@sockethub/schemas 3.0.0-alpha.19 → 3.0.0-alpha.20

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.
@@ -131,6 +131,19 @@ export declare const ObjectTypesSchema: {
131
131
  };
132
132
  };
133
133
  };
134
+ addressBook: {
135
+ required: string[];
136
+ additionalProperties: boolean;
137
+ properties: {
138
+ id: {
139
+ type: string;
140
+ format: string;
141
+ };
142
+ type: {
143
+ enum: string[];
144
+ };
145
+ };
146
+ };
134
147
  };
135
148
  export declare const InternalObjectTypesList: string[];
136
149
  export declare const ObjectTypesList: string[];
package/dist/index.d.ts CHANGED
@@ -1,9 +1,11 @@
1
1
  import { AS2_BASE_CONTEXT_URL, buildCanonicalContext, ERROR_PLATFORM_CONTEXT_URL, ERROR_PLATFORM_ID, INTERNAL_PLATFORM_CONTEXT_URL, INTERNAL_PLATFORM_ID, PLATFORM_CONTEXT_PREFIX, platformIdFromContext, SOCKETHUB_BASE_CONTEXT_URL } from "./context.js";
2
+ import { type ExamplesConfig, ExamplesConfigSchema, validateExamplesConfig } from "./examples-config.js";
2
3
  import { InternalObjectTypesList, ObjectTypesList, ObjectTypesSchema } from "./helpers/objects.js";
3
4
  import { ActivityStreamSchema } from "./schemas/activity-stream.js";
4
5
  import { PlatformSchema } from "./schemas/platform.js";
5
6
  import { SockethubConfigSchema, SockethubConfigSchemaId } from "./schemas/sockethub-config.js";
6
7
  import { addPlatformContext, addPlatformSchema, getPlatformSchema, registerSystemPlatformContexts, resolvePlatformId, setValidationErrorOptions, validateActivityStream, validateActivityStreamResponse, validateCredentials, validatePlatformSchema, validateSockethubConfig } from "./validator.js";
7
8
  export { normalizeActivityStream } from "./activity-stream-helper.js";
8
- export { AS2_BASE_CONTEXT_URL, SOCKETHUB_BASE_CONTEXT_URL, PLATFORM_CONTEXT_PREFIX, ERROR_PLATFORM_ID, ERROR_PLATFORM_CONTEXT_URL, INTERNAL_PLATFORM_ID, INTERNAL_PLATFORM_CONTEXT_URL, buildCanonicalContext, platformIdFromContext, addPlatformContext, addPlatformSchema, getPlatformSchema, resolvePlatformId, registerSystemPlatformContexts, validatePlatformSchema, validateCredentials, validateActivityStream, validateActivityStreamResponse, validateSockethubConfig, setValidationErrorOptions, PlatformSchema, ActivityStreamSchema, SockethubConfigSchema, SockethubConfigSchemaId, ObjectTypesList, ObjectTypesSchema, InternalObjectTypesList, };
9
+ export { AS2_BASE_CONTEXT_URL, SOCKETHUB_BASE_CONTEXT_URL, PLATFORM_CONTEXT_PREFIX, ERROR_PLATFORM_ID, ERROR_PLATFORM_CONTEXT_URL, INTERNAL_PLATFORM_ID, INTERNAL_PLATFORM_CONTEXT_URL, buildCanonicalContext, platformIdFromContext, addPlatformContext, addPlatformSchema, getPlatformSchema, resolvePlatformId, registerSystemPlatformContexts, validatePlatformSchema, validateCredentials, validateActivityStream, validateActivityStreamResponse, validateExamplesConfig, validateSockethubConfig, setValidationErrorOptions, PlatformSchema, ExamplesConfigSchema, ActivityStreamSchema, SockethubConfigSchema, SockethubConfigSchemaId, ObjectTypesList, ObjectTypesSchema, InternalObjectTypesList, };
10
+ export type { ExamplesConfig };
9
11
  export * from "./types.js";
package/dist/index.js CHANGED
@@ -10356,7 +10356,7 @@ var require_core3 = __commonJS((exports) => {
10356
10356
  };
10357
10357
  }
