@classytic/arc 2.11.3 → 2.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -18
- package/dist/{BaseController-swXruJ2_.mjs → BaseController-DX_T-bDB.mjs} +388 -423
- package/dist/EventTransport-CT_52aWU.d.mts +34 -0
- package/dist/EventTransport-DLWoUMHy.mjs +103 -0
- package/dist/{QueryCache-DOBNHBE0.d.mts → QueryCache-D41bfdBB.d.mts} +1 -1
- package/dist/{ResourceRegistry-DkAeAuTX.mjs → ResourceRegistry-CTERg_2x.mjs} +139 -66
- package/dist/audit/index.d.mts +2 -2
- package/dist/audit/index.mjs +1 -1
- package/dist/auth/audit.d.mts +199 -0
- package/dist/auth/audit.mjs +288 -0
- package/dist/auth/index.d.mts +5 -5
- package/dist/auth/index.mjs +117 -191
- package/dist/auth/redis-session.d.mts +1 -1
- package/dist/{betterAuthOpenApi-DwxtK3uG.mjs → betterAuthOpenApi--M_i87dQ.mjs} +1 -1
- package/dist/buildHandler-olo-gt94.mjs +610 -0
- package/dist/cache/index.d.mts +3 -3
- package/dist/cache/index.mjs +3 -3
- package/dist/cli/commands/describe.d.mts +89 -13
- package/dist/cli/commands/describe.mjs +56 -2
- package/dist/cli/commands/docs.mjs +2 -2
- package/dist/cli/commands/generate.mjs +147 -48
- package/dist/cli/commands/init.d.mts +13 -0
- package/dist/cli/commands/init.mjs +237 -112
- package/dist/cli/commands/introspect.mjs +8 -1
- package/dist/context/index.mjs +1 -1
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +5 -5
- package/dist/core-D72ia0EH.mjs +1399 -0
- package/dist/{createActionRouter-u3ql2EDo.mjs → createActionRouter-CEvzKcy8.mjs} +7 -20
- package/dist/createAggregationRouter-CyecOxnO.mjs +114 -0
- package/dist/{createApp-BFxtdKy6.mjs → createApp-XX2-N0Yd.mjs} +31 -27
- package/dist/defineEvent-D5h7EvAx.mjs +188 -0
- package/dist/docs/index.d.mts +2 -2
- package/dist/docs/index.mjs +2 -2
- package/dist/{elevation-DOFoxoDs.mjs → elevation-DgoeTyfX.mjs} +1 -1
- package/dist/errorHandler-Bk-AGhkU.mjs +174 -0
- package/dist/errorHandler-DFr45ZG4.d.mts +45 -0
- package/dist/errors-j4aJm1Wg.mjs +184 -0
- package/dist/{eventPlugin-KrFIQ097.mjs → eventPlugin-CaKTYkYM.mjs} +35 -137
- package/dist/{eventPlugin-CUNjYYRY.d.mts → eventPlugin-qXpqTebY.d.mts} +57 -7
- package/dist/events/index.d.mts +164 -5
- package/dist/events/index.mjs +133 -209
- package/dist/events/transports/redis-stream-entry.d.mts +1 -1
- package/dist/events/transports/redis-stream-entry.mjs +204 -31
- package/dist/events/transports/redis.d.mts +1 -1
- package/dist/factory/index.d.mts +2 -2
- package/dist/factory/index.mjs +2 -2
- package/dist/{fields-C8Y0XLAu.d.mts → fields-COhcH3fk.d.mts} +23 -2
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/idempotency/index.d.mts +3 -3
- package/dist/idempotency/index.mjs +1 -20
- package/dist/idempotency/redis.d.mts +1 -1
- package/dist/idempotency/redis.mjs +1 -1
- package/dist/{index-BYCqHCVu.d.mts → index-BTqLEvhu.d.mts} +164 -4
- package/dist/{index-6u4_Gg6G.d.mts → index-BtW7qYwa.d.mts} +661 -281
- package/dist/{index-BdXnTPRj.d.mts → index-Ds61mrJE.d.mts} +50 -4
- package/dist/{index-DdQ3O9Pg.d.mts → index-Dz5IKsrE.d.mts} +360 -219
- package/dist/index.d.mts +6 -7
- package/dist/index.mjs +9 -10
- package/dist/integrations/event-gateway.d.mts +2 -2
- package/dist/integrations/event-gateway.mjs +1 -1
- package/dist/integrations/index.d.mts +2 -2
- package/dist/integrations/mcp/index.d.mts +2 -2
- 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.d.mts +60 -11
- package/dist/integrations/streamline.mjs +75 -85
- package/dist/integrations/websocket-redis.d.mts +1 -1
- package/dist/integrations/websocket.d.mts +1 -1
- package/dist/integrations/websocket.mjs +2 -8
- package/dist/middleware/index.d.mts +1 -1
- package/dist/middleware/index.mjs +2 -2
- package/dist/migrations/index.d.mts +23 -3
- package/dist/migrations/index.mjs +0 -7
- package/dist/{multipartBody-CvTR1Un6.mjs → multipartBody-BOvVSVCD.mjs} +11 -8
- package/dist/{openapi-BGUn7Ki1.mjs → openapi-CiOMVW1p.mjs} +143 -13
- package/dist/org/index.d.mts +2 -2
- package/dist/org/index.mjs +1 -1
- package/dist/permissions/index.d.mts +3 -3
- package/dist/permissions/index.mjs +3 -3
- package/dist/{permissions-gd_aUWrR.mjs → permissions-ohQyv50e.mjs} +404 -176
- package/dist/{pipe-DVoIheVC.mjs → pipe-Zr0KXjQe.mjs} +1 -1
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/pipeline/index.mjs +1 -1
- package/dist/plugins/index.d.mts +18 -33
- package/dist/plugins/index.mjs +33 -13
- 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 +5 -5
- package/dist/presets/filesUpload.mjs +6 -9
- 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 +6 -8
- package/dist/{presets-Z7P5w4gF.mjs → presets-BbkjdPeH.mjs} +6 -28
- package/dist/{queryCachePlugin-BUXBSm4F.d.mts → queryCachePlugin-CqMdLI2-.d.mts} +2 -2
- package/dist/{queryCachePlugin-Bq6bO6vc.mjs → queryCachePlugin-m1XsgAIJ.mjs} +3 -3
- package/dist/{redis-Cm1gnRDf.d.mts → redis-DiMkdHEl.d.mts} +1 -1
- package/dist/redis-stream-D6HzR1Z_.d.mts +232 -0
- package/dist/registry/index.d.mts +1 -1
- package/dist/registry/index.mjs +2 -2
- package/dist/{replyHelpers-ByllIXXV.mjs → replyHelpers-CK-FNO8E.mjs} +3 -21
- package/dist/{resourceToTools-ByZpgjeH.mjs → resourceToTools-C5coh64w.mjs} +224 -71
- package/dist/{routerShared-BqLRb5l7.mjs → routerShared-D6_fEGHh.mjs} +40 -36
- package/dist/{schemaIR-BlG9bY7v.mjs → schemaIR-7Vl611Qs.mjs} +1 -1
- package/dist/schemas/index.d.mts +100 -30
- package/dist/schemas/index.mjs +86 -29
- package/dist/scim/index.d.mts +264 -0
- package/dist/scim/index.mjs +963 -0
- package/dist/scope/index.d.mts +3 -3
- package/dist/scope/index.mjs +4 -4
- package/dist/{sse-V7aXc3bW.mjs → sse-Bz-5ZeTt.mjs} +1 -1
- package/dist/{store-helpers-BhrzxvyQ.mjs → store-helpers-BkIN9-vu.mjs} +1 -1
- package/dist/testing/index.d.mts +2 -8
- package/dist/testing/index.mjs +16 -24
- package/dist/testing/storageContract.d.mts +1 -1
- package/dist/types/index.d.mts +4 -4
- package/dist/types/storage.d.mts +1 -1
- package/dist/{types-BH7dEGvU.d.mts → types-BvqwCCSx.d.mts} +77 -29
- package/dist/{types-tgR4Pt8F.d.mts → types-CTYvcwHe.d.mts} +195 -1
- package/dist/{types-AOD8fxIw.mjs → types-C_s5moIu.mjs} +117 -1
- package/dist/{types-9beEMe25.d.mts → types-DQHFc8PM.d.mts} +1 -1
- package/dist/utils/index.d.mts +2 -2
- package/dist/utils/index.mjs +5 -5
- package/dist/{utils-CcYTj09l.mjs → utils-_h9B3c57.mjs} +1269 -1334
- package/dist/{versioning-M9lNLhO8.d.mts → versioning-DTTvc80y.d.mts} +1 -1
- package/package.json +24 -34
- package/skills/arc/SKILL.md +521 -785
- package/skills/arc/references/agent-auth.md +238 -0
- package/skills/arc/references/api-reference.md +187 -0
- package/skills/arc/references/auth.md +354 -7
- package/skills/arc/references/enterprise-auth.md +94 -0
- package/skills/arc/references/events.md +8 -6
- package/skills/arc/references/mcp.md +2 -2
- package/skills/arc/references/multi-tenancy.md +11 -2
- package/skills/arc/references/production.md +10 -9
- package/skills/arc/references/scim.md +247 -0
- package/skills/arc/references/testing.md +1 -1
- package/skills/arc-code-review/SKILL.md +141 -0
- package/skills/arc-code-review/references/anti-patterns.md +911 -0
- package/skills/arc-code-review/references/arc-cheatsheet.md +380 -0
- package/skills/arc-code-review/references/migration-recipes.md +700 -0
- package/skills/arc-code-review/references/mongokit-migration.md +386 -0
- package/skills/arc-code-review/references/scaffolding.md +230 -0
- package/skills/arc-code-review/references/severity.md +127 -0
- package/dist/EventTransport-CfVEGaEl.d.mts +0 -293
- package/dist/adapters/index.d.mts +0 -3
- package/dist/adapters/index.mjs +0 -2
- package/dist/adapters-D0tT2Tyo.mjs +0 -949
- package/dist/auth/mongoose.d.mts +0 -191
- package/dist/auth/mongoose.mjs +0 -73
- package/dist/core-DnUsRpuX.mjs +0 -1049
- package/dist/errorHandler-BQm8ZxTK.mjs +0 -173
- package/dist/errorHandler-Co3lnVmJ.d.mts +0 -114
- package/dist/errors-D5c-5BJL.mjs +0 -232
- package/dist/index-BbMrcvGp.d.mts +0 -362
- package/dist/redis-stream-CM8TXTix.d.mts +0 -110
- /package/dist/{HookSystem-CGsMd6oK.mjs → HookSystem-Iiebom92.mjs} +0 -0
- /package/dist/{actionPermissions-sUUKDhtP.mjs → actionPermissions-CyUkQu6O.mjs} +0 -0
- /package/dist/{caching-CheW3m-S.mjs → caching-SM8gghN6.mjs} +0 -0
- /package/dist/{constants-BhY1OHoH.mjs → constants-Cxde4rpC.mjs} +0 -0
- /package/dist/{elevation-s5ykdNHr.d.mts → elevation-BXOWoGCF.d.mts} +0 -0
- /package/dist/{externalPaths-Bapitwvd.d.mts → externalPaths-BD5nw6St.d.mts} +0 -0
- /package/dist/{interface-CkkWm5uR.d.mts → interface-DfLGcus7.d.mts} +0 -0
- /package/dist/{interface-Da0r7Lna.d.mts → interface-beEtJyWM.d.mts} +0 -0
- /package/dist/{keys-CARyUjiR.mjs → keys-CGcCbNyu.mjs} +0 -0
- /package/dist/{loadResources-CPpkyKfM.mjs → loadResources-DBMQg_Aj.mjs} +0 -0
- /package/dist/{memory-DikHSvWa.mjs → memory-UBydS5ku.mjs} +0 -0
- /package/dist/{metrics-Csh4nsvv.mjs → metrics-Qnvwc-LQ.mjs} +0 -0
- /package/dist/{pluralize-BneOJkpi.mjs → pluralize-DQgqgifU.mjs} +0 -0
- /package/dist/{registry-D63ee7fl.mjs → registry-I-ogLgL9.mjs} +0 -0
- /package/dist/{requestContext-C5XeK3VA.mjs → requestContext-SSaaTgW8.mjs} +0 -0
- /package/dist/{schemaConverter-B0oKLuqI.mjs → schemaConverter-De34B1ZG.mjs} +0 -0
- /package/dist/{sessionManager-D-oNWHz3.d.mts → sessionManager-C4Le_UB3.d.mts} +0 -0
- /package/dist/{storage-BwGQXUpd.d.mts → storage-Dfzt4VTl.d.mts} +0 -0
- /package/dist/{tracing-DokiEsuz.d.mts → tracing-QJVprktp.d.mts} +0 -0
- /package/dist/{typeGuards-CcFZXgU7.mjs → typeGuards-BzkXkvVv.mjs} +0 -0
- /package/dist/{types-DV9WDfeg.mjs → types-D57iXYb8.mjs} +0 -0
- /package/dist/{versioning-CGPjkqAg.mjs → versioning-BUrT5aP4.mjs} +0 -0
- /package/dist/{websocket-CyJ1VIFI.d.mts → websocket-ChC2rqe1.d.mts} +0 -0
|
@@ -1,362 +0,0 @@
|
|
|
1
|
-
import { $ as OpenApiSchemas, Dn as AdapterSchemaContext, Mn as SchemaMetadata, Nn as ValidationResult, On as DataAdapter, S as QueryParserInterface, b as ParsedQuery, ft as RouteSchemaOptions, jn as RepositoryLike } from "./index-6u4_Gg6G.mjs";
|
|
2
|
-
import { StandardRepo } from "@classytic/repo-core/repository";
|
|
3
|
-
import { Model } from "mongoose";
|
|
4
|
-
|
|
5
|
-
//#region src/adapters/drizzle.d.ts
|
|
6
|
-
/**
|
|
7
|
-
* Minimum shape arc needs from a Drizzle column. Every SQLite, PG, and MySQL
|
|
8
|
-
* column in `drizzle-orm` exposes these via `getTableColumns(table)`. Held
|
|
9
|
-
* structurally so arc doesn't depend on `drizzle-orm` types.
|
|
10
|
-
*/
|
|
11
|
-
interface DrizzleColumnLike {
|
|
12
|
-
columnType?: string;
|
|
13
|
-
dataType?: "number" | "string" | "date" | "boolean" | "json" | "buffer" | "bigint" | "custom";
|
|
14
|
-
notNull?: boolean;
|
|
15
|
-
hasDefault?: boolean;
|
|
16
|
-
primary?: boolean;
|
|
17
|
-
enumValues?: readonly string[];
|
|
18
|
-
length?: number;
|
|
19
|
-
name?: string;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Structural Drizzle table — only requires `[Symbol.for('drizzle:Columns')]`,
|
|
23
|
-
* which every Drizzle table exposes. Matches `drizzle-orm`'s `Table` at
|
|
24
|
-
* runtime without importing it at compile time.
|
|
25
|
-
*/
|
|
26
|
-
type DrizzleTableLike = Record<symbol, Record<string, DrizzleColumnLike>> & {
|
|
27
|
-
[key: string]: unknown;
|
|
28
|
-
};
|
|
29
|
-
interface DrizzleAdapterOptions<TDoc = unknown> {
|
|
30
|
-
/** Drizzle table — used for schema introspection. */
|
|
31
|
-
table: DrizzleTableLike;
|
|
32
|
-
/** Repository implementing the repo-core contract. */
|
|
33
|
-
repository: RepositoryLike<TDoc>;
|
|
34
|
-
/**
|
|
35
|
-
* External schema generator. When provided, replaces the built-in
|
|
36
|
-
* type-only conversion. Wire it to your kit's `buildCrudSchemasFromTable`
|
|
37
|
-
* (sqlitekit, pgkit, ...) to get the full CRUD schemas — strict
|
|
38
|
-
* additional-property control, field-rule application, param-type
|
|
39
|
-
* narrowing from primary-key columns, etc.
|
|
40
|
-
*/
|
|
41
|
-
schemaGenerator?: (table: DrizzleTableLike, options?: RouteSchemaOptions, context?: AdapterSchemaContext) => OpenApiSchemas | Record<string, unknown>;
|
|
42
|
-
/** Optional name — defaults to "DrizzleAdapter". */
|
|
43
|
-
name?: string;
|
|
44
|
-
}
|
|
45
|
-
declare class DrizzleAdapter<TDoc = unknown> implements DataAdapter<TDoc> {
|
|
46
|
-
readonly type: "drizzle";
|
|
47
|
-
readonly name: string;
|
|
48
|
-
readonly table: DrizzleTableLike;
|
|
49
|
-
readonly repository: RepositoryLike<TDoc>;
|
|
50
|
-
private readonly schemaGenerator?;
|
|
51
|
-
constructor(options: DrizzleAdapterOptions<TDoc>);
|
|
52
|
-
/**
|
|
53
|
-
* Introspect Drizzle columns into arc's schema metadata shape.
|
|
54
|
-
*/
|
|
55
|
-
getSchemaMetadata(): SchemaMetadata;
|
|
56
|
-
/**
|
|
57
|
-
* Generate OpenAPI schemas. Delegates to the user-provided
|
|
58
|
-
* `schemaGenerator` when available (strongly recommended — that's where
|
|
59
|
-
* field rules, omit lists, and param-type narrowing live). The built-in
|
|
60
|
-
* fallback emits a permissive entity + CRUD body shape so routes still
|
|
61
|
-
* register when no generator is provided.
|
|
62
|
-
*
|
|
63
|
-
* After the kit generator runs, arc merges constraint-style field rules
|
|
64
|
-
* (`minLength`, `maxLength`, `min`, `max`, `pattern`, `enum`, `description`)
|
|
65
|
-
* into the resulting property schemas so sqlitekit / pgkit behave
|
|
66
|
-
* identically to mongoose here — rule-driven AJV constraints apply
|
|
67
|
-
* regardless of backend.
|
|
68
|
-
*/
|
|
69
|
-
generateSchemas(schemaOptions?: RouteSchemaOptions, context?: AdapterSchemaContext): OpenApiSchemas | Record<string, unknown> | null;
|
|
70
|
-
healthCheck(): Promise<boolean>;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Factory — preferred construction style for symmetry with
|
|
74
|
-
* `createMongooseAdapter` / `createPrismaAdapter`.
|
|
75
|
-
*/
|
|
76
|
-
declare function createDrizzleAdapter<TDoc = unknown>(options: DrizzleAdapterOptions<TDoc>): DrizzleAdapter<TDoc>;
|
|
77
|
-
//#endregion
|
|
78
|
-
//#region src/adapters/mongoose.d.ts
|
|
79
|
-
/**
|
|
80
|
-
* Options for creating a Mongoose adapter.
|
|
81
|
-
* TDoc is auto-inferred from the Mongoose model — no explicit type needed.
|
|
82
|
-
*
|
|
83
|
-
* @typeParam TDoc - Inferred from `model: Model<TDoc>`
|
|
84
|
-
*/
|
|
85
|
-
interface MongooseAdapterOptions<TDoc = unknown> {
|
|
86
|
-
/** Mongoose model instance — preserves document type for type safety */
|
|
87
|
-
model: Model<TDoc>;
|
|
88
|
-
/** Repository implementing CRUD operations - accepts any repository-like object */
|
|
89
|
-
repository: RepositoryLike<TDoc>;
|
|
90
|
-
/**
|
|
91
|
-
* External schema generator plugin for OpenAPI docs.
|
|
92
|
-
* When provided, replaces the built-in basic type conversion.
|
|
93
|
-
* Receives the Mongoose model and schema options, must return OpenApiSchemas.
|
|
94
|
-
*
|
|
95
|
-
* **Model type is intentionally `Model<unknown>`, not `Model<TDoc>`**:
|
|
96
|
-
* schema generators introspect `.schema.paths` — they read metadata, not
|
|
97
|
-
* document types. Typing as `Model<TDoc>` forced every mongokit host to
|
|
98
|
-
* cast `m as unknown as Model<unknown>` when handing the model to
|
|
99
|
-
* `buildCrudSchemasFromModel` (which is typed `Model<unknown>`), because
|
|
100
|
-
* `Model<T>` is invariant in T. Widening here at the callback boundary
|
|
101
|
-
* trades one documented internal cast for zero host-side casts.
|
|
102
|
-
*
|
|
103
|
-
* @example MongoKit integration — direct pass-through, no casts
|
|
104
|
-
* ```typescript
|
|
105
|
-
* import { buildCrudSchemasFromModel } from '@classytic/mongokit';
|
|
106
|
-
*
|
|
107
|
-
* createMongooseAdapter({
|
|
108
|
-
* model: JobModel,
|
|
109
|
-
* repository: jobRepository,
|
|
110
|
-
* schemaGenerator: buildCrudSchemasFromModel,
|
|
111
|
-
* });
|
|
112
|
-
* ```
|
|
113
|
-
*/
|
|
114
|
-
schemaGenerator?: (model: Model<unknown>, options?: RouteSchemaOptions, context?: AdapterSchemaContext) => OpenApiSchemas | Record<string, unknown>;
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Mongoose data adapter with proper type safety
|
|
118
|
-
*
|
|
119
|
-
* @typeParam TDoc - The document type
|
|
120
|
-
*/
|
|
121
|
-
declare class MongooseAdapter<TDoc = unknown> implements DataAdapter<TDoc> {
|
|
122
|
-
readonly type: "mongoose";
|
|
123
|
-
readonly name: string;
|
|
124
|
-
readonly model: Model<TDoc>;
|
|
125
|
-
readonly repository: RepositoryLike<TDoc>;
|
|
126
|
-
private readonly schemaGenerator?;
|
|
127
|
-
constructor(options: MongooseAdapterOptions<TDoc>);
|
|
128
|
-
/**
|
|
129
|
-
* Get schema metadata from Mongoose model
|
|
130
|
-
*/
|
|
131
|
-
getSchemaMetadata(): SchemaMetadata;
|
|
132
|
-
/**
|
|
133
|
-
* Generate OpenAPI schemas from Mongoose model.
|
|
134
|
-
*
|
|
135
|
-
* If a `schemaGenerator` plugin was provided (e.g. MongoKit's buildCrudSchemasFromModel),
|
|
136
|
-
* it is used instead of the built-in basic conversion.
|
|
137
|
-
*/
|
|
138
|
-
generateSchemas(schemaOptions?: RouteSchemaOptions, context?: AdapterSchemaContext): OpenApiSchemas | Record<string, unknown> | null;
|
|
139
|
-
/**
|
|
140
|
-
* Extract relation metadata
|
|
141
|
-
*/
|
|
142
|
-
private extractRelations;
|
|
143
|
-
/**
|
|
144
|
-
* Convert Mongoose type to OpenAPI type
|
|
145
|
-
*/
|
|
146
|
-
private mongooseTypeToOpenApi;
|
|
147
|
-
}
|
|
148
|
-
/**
|
|
149
|
-
* Create Mongoose adapter with flexible type acceptance.
|
|
150
|
-
* Accepts any repository with CRUD methods — no `as any` needed.
|
|
151
|
-
*
|
|
152
|
-
* **Type parameter (v2.11):** `TDoc` is UNCONSTRAINED. An earlier v2.11
|
|
153
|
-
* revision added `TDoc extends AnyRecord` to surface errors at the
|
|
154
|
-
* adapter call site, but Mongoose's own document types
|
|
155
|
-
* (`HydratedDocument<T>`, `T & Document`) don't carry an index signature
|
|
156
|
-
* — so the constraint fired on the exact Mongoose idioms this factory
|
|
157
|
-
* is designed to accept. Hosts were casting with
|
|
158
|
-
* `as RepositoryLike<Record<string, unknown>>` at every call just to
|
|
159
|
-
* silence it. The constraint now lives exclusively on `BaseController`
|
|
160
|
-
* where it's load-bearing for mixin composition; `defineResource`
|
|
161
|
-
* widens once internally so every other layer stays permissive.
|
|
162
|
-
*
|
|
163
|
-
* @example
|
|
164
|
-
* ```typescript
|
|
165
|
-
* // Object form (explicit)
|
|
166
|
-
* const adapter = createMongooseAdapter({
|
|
167
|
-
* model: ProductModel,
|
|
168
|
-
* repository: productRepository,
|
|
169
|
-
* });
|
|
170
|
-
*
|
|
171
|
-
* // Shorthand form (2-arg) — most common path
|
|
172
|
-
* const adapter = createMongooseAdapter(ProductModel, productRepository);
|
|
173
|
-
* ```
|
|
174
|
-
*/
|
|
175
|
-
declare function createMongooseAdapter<TDoc = unknown>(model: Model<TDoc>, repository: RepositoryLike<TDoc>): DataAdapter<TDoc>;
|
|
176
|
-
declare function createMongooseAdapter<TDoc = unknown>(options: MongooseAdapterOptions<TDoc>): DataAdapter<TDoc>;
|
|
177
|
-
//#endregion
|
|
178
|
-
//#region src/adapters/prisma.d.ts
|
|
179
|
-
/** Prisma DMMF field shape */
|
|
180
|
-
interface DmmfField {
|
|
181
|
-
name: string;
|
|
182
|
-
type: string;
|
|
183
|
-
kind: string;
|
|
184
|
-
isList: boolean;
|
|
185
|
-
isRequired: boolean;
|
|
186
|
-
isUnique?: boolean;
|
|
187
|
-
isId?: boolean;
|
|
188
|
-
isGenerated?: boolean;
|
|
189
|
-
hasDefaultValue?: boolean;
|
|
190
|
-
default?: unknown;
|
|
191
|
-
documentation?: string;
|
|
192
|
-
relationName?: string;
|
|
193
|
-
}
|
|
194
|
-
/** Prisma DMMF enum value */
|
|
195
|
-
interface DmmfEnumValue {
|
|
196
|
-
name: string;
|
|
197
|
-
}
|
|
198
|
-
/** Prisma DMMF enum */
|
|
199
|
-
interface DmmfEnum {
|
|
200
|
-
name: string;
|
|
201
|
-
values: DmmfEnumValue[];
|
|
202
|
-
}
|
|
203
|
-
/** Prisma DMMF model shape */
|
|
204
|
-
interface DmmfModel {
|
|
205
|
-
name: string;
|
|
206
|
-
fields: DmmfField[];
|
|
207
|
-
uniqueIndexes?: Array<{
|
|
208
|
-
fields: string[];
|
|
209
|
-
}>;
|
|
210
|
-
}
|
|
211
|
-
/** Prisma DMMF datamodel */
|
|
212
|
-
interface DmmfDatamodel {
|
|
213
|
-
models: DmmfModel[];
|
|
214
|
-
enums?: DmmfEnum[];
|
|
215
|
-
}
|
|
216
|
-
/** Prisma DMMF root shape */
|
|
217
|
-
interface PrismaDmmf {
|
|
218
|
-
datamodel?: DmmfDatamodel;
|
|
219
|
-
}
|
|
220
|
-
/** Prisma client shape */
|
|
221
|
-
interface PrismaClientLike {
|
|
222
|
-
$disconnect(): Promise<void>;
|
|
223
|
-
[key: string]: unknown;
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Options for PrismaQueryParser
|
|
227
|
-
*/
|
|
228
|
-
interface PrismaQueryParserOptions {
|
|
229
|
-
/** Maximum allowed limit value (default: 1000) */
|
|
230
|
-
maxLimit?: number;
|
|
231
|
-
/** Default limit for pagination (default: 20) */
|
|
232
|
-
defaultLimit?: number;
|
|
233
|
-
/** Enable soft delete filtering by default (default: true) */
|
|
234
|
-
softDeleteEnabled?: boolean;
|
|
235
|
-
/** Field name for soft delete (default: 'deletedAt') */
|
|
236
|
-
softDeleteField?: string;
|
|
237
|
-
}
|
|
238
|
-
/**
|
|
239
|
-
* Prisma Query Parser - Converts URL parameters to Prisma query format
|
|
240
|
-
*
|
|
241
|
-
* Translates Arc's query format to Prisma's where/orderBy/take/skip structure.
|
|
242
|
-
*
|
|
243
|
-
* @example
|
|
244
|
-
* ```typescript
|
|
245
|
-
* const parser = new PrismaQueryParser();
|
|
246
|
-
*
|
|
247
|
-
* // URL: ?status=active&price[gte]=100&sort=-createdAt&page=2&limit=10
|
|
248
|
-
* const prismaQuery = parser.toPrismaQuery(parsedQuery);
|
|
249
|
-
* // Returns:
|
|
250
|
-
* // {
|
|
251
|
-
* // where: { status: 'active', price: { gte: 100 }, deletedAt: null },
|
|
252
|
-
* // orderBy: { createdAt: 'desc' },
|
|
253
|
-
* // take: 10,
|
|
254
|
-
* // skip: 10,
|
|
255
|
-
* // }
|
|
256
|
-
* ```
|
|
257
|
-
*/
|
|
258
|
-
declare class PrismaQueryParser implements QueryParserInterface {
|
|
259
|
-
private readonly maxLimit;
|
|
260
|
-
private readonly defaultLimit;
|
|
261
|
-
private readonly softDeleteEnabled;
|
|
262
|
-
private readonly softDeleteField;
|
|
263
|
-
/** Map Arc operators to Prisma operators */
|
|
264
|
-
private readonly operatorMap;
|
|
265
|
-
constructor(options?: PrismaQueryParserOptions);
|
|
266
|
-
/**
|
|
267
|
-
* Parse URL query parameters (delegates to ArcQueryParser format)
|
|
268
|
-
*/
|
|
269
|
-
parse(query: Record<string, unknown> | null | undefined): ParsedQuery;
|
|
270
|
-
/**
|
|
271
|
-
* Convert ParsedQuery to Prisma query options
|
|
272
|
-
*/
|
|
273
|
-
toPrismaQuery(parsed: ParsedQuery, policyFilters?: Record<string, unknown>): PrismaQueryOptions;
|
|
274
|
-
/**
|
|
275
|
-
* Translate Arc/MongoDB-style filters to Prisma where clause
|
|
276
|
-
*/
|
|
277
|
-
private translateFilters;
|
|
278
|
-
private parseNumber;
|
|
279
|
-
private parseSort;
|
|
280
|
-
private parseSelect;
|
|
281
|
-
private parseFilters;
|
|
282
|
-
private coerceValue;
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Prisma query options returned by toPrismaQuery
|
|
286
|
-
*/
|
|
287
|
-
interface PrismaQueryOptions {
|
|
288
|
-
where?: Record<string, unknown>;
|
|
289
|
-
orderBy?: Array<Record<string, "asc" | "desc">>;
|
|
290
|
-
take?: number;
|
|
291
|
-
skip?: number;
|
|
292
|
-
select?: Record<string, boolean>;
|
|
293
|
-
include?: Record<string, boolean>;
|
|
294
|
-
}
|
|
295
|
-
interface PrismaAdapterOptions<TModel> {
|
|
296
|
-
/** Prisma client instance */
|
|
297
|
-
client: PrismaClientLike;
|
|
298
|
-
/** Model name (e.g., 'user', 'product') */
|
|
299
|
-
modelName: string;
|
|
300
|
-
/** Repository instance implementing CRUD operations */
|
|
301
|
-
repository: StandardRepo<TModel>;
|
|
302
|
-
/** Optional: Prisma DMMF (Data Model Meta Format) for schema extraction */
|
|
303
|
-
dmmf?: PrismaDmmf;
|
|
304
|
-
/** Optional: Custom query parser (default: PrismaQueryParser) */
|
|
305
|
-
queryParser?: PrismaQueryParser;
|
|
306
|
-
/** Enable soft delete filtering (default: true) */
|
|
307
|
-
softDeleteEnabled?: boolean;
|
|
308
|
-
/** Field name for soft delete (default: 'deletedAt') */
|
|
309
|
-
softDeleteField?: string;
|
|
310
|
-
}
|
|
311
|
-
declare class PrismaAdapter<TModel = unknown> implements DataAdapter<TModel> {
|
|
312
|
-
readonly type: "prisma";
|
|
313
|
-
readonly name: string;
|
|
314
|
-
readonly repository: StandardRepo<TModel>;
|
|
315
|
-
readonly queryParser: PrismaQueryParser;
|
|
316
|
-
private client;
|
|
317
|
-
private modelName;
|
|
318
|
-
private dmmf?;
|
|
319
|
-
private softDeleteEnabled;
|
|
320
|
-
private softDeleteField;
|
|
321
|
-
constructor(options: PrismaAdapterOptions<TModel>);
|
|
322
|
-
/**
|
|
323
|
-
* Parse URL query parameters and convert to Prisma query options
|
|
324
|
-
*/
|
|
325
|
-
parseQuery(query: Record<string, unknown>, policyFilters?: Record<string, unknown>): PrismaQueryOptions;
|
|
326
|
-
/**
|
|
327
|
-
* Apply policy filters to existing Prisma where clause
|
|
328
|
-
* Used for multi-tenant, ownership, and other security filters
|
|
329
|
-
*/
|
|
330
|
-
applyPolicyFilters(where: Record<string, unknown>, policyFilters: Record<string, unknown>): Record<string, unknown>;
|
|
331
|
-
generateSchemas(options?: RouteSchemaOptions): OpenApiSchemas | null;
|
|
332
|
-
getSchemaMetadata(): SchemaMetadata | null;
|
|
333
|
-
validate(data: unknown): Promise<ValidationResult>;
|
|
334
|
-
healthCheck(): Promise<boolean>;
|
|
335
|
-
close(): Promise<void>;
|
|
336
|
-
private buildEntitySchema;
|
|
337
|
-
private buildCreateSchema;
|
|
338
|
-
private buildUpdateSchema;
|
|
339
|
-
private shouldSkipField;
|
|
340
|
-
private convertPrismaFieldToJsonSchema;
|
|
341
|
-
private convertPrismaFieldToMetadata;
|
|
342
|
-
private mapPrismaTypeToMetadataType;
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Factory function to create Prisma adapter
|
|
346
|
-
*
|
|
347
|
-
* @example
|
|
348
|
-
* import { PrismaClient } from '@prisma/client';
|
|
349
|
-
* import { createPrismaAdapter } from '@classytic/arc';
|
|
350
|
-
*
|
|
351
|
-
* const prisma = new PrismaClient();
|
|
352
|
-
*
|
|
353
|
-
* const userAdapter = createPrismaAdapter({
|
|
354
|
-
* client: prisma,
|
|
355
|
-
* modelName: 'user',
|
|
356
|
-
* repository: userRepository,
|
|
357
|
-
* dmmf: Prisma.dmmf, // Optional: for schema generation
|
|
358
|
-
* });
|
|
359
|
-
*/
|
|
360
|
-
declare function createPrismaAdapter<TModel>(options: PrismaAdapterOptions<TModel>): PrismaAdapter<TModel>;
|
|
361
|
-
//#endregion
|
|
362
|
-
export { PrismaQueryParserOptions as a, MongooseAdapterOptions as c, DrizzleAdapterOptions as d, createDrizzleAdapter as f, PrismaQueryParser as i, createMongooseAdapter as l, PrismaAdapterOptions as n, createPrismaAdapter as o, PrismaQueryOptions as r, MongooseAdapter as s, PrismaAdapter as t, DrizzleAdapter as u };
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import { i as EventLogger, n as DomainEvent, o as EventTransport, r as EventHandler } from "./EventTransport-CfVEGaEl.mjs";
|
|
2
|
-
|
|
3
|
-
//#region src/events/transports/redis-stream.d.ts
|
|
4
|
-
interface RedisStreamLike {
|
|
5
|
-
xadd(key: string, id: string, ...fieldValues: string[]): Promise<string | null>;
|
|
6
|
-
xreadgroup(command: "GROUP", group: string, consumer: string, ...args: (string | number)[]): Promise<Array<[string, Array<[string, string[]]>]> | null>;
|
|
7
|
-
xack(key: string, group: string, ...ids: string[]): Promise<number>;
|
|
8
|
-
xgroup(command: string, key: string, group: string, ...args: string[]): Promise<unknown>;
|
|
9
|
-
xpending(key: string, group: string, ...args: (string | number)[]): Promise<Array<[string, string, number, number]>>;
|
|
10
|
-
xclaim(key: string, group: string, consumer: string, minIdleTime: number, ...ids: string[]): Promise<Array<[string, string[]]>>;
|
|
11
|
-
xlen(key: string): Promise<number>;
|
|
12
|
-
quit(): Promise<unknown>;
|
|
13
|
-
}
|
|
14
|
-
interface RedisStreamTransportOptions {
|
|
15
|
-
/**
|
|
16
|
-
* Redis stream key name.
|
|
17
|
-
* @default 'arc:events'
|
|
18
|
-
*/
|
|
19
|
-
stream?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Consumer group name. Each group receives every event independently.
|
|
22
|
-
* Multiple instances of the same service should share a group name.
|
|
23
|
-
* @default 'default'
|
|
24
|
-
*/
|
|
25
|
-
group?: string;
|
|
26
|
-
/**
|
|
27
|
-
* Consumer name within the group. Must be unique per instance.
|
|
28
|
-
* @default 'consumer-<random>'
|
|
29
|
-
*/
|
|
30
|
-
consumer?: string;
|
|
31
|
-
/**
|
|
32
|
-
* Block time in ms when waiting for new events.
|
|
33
|
-
* @default 5000
|
|
34
|
-
*/
|
|
35
|
-
blockTimeMs?: number;
|
|
36
|
-
/**
|
|
37
|
-
* Max events to read per batch.
|
|
38
|
-
* @default 10
|
|
39
|
-
*/
|
|
40
|
-
batchSize?: number;
|
|
41
|
-
/**
|
|
42
|
-
* Max delivery attempts before moving to dead letter stream.
|
|
43
|
-
* @default 5
|
|
44
|
-
*/
|
|
45
|
-
maxRetries?: number;
|
|
46
|
-
/**
|
|
47
|
-
* Idle time in ms before pending entries are claimed by this consumer.
|
|
48
|
-
* Handles crash recovery — if a consumer dies mid-processing, another
|
|
49
|
-
* consumer will claim its pending entries after this timeout.
|
|
50
|
-
* @default 30000
|
|
51
|
-
*/
|
|
52
|
-
claimTimeoutMs?: number;
|
|
53
|
-
/**
|
|
54
|
-
* Dead letter stream name. Failed events are moved here after maxRetries.
|
|
55
|
-
* Set to `false` to disable DLQ (failed events are acked and dropped).
|
|
56
|
-
* @default 'arc:events:dlq'
|
|
57
|
-
*/
|
|
58
|
-
deadLetterStream?: string | false;
|
|
59
|
-
/**
|
|
60
|
-
* Max stream length (approximate). Uses XADD MAXLEN ~ to trim old entries.
|
|
61
|
-
* Set to 0 to disable trimming.
|
|
62
|
-
* @default 10000
|
|
63
|
-
*/
|
|
64
|
-
maxLen?: number;
|
|
65
|
-
/**
|
|
66
|
-
* Max event payload size in bytes. Publish rejects events exceeding this limit
|
|
67
|
-
* to prevent Redis memory exhaustion from oversized payloads.
|
|
68
|
-
* @default 1_000_000 (1 MB)
|
|
69
|
-
*/
|
|
70
|
-
maxPayloadBytes?: number;
|
|
71
|
-
/**
|
|
72
|
-
* Logger for error messages (default: console).
|
|
73
|
-
* Pass `fastify.log` to integrate with your application logger.
|
|
74
|
-
*/
|
|
75
|
-
logger?: EventLogger;
|
|
76
|
-
}
|
|
77
|
-
declare class RedisStreamTransport implements EventTransport {
|
|
78
|
-
readonly name = "redis-stream";
|
|
79
|
-
private redis;
|
|
80
|
-
private stream;
|
|
81
|
-
private group;
|
|
82
|
-
private consumer;
|
|
83
|
-
private blockTimeMs;
|
|
84
|
-
private batchSize;
|
|
85
|
-
private maxRetries;
|
|
86
|
-
private claimTimeoutMs;
|
|
87
|
-
private deadLetterStream;
|
|
88
|
-
private maxLen;
|
|
89
|
-
private maxPayloadBytes;
|
|
90
|
-
private logger;
|
|
91
|
-
private handlers;
|
|
92
|
-
private running;
|
|
93
|
-
private pollPromise;
|
|
94
|
-
private groupCreated;
|
|
95
|
-
constructor(redis: RedisStreamLike, options?: RedisStreamTransportOptions);
|
|
96
|
-
publish(event: DomainEvent): Promise<void>;
|
|
97
|
-
subscribe(pattern: string, handler: EventHandler): Promise<() => void>;
|
|
98
|
-
close(): Promise<void>;
|
|
99
|
-
private ensureGroup;
|
|
100
|
-
private pollLoop;
|
|
101
|
-
private readNewMessages;
|
|
102
|
-
private claimPending;
|
|
103
|
-
private processEntry;
|
|
104
|
-
private getMatchingHandlers;
|
|
105
|
-
private matchesPattern;
|
|
106
|
-
private moveToDlq;
|
|
107
|
-
private sleep;
|
|
108
|
-
}
|
|
109
|
-
//#endregion
|
|
110
|
-
export { RedisStreamTransport as n, RedisStreamTransportOptions as r, RedisStreamLike as t };
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|