@productminds/article-events 6.0.0 → 6.2.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/lib/events/InternalArticleEvent.d.ts +33 -0
- package/lib/events/InternalArticleEvent.js +2 -0
- package/lib/types/ReusePolicy.d.ts +2 -0
- package/lib/{shared/schema.js → types/ReusePolicy.js} +2 -2
- package/package.json +1 -1
- package/lib/article-events/src/article-events.d.ts +0 -3
- package/lib/article-events/src/article-events.js +0 -10
- package/lib/article-events/src/cmd/write-json-schema.d.ts +0 -1
- package/lib/article-events/src/cmd/write-json-schema.js +0 -14
- package/lib/article-events/src/events/ExternalArticleEvent.d.ts +0 -418
- package/lib/article-events/src/events/ExternalArticleEvent.js +0 -19
- package/lib/article-events/src/events/InternalArticleEvent.d.ts +0 -546
- package/lib/article-events/src/events/InternalArticleEvent.js +0 -19
- package/lib/article-events/src/types/Article.d.ts +0 -47
- package/lib/article-events/src/types/Article.js +0 -41
- package/lib/article-events/src/utils/makeHelpers.d.ts +0 -15
- package/lib/article-events/src/utils/makeHelpers.js +0 -45
- package/lib/events/ArticleEvent.d.ts +0 -70
- package/lib/events/ArticleEvent.js +0 -15
- package/lib/shared/schema.d.ts +0 -2
@@ -32,10 +32,12 @@ export declare const ArticleIngressSchema: Schema.Struct<{
|
|
32
32
|
extID: typeof Schema.UUID;
|
33
33
|
extSource: typeof Schema.String;
|
34
34
|
}>]>>;
|
35
|
+
reusePolicy: Schema.optional<Schema.Literal<["strictly_no_reuse", "by_request", "free_to_reuse"]>>;
|
35
36
|
}>>;
|
36
37
|
}>;
|
37
38
|
export declare const InternalArticleEventSchema: Schema.Struct<{
|
38
39
|
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
40
|
+
extId: Schema.optional<typeof Schema.NonEmptyString>;
|
39
41
|
payload: Schema.Union<[Schema.Struct<{
|
40
42
|
source: Schema.Literal<["INTERNAL"]>;
|
41
43
|
status: Schema.Literal<["NEW", "UPDATED"]>;
|
@@ -64,6 +66,7 @@ export declare const InternalArticleEventSchema: Schema.Struct<{
|
|
64
66
|
extID: typeof Schema.UUID;
|
65
67
|
extSource: typeof Schema.String;
|
66
68
|
}>]>>;
|
69
|
+
reusePolicy: Schema.optional<Schema.Literal<["strictly_no_reuse", "by_request", "free_to_reuse"]>>;
|
67
70
|
}>>;
|
68
71
|
}>, Schema.Struct<{
|
69
72
|
status: Schema.Literal<["UNPUBLISHED"]>;
|
@@ -100,6 +103,7 @@ declare const _default: {
|
|
100
103
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
101
104
|
readonly id: string;
|
102
105
|
})[];
|
106
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
103
107
|
};
|
104
108
|
readonly status: "NEW" | "UPDATED";
|
105
109
|
readonly source: "INTERNAL";
|
@@ -108,6 +112,7 @@ declare const _default: {
|
|
108
112
|
readonly status: "UNPUBLISHED";
|
109
113
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
110
114
|
};
|
115
|
+
readonly extId?: string | undefined;
|
111
116
|
}, import("@effect/schema/ParseResult").ParseError>;
|
112
117
|
decodeExn: (u: unknown) => {
|
113
118
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -137,6 +142,7 @@ declare const _default: {
|
|
137
142
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
138
143
|
readonly id: string;
|
139
144
|
})[];
|
145
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
140
146
|
};
|
141
147
|
readonly status: "NEW" | "UPDATED";
|
142
148
|
readonly source: "INTERNAL";
|
@@ -145,6 +151,7 @@ declare const _default: {
|
|
145
151
|
readonly status: "UNPUBLISHED";
|
146
152
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
147
153
|
};
|
154
|
+
readonly extId?: string | undefined;
|
148
155
|
};
|
149
156
|
encode: (a: {
|
150
157
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -174,6 +181,7 @@ declare const _default: {
|
|
174
181
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
175
182
|
readonly id: string;
|
176
183
|
})[];
|
184
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
177
185
|
};
|
178
186
|
readonly status: "NEW" | "UPDATED";
|
179
187
|
readonly source: "INTERNAL";
|
@@ -182,6 +190,7 @@ declare const _default: {
|
|
182
190
|
readonly status: "UNPUBLISHED";
|
183
191
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
184
192
|
};
|
193
|
+
readonly extId?: string | undefined;
|
185
194
|
}, overrideOptions?: import("@effect/schema/AST").ParseOptions) => import("effect/Either").Either<{
|
186
195
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
187
196
|
readonly payload: {
|
@@ -210,6 +219,7 @@ declare const _default: {
|
|
210
219
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
211
220
|
readonly id: string;
|
212
221
|
})[];
|
222
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
213
223
|
};
|
214
224
|
readonly status: "NEW" | "UPDATED";
|
215
225
|
readonly source: "INTERNAL";
|
@@ -218,6 +228,7 @@ declare const _default: {
|
|
218
228
|
readonly status: "UNPUBLISHED";
|
219
229
|
readonly unpublishedAt: string;
|
220
230
|
};
|
231
|
+
readonly extId?: string | undefined;
|
221
232
|
}, import("@effect/schema/ParseResult").ParseError>;
|
222
233
|
encodeExn: (event: {
|
223
234
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -247,6 +258,7 @@ declare const _default: {
|
|
247
258
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
248
259
|
readonly id: string;
|
249
260
|
})[];
|
261
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
250
262
|
};
|
251
263
|
readonly status: "NEW" | "UPDATED";
|
252
264
|
readonly source: "INTERNAL";
|
@@ -255,6 +267,7 @@ declare const _default: {
|
|
255
267
|
readonly status: "UNPUBLISHED";
|
256
268
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
257
269
|
};
|
270
|
+
readonly extId?: string | undefined;
|
258
271
|
}) => {
|
259
272
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
260
273
|
readonly payload: {
|
@@ -283,6 +296,7 @@ declare const _default: {
|
|
283
296
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
284
297
|
readonly id: string;
|
285
298
|
})[];
|
299
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
286
300
|
};
|
287
301
|
readonly status: "NEW" | "UPDATED";
|
288
302
|
readonly source: "INTERNAL";
|
@@ -291,6 +305,7 @@ declare const _default: {
|
|
291
305
|
readonly status: "UNPUBLISHED";
|
292
306
|
readonly unpublishedAt: string;
|
293
307
|
};
|
308
|
+
readonly extId?: string | undefined;
|
294
309
|
};
|
295
310
|
fromString: (msg: string) => import("effect/Either").Either<{
|
296
311
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -320,6 +335,7 @@ declare const _default: {
|
|
320
335
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
321
336
|
readonly id: string;
|
322
337
|
})[];
|
338
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
323
339
|
};
|
324
340
|
readonly status: "NEW" | "UPDATED";
|
325
341
|
readonly source: "INTERNAL";
|
@@ -328,6 +344,7 @@ declare const _default: {
|
|
328
344
|
readonly status: "UNPUBLISHED";
|
329
345
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
330
346
|
};
|
347
|
+
readonly extId?: string | undefined;
|
331
348
|
}, import("@effect/schema/ParseResult").ParseError>;
|
332
349
|
fromBuffer: (msg: Buffer) => import("effect/Either").Either<{
|
333
350
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -357,6 +374,7 @@ declare const _default: {
|
|
357
374
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
358
375
|
readonly id: string;
|
359
376
|
})[];
|
377
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
360
378
|
};
|
361
379
|
readonly status: "NEW" | "UPDATED";
|
362
380
|
readonly source: "INTERNAL";
|
@@ -365,6 +383,7 @@ declare const _default: {
|
|
365
383
|
readonly status: "UNPUBLISHED";
|
366
384
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
367
385
|
};
|
386
|
+
readonly extId?: string | undefined;
|
368
387
|
}, import("@effect/schema/ParseResult").ParseError>;
|
369
388
|
fromStringExn: (msg: string) => {
|
370
389
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -394,6 +413,7 @@ declare const _default: {
|
|
394
413
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
395
414
|
readonly id: string;
|
396
415
|
})[];
|
416
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
397
417
|
};
|
398
418
|
readonly status: "NEW" | "UPDATED";
|
399
419
|
readonly source: "INTERNAL";
|
@@ -402,6 +422,7 @@ declare const _default: {
|
|
402
422
|
readonly status: "UNPUBLISHED";
|
403
423
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
404
424
|
};
|
425
|
+
readonly extId?: string | undefined;
|
405
426
|
};
|
406
427
|
fromBufferExn: (msg: Buffer) => {
|
407
428
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -431,6 +452,7 @@ declare const _default: {
|
|
431
452
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
432
453
|
readonly id: string;
|
433
454
|
})[];
|
455
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
434
456
|
};
|
435
457
|
readonly status: "NEW" | "UPDATED";
|
436
458
|
readonly source: "INTERNAL";
|
@@ -439,6 +461,7 @@ declare const _default: {
|
|
439
461
|
readonly status: "UNPUBLISHED";
|
440
462
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
441
463
|
};
|
464
|
+
readonly extId?: string | undefined;
|
442
465
|
};
|
443
466
|
toString: (event: {
|
444
467
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -468,6 +491,7 @@ declare const _default: {
|
|
468
491
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
469
492
|
readonly id: string;
|
470
493
|
})[];
|
494
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
471
495
|
};
|
472
496
|
readonly status: "NEW" | "UPDATED";
|
473
497
|
readonly source: "INTERNAL";
|
@@ -476,6 +500,7 @@ declare const _default: {
|
|
476
500
|
readonly status: "UNPUBLISHED";
|
477
501
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
478
502
|
};
|
503
|
+
readonly extId?: string | undefined;
|
479
504
|
}) => string;
|
480
505
|
toBuffer: (event: {
|
481
506
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -505,6 +530,7 @@ declare const _default: {
|
|
505
530
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
506
531
|
readonly id: string;
|
507
532
|
})[];
|
533
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
508
534
|
};
|
509
535
|
readonly status: "NEW" | "UPDATED";
|
510
536
|
readonly source: "INTERNAL";
|
@@ -513,6 +539,7 @@ declare const _default: {
|
|
513
539
|
readonly status: "UNPUBLISHED";
|
514
540
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
515
541
|
};
|
542
|
+
readonly extId?: string | undefined;
|
516
543
|
}) => Buffer;
|
517
544
|
toStringExn: (event: {
|
518
545
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -542,6 +569,7 @@ declare const _default: {
|
|
542
569
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
543
570
|
readonly id: string;
|
544
571
|
})[];
|
572
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
545
573
|
};
|
546
574
|
readonly status: "NEW" | "UPDATED";
|
547
575
|
readonly source: "INTERNAL";
|
@@ -550,6 +578,7 @@ declare const _default: {
|
|
550
578
|
readonly status: "UNPUBLISHED";
|
551
579
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
552
580
|
};
|
581
|
+
readonly extId?: string | undefined;
|
553
582
|
}) => string;
|
554
583
|
toBufferExn: (event: {
|
555
584
|
readonly kind: "INTERNAL_ARTICLE_EVENT";
|
@@ -579,6 +608,7 @@ declare const _default: {
|
|
579
608
|
readonly type: "EXTERNAL_ARTICLE_REFERENCE";
|
580
609
|
readonly id: string;
|
581
610
|
})[];
|
611
|
+
readonly reusePolicy?: "strictly_no_reuse" | "by_request" | "free_to_reuse" | undefined;
|
582
612
|
};
|
583
613
|
readonly status: "NEW" | "UPDATED";
|
584
614
|
readonly source: "INTERNAL";
|
@@ -587,9 +617,11 @@ declare const _default: {
|
|
587
617
|
readonly status: "UNPUBLISHED";
|
588
618
|
readonly unpublishedAt: import("effect/DateTime").Utc;
|
589
619
|
};
|
620
|
+
readonly extId?: string | undefined;
|
590
621
|
}) => Buffer;
|
591
622
|
Schema: Schema.Struct<{
|
592
623
|
kind: Schema.Literal<["INTERNAL_ARTICLE_EVENT"]>;
|
624
|
+
extId: Schema.optional<typeof Schema.NonEmptyString>;
|
593
625
|
payload: Schema.Union<[Schema.Struct<{
|
594
626
|
source: Schema.Literal<["INTERNAL"]>;
|
595
627
|
status: Schema.Literal<["NEW", "UPDATED"]>;
|
@@ -618,6 +650,7 @@ declare const _default: {
|
|
618
650
|
extID: typeof Schema.UUID;
|
619
651
|
extSource: typeof Schema.String;
|
620
652
|
}>]>>;
|
653
|
+
reusePolicy: Schema.optional<Schema.Literal<["strictly_no_reuse", "by_request", "free_to_reuse"]>>;
|
621
654
|
}>>;
|
622
655
|
}>, Schema.Struct<{
|
623
656
|
status: Schema.Literal<["UNPUBLISHED"]>;
|
@@ -6,6 +6,7 @@ const Article_1 = require("../types/Article");
|
|
6
6
|
const makeHelpers_1 = require("../utils/makeHelpers");
|
7
7
|
const InternalArticleSchema = schema_1.Schema.extend(Article_1.BaseArticleSchema, schema_1.Schema.Struct({
|
8
8
|
tags: schema_1.Schema.Array(schema_1.Schema.Union(Article_1.CategoryTagSchema, Article_1.ExternalArticleReferenceTagSchema, Article_1.DrupalExternalIDTag)),
|
9
|
+
reusePolicy: schema_1.Schema.optional(schema_1.Schema.Literal('strictly_no_reuse', 'by_request', 'free_to_reuse')),
|
9
10
|
}));
|
10
11
|
exports.ArticleUnpublishedSchema = schema_1.Schema.Struct({
|
11
12
|
status: schema_1.Schema.Literal('UNPUBLISHED'),
|
@@ -19,6 +20,7 @@ exports.ArticleIngressSchema = schema_1.Schema.Struct({
|
|
19
20
|
});
|
20
21
|
exports.InternalArticleEventSchema = schema_1.Schema.Struct({
|
21
22
|
kind: schema_1.Schema.Literal('INTERNAL_ARTICLE_EVENT'),
|
23
|
+
extId: schema_1.Schema.optional(schema_1.Schema.NonEmptyString),
|
22
24
|
payload: schema_1.Schema.Union(exports.ArticleIngressSchema, exports.ArticleUnpublishedSchema),
|
23
25
|
});
|
24
26
|
const helpers = (0, makeHelpers_1.makeHelpers)(exports.InternalArticleEventSchema);
|
@@ -1,5 +1,5 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.ReusePolicySchema = void 0;
|
4
4
|
const schema_1 = require("@effect/schema");
|
5
|
-
exports.
|
5
|
+
exports.ReusePolicySchema = schema_1.Schema.Struct({});
|
package/package.json
CHANGED
@@ -1,10 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.InternalArticleEvent = exports.ExternalArticleEvent = void 0;
|
7
|
-
const ExternalArticleEvent_1 = __importDefault(require("./events/ExternalArticleEvent"));
|
8
|
-
exports.ExternalArticleEvent = ExternalArticleEvent_1.default;
|
9
|
-
const InternalArticleEvent_1 = __importDefault(require("./events/InternalArticleEvent"));
|
10
|
-
exports.InternalArticleEvent = InternalArticleEvent_1.default;
|
@@ -1 +0,0 @@
|
|
1
|
-
export {};
|
@@ -1,14 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
const schema_1 = require("@effect/schema");
|
4
|
-
const InternalArticleEvent_1 = require("../events/InternalArticleEvent");
|
5
|
-
const ExternalArticleEvent_1 = require("../events/ExternalArticleEvent");
|
6
|
-
const fs_1 = require("fs");
|
7
|
-
const dir = './jsonSchemas';
|
8
|
-
if (!(0, fs_1.existsSync)(dir)) {
|
9
|
-
(0, fs_1.mkdirSync)(dir);
|
10
|
-
}
|
11
|
-
const jsonSchemaInternal = schema_1.JSONSchema.make(InternalArticleEvent_1.InternalArticleEventSchema);
|
12
|
-
(0, fs_1.writeFileSync)(`${dir}/internalArticleEventSchema.json`, JSON.stringify(jsonSchemaInternal, null, 2));
|
13
|
-
const jsonSchemaExternal = schema_1.JSONSchema.make(ExternalArticleEvent_1.ExternalArticleEventSchema);
|
14
|
-
(0, fs_1.writeFileSync)(`${dir}/externalArticleEventSchema.json`, JSON.stringify(jsonSchemaExternal, null, 2));
|