@szdatatalk/sqlward 0.0.0-stage → 0.3.2

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/package.json CHANGED
@@ -1,6 +1,56 @@
1
1
  {
2
2
  "name": "@szdatatalk/sqlward",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.2",
4
+ "license": "Apache-2.0",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/shygoly/sqlward.git",
8
+ "directory": "packages/wasm"
9
+ },
10
+ "homepage": "https://github.com/shygoly/sqlward#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/shygoly/sqlward/issues"
13
+ },
14
+ "description": "Zero-Python WASM runtime for SqlWard: 8-dialect SQL lineage, M6 security policy, receipts, and dbt/OMOP/Robot/M5 adapters",
15
+ "type": "module",
16
+ "main": "index.js",
17
+ "types": "index.d.ts",
18
+ "exports": {
19
+ ".": {
20
+ "types": "./index.d.ts",
21
+ "import": "./index.js"
22
+ }
23
+ },
24
+ "files": [
25
+ "index.js",
26
+ "index.d.ts",
27
+ "wasm-worker.js",
28
+ "wasm/sqlward_wasm.wasm",
29
+ "README.md",
30
+ "LICENSE"
31
+ ],
32
+ "keywords": [
33
+ "szdatatalk",
34
+ "datatalk",
35
+ "sqlward",
36
+ "sql",
37
+ "lineage",
38
+ "wasm",
39
+ "data-governance",
40
+ "security",
41
+ "policy",
42
+ "dbt",
43
+ "omop"
44
+ ],
45
+ "publishConfig": {
46
+ "access": "public"
47
+ },
48
+ "scripts": {
49
+ "stage-wasm": "node -e \"const fs=require('fs'),p=require('path');const dst=p.resolve('wasm/sqlward_wasm.wasm');const srcs=[p.resolve('../../native/target/wasm32-unknown-unknown/release/sqlward_wasm.wasm'),p.resolve('../../evidence/phase2/artifacts/wasm/sqlward_wasm.wasm')];const src=srcs.find((s)=>fs.existsSync(s));if(src){fs.mkdirSync(p.dirname(dst),{recursive:true});fs.copyFileSync(src,dst);}if(!fs.existsSync(dst)){throw new Error('Missing wasm/sqlward_wasm.wasm; build sqlward-wasm first');}const lic=p.resolve('../../LICENSE');if(fs.existsSync(lic))fs.copyFileSync(lic,p.resolve('LICENSE'));\"",
50
+ "prepack": "npm run stage-wasm",
51
+ "test": "node --test test/contract.test.js"
52
+ },
53
+ "engines": {
54
+ "node": ">=20"
55
+ }
56
+ }
Binary file
package/wasm-worker.js ADDED
@@ -0,0 +1,54 @@
1
+ import { parentPort, workerData } from "node:worker_threads";
2
+ import { instantiateWasm } from "./index.js";
3
+
4
+ async function main() {
5
+ const { operation, payload, wasmPath } = workerData;
6
+ if (operation === "__spin_for_cancel_test__") {
7
+ // Deliberate busy loop to prove host worker termination works cleanly
8
+ while (true) {
9
+ Math.imul(1234567, 890123);
10
+ }
11
+ }
12
+ const wasm = await instantiateWasm(wasmPath);
13
+ let result;
14
+ if (operation === "graphDigest") {
15
+ result = wasm.graphDigestFromEdges(payload.edges);
16
+ } else if (operation === "impactDownstream") {
17
+ result = wasm.impactDownstream(payload.edges, payload.originTable, payload.originColumn);
18
+ } else if (operation === "impactUpstream") {
19
+ result = wasm.impactUpstream(payload.edges, payload.originTable, payload.originColumn);
20
+ } else if (operation === "parseColumn") {
21
+ result = wasm.parseColumn(payload);
22
+ } else if (operation === "evaluatePolicy") {
23
+ result = wasm.evaluatePolicy(payload);
24
+ } else if (operation === "verifyReceipt") {
25
+ result = wasm.verifyReceipt(payload);
26
+ } else if (operation === "verifyWorkflowEvidence") {
27
+ result = wasm.verifyWorkflowEvidence(payload);
28
+ } else if (operation === "bind") {
29
+ result = wasm.bind(payload);
30
+ } else if (operation === "analyzeDbt") {
31
+ result = wasm.analyzeDbt(payload);
32
+ } else if (operation === "diffDbt") {
33
+ result = wasm.diffDbt(payload);
34
+ } else if (operation === "impactDbt") {
35
+ result = wasm.impactDbt(payload);
36
+ } else if (operation === "profileOmop") {
37
+ result = wasm.profileOmop(payload);
38
+ } else if (operation === "analyzeMappingImpact") {
39
+ result = wasm.analyzeMappingImpact(payload);
40
+ } else if (operation === "queryRobotImpact") {
41
+ result = wasm.queryRobotImpact(payload);
42
+ } else if (operation === "verifyInterop") {
43
+ result = wasm.verifyInterop(payload);
44
+ } else if (operation === "retrieveContext") {
45
+ result = wasm.retrieveContext(payload);
46
+ } else {
47
+ throw new Error(`unsupported WASM worker operation: ${operation}`);
48
+ }
49
+ parentPort.postMessage({ ok: true, result });
50
+ }
51
+
52
+ main().catch((err) => {
53
+ parentPort.postMessage({ ok: false, error: String(err?.message || err) });
54
+ });