@sockethub/schemas 3.0.0-alpha.3 → 3.0.0-alpha.5

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 (43) hide show
  1. package/package.json +16 -31
  2. package/src/index.ts +23 -22
  3. package/src/schemas/activity-object.ts +15 -15
  4. package/src/schemas/activity-stream.ts +41 -38
  5. package/{dist → src}/schemas/json/activity-object.json +1 -1
  6. package/{dist → src}/schemas/json/activity-stream.json +5 -1
  7. package/{dist → src}/schemas/json/platform.json +1 -0
  8. package/src/schemas/json/sockethub-config.json +144 -0
  9. package/src/schemas/platform.ts +22 -22
  10. package/src/schemas/sockethub-config.ts +140 -0
  11. package/dist/helpers/error-parser.d.ts +0 -9
  12. package/dist/helpers/error-parser.js +0 -91
  13. package/dist/helpers/objects.d.ts +0 -206
  14. package/dist/helpers/objects.js +0 -217
  15. package/dist/index.d.ts +0 -15
  16. package/dist/index.js +0 -22
  17. package/dist/index.test.data.credentials.d.ts +0 -37
  18. package/dist/index.test.data.credentials.js +0 -69
  19. package/dist/index.test.data.objects.d.ts +0 -50
  20. package/dist/index.test.data.objects.js +0 -214
  21. package/dist/index.test.data.platform.d.ts +0 -44
  22. package/dist/index.test.data.platform.js +0 -47
  23. package/dist/index.test.data.streams.d.ts +0 -256
  24. package/dist/index.test.data.streams.js +0 -449
  25. package/dist/schemas/activity-object.d.ts +0 -16
  26. package/dist/schemas/activity-object.js +0 -18
  27. package/dist/schemas/activity-stream.d.ts +0 -235
  28. package/dist/schemas/activity-stream.js +0 -49
  29. package/dist/schemas/platform.d.ts +0 -41
  30. package/dist/schemas/platform.js +0 -44
  31. package/dist/types.d.ts +0 -20
  32. package/dist/types.js +0 -2
  33. package/dist/validator.d.ts +0 -8
  34. package/dist/validator.js +0 -78
  35. package/src/helpers/error-parser.ts +0 -99
  36. package/src/helpers/objects.ts +0 -230
  37. package/src/index.test.data.credentials.ts +0 -71
  38. package/src/index.test.data.objects.ts +0 -235
  39. package/src/index.test.data.platform.ts +0 -45
  40. package/src/index.test.data.streams.ts +0 -470
  41. package/src/index.test.ts +0 -84
  42. package/src/types.ts +0 -23
  43. package/src/validator.ts +0 -79
