Skip to content

Commit

Permalink
feat(api-headless-cms): add crud operation to restore entry from tras…
Browse files Browse the repository at this point in the history
…h bin (#4064)
  • Loading branch information
leopuleo authored Apr 12, 2024
1 parent 517c703 commit 705277f
Show file tree
Hide file tree
Showing 85 changed files with 2,871 additions and 51 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/pullRequests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ jobs:
--storage=ddb","storage":"ddb","id":"api-audit-logs_ddb"},{"cmd":"packages/api-file-manager
--storage=ddb","storage":"ddb","id":"api-file-manager_ddb"},{"cmd":"packages/api-form-builder
--storage=ddb","storage":"ddb","id":"api-form-builder_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb","storage":"ddb","id":"api-headless-cms_ddb"},{"cmd":"packages/api-i18n
--storage=ddb","storage":"ddb","id":"api-headless-cms_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb","storage":"ddb","id":"api-headless-cms-aco_ddb"},{"cmd":"packages/api-i18n
--storage=ddb","storage":"ddb","id":"api-i18n_ddb"},{"cmd":"packages/api-mailer
--storage=ddb","storage":"ddb","id":"api-mailer_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb","storage":"ddb","id":"api-page-builder_ddb"},{"cmd":"packages/api-page-builder-aco
Expand Down Expand Up @@ -286,7 +287,8 @@ jobs:
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-file-manager_ddb-es_ddb"},{"cmd":"packages/api-form-builder
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-form-builder_ddb-es_ddb"},{"cmd":"packages/api-form-builder-so-ddb-es
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-form-builder-so-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-aco_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-mailer_ddb-es_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-page-builder_ddb-es_ddb"},{"cmd":"packages/api-page-builder-aco
Expand Down Expand Up @@ -353,7 +355,8 @@ jobs:
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-file-manager_ddb-os_ddb"},{"cmd":"packages/api-form-builder
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-form-builder_ddb-os_ddb"},{"cmd":"packages/api-form-builder-so-ddb-es
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-form-builder-so-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-aco_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-mailer_ddb-os_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-page-builder_ddb-os_ddb"},{"cmd":"packages/api-page-builder-aco
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/pushDev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ jobs:
--storage=ddb","storage":"ddb","id":"api-audit-logs_ddb"},{"cmd":"packages/api-file-manager
--storage=ddb","storage":"ddb","id":"api-file-manager_ddb"},{"cmd":"packages/api-form-builder
--storage=ddb","storage":"ddb","id":"api-form-builder_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb","storage":"ddb","id":"api-headless-cms_ddb"},{"cmd":"packages/api-i18n
--storage=ddb","storage":"ddb","id":"api-headless-cms_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb","storage":"ddb","id":"api-headless-cms-aco_ddb"},{"cmd":"packages/api-i18n
--storage=ddb","storage":"ddb","id":"api-i18n_ddb"},{"cmd":"packages/api-mailer
--storage=ddb","storage":"ddb","id":"api-mailer_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb","storage":"ddb","id":"api-page-builder_ddb"},{"cmd":"packages/api-page-builder-aco
Expand Down Expand Up @@ -252,7 +253,8 @@ jobs:
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-file-manager_ddb-es_ddb"},{"cmd":"packages/api-form-builder
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-form-builder_ddb-es_ddb"},{"cmd":"packages/api-form-builder-so-ddb-es
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-form-builder-so-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-aco_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-mailer_ddb-es_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-page-builder_ddb-es_ddb"},{"cmd":"packages/api-page-builder-aco
Expand Down Expand Up @@ -318,7 +320,8 @@ jobs:
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-file-manager_ddb-os_ddb"},{"cmd":"packages/api-form-builder
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-form-builder_ddb-os_ddb"},{"cmd":"packages/api-form-builder-so-ddb-es
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-form-builder-so-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-aco_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-mailer_ddb-os_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-page-builder_ddb-os_ddb"},{"cmd":"packages/api-page-builder-aco
Expand Down
9 changes: 6 additions & 3 deletions .github/workflows/pushNext.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ jobs:
--storage=ddb","storage":"ddb","id":"api-audit-logs_ddb"},{"cmd":"packages/api-file-manager
--storage=ddb","storage":"ddb","id":"api-file-manager_ddb"},{"cmd":"packages/api-form-builder
--storage=ddb","storage":"ddb","id":"api-form-builder_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb","storage":"ddb","id":"api-headless-cms_ddb"},{"cmd":"packages/api-i18n
--storage=ddb","storage":"ddb","id":"api-headless-cms_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb","storage":"ddb","id":"api-headless-cms-aco_ddb"},{"cmd":"packages/api-i18n
--storage=ddb","storage":"ddb","id":"api-i18n_ddb"},{"cmd":"packages/api-mailer
--storage=ddb","storage":"ddb","id":"api-mailer_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb","storage":"ddb","id":"api-page-builder_ddb"},{"cmd":"packages/api-page-builder-aco
Expand Down Expand Up @@ -252,7 +253,8 @@ jobs:
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-file-manager_ddb-es_ddb"},{"cmd":"packages/api-form-builder
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-form-builder_ddb-es_ddb"},{"cmd":"packages/api-form-builder-so-ddb-es
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-form-builder-so-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-aco_ddb-es_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-headless-cms-ddb-es_ddb-es_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-mailer_ddb-es_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb-es,ddb","storage":"ddb-es","id":"api-page-builder_ddb-es_ddb"},{"cmd":"packages/api-page-builder-aco
Expand Down Expand Up @@ -318,7 +320,8 @@ jobs:
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-file-manager_ddb-os_ddb"},{"cmd":"packages/api-form-builder
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-form-builder_ddb-os_ddb"},{"cmd":"packages/api-form-builder-so-ddb-es
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-form-builder-so-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-headless-cms
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-aco
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-aco_ddb-os_ddb"},{"cmd":"packages/api-headless-cms-ddb-es
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-headless-cms-ddb-es_ddb-os_ddb"},{"cmd":"packages/api-mailer
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-mailer_ddb-os_ddb"},{"cmd":"packages/api-page-builder
--storage=ddb-os,ddb","storage":"ddb-os","id":"api-page-builder_ddb-os_ddb"},{"cmd":"packages/api-page-builder-aco
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/wac/utils/listPackagesWithJestTests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,13 @@ const CUSTOM_HANDLERS: Record<string, () => Array<PackageWithTests>> = {
}
];
},
"api-headless-cms-aco": () => {
return [
{ cmd: "packages/api-headless-cms-aco --storage=ddb", storage: "ddb" },
{ cmd: "packages/api-headless-cms-aco --storage=ddb-es,ddb", storage: "ddb-es" },
{ cmd: "packages/api-headless-cms-aco --storage=ddb-os,ddb", storage: "ddb-os" }
];
},
"api-apw": () => {
return [
{ cmd: "packages/api-apw --storage=ddb", storage: "ddb" }
Expand Down Expand Up @@ -250,7 +257,7 @@ function hasTestFiles(packageFolderPath: string) {
}

const files = fs.readdirSync(packageFolderPath);
for (let filename of files) {
for (const filename of files) {
const filepath = path.join(packageFolderPath, filename);
if (fs.statSync(filepath).isDirectory()) {
const hasTFiles = hasTestFiles(filepath);
Expand Down
1 change: 1 addition & 0 deletions apps/api/graphql/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"@webiny/api-form-builder": "0.0.0",
"@webiny/api-form-builder-so-ddb": "0.0.0",
"@webiny/api-headless-cms": "0.0.0",
"@webiny/api-headless-cms-aco": "0.0.0",
"@webiny/api-headless-cms-ddb": "0.0.0",
"@webiny/api-i18n": "0.0.0",
"@webiny/api-i18n-content": "0.0.0",
Expand Down
4 changes: 3 additions & 1 deletion apps/api/graphql/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import fileManagerS3, { createAssetDelivery } from "@webiny/api-file-manager-s3"
import { createFormBuilder } from "@webiny/api-form-builder";
import { createFormBuilderStorageOperations } from "@webiny/api-form-builder-so-ddb";
import { createHeadlessCmsContext, createHeadlessCmsGraphQL } from "@webiny/api-headless-cms";
import { createAcoHcmsContext } from "@webiny/api-headless-cms-aco";
import { createStorageOperations as createHeadlessCmsStorageOperations } from "@webiny/api-headless-cms-ddb";
import securityPlugins from "./security";
import tenantManager from "@webiny/api-tenant-manager";
Expand Down Expand Up @@ -128,7 +129,8 @@ export const handler = createHandler({
}),
createAuditLogs(),
createCountDynamoDbTask(),
createContinuingTask()
createContinuingTask(),
createAcoHcmsContext()
],
debug
});
4 changes: 3 additions & 1 deletion apps/api/graphql/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { CmsContext } from "@webiny/api-headless-cms/types";
import { AcoContext } from "@webiny/api-aco/types";
import { PbAcoContext } from "@webiny/api-page-builder-aco/types";
import { Context as TasksContext } from "@webiny/tasks/types";
import { HcmsAcoContext } from "@webiny/api-headless-cms-aco/types";

// When working with the `context` object (for example while defining a new GraphQL resolver function),
// you can import this interface and assign it to it. This will give you full autocomplete functionality
Expand All @@ -25,4 +26,5 @@ export interface Context
FormBuilderContext,
AcoContext,
TasksContext,
PbAcoContext {}
PbAcoContext,
HcmsAcoContext {}
5 changes: 5 additions & 0 deletions apps/api/graphql/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
{
"path": "../../../packages/api-headless-cms/tsconfig.build.json"
},
{
"path": "../../../packages/api-headless-cms-aco/tsconfig.build.json"
},
{
"path": "../../../packages/api-headless-cms-ddb/tsconfig.build.json"
},
Expand Down Expand Up @@ -143,6 +146,8 @@
"@webiny/api-form-builder-so-ddb": ["../../../packages/api-form-builder-so-ddb/src"],
"@webiny/api-headless-cms/*": ["../../../packages/api-headless-cms/src/*"],
"@webiny/api-headless-cms": ["../../../packages/api-headless-cms/src"],
"@webiny/api-headless-cms-aco/*": ["../../../packages/api-headless-cms-aco/src/*"],
"@webiny/api-headless-cms-aco": ["../../../packages/api-headless-cms-aco/src"],
"@webiny/api-headless-cms-ddb/*": ["../../../packages/api-headless-cms-ddb/src/*"],
"@webiny/api-headless-cms-ddb": ["../../../packages/api-headless-cms-ddb/src"],
"@webiny/api-i18n/*": ["../../../packages/api-i18n/src/*"],
Expand Down
26 changes: 26 additions & 0 deletions packages/api-aco/__tests__/snapshots/customAppsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,13 @@ export const createCustomAppsSchemaSnapshot = () => {
deletedOn_lte: DateTime
deletedOn_between: [DateTime!]
deletedOn_not_between: [DateTime!]
restoredOn: DateTime
restoredOn_gt: DateTime
restoredOn_gte: DateTime
restoredOn_lt: DateTime
restoredOn_lte: DateTime
restoredOn_between: [DateTime!]
restoredOn_not_between: [DateTime!]
firstPublishedOn: DateTime
firstPublishedOn_gt: DateTime
firstPublishedOn_gte: DateTime
Expand Down Expand Up @@ -246,6 +253,10 @@ export const createCustomAppsSchemaSnapshot = () => {
deletedBy_not: ID
deletedBy_in: [ID!]
deletedBy_not_in: [ID!]
restoredBy: ID
restoredBy_not: ID
restoredBy_in: [ID!]
restoredBy_not_in: [ID!]
firstPublishedBy: ID
firstPublishedBy_not: ID
firstPublishedBy_in: [ID!]
Expand Down Expand Up @@ -282,6 +293,13 @@ export const createCustomAppsSchemaSnapshot = () => {
revisionDeletedOn_lte: DateTime
revisionDeletedOn_between: [DateTime!]
revisionDeletedOn_not_between: [DateTime!]
revisionRestoredOn: DateTime
revisionRestoredOn_gt: DateTime
revisionRestoredOn_gte: DateTime
revisionRestoredOn_lt: DateTime
revisionRestoredOn_lte: DateTime
revisionRestoredOn_between: [DateTime!]
revisionRestoredOn_not_between: [DateTime!]
revisionFirstPublishedOn: DateTime
revisionFirstPublishedOn_gt: DateTime
revisionFirstPublishedOn_gte: DateTime
Expand Down Expand Up @@ -312,6 +330,10 @@ export const createCustomAppsSchemaSnapshot = () => {
revisionDeletedBy_not: ID
revisionDeletedBy_in: [ID!]
revisionDeletedBy_not_in: [ID!]
revisionRestoredBy: ID
revisionRestoredBy_not: ID
revisionRestoredBy_in: [ID!]
revisionRestoredBy_not_in: [ID!]
revisionFirstPublishedBy: ID
revisionFirstPublishedBy_not: ID
revisionFirstPublishedBy_in: [ID!]
Expand Down Expand Up @@ -385,6 +407,8 @@ export const createCustomAppsSchemaSnapshot = () => {
savedOn_DESC
deletedOn_ASC
deletedOn_DESC
restoredOn_ASC
restoredOn_DESC
firstPublishedOn_ASC
firstPublishedOn_DESC
lastPublishedOn_ASC
Expand All @@ -397,6 +421,8 @@ export const createCustomAppsSchemaSnapshot = () => {
revisionSavedOn_DESC
revisionDeletedOn_ASC
revisionDeletedOn_DESC
revisionRestoredOn_ASC
revisionRestoredOn_DESC
revisionFirstPublishedOn_ASC
revisionFirstPublishedOn_DESC
revisionLastPublishedOn_ASC
Expand Down
26 changes: 26 additions & 0 deletions packages/api-aco/__tests__/snapshots/defaultAppsSchema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,13 @@ export const createDefaultAppsSchemaSnapshot = () => {
deletedOn_lte: DateTime
deletedOn_between: [DateTime!]
deletedOn_not_between: [DateTime!]
restoredOn: DateTime
restoredOn_gt: DateTime
restoredOn_gte: DateTime
restoredOn_lt: DateTime
restoredOn_lte: DateTime
restoredOn_between: [DateTime!]
restoredOn_not_between: [DateTime!]
firstPublishedOn: DateTime
firstPublishedOn_gt: DateTime
firstPublishedOn_gte: DateTime
Expand Down Expand Up @@ -220,6 +227,10 @@ export const createDefaultAppsSchemaSnapshot = () => {
deletedBy_not: ID
deletedBy_in: [ID!]
deletedBy_not_in: [ID!]
restoredBy: ID
restoredBy_not: ID
restoredBy_in: [ID!]
restoredBy_not_in: [ID!]
firstPublishedBy: ID
firstPublishedBy_not: ID
firstPublishedBy_in: [ID!]
Expand Down Expand Up @@ -256,6 +267,13 @@ export const createDefaultAppsSchemaSnapshot = () => {
revisionDeletedOn_lte: DateTime
revisionDeletedOn_between: [DateTime!]
revisionDeletedOn_not_between: [DateTime!]
revisionRestoredOn: DateTime
revisionRestoredOn_gt: DateTime
revisionRestoredOn_gte: DateTime
revisionRestoredOn_lt: DateTime
revisionRestoredOn_lte: DateTime
revisionRestoredOn_between: [DateTime!]
revisionRestoredOn_not_between: [DateTime!]
revisionFirstPublishedOn: DateTime
revisionFirstPublishedOn_gt: DateTime
revisionFirstPublishedOn_gte: DateTime
Expand Down Expand Up @@ -286,6 +304,10 @@ export const createDefaultAppsSchemaSnapshot = () => {
revisionDeletedBy_not: ID
revisionDeletedBy_in: [ID!]
revisionDeletedBy_not_in: [ID!]
revisionRestoredBy: ID
revisionRestoredBy_not: ID
revisionRestoredBy_in: [ID!]
revisionRestoredBy_not_in: [ID!]
revisionFirstPublishedBy: ID
revisionFirstPublishedBy_not: ID
revisionFirstPublishedBy_in: [ID!]
Expand Down Expand Up @@ -359,6 +381,8 @@ export const createDefaultAppsSchemaSnapshot = () => {
savedOn_DESC
deletedOn_ASC
deletedOn_DESC
restoredOn_ASC
restoredOn_DESC
firstPublishedOn_ASC
firstPublishedOn_DESC
lastPublishedOn_ASC
Expand All @@ -371,6 +395,8 @@ export const createDefaultAppsSchemaSnapshot = () => {
revisionSavedOn_DESC
revisionDeletedOn_ASC
revisionDeletedOn_DESC
revisionRestoredOn_ASC
revisionRestoredOn_DESC
revisionFirstPublishedOn_ASC
revisionFirstPublishedOn_DESC
revisionLastPublishedOn_ASC
Expand Down
Loading

0 comments on commit 705277f

Please sign in to comment.