@classytic/arc 2.41.1 → 2.44.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/{EventTransport-CbUKDzZZ.d.mts → EventTransport-CiicKz2Z.d.mts} +1 -1
- package/dist/{EventTransport-DSqD_Xsg.mjs → EventTransport-DZWDsaPa.mjs} +22 -17
- package/dist/{HookSystem-CMF94SEA.mjs → HookSystem-yjEgn7Cm.mjs} +2 -2
- package/dist/{QueryCache-DFA-QrU9.d.mts → QueryCache--5uAuYPW.d.mts} +7 -3
- package/dist/{ResourceRegistry-MGpXoxHZ.mjs → ResourceRegistry-DJxHUpE4.mjs} +44 -13
- package/dist/acquire-BozJ-9yt.mjs +35 -0
- package/dist/actionPermissions-5N04zBL4.mjs +772 -0
- package/dist/audit/index.d.mts +46 -8
- package/dist/audit/index.mjs +48 -26
- package/dist/auth/audit.d.mts +8 -8
- package/dist/auth/audit.mjs +1 -1
- package/dist/auth/index.d.mts +46 -16
- package/dist/auth/index.mjs +134 -156
- package/dist/auth/redis-session.d.mts +4 -5
- package/dist/auth/redis-session.mjs +1 -1
- package/dist/{authorizationDecision-DawKGoXb.mjs → authorizationDecision-wX3SA9w_.mjs} +7 -102
- package/dist/{base-CxrV1LmG.d.mts → base-CZyixEQR.d.mts} +27 -5
- package/dist/boundedMap-DWiKW7lP.mjs +57 -0
- package/dist/{buildHandler-CvxKOc0m.mjs → buildHandler-Bswu_vNb.mjs} +4 -4
- package/dist/cache/index.d.mts +31 -43
- package/dist/cache/index.mjs +4 -4
- package/dist/{caching-DbCBxlgw.mjs → caching-Drp68DIS.mjs} +3 -3
- package/dist/claimed-DYvQoZLv.mjs +8 -0
- package/dist/cleanup/index.d.mts +18 -22
- package/dist/cleanup/index.mjs +27 -73
- package/dist/cli/commands/describe.d.mts +7 -5
- package/dist/cli/commands/describe.mjs +7 -4
- package/dist/cli/commands/docs.d.mts +2 -3
- package/dist/cli/commands/docs.mjs +3 -3
- package/dist/cli/commands/doctor.d.mts +2 -3
- package/dist/cli/commands/doctor.mjs +1 -1
- package/dist/cli/commands/generate.mjs +2 -3
- package/dist/cli/commands/init.mjs +2 -3
- package/dist/cli/commands/introspect.d.mts +2 -3
- package/dist/cli/commands/introspect.mjs +2 -2
- package/dist/cli/index.mjs +3 -3
- package/dist/{constants-D5Ubn1fe.mjs → constants-B2QHb6u6.mjs} +4 -2
- package/dist/context/index.d.mts +11 -14
- package/dist/context/index.mjs +18 -38
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +8 -8
- package/dist/{core-5lazhva9.mjs → core-COcqo0Cp.mjs} +15 -5
- package/dist/{createActionRouter-DNqoaK81.mjs → createActionRouter-zG13rpPJ.mjs} +97 -39
- package/dist/{createAggregationRouter-BcbQJf10.mjs → createAggregationRouter-CWRz96Vr.mjs} +11 -8
- package/dist/{preloadResources-f3boenVZ.mjs → createApp-BGLYtErt.mjs} +305 -394
- package/dist/{createMcpServer-CbDWkZ1T.d.mts → createMcpServer-DSztofa9.d.mts} +1 -1
- package/dist/{defineAggregation-D_eJjm5A.mjs → defineAggregation--3xguLkk.mjs} +1 -1
- package/dist/{defineResource-DxkMTjRn.mjs → defineResource-gUp9ug66.mjs} +118 -1024
- package/dist/discovery/index.d.mts +6 -7
- package/dist/discovery/index.mjs +1 -1
- package/dist/docs/index.d.mts +11 -5
- package/dist/docs/index.mjs +4 -4
- package/dist/{elevation-CkvG0LG2.mjs → elevation-BG4gnMsJ.mjs} +41 -12
- package/dist/{elevation-BXCfVcNG.d.mts → elevation-BW2J3tNj.d.mts} +1 -2
- package/dist/encryption/index.d.mts +5 -5
- package/dist/encryption/index.mjs +3 -3
- package/dist/{errorHandler-D1GHKGlV.mjs → errorHandler-COHw3N1b.mjs} +26 -5
- package/dist/{errors-BH7YU_9O.mjs → errors-CW4anJBy.mjs} +58 -23
- package/dist/{errors-BGdVwP25.d.mts → errors-JYc9vwqE.d.mts} +9 -0
- package/dist/{eventPlugin-B52abJ8W.d.mts → eventPlugin-BtmA4-3P.d.mts} +65 -9
- package/dist/{eventPlugin-zZY-unhr.mjs → eventPlugin-BweHAVws.mjs} +82 -21
- package/dist/{subscribe-helpers-DatDkcuG.mjs → eventTypes-N4-omQFR.mjs} +151 -17
- package/dist/events/index.d.mts +43 -18
- package/dist/events/index.mjs +49 -53
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis-stream-entry.mjs +139 -157
- package/dist/events/transports/redis.d.mts +5 -6
- package/dist/events/transports/redis.mjs +2 -2
- package/dist/factory/index.d.mts +42 -27
- package/dist/factory/index.mjs +213 -32
- package/dist/{fastify-augmentation-Cq2nHVaW.d.mts → fastify-augmentation-DRlCIWE9.d.mts} +11 -25
- package/dist/{fields-BHrkoF5y.mjs → fields-A5crhsJb.mjs} +1 -1
- package/dist/{fields-I_EeRWND.d.mts → fields-BBSpf8pS.d.mts} +1 -1
- package/dist/filter-merge-DGM-GQ1J.mjs +99 -0
- package/dist/{generate-BLRf2m3y.mjs → generate-BXKo2Gc8.mjs} +2 -2
- package/dist/{headers-BIXWKrzQ.mjs → headers-DKZQKL-Z.mjs} +2 -2
- package/dist/health-BYAwA6YS.mjs +22 -0
- package/dist/{health-ZRHeDHXH.mjs → health-CrqUp3sz.mjs} +115 -55
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.mjs +2 -3
- package/dist/idempotency/index.d.mts +36 -10
- package/dist/idempotency/index.mjs +230 -111
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/idempotency/redis.mjs +77 -12
- package/dist/{index-D4u76eQW.d.mts → index-Beg3aNnK.d.mts} +23 -101
- package/dist/{preloadResources-CjS2OfpU.d.mts → index-BkV55WlV.d.mts} +37 -38
- package/dist/{index-BHdZD8zK.d.mts → index-Bxriq3so.d.mts} +84 -21
- package/dist/index-CUJvoyw3.d.mts +510 -0
- package/dist/{index-CbJiYrfv.d.mts → index-Chgz3d0i.d.mts} +1 -1
- package/dist/{index-DHbyPo5j.d.mts → index-WH7xgvxS.d.mts} +304 -254
- package/dist/index.d.mts +9 -9
- package/dist/index.mjs +11 -11
- package/dist/{init-CpLkjU18.mjs → init-BPzK5Lnr.mjs} +1 -1
- package/dist/integrations/event-gateway.d.mts +11 -7
- package/dist/integrations/event-gateway.mjs +4 -4
- package/dist/integrations/index.d.mts +3 -3
- package/dist/integrations/index.mjs +1 -1
- package/dist/integrations/jobs/index.d.mts +1 -1
- package/dist/integrations/jobs/index.mjs +18 -5
- package/dist/integrations/mcp/index.d.mts +102 -89
- package/dist/integrations/mcp/index.mjs +19 -4
- package/dist/integrations/mcp/testing.d.mts +8 -9
- package/dist/integrations/mcp/testing.mjs +2 -2
- package/dist/integrations/streamline.d.mts +85 -144
- package/dist/integrations/streamline.mjs +131 -55
- package/dist/integrations/webhooks.d.mts +83 -143
- package/dist/integrations/webhooks.mjs +36 -80
- package/dist/integrations/websocket-pushref-redis.d.mts +5 -6
- package/dist/integrations/websocket-pushref-redis.mjs +1 -1
- package/dist/integrations/websocket-redis.d.mts +5 -6
- package/dist/integrations/websocket-redis.mjs +1 -1
- package/dist/integrations/websocket.d.mts +3 -3
- package/dist/integrations/websocket.mjs +2 -2
- package/dist/{interface-DEWNOMza.d.mts → interface-JJzwH4Ro.d.mts} +34 -2
- package/dist/{jsonBody-ELR9lfeU.mjs → jsonBody-YIq-vGLv.mjs} +2 -2
- package/dist/{keys-cpZCtcIE.mjs → keys-CpoiZ8hU.mjs} +7 -18
- package/dist/{loadResources-BPfWiI5s.mjs → loadResources-6jO52-RR.mjs} +3 -3
- package/dist/{loadResourcesFromEntry-ixtfL3J2.mjs → loadResourcesFromEntry-MP8xEppu.mjs} +2 -2
- package/dist/logger/index.d.mts +9 -17
- package/dist/logger/index.mjs +2 -153
- package/dist/logger-D4V1zGLI.mjs +160 -0
- package/dist/{mcpPlugin-BX5PujI0.mjs → mcpPlugin-srPc7ItN.mjs} +446 -170
- package/dist/{memory-Iotz0cCx.mjs → memory-CTa5pOCW.mjs} +36 -34
- package/dist/{metrics-NMsmpRmY.mjs → metrics-DsZrvnpB.mjs} +39 -72
- package/dist/middleware/index.d.mts +5 -5
- package/dist/middleware/index.mjs +3 -3
- package/dist/migrations/index.d.mts +13 -13
- package/dist/migrations/index.mjs +2 -2
- package/dist/{module-DpLJG2_N.mjs → module--L0iBIZz.mjs} +8 -8
- package/dist/mongodb-memory-server-CHhYSq5y.mjs +35539 -0
- package/dist/mongoose-CYJCLyi-.mjs +67451 -0
- package/dist/multiTenant-CAtYlW6H.d.mts +104 -0
- package/dist/{multipartBody-DtRWM6_U.mjs → multipartBody-Cc7eZ9cq.mjs} +46 -7
- package/dist/node-D8UZv_8c.mjs +41236 -0
- package/dist/{openapi-CmFf3yq_.mjs → openapi-CMegfsm8.mjs} +48 -10
- package/dist/outbox-admin/index.d.mts +5 -5
- package/dist/outbox-admin/index.mjs +6 -18
- package/dist/{outbox-module-D2z5WkDY.mjs → outbox-module-Ryk270jd.mjs} +203 -33
- package/dist/{outbox-module-BHdUnuuK.d.mts → outbox-module-gZCHoE4H.d.mts} +79 -6
- package/dist/permissions/index.d.mts +5 -4
- package/dist/permissions/index.mjs +8 -6
- package/dist/{permissions-D8TBH44E.mjs → permissions-C5ijIz5Q.mjs} +149 -33
- package/dist/{pipe-FMWNheSO.mjs → pipe-D81zMtWs.mjs} +2 -2
- package/dist/pipeline/index.d.mts +7 -7
- package/dist/pipeline/index.mjs +2 -2
- package/dist/plan-CJGMKoui.mjs +565 -0
- package/dist/{BaseController-CYEwjyjN.mjs → plugin-DALd9dcF.mjs} +1269 -346
- package/dist/plugins/index.d.mts +17 -14
- package/dist/plugins/index.mjs +44 -22
- package/dist/plugins/response-cache.d.mts +5 -6
- package/dist/plugins/response-cache.mjs +8 -14
- package/dist/plugins/tracing-entry.mjs +2 -2
- package/dist/{pluralize-CXWZIzTv.mjs → pluralize-COUNYo3d.mjs} +1 -1
- package/dist/presets/filesUpload.d.mts +8 -8
- package/dist/presets/filesUpload.mjs +5 -5
- package/dist/presets/index.d.mts +35 -40
- package/dist/presets/index.mjs +4 -4
- package/dist/presets/multiTenant.d.mts +2 -107
- package/dist/presets/multiTenant.mjs +22 -162
- package/dist/presets/search.d.mts +9 -10
- package/dist/presets/search.mjs +2 -2
- package/dist/{presets-ZJSPgmT2.mjs → presets-CONf2Qem.mjs} +99 -107
- package/dist/{projection-BzIgzoKZ.mjs → projection-wFoLqdss.mjs} +2 -2
- package/dist/{pushref-registry-Dov9l4qE.d.mts → pushref-registry-UxCkoA4C.d.mts} +1 -1
- package/dist/{queryCachePlugin-DZHPOm9p.mjs → queryCachePlugin-BATECpyh.mjs} +12 -14
- package/dist/{queryCachePlugin-BzqxconG.d.mts → queryCachePlugin-C2lZjTxk.d.mts} +1 -1
- package/dist/{rateLimitKey-BvOvcBDi.mjs → rateLimitKey-DVEZ_UpV.mjs} +1 -1
- package/dist/{realtime-8tIQWZz4.mjs → realtime-xyubMKSB.mjs} +25 -21
- package/dist/{redis-Bzi1y3F9.d.mts → redis-BDgv9Glw.d.mts} +17 -24
- package/dist/redis-stream-BMk-bpQS.d.mts +219 -0
- package/dist/redisShapes-CQksY67q.d.mts +55 -0
- package/dist/registry/index.d.mts +15 -10
- package/dist/registry/index.mjs +4 -4
- package/dist/{registry-DNkgGQcK.mjs → registry-Bdzg-hdm.mjs} +13 -10
- package/dist/{renewingLease-yF8BdW4b.mjs → renewingLease-BFJxGPuh.mjs} +1 -1
- package/dist/{replyHelpers-CNdvMfM4.mjs → replyHelpers-Bnc6lJyy.mjs} +2 -2
- package/dist/{requestContext-cDkAUr-P.mjs → requestContext-C10UeFe5.mjs} +1 -1
- package/dist/requirement-Bu50QALH.mjs +35 -0
- package/dist/requirement-CbiLdQ1n.d.mts +22 -0
- package/dist/resourceRateLimit-Wf6d6FL9.d.mts +30 -0
- package/dist/resourceRateLimit-urWPJxrt.mjs +180 -0
- package/dist/rolldown-runtime-MYrLNGnq.mjs +45 -0
- package/dist/routeValidator-DHtpzrzk.mjs +70 -0
- package/dist/{runtimeCapabilities-CkhS6jn6.mjs → runtimeCapabilities-DIMKMV2G.mjs} +1 -1
- package/dist/{schedules-j6uXXAeJ.mjs → schedules-CKTs5ys8.mjs} +46 -37
- package/dist/{schemaConverter-BVA7cFRG.mjs → schemaConverter-BVjkQ5DD.mjs} +2 -2
- package/dist/{schemaIR-CTvPDoPB.mjs → schemaIR-BA0Hb21Y.mjs} +2 -2
- package/dist/schemas/index.d.mts +20 -10
- package/dist/schemas/index.mjs +8 -3
- package/dist/scim/index.d.mts +13 -13
- package/dist/scim/index.mjs +2 -2
- package/dist/scope/index.d.mts +4 -4
- package/dist/scope/index.mjs +6 -6
- package/dist/{scope-BUi1xV1I.mjs → scope-DINaj7Ax.mjs} +4 -4
- package/dist/shutdown-LpLMH8T1.mjs +59 -0
- package/dist/{simpleEqualityMatcher-C9bzq2gO.mjs → simpleEqualityMatcher-DbwIM1f1.mjs} +1 -1
- package/dist/{sse-BeqVKQKu.mjs → sse-BzJFPX_1.mjs} +11 -15
- package/dist/{sseStream-Ppzo-WUH.mjs → sseStream-DQChzGTs.mjs} +2 -2
- package/dist/{store-helpers-dW71XVWL.mjs → store-helpers-Coj9RhOZ.mjs} +1 -1
- package/dist/{streaming-IcRFjWQU.mjs → streaming-JzB5CAga.mjs} +1 -1
- package/dist/subscriberIdentity-DeyppIif.mjs +28 -0
- package/dist/tenancy-DxV8OuX2.mjs +43 -0
- package/dist/tenantPreparation-CBvvAcAj.mjs +67 -0
- package/dist/testing/cleanupStoreContract.d.mts +4 -5
- package/dist/testing/cleanupStoreContract.mjs +1 -1
- package/dist/testing/index.d.mts +215 -197
- package/dist/testing/index.mjs +289 -214
- package/dist/testing/outboxStoreContract.d.mts +4 -5
- package/dist/testing/outboxStoreContract.mjs +137 -2
- package/dist/testing/requiredPorts.d.mts +16 -0
- package/dist/testing/requiredPorts.mjs +65 -0
- package/dist/testing/storageContract.d.mts +4 -5
- package/dist/testing/storageContract.mjs +1 -1
- package/dist/timing-CntavTlR.mjs +46 -0
- package/dist/{transactionContext-CPbdlnVw.mjs → transactionContext-orvnGu4F.mjs} +1 -1
- package/dist/{typeGuards-BLjPgVBm.mjs → typeGuards-kEaP_WmO.mjs} +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/types/index.mjs +1 -1
- package/dist/types/storage.mjs +1 -1
- package/dist/{types-DfVDvkdP.d.mts → types-BJ-2XqVF.d.mts} +189 -204
- package/dist/{types-CWQn9-IC.d.mts → types-D3Ixsh00.d.mts} +22 -9
- package/dist/{types-CgenB1gv.mjs → types-fvO6Ovzx.mjs} +4 -4
- package/dist/usage/index.d.mts +5 -6
- package/dist/usage/index.mjs +5 -5
- package/dist/{userHelpers-ChRvkuSZ.mjs → userHelpers-C76zD5pa.mjs} +1 -1
- package/dist/utils/index.d.mts +125 -264
- package/dist/utils/index.mjs +13 -12
- package/dist/{utils-CxcctrAh.mjs → utils-BpkVZ8rB.mjs} +315 -404
- package/dist/{validate-DrYWnOzI.mjs → validate-CWp-lsrm.mjs} +6 -14
- package/dist/{versioning-D6JIK8Tk.d.mts → versioning-Bsb51gGT.d.mts} +28 -13
- package/dist/{versioning-DKkT4hNJ.mjs → versioning-CHhL9P3o.mjs} +4 -4
- package/dist/{websocket-BOXVggMf.d.mts → websocket-Cs4awVyD.d.mts} +1 -1
- package/dist/{workScope-CxKqoIFn.mjs → workScope-n9a7d_lZ.mjs} +2 -2
- package/package.json +57 -59
- package/skills/arc/SKILL.md +13 -4
- package/skills/arc/references/auth.md +8 -5
- package/skills/arc/references/integrations.md +1 -1
- package/skills/arc/references/mcp.md +8 -6
- package/skills/arc/references/multi-tenancy.md +19 -14
- package/skills/arc/references/production.md +27 -10
- package/dist/actionPermissions-BoPGQ5-4.mjs +0 -350
- package/dist/index-CFfLKMH4.d.mts +0 -290
- package/dist/interface-YzIbF7Ii.mjs +0 -17
- package/dist/redis-stream-BPKscsTB.d.mts +0 -260
- package/dist/registerRoute-Bsnk6NiZ.mjs +0 -364
- package/dist/rolldown-runtime-eysyzFAF.mjs +0 -15
- package/dist/sync/changelog.d.mts +0 -3
- package/dist/sync/changelog.mjs +0 -3
package/dist/scope/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
import { A as requireOrgId, C as hasOrgAccess, D as isOrgInScope, E as isMember, M as requireUserId, N as scopeFirstCtx, O as isService, S as getUserRoles, T as isElevated, _ as getScopeContextMap, a as ScopeFirstCtx, b as getTenantFromRequest, c as getAncestorOrgIds, d as getMandate, f as getOrgContext, g as getScopeContext, h as getRequestScope, i as RequestScope, j as requireTeamId, k as requireClientId, l as getClientId, m as getOrgRoles, n as Mandate, o as ScopeFirstCtxOptions, p as getOrgId, r as PUBLIC_SCOPE, s as ScopeFirstCtxRequest, t as AUTHENTICATED_SCOPE, u as getDPoPJkt, v as getServiceScopes, w as isAuthenticated, x as getUserId, y as getTeamId } from "../types-Ddl9OjmE.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { n as ElevationOptions, r as _default, t as ElevationEvent } from "../elevation-BW2J3tNj.mjs";
|
|
4
4
|
import { FastifyReply, FastifyRequest } from "fastify";
|
|
5
5
|
//#region src/scope/rateLimitKey.d.ts
|
|
6
6
|
interface RateLimitKeyContext {
|
|
@@ -11,7 +11,7 @@ interface TenantKeyGeneratorOptions {
|
|
|
11
11
|
/** Custom strategy — overrides default scope-based logic */
|
|
12
12
|
strategy?: (ctx: RateLimitKeyContext) => string;
|
|
13
13
|
}
|
|
14
|
-
declare function createTenantKeyGenerator(opts?: TenantKeyGeneratorOptions): (ctx: RateLimitKeyContext) => string;
|
|
14
|
+
export declare function createTenantKeyGenerator(opts?: TenantKeyGeneratorOptions): (ctx: RateLimitKeyContext) => string;
|
|
15
15
|
//#endregion
|
|
16
16
|
//#region src/scope/resolveOrgFromHeader.d.ts
|
|
17
17
|
interface ResolveOrgFromHeaderOptions {
|
|
@@ -28,6 +28,6 @@ interface ResolveOrgFromHeaderOptions {
|
|
|
28
28
|
* If the header is present and user is a member, sets `request.scope` to `member`.
|
|
29
29
|
* If the header is absent, scope stays as-is (typically `authenticated`).
|
|
30
30
|
*/
|
|
31
|
-
declare function resolveOrgFromHeader(options: ResolveOrgFromHeaderOptions): (request: FastifyRequest, reply: FastifyReply) => Promise<void>;
|
|
31
|
+
export declare function resolveOrgFromHeader(options: ResolveOrgFromHeaderOptions): (request: FastifyRequest, reply: FastifyReply) => Promise<void>;
|
|
32
32
|
//#endregion
|
|
33
|
-
export { AUTHENTICATED_SCOPE, type ElevationEvent, type ElevationOptions, type Mandate, PUBLIC_SCOPE, type RateLimitKeyContext, type RequestScope, type ResolveOrgFromHeaderOptions, type ScopeFirstCtx, type ScopeFirstCtxOptions, type ScopeFirstCtxRequest, type TenantKeyGeneratorOptions,
|
|
33
|
+
export { AUTHENTICATED_SCOPE, type ElevationEvent, type ElevationOptions, type Mandate, PUBLIC_SCOPE, type RateLimitKeyContext, type RequestScope, type ResolveOrgFromHeaderOptions, type ScopeFirstCtx, type ScopeFirstCtxOptions, type ScopeFirstCtxRequest, type TenantKeyGeneratorOptions, _default as elevationPlugin, 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, scopeFirstCtx };
|
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 {
|
|
4
|
-
import { t as
|
|
5
|
-
import { t as resolveOrgFromHeader } from "../scope-
|
|
6
|
-
export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, createTenantKeyGenerator, elevation_default as elevationPlugin,
|
|
1
|
+
/*! @classytic/arc v2.44.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-fvO6Ovzx.mjs";
|
|
3
|
+
import { t as createTenantKeyGenerator } from "../rateLimitKey-DVEZ_UpV.mjs";
|
|
4
|
+
import { t as elevation_default } from "../elevation-BG4gnMsJ.mjs";
|
|
5
|
+
import { t as resolveOrgFromHeader } from "../scope-DINaj7Ax.mjs";
|
|
6
|
+
export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, createTenantKeyGenerator, elevation_default as elevationPlugin, 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.44.0 | MIT | https://classytic.com */
|
|
2
|
+
import { a as OrgAccessDeniedError, l as UnauthorizedError } from "./errors-CW4anJBy.mjs";
|
|
3
|
+
import { n as requireSingleHeaderValue } from "./headers-DKZQKL-Z.mjs";
|
|
4
|
+
import { n as getUserRoles } from "./userHelpers-C76zD5pa.mjs";
|
|
5
5
|
//#region src/scope/resolveOrgFromHeader.ts
|
|
6
6
|
/**
|
|
7
7
|
* Create a preHandler hook that resolves org scope from a header.
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
3
|
+
//#region src/utils/shutdown.ts
|
|
4
|
+
/** Stop admissions across every runtime before draining work and disposing domain engines. */
|
|
5
|
+
const SHUTDOWN = Symbol.for("arc.shutdown");
|
|
6
|
+
const admittedWork = new AsyncLocalStorage();
|
|
7
|
+
/** Descendants of admitted work may finish their causal publications during shutdown. */
|
|
8
|
+
async function runAdmittedWork(work) {
|
|
9
|
+
if (isAdmittedWork()) return await work();
|
|
10
|
+
const scope = { active: true };
|
|
11
|
+
return admittedWork.run(scope, async () => {
|
|
12
|
+
try {
|
|
13
|
+
return await work();
|
|
14
|
+
} finally {
|
|
15
|
+
scope.active = false;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function isAdmittedWork() {
|
|
20
|
+
return admittedWork.getStore()?.active === true;
|
|
21
|
+
}
|
|
22
|
+
/** Seed on the root before plugins register, so encapsulated plugins share one coordinator. */
|
|
23
|
+
function initShutdownRegistry(fastify) {
|
|
24
|
+
const holder = fastify;
|
|
25
|
+
if (holder[SHUTDOWN]) return;
|
|
26
|
+
holder[SHUTDOWN] = { participants: [] };
|
|
27
|
+
fastify.addHook("onClose", async () => {
|
|
28
|
+
const errors = await runShutdown(fastify);
|
|
29
|
+
for (const err of errors) fastify.log.error({ err }, "[arc] runtime shutdown failed");
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/** A participant's stop must prevent new work; drain waits for work already admitted. */
|
|
33
|
+
function registerShutdownParticipant(fastify, participant) {
|
|
34
|
+
initShutdownRegistry(fastify);
|
|
35
|
+
const registry = fastify[SHUTDOWN];
|
|
36
|
+
if (!registry) throw new Error("[arc] shutdown coordinator is unavailable");
|
|
37
|
+
if (registry.completion) throw new Error(`[arc] cannot register ${participant.name} during shutdown`);
|
|
38
|
+
registry.participants.push(participant);
|
|
39
|
+
}
|
|
40
|
+
/** Once-guarded, best effort; callers dispose engines only after this completes. */
|
|
41
|
+
function runShutdown(fastify) {
|
|
42
|
+
const registry = fastify[SHUTDOWN];
|
|
43
|
+
if (!registry) return Promise.resolve([]);
|
|
44
|
+
registry.completion ??= Promise.resolve().then(async () => {
|
|
45
|
+
const errors = [];
|
|
46
|
+
for (const phase of ["stop", "drain"]) {
|
|
47
|
+
const participants = phase === "drain" ? [...registry.participants.filter((p) => p.kind !== "consumer"), ...registry.participants.filter((p) => p.kind === "consumer")] : registry.participants;
|
|
48
|
+
for (const participant of participants) try {
|
|
49
|
+
await participant[phase]?.();
|
|
50
|
+
} catch (cause) {
|
|
51
|
+
errors.push(new Error(`[arc] ${participant.name} shutdown ${phase} failed`, { cause }));
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return errors;
|
|
55
|
+
});
|
|
56
|
+
return registry.completion;
|
|
57
|
+
}
|
|
58
|
+
//#endregion
|
|
59
|
+
export { runShutdown as a, runAdmittedWork as i, isAdmittedWork as n, registerShutdownParticipant as r, initShutdownRegistry as t };
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import {
|
|
3
|
-
import { arcLog } from "./logger
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
import { r as __exportAll } from "./rolldown-runtime-MYrLNGnq.mjs";
|
|
3
|
+
import { t as arcLog } from "./logger-D4V1zGLI.mjs";
|
|
4
|
+
import { n as PUBLIC_SCOPE } from "./types-fvO6Ovzx.mjs";
|
|
5
|
+
import { n as isEventVisible, t as eventAudienceOf } from "./tenancy-DxV8OuX2.mjs";
|
|
6
|
+
import { a as promoteStreamTokenToHeader } from "./streaming-JzB5CAga.mjs";
|
|
7
|
+
import { t as openSseStream } from "./sseStream-DQChzGTs.mjs";
|
|
7
8
|
import fp from "fastify-plugin";
|
|
8
9
|
//#region src/plugins/sse.ts
|
|
9
10
|
var sse_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -12,7 +13,7 @@ var sse_exports = /* @__PURE__ */ __exportAll({
|
|
|
12
13
|
});
|
|
13
14
|
const log = arcLog("sse");
|
|
14
15
|
const ssePlugin = async (fastify, opts = {}) => {
|
|
15
|
-
const { path = "/events/stream", requireAuth = true, patterns = ["*"], heartbeat = 3e4, orgScoped =
|
|
16
|
+
const { path = "/events/stream", requireAuth = true, patterns = ["*"], heartbeat = 3e4, orgScoped = true, filter: customFilter, tokenQueryParam = "token" } = opts;
|
|
16
17
|
if (!fastify.hasDecorator("events")) {
|
|
17
18
|
log.warn("Events plugin (arc-events) not registered. SSE plugin will not function. Register eventPlugin before ssePlugin.");
|
|
18
19
|
return;
|
|
@@ -34,15 +35,10 @@ const ssePlugin = async (fastify, opts = {}) => {
|
|
|
34
35
|
const stream = openSseStream(request, reply, { heartbeatMs: heartbeat });
|
|
35
36
|
stream.onCleanup(() => activeConnections.delete(stream.close));
|
|
36
37
|
const scope = request.scope ?? PUBLIC_SCOPE;
|
|
37
|
-
const
|
|
38
|
-
const dropOrgEvents = orgScoped && !requestOrgId;
|
|
38
|
+
const audience = eventAudienceOf(scope);
|
|
39
39
|
for (const pattern of patterns) {
|
|
40
40
|
const unsub = await fastify.events.subscribe(pattern, async (event) => {
|
|
41
|
-
if (orgScoped)
|
|
42
|
-
const eventOrgId = event.meta?.organizationId;
|
|
43
|
-
if (dropOrgEvents && eventOrgId) return;
|
|
44
|
-
if (requestOrgId && eventOrgId && eventOrgId !== requestOrgId) return;
|
|
45
|
-
}
|
|
41
|
+
if (orgScoped && !isEventVisible(event.meta?.organizationId, audience)) return;
|
|
46
42
|
if (customFilter && !customFilter(event, request)) return;
|
|
47
43
|
const data = JSON.stringify({
|
|
48
44
|
type: event.type,
|
|
@@ -90,4 +86,4 @@ var sse_default = fp(ssePlugin, {
|
|
|
90
86
|
dependencies: ["arc-events"]
|
|
91
87
|
});
|
|
92
88
|
//#endregion
|
|
93
|
-
export {
|
|
89
|
+
export { sse_exports as n, sse_default as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/*! @classytic/arc v2.
|
|
2
|
-
import { n as forwardedStreamHeaders } from "./streaming-
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
import { n as forwardedStreamHeaders } from "./streaming-JzB5CAga.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
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
//#region src/events/subscriberIdentity.ts
|
|
3
|
+
const SUBSCRIBER_ID = Symbol.for("@classytic/arc/subscriber-id");
|
|
4
|
+
/** Assign a deployment-stable identity for durable per-handler progress; never use an index. */
|
|
5
|
+
function withSubscriberId(id, handler) {
|
|
6
|
+
if (typeof id !== "string" || !id.trim()) throw new Error("[Arc Events] subscriber id must be non-empty");
|
|
7
|
+
const wrapped = async (event) => {
|
|
8
|
+
await handler(event);
|
|
9
|
+
};
|
|
10
|
+
Object.defineProperty(wrapped, SUBSCRIBER_ID, { value: id });
|
|
11
|
+
return wrapped;
|
|
12
|
+
}
|
|
13
|
+
function getSubscriberId(handler) {
|
|
14
|
+
const id = Reflect.get(handler, SUBSCRIBER_ID);
|
|
15
|
+
return typeof id === "string" ? id : void 0;
|
|
16
|
+
}
|
|
17
|
+
/** Preserve explicit IDs and the implicit function name through framework wrappers. */
|
|
18
|
+
function preserveSubscriberIdentity(original, wrapper) {
|
|
19
|
+
const id = getSubscriberId(original);
|
|
20
|
+
if (id !== void 0) Object.defineProperty(wrapper, SUBSCRIBER_ID, { value: id });
|
|
21
|
+
Object.defineProperty(wrapper, "name", {
|
|
22
|
+
value: original.name,
|
|
23
|
+
configurable: true
|
|
24
|
+
});
|
|
25
|
+
return wrapper;
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { preserveSubscriberIdentity as n, withSubscriberId as r, getSubscriberId as t };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
import { b as isElevated, c as getOrgId } from "./types-fvO6Ovzx.mjs";
|
|
3
|
+
//#region src/core/tenancy.ts
|
|
4
|
+
function eventAudienceOf(scope) {
|
|
5
|
+
const tenancy = resolveTenancy({ _scope: scope }, "organizationId");
|
|
6
|
+
return tenancy.mode === "scoped" ? {
|
|
7
|
+
orgId: tenancy.orgId,
|
|
8
|
+
platformView: false
|
|
9
|
+
} : { platformView: tenancy.reason === "platform" };
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Whether an event tagged `eventOrgId` may reach `audience`. Untenanted events
|
|
13
|
+
* reach everyone; a tenant's event reaches that tenant and the platform view,
|
|
14
|
+
* and nobody else — including a caller with no org at all (fail-closed).
|
|
15
|
+
*/
|
|
16
|
+
function isEventVisible(eventOrgId, audience) {
|
|
17
|
+
if (eventOrgId === void 0 || eventOrgId === null || eventOrgId === "") return true;
|
|
18
|
+
if (audience.platformView) return true;
|
|
19
|
+
return audience.orgId !== void 0 && String(eventOrgId) === audience.orgId;
|
|
20
|
+
}
|
|
21
|
+
function resolveTenancy(input, tenantField) {
|
|
22
|
+
if (!tenantField) return {
|
|
23
|
+
mode: "unscoped",
|
|
24
|
+
reason: "untenanted-resource"
|
|
25
|
+
};
|
|
26
|
+
if (input?._crossTenantRead === true) return {
|
|
27
|
+
mode: "unscoped",
|
|
28
|
+
reason: "cross-tenant"
|
|
29
|
+
};
|
|
30
|
+
const scope = input?._scope;
|
|
31
|
+
const orgId = scope ? getOrgId(scope) : void 0;
|
|
32
|
+
if (orgId) return {
|
|
33
|
+
mode: "scoped",
|
|
34
|
+
field: tenantField,
|
|
35
|
+
orgId
|
|
36
|
+
};
|
|
37
|
+
return {
|
|
38
|
+
mode: "unscoped",
|
|
39
|
+
reason: scope && isElevated(scope) ? "platform" : "no-org"
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { isEventVisible as n, resolveTenancy as r, eventAudienceOf as t };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*! @classytic/arc v2.44.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as conjoinPolicyFilters } from "./filter-merge-DGM-GQ1J.mjs";
|
|
3
|
+
import { d as createDomainError } from "./errors-CW4anJBy.mjs";
|
|
4
|
+
import { b as isElevated, c as getOrgId, d as getScopeContext, m as getTeamId, v as hasOrgAccess } from "./types-fvO6Ovzx.mjs";
|
|
5
|
+
//#region src/permissions/tenantPreparation.ts
|
|
6
|
+
/** Tenant preparation shared by HTTP middleware and direct transport invocation. */
|
|
7
|
+
const PREPARATION = Symbol.for("arc.tenantPreparation");
|
|
8
|
+
function tagTenantPreparation(middleware, preparation) {
|
|
9
|
+
Object.defineProperty(middleware, PREPARATION, { value: preparation });
|
|
10
|
+
return middleware;
|
|
11
|
+
}
|
|
12
|
+
function isTenantPreparation(middleware) {
|
|
13
|
+
return typeof middleware === "function" && middleware[PREPARATION] !== void 0;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The resource's tenant middlewares minus body INJECTION: an action payload is a command, not
|
|
17
|
+
* the document, so it is scoped (filters, `_tenantFields`) but never written into.
|
|
18
|
+
*/
|
|
19
|
+
function withoutTenantInjection(middlewares) {
|
|
20
|
+
return (middlewares ?? []).filter((middleware) => {
|
|
21
|
+
if (typeof middleware !== "function") return true;
|
|
22
|
+
const preparation = Reflect.get(middleware, PREPARATION);
|
|
23
|
+
return !(typeof preparation === "object" && preparation !== null && "mode" in preparation && preparation.mode === "inject");
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
function prepareTenancy(scope, preparation) {
|
|
27
|
+
if (preparation.mode === "crossTenant") return { crossTenant: true };
|
|
28
|
+
const elevated = isElevated(scope);
|
|
29
|
+
if (preparation.mode === "inject" && elevated && !getOrgId(scope)) return {};
|
|
30
|
+
if (preparation.mode !== "inject" && !elevated && !hasOrgAccess(scope)) {
|
|
31
|
+
if (preparation.mode === "flexible") return {};
|
|
32
|
+
throw createDomainError(scope.kind === "public" ? "arc.unauthorized" : "arc.forbidden", scope.kind === "public" ? "Authentication required for multi-tenant resources" : "Organization context required for this operation", scope.kind === "public" ? 401 : 403);
|
|
33
|
+
}
|
|
34
|
+
const fields = {};
|
|
35
|
+
const missing = [];
|
|
36
|
+
for (const spec of preparation.specs) {
|
|
37
|
+
const value = "contextKey" in spec ? getScopeContext(scope, spec.contextKey) : spec.type === "org" ? getOrgId(scope) : getTeamId(scope);
|
|
38
|
+
if (value === void 0) missing.push(spec.field);
|
|
39
|
+
else fields[spec.field] = value;
|
|
40
|
+
}
|
|
41
|
+
if (missing.length && (preparation.mode === "inject" || !elevated)) throw createDomainError("arc.forbidden", `Tenant context incomplete — missing: ${missing.join(", ")}`, 403);
|
|
42
|
+
return {
|
|
43
|
+
fields,
|
|
44
|
+
...preparation.mode === "inject" ? { inject: true } : { policy: fields }
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function applyTenantPreparation(target, body, scope, preparation) {
|
|
48
|
+
const result = prepareTenancy(scope, preparation);
|
|
49
|
+
if (result.crossTenant) target._crossTenantRead = true;
|
|
50
|
+
if (result.policy && Object.keys(result.policy).length) target._policyFilters = conjoinPolicyFilters(target._policyFilters, result.policy);
|
|
51
|
+
if (result.fields && Object.keys(result.fields).length) target._tenantFields = {
|
|
52
|
+
...target._tenantFields,
|
|
53
|
+
...result.fields
|
|
54
|
+
};
|
|
55
|
+
if (result.inject && body && typeof body === "object") Object.assign(body, result.fields);
|
|
56
|
+
}
|
|
57
|
+
function prepareTenantContext(ctx, middlewares) {
|
|
58
|
+
const meta = ctx.metadata;
|
|
59
|
+
for (const middleware of middlewares ?? []) {
|
|
60
|
+
if (typeof middleware !== "function") continue;
|
|
61
|
+
const preparation = middleware[PREPARATION];
|
|
62
|
+
if (preparation) applyTenantPreparation(meta, ctx.body, meta._scope ?? { kind: "public" }, preparation);
|
|
63
|
+
if (meta._tenantFields) ctx._tenantFields = meta._tenantFields;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { withoutTenantInjection as a, tagTenantPreparation as i, isTenantPreparation as n, prepareTenantContext as r, applyTenantPreparation as t };
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
|
|
2
2
|
import { D as CleanupRunStore } from "../types-DVLddu2q.mjs";
|
|
3
3
|
//#region src/testing/cleanupStoreContract.d.ts
|
|
4
|
-
interface CleanupRunStoreContractSetupResult {
|
|
4
|
+
export interface CleanupRunStoreContractSetupResult {
|
|
5
5
|
store: CleanupRunStore;
|
|
6
6
|
teardown?: () => Promise<void>;
|
|
7
7
|
}
|
|
8
|
-
type CleanupRunStoreContractSetup = () => Promise<CleanupRunStoreContractSetupResult>;
|
|
9
|
-
declare function runCleanupRunStoreContract(name: string, setup: CleanupRunStoreContractSetup): void;
|
|
10
|
-
//#endregion
|
|
11
|
-
export { CleanupRunStoreContractSetup, CleanupRunStoreContractSetupResult, runCleanupRunStoreContract };
|
|
8
|
+
export type CleanupRunStoreContractSetup = () => Promise<CleanupRunStoreContractSetupResult>;
|
|
9
|
+
export declare function runCleanupRunStoreContract(name: string, setup: CleanupRunStoreContractSetup): void;
|
|
10
|
+
//#endregion
|