@sockethub/schemas 3.0.0-alpha.9 → 3.0.0-beta.0

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 (74) 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 +80 -0
  6. package/dist/context.js.map +10 -0
  7. package/dist/contexts/platform/caldav/v1.jsonld +8 -0
  8. package/dist/contexts/platform/carddav/v1.jsonld +8 -0
  9. package/dist/contexts/platform/dummy/v1.jsonld +8 -0
  10. package/dist/contexts/platform/error/v1.jsonld +8 -0
  11. package/dist/contexts/platform/feeds/v1.jsonld +8 -0
  12. package/dist/contexts/platform/irc/v1.jsonld +8 -0
  13. package/dist/contexts/platform/metadata/v1.jsonld +8 -0
  14. package/dist/contexts/platform/sockethub%3Ainternal/v1.jsonld +8 -0
  15. package/dist/contexts/platform/xmpp/v1.jsonld +8 -0
  16. package/dist/contexts/v1.jsonld +7 -0
  17. package/dist/helpers/error-parser.d.ts +13 -0
  18. package/dist/helpers/objects.d.ts +157 -0
  19. package/dist/index.d.ts +11 -0
  20. package/dist/index.js +1235 -1143
  21. package/dist/index.js.map +15 -17
  22. package/dist/maps/context-map.json +41 -0
  23. package/dist/object-types.d.ts +2 -0
  24. package/dist/object-types.js +299 -0
  25. package/dist/object-types.js.map +12 -0
  26. package/dist/schema-id.d.ts +11 -0
  27. package/dist/schemas/activity-stream.d.ts +196 -0
  28. package/{src/schemas/json/activity-object.json → dist/schemas/json/activity-stream.json} +99 -158
  29. package/dist/schemas/json/platform.json +52 -0
  30. package/dist/schemas/json/service-descriptor.json +58 -0
  31. package/dist/schemas/json/sockethub-config.json +500 -0
  32. package/dist/schemas/platform/caldav/v1/credentials.schema.json +71 -0
  33. package/dist/schemas/platform/caldav/v1/messages.schema.json +769 -0
  34. package/dist/schemas/platform/carddav/v1/credentials.schema.json +67 -0
  35. package/dist/schemas/platform/carddav/v1/messages.schema.json +375 -0
  36. package/dist/schemas/platform/dummy/v1/credentials.schema.json +1 -0
  37. package/dist/schemas/platform/dummy/v1/messages.schema.json +22 -0
  38. package/dist/schemas/platform/error/v1/credentials.schema.json +1 -0
  39. package/dist/schemas/platform/error/v1/messages.schema.json +1 -0
  40. package/dist/schemas/platform/feeds/v1/credentials.schema.json +1 -0
  41. package/dist/schemas/platform/feeds/v1/messages.schema.json +27 -0
  42. package/dist/schemas/platform/irc/v1/credentials.schema.json +118 -0
  43. package/dist/schemas/platform/irc/v1/messages.schema.json +149 -0
  44. package/dist/schemas/platform/metadata/v1/credentials.schema.json +1 -0
  45. package/dist/schemas/platform/metadata/v1/messages.schema.json +14 -0
  46. package/dist/schemas/platform/sockethub%3Ainternal/v1/credentials.schema.json +1 -0
  47. package/dist/schemas/platform/sockethub%3Ainternal/v1/messages.schema.json +1 -0
  48. package/dist/schemas/platform/xmpp/v1/credentials.schema.json +43 -0
  49. package/dist/schemas/platform/xmpp/v1/messages.schema.json +129 -0
  50. package/dist/schemas/platform.d.ts +62 -0
  51. package/dist/schemas/service-descriptor.d.ts +84 -0
  52. package/dist/schemas/sockethub-config.d.ts +466 -0
  53. package/dist/service-descriptor.d.ts +4 -0
  54. package/dist/service-descriptor.js +6280 -0
  55. package/dist/service-descriptor.js.map +77 -0
  56. package/{src/types.ts → dist/types.d.ts} +52 -53
  57. package/dist/validator.d.ts +26 -0
  58. package/package.json +32 -11
  59. package/src/helpers/error-parser.ts +0 -113
  60. package/src/helpers/objects.ts +0 -227
  61. package/src/index.test.data.credentials.ts +0 -71
  62. package/src/index.test.data.objects.ts +0 -241
  63. package/src/index.test.data.platform.ts +0 -45
  64. package/src/index.test.data.streams.ts +0 -498
  65. package/src/index.test.ts +0 -99
  66. package/src/index.ts +0 -27
  67. package/src/schemas/activity-object.ts +0 -19
  68. package/src/schemas/activity-stream.ts +0 -54
  69. package/src/schemas/json/activity-stream.json +0 -469
  70. package/src/schemas/json/platform.json +0 -28
  71. package/src/schemas/json/sockethub-config.json +0 -144
  72. package/src/schemas/platform.ts +0 -47
  73. package/src/schemas/sockethub-config.ts +0 -140
  74. package/src/validator.ts +0 -94
