@relkit/contracts 0.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 rel-kit
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,5 @@
1
+ # @relkit/contracts
2
+
3
+ Unsupported internal RELKIT contracts; use @relkit/app.
4
+
5
+ See [@relkit/app](https://github.com/rel-kit/relkit) for supported application APIs.
@@ -0,0 +1,38 @@
1
+ import { type DescriptorKind, type Ref } from "./id.js";
2
+ /** The shared runtime brand used by every RelKit descriptor factory. */
3
+ export declare const RELKIT_DESCRIPTOR: unique symbol;
4
+ /** Common serializable metadata shared by all public descriptors. */
5
+ export interface DescriptorMetadata {
6
+ readonly title?: string;
7
+ readonly description?: string;
8
+ readonly tags?: readonly string[];
9
+ }
10
+ /** The immutable common shape implemented by every public descriptor. */
11
+ export interface DescriptorBase<Kind extends DescriptorKind, Id extends string = string> extends DescriptorMetadata {
12
+ readonly [RELKIT_DESCRIPTOR]: true;
13
+ readonly kind: Kind;
14
+ readonly id: Id;
15
+ readonly ref: Ref<Kind, Id>;
16
+ }
17
+ /** A descriptor whose concrete kind and ID are not known by the caller. */
18
+ export type DescriptorAny = DescriptorBase<DescriptorKind, string>;
19
+ /** Creates a normalized immutable reference without deriving identity from a path. */
20
+ export declare function createRef<Kind extends DescriptorKind, Id extends string>(kind: Kind, id: Id): Ref<Kind, Id>;
21
+ /** Returns whether a value is a supported descriptor kind. */
22
+ export declare function isDescriptorKind(value: unknown): value is DescriptorKind;
23
+ /** Returns whether a value has the exact portable descriptor-reference shape. */
24
+ export declare function isRef(value: unknown): value is Ref<DescriptorKind, string>;
25
+ export declare function isRef<Kind extends DescriptorKind>(value: unknown, kind: Kind): value is Ref<Kind, string>;
26
+ /** Asserts that a value is a valid descriptor reference. */
27
+ export declare function assertRef(value: unknown): asserts value is Ref<DescriptorKind, string>;
28
+ export declare function assertRef<Kind extends DescriptorKind>(value: unknown, kind: Kind): asserts value is Ref<Kind, string>;
29
+ /** Returns whether a value is a branded descriptor with a matching stable reference. */
30
+ export declare function isDescriptor(value: unknown): value is DescriptorAny;
31
+ export declare function isDescriptor<Kind extends DescriptorKind>(value: unknown, kind: Kind): value is DescriptorBase<Kind, string>;
32
+ /** Asserts that a value is a branded descriptor with a valid stable reference. */
33
+ export declare function assertDescriptor(value: unknown): asserts value is DescriptorAny;
34
+ /** Builds the shared descriptor fields used by later pure public factories. */
35
+ export declare function createDescriptorBase<Kind extends DescriptorKind, Id extends string>(kind: Kind, id: Id, metadata?: DescriptorMetadata): DescriptorBase<Kind, Id>;
36
+ /** Recursively freezes object data without invoking accessors or looping on cycles. */
37
+ export declare function deepFreeze<T>(value: T): T;
38
+ //# sourceMappingURL=descriptor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descript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,wBAAgB,KAAK,CAAC,IAAI,SAAS,cAAc,EAC/C,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,IAAI,GACT,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAW9B,4DAA4D;AAC5D,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,GAAG,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC;AACxF,wBAAgB,SAAS,CAAC,IAAI,SAAS,cAAc,EACnD,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,IAAI,GACT,OAAO,CAAC,KAAK,IAAI,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAOtC,wFAAwF;AACxF,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAAC;AACrE,wBAAgB,YAAY,CAAC,IAAI,SAAS,cAAc,EACtD,KAAK,EAAE,OAAO,EACd,IAAI,EAAE,IAAI,GACT,KAAK,IAAI,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAgBzC,kFAAkF;AAClF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,aAAa,CAE/E;AAED,+EAA+E;AAC/E,wBAAgB,oBAAoB,CAAC,IAAI,SAAS,cAAc,EAAE,EAAE,SAAS,MAAM,EACjF,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,EAAE,EACN,QAAQ,GAAE,kBAAuB,GAChC,cAAc,CAAC,IAAI,EAAE,EAAE,CAAC,CAY1B;AAED,uFAAuF;AACvF,wBAAgB,UAAU,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAGzC"}
@@ -0,0 +1,96 @@
1
+ import { isStableId, normalizeId } from "./id.js";
2
+ /** The shared runtime brand used by every RelKit descriptor factory. */
3
+ export const RELKIT_DESCRIPTOR = Symbol.for("relkit.descriptor");
4
+ const descriptorKinds = [
5
+ "app",
6
+ "function",
7
+ "service",
8
+ "route",
9
+ "middleware",
10
+ "job",
11
+ "event",
12
+ "event-trigger",
13
+ "bucket",
14
+ "cache",
15
+ "tool",
16
+ "agent",
17
+ "data-model",
18
+ "constants",
19
+ "prompt",
20
+ ];
21
+ /** Creates a normalized immutable reference without deriving identity from a path. */
22
+ export function createRef(kind, id) {
23
+ return Object.freeze({ kind, id: normalizeId(id) });
24
+ }
25
+ /** Returns whether a value is a supported descriptor kind. */
26
+ export function isDescriptorKind(value) {
27
+ return typeof value === "string" && descriptorKinds.includes(value);
28
+ }
29
+ export function isRef(value, kind) {
30
+ if (!isRecord(value) || !hasOwn(value, "kind") || !hasOwn(value, "id"))
31
+ return false;
32
+ return (Reflect.ownKeys(value).length === 2 &&
33
+ isDescriptorKind(value.kind) &&
34
+ isStableId(value.id) &&
35
+ (kind === undefined || value.kind === kind));
36
+ }
37
+ export function assertRef(value, kind) {
38
+ if (!isRef(value) || (kind !== undefined && value.kind !== kind)) {
39
+ throw new TypeError("Invalid RelKit descriptor reference");
40
+ }
41
+ }
42
+ export function isDescriptor(value, kind) {
43
+ if (!isRecord(value) || !hasOwn(value, RELKIT_DESCRIPTOR) || value[RELKIT_DESCRIPTOR] !== true) {
44
+ return false;
45
+ }
46
+ if (!hasOwn(value, "kind") || !hasOwn(value, "id") || !hasOwn(value, "ref"))
47
+ return false;
48
+ return (isDescriptorKind(value.kind) &&
49
+ (kind === undefined || value.kind === kind) &&
50
+ isStableId(value.id) &&
51
+ isRef(value.ref) &&
52
+ value.ref.kind === value.kind &&
53
+ value.ref.id === value.id);
54
+ }
55
+ /** Asserts that a value is a branded descriptor with a valid stable reference. */
56
+ export function assertDescriptor(value) {
57
+ if (!isDescriptor(value))
58
+ throw new TypeError("Invalid RelKit descriptor");
59
+ }
60
+ /** Builds the shared descriptor fields used by later pure public factories. */
61
+ export function createDescriptorBase(kind, id, metadata = {}) {
62
+ const tags = metadata.tags === undefined ? undefined : Object.freeze([...metadata.tags]);
63
+ const value = {
64
+ [RELKIT_DESCRIPTOR]: true,
65
+ kind,
66
+ id: normalizeId(id),
67
+ ...(metadata.title === undefined ? {} : { title: metadata.title }),
68
+ ...(metadata.description === undefined ? {} : { description: metadata.description }),
69
+ ...(tags === undefined ? {} : { tags }),
70
+ ref: createRef(kind, id),
71
+ };
72
+ return deepFreeze(value);
73
+ }
74
+ /** Recursively freezes object data without invoking accessors or looping on cycles. */
75
+ export function deepFreeze(value) {
76
+ freezeObject(value, new WeakSet());
77
+ return value;
78
+ }
79
+ function freezeObject(value, seen) {
80
+ if (value === null || typeof value !== "object" || seen.has(value))
81
+ return;
82
+ seen.add(value);
83
+ for (const key of Reflect.ownKeys(value)) {
84
+ const property = Object.getOwnPropertyDescriptor(value, key);
85
+ if (property && "value" in property)
86
+ freezeObject(property.value, seen);
87
+ }
88
+ Object.freeze(value);
89
+ }
90
+ function isRecord(value) {
91
+ return value !== null && typeof value === "object" && !Array.isArray(value);
92
+ }
93
+ function hasOwn(value, key) {
94
+ return Object.prototype.hasOwnProperty.call(value, key);
95
+ }
96
+ //# sourceMappingURL=descriptor.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"descriptor.js","sourceRoot":"","sources":["../src/descriptor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiC,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAEjF,wEAAwE;AACxE,MAAM,CAAC,MAAM,iBAAiB,GAAkB,MAAM,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;AAuBhF,MAAM,eAAe,GAA8B;IACjD,KAAK;IACL,UAAU;IACV,SAAS;IACT,OAAO;IACP,YAAY;IACZ,KAAK;IACL,OAAO;IACP,eAAe;IACf,QAAQ;IACR,OAAO;IACP,MAAM;IACN,OAAO;IACP,YAAY;IACZ,WAAW;IACX,QAAQ;CACT,CAAC;AAEF,sFAAsF;AACtF,MAAM,UAAU,SAAS,CACvB,IAAU,EACV,EAAM;IAEN,OAAO,M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,OAAO,MAAM,CAAC,SAAS,CAAC,cAAc,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AAC1D,CAAC"}
package/dist/id.d.ts ADDED
@@ -0,0 +1,49 @@
1
+ declare const StableIdBrand: unique symbol;
2
+ declare const ProtocolIdBrand: unique symbol;
3
+ /** A validated identifier whose value is independent of a source path. */
4
+ export type StableId = string & {
5
+ readonly [StableIdBrand]: "StableId";
6
+ };
7
+ /** Alias used by descriptor contracts for stable IDs. */
8
+ export type DescriptorId = StableId;
9
+ /** A stable identifier used to address a versioned protocol value. */
10
+ export type ProtocolId<Name extends string = "ProtocolId"> = StableId & {
11
+ readonly [ProtocolIdBrand]: Name;
12
+ };
13
+ export type GraphHash = ProtocolId<"GraphHash">;
14
+ export type GenerationId = ProtocolId<"GenerationId">;
15
+ export type RequestId = ProtocolId<"RequestId">;
16
+ export type TraceId = ProtocolId<"TraceId">;
17
+ export type InvocationId = ProtocolId<"InvocationId">;
18
+ export type EventInstanceId = ProtocolId<"EventInstanceId">;
19
+ /** The descriptor kinds represented by the public v3 contracts. */
20
+ export type DescriptorKind = "app" | "function" | "service" | "route" | "middleware" | "job" | "event" | "event-trigger" | "bucket" | "cache" | "tool" | "agent" | "data-model" | "constants" | "prompt";
21
+ /** A typed reference to a descriptor identified by an explicit stable ID. */
22
+ export interface Ref<Kind extends DescriptorKind, Id extends string = string> {
23
+ readonly kind: Kind;
24
+ readonly id: Id;
25
+ }
26
+ /** Raised when an identifier is missing or cannot be normalized safely. */
27
+ export declare class StableIdError extends TypeError {
28
+ constructor(reason: string);
29
+ }
30
+ export { StableIdError as IdError, StableIdError as IdValidationError };
31
+ /** Trims and validates an explicit stable ID without deriving it from a path. */
32
+ export declare function normalizeId(value: unknown): StableId;
33
+ /** Returns whether a value is already a canonical stable ID. */
34
+ export declare function isStableId(value: unknown): value is StableId;
35
+ export declare const isValidId: typeof isStableId;
36
+ /** Asserts that a value is already a canonical stable ID. */
37
+ export declare function assertStableId(value: unknown): asserts value is StableId;
38
+ export declare const assertValidId: typeof assertStableId;
39
+ /** Normalizes an explicit protocol ID while preserving its nominal type. */
40
+ export declare function normalizeProtocolId(value: unknown): ProtocolId;
41
+ /** Returns whether a value is a canonical protocol ID. */
42
+ export declare function isProtocolId(value: unknown): value is ProtocolId;
43
+ export declare const toGraphHash: (value: unknown) => GraphHash;
44
+ export declare const toGenerationId: (value: unknown) => GenerationId;
45
+ export declare const toRequestId: (value: unknown) => RequestId;
46
+ export declare const toTraceId: (value: unknown) => TraceId;
47
+ export declare const toInvocationId: (value: unknown) => InvocationId;
48
+ export declare const toEventInstanceId: (value: unknown) => EventInstanceId;
49
+ //# sourceMappingURL=id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.d.ts","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAEA,OAAO,CAAC,MAAM,aAAa,EAAE,OAAO,MAAM,CAAC;AAC3C,OAAO,CAAC,MAAM,eAAe,EAAE,OAAO,MAAM,CAAC;AAE7C,0EAA0E;AAC1E,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,CAAC,aAAa,CAAC,EAAE,UAAU,CAAA;CAAE,CAAC;AAEzE,yDAAyD;AACzD,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;AAEpC,sEAAsE;AACtE,MAAM,MAAM,UAAU,CAAC,IAAI,SAAS,MAAM,GAAG,YAAY,IAAI,QAAQ,GAAG;IACtE,QAAQ,CAAC,CAAC,eAAe,CAAC,EAAE,IAAI,CAAC;CAClC,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;AAChD,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC,cAAc,CAAC,CAAC;AACtD,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,WAAW,CAAC,CAAC;AAChD,MAAM,MAAM,OAAO,GAAG,UAAU,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,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O,KAAG,SACO,CAAC;AACrD,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,YACO,CAAC;AACxD,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,SACO,CAAC;AACrD,eAAO,MAAM,SAAS,GAAI,OAAO,OAAO,KAAG,OACO,CAAC;AACnD,eAAO,MAAM,cAAc,GAAI,OAAO,OAAO,KAAG,YACO,CAAC;AACxD,eAAO,MAAM,iBAAiB,GAAI,OAAO,OAAO,KAAG,eACO,CAAC"}
package/dist/id.js ADDED
@@ -0,0 +1,52 @@
1
+ const STABLE_ID_PATTERN = /^[A-Za-z0-9]+(?:[._-][A-Za-z0-9]+)*$/;
2
+ /** Raised when an identifier is missing or cannot be normalized safely. */
3
+ export class StableIdError extends TypeError {
4
+ constructor(reason) {
5
+ super(`Invalid stable ID: ${reason}`);
6
+ this.name = "StableIdError";
7
+ }
8
+ }
9
+ export { StableIdError as IdError, StableIdError as IdValidationError };
10
+ /** Trims and validates an explicit stable ID without deriving it from a path. */
11
+ export function normalizeId(value) {
12
+ if (typeof value !== "string") {
13
+ throw new StableIdError("expected a string");
14
+ }
15
+ const normalized = value.normalize("NFC").trim();
16
+ if (normalized.length === 0) {
17
+ throw new StableIdError("expected a non-empty value");
18
+ }
19
+ if (!STABLE_ID_PATTERN.test(normalized)) {
20
+ throw new StableIdError("use letters, numbers, '.', '_' or '-' between alphanumeric segments");
21
+ }
22
+ return normalized;
23
+ }
24
+ /** Returns whether a value is already a canonical stable ID. */
25
+ export function isStableId(value) {
26
+ if (typeof value !== "string" || value !== value.trim())
27
+ return false;
28
+ return STABLE_ID_PATTERN.test(value);
29
+ }
30
+ export const isValidId = isStableId;
31
+ /** Asserts that a value is already a canonical stable ID. */
32
+ export function assertStableId(value) {
33
+ if (!isStableId(value)) {
34
+ throw new StableIdError("expected a canonical stable ID");
35
+ }
36
+ }
37
+ export const assertValidId = assertStableId;
38
+ /** Normalizes an explicit protocol ID while preserving its nominal type. */
39
+ export function normalizeProtocolId(value) {
40
+ return normalizeId(value);
41
+ }
42
+ /** Returns whether a value is a canonical protocol ID. */
43
+ export function isProtocolId(value) {
44
+ return isStableId(value);
45
+ }
46
+ export const toGraphHash = (value) => normalizeProtocolId(value);
47
+ export const toGenerationId = (value) => normalizeProtocolId(value);
48
+ export const toRequestId = (value) => normalizeProtocolId(value);
49
+ export const toTraceId = (value) => normalizeProtocolId(value);
50
+ export const toInvocationId = (value) => normalizeProtocolId(value);
51
+ export const toEventInstanceId = (value) => normalizeProtocolId(value);
52
+ //# sourceMappingURL=id.js.map
package/dist/id.js.map ADDED
@@ -0,0 +1 @@
1
+ {"version":3,"file":"id.js","sourceRoot":"","sources":["../src/id.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,sCAAsC,CAAC;AA+CjE,2EAA2E;AAC3E,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C,YAAY,MAAc;QACxB,KAAK,CAAC,sBAAsB,MAAM,EAAE,CAAC,CAAC;QACtC,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;IAC9B,CAAC;CACF;AAED,OAAO,EAAE,aAAa,IAAI,OAAO,EAAE,aAAa,IAAI,iBAAiB,EAAE,CAAC;AAExE,iFAAiF;AACjF,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,MAAM,IAAI,aAAa,CAAC,mBAAmB,CAAC,CAAC;IAC/C,CAAC;IAED,MAAM,UAAU,GAAG,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC;IACjD,IAAI,UAAU,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,IAAI,aAAa,CAAC,4BAA4B,CAAC,CAAC;IACxD,CAAC;IACD,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACxC,MAAM,IAAI,aAAa,CAAC,qEAAqE,CAAC,CAAC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,mBAAmB,CAAC,KAAK,CAA4B,CAAC;AACxD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAmB,EAAE,CACnE,mBAAmB,CAAC,KAAK,CAA+B,CAAC"}
@@ -0,0 +1,6 @@
1
+ export * from "./id.js";
2
+ export * from "./descriptor.js";
3
+ export * from "./json.js";
4
+ export * from "./source-location.js";
5
+ export * from "./version.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ export * from "./id.js";
2
+ export * from "./descriptor.js";
3
+ export * from "./json.js";
4
+ export * from "./source-location.js";
5
+ export * from "./version.js";
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,sBAAsB,CAAC;AACrC,cAAc,cAAc,CAAC"}
package/dist/json.d.ts ADDED
@@ -0,0 +1,27 @@
1
+ /** A value or a promise of that value. */
2
+ export type MaybePromise<T> = T | Promise<T>;
3
+ /** Values represented directly by JSON. Non-finite numbers are rejected at runtime. */
4
+ export type JsonPrimitive = string | number | boolean | null;
5
+ /** A recursively JSON-serializable value. */
6
+ export type JsonValue = JsonPrimitive | readonly JsonValue[] | {
7
+ readonly [key: string]: JsonValue;
8
+ };
9
+ /** Raised when a value cannot cross the JSON boundary. */
10
+ export declare class JsonValueError extends TypeError {
11
+ readonly path: string;
12
+ constructor(path: string, reason: string);
13
+ }
14
+ /** Returns whether a value is a JSON primitive accepted by RelKit. */
15
+ export declare function isJsonPrimitive(value: unknown): value is JsonPrimitive;
16
+ /** Returns whether a value is recursively JSON-safe. */
17
+ export declare function isJsonValue(value: unknown): value is JsonValue;
18
+ /** Asserts that a value is recursively JSON-safe. */
19
+ export declare function assertJsonValue(value: unknown): asserts value is JsonValue;
20
+ /**
21
+ * Serializes JSON deterministically by sorting every object key at every depth.
22
+ * Undefined values, executable values, cycles, and non-JSON objects are errors.
23
+ */
24
+ export declare function serializeJson(value: unknown): string;
25
+ /** Alias for the one canonical JSON serializer. */
26
+ export declare const canonicalJson: typeof serializeJson;
27
+ //# sourceMappingURL=json.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAAA,0CAA0C;AAC1C,MAAM,MAAM,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAE7C,uFAAuF;AACvF,MAAM,MAAM,aAAa,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,CAAC;AAE7D,6CAA6C;AAC7C,MAAM,MAAM,SAAS,GACnB,aAAa,GAAG,SAAS,SAAS,EAAE,GAAG;IAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,CAAA;CAAE,CAAC;AAE/E,0DAA0D;AAC1D,qBAAa,cAAe,SAAQ,SAAS;IAC3C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAEV,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM;CAKzC;AAED,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,aAAa,CAOtE;AAED,wDAAwD;AACxD,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,SAAS,CAO9D;AAED,qDAAqD;AACrD,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAAC,KAAK,IAAI,SAAS,CAE1E;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,CAEpD;AAED,mDAAmD;AACnD,eAAO,MAAM,aAAa,sBAAgB,CAAC"}
package/dist/json.js ADDED
@@ -0,0 +1,125 @@
1
+ /** Raised when a value cannot cross the JSON boundary. */
2
+ export class JsonValueError extends TypeError {
3
+ path;
4
+ constructor(path, reason) {
5
+ super(`Invalid JSON value at ${path}: ${reason}`);
6
+ this.name = "JsonValueError";
7
+ this.path = path;
8
+ }
9
+ }
10
+ /** Returns whether a value is a JSON primitive accepted by RelKit. */
11
+ export function isJsonPrimitive(value) {
12
+ return (value === null ||
13
+ typeof value === "string" ||
14
+ typeof value === "boolean" ||
15
+ (typeof value === "number" && Number.isFinite(value)));
16
+ }
17
+ /** Returns whether a value is recursively JSON-safe. */
18
+ export function isJsonValue(value) {
19
+ try {
20
+ serializeJson(value);
21
+ return true;
22
+ }
23
+ catch {
24
+ return false;
25
+ }
26
+ }
27
+ /** Asserts that a value is recursively JSON-safe. */
28
+ export function assertJsonValue(value) {
29
+ serializeJson(value);
30
+ }
31
+ /**
32
+ * Serializes JSON deterministically by sorting every object key at every depth.
33
+ * Undefined values, executable values, cycles, and non-JSON objects are errors.
34
+ */
35
+ export function serializeJson(value) {
36
+ return serialize(value, "$", new Set());
37
+ }
38
+ /** Alias for the one canonical JSON serializer. */
39
+ export const canonicalJson = serializeJson;
40
+ function serialize(value, path, active) {
41
+ if (isJsonPrimitive(value))
42
+ return JSON.stringify(value);
43
+ switch (typeof value) {
44
+ case "undefined":
45
+ throw new JsonValueError(path, "undefined is not JSON data");
46
+ case "function":
47
+ throw new JsonValueError(path, "functions are not JSON data");
48
+ case "symbol":
49
+ throw new JsonValueError(path, "symbols are not JSON data");
50
+ case "bigint":
51
+ throw new JsonValueError(path, "bigints are not JSON data");
52
+ case "number":
53
+ throw new JsonValueError(path, "non-finite numbers are not JSON data");
54
+ case "object":
55
+ return serializeObject(value, path, active);
56
+ default:
57
+ throw new JsonValueError(path, "value is not JSON data");
58
+ }
59
+ }
60
+ function serializeObject(value, path, active) {
61
+ if (active.has(value))
62
+ throw new JsonValueError(path, "cycles are not JSON data");
63
+ active.add(value);
64
+ try {
65
+ if (Array.isArray(value))
66
+ return serializeArray(value, path, active);
67
+ if (!isPlainObject(value)) {
68
+ throw new JsonValueError(path, "only arrays and plain objects are JSON data");
69
+ }
70
+ return serializeRecord(value, path, active);
71
+ }
72
+ finally {
73
+ active.delete(value);
74
+ }
75
+ }
76
+ function serializeArray(value, path, active) {
77
+ if (Object.getPrototypeOf(value) !== Array.prototype) {
78
+ throw new JsonValueError(path, "only ordinary arrays are JSON data");
79
+ }
80
+ rejectSymbolKeys(value, path);
81
+ for (const key of Object.getOwnPropertyNames(value)) {
82
+ if (key !== "length" && !isArrayIndex(key, value.length)) {
83
+ throw new JsonValueError(path, "array properties are not JSON data");
84
+ }
85
+ }
86
+ const items = [];
87
+ for (let index = 0; index < value.length; index += 1) {
88
+ if (!Object.prototype.hasOwnProperty.call(value, index)) {
89
+ throw new JsonValueError(`${path}[${index}]`, "sparse arrays are not JSON data");
90
+ }
91
+ const descriptor = Object.getOwnPropertyDescriptor(value, String(index));
92
+ if (!descriptor || !("value" in descriptor)) {
93
+ throw new JsonValueError(`${path}[${index}]`, "accessor properties are not JSON data");
94
+ }
95
+ items.push(serialize(descriptor.value, `${path}[${index}]`, active));
96
+ }
97
+ return `[${items.join(",")}]`;
98
+ }
99
+ function serializeRecord(value, path, active) {
100
+ rejectSymbolKeys(value, path);
101
+ const keys = Object.keys(value).sort();
102
+ const entries = [];
103
+ for (const key of keys) {
104
+ const descriptor = Object.getOwnPropertyDescriptor(value, key);
105
+ if (!descriptor || !("value" in descriptor)) {
106
+ throw new JsonValueError(`${path}[${JSON.stringify(key)}]`, "accessor properties are not JSON data");
107
+ }
108
+ entries.push(`${JSON.stringify(key)}:${serialize(descriptor.value, `${path}[${JSON.stringify(key)}]`, active)}`);
109
+ }
110
+ return `{${entries.join(",")}}`;
111
+ }
112
+ function rejectSymbolKeys(value, path) {
113
+ if (Object.getOwnPropertySymbols(value).length > 0) {
114
+ throw new JsonValueError(path, "symbol keys are not JSON data");
115
+ }
116
+ }
117
+ function isPlainObject(value) {
118
+ const prototype = Object.getPrototypeOf(value);
119
+ return prototype === null || prototype === Object.prototype;
120
+ }
121
+ function isArrayIndex(key, length) {
122
+ const index = Number(key);
123
+ return Number.isInteger(index) && index >= 0 && index < length && String(index) === key;
124
+ }
125
+ //# sourceMappingURL=json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"json.js","sourceRoot":"","sources":["../src/json.ts"],"names":[],"mappings":"AAUA,0DAA0D;AAC1D,MAAM,OAAO,cAAe,SAAQ,SAAS;IAClC,IAAI,CAAS;IAEtB,YAAY,IAAY,EAAE,MAAc;QACtC,KAAK,CAAC,yBAAyB,IAAI,KAAK,MAAM,EAAE,CAAC,CAAC;QAClD,IAAI,CAAC,IAAI,GAAG,gBAAgB,CAAC;QAC7B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAED,sEAAsE;AACtE,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,OAAO,CACL,KAAK,KAAK,IAAI;QACd,OAAO,KAAK,KAAK,QAAQ;QACzB,OAAO,KAAK,KAAK,SAAS;QAC1B,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CACtD,CAAC;AACJ,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,WAAW,CAAC,KAAc;IACxC,IAAI,CAAC;QACH,aAAa,CAAC,KAAK,CAAC,CAAC;QACrB,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED,qDAAqD;AACrD,MAAM,UAAU,eAAe,CAAC,KAAc;IAC5C,aAAa,CAA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,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,EAAE,CACnG,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;AAClC,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa,EAAE,IAAY;IACnD,IAAI,MAAM,CAAC,qBAAqB,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnD,MAAM,IAAI,cAAc,CAAC,IAAI,EAAE,+BAA+B,CAAC,CAAC;IAClE,CAAC;AACH,CAAC;AAED,SAAS,aAAa,CAAC,KAAa;IAClC,MAAM,SAAS,GAAG,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC/C,OAAO,SAAS,KAAK,IAAI,IAAI,SAAS,KAAK,MAAM,CAAC,SAAS,CAAC;AAC9D,CAAC;AAED,SAAS,YAAY,CAAC,GAAW,EAAE,MAAc;IAC/C,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,MAAM,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC;AAC1F,CAAC"}
@@ -0,0 +1,23 @@
1
+ /** A source file path normalized relative to a project root. */
2
+ export type ProjectRelativePath = string;
3
+ /** A portable source position used by diagnostics and graph metadata. */
4
+ export interface SourceLocation {
5
+ readonly file: ProjectRelativePath;
6
+ readonly line: number;
7
+ readonly column: number;
8
+ }
9
+ /** Raised when a source path or position cannot be represented portably. */
10
+ export declare class SourceLocationError extends TypeError {
11
+ constructor(reason: string);
12
+ }
13
+ /**
14
+ * Returns a project-relative path with `/` separators.
15
+ * Absolute inputs require an absolute project root and must remain inside it.
16
+ */
17
+ export declare function normalizeSourcePath(filePath: string, projectRoot?: string): ProjectRelativePath;
18
+ export declare const toProjectRelativePath: typeof normalizeSourcePath;
19
+ /** Creates a portable source location from a path and one-based coordinates. */
20
+ export declare function createSourceLocation(filePath: string, line: number, column: number, projectRoot?: string): SourceLocation;
21
+ /** Normalizes a source-location record without changing its identity fields. */
22
+ export declare function normalizeSourceLocation(location: SourceLocation, projectRoot?: string): SourceLocation;
23
+ //# sourceMappingURL=source-location.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-location.d.ts","sourceRoot":"","sources":["../src/source-location.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,MAAM,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEzC,yEAAyE;AACzE,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IACnC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAED,4EAA4E;AAC5E,qBAAa,mBAAoB,SAAQ,SAAS;gBACpC,MAAM,EAAE,MAAM;CAI3B;AASD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,mBAAmB,CA4B/F;AAED,eAAO,MAAM,qBAAqB,4BAAsB,CAAC;AAEzD,gFAAgF;AAChF,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,MAAM,GACnB,cAAc,CAShB;AAED,gFAAgF;AAChF,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,cAAc,EACxB,WAAW,CAAC,EAAE,MAAM,GACnB,cAAc,CAEhB"}
@@ -0,0 +1,104 @@
1
+ /** Raised when a source path or position cannot be represented portably. */
2
+ export class SourceLocationError extends TypeError {
3
+ constructor(reason) {
4
+ super(`Invalid source location: ${reason}`);
5
+ this.name = "SourceLocationError";
6
+ }
7
+ }
8
+ /**
9
+ * Returns a project-relative path with `/` separators.
10
+ * Absolute inputs require an absolute project root and must remain inside it.
11
+ */
12
+ export function normalizeSourcePath(filePath, projectRoot) {
13
+ if (typeof filePath !== "string") {
14
+ throw new SourceLocationError("file must be a string");
15
+ }
16
+ const file = parsePath(filePath, "file");
17
+ if (projectRoot === undefined) {
18
+ if (file.absolute) {
19
+ throw new SourceLocationError("an absolute file requires an absolute project root");
20
+ }
21
+ return joinSegments(file.segments);
22
+ }
23
+ if (typeof projectRoot !== "string") {
24
+ throw new SourceLocationError("project root must be a string");
25
+ }
26
+ const root = parsePath(projectRoot, "project root");
27
+ if (!root.absolute) {
28
+ throw new SourceLocationError("project root must be absolute");
29
+ }
30
+ if (!file.absolute)
31
+ return joinSegments(file.segments);
32
+ if (file.caseInsensitive !== root.caseInsensitive || !isWithin(file, root)) {
33
+ throw new SourceLocationError("file must be inside the project root");
34
+ }
35
+ const relative = file.segments.slice(root.segments.length);
36
+ return joinSegments(relative);
37
+ }
38
+ export const toProjectRelativePath = normalizeSourcePath;
39
+ /** Creates a portable source location from a path and one-based coordinates. */
40
+ export function createSourceLocation(filePath, line, column, projectRoot) {
41
+ const file = normalizeSourcePath(filePath, projectRoot);
42
+ if (!Number.isInteger(line) || line < 1) {
43
+ throw new SourceLocationError("line must be a positive integer");
44
+ }
45
+ if (!Number.isInteger(column) || column < 1) {
46
+ throw new SourceLocationError("column must be a positive integer");
47
+ }
48
+ return { file, line, column };
49
+ }
50
+ /** Normalizes a source-location record without changing its identity fields. */
51
+ export function normalizeSourceLocation(location, projectRoot) {
52
+ return createSourceLocation(location.file, location.line, location.column, projectRoot);
53
+ }
54
+ function parsePath(value, label) {
55
+ if (value.length === 0 || value.includes("\0")) {
56
+ throw new SourceLocationError(`${label} must be a non-empty path`);
57
+ }
58
+ const slashPath = value.replaceAll("\\", "/");
59
+ const drive = /^([A-Za-z]):(?:\/|$)/.exec(slashPath);
60
+ const isUnc = slashPath.startsWith("//");
61
+ const absolute = Boolean(drive) || isUnc || slashPath.startsWith("/");
62
+ const caseInsensitive = Boolean(drive) || isUnc;
63
+ const rootKey = drive ? `${drive[1]?.toLowerCase()}:` : isUnc ? "unc" : absolute ? "/" : "";
64
+ const body = drive
65
+ ? slashPath.slice(2)
66
+ : isUnc
67
+ ? slashPath.slice(2)
68
+ : absolute
69
+ ? slashPath.slice(1)
70
+ : slashPath;
71
+ const segments = [];
72
+ for (const segment of body.split("/")) {
73
+ if (segment === "" || segment === ".")
74
+ continue;
75
+ if (segment.includes(":")) {
76
+ throw new SourceLocationError(`${label} contains an invalid ':' segment`);
77
+ }
78
+ if (segment === "..") {
79
+ if (segments.length === 0) {
80
+ if (absolute)
81
+ continue;
82
+ throw new SourceLocationError(`${label} cannot escape its root`);
83
+ }
84
+ segments.pop();
85
+ continue;
86
+ }
87
+ segments.push(segment);
88
+ }
89
+ return { absolute, caseInsensitive, rootKey, segments };
90
+ }
91
+ function isWithin(file, root) {
92
+ if (file.rootKey !== root.rootKey || file.segments.length <= root.segments.length)
93
+ return false;
94
+ return root.segments.every((segment, index) => file.caseInsensitive
95
+ ? segment.toLowerCase() === file.segments[index]?.toLowerCase()
96
+ : segment === file.segments[index]);
97
+ }
98
+ function joinSegments(segments) {
99
+ if (segments.length === 0) {
100
+ throw new SourceLocationError("file must be below the project root");
101
+ }
102
+ return segments.join("/");
103
+ }
104
+ //# sourceMappingURL=source-location.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source-location.js","sourceRoot":"","sources":["../src/source-location.ts"],"names":[],"mappings":"AAUA,4EAA4E;AAC5E,MAAM,OAAO,mBAAoB,SAAQ,SAAS;IAChD,YAAY,MAAc;QACxB,KAAK,CAAC,4BAA4B,MAAM,EAAE,CAAC,CAAC;QAC5C,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AASD;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,QAAgB,EAAE,WAAoB;IACxE,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE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AQ,EAAE,CAAC;AAC1D,CAAC;AAED,SAAS,QAAQ,CAAC,IAAgB,EAAE,IAAgB;IAClD,IAAI,IAAI,CAAC,OAAO,KAAK,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM;QAAE,OAAO,KAAK,CAAC;IAChG,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,OAAO,EAAE,KAAK,EAAE,EAAE,CAC5C,IAAI,CAAC,eAAe;QAClB,CAAC,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,WAAW,EAAE;QAC/D,CAAC,CAAC,OAAO,KAAK,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CACrC,CAAC;AACJ,CAAC;AAED,SAAS,YAAY,CAAC,QAA2B;IAC/C,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,IAAI,mBAAmB,CAAC,qCAAqC,CAAC,CAAC;IACvE,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC"}
@@ -0,0 +1,14 @@
1
+ /** Current version of the public contract payloads. */
2
+ export declare const CONTRACT_VERSION: 2;
3
+ /** Current version of generated RelKit artifacts. */
4
+ export declare const GENERATOR_VERSION: 2;
5
+ /** Current version of the canonical application graph. */
6
+ export declare const GRAPH_VERSION: 5;
7
+ /** Current version of the executable runtime manifest. */
8
+ export declare const MANIFEST_VERSION: 5;
9
+ /** Current version of the internal inspector/API protocol. */
10
+ export declare const API_VERSION: 1;
11
+ /** Shared protocol version used by versioned internal contracts. */
12
+ export declare const PROTOCOL_VERSION: 1;
13
+ export declare const API_BASE_PATH: "/_relkit/v1";
14
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,eAAO,MAAM,gBAAgB,EAAG,CAAU,CAAC;AAE3C,qDAAqD;AACrD,eAAO,MAAM,iBAAiB,EAAG,CAAU,CAAC;AAE5C,0DAA0D;AAC1D,eAAO,MAAM,aAAa,EAAG,CAAU,CAAC;AAExC,0DAA0D;AAC1D,eAAO,MAAM,gBAAgB,EAAG,CAAU,CAAC;AAE3C,8DAA8D;AAC9D,eAAO,MAAM,WAAW,EAAG,CAAU,CAAC;AAEtC,oEAAoE;AACpE,eAAO,MAAM,gBAAgB,GAAc,CAAC;AAE5C,eAAO,MAAM,aAAa,EAAG,aAAsB,CAAC"}
@@ -0,0 +1,14 @@
1
+ /** Current version of the public contract payloads. */
2
+ export const CONTRACT_VERSION = 2;
3
+ /** Current version of generated RelKit artifacts. */
4
+ export const GENERATOR_VERSION = 2;
5
+ /** Current version of the canonical application graph. */
6
+ export const GRAPH_VERSION = 5;
7
+ /** Current version of the executable runtime manifest. */
8
+ export const MANIFEST_VERSION = 5;
9
+ /** Current version of the internal inspector/API protocol. */
10
+ export const API_VERSION = 1;
11
+ /** Shared protocol version used by versioned internal contracts. */
12
+ export const PROTOCOL_VERSION = API_VERSION;
13
+ export const API_BASE_PATH = "/_relkit/v1";
14
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAU,CAAC;AAE3C,qDAAqD;AACrD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAU,CAAC;AAE5C,0DAA0D;AAC1D,MAAM,CAAC,MAAM,aAAa,GAAG,CAAU,CAAC;AAExC,0DAA0D;AAC1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAU,CAAC;AAE3C,8DAA8D;AAC9D,MAAM,CAAC,MAAM,WAAW,GAAG,CAAU,CAAC;AAEtC,oEAAoE;AACpE,MAAM,CAAC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAE5C,MAAM,CAAC,MAAM,aAAa,GAAG,aAAsB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,36 @@
1
+ {
2
+ "name": "@relkit/contracts",
3
+ "version": "0.0.0",
4
+ "description": "Unsupported internal RELKIT contracts; use @relkit/app.",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/rel-kit/relkit.git",
9
+ "directory": "packages/contracts"
10
+ },
11
+ "homepage": "https://github.com/rel-kit/relkit#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/rel-kit/relkit/issues"
14
+ },
15
+ "files": [
16
+ "dist"
17
+ ],
18
+ "publishConfig": {
19
+ "access": "public"
20
+ },
21
+ "engines": {
22
+ "bun": ">=1.3.10"
23
+ },
24
+ "type": "module",
25
+ "exports": {
26
+ ".": {
27
+ "types": "./dist/index.d.ts",
28
+ "import": "./dist/index.js"
29
+ }
30
+ },
31
+ "scripts": {
32
+ "build": "tsc -b",
33
+ "check": "tsc -b --pretty false",
34
+ "typecheck": "tsc -b --pretty false"
35
+ }
36
+ }