@webiny/api-headless-cms 6.6.0-alpha.10 → 6.6.0-alpha.11
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.
|
@@ -13,13 +13,17 @@ class SyncStorageOnModelUpdateImpl {
|
|
|
13
13
|
if (!this.sync || !this.taskService || model.isPlugin) return;
|
|
14
14
|
try {
|
|
15
15
|
if (!await this.sync.needsSync(model)) return;
|
|
16
|
-
await this.taskService.trigger({
|
|
16
|
+
const result = await this.taskService.trigger({
|
|
17
17
|
definition: MODEL_STORAGE_SYNC_TASK,
|
|
18
18
|
name: `Sync storage of model "${model.modelId}"`,
|
|
19
19
|
input: {
|
|
20
20
|
modelId: model.modelId
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
|
+
if (result.isFail()) this.logger.error({
|
|
24
|
+
error: result.error,
|
|
25
|
+
modelId: model.modelId
|
|
26
|
+
}, "Could not start the storage sync of a changed model.");
|
|
23
27
|
} catch (error) {
|
|
24
28
|
this.logger.error({
|
|
25
29
|
error,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"features/modelStorageSync/SyncStorageOnModelUpdate.js","sources":["../../../src/features/modelStorageSync/SyncStorageOnModelUpdate.ts"],"sourcesContent":["import { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\nimport { ModelAfterUpdateEventHandler } from \"~/features/contentModel/UpdateModel/index.js\";\nimport {\n MODEL_STORAGE_SYNC_TASK,\n ModelStorageSync,\n type IModelStorageSyncTaskInput\n} from \"./abstractions.js\";\n\n/**\n * After a model edited in the admin UI is saved, starts the background sync if its storage has work\n * to do. Code models are skipped: there is no event for a changed code definition, so their sync is\n * triggered after a deploy (the background tasks `triggerTask` mutation, or `TaskService`).\n *\n * Never fails the update: the model is already stored, and pending work only makes some queries\n * slower until a sync runs.\n */\nclass SyncStorageOnModelUpdateImpl implements ModelAfterUpdateEventHandler.Interface {\n public constructor(\n private readonly logger: Logger.Interface,\n private readonly sync?: ModelStorageSync.Interface,\n private readonly taskService?: TaskService.Interface\n ) {}\n\n public async handle(event: ModelAfterUpdateEventHandler.Event): Promise<void> {\n const { model } = event.payload;\n if (!this.sync || !this.taskService || model.isPlugin) {\n return;\n }\n try {\n if (!(await this.sync.needsSync(model))) {\n return;\n }\n await this.taskService.trigger<IModelStorageSyncTaskInput>({\n definition: MODEL_STORAGE_SYNC_TASK,\n name: `Sync storage of model \"${model.modelId}\"`,\n input: { modelId: model.modelId }\n });\n } catch (error) {\n this.logger.error(\n { error, modelId: model.modelId },\n \"Could not start the storage sync of a changed model.\"\n );\n }\n }\n}\n\nexport const SyncStorageOnModelUpdate = ModelAfterUpdateEventHandler.createImplementation({\n implementation: SyncStorageOnModelUpdateImpl,\n dependencies: [\n Logger,\n [ModelStorageSync, { optional: true }],\n [TaskService, { optional: true }]\n ]\n});\n"],"names":["SyncStorageOnModelUpdateImpl","logger","sync","taskService","event","model","MODEL_STORAGE_SYNC_TASK","error","SyncStorageOnModelUpdate","ModelAfterUpdateEventHandler","Logger","ModelStorageSync","TaskService"],"mappings":";;;;AAiBA,MAAMA;IACF,YACqBC,MAAwB,EACxBC,IAAiC,EACjCC,WAAmC,CACtD;aAHmBF,MAAM,GAANA;aACAC,IAAI,GAAJA;aACAC,WAAW,GAAXA;IAClB;IAEH,MAAa,OAAOC,KAAyC,EAAiB;QAC1E,MAAM,EAAEC,KAAK,EAAE,GAAGD,MAAM,OAAO;QAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,IAAIC,MAAM,QAAQ,EACjD;QAEJ,IAAI;YACA,IAAI,CAAE,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAACA,QAC5B;YAEJ,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAA6B;
|
|
1
|
+
{"version":3,"file":"features/modelStorageSync/SyncStorageOnModelUpdate.js","sources":["../../../src/features/modelStorageSync/SyncStorageOnModelUpdate.ts"],"sourcesContent":["import { TaskService } from \"@webiny/api-core/features/task/TaskService/index.js\";\nimport { Logger } from \"@webiny/api-core/features/logger/index.js\";\nimport { ModelAfterUpdateEventHandler } from \"~/features/contentModel/UpdateModel/index.js\";\nimport {\n MODEL_STORAGE_SYNC_TASK,\n ModelStorageSync,\n type IModelStorageSyncTaskInput\n} from \"./abstractions.js\";\n\n/**\n * After a model edited in the admin UI is saved, starts the background sync if its storage has work\n * to do. Code models are skipped: there is no event for a changed code definition, so their sync is\n * triggered after a deploy (the background tasks `triggerTask` mutation, or `TaskService`).\n *\n * Never fails the update: the model is already stored, and pending work only makes some queries\n * slower until a sync runs.\n */\nclass SyncStorageOnModelUpdateImpl implements ModelAfterUpdateEventHandler.Interface {\n public constructor(\n private readonly logger: Logger.Interface,\n private readonly sync?: ModelStorageSync.Interface,\n private readonly taskService?: TaskService.Interface\n ) {}\n\n public async handle(event: ModelAfterUpdateEventHandler.Event): Promise<void> {\n const { model } = event.payload;\n if (!this.sync || !this.taskService || model.isPlugin) {\n return;\n }\n try {\n if (!(await this.sync.needsSync(model))) {\n return;\n }\n const result = await this.taskService.trigger<IModelStorageSyncTaskInput>({\n definition: MODEL_STORAGE_SYNC_TASK,\n name: `Sync storage of model \"${model.modelId}\"`,\n input: { modelId: model.modelId }\n });\n if (result.isFail()) {\n this.logger.error(\n { error: result.error, modelId: model.modelId },\n \"Could not start the storage sync of a changed model.\"\n );\n }\n } catch (error) {\n this.logger.error(\n { error, modelId: model.modelId },\n \"Could not start the storage sync of a changed model.\"\n );\n }\n }\n}\n\nexport const SyncStorageOnModelUpdate = ModelAfterUpdateEventHandler.createImplementation({\n implementation: SyncStorageOnModelUpdateImpl,\n dependencies: [\n Logger,\n [ModelStorageSync, { optional: true }],\n [TaskService, { optional: true }]\n ]\n});\n"],"names":["SyncStorageOnModelUpdateImpl","logger","sync","taskService","event","model","result","MODEL_STORAGE_SYNC_TASK","error","SyncStorageOnModelUpdate","ModelAfterUpdateEventHandler","Logger","ModelStorageSync","TaskService"],"mappings":";;;;AAiBA,MAAMA;IACF,YACqBC,MAAwB,EACxBC,IAAiC,EACjCC,WAAmC,CACtD;aAHmBF,MAAM,GAANA;aACAC,IAAI,GAAJA;aACAC,WAAW,GAAXA;IAClB;IAEH,MAAa,OAAOC,KAAyC,EAAiB;QAC1E,MAAM,EAAEC,KAAK,EAAE,GAAGD,MAAM,OAAO;QAC/B,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,IAAIC,MAAM,QAAQ,EACjD;QAEJ,IAAI;YACA,IAAI,CAAE,MAAM,IAAI,CAAC,IAAI,CAAC,SAAS,CAACA,QAC5B;YAEJ,MAAMC,SAAS,MAAM,IAAI,CAAC,WAAW,CAAC,OAAO,CAA6B;gBACtE,YAAYC;gBACZ,MAAM,CAAC,uBAAuB,EAAEF,MAAM,OAAO,CAAC,CAAC,CAAC;gBAChD,OAAO;oBAAE,SAASA,MAAM,OAAO;gBAAC;YACpC;YACA,IAAIC,OAAO,MAAM,IACb,IAAI,CAAC,MAAM,CAAC,KAAK,CACb;gBAAE,OAAOA,OAAO,KAAK;gBAAE,SAASD,MAAM,OAAO;YAAC,GAC9C;QAGZ,EAAE,OAAOG,OAAO;YACZ,IAAI,CAAC,MAAM,CAAC,KAAK,CACb;gBAAEA;gBAAO,SAASH,MAAM,OAAO;YAAC,GAChC;QAER;IACJ;AACJ;AAEO,MAAMI,2BAA2BC,6BAA6B,oBAAoB,CAAC;IACtF,gBAAgBV;IAChB,cAAc;QACVW;QACA;YAACC;YAAkB;gBAAE,UAAU;YAAK;SAAE;QACtC;YAACC;YAAa;gBAAE,UAAU;YAAK;SAAE;KACpC;AACL"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webiny/api-headless-cms",
|
|
3
|
-
"version": "6.6.0-alpha.
|
|
3
|
+
"version": "6.6.0-alpha.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./index.js",
|
|
@@ -25,18 +25,18 @@
|
|
|
25
25
|
"@babel/code-frame": "8.0.6",
|
|
26
26
|
"@graphql-tools/merge": "10.0.8",
|
|
27
27
|
"@graphql-tools/schema": "11.0.8",
|
|
28
|
-
"@webiny/api": "6.6.0-alpha.
|
|
29
|
-
"@webiny/api-core": "6.6.0-alpha.
|
|
30
|
-
"@webiny/api-core-testing": "6.6.0-alpha.
|
|
31
|
-
"@webiny/api-graphql": "6.6.0-alpha.
|
|
28
|
+
"@webiny/api": "6.6.0-alpha.11",
|
|
29
|
+
"@webiny/api-core": "6.6.0-alpha.11",
|
|
30
|
+
"@webiny/api-core-testing": "6.6.0-alpha.11",
|
|
31
|
+
"@webiny/api-graphql": "6.6.0-alpha.11",
|
|
32
32
|
"@webiny/di": "2.0.0",
|
|
33
|
-
"@webiny/error": "6.6.0-alpha.
|
|
34
|
-
"@webiny/event-handler-core": "6.6.0-alpha.
|
|
35
|
-
"@webiny/feature": "6.6.0-alpha.
|
|
36
|
-
"@webiny/handler": "6.6.0-alpha.
|
|
37
|
-
"@webiny/plugins": "6.6.0-alpha.
|
|
38
|
-
"@webiny/utils": "6.6.0-alpha.
|
|
39
|
-
"@webiny/validation": "6.6.0-alpha.
|
|
33
|
+
"@webiny/error": "6.6.0-alpha.11",
|
|
34
|
+
"@webiny/event-handler-core": "6.6.0-alpha.11",
|
|
35
|
+
"@webiny/feature": "6.6.0-alpha.11",
|
|
36
|
+
"@webiny/handler": "6.6.0-alpha.11",
|
|
37
|
+
"@webiny/plugins": "6.6.0-alpha.11",
|
|
38
|
+
"@webiny/utils": "6.6.0-alpha.11",
|
|
39
|
+
"@webiny/validation": "6.6.0-alpha.11",
|
|
40
40
|
"dot-prop-immutable": "2.1.1",
|
|
41
41
|
"graphql": "16.14.2",
|
|
42
42
|
"graphql-tag": "2.12.7",
|
|
@@ -49,10 +49,10 @@
|
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/pluralize": "0.0.33",
|
|
52
|
-
"@webiny/build-tools": "6.6.0-alpha.
|
|
53
|
-
"@webiny/db-dynamodb": "6.6.0-alpha.
|
|
54
|
-
"@webiny/sdk": "6.6.0-alpha.
|
|
55
|
-
"@webiny/wcp": "6.6.0-alpha.
|
|
52
|
+
"@webiny/build-tools": "6.6.0-alpha.11",
|
|
53
|
+
"@webiny/db-dynamodb": "6.6.0-alpha.11",
|
|
54
|
+
"@webiny/sdk": "6.6.0-alpha.11",
|
|
55
|
+
"@webiny/wcp": "6.6.0-alpha.11",
|
|
56
56
|
"graphql": "16.14.2",
|
|
57
57
|
"oxfmt": "0.75.0",
|
|
58
58
|
"rimraf": "6.1.3",
|