@lpdjs/firestore-repo-service 3.0.16 → 3.0.17

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.
@@ -1,70 +0,0 @@
1
- import { d as CrudRepoRegistry, O as OpenAPISpecOptions } from './types-CaCBG76r.js';
2
-
3
- /**
4
- * OpenAPI 3.1 specification generator for the CRUD server.
5
- *
6
- * Introspects each `CrudRepoEntry` and uses Zod 4's native `z.toJSONSchema()`
7
- * to produce a fully typed OpenAPI document ready for Scalar UI or codegen.
8
- *
9
- * @module servers/crud/openapi
10
- */
11
-
12
- /** Minimal subset of an OpenAPI 3.1 document we produce. */
13
- interface OpenAPIDocument {
14
- openapi: "3.1.0";
15
- info: OpenAPIInfo;
16
- servers?: {
17
- url: string;
18
- description?: string;
19
- }[];
20
- paths: Record<string, Record<string, OpenAPIOperation>>;
21
- components: {
22
- schemas: Record<string, Record<string, unknown>>;
23
- securitySchemes?: Record<string, Record<string, unknown>>;
24
- };
25
- security?: Record<string, string[]>[];
26
- tags?: {
27
- name: string;
28
- description?: string;
29
- }[];
30
- }
31
- interface OpenAPIInfo {
32
- title: string;
33
- version: string;
34
- description?: string;
35
- }
36
- interface OpenAPIOperation {
37
- operationId: string;
38
- summary: string;
39
- tags: string[];
40
- parameters?: Record<string, unknown>[];
41
- requestBody?: Record<string, unknown>;
42
- responses: Record<string, Record<string, unknown>>;
43
- security?: Record<string, string[]>[];
44
- }
45
- /**
46
- * Generate a full OpenAPI 3.1 specification from a `CrudRepoRegistry`.
47
- *
48
- * Uses Zod 4's native `z.toJSONSchema()` to convert each repo's schema
49
- * into a JSON Schema component, then assembles paths for the standard
50
- * CRUD endpoints.
51
- *
52
- * @example
53
- * ```ts
54
- * import { generateOpenAPISpec } from "@lpdjs/firestore-repo-service/servers/crud";
55
- *
56
- * const spec = generateOpenAPISpec(registry, "/api", {
57
- * title: "My API",
58
- * version: "1.0.0",
59
- * servers: [{ url: "https://my-api.example.com" }],
60
- * auth: "bearer",
61
- * });
62
- *
63
- * // Write to file
64
- * fs.writeFileSync("openapi.json", JSON.stringify(spec, null, 2));
65
- * ```
66
- */
67
- declare function generateOpenAPISpec(registry: CrudRepoRegistry, basePath: string, options?: OpenAPISpecOptions): OpenAPIDocument;
68
-
69
- export { generateOpenAPISpec as g };
70
- export type { OpenAPIDocument as O };
@@ -1,70 +0,0 @@
1
- import { d as CrudRepoRegistry, O as OpenAPISpecOptions } from './types-mKcJozu4.cjs';
2
-
3
- /**
4
- * OpenAPI 3.1 specification generator for the CRUD server.
5
- *
6
- * Introspects each `CrudRepoEntry` and uses Zod 4's native `z.toJSONSchema()`
7
- * to produce a fully typed OpenAPI document ready for Scalar UI or codegen.
8
- *
9
- * @module servers/crud/openapi
10
- */
11
-
12
- /** Minimal subset of an OpenAPI 3.1 document we produce. */
13
- interface OpenAPIDocument {
14
- openapi: "3.1.0";
15
- info: OpenAPIInfo;
16
- servers?: {
17
- url: string;
18
- description?: string;
19
- }[];
20
- paths: Record<string, Record<string, OpenAPIOperation>>;
21
- components: {
22
- schemas: Record<string, Record<string, unknown>>;
23
- securitySchemes?: Record<string, Record<string, unknown>>;
24
- };
25
- security?: Record<string, string[]>[];
26
- tags?: {
27
- name: string;
28
- description?: string;
29
- }[];
30
- }
31
- interface OpenAPIInfo {
32
- title: string;
33
- version: string;
34
- description?: string;
35
- }
36
- interface OpenAPIOperation {
37
- operationId: string;
38
- summary: string;
39
- tags: string[];
40
- parameters?: Record<string, unknown>[];
41
- requestBody?: Record<string, unknown>;
42
- responses: Record<string, Record<string, unknown>>;
43
- security?: Record<string, string[]>[];
44
- }
45
- /**
46
- * Generate a full OpenAPI 3.1 specification from a `CrudRepoRegistry`.
47
- *
48
- * Uses Zod 4's native `z.toJSONSchema()` to convert each repo's schema
49
- * into a JSON Schema component, then assembles paths for the standard
50
- * CRUD endpoints.
51
- *
52
- * @example
53
- * ```ts
54
- * import { generateOpenAPISpec } from "@lpdjs/firestore-repo-service/servers/crud";
55
- *
56
- * const spec = generateOpenAPISpec(registry, "/api", {
57
- * title: "My API",
58
- * version: "1.0.0",
59
- * servers: [{ url: "https://my-api.example.com" }],
60
- * auth: "bearer",
61
- * });
62
- *
63
- * // Write to file
64
- * fs.writeFileSync("openapi.json", JSON.stringify(spec, null, 2));
65
- * ```
66
- */
67
- declare function generateOpenAPISpec(registry: CrudRepoRegistry, basePath: string, options?: OpenAPISpecOptions): OpenAPIDocument;
68
-
69
- export { generateOpenAPISpec as g };
70
- export type { OpenAPIDocument as O };
@@ -1,30 +0,0 @@
1
- import { b as AuthUser } from './firebase-auth-nG3prKoj.js';
2
- import { D as DeepDiffReturn, k as RulesMap, f as CrudUpdateRuleContext } from './types-CaCBG76r.js';
3
-
4
- /**
5
- * Computes a typed diff between the existing document (`before`) and the incoming partial changes (`changesInput`).
6
- * Only fields whose values have actually changed (via structural equality) are included in `changes`.
7
- */
8
- declare function computeDeepDiff<T extends Record<string, unknown>>(before: T, changesInput: Partial<T>): DeepDiffReturn<T>;
9
- /**
10
- * Helper to define field-by-field before-rules with strong typing.
11
- */
12
- declare function createRules<T>(rules: RulesMap<T>): RulesMap<T>;
13
- /**
14
- * Executes a map of field rules against a computed diff.
15
- * Evaluates rules only for the keys that changed in `diff.changes`.
16
- * Returns `{ allowed: true }` if all rules pass, or `{ allowed: false, reason: rule.description }` on the first failure.
17
- */
18
- declare function applyRules<T>(diff: DeepDiffReturn<T>, rulesMap: RulesMap<T>, user?: AuthUser): Promise<{
19
- allowed: boolean;
20
- reason?: string;
21
- }>;
22
- /**
23
- * Wraps a rules map into a standard `rules.update` handler for `createCrudServer`.
24
- */
25
- declare function createBeforeRules<T>(rulesMap: RulesMap<T>): (ctx: CrudUpdateRuleContext<T>) => Promise<{
26
- allowed: boolean;
27
- reason?: string;
28
- }>;
29
-
30
- export { applyRules as a, createBeforeRules as b, computeDeepDiff as c, createRules as d };
@@ -1,30 +0,0 @@
1
- import { b as AuthUser } from './firebase-auth-nG3prKoj.cjs';
2
- import { D as DeepDiffReturn, k as RulesMap, f as CrudUpdateRuleContext } from './types-mKcJozu4.cjs';
3
-
4
- /**
5
- * Computes a typed diff between the existing document (`before`) and the incoming partial changes (`changesInput`).
6
- * Only fields whose values have actually changed (via structural equality) are included in `changes`.
7
- */
8
- declare function computeDeepDiff<T extends Record<string, unknown>>(before: T, changesInput: Partial<T>): DeepDiffReturn<T>;
9
- /**
10
- * Helper to define field-by-field before-rules with strong typing.
11
- */
12
- declare function createRules<T>(rules: RulesMap<T>): RulesMap<T>;
13
- /**
14
- * Executes a map of field rules against a computed diff.
15
- * Evaluates rules only for the keys that changed in `diff.changes`.
16
- * Returns `{ allowed: true }` if all rules pass, or `{ allowed: false, reason: rule.description }` on the first failure.
17
- */
18
- declare function applyRules<T>(diff: DeepDiffReturn<T>, rulesMap: RulesMap<T>, user?: AuthUser): Promise<{
19
- allowed: boolean;
20
- reason?: string;
21
- }>;
22
- /**
23
- * Wraps a rules map into a standard `rules.update` handler for `createCrudServer`.
24
- */
25
- declare function createBeforeRules<T>(rulesMap: RulesMap<T>): (ctx: CrudUpdateRuleContext<T>) => Promise<{
26
- allowed: boolean;
27
- reason?: string;
28
- }>;
29
-
30
- export { applyRules as a, createBeforeRules as b, computeDeepDiff as c, createRules as d };