@sockethub/schemas 3.0.0-alpha.9 → 3.0.0-beta.0

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 (74) 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 +80 -0
  6. package/dist/context.js.map +10 -0
  7. package/dist/contexts/platform/caldav/v1.jsonld +8 -0
  8. package/dist/contexts/platform/carddav/v1.jsonld +8 -0
  9. package/dist/contexts/platform/dummy/v1.jsonld +8 -0
  10. package/dist/contexts/platform/error/v1.jsonld +8 -0
  11. package/dist/contexts/platform/feeds/v1.jsonld +8 -0
  12. package/dist/contexts/platform/irc/v1.jsonld +8 -0
  13. package/dist/contexts/platform/metadata/v1.jsonld +8 -0
  14. package/dist/contexts/platform/sockethub%3Ainternal/v1.jsonld +8 -0
  15. package/dist/contexts/platform/xmpp/v1.jsonld +8 -0
  16. package/dist/contexts/v1.jsonld +7 -0
  17. package/dist/helpers/error-parser.d.ts +13 -0
  18. package/dist/helpers/objects.d.ts +157 -0
  19. package/dist/index.d.ts +11 -0
  20. package/dist/index.js +1235 -1143
  21. package/dist/index.js.map +15 -17
  22. package/dist/maps/context-map.json +41 -0
  23. package/dist/object-types.d.ts +2 -0
  24. package/dist/object-types.js +299 -0
  25. package/dist/object-types.js.map +12 -0
  26. package/dist/schema-id.d.ts +11 -0
  27. package/dist/schemas/activity-stream.d.ts +196 -0
  28. package/{src/schemas/json/activity-object.json → dist/schemas/json/activity-stream.json} +99 -158
  29. package/dist/schemas/json/platform.json +52 -0
  30. package/dist/schemas/json/service-descriptor.json +58 -0
  31. package/dist/schemas/json/sockethub-config.json +500 -0
  32. package/dist/schemas/platform/caldav/v1/credentials.schema.json +71 -0
  33. package/dist/schemas/platform/caldav/v1/messages.schema.json +769 -0
  34. package/dist/schemas/platform/carddav/v1/credentials.schema.json +67 -0
  35. package/dist/schemas/platform/carddav/v1/messages.schema.json +375 -0
  36. package/dist/schemas/platform/dummy/v1/credentials.schema.json +1 -0
  37. package/dist/schemas/platform/dummy/v1/messages.schema.json +22 -0
  38. package/dist/schemas/platform/error/v1/credentials.schema.json +1 -0
  39. package/dist/schemas/platform/error/v1/messages.schema.json +1 -0
  40. package/dist/schemas/platform/feeds/v1/credentials.schema.json +1 -0
  41. package/dist/schemas/platform/feeds/v1/messages.schema.json +27 -0
  42. package/dist/schemas/platform/irc/v1/credentials.schema.json +118 -0
  43. package/dist/schemas/platform/irc/v1/messages.schema.json +149 -0
  44. package/dist/schemas/platform/metadata/v1/credentials.schema.json +1 -0
  45. package/dist/schemas/platform/metadata/v1/messages.schema.json +14 -0
  46. package/dist/schemas/platform/sockethub%3Ainternal/v1/credentials.schema.json +1 -0
  47. package/dist/schemas/platform/sockethub%3Ainternal/v1/messages.schema.json +1 -0
  48. package/dist/schemas/platform/xmpp/v1/credentials.schema.json +43 -0
  49. package/dist/schemas/platform/xmpp/v1/messages.schema.json +129 -0
  50. package/dist/schemas/platform.d.ts +62 -0
  51. package/dist/schemas/service-descriptor.d.ts +84 -0
  52. package/dist/schemas/sockethub-config.d.ts +466 -0
  53. package/dist/service-descriptor.d.ts +4 -0
  54. package/dist/service-descriptor.js +6280 -0
  55. package/dist/service-descriptor.js.map +77 -0
  56. package/{src/types.ts → dist/types.d.ts} +52 -53
  57. package/dist/validator.d.ts +26 -0
  58. package/package.json +32 -11
  59. package/src/helpers/error-parser.ts +0 -113
  60. package/src/helpers/objects.ts +0 -227
  61. package/src/index.test.data.credentials.ts +0 -71
  62. package/src/index.test.data.objects.ts +0 -241
  63. package/src/index.test.data.platform.ts +0 -45
  64. package/src/index.test.data.streams.ts +0 -498
  65. package/src/index.test.ts +0 -99
  66. package/src/index.ts +0 -27
  67. package/src/schemas/activity-object.ts +0 -19
  68. package/src/schemas/activity-stream.ts +0 -54
  69. package/src/schemas/json/activity-stream.json +0 -469
  70. package/src/schemas/json/platform.json +0 -28
  71. package/src/schemas/json/sockethub-config.json +0 -144
  72. package/src/schemas/platform.ts +0 -47
  73. package/src/schemas/sockethub-config.ts +0 -140
  74. package/src/validator.ts +0 -94
