@classytic/arc 2.32.0 → 2.34.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-Dk34dxhI.mjs → BaseController-CbkuhNI2.mjs} +329 -35
- package/dist/{EventTransport-2uVV34WU.d.mts → EventTransport-BEVP50ka.d.mts} +16 -0
- package/dist/{EventTransport-BV10D0oG.mjs → EventTransport-tq4CEB-q.mjs} +39 -2
- package/dist/{HookSystem-vimw5D7Z.mjs → HookSystem-DqXkMXkB.mjs} +2 -2
- package/dist/{ResourceRegistry-BVr7PgA0.mjs → ResourceRegistry-DoALUlOO.mjs} +3 -2
- package/dist/{actionPermissions-Dti7ebyv.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 +39 -7
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/{authorizationDecision-__T3EJDA.mjs → authorizationDecision-CMMLWmuZ.mjs} +6 -2
- package/dist/{types-B7XeLEgK.d.mts → base-Csjc2oF-.d.mts} +74 -74
- package/dist/{buildHandler-Dn7rzUJo.mjs → buildHandler-BrdYrG_1.mjs} +4 -4
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-DFJqHyFs.mjs → caching-BcGmvnHh.mjs} +2 -2
- package/dist/cleanup/index.d.mts +17 -5
- package/dist/cleanup/index.mjs +240 -7
- 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-J99LGTJI.mjs → constants-BxCoxmiN.mjs} +1 -1
- package/dist/context/index.mjs +3 -3
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +9 -8
- package/dist/{core-BwwmNSp7.mjs → core-BYKa8wHu.mjs} +3 -3
- package/dist/{createActionRouter-DkJZWo0m.mjs → createActionRouter-D6T0jWhS.mjs} +8 -8
- package/dist/{createAggregationRouter-B1exOVD8.mjs → createAggregationRouter-QLV2PrWP.mjs} +7 -7
- package/dist/{createApp-Bv0m-Q6_.mjs → createApp-zR-DEesr.mjs} +128 -24
- package/dist/{defineAggregation-gX4No1gt.mjs → defineAggregation-Nv-DwfOf.mjs} +1 -1
- package/dist/{defineResource-XFPPUu2c.mjs → defineResource-ZhuLonLm.mjs} +297 -23
- 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-DNXXxgjl.mjs → elevation-B0tlY8y1.mjs} +4 -4
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-B2AZUJUj.mjs → errorHandler-C7xBqHsI.mjs} +42 -5
- package/dist/{errorHandler-CpYUJmPA.d.mts → errorHandler-DI5AN2b5.d.mts} +14 -3
- package/dist/{errors-Bh1KK5ps.mjs → errors-Cd_yy7aW.mjs} +1 -1
- package/dist/{eventPlugin-GF5nnBIq.d.mts → eventPlugin-DSNEZWfV.d.mts} +29 -1
- package/dist/{eventPlugin-Dk_TyXeE.mjs → eventPlugin-Dar8qRaj.mjs} +65 -9
- package/dist/events/index.d.mts +5 -351
- package/dist/events/index.mjs +5 -780
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis-stream-entry.mjs +1 -1
- 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 +7 -7
- package/dist/{fastify-augmentation-BppG5bMT.d.mts → fastify-augmentation-DVsTAy6X.d.mts} +3 -3
- package/dist/{fields-DEi65pGj.mjs → fields-CojeUkS4.mjs} +1 -1
- package/dist/{generate-CRSG0jTv.mjs → generate-DiB0nHPR.mjs} +2 -2
- package/dist/{headers-BXjQYbeC.mjs → headers-CveNO9gR.mjs} +2 -2
- package/dist/{health-5XnTa2uo.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 +90 -9
- package/dist/idempotency/redis.mjs +1 -1
- package/dist/{index-zq6VrjaB.d.mts → index-B-DvUzsr.d.mts} +12 -2
- package/dist/{index-CpzxqePp.d.mts → index-BcR2bFZQ.d.mts} +707 -373
- package/dist/{index-ZWhLTp_s.d.mts → index-C5NnMEKF.d.mts} +1 -1
- package/dist/{index-DXlHwvuE.d.mts → index-CFAJEWCX.d.mts} +18 -5
- package/dist/{index-C-481Zf2.d.mts → index-ugr1tQlW.d.mts} +17 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.mjs +13 -12
- package/dist/{init-BbfP8aky.mjs → init-mdJ-v4Xp.mjs} +18 -12
- 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 +99 -97
- 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 +1 -1
- package/dist/{interface-BP4IJCBO.mjs → interface-DznJrm9R.mjs} +1 -1
- package/dist/{jsonBody-DDSR2HFl.mjs → jsonBody-CfGH-GxO.mjs} +2 -2
- package/dist/{keys-B-HBTGXl.mjs → keys-WeKvY1dE.mjs} +1 -1
- package/dist/{loadResources-DisEAmkm.mjs → loadResources-Bj-aSsXi.mjs} +2 -2
- package/dist/{loadResourcesFromEntry-D1MJp13f.mjs → loadResourcesFromEntry-DwaxNcE2.mjs} +2 -2
- package/dist/logger/index.mjs +1 -1
- package/dist/{mcpPlugin-CpfVpKHE.mjs → mcpPlugin-DX3PHD7K.mjs} +60 -21
- package/dist/{memory-DsuWnj4T.mjs → memory-qYSB7rMQ.mjs} +2 -2
- package/dist/{metrics-DdQL8syd.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 +2 -2
- package/dist/{module-Br81am6m.mjs → module-CwKsgZXp.mjs} +1 -1
- package/dist/{multipartBody-BnkBLN7v.mjs → multipartBody-4w-S3-PU.mjs} +1 -1
- package/dist/{openapi-DIRzvxC0.mjs → openapi-CkV5mQ53.mjs} +6 -6
- package/dist/outbox-admin/index.d.mts +2 -2
- package/dist/outbox-admin/index.mjs +4 -4
- package/dist/outbox-module-C1Bs_FXF.d.mts +382 -0
- package/dist/outbox-module-D1QfHqO4.mjs +846 -0
- package/dist/permissions/index.d.mts +2 -2
- package/dist/permissions/index.mjs +5 -5
- package/dist/{permissions-Dl_m0NCe.mjs → permissions-CP47jdi7.mjs} +25 -6
- package/dist/{pipe-ELHCP3zj.mjs → pipe-BzzoEhHj.mjs} +2 -2
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +2 -2
- package/dist/{pipeline-CPA-jx0M.mjs → pipeline-q69DZzgG.mjs} +6 -6
- 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-C2ZkKbsn.mjs → pluralize-B7xf8qZF.mjs} +1 -1
- package/dist/{preloadResources-CDs87fTw.mjs → preloadResources-BkyqeTDz.mjs} +1 -1
- package/dist/{preloadResources-T1hmlTEZ.d.mts → preloadResources-g07ldtzh.d.mts} +30 -7
- 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 +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-Dntd_pUO.mjs → presets-BAPijK_A.mjs} +4 -4
- package/dist/projection-BKM0Ui-s.mjs +42 -0
- package/dist/{queryCachePlugin-Dhps-Ldt.mjs → queryCachePlugin-DhsZ0ZIc.mjs} +49 -7
- package/dist/{rateLimit-C7mmAGs3.mjs → rateLimit-D4-ASwsI.mjs} +2 -2
- package/dist/{rateLimitKey-CccEFBfk.mjs → rateLimitKey-XngqVNEV.mjs} +1 -1
- package/dist/{realtime-DVvVZZFz.mjs → realtime-G1TC6Yzc.mjs} +9 -9
- package/dist/{redis-stream-qN6A-RFv.d.mts → redis-stream-mwLWlfHG.d.mts} +1 -1
- package/dist/{registerRoute-B_QrjYZS.mjs → registerRoute-Ba8v0PCa.mjs} +4 -4
- package/dist/registry/index.d.mts +3 -3
- package/dist/registry/index.mjs +3 -3
- package/dist/{registry-DqUmzA9W.mjs → registry-CLxCR5LF.mjs} +2 -2
- package/dist/{renewingLease-BpP9wwj7.mjs → renewingLease-BnWtbA2U.mjs} +1 -1
- package/dist/{replyHelpers-DS-P0b32.mjs → replyHelpers-BSBVCwL3.mjs} +2 -2
- package/dist/repositoryFilter-BANpz6BX.mjs +78 -0
- package/dist/{requestContext-B6vQF-sy.mjs → requestContext-uYE35JxI.mjs} +1 -1
- package/dist/{rolldown-runtime-BhflRrBs.mjs → rolldown-runtime-DNg-KNCk.mjs} +1 -1
- package/dist/runtimeCapabilities-Dm88DaTW.mjs +49 -0
- package/dist/{schedules-C2Q3uv2d.mjs → schedules-CAcZgia0.mjs} +3 -3
- package/dist/{schemaConverter-Crjvczi_.mjs → schemaConverter-XH1RZRyu.mjs} +1 -1
- package/dist/{schemaIR-CnyKK_1j.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-afz_Ieek.mjs → scope-BaWcqBvr.mjs} +4 -4
- package/dist/{simpleEqualityMatcher-C4KiMWUa.mjs → simpleEqualityMatcher-Se8VrsaP.mjs} +1 -1
- package/dist/{sse-B9P4Y-UI.mjs → sse-Cf0jUHsh.mjs} +5 -5
- package/dist/{sseStream-B3zb_d1h.mjs → sseStream-Bvpi-UXQ.mjs} +2 -2
- package/dist/{store-helpers-DmEMHlPQ.mjs → store-helpers-B88p99Z2.mjs} +1 -1
- package/dist/{streaming-DPZdQmDz.mjs → streaming-DsT1B5zJ.mjs} +1 -1
- package/dist/{subscribe-helpers-sp5xTDVA.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 +3 -1
- package/dist/testing/index.d.mts +24 -12
- package/dist/testing/index.mjs +24 -12
- package/dist/testing/outboxStoreContract.mjs +1 -1
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/{transactionContext-BvLKvOIL.mjs → transactionContext-BYtWnwAS.mjs} +1 -1
- package/dist/{typeGuards-B_5-hKjJ.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-CT5vu6M0.d.mts → types-BcTumAz_.d.mts} +41 -7
- package/dist/{types-CwcUQ610.d.mts → types-BfC83KsP.d.mts} +15 -1
- package/dist/{types-DXYX7dIR.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-BNsOXzOd.mjs → userHelpers-CWF5pbZD.mjs} +1 -1
- package/dist/utils/index.d.mts +57 -5
- package/dist/utils/index.mjs +12 -11
- package/dist/{utils-BtOha_Sp.mjs → utils-h1V_sT-t.mjs} +38 -7
- package/dist/{validate-PMCPR9El.mjs → validate-CdQlz52F.mjs} +2 -2
- package/dist/{versioning-D_rhHfZm.d.mts → versioning-DEs-_hFi.d.mts} +1 -1
- package/dist/{versioning-CKv2jz_U.mjs → versioning-rZbyLVD-.mjs} +3 -3
- package/package.json +17 -16
- 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/projection-CjHhM5W1.mjs +0 -18
- package/dist/repositoryFilter-DotlxG3L.mjs +0 -45
|
@@ -40,6 +40,18 @@ interface CleanupExecutionContext extends CleanupContext {
|
|
|
40
40
|
* commits, call this so the executor learns of a cancel request promptly.
|
|
41
41
|
*/
|
|
42
42
|
onStep(step: CleanupStepResult): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Report a STEP LIFECYCLE transition — running / completed / skipped / failed.
|
|
45
|
+
*
|
|
46
|
+
* Separate from {@link onStep}, which reports a committed CHUNK and drives the
|
|
47
|
+
* aggregate counters. Folding both into one call would double-count `steps`
|
|
48
|
+
* and conflate "a batch landed" with "this phase is now done" — two different
|
|
49
|
+
* facts an operator reads differently.
|
|
50
|
+
*
|
|
51
|
+
* OPTIONAL on the context so a recipe that does not model discrete steps is
|
|
52
|
+
* unaffected; `recipeFromSteps` drives it for every composed recipe.
|
|
53
|
+
*/
|
|
54
|
+
onStepState?(state: CleanupStepProgress): Promise<void>;
|
|
43
55
|
/**
|
|
44
56
|
* Throw `CleanupCancelled` if a cancel has been requested for this run. Cheap
|
|
45
57
|
* to call between chunks; backed by the durable `cancelRequested` flag (the
|
|
@@ -56,13 +68,72 @@ interface Availability {
|
|
|
56
68
|
/** Operator-supplied recipe parameters (branch, module set, before-date, …). */
|
|
57
69
|
interface CleanupInput {
|
|
58
70
|
readonly parameters?: Readonly<Record<string, unknown>> | undefined;
|
|
71
|
+
/**
|
|
72
|
+
* Step ids the operator chose to LEAVE OUT of this run.
|
|
73
|
+
*
|
|
74
|
+
* The obvious shape for this is a free-text ignore-list, which carries one
|
|
75
|
+
* dangerous gap: anything can be ignored, including the checks. Here a step
|
|
76
|
+
* that PROTECTS is not excludable — see
|
|
77
|
+
* {@link CleanupPlanItem.excluded} — because being able to switch off the
|
|
78
|
+
* thing standing between you and a statutory record makes the guard advisory.
|
|
79
|
+
* An unknown or unexcludable id REFUSES the plan rather than being dropped: a
|
|
80
|
+
* silently-ignored exclusion is an operator believing they narrowed a
|
|
81
|
+
* destructive run when they did not.
|
|
82
|
+
*
|
|
83
|
+
* SEALED INTO THE DIGEST. The exclusion set is part of what was consented to,
|
|
84
|
+
* so a plan previewed with accounting excluded cannot be executed as one that
|
|
85
|
+
* includes it.
|
|
86
|
+
*
|
|
87
|
+
* Framework-level and deliberately NOT smuggled through `parameters`:
|
|
88
|
+
* parameters are the recipe's domain scope, this is the composition.
|
|
89
|
+
*/
|
|
90
|
+
readonly excludeSteps?: readonly string[] | undefined;
|
|
59
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* What a line's `estimated` COUNTS. Absent ⇒ `'remove'`, so every existing
|
|
94
|
+
* recipe keeps its meaning.
|
|
95
|
+
*
|
|
96
|
+
* A protective guard step reports the records it DEFENDS, not records it would
|
|
97
|
+
* touch — and summing those into a "records to remove" headline overstates the
|
|
98
|
+
* damage by exactly the protected count. That is not cosmetic: a pre-live reset
|
|
99
|
+
* showed **540 records to remove** when 173 of them were posted journal entries
|
|
100
|
+
* the run would refuse to touch. The number was plausible, internally
|
|
101
|
+
* consistent, and wrong — this codebase's signature failure, in the one place an
|
|
102
|
+
* operator reads before authorising a destructive act.
|
|
103
|
+
*
|
|
104
|
+
* The count cannot be inferred from `blockers`: a guard that finds nothing still
|
|
105
|
+
* reports zero protected records, and a REMOVING line can carry a blocker too.
|
|
106
|
+
* The line has to say which quantity it is.
|
|
107
|
+
*/
|
|
108
|
+
type CleanupPlanItemDisposition = "remove" | "protect" | "rebuild";
|
|
60
109
|
/** One logical line in the preview — a business record class, never a collection. */
|
|
61
110
|
interface CleanupPlanItem {
|
|
111
|
+
/**
|
|
112
|
+
* The contributing step, when the recipe is composed from steps.
|
|
113
|
+
*
|
|
114
|
+
* Without it the exclusion list is enforceable but not DISCOVERABLE: a UI
|
|
115
|
+
* showing `resource` labels has no id to send, so the capability exists and
|
|
116
|
+
* nothing can reach it. Absent for a recipe that is not step-composed.
|
|
117
|
+
*/
|
|
118
|
+
readonly stepId?: string | undefined;
|
|
62
119
|
/** Logical module / resource label, e.g. `'orders'`, `'journal entries'`. */
|
|
63
120
|
readonly resource: string;
|
|
64
121
|
/** Estimated records affected. */
|
|
65
122
|
readonly estimated: number;
|
|
123
|
+
/**
|
|
124
|
+
* Whether `estimated` counts records this line REMOVES, PROTECTS, or REBUILDS.
|
|
125
|
+
* Defaults to `'remove'` — only a line that does something else must say so.
|
|
126
|
+
*/
|
|
127
|
+
readonly disposition?: CleanupPlanItemDisposition | undefined;
|
|
128
|
+
/**
|
|
129
|
+
* The operator excluded this line from the run.
|
|
130
|
+
*
|
|
131
|
+
* It still appears in the plan — showing what was left out is the point; a
|
|
132
|
+
* line that vanishes is indistinguishable from one that was never in scope.
|
|
133
|
+
* Its `estimated` is kept out of both totals, and at execute time the step is
|
|
134
|
+
* reported `skipped` with the reason rather than silently not run.
|
|
135
|
+
*/
|
|
136
|
+
readonly excluded?: boolean | undefined;
|
|
66
137
|
/** What is retained for this line (e.g. `'measures kept, PII redacted'`). */
|
|
67
138
|
readonly retained?: string | undefined;
|
|
68
139
|
/** Domain blockers preventing this line (e.g. `'OPEN_TRANSFER'`). */
|
|
@@ -101,7 +172,26 @@ interface CleanupPlan {
|
|
|
101
172
|
readonly blockers: readonly string[];
|
|
102
173
|
readonly rebuildActions: readonly string[];
|
|
103
174
|
readonly warnings: readonly string[];
|
|
175
|
+
/**
|
|
176
|
+
* Records this plan would REMOVE — the headline an operator authorises against.
|
|
177
|
+
*
|
|
178
|
+
* Counts only `disposition: 'remove'` lines. It used to sum every line, so a
|
|
179
|
+
* protective guard's count landed in the removal total (see
|
|
180
|
+
* {@link CleanupPlanItemDisposition}).
|
|
181
|
+
*/
|
|
104
182
|
readonly estimatedTotal: number;
|
|
183
|
+
/**
|
|
184
|
+
* Records a guard step is DEFENDING in this plan, reported separately so it
|
|
185
|
+
* can be shown as reassurance rather than as damage. Zero when no line
|
|
186
|
+
* protects anything.
|
|
187
|
+
*/
|
|
188
|
+
readonly protectedTotal: number;
|
|
189
|
+
/**
|
|
190
|
+
* Step ids the operator left out, SEALED. re-resolves from here,
|
|
191
|
+
* never from a fresh caller input, so a run cannot be widened past what was
|
|
192
|
+
* previewed and confirmed.
|
|
193
|
+
*/
|
|
194
|
+
readonly excludeSteps: readonly string[];
|
|
105
195
|
readonly confirmationPhrase: string;
|
|
106
196
|
/** Deterministic checksum of the plan's material content — see `computePlanDigest`. */
|
|
107
197
|
readonly digest: string;
|
|
@@ -122,11 +212,64 @@ interface CleanupStepResult {
|
|
|
122
212
|
* fixed-size aggregate, never an unbounded per-chunk array. Detailed steps, if a
|
|
123
213
|
* host wants them, go to a separate capped sink — not this document.
|
|
124
214
|
*/
|
|
215
|
+
/**
|
|
216
|
+
* One step's lifecycle within a run.
|
|
217
|
+
*
|
|
218
|
+
* `skipped` and `failed` are DISTINCT from each other and from `completed`,
|
|
219
|
+
* because collapsing them is what makes a long destructive run unreadable: an
|
|
220
|
+
* operator watching "1,204 processed" cannot tell whether accounting ran, was
|
|
221
|
+
* deliberately not applicable, or blew up and left the rest half-done.
|
|
222
|
+
*/
|
|
223
|
+
type CleanupStepRunStatus = "pending" | "running" | "completed" | "skipped" | "failed";
|
|
224
|
+
/**
|
|
225
|
+
* Per-step progress — the readable half of a run.
|
|
226
|
+
*
|
|
227
|
+
* The conventional shape is one FIXED COLUMN per phase, each holding
|
|
228
|
+
* `Pending | Completed | Skipped`. That works for a fixed pipeline and breaks
|
|
229
|
+
* the moment the pipeline is composed: adding a phase means a schema migration,
|
|
230
|
+
* and a recipe assembled from contributed steps has no fixed phase list at all.
|
|
231
|
+
*
|
|
232
|
+
* So this is a bounded LIST keyed by step id rather than columns. Two further
|
|
233
|
+
* properties, both deliberate:
|
|
234
|
+
*
|
|
235
|
+
* - a `Skipped` with no reason is unreadable — "nothing to do" and
|
|
236
|
+
* "deliberately excluded" are opposite facts, and a bare status enum cannot
|
|
237
|
+
* tell them apart. {@link detail} is REQUIRED for `skipped` and `failed`.
|
|
238
|
+
* - per-step `processed` and timings, so a stalled step is visible while it is
|
|
239
|
+
* still running instead of after the run ends.
|
|
240
|
+
*
|
|
241
|
+
* Bounded by construction: one entry per step in the SEALED plan, and the plan
|
|
242
|
+
* is already capped at `maxPlanItems`. This is not the unbounded per-chunk array
|
|
243
|
+
* the progress summary exists to avoid.
|
|
244
|
+
*/
|
|
245
|
+
interface CleanupStepProgress {
|
|
246
|
+
/** Stable id of the contributing step — survives relabelling of `resource`. */
|
|
247
|
+
readonly stepId: string;
|
|
248
|
+
/** Human-facing record class, e.g. `'journal entries'`. */
|
|
249
|
+
readonly resource: string;
|
|
250
|
+
readonly status: CleanupStepRunStatus;
|
|
251
|
+
/** Records this step has processed so far. */
|
|
252
|
+
readonly processed: number;
|
|
253
|
+
readonly startedAt?: Date | undefined;
|
|
254
|
+
readonly completedAt?: Date | undefined;
|
|
255
|
+
/**
|
|
256
|
+
* WHY, for any non-`completed` terminal state. Required for `skipped` and
|
|
257
|
+
* `failed`: an unexplained non-completion is the thing this field exists to
|
|
258
|
+
* prevent.
|
|
259
|
+
*/
|
|
260
|
+
readonly detail?: string | undefined;
|
|
261
|
+
}
|
|
125
262
|
interface CleanupProgressSummary {
|
|
126
263
|
/** Running total of processed records across all steps. */
|
|
127
264
|
readonly processed: number;
|
|
128
265
|
/** Count of steps reported so far. */
|
|
129
266
|
readonly steps: number;
|
|
267
|
+
/**
|
|
268
|
+
* Per-step lifecycle. Bounded by the sealed plan's step count — see
|
|
269
|
+
* {@link CleanupStepProgress}. Absent on runs recorded before this existed,
|
|
270
|
+
* so a reader must treat it as optional rather than assume an empty run.
|
|
271
|
+
*/
|
|
272
|
+
readonly stepProgress?: readonly CleanupStepProgress[] | undefined;
|
|
130
273
|
/** Resource the last step touched. */
|
|
131
274
|
readonly currentResource?: string | undefined;
|
|
132
275
|
/** Last resume cursor reported. */
|
|
@@ -448,4 +591,4 @@ interface CleanupLimits {
|
|
|
448
591
|
}
|
|
449
592
|
declare const DEFAULT_CLEANUP_LIMITS: CleanupLimits;
|
|
450
593
|
//#endregion
|
|
451
|
-
export {
|
|
594
|
+
export { CleanupStepResult as A, VerificationResult as B, CleanupResult as C, CleanupRunStore as D, CleanupRunStatus as E, PurgeEvidence as F, PurgeResourceResult as I, PurgeStrategyKind$1 as L, CleanupWriteFence as M, DEFAULT_CLEANUP_LIMITS as N, CleanupRunTransitionPatch as O, PurgeActor as P, PurgeVerificationSummary as R, CleanupRecipe as S, CleanupRunCreateResult as T, CleanupPermissions as _, CleanupEvidenceStore as a, CleanupPlanItem as b, CleanupInput as c, CleanupLease as d, CleanupLimits as f, CleanupPermissionCheck as g, CleanupOutcomeStatus as h, CleanupContext as i, CleanupStepRunStatus as j, CleanupStepProgress as k, CleanupJob as l, CleanupManifest as m, CLEANUP_TERMINAL_STATUSES as n, CleanupExecutionContext as o, CleanupLogger as p, CleanupCancelRequest as r, CleanupFinalizationPayload as s, Availability as t, CleanupJobQueue as u, CleanupPlan as v, CleanupRun as w, CleanupProgressSummary as x, CleanupPlanDraft as y, VerificationCheck as z };
|
package/dist/usage/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { i as RequestScope } from "../types-ChuShpCP.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { l as PermissionCheck, u as PermissionContext } from "../base-Csjc2oF-.mjs";
|
|
4
4
|
import { UsageBucket, UsageStore, usagePeriod } from "@classytic/repo-core/usage";
|
|
5
5
|
import { FastifyPluginAsync, FastifyRequest } from "fastify";
|
|
6
6
|
//#region src/usage/requireQuota.d.ts
|
package/dist/usage/index.mjs
CHANGED
|
Binary file
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
|
|
2
|
-
import { $ as OpenApiSchemas, S as QueryParserInterface, b as ParsedQuery } from "../index-CpzxqePp.mjs";
|
|
3
2
|
import { F as getHeader, I as requireSingleHeaderValue, P as ArcHeaders } from "../types-ChuShpCP.mjs";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { f as getUserId, m as normalizeRoles, p as getUserRoles, t as AnyRecord } from "../base-Csjc2oF-.mjs";
|
|
4
|
+
import { $ as OpenApiSchemas, S as QueryParserInterface, b as ParsedQuery } from "../index-BcR2bFZQ.mjs";
|
|
5
|
+
import { n as ErrorMapper } from "../errorHandler-DI5AN2b5.mjs";
|
|
6
6
|
import { a as NotFoundError, c as RateLimitError, d as ValidationError, f as createDomainError, i as ForbiddenError, l as ServiceUnavailableError, m as isArcError, n as ConflictError, o as OrgAccessDeniedError, p as createError, r as ErrorOptions, s as OrgRequiredError, t as ArcError, u as UnauthorizedError } from "../errors-BGdVwP25.mjs";
|
|
7
7
|
import { errorContractSchema, errorDetailSchema } from "@classytic/repo-core/errors";
|
|
8
8
|
import { scheduleBackground } from "@classytic/repo-core/cache";
|
|
@@ -478,6 +478,29 @@ interface ArcQueryParserOptions {
|
|
|
478
478
|
* Also used by MCP to auto-derive filterable fields in tool schemas.
|
|
479
479
|
*/
|
|
480
480
|
allowedFilterFields?: string[];
|
|
481
|
+
/**
|
|
482
|
+
* REFUSE a filter key that is not in {@link allowedFilterFields}, instead of
|
|
483
|
+
* dropping it (default: `false` — today's drop behaviour, kept because arc
|
|
484
|
+
* is published and an unconditional throw would reject requests that work).
|
|
485
|
+
*
|
|
486
|
+
* Dropping a filter does not fail, it **WIDENS**: the caller asked for a
|
|
487
|
+
* narrower set and is silently answered with a broader one, HTTP 200. Two
|
|
488
|
+
* live instances:
|
|
489
|
+
*
|
|
490
|
+
* `?filters[status]=pending` → 200, every row `status:"verified"`
|
|
491
|
+
* `?productId=…` (the param is `skuRef`) → a different product's 75 units,
|
|
492
|
+
* filed for weeks as "quant leakage"
|
|
493
|
+
*
|
|
494
|
+
* Turn this on per-parser, or fleet-wide via `ARC_STRICT_QUERY_PARAMS`.
|
|
495
|
+
* Mirrors the `ARC_STRICT_PERMISSIONS` precedent: off by default here, and
|
|
496
|
+
* the HOST opts in from its env-loader so a forgotten `.env` line cannot
|
|
497
|
+
* silently disable enforcement.
|
|
498
|
+
*
|
|
499
|
+
* Only the FILTER whitelist is covered. `allowedSortFields` /
|
|
500
|
+
* `allowedOperators` keep dropping: a rejected sort or operator degrades
|
|
501
|
+
* ordering, it does not widen the row set.
|
|
502
|
+
*/
|
|
503
|
+
strictFilterFields?: boolean;
|
|
481
504
|
/**
|
|
482
505
|
* Whitelist of fields that can be sorted on.
|
|
483
506
|
* When set, sort fields not in this list are silently dropped.
|
|
@@ -527,7 +550,12 @@ interface ArcQueryParserOptions {
|
|
|
527
550
|
* For advanced MongoDB features ($lookup, aggregations), use MongoKit's QueryParser.
|
|
528
551
|
*/
|
|
529
552
|
declare class ArcQueryParser implements QueryParserInterface {
|
|
530
|
-
|
|
553
|
+
/**
|
|
554
|
+
* PUBLIC, deliberately: `QueryResolver` reads it so it does not apply a second cap
|
|
555
|
+
* on top of this one. Three layers capping independently, lowest winning silently,
|
|
556
|
+
* is what made a 696-row chart of accounts render as 100.
|
|
557
|
+
*/
|
|
558
|
+
readonly maxLimit: number;
|
|
531
559
|
private readonly defaultLimit;
|
|
532
560
|
private readonly maxRegexLength;
|
|
533
561
|
private readonly maxSearchLength;
|
|
@@ -535,6 +563,7 @@ declare class ArcQueryParser implements QueryParserInterface {
|
|
|
535
563
|
private readonly _allowedFilterFields?;
|
|
536
564
|
private readonly _allowedSortFields?;
|
|
537
565
|
private readonly _allowedOperators?;
|
|
566
|
+
private readonly strictFilterFields;
|
|
538
567
|
/** Allowed filter fields (used by MCP for auto-derive) */
|
|
539
568
|
readonly allowedFilterFields?: readonly string[];
|
|
540
569
|
/** Allowed sort fields (used by MCP for sort descriptions) */
|
|
@@ -1105,6 +1134,29 @@ declare function getListQueryParams(): AnyRecord;
|
|
|
1105
1134
|
*/
|
|
1106
1135
|
declare function getDefaultCrudSchemas(): Record<string, Record<string, unknown>>;
|
|
1107
1136
|
//#endregion
|
|
1137
|
+
//#region src/utils/runtimeCapabilities.d.ts
|
|
1138
|
+
/** What a subsystem declares about the state it holds. */
|
|
1139
|
+
interface RuntimeCapabilityDeclaration {
|
|
1140
|
+
/** Dotted subsystem id, e.g. `'webhooks.subscriptions'`, `'events.transport'`. */
|
|
1141
|
+
subsystem: string;
|
|
1142
|
+
/** Where the state lives: `'memory'` = this process only; `'shared'` = external/durable. */
|
|
1143
|
+
durability: "memory" | "shared";
|
|
1144
|
+
/**
|
|
1145
|
+
* `'memory'` durability that is CORRECT by design (per-process micro-cache,
|
|
1146
|
+
* declared single-process topology). Audited as info, never an error —
|
|
1147
|
+
* acceptance must be stated by the declarant, not inferred by the audit.
|
|
1148
|
+
*/
|
|
1149
|
+
accepted?: boolean;
|
|
1150
|
+
/** One line for the audit output: what breaks multi-replica, or why accepted. */
|
|
1151
|
+
detail?: string;
|
|
1152
|
+
}
|
|
1153
|
+
/**
|
|
1154
|
+
* Declare a runtime capability. Callable from ANY registration context —
|
|
1155
|
+
* arc's own plugins, host `plugins()` callbacks, module `plugins` phases —
|
|
1156
|
+
* which is the point: the audit sees what the constructor-time guard cannot.
|
|
1157
|
+
*/
|
|
1158
|
+
declare function declareRuntimeCapability(fastify: FastifyInstance, decl: RuntimeCapabilityDeclaration): void;
|
|
1159
|
+
//#endregion
|
|
1108
1160
|
//#region src/utils/schemaConverter.d.ts
|
|
1109
1161
|
/**
|
|
1110
1162
|
* Supported JSON Schema output targets for Zod v4's `toJSONSchema()`.
|
|
@@ -1514,4 +1566,4 @@ declare function hasEvents(instance: FastifyInstance): instance is FastifyInstan
|
|
|
1514
1566
|
events: EventsDecorator;
|
|
1515
1567
|
};
|
|
1516
1568
|
//#endregion
|
|
1517
|
-
export { ArcError, type ArcHeaders, ArcQueryParser, type ArcQueryParserOptions, CircuitBreaker, CircuitBreakerError, type CircuitBreakerOptions, CircuitBreakerRegistry, type CircuitBreakerStats, CircuitState, type CompensationDefinition, type CompensationError, type CompensationHooks, type CompensationResult, type CompensationStep, ConflictError, type ErrorOptions, type EventsDecorator, type FilterDialect, ForbiddenError, type Guard, type GuardConfig, type JsonSchema, type JsonSchemaTarget, MONGO_DIALECT, NEUTRAL_DIALECT, NotFoundError, OrgAccessDeniedError, OrgRequiredError, type PipeUIMessageStreamOptions, RateLimitError, type SchemaIo, ServiceUnavailableError, type SseStream, type SseStreamOptions, type StateMachine, type TransitionConfig, UI_MESSAGE_STREAM_HEADERS, UnauthorizedError, ValidationError, aggregateListResponse, bareListResponse, convertOpenApiSchemas, convertRouteSchema, createCircuitBreaker, createCircuitBreakerRegistry, createDomainError, createError, createQueryParser, createStateMachine, defineCompensation, defineErrorMapper, defineGuard, deleteResponse, errorContractSchema, errorDetailSchema, forwardedStreamHeaders, getDefaultCrudSchemas, getHeader, getListQueryParams, getUserId, getUserRoles, handleRaw, hasEvents, isArcError, isJsonSchema, isReadableStream, isZodSchema, keysetListResponse, listResponse, normalizeRoles, offsetListResponse, openSseStream, paginationSchema, pipeUIMessageStreamToReply, promoteStreamTokenToHeader, queryParams, requireSingleHeaderValue, responses, scheduleBackground, simpleEqualityMatcher, toJsonSchema, withCompensation };
|
|
1569
|
+
export { ArcError, type ArcHeaders, ArcQueryParser, type ArcQueryParserOptions, CircuitBreaker, CircuitBreakerError, type CircuitBreakerOptions, CircuitBreakerRegistry, type CircuitBreakerStats, CircuitState, type CompensationDefinition, type CompensationError, type CompensationHooks, type CompensationResult, type CompensationStep, ConflictError, type ErrorOptions, type EventsDecorator, type FilterDialect, ForbiddenError, type Guard, type GuardConfig, type JsonSchema, type JsonSchemaTarget, MONGO_DIALECT, NEUTRAL_DIALECT, NotFoundError, OrgAccessDeniedError, OrgRequiredError, type PipeUIMessageStreamOptions, RateLimitError, type RuntimeCapabilityDeclaration, type SchemaIo, ServiceUnavailableError, type SseStream, type SseStreamOptions, type StateMachine, type TransitionConfig, UI_MESSAGE_STREAM_HEADERS, UnauthorizedError, ValidationError, aggregateListResponse, bareListResponse, convertOpenApiSchemas, convertRouteSchema, createCircuitBreaker, createCircuitBreakerRegistry, createDomainError, createError, createQueryParser, createStateMachine, declareRuntimeCapability, defineCompensation, defineErrorMapper, defineGuard, deleteResponse, errorContractSchema, errorDetailSchema, forwardedStreamHeaders, getDefaultCrudSchemas, getHeader, getListQueryParams, getUserId, getUserRoles, handleRaw, hasEvents, isArcError, isJsonSchema, isReadableStream, isZodSchema, keysetListResponse, listResponse, normalizeRoles, offsetListResponse, openSseStream, paginationSchema, pipeUIMessageStreamToReply, promoteStreamTokenToHeader, queryParams, requireSingleHeaderValue, responses, scheduleBackground, simpleEqualityMatcher, toJsonSchema, withCompensation };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { a as OrgAccessDeniedError, c as ServiceUnavailableError, d as createDomainError, f as createError, i as NotFoundError, l as UnauthorizedError, n as ConflictError, o as OrgRequiredError, p as isArcError, r as ForbiddenError, s as RateLimitError, t as ArcError, u as ValidationError } from "../errors-
|
|
3
|
-
import { n as requireSingleHeaderValue, t as getHeader } from "../headers-
|
|
4
|
-
import { n as getUserRoles, r as normalizeRoles, t as getUserId } from "../userHelpers-
|
|
5
|
-
import { t as simpleEqualityMatcher } from "../simpleEqualityMatcher-
|
|
6
|
-
import { A as createCircuitBreakerRegistry, C as defineCompensation, D as CircuitBreakerRegistry, E as CircuitBreakerError, O as CircuitState, S as defineErrorMapper, T as CircuitBreaker, _ as createQueryParser, a as deleteResponse, b as NEUTRAL_DIALECT, c as getDefaultCrudSchemas, d as listResponse, f as offsetListResponse, g as ArcQueryParser, h as responses, i as bareListResponse, k as createCircuitBreaker, l as getListQueryParams, m as queryParams, n as scheduleBackground, o as errorContractSchema, p as paginationSchema, r as aggregateListResponse, s as errorDetailSchema, t as createStateMachine, u as keysetListResponse, v as handleRaw, w as withCompensation, x as defineGuard, y as MONGO_DIALECT } from "../utils-
|
|
7
|
-
import {
|
|
8
|
-
import { a as
|
|
9
|
-
import { t as
|
|
10
|
-
import { t as
|
|
11
|
-
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as OrgAccessDeniedError, c as ServiceUnavailableError, d as createDomainError, f as createError, i as NotFoundError, l as UnauthorizedError, n as ConflictError, o as OrgRequiredError, p as isArcError, r as ForbiddenError, s as RateLimitError, t as ArcError, u as ValidationError } from "../errors-Cd_yy7aW.mjs";
|
|
3
|
+
import { n as requireSingleHeaderValue, t as getHeader } from "../headers-CveNO9gR.mjs";
|
|
4
|
+
import { n as getUserRoles, r as normalizeRoles, t as getUserId } from "../userHelpers-CWF5pbZD.mjs";
|
|
5
|
+
import { t as simpleEqualityMatcher } from "../simpleEqualityMatcher-Se8VrsaP.mjs";
|
|
6
|
+
import { A as createCircuitBreakerRegistry, C as defineCompensation, D as CircuitBreakerRegistry, E as CircuitBreakerError, O as CircuitState, S as defineErrorMapper, T as CircuitBreaker, _ as createQueryParser, a as deleteResponse, b as NEUTRAL_DIALECT, c as getDefaultCrudSchemas, d as listResponse, f as offsetListResponse, g as ArcQueryParser, h as responses, i as bareListResponse, k as createCircuitBreaker, l as getListQueryParams, m as queryParams, n as scheduleBackground, o as errorContractSchema, p as paginationSchema, r as aggregateListResponse, s as errorDetailSchema, t as createStateMachine, u as keysetListResponse, v as handleRaw, w as withCompensation, x as defineGuard, y as MONGO_DIALECT } from "../utils-h1V_sT-t.mjs";
|
|
7
|
+
import { n as declareRuntimeCapability } from "../runtimeCapabilities-Dm88DaTW.mjs";
|
|
8
|
+
import { a as isZodSchema, i as isJsonSchema, n as convertRouteSchema, o as toJsonSchema, t as convertOpenApiSchemas } from "../schemaConverter-XH1RZRyu.mjs";
|
|
9
|
+
import { a as promoteStreamTokenToHeader, i as pipeUIMessageStreamToReply, n as forwardedStreamHeaders, r as isReadableStream, t as UI_MESSAGE_STREAM_HEADERS } from "../streaming-DsT1B5zJ.mjs";
|
|
10
|
+
import { t as openSseStream } from "../sseStream-Bvpi-UXQ.mjs";
|
|
11
|
+
import { t as hasEvents } from "../typeGuards-jjKJDN13.mjs";
|
|
12
|
+
export { ArcError, ArcQueryParser, CircuitBreaker, CircuitBreakerError, CircuitBreakerRegistry, CircuitState, ConflictError, ForbiddenError, MONGO_DIALECT, NEUTRAL_DIALECT, NotFoundError, OrgAccessDeniedError, OrgRequiredError, RateLimitError, ServiceUnavailableError, UI_MESSAGE_STREAM_HEADERS, UnauthorizedError, ValidationError, aggregateListResponse, bareListResponse, convertOpenApiSchemas, convertRouteSchema, createCircuitBreaker, createCircuitBreakerRegistry, createDomainError, createError, createQueryParser, createStateMachine, declareRuntimeCapability, defineCompensation, defineErrorMapper, defineGuard, deleteResponse, errorContractSchema, errorDetailSchema, forwardedStreamHeaders, getDefaultCrudSchemas, getHeader, getListQueryParams, getUserId, getUserRoles, handleRaw, hasEvents, isArcError, isJsonSchema, isReadableStream, isZodSchema, keysetListResponse, listResponse, normalizeRoles, offsetListResponse, openSseStream, paginationSchema, pipeUIMessageStreamToReply, promoteStreamTokenToHeader, queryParams, requireSingleHeaderValue, responses, scheduleBackground, simpleEqualityMatcher, toJsonSchema, withCompensation };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { m as RESERVED_QUERY_PARAMS } from "./constants-
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
import { m as RESERVED_QUERY_PARAMS } from "./constants-BxCoxmiN.mjs";
|
|
3
3
|
import { arcLog } from "./logger/index.mjs";
|
|
4
|
-
import { t as ArcError } from "./errors-
|
|
4
|
+
import { t as ArcError, u as ValidationError } from "./errors-Cd_yy7aW.mjs";
|
|
5
5
|
import { errorContractSchema as errorContractSchema$1, errorDetailSchema as errorDetailSchema$1 } from "@classytic/repo-core/errors";
|
|
6
6
|
import { scheduleBackground } from "@classytic/repo-core/cache";
|
|
7
7
|
//#region src/utils/circuitBreaker.ts
|
|
@@ -591,6 +591,11 @@ const DANGEROUS_REGEX_PATTERNS = /(\{[0-9,]+\}|\*\+|\+\+|\?\+|(\(.+\))\+|\(\?:|\
|
|
|
591
591
|
* For advanced MongoDB features ($lookup, aggregations), use MongoKit's QueryParser.
|
|
592
592
|
*/
|
|
593
593
|
var ArcQueryParser = class {
|
|
594
|
+
/**
|
|
595
|
+
* PUBLIC, deliberately: `QueryResolver` reads it so it does not apply a second cap
|
|
596
|
+
* on top of this one. Three layers capping independently, lowest winning silently,
|
|
597
|
+
* is what made a 696-row chart of accounts render as 100.
|
|
598
|
+
*/
|
|
594
599
|
maxLimit;
|
|
595
600
|
defaultLimit;
|
|
596
601
|
maxRegexLength;
|
|
@@ -599,6 +604,7 @@ var ArcQueryParser = class {
|
|
|
599
604
|
_allowedFilterFields;
|
|
600
605
|
_allowedSortFields;
|
|
601
606
|
_allowedOperators;
|
|
607
|
+
strictFilterFields;
|
|
602
608
|
/** Allowed filter fields (used by MCP for auto-derive) */
|
|
603
609
|
allowedFilterFields;
|
|
604
610
|
/** Allowed sort fields (used by MCP for sort descriptions) */
|
|
@@ -621,6 +627,7 @@ var ArcQueryParser = class {
|
|
|
621
627
|
this.maxRegexLength = options.maxRegexLength ?? 200;
|
|
622
628
|
this.maxSearchLength = options.maxSearchLength ?? 200;
|
|
623
629
|
this.maxFilterDepth = options.maxFilterDepth ?? 10;
|
|
630
|
+
this.strictFilterFields = options.strictFilterFields ?? process.env.ARC_STRICT_QUERY_PARAMS === "true";
|
|
624
631
|
if (options.allowedFilterFields) {
|
|
625
632
|
this._allowedFilterFields = new Set(options.allowedFilterFields);
|
|
626
633
|
this.allowedFilterFields = options.allowedFilterFields;
|
|
@@ -787,7 +794,10 @@ var ArcQueryParser = class {
|
|
|
787
794
|
if (value === void 0 || value === null) return;
|
|
788
795
|
if (!/^[a-zA-Z_][a-zA-Z0-9_.]*(?:\[[a-z]+\])?$/.test(key)) return;
|
|
789
796
|
const bareKey = key.replace(/\[[a-z]+\]$/, "");
|
|
790
|
-
if (this._allowedFilterFields && !this._allowedFilterFields.has(bareKey))
|
|
797
|
+
if (this._allowedFilterFields && !this._allowedFilterFields.has(bareKey)) {
|
|
798
|
+
if (this.strictFilterFields) throw new ValidationError(`Unknown filter field: ${bareKey}. Allowed: ${[...this._allowedFilterFields].sort().join(", ")}`);
|
|
799
|
+
return;
|
|
800
|
+
}
|
|
791
801
|
if (this.exceedsDepth(value)) return;
|
|
792
802
|
if (typeof value === "object" && value !== null && !Array.isArray(value)) {
|
|
793
803
|
const operatorObj = value;
|
|
@@ -879,10 +889,31 @@ var ArcQueryParser = class {
|
|
|
879
889
|
},
|
|
880
890
|
limit: {
|
|
881
891
|
type: "integer",
|
|
882
|
-
|
|
892
|
+
/**
|
|
893
|
+
* The cap is DOCUMENTED here, not enforced — deliberately.
|
|
894
|
+
*
|
|
895
|
+
* Both layers that handle `limit` CLAMP it: this parser
|
|
896
|
+
* (`Math.min(…, this.maxLimit)`) and `QueryResolver`. Emitting
|
|
897
|
+
* `maximum` contradicted them, because arc layers this schema as the
|
|
898
|
+
* route's `listQuery` and Fastify validates the querystring BEFORE
|
|
899
|
+
* either runs — so the clamp was unreachable and `?limit=200` became a
|
|
900
|
+
* hard 400.
|
|
901
|
+
*
|
|
902
|
+
* That combination is worse than either policy alone. Asking for more
|
|
903
|
+
* rows than allowed is a benign over-ask with an obvious right answer
|
|
904
|
+
* (give the maximum); turning it into a validation failure means a UI
|
|
905
|
+
* passing a generous page size gets NOTHING, and a caller that does not
|
|
906
|
+
* inspect the error body renders it as an empty list — a 400 disguised
|
|
907
|
+
* as "no results", which is the hardest kind to find.
|
|
908
|
+
*
|
|
909
|
+
* A deployment wanting refusal instead of clamping should say so in the
|
|
910
|
+
* parser's policy, where both halves can agree, not in a schema that
|
|
911
|
+
* silently outranks them. Mirrors the same fix in mongokit's
|
|
912
|
+
* `buildQuerySchema`.
|
|
913
|
+
*/
|
|
914
|
+
description: `Number of items per page (values above ${this.maxLimit} are capped to ${this.maxLimit})`,
|
|
883
915
|
default: this.defaultLimit,
|
|
884
|
-
minimum: 1
|
|
885
|
-
maximum: this.maxLimit
|
|
916
|
+
minimum: 1
|
|
886
917
|
},
|
|
887
918
|
sort: {
|
|
888
919
|
type: "string",
|
|
@@ -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
|
//#region src/core/aggregation/normalize.ts
|
|
4
4
|
/**
|
|
5
5
|
* Framework cap on URL-driven aggregation limits when the host opts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { t as __exportAll } from "./rolldown-runtime-
|
|
3
|
-
import { d as createDomainError } from "./errors-
|
|
1
|
+
/*! @classytic/arc v2.34.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as __exportAll } from "./rolldown-runtime-DNg-KNCk.mjs";
|
|
3
|
+
import { d as createDomainError } from "./errors-Cd_yy7aW.mjs";
|
|
4
4
|
import fp from "fastify-plugin";
|
|
5
5
|
//#region src/plugins/versioning.ts
|
|
6
6
|
var versioning_exports = /* @__PURE__ */ __exportAll({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@classytic/arc",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.34.0",
|
|
4
4
|
"description": "Resource-oriented backend framework for Fastify - clean, minimal, powerful, tree-shakable",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -336,13 +336,14 @@
|
|
|
336
336
|
"test:smoke:redis": "node scripts/smoke-ws-redis.mjs",
|
|
337
337
|
"smoke": "node scripts/smoke-test.mjs",
|
|
338
338
|
"smoke:consumer": "node scripts/smoke-test.mjs --consumer",
|
|
339
|
+
"smoke:mcp": "node scripts/mcp-e2e.mjs",
|
|
339
340
|
"push": "classytic-push",
|
|
340
341
|
"release:tag": "node -e \"require('child_process').execSync('npm run push -- v'+require('./package.json').version,{stdio:'inherit'})\"",
|
|
341
342
|
"release": "npm run push -- main && npm run release:tag && npm publish",
|
|
342
343
|
"check:peer-skew": "node scripts/check-peer-skew.mjs",
|
|
343
344
|
"check:docs-drift": "node scripts/check-docs-drift.mjs",
|
|
344
345
|
"check:boundaries": "node scripts/check-boundaries.mjs",
|
|
345
|
-
"prepublishOnly": "npm run check:peer-skew && npm run check:docs-drift && npm run check:route-api && npm run check:boundaries && npm run typecheck && npm run lint && npm run build && npm run check:api-surface && npm run check:forgotten-exports && npm run check:package && npm run test:ci && npm run smoke:consumer",
|
|
346
|
+
"prepublishOnly": "npm run check:peer-skew && npm run check:docs-drift && npm run check:route-api && npm run check:boundaries && npm run typecheck && npm run lint && npm run build && npm run check:api-surface && npm run check:forgotten-exports && npm run check:package && npm run test:ci && npm run smoke:consumer && npm run smoke:mcp",
|
|
346
347
|
"check:route-api": "node scripts/check-removed-route-api.mjs",
|
|
347
348
|
"check:forgotten-exports": "node scripts/check-forgotten-exports.mjs"
|
|
348
349
|
},
|
|
@@ -350,8 +351,8 @@
|
|
|
350
351
|
"node": ">=22"
|
|
351
352
|
},
|
|
352
353
|
"peerDependencies": {
|
|
353
|
-
"@classytic/primitives": ">=0.
|
|
354
|
-
"@classytic/repo-core": ">=0.
|
|
354
|
+
"@classytic/primitives": ">=0.23.0",
|
|
355
|
+
"@classytic/repo-core": ">=0.24.0",
|
|
355
356
|
"@classytic/streamline": ">=2.8.0",
|
|
356
357
|
"@fastify/cors": ">=11.0.0",
|
|
357
358
|
"@fastify/helmet": ">=13.0.0",
|
|
@@ -359,6 +360,7 @@
|
|
|
359
360
|
"@fastify/multipart": ">=9.0.0",
|
|
360
361
|
"@fastify/rate-limit": ">=10.0.0",
|
|
361
362
|
"@fastify/sensible": ">=6.0.0",
|
|
363
|
+
"@fastify/static": ">=8.0.0",
|
|
362
364
|
"@fastify/type-provider-typebox": ">=6.0.0",
|
|
363
365
|
"@fastify/under-pressure": ">=9.0.0",
|
|
364
366
|
"@fastify/websocket": ">=11.0.0",
|
|
@@ -378,9 +380,8 @@
|
|
|
378
380
|
"jose": ">=5.0.0",
|
|
379
381
|
"pino-pretty": ">=13.0.0",
|
|
380
382
|
"typebox": ">=1.0.0",
|
|
381
|
-
"
|
|
382
|
-
"
|
|
383
|
-
"vitest": ">=3.0.0"
|
|
383
|
+
"vitest": ">=3.0.0",
|
|
384
|
+
"zod": ">=4.4.0"
|
|
384
385
|
},
|
|
385
386
|
"peerDependenciesMeta": {
|
|
386
387
|
"better-auth": {
|
|
@@ -480,11 +481,11 @@
|
|
|
480
481
|
"@biomejs/biome": "^2.5.7",
|
|
481
482
|
"@classytic/dev-tools": "^0.2.0",
|
|
482
483
|
"@classytic/gitkit": ">=0.1.0",
|
|
483
|
-
"@classytic/mongokit": "^3.
|
|
484
|
+
"@classytic/mongokit": "^3.33.0",
|
|
484
485
|
"@classytic/pgkit": "^0.1.0",
|
|
485
|
-
"@classytic/primitives": "^0.
|
|
486
|
-
"@classytic/repo-core": "^0.
|
|
487
|
-
"@classytic/sqlitekit": "^0.
|
|
486
|
+
"@classytic/primitives": "^0.23.0",
|
|
487
|
+
"@classytic/repo-core": "^0.24.0",
|
|
488
|
+
"@classytic/sqlitekit": "^0.9.0",
|
|
488
489
|
"@classytic/streamline": "^2.8.2",
|
|
489
490
|
"@electric-sql/pglite": "^0.5.4",
|
|
490
491
|
"@fastify/cors": "^11.2.0",
|
|
@@ -504,15 +505,15 @@
|
|
|
504
505
|
"@vitest/coverage-v8": "^4.1.9",
|
|
505
506
|
"ajv": "^8.20.0",
|
|
506
507
|
"better-auth": "^1.6.25",
|
|
507
|
-
"better-sqlite3": "^
|
|
508
|
-
"bullmq": "^
|
|
508
|
+
"better-sqlite3": "^13.0.3",
|
|
509
|
+
"bullmq": "^6.1.2",
|
|
509
510
|
"dotenv": "^17.4.2",
|
|
510
511
|
"drizzle-orm": "^0.45.2",
|
|
511
512
|
"fast-check": "^4.8.0",
|
|
512
|
-
"fastify": "^5.
|
|
513
|
-
"fastify-raw-body": "^
|
|
513
|
+
"fastify": "^5.12.0",
|
|
514
|
+
"fastify-raw-body": "^6.0.1",
|
|
514
515
|
"h3-js": "^4.4.0",
|
|
515
|
-
"ioredis": "^
|
|
516
|
+
"ioredis": "^6.0.0",
|
|
516
517
|
"jose": "^6.2.3",
|
|
517
518
|
"jsonwebtoken": "^9.0.3",
|
|
518
519
|
"knip": "^6.31.0",
|