@@ -1,449 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const objects_1 = require("./helpers/objects");
4
- exports.default = [
5
- [
6
- 'type:send, object:message',
7
- {
8
- type: 'send',
9
- context: 'irc',
10
- actor: {
11
- id: 'dood@irc.freenode.net',
12
- type: 'person',
13
- name: 'dood'
14
- },
15
- target: {
16
- id: 'irc.freenode.net/server',
17
- type: 'room',
18
- name: 'sockethub'
19
- },
20
- object: {
21
- type: 'message',
22
- content: 'some kind of message'
23
- }
24
- },
25
- true,
26
- ''
27
- ],
28
- [
29
- 'type:credentials, object:credentials',
30
- {
31
- type: 'credentials',
32
- context: 'irc',
33
- actor: {
34
- id: 'dood@irc.freenode.net',
35
- type: 'person',
36
- name: 'dood'
37
- },
38
- target: {
39
- id: 'irc.freenode.net/server',
40
- type: 'room',
41
- name: 'sockethub'
42
- },
43
- object: {
44
- type: 'credentials'
45
- }
46
- },
47
- true,
48
- ''
49
- ],
50
- [
51
- 'type:credentials',
52
- {
53
- context: 'irc',
54
- type: 'credentials',
55
- actor: {
56
- id: 'dood@irc.freenode.net',
57
- type: 'person',
58
- name: 'dood'
59
- },
60
- object: {
61
- type: 'credentials',
62
- user: "foo",
63
- pass: "bar"
64
- }
65
- },
66
- true,
67
- ''
68
- ],
69
- [
70
- 'bad target',
71
- {
72
- id: 'blah',
73
- type: 'send',
74
- context: 'dood',
75
- actor: {
76
- id: 'dood@irc.freenode.net',
77
- type: 'person',
78
- name: 'dood'
79
- },
80
- target: {
81
- type: 'person',
82
- name: 'bob'
83
- },
84
- object: {
85
- type: 'credentials'
86
- }
87
- },
88
- false,
89
- '/target: must have required property \'id\''
90
- ],
91
- [
92
- 'bad iri in object id',
93
- {
94
- type: 'feed',
95
- context: 'dood',
96
- actor: {
97
- id: 'dood@irc.freenode.net',
98
- type: 'person'
99
- },
100
- object: {
101
- id: 'example.org/some/path.html',
102
- type: 'website'
103
- }
104
- },
105
- false,
106
- '/object/id: must match format "iri"'
107
- ],
108
- [
109
- 'valid iri in object id',
110
- {
111
- type: 'feed',
112
- context: 'dood',
113
- actor: {
114
- id: 'dood@irc.freenode.net',
115
- type: 'person'
116
- },
117
- object: {
118
- id: 'https://example.org/some/path.html',
119
- type: 'website'
120
- }
121
- },
122
- true,
123
- ''
124
- ],
125
- [
126
- 'wrong actor type',
127
- {
128
- type: 'send',
129
- context: 'dood',
130
- actor: {
131
- id: 'doobar@freenode.net/channel',
132
- type: 'foo',
133
- content: 'hi there'
134
- },
135
- object: {
136
- type: 'feed',
137
- id: 'http://rss.example.org/feed.rss'
138
- }
139
- },
140
- false,
141
- `/actor: must match exactly one schema in oneOf: ${objects_1.ObjectTypesList.join(', ')}`
142
- ],
143
- [
144
- 'missing actor id',
145
- {
146
- id: 'blah',
147
- type: 'send',
148
- context: 'dood',
149
- actor: {
150
- type: 'person',
151
- name: 'dood'
152
- },
153
- target: {
154
- id: 'bob@crusty.net/Home',
155
- type: 'person',
156
- name: 'bob'
157
- },
158
- object: {
159
- type: 'feed',
160
- id: 'http://rss.example.org/feed.rss'
161
- }
162
- },
163
- false,
164
- '/actor: must have required property \'id\''
165
- ],
166
- [
167
- 'attendance request',
168
- {
169
- id: 'blah',
170
- type: 'observe',
171
- context: 'dood',
172
- actor: {
173
- id: 'dood',
174
- type: 'person'
175
- },
176
- target: {
177
- id: 'chatroom@crusty.net',
178
- type: 'room'
179
- },
180
- object: {
181
- type: 'attendance',
182
- }
183
- },
184
- true,
185
- ''
186
- ],
187
- [
188
- 'attendance response',
189
- {
190
- id: 'blah',
191
- type: 'observe',
192
- context: 'dood',
193
- actor: {
194
- id: 'chatroom@crusty.net',
195
- type: 'room',
196
- name: 'chatroom'
197
- },
198
- object: {
199
- type: 'attendance',
200
- members: ['bill', 'bob', 'hank']
201
- }
202
- },
203
- true,
204
- ''
205
- ],
206
- [
207
- 'invalid attendance request',
208
- {
209
- id: 'blah',
210
- type: 'observe',
211
- context: 'dood',
212
- actor: {
213
- id: 'dood',
214
- type: 'person'
215
- },
216
- target: {
217
- id: 'chatroom@crusty.net',
218
- type: 'room'
219
- },
220
- object: {
221
- type: 'attendance',
222
- status: 'foobar'
223
- }
224
- },
225
- false,
226
- '/object: must NOT have additional properties: status'
227
- ],
228
- [
229
- 'setting presence',
230
- {
231
- id: 'blah',
232
- type: 'observe',
233
- context: 'dood',
234
- actor: {
235
- id: 'dood',
236
- type: 'person'
237
- },
238
- object: {
239
- type: 'presence',
240
- presence: 'away',
241
- content: 'forgot the milk'
242
- },
243
- target: {
244
- id: 'chatroom@crusty.net',
245
- type: 'room'
246
- }
247
- },
248
- true,
249
- ''
250
- ],
251
- [
252
- 'setting invalid presence',
253
- {
254
- id: 'blah',
255
- type: 'observe',
256
- context: 'dood',
257
- actor: {
258
- id: 'dood',
259
- type: 'person'
260
- },
261
- object: {
262
- type: 'presence',
263
- presence: 'afk',
264
- content: 'forgot the milk'
265
- },
266
- target: {
267
- id: 'chatroom@crusty.net',
268
- type: 'room'
269
- }
270
- },
271
- false,
272
- '/object/presence: must be equal to one of the allowed values: ' +
273
- 'away, chat, dnd, xa, offline, online'
274
- ],
275
- [
276
- 'setting topic',
277
- {
278
- id: 'blah',
279
- type: 'observe',
280
- context: 'dood',
281
- actor: {
282
- id: 'dood',
283
- type: 'person'
284
- },
285
- object: {
286
- type: 'topic',
287
- content: 'the topic is goats'
288
- },
289
- target: {
290
- id: 'chatroom@crusty.net',
291
- type: 'room'
292
- }
293
- },
294
- true,
295
- ''
296
- ],
297
- [
298
- 'setting topic incorrectly',
299
- {
300
- id: 'blah',
301
- type: 'observe',
302
- context: 'dood',
303
- actor: {
304
- id: 'dood',
305
- type: 'person'
306
- },
307
- object: {
308
- type: 'topic',
309
- topic: 'the topic is goats'
310
- },
311
- target: {
312
- id: 'chatroom@crusty.net',
313
- type: 'room'
314
- }
315
- },
316
- false,
317
- '/object: must NOT have additional properties: topic'
318
- ],
319
- [
320
- 'receive topic',
321
- {
322
- id: 'blah',
323
- type: 'observe',
324
- context: 'dood',
325
- actor: {
326
- id: 'chatroom@crusty.net',
327
- type: 'room'
328
- },
329
- object: {
330
- type: 'topic',
331
- content: 'the topic is goats'
332
- }
333
- },
334
- true,
335
- ''
336
- ],
337
- [
338
- 'change user address',
339
- {
340
- id: 'blah',
341
- type: 'update',
342
- context: 'dood',
343
- actor: {
344
- id: 'foobar@example.com',
345
- type: 'person'
346
- },
347
- object: {
348
- type: 'address'
349
- },
350
- target: {
351
- id: 'futurebar@example.com',
352
- type: 'person'
353
- },
354
- },
355
- true,
356
- ''
357
- ],
358
- [
359
- 'change user address incorrectly',
360
- {
361
- type: 'update',
362
- context: 'dood',
363
- actor: {
364
- id: 'foobar@example.com',
365
- type: 'person'
366
- },
367
- object: {
368
- type: 'address',
369
- id: 'futurebar@example.com',
370
- }
371
- },
372
- false,
373
- '/object: must NOT have additional properties: id'
374
- ],
375
- [
376
- 'invalid activity stream',
377
- {
378
- "actor": { "id": "irc://uuu@localhost", "type": "person" },
379
- "context": "irc",
380
- "target": { "id": "irc://irc.dooder.net/a-room", "type": "room" }
381
- },
382
- false,
383
- 'activity stream: must have required property \'type\''
384
- ],
385
- [
386
- 'invalid room',
387
- {
388
- "context": "irc",
389
- "type": "credentials",
390
- "actor": {
391
- "id": "sh-9K3Vk@irc.freenode.net",
392
- "type": "person",
393
- },
394
- "target": {
395
- "type": "room",
396
- "name": "sh-9K3Vk"
397
- }
398
- },
399
- false,
400
- '/target: must have required property \'id\''
401
- ],
402
- [
403
- 'relationship',
404
- {
405
- "context": "irc",
406
- "type": "add",
407
- "actor": { "type": "person", "id": "alice@localhost", "name": "alice" },
408
- "target": { "type": "person", "id": "Kilroy@localhost", "name": "Kilroy" },
409
- "object": {
410
- "type": "relationship",
411
- "relationship": "role",
412
- "subject": {
413
- "type": "presence",
414
- "role": "owner"
415
- },
416
- "object": {
417
- "type": "room",
418
- "id": "localhost/#Finnish",
419
- "name": "#Finnish"
420
- }
421
- }
422
- },
423
- true, ""
424
- ],
425
- [
426
- 'invalid role in relationship',
427
- {
428
- "context": "irc",
429
- "type": "add",
430
- "actor": { "type": "person", "id": "alice@localhost", "name": "alice" },
431
- "target": { "type": "person", "id": "Kilroy@localhost", "name": "Kilroy" },
432
- "object": {
433
- "type": "relationship",
434
- "relationship": "role",
435
- "subject": {
436
- "type": "presence",
437
- "role": "manager"
438
- },
439
- "object": {
440
- "type": "room",
441
- "id": "localhost/#Finnish",
442
- "name": "#Finnish"
443
- }
444
- }
445
- },
446
- false, "/object/subject/role: must be equal to one of the allowed values: " +
447
- "owner, member, participant, admin"
448
- ]
449
- ];
@@ -1,16 +0,0 @@
1
- declare const _default: {
2
- $id: string;
3
- description: string;
4
- type: string;
5
- required: string[];
6
- properties: {
7
- object: {
8
- type: string;
9
- oneOf: any[];
10
- };
11
- };
12
- definitions: {
13
- type: {};
14
- };
15
- };
16
- export default _default;
@@ -1,18 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const objects_1 = require("../helpers/objects");
4
- exports.default = {
5
- "$id": "https://sockethub.org/schemas/v0/activity-object#",
6
- "description": "Schema for Sockethub Activity Objects",
7
- "type": "object",
8
- "required": ["object"],
9
- "properties": {
10
- "object": {
11
- "type": "object",
12
- "oneOf": objects_1.validObjectRefs
13
- }
14
- },
15
- "definitions": {
16
- "type": objects_1.validObjectDefs
17
- }
18
- };
@@ -1,235 +0,0 @@
1
- declare const _default: {
2
- $id: string;
3
- description: string;
4
- type: string;
5
- required: string[];
6
- properties: {
7
- id: {
8
- type: string;
9
- };
10
- type: {
11
- type: string;
12
- };
13
- context: {
14
- type: string;
15
- };
16
- actor: {
17
- type: string;
18
- oneOf: any[];
19
- };
20
- target: {
21
- type: string;
22
- oneOf: any[];
23
- };
24
- object: {
25
- type: string;
26
- oneOf: any[];
27
- };
28
- };
29
- definitions: {
30
- type: {
31
- credentials: {
32
- required: string[];
33
- additionalProperties: boolean;
34
- properties: {
35
- type: {
36
- enum: string[];
37
- };
38
- };
39
- };
40
- feed: {
41
- required: string[];
42
- additionalProperties: boolean;
43
- properties: {
44
- type: {
45
- enum: string[];
46
- };
47
- id: {
48
- type: string;
49
- format: string;
50
- };
51
- name: {
52
- type: string;
53
- };
54
- description: {
55
- type: string;
56
- };
57
- author: {
58
- type: string;
59
- };
60
- favicon: {
61
- type: string;
62
- };
63
- };
64
- };
65
- message: {
66
- required: string[];
67
- additionalProperties: boolean;
68
- properties: {
69
- type: {
70
- enum: string[];
71
- };
72
- id: {
73
- type: string;
74
- };
75
- name: {
76
- type: string;
77
- };
78
- content: {
79
- type: string;
80
- };
81
- };
82
- };
83
- me: {
84
- required: string[];
85
- additionalProperties: boolean;
86
- properties: {
87
- type: {
88
- enum: string[];
89
- };
90
- content: {
91
- type: string;
92
- };
93
- };
94
- };
95
- person: {
96
- required: string[];
97
- additionalProperties: boolean;
98
- properties: {
99
- id: {
100
- type: string;
101
- };
102
- type: {
103
- enum: string[];
104
- };
105
- name: {
106
- type: string;
107
- };
108
- };
109
- };
110
- room: {
111
- required: string[];
112
- additionalProperties: boolean;
113
- properties: {
114
- id: {
115
- type: string;
116
- };
117
- type: {
118
- enum: string[];
119
- };
120
- name: {
121
- type: string;
122
- };
123
- };
124
- };
125
- service: {
126
- required: string[];
127
- additionalProperties: boolean;
128
- properties: {
129
- id: {
130
- type: string;
131
- };
132
- type: {
133
- enum: string[];
134
- };
135
- name: {
136
- type: string;
137
- };
138
- };
139
- };
140
- website: {
141
- required: string[];
142
- additionalProperties: boolean;
143
- properties: {
144
- id: {
145
- type: string;
146
- format: string;
147
- };
148
- type: {
149
- enum: string[];
150
- };
151
- name: {
152
- type: string;
153
- };
154
- };
155
- };
156
- attendance: {
157
- required: string[];
158
- additionalProperties: boolean;
159
- properties: {
160
- type: {
161
- enum: string[];
162
- };
163
- members: {
164
- type: string;
165
- items: {
166
- type: string;
167
- };
168
- };
169
- };
170
- };
171
- presence: {
172
- required: string[];
173
- additionalProperties: boolean;
174
- properties: {
175
- type: {
176
- enum: string[];
177
- };
178
- presence: {
179
- enum: string[];
180
- };
181
- role: {
182
- enum: string[];
183
- };
184
- content: {
185
- type: string;
186
- };
187
- };
188
- };
189
- relationship: {
190
- required: string[];
191
- additionalProperties: boolean;
192
- properties: {
193
- type: {
194
- enum: string[];
195
- };
196
- relationship: {
197
- enum: string[];
198
- };
199
- subject: {
200
- type: string;
201
- oneOf: {
202
- $ref: string;
203
- }[];
204
- };
205
- object: {
206
- type: string;
207
- oneOf: any[];
208
- };
209
- };
210
- };
211
- topic: {
212
- required: string[];
213
- additionalProperties: boolean;
214
- properties: {
215
- type: {
216
- enum: string[];
217
- };
218
- content: {
219
- type: string;
220
- };
221
- };
222
- };
223
- address: {
224
- required: string[];
225
- additionalProperties: boolean;
226
- properties: {
227
- type: {
228
- enum: string[];
229
- };
230
- };
231
- };
232
- };
233
- };
234
- };
235
- export default _default;