@sockethub/schemas 3.0.0-alpha.24 → 3.0.0-alpha.25
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.
- package/dist/activity-stream-helper.js +1 -35
- package/dist/activity-stream-helper.js.map +2 -2
- package/dist/context.js +1 -35
- package/dist/context.js.map +2 -2
- package/dist/examples-config.js +25 -16
- package/dist/examples-config.js.map +3 -3
- package/dist/index.d.ts +3 -2
- package/dist/index.js +188 -128
- package/dist/index.js.map +6 -4
- package/dist/maps/context-map.json +2 -2
- package/dist/object-types.js +1 -37
- package/dist/object-types.js.map +2 -2
- package/dist/schemas/examples-config.d.ts +17 -0
- package/dist/schemas/json/activity-stream.json +1 -1
- package/dist/schemas/json/examples-config.json +17 -1
- package/dist/schemas/json/platform.json +1 -1
- package/dist/schemas/json/service-descriptor.json +41 -0
- package/dist/schemas/json/sockethub-config.json +1 -1
- package/dist/schemas/platform/irc/v1/messages.schema.json +24 -0
- package/dist/schemas/service-descriptor.d.ts +47 -0
- package/dist/service-descriptor.d.ts +4 -0
- package/dist/service-descriptor.js +6266 -0
- package/dist/service-descriptor.js.map +77 -0
- package/package.json +12 -3
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
function __accessProp(key) {
|
|
7
|
-
return this[key];
|
|
8
|
-
}
|
|
9
|
-
var __toESMCache_node;
|
|
10
|
-
var __toESMCache_esm;
|
|
11
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
12
|
-
var canCache = mod != null && typeof mod === "object";
|
|
13
|
-
if (canCache) {
|
|
14
|
-
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
15
|
-
var cached = cache.get(mod);
|
|
16
|
-
if (cached)
|
|
17
|
-
return cached;
|
|
18
|
-
}
|
|
19
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
20
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
21
|
-
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(mod))
|
|
23
|
-
if (!__hasOwnProp.call(to, key))
|
|
24
|
-
__defProp(to, key, {
|
|
25
|
-
get: __accessProp.bind(mod, key),
|
|
26
|
-
enumerable: true
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
if (canCache)
|
|
30
|
-
cache.set(mod, to);
|
|
31
|
-
return to;
|
|
32
|
-
};
|
|
33
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
-
|
|
35
1
|
// src/activity-stream-helper.ts
|
|
36
2
|
var stringRefKeys = {
|
|
37
3
|
actor: "id",
|
|
@@ -67,4 +33,4 @@ export {
|
|
|
67
33
|
normalizeActivityStream
|
|
68
34
|
};
|
|
69
35
|
|
|
70
|
-
//# debugId=
|
|
36
|
+
//# debugId=3EF61D1A83F2BA1264756E2164756E21
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
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
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
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
9
|
"names": []
|
|
10
10
|
}
|
package/dist/context.js
CHANGED
|
@@ -1,37 +1,3 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
function __accessProp(key) {
|
|
7
|
-
return this[key];
|
|
8
|
-
}
|
|
9
|
-
var __toESMCache_node;
|
|
10
|
-
var __toESMCache_esm;
|
|
11
|
-
var __toESM = (mod, isNodeMode, target) => {
|
|
12
|
-
var canCache = mod != null && typeof mod === "object";
|
|
13
|
-
if (canCache) {
|
|
14
|
-
var cache = isNodeMode ? __toESMCache_node ??= new WeakMap : __toESMCache_esm ??= new WeakMap;
|
|
15
|
-
var cached = cache.get(mod);
|
|
16
|
-
if (cached)
|
|
17
|
-
return cached;
|
|
18
|
-
}
|
|
19
|
-
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
20
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
21
|
-
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
22
|
-
for (let key of __getOwnPropNames(mod))
|
|
23
|
-
if (!__hasOwnProp.call(to, key))
|
|
24
|
-
__defProp(to, key, {
|
|
25
|
-
get: __accessProp.bind(mod, key),
|
|
26
|
-
enumerable: true
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
if (canCache)
|
|
30
|
-
cache.set(mod, to);
|
|
31
|
-
return to;
|
|
32
|
-
};
|
|
33
|
-
var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
34
|
-
|
|
35
1
|
// src/context.ts
|
|
36
2
|
var AS2_BASE_CONTEXT_URL = "https://www.w3.org/ns/activitystreams";
|
|
37
3
|
var SOCKETHUB_BASE_CONTEXT_URL = "https://sockethub.org/ns/context/v1.jsonld";
|
|
@@ -111,4 +77,4 @@ export {
|
|
|
111
77
|
resolvePlatformContextUrl
|
|
112
78
|
};
|
|
113
79
|
|
|
114
|
-
//# debugId=
|
|
80
|
+
//# debugId=6A90853B4DB425E264756E2164756E21
|
package/dist/context.js.map
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"sourcesContent": [
|
|
5
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
6
|
],
|
|
7
|
-
"mappings": "
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";AAKO,IAAM,uBAAuB;AAK7B,IAAM,6BACT;AAKG,IAAM,0BACT;AAKG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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
9
|
"names": []
|
|
10
10
|
}
|
package/dist/examples-config.js
CHANGED
|
@@ -17,7 +17,7 @@ var __toESM = (mod, isNodeMode, target) => {
|
|
|
17
17
|
return cached;
|
|
18
18
|
}
|
|
19
19
|
target = mod != null ? __create(__getProtoOf(mod)) : {};
|
|
20
|
-
const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
20
|
+
const to = isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
|
|
21
21
|
if (mod && typeof mod === "object" || typeof mod === "function") {
|
|
22
22
|
for (let key of __getOwnPropNames(mod))
|
|
23
23
|
if (!__hasOwnProp.call(to, key))
|
|
@@ -199,9 +199,9 @@ var require_scope = __commonJS(function(exports) {
|
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
201
|
var UsedValueState;
|
|
202
|
-
(function(
|
|
203
|
-
|
|
204
|
-
|
|
202
|
+
(function(UsedValueState) {
|
|
203
|
+
UsedValueState[UsedValueState["Started"] = 0] = "Started";
|
|
204
|
+
UsedValueState[UsedValueState["Completed"] = 1] = "Completed";
|
|
205
205
|
})(UsedValueState || (exports.UsedValueState = UsedValueState = {}));
|
|
206
206
|
exports.varKinds = {
|
|
207
207
|
const: new code_1.Name("const"),
|
|
@@ -1183,9 +1183,9 @@ var require_util = __commonJS(function(exports) {
|
|
|
1183
1183
|
}
|
|
1184
1184
|
exports.useFunc = useFunc;
|
|
1185
1185
|
var Type;
|
|
1186
|
-
(function(
|
|
1187
|
-
|
|
1188
|
-
|
|
1186
|
+
(function(Type) {
|
|
1187
|
+
Type[Type["Num"] = 0] = "Num";
|
|
1188
|
+
Type[Type["Str"] = 1] = "Str";
|
|
1189
1189
|
})(Type || (exports.Type = Type = {}));
|
|
1190
1190
|
function getErrorPath(dataProp, dataPropType, jsPropertySyntax) {
|
|
1191
1191
|
if (dataProp instanceof codegen_1.Name) {
|
|
@@ -1455,9 +1455,9 @@ var require_dataType = __commonJS(function(exports) {
|
|
|
1455
1455
|
var codegen_1 = require_codegen();
|
|
1456
1456
|
var util_1 = require_util();
|
|
1457
1457
|
var DataType;
|
|
1458
|
-
(function(
|
|
1459
|
-
|
|
1460
|
-
|
|
1458
|
+
(function(DataType) {
|
|
1459
|
+
DataType[DataType["Correct"] = 0] = "Correct";
|
|
1460
|
+
DataType[DataType["Wrong"] = 1] = "Wrong";
|
|
1461
1461
|
})(DataType || (exports.DataType = DataType = {}));
|
|
1462
1462
|
function getSchemaTypes(schema) {
|
|
1463
1463
|
const types = getJSONTypes(schema.type);
|
|
@@ -1853,8 +1853,8 @@ var require_keyword = __commonJS(function(exports) {
|
|
|
1853
1853
|
gen.assign(valid, (0, codegen_1._)`${_await}${(0, code_1.callValidateCode)(cxt, validateRef, passCxt, passSchema)}`, def.modifying);
|
|
1854
1854
|
}
|
|
1855
1855
|
function reportErrs(errors) {
|
|
1856
|
-
var
|
|
1857
|
-
gen.if((0, codegen_1.not)((
|
|
1856
|
+
var _a;
|
|
1857
|
+
gen.if((0, codegen_1.not)((_a = def.valid) !== null && _a !== undefined ? _a : valid), errors);
|
|
1858
1858
|
}
|
|
1859
1859
|
}
|
|
1860
1860
|
exports.funcKeywordCode = funcKeywordCode;
|
|
@@ -5888,9 +5888,9 @@ var require_types = __commonJS(function(exports) {
|
|
|
5888
5888
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5889
5889
|
exports.DiscrError = undefined;
|
|
5890
5890
|
var DiscrError;
|
|
5891
|
-
(function(
|
|
5892
|
-
|
|
5893
|
-
|
|
5891
|
+
(function(DiscrError) {
|
|
5892
|
+
DiscrError["Tag"] = "tag";
|
|
5893
|
+
DiscrError["Mapping"] = "mapping";
|
|
5894
5894
|
})(DiscrError || (exports.DiscrError = DiscrError = {}));
|
|
5895
5895
|
});
|
|
5896
5896
|
|
|
@@ -6259,6 +6259,15 @@ var ExamplesConfigSchema = {
|
|
|
6259
6259
|
platforms: {
|
|
6260
6260
|
type: "array",
|
|
6261
6261
|
items: { type: "string" }
|
|
6262
|
+
},
|
|
6263
|
+
httpActions: {
|
|
6264
|
+
type: "object",
|
|
6265
|
+
required: ["enabled", "path"],
|
|
6266
|
+
additionalProperties: false,
|
|
6267
|
+
properties: {
|
|
6268
|
+
enabled: { type: "boolean" },
|
|
6269
|
+
path: { type: "string" }
|
|
6270
|
+
}
|
|
6262
6271
|
}
|
|
6263
6272
|
}
|
|
6264
6273
|
};
|
|
@@ -6275,4 +6284,4 @@ export {
|
|
|
6275
6284
|
validateExamplesConfig
|
|
6276
6285
|
};
|
|
6277
6286
|
|
|
6278
|
-
//# debugId=
|
|
6287
|
+
//# debugId=8CCFEFB75FEE691664756E2164756E21
|