@rocicorp/zero 1.11.0-canary.26 → 1.11.0-canary.28

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.
Files changed (110) hide show
  1. package/out/analyze-query/src/analyze-cli.js +4 -4
  2. package/out/analyze-query/src/analyze-cli.js.map +1 -1
  3. package/out/analyze-query/src/bin-analyze.js +4 -4
  4. package/out/analyze-query/src/bin-analyze.js.map +1 -1
  5. package/out/analyze-query/src/bin-transform.js +1 -1
  6. package/out/analyze-query/src/bin-transform.js.map +1 -1
  7. package/out/otel/src/log-options.d.ts.map +1 -1
  8. package/out/otel/src/log-options.js +11 -10
  9. package/out/otel/src/log-options.js.map +1 -1
  10. package/out/replicache/src/persist/clients.d.ts +2 -2
  11. package/out/shared/src/options-types.d.ts +2 -2
  12. package/out/shared/src/options.d.ts.map +1 -1
  13. package/out/shared/src/options.js +10 -7
  14. package/out/shared/src/options.js.map +1 -1
  15. package/out/shared/src/valita.d.ts +13 -0
  16. package/out/shared/src/valita.d.ts.map +1 -1
  17. package/out/shared/src/valita.js +23 -23
  18. package/out/shared/src/valita.js.map +1 -1
  19. package/out/zero/package.js +2 -2
  20. package/out/zero/package.js.map +1 -1
  21. package/out/zero-cache/src/config/normalize.d.ts +1 -0
  22. package/out/zero-cache/src/config/normalize.d.ts.map +1 -1
  23. package/out/zero-cache/src/config/normalize.js +21 -2
  24. package/out/zero-cache/src/config/normalize.js.map +1 -1
  25. package/out/zero-cache/src/config/zero-config.d.ts +2 -2
  26. package/out/zero-cache/src/config/zero-config.d.ts.map +1 -1
  27. package/out/zero-cache/src/config/zero-config.js +86 -81
  28. package/out/zero-cache/src/config/zero-config.js.map +1 -1
  29. package/out/zero-cache/src/custom/fetch.d.ts +1 -1
  30. package/out/zero-cache/src/custom/fetch.d.ts.map +1 -1
  31. package/out/zero-cache/src/custom/fetch.js.map +1 -1
  32. package/out/zero-cache/src/scripts/permissions.js +3 -3
  33. package/out/zero-cache/src/scripts/permissions.js.map +1 -1
  34. package/out/zero-cache/src/server/change-streamer.d.ts.map +1 -1
  35. package/out/zero-cache/src/server/change-streamer.js +2 -1
  36. package/out/zero-cache/src/server/change-streamer.js.map +1 -1
  37. package/out/zero-cache/src/services/change-source/common/replica-restore.d.ts +5 -0
  38. package/out/zero-cache/src/services/change-source/common/replica-restore.d.ts.map +1 -1
  39. package/out/zero-cache/src/services/change-source/common/replica-restore.js.map +1 -1
  40. package/out/zero-cache/src/services/change-source/pg/backfill-stream.js +2 -1
  41. package/out/zero-cache/src/services/change-source/pg/backfill-stream.js.map +1 -1
  42. package/out/zero-cache/src/services/change-source/pg/change-source-init.d.ts +26 -1
  43. package/out/zero-cache/src/services/change-source/pg/change-source-init.d.ts.map +1 -1
  44. package/out/zero-cache/src/services/change-source/pg/change-source-init.js +37 -5
  45. package/out/zero-cache/src/services/change-source/pg/change-source-init.js.map +1 -1
  46. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts +18 -3
  47. package/out/zero-cache/src/services/change-source/pg/change-source.d.ts.map +1 -1
  48. package/out/zero-cache/src/services/change-source/pg/change-source.js +50 -6
  49. package/out/zero-cache/src/services/change-source/pg/change-source.js.map +1 -1
  50. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.d.ts.map +1 -1
  51. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.js +2 -1
  52. package/out/zero-cache/src/services/change-source/pg/logical-replication/stream.js.map +1 -1
  53. package/out/zero-cache/src/services/change-source/pg/replication-slots.d.ts +16 -1
  54. package/out/zero-cache/src/services/change-source/pg/replication-slots.d.ts.map +1 -1
  55. package/out/zero-cache/src/services/change-source/pg/replication-slots.js +53 -7
  56. package/out/zero-cache/src/services/change-source/pg/replication-slots.js.map +1 -1
  57. package/out/zero-cache/src/services/change-source/pg/schema/shard.d.ts +4 -4
  58. package/out/zero-cache/src/services/change-source/protocol/current/data.d.ts +2 -2
  59. package/out/zero-cache/src/services/change-source/protocol/current/downstream.d.ts +3 -3
  60. package/out/zero-cache/src/services/change-source/protocol/current/upstream.d.ts +3 -4
  61. package/out/zero-cache/src/services/change-source/protocol/current/upstream.d.ts.map +1 -1
  62. package/out/zero-cache/src/services/change-streamer/backup-monitor.d.ts.map +1 -1
  63. package/out/zero-cache/src/services/change-streamer/backup-monitor.js +3 -3
  64. package/out/zero-cache/src/services/change-streamer/backup-monitor.js.map +1 -1
  65. package/out/zero-cache/src/services/change-streamer/change-streamer-http.d.ts.map +1 -1
  66. package/out/zero-cache/src/services/change-streamer/change-streamer-http.js +2 -1
  67. package/out/zero-cache/src/services/change-streamer/change-streamer-http.js.map +1 -1
  68. package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts +5 -1
  69. package/out/zero-cache/src/services/change-streamer/change-streamer-service.d.ts.map +1 -1
  70. package/out/zero-cache/src/services/change-streamer/change-streamer-service.js +1 -0
  71. package/out/zero-cache/src/services/change-streamer/change-streamer-service.js.map +1 -1
  72. package/out/zero-cache/src/services/change-streamer/change-streamer.d.ts +1 -1
  73. package/out/zero-cache/src/services/change-streamer/storer.d.ts +7 -1
  74. package/out/zero-cache/src/services/change-streamer/storer.d.ts.map +1 -1
  75. package/out/zero-cache/src/services/change-streamer/storer.js +23 -11
  76. package/out/zero-cache/src/services/change-streamer/storer.js.map +1 -1
  77. package/out/zero-cache/src/services/change-streamer/subscribe.d.ts +1 -1
  78. package/out/zero-cache/src/services/replicator/replication-status.js +2 -1
  79. package/out/zero-cache/src/services/replicator/replication-status.js.map +1 -1
  80. package/out/zero-cache/src/services/replicator/reporter/recorder.js +1 -1
  81. package/out/zero-cache/src/services/replicator/reporter/recorder.js.map +1 -1
  82. package/out/zero-cache/src/services/view-syncer/query-stats.d.ts +7 -2
  83. package/out/zero-cache/src/services/view-syncer/query-stats.d.ts.map +1 -1
  84. package/out/zero-cache/src/services/view-syncer/query-stats.js +12 -4
  85. package/out/zero-cache/src/services/view-syncer/query-stats.js.map +1 -1
  86. package/out/zero-cache/src/services/view-syncer/schema/types.d.ts +1 -1
  87. package/out/zero-cache/src/services/view-syncer/snapshotter.d.ts.map +1 -1
  88. package/out/zero-cache/src/services/view-syncer/snapshotter.js +7 -2
  89. package/out/zero-cache/src/services/view-syncer/snapshotter.js.map +1 -1
  90. package/out/zero-cache/src/types/pg.d.ts.map +1 -1
  91. package/out/zero-cache/src/types/pg.js +1 -1
  92. package/out/zero-cache/src/types/pg.js.map +1 -1
  93. package/out/zero-client/src/client/crud-impl.d.ts.map +1 -1
  94. package/out/zero-client/src/client/crud-impl.js +1 -1
  95. package/out/zero-client/src/client/crud-impl.js.map +1 -1
  96. package/out/zero-client/src/client/reload-error-handler.js +2 -2
  97. package/out/zero-client/src/client/reload-error-handler.js.map +1 -1
  98. package/out/zero-client/src/client/version.js +1 -1
  99. package/out/zero-events/src/status.d.ts +6 -0
  100. package/out/zero-events/src/status.d.ts.map +1 -1
  101. package/out/zero-protocol/src/down.d.ts +4 -4
  102. package/out/zero-protocol/src/inspect-down.d.ts +16 -16
  103. package/out/zqlite/src/index-usage.d.ts +19 -0
  104. package/out/zqlite/src/index-usage.d.ts.map +1 -0
  105. package/out/zqlite/src/index-usage.js +49 -0
  106. package/out/zqlite/src/index-usage.js.map +1 -0
  107. package/out/zqlite/src/table-source.d.ts.map +1 -1
  108. package/out/zqlite/src/table-source.js +7 -1
  109. package/out/zqlite/src/table-source.js.map +1 -1
  110. package/package.json +2 -2
