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

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/context.js +101 -0
  2. package/dist/context.js.map +10 -0
  3. package/dist/contexts/platform/dummy/v1.jsonld +8 -0
  4. package/dist/contexts/platform/error/v1.jsonld +8 -0
  5. package/dist/contexts/platform/feeds/v1.jsonld +8 -0
  6. package/dist/contexts/platform/irc/v1.jsonld +8 -0
  7. package/dist/contexts/platform/metadata/v1.jsonld +8 -0
  8. package/dist/contexts/platform/sockethub%3Ainternal/v1.jsonld +8 -0
  9. package/dist/contexts/platform/xmpp/v1.jsonld +8 -0
  10. package/dist/contexts/v1.jsonld +7 -0
  11. package/dist/index.js +312 -31
  12. package/dist/index.js.map +10 -9
  13. package/dist/maps/context-map.json +35 -0
  14. package/dist/schemas/platform/dummy/v1/credentials.schema.json +1 -0
  15. package/dist/schemas/platform/dummy/v1/messages.schema.json +22 -0
  16. package/dist/schemas/platform/error/v1/credentials.schema.json +1 -0
  17. package/dist/schemas/platform/error/v1/messages.schema.json +1 -0
  18. package/dist/schemas/platform/feeds/v1/credentials.schema.json +1 -0
  19. package/dist/schemas/platform/feeds/v1/messages.schema.json +36 -0
  20. package/dist/schemas/platform/irc/v1/credentials.schema.json +48 -0
  21. package/dist/schemas/platform/irc/v1/messages.schema.json +19 -0
  22. package/dist/schemas/platform/metadata/v1/credentials.schema.json +1 -0
  23. package/dist/schemas/platform/metadata/v1/messages.schema.json +29 -0
  24. package/dist/schemas/platform/sockethub%3Ainternal/v1/credentials.schema.json +1 -0
  25. package/dist/schemas/platform/sockethub%3Ainternal/v1/messages.schema.json +1 -0
  26. package/dist/schemas/platform/xmpp/v1/credentials.schema.json +43 -0
  27. package/dist/schemas/platform/xmpp/v1/messages.schema.json +21 -0
  28. package/package.json +8 -3
  29. package/src/context.ts +125 -0
  30. package/src/helpers/error-parser.ts +65 -18
  31. package/src/helpers/objects.ts +59 -3
  32. package/src/index.test.data.credentials.ts +37 -5
  33. package/src/index.test.data.platform.ts +3 -0
  34. package/src/index.test.data.streams.ts +117 -25
  35. package/src/index.test.ts +31 -3
  36. package/src/index.ts +28 -1
  37. package/src/schemas/activity-stream.ts +30 -9
  38. package/src/schemas/json/activity-object.json +50 -1
  39. package/src/schemas/json/activity-stream.json +77 -44
  40. package/src/schemas/json/platform.json +22 -2
  41. package/src/schemas/json/sockethub-config.json +15 -1
  42. package/src/schemas/platform.ts +25 -1
  43. package/src/schemas/sockethub-config.ts +15 -1
  44. package/src/types/ajv-formats-draft2019.d.ts +5 -0
  45. package/src/types.ts +10 -3
  46. package/src/validator.ts +138 -18
package/dist/index.js CHANGED
@@ -4,15 +4,29 @@ var __getProtoOf = Object.getPrototypeOf;
4
4
  var __defProp = Object.defineProperty;
5
5
  var __getOwnPropNames = Object.getOwnPropertyNames;
6
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ function __accessProp(key) {
8
+ return this[key];
9
+ }
10
+ var __toESMCache_node;
11
+ var __toESMCache_esm;
7
12
  var __toESM = (mod, isNodeMode, target) => {
13
+ var canCache = mod != null && typeof mod === "object";
14
+ if (canCache) {
15
+ var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
16
+ var cached = cache.get(mod);
17
+ if (cached)
18
+ return cached;
19
+ }
8
20
  target = mod != null ? __create(__getProtoOf(mod)) : {};
9
21
  const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
10
22
  for (let key of __getOwnPropNames(mod))
11
23
  if (!__hasOwnProp.call(to, key))
12
24
  __defProp(to, key, {
13
- get: () => mod[key],
25
+ get: __accessProp.bind(mod, key),
14
26
  enumerable: true
15
27
  });
28
+ if (canCache)
29
+ cache.set(mod, to);
16
30
  return to;
17
31
  };
