Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api-headless-cms): singleton schema missing input #4315

Merged
merged 3 commits into from
Oct 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/pullRequests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,10 +174,10 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
package: >-
${{
fromJson('[{"cmd":"packages/api","id":"api"},{"cmd":"packages/api-admin-settings","id":"api-admin-settings"},{"cmd":"packages/api-authentication","id":"api-authentication"},{"cmd":"packages/api-authentication-cognito","id":"api-authentication-cognito"},{"cmd":"packages/api-headless-cms-ddb","id":"api-headless-cms-ddb"},{"cmd":"packages/api-record-locking","id":"api-record-locking"},{"cmd":"packages/api-wcp","id":"api-wcp"},{"cmd":"packages/api-websockets","id":"api-websockets"},{"cmd":"packages/app-aco","id":"app-aco"},{"cmd":"packages/app-admin","id":"app-admin"},{"cmd":"packages/cwp-template-aws","id":"cwp-template-aws"},{"cmd":"packages/data-migration","id":"data-migration"},{"cmd":"packages/db-dynamodb","id":"db-dynamodb"},{"cmd":"packages/form","id":"form"},{"cmd":"packages/handler","id":"handler"},{"cmd":"packages/handler-aws","id":"handler-aws"},{"cmd":"packages/handler-graphql","id":"handler-graphql"},{"cmd":"packages/handler-logs","id":"handler-logs"},{"cmd":"packages/ioc","id":"ioc"},{"cmd":"packages/lexical-converter","id":"lexical-converter"},{"cmd":"packages/plugins","id":"plugins"},{"cmd":"packages/pubsub","id":"pubsub"},{"cmd":"packages/react-composition","id":"react-composition"},{"cmd":"packages/react-properties","id":"react-properties"},{"cmd":"packages/react-rich-text-lexical-renderer","id":"react-rich-text-lexical-renderer"},{"cmd":"packages/utils","id":"utils"},{"cmd":"packages/validation","id":"validation"}]')
fromJson('[{"cmd":"packages/api","id":"api"},{"cmd":"packages/api-admin-settings","id":"api-admin-settings"},{"cmd":"packages/api-authentication","id":"api-authentication"},{"cmd":"packages/api-authentication-cognito","id":"api-authentication-cognito"},{"cmd":"packages/api-headless-cms-ddb","id":"api-headless-cms-ddb"},{"cmd":"packages/api-headless-cms-import-export","id":"api-headless-cms-import-export"},{"cmd":"packages/api-record-locking","id":"api-record-locking"},{"cmd":"packages/api-wcp","id":"api-wcp"},{"cmd":"packages/api-websockets","id":"api-websockets"},{"cmd":"packages/app-aco","id":"app-aco"},{"cmd":"packages/app-admin","id":"app-admin"},{"cmd":"packages/cwp-template-aws","id":"cwp-template-aws"},{"cmd":"packages/data-migration","id":"data-migration"},{"cmd":"packages/db-dynamodb","id":"db-dynamodb"},{"cmd":"packages/form","id":"form"},{"cmd":"packages/handler","id":"handler"},{"cmd":"packages/handler-aws","id":"handler-aws"},{"cmd":"packages/handler-graphql","id":"handler-graphql"},{"cmd":"packages/handler-logs","id":"handler-logs"},{"cmd":"packages/ioc","id":"ioc"},{"cmd":"packages/lexical-converter","id":"lexical-converter"},{"cmd":"packages/plugins","id":"plugins"},{"cmd":"packages/pubsub","id":"pubsub"},{"cmd":"packages/react-composition","id":"react-composition"},{"cmd":"packages/react-properties","id":"react-properties"},{"cmd":"packages/react-rich-text-lexical-renderer","id":"react-rich-text-lexical-renderer"},{"cmd":"packages/utils","id":"utils"},{"cmd":"packages/validation","id":"validation"}]')
}}
runs-on: ${{ matrix.os }}
env:
Expand Down Expand Up @@ -218,7 +218,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
package: >-
${{ fromJson('[{"cmd":"packages/api-aco
--storage=ddb","storage":"ddb","id":"api-aco_ddb"},{"cmd":"packages/api-apw
Expand Down Expand Up @@ -279,7 +279,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
package: >-
${{ fromJson('[{"cmd":"packages/api-aco
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-aco_ddb-es_ddb"},{"cmd":"packages/api-audit-logs
Expand Down Expand Up @@ -350,7 +350,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
package: >-
${{ fromJson('[{"cmd":"packages/api-aco
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-aco_ddb-os_ddb"},{"cmd":"packages/api-audit-logs
Expand Down Expand Up @@ -479,7 +479,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
runs-on: ${{ matrix.os }}
steps:
- uses: actions/setup-node@v4
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/pullRequestsCommandCypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
cypress-folder: >-
${{ fromJson(needs.e2e-wby-cms-ddb-constants.outputs.cypress-folders)
}}
Expand Down Expand Up @@ -559,7 +559,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
cypress-folder: >-
${{
fromJson(needs.e2e-wby-cms-ddb-es-constants.outputs.cypress-folders)
Expand Down Expand Up @@ -799,7 +799,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
cypress-folder: >-
${{
fromJson(needs.e2e-wby-cms-ddb-os-constants.outputs.cypress-folders)
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/pushDev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
package: >-
${{
fromJson('[{"cmd":"packages/api","id":"api"},{"cmd":"packages/api-admin-settings","id":"api-admin-settings"},{"cmd":"packages/api-authentication","id":"api-authentication"},{"cmd":"packages/api-authentication-cognito","id":"api-authentication-cognito"},{"cmd":"packages/api-headless-cms-ddb","id":"api-headless-cms-ddb"},{"cmd":"packages/api-record-locking","id":"api-record-locking"},{"cmd":"packages/api-wcp","id":"api-wcp"},{"cmd":"packages/api-websockets","id":"api-websockets"},{"cmd":"packages/app-aco","id":"app-aco"},{"cmd":"packages/app-admin","id":"app-admin"},{"cmd":"packages/cwp-template-aws","id":"cwp-template-aws"},{"cmd":"packages/data-migration","id":"data-migration"},{"cmd":"packages/db-dynamodb","id":"db-dynamodb"},{"cmd":"packages/form","id":"form"},{"cmd":"packages/handler","id":"handler"},{"cmd":"packages/handler-aws","id":"handler-aws"},{"cmd":"packages/handler-graphql","id":"handler-graphql"},{"cmd":"packages/handler-logs","id":"handler-logs"},{"cmd":"packages/ioc","id":"ioc"},{"cmd":"packages/lexical-converter","id":"lexical-converter"},{"cmd":"packages/plugins","id":"plugins"},{"cmd":"packages/pubsub","id":"pubsub"},{"cmd":"packages/react-composition","id":"react-composition"},{"cmd":"packages/react-properties","id":"react-properties"},{"cmd":"packages/react-rich-text-lexical-renderer","id":"react-rich-text-lexical-renderer"},{"cmd":"packages/utils","id":"utils"},{"cmd":"packages/validation","id":"validation"}]')
fromJson('[{"cmd":"packages/api","id":"api"},{"cmd":"packages/api-admin-settings","id":"api-admin-settings"},{"cmd":"packages/api-authentication","id":"api-authentication"},{"cmd":"packages/api-authentication-cognito","id":"api-authentication-cognito"},{"cmd":"packages/api-headless-cms-ddb","id":"api-headless-cms-ddb"},{"cmd":"packages/api-headless-cms-import-export","id":"api-headless-cms-import-export"},{"cmd":"packages/api-record-locking","id":"api-record-locking"},{"cmd":"packages/api-wcp","id":"api-wcp"},{"cmd":"packages/api-websockets","id":"api-websockets"},{"cmd":"packages/app-aco","id":"app-aco"},{"cmd":"packages/app-admin","id":"app-admin"},{"cmd":"packages/cwp-template-aws","id":"cwp-template-aws"},{"cmd":"packages/data-migration","id":"data-migration"},{"cmd":"packages/db-dynamodb","id":"db-dynamodb"},{"cmd":"packages/form","id":"form"},{"cmd":"packages/handler","id":"handler"},{"cmd":"packages/handler-aws","id":"handler-aws"},{"cmd":"packages/handler-graphql","id":"handler-graphql"},{"cmd":"packages/handler-logs","id":"handler-logs"},{"cmd":"packages/ioc","id":"ioc"},{"cmd":"packages/lexical-converter","id":"lexical-converter"},{"cmd":"packages/plugins","id":"plugins"},{"cmd":"packages/pubsub","id":"pubsub"},{"cmd":"packages/react-composition","id":"react-composition"},{"cmd":"packages/react-properties","id":"react-properties"},{"cmd":"packages/react-rich-text-lexical-renderer","id":"react-rich-text-lexical-renderer"},{"cmd":"packages/utils","id":"utils"},{"cmd":"packages/validation","id":"validation"}]')
}}
runs-on: ${{ matrix.os }}
env:
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
package: >-
${{ fromJson('[{"cmd":"packages/api-aco
--storage=ddb","storage":"ddb","id":"api-aco_ddb"},{"cmd":"packages/api-apw
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
package: >-
${{ fromJson('[{"cmd":"packages/api-aco
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-aco_ddb-es_ddb"},{"cmd":"packages/api-audit-logs
Expand Down Expand Up @@ -315,7 +315,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
package: >-
${{ fromJson('[{"cmd":"packages/api-aco
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-aco_ddb-os_ddb"},{"cmd":"packages/api-audit-logs
Expand Down Expand Up @@ -537,7 +537,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
cypress-folder: ${{ fromJson(needs.e2eTestsDdb-constants.outputs.cypress-folders) }}
environment: next
env:
Expand Down Expand Up @@ -744,7 +744,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
cypress-folder: >-
${{ fromJson(needs.e2eTestsDdb-es-constants.outputs.cypress-folders)
}}
Expand Down Expand Up @@ -956,7 +956,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
cypress-folder: >-
${{ fromJson(needs.e2eTestsDdb-os-constants.outputs.cypress-folders)
}}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/pushNext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -140,10 +140,10 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
package: >-
${{
fromJson('[{"cmd":"packages/api","id":"api"},{"cmd":"packages/api-admin-settings","id":"api-admin-settings"},{"cmd":"packages/api-authentication","id":"api-authentication"},{"cmd":"packages/api-authentication-cognito","id":"api-authentication-cognito"},{"cmd":"packages/api-headless-cms-ddb","id":"api-headless-cms-ddb"},{"cmd":"packages/api-record-locking","id":"api-record-locking"},{"cmd":"packages/api-wcp","id":"api-wcp"},{"cmd":"packages/api-websockets","id":"api-websockets"},{"cmd":"packages/app-aco","id":"app-aco"},{"cmd":"packages/app-admin","id":"app-admin"},{"cmd":"packages/cwp-template-aws","id":"cwp-template-aws"},{"cmd":"packages/data-migration","id":"data-migration"},{"cmd":"packages/db-dynamodb","id":"db-dynamodb"},{"cmd":"packages/form","id":"form"},{"cmd":"packages/handler","id":"handler"},{"cmd":"packages/handler-aws","id":"handler-aws"},{"cmd":"packages/handler-graphql","id":"handler-graphql"},{"cmd":"packages/handler-logs","id":"handler-logs"},{"cmd":"packages/ioc","id":"ioc"},{"cmd":"packages/lexical-converter","id":"lexical-converter"},{"cmd":"packages/plugins","id":"plugins"},{"cmd":"packages/pubsub","id":"pubsub"},{"cmd":"packages/react-composition","id":"react-composition"},{"cmd":"packages/react-properties","id":"react-properties"},{"cmd":"packages/react-rich-text-lexical-renderer","id":"react-rich-text-lexical-renderer"},{"cmd":"packages/utils","id":"utils"},{"cmd":"packages/validation","id":"validation"}]')
fromJson('[{"cmd":"packages/api","id":"api"},{"cmd":"packages/api-admin-settings","id":"api-admin-settings"},{"cmd":"packages/api-authentication","id":"api-authentication"},{"cmd":"packages/api-authentication-cognito","id":"api-authentication-cognito"},{"cmd":"packages/api-headless-cms-ddb","id":"api-headless-cms-ddb"},{"cmd":"packages/api-headless-cms-import-export","id":"api-headless-cms-import-export"},{"cmd":"packages/api-record-locking","id":"api-record-locking"},{"cmd":"packages/api-wcp","id":"api-wcp"},{"cmd":"packages/api-websockets","id":"api-websockets"},{"cmd":"packages/app-aco","id":"app-aco"},{"cmd":"packages/app-admin","id":"app-admin"},{"cmd":"packages/cwp-template-aws","id":"cwp-template-aws"},{"cmd":"packages/data-migration","id":"data-migration"},{"cmd":"packages/db-dynamodb","id":"db-dynamodb"},{"cmd":"packages/form","id":"form"},{"cmd":"packages/handler","id":"handler"},{"cmd":"packages/handler-aws","id":"handler-aws"},{"cmd":"packages/handler-graphql","id":"handler-graphql"},{"cmd":"packages/handler-logs","id":"handler-logs"},{"cmd":"packages/ioc","id":"ioc"},{"cmd":"packages/lexical-converter","id":"lexical-converter"},{"cmd":"packages/plugins","id":"plugins"},{"cmd":"packages/pubsub","id":"pubsub"},{"cmd":"packages/react-composition","id":"react-composition"},{"cmd":"packages/react-properties","id":"react-properties"},{"cmd":"packages/react-rich-text-lexical-renderer","id":"react-rich-text-lexical-renderer"},{"cmd":"packages/utils","id":"utils"},{"cmd":"packages/validation","id":"validation"}]')
}}
runs-on: ${{ matrix.os }}
env:
Expand Down Expand Up @@ -184,7 +184,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
package: >-
${{ fromJson('[{"cmd":"packages/api-aco
--storage=ddb","storage":"ddb","id":"api-aco_ddb"},{"cmd":"packages/api-apw
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
package: >-
${{ fromJson('[{"cmd":"packages/api-aco
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-aco_ddb-es_ddb"},{"cmd":"packages/api-audit-logs
Expand Down Expand Up @@ -315,7 +315,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
package: >-
${{ fromJson('[{"cmd":"packages/api-aco
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-aco_ddb-os_ddb"},{"cmd":"packages/api-audit-logs
Expand Down Expand Up @@ -537,7 +537,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
cypress-folder: ${{ fromJson(needs.e2eTestsDdb-constants.outputs.cypress-folders) }}
environment: next
env:
Expand Down Expand Up @@ -744,7 +744,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
cypress-folder: >-
${{ fromJson(needs.e2eTestsDdb-es-constants.outputs.cypress-folders)
}}
Expand Down Expand Up @@ -956,7 +956,7 @@ jobs:
os:
- ubuntu-latest
node:
- 18
- 20
cypress-folder: >-
${{ fromJson(needs.e2eTestsDdb-os-constants.outputs.cypress-folders)
}}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/wac/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const NODE_VERSION = 18;
export const NODE_VERSION = 20;

export const NODE_OPTIONS = "--max_old_space_size=4096";

Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/wac/utils/listPackagesWithJestTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,19 @@ const CUSTOM_HANDLERS: Record<string, () => Array<PackageWithTests>> = {
{ cmd: "packages/api-headless-cms --storage=ddb-os,ddb", storage: "ddb-os" }
];
},
"api-headless-cms-import-export": () => {
return [
{ cmd: "packages/api-headless-cms-import-export --storage=ddb", storage: "ddb" },
{
cmd: "packages/api-headless-cms-import-export --storage=ddb-es,ddb",
storage: "ddb-es"
},
{
cmd: "packages/api-headless-cms-import-export --storage=ddb-os,ddb",
storage: "ddb-os"
}
];
},
"api-headless-cms-ddb-es": () => {
return [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe("import from url controller", () => {
});

it("should run the task, trigger child tasks and return a continue response", async () => {
expect.assertions(3);
expect.assertions(5);
const definition = createImportFromUrlControllerTask();

const files: NonEmptyArray<ICmsImportExportValidatedFile> = [
Expand All @@ -176,16 +176,6 @@ describe("import from url controller", () => {
checksum: "checksum",
checked: true,
key: "file-2.wa.zip"
},
{
get: "https://some-url.com/file-3.unknown.zip",
head: "https://some-url.com/file-3.unknown.zip",
size: 2000,
error: undefined,
type: "unknown" as CmsImportExportFileType.ENTRIES,
checksum: "checksum",
checked: true,
key: "something-unknown.zip"
}
];

Expand All @@ -203,16 +193,19 @@ describe("import from url controller", () => {
const runner = createRunner({
context,
task: definition,
onContinue: async ({ taskId, iteration, result }) => {
if (iteration === 1) {
return;
}
onContinue: async ({ taskId, result }) => {
const children = await context.tasks.listTasks({
where: {
parentId: taskId
},
limit: 1000000
});
/**
* Don't update again if not required.
*/
if (children.items.every(child => child.taskStatus === TaskDataStatus.SUCCESS)) {
return;
}
for (const child of children.items) {
await context.tasks.updateTask(child.id, {
taskStatus: TaskDataStatus.SUCCESS
Expand Down Expand Up @@ -256,22 +249,6 @@ describe("import from url controller", () => {
locale: "en-US"
});

expect(result).toEqual({
message: undefined,
output: {
aborted: [],
done: [],
failed: [],
files: [],
invalid: []
},
locale: "en-US",
status: "done",
tenant: "root",
webinyTaskDefinitionId: "importFromUrlController",
webinyTaskId: expect.any(String)
});

// assertion #2
expect(result).toEqual({
status: TaskResponseStatus.DONE,
Expand All @@ -284,7 +261,7 @@ describe("import from url controller", () => {
done: [],
failed: [],
invalid: [],
files: []
files: ["cms-import/file-1.we.zip", "cms-import/file-2.wa.zip"]
},
message: undefined
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe("entry assets resolver", () => {
try {
await context.fileManager.createFile(image.data);
} catch (ex) {
console.log(ex);
console.error(ex);
expect(ex.message).toEqual("Must not happen!");
}
}
Expand Down
Loading
Loading