@panproto/core 0.1.0 → 0.2.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.cjs +104 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +32 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +104 -32
- package/dist/index.js.map +1 -1
- package/dist/lens.d.ts +123 -0
- package/dist/lens.d.ts.map +1 -0
- package/dist/migration.d.ts +133 -0
- package/dist/migration.d.ts.map +1 -0
- package/dist/msgpack.d.ts +63 -0
- package/dist/msgpack.d.ts.map +1 -0
- package/dist/panproto.d.ts +114 -0
- package/dist/panproto.d.ts.map +1 -0
- package/dist/protocol.d.ts +65 -0
- package/dist/protocol.d.ts.map +1 -0
- package/dist/schema.d.ts +107 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/types.d.ts +175 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/wasm.d.ts +61 -0
- package/dist/wasm.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core type definitions for the @panproto/core SDK.
|
|
3
|
+
*
|
|
4
|
+
* These types mirror the Rust-side structures but use JavaScript idioms:
|
|
5
|
+
* - `HashMap<K,V>` becomes `Map<K,V>` or `Record<string, V>` for string keys
|
|
6
|
+
* - `Option<T>` becomes `T | undefined`
|
|
7
|
+
* - `Vec<T>` becomes `T[]`
|
|
8
|
+
* - `Result<T,E>` becomes thrown `PanprotoError` or return value
|
|
9
|
+
*
|
|
10
|
+
* @module
|
|
11
|
+
*/
|
|
12
|
+
/** Opaque handle to a WASM-side resource. */
|
|
13
|
+
export interface Handle {
|
|
14
|
+
readonly __brand: unique symbol;
|
|
15
|
+
readonly id: number;
|
|
16
|
+
}
|
|
17
|
+
/** Branded handle for a protocol resource. */
|
|
18
|
+
export interface ProtocolHandle extends Handle {
|
|
19
|
+
readonly __kind: 'protocol';
|
|
20
|
+
}
|
|
21
|
+
/** Branded handle for a schema resource. */
|
|
22
|
+
export interface SchemaHandle extends Handle {
|
|
23
|
+
readonly __kind: 'schema';
|
|
24
|
+
}
|
|
25
|
+
/** Branded handle for a compiled migration resource. */
|
|
26
|
+
export interface MigrationHandle extends Handle {
|
|
27
|
+
readonly __kind: 'migration';
|
|
28
|
+
}
|
|
29
|
+
/** Rule constraining which vertex kinds an edge can connect. */
|
|
30
|
+
export interface EdgeRule {
|
|
31
|
+
readonly edgeKind: string;
|
|
32
|
+
/** Allowed source vertex kinds. Empty array means any. */
|
|
33
|
+
readonly srcKinds: readonly string[];
|
|
34
|
+
/** Allowed target vertex kinds. Empty array means any. */
|
|
35
|
+
readonly tgtKinds: readonly string[];
|
|
36
|
+
}
|
|
37
|
+
/** A protocol specification defining schema/instance theories and validation rules. */
|
|
38
|
+
export interface ProtocolSpec {
|
|
39
|
+
readonly name: string;
|
|
40
|
+
readonly schemaTheory: string;
|
|
41
|
+
readonly instanceTheory: string;
|
|
42
|
+
readonly edgeRules: readonly EdgeRule[];
|
|
43
|
+
readonly objKinds: readonly string[];
|
|
44
|
+
readonly constraintSorts: readonly string[];
|
|
45
|
+
}
|
|
46
|
+
/** Options for vertex creation. */
|
|
47
|
+
export interface VertexOptions {
|
|
48
|
+
readonly nsid?: string;
|
|
49
|
+
}
|
|
50
|
+
/** A vertex in a schema graph. */
|
|
51
|
+
export interface Vertex {
|
|
52
|
+
readonly id: string;
|
|
53
|
+
readonly kind: string;
|
|
54
|
+
readonly nsid?: string | undefined;
|
|
55
|
+
}
|
|
56
|
+
/** A directed edge in a schema graph. */
|
|
57
|
+
export interface Edge {
|
|
58
|
+
readonly src: string;
|
|
59
|
+
readonly tgt: string;
|
|
60
|
+
readonly kind: string;
|
|
61
|
+
readonly name?: string | undefined;
|
|
62
|
+
}
|
|
63
|
+
/** A hyperedge with a labeled signature. */
|
|
64
|
+
export interface HyperEdge {
|
|
65
|
+
readonly id: string;
|
|
66
|
+
readonly kind: string;
|
|
67
|
+
readonly signature: Readonly<Record<string, string>>;
|
|
68
|
+
readonly parentLabel: string;
|
|
69
|
+
}
|
|
70
|
+
/** A constraint on a vertex (sort + value). */
|
|
71
|
+
export interface Constraint {
|
|
72
|
+
readonly sort: string;
|
|
73
|
+
readonly value: string;
|
|
74
|
+
}
|
|
75
|
+
/** Options for edge creation. */
|
|
76
|
+
export interface EdgeOptions {
|
|
77
|
+
readonly name?: string;
|
|
78
|
+
}
|
|
79
|
+
/** Serializable schema representation. */
|
|
80
|
+
export interface SchemaData {
|
|
81
|
+
readonly protocol: string;
|
|
82
|
+
readonly vertices: Readonly<Record<string, Vertex>>;
|
|
83
|
+
readonly edges: readonly Edge[];
|
|
84
|
+
readonly hyperEdges: Readonly<Record<string, HyperEdge>>;
|
|
85
|
+
readonly constraints: Readonly<Record<string, readonly Constraint[]>>;
|
|
86
|
+
readonly required: Readonly<Record<string, readonly Edge[]>>;
|
|
87
|
+
}
|
|
88
|
+
/** A vertex mapping entry for migration building. */
|
|
89
|
+
export interface VertexMapping {
|
|
90
|
+
readonly src: string;
|
|
91
|
+
readonly tgt: string;
|
|
92
|
+
}
|
|
93
|
+
/** A migration specification (maps between two schemas). */
|
|
94
|
+
export interface MigrationSpec {
|
|
95
|
+
readonly vertexMap: Readonly<Record<string, string>>;
|
|
96
|
+
readonly edgeMap: readonly [Edge, Edge][];
|
|
97
|
+
readonly resolvers: readonly [[string, string], Edge][];
|
|
98
|
+
}
|
|
99
|
+
/** Result of applying a compiled migration to a record. */
|
|
100
|
+
export interface LiftResult {
|
|
101
|
+
readonly data: unknown;
|
|
102
|
+
}
|
|
103
|
+
/** Get result for bidirectional lens operation. */
|
|
104
|
+
export interface GetResult {
|
|
105
|
+
readonly view: unknown;
|
|
106
|
+
readonly complement: Uint8Array;
|
|
107
|
+
}
|
|
108
|
+
/** A single change detected between two schemas. */
|
|
109
|
+
export interface SchemaChange {
|
|
110
|
+
readonly kind: 'vertex-added' | 'vertex-removed' | 'edge-added' | 'edge-removed' | 'constraint-added' | 'constraint-removed' | 'constraint-changed' | 'kind-changed' | 'required-added' | 'required-removed';
|
|
111
|
+
readonly path: string;
|
|
112
|
+
readonly detail?: string | undefined;
|
|
113
|
+
}
|
|
114
|
+
/** Compatibility classification. */
|
|
115
|
+
export type Compatibility = 'fully-compatible' | 'backward-compatible' | 'breaking';
|
|
116
|
+
/** Schema diff report. */
|
|
117
|
+
export interface DiffReport {
|
|
118
|
+
readonly compatibility: Compatibility;
|
|
119
|
+
readonly changes: readonly SchemaChange[];
|
|
120
|
+
}
|
|
121
|
+
/** A structured existence error. */
|
|
122
|
+
export interface ExistenceError {
|
|
123
|
+
readonly kind: 'edge-missing' | 'kind-inconsistency' | 'label-inconsistency' | 'required-field-missing' | 'constraint-tightened' | 'resolver-invalid' | 'well-formedness' | 'signature-coherence' | 'simultaneity' | 'reachability-risk';
|
|
124
|
+
readonly message: string;
|
|
125
|
+
readonly detail?: Record<string, unknown> | undefined;
|
|
126
|
+
}
|
|
127
|
+
/** Result of existence checking. */
|
|
128
|
+
export interface ExistenceReport {
|
|
129
|
+
readonly valid: boolean;
|
|
130
|
+
readonly errors: readonly ExistenceError[];
|
|
131
|
+
}
|
|
132
|
+
/** The raw WASM module interface (10 entry points). */
|
|
133
|
+
export interface WasmExports {
|
|
134
|
+
define_protocol(spec: Uint8Array): number;
|
|
135
|
+
build_schema(proto: number, ops: Uint8Array): number;
|
|
136
|
+
check_existence(proto: number, src: number, tgt: number, mapping: Uint8Array): Uint8Array;
|
|
137
|
+
compile_migration(src: number, tgt: number, mapping: Uint8Array): number;
|
|
138
|
+
lift_record(migration: number, record: Uint8Array): Uint8Array;
|
|
139
|
+
get_record(migration: number, record: Uint8Array): Uint8Array;
|
|
140
|
+
put_record(migration: number, view: Uint8Array, complement: Uint8Array): Uint8Array;
|
|
141
|
+
compose_migrations(m1: number, m2: number): number;
|
|
142
|
+
diff_schemas(s1: number, s2: number): Uint8Array;
|
|
143
|
+
free_handle(handle: number): void;
|
|
144
|
+
}
|
|
145
|
+
/** WASM module wrapper including exports and memory. */
|
|
146
|
+
export interface WasmModule {
|
|
147
|
+
readonly exports: WasmExports;
|
|
148
|
+
readonly memory: WebAssembly.Memory;
|
|
149
|
+
}
|
|
150
|
+
/** Base error class for all panproto errors. */
|
|
151
|
+
export declare class PanprotoError extends Error {
|
|
152
|
+
readonly name: string;
|
|
153
|
+
constructor(message: string, options?: ErrorOptions);
|
|
154
|
+
}
|
|
155
|
+
/** Error from WASM boundary. */
|
|
156
|
+
export declare class WasmError extends PanprotoError {
|
|
157
|
+
readonly name = "WasmError";
|
|
158
|
+
}
|
|
159
|
+
/** Error from schema validation. */
|
|
160
|
+
export declare class SchemaValidationError extends PanprotoError {
|
|
161
|
+
readonly errors: readonly string[];
|
|
162
|
+
readonly name = "SchemaValidationError";
|
|
163
|
+
constructor(message: string, errors: readonly string[]);
|
|
164
|
+
}
|
|
165
|
+
/** Error from migration compilation. */
|
|
166
|
+
export declare class MigrationError extends PanprotoError {
|
|
167
|
+
readonly name = "MigrationError";
|
|
168
|
+
}
|
|
169
|
+
/** Error from existence checking. */
|
|
170
|
+
export declare class ExistenceCheckError extends PanprotoError {
|
|
171
|
+
readonly report: ExistenceReport;
|
|
172
|
+
readonly name = "ExistenceCheckError";
|
|
173
|
+
constructor(message: string, report: ExistenceReport);
|
|
174
|
+
}
|
|
175
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAMH,6CAA6C;AAC7C,MAAM,WAAW,MAAM;IACrB,QAAQ,CAAC,OAAO,EAAE,OAAO,MAAM,CAAC;IAChC,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;CACrB;AAED,8CAA8C;AAC9C,MAAM,WAAW,cAAe,SAAQ,MAAM;IAC5C,QAAQ,CAAC,MAAM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,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC;AAED,wDAAwD;AACxD,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC;IAC9B,QAAQ,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC;CACrC;AAMD,gDAAgD;AAChD,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAkB,IAAI,EAAE,MAAM,CAAmB;gBAErC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY;CAGpD;AAED,gCAAgC;AAChC,qBAAa,SAAU,SAAQ,aAAa;IAC1C,SAAkB,IAAI,eAAe;CACtC;AAED,oCAAoC;AACpC,qBAAa,qBAAsB,SAAQ,aAAa;IAKpD,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE;IAJpC,SAAkB,IAAI,2BAA2B;gBAG/C,OAAO,EAAE,MAAM,EACN,MAAM,EAAE,SAAS,MAAM,EAAE;CAIrC;AAED,wCAAwC;AACxC,qBAAa,cAAe,SAAQ,aAAa;IAC/C,SAAkB,IAAI,oBAAoB;CAC3C;AAED,qCAAqC;AACrC,qBAAa,mBAAoB,SAAQ,aAAa;IAKlD,QAAQ,CAAC,MAAM,EAAE,eAAe;IAJlC,SAAkB,IAAI,yBAAyB;gBAG7C,OAAO,EAAE,MAAM,EACN,MAAM,EAAE,eAAe;CAInC"}
|
package/dist/wasm.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { WasmModule, WasmExports } from './types.js';
|
|
2
|
+
/**
|
|
3
|
+
* Shape of a pre-imported wasm-bindgen glue module.
|
|
4
|
+
*
|
|
5
|
+
* The `default` export is the wasm-bindgen init function. We type it
|
|
6
|
+
* loosely so any wasm-bindgen output module satisfies the interface.
|
|
7
|
+
*/
|
|
8
|
+
export interface WasmGlueModule {
|
|
9
|
+
default: (...args: any[]) => Promise<{
|
|
10
|
+
memory: WebAssembly.Memory;
|
|
11
|
+
}>;
|
|
12
|
+
define_protocol: WasmExports['define_protocol'];
|
|
13
|
+
build_schema: WasmExports['build_schema'];
|
|
14
|
+
check_existence: WasmExports['check_existence'];
|
|
15
|
+
compile_migration: WasmExports['compile_migration'];
|
|
16
|
+
lift_record: WasmExports['lift_record'];
|
|
17
|
+
get_record: WasmExports['get_record'];
|
|
18
|
+
put_record: WasmExports['put_record'];
|
|
19
|
+
compose_migrations: WasmExports['compose_migrations'];
|
|
20
|
+
diff_schemas: WasmExports['diff_schemas'];
|
|
21
|
+
free_handle: WasmExports['free_handle'];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Load the panproto WASM module.
|
|
25
|
+
*
|
|
26
|
+
* Accepts either:
|
|
27
|
+
* - A URL to the wasm-bindgen `.js` glue module (loaded via dynamic import)
|
|
28
|
+
* - A pre-imported wasm-bindgen glue module object (for bundler environments like Vite)
|
|
29
|
+
*
|
|
30
|
+
* @param input - URL string, URL object, or pre-imported glue module.
|
|
31
|
+
* Defaults to the bundled glue module URL.
|
|
32
|
+
* @returns The initialized WASM module
|
|
33
|
+
* @throws {@link WasmError} if loading or instantiation fails
|
|
34
|
+
*/
|
|
35
|
+
export declare function loadWasm(input?: string | URL | WasmGlueModule): Promise<WasmModule>;
|
|
36
|
+
/**
|
|
37
|
+
* A disposable wrapper around a WASM handle.
|
|
38
|
+
*
|
|
39
|
+
* Implements `Symbol.dispose` for use with `using` declarations.
|
|
40
|
+
* A `FinalizationRegistry` acts as a safety net for handles that
|
|
41
|
+
* are not explicitly disposed.
|
|
42
|
+
*/
|
|
43
|
+
export declare class WasmHandle implements Disposable {
|
|
44
|
+
#private;
|
|
45
|
+
constructor(handle: number, freeHandle: (h: number) => void);
|
|
46
|
+
/** The raw WASM handle id. Only for internal use within the SDK. */
|
|
47
|
+
get id(): number;
|
|
48
|
+
/** Whether this handle has been disposed. */
|
|
49
|
+
get disposed(): boolean;
|
|
50
|
+
/** Release the underlying WASM resource. */
|
|
51
|
+
[Symbol.dispose](): void;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Create a managed handle that will be freed when disposed.
|
|
55
|
+
*
|
|
56
|
+
* @param rawHandle - The u32 handle from WASM
|
|
57
|
+
* @param wasm - The WASM module for freeing
|
|
58
|
+
* @returns A disposable wrapper
|
|
59
|
+
*/
|
|
60
|
+
export declare function createHandle(rawHandle: number, wasm: WasmModule): WasmHandle;
|
|
61
|
+
//# sourceMappingURL=wasm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm.d.ts","sourceRoot":"","sources":["../src/wasm.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAM1D;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAE7B,OAAO,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC;QAAE,MAAM,EAAE,WAAW,CAAC,MAAM,CAAA;KAAE,CAAC,CAAC;IACrE,eAAe,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAChD,YAAY,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IAC1C,eAAe,EAAE,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAChD,iBAAiB,EAAE,WAAW,CAAC,mBAAmB,CAAC,CAAC;IACpD,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;IACxC,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IACtC,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;IACtC,kBAAkB,EAAE,WAAW,CAAC,oBAAoB,CAAC,CAAC;IACtD,YAAY,EAAE,WAAW,CAAC,cAAc,CAAC,CAAC;IAC1C,WAAW,EAAE,WAAW,CAAC,aAAa,CAAC,CAAC;CACzC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAA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