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