@@ -0,0 +1,500 @@
1
+ {
2
+ "$id": "https://sockethub.org/schemas/3.0.0-beta.0/sockethub-config.json",
3
+ "description": "Sockethub Config Schema",
4
+ "type": "object",
5
+ "required": [
6
+ "platforms"
7
+ ],
8
+ "additionalProperties": false,
9
+ "properties": {
10
+ "$schema": {
11
+ "type": "string"
12
+ },
13
+ "examples": {
14
+ "type": "boolean",
15
+ "default": true,
16
+ "description": "Enable the examples pages served at [host]:[port]/examples"
17
+ },
18
+ "about": {
19
+ "type": "object",
20
+ "additionalProperties": false,
21
+ "description": "Details about this deployment shown on the root info page",
22
+ "properties": {
23
+ "name": {
24
+ "type": "string",
25
+ "default": "",
26
+ "description": "Display name of this Sockethub instance"
27
+ },
28
+ "description": {
29
+ "type": "string",
30
+ "default": "",
31
+ "description": "Short description of who this instance is for"
32
+ },
33
+ "contact": {
34
+ "type": "string",
35
+ "default": "",
36
+ "description": "Operator contact (email address or URL)"
37
+ },
38
+ "links": {
39
+ "type": "array",
40
+ "default": [],
41
+ "description": "Extra links (privacy policy, terms, website) shown on the info page",
42
+ "items": {
43
+ "type": "object",
44
+ "additionalProperties": false,
45
+ "required": [
46
+ "label",
47
+ "url"
48
+ ],
49
+ "properties": {
50
+ "label": {
51
+ "type": "string",
52
+ "minLength": 1
53
+ },
54
+ "url": {
55
+ "type": "string",
56
+ "pattern": "^https?://"
57
+ }
58
+ }
59
+ }
60
+ },
61
+ "showVersion": {
62
+ "type": "boolean",
63
+ "default": false,
64
+ "description": "Show the exact server version on the info page (off by default to limit fingerprinting)"
65
+ },
66
+ "showUptime": {
67
+ "type": "boolean",
68
+ "default": false,
69
+ "description": "Show the process uptime on the info page (off by default: it reveals when the server last restarted)"
70
+ }
71
+ }
72
+ },
73
+ "logging": {
74
+ "type": "object",
75
+ "additionalProperties": false,
76
+ "properties": {
77
+ "level": {
78
+ "type": "string",
79
+ "enum": [
80
+ "error",
81
+ "warn",
82
+ "info",
83
+ "debug"
84
+ ],
85
+ "default": "info"
86
+ },
87
+ "fileLevel": {
88
+ "type": "string",
89
+ "enum": [
90
+ "error",
91
+ "warn",
92
+ "info",
93
+ "debug"
94
+ ],
95
+ "default": "debug"
96
+ },
97
+ "file": {
98
+ "type": "string",
99
+ "default": "sockethub.log"
100
+ }
101
+ }
102
+ },
103
+ "platforms": {
104
+ "type": "array",
105
+ "items": {
106
+ "type": "string"
107
+ },
108
+ "description": "Platform packages to load",
109
+ "default": [
110
+ "@sockethub/platform-carddav",
111
+ "@sockethub/platform-caldav",
112
+ "@sockethub/platform-dummy",
113
+ "@sockethub/platform-feeds",
114
+ "@sockethub/platform-irc",
115
+ "@sockethub/platform-metadata",
116
+ "@sockethub/platform-xmpp"
117
+ ]
118
+ },
119
+ "packageConfig": {
120
+ "type": "object",
121
+ "default": {},
122
+ "description": "Per-platform config keyed by package name, validated against each platform's config schema and forwarded to its child process",
123
+ "properties": {
124
+ "@sockethub/platform-carddav": {
125
+ "type": "object",
126
+ "additionalProperties": false,
127
+ "properties": {
128
+ "connectTimeoutMs": {
129
+ "type": "integer",
130
+ "minimum": 1
131
+ },
132
+ "allowPrivateAddresses": {
133
+ "type": "boolean"
134
+ },
135
+ "allowInsecureHttp": {
136
+ "type": "boolean"
137
+ },
138
+ "concurrency": {
139
+ "type": "integer",
140
+ "minimum": 1
141
+ }
142
+ }
143
+ },
144
+ "@sockethub/platform-caldav": {
145
+ "type": "object",
146
+ "additionalProperties": false,
147
+ "properties": {
148
+ "connectTimeoutMs": {
149
+ "type": "integer",
150
+ "minimum": 1
151
+ },
152
+ "allowPrivateAddresses": {
153
+ "type": "boolean"
154
+ },
155
+ "allowInsecureHttp": {
156
+ "type": "boolean"
157
+ },
158
+ "concurrency": {
159
+ "type": "integer",
160
+ "minimum": 1
161
+ }
162
+ }
163
+ },
164
+ "@sockethub/platform-dummy": {
165
+ "type": "object",
166
+ "additionalProperties": false,
167
+ "properties": {
168
+ "greeting": {
169
+ "type": "string",
170
+ "default": "Hello"
171
+ }
172
+ }
173
+ },
174
+ "@sockethub/platform-feeds": {
175
+ "type": "object",
176
+ "additionalProperties": false,
177
+ "properties": {
178
+ "connectTimeoutMs": {
179
+ "type": "number"
180
+ },
181
+ "allowPrivateAddresses": {
182
+ "type": "boolean"
183
+ },
184
+ "concurrency": {
185
+ "type": "integer",
186
+ "minimum": 1
187
+ }
188
+ }
189
+ },
190
+ "@sockethub/platform-irc": {
191
+ "type": "object",
192
+ "additionalProperties": false,
193
+ "properties": {
194
+ "connectTimeoutMs": {
195
+ "type": "number"
196
+ }
197
+ }
198
+ },
199
+ "@sockethub/platform-xmpp": {
200
+ "type": "object",
201
+ "additionalProperties": false,
202
+ "properties": {
203
+ "connectTimeoutMs": {
204
+ "type": "number"
205
+ }
206
+ }
207
+ },
208
+ "@sockethub/platform-metadata": {
209
+ "type": "object",
210
+ "additionalProperties": false,
211
+ "properties": {
212
+ "allowPrivateAddresses": {
213
+ "type": "boolean"
214
+ },
215
+ "concurrency": {
216
+ "type": "integer",
217
+ "minimum": 1
218
+ }
219
+ }
220
+ }
221
+ }
222
+ },
223
+ "credentials": {
224
+ "type": "object",
225
+ "additionalProperties": false,
226
+ "properties": {
227
+ "ttlMs": {
228
+ "type": "number",
229
+ "minimum": 0,
230
+ "default": 604800000,
231
+ "description": "Sliding TTL in milliseconds for per-session encrypted credential keys in Redis, refreshed on every save and read. A backstop against keys orphaned by crashes; sessions normally delete their key on disconnect. Size generously — idle sessions do not refresh it. 0 disables expiry."
232
+ }
233
+ }
234
+ },
235
+ "credentialCheck": {
236
+ "type": "object",
237
+ "additionalProperties": false,
238
+ "properties": {
239
+ "reconnectIpSource": {
240
+ "type": "string",
241
+ "enum": [
242
+ "socket",
243
+ "proxy"
244
+ ],
245
+ "default": "socket"
246
+ },
247
+ "proxyHeader": {
248
+ "type": "string",
249
+ "default": "x-forwarded-for"
250
+ }
251
+ }
252
+ },
253
+ "public": {
254
+ "type": "object",
255
+ "additionalProperties": false,
256
+ "properties": {
257
+ "protocol": {
258
+ "type": "string",
259
+ "default": "http"
260
+ },
261
+ "host": {
262
+ "type": "string",
263
+ "default": "localhost"
264
+ },
265
+ "port": {
266
+ "type": "number",
267
+ "default": 10550
268
+ },
269
+ "path": {
270
+ "type": "string",
271
+ "default": "/"
272
+ }
273
+ }
274
+ },
275
+ "rateLimiter": {
276
+ "type": "object",
277
+ "additionalProperties": false,
278
+ "properties": {
279
+ "windowMs": {
280
+ "type": "number",
281
+ "default": 1000
282
+ },
283
+ "maxRequests": {
284
+ "type": "number",
285
+ "default": 100
286
+ },
287
+ "blockDurationMs": {
288
+ "type": "number",
289
+ "default": 5000
290
+ },
291
+ "maxConnectionsPerIp": {
292
+ "type": "number",
293
+ "minimum": 0,
294
+ "default": 20,
295
+ "description": "Maximum concurrent socket connections per client IP. The per-event rate limiter is keyed by socket id, so without a connection cap a client can bypass it by opening more sockets. 0 disables the cap."
296
+ }
297
+ }
298
+ },
299
+ "limits": {
300
+ "type": "object",
301
+ "additionalProperties": false,
302
+ "properties": {
303
+ "maxPlatformInstances": {
304
+ "type": "number",
305
+ "minimum": 0,
306
+ "default": 100,
307
+ "description": "Upper bound on concurrently running platform instances (child processes). Each persistent-platform actor forks its own process, so an unbounded count is a resource exhaustion risk on public instances. 0 disables the cap."
308
+ }
309
+ }
310
+ },
311
+ "redis": {
312
+ "type": "object",
313
+ "additionalProperties": false,
314
+ "properties": {
315
+ "url": {
316
+ "type": "string",
317
+ "default": "redis://127.0.0.1:6379"
318
+ },
319
+ "connectTimeout": {
320
+ "type": "number",
321
+ "default": 10000,
322
+ "description": "Connection timeout in milliseconds"
323
+ },
324
+ "disconnectTimeout": {
325
+ "type": "number",
326
+ "default": 5000,
327
+ "description": "Disconnect timeout in milliseconds"
328
+ },
329
+ "maxRetriesPerRequest": {
330
+ "type": [
331
+ "number",
332
+ "null"
333
+ ],
334
+ "default": null,
335
+ "description": "Maximum number of retries per request (null for BullMQ default)"
336
+ }
337
+ }
338
+ },
339
+ "sentry": {
340
+ "type": "object",
341
+ "additionalProperties": false,
342
+ "properties": {
343
+ "dsn": {
344
+ "type": "string",
345
+ "default": ""
346
+ },
347
+ "environment": {
348
+ "type": "string",
349
+ "default": "production"
350
+ },
351
+ "release": {
352
+ "type": "string",
353
+ "default": ""
354
+ },
355
+ "enableLogs": {
356
+ "type": "boolean",
357
+ "default": false
358
+ },
359
+ "logLevels": {
360
+ "type": "array",
361
+ "items": {
362
+ "type": "string",
363
+ "enum": [
364
+ "debug",
365
+ "info",
366
+ "warn",
367
+ "error"
368
+ ]
369
+ },
370
+ "default": [
371
+ "warn",
372
+ "error"
373
+ ]
374
+ },
375
+ "enableMetrics": {
376
+ "type": "boolean",
377
+ "default": true
378
+ },
379
+ "tracesSampleRate": {
380
+ "type": "number",
381
+ "minimum": 0,
382
+ "maximum": 1,
383
+ "default": 0.1
384
+ },
385
+ "profileSessionSampleRate": {
386
+ "type": "number",
387
+ "minimum": 0,
388
+ "maximum": 1,
389
+ "default": 0
390
+ },
391
+ "sendDefaultPii": {
392
+ "type": "boolean",
393
+ "default": false
394
+ }
395
+ }
396
+ },
397
+ "sockethub": {
398
+ "type": "object",
399
+ "additionalProperties": false,
400
+ "properties": {
401
+ "port": {
402
+ "type": "number",
403
+ "default": 10550
404
+ },
405
+ "host": {
406
+ "type": "string",
407
+ "default": "localhost"
408
+ },
409
+ "path": {
410
+ "type": "string",
411
+ "default": "/sockethub"
412
+ },
413
+ "maxPayloadBytes": {
414
+ "type": "integer",
415
+ "minimum": 1,
416
+ "default": 262144,
417
+ "description": "Maximum size in bytes of a single Socket.IO message."
418
+ },
419
+ "trustProxy": {
420
+ "type": [
421
+ "boolean",
422
+ "number",
423
+ "string"
424
+ ],
425
+ "default": false,
426
+ "description": "Express 'trust proxy' setting, deciding whether 'x-forwarded-for' is believed when determining a client's IP for HTTP rate limiting. false trusts no proxy; a number trusts that many hops; a string takes an address, subnet or preset ('loopback'). Only enable behind a reverse proxy that overwrites the header. When left false while credentialCheck.reconnectIpSource is 'proxy' and credentialCheck.proxyHeader is 'x-forwarded-for', one hop is trusted so both paths agree; a custom proxyHeader requires setting this explicitly."
427
+ },
428
+ "cors": {
429
+ "type": "object",
430
+ "additionalProperties": false,
431
+ "properties": {
432
+ "origin": {
433
+ "type": "string",
434
+ "default": "*",
435
+ "description": "Allowed CORS origin(s) for socket.io connections and the HTTP actions endpoint. '*' allows any website to connect visitors' browsers to this instance; public deployments should set an explicit origin or comma-separated list of origins."
436
+ }
437
+ }
438
+ }
439
+ }
440
+ },
441
+ "httpActions": {
442
+ "type": "object",
443
+ "additionalProperties": false,
444
+ "properties": {
445
+ "enabled": {
446
+ "type": "boolean",
447
+ "default": false,
448
+ "description": "Enable the HTTP actions endpoint"
449
+ },
450
+ "path": {
451
+ "type": "string",
452
+ "default": "/sockethub-http"
453
+ },
454
+ "requireRequestId": {
455
+ "type": "boolean",
456
+ "default": true
457
+ },
458
+ "maxMessagesPerRequest": {
459
+ "type": "number",
460
+ "minimum": 1,
461
+ "default": 20
462
+ },
463
+ "maxPayloadBytes": {
464
+ "type": "number",
465
+ "minimum": 1,
466
+ "default": 262144
467
+ },
468
+ "idempotencyTtlMs": {
469
+ "type": "number",
470
+ "minimum": 0,
471
+ "default": 300000
472
+ },
473
+ "requestTimeoutMs": {
474
+ "type": "number",
475
+ "minimum": 0,
476
+ "default": 30000
477
+ },
478
+ "idleTimeoutMs": {
479
+ "type": "number",
480
+ "minimum": 0,
481
+ "default": 15000
482
+ }
483
+ }
484
+ },
485
+ "platformHeartbeat": {
486
+ "type": "object",
487
+ "additionalProperties": false,
488
+ "properties": {
489
+ "intervalMs": {
490
+ "type": "number",
491
+ "default": 5000
492
+ },
493
+ "timeoutMs": {
494
+ "type": "number",
495
+ "default": 15000
496
+ }
497
+ }
498
+ }
499
+ }
500
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "required": [
3
+ "object"
4
+ ],
5
+ "properties": {
6
+ "object": {
7
+ "oneOf": [
8
+ {
9
+ "type": "object",
10
+ "required": [
11
+ "type",
12
+ "url",
13
+ "username",
14
+ "password"
15
+ ],
16
+ "additionalProperties": false,
17
+ "properties": {
18
+ "type": {
19
+ "enum": [
20
+ "credentials"
21
+ ]
22
+ },
23
+ "url": {
24
+ "type": "string",
25
+ "format": "uri",
26
+ "pattern": "^https?://",
27
+ "maxLength": 4096
28
+ },
29
+ "username": {
30
+ "type": "string",
31
+ "minLength": 1,
32
+ "maxLength": 1024
33
+ },
34
+ "password": {
35
+ "type": "string",
36
+ "minLength": 1,
37
+ "maxLength": 4096
38
+ }
39
+ }
40
+ },
41
+ {
42
+ "type": "object",
43
+ "required": [
44
+ "type",
45
+ "url",
46
+ "token"
47
+ ],
48
+ "additionalProperties": false,
49
+ "properties": {
50
+ "type": {
51
+ "enum": [
52
+ "credentials"
53
+ ]
54
+ },
55
+ "url": {
56
+ "type": "string",
57
+ "format": "uri",
58
+ "pattern": "^https?://",
59
+ "maxLength": 4096
60
+ },
61
+ "token": {
62
+ "type": "string",
63
+ "minLength": 1,
64
+ "maxLength": 8192
65
+ }
66
+ }
67
+ }
68
+ ]
69
+ }
70
+ }
71
+ }