rust-store-node 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 rust-store 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.
package/README.md ADDED
@@ -0,0 +1,43 @@
1
+ # rust-store-node
2
+
3
+ `rust-store` 的 **Node 绑定(napi-rs)**:把 Rust core 的 Command 契约暴露给 JS Host。
4
+
5
+ - 语言无关核心见 `../core`(GQL / 权限 / 计算列 / 命令规划 / SQL 方言翻译,纯逻辑无 IO)。
6
+ - 绑定层只做「JSON in → JSON out」的类型转换与转发,不持有数据库驱动,不执行任何 IO。
7
+ - Python 侧同构绑定见 `../core-py`(`rust-store-py`)。
8
+
9
+ ## 安装
10
+
11
+ ```bash
12
+ npm i rust-store-node
13
+ ```
14
+
15
+ 平台原生二进制按 `optionalDependencies` 分包发布,安装后自动匹配当前平台。
16
+
17
+ ## 使用
18
+
19
+ ```js
20
+ const { Registry } = require('rust-store-node');
21
+
22
+ const reg = new Registry();
23
+ reg.register({ name: 'User', collection: 'users', fields: { name: { type: 'string' } }, relations: {} });
24
+
25
+ const plan = reg.planQuery('User{name}', {}, null); // → Mongo 命令 JSON
26
+ ```
27
+
28
+ 同步计算列回调经 `setFn` 注册;异步计算列(`asyncFn`)由 Host 走 `prepareQuery` / `stripQuery` 两段式执行。
29
+
30
+ ## 本地构建(开发)
31
+
32
+ 产物在发布期由 `napi build --platform` 生成平台包;开发期可用 cargo 手工构建:
33
+
34
+ ```powershell
35
+ cargo build --manifest-path core-node/Cargo.toml
36
+ Copy-Item core-node/target/debug/rust_store_node.dll core-node/dist/rust-store-node.node -Force
37
+ ```
38
+
39
+ `dist/rust-store-node.node` 仅供本仓库测试与相邻 Host 调试使用,**不会**随 npm 包发布。
40
+
41
+ ## License
42
+
43
+ [MIT](LICENSE)
package/index.d.ts ADDED
@@ -0,0 +1,128 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ /**
7
+ * 系统内部调用上下文工厂:`{ internal: true }` —— 权限引擎全放行、不注入 owner
8
+ * 条件。供 Host 的内部路径(索引创建、归档回填、后台任务等)显式表达「系统调用」,
9
+ * 与 `undefined`(未传上下文,`require_context` 开启时报错)区分。
10
+ */
11
+ export declare function systemContext(): any
12
+ export declare class Registry {
13
+ /** 逐条后处理文档(默认值 → 同步 fn → 递归下钻 → 权限裁剪),返回 `{doc}` */
14
+ processNode(gql: string, doc: any, ctx?: any | undefined | null): any
15
+ /** 需由 Host 异步执行的计算列 `fnRef` 列表(已按 `comp.read` 权限过滤) */
16
+ asyncFnRefs(model: string, ctx?: any | undefined | null): Array<string>
17
+ /** 收集关系依赖并注入 AST,返回 `{relDeps, ast, injectInfo}` */
18
+ injectDepends(gql: string): any
19
+ /** 剥离 asyncFn 依赖注入的字段,返回 `{items}` */
20
+ stripDepInjected(injectInfo: any, items: Array<any>): any
21
+ /** finalize 第一阶段:逐条 `process_node`,返回 `{items, fnRefs}` */
22
+ prepareQuery(postprocess: any, items: Array<any>, ctx?: any | undefined | null): any
23
+ /** finalize 第三阶段:剥离 asyncFn 依赖注入的字段,返回 `{items}` */
24
+ stripQuery(postprocess: any, items: Array<any>): any
25
+ /**
26
+ * 解析 schema 绑定的数据源 kind(`"mongo"` / `"mysql"` / `"postgres"` / `"sqlite"`)
27
+ *
28
+ * `config` 形状:`{ "sources": { "<name>": "<kind>" } }`;`null` → 单源 Mongo。
29
+ */
30
+ resolveDatasource(schemaName: string, config?: any | undefined | null): string
31
+ /** schema 声明的数据源名(未声明 → `null`,语义为 `default`) */
32
+ schemaDatasource(schemaName: string): string | null
33
+ /** 把一条 Mongo 命令 JSON 翻译为指定后端的 SQL 语句序列(见 `translate::translate`)。 */
34
+ dialectTranslate(backend: string, cmd: any): any
35
+ /** 把 `{rowShape, rows}` 还原为嵌套 Mongo 文档数组(平铺 JOIN 行 → 文档) */
36
+ restoreRows(shape: any, rows: any): any
37
+ /** 把 introspection 行 JSON → schemaJSON(`{rows}` 内含 tables/columns/fks/indexes) */
38
+ schemaFromRows(rows: any, backend: string): any
39
+ /** 合并 introspected 基础 schema 与本地 overlay(权限 / 计算列 / 覆盖) */
40
+ mergeSchema(base: any, overlay: any): any
41
+ /**
42
+ * 生成联邦计划:按 schema 的 `(datasource, namespace)` 与数据源 kind 把一条 GQL
43
+ * 拆成「各源命令序列 + 内存 join 边」;Host 逐源执行命令后调 `mergeFederated`
44
+ *
45
+ * `dsConfig`:`{ "sources": { name: kind } }`(与 `init` 的数据源声明一致;
46
+ * `null` = 单源 Mongo)。SQL 同源跨 namespace 仍下推(qualified JOIN),
47
+ * Mongo 跨 db 剥离为内存 join。
48
+ *
49
+ * 返回 `{v, kind:"federated", root, sources, join, postprocess, degraded}`;
50
+ * 单源(无跨源关系)时 `sources` 仅根单元、`join.edges` 为空。
51
+ */
52
+ planFederated(gql: string, params: any, ctx?: any | undefined | null, dsConfig?: any | undefined | null): any
53
+ /** 合并各源结果 → 嵌套文档数组;`results` 必须与 `plan.sources` **同序同长** */
54
+ mergeFederated(plan: any, results: Array<any>): any
55
+ canRead(model: string, ctx?: any | undefined | null): boolean
56
+ canWrite(model: string, ctx?: any | undefined | null): boolean
57
+ shouldInjectOwner(model: string, ctx?: any | undefined | null): boolean
58
+ /** 非 admin 用户只看自己数据时叠加 owner 条件;无上下文时原样返回 */
59
+ mergeOwnerCondition(model: string, ctx?: any | undefined | null, condition?: any | undefined | null): any
60
+ readableFields(model: string, ctx?: any | undefined | null): any
61
+ readableRelations(model: string, ctx?: any | undefined | null): any
62
+ writableFields(model: string, ctx?: any | undefined | null): any
63
+ filterWritableData(model: string, ctx: any | undefined | null, data: any): any
64
+ /** 解析 GQL 并构建 pipeline / projection,返回 `{tokens, ast, pipeline, projection}` */
65
+ buildPipeline(gql: string, params: any, ctx?: any | undefined | null): any
66
+ planQuery(gql: string, params: any, ctx?: any | undefined | null, routeOverride?: any | undefined | null): any
67
+ /** queryOne 计划:未显式 `$limit` 时强制下推 `$limit(1)`(`$pipeline` 全权模式不注入) */
68
+ planQueryOne(gql: string, params: any, ctx?: any | undefined | null, routeOverride?: any | undefined | null): any
69
+ /** 列表 + total;`total` 由 Host 执行 `countCommand` 后回喂,用于算 `hasMore` */
70
+ planQueryWithCount(gql: string, params: any, ctx?: any | undefined | null, total?: number | undefined | null, routeOverride?: any | undefined | null): any
71
+ resolvePage(gql: string, params: any): any
72
+ /** 两阶段查询后按阶段一 `_id` 顺序重排,返回 `{items}` */
73
+ restoreSortOrder(items: Array<any>, ids: Array<any>, sort?: any | undefined | null): any
74
+ /** 生成插入命令;`now` / `newId` 由 Host 提供(core 无时钟与随机源) */
75
+ planInsert(model: string, data: any, now: number, newId: string, ctx?: any | undefined | null, routeOverride?: any | undefined | null): any
76
+ planExists(model: string, condition: any, routeOverride?: any | undefined | null): any
77
+ planCount(model: string, filter?: any | undefined | null, routeOverride?: any | undefined | null): any
78
+ planAggregate(model: string, pipeline: Array<any>, routeOverride?: any | undefined | null): any
79
+ /** 批量插入命令;`newIds` 按需消费(仅无 `_id` 的文档取用) */
80
+ planInsertMany(model: string, docs: Array<any>, now: number, newIds: Array<string>, ctx?: any | undefined | null, routeOverride?: any | undefined | null): any
81
+ /**
82
+ * 更新一条(findOneAndUpdate + returnDocument AFTER)。
83
+ *
84
+ * creator 写权限需探针时返回 `{"needsProbe": cmd}`;Host 执行探针后携
85
+ * `probeFound`(true/false)与 `probeDoc` 重入即得 `{"command": cmd}`。
86
+ */
87
+ planUpdate(model: string, condition: any, data: any, options: any | undefined | null, now: number, ctx?: any | undefined | null, probeFound?: boolean | undefined | null, probeDoc?: any | undefined | null, routeOverride?: any | undefined | null): any
88
+ /** 批量更新(guest / 无写授权直接拒绝,不走 creator 探针) */
89
+ planUpdateMany(model: string, condition: any, data: any, now: number, ctx?: any | undefined | null, routeOverride?: any | undefined | null): any
90
+ /**
91
+ * 删除计划:归档表存在时返回 findCommand(Host 取源文档后调 planArchiveDocs)+
92
+ * deleteCommand。creator 探针语义同 planUpdate。
93
+ */
94
+ planRemove(model: string, condition: any, ctx?: any | undefined | null, probeFound?: boolean | undefined | null, probeDoc?: any | undefined | null, routeOverride?: any | undefined | null): any
95
+ /** 归档文档命令:源文档补 `deletedAt` 后批量写入 `<collection>_deleted` */
96
+ planArchiveDocs(model: string, docs: Array<any>, now: number, routeOverride?: any | undefined | null): any
97
+ /** 显式条件 upsert;`newId` 仅在需生成 `_id` 时被使用 */
98
+ planUpsert(model: string, condition: any, data: any, options: any | undefined | null, now: number, newId: string, ctx?: any | undefined | null, routeOverride?: any | undefined | null): any
99
+ /**
100
+ * mutation 规划:展开为有序步骤序列 `{steps: [{model, command}]}`,
101
+ * 父子依赖用 `{{step.<N>._id}}` 占位符表达,由 Host 依次执行并回填
102
+ */
103
+ planMutation(model: string, data: any, now: number, newIds: Array<string>, ctx?: any | undefined | null, routeOverride?: any | undefined | null): any
104
+ /**
105
+ * 写路径结果回喂:对 findOneAndUpdate 返回文档补默认值 / 同步计算列
106
+ * (对齐 JS `applyDefaultsAndComputes(result, s)`)
107
+ */
108
+ applyWriteDefaults(model: string, doc: any): any
109
+ sortsByRelation(sort?: any | undefined | null): boolean
110
+ constructor()
111
+ /** 注册 schema(自动派生 `<Name>Deleted` 归档表;`timestamps !== false` 时补时间戳字段) */
112
+ register(defn: any): void
113
+ has(name: string): boolean
114
+ list(): Array<string>
115
+ /** 注册同步计算列回调(schema 里 `fn: true` 的 `fnRef`,缺省为计算列名) */
116
+ setFn(fnRef: string, callback: (arg: any) => any): void
117
+ clearFns(): void
118
+ /** 开关用户 $pipeline 直通(默认允许;AI 查询宿主建议关闭作纵深防御) */
119
+ setAllowUserPipeline(allow: boolean): void
120
+ /**
121
+ * 开关「上下文强制」(默认关闭 = fail-open,保持 JS parity)。
122
+ * 开启后:plan 入口遇 `ctx` 缺失抛 `ERR_NO_CONTEXT`(fail-secure),
123
+ * 内部调用须显式传系统上下文 `systemContext()`。
124
+ */
125
+ setRequireContext(require: boolean): void
126
+ /** 「上下文强制」开关当前值 */
127
+ requireContext(): boolean
128
+ }
package/index.js ADDED
@@ -0,0 +1,316 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /* prettier-ignore */
4
+
5
+ /* auto-generated by NAPI-RS */
6
+
7
+ const { existsSync, readFileSync } = require('fs')
8
+ const { join } = require('path')
9
+
10
+ const { platform, arch } = process
11
+
12
+ let nativeBinding = null
13
+ let localFileExisted = false
14
+ let loadError = null
15
+
16
+ function isMusl() {
17
+ // For Node 10
18
+ if (!process.report || typeof process.report.getReport !== 'function') {
19
+ try {
20
+ const lddPath = require('child_process').execSync('which ldd').toString().trim()
21
+ return readFileSync(lddPath, 'utf8').includes('musl')
22
+ } catch (e) {
23
+ return true
24
+ }
25
+ } else {
26
+ const { glibcVersionRuntime } = process.report.getReport().header
27
+ return !glibcVersionRuntime
28
+ }
29
+ }
30
+
31
+ switch (platform) {
32
+ case 'android':
33
+ switch (arch) {
34
+ case 'arm64':
35
+ localFileExisted = existsSync(join(__dirname, 'rust-store-node.android-arm64.node'))
36
+ try {
37
+ if (localFileExisted) {
38
+ nativeBinding = require('./rust-store-node.android-arm64.node')
39
+ } else {
40
+ nativeBinding = require('rust-store-node-android-arm64')
41
+ }
42
+ } catch (e) {
43
+ loadError = e
44
+ }
45
+ break
46
+ case 'arm':
47
+ localFileExisted = existsSync(join(__dirname, 'rust-store-node.android-arm-eabi.node'))
48
+ try {
49
+ if (localFileExisted) {
50
+ nativeBinding = require('./rust-store-node.android-arm-eabi.node')
51
+ } else {
52
+ nativeBinding = require('rust-store-node-android-arm-eabi')
53
+ }
54
+ } catch (e) {
55
+ loadError = e
56
+ }
57
+ break
58
+ default:
59
+ throw new Error(`Unsupported architecture on Android ${arch}`)
60
+ }
61
+ break
62
+ case 'win32':
63
+ switch (arch) {
64
+ case 'x64':
65
+ localFileExisted = existsSync(
66
+ join(__dirname, 'rust-store-node.win32-x64-msvc.node')
67
+ )
68
+ try {
69
+ if (localFileExisted) {
70
+ nativeBinding = require('./rust-store-node.win32-x64-msvc.node')
71
+ } else {
72
+ nativeBinding = require('rust-store-node-win32-x64-msvc')
73
+ }
74
+ } catch (e) {
75
+ loadError = e
76
+ }
77
+ break
78
+ case 'ia32':
79
+ localFileExisted = existsSync(
80
+ join(__dirname, 'rust-store-node.win32-ia32-msvc.node')
81
+ )
82
+ try {
83
+ if (localFileExisted) {
84
+ nativeBinding = require('./rust-store-node.win32-ia32-msvc.node')
85
+ } else {
86
+ nativeBinding = require('rust-store-node-win32-ia32-msvc')
87
+ }
88
+ } catch (e) {
89
+ loadError = e
90
+ }
91
+ break
92
+ case 'arm64':
93
+ localFileExisted = existsSync(
94
+ join(__dirname, 'rust-store-node.win32-arm64-msvc.node')
95
+ )
96
+ try {
97
+ if (localFileExisted) {
98
+ nativeBinding = require('./rust-store-node.win32-arm64-msvc.node')
99
+ } else {
100
+ nativeBinding = require('rust-store-node-win32-arm64-msvc')
101
+ }
102
+ } catch (e) {
103
+ loadError = e
104
+ }
105
+ break
106
+ default:
107
+ throw new Error(`Unsupported architecture on Windows: ${arch}`)
108
+ }
109
+ break
110
+ case 'darwin':
111
+ localFileExisted = existsSync(join(__dirname, 'rust-store-node.darwin-universal.node'))
112
+ try {
113
+ if (localFileExisted) {
114
+ nativeBinding = require('./rust-store-node.darwin-universal.node')
115
+ } else {
116
+ nativeBinding = require('rust-store-node-darwin-universal')
117
+ }
118
+ break
119
+ } catch {}
120
+ switch (arch) {
121
+ case 'x64':
122
+ localFileExisted = existsSync(join(__dirname, 'rust-store-node.darwin-x64.node'))
123
+ try {
124
+ if (localFileExisted) {
125
+ nativeBinding = require('./rust-store-node.darwin-x64.node')
126
+ } else {
127
+ nativeBinding = require('rust-store-node-darwin-x64')
128
+ }
129
+ } catch (e) {
130
+ loadError = e
131
+ }
132
+ break
133
+ case 'arm64':
134
+ localFileExisted = existsSync(
135
+ join(__dirname, 'rust-store-node.darwin-arm64.node')
136
+ )
137
+ try {
138
+ if (localFileExisted) {
139
+ nativeBinding = require('./rust-store-node.darwin-arm64.node')
140
+ } else {
141
+ nativeBinding = require('rust-store-node-darwin-arm64')
142
+ }
143
+ } catch (e) {
144
+ loadError = e
145
+ }
146
+ break
147
+ default:
148
+ throw new Error(`Unsupported architecture on macOS: ${arch}`)
149
+ }
150
+ break
151
+ case 'freebsd':
152
+ if (arch !== 'x64') {
153
+ throw new Error(`Unsupported architecture on FreeBSD: ${arch}`)
154
+ }
155
+ localFileExisted = existsSync(join(__dirname, 'rust-store-node.freebsd-x64.node'))
156
+ try {
157
+ if (localFileExisted) {
158
+ nativeBinding = require('./rust-store-node.freebsd-x64.node')
159
+ } else {
160
+ nativeBinding = require('rust-store-node-freebsd-x64')
161
+ }
162
+ } catch (e) {
163
+ loadError = e
164
+ }
165
+ break
166
+ case 'linux':
167
+ switch (arch) {
168
+ case 'x64':
169
+ if (isMusl()) {
170
+ localFileExisted = existsSync(
171
+ join(__dirname, 'rust-store-node.linux-x64-musl.node')
172
+ )
173
+ try {
174
+ if (localFileExisted) {
175
+ nativeBinding = require('./rust-store-node.linux-x64-musl.node')
176
+ } else {
177
+ nativeBinding = require('rust-store-node-linux-x64-musl')
178
+ }
179
+ } catch (e) {
180
+ loadError = e
181
+ }
182
+ } else {
183
+ localFileExisted = existsSync(
184
+ join(__dirname, 'rust-store-node.linux-x64-gnu.node')
185
+ )
186
+ try {
187
+ if (localFileExisted) {
188
+ nativeBinding = require('./rust-store-node.linux-x64-gnu.node')
189
+ } else {
190
+ nativeBinding = require('rust-store-node-linux-x64-gnu')
191
+ }
192
+ } catch (e) {
193
+ loadError = e
194
+ }
195
+ }
196
+ break
197
+ case 'arm64':
198
+ if (isMusl()) {
199
+ localFileExisted = existsSync(
200
+ join(__dirname, 'rust-store-node.linux-arm64-musl.node')
201
+ )
202
+ try {
203
+ if (localFileExisted) {
204
+ nativeBinding = require('./rust-store-node.linux-arm64-musl.node')
205
+ } else {
206
+ nativeBinding = require('rust-store-node-linux-arm64-musl')
207
+ }
208
+ } catch (e) {
209
+ loadError = e
210
+ }
211
+ } else {
212
+ localFileExisted = existsSync(
213
+ join(__dirname, 'rust-store-node.linux-arm64-gnu.node')
214
+ )
215
+ try {
216
+ if (localFileExisted) {
217
+ nativeBinding = require('./rust-store-node.linux-arm64-gnu.node')
218
+ } else {
219
+ nativeBinding = require('rust-store-node-linux-arm64-gnu')
220
+ }
221
+ } catch (e) {
222
+ loadError = e
223
+ }
224
+ }
225
+ break
226
+ case 'arm':
227
+ if (isMusl()) {
228
+ localFileExisted = existsSync(
229
+ join(__dirname, 'rust-store-node.linux-arm-musleabihf.node')
230
+ )
231
+ try {
232
+ if (localFileExisted) {
233
+ nativeBinding = require('./rust-store-node.linux-arm-musleabihf.node')
234
+ } else {
235
+ nativeBinding = require('rust-store-node-linux-arm-musleabihf')
236
+ }
237
+ } catch (e) {
238
+ loadError = e
239
+ }
240
+ } else {
241
+ localFileExisted = existsSync(
242
+ join(__dirname, 'rust-store-node.linux-arm-gnueabihf.node')
243
+ )
244
+ try {
245
+ if (localFileExisted) {
246
+ nativeBinding = require('./rust-store-node.linux-arm-gnueabihf.node')
247
+ } else {
248
+ nativeBinding = require('rust-store-node-linux-arm-gnueabihf')
249
+ }
250
+ } catch (e) {
251
+ loadError = e
252
+ }
253
+ }
254
+ break
255
+ case 'riscv64':
256
+ if (isMusl()) {
257
+ localFileExisted = existsSync(
258
+ join(__dirname, 'rust-store-node.linux-riscv64-musl.node')
259
+ )
260
+ try {
261
+ if (localFileExisted) {
262
+ nativeBinding = require('./rust-store-node.linux-riscv64-musl.node')
263
+ } else {
264
+ nativeBinding = require('rust-store-node-linux-riscv64-musl')
265
+ }
266
+ } catch (e) {
267
+ loadError = e
268
+ }
269
+ } else {
270
+ localFileExisted = existsSync(
271
+ join(__dirname, 'rust-store-node.linux-riscv64-gnu.node')
272
+ )
273
+ try {
274
+ if (localFileExisted) {
275
+ nativeBinding = require('./rust-store-node.linux-riscv64-gnu.node')
276
+ } else {
277
+ nativeBinding = require('rust-store-node-linux-riscv64-gnu')
278
+ }
279
+ } catch (e) {
280
+ loadError = e
281
+ }
282
+ }
283
+ break
284
+ case 's390x':
285
+ localFileExisted = existsSync(
286
+ join(__dirname, 'rust-store-node.linux-s390x-gnu.node')
287
+ )
288
+ try {
289
+ if (localFileExisted) {
290
+ nativeBinding = require('./rust-store-node.linux-s390x-gnu.node')
291
+ } else {
292
+ nativeBinding = require('rust-store-node-linux-s390x-gnu')
293
+ }
294
+ } catch (e) {
295
+ loadError = e
296
+ }
297
+ break
298
+ default:
299
+ throw new Error(`Unsupported architecture on Linux: ${arch}`)
300
+ }
301
+ break
302
+ default:
303
+ throw new Error(`Unsupported OS: ${platform}, architecture: ${arch}`)
304
+ }
305
+
306
+ if (!nativeBinding) {
307
+ if (loadError) {
308
+ throw loadError
309
+ }
310
+ throw new Error(`Failed to load native binding`)
311
+ }
312
+
313
+ const { Registry, systemContext } = nativeBinding
314
+
315
+ module.exports.Registry = Registry
316
+ module.exports.systemContext = systemContext
package/package.json ADDED
@@ -0,0 +1,65 @@
1
+ {
2
+ "name": "rust-store-node",
3
+ "version": "1.0.0",
4
+ "description": "rust-store 的 Node 绑定(napi-rs):把 core 的 Command 契约暴露给 JS Host",
5
+ "main": "index.js",
6
+ "types": "index.d.ts",
7
+ "files": [
8
+ "index.js",
9
+ "index.d.ts",
10
+ "*.node",
11
+ "README.md",
12
+ "LICENSE"
13
+ ],
14
+ "engines": {
15
+ "node": ">=18"
16
+ },
17
+ "napi": {
18
+ "name": "rust-store-node",
19
+ "triples": {
20
+ "defaults": false,
21
+ "additional": [
22
+ "x86_64-pc-windows-msvc",
23
+ "x86_64-unknown-linux-gnu",
24
+ "aarch64-unknown-linux-gnu",
25
+ "x86_64-apple-darwin",
26
+ "aarch64-apple-darwin"
27
+ ]
28
+ }
29
+ },
30
+ "scripts": {
31
+ "build": "napi build --platform --release",
32
+ "build:debug": "napi build --platform",
33
+ "artifacts": "napi artifacts",
34
+ "prepublishOnly": "napi prepublish -t npm --skip-gh-release",
35
+ "test": "node --test \"test/**/*.test.js\""
36
+ },
37
+ "keywords": [
38
+ "rust-store",
39
+ "napi-rs",
40
+ "binding",
41
+ "gql",
42
+ "data-layer"
43
+ ],
44
+ "author": "leo <coen_ddt@qq.com>",
45
+ "license": "MIT",
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/coenddt/rust-store.git"
49
+ },
50
+ "bugs": {
51
+ "url": "https://github.com/coenddt/rust-store/issues"
52
+ },
53
+ "homepage": "https://github.com/coenddt/rust-store#readme",
54
+ "devDependencies": {
55
+ "@napi-rs/cli": "^2.18.4",
56
+ "sql.js": "^1.8.0"
57
+ },
58
+ "optionalDependencies": {
59
+ "rust-store-node-win32-x64-msvc": "1.0.0",
60
+ "rust-store-node-linux-x64-gnu": "1.0.0",
61
+ "rust-store-node-linux-arm64-gnu": "1.0.0",
62
+ "rust-store-node-darwin-x64": "1.0.0",
63
+ "rust-store-node-darwin-arm64": "1.0.0"
64
+ }
65
+ }