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

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 +235 -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 +316 -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,236 +0,0 @@
1
- {
2
- "$id": "https://sockethub.org/schemas/3.0.0-alpha.12/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
- },
17
- "logging": {
18
- "type": "object",
19
- "additionalProperties": false,
20
- "properties": {
21
- "level": {
22
- "type": "string",
23
- "enum": [
24
- "error",
25
- "warn",
26
- "info",
27
- "debug"
28
- ],
29
- "default": "info"
30
- },
31
- "fileLevel": {
32
- "type": "string",
33
- "enum": [
34
- "error",
35
- "warn",
36
- "info",
37
- "debug"
38
- ],
39
- "default": "debug"
40
- },
41
- "file": {
42
- "type": "string",
43
- "default": "sockethub.log"
44
- }
45
- }
46
- },
47
- "packageConfig": {
48
- "type": "object",
49
- "properties": {
50
- "@sockethub/activity-streams": {
51
- "type": "object",
52
- "additionalProperties": false,
53
- "properties": {
54
- "specialObjs": {
55
- "type": "array",
56
- "items": {
57
- "type": "string"
58
- },
59
- "default": [
60
- "credentials"
61
- ]
62
- },
63
- "failOnUnknownObjectProperties": {
64
- "type": "boolean",
65
- "default": true
66
- }
67
- }
68
- },
69
- "@sockethub/platform-dummy": {
70
- "type": "object",
71
- "additionalProperties": false,
72
- "properties": {
73
- "greeting": {
74
- "type": "string",
75
- "default": "Hello"
76
- }
77
- }
78
- },
79
- "@sockethub/platform-feeds": {
80
- "type": "object",
81
- "additionalProperties": false,
82
- "properties": {
83
- "connectTimeoutMs": {
84
- "type": "number"
85
- }
86
- }
87
- },
88
- "@sockethub/platform-irc": {
89
- "type": "object",
90
- "additionalProperties": false,
91
- "properties": {
92
- "connectTimeoutMs": {
93
- "type": "number"
94
- }
95
- }
96
- },
97
- "@sockethub/platform-xmpp": {
98
- "type": "object",
99
- "additionalProperties": false,
100
- "properties": {
101
- "connectTimeoutMs": {
102
- "type": "number"
103
- }
104
- }
105
- }
106
- }
107
- },
108
- "platforms": {
109
- "type": "array",
110
- "items": {
111
- "type": "string"
112
- },
113
- "default": [
114
- "@sockethub/platform-dummy",
115
- "@sockethub/platform-feeds",
116
- "@sockethub/platform-irc",
117
- "@sockethub/platform-metadata",
118
- "@sockethub/platform-xmpp"
119
- ]
120
- },
121
- "public": {
122
- "type": "object",
123
- "additionalProperties": false,
124
- "properties": {
125
- "protocol": {
126
- "type": "string",
127
- "default": "http"
128
- },
129
- "host": {
130
- "type": "string",
131
- "default": "localhost"
132
- },
133
- "port": {
134
- "type": "number",
135
- "default": 10550
136
- },
137
- "path": {
138
- "type": "string",
139
- "default": "/"
140
- }
141
- }
142
- },
143
- "rateLimiter": {
144
- "type": "object",
145
- "additionalProperties": false,
146
- "properties": {
147
- "windowMs": {
148
- "type": "number",
149
- "default": 1000
150
- },
151
- "maxRequests": {
152
- "type": "number",
153
- "default": 100
154
- },
155
- "blockDurationMs": {
156
- "type": "number",
157
- "default": 5000
158
- }
159
- }
160
- },
161
- "redis": {
162
- "type": "object",
163
- "additionalProperties": false,
164
- "properties": {
165
- "url": {
166
- "type": "string",
167
- "default": "redis://127.0.0.1:6379"
168
- },
169
- "connectTimeout": {
170
- "type": "number",
171
- "default": 10000,
172
- "description": "Connection timeout in milliseconds"
173
- },
174
- "disconnectTimeout": {
175
- "type": "number",
176
- "default": 5000,
177
- "description": "Disconnect timeout in milliseconds"
178
- },
179
- "maxRetriesPerRequest": {
180
- "type": [
181
- "number",
182
- "null"
183
- ],
184
- "default": null,
185
- "description": "Maximum number of retries per request (null for BullMQ default)"
186
- }
187
- }
188
- },
189
- "sentry": {
190
- "type": "object",
191
- "additionalProperties": false,
192
- "properties": {
193
- "dsn": {
194
- "type": "string",
195
- "default": ""
196
- },
197
- "traceSampleRate": {
198
- "type": "number",
199
- "default": 1
200
- }
201
- }
202
- },
203
- "sockethub": {
204
- "type": "object",
205
- "additionalProperties": false,
206
- "properties": {
207
- "port": {
208
- "type": "number",
209
- "default": 10550
210
- },
211
- "host": {
212
- "type": "string",
213
- "default": "localhost"
214
- },
215
- "path": {
216
- "type": "string",
217
- "default": "/sockethub"
218
- }
219
- }
220
- },
221
- "platformHeartbeat": {
222
- "type": "object",
223
- "additionalProperties": false,
224
- "properties": {
225
- "intervalMs": {
226
- "type": "number",
227
- "default": 5000
228
- },
229
- "timeoutMs": {
230
- "type": "number",
231
- "default": 15000
232
- }
233
- }
234
- }
235
- }
236
- }
@@ -1,71 +0,0 @@
1
- /**
2
- * This file is part of Sockethub.
3
- *
4
- * Developed by Nick Jennings (https://github.com/silverbucket)
5
- *
6
- * server is licensed under the LGPL.
7
- * See the LICENSE file for details.
8
- *
9
- * The latest version of server can be found here:
10
- * git://github.com/sockethub/sockethub.git
11
- *
12
- * For more information about Sockethub visit https://sockethub.org/.
13
- *
14
- * This program is distributed in the hope that it will be useful,
15
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
- */
18
-
19
- // this schema defines the general structure of the schema object which should
20
- // be returned from platforms.
21
- export const PlatformSchema = {
22
- $id: "https://sockethub.org/schemas/v/platform.json",
23
- type: "object",
24
- required: [
25
- "name",
26
- "version",
27
- "messages",
28
- "contextUrl",
29
- "contextVersion",
30
- "schemaVersion",
31
- ],
32
- additionalProperties: false,
33
- properties: {
34
- contextUrl: {
35
- title: "contextUrl",
36
- type: "string",
37
- format: "uri",
38
- },
39
- contextVersion: {
40
- title: "contextVersion",
41
- type: "string",
42
- },
43
- schemaVersion: {
44
- title: "schemaVersion",
45
- type: "string",
46
- },
47
- messageConstraints: {
48
- title: "messageConstraints",
49
- type: "object",
50
- },
51
- credentials: {
52
- title: "credentials",
53
- type: "object",
54
- },
55
-
56
- messages: {
57
- title: "messages",
58
- type: "object",
59
- },
60
-
61
- name: {
62
- title: "name",
63
- type: "string",
64
- },
65
-
66
- version: {
67
- title: "version",
68
- type: "string",
69
- },
70
- },
71
- };
@@ -1,220 +0,0 @@
1
- const connectConfigPlatforms = {
2
- connectTimeoutMs: {
3
- type: "number",
4
- },
5
- };
6
-
7
- export const SockethubConfigSchema = {
8
- $id: "https://sockethub.org/schemas/v/sockethub-config.json",
9
- description: "Sockethub Config Schema",
10
- type: "object",
11
- required: ["platforms"],
12
- additionalProperties: false,
13
- properties: {
14
- $schema: {
15
- type: "string",
16
- },
17
- examples: {
18
- type: "boolean",
19
- default: true,
20
- },
21
- logging: {
22
- type: "object",
23
- additionalProperties: false,
24
- properties: {
25
- level: {
26
- type: "string",
27
- enum: ["error", "warn", "info", "debug"],
28
- default: "info",
29
- },
30
- fileLevel: {
31
- type: "string",
32
- enum: ["error", "warn", "info", "debug"],
33
- default: "debug",
34
- },
35
- file: {
36
- type: "string",
37
- default: "sockethub.log",
38
- },
39
- },
40
- },
41
- packageConfig: {
42
- type: "object",
43
- properties: {
44
- "@sockethub/activity-streams": {
45
- type: "object",
46
- additionalProperties: false,
47
- properties: {
48
- specialObjs: {
49
- type: "array",
50
- items: {
51
- type: "string",
52
- },
53
- default: ["credentials"],
54
- },
55
- failOnUnknownObjectProperties: {
56
- type: "boolean",
57
- default: true,
58
- },
59
- },
60
- },
61
- "@sockethub/platform-dummy": {
62
- type: "object",
63
- additionalProperties: false,
64
- properties: {
65
- greeting: {
66
- type: "string",
67
- default: "Hello",
68
- },
69
- },
70
- },
71
- "@sockethub/platform-feeds": {
72
- type: "object",
73
- additionalProperties: false,
74
- properties: {
75
- ...connectConfigPlatforms,
76
- },
77
- },
78
- "@sockethub/platform-irc": {
79
- type: "object",
80
- additionalProperties: false,
81
- properties: {
82
- ...connectConfigPlatforms,
83
- },
84
- },
85
- "@sockethub/platform-xmpp": {
86
- type: "object",
87
- additionalProperties: false,
88
- properties: {
89
- ...connectConfigPlatforms,
90
- },
91
- },
92
- },
93
- },
94
- platforms: {
95
- type: "array",
96
- items: {
97
- type: "string",
98
- },
99
- default: [
100
- "@sockethub/platform-dummy",
101
- "@sockethub/platform-feeds",
102
- "@sockethub/platform-irc",
103
- "@sockethub/platform-metadata",
104
- "@sockethub/platform-xmpp",
105
- ],
106
- },
107
- public: {
108
- type: "object",
109
- additionalProperties: false,
110
- properties: {
111
- protocol: {
112
- type: "string",
113
- default: "http",
114
- },
115
- host: {
116
- type: "string",
117
- default: "localhost",
118
- },
119
- port: {
120
- type: "number",
121
- default: 10550,
122
- },
123
- path: {
124
- type: "string",
125
- default: "/",
126
- },
127
- },
128
- },
129
- rateLimiter: {
130
- type: "object",
131
- additionalProperties: false,
132
- properties: {
133
- windowMs: {
134
- type: "number",
135
- default: 1000,
136
- },
137
- maxRequests: {
138
- type: "number",
139
- default: 100,
140
- },
141
- blockDurationMs: {
142
- type: "number",
143
- default: 5000,
144
- },
145
- },
146
- },
147
- redis: {
148
- type: "object",
149
- additionalProperties: false,
150
- properties: {
151
- url: {
152
- type: "string",
153
- default: "redis://127.0.0.1:6379",
154
- },
155
- connectTimeout: {
156
- type: "number",
157
- default: 10000,
158
- description: "Connection timeout in milliseconds",
159
- },
160
- disconnectTimeout: {
161
- type: "number",
162
- default: 5000,
163
- description: "Disconnect timeout in milliseconds",
164
- },
165
- maxRetriesPerRequest: {
166
- type: ["number", "null"],
167
- default: null as number | null,
168
- description:
169
- "Maximum number of retries per request (null for BullMQ default)",
170
- },
171
- },
172
- },
173
- sentry: {
174
- type: "object",
175
- additionalProperties: false,
176
- properties: {
177
- dsn: {
178
- type: "string",
179
- default: "",
180
- },
181
- traceSampleRate: {
182
- type: "number",
183
- default: 1.0,
184
- },
185
- },
186
- },
187
- sockethub: {
188
- type: "object",
189
- additionalProperties: false,
190
- properties: {
191
- port: {
192
- type: "number",
193
- default: 10550,
194
- },
195
- host: {
196
- type: "string",
197
- default: "localhost",
198
- },
199
- path: {
200
- type: "string",
201
- default: "/sockethub",
202
- },
203
- },
204
- },
205
- platformHeartbeat: {
206
- type: "object",
207
- additionalProperties: false,
208
- properties: {
209
- intervalMs: {
210
- type: "number",
211
- default: 5000,
212
- },
213
- timeoutMs: {
214
- type: "number",
215
- default: 15000,
216
- },
217
- },
218
- },
219
- },
220
- };
@@ -1,5 +0,0 @@
1
- declare module "ajv-formats-draft2019" {
2
- import type Ajv from "ajv";
3
- const addFormats: (ajv: Ajv) => void;
4
- export default addFormats;
5
- }