@classytic/arc 2.31.0 → 2.33.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/README.md +1 -1
- package/bin/arc.js +58 -17
- package/dist/{BaseController-De7GqHck.mjs → BaseController-CaQC5EXX.mjs} +298 -35
- package/dist/{EventTransport-2uVV34WU.d.mts → EventTransport-BEVP50ka.d.mts} +16 -0
- package/dist/{EventTransport-9mlTgqzE.mjs → EventTransport-tq4CEB-q.mjs} +39 -2
- package/dist/{HookSystem-BcmPyq5I.mjs → HookSystem-DqXkMXkB.mjs} +2 -2
- package/dist/{ResourceRegistry-qq0mn2s9.mjs → ResourceRegistry-DoALUlOO.mjs} +18 -15
- package/dist/{actionPermissions-BE5NwaQk.mjs → actionPermissions-CUeCmpUd.mjs} +1 -1
- package/dist/audit/index.d.mts +2 -2
- package/dist/audit/index.mjs +2 -2
- package/dist/auth/audit.mjs +1 -1
- package/dist/auth/index.d.mts +2 -2
- package/dist/auth/index.mjs +44 -11
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/{authorizationDecision-ChvUQGG1.mjs → authorizationDecision-B3mP_QTy.mjs} +2 -2
- package/dist/{types-B7XeLEgK.d.mts → base-Csjc2oF-.d.mts} +74 -74
- package/dist/{buildHandler-CDrCJzmB.mjs → buildHandler-DLE9xX-V.mjs} +6 -5
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-BFHA6Scf.mjs → caching-BcGmvnHh.mjs} +2 -2
- package/dist/cleanup/index.d.mts +52 -18
- package/dist/cleanup/index.mjs +281 -32
- package/dist/cli/commands/describe.d.mts +1 -1
- package/dist/cli/commands/describe.mjs +4 -6
- 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-D3Dv4LAV.mjs → constants-BxCoxmiN.mjs} +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +7 -7
- package/dist/{core-BGpIxINN.mjs → core-dxhcHhUD.mjs} +3 -3
- package/dist/{createActionRouter-CDXEdasl.mjs → createActionRouter-DVpoA0do.mjs} +14 -11
- package/dist/{createAggregationRouter-KrQDzx-k.mjs → createAggregationRouter-B_B48JZ-.mjs} +10 -8
- package/dist/{createApp-Df89BEni.mjs → createApp-CLGegqiG.mjs} +287 -62
- package/dist/{defineAggregation-DbPPS8RI.mjs → defineAggregation-Nv-DwfOf.mjs} +1 -1
- package/dist/{defineResource-Bv6EtN1x.mjs → defineResource-DR9vsUYy.mjs} +318 -35
- 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-D2l1mh4g.mjs → elevation-B0tlY8y1.mjs} +4 -4
- package/dist/encryption/index.mjs +5 -4
- package/dist/{errorHandler-C5NeD6bT.mjs → errorHandler-C7xBqHsI.mjs} +42 -5
- package/dist/{errorHandler-CpYUJmPA.d.mts → errorHandler-DI5AN2b5.d.mts} +14 -3
- package/dist/{errors-Cj42AntO.mjs → errors-Cd_yy7aW.mjs} +1 -1
- package/dist/{eventPlugin-GF5nnBIq.d.mts → eventPlugin-DSNEZWfV.d.mts} +29 -1
- package/dist/{eventPlugin-CkffEihm.mjs → eventPlugin-Dar8qRaj.mjs} +68 -11
- package/dist/events/index.d.mts +18 -297
- package/dist/events/index.mjs +7 -758
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis-stream-entry.mjs +14 -10
- package/dist/events/transports/redis.d.mts +1 -1
- package/dist/events/transports/redis.mjs +1 -1
- package/dist/factory/index.d.mts +20 -5
- package/dist/factory/index.mjs +131 -8
- package/dist/fastify-augmentation-DVsTAy6X.d.mts +179 -0
- package/dist/{fields-CB5Cuzk9.mjs → fields-CojeUkS4.mjs} +6 -11
- package/dist/{generate-EcA6ui4i.mjs → generate-DiB0nHPR.mjs} +2 -2
- package/dist/{headers-3zvE0rM3.mjs → headers-CveNO9gR.mjs} +2 -2
- package/dist/{health-DjZYjM7H.mjs → health-CasG2A28.mjs} +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/idempotency/index.d.mts +45 -1
- package/dist/idempotency/index.mjs +95 -11
- package/dist/idempotency/redis.mjs +1 -1
- package/dist/{index-CEJNZFtX.d.mts → index-B-DvUzsr.d.mts} +82 -3
- package/dist/{index-CpzxqePp.d.mts → index-BcR2bFZQ.d.mts} +707 -373
- package/dist/{index-Bc2ox8_U.d.mts → index-Brin0ODU.d.mts} +4 -4
- package/dist/{index-CFThn1K9.d.mts → index-C5NnMEKF.d.mts} +70 -4
- package/dist/{index-C-481Zf2.d.mts → index-ugr1tQlW.d.mts} +17 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +11 -11
- package/dist/{init-BEiNZBsJ.mjs → init-mdJ-v4Xp.mjs} +24 -16
- 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 +100 -98
- package/dist/integrations/mcp/index.d.mts +12 -3
- package/dist/integrations/mcp/index.mjs +2 -2
- package/dist/integrations/mcp/testing.d.mts +1 -1
- package/dist/integrations/mcp/testing.mjs +2 -2
- package/dist/integrations/streamline.mjs +3 -3
- package/dist/integrations/webhooks.d.mts +124 -1
- package/dist/integrations/webhooks.mjs +180 -2
- package/dist/integrations/websocket-pushref-redis.mjs +1 -1
- package/dist/integrations/websocket-redis.mjs +1 -1
- package/dist/integrations/websocket.mjs +38 -35
- package/dist/{interface-DYzM0q-u.mjs → interface-DznJrm9R.mjs} +1 -1
- package/dist/{jsonBody-BYbLDi5D.mjs → jsonBody-CfGH-GxO.mjs} +2 -2
- package/dist/{keys-C0_pa1tY.mjs → keys-WeKvY1dE.mjs} +1 -1
- package/dist/{loadResources-yawi9tAE.mjs → loadResources-Bj-aSsXi.mjs} +4 -3
- package/dist/{loadResourcesFromEntry-BAjYZonx.mjs → loadResourcesFromEntry-DwaxNcE2.mjs} +2 -2
- package/dist/logger/index.mjs +1 -1
- package/dist/{mcpPlugin-B_es0hiF.mjs → mcpPlugin-aJg5TqHi.mjs} +76 -36
- package/dist/{memory-DR6wpa9F.mjs → memory-qYSB7rMQ.mjs} +5 -5
- package/dist/{metrics-CUdw_wLB.mjs → metrics-D7uchLjN.mjs} +2 -2
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +3 -3
- package/dist/migrations/index.mjs +3 -3
- package/dist/{module-0pFJA6YW.mjs → module-CwKsgZXp.mjs} +1 -1
- package/dist/{multipartBody-wOgj_fnj.mjs → multipartBody-4w-S3-PU.mjs} +3 -3
- package/dist/{openapi-B2L4js1v.mjs → openapi-BN5cQaO2.mjs} +6 -6
- package/dist/outbox-admin/index.d.mts +85 -0
- package/dist/outbox-admin/index.mjs +115 -0
- package/dist/outbox-module-CXB79bvt.mjs +839 -0
- package/dist/outbox-module-D-VFq37T.d.mts +368 -0
- package/dist/permissions/index.d.mts +3 -3
- package/dist/permissions/index.mjs +6 -6
- package/dist/{permissions-L--QDAir.mjs → permissions-BAfwgBxc.mjs} +120 -8
- package/dist/{pipe-DRDNsI2T.mjs → pipe-BzzoEhHj.mjs} +3 -5
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +2 -2
- package/dist/{pipeline-UPQFatit.mjs → pipeline-q69DZzgG.mjs} +17 -15
- package/dist/plugins/index.d.mts +6 -6
- package/dist/plugins/index.mjs +16 -16
- package/dist/plugins/response-cache.mjs +2 -2
- package/dist/plugins/tracing-entry.mjs +2 -2
- package/dist/{pluralize-O0FZgESl.mjs → pluralize-B7xf8qZF.mjs} +1 -1
- package/dist/{preloadResources-Dz6BjzM6.mjs → preloadResources-BkyqeTDz.mjs} +1 -1
- package/dist/{preloadResources-CyoJMSiO.d.mts → preloadResources-g07ldtzh.d.mts} +30 -7
- package/dist/presets/filesUpload.d.mts +2 -2
- package/dist/presets/filesUpload.mjs +6 -6
- package/dist/presets/index.d.mts +2 -2
- package/dist/presets/index.mjs +2 -2
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/multiTenant.mjs +3 -3
- package/dist/presets/search.d.mts +2 -2
- package/dist/presets/search.mjs +2 -2
- package/dist/{presets-C4-g4_4P.mjs → presets-D-h0uWtP.mjs} +6 -5
- package/dist/projection-BKM0Ui-s.mjs +42 -0
- package/dist/{queryCachePlugin-BZr8v46E.mjs → queryCachePlugin-DhsZ0ZIc.mjs} +50 -8
- package/dist/{rateLimit-CMPY5Qms.mjs → rateLimit-D4-ASwsI.mjs} +2 -2
- package/dist/{rateLimitKey-Dn5JNmkj.mjs → rateLimitKey-XngqVNEV.mjs} +1 -1
- package/dist/{realtime-C5NoxWFY.mjs → realtime-CTkv3O59.mjs} +10 -10
- package/dist/{redis-stream-qN6A-RFv.d.mts → redis-stream-mwLWlfHG.d.mts} +1 -1
- package/dist/{registerRoute-CBN84fc7.mjs → registerRoute-DNnd3vkz.mjs} +10 -8
- package/dist/registry/index.d.mts +3 -3
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-4213U4zb.mjs → registry-CLxCR5LF.mjs} +2 -2
- package/dist/{renewingLease-Dll8mGgc.mjs → renewingLease-BnWtbA2U.mjs} +1 -1
- package/dist/{replyHelpers-DIiZKGUt.mjs → replyHelpers-BSBVCwL3.mjs} +2 -2
- package/dist/{repositoryFilter-f9eAfq_l.mjs → repositoryFilter-DKny7PDn.mjs} +1 -1
- package/dist/{requestContext-2TxXOJ7T.mjs → requestContext-uYE35JxI.mjs} +1 -1
- package/dist/{rolldown-runtime-CUsjNX9R.mjs → rolldown-runtime-DNg-KNCk.mjs} +1 -1
- package/dist/runtimeCapabilities-Dm88DaTW.mjs +49 -0
- package/dist/{schedules-DdtlICTf.mjs → schedules-CAcZgia0.mjs} +3 -3
- package/dist/{schemaConverter-D--wdJM-.mjs → schemaConverter-XH1RZRyu.mjs} +1 -1
- package/dist/{schemaIR-Bm2enbnh.mjs → schemaIR-CDvclAew.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-DHx5Fous.mjs → scope-BaWcqBvr.mjs} +4 -4
- package/dist/{simpleEqualityMatcher-DjQJ7FKA.mjs → simpleEqualityMatcher-Se8VrsaP.mjs} +1 -1
- package/dist/{sse-CUTo9y0X.mjs → sse-Cf0jUHsh.mjs} +7 -6
- package/dist/{sseStream-B_5XcVVd.mjs → sseStream-Bvpi-UXQ.mjs} +2 -2
- package/dist/{store-helpers-D1MP_gRG.mjs → store-helpers-B88p99Z2.mjs} +1 -1
- package/dist/{streaming-PSZwi8JV.mjs → streaming-DsT1B5zJ.mjs} +1 -1
- package/dist/{subscribe-helpers-C0Tb2aUp.mjs → subscribe-helpers-CLIOHsOK.mjs} +2 -2
- package/dist/sync/changelog.mjs +1 -1
- package/dist/testing/cleanupStoreContract.d.mts +1 -1
- package/dist/testing/cleanupStoreContract.mjs +12 -6
- package/dist/testing/index.d.mts +52 -13
- package/dist/testing/index.mjs +110 -40
- package/dist/testing/outboxStoreContract.d.mts +11 -2
- package/dist/testing/outboxStoreContract.mjs +110 -21
- package/dist/testing/storageContract.mjs +11 -6
- package/dist/{transactionContext-dAfBVUrk.mjs → transactionContext-BYtWnwAS.mjs} +1 -1
- package/dist/{typeGuards-B0ryPo3I.mjs → typeGuards-jjKJDN13.mjs} +1 -1
- package/dist/types/index.d.mts +3 -3
- package/dist/types/index.mjs +1 -1
- package/dist/types/storage.mjs +1 -1
- package/dist/{types-CBgvkp8O.d.mts → types-BcTumAz_.d.mts} +128 -18
- package/dist/{types-CwcUQ610.d.mts → types-BfC83KsP.d.mts} +15 -1
- package/dist/{types-Cys0ko9Z.mjs → types-CoqIRrkY.mjs} +4 -4
- package/dist/{types-C4QE8qnm.d.mts → types-DVLddu2q.d.mts} +144 -1
- package/dist/usage/index.d.mts +1 -1
- package/dist/usage/index.mjs +0 -0
- package/dist/{userHelpers-ChYJ6CdK.mjs → userHelpers-CWF5pbZD.mjs} +1 -1
- package/dist/utils/index.d.mts +57 -5
- package/dist/utils/index.mjs +12 -11
- package/dist/{utils-vL8BrDE2.mjs → utils-h1V_sT-t.mjs} +38 -7
- package/dist/{validate-_KbifpHF.mjs → validate-CdQlz52F.mjs} +2 -2
- package/dist/{versioning-D_rhHfZm.d.mts → versioning-DEs-_hFi.d.mts} +1 -1
- package/dist/{versioning-CHDTor3P.mjs → versioning-rZbyLVD-.mjs} +4 -4
- package/package.json +31 -20
- package/skills/arc/SKILL.md +96 -4
- package/skills/arc/references/api-reference.md +19 -0
- package/skills/arc/references/production.md +2 -2
- package/dist/fastify-augmentation-zh0_AYHa.d.mts +0 -85
- package/dist/projection-BHw6xlOQ.mjs +0 -18
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DNg-KNCk.mjs";
|
|
3
3
|
import { toCanonicalList } from "@classytic/repo-core/pagination";
|
|
4
4
|
import fp from "fastify-plugin";
|
|
5
5
|
//#region src/plugins/replyHelpers.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
2
|
import { arcLog } from "./logger/index.mjs";
|
|
3
3
|
import { policyRecordToFilter } from "@classytic/repo-core/filter";
|
|
4
4
|
//#region src/core/repositoryFilter.ts
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
//#region src/utils/runtimeCapabilities.ts
|
|
3
|
+
/**
|
|
4
|
+
* `Symbol.for` so declarations from two arc copies in one dependency graph
|
|
5
|
+
* land in ONE registry — same reasoning as `ARC_EVENT_TRANSPORT`. Not on the
|
|
6
|
+
* public `fastify.arc` surface; the audit result is the product, not the list.
|
|
7
|
+
*/
|
|
8
|
+
const ARC_RUNTIME_CAPABILITIES = Symbol.for("arc.runtimeCapabilities");
|
|
9
|
+
function registryOf(fastify) {
|
|
10
|
+
const holder = fastify;
|
|
11
|
+
if (!holder[ARC_RUNTIME_CAPABILITIES]) holder[ARC_RUNTIME_CAPABILITIES] = [];
|
|
12
|
+
return holder[ARC_RUNTIME_CAPABILITIES];
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Declare a runtime capability. Callable from ANY registration context —
|
|
16
|
+
* arc's own plugins, host `plugins()` callbacks, module `plugins` phases —
|
|
17
|
+
* which is the point: the audit sees what the constructor-time guard cannot.
|
|
18
|
+
*/
|
|
19
|
+
function declareRuntimeCapability(fastify, decl) {
|
|
20
|
+
registryOf(fastify).push(decl);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* The boot audit. Runs once at the end of `buildApp`, after every declarant.
|
|
24
|
+
*
|
|
25
|
+
* - `runtime: 'distributed'` + `durability: 'memory'` + not `accepted` →
|
|
26
|
+
* collected and THROWN as one error naming every violator (fixing them one
|
|
27
|
+
* boot at a time is the checklist experience this replaces).
|
|
28
|
+
* - accepted memory declarations → one info line, so the topology decision is
|
|
29
|
+
* visible in the boot log it was made for.
|
|
30
|
+
* - non-distributed runtimes → nothing to enforce; declarations still logged
|
|
31
|
+
* at debug for `arc doctor`-style tooling.
|
|
32
|
+
*/
|
|
33
|
+
function auditRuntimeCapabilities(fastify, runtime) {
|
|
34
|
+
const declarations = registryOf(fastify);
|
|
35
|
+
if (declarations.length === 0) return;
|
|
36
|
+
if (runtime !== "distributed") {
|
|
37
|
+
fastify.log.debug({ capabilities: declarations }, "[arc] runtime capabilities declared (no distributed profile — informational)");
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const violations = declarations.filter((d) => d.durability === "memory" && !d.accepted);
|
|
41
|
+
const acceptedMemory = declarations.filter((d) => d.durability === "memory" && d.accepted);
|
|
42
|
+
if (acceptedMemory.length > 0) fastify.log.info({ accepted: acceptedMemory.map((d) => d.subsystem) }, "[arc] per-process state accepted by design under runtime: 'distributed'");
|
|
43
|
+
if (violations.length > 0) {
|
|
44
|
+
const lines = violations.map((d) => ` - ${d.subsystem}${d.detail ? ` — ${d.detail}` : ""}`).join("\n");
|
|
45
|
+
throw new Error(`runtime: 'distributed' — ${violations.length} subsystem(s) hold PER-PROCESS state that multi-replica deployment breaks:\n${lines}\nWire a shared store for each, or — where per-process is genuinely intended — have the declarant pass \`accepted: true\` with a reason.`);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { declareRuntimeCapability as n, auditRuntimeCapabilities as t };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import { t as startRenewingLease } from "./renewingLease-
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DNg-KNCk.mjs";
|
|
3
|
+
import { t as startRenewingLease } from "./renewingLease-BnWtbA2U.mjs";
|
|
4
4
|
import fp from "fastify-plugin";
|
|
5
5
|
//#region src/plugins/schedules.ts
|
|
6
6
|
var schedules_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { o as toJsonSchema } from "./schemaConverter-
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
import { o as toJsonSchema } from "./schemaConverter-XH1RZRyu.mjs";
|
|
3
3
|
//#region src/core/schemaIR.ts
|
|
4
4
|
/**
|
|
5
5
|
* Schema IR — one canonical representation, two adapters.
|
package/dist/schemas/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
2
|
import { errorContractSchema, errorDetailSchema } from "@classytic/repo-core/errors";
|
|
3
3
|
import { Type, Type as Type$1 } from "typebox";
|
|
4
4
|
//#region src/schemas/index.ts
|
package/dist/scim/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as parseJsonBody } from "../jsonBody-
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as parseJsonBody } from "../jsonBody-CfGH-GxO.mjs";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
//#region src/scim/errors.ts
|
|
5
5
|
var ScimError = class extends Error {
|
package/dist/scope/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { C as isService, D as requireUserId, E as requireTeamId, O as scopeFirstCtx, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-
|
|
3
|
-
import { n as elevation_default, t as elevationPlugin } from "../elevation-
|
|
4
|
-
import { t as createTenantKeyGenerator } from "../rateLimitKey-
|
|
5
|
-
import { t as resolveOrgFromHeader } from "../scope-
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
import { C as isService, D as requireUserId, E as requireTeamId, O as scopeFirstCtx, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-CoqIRrkY.mjs";
|
|
3
|
+
import { n as elevation_default, t as elevationPlugin } from "../elevation-B0tlY8y1.mjs";
|
|
4
|
+
import { t as createTenantKeyGenerator } from "../rateLimitKey-XngqVNEV.mjs";
|
|
5
|
+
import { t as resolveOrgFromHeader } from "../scope-BaWcqBvr.mjs";
|
|
6
6
|
export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, createTenantKeyGenerator, elevation_default as elevationPlugin, elevationPlugin as elevationPluginFn, getAncestorOrgIds, getClientId, getDPoPJkt, getMandate, getOrgContext, getOrgId, getOrgRoles, getRequestScope, getScopeContext, getScopeContextMap, getServiceScopes, getTeamId, getTenantFromRequest, getUserId, getUserRoles, hasOrgAccess, isAuthenticated, isElevated, isMember, isOrgInScope, isService, requireClientId, requireOrgId, requireTeamId, requireUserId, resolveOrgFromHeader, scopeFirstCtx };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-
|
|
3
|
-
import { n as requireSingleHeaderValue } from "./headers-
|
|
4
|
-
import { n as getUserRoles } from "./userHelpers-
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-Cd_yy7aW.mjs";
|
|
3
|
+
import { n as requireSingleHeaderValue } from "./headers-CveNO9gR.mjs";
|
|
4
|
+
import { n as getUserRoles } from "./userHelpers-CWF5pbZD.mjs";
|
|
5
5
|
//#region src/scope/resolveOrgFromHeader.ts
|
|
6
6
|
/**
|
|
7
7
|
* Create a preHandler hook that resolves org scope from a header.
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DNg-KNCk.mjs";
|
|
3
3
|
import { arcLog } from "./logger/index.mjs";
|
|
4
|
-
import { c as getOrgId, n as PUBLIC_SCOPE } from "./types-
|
|
5
|
-
import { a as promoteStreamTokenToHeader } from "./streaming-
|
|
6
|
-
import { t as openSseStream } from "./sseStream-
|
|
4
|
+
import { c as getOrgId, n as PUBLIC_SCOPE } from "./types-CoqIRrkY.mjs";
|
|
5
|
+
import { a as promoteStreamTokenToHeader } from "./streaming-DsT1B5zJ.mjs";
|
|
6
|
+
import { t as openSseStream } from "./sseStream-Bvpi-UXQ.mjs";
|
|
7
7
|
import fp from "fastify-plugin";
|
|
8
8
|
//#region src/plugins/sse.ts
|
|
9
9
|
var sse_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -33,7 +33,8 @@ const ssePlugin = async (fastify, opts = {}) => {
|
|
|
33
33
|
handler: async (request, reply) => {
|
|
34
34
|
const stream = openSseStream(request, reply, { heartbeatMs: heartbeat });
|
|
35
35
|
stream.onCleanup(() => activeConnections.delete(stream.close));
|
|
36
|
-
const
|
|
36
|
+
const scope = request.scope ?? PUBLIC_SCOPE;
|
|
37
|
+
const requestOrgId = getOrgId(scope);
|
|
37
38
|
const dropOrgEvents = orgScoped && !requestOrgId;
|
|
38
39
|
for (const pattern of patterns) {
|
|
39
40
|
const unsub = await fastify.events.subscribe(pattern, async (event) => {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as forwardedStreamHeaders } from "./streaming-
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as forwardedStreamHeaders } from "./streaming-DsT1B5zJ.mjs";
|
|
3
3
|
//#region src/utils/sseStream.ts
|
|
4
4
|
/**
|
|
5
5
|
* Take over the reply socket and open an SSE stream. Call ONLY after every
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
import { r as createEvent } from "./EventTransport-tq4CEB-q.mjs";
|
|
3
3
|
//#region src/events/defineEvent.ts
|
|
4
4
|
/**
|
|
5
5
|
* defineEvent — Typed Event Definitions with Optional Schema Validation
|
package/dist/sync/changelog.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
2
|
import { afterAll, beforeAll, describe, expect, it } from "vitest";
|
|
3
3
|
//#region src/testing/cleanupStoreContract.ts
|
|
4
4
|
/**
|
|
@@ -50,6 +50,8 @@ function plan(recipeId) {
|
|
|
50
50
|
rebuildActions: [],
|
|
51
51
|
warnings: [],
|
|
52
52
|
estimatedTotal: 1,
|
|
53
|
+
protectedTotal: 0,
|
|
54
|
+
excludeSteps: [],
|
|
53
55
|
confirmationPhrase: recipeId,
|
|
54
56
|
digest: `digest-${recipeId}`
|
|
55
57
|
};
|
|
@@ -152,10 +154,11 @@ function runCleanupRunStoreContract(name, setup) {
|
|
|
152
154
|
expiresAt: future()
|
|
153
155
|
});
|
|
154
156
|
await store.compareAndTransition(run.id, ["queued"], "running");
|
|
155
|
-
|
|
157
|
+
const stolen = await store.claim(run.id, {
|
|
156
158
|
token: uid("thief"),
|
|
157
159
|
expiresAt: future()
|
|
158
|
-
})
|
|
160
|
+
});
|
|
161
|
+
expect(stolen).toBeNull();
|
|
159
162
|
});
|
|
160
163
|
it("recovers a running run whose lease EXPIRED (crash recovery)", async () => {
|
|
161
164
|
const run = makeRun(uid("crashed"), { concurrencyKey: void 0 });
|
|
@@ -234,9 +237,11 @@ function runCleanupRunStoreContract(name, setup) {
|
|
|
234
237
|
token: live,
|
|
235
238
|
expiresAt: future()
|
|
236
239
|
});
|
|
237
|
-
|
|
240
|
+
const clobbered = await store.compareAndTransition(run.id, ["running"], "completed", { completedAt: /* @__PURE__ */ new Date() }, "a-stale-token");
|
|
241
|
+
expect(clobbered).toBeNull();
|
|
238
242
|
expect((await store.get(run.id))?.status).toBe("running");
|
|
239
|
-
|
|
243
|
+
const ok = await store.compareAndTransition(run.id, ["running"], "completed", void 0, live);
|
|
244
|
+
expect(ok?.status).toBe("completed");
|
|
240
245
|
});
|
|
241
246
|
});
|
|
242
247
|
describe("requestCancel — durable cancellation flag", () => {
|
|
@@ -353,7 +358,8 @@ function runCleanupRunStoreContract(name, setup) {
|
|
|
353
358
|
const run = makeRun(uid("rearm-cancelled"), { concurrencyKey: void 0 });
|
|
354
359
|
await store.createIfPermitted(run);
|
|
355
360
|
await store.compareAndTransition(run.id, ["queued"], "cancelled");
|
|
356
|
-
|
|
361
|
+
const requeued = await store.reArmIfPermitted(run.id, { queuedAt: /* @__PURE__ */ new Date() });
|
|
362
|
+
expect(requeued?.status).toBe("queued");
|
|
357
363
|
});
|
|
358
364
|
it("refuses a run that is not in a terminal status", async () => {
|
|
359
365
|
const run = makeRun(uid("rearm-live"), { concurrencyKey: void 0 });
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
|
|
2
|
-
import { V as ResourceDefinition } from "../index-CpzxqePp.mjs";
|
|
3
2
|
import { i as RequestScope } from "../types-ChuShpCP.mjs";
|
|
4
|
-
import { l as
|
|
5
|
-
import {
|
|
6
|
-
import "../
|
|
7
|
-
import
|
|
3
|
+
import { l as PermissionCheck, t as AnyRecord } from "../base-Csjc2oF-.mjs";
|
|
4
|
+
import { V as ResourceDefinition } from "../index-BcR2bFZQ.mjs";
|
|
5
|
+
import { n as ArcModuleInput, o as ModuleDisposer, s as ModuleSetupContext } from "../types-BcTumAz_.mjs";
|
|
6
|
+
import "../index-C5NnMEKF.mjs";
|
|
7
|
+
import { n as preloadResourcesAsync, r as CreateAppOptions, t as preloadResources } from "../preloadResources-g07ldtzh.mjs";
|
|
8
8
|
import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
|
|
9
|
+
import { StandardRepo } from "@classytic/repo-core/repository";
|
|
9
10
|
import { FastifyInstance, FastifyServerOptions } from "fastify";
|
|
10
11
|
import { Mock } from "vitest";
|
|
11
|
-
import { StandardRepo } from "@classytic/repo-core/repository";
|
|
12
12
|
//#region src/testing/assertions.d.ts
|
|
13
13
|
/**
|
|
14
14
|
* expectArc — Arc-specific response assertions
|
|
@@ -91,6 +91,11 @@ interface AuthorizationConformance {
|
|
|
91
91
|
* `buildIdFilter` output (route id AND policy AND tenant), so a policy that
|
|
92
92
|
* tried to redirect/widen the target would show here — the surface the
|
|
93
93
|
* filter-overwrite class of bug lives on.
|
|
94
|
+
*
|
|
95
|
+
* `filter` is `undefined` when the permission carries NO policy: `fetchDetailed`
|
|
96
|
+
* only builds a compound filter when there is something to compound, and takes a
|
|
97
|
+
* plain by-id read otherwise. `status` is meaningful on both paths — assert the
|
|
98
|
+
* filter only when the permission under test emits a policy.
|
|
94
99
|
*/
|
|
95
100
|
get: SurfaceObservation;
|
|
96
101
|
/** `GET /confs/aggregations/tally` — the aggregation surface. */
|
|
@@ -606,15 +611,27 @@ declare function createMockRequest(overrides?: Partial<AnyRecord>): unknown;
|
|
|
606
611
|
*/
|
|
607
612
|
declare function createMockReply(): unknown;
|
|
608
613
|
/**
|
|
609
|
-
* Create a mock controller for testing
|
|
614
|
+
* Create a mock controller for testing.
|
|
615
|
+
*
|
|
616
|
+
* The return type is ANNOTATED rather than inferred, and writing it out IS the
|
|
617
|
+
* fix: inference expands `Mock`'s default type argument to `Procedure`, which
|
|
618
|
+
* vitest declares in an internal sub-package arc does not depend on. The
|
|
619
|
+
* emitted declaration then referenced that package by name — resolvable under
|
|
620
|
+
* npm's hoisting because `vitest` (a real peer) drags it in, and broken under
|
|
621
|
+
* pnpm's strict layout, where a transitive dep is not reachable from a
|
|
622
|
+
* consumer's root.
|
|
623
|
+
*
|
|
624
|
+
* Bare `Mock` keeps the permissive ergonomics (`.mockResolvedValue(...)`, any
|
|
625
|
+
* arguments) while naming only `vitest`, which arc does declare. Same shape
|
|
626
|
+
* `MockRepository` above uses.
|
|
610
627
|
*/
|
|
611
628
|
declare function createMockController(repository: StandardRepo<AnyRecord>): {
|
|
612
629
|
repository: StandardRepo<AnyRecord>;
|
|
613
|
-
list: Mock
|
|
614
|
-
get: Mock
|
|
615
|
-
create: Mock
|
|
616
|
-
update: Mock
|
|
617
|
-
delete: Mock
|
|
630
|
+
list: Mock;
|
|
631
|
+
get: Mock;
|
|
632
|
+
create: Mock;
|
|
633
|
+
update: Mock;
|
|
634
|
+
delete: Mock;
|
|
618
635
|
};
|
|
619
636
|
/**
|
|
620
637
|
* Create mock data factory
|
|
@@ -675,6 +692,28 @@ declare function createTestTimer(): {
|
|
|
675
692
|
reset: () => void;
|
|
676
693
|
};
|
|
677
694
|
//#endregion
|
|
695
|
+
//#region src/testing/moduleSetup.d.ts
|
|
696
|
+
interface TestModuleSetup {
|
|
697
|
+
/** Pass this as the second argument to `bootstrap` / `plugins` / `afterResources`. */
|
|
698
|
+
readonly context: ModuleSetupContext;
|
|
699
|
+
/**
|
|
700
|
+
* Disposers the module registered, in REGISTRATION order (`dispose()` runs
|
|
701
|
+
* them backwards). Assert on `.length` to prove a phase registered teardown
|
|
702
|
+
* at all — the check a no-op `defer` can never fail.
|
|
703
|
+
*/
|
|
704
|
+
readonly deferred: readonly ModuleDisposer[];
|
|
705
|
+
/**
|
|
706
|
+
* Run every collected disposer LIFO, then clear them.
|
|
707
|
+
*
|
|
708
|
+
* Best-effort like arc's teardown: one throwing disposer never blocks the
|
|
709
|
+
* ones behind it. Any errors are collected and thrown together at the end, so
|
|
710
|
+
* a test still fails loudly instead of a rejection vanishing into a floating
|
|
711
|
+
* promise.
|
|
712
|
+
*/
|
|
713
|
+
dispose(): Promise<void>;
|
|
714
|
+
}
|
|
715
|
+
declare function createTestModuleSetup(): TestModuleSetup;
|
|
716
|
+
//#endregion
|
|
678
717
|
//#region src/testing/scopeRoleGate.d.ts
|
|
679
718
|
/**
|
|
680
719
|
* Grants iff the caller is an org member holding one of `allowed` as an ORG role.
|
|
@@ -777,4 +816,4 @@ declare function createTestApp(options?: CreateTestAppOptions): Promise<TestAppC
|
|
|
777
816
|
*/
|
|
778
817
|
declare function createMinimalTestApp(options?: FastifyServerOptions): FastifyInstance;
|
|
779
818
|
//#endregion
|
|
780
|
-
export { type ArcAssertion, type ArcResponseLike, type AuthMode, type AuthResponse, type AuthorizationConformance, type BetterAuthTestHelpers, type BetterAuthTestHelpersOptions, type BetterAuthTestUser, type BootModuleAppOptions, type BootModulesInput, type CreateOrgInput, type CreateTestAppOptions, type DbMode, type FixtureDestroyer, type FixtureFactory, type FixtureRegistration, HttpTestHarness, type HttpTestHarnessOptions, type MockRepository, type ModuleTestApp, type OrgResponse, type RoleConfig, type SetupBetterAuthTestAppInput, type SetupBetterAuthTestAppResult, type SignInInput, type SignUpInput, type StorageContractSetup, type StorageContractSetupResult, type SurfaceObservation, TEST_ACTOR_HEADER, type TestActor, type TestAppContext, type TestAuthProvider, type TestAuthSession, type TestDatabase, type TestDatabaseFactory, type TestFixtures, type TestkitContext, bootModuleApp, createBetterAuthProvider, createBetterAuthTestHelpers, createCustomAuthProvider, createDataFactory, createHttpTestHarness, createJwtAuthProvider, createMinimalTestApp, createMockController, createMockReply, createMockRepository, createMockRequest, createMockUser, createSpy, createTestApp, createTestFixtures, createTestTimer, expectArc, mongoMemoryDatabase, preloadResources, preloadResourcesAsync, runAuthorizationConformance, runStorageContract, safeParseBody, scopeFromTestActor, scopeRoleGate, setupBetterAuthTestApp, testActorAuth, testActorHeaders, waitFor };
|
|
819
|
+
export { type ArcAssertion, type ArcResponseLike, type AuthMode, type AuthResponse, type AuthorizationConformance, type BetterAuthTestHelpers, type BetterAuthTestHelpersOptions, type BetterAuthTestUser, type BootModuleAppOptions, type BootModulesInput, type CreateOrgInput, type CreateTestAppOptions, type DbMode, type FixtureDestroyer, type FixtureFactory, type FixtureRegistration, HttpTestHarness, type HttpTestHarnessOptions, type MockRepository, type ModuleTestApp, type OrgResponse, type RoleConfig, type SetupBetterAuthTestAppInput, type SetupBetterAuthTestAppResult, type SignInInput, type SignUpInput, type StorageContractSetup, type StorageContractSetupResult, type SurfaceObservation, TEST_ACTOR_HEADER, type TestActor, type TestAppContext, type TestAuthProvider, type TestAuthSession, type TestDatabase, type TestDatabaseFactory, type TestFixtures, type TestModuleSetup, type TestkitContext, bootModuleApp, createBetterAuthProvider, createBetterAuthTestHelpers, createCustomAuthProvider, createDataFactory, createHttpTestHarness, createJwtAuthProvider, createMinimalTestApp, createMockController, createMockReply, createMockRepository, createMockRequest, createMockUser, createSpy, createTestApp, createTestFixtures, createTestModuleSetup, createTestTimer, expectArc, mongoMemoryDatabase, preloadResources, preloadResourcesAsync, runAuthorizationConformance, runStorageContract, safeParseBody, scopeFromTestActor, scopeRoleGate, setupBetterAuthTestApp, testActorAuth, testActorHeaders, waitFor };
|