jazz-napi 2.0.0-alpha.16 → 2.0.0-alpha.17

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 (3) hide show
  1. package/index.d.ts +27 -56
  2. package/index.js +320 -493
  3. package/package.json +5 -5
package/index.d.ts CHANGED
@@ -2,69 +2,40 @@
2
2
  /* eslint-disable */
3
3
  export declare class NapiRuntime {
4
4
  /** Create a new NapiRuntime with Fjall-backed persistent storage. */
5
- constructor(
6
- schemaJson: string,
7
- appId: string,
8
- jazzEnv: string,
9
- userBranch: string,
10
- dataPath: string,
11
- tier?: string | undefined | null,
12
- );
5
+ constructor(schemaJson: string, appId: string, jazzEnv: string, userBranch: string, dataPath: string, tier?: string | undefined | null)
13
6
  /** Create a new NapiRuntime with in-memory storage (no local persistence). */
14
- static inMemory(
15
- schemaJson: string,
16
- appId: string,
17
- jazzEnv: string,
18
- userBranch: string,
19
- tier?: string | undefined | null,
20
- ): NapiRuntime;
21
- insert(table: string, values: any): any;
22
- update(objectId: string, values: any): void;
23
- delete(objectId: string): void;
24
- query(
25
- queryJson: string,
26
- sessionJson?: string | undefined | null,
27
- tier?: string | undefined | null,
28
- optionsJson?: string | undefined | null,
29
- ): Promise<any>;
30
- subscribe(
31
- queryJson: string,
32
- onUpdate: (...args: any[]) => any,
33
- sessionJson?: string | undefined | null,
34
- tier?: string | undefined | null,
35
- optionsJson?: string | undefined | null,
36
- ): number;
37
- unsubscribe(handle: number): void;
7
+ static inMemory(schemaJson: string, appId: string, jazzEnv: string, userBranch: string, tier?: string | undefined | null): NapiRuntime
8
+ insert(table: string, values: any): any
9
+ update(objectId: string, values: any): void
10
+ delete(objectId: string): void
11
+ query(queryJson: string, sessionJson?: string | undefined | null, tier?: string | undefined | null, optionsJson?: string | undefined | null): Promise<any>
12
+ subscribe(queryJson: string, onUpdate: (...args: any[]) => any, sessionJson?: string | undefined | null, tier?: string | undefined | null, optionsJson?: string | undefined | null): number
13
+ unsubscribe(handle: number): void
38
14
  /** Phase 1 of 2-phase subscribe: allocate a handle and store query params. */
39
- createSubscription(
40
- queryJson: string,
41
- sessionJson?: string | undefined | null,
42
- tier?: string | undefined | null,
43
- optionsJson?: string | undefined | null,
44
- ): number;
15
+ createSubscription(queryJson: string, sessionJson?: string | undefined | null, tier?: string | undefined | null, optionsJson?: string | undefined | null): number
45
16
  /** Phase 2 of 2-phase subscribe: compile, register, sync, attach callback, tick. */
46
- executeSubscription(handle: number, onUpdate: (...args: any[]) => any): void;
47
- insertDurable(table: string, values: any, tier: string): Promise<any>;
48
- updateDurable(objectId: string, values: any, tier: string): Promise<void>;
49
- deleteDurable(objectId: string, tier: string): Promise<void>;
50
- onSyncMessageReceived(messageJson: string): void;
17
+ executeSubscription(handle: number, onUpdate: (...args: any[]) => any): void
18
+ insertDurable(table: string, values: any, tier: string): Promise<any>
19
+ updateDurable(objectId: string, values: any, tier: string): Promise<void>
20
+ deleteDurable(objectId: string, tier: string): Promise<void>
21
+ onSyncMessageReceived(messageJson: string): void
51
22
  /** Called by JS when a sync message arrives from a client (not a server). */
52
- onSyncMessageReceivedFromClient(clientId: string, messageJson: string): void;
53
- onSyncMessageToSend(callback: (...args: any[]) => any): void;
54
- addServer(): void;
55
- removeServer(): void;
56
- addClient(): string;
23
+ onSyncMessageReceivedFromClient(clientId: string, messageJson: string): void
24
+ onSyncMessageToSend(callback: (...args: any[]) => any): void
25
+ addServer(): void
26
+ removeServer(): void
27
+ addClient(): string
57
28
  /** Set a client's role ("user", "admin", or "peer"). */
58
- setClientRole(clientId: string, role: string): void;
59
- getSchema(): any;
60
- getSchemaHash(): string;
61
- flush(): void;
29
+ setClientRole(clientId: string, role: string): void
30
+ getSchema(): any
31
+ getSchemaHash(): string
32
+ flush(): void
62
33
  /** Flush and close the underlying storage, releasing filesystem locks. */
63
- close(): void;
34
+ close(): void
64
35
  }
65
36
 
66
- export declare function currentTimestamp(): number;
37
+ export declare function currentTimestamp(): number
67
38
 
68
- export declare function generateId(): string;
39
+ export declare function generateId(): string
69
40
 
70
- export declare function parseSchema(json: string): any;
41
+ export declare function parseSchema(json: string): any
package/index.js CHANGED
@@ -4,735 +4,562 @@
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
6
  const { readFileSync } = require('node:fs')