18
32
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
@@ -15735,6 +15749,56 @@ var require_ajv_formats_draft2019 = __commonJS((exports, module) => {
15735
15749
  };
15736
15750
  });
15737
15751
 
15752
+ // src/context.ts
15753
+ var AS2_BASE_CONTEXT_URL = "https://www.w3.org/ns/activitystreams";
15754
+ var SOCKETHUB_BASE_CONTEXT_URL = "https://sockethub.org/ns/context/v1.jsonld";
15755
+ var PLATFORM_CONTEXT_PREFIX = "https://sockethub.org/ns/context/platform/";
15756
+ var ERROR_PLATFORM_ID = "error";
15757
+ var ERROR_PLATFORM_CONTEXT_URL = "https://sockethub.org/ns/context/platform/error/v1.jsonld";
15758
+ var INTERNAL_PLATFORM_ID = "sockethub:internal";
15759
+ var INTERNAL_PLATFORM_CONTEXT_URL = "https://sockethub.org/ns/context/platform/sockethub:internal/v1.jsonld";
15760
+ var platformContextToPlatformId = new Map;
15761
+ var platformContextToSchemaId = new Map;
15762
+ var platformContextToCredentialsSchemaId = new Map;
15763
+ function buildCanonicalContext(platformContextUrl) {
15764
+ return [
15765
+ AS2_BASE_CONTEXT_URL,
15766
+ SOCKETHUB_BASE_CONTEXT_URL,
15767
+ platformContextUrl
15768
+ ];
15769
+ }
15770
+ function normalizeContextArray(value) {
15771
+ if (!Array.isArray(value)) {
15772
+ return [];
15773
+ }
15774
+ return value.filter((entry) => typeof entry === "string");
15775
+ }
15776
+ function getContextArray(msg) {
15777
+ return normalizeContextArray(msg["@context"]);
15778
+ }
15779
+ function registerPlatformContext(platformId, platformContextUrl, schemaId, credentialsSchemaId) {
15780
+ platformContextToPlatformId.set(platformContextUrl, platformId);
15781
+ platformContextToSchemaId.set(platformContextUrl, schemaId);
15782
+ platformContextToCredentialsSchemaId.set(platformContextUrl, credentialsSchemaId);
15783
+ }
15784
+ function resolvePlatformContextUrl(msg) {
15785
+ const contexts = getContextArray(msg);
15786
+ const matches = contexts.filter((contextUrl) => platformContextToPlatformId.has(contextUrl));
15787
+ if (matches.length !== 1) {
15788
+ return null;
15789
+ }
15790
+ return matches[0];
15791
+ }
15792
+ function getPlatformIdByContextUrl(platformContextUrl) {
15793
+ return platformContextToPlatformId.get(platformContextUrl);
15794
+ }
15795
+ function getSchemaIdByContextUrl(platformContextUrl) {
15796
+ return platformContextToSchemaId.get(platformContextUrl);
15797
+ }
15798
+ function getCredentialsSchemaIdByContextUrl(platformContextUrl) {
15799
+ return platformContextToCredentialsSchemaId.get(platformContextUrl);
15800
+ }
15801
+
15738
15802
  // src/helpers/objects.ts
15739
15803
  var validObjectRefs = [];
15740
15804
  var validObjectDefs = {};
@@ -15848,6 +15912,21 @@ var ObjectTypesSchema = {
15848
15912
  }
15849
15913
  }
15850
15914
  },
15915
+ platform: {
15916
+ required: ["id", "type"],
15917
+ additionalProperties: true,
15918
+ properties: {
15919
+ id: {
15920
+ type: "string"
15921
+ },
15922
+ type: {
15923
+ enum: ["platform"]
15924
+ },
15925
+ name: {
15926
+ type: "string"
15927
+ }
15928
+ }
15929
+ },
15851
15930
  website: {
15852
15931
  required: ["id", "type"],
15853
15932
  additionalProperties: true,
@@ -15937,9 +16016,45 @@ var ObjectTypesSchema = {
15937
16016
  enum: ["address"]
15938
16017
  }
15939
16018
  }
16019
+ },
16020
+ heartbeat: {
16021
+ required: ["type", "timestamp"],
16022
+ additionalProperties: false,
16023
+ properties: {
16024
+ type: {
16025
+ enum: ["heartbeat"]
16026
+ },
16027
+ timestamp: {
16028
+ type: "number"
16029
+ }
16030
+ }
15940
16031
  }
15941
16032
  };
