@effect-native/libcrsql 0.16.3-1 → 0.16.301

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.
Files changed (54) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +41 -152
  3. package/dist/cjs/browser-unsupported.js +14 -0
  4. package/dist/cjs/browser-unsupported.js.map +1 -0
  5. package/dist/cjs/index.js +77 -0
  6. package/dist/cjs/index.js.map +1 -0
  7. package/dist/cjs/paths.js +45 -0
  8. package/dist/cjs/paths.js.map +1 -0
  9. package/dist/cjs/platform.js +61 -0
  10. package/dist/cjs/platform.js.map +1 -0
  11. package/dist/cjs/version.js +12 -0
  12. package/dist/cjs/version.js.map +1 -0
  13. package/dist/dts/browser-unsupported.d.ts +7 -0
  14. package/dist/dts/browser-unsupported.d.ts.map +1 -0
  15. package/dist/dts/index.d.ts +44 -0
  16. package/dist/dts/index.d.ts.map +1 -0
  17. package/dist/dts/paths.d.ts +38 -0
  18. package/dist/dts/paths.d.ts.map +1 -0
  19. package/dist/dts/platform.d.ts +30 -0
  20. package/dist/dts/platform.d.ts.map +1 -0
  21. package/dist/dts/version.d.ts +6 -0
  22. package/dist/dts/version.d.ts.map +1 -0
  23. package/dist/esm/browser-unsupported.js +10 -0
  24. package/dist/esm/browser-unsupported.js.map +1 -0
  25. package/dist/esm/index.js +68 -0
  26. package/dist/esm/index.js.map +1 -0
  27. package/dist/esm/package.json +8 -0
  28. package/dist/esm/paths.js +38 -0
  29. package/dist/esm/paths.js.map +1 -0
  30. package/dist/esm/platform.js +52 -0
  31. package/dist/esm/platform.js.map +1 -0
  32. package/dist/esm/version.js +6 -0
  33. package/dist/esm/version.js.map +1 -0
  34. package/dist/lib/darwin-aarch64/libcrsqlite.dylib +0 -0
  35. package/{lib/crsqlite-darwin-x86_64.dylib → dist/lib/darwin-x86_64/libcrsqlite.dylib} +0 -0
  36. package/dist/lib/linux-aarch64/libcrsqlite.so +0 -0
  37. package/dist/lib/linux-x86_64/libcrsqlite.so +0 -0
  38. package/dist/lib/win-i686/crsqlite.dll +0 -0
  39. package/dist/lib/win-x86_64/crsqlite.dll +0 -0
  40. package/effect/package.json +6 -0
  41. package/package.json +55 -59
  42. package/paths/package.json +6 -0
  43. package/src/browser-unsupported.ts +9 -0
  44. package/src/effect.ts +117 -0
  45. package/src/index.ts +87 -0
  46. package/src/paths.ts +47 -0
  47. package/src/platform.ts +75 -0
  48. package/src/version.ts +5 -0
  49. package/bin/libcrsql-extension-path.js +0 -10
  50. package/index.d.ts +0 -16
  51. package/index.js +0 -67
  52. package/lib/crsqlite-darwin-aarch64.dylib +0 -0
  53. package/react-native.d.ts +0 -13
  54. package/react-native.js +0 -32
package/LICENSE ADDED
@@ -0,0 +1,22 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Effect-Native Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
22
+
package/README.md CHANGED
@@ -1,176 +1,65 @@
1
1
  # @effect-native/libcrsql
2
2
 
