@sockethub/schemas 3.0.0-alpha.12 → 3.0.0-alpha.13

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.
Files changed (46) hide show
  1. package/dist/activity-stream-helper.d.ts +5 -0
  2. package/dist/activity-stream-helper.js +36 -0
  3. package/dist/activity-stream-helper.js.map +10 -0
  4. package/dist/context.d.ts +56 -0
  5. package/dist/context.js +20 -41
  6. package/dist/context.js.map +3 -3
  7. package/dist/helpers/error-parser.d.ts +13 -0
  8. package/dist/helpers/objects.d.ts +122 -0
  9. package/dist/index.d.ts +9 -0
  10. package/dist/index.js +180 -218
  11. package/dist/index.js.map +12 -12
  12. package/dist/maps/context-map.json +2 -2
  13. package/dist/object-types.d.ts +2 -0
  14. package/dist/object-types.js +296 -0
  15. package/dist/object-types.js.map +12 -0
  16. package/dist/schemas/activity-stream.d.ts +161 -0
  17. package/dist/schemas/platform/feeds/v1/messages.schema.json +8 -17
  18. package/dist/schemas/platform/irc/v1/credentials.schema.json +71 -1
  19. package/dist/schemas/platform/irc/v1/messages.schema.json +84 -0
  20. package/dist/schemas/platform/metadata/v1/messages.schema.json +1 -16
  21. package/dist/schemas/platform/xmpp/v1/credentials.schema.json +2 -2
  22. package/dist/schemas/platform/xmpp/v1/messages.schema.json +108 -0
  23. package/dist/schemas/platform.d.ts +62 -0
  24. package/dist/schemas/sockethub-config.d.ts +261 -0
  25. package/{src/types.ts → dist/types.d.ts} +17 -45
  26. package/dist/validator.d.ts +26 -0
  27. package/package.json +13 -8
  28. package/src/context.ts +0 -125
  29. package/src/helpers/error-parser.ts +0 -160
  30. package/src/helpers/objects.ts +0 -283
  31. package/src/index.test.data.credentials.ts +0 -103
  32. package/src/index.test.data.objects.ts +0 -241
  33. package/src/index.test.data.platform.ts +0 -48
  34. package/src/index.test.data.streams.ts +0 -590
  35. package/src/index.test.ts +0 -127
  36. package/src/index.ts +0 -56
  37. package/src/schemas/activity-object.ts +0 -19
  38. package/src/schemas/activity-stream.ts +0 -75
  39. package/src/schemas/json/activity-object.json +0 -405
  40. package/src/schemas/json/activity-stream.json +0 -502
  41. package/src/schemas/json/platform.json +0 -48
  42. package/src/schemas/json/sockethub-config.json +0 -236
  43. package/src/schemas/platform.ts +0 -71
  44. package/src/schemas/sockethub-config.ts +0 -220
  45. package/src/types/ajv-formats-draft2019.d.ts +0 -5
  46. package/src/validator.ts +0 -207