7
- let nativeBinding = null;
8
- const loadErrors = [];
9
- const NATIVE_BINDING_PACKAGE_SCOPE = "@garden-co";
10
- const resolveNativeBindingPackage = (name) =>
11
- `${NATIVE_BINDING_PACKAGE_SCOPE}/${name}`;
12
- const requireNativeBindingPackage = (name) =>
13
- require(resolveNativeBindingPackage(name));
7
+ let nativeBinding = null
8
+ const loadErrors = []
9
+ const NATIVE_BINDING_PACKAGE_SCOPE = '@garden-co'
10
+ const resolveNativeBindingPackage = (name) => `${NATIVE_BINDING_PACKAGE_SCOPE}/${name}`
11
+ const requireNativeBindingPackage = (name) => require(resolveNativeBindingPackage(name))
14
12
  const getNativeBindingPackageVersion = (name) =>
15
- require(`${resolveNativeBindingPackage(name)}/package.json`).version;
13
+ require(`${resolveNativeBindingPackage(name)}/package.json`).version
16
14
 
17
15
  const isMusl = () => {
18
- let musl = false;
19
- if (process.platform === "linux") {
20
- musl = isMuslFromFilesystem();
16
+ let musl = false
17
+ if (process.platform === 'linux') {
18
+ musl = isMuslFromFilesystem()
21
19
  if (musl === null) {
22
- musl = isMuslFromReport();
20
+ musl = isMuslFromReport()
23
21
  }
24
22
  if (musl === null) {
25
- musl = isMuslFromChildProcess();
23
+ musl = isMuslFromChildProcess()
26
24
  }
27
25
  }
28
- return musl;
29
- };
26
+ return musl
27
+ }
30
28
 
31
- const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
29
+ const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
32
30
 
33
31
  const isMuslFromFilesystem = () => {
34
32
  try {
35
- return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
33
+ return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
36
34
  } catch {
37
- return null;
35
+ return null
38
36
  }
39
- };
37
+ }
40
38
 
41
39
  const isMuslFromReport = () => {
42
- let report = null;
43
- if (typeof process.report?.getReport === "function") {
44
- process.report.excludeNetwork = true;
45
- report = process.report.getReport();
40
+ let report = null
41
+ if (typeof process.report?.getReport === 'function') {
42
+ process.report.excludeNetwork = true
43
+ report = process.report.getReport()
46
44
  }
47
45
  if (!report) {
48
- return null;
46
+ return null
49
47
  }
50
48
  if (report.header && report.header.glibcVersionRuntime) {
51
- return false;
49
+ return false
52
50
  }
53
51
  if (Array.isArray(report.sharedObjects)) {
54
52
  if (report.sharedObjects.some(isFileMusl)) {
55
- return true;
53
+ return true
56
54
  }
57
55
  }
58
- return false;
59
- };
56
+ return false
57
+ }
60
58
 
61
59
  const isMuslFromChildProcess = () => {
62
60
  try {
63
- return require("child_process")
64
- .execSync("ldd --version", { encoding: "utf8" })
65
- .includes("musl");
61
+ return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
66
62
  } catch (e) {
67
63
  // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
68
- return false;
64
+ return false
69
65
  }
70
- };
66
+ }
71
67
 
