every-plugin 2.5.10 → 2.5.11
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/dist/_virtual/_rolldown/runtime.cjs +0 -16
- package/dist/_virtual/_rolldown/runtime.mjs +1 -33
- package/dist/build/rspack/dev-server-middleware.cjs.map +1 -1
- package/dist/build/rspack/dev-server-middleware.mjs.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.cjs.map +1 -1
- package/dist/build/rspack/fix-mf-data-uri-plugin.mjs.map +1 -1
- package/dist/build/rspack/plugin.cjs.map +1 -1
- package/dist/build/rspack/plugin.mjs.map +1 -1
- package/dist/build/shared-deps.cjs.map +1 -1
- package/dist/build/shared-deps.mjs.map +1 -1
- package/dist/errors.cjs +37 -35
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.cts +130 -130
- package/dist/errors.d.mts +130 -130
- package/dist/errors.mjs +35 -35
- package/dist/errors.mjs.map +1 -1
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.mjs.map +1 -1
- package/dist/runtime/errors.cjs.map +1 -1
- package/dist/runtime/errors.mjs.map +1 -1
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/mf-config.cjs +1 -1
- package/dist/runtime/mf-config.mjs +1 -1
- package/dist/runtime/services/plugin-loader.service.cjs.map +1 -1
- package/dist/runtime/services/plugin-loader.service.mjs.map +1 -1
- package/dist/runtime/services/secrets.service.cjs +2 -1
- package/dist/runtime/services/secrets.service.cjs.map +1 -1
- package/dist/runtime/services/secrets.service.mjs +2 -2
- package/dist/runtime/services/secrets.service.mjs.map +1 -1
- package/dist/testing/index.cjs.map +1 -1
- package/dist/testing/index.mjs.map +1 -1
- package/dist/zod.cjs +5 -17
- package/dist/zod.d.cts +2 -8
- package/dist/zod.d.mts +2 -8
- package/dist/zod.mjs +2 -11
- package/package.json +6 -6
- package/skills/plugin-development/SKILL.md +16 -8
- package/skills/plugin-testing/SKILL.md +19 -9
- package/src/runtime/services/secrets.service.ts +1 -1
- package/src/zod-core.ts +0 -3
- package/src/zod.ts +3 -1
- package/dist/zod.cjs.map +0 -1
- package/dist/zod.d.cts.map +0 -1
- package/dist/zod.d.mts.map +0 -1
- package/dist/zod.mjs.map +0 -1
package/dist/errors.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from "./zod.mjs";
|
|
2
2
|
import { ModuleFederationError, PluginRuntimeError, ValidationError, extractFromFiberFailure, formatORPCError, isRetryableORPCCode, toPluginRuntimeError, wrapORPCError } from "./runtime/errors.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/errors.d.ts
|
|
@@ -31,78 +31,78 @@ declare const ERROR_PATTERNS: {
|
|
|
31
31
|
*/
|
|
32
32
|
declare const UNAUTHORIZED: {
|
|
33
33
|
readonly status: 401;
|
|
34
|
-
readonly data:
|
|
35
|
-
apiKeyProvided:
|
|
36
|
-
provider:
|
|
37
|
-
authType:
|
|
34
|
+
readonly data: z.ZodObject<{
|
|
35
|
+
apiKeyProvided: z.ZodBoolean;
|
|
36
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
37
|
+
authType: z.ZodOptional<z.ZodEnum<{
|
|
38
38
|
apiKey: "apiKey";
|
|
39
39
|
oauth: "oauth";
|
|
40
40
|
token: "token";
|
|
41
41
|
}>>;
|
|
42
|
-
},
|
|
42
|
+
}, z.core.$strip>;
|
|
43
43
|
};
|
|
44
44
|
declare const RATE_LIMITED: {
|
|
45
45
|
readonly status: 429;
|
|
46
|
-
readonly data:
|
|
47
|
-
retryAfter:
|
|
48
|
-
remainingRequests:
|
|
49
|
-
resetTime:
|
|
50
|
-
limitType:
|
|
46
|
+
readonly data: z.ZodObject<{
|
|
47
|
+
retryAfter: z.ZodNumber;
|
|
48
|
+
remainingRequests: z.ZodOptional<z.ZodNumber>;
|
|
49
|
+
resetTime: z.ZodOptional<z.ZodString>;
|
|
50
|
+
limitType: z.ZodOptional<z.ZodEnum<{
|
|
51
51
|
requests: "requests";
|
|
52
52
|
tokens: "tokens";
|
|
53
53
|
bandwidth: "bandwidth";
|
|
54
54
|
}>>;
|
|
55
|
-
},
|
|
55
|
+
}, z.core.$strip>;
|
|
56
56
|
};
|
|
57
57
|
declare const SERVICE_UNAVAILABLE: {
|
|
58
58
|
readonly status: 503;
|
|
59
|
-
readonly data:
|
|
60
|
-
retryAfter:
|
|
61
|
-
maintenanceWindow:
|
|
62
|
-
estimatedUptime:
|
|
63
|
-
},
|
|
59
|
+
readonly data: z.ZodObject<{
|
|
60
|
+
retryAfter: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
maintenanceWindow: z.ZodDefault<z.ZodBoolean>;
|
|
62
|
+
estimatedUptime: z.ZodOptional<z.ZodString>;
|
|
63
|
+
}, z.core.$strip>;
|
|
64
64
|
};
|
|
65
65
|
declare const BAD_REQUEST: {
|
|
66
66
|
readonly status: 400;
|
|
67
|
-
readonly data:
|
|
68
|
-
invalidFields:
|
|
69
|
-
validationErrors:
|
|
70
|
-
field:
|
|
71
|
-
message:
|
|
72
|
-
code:
|
|
73
|
-
},
|
|
74
|
-
},
|
|
67
|
+
readonly data: z.ZodObject<{
|
|
68
|
+
invalidFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
69
|
+
validationErrors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
70
|
+
field: z.ZodString;
|
|
71
|
+
message: z.ZodString;
|
|
72
|
+
code: z.ZodOptional<z.ZodString>;
|
|
73
|
+
}, z.core.$strip>>>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
75
|
};
|
|
76
76
|
declare const NOT_FOUND: {
|
|
77
77
|
readonly status: 404;
|
|
78
|
-
readonly data:
|
|
79
|
-
resource:
|
|
80
|
-
resourceId:
|
|
81
|
-
},
|
|
78
|
+
readonly data: z.ZodObject<{
|
|
79
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
80
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
81
|
+
}, z.core.$strip>;
|
|
82
82
|
};
|
|
83
83
|
declare const FORBIDDEN: {
|
|
84
84
|
readonly status: 403;
|
|
85
|
-
readonly data:
|
|
86
|
-
requiredPermissions:
|
|
87
|
-
action:
|
|
88
|
-
},
|
|
85
|
+
readonly data: z.ZodObject<{
|
|
86
|
+
requiredPermissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
87
|
+
action: z.ZodOptional<z.ZodString>;
|
|
88
|
+
}, z.core.$strip>;
|
|
89
89
|
};
|
|
90
90
|
declare const TIMEOUT: {
|
|
91
91
|
readonly status: 504;
|
|
92
|
-
readonly data:
|
|
93
|
-
timeoutMs:
|
|
94
|
-
operation:
|
|
95
|
-
retryable:
|
|
96
|
-
},
|
|
92
|
+
readonly data: z.ZodObject<{
|
|
93
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
94
|
+
operation: z.ZodOptional<z.ZodString>;
|
|
95
|
+
retryable: z.ZodDefault<z.ZodBoolean>;
|
|
96
|
+
}, z.core.$strip>;
|
|
97
97
|
};
|
|
98
98
|
declare const CONNECTION_ERROR: {
|
|
99
99
|
readonly status: 502;
|
|
100
|
-
readonly data:
|
|
101
|
-
errorCode:
|
|
102
|
-
host:
|
|
103
|
-
port:
|
|
104
|
-
suggestion:
|
|
105
|
-
},
|
|
100
|
+
readonly data: z.ZodObject<{
|
|
101
|
+
errorCode: z.ZodOptional<z.ZodString>;
|
|
102
|
+
host: z.ZodOptional<z.ZodString>;
|
|
103
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
104
|
+
suggestion: z.ZodOptional<z.ZodString>;
|
|
105
|
+
}, z.core.$strip>;
|
|
106
106
|
};
|
|
107
107
|
/**
|
|
108
108
|
* Grouped export for all plugin errors.
|
|
@@ -111,78 +111,78 @@ declare const CONNECTION_ERROR: {
|
|
|
111
111
|
declare const PluginErrors: {
|
|
112
112
|
readonly UNAUTHORIZED: {
|
|
113
113
|
readonly status: 401;
|
|
114
|
-
readonly data:
|
|
115
|
-
apiKeyProvided:
|
|
116
|
-
provider:
|
|
117
|
-
authType:
|
|
114
|
+
readonly data: z.ZodObject<{
|
|
115
|
+
apiKeyProvided: z.ZodBoolean;
|
|
116
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
117
|
+
authType: z.ZodOptional<z.ZodEnum<{
|
|
118
118
|
apiKey: "apiKey";
|
|
119
119
|
oauth: "oauth";
|
|
120
120
|
token: "token";
|
|
121
121
|
}>>;
|
|
122
|
-
},
|
|
122
|
+
}, z.core.$strip>;
|
|
123
123
|
};
|
|
124
124
|
readonly RATE_LIMITED: {
|
|
125
125
|
readonly status: 429;
|
|
126
|
-
readonly data:
|
|
127
|
-
retryAfter:
|
|
128
|
-
remainingRequests:
|
|
129
|
-
resetTime:
|
|
130
|
-
limitType:
|
|
126
|
+
readonly data: z.ZodObject<{
|
|
127
|
+
retryAfter: z.ZodNumber;
|
|
128
|
+
remainingRequests: z.ZodOptional<z.ZodNumber>;
|
|
129
|
+
resetTime: z.ZodOptional<z.ZodString>;
|
|
130
|
+
limitType: z.ZodOptional<z.ZodEnum<{
|
|
131
131
|
requests: "requests";
|
|
132
132
|
tokens: "tokens";
|
|
133
133
|
bandwidth: "bandwidth";
|
|
134
134
|
}>>;
|
|
135
|
-
},
|
|
135
|
+
}, z.core.$strip>;
|
|
136
136
|
};
|
|
137
137
|
readonly SERVICE_UNAVAILABLE: {
|
|
138
138
|
readonly status: 503;
|
|
139
|
-
readonly data:
|
|
140
|
-
retryAfter:
|
|
141
|
-
maintenanceWindow:
|
|
142
|
-
estimatedUptime:
|
|
143
|
-
},
|
|
139
|
+
readonly data: z.ZodObject<{
|
|
140
|
+
retryAfter: z.ZodOptional<z.ZodNumber>;
|
|
141
|
+
maintenanceWindow: z.ZodDefault<z.ZodBoolean>;
|
|
142
|
+
estimatedUptime: z.ZodOptional<z.ZodString>;
|
|
143
|
+
}, z.core.$strip>;
|
|
144
144
|
};
|
|
145
145
|
readonly BAD_REQUEST: {
|
|
146
146
|
readonly status: 400;
|
|
147
|
-
readonly data:
|
|
148
|
-
invalidFields:
|
|
149
|
-
validationErrors:
|
|
150
|
-
field:
|
|
151
|
-
message:
|
|
152
|
-
code:
|
|
153
|
-
},
|
|
154
|
-
},
|
|
147
|
+
readonly data: z.ZodObject<{
|
|
148
|
+
invalidFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
149
|
+
validationErrors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
150
|
+
field: z.ZodString;
|
|
151
|
+
message: z.ZodString;
|
|
152
|
+
code: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, z.core.$strip>>>;
|
|
154
|
+
}, z.core.$strip>;
|
|
155
155
|
};
|
|
156
156
|
readonly NOT_FOUND: {
|
|
157
157
|
readonly status: 404;
|
|
158
|
-
readonly data:
|
|
159
|
-
resource:
|
|
160
|
-
resourceId:
|
|
161
|
-
},
|
|
158
|
+
readonly data: z.ZodObject<{
|
|
159
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
160
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
161
|
+
}, z.core.$strip>;
|
|
162
162
|
};
|
|
163
163
|
readonly FORBIDDEN: {
|
|
164
164
|
readonly status: 403;
|
|
165
|
-
readonly data:
|
|
166
|
-
requiredPermissions:
|
|
167
|
-
action:
|
|
168
|
-
},
|
|
165
|
+
readonly data: z.ZodObject<{
|
|
166
|
+
requiredPermissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
167
|
+
action: z.ZodOptional<z.ZodString>;
|
|
168
|
+
}, z.core.$strip>;
|
|
169
169
|
};
|
|
170
170
|
readonly TIMEOUT: {
|
|
171
171
|
readonly status: 504;
|
|
172
|
-
readonly data:
|
|
173
|
-
timeoutMs:
|
|
174
|
-
operation:
|
|
175
|
-
retryable:
|
|
176
|
-
},
|
|
172
|
+
readonly data: z.ZodObject<{
|
|
173
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
174
|
+
operation: z.ZodOptional<z.ZodString>;
|
|
175
|
+
retryable: z.ZodDefault<z.ZodBoolean>;
|
|
176
|
+
}, z.core.$strip>;
|
|
177
177
|
};
|
|
178
178
|
readonly CONNECTION_ERROR: {
|
|
179
179
|
readonly status: 502;
|
|
180
|
-
readonly data:
|
|
181
|
-
errorCode:
|
|
182
|
-
host:
|
|
183
|
-
port:
|
|
184
|
-
suggestion:
|
|
185
|
-
},
|
|
180
|
+
readonly data: z.ZodObject<{
|
|
181
|
+
errorCode: z.ZodOptional<z.ZodString>;
|
|
182
|
+
host: z.ZodOptional<z.ZodString>;
|
|
183
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
184
|
+
suggestion: z.ZodOptional<z.ZodString>;
|
|
185
|
+
}, z.core.$strip>;
|
|
186
186
|
};
|
|
187
187
|
};
|
|
188
188
|
/**
|
|
@@ -191,78 +191,78 @@ declare const PluginErrors: {
|
|
|
191
191
|
declare const CommonPluginErrors: {
|
|
192
192
|
readonly UNAUTHORIZED: {
|
|
193
193
|
readonly status: 401;
|
|
194
|
-
readonly data:
|
|
195
|
-
apiKeyProvided:
|
|
196
|
-
provider:
|
|
197
|
-
authType:
|
|
194
|
+
readonly data: z.ZodObject<{
|
|
195
|
+
apiKeyProvided: z.ZodBoolean;
|
|
196
|
+
provider: z.ZodOptional<z.ZodString>;
|
|
197
|
+
authType: z.ZodOptional<z.ZodEnum<{
|
|
198
198
|
apiKey: "apiKey";
|
|
199
199
|
oauth: "oauth";
|
|
200
200
|
token: "token";
|
|
201
201
|
}>>;
|
|
202
|
-
},
|
|
202
|
+
}, z.core.$strip>;
|
|
203
203
|
};
|
|
204
204
|
readonly RATE_LIMITED: {
|
|
205
205
|
readonly status: 429;
|
|
206
|
-
readonly data:
|
|
207
|
-
retryAfter:
|
|
208
|
-
remainingRequests:
|
|
209
|
-
resetTime:
|
|
210
|
-
limitType:
|
|
206
|
+
readonly data: z.ZodObject<{
|
|
207
|
+
retryAfter: z.ZodNumber;
|
|
208
|
+
remainingRequests: z.ZodOptional<z.ZodNumber>;
|
|
209
|
+
resetTime: z.ZodOptional<z.ZodString>;
|
|
210
|
+
limitType: z.ZodOptional<z.ZodEnum<{
|
|
211
211
|
requests: "requests";
|
|
212
212
|
tokens: "tokens";
|
|
213
213
|
bandwidth: "bandwidth";
|
|
214
214
|
}>>;
|
|
215
|
-
},
|
|
215
|
+
}, z.core.$strip>;
|
|
216
216
|
};
|
|
217
217
|
readonly SERVICE_UNAVAILABLE: {
|
|
218
218
|
readonly status: 503;
|
|
219
|
-
readonly data:
|
|
220
|
-
retryAfter:
|
|
221
|
-
maintenanceWindow:
|
|
222
|
-
estimatedUptime:
|
|
223
|
-
},
|
|
219
|
+
readonly data: z.ZodObject<{
|
|
220
|
+
retryAfter: z.ZodOptional<z.ZodNumber>;
|
|
221
|
+
maintenanceWindow: z.ZodDefault<z.ZodBoolean>;
|
|
222
|
+
estimatedUptime: z.ZodOptional<z.ZodString>;
|
|
223
|
+
}, z.core.$strip>;
|
|
224
224
|
};
|
|
225
225
|
readonly BAD_REQUEST: {
|
|
226
226
|
readonly status: 400;
|
|
227
|
-
readonly data:
|
|
228
|
-
invalidFields:
|
|
229
|
-
validationErrors:
|
|
230
|
-
field:
|
|
231
|
-
message:
|
|
232
|
-
code:
|
|
233
|
-
},
|
|
234
|
-
},
|
|
227
|
+
readonly data: z.ZodObject<{
|
|
228
|
+
invalidFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
229
|
+
validationErrors: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
230
|
+
field: z.ZodString;
|
|
231
|
+
message: z.ZodString;
|
|
232
|
+
code: z.ZodOptional<z.ZodString>;
|
|
233
|
+
}, z.core.$strip>>>;
|
|
234
|
+
}, z.core.$strip>;
|
|
235
235
|
};
|
|
236
236
|
readonly NOT_FOUND: {
|
|
237
237
|
readonly status: 404;
|
|
238
|
-
readonly data:
|
|
239
|
-
resource:
|
|
240
|
-
resourceId:
|
|
241
|
-
},
|
|
238
|
+
readonly data: z.ZodObject<{
|
|
239
|
+
resource: z.ZodOptional<z.ZodString>;
|
|
240
|
+
resourceId: z.ZodOptional<z.ZodString>;
|
|
241
|
+
}, z.core.$strip>;
|
|
242
242
|
};
|
|
243
243
|
readonly FORBIDDEN: {
|
|
244
244
|
readonly status: 403;
|
|
245
|
-
readonly data:
|
|
246
|
-
requiredPermissions:
|
|
247
|
-
action:
|
|
248
|
-
},
|
|
245
|
+
readonly data: z.ZodObject<{
|
|
246
|
+
requiredPermissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
247
|
+
action: z.ZodOptional<z.ZodString>;
|
|
248
|
+
}, z.core.$strip>;
|
|
249
249
|
};
|
|
250
250
|
readonly TIMEOUT: {
|
|
251
251
|
readonly status: 504;
|
|
252
|
-
readonly data:
|
|
253
|
-
timeoutMs:
|
|
254
|
-
operation:
|
|
255
|
-
retryable:
|
|
256
|
-
},
|
|
252
|
+
readonly data: z.ZodObject<{
|
|
253
|
+
timeoutMs: z.ZodOptional<z.ZodNumber>;
|
|
254
|
+
operation: z.ZodOptional<z.ZodString>;
|
|
255
|
+
retryable: z.ZodDefault<z.ZodBoolean>;
|
|
256
|
+
}, z.core.$strip>;
|
|
257
257
|
};
|
|
258
258
|
readonly CONNECTION_ERROR: {
|
|
259
259
|
readonly status: 502;
|
|
260
|
-
readonly data:
|
|
261
|
-
errorCode:
|
|
262
|
-
host:
|
|
263
|
-
port:
|
|
264
|
-
suggestion:
|
|
265
|
-
},
|
|
260
|
+
readonly data: z.ZodObject<{
|
|
261
|
+
errorCode: z.ZodOptional<z.ZodString>;
|
|
262
|
+
host: z.ZodOptional<z.ZodString>;
|
|
263
|
+
port: z.ZodOptional<z.ZodNumber>;
|
|
264
|
+
suggestion: z.ZodOptional<z.ZodString>;
|
|
265
|
+
}, z.core.$strip>;
|
|
266
266
|
};
|
|
267
267
|
};
|
|
268
268
|
//#endregion
|
package/dist/errors.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { z } from "./zod.mjs";
|
|
2
2
|
import { ModuleFederationError, PluginRuntimeError, ValidationError, extractFromFiberFailure, formatORPCError, isRetryableORPCCode, toPluginRuntimeError, wrapORPCError } from "./runtime/errors.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/errors.ts
|
|
@@ -47,10 +47,10 @@ const ERROR_PATTERNS = {
|
|
|
47
47
|
*/
|
|
48
48
|
const UNAUTHORIZED = {
|
|
49
49
|
status: 401,
|
|
50
|
-
data:
|
|
51
|
-
apiKeyProvided:
|
|
52
|
-
provider:
|
|
53
|
-
authType:
|
|
50
|
+
data: z.object({
|
|
51
|
+
apiKeyProvided: z.boolean(),
|
|
52
|
+
provider: z.string().optional(),
|
|
53
|
+
authType: z.enum([
|
|
54
54
|
"apiKey",
|
|
55
55
|
"oauth",
|
|
56
56
|
"token"
|
|
@@ -59,11 +59,11 @@ const UNAUTHORIZED = {
|
|
|
59
59
|
};
|
|
60
60
|
const RATE_LIMITED = {
|
|
61
61
|
status: 429,
|
|
62
|
-
data:
|
|
63
|
-
retryAfter:
|
|
64
|
-
remainingRequests:
|
|
65
|
-
resetTime:
|
|
66
|
-
limitType:
|
|
62
|
+
data: z.object({
|
|
63
|
+
retryAfter: z.number().int().min(1),
|
|
64
|
+
remainingRequests: z.number().int().min(0).optional(),
|
|
65
|
+
resetTime: z.string().datetime().optional(),
|
|
66
|
+
limitType: z.enum([
|
|
67
67
|
"requests",
|
|
68
68
|
"tokens",
|
|
69
69
|
"bandwidth"
|
|
@@ -72,52 +72,52 @@ const RATE_LIMITED = {
|
|
|
72
72
|
};
|
|
73
73
|
const SERVICE_UNAVAILABLE = {
|
|
74
74
|
status: 503,
|
|
75
|
-
data:
|
|
76
|
-
retryAfter:
|
|
77
|
-
maintenanceWindow:
|
|
78
|
-
estimatedUptime:
|
|
75
|
+
data: z.object({
|
|
76
|
+
retryAfter: z.number().int().optional(),
|
|
77
|
+
maintenanceWindow: z.boolean().default(false),
|
|
78
|
+
estimatedUptime: z.string().datetime().optional()
|
|
79
79
|
})
|
|
80
80
|
};
|
|
81
81
|
const BAD_REQUEST = {
|
|
82
82
|
status: 400,
|
|
83
|
-
data:
|
|
84
|
-
invalidFields:
|
|
85
|
-
validationErrors:
|
|
86
|
-
field:
|
|
87
|
-
message:
|
|
88
|
-
code:
|
|
83
|
+
data: z.object({
|
|
84
|
+
invalidFields: z.array(z.string()).optional(),
|
|
85
|
+
validationErrors: z.array(z.object({
|
|
86
|
+
field: z.string(),
|
|
87
|
+
message: z.string(),
|
|
88
|
+
code: z.string().optional()
|
|
89
89
|
})).optional()
|
|
90
90
|
})
|
|
91
91
|
};
|
|
92
92
|
const NOT_FOUND = {
|
|
93
93
|
status: 404,
|
|
94
|
-
data:
|
|
95
|
-
resource:
|
|
96
|
-
resourceId:
|
|
94
|
+
data: z.object({
|
|
95
|
+
resource: z.string().optional(),
|
|
96
|
+
resourceId: z.string().optional()
|
|
97
97
|
})
|
|
98
98
|
};
|
|
99
99
|
const FORBIDDEN = {
|
|
100
100
|
status: 403,
|
|
101
|
-
data:
|
|
102
|
-
requiredPermissions:
|
|
103
|
-
action:
|
|
101
|
+
data: z.object({
|
|
102
|
+
requiredPermissions: z.array(z.string()).optional(),
|
|
103
|
+
action: z.string().optional()
|
|
104
104
|
})
|
|
105
105
|
};
|
|
106
106
|
const TIMEOUT = {
|
|
107
107
|
status: 504,
|
|
108
|
-
data:
|
|
109
|
-
timeoutMs:
|
|
110
|
-
operation:
|
|
111
|
-
retryable:
|
|
108
|
+
data: z.object({
|
|
109
|
+
timeoutMs: z.number().int().min(0).optional(),
|
|
110
|
+
operation: z.string().optional(),
|
|
111
|
+
retryable: z.boolean().default(true)
|
|
112
112
|
})
|
|
113
113
|
};
|
|
114
114
|
const CONNECTION_ERROR = {
|
|
115
115
|
status: 502,
|
|
116
|
-
data:
|
|
117
|
-
errorCode:
|
|
118
|
-
host:
|
|
119
|
-
port:
|
|
120
|
-
suggestion:
|
|
116
|
+
data: z.object({
|
|
117
|
+
errorCode: z.string().optional(),
|
|
118
|
+
host: z.string().optional(),
|
|
119
|
+
port: z.number().int().optional(),
|
|
120
|
+
suggestion: z.string().optional()
|
|
121
121
|
})
|
|
122
122
|
};
|
|
123
123
|
/**
|
package/dist/errors.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.mjs","names":[
|
|
1
|
+
{"version":3,"file":"errors.mjs","names":[],"sources":["../src/errors.ts"],"sourcesContent":["import { z } from \"./zod\";\n\n/**\n * Error pattern constants for categorizing infrastructure errors\n */\nexport const ERROR_PATTERNS = {\n CONNECTION_REFUSED: [\"ECONNREFUSED\"],\n HOST_NOT_FOUND: [\"ENOTFOUND\", \"EHOSTUNREACH\"],\n TIMEOUT: [\"ETIMEDOUT\", \"ESOCKETTIMEDOUT\", \"timeout\"],\n CONNECTION_RESET: [\"ECONNRESET\", \"EPIPE\"],\n PERMISSION: [\"EACCES\", \"EPERM\", \"permission denied\"],\n AUTH: [\"401\", \"unauthorized\", \"authentication failed\"],\n RATE_LIMITED: [\"429\", \"too many requests\", \"rate limit\"],\n SERVICE_UNAVAILABLE: [\"503\", \"service unavailable\"],\n} as const;\n\n/**\n * Common error schemas for plugin contracts.\n * Import individually or use the grouped PluginErrors export.\n *\n * @example\n * ```typescript\n * import { NOT_FOUND, FORBIDDEN, UNAUTHORIZED } from \"every-plugin/errors\";\n *\n * export const contract = oc.router({\n * getData: oc.route(...)\n * .errors({ NOT_FOUND, FORBIDDEN, UNAUTHORIZED })\n * });\n * ```\n */\n\nexport const UNAUTHORIZED = {\n status: 401,\n data: z.object({\n apiKeyProvided: z.boolean(),\n provider: z.string().optional(),\n authType: z.enum([\"apiKey\", \"oauth\", \"token\"]).optional(),\n }),\n} as const;\n\nexport const RATE_LIMITED = {\n status: 429,\n data: z.object({\n retryAfter: z.number().int().min(1),\n remainingRequests: z.number().int().min(0).optional(),\n resetTime: z.string().datetime().optional(),\n limitType: z.enum([\"requests\", \"tokens\", \"bandwidth\"]).optional(),\n }),\n} as const;\n\nexport const SERVICE_UNAVAILABLE = {\n status: 503,\n data: z.object({\n retryAfter: z.number().int().optional(),\n maintenanceWindow: z.boolean().default(false),\n estimatedUptime: z.string().datetime().optional(),\n }),\n} as const;\n\nexport const BAD_REQUEST = {\n status: 400,\n data: z.object({\n invalidFields: z.array(z.string()).optional(),\n validationErrors: z\n .array(\n z.object({\n field: z.string(),\n message: z.string(),\n code: z.string().optional(),\n }),\n )\n .optional(),\n }),\n} as const;\n\nexport const NOT_FOUND = {\n status: 404,\n data: z.object({\n resource: z.string().optional(),\n resourceId: z.string().optional(),\n }),\n} as const;\n\nexport const FORBIDDEN = {\n status: 403,\n data: z.object({\n requiredPermissions: z.array(z.string()).optional(),\n action: z.string().optional(),\n }),\n} as const;\n\nexport const TIMEOUT = {\n status: 504,\n data: z.object({\n timeoutMs: z.number().int().min(0).optional(),\n operation: z.string().optional(),\n retryable: z.boolean().default(true),\n }),\n} as const;\n\nexport const CONNECTION_ERROR = {\n status: 502,\n data: z.object({\n errorCode: z.string().optional(),\n host: z.string().optional(),\n port: z.number().int().optional(),\n suggestion: z.string().optional(),\n }),\n} as const;\n\n/**\n * Grouped export for all plugin errors.\n * Use individual imports for cleaner code.\n */\nexport const PluginErrors = {\n UNAUTHORIZED,\n RATE_LIMITED,\n SERVICE_UNAVAILABLE,\n BAD_REQUEST,\n NOT_FOUND,\n FORBIDDEN,\n TIMEOUT,\n CONNECTION_ERROR,\n} as const;\n\n/**\n * @deprecated Use individual imports or PluginErrors instead\n */\nexport const CommonPluginErrors = PluginErrors;\n\nexport {\n extractFromFiberFailure,\n formatORPCError,\n isRetryableORPCCode,\n ModuleFederationError,\n PluginRuntimeError,\n toPluginRuntimeError,\n ValidationError,\n wrapORPCError,\n} from \"./runtime/errors\";\n"],"mappings":";;;;;;;AAKA,MAAa,iBAAiB;CAC5B,oBAAoB,CAAC,eAAe;CACpC,gBAAgB,CAAC,aAAa,eAAe;CAC7C,SAAS;EAAC;EAAa;EAAmB;EAAU;CACpD,kBAAkB,CAAC,cAAc,QAAQ;CACzC,YAAY;EAAC;EAAU;EAAS;EAAoB;CACpD,MAAM;EAAC;EAAO;EAAgB;EAAwB;CACtD,cAAc;EAAC;EAAO;EAAqB;EAAa;CACxD,qBAAqB,CAAC,OAAO,sBAAsB;CACpD;;;;;;;;;;;;;;;AAiBD,MAAa,eAAe;CAC1B,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,gBAAgB,EAAE,SAAS;EAC3B,UAAU,EAAE,QAAQ,CAAC,UAAU;EAC/B,UAAU,EAAE,KAAK;GAAC;GAAU;GAAS;GAAQ,CAAC,CAAC,UAAU;EAC1D,CAAC;CACH;AAED,MAAa,eAAe;CAC1B,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE;EACnC,mBAAmB,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU;EACrD,WAAW,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;EAC3C,WAAW,EAAE,KAAK;GAAC;GAAY;GAAU;GAAY,CAAC,CAAC,UAAU;EAClE,CAAC;CACH;AAED,MAAa,sBAAsB;CACjC,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,YAAY,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;EACvC,mBAAmB,EAAE,SAAS,CAAC,QAAQ,MAAM;EAC7C,iBAAiB,EAAE,QAAQ,CAAC,UAAU,CAAC,UAAU;EAClD,CAAC;CACH;AAED,MAAa,cAAc;CACzB,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,eAAe,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;EAC7C,kBAAkB,EACf,MACC,EAAE,OAAO;GACP,OAAO,EAAE,QAAQ;GACjB,SAAS,EAAE,QAAQ;GACnB,MAAM,EAAE,QAAQ,CAAC,UAAU;GAC5B,CAAC,CACH,CACA,UAAU;EACd,CAAC;CACH;AAED,MAAa,YAAY;CACvB,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,UAAU,EAAE,QAAQ,CAAC,UAAU;EAC/B,YAAY,EAAE,QAAQ,CAAC,UAAU;EAClC,CAAC;CACH;AAED,MAAa,YAAY;CACvB,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,qBAAqB,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC,UAAU;EACnD,QAAQ,EAAE,QAAQ,CAAC,UAAU;EAC9B,CAAC;CACH;AAED,MAAa,UAAU;CACrB,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,UAAU;EAC7C,WAAW,EAAE,QAAQ,CAAC,UAAU;EAChC,WAAW,EAAE,SAAS,CAAC,QAAQ,KAAK;EACrC,CAAC;CACH;AAED,MAAa,mBAAmB;CAC9B,QAAQ;CACR,MAAM,EAAE,OAAO;EACb,WAAW,EAAE,QAAQ,CAAC,UAAU;EAChC,MAAM,EAAE,QAAQ,CAAC,UAAU;EAC3B,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,UAAU;EACjC,YAAY,EAAE,QAAQ,CAAC,UAAU;EAClC,CAAC;CACH;;;;;AAMD,MAAa,eAAe;CAC1B;CACA;CACA;CACA;CACA;CACA;CACA;CACA;CACD;;;;AAKD,MAAa,qBAAqB"}
|
package/dist/plugin.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.cjs","names":["Effect","extractFromFiberFailure","ORPCError"],"sources":["../src/plugin.ts"],"sourcesContent":["import type { AnyContractRouter, AnySchema, InferSchemaOutput } from \"@orpc/contract\";\nimport { ORPCError } from \"@orpc/contract\";\nimport type { Context, Implementer, Router } from \"@orpc/server\";\nimport { implement, onError } from \"@orpc/server\";\nimport { Effect, type Scope } from \"effect\";\nimport { extractFromFiberFailure, formatORPCError } from \"./runtime/errors\";\n\ntype ContextOutput<T> = T extends AnySchema ? InferSchemaOutput<T> : Record<string, never>;\n\nexport type PluginConfigFor<\n V extends AnySchema,\n S extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n> = {\n variables: V;\n secrets: S;\n context: TRequestContext;\n};\n\ntype PluginInitializeInput<V extends AnySchema, S extends AnySchema> = {\n variables: InferSchemaOutput<V>;\n secrets: InferSchemaOutput<S>;\n};\n\ntype PluginDefinition<\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context,\n P extends Record<string, unknown>,\n> = {\n variables: V;\n secrets: S;\n contract: TContract;\n context?: TRequestContext;\n initialize?: (\n config: PluginInitializeInput<V, S>,\n plugins: P,\n ) => Effect.Effect<TDeps, Error, Scope.Scope>;\n createRouter: (\n deps: TDeps,\n builder: Implementer<TContract, ContextOutput<TRequestContext>, ContextOutput<TRequestContext>>,\n ) => Router<TContract, any>;\n shutdown?: (deps: TDeps) => Effect.Effect<void, Error, never>;\n};\n\n/**\n * Loaded plugin with static binding property\n */\nexport interface LoadedPluginWithBinding<\n TContract extends AnyContractRouter,\n TVariables extends AnySchema,\n TSecrets extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context = Record<never, never>,\n> {\n new (): Plugin<TContract, TVariables, TSecrets, TRequestContext, TDeps>;\n binding: {\n contract: TContract;\n variables: TVariables;\n secrets: TSecrets;\n context: TRequestContext;\n };\n}\n\n/**\n * Plugin interface\n */\nexport interface Plugin<\n TContract extends AnyContractRouter,\n TVariables extends AnySchema,\n TSecrets extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context = Record<never, never>,\n> {\n readonly id: string;\n readonly contract: TContract;\n readonly configSchema: PluginConfigFor<TVariables, TSecrets, TRequestContext>;\n\n initialize(\n config: PluginInitializeInput<TVariables, TSecrets>,\n plugins: Record<string, unknown>,\n ): Effect.Effect<TDeps, unknown, Scope.Scope>;\n\n shutdown(): Effect.Effect<void, never>;\n\n /**\n * Creates the strongly-typed oRPC router for this plugin.\n * The router's procedure types are inferred directly from the contract.\n * @param deps The initialized plugin dependencies\n * @returns A router with procedures matching the plugin's contract\n */\n createRouter(deps: TDeps): Router<TContract, any>;\n}\n\nexport interface CreatePluginFn {\n <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n P extends Record<string, unknown> = Record<string, never>,\n >(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n ): LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\n\n withPlugins: <P extends Record<string, unknown>>() => CreatePluginWithPlugins<P>;\n}\n\nexport const createPlugin: CreatePluginFn = function createPlugin<\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n P extends Record<string, unknown> = Record<string, never>,\n>(config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>) {\n const configSchema: PluginConfigFor<V, S, TRequestContext> = {\n variables: config.variables,\n secrets: config.secrets,\n context: config.context as TRequestContext,\n };\n\n class CreatedPlugin implements Plugin<TContract, V, S, TRequestContext, TDeps> {\n /** set during instantiation - registry key */\n id!: string;\n readonly contract = config.contract;\n readonly configSchema = configSchema;\n\n private _deps: TDeps | null = null;\n\n initialize(\n pluginConfig: PluginInitializeInput<V, S>,\n plugins: Record<string, unknown> = {},\n ): Effect.Effect<TDeps, unknown, Scope.Scope> {\n const init = config.initialize ?? (() => Effect.succeed({} as TDeps));\n\n return init(pluginConfig, plugins as P).pipe(\n Effect.tap((deps) =>\n Effect.sync(() => {\n this._deps = deps;\n }),\n ),\n Effect.map(() => this._deps as TDeps),\n Effect.mapError((error) => error as unknown),\n );\n }\n\n shutdown(): Effect.Effect<void, never> {\n const self = this;\n return Effect.gen(function* () {\n if (config.shutdown && self._deps) {\n yield* config\n .shutdown(self._deps)\n .pipe(\n Effect.catchAll((error) =>\n Effect.logWarning(`Plugin shutdown hook failed for ${self.id}`, error),\n ),\n );\n }\n self._deps = null;\n });\n }\n\n createRouter(deps: TDeps): Router<TContract, any> {\n const base = implement(config.contract).$context<ContextOutput<TRequestContext>>();\n const errorMiddleware = onError((error: unknown) => {\n const unwrapped = extractFromFiberFailure(error);\n\n if (unwrapped !== error && unwrapped instanceof ORPCError) {\n throw unwrapped;\n }\n\n formatORPCError(error);\n throw error;\n }) as any;\n\n const builder = (base as any).use(errorMiddleware);\n const router = config.createRouter(deps, builder as any);\n return router as Router<TContract, any>;\n }\n }\n\n const PluginConstructor = CreatedPlugin as unknown as {\n new (): Plugin<TContract, V, S, TRequestContext, TDeps>;\n binding: {\n contract: TContract;\n variables: V;\n secrets: S;\n context: TRequestContext;\n };\n };\n\n PluginConstructor.binding = {\n contract: config.contract,\n variables: config.variables,\n secrets: config.secrets,\n context: config.context as TRequestContext,\n };\n\n return PluginConstructor as LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\n};\n\nexport type CreatePluginWithPlugins<P extends Record<string, unknown>> = <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n>(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n) => LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\n\nexport function withPlugins<P extends Record<string, unknown>>(): CreatePluginWithPlugins<P> {\n return <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n >(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n ) => createPlugin<V, S, TContract, TRequestContext, TDeps, P>(config as any);\n}\n\ncreatePlugin.withPlugins = withPlugins;\n"],"mappings":";;;;;;;AA+GA,MAAa,eAA+B,SAAS,aAOnD,QAAsE;CACtE,MAAM,eAAuD;EAC3D,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,SAAS,OAAO;EACjB;CAED,MAAM,cAAyE;;EAE7E;EACA,AAAS,WAAW,OAAO;EAC3B,AAAS,eAAe;EAExB,AAAQ,QAAsB;EAE9B,WACE,cACA,UAAmC,EAAE,EACO;AAG5C,WAFa,OAAO,qBAAqBA,cAAO,QAAQ,EAAE,CAAU,GAExD,cAAc,QAAa,CAAC,KACtCA,cAAO,KAAK,SACVA,cAAO,WAAW;AAChB,SAAK,QAAQ;KACb,CACH,EACDA,cAAO,UAAU,KAAK,MAAe,EACrCA,cAAO,UAAU,UAAU,MAAiB,CAC7C;;EAGH,WAAuC;GACrC,MAAM,OAAO;AACb,UAAOA,cAAO,IAAI,aAAa;AAC7B,QAAI,OAAO,YAAY,KAAK,MAC1B,QAAO,OACJ,SAAS,KAAK,MAAM,CACpB,KACCA,cAAO,UAAU,UACfA,cAAO,WAAW,mCAAmC,KAAK,MAAM,MAAM,CACvE,CACF;AAEL,SAAK,QAAQ;KACb;;EAGJ,aAAa,MAAqC;GAChD,MAAM,mCAAiB,OAAO,SAAS,CAAC,UAA0C;GAClF,MAAM,6CAA2B,UAAmB;IAClD,MAAM,YAAYC,uCAAwB,MAAM;AAEhD,QAAI,cAAc,SAAS,qBAAqBC,yBAC9C,OAAM;AAGR,mCAAgB,MAAM;AACtB,UAAM;KACN;GAEF,MAAM,UAAW,KAAa,IAAI,gBAAgB;AAElD,UADe,OAAO,aAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"plugin.cjs","names":["Effect","extractFromFiberFailure","ORPCError"],"sources":["../src/plugin.ts"],"sourcesContent":["import type { AnyContractRouter, AnySchema, InferSchemaOutput } from \"@orpc/contract\";\nimport { ORPCError } from \"@orpc/contract\";\nimport type { Context, Implementer, Router } from \"@orpc/server\";\nimport { implement, onError } from \"@orpc/server\";\nimport { Effect, type Scope } from \"effect\";\nimport { extractFromFiberFailure, formatORPCError } from \"./runtime/errors\";\n\ntype ContextOutput<T> = T extends AnySchema ? InferSchemaOutput<T> : Record<string, never>;\n\nexport type PluginConfigFor<\n V extends AnySchema,\n S extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n> = {\n variables: V;\n secrets: S;\n context: TRequestContext;\n};\n\ntype PluginInitializeInput<V extends AnySchema, S extends AnySchema> = {\n variables: InferSchemaOutput<V>;\n secrets: InferSchemaOutput<S>;\n};\n\ntype PluginDefinition<\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context,\n P extends Record<string, unknown>,\n> = {\n variables: V;\n secrets: S;\n contract: TContract;\n context?: TRequestContext;\n initialize?: (\n config: PluginInitializeInput<V, S>,\n plugins: P,\n ) => Effect.Effect<TDeps, Error, Scope.Scope>;\n createRouter: (\n deps: TDeps,\n builder: Implementer<TContract, ContextOutput<TRequestContext>, ContextOutput<TRequestContext>>,\n ) => Router<TContract, any>;\n shutdown?: (deps: TDeps) => Effect.Effect<void, Error, never>;\n};\n\n/**\n * Loaded plugin with static binding property\n */\nexport interface LoadedPluginWithBinding<\n TContract extends AnyContractRouter,\n TVariables extends AnySchema,\n TSecrets extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context = Record<never, never>,\n> {\n new (): Plugin<TContract, TVariables, TSecrets, TRequestContext, TDeps>;\n binding: {\n contract: TContract;\n variables: TVariables;\n secrets: TSecrets;\n context: TRequestContext;\n };\n}\n\n/**\n * Plugin interface\n */\nexport interface Plugin<\n TContract extends AnyContractRouter,\n TVariables extends AnySchema,\n TSecrets extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context = Record<never, never>,\n> {\n readonly id: string;\n readonly contract: TContract;\n readonly configSchema: PluginConfigFor<TVariables, TSecrets, TRequestContext>;\n\n initialize(\n config: PluginInitializeInput<TVariables, TSecrets>,\n plugins: Record<string, unknown>,\n ): Effect.Effect<TDeps, unknown, Scope.Scope>;\n\n shutdown(): Effect.Effect<void, never>;\n\n /**\n * Creates the strongly-typed oRPC router for this plugin.\n * The router's procedure types are inferred directly from the contract.\n * @param deps The initialized plugin dependencies\n * @returns A router with procedures matching the plugin's contract\n */\n createRouter(deps: TDeps): Router<TContract, any>;\n}\n\nexport interface CreatePluginFn {\n <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n P extends Record<string, unknown> = Record<string, never>,\n >(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n ): LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\n\n withPlugins: <P extends Record<string, unknown>>() => CreatePluginWithPlugins<P>;\n}\n\nexport const createPlugin: CreatePluginFn = function createPlugin<\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n P extends Record<string, unknown> = Record<string, never>,\n>(config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>) {\n const configSchema: PluginConfigFor<V, S, TRequestContext> = {\n variables: config.variables,\n secrets: config.secrets,\n context: config.context as TRequestContext,\n };\n\n class CreatedPlugin implements Plugin<TContract, V, S, TRequestContext, TDeps> {\n /** set during instantiation - registry key */\n id!: string;\n readonly contract = config.contract;\n readonly configSchema = configSchema;\n\n private _deps: TDeps | null = null;\n\n initialize(\n pluginConfig: PluginInitializeInput<V, S>,\n plugins: Record<string, unknown> = {},\n ): Effect.Effect<TDeps, unknown, Scope.Scope> {\n const init = config.initialize ?? (() => Effect.succeed({} as TDeps));\n\n return init(pluginConfig, plugins as P).pipe(\n Effect.tap((deps) =>\n Effect.sync(() => {\n this._deps = deps;\n }),\n ),\n Effect.map(() => this._deps as TDeps),\n Effect.mapError((error) => error as unknown),\n );\n }\n\n shutdown(): Effect.Effect<void, never> {\n const self = this;\n return Effect.gen(function* () {\n if (config.shutdown && self._deps) {\n yield* config\n .shutdown(self._deps)\n .pipe(\n Effect.catchAll((error) =>\n Effect.logWarning(`Plugin shutdown hook failed for ${self.id}`, error),\n ),\n );\n }\n self._deps = null;\n });\n }\n\n createRouter(deps: TDeps): Router<TContract, any> {\n const base = implement(config.contract).$context<ContextOutput<TRequestContext>>();\n const errorMiddleware = onError((error: unknown) => {\n const unwrapped = extractFromFiberFailure(error);\n\n if (unwrapped !== error && unwrapped instanceof ORPCError) {\n throw unwrapped;\n }\n\n formatORPCError(error);\n throw error;\n }) as any;\n\n const builder = (base as any).use(errorMiddleware);\n const router = config.createRouter(deps, builder as any);\n return router as Router<TContract, any>;\n }\n }\n\n const PluginConstructor = CreatedPlugin as unknown as {\n new (): Plugin<TContract, V, S, TRequestContext, TDeps>;\n binding: {\n contract: TContract;\n variables: V;\n secrets: S;\n context: TRequestContext;\n };\n };\n\n PluginConstructor.binding = {\n contract: config.contract,\n variables: config.variables,\n secrets: config.secrets,\n context: config.context as TRequestContext,\n };\n\n return PluginConstructor as LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\n};\n\nexport type CreatePluginWithPlugins<P extends Record<string, unknown>> = <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n>(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n) => LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\n\nexport function withPlugins<P extends Record<string, unknown>>(): CreatePluginWithPlugins<P> {\n return <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n >(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n ) => createPlugin<V, S, TContract, TRequestContext, TDeps, P>(config as any);\n}\n\ncreatePlugin.withPlugins = withPlugins;\n"],"mappings":";;;;;;;AA+GA,MAAa,eAA+B,SAAS,aAOnD,QAAsE;CACtE,MAAM,eAAuD;EAC3D,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,SAAS,OAAO;EACjB;CAED,MAAM,cAAyE;;EAE7E;EACA,AAAS,WAAW,OAAO;EAC3B,AAAS,eAAe;EAExB,AAAQ,QAAsB;EAE9B,WACE,cACA,UAAmC,EAAE,EACO;AAG5C,WAFa,OAAO,qBAAqBA,cAAO,QAAQ,EAAE,CAAU,GAExD,cAAc,QAAa,CAAC,KACtCA,cAAO,KAAK,SACVA,cAAO,WAAW;AAChB,SAAK,QAAQ;KACb,CACH,EACDA,cAAO,UAAU,KAAK,MAAe,EACrCA,cAAO,UAAU,UAAU,MAAiB,CAC7C;;EAGH,WAAuC;GACrC,MAAM,OAAO;AACb,UAAOA,cAAO,IAAI,aAAa;AAC7B,QAAI,OAAO,YAAY,KAAK,MAC1B,QAAO,OACJ,SAAS,KAAK,MAAM,CACpB,KACCA,cAAO,UAAU,UACfA,cAAO,WAAW,mCAAmC,KAAK,MAAM,MAAM,CACvE,CACF;AAEL,SAAK,QAAQ;KACb;;EAGJ,aAAa,MAAqC;GAChD,MAAM,mCAAiB,OAAO,SAAS,CAAC,UAA0C;GAClF,MAAM,6CAA2B,UAAmB;IAClD,MAAM,YAAYC,uCAAwB,MAAM;AAEhD,QAAI,cAAc,SAAS,qBAAqBC,yBAC9C,OAAM;AAGR,mCAAgB,MAAM;AACtB,UAAM;KACN;GAEF,MAAM,UAAW,KAAa,IAAI,gBAAgB;AAElD,UADe,OAAO,aAAa,MAAM,QAC5B;;;CAIjB,MAAM,oBAAoB;AAU1B,mBAAkB,UAAU;EAC1B,UAAU,OAAO;EACjB,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,SAAS,OAAO;EACjB;AAED,QAAO;;AAaT,SAAgB,cAA6E;AAC3F,SAOE,WACG,aAAyD,OAAc;;AAG9E,aAAa,cAAc"}
|
package/dist/plugin.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.mjs","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import type { AnyContractRouter, AnySchema, InferSchemaOutput } from \"@orpc/contract\";\nimport { ORPCError } from \"@orpc/contract\";\nimport type { Context, Implementer, Router } from \"@orpc/server\";\nimport { implement, onError } from \"@orpc/server\";\nimport { Effect, type Scope } from \"effect\";\nimport { extractFromFiberFailure, formatORPCError } from \"./runtime/errors\";\n\ntype ContextOutput<T> = T extends AnySchema ? InferSchemaOutput<T> : Record<string, never>;\n\nexport type PluginConfigFor<\n V extends AnySchema,\n S extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n> = {\n variables: V;\n secrets: S;\n context: TRequestContext;\n};\n\ntype PluginInitializeInput<V extends AnySchema, S extends AnySchema> = {\n variables: InferSchemaOutput<V>;\n secrets: InferSchemaOutput<S>;\n};\n\ntype PluginDefinition<\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context,\n P extends Record<string, unknown>,\n> = {\n variables: V;\n secrets: S;\n contract: TContract;\n context?: TRequestContext;\n initialize?: (\n config: PluginInitializeInput<V, S>,\n plugins: P,\n ) => Effect.Effect<TDeps, Error, Scope.Scope>;\n createRouter: (\n deps: TDeps,\n builder: Implementer<TContract, ContextOutput<TRequestContext>, ContextOutput<TRequestContext>>,\n ) => Router<TContract, any>;\n shutdown?: (deps: TDeps) => Effect.Effect<void, Error, never>;\n};\n\n/**\n * Loaded plugin with static binding property\n */\nexport interface LoadedPluginWithBinding<\n TContract extends AnyContractRouter,\n TVariables extends AnySchema,\n TSecrets extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context = Record<never, never>,\n> {\n new (): Plugin<TContract, TVariables, TSecrets, TRequestContext, TDeps>;\n binding: {\n contract: TContract;\n variables: TVariables;\n secrets: TSecrets;\n context: TRequestContext;\n };\n}\n\n/**\n * Plugin interface\n */\nexport interface Plugin<\n TContract extends AnyContractRouter,\n TVariables extends AnySchema,\n TSecrets extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context = Record<never, never>,\n> {\n readonly id: string;\n readonly contract: TContract;\n readonly configSchema: PluginConfigFor<TVariables, TSecrets, TRequestContext>;\n\n initialize(\n config: PluginInitializeInput<TVariables, TSecrets>,\n plugins: Record<string, unknown>,\n ): Effect.Effect<TDeps, unknown, Scope.Scope>;\n\n shutdown(): Effect.Effect<void, never>;\n\n /**\n * Creates the strongly-typed oRPC router for this plugin.\n * The router's procedure types are inferred directly from the contract.\n * @param deps The initialized plugin dependencies\n * @returns A router with procedures matching the plugin's contract\n */\n createRouter(deps: TDeps): Router<TContract, any>;\n}\n\nexport interface CreatePluginFn {\n <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n P extends Record<string, unknown> = Record<string, never>,\n >(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n ): LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\n\n withPlugins: <P extends Record<string, unknown>>() => CreatePluginWithPlugins<P>;\n}\n\nexport const createPlugin: CreatePluginFn = function createPlugin<\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n P extends Record<string, unknown> = Record<string, never>,\n>(config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>) {\n const configSchema: PluginConfigFor<V, S, TRequestContext> = {\n variables: config.variables,\n secrets: config.secrets,\n context: config.context as TRequestContext,\n };\n\n class CreatedPlugin implements Plugin<TContract, V, S, TRequestContext, TDeps> {\n /** set during instantiation - registry key */\n id!: string;\n readonly contract = config.contract;\n readonly configSchema = configSchema;\n\n private _deps: TDeps | null = null;\n\n initialize(\n pluginConfig: PluginInitializeInput<V, S>,\n plugins: Record<string, unknown> = {},\n ): Effect.Effect<TDeps, unknown, Scope.Scope> {\n const init = config.initialize ?? (() => Effect.succeed({} as TDeps));\n\n return init(pluginConfig, plugins as P).pipe(\n Effect.tap((deps) =>\n Effect.sync(() => {\n this._deps = deps;\n }),\n ),\n Effect.map(() => this._deps as TDeps),\n Effect.mapError((error) => error as unknown),\n );\n }\n\n shutdown(): Effect.Effect<void, never> {\n const self = this;\n return Effect.gen(function* () {\n if (config.shutdown && self._deps) {\n yield* config\n .shutdown(self._deps)\n .pipe(\n Effect.catchAll((error) =>\n Effect.logWarning(`Plugin shutdown hook failed for ${self.id}`, error),\n ),\n );\n }\n self._deps = null;\n });\n }\n\n createRouter(deps: TDeps): Router<TContract, any> {\n const base = implement(config.contract).$context<ContextOutput<TRequestContext>>();\n const errorMiddleware = onError((error: unknown) => {\n const unwrapped = extractFromFiberFailure(error);\n\n if (unwrapped !== error && unwrapped instanceof ORPCError) {\n throw unwrapped;\n }\n\n formatORPCError(error);\n throw error;\n }) as any;\n\n const builder = (base as any).use(errorMiddleware);\n const router = config.createRouter(deps, builder as any);\n return router as Router<TContract, any>;\n }\n }\n\n const PluginConstructor = CreatedPlugin as unknown as {\n new (): Plugin<TContract, V, S, TRequestContext, TDeps>;\n binding: {\n contract: TContract;\n variables: V;\n secrets: S;\n context: TRequestContext;\n };\n };\n\n PluginConstructor.binding = {\n contract: config.contract,\n variables: config.variables,\n secrets: config.secrets,\n context: config.context as TRequestContext,\n };\n\n return PluginConstructor as LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\n};\n\nexport type CreatePluginWithPlugins<P extends Record<string, unknown>> = <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n>(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n) => LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\n\nexport function withPlugins<P extends Record<string, unknown>>(): CreatePluginWithPlugins<P> {\n return <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n >(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n ) => createPlugin<V, S, TContract, TRequestContext, TDeps, P>(config as any);\n}\n\ncreatePlugin.withPlugins = withPlugins;\n"],"mappings":";;;;;;AA+GA,MAAa,eAA+B,SAAS,aAOnD,QAAsE;CACtE,MAAM,eAAuD;EAC3D,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,SAAS,OAAO;EACjB;CAED,MAAM,cAAyE;;EAE7E;EACA,AAAS,WAAW,OAAO;EAC3B,AAAS,eAAe;EAExB,AAAQ,QAAsB;EAE9B,WACE,cACA,UAAmC,EAAE,EACO;AAG5C,WAFa,OAAO,qBAAqB,OAAO,QAAQ,EAAE,CAAU,GAExD,cAAc,QAAa,CAAC,KACtC,OAAO,KAAK,SACV,OAAO,WAAW;AAChB,SAAK,QAAQ;KACb,CACH,EACD,OAAO,UAAU,KAAK,MAAe,EACrC,OAAO,UAAU,UAAU,MAAiB,CAC7C;;EAGH,WAAuC;GACrC,MAAM,OAAO;AACb,UAAO,OAAO,IAAI,aAAa;AAC7B,QAAI,OAAO,YAAY,KAAK,MAC1B,QAAO,OACJ,SAAS,KAAK,MAAM,CACpB,KACC,OAAO,UAAU,UACf,OAAO,WAAW,mCAAmC,KAAK,MAAM,MAAM,CACvE,CACF;AAEL,SAAK,QAAQ;KACb;;EAGJ,aAAa,MAAqC;GAChD,MAAM,OAAO,UAAU,OAAO,SAAS,CAAC,UAA0C;GAClF,MAAM,kBAAkB,SAAS,UAAmB;IAClD,MAAM,YAAY,wBAAwB,MAAM;AAEhD,QAAI,cAAc,SAAS,qBAAqB,UAC9C,OAAM;AAGR,oBAAgB,MAAM;AACtB,UAAM;KACN;GAEF,MAAM,UAAW,KAAa,IAAI,gBAAgB;AAElD,UADe,OAAO,aAAa,MAAM,
|
|
1
|
+
{"version":3,"file":"plugin.mjs","names":[],"sources":["../src/plugin.ts"],"sourcesContent":["import type { AnyContractRouter, AnySchema, InferSchemaOutput } from \"@orpc/contract\";\nimport { ORPCError } from \"@orpc/contract\";\nimport type { Context, Implementer, Router } from \"@orpc/server\";\nimport { implement, onError } from \"@orpc/server\";\nimport { Effect, type Scope } from \"effect\";\nimport { extractFromFiberFailure, formatORPCError } from \"./runtime/errors\";\n\ntype ContextOutput<T> = T extends AnySchema ? InferSchemaOutput<T> : Record<string, never>;\n\nexport type PluginConfigFor<\n V extends AnySchema,\n S extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n> = {\n variables: V;\n secrets: S;\n context: TRequestContext;\n};\n\ntype PluginInitializeInput<V extends AnySchema, S extends AnySchema> = {\n variables: InferSchemaOutput<V>;\n secrets: InferSchemaOutput<S>;\n};\n\ntype PluginDefinition<\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context,\n P extends Record<string, unknown>,\n> = {\n variables: V;\n secrets: S;\n contract: TContract;\n context?: TRequestContext;\n initialize?: (\n config: PluginInitializeInput<V, S>,\n plugins: P,\n ) => Effect.Effect<TDeps, Error, Scope.Scope>;\n createRouter: (\n deps: TDeps,\n builder: Implementer<TContract, ContextOutput<TRequestContext>, ContextOutput<TRequestContext>>,\n ) => Router<TContract, any>;\n shutdown?: (deps: TDeps) => Effect.Effect<void, Error, never>;\n};\n\n/**\n * Loaded plugin with static binding property\n */\nexport interface LoadedPluginWithBinding<\n TContract extends AnyContractRouter,\n TVariables extends AnySchema,\n TSecrets extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context = Record<never, never>,\n> {\n new (): Plugin<TContract, TVariables, TSecrets, TRequestContext, TDeps>;\n binding: {\n contract: TContract;\n variables: TVariables;\n secrets: TSecrets;\n context: TRequestContext;\n };\n}\n\n/**\n * Plugin interface\n */\nexport interface Plugin<\n TContract extends AnyContractRouter,\n TVariables extends AnySchema,\n TSecrets extends AnySchema,\n TRequestContext extends AnySchema | undefined,\n TDeps extends Context = Record<never, never>,\n> {\n readonly id: string;\n readonly contract: TContract;\n readonly configSchema: PluginConfigFor<TVariables, TSecrets, TRequestContext>;\n\n initialize(\n config: PluginInitializeInput<TVariables, TSecrets>,\n plugins: Record<string, unknown>,\n ): Effect.Effect<TDeps, unknown, Scope.Scope>;\n\n shutdown(): Effect.Effect<void, never>;\n\n /**\n * Creates the strongly-typed oRPC router for this plugin.\n * The router's procedure types are inferred directly from the contract.\n * @param deps The initialized plugin dependencies\n * @returns A router with procedures matching the plugin's contract\n */\n createRouter(deps: TDeps): Router<TContract, any>;\n}\n\nexport interface CreatePluginFn {\n <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n P extends Record<string, unknown> = Record<string, never>,\n >(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n ): LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\n\n withPlugins: <P extends Record<string, unknown>>() => CreatePluginWithPlugins<P>;\n}\n\nexport const createPlugin: CreatePluginFn = function createPlugin<\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n P extends Record<string, unknown> = Record<string, never>,\n>(config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>) {\n const configSchema: PluginConfigFor<V, S, TRequestContext> = {\n variables: config.variables,\n secrets: config.secrets,\n context: config.context as TRequestContext,\n };\n\n class CreatedPlugin implements Plugin<TContract, V, S, TRequestContext, TDeps> {\n /** set during instantiation - registry key */\n id!: string;\n readonly contract = config.contract;\n readonly configSchema = configSchema;\n\n private _deps: TDeps | null = null;\n\n initialize(\n pluginConfig: PluginInitializeInput<V, S>,\n plugins: Record<string, unknown> = {},\n ): Effect.Effect<TDeps, unknown, Scope.Scope> {\n const init = config.initialize ?? (() => Effect.succeed({} as TDeps));\n\n return init(pluginConfig, plugins as P).pipe(\n Effect.tap((deps) =>\n Effect.sync(() => {\n this._deps = deps;\n }),\n ),\n Effect.map(() => this._deps as TDeps),\n Effect.mapError((error) => error as unknown),\n );\n }\n\n shutdown(): Effect.Effect<void, never> {\n const self = this;\n return Effect.gen(function* () {\n if (config.shutdown && self._deps) {\n yield* config\n .shutdown(self._deps)\n .pipe(\n Effect.catchAll((error) =>\n Effect.logWarning(`Plugin shutdown hook failed for ${self.id}`, error),\n ),\n );\n }\n self._deps = null;\n });\n }\n\n createRouter(deps: TDeps): Router<TContract, any> {\n const base = implement(config.contract).$context<ContextOutput<TRequestContext>>();\n const errorMiddleware = onError((error: unknown) => {\n const unwrapped = extractFromFiberFailure(error);\n\n if (unwrapped !== error && unwrapped instanceof ORPCError) {\n throw unwrapped;\n }\n\n formatORPCError(error);\n throw error;\n }) as any;\n\n const builder = (base as any).use(errorMiddleware);\n const router = config.createRouter(deps, builder as any);\n return router as Router<TContract, any>;\n }\n }\n\n const PluginConstructor = CreatedPlugin as unknown as {\n new (): Plugin<TContract, V, S, TRequestContext, TDeps>;\n binding: {\n contract: TContract;\n variables: V;\n secrets: S;\n context: TRequestContext;\n };\n };\n\n PluginConstructor.binding = {\n contract: config.contract,\n variables: config.variables,\n secrets: config.secrets,\n context: config.context as TRequestContext,\n };\n\n return PluginConstructor as LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\n};\n\nexport type CreatePluginWithPlugins<P extends Record<string, unknown>> = <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n>(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n) => LoadedPluginWithBinding<TContract, V, S, TRequestContext, TDeps>;\n\nexport function withPlugins<P extends Record<string, unknown>>(): CreatePluginWithPlugins<P> {\n return <\n V extends AnySchema,\n S extends AnySchema,\n TContract extends AnyContractRouter,\n TRequestContext extends AnySchema | undefined = undefined,\n TDeps extends Context = Record<never, never>,\n >(\n config: PluginDefinition<V, S, TContract, TRequestContext, TDeps, P>,\n ) => createPlugin<V, S, TContract, TRequestContext, TDeps, P>(config as any);\n}\n\ncreatePlugin.withPlugins = withPlugins;\n"],"mappings":";;;;;;AA+GA,MAAa,eAA+B,SAAS,aAOnD,QAAsE;CACtE,MAAM,eAAuD;EAC3D,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,SAAS,OAAO;EACjB;CAED,MAAM,cAAyE;;EAE7E;EACA,AAAS,WAAW,OAAO;EAC3B,AAAS,eAAe;EAExB,AAAQ,QAAsB;EAE9B,WACE,cACA,UAAmC,EAAE,EACO;AAG5C,WAFa,OAAO,qBAAqB,OAAO,QAAQ,EAAE,CAAU,GAExD,cAAc,QAAa,CAAC,KACtC,OAAO,KAAK,SACV,OAAO,WAAW;AAChB,SAAK,QAAQ;KACb,CACH,EACD,OAAO,UAAU,KAAK,MAAe,EACrC,OAAO,UAAU,UAAU,MAAiB,CAC7C;;EAGH,WAAuC;GACrC,MAAM,OAAO;AACb,UAAO,OAAO,IAAI,aAAa;AAC7B,QAAI,OAAO,YAAY,KAAK,MAC1B,QAAO,OACJ,SAAS,KAAK,MAAM,CACpB,KACC,OAAO,UAAU,UACf,OAAO,WAAW,mCAAmC,KAAK,MAAM,MAAM,CACvE,CACF;AAEL,SAAK,QAAQ;KACb;;EAGJ,aAAa,MAAqC;GAChD,MAAM,OAAO,UAAU,OAAO,SAAS,CAAC,UAA0C;GAClF,MAAM,kBAAkB,SAAS,UAAmB;IAClD,MAAM,YAAY,wBAAwB,MAAM;AAEhD,QAAI,cAAc,SAAS,qBAAqB,UAC9C,OAAM;AAGR,oBAAgB,MAAM;AACtB,UAAM;KACN;GAEF,MAAM,UAAW,KAAa,IAAI,gBAAgB;AAElD,UADe,OAAO,aAAa,MAAM,QAC5B;;;CAIjB,MAAM,oBAAoB;AAU1B,mBAAkB,UAAU;EAC1B,UAAU,OAAO;EACjB,WAAW,OAAO;EAClB,SAAS,OAAO;EAChB,SAAS,OAAO;EACjB;AAED,QAAO;;AAaT,SAAgB,cAA6E;AAC3F,SAOE,WACG,aAAyD,OAAc;;AAG9E,aAAa,cAAc"}
|