@sockethub/server 5.0.0-alpha.4 → 5.0.0-alpha.6

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 (105) hide show
  1. package/README.md +54 -60
  2. package/bin/sockethub +4 -3
  3. package/package.json +42 -54
  4. package/res/socket.io.js +4908 -0
  5. package/res/sockethub-client.js +602 -0
  6. package/res/sockethub-client.min.js +19 -0
  7. package/sockethub.config.example.json +2 -3
  8. package/src/bootstrap/init.d.ts +16 -13
  9. package/src/bootstrap/init.test.ts +211 -0
  10. package/src/bootstrap/init.ts +152 -76
  11. package/src/bootstrap/load-platforms.ts +151 -0
  12. package/src/config.test.ts +27 -22
  13. package/src/config.ts +82 -86
  14. package/src/defaults.json +24 -16
  15. package/src/index.ts +61 -22
  16. package/src/janitor.test.ts +191 -169
  17. package/src/janitor.ts +141 -118
  18. package/src/listener.ts +148 -58
  19. package/src/middleware/create-activity-object.test.ts +28 -8
  20. package/src/middleware/create-activity-object.ts +16 -10
  21. package/src/middleware/expand-activity-stream.test.data.ts +331 -345
  22. package/src/middleware/expand-activity-stream.test.ts +65 -66
  23. package/src/middleware/expand-activity-stream.ts +26 -21
  24. package/src/middleware/store-credentials.test.ts +74 -60
  25. package/src/middleware/store-credentials.ts +14 -8
  26. package/src/middleware/validate.test.data.ts +240 -242
  27. package/src/middleware/validate.test.ts +39 -78
  28. package/src/middleware/validate.ts +62 -36
  29. package/src/middleware.test.ts +168 -138
  30. package/src/middleware.ts +57 -55
  31. package/src/platform-instance.test.ts +508 -214
  32. package/src/platform-instance.ts +324 -231
  33. package/src/platform.test.ts +375 -0
  34. package/src/platform.ts +306 -117
  35. package/src/process-manager.ts +75 -51
  36. package/src/routes.test.ts +43 -89
  37. package/src/routes.ts +40 -78
  38. package/src/sentry.test.ts +106 -0
  39. package/src/sentry.ts +19 -0
  40. package/src/sockethub.ts +190 -129
  41. package/src/util.ts +5 -0
  42. package/coverage/tmp/coverage-39338-1663949520416-0.json +0 -1
  43. package/dist/bootstrap/init.d.ts +0 -18
  44. package/dist/bootstrap/init.js +0 -64
  45. package/dist/bootstrap/init.js.map +0 -1
  46. package/dist/bootstrap/platforms.js +0 -75
  47. package/dist/config.d.ts +0 -12
  48. package/dist/config.js +0 -107
  49. package/dist/config.js.map +0 -1
  50. package/dist/defaults.json +0 -28
  51. package/dist/index.d.ts +0 -1
  52. package/dist/index.js +0 -29
  53. package/dist/index.js.map +0 -1
  54. package/dist/janitor.d.ts +0 -30
  55. package/dist/janitor.js +0 -120
  56. package/dist/janitor.js.map +0 -1
  57. package/dist/listener.d.ts +0 -31
  58. package/dist/listener.js +0 -94
  59. package/dist/listener.js.map +0 -1
  60. package/dist/middleware/create-activity-object.d.ts +0 -8
  61. package/dist/middleware/create-activity-object.js +0 -19
  62. package/dist/middleware/create-activity-object.js.map +0 -1
  63. package/dist/middleware/expand-activity-stream.d.ts +0 -3
  64. package/dist/middleware/expand-activity-stream.js +0 -36
  65. package/dist/middleware/expand-activity-stream.js.map +0 -1
  66. package/dist/middleware/expand-activity-stream.test.data.d.ts +0 -480
  67. package/dist/middleware/expand-activity-stream.test.data.js +0 -360
  68. package/dist/middleware/expand-activity-stream.test.data.js.map +0 -1
  69. package/dist/middleware/store-credentials.d.ts +0 -3
  70. package/dist/middleware/store-credentials.js +0 -9
  71. package/dist/middleware/store-credentials.js.map +0 -1
  72. package/dist/middleware/validate.d.ts +0 -2
  73. package/dist/middleware/validate.js +0 -56
  74. package/dist/middleware/validate.js.map +0 -1
  75. package/dist/middleware/validate.test.data.d.ts +0 -532
  76. package/dist/middleware/validate.test.data.js +0 -263
  77. package/dist/middleware/validate.test.data.js.map +0 -1
  78. package/dist/middleware.d.ts +0 -21
  79. package/dist/middleware.js +0 -56
  80. package/dist/middleware.js.map +0 -1
  81. package/dist/platform-instance.d.ts +0 -78
  82. package/dist/platform-instance.js +0 -226
  83. package/dist/platform-instance.js.map +0 -1
  84. package/dist/platform.d.ts +0 -6
  85. package/dist/platform.js +0 -176
  86. package/dist/platform.js.map +0 -1
  87. package/dist/process-manager.d.ts +0 -11
  88. package/dist/process-manager.js +0 -82
  89. package/dist/process-manager.js.map +0 -1
  90. package/dist/routes.d.ts +0 -13
  91. package/dist/routes.js +0 -83
  92. package/dist/routes.js.map +0 -1
  93. package/dist/sockethub.d.ts +0 -18
  94. package/dist/sockethub.js +0 -112
  95. package/dist/sockethub.js.map +0 -1
  96. package/src/bootstrap/platforms.js +0 -75
  97. package/test/init-suite.js +0 -41
  98. package/test/sockethub-suite.js +0 -25
  99. package/tsconfig.json +0 -18
  100. package/views/examples/dummy.ejs +0 -95
  101. package/views/examples/feeds.ejs +0 -90
  102. package/views/examples/irc.ejs +0 -239
  103. package/views/examples/shared.js +0 -72
  104. package/views/examples/xmpp.ejs +0 -217
  105. package/views/index.ejs +0 -17
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const activity_streams_1 = __importDefault(require("@sockethub/activity-streams"));
7
- const config_1 = __importDefault(require("../config"));
8
- const activity = (0, activity_streams_1.default)(config_1.default.get('activity-streams:opts'));
9
- /**
10
- * A simple middleware wrapper for the activity-streams Object.create method.
11
- * @param obj
12
- * @param done
13
- */
14
- function createActivityObject(obj, done) {
15
- activity.Object.create(obj);
16
- done(obj);
17
- }
18
- exports.default = createActivityObject;
19
- //# sourceMappingURL=/middleware/create-activity-object.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create-activity-object.js","sourceRoot":"/","sources":["middleware/create-activity-object.ts"],"names":[],"mappings":";;;;;AAAA,mFAA0D;AAC1D,uDAA+B;AAG/B,MAAM,QAAQ,GAAG,IAAA,0BAAe,EAAC,gBAAM,CAAC,GAAG,CAAC,uBAAuB,CAAC,CAAC,CAAC;AAEtE;;;;GAIG;AACH,SAAwB,oBAAoB,CAAC,GAAoB,EACpB,IAA8B;IACzE,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5B,IAAI,CAAC,GAAG,CAAC,CAAC;AACZ,CAAC;AAJD,uCAIC"}
@@ -1,3 +0,0 @@
1
- import { IActivityStream } from "@sockethub/schemas";
2
- import { MiddlewareChainInterface } from "../middleware";
3
- export default function expandActivityStream(msg: IActivityStream, done: MiddlewareChainInterface): void;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const activity_streams_1 = __importDefault(require("@sockethub/activity-streams"));
7
- const config_1 = __importDefault(require("../config"));
8
- const asConfig = config_1.default.get('activity-streams:opts');
9
- asConfig.warnOnUnknownObjectProperties = false;
10
- asConfig.failOnUnknownObjectProperties = false;
11
- const activity = (0, activity_streams_1.default)(asConfig);
12
- function ensureObject(msg) {
13
- return !((typeof msg !== 'object') || (Array.isArray(msg)));
14
- }
15
- function expandActivityStream(msg, done) {
16
- if (!ensureObject(msg)) {
17
- done(new Error(`message received is not an object.`));
18
- }
19
- else if (typeof msg.context !== 'string') {
20
- done(new Error('activity stream must contain a context property'));
21
- }
22
- else if (typeof msg.type !== 'string') {
23
- done(new Error('activity stream must contain a type property.'));
24
- }
25
- else {
26
- msg = activity.Stream(msg);
27
- if (!msg.actor) {
28
- done(new Error('activity stream must contain an actor property.'));
29
- }
30
- else {
31
- done(msg);
32
- }
33
- }
34
- }
35
- exports.default = expandActivityStream;
36
- //# sourceMappingURL=/middleware/expand-activity-stream.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"expand-activity-stream.js","sourceRoot":"/","sources":["middleware/expand-activity-stream.ts"],"names":[],"mappings":";;;;;AAAA,mFAA0D;AAG1D,uDAA8D;AAG9D,MAAM,QAAQ,GAAG,gBAAM,CAAC,GAAG,CAAC,uBAAuB,CAAgC,CAAC;AACpF,QAAQ,CAAC,6BAA6B,GAAG,KAAK,CAAC;AAC/C,QAAQ,CAAC,6BAA6B,GAAG,KAAK,CAAC;AAC/C,MAAM,QAAQ,GAAG,IAAA,0BAAe,EAAC,QAAQ,CAAC,CAAC;AAE3C,SAAS,YAAY,CAAC,GAAY;IAChC,OAAO,CAAC,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC9D,CAAC;AAED,SAAwB,oBAAoB,CAAC,GAAoB,EACpB,IAA8B;IACzE,IAAI,CAAE,YAAY,CAAC,GAAG,CAAC,EAAE;QACvB,IAAI,CAAC,IAAI,KAAK,CAAC,oCAAoC,CAAC,CAAC,CAAC;KACvD;SAAM,IAAI,OAAO,GAAG,CAAC,OAAO,KAAK,QAAQ,EAAE;QAC1C,IAAI,CAAC,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC,CAAC;KACpE;SAAM,IAAI,OAAO,GAAG,CAAC,IAAI,KAAK,QAAQ,EAAE;QACvC,IAAI,CAAC,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC,CAAC;KAClE;SAAM;QACL,GAAG,GAAG,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC3B,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE;YACd,IAAI,CAAC,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC,CAAC;SACpE;aAAM;YACL,IAAI,CAAC,GAAG,CAAC,CAAC;SACX;KACF;AACH,CAAC;AAhBD,uCAgBC"}
@@ -1,480 +0,0 @@
1
- declare const _default: ({
2
- name: string;
3
- valid: boolean;
4
- type: string;
5
- input: string;
6
- error: string;
7
- output?: undefined;
8
- } | {
9
- name: string;
10
- valid: boolean;
11
- type: string;
12
- input: {
13
- id: string;
14
- type: string;
15
- context: string;
16
- actor: {
17
- id: string;
18
- type: string;
19
- name: string;
20
- image?: undefined;
21
- url?: undefined;
22
- };
23
- target: {
24
- id: string;
25
- type: string;
26
- name: string;
27
- };
28
- object: {
29
- type: string;
30
- nick?: undefined;
31
- port?: undefined;
32
- secure?: undefined;
33
- server?: undefined;
34
- username?: undefined;
35
- password?: undefined;
36
- resource?: undefined;
37
- content?: undefined;
38
- };
39
- string?: undefined;
40
- array?: undefined;
41
- as?: undefined;
42
- noId?: undefined;
43
- noId2?: undefined;
44
- noDisplayName?: undefined;
45
- };
46
- output: string;
47
- error?: undefined;
48
- } | {
49
- name: string;
50
- valid: boolean;
51
- type: string;
52
- input: {
53
- type: string;
54
- context: string;
55
- actor: {
56
- id: string;
57
- type: string;
58
- name: string;
59
- image: {
60
- height: number;
61
- mediaType: string;
62
- url: string;
63
- width: number;
64
- };
65
- url: string;
66
- };
67
- object: {
68
- type: string;
69
- nick: string;
70
- port: number;
71
- secure: boolean;
72
- server: string;
73
- username?: undefined;
74
- password?: undefined;
75
- resource?: undefined;
76
- content?: undefined;
77
- };
78
- id?: undefined;
79
- target?: undefined;
80
- string?: undefined;
81
- array?: undefined;
82
- as?: undefined;
83
- noId?: undefined;
84
- noId2?: undefined;
85
- noDisplayName?: undefined;
86
- };
87
- output: string;
88
- error?: undefined;
89
- } | {
90
- name: string;
91
- valid: boolean;
92
- type: string;
93
- input: {
94
- actor: string;
95
- context: string;
96
- object: {
97
- username: string;
98
- password: string;
99
- server: string;
100
- port: number;
101
- resource: string;
102
- type?: undefined;
103
- nick?: undefined;
104
- secure?: undefined;
105
- content?: undefined;
106
- };
107
- id?: undefined;
108
- type?: undefined;
109
- target?: undefined;
110
- string?: undefined;
111
- array?: undefined;
112
- as?: undefined;
113
- noId?: undefined;
114
- noId2?: undefined;
115
- noDisplayName?: undefined;
116
- };
117
- error: string;
118
- output?: undefined;
119
- } | {
120
- name: string;
121
- type: string;
122
- valid: string;
123
- input: {
124
- context: string;
125
- type: string;
126
- actor: string;
127
- object: {
128
- content: string;
129
- type?: undefined;
130
- nick?: undefined;
131
- port?: undefined;
132
- secure?: undefined;
133
- server?: undefined;
134
- username?: undefined;
135
- password?: undefined;
136
- resource?: undefined;
137
- };
138
- id?: undefined;
139
- target?: undefined;
140
- string?: undefined;
141
- array?: undefined;
142
- as?: undefined;
143
- noId?: undefined;
144
- noId2?: undefined;
145
- noDisplayName?: undefined;
146
- };
147
- output: {
148
- context: string;
149
- type: string;
150
- actor: {
151
- id: string;
152
- type?: undefined;
153
- name?: undefined;
154
- hello?: undefined;
155
- i?: undefined;
156
- image?: undefined;
157
- url?: undefined;
158
- };
159
- object: {
160
- content: string;
161
- };
162
- target?: undefined;
163
- };
164
- error?: undefined;
165
- } | {
166
- name: string;
167
- type: string;
168
- valid: boolean;
169
- input: {
170
- context: string;
171
- type: string;
172
- actor: string;
173
- object: {
174
- type?: undefined;
175
- nick?: undefined;
176
- port?: undefined;
177
- secure?: undefined;
178
- server?: undefined;
179
- username?: undefined;
180
- password?: undefined;
181
- resource?: undefined;
182
- content?: undefined;
183
- };
184
- id?: undefined;
185
- target?: undefined;
186
- string?: undefined;
187
- array?: undefined;
188
- as?: undefined;
189
- noId?: undefined;
190
- noId2?: undefined;
191
- noDisplayName?: undefined;
192
- };
193
- output: {
194
- context: string;
195
- type: string;
196
- actor: {
197
- id: string;
198
- type: string;
199
- name: string;
200
- hello?: undefined;
201
- i?: undefined;
202
- image?: undefined;
203
- url?: undefined;
204
- };
205
- object: {
206
- content?: undefined;
207
- };
208
- target?: undefined;
209
- };
210
- error?: undefined;
211
- } | {
212
- name: string;
213
- valid: boolean;
214
- type: string;
215
- input: {
216
- context: string;
217
- type: string;
218
- actor: string;
219
- object: {
220
- type?: undefined;
221
- nick?: undefined;
222
- port?: undefined;
223
- secure?: undefined;
224
- server?: undefined;
225
- username?: undefined;
226
- password?: undefined;
227
- resource?: undefined;
228
- content?: undefined;
229
- };
230
- id?: undefined;
231
- target?: undefined;
232
- string?: undefined;
233
- array?: undefined;
234
- as?: undefined;
235
- noId?: undefined;
236
- noId2?: undefined;
237
- noDisplayName?: undefined;
238
- };
239
- output: {
240
- context: string;
241
- type: string;
242
- actor: {
243
- id: string;
244
- type: string;
245
- name: string;
246
- hello: string;
247
- i: string[];
248
- image?: undefined;
249
- url?: undefined;
250
- };
251
- object: {
252
- content?: undefined;
253
- };
254
- target?: undefined;
255
- };
256
- error?: undefined;
257
- } | {
258
- name: string;
259
- valid: boolean;
260
- type: string;
261
- input: {
262
- string: string;
263
- array: (string | {
264
- an: string;
265
- })[];
266
- as: {
267
- id: string;
268
- type: string;
269
- context: string;
270
- actor: {
271
- name: string;
272
- };
273
- target: {
274
- type: string;
275
- name: string;
276
- };
277
- object: {
278
- type: string;
279
- };
280
- };
281
- noId: {
282
- name: string;
283
- };
284
- noId2: {
285
- type: string;
286
- name: string;
287
- };
288
- noDisplayName: {
289
- id: string;
290
- };
291
- id?: undefined;
292
- type?: undefined;
293
- context?: undefined;
294
- actor?: undefined;
295
- target?: undefined;
296
- object?: undefined;
297
- };
298
- error: string;
299
- output?: undefined;
300
- } | {
301
- name: string;
302
- valid: boolean;
303
- type: string;
304
- input: {
305
- type: string;
306
- context: string;
307
- object: {
308
- type: string;
309
- content: string;
310
- nick?: undefined;
311
- port?: undefined;
312
- secure?: undefined;
313
- server?: undefined;
314
- username?: undefined;
315
- password?: undefined;
316
- resource?: undefined;
317
- };
318
- id?: undefined;
319
- actor?: undefined;
320
- target?: undefined;
321
- string?: undefined;
322
- array?: undefined;
323
- as?: undefined;
324
- noId?: undefined;
325
- noId2?: undefined;
326
- noDisplayName?: undefined;
327
- };
328
- error: string;
329
- output?: undefined;
330
- } | {
331
- name: string;
332
- valid: boolean;
333
- type: string;
334
- input: {
335
- actor: string;
336
- type: string;
337
- context: string;
338
- target: string;
339
- id?: undefined;
340
- object?: undefined;
341
- string?: undefined;
342
- array?: undefined;
343
- as?: undefined;
344
- noId?: undefined;
345
- noId2?: undefined;
346
- noDisplayName?: undefined;
347
- };
348
- output: {
349
- actor: {
350
- id: string;
351
- type?: undefined;
352
- name?: undefined;
353
- hello?: undefined;
354
- i?: undefined;
355
- image?: undefined;
356
- url?: undefined;
357
- };
358
- type: string;
359
- context: string;
360
- target: {
361
- id: string;
362
- type?: undefined;
363
- name?: undefined;
364
- hello?: undefined;
365
- i?: undefined;
366
- };
367
- object?: undefined;
368
- };
369
- error?: undefined;
370
- } | {
371
- name: string;
372
- valid: boolean;
373
- type: string;
374
- input: {
375
- actor: string;
376
- type: string;
377
- context: string;
378
- object: {
379
- type?: undefined;
380
- nick?: undefined;
381
- port?: undefined;
382
- secure?: undefined;
383
- server?: undefined;
384
- username?: undefined;
385
- password?: undefined;
386
- resource?: undefined;
387
- content?: undefined;
388
- };
389
- target: string;
390
- id?: undefined;
391
- string?: undefined;
392
- array?: undefined;
393
- as?: undefined;
394
- noId?: undefined;
395
- noId2?: undefined;
396
- noDisplayName?: undefined;
397
- };
398
- output: {
399
- actor: {
400
- id: string;
401
- type?: undefined;
402
- name?: undefined;
403
- hello?: undefined;
404
- i?: undefined;
405
- image?: undefined;
406
- url?: undefined;
407
- };
408
- type: string;
409
- context: string;
410
- object: {
411
- content?: undefined;
412
- };
413
- target: {
414
- id: string;
415
- type?: undefined;
416
- name?: undefined;
417
- hello?: undefined;
418
- i?: undefined;
419
- };
420
- };
421
- error?: undefined;
422
- } | {
423
- name: string;
424
- valid: boolean;
425
- type: string;
426
- input: {
427
- actor: string;
428
- target: string;
429
- type: string;
430
- context: string;
431
- object: {
432
- type?: undefined;
433
- nick?: undefined;
434
- port?: undefined;
435
- secure?: undefined;
436
- server?: undefined;
437
- username?: undefined;
438
- password?: undefined;
439
- resource?: undefined;
440
- content?: undefined;
441
- };
442
- id?: undefined;
443
- string?: undefined;
444
- array?: undefined;
445
- as?: undefined;
446
- noId?: undefined;
447
- noId2?: undefined;
448
- noDisplayName?: undefined;
449
- };
450
- output: {
451
- actor: {
452
- id: string;
453
- type: string;
454
- name: string;
455
- image: {
456
- height: number;
457
- mediaType: string;
458
- url: string;
459
- width: number;
460
- };
461
- url: string;
462
- hello?: undefined;
463
- i?: undefined;
464
- };
465
- target: {
466
- id: string;
467
- type: string;
468
- name: string;
469
- hello: string;
470
- i: string[];
471
- };
472
- type: string;
473
- context: string;
474
- object: {
475
- content?: undefined;
476
- };
477
- };
478
- error?: undefined;
479
- })[];
480
- export default _default;