@webiny/api-headless-cms-tasks 6.3.0-beta.4 → 6.4.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/constants.js +2 -1
- package/constants.js.map +1 -1
- package/features/DeleteModelTask/DeleteModel.js +92 -119
- package/features/DeleteModelTask/DeleteModel.js.map +1 -1
- package/features/DeleteModelTask/DeleteModelTask.js +33 -31
- package/features/DeleteModelTask/DeleteModelTask.js.map +1 -1
- package/features/DeleteModelTask/feature.js +6 -5
- package/features/DeleteModelTask/feature.js.map +1 -1
- package/features/DeleteModelTask/types.js +7 -6
- package/features/DeleteModelTask/types.js.map +1 -1
- package/features/DisableModel/BlockActionIfModelDisabled.js +9 -10
- package/features/DisableModel/BlockActionIfModelDisabled.js.map +1 -1
- package/features/DisableModel/abstractions.js +2 -1
- package/features/DisableModel/abstractions.js.map +1 -1
- package/features/DisableModel/feature.js +18 -22
- package/features/DisableModel/feature.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeCreate.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeCreate.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeMove.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeMove.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforePublish.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforePublish.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeRepublish.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeRepublish.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeRestoreFromBin.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeRestoreFromBin.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeUnpublish.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeUnpublish.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeUpdate.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeUpdate.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryRevisionBeforeCreate.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryRevisionBeforeCreate.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnModelBeforeCreateFrom.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnModelBeforeCreateFrom.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnModelBeforeUpdate.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnModelBeforeUpdate.js.map +1 -1
- package/features/DisableModel/index.js +0 -2
- package/graphql/deleteModel/cancelDeleteModel.js +45 -55
- package/graphql/deleteModel/cancelDeleteModel.js.map +1 -1
- package/graphql/deleteModel/crud.js +52 -61
- package/graphql/deleteModel/crud.js.map +1 -1
- package/graphql/deleteModel/fullyDeleteModel.js +44 -56
- package/graphql/deleteModel/fullyDeleteModel.js.map +1 -1
- package/graphql/deleteModel/getDeleteModelProgress.js +42 -54
- package/graphql/deleteModel/getDeleteModelProgress.js.map +1 -1
- package/graphql/deleteModel/index.js +78 -101
- package/graphql/deleteModel/index.js.map +1 -1
- package/graphql/deleteModel/status.js +13 -12
- package/graphql/deleteModel/status.js.map +1 -1
- package/helpers/confirmation.js +6 -12
- package/helpers/confirmation.js.map +1 -1
- package/helpers/store.js +9 -14
- package/helpers/store.js.map +1 -1
- package/index.js +15 -8
- package/index.js.map +1 -1
- package/package.json +21 -21
- package/types.js +0 -3
- package/features/DisableModel/index.js.map +0 -1
- package/types.js.map +0 -1
|
@@ -1,41 +1,35 @@
|
|
|
1
1
|
import zod from "zod";
|
|
2
2
|
import { ContextPlugin } from "@webiny/api";
|
|
3
|
-
import { CmsGraphQLSchemaPlugin } from "@webiny/api-headless-cms";
|
|
4
|
-
import {
|
|
5
|
-
import { createResolverDecorator } from "@webiny/handler-graphql";
|
|
6
|
-
import { ErrorResponse } from "@webiny/handler-graphql";
|
|
7
|
-
import { resolve } from "@webiny/handler-graphql";
|
|
8
|
-
import { Response } from "@webiny/handler-graphql";
|
|
3
|
+
import { CmsGraphQLSchemaPlugin, isHeadlessCmsReady } from "@webiny/api-headless-cms";
|
|
4
|
+
import { ErrorResponse, Response, createResolverDecorator, resolve } from "@webiny/handler-graphql";
|
|
9
5
|
import { createZodError } from "@webiny/utils";
|
|
10
6
|
import { validateConfirmation } from "../../helpers/confirmation.js";
|
|
11
7
|
const deleteValidation = zod.object({
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}).superRefine((value, context)
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
modelId: zod.string(),
|
|
9
|
+
confirmation: zod.string()
|
|
10
|
+
}).superRefine((value, context)=>{
|
|
11
|
+
if (validateConfirmation(value)) return;
|
|
12
|
+
context.addIssue({
|
|
13
|
+
code: zod.ZodIssueCode.custom,
|
|
14
|
+
message: "Confirmation input does not match.",
|
|
15
|
+
fatal: true,
|
|
16
|
+
path: [
|
|
17
|
+
"confirmation"
|
|
18
|
+
]
|
|
19
|
+
});
|
|
24
20
|
}).readonly();
|
|
25
21
|
const cancelValidation = zod.object({
|
|
26
|
-
|
|
22
|
+
modelId: zod.string()
|
|
27
23
|
}).readonly();
|
|
28
24
|
const getValidation = zod.object({
|
|
29
|
-
|
|
25
|
+
modelId: zod.string()
|
|
30
26
|
}).readonly();
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const plugin = new CmsGraphQLSchemaPlugin({
|
|
38
|
-
typeDefs: /* GraphQL */`
|
|
27
|
+
const createDeleteModelGraphQl = ()=>{
|
|
28
|
+
const contextPlugin = new ContextPlugin(async (inputContext)=>{
|
|
29
|
+
const ready = await isHeadlessCmsReady(inputContext);
|
|
30
|
+
if (!ready || !inputContext.cms.MANAGE) return;
|
|
31
|
+
const plugin = new CmsGraphQLSchemaPlugin({
|
|
32
|
+
typeDefs: `
|
|
39
33
|
enum DeleteCmsModelTaskStatus {
|
|
40
34
|
running
|
|
41
35
|
done
|
|
@@ -83,81 +77,64 @@ export const createDeleteModelGraphQl = () => {
|
|
|
83
77
|
cancelFullyDeleteModel(modelId: ID!): CancelDeleteCmsModelResponse!
|
|
84
78
|
}
|
|
85
79
|
`,
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
80
|
+
resolvers: {
|
|
81
|
+
CmsContentModel: {
|
|
82
|
+
isBeingDeleted: async (model, _, context)=>{
|
|
83
|
+
try {
|
|
84
|
+
return await context.cms.isModelBeingDeleted(model.modelId);
|
|
85
|
+
} catch (ex) {
|
|
86
|
+
console.error(ex);
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
Query: {
|
|
92
|
+
getDeleteModelProgress: async (_, args, context)=>resolve(async ()=>{
|
|
93
|
+
const input = getValidation.safeParse(args);
|
|
94
|
+
if (input.error) throw createZodError(input.error);
|
|
95
|
+
return await context.cms.getDeleteModelProgress(input.data.modelId);
|
|
96
|
+
})
|
|
97
|
+
},
|
|
98
|
+
Mutation: {
|
|
99
|
+
fullyDeleteModel: async (_, args, context)=>resolve(async ()=>{
|
|
100
|
+
const input = deleteValidation.safeParse(args);
|
|
101
|
+
if (input.error) throw createZodError(input.error);
|
|
102
|
+
return await context.cms.fullyDeleteModel(input.data.modelId);
|
|
103
|
+
}),
|
|
104
|
+
cancelFullyDeleteModel: async (_, args, context)=>resolve(async ()=>{
|
|
105
|
+
const input = cancelValidation.safeParse(args);
|
|
106
|
+
if (input.error) throw createZodError(input.error);
|
|
107
|
+
return await context.cms.cancelFullyDeleteModel(input.data.modelId);
|
|
108
|
+
})
|
|
109
|
+
}
|
|
110
|
+
},
|
|
111
|
+
resolverDecorators: {
|
|
112
|
+
["Query.listContentModels"]: [
|
|
113
|
+
createResolverDecorator((resolver)=>async (parent, args, context, info)=>{
|
|
114
|
+
const result = await resolver(parent, args, context, info);
|
|
115
|
+
if (result.error || !Array.isArray(result.data)) return result;
|
|
116
|
+
if (args?.includeBeingDeleted !== false) return result;
|
|
117
|
+
const listed = result.data;
|
|
118
|
+
try {
|
|
119
|
+
const beingDeletedList = await context.cms.listModelsBeingDeleted();
|
|
120
|
+
return new Response(listed.filter((model)=>{
|
|
121
|
+
if (!model?.modelId) return false;
|
|
122
|
+
if (beingDeletedList.some((item)=>item.modelId === model.modelId)) return false;
|
|
123
|
+
return true;
|
|
124
|
+
}));
|
|
125
|
+
} catch (ex) {
|
|
126
|
+
return new ErrorResponse(ex);
|
|
127
|
+
}
|
|
128
|
+
})
|
|
129
|
+
]
|
|
93
130
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
Query: {
|
|
98
|
-
getDeleteModelProgress: async (_, args, context) => {
|
|
99
|
-
return resolve(async () => {
|
|
100
|
-
const input = getValidation.safeParse(args);
|
|
101
|
-
if (input.error) {
|
|
102
|
-
throw createZodError(input.error);
|
|
103
|
-
}
|
|
104
|
-
return await context.cms.getDeleteModelProgress(input.data.modelId);
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
Mutation: {
|
|
109
|
-
fullyDeleteModel: async (_, args, context) => {
|
|
110
|
-
return resolve(async () => {
|
|
111
|
-
const input = deleteValidation.safeParse(args);
|
|
112
|
-
if (input.error) {
|
|
113
|
-
throw createZodError(input.error);
|
|
114
|
-
}
|
|
115
|
-
return await context.cms.fullyDeleteModel(input.data.modelId);
|
|
116
|
-
});
|
|
117
|
-
},
|
|
118
|
-
cancelFullyDeleteModel: async (_, args, context) => {
|
|
119
|
-
return resolve(async () => {
|
|
120
|
-
const input = cancelValidation.safeParse(args);
|
|
121
|
-
if (input.error) {
|
|
122
|
-
throw createZodError(input.error);
|
|
123
|
-
}
|
|
124
|
-
return await context.cms.cancelFullyDeleteModel(input.data.modelId);
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
},
|
|
129
|
-
resolverDecorators: {
|
|
130
|
-
["Query.listContentModels"]: [createResolverDecorator(resolver => async (parent, args, context, info) => {
|
|
131
|
-
// TODO @bruno figure out how to fix these types
|
|
132
|
-
const result = await resolver(parent, args, context, info);
|
|
133
|
-
if (result.error || !Array.isArray(result.data)) {
|
|
134
|
-
return result;
|
|
135
|
-
}
|
|
136
|
-
if (args?.includeBeingDeleted !== false) {
|
|
137
|
-
return result;
|
|
138
|
-
}
|
|
139
|
-
const listed = result.data;
|
|
140
|
-
try {
|
|
141
|
-
const beingDeletedList = await context.cms.listModelsBeingDeleted();
|
|
142
|
-
return new Response(listed.filter(model => {
|
|
143
|
-
if (!model?.modelId) {
|
|
144
|
-
return false;
|
|
145
|
-
} else if (beingDeletedList.some(item => item.modelId === model.modelId)) {
|
|
146
|
-
return false;
|
|
147
|
-
}
|
|
148
|
-
return true;
|
|
149
|
-
}));
|
|
150
|
-
} catch (ex) {
|
|
151
|
-
return new ErrorResponse(ex);
|
|
152
|
-
}
|
|
153
|
-
})]
|
|
154
|
-
}
|
|
131
|
+
});
|
|
132
|
+
plugin.name = "headless-cms.graphql.fullyDeleteModel";
|
|
133
|
+
inputContext.plugins.register(plugin);
|
|
155
134
|
});
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
});
|
|
159
|
-
contextPlugin.name = "headless-cms.context.createDeleteModelGraphQl";
|
|
160
|
-
return contextPlugin;
|
|
135
|
+
contextPlugin.name = "headless-cms.context.createDeleteModelGraphQl";
|
|
136
|
+
return contextPlugin;
|
|
161
137
|
};
|
|
138
|
+
export { createDeleteModelGraphQl };
|
|
162
139
|
|
|
163
140
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["zod","ContextPlugin","CmsGraphQLSchemaPlugin","isHeadlessCmsReady","createResolverDecorator","ErrorResponse","resolve","Response","createZodError","validateConfirmation","deleteValidation","object","modelId","string","confirmation","superRefine","value","context","addIssue","code","ZodIssueCode","custom","message","fatal","path","readonly","cancelValidation","getValidation","createDeleteModelGraphQl","contextPlugin","inputContext","ready","cms","MANAGE","plugin","typeDefs","resolvers","CmsContentModel","isBeingDeleted","model","_","isModelBeingDeleted","ex","console","error","Query","getDeleteModelProgress","args","input","safeParse","data","Mutation","fullyDeleteModel","cancelFullyDeleteModel","resolverDecorators","resolver","parent","info","result","Array","isArray","includeBeingDeleted","listed","beingDeletedList","listModelsBeingDeleted","filter","some","item","name","plugins","register"],"sources":["index.ts"],"sourcesContent":["import zod from \"zod\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { CmsGraphQLSchemaPlugin } from \"@webiny/api-headless-cms\";\nimport { isHeadlessCmsReady } from \"@webiny/api-headless-cms\";\nimport type { HcmsTasksContext } from \"~/types.js\";\nimport { createResolverDecorator } from \"@webiny/handler-graphql\";\nimport { ErrorResponse } from \"@webiny/handler-graphql\";\nimport { resolve } from \"@webiny/handler-graphql\";\nimport { Response } from \"@webiny/handler-graphql\";\nimport { createZodError } from \"@webiny/utils\";\nimport type { IDeleteCmsModelTask } from \"~/features/DeleteModelTask/types.js\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { validateConfirmation } from \"~/helpers/confirmation.js\";\n\nconst deleteValidation = zod\n .object({\n modelId: zod.string(),\n confirmation: zod.string()\n })\n .superRefine((value, context) => {\n if (validateConfirmation(value)) {\n return;\n }\n context.addIssue({\n code: zod.ZodIssueCode.custom,\n message: `Confirmation input does not match.`,\n fatal: true,\n path: [\"confirmation\"]\n });\n })\n .readonly();\n\nconst cancelValidation = zod\n .object({\n modelId: zod.string()\n })\n .readonly();\n\nconst getValidation = zod\n .object({\n modelId: zod.string()\n })\n .readonly();\n\nexport const createDeleteModelGraphQl = <T extends HcmsTasksContext = HcmsTasksContext>() => {\n const contextPlugin = new ContextPlugin<T>(async inputContext => {\n const ready = await isHeadlessCmsReady(inputContext);\n\n if (!ready || !inputContext.cms.MANAGE) {\n return;\n }\n\n const plugin = new CmsGraphQLSchemaPlugin<T>({\n typeDefs: /* GraphQL */ `\n enum DeleteCmsModelTaskStatus {\n running\n done\n error\n canceled\n }\n type DeleteCmsModelTask {\n id: ID!\n status: DeleteCmsModelTaskStatus!\n deleted: Int!\n total: Int!\n }\n\n type GetDeleteCmsModelProgressResponse {\n data: DeleteCmsModelTask\n error: CmsError\n }\n\n type FullyDeleteCmsModelResponse {\n data: DeleteCmsModelTask\n error: CmsError\n }\n\n type CancelDeleteCmsModelResponse {\n data: DeleteCmsModelTask\n error: CmsError\n }\n\n extend type CmsContentModel {\n isBeingDeleted: Boolean!\n }\n\n extend type Query {\n getDeleteModelProgress(modelId: ID!): GetDeleteCmsModelProgressResponse!\n listContentModels(\n includeBeingDeleted: Boolean = false\n ): CmsContentModelListResponse\n }\n\n extend type Mutation {\n fullyDeleteModel(\n modelId: ID!\n confirmation: String!\n ): FullyDeleteCmsModelResponse!\n cancelFullyDeleteModel(modelId: ID!): CancelDeleteCmsModelResponse!\n }\n `,\n resolvers: {\n CmsContentModel: {\n isBeingDeleted: async (model: CmsModel, _: unknown, context) => {\n try {\n return await context.cms.isModelBeingDeleted(model.modelId);\n } catch (ex) {\n console.error(ex);\n }\n return true;\n }\n },\n Query: {\n getDeleteModelProgress: async (_: unknown, args: unknown, context) => {\n return resolve<IDeleteCmsModelTask>(async () => {\n const input = getValidation.safeParse(args);\n if (input.error) {\n throw createZodError(input.error);\n }\n return await context.cms.getDeleteModelProgress(input.data.modelId);\n });\n }\n },\n Mutation: {\n fullyDeleteModel: async (_: unknown, args: unknown, context) => {\n return resolve<IDeleteCmsModelTask>(async () => {\n const input = deleteValidation.safeParse(args);\n if (input.error) {\n throw createZodError(input.error);\n }\n return await context.cms.fullyDeleteModel(input.data.modelId);\n });\n },\n cancelFullyDeleteModel: async (_: unknown, args: unknown, context) => {\n return resolve<IDeleteCmsModelTask>(async () => {\n const input = cancelValidation.safeParse(args);\n if (input.error) {\n throw createZodError(input.error);\n }\n return await context.cms.cancelFullyDeleteModel(input.data.modelId);\n });\n }\n }\n },\n resolverDecorators: {\n [\"Query.listContentModels\"]: [\n createResolverDecorator<any, any, HcmsTasksContext>(\n resolver => async (parent, args, context, info) => {\n // TODO @bruno figure out how to fix these types\n const result = (await resolver(parent, args, context, info)) as any;\n if (result.error || !Array.isArray(result.data)) {\n return result;\n }\n\n if (args?.includeBeingDeleted !== false) {\n return result;\n }\n\n const listed = result.data as CmsModel[];\n\n try {\n const beingDeletedList = await context.cms.listModelsBeingDeleted();\n\n return new Response(\n listed.filter(model => {\n if (!model?.modelId) {\n return false;\n } else if (\n beingDeletedList.some(\n item => item.modelId === model.modelId\n )\n ) {\n return false;\n }\n return true;\n })\n );\n } catch (ex) {\n return new ErrorResponse(ex);\n }\n }\n )\n ]\n }\n });\n plugin.name = \"headless-cms.graphql.fullyDeleteModel\";\n inputContext.plugins.register(plugin);\n });\n contextPlugin.name = \"headless-cms.context.createDeleteModelGraphQl\";\n return contextPlugin;\n};\n"],"mappings":"AAAA,OAAOA,GAAG,MAAM,KAAK;AACrB,SAASC,aAAa,QAAQ,aAAa;AAC3C,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,SAASC,kBAAkB,QAAQ,0BAA0B;AAE7D,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,aAAa,QAAQ,yBAAyB;AACvD,SAASC,OAAO,QAAQ,yBAAyB;AACjD,SAASC,QAAQ,QAAQ,yBAAyB;AAClD,SAASC,cAAc,QAAQ,eAAe;AAG9C,SAASC,oBAAoB;AAE7B,MAAMC,gBAAgB,GAAGV,GAAG,CACvBW,MAAM,CAAC;EACJC,OAAO,EAAEZ,GAAG,CAACa,MAAM,CAAC,CA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C,EACH;gBACE,OAAO,KAAK;cAChB;cACA,OAAO,IAAI;YACf,CAAC,CACL,CAAC;UACL,CAAC,CAAC,OAAO8B,EAAE,EAAE;YACT,OAAO,IAAIrC,aAAa,CAACqC,EAAE,CAAC;UAChC;QACJ,CACJ,CAAC;MAET;IACJ,CAAC,CAAC;IACFR,MAAM,CAACkC,IAAI,GAAG,uCAAuC;IACrDtC,YAAY,CAACuC,OAAO,CAACC,QAAQ,CAACpC,MAAM,CAAC;EACzC,CAAC,CAAC;EACFL,aAAa,CAACuC,IAAI,GAAG,+CAA+C;EACpE,OAAOvC,aAAa;AACxB,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"graphql/deleteModel/index.js","sources":["../../../src/graphql/deleteModel/index.ts"],"sourcesContent":["import zod from \"zod\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { CmsGraphQLSchemaPlugin } from \"@webiny/api-headless-cms\";\nimport { isHeadlessCmsReady } from \"@webiny/api-headless-cms\";\nimport type { HcmsTasksContext } from \"~/types.js\";\nimport { createResolverDecorator } from \"@webiny/handler-graphql\";\nimport { ErrorResponse } from \"@webiny/handler-graphql\";\nimport { resolve } from \"@webiny/handler-graphql\";\nimport { Response } from \"@webiny/handler-graphql\";\nimport { createZodError } from \"@webiny/utils\";\nimport type { IDeleteCmsModelTask } from \"~/features/DeleteModelTask/types.js\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport { validateConfirmation } from \"~/helpers/confirmation.js\";\n\nconst deleteValidation = zod\n .object({\n modelId: zod.string(),\n confirmation: zod.string()\n })\n .superRefine((value, context) => {\n if (validateConfirmation(value)) {\n return;\n }\n context.addIssue({\n code: zod.ZodIssueCode.custom,\n message: `Confirmation input does not match.`,\n fatal: true,\n path: [\"confirmation\"]\n });\n })\n .readonly();\n\nconst cancelValidation = zod\n .object({\n modelId: zod.string()\n })\n .readonly();\n\nconst getValidation = zod\n .object({\n modelId: zod.string()\n })\n .readonly();\n\nexport const createDeleteModelGraphQl = <T extends HcmsTasksContext = HcmsTasksContext>() => {\n const contextPlugin = new ContextPlugin<T>(async inputContext => {\n const ready = await isHeadlessCmsReady(inputContext);\n\n if (!ready || !inputContext.cms.MANAGE) {\n return;\n }\n\n const plugin = new CmsGraphQLSchemaPlugin<T>({\n typeDefs: /* GraphQL */ `\n enum DeleteCmsModelTaskStatus {\n running\n done\n error\n canceled\n }\n type DeleteCmsModelTask {\n id: ID!\n status: DeleteCmsModelTaskStatus!\n deleted: Int!\n total: Int!\n }\n\n type GetDeleteCmsModelProgressResponse {\n data: DeleteCmsModelTask\n error: CmsError\n }\n\n type FullyDeleteCmsModelResponse {\n data: DeleteCmsModelTask\n error: CmsError\n }\n\n type CancelDeleteCmsModelResponse {\n data: DeleteCmsModelTask\n error: CmsError\n }\n\n extend type CmsContentModel {\n isBeingDeleted: Boolean!\n }\n\n extend type Query {\n getDeleteModelProgress(modelId: ID!): GetDeleteCmsModelProgressResponse!\n listContentModels(\n includeBeingDeleted: Boolean = false\n ): CmsContentModelListResponse\n }\n\n extend type Mutation {\n fullyDeleteModel(\n modelId: ID!\n confirmation: String!\n ): FullyDeleteCmsModelResponse!\n cancelFullyDeleteModel(modelId: ID!): CancelDeleteCmsModelResponse!\n }\n `,\n resolvers: {\n CmsContentModel: {\n isBeingDeleted: async (model: CmsModel, _: unknown, context) => {\n try {\n return await context.cms.isModelBeingDeleted(model.modelId);\n } catch (ex) {\n console.error(ex);\n }\n return true;\n }\n },\n Query: {\n getDeleteModelProgress: async (_: unknown, args: unknown, context) => {\n return resolve<IDeleteCmsModelTask>(async () => {\n const input = getValidation.safeParse(args);\n if (input.error) {\n throw createZodError(input.error);\n }\n return await context.cms.getDeleteModelProgress(input.data.modelId);\n });\n }\n },\n Mutation: {\n fullyDeleteModel: async (_: unknown, args: unknown, context) => {\n return resolve<IDeleteCmsModelTask>(async () => {\n const input = deleteValidation.safeParse(args);\n if (input.error) {\n throw createZodError(input.error);\n }\n return await context.cms.fullyDeleteModel(input.data.modelId);\n });\n },\n cancelFullyDeleteModel: async (_: unknown, args: unknown, context) => {\n return resolve<IDeleteCmsModelTask>(async () => {\n const input = cancelValidation.safeParse(args);\n if (input.error) {\n throw createZodError(input.error);\n }\n return await context.cms.cancelFullyDeleteModel(input.data.modelId);\n });\n }\n }\n },\n resolverDecorators: {\n [\"Query.listContentModels\"]: [\n createResolverDecorator<any, any, HcmsTasksContext>(\n resolver => async (parent, args, context, info) => {\n // TODO @bruno figure out how to fix these types\n const result = (await resolver(parent, args, context, info)) as any;\n if (result.error || !Array.isArray(result.data)) {\n return result;\n }\n\n if (args?.includeBeingDeleted !== false) {\n return result;\n }\n\n const listed = result.data as CmsModel[];\n\n try {\n const beingDeletedList = await context.cms.listModelsBeingDeleted();\n\n return new Response(\n listed.filter(model => {\n if (!model?.modelId) {\n return false;\n } else if (\n beingDeletedList.some(\n item => item.modelId === model.modelId\n )\n ) {\n return false;\n }\n return true;\n })\n );\n } catch (ex) {\n return new ErrorResponse(ex);\n }\n }\n )\n ]\n }\n });\n plugin.name = \"headless-cms.graphql.fullyDeleteModel\";\n inputContext.plugins.register(plugin);\n });\n contextPlugin.name = \"headless-cms.context.createDeleteModelGraphQl\";\n return contextPlugin;\n};\n"],"names":["deleteValidation","zod","value","context","validateConfirmation","cancelValidation","getValidation","createDeleteModelGraphQl","contextPlugin","ContextPlugin","inputContext","ready","isHeadlessCmsReady","plugin","CmsGraphQLSchemaPlugin","model","_","ex","console","args","resolve","input","createZodError","createResolverDecorator","resolver","parent","info","result","Array","listed","beingDeletedList","Response","item","ErrorResponse"],"mappings":";;;;;;AAcA,MAAMA,mBAAmBC,IAAAA,MACd,CAAC;IACJ,SAASA,IAAI,MAAM;IACnB,cAAcA,IAAI,MAAM;AAC5B,GACC,WAAW,CAAC,CAACC,OAAOC;IACjB,IAAIC,qBAAqBF,QACrB;IAEJC,QAAQ,QAAQ,CAAC;QACb,MAAMF,IAAI,YAAY,CAAC,MAAM;QAC7B,SAAS;QACT,O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AAC,OAAO;wBAChE;oBAEJ,wBAAwB,OAAOL,GAAYG,MAAehB,UAC/CiB,QAA6B;4BAChC,MAAMC,QAAQhB,iBAAiB,SAAS,CAACc;4BACzC,IAAIE,MAAM,KAAK,EACX,MAAMC,eAAeD,MAAM,KAAK;4BAEpC,OAAO,MAAMlB,QAAQ,GAAG,CAAC,sBAAsB,CAACkB,MAAM,IAAI,CAAC,OAAO;wBACtE;gBAER;YACJ;YACA,oBAAoB;gBAChB,CAAC,0BAA0B,EAAE;oBACzBE,wBACIC,CAAAA,WAAY,OAAOC,QAAQN,MAAMhB,SAASuB;4BAEtC,MAAMC,SAAU,MAAMH,SAASC,QAAQN,MAAMhB,SAASuB;4BACtD,IAAIC,OAAO,KAAK,IAAI,CAACC,MAAM,OAAO,CAACD,OAAO,IAAI,GAC1C,OAAOA;4BAGX,IAAIR,MAAM,wBAAwB,OAC9B,OAAOQ;4BAGX,MAAME,SAASF,OAAO,IAAI;4BAE1B,IAAI;gCACA,MAAMG,mBAAmB,MAAM3B,QAAQ,GAAG,CAAC,sBAAsB;gCAEjE,OAAO,IAAI4B,SACPF,OAAO,MAAM,CAACd,CAAAA;oCACV,IAAI,CAACA,OAAO,SACR,OAAO;oCACJ,IACHe,iBAAiB,IAAI,CACjBE,CAAAA,OAAQA,KAAK,OAAO,KAAKjB,MAAM,OAAO,GAG1C,OAAO;oCAEX,OAAO;gCACX;4BAER,EAAE,OAAOE,IAAI;gCACT,OAAO,IAAIgB,cAAchB;4BAC7B;wBACJ;iBAEP;YACL;QACJ;QACAJ,OAAO,IAAI,GAAG;QACdH,aAAa,OAAO,CAAC,QAAQ,CAACG;IAClC;IACAL,cAAc,IAAI,GAAG;IACrB,OAAOA;AACX"}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
import { DeleteCmsModelTaskStatus } from "../../features/DeleteModelTask/types.js";
|
|
2
2
|
import { TaskDataStatus } from "@webiny/api-core/features/task/TaskService/index.js";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
3
|
+
const getStatus = (status)=>{
|
|
4
|
+
switch(status){
|
|
5
|
+
case TaskDataStatus.PENDING:
|
|
6
|
+
case TaskDataStatus.RUNNING:
|
|
7
|
+
return DeleteCmsModelTaskStatus.RUNNING;
|
|
8
|
+
case TaskDataStatus.FAILED:
|
|
9
|
+
return DeleteCmsModelTaskStatus.ERROR;
|
|
10
|
+
case TaskDataStatus.ABORTED:
|
|
11
|
+
return DeleteCmsModelTaskStatus.CANCELED;
|
|
12
|
+
case TaskDataStatus.SUCCESS:
|
|
13
|
+
return DeleteCmsModelTaskStatus.DONE;
|
|
14
|
+
}
|
|
15
15
|
};
|
|
16
|
+
export { getStatus };
|
|
16
17
|
|
|
17
18
|
//# sourceMappingURL=status.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"graphql/deleteModel/status.js","sources":["../../../src/graphql/deleteModel/status.ts"],"sourcesContent":["import { DeleteCmsModelTaskStatus } from \"~/features/DeleteModelTask/types.js\";\nimport { TaskDataStatus } from \"@webiny/api-core/features/task/TaskService/index.js\";\n\nexport const getStatus = (status: TaskDataStatus): DeleteCmsModelTaskStatus => {\n switch (status) {\n case TaskDataStatus.PENDING:\n case TaskDataStatus.RUNNING:\n return DeleteCmsModelTaskStatus.RUNNING;\n case TaskDataStatus.FAILED:\n return DeleteCmsModelTaskStatus.ERROR;\n case TaskDataStatus.ABORTED:\n return DeleteCmsModelTaskStatus.CANCELED;\n case TaskDataStatus.SUCCESS:\n return DeleteCmsModelTaskStatus.DONE;\n }\n};\n"],"names":["getStatus","status","TaskDataStatus","DeleteCmsModelTaskStatus"],"mappings":";;AAGO,MAAMA,YAAY,CAACC;IACtB,OAAQA;QACJ,KAAKC,eAAe,OAAO;QAC3B,KAAKA,eAAe,OAAO;YACvB,OAAOC,yBAAyB,OAAO;QAC3C,KAAKD,eAAe,MAAM;YACtB,OAAOC,yBAAyB,KAAK;QACzC,KAAKD,eAAe,OAAO;YACvB,OAAOC,yBAAyB,QAAQ;QAC5C,KAAKD,eAAe,OAAO;YACvB,OAAOC,yBAAyB,IAAI;IAC5C;AACJ"}
|
package/helpers/confirmation.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
};
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
modelId,
|
|
7
|
-
confirmation
|
|
8
|
-
} = params;
|
|
9
|
-
if (!modelId || !confirmation) {
|
|
10
|
-
return false;
|
|
11
|
-
}
|
|
12
|
-
return confirmation === generateConfirmation(modelId);
|
|
1
|
+
const generateConfirmation = (modelId)=>`delete ${modelId}`;
|
|
2
|
+
const validateConfirmation = (params)=>{
|
|
3
|
+
const { modelId, confirmation } = params;
|
|
4
|
+
if (!modelId || !confirmation) return false;
|
|
5
|
+
return confirmation === generateConfirmation(modelId);
|
|
13
6
|
};
|
|
7
|
+
export { generateConfirmation, validateConfirmation };
|
|
14
8
|
|
|
15
9
|
//# sourceMappingURL=confirmation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"helpers/confirmation.js","sources":["../../src/helpers/confirmation.ts"],"sourcesContent":["export const generateConfirmation = (modelId: string): string => {\n return `delete ${modelId}`;\n};\n\nexport interface IValidateConfirmationParams {\n modelId?: string;\n confirmation?: string;\n}\nexport const validateConfirmation = (params: IValidateConfirmationParams): boolean => {\n const { modelId, confirmation } = params;\n if (!modelId || !confirmation) {\n return false;\n }\n return confirmation === generateConfirmation(modelId);\n};\n"],"names":["generateConfirmation","modelId","validateConfirmation","params","confirmation"],"mappings":"AAAO,MAAMA,uBAAuB,CAACC,UAC1B,CAAC,OAAO,EAAEA,SAAS;AAOvB,MAAMC,uBAAuB,CAACC;IACjC,MAAM,EAAEF,OAAO,EAAEG,YAAY,EAAE,GAAGD;IAClC,IAAI,CAACF,WAAW,CAACG,cACb,OAAO;IAEX,OAAOA,iBAAiBJ,qBAAqBC;AACjD"}
|
package/helpers/store.js
CHANGED
|
@@ -1,16 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
task: params.task,
|
|
11
|
-
identity: params.identity,
|
|
12
|
-
tenant: params.tenant
|
|
13
|
-
};
|
|
14
|
-
};
|
|
1
|
+
const createStoreNamespace = (params)=>`deletingCmsModel#T#${params.tenant}#`;
|
|
2
|
+
const createStoreKey = (params)=>`${createStoreNamespace(params)}${params.modelId}`;
|
|
3
|
+
const createStoreValue = (params)=>({
|
|
4
|
+
modelId: params.modelId,
|
|
5
|
+
task: params.task,
|
|
6
|
+
identity: params.identity,
|
|
7
|
+
tenant: params.tenant
|
|
8
|
+
});
|
|
9
|
+
export { createStoreKey, createStoreNamespace, createStoreValue };
|
|
15
10
|
|
|
16
11
|
//# sourceMappingURL=store.js.map
|
package/helpers/store.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"helpers/store.js","sources":["../../src/helpers/store.ts"],"sourcesContent":["import type { StorageKey } from \"@webiny/db/types.js\";\nimport type { IStoreValue } from \"~/features/DeleteModelTask/types.js\";\n\nexport interface ICreateStoreKeyParams {\n modelId: string;\n tenant: string;\n}\n\nexport const createStoreNamespace = (params: Pick<ICreateStoreKeyParams, \"tenant\">) => {\n return `deletingCmsModel#T#${params.tenant}#`;\n};\n\nexport const createStoreKey = (params: ICreateStoreKeyParams): StorageKey => {\n return `${createStoreNamespace(params)}${params.modelId}`;\n};\n\nexport const createStoreValue = (params: IStoreValue): IStoreValue => {\n return {\n modelId: params.modelId,\n task: params.task,\n identity: params.identity,\n tenant: params.tenant\n };\n};\n"],"names":["createStoreNamespace","params","createStoreKey","createStoreValue"],"mappings":"AAQO,MAAMA,uBAAuB,CAACC,SAC1B,CAAC,mBAAmB,EAAEA,OAAO,MAAM,CAAC,CAAC,CAAC;AAG1C,MAAMC,iBAAiB,CAACD,SACpB,GAAGD,qBAAqBC,UAAUA,OAAO,OAAO,EAAE;AAGtD,MAAME,mBAAmB,CAACF,SACtB;QACH,SAASA,OAAO,OAAO;QACvB,MAAMA,OAAO,IAAI;QACjB,UAAUA,OAAO,QAAQ;QACzB,QAAQA,OAAO,MAAM;IACzB"}
|
package/index.js
CHANGED
|
@@ -3,13 +3,20 @@ import { createContextPlugin } from "@webiny/api";
|
|
|
3
3
|
import { DeleteModelTaskFeature } from "./features/DeleteModelTask/feature.js";
|
|
4
4
|
import { createDeleteModelCrud } from "./graphql/deleteModel/crud.js";
|
|
5
5
|
import { createDeleteModelGraphQl } from "./graphql/deleteModel/index.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
6
|
+
const createDeleteModelTask = ()=>[
|
|
7
|
+
createDeleteModelCrud(),
|
|
8
|
+
createDeleteModelGraphQl(),
|
|
9
|
+
createContextPlugin((context)=>{
|
|
10
|
+
DeleteModelTaskFeature.register(context.container);
|
|
11
|
+
})
|
|
12
|
+
];
|
|
13
|
+
const createHcmsTasks = ()=>[
|
|
14
|
+
createHcmsBulkActions({
|
|
15
|
+
batchSize: 100
|
|
16
|
+
}),
|
|
17
|
+
createEmptyTrashBinsTask(),
|
|
18
|
+
createDeleteModelTask()
|
|
19
|
+
];
|
|
20
|
+
export { createDeleteModelTask, createHcmsTasks };
|
|
14
21
|
|
|
15
22
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../src/index.ts"],"sourcesContent":["import {\n createEmptyTrashBinsTask,\n createHcmsBulkActions\n} from \"@webiny/api-headless-cms-bulk-actions\";\nimport { createContextPlugin } from \"@webiny/api\";\nimport { DeleteModelTaskFeature } from \"~/features/DeleteModelTask/feature.js\";\nimport { createDeleteModelCrud } from \"~/graphql/deleteModel/crud.js\";\nimport { createDeleteModelGraphQl } from \"~/graphql/deleteModel/index.js\";\n\nexport const createDeleteModelTask = () => {\n return [\n createDeleteModelCrud(),\n createDeleteModelGraphQl(),\n createContextPlugin(context => {\n DeleteModelTaskFeature.register(context.container);\n })\n ];\n};\n\nexport const createHcmsTasks = () => [\n createHcmsBulkActions({ batchSize: 100 }),\n createEmptyTrashBinsTask(),\n createDeleteModelTask()\n];\n"],"names":["createDeleteModelTask","createDeleteModelCrud","createDeleteModelGraphQl","createContextPlugin","context","DeleteModelTaskFeature","createHcmsTasks","createHcmsBulkActions","createEmptyTrashBinsTask"],"mappings":";;;;;AASO,MAAMA,wBAAwB,IAC1B;QACHC;QACAC;QACAC,oBAAoBC,CAAAA;YAChBC,uBAAuB,QAAQ,CAACD,QAAQ,SAAS;QACrD;KACH;AAGE,MAAME,kBAAkB,IAAM;QACjCC,sBAAsB;YAAE,WAAW;QAAI;QACvCC;QACAR;KACH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms-tasks",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.4.0-beta.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -17,32 +17,32 @@
|
|
|
17
17
|
},
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@webiny/api": "6.
|
|
21
|
-
"@webiny/api-aco": "6.
|
|
22
|
-
"@webiny/api-headless-cms": "6.
|
|
23
|
-
"@webiny/api-headless-cms-bulk-actions": "6.
|
|
24
|
-
"@webiny/db": "6.
|
|
25
|
-
"@webiny/error": "6.
|
|
26
|
-
"@webiny/feature": "6.
|
|
27
|
-
"@webiny/handler-graphql": "6.
|
|
28
|
-
"@webiny/tasks": "6.
|
|
29
|
-
"@webiny/utils": "6.
|
|
30
|
-
"zod": "4.3
|
|
20
|
+
"@webiny/api": "6.4.0-beta.0",
|
|
21
|
+
"@webiny/api-aco": "6.4.0-beta.0",
|
|
22
|
+
"@webiny/api-headless-cms": "6.4.0-beta.0",
|
|
23
|
+
"@webiny/api-headless-cms-bulk-actions": "6.4.0-beta.0",
|
|
24
|
+
"@webiny/db": "6.4.0-beta.0",
|
|
25
|
+
"@webiny/error": "6.4.0-beta.0",
|
|
26
|
+
"@webiny/feature": "6.4.0-beta.0",
|
|
27
|
+
"@webiny/handler-graphql": "6.4.0-beta.0",
|
|
28
|
+
"@webiny/tasks": "6.4.0-beta.0",
|
|
29
|
+
"@webiny/utils": "6.4.0-beta.0",
|
|
30
|
+
"zod": "4.4.3"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@webiny/api-core": "6.
|
|
34
|
-
"@webiny/build-tools": "6.
|
|
35
|
-
"@webiny/handler": "6.
|
|
36
|
-
"@webiny/handler-aws": "6.
|
|
37
|
-
"@webiny/plugins": "6.
|
|
38
|
-
"@webiny/project-utils": "6.
|
|
39
|
-
"@webiny/wcp": "6.
|
|
33
|
+
"@webiny/api-core": "6.4.0-beta.0",
|
|
34
|
+
"@webiny/build-tools": "6.4.0-beta.0",
|
|
35
|
+
"@webiny/handler": "6.4.0-beta.0",
|
|
36
|
+
"@webiny/handler-aws": "6.4.0-beta.0",
|
|
37
|
+
"@webiny/plugins": "6.4.0-beta.0",
|
|
38
|
+
"@webiny/project-utils": "6.4.0-beta.0",
|
|
39
|
+
"@webiny/wcp": "6.4.0-beta.0",
|
|
40
40
|
"typescript": "6.0.3",
|
|
41
|
-
"vitest": "4.1.
|
|
41
|
+
"vitest": "4.1.6"
|
|
42
42
|
},
|
|
43
43
|
"publishConfig": {
|
|
44
44
|
"access": "public",
|
|
45
45
|
"directory": "dist"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "a545d7529828af07d08d49c3da1bcb967483b9ce"
|
|
48
48
|
}
|
package/types.js
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["DisableModelFeature"],"sources":["index.ts"],"sourcesContent":["export { DisableModelFeature } from \"./feature.js\";\n"],"mappings":"AAAA,SAASA,mBAAmB","ignoreList":[]}
|
package/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":[],"sources":["types.ts"],"sourcesContent":["import type { HcmsBulkActionsContext } from \"@webiny/api-headless-cms-bulk-actions/types.js\";\nimport type { AcoContext } from \"@webiny/api-aco/types.js\";\nimport type { HeadlessCms } from \"@webiny/api-headless-cms/types/index.js\";\nimport type { IDeleteCmsModelTask, IStoreValue } from \"~/features/DeleteModelTask/types.js\";\n\nexport interface HeadlessCmsFullyDeleteModel {\n fullyDeleteModel: (modelId: string) => Promise<IDeleteCmsModelTask>;\n cancelFullyDeleteModel: (modelId: string) => Promise<IDeleteCmsModelTask>;\n getDeleteModelProgress: (modelId: string) => Promise<IDeleteCmsModelTask>;\n isModelBeingDeleted: (modelId: string) => Promise<boolean>;\n listModelsBeingDeleted: () => Promise<IStoreValue[]>;\n}\n\nexport interface HcmsTasksContext extends HcmsBulkActionsContext, AcoContext {\n cms: HeadlessCms & HeadlessCmsFullyDeleteModel;\n}\n"],"mappings":"","ignoreList":[]}
|