16033
+ var InternalObjectTypesList = ["platform", "heartbeat"];
15942
16034
  var ObjectTypesList = Object.keys(ObjectTypesSchema);
16035
+ var ActorTypesList = [
16036
+ "person",
16037
+ "room",
16038
+ "service",
16039
+ "feed",
16040
+ "website",
16041
+ "platform"
16042
+ ];
16043
+ var TargetTypesList = [
16044
+ "person",
16045
+ "room",
16046
+ "service",
16047
+ "feed",
16048
+ "website",
16049
+ "platform",
16050
+ "address"
16051
+ ];
16052
+ var validActorRefs = ActorTypesList.map((type) => ({
16053
+ $ref: `#/definitions/type/${type}`
16054
+ }));
16055
+ var validTargetRefs = TargetTypesList.map((type) => ({
16056
+ $ref: `#/definitions/type/${type}`
16057
+ }));
15943
16058
  for (const type of ObjectTypesList) {
15944
16059
  if (type === "credentials") {
15945
16060
  continue;
@@ -15966,14 +16081,29 @@ var ActivityObjectSchema = {
15966
16081
  };
15967
16082
 
15968
16083
  // src/schemas/activity-stream.ts
15969
- var validActorRefs = ActivityObjectSchema.properties.object.oneOf;
15970
- var validTargetRefs = ActivityObjectSchema.properties.object.oneOf;
15971
16084
  var validObjectRefs2 = [];
15972
16085
  for (const type of ObjectTypesList) {
15973
16086
  validObjectRefs2.push({ $ref: `#/definitions/type/${type}` });
15974
16087
  }
15975
16088
  var contextSchema = {
15976
- type: "string"
16089
+ type: "array",
16090
+ minItems: 3,
16091
+ maxItems: 3,
16092
+ items: {
16093
+ type: "string"
16094
+ },
16095
+ allOf: [
16096
+ {
16097
+ contains: {
16098
+ const: AS2_BASE_CONTEXT_URL
16099
+ }
16100
+ },
16101
+ {
16102
+ contains: {
16103
+ const: SOCKETHUB_BASE_CONTEXT_URL
16104
+ }
16105
+ }
16106
+ ]
15977
16107
  };
15978
16108
  var typeSchema = {
15979
16109
  type: "string"
@@ -15982,13 +16112,13 @@ var ActivityStreamSchema = {
15982
16112
  $id: "https://sockethub.org/schemas/v/activity-stream.json",
15983
16113
  description: "Schema for Sockethub Activity Streams",
15984
16114
  type: "object",
15985
- required: ["context", "type", "actor"],
16115
+ required: ["@context", "type", "actor"],
15986
16116
  properties: {
16117
+ "@context": contextSchema,
15987
16118
  id: {
15988
16119
  type: "string"
15989
16120
  },
15990
16121
  type: typeSchema,
15991
- context: contextSchema,
15992
16122
  actor: {
15993
16123
  type: "object",
15994
16124
  oneOf: validActorRefs
@@ -16015,9 +16145,33 @@ var ActivityStreamSchema = {
16015
16145
  var PlatformSchema = {
16016
16146
  $id: "https://sockethub.org/schemas/v/platform.json",
16017
16147
  type: "object",
16018
- required: ["name", "version", "messages"],
16148
+ required: [
16149
+ "name",
16150
+ "version",
16151
+ "messages",
16152
+ "contextUrl",
16153
+ "contextVersion",
16154
+ "schemaVersion"
16155
+ ],
16019
16156
  additionalProperties: false,
16020
16157
  properties: {
16158
+ contextUrl: {
16159
+ title: "contextUrl",
16160
+ type: "string",
16161
+ format: "uri"
16162
+ },
16163
+ contextVersion: {
16164
+ title: "contextVersion",
16165
+ type: "string"
16166
+ },
16167
+ schemaVersion: {
16168
+ title: "schemaVersion",
16169
+ type: "string"
16170
+ },
16171
+ messageConstraints: {
16172
+ title: "messageConstraints",
16173
+ type: "object"
16174
+ },
16021
16175
  credentials: {
16022
16176
  title: "credentials",
16023
16177
  type: "object"
@@ -16239,6 +16393,20 @@ var SockethubConfigSchema = {
16239
16393
  default: "/sockethub"
16240
16394
  }
16241
16395
  }
16396
+ },
16397
+ platformHeartbeat: {
16398
+ type: "object",
16399
+ additionalProperties: false,
16400
+ properties: {
16401
+ intervalMs: {
16402
+ type: "number",
16403
+ default: 5000
16404
+ },
16405
+ timeoutMs: {
16406
+ type: "number",
16407
+ default: 15000
16408
+ }
16409
+ }
16242
16410
  }
16243
16411
  }
16244
16412
  };
@@ -16259,11 +16427,15 @@ function parseMsg(error) {
16259
16427
  return err;
16260
16428
  }
16261
16429
  function getTypeList(msg) {
16262
- let types = [];
16263
- types.push(msg?.type);
16264
- for (const prop in msg) {
16265
- if (msg[prop]?.type) {
16266
- types = [...types, ...getTypeList(msg[prop])];
16430
+ const types = [];
16431
+ if (msg?.type) {
16432
+ types.push(msg.type);
16433
+ }
16434
+ const record = msg;
16435
+ for (const prop in record) {
16436
+ const value = record[prop];
16437
+ if (value && typeof value === "object" && "type" in value) {
16438
+ types.push(...getTypeList(value));
16267
16439
  }
16268
16440
  }
16269
16441
  return types;
@@ -16282,23 +16454,32 @@ function getPartsCount(error, types) {
16282
16454
  if (!errType) {
16283
16455
  return -1;
16284
16456
  }
16285
- if (!types[errType]) {
16457
+ const typeList = types[errType];
16458
+ if (!typeList) {
16286
16459
  return -1;
16287
16460
  }
16288
- if (!types[errType].includes(schemaType)) {
16461
+ if (!schemaType || !typeList.includes(schemaType)) {
16289
16462
  return -1;
16290
16463
  }
16291
16464
  const parts = error.instancePath.split("/");
16292
16465
  return parts.length;
16293
16466
  }
16294
16467
  function getTypes(msg) {
16468
+ if (!Array.isArray(msg["@context"])) {
16469
+ return {
16470
+ actor: [],
16471
+ target: [],
16472
+ object: getTypeList(msg)
16473
+ };
16474
+ }
16475
+ const stream = msg;
16295
16476
  return {
16296
- actor: getTypeList(msg.actor),
16297
- target: getTypeList(msg.target),
16298
- object: getTypeList(msg.context ? msg.object : msg)
16477
+ actor: getTypeList(stream.actor),
16478
+ target: getTypeList(stream.target),
16479
+ object: stream.object ? getTypeList(stream.object) : []
16299
16480
  };
16300
16481
  }
16301
- function getErrorMessage(msg, errors) {
16482
+ function getErrorMessage(msg, errors, options) {
16302
16483
  const types = getTypes(msg);
16303
16484
  let deepest_entry = 0;
16304
16485
  let highest_depth = -1;
@@ -16309,12 +16490,23 @@ function getErrorMessage(msg, errors) {
16309
16490
  deepest_entry = i;
16310
16491
  }
16311
16492
  }
16312
- return highest_depth >= 0 ? parseMsg(errors[deepest_entry]) : composeFinalError(errors[errors.length - 1]);
16493
+ return highest_depth >= 0 ? parseMsg(errors[deepest_entry]) : composeFinalError(errors[errors.length - 1], options);
16494
+ }
16495
+ function filterTypeList(types, options) {
16496
+ if (!options?.excludeTypes || options.excludeTypes.length === 0) {
16497
+ return types;
16498
+ }
16499
+ const exclude = new Set(options.excludeTypes);
16500
+ return types.filter((type) => !exclude.has(type));
16313
16501
  }
16314
- function composeFinalError(error) {
16502
+ function composeFinalError(error, options) {
16315
16503
  let msg;
16316
16504
  if (error.keyword === "oneOf") {
16317
- msg = `${error.instancePath}: ${error.message}: ` + `${ObjectTypesList.join(", ")}`;
16505
+ const instanceRoot = error.instancePath.split("/")[1];
16506
+ const pathScopedTypes = instanceRoot === "actor" ? ActorTypesList : instanceRoot === "target" ? TargetTypesList : ObjectTypesList;
16507
+ const filteredTypes = filterTypeList(pathScopedTypes, options);
16508
+ const typesList = filteredTypes.length > 0 ? filteredTypes : pathScopedTypes;
16509
+ msg = `${error.instancePath}: ${error.message}: ` + `${typesList.join(", ")}`;
16318
16510
  } else {
16319
16511
  msg = `${error.instancePath ? error.instancePath : "activity stream"}: ${error.message}`;
16320
16512
  }
@@ -16330,13 +16522,38 @@ import_ajv_formats.default(ajv);
16330
16522
  import_ajv_formats_draft2019.default(ajv);
16331
16523
  var schemaURL = "https://sockethub.org/schemas/v0";
16332
16524
  var schemas = {};
16525
+ var validationErrorOptions = {};
16526
+ var systemContextsRegistered = false;
16333
16527
  schemas[`${schemaURL}/activity-stream`] = ActivityStreamSchema;
16334
16528
  schemas[`${schemaURL}/activity-object`] = ActivityObjectSchema;
16335
16529
  for (const uri in schemas) {
16336
16530
  ajv.addSchema(schemas[uri], uri);
16337
16531
  }
16532
+ function registerSystemContext(platformId, contextUrl) {
16533
+ registerPlatformContext(platformId, contextUrl, `${schemaURL}/context/${platformId}/messages`, `${schemaURL}/context/${platformId}/credentials`);
16534
+ const messageSchemaRef = `${schemaURL}/context/${platformId}/messages`;
16535
+ if (!ajv.getSchema(messageSchemaRef)) {
16536
+ ajv.addSchema({}, messageSchemaRef);
16537
+ }
16538
+ const credentialsSchemaRef = `${schemaURL}/context/${platformId}/credentials`;
16539
+ if (!ajv.getSchema(credentialsSchemaRef)) {
16540
+ ajv.addSchema({}, credentialsSchemaRef);
16541
+ }
16542
+ }
16543
+ function registerSystemPlatformContexts() {
16544
+ if (systemContextsRegistered) {
16545
+ return;
16546
+ }
16547
+ registerSystemContext(ERROR_PLATFORM_ID, ERROR_PLATFORM_CONTEXT_URL);
16548
+ registerSystemContext(INTERNAL_PLATFORM_ID, INTERNAL_PLATFORM_CONTEXT_URL);
16549
+ systemContextsRegistered = true;
16550
+ }
16551
+ registerSystemPlatformContexts();
16338
16552
  function handleValidation(schemaRef, msg, isObject = false) {
16339
16553
  const validator = ajv.getSchema(schemaRef);
16554
+ if (!validator) {
16555
+ return `schema ${schemaRef} not found`;
16556
+ }
16340
16557
  let result;
16341
16558
  if (isObject) {
16342
16559
  result = validator({ object: msg });
@@ -16344,28 +16561,61 @@ function handleValidation(schemaRef, msg, isObject = false) {
16344
16561
  result = validator(msg);
16345
16562
  }
16346
16563
  if (!result) {
16347
- let errorMessage = getErrorMessage(msg, validator.errors);
16348
- if (msg.context) {
16349
- errorMessage = `[${msg.context}] ${errorMessage}`;
16564
+ let errorMessage = getErrorMessage(msg, validator.errors, validationErrorOptions);
16565
+ if (Array.isArray(msg["@context"])) {
16566
+ const platformContextUrl = resolvePlatformContextUrl(msg);
16567
+ if (platformContextUrl) {
16568
+ const platformId = getPlatformIdByContextUrl(platformContextUrl);
16569
+ if (platformId) {
16570
+ errorMessage = `[${platformId}] ${errorMessage}`;
16571
+ }
16572
+ }
16350
16573
  }
16351
16574
  return errorMessage;
16352
16575
  }
16353
16576
  return "";
16354
16577
  }
16578
+ function setValidationErrorOptions(options) {
16579
+ validationErrorOptions = { ...validationErrorOptions, ...options };
16580
+ }
16355
16581
  function validateActivityObject(msg) {
16356
16582
  return handleValidation(`${schemaURL}/activity-object`, msg, true);
16357
16583
  }
16358
16584
  function validateActivityStream(msg) {
16359
- return handleValidation(`${schemaURL}/activity-stream`, msg);
16585
+ const streamValidationError = handleValidation(`${schemaURL}/activity-stream`, msg);
16586
+ if (streamValidationError) {
16587
+ return streamValidationError;
16588
+ }
16589
+ const platformContextUrl = resolvePlatformContextUrl(msg);
16590
+ if (!platformContextUrl) {
16591
+ return "activity streams must have exactly one registered platform context URL in @context";
16592
+ }
16593
+ const schemaId = getSchemaIdByContextUrl(platformContextUrl);
16594
+ if (!schemaId) {
16595
+ return `platform context URL ${platformContextUrl} does not have a registered message schema`;
16596
+ }
16597
+ return handleValidation(schemaId, msg);
16360
16598
  }
16361
16599
  function validateCredentials(msg) {
16362
- if (!msg.context) {
16363
- return "credential activity streams must have a context set";
16600
+ if (!Array.isArray(msg["@context"])) {
16601
+ return "credential activity streams must have an @context set";
16364
16602
  }
16365
16603
  if (msg.type !== "credentials") {
16366
16604
  return "credential activity streams must have credentials set as type";
16367
16605
  }
16368
- return handleValidation(`${schemaURL}/context/${msg.context}/credentials`, msg);
16606
+ const streamValidationError = handleValidation(`${schemaURL}/activity-stream`, msg);
16607
+ if (streamValidationError) {
16608
+ return streamValidationError;
16609
+ }
16610
+ const platformContextUrl = resolvePlatformContextUrl(msg);
16611
+ if (!platformContextUrl) {
16612
+ return "credential activity streams must have exactly one registered platform context URL in @context";
16613
+ }
16614
+ const credentialsSchemaId = getCredentialsSchemaIdByContextUrl(platformContextUrl);
16615
+ if (!credentialsSchemaId) {
16616
+ return `platform context URL ${platformContextUrl} does not have a registered credentials schema`;
16617
+ }
16618
+ return handleValidation(credentialsSchemaId, msg);
16369
16619
  }
16370
16620
  function validatePlatformSchema(schema) {
16371
16621
  const validate = ajv.compile(PlatformSchema);
@@ -16376,23 +16626,54 @@ function validatePlatformSchema(schema) {
16376
16626
  return "";
16377
16627
  }
16378
16628
  function addPlatformSchema(schema, platform_type) {
16379
- ajv.addSchema(schema, `${schemaURL}/context/${platform_type}`);
16629
+ const schemaRef = `${schemaURL}/context/${platform_type}`;
16630
+ if (!ajv.getSchema(schemaRef)) {
16631
+ ajv.addSchema(schema, schemaRef);
16632
+ }
16380
16633
  }
16381
16634
  function getPlatformSchema(platform_type) {
16382
16635
  return ajv.getSchema(`${schemaURL}/context/${platform_type}`);
16383
16636
  }
16637
+ function addPlatformContext(platformId, platformContextUrl) {
16638
+ registerPlatformContext(platformId, platformContextUrl, `${schemaURL}/context/${platformId}/messages`, `${schemaURL}/context/${platformId}/credentials`);
16639
+ }
16640
+ function resolvePlatformId(msg) {
16641
+ const platformContextUrl = resolvePlatformContextUrl(msg);
16642
+ if (platformContextUrl) {
16643
+ const id = getPlatformIdByContextUrl(platformContextUrl);
16644
+ if (id)
16645
+ return id;
16646
+ }
16647
+ if (typeof msg.platform === "string" && msg.platform) {
16648
+ return msg.platform;
16649
+ }
16650
+ return null;
16651
+ }
16384
16652
  export {
16385
16653
  validatePlatformSchema,
16386
16654
  validateCredentials,
16387
16655
  validateActivityStream,
16388
16656
  validateActivityObject,
16657
+ setValidationErrorOptions,
16658
+ resolvePlatformId,
16659
+ registerSystemPlatformContexts,
16389
16660
  getPlatformSchema,
16661
+ buildCanonicalContext,
16390
16662
  addPlatformSchema,
16663
+ addPlatformContext,
16391
16664
  SockethubConfigSchema,
16665
+ SOCKETHUB_BASE_CONTEXT_URL,
16392
16666
  PlatformSchema,
16667
+ PLATFORM_CONTEXT_PREFIX,
16393
16668
  ObjectTypesList,
16669
+ InternalObjectTypesList,
16670
+ INTERNAL_PLATFORM_ID,
16671
+ INTERNAL_PLATFORM_CONTEXT_URL,
16672
+ ERROR_PLATFORM_ID,
16673
+ ERROR_PLATFORM_CONTEXT_URL,
16394
16674
  ActivityStreamSchema,
16395
- ActivityObjectSchema
16675
+ ActivityObjectSchema,
16676
+ AS2_BASE_CONTEXT_URL
16396
16677
  };
16397
16678
 
16398
- //# debugId=6F40F71261F1E85264756E2164756E21
16679
+ //# debugId=6297C1FC6C040BA364756E2164756E21