@webiny/api-headless-cms 5.20.0-beta.1 → 5.21.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/content/graphQLHandlerFactory.js +5 -2
- package/content/plugins/crud/contentEntry/afterDelete.d.ts +1 -1
- package/content/plugins/crud/contentEntry/afterDelete.js +2 -2
- package/content/plugins/crud/contentEntry/beforeCreate.d.ts +1 -1
- package/content/plugins/crud/contentEntry/beforeCreate.js +2 -2
- package/content/plugins/crud/contentEntry/beforeUpdate.d.ts +1 -1
- package/content/plugins/crud/contentEntry/beforeUpdate.js +2 -2
- package/content/plugins/crud/contentEntry.crud.js +72 -68
- package/content/plugins/crud/contentModel/afterCreate.d.ts +1 -1
- package/content/plugins/crud/contentModel/afterCreate.js +2 -2
- package/content/plugins/crud/contentModel/afterDelete.d.ts +1 -1
- package/content/plugins/crud/contentModel/afterDelete.js +2 -2
- package/content/plugins/crud/contentModel/afterUpdate.d.ts +1 -1
- package/content/plugins/crud/contentModel/afterUpdate.js +2 -2
- package/content/plugins/crud/contentModel/beforeCreate.d.ts +2 -2
- package/content/plugins/crud/contentModel/beforeCreate.js +4 -4
- package/content/plugins/crud/contentModel/beforeDelete.d.ts +1 -1
- package/content/plugins/crud/contentModel/beforeDelete.js +2 -2
- package/content/plugins/crud/contentModel/beforeUpdate.d.ts +1 -1
- package/content/plugins/crud/contentModel/beforeUpdate.js +2 -2
- package/content/plugins/crud/contentModel.crud.js +50 -65
- package/content/plugins/graphqlFields/boolean.js +4 -2
- package/content/plugins/graphqlFields/datetime.js +4 -1
- package/content/plugins/graphqlFields/file.js +5 -2
- package/content/plugins/graphqlFields/longText.js +4 -2
- package/content/plugins/graphqlFields/number.js +4 -2
- package/content/plugins/graphqlFields/object.js +3 -1
- package/content/plugins/graphqlFields/ref.js +4 -2
- package/content/plugins/graphqlFields/requiredField.d.ts +2 -0
- package/content/plugins/graphqlFields/requiredField.js +24 -0
- package/content/plugins/graphqlFields/richText.js +5 -2
- package/content/plugins/graphqlFields/text.js +4 -2
- package/content/plugins/schema/contentModelGroups.js +6 -2
- package/content/plugins/storage/object.js +5 -0
- package/package.json +23 -23
- package/plugins/crud/system.crud.js +11 -3
- package/types.d.ts +43 -27
- package/types.js +15 -0
|
@@ -23,16 +23,19 @@ var _buildSchemaPlugins = _interopRequireDefault(require("./plugins/buildSchemaP
|
|
|
23
23
|
|
|
24
24
|
var _plugins = require("@webiny/handler-graphql/plugins");
|
|
25
25
|
|
|
26
|
+
var _utils = require("@webiny/utils");
|
|
27
|
+
|
|
26
28
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }
|
|
27
29
|
|
|
28
30
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { (0, _defineProperty2.default)(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
|
|
29
31
|
|
|
30
|
-
const DEFAULT_HEADERS = {
|
|
32
|
+
const DEFAULT_HEADERS = _objectSpread({
|
|
31
33
|
"Access-Control-Allow-Origin": "*",
|
|
32
34
|
"Access-Control-Allow-Headers": "*",
|
|
33
35
|
"Access-Control-Allow-Methods": "OPTIONS,POST",
|
|
34
36
|
"Content-Type": "application/json"
|
|
35
|
-
};
|
|
37
|
+
}, (0, _utils.getWebinyVersionHeaders)());
|
|
38
|
+
|
|
36
39
|
const DEFAULT_CACHE_MAX_AGE = 30758400; // 1 year
|
|
37
40
|
|
|
38
41
|
const respond = (http, result) => {
|
|
@@ -2,6 +2,6 @@ import { Topic } from "@webiny/pubsub/types";
|
|
|
2
2
|
import { AfterEntryDeleteTopicParams, CmsContext } from "../../../../types";
|
|
3
3
|
export interface Params {
|
|
4
4
|
context: CmsContext;
|
|
5
|
-
|
|
5
|
+
onAfterEntryDelete: Topic<AfterEntryDeleteTopicParams>;
|
|
6
6
|
}
|
|
7
7
|
export declare const assignAfterEntryDelete: (params: Params) => void;
|
|
@@ -10,9 +10,9 @@ var _markLockedFields = require("./markLockedFields");
|
|
|
10
10
|
const assignAfterEntryDelete = params => {
|
|
11
11
|
const {
|
|
12
12
|
context,
|
|
13
|
-
|
|
13
|
+
onAfterEntryDelete
|
|
14
14
|
} = params;
|
|
15
|
-
|
|
15
|
+
onAfterEntryDelete.subscribe(async params => {
|
|
16
16
|
const {
|
|
17
17
|
entry,
|
|
18
18
|
model
|
|
@@ -2,6 +2,6 @@ import { Topic } from "@webiny/pubsub/types";
|
|
|
2
2
|
import { BeforeEntryCreateTopicParams, CmsContext } from "../../../../types";
|
|
3
3
|
export interface Params {
|
|
4
4
|
context: CmsContext;
|
|
5
|
-
|
|
5
|
+
onBeforeEntryCreate: Topic<BeforeEntryCreateTopicParams>;
|
|
6
6
|
}
|
|
7
7
|
export declare const assignBeforeEntryCreate: (params: Params) => void;
|
|
@@ -10,9 +10,9 @@ var _markLockedFields = require("./markLockedFields");
|
|
|
10
10
|
const assignBeforeEntryCreate = params => {
|
|
11
11
|
const {
|
|
12
12
|
context,
|
|
13
|
-
|
|
13
|
+
onBeforeEntryCreate
|
|
14
14
|
} = params;
|
|
15
|
-
|
|
15
|
+
onBeforeEntryCreate.subscribe(async params => {
|
|
16
16
|
const {
|
|
17
17
|
entry,
|
|
18
18
|
model
|
|
@@ -2,6 +2,6 @@ import { Topic } from "@webiny/pubsub/types";
|
|
|
2
2
|
import { BeforeEntryUpdateTopicParams, CmsContext } from "../../../../types";
|
|
3
3
|
export interface Params {
|
|
4
4
|
context: CmsContext;
|
|
5
|
-
|
|
5
|
+
onBeforeEntryUpdate: Topic<BeforeEntryUpdateTopicParams>;
|
|
6
6
|
}
|
|
7
7
|
export declare const assignBeforeEntryUpdate: (params: Params) => void;
|
|
@@ -10,9 +10,9 @@ var _markLockedFields = require("./markLockedFields");
|
|
|
10
10
|
const assignBeforeEntryUpdate = params => {
|
|
11
11
|
const {
|
|
12
12
|
context,
|
|
13
|
-
|
|
13
|
+
onBeforeEntryUpdate
|
|
14
14
|
} = params;
|
|
15
|
-
|
|
15
|
+
onBeforeEntryUpdate.subscribe(async params => {
|
|
16
16
|
const {
|
|
17
17
|
entry,
|
|
18
18
|
model
|
|
@@ -52,9 +52,9 @@ exports.STATUS_CHANGES_REQUESTED = STATUS_CHANGES_REQUESTED;
|
|
|
52
52
|
const STATUS_REVIEW_REQUESTED = "reviewRequested";
|
|
53
53
|
exports.STATUS_REVIEW_REQUESTED = STATUS_REVIEW_REQUESTED;
|
|
54
54
|
|
|
55
|
-
const cleanInputData = (model,
|
|
55
|
+
const cleanInputData = (model, input) => {
|
|
56
56
|
return model.fields.reduce((acc, field) => {
|
|
57
|
-
acc[field.fieldId] =
|
|
57
|
+
acc[field.fieldId] = input[field.fieldId];
|
|
58
58
|
return acc;
|
|
59
59
|
}, {});
|
|
60
60
|
};
|
|
@@ -110,41 +110,41 @@ const createContentEntryCrud = params => {
|
|
|
110
110
|
context,
|
|
111
111
|
getIdentity
|
|
112
112
|
} = params;
|
|
113
|
-
const
|
|
114
|
-
const
|
|
115
|
-
const
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
const
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
const
|
|
124
|
-
const
|
|
125
|
-
const
|
|
126
|
-
const
|
|
127
|
-
const
|
|
128
|
-
const
|
|
129
|
-
const
|
|
130
|
-
const
|
|
131
|
-
const
|
|
132
|
-
const
|
|
113
|
+
const onBeforeEntryCreate = (0, _pubsub.createTopic)();
|
|
114
|
+
const onAfterEntryCreate = (0, _pubsub.createTopic)();
|
|
115
|
+
const onBeforeEntryCreateRevision = (0, _pubsub.createTopic)();
|
|
116
|
+
const onAfterEntryCreateRevision = (0, _pubsub.createTopic)();
|
|
117
|
+
const onBeforeEntryUpdate = (0, _pubsub.createTopic)();
|
|
118
|
+
const onAfterEntryUpdate = (0, _pubsub.createTopic)();
|
|
119
|
+
const onBeforeEntryPublish = (0, _pubsub.createTopic)();
|
|
120
|
+
const onAfterEntryPublish = (0, _pubsub.createTopic)();
|
|
121
|
+
const onBeforeEntryUnpublish = (0, _pubsub.createTopic)();
|
|
122
|
+
const onAfterEntryUnpublish = (0, _pubsub.createTopic)();
|
|
123
|
+
const onBeforeEntryRequestChanges = (0, _pubsub.createTopic)();
|
|
124
|
+
const onAfterEntryRequestChanges = (0, _pubsub.createTopic)();
|
|
125
|
+
const onBeforeEntryRequestReview = (0, _pubsub.createTopic)();
|
|
126
|
+
const onAfterEntryRequestReview = (0, _pubsub.createTopic)();
|
|
127
|
+
const onBeforeEntryDelete = (0, _pubsub.createTopic)();
|
|
128
|
+
const onAfterEntryDelete = (0, _pubsub.createTopic)();
|
|
129
|
+
const onBeforeEntryDeleteRevision = (0, _pubsub.createTopic)();
|
|
130
|
+
const onAfterEntryDeleteRevision = (0, _pubsub.createTopic)();
|
|
131
|
+
const onBeforeEntryGet = (0, _pubsub.createTopic)();
|
|
132
|
+
const onBeforeEntryList = (0, _pubsub.createTopic)();
|
|
133
133
|
/**
|
|
134
134
|
* We need to assign some default behaviors.
|
|
135
135
|
*/
|
|
136
136
|
|
|
137
137
|
(0, _beforeCreate.assignBeforeEntryCreate)({
|
|
138
138
|
context,
|
|
139
|
-
|
|
139
|
+
onBeforeEntryCreate
|
|
140
140
|
});
|
|
141
141
|
(0, _beforeUpdate.assignBeforeEntryUpdate)({
|
|
142
142
|
context,
|
|
143
|
-
|
|
143
|
+
onBeforeEntryUpdate
|
|
144
144
|
});
|
|
145
145
|
(0, _afterDelete.assignAfterEntryDelete)({
|
|
146
146
|
context,
|
|
147
|
-
|
|
147
|
+
onAfterEntryDelete
|
|
148
148
|
});
|
|
149
149
|
|
|
150
150
|
const checkEntryPermissions = check => {
|
|
@@ -163,7 +163,7 @@ const createContentEntryCrud = params => {
|
|
|
163
163
|
} = params;
|
|
164
164
|
|
|
165
165
|
try {
|
|
166
|
-
await
|
|
166
|
+
await onBeforeEntryDelete.publish({
|
|
167
167
|
entry,
|
|
168
168
|
model
|
|
169
169
|
});
|
|
@@ -171,7 +171,7 @@ const createContentEntryCrud = params => {
|
|
|
171
171
|
entry,
|
|
172
172
|
storageEntry
|
|
173
173
|
});
|
|
174
|
-
await
|
|
174
|
+
await onAfterEntryDelete.publish({
|
|
175
175
|
entry,
|
|
176
176
|
model
|
|
177
177
|
});
|
|
@@ -198,26 +198,26 @@ const createContentEntryCrud = params => {
|
|
|
198
198
|
};
|
|
199
199
|
|
|
200
200
|
return {
|
|
201
|
-
onBeforeEntryCreate
|
|
202
|
-
onAfterEntryCreate
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
onBeforeEntryUpdate
|
|
206
|
-
onAfterEntryUpdate
|
|
207
|
-
onBeforeEntryDelete
|
|
208
|
-
onAfterEntryDelete
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
onBeforeEntryPublish
|
|
212
|
-
onAfterEntryPublish
|
|
213
|
-
onBeforeEntryUnpublish
|
|
214
|
-
onAfterEntryUnpublish
|
|
215
|
-
onBeforeEntryRequestChanges
|
|
216
|
-
onAfterEntryRequestChanges
|
|
217
|
-
onBeforeEntryRequestReview
|
|
218
|
-
onAfterEntryRequestReview
|
|
219
|
-
onBeforeEntryGet
|
|
220
|
-
onBeforeEntryList
|
|
201
|
+
onBeforeEntryCreate,
|
|
202
|
+
onAfterEntryCreate,
|
|
203
|
+
onBeforeEntryCreateRevision,
|
|
204
|
+
onAfterEntryCreateRevision,
|
|
205
|
+
onBeforeEntryUpdate,
|
|
206
|
+
onAfterEntryUpdate,
|
|
207
|
+
onBeforeEntryDelete,
|
|
208
|
+
onAfterEntryDelete,
|
|
209
|
+
onBeforeEntryDeleteRevision,
|
|
210
|
+
onAfterEntryDeleteRevision,
|
|
211
|
+
onBeforeEntryPublish,
|
|
212
|
+
onAfterEntryPublish,
|
|
213
|
+
onBeforeEntryUnpublish,
|
|
214
|
+
onAfterEntryUnpublish,
|
|
215
|
+
onBeforeEntryRequestChanges,
|
|
216
|
+
onAfterEntryRequestChanges,
|
|
217
|
+
onBeforeEntryRequestReview,
|
|
218
|
+
onAfterEntryRequestReview,
|
|
219
|
+
onBeforeEntryGet,
|
|
220
|
+
onBeforeEntryList,
|
|
221
221
|
|
|
222
222
|
/**
|
|
223
223
|
* Get entries by exact revision IDs from the database.
|
|
@@ -231,7 +231,7 @@ const createContentEntryCrud = params => {
|
|
|
231
231
|
const where = {
|
|
232
232
|
id
|
|
233
233
|
};
|
|
234
|
-
await
|
|
234
|
+
await onBeforeEntryGet.publish({
|
|
235
235
|
where,
|
|
236
236
|
model
|
|
237
237
|
});
|
|
@@ -290,7 +290,7 @@ const createContentEntryCrud = params => {
|
|
|
290
290
|
where,
|
|
291
291
|
sort
|
|
292
292
|
} = params;
|
|
293
|
-
await
|
|
293
|
+
await onBeforeEntryGet.publish({
|
|
294
294
|
where,
|
|
295
295
|
model
|
|
296
296
|
});
|
|
@@ -351,7 +351,7 @@ const createContentEntryCrud = params => {
|
|
|
351
351
|
listWhere.ownedBy = ownedBy;
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
-
await
|
|
354
|
+
await onBeforeEntryList.publish({
|
|
355
355
|
where: listWhere,
|
|
356
356
|
model
|
|
357
357
|
});
|
|
@@ -443,7 +443,7 @@ const createContentEntryCrud = params => {
|
|
|
443
443
|
let storageEntry = null;
|
|
444
444
|
|
|
445
445
|
try {
|
|
446
|
-
await
|
|
446
|
+
await onBeforeEntryCreate.publish({
|
|
447
447
|
entry,
|
|
448
448
|
input,
|
|
449
449
|
model
|
|
@@ -454,7 +454,7 @@ const createContentEntryCrud = params => {
|
|
|
454
454
|
entry,
|
|
455
455
|
storageEntry
|
|
456
456
|
});
|
|
457
|
-
await
|
|
457
|
+
await onAfterEntryCreate.publish({
|
|
458
458
|
entry,
|
|
459
459
|
storageEntry: result,
|
|
460
460
|
model,
|
|
@@ -470,7 +470,7 @@ const createContentEntryCrud = params => {
|
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
472
|
},
|
|
473
|
-
createEntryRevisionFrom: async (model, sourceId, inputData
|
|
473
|
+
createEntryRevisionFrom: async (model, sourceId, inputData) => {
|
|
474
474
|
const permission = await checkEntryPermissions({
|
|
475
475
|
rwd: "w"
|
|
476
476
|
});
|
|
@@ -541,8 +541,10 @@ const createContentEntryCrud = params => {
|
|
|
541
541
|
let storageEntry = undefined;
|
|
542
542
|
|
|
543
543
|
try {
|
|
544
|
-
await
|
|
544
|
+
await onBeforeEntryCreateRevision.publish({
|
|
545
|
+
input,
|
|
545
546
|
entry,
|
|
547
|
+
original: originalEntry,
|
|
546
548
|
model
|
|
547
549
|
});
|
|
548
550
|
storageEntry = await (0, _entryStorage.entryToStorageTransform)(context, model, entry);
|
|
@@ -554,9 +556,11 @@ const createContentEntryCrud = params => {
|
|
|
554
556
|
latestEntry,
|
|
555
557
|
latestStorageEntry
|
|
556
558
|
});
|
|
557
|
-
await
|
|
559
|
+
await onAfterEntryCreateRevision.publish({
|
|
560
|
+
input,
|
|
558
561
|
entry,
|
|
559
562
|
model,
|
|
563
|
+
original: originalEntry,
|
|
560
564
|
storageEntry: result
|
|
561
565
|
});
|
|
562
566
|
return result;
|
|
@@ -579,7 +583,7 @@ const createContentEntryCrud = params => {
|
|
|
579
583
|
* Make sure we only work with fields that are defined in the model.
|
|
580
584
|
*/
|
|
581
585
|
|
|
582
|
-
const input =
|
|
586
|
+
const input = cleanUpdatedInputData(model, inputData);
|
|
583
587
|
/**
|
|
584
588
|
* Validate data early. We don't want to query DB if input data is invalid.
|
|
585
589
|
*/
|
|
@@ -624,7 +628,7 @@ const createContentEntryCrud = params => {
|
|
|
624
628
|
let storageEntry = undefined;
|
|
625
629
|
|
|
626
630
|
try {
|
|
627
|
-
await
|
|
631
|
+
await onBeforeEntryUpdate.publish({
|
|
628
632
|
entry,
|
|
629
633
|
model,
|
|
630
634
|
input,
|
|
@@ -638,7 +642,7 @@ const createContentEntryCrud = params => {
|
|
|
638
642
|
storageEntry,
|
|
639
643
|
input
|
|
640
644
|
});
|
|
641
|
-
await
|
|
645
|
+
await onAfterEntryUpdate.publish({
|
|
642
646
|
entry,
|
|
643
647
|
storageEntry: result,
|
|
644
648
|
model,
|
|
@@ -787,7 +791,7 @@ const createContentEntryCrud = params => {
|
|
|
787
791
|
}
|
|
788
792
|
|
|
789
793
|
try {
|
|
790
|
-
await
|
|
794
|
+
await onBeforeEntryDeleteRevision.publish({
|
|
791
795
|
entry: entryToDelete,
|
|
792
796
|
model
|
|
793
797
|
});
|
|
@@ -797,7 +801,7 @@ const createContentEntryCrud = params => {
|
|
|
797
801
|
entryToSetAsLatest,
|
|
798
802
|
storageEntryToSetAsLatest
|
|
799
803
|
});
|
|
800
|
-
await
|
|
804
|
+
await onAfterEntryDeleteRevision.publish({
|
|
801
805
|
entry: entryToDelete,
|
|
802
806
|
model
|
|
803
807
|
});
|
|
@@ -859,7 +863,7 @@ const createContentEntryCrud = params => {
|
|
|
859
863
|
let storageEntry = undefined;
|
|
860
864
|
|
|
861
865
|
try {
|
|
862
|
-
await
|
|
866
|
+
await onBeforeEntryPublish.publish({
|
|
863
867
|
entry,
|
|
864
868
|
model
|
|
865
869
|
});
|
|
@@ -870,7 +874,7 @@ const createContentEntryCrud = params => {
|
|
|
870
874
|
originalEntry,
|
|
871
875
|
originalStorageEntry
|
|
872
876
|
});
|
|
873
|
-
await
|
|
877
|
+
await onAfterEntryPublish.publish({
|
|
874
878
|
entry,
|
|
875
879
|
storageEntry: result,
|
|
876
880
|
model
|
|
@@ -919,7 +923,7 @@ const createContentEntryCrud = params => {
|
|
|
919
923
|
let storageEntry = undefined;
|
|
920
924
|
|
|
921
925
|
try {
|
|
922
|
-
await
|
|
926
|
+
await onBeforeEntryRequestChanges.publish({
|
|
923
927
|
entry,
|
|
924
928
|
model
|
|
925
929
|
});
|
|
@@ -930,7 +934,7 @@ const createContentEntryCrud = params => {
|
|
|
930
934
|
entry,
|
|
931
935
|
storageEntry
|
|
932
936
|
});
|
|
933
|
-
await
|
|
937
|
+
await onAfterEntryRequestChanges.publish({
|
|
934
938
|
entry,
|
|
935
939
|
storageEntry: result,
|
|
936
940
|
model
|
|
@@ -981,7 +985,7 @@ const createContentEntryCrud = params => {
|
|
|
981
985
|
let storageEntry = undefined;
|
|
982
986
|
|
|
983
987
|
try {
|
|
984
|
-
await
|
|
988
|
+
await onBeforeEntryRequestReview.publish({
|
|
985
989
|
entry,
|
|
986
990
|
model
|
|
987
991
|
});
|
|
@@ -992,7 +996,7 @@ const createContentEntryCrud = params => {
|
|
|
992
996
|
entry,
|
|
993
997
|
storageEntry
|
|
994
998
|
});
|
|
995
|
-
await
|
|
999
|
+
await onAfterEntryRequestReview.publish({
|
|
996
1000
|
entry,
|
|
997
1001
|
storageEntry: result,
|
|
998
1002
|
model
|
|
@@ -1036,7 +1040,7 @@ const createContentEntryCrud = params => {
|
|
|
1036
1040
|
let storageEntry = undefined;
|
|
1037
1041
|
|
|
1038
1042
|
try {
|
|
1039
|
-
await
|
|
1043
|
+
await onBeforeEntryUnpublish.publish({
|
|
1040
1044
|
entry,
|
|
1041
1045
|
model
|
|
1042
1046
|
});
|
|
@@ -1047,7 +1051,7 @@ const createContentEntryCrud = params => {
|
|
|
1047
1051
|
entry,
|
|
1048
1052
|
storageEntry
|
|
1049
1053
|
});
|
|
1050
|
-
await
|
|
1054
|
+
await onAfterEntryUnpublish.publish({
|
|
1051
1055
|
entry,
|
|
1052
1056
|
storageEntry: result,
|
|
1053
1057
|
model
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AfterModelCreateTopicParams, CmsContext } from "../../../../types";
|
|
2
2
|
import { Topic } from "@webiny/pubsub/types";
|
|
3
3
|
export interface Params {
|
|
4
|
-
|
|
4
|
+
onAfterModelCreate: Topic<AfterModelCreateTopicParams>;
|
|
5
5
|
context: CmsContext;
|
|
6
6
|
}
|
|
7
7
|
export declare const assignAfterModelCreate: (params: Params) => void;
|
|
@@ -7,10 +7,10 @@ exports.assignAfterModelCreate = void 0;
|
|
|
7
7
|
|
|
8
8
|
const assignAfterModelCreate = params => {
|
|
9
9
|
const {
|
|
10
|
-
|
|
10
|
+
onAfterModelCreate,
|
|
11
11
|
context
|
|
12
12
|
} = params;
|
|
13
|
-
|
|
13
|
+
onAfterModelCreate.subscribe(async () => {
|
|
14
14
|
await context.cms.updateModelLastChange();
|
|
15
15
|
});
|
|
16
16
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AfterModelDeleteTopicParams, CmsContext } from "../../../../types";
|
|
2
2
|
import { Topic } from "@webiny/pubsub/types";
|
|
3
3
|
export interface Params {
|
|
4
|
-
|
|
4
|
+
onAfterModelDelete: Topic<AfterModelDeleteTopicParams>;
|
|
5
5
|
context: CmsContext;
|
|
6
6
|
}
|
|
7
7
|
export declare const assignAfterModelDelete: (params: Params) => void;
|
|
@@ -7,10 +7,10 @@ exports.assignAfterModelDelete = void 0;
|
|
|
7
7
|
|
|
8
8
|
const assignAfterModelDelete = params => {
|
|
9
9
|
const {
|
|
10
|
-
|
|
10
|
+
onAfterModelDelete,
|
|
11
11
|
context
|
|
12
12
|
} = params;
|
|
13
|
-
|
|
13
|
+
onAfterModelDelete.subscribe(async () => {
|
|
14
14
|
await context.cms.updateModelLastChange();
|
|
15
15
|
});
|
|
16
16
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AfterModelUpdateTopicParams, CmsContext } from "../../../../types";
|
|
2
2
|
import { Topic } from "@webiny/pubsub/types";
|
|
3
3
|
export interface Params {
|
|
4
|
-
|
|
4
|
+
onAfterModelUpdate: Topic<AfterModelUpdateTopicParams>;
|
|
5
5
|
context: CmsContext;
|
|
6
6
|
}
|
|
7
7
|
export declare const assignAfterModelUpdate: (params: Params) => void;
|
|
@@ -7,10 +7,10 @@ exports.assignAfterModelUpdate = void 0;
|
|
|
7
7
|
|
|
8
8
|
const assignAfterModelUpdate = params => {
|
|
9
9
|
const {
|
|
10
|
-
|
|
10
|
+
onAfterModelUpdate,
|
|
11
11
|
context
|
|
12
12
|
} = params;
|
|
13
|
-
|
|
13
|
+
onAfterModelUpdate.subscribe(async () => {
|
|
14
14
|
await context.cms.updateModelLastChange();
|
|
15
15
|
});
|
|
16
16
|
};
|
|
@@ -2,8 +2,8 @@ import { BeforeModelCreateTopicParams, HeadlessCmsStorageOperations } from "../.
|
|
|
2
2
|
import { Topic } from "@webiny/pubsub/types";
|
|
3
3
|
import { PluginsContainer } from "@webiny/plugins";
|
|
4
4
|
export interface Params {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
onBeforeModelCreate: Topic<BeforeModelCreateTopicParams>;
|
|
6
|
+
onBeforeModelCreateFrom: Topic<BeforeModelCreateTopicParams>;
|
|
7
7
|
storageOperations: HeadlessCmsStorageOperations;
|
|
8
8
|
plugins: PluginsContainer;
|
|
9
9
|
}
|
|
@@ -147,16 +147,16 @@ const createOnBeforeCb = ({
|
|
|
147
147
|
*/
|
|
148
148
|
const assignBeforeModelCreate = params => {
|
|
149
149
|
const {
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
onBeforeModelCreate,
|
|
151
|
+
onBeforeModelCreateFrom,
|
|
152
152
|
storageOperations,
|
|
153
153
|
plugins
|
|
154
154
|
} = params;
|
|
155
|
-
|
|
155
|
+
onBeforeModelCreate.subscribe(createOnBeforeCb({
|
|
156
156
|
storageOperations,
|
|
157
157
|
plugins
|
|
158
158
|
}));
|
|
159
|
-
|
|
159
|
+
onBeforeModelCreateFrom.subscribe(createOnBeforeCb({
|
|
160
160
|
storageOperations,
|
|
161
161
|
plugins
|
|
162
162
|
}));
|
|
@@ -2,7 +2,7 @@ import { Topic } from "@webiny/pubsub/types";
|
|
|
2
2
|
import { BeforeModelDeleteTopicParams, HeadlessCmsStorageOperations } from "../../../../types";
|
|
3
3
|
import { PluginsContainer } from "@webiny/plugins";
|
|
4
4
|
export interface Params {
|
|
5
|
-
|
|
5
|
+
onBeforeModelDelete: Topic<BeforeModelDeleteTopicParams>;
|
|
6
6
|
storageOperations: HeadlessCmsStorageOperations;
|
|
7
7
|
plugins: PluginsContainer;
|
|
8
8
|
}
|
|
@@ -13,11 +13,11 @@ var _CmsModelPlugin = require("../../CmsModelPlugin");
|
|
|
13
13
|
|
|
14
14
|
const assignBeforeModelDelete = params => {
|
|
15
15
|
const {
|
|
16
|
-
|
|
16
|
+
onBeforeModelDelete,
|
|
17
17
|
storageOperations,
|
|
18
18
|
plugins
|
|
19
19
|
} = params;
|
|
20
|
-
|
|
20
|
+
onBeforeModelDelete.subscribe(async params => {
|
|
21
21
|
const {
|
|
22
22
|
model
|
|
23
23
|
} = params;
|
|
@@ -2,7 +2,7 @@ import { Topic } from "@webiny/pubsub/types";
|
|
|
2
2
|
import { BeforeModelUpdateTopicParams, HeadlessCmsStorageOperations } from "../../../../types";
|
|
3
3
|
import { PluginsContainer } from "@webiny/plugins";
|
|
4
4
|
export interface Params {
|
|
5
|
-
|
|
5
|
+
onBeforeModelUpdate: Topic<BeforeModelUpdateTopicParams>;
|
|
6
6
|
storageOperations: HeadlessCmsStorageOperations;
|
|
7
7
|
plugins: PluginsContainer;
|
|
8
8
|
}
|
|
@@ -55,10 +55,10 @@ const getContentModelTitleFieldId = (fields, titleFieldId) => {
|
|
|
55
55
|
|
|
56
56
|
const assignBeforeModelUpdate = params => {
|
|
57
57
|
const {
|
|
58
|
-
|
|
58
|
+
onBeforeModelUpdate,
|
|
59
59
|
plugins
|
|
60
60
|
} = params;
|
|
61
|
-
|
|
61
|
+
onBeforeModelUpdate.subscribe(async params => {
|
|
62
62
|
const {
|
|
63
63
|
model
|
|
64
64
|
} = params;
|