@twin.org/standards-w3c-activity-streams 0.0.2-next.9 → 0.0.3-next.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.
@@ -1,402 +0,0 @@
1
- 'use strict';
2
-
3
- var dataCore = require('@twin.org/data-core');
4
-
5
- // Copyright 2024 IOTA Stiftung.
6
- // SPDX-License-Identifier: Apache-2.0.
7
- /**
8
- * The LD Contexts concerning Activity Streams.
9
- */
10
- // eslint-disable-next-line @typescript-eslint/naming-convention
11
- const ActivityStreamsContexts = {
12
- /**
13
- * The Activity Streams LD Context.
14
- */
15
- ContextRoot: "https://www.w3.org/ns/activitystreams",
16
- /**
17
- * The Activity Streams namespace.
18
- */
19
- ActivityStreamsNamespace: "https://www.w3.org/ns/activitystreams#",
20
- /**
21
- * The TWIN context for Activity Streams.
22
- */
23
- TwinContext: "https://schema.twindev.org/w3c-activity-streams"
24
- };
25
-
26
- // Copyright 2024 IOTA Stiftung.
27
- // SPDX-License-Identifier: Apache-2.0.
28
- /**
29
- * The types concerning Activity Streams.
30
- * @see https://www.w3.org/ns/activitystreams
31
- */
32
- // eslint-disable-next-line @typescript-eslint/naming-convention
33
- const ActivityStreamsTypes = {
34
- /**
35
- * Activity base class
36
- * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-activity
37
- */
38
- Activity: "Activity",
39
- /**
40
- * Activity Create
41
- * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-create
42
- */
43
- Create: "Create",
44
- /**
45
- * Activity Add
46
- * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-add
47
- */
48
- Add: "Add",
49
- /**
50
- * Activity Update
51
- * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-update
52
- */
53
- Update: "Update",
54
- /**
55
- * Activity Remove
56
- * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-remove
57
- */
58
- Remove: "Remove",
59
- /**
60
- * Activity Delete
61
- * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-delete
62
- */
63
- Delete: "Delete"
64
- };
65
-
66
- var $schema$2 = "https://json-schema.org/draft/2020-12/schema";
67
- var $id$2 = "https://schema.twindev.org/w3c-activity-streams/Activity";
68
- var description$2 = "A W3C Activity from Activity Streams";
69
- var type$1 = "object";
70
- var properties = {
71
- "@context": {
72
- $ref: "https://schema.twindev.org/w3c-activity-streams/ActivityStreamsContextType",
73
- description: "The LD Context."
74
- },
75
- "@id": {
76
- anyOf: [
77
- {
78
- type: "string"
79
- },
80
- {
81
- type: "array",
82
- items: false,
83
- prefixItems: [
84
- {
85
- type: "string"
86
- }
87
- ]
88
- }
89
- ]
90
- },
91
- "@included": {
92
- $ref: "https://schema.twindev.org/json-ld/JsonLdIncludedBlock"
93
- },
94
- "@graph": {
95
- anyOf: [
96
- {
97
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject"
98
- },
99
- {
100
- type: "array",
101
- items: false,
102
- prefixItems: [
103
- {
104
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject"
105
- }
106
- ]
107
- }
108
- ]
109
- },
110
- "@nest": {
111
- anyOf: [
112
- {
113
- $ref: "https://schema.twindev.org/json-ld/JsonLdJsonObject"
114
- },
115
- {
116
- type: "array",
117
- items: false,
118
- prefixItems: [
119
- {
120
- $ref: "https://schema.twindev.org/json-ld/JsonLdJsonObject"
121
- }
122
- ]
123
- }
124
- ]
125
- },
126
- "@type": {
127
- anyOf: [
128
- {
129
- type: "string"
130
- },
131
- {
132
- type: "array",
133
- items: false,
134
- prefixItems: [
135
- {
136
- type: "string"
137
- }
138
- ]
139
- }
140
- ]
141
- },
142
- "@reverse": {
143
- type: "object",
144
- additionalProperties: {
145
- type: "string"
146
- }
147
- },
148
- "@index": {
149
- type: "string"
150
- },
151
- type: {
152
- description: "Object or array data type",
153
- anyOf: [
154
- {
155
- $ref: "https://schema.twindev.org/w3c-activity-streams/ActivityStreamsTypes"
156
- },
157
- {
158
- type: "string"
159
- },
160
- {
161
- type: "array",
162
- items: false,
163
- prefixItems: [
164
- {
165
- anyOf: [
166
- {
167
- $ref: "https://schema.twindev.org/w3c-activity-streams/ActivityStreamsTypes"
168
- },
169
- {
170
- type: "string"
171
- }
172
- ]
173
- }
174
- ]
175
- }
176
- ]
177
- },
178
- generator: {
179
- anyOf: [
180
- {
181
- type: "string"
182
- },
183
- {
184
- type: "array",
185
- items: false,
186
- prefixItems: [
187
- {
188
- type: "string"
189
- }
190
- ]
191
- },
192
- {
193
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject"
194
- }
195
- ],
196
- description: "The generator of the Activity."
197
- },
198
- actor: {
199
- anyOf: [
200
- {
201
- type: "string"
202
- },
203
- {
204
- type: "array",
205
- items: false,
206
- prefixItems: [
207
- {
208
- type: "string"
209
- }
210
- ]
211
- },
212
- {
213
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject"
214
- }
215
- ],
216
- description: "The Actor behind the Activity."
217
- },
218
- object: {
219
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
220
- description: "The object affected by the Activity."
221
- },
222
- target: {
223
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
224
- description: "The target of the Activity."
225
- },
226
- summary: {
227
- anyOf: [
228
- {
229
- type: "string"
230
- },
231
- {
232
- $ref: "https://schema.twindev.org/json-ld/JsonLdLanguageMap"
233
- }
234
- ],
235
- description: "Summary of the Activity."
236
- },
237
- result: {
238
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject",
239
- description: "Result of the Activity."
240
- },
241
- origin: {
242
- anyOf: [
243
- {
244
- type: "string"
245
- },
246
- {
247
- type: "array",
248
- items: false,
249
- prefixItems: [
250
- {
251
- type: "string"
252
- }
253
- ]
254
- },
255
- {
256
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodeObject"
257
- }
258
- ],
259
- description: "Activity's origin."
260
- },
261
- updated: {
262
- type: "string",
263
- description: "The date and time at which the object was updated."
264
- }
265
- };
266
- var required = [
267
- "@context",
268
- "type",
269
- "object",
270
- "updated"
271
- ];
272
- var additionalProperties = {
273
- anyOf: [
274
- {
275
- $ref: "https://schema.twindev.org/json-ld/JsonLdNodePrimitive"
276
- },
277
- {
278
- $ref: "https://schema.twindev.org/json-ld/JsonLdLanguageMap"
279
- },
280
- {
281
- $ref: "https://schema.twindev.org/json-ld/JsonLdIndexMap"
282
- },
283
- {
284
- $ref: "https://schema.twindev.org/json-ld/JsonLdIncludedBlock"
285
- },
286
- {
287
- $ref: "https://schema.twindev.org/json-ld/JsonLdIdMap"
288
- },
289
- {
290
- $ref: "https://schema.twindev.org/json-ld/JsonLdTypeMap"
291
- },
292
- {
293
- type: "array"
294
- }
295
- ]
296
- };
297
- var ActivitySchema = {
298
- $schema: $schema$2,
299
- $id: $id$2,
300
- description: description$2,
301
- type: type$1,
302
- properties: properties,
303
- required: required,
304
- additionalProperties: additionalProperties
305
- };
306
-
307
- var $schema$1 = "https://json-schema.org/draft/2020-12/schema";
308
- var $id$1 = "https://schema.twindev.org/w3c-activity-streams/ActivityStreamsContextType";
309
- var description$1 = "The Activity Streams JSON-LD context type.";
310
- var anyOf = [
311
- {
312
- type: "string",
313
- "const": "https://www.w3.org/ns/activitystreams"
314
- },
315
- {
316
- type: "array",
317
- items: false,
318
- minItems: 1,
319
- maxItems: 1,
320
- prefixItems: [
321
- {
322
- type: "string",
323
- "const": "https://www.w3.org/ns/activitystreams"
324
- }
325
- ]
326
- },
327
- {
328
- type: "array",
329
- minItems: 1,
330
- items: {
331
- $ref: "https://schema.twindev.org/json-ld/JsonLdContextDefinitionElement"
332
- },
333
- prefixItems: [
334
- {
335
- type: "string",
336
- "const": "https://www.w3.org/ns/activitystreams"
337
- }
338
- ]
339
- }
340
- ];
341
- var ActivityStreamsContextTypeSchema = {
342
- $schema: $schema$1,
343
- $id: $id$1,
344
- description: description$1,
345
- anyOf: anyOf
346
- };
347
-
348
- var $schema = "https://json-schema.org/draft/2020-12/schema";
349
- var $id = "https://schema.twindev.org/w3c-activity-streams/ActivityStreamsTypes";
350
- var description = "The types concerning Activity Streams. The types concerning Activity.";
351
- var type = "string";
352
- var ActivityStreamsTypesSchema = {
353
- $schema: $schema,
354
- $id: $id,
355
- description: description,
356
- type: type,
357
- "enum": [
358
- "Activity",
359
- "Create",
360
- "Add",
361
- "Update",
362
- "Remove",
363
- "Delete"
364
- ]
365
- };
366
-
367
- // Copyright 2024 IOTA Stiftung.
368
- // SPDX-License-Identifier: Apache-2.0.
369
- /**
370
- * Data Type registration for the Data Space Connector
371
- */
372
- class ActivityStreamsDataTypes {
373
- /**
374
- * Register all the data types.
375
- */
376
- static registerTypes() {
377
- for (const activityStreamsType of Object.values(ActivityStreamsTypes)) {
378
- dataCore.DataTypeHandlerFactory.register(`${ActivityStreamsContexts.ActivityStreamsNamespace}${activityStreamsType}`, () => ({
379
- context: ActivityStreamsContexts.ActivityStreamsNamespace,
380
- type: `${activityStreamsType}`,
381
- defaultValue: {},
382
- jsonSchema: async () => ActivitySchema
383
- }));
384
- }
385
- const twinSchemaTypes = {
386
- ["ActivityStreamsContextType"]: ActivityStreamsContextTypeSchema,
387
- ["ActivityStreamsTypes"]: ActivityStreamsTypesSchema
388
- };
389
- for (const type of Object.keys(twinSchemaTypes)) {
390
- dataCore.DataTypeHandlerFactory.register(`${ActivityStreamsContexts.TwinContext}/${type}`, () => ({
391
- context: ActivityStreamsContexts.TwinContext,
392
- type,
393
- defaultValue: {},
394
- jsonSchema: async () => twinSchemaTypes[type]
395
- }));
396
- }
397
- }
398
- }
399
-
400
- exports.ActivityStreamsContexts = ActivityStreamsContexts;
401
- exports.ActivityStreamsDataTypes = ActivityStreamsDataTypes;
402
- exports.ActivityStreamsTypes = ActivityStreamsTypes;