72
68
  function requireNative() {
73
69
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
74
70
  try {
75
71
  return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
76
72
  } catch (err) {
77
- loadErrors.push(err);
73
+ loadErrors.push(err)
78
74
  }
79
- } else if (process.platform === "android") {
80
- if (process.arch === "arm64") {
75
+ } else if (process.platform === 'android') {
76
+ if (process.arch === 'arm64') {
81
77
  try {
82
- return require("./jazz-napi.android-arm64.node");
78
+ return require('./jazz-napi.android-arm64.node')
83
79
  } catch (e) {
84
- loadErrors.push(e);
80
+ loadErrors.push(e)
85
81
  }
86
82
  try {
87
- const binding = requireNativeBindingPackage("jazz-napi-android-arm64");
88
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-android-arm64");
89
- if (
90
- bindingPackageVersion !== "2.0.0-alpha.14" &&
91
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
92
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
93
- ) {
94
- throw new Error(
95
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
96
- );
97
- }
98
- return binding;
83
+ const binding = requireNativeBindingPackage('jazz-napi-android-arm64')
84
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-android-arm64')
85
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
86
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
87
+ }
88
+ return binding
99
89
  } catch (e) {
100
- loadErrors.push(e);
90
+ loadErrors.push(e)
101
91
  }
102
- } else if (process.arch === "arm") {
92
+ } else if (process.arch === 'arm') {
103
93
  try {
104
- return require("./jazz-napi.android-arm-eabi.node");
94
+ return require('./jazz-napi.android-arm-eabi.node')
105
95
  } catch (e) {
106
- loadErrors.push(e);
96
+ loadErrors.push(e)
107
97
  }
108
98
  try {
109
- const binding = requireNativeBindingPackage("jazz-napi-android-arm-eabi");
110
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-android-arm-eabi");
111
- if (
112
- bindingPackageVersion !== "2.0.0-alpha.14" &&
113
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
114
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
115
- ) {
116
- throw new Error(
117
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
118
- );
119
- }
120
- return binding;
99
+ const binding = requireNativeBindingPackage('jazz-napi-android-arm-eabi')
100
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-android-arm-eabi')
101
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
102
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
103
+ }
104
+ return binding
121
105
  } catch (e) {
122
- loadErrors.push(e);
106
+ loadErrors.push(e)
123
107
  }
124
108
  } else {
125
- loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`));
109
+ loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
126
110
  }
127
- } else if (process.platform === "win32") {
128
- if (process.arch === "x64") {
129
- if (
130
- process.config?.variables?.shlib_suffix === "dll.a" ||
131
- process.config?.variables?.node_target_type === "shared_library"
132
- ) {
111
+ } else if (process.platform === 'win32') {
112
+ if (process.arch === 'x64') {
113
+ if (process.config?.variables?.shlib_suffix === 'dll.a' || process.config?.variables?.node_target_type === 'shared_library') {
133
114
  try {
134
- return require("./jazz-napi.win32-x64-gnu.node");
135
- } catch (e) {
136
- loadErrors.push(e);
137
- }
138
- try {
139
- const binding = requireNativeBindingPackage("jazz-napi-win32-x64-gnu");
140
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-win32-x64-gnu");
141
- if (
142
- bindingPackageVersion !== "2.0.0-alpha.14" &&
143
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
144
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
145
- ) {
146
- throw new Error(
147
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
148
- );
149
- }
150
- return binding;
151
- } catch (e) {
152
- loadErrors.push(e);
115
+ return require('./jazz-napi.win32-x64-gnu.node')
116
+ } catch (e) {
117
+ loadErrors.push(e)
118
+ }
119
+ try {
120
+ const binding = requireNativeBindingPackage('jazz-napi-win32-x64-gnu')
121
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-win32-x64-gnu')
122
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
123
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
153
124
  }
125
+ return binding
126
+ } catch (e) {
127
+ loadErrors.push(e)
128
+ }
154
129
  } else {
155
130
  try {
156
- return require("./jazz-napi.win32-x64-msvc.node");
157
- } catch (e) {
158
- loadErrors.push(e);
159
- }
160
- try {
161
- const binding = requireNativeBindingPackage("jazz-napi-win32-x64-msvc");
162
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-win32-x64-msvc");
163
- if (
164
- bindingPackageVersion !== "2.0.0-alpha.14" &&
165
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
166
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
167
- ) {
168
- throw new Error(
169
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
170
- );
171
- }
172
- return binding;
173
- } catch (e) {
174
- loadErrors.push(e);
131
+ return require('./jazz-napi.win32-x64-msvc.node')
132
+ } catch (e) {
133
+ loadErrors.push(e)
134
+ }
135
+ try {
136
+ const binding = requireNativeBindingPackage('jazz-napi-win32-x64-msvc')
137
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-win32-x64-msvc')
138
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
139
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
175
140
  }
141
+ return binding
142
+ } catch (e) {
143
+ loadErrors.push(e)
144
+ }
176
145
  }
177
- } else if (process.arch === "ia32") {
146
+ } else if (process.arch === 'ia32') {
178
147
  try {
179
- return require("./jazz-napi.win32-ia32-msvc.node");
148
+ return require('./jazz-napi.win32-ia32-msvc.node')
180
149
  } catch (e) {
181
- loadErrors.push(e);
150
+ loadErrors.push(e)
182
151
  }
183
152
  try {
184
- const binding = requireNativeBindingPackage("jazz-napi-win32-ia32-msvc");
185
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-win32-ia32-msvc");
186
- if (
187
- bindingPackageVersion !== "2.0.0-alpha.14" &&
188
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
189
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
190
- ) {
191
- throw new Error(
192
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
193
- );
194
- }
195
- return binding;
153
+ const binding = requireNativeBindingPackage('jazz-napi-win32-ia32-msvc')
154
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-win32-ia32-msvc')
155
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
156
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
157
+ }
158
+ return binding
196
159
  } catch (e) {
197
- loadErrors.push(e);
160
+ loadErrors.push(e)
198
161
  }
199
- } else if (process.arch === "arm64") {
162
+ } else if (process.arch === 'arm64') {
200
163
  try {
201
- return require("./jazz-napi.win32-arm64-msvc.node");
164
+ return require('./jazz-napi.win32-arm64-msvc.node')
202
165
  } catch (e) {
203
- loadErrors.push(e);
166
+ loadErrors.push(e)
204
167
  }
205
168
  try {
206
- const binding = requireNativeBindingPackage("jazz-napi-win32-arm64-msvc");
207
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-win32-arm64-msvc");
208
- if (
209
- bindingPackageVersion !== "2.0.0-alpha.14" &&
210
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
211
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
212
- ) {
213
- throw new Error(
214
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
215
- );
216
- }
217
- return binding;
169
+ const binding = requireNativeBindingPackage('jazz-napi-win32-arm64-msvc')
170
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-win32-arm64-msvc')
171
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
172
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
173
+ }
174
+ return binding
218
175
  } catch (e) {
219
- loadErrors.push(e);
176
+ loadErrors.push(e)
220
177
  }
221
178
  } else {
222
- loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`));
179
+ loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
223
180
  }