10358
10358
 
10359
- class Ajv {
10359
+ class Ajv2 {
10360
10360
  constructor(opts = {}) {
10361
10361
  this.schemas = {};
10362
10362
  this.refs = {};
@@ -10713,9 +10713,9 @@ var require_core3 = __commonJS((exports) => {
10713
10713
  }
10714
10714
  }
10715
10715
  }
10716
- exports.default = Ajv;
10717
- Ajv.ValidationError = validation_error_1.default;
10718
- Ajv.MissingRefError = ref_error_1.default;
10716
+ exports.default = Ajv2;
10717
+ Ajv2.ValidationError = validation_error_1.default;
10718
+ Ajv2.MissingRefError = ref_error_1.default;
10719
10719
  function checkOptions(checkOpts, options, msg, log = "error") {
10720
10720
  for (const key in checkOpts) {
10721
10721
  const opt = key;
@@ -12676,7 +12676,7 @@ var require_ajv2 = __commonJS((exports, module) => {
12676
12676
  var META_SUPPORT_DATA = ["/properties"];
12677
12677
  var META_SCHEMA_ID = "http://json-schema.org/draft-07/schema";
12678
12678
 
12679
- class Ajv extends core_1.default {
12679
+ class Ajv2 extends core_1.default {
12680
12680
  _addVocabularies() {
12681
12681
  super._addVocabularies();
12682
12682
  draft7_1.default.forEach((v) => this.addVocabulary(v));
@@ -12695,9 +12695,9 @@ var require_ajv2 = __commonJS((exports, module) => {
12695
12695
  return this.opts.defaultMeta = super.defaultMeta() || (this.getSchema(META_SCHEMA_ID) ? META_SCHEMA_ID : undefined);
12696
12696
  }
12697
12697
  }
12698
- module.exports = exports = Ajv;
12698
+ module.exports = exports = Ajv2;
12699
12699
  Object.defineProperty(exports, "__esModule", { value: true });
12700
- exports.default = Ajv;
12700
+ exports.default = Ajv2;
12701
12701
  var validate_1 = require_validate2();
12702
12702
  Object.defineProperty(exports, "KeywordCxt", { enumerable: true, get: function() {
12703
12703
  return validate_1.KeywordCxt;
@@ -12793,9 +12793,9 @@ var require_limit = __commonJS((exports) => {
12793
12793
  },
12794
12794
  dependencies: ["format"]
12795
12795
  };
12796
- var formatLimitPlugin = (ajv) => {
12797
- ajv.addKeyword(exports.formatLimitDefinition);
12798
- return ajv;
12796
+ var formatLimitPlugin = (ajv2) => {
12797
+ ajv2.addKeyword(exports.formatLimitDefinition);
12798
+ return ajv2;
12799
12799
  };
12800
12800
  exports.default = formatLimitPlugin;
12801
12801
  });
@@ -12808,17 +12808,17 @@ var require_dist = __commonJS((exports, module) => {
12808
12808
  var codegen_1 = require_codegen2();
12809
12809
  var fullName = new codegen_1.Name("fullFormats");
12810
12810
  var fastName = new codegen_1.Name("fastFormats");
12811
- var formatsPlugin = (ajv, opts = { keywords: true }) => {
12811
+ var formatsPlugin = (ajv2, opts = { keywords: true }) => {
12812
12812
  if (Array.isArray(opts)) {
12813
- addFormats(ajv, opts, formats_1.fullFormats, fullName);
12814
- return ajv;
12813
+ addFormats(ajv2, opts, formats_1.fullFormats, fullName);
12814
+ return ajv2;
12815
12815
  }
12816
12816
  const [formats, exportName] = opts.mode === "fast" ? [formats_1.fastFormats, fastName] : [formats_1.fullFormats, fullName];
12817
12817
  const list = opts.formats || formats_1.formatNames;
12818
- addFormats(ajv, list, formats, exportName);
12818
+ addFormats(ajv2, list, formats, exportName);
12819
12819
  if (opts.keywords)
12820
- limit_1.default(ajv);
12821
- return ajv;
12820
+ limit_1.default(ajv2);
12821
+ return ajv2;
12822
12822
  };
12823
12823
  formatsPlugin.get = (name, mode = "full") => {
12824
12824
  const formats = mode === "fast" ? formats_1.fastFormats : formats_1.fullFormats;
@@ -12827,12 +12827,12 @@ var require_dist = __commonJS((exports, module) => {
12827
12827
  throw new Error(`Unknown format "${name}"`);
12828
12828
  return f;
12829
12829
  };
12830
- function addFormats(ajv, list, fs, exportName) {
12830
+ function addFormats(ajv2, list, fs, exportName) {
12831
12831
  var _a;
12832
12832
  var _b;
12833
- (_a = (_b = ajv.opts.code).formats) !== null && _a !== undefined || (_b.formats = codegen_1._`require("ajv-formats/dist/formats").${exportName}`);
12833
+ (_a = (_b = ajv2.opts.code).formats) !== null && _a !== undefined || (_b.formats = codegen_1._`require("ajv-formats/dist/formats").${exportName}`);
12834
12834
  for (const f of list)
12835
- ajv.addFormat(f, fs[f]);
12835
+ ajv2.addFormat(f, fs[f]);
12836
12836
  }
12837
12837
  module.exports = exports = formatsPlugin;
12838
12838
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -15743,7 +15743,7 @@ var require_formats2 = __commonJS((exports, module) => {
15743
15743
  // ../../node_modules/ajv-formats-draft2019/index.js
15744
15744
  var require_ajv_formats_draft2019 = __commonJS((exports, module) => {
15745
15745
  var formats = require_formats2();
15746
- module.exports = (ajv, options = {}) => {
15746
+ module.exports = (ajv2, options = {}) => {
15747
15747
  const allFormats = Object.keys(formats);
15748
15748
  let formatsToInstall = allFormats;
15749
15749
  if (options.formats) {
@@ -15752,9 +15752,9 @@ var require_ajv_formats_draft2019 = __commonJS((exports, module) => {
15752
15752
  formatsToInstall = options.formats;
15753
15753
  }
15754
15754
  allFormats.filter((format) => formatsToInstall.includes(format)).forEach((key) => {
15755
- ajv.addFormat(key, formats[key]);
15755
+ ajv2.addFormat(key, formats[key]);
15756
15756
  });
15757
- return ajv;
15757
+ return ajv2;
15758
15758
  };
15759
15759
  });
15760
15760
 
@@ -15820,6 +15820,58 @@ function getCredentialsSchemaIdByContextUrl(platformContextUrl) {
15820
15820
  return platformContextToCredentialsSchemaId.get(platformContextUrl);
15821
15821
  }
15822
15822
 
15823
+ // src/examples-config.ts
15824
+ var import_ajv = __toESM(require_ajv(), 1);
15825
+
15826
+ // src/schemas/examples-config.ts
15827
+ var port = {
15828
+ type: "integer",
15829
+ minimum: 1,
15830
+ maximum: 65535
15831
+ };
15832
+ var ExamplesConfigSchema = {
15833
+ $id: "https://sockethub.org/schemas/v/examples-config.json",
15834
+ description: "Sockethub examples runtime configuration",
15835
+ type: "object",
15836
+ required: ["sockethub", "public"],
15837
+ additionalProperties: false,
15838
+ properties: {
15839
+ sockethub: {
15840
+ type: "object",
15841
+ required: ["port", "host", "path"],
15842
+ additionalProperties: false,
15843
+ properties: {
15844
+ port,
15845
+ host: { type: "string" },
15846
+ path: { type: "string" }
15847
+ }
15848
+ },
15849
+ public: {
15850
+ type: "object",
15851
+ required: ["protocol", "host", "port", "path"],
15852
+ additionalProperties: false,
15853
+ properties: {
15854
+ protocol: { type: "string" },
15855
+ host: { type: "string" },
15856
+ port,
15857
+ path: { type: "string" }
15858
+ }
15859
+ },
15860
+ platforms: {
15861
+ type: "array",
15862
+ items: { type: "string" }
15863
+ }
15864
+ }
15865
+ };
15866
+
15867
+ // src/examples-config.ts
15868
+ var ajv = new import_ajv.default({ strictTypes: false, allErrors: true });
15869
+ var validator;
15870
+ function validateExamplesConfig(config) {
15871
+ validator ??= ajv.compile(ExamplesConfigSchema);
15872
+ return validator(config);
15873
+ }
15874
+
15823
15875
  // src/helpers/objects.ts
15824
15876
  var ObjectTypesSchema = {
15825
15877
  feed: {
@@ -15953,6 +16005,19 @@ var ObjectTypesSchema = {
15953
16005
  }
15954
16006
  }
15955
16007
  }
16008
+ },
16009
+ addressBook: {
16010
+ required: ["id", "type"],
16011
+ additionalProperties: false,
16012
+ properties: {
16013
+ id: {
16014
+ type: "string",
16015
+ format: "iri"
16016
+ },
16017
+ type: {
16018
+ enum: ["addressBook"]
16019
+ }
16020
+ }
15956
16021
  }
15957
16022
  };
15958
16023
  var InternalObjectTypesList = ["platform", "heartbeat"];
@@ -15973,7 +16038,8 @@ var TargetTypesList = [
15973
16038
  "website",
15974
16039
  "platform",
15975
16040
  "address",
15976
- "calendar"
16041
+ "calendar",
16042
+ "addressBook"
15977
16043
  ];
15978
16044
  var validActorRefs = ActorTypesList.map((type) => ({
15979
16045
  $ref: `#/definitions/type/${type}`
@@ -16096,7 +16162,7 @@ var PlatformSchema = {
16096
16162
  var package_default = {
16097
16163
  name: "@sockethub/schemas",
16098
16164
  description: "JSON schema files for validating Sockethub Activity Streams",
16099
- version: "3.0.0-alpha.19",
16165
+ version: "3.0.0-alpha.20",
16100
16166
  type: "module",
16101
16167
  private: false,
16102
16168
  author: "Nick Jennings <nick@silverbucket.net>",
@@ -16121,8 +16187,17 @@ var package_default = {
16121
16187
  import: "./dist/object-types.js",
16122
16188
  default: "./dist/object-types.js"
16123
16189
  },
16190
+ "./examples-config": {
16191
+ types: "./dist/examples-config.d.ts",
16192
+ bun: "./src/examples-config.ts",
16193
+ import: "./dist/examples-config.js",
16194
+ default: "./dist/examples-config.js"
16195
+ },
16124
16196
  "./schemas/json/sockethub-config.json": {
16125
16197
  default: "./dist/schemas/json/sockethub-config.json"
16198
+ },
16199
+ "./schemas/json/examples-config.json": {
16200
+ default: "./dist/schemas/json/examples-config.json"
16126
16201
  }
16127
16202
  },
16128
16203
  files: [
@@ -16148,7 +16223,7 @@ var package_default = {
16148
16223
  "@types/bun": "latest"
16149
16224
  },
16150
16225
  scripts: {
16151
- build: "bun ./scripts/export-json-schema.ts && bun ./scripts/export-canonical-assets.ts && bun build src/index.ts src/object-types.ts --outdir dist --target node --format esm --sourcemap=external && bun build src/context.ts src/activity-stream-helper.ts --outdir dist --target browser --format esm --sourcemap=external",
16226
+ build: "bun ./scripts/export-json-schema.ts && bun ./scripts/export-canonical-assets.ts && bun build src/index.ts src/object-types.ts --outdir dist --target node --format esm --sourcemap=external && bun build src/context.ts src/activity-stream-helper.ts src/examples-config.ts --outdir dist --target browser --format esm --sourcemap=external",
16152
16227
  clean: "rm -rf dist",
16153
16228
  "clean:deps": "rm -rf node_modules"
16154
16229
  },
@@ -16157,7 +16232,7 @@ var package_default = {
16157
16232
  "ajv-formats": "^2.1.1",
16158
16233
  "ajv-formats-draft2019": "^1.6.1"
16159
16234
  },
16160
- gitHead: "9dc63d790aabfbfe894b1d1b0754013e40fd25ec",
16235
+ gitHead: "194422de2ffe1a95ffff45063bc988da8594756a",
16161
16236
  types: "./dist/index.d.ts"
16162
16237
  };
16163
16238
 
@@ -16214,6 +16289,7 @@ var SockethubConfigSchema = {
16214
16289
  },
16215
16290
  description: "Platform packages to load",
16216
16291
  default: [
16292
+ "@sockethub/platform-carddav",
16217
16293
  "@sockethub/platform-caldav",
16218
16294
  "@sockethub/platform-dummy",
16219
16295
  "@sockethub/platform-feeds",
@@ -16227,6 +16303,16 @@ var SockethubConfigSchema = {
16227
16303
  default: {},
16228
16304
  description: "Per-platform config keyed by package name, validated against " + "each platform's config schema and forwarded to its child process",
16229
16305
  properties: {
16306
+ "@sockethub/platform-carddav": {
16307
+ type: "object",
16308
+ additionalProperties: false,
16309
+ properties: {
16310
+ connectTimeoutMs: { type: "integer", minimum: 1 },
16311
+ allowPrivateAddresses: { type: "boolean" },
16312
+ allowInsecureHttp: { type: "boolean" },
16313
+ concurrency: { type: "integer", minimum: 1 }
16314
+ }
16315
+ },
16230
16316
  "@sockethub/platform-caldav": {
16231
16317
  type: "object",
16232
16318
  additionalProperties: false,
@@ -16345,7 +16431,7 @@ var SockethubConfigSchema = {
16345
16431
  maxConnectionsPerIp: {
16346
16432
  type: "number",
16347
16433
  minimum: 0,
16348
- default: 0,
16434
+ default: 20,
16349
16435
  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."
16350
16436
  }
16351
16437
  }
@@ -16357,7 +16443,7 @@ var SockethubConfigSchema = {
16357
16443
  maxPlatformInstances: {
16358
16444
  type: "number",
16359
16445
  minimum: 0,
16360
- default: 0,
16446
+ default: 100,
16361
16447
  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."
16362
16448
  }
16363
16449
  }
@@ -16417,6 +16503,12 @@ var SockethubConfigSchema = {
16417
16503
  type: "string",
16418
16504
  default: "/sockethub"
16419
16505
  },
16506
+ maxPayloadBytes: {
16507
+ type: "integer",
16508
+ minimum: 1,
16509
+ default: 262144,
16510
+ description: "Maximum size in bytes of a single Socket.IO message."
16511
+ },
16420
16512
  cors: {
16421
16513
  type: "object",
16422
16514
  additionalProperties: false,
@@ -16493,7 +16585,7 @@ var SockethubConfigSchema = {
16493
16585
  var SockethubConfigSchemaId = versionedSchemaId(SockethubConfigSchema.$id, package_default.version);
16494
16586
 
16495
16587
  // src/validator.ts
16496
- var import_ajv = __toESM(require_ajv(), 1);
16588
+ var import_ajv2 = __toESM(require_ajv(), 1);
16497
16589
  var import_ajv_formats = __toESM(require_dist(), 1);
16498
16590
  var import_ajv_formats_draft2019 = __toESM(require_ajv_formats_draft2019(), 1);
16499
16591
 
@@ -16598,26 +16690,26 @@ function composeFinalError(error, options) {
16598
16690
  }
16599
16691
 
16600
16692
  // src/validator.ts
16601
- var ajv = new import_ajv.default({ strictTypes: false, allErrors: true });
16602
- import_ajv_formats.default(ajv);
16603
- import_ajv_formats_draft2019.default(ajv);
16693
+ var ajv2 = new import_ajv2.default({ strictTypes: false, allErrors: true });
16694
+ import_ajv_formats.default(ajv2);
16695
+ import_ajv_formats_draft2019.default(ajv2);
16604
16696
  var schemaURL = "https://sockethub.org/schemas/v0";
16605
16697
  var schemas = {};
16606
16698
  var validationErrorOptions = {};
16607
16699
  var systemContextsRegistered = false;
16608
16700
  schemas[`${schemaURL}/activity-stream`] = ActivityStreamSchema;
16609
16701
  for (const uri in schemas) {
16610
- ajv.addSchema(schemas[uri], uri);
16702
+ ajv2.addSchema(schemas[uri], uri);
16611
16703
  }
16612
16704
  function registerSystemContext(platformId, contextUrl) {
16613
16705
  registerPlatformContext(platformId, contextUrl, `${schemaURL}/context/${platformId}/messages`, `${schemaURL}/context/${platformId}/credentials`);
16614
16706
  const messageSchemaRef = `${schemaURL}/context/${platformId}/messages`;
16615
- if (!ajv.getSchema(messageSchemaRef)) {
16616
- ajv.addSchema({}, messageSchemaRef);
16707
+ if (!ajv2.getSchema(messageSchemaRef)) {
16708
+ ajv2.addSchema({}, messageSchemaRef);
16617
16709
  }
16618
16710
  const credentialsSchemaRef = `${schemaURL}/context/${platformId}/credentials`;
16619
- if (!ajv.getSchema(credentialsSchemaRef)) {
16620
- ajv.addSchema({}, credentialsSchemaRef);
16711
+ if (!ajv2.getSchema(credentialsSchemaRef)) {
16712
+ ajv2.addSchema({}, credentialsSchemaRef);
16621
16713
  }
16622
16714
  }
16623
16715
  function registerSystemPlatformContexts() {
@@ -16630,13 +16722,13 @@ function registerSystemPlatformContexts() {
16630
16722
  }
16631
16723
  registerSystemPlatformContexts();
16632
16724
  function handleValidation(schemaRef, msg) {
16633
- const validator = ajv.getSchema(schemaRef);
16634
- if (!validator) {
16725
+ const validator2 = ajv2.getSchema(schemaRef);
16726
+ if (!validator2) {
16635
16727
  return `schema ${schemaRef} not found`;
16636
16728
  }
16637
- const result = validator(msg);
16729
+ const result = validator2(msg);
16638
16730
  if (!result) {
16639
- let errorMessage = getErrorMessage(msg, validator.errors, validationErrorOptions);
16731
+ let errorMessage = getErrorMessage(msg, validator2.errors, validationErrorOptions);
16640
16732
  if (Array.isArray(msg["@context"])) {
16641
16733
  const platformContextUrl = resolvePlatformContextUrl(msg);
16642
16734
  if (platformContextUrl) {
@@ -16656,12 +16748,12 @@ function setValidationErrorOptions(options) {
16656
16748
  var sockethubConfigValidator;
16657
16749
  function validateSockethubConfig(config) {
16658
16750
  if (!sockethubConfigValidator) {
16659
- sockethubConfigValidator = ajv.compile(SockethubConfigSchema);
16751
+ sockethubConfigValidator = ajv2.compile(SockethubConfigSchema);
16660
16752
  }
16661
16753
  if (sockethubConfigValidator(config)) {
16662
16754
  return "";
16663
16755
  }
16664
- return ajv.errorsText(sockethubConfigValidator.errors, {
16756
+ return ajv2.errorsText(sockethubConfigValidator.errors, {
16665
16757
  dataVar: "config"
16666
16758
  });
16667
16759
  }
@@ -16690,7 +16782,7 @@ function validateActivityStreamResponse(msg) {
16690
16782
  return "";
16691
16783
  }
16692
16784
  const responsesSchemaId = `${schemaURL}/context/${platformId}/responses`;
16693
- if (!ajv.getSchema(responsesSchemaId)) {
16785
+ if (!ajv2.getSchema(responsesSchemaId)) {
16694
16786
  return "";
16695
16787
  }
16696
16788
  return handleValidation(responsesSchemaId, msg);
@@ -16717,7 +16809,7 @@ function validateCredentials(msg) {
16717
16809
  return handleValidation(credentialsSchemaId, msg);
16718
16810
  }
16719
16811
  function validatePlatformSchema(schema) {
16720
- const validate = ajv.compile(PlatformSchema);
16812
+ const validate = ajv2.compile(PlatformSchema);
16721
16813
  const err = validate(schema);
16722
16814
  if (!err) {
16723
16815
  const validationError = validate.errors[0];
@@ -16727,16 +16819,53 @@ function validatePlatformSchema(schema) {
16727
16819
  }
16728
16820
  return `platform schema failed to validate: ${message}`;
16729
16821
  }
16822
+ const platform = schema;
16823
+ const messages = platform.messages;
16824
+ const properties = messages?.properties;
16825
+ const declaredTypes = (root) => {
16826
+ const result = new Set;
16827
+ const visit = (value) => {
16828
+ if (!value || typeof value !== "object" || Array.isArray(value))
16829
+ return;
16830
+ const node = value;
16831
+ if (typeof node.const === "string")
16832
+ result.add(node.const);
16833
+ if (Array.isArray(node.enum)) {
16834
+ for (const item of node.enum) {
16835
+ if (typeof item === "string")
16836
+ result.add(item);
16837
+ }
16838
+ }
16839
+ const nodeProperties = node.properties;
16840
+ visit(nodeProperties?.type);
16841
+ for (const keyword of ["allOf", "anyOf", "oneOf"]) {
16842
+ const branches = node[keyword];
16843
+ if (Array.isArray(branches))
16844
+ branches.forEach(visit);
16845
+ }
16846
+ };
16847
+ visit(root);
16848
+ return result;
16849
+ };
16850
+ for (const [property, allowed] of [
16851
+ ["actor", ActorTypesList],
16852
+ ["target", TargetTypesList]
16853
+ ]) {
16854
+ const unsupported = [...declaredTypes(properties?.[property])].filter((type) => !allowed.includes(type));
16855
+ if (unsupported.length > 0) {
16856
+ return `platform schema ${property} types are not registered in the shared ActivityStreams envelope: ${unsupported.join(", ")}`;
16857
+ }
16858
+ }
16730
16859
  return "";
16731
16860
  }
16732
16861
  function addPlatformSchema(schema, platform_type) {
16733
16862
  const schemaRef = `${schemaURL}/context/${platform_type}`;
16734
- if (!ajv.getSchema(schemaRef)) {
16735
- ajv.addSchema(schema, schemaRef);
16863
+ if (!ajv2.getSchema(schemaRef)) {
16864
+ ajv2.addSchema(schema, schemaRef);
16736
16865
  }
16737
16866
  }
16738
16867
  function getPlatformSchema(platform_type) {
16739
- return ajv.getSchema(`${schemaURL}/context/${platform_type}`);
16868
+ return ajv2.getSchema(`${schemaURL}/context/${platform_type}`);
16740
16869
  }
16741
16870
  function addPlatformContext(platformId, platformContextUrl) {
16742
16871
  registerPlatformContext(platformId, platformContextUrl, `${schemaURL}/context/${platformId}/messages`, `${schemaURL}/context/${platformId}/credentials`);
@@ -16783,6 +16912,7 @@ function normalizeActivityStream(meta) {
16783
16912
  export {
16784
16913
  validateSockethubConfig,
16785
16914
  validatePlatformSchema,
16915
+ validateExamplesConfig,
16786
16916
  validateCredentials,
16787
16917
  validateActivityStreamResponse,
16788
16918
  validateActivityStream,
@@ -16805,10 +16935,11 @@ export {
16805
16935
  InternalObjectTypesList,
16806
16936
  INTERNAL_PLATFORM_ID,
16807
16937
  INTERNAL_PLATFORM_CONTEXT_URL,
16938
+ ExamplesConfigSchema,
16808
16939
  ERROR_PLATFORM_ID,
16809
16940
  ERROR_PLATFORM_CONTEXT_URL,
16810
16941
  ActivityStreamSchema,
16811
16942
  AS2_BASE_CONTEXT_URL
16812
16943
  };
16813
16944
 
16814
- //# debugId=80D593878431903D64756E2164756E21
16945
+ //# debugId=B519AB3A4C03353464756E2164756E21