@lpdjs/firestore-repo-service 2.1.2 → 2.1.3
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/README.md +22 -13
- package/dist/index.cjs +44 -44
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +44 -44
- package/dist/index.js.map +1 -1
- package/dist/servers/admin/index.cjs +4 -4
- package/dist/servers/admin/index.cjs.map +1 -1
- package/dist/servers/admin/index.js +4 -4
- package/dist/servers/admin/index.js.map +1 -1
- package/dist/servers/crud/index.cjs +2 -2
- package/dist/servers/crud/index.cjs.map +1 -1
- package/dist/servers/crud/index.js +2 -2
- package/dist/servers/crud/index.js.map +1 -1
- package/dist/servers/index.cjs +2 -2
- package/dist/servers/index.cjs.map +1 -1
- package/dist/servers/index.js +2 -2
- package/dist/servers/index.js.map +1 -1
- package/dist/sync/bigquery.d.cts +1 -1
- package/dist/sync/bigquery.d.ts +1 -1
- package/dist/sync/index.cjs +33 -33
- package/dist/sync/index.cjs.map +1 -1
- package/dist/sync/index.d.cts +170 -170
- package/dist/sync/index.d.ts +170 -170
- package/dist/sync/index.js +33 -33
- package/dist/sync/index.js.map +1 -1
- package/dist/{types-PzZ0APQ_.d.cts → types-BG1kGsLO.d.cts} +25 -12
- package/dist/{types-PzZ0APQ_.d.ts → types-BG1kGsLO.d.ts} +25 -12
- package/package.json +1 -1
package/dist/sync/index.d.cts
CHANGED
|
@@ -1,70 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export {
|
|
1
|
+
import { S as SqlAdapter, a as SyncEvent, b as adminsyncConfig, R as RepoSyncConfig, P as PubSubClientDep, F as FirestoreSyncConfig, c as SqlDialect, d as SqlColumn, e as SqlTableDef, G as GenerateDDLConfig, L as LogicalType, f as SyncTriggersConfig, g as SyncWorkerConfig } from '../types-BG1kGsLO.cjs';
|
|
2
|
+
export { h as FirestoreTriggersDep, O as OrFactory, i as PubSubHandlerDep, j as SyncDeps, k as SyncOperation, l as adminsyncBasicAuth, m as adminsyncFeaturesFlag } from '../types-BG1kGsLO.cjs';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
|
-
declare function zodTypeToLogical(schema: z.ZodType): LogicalType;
|
|
6
|
-
interface ZodSchemaToColumnsOptions {
|
|
7
|
-
primaryKey?: string;
|
|
8
|
-
exclude?: string[];
|
|
9
|
-
columnMap?: Record<string, string>;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* Convert a Zod object schema into an array of {@link SqlColumn} definitions
|
|
13
|
-
* suitable for SQL table creation.
|
|
14
|
-
*
|
|
15
|
-
* Nested ZodObject fields are recursively flattened into separate columns
|
|
16
|
-
* with underscore-separated names (e.g. `address.street` → `address_street`).
|
|
17
|
-
* Arrays become JSON columns.
|
|
18
|
-
*/
|
|
19
|
-
declare function zodSchemaToColumns(schema: z.ZodObject<any>, dialect: SqlDialect, options?: ZodSchemaToColumnsOptions): SqlColumn[];
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Convert a single Firestore value into a SQL-safe primitive.
|
|
23
|
-
*
|
|
24
|
-
* Complex types (arrays, GeoPoints, binary) become JSON strings.
|
|
25
|
-
* Primitives pass through unchanged.
|
|
26
|
-
* Objects are NOT stringified here — they are flattened by serializeDocument.
|
|
27
|
-
*/
|
|
28
|
-
declare function serializeValue(value: unknown): unknown;
|
|
29
|
-
/**
|
|
30
|
-
* Serialize a full Firestore document into a flat object of SQL-safe values.
|
|
31
|
-
*
|
|
32
|
-
* Nested objects are flattened into underscore-separated column names
|
|
33
|
-
* (e.g. `address.street` → `address_street`). Arrays become JSON strings.
|
|
34
|
-
* Applies optional field exclusions and column renames from `options`.
|
|
35
|
-
*/
|
|
36
|
-
declare function serializeDocument(doc: Record<string, unknown>, options?: Pick<RepoSyncConfig, "exclude" | "columnMap">): Record<string, unknown>;
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
* DDL generator — produces CREATE TABLE / ALTER TABLE statements from
|
|
40
|
-
* SqlColumn definitions and a SqlDialect.
|
|
41
|
-
*
|
|
42
|
-
* `generateDDL()` is the public entry point: it walks a repository mapping,
|
|
43
|
-
* converts each repo's Zod schema to columns, and returns the full DDL
|
|
44
|
-
* as a single string.
|
|
45
|
-
*/
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Generate a CREATE TABLE statement from a table definition.
|
|
49
|
-
* Delegates to the dialect for syntax specifics.
|
|
50
|
-
*/
|
|
51
|
-
declare function createTableDDL(dialect: SqlDialect, table: SqlTableDef): string;
|
|
52
|
-
/**
|
|
53
|
-
* Generate ALTER TABLE ADD COLUMN statements for columns missing from an
|
|
54
|
-
* existing table.
|
|
55
|
-
*/
|
|
56
|
-
declare function addColumnsDDL(dialect: SqlDialect, tableName: string, columns: SqlColumn[]): string;
|
|
57
|
-
/**
|
|
58
|
-
* Walk a full repository mapping and produce DDL for every repo that has a
|
|
59
|
-
* Zod schema attached.
|
|
60
|
-
*
|
|
61
|
-
* @param repoMapping - Object whose values expose `.schema` (ZodObject)
|
|
62
|
-
* @param dialect - Target SQL dialect
|
|
63
|
-
* @param config - Optional per-repo overrides (table name, exclusions…)
|
|
64
|
-
* @returns Complete DDL string (one CREATE TABLE per repo, separated by newlines)
|
|
65
|
-
*/
|
|
66
|
-
declare function generateDDL<M extends Record<string, any>>(repoMapping: M, dialect: SqlDialect, config?: GenerateDDLConfig<NoInfer<M>>): string;
|
|
67
|
-
|
|
68
5
|
/**
|
|
69
6
|
* Per-repo in-memory batch buffer.
|
|
70
7
|
*
|
|
@@ -115,35 +52,127 @@ declare class SyncQueue {
|
|
|
115
52
|
}
|
|
116
53
|
|
|
117
54
|
/**
|
|
118
|
-
*
|
|
119
|
-
*
|
|
120
|
-
* flushes batches to the configured {@link SqlAdapter}.
|
|
55
|
+
* Sync Admin — optional HTTP endpoint for inspecting and managing the
|
|
56
|
+
* Firestore → SQL sync pipeline.
|
|
121
57
|
*
|
|
122
|
-
*
|
|
123
|
-
*
|
|
58
|
+
* Features (gated by `featuresFlag`):
|
|
59
|
+
* - **healthCheck** — compare expected Zod-derived columns vs actual SQL columns
|
|
60
|
+
* - **manualSync** — force re-sync all documents in a Firestore collection
|
|
61
|
+
* - **viewQueue** — inspect pending items in the per-repo SyncQueue
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```typescript
|
|
65
|
+
* const sync = createFirestoreSync(repos, {
|
|
66
|
+
* // …deps, adapter, etc.
|
|
67
|
+
* admin: {
|
|
68
|
+
* auth: { type: "basic", username: "admin", password: "secret" },
|
|
69
|
+
* featuresFlag: { healthCheck: true, manualSync: true, viewQueue: true },
|
|
70
|
+
* },
|
|
71
|
+
* });
|
|
72
|
+
*
|
|
73
|
+
* export const adminsync = onRequest(sync.adminHandler!);
|
|
74
|
+
* ```
|
|
124
75
|
*/
|
|
125
76
|
|
|
126
77
|
/**
|
|
127
|
-
* Create
|
|
128
|
-
* to a SQL database.
|
|
78
|
+
* Create the sync admin HTTP handler.
|
|
129
79
|
*
|
|
130
|
-
*
|
|
131
|
-
* -
|
|
132
|
-
* -
|
|
133
|
-
*
|
|
134
|
-
* -
|
|
80
|
+
* @param repoMapping - The configured repository mapping
|
|
81
|
+
* @param adapter - The SQL adapter (e.g. BigQueryAdapter)
|
|
82
|
+
* @param queues - Live queue map from the worker
|
|
83
|
+
* @param handleMessage - Direct SyncEvent processor from the worker
|
|
84
|
+
* @param config - Admin-specific config (auth, basePath, features)
|
|
85
|
+
* @param repoConfigs - Per-repo sync config (tableName, exclude, columnMap…)
|
|
86
|
+
* @param pubsub - PubSub client (needed for configCheck)
|
|
87
|
+
* @param topicPrefix - PubSub topic prefix (needed for configCheck)
|
|
135
88
|
*/
|
|
136
|
-
declare function
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
89
|
+
declare function createadminsyncServer(repoMapping: Record<string, any>, adapter: SqlAdapter, queues: Map<string, SyncQueue>, handleMessage: (event: SyncEvent) => Promise<void>, config: adminsyncConfig, repoConfigs: Record<string, RepoSyncConfig<string> | undefined>, pubsub?: PubSubClientDep, topicPrefix?: string): (req: any, res: any) => Promise<void>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* Unified wrapper — combines triggers + worker into a single call.
|
|
93
|
+
*
|
|
94
|
+
* @example
|
|
95
|
+
* ```typescript
|
|
96
|
+
* import * as firestoreTriggers from "firebase-functions/v2/firestore";
|
|
97
|
+
* import * as pubsubHandler from "firebase-functions/v2/pubsub";
|
|
98
|
+
* import { PubSub } from "@google-cloud/pubsub";
|
|
99
|
+
*
|
|
100
|
+
* const sync = createFirestoreSync(repos, {
|
|
101
|
+
* deps: { firestoreTriggers, pubsubHandler, pubsub: new PubSub() },
|
|
102
|
+
* adapter,
|
|
103
|
+
* topicPrefix: "firestore-sync",
|
|
104
|
+
* autoMigrate: true,
|
|
105
|
+
* admin: {
|
|
106
|
+
* auth: { type: "basic", username: "admin", password: "secret" },
|
|
107
|
+
* featuresFlag: { healthCheck: true, manualSync: true, viewQueue: true },
|
|
108
|
+
* },
|
|
109
|
+
* repos: {
|
|
110
|
+
* users: { exclude: ["documentPath"], columnMap: { docId: "user_id" } },
|
|
111
|
+
* posts: { columnMap: { docId: "post_id" } },
|
|
112
|
+
* },
|
|
113
|
+
* });
|
|
114
|
+
*
|
|
115
|
+
* // Triggers + PubSub handlers
|
|
116
|
+
* export const { users_onCreate, users_onUpdate, users_onDelete, sync_users } = sync.functions;
|
|
117
|
+
*
|
|
118
|
+
* // Admin endpoint — wrap with onRequest yourself
|
|
119
|
+
* export const adminsync = onRequest(sync.adminHandler!);
|
|
120
|
+
*
|
|
121
|
+
* // Or pass onRequest in admin config to auto-add to sync.functions:
|
|
122
|
+
* // admin: { onRequest, ... } → export const { adminsync } = sync.functions;
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
|
|
126
|
+
declare function createFirestoreSync<M extends Record<string, any>>(repoMapping: M, config: FirestoreSyncConfig<NoInfer<M>>): {
|
|
127
|
+
/** All Cloud Functions (triggers + handlers + optional admin) — spread into exports */
|
|
128
|
+
functions: Record<string, any>;
|
|
129
|
+
/**
|
|
130
|
+
* Raw admin HTTP handler — wrap with `onRequest()` yourself if you
|
|
131
|
+
* didn't pass `onRequest` in the admin config.
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* export const adminsync = onRequest(sync.adminHandler!);
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
adminHandler: ((req: any, res: any) => Promise<void>) | null;
|
|
138
|
+
/** Process a SyncEvent directly (for testing) */
|
|
139
|
+
handleMessage: (event: SyncEvent) => Promise<void>;
|
|
140
|
+
/** Internal queue map (for testing) */
|
|
142
141
|
queues: Map<string, SyncQueue>;
|
|
143
|
-
/** Flush all queues and stop timers
|
|
144
|
-
shutdown()
|
|
142
|
+
/** Flush all queues and stop timers */
|
|
143
|
+
shutdown: () => Promise<void>;
|
|
145
144
|
};
|
|
146
145
|
|
|
146
|
+
/**
|
|
147
|
+
* DDL generator — produces CREATE TABLE / ALTER TABLE statements from
|
|
148
|
+
* SqlColumn definitions and a SqlDialect.
|
|
149
|
+
*
|
|
150
|
+
* `generateDDL()` is the public entry point: it walks a repository mapping,
|
|
151
|
+
* converts each repo's Zod schema to columns, and returns the full DDL
|
|
152
|
+
* as a single string.
|
|
153
|
+
*/
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Generate a CREATE TABLE statement from a table definition.
|
|
157
|
+
* Delegates to the dialect for syntax specifics.
|
|
158
|
+
*/
|
|
159
|
+
declare function createTableDDL(dialect: SqlDialect, table: SqlTableDef): string;
|
|
160
|
+
/**
|
|
161
|
+
* Generate ALTER TABLE ADD COLUMN statements for columns missing from an
|
|
162
|
+
* existing table.
|
|
163
|
+
*/
|
|
164
|
+
declare function addColumnsDDL(dialect: SqlDialect, tableName: string, columns: SqlColumn[]): string;
|
|
165
|
+
/**
|
|
166
|
+
* Walk a full repository mapping and produce DDL for every repo that has a
|
|
167
|
+
* Zod schema attached.
|
|
168
|
+
*
|
|
169
|
+
* @param repoMapping - Object whose values expose `.schema` (ZodObject)
|
|
170
|
+
* @param dialect - Target SQL dialect
|
|
171
|
+
* @param config - Optional per-repo overrides (table name, exclusions…)
|
|
172
|
+
* @returns Complete DDL string (one CREATE TABLE per repo, separated by newlines)
|
|
173
|
+
*/
|
|
174
|
+
declare function generateDDL<M extends Record<string, any>>(repoMapping: M, dialect: SqlDialect, config?: GenerateDDLConfig<NoInfer<M>>): string;
|
|
175
|
+
|
|
147
176
|
/**
|
|
148
177
|
* Migration manager — generates DDL and optionally auto-migrates SQL tables
|
|
149
178
|
* to match the Zod schemas defined in a repository mapping.
|
|
@@ -169,6 +198,39 @@ interface MigrateResult {
|
|
|
169
198
|
*/
|
|
170
199
|
declare function autoMigrate<M extends Record<string, any>>(repoMapping: M, adapter: SqlAdapter, config?: GenerateDDLConfig<NoInfer<M>>): Promise<MigrateResult>;
|
|
171
200
|
|
|
201
|
+
declare function zodTypeToLogical(schema: z.ZodType): LogicalType;
|
|
202
|
+
interface ZodSchemaToColumnsOptions {
|
|
203
|
+
primaryKey?: string;
|
|
204
|
+
exclude?: string[];
|
|
205
|
+
columnMap?: Record<string, string>;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Convert a Zod object schema into an array of {@link SqlColumn} definitions
|
|
209
|
+
* suitable for SQL table creation.
|
|
210
|
+
*
|
|
211
|
+
* Nested ZodObject fields are recursively flattened into separate columns
|
|
212
|
+
* with underscore-separated names (e.g. `address.street` → `address_street`).
|
|
213
|
+
* Arrays become JSON columns.
|
|
214
|
+
*/
|
|
215
|
+
declare function zodSchemaToColumns(schema: z.ZodObject<any>, dialect: SqlDialect, options?: ZodSchemaToColumnsOptions): SqlColumn[];
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Convert a single Firestore value into a SQL-safe primitive.
|
|
219
|
+
*
|
|
220
|
+
* Complex types (arrays, GeoPoints, binary) become JSON strings.
|
|
221
|
+
* Primitives pass through unchanged.
|
|
222
|
+
* Objects are NOT stringified here — they are flattened by serializeDocument.
|
|
223
|
+
*/
|
|
224
|
+
declare function serializeValue(value: unknown): unknown;
|
|
225
|
+
/**
|
|
226
|
+
* Serialize a full Firestore document into a flat object of SQL-safe values.
|
|
227
|
+
*
|
|
228
|
+
* Nested objects are flattened into underscore-separated column names
|
|
229
|
+
* (e.g. `address.street` → `address_street`). Arrays become JSON strings.
|
|
230
|
+
* Applies optional field exclusions and column renames from `options`.
|
|
231
|
+
*/
|
|
232
|
+
declare function serializeDocument(doc: Record<string, unknown>, options?: Pick<RepoSyncConfig, "exclude" | "columnMap">): Record<string, unknown>;
|
|
233
|
+
|
|
172
234
|
/**
|
|
173
235
|
* Firestore Cloud Function triggers that publish {@link SyncEvent}s to
|
|
174
236
|
* Google Cloud PubSub.
|
|
@@ -211,95 +273,33 @@ declare function autoMigrate<M extends Record<string, any>>(repoMapping: M, adap
|
|
|
211
273
|
declare function createSyncTriggers<M extends Record<string, any>>(repoMapping: M, config: SyncTriggersConfig<NoInfer<M>>): Record<string, any>;
|
|
212
274
|
|
|
213
275
|
/**
|
|
214
|
-
*
|
|
215
|
-
*
|
|
216
|
-
* @
|
|
217
|
-
* ```typescript
|
|
218
|
-
* import * as firestoreTriggers from "firebase-functions/v2/firestore";
|
|
219
|
-
* import * as pubsubHandler from "firebase-functions/v2/pubsub";
|
|
220
|
-
* import { PubSub } from "@google-cloud/pubsub";
|
|
221
|
-
*
|
|
222
|
-
* const sync = createFirestoreSync(repos, {
|
|
223
|
-
* deps: { firestoreTriggers, pubsubHandler, pubsub: new PubSub() },
|
|
224
|
-
* adapter,
|
|
225
|
-
* topicPrefix: "firestore-sync",
|
|
226
|
-
* autoMigrate: true,
|
|
227
|
-
* admin: {
|
|
228
|
-
* auth: { type: "basic", username: "admin", password: "secret" },
|
|
229
|
-
* featuresFlag: { healthCheck: true, manualSync: true, viewQueue: true },
|
|
230
|
-
* },
|
|
231
|
-
* repos: {
|
|
232
|
-
* users: { exclude: ["documentPath"], columnMap: { docId: "user_id" } },
|
|
233
|
-
* posts: { columnMap: { docId: "post_id" } },
|
|
234
|
-
* },
|
|
235
|
-
* });
|
|
236
|
-
*
|
|
237
|
-
* // Triggers + PubSub handlers
|
|
238
|
-
* export const { users_onCreate, users_onUpdate, users_onDelete, sync_users } = sync.functions;
|
|
239
|
-
*
|
|
240
|
-
* // Admin endpoint — wrap with onRequest yourself
|
|
241
|
-
* export const syncAdmin = onRequest(sync.adminHandler!);
|
|
242
|
-
*
|
|
243
|
-
* // Or pass onRequest in admin config to auto-add to sync.functions:
|
|
244
|
-
* // admin: { onRequest, ... } → export const { syncAdmin } = sync.functions;
|
|
245
|
-
* ```
|
|
246
|
-
*/
|
|
247
|
-
|
|
248
|
-
declare function createFirestoreSync<M extends Record<string, any>>(repoMapping: M, config: FirestoreSyncConfig<NoInfer<M>>): {
|
|
249
|
-
/** All Cloud Functions (triggers + handlers + optional admin) — spread into exports */
|
|
250
|
-
functions: Record<string, any>;
|
|
251
|
-
/**
|
|
252
|
-
* Raw admin HTTP handler — wrap with `onRequest()` yourself if you
|
|
253
|
-
* didn't pass `onRequest` in the admin config.
|
|
254
|
-
* @example
|
|
255
|
-
* ```ts
|
|
256
|
-
* export const syncAdmin = onRequest(sync.adminHandler!);
|
|
257
|
-
* ```
|
|
258
|
-
*/
|
|
259
|
-
adminHandler: ((req: any, res: any) => Promise<void>) | null;
|
|
260
|
-
/** Process a SyncEvent directly (for testing) */
|
|
261
|
-
handleMessage: (event: SyncEvent) => Promise<void>;
|
|
262
|
-
/** Internal queue map (for testing) */
|
|
263
|
-
queues: Map<string, SyncQueue>;
|
|
264
|
-
/** Flush all queues and stop timers */
|
|
265
|
-
shutdown: () => Promise<void>;
|
|
266
|
-
};
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* Sync Admin — optional HTTP endpoint for inspecting and managing the
|
|
270
|
-
* Firestore → SQL sync pipeline.
|
|
271
|
-
*
|
|
272
|
-
* Features (gated by `featuresFlag`):
|
|
273
|
-
* - **healthCheck** — compare expected Zod-derived columns vs actual SQL columns
|
|
274
|
-
* - **manualSync** — force re-sync all documents in a Firestore collection
|
|
275
|
-
* - **viewQueue** — inspect pending items in the per-repo SyncQueue
|
|
276
|
-
*
|
|
277
|
-
* @example
|
|
278
|
-
* ```typescript
|
|
279
|
-
* const sync = createFirestoreSync(repos, {
|
|
280
|
-
* // …deps, adapter, etc.
|
|
281
|
-
* admin: {
|
|
282
|
-
* auth: { type: "basic", username: "admin", password: "secret" },
|
|
283
|
-
* featuresFlag: { healthCheck: true, manualSync: true, viewQueue: true },
|
|
284
|
-
* },
|
|
285
|
-
* });
|
|
276
|
+
* PubSub worker — creates a Cloud Function that receives {@link SyncEvent}
|
|
277
|
+
* messages from PubSub, routes them to per-repo {@link SyncQueue}s, and
|
|
278
|
+
* flushes batches to the configured {@link SqlAdapter}.
|
|
286
279
|
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
280
|
+
* Dependencies (`firebase-functions`, `@google-cloud/pubsub`) are injected
|
|
281
|
+
* via the `deps` config property.
|
|
289
282
|
*/
|
|
290
283
|
|
|
291
284
|
/**
|
|
292
|
-
* Create
|
|
285
|
+
* Create a PubSub-triggered Cloud Function that syncs Firestore changes
|
|
286
|
+
* to a SQL database.
|
|
293
287
|
*
|
|
294
|
-
*
|
|
295
|
-
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
* @param repoConfigs - Per-repo sync config (tableName, exclude, columnMap…)
|
|
300
|
-
* @param pubsub - PubSub client (needed for configCheck)
|
|
301
|
-
* @param topicPrefix - PubSub topic prefix (needed for configCheck)
|
|
288
|
+
* Returns an object with:
|
|
289
|
+
* - `createHandler` — creates a Cloud Function for a PubSub topic
|
|
290
|
+
* - `handleMessage` — process a SyncEvent directly (for testing)
|
|
291
|
+
* - `queues` — internal SyncQueue map (for testing / manual flush)
|
|
292
|
+
* - `shutdown()` — flush all queues and stop timers
|
|
302
293
|
*/
|
|
303
|
-
declare function
|
|
294
|
+
declare function createSyncWorker<M extends Record<string, any>>(repoMapping: M, config: SyncWorkerConfig<NoInfer<M>>): {
|
|
295
|
+
/** Process a SyncEvent directly (for testing or custom PubSub integration). */
|
|
296
|
+
handleMessage: (syncEvent: SyncEvent) => Promise<void>;
|
|
297
|
+
/** Create a Cloud Function handler for a specific PubSub topic. */
|
|
298
|
+
createHandler: (topicName: string) => any;
|
|
299
|
+
/** Internal queue map (for testing). */
|
|
300
|
+
queues: Map<string, SyncQueue>;
|
|
301
|
+
/** Flush all queues and stop timers. */
|
|
302
|
+
shutdown(): Promise<void>;
|
|
303
|
+
};
|
|
304
304
|
|
|
305
|
-
export { FirestoreSyncConfig, GenerateDDLConfig, LogicalType, type MigrateResult, PubSubClientDep, RepoSyncConfig, SqlAdapter, SqlColumn, SqlDialect, SqlTableDef,
|
|
305
|
+
export { FirestoreSyncConfig, GenerateDDLConfig, LogicalType, type MigrateResult, PubSubClientDep, RepoSyncConfig, SqlAdapter, SqlColumn, SqlDialect, SqlTableDef, SyncEvent, SyncQueue, type SyncQueueOptions, SyncTriggersConfig, SyncWorkerConfig, addColumnsDDL, adminsyncConfig, autoMigrate, createFirestoreSync, createSyncTriggers, createSyncWorker, createTableDDL, createadminsyncServer, generateDDL, serializeDocument, serializeValue, zodSchemaToColumns, zodTypeToLogical };
|