@@ -1,590 +0,0 @@
1
- import { ActorTypesList } from "./helpers/objects";
2
-
3
- export default [
4
- [
5
- "type:send, object:message",
6
- {
7
- type: "send",
8
- "@context": [
9
- "https://www.w3.org/ns/activitystreams",
10
- "https://sockethub.org/ns/context/v1.jsonld",
11
- "https://sockethub.org/ns/context/platform/irc/v1.jsonld",
12
- ],
13
- actor: {
14
- id: "dood@irc.freenode.net",
15
- type: "person",
16
- name: "dood",
17
- },
18
- target: {
19
- id: "irc.freenode.net/server",
20
- type: "room",
21
- name: "sockethub",
22
- },
23
- object: {
24
- type: "message",
25
- content: "some kind of message",
26
- },
27
- },
28
- true,
29
- "",
30
- ],
31
-
32
- [
33
- "type:send, object:message bad published value",
34
- {
35
- type: "send",
36
- "@context": [
37
- "https://www.w3.org/ns/activitystreams",
38
- "https://sockethub.org/ns/context/v1.jsonld",
39
- "https://sockethub.org/ns/context/platform/irc/v1.jsonld",
40
- ],
41
- published: "foo",
42
- actor: {
43
- id: "dood@irc.freenode.net",
44
- type: "person",
45
- name: "dood",
46
- },
47
- target: {
48
- id: "irc.freenode.net/server",
49
- type: "room",
50
- name: "sockethub",
51
- },
52
- object: {
53
- type: "message",
54
- content: "some kind of message",
55
- },
56
- },
57
- false,
58
- '[irc] /published: must match format "date-time"',
59
- ],
60
-
61
- [
62
- "type:credentials, object:credentials",
63
- {
64
- type: "credentials",
65
- "@context": [
66
- "https://www.w3.org/ns/activitystreams",
67
- "https://sockethub.org/ns/context/v1.jsonld",
68
- "https://sockethub.org/ns/context/platform/irc/v1.jsonld",
69
- ],
70
- actor: {
71
- id: "dood@irc.freenode.net",
72
- type: "person",
73
- name: "dood",
74
- },
75
- target: {
76
- id: "irc.freenode.net/server",
77
- type: "room",
78
- name: "sockethub",
79
- },
80
- object: {
81
- type: "credentials",
82
- },
83
- },
84
- true,
85
- "",
86
- ],
87
-
88
- [
89
- "type:credentials",
90
- {
91
- "@context": [
92
- "https://www.w3.org/ns/activitystreams",
93
- "https://sockethub.org/ns/context/v1.jsonld",
94
- "https://sockethub.org/ns/context/platform/irc/v1.jsonld",
95
- ],
96
- type: "credentials",
97
- actor: {
98
- id: "dood@irc.freenode.net",
99
- type: "person",
100
- name: "dood",
101
- },
102
- object: {
103
- type: "credentials",
104
- user: "foo",
105
- pass: "bar",
106
- },
107
- },
108
- true,
109
- "",
110
- ],
111
-
112
- [
113
- "bad target",
114
- {
115
- id: "blah",
116
- type: "send",
117
- "@context": [
118
- "https://www.w3.org/ns/activitystreams",
119
- "https://sockethub.org/ns/context/v1.jsonld",
120
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
121
- ],
122
- actor: {
123
- id: "dood@irc.freenode.net",
124
- type: "person",
125
- name: "dood",
126
- },
127
- target: {
128
- type: "person",
129
- name: "bob",
130
- },
131
- object: {
132
- type: "credentials",
133
- },
134
- },
135
- false,
136
- "[dood] /target: must have required property 'id'",
137
- ],
138
-
139
- [
140
- "bad iri in object id",
141
- {
142
- type: "feed",
143
- "@context": [
144
- "https://www.w3.org/ns/activitystreams",
145
- "https://sockethub.org/ns/context/v1.jsonld",
146
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
147
- ],
148
- actor: {
149
- id: "dood@irc.freenode.net",
150
- type: "person",
151
- },
152
- object: {
153
- id: "example.org/some/path.html",
154
- type: "website",
155
- },
156
- },
157
- false,
158
- '[dood] /object/id: must match format "iri"',
159
- ],
160
-
161
- [
162
- "valid iri in object id",
163
- {
164
- type: "feed",
165
- "@context": [
166
- "https://www.w3.org/ns/activitystreams",
167
- "https://sockethub.org/ns/context/v1.jsonld",
168
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
169
- ],
170
- actor: {
171
- id: "dood@irc.freenode.net",
172
- type: "person",
173
- },
174
- object: {
175
- id: "https://example.org/some/path.html",
176
- type: "website",
177
- },
178
- },
179
- true,
180
- "",
181
- ],
182
-
183
- [
184
- "wrong actor type",
185
- {
186
- type: "send",
187
- "@context": [
188
- "https://www.w3.org/ns/activitystreams",
189
- "https://sockethub.org/ns/context/v1.jsonld",
190
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
191
- ],
192
- actor: {
193
- id: "doobar@freenode.net/channel",
194
- type: "foo",
195
- content: "hi there",
196
- },
197
- object: {
198
- type: "feed",
199
- id: "http://rss.example.org/feed.rss",
200
- },
201
- },
202
- false,
203
- `[dood] /actor: must match exactly one schema in oneOf: ${ActorTypesList.join(
204
- ", ",
205
- )}`,
206
- ],
207
-
208
- [
209
- "missing actor id",
210
- {
211
- id: "blah",
212
- type: "send",
213
- "@context": [
214
- "https://www.w3.org/ns/activitystreams",
215
- "https://sockethub.org/ns/context/v1.jsonld",
216
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
217
- ],
218
- actor: {
219
- type: "person",
220
- name: "dood",
221
- },
222
- target: {
223
- id: "bob@crusty.net/Home",
224
- type: "person",
225
- name: "bob",
226
- },
227
- object: {
228
- type: "feed",
229
- id: "http://rss.example.org/feed.rss",
230
- },
231
- },
232
- false,
233
- "[dood] /actor: must have required property 'id'",
234
- ],
235
-
236
- [
237
- "attendance request",
238
- {
239
- id: "blah",
240
- type: "observe",
241
- "@context": [
242
- "https://www.w3.org/ns/activitystreams",
243
- "https://sockethub.org/ns/context/v1.jsonld",
244
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
245
- ],
246
- actor: {
247
- id: "dood",
248
- type: "person",
249
- },
250
- target: {
251
- id: "chatroom@crusty.net",
252
- type: "room",
253
- },
254
- object: {
255
- type: "attendance",
256
- },
257
- },
258
- true,
259
- "",
260
- ],
261
-
262
- [
263
- "attendance response",
264
- {
265
- id: "blah",
266
- type: "observe",
267
- "@context": [
268
- "https://www.w3.org/ns/activitystreams",
269
- "https://sockethub.org/ns/context/v1.jsonld",
270
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
271
- ],
272
- actor: {
273
- id: "chatroom@crusty.net",
274
- type: "room",
275
- name: "chatroom",
276
- },
277
- object: {
278
- type: "attendance",
279
- members: ["bill", "bob", "hank"],
280
- },
281
- },
282
- true,
283
- "",
284
- ],
285
-
286
- [
287
- "invalid attendance request",
288
- {
289
- id: "blah",
290
- type: "observe",
291
- "@context": [
292
- "https://www.w3.org/ns/activitystreams",
293
- "https://sockethub.org/ns/context/v1.jsonld",
294
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
295
- ],
296
- actor: {
297
- id: "dood",
298
- type: "person",
299
- },
300
- target: {
301
- id: "chatroom@crusty.net",
302
- type: "room",
303
- },
304
- object: {
305
- type: "attendance",
306
- status: "foobar",
307
- },
308
- },
309
- false,
310
- "[dood] /object: must NOT have additional properties: status",
311
- ],
312
-
313
- [
314
- "setting presence",
315
- {
316
- id: "blah",
317
- type: "observe",
318
- "@context": [
319
- "https://www.w3.org/ns/activitystreams",
320
- "https://sockethub.org/ns/context/v1.jsonld",
321
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
322
- ],
323
- actor: {
324
- id: "dood",
325
- type: "person",
326
- },
327
- object: {
328
- type: "presence",
329
- presence: "away",
330
- content: "forgot the milk",
331
- },
332
- target: {
333
- id: "chatroom@crusty.net",
334
- type: "room",
335
- },
336
- },
337
- true,
338
- "",
339
- ],
340
-
341
- [
342
- "setting invalid presence",
343
- {
344
- id: "blah",
345
- type: "observe",
346
- "@context": [
347
- "https://www.w3.org/ns/activitystreams",
348
- "https://sockethub.org/ns/context/v1.jsonld",
349
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
350
- ],
351
- actor: {
352
- id: "dood",
353
- type: "person",
354
- },
355
- object: {
356
- type: "presence",
357
- presence: "afk",
358
- content: "forgot the milk",
359
- },
360
- target: {
361
- id: "chatroom@crusty.net",
362
- type: "room",
363
- },
364
- },
365
- false,
366
- "[dood] /object/presence: must be equal to one of the allowed values: " +
367
- "away, chat, dnd, xa, offline, online",
368
- ],
369
-
370
- [
371
- "setting topic",
372
- {
373
- id: "blah",
374
- type: "observe",
375
- "@context": [
376
- "https://www.w3.org/ns/activitystreams",
377
- "https://sockethub.org/ns/context/v1.jsonld",
378
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
379
- ],
380
- actor: {
381
- id: "dood",
382
- type: "person",
383
- },
384
- object: {
385
- type: "topic",
386
- content: "the topic is goats",
387
- },
388
- target: {
389
- id: "chatroom@crusty.net",
390
- type: "room",
391
- },
392
- },
393
- true,
394
- "",
395
- ],
396
-
397
- [
398
- "setting topic incorrectly",
399
- {
400
- id: "blah",
401
- type: "observe",
402
- "@context": [
403
- "https://www.w3.org/ns/activitystreams",
404
- "https://sockethub.org/ns/context/v1.jsonld",
405
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
406
- ],
407
- actor: {
408
- id: "dood",
409
- type: "person",
410
- },
411
- object: {
412
- type: "topic",
413
- topic: "the topic is goats",
414
- },
415
- target: {
416
- id: "chatroom@crusty.net",
417
- type: "room",
418
- },
419
- },
420
- false,
421
- "[dood] /object: must NOT have additional properties: topic",
422
- ],
423
-
424
- [
425
- "receive topic",
426
- {
427
- id: "blah",
428
- type: "observe",
429
- "@context": [
430
- "https://www.w3.org/ns/activitystreams",
431
- "https://sockethub.org/ns/context/v1.jsonld",
432
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
433
- ],
434
- actor: {
435
- id: "chatroom@crusty.net",
436
- type: "room",
437
- },
438
- object: {
439
- type: "topic",
440
- content: "the topic is goats",
441
- },
442
- },
443
- true,
444
- "",
445
- ],
446
-
447
- [
448
- "change user address",
449
- {
450
- id: "blah",
451
- type: "update",
452
- "@context": [
453
- "https://www.w3.org/ns/activitystreams",
454
- "https://sockethub.org/ns/context/v1.jsonld",
455
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
456
- ],
457
- actor: {
458
- id: "foobar@example.com",
459
- type: "person",
460
- },
461
- object: {
462
- type: "address",
463
- },
464
- target: {
465
- id: "futurebar@example.com",
466
- type: "person",
467
- },
468
- },
469
- true,
470
- "",
471
- ],
472
-
473
- [
474
- "change user address incorrectly",
475
- {
476
- type: "update",
477
- "@context": [
478
- "https://www.w3.org/ns/activitystreams",
479
- "https://sockethub.org/ns/context/v1.jsonld",
480
- "https://sockethub.org/ns/context/platform/dood/v1.jsonld",
481
- ],
482
- actor: {
483
- id: "foobar@example.com",
484
- type: "person",
485
- },
486
- object: {
487
- type: "address",
488
- id: "futurebar@example.com",
489
- },
490
- },
491
- false,
492
- "[dood] /object: must NOT have additional properties: id",
493
- ],
494
-
495
- [
496
- "invalid activity stream",
497
- {
498
- actor: { id: "irc://uuu@localhost", type: "person" },
499
- "@context": [
500
- "https://www.w3.org/ns/activitystreams",
501
- "https://sockethub.org/ns/context/v1.jsonld",
502
- "https://sockethub.org/ns/context/platform/irc/v1.jsonld",
503
- ],
504
- target: { id: "irc://irc.dooder.net/a-room", type: "room" },
505
- },
506
- false,
507
- "[irc] activity stream: must have required property 'type'",
508
- ],
509
-
510
- [
511
- "invalid room",
512
- {
513
- "@context": [
514
- "https://www.w3.org/ns/activitystreams",
515
- "https://sockethub.org/ns/context/v1.jsonld",
516
- "https://sockethub.org/ns/context/platform/irc/v1.jsonld",
517
- ],
518
- type: "credentials",
519
- actor: {
520
- id: "sh-9K3Vk@irc.freenode.net",
521
- type: "person",
522
- },
523
- target: {
524
- type: "room",
525
- name: "sh-9K3Vk",
526
- },
527
- },
528
- false,
529
- "[irc] /target: must have required property 'id'",
530
- ],
531
-
532
- [
533
- "relationship",
534
- {
535
- "@context": [
536
- "https://www.w3.org/ns/activitystreams",
537
- "https://sockethub.org/ns/context/v1.jsonld",
538
- "https://sockethub.org/ns/context/platform/irc/v1.jsonld",
539
- ],
540
- type: "add",
541
- actor: { type: "person", id: "alice@localhost", name: "alice" },
542
- target: { type: "person", id: "Kilroy@localhost", name: "Kilroy" },
543
- object: {
544
- type: "relationship",
545
- relationship: "role",
546
- subject: {
547
- type: "presence",
548
- role: "owner",
549
- },
550
- object: {
551
- type: "room",
552
- id: "localhost/#Finnish",
553
- name: "#Finnish",
554
- },
555
- },
556
- },
557
- true,
558
- "",
559
- ],
560
-
561
- [
562
- "invalid role in relationship",
563
- {
564
- "@context": [
565
- "https://www.w3.org/ns/activitystreams",
566
- "https://sockethub.org/ns/context/v1.jsonld",
567
- "https://sockethub.org/ns/context/platform/irc/v1.jsonld",
568
- ],
569
- type: "add",
570
- actor: { type: "person", id: "alice@localhost", name: "alice" },
571
- target: { type: "person", id: "Kilroy@localhost", name: "Kilroy" },
572
- object: {
573
- type: "relationship",
574
- relationship: "role",
575
- subject: {
576
- type: "presence",
577
- role: "manager",
578
- },
579
- object: {
580
- type: "room",
581
- id: "localhost/#Finnish",
582
- name: "#Finnish",
583
- },
584
- },
585
- },
586
- false,
587
- "[irc] /object/subject/role: must be equal to one of the allowed values: " +
588
- "owner, member, participant, admin",
589
- ],
590
- ];