224
- } else if (process.platform === "darwin") {
181
+ } else if (process.platform === 'darwin') {
225
182
  try {
226
- return require("./jazz-napi.darwin-universal.node");
183
+ return require('./jazz-napi.darwin-universal.node')
227
184
  } catch (e) {
228
- loadErrors.push(e);
185
+ loadErrors.push(e)
229
186
  }
230
187
  try {
231
- const binding = requireNativeBindingPackage("jazz-napi-darwin-universal");
232
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-darwin-universal");
233
- if (
234
- bindingPackageVersion !== "2.0.0-alpha.14" &&
235
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
236
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
237
- ) {
238
- throw new Error(
239
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
240
- );
241
- }
242
- return binding;
188
+ const binding = requireNativeBindingPackage('jazz-napi-darwin-universal')
189
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-darwin-universal')
190
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
191
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
192
+ }
193
+ return binding
243
194
  } catch (e) {
244
- loadErrors.push(e);
195
+ loadErrors.push(e)
245
196
  }
246
- if (process.arch === "x64") {
197
+ if (process.arch === 'x64') {
247
198
  try {
248
- return require("./jazz-napi.darwin-x64.node");
199
+ return require('./jazz-napi.darwin-x64.node')
249
200
  } catch (e) {
250
- loadErrors.push(e);
201
+ loadErrors.push(e)
251
202
  }
252
203
  try {
253
- const binding = requireNativeBindingPackage("jazz-napi-darwin-x64");
254
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-darwin-x64");
255
- if (
256
- bindingPackageVersion !== "2.0.0-alpha.14" &&
257
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
258
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
259
- ) {
260
- throw new Error(
261
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
262
- );
263
- }
264
- return binding;
204
+ const binding = requireNativeBindingPackage('jazz-napi-darwin-x64')
205
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-darwin-x64')
206
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
207
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
208
+ }
209
+ return binding
265
210
  } catch (e) {
266
- loadErrors.push(e);
211
+ loadErrors.push(e)
267
212
  }
268
- } else if (process.arch === "arm64") {
213
+ } else if (process.arch === 'arm64') {
269
214
  try {
270
- return require("./jazz-napi.darwin-arm64.node");
215
+ return require('./jazz-napi.darwin-arm64.node')
271
216
  } catch (e) {
272
- loadErrors.push(e);
217
+ loadErrors.push(e)
273
218
  }
274
219
  try {
275
- const binding = requireNativeBindingPackage("jazz-napi-darwin-arm64");
276
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-darwin-arm64");
277
- if (
278
- bindingPackageVersion !== "2.0.0-alpha.14" &&
279
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
280
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
281
- ) {
282
- throw new Error(
283
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
284
- );
285
- }
286
- return binding;
220
+ const binding = requireNativeBindingPackage('jazz-napi-darwin-arm64')
221
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-darwin-arm64')
222
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
223
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
224
+ }
225
+ return binding
287
226
  } catch (e) {
288
- loadErrors.push(e);
227
+ loadErrors.push(e)
289
228
  }
290
229
  } else {
291
- loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`));
230
+ loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
292
231
  }
293
- } else if (process.platform === "freebsd") {
294
- if (process.arch === "x64") {
232
+ } else if (process.platform === 'freebsd') {
233
+ if (process.arch === 'x64') {
295
234
  try {
296
- return require("./jazz-napi.freebsd-x64.node");
235
+ return require('./jazz-napi.freebsd-x64.node')
297
236
  } catch (e) {
298
- loadErrors.push(e);
237
+ loadErrors.push(e)
299
238
  }
300
239
  try {
301
- const binding = requireNativeBindingPackage("jazz-napi-freebsd-x64");
302
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-freebsd-x64");
303
- if (
304
- bindingPackageVersion !== "2.0.0-alpha.14" &&
305
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
306
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
307
- ) {
308
- throw new Error(
309
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
310
- );
311
- }
312
- return binding;
240
+ const binding = requireNativeBindingPackage('jazz-napi-freebsd-x64')
241
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-freebsd-x64')
242
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
243
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
244
+ }
245
+ return binding
313
246
  } catch (e) {
314
- loadErrors.push(e);
247
+ loadErrors.push(e)
315
248
  }
316
- } else if (process.arch === "arm64") {
249
+ } else if (process.arch === 'arm64') {
317
250
  try {
318
- return require("./jazz-napi.freebsd-arm64.node");
251
+ return require('./jazz-napi.freebsd-arm64.node')
319
252
  } catch (e) {
320
- loadErrors.push(e);
253
+ loadErrors.push(e)
321
254
  }
322
255
  try {
323
- const binding = requireNativeBindingPackage("jazz-napi-freebsd-arm64");
324
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-freebsd-arm64");
325
- if (
326
- bindingPackageVersion !== "2.0.0-alpha.14" &&
327
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
328
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
329
- ) {
330
- throw new Error(
331
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
332
- );
333
- }
334
- return binding;
256
+ const binding = requireNativeBindingPackage('jazz-napi-freebsd-arm64')
257
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-freebsd-arm64')
258
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
259
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
260
+ }
261
+ return binding
335
262
  } catch (e) {
336
- loadErrors.push(e);
263
+ loadErrors.push(e)
337
264
  }
338
265
  } else {
339
- loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`));
266
+ loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
340
267
  }
