Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/origin/dev' into adrian/de…
Browse files Browse the repository at this point in the history
…v-next-merge
  • Loading branch information
adrians5j committed Jun 12, 2024
2 parents 63ad55f + ce7781a commit 716a967
Show file tree
Hide file tree
Showing 190 changed files with 28,762 additions and 396 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/wac/utils/listPackagesWithJestTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,30 @@ const CUSTOM_HANDLERS: Record<string, () => Array<PackageWithTests>> = {
}
];
},
"api-dynamodb-to-elasticsearch": () => {
return [
{
cmd: "packages/api-dynamodb-to-elasticsearch --storage=ddb-es,ddb",
storage: ["ddb-es"]
},
{
cmd: "packages/api-dynamodb-to-elasticsearch --storage=ddb-os,ddb",
storage: ["ddb-os"]
}
];
},
"api-headless-cms-es-tasks": () => {
return [
{
cmd: "packages/api-headless-cms-es-tasks --storage=ddb-es,ddb",
storage: ["ddb-es"]
},
{
cmd: "packages/api-headless-cms-es-tasks --storage=ddb-os,ddb",
storage: ["ddb-os"]
}
];
},
tasks: () => {
return [
{ cmd: "packages/tasks --storage=ddb", storage: "ddb" },
Expand Down
1 change: 1 addition & 0 deletions packages/api-background-tasks-es/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"license": "MIT",
"dependencies": {
"@webiny/api-elasticsearch-tasks": "0.0.0",
"@webiny/api-headless-cms-es-tasks": "0.0.0",
"@webiny/plugins": "0.0.0",
"@webiny/tasks": "0.0.0"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/api-background-tasks-es/src/index.ts
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()
];
};
1 change: 1 addition & 0 deletions packages/api-background-tasks-es/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"include": ["src"],
"references": [
{ "path": "../api-elasticsearch-tasks/tsconfig.build.json" },
{ "path": "../api-headless-cms-es-tasks/tsconfig.build.json" },
{ "path": "../plugins/tsconfig.build.json" },
{ "path": "../tasks/tsconfig.build.json" }
],
Expand Down
3 changes: 3 additions & 0 deletions packages/api-background-tasks-es/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"include": ["src", "__tests__"],
"references": [
{ "path": "../api-elasticsearch-tasks" },
{ "path": "../api-headless-cms-es-tasks" },
{ "path": "../plugins" },
{ "path": "../tasks" }
],
Expand All @@ -15,6 +16,8 @@
"~tests/*": ["./__tests__/*"],
"@webiny/api-elasticsearch-tasks/*": ["../api-elasticsearch-tasks/src/*"],
"@webiny/api-elasticsearch-tasks": ["../api-elasticsearch-tasks/src"],
"@webiny/api-headless-cms-es-tasks/*": ["../api-headless-cms-es-tasks/src/*"],
"@webiny/api-headless-cms-es-tasks": ["../api-headless-cms-es-tasks/src"],
"@webiny/plugins/*": ["../plugins/src/*"],
"@webiny/plugins": ["../plugins/src"],
"@webiny/tasks/*": ["../tasks/src/*"],
Expand Down
1 change: 1 addition & 0 deletions packages/api-background-tasks-os/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"license": "MIT",
"dependencies": {
"@webiny/api-elasticsearch-tasks": "0.0.0",
"@webiny/api-headless-cms-es-tasks": "0.0.0",
"@webiny/plugins": "0.0.0",
"@webiny/tasks": "0.0.0"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/api-background-tasks-os/src/index.ts
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()
];
};
1 change: 1 addition & 0 deletions packages/api-background-tasks-os/tsconfig.build.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"include": ["src"],
"references": [
{ "path": "../api-elasticsearch-tasks/tsconfig.build.json" },
{ "path": "../api-headless-cms-es-tasks/tsconfig.build.json" },
{ "path": "../plugins/tsconfig.build.json" },
{ "path": "../tasks/tsconfig.build.json" }
],
Expand Down
3 changes: 3 additions & 0 deletions packages/api-background-tasks-os/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"include": ["src", "__tests__"],
"references": [
{ "path": "../api-elasticsearch-tasks" },
{ "path": "../api-headless-cms-es-tasks" },
{ "path": "../plugins" },
{ "path": "../tasks" }
],
Expand All @@ -15,6 +16,8 @@
"~tests/*": ["./__tests__/*"],
"@webiny/api-elasticsearch-tasks/*": ["../api-elasticsearch-tasks/src/*"],
"@webiny/api-elasticsearch-tasks": ["../api-elasticsearch-tasks/src"],
"@webiny/api-headless-cms-es-tasks/*": ["../api-headless-cms-es-tasks/src/*"],
"@webiny/api-headless-cms-es-tasks": ["../api-headless-cms-es-tasks/src"],
"@webiny/plugins/*": ["../plugins/src/*"],
"@webiny/plugins": ["../plugins/src"],
"@webiny/tasks/*": ["../tasks/src/*"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ describe("event", () => {
},
lambdaContext,
request,
reply
reply,
next: jest.fn()
});

expect(result).toEqual(null);
Expand All @@ -86,7 +87,8 @@ describe("event", () => {
event,
lambdaContext,
request,
reply
reply,
next: jest.fn()
});

expect(result).toEqual(null);
Expand Down
56 changes: 56 additions & 0 deletions packages/api-dynamodb-to-elasticsearch/__tests__/transfer.test.ts
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();
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { WebinyError } from "@webiny/error";

export class NotEnoughRemainingTimeError extends WebinyError {}
Loading

0 comments on commit 716a967

Please sign in to comment.