orez-sync-executor 0.9.7 → 0.10.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.d.ts CHANGED
@@ -1,4 +1,6 @@
1
1
  export { createPostgreSQLApplicationDatabase, createSQLiteApplicationDatabase, } from './adapters.js';
2
2
  export * from './core.js';
3
+ export { encodeSqlParams, encodeSqlValue } from './sql-wire.js';
4
+ export type { SqlWireValue } from './sql-wire.js';
3
5
  export type { PostgreSQLApplicationDatabaseOptions, PostgreSQLClient, PostgreSQLPool, PostgreSQLQueryResult, } from './adapters.js';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,+BAA+B,GAChC,MAAM,eAAe,CAAA;AACtB,cAAc,WAAW,CAAA;AAEzB,YAAY,EACV,oCAAoC,EACpC,gBAAgB,EAChB,cAAc,EACd,qBAAqB,GACtB,MAAM,eAAe,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,+BAA+B,GAChC,MAAM,eAAe,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA;AAC/D,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAEjD,YAAY,EACV,oCAAoC,EACpC,gBAAgB,EAChB,cAAc,EACd,qBAAqB,GACtB,MAAM,eAAe,CAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export { createPostgreSQLApplicationDatabase, createSQLiteApplicationDatabase, } from './adapters.js';
2
2
  export * from './core.js';
3
+ export { encodeSqlParams, encodeSqlValue } from './sql-wire.js';
3
4
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,+BAA+B,GAChC,MAAM,eAAe,CAAA;AACtB,cAAc,WAAW,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,+BAA+B,GAChC,MAAM,eAAe,CAAA;AACtB,cAAc,WAAW,CAAA;AACzB,OAAO,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,eAAe,CAAA"}
@@ -0,0 +1,26 @@
1
+ export type SqlWireValue = {
2
+ kind: 'null';
3
+ } | {
4
+ kind: 'integer';
5
+ value: string;
6
+ } | {
7
+ kind: 'real';
8
+ value: number;
9
+ } | {
10
+ kind: 'text';
11
+ value: string;
12
+ } | {
13
+ kind: 'blob';
14
+ value: number[];
15
+ };
16
+ /**
17
+ * encode one JavaScript SQLite binding for Orez's Rust host boundary.
18
+ *
19
+ * integers cross JSON as decimal strings so their i64 value is exact. values
20
+ * with no unambiguous SQLite representation fail here instead of reaching the
21
+ * host as lossy JSON.
22
+ */
23
+ export declare function encodeSqlValue(value: unknown): SqlWireValue;
24
+ /** encode positional SQLite bindings for an Orez Rust sync-host request. */
25
+ export declare function encodeSqlParams(params?: readonly unknown[]): SqlWireValue[];
26
+ //# sourceMappingURL=sql-wire.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-wire.d.ts","sourceRoot":"","sources":["../src/sql-wire.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAClC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAC/B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAAA;AAYrC;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,YAAY,CA2B3D;AAED,4EAA4E;AAC5E,wBAAgB,eAAe,CAAC,MAAM,GAAE,SAAS,OAAO,EAAO,GAAG,YAAY,EAAE,CAE/E"}
@@ -0,0 +1,52 @@
1
+ const I64_MIN = -(1n << 63n);
2
+ const I64_MAX = (1n << 63n) - 1n;
3
+ function integerWireValue(value) {
4
+ if (value < I64_MIN || value > I64_MAX) {
5
+ throw new TypeError(`SQL integer ${value} is outside the i64 range`);
6
+ }
7
+ return { kind: 'integer', value: value.toString() };
8
+ }
9
+ /**
10
+ * encode one JavaScript SQLite binding for Orez's Rust host boundary.
11
+ *
12
+ * integers cross JSON as decimal strings so their i64 value is exact. values
13
+ * with no unambiguous SQLite representation fail here instead of reaching the
14
+ * host as lossy JSON.
15
+ */
16
+ export function encodeSqlValue(value) {
17
+ if (value === null)
18
+ return { kind: 'null' };
19
+ if (typeof value === 'boolean')
20
+ return integerWireValue(value ? 1n : 0n);
21
+ if (typeof value === 'bigint')
22
+ return integerWireValue(value);
23
+ if (typeof value === 'number') {
24
+ if (!Number.isFinite(value)) {
25
+ throw new TypeError('SQL numbers must be finite');
26
+ }
27
+ if (Number.isInteger(value)) {
28
+ if (!Number.isSafeInteger(value)) {
29
+ throw new TypeError('SQL integer numbers must be safe integers; use bigint');
30
+ }
31
+ return integerWireValue(BigInt(value));
32
+ }
33
+ return { kind: 'real', value };
34
+ }
35
+ if (typeof value === 'string')
36
+ return { kind: 'text', value };
37
+ if (value instanceof ArrayBuffer) {
38
+ return { kind: 'blob', value: Array.from(new Uint8Array(value)) };
39
+ }
40
+ if (ArrayBuffer.isView(value)) {
41
+ return {
42
+ kind: 'blob',
43
+ value: Array.from(new Uint8Array(value.buffer, value.byteOffset, value.byteLength)),
44
+ };
45
+ }
46
+ throw new TypeError(`unsupported SQL binding: ${Object.prototype.toString.call(value)}`);
47
+ }
48
+ /** encode positional SQLite bindings for an Orez Rust sync-host request. */
49
+ export function encodeSqlParams(params = []) {
50
+ return params.map(encodeSqlValue);
51
+ }
52
+ //# sourceMappingURL=sql-wire.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sql-wire.js","sourceRoot":"","sources":["../src/sql-wire.ts"],"names":[],"mappings":"AAOA,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,IAAI,GAAG,CAAC,CAAA;AAC5B,MAAM,OAAO,GAAG,CAAC,EAAE,IAAI,GAAG,CAAC,GAAG,EAAE,CAAA;AAEhC,SAAS,gBAAgB,CAAC,KAAa;IACrC,IAAI,KAAK,GAAG,OAAO,IAAI,KAAK,GAAG,OAAO,EAAE,CAAC;QACvC,MAAM,IAAI,SAAS,CAAC,eAAe,KAAK,2BAA2B,CAAC,CAAA;IACtE,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAA;AACrD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,cAAc,CAAC,KAAc;IAC3C,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,CAAA;IAC3C,IAAI,OAAO,KAAK,KAAK,SAAS;QAAE,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAA;IACxE,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAA;IAC7D,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;YAC5B,MAAM,IAAI,SAAS,CAAC,4BAA4B,CAAC,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