341
- } else if (process.platform === "linux") {
342
- if (process.arch === "x64") {
268
+ } else if (process.platform === 'linux') {
269
+ if (process.arch === 'x64') {
343
270
  if (isMusl()) {
344
271
  try {
345
- return require("./jazz-napi.linux-x64-musl.node");
272
+ return require('./jazz-napi.linux-x64-musl.node')
346
273
  } catch (e) {
347
- loadErrors.push(e);
274
+ loadErrors.push(e)
348
275
  }
349
276
  try {
350
- const binding = requireNativeBindingPackage("jazz-napi-linux-x64-musl");
351
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-linux-x64-musl");
352
- if (
353
- bindingPackageVersion !== "2.0.0-alpha.14" &&
354
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
355
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
356
- ) {
357
- throw new Error(
358
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
359
- );
277
+ const binding = requireNativeBindingPackage('jazz-napi-linux-x64-musl')
278
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-linux-x64-musl')
279
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
280
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
360
281
  }
361
- return binding;
282
+ return binding
362
283
  } catch (e) {
363
- loadErrors.push(e);
284
+ loadErrors.push(e)
364
285
  }
365
286
  } else {
366
287
  try {
367
- return require("./jazz-napi.linux-x64-gnu.node");
288
+ return require('./jazz-napi.linux-x64-gnu.node')
368
289
  } catch (e) {
369
- loadErrors.push(e);
290
+ loadErrors.push(e)
370
291
  }
371
292
  try {
372
- const binding = requireNativeBindingPackage("jazz-napi-linux-x64-gnu");
373
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-linux-x64-gnu");
374
- if (
375
- bindingPackageVersion !== "2.0.0-alpha.14" &&
376
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
377
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
378
- ) {
379
- throw new Error(
380
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
381
- );
293
+ const binding = requireNativeBindingPackage('jazz-napi-linux-x64-gnu')
294
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-linux-x64-gnu')
295
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
296
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
382
297
  }
383
- return binding;
298
+ return binding
384
299
  } catch (e) {
385
- loadErrors.push(e);
300
+ loadErrors.push(e)
386
301
  }
387
302
  }
388
- } else if (process.arch === "arm64") {
303
+ } else if (process.arch === 'arm64') {
389
304
  if (isMusl()) {
390
305
  try {
391
- return require("./jazz-napi.linux-arm64-musl.node");
306
+ return require('./jazz-napi.linux-arm64-musl.node')
392
307
  } catch (e) {
393
- loadErrors.push(e);
308
+ loadErrors.push(e)
394
309
  }
395
310
  try {
396
- const binding = requireNativeBindingPackage("jazz-napi-linux-arm64-musl");
397
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-linux-arm64-musl");
398
- if (
399
- bindingPackageVersion !== "2.0.0-alpha.14" &&
400
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
401
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
402
- ) {
403
- throw new Error(
404
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
405
- );
311
+ const binding = requireNativeBindingPackage('jazz-napi-linux-arm64-musl')
312
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-linux-arm64-musl')
313
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
314
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
406
315
  }
407
- return binding;
316
+ return binding
408
317
  } catch (e) {
409
- loadErrors.push(e);
318
+ loadErrors.push(e)
410
319
  }
411
320
  } else {
412
321
  try {
413
- return require("./jazz-napi.linux-arm64-gnu.node");
322
+ return require('./jazz-napi.linux-arm64-gnu.node')
414
323
  } catch (e) {
415
- loadErrors.push(e);
324
+ loadErrors.push(e)
416
325
  }
417
326
  try {
418
- const binding = requireNativeBindingPackage("jazz-napi-linux-arm64-gnu");
419
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-linux-arm64-gnu");
420
- if (
421
- bindingPackageVersion !== "2.0.0-alpha.14" &&
422
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
423
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
424
- ) {
425
- throw new Error(
426
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
427
- );
327
+ const binding = requireNativeBindingPackage('jazz-napi-linux-arm64-gnu')
328
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-linux-arm64-gnu')
329
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
330
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
428
331
  }
429
- return binding;
332
+ return binding
430
333
  } catch (e) {
431
- loadErrors.push(e);
334
+ loadErrors.push(e)
432
335
  }
433
336
  }
434
- } else if (process.arch === "arm") {
337
+ } else if (process.arch === 'arm') {
435
338
  if (isMusl()) {
436
339
  try {
437
- return require("./jazz-napi.linux-arm-musleabihf.node");
340
+ return require('./jazz-napi.linux-arm-musleabihf.node')
438
341
  } catch (e) {
439
- loadErrors.push(e);
342
+ loadErrors.push(e)
440
343
  }
441
344
  try {
442
- const binding = requireNativeBindingPackage("jazz-napi-linux-arm-musleabihf");
443
- const bindingPackageVersion = getNativeBindingPackageVersion(
444
- "jazz-napi-linux-arm-musleabihf",
445
- );
446
- if (
447
- bindingPackageVersion !== "2.0.0-alpha.14" &&
448
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
449
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
450
- ) {
451
- throw new Error(
452
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
453
- );
345
+ const binding = requireNativeBindingPackage('jazz-napi-linux-arm-musleabihf')
346
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-linux-arm-musleabihf')
347
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
348
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
454
349
  }
455
- return binding;
350
+ return binding
456
351
  } catch (e) {
457
- loadErrors.push(e);
352
+ loadErrors.push(e)
458
353
  }
459
354
  } else {
460
355
  try {
461
- return require("./jazz-napi.linux-arm-gnueabihf.node");
356
+ return require('./jazz-napi.linux-arm-gnueabihf.node')
462
357
  } catch (e) {
463
- loadErrors.push(e);
358
+ loadErrors.push(e)
464
359
  }
465
360
  try {
466
- const binding = requireNativeBindingPackage("jazz-napi-linux-arm-gnueabihf");
467
- const bindingPackageVersion = getNativeBindingPackageVersion(
468
- "jazz-napi-linux-arm-gnueabihf",
469
- );
470
- if (
471
- bindingPackageVersion !== "2.0.0-alpha.14" &&
472
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
473
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
474
- ) {
475
- throw new Error(
476
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
477
- );
361
+ const binding = requireNativeBindingPackage('jazz-napi-linux-arm-gnueabihf')
362
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-linux-arm-gnueabihf')
363
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
364
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
478
365
  }
479
- return binding;
366
+ return binding
480
367
  } catch (e) {
481
- loadErrors.push(e);
368
+ loadErrors.push(e)
482
369
  }
483
370
  }
484
- } else if (process.arch === "loong64") {
371
+ } else if (process.arch === 'loong64') {
485
372
  if (isMusl()) {
486
373
  try {
487
- return require("./jazz-napi.linux-loong64-musl.node");
374
+ return require('./jazz-napi.linux-loong64-musl.node')
488
375
  } catch (e) {
489
- loadErrors.push(e);
376
+ loadErrors.push(e)
490
377
  }
491
378
  try {
492
- const binding = requireNativeBindingPackage("jazz-napi-linux-loong64-musl");
493
- const bindingPackageVersion = getNativeBindingPackageVersion(
494
- "jazz-napi-linux-loong64-musl",
495
- );
496
- if (
497
- bindingPackageVersion !== "2.0.0-alpha.14" &&
498
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
499
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
500
- ) {
501
- throw new Error(
502
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
503
- );
379
+ const binding = requireNativeBindingPackage('jazz-napi-linux-loong64-musl')
380
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-linux-loong64-musl')
381
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
382
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
504
383
  }
505
- return binding;
384
+ return binding
506
385
  } catch (e) {
507
- loadErrors.push(e);
386
+ loadErrors.push(e)
508
387
  }
509
388
  } else {
510
389
  try {
511
- return require("./jazz-napi.linux-loong64-gnu.node");
390
+ return require('./jazz-napi.linux-loong64-gnu.node')
512
391
  } catch (e) {
513
- loadErrors.push(e);
392
+ loadErrors.push(e)
514
393
  }
515
394
  try {
516
- const binding = requireNativeBindingPackage("jazz-napi-linux-loong64-gnu");
517
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-linux-loong64-gnu");
518
- if (
519
- bindingPackageVersion !== "2.0.0-alpha.14" &&
520
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
521
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
522
- ) {
523
- throw new Error(
524
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
525
- );
395
+ const binding = requireNativeBindingPackage('jazz-napi-linux-loong64-gnu')
396
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-linux-loong64-gnu')
397
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
398
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
526
399
  }
527
- return binding;
400
+ return binding
528
401
  } catch (e) {
529
- loadErrors.push(e);
402
+ loadErrors.push(e)
530
403
  }
531
404
  }
532
- } else if (process.arch === "riscv64") {
405
+ } else if (process.arch === 'riscv64') {
533
406
  if (isMusl()) {
534
407
  try {
535
- return require("./jazz-napi.linux-riscv64-musl.node");
408
+ return require('./jazz-napi.linux-riscv64-musl.node')
536
409
  } catch (e) {
537
- loadErrors.push(e);
410
+ loadErrors.push(e)
538
411
  }
539
412
  try {
540
- const binding = requireNativeBindingPackage("jazz-napi-linux-riscv64-musl");
541
- const bindingPackageVersion = getNativeBindingPackageVersion(
542
- "jazz-napi-linux-riscv64-musl",
543
- );
544
- if (
545
- bindingPackageVersion !== "2.0.0-alpha.14" &&
546
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
547
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
548
- ) {
549
- throw new Error(
550
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
551
- );
413
+ const binding = requireNativeBindingPackage('jazz-napi-linux-riscv64-musl')
414
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-linux-riscv64-musl')
415
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
416
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
552
417
  }
553
- return binding;
418
+ return binding
554
419
  } catch (e) {
555
- loadErrors.push(e);
420
+ loadErrors.push(e)
556
421
  }
557
422
  } else {
558
423
  try {
559
- return require("./jazz-napi.linux-riscv64-gnu.node");
424
+ return require('./jazz-napi.linux-riscv64-gnu.node')
560
425
  } catch (e) {
561
- loadErrors.push(e);
426
+ loadErrors.push(e)
562
427
  }
563
428
  try {
564
- const binding = requireNativeBindingPackage("jazz-napi-linux-riscv64-gnu");
565
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-linux-riscv64-gnu");
566
- if (
567
- bindingPackageVersion !== "2.0.0-alpha.14" &&
568
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
569
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
570
- ) {
571
- throw new Error(
572
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
573
- );
429
+ const binding = requireNativeBindingPackage('jazz-napi-linux-riscv64-gnu')
430
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-linux-riscv64-gnu')
431
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
432
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
574
433
  }
575
- return binding;
434
+ return binding
576
435
  } catch (e) {
577
- loadErrors.push(e);
436
+ loadErrors.push(e)
578
437
  }
579
438
  }
580
- } else if (process.arch === "ppc64") {
439
+ } else if (process.arch === 'ppc64') {
581
440
  try {
582
- return require("./jazz-napi.linux-ppc64-gnu.node");
441
+ return require('./jazz-napi.linux-ppc64-gnu.node')
583
442
  } catch (e) {
584
- loadErrors.push(e);
443
+ loadErrors.push(e)
585
444
  }
586
445
  try {
587
- const binding = requireNativeBindingPackage("jazz-napi-linux-ppc64-gnu");
588
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-linux-ppc64-gnu");
589
- if (
590
- bindingPackageVersion !== "2.0.0-alpha.14" &&
591
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
592
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
593
- ) {
594
- throw new Error(
595
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
596
- );
597
- }
598
- return binding;
446
+ const binding = requireNativeBindingPackage('jazz-napi-linux-ppc64-gnu')
447
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-linux-ppc64-gnu')
448
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
449
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
450
+ }
451
+ return binding
599
452
  } catch (e) {
600
- loadErrors.push(e);
453
+ loadErrors.push(e)
601
454
  }
602
- } else if (process.arch === "s390x") {
455
+ } else if (process.arch === 's390x') {
603
456
  try {
604
- return require("./jazz-napi.linux-s390x-gnu.node");
457
+ return require('./jazz-napi.linux-s390x-gnu.node')
605
458
  } catch (e) {
606
- loadErrors.push(e);
459
+ loadErrors.push(e)
607
460
  }
608
461
  try {
609
- const binding = requireNativeBindingPackage("jazz-napi-linux-s390x-gnu");
610
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-linux-s390x-gnu");
611
- if (
612
- bindingPackageVersion !== "2.0.0-alpha.14" &&
613
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
614
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
615
- ) {
616
- throw new Error(
617
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
618
- );
619
- }
620
- return binding;
462
+ const binding = requireNativeBindingPackage('jazz-napi-linux-s390x-gnu')
463
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-linux-s390x-gnu')
464
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
465
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
466
+ }
467
+ return binding
621
468
  } catch (e) {
622
- loadErrors.push(e);
469
+ loadErrors.push(e)
623
470
  }
624
471
  } else {
625
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`));
472
+ loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
626
473
  }
627
- } else if (process.platform === "openharmony") {
628
- if (process.arch === "arm64") {
474
+ } else if (process.platform === 'openharmony') {
475
+ if (process.arch === 'arm64') {
629
476
  try {
630
- return require("./jazz-napi.openharmony-arm64.node");
477
+ return require('./jazz-napi.openharmony-arm64.node')
631
478
  } catch (e) {
632
- loadErrors.push(e);
479
+ loadErrors.push(e)
633
480
  }
634
481
  try {
635
- const binding = requireNativeBindingPackage("jazz-napi-openharmony-arm64");
636
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-openharmony-arm64");
637
- if (
638
- bindingPackageVersion !== "2.0.0-alpha.14" &&
639
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
640
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
641
- ) {
642
- throw new Error(
643
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
644
- );
645
- }
646
- return binding;
482
+ const binding = requireNativeBindingPackage('jazz-napi-openharmony-arm64')
483
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-openharmony-arm64')
484
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
485
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
486
+ }
487
+ return binding
647
488
  } catch (e) {
648
- loadErrors.push(e);
489
+ loadErrors.push(e)
649
490
  }
650
- } else if (process.arch === "x64") {
491
+ } else if (process.arch === 'x64') {
651
492
  try {
652
- return require("./jazz-napi.openharmony-x64.node");
493
+ return require('./jazz-napi.openharmony-x64.node')
653
494
  } catch (e) {
654
- loadErrors.push(e);
495
+ loadErrors.push(e)
655
496
  }
656
497
  try {
657
- const binding = requireNativeBindingPackage("jazz-napi-openharmony-x64");
658
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-openharmony-x64");
659
- if (
660
- bindingPackageVersion !== "2.0.0-alpha.14" &&
661
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
662
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
663
- ) {
664
- throw new Error(
665
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
666
- );
667
- }
668
- return binding;
498
+ const binding = requireNativeBindingPackage('jazz-napi-openharmony-x64')
499
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-openharmony-x64')
500
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
501
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
502
+ }
503
+ return binding
669
504
  } catch (e) {
670
- loadErrors.push(e);
505
+ loadErrors.push(e)
671
506
  }
672
- } else if (process.arch === "arm") {
507
+ } else if (process.arch === 'arm') {
673
508
  try {
674
- return require("./jazz-napi.openharmony-arm.node");
509
+ return require('./jazz-napi.openharmony-arm.node')
675
510
  } catch (e) {
676
- loadErrors.push(e);
511
+ loadErrors.push(e)
677
512
  }
678
513
  try {
679
- const binding = requireNativeBindingPackage("jazz-napi-openharmony-arm");
680
- const bindingPackageVersion = getNativeBindingPackageVersion("jazz-napi-openharmony-arm");
681
- if (
682
- bindingPackageVersion !== "2.0.0-alpha.14" &&
683
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK &&
684
- process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== "0"
685
- ) {
686
- throw new Error(
687
- `Native binding package version mismatch, expected 2.0.0-alpha.14 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`,
688
- );
689
- }
690
- return binding;
514
+ const binding = requireNativeBindingPackage('jazz-napi-openharmony-arm')
515
+ const bindingPackageVersion = getNativeBindingPackageVersion('jazz-napi-openharmony-arm')
516
+ if (bindingPackageVersion !== '2.0.0-alpha.16' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
517
+ throw new Error(`Native binding package version mismatch, expected 2.0.0-alpha.16 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
518
+ }
519
+ return binding
691
520
  } catch (e) {
692
- loadErrors.push(e);
521
+ loadErrors.push(e)
693
522
  }
