@lpdjs/firestore-repo-service 2.6.30 → 2.6.31
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/{create-servers-C3CIViuc.d.cts → create-servers-DlVgnO_m.d.cts} +3 -3
- package/dist/{create-servers-O2stZ-yF.d.ts → create-servers-n4q5BhVK.d.ts} +3 -3
- package/dist/{index-D0KRndyL.d.cts → index-BfTEw4r1.d.cts} +1 -1
- package/dist/{index-TTSjUi4p.d.ts → index-Da_8eLPb.d.ts} +1 -1
- package/dist/index.cjs +26 -26
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +25 -11
- package/dist/index.d.ts +25 -11
- package/dist/index.js +26 -26
- package/dist/index.js.map +1 -1
- package/dist/llms-full.txt +14 -8
- package/dist/llms.txt +1 -1
- package/dist/{openapi-BdatGOqK.d.cts → openapi-BHW1HViI.d.cts} +1 -1
- package/dist/{openapi-uTAic4s0.d.ts → openapi-BupSdudk.d.ts} +1 -1
- package/dist/servers/admin/index.d.cts +2 -2
- package/dist/servers/admin/index.d.ts +2 -2
- package/dist/servers/crud/index.d.cts +4 -4
- package/dist/servers/crud/index.d.ts +4 -4
- package/dist/servers/index.d.cts +5 -5
- package/dist/servers/index.d.ts +5 -5
- package/dist/{types-wzqw45jH.d.ts → types-BcT92G9B.d.ts} +12 -7
- package/dist/{types-Qd4tuEq9.d.cts → types-CpkQQn4b.d.cts} +12 -7
- package/package.json +1 -1
package/dist/llms-full.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @lpdjs/firestore-repo-service (v2.6.
|
|
1
|
+
# @lpdjs/firestore-repo-service (v2.6.31) — full documentation
|
|
2
2
|
|
|
3
3
|
> ⚡ Type-safe Firestore ORM with auto-generated repositories, advanced queries, relations with typed select, pagination with include, batch/bulk operations, aggregations and transactions.
|
|
4
4
|
|
|
@@ -315,16 +315,21 @@ Returns `{ scanned, written, skipped, failures }`.
|
|
|
315
315
|
```typescript
|
|
316
316
|
const mappingWithRelations = buildRepositoryRelations(repositoryMapping, {
|
|
317
317
|
users: {
|
|
318
|
-
docId: { repo: "posts", key: "userId", type: "many"
|
|
318
|
+
docId: { repo: "posts", key: "userId", type: "many" },
|
|
319
319
|
},
|
|
320
320
|
posts: {
|
|
321
|
-
userId: { repo: "users", key: "docId", type: "one"
|
|
322
|
-
docId: { repo: "comments", key: "postId", type: "many"
|
|
321
|
+
userId: { repo: "users", key: "docId", type: "one" },
|
|
322
|
+
docId: { repo: "comments", key: "postId", type: "many" },
|
|
323
323
|
},
|
|
324
324
|
comments: {
|
|
325
|
-
postId: { repo: "posts", key: "docId", type: "one"
|
|
326
|
-
userId: { repo: "users", key: "docId", type: "one"
|
|
325
|
+
postId: { repo: "posts", key: "docId", type: "one" },
|
|
326
|
+
userId: { repo: "users", key: "docId", type: "one" },
|
|
327
327
|
},
|
|
328
|
+
residences: {
|
|
329
|
+
// Multiple relations originating from the same source field
|
|
330
|
+
events: { repo: "events", key: "residenceId", type: "many", sourceKey: "docId" },
|
|
331
|
+
quotes: { repo: "quotes", key: "residenceId", type: "many", sourceKey: "docId" }
|
|
332
|
+
}
|
|
328
333
|
});
|
|
329
334
|
```
|
|
330
335
|
|
|
@@ -334,8 +339,9 @@ Each entry maps a field in the source model to a target repository:
|
|
|
334
339
|
|----------------|------------------------------------------------|
|
|
335
340
|
| `repo` | Name of the target repository |
|
|
336
341
|
| `key` | Field on the target repo used for the lookup |
|
|
337
|
-
| `type: "one"` | The
|
|
338
|
-
| `type: "many"` | The
|
|
342
|
+
| `type: "one"` | The target key must exist in `foreignKeys` → returns one doc |
|
|
343
|
+
| `type: "many"` | The target key must exist in `queryKeys` → returns array |
|
|
344
|
+
| `sourceKey` | Optional. Field in the current document containing the value to look up (required if the relation name is not a valid model key) |
|
|
339
345
|
|
|
340
346
|
## `populate()` — on a single document
|
|
341
347
|
|
package/dist/llms.txt
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @lpdjs/firestore-repo-service (v2.6.
|
|
1
|
+
# @lpdjs/firestore-repo-service (v2.6.31)
|
|
2
2
|
|
|
3
3
|
> ⚡ Type-safe Firestore ORM with auto-generated repositories, advanced queries, relations with typed select, pagination with include, batch/bulk operations, aggregations and transactions.
|
|
4
4
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'zod';
|
|
2
2
|
import 'firebase-functions/v2/https';
|
|
3
|
-
import '../../types-
|
|
3
|
+
import '../../types-CpkQQn4b.cjs';
|
|
4
4
|
export { h as Middleware, M as MiniRouter, R as RouteHandler } from '../../firebase-auth-DZ8lb2Ec.cjs';
|
|
5
|
-
export { a as AdminRepoConfig, b as AdminRepoEntry, A as AdminServerOptions, B as BasicAuthConfig, c as RepoRegistry, d as createAdminServer } from '../../index-
|
|
5
|
+
export { a as AdminRepoConfig, b as AdminRepoEntry, A as AdminServerOptions, B as BasicAuthConfig, c as RepoRegistry, d as createAdminServer } from '../../index-BfTEw4r1.cjs';
|
|
6
6
|
import '../../read-CTWZjxyh.cjs';
|
|
7
7
|
import 'firebase-admin/firestore';
|
|
8
8
|
import 'firebase-functions/v2/firestore';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'zod';
|
|
2
2
|
import 'firebase-functions/v2/https';
|
|
3
|
-
import '../../types-
|
|
3
|
+
import '../../types-BcT92G9B.js';
|
|
4
4
|
export { h as Middleware, M as MiniRouter, R as RouteHandler } from '../../firebase-auth-DZ8lb2Ec.js';
|
|
5
|
-
export { a as AdminRepoConfig, b as AdminRepoEntry, A as AdminServerOptions, B as BasicAuthConfig, c as RepoRegistry, d as createAdminServer } from '../../index-
|
|
5
|
+
export { a as AdminRepoConfig, b as AdminRepoEntry, A as AdminServerOptions, B as BasicAuthConfig, c as RepoRegistry, d as createAdminServer } from '../../index-Da_8eLPb.js';
|
|
6
6
|
import '../../read-CTWZjxyh.js';
|
|
7
7
|
import 'firebase-admin/firestore';
|
|
8
8
|
import 'firebase-functions/v2/firestore';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HttpsOptions } from 'firebase-functions/v2/https';
|
|
2
|
-
import { C as ConfiguredRepository, a as CrudServerOptions } from '../../types-
|
|
3
|
-
export { A as ApiResponse, B as BasicAuthConfig, b as CrudRepoConfig, c as CrudRepoEntry, d as CrudRepoRegistry, F as FieldRole, L as ListResponseData, M as Middleware, O as OpenAPISpecOptions, Q as QueryRequestBody, R as RepoFieldPath, e as RepoRelationKeys, U as UserFieldPath } from '../../types-
|
|
4
|
-
import { O as OpenAPIDocument } from '../../openapi-
|
|
5
|
-
export { g as generateOpenAPISpec } from '../../openapi-
|
|
2
|
+
import { C as ConfiguredRepository, a as CrudServerOptions } from '../../types-CpkQQn4b.cjs';
|
|
3
|
+
export { A as ApiResponse, B as BasicAuthConfig, b as CrudRepoConfig, c as CrudRepoEntry, d as CrudRepoRegistry, F as FieldRole, L as ListResponseData, M as Middleware, O as OpenAPISpecOptions, Q as QueryRequestBody, R as RepoFieldPath, e as RepoRelationKeys, U as UserFieldPath } from '../../types-CpkQQn4b.cjs';
|
|
4
|
+
import { O as OpenAPIDocument } from '../../openapi-BHW1HViI.cjs';
|
|
5
|
+
export { g as generateOpenAPISpec } from '../../openapi-BHW1HViI.cjs';
|
|
6
6
|
import '../../firebase-auth-DZ8lb2Ec.cjs';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import '../../read-CTWZjxyh.cjs';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { HttpsOptions } from 'firebase-functions/v2/https';
|
|
2
|
-
import { C as ConfiguredRepository, a as CrudServerOptions } from '../../types-
|
|
3
|
-
export { A as ApiResponse, B as BasicAuthConfig, b as CrudRepoConfig, c as CrudRepoEntry, d as CrudRepoRegistry, F as FieldRole, L as ListResponseData, M as Middleware, O as OpenAPISpecOptions, Q as QueryRequestBody, R as RepoFieldPath, e as RepoRelationKeys, U as UserFieldPath } from '../../types-
|
|
4
|
-
import { O as OpenAPIDocument } from '../../openapi-
|
|
5
|
-
export { g as generateOpenAPISpec } from '../../openapi-
|
|
2
|
+
import { C as ConfiguredRepository, a as CrudServerOptions } from '../../types-BcT92G9B.js';
|
|
3
|
+
export { A as ApiResponse, B as BasicAuthConfig, b as CrudRepoConfig, c as CrudRepoEntry, d as CrudRepoRegistry, F as FieldRole, L as ListResponseData, M as Middleware, O as OpenAPISpecOptions, Q as QueryRequestBody, R as RepoFieldPath, e as RepoRelationKeys, U as UserFieldPath } from '../../types-BcT92G9B.js';
|
|
4
|
+
import { O as OpenAPIDocument } from '../../openapi-BupSdudk.js';
|
|
5
|
+
export { g as generateOpenAPISpec } from '../../openapi-BupSdudk.js';
|
|
6
6
|
import '../../firebase-auth-DZ8lb2Ec.js';
|
|
7
7
|
import 'zod';
|
|
8
8
|
import '../../read-CTWZjxyh.js';
|
package/dist/servers/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BoundAdminRepoConfig, a as BoundAdminServerOptions, b as BoundCrudRepoConfig, d as BoundCrudServerOptions, e as BoundFirestoreSyncConfig, C as CreateServersDeps, c as createServers } from '../create-servers-
|
|
2
|
-
import { P as PageOptions, C as ColumnMeta, F as FilterState, R as RelationalFieldMeta, S as SortState, Q as QueryError } from '../index-
|
|
3
|
-
export { a as AdminRepoConfig, b as AdminRepoEntry, A as AdminServerOptions, B as BasicAuthConfig, c as RepoRegistry } from '../index-
|
|
4
|
-
export { A as ApiResponse, b as CrudRepoConfig, c as CrudRepoEntry, d as CrudRepoRegistry, a as CrudServerOptions, D as DEFAULT_HTML_CSP, F as FieldRole, L as ListResponseData, Q as QueryRequestBody, R as RepoFieldPath, e as RepoRelationKeys, S as SecurityHeadersOptions, U as UserFieldPath, s as securityHeaders } from '../types-
|
|
1
|
+
export { B as BoundAdminRepoConfig, a as BoundAdminServerOptions, b as BoundCrudRepoConfig, d as BoundCrudServerOptions, e as BoundFirestoreSyncConfig, C as CreateServersDeps, c as createServers } from '../create-servers-DlVgnO_m.cjs';
|
|
2
|
+
import { P as PageOptions, C as ColumnMeta, F as FilterState, R as RelationalFieldMeta, S as SortState, Q as QueryError } from '../index-BfTEw4r1.cjs';
|
|
3
|
+
export { a as AdminRepoConfig, b as AdminRepoEntry, A as AdminServerOptions, B as BasicAuthConfig, c as RepoRegistry } from '../index-BfTEw4r1.cjs';
|
|
4
|
+
export { A as ApiResponse, b as CrudRepoConfig, c as CrudRepoEntry, d as CrudRepoRegistry, a as CrudServerOptions, D as DEFAULT_HTML_CSP, F as FieldRole, L as ListResponseData, Q as QueryRequestBody, R as RepoFieldPath, e as RepoRelationKeys, S as SecurityHeadersOptions, U as UserFieldPath, s as securityHeaders } from '../types-CpkQQn4b.cjs';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
export { h as Middleware, M as MiniRouter, R as RouteHandler } from '../firebase-auth-DZ8lb2Ec.cjs';
|
|
7
7
|
import * as hono_jsx_jsx_dev_runtime from 'hono/jsx/jsx-dev-runtime';
|
|
@@ -10,7 +10,7 @@ import '../types-BwH1C-wi.cjs';
|
|
|
10
10
|
import 'firebase-functions/v2/firestore';
|
|
11
11
|
import 'firebase-functions/v2/https';
|
|
12
12
|
import 'firebase-functions/v2/pubsub';
|
|
13
|
-
import '../openapi-
|
|
13
|
+
import '../openapi-BHW1HViI.cjs';
|
|
14
14
|
import '../read-CTWZjxyh.cjs';
|
|
15
15
|
import 'firebase-admin/firestore';
|
|
16
16
|
|
package/dist/servers/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export { B as BoundAdminRepoConfig, a as BoundAdminServerOptions, b as BoundCrudRepoConfig, d as BoundCrudServerOptions, e as BoundFirestoreSyncConfig, C as CreateServersDeps, c as createServers } from '../create-servers-
|
|
2
|
-
import { P as PageOptions, C as ColumnMeta, F as FilterState, R as RelationalFieldMeta, S as SortState, Q as QueryError } from '../index-
|
|
3
|
-
export { a as AdminRepoConfig, b as AdminRepoEntry, A as AdminServerOptions, B as BasicAuthConfig, c as RepoRegistry } from '../index-
|
|
4
|
-
export { A as ApiResponse, b as CrudRepoConfig, c as CrudRepoEntry, d as CrudRepoRegistry, a as CrudServerOptions, D as DEFAULT_HTML_CSP, F as FieldRole, L as ListResponseData, Q as QueryRequestBody, R as RepoFieldPath, e as RepoRelationKeys, S as SecurityHeadersOptions, U as UserFieldPath, s as securityHeaders } from '../types-
|
|
1
|
+
export { B as BoundAdminRepoConfig, a as BoundAdminServerOptions, b as BoundCrudRepoConfig, d as BoundCrudServerOptions, e as BoundFirestoreSyncConfig, C as CreateServersDeps, c as createServers } from '../create-servers-n4q5BhVK.js';
|
|
2
|
+
import { P as PageOptions, C as ColumnMeta, F as FilterState, R as RelationalFieldMeta, S as SortState, Q as QueryError } from '../index-Da_8eLPb.js';
|
|
3
|
+
export { a as AdminRepoConfig, b as AdminRepoEntry, A as AdminServerOptions, B as BasicAuthConfig, c as RepoRegistry } from '../index-Da_8eLPb.js';
|
|
4
|
+
export { A as ApiResponse, b as CrudRepoConfig, c as CrudRepoEntry, d as CrudRepoRegistry, a as CrudServerOptions, D as DEFAULT_HTML_CSP, F as FieldRole, L as ListResponseData, Q as QueryRequestBody, R as RepoFieldPath, e as RepoRelationKeys, S as SecurityHeadersOptions, U as UserFieldPath, s as securityHeaders } from '../types-BcT92G9B.js';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
export { h as Middleware, M as MiniRouter, R as RouteHandler } from '../firebase-auth-DZ8lb2Ec.js';
|
|
7
7
|
import * as hono_jsx_jsx_dev_runtime from 'hono/jsx/jsx-dev-runtime';
|
|
@@ -10,7 +10,7 @@ import '../types-DT7Nypd_.js';
|
|
|
10
10
|
import 'firebase-functions/v2/firestore';
|
|
11
11
|
import 'firebase-functions/v2/https';
|
|
12
12
|
import 'firebase-functions/v2/pubsub';
|
|
13
|
-
import '../openapi-
|
|
13
|
+
import '../openapi-BupSdudk.js';
|
|
14
14
|
import '../read-CTWZjxyh.js';
|
|
15
15
|
import 'firebase-admin/firestore';
|
|
16
16
|
|
|
@@ -133,6 +133,7 @@ interface RelationConfig<TRepoKey extends string = string, TForeignKey extends s
|
|
|
133
133
|
repo: TRepoKey;
|
|
134
134
|
key: TForeignKey;
|
|
135
135
|
type: TType;
|
|
136
|
+
sourceKey?: string;
|
|
136
137
|
targetType?: TTargetModel;
|
|
137
138
|
}
|
|
138
139
|
/**
|
|
@@ -141,17 +142,21 @@ interface RelationConfig<TRepoKey extends string = string, TForeignKey extends s
|
|
|
141
142
|
* @template T - Current model type
|
|
142
143
|
* @template TMapping - All repositories mapping for validation
|
|
143
144
|
* @example { userId: { repo: "users", key: "docId", type: "one" } }
|
|
144
|
-
*
|
|
145
|
-
* IMPORTANT: Keys must exist in T (the current model)
|
|
146
|
-
* This prevents creating relations on non-existent fields
|
|
145
|
+
* @example { events: { repo: "events", key: "residenceId", type: "many", sourceKey: "docId" } }
|
|
147
146
|
*/
|
|
148
147
|
type RelationalKeys<T = any, TMapping = any> = {
|
|
149
|
-
[K in
|
|
150
|
-
[R in keyof TMapping]: TMapping[R] extends RepositoryConfig<any, infer FKeys, any, any, any, any, any, any, any, any, any> ? {
|
|
148
|
+
[K in string]?: TMapping extends Record<string, any> ? {
|
|
149
|
+
[R in keyof TMapping]: TMapping[R] extends RepositoryConfig<any, infer FKeys extends readonly any[], infer QKeys extends readonly any[], any, any, any, any, any, any, any, any> ? ({
|
|
151
150
|
repo: R;
|
|
152
151
|
key: FKeys[number];
|
|
153
|
-
type: "one"
|
|
154
|
-
|
|
152
|
+
type: "one";
|
|
153
|
+
sourceKey?: keyof T;
|
|
154
|
+
} | {
|
|
155
|
+
repo: R;
|
|
156
|
+
key: QKeys[number];
|
|
157
|
+
type: "many";
|
|
158
|
+
sourceKey?: keyof T;
|
|
159
|
+
}) : never;
|
|
155
160
|
}[keyof TMapping] : RelationConfig;
|
|
156
161
|
};
|
|
157
162
|
/**
|
|
@@ -133,6 +133,7 @@ interface RelationConfig<TRepoKey extends string = string, TForeignKey extends s
|
|
|
133
133
|
repo: TRepoKey;
|
|
134
134
|
key: TForeignKey;
|
|
135
135
|
type: TType;
|
|
136
|
+
sourceKey?: string;
|
|
136
137
|
targetType?: TTargetModel;
|
|
137
138
|
}
|
|
138
139
|
/**
|
|
@@ -141,17 +142,21 @@ interface RelationConfig<TRepoKey extends string = string, TForeignKey extends s
|
|
|
141
142
|
* @template T - Current model type
|
|
142
143
|
* @template TMapping - All repositories mapping for validation
|
|
143
144
|
* @example { userId: { repo: "users", key: "docId", type: "one" } }
|
|
144
|
-
*
|
|
145
|
-
* IMPORTANT: Keys must exist in T (the current model)
|
|
146
|
-
* This prevents creating relations on non-existent fields
|
|
145
|
+
* @example { events: { repo: "events", key: "residenceId", type: "many", sourceKey: "docId" } }
|
|
147
146
|
*/
|
|
148
147
|
type RelationalKeys<T = any, TMapping = any> = {
|
|
149
|
-
[K in
|
|
150
|
-
[R in keyof TMapping]: TMapping[R] extends RepositoryConfig<any, infer FKeys, any, any, any, any, any, any, any, any, any> ? {
|
|
148
|
+
[K in string]?: TMapping extends Record<string, any> ? {
|
|
149
|
+
[R in keyof TMapping]: TMapping[R] extends RepositoryConfig<any, infer FKeys extends readonly any[], infer QKeys extends readonly any[], any, any, any, any, any, any, any, any> ? ({
|
|
151
150
|
repo: R;
|
|
152
151
|
key: FKeys[number];
|
|
153
|
-
type: "one"
|
|
154
|
-
|
|
152
|
+
type: "one";
|
|
153
|
+
sourceKey?: keyof T;
|
|
154
|
+
} | {
|
|
155
|
+
repo: R;
|
|
156
|
+
key: QKeys[number];
|
|
157
|
+
type: "many";
|
|
158
|
+
sourceKey?: keyof T;
|
|
159
|
+
}) : never;
|
|
155
160
|
}[keyof TMapping] : RelationConfig;
|
|
156
161
|
};
|
|
157
162
|
/**
|