@telorun/sdk 0.33.0 → 0.34.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.
package/dist/index.d.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./cancellation.js";
2
2
  export * from "./compiled-value.js";
3
3
  export * from "./capabilities/invokable.js";
4
4
  export * from "./ref.js";
5
+ export * from "./type-schema-ref.js";
5
6
  export * from "./invoke-step.js";
6
7
  export * from "./dispatch-invoke-ref.js";
7
8
  export * from "./capabilities/provider.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,UAAU,CAAC;AACzB,cAAc,sBAAsB,CAAC;AACrC,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,uBAAuB,CAAC;AACtC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@ export * from "./cancellation.js";
2
2
  export * from "./compiled-value.js";
3
3
  export * from "./capabilities/invokable.js";
4
4
  export * from "./ref.js";
5
+ export * from "./type-schema-ref.js";
5
6
  export * from "./invoke-step.js";
6
7
  export * from "./dispatch-invoke-ref.js";
7
8
  export * from "./capabilities/provider.js";
@@ -0,0 +1,28 @@
1
+ /**
2
+ * Module-scoped schema references for JSON Schema `$ref`.
3
+ *
4
+ * A `Type.JsonSchema` (or any `Telo.Type`) resource registers its schema under a
5
+ * canonical URI `$id` of `telo://<module>/<typeName>`, so other schemas can
6
+ * reference it with a standard JSON Schema `$ref`. Authors write the reference
7
+ * through an import — `telo://Self/<typeName>` for the declaring module's own
8
+ * type, or `telo://<Alias>/<typeName>` for an imported module's type — and the
9
+ * loader rewrites the authority (`Self` / alias) to the resolved module name.
10
+ * The version is carried by the `imports:` entry, never by the URI: only the
11
+ * pinned version is ever loaded, so the canonical id stays version-free.
12
+ */
13
+ export declare const TELO_TYPE_SCHEME = "telo://";
14
+ /** The canonical, alias-resolved `$id` a named type schema is registered under. */
15
+ export declare function canonicalTypeSchemaId(moduleName: string, typeName: string): string;
16
+ /** Parsed parts of a `telo://<authority>/<typeName>` schema reference. */
17
+ export interface TeloTypeRef {
18
+ authority: string;
19
+ typeName: string;
20
+ }
21
+ /**
22
+ * Parse a `telo://<authority>/<typeName>` schema `$ref`. Returns null for any
23
+ * other string — notably fragment-bearing built-ins like
24
+ * `telo://manifest#/$defs/ResourceRef`, which carry no `authority/type` path and
25
+ * must be left untouched.
26
+ */
27
+ export declare function parseTeloTypeRef(ref: unknown): TeloTypeRef | null;
28
+ //# sourceMappingURL=type-schema-ref.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"type-schema-ref.d.ts","sourceRoot":"","sources":["../src/type-schema-ref.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C,mFAAmF;AACnF,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAElF;AAED,0EAA0E;AAC1E,MAAM,WAAW,WAAW;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,OAAO,GAAG,WAAW,GAAG,IAAI,CAKjE"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Module-scoped schema references for JSON Schema `$ref`.
3
+ *
4
+ * A `Type.JsonSchema` (or any `Telo.Type`) resource registers its schema under a
5
+ * canonical URI `$id` of `telo://<module>/<typeName>`, so other schemas can
6
+ * reference it with a standard JSON Schema `$ref`. Authors write the reference
7
+ * through an import — `telo://Self/<typeName>` for the declaring module's own
8
+ * type, or `telo://<Alias>/<typeName>` for an imported module's type — and the
9
+ * loader rewrites the authority (`Self` / alias) to the resolved module name.
10
+ * The version is carried by the `imports:` entry, never by the URI: only the
11
+ * pinned version is ever loaded, so the canonical id stays version-free.
12
+ */
13
+ export const TELO_TYPE_SCHEME = "telo://";
14
+ /** The canonical, alias-resolved `$id` a named type schema is registered under. */
15
+ export function canonicalTypeSchemaId(moduleName, typeName) {
16
+ return `${TELO_TYPE_SCHEME}${moduleName}/${typeName}`;
17
+ }
18
+ /**
19
+ * Parse a `telo://<authority>/<typeName>` schema `$ref`. Returns null for any
20
+ * other string — notably fragment-bearing built-ins like
21
+ * `telo://manifest#/$defs/ResourceRef`, which carry no `authority/type` path and
22
+ * must be left untouched.
23
+ */
24
+ export function parseTeloTypeRef(ref) {
25
+ if (typeof ref !== "string")
26
+ return null;
27
+ const match = /^telo:\/\/([^/#]+)\/([^#/]+)$/.exec(ref);
28
+ if (!match)
29
+ return null;
30
+ return { authority: match[1], typeName: match[2] };
31
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@telorun/sdk",
3
- "version": "0.33.0",
3
+ "version": "0.34.0",
4
4
  "description": "Telo SDK - Public API for Telo module authors.",
5
5
  "keywords": [
6
6
  "telo",
package/src/index.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./cancellation.js";
2
2
  export * from "./compiled-value.js";
3
3
  export * from "./capabilities/invokable.js";
4
4
  export * from "./ref.js";
5
+ export * from "./type-schema-ref.js";
5
6
  export * from "./invoke-step.js";
6
7
  export * from "./dispatch-invoke-ref.js";
7
8
  export * from "./capabilities/provider.js";
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Module-scoped schema references for JSON Schema `$ref`.
3
+ *
4
+ * A `Type.JsonSchema` (or any `Telo.Type`) resource registers its schema under a
5
+ * canonical URI `$id` of `telo://<module>/<typeName>`, so other schemas can
6
+ * reference it with a standard JSON Schema `$ref`. Authors write the reference
7
+ * through an import — `telo://Self/<typeName>` for the declaring module's own
8
+ * type, or `telo://<Alias>/<typeName>` for an imported module's type — and the
9
+ * loader rewrites the authority (`Self` / alias) to the resolved module name.
10
+ * The version is carried by the `imports:` entry, never by the URI: only the
11
+ * pinned version is ever loaded, so the canonical id stays version-free.
12
+ */
13
+
14
+ export const TELO_TYPE_SCHEME = "telo://";
15
+
16
+ /** The canonical, alias-resolved `$id` a named type schema is registered under. */
17
+ export function canonicalTypeSchemaId(moduleName: string, typeName: string): string {
18
+ return `${TELO_TYPE_SCHEME}${moduleName}/${typeName}`;
19
+ }
20
+
21
+ /** Parsed parts of a `telo://<authority>/<typeName>` schema reference. */
22
+ export interface TeloTypeRef {
23
+ authority: string;
24
+ typeName: string;
25
+ }
26
+
27
+ /**
28
+ * Parse a `telo://<authority>/<typeName>` schema `$ref`. Returns null for any
29
+ * other string — notably fragment-bearing built-ins like
30
+ * `telo://manifest#/$defs/ResourceRef`, which carry no `authority/type` path and
31
+ * must be left untouched.
32
+ */
33
+ export function parseTeloTypeRef(ref: unknown): TeloTypeRef | null {
34
+ if (typeof ref !== "string") return null;
35
+ const match = /^telo:\/\/([^/#]+)\/([^#/]+)$/.exec(ref);
36
+ if (!match) return null;
37
+ return { authority: match[1], typeName: match[2] };
38
+ }