@lpdjs/firestore-repo-service 2.1.13 → 2.1.14

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.
@@ -188,6 +188,25 @@ interface SyncTriggersConfig<M = Record<string, any>> {
188
188
  topicPrefix?: string;
189
189
  /** Per-repo overrides */
190
190
  repos?: TypedRepoSyncConfigs<M>;
191
+ /**
192
+ * Enable Pub/Sub message ordering so events for the same document are
193
+ * delivered in the order they were published.
194
+ *
195
+ * - `false` (default): no ordering, messages may be delivered out-of-order.
196
+ * - `true`: ordering keyed by `docId` (per-document ordering — recommended
197
+ * for Firestore sync; different docs remain parallelizable).
198
+ * - `(event) => string`: custom key (e.g. `"${repoName}:${docId}"` or a
199
+ * tenant id). All messages sharing the same key are strictly ordered.
200
+ *
201
+ * **IMPORTANT:** the matching subscription must also be created with
202
+ * `enableMessageOrdering: true` (it cannot be enabled after creation):
203
+ * ```ts
204
+ * await topic.createSubscription("my-sub", { enableMessageOrdering: true });
205
+ * ```
206
+ * Publish-and-subscribe must happen in the **same region** for the ordering
207
+ * guarantee to hold.
208
+ */
209
+ ordering?: boolean | ((event: SyncEvent) => string);
191
210
  }
192
211
  /** Options for `createSyncWorker()`. */
193
212
  interface SyncWorkerConfig<M = Record<string, any>> {
@@ -257,6 +276,24 @@ interface adminsyncConfig {
257
276
  * Only used when `onRequest` is also provided.
258
277
  */
259
278
  httpsOptions?: Record<string, unknown>;
279
+ /**
280
+ * Options used by the "Setup Pub/Sub" action on the Config Check page.
281
+ * When `featuresFlag.configCheck` is enabled and a PubSub client is
282
+ * available, the admin exposes a button that runs `ensureSyncInfra()`
283
+ * to (re-)create the topics + subscriptions with the desired ordering.
284
+ */
285
+ pubsubSetup?: {
286
+ /** Enable `enableMessageOrdering` on created subscriptions (default: true) */
287
+ ordering?: boolean;
288
+ /** Suffix for subscription name: `{prefix}-{repoName}-{suffix}` (default: "sync-sub") */
289
+ subscriptionSuffix?: string;
290
+ /** Also create the `-dlq` topic per repo (default: true) */
291
+ includeDLQ?: boolean;
292
+ /** Ack deadline for created subscriptions, in seconds (default: 60) */
293
+ ackDeadlineSeconds?: number;
294
+ /** Message retention duration (e.g. "604800s" for 7 days) */
295
+ messageRetentionDuration?: string;
296
+ };
260
297
  }
261
298
  /** Options for `createFirestoreSync()` — the unified wrapper. */
262
299
  interface FirestoreSyncConfig<M = Record<string, any>> {
@@ -188,6 +188,25 @@ interface SyncTriggersConfig<M = Record<string, any>> {
188
188
  topicPrefix?: string;
189
189
  /** Per-repo overrides */
190
190
  repos?: TypedRepoSyncConfigs<M>;
191
+ /**
192
+ * Enable Pub/Sub message ordering so events for the same document are
193
+ * delivered in the order they were published.
194
+ *
195
+ * - `false` (default): no ordering, messages may be delivered out-of-order.
196
+ * - `true`: ordering keyed by `docId` (per-document ordering — recommended
197
+ * for Firestore sync; different docs remain parallelizable).
198
+ * - `(event) => string`: custom key (e.g. `"${repoName}:${docId}"` or a
199
+ * tenant id). All messages sharing the same key are strictly ordered.
200
+ *
201
+ * **IMPORTANT:** the matching subscription must also be created with
202
+ * `enableMessageOrdering: true` (it cannot be enabled after creation):
203
+ * ```ts
204
+ * await topic.createSubscription("my-sub", { enableMessageOrdering: true });
205
+ * ```
206
+ * Publish-and-subscribe must happen in the **same region** for the ordering
207
+ * guarantee to hold.
208
+ */
209
+ ordering?: boolean | ((event: SyncEvent) => string);
191
210
  }
192
211
  /** Options for `createSyncWorker()`. */
193
212
  interface SyncWorkerConfig<M = Record<string, any>> {
@@ -257,6 +276,24 @@ interface adminsyncConfig {
257
276
  * Only used when `onRequest` is also provided.
258
277
  */
259
278
  httpsOptions?: Record<string, unknown>;
279
+ /**
280
+ * Options used by the "Setup Pub/Sub" action on the Config Check page.
281
+ * When `featuresFlag.configCheck` is enabled and a PubSub client is
282
+ * available, the admin exposes a button that runs `ensureSyncInfra()`
283
+ * to (re-)create the topics + subscriptions with the desired ordering.
284
+ */
285
+ pubsubSetup?: {
286
+ /** Enable `enableMessageOrdering` on created subscriptions (default: true) */
287
+ ordering?: boolean;
288
+ /** Suffix for subscription name: `{prefix}-{repoName}-{suffix}` (default: "sync-sub") */
289
+ subscriptionSuffix?: string;
290
+ /** Also create the `-dlq` topic per repo (default: true) */
291
+ includeDLQ?: boolean;
292
+ /** Ack deadline for created subscriptions, in seconds (default: 60) */
293
+ ackDeadlineSeconds?: number;
294
+ /** Message retention duration (e.g. "604800s" for 7 days) */
295
+ messageRetentionDuration?: string;
296
+ };
260
297
  }
261
298
  /** Options for `createFirestoreSync()` — the unified wrapper. */
262
299
  interface FirestoreSyncConfig<M = Record<string, any>> {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lpdjs/firestore-repo-service",
3
- "version": "2.1.13",
3
+ "version": "2.1.14",
4
4
  "description": "⚡ Type-safe Firestore ORM with auto-generated repositories, advanced queries, relations with typed select, pagination with include, batch/bulk operations, aggregations and transactions.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",