@webiny/api-headless-cms-tasks 0.0.0-unstable.6844005670 → 0.0.0-unstable.7be00a75a9
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.d.ts +1 -0
- package/features/DeleteModelTask/DeleteModelTask.js +33 -30
- package/features/DeleteModelTask/DeleteModelTask.js.map +1 -1
- package/features/DeleteModelTask/feature.d.ts +4 -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.d.ts +4 -1
- package/features/DisableModel/feature.js +18 -22
- package/features/DisableModel/feature.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeCreate.d.ts +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeCreate.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeCreate.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeMove.d.ts +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeMove.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeMove.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforePublish.d.ts +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforePublish.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforePublish.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeRepublish.d.ts +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeRepublish.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeRepublish.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeRestoreFromBin.d.ts +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeRestoreFromBin.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeRestoreFromBin.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeUnpublish.d.ts +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeUnpublish.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeUnpublish.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeUpdate.d.ts +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeUpdate.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryBeforeUpdate.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryRevisionBeforeCreate.d.ts +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnEntryRevisionBeforeCreate.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnEntryRevisionBeforeCreate.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnModelBeforeCreateFrom.d.ts +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnModelBeforeCreateFrom.js +12 -9
- package/features/DisableModel/handlers/BlockModelActionOnModelBeforeCreateFrom.js.map +1 -1
- package/features/DisableModel/handlers/BlockModelActionOnModelBeforeUpdate.d.ts +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.d.ts +1 -1
- package/graphql/deleteModel/cancelDeleteModel.js +47 -48
- 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 +45 -50
- package/graphql/deleteModel/fullyDeleteModel.js.map +1 -1
- package/graphql/deleteModel/getDeleteModelProgress.js +43 -48
- 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.d.ts +1 -1
- package/index.js +15 -9
- package/index.js.map +1 -1
- package/package.json +29 -26
- package/types.js +0 -3
- package/features/DisableModel/index.js.map +0 -1
- package/types.js.map +0 -1
|
@@ -2,57 +2,56 @@ import { WebinyError } from "@webiny/error";
|
|
|
2
2
|
import { createStoreKey } from "../../helpers/store.js";
|
|
3
3
|
import { DELETE_MODEL_TASK } from "../../constants.js";
|
|
4
4
|
import { getStatus } from "./status.js";
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
modelId
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
5
|
+
import { NotAuthorizedError } from "@webiny/api-headless-cms/utils/errors.js";
|
|
6
|
+
import { AccessControl } from "@webiny/api-headless-cms/features/shared/abstractions.js";
|
|
7
|
+
const cancelDeleteModel = async (params)=>{
|
|
8
|
+
const { context, modelId } = params;
|
|
9
|
+
const model = await context.cms.getModel(modelId);
|
|
10
|
+
const accessControl = context.container.resolve(AccessControl);
|
|
11
|
+
const canAccessModel = await accessControl.canAccessModel({
|
|
12
|
+
model,
|
|
13
|
+
rwd: "d"
|
|
14
|
+
});
|
|
15
|
+
if (!canAccessModel) throw new NotAuthorizedError(`Not allowed to access content model "${model.name}".`);
|
|
16
|
+
const canAccessEntry = await accessControl.canAccessEntry({
|
|
17
|
+
model,
|
|
18
|
+
rwd: "w"
|
|
19
|
+
});
|
|
20
|
+
if (!canAccessEntry) throw new NotAuthorizedError(`Not allowed to access "${model.modelId}" entries.`);
|
|
21
|
+
const storeKey = createStoreKey(model);
|
|
22
|
+
const result = await context.db.store.getValue(storeKey);
|
|
23
|
+
const taskId = result.data?.task;
|
|
24
|
+
await context.db.store.removeValue(storeKey);
|
|
25
|
+
if (!taskId) {
|
|
26
|
+
if (result.error) throw WebinyError.from(result.error, {
|
|
27
|
+
code: "DELETE_MODEL_NO_TASK_DEFINED"
|
|
28
|
+
});
|
|
29
|
+
throw new WebinyError({
|
|
30
|
+
message: `Model "${modelId}" is not being deleted.`,
|
|
31
|
+
code: "MODEL_NOT_BEING_DELETED"
|
|
32
|
+
});
|
|
28
33
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
const task = await context.tasks.getTask(taskId);
|
|
35
|
+
if (task?.definitionId !== DELETE_MODEL_TASK) throw new WebinyError({
|
|
36
|
+
message: `The task which is deleting a model cannot be found. Please check Step Functions for more info. Task id: ${taskId}`,
|
|
37
|
+
code: "DELETE_MODEL_TASK_NOT_FOUND",
|
|
38
|
+
data: {
|
|
39
|
+
model: model.modelId,
|
|
40
|
+
task: taskId
|
|
41
|
+
}
|
|
32
42
|
});
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
throw new WebinyError({
|
|
37
|
-
message: `The task which is deleting a model cannot be found. Please check Step Functions for more info. Task id: ${taskId}`,
|
|
38
|
-
code: "DELETE_MODEL_TASK_NOT_FOUND",
|
|
39
|
-
data: {
|
|
40
|
-
model: model.modelId,
|
|
41
|
-
task: taskId
|
|
42
|
-
}
|
|
43
|
+
const abortResult = await context.tasks.abort({
|
|
44
|
+
id: task.id,
|
|
45
|
+
message: "User canceled the task."
|
|
43
46
|
});
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
id: canceledTask.id,
|
|
52
|
-
status: getStatus(canceledTask.taskStatus),
|
|
53
|
-
total: canceledTask.output?.total || 0,
|
|
54
|
-
deleted: canceledTask.output?.deleted || 0
|
|
55
|
-
};
|
|
47
|
+
const canceledTask = abortResult.value;
|
|
48
|
+
return {
|
|
49
|
+
id: canceledTask.id,
|
|
50
|
+
status: getStatus(canceledTask.taskStatus),
|
|
51
|
+
total: canceledTask.output?.total || 0,
|
|
52
|
+
deleted: canceledTask.output?.deleted || 0
|
|
53
|
+
};
|
|
56
54
|
};
|
|
55
|
+
export { cancelDeleteModel };
|
|
57
56
|
|
|
58
57
|
//# sourceMappingURL=cancelDeleteModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"graphql/deleteModel/cancelDeleteModel.js","sources":["../../../src/graphql/deleteModel/cancelDeleteModel.ts"],"sourcesContent":["import type { HcmsTasksContext } from \"~/types.js\";\nimport { WebinyError } from \"@webiny/error\";\nimport type {\n IDeleteCmsModelTask,\n IDeleteModelTaskInput,\n IDeleteModelTaskOutput,\n IStoreValue\n} from \"~/features/DeleteModelTask/types.js\";\nimport { createStoreKey } from \"~/helpers/store.js\";\nimport { DELETE_MODEL_TASK } from \"~/constants.js\";\nimport { getStatus } from \"~/graphql/deleteModel/status.js\";\nimport { NotAuthorizedError } from \"@webiny/api-headless-cms/utils/errors.js\";\nimport { AccessControl } from \"@webiny/api-headless-cms/features/shared/abstractions.js\";\n\nexport interface ICancelDeleteModelParams {\n readonly context: Pick<HcmsTasksContext, \"cms\" | \"tasks\" | \"db\" | \"container\">;\n readonly modelId: string;\n}\n\nexport const cancelDeleteModel = async (\n params: ICancelDeleteModelParams\n): Promise<IDeleteCmsModelTask> => {\n const { context, modelId } = params;\n\n const model = await context.cms.getModel(modelId);\n const accessControl = context.container.resolve(AccessControl);\n\n const canAccessModel = await accessControl.canAccessModel({ model, rwd: \"d\" });\n if (!canAccessModel) {\n throw new NotAuthorizedError(`Not allowed to access content model \"${model.name}\".`);\n }\n\n const canAccessEntry = await accessControl.canAccessEntry({ model, rwd: \"w\" });\n if (!canAccessEntry) {\n throw new NotAuthorizedError(`Not allowed to access \"${model.modelId}\" entries.`);\n }\n\n const storeKey = createStoreKey(model);\n\n const result = await context.db.store.getValue<IStoreValue>(storeKey);\n\n const taskId = result.data?.task;\n\n await context.db.store.removeValue(storeKey);\n if (!taskId) {\n if (result.error) {\n throw WebinyError.from(result.error, {\n code: \"DELETE_MODEL_NO_TASK_DEFINED\"\n });\n }\n throw new WebinyError({\n message: `Model \"${modelId}\" is not being deleted.`,\n code: \"MODEL_NOT_BEING_DELETED\"\n });\n }\n\n const task = await context.tasks.getTask<IDeleteModelTaskInput, IDeleteModelTaskOutput>(taskId);\n if (task?.definitionId !== DELETE_MODEL_TASK) {\n throw new WebinyError({\n message: `The task which is deleting a model cannot be found. Please check Step Functions for more info. Task id: ${taskId}`,\n code: \"DELETE_MODEL_TASK_NOT_FOUND\",\n data: {\n model: model.modelId,\n task: taskId\n }\n });\n }\n\n const abortResult = await context.tasks.abort<IDeleteModelTaskInput, IDeleteModelTaskOutput>({\n id: task.id,\n message: \"User canceled the task.\"\n });\n\n const canceledTask = abortResult.value;\n\n return {\n id: canceledTask.id,\n status: getStatus(canceledTask.taskStatus),\n total: canceledTask.output?.total || 0,\n deleted: canceledTask.output?.deleted || 0\n };\n};\n"],"names":["cancelDeleteModel","params","context","modelId","model","accessControl","AccessControl","canAccessModel","NotAuthorizedError","canAccessEntry","storeKey","createStoreKey","result","taskId","WebinyError","task","DELETE_MODEL_TASK","abortResult","canceledTask","getStatus"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Q,KAAK,CAAC,KAAK,CAAgD;QACzF,IAAIa,KAAK,EAAE;QACX,SAAS;IACb;IAEA,MAAMG,eAAeD,YAAY,KAAK;IAEtC,OAAO;QACH,IAAIC,aAAa,EAAE;QACnB,QAAQC,UAAUD,aAAa,UAAU;QACzC,OAAOA,aAAa,MAAM,EAAE,SAAS;QACrC,SAASA,aAAa,MAAM,EAAE,WAAW;IAC7C;AACJ"}
|
|
@@ -1,72 +1,63 @@
|
|
|
1
|
-
import { createCacheKey } from "@webiny/api-headless-cms/utils/index.js";
|
|
2
|
-
import { createMemoryCache } from "@webiny/api-headless-cms/utils/index.js";
|
|
1
|
+
import { createCacheKey, createMemoryCache } from "@webiny/api-headless-cms/utils/index.js";
|
|
3
2
|
import { ContextPlugin } from "@webiny/api";
|
|
4
3
|
import { DisableModelFeature } from "../../features/DisableModel/feature.js";
|
|
5
4
|
import { createStoreNamespace } from "../../helpers/store.js";
|
|
6
5
|
import { fullyDeleteModel } from "./fullyDeleteModel.js";
|
|
7
6
|
import { cancelDeleteModel } from "./cancelDeleteModel.js";
|
|
8
7
|
import { getDeleteModelProgress } from "./getDeleteModelProgress.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
8
|
+
const createDeleteModelCrud = ()=>{
|
|
9
|
+
const plugin = new ContextPlugin(async (context)=>{
|
|
10
|
+
const getTenant = ()=>context.tenancy.getCurrentTenant().id;
|
|
11
|
+
const cache = createMemoryCache();
|
|
12
|
+
context.cms.listModelsBeingDeleted = async ()=>{
|
|
13
|
+
const tenant = getTenant();
|
|
14
|
+
const cacheKey = createCacheKey({
|
|
15
|
+
tenant: getTenant(),
|
|
16
|
+
type: "deleteModel"
|
|
17
|
+
});
|
|
18
|
+
const result = await cache.getOrSet(cacheKey, async ()=>{
|
|
19
|
+
const beginsWith = createStoreNamespace({
|
|
20
|
+
tenant
|
|
21
|
+
});
|
|
22
|
+
return await context.db.store.listValues({
|
|
23
|
+
beginsWith
|
|
24
|
+
});
|
|
25
|
+
});
|
|
26
|
+
if (result.error) throw result.error;
|
|
27
|
+
if (!result.data) return [];
|
|
28
|
+
return Object.values(result.data);
|
|
29
|
+
};
|
|
30
|
+
context.cms.isModelBeingDeleted = async (modelId)=>{
|
|
31
|
+
const items = await context.cms.listModelsBeingDeleted();
|
|
32
|
+
return items.some((item)=>item.modelId === modelId);
|
|
33
|
+
};
|
|
34
|
+
context.cms.fullyDeleteModel = async (modelId)=>{
|
|
35
|
+
const result = await fullyDeleteModel({
|
|
36
|
+
context,
|
|
37
|
+
modelId
|
|
38
|
+
});
|
|
39
|
+
cache.clear();
|
|
40
|
+
return result;
|
|
41
|
+
};
|
|
42
|
+
context.cms.cancelFullyDeleteModel = async (modelId)=>{
|
|
43
|
+
const result = await cancelDeleteModel({
|
|
44
|
+
context,
|
|
45
|
+
modelId
|
|
46
|
+
});
|
|
47
|
+
cache.clear();
|
|
48
|
+
return result;
|
|
49
|
+
};
|
|
50
|
+
context.cms.getDeleteModelProgress = async (modelId)=>await getDeleteModelProgress({
|
|
51
|
+
context,
|
|
52
|
+
modelId
|
|
53
|
+
});
|
|
54
|
+
DisableModelFeature.register(context.container, {
|
|
55
|
+
isModelBeingDeleted: context.cms.isModelBeingDeleted
|
|
24
56
|
});
|
|
25
|
-
return await context.db.store.listValues({
|
|
26
|
-
beginsWith
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
if (result.error) {
|
|
30
|
-
throw result.error;
|
|
31
|
-
} else if (!result.data) {
|
|
32
|
-
return [];
|
|
33
|
-
}
|
|
34
|
-
return Object.values(result.data);
|
|
35
|
-
};
|
|
36
|
-
context.cms.isModelBeingDeleted = async modelId => {
|
|
37
|
-
const items = await context.cms.listModelsBeingDeleted();
|
|
38
|
-
return items.some(item => item.modelId === modelId);
|
|
39
|
-
};
|
|
40
|
-
context.cms.fullyDeleteModel = async modelId => {
|
|
41
|
-
const result = await fullyDeleteModel({
|
|
42
|
-
context,
|
|
43
|
-
modelId
|
|
44
|
-
});
|
|
45
|
-
cache.clear();
|
|
46
|
-
return result;
|
|
47
|
-
};
|
|
48
|
-
context.cms.cancelFullyDeleteModel = async modelId => {
|
|
49
|
-
const result = await cancelDeleteModel({
|
|
50
|
-
context,
|
|
51
|
-
modelId
|
|
52
|
-
});
|
|
53
|
-
cache.clear();
|
|
54
|
-
return result;
|
|
55
|
-
};
|
|
56
|
-
context.cms.getDeleteModelProgress = async modelId => {
|
|
57
|
-
return await getDeleteModelProgress({
|
|
58
|
-
context,
|
|
59
|
-
modelId
|
|
60
|
-
});
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
// Register feature
|
|
64
|
-
DisableModelFeature.register(context.container, {
|
|
65
|
-
isModelBeingDeleted: context.cms.isModelBeingDeleted
|
|
66
57
|
});
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
return plugin;
|
|
58
|
+
plugin.name = "headlessCms.context.cms.fullyDeleteModel";
|
|
59
|
+
return plugin;
|
|
70
60
|
};
|
|
61
|
+
export { createDeleteModelCrud };
|
|
71
62
|
|
|
72
63
|
//# sourceMappingURL=crud.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"graphql/deleteModel/crud.js","sources":["../../../src/graphql/deleteModel/crud.ts"],"sourcesContent":["import type { HcmsTasksContext } from \"~/types.js\";\nimport { createCacheKey } from \"@webiny/api-headless-cms/utils/index.js\";\nimport { createMemoryCache } from \"@webiny/api-headless-cms/utils/index.js\";\nimport type { IStoreValue } from \"~/features/DeleteModelTask/types.js\";\nimport type { ListStoreKeysResult } from \"~/features/DeleteModelTask/types.js\";\nimport type { GenericRecord } from \"@webiny/api/types.js\";\nimport { ContextPlugin } from \"@webiny/api\";\nimport { DisableModelFeature } from \"~/features/DisableModel/feature.js\";\nimport { createStoreNamespace } from \"~/helpers/store.js\";\nimport { fullyDeleteModel } from \"~/graphql/deleteModel/fullyDeleteModel.js\";\nimport { cancelDeleteModel } from \"~/graphql/deleteModel/cancelDeleteModel.js\";\nimport { getDeleteModelProgress } from \"~/graphql/deleteModel/getDeleteModelProgress.js\";\n\nexport const createDeleteModelCrud = () => {\n const plugin = new ContextPlugin<HcmsTasksContext>(async context => {\n const getTenant = (): string => {\n return context.tenancy.getCurrentTenant().id;\n };\n\n const cache = createMemoryCache<ListStoreKeysResult>();\n\n context.cms.listModelsBeingDeleted = async () => {\n const tenant = getTenant();\n const cacheKey = createCacheKey({\n tenant: getTenant(),\n type: \"deleteModel\"\n });\n\n const result = await cache.getOrSet(cacheKey, async () => {\n const beginsWith = createStoreNamespace({\n tenant\n });\n return await context.db.store.listValues<GenericRecord<string, IStoreValue>>({\n beginsWith\n });\n });\n\n if (result.error) {\n throw result.error;\n } else if (!result.data) {\n return [];\n }\n return Object.values(result.data);\n };\n\n context.cms.isModelBeingDeleted = async (modelId: string) => {\n const items = await context.cms.listModelsBeingDeleted();\n return items.some(item => item.modelId === modelId);\n };\n context.cms.fullyDeleteModel = async (modelId: string) => {\n const result = await fullyDeleteModel({\n context,\n modelId\n });\n cache.clear();\n return result;\n };\n\n context.cms.cancelFullyDeleteModel = async (modelId: string) => {\n const result = await cancelDeleteModel({\n context,\n modelId\n });\n cache.clear();\n return result;\n };\n\n context.cms.getDeleteModelProgress = async (modelId: string) => {\n return await getDeleteModelProgress({\n context,\n modelId\n });\n };\n\n // Register feature\n DisableModelFeature.register(context.container, {\n isModelBeingDeleted: context.cms.isModelBeingDeleted\n });\n });\n\n plugin.name = \"headlessCms.context.cms.fullyDeleteModel\";\n\n return plugin;\n};\n"],"names":["createDeleteModelCrud","plugin","ContextPlugin","context","getTenant","cache","createMemoryCache","tenant","cacheKey","createCacheKey","result","beginsWith","createStoreNamespace","Object","modelId","items","item","fullyDeleteModel","cancelDeleteModel","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AE;YAC5C,qBAAqBA,QAAQ,GAAG,CAAC,mBAAmB;QACxD;IACJ;IAEAF,OAAO,IAAI,GAAG;IAEd,OAAOA;AACX"}
|
|
@@ -1,56 +1,51 @@
|
|
|
1
1
|
import { createStoreKey, createStoreValue } from "../../helpers/store.js";
|
|
2
2
|
import { DELETE_MODEL_TASK } from "../../constants.js";
|
|
3
3
|
import { getStatus } from "./status.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
context,
|
|
7
|
-
modelId
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
model
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return {
|
|
49
|
-
id: task.id,
|
|
50
|
-
status: getStatus(task.taskStatus),
|
|
51
|
-
total: 0,
|
|
52
|
-
deleted: 0
|
|
53
|
-
};
|
|
4
|
+
import { NotAuthorizedError } from "@webiny/api-headless-cms/utils/errors.js";
|
|
5
|
+
const fullyDeleteModel = async (params)=>{
|
|
6
|
+
const { context, modelId } = params;
|
|
7
|
+
const model = await context.cms.getModel(modelId);
|
|
8
|
+
if (model.isPrivate) throw new Error("Cannot delete private model.");
|
|
9
|
+
const canAccessModel = await context.cms.accessControl.canAccessModel({
|
|
10
|
+
model,
|
|
11
|
+
rwd: "d"
|
|
12
|
+
});
|
|
13
|
+
if (!canAccessModel) throw new NotAuthorizedError(`Not allowed to access content model "${model.name}".`);
|
|
14
|
+
const canAccessEntry = await context.cms.accessControl.canAccessEntry({
|
|
15
|
+
model,
|
|
16
|
+
rwd: "w"
|
|
17
|
+
});
|
|
18
|
+
if (!canAccessEntry) throw new NotAuthorizedError(`Not allowed to access "${model.modelId}" entries.`);
|
|
19
|
+
if (!model) throw new Error(`Model "${modelId}" not found.`);
|
|
20
|
+
const storeKey = createStoreKey(model);
|
|
21
|
+
const result = await context.db.store.getValue(storeKey);
|
|
22
|
+
const taskId = result.data?.task;
|
|
23
|
+
if (taskId) throw new Error(`Model "${modelId}" is already getting deleted. Task id: ${taskId}.`);
|
|
24
|
+
const triggerResult = await context.tasks.trigger({
|
|
25
|
+
input: {
|
|
26
|
+
modelId
|
|
27
|
+
},
|
|
28
|
+
definition: DELETE_MODEL_TASK,
|
|
29
|
+
name: `Fully delete model: ${modelId}`
|
|
30
|
+
});
|
|
31
|
+
const task = triggerResult.value;
|
|
32
|
+
const identity = context.security.getIdentity();
|
|
33
|
+
await context.db.store.storeValue(storeKey, createStoreValue({
|
|
34
|
+
...model,
|
|
35
|
+
identity: {
|
|
36
|
+
id: identity.id,
|
|
37
|
+
type: identity.type,
|
|
38
|
+
displayName: identity.displayName
|
|
39
|
+
},
|
|
40
|
+
task: task.id
|
|
41
|
+
}));
|
|
42
|
+
return {
|
|
43
|
+
id: task.id,
|
|
44
|
+
status: getStatus(task.taskStatus),
|
|
45
|
+
total: 0,
|
|
46
|
+
deleted: 0
|
|
47
|
+
};
|
|
54
48
|
};
|
|
49
|
+
export { fullyDeleteModel };
|
|
55
50
|
|
|
56
51
|
//# sourceMappingURL=fullyDeleteModel.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"graphql/deleteModel/fullyDeleteModel.js","sources":["../../../src/graphql/deleteModel/fullyDeleteModel.ts"],"sourcesContent":["import type { HcmsTasksContext } from \"~/types.js\";\nimport type {\n IDeleteCmsModelTask,\n IDeleteModelTaskInput,\n IStoreValue\n} from \"~/features/DeleteModelTask/types.js\";\nimport { createStoreKey, createStoreValue } from \"~/helpers/store.js\";\nimport { DELETE_MODEL_TASK } from \"~/constants.js\";\nimport { getStatus } from \"~/graphql/deleteModel/status.js\";\nimport { NotAuthorizedError } from \"@webiny/api-headless-cms/utils/errors.js\";\n\nexport interface IFullyDeleteModelParams {\n readonly context: Pick<HcmsTasksContext, \"cms\" | \"tasks\" | \"db\" | \"security\">;\n readonly modelId: string;\n}\n\nexport const fullyDeleteModel = async (\n params: IFullyDeleteModelParams\n): Promise<IDeleteCmsModelTask> => {\n const { context, modelId } = params;\n\n const model = await context.cms.getModel(modelId);\n\n if (model.isPrivate) {\n throw new Error(`Cannot delete private model.`);\n }\n\n const canAccessModel = await context.cms.accessControl.canAccessModel({ model, rwd: \"d\" });\n if (!canAccessModel) {\n throw new NotAuthorizedError(`Not allowed to access content model \"${model.name}\".`);\n }\n\n const canAccessEntry = await context.cms.accessControl.canAccessEntry({ model, rwd: \"w\" });\n if (!canAccessEntry) {\n throw new NotAuthorizedError(`Not allowed to access \"${model.modelId}\" entries.`);\n }\n\n if (!model) {\n throw new Error(`Model \"${modelId}\" not found.`);\n }\n const storeKey = createStoreKey(model);\n const result = await context.db.store.getValue<IStoreValue>(storeKey);\n const taskId = result.data?.task;\n if (taskId) {\n throw new Error(`Model \"${modelId}\" is already getting deleted. Task id: ${taskId}.`);\n }\n\n const triggerResult = await context.tasks.trigger<IDeleteModelTaskInput>({\n input: {\n modelId\n },\n definition: DELETE_MODEL_TASK,\n name: `Fully delete model: ${modelId}`\n });\n\n const task = triggerResult.value;\n\n const identity = context.security.getIdentity();\n\n await context.db.store.storeValue(\n storeKey,\n createStoreValue({\n ...model,\n identity: {\n id: identity.id,\n type: identity.type,\n displayName: identity.displayName\n },\n task: task.id\n })\n );\n\n return {\n id: task.id,\n status: getStatus(task.taskStatus),\n total: 0,\n deleted: 0\n };\n};\n"],"names":["fullyDeleteModel","params","context","modelId","model","Error","canAccessModel","NotAuthorizedError","canAccessEntry","storeKey","createStoreKey","result","taskId","triggerResult","DELETE_MODEL_TASK","task","identity","createStoreValue","getStatus"],"mappings":";;;;AAgBO,MAAMA,mBAAmB,OAC5BC;IAEA,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGF;IAE7B,MAAMG,QAAQ,MAAMF,QAAQ,GAAG,CAAC,QAAQ,CAACC;IAEzC,IAAIC,MAAM,SAAS,EACf,MAAM,IAAIC,MAAM;IAGpB,MAAMC,iBAAiB,MAAMJ,QAAQ,GAAG,CAAC,aAAa,CAAC,cAAc,CAAC;QAAEE;QAAO,KAAK;IAAI;IACxF,IAAI,CAACE,gBACD,MAAM,IAAIC,mBAAmB,CAAC,qCAAqC,EAAEH,MAAM,IAAI,CAAC,EAAE,CAAC;IAGvF,MAAMI,iBAAiB,MAAMN,QAAQ,GAAG,CAAC,aAAa,CAAC,cAAc,CAAC;QAAEE;QAAO,KAAK;IAAI;IACxF,IAAI,CAACI,gBACD,MAAM,IAAID,mBAAmB,CAAC,uBAAuB,EAAEH,MAAM,OAAO,CAAC,UAAU,CAAC;IAGpF,IAAI,CAACA,OACD,MAAM,IAAIC,MAAM,CAAC,OAAO,EAAEF,QAAQ,YAAY,CAAC;IAEnD,MAAMM,WAAWC,eAAeN;IAChC,MAAMO,SAAS,MAAMT,QAAQ,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAcO;IAC5D,MAAMG,SAASD,OAAO,IAAI,EAAE;IAC5B,IAAIC,QACA,MAAM,IAAIP,MAAM,CAAC,OAAO,EAAEF,QAAQ,uCAAuC,EAAES,OAAO,CAAC,CAAC;IAGxF,MAAMC,gBAAgB,MAAMX,QAAQ,KAAK,CAAC,OAAO,CAAwB;QACrE,OAAO;YACHC;QACJ;QACA,YAAYW;QACZ,MAAM,CAAC,oBAAoB,EAAEX,SAAS;IAC1C;IAEA,MAAMY,OAAOF,cAAc,KAAK;IAEhC,MAAMG,WAAWd,QAAQ,QAAQ,CAAC,WAAW;IAE7C,MAAMA,QAAQ,EAAE,CAAC,KAAK,CAAC,UAAU,CAC7BO,UACAQ,iBAAiB;QACb,GAAGb,KAAK;QACR,UAAU;YACN,IAAIY,SAAS,EAAE;YACf,MAAMA,SAAS,IAAI;YACnB,aAAaA,SAAS,WAAW;QACrC;QACA,MAAMD,KAAK,EAAE;IACjB;IAGJ,OAAO;QACH,IAAIA,KAAK,EAAE;QACX,QAAQG,UAAUH,KAAK,UAAU;QACjC,OAAO;QACP,SAAS;IACb;AACJ"}
|
|
@@ -3,57 +3,52 @@ import { NotFoundError } from "@webiny/handler-graphql";
|
|
|
3
3
|
import { createStoreKey } from "../../helpers/store.js";
|
|
4
4
|
import { DELETE_MODEL_TASK } from "../../constants.js";
|
|
5
5
|
import { getStatus } from "./status.js";
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
context,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
6
|
+
import { NotAuthorizedError } from "@webiny/api-headless-cms/utils/errors.js";
|
|
7
|
+
const getDeleteModelProgress = async (params)=>{
|
|
8
|
+
const { context, modelId } = params;
|
|
9
|
+
let model;
|
|
10
|
+
try {
|
|
11
|
+
model = await context.cms.getModel(modelId);
|
|
12
|
+
} catch (ex) {
|
|
13
|
+
if (ex instanceof NotFoundError === false) throw ex;
|
|
14
|
+
throw new WebinyError({
|
|
15
|
+
message: "Model not found. It must have been deleted already.",
|
|
16
|
+
code: "MODEL_ALREADY_DELETED_FOUND",
|
|
17
|
+
data: {
|
|
18
|
+
model: modelId
|
|
19
|
+
}
|
|
20
|
+
});
|
|
17
21
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
data: {
|
|
22
|
-
model: modelId
|
|
23
|
-
}
|
|
22
|
+
const canAccessModel = await context.cms.accessControl.canAccessModel({
|
|
23
|
+
model,
|
|
24
|
+
rwd: "d"
|
|
24
25
|
});
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
});
|
|
30
|
-
await context.cms.accessControl.ensureCanAccessEntry({
|
|
31
|
-
model,
|
|
32
|
-
rwd: "w"
|
|
33
|
-
});
|
|
34
|
-
const storeKey = createStoreKey(model);
|
|
35
|
-
const result = await context.db.store.getValue(storeKey);
|
|
36
|
-
const taskId = result.data?.task;
|
|
37
|
-
if (!taskId) {
|
|
38
|
-
throw new Error(`Model "${modelId}" is not being deleted.`);
|
|
39
|
-
}
|
|
40
|
-
const task = await context.tasks.getTask(taskId);
|
|
41
|
-
if (task?.definitionId !== DELETE_MODEL_TASK) {
|
|
42
|
-
throw new WebinyError({
|
|
43
|
-
message: `The task which is deleting a model cannot be found.`,
|
|
44
|
-
code: "DELETE_MODEL_TASK_NOT_FOUND",
|
|
45
|
-
data: {
|
|
46
|
-
model: model.modelId,
|
|
47
|
-
task: taskId
|
|
48
|
-
}
|
|
26
|
+
if (!canAccessModel) throw new NotAuthorizedError(`Not allowed to access content model "${model.name}".`);
|
|
27
|
+
const canAccessEntry = await context.cms.accessControl.canAccessEntry({
|
|
28
|
+
model,
|
|
29
|
+
rwd: "w"
|
|
49
30
|
});
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
31
|
+
if (!canAccessEntry) throw new NotAuthorizedError(`Not allowed to access "${model.modelId}" entries.`);
|
|
32
|
+
const storeKey = createStoreKey(model);
|
|
33
|
+
const result = await context.db.store.getValue(storeKey);
|
|
34
|
+
const taskId = result.data?.task;
|
|
35
|
+
if (!taskId) throw new Error(`Model "${modelId}" is not being deleted.`);
|
|
36
|
+
const task = await context.tasks.getTask(taskId);
|
|
37
|
+
if (task?.definitionId !== DELETE_MODEL_TASK) throw new WebinyError({
|
|
38
|
+
message: "The task which is deleting a model cannot be found.",
|
|
39
|
+
code: "DELETE_MODEL_TASK_NOT_FOUND",
|
|
40
|
+
data: {
|
|
41
|
+
model: model.modelId,
|
|
42
|
+
task: taskId
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return {
|
|
46
|
+
id: task.id,
|
|
47
|
+
status: getStatus(task.taskStatus),
|
|
48
|
+
total: task.output?.total || 0,
|
|
49
|
+
deleted: task.output?.deleted || 0
|
|
50
|
+
};
|
|
57
51
|
};
|
|
52
|
+
export { getDeleteModelProgress };
|
|
58
53
|
|
|
59
54
|
//# sourceMappingURL=getDeleteModelProgress.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"graphql/deleteModel/getDeleteModelProgress.js","sources":["../../../src/graphql/deleteModel/getDeleteModelProgress.ts"],"sourcesContent":["import type { HcmsTasksContext } from \"~/types.js\";\nimport { WebinyError } from \"@webiny/error\";\nimport { NotFoundError } from \"@webiny/handler-graphql\";\nimport type { CmsModel } from \"@webiny/api-headless-cms/types/index.js\";\nimport type {\n IDeleteCmsModelTask,\n IDeleteModelTaskInput,\n IDeleteModelTaskOutput,\n IStoreValue\n} from \"~/features/DeleteModelTask/types.js\";\nimport { createStoreKey } from \"~/helpers/store.js\";\nimport { DELETE_MODEL_TASK } from \"~/constants.js\";\nimport { getStatus } from \"~/graphql/deleteModel/status.js\";\nimport { NotAuthorizedError } from \"@webiny/api-headless-cms/utils/errors.js\";\n\nexport interface IGetDeleteModelProgress {\n readonly context: Pick<HcmsTasksContext, \"cms\" | \"tasks\" | \"db\">;\n readonly modelId: string;\n}\n\nexport const getDeleteModelProgress = async (\n params: IGetDeleteModelProgress\n): Promise<IDeleteCmsModelTask> => {\n const { context, modelId } = params;\n\n let model: CmsModel;\n try {\n model = await context.cms.getModel(modelId);\n } catch (ex) {\n if (ex instanceof NotFoundError === false) {\n throw ex;\n }\n throw new WebinyError({\n message: \"Model not found. It must have been deleted already.\",\n code: \"MODEL_ALREADY_DELETED_FOUND\",\n data: {\n model: modelId\n }\n });\n }\n\n const canAccessModel = await context.cms.accessControl.canAccessModel({ model, rwd: \"d\" });\n if (!canAccessModel) {\n throw new NotAuthorizedError(`Not allowed to access content model \"${model.name}\".`);\n }\n\n const canAccessEntry = await context.cms.accessControl.canAccessEntry({ model, rwd: \"w\" });\n if (!canAccessEntry) {\n throw new NotAuthorizedError(`Not allowed to access \"${model.modelId}\" entries.`);\n }\n\n const storeKey = createStoreKey(model);\n const result = await context.db.store.getValue<IStoreValue>(storeKey);\n\n const taskId = result.data?.task;\n if (!taskId) {\n throw new Error(`Model \"${modelId}\" is not being deleted.`);\n }\n\n const task = await context.tasks.getTask<IDeleteModelTaskInput, IDeleteModelTaskOutput>(taskId);\n if (task?.definitionId !== DELETE_MODEL_TASK) {\n throw new WebinyError({\n message: `The task which is deleting a model cannot be found.`,\n code: \"DELETE_MODEL_TASK_NOT_FOUND\",\n data: {\n model: model.modelId,\n task: taskId\n }\n });\n }\n return {\n id: task.id,\n status: getStatus(task.taskStatus),\n total: task.output?.total || 0,\n deleted: task.output?.deleted || 0\n };\n};\n"],"names":["getDeleteModelProgress","params","context","modelId","model","ex","NotFoundError","WebinyError","canAccessModel","NotAuthorizedError","canAccessEntry","storeKey","createStoreKey","result","taskId","Error","task","DELETE_MODEL_TASK","getStatus"],"mappings":";;;;;;AAoBO,MAAMA,yBAAyB,OAClCC;IAEA,MAAM,EAAEC,OAAO,EAAEC,OAAO,EAAE,GAAGF;IAE7B,IAAIG;IACJ,IAAI;QACAA,QAAQ,MAAMF,QAAQ,GAAG,CAAC,QAAQ,CAACC;IACvC,EAAE,OAAOE,IAAI;QACT,IAAIA,cAAcC,kBAAkB,OAChC,MAAMD;QAEV,MAAM,IAAIE,YAAY;YAClB,SAAS;YACT,MAAM;YACN,MAAM;gBACF,OAAOJ;YACX;QACJ;IACJ;IAEA,MAAMK,iBAAiB,MAAMN,QAAQ,GAAG,CAAC,aAAa,CAAC,cAAc,CAAC;QAAEE;QAAO,KAAK;IAAI;IACxF,IA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