@sockethub/schemas 3.0.0-beta.0 → 3.0.0-beta.1

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.
@@ -1,6 +1,6 @@
1
1
  {
2
- "schemaVersion": "3.0.0-beta.0",
3
- "generatedAt": "2026-10-12T13:04:34.157Z",
2
+ "schemaVersion": "3.0.0-beta.1",
3
+ "generatedAt": "2026-11-02T15:05:44.363Z",
4
4
  "contextToPlatformId": {
5
5
  "https://sockethub.org/ns/context/platform/caldav/v1.jsonld": "caldav",
6
6
  "https://sockethub.org/ns/context/platform/carddav/v1.jsonld": "carddav",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://sockethub.org/schemas/3.0.0-beta.0/activity-stream.json",
2
+ "$id": "https://sockethub.org/schemas/3.0.0-beta.1/activity-stream.json",
3
3
  "description": "Schema for Sockethub Activity Streams",
4
4
  "type": "object",
5
5
  "required": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://sockethub.org/schemas/3.0.0-beta.0/platform.json",
2
+ "$id": "https://sockethub.org/schemas/3.0.0-beta.1/platform.json",
3
3
  "type": "object",
4
4
  "required": [
5
5
  "name",
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://sockethub.org/schemas/3.0.0-beta.0/service-descriptor.json",
2
+ "$id": "https://sockethub.org/schemas/3.0.0-beta.1/service-descriptor.json",
3
3
  "description": "Sockethub service descriptor",
4
4
  "type": "object",
5
5
  "required": [
@@ -1,5 +1,5 @@
1
1
  {
2
- "$id": "https://sockethub.org/schemas/3.0.0-beta.0/sockethub-config.json",
2
+ "$id": "https://sockethub.org/schemas/3.0.0-beta.1/sockethub-config.json",
3
3
  "description": "Sockethub Config Schema",
4
4
  "type": "object",
5
5
  "required": [
@@ -202,6 +202,9 @@
202
202
  "properties": {
203
203
  "connectTimeoutMs": {
204
204
  "type": "number"
205
+ },
206
+ "allowPrivateAddresses": {
207
+ "type": "boolean"
205
208
  }
206
209
  }
207
210
  },
@@ -300,11 +303,23 @@
300
303
  "type": "object",
301
304
  "additionalProperties": false,
302
305
  "properties": {
306
+ "maxInstancesPerSession": {
307
+ "type": "integer",
308
+ "minimum": 0,
309
+ "default": 10,
310
+ "description": "Maximum persistent instances per socket session. 0 disables the cap."
311
+ },
312
+ "maxInstancesPerIp": {
313
+ "type": "integer",
314
+ "minimum": 0,
315
+ "default": 20,
316
+ "description": "Maximum persistent instances per client IP, including HTTP actions. 0 disables the cap."
317
+ },
303
318
  "maxPlatformInstances": {
304
319
  "type": "number",
305
320
  "minimum": 0,
306
321
  "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."
322
+ "description": "Upper bound on concurrently running persistent 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
323
  }
309
324
  }
310
325
  },
@@ -32,7 +32,9 @@
32
32
  "type": "string"
33
33
  },
34
34
  "port": {
35
- "type": "number"
35
+ "type": "integer",
36
+ "minimum": 1,
37
+ "maximum": 65535
36
38
  },
37
39
  "resource": {
38
40
  "type": "string"
@@ -180,6 +180,9 @@ export declare const SockethubConfigSchema: {
180
180
  connectTimeoutMs: {
181
181
  type: string;
182
182
  };
183
+ allowPrivateAddresses: {
184
+ type: string;
185
+ };
183
186
  };
184
187
  };
185
188
  "@sockethub/platform-metadata": {
@@ -274,6 +277,18 @@ export declare const SockethubConfigSchema: {
274
277
  type: string;
275
278
  additionalProperties: boolean;
276
279
  properties: {
280
+ maxInstancesPerSession: {
281
+ type: string;
282
+ minimum: number;
283
+ default: number;
284
+ description: string;
285
+ };
286
+ maxInstancesPerIp: {
287
+ type: string;
288
+ minimum: number;
289
+ default: number;
290
+ description: string;
291
+ };
277
292
  maxPlatformInstances: {
278
293
  type: string;
279
294
  minimum: number;
@@ -1,4 +1,9 @@
1
1
  import { type ServiceDescriptor, ServiceDescriptorSchema, type ServiceEndpoints } from "./schemas/service-descriptor.js";
2
+ /**
3
+ * Type guard for a server's service descriptor. Validates with Ajv when code
4
+ * generation is available and falls back to a structural check when a Content
5
+ * Security Policy blocks it.
6
+ */
2
7
  export declare function validateServiceDescriptor(descriptor: unknown): descriptor is ServiceDescriptor;
3
8
  export { ServiceDescriptorSchema };
4
9
  export type { ServiceDescriptor, ServiceEndpoints };
@@ -6222,6 +6222,28 @@ var require_ajv = __commonJS(function(exports, module) {
6222
6222
  // src/service-descriptor.ts
6223
6223
  var import_ajv = __toESM(require_ajv(), 1);
6224
6224
 
6225
+ // src/helpers/codegen.ts
6226
+ var available;
6227
+ var warned = false;
6228
+ function isCodegenAvailable() {
6229
+ if (available === undefined) {
6230
+ try {
6231
+ new Function("return true");
6232
+ available = true;
6233
+ } catch {
6234
+ available = false;
6235
+ }
6236
+ }
6237
+ return available;
6238
+ }
6239
+ function warnCodegenUnavailable() {
6240
+ if (warned) {
6241
+ return;
6242
+ }
6243
+ warned = true;
6244
+ console.warn("[@sockethub/schemas] Schema validation is disabled: this environment's Content Security Policy blocks `new Function`, which Ajv needs to compile schemas. The Sockethub server still validates every message.");
6245
+ }
6246
+
6225
6247
  // src/schemas/service-descriptor.ts
6226
6248
  var apiVersion = {
6227
6249
  type: "integer",
@@ -6266,15 +6288,68 @@ var ServiceDescriptorSchema = {
6266
6288
  };
6267
6289
 
6268
6290
  // src/service-descriptor.ts
6269
- var ajv = new import_ajv.default({ strictTypes: false, allErrors: true });
6291
+ var ajv;
6270
6292
  var validator;
6271
6293
  function validateServiceDescriptor(descriptor) {
6294
+ if (!isCodegenAvailable()) {
6295
+ warnCodegenUnavailable();
6296
+ return isServiceDescriptorShape(descriptor);
6297
+ }
6298
+ if (!ajv) {
6299
+ ajv = new import_ajv.default({ strictTypes: false, allErrors: true });
6300
+ }
6272
6301
  validator ??= ajv.compile(ServiceDescriptorSchema);
6273
6302
  return validator(descriptor);
6274
6303
  }
6304
+ function isServiceDescriptorShape(descriptor) {
6305
+ if (!descriptor || typeof descriptor !== "object") {
6306
+ return false;
6307
+ }
6308
+ const value = descriptor;
6309
+ if (value.name !== "sockethub") {
6310
+ return false;
6311
+ }
6312
+ if (!isApiVersion(value.apiVersion)) {
6313
+ return false;
6314
+ }
6315
+ if (!Array.isArray(value.platforms)) {
6316
+ return false;
6317
+ }
6318
+ for (const platform of value.platforms) {
6319
+ if (!platform || typeof platform !== "object") {
6320
+ return false;
6321
+ }
6322
+ const entry = platform;
6323
+ if (typeof entry.id !== "string" || entry.id.length === 0) {
6324
+ return false;
6325
+ }
6326
+ if (!isApiVersion(entry.apiVersion)) {
6327
+ return false;
6328
+ }
6329
+ }
6330
+ if (value.endpoints !== undefined) {
6331
+ if (!value.endpoints || typeof value.endpoints !== "object") {
6332
+ return false;
6333
+ }
6334
+ const endpoints = value.endpoints;
6335
+ if (!isAbsolutePath(endpoints.socketIO)) {
6336
+ return false;
6337
+ }
6338
+ if (endpoints.httpActions !== undefined && !isAbsolutePath(endpoints.httpActions)) {
6339
+ return false;
6340
+ }
6341
+ }
6342
+ return true;
6343
+ }
6344
+ function isApiVersion(value) {
6345
+ return typeof value === "number" && Number.isInteger(value) && value >= 0;
6346
+ }
6347
+ function isAbsolutePath(value) {
6348
+ return typeof value === "string" && /^\/(?![/\\])[^\s\\]*$/.test(value);
6349
+ }
6275
6350
  export {
6276
6351
  ServiceDescriptorSchema,
6277
6352
  validateServiceDescriptor
6278
6353
  };
6279
6354
 
6280
- //# debugId=80A2C8695850A8EE64756E2164756E21
6355
+ //# debugId=D62B42AEB54699FA64756E2164756E21