694
523
  } else {
695
- loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`));
524
+ loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
696
525
  }
697
526
  } else {
698
- loadErrors.push(
699
- new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`),
700
- );
527
+ loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
701
528
  }
702
529
  }
703
530
 
704
- nativeBinding = requireNative();
531
+ nativeBinding = requireNative()
705
532
 
706
533
  if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
707
- let wasiBinding = null;
708
- let wasiBindingError = null;
534
+ let wasiBinding = null
535
+ let wasiBindingError = null
709
536
  try {
710
- wasiBinding = require("./jazz-napi.wasi.cjs");
711
- nativeBinding = wasiBinding;
537
+ wasiBinding = require('./jazz-napi.wasi.cjs')
538
+ nativeBinding = wasiBinding
712
539
  } catch (err) {
713
540
  if (process.env.NAPI_RS_FORCE_WASI) {
714
- wasiBindingError = err;
541
+ wasiBindingError = err
715
542
  }
716
543
  }
717
544
  if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
718
545
  try {
719
- wasiBinding = requireNativeBindingPackage("jazz-napi-wasm32-wasi");
720
- nativeBinding = wasiBinding;
546
+ wasiBinding = requireNativeBindingPackage('jazz-napi-wasm32-wasi')
547
+ nativeBinding = wasiBinding
721
548
  } catch (err) {
722
549
  if (process.env.NAPI_RS_FORCE_WASI) {
723
550
  if (!wasiBindingError) {
724
- wasiBindingError = err;
551
+ wasiBindingError = err
725
552
  } else {
726
- wasiBindingError.cause = err;
553
+ wasiBindingError.cause = err
727
554
  }
728
- loadErrors.push(err);
555
+ loadErrors.push(err)
729
556
  }
730
557
  }
