@classytic/arc 2.28.0 → 2.31.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/LICENSE +1 -1
- package/README.md +7 -0
- package/TRADEMARK.md +22 -0
- package/dist/{BaseController-B65zbz9m.mjs → BaseController-De7GqHck.mjs} +25 -24
- package/dist/{EventTransport-QmY7A258.d.mts → EventTransport-2uVV34WU.d.mts} +1 -0
- package/dist/EventTransport-9mlTgqzE.mjs +104 -0
- package/dist/{HookSystem-C1vB_Gc9.mjs → HookSystem-BcmPyq5I.mjs} +16 -35
- package/dist/{QueryCache-DOMT_iq7.d.mts → QueryCache-DFA-QrU9.d.mts} +2 -1
- package/dist/{ResourceRegistry-y9Hnypus.mjs → ResourceRegistry-qq0mn2s9.mjs} +3 -2
- package/dist/{actionPermissions-CAphcmUG.mjs → actionPermissions-BE5NwaQk.mjs} +1 -0
- package/dist/audit/index.d.mts +3 -2
- package/dist/audit/index.mjs +3 -2
- package/dist/auth/audit.d.mts +1 -0
- package/dist/auth/audit.mjs +1 -0
- package/dist/auth/index.d.mts +5 -4
- package/dist/auth/index.mjs +6 -5
- package/dist/auth/redis-session.d.mts +2 -1
- package/dist/auth/redis-session.mjs +1 -0
- package/dist/authorizationDecision-ChvUQGG1.mjs +266 -0
- package/dist/{buildHandler-Dtwd8fdz.mjs → buildHandler-CDrCJzmB.mjs} +34 -7
- package/dist/cache/index.d.mts +4 -3
- package/dist/cache/index.mjs +4 -3
- package/dist/{caching-_NJeDd1_.mjs → caching-BFHA6Scf.mjs} +2 -1
- package/dist/cleanup/index.d.mts +4 -3
- package/dist/cleanup/index.mjs +9 -13
- package/dist/cli/commands/describe.d.mts +2 -1
- package/dist/cli/commands/describe.mjs +3 -2
- package/dist/cli/commands/docs.d.mts +1 -0
- package/dist/cli/commands/docs.mjs +3 -2
- package/dist/cli/commands/doctor.d.mts +1 -0
- package/dist/cli/commands/doctor.mjs +1 -0
- package/dist/cli/commands/generate.d.mts +2 -1
- package/dist/cli/commands/generate.mjs +2 -1
- package/dist/cli/commands/init.d.mts +2 -1
- package/dist/cli/commands/init.mjs +2 -1
- package/dist/cli/commands/introspect.d.mts +1 -0
- package/dist/cli/commands/introspect.mjs +2 -1
- package/dist/cli/index.d.mts +3 -2
- package/dist/cli/index.mjs +3 -2
- package/dist/{constants-DNre0wRg.mjs → constants-D3Dv4LAV.mjs} +1 -0
- package/dist/context/index.d.mts +1 -0
- package/dist/context/index.mjs +3 -2
- package/dist/core/index.d.mts +3 -2
- package/dist/core/index.mjs +7 -5
- package/dist/{core-BGa8TXJR.mjs → core-BGpIxINN.mjs} +4 -49
- package/dist/{createActionRouter-C-N7z2EL.mjs → createActionRouter-CDXEdasl.mjs} +8 -7
- package/dist/{createAggregationRouter-wzwFa_dW.mjs → createAggregationRouter-KrQDzx-k.mjs} +10 -22
- package/dist/{createApp-Du5G54TM.mjs → createApp-Df89BEni.mjs} +505 -209
- package/dist/defineAggregation-DbPPS8RI.mjs +48 -0
- package/dist/{defineResource-2zvVVpxg.mjs → defineResource-Bv6EtN1x.mjs} +90 -72
- package/dist/discovery/index.d.mts +1 -0
- package/dist/discovery/index.mjs +1 -0
- package/dist/docs/index.d.mts +3 -2
- package/dist/docs/index.mjs +3 -2
- package/dist/{elevation-C9s5hFP_.d.mts → elevation-BXCfVcNG.d.mts} +1 -0
- package/dist/{elevation-CIz1GjGm.mjs → elevation-D2l1mh4g.mjs} +4 -3
- package/dist/encryption/index.d.mts +2 -1
- package/dist/encryption/index.mjs +3 -2
- package/dist/{errorHandler-Bq2OeEQL.mjs → errorHandler-C5NeD6bT.mjs} +3 -2
- package/dist/{errorHandler-C6yv4ZTW.d.mts → errorHandler-CpYUJmPA.d.mts} +1 -0
- package/dist/{errors-DHcHVAgk.d.mts → errors-BGdVwP25.d.mts} +1 -0
- package/dist/{errors-DkO8Nk6-.mjs → errors-Cj42AntO.mjs} +1 -0
- package/dist/{eventPlugin-DrQ_FesK.mjs → eventPlugin-CkffEihm.mjs} +6 -106
- package/dist/{eventPlugin-Bg3cP2_u.d.mts → eventPlugin-GF5nnBIq.d.mts} +2 -1
- package/dist/events/index.d.mts +4 -3
- package/dist/events/index.mjs +17 -340
- package/dist/events/transports/redis-stream-entry.d.mts +2 -1
- package/dist/events/transports/redis-stream-entry.mjs +1 -0
- package/dist/events/transports/redis.d.mts +2 -1
- package/dist/events/transports/redis.mjs +1 -0
- package/dist/{externalPaths-BE6wFpYv.d.mts → externalPaths-CmGOxOtD.d.mts} +1 -0
- package/dist/factory/index.d.mts +9 -5
- package/dist/factory/index.mjs +7 -6
- package/dist/{fastify-augmentation-OzYGIiU1.d.mts → fastify-augmentation-zh0_AYHa.d.mts} +13 -4
- package/dist/{applyPermissionResult-BnyVE9eD.mjs → fields-CB5Cuzk9.mjs} +2 -107
- package/dist/{fields-D3lhgzhD.d.mts → fields-I_EeRWND.d.mts} +1 -0
- package/dist/{generate-BnsL9GBm.d.mts → generate-DCGuEbqI.d.mts} +1 -0
- package/dist/{generate-D0wZupBg.mjs → generate-EcA6ui4i.mjs} +2 -1
- package/dist/{headers-BvlQSDMB.mjs → headers-3zvE0rM3.mjs} +2 -1
- package/dist/{health-CB_m4S32.mjs → health-DjZYjM7H.mjs} +1 -0
- package/dist/hooks/index.d.mts +2 -1
- package/dist/hooks/index.mjs +2 -1
- package/dist/idempotency/index.d.mts +3 -2
- package/dist/idempotency/index.mjs +5 -4
- package/dist/idempotency/redis.d.mts +2 -1
- package/dist/idempotency/redis.mjs +1 -0
- package/dist/{index-CjVg-Epg.d.mts → index-Bc2ox8_U.d.mts} +6 -5
- package/dist/{index-CG4yqMDB.d.mts → index-C-481Zf2.d.mts} +74 -18
- package/dist/{index-BMnbzvtO.d.mts → index-CEJNZFtX.d.mts} +242 -24
- package/dist/index-CFThn1K9.d.mts +224 -0
- package/dist/{index-DPRH0Cme.d.mts → index-CpzxqePp.d.mts} +203 -97
- package/dist/index.d.mts +9 -8
- package/dist/index.mjs +11 -9
- package/dist/{init-tlRSt667.mjs → init-BEiNZBsJ.mjs} +19 -23
- package/dist/{init-BPEu8cs-.d.mts → init-Cscs4lab.d.mts} +1 -0
- package/dist/integrations/event-gateway.d.mts +3 -2
- package/dist/integrations/event-gateway.mjs +2 -1
- package/dist/integrations/index.d.mts +4 -3
- package/dist/integrations/index.mjs +1 -0
- package/dist/integrations/jobs/index.d.mts +2 -1
- package/dist/integrations/jobs/index.mjs +108 -32
- package/dist/integrations/mcp/index.d.mts +9 -9
- package/dist/integrations/mcp/index.mjs +2 -1
- package/dist/integrations/mcp/testing.d.mts +3 -2
- package/dist/integrations/mcp/testing.mjs +2 -2
- package/dist/integrations/streamline.d.mts +1 -0
- package/dist/integrations/streamline.mjs +3 -2
- package/dist/integrations/webhooks.d.mts +1 -0
- package/dist/integrations/webhooks.mjs +1 -0
- package/dist/integrations/websocket-pushref-redis.d.mts +2 -1
- package/dist/integrations/websocket-pushref-redis.mjs +1 -0
- package/dist/integrations/websocket-redis.d.mts +2 -1
- package/dist/integrations/websocket-redis.mjs +1 -0
- package/dist/integrations/websocket.d.mts +3 -2
- package/dist/integrations/websocket.mjs +1 -0
- package/dist/{interface-BGZCzOGL.d.mts → interface-BOk3YnTz.d.mts} +1 -0
- package/dist/{interface-Uk8ONJv7.d.mts → interface-DEWNOMza.d.mts} +1 -0
- package/dist/{interface-n5hpKg1d.mjs → interface-DYzM0q-u.mjs} +1 -0
- package/dist/{jsonBody-BlzAoGCe.mjs → jsonBody-BYbLDi5D.mjs} +2 -1
- package/dist/{keys-Cd316u_y.mjs → keys-C0_pa1tY.mjs} +1 -0
- package/dist/{loadResources-DpU8pfjV.mjs → loadResources-yawi9tAE.mjs} +2 -1
- package/dist/{loadResourcesFromEntry-kvGT6EcO.mjs → loadResourcesFromEntry-BAjYZonx.mjs} +2 -1
- package/dist/logger/index.d.mts +1 -0
- package/dist/logger/index.mjs +1 -0
- package/dist/{mcpPlugin-Cs6nRGCt.mjs → mcpPlugin-B_es0hiF.mjs} +52 -60
- package/dist/{memory-CmnzXE5Z.mjs → memory-DR6wpa9F.mjs} +2 -1
- package/dist/{metrics-fdxI5mn_.mjs → metrics-CUdw_wLB.mjs} +2 -1
- package/dist/middleware/index.d.mts +2 -1
- package/dist/middleware/index.mjs +3 -2
- package/dist/migrations/index.d.mts +1 -3
- package/dist/migrations/index.mjs +2 -4
- package/dist/module-0pFJA6YW.mjs +78 -0
- package/dist/{multipartBody-D0eBvkeq.mjs → multipartBody-wOgj_fnj.mjs} +1 -0
- package/dist/{openapi-BLV4OMXb.mjs → openapi-B2L4js1v.mjs} +6 -5
- package/dist/permissions/index.d.mts +5 -4
- package/dist/permissions/index.mjs +6 -4
- package/dist/{permissions-BrtiBKGs.mjs → permissions-L--QDAir.mjs} +518 -316
- package/dist/{pipe-BOLmGIxa.mjs → pipe-DRDNsI2T.mjs} +2 -1
- package/dist/pipeline/index.d.mts +2 -1
- package/dist/pipeline/index.mjs +2 -1
- package/dist/{pipeline-BGRnV-To.mjs → pipeline-UPQFatit.mjs} +7 -20
- package/dist/plugins/index.d.mts +8 -7
- package/dist/plugins/index.mjs +16 -15
- package/dist/plugins/response-cache.d.mts +1 -0
- package/dist/plugins/response-cache.mjs +2 -1
- package/dist/plugins/tracing-entry.d.mts +2 -1
- package/dist/plugins/tracing-entry.mjs +2 -1
- package/dist/{pluralize-BhrgwZb9.mjs → pluralize-O0FZgESl.mjs} +1 -0
- package/dist/{preloadResources-CM4uUaFv.d.mts → preloadResources-CyoJMSiO.d.mts} +117 -12
- package/dist/{preloadResources-DSY5HGpS.mjs → preloadResources-Dz6BjzM6.mjs} +1 -0
- package/dist/presets/filesUpload.d.mts +6 -5
- package/dist/presets/filesUpload.mjs +9 -11
- package/dist/presets/index.d.mts +15 -2
- package/dist/presets/index.mjs +2 -1
- package/dist/presets/multiTenant.d.mts +2 -1
- package/dist/presets/multiTenant.mjs +3 -2
- package/dist/presets/search.d.mts +3 -2
- package/dist/presets/search.mjs +2 -1
- package/dist/{presets-DwFDVKP0.mjs → presets-C4-g4_4P.mjs} +27 -10
- package/dist/projection-BHw6xlOQ.mjs +18 -0
- package/dist/{pushref-registry-BbcnpNTm.d.mts → pushref-registry-Dov9l4qE.d.mts} +1 -0
- package/dist/{queryCachePlugin-DSGuSVLW.mjs → queryCachePlugin-BZr8v46E.mjs} +5 -4
- package/dist/{queryCachePlugin-br4otiqF.d.mts → queryCachePlugin-BzqxconG.d.mts} +3 -2
- package/dist/{rateLimit-DrED-C4v.mjs → rateLimit-CMPY5Qms.mjs} +7 -3
- package/dist/{rateLimitKey-BoWRH3e7.mjs → rateLimitKey-Dn5JNmkj.mjs} +1 -0
- package/dist/{realtime-DEuDu9io.mjs → realtime-C5NoxWFY.mjs} +20 -8
- package/dist/{redis-UDtLaNj6.d.mts → redis-CduhKsJi.d.mts} +2 -1
- package/dist/{redis-stream-uIaauNpZ.d.mts → redis-stream-qN6A-RFv.d.mts} +2 -1
- package/dist/{registerRoute-DTp18Ah_.mjs → registerRoute-CBN84fc7.mjs} +5 -2
- package/dist/registry/index.d.mts +3 -2
- package/dist/registry/index.mjs +3 -2
- package/dist/{registry-9km_w1aP.mjs → registry-4213U4zb.mjs} +3 -2
- package/dist/{renewingLease-3cuQH7h8.mjs → renewingLease-Dll8mGgc.mjs} +1 -0
- package/dist/{replyHelpers-67tRawQZ.mjs → replyHelpers-DIiZKGUt.mjs} +2 -1
- package/dist/repositoryFilter-f9eAfq_l.mjs +45 -0
- package/dist/{requestContext-MrlJwECf.mjs → requestContext-2TxXOJ7T.mjs} +1 -0
- package/dist/{rolldown-runtime-8H4AJuhK.mjs → rolldown-runtime-CUsjNX9R.mjs} +1 -0
- package/dist/{schedules-CjOd2MG9.mjs → schedules-DdtlICTf.mjs} +3 -2
- package/dist/{schemaConverter-DJvodiHj.mjs → schemaConverter-D--wdJM-.mjs} +70 -17
- package/dist/{schemaIR-Ca7ySNPx.mjs → schemaIR-Bm2enbnh.mjs} +2 -1
- package/dist/schemas/index.d.mts +1 -0
- package/dist/schemas/index.mjs +1 -0
- package/dist/scim/index.d.mts +1 -0
- package/dist/scim/index.mjs +2 -1
- package/dist/scope/index.d.mts +3 -2
- package/dist/scope/index.mjs +5 -4
- package/dist/{scope-DfaPntpo.mjs → scope-DHx5Fous.mjs} +4 -3
- package/dist/{sessionManager-BHOM3N_0.d.mts → sessionManager-qimlKV0P.d.mts} +1 -0
- package/dist/{simpleEqualityMatcher-Cg05HPsn.mjs → simpleEqualityMatcher-DjQJ7FKA.mjs} +1 -0
- package/dist/{sse-BQ1w0dfl.mjs → sse-CUTo9y0X.mjs} +5 -4
- package/dist/{sseStream-BQ7Qaynp.mjs → sseStream-B_5XcVVd.mjs} +2 -1
- package/dist/{storage-DLUZ04kK.d.mts → storage-Cx9Sz3Ou.d.mts} +1 -0
- package/dist/{store-helpers-DY6xq4sM.mjs → store-helpers-D1MP_gRG.mjs} +1 -0
- package/dist/{streaming-BQcW6_Kq.mjs → streaming-PSZwi8JV.mjs} +1 -0
- package/dist/subscribe-helpers-C0Tb2aUp.mjs +340 -0
- package/dist/sync/changelog.d.mts +1 -0
- package/dist/sync/changelog.mjs +1 -0
- package/dist/testing/cleanupStoreContract.d.mts +2 -1
- package/dist/testing/cleanupStoreContract.mjs +1 -0
- package/dist/testing/index.d.mts +167 -12
- package/dist/testing/index.mjs +522 -205
- package/dist/testing/outboxStoreContract.d.mts +1 -0
- package/dist/testing/outboxStoreContract.mjs +1 -0
- package/dist/testing/storageContract.d.mts +2 -1
- package/dist/testing/storageContract.mjs +1 -0
- package/dist/{tracing-CsGKQJGg.d.mts → tracing-Dro5eH6j.d.mts} +1 -0
- package/dist/{transactionContext-PNdoyLLm.mjs → transactionContext-dAfBVUrk.mjs} +1 -0
- package/dist/{typeGuards-C9KXUly6.mjs → typeGuards-B0ryPo3I.mjs} +1 -0
- package/dist/types/index.d.mts +6 -5
- package/dist/types/index.mjs +1 -0
- package/dist/types/storage.d.mts +2 -1
- package/dist/types/storage.mjs +1 -0
- package/dist/{types-Dmw-6Qeo.d.mts → types-B7XeLEgK.d.mts} +127 -90
- package/dist/{types-Cc91nXuA.d.mts → types-ByHn9rEO.d.mts} +1 -0
- package/dist/{types-C_ZZRcD6.d.mts → types-C4QE8qnm.d.mts} +1 -0
- package/dist/{types-Cu6vVJmh.d.mts → types-CBgvkp8O.d.mts} +82 -12
- package/dist/{types-DjC-KUCz.d.mts → types-ChuShpCP.d.mts} +1 -0
- package/dist/{types-QFGc3Cjv.d.mts → types-CwcUQ610.d.mts} +2 -6
- package/dist/{types-CSyCxl2V.mjs → types-Cys0ko9Z.mjs} +4 -3
- package/dist/usage/index.d.mts +3 -2
- package/dist/usage/index.mjs +0 -0
- package/dist/{userHelpers-Cg_y3fBz.mjs → userHelpers-ChYJ6CdK.mjs} +1 -0
- package/dist/utils/index.d.mts +16 -10
- package/dist/utils/index.mjs +10 -9
- package/dist/{utils-taUVD4p3.mjs → utils-vL8BrDE2.mjs} +3 -2
- package/dist/{validate-Bk44F2yT.mjs → validate-_KbifpHF.mjs} +2 -1
- package/dist/{versioning-gKWyryT3.mjs → versioning-CHDTor3P.mjs} +3 -2
- package/dist/{versioning-DXgY5BUm.d.mts → versioning-D_rhHfZm.d.mts} +5 -2
- package/dist/{websocket-_Pd0CgR0.d.mts → websocket-BOXVggMf.d.mts} +2 -1
- package/package.json +15 -7
- package/skills/arc/SKILL.md +22 -8
- package/skills/arc/references/api-reference.md +4 -0
- package/skills/arc/references/auth.md +3 -0
- package/skills/arc/references/integrations.md +33 -0
- package/skills/arc/references/mcp.md +6 -7
- package/skills/arc/references/production.md +24 -25
- package/skills/arc-code-review/references/anti-patterns.md +3 -3
- package/dist/index-CZY4EGga.d.mts +0 -107
- package/dist/module-_-M7C5ES.mjs +0 -29
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -324,3 +324,10 @@ arc doctor # diagnose env
|
|
|
324
324
|
## License
|
|
325
325
|
|
|
326
326
|
MIT
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
## Trademark
|
|
330
|
+
|
|
331
|
+
The code is MIT-licensed. **"Classytic", "arc", and the logos are trademarks of
|
|
332
|
+
Classytic LLC** and are **not** licensed under MIT — see [TRADEMARK.md](TRADEMARK.md).
|
|
333
|
+
Forks must be renamed; the license covers the code, not the brand.
|
package/TRADEMARK.md
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Trademark Notice
|
|
2
|
+
|
|
3
|
+
The **source code** in this package is licensed under the MIT License (see
|
|
4
|
+
[LICENSE](LICENSE)). Trademarks are **not** part of that license.
|
|
5
|
+
|
|
6
|
+
**"Classytic", "arc", the Classytic and arc logos**, and related names and marks
|
|
7
|
+
are trademarks of **Classytic LLC** (Wyoming, USA). The MIT License covers the
|
|
8
|
+
code only — it grants **no right** to use Classytic LLC's names, logos, or brand.
|
|
9
|
+
|
|
10
|
+
## You may
|
|
11
|
+
- use, fork, modify, and redistribute the **code** under the MIT License;
|
|
12
|
+
- state truthfully that your product "uses" or "is built on" arc / Classytic
|
|
13
|
+
software, without implying endorsement.
|
|
14
|
+
|
|
15
|
+
## You may not (without written permission from Classytic LLC)
|
|
16
|
+
- use "Classytic", "arc", or confusingly similar names as the name of your own
|
|
17
|
+
product, package, company, or service;
|
|
18
|
+
- use the Classytic / arc logos or brand styling;
|
|
19
|
+
- imply sponsorship, affiliation, or endorsement by Classytic LLC.
|
|
20
|
+
|
|
21
|
+
Forks or redistributions must be **renamed** so they are not confused with the
|
|
22
|
+
official project. Permission / questions: **trademark@classytic.com**.
|
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { h as SYSTEM_FIELDS, o as DEFAULT_TENANT_FIELD } from "./constants-D3Dv4LAV.mjs";
|
|
2
3
|
import { arcLog } from "./logger/index.mjs";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
4
|
+
import { a as conjoinPolicyFilters } from "./authorizationDecision-ChvUQGG1.mjs";
|
|
5
|
+
import { d as createDomainError, f as createError, i as NotFoundError, p as isArcError, r as ForbiddenError } from "./errors-Cj42AntO.mjs";
|
|
6
|
+
import { n as getUserRoles, t as getUserId } from "./userHelpers-ChYJ6CdK.mjs";
|
|
7
|
+
import { b as isElevated, c as getOrgId, n as PUBLIC_SCOPE, x as isMember } from "./types-Cys0ko9Z.mjs";
|
|
8
|
+
import { t as simpleEqualityMatcher } from "./simpleEqualityMatcher-DjQJ7FKA.mjs";
|
|
9
|
+
import { t as toRepositoryFilter } from "./repositoryFilter-f9eAfq_l.mjs";
|
|
10
|
+
import { i as resolveEffectiveRoles, n as applyFieldWritePermissions } from "./fields-CB5Cuzk9.mjs";
|
|
11
|
+
import { g as ArcQueryParser, n as scheduleBackground } from "./utils-vL8BrDE2.mjs";
|
|
12
|
+
import { t as buildQueryKey } from "./keys-C0_pa1tY.mjs";
|
|
10
13
|
//#region src/core/AccessControl.ts
|
|
11
14
|
const log$1 = arcLog("access-control");
|
|
12
15
|
var AccessControl = class {
|
|
@@ -31,14 +34,14 @@ var AccessControl = class {
|
|
|
31
34
|
* Combines ID filter with policy/org filters for proper security enforcement
|
|
32
35
|
*/
|
|
33
36
|
buildIdFilter(id, req) {
|
|
34
|
-
|
|
37
|
+
let filter = { [this.idField]: id };
|
|
35
38
|
const arcContext = this._meta(req);
|
|
36
39
|
const policyFilters = arcContext?._policyFilters;
|
|
37
|
-
if (policyFilters)
|
|
40
|
+
if (policyFilters) filter = conjoinPolicyFilters(filter, policyFilters);
|
|
38
41
|
const scope = arcContext?._scope;
|
|
39
42
|
const orgId = scope ? getOrgId(scope) : void 0;
|
|
40
|
-
if (this.tenantField && orgId
|
|
41
|
-
return filter;
|
|
43
|
+
if (this.tenantField && orgId) filter = conjoinPolicyFilters(filter, { [this.tenantField]: orgId });
|
|
44
|
+
return toRepositoryFilter(filter);
|
|
42
45
|
}
|
|
43
46
|
/**
|
|
44
47
|
* Check if a post-fetch item matches the request's `_policyFilters`.
|
|
@@ -110,9 +113,9 @@ var AccessControl = class {
|
|
|
110
113
|
checkOwnership(item, req) {
|
|
111
114
|
const ownershipCheck = this._meta(req)?._ownershipCheck;
|
|
112
115
|
if (!item || !ownershipCheck) return true;
|
|
113
|
-
const { field, userId } = ownershipCheck;
|
|
116
|
+
const { field, userId, missingOwner } = ownershipCheck;
|
|
114
117
|
const itemOwnerId = item[field];
|
|
115
|
-
if (!itemOwnerId) return
|
|
118
|
+
if (!itemOwnerId) return missingOwner === "allow";
|
|
116
119
|
return String(itemOwnerId) === String(userId);
|
|
117
120
|
}
|
|
118
121
|
/**
|
|
@@ -670,12 +673,12 @@ var QueryResolver = class {
|
|
|
670
673
|
const page = parsed.after ? void 0 : parsed.page ? Math.max(1, parsed.page) : 1;
|
|
671
674
|
const sortString = parsed.sort ? Object.entries(parsed.sort).map(([k, v]) => v === -1 ? `-${k}` : k).join(",") : this.defaultSort;
|
|
672
675
|
const rawSelect = parsed.select ?? req.query?.select;
|
|
673
|
-
const filters = { ...parsed.filters };
|
|
674
676
|
const policyFilters = arcContext?._policyFilters;
|
|
675
|
-
|
|
677
|
+
let filters = conjoinPolicyFilters(parsed.filters, policyFilters);
|
|
676
678
|
const scope = arcContext?._scope;
|
|
677
679
|
const orgId = scope ? getOrgId(scope) : void 0;
|
|
678
|
-
if (this.tenantField && orgId && !policyFilters?.[this.tenantField]) filters[this.tenantField]
|
|
680
|
+
if (this.tenantField && orgId && !policyFilters?.[this.tenantField]) filters = conjoinPolicyFilters(filters, { [this.tenantField]: orgId });
|
|
681
|
+
const portableFilters = toRepositoryFilter(filters);
|
|
679
682
|
return {
|
|
680
683
|
page,
|
|
681
684
|
limit,
|
|
@@ -684,7 +687,7 @@ var QueryResolver = class {
|
|
|
684
687
|
populate: this.sanitizePopulate(parsed.populate, this.schemaOptions),
|
|
685
688
|
populateOptions: this.sanitizePopulateOptions(parsed.populateOptions, this.schemaOptions),
|
|
686
689
|
lookups: this.sanitizeLookups(parsed.lookups, this.schemaOptions),
|
|
687
|
-
filters,
|
|
690
|
+
filters: portableFilters,
|
|
688
691
|
search: parsed.search,
|
|
689
692
|
after: parsed.after,
|
|
690
693
|
user: req.user,
|
|
@@ -800,7 +803,7 @@ var BaseCrudController = class {
|
|
|
800
803
|
/**
|
|
801
804
|
* Composable access control (ID filtering, policy checks, org scope, ownership).
|
|
802
805
|
*
|
|
803
|
-
* Not `readonly`
|
|
806
|
+
* Not `readonly` — `configure()` rebuilds it when the host
|
|
804
807
|
* supplies tenant/idField/matchesFilter post-construction. Same model as
|
|
805
808
|
* `queryResolver` after `setQueryParser` shipped in 2.10.9.
|
|
806
809
|
*/
|
|
@@ -808,7 +811,7 @@ var BaseCrudController = class {
|
|
|
808
811
|
/**
|
|
809
812
|
* Composable body sanitization (field permissions, system fields).
|
|
810
813
|
*
|
|
811
|
-
* Not `readonly`
|
|
814
|
+
* Not `readonly` — `configure()` rebuilds it when the host
|
|
812
815
|
* supplies schemaOptions/onFieldWriteDenied post-construction.
|
|
813
816
|
*/
|
|
814
817
|
bodySanitizer;
|
|
@@ -1486,10 +1489,8 @@ function BulkMixin(Base) {
|
|
|
1486
1489
|
* Returns the merged filter, or `null` when access must be denied.
|
|
1487
1490
|
*/
|
|
1488
1491
|
buildBulkFilter(userFilter, req) {
|
|
1489
|
-
const filter = { ...userFilter };
|
|
1490
1492
|
const arcContext = this.meta(req);
|
|
1491
|
-
|
|
1492
|
-
if (policyFilters) Object.assign(filter, policyFilters);
|
|
1493
|
+
let filter = conjoinPolicyFilters(userFilter, arcContext?._policyFilters);
|
|
1493
1494
|
if (this.tenantField) {
|
|
1494
1495
|
const scope = arcContext?._scope;
|
|
1495
1496
|
if (!scope) return filter;
|
|
@@ -1497,7 +1498,7 @@ function BulkMixin(Base) {
|
|
|
1497
1498
|
if (isElevated(scope)) return filter;
|
|
1498
1499
|
const orgId = getOrgId(scope);
|
|
1499
1500
|
if (!orgId) return null;
|
|
1500
|
-
filter[this.tenantField]
|
|
1501
|
+
filter = conjoinPolicyFilters(filter, { [this.tenantField]: orgId });
|
|
1501
1502
|
}
|
|
1502
1503
|
return filter;
|
|
1503
1504
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
|
|
1
2
|
import { DeadLetteredEvent, DomainEvent, DomainEvent as DomainEvent$1, EventHandler, EventHandler as EventHandler$1, EventLogger, EventLogger as EventLogger$1, EventTransport, EventTransport as EventTransport$1, PublishManyResult } from "@classytic/primitives/events";
|
|
2
3
|
//#region src/events/EventTransport.d.ts
|
|
3
4
|
interface MemoryEventTransportOptions {
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { createEvent, matchEventPattern } from "@classytic/primitives/events";
|
|
3
|
+
//#region src/events/EventTransport.ts
|
|
4
|
+
/**
|
|
5
|
+
* Internal arc events module — concrete in-memory transport.
|
|
6
|
+
*
|
|
7
|
+
* **Public type contracts moved out (arc 2.12).** `EventMeta`, `DomainEvent`,
|
|
8
|
+
* `EventHandler`, `EventLogger`, `EventTransport`, `DeadLetteredEvent`,
|
|
9
|
+
* `PublishManyResult`, plus the `createEvent` / `createChildEvent` /
|
|
10
|
+
* `matchEventPattern` helpers, are now owned by `@classytic/primitives/events`.
|
|
11
|
+
* Two reasons:
|
|
12
|
+
*
|
|
13
|
+
* 1. The shapes ARE the cross-package contract. arc, arc-next, mongokit's
|
|
14
|
+
* audit-log plugin, future kits and downstream services all share them.
|
|
15
|
+
* Owning them in `primitives` (pure types, zero runtime, zero deps)
|
|
16
|
+
* eliminates the "manually mirror in two places" problem the previous
|
|
17
|
+
* `primitives/src/events.ts` header explicitly called out.
|
|
18
|
+
* 2. Inverting the dependency direction lets future packages (sqlitekit
|
|
19
|
+
* audit, billing services) consume the contract without depending on
|
|
20
|
+
* arc's HTTP-coupled stack.
|
|
21
|
+
*
|
|
22
|
+
* Hosts MUST import the types from primitives directly:
|
|
23
|
+
*
|
|
24
|
+
* ```typescript
|
|
25
|
+
* import type {
|
|
26
|
+
* EventMeta, DomainEvent, EventHandler, EventTransport,
|
|
27
|
+
* DeadLetteredEvent, PublishManyResult,
|
|
28
|
+
* } from '@classytic/primitives/events';
|
|
29
|
+
* import { createEvent, createChildEvent } from '@classytic/primitives/events';
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* arc's `events/index.ts` barrel does NOT re-export these — by design, so
|
|
33
|
+
* that consumer code is forced into the canonical import path and the org's
|
|
34
|
+
* "no re-exports" rule holds at every public surface.
|
|
35
|
+
*
|
|
36
|
+
* What stays here:
|
|
37
|
+
* - `MemoryEventTransport` — the in-memory `EventTransport` implementation
|
|
38
|
+
* used as arc's default transport. Its handler-set state is process-local;
|
|
39
|
+
* wrong layer for primitives.
|
|
40
|
+
* - `MemoryEventTransportOptions` — its options shape.
|
|
41
|
+
*
|
|
42
|
+
* Inside arc, files that previously imported types from `./EventTransport.js`
|
|
43
|
+
* keep working: this file re-exports them from primitives for arc's own
|
|
44
|
+
* call sites. That re-export is an internal refactor convenience — the
|
|
45
|
+
* public `events/index.ts` barrel stays clean.
|
|
46
|
+
*/
|
|
47
|
+
/**
|
|
48
|
+
* In-memory event transport (default).
|
|
49
|
+
*
|
|
50
|
+
* Events are delivered synchronously within the process. Not suitable for
|
|
51
|
+
* multi-instance deployments — pair with `RedisEventTransport` /
|
|
52
|
+
* `RedisStreamTransport` (subpath imports) for those.
|
|
53
|
+
*/
|
|
54
|
+
var MemoryEventTransport = class {
|
|
55
|
+
name = "memory";
|
|
56
|
+
handlers = /* @__PURE__ */ new Map();
|
|
57
|
+
logger;
|
|
58
|
+
constructor(options) {
|
|
59
|
+
this.logger = options?.logger ?? console;
|
|
60
|
+
}
|
|
61
|
+
async publish(event) {
|
|
62
|
+
const allHandlers = /* @__PURE__ */ new Set();
|
|
63
|
+
for (const [pattern, handlers] of this.handlers) if (matchEventPattern(pattern, event.type)) for (const h of handlers) allHandlers.add(h);
|
|
64
|
+
for (const handler of allHandlers) try {
|
|
65
|
+
await handler(event);
|
|
66
|
+
} catch (err) {
|
|
67
|
+
this.logger.error(`[EventTransport] Handler error for ${event.type}:`, err);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Reference `publishMany` implementation — delegates to `publish()` in order.
|
|
72
|
+
*
|
|
73
|
+
* Production transports (Kafka, Redis pipeline, SQS batch) should override
|
|
74
|
+
* this with a single batched network call. Memory transport has nothing to
|
|
75
|
+
* batch, so we just loop — the loop still returns a proper result map so
|
|
76
|
+
* `EventOutbox.relay` can exercise the batched code path in tests.
|
|
77
|
+
*/
|
|
78
|
+
async publishMany(events) {
|
|
79
|
+
const results = /* @__PURE__ */ new Map();
|
|
80
|
+
for (const event of events) try {
|
|
81
|
+
await this.publish(event);
|
|
82
|
+
results.set(event.meta.id, null);
|
|
83
|
+
} catch (err) {
|
|
84
|
+
results.set(event.meta.id, err instanceof Error ? err : new Error(String(err)));
|
|
85
|
+
}
|
|
86
|
+
return results;
|
|
87
|
+
}
|
|
88
|
+
async subscribe(pattern, handler) {
|
|
89
|
+
if (!this.handlers.has(pattern)) this.handlers.set(pattern, /* @__PURE__ */ new Set());
|
|
90
|
+
this.handlers.get(pattern)?.add(handler);
|
|
91
|
+
return () => {
|
|
92
|
+
const set = this.handlers.get(pattern);
|
|
93
|
+
if (set) {
|
|
94
|
+
set.delete(handler);
|
|
95
|
+
if (set.size === 0) this.handlers.delete(pattern);
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
async close() {
|
|
100
|
+
this.handlers.clear();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
//#endregion
|
|
104
|
+
export { createEvent as n, MemoryEventTransport as t };
|
|
@@ -1,4 +1,16 @@
|
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as buildRequestScopeProjection } from "./projection-BHw6xlOQ.mjs";
|
|
1
3
|
//#region src/hooks/HookSystem.ts
|
|
4
|
+
/**
|
|
5
|
+
* Hook System
|
|
6
|
+
*
|
|
7
|
+
* Lifecycle hooks for resource operations.
|
|
8
|
+
* Allows intercepting and modifying data at various points.
|
|
9
|
+
*/
|
|
10
|
+
/** Lift the validated scope out of the request context (undefined when unscoped). */
|
|
11
|
+
function scopeOf(context) {
|
|
12
|
+
return buildRequestScopeProjection(context?._scope);
|
|
13
|
+
}
|
|
2
14
|
var HookSystem = class {
|
|
3
15
|
hooks;
|
|
4
16
|
logger;
|
|
@@ -9,16 +21,10 @@ var HookSystem = class {
|
|
|
9
21
|
this.logger = options?.logger ?? { error: noop };
|
|
10
22
|
this.warn = options?.logger?.warn ?? noop;
|
|
11
23
|
}
|
|
12
|
-
/**
|
|
13
|
-
* Generate hook key
|
|
14
|
-
*/
|
|
15
24
|
getKey(resource, operation, phase) {
|
|
16
25
|
return `${resource}:${operation}:${phase}`;
|
|
17
26
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Register a hook
|
|
20
|
-
* Supports both object parameter and positional arguments
|
|
21
|
-
*/
|
|
27
|
+
/** Supports both the object-parameter and positional argument forms. */
|
|
22
28
|
register(resourceOrOptions, operation, phase, handler, priority = 10) {
|
|
23
29
|
let hookName;
|
|
24
30
|
let resource;
|
|
@@ -63,15 +69,9 @@ var HookSystem = class {
|
|
|
63
69
|
if (idx !== -1) hooks.splice(idx, 1);
|
|
64
70
|
};
|
|
65
71
|
}
|
|
66
|
-
/**
|
|
67
|
-
* Register before hook
|
|
68
|
-
*/
|
|
69
72
|
before(resource, operation, handler, priority = 10) {
|
|
70
73
|
return this.register(resource, operation, "before", handler, priority);
|
|
71
74
|
}
|
|
72
|
-
/**
|
|
73
|
-
* Register after hook
|
|
74
|
-
*/
|
|
75
75
|
after(resource, operation, handler, priority = 10) {
|
|
76
76
|
return this.register(resource, operation, "after", handler, priority);
|
|
77
77
|
}
|
|
@@ -105,6 +105,7 @@ var HookSystem = class {
|
|
|
105
105
|
data,
|
|
106
106
|
user: options?.user,
|
|
107
107
|
context: options?.context,
|
|
108
|
+
scope: scopeOf(options?.context),
|
|
108
109
|
meta: options?.meta
|
|
109
110
|
};
|
|
110
111
|
return hook.handler(ctx, next);
|
|
@@ -113,9 +114,6 @@ var HookSystem = class {
|
|
|
113
114
|
};
|
|
114
115
|
return next();
|
|
115
116
|
}
|
|
116
|
-
/**
|
|
117
|
-
* Execute hooks for a given context
|
|
118
|
-
*/
|
|
119
117
|
async execute(ctx) {
|
|
120
118
|
const key = this.getKey(ctx.resource, ctx.operation, ctx.phase);
|
|
121
119
|
const hooks = this.hooks.get(key) ?? [];
|
|
@@ -133,6 +131,7 @@ var HookSystem = class {
|
|
|
133
131
|
result: ctx.result,
|
|
134
132
|
user: ctx.user,
|
|
135
133
|
context: ctx.context,
|
|
134
|
+
scope: ctx.scope ?? scopeOf(ctx.context),
|
|
136
135
|
meta: ctx.meta
|
|
137
136
|
};
|
|
138
137
|
const hookResult = await hook.handler(handlerContext);
|
|
@@ -140,9 +139,6 @@ var HookSystem = class {
|
|
|
140
139
|
}
|
|
141
140
|
return result;
|
|
142
141
|
}
|
|
143
|
-
/**
|
|
144
|
-
* Execute before hooks
|
|
145
|
-
*/
|
|
146
142
|
async executeBefore(resource, operation, data, options) {
|
|
147
143
|
return await this.execute({
|
|
148
144
|
resource,
|
|
@@ -154,10 +150,7 @@ var HookSystem = class {
|
|
|
154
150
|
meta: options?.meta
|
|
155
151
|
}) ?? data;
|
|
156
152
|
}
|
|
157
|
-
/**
|
|
158
|
-
* Execute after hooks
|
|
159
|
-
* Errors in after hooks are logged but don't fail the request
|
|
160
|
-
*/
|
|
153
|
+
/** Errors in after hooks are logged but never fail the request. */
|
|
161
154
|
async executeAfter(resource, operation, result, options) {
|
|
162
155
|
try {
|
|
163
156
|
await this.execute({
|
|
@@ -226,17 +219,11 @@ var HookSystem = class {
|
|
|
226
219
|
}
|
|
227
220
|
return result;
|
|
228
221
|
}
|
|
229
|
-
/**
|
|
230
|
-
* Get all registered hooks
|
|
231
|
-
*/
|
|
232
222
|
getAll() {
|
|
233
223
|
const all = [];
|
|
234
224
|
for (const hooks of this.hooks.values()) all.push(...hooks);
|
|
235
225
|
return all;
|
|
236
226
|
}
|
|
237
|
-
/**
|
|
238
|
-
* Get hooks for a specific resource
|
|
239
|
-
*/
|
|
240
227
|
getForResource(resource) {
|
|
241
228
|
const all = [];
|
|
242
229
|
for (const [key, hooks] of this.hooks.entries()) if (key.startsWith(`${resource}:`)) all.push(...hooks);
|
|
@@ -298,15 +285,9 @@ var HookSystem = class {
|
|
|
298
285
|
const key = this.getKey(resource, operation, phase);
|
|
299
286
|
return (this.hooks.get(key)?.length ?? 0) > 0;
|
|
300
287
|
}
|
|
301
|
-
/**
|
|
302
|
-
* Clear all hooks
|
|
303
|
-
*/
|
|
304
288
|
clear() {
|
|
305
289
|
this.hooks.clear();
|
|
306
290
|
}
|
|
307
|
-
/**
|
|
308
|
-
* Clear hooks for a specific resource
|
|
309
|
-
*/
|
|
310
291
|
clearResource(resource) {
|
|
311
292
|
for (const key of this.hooks.keys()) if (key.startsWith(`${resource}:`)) this.hooks.delete(key);
|
|
312
293
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import "./constants-D3Dv4LAV.mjs";
|
|
2
3
|
//#region src/registry/ResourceRegistry.ts
|
|
3
4
|
/**
|
|
4
5
|
* Resource Registry
|
|
@@ -59,7 +60,7 @@ var ResourceRegistry = class {
|
|
|
59
60
|
summary: r.summary,
|
|
60
61
|
description: r.description,
|
|
61
62
|
permissions: r.permissions,
|
|
62
|
-
raw: r.
|
|
63
|
+
raw: r.rawHandler !== void 0,
|
|
63
64
|
schema: r.schema
|
|
64
65
|
})),
|
|
65
66
|
events: Object.keys(resource.events ?? {}),
|
package/dist/audit/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
|
|
2
|
+
import "../index-CpzxqePp.mjs";
|
|
3
|
+
import { a as UserBase } from "../types-B7XeLEgK.mjs";
|
|
3
4
|
import { FastifyPluginAsync } from "fastify";
|
|
4
5
|
import { RepositoryLike } from "@classytic/repo-core/adapter";
|
|
5
6
|
//#region src/audit/stores/interface.d.ts
|
package/dist/audit/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { t as transactionContext } from "../transactionContext-dAfBVUrk.mjs";
|
|
3
3
|
import { and, anyOf, eq, gte, lt, lte } from "@classytic/repo-core/filter";
|
|
4
|
+
import fp from "fastify-plugin";
|
|
4
5
|
//#region src/audit/repository-audit-adapter.ts
|
|
5
6
|
function repositoryAsAuditStore(repository, options = {}) {
|
|
6
7
|
const idField = repository.idField ?? "_id";
|
package/dist/auth/audit.d.mts
CHANGED
package/dist/auth/audit.mjs
CHANGED
package/dist/auth/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
|
|
2
|
+
import { Ut as AuthHelpers, Wt as AuthPluginOptions } from "../index-CpzxqePp.mjs";
|
|
3
|
+
import { r as PermissionCheck } from "../types-B7XeLEgK.mjs";
|
|
4
|
+
import { t as ExternalOpenApiPaths } from "../externalPaths-CmGOxOtD.mjs";
|
|
5
|
+
import { a as SessionManagerOptions, c as createSessionManager, i as SessionData, n as MemorySessionStoreOptions, o as SessionManagerResult, r as SessionCookieOptions, s as SessionStore, t as MemorySessionStore } from "../sessionManager-qimlKV0P.mjs";
|
|
5
6
|
import { FastifyPluginAsync, FastifyReply as FastifyReply$1, FastifyRequest } from "fastify";
|
|
6
7
|
//#region src/auth/authPlugin.d.ts
|
|
7
8
|
declare module "fastify" {
|
package/dist/auth/index.mjs
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
import { n as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
/*! @classytic/arc v2.31.0 | MIT | https://classytic.com */
|
|
2
|
+
import { d as createDomainError, l as UnauthorizedError, p as isArcError, t as ArcError } from "../errors-Cj42AntO.mjs";
|
|
3
|
+
import { n as requireSingleHeaderValue } from "../headers-3zvE0rM3.mjs";
|
|
4
|
+
import { n as getUserRoles, r as normalizeRoles } from "../userHelpers-ChYJ6CdK.mjs";
|
|
5
|
+
import { o as toJsonSchema } from "../schemaConverter-D--wdJM-.mjs";
|
|
6
|
+
import { S as requireOrgRole, T as requireTeamMembership, x as requireOrgMembership } from "../permissions-L--QDAir.mjs";
|
|
6
7
|
import { createHmac, randomUUID, timingSafeEqual } from "node:crypto";
|
|
7
8
|
import fp from "fastify-plugin";
|
|
8
9
|
//#region src/auth/authPlugin.ts
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { i as SessionData, s as SessionStore } from "../sessionManager-qimlKV0P.mjs";
|
|
2
3
|
//#region src/auth/redis-session.d.ts
|
|
3
4
|
/** Minimal Redis client interface — compatible with ioredis */
|
|
4
5
|
interface RedisLike {
|