@classytic/arc 2.18.4 → 2.18.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BaseController-B-uXzf6I.mjs → BaseController-Dy6EQHjM.mjs} +7 -7
- package/dist/{QueryCache-Dsyv2mLS.d.mts → QueryCache-TRfXau3W.d.mts} +1 -1
- package/dist/{ResourceRegistry-CWmOggxS.mjs → ResourceRegistry-5fKZwhK_.mjs} +1 -1
- package/dist/{pipeline-D4sqiokR.mjs → actionPermissions-h7DYDNMg.mjs} +28 -5
- package/dist/audit/index.d.mts +1 -1
- package/dist/auth/index.d.mts +4 -4
- package/dist/auth/index.mjs +252 -5
- package/dist/auth/redis-session.d.mts +1 -1
- package/dist/betterAuthOpenApi-CV1lxpRX.mjs +2 -0
- package/dist/{buildHandler-Cvrc2p7r.mjs → buildHandler-B0qvAguf.mjs} +1 -1
- package/dist/cache/index.d.mts +3 -3
- package/dist/cache/index.mjs +3 -3
- package/dist/{caching-C0DdKiYB.mjs → caching-_NJeDd1_.mjs} +1 -1
- package/dist/cli/commands/describe.d.mts +1 -1
- package/dist/cli/commands/describe.mjs +2 -2
- package/dist/cli/commands/docs.mjs +2 -2
- package/dist/cli/commands/generate.d.mts +2 -2
- package/dist/cli/commands/generate.mjs +1 -1
- package/dist/cli/commands/init.d.mts +2 -2
- package/dist/cli/commands/init.mjs +1 -1
- package/dist/cli/commands/introspect.mjs +1 -1
- package/dist/cli/index.d.mts +2 -2
- package/dist/cli/index.mjs +2 -2
- package/dist/context/index.mjs +1 -1
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +4 -4
- package/dist/{core-C88uIwd3.mjs → core-ZnQBa5rh.mjs} +55 -56
- package/dist/{createActionRouter-DGCCp-kP.mjs → createActionRouter-CagItpxI.mjs} +6 -7
- package/dist/{createAggregationRouter-Ca77b8iK.mjs → createAggregationRouter-DVKroXhC.mjs} +4 -4
- package/dist/{createApp-J1iPXY9p.mjs → createApp--703hQE1.mjs} +14 -14
- package/dist/docs/index.d.mts +2 -2
- package/dist/docs/index.mjs +2 -2
- package/dist/{elevation-BzhyVWfn.mjs → elevation-COpYKt2h.mjs} +2 -2
- package/dist/{errorHandler-Bua97SEt.mjs → errorHandler-Dxf6P_kV.mjs} +2 -2
- package/dist/{eventPlugin-Bw4bUDEO.mjs → eventPlugin-DJG2D7sy.mjs} +106 -5
- package/dist/{eventPlugin-C1W1CRbf.d.mts → eventPlugin-DbBFd3x_.d.mts} +1 -1
- package/dist/events/index.d.mts +3 -3
- package/dist/events/index.mjs +189 -5
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis.d.mts +1 -1
- package/dist/factory/index.d.mts +1 -1
- package/dist/factory/index.mjs +3 -3
- package/dist/{fastify-augmentation-BdCl_eNo.d.mts → fastify-augmentation-Cxb0ROIw.d.mts} +2 -2
- package/dist/{fields-CKLrhyOb.d.mts → fields-C7ahdGYf.d.mts} +1 -1
- package/dist/{generate-BaxDdmJ8.mjs → generate-Brans3fW.mjs} +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/idempotency/index.d.mts +2 -2
- package/dist/idempotency/index.mjs +1 -1
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/{index-QYma8mdC.d.mts → index-CHNQIhcb.d.mts} +5 -6
- package/dist/{index-vcWUGkwf.d.mts → index-CRKiiP5o.d.mts} +3 -3
- package/dist/{index-Cvo1u9n6.d.mts → index-Dh0_RSTd.d.mts} +3 -3
- package/dist/index.d.mts +5 -5
- package/dist/index.mjs +7 -7
- package/dist/{init-DSsdRfk9.mjs → init-Bqpt1Hxf.mjs} +274 -130
- package/dist/integrations/event-gateway.d.mts +2 -2
- package/dist/integrations/event-gateway.mjs +1 -1
- package/dist/integrations/index.d.mts +3 -3
- package/dist/integrations/mcp/index.d.mts +4 -4
- package/dist/integrations/mcp/index.mjs +1 -1
- package/dist/integrations/mcp/testing.d.mts +1 -1
- package/dist/integrations/mcp/testing.mjs +1 -1
- package/dist/integrations/streamline.mjs +7 -3
- package/dist/integrations/websocket-pushref-redis.d.mts +1 -1
- package/dist/integrations/websocket-redis.d.mts +1 -1
- package/dist/integrations/websocket.d.mts +3 -3
- package/dist/{loadResources-CwXt9MCh.mjs → loadResources-B8UmpITt.mjs} +1 -1
- package/dist/{loadResourcesFromEntry-XHNeUWpu.mjs → loadResourcesFromEntry-BTlFEx05.mjs} +1 -1
- package/dist/{mcpPlugin-CzKdt3B8.mjs → mcpPlugin-D1wuRD2c.mjs} +10 -11
- package/dist/{memory-TdTHCS9-.mjs → memory-CLXA2VeJ.mjs} +1 -1
- package/dist/{metrics-Da2EUPi9.mjs → metrics-fdxI5mn_.mjs} +1 -1
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +2 -2
- package/dist/{openapi-ButnRyOM.mjs → openapi-xVJibapr.mjs} +5 -5
- package/dist/permissions/index.d.mts +3 -3
- package/dist/permissions/index.mjs +2 -2
- package/dist/{permissions-3uzwkbQt.mjs → permissions-BPB1xqGf.mjs} +4 -4
- package/dist/{pipe-9Tl-OAus.mjs → pipe-BOLmGIxa.mjs} +1 -1
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +1 -1
- package/dist/plugins/index.d.mts +6 -7
- package/dist/plugins/index.mjs +12 -12
- package/dist/plugins/response-cache.mjs +1 -1
- package/dist/plugins/tracing-entry.d.mts +1 -1
- package/dist/plugins/tracing-entry.mjs +1 -1
- package/dist/presets/filesUpload.d.mts +4 -4
- package/dist/presets/filesUpload.mjs +4 -4
- package/dist/presets/index.d.mts +1 -1
- package/dist/presets/index.mjs +1 -1
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/multiTenant.mjs +2 -2
- package/dist/presets/search.d.mts +2 -2
- package/dist/presets/search.mjs +1 -1
- package/dist/{presets-CF79RHEo.mjs → presets-BtyFwTO4.mjs} +2 -2
- package/dist/{queryCachePlugin-CnAeFqju.mjs → queryCachePlugin-emHb0CuX.mjs} +4 -4
- package/dist/{queryCachePlugin-Bd2tYgh5.d.mts → queryCachePlugin-xzFyKAjT.d.mts} +2 -2
- package/dist/{redis-3hqH_Qk_.d.mts → redis-C3W0qbz8.d.mts} +1 -1
- package/dist/{redis-stream-BtEUtjxZ.d.mts → redis-stream-DsP1vqZB.d.mts} +1 -1
- package/dist/{rateLimit-yKvxWAky.mjs → registerRoute-CPmdkZGu.mjs} +109 -2
- package/dist/registry/index.d.mts +1 -1
- package/dist/registry/index.mjs +2 -2
- package/dist/{registry-Br15xdGM.mjs → registry-Bm9LjWKs.mjs} +1 -1
- package/dist/{replyHelpers-DXHVxrrj.mjs → replyHelpers-67tRawQZ.mjs} +1 -1
- package/dist/{schemaIR-CE6USIRi.mjs → schemaIR-D1MJwqmp.mjs} +1 -1
- package/dist/schemas/index.d.mts +64 -65
- package/dist/scope/index.d.mts +2 -2
- package/dist/scope/index.mjs +3 -3
- package/dist/{sse-BrY1W6U8.mjs → sse-CfUjwjDk.mjs} +7 -4
- package/dist/streaming-BQcW6_Kq.mjs +162 -0
- package/dist/testing/index.d.mts +7 -7
- package/dist/testing/index.mjs +3 -3
- package/dist/testing/storageContract.d.mts +1 -1
- package/dist/types/index.d.mts +5 -5
- package/dist/types/storage.d.mts +1 -1
- package/dist/{types-WVlAVp8T.d.mts → types-CmkknLzI.d.mts} +10 -10
- package/dist/{types-BWBcb88c.d.mts → types-D60PFwfG.d.mts} +1 -1
- package/dist/{types-Bi0r0vjG.mjs → types-bHblZ9YN.mjs} +1 -1
- package/dist/utils/index.d.mts +42 -4
- package/dist/utils/index.mjs +6 -5
- package/dist/{utils-xAQeDyU_.mjs → utils-C6QQ9-hd.mjs} +1415 -1524
- package/dist/{validate-0__MuUsK.mjs → validate-CRcaWzp2.mjs} +1 -1
- package/dist/{versioning-BSEDGXKC.d.mts → versioning-D_eBCfNr.d.mts} +8 -1
- package/dist/{versioning-C0K8KQLx.mjs → versioning-Dk-71iIz.mjs} +1 -1
- package/dist/{websocket-BFBT5rH-.d.mts → websocket-MlYlrYq0.d.mts} +1 -1
- package/package.json +36 -30
- package/dist/EventTransport-7LPXLEUX.mjs +0 -103
- package/dist/actionPermissions-CX9QIMTd.mjs +0 -24
- package/dist/betterAuthOpenApi-DAAhMZff.mjs +0 -251
- package/dist/defineEvent-DC981g-o.mjs +0 -188
- package/dist/registerRoute-BEYn0ylk.mjs +0 -108
- /package/dist/{EventTransport-CaaXM5Y1.d.mts → EventTransport-IEn7Tn-Q.d.mts} +0 -0
- /package/dist/{HookSystem-BfCpWbwM.mjs → HookSystem-C1vB_Gc9.mjs} +0 -0
- /package/dist/{constants-TrJVIJl0.mjs → constants-gaEeMlz-.mjs} +0 -0
- /package/dist/{elevation-DW90z5bT.d.mts → elevation-xGUBq6p_.d.mts} +0 -0
- /package/dist/{errorHandler-_Lp2k9M3.d.mts → errorHandler-BtUUDPEa.d.mts} +0 -0
- /package/dist/{errors-DZOemeGa.d.mts → errors-DOHkjQlD.d.mts} +0 -0
- /package/dist/{errors-j4aJm1Wg.mjs → errors-DkO8Nk6-.mjs} +0 -0
- /package/dist/{externalPaths-DLle0R07.d.mts → externalPaths-BE6wFpYv.d.mts} +0 -0
- /package/dist/{generate-Dmk8cfvX.d.mts → generate-BnsL9GBm.d.mts} +0 -0
- /package/dist/{init-BS4Daqnv.d.mts → init-BPEu8cs-.d.mts} +0 -0
- /package/dist/{interface-DL7LlWS5.d.mts → interface-C1_WLTMK.d.mts} +0 -0
- /package/dist/{interface-CsrGR8LF.d.mts → interface-Uk8ONJv7.d.mts} +0 -0
- /package/dist/{keys-B3yyBEyH.mjs → keys-Cd316u_y.mjs} +0 -0
- /package/dist/{multipartBody-709YcXi1.mjs → multipartBody-CHEQSZ6G.mjs} +0 -0
- /package/dist/{pluralize-BxdUl2P4.mjs → pluralize-DccFV9R7.mjs} +0 -0
- /package/dist/{preloadResources-B-j-iqo-.mjs → preloadResources-CHw3_oA_.mjs} +0 -0
- /package/dist/{pushref-registry-Dqclzjy7.d.mts → pushref-registry-DnCqL3aa.d.mts} +0 -0
- /package/dist/{requestContext-DDLS3NVU.mjs → requestContext-BZKOr13H.mjs} +0 -0
- /package/dist/{chunk-BpYLSNr0.mjs → rolldown-runtime-8H4AJuhK.mjs} +0 -0
- /package/dist/{schemaConverter-DatAaVNj.mjs → schemaConverter-U0MnO9vd.mjs} +0 -0
- /package/dist/{sessionManager-CyHpYXoB.d.mts → sessionManager-BXG-HGwG.d.mts} +0 -0
- /package/dist/{storage-C5q8fuEt.d.mts → storage-Co_PQpeQ.d.mts} +0 -0
- /package/dist/{store-helpers-DjSYI2uP.mjs → store-helpers-DY6xq4sM.mjs} +0 -0
- /package/dist/{tracing-Bnb1-YVd.d.mts → tracing-D8jlGXP7.d.mts} +0 -0
- /package/dist/{typeGuards-CcFZXgU7.mjs → typeGuards-C9KXUly6.mjs} +0 -0
- /package/dist/{types-BJwJN2Pg.d.mts → types-LNebCoJx.d.mts} +0 -0
- /package/dist/{types-D57iXYb8.mjs → types-XTApa8b6.mjs} +0 -0
package/dist/schemas/index.d.mts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ErrorContract, ErrorDetail } from "@classytic/repo-core/errors";
|
|
2
2
|
import { FastifyPluginAsyncTypebox, FastifyPluginCallbackTypebox, TypeBoxTypeProvider, TypeBoxValidatorCompiler } from "@fastify/type-provider-typebox";
|
|
3
|
-
import * as _$_sinclair_typebox0 from "@sinclair/typebox";
|
|
4
3
|
import { Static, TObject, TSchema, TSchema as TSchema$1, Type } from "@sinclair/typebox";
|
|
5
4
|
|
|
6
5
|
//#region src/schemas/index.d.ts
|
|
@@ -18,74 +17,74 @@ import { Static, TObject, TSchema, TSchema as TSchema$1, Type } from "@sinclair/
|
|
|
18
17
|
* variant when your endpoint never emits the others. HTTP status
|
|
19
18
|
* discriminates success vs error — no `success` field.
|
|
20
19
|
*/
|
|
21
|
-
declare function ArcListResponse<T extends TSchema$1>(itemSchema: T):
|
|
22
|
-
method:
|
|
23
|
-
data:
|
|
24
|
-
page:
|
|
25
|
-
limit:
|
|
26
|
-
total:
|
|
27
|
-
pages:
|
|
28
|
-
hasNext:
|
|
29
|
-
hasPrev:
|
|
30
|
-
}>,
|
|
31
|
-
method:
|
|
32
|
-
data:
|
|
33
|
-
limit:
|
|
34
|
-
hasMore:
|
|
35
|
-
next:
|
|
36
|
-
}>,
|
|
37
|
-
method:
|
|
38
|
-
data:
|
|
39
|
-
page:
|
|
40
|
-
limit:
|
|
41
|
-
total:
|
|
42
|
-
pages:
|
|
43
|
-
hasNext:
|
|
44
|
-
hasPrev:
|
|
45
|
-
}>,
|
|
46
|
-
data:
|
|
20
|
+
declare function ArcListResponse<T extends TSchema$1>(itemSchema: T): import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TObject<{
|
|
21
|
+
method: import("@sinclair/typebox").TLiteral<"offset">;
|
|
22
|
+
data: import("@sinclair/typebox").TArray<T>;
|
|
23
|
+
page: import("@sinclair/typebox").TInteger;
|
|
24
|
+
limit: import("@sinclair/typebox").TInteger;
|
|
25
|
+
total: import("@sinclair/typebox").TInteger;
|
|
26
|
+
pages: import("@sinclair/typebox").TInteger;
|
|
27
|
+
hasNext: import("@sinclair/typebox").TBoolean;
|
|
28
|
+
hasPrev: import("@sinclair/typebox").TBoolean;
|
|
29
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
30
|
+
method: import("@sinclair/typebox").TLiteral<"keyset">;
|
|
31
|
+
data: import("@sinclair/typebox").TArray<T>;
|
|
32
|
+
limit: import("@sinclair/typebox").TInteger;
|
|
33
|
+
hasMore: import("@sinclair/typebox").TBoolean;
|
|
34
|
+
next: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
35
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
36
|
+
method: import("@sinclair/typebox").TLiteral<"aggregate">;
|
|
37
|
+
data: import("@sinclair/typebox").TArray<T>;
|
|
38
|
+
page: import("@sinclair/typebox").TInteger;
|
|
39
|
+
limit: import("@sinclair/typebox").TInteger;
|
|
40
|
+
total: import("@sinclair/typebox").TInteger;
|
|
41
|
+
pages: import("@sinclair/typebox").TInteger;
|
|
42
|
+
hasNext: import("@sinclair/typebox").TBoolean;
|
|
43
|
+
hasPrev: import("@sinclair/typebox").TBoolean;
|
|
44
|
+
}>, import("@sinclair/typebox").TObject<{
|
|
45
|
+
data: import("@sinclair/typebox").TArray<T>;
|
|
47
46
|
}>]>;
|
|
48
47
|
/** Offset variant — `{ method: 'offset', data, page, limit, total, pages, hasNext, hasPrev }`. */
|
|
49
|
-
declare function ArcOffsetListResponse<T extends TSchema$1>(itemSchema: T):
|
|
50
|
-
method:
|
|
51
|
-
data:
|
|
52
|
-
page:
|
|
53
|
-
limit:
|
|
54
|
-
total:
|
|
55
|
-
pages:
|
|
56
|
-
hasNext:
|
|
57
|
-
hasPrev:
|
|
48
|
+
declare function ArcOffsetListResponse<T extends TSchema$1>(itemSchema: T): import("@sinclair/typebox").TObject<{
|
|
49
|
+
method: import("@sinclair/typebox").TLiteral<"offset">;
|
|
50
|
+
data: import("@sinclair/typebox").TArray<T>;
|
|
51
|
+
page: import("@sinclair/typebox").TInteger;
|
|
52
|
+
limit: import("@sinclair/typebox").TInteger;
|
|
53
|
+
total: import("@sinclair/typebox").TInteger;
|
|
54
|
+
pages: import("@sinclair/typebox").TInteger;
|
|
55
|
+
hasNext: import("@sinclair/typebox").TBoolean;
|
|
56
|
+
hasPrev: import("@sinclair/typebox").TBoolean;
|
|
58
57
|
}>;
|
|
59
58
|
/** Keyset variant — `{ method: 'keyset', data, limit, hasMore, next: string | null }`. */
|
|
60
|
-
declare function ArcKeysetListResponse<T extends TSchema$1>(itemSchema: T):
|
|
61
|
-
method:
|
|
62
|
-
data:
|
|
63
|
-
limit:
|
|
64
|
-
hasMore:
|
|
65
|
-
next:
|
|
59
|
+
declare function ArcKeysetListResponse<T extends TSchema$1>(itemSchema: T): import("@sinclair/typebox").TObject<{
|
|
60
|
+
method: import("@sinclair/typebox").TLiteral<"keyset">;
|
|
61
|
+
data: import("@sinclair/typebox").TArray<T>;
|
|
62
|
+
limit: import("@sinclair/typebox").TInteger;
|
|
63
|
+
hasMore: import("@sinclair/typebox").TBoolean;
|
|
64
|
+
next: import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TNull]>;
|
|
66
65
|
}>;
|
|
67
66
|
/** Aggregate variant — `{ method: 'aggregate', ...same as offset }`. */
|
|
68
|
-
declare function ArcAggregateListResponse<T extends TSchema$1>(itemSchema: T):
|
|
69
|
-
method:
|
|
70
|
-
data:
|
|
71
|
-
page:
|
|
72
|
-
limit:
|
|
73
|
-
total:
|
|
74
|
-
pages:
|
|
75
|
-
hasNext:
|
|
76
|
-
hasPrev:
|
|
67
|
+
declare function ArcAggregateListResponse<T extends TSchema$1>(itemSchema: T): import("@sinclair/typebox").TObject<{
|
|
68
|
+
method: import("@sinclair/typebox").TLiteral<"aggregate">;
|
|
69
|
+
data: import("@sinclair/typebox").TArray<T>;
|
|
70
|
+
page: import("@sinclair/typebox").TInteger;
|
|
71
|
+
limit: import("@sinclair/typebox").TInteger;
|
|
72
|
+
total: import("@sinclair/typebox").TInteger;
|
|
73
|
+
pages: import("@sinclair/typebox").TInteger;
|
|
74
|
+
hasNext: import("@sinclair/typebox").TBoolean;
|
|
75
|
+
hasPrev: import("@sinclair/typebox").TBoolean;
|
|
77
76
|
}>;
|
|
78
77
|
/** Bare variant — `{ data }`, no `method` discriminant. */
|
|
79
|
-
declare function ArcBareListResponse<T extends TSchema$1>(itemSchema: T):
|
|
80
|
-
data:
|
|
78
|
+
declare function ArcBareListResponse<T extends TSchema$1>(itemSchema: T): import("@sinclair/typebox").TObject<{
|
|
79
|
+
data: import("@sinclair/typebox").TArray<T>;
|
|
81
80
|
}>;
|
|
82
81
|
/**
|
|
83
82
|
* Delete response — `{ message, id?, soft? }` raw at the top level.
|
|
84
83
|
*/
|
|
85
|
-
declare function ArcDeleteResponse():
|
|
86
|
-
message:
|
|
87
|
-
id:
|
|
88
|
-
soft:
|
|
84
|
+
declare function ArcDeleteResponse(): import("@sinclair/typebox").TObject<{
|
|
85
|
+
message: import("@sinclair/typebox").TString;
|
|
86
|
+
id: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
87
|
+
soft: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
89
88
|
}>;
|
|
90
89
|
/**
|
|
91
90
|
* Single field-scoped error detail — `Type.Unsafe<ErrorDetail>` over the
|
|
@@ -97,7 +96,7 @@ declare function ArcDeleteResponse(): _$_sinclair_typebox0.TObject<{
|
|
|
97
96
|
* Exported standalone so hosts can embed it in custom 422 / 409 response
|
|
98
97
|
* schemas.
|
|
99
98
|
*/
|
|
100
|
-
declare function ArcErrorDetail():
|
|
99
|
+
declare function ArcErrorDetail(): import("@sinclair/typebox").TUnsafe<ErrorDetail>;
|
|
101
100
|
/**
|
|
102
101
|
* Error response schema — `Type.Unsafe<ErrorContract>` over the canonical
|
|
103
102
|
* JSON Schema `errorContractSchema` from `@classytic/repo-core/errors`.
|
|
@@ -106,7 +105,7 @@ declare function ArcErrorDetail(): _$_sinclair_typebox0.TUnsafe<ErrorDetail>;
|
|
|
106
105
|
* (`errorContractSchema`) and this TypeBox helper cannot drift —
|
|
107
106
|
* literally one source.
|
|
108
107
|
*/
|
|
109
|
-
declare function ArcErrorResponse():
|
|
108
|
+
declare function ArcErrorResponse(): import("@sinclair/typebox").TUnsafe<ErrorContract>;
|
|
110
109
|
/**
|
|
111
110
|
* Standard pagination + sorting + filtering query parameters.
|
|
112
111
|
* Matches Arc's list endpoint conventions.
|
|
@@ -122,12 +121,12 @@ declare function ArcErrorResponse(): _$_sinclair_typebox0.TUnsafe<ErrorContract>
|
|
|
122
121
|
* projection forms at the request-validation gate even though arc passes
|
|
123
122
|
* them through unchanged.
|
|
124
123
|
*/
|
|
125
|
-
declare function ArcPaginationQuery():
|
|
126
|
-
page:
|
|
127
|
-
limit:
|
|
128
|
-
sort:
|
|
129
|
-
select:
|
|
130
|
-
populate:
|
|
124
|
+
declare function ArcPaginationQuery(): import("@sinclair/typebox").TObject<{
|
|
125
|
+
page: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
126
|
+
limit: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TInteger>;
|
|
127
|
+
sort: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
128
|
+
select: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TString, import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>, import("@sinclair/typebox").TRecord<import("@sinclair/typebox").TString, import("@sinclair/typebox").TUnion<[import("@sinclair/typebox").TLiteral<0>, import("@sinclair/typebox").TLiteral<1>]>>]>>;
|
|
129
|
+
populate: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TAny>;
|
|
131
130
|
}>;
|
|
132
131
|
//#endregion
|
|
133
132
|
export { ArcAggregateListResponse, ArcBareListResponse, ArcDeleteResponse, ArcErrorDetail, ArcErrorResponse, ArcKeysetListResponse, ArcListResponse, ArcOffsetListResponse, ArcPaginationQuery, type FastifyPluginAsyncTypebox, type FastifyPluginCallbackTypebox, type Static, type TObject, type TSchema, Type, type TypeBoxTypeProvider, TypeBoxValidatorCompiler };
|
package/dist/scope/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { C as isMember, D as requireOrgId, E as requireClientId, O as requireTeamId, S as isElevated, T as isService, _ as getTenantFromRequest, a as getAncestorOrgIds, b as hasOrgAccess, c as getMandate, d as getOrgRoles, f as getRequestScope, g as getTeamId, h as getServiceScopes, i as RequestScope, k as requireUserId, l as getOrgContext, m as getScopeContextMap, n as Mandate, o as getClientId, p as getScopeContext, r as PUBLIC_SCOPE, s as getDPoPJkt, t as AUTHENTICATED_SCOPE, u as getOrgId, v as getUserId, w as isOrgInScope, x as isAuthenticated, y as getUserRoles } from "../types-
|
|
2
|
-
import { i as elevationPlugin, n as ElevationOptions, r as _default, t as ElevationEvent } from "../elevation-
|
|
1
|
+
import { C as isMember, D as requireOrgId, E as requireClientId, O as requireTeamId, S as isElevated, T as isService, _ as getTenantFromRequest, a as getAncestorOrgIds, b as hasOrgAccess, c as getMandate, d as getOrgRoles, f as getRequestScope, g as getTeamId, h as getServiceScopes, i as RequestScope, k as requireUserId, l as getOrgContext, m as getScopeContextMap, n as Mandate, o as getClientId, p as getScopeContext, r as PUBLIC_SCOPE, s as getDPoPJkt, t as AUTHENTICATED_SCOPE, u as getOrgId, v as getUserId, w as isOrgInScope, x as isAuthenticated, y as getUserRoles } from "../types-LNebCoJx.mjs";
|
|
2
|
+
import { i as elevationPlugin, n as ElevationOptions, r as _default, t as ElevationEvent } from "../elevation-xGUBq6p_.mjs";
|
|
3
3
|
import { FastifyReply, FastifyRequest } from "fastify";
|
|
4
4
|
|
|
5
5
|
//#region src/scope/rateLimitKey.d.ts
|
package/dist/scope/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { C as isService, D as requireUserId, E as requireTeamId, 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-
|
|
2
|
-
import { n as normalizeRoles } from "../types-
|
|
3
|
-
import { n as elevation_default, t as elevationPlugin } from "../elevation-
|
|
1
|
+
import { C as isService, D as requireUserId, E as requireTeamId, 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-bHblZ9YN.mjs";
|
|
2
|
+
import { n as normalizeRoles } from "../types-XTApa8b6.mjs";
|
|
3
|
+
import { n as elevation_default, t as elevationPlugin } from "../elevation-COpYKt2h.mjs";
|
|
4
4
|
//#region src/scope/rateLimitKey.ts
|
|
5
5
|
function createTenantKeyGenerator(opts) {
|
|
6
6
|
if (opts?.strategy) return opts.strategy;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { t as __exportAll } from "./
|
|
1
|
+
import { t as __exportAll } from "./rolldown-runtime-8H4AJuhK.mjs";
|
|
2
2
|
import { arcLog } from "./logger/index.mjs";
|
|
3
|
-
import { c as getOrgId, n as PUBLIC_SCOPE } from "./types-
|
|
3
|
+
import { c as getOrgId, n as PUBLIC_SCOPE } from "./types-bHblZ9YN.mjs";
|
|
4
|
+
import { a as promoteStreamTokenToHeader, n as forwardedStreamHeaders } from "./streaming-BQcW6_Kq.mjs";
|
|
4
5
|
import fp from "fastify-plugin";
|
|
5
6
|
//#region src/plugins/sse.ts
|
|
6
7
|
var sse_exports = /* @__PURE__ */ __exportAll({
|
|
@@ -9,7 +10,7 @@ var sse_exports = /* @__PURE__ */ __exportAll({
|
|
|
9
10
|
});
|
|
10
11
|
const log = arcLog("sse");
|
|
11
12
|
const ssePlugin = async (fastify, opts = {}) => {
|
|
12
|
-
const { path = "/events/stream", requireAuth = true, patterns = ["*"], heartbeat = 3e4, orgScoped = false, filter: customFilter } = opts;
|
|
13
|
+
const { path = "/events/stream", requireAuth = true, patterns = ["*"], heartbeat = 3e4, orgScoped = false, filter: customFilter, tokenQueryParam = "token" } = opts;
|
|
13
14
|
if (!fastify.hasDecorator("events")) {
|
|
14
15
|
log.warn("Events plugin (arc-events) not registered. SSE plugin will not function. Register eventPlugin before ssePlugin.");
|
|
15
16
|
return;
|
|
@@ -33,7 +34,8 @@ const ssePlugin = async (fastify, opts = {}) => {
|
|
|
33
34
|
"content-type": "text/event-stream",
|
|
34
35
|
"cache-control": "no-cache",
|
|
35
36
|
connection: "keep-alive",
|
|
36
|
-
"x-accel-buffering": "no"
|
|
37
|
+
"x-accel-buffering": "no",
|
|
38
|
+
...forwardedStreamHeaders(reply)
|
|
37
39
|
});
|
|
38
40
|
reply.raw.flushHeaders();
|
|
39
41
|
const unsubscribers = [];
|
|
@@ -80,6 +82,7 @@ const ssePlugin = async (fastify, opts = {}) => {
|
|
|
80
82
|
};
|
|
81
83
|
if (requireAuth) {
|
|
82
84
|
routeOpts.preHandler = (request, reply) => {
|
|
85
|
+
if (tokenQueryParam) promoteStreamTokenToHeader(request, tokenQueryParam);
|
|
83
86
|
const authenticate = fastify.authenticate;
|
|
84
87
|
if (typeof authenticate !== "function") {
|
|
85
88
|
reply.code(401).send({ error: "Unauthorized" });
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import { Readable } from "node:stream";
|
|
2
|
+
//#region src/utils/streaming.ts
|
|
3
|
+
/**
|
|
4
|
+
* Streaming helpers — adapters between Web `ReadableStream` producers
|
|
5
|
+
* (Vercel AI SDK, OpenAI SDK, `fetch().body`, hand-built `TransformStream`s)
|
|
6
|
+
* and Fastify's raw Node-stream reply.
|
|
7
|
+
*
|
|
8
|
+
* Why this exists: returning a `ReadableStream<UIMessageChunk>` from a
|
|
9
|
+
* `streamResponse: true` arc route used to crash with
|
|
10
|
+
* `chunk must be a string or Buffer` because Fastify cannot serialise
|
|
11
|
+
* `UIMessageChunk` JSON objects directly. Every arc-ai host (sniffer,
|
|
12
|
+
* spawn, downstream) reimplemented the same `JsonToSseTransformStream` +
|
|
13
|
+
* SSE header boilerplate. `pipeUIMessageStreamToReply()` is that
|
|
14
|
+
* boilerplate, owned once.
|
|
15
|
+
*
|
|
16
|
+
* arc stays peer-coupled to nothing: the helper accepts any
|
|
17
|
+
* `ReadableStream<unknown>` and JSON-stringifies each chunk. It works
|
|
18
|
+
* with `UIMessageChunk` from the AI SDK without importing it.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Canonical SSE headers for AI-SDK-style UI message streams.
|
|
22
|
+
*
|
|
23
|
+
* `x-vercel-ai-ui-message-stream: v1` is the marker the Vercel AI SDK
|
|
24
|
+
* client uses to detect the v1 UI message stream protocol (vs the older
|
|
25
|
+
* data stream protocol). Surfaced as a constant so hosts don't memorise it.
|
|
26
|
+
*/
|
|
27
|
+
const UI_MESSAGE_STREAM_HEADERS = {
|
|
28
|
+
"content-type": "text/event-stream",
|
|
29
|
+
"cache-control": "no-cache",
|
|
30
|
+
connection: "keep-alive",
|
|
31
|
+
"x-accel-buffering": "no",
|
|
32
|
+
"x-vercel-ai-ui-message-stream": "v1"
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Pipe a Web `ReadableStream` of JSON-serialisable chunks (typically
|
|
36
|
+
* `UIMessageChunk` from the Vercel AI SDK) into a Fastify reply as an
|
|
37
|
+
* SSE event stream.
|
|
38
|
+
*
|
|
39
|
+
* - Sets {@link UI_MESSAGE_STREAM_HEADERS} (or the caller's override)
|
|
40
|
+
* before the first chunk.
|
|
41
|
+
* - Writes each chunk as `data: ${JSON.stringify(chunk)}\n\n`.
|
|
42
|
+
* - Cancels the source and closes the reply when the client disconnects.
|
|
43
|
+
* - Resolves once the stream is fully written.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* import { pipeUIMessageStreamToReply } from '@classytic/arc/utils';
|
|
48
|
+
* import { streamText, convertToUIMessageStream } from 'ai';
|
|
49
|
+
*
|
|
50
|
+
* defineResource({
|
|
51
|
+
* name: 'chat',
|
|
52
|
+
* routes: [{
|
|
53
|
+
* method: 'POST', path: '/', streamResponse: true,
|
|
54
|
+
* handler: async (req, reply) => {
|
|
55
|
+
* const result = streamText({ model, messages: req.body.messages });
|
|
56
|
+
* await pipeUIMessageStreamToReply(reply, result.toUIMessageStream());
|
|
57
|
+
* },
|
|
58
|
+
* }],
|
|
59
|
+
* });
|
|
60
|
+
* ```
|
|
61
|
+
*/
|
|
62
|
+
async function pipeUIMessageStreamToReply(reply, stream, options = {}) {
|
|
63
|
+
const serialize = options.serialize ?? defaultSerialize;
|
|
64
|
+
const headers = options.headers ?? UI_MESSAGE_STREAM_HEADERS;
|
|
65
|
+
for (const [key, value] of Object.entries(headers)) reply.header(key, value);
|
|
66
|
+
const reader = stream.getReader();
|
|
67
|
+
let cancelled = false;
|
|
68
|
+
const onAbort = () => {
|
|
69
|
+
cancelled = true;
|
|
70
|
+
reader.cancel().catch(() => {});
|
|
71
|
+
};
|
|
72
|
+
reply.request.raw.once("close", onAbort);
|
|
73
|
+
options.signal?.addEventListener("abort", onAbort, { once: true });
|
|
74
|
+
async function* sseFrames() {
|
|
75
|
+
try {
|
|
76
|
+
while (true) {
|
|
77
|
+
const { value, done } = await reader.read();
|
|
78
|
+
if (done) break;
|
|
79
|
+
yield `data: ${serialize(value)}\n\n`;
|
|
80
|
+
}
|
|
81
|
+
} catch (err) {
|
|
82
|
+
if (!cancelled) yield `event: error\ndata: ${JSON.stringify({ message: String(err) })}\n\n`;
|
|
83
|
+
} finally {
|
|
84
|
+
reply.request.raw.removeListener("close", onAbort);
|
|
85
|
+
options.signal?.removeEventListener("abort", onAbort);
|
|
86
|
+
reader.releaseLock?.();
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
const nodeStream = Readable.from(sseFrames());
|
|
90
|
+
await reply.send(nodeStream);
|
|
91
|
+
}
|
|
92
|
+
function defaultSerialize(chunk) {
|
|
93
|
+
return typeof chunk === "string" ? chunk : JSON.stringify(chunk);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Promote a stream auth token from the query string into the `Authorization`
|
|
97
|
+
* header, in place, so the standard `fastify.authenticate` decorator can read it.
|
|
98
|
+
*
|
|
99
|
+
* Why: the browser `EventSource` (and `WebSocket`) API **cannot set request
|
|
100
|
+
* headers** — there is no header channel on the constructor. So arc-next's
|
|
101
|
+
* `buildStreamUrl` (bearer mode) appends the token as `?token=<jwt>` on stream
|
|
102
|
+
* URLs. Server auth reads the `Authorization` header, so without this promotion
|
|
103
|
+
* EVERY browser SSE/WS stream is 401 in bearer mode (cookie mode is unaffected —
|
|
104
|
+
* arc-next omits the query token there and relies on the cookie).
|
|
105
|
+
*
|
|
106
|
+
* Safe by construction:
|
|
107
|
+
* - No-op when an `Authorization` header is already present → normal `fetch`
|
|
108
|
+
* requests (which send the header) are never touched.
|
|
109
|
+
* - The token still goes through full authentication downstream, so a forged or
|
|
110
|
+
* stale value simply 401s. This only relocates WHERE the bearer is read from;
|
|
111
|
+
* it grants no trust on its own.
|
|
112
|
+
*
|
|
113
|
+
* Parsed from `request.raw.url` (not `request.query`) so it's robust to route
|
|
114
|
+
* querystring schemas that would otherwise strip an undeclared `token` param.
|
|
115
|
+
*
|
|
116
|
+
* @param queryParam name of the query parameter carrying the token (default `token`).
|
|
117
|
+
*/
|
|
118
|
+
function promoteStreamTokenToHeader(request, queryParam = "token") {
|
|
119
|
+
if (request.headers.authorization) return;
|
|
120
|
+
const url = request.raw.url ?? "";
|
|
121
|
+
const q = url.indexOf("?");
|
|
122
|
+
if (q < 0) return;
|
|
123
|
+
const token = new URLSearchParams(url.slice(q + 1)).get(queryParam);
|
|
124
|
+
if (token) request.headers.authorization = `Bearer ${token}`;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Collect the CORS / `Vary` headers a plugin (e.g. `@fastify/cors`, whose default
|
|
128
|
+
* `onRequest` hook runs BEFORE the route handler) has already set on the reply, so
|
|
129
|
+
* a hijacked SSE handler that writes straight to `reply.raw.writeHead(...)` can
|
|
130
|
+
* merge them onto the raw response.
|
|
131
|
+
*
|
|
132
|
+
* Why: `reply.hijack()` + `reply.raw.writeHead()` bypass Fastify's `onSend`
|
|
133
|
+
* serialization, which is where reply-level headers reach the wire. A cross-origin
|
|
134
|
+
* `EventSource` therefore receives no `Access-Control-Allow-Origin` and the browser
|
|
135
|
+
* blocks the (authenticated) stream. Re-emitting the already-computed CORS headers
|
|
136
|
+
* honors the host's configured policy (origin allowlist, credentials) rather than
|
|
137
|
+
* re-deriving it. Returns lowercased header names suitable for `writeHead`.
|
|
138
|
+
*/
|
|
139
|
+
function forwardedStreamHeaders(reply) {
|
|
140
|
+
const out = {};
|
|
141
|
+
for (const [key, value] of Object.entries(reply.getHeaders())) {
|
|
142
|
+
if (value == null) continue;
|
|
143
|
+
if (key.startsWith("access-control-") || key === "vary") out[key] = Array.isArray(value) ? value.join(", ") : String(value);
|
|
144
|
+
}
|
|
145
|
+
return out;
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Heuristic — does this value look like a Web `ReadableStream`?
|
|
149
|
+
*
|
|
150
|
+
* Used by `createCrudRouter` to auto-pipe `streamResponse: true` handlers
|
|
151
|
+
* that return a UI message stream instead of writing to `reply.raw`
|
|
152
|
+
* directly. Cross-realm safe (no `instanceof`) — checks the duck shape
|
|
153
|
+
* the Streams spec mandates: `getReader`, `cancel`, and the `locked`
|
|
154
|
+
* getter.
|
|
155
|
+
*/
|
|
156
|
+
function isReadableStream(value) {
|
|
157
|
+
if (value === null || typeof value !== "object") return false;
|
|
158
|
+
const obj = value;
|
|
159
|
+
return typeof obj.getReader === "function" && typeof obj.cancel === "function" && typeof obj.locked === "boolean";
|
|
160
|
+
}
|
|
161
|
+
//#endregion
|
|
162
|
+
export { promoteStreamTokenToHeader as a, pipeUIMessageStreamToReply as i, forwardedStreamHeaders as n, isReadableStream as r, UI_MESSAGE_STREAM_HEADERS as t };
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Kt as AnyRecord, V as ResourceDefinition } from "../index-
|
|
2
|
-
import { d as preloadResourcesAsync, r as CreateAppOptions, u as preloadResources } from "../types-
|
|
1
|
+
import { Kt as AnyRecord, V as ResourceDefinition } from "../index-CHNQIhcb.mjs";
|
|
2
|
+
import { d as preloadResourcesAsync, r as CreateAppOptions, u as preloadResources } from "../types-CmkknLzI.mjs";
|
|
3
3
|
import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
|
|
4
4
|
import { FastifyInstance, FastifyServerOptions } from "fastify";
|
|
5
5
|
import { Mock } from "vitest";
|
|
@@ -412,11 +412,11 @@ declare function createMockReply(): unknown;
|
|
|
412
412
|
*/
|
|
413
413
|
declare function createMockController(repository: StandardRepo<AnyRecord>): {
|
|
414
414
|
repository: StandardRepo<AnyRecord>;
|
|
415
|
-
list: Mock<(
|
|
416
|
-
get: Mock<(
|
|
417
|
-
create: Mock<(
|
|
418
|
-
update: Mock<(
|
|
419
|
-
delete: Mock<(
|
|
415
|
+
list: Mock<import("@vitest/spy").Procedure>;
|
|
416
|
+
get: Mock<import("@vitest/spy").Procedure>;
|
|
417
|
+
create: Mock<import("@vitest/spy").Procedure>;
|
|
418
|
+
update: Mock<import("@vitest/spy").Procedure>;
|
|
419
|
+
delete: Mock<import("@vitest/spy").Procedure>;
|
|
420
420
|
};
|
|
421
421
|
/**
|
|
422
422
|
* Create mock data factory
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as CRUD_OPERATIONS } from "../constants-
|
|
2
|
-
import { n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-
|
|
1
|
+
import { t as CRUD_OPERATIONS } from "../constants-gaEeMlz-.mjs";
|
|
2
|
+
import { n as preloadResourcesAsync, t as preloadResources } from "../preloadResources-CHw3_oA_.mjs";
|
|
3
3
|
import { runStorageContract } from "./storageContract.mjs";
|
|
4
4
|
import Fastify from "fastify";
|
|
5
5
|
import { afterAll, describe, expect, it, vi } from "vitest";
|
|
@@ -1046,7 +1046,7 @@ function pickDefaultAuth(authMode, callerAuth) {
|
|
|
1046
1046
|
};
|
|
1047
1047
|
}
|
|
1048
1048
|
async function createTestApp(options = {}) {
|
|
1049
|
-
const { createApp } = await import("../createApp
|
|
1049
|
+
const { createApp } = await import("../createApp--703hQE1.mjs").then((n) => n.r);
|
|
1050
1050
|
const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
|
|
1051
1051
|
let dbHandle;
|
|
1052
1052
|
let dbUri;
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as OnTenantDeleteConfig, A as RequestIdOptions, Bt as AuthHelpers, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, G as ActionsMap, Gt as TokenPair, H as ActionDefinition, Ht as Authenticator, I as MiddlewareHandler, J as CrudRouteKey, Jt as ArcRequest, K as ArcFieldRule, Kt as AnyRecord, L as RequestWithExtras, M as EventsDecorator, N as FastifyRequestExtras, O as HealthOptions, P as FastifyWithAuth, Pn as BaseControllerOptions, Q as MiddlewareConfig, Qt as UserOrganization, S as QueryParserInterface, T as CrudRouterOptions, U as ActionEntry, Ut as AuthenticatorContext, Vt as AuthPluginOptions, W as ActionHandlerFn, Wt as JwtContext, X as EventDefinition, Xt as ObjectId, Y as CrudSchemas, Yt as JWTPayload, Z as FieldRule, Zt as UserLike, _ as ControllerQueryOptions, _t as FastifyHandler, a as InferAdapterDoc, at as ResolvedTenantPurge, b as ParsedQuery, bt as IRequestContext, c as TypedController, ct as ResourceHookContext, d as PaginationResult, dt as RouteDefinition, et as OpenApiSchemas, f as IntrospectionData, ft as RouteMcpConfig, g as ArcInternalMetadata, gt as ControllerLike, h as ResourceMetadata, ht as ControllerHandler, i as ValidationResult, it as RateLimitConfig, j as ArcDecorator, k as IntrospectionPluginOptions, l as TypedRepository, lt as ResourceHooks, m as RegistryStats, mt as RouteSchemaOptions, n as ConfigError, nt as PresetHook, o as InferDocType, ot as ResourceCacheConfig, p as RegistryEntry, pt as RouteMethod, q as CrudController, qt as ApiResponse, r as ValidateOptions, rt as PresetResult, s as InferResourceDoc, st as ResourceConfig, t as RouteHandlerMethod, tt as PresetFunction, u as TypedResourceConfig, ut as ResourcePermissions, v as LookupOption, vt as IController, w as ServiceContext, x as PopulateOption, xt as RouteHandler, y as OwnershipCheck, yt as IControllerResponse } from "../index-
|
|
2
|
-
import { i as RequestScope } from "../types-
|
|
3
|
-
import { c as PermissionCheck, d as UserBase, l as PermissionContext, u as PermissionResult } from "../fields-
|
|
4
|
-
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-
|
|
5
|
-
export { ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ApiResponse, ArcDecorator, ArcFieldRule, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, BaseControllerOptions, ConfigError, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRouteKey, CrudRouterOptions, CrudSchemas, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, LookupOption, MiddlewareConfig, MiddlewareHandler, ObjectId, OnTenantDeleteConfig, OpenApiSchemas, OwnershipCheck, PaginationResult, ParsedQuery, PermissionCheck, PermissionContext, PermissionResult, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryParserInterface, RateLimitConfig, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResolvedTenantPurge, ResourceCacheConfig, ResourceConfig, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, RouteDefinition, RouteHandler, RouteHandlerMethod, RouteMcpConfig, RouteMethod, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult };
|
|
1
|
+
import { $ as OnTenantDeleteConfig, A as RequestIdOptions, Bt as AuthHelpers, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, G as ActionsMap, Gt as TokenPair, H as ActionDefinition, Ht as Authenticator, I as MiddlewareHandler, J as CrudRouteKey, Jt as ArcRequest, K as ArcFieldRule, Kt as AnyRecord, L as RequestWithExtras, M as EventsDecorator, N as FastifyRequestExtras, O as HealthOptions, P as FastifyWithAuth, Pn as BaseControllerOptions, Q as MiddlewareConfig, Qt as UserOrganization, S as QueryParserInterface, T as CrudRouterOptions, U as ActionEntry, Ut as AuthenticatorContext, Vt as AuthPluginOptions, W as ActionHandlerFn, Wt as JwtContext, X as EventDefinition, Xt as ObjectId, Y as CrudSchemas, Yt as JWTPayload, Z as FieldRule, Zt as UserLike, _ as ControllerQueryOptions, _t as FastifyHandler, a as InferAdapterDoc, at as ResolvedTenantPurge, b as ParsedQuery, bt as IRequestContext, c as TypedController, ct as ResourceHookContext, d as PaginationResult, dt as RouteDefinition, et as OpenApiSchemas, f as IntrospectionData, ft as RouteMcpConfig, g as ArcInternalMetadata, gt as ControllerLike, h as ResourceMetadata, ht as ControllerHandler, i as ValidationResult, it as RateLimitConfig, j as ArcDecorator, k as IntrospectionPluginOptions, l as TypedRepository, lt as ResourceHooks, m as RegistryStats, mt as RouteSchemaOptions, n as ConfigError, nt as PresetHook, o as InferDocType, ot as ResourceCacheConfig, p as RegistryEntry, pt as RouteMethod, q as CrudController, qt as ApiResponse, r as ValidateOptions, rt as PresetResult, s as InferResourceDoc, st as ResourceConfig, t as RouteHandlerMethod, tt as PresetFunction, u as TypedResourceConfig, ut as ResourcePermissions, v as LookupOption, vt as IController, w as ServiceContext, x as PopulateOption, xt as RouteHandler, y as OwnershipCheck, yt as IControllerResponse } from "../index-CHNQIhcb.mjs";
|
|
2
|
+
import { i as RequestScope } from "../types-LNebCoJx.mjs";
|
|
3
|
+
import { c as PermissionCheck, d as UserBase, l as PermissionContext, u as PermissionResult } from "../fields-C7ahdGYf.mjs";
|
|
4
|
+
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-xGUBq6p_.mjs";
|
|
5
|
+
export type { ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ApiResponse, ArcDecorator, ArcFieldRule, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, BaseControllerOptions, ConfigError, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRouteKey, CrudRouterOptions, CrudSchemas, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, LookupOption, MiddlewareConfig, MiddlewareHandler, ObjectId, OnTenantDeleteConfig, OpenApiSchemas, OwnershipCheck, PaginationResult, ParsedQuery, PermissionCheck, PermissionContext, PermissionResult, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryParserInterface, RateLimitConfig, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResolvedTenantPurge, ResourceCacheConfig, ResourceConfig, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, RouteDefinition, RouteHandler, RouteHandlerMethod, RouteMcpConfig, RouteMethod, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult };
|
package/dist/types/storage.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-
|
|
1
|
+
import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-Co_PQpeQ.mjs";
|
|
2
2
|
export { Storage, StorageContext, StorageFile, StorageReadRange, StorageReadResult, StorageUploadInput };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { Ht as Authenticator } from "./index-
|
|
2
|
-
import { r as CacheStore } from "./interface-
|
|
3
|
-
import { n as ElevationOptions } from "./elevation-
|
|
4
|
-
import { a as EventTransport } from "./EventTransport-
|
|
5
|
-
import { t as ExternalOpenApiPaths } from "./externalPaths-
|
|
6
|
-
import { r as QueryCachePluginOptions } from "./queryCachePlugin-
|
|
7
|
-
import { t as EventPluginOptions } from "./eventPlugin-
|
|
8
|
-
import { _ as HealthOptions, f as CachingOptions, l as SSEOptions, o as MetricsOptions, t as VersioningOptions } from "./versioning-
|
|
9
|
-
import { t as ErrorHandlerOptions } from "./errorHandler-
|
|
10
|
-
import { r as IdempotencyStore } from "./interface-
|
|
1
|
+
import { Ht as Authenticator } from "./index-CHNQIhcb.mjs";
|
|
2
|
+
import { r as CacheStore } from "./interface-C1_WLTMK.mjs";
|
|
3
|
+
import { n as ElevationOptions } from "./elevation-xGUBq6p_.mjs";
|
|
4
|
+
import { a as EventTransport } from "./EventTransport-IEn7Tn-Q.mjs";
|
|
5
|
+
import { t as ExternalOpenApiPaths } from "./externalPaths-BE6wFpYv.mjs";
|
|
6
|
+
import { r as QueryCachePluginOptions } from "./queryCachePlugin-xzFyKAjT.mjs";
|
|
7
|
+
import { t as EventPluginOptions } from "./eventPlugin-DbBFd3x_.mjs";
|
|
8
|
+
import { _ as HealthOptions, f as CachingOptions, l as SSEOptions, o as MetricsOptions, t as VersioningOptions } from "./versioning-D_eBCfNr.mjs";
|
|
9
|
+
import { t as ErrorHandlerOptions } from "./errorHandler-BtUUDPEa.mjs";
|
|
10
|
+
import { r as IdempotencyStore } from "./interface-Uk8ONJv7.mjs";
|
|
11
11
|
import { FastifyInstance, FastifyPluginAsync, FastifyReply, FastifyRequest, FastifyServerOptions } from "fastify";
|
|
12
12
|
|
|
13
13
|
//#region src/factory/loadResources.d.ts
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Kt as AnyRecord, S as QueryParserInterface, Zt as UserLike, b as ParsedQuery, et as OpenApiSchemas, st as ResourceConfig } from "../index-
|
|
2
|
-
import { n as ErrorMapper } from "../errorHandler-
|
|
3
|
-
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-
|
|
1
|
+
import { Kt as AnyRecord, S as QueryParserInterface, Zt as UserLike, b as ParsedQuery, et as OpenApiSchemas, st as ResourceConfig } from "../index-CHNQIhcb.mjs";
|
|
2
|
+
import { n as ErrorMapper } from "../errorHandler-BtUUDPEa.mjs";
|
|
3
|
+
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-DOHkjQlD.mjs";
|
|
4
4
|
import { errorContractSchema, errorDetailSchema } from "@classytic/repo-core/errors";
|
|
5
5
|
import { FastifyInstance, FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
|
|
6
6
|
|
|
@@ -1321,6 +1321,44 @@ interface PipeUIMessageStreamOptions {
|
|
|
1321
1321
|
* ```
|
|
1322
1322
|
*/
|
|
1323
1323
|
declare function pipeUIMessageStreamToReply(reply: FastifyReply, stream: ReadableStream<unknown>, options?: PipeUIMessageStreamOptions): Promise<void>;
|
|
1324
|
+
/**
|
|
1325
|
+
* Promote a stream auth token from the query string into the `Authorization`
|
|
1326
|
+
* header, in place, so the standard `fastify.authenticate` decorator can read it.
|
|
1327
|
+
*
|
|
1328
|
+
* Why: the browser `EventSource` (and `WebSocket`) API **cannot set request
|
|
1329
|
+
* headers** — there is no header channel on the constructor. So arc-next's
|
|
1330
|
+
* `buildStreamUrl` (bearer mode) appends the token as `?token=<jwt>` on stream
|
|
1331
|
+
* URLs. Server auth reads the `Authorization` header, so without this promotion
|
|
1332
|
+
* EVERY browser SSE/WS stream is 401 in bearer mode (cookie mode is unaffected —
|
|
1333
|
+
* arc-next omits the query token there and relies on the cookie).
|
|
1334
|
+
*
|
|
1335
|
+
* Safe by construction:
|
|
1336
|
+
* - No-op when an `Authorization` header is already present → normal `fetch`
|
|
1337
|
+
* requests (which send the header) are never touched.
|
|
1338
|
+
* - The token still goes through full authentication downstream, so a forged or
|
|
1339
|
+
* stale value simply 401s. This only relocates WHERE the bearer is read from;
|
|
1340
|
+
* it grants no trust on its own.
|
|
1341
|
+
*
|
|
1342
|
+
* Parsed from `request.raw.url` (not `request.query`) so it's robust to route
|
|
1343
|
+
* querystring schemas that would otherwise strip an undeclared `token` param.
|
|
1344
|
+
*
|
|
1345
|
+
* @param queryParam name of the query parameter carrying the token (default `token`).
|
|
1346
|
+
*/
|
|
1347
|
+
declare function promoteStreamTokenToHeader(request: FastifyRequest, queryParam?: string): void;
|
|
1348
|
+
/**
|
|
1349
|
+
* Collect the CORS / `Vary` headers a plugin (e.g. `@fastify/cors`, whose default
|
|
1350
|
+
* `onRequest` hook runs BEFORE the route handler) has already set on the reply, so
|
|
1351
|
+
* a hijacked SSE handler that writes straight to `reply.raw.writeHead(...)` can
|
|
1352
|
+
* merge them onto the raw response.
|
|
1353
|
+
*
|
|
1354
|
+
* Why: `reply.hijack()` + `reply.raw.writeHead()` bypass Fastify's `onSend`
|
|
1355
|
+
* serialization, which is where reply-level headers reach the wire. A cross-origin
|
|
1356
|
+
* `EventSource` therefore receives no `Access-Control-Allow-Origin` and the browser
|
|
1357
|
+
* blocks the (authenticated) stream. Re-emitting the already-computed CORS headers
|
|
1358
|
+
* honors the host's configured policy (origin allowlist, credentials) rather than
|
|
1359
|
+
* re-deriving it. Returns lowercased header names suitable for `writeHead`.
|
|
1360
|
+
*/
|
|
1361
|
+
declare function forwardedStreamHeaders(reply: FastifyReply): Record<string, string>;
|
|
1324
1362
|
/**
|
|
1325
1363
|
* Heuristic — does this value look like a Web `ReadableStream`?
|
|
1326
1364
|
*
|
|
@@ -1361,4 +1399,4 @@ declare function hasEvents(instance: FastifyInstance): instance is FastifyInstan
|
|
|
1361
1399
|
*/
|
|
1362
1400
|
declare function getUserId(user: UserLike | null | undefined): string | undefined;
|
|
1363
1401
|
//#endregion
|
|
1364
|
-
export { ArcError, ArcQueryParser, type ArcQueryParserOptions, CircuitBreaker, CircuitBreakerError, type CircuitBreakerOptions, CircuitBreakerRegistry, type CircuitBreakerStats, CircuitState, type CompensationDefinition, type CompensationError, type CompensationHooks, type CompensationResult, type CompensationStep, type ConfigError, ConflictError, type ErrorOptions, type EventsDecorator, ForbiddenError, type Guard, type GuardConfig, type JsonSchema, type JsonSchemaTarget, NotFoundError, OrgAccessDeniedError, OrgRequiredError, type PipeUIMessageStreamOptions, RateLimitError, ServiceUnavailableError, type StateMachine, type TransitionConfig, UI_MESSAGE_STREAM_HEADERS, UnauthorizedError, type ValidateOptions, ValidationError, type ValidationResult, aggregateListResponse, assertValidConfig, bareListResponse, convertOpenApiSchemas, convertRouteSchema, createCircuitBreaker, createCircuitBreakerRegistry, createDomainError, createError, createQueryParser, createStateMachine, defineCompensation, defineErrorMapper, defineGuard, deleteResponse, errorContractSchema, errorDetailSchema, formatValidationErrors, getDefaultCrudSchemas, getListQueryParams, getUserId, handleRaw, hasEvents, isArcError, isJsonSchema, isReadableStream, isZodSchema, keysetListResponse, listResponse, offsetListResponse, paginationSchema, pipeUIMessageStreamToReply, queryParams, responses, scheduleBackground, simpleEqualityMatcher, toJsonSchema, validateResourceConfig, withCompensation };
|
|
1402
|
+
export { ArcError, ArcQueryParser, type ArcQueryParserOptions, CircuitBreaker, CircuitBreakerError, type CircuitBreakerOptions, CircuitBreakerRegistry, type CircuitBreakerStats, CircuitState, type CompensationDefinition, type CompensationError, type CompensationHooks, type CompensationResult, type CompensationStep, type ConfigError, ConflictError, type ErrorOptions, type EventsDecorator, ForbiddenError, type Guard, type GuardConfig, type JsonSchema, type JsonSchemaTarget, NotFoundError, OrgAccessDeniedError, OrgRequiredError, type PipeUIMessageStreamOptions, RateLimitError, ServiceUnavailableError, type StateMachine, type TransitionConfig, UI_MESSAGE_STREAM_HEADERS, UnauthorizedError, type ValidateOptions, ValidationError, type ValidationResult, aggregateListResponse, assertValidConfig, bareListResponse, convertOpenApiSchemas, convertRouteSchema, createCircuitBreaker, createCircuitBreakerRegistry, createDomainError, createError, createQueryParser, createStateMachine, defineCompensation, defineErrorMapper, defineGuard, deleteResponse, errorContractSchema, errorDetailSchema, formatValidationErrors, forwardedStreamHeaders, getDefaultCrudSchemas, getListQueryParams, getUserId, handleRaw, hasEvents, isArcError, isJsonSchema, isReadableStream, isZodSchema, keysetListResponse, listResponse, offsetListResponse, paginationSchema, pipeUIMessageStreamToReply, promoteStreamTokenToHeader, queryParams, responses, scheduleBackground, simpleEqualityMatcher, toJsonSchema, validateResourceConfig, withCompensation };
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
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-
|
|
2
|
-
import { A as
|
|
3
|
-
import { a as toJsonSchema, i as isZodSchema, n as convertRouteSchema, r as isJsonSchema, t as convertOpenApiSchemas } from "../schemaConverter-
|
|
4
|
-
import { t as
|
|
5
|
-
|
|
1
|
+
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-DkO8Nk6-.mjs";
|
|
2
|
+
import { A as createQueryParser, C as keysetListResponse, D as queryParams, E as paginationSchema, M as scheduleBackground, N as simpleEqualityMatcher, O as responses, S as getListQueryParams, T as offsetListResponse, _ as bareListResponse, a as defineCompensation, b as errorDetailSchema, c as CircuitBreakerError, d as createCircuitBreaker, f as createCircuitBreakerRegistry, g as aggregateListResponse, h as validateResourceConfig, i as defineErrorMapper, j as getUserId, k as ArcQueryParser, l as CircuitBreakerRegistry, m as formatValidationErrors, n as handleRaw, o as withCompensation, p as assertValidConfig, r as defineGuard, s as CircuitBreaker, t as createStateMachine, u as CircuitState, v as deleteResponse, w as listResponse, x as getDefaultCrudSchemas, y as errorContractSchema } from "../utils-C6QQ9-hd.mjs";
|
|
3
|
+
import { a as toJsonSchema, i as isZodSchema, n as convertRouteSchema, r as isJsonSchema, t as convertOpenApiSchemas } from "../schemaConverter-U0MnO9vd.mjs";
|
|
4
|
+
import { a as promoteStreamTokenToHeader, i as pipeUIMessageStreamToReply, n as forwardedStreamHeaders, r as isReadableStream, t as UI_MESSAGE_STREAM_HEADERS } from "../streaming-BQcW6_Kq.mjs";
|
|
5
|
+
import { t as hasEvents } from "../typeGuards-C9KXUly6.mjs";
|
|
6
|
+
export { ArcError, ArcQueryParser, CircuitBreaker, CircuitBreakerError, CircuitBreakerRegistry, CircuitState, ConflictError, ForbiddenError, NotFoundError, OrgAccessDeniedError, OrgRequiredError, RateLimitError, ServiceUnavailableError, UI_MESSAGE_STREAM_HEADERS, UnauthorizedError, ValidationError, aggregateListResponse, assertValidConfig, bareListResponse, convertOpenApiSchemas, convertRouteSchema, createCircuitBreaker, createCircuitBreakerRegistry, createDomainError, createError, createQueryParser, createStateMachine, defineCompensation, defineErrorMapper, defineGuard, deleteResponse, errorContractSchema, errorDetailSchema, formatValidationErrors, forwardedStreamHeaders, getDefaultCrudSchemas, getListQueryParams, getUserId, handleRaw, hasEvents, isArcError, isJsonSchema, isReadableStream, isZodSchema, keysetListResponse, listResponse, offsetListResponse, paginationSchema, pipeUIMessageStreamToReply, promoteStreamTokenToHeader, queryParams, responses, scheduleBackground, simpleEqualityMatcher, toJsonSchema, validateResourceConfig, withCompensation };
|