@classytic/arc 2.21.0 → 2.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{BaseController-BnLYgE9A.mjs → BaseController-C6FlRWxF.mjs} +1 -1
- package/dist/audit/index.d.mts +2 -2
- package/dist/auth/index.d.mts +30 -2
- package/dist/auth/index.mjs +5 -2
- package/dist/cli/commands/describe.d.mts +1 -1
- package/dist/cli/commands/docs.mjs +1 -1
- package/dist/cli/commands/init.mjs +1 -1
- package/dist/cli/index.mjs +1 -1
- package/dist/core/index.d.mts +2 -2
- package/dist/core/index.mjs +2 -2
- package/dist/{core-DZ6Xe1jR.mjs → core-b6fgFgnd.mjs} +123 -66
- package/dist/{createActionRouter-BWMDW-dL.mjs → createActionRouter-h1cEEaEX.mjs} +9 -5
- package/dist/{createAggregationRouter-l5mNdYrZ.mjs → createAggregationRouter-B1C0kvTL.mjs} +3 -3
- package/dist/{createApp-Bi61XxqU.mjs → createApp-Ci7yG5gv.mjs} +242 -56
- package/dist/docs/index.d.mts +1 -1
- package/dist/docs/index.mjs +1 -1
- package/dist/encryption/index.mjs +9 -5
- package/dist/{errorHandler-Dxf6P_kV.mjs → errorHandler-BTzXSwIg.mjs} +24 -3
- package/dist/{errorHandler-B0e-bq-O.d.mts → errorHandler-C6yv4ZTW.d.mts} +13 -0
- package/dist/factory/index.d.mts +29 -8
- package/dist/factory/index.mjs +34 -3
- package/dist/{fastify-augmentation-DafigGQp.d.mts → fastify-augmentation-9_fuetB4.d.mts} +2 -2
- package/dist/fields-D3lhgzhD.d.mts +121 -0
- package/dist/health-ScyjIVo5.mjs +202 -0
- package/dist/hooks/index.d.mts +1 -1
- package/dist/idempotency/index.mjs +2 -0
- package/dist/{types-DpxoNX5v.d.mts → index-BEu4wjbL.d.mts} +187 -66
- package/dist/{index-B5N-NaHs.d.mts → index-D8MKYGDa.d.mts} +3 -3
- package/dist/{index-Dtrj6XZk.d.mts → index-DbtgCOCj.d.mts} +1287 -1225
- package/dist/{index-B5PoNbfu.d.mts → index-ogIHvOjo.d.mts} +1 -1
- package/dist/index.d.mts +6 -5
- package/dist/index.mjs +3 -3
- package/dist/{init-0YhHkXGk.mjs → init-DleK3p9f.mjs} +118 -2
- package/dist/integrations/index.d.mts +1 -1
- package/dist/integrations/mcp/index.d.mts +3 -3
- 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/webhooks.d.mts +8 -4
- package/dist/integrations/webhooks.mjs +9 -5
- package/dist/jsonBody-BlzAoGCe.mjs +43 -0
- package/dist/logger/index.d.mts +26 -1
- package/dist/logger/index.mjs +39 -1
- package/dist/{mcpPlugin-B9XjjNVG.mjs → mcpPlugin-ByA2tf6D.mjs} +6 -2
- package/dist/middleware/index.d.mts +1 -1
- package/dist/{module-WeuU5jfd.d.mts → module-B4u10iOJ.d.mts} +26 -1
- package/dist/{openapi-Kyod_di6.mjs → openapi-BRpMZD7C.mjs} +2 -2
- package/dist/permissions/index.d.mts +3 -2
- package/dist/pipeline/index.d.mts +1 -1
- package/dist/plugins/index.d.mts +22 -5
- package/dist/plugins/index.mjs +11 -280
- package/dist/plugins/response-cache.mjs +1 -0
- package/dist/plugins/tracing-entry.mjs +7 -4
- package/dist/presets/filesUpload.d.mts +2 -2
- package/dist/presets/index.d.mts +1 -1
- package/dist/presets/multiTenant.d.mts +1 -1
- package/dist/presets/search.d.mts +2 -2
- package/dist/rateLimitKey-BoWRH3e7.mjs +14 -0
- package/dist/{registerRoute-oGAl0oA8.mjs → registerRoute-xHc42fwB.mjs} +37 -17
- package/dist/registry/index.d.mts +2 -2
- package/dist/requestId-5BhTVzBv.mjs +113 -0
- package/dist/schemaConverter-Ds5reSGs.mjs +168 -0
- package/dist/{schemaIR-ajetw3Fv.mjs → schemaIR-B-6SPe7g.mjs} +2 -2
- package/dist/scim/index.mjs +6 -7
- package/dist/scope/index.mjs +2 -76
- package/dist/scope-k15RXfcq.mjs +64 -0
- package/dist/testing/index.d.mts +83 -3
- package/dist/testing/index.mjs +70 -3
- package/dist/types/index.d.mts +2 -2
- package/dist/{types-DRj-Ut4n.d.mts → types-Bc42CUyk.d.mts} +1 -1
- package/dist/{fields-BGqrAa_u.d.mts → types-Csxga7d3.d.mts} +1 -121
- package/dist/usage/index.d.mts +142 -0
- package/dist/usage/index.mjs +0 -0
- package/dist/utils/index.d.mts +40 -18
- package/dist/utils/index.mjs +2 -2
- package/dist/{utils-CO8a3B_1.mjs → utils-FhJ88TJE.mjs} +59 -13
- package/dist/{versioning-DQ4mCvg0.d.mts → versioning-DLwklPlG.d.mts} +0 -5
- package/llms.txt +39 -0
- package/package.json +453 -447
- package/skills/arc/SKILL.md +14 -8
- package/skills/arc/references/api-reference.md +34 -0
- package/skills/arc/references/auth.md +21 -4
- package/skills/arc/references/mcp.md +1 -1
- package/skills/arc/references/production.md +44 -2
- package/skills/arc-code-review/SKILL.md +1 -1
- package/skills/arc-code-review/references/anti-patterns.md +71 -18
- package/skills/arc-code-review/references/arc-cheatsheet.md +15 -2
- package/skills/arc-code-review/references/migration-recipes.md +7 -7
- package/skills/arc-code-review/references/mongokit-migration.md +4 -3
- package/skills/arc-module-publishing/SKILL.md +2 -1
- package/skills/arc-module-publishing/references/authoring-modules.md +55 -0
- package/skills/arc-module-publishing/references/package-manifest.md +4 -2
- package/dist/preloadResources-CHw3_oA_.mjs +0 -45
- package/dist/schemaConverter-U0MnO9vd.mjs +0 -110
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
import { arcLog } from "./logger/index.mjs";
|
|
2
|
+
//#region src/utils/schemaConverter.ts
|
|
3
|
+
/**
|
|
4
|
+
* Schema Converter — Detect-First, Convert-Only-When-Needed
|
|
5
|
+
*
|
|
6
|
+
* Converts Zod v4 schemas to JSON Schema using Zod's native `z.toJSONSchema()`.
|
|
7
|
+
* Plain JSON Schema objects pass through with zero overhead.
|
|
8
|
+
*
|
|
9
|
+
* Zod is an **optional** peer dependency — loaded lazily at module init;
|
|
10
|
+
* `ensureSchemaConverter()` awaits readiness (arc's resource plugin does this
|
|
11
|
+
* before converting). When a Zod schema shows up and can't be converted
|
|
12
|
+
* (zod missing, zod v3, conversion throw), VALIDATION paths fail fast at
|
|
13
|
+
* boot with an actionable error; DOC paths warn and degrade — see
|
|
14
|
+
* {@link UnconvertibleMode}. Hosts that never pass Zod pay nothing.
|
|
15
|
+
*
|
|
16
|
+
* ## Targets
|
|
17
|
+
*
|
|
18
|
+
* Zod v4's `toJSONSchema` supports multiple output targets; arc picks per consumer:
|
|
19
|
+
*
|
|
20
|
+
* - **`draft-7`** (default) — for Fastify route schemas. Fastify v5 bundles AJV 8
|
|
21
|
+
* configured for draft-07, which uses **numeric** `exclusiveMinimum`/`exclusiveMaximum`.
|
|
22
|
+
* The `openapi-3.0` target emits the **boolean** form inherited from draft-04
|
|
23
|
+
* (`exclusiveMinimum: true` alongside `minimum`), which AJV rejects at route
|
|
24
|
+
* registration with `schema is invalid: data/properties/X/exclusiveMinimum must be number`.
|
|
25
|
+
* Using `draft-7` fixes `.positive() / .negative() / .gt() / .lt()` out of the box.
|
|
26
|
+
* - **`openapi-3.0`** — for OpenAPI doc generation (arc emits OpenAPI 3.0.3). Keeps
|
|
27
|
+
* the boolean exclusive form that 3.0 tooling expects.
|
|
28
|
+
*/
|
|
29
|
+
const log = arcLog("schema");
|
|
30
|
+
/** Default target for Fastify-consumed schemas (matches Fastify v5's default AJV draft). */
|
|
31
|
+
const DEFAULT_FASTIFY_TARGET = "draft-7";
|
|
32
|
+
/** Default target for OpenAPI document generation (matches arc's emitted OpenAPI version). */
|
|
33
|
+
const DEFAULT_OPENAPI_TARGET = "openapi-3.0";
|
|
34
|
+
let _toJSONSchema = null;
|
|
35
|
+
const zodReady = import("zod").then(({ z }) => {
|
|
36
|
+
if (typeof z?.toJSONSchema === "function") _toJSONSchema = (schema, opts) => z.toJSONSchema(schema, opts);
|
|
37
|
+
}).catch(() => {});
|
|
38
|
+
/**
|
|
39
|
+
* Await Zod-converter readiness. Arc's resource plugin awaits this once
|
|
40
|
+
* before any schema conversion, closing the (theoretical) race between the
|
|
41
|
+
* lazy `import("zod")` above and boot-time route registration. Resolves
|
|
42
|
+
* immediately when zod isn't installed — absence is handled per-schema.
|
|
43
|
+
*/
|
|
44
|
+
function ensureSchemaConverter() {
|
|
45
|
+
return zodReady;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Check if an object is already a plain JSON Schema.
|
|
49
|
+
* Returns true if it has JSON Schema markers (`type`, `properties`, `$ref`,
|
|
50
|
+
* `allOf`, `anyOf`, `oneOf`, `items`, `enum`) and does NOT have Zod markers.
|
|
51
|
+
*/
|
|
52
|
+
function isJsonSchema(input) {
|
|
53
|
+
if (input === null || typeof input !== "object") return false;
|
|
54
|
+
const obj = input;
|
|
55
|
+
if ("_def" in obj || "_zod" in obj) return false;
|
|
56
|
+
return "type" in obj || "properties" in obj || "$ref" in obj || "allOf" in obj || "anyOf" in obj || "oneOf" in obj || "items" in obj || "enum" in obj;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Check if an object is a Zod schema (has `_zod` marker from Zod v4).
|
|
60
|
+
*/
|
|
61
|
+
function isZodSchema(input) {
|
|
62
|
+
return input !== null && typeof input === "object" && "_zod" in input;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Zod v3 schemas carry `_def` but NOT v4's `_zod` marker. They can't be
|
|
66
|
+
* converted (`z.toJSONSchema()` is v4-only) — detect them so the failure is
|
|
67
|
+
* an actionable "upgrade to zod v4" instead of a cryptic AJV boot error
|
|
68
|
+
* three layers away.
|
|
69
|
+
*/
|
|
70
|
+
function isZodV3Schema(input) {
|
|
71
|
+
if (input === null || typeof input !== "object") return false;
|
|
72
|
+
const obj = input;
|
|
73
|
+
return "_def" in obj && !("_zod" in obj);
|
|
74
|
+
}
|
|
75
|
+
function unconvertible(mode, message, cause) {
|
|
76
|
+
if (mode === "throw") throw new Error(`[arc/schema] ${message}`, cause ? { cause } : void 0);
|
|
77
|
+
log.warn(`${message} — degrading to permissive { type: 'object' } (validation disabled for this slot)`);
|
|
78
|
+
return { type: "object" };
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Convert any schema input to JSON Schema.
|
|
82
|
+
*
|
|
83
|
+
* Detection order:
|
|
84
|
+
* 1. `null`/`undefined` → `undefined`
|
|
85
|
+
* 2. Already JSON Schema → pass through as-is (zero overhead)
|
|
86
|
+
* 3. Zod v4 schema → `z.toJSONSchema(schema, { target })`
|
|
87
|
+
* 4. Zod v3 schema → unconvertible (actionable "upgrade to v4" error/warn)
|
|
88
|
+
* 5. Unrecognized object → return as-is (treat as opaque schema)
|
|
89
|
+
*
|
|
90
|
+
* @param input Schema (Zod, plain JSON Schema, or opaque object)
|
|
91
|
+
* @param target Output target — defaults to `draft-7` for Fastify compatibility.
|
|
92
|
+
* Pass `openapi-3.0`/`openapi-3.1` for OpenAPI document generation.
|
|
93
|
+
* @param mode Failure policy for unconvertible Zod schemas — see
|
|
94
|
+
* {@link UnconvertibleMode}. Defaults to `'warn'`.
|
|
95
|
+
*/
|
|
96
|
+
function toJsonSchema(input, target = DEFAULT_FASTIFY_TARGET, mode = "warn") {
|
|
97
|
+
if (input == null) return void 0;
|
|
98
|
+
if (typeof input !== "object") return void 0;
|
|
99
|
+
if (isJsonSchema(input)) return input;
|
|
100
|
+
if (isZodSchema(input)) {
|
|
101
|
+
if (!_toJSONSchema) return unconvertible(mode, "A Zod schema was passed but zod v4 is not installed (or not yet loaded). Install zod >=4 — arc converts via zod's native z.toJSONSchema().");
|
|
102
|
+
try {
|
|
103
|
+
const converted = _toJSONSchema(input, { target });
|
|
104
|
+
if ("$schema" in converted) delete converted.$schema;
|
|
105
|
+
return converted;
|
|
106
|
+
} catch (cause) {
|
|
107
|
+
return unconvertible(mode, `z.toJSONSchema() failed for a Zod schema (target: ${target}): ${cause instanceof Error ? cause.message : String(cause)}. Zod-only features with no JSON Schema equivalent (.refine/.transform/custom checks) cannot express wire validation — enforce those in the handler or a pipeline step.`, cause);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
if (isZodV3Schema(input)) return unconvertible(mode, "A Zod v3 schema was passed (has `_def` but no v4 `_zod` marker). arc requires zod >=4 for schema conversion — upgrade zod, or pass plain JSON Schema.");
|
|
111
|
+
return input;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Convert all schema fields in an OpenApiSchemas object.
|
|
115
|
+
* JSON Schema values pass through unchanged. Only Zod schemas are converted.
|
|
116
|
+
*
|
|
117
|
+
* Defaults to the `openapi-3.0` target since this function feeds OpenAPI doc
|
|
118
|
+
* generation, not Fastify route validation.
|
|
119
|
+
*/
|
|
120
|
+
function convertOpenApiSchemas(schemas, target = DEFAULT_OPENAPI_TARGET) {
|
|
121
|
+
const result = {};
|
|
122
|
+
const schemaFields = [
|
|
123
|
+
"entity",
|
|
124
|
+
"createBody",
|
|
125
|
+
"updateBody",
|
|
126
|
+
"params",
|
|
127
|
+
"listQuery",
|
|
128
|
+
"response"
|
|
129
|
+
];
|
|
130
|
+
for (const field of schemaFields) {
|
|
131
|
+
const value = schemas[field];
|
|
132
|
+
if (value !== void 0) result[field] = toJsonSchema(value, target) ?? value;
|
|
133
|
+
}
|
|
134
|
+
for (const [key, value] of Object.entries(schemas)) if (!schemaFields.includes(key)) result[key] = value;
|
|
135
|
+
return result;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Convert schema values in a Fastify route schema record.
|
|
139
|
+
*
|
|
140
|
+
* Handles `body`, `querystring`, `params`, `headers` (top-level conversion)
|
|
141
|
+
* and `response` (iterates by status code — each value converted individually).
|
|
142
|
+
*
|
|
143
|
+
* JSON Schema values pass through unchanged. Only Zod schemas are converted.
|
|
144
|
+
*
|
|
145
|
+
* Used for both custom routes and customSchemas (CRUD overrides).
|
|
146
|
+
*
|
|
147
|
+
* Defaults to `draft-7` so Fastify v5's bundled AJV 8 accepts the output.
|
|
148
|
+
* Pass `openapi-3.0` (or `openapi-3.1`) when generating OpenAPI documents.
|
|
149
|
+
*/
|
|
150
|
+
function convertRouteSchema(schema, target = DEFAULT_FASTIFY_TARGET) {
|
|
151
|
+
const result = { ...schema };
|
|
152
|
+
const mode = target === DEFAULT_FASTIFY_TARGET ? "throw" : "warn";
|
|
153
|
+
for (const field of [
|
|
154
|
+
"body",
|
|
155
|
+
"querystring",
|
|
156
|
+
"params",
|
|
157
|
+
"headers"
|
|
158
|
+
]) if (result[field] !== void 0) result[field] = toJsonSchema(result[field], target, mode) ?? result[field];
|
|
159
|
+
if (result.response !== void 0 && typeof result.response === "object" && result.response !== null) {
|
|
160
|
+
const responseObj = result.response;
|
|
161
|
+
const convertedResponse = {};
|
|
162
|
+
for (const [statusCode, responseSchema] of Object.entries(responseObj)) convertedResponse[statusCode] = toJsonSchema(responseSchema, target, mode) ?? responseSchema;
|
|
163
|
+
result.response = convertedResponse;
|
|
164
|
+
}
|
|
165
|
+
return result;
|
|
166
|
+
}
|
|
167
|
+
//#endregion
|
|
168
|
+
export { isZodSchema as a, isJsonSchema as i, convertRouteSchema as n, toJsonSchema as o, ensureSchemaConverter as r, convertOpenApiSchemas as t };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as toJsonSchema } from "./schemaConverter-Ds5reSGs.mjs";
|
|
2
2
|
//#region src/core/schemaIR.ts
|
|
3
3
|
/**
|
|
4
4
|
* Schema IR — one canonical representation, two adapters.
|
|
@@ -49,7 +49,7 @@ function normalizeSchemaIR(raw) {
|
|
|
49
49
|
properties: {},
|
|
50
50
|
required: []
|
|
51
51
|
};
|
|
52
|
-
const converted = toJsonSchema(raw);
|
|
52
|
+
const converted = toJsonSchema(raw, "draft-7", "throw");
|
|
53
53
|
if (!converted || typeof converted !== "object" || converted.type !== "object" && !("properties" in converted)) return {
|
|
54
54
|
properties: {},
|
|
55
55
|
required: []
|
package/dist/scim/index.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { t as parseJsonBody } from "../jsonBody-BlzAoGCe.mjs";
|
|
1
2
|
import fp from "fastify-plugin";
|
|
2
3
|
//#region src/scim/errors.ts
|
|
3
4
|
var ScimError = class extends Error {
|
|
@@ -93,18 +94,16 @@ function asRecord(doc) {
|
|
|
93
94
|
/**
|
|
94
95
|
* Register the `application/scim+json` Fastify content-type parser. Idempotent
|
|
95
96
|
* — second registration in the same scope is a no-op. Empty bodies (DELETE,
|
|
96
|
-
* GET) yield `undefined` rather than crashing on `JSON.parse("")`.
|
|
97
|
+
* GET) yield `undefined` rather than crashing on `JSON.parse("")`. Parsing
|
|
98
|
+
* flows through `parseJsonBody`, so malformed SCIM payloads surface as 400
|
|
99
|
+
* `arc.bad_request` (not 500) and prototype-poisoning bodies are rejected —
|
|
100
|
+
* same contract as arc's main `application/json` parser.
|
|
97
101
|
*/
|
|
98
102
|
function ensureScimContentTypeParser(fastify) {
|
|
99
103
|
if (fastify.hasContentTypeParser("application/scim+json")) return;
|
|
100
104
|
fastify.addContentTypeParser("application/scim+json", { parseAs: "string" }, (_req, body, done) => {
|
|
101
|
-
const raw = body;
|
|
102
|
-
if (!raw || raw.length === 0) {
|
|
103
|
-
done(null, void 0);
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
105
|
try {
|
|
107
|
-
done(null, JSON
|
|
106
|
+
done(null, parseJsonBody(body, "Invalid SCIM JSON payload"));
|
|
108
107
|
} catch (err) {
|
|
109
108
|
done(err, void 0);
|
|
110
109
|
}
|
package/dist/scope/index.mjs
CHANGED
|
@@ -1,79 +1,5 @@
|
|
|
1
1
|
import { C as isService, D as requireUserId, E as requireTeamId, S as isOrgInScope, T as requireOrgId, _ as getUserRoles, a as getDPoPJkt, b as isElevated, c as getOrgId, d as getScopeContext, f as getScopeContextMap, g as getUserId, h as getTenantFromRequest, i as getClientId, l as getOrgRoles, m as getTeamId, n as PUBLIC_SCOPE, o as getMandate, p as getServiceScopes, r as getAncestorOrgIds, s as getOrgContext, t as AUTHENTICATED_SCOPE, u as getRequestScope, v as hasOrgAccess, w as requireClientId, x as isMember, y as isAuthenticated } from "../types-bHblZ9YN.mjs";
|
|
2
|
-
import { n as normalizeRoles } from "../types-XTApa8b6.mjs";
|
|
3
2
|
import { n as elevation_default, t as elevationPlugin } from "../elevation-COpYKt2h.mjs";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
if (opts?.strategy) return opts.strategy;
|
|
7
|
-
return (ctx) => {
|
|
8
|
-
const scope = ctx.scope;
|
|
9
|
-
if (!scope || scope.kind === "public") return ctx.ip;
|
|
10
|
-
if (scope.kind === "member") return scope.organizationId;
|
|
11
|
-
if (scope.kind === "service") return scope.organizationId;
|
|
12
|
-
if (scope.kind === "elevated") return scope.organizationId ?? scope.userId ?? ctx.ip;
|
|
13
|
-
return scope.userId ?? ctx.ip;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
//#endregion
|
|
17
|
-
//#region src/scope/resolveOrgFromHeader.ts
|
|
18
|
-
/**
|
|
19
|
-
* Create a preHandler hook that resolves org scope from a header.
|
|
20
|
-
* Must run AFTER authentication so `request.user` is populated.
|
|
21
|
-
* If the header is present and user is a member, sets `request.scope` to `member`.
|
|
22
|
-
* If the header is absent, scope stays as-is (typically `authenticated`).
|
|
23
|
-
*/
|
|
24
|
-
function resolveOrgFromHeader(options) {
|
|
25
|
-
const { header = "x-organization-id", resolveMembership } = options;
|
|
26
|
-
return async (request, reply) => {
|
|
27
|
-
const orgId = request.headers[header];
|
|
28
|
-
if (!orgId) return;
|
|
29
|
-
const scope = request.scope;
|
|
30
|
-
if (!scope || scope.kind === "public") {
|
|
31
|
-
reply.code(401).send({
|
|
32
|
-
success: false,
|
|
33
|
-
error: "Unauthorized",
|
|
34
|
-
message: "Authentication required for organization access",
|
|
35
|
-
code: "ORG_AUTH_REQUIRED"
|
|
36
|
-
});
|
|
37
|
-
return;
|
|
38
|
-
}
|
|
39
|
-
if (scope.kind === "elevated") return;
|
|
40
|
-
const user = request.user;
|
|
41
|
-
if (!user) {
|
|
42
|
-
reply.code(401).send({
|
|
43
|
-
success: false,
|
|
44
|
-
error: "Unauthorized",
|
|
45
|
-
message: "Authentication required for organization access",
|
|
46
|
-
code: "ORG_AUTH_REQUIRED"
|
|
47
|
-
});
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const userId = String(user.id ?? user._id ?? "");
|
|
51
|
-
if (!userId) {
|
|
52
|
-
reply.code(401).send({
|
|
53
|
-
success: false,
|
|
54
|
-
error: "Unauthorized",
|
|
55
|
-
message: "User identity required for organization access"
|
|
56
|
-
});
|
|
57
|
-
return;
|
|
58
|
-
}
|
|
59
|
-
const membership = await resolveMembership(userId, orgId);
|
|
60
|
-
if (!membership) {
|
|
61
|
-
reply.code(403).send({
|
|
62
|
-
success: false,
|
|
63
|
-
error: "Forbidden",
|
|
64
|
-
message: "Not a member of this organization",
|
|
65
|
-
code: "ORG_ACCESS_DENIED"
|
|
66
|
-
});
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
request.scope = {
|
|
70
|
-
kind: "member",
|
|
71
|
-
userId: userId || void 0,
|
|
72
|
-
userRoles: normalizeRoles(user.role),
|
|
73
|
-
organizationId: orgId,
|
|
74
|
-
orgRoles: membership.roles
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
//#endregion
|
|
3
|
+
import { t as createTenantKeyGenerator } from "../rateLimitKey-BoWRH3e7.mjs";
|
|
4
|
+
import { t as resolveOrgFromHeader } from "../scope-k15RXfcq.mjs";
|
|
79
5
|
export { AUTHENTICATED_SCOPE, PUBLIC_SCOPE, createTenantKeyGenerator, elevation_default as elevationPlugin, elevationPlugin as elevationPluginFn, getAncestorOrgIds, getClientId, getDPoPJkt, getMandate, getOrgContext, getOrgId, getOrgRoles, getRequestScope, getScopeContext, getScopeContextMap, getServiceScopes, getTeamId, getTenantFromRequest, getUserId, getUserRoles, hasOrgAccess, isAuthenticated, isElevated, isMember, isOrgInScope, isService, requireClientId, requireOrgId, requireTeamId, requireUserId, resolveOrgFromHeader };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { n as normalizeRoles } from "./types-XTApa8b6.mjs";
|
|
2
|
+
//#region src/scope/resolveOrgFromHeader.ts
|
|
3
|
+
/**
|
|
4
|
+
* Create a preHandler hook that resolves org scope from a header.
|
|
5
|
+
* Must run AFTER authentication so `request.user` is populated.
|
|
6
|
+
* If the header is present and user is a member, sets `request.scope` to `member`.
|
|
7
|
+
* If the header is absent, scope stays as-is (typically `authenticated`).
|
|
8
|
+
*/
|
|
9
|
+
function resolveOrgFromHeader(options) {
|
|
10
|
+
const { header = "x-organization-id", resolveMembership } = options;
|
|
11
|
+
return async (request, reply) => {
|
|
12
|
+
const orgId = request.headers[header];
|
|
13
|
+
if (!orgId) return;
|
|
14
|
+
const scope = request.scope;
|
|
15
|
+
if (!scope || scope.kind === "public") {
|
|
16
|
+
reply.code(401).send({
|
|
17
|
+
success: false,
|
|
18
|
+
error: "Unauthorized",
|
|
19
|
+
message: "Authentication required for organization access",
|
|
20
|
+
code: "ORG_AUTH_REQUIRED"
|
|
21
|
+
});
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (scope.kind === "elevated") return;
|
|
25
|
+
const user = request.user;
|
|
26
|
+
if (!user) {
|
|
27
|
+
reply.code(401).send({
|
|
28
|
+
success: false,
|
|
29
|
+
error: "Unauthorized",
|
|
30
|
+
message: "Authentication required for organization access",
|
|
31
|
+
code: "ORG_AUTH_REQUIRED"
|
|
32
|
+
});
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const userId = String(user.id ?? user._id ?? "");
|
|
36
|
+
if (!userId) {
|
|
37
|
+
reply.code(401).send({
|
|
38
|
+
success: false,
|
|
39
|
+
error: "Unauthorized",
|
|
40
|
+
message: "User identity required for organization access"
|
|
41
|
+
});
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const membership = await resolveMembership(userId, orgId);
|
|
45
|
+
if (!membership) {
|
|
46
|
+
reply.code(403).send({
|
|
47
|
+
success: false,
|
|
48
|
+
error: "Forbidden",
|
|
49
|
+
message: "Not a member of this organization",
|
|
50
|
+
code: "ORG_ACCESS_DENIED"
|
|
51
|
+
});
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
request.scope = {
|
|
55
|
+
kind: "member",
|
|
56
|
+
userId: userId || void 0,
|
|
57
|
+
userRoles: normalizeRoles(user.role),
|
|
58
|
+
organizationId: orgId,
|
|
59
|
+
orgRoles: membership.roles
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
//#endregion
|
|
64
|
+
export { resolveOrgFromHeader as t };
|
package/dist/testing/index.d.mts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { V as ResourceDefinition, qt as AnyRecord } from "../index-
|
|
2
|
-
import {
|
|
1
|
+
import { V as ResourceDefinition, qt as AnyRecord } from "../index-DbtgCOCj.mjs";
|
|
2
|
+
import { n as ArcModuleInput } from "../module-B4u10iOJ.mjs";
|
|
3
|
+
import { d as preloadResourcesAsync, t as CreateAppOptions, u as preloadResources } from "../index-BEu4wjbL.mjs";
|
|
3
4
|
import { StorageContractSetup, StorageContractSetupResult, runStorageContract } from "./storageContract.mjs";
|
|
4
5
|
import { FastifyInstance, FastifyServerOptions } from "fastify";
|
|
5
6
|
import { Mock } from "vitest";
|
|
@@ -296,6 +297,85 @@ declare function createBetterAuthTestHelpers(options?: BetterAuthTestHelpersOpti
|
|
|
296
297
|
*/
|
|
297
298
|
declare function setupBetterAuthTestApp(input: SetupBetterAuthTestAppInput): Promise<SetupBetterAuthTestAppResult>;
|
|
298
299
|
//#endregion
|
|
300
|
+
//#region src/testing/bootModuleApp.d.ts
|
|
301
|
+
/** Handed to a modules factory — the in-memory DB is live at call time. */
|
|
302
|
+
/**
|
|
303
|
+
* A provisioned test database — what the `database` seam yields. Arc
|
|
304
|
+
* core never names a driver: kits ship factories (`mongoMemoryDatabase`
|
|
305
|
+
* is the built-in default; a sqlitekit/pgkit testkit ships its own) and
|
|
306
|
+
* the connection flows through as an opaque generic.
|
|
307
|
+
*/
|
|
308
|
+
interface TestDatabase<TConn = unknown> {
|
|
309
|
+
/** Connection string, when the backend has one (informational). */
|
|
310
|
+
uri: string;
|
|
311
|
+
/** Driver connection handle passed to the modules factory. */
|
|
312
|
+
connection: TConn;
|
|
313
|
+
/** Stop/disconnect everything this factory started. MUST be idempotent-safe to call once. */
|
|
314
|
+
teardown(): Promise<void>;
|
|
315
|
+
}
|
|
316
|
+
/** The DB-provisioning seam — `bootModuleApp({ database })`. */
|
|
317
|
+
type TestDatabaseFactory<TConn = unknown> = (opts: {
|
|
318
|
+
replset?: boolean;
|
|
319
|
+
}) => Promise<TestDatabase<TConn>>;
|
|
320
|
+
interface TestkitContext<TConn = unknown> {
|
|
321
|
+
/** The provisioned database's connection string. */
|
|
322
|
+
uri: string;
|
|
323
|
+
/** @deprecated Alias of `uri` from the Mongo-default era — prefer `uri`. */
|
|
324
|
+
mongoUri: string;
|
|
325
|
+
/**
|
|
326
|
+
* Driver connection handle (the default factory yields mongoose's
|
|
327
|
+
* DEFAULT connection). Generic so DB-typed wrappers assert the driver
|
|
328
|
+
* type ONCE: `bootModuleApp<Connection>(...)`. Arc core stays DB-agnostic.
|
|
329
|
+
*/
|
|
330
|
+
connection: TConn;
|
|
331
|
+
}
|
|
332
|
+
type BootModulesInput<TConn = unknown> = ArcModuleInput | readonly ArcModuleInput[] | ((ctx: TestkitContext<TConn>) => ArcModuleInput | readonly ArcModuleInput[] | Promise<ArcModuleInput | readonly ArcModuleInput[]>);
|
|
333
|
+
interface BootModuleAppOptions<TConn = unknown> {
|
|
334
|
+
/**
|
|
335
|
+
* DB provisioner. Default: `mongoMemoryDatabase` (in-memory MongoDB —
|
|
336
|
+
* lazy devDep imports, nothing Mongo touches arc's runtime). Kits for
|
|
337
|
+
* other stores inject their own factory here; the rest of the harness
|
|
338
|
+
* (module resolution, app boot, teardown ordering) is DB-agnostic.
|
|
339
|
+
*/
|
|
340
|
+
database?: TestDatabaseFactory<TConn>;
|
|
341
|
+
/** Single-node replica set (transactions). Default: standalone. Passed to the database factory. */
|
|
342
|
+
replset?: boolean;
|
|
343
|
+
/**
|
|
344
|
+
* Extra `createApp` options merged over the testing defaults
|
|
345
|
+
* (`preset: 'testing'`, `auth: false`, `sensible: false` — utility
|
|
346
|
+
* plugins stay off so the testkit is dependency-light; re-enable per
|
|
347
|
+
* boot when a module genuinely exercises one).
|
|
348
|
+
*/
|
|
349
|
+
app?: Partial<CreateAppOptions>;
|
|
350
|
+
}
|
|
351
|
+
interface ModuleTestApp<TConn = unknown> {
|
|
352
|
+
app: FastifyInstance;
|
|
353
|
+
/** The provisioned database's connection string. */
|
|
354
|
+
uri: string;
|
|
355
|
+
/** @deprecated Alias of `uri` from the Mongo-default era — prefer `uri`. */
|
|
356
|
+
mongoUri: string;
|
|
357
|
+
/** The mongoose `Connection` handed to the modules factory. */
|
|
358
|
+
connection: TConn;
|
|
359
|
+
/**
|
|
360
|
+
* Typed module-export accessor — `t.exports<CatalogEngine>('catalog')`
|
|
361
|
+
* instead of reaching through `(t.app as ...).arc.modules.catalog`.
|
|
362
|
+
* Delegates to `getModuleExports` (throws with the registered-module
|
|
363
|
+
* list when the name is unknown — same contract hosts get).
|
|
364
|
+
*/
|
|
365
|
+
exports<TExports = unknown>(name: string): TExports;
|
|
366
|
+
/** Close app → disconnect mongoose → stop the in-memory server. Idempotent. */
|
|
367
|
+
close(): Promise<void>;
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* The built-in DB factory: in-memory MongoDB via lazy devDep imports.
|
|
371
|
+
* Everything Mongo-specific about the harness lives HERE — the harness
|
|
372
|
+
* itself is driver-blind and any kit can replace this via `database`.
|
|
373
|
+
*/
|
|
374
|
+
declare function mongoMemoryDatabase(opts: {
|
|
375
|
+
replset?: boolean;
|
|
376
|
+
}): Promise<TestDatabase<unknown>>;
|
|
377
|
+
declare function bootModuleApp<TConn = unknown>(modules: BootModulesInput<TConn>, options?: BootModuleAppOptions<TConn>): Promise<ModuleTestApp<TConn>>;
|
|
378
|
+
//#endregion
|
|
299
379
|
//#region src/testing/fixtures.d.ts
|
|
300
380
|
type FixtureFactory<T extends AnyRecord = AnyRecord> = (data: Partial<T>) => Promise<T>;
|
|
301
381
|
/** Delete hook invoked by `clear()` for records that were created through a factory. */
|
|
@@ -540,4 +620,4 @@ declare function createTestApp(options?: CreateTestAppOptions): Promise<TestAppC
|
|
|
540
620
|
*/
|
|
541
621
|
declare function createMinimalTestApp(options?: FastifyServerOptions): FastifyInstance;
|
|
542
622
|
//#endregion
|
|
543
|
-
export { type ArcAssertion, type ArcResponseLike, type AuthMode, type AuthResponse, type BetterAuthTestHelpers, type BetterAuthTestHelpersOptions, type BetterAuthTestUser, type CreateOrgInput, type CreateTestAppOptions, type DbMode, type FixtureDestroyer, type FixtureFactory, type FixtureRegistration, HttpTestHarness, type HttpTestHarnessOptions, type MockRepository, type OrgResponse, type RoleConfig, type SetupBetterAuthTestAppInput, type SetupBetterAuthTestAppResult, type SignInInput, type SignUpInput, type StorageContractSetup, type StorageContractSetupResult, type TestAppContext, type TestAuthProvider, type TestAuthSession, type TestFixtures, createBetterAuthProvider, createBetterAuthTestHelpers, createCustomAuthProvider, createDataFactory, createHttpTestHarness, createJwtAuthProvider, createMinimalTestApp, createMockController, createMockReply, createMockRepository, createMockRequest, createMockUser, createSpy, createTestApp, createTestFixtures, createTestTimer, expectArc, preloadResources, preloadResourcesAsync, runStorageContract, safeParseBody, setupBetterAuthTestApp, waitFor };
|
|
623
|
+
export { type ArcAssertion, type ArcResponseLike, type AuthMode, type AuthResponse, type BetterAuthTestHelpers, type BetterAuthTestHelpersOptions, type BetterAuthTestUser, type BootModuleAppOptions, type BootModulesInput, type CreateOrgInput, type CreateTestAppOptions, type DbMode, type FixtureDestroyer, type FixtureFactory, type FixtureRegistration, HttpTestHarness, type HttpTestHarnessOptions, type MockRepository, type ModuleTestApp, type OrgResponse, type RoleConfig, type SetupBetterAuthTestAppInput, type SetupBetterAuthTestAppResult, type SignInInput, type SignUpInput, type StorageContractSetup, type StorageContractSetupResult, type TestAppContext, type TestAuthProvider, type TestAuthSession, type TestDatabase, type TestDatabaseFactory, type TestFixtures, type TestkitContext, bootModuleApp, createBetterAuthProvider, createBetterAuthTestHelpers, createCustomAuthProvider, createDataFactory, createHttpTestHarness, createJwtAuthProvider, createMinimalTestApp, createMockController, createMockReply, createMockRepository, createMockRequest, createMockUser, createSpy, createTestApp, createTestFixtures, createTestTimer, expectArc, mongoMemoryDatabase, preloadResources, preloadResourcesAsync, runStorageContract, safeParseBody, setupBetterAuthTestApp, waitFor };
|
package/dist/testing/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { t as CRUD_OPERATIONS } from "../constants-DNre0wRg.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { d as getModuleExports, h as preloadResourcesAsync, m as preloadResources, n as createApp } from "../createApp-Ci7yG5gv.mjs";
|
|
3
3
|
import { runStorageContract } from "./storageContract.mjs";
|
|
4
4
|
import Fastify from "fastify";
|
|
5
5
|
import { afterAll, describe, expect, it, vi } from "vitest";
|
|
@@ -462,6 +462,73 @@ async function setupBetterAuthTestApp(input) {
|
|
|
462
462
|
};
|
|
463
463
|
}
|
|
464
464
|
//#endregion
|
|
465
|
+
//#region src/testing/bootModuleApp.ts
|
|
466
|
+
/**
|
|
467
|
+
* The built-in DB factory: in-memory MongoDB via lazy devDep imports.
|
|
468
|
+
* Everything Mongo-specific about the harness lives HERE — the harness
|
|
469
|
+
* itself is driver-blind and any kit can replace this via `database`.
|
|
470
|
+
*/
|
|
471
|
+
async function mongoMemoryDatabase(opts) {
|
|
472
|
+
let mms;
|
|
473
|
+
try {
|
|
474
|
+
mms = await import("mongodb-memory-server");
|
|
475
|
+
} catch {
|
|
476
|
+
throw new Error("[arc-testing] bootModuleApp's default database is in-memory MongoDB — install 'mongodb-memory-server' + 'mongoose' as devDependencies, or inject your own `database` factory for a different store");
|
|
477
|
+
}
|
|
478
|
+
const server = opts.replset ? await mms.MongoMemoryReplSet.create({ replSet: { count: 1 } }) : await mms.MongoMemoryServer.create();
|
|
479
|
+
const uri = server.getUri();
|
|
480
|
+
const mongoose = (await import("mongoose")).default;
|
|
481
|
+
if (mongoose.connection.readyState !== 0) await mongoose.disconnect();
|
|
482
|
+
await mongoose.connect(uri);
|
|
483
|
+
mongoose.connection.deleteModel(/.*/);
|
|
484
|
+
return {
|
|
485
|
+
uri,
|
|
486
|
+
connection: mongoose.connection,
|
|
487
|
+
teardown: async () => {
|
|
488
|
+
if (mongoose.connection.readyState !== 0) await mongoose.disconnect().catch(() => void 0);
|
|
489
|
+
await server.stop().catch(() => void 0);
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
async function bootModuleApp(modules, options = {}) {
|
|
494
|
+
const db = await (options.database ?? mongoMemoryDatabase)({ replset: options.replset ?? false });
|
|
495
|
+
const ctx = {
|
|
496
|
+
uri: db.uri,
|
|
497
|
+
mongoUri: db.uri,
|
|
498
|
+
connection: db.connection
|
|
499
|
+
};
|
|
500
|
+
const resolved = typeof modules === "function" ? await modules(ctx) : modules;
|
|
501
|
+
const list = Array.isArray(resolved) ? resolved : [resolved];
|
|
502
|
+
let app;
|
|
503
|
+
try {
|
|
504
|
+
app = await createApp({
|
|
505
|
+
preset: "testing",
|
|
506
|
+
auth: false,
|
|
507
|
+
sensible: false,
|
|
508
|
+
...options.app,
|
|
509
|
+
modules: list
|
|
510
|
+
});
|
|
511
|
+
await app.ready();
|
|
512
|
+
} catch (err) {
|
|
513
|
+
await db.teardown().catch(() => void 0);
|
|
514
|
+
throw err;
|
|
515
|
+
}
|
|
516
|
+
let closed = false;
|
|
517
|
+
return {
|
|
518
|
+
app,
|
|
519
|
+
uri: db.uri,
|
|
520
|
+
mongoUri: db.uri,
|
|
521
|
+
connection: db.connection,
|
|
522
|
+
exports: (name) => getModuleExports(app, name),
|
|
523
|
+
close: async () => {
|
|
524
|
+
if (closed) return;
|
|
525
|
+
closed = true;
|
|
526
|
+
await app.close().catch(() => void 0);
|
|
527
|
+
await db.teardown().catch(() => void 0);
|
|
528
|
+
}
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
//#endregion
|
|
465
532
|
//#region src/testing/fixtures.ts
|
|
466
533
|
function createTestFixtures() {
|
|
467
534
|
const registry = /* @__PURE__ */ new Map();
|
|
@@ -1049,7 +1116,7 @@ function pickDefaultAuth(authMode, callerAuth) {
|
|
|
1049
1116
|
};
|
|
1050
1117
|
}
|
|
1051
1118
|
async function createTestApp(options = {}) {
|
|
1052
|
-
const { createApp } = await import("../createApp-
|
|
1119
|
+
const { createApp } = await import("../createApp-Ci7yG5gv.mjs").then((n) => n.r);
|
|
1053
1120
|
const { resources = [], db = "in-memory", connectMongoose = false, authMode = "jwt", defaultOrgId, plugins, auth: callerAuth, ...appOptions } = options;
|
|
1054
1121
|
let dbHandle;
|
|
1055
1122
|
let dbUri;
|
|
@@ -1119,4 +1186,4 @@ function createMinimalTestApp(options = {}) {
|
|
|
1119
1186
|
});
|
|
1120
1187
|
}
|
|
1121
1188
|
//#endregion
|
|
1122
|
-
export { HttpTestHarness, createBetterAuthProvider, createBetterAuthTestHelpers, createCustomAuthProvider, createDataFactory, createHttpTestHarness, createJwtAuthProvider, createMinimalTestApp, createMockController, createMockReply, createMockRepository, createMockRequest, createMockUser, createSpy, createTestApp, createTestFixtures, createTestTimer, expectArc, preloadResources, preloadResourcesAsync, runStorageContract, safeParseBody, setupBetterAuthTestApp, waitFor };
|
|
1189
|
+
export { HttpTestHarness, bootModuleApp, createBetterAuthProvider, createBetterAuthTestHelpers, createCustomAuthProvider, createDataFactory, createHttpTestHarness, createJwtAuthProvider, createMinimalTestApp, createMockController, createMockReply, createMockRepository, createMockRequest, createMockUser, createSpy, createTestApp, createTestFixtures, createTestTimer, expectArc, mongoMemoryDatabase, preloadResources, preloadResourcesAsync, runStorageContract, safeParseBody, setupBetterAuthTestApp, waitFor };
|
package/dist/types/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { $ as
|
|
1
|
+
import { $ as OpenApiSchemas, $t as UserOrganization, A as RequestIdOptions, At as RouteDefinition, Bt as RouteHandler, C as RequestContext, D as HealthCheck, Dt as ActionEntry, E as GracefulShutdownOptions, Et as ActionDefinition, F as FastifyWithDecorators, Fn as BaseControllerOptions, Ft as ControllerLike, G as OnTenantDeleteConfig, Gt as JwtContext, H as CrudController, Ht as AuthPluginOptions, I as MiddlewareHandler, It as FastifyHandler, J as PresetHook, Jt as ApiResponse, K as ResolvedTenantPurge, Kt as TokenPair, L as RequestWithExtras, Lt as IController, M as EventsDecorator, Mt as RouteMethod, N as FastifyRequestExtras, Nt as RateLimitConfig, O as HealthOptions, Ot as ActionHandlerFn, P as FastifyWithAuth, Pt as ControllerHandler, Q as MiddlewareConfig, Qt as UserLike, Rt as IControllerResponse, S as QueryParserInterface, T as CrudRouterOptions, Tt as ResourceCacheConfig, U as ResourceConfig, Ut as Authenticator, Vt as AuthHelpers, W as ResourcePermissions, Wt as AuthenticatorContext, X as CrudRouteKey, Xt as JWTPayload, Y as PresetResult, Yt as ArcRequest, Z as CrudSchemas, Zt as ObjectId, _ as ControllerQueryOptions, a as InferAdapterDoc, at as ResourceExtensions, b as ParsedQuery, c as TypedController, d as PaginationResult, et as RouteSchemaOptions, f as IntrospectionData, g as ArcInternalMetadata, h as ResourceMetadata, i as ValidationResult, it as ResourceHooks, j as ArcDecorator, jt as RouteMcpConfig, k as IntrospectionPluginOptions, kt as ActionsMap, l as TypedRepository, m as RegistryStats, n as ConfigError, nt as FieldRule, o as InferDocType, ot as EventDefinition, p as RegistryEntry, q as PresetFunction, qt as AnyRecord, r as ValidateOptions, rt as ResourceHookContext, s as InferResourceDoc, t as RouteHandlerMethod, tt as ArcFieldRule, u as TypedResourceConfig, v as LookupOption, w as ServiceContext, x as PopulateOption, y as OwnershipCheck, zt as IRequestContext } from "../index-DbtgCOCj.mjs";
|
|
2
2
|
import { i as RequestScope } from "../types-DH0GupI7.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { i as UserBase, n as PermissionContext, r as PermissionResult, t as PermissionCheck } from "../types-Csxga7d3.mjs";
|
|
4
4
|
import { n as ElevationOptions, t as ElevationEvent } from "../elevation-C9s5hFP_.mjs";
|
|
5
5
|
export type { ActionDefinition, ActionEntry, ActionHandlerFn, ActionsMap, AnyRecord, ApiResponse, ArcDecorator, ArcFieldRule, ArcInternalMetadata, ArcRequest, AuthHelpers, AuthPluginOptions, Authenticator, AuthenticatorContext, BaseControllerOptions, ConfigError, ControllerHandler, ControllerLike, ControllerQueryOptions, CrudController, CrudRouteKey, CrudRouterOptions, CrudSchemas, ElevationEvent, ElevationOptions, EventDefinition, EventsDecorator, FastifyHandler, FastifyRequestExtras, FastifyWithAuth, FastifyWithDecorators, FieldRule, GracefulShutdownOptions, HealthCheck, HealthOptions, IController, IControllerResponse, IRequestContext, InferAdapterDoc, InferDocType, InferResourceDoc, IntrospectionData, IntrospectionPluginOptions, JWTPayload, JwtContext, LookupOption, MiddlewareConfig, MiddlewareHandler, ObjectId, OnTenantDeleteConfig, OpenApiSchemas, OwnershipCheck, PaginationResult, ParsedQuery, PermissionCheck, PermissionContext, PermissionResult, PopulateOption, PresetFunction, PresetHook, PresetResult, QueryParserInterface, RateLimitConfig, RegistryEntry, RegistryStats, RequestContext, RequestIdOptions, RequestScope, RequestWithExtras, ResolvedTenantPurge, ResourceCacheConfig, ResourceConfig, ResourceExtensions, ResourceHookContext, ResourceHooks, ResourceMetadata, ResourcePermissions, RouteDefinition, RouteHandler, RouteHandlerMethod, RouteMcpConfig, RouteMethod, RouteSchemaOptions, ServiceContext, TokenPair, TypedController, TypedRepository, TypedResourceConfig, UserBase, UserLike, UserOrganization, ValidateOptions, ValidationResult };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { V as ResourceDefinition } from "./index-
|
|
1
|
+
import { V as ResourceDefinition } from "./index-DbtgCOCj.mjs";
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
//#region src/integrations/mcp/types.d.ts
|
|
4
4
|
/** Behavioral hints for MCP clients (tool annotations per MCP spec) */
|