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