@lpdjs/firestore-repo-service 2.2.2 → 2.2.4
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/{index-KbSSRIWJ.d.cts → index-B3-vAYx0.d.cts} +5 -2
- package/dist/{index-BnXFmcVp.d.ts → index-BiWZwHS_.d.ts} +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js.map +1 -1
- package/dist/servers/admin/index.cjs.map +1 -1
- package/dist/servers/admin/index.d.cts +2 -2
- package/dist/servers/admin/index.d.ts +2 -2
- package/dist/servers/admin/index.js.map +1 -1
- package/dist/servers/crud/index.cjs.map +1 -1
- package/dist/servers/crud/index.d.cts +69 -3
- package/dist/servers/crud/index.d.ts +69 -3
- package/dist/servers/crud/index.js.map +1 -1
- package/dist/servers/index.cjs.map +1 -1
- package/dist/servers/index.d.cts +3 -3
- package/dist/servers/index.d.ts +3 -3
- package/dist/servers/index.js.map +1 -1
- package/dist/{types-B5NdBY1Z.d.cts → types-Z9Qy8Xmx.d.cts} +12 -70
- package/dist/{types-B5NdBY1Z.d.ts → types-Z9Qy8Xmx.d.ts} +12 -70
- package/package.json +1 -1
|
@@ -1,9 +1,75 @@
|
|
|
1
1
|
import { HttpsOptions } from 'firebase-functions/v2/https';
|
|
2
|
-
import {
|
|
3
|
-
export { A as ApiResponse, B as BasicAuthConfig, l as CrudRepoConfig, r as CrudRepoEntry,
|
|
2
|
+
import { s as CrudRepoRegistry, O as OpenAPISpecOptions, C as ConfiguredRepository, m as CrudServerOptions } from '../../types-Z9Qy8Xmx.cjs';
|
|
3
|
+
export { A as ApiResponse, B as BasicAuthConfig, l as CrudRepoConfig, r as CrudRepoEntry, n as FieldRole, L as ListResponseData, M as Middleware, o as QueryRequestBody, p as RepoFieldPath, q as RepoRelationKeys, U as UserFieldPath } from '../../types-Z9Qy8Xmx.cjs';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import 'firebase-admin/firestore';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* OpenAPI 3.1 specification generator for the CRUD server.
|
|
9
|
+
*
|
|
10
|
+
* Introspects each `CrudRepoEntry` and uses Zod 4's native `z.toJSONSchema()`
|
|
11
|
+
* to produce a fully typed OpenAPI document ready for Scalar UI or codegen.
|
|
12
|
+
*
|
|
13
|
+
* @module servers/crud/openapi
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Minimal subset of an OpenAPI 3.1 document we produce. */
|
|
17
|
+
interface OpenAPIDocument {
|
|
18
|
+
openapi: "3.1.0";
|
|
19
|
+
info: OpenAPIInfo;
|
|
20
|
+
servers?: {
|
|
21
|
+
url: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
}[];
|
|
24
|
+
paths: Record<string, Record<string, OpenAPIOperation>>;
|
|
25
|
+
components: {
|
|
26
|
+
schemas: Record<string, Record<string, unknown>>;
|
|
27
|
+
securitySchemes?: Record<string, Record<string, unknown>>;
|
|
28
|
+
};
|
|
29
|
+
security?: Record<string, string[]>[];
|
|
30
|
+
tags?: {
|
|
31
|
+
name: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
}[];
|
|
34
|
+
}
|
|
35
|
+
interface OpenAPIInfo {
|
|
36
|
+
title: string;
|
|
37
|
+
version: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
}
|
|
40
|
+
interface OpenAPIOperation {
|
|
41
|
+
operationId: string;
|
|
42
|
+
summary: string;
|
|
43
|
+
tags: string[];
|
|
44
|
+
parameters?: Record<string, unknown>[];
|
|
45
|
+
requestBody?: Record<string, unknown>;
|
|
46
|
+
responses: Record<string, Record<string, unknown>>;
|
|
47
|
+
security?: Record<string, string[]>[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Generate a full OpenAPI 3.1 specification from a `CrudRepoRegistry`.
|
|
51
|
+
*
|
|
52
|
+
* Uses Zod 4's native `z.toJSONSchema()` to convert each repo's schema
|
|
53
|
+
* into a JSON Schema component, then assembles paths for the standard
|
|
54
|
+
* CRUD endpoints.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { generateOpenAPISpec } from "@lpdjs/firestore-repo-service/servers/crud";
|
|
59
|
+
*
|
|
60
|
+
* const spec = generateOpenAPISpec(registry, "/api", {
|
|
61
|
+
* title: "My API",
|
|
62
|
+
* version: "1.0.0",
|
|
63
|
+
* servers: [{ url: "https://my-api.example.com" }],
|
|
64
|
+
* auth: "bearer",
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* // Write to file
|
|
68
|
+
* fs.writeFileSync("openapi.json", JSON.stringify(spec, null, 2));
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare function generateOpenAPISpec(registry: CrudRepoRegistry, basePath: string, options?: OpenAPISpecOptions): OpenAPIDocument;
|
|
72
|
+
|
|
7
73
|
/**
|
|
8
74
|
* @module servers/crud
|
|
9
75
|
*
|
|
@@ -181,4 +247,4 @@ declare function createCrudServer<TRepos extends Record<string, ConfiguredReposi
|
|
|
181
247
|
httpsOptions?: HttpsOptions;
|
|
182
248
|
};
|
|
183
249
|
|
|
184
|
-
export { CrudServerOptions, OpenAPIDocument, createCrudServer };
|
|
250
|
+
export { CrudRepoRegistry, CrudServerOptions, type OpenAPIDocument, OpenAPISpecOptions, createCrudServer, generateOpenAPISpec };
|
|
@@ -1,9 +1,75 @@
|
|
|
1
1
|
import { HttpsOptions } from 'firebase-functions/v2/https';
|
|
2
|
-
import {
|
|
3
|
-
export { A as ApiResponse, B as BasicAuthConfig, l as CrudRepoConfig, r as CrudRepoEntry,
|
|
2
|
+
import { s as CrudRepoRegistry, O as OpenAPISpecOptions, C as ConfiguredRepository, m as CrudServerOptions } from '../../types-Z9Qy8Xmx.js';
|
|
3
|
+
export { A as ApiResponse, B as BasicAuthConfig, l as CrudRepoConfig, r as CrudRepoEntry, n as FieldRole, L as ListResponseData, M as Middleware, o as QueryRequestBody, p as RepoFieldPath, q as RepoRelationKeys, U as UserFieldPath } from '../../types-Z9Qy8Xmx.js';
|
|
4
4
|
import 'zod';
|
|
5
5
|
import 'firebase-admin/firestore';
|
|
6
6
|
|
|
7
|
+
/**
|
|
8
|
+
* OpenAPI 3.1 specification generator for the CRUD server.
|
|
9
|
+
*
|
|
10
|
+
* Introspects each `CrudRepoEntry` and uses Zod 4's native `z.toJSONSchema()`
|
|
11
|
+
* to produce a fully typed OpenAPI document ready for Scalar UI or codegen.
|
|
12
|
+
*
|
|
13
|
+
* @module servers/crud/openapi
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
/** Minimal subset of an OpenAPI 3.1 document we produce. */
|
|
17
|
+
interface OpenAPIDocument {
|
|
18
|
+
openapi: "3.1.0";
|
|
19
|
+
info: OpenAPIInfo;
|
|
20
|
+
servers?: {
|
|
21
|
+
url: string;
|
|
22
|
+
description?: string;
|
|
23
|
+
}[];
|
|
24
|
+
paths: Record<string, Record<string, OpenAPIOperation>>;
|
|
25
|
+
components: {
|
|
26
|
+
schemas: Record<string, Record<string, unknown>>;
|
|
27
|
+
securitySchemes?: Record<string, Record<string, unknown>>;
|
|
28
|
+
};
|
|
29
|
+
security?: Record<string, string[]>[];
|
|
30
|
+
tags?: {
|
|
31
|
+
name: string;
|
|
32
|
+
description?: string;
|
|
33
|
+
}[];
|
|
34
|
+
}
|
|
35
|
+
interface OpenAPIInfo {
|
|
36
|
+
title: string;
|
|
37
|
+
version: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
}
|
|
40
|
+
interface OpenAPIOperation {
|
|
41
|
+
operationId: string;
|
|
42
|
+
summary: string;
|
|
43
|
+
tags: string[];
|
|
44
|
+
parameters?: Record<string, unknown>[];
|
|
45
|
+
requestBody?: Record<string, unknown>;
|
|
46
|
+
responses: Record<string, Record<string, unknown>>;
|
|
47
|
+
security?: Record<string, string[]>[];
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Generate a full OpenAPI 3.1 specification from a `CrudRepoRegistry`.
|
|
51
|
+
*
|
|
52
|
+
* Uses Zod 4's native `z.toJSONSchema()` to convert each repo's schema
|
|
53
|
+
* into a JSON Schema component, then assembles paths for the standard
|
|
54
|
+
* CRUD endpoints.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* import { generateOpenAPISpec } from "@lpdjs/firestore-repo-service/servers/crud";
|
|
59
|
+
*
|
|
60
|
+
* const spec = generateOpenAPISpec(registry, "/api", {
|
|
61
|
+
* title: "My API",
|
|
62
|
+
* version: "1.0.0",
|
|
63
|
+
* servers: [{ url: "https://my-api.example.com" }],
|
|
64
|
+
* auth: "bearer",
|
|
65
|
+
* });
|
|
66
|
+
*
|
|
67
|
+
* // Write to file
|
|
68
|
+
* fs.writeFileSync("openapi.json", JSON.stringify(spec, null, 2));
|
|
69
|
+
* ```
|
|
70
|
+
*/
|
|
71
|
+
declare function generateOpenAPISpec(registry: CrudRepoRegistry, basePath: string, options?: OpenAPISpecOptions): OpenAPIDocument;
|
|
72
|
+
|
|
7
73
|
/**
|
|
8
74
|
* @module servers/crud
|
|
9
75
|
*
|
|
@@ -181,4 +247,4 @@ declare function createCrudServer<TRepos extends Record<string, ConfiguredReposi
|
|
|
181
247
|
httpsOptions?: HttpsOptions;
|
|
182
248
|
};
|
|
183
249
|
|
|
184
|
-
export { CrudServerOptions, OpenAPIDocument, createCrudServer };
|
|
250
|
+
export { CrudRepoRegistry, CrudServerOptions, type OpenAPIDocument, OpenAPISpecOptions, createCrudServer, generateOpenAPISpec };
|