@zachariaz/strapi-plugin-experience-context 0.0.0-stage → 0.1.0-dev.2
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/LICENSE +21 -0
- package/README.md +86 -2
- package/dist/_chunks/en-8ms9Hfxr.mjs +27 -0
- package/dist/_chunks/en-yERKDiB0.js +27 -0
- package/dist/admin/index.js +464 -0
- package/dist/admin/index.mjs +448 -0
- package/dist/admin/src/api/client.d.ts +13 -0
- package/dist/admin/src/api/types.d.ts +93 -0
- package/dist/admin/src/api/useInspect.d.ts +3 -0
- package/dist/admin/src/components/BlockMarkers.d.ts +12 -0
- package/dist/admin/src/components/ExperienceModal.d.ts +28 -0
- package/dist/admin/src/components/HeaderBadge.d.ts +19 -0
- package/dist/admin/src/components/Initializer.d.ts +5 -0
- package/dist/admin/src/components/ModalTrigger.d.ts +10 -0
- package/dist/admin/src/contentManagerHooks/editView.d.ts +7 -0
- package/dist/admin/src/index.d.ts +17 -0
- package/dist/admin/src/pluginId.d.ts +2 -0
- package/dist/admin/src/utils/dzSlots.d.ts +16 -0
- package/dist/admin/src/utils/labels.d.ts +30 -0
- package/dist/admin/src/utils/markers.d.ts +12 -0
- package/dist/admin/src/utils/modal.d.ts +10 -0
- package/dist/admin/src/utils/targets.d.ts +12 -0
- package/dist/server/index.js +3780 -0
- package/dist/server/index.mjs +3781 -0
- package/dist/server/src/admin-api/access.d.ts +40 -0
- package/dist/server/src/admin-api/inspect.d.ts +132 -0
- package/dist/server/src/admin-api/mark.d.ts +9 -0
- package/dist/server/src/block-keys/index.d.ts +16 -0
- package/dist/server/src/block-keys/middleware.d.ts +17 -0
- package/dist/server/src/block-keys/stamp.d.ts +55 -0
- package/dist/server/src/block-keys/store.d.ts +33 -0
- package/dist/server/src/block-keys/targets.d.ts +43 -0
- package/dist/server/src/bootstrap.d.ts +16 -0
- package/dist/server/src/changes.d.ts +80 -0
- package/dist/server/src/config/index.d.ts +67 -0
- package/dist/server/src/constants.d.ts +18 -0
- package/dist/server/src/content-types/index.d.ts +309 -0
- package/dist/server/src/controllers/admin.d.ts +10 -0
- package/dist/server/src/controllers/experience.d.ts +15 -0
- package/dist/server/src/controllers/index.d.ts +16 -0
- package/dist/server/src/destroy.d.ts +5 -0
- package/dist/server/src/index.d.ts +441 -0
- package/dist/server/src/integrity/index.d.ts +34 -0
- package/dist/server/src/integrity/orphans.d.ts +40 -0
- package/dist/server/src/mcp/index.d.ts +2 -0
- package/dist/server/src/mcp/operations.d.ts +815 -0
- package/dist/server/src/mcp/permissions.d.ts +56 -0
- package/dist/server/src/mcp/tools.d.ts +59 -0
- package/dist/server/src/model/content.d.ts +32 -0
- package/dist/server/src/model/mapping.d.ts +90 -0
- package/dist/server/src/model/records.d.ts +132 -0
- package/dist/server/src/model/store.d.ts +44 -0
- package/dist/server/src/model/target.d.ts +40 -0
- package/dist/server/src/policies/index.d.ts +4 -0
- package/dist/server/src/rbac/index.d.ts +24 -0
- package/dist/server/src/read-path/editor.d.ts +28 -0
- package/dist/server/src/read-path/gate.d.ts +26 -0
- package/dist/server/src/read-path/index.d.ts +12 -0
- package/dist/server/src/read-path/loader.d.ts +31 -0
- package/dist/server/src/read-path/middleware.d.ts +32 -0
- package/dist/server/src/read-path/payload.d.ts +34 -0
- package/dist/server/src/read-path/populate.d.ts +6 -0
- package/dist/server/src/register.d.ts +14 -0
- package/dist/server/src/registry/index.d.ts +29 -0
- package/dist/server/src/registry/unomi.d.ts +53 -0
- package/dist/server/src/routes/index.d.ts +25 -0
- package/dist/server/src/services/index.d.ts +79 -0
- package/package.json +140 -4
- package/scripts/experience-smoke.mjs +430 -0
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
declare const _default: {
|
|
2
|
+
register: ({ strapi }: {
|
|
3
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
4
|
+
}) => void;
|
|
5
|
+
bootstrap: ({ strapi }: {
|
|
6
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
7
|
+
}) => Promise<void>;
|
|
8
|
+
destroy: (_ctx: {
|
|
9
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
10
|
+
}) => void;
|
|
11
|
+
config: {
|
|
12
|
+
default: import("./config").PluginConfig;
|
|
13
|
+
validator(config: import("./config").PluginConfig): void;
|
|
14
|
+
};
|
|
15
|
+
contentTypes: {
|
|
16
|
+
annotation: {
|
|
17
|
+
schema: {
|
|
18
|
+
kind: string;
|
|
19
|
+
collectionName: string;
|
|
20
|
+
info: {
|
|
21
|
+
singularName: string;
|
|
22
|
+
pluralName: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
description: string;
|
|
25
|
+
};
|
|
26
|
+
options: {
|
|
27
|
+
draftAndPublish: boolean;
|
|
28
|
+
};
|
|
29
|
+
pluginOptions: {
|
|
30
|
+
"content-manager": {
|
|
31
|
+
visible: boolean;
|
|
32
|
+
};
|
|
33
|
+
"content-type-builder": {
|
|
34
|
+
visible: boolean;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
attributes: {
|
|
38
|
+
targetUid: {
|
|
39
|
+
type: string;
|
|
40
|
+
required: boolean;
|
|
41
|
+
};
|
|
42
|
+
targetDocumentId: {
|
|
43
|
+
type: string;
|
|
44
|
+
required: boolean;
|
|
45
|
+
};
|
|
46
|
+
targetLocale: {
|
|
47
|
+
type: string;
|
|
48
|
+
};
|
|
49
|
+
blockKey: {
|
|
50
|
+
type: string;
|
|
51
|
+
};
|
|
52
|
+
concepts: {
|
|
53
|
+
type: string;
|
|
54
|
+
required: boolean;
|
|
55
|
+
};
|
|
56
|
+
orphaned: {
|
|
57
|
+
type: string;
|
|
58
|
+
default: boolean;
|
|
59
|
+
};
|
|
60
|
+
source: {
|
|
61
|
+
type: string;
|
|
62
|
+
};
|
|
63
|
+
createdByActor: {
|
|
64
|
+
type: string;
|
|
65
|
+
};
|
|
66
|
+
correlationId: {
|
|
67
|
+
type: string;
|
|
68
|
+
};
|
|
69
|
+
};
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
variation: {
|
|
73
|
+
schema: {
|
|
74
|
+
kind: string;
|
|
75
|
+
collectionName: string;
|
|
76
|
+
info: {
|
|
77
|
+
singularName: string;
|
|
78
|
+
pluralName: string;
|
|
79
|
+
displayName: string;
|
|
80
|
+
description: string;
|
|
81
|
+
};
|
|
82
|
+
options: {
|
|
83
|
+
draftAndPublish: boolean;
|
|
84
|
+
};
|
|
85
|
+
pluginOptions: {
|
|
86
|
+
"content-manager": {
|
|
87
|
+
visible: boolean;
|
|
88
|
+
};
|
|
89
|
+
"content-type-builder": {
|
|
90
|
+
visible: boolean;
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
attributes: {
|
|
94
|
+
targetUid: {
|
|
95
|
+
type: string;
|
|
96
|
+
required: boolean;
|
|
97
|
+
};
|
|
98
|
+
targetDocumentId: {
|
|
99
|
+
type: string;
|
|
100
|
+
required: boolean;
|
|
101
|
+
};
|
|
102
|
+
targetLocale: {
|
|
103
|
+
type: string;
|
|
104
|
+
};
|
|
105
|
+
blockKey: {
|
|
106
|
+
type: string;
|
|
107
|
+
required: boolean;
|
|
108
|
+
};
|
|
109
|
+
sectionKey: {
|
|
110
|
+
type: string;
|
|
111
|
+
required: boolean;
|
|
112
|
+
};
|
|
113
|
+
variantKey: {
|
|
114
|
+
type: string;
|
|
115
|
+
required: boolean;
|
|
116
|
+
};
|
|
117
|
+
displayName: {
|
|
118
|
+
type: string;
|
|
119
|
+
};
|
|
120
|
+
description: {
|
|
121
|
+
type: string;
|
|
122
|
+
};
|
|
123
|
+
isDefault: {
|
|
124
|
+
type: string;
|
|
125
|
+
default: boolean;
|
|
126
|
+
required: boolean;
|
|
127
|
+
};
|
|
128
|
+
status: {
|
|
129
|
+
type: string;
|
|
130
|
+
enum: string[];
|
|
131
|
+
default: string;
|
|
132
|
+
required: boolean;
|
|
133
|
+
};
|
|
134
|
+
orphaned: {
|
|
135
|
+
type: string;
|
|
136
|
+
default: boolean;
|
|
137
|
+
};
|
|
138
|
+
targetAudiences: {
|
|
139
|
+
type: string;
|
|
140
|
+
};
|
|
141
|
+
traits: {
|
|
142
|
+
type: string;
|
|
143
|
+
};
|
|
144
|
+
affinities: {
|
|
145
|
+
type: string;
|
|
146
|
+
};
|
|
147
|
+
experiment: {
|
|
148
|
+
type: string;
|
|
149
|
+
};
|
|
150
|
+
priority: {
|
|
151
|
+
type: string;
|
|
152
|
+
default: number;
|
|
153
|
+
};
|
|
154
|
+
validity: {
|
|
155
|
+
type: string;
|
|
156
|
+
};
|
|
157
|
+
componentUid: {
|
|
158
|
+
type: string;
|
|
159
|
+
};
|
|
160
|
+
source: {
|
|
161
|
+
type: string;
|
|
162
|
+
};
|
|
163
|
+
createdByActor: {
|
|
164
|
+
type: string;
|
|
165
|
+
};
|
|
166
|
+
correlationId: {
|
|
167
|
+
type: string;
|
|
168
|
+
};
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
};
|
|
172
|
+
experiment: {
|
|
173
|
+
schema: {
|
|
174
|
+
kind: string;
|
|
175
|
+
collectionName: string;
|
|
176
|
+
info: {
|
|
177
|
+
singularName: string;
|
|
178
|
+
pluralName: string;
|
|
179
|
+
displayName: string;
|
|
180
|
+
description: string;
|
|
181
|
+
};
|
|
182
|
+
options: {
|
|
183
|
+
draftAndPublish: boolean;
|
|
184
|
+
};
|
|
185
|
+
pluginOptions: {
|
|
186
|
+
"content-manager": {
|
|
187
|
+
visible: boolean;
|
|
188
|
+
};
|
|
189
|
+
"content-type-builder": {
|
|
190
|
+
visible: boolean;
|
|
191
|
+
};
|
|
192
|
+
};
|
|
193
|
+
attributes: {
|
|
194
|
+
key: {
|
|
195
|
+
type: string;
|
|
196
|
+
required: boolean;
|
|
197
|
+
unique: boolean;
|
|
198
|
+
};
|
|
199
|
+
name: {
|
|
200
|
+
type: string;
|
|
201
|
+
};
|
|
202
|
+
description: {
|
|
203
|
+
type: string;
|
|
204
|
+
};
|
|
205
|
+
outcomes: {
|
|
206
|
+
type: string;
|
|
207
|
+
required: boolean;
|
|
208
|
+
};
|
|
209
|
+
controlOutcome: {
|
|
210
|
+
type: string;
|
|
211
|
+
required: boolean;
|
|
212
|
+
};
|
|
213
|
+
status: {
|
|
214
|
+
type: string;
|
|
215
|
+
enum: string[];
|
|
216
|
+
default: string;
|
|
217
|
+
required: boolean;
|
|
218
|
+
};
|
|
219
|
+
validity: {
|
|
220
|
+
type: string;
|
|
221
|
+
};
|
|
222
|
+
winner: {
|
|
223
|
+
type: string;
|
|
224
|
+
};
|
|
225
|
+
externalId: {
|
|
226
|
+
type: string;
|
|
227
|
+
};
|
|
228
|
+
source: {
|
|
229
|
+
type: string;
|
|
230
|
+
};
|
|
231
|
+
createdByActor: {
|
|
232
|
+
type: string;
|
|
233
|
+
};
|
|
234
|
+
correlationId: {
|
|
235
|
+
type: string;
|
|
236
|
+
};
|
|
237
|
+
};
|
|
238
|
+
};
|
|
239
|
+
};
|
|
240
|
+
change: {
|
|
241
|
+
schema: {
|
|
242
|
+
kind: string;
|
|
243
|
+
collectionName: string;
|
|
244
|
+
info: {
|
|
245
|
+
singularName: string;
|
|
246
|
+
pluralName: string;
|
|
247
|
+
displayName: string;
|
|
248
|
+
description: string;
|
|
249
|
+
};
|
|
250
|
+
options: {
|
|
251
|
+
draftAndPublish: boolean;
|
|
252
|
+
};
|
|
253
|
+
pluginOptions: {
|
|
254
|
+
"content-manager": {
|
|
255
|
+
visible: boolean;
|
|
256
|
+
};
|
|
257
|
+
"content-type-builder": {
|
|
258
|
+
visible: boolean;
|
|
259
|
+
};
|
|
260
|
+
};
|
|
261
|
+
attributes: {
|
|
262
|
+
action: {
|
|
263
|
+
type: string;
|
|
264
|
+
enum: string[];
|
|
265
|
+
required: boolean;
|
|
266
|
+
};
|
|
267
|
+
entity: {
|
|
268
|
+
type: string;
|
|
269
|
+
enum: string[];
|
|
270
|
+
required: boolean;
|
|
271
|
+
};
|
|
272
|
+
entityDocumentId: {
|
|
273
|
+
type: string;
|
|
274
|
+
};
|
|
275
|
+
targetUid: {
|
|
276
|
+
type: string;
|
|
277
|
+
};
|
|
278
|
+
targetDocumentId: {
|
|
279
|
+
type: string;
|
|
280
|
+
};
|
|
281
|
+
targetLocale: {
|
|
282
|
+
type: string;
|
|
283
|
+
};
|
|
284
|
+
blockKey: {
|
|
285
|
+
type: string;
|
|
286
|
+
};
|
|
287
|
+
componentUid: {
|
|
288
|
+
type: string;
|
|
289
|
+
};
|
|
290
|
+
sectionKey: {
|
|
291
|
+
type: string;
|
|
292
|
+
};
|
|
293
|
+
variantKey: {
|
|
294
|
+
type: string;
|
|
295
|
+
};
|
|
296
|
+
experimentKey: {
|
|
297
|
+
type: string;
|
|
298
|
+
};
|
|
299
|
+
actor: {
|
|
300
|
+
type: string;
|
|
301
|
+
};
|
|
302
|
+
source: {
|
|
303
|
+
type: string;
|
|
304
|
+
enum: string[];
|
|
305
|
+
required: boolean;
|
|
306
|
+
};
|
|
307
|
+
reason: {
|
|
308
|
+
type: string;
|
|
309
|
+
};
|
|
310
|
+
correlationId: {
|
|
311
|
+
type: string;
|
|
312
|
+
};
|
|
313
|
+
before: {
|
|
314
|
+
type: string;
|
|
315
|
+
};
|
|
316
|
+
after: {
|
|
317
|
+
type: string;
|
|
318
|
+
};
|
|
319
|
+
};
|
|
320
|
+
};
|
|
321
|
+
};
|
|
322
|
+
};
|
|
323
|
+
controllers: {
|
|
324
|
+
admin: ({ strapi }: {
|
|
325
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
326
|
+
}) => {
|
|
327
|
+
registry(ctx: any): Promise<void>;
|
|
328
|
+
presets(ctx: any): Promise<void>;
|
|
329
|
+
inspect(ctx: any): Promise<void>;
|
|
330
|
+
explain(ctx: any): Promise<void>;
|
|
331
|
+
};
|
|
332
|
+
experience: (_: {
|
|
333
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
334
|
+
}) => {
|
|
335
|
+
read(ctx: any): Promise<void>;
|
|
336
|
+
};
|
|
337
|
+
};
|
|
338
|
+
policies: {
|
|
339
|
+
'can-read': (policyContext: any) => boolean;
|
|
340
|
+
};
|
|
341
|
+
routes: {
|
|
342
|
+
'content-api': {
|
|
343
|
+
type: "content-api";
|
|
344
|
+
routes: {
|
|
345
|
+
method: string;
|
|
346
|
+
path: string;
|
|
347
|
+
handler: string;
|
|
348
|
+
config: {
|
|
349
|
+
policies: never[];
|
|
350
|
+
};
|
|
351
|
+
}[];
|
|
352
|
+
};
|
|
353
|
+
admin: {
|
|
354
|
+
type: "admin";
|
|
355
|
+
routes: {
|
|
356
|
+
method: string;
|
|
357
|
+
path: string;
|
|
358
|
+
handler: string;
|
|
359
|
+
config: {
|
|
360
|
+
policies: string[];
|
|
361
|
+
};
|
|
362
|
+
}[];
|
|
363
|
+
};
|
|
364
|
+
};
|
|
365
|
+
services: {
|
|
366
|
+
blockKeys: ({ strapi }: {
|
|
367
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
368
|
+
}) => {
|
|
369
|
+
targets(): {
|
|
370
|
+
contentTypes: {
|
|
371
|
+
[k: string]: string[];
|
|
372
|
+
};
|
|
373
|
+
components: string[];
|
|
374
|
+
};
|
|
375
|
+
backfill(options?: import("./block-keys").BackfillOptions): Promise<import("./block-keys").BackfillReport>;
|
|
376
|
+
stamp(uid: string, data: unknown): Promise<import("./block-keys/stamp").StampEvent[]>;
|
|
377
|
+
};
|
|
378
|
+
editor: ({ strapi }: {
|
|
379
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
380
|
+
}) => {
|
|
381
|
+
attach(options: import("./read-path/editor").EditorAttachOptions): Promise<import("./read-path/editor").EditorAttachResult>;
|
|
382
|
+
};
|
|
383
|
+
integrity: ({ strapi }: {
|
|
384
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
385
|
+
}) => {
|
|
386
|
+
recompute: (uid: string, documentId: string, reason?: string) => Promise<{
|
|
387
|
+
entity: string;
|
|
388
|
+
documentId: string | null;
|
|
389
|
+
blockKey: string | null;
|
|
390
|
+
locale: string | null;
|
|
391
|
+
orphaned: boolean;
|
|
392
|
+
}[]>;
|
|
393
|
+
cascadeDelete: (uid: string, documentId: string) => Promise<{
|
|
394
|
+
variations: (string | null)[];
|
|
395
|
+
annotations: (string | null)[];
|
|
396
|
+
}>;
|
|
397
|
+
currentKeys: (uid: string, documentId: string) => Promise<import("./integrity/orphans").PresentKeys | null>;
|
|
398
|
+
orphanedNow: (uid: string, documentId: string, target: {
|
|
399
|
+
locale?: string | null | undefined;
|
|
400
|
+
blockKey?: string | null | undefined;
|
|
401
|
+
}) => Promise<boolean>;
|
|
402
|
+
};
|
|
403
|
+
registry: ({ strapi }: {
|
|
404
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
405
|
+
}) => {
|
|
406
|
+
get: () => Promise<Required<import("@zachariaz/experience-context-core").Registry>>;
|
|
407
|
+
presets: () => import("@zachariaz/experience-context-core").Preset[];
|
|
408
|
+
};
|
|
409
|
+
store: ({ strapi }: {
|
|
410
|
+
strapi: import("@strapi/types/dist/core").Strapi;
|
|
411
|
+
}) => {
|
|
412
|
+
listVariations: (filters?: {
|
|
413
|
+
targetUid?: string | undefined;
|
|
414
|
+
targetDocumentId?: string | string[] | undefined;
|
|
415
|
+
locale?: string | null | undefined;
|
|
416
|
+
sectionKey?: string | undefined;
|
|
417
|
+
blockKey?: string | undefined;
|
|
418
|
+
}) => Promise<import("./model/records").VariationRecord[]>;
|
|
419
|
+
createVariation: (record: Omit<import("./model/records").VariationRecord, "documentId">, ctx: import("./model/store").WriteContext) => Promise<import("./model/records").VariationRecord>;
|
|
420
|
+
updateVariation: (before: import("./model/records").VariationRecord, patch: Partial<import("./model/records").VariationRecord>, ctx: import("./model/store").WriteContext) => Promise<import("./model/records").VariationRecord>;
|
|
421
|
+
deleteVariation: (before: import("./model/records").VariationRecord, ctx: import("./model/store").WriteContext) => Promise<void>;
|
|
422
|
+
listAnnotations: (filters?: {
|
|
423
|
+
targetUid?: string | undefined;
|
|
424
|
+
targetDocumentId?: string | string[] | undefined;
|
|
425
|
+
locale?: string | null | undefined;
|
|
426
|
+
blockKey?: string | null | undefined;
|
|
427
|
+
}) => Promise<import("./model/records").AnnotationRecord[]>;
|
|
428
|
+
setAnnotation: (existing: import("./model/records").AnnotationRecord | undefined, record: Omit<import("./model/records").AnnotationRecord, "documentId" | "orphaned" | "source" | "createdBy" | "correlationId"> & {
|
|
429
|
+
orphaned?: boolean | undefined;
|
|
430
|
+
}, ctx: import("./model/store").WriteContext) => Promise<import("./model/records").AnnotationRecord | null>;
|
|
431
|
+
deleteAnnotation: (before: import("./model/records").AnnotationRecord, ctx: import("./model/store").WriteContext) => Promise<void>;
|
|
432
|
+
listExperiments: (keys?: string[] | undefined) => Promise<import("./model/records").ExperimentRecord[]>;
|
|
433
|
+
getExperiment: (key: string) => Promise<import("./model/records").ExperimentRecord | undefined>;
|
|
434
|
+
saveExperiment: (existing: import("./model/records").ExperimentRecord | undefined, record: Omit<import("./model/records").ExperimentRecord, "documentId" | "source" | "createdBy" | "correlationId">, ctx: import("./model/store").WriteContext) => Promise<import("./model/records").ExperimentRecord>;
|
|
435
|
+
deleteExperiment: (before: import("./model/records").ExperimentRecord, ctx: import("./model/store").WriteContext) => Promise<void>;
|
|
436
|
+
variationsOfExperiment: (key: string) => Promise<import("./model/records").VariationRecord[]>;
|
|
437
|
+
logBlock: (action: "create" | "delete", block: Record<string, unknown>, ctx: import("./model/store").WriteContext) => Promise<void>;
|
|
438
|
+
};
|
|
439
|
+
};
|
|
440
|
+
};
|
|
441
|
+
export default _default;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Core } from '@strapi/strapi';
|
|
2
|
+
import type { BlockKeyTargets } from '../block-keys/targets';
|
|
3
|
+
import { type PresentKeys } from './orphans';
|
|
4
|
+
/** Integrity operations; exposed as the `integrity` service. */
|
|
5
|
+
export declare function createIntegrity(strapi: Core.Strapi, getTargets: () => BlockKeyTargets): {
|
|
6
|
+
recompute: (uid: string, documentId: string, reason?: string) => Promise<{
|
|
7
|
+
entity: string;
|
|
8
|
+
documentId: string | null;
|
|
9
|
+
blockKey: string | null;
|
|
10
|
+
locale: string | null;
|
|
11
|
+
orphaned: boolean;
|
|
12
|
+
}[]>;
|
|
13
|
+
cascadeDelete: (uid: string, documentId: string) => Promise<{
|
|
14
|
+
variations: (string | null)[];
|
|
15
|
+
annotations: (string | null)[];
|
|
16
|
+
}>;
|
|
17
|
+
currentKeys: (uid: string, documentId: string) => Promise<PresentKeys | null>;
|
|
18
|
+
orphanedNow: (uid: string, documentId: string, target: {
|
|
19
|
+
locale?: string | null;
|
|
20
|
+
blockKey?: string | null;
|
|
21
|
+
}) => Promise<boolean>;
|
|
22
|
+
};
|
|
23
|
+
export type Integrity = ReturnType<typeof createIntegrity>;
|
|
24
|
+
/**
|
|
25
|
+
* Document Service middleware: for configured content types, recompute
|
|
26
|
+
* orphan status after `update`, `publish` and `discardDraft` (content
|
|
27
|
+
* history restore and Experience Builder saves are `update`s); after
|
|
28
|
+
* `delete`, remove the mappings when no version of the document is left
|
|
29
|
+
* (cascade), otherwise recompute (a locale was deleted). Integrity work
|
|
30
|
+
* never fails the content write that triggered it.
|
|
31
|
+
*/
|
|
32
|
+
export declare function registerIntegrityMiddleware(strapi: Core.Strapi, integrity: Integrity, configured: readonly string[]): void;
|
|
33
|
+
/** Bootstrap wiring: webhook event, middleware. */
|
|
34
|
+
export declare function bootstrapIntegrity(strapi: Core.Strapi, integrity: Integrity): void;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orphan status. Pure: decides each mapping's status from the blocks a
|
|
3
|
+
* document has now.
|
|
4
|
+
*
|
|
5
|
+
* A mapping is orphaned when what it targets is missing from the
|
|
6
|
+
* document's working version, the draft (for types without draft & publish,
|
|
7
|
+
* the only version):
|
|
8
|
+
* - a block mapping: its `blockKey` is not in the draft of its locale, or of
|
|
9
|
+
* any locale for a `locale: null` mapping;
|
|
10
|
+
* - a page annotation for one locale: that locale has no draft any more.
|
|
11
|
+
* It becomes active again as soon as the key reappears (discard draft,
|
|
12
|
+
* content-history restore, undo in Experience Builder). Recomputed after
|
|
13
|
+
* every write of the document, so the status never needs a manual fix.
|
|
14
|
+
* Orphaned mappings are not sent by the read path.
|
|
15
|
+
*/
|
|
16
|
+
export interface StatusRow {
|
|
17
|
+
documentId: string | null;
|
|
18
|
+
locale?: string | null;
|
|
19
|
+
blockKey?: string | null;
|
|
20
|
+
orphaned?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface VersionRow {
|
|
23
|
+
locale?: string | null;
|
|
24
|
+
publishedAt?: string | Date | null;
|
|
25
|
+
[zone: string]: unknown;
|
|
26
|
+
}
|
|
27
|
+
export interface PresentKeys {
|
|
28
|
+
/** locale ('' when the type is not localized) → keys in that locale's working version */
|
|
29
|
+
byLocale: Map<string, Set<string>>;
|
|
30
|
+
}
|
|
31
|
+
/** Keys of the working version per locale. `draftAndPublish: false` types have only one row per locale. */
|
|
32
|
+
export declare function presentKeys(rows: VersionRow[], zones: readonly string[], draftAndPublish: boolean): PresentKeys;
|
|
33
|
+
/** Is the mapping orphaned, given the document's working version? */
|
|
34
|
+
export declare function isOrphaned(row: StatusRow, present: PresentKeys): boolean;
|
|
35
|
+
export interface StatusChange<T extends StatusRow> {
|
|
36
|
+
row: T;
|
|
37
|
+
orphaned: boolean;
|
|
38
|
+
}
|
|
39
|
+
/** Mappings whose orphan status changes, given the document's current versions. */
|
|
40
|
+
export declare function statusChanges<T extends StatusRow>(rows: T[], present: PresentKeys): Array<StatusChange<T>>;
|