@@ -0,0 +1,5 @@
1
+ import type { ActivityStream } from "./types.js";
2
+ /**
3
+ * Normalize string actor/target/object refs into minimal ActivityObjects.
4
+ */
5
+ export declare function normalizeActivityStream(meta: ActivityStream): ActivityStream;
@@ -0,0 +1,36 @@
1
+ // src/activity-stream-helper.ts
2
+ var stringRefKeys = {
3
+ actor: "id",
4
+ target: "id",
5
+ object: "content"
6
+ };
7
+ function normalizeStringRef(value, primaryKey) {
8
+ if (typeof value === "string") {
9
+ return { [primaryKey]: value };
10
+ }
11
+ if (Array.isArray(value)) {
12
+ return value.map((entry) => {
13
+ if (typeof entry === "string") {
14
+ return { id: entry };
15
+ }
16
+ return entry;
17
+ });
18
+ }
19
+ return value;
20
+ }
21
+ function normalizeActivityStream(meta) {
22
+ const stream = {
23
+ ...meta
24
+ };
25
+ for (const key of Object.keys(stringRefKeys)) {
26
+ if (key in stream) {
27
+ stream[key] = normalizeStringRef(stream[key], stringRefKeys[key]);
28
+ }
29
+ }
30
+ return stream;
31
+ }
32
+ export {
33
+ normalizeActivityStream
34
+ };
35
+
36
+ //# debugId=3EF61D1A83F2BA1264756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/activity-stream-helper.ts"],
4
+ "sourcesContent": [
5
+ "import type { ActivityStream } from \"./types.js\";\n\nconst stringRefKeys = {\n actor: \"id\",\n target: \"id\",\n object: \"content\",\n} as const;\n\ntype StreamPartKey = keyof typeof stringRefKeys;\n\nfunction normalizeStringRef(value: unknown, primaryKey: string): unknown {\n if (typeof value === \"string\") {\n return { [primaryKey]: value };\n }\n if (Array.isArray(value)) {\n return value.map((entry) => {\n if (typeof entry === \"string\") {\n return { id: entry };\n }\n return entry;\n });\n }\n return value;\n}\n\n/**\n * Normalize string actor/target/object refs into minimal ActivityObjects.\n */\nexport function normalizeActivityStream(meta: ActivityStream): ActivityStream {\n const stream: Record<string, unknown> = {\n ...(meta as unknown as Record<string, unknown>),\n };\n for (const key of Object.keys(stringRefKeys) as StreamPartKey[]) {\n if (key in stream) {\n stream[key] = normalizeStringRef(stream[key], stringRefKeys[key]);\n }\n }\n return stream as ActivityStream;\n}\n"
6
+ ],
7
+ "mappings": ";AAEA,IAAM,gBAAgB;AAAA,EAClB,OAAO;AAAA,EACP,QAAQ;AAAA,EACR,QAAQ;AACZ;AAIA,SAAS,kBAAkB,CAAC,OAAgB,YAA6B;AAAA,EACrE,IAAI,OAAO,UAAU,UAAU;AAAA,IAC3B,OAAO,GAAG,aAAa,MAAM;AAAA,EACjC;AAAA,EACA,IAAI,MAAM,QAAQ,KAAK,GAAG;AAAA,IACtB,OAAO,MAAM,IAAI,CAAC,UAAU;AAAA,MACxB,IAAI,OAAO,UAAU,UAAU;AAAA,QAC3B,OAAO,EAAE,IAAI,MAAM;AAAA,MACvB;AAAA,MACA,OAAO;AAAA,KACV;AAAA,EACL;AAAA,EACA,OAAO;AAAA;AAMJ,SAAS,uBAAuB,CAAC,MAAsC;AAAA,EAC1E,MAAM,SAAkC;AAAA,OAChC;AAAA,EACR;AAAA,EACA,WAAW,OAAO,OAAO,KAAK,aAAa,GAAsB;AAAA,IAC7D,IAAI,OAAO,QAAQ;AAAA,MACf,OAAO,OAAO,mBAAmB,OAAO,MAAM,cAAc,IAAI;AAAA,IACpE;AAAA,EACJ;AAAA,EACA,OAAO;AAAA;",
8
+ "debugId": "3EF61D1A83F2BA1264756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,56 @@
1
+ import type { ActivityStream, JsonLdContext } from "./types.js";
2
+ /**
3
+ * Canonical AS2 base vocabulary URL.
4
+ */
5
+ export declare const AS2_BASE_CONTEXT_URL = "https://www.w3.org/ns/activitystreams";
6
+ /**
7
+ * Sockethub base vocabulary URL for shared platform terms.
8
+ */
9
+ export declare const SOCKETHUB_BASE_CONTEXT_URL = "https://sockethub.org/ns/context/v1.jsonld";
10
+ /**
11
+ * URL prefix for per-platform context URLs.
12
+ */
13
+ export declare const PLATFORM_CONTEXT_PREFIX = "https://sockethub.org/ns/context/platform/";
14
+ /**
15
+ * Built-in pseudo-platform used for server-side error payloads.
16
+ */
17
+ export declare const ERROR_PLATFORM_ID = "error";
18
+ export declare const ERROR_PLATFORM_CONTEXT_URL = "https://sockethub.org/ns/context/platform/error/v1.jsonld";
19
+ /**
20
+ * Built-in pseudo-platform used for internal control messages.
21
+ */
22
+ export declare const INTERNAL_PLATFORM_ID = "sockethub:internal";
23
+ export declare const INTERNAL_PLATFORM_CONTEXT_URL = "https://sockethub.org/ns/context/platform/sockethub:internal/v1.jsonld";
24
+ /**
25
+ * Build the canonical Sockethub @context array from a platform id or full context URL.
26
+ */
27
+ export declare function buildCanonicalContext(platform: string): JsonLdContext;
28
+ /**
29
+ * Extract the platform ID from a canonical @context array.
30
+ */
31
+ export declare function platformIdFromContext(context: string[] | unknown): string | undefined;
32
+ /**
33
+ * Get a normalized @context array from an activity stream.
34
+ */
35
+ export declare function getContextArray(msg: ActivityStream): Array<string>;
36
+ /**
37
+ * Register a platform context URL and its schema IDs for runtime resolution.
38
+ */
39
+ export declare function registerPlatformContext(platformId: string, platformContextUrl: string, schemaId: string, credentialsSchemaId: string): void;
40
+ /**
41
+ * Resolve the single registered platform context URL from a message.
42
+ * Returns null when there are zero or multiple registered platform contexts.
43
+ */
44
+ export declare function resolvePlatformContextUrl(msg: ActivityStream): string | null;
45
+ /**
46
+ * Resolve a platform ID from a platform context URL.
47
+ */
48
+ export declare function getPlatformIdByContextUrl(platformContextUrl: string): string | undefined;
49
+ /**
50
+ * Resolve a message schema ID from a platform context URL.
51
+ */
52
+ export declare function getSchemaIdByContextUrl(platformContextUrl: string): string | undefined;
53
+ /**
54
+ * Resolve a credentials schema ID from a platform context URL.
55
+ */
56
+ export declare function getCredentialsSchemaIdByContextUrl(platformContextUrl: string): string | undefined;
@@ -0,0 +1,80 @@
1
+ // src/context.ts
2
+ var AS2_BASE_CONTEXT_URL = "https://www.w3.org/ns/activitystreams";
3
+ var SOCKETHUB_BASE_CONTEXT_URL = "https://sockethub.org/ns/context/v1.jsonld";
4
+ var PLATFORM_CONTEXT_PREFIX = "https://sockethub.org/ns/context/platform/";
5
+ var ERROR_PLATFORM_ID = "error";
6
+ var ERROR_PLATFORM_CONTEXT_URL = "https://sockethub.org/ns/context/platform/error/v1.jsonld";
7
+ var INTERNAL_PLATFORM_ID = "sockethub:internal";
8
+ var INTERNAL_PLATFORM_CONTEXT_URL = "https://sockethub.org/ns/context/platform/sockethub:internal/v1.jsonld";
9
+ var platformContextToPlatformId = new Map;
10
+ var platformContextToSchemaId = new Map;
11
+ var platformContextToCredentialsSchemaId = new Map;
12
+ function buildCanonicalContext(platform) {
13
+ const platformUrl = platform.startsWith("https://") ? platform : `${PLATFORM_CONTEXT_PREFIX}${platform}/v1.jsonld`;
14
+ return [AS2_BASE_CONTEXT_URL, SOCKETHUB_BASE_CONTEXT_URL, platformUrl];
15
+ }
16
+ function platformIdFromContext(context) {
17
+ if (!Array.isArray(context)) {
18
+ return;
19
+ }
20
+ for (const entry of context) {
21
+ if (typeof entry === "string" && entry.startsWith(PLATFORM_CONTEXT_PREFIX)) {
22
+ const rest = entry.slice(PLATFORM_CONTEXT_PREFIX.length);
23
+ const slashIdx = rest.indexOf("/");
24
+ if (slashIdx > 0) {
25
+ return rest.slice(0, slashIdx);
26
+ }
27
+ }
28
+ }
29
+ return;
30
+ }
31
+ function normalizeContextArray(value) {
32
+ if (!Array.isArray(value)) {
33
+ return [];
34
+ }
35
+ return value.filter((entry) => typeof entry === "string");
36
+ }
37
+ function getContextArray(msg) {
38
+ return normalizeContextArray(msg["@context"]);
39
+ }
40
+ function registerPlatformContext(platformId, platformContextUrl, schemaId, credentialsSchemaId) {
41
+ platformContextToPlatformId.set(platformContextUrl, platformId);
42
+ platformContextToSchemaId.set(platformContextUrl, schemaId);
43
+ platformContextToCredentialsSchemaId.set(platformContextUrl, credentialsSchemaId);
44
+ }
45
+ function resolvePlatformContextUrl(msg) {
46
+ const contexts = getContextArray(msg);
47
+ const matches = contexts.filter((contextUrl) => platformContextToPlatformId.has(contextUrl));
48
+ if (matches.length !== 1) {
49
+ return null;
50
+ }
51
+ return matches[0];
52
+ }
53
+ function getPlatformIdByContextUrl(platformContextUrl) {
54
+ return platformContextToPlatformId.get(platformContextUrl);
55
+ }
56
+ function getSchemaIdByContextUrl(platformContextUrl) {
57
+ return platformContextToSchemaId.get(platformContextUrl);
58
+ }
59
+ function getCredentialsSchemaIdByContextUrl(platformContextUrl) {
60
+ return platformContextToCredentialsSchemaId.get(platformContextUrl);
61
+ }
62
+ export {
63
+ AS2_BASE_CONTEXT_URL,
64
+ ERROR_PLATFORM_CONTEXT_URL,
65
+ ERROR_PLATFORM_ID,
66
+ INTERNAL_PLATFORM_CONTEXT_URL,
67
+ INTERNAL_PLATFORM_ID,
68
+ PLATFORM_CONTEXT_PREFIX,
69
+ SOCKETHUB_BASE_CONTEXT_URL,
70
+ buildCanonicalContext,
71
+ getContextArray,
72
+ getCredentialsSchemaIdByContextUrl,
73
+ getPlatformIdByContextUrl,
74
+ getSchemaIdByContextUrl,
75
+ platformIdFromContext,
76
+ registerPlatformContext,
77
+ resolvePlatformContextUrl
78
+ };
79
+
80
+ //# debugId=6A90853B4DB425E264756E2164756E21
@@ -0,0 +1,10 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../src/context.ts"],
4
+ "sourcesContent": [
5
+ "import type { ActivityStream, JsonLdContext } from \"./types.js\";\n\n/**\n * Canonical AS2 base vocabulary URL.\n */\nexport const AS2_BASE_CONTEXT_URL = \"https://www.w3.org/ns/activitystreams\";\n\n/**\n * Sockethub base vocabulary URL for shared platform terms.\n */\nexport const SOCKETHUB_BASE_CONTEXT_URL =\n \"https://sockethub.org/ns/context/v1.jsonld\";\n\n/**\n * URL prefix for per-platform context URLs.\n */\nexport const PLATFORM_CONTEXT_PREFIX =\n \"https://sockethub.org/ns/context/platform/\";\n\n/**\n * Built-in pseudo-platform used for server-side error payloads.\n */\nexport const ERROR_PLATFORM_ID = \"error\";\nexport const ERROR_PLATFORM_CONTEXT_URL =\n \"https://sockethub.org/ns/context/platform/error/v1.jsonld\";\n\n/**\n * Built-in pseudo-platform used for internal control messages.\n */\nexport const INTERNAL_PLATFORM_ID = \"sockethub:internal\";\nexport const INTERNAL_PLATFORM_CONTEXT_URL =\n \"https://sockethub.org/ns/context/platform/sockethub:internal/v1.jsonld\";\n\nconst platformContextToPlatformId = new Map<string, string>();\nconst platformContextToSchemaId = new Map<string, string>();\nconst platformContextToCredentialsSchemaId = new Map<string, string>();\n\n/**\n * Build the canonical Sockethub @context array from a platform id or full context URL.\n */\nexport function buildCanonicalContext(platform: string): JsonLdContext {\n const platformUrl = platform.startsWith(\"https://\")\n ? platform\n : `${PLATFORM_CONTEXT_PREFIX}${platform}/v1.jsonld`;\n return [AS2_BASE_CONTEXT_URL, SOCKETHUB_BASE_CONTEXT_URL, platformUrl];\n}\n\n/**\n * Extract the platform ID from a canonical @context array.\n */\nexport function platformIdFromContext(\n context: string[] | unknown,\n): string | undefined {\n if (!Array.isArray(context)) {\n return undefined;\n }\n for (const entry of context) {\n if (\n typeof entry === \"string\" &&\n entry.startsWith(PLATFORM_CONTEXT_PREFIX)\n ) {\n const rest = entry.slice(PLATFORM_CONTEXT_PREFIX.length);\n const slashIdx = rest.indexOf(\"/\");\n if (slashIdx > 0) {\n return rest.slice(0, slashIdx);\n }\n }\n }\n return undefined;\n}\n\n/**\n * Normalize unknown @context input into a string-only array.\n */\nfunction normalizeContextArray(value: unknown): Array<string> {\n if (!Array.isArray(value)) {\n return [];\n }\n return value.filter((entry): entry is string => typeof entry === \"string\");\n}\n\n/**\n * Get a normalized @context array from an activity stream.\n */\nexport function getContextArray(msg: ActivityStream): Array<string> {\n return normalizeContextArray(msg[\"@context\"]);\n}\n\n/**\n * Register a platform context URL and its schema IDs for runtime resolution.\n */\nexport function registerPlatformContext(\n platformId: string,\n platformContextUrl: string,\n schemaId: string,\n credentialsSchemaId: string,\n) {\n platformContextToPlatformId.set(platformContextUrl, platformId);\n platformContextToSchemaId.set(platformContextUrl, schemaId);\n platformContextToCredentialsSchemaId.set(\n platformContextUrl,\n credentialsSchemaId,\n );\n}\n\n/**\n * Resolve the single registered platform context URL from a message.\n * Returns null when there are zero or multiple registered platform contexts.\n */\nexport function resolvePlatformContextUrl(msg: ActivityStream): string | null {\n const contexts = getContextArray(msg);\n const matches = contexts.filter((contextUrl) =>\n platformContextToPlatformId.has(contextUrl),\n );\n if (matches.length !== 1) {\n return null;\n }\n return matches[0];\n}\n\n/**\n * Resolve a platform ID from a platform context URL.\n */\nexport function getPlatformIdByContextUrl(\n platformContextUrl: string,\n): string | undefined {\n return platformContextToPlatformId.get(platformContextUrl);\n}\n\n/**\n * Resolve a message schema ID from a platform context URL.\n */\nexport function getSchemaIdByContextUrl(\n platformContextUrl: string,\n): string | undefined {\n return platformContextToSchemaId.get(platformContextUrl);\n}\n\n/**\n * Resolve a credentials schema ID from a platform context URL.\n */\nexport function getCredentialsSchemaIdByContextUrl(\n platformContextUrl: string,\n): string | undefined {\n return platformContextToCredentialsSchemaId.get(platformContextUrl);\n}\n"
6
+ ],
7
+ "mappings": ";AAKO,IAAM,uBAAuB;AAK7B,IAAM,6BACT;AAKG,IAAM,0BACT;AAKG,IAAM,oBAAoB;AAC1B,IAAM,6BACT;AAKG,IAAM,uBAAuB;AAC7B,IAAM,gCACT;AAEJ,IAAM,8BAA8B,IAAI;AACxC,IAAM,4BAA4B,IAAI;AACtC,IAAM,uCAAuC,IAAI;AAK1C,SAAS,qBAAqB,CAAC,UAAiC;AAAA,EACnE,MAAM,cAAc,SAAS,WAAW,UAAU,IAC5C,WACA,GAAG,0BAA0B;AAAA,EACnC,OAAO,CAAC,sBAAsB,4BAA4B,WAAW;AAAA;AAMlE,SAAS,qBAAqB,CACjC,SACkB;AAAA,EAClB,IAAI,CAAC,MAAM,QAAQ,OAAO,GAAG;AAAA,IACzB;AAAA,EACJ;AAAA,EACA,WAAW,SAAS,SAAS;AAAA,IACzB,IACI,OAAO,UAAU,YACjB,MAAM,WAAW,uBAAuB,GAC1C;AAAA,MACE,MAAM,OAAO,MAAM,MAAM,wBAAwB,MAAM;AAAA,MACvD,MAAM,WAAW,KAAK,QAAQ,GAAG;AAAA,MACjC,IAAI,WAAW,GAAG;AAAA,QACd,OAAO,KAAK,MAAM,GAAG,QAAQ;AAAA,MACjC;AAAA,IACJ;AAAA,EACJ;AAAA,EACA;AAAA;AAMJ,SAAS,qBAAqB,CAAC,OAA+B;AAAA,EAC1D,IAAI,CAAC,MAAM,QAAQ,KAAK,GAAG;AAAA,IACvB,OAAO,CAAC;AAAA,EACZ;AAAA,EACA,OAAO,MAAM,OAAO,CAAC,UAA2B,OAAO,UAAU,QAAQ;AAAA;AAMtE,SAAS,eAAe,CAAC,KAAoC;AAAA,EAChE,OAAO,sBAAsB,IAAI,WAAW;AAAA;AAMzC,SAAS,uBAAuB,CACnC,YACA,oBACA,UACA,qBACF;AAAA,EACE,4BAA4B,IAAI,oBAAoB,UAAU;AAAA,EAC9D,0BAA0B,IAAI,oBAAoB,QAAQ;AAAA,EAC1D,qCAAqC,IACjC,oBACA,mBACJ;AAAA;AAOG,SAAS,yBAAyB,CAAC,KAAoC;AAAA,EAC1E,MAAM,WAAW,gBAAgB,GAAG;AAAA,EACpC,MAAM,UAAU,SAAS,OAAO,CAAC,eAC7B,4BAA4B,IAAI,UAAU,CAC9C;AAAA,EACA,IAAI,QAAQ,WAAW,GAAG;AAAA,IACtB,OAAO;AAAA,EACX;AAAA,EACA,OAAO,QAAQ;AAAA;AAMZ,SAAS,yBAAyB,CACrC,oBACkB;AAAA,EAClB,OAAO,4BAA4B,IAAI,kBAAkB;AAAA;AAMtD,SAAS,uBAAuB,CACnC,oBACkB;AAAA,EAClB,OAAO,0BAA0B,IAAI,kBAAkB;AAAA;AAMpD,SAAS,kCAAkC,CAC9C,oBACkB;AAAA,EAClB,OAAO,qCAAqC,IAAI,kBAAkB;AAAA;",
8
+ "debugId": "6A90853B4DB425E264756E2164756E21",
9
+ "names": []
10
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "@context": {
3
+ "as": "https://www.w3.org/ns/activitystreams#",
4
+ "sh": "https://sockethub.org/ns#",
5
+ "platform": "sh:platform",
6
+ "caldavType": "sh:caldavType"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "@context": {
3
+ "as": "https://www.w3.org/ns/activitystreams#",
4
+ "sh": "https://sockethub.org/ns#",
5
+ "platform": "sh:platform",
6
+ "carddavType": "sh:carddavType"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "@context": {
3
+ "as": "https://www.w3.org/ns/activitystreams#",
4
+ "sh": "https://sockethub.org/ns#",
5
+ "platform": "sh:platform",
6
+ "dummyType": "sh:dummyType"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "@context": {
3
+ "as": "https://www.w3.org/ns/activitystreams#",
4
+ "sh": "https://sockethub.org/ns#",
5
+ "platform": "sh:platform",
6
+ "errorType": "sh:errorType"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "@context": {
3
+ "as": "https://www.w3.org/ns/activitystreams#",
4
+ "sh": "https://sockethub.org/ns#",
5
+ "platform": "sh:platform",
6
+ "feedsType": "sh:feedsType"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "@context": {
3
+ "as": "https://www.w3.org/ns/activitystreams#",
4
+ "sh": "https://sockethub.org/ns#",
5
+ "platform": "sh:platform",
6
+ "ircType": "sh:ircType"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "@context": {
3
+ "as": "https://www.w3.org/ns/activitystreams#",
4
+ "sh": "https://sockethub.org/ns#",
5
+ "platform": "sh:platform",
6
+ "metadataType": "sh:metadataType"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "@context": {
3
+ "as": "https://www.w3.org/ns/activitystreams#",
4
+ "sh": "https://sockethub.org/ns#",
5
+ "platform": "sh:platform",
6
+ "sockethub:internalType": "sh:sockethub:internalType"
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "@context": {
3
+ "as": "https://www.w3.org/ns/activitystreams#",
4
+ "sh": "https://sockethub.org/ns#",
5
+ "platform": "sh:platform",
6
+ "xmppType": "sh:xmppType"
7
+ }
8
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "@context": {
3
+ "as": "https://www.w3.org/ns/activitystreams#",
4
+ "sh": "https://sockethub.org/ns#",
5
+ "platform": "sh:platform"
6
+ }
7
+ }
@@ -0,0 +1,13 @@
1
+ import type { ErrorObject } from "ajv";
2
+ import type { ActivityObject, ActivityStream } from "../types.js";
3
+ export interface ValidationErrorOptions {
4
+ excludeTypes?: Array<string>;
5
+ }
6
+ /**
7
+ * Traverses the errors array from ajv, and makes a series of filtering decisions to
8
+ * try to arrive at the most useful error.
9
+ * @param msg
10
+ * @param errors
11
+ * @returns {string}
12
+ */
13
+ export default function getErrorMessage(msg: ActivityStream | ActivityObject, errors: Array<ErrorObject>, options?: ValidationErrorOptions): string;
@@ -0,0 +1,157 @@
1
+ export declare const ObjectTypesSchema: {
2
+ feed: {
3
+ required: string[];
4
+ additionalProperties: boolean;
5
+ properties: {
6
+ type: {
7
+ enum: string[];
8
+ };
9
+ id: {
10
+ type: string;
11
+ format: string;
12
+ };
13
+ name: {
14
+ type: string;
15
+ };
16
+ description: {
17
+ type: string;
18
+ };
19
+ author: {
20
+ type: string;
21
+ };
22
+ favicon: {
23
+ type: string;
24
+ };
25
+ };
26
+ };
27
+ person: {
28
+ required: string[];
29
+ additionalProperties: boolean;
30
+ properties: {
31
+ id: {
32
+ type: string;
33
+ };
34
+ type: {
35
+ enum: string[];
36
+ };
37
+ name: {
38
+ type: string;
39
+ };
40
+ };
41
+ };
42
+ room: {
43
+ required: string[];
44
+ additionalProperties: boolean;
45
+ properties: {
46
+ id: {
47
+ type: string;
48
+ };
49
+ type: {
50
+ enum: string[];
51
+ };
52
+ name: {
53
+ type: string;
54
+ };
55
+ };
56
+ };
57
+ service: {
58
+ required: string[];
59
+ additionalProperties: boolean;
60
+ properties: {
61
+ id: {
62
+ type: string;
63
+ };
64
+ type: {
65
+ enum: string[];
66
+ };
67
+ name: {
68
+ type: string;
69
+ };
70
+ };
71
+ };
72
+ platform: {
73
+ required: string[];
74
+ additionalProperties: boolean;
75
+ properties: {
76
+ id: {
77
+ type: string;
78
+ };
79
+ type: {
80
+ enum: string[];
81
+ };
82
+ name: {
83
+ type: string;
84
+ };
85
+ };
86
+ };
87
+ website: {
88
+ required: string[];
89
+ additionalProperties: boolean;
90
+ properties: {
91
+ id: {
92
+ type: string;
93
+ format: string;
94
+ };
95
+ type: {
96
+ enum: string[];
97
+ };
98
+ name: {
99
+ type: string;
100
+ };
101
+ };
102
+ };
103
+ address: {
104
+ required: string[];
105
+ additionalProperties: boolean;
106
+ properties: {
107
+ type: {
108
+ enum: string[];
109
+ };
110
+ };
111
+ };
112
+ calendar: {
113
+ required: string[];
114
+ additionalProperties: boolean;
115
+ properties: {
116
+ id: {
117
+ type: string;
118
+ format: string;
119
+ };
120
+ type: {
121
+ enum: string[];
122
+ };
123
+ name: {
124
+ type: string;
125
+ };
126
+ components: {
127
+ type: string;
128
+ items: {
129
+ enum: string[];
130
+ };
131
+ };
132
+ };
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
+ };
147
+ };
148
+ export declare const InternalObjectTypesList: string[];
149
+ export declare const ObjectTypesList: string[];
150
+ export declare const ActorTypesList: string[];
151
+ export declare const TargetTypesList: string[];
152
+ export declare const validActorRefs: {
153
+ $ref: string;
154
+ }[];
155
+ export declare const validTargetRefs: {
156
+ $ref: string;
157
+ }[];
@@ -0,0 +1,11 @@
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 { InternalObjectTypesList, ObjectTypesList, ObjectTypesSchema } from "./helpers/objects.js";
3
+ import { ActivityStreamSchema } from "./schemas/activity-stream.js";
4
+ import { PlatformSchema } from "./schemas/platform.js";
5
+ import { SockethubConfigSchema, SockethubConfigSchemaId } from "./schemas/sockethub-config.js";
6
+ import { type ServiceDescriptor, ServiceDescriptorSchema, type ServiceEndpoints, validateServiceDescriptor } from "./service-descriptor.js";
7
+ import { addPlatformContext, addPlatformSchema, getPlatformSchema, registerSystemPlatformContexts, resolvePlatformId, setValidationErrorOptions, validateActivityStream, validateActivityStreamResponse, validateCredentials, validatePlatformSchema, validateSockethubConfig } from "./validator.js";
8
+ export { normalizeActivityStream } from "./activity-stream-helper.js";
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, validateServiceDescriptor, validateSockethubConfig, setValidationErrorOptions, PlatformSchema, ServiceDescriptorSchema, ActivityStreamSchema, SockethubConfigSchema, SockethubConfigSchemaId, ObjectTypesList, ObjectTypesSchema, InternalObjectTypesList, };
10
+ export type { ServiceDescriptor, ServiceEndpoints };
11
+ export * from "./types.js";