@panproto/core 0.3.0 → 0.4.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.
@@ -0,0 +1,64 @@
1
+ import { Protocol } from './protocol.js';
2
+ import { FullSchemaDiff, CompatReportData, BreakingChange, NonBreakingChange, SchemaValidationIssue, WasmModule } from './types.js';
3
+ /**
4
+ * A full schema diff with 20+ change categories.
5
+ *
6
+ * Created via `Panproto.diffFull()`. Use `.classify()` to determine
7
+ * compatibility.
8
+ */
9
+ export declare class FullDiffReport {
10
+ /** The raw diff data. */
11
+ readonly data: FullSchemaDiff;
12
+ /** @internal */
13
+ readonly _reportBytes: Uint8Array;
14
+ /** @internal */
15
+ readonly _wasm: WasmModule;
16
+ /** @internal */
17
+ constructor(data: FullSchemaDiff, reportBytes: Uint8Array, wasm: WasmModule);
18
+ /** Whether there are any changes at all. */
19
+ get hasChanges(): boolean;
20
+ /** Classify the diff against a protocol, producing a compatibility report. */
21
+ classify(protocol: Protocol): CompatReport;
22
+ }
23
+ /**
24
+ * A compatibility report classifying schema changes as breaking or non-breaking.
25
+ *
26
+ * Created via `FullDiffReport.classify()`.
27
+ */
28
+ export declare class CompatReport {
29
+ /** The raw report data. */
30
+ readonly data: CompatReportData;
31
+ /** @internal */
32
+ readonly _rawBytes: Uint8Array;
33
+ /** @internal */
34
+ readonly _wasm: WasmModule;
35
+ /** @internal */
36
+ constructor(data: CompatReportData, rawBytes: Uint8Array, wasm: WasmModule);
37
+ /** List of breaking changes. */
38
+ get breakingChanges(): readonly BreakingChange[];
39
+ /** List of non-breaking changes. */
40
+ get nonBreakingChanges(): readonly NonBreakingChange[];
41
+ /** Whether the changes are fully compatible (no breaking changes). */
42
+ get isCompatible(): boolean;
43
+ /** Whether there are any breaking changes. */
44
+ get isBreaking(): boolean;
45
+ /** Whether the changes are backward-compatible (additions only, no removals). */
46
+ get isBackwardCompatible(): boolean;
47
+ /** Render as human-readable text. */
48
+ toText(): string;
49
+ /** Render as a JSON string. */
50
+ toJson(): string;
51
+ }
52
+ /**
53
+ * Result of schema validation against a protocol.
54
+ */
55
+ export declare class ValidationResult {
56
+ /** The list of validation issues found. */
57
+ readonly issues: readonly SchemaValidationIssue[];
58
+ constructor(issues: readonly SchemaValidationIssue[]);
59
+ /** Whether the schema is valid (no issues found). */
60
+ get isValid(): boolean;
61
+ /** The number of validation issues. */
62
+ get errorCount(): number;
63
+ }
64
+ //# sourceMappingURL=check.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"check.d.ts","sourceRoot":"","sources":["../src/check.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EACV,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,qBAAqB,EACrB,UAAU,EACX,MAAM,YAAY,CAAC;AAGpB;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,yBAAyB;IACzB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAE9B,gBAAgB;IAChB,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC;IAElC,gBAAgB;IAChB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAE3B,gBAAgB;gBACJ,IAAI,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU;IAM3E,4CAA4C;IAC5C,IAAI,UAAU,IAAI,OAAO,CA8BxB;IAED,8EAA8E;IAC9E,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,YAAY;CAQ3C;AAED;;;;GAIG;AACH,qBAAa,YAAY;IACvB,2BAA2B;IAC3B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAEhC,gBAAgB;IAChB,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC;IAE/B,gBAAgB;IAChB,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;IAE3B,gBAAgB;gBACJ,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU;IAM1E,gCAAgC;IAChC,IAAI,eAAe,IAAI,SAAS,cAAc,EAAE,CAE/C;IAED,oCAAoC;IACpC,IAAI,kBAAkB,IAAI,SAAS,iBAAiB,EAAE,CAErD;IAED,sEAAsE;IACtE,IAAI,YAAY,IAAI,OAAO,CAE1B;IAED,8CAA8C;IAC9C,IAAI,UAAU,IAAI,OAAO,CAExB;IAED,iFAAiF;IACjF,IAAI,oBAAoB,IAAI,OAAO,CAElC;IAED,qCAAqC;IACrC,MAAM,IAAI,MAAM;IAIhB,+BAA+B;IAC/B,MAAM,IAAI,MAAM;CAGjB;AAED;;GAEG;AACH,qBAAa,gBAAgB;IAC3B,2CAA2C;IAC3C,QAAQ,CAAC,MAAM,EAAE,SAAS,qBAAqB,EAAE,CAAC;gBAEtC,MAAM,EAAE,SAAS,qBAAqB,EAAE;IAIpD,qDAAqD;IACrD,IAAI,OAAO,IAAI,OAAO,CAErB;IAED,uCAAuC;IACvC,IAAI,UAAU,IAAI,MAAM,CAEvB;CACF"}
package/dist/gat.d.ts ADDED
@@ -0,0 +1,99 @@
1
+ import { WasmModule, TheorySpec, TheoryMorphism, MorphismCheckResult } from './types.js';
2
+ import { WasmHandle } from './wasm.js';
3
+ /**
4
+ * A disposable handle to a WASM-side Theory resource.
5
+ *
6
+ * Implements `Disposable` for use with `using` declarations.
7
+ */
8
+ export declare class TheoryHandle implements Disposable {
9
+ #private;
10
+ /** @internal Retained for future sort/op inspection methods. */
11
+ readonly _wasm: WasmModule;
12
+ constructor(handle: WasmHandle, wasm: WasmModule);
13
+ /** The WASM handle. Internal use only. */
14
+ get _handle(): WasmHandle;
15
+ /** Release the WASM-side theory resource. */
16
+ [Symbol.dispose](): void;
17
+ }
18
+ /**
19
+ * Fluent builder for constructing a Theory specification.
20
+ *
21
+ * @example
22
+ * ```typescript
23
+ * const monoid = new TheoryBuilder('Monoid')
24
+ * .sort('Carrier')
25
+ * .op('mul', [['a', 'Carrier'], ['b', 'Carrier']], 'Carrier')
26
+ * .op('unit', [], 'Carrier')
27
+ * .build(wasm);
28
+ * ```
29
+ */
30
+ export declare class TheoryBuilder {
31
+ #private;
32
+ constructor(name: string);
33
+ /** Declare that this theory extends a parent theory. */
34
+ extends(parentName: string): this;
35
+ /** Add a simple sort (no parameters). */
36
+ sort(name: string): this;
37
+ /** Add a dependent sort with parameters. */
38
+ dependentSort(name: string, params: {
39
+ name: string;
40
+ sort: string;
41
+ }[]): this;
42
+ /** Add an operation. */
43
+ op(name: string, inputs: [string, string][], output: string): this;
44
+ /** Add an equation (axiom). */
45
+ eq(name: string, lhs: import('./types.js').Term, rhs: import('./types.js').Term): this;
46
+ /** Get the theory specification. */
47
+ toSpec(): TheorySpec;
48
+ /**
49
+ * Build the theory and register it in WASM.
50
+ *
51
+ * @param wasm - The WASM module
52
+ * @returns A disposable TheoryHandle
53
+ * @throws {@link PanprotoError} if the WASM call fails
54
+ */
55
+ build(wasm: WasmModule): TheoryHandle;
56
+ }
57
+ /**
58
+ * Create a theory from a specification.
59
+ *
60
+ * @param spec - The theory specification
61
+ * @param wasm - The WASM module
62
+ * @returns A disposable TheoryHandle
63
+ * @throws {@link PanprotoError} if serialization or WASM fails
64
+ */
65
+ export declare function createTheory(spec: TheorySpec, wasm: WasmModule): TheoryHandle;
66
+ /**
67
+ * Compute the colimit (pushout) of two theories over a shared base.
68
+ *
69
+ * @param t1 - First theory handle
70
+ * @param t2 - Second theory handle
71
+ * @param shared - Shared base theory handle
72
+ * @param wasm - The WASM module
73
+ * @returns A new TheoryHandle for the colimit theory
74
+ * @throws {@link WasmError} if computation fails
75
+ */
76
+ export declare function colimit(t1: TheoryHandle, t2: TheoryHandle, shared: TheoryHandle, wasm: WasmModule): TheoryHandle;
77
+ /**
78
+ * Check whether a theory morphism is valid.
79
+ *
80
+ * @param morphism - The morphism to check
81
+ * @param domain - Handle to the domain theory
82
+ * @param codomain - Handle to the codomain theory
83
+ * @param wasm - The WASM module
84
+ * @returns A result indicating validity and any error
85
+ */
86
+ export declare function checkMorphism(morphism: TheoryMorphism, domain: TheoryHandle, codomain: TheoryHandle, wasm: WasmModule): MorphismCheckResult;
87
+ /**
88
+ * Migrate a model's sort interpretations through a morphism.
89
+ *
90
+ * Since operation interpretations (functions) cannot cross the WASM
91
+ * boundary, only sort interpretations are migrated.
92
+ *
93
+ * @param sortInterp - Sort interpretations as name-to-values map
94
+ * @param morphism - The theory morphism to migrate along
95
+ * @param wasm - The WASM module
96
+ * @returns Reindexed sort interpretations
97
+ */
98
+ export declare function migrateModel(sortInterp: Record<string, unknown[]>, morphism: TheoryMorphism, wasm: WasmModule): Record<string, unknown[]>;
99
+ //# sourceMappingURL=gat.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gat.d.ts","sourceRoot":"","sources":["../src/gat.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,cAAc,EACd,mBAAmB,EAIpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAE,UAAU,EAAgB,MAAM,WAAW,CAAC;AAGrD;;;;GAIG;AACH,qBAAa,YAAa,YAAW,UAAU;;IAE7C,gEAAgE;IAChE,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;gBAEf,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,UAAU;IAKhD,0CAA0C;IAC1C,IAAI,OAAO,IAAI,UAAU,CAExB;IAED,6CAA6C;IAC7C,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI;CAGzB;AAED;;;;;;;;;;;GAWG;AACH,qBAAa,aAAa;;gBAOZ,IAAI,EAAE,MAAM;IAQxB,wDAAwD;IACxD,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI;IAKjC,yCAAyC;IACzC,IAAI,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAKxB,4CAA4C;IAC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