@lpdjs/firestore-repo-service 2.2.6 → 2.2.8
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-DmggzSb3.d.cts → create-servers-BGtAS0oG.d.cts} +3 -3
- package/dist/{create-servers-D4-NGpKm.d.ts → create-servers-DMszgNtg.d.ts} +3 -3
- package/dist/history/index.cjs +2 -0
- package/dist/history/index.cjs.map +1 -0
- package/dist/history/index.d.cts +126 -0
- package/dist/history/index.d.ts +126 -0
- package/dist/history/index.js +2 -0
- package/dist/history/index.js.map +1 -0
- package/dist/{index-Cvip2Sgt.d.ts → index-BSZP0Gz9.d.ts} +3 -3
- package/dist/{index-DpD4DEqH.d.cts → index-D7oj3Pft.d.cts} +3 -3
- package/dist/index.cjs +120 -102
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +21 -12
- package/dist/index.d.ts +21 -12
- package/dist/index.js +120 -102
- package/dist/index.js.map +1 -1
- package/dist/{openapi-B3P2F8op.d.ts → openapi-BdqIkSjO.d.ts} +1 -1
- package/dist/{openapi-UJJ1aCFk.d.cts → openapi-lY43PZXy.d.cts} +1 -1
- package/dist/read-DfXXxhO4.d.cts +230 -0
- package/dist/read-DfXXxhO4.d.ts +230 -0
- package/dist/servers/admin/index.cjs +31 -13
- package/dist/servers/admin/index.cjs.map +1 -1
- package/dist/servers/admin/index.d.cts +4 -2
- package/dist/servers/admin/index.d.ts +4 -2
- package/dist/servers/admin/index.js +31 -13
- package/dist/servers/admin/index.js.map +1 -1
- package/dist/servers/crud/index.d.cts +6 -4
- package/dist/servers/crud/index.d.ts +6 -4
- package/dist/servers/index.cjs +33 -15
- package/dist/servers/index.cjs.map +1 -1
- package/dist/servers/index.d.cts +6 -5
- package/dist/servers/index.d.ts +6 -5
- package/dist/servers/index.js +33 -15
- package/dist/servers/index.js.map +1 -1
- package/dist/{types-Z9Qy8Xmx.d.ts → types-BESS89Fu.d.cts} +30 -12
- package/dist/{types-Z9Qy8Xmx.d.cts → types-BVUFVcpl.d.ts} +30 -12
- package/package.json +17 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { H as HistoryConfigForModel } from './read-DfXXxhO4.cjs';
|
|
1
2
|
import { Query, QuerySnapshot, Firestore } from 'firebase-admin/firestore';
|
|
2
3
|
import { z } from 'zod';
|
|
3
|
-
import { Q as QueryOptions, P as PaginationOptions, R as RepositoryConfig, a as RelationConfig, C as ConfiguredRepository } from './types-
|
|
4
|
-
export { A as ApiResponse, l as CrudRepoConfig, m as CrudServerOptions, E as ExtractDocumentRefSignature, b as ExtractUpdateSignature, F as FieldPath, n as FieldRole, h as GenerateGetMethods, i as GenerateQueryMethods, G as GetOptions, c as GetResult, I as IncludeConfigTyped, L as ListResponseData, g as PaginationResult, j as PaginationWithIncludeOptionsTyped, k as PopulateOptionsTyped, o as QueryRequestBody, d as RelationalKeys, p as RepoFieldPath, q as RepoRelationKeys, U as UserFieldPath, W as WhereClause, e as createPaginationIterator, f as executePaginatedQuery } from './types-
|
|
5
|
-
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-
|
|
6
|
-
export { A as AdminRepoConfig, a as AdminRepoEntry, b as AdminServerOptions, B as BasicAuthConfig, M as MiniRouter } from './index-
|
|
4
|
+
import { Q as QueryOptions, P as PaginationOptions, R as RepositoryConfig, a as RelationConfig, C as ConfiguredRepository } from './types-BESS89Fu.cjs';
|
|
5
|
+
export { A as ApiResponse, l as CrudRepoConfig, m as CrudServerOptions, E as ExtractDocumentRefSignature, b as ExtractUpdateSignature, F as FieldPath, n as FieldRole, h as GenerateGetMethods, i as GenerateQueryMethods, G as GetOptions, c as GetResult, I as IncludeConfigTyped, L as ListResponseData, g as PaginationResult, j as PaginationWithIncludeOptionsTyped, k as PopulateOptionsTyped, o as QueryRequestBody, d as RelationalKeys, p as RepoFieldPath, q as RepoRelationKeys, U as UserFieldPath, W as WhereClause, e as createPaginationIterator, f as executePaginatedQuery } from './types-BESS89Fu.cjs';
|
|
6
|
+
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-BGtAS0oG.cjs';
|
|
7
|
+
export { A as AdminRepoConfig, a as AdminRepoEntry, b as AdminServerOptions, B as BasicAuthConfig, M as MiniRouter } from './index-D7oj3Pft.cjs';
|
|
8
|
+
import 'firebase-functions/v2/firestore';
|
|
7
9
|
import 'firebase-functions/v2/https';
|
|
8
10
|
import './queue-Dk1Ezhkf.cjs';
|
|
9
11
|
import './types-CX5AbZWV.cjs';
|
|
10
|
-
import 'firebase-functions/v2/firestore';
|
|
11
12
|
import 'firebase-functions/v2/pubsub';
|
|
12
|
-
import './openapi-
|
|
13
|
+
import './openapi-lY43PZXy.cjs';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Apply QueryOptions to a Firestore query.
|
|
@@ -111,7 +112,7 @@ declare function normalizeTimestamps<T>(value: T): T;
|
|
|
111
112
|
* const repos = createRepositoryMapping(db, mapping);
|
|
112
113
|
* ```
|
|
113
114
|
*/
|
|
114
|
-
declare function createRepositoryConfig<TSchema extends z.ZodObject<any>>(schema: TSchema): <const TForeignKeys extends readonly (keyof z.infer<TSchema>)[], const TQueryKeys extends readonly (keyof z.infer<TSchema>)[], const TIsGroup extends boolean, const TDocumentKey extends keyof z.infer<TSchema>, const TPathKey extends keyof z.infer<TSchema> | undefined = undefined, const TCreatedKey extends keyof z.infer<TSchema> | undefined = undefined, const TUpdatedKey extends keyof z.infer<TSchema> | undefined = undefined, TRefCb = undefined>(config: {
|
|
115
|
+
declare function createRepositoryConfig<TSchema extends z.ZodObject<any>>(schema: TSchema): <const TForeignKeys extends readonly (keyof z.infer<TSchema>)[], const TQueryKeys extends readonly (keyof z.infer<TSchema>)[], const TIsGroup extends boolean, const TDocumentKey extends keyof z.infer<TSchema>, const TPathKey extends keyof z.infer<TSchema> | undefined = undefined, const TCreatedKey extends keyof z.infer<TSchema> | undefined = undefined, const TUpdatedKey extends keyof z.infer<TSchema> | undefined = undefined, const THistoryEnabled extends boolean = false, TRefCb = undefined>(config: {
|
|
115
116
|
path: string;
|
|
116
117
|
isGroup: TIsGroup;
|
|
117
118
|
foreignKeys: TForeignKeys;
|
|
@@ -121,7 +122,15 @@ declare function createRepositoryConfig<TSchema extends z.ZodObject<any>>(schema
|
|
|
121
122
|
createdKey?: TCreatedKey;
|
|
122
123
|
updatedKey?: TUpdatedKey;
|
|
123
124
|
refCb: TRefCb;
|
|
124
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Optional change-history configuration. Set `enabled: true` to expose
|
|
127
|
+
* `repo.history.*` and have `createHistoryTriggers(...)` register a trigger
|
|
128
|
+
* for this repo.
|
|
129
|
+
*/
|
|
130
|
+
history?: HistoryConfigForModel<z.infer<TSchema>> & {
|
|
131
|
+
enabled: THistoryEnabled;
|
|
132
|
+
};
|
|
133
|
+
}) => RepositoryConfig<z.infer<TSchema>, TForeignKeys, TQueryKeys, TIsGroup, TRefCb, {}, TDocumentKey, TPathKey, TCreatedKey, TUpdatedKey, THistoryEnabled> & {
|
|
125
134
|
schema: TSchema;
|
|
126
135
|
};
|
|
127
136
|
/**
|
|
@@ -160,9 +169,9 @@ type ResolveRelation<TMapping, TRelationConfig> = TRelationConfig extends {
|
|
|
160
169
|
* ```
|
|
161
170
|
*/
|
|
162
171
|
declare function buildRepositoryRelations<TMapping extends Record<string, any>, const TRelations extends {
|
|
163
|
-
[K in keyof TMapping]?: TMapping[K] extends RepositoryConfig<infer T, any, any, any, any, any, any, any, any, any> ? {
|
|
172
|
+
[K in keyof TMapping]?: TMapping[K] extends RepositoryConfig<infer T, any, any, any, any, any, any, any, any, any, any> ? {
|
|
164
173
|
[RK in keyof T]?: {
|
|
165
|
-
[R in keyof TMapping]: TMapping[R] extends RepositoryConfig<infer TTargetModel, infer TForeignKeys, any, any, any, any, any, any, any, any> ? {
|
|
174
|
+
[R in keyof TMapping]: TMapping[R] extends RepositoryConfig<infer TTargetModel, infer TForeignKeys, any, any, any, any, any, any, any, any, any> ? {
|
|
166
175
|
repo: R;
|
|
167
176
|
key: TForeignKeys[number];
|
|
168
177
|
type: "one" | "many";
|
|
@@ -170,9 +179,9 @@ declare function buildRepositoryRelations<TMapping extends Record<string, any>,
|
|
|
170
179
|
}[keyof TMapping];
|
|
171
180
|
} : never;
|
|
172
181
|
}>(mapping: TMapping, relations: TRelations): {
|
|
173
|
-
[K in keyof TMapping]: K extends keyof TRelations ? TMapping[K] extends RepositoryConfig<infer T, infer TForeignKeys, infer TQueryKeys, infer TIsGroup, infer TRefCb, any, infer TDocumentKey, infer TPathKey, infer TCreatedKey, infer TUpdatedKey> ? RepositoryConfig<T, TForeignKeys, TQueryKeys, TIsGroup, TRefCb, {
|
|
182
|
+
[K in keyof TMapping]: K extends keyof TRelations ? TMapping[K] extends RepositoryConfig<infer T, infer TForeignKeys, infer TQueryKeys, infer TIsGroup, infer TRefCb, any, infer TDocumentKey, infer TPathKey, infer TCreatedKey, infer TUpdatedKey, infer THistoryEnabled> ? RepositoryConfig<T, TForeignKeys, TQueryKeys, TIsGroup, TRefCb, {
|
|
174
183
|
[RK in keyof TRelations[K]]: ResolveRelation<TMapping, TRelations[K][RK]>;
|
|
175
|
-
}, TDocumentKey, TPathKey, TCreatedKey, TUpdatedKey> : TMapping[K] : TMapping[K];
|
|
184
|
+
}, TDocumentKey, TPathKey, TCreatedKey, TUpdatedKey, THistoryEnabled> : TMapping[K] : TMapping[K];
|
|
176
185
|
};
|
|
177
186
|
/**
|
|
178
187
|
* Repository mapping class that manages Firestore repositories with type safety
|
package/dist/index.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { H as HistoryConfigForModel } from './read-DfXXxhO4.js';
|
|
1
2
|
import { Query, QuerySnapshot, Firestore } from 'firebase-admin/firestore';
|
|
2
3
|
import { z } from 'zod';
|
|
3
|
-
import { Q as QueryOptions, P as PaginationOptions, R as RepositoryConfig, a as RelationConfig, C as ConfiguredRepository } from './types-
|
|
4
|
-
export { A as ApiResponse, l as CrudRepoConfig, m as CrudServerOptions, E as ExtractDocumentRefSignature, b as ExtractUpdateSignature, F as FieldPath, n as FieldRole, h as GenerateGetMethods, i as GenerateQueryMethods, G as GetOptions, c as GetResult, I as IncludeConfigTyped, L as ListResponseData, g as PaginationResult, j as PaginationWithIncludeOptionsTyped, k as PopulateOptionsTyped, o as QueryRequestBody, d as RelationalKeys, p as RepoFieldPath, q as RepoRelationKeys, U as UserFieldPath, W as WhereClause, e as createPaginationIterator, f as executePaginatedQuery } from './types-
|
|
5
|
-
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-
|
|
6
|
-
export { A as AdminRepoConfig, a as AdminRepoEntry, b as AdminServerOptions, B as BasicAuthConfig, M as MiniRouter } from './index-
|
|
4
|
+
import { Q as QueryOptions, P as PaginationOptions, R as RepositoryConfig, a as RelationConfig, C as ConfiguredRepository } from './types-BVUFVcpl.js';
|
|
5
|
+
export { A as ApiResponse, l as CrudRepoConfig, m as CrudServerOptions, E as ExtractDocumentRefSignature, b as ExtractUpdateSignature, F as FieldPath, n as FieldRole, h as GenerateGetMethods, i as GenerateQueryMethods, G as GetOptions, c as GetResult, I as IncludeConfigTyped, L as ListResponseData, g as PaginationResult, j as PaginationWithIncludeOptionsTyped, k as PopulateOptionsTyped, o as QueryRequestBody, d as RelationalKeys, p as RepoFieldPath, q as RepoRelationKeys, U as UserFieldPath, W as WhereClause, e as createPaginationIterator, f as executePaginatedQuery } from './types-BVUFVcpl.js';
|
|
6
|
+
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-DMszgNtg.js';
|
|
7
|
+
export { A as AdminRepoConfig, a as AdminRepoEntry, b as AdminServerOptions, B as BasicAuthConfig, M as MiniRouter } from './index-BSZP0Gz9.js';
|
|
8
|
+
import 'firebase-functions/v2/firestore';
|
|
7
9
|
import 'firebase-functions/v2/https';
|
|
8
10
|
import './queue-D_-aMf4H.js';
|
|
9
11
|
import './types-CX5AbZWV.js';
|
|
10
|
-
import 'firebase-functions/v2/firestore';
|
|
11
12
|
import 'firebase-functions/v2/pubsub';
|
|
12
|
-
import './openapi-
|
|
13
|
+
import './openapi-BdqIkSjO.js';
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* Apply QueryOptions to a Firestore query.
|
|
@@ -111,7 +112,7 @@ declare function normalizeTimestamps<T>(value: T): T;
|
|
|
111
112
|
* const repos = createRepositoryMapping(db, mapping);
|
|
112
113
|
* ```
|
|
113
114
|
*/
|
|
114
|
-
declare function createRepositoryConfig<TSchema extends z.ZodObject<any>>(schema: TSchema): <const TForeignKeys extends readonly (keyof z.infer<TSchema>)[], const TQueryKeys extends readonly (keyof z.infer<TSchema>)[], const TIsGroup extends boolean, const TDocumentKey extends keyof z.infer<TSchema>, const TPathKey extends keyof z.infer<TSchema> | undefined = undefined, const TCreatedKey extends keyof z.infer<TSchema> | undefined = undefined, const TUpdatedKey extends keyof z.infer<TSchema> | undefined = undefined, TRefCb = undefined>(config: {
|
|
115
|
+
declare function createRepositoryConfig<TSchema extends z.ZodObject<any>>(schema: TSchema): <const TForeignKeys extends readonly (keyof z.infer<TSchema>)[], const TQueryKeys extends readonly (keyof z.infer<TSchema>)[], const TIsGroup extends boolean, const TDocumentKey extends keyof z.infer<TSchema>, const TPathKey extends keyof z.infer<TSchema> | undefined = undefined, const TCreatedKey extends keyof z.infer<TSchema> | undefined = undefined, const TUpdatedKey extends keyof z.infer<TSchema> | undefined = undefined, const THistoryEnabled extends boolean = false, TRefCb = undefined>(config: {
|
|
115
116
|
path: string;
|
|
116
117
|
isGroup: TIsGroup;
|
|
117
118
|
foreignKeys: TForeignKeys;
|
|
@@ -121,7 +122,15 @@ declare function createRepositoryConfig<TSchema extends z.ZodObject<any>>(schema
|
|
|
121
122
|
createdKey?: TCreatedKey;
|
|
122
123
|
updatedKey?: TUpdatedKey;
|
|
123
124
|
refCb: TRefCb;
|
|
124
|
-
|
|
125
|
+
/**
|
|
126
|
+
* Optional change-history configuration. Set `enabled: true` to expose
|
|
127
|
+
* `repo.history.*` and have `createHistoryTriggers(...)` register a trigger
|
|
128
|
+
* for this repo.
|
|
129
|
+
*/
|
|
130
|
+
history?: HistoryConfigForModel<z.infer<TSchema>> & {
|
|
131
|
+
enabled: THistoryEnabled;
|
|
132
|
+
};
|
|
133
|
+
}) => RepositoryConfig<z.infer<TSchema>, TForeignKeys, TQueryKeys, TIsGroup, TRefCb, {}, TDocumentKey, TPathKey, TCreatedKey, TUpdatedKey, THistoryEnabled> & {
|
|
125
134
|
schema: TSchema;
|
|
126
135
|
};
|
|
127
136
|
/**
|
|
@@ -160,9 +169,9 @@ type ResolveRelation<TMapping, TRelationConfig> = TRelationConfig extends {
|
|
|
160
169
|
* ```
|
|
161
170
|
*/
|
|
162
171
|
declare function buildRepositoryRelations<TMapping extends Record<string, any>, const TRelations extends {
|
|
163
|
-
[K in keyof TMapping]?: TMapping[K] extends RepositoryConfig<infer T, any, any, any, any, any, any, any, any, any> ? {
|
|
172
|
+
[K in keyof TMapping]?: TMapping[K] extends RepositoryConfig<infer T, any, any, any, any, any, any, any, any, any, any> ? {
|
|
164
173
|
[RK in keyof T]?: {
|
|
165
|
-
[R in keyof TMapping]: TMapping[R] extends RepositoryConfig<infer TTargetModel, infer TForeignKeys, any, any, any, any, any, any, any, any> ? {
|
|
174
|
+
[R in keyof TMapping]: TMapping[R] extends RepositoryConfig<infer TTargetModel, infer TForeignKeys, any, any, any, any, any, any, any, any, any> ? {
|
|
166
175
|
repo: R;
|
|
167
176
|
key: TForeignKeys[number];
|
|
168
177
|
type: "one" | "many";
|
|
@@ -170,9 +179,9 @@ declare function buildRepositoryRelations<TMapping extends Record<string, any>,
|
|
|
170
179
|
}[keyof TMapping];
|
|
171
180
|
} : never;
|
|
172
181
|
}>(mapping: TMapping, relations: TRelations): {
|
|
173
|
-
[K in keyof TMapping]: K extends keyof TRelations ? TMapping[K] extends RepositoryConfig<infer T, infer TForeignKeys, infer TQueryKeys, infer TIsGroup, infer TRefCb, any, infer TDocumentKey, infer TPathKey, infer TCreatedKey, infer TUpdatedKey> ? RepositoryConfig<T, TForeignKeys, TQueryKeys, TIsGroup, TRefCb, {
|
|
182
|
+
[K in keyof TMapping]: K extends keyof TRelations ? TMapping[K] extends RepositoryConfig<infer T, infer TForeignKeys, infer TQueryKeys, infer TIsGroup, infer TRefCb, any, infer TDocumentKey, infer TPathKey, infer TCreatedKey, infer TUpdatedKey, infer THistoryEnabled> ? RepositoryConfig<T, TForeignKeys, TQueryKeys, TIsGroup, TRefCb, {
|
|
174
183
|
[RK in keyof TRelations[K]]: ResolveRelation<TMapping, TRelations[K][RK]>;
|
|
175
|
-
}, TDocumentKey, TPathKey, TCreatedKey, TUpdatedKey> : TMapping[K] : TMapping[K];
|
|
184
|
+
}, TDocumentKey, TPathKey, TCreatedKey, TUpdatedKey, THistoryEnabled> : TMapping[K] : TMapping[K];
|
|
176
185
|
};
|
|
177
186
|
/**
|
|
178
187
|
* Repository mapping class that manages Firestore repositories with type safety
|