3
- [![npm version](https://badge.fury.io/js/%40effect-native%2Flibcrsql.svg)](https://badge.fury.io/js/%40effect-native%2Flibcrsql)
3
+ Absolute paths to the cr-sqlite extension binaries for common desktop/server platforms, plus an optional Effect entrypoint.
4
4
 
5
- Pure-Nix CR-SQLite extension for conflict-free replicated databases. Just Works™ everywhere - Mac, Linux, Pi, Docker, Vercel, etc.
5
+ Supported platforms (verified on release):
6
+ - macOS: darwin-aarch64, darwin-x86_64
7
+ - Linux: linux-aarch64, linux-x86_64
8
+ - Windows: win-x86_64, win-i686
6
9
 
7
- ## What is CR-SQLite?
10
+ ## Install
8
11
 
9
- CR-SQLite is a run-time loadable extension for SQLite that enables Conflict-free Replicated Data Types (CRDTs). It allows you to create tables that can be replicated across multiple devices/servers and automatically merge changes without conflicts.
12
+ pnpm add @effect-native/libcrsql
10
13
 
11
- This package provides pre-built CR-SQLite extensions via Nix, eliminating the need to build from source.
14
+ ## Usage (no Effect)
12
15
 
13
- ## Installation
16
+ import Database from "better-sqlite3"
17
+ import { pathToCrSqliteExtension, getCrSqliteExtensionPathSync } from "@effect-native/libcrsql"
14
18
 
15
- ```bash
16
- npm install @effect-native/libcrsql
17
- ```
18
-
19
- ## Quick Start
20
-
21
- ```javascript
22
- import { pathToCRSQLiteExtension } from '@effect-native/libcrsql';
23
- import Database from 'better-sqlite3';
24
-
25
- const db = new Database(':memory:');
26
- db.loadExtension(pathToCRSQLiteExtension);
27
-
28
- // Convert table to conflict-free replicated relation
29
- db.exec(`
30
- CREATE TABLE users (id INTEGER PRIMARY KEY, name TEXT);
31
- SELECT crsql_as_crr('users');
32
- `);
33
-
34
- // Insert data - changes are automatically tracked
35
- db.exec(`INSERT INTO users (name) VALUES ('Alice')`);
36
-
37
- // Get changes for synchronization
38
- const changes = db.prepare(`SELECT * FROM crsql_changes`).all();
39
- console.log('Changes to sync:', changes);
40
- ```
41
-
42
- ## API
43
-
44
- ### `pathToCRSQLiteExtension`
45
-
46
- Path to the CR-SQLite extension file. Use this with your SQLite library's `loadExtension()` method.
47
-
48
- ```javascript
49
- import { pathToCRSQLiteExtension } from '@effect-native/libcrsql';
50
- console.log(pathToCRSQLiteExtension); // /path/to/crsqlite-darwin-aarch64.dylib
51
- ```
52
-
53
- ### `getExtensionPath()`
54
-
55
- Function that returns the path to the CR-SQLite extension.
56
-
57
- ```javascript
58
- import { getExtensionPath } from '@effect-native/libcrsql';
59
- const extensionPath = getExtensionPath();
60
- ```
61
-
62
- ## CLI Usage
63
-
64
- ```bash
65
- npx libcrsql-extension-path
66
- # /path/to/crsqlite-darwin-aarch64.dylib
67
- ```
68
-
69
- ## Supported Platforms
19
+ const db = new Database(":memory:")
20
+ db.loadExtension(pathToCrSqliteExtension)
21
+ // or explicit
22
+ // db.loadExtension(getCrSqliteExtensionPathSync("linux-x86_64"))
70
23
 
71
- - **macOS** (Intel & Apple Silicon)
72
- - ✅ **Linux** (x86_64 & ARM64)
73
- - ✅ **Docker** containers
74
- - ✅ **Vercel**, Netlify, Railway
75
- - ✅ **Raspberry Pi** 4+
76
- - ✅ **AWS Lambda** (with custom runtime)
24
+ ## Absolute constants (no side effects)
77
25
 
78
- ## Database Libraries
26
+ import { linux_x86_64 } from "@effect-native/libcrsql/paths"
27
+ // linux_x86_64 is an absolute string like
28
+ // /.../node_modules/@effect-native/libcrsql/lib/linux-x86_64/libcrsqlite.so
79
29
 
80
- Works with any SQLite library that supports loading extensions:
30
+ ## Effect entrypoint (optional)
81
31
 
82
- ### better-sqlite3
83
- ```javascript
84
- import Database from 'better-sqlite3';
85
- import { pathToCRSQLiteExtension } from '@effect-native/libcrsql';
32
+ import { Effect } from "effect"
33
+ import { getCrSqliteExtensionPath } from "@effect-native/libcrsql/effect"
86
34
 
87
- const db = new Database('my-app.db');
88
- db.loadExtension(pathToCRSQLiteExtension);
89
- ```
35
+ const program = getCrSqliteExtensionPath()
36
+ Effect.runPromise(program)
90
37
 
91
- ### sqlite3
92
- ```javascript
93
- import sqlite3 from 'sqlite3';
94
- import { pathToCRSQLiteExtension } from '@effect-native/libcrsql';
38
+ ## Notes
39
+ - No network or postinstall scripts. Binaries are bundled in `lib/`.
40
+ - Android and iOS are out of scope for this release.
41
+ - Root and paths entrypoints have zero external runtime dependencies.
95
42
 
96
- const db = new sqlite3.Database('my-app.db');
97
- db.loadExtension(pathToCRSQLiteExtension);
98
- ```
43
+ ## Versioning Policy
99
44
 
100
- ### Bun SQLite
101
- ```javascript
102
- import { Database } from 'bun:sqlite';
103
- import { pathToCRSQLiteExtension } from '@effect-native/libcrsql';
45
+ - This package embeds the upstream cr-sqlite version into the npm SemVer patch field.
46
+ - Mapping: `<upstream-major>.<upstream-minor>.<upstream-patch>` → npm `<major>.<minor>.<patch>` where `patch = upstreamPatch * 100 + wrapperPatch`.
47
+ - Example: upstream `0.16.3` npm `0.16.300` (first wrapper release). Subsequent wrapper patches: `0.16.301`, `0.16.302`, ...
48
+ - Next upstream `0.16.4` npm `0.16.400` (then wrapper patches continue).
49
+ - The exact upstream version is exported:
104
50
 
105
- const db = new Database('my-app.db');
106
- db.loadExtension(pathToCRSQLiteExtension);
51
+ ```ts
52
+ import { CRSQLITE_VERSION } from "@effect-native/libcrsql" // or /effect
53
+ console.log(CRSQLITE_VERSION) // "0.16.3"
107
54
  ```
108
55
 
109
- ## React Native
110
-
111
- This package is for **Node.js/Bun server environments only**. For React Native, use:
112
-
113
- - [@op-engineering/op-sqlite](https://www.npmjs.com/package/@op-engineering/op-sqlite)
114
- - [expo-sqlite](https://docs.expo.dev/versions/latest/sdk/sqlite/)
115
-
116
- ## CR-SQLite Functions
117
-
118
- Once loaded, CR-SQLite provides these functions:
119
-
120
- - `crsql_as_crr(table_name)` - Convert table to conflict-free replicated relation
121
- - `crsql_version()` - Get CR-SQLite version
122
- - `crsql_changes` - Virtual table containing changes for sync
123
- - `crsql_begin_alter(table_name)` - Begin schema changes
124
- - `crsql_commit_alter(table_name)` - Commit schema changes
125
-
126
- See [CR-SQLite Documentation](https://vlcn.io/docs/cr-sqlite/intro) for complete API reference.
127
-
128
- ## Development
129
-
130
- ### Prerequisites
131
- - [Nix](https://nixos.org/download.html) package manager
132
- - Node.js 16+
133
-
134
- ### Building
56
+ ## Performance Note
135
57
 
136
- ```bash
137
- # Build CR-SQLite extensions for all platforms
138
- npm run bundle-lib
58
+ The module uses a synchronous file existence check (`fs.accessSync`) to ensure the returned path points to a real binary. This runs once per import/use and is acceptable for this package’s contract. If needed, this can be revisited later with memoization.
59
+ ## Binary Integrity
139
60
 
140
- # Build production package
141
- npm run build-production
61
+ Run a local integrity check to verify bundled binaries match the expected SHA256:
142
62
 
143
- # Run tests
144
- npm test
145
- npm run test:docker
146
63
  ```
147
-
148
- ## Troubleshooting
149
-
150
- ### "Extension not found" Error
151
-
152
- ```bash
153
- # Check what platforms are available
154
- npm list @effect-native/libcrsql
155
- ls node_modules/@effect-native/libcrsql/lib/
156
-
157
- # Get extension path for debugging
158
- npx libcrsql-extension-path
64
+ pnpm --filter @effect-native/libcrsql run verify
159
65
  ```
160
-
161
- ## Contributing
162
-
163
- 1. Fork the repository
164
- 2. Create your feature branch: `git checkout -b my-feature`
165
- 3. Make your changes and run tests: `npm test`
166
- 4. Submit a pull request
167
-
168
- ## License
169
-
170
- MIT
171
-
172
- ## Related
173
-
174
- - [CR-SQLite](https://github.com/vlcn-io/cr-sqlite) - The upstream CR-SQLite project
175
- - [@effect-native/libsqlite](https://github.com/effect-native/libsqlite) - Nix-built SQLite library
176
- - [vlcn.io](https://vlcn.io) - CR-SQLite documentation and tools
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ /**
7
+ * Browser guard for @effect-native/libcrsql.
8
+ * This package is Node.js-only and provides paths to native binaries.
9
+ * @since 0.16.300
10
+ */
11
+ // Importing in browser environments is not supported.
12
+ const msg = "@effect-native/libcrsql is Node.js-only (native binaries). Browser is not supported.";
13
+ throw new Error(msg);
14
+ //# sourceMappingURL=browser-unsupported.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-unsupported.js","names":["msg","Error"],"sources":["../../src/browser-unsupported.ts"],"sourcesContent":[null],"mappings":";;;;;AAAA;;;;;AAKA;AAEA,MAAMA,GAAG,GAAG,sFAAsF;AAClG,MAAM,IAAIC,KAAK,CAACD,GAAG,CAAC","ignoreList":[]}
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.pathToCrSqliteExtension = exports.getCrSqliteExtensionPathSync = exports.SUPPORTED_PLATFORMS = exports.CRSQLITE_VERSION = void 0;
7
+ var fs = _interopRequireWildcard(require("node:fs"));
8
+ var _nodeUrl = require("node:url");
9
+ var _platform = require("./platform.js");
10
+ var _version = require("./version.js");
11
+ function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
12
+ /**
13
+ * Root entrypoint: absolute path getters with zero external dependencies.
14
+ *
15
+ * @since 0.16.300
16
+ */
17
+
18
+ /**
19
+ * Synchronous absolute path resolution for the cr-sqlite extension binary.
20
+ *
21
+ * - Returns an absolute path string that you can pass to `db.loadExtension()`.
22
+ * - Throws native Error with `code` set to `ERR_PLATFORM_UNSUPPORTED` or
23
+ * `ERR_EXTENSION_NOT_FOUND`.
24
+ *
25
+ * @since 0.16.300
26
+ * @example
27
+ * import { getCrSqliteExtensionPathSync } from "@effect-native/libcrsql"
28
+ *
29
+ * const path = getCrSqliteExtensionPathSync()
30
+ * console.log(path)
31
+ */
32
+ const getCrSqliteExtensionPathSync = platform => {
33
+ const target = platform ?? (0, _platform.detectPlatform)();
34
+ if (!(0, _platform.isSupportedPlatform)(target)) {
35
+ const err = new Error(`Platform "${target}" is not supported. Detected: ${process.platform}-${process.arch}. Supported: ${SUPPORTED_PLATFORMS.join(", ")}`);
36
+ err.code = "ERR_PLATFORM_UNSUPPORTED";
37
+ throw err;
38
+ }
39
+ const abs = (0, _nodeUrl.fileURLToPath)(new URL(`../${(0, _platform.buildRelativeLibraryPath)(target)}`, import.meta.url));
40
+ // Best-effort existence check without external deps.
41
+ // Note: this synchronous check runs once per import/use and ensures the
42
+ // contract of this package (absolute path to an existing native binary).
43
+ // If needed, we can memoize this at runtime, but import memoization already
44
+ // avoids repeated work in typical usage.
45
+ try {
46
+ fs.accessSync(abs);
47
+ } catch {
48
+ const err = new Error(`Extension binary not found: ${abs}`);
49
+ err.code = "ERR_EXTENSION_NOT_FOUND";
50
+ throw err;
51
+ }
52
+ return abs;
53
+ };
54
+ /**
55
+ * Absolute path to the cr-sqlite binary for the current platform, computed at import time.
56
+ *
57
+ * - Useful for the simplest use cases: just import and load.
58
+ * - Throws on unsupported platform or if the binary is not present.
59
+ *
60
+ * @since 0.16.300
61
+ * @example
62
+ * import { pathToCrSqliteExtension } from "@effect-native/libcrsql"
63
+ * console.log(pathToCrSqliteExtension)
64
+ */
65
+ exports.getCrSqliteExtensionPathSync = getCrSqliteExtensionPathSync;
66
+ const pathToCrSqliteExtension = exports.pathToCrSqliteExtension = /*#__PURE__*/getCrSqliteExtensionPathSync();
67
+ /**
68
+ * List of supported platforms.
69
+ * @since 0.16.300
70
+ */
71
+ const SUPPORTED_PLATFORMS = exports.SUPPORTED_PLATFORMS = _platform.SUPPORTED_PLATFORMS;
72
+ /**
73
+ * Bundled upstream cr-sqlite version.
74
+ * @since 0.16.300
75
+ */
76
+ const CRSQLITE_VERSION = exports.CRSQLITE_VERSION = _version.CRSQLITE_VERSION;
77
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","names":["fs","_interopRequireWildcard","require","_nodeUrl","_platform","_version","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","getCrSqliteExtensionPathSync","platform","target","detectPlatform","isSupportedPlatform","err","Error","process","arch","SUPPORTED_PLATFORMS","join","code","abs","fileURLToPath","URL","buildRelativeLibraryPath","import","meta","url","accessSync","exports","pathToCrSqliteExtension","_SUPPORTED_PLATFORMS","CRSQLITE_VERSION","_CRSQLITE_VERSION"],"sources":["../../src/index.ts"],"sourcesContent":[null],"mappings":";;;;;;AAKA,IAAAA,EAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAD,OAAA;AACA,IAAAE,SAAA,GAAAF,OAAA;AAMA,IAAAG,QAAA,GAAAH,OAAA;AAAoE,SAAAD,wBAAAK,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAP,uBAAA,YAAAA,CAAAK,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA,CAAAC,cAAA,KAAAD,MAAA,CAAAE,wBAAA,CAAAlB,CAAA,EAAAC,CAAA,OAAAM,CAAA,CAAAK,GAAA,IAAAL,CAAA,CAAAM,GAAA,IAAAP,CAAA,CAAAE,CAAA,EAAAP,CAAA,EAAAM,CAAA,IAAAC,CAAA,CAAAP,CAAA,IAAAD,CAAA,CAAAC,CAAA,WAAAO,CAAA,KAAAR,CAAA,EAAAC,CAAA;AAbpE;;;;;;AAiBA;;;;;;;;;;;;;;AAcO,MAAMkB,4BAA4B,GAAIC,QAAmB,IAAY;EAC1E,MAAMC,MAAM,GAAGD,QAAQ,IAAI,IAAAE,wBAAc,GAAE;EAC3C,IAAI,CAAC,IAAAC,6BAAmB,EAACF,MAAM,CAAC,EAAE;IAChC,MAAMG,GAAG,GAA0B,IAAIC,KAAK,CAC1C,aAAaJ,MAAM,iCAAiCK,OAAO,CAACN,QAAQ,IAAIM,OAAO,CAACC,IAAI,gBAClFC,mBAAmB,CAACC,IAAI,CAAC,IAAI,CAC/B,EAAE,CACH;IACDL,GAAG,CAACM,IAAI,GAAG,0BAA0B;IACrC,MAAMN,GAAG;EACX;EACA,MAAMO,GAAG,GAAG,IAAAC,sBAAa,EAAC,IAAIC,GAAG,CAAC,MAAM,IAAAC,kCAAwB,EAACb,MAAM,CAAC,EAAE,EAAEc,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;EAC7F;EACA;EACA;EACA;EACA;EACA,IAAI;IACF3C,EAAE,CAAC4C,UAAU,CAACP,GAAG,CAAC;EACpB,CAAC,CAAC,MAAM;IACN,MAAMP,GAAG,GAA0B,IAAIC,KAAK,CAAC,+BAA+BM,GAAG,EAAE,CAAC;IAClFP,GAAG,CAACM,IAAI,GAAG,yBAAyB;IACpC,MAAMN,GAAG;EACX;EACA,OAAOO,GAAG;AACZ,CAAC;AAED;;;;;;;;;;;AAAAQ,OAAA,CAAApB,4BAAA,GAAAA,4BAAA;AAWO,MAAMqB,uBAAuB,GAAAD,OAAA,CAAAC,uBAAA,gBAAWrB,4BAA4B,EAAE;AAQ7E;;;;AAIO,MAAMS,mBAAmB,GAAAW,OAAA,CAAAX,mBAAA,GAAGa,6BAAoB;AACvD;;;;AAIO,MAAMC,gBAAgB,GAAAH,OAAA,CAAAG,gBAAA,GAAGC,yBAAiB","ignoreList":[]}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.win_x86_64 = exports.win_i686 = exports.linux_x86_64 = exports.linux_aarch64 = exports.darwin_x86_64 = exports.darwin_aarch64 = void 0;
7
+ var _nodeUrl = require("node:url");
8
+ /**
9
+ * Absolute paths per-platform. These are computed from this module location
10
+ * using Node built-ins only (no external dependencies, no I/O).
11
+ *
12
+ * @since 0.16.300
13
+ */
14
+
15
+ /**
16
+ * Absolute path to darwin-aarch64 cr-sqlite dylib.
17
+ * @since 0.16.300
18
+ */
19
+ const darwin_aarch64 = exports.darwin_aarch64 = /*#__PURE__*/(0, _nodeUrl.fileURLToPath)(/*#__PURE__*/new URL("../lib/darwin-aarch64/libcrsqlite.dylib", import.meta.url));
20
+ /**
21
+ * Absolute path to darwin-x86_64 cr-sqlite dylib.
22
+ * @since 0.16.300
23
+ */
24
+ const darwin_x86_64 = exports.darwin_x86_64 = /*#__PURE__*/(0, _nodeUrl.fileURLToPath)(/*#__PURE__*/new URL("../lib/darwin-x86_64/libcrsqlite.dylib", import.meta.url));
25
+ /**
26
+ * Absolute path to linux-aarch64 cr-sqlite so.
27
+ * @since 0.16.300
28
+ */
29
+ const linux_aarch64 = exports.linux_aarch64 = /*#__PURE__*/(0, _nodeUrl.fileURLToPath)(/*#__PURE__*/new URL("../lib/linux-aarch64/libcrsqlite.so", import.meta.url));
30
+ /**
31
+ * Absolute path to linux-x86_64 cr-sqlite so.
32
+ * @since 0.16.300
33
+ */
34
+ const linux_x86_64 = exports.linux_x86_64 = /*#__PURE__*/(0, _nodeUrl.fileURLToPath)(/*#__PURE__*/new URL("../lib/linux-x86_64/libcrsqlite.so", import.meta.url));
35
+ /**
36
+ * Absolute path to win-x86_64 cr-sqlite dll.
37
+ * @since 0.16.300
38
+ */
39
+ const win_x86_64 = exports.win_x86_64 = /*#__PURE__*/(0, _nodeUrl.fileURLToPath)(/*#__PURE__*/new URL("../lib/win-x86_64/crsqlite.dll", import.meta.url));
40
+ /**
41
+ * Absolute path to win-i686 cr-sqlite dll.
42
+ * @since 0.16.300
43
+ */
44
+ const win_i686 = exports.win_i686 = /*#__PURE__*/(0, _nodeUrl.fileURLToPath)(/*#__PURE__*/new URL("../lib/win-i686/crsqlite.dll", import.meta.url));
45
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","names":["_nodeUrl","require","darwin_aarch64","exports","fileURLToPath","URL","import","meta","url","darwin_x86_64","linux_aarch64","linux_x86_64","win_x86_64","win_i686"],"sources":["../../src/paths.ts"],"sourcesContent":[null],"mappings":";;;;;;AAMA,IAAAA,QAAA,GAAAC,OAAA;AANA;;;;;;;AAQA;;;;AAIO,MAAMC,cAAc,GAAAC,OAAA,CAAAD,cAAA,gBAAG,IAAAE,sBAAa,eAAC,IAAIC,GAAG,CAAC,yCAAyC,EAAEC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAChH;;;;AAIO,MAAMC,aAAa,GAAAN,OAAA,CAAAM,aAAA,gBAAG,IAAAL,sBAAa,eAAC,IAAIC,GAAG,CAAC,wCAAwC,EAAEC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAC9G;;;;AAIO,MAAME,aAAa,GAAAP,OAAA,CAAAO,aAAA,gBAAG,IAAAN,sBAAa,eAAC,IAAIC,GAAG,CAAC,qCAAqC,EAAEC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AAC3G;;;;AAIO,MAAMG,YAAY,GAAAR,OAAA,CAAAQ,YAAA,gBAAG,IAAAP,sBAAa,eAAC,IAAIC,GAAG,CAAC,oCAAoC,EAAEC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AACzG;;;;AAIO,MAAMI,UAAU,GAAAT,OAAA,CAAAS,UAAA,gBAAG,IAAAR,sBAAa,eAAC,IAAIC,GAAG,CAAC,gCAAgC,EAAEC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;AACnG;;;;AAIO,MAAMK,QAAQ,GAAAV,OAAA,CAAAU,QAAA,gBAAG,IAAAT,sBAAa,eAAC,IAAIC,GAAG,CAAC,8BAA8B,EAAEC,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,61 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isSupportedPlatform = exports.detectPlatform = exports.buildRelativeLibraryPath = exports.SUPPORTED_PLATFORMS = void 0;
7
+ /**
8
+ * Platform detection and mapping utilities for @effect-native/libcrsql.
9
+ * @since 0.16.300
10
+ */
11
+ // Platform detection and mapping
12
+ /**
13
+ * List of supported platforms.
14
+ * @since 0.16.300
15
+ */
16
+ const SUPPORTED_PLATFORMS = exports.SUPPORTED_PLATFORMS = ["darwin-aarch64", "darwin-x86_64", "linux-aarch64", "linux-x86_64", "win-x86_64", "win-i686"];
17
+ /**
18
+ * True if the given string is a supported platform.
19
+ * @since 0.16.300
20
+ */
21
+ const isSupportedPlatform = p => SUPPORTED_PLATFORMS.includes(p);
22
+ /**
23
+ * Detect current platform string.
24
+ * @since 0.16.300
25
+ */
26
+ exports.isSupportedPlatform = isSupportedPlatform;
27
+ const detectPlatform = () => {
28
+ const platform = process.platform;
29
+ const arch = process.arch;
30
+ // Map Node.js platform/arch to our strings
31
+ if (platform === "darwin" && arch === "arm64") return "darwin-aarch64";
32
+ if (platform === "darwin" && arch === "x64") return "darwin-x86_64";
33
+ if (platform === "linux" && arch === "arm64") return "linux-aarch64";
34
+ if (platform === "linux" && arch === "x64") return "linux-x86_64";
35
+ if (platform === "win32" && arch === "x64") return "win-x86_64";
36
+ if (platform === "win32" && arch === "ia32") return "win-i686";
37
+ return `${platform}-${arch}`;
38
+ };
39
+ /**
40
+ * Build relative path to the cr-sqlite binary within the package.
41
+ * @since 0.16.300
42
+ */
43
+ exports.detectPlatform = detectPlatform;
44
+ const buildRelativeLibraryPath = platform => {
45
+ switch (platform) {
46
+ case "darwin-aarch64":
47
+ case "darwin-x86_64":
48
+ return `lib/${platform}/libcrsqlite.dylib`;
49
+ case "linux-aarch64":
50
+ case "linux-x86_64":
51
+ return `lib/${platform}/libcrsqlite.so`;
52
+ case "win-x86_64":
53
+ case "win-i686":
54
+ return `lib/${platform}/crsqlite.dll`;
55
+ }
56
+ // Exhaustiveness note: if a new Platform variant is added, TypeScript will error
57
+ // unless it is handled above. This fallback exists only for type safety.
58
+ return platform;
59
+ };
60
+ exports.buildRelativeLibraryPath = buildRelativeLibraryPath;
61
+ //# sourceMappingURL=platform.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.js","names":["SUPPORTED_PLATFORMS","exports","isSupportedPlatform","p","includes","detectPlatform","platform","process","arch","buildRelativeLibraryPath"],"sources":["../../src/platform.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA;;;;AAIA;AAcA;;;;AAIO,MAAMA,mBAAmB,GAAAC,OAAA,CAAAD,mBAAA,GAA4B,CAC1D,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,cAAc,EACd,YAAY,EACZ,UAAU,CACF;AAEV;;;;AAIO,MAAME,mBAAmB,GAAIC,CAAS,IAC1CH,mBAA6C,CAACI,QAAQ,CAACD,CAAC,CAAC;AAE5D;;;;AAAAF,OAAA,CAAAC,mBAAA,GAAAA,mBAAA;AAIO,MAAMG,cAAc,GAAGA,CAAA,KAAa;EACzC,MAAMC,QAAQ,GAAGC,OAAO,CAACD,QAAQ;EACjC,MAAME,IAAI,GAAGD,OAAO,CAACC,IAAI;EACzB;EACA,IAAIF,QAAQ,KAAK,QAAQ,IAAIE,IAAI,KAAK,OAAO,EAAE,OAAO,gBAAgB;EACtE,IAAIF,QAAQ,KAAK,QAAQ,IAAIE,IAAI,KAAK,KAAK,EAAE,OAAO,eAAe;EACnE,IAAIF,QAAQ,KAAK,OAAO,IAAIE,IAAI,KAAK,OAAO,EAAE,OAAO,eAAe;EACpE,IAAIF,QAAQ,KAAK,OAAO,IAAIE,IAAI,KAAK,KAAK,EAAE,OAAO,cAAc;EACjE,IAAIF,QAAQ,KAAK,OAAO,IAAIE,IAAI,KAAK,KAAK,EAAE,OAAO,YAAY;EAC/D,IAAIF,QAAQ,KAAK,OAAO,IAAIE,IAAI,KAAK,MAAM,EAAE,OAAO,UAAU;EAC9D,OAAO,GAAGF,QAAQ,IAAIE,IAAI,EAAE;AAC9B,CAAC;AAED;;;;AAAAP,OAAA,CAAAI,cAAA,GAAAA,cAAA;AAIO,MAAMI,wBAAwB,GAAIH,QAAkB,IAAY;EACrE,QAAQA,QAAQ;IACd,KAAK,gBAAgB;IACrB,KAAK,eAAe;MAClB,OAAO,OAAOA,QAAQ,oBAAoB;IAC5C,KAAK,eAAe;IACpB,KAAK,cAAc;MACjB,OAAO,OAAOA,QAAQ,iBAAiB;IACzC,KAAK,YAAY;IACjB,KAAK,UAAU;MACb,OAAO,OAAOA,QAAQ,eAAe;EACzC;EACA;EACA;EACA,OAAOA,QAAwB;AACjC,CAAC;AAAAL,OAAA,CAAAQ,wBAAA,GAAAA,wBAAA","ignoreList":[]}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.CRSQLITE_VERSION = void 0;
7
+ /**
8
+ * Underlying cr-sqlite release version bundled with this package.
9
+ * @since 0.16.300
10
+ */
11
+ const CRSQLITE_VERSION = exports.CRSQLITE_VERSION = "0.16.3";
12
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","names":["CRSQLITE_VERSION","exports"],"sources":["../../src/version.ts"],"sourcesContent":[null],"mappings":";;;;;;AAAA;;;;AAIO,MAAMA,gBAAgB,GAAAC,OAAA,CAAAD,gBAAA,GAAG,QAAQ","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Browser guard for @effect-native/libcrsql.
3
+ * This package is Node.js-only and provides paths to native binaries.
4
+ * @since 0.16.300
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=browser-unsupported.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-unsupported.d.ts","sourceRoot":"","sources":["../../src/browser-unsupported.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
@@ -0,0 +1,44 @@
1
+ import type { Platform as _Platform } from "./platform.js";
2
+ /**
3
+ * Synchronous absolute path resolution for the cr-sqlite extension binary.
4
+ *
5
+ * - Returns an absolute path string that you can pass to `db.loadExtension()`.
6
+ * - Throws native Error with `code` set to `ERR_PLATFORM_UNSUPPORTED` or
7
+ * `ERR_EXTENSION_NOT_FOUND`.
8
+ *
9
+ * @since 0.16.300
10
+ * @example
11
+ * import { getCrSqliteExtensionPathSync } from "@effect-native/libcrsql"
12
+ *
13
+ * const path = getCrSqliteExtensionPathSync()
14
+ * console.log(path)
15
+ */
16
+ export declare const getCrSqliteExtensionPathSync: (platform?: Platform) => string;
17
+ /**
18
+ * Absolute path to the cr-sqlite binary for the current platform, computed at import time.
19
+ *
20
+ * - Useful for the simplest use cases: just import and load.
21
+ * - Throws on unsupported platform or if the binary is not present.
22
+ *
23
+ * @since 0.16.300
24
+ * @example
25
+ * import { pathToCrSqliteExtension } from "@effect-native/libcrsql"
26
+ * console.log(pathToCrSqliteExtension)
27
+ */
28
+ export declare const pathToCrSqliteExtension: string;
29
+ /**
30
+ * Supported platform-arch identifiers.
31
+ * @since 0.16.300
32
+ */
33
+ export type Platform = _Platform;
34
+ /**
35
+ * List of supported platforms.
36
+ * @since 0.16.300
37
+ */
38
+ export declare const SUPPORTED_PLATFORMS: readonly _Platform[];
39
+ /**
40
+ * Bundled upstream cr-sqlite version.
41
+ * @since 0.16.300
42
+ */
43
+ export declare const CRSQLITE_VERSION = "0.16.3";
44
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,eAAe,CAAA;AAE1D;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,4BAA4B,GAAI,WAAW,QAAQ,KAAG,MAyBlE,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,EAAE,MAAuC,CAAA;AAE7E;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,SAAS,CAAA;AAEhC;;;GAGG;AACH,eAAO,MAAM,mBAAmB,sBAAuB,CAAA;AACvD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,WAAoB,CAAA"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Absolute path to darwin-aarch64 cr-sqlite dylib.
3
+ * @since 0.16.300
4
+ */
5
+ export declare const darwin_aarch64: string;
6
+ /**
7
+ * Absolute path to darwin-x86_64 cr-sqlite dylib.
8
+ * @since 0.16.300
9
+ */
10
+ export declare const darwin_x86_64: string;
11
+ /**
12
+ * Absolute path to linux-aarch64 cr-sqlite so.
13
+ * @since 0.16.300
14
+ */
15
+ export declare const linux_aarch64: string;
16
+ /**
17
+ * Absolute path to linux-x86_64 cr-sqlite so.
18
+ * @since 0.16.300
19
+ */
20
+ export declare const linux_x86_64: string;
21
+ /**
22
+ * Absolute path to win-x86_64 cr-sqlite dll.
23
+ * @since 0.16.300
24
+ */
25
+ export declare const win_x86_64: string;
26
+ /**
27
+ * Absolute path to win-i686 cr-sqlite dll.
28
+ * @since 0.16.300
29
+ */
30
+ export declare const win_i686: string;
31
+ /**
32
+ * Map of platform name to absolute path.
33
+ * @since 0.16.300
34
+ */
35
+ export type Paths = {
36
+ readonly [K in "darwin_aarch64" | "darwin_x86_64" | "linux_aarch64" | "linux_x86_64" | "win_x86_64" | "win_i686"]: string;
37
+ };
38
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/paths.ts"],"names":[],"mappings":"AAQA;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAqF,CAAA;AAChH;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAoF,CAAA;AAC9G;;;GAGG;AACH,eAAO,MAAM,aAAa,QAAiF,CAAA;AAC3G;;;GAGG;AACH,eAAO,MAAM,YAAY,QAAgF,CAAA;AACzG;;;GAGG;AACH,eAAO,MAAM,UAAU,QAA4E,CAAA;AACnG;;;GAGG;AACH,eAAO,MAAM,QAAQ,QAA0E,CAAA;AAE/F;;;GAGG;AACH,MAAM,MAAM,KAAK,GAAG;IAClB,QAAQ,EAAE,CAAC,IAAI,gBAAgB,GAAG,eAAe,GAAG,eAAe,GAAG,cAAc,GAAG,YAAY,GAAG,UAAU,GAC9G,MAAM;CACT,CAAA"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Platform detection and mapping utilities for @effect-native/libcrsql.
3
+ * @since 0.16.300
4
+ */
5
+ /**
6
+ * Supported platform-arch identifiers.
7
+ * @since 0.16.300
8
+ */
9
+ export type Platform = "darwin-aarch64" | "darwin-x86_64" | "linux-aarch64" | "linux-x86_64" | "win-x86_64" | "win-i686";
10
+ /**
11
+ * List of supported platforms.
12
+ * @since 0.16.300
13
+ */
14
+ export declare const SUPPORTED_PLATFORMS: ReadonlyArray<Platform>;
15
+ /**
16
+ * True if the given string is a supported platform.
17
+ * @since 0.16.300
18
+ */
19
+ export declare const isSupportedPlatform: (p: string) => p is Platform;
20
+ /**
21
+ * Detect current platform string.
22
+ * @since 0.16.300
23
+ */
24
+ export declare const detectPlatform: () => string;
25
+ /**
26
+ * Build relative path to the cr-sqlite binary within the package.
27
+ * @since 0.16.300
28
+ */
29
+ export declare const buildRelativeLibraryPath: (platform: Platform) => string;
30
+ //# sourceMappingURL=platform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../../src/platform.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAChB,gBAAgB,GAChB,eAAe,GACf,eAAe,GACf,cAAc,GACd,YAAY,GACZ,UAAU,CAAA;AAEd;;;GAGG;AACH,eAAO,MAAM,mBAAmB,EAAE,aAAa,CAAC,QAAQ,CAO9C,CAAA;AAEV;;;GAGG;AACH,eAAO,MAAM,mBAAmB,GAAI,GAAG,MAAM,KAAG,CAAC,IAAI,QACO,CAAA;AAE5D;;;GAGG;AACH,eAAO,MAAM,cAAc,QAAO,MAWjC,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,wBAAwB,GAAI,UAAU,QAAQ,KAAG,MAe7D,CAAA"}
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Underlying cr-sqlite release version bundled with this package.
3
+ * @since 0.16.300
4
+ */
5
+ export declare const CRSQLITE_VERSION = "0.16.3";
6
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,gBAAgB,WAAW,CAAA"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Browser guard for @effect-native/libcrsql.
3
+ * This package is Node.js-only and provides paths to native binaries.
4
+ * @since 0.16.300
5
+ */
6
+ // Importing in browser environments is not supported.
7
+ const msg = "@effect-native/libcrsql is Node.js-only (native binaries). Browser is not supported.";
8
+ throw new Error(msg);
9
+ export {};
10
+ //# sourceMappingURL=browser-unsupported.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"browser-unsupported.js","names":["msg","Error"],"sources":["../../src/browser-unsupported.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;;AAKA;AAEA,MAAMA,GAAG,GAAG,sFAAsF;AAClG,MAAM,IAAIC,KAAK,CAACD,GAAG,CAAC","ignoreList":[]}