@spikard/node 0.6.1 → 0.7.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/graphql.d.ts +287 -0
- package/index.d.ts +4 -0
- package/index.js +58 -54
- package/package.json +6 -6
package/graphql.d.ts
ADDED
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GraphQL Schema Configuration Bindings for Node.js
|
|
3
|
+
*
|
|
4
|
+
* High-performance TypeScript bindings for configuring GraphQL schemas
|
|
5
|
+
* with support for introspection control, complexity limits, and depth limits.
|
|
6
|
+
*
|
|
7
|
+
* @module spikard/graphql
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* GraphQL Schema Configuration
|
|
12
|
+
*
|
|
13
|
+
* Represents the final configuration for a GraphQL schema after builder setup.
|
|
14
|
+
* This object is passed to the GraphQL execution engine to apply constraints
|
|
15
|
+
* and settings to query execution.
|
|
16
|
+
*
|
|
17
|
+
* @interface SchemaConfig
|
|
18
|
+
*/
|
|
19
|
+
export interface SchemaConfig {
|
|
20
|
+
/**
|
|
21
|
+
* Whether to enable GraphQL introspection queries.
|
|
22
|
+
* Introspection allows clients to query the schema structure.
|
|
23
|
+
*
|
|
24
|
+
* @default true
|
|
25
|
+
*/
|
|
26
|
+
introspectionEnabled?: boolean;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Maximum complexity allowed for queries (0 = unlimited).
|
|
30
|
+
* Queries exceeding this complexity will be rejected.
|
|
31
|
+
*
|
|
32
|
+
* Complexity is calculated based on the query structure and field costs.
|
|
33
|
+
* Typical production values: 1000-5000
|
|
34
|
+
*
|
|
35
|
+
* @default undefined (unlimited)
|
|
36
|
+
*/
|
|
37
|
+
complexityLimit?: number;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Maximum depth allowed for queries (0 = unlimited).
|
|
41
|
+
* Queries exceeding this depth will be rejected.
|
|
42
|
+
*
|
|
43
|
+
* Depth is the maximum nesting level of selections.
|
|
44
|
+
* Typical production values: 15-25
|
|
45
|
+
*
|
|
46
|
+
* @default undefined (unlimited)
|
|
47
|
+
*/
|
|
48
|
+
depthLimit?: number;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* GraphQL Schema Builder
|
|
53
|
+
*
|
|
54
|
+
* Provides a fluent interface for building GraphQL schema configurations.
|
|
55
|
+
* The builder follows the same pattern as the Rust SchemaBuilder with
|
|
56
|
+
* mutations applied directly to the builder instance.
|
|
57
|
+
*
|
|
58
|
+
* @class GraphQLSchemaBuilder
|
|
59
|
+
* @example
|
|
60
|
+
* const builder = new GraphQLSchemaBuilder();
|
|
61
|
+
* builder.enableIntrospection(true);
|
|
62
|
+
* builder.complexityLimit(5000);
|
|
63
|
+
* builder.depthLimit(50);
|
|
64
|
+
* const config = builder.finish();
|
|
65
|
+
*/
|
|
66
|
+
export class GraphQLSchemaBuilder {
|
|
67
|
+
/**
|
|
68
|
+
* Create a new GraphQL schema builder with default settings
|
|
69
|
+
*
|
|
70
|
+
* Default configuration:
|
|
71
|
+
* - Introspection enabled
|
|
72
|
+
* - No complexity limit
|
|
73
|
+
* - No depth limit
|
|
74
|
+
*
|
|
75
|
+
* @constructor
|
|
76
|
+
*/
|
|
77
|
+
constructor();
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Enable or disable GraphQL introspection
|
|
81
|
+
*
|
|
82
|
+
* Introspection is enabled by default. Disabling it prevents clients
|
|
83
|
+
* from querying the schema structure via introspection queries, which
|
|
84
|
+
* can be useful for security through obscurity in production.
|
|
85
|
+
*
|
|
86
|
+
* @param enabled - Whether to enable introspection
|
|
87
|
+
* @returns void (mutates this instance)
|
|
88
|
+
*
|
|
89
|
+
* @example
|
|
90
|
+
* builder.enableIntrospection(false); // Disable introspection
|
|
91
|
+
*/
|
|
92
|
+
enableIntrospection(enabled: boolean): void;
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Set the maximum complexity allowed for queries
|
|
96
|
+
*
|
|
97
|
+
* The complexity is calculated based on the query structure and field costs.
|
|
98
|
+
* Queries exceeding this limit will be rejected with a validation error.
|
|
99
|
+
* A value of 0 means unlimited.
|
|
100
|
+
*
|
|
101
|
+
* Typical values:
|
|
102
|
+
* - Production: 1000-5000
|
|
103
|
+
* - Development: 10000+
|
|
104
|
+
* - Testing: varies based on test scenarios
|
|
105
|
+
*
|
|
106
|
+
* @param limit - The maximum complexity allowed (0 = unlimited)
|
|
107
|
+
* @returns void (mutates this instance)
|
|
108
|
+
*
|
|
109
|
+
* @example
|
|
110
|
+
* builder.complexityLimit(5000); // Allow up to 5000 complexity
|
|
111
|
+
*/
|
|
112
|
+
complexityLimit(limit: number): void;
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Set the maximum depth allowed for queries
|
|
116
|
+
*
|
|
117
|
+
* The depth is the maximum nesting level of selections in a query.
|
|
118
|
+
* Queries exceeding this limit will be rejected with a validation error.
|
|
119
|
+
* A value of 0 means unlimited.
|
|
120
|
+
*
|
|
121
|
+
* Typical values:
|
|
122
|
+
* - Production: 15-25
|
|
123
|
+
* - Development: 50-100
|
|
124
|
+
* - Testing: varies based on test scenarios
|
|
125
|
+
*
|
|
126
|
+
* @param limit - The maximum depth allowed (0 = unlimited)
|
|
127
|
+
* @returns void (mutates this instance)
|
|
128
|
+
*
|
|
129
|
+
* @example
|
|
130
|
+
* builder.depthLimit(50); // Allow up to 50 nesting levels
|
|
131
|
+
*/
|
|
132
|
+
depthLimit(limit: number): void;
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Check if introspection is currently enabled
|
|
136
|
+
*
|
|
137
|
+
* @returns true if introspection is enabled, false otherwise
|
|
138
|
+
*/
|
|
139
|
+
isIntrospectionEnabled(): boolean;
|
|
140
|
+
|
|
141
|
+
/**
|
|
142
|
+
* Get the current complexity limit if set
|
|
143
|
+
*
|
|
144
|
+
* @returns The complexity limit, or null if unlimited
|
|
145
|
+
*/
|
|
146
|
+
getComplexityLimit(): number | null;
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* Get the current depth limit if set
|
|
150
|
+
*
|
|
151
|
+
* @returns The depth limit, or null if unlimited
|
|
152
|
+
*/
|
|
153
|
+
getDepthLimit(): number | null;
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Build and return the schema configuration
|
|
157
|
+
*
|
|
158
|
+
* This method finalizes the configuration and returns a SchemaConfig object
|
|
159
|
+
* that can be serialized and passed to the GraphQL execution engine.
|
|
160
|
+
*
|
|
161
|
+
* @returns A SchemaConfig instance with the configured settings
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* const builder = new GraphQLSchemaBuilder();
|
|
165
|
+
* builder.complexityLimit(5000);
|
|
166
|
+
* const config = builder.finish();
|
|
167
|
+
* // config is now {
|
|
168
|
+
* // introspectionEnabled: true,
|
|
169
|
+
* // complexityLimit: 5000,
|
|
170
|
+
* // depthLimit: undefined
|
|
171
|
+
* // }
|
|
172
|
+
*/
|
|
173
|
+
finish(): SchemaConfig;
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Convert the schema configuration to a JSON object
|
|
177
|
+
*
|
|
178
|
+
* This method serializes the current builder state to a JSON Value
|
|
179
|
+
* for transmission to the Rust execution engine or storage.
|
|
180
|
+
* Zero-copy serialization is used where possible.
|
|
181
|
+
*
|
|
182
|
+
* @returns A JSON representation of the schema configuration
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* const builder = new GraphQLSchemaBuilder();
|
|
186
|
+
* builder.complexityLimit(5000);
|
|
187
|
+
* const json = builder.to_json();
|
|
188
|
+
* console.log(JSON.stringify(json, null, 2));
|
|
189
|
+
*/
|
|
190
|
+
to_json(): Record<string, any>;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* GraphQL Utilities and Factory Functions
|
|
195
|
+
*
|
|
196
|
+
* Provides factory methods for creating schema builders and configurations
|
|
197
|
+
* with common patterns. All factory methods follow the same configuration
|
|
198
|
+
* semantics as the SchemaBuilder.
|
|
199
|
+
*
|
|
200
|
+
* @class GraphQL
|
|
201
|
+
*
|
|
202
|
+
* @example
|
|
203
|
+
* const builder = GraphQL.schemaBuilder();
|
|
204
|
+
* const config = GraphQL.defaultSchemaConfig();
|
|
205
|
+
* const queryConfig = GraphQL.queryOnlyConfig();
|
|
206
|
+
*/
|
|
207
|
+
export class GraphQL {
|
|
208
|
+
/**
|
|
209
|
+
* Create a new GraphQL schema builder
|
|
210
|
+
*
|
|
211
|
+
* Returns a builder instance that can be configured with various settings.
|
|
212
|
+
* The builder uses fluent API with mutation methods (returns void).
|
|
213
|
+
*
|
|
214
|
+
* @static
|
|
215
|
+
* @returns A new GraphQLSchemaBuilder instance with default settings
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* const builder = GraphQL.schemaBuilder()
|
|
219
|
+
* .enableIntrospection(true)
|
|
220
|
+
* .complexityLimit(5000)
|
|
221
|
+
* .depthLimit(50);
|
|
222
|
+
*/
|
|
223
|
+
static schemaBuilder(): GraphQLSchemaBuilder;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* Create a default schema configuration
|
|
227
|
+
*
|
|
228
|
+
* Returns a configuration with default settings:
|
|
229
|
+
* - Introspection enabled
|
|
230
|
+
* - No complexity limit
|
|
231
|
+
* - No depth limit
|
|
232
|
+
*
|
|
233
|
+
* @static
|
|
234
|
+
* @returns A SchemaConfig with default settings
|
|
235
|
+
*
|
|
236
|
+
* @example
|
|
237
|
+
* const config = GraphQL.defaultSchemaConfig();
|
|
238
|
+
* console.log(config.introspectionEnabled); // true
|
|
239
|
+
*/
|
|
240
|
+
static defaultSchemaConfig(): SchemaConfig;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Create a schema configuration for query-only schemas
|
|
244
|
+
*
|
|
245
|
+
* Returns a configuration suitable for schemas without mutations or
|
|
246
|
+
* subscriptions. Useful for read-only APIs.
|
|
247
|
+
*
|
|
248
|
+
* @static
|
|
249
|
+
* @returns A SchemaConfig optimized for query-only schemas
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* const config = GraphQL.queryOnlyConfig();
|
|
253
|
+
* // Use this for read-only GraphQL endpoints
|
|
254
|
+
*/
|
|
255
|
+
static queryOnlyConfig(): SchemaConfig;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Create a schema configuration for query and mutation schemas
|
|
259
|
+
*
|
|
260
|
+
* Returns a configuration suitable for schemas with queries and mutations
|
|
261
|
+
* but no subscriptions. This is the most common pattern for REST-like
|
|
262
|
+
* GraphQL APIs.
|
|
263
|
+
*
|
|
264
|
+
* @static
|
|
265
|
+
* @returns A SchemaConfig optimized for query and mutation schemas
|
|
266
|
+
*
|
|
267
|
+
* @example
|
|
268
|
+
* const config = GraphQL.queryMutationConfig();
|
|
269
|
+
* // Use this for typical CRUD GraphQL endpoints
|
|
270
|
+
*/
|
|
271
|
+
static queryMutationConfig(): SchemaConfig;
|
|
272
|
+
|
|
273
|
+
/**
|
|
274
|
+
* Create a full schema configuration
|
|
275
|
+
*
|
|
276
|
+
* Returns a configuration suitable for schemas with queries, mutations,
|
|
277
|
+
* and subscriptions. Use this for real-time GraphQL APIs.
|
|
278
|
+
*
|
|
279
|
+
* @static
|
|
280
|
+
* @returns A SchemaConfig optimized for full-featured schemas
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* const config = GraphQL.fullSchemaConfig();
|
|
284
|
+
* // Use this for real-time GraphQL APIs with subscriptions
|
|
285
|
+
*/
|
|
286
|
+
static fullSchemaConfig(): SchemaConfig;
|
|
287
|
+
}
|
package/index.d.ts
CHANGED
|
@@ -76,6 +76,10 @@ export declare class TestResponse {
|
|
|
76
76
|
json(): any
|
|
77
77
|
/** Get raw response body bytes */
|
|
78
78
|
bytes(): Buffer
|
|
79
|
+
/** Extract GraphQL data from response */
|
|
80
|
+
graphqlData(): any
|
|
81
|
+
/** Extract GraphQL errors from response */
|
|
82
|
+
graphqlErrors(): Array<any>
|
|
79
83
|
}
|
|
80
84
|
|
|
81
85
|
/** Node.js wrapper for WebSocket messages */
|
package/index.js
CHANGED
|
@@ -77,8 +77,8 @@ function requireNative() {
|
|
|
77
77
|
try {
|
|
78
78
|
const binding = require('@spikard/node-android-arm64')
|
|
79
79
|
const bindingPackageVersion = require('@spikard/node-android-arm64/package.json').version
|
|
80
|
-
if (bindingPackageVersion !== '0.
|
|
81
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
80
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
81
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
82
82
|
}
|
|
83
83
|
return binding
|
|
84
84
|
} catch (e) {
|
|
@@ -93,8 +93,8 @@ function requireNative() {
|
|
|
93
93
|
try {
|
|
94
94
|
const binding = require('@spikard/node-android-arm-eabi')
|
|
95
95
|
const bindingPackageVersion = require('@spikard/node-android-arm-eabi/package.json').version
|
|
96
|
-
if (bindingPackageVersion !== '0.
|
|
97
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
96
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
97
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
98
98
|
}
|
|
99
99
|
return binding
|
|
100
100
|
} catch (e) {
|
|
@@ -114,8 +114,8 @@ function requireNative() {
|
|
|
114
114
|
try {
|
|
115
115
|
const binding = require('@spikard/node-win32-x64-gnu')
|
|
116
116
|
const bindingPackageVersion = require('@spikard/node-win32-x64-gnu/package.json').version
|
|
117
|
-
if (bindingPackageVersion !== '0.
|
|
118
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
117
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
118
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
119
119
|
}
|
|
120
120
|
return binding
|
|
121
121
|
} catch (e) {
|
|
@@ -130,8 +130,8 @@ function requireNative() {
|
|
|
130
130
|
try {
|
|
131
131
|
const binding = require('@spikard/node-win32-x64-msvc')
|
|
132
132
|
const bindingPackageVersion = require('@spikard/node-win32-x64-msvc/package.json').version
|
|
133
|
-
if (bindingPackageVersion !== '0.
|
|
134
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
133
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
134
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
135
135
|
}
|
|
136
136
|
return binding
|
|
137
137
|
} catch (e) {
|
|
@@ -147,8 +147,8 @@ function requireNative() {
|
|
|
147
147
|
try {
|
|
148
148
|
const binding = require('@spikard/node-win32-ia32-msvc')
|
|
149
149
|
const bindingPackageVersion = require('@spikard/node-win32-ia32-msvc/package.json').version
|
|
150
|
-
if (bindingPackageVersion !== '0.
|
|
151
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
150
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
151
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
152
152
|
}
|
|
153
153
|
return binding
|
|
154
154
|
} catch (e) {
|
|
@@ -163,8 +163,8 @@ function requireNative() {
|
|
|
163
163
|
try {
|
|
164
164
|
const binding = require('@spikard/node-win32-arm64-msvc')
|
|
165
165
|
const bindingPackageVersion = require('@spikard/node-win32-arm64-msvc/package.json').version
|
|
166
|
-
if (bindingPackageVersion !== '0.
|
|
167
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
166
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
167
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
168
168
|
}
|
|
169
169
|
return binding
|
|
170
170
|
} catch (e) {
|
|
@@ -182,8 +182,8 @@ function requireNative() {
|
|
|
182
182
|
try {
|
|
183
183
|
const binding = require('@spikard/node-darwin-universal')
|
|
184
184
|
const bindingPackageVersion = require('@spikard/node-darwin-universal/package.json').version
|
|
185
|
-
if (bindingPackageVersion !== '0.
|
|
186
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
185
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
186
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
187
187
|
}
|
|
188
188
|
return binding
|
|
189
189
|
} catch (e) {
|
|
@@ -198,8 +198,8 @@ function requireNative() {
|
|
|
198
198
|
try {
|
|
199
199
|
const binding = require('@spikard/node-darwin-x64')
|
|
200
200
|
const bindingPackageVersion = require('@spikard/node-darwin-x64/package.json').version
|
|
201
|
-
if (bindingPackageVersion !== '0.
|
|
202
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
201
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
202
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
203
203
|
}
|
|
204
204
|
return binding
|
|
205
205
|
} catch (e) {
|
|
@@ -214,8 +214,8 @@ function requireNative() {
|
|
|
214
214
|
try {
|
|
215
215
|
const binding = require('@spikard/node-darwin-arm64')
|
|
216
216
|
const bindingPackageVersion = require('@spikard/node-darwin-arm64/package.json').version
|
|
217
|
-
if (bindingPackageVersion !== '0.
|
|
218
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
217
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
218
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
219
219
|
}
|
|
220
220
|
return binding
|
|
221
221
|
} catch (e) {
|
|
@@ -234,8 +234,8 @@ function requireNative() {
|
|
|
234
234
|
try {
|
|
235
235
|
const binding = require('@spikard/node-freebsd-x64')
|
|
236
236
|
const bindingPackageVersion = require('@spikard/node-freebsd-x64/package.json').version
|
|
237
|
-
if (bindingPackageVersion !== '0.
|
|
238
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
237
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
238
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
239
239
|
}
|
|
240
240
|
return binding
|
|
241
241
|
} catch (e) {
|
|
@@ -250,8 +250,8 @@ function requireNative() {
|
|
|
250
250
|
try {
|
|
251
251
|
const binding = require('@spikard/node-freebsd-arm64')
|
|
252
252
|
const bindingPackageVersion = require('@spikard/node-freebsd-arm64/package.json').version
|
|
253
|
-
if (bindingPackageVersion !== '0.
|
|
254
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
253
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
254
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
255
255
|
}
|
|
256
256
|
return binding
|
|
257
257
|
} catch (e) {
|
|
@@ -271,8 +271,8 @@ function requireNative() {
|
|
|
271
271
|
try {
|
|
272
272
|
const binding = require('@spikard/node-linux-x64-musl')
|
|
273
273
|
const bindingPackageVersion = require('@spikard/node-linux-x64-musl/package.json').version
|
|
274
|
-
if (bindingPackageVersion !== '0.
|
|
275
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
274
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
275
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
276
276
|
}
|
|
277
277
|
return binding
|
|
278
278
|
} catch (e) {
|
|
@@ -287,8 +287,8 @@ function requireNative() {
|
|
|
287
287
|
try {
|
|
288
288
|
const binding = require('@spikard/node-linux-x64-gnu')
|
|
289
289
|
const bindingPackageVersion = require('@spikard/node-linux-x64-gnu/package.json').version
|
|
290
|
-
if (bindingPackageVersion !== '0.
|
|
291
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
290
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
291
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
292
292
|
}
|
|
293
293
|
return binding
|
|
294
294
|
} catch (e) {
|
|
@@ -305,8 +305,8 @@ function requireNative() {
|
|
|
305
305
|
try {
|
|
306
306
|
const binding = require('@spikard/node-linux-arm64-musl')
|
|
307
307
|
const bindingPackageVersion = require('@spikard/node-linux-arm64-musl/package.json').version
|
|
308
|
-
if (bindingPackageVersion !== '0.
|
|
309
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
308
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
309
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
310
310
|
}
|
|
311
311
|
return binding
|
|
312
312
|
} catch (e) {
|
|
@@ -321,8 +321,8 @@ function requireNative() {
|
|
|
321
321
|
try {
|
|
322
322
|
const binding = require('@spikard/node-linux-arm64-gnu')
|
|
323
323
|
const bindingPackageVersion = require('@spikard/node-linux-arm64-gnu/package.json').version
|
|
324
|
-
if (bindingPackageVersion !== '0.
|
|
325
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
324
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
325
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
326
326
|
}
|
|
327
327
|
return binding
|
|
328
328
|
} catch (e) {
|
|
@@ -339,8 +339,8 @@ function requireNative() {
|
|
|
339
339
|
try {
|
|
340
340
|
const binding = require('@spikard/node-linux-arm-musleabihf')
|
|
341
341
|
const bindingPackageVersion = require('@spikard/node-linux-arm-musleabihf/package.json').version
|
|
342
|
-
if (bindingPackageVersion !== '0.
|
|
343
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
342
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
343
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
344
344
|
}
|
|
345
345
|
return binding
|
|
346
346
|
} catch (e) {
|
|
@@ -355,8 +355,8 @@ function requireNative() {
|
|
|
355
355
|
try {
|
|
356
356
|
const binding = require('@spikard/node-linux-arm-gnueabihf')
|
|
357
357
|
const bindingPackageVersion = require('@spikard/node-linux-arm-gnueabihf/package.json').version
|
|
358
|
-
if (bindingPackageVersion !== '0.
|
|
359
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
358
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
359
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
360
360
|
}
|
|
361
361
|
return binding
|
|
362
362
|
} catch (e) {
|
|
@@ -373,8 +373,8 @@ function requireNative() {
|
|
|
373
373
|
try {
|
|
374
374
|
const binding = require('@spikard/node-linux-loong64-musl')
|
|
375
375
|
const bindingPackageVersion = require('@spikard/node-linux-loong64-musl/package.json').version
|
|
376
|
-
if (bindingPackageVersion !== '0.
|
|
377
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
376
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
377
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
378
378
|
}
|
|
379
379
|
return binding
|
|
380
380
|
} catch (e) {
|
|
@@ -389,8 +389,8 @@ function requireNative() {
|
|
|
389
389
|
try {
|
|
390
390
|
const binding = require('@spikard/node-linux-loong64-gnu')
|
|
391
391
|
const bindingPackageVersion = require('@spikard/node-linux-loong64-gnu/package.json').version
|
|
392
|
-
if (bindingPackageVersion !== '0.
|
|
393
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
392
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
393
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
394
394
|
}
|
|
395
395
|
return binding
|
|
396
396
|
} catch (e) {
|
|
@@ -407,8 +407,8 @@ function requireNative() {
|
|
|
407
407
|
try {
|
|
408
408
|
const binding = require('@spikard/node-linux-riscv64-musl')
|
|
409
409
|
const bindingPackageVersion = require('@spikard/node-linux-riscv64-musl/package.json').version
|
|
410
|
-
if (bindingPackageVersion !== '0.
|
|
411
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
410
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
411
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
412
412
|
}
|
|
413
413
|
return binding
|
|
414
414
|
} catch (e) {
|
|
@@ -423,8 +423,8 @@ function requireNative() {
|
|
|
423
423
|
try {
|
|
424
424
|
const binding = require('@spikard/node-linux-riscv64-gnu')
|
|
425
425
|
const bindingPackageVersion = require('@spikard/node-linux-riscv64-gnu/package.json').version
|
|
426
|
-
if (bindingPackageVersion !== '0.
|
|
427
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
426
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
427
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
428
428
|
}
|
|
429
429
|
return binding
|
|
430
430
|
} catch (e) {
|
|
@@ -440,8 +440,8 @@ function requireNative() {
|
|
|
440
440
|
try {
|
|
441
441
|
const binding = require('@spikard/node-linux-ppc64-gnu')
|
|
442
442
|
const bindingPackageVersion = require('@spikard/node-linux-ppc64-gnu/package.json').version
|
|
443
|
-
if (bindingPackageVersion !== '0.
|
|
444
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
443
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
444
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
445
445
|
}
|
|
446
446
|
return binding
|
|
447
447
|
} catch (e) {
|
|
@@ -456,8 +456,8 @@ function requireNative() {
|
|
|
456
456
|
try {
|
|
457
457
|
const binding = require('@spikard/node-linux-s390x-gnu')
|
|
458
458
|
const bindingPackageVersion = require('@spikard/node-linux-s390x-gnu/package.json').version
|
|
459
|
-
if (bindingPackageVersion !== '0.
|
|
460
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
459
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
460
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
461
461
|
}
|
|
462
462
|
return binding
|
|
463
463
|
} catch (e) {
|
|
@@ -476,8 +476,8 @@ function requireNative() {
|
|
|
476
476
|
try {
|
|
477
477
|
const binding = require('@spikard/node-openharmony-arm64')
|
|
478
478
|
const bindingPackageVersion = require('@spikard/node-openharmony-arm64/package.json').version
|
|
479
|
-
if (bindingPackageVersion !== '0.
|
|
480
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
479
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
480
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
481
481
|
}
|
|
482
482
|
return binding
|
|
483
483
|
} catch (e) {
|
|
@@ -492,8 +492,8 @@ function requireNative() {
|
|
|
492
492
|
try {
|
|
493
493
|
const binding = require('@spikard/node-openharmony-x64')
|
|
494
494
|
const bindingPackageVersion = require('@spikard/node-openharmony-x64/package.json').version
|
|
495
|
-
if (bindingPackageVersion !== '0.
|
|
496
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
495
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
496
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
497
497
|
}
|
|
498
498
|
return binding
|
|
499
499
|
} catch (e) {
|
|
@@ -508,8 +508,8 @@ function requireNative() {
|
|
|
508
508
|
try {
|
|
509
509
|
const binding = require('@spikard/node-openharmony-arm')
|
|
510
510
|
const bindingPackageVersion = require('@spikard/node-openharmony-arm/package.json').version
|
|
511
|
-
if (bindingPackageVersion !== '0.
|
|
512
|
-
throw new Error(`Native binding package version mismatch, expected 0.
|
|
511
|
+
if (bindingPackageVersion !== '0.7.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
|
|
512
|
+
throw new Error(`Native binding package version mismatch, expected 0.7.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
|
|
513
513
|
}
|
|
514
514
|
return binding
|
|
515
515
|
} catch (e) {
|
|
@@ -536,13 +536,17 @@ if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
|
536
536
|
wasiBindingError = err
|
|
537
537
|
}
|
|
538
538
|
}
|
|
539
|
-
if (!nativeBinding) {
|
|
539
|
+
if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI) {
|
|
540
540
|
try {
|
|
541
541
|
wasiBinding = require('@spikard/node-wasm32-wasi')
|
|
542
542
|
nativeBinding = wasiBinding
|
|
543
543
|
} catch (err) {
|
|
544
544
|
if (process.env.NAPI_RS_FORCE_WASI) {
|
|
545
|
-
wasiBindingError
|
|
545
|
+
if (!wasiBindingError) {
|
|
546
|
+
wasiBindingError = err
|
|
547
|
+
} else {
|
|
548
|
+
wasiBindingError.cause = err
|
|
549
|
+
}
|
|
546
550
|
loadErrors.push(err)
|
|
547
551
|
}
|
|
548
552
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spikard/node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"description": "High-performance HTTP framework for Node.js and Bun. Type-safe routing, validation, and testing powered by Rust core.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"node": ">=20"
|
|
46
46
|
},
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"@napi-rs/cli": "^3.5.
|
|
48
|
+
"@napi-rs/cli": "^3.5.1",
|
|
49
49
|
"@types/node": "^25.0.3",
|
|
50
50
|
"@vitest/coverage-v8": "^4.0.16",
|
|
51
51
|
"typescript": "^5.9.3",
|
|
@@ -67,10 +67,10 @@
|
|
|
67
67
|
"zod": "^4.2.1"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
|
-
"@spikard/node-darwin-x64": "0.
|
|
71
|
-
"@spikard/node-darwin-arm64": "0.
|
|
72
|
-
"@spikard/node-linux-x64-gnu": "0.
|
|
73
|
-
"@spikard/node-win32-x64-msvc": "0.
|
|
70
|
+
"@spikard/node-darwin-x64": "0.7.0",
|
|
71
|
+
"@spikard/node-darwin-arm64": "0.7.0",
|
|
72
|
+
"@spikard/node-linux-x64-gnu": "0.7.0",
|
|
73
|
+
"@spikard/node-win32-x64-msvc": "0.7.0"
|
|
74
74
|
},
|
|
75
75
|
"scripts": {
|
|
76
76
|
"artifacts": "napi artifacts",
|