@@ -15,7 +15,7 @@ import { timingSafeEqual } from "node:crypto";
15
15
  var ZERO_ENV_VAR_PREFIX = "ZERO_";
16
16
  var appOptions = {
17
17
  id: {
18
- type: valita_exports.string().default("zero").assert((id) => ALLOWED_APP_ID_CHARACTERS.test(id), INVALID_APP_ID_MESSAGE),
18
+ type: valita_exports.string().optional(() => "zero").assert((id) => ALLOWED_APP_ID_CHARACTERS.test(id), INVALID_APP_ID_MESSAGE),
19
19
  desc: [
20
20
  "Unique identifier for the app.",
21
21
  "",
@@ -65,7 +65,7 @@ var shardOptions = {
65
65
  hidden: true
66
66
  },
67
67
  num: {
68
- type: valita_exports.number().default(0),
68
+ type: valita_exports.number().optional(() => 0),
69
69
  desc: [
70
70
  `The shard number (from 0 to NUM_SHARDS) of the App. zero will eventually`,
71
71
  `support data sharding as a first-class primitive; until then, deploying`,
@@ -77,7 +77,7 @@ var shardOptions = {
77
77
  };
78
78
  var replicaOptions = {
79
79
  file: {
80
- type: valita_exports.string().default("zero.db"),
80
+ type: valita_exports.string().optional(() => "zero.db"),
81
81
  desc: [
82
82
  `File path to the SQLite replica that zero-cache maintains.`,
83
83
  `This can be lost, but if it is, zero-cache will have to re-replicate next`,
@@ -100,7 +100,7 @@ var perUserMutationLimit = {
100
100
  desc: [`The maximum mutations per user within the specified {bold windowMs}.`, `If unset, no rate limiting is enforced.`]
101
101
  },
102
102
  windowMs: {
103
- type: valita_exports.number().default(6e4),
103
+ type: valita_exports.number().optional(() => 6e4),
104
104
  desc: [`The sliding window over which the {bold perUserMutationLimitMax} is enforced.`]
105
105
  }
106
106
  };
@@ -131,11 +131,11 @@ var authOptions = {
131
131
  deprecated: [`Use cookie-based authentication or an auth token instead - see https://zero.rocicorp.dev/docs/auth.`]
132
132
  },
133
133
  revalidateIntervalSeconds: {
134
- type: valita_exports.number().default(300),
134
+ type: valita_exports.number().optional(() => 300),
135
135
  desc: [`The interval in seconds between periodic /query auth revalidation for validated connections.`, `If unset, periodic auth revalidation is disabled.`]
136
136
  },
137
137
  retransformIntervalSeconds: {
138
- type: valita_exports.number().default(300),
138
+ type: valita_exports.number().optional(() => 300),
139
139
  desc: [`The interval in seconds between periodic shared /query retransform work for a client group.`, `If unset, periodic shared retransform is disabled.`]
140
140
  }
141
141
  };
@@ -192,7 +192,7 @@ var makeMutatorQueryOptions = (replacement, suffix) => ({
192
192
  ...replacement ? { deprecated: [makeDeprecationMessage(`${replacement}-api-key`)] } : {}
193
193
  },
194
194
  forwardCookies: {
195
- type: valita_exports.boolean().default(false),
195
+ type: valita_exports.boolean().optional(() => false),
196
196
  desc: [
197
197
  `If true, zero-cache will forward cookies from the request.`,
198
198
  `This is useful for passing authentication cookies to the API server.`,
@@ -236,7 +236,7 @@ var zeroOptions = {
236
236
  desc: [`The "upstream" authoritative postgres database.`, `In the future we will support other types of upstream besides PG.`]
237
237
  },
238
238
  type: {
239
- type: literalUnion("pg", "custom").default("pg"),
239
+ type: literalUnion("pg", "custom").optional(() => "pg"),
240
240
  desc: [
241
241
  `The meaning of the {bold upstream-db} depends on the upstream type:`,
242
242
  `* {bold pg}: The connection database string, e.g. "postgres://..."`,
@@ -246,7 +246,7 @@ var zeroOptions = {
246
246
  hidden: true
247
247
  },
248
248
  maxConns: {
249
- type: valita_exports.number().default(20),
249
+ type: valita_exports.number().optional(() => 20),
250
250
  desc: [
251
251
  `The maximum number of connections to open to the upstream database`,
252
252
  `for committing mutations. This is divided evenly amongst sync workers.`,
@@ -275,7 +275,7 @@ var zeroOptions = {
275
275
  ]
276
276
  },
277
277
  pgReplicationSlotPerReplica: {
278
- type: valita_exports.boolean().default(false),
278
+ type: valita_exports.boolean().optional(() => false),
279
279
  desc: [
280
280
  `Creates a dedicated replication slot for each replication-manager, rather than`,
281
281
  `having a new replication-manager take over the slot of the one it replaces.`,
@@ -312,7 +312,7 @@ var zeroOptions = {
312
312
  hidden: true
313
313
  },
314
314
  pgResumeOrphanedSlotGracePeriodMs: {
315
- type: valita_exports.number().default(2e4),
315
+ type: valita_exports.number().optional(() => 2e4),
316
316
  desc: [
317
317
  `The grace period to wait before taking over an inactive replication slot, "resuming"`,
318
318
  `the replica. With high availability replication, a new replica is generally "forked"`,
@@ -326,7 +326,7 @@ var zeroOptions = {
326
326
  hidden: true
327
327
  },
328
328
  pgReplicationEpoch: {
329
- type: valita_exports.number().default(0),
329
+ type: valita_exports.number().optional(() => 0),
330
330
  desc: [
331
331
  `Replication managers sharing the same epoch attempt to converge on a single`,
332
332
  `generation (i.e. the result of an initial-sync); if multiple tasks are started`,
@@ -345,7 +345,7 @@ var zeroOptions = {
345
345
  hidden: true
346
346
  },
347
347
  pgPartialIndexTriggers: {
348
- type: valita_exports.boolean().default(false),
348
+ type: valita_exports.boolean().optional(() => false),
349
349
  hidden: true
350
350
  },
351
351
  pgStreamInboundTimeoutMs: {
@@ -377,7 +377,7 @@ var zeroOptions = {
377
377
  getQueries: getQueriesOptions,
378
378
  query: queryOptions,
379
379
  enableCrudMutations: {
380
- type: valita_exports.boolean().default(true),
380
+ type: valita_exports.boolean().optional(() => true),
381
381
  desc: [
382
382
  `Enables support for legacy CRUD mutations. When this is {bold false}, no connections`,
383
383
  `are made from view-syncers to the upstream db, and push messages with CRUD mutations`,
@@ -385,7 +385,7 @@ var zeroOptions = {
385
385
  ]
386
386
  },
387
387
  allowLegacyQueries: {
388
- type: valita_exports.boolean().default(false),
388
+ type: valita_exports.boolean().optional(() => false),
389
389
  desc: [
390
390
  `Allows clients to send legacy query ASTs directly to zero-cache.`,
391
391
  `Keep this disabled when using custom queries so that zero-cache rejects`,
@@ -402,7 +402,7 @@ var zeroOptions = {
402
402
  ]
403
403
  },
404
404
  maxConns: {
405
- type: valita_exports.number().default(30),
405
+ type: valita_exports.number().optional(() => 30),
406
406
  desc: [
407
407
  `The maximum number of connections to open to the CVR database.`,
408
408
  `This is divided evenly amongst sync workers.`,
@@ -416,7 +416,7 @@ var zeroOptions = {
416
416
  hidden: true
417
417
  },
418
418
  garbageCollectionInactivityThresholdHours: {
419
- type: valita_exports.number().default(168),
419
+ type: valita_exports.number().optional(() => 168),
420
420
  desc: [
421
421
  `The duration after which an inactive CVR is eligible for garbage collection.`,
422
422
  `Purging a CVR forces the next connection from that client group to`,
@@ -427,7 +427,7 @@ var zeroOptions = {
427
427
  ]
428
428
  },
429
429
  garbageCollectionInitialIntervalSeconds: {
430
- type: valita_exports.number().default(60),
430
+ type: valita_exports.number().optional(() => 60),
431
431
  desc: [
432
432
  `The initial interval at which to check and garbage collect inactive CVRs.`,
433
433
  `This interval is increased exponentially (up to 16 minutes) when there is`,
@@ -435,7 +435,7 @@ var zeroOptions = {
435
435
  ]
436
436
  },
437
437
  garbageCollectionInitialBatchSize: {
438
- type: valita_exports.number().default(25),
438
+ type: valita_exports.number().optional(() => 25),
439
439
  desc: [
440
440
  `The initial number of CVRs to purge per garbage collection interval.`,
441
441
  `This number is increased linearly if the rate of new CVRs exceeds the rate of`,
@@ -454,12 +454,12 @@ var zeroOptions = {
454
454
  ]
455
455
  },
456
456
  sqliteCorruptionChecks: {
457
- type: valita_exports.boolean().default(false),
457
+ type: valita_exports.boolean().optional(() => false),
458
458
  desc: [`Run SQLite quick_check and integrity_check when corruption is detected.`, `These checks scan the replica and can take a long time on large databases.`],
459
459
  hidden: true
460
460
  },
461
461
  snapshotRowCacheSize: {
462
- type: valita_exports.number().default(5e4),
462
+ type: valita_exports.number().optional(() => 5e4),
463
463
  desc: [
464
464
  `The maximum number of entries in the per-worker cache of replica rows`,
465
465
  `read while advancing IVM pipelines. Every client group on a sync worker`,
@@ -472,7 +472,7 @@ var zeroOptions = {
472
472
  hidden: true
473
473
  },
474
474
  enableQueryPlanner: {
475
- type: valita_exports.boolean().default(true),
475
+ type: valita_exports.boolean().optional(() => true),
476
476
  desc: [
477
477
  `Enable the query planner for optimizing ZQL queries.`,
478
478
  ``,
@@ -483,7 +483,7 @@ var zeroOptions = {
483
483
  ]
484
484
  },
485
485
  enableCorrelatedPredicatePushdown: {
486
- type: valita_exports.boolean().default(true),
486
+ type: valita_exports.boolean().optional(() => true),
487
487
  desc: [
488
488
  `Copy a query's equality conditions on a relationship's join columns`,
489
489
  `into the related subquery. This reduces the rows that are read when a`,
@@ -494,7 +494,7 @@ var zeroOptions = {
494
494
  hidden: true
495
495
  },
496
496
  enablePlannerAwarePushdown: {
497
- type: valita_exports.boolean().default(true),
497
+ type: valita_exports.boolean().optional(() => true),
498
498
  desc: [
499
499
  `Copy the conditions of correlated predicate pushdown before the query`,
500
500
  `planner runs instead of after, so that the planner can use them. This`,
@@ -505,7 +505,7 @@ var zeroOptions = {
505
505
  hidden: true
506
506
  },
507
507
  enableQueryCovering: {
508
- type: valita_exports.boolean().default(true),
508
+ type: valita_exports.boolean().optional(() => true),
509
509
  desc: [
510
510
  `Enable shadow-mode query covering detection during query hydration.`,
511
511
  ``,
@@ -516,7 +516,7 @@ var zeroOptions = {
516
516
  ]
517
517
  },
518
518
  deferIvmWrites: {
519
- type: valita_exports.boolean().default(true),
519
+ type: valita_exports.boolean().optional(() => true),
520
520
  desc: [
521
521
  `Derive IVM advancements without writing to the replica snapshot.`,
522
522
  ``,
@@ -535,7 +535,7 @@ var zeroOptions = {
535
535
  hidden: true
536
536
  },
537
537
  deferIvmWritesHeapProportion: {
538
- type: valita_exports.number().assert((value) => value > 0 && value <= 1, "must be greater than 0 and at most 1").default(.25),
538
+ type: valita_exports.number().assert((value) => value > 0 && value <= 1, "must be greater than 0 and at most 1").optional(() => .25),
539
539
  desc: [
540
540
  `With {bold deferIvmWrites}, the proportion of {bold --max-old-space-size}`,
541
541
  `that the client groups of one sync worker may hold in memory at once.`,
@@ -552,7 +552,7 @@ var zeroOptions = {
552
552
  hidden: true
553
553
  },
554
554
  yieldThresholdMs: {
555
- type: valita_exports.number().default(10),
555
+ type: valita_exports.number().optional(() => 10),
556
556
  desc: [
557
557
  `The maximum amount of time in milliseconds that a sync worker will`,
558
558
  `spend in IVM (processing query hydration and advancement) before yielding`,
@@ -561,7 +561,7 @@ var zeroOptions = {
561
561
  ]
562
562
  },
563
563
  viewSyncerHydrationBudgetMs: {
564
- type: valita_exports.number().assert((value) => Number.isSafeInteger(value) && value >= 0, "must be a nonnegative integer").default(0),
564
+ type: valita_exports.number().assert((value) => Number.isSafeInteger(value) && value >= 0, "must be a nonnegative integer").optional(() => 0),
565
565
  desc: [
566
566
  `The soft time budget in milliseconds for hydrating inactive queries`,
567
567
  `during a view-syncer hydration pass. Active and internal queries always`,
@@ -573,7 +573,7 @@ var zeroOptions = {
573
573
  ]
574
574
  },
575
575
  viewSyncerQueryHydrationTimeoutMs: {
576
- type: valita_exports.number().assert((value) => Number.isSafeInteger(value) && value >= 0, "must be a nonnegative integer").default(0),
576
+ type: valita_exports.number().assert((value) => Number.isSafeInteger(value) && value >= 0, "must be a nonnegative integer").optional(() => 0),
577
577
  desc: [
578
578
  `The maximum processing time in milliseconds that a view-syncer spends`,
579
579
  `hydrating a single client query. Time spent yielding to other work is`,
@@ -595,12 +595,12 @@ var zeroOptions = {
595
595
  },
596
596
  /** @deprecated */
597
597
  maxConns: {
598
- type: valita_exports.number().default(5),
598
+ type: valita_exports.number().optional(() => 5),
599
599
  deprecated: [`Connections to the change db are created dynamically for subscriber catchup. Ensure`, `that the database supports sufficient connections for at least 5 + numViewSyncers.`],
600
600
  hidden: true
601
601
  },
602
602
  statementTimeoutMs: {
603
- type: valita_exports.number().default(3e4),
603
+ type: valita_exports.number().optional(() => 3e4),
604
604
  desc: [
605
605
  `Fail change-log db operations that make no progress within the specified timeout. This`,
606
606
  `differs from a postgres {bold statement_timeout} in that it is implemented to handle a`,
@@ -610,7 +610,7 @@ var zeroOptions = {
610
610
  hidden: true
611
611
  },
612
612
  logBatchSize: {
613
- type: valita_exports.number().assert((n) => Number.isInteger(n) && n >= 1, `change.logBatchSize must be an integer >= 1`).default(2e3),
613
+ type: valita_exports.number().assert((n) => Number.isInteger(n) && n >= 1, `change.logBatchSize must be an integer >= 1`).optional(() => 2e3),
614
614
  desc: [
615
615
  `The maximum number of change-log rows written per multi-row INSERT to the change`,
616
616
  `database. Larger upstream transactions are persisted in batches of this size rather`,
@@ -628,7 +628,7 @@ var zeroOptions = {
628
628
  shard: shardOptions,
629
629
  auth: authOptions,
630
630
  port: {
631
- type: valita_exports.number().default(4848),
631
+ type: valita_exports.number().optional(() => 4848),
632
632
  desc: [`The port for sync connections.`]
633
633
  },
634
634
  keepaliveTimeoutMs: {
@@ -662,7 +662,7 @@ var zeroOptions = {
662
662
  ]
663
663
  },
664
664
  mode: {
665
- type: literalUnion("dedicated", "discover").default("dedicated"),
665
+ type: literalUnion("dedicated", "discover").optional(() => "dedicated"),
666
666
  desc: [
667
667
  `As an alternative to {bold ZERO_CHANGE_STREAMER_URI}, the {bold ZERO_CHANGE_STREAMER_MODE}`,
668
668
  `can be set to "{bold discover}" to instruct the {bold view-syncer} to connect to the `,
@@ -693,12 +693,12 @@ var zeroOptions = {
693
693
  },
694
694
  /** @deprecated */
695
695
  protocol: {
696
- type: literalUnion("ws", "wss").default("ws"),
696
+ type: literalUnion("ws", "wss").optional(() => "ws"),
697
697
  deprecated: [`Set the {bold ZERO_CHANGE_STREAMER_URI} on view-syncers instead.`],
698
698
  hidden: true
699
699
  },
700
700
  discoveryInterfacePreferences: {
701
- type: valita_exports.array(valita_exports.string()).default([...DEFAULT_PREFERRED_PREFIXES]),
701
+ type: valita_exports.array(valita_exports.string()).optional(() => [...DEFAULT_PREFERRED_PREFIXES]),
702
702
  desc: [
703
703
  `The name prefixes to prefer when introspecting the network interfaces to determine`,
704
704
  `the externally reachable IP address for change-streamer discovery. This defaults`,
@@ -708,7 +708,7 @@ var zeroOptions = {
708
708
  hidden: true
709
709
  },
710
710
  startupDelayMs: {
711
- type: valita_exports.number().default(15e3),
711
+ type: valita_exports.number().optional(() => 15e3),
712
712
  desc: [
713
713
  `The delay to wait before the change-streamer takes over the replication stream`,
714
714
  `(i.e. the handoff during replication-manager updates), to allow loadbalancers to register`,
@@ -718,12 +718,12 @@ var zeroOptions = {
718
718
  ]
719
719
  },
720
720
  sqliteChangeLogMode: {
721
- type: literalUnion("off", "write", "compare", "serve").default("off"),
721
+ type: literalUnion("off", "write", "compare", "serve").optional(() => "off"),
722
722
  desc: [`Controls the staged SQLite change-log rollout. Modes are cumulative:`, `{bold off}, {bold write}, {bold compare}, and {bold serve}.`],
723
723
  hidden: true
724
724
  },
725
725
  pgChangeLogEnabled: {
726
- type: valita_exports.boolean().default(true),
726
+ type: valita_exports.boolean().optional(() => true),
727
727
  desc: [
728
728
  `Whether the legacy Postgres change log remains authoritative for`,
729
729
  `stream initialization, persistence, catchup, and upstream ACKs.`,
@@ -732,12 +732,12 @@ var zeroOptions = {
732
732
  hidden: true
733
733
  },
734
734
  sqliteChangeLogReadPercent: {
735
- type: valita_exports.number().default(0),
735
+ type: valita_exports.number().optional(() => 0),
736
736
  desc: [`The stable percentage of eligible catchup subscriptions served from SQLite.`],
737
737
  hidden: true
738
738
  },
739
739
  sqliteChangeLogColdReadPercent: {
740
- type: valita_exports.number().default(0),
740
+ type: valita_exports.number().optional(() => 0),
741
741
  desc: [
742
742
  `The stable percentage of eligible catchup subscriptions served from a`,
743
743
  `SQLite change log that is younger than its retention window, i.e. one`,
@@ -749,27 +749,27 @@ var zeroOptions = {
749
749
  hidden: true
750
750
  },
751
751
  sqliteChangeLogComparePercent: {
752
- type: valita_exports.number().default(1),
752
+ type: valita_exports.number().optional(() => 1),
753
753
  desc: [`The stable percentage of committed transactions whose catchup output is`, `compared between the Postgres and SQLite change logs in {bold compare} mode.`],
754
754
  hidden: true
755
755
  },
756
756
  sqliteChangeLogRetentionMs: {
757
- type: valita_exports.number().default(6e4),
757
+ type: valita_exports.number().optional(() => 6e4),
758
758
  desc: [`The minimum time window retained in the SQLite change log.`],
759
759
  hidden: true
760
760
  },
761
761
  sqliteChangeLogReadBatchRows: {
762
- type: valita_exports.number().default(1e3),
762
+ type: valita_exports.number().optional(() => 1e3),
763
763
  desc: [`The target number of rows in each SQLite catchup read batch.`],
764
764
  hidden: true
765
765
  },
766
766
  sqliteChangeLogPurgeBatchRows: {
767
- type: valita_exports.number().default(1e3),
767
+ type: valita_exports.number().optional(() => 1e3),
768
768
  desc: [`The target number of rows in each SQLite purge batch.`],
769
769
  hidden: true
770
770
  },
771
771
  sqliteChangeLogBarrierTimeoutMs: {
772
- type: valita_exports.number().default(3e5),
772
+ type: valita_exports.number().optional(() => 3e5),
773
773
  desc: [
774
774
  `The maximum wait for the SQLite required-head barrier. This is a`,
775
775
  `backstop for a wedged replica on an idle shard, where waiting costs`,
@@ -781,7 +781,7 @@ var zeroOptions = {
781
781
  hidden: true
782
782
  },
783
783
  backPressureLimitHeapProportion: {
784
- type: valita_exports.number().default(.04),
784
+ type: valita_exports.number().optional(() => .04),
785
785
  desc: [
786
786
  `The percentage of {bold --max-old-space-size} to use as a buffer for absorbing replication`,
787
787
  `stream spikes. When the estimated amount of queued data exceeds this threshold, back pressure`,
@@ -804,7 +804,7 @@ var zeroOptions = {
804
804
  ]
805
805
  },
806
806
  flowControlConsensusTimeoutProportion: {
807
- type: valita_exports.number().default(4),
807
+ type: valita_exports.number().optional(() => 4),
808
808
  desc: [
809
809
  `During periodic flow control checks (every 64kb), the amount of time to wait after the majority`,
810
810
  `of subscribers have acked, proportional to that interval, after which replication will continue`,
@@ -831,7 +831,7 @@ var zeroOptions = {
831
831
  ]
832
832
  },
833
833
  flowControlSlowSubscriberGracePeriodSeconds: {
834
- type: valita_exports.number().default(30),
834
+ type: valita_exports.number().optional(() => 30),
835
835
  desc: [
836
836
  `The period of time after which a lagging subscriber is disconnected and instructed to`,
837
837
  `restart. A subscriber is considered lagging if it {italic continuously} (1) exceeds the`,
@@ -878,7 +878,7 @@ var zeroOptions = {
878
878
  ]
879
879
  },
880
880
  autoReset: {
881
- type: valita_exports.boolean().default(true),
881
+ type: valita_exports.boolean().optional(() => true),
882
882
  desc: [
883
883
  `Automatically wipe and resync the replica when replication is halted.`,
884
884
  `This situation can occur for configurations in which the upstream database`,
@@ -895,7 +895,7 @@ var zeroOptions = {
895
895
  },
896
896
  replicationLag: {
897
897
  reportIntervalMs: {
898
- type: valita_exports.number().default(1e4),
898
+ type: valita_exports.number().optional(() => 1e4),
899
899
  desc: [
900
900
  `The approximate interval at which replication lag reports are written upstream and`,
901
901
  `reported via the {bold zero.replication.total_lag} opentelemetry metric. If`,
@@ -916,7 +916,7 @@ var zeroOptions = {
916
916
  ]
917
917
  },
918
918
  initialReadinessThresholdMs: {
919
- type: valita_exports.number().default(1e3),
919
+ type: valita_exports.number().optional(() => 1e3),
920
920
  desc: [
921
921
  `The maximum replication lag in milliseconds that a server is allowed to have`,
922
922
  `before it advertises readiness (to serve traffic). This prevents the server`,
@@ -930,7 +930,7 @@ var zeroOptions = {
930
930
  ]
931
931
  },
932
932
  maxReadinessDelayMs: {
933
- type: valita_exports.number().default(6e5),
933
+ type: valita_exports.number().optional(() => 6e5),
934
934
  desc: [
935
935
  `The maximum time in milliseconds that a server will wait for replication lag`,
936
936
  `to fall below the {bold ZERO_REPLICATION_LAG_INITIAL_READINESS_THRESHOLD_MS}`,
@@ -975,7 +975,7 @@ var zeroOptions = {
975
975
  ]
976
976
  },
977
977
  websocketCompression: {
978
- type: valita_exports.boolean().default(false),
978
+ type: valita_exports.boolean().optional(() => false),
979
979
  desc: [
980
980
  "Enable WebSocket per-message deflate compression.",
981
981
  "",
@@ -998,7 +998,7 @@ var zeroOptions = {
998
998
  ]
999
999
  },
1000
1000
  websocketMaxPayloadBytes: {
1001
- type: valita_exports.number().default(10 * 1024 * 1024),
1001
+ type: valita_exports.number().optional(() => 10 * 1024 * 1024),
1002
1002
  desc: [
1003
1003
  "Maximum size of incoming WebSocket messages in bytes.",
1004
1004
  "",
@@ -1026,7 +1026,7 @@ var zeroOptions = {
1026
1026
  ]
1027
1027
  },
1028
1028
  restoreUsingV5: {
1029
- type: valita_exports.boolean().default(true),
1029
+ type: valita_exports.boolean().optional(() => true),
1030
1030
  desc: [
1031
1031
  `Restores the backup using the {bold ZERO_LITESTREAM_EXECUTABLE_V5} if specified.`,
1032
1032
  `This provides a recovery path if rolling back from {bold ZERO_LITESTREAM_BACKUP_USING_V5}`,
@@ -1034,7 +1034,7 @@ var zeroOptions = {
1034
1034
  ]
1035
1035
  },
1036
1036
  backupUsingV5: {
1037
- type: valita_exports.boolean().default(true),
1037
+ type: valita_exports.boolean().optional(() => true),
1038
1038
  desc: [
1039
1039
  `Backs up the replica using Litestream v0.5.x. This is required for (upcoming)`,
1040
1040
  `high-availability replication. Set to false to revert to Litestream v0.3.x backups.`,
@@ -1055,7 +1055,7 @@ var zeroOptions = {
1055
1055
  ]
1056
1056
  },
1057
1057
  forkBackup: {
1058
- type: valita_exports.boolean().default(true),
1058
+ type: valita_exports.boolean().optional(() => true),
1059
1059
  hidden: true,
1060
1060
  desc: [
1061
1061
  `When a replication-manager restores from another replication-manager's`,
@@ -1069,7 +1069,7 @@ var zeroOptions = {
1069
1069
  ]
1070
1070
  },
1071
1071
  configPath: {
1072
- type: valita_exports.string().default("./src/services/litestream/config.yml"),
1072
+ type: valita_exports.string().optional(() => "./src/services/litestream/config.yml"),
1073
1073
  desc: [
1074
1074
  `Path to the litestream yaml config file. zero-cache will run this with its`,
1075
1075
  `environment variables, which can be referenced in the file via $\\{ENV\\}`,
@@ -1081,7 +1081,7 @@ var zeroOptions = {
1081
1081
  ]
1082
1082
  },
1083
1083
  configPathV5: {
1084
- type: valita_exports.string().default("./src/services/litestream/config-v5.yml"),
1084
+ type: valita_exports.string().optional(() => "./src/services/litestream/config-v5.yml"),
1085
1085
  desc: [
1086
1086
  `Path to the litestream v5 yaml config file. zero-cache will run this with its`,
1087
1087
  `environment variables, which can be referenced in the file via $\\{ENV\\}`,
@@ -1092,7 +1092,7 @@ var zeroOptions = {
1092
1092
  `* {bold ZERO_LOG_FORMAT} for the log type`
1093
1093
  ]
1094
1094
  },
1095
- logLevel: { type: literalUnion("debug", "info", "warn", "error").default("warn") },
1095
+ logLevel: { type: literalUnion("debug", "info", "warn", "error").optional(() => "warn") },
1096
1096
  backupURL: {
1097
1097
  type: valita_exports.string().optional(),
1098
1098
  desc: [
@@ -1128,7 +1128,7 @@ var zeroOptions = {
1128
1128
  ]
1129
1129
  },
1130
1130
  checkpointThresholdMB: {
1131
- type: valita_exports.number().default(40),
1131
+ type: valita_exports.number().optional(() => 40),
1132
1132
  desc: [
1133
1133
  `The size of the WAL file at which litestream performs background, best-effort (PASSIVE)`,
1134
1134
  `SQLite checkpoints to apply the writes in the WAL to the main database file. Checkpoints`,
@@ -1155,7 +1155,7 @@ var zeroOptions = {
1155
1155
  ]
1156
1156
  },
1157
1157
  forceCheckpointThresholdMB: {
1158
- type: valita_exports.number().default(256),
1158
+ type: valita_exports.number().optional(() => 256),
1159
1159
  desc: [
1160
1160
  `The size of the WAL file at which to pause writes and explicitly initiate a`,
1161
1161
  `local litestream sync. This is a safeguard for the situation in which litestream's`,
@@ -1177,7 +1177,7 @@ var zeroOptions = {
1177
1177
  ]
1178
1178
  },
1179
1179
  maxWalSizeMB: {
1180
- type: valita_exports.number().default(10240),
1180
+ type: valita_exports.number().optional(() => 10240),
1181
1181
  desc: [
1182
1182
  `A fail-safe that pauses writes once the un-checkpointed WAL reaches this size,`,
1183
1183
  `resuming when litestream manages to checkpoint it. This bounds WAL growth (and`,
@@ -1194,7 +1194,7 @@ var zeroOptions = {
1194
1194
  ]
1195
1195
  },
1196
1196
  incrementalBackupIntervalMinutes: {
1197
- type: valita_exports.number().default(15),
1197
+ type: valita_exports.number().optional(() => 15),
1198
1198
  desc: [
1199
1199
  `The interval between incremental v3 backups of the replica. Shorter intervals`,
1200
1200
  `reduce the amount of change history that needs to be replayed when catching`,
@@ -1207,7 +1207,7 @@ var zeroOptions = {
1207
1207
  ]
1208
1208
  },
1209
1209
  snapshotBackupIntervalHours: {
1210
- type: valita_exports.number().default(12),
1210
+ type: valita_exports.number().optional(() => 12),
1211
1211
  desc: [
1212
1212
  `The interval between snapshot backups of the replica. Applies to both`,
1213
1213
  `litestream v3 and v5 backups.`,
@@ -1225,7 +1225,7 @@ var zeroOptions = {
1225
1225
  ]
1226
1226
  },
1227
1227
  incrementalBackupIntervalSeconds: {
1228
- type: valita_exports.number().default(15),
1228
+ type: valita_exports.number().optional(() => 15),
1229
1229
  desc: [
1230
1230
  `The interval between incremental v5 backups of the replica. With litestream v5`,
1231
1231
  `the upstream change source is not ACKed until the corresponding changes have been`,
@@ -1240,15 +1240,20 @@ var zeroOptions = {
1240
1240
  ]
1241
1241
  },
1242
1242
  restoreParallelism: {
1243
- type: valita_exports.number().default(48),
1243
+ type: valita_exports.number().optional(() => 48),
1244
1244
  desc: [`The number of WAL files to download in parallel when performing the`, `initial restore of the replica from the backup.`]
1245
1245
  },
1246
1246
  multipartConcurrency: {
1247
- type: valita_exports.number().default(48),
1248
- desc: [`The number of parts (of size {bold --litestream-multipart-size} bytes)`, `to upload or download in parallel when backing up or restoring the snapshot.`]
1247
+ type: valita_exports.number().optional(),
1248
+ desc: [
1249
+ `The number of parts (of size {bold --litestream-multipart-size} bytes)`,
1250
+ `to upload or download in parallel when backing up or restoring the snapshot.`,
1251
+ `Leave this unset to use 48, reduced as needed to keep the parts within`,
1252
+ `a quarter of the memory available to the container.`
1253
+ ]
1249
1254
  },
1250
1255
  multipartSize: {
1251
- type: valita_exports.number().default(16 * 1024 * 1024),
1256
+ type: valita_exports.number().optional(() => 16 * 1024 * 1024),
1252
1257
  desc: [
1253
1258
  `The size of each part when uploading or downloading the snapshot with`,
1254
1259
  `{bold --multipart-concurrency}. Note that up to {bold concurrency * size}`,
@@ -1262,7 +1267,7 @@ var zeroOptions = {
1262
1267
  },
1263
1268
  initialSync: {
1264
1269
  tableCopyWorkers: {
1265
- type: valita_exports.number().default(5),
1270
+ type: valita_exports.number().optional(() => 5),
1266
1271
  desc: [
1267
1272
  `The number of parallel workers used to copy tables during initial sync.`,
1268
1273
  `Each worker uses a database connection and will buffer up to (approximately)`,
@@ -1277,7 +1282,7 @@ var zeroOptions = {
1277
1282
  desc: [`Takes a cpu profile during the copy phase initial-sync, storing it as a JSON file`, `initial-copy.cpuprofile in the tmp directory.`]
1278
1283
  },
1279
1284
  textCopy: {
1280
- type: valita_exports.boolean().default(false),
1285
+ type: valita_exports.boolean().optional(() => false),
1281
1286
  desc: [
1282
1287
  `Use text-format COPY instead of binary COPY for initial sync and`,
1283
1288
  `backfill streaming. This is slower but can work around issues with`,
@@ -1287,7 +1292,7 @@ var zeroOptions = {
1287
1292
  },
1288
1293
  shadowSync: {
1289
1294
  enabled: {
1290
- type: valita_exports.boolean().default(false),
1295
+ type: valita_exports.boolean().optional(() => false),
1291
1296
  desc: [
1292
1297
  `Periodically exercises the initial-sync code path against a sample of`,
1293
1298
  `rows from every published table, writing to a throwaway SQLite database.`,
@@ -1297,7 +1302,7 @@ var zeroOptions = {
1297
1302
  ]
1298
1303
  },
1299
1304
  intervalHours: {
1300
- type: valita_exports.number().default(12),
1305
+ type: valita_exports.number().optional(() => 12),
1301
1306
  desc: [
1302
1307
  `The interval between shadow initial-sync runs, in hours. The first`,
1303
1308
  `run fires within [2/3, 1) of this interval after startup, so the`,
@@ -1307,7 +1312,7 @@ var zeroOptions = {
1307
1312
  ]
1308
1313
  },
1309
1314
  sampleRate: {
1310
- type: valita_exports.number().default(.1),
1315
+ type: valita_exports.number().optional(() => .1),
1311
1316
  desc: [
1312
1317
  `The BERNOULLI sampling rate for each table (0 < rate <= 1). A value of`,
1313
1318
  `1 disables sampling and copies all rows (still subject to`,
@@ -1315,13 +1320,13 @@ var zeroOptions = {
1315
1320
  ]
1316
1321
  },
1317
1322
  maxRowsPerTable: {
1318
- type: valita_exports.number().default(1e4),
1323
+ type: valita_exports.number().optional(() => 1e4),
1319
1324
  desc: [`The hard upper bound on rows copied per table per shadow run. Guards`, `against unexpectedly large tables consuming disk / upstream bandwidth.`]
1320
1325
  }
1321
1326
  },
1322
1327
  /** @deprecated */
1323
1328
  targetClientRowCount: {
1324
- type: valita_exports.number().default(2e4),
1329
+ type: valita_exports.number().optional(() => 2e4),
1325
1330
  deprecated: [
1326
1331
  "This option is no longer used and will be removed in a future version.",
1327
1332
  "The client-side cache no longer enforces a row limit. Instead, TTL-based expiration",
@@ -1330,7 +1335,7 @@ var zeroOptions = {
1330
1335
  hidden: true
1331
1336
  },
1332
1337
  lazyStartup: {
1333
- type: valita_exports.boolean().default(false),
1338
+ type: valita_exports.boolean().optional(() => false),
1334
1339
  desc: [
1335
1340
  "Delay starting the majority of zero-cache until first request.",
1336
1341
  "",
@@ -1345,7 +1350,7 @@ var zeroOptions = {
1345
1350
  desc: [`The version string outputted to logs when the server starts up.`]
1346
1351
  },
1347
1352
  enableTelemetry: {
1348
- type: valita_exports.boolean().default(true),
1353
+ type: valita_exports.boolean().optional(() => true),
1349
1354
  desc: [
1350
1355
  `Set to false to opt out of telemetry collection.`,
1351
1356
  ``,