@dlovans/tenet-core 0.1.2 → 0.1.4

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
@@ -14,6 +14,22 @@ export interface TenetVerifyResult {
14
14
  valid: boolean;
15
15
  error?: string;
16
16
  }
17
+ export interface Evidence {
18
+ provider_audit_id?: string;
19
+ timestamp?: string;
20
+ signer_id?: string;
21
+ logic_version?: string;
22
+ }
23
+ export interface Attestation {
24
+ statement: string;
25
+ law_ref?: string;
26
+ required_role?: string;
27
+ provider?: string;
28
+ required?: boolean;
29
+ signed?: boolean;
30
+ evidence?: Evidence;
31
+ on_sign?: Action;
32
+ }
17
33
  export interface TenetSchema {
18
34
  protocol?: string;
19
35
  schema_id?: string;
@@ -25,6 +41,7 @@ export interface TenetSchema {
25
41
  state_model?: StateModel;
26
42
  errors?: ValidationError[];
27
43
  status?: 'READY' | 'INCOMPLETE' | 'INVALID';
44
+ attestations?: Record<string, Attestation>;
28
45
  }
29
46
  export interface Definition {
30
47
  type: 'string' | 'number' | 'boolean' | 'select' | 'date' | 'attestation' | 'currency';
package/dist/index.js CHANGED
@@ -29,8 +29,25 @@ async function loadWasm(wasmPath) {
29
29
  const isNode = typeof process !== 'undefined' && process.versions?.node;
30
30
  if (isBrowser) {
31
31
  // Browser environment
32
+ // Resolve paths relative to this module
33
+ const moduleUrl = new URL(import.meta.url);
34
+ const baseUrl = moduleUrl.href.substring(0, moduleUrl.href.lastIndexOf('/'));
35
+ // Load wasm_exec.js if Go is not defined
36
+ if (typeof Go === 'undefined') {
37
+ await new Promise((resolve, reject) => {
38
+ const script = document.createElement('script');
39
+ script.src = `${baseUrl}/../wasm/wasm_exec.js`;
40
+ script.onload = () => resolve();
41
+ script.onerror = () => reject(new Error('Failed to load wasm_exec.js'));
42
+ document.head.appendChild(script);
43
+ });
44
+ }
45
+ // Auto-resolve WASM path if default
46
+ const resolvedWasmPath = wasmPath === './tenet.wasm'
47
+ ? `${baseUrl}/../wasm/tenet.wasm`
48
+ : wasmPath;
32
49
  const go = new Go();
33
- const result = await WebAssembly.instantiateStreaming(fetch(wasmPath), go.importObject);
50
+ const result = await WebAssembly.instantiateStreaming(fetch(resolvedWasmPath), go.importObject);
34
51
  go.run(result.instance);
35
52
  }
36
53
  else if (isNode) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dlovans/tenet-core",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "description": "Declarative logic VM for JSON schemas - reactive validation, temporal routing, and computed state",
6
6
  "main": "dist/index.js",
package/wasm/tenet.wasm CHANGED
Binary file