731
558
  }
732
- if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
733
- const error = new Error("WASI binding not found and NAPI_RS_FORCE_WASI is set to error");
734
- error.cause = wasiBindingError;
735
- throw error;
559
+ if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
560
+ const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
561
+ error.cause = wasiBindingError
562
+ throw error
736
563
  }
737
564
  }
738
565
 
@@ -741,20 +568,20 @@ if (!nativeBinding) {
741
568
  throw new Error(
742
569
  `Cannot find native binding. ` +
743
570
  `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
744
- "Please try `npm i` again after removing both package-lock.json and node_modules directory.",
571
+ 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
745
572
  {
746
573
  cause: loadErrors.reduce((err, cur) => {
747
- cur.cause = err;
748
- return cur;
574
+ cur.cause = err
575
+ return cur
749
576
  }),
750
577
  },
751
- );
578
+ )
752
579
  }
753
- throw new Error(`Failed to load native binding`);
580
+ throw new Error(`Failed to load native binding`)
754
581
  }
755
582
 
756
- module.exports = nativeBinding;
757
- module.exports.NapiRuntime = nativeBinding.NapiRuntime;
758
- module.exports.currentTimestamp = nativeBinding.currentTimestamp;
759
- module.exports.generateId = nativeBinding.generateId;
760
- module.exports.parseSchema = nativeBinding.parseSchema;
583
+ module.exports = nativeBinding
584
+ module.exports.NapiRuntime = nativeBinding.NapiRuntime
585
+ module.exports.currentTimestamp = nativeBinding.currentTimestamp
586
+ module.exports.generateId = nativeBinding.generateId
587
+ module.exports.parseSchema = nativeBinding.parseSchema
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jazz-napi",
3
- "version": "2.0.0-alpha.16",
3
+ "version": "2.0.0-alpha.17",
4
4
  "description": "Native Node.js bindings for Jazz runtime",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -30,10 +30,10 @@
30
30
  ]
31
31
  },
32
32
  "optionalDependencies": {
33
- "@garden-co/jazz-napi-darwin-arm64": "2.0.0-alpha.16",
34
- "@garden-co/jazz-napi-darwin-x64": "2.0.0-alpha.16",
35
- "@garden-co/jazz-napi-linux-x64-gnu": "2.0.0-alpha.16",
36
- "@garden-co/jazz-napi-win32-x64-msvc": "2.0.0-alpha.16"
33
+ "@garden-co/jazz-napi-darwin-arm64": "2.0.0-alpha.17",
34
+ "@garden-co/jazz-napi-darwin-x64": "2.0.0-alpha.17",
35
+ "@garden-co/jazz-napi-linux-x64-gnu": "2.0.0-alpha.17",
36
+ "@garden-co/jazz-napi-win32-x64-msvc": "2.0.0-alpha.17"
37
37
  },
38
38
  "scripts": {
39
39
  "build": "node scripts/build.js",