@classytic/arc 2.38.0 → 2.41.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/dist/{BaseController-CYaDvmOB.mjs → BaseController-DYJRZ0EJ.mjs} +114 -24
- package/dist/{EventTransport-Cx60_s-6.d.mts → EventTransport-CbUKDzZZ.d.mts} +33 -0
- package/dist/{EventTransport-Gq7JWbWw.mjs → EventTransport-n7qO5Cz3.mjs} +22 -2
- package/dist/{HookSystem-C0ikzqQf.mjs → HookSystem-CxvZBo77.mjs} +2 -2
- package/dist/{ResourceRegistry-DPcX--zk.mjs → ResourceRegistry-Cu7uTJp9.mjs} +2 -2
- package/dist/{actionPermissions-jlFZ1it4.mjs → actionPermissions-DPwPWPOV.mjs} +7 -6
- package/dist/audit/index.d.mts +2 -2
- package/dist/audit/index.mjs +10 -3
- package/dist/auth/audit.mjs +1 -1
- package/dist/auth/index.d.mts +2 -2
- package/dist/auth/index.mjs +12 -6
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/{authorizationDecision-BP8GHtjc.mjs → authorizationDecision-2YY_Kaj1.mjs} +2 -2
- package/dist/{base-C-NL2fTi.d.mts → base-CxrV1LmG.d.mts} +10 -0
- package/dist/{buildHandler-DjXOqIvX.mjs → buildHandler-CUhjGHGZ.mjs} +4 -4
- package/dist/cache/index.d.mts +4 -2
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-a3ZEcJJs.mjs → caching-DsWDjIxx.mjs} +2 -2
- package/dist/cleanup/index.d.mts +2 -2
- package/dist/cleanup/index.mjs +21 -5
- package/dist/cli/commands/describe.d.mts +1 -1
- package/dist/cli/commands/describe.mjs +3 -3
- package/dist/cli/commands/docs.mjs +3 -3
- package/dist/cli/commands/doctor.mjs +1 -1
- package/dist/cli/commands/generate.mjs +2 -2
- package/dist/cli/commands/init.mjs +2 -2
- package/dist/cli/commands/introspect.mjs +2 -2
- package/dist/cli/index.mjs +3 -3
- package/dist/{constants-BONghE1Y.mjs → constants-BxLgNFF7.mjs} +1 -1
- package/dist/context/index.d.mts +34 -6
- package/dist/context/index.mjs +42 -24
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +7 -7
- package/dist/{core-8She7FgF.mjs → core-iNGqYerO.mjs} +3 -3
- package/dist/{createActionRouter-Bqi6Bhhx.mjs → createActionRouter-BBlbPs3k.mjs} +7 -7
- package/dist/{createAggregationRouter-BsYO7ktd.mjs → createAggregationRouter-Dv5SuK2x.mjs} +7 -7
- package/dist/createMcpServer-CbDWkZ1T.d.mts +48 -0
- package/dist/{defineAggregation-0KBvqEEC.mjs → defineAggregation-UyeurGkp.mjs} +1 -1
- package/dist/{defineResource-BMdyRelW.mjs → defineResource-DzGT-2LP.mjs} +20 -22
- package/dist/discovery/index.mjs +1 -1
- package/dist/docs/index.d.mts +1 -1
- package/dist/docs/index.mjs +3 -3
- package/dist/{elevation-C6woysGC.mjs → elevation-BF-vhGxY.mjs} +4 -4
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-DI5AN2b5.d.mts → errorHandler--4rSMMvq.d.mts} +7 -1
- package/dist/{errorHandler-BdmIWPba.mjs → errorHandler-CIMkCOWm.mjs} +3 -3
- package/dist/{errors-2ExmOgIJ.mjs → errors-C_YhELhe.mjs} +1 -1
- package/dist/{eventPlugin-DFvHa4Nf.d.mts → eventPlugin-B52abJ8W.d.mts} +1 -1
- package/dist/{eventPlugin-DJwpGMzx.mjs → eventPlugin-CmXaPWLv.mjs} +5 -5
- package/dist/events/index.d.mts +4 -4
- package/dist/events/index.mjs +5 -5
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis-stream-entry.mjs +34 -24
- package/dist/events/transports/redis.d.mts +1 -1
- package/dist/events/transports/redis.mjs +11 -8
- package/dist/factory/index.d.mts +5 -5
- package/dist/factory/index.mjs +5 -5
- package/dist/{fastify-augmentation-jYA2oHyL.d.mts → fastify-augmentation-Cq2nHVaW.d.mts} +3 -3
- package/dist/{fields-Cha2QCKH.mjs → fields-BTyPLHK0.mjs} +1 -1
- package/dist/{generate-BUP4Oydg.mjs → generate-D_YmiCNf.mjs} +4 -3
- package/dist/{headers-DeXNifVj.mjs → headers-CNECDE6q.mjs} +2 -2
- package/dist/{health-Bh0N_FLk.mjs → health-CxQzbJmr.mjs} +10 -2
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/idempotency/index.d.mts +1 -1
- package/dist/idempotency/index.mjs +4 -4
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/idempotency/redis.mjs +1 -1
- package/dist/{index-BtYoMip1.d.mts → index-BHdZD8zK.d.mts} +10 -2
- package/dist/{index-D2uIUSQk.d.mts → index-CFfLKMH4.d.mts} +2 -2
- package/dist/{index-eyg5WEcy.d.mts → index-CbJiYrfv.d.mts} +1 -1
- package/dist/{index-BRoDtjek.d.mts → index-D4u76eQW.d.mts} +3 -3
- package/dist/{index-B78WZom8.d.mts → index-DHbyPo5j.d.mts} +52 -12
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +11 -11
- package/dist/{init-Dg_Am2o_.mjs → init-Y2MlSN9n.mjs} +9 -9
- package/dist/integrations/event-gateway.d.mts +1 -1
- package/dist/integrations/event-gateway.mjs +2 -2
- package/dist/integrations/index.d.mts +2 -2
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/jobs/index.d.mts +1 -1
- package/dist/integrations/jobs/index.mjs +2 -2
- package/dist/integrations/mcp/index.d.mts +4 -47
- package/dist/integrations/mcp/index.mjs +2 -2
- package/dist/integrations/mcp/testing.d.mts +22 -2
- package/dist/integrations/mcp/testing.mjs +55 -33
- package/dist/integrations/streamline.mjs +3 -3
- package/dist/integrations/webhooks.d.mts +2 -2
- package/dist/integrations/webhooks.mjs +3 -3
- package/dist/integrations/websocket-pushref-redis.d.mts +1 -1
- package/dist/integrations/websocket-pushref-redis.mjs +1 -1
- package/dist/integrations/websocket-redis.mjs +1 -1
- package/dist/integrations/websocket.mjs +24 -6
- package/dist/{interface-DYPVscCU.mjs → interface-BIpgzbZl.mjs} +1 -1
- package/dist/{jsonBody-DVui0uJl.mjs → jsonBody-Cq9KYl2Z.mjs} +2 -2
- package/dist/{keys-BSuxGS-B.mjs → keys-Cmv4cBRa.mjs} +1 -1
- package/dist/{loadResources-CNd1DWnK.mjs → loadResources-CblF7xt2.mjs} +2 -2
- package/dist/{loadResourcesFromEntry-DNj8cpiY.mjs → loadResourcesFromEntry-99fIMC3p.mjs} +2 -2
- package/dist/logger/index.mjs +1 -1
- package/dist/{mcpPlugin-KWsezMx7.mjs → mcpPlugin-xF3Gw-HW.mjs} +75 -31
- package/dist/{memory-BiPVaCPg.mjs → memory-CpDZ9NPw.mjs} +2 -2
- package/dist/{metrics-CsWaIVTa.mjs → metrics-BaKnq8ag.mjs} +2 -2
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +3 -3
- package/dist/migrations/index.mjs +2 -2
- package/dist/{module-BQXHxMEk.mjs → module-BkQEesNQ.mjs} +1 -1
- package/dist/{multipartBody-u6VrS_iH.mjs → multipartBody-C92aJ8am.mjs} +1 -1
- package/dist/{openapi-Dxc8RLy_.mjs → openapi-C3LFRzPq.mjs} +6 -6
- package/dist/outbox-admin/index.d.mts +2 -2
- package/dist/outbox-admin/index.mjs +4 -4
- package/dist/{outbox-module-CQXu_O6o.d.mts → outbox-module-BHdUnuuK.d.mts} +15 -2
- package/dist/{outbox-module-DyIqA5vo.mjs → outbox-module-dsCyLxXH.mjs} +43 -21
- package/dist/permissions/index.d.mts +2 -2
- package/dist/permissions/index.mjs +5 -5
- package/dist/{permissions-H7Zcb82Z.mjs → permissions-DiHXy8Ck.mjs} +12 -6
- package/dist/{pipe-SunhEaZ6.mjs → pipe-CBVmUJ-j.mjs} +2 -2
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +2 -2
- package/dist/plugins/index.d.mts +7 -37
- package/dist/plugins/index.mjs +34 -22
- package/dist/plugins/response-cache.mjs +9 -2
- package/dist/plugins/tracing-entry.mjs +2 -2
- package/dist/{pluralize-Da7IT_qJ.mjs → pluralize-2_U6QZQg.mjs} +1 -1
- package/dist/{preloadResources-DlhH81py.mjs → preloadResources-Bbp4QJ8V.mjs} +82 -26
- package/dist/{preloadResources-BbBkNkqK.d.mts → preloadResources-CjS2OfpU.d.mts} +14 -9
- package/dist/presets/filesUpload.d.mts +2 -2
- package/dist/presets/filesUpload.mjs +5 -5
- package/dist/presets/index.d.mts +2 -2
- package/dist/presets/index.mjs +2 -2
- package/dist/presets/multiTenant.d.mts +38 -1
- package/dist/presets/multiTenant.mjs +24 -6
- package/dist/presets/search.d.mts +2 -2
- package/dist/presets/search.mjs +2 -2
- package/dist/{presets-CNyfaxGL.mjs → presets-BdlugYTc.mjs} +4 -4
- package/dist/{projection-DSfEoooA.mjs → projection-Uvgp-EEj.mjs} +2 -2
- package/dist/{queryCachePlugin-oTsmVyEQ.mjs → queryCachePlugin-B5F09bYr.mjs} +11 -5
- package/dist/rateLimitKey-CK-EU2L8.mjs +41 -0
- package/dist/{realtime-CPmjjgqd.mjs → realtime-FnnD0n3Z.mjs} +9 -9
- package/dist/{redis-CduhKsJi.d.mts → redis-Bzi1y3F9.d.mts} +10 -2
- package/dist/{redis-stream-eh0eOtjh.d.mts → redis-stream-BPKscsTB.d.mts} +12 -7
- package/dist/{registerRoute-XvcI_3sh.mjs → registerRoute-DRsSHPSM.mjs} +6 -6
- package/dist/registry/index.d.mts +2 -2
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-UFEJQN8R.mjs → registry-D3y8VEJ1.mjs} +2 -2
- package/dist/{renewingLease-DuRGVOMe.mjs → renewingLease-B3VYh5aU.mjs} +1 -1
- package/dist/{replyHelpers-BHebarf0.mjs → replyHelpers-DPHsdw-5.mjs} +2 -2
- package/dist/{requestContext-DpmntRZy.mjs → requestContext-cSVKnYPk.mjs} +1 -1
- package/dist/{rolldown-runtime-Add2L50I.mjs → rolldown-runtime-DjDuyglE.mjs} +1 -1
- package/dist/{runtimeCapabilities-D793Pxci.mjs → runtimeCapabilities-DSA_dH1_.mjs} +31 -5
- package/dist/{schedules-DthM8Qag.mjs → schedules-BktJb3Y3.mjs} +8 -4
- package/dist/{schemaConverter-Db-MMsH6.mjs → schemaConverter-BLCSmNbr.mjs} +1 -1
- package/dist/{schemaIR-CIXShch7.mjs → schemaIR-K16Bb5BX.mjs} +2 -2
- package/dist/schemas/index.mjs +1 -1
- package/dist/scim/index.mjs +2 -2
- package/dist/scope/index.mjs +5 -5
- package/dist/{scope-D03sk17n.mjs → scope-jSxuBTFM.mjs} +4 -4
- package/dist/{simpleEqualityMatcher-B7qVjQBv.mjs → simpleEqualityMatcher-BiOnyflP.mjs} +1 -1
- package/dist/{sse-D4MYqkic.mjs → sse-CH7Slxc1.mjs} +5 -5
- package/dist/{sseStream-BuMNPR6r.mjs → sseStream-CN-Lh1Tu.mjs} +2 -2
- package/dist/{store-helpers-CIF4RG8s.mjs → store-helpers-9DX9-1j_.mjs} +1 -1
- package/dist/{streaming-DkpW1HwJ.mjs → streaming-dvppnxsr.mjs} +1 -1
- package/dist/{subscribe-helpers-CBZOi6pk.mjs → subscribe-helpers-AVYPgqTl.mjs} +2 -2
- package/dist/sync/changelog.mjs +1 -1
- package/dist/testing/cleanupStoreContract.mjs +1 -1
- package/dist/testing/index.d.mts +5 -5
- package/dist/testing/index.mjs +10 -10
- package/dist/testing/outboxStoreContract.mjs +14 -3
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/{transactionContext-DMmvcfdo.mjs → transactionContext-DCWMI6hV.mjs} +1 -1
- package/dist/{typeGuards-DHTnEs5X.mjs → typeGuards-D7tHFdH6.mjs} +1 -1
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.mjs +1 -1
- package/dist/types/storage.mjs +1 -1
- package/dist/{types-BqLyyH0o.mjs → types-CDy3-zw1.mjs} +4 -4
- package/dist/{types-LQFwC37d.d.mts → types-CWQn9-IC.d.mts} +46 -1
- package/dist/{types-BRU-Kd3t.d.mts → types-DfVDvkdP.d.mts} +20 -2
- package/dist/usage/index.d.mts +58 -2
- package/dist/usage/index.mjs +0 -0
- package/dist/{userHelpers-CXySQFRg.mjs → userHelpers-DDMOZ_Pm.mjs} +1 -1
- package/dist/utils/index.d.mts +110 -8
- package/dist/utils/index.mjs +12 -12
- package/dist/{utils-BbGG8XNT.mjs → utils-B-zj_b__.mjs} +61 -12
- package/dist/{validate-CidSeUrx.mjs → validate-R0G_JrnK.mjs} +2 -2
- package/dist/{versioning-B843jOYX.d.mts → versioning-D6JIK8Tk.d.mts} +58 -2
- package/dist/{versioning-C2r0eOZ4.mjs → versioning-DuVWcu-F.mjs} +3 -3
- package/dist/workScope-BhsWde4k.mjs +41 -0
- package/package.json +574 -565
- package/skills/arc/SKILL.md +8 -4
- package/skills/arc/references/mcp.md +20 -0
- package/skills/arc/references/production.md +94 -9
- package/skills/arc/references/testing.md +0 -12
- package/skills/arc-code-review/references/anti-patterns.md +1 -1
- package/skills/arc-code-review/references/migration-recipes.md +0 -60
- package/skills/arc-code-review/references/mongokit-migration.md +0 -27
- package/skills/arc-module-publishing/references/package-manifest.md +3 -1
- package/dist/rateLimitKey-CewdR-m6.mjs +0 -15
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
2
|
import * as fs from "node:fs/promises";
|
|
3
3
|
import * as path from "node:path";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
@@ -605,7 +605,7 @@ export const authResource = defineResource({
|
|
|
605
605
|
tag: 'Authentication',
|
|
606
606
|
prefix: '/auth',
|
|
607
607
|
|
|
608
|
-
adapter: createAdapter(User${ts ? " as
|
|
608
|
+
adapter: createAdapter(User${ts ? " as never" : ""}, userRepository${ts ? " as never" : ""}),
|
|
609
609
|
disableDefaultRoutes: true,
|
|
610
610
|
|
|
611
611
|
routes: [
|
|
@@ -661,7 +661,7 @@ export const userProfileResource = defineResource({
|
|
|
661
661
|
tag: 'User Profile',
|
|
662
662
|
prefix: '/users',
|
|
663
663
|
|
|
664
|
-
adapter: createAdapter(User${ts ? " as
|
|
664
|
+
adapter: createAdapter(User${ts ? " as never" : ""}, userRepository${ts ? " as never" : ""}),
|
|
665
665
|
disableDefaultRoutes: true,
|
|
666
666
|
|
|
667
667
|
routes: [
|
|
@@ -702,7 +702,7 @@ import { mongodbAdapter } from '@better-auth/mongo-adapter';` : "";
|
|
|
702
702
|
useBearer ? `import { bearer } from 'better-auth/plugins/bearer';` : "",
|
|
703
703
|
useApiKey ? `import { apiKey } from '@better-auth/api-key';` : ""
|
|
704
704
|
].filter(Boolean).join("\n");
|
|
705
|
-
const dbAdapter = useMongo ? config.typescript ? `database: mongodbAdapter(mongoose.connection.getClient().db() as
|
|
705
|
+
const dbAdapter = useMongo ? config.typescript ? `database: mongodbAdapter(mongoose.connection.getClient().db() as never),` : `database: mongodbAdapter(mongoose.connection.getClient().db()),` : `// Configure your database adapter here
|
|
706
706
|
// See: https://www.better-auth.com/docs/concepts/database`;
|
|
707
707
|
const pluginEntries = [
|
|
708
708
|
useBearer ? ` bearer(),` : "",
|
|
@@ -962,7 +962,7 @@ export async function resetPassword(request${ts ? ": FastifyRequest" : ""}, repl
|
|
|
962
962
|
*/
|
|
963
963
|
export async function getUserProfile(request${ts ? ": FastifyRequest" : ""}, reply${ts ? ": FastifyReply" : ""}) {
|
|
964
964
|
try {
|
|
965
|
-
const requestUser = (request${ts ? " as
|
|
965
|
+
const requestUser = (request${ts ? " as { user?: { _id?: string; id?: string } }" : ""}).user;
|
|
966
966
|
const userId = requestUser?._id || requestUser?.id;
|
|
967
967
|
if (!userId) {
|
|
968
968
|
return reply.code(401).send({ error: 'Authentication required', code: 'arc.unauthorized' });
|
|
@@ -985,7 +985,7 @@ export async function getUserProfile(request${ts ? ": FastifyRequest" : ""}, rep
|
|
|
985
985
|
*/
|
|
986
986
|
export async function updateUserProfile(request${ts ? ": FastifyRequest" : ""}, reply${ts ? ": FastifyReply" : ""}) {
|
|
987
987
|
try {
|
|
988
|
-
const requestUser = (request${ts ? " as
|
|
988
|
+
const requestUser = (request${ts ? " as { user?: { _id?: string; id?: string } }" : ""}).user;
|
|
989
989
|
const userId = requestUser?._id || requestUser?.id;
|
|
990
990
|
if (!userId) {
|
|
991
991
|
return reply.code(401).send({ error: 'Authentication required', code: 'arc.unauthorized' });
|
|
@@ -2727,7 +2727,7 @@ interface FlexibleMultiTenantOptions {
|
|
|
2727
2727
|
tenantField?: string;
|
|
2728
2728
|
}
|
|
2729
2729
|
` : `
|
|
2730
|
-
|
|
2730
|
+
import { multiTenantPreset } from '@classytic/arc/presets/tenant';
|
|
2731
2731
|
`}
|
|
2732
2732
|
export function flexibleMultiTenantPreset(options${ts ? ": FlexibleMultiTenantOptions = {}" : " = {}"}) {
|
|
2733
2733
|
const { tenantField = 'organizationId' } = options;
|
|
@@ -2972,7 +2972,7 @@ ${ts ? "import type { UserDocument } from './user.model.js';\nimport type { Clie
|
|
|
2972
2972
|
${ts ? "type ID = string | Types.ObjectId;\n" : ""}
|
|
2973
2973
|
class UserRepository extends Repository${ts ? "<UserDocument>" : ""} {
|
|
2974
2974
|
constructor() {
|
|
2975
|
-
super(User${ts ? " as
|
|
2975
|
+
super(User${ts ? " as never" : ""}, [
|
|
2976
2976
|
methodRegistryPlugin(),
|
|
2977
2977
|
mongoOperationsPlugin(),
|
|
2978
2978
|
]);
|
|
@@ -3058,7 +3058,7 @@ import userRepository from './user.repository.js';
|
|
|
3058
3058
|
|
|
3059
3059
|
class UserController extends BaseController {
|
|
3060
3060
|
constructor() {
|
|
3061
|
-
super(userRepository${config.typescript ? " as
|
|
3061
|
+
super(userRepository${config.typescript ? " as never" : ""});
|
|
3062
3062
|
}
|
|
3063
3063
|
|
|
3064
3064
|
// Custom user operations can be added here
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
import { n as DomainEvent } from "../EventTransport-
|
|
2
|
+
import { n as DomainEvent } from "../EventTransport-CbUKDzZZ.mjs";
|
|
3
3
|
import { c as WebSocketClient, l as WebSocketMessage } from "../websocket-BOXVggMf.mjs";
|
|
4
4
|
import { FastifyPluginAsync, FastifyRequest } from "fastify";
|
|
5
5
|
//#region src/integrations/event-gateway.d.ts
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
2
|
import fp from "fastify-plugin";
|
|
3
3
|
//#region src/integrations/event-gateway.ts
|
|
4
4
|
const eventGatewayPluginImpl = async (fastify, opts = {}) => {
|
|
5
5
|
const { auth = true, orgScoped = false, roomPolicy, maxMessageBytes, maxSubscriptionsPerClient, authenticate } = opts;
|
|
6
6
|
if (auth && !authenticate && !fastify.hasDecorator("authenticate")) throw new Error("[arc-event-gateway] auth is true but fastify.authenticate is not registered. Register an auth plugin first, provide a custom authenticate function, or set auth: false.");
|
|
7
7
|
if (opts.sse !== false) {
|
|
8
|
-
const { default: ssePlugin } = await import("../sse-
|
|
8
|
+
const { default: ssePlugin } = await import("../sse-CH7Slxc1.mjs").then((n) => n.r);
|
|
9
9
|
await fastify.register(ssePlugin, {
|
|
10
10
|
path: opts.sse?.path ?? "/events/stream",
|
|
11
11
|
requireAuth: auth,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
2
|
import { c as WebSocketClient, l as WebSocketMessage, u as WebSocketPluginOptions } from "../websocket-BOXVggMf.mjs";
|
|
3
3
|
import { EventGatewayOptions } from "./event-gateway.mjs";
|
|
4
|
-
import { a as JobMeta, c as JobsPluginOptions, i as JobDispatcher, l as QueueStats, n as JobDefinition, r as JobDispatchOptions } from "../index-
|
|
5
|
-
import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-
|
|
4
|
+
import { a as JobMeta, c as JobsPluginOptions, i as JobDispatcher, l as QueueStats, n as JobDefinition, r as JobDispatchOptions } from "../index-CbJiYrfv.mjs";
|
|
5
|
+
import { _ as ToolDefinition, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, n as CallToolResult, o as CrudOperation, r as CreateMcpServerConfig, t as BetterAuthHandler, u as McpPluginOptions } from "../types-CWQn9-IC.mjs";
|
|
6
6
|
import { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike } from "./streamline.mjs";
|
|
7
7
|
import { WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription } from "./webhooks.mjs";
|
|
8
8
|
export type { BetterAuthHandler, CallToolResult, CreateMcpServerConfig, CrudOperation, EventGatewayOptions, JobDefinition, JobDispatchOptions, JobDispatcher, JobMeta, JobsPluginOptions, McpAuthResult, McpPluginOptions, McpResourceConfig, PromptDefinition, QueueStats, StreamlinePluginOptions, ToolAnnotations, ToolContext, ToolDefinition, WebSocketClient, WebSocketMessage, WebSocketPluginOptions, WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription, WorkflowLike, WorkflowRunLike };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
2
|
export {};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as JobMeta, c as JobsPluginOptions, d as ExecuteTimedHandlerOptions, f as TimedHandlerLogger, i as JobDispatcher, l as QueueStats, n as JobDefinition, o as JobRepeatOptions, p as executeTimedHandler, r as JobDispatchOptions, s as JobStatus, t as jobsPlugin, u as defineJob } from "../../index-
|
|
2
|
+
import { a as JobMeta, c as JobsPluginOptions, d as ExecuteTimedHandlerOptions, f as TimedHandlerLogger, i as JobDispatcher, l as QueueStats, n as JobDefinition, o as JobRepeatOptions, p as executeTimedHandler, r as JobDispatchOptions, s as JobStatus, t as jobsPlugin, u as defineJob } from "../../index-CbJiYrfv.mjs";
|
|
3
3
|
export { type ExecuteTimedHandlerOptions, type JobDefinition, type JobDispatchOptions, type JobDispatcher, type JobMeta, type JobRepeatOptions, type JobStatus, type JobsPluginOptions, type QueueStats, type TimedHandlerLogger, defineJob, executeTimedHandler, jobsPlugin };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as evaluateAndApplyPermission } from "../../authorizationDecision-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as evaluateAndApplyPermission } from "../../authorizationDecision-2YY_Kaj1.mjs";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
//#region src/integrations/jobs/execution.ts
|
|
5
5
|
async function executeTimedHandler(options) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { i as RequestScope } from "../../types-Ddl9OjmE.mjs";
|
|
3
|
-
import { l as PermissionCheck } from "../../base-
|
|
4
|
-
import { Fn as IControllerResponse, In as IRequestContext, V as ResourceDefinition, zn as ServerAccessor } from "../../index-
|
|
3
|
+
import { l as PermissionCheck } from "../../base-CxrV1LmG.mjs";
|
|
4
|
+
import { Fn as IControllerResponse, In as IRequestContext, V as ResourceDefinition, zn as ServerAccessor } from "../../index-DHbyPo5j.mjs";
|
|
5
5
|
import { n as FieldPermissionMap } from "../../fields-I_EeRWND.mjs";
|
|
6
|
-
import { _ as ToolDefinition, a as CrudDescriptionOverride, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, i as CrudDescriptionMeta, l as McpExecutionWiring, m as SessionEntry, n as CallToolResult, o as CrudOperation, p as PromptResult, r as CreateMcpServerConfig, s as McpAuthResolver, t as BetterAuthHandler, u as McpPluginOptions } from "../../types-
|
|
6
|
+
import { _ as ToolDefinition, a as CrudDescriptionOverride, c as McpAuthResult, d as McpResourceConfig, f as PromptDefinition, g as ToolContext, h as ToolAnnotations, i as CrudDescriptionMeta, l as McpExecutionWiring, m as SessionEntry, n as CallToolResult, o as CrudOperation, p as PromptResult, r as CreateMcpServerConfig, s as McpAuthResolver, t as BetterAuthHandler, u as McpPluginOptions } from "../../types-CWQn9-IC.mjs";
|
|
7
|
+
import { i as resolveToolCollisions, n as McpServerInstance, r as createMcpServer, t as AuthRef } from "../../createMcpServer-CbDWkZ1T.mjs";
|
|
7
8
|
import { ErrorContract } from "@classytic/repo-core/errors";
|
|
8
9
|
import { FastifyPluginAsync } from "fastify";
|
|
9
10
|
import { z } from "zod";
|
|
@@ -96,50 +97,6 @@ interface CreateMcpAuthFromBetterAuthApiKeyOptions {
|
|
|
96
97
|
*/
|
|
97
98
|
declare function createMcpAuthFromBetterAuthApiKey(auth: BetterAuthHandler, options?: CreateMcpAuthFromBetterAuthApiKeyOptions): McpAuthResolver;
|
|
98
99
|
//#endregion
|
|
99
|
-
//#region src/integrations/mcp/createMcpServer.d.ts
|
|
100
|
-
/**
|
|
101
|
-
* Mutable auth ref — updated per-request by mcpPlugin.
|
|
102
|
-
* Tool handlers read from this to get the current request's auth context.
|
|
103
|
-
*/
|
|
104
|
-
interface AuthRef {
|
|
105
|
-
current: McpAuthResult | null;
|
|
106
|
-
}
|
|
107
|
-
/**
|
|
108
|
-
* Create a configured MCP server from declarative config.
|
|
109
|
-
*
|
|
110
|
-
* @param config - Server name, version, tools, prompts
|
|
111
|
-
* @returns McpServer instance (not yet connected to a transport)
|
|
112
|
-
*/
|
|
113
|
-
declare function createMcpServer(config: CreateMcpServerConfig, authRef?: AuthRef): Promise<McpServerInstance>;
|
|
114
|
-
/**
|
|
115
|
-
* Detect and resolve duplicate MCP tool names across the assembled tool list.
|
|
116
|
-
*
|
|
117
|
-
* Two outcomes:
|
|
118
|
-
*
|
|
119
|
-
* 1. **Auto-namespace** — when one tool's `source` carries a `preset:<name>`
|
|
120
|
-
* prefix and the other doesn't, the preset tool is renamed to
|
|
121
|
-
* `<presetName>_<originalName>` (e.g. softDelete's `restore_post`
|
|
122
|
-
* becomes `softdelete_restore_post` when the user defines
|
|
123
|
-
* `actions.restore`). The user's tool wins the canonical name because
|
|
124
|
-
* it's the more-specific intent.
|
|
125
|
-
*
|
|
126
|
-
* 2. **Typed throw** — every other collision (two user actions, two
|
|
127
|
-
* custom routes, two presets) raises `ArcError('arc.mcp.tool_name_collision')`
|
|
128
|
-
* naming both sources so the host's stack trace points at the
|
|
129
|
-
* resource definitions, not the MCP SDK internals.
|
|
130
|
-
*
|
|
131
|
-
* Exported for the testing harness so collision behaviour can be exercised
|
|
132
|
-
* without a full server boot.
|
|
133
|
-
*/
|
|
134
|
-
declare function resolveToolCollisions(tools: readonly ToolDefinition[]): ToolDefinition[];
|
|
135
|
-
/** Minimal interface for McpServer — avoids hard SDK type dependency */
|
|
136
|
-
interface McpServerInstance {
|
|
137
|
-
connect: (transport: unknown) => Promise<void>;
|
|
138
|
-
registerTool: (name: string, config: Record<string, unknown>, handler: (input: Record<string, unknown>, extra: Record<string, unknown>) => unknown) => unknown;
|
|
139
|
-
registerPrompt: (name: string, config: Record<string, unknown>, handler: (args: Record<string, unknown>) => unknown) => void;
|
|
140
|
-
resource: (...args: unknown[]) => void;
|
|
141
|
-
}
|
|
142
|
-
//#endregion
|
|
143
100
|
//#region src/integrations/mcp/crud-tools.d.ts
|
|
144
101
|
/**
|
|
145
102
|
* Default description for a CRUD tool. Enriches list descriptions with the
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { a as defaultCrudDescription, c as mcpHandlerAdapter, d as toCallToolResult, f as toCallToolSuccess, h as resolveToolCollisions, i as fieldRulesToZod, l as permissionDeniedResult, m as createMcpServer, n as mcpPlugin, o as resolveCrudDescription, p as buildRequestContext, r as resourceToTools, s as invokeController, t as filterResourcesForMcp, u as toCallToolError } from "../../mcpPlugin-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as defaultCrudDescription, c as mcpHandlerAdapter, d as toCallToolResult, f as toCallToolSuccess, h as resolveToolCollisions, i as fieldRulesToZod, l as permissionDeniedResult, m as createMcpServer, n as mcpPlugin, o as resolveCrudDescription, p as buildRequestContext, r as resourceToTools, s as invokeController, t as filterResourcesForMcp, u as toCallToolError } from "../../mcpPlugin-xF3Gw-HW.mjs";
|
|
3
3
|
//#region src/integrations/mcp/defineTool.ts
|
|
4
4
|
/**
|
|
5
5
|
* Define a type-safe MCP tool.
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
|
|
2
|
-
import { c as McpAuthResult, u as McpPluginOptions } from "../../types-
|
|
2
|
+
import { c as McpAuthResult, u as McpPluginOptions } from "../../types-CWQn9-IC.mjs";
|
|
3
|
+
import { n as McpServerInstance } from "../../createMcpServer-CbDWkZ1T.mjs";
|
|
4
|
+
import { Client } from "@modelcontextprotocol/client";
|
|
3
5
|
//#region src/integrations/mcp/testing.d.ts
|
|
6
|
+
/** An MCP client bound to a live loopback server, plus its teardown. */
|
|
7
|
+
interface ConnectedMcpTestClient {
|
|
8
|
+
/** The connected SDK client — full `listTools` / `callTool` / `listPrompts` surface. */
|
|
9
|
+
client: Client;
|
|
10
|
+
/** Closes the client and the HTTP server. Always await it. */
|
|
11
|
+
close: () => Promise<void>;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Serve an already-built `McpServer` on an ephemeral loopback port and connect
|
|
15
|
+
* a client to it.
|
|
16
|
+
*
|
|
17
|
+
* Split out from {@link createTestMcpClient} because arc's own MCP suites build
|
|
18
|
+
* a server directly and only need the connection — five of them had each grown a
|
|
19
|
+
* private copy of the same connect helper against the v1 in-memory transport.
|
|
20
|
+
* One implementation, two entry points: this for a server you built, that for
|
|
21
|
+
* one built from resources.
|
|
22
|
+
*/
|
|
23
|
+
declare function connectMcpTestClient(server: McpServerInstance | unknown): Promise<ConnectedMcpTestClient>;
|
|
4
24
|
interface TestMcpClientOptions {
|
|
5
25
|
/** MCP plugin options (resources, overrides, etc.) — same as mcpPlugin config */
|
|
6
26
|
pluginOptions?: Pick<McpPluginOptions, "resources" | "overrides" | "expose" | "exclude" | "toolNamePrefix" | "extraTools" | "extraPrompts" | "instructions">;
|
|
@@ -50,4 +70,4 @@ interface TestMcpClient {
|
|
|
50
70
|
*/
|
|
51
71
|
declare function createTestMcpClient(options?: TestMcpClientOptions): Promise<TestMcpClient>;
|
|
52
72
|
//#endregion
|
|
53
|
-
export { TestMcpClient, TestMcpClientOptions, createTestMcpClient };
|
|
73
|
+
export { ConnectedMcpTestClient, TestMcpClient, TestMcpClientOptions, connectMcpTestClient, createTestMcpClient };
|
|
@@ -1,26 +1,58 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { m as createMcpServer, r as resourceToTools, t as filterResourcesForMcp } from "../../mcpPlugin-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { m as createMcpServer, r as resourceToTools, t as filterResourcesForMcp } from "../../mcpPlugin-xF3Gw-HW.mjs";
|
|
3
3
|
//#region src/integrations/mcp/testing.ts
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Serve an already-built `McpServer` on an ephemeral loopback port and connect
|
|
6
|
+
* a client to it.
|
|
6
7
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* import { createTestMcpClient } from '@classytic/arc/mcp/testing';
|
|
13
|
-
*
|
|
14
|
-
* const client = await createTestMcpClient({
|
|
15
|
-
* pluginOptions: { resources: [productResource] },
|
|
16
|
-
* auth: { userId: 'test-user', organizationId: 'org-1' },
|
|
17
|
-
* });
|
|
18
|
-
*
|
|
19
|
-
* const tools = await client.listTools();
|
|
20
|
-
* const result = await client.callTool('list_products', { limit: 5 });
|
|
21
|
-
* await client.close();
|
|
22
|
-
* ```
|
|
8
|
+
* Split out from {@link createTestMcpClient} because arc's own MCP suites build
|
|
9
|
+
* a server directly and only need the connection — five of them had each grown a
|
|
10
|
+
* private copy of the same connect helper against the v1 in-memory transport.
|
|
11
|
+
* One implementation, two entry points: this for a server you built, that for
|
|
12
|
+
* one built from resources.
|
|
23
13
|
*/
|
|
14
|
+
async function connectMcpTestClient(server) {
|
|
15
|
+
const { randomUUID } = await import("node:crypto");
|
|
16
|
+
const { createServer } = await import("node:http");
|
|
17
|
+
const { NodeStreamableHTTPServerTransport } = await import("@modelcontextprotocol/node");
|
|
18
|
+
const { Client, StreamableHTTPClientTransport } = await import("@modelcontextprotocol/client");
|
|
19
|
+
const serverTransport = new NodeStreamableHTTPServerTransport({ sessionIdGenerator: () => randomUUID() });
|
|
20
|
+
await server.connect(serverTransport);
|
|
21
|
+
const httpServer = createServer((req, res) => {
|
|
22
|
+
serverTransport.handleRequest(req, res);
|
|
23
|
+
});
|
|
24
|
+
await new Promise((resolve, reject) => {
|
|
25
|
+
httpServer.once("error", reject);
|
|
26
|
+
httpServer.listen(0, "127.0.0.1", resolve);
|
|
27
|
+
});
|
|
28
|
+
const address = httpServer.address();
|
|
29
|
+
if (address === null || typeof address === "string") {
|
|
30
|
+
httpServer.close();
|
|
31
|
+
throw new Error("[arc] MCP test harness: HTTP server did not bind a TCP port");
|
|
32
|
+
}
|
|
33
|
+
const client = new Client({
|
|
34
|
+
name: "test-client",
|
|
35
|
+
version: "1.0"
|
|
36
|
+
});
|
|
37
|
+
await client.connect(new StreamableHTTPClientTransport(new URL(`http://127.0.0.1:${address.port}/`)));
|
|
38
|
+
return {
|
|
39
|
+
client,
|
|
40
|
+
/**
|
|
41
|
+
* Client first, THEN the socket. Reversed, the client's in-flight request
|
|
42
|
+
* hangs on a dead server until its own timeout — which reads as a slow test
|
|
43
|
+
* rather than a teardown bug. `httpServer.close()` only stops NEW
|
|
44
|
+
* connections, so keep-alive sockets are destroyed explicitly; without that
|
|
45
|
+
* vitest hangs at end-of-file with no failing assertion.
|
|
46
|
+
*/
|
|
47
|
+
async close() {
|
|
48
|
+
await client.close();
|
|
49
|
+
httpServer.closeAllConnections?.();
|
|
50
|
+
await new Promise((resolve, reject) => {
|
|
51
|
+
httpServer.close((err) => err ? reject(err) : resolve());
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
24
56
|
/**
|
|
25
57
|
* Create an in-process MCP test client connected to an Arc MCP server.
|
|
26
58
|
*
|
|
@@ -44,8 +76,6 @@ import { m as createMcpServer, r as resourceToTools, t as filterResourcesForMcp
|
|
|
44
76
|
* ```
|
|
45
77
|
*/
|
|
46
78
|
async function createTestMcpClient(options = {}) {
|
|
47
|
-
const { InMemoryTransport } = await import("@modelcontextprotocol/sdk/inMemory.js");
|
|
48
|
-
const { Client } = await import("@modelcontextprotocol/sdk/client/index.js");
|
|
49
79
|
const pluginOpts = {
|
|
50
80
|
resources: [],
|
|
51
81
|
...options.pluginOptions
|
|
@@ -65,19 +95,13 @@ async function createTestMcpClient(options = {}) {
|
|
|
65
95
|
});
|
|
66
96
|
if (pluginOpts.extraTools) tools.push(...pluginOpts.extraTools);
|
|
67
97
|
const authRef = { current: auth };
|
|
68
|
-
const
|
|
98
|
+
const { client, close } = await connectMcpTestClient(await createMcpServer({
|
|
69
99
|
name: serverName,
|
|
70
100
|
version: "1.0.0",
|
|
71
101
|
instructions: pluginOpts.instructions,
|
|
72
102
|
tools,
|
|
73
103
|
prompts: pluginOpts.extraPrompts
|
|
74
|
-
}, authRef);
|
|
75
|
-
const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
|
|
76
|
-
const client = new Client({
|
|
77
|
-
name: "test-client",
|
|
78
|
-
version: "1.0"
|
|
79
|
-
});
|
|
80
|
-
await Promise.all([client.connect(clientTransport), server.connect(serverTransport)]);
|
|
104
|
+
}, authRef));
|
|
81
105
|
return {
|
|
82
106
|
async listTools() {
|
|
83
107
|
return (await client.listTools()).tools.map((t) => ({
|
|
@@ -91,10 +115,8 @@ async function createTestMcpClient(options = {}) {
|
|
|
91
115
|
arguments: args ?? {}
|
|
92
116
|
});
|
|
93
117
|
},
|
|
94
|
-
|
|
95
|
-
await client.close();
|
|
96
|
-
}
|
|
118
|
+
close
|
|
97
119
|
};
|
|
98
120
|
}
|
|
99
121
|
//#endregion
|
|
100
|
-
export { createTestMcpClient };
|
|
122
|
+
export { connectMcpTestClient, createTestMcpClient };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { f as createError, i as NotFoundError, r as ForbiddenError } from "../errors-
|
|
3
|
-
import { a as promoteStreamTokenToHeader, n as forwardedStreamHeaders } from "../streaming-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { f as createError, i as NotFoundError, r as ForbiddenError } from "../errors-C_YhELhe.mjs";
|
|
3
|
+
import { a as promoteStreamTokenToHeader, n as forwardedStreamHeaders } from "../streaming-dvppnxsr.mjs";
|
|
4
4
|
import fp from "fastify-plugin";
|
|
5
5
|
//#region src/integrations/streamline.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
|
-
import { a as EventTransport, n as DomainEvent } from "../EventTransport-
|
|
3
|
-
import { n as OutboxModuleOptions, r as createOutboxModule } from "../outbox-module-
|
|
2
|
+
import { a as EventTransport, n as DomainEvent } from "../EventTransport-CbUKDzZZ.mjs";
|
|
3
|
+
import { n as OutboxModuleOptions, r as createOutboxModule } from "../outbox-module-BHdUnuuK.mjs";
|
|
4
4
|
import { FastifyPluginAsync } from "fastify";
|
|
5
5
|
import { OutboxFailurePolicy, OutboxStore } from "@classytic/primitives/outbox";
|
|
6
6
|
//#region src/integrations/webhooks.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as declareRuntimeCapability } from "../runtimeCapabilities-
|
|
3
|
-
import { i as exponentialBackoff, t as createOutboxModule } from "../outbox-module-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as declareRuntimeCapability } from "../runtimeCapabilities-DSA_dH1_.mjs";
|
|
3
|
+
import { i as exponentialBackoff, t as createOutboxModule } from "../outbox-module-dsCyLxXH.mjs";
|
|
4
4
|
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
5
5
|
import fp from "fastify-plugin";
|
|
6
6
|
import { createChildEvent } from "@classytic/primitives/events";
|
|
@@ -9,7 +9,7 @@ import { c as SerializedEntry, i as Principal, n as FencedWriteOutcome, s as Pus
|
|
|
9
9
|
*/
|
|
10
10
|
interface RedisLike {
|
|
11
11
|
get(key: string): Promise<string | null>;
|
|
12
|
-
set(key: string, value: string,
|
|
12
|
+
set(key: string, value: string, ...args: unknown[]): Promise<unknown>;
|
|
13
13
|
del(key: string): Promise<number>;
|
|
14
14
|
pexpire(key: string, ttlMs: number): Promise<number>;
|
|
15
15
|
scan(cursor: string | number, matchKw: "MATCH", pattern: string, countKw: "COUNT", count: number): Promise<[string, string[]]>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as declareRuntimeCapability } from "../runtimeCapabilities-DSA_dH1_.mjs";
|
|
2
3
|
import { randomUUID } from "node:crypto";
|
|
3
4
|
import sjson from "secure-json-parse";
|
|
4
5
|
import fp from "fastify-plugin";
|
|
@@ -968,7 +969,7 @@ async function handleConnection(ctx, socket, request) {
|
|
|
968
969
|
socket.close(4003, "Session expired");
|
|
969
970
|
}
|
|
970
971
|
}, options.reauthInterval);
|
|
971
|
-
socket.on("message", async (
|
|
972
|
+
socket.on("message", (raw) => safeAsync((async () => {
|
|
972
973
|
if ((typeof raw === "string" ? Buffer.byteLength(raw) : raw.length) > options.maxMessageBytes) {
|
|
973
974
|
socket.send(JSON.stringify({
|
|
974
975
|
type: "error",
|
|
@@ -1057,12 +1058,19 @@ async function handleConnection(ctx, socket, request) {
|
|
|
1057
1058
|
}
|
|
1058
1059
|
default: await options.onMessage?.(client, msg);
|
|
1059
1060
|
}
|
|
1060
|
-
});
|
|
1061
|
-
socket.on("close", async () => {
|
|
1061
|
+
})(), fastify.log, "ws.message", { clientId }));
|
|
1062
|
+
socket.on("close", () => safeAsync((async () => {
|
|
1062
1063
|
if (heartbeatTimer) clearInterval(heartbeatTimer);
|
|
1063
1064
|
if (reauthTimer) clearInterval(reauthTimer);
|
|
1064
1065
|
if (rooms.getClient(clientId)?.socket === socket) {
|
|
1065
|
-
|
|
1066
|
+
try {
|
|
1067
|
+
await options.onDisconnect?.(client);
|
|
1068
|
+
} catch (err) {
|
|
1069
|
+
fastify.log.warn({
|
|
1070
|
+
err,
|
|
1071
|
+
clientId
|
|
1072
|
+
}, "[arc] websocket onDisconnect threw");
|
|
1073
|
+
}
|
|
1066
1074
|
rooms.removeClient(clientId);
|
|
1067
1075
|
}
|
|
1068
1076
|
queue.dispose();
|
|
@@ -1070,7 +1078,7 @@ async function handleConnection(ctx, socket, request) {
|
|
|
1070
1078
|
pushRef,
|
|
1071
1079
|
generation
|
|
1072
1080
|
});
|
|
1073
|
-
});
|
|
1081
|
+
})(), fastify.log, "ws.close", { clientId }));
|
|
1074
1082
|
socket.on("error", () => {
|
|
1075
1083
|
if (heartbeatTimer) clearInterval(heartbeatTimer);
|
|
1076
1084
|
if (reauthTimer) clearInterval(reauthTimer);
|
|
@@ -1483,6 +1491,16 @@ const websocketPluginImpl = async (fastify, options) => {
|
|
|
1483
1491
|
...options.pushRefStore ? { store: options.pushRefStore } : {}
|
|
1484
1492
|
});
|
|
1485
1493
|
const rooms = new RoomManager(maxClientsPerRoom, adapter ?? new LocalWebSocketAdapter(), pushRefRegistry, fastify.log);
|
|
1494
|
+
declareRuntimeCapability(fastify, {
|
|
1495
|
+
subsystem: "websocket.adapter",
|
|
1496
|
+
durability: adapter ? "shared" : "memory",
|
|
1497
|
+
detail: "LocalWebSocketAdapter: a broadcast reaches only this replica's sockets"
|
|
1498
|
+
});
|
|
1499
|
+
declareRuntimeCapability(fastify, {
|
|
1500
|
+
subsystem: "websocket.pushref-store",
|
|
1501
|
+
durability: options.pushRefStore ? "shared" : "memory",
|
|
1502
|
+
detail: "MemoryPushRefStore: a client reconnecting through another replica loses its dead queue (RESUME replays nothing)"
|
|
1503
|
+
});
|
|
1486
1504
|
if (adapter) await adapter.subscribe((room, message) => {
|
|
1487
1505
|
if (room.startsWith("org:")) {
|
|
1488
1506
|
const parts = room.split(":");
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as ArcError } from "./errors-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as ArcError } from "./errors-C_YhELhe.mjs";
|
|
3
3
|
import sjson from "secure-json-parse";
|
|
4
4
|
//#region src/utils/jsonBody.ts
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DjDuyglE.mjs";
|
|
3
3
|
import { arcLog } from "./logger/index.mjs";
|
|
4
4
|
import { readdir } from "node:fs/promises";
|
|
5
5
|
import { dirname, join, resolve } from "node:path";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as ResourceRegistry } from "./ResourceRegistry-
|
|
1
|
+
/*! @classytic/arc v2.41.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as ResourceRegistry } from "./ResourceRegistry-Cu7uTJp9.mjs";
|
|
3
3
|
import { resolve } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
//#region src/cli/utils/loadResourcesFromEntry.ts
|
package/dist/logger/index.mjs
CHANGED