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