@graphql-hive/router-query-planner 0.0.1-manual.1 → 0.0.3-manual.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs ADDED
@@ -0,0 +1,329 @@
1
+ // prettier-ignore
2
+ /* eslint-disable */
3
+ // @ts-nocheck
4
+ /* auto-generated by NAPI-RS */
5
+
6
+ const { createRequire } = require('node:module')
7
+ require = createRequire(__filename);
8
+
9
+ const { readFileSync } = require("node:fs");
10
+ let nativeBinding = null;
11
+ const loadErrors = [];
12
+
13
+ const isMusl = () => {
14
+ let musl = false;
15
+ if (process.platform === "linux") {
16
+ musl = isMuslFromFilesystem();
17
+ if (musl === null) {
18
+ musl = isMuslFromReport();
19
+ }
20
+ if (musl === null) {
21
+ musl = isMuslFromChildProcess();
22
+ }
23
+ }
24
+ return musl;
25
+ };
26
+
27
+ const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
28
+
29
+ const isMuslFromFilesystem = () => {
30
+ try {
31
+ return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
32
+ } catch {
33
+ return null;
34
+ }
35
+ };
36
+
37
+ const isMuslFromReport = () => {
38
+ let report = null;
39
+ if (typeof process.report?.getReport === "function") {
40
+ process.report.excludeNetwork = true;
41
+ report = process.report.getReport();
42
+ }
43
+ if (!report) {
44
+ return null;
45
+ }
46
+ if (report.header && report.header.glibcVersionRuntime) {
47
+ return false;
48
+ }
49
+ if (Array.isArray(report.sharedObjects)) {
50
+ if (report.sharedObjects.some(isFileMusl)) {
51
+ return true;
52
+ }
53
+ }
54
+ return false;
55
+ };
56
+
57
+ const isMuslFromChildProcess = () => {
58
+ try {
59
+ return require("child_process")
60
+ .execSync("ldd --version", { encoding: "utf8" })
61
+ .includes("musl");
62
+ } catch (e) {
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
64
+ return false;
65
+ }
66
+ };
67
+
68
+ function requireNative() {
69
+ if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
70
+ try {
71
+ return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
72
+ } catch (err) {
73
+ loadErrors.push(err);
74
+ }
75
+ } else if (process.platform === "android") {
76
+ if (process.arch === "arm64") {
77
+ try {
78
+ return require("./hive_router_query_planner.android-arm64.node");
79
+ } catch (e) {
80
+ loadErrors.push(e);
81
+ }
82
+ } else if (process.arch === "arm") {
83
+ try {
84
+ return require("./hive_router_query_planner.android-arm-eabi.node");
85
+ } catch (e) {
86
+ loadErrors.push(e);
87
+ }
88
+ } else {
89
+ loadErrors.push(
90
+ new Error(`Unsupported architecture on Android ${process.arch}`)
91
+ );
92
+ }
93
+ } else if (process.platform === "win32") {
94
+ if (process.arch === "x64") {
95
+ if (
96
+ process.report?.getReport?.()?.header?.osName?.startsWith?.("MINGW")
97
+ ) {
98
+ try {
99
+ return require("./hive_router_query_planner.win32-x64-gnu.node");
100
+ } catch (e) {
101
+ loadErrors.push(e);
102
+ }
103
+ } else {
104
+ try {
105
+ return require("./hive_router_query_planner.win32-x64-msvc.node");
106
+ } catch (e) {
107
+ loadErrors.push(e);
108
+ }
109
+ }
110
+ } else if (process.arch === "ia32") {
111
+ try {
112
+ return require("./hive_router_query_planner.win32-ia32-msvc.node");
113
+ } catch (e) {
114
+ loadErrors.push(e);
115
+ }
116
+ } else if (process.arch === "arm64") {
117
+ try {
118
+ return require("./hive_router_query_planner.win32-arm64-msvc.node");
119
+ } catch (e) {
120
+ loadErrors.push(e);
121
+ }
122
+ } else {
123
+ loadErrors.push(
124
+ new Error(`Unsupported architecture on Windows: ${process.arch}`)
125
+ );
126
+ }
127
+ } else if (process.platform === "darwin") {
128
+ try {
129
+ return require("./hive_router_query_planner.darwin-universal.node");
130
+ } catch (e) {
131
+ loadErrors.push(e);
132
+ }
133
+ if (process.arch === "x64") {
134
+ try {
135
+ return require("./hive_router_query_planner.darwin-x64.node");
136
+ } catch (e) {
137
+ loadErrors.push(e);
138
+ }
139
+ } else if (process.arch === "arm64") {
140
+ try {
141
+ return require("./hive_router_query_planner.darwin-arm64.node");
142
+ } catch (e) {
143
+ loadErrors.push(e);
144
+ }
145
+ } else {
146
+ loadErrors.push(
147
+ new Error(`Unsupported architecture on macOS: ${process.arch}`)
148
+ );
149
+ }
150
+ } else if (process.platform === "freebsd") {
151
+ if (process.arch === "x64") {
152
+ try {
153
+ return require("./hive_router_query_planner.freebsd-x64.node");
154
+ } catch (e) {
155
+ loadErrors.push(e);
156
+ }
157
+ } else if (process.arch === "arm64") {
158
+ try {
159
+ return require("./hive_router_query_planner.freebsd-arm64.node");
160
+ } catch (e) {
161
+ loadErrors.push(e);
162
+ }
163
+ } else {
164
+ loadErrors.push(
165
+ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`)
166
+ );
167
+ }
168
+ } else if (process.platform === "linux") {
169
+ if (process.arch === "x64") {
170
+ if (isMusl()) {
171
+ try {
172
+ return require("./hive_router_query_planner.linux-x64-musl.node");
173
+ } catch (e) {
174
+ loadErrors.push(e);
175
+ }
176
+ } else {
177
+ try {
178
+ return require("./hive_router_query_planner.linux-x64-gnu.node");
179
+ } catch (e) {
180
+ loadErrors.push(e);
181
+ }
182
+ }
183
+ } else if (process.arch === "arm64") {
184
+ if (isMusl()) {
185
+ try {
186
+ return require("./hive_router_query_planner.linux-arm64-musl.node");
187
+ } catch (e) {
188
+ loadErrors.push(e);
189
+ }
190
+ } else {
191
+ try {
192
+ return require("./hive_router_query_planner.linux-arm64-gnu.node");
193
+ } catch (e) {
194
+ loadErrors.push(e);
195
+ }
196
+ }
197
+ } else if (process.arch === "arm") {
198
+ if (isMusl()) {
199
+ try {
200
+ return require("./hive_router_query_planner.linux-arm-musleabihf.node");
201
+ } catch (e) {
202
+ loadErrors.push(e);
203
+ }
204
+ } else {
205
+ try {
206
+ return require("./hive_router_query_planner.linux-arm-gnueabihf.node");
207
+ } catch (e) {
208
+ loadErrors.push(e);
209
+ }
210
+ }
211
+ } else if (process.arch === "loong64") {
212
+ if (isMusl()) {
213
+ try {
214
+ return require("./hive_router_query_planner.linux-loong64-musl.node");
215
+ } catch (e) {
216
+ loadErrors.push(e);
217
+ }
218
+ } else {
219
+ try {
220
+ return require("./hive_router_query_planner.linux-loong64-gnu.node");
221
+ } catch (e) {
222
+ loadErrors.push(e);
223
+ }
224
+ }
225
+ } else if (process.arch === "riscv64") {
226
+ if (isMusl()) {
227
+ try {
228
+ return require("./hive_router_query_planner.linux-riscv64-musl.node");
229
+ } catch (e) {
230
+ loadErrors.push(e);
231
+ }
232
+ } else {
233
+ try {
234
+ return require("./hive_router_query_planner.linux-riscv64-gnu.node");
235
+ } catch (e) {
236
+ loadErrors.push(e);
237
+ }
238
+ }
239
+ } else if (process.arch === "ppc64") {
240
+ try {
241
+ return require("./hive_router_query_planner.linux-ppc64-gnu.node");
242
+ } catch (e) {
243
+ loadErrors.push(e);
244
+ }
245
+ } else if (process.arch === "s390x") {
246
+ try {
247
+ return require("./hive_router_query_planner.linux-s390x-gnu.node");
248
+ } catch (e) {
249
+ loadErrors.push(e);
250
+ }
251
+ } else {
252
+ loadErrors.push(
253
+ new Error(`Unsupported architecture on Linux: ${process.arch}`)
254
+ );
255
+ }
256
+ } else if (process.platform === "openharmony") {
257
+ if (process.arch === "arm64") {
258
+ try {
259
+ return require("./hive_router_query_planner.openharmony-arm64.node");
260
+ } catch (e) {
261
+ loadErrors.push(e);
262
+ }
263
+ } else if (process.arch === "x64") {
264
+ try {
265
+ return require("./hive_router_query_planner.openharmony-x64.node");
266
+ } catch (e) {
267
+ loadErrors.push(e);
268
+ }
269
+ } else if (process.arch === "arm") {
270
+ try {
271
+ return require("./hive_router_query_planner.openharmony-arm.node");
272
+ } catch (e) {
273
+ loadErrors.push(e);
274
+ }
275
+ } else {
276
+ loadErrors.push(
277
+ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`)
278
+ );
279
+ }
280
+ } else {
281
+ loadErrors.push(
282
+ new Error(
283
+ `Unsupported OS: ${process.platform}, architecture: ${process.arch}`
284
+ )
285
+ );
286
+ }
287
+ }
288
+
289
+ nativeBinding = requireNative();
290
+
291
+ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
292
+ let wasiBinding = null;
293
+ let wasiBindingError = null;
294
+ try {
295
+ wasiBinding = require("./hive_router_query_planner.wasi.cjs");
296
+ nativeBinding = wasiBinding;
297
+ } catch (err) {
298
+ if (process.env.NAPI_RS_FORCE_WASI) {
299
+ wasiBindingError = err;
300
+ }
301
+ }
302
+ if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
303
+ const error = new Error(
304
+ "WASI binding not found and NAPI_RS_FORCE_WASI is set to error"
305
+ );
306
+ error.cause = wasiBindingError;
307
+ throw error;
308
+ }
309
+ }
310
+
311
+ if (!nativeBinding) {
312
+ if (loadErrors.length > 0) {
313
+ throw new Error(
314
+ `Cannot find native binding. ` +
315
+ `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
316
+ "Please try `npm i` again after removing both package-lock.json and node_modules directory.",
317
+ {
318
+ cause: loadErrors.reduce((err, cur) => {
319
+ cur.cause = err;
320
+ return cur;
321
+ }),
322
+ }
323
+ );
324
+ }
325
+ throw new Error(`Failed to load native binding`);
326
+ }
327
+
328
+ module.exports = nativeBinding;
329
+ module.exports.QueryPlanner = nativeBinding.QueryPlanner;
package/index.js CHANGED
@@ -4,557 +4,308 @@
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
6
  import { createRequire } from 'node:module'
7
- const require = createRequire(import.meta.url)
8
- const __dirname = new URL('.', import.meta.url).pathname
7
+ const require = createRequire(import.meta.url);
8
+ const __dirname = new URL(".", import.meta.url).pathname;
9
9
 
10
- const { readFileSync } = require('node:fs')
11
- let nativeBinding = null
12
- const loadErrors = []
10
+ const { readFileSync } = require("node:fs");
11
+ let nativeBinding = null;
12
+ const loadErrors = [];
13
13
 
14
14
  const isMusl = () => {
15
- let musl = false
16
- if (process.platform === 'linux') {
17
- musl = isMuslFromFilesystem()
15
+ let musl = false;
16
+ if (process.platform === "linux") {
17
+ musl = isMuslFromFilesystem();
18
18
  if (musl === null) {
19
- musl = isMuslFromReport()
19
+ musl = isMuslFromReport();
20
20
  }
21
21
  if (musl === null) {
22
- musl = isMuslFromChildProcess()
22
+ musl = isMuslFromChildProcess();
23
23
  }
24
24
  }
25
- return musl
26
- }
25
+ return musl;
26
+ };
27
27
 
28
- const isFileMusl = (f) => f.includes('libc.musl-') || f.includes('ld-musl-')
28
+ const isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
29
29
 
30
30
  const isMuslFromFilesystem = () => {
31
31
  try {
32
- return readFileSync('/usr/bin/ldd', 'utf-8').includes('musl')
32
+ return readFileSync("/usr/bin/ldd", "utf-8").includes("musl");
33
33
  } catch {
34
- return null
34
+ return null;
35
35
  }
36
- }
36
+ };
37
37
 
38
38
  const isMuslFromReport = () => {
39
- let report = null
40
- if (typeof process.report?.getReport === 'function') {
41
- process.report.excludeNetwork = true
42
- report = process.report.getReport()
39
+ let report = null;
40
+ if (typeof process.report?.getReport === "function") {
41
+ process.report.excludeNetwork = true;
42
+ report = process.report.getReport();
43
43
  }
44
44
  if (!report) {
45
- return null
45
+ return null;
46
46
  }
47
47
  if (report.header && report.header.glibcVersionRuntime) {
48
- return false
48
+ return false;
49
49
  }
50
50
  if (Array.isArray(report.sharedObjects)) {
51
51
  if (report.sharedObjects.some(isFileMusl)) {
52
- return true
52
+ return true;
53
53
  }
54
54
  }
55
- return false
56
- }
55
+ return false;
56
+ };
57
57
 
58
58
  const isMuslFromChildProcess = () => {
59
59
  try {
60
- return require('child_process').execSync('ldd --version', { encoding: 'utf8' }).includes('musl')
60
+ return require("child_process")
61
+ .execSync("ldd --version", { encoding: "utf8" })
62
+ .includes("musl");
61
63
  } catch (e) {
62
64
  // If we reach this case, we don't know if the system is musl or not, so is better to just fallback to false
63
- return false
65
+ return false;
64
66
  }
65
- }
67
+ };
66
68
 
67
69
  function requireNative() {
68
70
  if (process.env.NAPI_RS_NATIVE_LIBRARY_PATH) {
69
71
  try {
70
72
  return require(process.env.NAPI_RS_NATIVE_LIBRARY_PATH);
71
73
  } catch (err) {
72
- loadErrors.push(err)
74
+ loadErrors.push(err);
73
75
  }
74
- } else if (process.platform === 'android') {
75
- if (process.arch === 'arm64') {
76
- try {
77
- return require('./hive_router.android-arm64.node')
78
- } catch (e) {
79
- loadErrors.push(e)
80
- }
76
+ } else if (process.platform === "android") {
77
+ if (process.arch === "arm64") {
81
78
  try {
82
- const binding = require('@graphql-hive/router-android-arm64')
83
- const bindingPackageVersion = require('@graphql-hive/router-android-arm64/package.json').version
84
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
85
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
86
- }
87
- return binding
79
+ return require("./hive_router_query_planner.android-arm64.node");
88
80
  } catch (e) {
89
- loadErrors.push(e)
81
+ loadErrors.push(e);
90
82
  }
91
- } else if (process.arch === 'arm') {
83
+ } else if (process.arch === "arm") {
92
84
  try {
93
- return require('./hive_router.android-arm-eabi.node')
85
+ return require("./hive_router_query_planner.android-arm-eabi.node");
94
86
  } catch (e) {
95
- loadErrors.push(e)
96
- }
97
- try {
98
- const binding = require('@graphql-hive/router-android-arm-eabi')
99
- const bindingPackageVersion = require('@graphql-hive/router-android-arm-eabi/package.json').version
100
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
101
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
102
- }
103
- return binding
104
- } catch (e) {
105
- loadErrors.push(e)
87
+ loadErrors.push(e);
106
88
  }
107
89
  } else {
108
- loadErrors.push(new Error(`Unsupported architecture on Android ${process.arch}`))
90
+ loadErrors.push(
91
+ new Error(`Unsupported architecture on Android ${process.arch}`)
92
+ );
109
93
  }
110
- } else if (process.platform === 'win32') {
111
- if (process.arch === 'x64') {
112
- if (process.report?.getReport?.()?.header?.osName?.startsWith?.('MINGW')) {
94
+ } else if (process.platform === "win32") {
95
+ if (process.arch === "x64") {
96
+ if (
97
+ process.report?.getReport?.()?.header?.osName?.startsWith?.("MINGW")
98
+ ) {
113
99
  try {
114
- return require('./hive_router.win32-x64-gnu.node')
115
- } catch (e) {
116
- loadErrors.push(e)
117
- }
118
- try {
119
- const binding = require('@graphql-hive/router-win32-x64-gnu')
120
- const bindingPackageVersion = require('@graphql-hive/router-win32-x64-gnu/package.json').version
121
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
122
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
100
+ return require("./hive_router_query_planner.win32-x64-gnu.node");
101
+ } catch (e) {
102
+ loadErrors.push(e);
123
103
  }
124
- return binding
125
- } catch (e) {
126
- loadErrors.push(e)
127
- }
128
104
  } else {
129
105
  try {
130
- return require('./hive_router.win32-x64-msvc.node')
131
- } catch (e) {
132
- loadErrors.push(e)
133
- }
134
- try {
135
- const binding = require('@graphql-hive/router-win32-x64-msvc')
136
- const bindingPackageVersion = require('@graphql-hive/router-win32-x64-msvc/package.json').version
137
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
138
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
139
- }
140
- return binding
141
- } catch (e) {
142
- loadErrors.push(e)
143
- }
144
- }
145
- } else if (process.arch === 'ia32') {
146
- try {
147
- return require('./hive_router.win32-ia32-msvc.node')
148
- } catch (e) {
149
- loadErrors.push(e)
150
- }
151
- try {
152
- const binding = require('@graphql-hive/router-win32-ia32-msvc')
153
- const bindingPackageVersion = require('@graphql-hive/router-win32-ia32-msvc/package.json').version
154
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
155
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
106
+ return require("./hive_router_query_planner.win32-x64-msvc.node");
107
+ } catch (e) {
108
+ loadErrors.push(e);
156
109
  }
157
- return binding
158
- } catch (e) {
159
- loadErrors.push(e)
160
110
  }
161
- } else if (process.arch === 'arm64') {
111
+ } else if (process.arch === "ia32") {
162
112
  try {
163
- return require('./hive_router.win32-arm64-msvc.node')
113
+ return require("./hive_router_query_planner.win32-ia32-msvc.node");
164
114
  } catch (e) {
165
- loadErrors.push(e)
115
+ loadErrors.push(e);
166
116
  }
117
+ } else if (process.arch === "arm64") {
167
118
  try {
168
- const binding = require('@graphql-hive/router-win32-arm64-msvc')
169
- const bindingPackageVersion = require('@graphql-hive/router-win32-arm64-msvc/package.json').version
170
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
171
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
172
- }
173
- return binding
119
+ return require("./hive_router_query_planner.win32-arm64-msvc.node");
174
120
  } catch (e) {
175
- loadErrors.push(e)
121
+ loadErrors.push(e);
176
122
  }
177
123
  } else {
178
- loadErrors.push(new Error(`Unsupported architecture on Windows: ${process.arch}`))
179
- }
180
- } else if (process.platform === 'darwin') {
181
- try {
182
- return require('./hive_router.darwin-universal.node')
183
- } catch (e) {
184
- loadErrors.push(e)
124
+ loadErrors.push(
125
+ new Error(`Unsupported architecture on Windows: ${process.arch}`)
126
+ );
185
127
  }
128
+ } else if (process.platform === "darwin") {
186
129
  try {
187
- const binding = require('@graphql-hive/router-darwin-universal')
188
- const bindingPackageVersion = require('@graphql-hive/router-darwin-universal/package.json').version
189
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
190
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
191
- }
192
- return binding
130
+ return require("./hive_router_query_planner.darwin-universal.node");
193
131
  } catch (e) {
194
- loadErrors.push(e)
132
+ loadErrors.push(e);
195
133
  }
196
- if (process.arch === 'x64') {
134
+ if (process.arch === "x64") {
197
135
  try {
198
- return require('./hive_router.darwin-x64.node')
136
+ return require("./hive_router_query_planner.darwin-x64.node");
199
137
  } catch (e) {
200
- loadErrors.push(e)
138
+ loadErrors.push(e);
201
139
  }
140
+ } else if (process.arch === "arm64") {
202
141
  try {
203
- const binding = require('@graphql-hive/router-darwin-x64')
204
- const bindingPackageVersion = require('@graphql-hive/router-darwin-x64/package.json').version
205
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
206
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
207
- }
208
- return binding
142
+ return require("./hive_router_query_planner.darwin-arm64.node");
209
143
  } catch (e) {
210
- loadErrors.push(e)
211
- }
212
- } else if (process.arch === 'arm64') {
213
- try {
214
- return require('./hive_router.darwin-arm64.node')
215
- } catch (e) {
216
- loadErrors.push(e)
217
- }
218
- try {
219
- const binding = require('@graphql-hive/router-darwin-arm64')
220
- const bindingPackageVersion = require('@graphql-hive/router-darwin-arm64/package.json').version
221
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
222
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
223
- }
224
- return binding
225
- } catch (e) {
226
- loadErrors.push(e)
144
+ loadErrors.push(e);
227
145
  }
228
146
  } else {
229
- loadErrors.push(new Error(`Unsupported architecture on macOS: ${process.arch}`))
147
+ loadErrors.push(
148
+ new Error(`Unsupported architecture on macOS: ${process.arch}`)
149
+ );
230
150
  }
231
- } else if (process.platform === 'freebsd') {
232
- if (process.arch === 'x64') {
151
+ } else if (process.platform === "freebsd") {
152
+ if (process.arch === "x64") {
233
153
  try {
234
- return require('./hive_router.freebsd-x64.node')
235
- } catch (e) {
236
- loadErrors.push(e)
237
- }
238
- try {
239
- const binding = require('@graphql-hive/router-freebsd-x64')
240
- const bindingPackageVersion = require('@graphql-hive/router-freebsd-x64/package.json').version
241
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
242
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
243
- }
244
- return binding
154
+ return require("./hive_router_query_planner.freebsd-x64.node");
245
155
  } catch (e) {
246
- loadErrors.push(e)
156
+ loadErrors.push(e);
247
157
  }
248
- } else if (process.arch === 'arm64') {
158
+ } else if (process.arch === "arm64") {
249
159
  try {
250
- return require('./hive_router.freebsd-arm64.node')
160
+ return require("./hive_router_query_planner.freebsd-arm64.node");
251
161
  } catch (e) {
252
- loadErrors.push(e)
253
- }
254
- try {
255
- const binding = require('@graphql-hive/router-freebsd-arm64')
256
- const bindingPackageVersion = require('@graphql-hive/router-freebsd-arm64/package.json').version
257
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
258
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
259
- }
260
- return binding
261
- } catch (e) {
262
- loadErrors.push(e)
162
+ loadErrors.push(e);
263
163
  }
264
164
  } else {
265
- loadErrors.push(new Error(`Unsupported architecture on FreeBSD: ${process.arch}`))
165
+ loadErrors.push(
166
+ new Error(`Unsupported architecture on FreeBSD: ${process.arch}`)
167
+ );
266
168
  }
267
- } else if (process.platform === 'linux') {
268
- if (process.arch === 'x64') {
169
+ } else if (process.platform === "linux") {
170
+ if (process.arch === "x64") {
269
171
  if (isMusl()) {
270
172
  try {
271
- return require('./hive_router.linux-x64-musl.node')
272
- } catch (e) {
273
- loadErrors.push(e)
274
- }
275
- try {
276
- const binding = require('@graphql-hive/router-linux-x64-musl')
277
- const bindingPackageVersion = require('@graphql-hive/router-linux-x64-musl/package.json').version
278
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
279
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
280
- }
281
- return binding
173
+ return require("./hive_router_query_planner.linux-x64-musl.node");
282
174
  } catch (e) {
283
- loadErrors.push(e)
175
+ loadErrors.push(e);
284
176
  }
285
177
  } else {
286
178
  try {
287
- return require('./hive_router.linux-x64-gnu.node')
288
- } catch (e) {
289
- loadErrors.push(e)
290
- }
291
- try {
292
- const binding = require('@graphql-hive/router-linux-x64-gnu')
293
- const bindingPackageVersion = require('@graphql-hive/router-linux-x64-gnu/package.json').version
294
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
295
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
296
- }
297
- return binding
179
+ return require("./hive_router_query_planner.linux-x64-gnu.node");
298
180
  } catch (e) {
299
- loadErrors.push(e)
181
+ loadErrors.push(e);
300
182
  }
301
183
  }
302
- } else if (process.arch === 'arm64') {
184
+ } else if (process.arch === "arm64") {
303
185
  if (isMusl()) {
304
186
  try {
305
- return require('./hive_router.linux-arm64-musl.node')
306
- } catch (e) {
307
- loadErrors.push(e)
308
- }
309
- try {
310
- const binding = require('@graphql-hive/router-linux-arm64-musl')
311
- const bindingPackageVersion = require('@graphql-hive/router-linux-arm64-musl/package.json').version
312
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
313
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
314
- }
315
- return binding
187
+ return require("./hive_router_query_planner.linux-arm64-musl.node");
316
188
  } catch (e) {
317
- loadErrors.push(e)
189
+ loadErrors.push(e);
318
190
  }
319
191
  } else {
320
192
  try {
321
- return require('./hive_router.linux-arm64-gnu.node')
193
+ return require("./hive_router_query_planner.linux-arm64-gnu.node");
322
194
  } catch (e) {
323
- loadErrors.push(e)
324
- }
325
- try {
326
- const binding = require('@graphql-hive/router-linux-arm64-gnu')
327
- const bindingPackageVersion = require('@graphql-hive/router-linux-arm64-gnu/package.json').version
328
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
329
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
330
- }
331
- return binding
332
- } catch (e) {
333
- loadErrors.push(e)
195
+ loadErrors.push(e);
334
196
  }
335
197
  }
336
- } else if (process.arch === 'arm') {
198
+ } else if (process.arch === "arm") {
337
199
  if (isMusl()) {
338
200
  try {
339
- return require('./hive_router.linux-arm-musleabihf.node')
201
+ return require("./hive_router_query_planner.linux-arm-musleabihf.node");
340
202
  } catch (e) {
341
- loadErrors.push(e)
342
- }
343
- try {
344
- const binding = require('@graphql-hive/router-linux-arm-musleabihf')
345
- const bindingPackageVersion = require('@graphql-hive/router-linux-arm-musleabihf/package.json').version
346
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
347
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
348
- }
349
- return binding
350
- } catch (e) {
351
- loadErrors.push(e)
203
+ loadErrors.push(e);
352
204
  }
353
205
  } else {
354
206
  try {
355
- return require('./hive_router.linux-arm-gnueabihf.node')
207
+ return require("./hive_router_query_planner.linux-arm-gnueabihf.node");
356
208
  } catch (e) {
357
- loadErrors.push(e)
358
- }
359
- try {
360
- const binding = require('@graphql-hive/router-linux-arm-gnueabihf')
361
- const bindingPackageVersion = require('@graphql-hive/router-linux-arm-gnueabihf/package.json').version
362
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
363
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
364
- }
365
- return binding
366
- } catch (e) {
367
- loadErrors.push(e)
209
+ loadErrors.push(e);
368
210
  }
369
211
  }
370
- } else if (process.arch === 'loong64') {
212
+ } else if (process.arch === "loong64") {
371
213
  if (isMusl()) {
372
214
  try {
373
- return require('./hive_router.linux-loong64-musl.node')
215
+ return require("./hive_router_query_planner.linux-loong64-musl.node");
374
216
  } catch (e) {
375
- loadErrors.push(e)
376
- }
377
- try {
378
- const binding = require('@graphql-hive/router-linux-loong64-musl')
379
- const bindingPackageVersion = require('@graphql-hive/router-linux-loong64-musl/package.json').version
380
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
381
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
382
- }
383
- return binding
384
- } catch (e) {
385
- loadErrors.push(e)
217
+ loadErrors.push(e);
386
218
  }
387
219
  } else {
388
220
  try {
389
- return require('./hive_router.linux-loong64-gnu.node')
221
+ return require("./hive_router_query_planner.linux-loong64-gnu.node");
390
222
  } catch (e) {
391
- loadErrors.push(e)
392
- }
393
- try {
394
- const binding = require('@graphql-hive/router-linux-loong64-gnu')
395
- const bindingPackageVersion = require('@graphql-hive/router-linux-loong64-gnu/package.json').version
396
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
397
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
398
- }
399
- return binding
400
- } catch (e) {
401
- loadErrors.push(e)
223
+ loadErrors.push(e);
402
224
  }
403
225
  }
404
- } else if (process.arch === 'riscv64') {
226
+ } else if (process.arch === "riscv64") {
405
227
  if (isMusl()) {
406
228
  try {
407
- return require('./hive_router.linux-riscv64-musl.node')
408
- } catch (e) {
409
- loadErrors.push(e)
410
- }
411
- try {
412
- const binding = require('@graphql-hive/router-linux-riscv64-musl')
413
- const bindingPackageVersion = require('@graphql-hive/router-linux-riscv64-musl/package.json').version
414
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
415
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
416
- }
417
- return binding
229
+ return require("./hive_router_query_planner.linux-riscv64-musl.node");
418
230
  } catch (e) {
419
- loadErrors.push(e)
231
+ loadErrors.push(e);
420
232
  }
421
233
  } else {
422
234
  try {
423
- return require('./hive_router.linux-riscv64-gnu.node')
424
- } catch (e) {
425
- loadErrors.push(e)
426
- }
427
- try {
428
- const binding = require('@graphql-hive/router-linux-riscv64-gnu')
429
- const bindingPackageVersion = require('@graphql-hive/router-linux-riscv64-gnu/package.json').version
430
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
431
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
432
- }
433
- return binding
235
+ return require("./hive_router_query_planner.linux-riscv64-gnu.node");
434
236
  } catch (e) {
435
- loadErrors.push(e)
436
- }
437
- }
438
- } else if (process.arch === 'ppc64') {
439
- try {
440
- return require('./hive_router.linux-ppc64-gnu.node')
441
- } catch (e) {
442
- loadErrors.push(e)
443
- }
444
- try {
445
- const binding = require('@graphql-hive/router-linux-ppc64-gnu')
446
- const bindingPackageVersion = require('@graphql-hive/router-linux-ppc64-gnu/package.json').version
447
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
448
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
237
+ loadErrors.push(e);
449
238
  }
450
- return binding
451
- } catch (e) {
452
- loadErrors.push(e)
453
239
  }
454
- } else if (process.arch === 's390x') {
240
+ } else if (process.arch === "ppc64") {
455
241
  try {
456
- return require('./hive_router.linux-s390x-gnu.node')
242
+ return require("./hive_router_query_planner.linux-ppc64-gnu.node");
457
243
  } catch (e) {
458
- loadErrors.push(e)
244
+ loadErrors.push(e);
459
245
  }
246
+ } else if (process.arch === "s390x") {
460
247
  try {
461
- const binding = require('@graphql-hive/router-linux-s390x-gnu')
462
- const bindingPackageVersion = require('@graphql-hive/router-linux-s390x-gnu/package.json').version
463
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
464
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
465
- }
466
- return binding
248
+ return require("./hive_router_query_planner.linux-s390x-gnu.node");
467
249
  } catch (e) {
468
- loadErrors.push(e)
250
+ loadErrors.push(e);
469
251
  }
470
252
  } else {
471
- loadErrors.push(new Error(`Unsupported architecture on Linux: ${process.arch}`))
253
+ loadErrors.push(
254
+ new Error(`Unsupported architecture on Linux: ${process.arch}`)
255
+ );
472
256
  }
473
- } else if (process.platform === 'openharmony') {
474
- if (process.arch === 'arm64') {
257
+ } else if (process.platform === "openharmony") {
258
+ if (process.arch === "arm64") {
475
259
  try {
476
- return require('./hive_router.openharmony-arm64.node')
260
+ return require("./hive_router_query_planner.openharmony-arm64.node");
477
261
  } catch (e) {
478
- loadErrors.push(e)
262
+ loadErrors.push(e);
479
263
  }
264
+ } else if (process.arch === "x64") {
480
265
  try {
481
- const binding = require('@graphql-hive/router-openharmony-arm64')
482
- const bindingPackageVersion = require('@graphql-hive/router-openharmony-arm64/package.json').version
483
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
484
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
485
- }
486
- return binding
266
+ return require("./hive_router_query_planner.openharmony-x64.node");
487
267
  } catch (e) {
488
- loadErrors.push(e)
268
+ loadErrors.push(e);
489
269
  }
490
- } else if (process.arch === 'x64') {
270
+ } else if (process.arch === "arm") {
491
271
  try {
492
- return require('./hive_router.openharmony-x64.node')
493
- } catch (e) {
494
- loadErrors.push(e)
495
- }
496
- try {
497
- const binding = require('@graphql-hive/router-openharmony-x64')
498
- const bindingPackageVersion = require('@graphql-hive/router-openharmony-x64/package.json').version
499
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
500
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
501
- }
502
- return binding
272
+ return require("./hive_router_query_planner.openharmony-arm.node");
503
273
  } catch (e) {
504
- loadErrors.push(e)
505
- }
506
- } else if (process.arch === 'arm') {
507
- try {
508
- return require('./hive_router.openharmony-arm.node')
509
- } catch (e) {
510
- loadErrors.push(e)
511
- }
512
- try {
513
- const binding = require('@graphql-hive/router-openharmony-arm')
514
- const bindingPackageVersion = require('@graphql-hive/router-openharmony-arm/package.json').version
515
- if (bindingPackageVersion !== '0.0.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
516
- throw new Error(`Native binding package version mismatch, expected 0.0.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
517
- }
518
- return binding
519
- } catch (e) {
520
- loadErrors.push(e)
274
+ loadErrors.push(e);
521
275
  }
522
276
  } else {
523
- loadErrors.push(new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`))
277
+ loadErrors.push(
278
+ new Error(`Unsupported architecture on OpenHarmony: ${process.arch}`)
279
+ );
524
280
  }
525
281
  } else {
526
- loadErrors.push(new Error(`Unsupported OS: ${process.platform}, architecture: ${process.arch}`))
282
+ loadErrors.push(
283
+ new Error(
284
+ `Unsupported OS: ${process.platform}, architecture: ${process.arch}`
285
+ )
286
+ );
527
287
  }
528
288
  }
529
289
 
530
- nativeBinding = requireNative()
290
+ nativeBinding = requireNative();
531
291
 
532
292
  if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
533
- let wasiBinding = null
534
- let wasiBindingError = null
293
+ let wasiBinding = null;
294
+ let wasiBindingError = null;
535
295
  try {
536
- wasiBinding = require('./hive_router.wasi.cjs')
537
- nativeBinding = wasiBinding
296
+ wasiBinding = require("./hive_router_query_planner.wasi.cjs");
297
+ nativeBinding = wasiBinding;
538
298
  } catch (err) {
539
299
  if (process.env.NAPI_RS_FORCE_WASI) {
540
- wasiBindingError = err
300
+ wasiBindingError = err;
541
301
  }
542
302
  }
543
- if (!nativeBinding) {
544
- try {
545
- wasiBinding = require('@graphql-hive/router-wasm32-wasi')
546
- nativeBinding = wasiBinding
547
- } catch (err) {
548
- if (process.env.NAPI_RS_FORCE_WASI) {
549
- wasiBindingError.cause = err
550
- loadErrors.push(err)
551
- }
552
- }
553
- }
554
- if (process.env.NAPI_RS_FORCE_WASI === 'error' && !wasiBinding) {
555
- const error = new Error('WASI binding not found and NAPI_RS_FORCE_WASI is set to error')
556
- error.cause = wasiBindingError
557
- throw error
303
+ if (process.env.NAPI_RS_FORCE_WASI === "error" && !wasiBinding) {
304
+ const error = new Error(
305
+ "WASI binding not found and NAPI_RS_FORCE_WASI is set to error"
306
+ );
307
+ error.cause = wasiBindingError;
308
+ throw error;
558
309
  }
559
310
  }
560
311
 
@@ -563,17 +314,17 @@ if (!nativeBinding) {
563
314
  throw new Error(
564
315
  `Cannot find native binding. ` +
565
316
  `npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). ` +
566
- 'Please try `npm i` again after removing both package-lock.json and node_modules directory.',
317
+ "Please try `npm i` again after removing both package-lock.json and node_modules directory.",
567
318
  {
568
319
  cause: loadErrors.reduce((err, cur) => {
569
- cur.cause = err
570
- return cur
320
+ cur.cause = err;
321
+ return cur;
571
322
  }),
572
- },
573
- )
323
+ }
324
+ );
574
325
  }
575
- throw new Error(`Failed to load native binding`)
326
+ throw new Error(`Failed to load native binding`);
576
327
  }
577
328
 
578
- const { QueryPlanner } = nativeBinding
579
- export { QueryPlanner }
329
+ const { QueryPlanner } = nativeBinding;
330
+ export { QueryPlanner };
package/package.json CHANGED
@@ -1,18 +1,27 @@
1
1
  {
2
2
  "name": "@graphql-hive/router-query-planner",
3
- "version": "0.0.1-manual.1",
3
+ "version": "0.0.3-manual.0",
4
4
  "type": "module",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "files": [
8
8
  "README.md",
9
9
  "index.js",
10
+ "index.cjs",
10
11
  "index.d.ts",
11
12
  "*.node"
12
13
  ],
14
+ "exports": {
15
+ ".": {
16
+ "import": "./index.js",
17
+ "require": "./index.cjs",
18
+ "types": "./index.d.ts"
19
+ },
20
+ "./package.json": "./package.json"
21
+ },
13
22
  "repository": {
14
23
  "type": "git",
15
- "url": "https://github.com/graphql-hive/router.git",
24
+ "url": "git+https://github.com/graphql-hive/router.git",
16
25
  "directory": "lib/node-addon"
17
26
  },
18
27
  "homepage": "https://the-guild.dev/graphql/hive/docs/router",
@@ -26,7 +35,7 @@
26
35
  "access": "public"
27
36
  },
28
37
  "napi": {
29
- "binaryName": "hive_router",
38
+ "binaryName": "hive_router_query_planner",
30
39
  "targets": [
31
40
  "aarch64-unknown-linux-gnu",
32
41
  "x86_64-unknown-linux-gnu",
Binary file