kizunajs 2.0.0-beta.2 → 2.0.0-beta.21
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/README.md +3 -2
- package/dist/{adapter-CZW-unqX.mjs → adapter-BSqNrxhq.mjs} +522 -104
- package/dist/adapter-C3WYdSfx.d.cts +2754 -0
- package/dist/{adapter-DDR_yo9L.cjs → adapter-ClaFZoab.cjs} +638 -196
- package/dist/adapter-D4bTPElA.d.mts +2754 -0
- package/dist/adapter.cjs +37 -29
- package/dist/adapter.d.cts +3 -5
- package/dist/adapter.d.mts +3 -5
- package/dist/adapter.mjs +5 -5
- package/dist/{error-response-C8Ragjcd.cjs → error-response-C9ymqSU4.cjs} +25 -5
- package/dist/{error-response-C839d8By.mjs → error-response-CNQaKVYd.mjs} +20 -6
- package/dist/{security-scheme-BrszwGD5.d.cts → error-response-NoOGdh8H.d.mts} +151 -24
- package/dist/{security-scheme-D3nb4XKj.d.mts → error-response-YbkRMKno.d.cts} +151 -24
- package/dist/generator.cjs +190 -95
- package/dist/generator.d.cts +189 -28
- package/dist/generator.d.mts +189 -28
- package/dist/generator.mjs +151 -60
- package/dist/index.cjs +159 -84
- package/dist/index.d.cts +193 -253
- package/dist/index.d.mts +193 -253
- package/dist/index.mjs +112 -38
- package/dist/jobs-entry.cjs +12 -11
- package/dist/jobs-entry.d.cts +1 -1
- package/dist/jobs-entry.d.mts +1 -1
- package/dist/jobs-entry.mjs +3 -2
- package/dist/plugin-Dw-yCjTY.cjs +233 -0
- package/dist/{cache-CLN5y0Xp.mjs → plugin-server-BztlE1fz.mjs} +188 -49
- package/dist/{cache-BgohRj0i.cjs → plugin-server-kUsK7thV.cjs} +238 -93
- package/dist/plugin-xxCxibmu.mjs +138 -0
- package/dist/plugin.cjs +8 -72
- package/dist/plugin.d.cts +3 -3
- package/dist/plugin.d.mts +3 -3
- package/dist/plugin.mjs +2 -68
- package/dist/{protected-resource-metadata-CA0v5cjg.d.mts → protected-resource-metadata-B9hMFQ9N.d.cts} +1 -1
- package/dist/{protected-resource-metadata-Cprrv0mt.d.cts → protected-resource-metadata-CfBVsqIk.d.mts} +1 -1
- package/dist/{schemas-C56no6bv.cjs → schemas-DNPVDvkd.cjs} +28 -1
- package/dist/{schemas-CJQcc97N.mjs → schemas-HW2FDsvz.mjs} +23 -2
- package/dist/schemas.cjs +3 -2
- package/dist/schemas.d.cts +24 -3
- package/dist/schemas.d.mts +24 -3
- package/dist/schemas.mjs +3 -3
- package/package.json +1 -1
- package/src/adapter.ts +245 -29
- package/src/api-definition.ts +12 -16
- package/src/api.ts +7 -3
- package/src/brand.ts +29 -0
- package/src/config.ts +51 -10
- package/src/configured.ts +13 -6
- package/src/define-config.ts +118 -39
- package/src/generator.ts +363 -46
- package/src/group-routes.ts +106 -0
- package/src/groups.ts +140 -0
- package/src/handler-pipeline.ts +78 -19
- package/src/index.ts +15 -6
- package/src/job-runner.ts +5 -0
- package/src/job-transport.ts +3 -3
- package/src/job.ts +8 -6
- package/src/jobs-dev-runner.ts +6 -0
- package/src/jobs.ts +61 -8
- package/src/kizuna.ts +56 -33
- package/src/plugin-server.ts +129 -19
- package/src/plugin.ts +269 -127
- package/src/routes.ts +80 -32
- package/src/schemas.ts +1 -0
- package/src/tool-answer.ts +21 -0
- package/src/tool-definitions.ts +166 -0
- package/src/tool-events.ts +90 -18
- package/src/tool-records.ts +11 -3
- package/src/tool-runner.ts +298 -0
- package/src/types.ts +90 -24
- package/src/zod-internals.ts +22 -5
- package/src/zod-meta.ts +7 -2
- package/dist/adapter-BGfMqEkM.d.cts +0 -563
- package/dist/adapter-Ci3cfcoT.d.mts +0 -563
- package/dist/api-definition-BHnh15zD.d.mts +0 -803
- package/dist/api-definition-DQj-ewHy.d.cts +0 -803
- package/dist/error-response-BBGSdgYw.d.mts +0 -67
- package/dist/error-response-Do38sr-9.d.cts +0 -67
- package/dist/plugin-Cz0kn6Lk.d.mts +0 -830
- package/dist/plugin-DhKvx_T0.d.cts +0 -830
- package/src/tags.ts +0 -67
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
3
|
-
const require_error_response = require("./error-response-
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
2
|
+
const require_plugin = require("./plugin-Dw-yCjTY.cjs");
|
|
3
|
+
const require_error_response = require("./error-response-C9ymqSU4.cjs");
|
|
4
|
+
const require_plugin_server = require("./plugin-server-kUsK7thV.cjs");
|
|
5
|
+
const require_schemas = require("./schemas-DNPVDvkd.cjs");
|
|
6
|
+
const require_adapter = require("./adapter-ClaFZoab.cjs");
|
|
7
7
|
let zod = require("zod");
|
|
8
|
+
//#region src/group-routes.ts
|
|
9
|
+
/**
|
|
10
|
+
* The runtime half of {@link GroupRoutes}. `k` never sees the groups, so
|
|
11
|
+
* `defineConfig` checks each path.
|
|
12
|
+
*/
|
|
13
|
+
const createGroupRoutes = () => {
|
|
14
|
+
const accessors = /* @__PURE__ */ new Map();
|
|
15
|
+
const accessorAt = (path) => {
|
|
16
|
+
const cached = accessors.get(path);
|
|
17
|
+
if (cached !== void 0) return cached;
|
|
18
|
+
const accessor = new Proxy(() => {}, {
|
|
19
|
+
apply: (_target, _this, [routes]) => require_adapter.groupRoutes(path, routes),
|
|
20
|
+
get: (_target, key) => typeof key === "string" ? accessorAt(path === "" ? key : `${path}.${key}`) : void 0
|
|
21
|
+
});
|
|
22
|
+
accessors.set(path, accessor);
|
|
23
|
+
return accessor;
|
|
24
|
+
};
|
|
25
|
+
return accessorAt("");
|
|
26
|
+
};
|
|
27
|
+
//#endregion
|
|
8
28
|
//#region src/coded-issue.ts
|
|
9
29
|
/**
|
|
10
30
|
* Emit a single validation issue with a custom machine-readable `code`.
|
|
@@ -37,7 +57,7 @@ const createRequestContextBuilder = (declaration) => ({
|
|
|
37
57
|
handler: (fn) => ({
|
|
38
58
|
...declaration,
|
|
39
59
|
[RESOLVER]: fn,
|
|
40
|
-
[
|
|
60
|
+
[require_plugin.DECLARATION]: "requestContext"
|
|
41
61
|
})
|
|
42
62
|
});
|
|
43
63
|
//#endregion
|
|
@@ -153,7 +173,7 @@ const buildable = (identity) => ({
|
|
|
153
173
|
guard: (fn) => ({
|
|
154
174
|
...identity,
|
|
155
175
|
[GUARD]: fn,
|
|
156
|
-
[
|
|
176
|
+
[require_plugin.DECLARATION]: "identity"
|
|
157
177
|
})
|
|
158
178
|
});
|
|
159
179
|
const identityFactories = {
|
|
@@ -165,34 +185,45 @@ const identityFactories = {
|
|
|
165
185
|
custom: (config) => buildable(createIdentity.custom(config))
|
|
166
186
|
};
|
|
167
187
|
//#endregion
|
|
168
|
-
//#region src/
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
188
|
+
//#region src/brand.ts
|
|
189
|
+
const BRANDABLE_TYPES = new Set([
|
|
190
|
+
"string",
|
|
191
|
+
"number",
|
|
192
|
+
"bigint",
|
|
193
|
+
"boolean",
|
|
194
|
+
"date"
|
|
195
|
+
]);
|
|
196
|
+
/**
|
|
197
|
+
* Brand a Zod schema, so the server and every generated client type its values
|
|
198
|
+
* as that brand. The schema is a string, number, bigint, boolean or date.
|
|
199
|
+
*
|
|
200
|
+
* ```ts
|
|
201
|
+
* const UserId = Kizuna.brand('UserId', z.string());
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
const createBrand = (brand, schema) => {
|
|
205
|
+
const type = require_error_response.readDef(schema).type;
|
|
206
|
+
if (type === void 0 || !BRANDABLE_TYPES.has(type)) throw new Error(`Kizuna.brand('${brand}') takes a string, number, bigint, boolean or date schema, not \`${type ?? "unknown"}\`. Put .optional() or .nullable() on the brand instead.`);
|
|
207
|
+
return schema.meta({ brand });
|
|
208
|
+
};
|
|
177
209
|
//#endregion
|
|
178
210
|
//#region src/job.ts
|
|
179
211
|
const createJob = (definition) => ({
|
|
180
212
|
...definition,
|
|
181
213
|
handler: (fn) => ({
|
|
182
214
|
...definition,
|
|
183
|
-
[
|
|
184
|
-
[
|
|
215
|
+
[require_plugin.HANDLER]: fn,
|
|
216
|
+
[require_plugin.DECLARATION]: "job"
|
|
185
217
|
})
|
|
186
218
|
});
|
|
187
219
|
//#endregion
|
|
188
220
|
//#region src/kizuna.ts
|
|
189
221
|
const createSurface = () => {
|
|
190
|
-
const
|
|
191
|
-
const jobs = ((identityOrDefinitions, definitions) => definitions === void 0 ? require_cache.buildJobs(void 0, identityOrDefinitions) : require_cache.buildJobs(identityOrDefinitions, definitions));
|
|
222
|
+
const jobs = ((identityOrDefinitions, definitions) => definitions === void 0 ? require_plugin_server.buildJobs(void 0, identityOrDefinitions) : require_plugin_server.buildJobs(identityOrDefinitions, definitions));
|
|
192
223
|
return {
|
|
193
|
-
|
|
194
|
-
route: createRoute,
|
|
195
|
-
routes,
|
|
224
|
+
groups: require_adapter.createGroups,
|
|
225
|
+
route: require_plugin.createRoute,
|
|
226
|
+
routes: createGroupRoutes(),
|
|
196
227
|
job: createJob,
|
|
197
228
|
jobs,
|
|
198
229
|
identity: identityFactories,
|
|
@@ -205,7 +236,7 @@ const createSurface = () => {
|
|
|
205
236
|
* `kizuna generate` writes, which is what every name on `k` is checked against
|
|
206
237
|
* and what types everything a handler receives.
|
|
207
238
|
*
|
|
208
|
-
* `k.route` declares a route with its handler, `k.routes`
|
|
239
|
+
* `k.route` declares a route with its handler, `k.routes` files them into groups, and
|
|
209
240
|
* `k.job` and `k.jobs` do the same for jobs.
|
|
210
241
|
* `defineConfig` assembles them.
|
|
211
242
|
*
|
|
@@ -221,6 +252,11 @@ var Kizuna = class {
|
|
|
221
252
|
*/
|
|
222
253
|
static model = require_error_response.createModel;
|
|
223
254
|
/**
|
|
255
|
+
* Brand a schema, so the server and every generated client type its values
|
|
256
|
+
* as that brand.
|
|
257
|
+
*/
|
|
258
|
+
static brand = createBrand;
|
|
259
|
+
/**
|
|
224
260
|
* Declare the permissions callers hold, as a catalog of resources and the
|
|
225
261
|
* verbs each allows.
|
|
226
262
|
*/
|
|
@@ -278,6 +314,7 @@ const readToolCalls = (messages) => {
|
|
|
278
314
|
case "tool_call": {
|
|
279
315
|
const call = at(data.id, data.name);
|
|
280
316
|
call.input = data.input;
|
|
317
|
+
if (data.needsApproval === true && call.state === "running") call.state = "needs-approval";
|
|
281
318
|
break;
|
|
282
319
|
}
|
|
283
320
|
case "tool_result": {
|
|
@@ -299,7 +336,7 @@ const readToolCalls = (messages) => {
|
|
|
299
336
|
//#endregion
|
|
300
337
|
//#region src/api-definition.ts
|
|
301
338
|
/**
|
|
302
|
-
* Internal helper that builds a {@link ApiDefinition} from routes,
|
|
339
|
+
* Internal helper that builds a {@link ApiDefinition} from routes, groups, identities,
|
|
303
340
|
* and issue codes. Called by `defineConfig`. Not part of the public surface;
|
|
304
341
|
* author contracts through `k`.
|
|
305
342
|
*/
|
|
@@ -310,7 +347,7 @@ function buildApiDefinition(config) {
|
|
|
310
347
|
plugins: config.plugins,
|
|
311
348
|
jobs: config.jobs,
|
|
312
349
|
jobsConfig: config.jobsConfig,
|
|
313
|
-
|
|
350
|
+
groups: config.groups,
|
|
314
351
|
securitySchemes: config.securitySchemes,
|
|
315
352
|
requestContext: config.requestContext,
|
|
316
353
|
validation: config.validation
|
|
@@ -347,10 +384,10 @@ const guardResponse = (body, headers) => Object.defineProperty({
|
|
|
347
384
|
...headers ? { headers } : {}
|
|
348
385
|
}, INJECTED, { value: true });
|
|
349
386
|
const widened = (declared, guardBody) => {
|
|
350
|
-
const body =
|
|
387
|
+
const body = require_plugin_server.resolveResponseBody(declared);
|
|
351
388
|
if (body === void 0) return declared;
|
|
352
389
|
return Object.defineProperty({
|
|
353
|
-
...
|
|
390
|
+
...require_plugin_server.isZodSchema(declared) ? {} : declared,
|
|
354
391
|
body: zod.z.union([body, guardBody])
|
|
355
392
|
}, WIDENED, { value: declared });
|
|
356
393
|
};
|
|
@@ -364,7 +401,7 @@ const widened = (declared, guardBody) => {
|
|
|
364
401
|
*/
|
|
365
402
|
const injectGuardResponses = (routes, identities, guardSchema) => {
|
|
366
403
|
const guardBody = guardSchema ?? require_error_response.ProblemDetailsSchema;
|
|
367
|
-
for (const { route, routeKey } of
|
|
404
|
+
for (const { route, routeKey } of require_plugin_server.flattenRoutes(routes)) {
|
|
368
405
|
const declared = Object.entries(route.responses).filter(([, response]) => !carries(response, INJECTED)).map(([status, response]) => [Number(status), asDeclared(response)]);
|
|
369
406
|
const schemes = require_schemas.resolveSecurityRequirements(route).map((requirement) => requirement.scheme);
|
|
370
407
|
if (schemes.length === 0) {
|
|
@@ -390,7 +427,7 @@ const handlersFrom = (declarations) => {
|
|
|
390
427
|
if (!value || typeof value !== "object") continue;
|
|
391
428
|
const compiled = value;
|
|
392
429
|
if (compiled.definition) {
|
|
393
|
-
if (compiled.definition[
|
|
430
|
+
if (compiled.definition[require_plugin.HANDLER]) handlers[key] = compiled.definition[require_plugin.HANDLER];
|
|
394
431
|
continue;
|
|
395
432
|
}
|
|
396
433
|
handlers[key] = handlersFrom(value);
|
|
@@ -403,18 +440,19 @@ const handlersFrom = (declarations) => {
|
|
|
403
440
|
*/
|
|
404
441
|
const buildApi = (contract, implementations, adapter) => {
|
|
405
442
|
require_adapter.warnUnsupportedJobOptions(contract.jobs, implementations.jobTransport);
|
|
406
|
-
const
|
|
443
|
+
const assembled = require_adapter.assembleApi(contract, {
|
|
407
444
|
router: require_adapter.routerFromRoutes(contract.routes),
|
|
408
445
|
guards: implementations.guards,
|
|
409
446
|
requestContext: implementations.requestContext,
|
|
410
447
|
plugins: implementations.plugins
|
|
411
|
-
};
|
|
412
|
-
const api = Object.assign(
|
|
448
|
+
});
|
|
449
|
+
const api = Object.assign(assembled, contract, { [require_adapter.JOBS_META]: contract.jobs ? {
|
|
413
450
|
jobs: contract.jobs,
|
|
414
451
|
handlers: handlersFrom(contract.jobs),
|
|
415
452
|
config: contract.jobsConfig,
|
|
416
453
|
transport: implementations.jobTransport,
|
|
417
|
-
onError: implementations.onJobError
|
|
454
|
+
onError: implementations.onJobError,
|
|
455
|
+
plugins: require_plugin_server.pluginExportsOf(assembled)
|
|
418
456
|
} : void 0 });
|
|
419
457
|
api.mount = (...args) => {
|
|
420
458
|
if (!adapter) throw new Error("This api has no adapter to mount on. Name one under `adapter` in `defineConfig`.");
|
|
@@ -512,6 +550,15 @@ const handlersOf = (declarations, key) => {
|
|
|
512
550
|
return handlers;
|
|
513
551
|
};
|
|
514
552
|
/**
|
|
553
|
+
* Throw on a route in a group the config does not declare.
|
|
554
|
+
*/
|
|
555
|
+
const assertDeclaredGroups = (routes, groups) => {
|
|
556
|
+
for (const { routeKey, routeGroups } of require_plugin_server.flattenRoutes(routes)) for (const group of routeGroups) {
|
|
557
|
+
if (groups?.groups.has(group)) continue;
|
|
558
|
+
throw new Error(groups === void 0 ? `Route '${routeKey}' is filed under the group '${group}', but the config declares no groups. Pass \`groups\` to defineConfig.` : `Route '${routeKey}' is filed under the group '${group}', which \`groups\` does not declare.`);
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
/**
|
|
515
562
|
* Everything kizuna knows about one API, written in `kizuna.config.ts`. Every
|
|
516
563
|
* route's `auth` resolves onto its `security`, `roles` and `requires`, the
|
|
517
564
|
* routes, jobs, tools and plugins are checked against one another, and the
|
|
@@ -531,19 +578,31 @@ const handlersOf = (declarations, key) => {
|
|
|
531
578
|
const defineConfig = (options) => {
|
|
532
579
|
const guardSchema = options.auth?.guardSchema;
|
|
533
580
|
if (guardSchema) assertFillableGuardSchema(guardSchema);
|
|
534
|
-
const routes = options.routes ??
|
|
581
|
+
const routes = require_adapter.assembleRoutes(options.routes ?? []);
|
|
535
582
|
const jobs = options.jobs;
|
|
536
583
|
const identities = options.auth?.identities;
|
|
537
|
-
const
|
|
584
|
+
const apiReference = require_plugin_server.createApiReference();
|
|
585
|
+
const plugins = require_plugin_server.resolvePlugins(options.plugins, apiReference.api);
|
|
586
|
+
const pluginRoutes = require_plugin.pluginRouteTree(plugins);
|
|
538
587
|
require_adapter.assertNoPathCollisions([
|
|
539
588
|
...require_adapter.routeClaims(routes),
|
|
540
|
-
...require_adapter.routeClaims(
|
|
541
|
-
...
|
|
589
|
+
...require_adapter.routeClaims(pluginRoutes, "Plugin route"),
|
|
590
|
+
...require_plugin_server.jobClaims(jobs, options.jobRunner)
|
|
542
591
|
]);
|
|
543
|
-
|
|
544
|
-
|
|
592
|
+
require_plugin_server.assertJobRunner(jobs, options.jobRunner);
|
|
593
|
+
require_plugin_server.assertValidDeprecationDates(routes);
|
|
594
|
+
require_plugin_server.assertValidDeprecationDates(pluginRoutes);
|
|
595
|
+
assertDeclaredGroups(routes, options.groups);
|
|
596
|
+
for (const { route, routeKey } of require_plugin_server.flattenRoutes(pluginRoutes)) {
|
|
597
|
+
if (route.tool !== void 0 && route.tool !== false) throw new Error(`Plugin route '${routeKey}' declares \`tool\`. Plugin routes are hidden, so they never publish.`);
|
|
598
|
+
route.hidden = true;
|
|
599
|
+
}
|
|
600
|
+
for (const { route, routeKey } of [...require_plugin_server.flattenRoutes(routes), ...require_plugin_server.flattenRoutes(pluginRoutes)]) {
|
|
601
|
+
if (route.hidden === true && route.tool !== void 0 && route.tool !== false) throw new Error(`Route '${routeKey}' is \`hidden\` and declares \`tool\`. A hidden route never publishes, so remove one of them.`);
|
|
602
|
+
if (route.rawBody === true && route.contentType === "multipart/form-data") throw new Error(`Route '${routeKey}' declares \`rawBody\` on a \`multipart/form-data\` body. A multipart body is read as a stream of parts, so kizuna cannot keep it as text. Remove \`rawBody\`, or take the body as JSON.`);
|
|
603
|
+
}
|
|
545
604
|
const declaresIdentities = Object.keys(identities ?? {}).length > 0;
|
|
546
|
-
for (const { route, routeKey } of
|
|
605
|
+
for (const { route, routeKey } of require_plugin_server.flattenRoutes(routes)) {
|
|
547
606
|
if (route.auth === void 0) {
|
|
548
607
|
if (declaresIdentities) throw new Error(`Route '${routeKey}' declares no \`auth\`. Name the identity it requires, or \`false\` for a public route.`);
|
|
549
608
|
route.security = [];
|
|
@@ -551,13 +610,21 @@ const defineConfig = (options) => {
|
|
|
551
610
|
}
|
|
552
611
|
resolveRouteAuth(route, route.auth, identities, routeKey);
|
|
553
612
|
}
|
|
613
|
+
for (const { route, routeKey } of require_plugin_server.flattenRoutes(pluginRoutes)) {
|
|
614
|
+
if (route.auth === void 0) {
|
|
615
|
+
route.security = [];
|
|
616
|
+
continue;
|
|
617
|
+
}
|
|
618
|
+
resolveRouteAuth(route, route.auth, identities, routeKey);
|
|
619
|
+
}
|
|
554
620
|
injectGuardResponses(routes, identities, guardSchema);
|
|
555
|
-
|
|
556
|
-
|
|
621
|
+
injectGuardResponses(pluginRoutes, identities, guardSchema);
|
|
622
|
+
require_plugin_server.assertValidCache(routes);
|
|
623
|
+
require_plugin_server.assertValidCache(pluginRoutes);
|
|
557
624
|
const contract = buildApiDefinition({
|
|
558
625
|
routes,
|
|
559
626
|
jobs,
|
|
560
|
-
|
|
627
|
+
groups: options.groups,
|
|
561
628
|
securitySchemes: identities,
|
|
562
629
|
guardSchema,
|
|
563
630
|
requestContext: options.requestContext,
|
|
@@ -570,14 +637,19 @@ const defineConfig = (options) => {
|
|
|
570
637
|
if (guards?.[name] !== void 0) continue;
|
|
571
638
|
throw new Error(`Identity '${name}' has no guard. Add \`.guard(...)\` to its declaration, so something authenticates it.`);
|
|
572
639
|
}
|
|
640
|
+
const api = buildApi(contract, {
|
|
641
|
+
guards,
|
|
642
|
+
requestContext: handlersOf(options.requestContext, RESOLVER),
|
|
643
|
+
jobTransport: options.jobRunner?.transport,
|
|
644
|
+
onJobError: options.jobRunner?.onError
|
|
645
|
+
}, options.adapter);
|
|
646
|
+
apiReference.bind(api);
|
|
647
|
+
for (const plugin of Object.values(plugins)) plugin.validate?.();
|
|
573
648
|
return {
|
|
574
|
-
api
|
|
575
|
-
guards,
|
|
576
|
-
requestContext: handlersOf(options.requestContext, RESOLVER),
|
|
577
|
-
jobTransport: options.jobRunner?.transport,
|
|
578
|
-
onJobError: options.jobRunner?.onError
|
|
579
|
-
}, options.adapter),
|
|
649
|
+
api,
|
|
580
650
|
clients: options.clients ?? [],
|
|
651
|
+
generators: Object.values(plugins).flatMap((plugin) => plugin.generators),
|
|
652
|
+
diff: options.diff,
|
|
581
653
|
typescript: options.typescript
|
|
582
654
|
};
|
|
583
655
|
};
|
|
@@ -593,73 +665,76 @@ const apiEntries = (module) => {
|
|
|
593
665
|
return [["default", {
|
|
594
666
|
api: config.api,
|
|
595
667
|
clients: config.clients ?? [],
|
|
596
|
-
|
|
668
|
+
generators: config.generators ?? [],
|
|
669
|
+
typescript: config.typescript,
|
|
670
|
+
diff: config.diff
|
|
597
671
|
}]];
|
|
598
672
|
};
|
|
599
673
|
//#endregion
|
|
600
|
-
exports.AUTO_GUARD_BRAND =
|
|
601
|
-
exports.AUTO_GUARD_WRITTEN_BRAND =
|
|
602
|
-
exports.AUTO_RESPONSES_BRAND =
|
|
603
|
-
exports.DECLARATION =
|
|
674
|
+
exports.AUTO_GUARD_BRAND = require_plugin.AUTO_GUARD_BRAND;
|
|
675
|
+
exports.AUTO_GUARD_WRITTEN_BRAND = require_plugin.AUTO_GUARD_WRITTEN_BRAND;
|
|
676
|
+
exports.AUTO_RESPONSES_BRAND = require_plugin.AUTO_RESPONSES_BRAND;
|
|
677
|
+
exports.DECLARATION = require_plugin.DECLARATION;
|
|
604
678
|
exports.DispatchFailedSchema = require_adapter.DispatchFailedSchema;
|
|
605
679
|
exports.DispatchResultSchema = require_adapter.DispatchResultSchema;
|
|
606
|
-
exports.EVENT_STREAM_MEDIA_TYPE =
|
|
680
|
+
exports.EVENT_STREAM_MEDIA_TYPE = require_plugin_server.EVENT_STREAM_MEDIA_TYPE;
|
|
607
681
|
exports.GUARD = GUARD;
|
|
608
|
-
exports.HANDLER_CONTEXT_BRAND =
|
|
682
|
+
exports.HANDLER_CONTEXT_BRAND = require_plugin.HANDLER_CONTEXT_BRAND;
|
|
609
683
|
exports.JobDispatchError = require_adapter.JobDispatchError;
|
|
610
684
|
exports.JobInputError = require_adapter.JobInputError;
|
|
611
685
|
exports.Kizuna = Kizuna;
|
|
612
|
-
exports.METHODS =
|
|
686
|
+
exports.METHODS = require_plugin.METHODS;
|
|
613
687
|
exports.RESOLVER = RESOLVER;
|
|
688
|
+
exports.ROUTES_GROUP = require_plugin.ROUTES_GROUP;
|
|
614
689
|
exports.ResponseError = require_adapter.ResponseError;
|
|
615
690
|
exports.STATUS_TITLES = require_adapter.STATUS_TITLES;
|
|
616
691
|
exports.apiEntries = apiEntries;
|
|
617
692
|
exports.assertCanonicalResourceUri = require_schemas.assertCanonicalResourceUri;
|
|
618
|
-
exports.assertValidSchedule =
|
|
693
|
+
exports.assertValidSchedule = require_plugin_server.assertValidSchedule;
|
|
619
694
|
exports.authorizationServerIssuer = require_schemas.authorizationServerIssuer;
|
|
620
|
-
exports.buildPath =
|
|
695
|
+
exports.buildPath = require_plugin_server.buildPath;
|
|
621
696
|
exports.buildProtectedResourceMetadata = require_schemas.buildProtectedResourceMetadata;
|
|
622
697
|
exports.createJobRunner = require_adapter.createJobRunner;
|
|
623
|
-
exports.
|
|
624
|
-
exports.createPlugin = require_plugin.createPlugin;
|
|
625
|
-
exports.cron = require_cache.cron;
|
|
698
|
+
exports.cron = require_plugin_server.cron;
|
|
626
699
|
exports.declaredScopes = require_schemas.declaredScopes;
|
|
627
700
|
exports.defineConfig = defineConfig;
|
|
701
|
+
exports.defineJobTransport = require_adapter.defineJobTransport;
|
|
702
|
+
exports.definePlugin = require_plugin.definePlugin;
|
|
628
703
|
exports.dispatchDueJobs = require_adapter.dispatchDueJobs;
|
|
629
704
|
exports.dispatchSucceeded = require_adapter.dispatchSucceeded;
|
|
630
705
|
exports.dueJobs = require_adapter.dueJobs;
|
|
631
|
-
exports.dueSchedules =
|
|
706
|
+
exports.dueSchedules = require_plugin_server.dueSchedules;
|
|
632
707
|
exports.expandStreamTools = require_adapter.expandStreamTools;
|
|
633
708
|
exports.failedJobs = require_adapter.failedJobs;
|
|
634
|
-
exports.firesBetween =
|
|
635
|
-
exports.flattenJobs =
|
|
709
|
+
exports.firesBetween = require_plugin_server.firesBetween;
|
|
710
|
+
exports.flattenJobs = require_plugin_server.flattenJobs;
|
|
636
711
|
exports.getHeaderValue = require_adapter.getHeaderValue;
|
|
637
712
|
exports.getStatusText = require_adapter.getStatusText;
|
|
638
|
-
exports.isCompiledJob =
|
|
639
|
-
exports.isJobDefinition =
|
|
640
|
-
exports.isNamedStream =
|
|
713
|
+
exports.isCompiledJob = require_plugin_server.isCompiledJob;
|
|
714
|
+
exports.isJobDefinition = require_plugin_server.isJobDefinition;
|
|
715
|
+
exports.isNamedStream = require_plugin_server.isNamedStream;
|
|
641
716
|
exports.isPermissions = require_adapter.isPermissions;
|
|
642
717
|
exports.isProblemDetails = require_error_response.isProblemDetails;
|
|
643
718
|
exports.isRoles = require_adapter.isRoles;
|
|
644
|
-
exports.isRouteDefinition =
|
|
719
|
+
exports.isRouteDefinition = require_plugin_server.isRouteDefinition;
|
|
645
720
|
exports.isSecurityScheme = require_schemas.isSecurityScheme;
|
|
646
|
-
exports.isStreamResponse =
|
|
721
|
+
exports.isStreamResponse = require_plugin_server.isStreamResponse;
|
|
647
722
|
exports.isValidationError = require_schemas.isValidationError;
|
|
648
|
-
exports.isZodSchema =
|
|
649
|
-
exports.jobAt =
|
|
723
|
+
exports.isZodSchema = require_plugin_server.isZodSchema;
|
|
724
|
+
exports.jobAt = require_plugin_server.jobAt;
|
|
650
725
|
exports.jobFnAt = require_adapter.jobFnAt;
|
|
651
|
-
exports.nextRun =
|
|
652
|
-
exports.nextRuns =
|
|
653
|
-
exports.parseCron =
|
|
654
|
-
exports.parsePath =
|
|
726
|
+
exports.nextRun = require_plugin_server.nextRun;
|
|
727
|
+
exports.nextRuns = require_plugin_server.nextRuns;
|
|
728
|
+
exports.parseCron = require_plugin_server.parseCron;
|
|
729
|
+
exports.parsePath = require_plugin_server.parsePath;
|
|
655
730
|
exports.problemDetails = require_adapter.problemDetails;
|
|
656
731
|
exports.problemFromBody = require_adapter.problemFromBody;
|
|
657
732
|
exports.readToolCalls = readToolCalls;
|
|
658
|
-
exports.routeStreams =
|
|
659
|
-
exports.scheduleExpression =
|
|
660
|
-
exports.scheduleTimezone =
|
|
661
|
-
exports.soleStreamResponse =
|
|
662
|
-
exports.streamContentType =
|
|
663
|
-
exports.streamMode =
|
|
664
|
-
exports.streamStatuses =
|
|
733
|
+
exports.routeStreams = require_plugin_server.routeStreams;
|
|
734
|
+
exports.scheduleExpression = require_plugin_server.scheduleExpression;
|
|
735
|
+
exports.scheduleTimezone = require_plugin_server.scheduleTimezone;
|
|
736
|
+
exports.soleStreamResponse = require_plugin_server.soleStreamResponse;
|
|
737
|
+
exports.streamContentType = require_plugin_server.streamContentType;
|
|
738
|
+
exports.streamMode = require_plugin_server.streamMode;
|
|
739
|
+
exports.streamStatuses = require_plugin_server.streamStatuses;
|
|
665
740
|
exports.toolEvents = require_adapter.toolEvents;
|