-
Notifications
You must be signed in to change notification settings - Fork 618
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'refs/remotes/origin/dev' into adrian/de…
…v-next-merge
- Loading branch information
Showing
190 changed files
with
28,762 additions
and
396 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { Plugin } from "@webiny/plugins/types"; | ||
import { createBackgroundTaskGraphQL, createBackgroundTaskContext } from "@webiny/tasks"; | ||
import { createElasticsearchBackgroundTasks } from "@webiny/api-elasticsearch-tasks"; | ||
import { createHeadlessCmsEsTasks } from "@webiny/api-headless-cms-es-tasks"; | ||
|
||
export const createBackgroundTasks = (): Plugin[] => { | ||
return [ | ||
...createBackgroundTaskContext(), | ||
...createBackgroundTaskGraphQL(), | ||
...createElasticsearchBackgroundTasks() | ||
...createElasticsearchBackgroundTasks(), | ||
...createHeadlessCmsEsTasks() | ||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
import { Plugin } from "@webiny/plugins/types"; | ||
import { createBackgroundTaskGraphQL, createBackgroundTaskContext } from "@webiny/tasks"; | ||
import { createElasticsearchBackgroundTasks } from "@webiny/api-elasticsearch-tasks"; | ||
import { createHeadlessCmsEsTasks } from "@webiny/api-headless-cms-es-tasks"; | ||
|
||
export const createBackgroundTasks = (): Plugin[] => { | ||
return [ | ||
...createBackgroundTaskContext(), | ||
...createBackgroundTaskGraphQL(), | ||
...createElasticsearchBackgroundTasks() | ||
...createElasticsearchBackgroundTasks(), | ||
...createHeadlessCmsEsTasks() | ||
]; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
packages/api-dynamodb-to-elasticsearch/__tests__/transfer.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import { createEventHandler, Operations } from "~/index"; | ||
import { createElasticsearchClient } from "@webiny/project-utils/testing/elasticsearch/createClient"; | ||
import { ElasticsearchContext } from "@webiny/api-elasticsearch/types"; | ||
import { Context, LambdaContext, Reply, Request } from "@webiny/handler-aws/types"; | ||
import { marshall } from "@webiny/aws-sdk/client-dynamodb"; | ||
import { PluginsContainer } from "@webiny/plugins"; | ||
|
||
describe("transfer data", () => { | ||
it("should transfer data from event to elasticsearch", async () => { | ||
const event = createEventHandler(); | ||
|
||
const elasticsearch = createElasticsearchClient(); | ||
|
||
const context = { | ||
elasticsearch, | ||
plugins: new PluginsContainer() | ||
} as unknown as ElasticsearchContext & Context; | ||
/** | ||
* Register index which is going to get created, so it can be deleted after the test. | ||
*/ | ||
const index = "a-test-index"; | ||
elasticsearch.indices.registerIndex(index); | ||
|
||
const result = await event.cb({ | ||
context, | ||
reply: {} as Reply, | ||
request: {} as Request, | ||
event: { | ||
Records: [ | ||
{ | ||
eventName: Operations.INSERT, | ||
dynamodb: { | ||
Keys: marshall({ | ||
PK: "PK_TEST", | ||
SK: "SK_TEST" | ||
}) as any, | ||
NewImage: marshall({ | ||
index, | ||
ignore: false, | ||
data: { | ||
title: "Hello World" | ||
} | ||
}) as any | ||
} | ||
} | ||
] | ||
}, | ||
lambdaContext: {} as LambdaContext, | ||
next: jest.fn() | ||
}); | ||
|
||
expect(result).toEqual(null); | ||
|
||
await elasticsearch.indices.deleteAll(); | ||
}); | ||
}); |
3 changes: 3 additions & 0 deletions
3
packages/api-dynamodb-to-elasticsearch/src/NotEnoughRemainingTimeError.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import { WebinyError } from "@webiny/error"; | ||
|
||
export class NotEnoughRemainingTimeError extends WebinyError {} |
Oops, something went wrong.