@classytic/arc 2.14.0 → 2.14.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/dist/{BaseController-DX_T-bDB.mjs → BaseController-Dv60tU83.mjs} +47 -11
- package/dist/auth/index.d.mts +79 -2
- package/dist/auth/index.mjs +19 -1
- package/dist/{buildHandler-olo-gt94.mjs → buildHandler-BamHHpH8.mjs} +26 -5
- package/dist/cli/commands/describe.d.mts +1 -1
- package/dist/cli/commands/docs.mjs +1 -1
- package/dist/core/index.d.mts +3 -3
- package/dist/core/index.mjs +3 -3
- package/dist/{core-DECn6zaU.mjs → core-DEdN6zKD.mjs} +104 -7
- package/dist/{createActionRouter-CBxLLbn3.mjs → createActionRouter-S3MLVYot.mjs} +9 -2
- package/dist/{createAggregationRouter-CRIBv4sC.mjs → createAggregationRouter-Bk-58SbZ.mjs} +1 -1
- package/dist/{createApp-XX2-N0Yd.mjs → createApp-BarYhXCZ.mjs} +4 -3
- package/dist/docs/index.d.mts +1 -1
- package/dist/docs/index.mjs +1 -1
- package/dist/factory/index.d.mts +1 -1
- package/dist/factory/index.mjs +1 -1
- package/dist/hooks/index.d.mts +1 -1
- package/dist/{index-Dz5IKsrE.d.mts → index-Bt0F3nJj.d.mts} +1 -1
- package/dist/{index-Ds61mrJE.d.mts → index-D1-Kp_dP.d.mts} +48 -2
- package/dist/{index-BtW7qYwa.d.mts → index-Dwc0orNd.d.mts} +68 -7
- package/dist/index.d.mts +3 -3
- package/dist/index.mjs +3 -3
- package/dist/integrations/index.d.mts +1 -1
- 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/middleware/index.d.mts +1 -1
- package/dist/{openapi-noXno2CV.mjs → openapi-BHXhoX8O.mjs} +1 -1
- package/dist/org/index.d.mts +1 -1
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/plugins/index.d.mts +1 -1
- package/dist/plugins/tracing-entry.mjs +1 -1
- package/dist/presets/filesUpload.d.mts +1 -1
- package/dist/presets/index.d.mts +1 -1
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/search.d.mts +1 -1
- package/dist/registry/index.d.mts +1 -1
- package/dist/{resourceToTools-DLL32us3.mjs → resourceToTools-CZ-ZhS7v.mjs} +2 -2
- package/dist/testing/index.d.mts +2 -2
- package/dist/testing/index.mjs +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/{types-DQHFc8PM.d.mts → types-C6ONJ_Z2.d.mts} +1 -1
- package/dist/{types-BvqwCCSx.d.mts → types-NGtx3uxV.d.mts} +1 -1
- package/dist/utils/index.d.mts +1 -1
- package/package.json +1 -1
|
@@ -283,6 +283,36 @@ var BodySanitizer = class {
|
|
|
283
283
|
}
|
|
284
284
|
};
|
|
285
285
|
//#endregion
|
|
286
|
+
//#region src/core/fieldRulePredicates.ts
|
|
287
|
+
/**
|
|
288
|
+
* True when the field is allowed to appear in client-readable surfaces
|
|
289
|
+
* (response payloads, `select=` whitelists, `_distinct` queries).
|
|
290
|
+
*
|
|
291
|
+
* Mirror of every read-side gate. Don't reach for `rules.systemManaged`
|
|
292
|
+
* here — that's a write rule.
|
|
293
|
+
*/
|
|
294
|
+
function isFieldReadable(rule) {
|
|
295
|
+
if (!rule) return true;
|
|
296
|
+
return rule.hidden !== true;
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* The set of field names blocked from read-side surfaces (used by
|
|
300
|
+
* `QueryResolver.sanitizeSelectAny` and `BaseCrudController._distinct`).
|
|
301
|
+
*
|
|
302
|
+
* Returns `null` (not an empty array) when there are no rules to apply,
|
|
303
|
+
* so call-sites can early-out without creating empty allocations.
|
|
304
|
+
*/
|
|
305
|
+
function collectReadBlockedFields(schemaOptions) {
|
|
306
|
+
const fieldRules = schemaOptions?.fieldRules;
|
|
307
|
+
if (!fieldRules) return null;
|
|
308
|
+
const blocked = /* @__PURE__ */ new Set();
|
|
309
|
+
for (const [field, rule] of Object.entries(fieldRules)) {
|
|
310
|
+
if (!rule) continue;
|
|
311
|
+
if (!isFieldReadable(rule)) blocked.add(field);
|
|
312
|
+
}
|
|
313
|
+
return blocked.size > 0 ? blocked : null;
|
|
314
|
+
}
|
|
315
|
+
//#endregion
|
|
286
316
|
//#region src/core/QueryResolver.ts
|
|
287
317
|
/**
|
|
288
318
|
* QueryResolver - Composable query resolution logic extracted from BaseController.
|
|
@@ -419,10 +449,15 @@ var QueryResolver = class {
|
|
|
419
449
|
});
|
|
420
450
|
return sanitized.length > 0 ? sanitized : void 0;
|
|
421
451
|
}
|
|
422
|
-
/**
|
|
452
|
+
/**
|
|
453
|
+
* Read-side allowlist gate for `select=` / `populate=`.
|
|
454
|
+
*
|
|
455
|
+
* Only `hidden: true` blocks. `systemManaged` is a *write* rule and
|
|
456
|
+
* doesn't gate visibility — see `core/fieldRulePredicates.ts`.
|
|
457
|
+
*/
|
|
423
458
|
getBlockedFields(schemaOptions) {
|
|
424
|
-
const
|
|
425
|
-
return
|
|
459
|
+
const blocked = collectReadBlockedFields(schemaOptions);
|
|
460
|
+
return blocked ? Array.from(blocked) : [];
|
|
426
461
|
}
|
|
427
462
|
};
|
|
428
463
|
//#endregion
|
|
@@ -873,15 +908,16 @@ var BaseCrudController = class {
|
|
|
873
908
|
};
|
|
874
909
|
}
|
|
875
910
|
/**
|
|
876
|
-
* True when `field` is safe to expose via `_distinct`.
|
|
877
|
-
*
|
|
878
|
-
*
|
|
879
|
-
*
|
|
911
|
+
* True when `field` is safe to expose via `_distinct`.
|
|
912
|
+
*
|
|
913
|
+
* Read-side gate only — only `hidden: true` blocks. `systemManaged`
|
|
914
|
+
* is a *write* rule (clients can't PATCH the value); the field is
|
|
915
|
+
* still in every list response, so blocking `_distinct` adds nothing
|
|
916
|
+
* but inconvenience. See `core/fieldRulePredicates.ts` for the
|
|
917
|
+
* canonical predicate shared with `QueryResolver`.
|
|
880
918
|
*/
|
|
881
919
|
isFieldExposedForRead(field) {
|
|
882
|
-
|
|
883
|
-
if (!rules) return true;
|
|
884
|
-
return !(rules.hidden || rules.systemManaged);
|
|
920
|
+
return isFieldReadable(this.schemaOptions.fieldRules?.[field]);
|
|
885
921
|
}
|
|
886
922
|
/** Execute list query through hooks (extracted for cache revalidation) */
|
|
887
923
|
async executeListQuery(options, req) {
|
|
@@ -1353,4 +1389,4 @@ function TreeMixin(Base) {
|
|
|
1353
1389
|
*/
|
|
1354
1390
|
var BaseController = class extends SoftDeleteMixin(TreeMixin(SlugMixin(BulkMixin(BaseCrudController)))) {};
|
|
1355
1391
|
//#endregion
|
|
1356
|
-
export { BulkMixin as a,
|
|
1392
|
+
export { BulkMixin as a, collectReadBlockedFields as c, AccessControl as d, SlugMixin as i, isFieldReadable as l, TreeMixin as n, BaseCrudController as o, SoftDeleteMixin as r, QueryResolver as s, BaseController as t, BodySanitizer as u };
|
package/dist/auth/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Rt as AuthHelpers, zt as AuthPluginOptions } from "../index-
|
|
1
|
+
import { Rt as AuthHelpers, zt as AuthPluginOptions } from "../index-Dwc0orNd.mjs";
|
|
2
2
|
import { c as PermissionCheck } from "../fields-COhcH3fk.mjs";
|
|
3
3
|
import { t as ExternalOpenApiPaths } from "../externalPaths-BD5nw6St.mjs";
|
|
4
4
|
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-C4Le_UB3.mjs";
|
|
@@ -191,4 +191,81 @@ interface BetterAuthOpenApiOptions {
|
|
|
191
191
|
*/
|
|
192
192
|
declare function extractBetterAuthOpenApi(authApi: Record<string, unknown>, options?: BetterAuthOpenApiOptions): ExternalOpenApiPaths;
|
|
193
193
|
//#endregion
|
|
194
|
-
|
|
194
|
+
//#region src/auth/trustedOrigins.d.ts
|
|
195
|
+
/**
|
|
196
|
+
* `trustedOrigins` ↔ CORS-allowlist union helper.
|
|
197
|
+
*
|
|
198
|
+
* Better Auth's `trustedOrigins` (CSRF / origin guard) and Fastify's CORS
|
|
199
|
+
* `origin` allowlist are independent — a request that survives CORS still
|
|
200
|
+
* has to pass BA's origin check. When they drift, sign-in throws
|
|
201
|
+
* `Invalid origin` 401s that don't surface CORS errors in the network
|
|
202
|
+
* panel.
|
|
203
|
+
*
|
|
204
|
+
* Hosts have written the same union by hand in every app, with the same
|
|
205
|
+
* three corner cases (array → union with canonical URL, `true` → `["*"]`,
|
|
206
|
+
* `false`/undefined → just the canonical URL). This helper centralises
|
|
207
|
+
* that rule so a future change happens in one place.
|
|
208
|
+
*
|
|
209
|
+
* @example
|
|
210
|
+
* ```ts
|
|
211
|
+
* import { betterAuth } from "better-auth";
|
|
212
|
+
* import { mirrorTrustedOriginsFromCors } from "@classytic/arc/auth";
|
|
213
|
+
* import config from "#config";
|
|
214
|
+
*
|
|
215
|
+
* export const auth = betterAuth({
|
|
216
|
+
* secret: config.betterAuth.secret,
|
|
217
|
+
* baseURL: process.env.BETTER_AUTH_URL,
|
|
218
|
+
* trustedOrigins: mirrorTrustedOriginsFromCors({
|
|
219
|
+
* corsOrigins: config.cors.origins, // string[] | true | false
|
|
220
|
+
* canonicalUrl: config.frontend.url, // FRONTEND_URL — used for email link templates
|
|
221
|
+
* }),
|
|
222
|
+
* // ...
|
|
223
|
+
* });
|
|
224
|
+
* ```
|
|
225
|
+
*
|
|
226
|
+
* Why both inputs:
|
|
227
|
+
* - `canonicalUrl` is the single URL embedded in BA's email templates
|
|
228
|
+
* (invitation-accept, password-reset). It MUST be in `trustedOrigins`.
|
|
229
|
+
* - `corsOrigins` is the browser allowlist. Every entry there is a real
|
|
230
|
+
* FE host that may attempt sign-in; missing one yields the silent 401.
|
|
231
|
+
*
|
|
232
|
+
* The union dedupes — passing `canonicalUrl` already in `corsOrigins` is
|
|
233
|
+
* fine and won't duplicate the entry.
|
|
234
|
+
*/
|
|
235
|
+
/**
|
|
236
|
+
* Shape arc's CORS plugin and most apps use:
|
|
237
|
+
* - `string[]` — explicit allowlist
|
|
238
|
+
* - `true` — wildcard (`*`)
|
|
239
|
+
* - `false` / `undefined` — no extra origins beyond `canonicalUrl`
|
|
240
|
+
*
|
|
241
|
+
* Other shapes (regex, predicate function) aren't supported here — pass
|
|
242
|
+
* an explicit array if you have dynamic logic upstream.
|
|
243
|
+
*/
|
|
244
|
+
type CorsOriginsConfig = readonly string[] | boolean | undefined;
|
|
245
|
+
interface MirrorTrustedOriginsOptions {
|
|
246
|
+
/**
|
|
247
|
+
* CORS allowlist as configured for Fastify's CORS plugin.
|
|
248
|
+
* Most apps read this from a `CORS_ORIGINS` env var (`*` → `true`,
|
|
249
|
+
* comma-separated → `string[]`).
|
|
250
|
+
*/
|
|
251
|
+
corsOrigins: CorsOriginsConfig;
|
|
252
|
+
/**
|
|
253
|
+
* The single canonical FE URL used for email-link templates
|
|
254
|
+
* (invitation-accept, password-reset). Must be a trusted origin.
|
|
255
|
+
* Typically `FRONTEND_URL`.
|
|
256
|
+
*/
|
|
257
|
+
canonicalUrl: string;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Compute BA's `trustedOrigins` as the union of `canonicalUrl` and the
|
|
261
|
+
* CORS allowlist.
|
|
262
|
+
*
|
|
263
|
+
* Returns:
|
|
264
|
+
* - `["*"]` when `corsOrigins === true` (wildcard CORS).
|
|
265
|
+
* - `[canonicalUrl, ...corsOrigins]` deduped when `corsOrigins` is an
|
|
266
|
+
* array.
|
|
267
|
+
* - `[canonicalUrl]` when `corsOrigins` is `false` / `undefined`.
|
|
268
|
+
*/
|
|
269
|
+
declare function mirrorTrustedOriginsFromCors(options: MirrorTrustedOriginsOptions): string[];
|
|
270
|
+
//#endregion
|
|
271
|
+
export { type AuthPluginOptions, type BetterAuthAdapterOptions, type BetterAuthAdapterResult, type BetterAuthHandler, type BetterAuthOpenApiOptions, type CorsOriginsConfig, MemorySessionStore, type MemorySessionStoreOptions, type MirrorTrustedOriginsOptions, type SessionCookieOptions, type SessionData, type SessionManagerOptions, type SessionManagerResult, type SessionStore, _default as authPlugin, authPlugin as authPluginFn, createBetterAuthAdapter, createSessionManager, extractBetterAuthOpenApi, mirrorTrustedOriginsFromCors };
|
package/dist/auth/index.mjs
CHANGED
|
@@ -1029,4 +1029,22 @@ function createSessionManager(options) {
|
|
|
1029
1029
|
};
|
|
1030
1030
|
}
|
|
1031
1031
|
//#endregion
|
|
1032
|
-
|
|
1032
|
+
//#region src/auth/trustedOrigins.ts
|
|
1033
|
+
/**
|
|
1034
|
+
* Compute BA's `trustedOrigins` as the union of `canonicalUrl` and the
|
|
1035
|
+
* CORS allowlist.
|
|
1036
|
+
*
|
|
1037
|
+
* Returns:
|
|
1038
|
+
* - `["*"]` when `corsOrigins === true` (wildcard CORS).
|
|
1039
|
+
* - `[canonicalUrl, ...corsOrigins]` deduped when `corsOrigins` is an
|
|
1040
|
+
* array.
|
|
1041
|
+
* - `[canonicalUrl]` when `corsOrigins` is `false` / `undefined`.
|
|
1042
|
+
*/
|
|
1043
|
+
function mirrorTrustedOriginsFromCors(options) {
|
|
1044
|
+
const { corsOrigins, canonicalUrl } = options;
|
|
1045
|
+
if (corsOrigins === true) return ["*"];
|
|
1046
|
+
if (!corsOrigins) return [canonicalUrl];
|
|
1047
|
+
return Array.from(new Set([canonicalUrl, ...corsOrigins]));
|
|
1048
|
+
}
|
|
1049
|
+
//#endregion
|
|
1050
|
+
export { MemorySessionStore, authPlugin_default as authPlugin, authPlugin as authPluginFn, createBetterAuthAdapter, createSessionManager, extractBetterAuthOpenApi, mirrorTrustedOriginsFromCors };
|
|
@@ -195,10 +195,10 @@ function assertBucketFieldAllowed(input) {
|
|
|
195
195
|
if (dot > 0) {
|
|
196
196
|
const a = field.slice(0, dot);
|
|
197
197
|
if (lookupAliases.has(a)) return;
|
|
198
|
-
if (blockedFields.has(a)) throw new ArcAggregationConfigError(`Resource "${resourceName}" aggregation "${aggregationName}" dateBucket "${alias}" references field "${field}" whose root "${a}" is
|
|
198
|
+
if (blockedFields.has(a)) throw new ArcAggregationConfigError(`Resource "${resourceName}" aggregation "${aggregationName}" dateBucket "${alias}" references field "${field}" whose root "${a}" is blocked from aggregation (\`hidden: true\` or \`aggregable: false\` in schemaOptions.fieldRules). Bucketing hidden fields would leak temporal info.`);
|
|
199
199
|
return;
|
|
200
200
|
}
|
|
201
|
-
if (blockedFields.has(field)) throw new ArcAggregationConfigError(`Resource "${resourceName}" aggregation "${aggregationName}" dateBucket "${alias}" references field "${field}", but the field is
|
|
201
|
+
if (blockedFields.has(field)) throw new ArcAggregationConfigError(`Resource "${resourceName}" aggregation "${aggregationName}" dateBucket "${alias}" references field "${field}", but the field is blocked from aggregation (\`hidden: true\` or \`aggregable: false\` in schemaOptions.fieldRules). Bucketing hidden fields would leak temporal info.`);
|
|
202
202
|
}
|
|
203
203
|
/**
|
|
204
204
|
* Map arc's declarative knobs onto repo-core's portable `AggExecutionHints`.
|
|
@@ -307,13 +307,34 @@ function collectLookupAliases(lookups) {
|
|
|
307
307
|
for (const lookup of lookups) aliases.add(lookup.as ?? lookup.from);
|
|
308
308
|
return aliases;
|
|
309
309
|
}
|
|
310
|
+
/**
|
|
311
|
+
* Collect fields that aggregation MUST NOT reference.
|
|
312
|
+
*
|
|
313
|
+
* Default rule: only `hidden: true` blocks. `hidden` means the field is
|
|
314
|
+
* omitted from list/get responses, so exposing it via aggregation would
|
|
315
|
+
* leak data the client can't otherwise see. `systemManaged` is a write
|
|
316
|
+
* rule (server stamps the value, clients can't PATCH it) — those fields
|
|
317
|
+
* are still visible per-row, so aggregating them leaks nothing.
|
|
318
|
+
*
|
|
319
|
+
* Two opt-in overrides via `ArcFieldRule.aggregable`:
|
|
320
|
+
* - `aggregable: false` — explicit deny on a visible field (rare; use
|
|
321
|
+
* when the per-row value is fine but the across-row distribution is
|
|
322
|
+
* itself sensitive).
|
|
323
|
+
* - `aggregable: true` — explicit allow, even on a `hidden` field
|
|
324
|
+
* (escape hatch — caller asserts cardinality leak isn't a concern).
|
|
325
|
+
*/
|
|
310
326
|
function collectBlockedFields(schemaOptions) {
|
|
311
327
|
const blocked = /* @__PURE__ */ new Set();
|
|
312
328
|
const fieldRules = schemaOptions?.fieldRules;
|
|
313
329
|
if (!fieldRules) return blocked;
|
|
314
330
|
for (const [field, rules] of Object.entries(fieldRules)) {
|
|
315
331
|
if (!rules) continue;
|
|
316
|
-
if (rules.
|
|
332
|
+
if (rules.aggregable === true) continue;
|
|
333
|
+
if (rules.aggregable === false) {
|
|
334
|
+
blocked.add(field);
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
if (rules.hidden) blocked.add(field);
|
|
317
338
|
}
|
|
318
339
|
return blocked;
|
|
319
340
|
}
|
|
@@ -348,10 +369,10 @@ function assertFieldAllowed(context, ref, input) {
|
|
|
348
369
|
if (dot > 0) {
|
|
349
370
|
const alias = ref.slice(0, dot);
|
|
350
371
|
if (lookupAliases.has(alias)) return;
|
|
351
|
-
if (blockedFields.has(alias)) throw new ArcAggregationConfigError(`Resource "${resourceName}" aggregation "${aggregationName}" references field "${ref}" in ${context} whose root "${alias}" is
|
|
372
|
+
if (blockedFields.has(alias)) throw new ArcAggregationConfigError(`Resource "${resourceName}" aggregation "${aggregationName}" references field "${ref}" in ${context} whose root "${alias}" is blocked from aggregation (\`hidden: true\` or \`aggregable: false\` in schemaOptions.fieldRules). Aggregating hidden fields would leak cardinality information.`);
|
|
352
373
|
return;
|
|
353
374
|
}
|
|
354
|
-
if (blockedFields.has(ref)) throw new ArcAggregationConfigError(`Resource "${resourceName}" aggregation "${aggregationName}" references field "${ref}" in ${context}, but the field is
|
|
375
|
+
if (blockedFields.has(ref)) throw new ArcAggregationConfigError(`Resource "${resourceName}" aggregation "${aggregationName}" references field "${ref}" in ${context}, but the field is blocked from aggregation (\`hidden: true\` or \`aggregable: false\` in schemaOptions.fieldRules). Aggregating hidden fields would leak cardinality information.`);
|
|
355
376
|
}
|
|
356
377
|
function extractTenantFilter(tenantOptions) {
|
|
357
378
|
const out = {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as ResourceDefinition, ft as RouteSchemaOptions, rt as RateLimitConfig } from "../../index-
|
|
1
|
+
import { V as ResourceDefinition, ft as RouteSchemaOptions, rt as RateLimitConfig } from "../../index-Dwc0orNd.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/cli/commands/describe.d.ts
|
|
4
4
|
interface DescribedResource {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as ResourceRegistry } from "../../ResourceRegistry-CTERg_2x.mjs";
|
|
2
|
-
import { t as buildOpenApiSpec } from "../../openapi-
|
|
2
|
+
import { t as buildOpenApiSpec } from "../../openapi-BHXhoX8O.mjs";
|
|
3
3
|
import { dirname, resolve } from "node:path";
|
|
4
4
|
import { pathToFileURL } from "node:url";
|
|
5
5
|
import { mkdirSync, writeFileSync } from "node:fs";
|
package/dist/core/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { $t as SoftDeleteMixin, B as defineResource, Ct as AggregationConfig, Dt as AggregationMaterializedResult, Et as AggregationMaterializedContext, Ot as AggregationRateLimit, Qt as SoftDeleteExt, St as AggregationCacheConfig, Tt as AggregationIndexHint, V as ResourceDefinition, Zt as BaseController, _n as BodySanitizerConfig, an as BulkMixin, bt as AggMeasureInput, cn as QueryResolver, en as TreeExt, gn as BodySanitizer, hn as ListResult, in as BulkExt, kt as AggregationsMap, ln as QueryResolverConfig, nn as SlugExt, on as BaseControllerOptions, rn as SlugMixin, sn as BaseCrudController, tn as TreeMixin, vn as AccessControl, wt as AggregationDateRangeRequirement, xt as AggMeasureShorthand, yn as AccessControlConfig } from "../index-
|
|
2
|
-
import { C as
|
|
3
|
-
export { AccessControl, AccessControlConfig, AggMeasureInput, AggMeasureShorthand, AggregationCacheConfig, AggregationConfig, AggregationDateRangeRequirement, AggregationIndexHint, AggregationMaterializedContext, AggregationMaterializedResult, AggregationRateLimit, AggregationsMap, BaseController, BaseControllerOptions, BaseCrudController, BodySanitizer, BodySanitizerConfig, BulkExt, BulkMixin, CRUD_OPERATIONS, CrudOperation, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, HookOperation, HookPhase, ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, MutationOperation, QueryResolver, QueryResolverConfig, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugExt, SlugMixin, SoftDeleteExt, SoftDeleteMixin, TreeExt, TreeMixin, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineAggregation, defineResource, defineResourceVariants, getControllerContext, getControllerScope, sendControllerResponse };
|
|
1
|
+
import { $t as SoftDeleteMixin, B as defineResource, Ct as AggregationConfig, Dt as AggregationMaterializedResult, Et as AggregationMaterializedContext, Ot as AggregationRateLimit, Qt as SoftDeleteExt, St as AggregationCacheConfig, Tt as AggregationIndexHint, V as ResourceDefinition, Zt as BaseController, _n as BodySanitizerConfig, an as BulkMixin, bt as AggMeasureInput, cn as QueryResolver, en as TreeExt, gn as BodySanitizer, hn as ListResult, in as BulkExt, kt as AggregationsMap, ln as QueryResolverConfig, nn as SlugExt, on as BaseControllerOptions, rn as SlugMixin, sn as BaseCrudController, tn as TreeMixin, vn as AccessControl, wt as AggregationDateRangeRequirement, xt as AggMeasureShorthand, yn as AccessControlConfig } from "../index-Dwc0orNd.mjs";
|
|
2
|
+
import { A as MAX_SEARCH_LENGTH, C as DEFAULT_UPDATE_METHOD, D as HookPhase, E as HookOperation, M as MutationOperation, N as RESERVED_QUERY_PARAMS, O as MAX_FILTER_DEPTH, P as SYSTEM_FIELDS, S as DEFAULT_TENANT_FIELD, T as HOOK_PHASES, _ as CrudOperation, a as createRequestContext, b as DEFAULT_MAX_LIMIT, c as sendControllerResponse, d as getEntityQuery, f as defineResourceVariants, g as CRUD_OPERATIONS, h as defineAggregation, i as createFastifyHandler, j as MUTATION_OPERATIONS, k as MAX_REGEX_LENGTH, l as getEntityId, m as createPermissionMiddleware, n as isFieldReadable, o as getControllerContext, p as createCrudRouter, r as createCrudHandlers, s as getControllerScope, t as collectReadBlockedFields, u as getEntityIdField, v as DEFAULT_ID_FIELD, w as HOOK_OPERATIONS, x as DEFAULT_SORT, y as DEFAULT_LIMIT } from "../index-D1-Kp_dP.mjs";
|
|
3
|
+
export { AccessControl, AccessControlConfig, AggMeasureInput, AggMeasureShorthand, AggregationCacheConfig, AggregationConfig, AggregationDateRangeRequirement, AggregationIndexHint, AggregationMaterializedContext, AggregationMaterializedResult, AggregationRateLimit, AggregationsMap, BaseController, BaseControllerOptions, BaseCrudController, BodySanitizer, BodySanitizerConfig, BulkExt, BulkMixin, CRUD_OPERATIONS, CrudOperation, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, HookOperation, HookPhase, ListResult, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, MutationOperation, QueryResolver, QueryResolverConfig, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugExt, SlugMixin, SoftDeleteExt, SoftDeleteMixin, TreeExt, TreeMixin, collectReadBlockedFields, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineAggregation, defineResource, defineResourceVariants, getControllerContext, getControllerScope, getEntityId, getEntityIdField, getEntityQuery, isFieldReadable, sendControllerResponse };
|
package/dist/core/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as DEFAULT_SORT, c as HOOK_OPERATIONS, d as MAX_REGEX_LENGTH, f as MAX_SEARCH_LENGTH, h as SYSTEM_FIELDS, i as DEFAULT_MAX_LIMIT, l as HOOK_PHASES, m as RESERVED_QUERY_PARAMS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MUTATION_OPERATIONS, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as MAX_FILTER_DEPTH } from "../constants-Cxde4rpC.mjs";
|
|
2
|
-
import { a as BulkMixin, c as
|
|
2
|
+
import { a as BulkMixin, c as collectReadBlockedFields, d as AccessControl, i as SlugMixin, l as isFieldReadable, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, s as QueryResolver, t as BaseController, u as BodySanitizer } from "../BaseController-Dv60tU83.mjs";
|
|
3
3
|
import { _ as getControllerContext, g as createRequestContext, h as createFastifyHandler, m as createCrudHandlers, v as getControllerScope, y as sendControllerResponse } from "../routerShared-DrOa-26E.mjs";
|
|
4
|
-
import { a as createPermissionMiddleware, i as
|
|
5
|
-
export { AccessControl, BaseController, BaseCrudController, BodySanitizer, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, QueryResolver, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineAggregation, defineResource, defineResourceVariants, getControllerContext, getControllerScope, sendControllerResponse };
|
|
4
|
+
import { a as defineResource, c as createPermissionMiddleware, i as defineResourceVariants, l as defineAggregation, n as getEntityIdField, o as ResourceDefinition, r as getEntityQuery, s as createCrudRouter, t as getEntityId } from "../core-DEdN6zKD.mjs";
|
|
5
|
+
export { AccessControl, BaseController, BaseCrudController, BodySanitizer, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, QueryResolver, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, collectReadBlockedFields, createCrudHandlers, createCrudRouter, createFastifyHandler, createPermissionMiddleware, createRequestContext, defineAggregation, defineResource, defineResourceVariants, getControllerContext, getControllerScope, getEntityId, getEntityIdField, getEntityQuery, isFieldReadable, sendControllerResponse };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS } from "./constants-Cxde4rpC.mjs";
|
|
2
2
|
import { arcLog } from "./logger/index.mjs";
|
|
3
3
|
import { A as assertValidConfig, l as getDefaultCrudSchemas } from "./utils-_h9B3c57.mjs";
|
|
4
|
-
import { t as BaseController } from "./BaseController-
|
|
4
|
+
import { t as BaseController } from "./BaseController-Dv60tU83.mjs";
|
|
5
5
|
import { t as applyPresets } from "./presets-BbkjdPeH.mjs";
|
|
6
6
|
import { n as convertRouteSchema, t as convertOpenApiSchemas } from "./schemaConverter-De34B1ZG.mjs";
|
|
7
7
|
import { t as hasEvents } from "./typeGuards-BzkXkvVv.mjs";
|
|
@@ -121,7 +121,7 @@ function createCustomRoutes(fastify, routes, controller, options) {
|
|
|
121
121
|
* @param options - Router configuration
|
|
122
122
|
*/
|
|
123
123
|
function createCrudRouter(fastify, controller, options = {}) {
|
|
124
|
-
const { tag = "Resource", schemas = {}, permissions = {}, middlewares = {}, routeGuards = [], routes: customRoutes = [], disableDefaultRoutes = false, disabledRoutes = [], resourceName = "unknown", schemaOptions, rateLimit, pipe: pipeline, fields: fieldPermissions, updateMethod = DEFAULT_UPDATE_METHOD } = options;
|
|
124
|
+
const { tag = "Resource", schemas = {}, permissions = {}, middlewares = {}, routeGuards = [], routes: customRoutes = [], disableDefaultRoutes = false, disabledRoutes = [], resourceName = "unknown", schemaOptions, rateLimit, pipe: pipeline, fields: fieldPermissions, updateMethod = DEFAULT_UPDATE_METHOD, idField } = options;
|
|
125
125
|
const rateLimitConfig = buildRateLimitConfig(rateLimit);
|
|
126
126
|
const resourceHasQueryCache = fastify.hasDecorator("queryCache") && controller && typeof controller._cacheConfig !== "undefined" && controller._cacheConfig !== void 0;
|
|
127
127
|
const pluginMw = resolveRouterPluginMw(fastify, Boolean(resourceHasQueryCache));
|
|
@@ -131,7 +131,8 @@ function createCrudRouter(fastify, controller, options = {}) {
|
|
|
131
131
|
permissions,
|
|
132
132
|
hooks: fastify.arc?.hooks,
|
|
133
133
|
events: fastify.events,
|
|
134
|
-
fields: fieldPermissions
|
|
134
|
+
fields: fieldPermissions,
|
|
135
|
+
idField
|
|
135
136
|
});
|
|
136
137
|
const mw = {
|
|
137
138
|
list: middlewares.list ?? [],
|
|
@@ -926,15 +927,17 @@ function buildResourcePlugin(resource) {
|
|
|
926
927
|
rateLimit: resource.rateLimit,
|
|
927
928
|
updateMethod: resource.updateMethod,
|
|
928
929
|
pipe: resource.pipe,
|
|
929
|
-
fields: resource.fields
|
|
930
|
+
fields: resource.fields,
|
|
931
|
+
idField: resource.idField
|
|
930
932
|
});
|
|
931
933
|
if (resource.actions && Object.keys(resource.actions).length > 0) {
|
|
932
|
-
const { createActionRouter } = await import("./createActionRouter-
|
|
934
|
+
const { createActionRouter } = await import("./createActionRouter-S3MLVYot.mjs").then((n) => n.n);
|
|
933
935
|
createActionRouter(typedInstance, {
|
|
934
936
|
...normalizeActionsToRouterConfig(resource.actions, resource.actionPermissions, resource.tag, resource.permissions, resource.name, typedInstance.log),
|
|
935
937
|
resourceName: resource.name,
|
|
936
938
|
fields: resource.fields,
|
|
937
939
|
schemaOptions: resource.schemaOptions,
|
|
940
|
+
idField: resource.idField,
|
|
938
941
|
permissions: resource.permissions,
|
|
939
942
|
routeGuards: resource.routeGuards,
|
|
940
943
|
pipeline: resource.pipe,
|
|
@@ -942,7 +945,7 @@ function buildResourcePlugin(resource) {
|
|
|
942
945
|
});
|
|
943
946
|
}
|
|
944
947
|
if (resource.aggregations && Object.keys(resource.aggregations).length > 0) {
|
|
945
|
-
const { createAggregationRouter } = await import("./createAggregationRouter-
|
|
948
|
+
const { createAggregationRouter } = await import("./createAggregationRouter-Bk-58SbZ.mjs");
|
|
946
949
|
const repoForAgg = resource.controller?.repository;
|
|
947
950
|
const buildOptions = (req) => {
|
|
948
951
|
return resource.controller?.tenantRepoOptions?.(req) ?? {};
|
|
@@ -1293,6 +1296,7 @@ function validateDefineResourceConfig(config) {
|
|
|
1293
1296
|
validatePermissionsShape(config);
|
|
1294
1297
|
validateCustomRoutePermissions(config);
|
|
1295
1298
|
validateActionsShape(config);
|
|
1299
|
+
warnRedundantFieldRules(config);
|
|
1296
1300
|
}
|
|
1297
1301
|
/** Permissions must be `PermissionCheck` functions, not arbitrary values. */
|
|
1298
1302
|
function validatePermissionsShape(config) {
|
|
@@ -1308,6 +1312,33 @@ function validateCustomRoutePermissions(config) {
|
|
|
1308
1312
|
for (const route of config.routes ?? []) if (typeof route.permissions !== "function") throw new Error(`[Arc] Resource '${config.name}' route ${route.method} ${route.path}: permissions is required and must be a PermissionCheck function.`);
|
|
1309
1313
|
}
|
|
1310
1314
|
/**
|
|
1315
|
+
* Surface common field-rule misconfigurations at boot — non-fatal,
|
|
1316
|
+
* just a `console.warn` so hosts notice and clean up.
|
|
1317
|
+
*
|
|
1318
|
+
* Catches:
|
|
1319
|
+
* 1. `immutable: true` + `immutableAfterCreate: true` — `immutable`
|
|
1320
|
+
* already covers `immutableAfterCreate`. Picking both signals the
|
|
1321
|
+
* author wasn't sure which to use.
|
|
1322
|
+
* 2. `systemManaged: true` + `readonly: true` — both are write rules
|
|
1323
|
+
* and `BodySanitizer` strips on either; the second flag is dead.
|
|
1324
|
+
* 3. `hidden: true` + `aggregable: false` — `hidden` already blocks
|
|
1325
|
+
* aggregation; `aggregable: false` is redundant.
|
|
1326
|
+
*
|
|
1327
|
+
* NOT a hard error — write-rule overlap is harmless at runtime, just
|
|
1328
|
+
* noisy in code review.
|
|
1329
|
+
*/
|
|
1330
|
+
function warnRedundantFieldRules(config) {
|
|
1331
|
+
const fieldRules = config.schemaOptions?.fieldRules;
|
|
1332
|
+
if (!fieldRules) return;
|
|
1333
|
+
for (const [field, rule] of Object.entries(fieldRules)) {
|
|
1334
|
+
if (!rule) continue;
|
|
1335
|
+
const r = rule;
|
|
1336
|
+
if (r.immutable === true && r.immutableAfterCreate === true) console.warn(`[Arc] Resource '${config.name}' fieldRules.${field}: \`immutable: true\` already implies \`immutableAfterCreate: true\` — drop the second flag.`);
|
|
1337
|
+
if (r.systemManaged === true && r.readonly === true) console.warn(`[Arc] Resource '${config.name}' fieldRules.${field}: \`systemManaged\` and \`readonly\` both strip writes — pick one (\`systemManaged\` is the canonical name).`);
|
|
1338
|
+
if (r.hidden === true && r.aggregable === false) console.warn(`[Arc] Resource '${config.name}' fieldRules.${field}: \`hidden: true\` already blocks aggregation — \`aggregable: false\` is redundant.`);
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
/**
|
|
1311
1342
|
* Actions (v2.8) — name must not collide with CRUD ops; handler +
|
|
1312
1343
|
* permissions must have the right shapes. Fail at boot so production
|
|
1313
1344
|
* never ships a misconfigured action endpoint.
|
|
@@ -1396,4 +1427,70 @@ function defineResourceVariants(base, variants) {
|
|
|
1396
1427
|
return out;
|
|
1397
1428
|
}
|
|
1398
1429
|
//#endregion
|
|
1399
|
-
|
|
1430
|
+
//#region src/core/entityHelpers.ts
|
|
1431
|
+
/**
|
|
1432
|
+
* Per-request entity helpers — read the resource binding (idField + the
|
|
1433
|
+
* URL `:id` value) off `req.arc`.
|
|
1434
|
+
*
|
|
1435
|
+
* Action handlers receive their `id` argument as the raw URL `:id` value.
|
|
1436
|
+
* When the resource declares a custom `idField` (`slug`, `reportId`, …)
|
|
1437
|
+
* that's NOT the document `_id`, a naive `Model.findById(id)` silently
|
|
1438
|
+
* returns null. The historical footgun was a `findById(id)` typo where
|
|
1439
|
+
* the handler author hadn't realised that `:id` resolves to the friendly
|
|
1440
|
+
* handle.
|
|
1441
|
+
*
|
|
1442
|
+
* `getEntityQuery(req)` produces the canonical filter shape so handlers
|
|
1443
|
+
* compose lookups with no resource-config recall:
|
|
1444
|
+
*
|
|
1445
|
+
* ```ts
|
|
1446
|
+
* actions: {
|
|
1447
|
+
* archive: {
|
|
1448
|
+
* handler: async (id, data, req) => {
|
|
1449
|
+
* const doc = await Model.findOne(getEntityQuery(req));
|
|
1450
|
+
* if (!doc) throw new NotFoundError("Order");
|
|
1451
|
+
* // ...
|
|
1452
|
+
* },
|
|
1453
|
+
* },
|
|
1454
|
+
* }
|
|
1455
|
+
* ```
|
|
1456
|
+
*
|
|
1457
|
+
* The router populates `req.arc.idField` and `req.arc.entityId` before
|
|
1458
|
+
* invoking the handler — these helpers are zero-cost reads.
|
|
1459
|
+
*/
|
|
1460
|
+
/**
|
|
1461
|
+
* Read the resource's configured `idField` for the current request.
|
|
1462
|
+
* Falls back to the framework default (`_id`) when the route hasn't
|
|
1463
|
+
* bound an idField — keeps handlers safe to author without checking
|
|
1464
|
+
* the resource config.
|
|
1465
|
+
*/
|
|
1466
|
+
function getEntityIdField(req) {
|
|
1467
|
+
return req.arc?.idField ?? "_id";
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Read the URL `:id` path param value as the resource handle.
|
|
1471
|
+
* Returns `undefined` when the route has no `:id` segment (collection
|
|
1472
|
+
* routes) — handlers that need the entity must be on row routes.
|
|
1473
|
+
*/
|
|
1474
|
+
function getEntityId(req) {
|
|
1475
|
+
if (req.arc?.entityId !== void 0) return req.arc.entityId;
|
|
1476
|
+
return req.params?.id;
|
|
1477
|
+
}
|
|
1478
|
+
/**
|
|
1479
|
+
* Compose a `findOne` filter that resolves the current request's
|
|
1480
|
+
* entity, regardless of whether the resource binds `_id` or a custom
|
|
1481
|
+
* field. Idiomatic shape for arc action handlers.
|
|
1482
|
+
*
|
|
1483
|
+
* ```ts
|
|
1484
|
+
* const doc = await Model.findOne(getEntityQuery(req));
|
|
1485
|
+
* ```
|
|
1486
|
+
*
|
|
1487
|
+
* Returns `{}` when the route has no entity context (collection routes
|
|
1488
|
+
* or tests bypassing the router) — caller decides what that means.
|
|
1489
|
+
*/
|
|
1490
|
+
function getEntityQuery(req) {
|
|
1491
|
+
const id = getEntityId(req);
|
|
1492
|
+
if (id === void 0) return {};
|
|
1493
|
+
return { [getEntityIdField(req)]: id };
|
|
1494
|
+
}
|
|
1495
|
+
//#endregion
|
|
1496
|
+
export { defineResource as a, createPermissionMiddleware as c, defineResourceVariants as i, defineAggregation as l, getEntityIdField as n, ResourceDefinition as o, getEntityQuery as r, createCrudRouter as s, getEntityId as t };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { t as __exportAll } from "./chunk-BpYLSNr0.mjs";
|
|
2
|
+
import "./constants-Cxde4rpC.mjs";
|
|
2
3
|
import { f as createError } from "./errors-j4aJm1Wg.mjs";
|
|
3
4
|
import { a as buildAuthMiddlewareForPermissions, c as buildPreHandlerChain, f as resolveRouterPluginMw, l as buildRateLimitConfig, n as buildActionPipelineHandler, p as selectPluginMw, r as buildArcDecorator, t as buildActionPermissionMw, u as resolvePipelineSteps, y as sendControllerResponse } from "./routerShared-DrOa-26E.mjs";
|
|
4
5
|
import { n as schemaIRToJsonSchemaBranch, t as normalizeSchemaIR } from "./schemaIR-lYhC2gE5.mjs";
|
|
@@ -16,7 +17,7 @@ var createActionRouter_exports = /* @__PURE__ */ __exportAll({
|
|
|
16
17
|
* (keyed by `body.action` at request time).
|
|
17
18
|
*/
|
|
18
19
|
function createActionRouter(fastify, config) {
|
|
19
|
-
const { tag, resourceName = tag ?? "action", actions, actionPermissions = {}, actionSchemas = {}, globalAuth, onError, fields: fieldPermissions, schemaOptions, permissions: resourcePermissions, routeGuards = [], pipeline, rateLimit } = config;
|
|
20
|
+
const { tag, resourceName = tag ?? "action", actions, actionPermissions = {}, actionSchemas = {}, globalAuth, onError, fields: fieldPermissions, schemaOptions, idField = "_id", permissions: resourcePermissions, routeGuards = [], pipeline, rateLimit } = config;
|
|
20
21
|
const actionEnum = Object.keys(actions);
|
|
21
22
|
if (actionEnum.length === 0) {
|
|
22
23
|
fastify.log.warn("[createActionRouter] No actions defined, skipping route creation");
|
|
@@ -43,7 +44,8 @@ function createActionRouter(fastify, config) {
|
|
|
43
44
|
permissions: resourcePermissions,
|
|
44
45
|
hooks: fastify.arc?.hooks,
|
|
45
46
|
events: fastify.events,
|
|
46
|
-
fields: fieldPermissions
|
|
47
|
+
fields: fieldPermissions,
|
|
48
|
+
idField
|
|
47
49
|
});
|
|
48
50
|
const authMw = buildAuthMiddlewareForPermissions(fastify, actionEnum.map((name) => actionPermissions[name] ?? globalAuth));
|
|
49
51
|
const pluginMw = resolveRouterPluginMw(fastify, false);
|
|
@@ -69,6 +71,11 @@ function createActionRouter(fastify, config) {
|
|
|
69
71
|
handler: async (req, reply) => {
|
|
70
72
|
const { action, ...data } = req.body;
|
|
71
73
|
const { id } = req.params;
|
|
74
|
+
const reqWithExtras = req;
|
|
75
|
+
reqWithExtras.arc = {
|
|
76
|
+
...reqWithExtras.arc ?? {},
|
|
77
|
+
entityId: id
|
|
78
|
+
};
|
|
72
79
|
const handler = wrappedHandlers.get(action);
|
|
73
80
|
if (!handler) throw createError(400, `Invalid action '${action}'. Valid actions: ${actionEnum.join(", ")}`, { validActions: actionEnum });
|
|
74
81
|
try {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { f as createError, l as UnauthorizedError, r as ForbiddenError } from "./errors-j4aJm1Wg.mjs";
|
|
2
2
|
import { c as buildPreHandlerChain, f as resolveRouterPluginMw, i as buildAuthMiddleware, l as buildRateLimitConfig, p as selectPluginMw, r as buildArcDecorator } from "./routerShared-DrOa-26E.mjs";
|
|
3
|
-
import { r as validateAggregations, t as buildAggregationHandler } from "./buildHandler-
|
|
3
|
+
import { r as validateAggregations, t as buildAggregationHandler } from "./buildHandler-BamHHpH8.mjs";
|
|
4
4
|
//#region src/core/aggregation/createAggregationRouter.ts
|
|
5
5
|
/**
|
|
6
6
|
* Register one Fastify route per aggregation. No-op when the map is
|
|
@@ -393,9 +393,10 @@ async function registerOne(parent, resource) {
|
|
|
393
393
|
try {
|
|
394
394
|
await parent.register(resource.toPlugin());
|
|
395
395
|
} catch (err) {
|
|
396
|
-
const
|
|
397
|
-
|
|
398
|
-
|
|
396
|
+
const rawMsg = err instanceof Error ? err.message : String(err);
|
|
397
|
+
const stripped = rawMsg.replace(new RegExp(`^Resource "${name}"\\s*`), "").replace(/\.+\s*$/, "");
|
|
398
|
+
parent.log.error(`Failed to register resource "${name}": ${rawMsg}`);
|
|
399
|
+
throw new Error(`Resource "${name}" failed to register — ${stripped}.`, { cause: err });
|
|
399
400
|
}
|
|
400
401
|
}
|
|
401
402
|
/**
|
package/dist/docs/index.d.mts
CHANGED
package/dist/docs/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as getUserRoles } from "../types-D57iXYb8.mjs";
|
|
2
|
-
import { n as openApiPlugin, r as openapi_default, t as buildOpenApiSpec } from "../openapi-
|
|
2
|
+
import { n as openApiPlugin, r as openapi_default, t as buildOpenApiSpec } from "../openapi-BHXhoX8O.mjs";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
//#region src/docs/scalar.ts
|
|
5
5
|
const scalarPlugin = async (fastify, opts = {}) => {
|
package/dist/factory/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as CustomPluginAuthOption, c as RawBodyOptions, d as ResourceLike, f as ResourceModule, i as CustomAuthenticatorOption, l as UnderPressureOptions, n as BetterAuthOption, o as JwtAuthOption, p as loadResources, r as CreateAppOptions, s as MultipartOptions, t as AuthOption, u as LoadResourcesOptions } from "../types-
|
|
1
|
+
import { a as CustomPluginAuthOption, c as RawBodyOptions, d as ResourceLike, f as ResourceModule, i as CustomAuthenticatorOption, l as UnderPressureOptions, n as BetterAuthOption, o as JwtAuthOption, p as loadResources, r as CreateAppOptions, s as MultipartOptions, t as AuthOption, u as LoadResourcesOptions } from "../types-NGtx3uxV.mjs";
|
|
2
2
|
import { FastifyInstance } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/factory/createApp.d.ts
|
package/dist/factory/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as edgePreset, c as testingPreset, i as developmentPreset, n as createApp, o as getPreset, s as productionPreset, t as ArcFactory } from "../createApp-
|
|
1
|
+
import { a as edgePreset, c as testingPreset, i as developmentPreset, n as createApp, o as getPreset, s as productionPreset, t as ArcFactory } from "../createApp-BarYhXCZ.mjs";
|
|
2
2
|
import { t as loadResources } from "../loadResources-DBMQg_Aj.mjs";
|
|
3
3
|
//#region src/factory/edge.ts
|
|
4
4
|
/**
|
package/dist/hooks/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { An as afterUpdate, Cn as HookOperation, Dn as HookSystemOptions, En as HookSystem, Fn as defineHook, Mn as beforeDelete, Nn as beforeUpdate, On as afterCreate, Pn as createHookSystem, Sn as HookHandler, Tn as HookRegistration, bn as DefineHookOptions, jn as beforeCreate, kn as afterDelete, wn as HookPhase, xn as HookContext } from "../index-
|
|
1
|
+
import { An as afterUpdate, Cn as HookOperation, Dn as HookSystemOptions, En as HookSystem, Fn as defineHook, Mn as beforeDelete, Nn as beforeUpdate, On as afterCreate, Pn as createHookSystem, Sn as HookHandler, Tn as HookRegistration, bn as DefineHookOptions, jn as beforeCreate, kn as afterDelete, wn as HookPhase, xn as HookContext } from "../index-Dwc0orNd.mjs";
|
|
2
2
|
export { type DefineHookOptions, type HookContext, type HookHandler, type HookOperation, type HookPhase, type HookRegistration, HookSystem, type HookSystemOptions, afterCreate, afterDelete, afterUpdate, beforeCreate, beforeDelete, beforeUpdate, createHookSystem, defineHook };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as OpenApiSchemas, S as QueryParserInterface, Wt as AnyRecord, Yt as UserLike, at as ResourceConfig, b as ParsedQuery } from "./index-
|
|
1
|
+
import { $ as OpenApiSchemas, S as QueryParserInterface, Wt as AnyRecord, Yt as UserLike, at as ResourceConfig, b as ParsedQuery } from "./index-Dwc0orNd.mjs";
|
|
2
2
|
import { n as ErrorMapper } from "./errorHandler-DFr45ZG4.mjs";
|
|
3
3
|
import { HttpError, errorContractSchema as errorContractSchema$1, errorDetailSchema as errorDetailSchema$1 } from "@classytic/repo-core/errors";
|
|
4
4
|
import { FastifyInstance, FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as RequestContext, Ct as AggregationConfig, F as FastifyWithDecorators, T as CrudRouterOptions, V as ResourceDefinition, Wt as AnyRecord, _t as IControllerResponse, at as ResourceConfig, gt as IController, q as CrudController, vt as IRequestContext } from "./index-
|
|
1
|
+
import { C as RequestContext, Ct as AggregationConfig, F as FastifyWithDecorators, K as ArcFieldRule, L as RequestWithExtras, T as CrudRouterOptions, V as ResourceDefinition, Wt as AnyRecord, _t as IControllerResponse, at as ResourceConfig, ft as RouteSchemaOptions, gt as IController, q as CrudController, vt as IRequestContext } from "./index-Dwc0orNd.mjs";
|
|
2
2
|
import { i as RequestScope } from "./types-CTYvcwHe.mjs";
|
|
3
3
|
import { c as PermissionCheck } from "./fields-COhcH3fk.mjs";
|
|
4
4
|
import { FastifyReply, FastifyRequest, RouteHandlerMethod } from "fastify";
|
|
@@ -159,6 +159,34 @@ type VariantsResult<TDoc, V extends VariantsMap<TDoc>> = { [K in keyof V]: Resou
|
|
|
159
159
|
*/
|
|
160
160
|
declare function defineResourceVariants<TDoc extends AnyRecord = AnyRecord, V extends VariantsMap<TDoc> = VariantsMap<TDoc>>(base: Omit<ResourceConfig<TDoc>, "name" | "prefix">, variants: V): VariantsResult<TDoc, V>;
|
|
161
161
|
//#endregion
|
|
162
|
+
//#region src/core/entityHelpers.d.ts
|
|
163
|
+
/**
|
|
164
|
+
* Read the resource's configured `idField` for the current request.
|
|
165
|
+
* Falls back to the framework default (`_id`) when the route hasn't
|
|
166
|
+
* bound an idField — keeps handlers safe to author without checking
|
|
167
|
+
* the resource config.
|
|
168
|
+
*/
|
|
169
|
+
declare function getEntityIdField(req: RequestWithExtras): string;
|
|
170
|
+
/**
|
|
171
|
+
* Read the URL `:id` path param value as the resource handle.
|
|
172
|
+
* Returns `undefined` when the route has no `:id` segment (collection
|
|
173
|
+
* routes) — handlers that need the entity must be on row routes.
|
|
174
|
+
*/
|
|
175
|
+
declare function getEntityId(req: RequestWithExtras): string | undefined;
|
|
176
|
+
/**
|
|
177
|
+
* Compose a `findOne` filter that resolves the current request's
|
|
178
|
+
* entity, regardless of whether the resource binds `_id` or a custom
|
|
179
|
+
* field. Idiomatic shape for arc action handlers.
|
|
180
|
+
*
|
|
181
|
+
* ```ts
|
|
182
|
+
* const doc = await Model.findOne(getEntityQuery(req));
|
|
183
|
+
* ```
|
|
184
|
+
*
|
|
185
|
+
* Returns `{}` when the route has no entity context (collection routes
|
|
186
|
+
* or tests bypassing the router) — caller decides what that means.
|
|
187
|
+
*/
|
|
188
|
+
declare function getEntityQuery(req: RequestWithExtras): Record<string, string>;
|
|
189
|
+
//#endregion
|
|
162
190
|
//#region src/core/fastifyAdapter.d.ts
|
|
163
191
|
/**
|
|
164
192
|
* Create IRequestContext from Fastify request
|
|
@@ -227,4 +255,22 @@ declare function createCrudHandlers<TDoc>(controller: IController<TDoc>): {
|
|
|
227
255
|
delete: (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
|
|
228
256
|
};
|
|
229
257
|
//#endregion
|
|
230
|
-
|
|
258
|
+
//#region src/core/fieldRulePredicates.d.ts
|
|
259
|
+
/**
|
|
260
|
+
* True when the field is allowed to appear in client-readable surfaces
|
|
261
|
+
* (response payloads, `select=` whitelists, `_distinct` queries).
|
|
262
|
+
*
|
|
263
|
+
* Mirror of every read-side gate. Don't reach for `rules.systemManaged`
|
|
264
|
+
* here — that's a write rule.
|
|
265
|
+
*/
|
|
266
|
+
declare function isFieldReadable(rule: ArcFieldRule | undefined): boolean;
|
|
267
|
+
/**
|
|
268
|
+
* The set of field names blocked from read-side surfaces (used by
|
|
269
|
+
* `QueryResolver.sanitizeSelectAny` and `BaseCrudController._distinct`).
|
|
270
|
+
*
|
|
271
|
+
* Returns `null` (not an empty array) when there are no rules to apply,
|
|
272
|
+
* so call-sites can early-out without creating empty allocations.
|
|
273
|
+
*/
|
|
274
|
+
declare function collectReadBlockedFields(schemaOptions: RouteSchemaOptions | undefined): Set<string> | null;
|
|
275
|
+
//#endregion
|
|
276
|
+
export { MAX_SEARCH_LENGTH as A, DEFAULT_UPDATE_METHOD as C, HookPhase as D, HookOperation as E, MutationOperation as M, RESERVED_QUERY_PARAMS as N, MAX_FILTER_DEPTH as O, SYSTEM_FIELDS as P, DEFAULT_TENANT_FIELD as S, HOOK_PHASES as T, CrudOperation as _, createRequestContext as a, DEFAULT_MAX_LIMIT as b, sendControllerResponse as c, getEntityQuery as d, defineResourceVariants as f, CRUD_OPERATIONS as g, defineAggregation as h, createFastifyHandler as i, MUTATION_OPERATIONS as j, MAX_REGEX_LENGTH as k, getEntityId as l, createPermissionMiddleware as m, isFieldReadable as n, getControllerContext as o, createCrudRouter as p, createCrudHandlers as r, getControllerScope as s, collectReadBlockedFields as t, getEntityIdField as u, DEFAULT_ID_FIELD as v, HOOK_OPERATIONS as w, DEFAULT_SORT as x, DEFAULT_LIMIT as y };
|
|
@@ -541,7 +541,12 @@ declare class QueryResolver {
|
|
|
541
541
|
* Validates lookup structure to prevent injection.
|
|
542
542
|
*/
|
|
543
543
|
private sanitizeLookups;
|
|
544
|
-
/**
|
|
544
|
+
/**
|
|
545
|
+
* Read-side allowlist gate for `select=` / `populate=`.
|
|
546
|
+
*
|
|
547
|
+
* Only `hidden: true` blocks. `systemManaged` is a *write* rule and
|
|
548
|
+
* doesn't gate visibility — see `core/fieldRulePredicates.ts`.
|
|
549
|
+
*/
|
|
545
550
|
private getBlockedFields;
|
|
546
551
|
}
|
|
547
552
|
//#endregion
|
|
@@ -817,10 +822,13 @@ declare class BaseCrudController<TDoc = AnyRecord, TRepository extends Repositor
|
|
|
817
822
|
exists: boolean;
|
|
818
823
|
}>>;
|
|
819
824
|
/**
|
|
820
|
-
* True when `field` is safe to expose via `_distinct`.
|
|
821
|
-
*
|
|
822
|
-
*
|
|
823
|
-
*
|
|
825
|
+
* True when `field` is safe to expose via `_distinct`.
|
|
826
|
+
*
|
|
827
|
+
* Read-side gate only — only `hidden: true` blocks. `systemManaged`
|
|
828
|
+
* is a *write* rule (clients can't PATCH the value); the field is
|
|
829
|
+
* still in every list response, so blocking `_distinct` adds nothing
|
|
830
|
+
* but inconvenience. See `core/fieldRulePredicates.ts` for the
|
|
831
|
+
* canonical predicate shared with `QueryResolver`.
|
|
824
832
|
*/
|
|
825
833
|
protected isFieldExposedForRead(field: string): boolean;
|
|
826
834
|
/** Execute list query through hooks (extracted for cache revalidation) */
|
|
@@ -1947,6 +1955,32 @@ interface ArcFieldRule extends FieldRule {
|
|
|
1947
1955
|
*/
|
|
1948
1956
|
preserveForElevated?: boolean;
|
|
1949
1957
|
hidden?: boolean;
|
|
1958
|
+
/**
|
|
1959
|
+
* Aggregation visibility override. By default, only `hidden: true`
|
|
1960
|
+
* blocks a field from `groupBy` / `measures.field` / `sort` / `dateBuckets`
|
|
1961
|
+
* — that's the genuine cardinality-leak guard (the value is omitted from
|
|
1962
|
+
* list/get responses, so exposing it via aggregation would reveal data
|
|
1963
|
+
* the client can't otherwise see).
|
|
1964
|
+
*
|
|
1965
|
+
* `systemManaged: true` does **not** block aggregation — it's a write
|
|
1966
|
+
* rule, not a visibility rule. Server-stamped fields like `createdAt`,
|
|
1967
|
+
* `status`, or plugin-generated handles are visible in every list
|
|
1968
|
+
* response and should aggregate freely.
|
|
1969
|
+
*
|
|
1970
|
+
* Use this flag to override the default:
|
|
1971
|
+
*
|
|
1972
|
+
* - `aggregable: false` — explicit deny, even on visible fields. Useful
|
|
1973
|
+
* when a value is exposed per-row but the cardinality across rows is
|
|
1974
|
+
* itself sensitive (e.g. `email` is visible in `get/:id` to admins
|
|
1975
|
+
* but you don't want a public-readable agg of email distributions).
|
|
1976
|
+
* - `aggregable: true` — escape hatch on `hidden` fields. Lets you
|
|
1977
|
+
* aggregate a hidden column when you're sure cardinality leakage
|
|
1978
|
+
* isn't a concern (e.g. `internalScore` hidden from list, but a
|
|
1979
|
+
* committee-only `byScore` agg is fine).
|
|
1980
|
+
*
|
|
1981
|
+
* Defaults to `undefined` (use the `hidden`-only rule).
|
|
1982
|
+
*/
|
|
1983
|
+
aggregable?: boolean;
|
|
1950
1984
|
/** String minimum length — auto-maps to OpenAPI `minLength` and MCP tool schema */
|
|
1951
1985
|
minLength?: number;
|
|
1952
1986
|
/** String maximum length — auto-maps to OpenAPI `maxLength` and MCP tool schema */
|
|
@@ -2837,13 +2871,33 @@ interface FastifyRequestExtras {
|
|
|
2837
2871
|
}
|
|
2838
2872
|
interface RequestWithExtras extends FastifyRequest {
|
|
2839
2873
|
/**
|
|
2840
|
-
* Arc metadata — set by createCrudRouter
|
|
2841
|
-
* and
|
|
2874
|
+
* Arc metadata — set by createCrudRouter / createActionRouter / etc.
|
|
2875
|
+
* Contains resource configuration and runtime resolution of the URL
|
|
2876
|
+
* `:id` path param into the resource's `idField`.
|
|
2842
2877
|
*/
|
|
2843
2878
|
arc?: {
|
|
2844
2879
|
resourceName?: string;
|
|
2845
2880
|
schemaOptions?: RouteSchemaOptions;
|
|
2846
2881
|
permissions?: ResourcePermissions;
|
|
2882
|
+
/**
|
|
2883
|
+
* The configured `idField` for this resource (e.g. `_id`, `slug`,
|
|
2884
|
+
* `reportId`). Set by routers that bind a path `:id` segment so
|
|
2885
|
+
* handlers can compose the right query without remembering the
|
|
2886
|
+
* resource-config detail.
|
|
2887
|
+
*
|
|
2888
|
+
* Use `getEntityQuery(req)` for the canonical
|
|
2889
|
+
* `{ [idField]: entityId }` filter shape — saves the action handler
|
|
2890
|
+
* from a typo class where `Model.findById(id)` silently fails when
|
|
2891
|
+
* `idField !== "_id"`.
|
|
2892
|
+
*/
|
|
2893
|
+
idField?: string;
|
|
2894
|
+
/**
|
|
2895
|
+
* The current request's `:id` path-param value, surfaced verbatim.
|
|
2896
|
+
* For most resources this equals `req.params.id`; we mirror it on
|
|
2897
|
+
* `req.arc` so middleware that doesn't have a typed `params` shape
|
|
2898
|
+
* can still read the entity handle.
|
|
2899
|
+
*/
|
|
2900
|
+
entityId?: string;
|
|
2847
2901
|
};
|
|
2848
2902
|
context?: Record<string, unknown>;
|
|
2849
2903
|
_policyFilters?: Record<string, unknown>;
|
|
@@ -2958,6 +3012,13 @@ interface CrudRouterOptions {
|
|
|
2958
3012
|
rateLimit?: RateLimitConfig | false;
|
|
2959
3013
|
/** PreHandler guards applied to every route (CRUD + custom + preset). */
|
|
2960
3014
|
routeGuards?: RouteHandlerMethod[];
|
|
3015
|
+
/**
|
|
3016
|
+
* Resource's bound `idField` (`_id`, `slug`, `reportId`, …). Surfaces on
|
|
3017
|
+
* `req.arc.idField` for every CRUD route so handlers + middleware can
|
|
3018
|
+
* compose `findOne` filters via `getEntityQuery(req)` without
|
|
3019
|
+
* re-reading resource config. Defaults to `_id`.
|
|
3020
|
+
*/
|
|
3021
|
+
idField?: string;
|
|
2961
3022
|
}
|
|
2962
3023
|
//#endregion
|
|
2963
3024
|
//#region src/types/query.d.ts
|
package/dist/index.d.mts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { $t as SoftDeleteMixin, A as RequestIdOptions, B as defineResource, C as RequestContext, Ct as AggregationConfig, D as HealthCheck, Dt as AggregationMaterializedResult, E as GracefulShutdownOptions, Et as AggregationMaterializedContext, F as FastifyWithDecorators, Gt as ApiResponse, J as CrudRouteKey, Kt as ArcRequest, L as RequestWithExtras, N as FastifyRequestExtras, O as HealthOptions, Ot as AggregationRateLimit, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as SoftDeleteExt, S as QueryParserInterface, St as AggregationCacheConfig, T as CrudRouterOptions, Tt as AggregationIndexHint, V as ResourceDefinition, Wt as AnyRecord, X as EventDefinition, Xt as UserOrganization, Y as CrudSchemas, Z as FieldRule, Zt as BaseController, _t as IControllerResponse, a as InferAdapterDoc, an as BulkMixin, at as ResourceConfig, bt as AggMeasureInput, c as TypedController, d as PaginationResult, dn as ArcDeleteResult, en as TreeExt, et as PresetFunction, f as IntrospectionData, fn as ArcGetResult, ft as RouteSchemaOptions, g as ArcInternalMetadata, gt as IController, h as ResourceMetadata, hn as ListResult, i as ValidationResult, in as BulkExt, k as IntrospectionPluginOptions, kt as AggregationsMap, l as TypedRepository, m as RegistryStats, mn as ArcUpdateResult, mt as ControllerLike, n as ConfigError, nn as SlugExt, nt as PresetResult, o as InferDocType, on as BaseControllerOptions, p as RegistryEntry, pn as ArcListResult, q as CrudController, qt as JWTPayload, r as ValidateOptions, rn as SlugMixin, rt as RateLimitConfig, s as InferResourceDoc, sn as BaseCrudController, t as RouteHandlerMethod, tn as TreeMixin, u as TypedResourceConfig, un as ArcCreateResult, vt as IRequestContext, w as ServiceContext, wt as AggregationDateRangeRequirement, xt as AggMeasureShorthand, y as OwnershipCheck, yt as RouteHandler, zt as AuthPluginOptions } from "./index-
|
|
1
|
+
import { $t as SoftDeleteMixin, A as RequestIdOptions, B as defineResource, C as RequestContext, Ct as AggregationConfig, D as HealthCheck, Dt as AggregationMaterializedResult, E as GracefulShutdownOptions, Et as AggregationMaterializedContext, F as FastifyWithDecorators, Gt as ApiResponse, J as CrudRouteKey, Kt as ArcRequest, L as RequestWithExtras, N as FastifyRequestExtras, O as HealthOptions, Ot as AggregationRateLimit, P as FastifyWithAuth, Q as MiddlewareConfig, Qt as SoftDeleteExt, S as QueryParserInterface, St as AggregationCacheConfig, T as CrudRouterOptions, Tt as AggregationIndexHint, V as ResourceDefinition, Wt as AnyRecord, X as EventDefinition, Xt as UserOrganization, Y as CrudSchemas, Z as FieldRule, Zt as BaseController, _t as IControllerResponse, a as InferAdapterDoc, an as BulkMixin, at as ResourceConfig, bt as AggMeasureInput, c as TypedController, d as PaginationResult, dn as ArcDeleteResult, en as TreeExt, et as PresetFunction, f as IntrospectionData, fn as ArcGetResult, ft as RouteSchemaOptions, g as ArcInternalMetadata, gt as IController, h as ResourceMetadata, hn as ListResult, i as ValidationResult, in as BulkExt, k as IntrospectionPluginOptions, kt as AggregationsMap, l as TypedRepository, m as RegistryStats, mn as ArcUpdateResult, mt as ControllerLike, n as ConfigError, nn as SlugExt, nt as PresetResult, o as InferDocType, on as BaseControllerOptions, p as RegistryEntry, pn as ArcListResult, q as CrudController, qt as JWTPayload, r as ValidateOptions, rn as SlugMixin, rt as RateLimitConfig, s as InferResourceDoc, sn as BaseCrudController, t as RouteHandlerMethod, tn as TreeMixin, u as TypedResourceConfig, un as ArcCreateResult, vt as IRequestContext, w as ServiceContext, wt as AggregationDateRangeRequirement, xt as AggMeasureShorthand, y as OwnershipCheck, yt as RouteHandler, zt as AuthPluginOptions } from "./index-Dwc0orNd.mjs";
|
|
2
2
|
import { a as applyFieldWritePermissions, c as PermissionCheck, d as UserBase, i as applyFieldReadPermissions, l as PermissionContext, n as FieldPermissionMap, o as fields, t as FieldPermission, u as PermissionResult } from "./fields-COhcH3fk.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { A as MAX_SEARCH_LENGTH, C as DEFAULT_UPDATE_METHOD, D as HookPhase, E as HookOperation, M as MutationOperation, N as RESERVED_QUERY_PARAMS, O as MAX_FILTER_DEPTH, P as SYSTEM_FIELDS, S as DEFAULT_TENANT_FIELD, T as HOOK_PHASES, _ as CrudOperation, b as DEFAULT_MAX_LIMIT, f as defineResourceVariants, g as CRUD_OPERATIONS, h as defineAggregation, j as MUTATION_OPERATIONS, k as MAX_REGEX_LENGTH, s as getControllerScope, v as DEFAULT_ID_FIELD, w as HOOK_OPERATIONS, x as DEFAULT_SORT, y as DEFAULT_LIMIT } from "./index-D1-Kp_dP.mjs";
|
|
4
4
|
import { A as requireRoles, C as allOf, E as denyAll, M as when, O as requireAuth, S as createOrgPermissions, T as anyOf, a as presets_d_exports, c as readOnly, d as requireOrgRole, f as requireScopeContext, i as ownerWithAdminBypass, k as requireOwnership, l as requireOrgInScope, m as requireTeamMembership, n as authenticated, o as publicRead, p as requireServiceScope, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as requireOrgMembership, v as DynamicPermissionMatrix, w as allowPublic, x as createDynamicPermissionMatrix, y as DynamicPermissionMatrixConfig } from "./index-BTqLEvhu.mjs";
|
|
5
|
-
import { ct as NotFoundError, ht as createDomainError, it as ArcError, mt as ValidationError, pt as UnauthorizedError, st as ForbiddenError, t as getUserId } from "./index-
|
|
5
|
+
import { ct as NotFoundError, ht as createDomainError, it as ArcError, mt as ValidationError, pt as UnauthorizedError, st as ForbiddenError, t as getUserId } from "./index-Bt0F3nJj.mjs";
|
|
6
6
|
|
|
7
7
|
//#region src/index.d.ts
|
|
8
8
|
declare const version: string;
|
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { a as DEFAULT_SORT, c as HOOK_OPERATIONS, d as MAX_REGEX_LENGTH, f as MAX_SEARCH_LENGTH, h as SYSTEM_FIELDS, i as DEFAULT_MAX_LIMIT, l as HOOK_PHASES, m as RESERVED_QUERY_PARAMS, n as DEFAULT_ID_FIELD, o as DEFAULT_TENANT_FIELD, p as MUTATION_OPERATIONS, r as DEFAULT_LIMIT, s as DEFAULT_UPDATE_METHOD, t as CRUD_OPERATIONS, u as MAX_FILTER_DEPTH } from "./constants-Cxde4rpC.mjs";
|
|
2
2
|
import { d as createDomainError, i as NotFoundError, l as UnauthorizedError, r as ForbiddenError, t as ArcError, u as ValidationError } from "./errors-j4aJm1Wg.mjs";
|
|
3
3
|
import { t as getUserId } from "./utils-_h9B3c57.mjs";
|
|
4
|
-
import { a as BulkMixin, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController-
|
|
4
|
+
import { a as BulkMixin, i as SlugMixin, n as TreeMixin, o as BaseCrudController, r as SoftDeleteMixin, t as BaseController } from "./BaseController-Dv60tU83.mjs";
|
|
5
5
|
import { C as allowPublic, D as requireAuth, O as requireOwnership, S as allOf, T as denyAll, _ as requireOrgMembership, a as presets_exports, b as requireServiceScope, c as readOnly, d as applyFieldWritePermissions, f as fields, g as requireOrgInScope, h as createOrgPermissions, i as ownerWithAdminBypass, j as when, k as requireRoles, m as createDynamicPermissionMatrix, n as authenticated, o as publicRead, r as fullPublic, s as publicReadAdminWrite, t as adminOnly, u as applyFieldReadPermissions, v as requireOrgRole, w as anyOf, x as requireTeamMembership, y as requireScopeContext } from "./permissions-ohQyv50e.mjs";
|
|
6
6
|
import { v as getControllerScope } from "./routerShared-DrOa-26E.mjs";
|
|
7
|
-
import {
|
|
7
|
+
import { a as defineResource, i as defineResourceVariants, l as defineAggregation, o as ResourceDefinition } from "./core-DEdN6zKD.mjs";
|
|
8
8
|
//#region src/index.ts
|
|
9
|
-
const version = "2.14.
|
|
9
|
+
const version = "2.14.1";
|
|
10
10
|
//#endregion
|
|
11
11
|
export { ArcError, BaseController, BaseCrudController, BulkMixin, CRUD_OPERATIONS, DEFAULT_ID_FIELD, DEFAULT_LIMIT, DEFAULT_MAX_LIMIT, DEFAULT_SORT, DEFAULT_TENANT_FIELD, DEFAULT_UPDATE_METHOD, ForbiddenError, HOOK_OPERATIONS, HOOK_PHASES, MAX_FILTER_DEPTH, MAX_REGEX_LENGTH, MAX_SEARCH_LENGTH, MUTATION_OPERATIONS, NotFoundError, RESERVED_QUERY_PARAMS, ResourceDefinition, SYSTEM_FIELDS, SlugMixin, SoftDeleteMixin, TreeMixin, UnauthorizedError, ValidationError, adminOnly, allOf, allowPublic, anyOf, applyFieldReadPermissions, applyFieldWritePermissions, authenticated, createDomainError, createDynamicPermissionMatrix, createOrgPermissions, defineAggregation, defineResource, defineResourceVariants, denyAll, fields, fullPublic, getControllerScope, getUserId, ownerWithAdminBypass, presets_exports as permissions, publicRead, publicReadAdminWrite, readOnly, requireAuth, requireOrgInScope, requireOrgMembership, requireOrgRole, requireOwnership, requireRoles, requireScopeContext, requireServiceScope, requireTeamMembership, version, when };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as WebSocketMessage, i as WebSocketClient, o as WebSocketPluginOptions } from "../websocket-ChC2rqe1.mjs";
|
|
2
2
|
import { EventGatewayOptions } from "./event-gateway.mjs";
|
|
3
3
|
import { JobDefinition, JobDispatchOptions, JobDispatcher, JobMeta, JobsPluginOptions, QueueStats } from "./jobs.mjs";
|
|
4
|
-
import { c as McpResourceConfig, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler } from "../types-
|
|
4
|
+
import { c as McpResourceConfig, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler } from "../types-C6ONJ_Z2.mjs";
|
|
5
5
|
import { StreamlinePluginOptions, WorkflowLike, WorkflowRunLike } from "./streamline.mjs";
|
|
6
6
|
import { WebhookDeliveryRecord, WebhookManager, WebhookPluginOptions, WebhookStore, WebhookSubscription } from "./webhooks.mjs";
|
|
7
7
|
export { type BetterAuthHandler, type CallToolResult, type CreateMcpServerConfig, type CrudOperation, type EventGatewayOptions, type JobDefinition, type JobDispatchOptions, type JobDispatcher, type JobMeta, type JobsPluginOptions, type McpAuthResult, type McpPluginOptions, type McpResourceConfig, type PromptDefinition, type QueueStats, type StreamlinePluginOptions, type ToolAnnotations, type ToolContext, type ToolDefinition, type WebSocketClient, type WebSocketMessage, type WebSocketPluginOptions, type WebhookDeliveryRecord, type WebhookManager, type WebhookPluginOptions, type WebhookStore, type WebhookSubscription, type WorkflowLike, type WorkflowRunLike };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as ResourceDefinition } from "../../index-
|
|
2
|
-
import { a as McpAuthResolver, c as McpResourceConfig, d as SessionEntry, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler, u as PromptResult } from "../../types-
|
|
1
|
+
import { V as ResourceDefinition } from "../../index-Dwc0orNd.mjs";
|
|
2
|
+
import { a as McpAuthResolver, c as McpResourceConfig, d as SessionEntry, f as ToolAnnotations, i as CrudOperation, l as PromptDefinition, m as ToolDefinition, n as CallToolResult, o as McpAuthResult, p as ToolContext, r as CreateMcpServerConfig, s as McpPluginOptions, t as BetterAuthHandler, u as PromptResult } from "../../types-C6ONJ_Z2.mjs";
|
|
3
3
|
import { FastifyPluginAsync } from "fastify";
|
|
4
4
|
import { z } from "zod";
|
|
5
5
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as fieldRulesToZod, r as createMcpServer, t as resourceToTools } from "../../resourceToTools-
|
|
1
|
+
import { n as fieldRulesToZod, r as createMcpServer, t as resourceToTools } from "../../resourceToTools-CZ-ZhS7v.mjs";
|
|
2
2
|
import { createHash, randomUUID } from "node:crypto";
|
|
3
3
|
import fp from "fastify-plugin";
|
|
4
4
|
//#region src/integrations/mcp/defineTool.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as createMcpServer, t as resourceToTools } from "../../resourceToTools-
|
|
1
|
+
import { r as createMcpServer, t as resourceToTools } from "../../resourceToTools-CZ-ZhS7v.mjs";
|
|
2
2
|
//#region src/integrations/mcp/testing.ts
|
|
3
3
|
/**
|
|
4
4
|
* @classytic/arc/mcp/testing — MCP Test Utilities
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { I as MiddlewareHandler, L as RequestWithExtras, Q as MiddlewareConfig } from "../index-
|
|
1
|
+
import { I as MiddlewareHandler, L as RequestWithExtras, Q as MiddlewareConfig } from "../index-Dwc0orNd.mjs";
|
|
2
2
|
import { RouteHandlerMethod } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/middleware/middleware.d.ts
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { t as getUserRoles } from "./types-D57iXYb8.mjs";
|
|
2
2
|
import { n as convertRouteSchema } from "./schemaConverter-De34B1ZG.mjs";
|
|
3
3
|
import { t as resolveActionPermission } from "./actionPermissions-CyUkQu6O.mjs";
|
|
4
|
-
import { t as buildActionBodySchema } from "./createActionRouter-
|
|
4
|
+
import { t as buildActionBodySchema } from "./createActionRouter-S3MLVYot.mjs";
|
|
5
5
|
import fp from "fastify-plugin";
|
|
6
6
|
//#region src/docs/openapi/canonical-schemas.ts
|
|
7
7
|
/**
|
package/dist/org/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { yt as RouteHandler } from "../index-
|
|
1
|
+
import { yt as RouteHandler } from "../index-Dwc0orNd.mjs";
|
|
2
2
|
import { d as UserBase } from "../fields-COhcH3fk.mjs";
|
|
3
3
|
import { InvitationAdapter, InvitationDoc, MemberDoc, OrgAdapter, OrgDoc, OrgPermissionStatement, OrgRole, OrganizationPluginOptions } from "./types.mjs";
|
|
4
4
|
import { FastifyPluginAsync, RouteHandlerMethod } from "fastify";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { At as Guard, Ft as PipelineContext, It as PipelineStep, Lt as Transform, Mt as NextFunction, Nt as OperationFilter, Pt as PipelineConfig, _t as IControllerResponse, jt as Interceptor } from "../index-
|
|
1
|
+
import { At as Guard, Ft as PipelineContext, It as PipelineStep, Lt as Transform, Mt as NextFunction, Nt as OperationFilter, Pt as PipelineConfig, _t as IControllerResponse, jt as Interceptor } from "../index-Dwc0orNd.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/pipeline/guard.d.ts
|
|
4
4
|
interface GuardOptions {
|
package/dist/plugins/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { En as HookSystem, Q as MiddlewareConfig, Wt as AnyRecord, ft as RouteSchemaOptions, lt as RouteDefinition, tt as PresetHook, z as ResourceRegistry } from "../index-
|
|
1
|
+
import { En as HookSystem, Q as MiddlewareConfig, Wt as AnyRecord, ft as RouteSchemaOptions, lt as RouteDefinition, tt as PresetHook, z as ResourceRegistry } from "../index-Dwc0orNd.mjs";
|
|
2
2
|
import { t as ExternalOpenApiPaths } from "../externalPaths-BD5nw6St.mjs";
|
|
3
3
|
import { a as MetricsCollector, c as metricsPlugin, d as ssePlugin, f as CachingOptions, h as cachingPlugin, i as MetricEntry, l as SSEOptions, m as _default$1, n as _default$7, o as MetricsOptions, p as CachingRule, r as versioningPlugin, s as _default$4, t as VersioningOptions, u as _default$6 } from "../versioning-DTTvc80y.mjs";
|
|
4
4
|
import { i as errorHandlerPlugin, n as ErrorMapper, r as defaultIsDuplicateKeyError, t as ErrorHandlerOptions } from "../errorHandler-DFr45ZG4.mjs";
|
|
@@ -58,7 +58,7 @@ try {
|
|
|
58
58
|
function createTracerProvider(options) {
|
|
59
59
|
if (!isAvailable || !NodeTracerProvider || !BatchSpanProcessor || !OTLPTraceExporter) return null;
|
|
60
60
|
const { serviceName = "@classytic/arc", serviceVersion, exporterUrl = "http://localhost:4318/v1/traces" } = options;
|
|
61
|
-
const resolvedVersion = serviceVersion ?? "2.14.
|
|
61
|
+
const resolvedVersion = serviceVersion ?? "2.14.1";
|
|
62
62
|
const exporter = new OTLPTraceExporter({ url: exporterUrl });
|
|
63
63
|
const provider = new NodeTracerProvider({ resource: { attributes: {
|
|
64
64
|
"service.name": serviceName,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { nt as PresetResult } from "../index-
|
|
1
|
+
import { nt as PresetResult } from "../index-Dwc0orNd.mjs";
|
|
2
2
|
import { i as RequestScope } from "../types-CTYvcwHe.mjs";
|
|
3
3
|
import { c as PermissionCheck } from "../fields-COhcH3fk.mjs";
|
|
4
4
|
import { a as StorageReadResult, i as StorageReadRange, n as StorageContext, o as StorageUploadInput, r as StorageFile, t as Storage } from "../storage-Dfzt4VTl.mjs";
|
package/dist/presets/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Wt as AnyRecord, _t as IControllerResponse, at as ResourceConfig, d as PaginationResult, nt as PresetResult, vt as IRequestContext } from "../index-
|
|
1
|
+
import { Wt as AnyRecord, _t as IControllerResponse, at as ResourceConfig, d as PaginationResult, nt as PresetResult, vt as IRequestContext } from "../index-Dwc0orNd.mjs";
|
|
2
2
|
import { FilesUploadPresetOptions, FilesUploadPresetPermissions, FilesUploadPresetRoutes, filesUploadPreset } from "./filesUpload.mjs";
|
|
3
3
|
import { MultiTenantOptions, TenantFieldSpec, multiTenantPreset } from "./multiTenant.mjs";
|
|
4
4
|
import { SearchHandler, SearchPresetOptions, SearchRouteConfig, searchPreset } from "./search.mjs";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { lt as RouteDefinition, nt as PresetResult, pt as ControllerHandler, ut as RouteMcpConfig } from "../index-
|
|
1
|
+
import { lt as RouteDefinition, nt as PresetResult, pt as ControllerHandler, ut as RouteMcpConfig } from "../index-Dwc0orNd.mjs";
|
|
2
2
|
import { c as PermissionCheck } from "../fields-COhcH3fk.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/presets/search.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { R as RegisterOptions, k as IntrospectionPluginOptions, z as ResourceRegistry } from "../index-
|
|
1
|
+
import { R as RegisterOptions, k as IntrospectionPluginOptions, z as ResourceRegistry } from "../index-Dwc0orNd.mjs";
|
|
2
2
|
import { FastifyPluginAsync } from "fastify";
|
|
3
3
|
|
|
4
4
|
//#region src/registry/introspectionPlugin.d.ts
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { p as isArcError } from "./errors-j4aJm1Wg.mjs";
|
|
2
|
-
import { t as BaseController } from "./BaseController-
|
|
2
|
+
import { t as BaseController } from "./BaseController-Dv60tU83.mjs";
|
|
3
3
|
import { L as normalizePermissionResult } from "./permissions-ohQyv50e.mjs";
|
|
4
4
|
import { t as executePipeline } from "./pipe-Zr0KXjQe.mjs";
|
|
5
5
|
import { u as resolvePipelineSteps } from "./routerShared-DrOa-26E.mjs";
|
|
6
|
-
import { n as executeAggregation, r as validateAggregations } from "./buildHandler-
|
|
6
|
+
import { n as executeAggregation, r as validateAggregations } from "./buildHandler-BamHHpH8.mjs";
|
|
7
7
|
import { t as resolveActionPermission } from "./actionPermissions-CyUkQu6O.mjs";
|
|
8
8
|
import { i as shouldRejectAdditionalProperties, r as schemaIRToZodShape, t as normalizeSchemaIR } from "./schemaIR-lYhC2gE5.mjs";
|
|
9
9
|
import { t as pluralize } from "./pluralize-DQgqgifU.mjs";
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as ResourceDefinition, Wt as AnyRecord } from "../index-
|
|
2
|
-
import { d as ResourceLike, r as CreateAppOptions } from "../types-
|
|
1
|
+
import { V as ResourceDefinition, Wt as AnyRecord } from "../index-Dwc0orNd.mjs";
|
|
2
|
+
import { d as ResourceLike, r as CreateAppOptions } from "../types-NGtx3uxV.mjs";
|
|
3
3
|
import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
|
|
4
4
|
import { FastifyInstance, FastifyServerOptions } from "fastify";
|
|
5
5
|
import { Mock } from "vitest";
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1073,7 +1073,7 @@ function pickDefaultAuth(authMode, callerAuth) {
|
|
|
1073
1073
|
};
|
|
1074
1074
|
}
|
|
1075
1075
|
async function createTestApp(options = {}) {
|
|
1076
|
-
const { createApp } = await import("../createApp-
|
|
1076
|
+
const { createApp } = await import("../createApp-BarYhXCZ.mjs").then((n) => n.r);
|
|
1077
1077
|
const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
|
|
1078
1078
|
let dbHandle;
|
|
1079
1079
|
let dbUri;
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as OpenApiSchemas, A as RequestIdOptions, Bt as Authenticator, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, G as ActionsMap, Gt as ApiResponse, H as ActionDefinition, Ht as JwtContext, I as MiddlewareHandler, J as CrudRouteKey, Jt as ObjectId, K as ArcFieldRule, Kt as ArcRequest, L as RequestWithExtras, M as EventsDecorator, N as FastifyRequestExtras, O as HealthOptions, P as FastifyWithAuth, Q as MiddlewareConfig, Rt as AuthHelpers, S as QueryParserInterface, T as CrudRouterOptions, U as ActionEntry, Ut as TokenPair, Vt as AuthenticatorContext, W as ActionHandlerFn, Wt as AnyRecord, X as EventDefinition, Xt as UserOrganization, Y as CrudSchemas, Yt as UserLike, Z as FieldRule, _ as ControllerQueryOptions, _t as IControllerResponse, a as InferAdapterDoc, at as ResourceConfig, b as ParsedQuery, c as TypedController, ct as ResourcePermissions, d as PaginationResult, dt as RouteMethod, et as PresetFunction, f as IntrospectionData, ft as RouteSchemaOptions, g as ArcInternalMetadata, gt as IController, h as ResourceMetadata, ht as FastifyHandler, i as ValidationResult, it as ResourceCacheConfig, j as ArcDecorator, k as IntrospectionPluginOptions, l as TypedRepository, lt as RouteDefinition, m as RegistryStats, mt as ControllerLike, n as ConfigError, nt as PresetResult, o as InferDocType, on as BaseControllerOptions, ot as ResourceHookContext, p as RegistryEntry, pt as ControllerHandler, q as CrudController, qt as JWTPayload, r as ValidateOptions, rt as RateLimitConfig, s as InferResourceDoc, st as ResourceHooks, t as RouteHandlerMethod, tt as PresetHook, u as TypedResourceConfig, ut as RouteMcpConfig, v as LookupOption, vt as IRequestContext, w as ServiceContext, x as PopulateOption, y as OwnershipCheck, yt as RouteHandler, zt as AuthPluginOptions } from "../index-
|
|
1
|
+
import { $ as OpenApiSchemas, A as RequestIdOptions, Bt as Authenticator, C as RequestContext, D as HealthCheck, E as GracefulShutdownOptions, F as FastifyWithDecorators, G as ActionsMap, Gt as ApiResponse, H as ActionDefinition, Ht as JwtContext, I as MiddlewareHandler, J as CrudRouteKey, Jt as ObjectId, K as ArcFieldRule, Kt as ArcRequest, L as RequestWithExtras, M as EventsDecorator, N as FastifyRequestExtras, O as HealthOptions, P as FastifyWithAuth, Q as MiddlewareConfig, Rt as AuthHelpers, S as QueryParserInterface, T as CrudRouterOptions, U as ActionEntry, Ut as TokenPair, Vt as AuthenticatorContext, W as ActionHandlerFn, Wt as AnyRecord, X as EventDefinition, Xt as UserOrganization, Y as CrudSchemas, Yt as UserLike, Z as FieldRule, _ as ControllerQueryOptions, _t as IControllerResponse, a as InferAdapterDoc, at as ResourceConfig, b as ParsedQuery, c as TypedController, ct as ResourcePermissions, d as PaginationResult, dt as RouteMethod, et as PresetFunction, f as IntrospectionData, ft as RouteSchemaOptions, g as ArcInternalMetadata, gt as IController, h as ResourceMetadata, ht as FastifyHandler, i as ValidationResult, it as ResourceCacheConfig, j as ArcDecorator, k as IntrospectionPluginOptions, l as TypedRepository, lt as RouteDefinition, m as RegistryStats, mt as ControllerLike, n as ConfigError, nt as PresetResult, o as InferDocType, on as BaseControllerOptions, ot as ResourceHookContext, p as RegistryEntry, pt as ControllerHandler, q as CrudController, qt as JWTPayload, r as ValidateOptions, rt as RateLimitConfig, s as InferResourceDoc, st as ResourceHooks, t as RouteHandlerMethod, tt as PresetHook, u as TypedResourceConfig, ut as RouteMcpConfig, v as LookupOption, vt as IRequestContext, w as ServiceContext, x as PopulateOption, y as OwnershipCheck, yt as RouteHandler, zt as AuthPluginOptions } from "../index-Dwc0orNd.mjs";
|
|
2
2
|
import { i as RequestScope } from "../types-CTYvcwHe.mjs";
|
|
3
3
|
import { c as PermissionCheck, d as UserBase, l as PermissionContext, u as PermissionResult } from "../fields-COhcH3fk.mjs";
|
|
4
4
|
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-BXOWoGCF.mjs";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { r as CacheStore } from "./interface-beEtJyWM.mjs";
|
|
2
|
-
import { Bt as Authenticator } from "./index-
|
|
2
|
+
import { Bt as Authenticator } from "./index-Dwc0orNd.mjs";
|
|
3
3
|
import { n as ElevationOptions } from "./elevation-BXOWoGCF.mjs";
|
|
4
4
|
import { a as EventTransport } from "./EventTransport-CT_52aWU.mjs";
|
|
5
5
|
import { t as ExternalOpenApiPaths } from "./externalPaths-BD5nw6St.mjs";
|
package/dist/utils/index.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { $ as ValidateOptions, A as ArcQueryParserOptions, B as CompensationResult, C as keysetListResponse, D as queryParams, E as paginationSchema, F as defineGuard, G as CircuitBreakerError, H as defineCompensation, I as defineErrorMapper, J as CircuitBreakerStats, K as CircuitBreakerOptions, L as CompensationDefinition, M as handleRaw, N as Guard, O as responses, P as GuardConfig, Q as ConfigError, R as CompensationError, S as getListQueryParams, T as offsetListResponse, U as withCompensation, V as CompensationStep, W as CircuitBreaker, X as createCircuitBreaker, Y as CircuitState, Z as createCircuitBreakerRegistry, _ as bareListResponse, _t as isArcError, a as TransitionConfig, at as ConflictError, b as errorDetailSchema, c as JsonSchemaTarget, ct as NotFoundError, d as isJsonSchema, dt as RateLimitError, et as ValidationResult, f as isZodSchema, ft as ServiceUnavailableError, g as aggregateListResponse, gt as createError, h as JsonSchema, ht as createDomainError, i as StateMachine, it as ArcError, j as createQueryParser, k as ArcQueryParser, l as convertOpenApiSchemas, lt as OrgAccessDeniedError, m as scheduleBackground, mt as ValidationError, n as EventsDecorator, nt as formatValidationErrors, o as createStateMachine, ot as ErrorOptions, p as toJsonSchema, pt as UnauthorizedError, q as CircuitBreakerRegistry, r as hasEvents, rt as validateResourceConfig, s as simpleEqualityMatcher, st as ForbiddenError, t as getUserId, tt as assertValidConfig, u as convertRouteSchema, ut as OrgRequiredError, v as deleteResponse, w as listResponse, x as getDefaultCrudSchemas, y as errorContractSchema, z as CompensationHooks } from "../index-
|
|
1
|
+
import { $ as ValidateOptions, A as ArcQueryParserOptions, B as CompensationResult, C as keysetListResponse, D as queryParams, E as paginationSchema, F as defineGuard, G as CircuitBreakerError, H as defineCompensation, I as defineErrorMapper, J as CircuitBreakerStats, K as CircuitBreakerOptions, L as CompensationDefinition, M as handleRaw, N as Guard, O as responses, P as GuardConfig, Q as ConfigError, R as CompensationError, S as getListQueryParams, T as offsetListResponse, U as withCompensation, V as CompensationStep, W as CircuitBreaker, X as createCircuitBreaker, Y as CircuitState, Z as createCircuitBreakerRegistry, _ as bareListResponse, _t as isArcError, a as TransitionConfig, at as ConflictError, b as errorDetailSchema, c as JsonSchemaTarget, ct as NotFoundError, d as isJsonSchema, dt as RateLimitError, et as ValidationResult, f as isZodSchema, ft as ServiceUnavailableError, g as aggregateListResponse, gt as createError, h as JsonSchema, ht as createDomainError, i as StateMachine, it as ArcError, j as createQueryParser, k as ArcQueryParser, l as convertOpenApiSchemas, lt as OrgAccessDeniedError, m as scheduleBackground, mt as ValidationError, n as EventsDecorator, nt as formatValidationErrors, o as createStateMachine, ot as ErrorOptions, p as toJsonSchema, pt as UnauthorizedError, q as CircuitBreakerRegistry, r as hasEvents, rt as validateResourceConfig, s as simpleEqualityMatcher, st as ForbiddenError, t as getUserId, tt as assertValidConfig, u as convertRouteSchema, ut as OrgRequiredError, v as deleteResponse, w as listResponse, x as getDefaultCrudSchemas, y as errorContractSchema, z as CompensationHooks } from "../index-Bt0F3nJj.mjs";
|
|
2
2
|
export { ArcError, ArcQueryParser, ArcQueryParserOptions, CircuitBreaker, CircuitBreakerError, CircuitBreakerOptions, CircuitBreakerRegistry, CircuitBreakerStats, CircuitState, CompensationDefinition, CompensationError, CompensationHooks, CompensationResult, CompensationStep, ConfigError, ConflictError, ErrorOptions, EventsDecorator, ForbiddenError, Guard, GuardConfig, JsonSchema, JsonSchemaTarget, NotFoundError, OrgAccessDeniedError, OrgRequiredError, RateLimitError, ServiceUnavailableError, StateMachine, TransitionConfig, UnauthorizedError, ValidateOptions, ValidationError, 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, isZodSchema, keysetListResponse, listResponse, offsetListResponse, paginationSchema, queryParams, responses, scheduleBackground, simpleEqualityMatcher, toJsonSchema, validateResourceConfig, withCompensation };
|