@fedify/postgres 2.4.0-pr.934.40 → 2.4.0

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/kv.cjs CHANGED
@@ -1,9 +1,11 @@
1
1
 
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- require("./_virtual/_rolldown/runtime.cjs");
3
+ const require_index = require("./node_modules/.pnpm/temporal-polyfill@1.0.1/node_modules/temporal-polyfill/index.cjs");
4
4
  const require_utils = require("./utils.cjs");
5
+ let _logtape_logtape = require("@logtape/logtape");
5
6
  //#region src/kv.ts
6
- const logger = (0, require("@logtape/logtape").getLogger)([
7
+ const Temporal = require_index.Temporal;
8
+ const logger = (0, _logtape_logtape.getLogger)([
7
9
  "fedify",
8
10
  "postgres",
9
11
  "kv"
@@ -30,7 +32,8 @@ var PostgresKvStore = class {
30
32
  #sql;
31
33
  #tableName;
32
34
  #unlogged;
33
- #initialized;
35
+ #skipDdl;
36
+ #initialized = false;
34
37
  #initializing;
35
38
  #driverSerializesJson = false;
36
39
  /**
@@ -42,7 +45,7 @@ var PostgresKvStore = class {
42
45
  this.#sql = sql;
43
46
  this.#tableName = options.tableName ?? "fedify_kv_v2";
44
47
  this.#unlogged = options.unlogged ?? false;
45
- this.#initialized = options.initialized ?? false;
48
+ this.#skipDdl = options.initialized ?? false;
46
49
  }
47
50
  async #expire() {
48
51
  await this.#sql`
@@ -62,7 +65,7 @@ var PostgresKvStore = class {
62
65
  }
63
66
  async set(key, value, options) {
64
67
  await this.initialize();
65
- const ttl = options?.ttl == null ? null : options.ttl.toString();
68
+ const ttl = options?.ttl == null ? null : Temporal.Duration.from(options.ttl).toString();
66
69
  await this.#sql`
67
70
  INSERT INTO ${this.#sql(this.#tableName)} (key, value, ttl)
68
71
  VALUES (
@@ -71,7 +74,10 @@ var PostgresKvStore = class {
71
74
  ${ttl}
72
75
  )
73
76
  ON CONFLICT (key)
74
- DO UPDATE SET value = EXCLUDED.value, ttl = EXCLUDED.ttl;
77
+ DO UPDATE SET
78
+ value = EXCLUDED.value,
79
+ created = CURRENT_TIMESTAMP,
80
+ ttl = EXCLUDED.ttl;
75
81
  `;
76
82
  await this.#expire();
77
83
  }
@@ -89,7 +95,7 @@ var PostgresKvStore = class {
89
95
  */
90
96
  async cas(key, expectedValue, newValue, options) {
91
97
  await this.initialize();
92
- const ttl = options?.ttl == null ? null : options.ttl.toString();
98
+ const ttl = options?.ttl == null ? null : Temporal.Duration.from(options.ttl).toString();
93
99
  if (expectedValue === void 0 && newValue === void 0) return await this.get(key) === void 0;
94
100
  let result;
95
101
  if (expectedValue === void 0) result = await this.#sql`
@@ -168,31 +174,7 @@ var PostgresKvStore = class {
168
174
  if (this.#initialized) return;
169
175
  this.#initializing ??= (async () => {
170
176
  logger.debug("Initializing the key–value store table {tableName}...", { tableName: this.#tableName });
171
- if (this.#unlogged) await this.#sql`
172
- CREATE UNLOGGED TABLE IF NOT EXISTS ${this.#sql(this.#tableName)} (
173
- key text[] PRIMARY KEY,
174
- value jsonb NOT NULL,
175
- created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
176
- ttl interval
177
- );
178
- `;
179
- else {
180
- await this.#sql`
181
- CREATE TABLE IF NOT EXISTS ${this.#sql(this.#tableName)} (
182
- key text[] PRIMARY KEY,
183
- value jsonb NOT NULL,
184
- created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
185
- ttl interval
186
- );
187
- `;
188
- if ((await this.#sql`
189
- SELECT relpersistence
190
- FROM pg_class
191
- WHERE oid = to_regclass(${quoteIdentifier(this.#tableName)});
192
- `)[0]?.relpersistence === "u") await this.#sql`
193
- ALTER TABLE ${this.#sql(this.#tableName)} SET LOGGED;
194
- `;
195
- }
177
+ if (!this.#skipDdl) await this.#initializeTable();
196
178
  this.#driverSerializesJson = await require_utils.driverSerializesJson(this.#sql);
197
179
  this.#initialized = true;
198
180
  logger.debug("Initialized the key–value store table {tableName}.", { tableName: this.#tableName });
@@ -204,6 +186,33 @@ var PostgresKvStore = class {
204
186
  throw error;
205
187
  }
206
188
  }
189
+ async #initializeTable() {
190
+ if (this.#unlogged) await this.#sql`
191
+ CREATE UNLOGGED TABLE IF NOT EXISTS ${this.#sql(this.#tableName)} (
192
+ key text[] PRIMARY KEY,
193
+ value jsonb NOT NULL,
194
+ created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
195
+ ttl interval
196
+ );
197
+ `;
198
+ else {
199
+ await this.#sql`
200
+ CREATE TABLE IF NOT EXISTS ${this.#sql(this.#tableName)} (
201
+ key text[] PRIMARY KEY,
202
+ value jsonb NOT NULL,
203
+ created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
204
+ ttl interval
205
+ );
206
+ `;
207
+ if ((await this.#sql`
208
+ SELECT relpersistence
209
+ FROM pg_class
210
+ WHERE oid = to_regclass(${quoteIdentifier(this.#tableName)});
211
+ `)[0]?.relpersistence === "u") await this.#sql`
212
+ ALTER TABLE ${this.#sql(this.#tableName)} SET LOGGED;
213
+ `;
214
+ }
215
+ }
207
216
  /**
208
217
  * Drops the table used by the key–value store. Does nothing if the table
209
218
  * does not exist.
@@ -212,6 +221,7 @@ var PostgresKvStore = class {
212
221
  await this.#sql`DROP TABLE IF EXISTS ${this.#sql(this.#tableName)};`;
213
222
  }
214
223
  #json(value) {
224
+ if (value === null) return this.#sql`'null'::jsonb`;
215
225
  if (this.#driverSerializesJson) return this.#sql.json(value);
216
226
  return this.#sql.json(JSON.stringify(value));
217
227
  }
package/dist/kv.d.cts CHANGED
@@ -15,6 +15,10 @@ interface PostgresKvStoreOptions {
15
15
  readonly tableName?: string;
16
16
  /**
17
17
  * Whether the table has been initialized. `false` by default.
18
+ *
19
+ * This skips only the table's schema DDL. Driver-specific runtime setup,
20
+ * such as detecting whether the driver serializes JSON parameters on its
21
+ * own, still runs before the first key is read or written.
18
22
  * @default `false`
19
23
  */
20
24
  readonly initialized?: boolean;
package/dist/kv.d.ts CHANGED
@@ -15,6 +15,10 @@ interface PostgresKvStoreOptions {
15
15
  readonly tableName?: string;
16
16
  /**
17
17
  * Whether the table has been initialized. `false` by default.
18
+ *
19
+ * This skips only the table's schema DDL. Driver-specific runtime setup,
20
+ * such as detecting whether the driver serializes JSON parameters on its
21
+ * own, still runs before the first key is read or written.
18
22
  * @default `false`
19
23
  */
20
24
  readonly initialized?: boolean;
package/dist/kv.js CHANGED
@@ -29,7 +29,8 @@ var PostgresKvStore = class {
29
29
  #sql;
30
30
  #tableName;
31
31
  #unlogged;
32
- #initialized;
32
+ #skipDdl;
33
+ #initialized = false;
33
34
  #initializing;
34
35
  #driverSerializesJson = false;
35
36
  /**
@@ -41,7 +42,7 @@ var PostgresKvStore = class {
41
42
  this.#sql = sql;
42
43
  this.#tableName = options.tableName ?? "fedify_kv_v2";
43
44
  this.#unlogged = options.unlogged ?? false;
44
- this.#initialized = options.initialized ?? false;
45
+ this.#skipDdl = options.initialized ?? false;
45
46
  }
46
47
  async #expire() {
47
48
  await this.#sql`
@@ -61,7 +62,7 @@ var PostgresKvStore = class {
61
62
  }
62
63
  async set(key, value, options) {
63
64
  await this.initialize();
64
- const ttl = options?.ttl == null ? null : options.ttl.toString();
65
+ const ttl = options?.ttl == null ? null : Temporal.Duration.from(options.ttl).toString();
65
66
  await this.#sql`
66
67
  INSERT INTO ${this.#sql(this.#tableName)} (key, value, ttl)
67
68
  VALUES (
@@ -70,7 +71,10 @@ var PostgresKvStore = class {
70
71
  ${ttl}
71
72
  )
72
73
  ON CONFLICT (key)
73
- DO UPDATE SET value = EXCLUDED.value, ttl = EXCLUDED.ttl;
74
+ DO UPDATE SET
75
+ value = EXCLUDED.value,
76
+ created = CURRENT_TIMESTAMP,
77
+ ttl = EXCLUDED.ttl;
74
78
  `;
75
79
  await this.#expire();
76
80
  }
@@ -88,7 +92,7 @@ var PostgresKvStore = class {
88
92
  */
89
93
  async cas(key, expectedValue, newValue, options) {
90
94
  await this.initialize();
91
- const ttl = options?.ttl == null ? null : options.ttl.toString();
95
+ const ttl = options?.ttl == null ? null : Temporal.Duration.from(options.ttl).toString();
92
96
  if (expectedValue === void 0 && newValue === void 0) return await this.get(key) === void 0;
93
97
  let result;
94
98
  if (expectedValue === void 0) result = await this.#sql`
@@ -167,31 +171,7 @@ var PostgresKvStore = class {
167
171
  if (this.#initialized) return;
168
172
  this.#initializing ??= (async () => {
169
173
  logger.debug("Initializing the key–value store table {tableName}...", { tableName: this.#tableName });
170
- if (this.#unlogged) await this.#sql`
171
- CREATE UNLOGGED TABLE IF NOT EXISTS ${this.#sql(this.#tableName)} (
172
- key text[] PRIMARY KEY,
173
- value jsonb NOT NULL,
174
- created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
175
- ttl interval
176
- );
177
- `;
178
- else {
179
- await this.#sql`
180
- CREATE TABLE IF NOT EXISTS ${this.#sql(this.#tableName)} (
181
- key text[] PRIMARY KEY,
182
- value jsonb NOT NULL,
183
- created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
184
- ttl interval
185
- );
186
- `;
187
- if ((await this.#sql`
188
- SELECT relpersistence
189
- FROM pg_class
190
- WHERE oid = to_regclass(${quoteIdentifier(this.#tableName)});
191
- `)[0]?.relpersistence === "u") await this.#sql`
192
- ALTER TABLE ${this.#sql(this.#tableName)} SET LOGGED;
193
- `;
194
- }
174
+ if (!this.#skipDdl) await this.#initializeTable();
195
175
  this.#driverSerializesJson = await driverSerializesJson(this.#sql);
196
176
  this.#initialized = true;
197
177
  logger.debug("Initialized the key–value store table {tableName}.", { tableName: this.#tableName });
@@ -203,6 +183,33 @@ var PostgresKvStore = class {
203
183
  throw error;
204
184
  }
205
185
  }
186
+ async #initializeTable() {
187
+ if (this.#unlogged) await this.#sql`
188
+ CREATE UNLOGGED TABLE IF NOT EXISTS ${this.#sql(this.#tableName)} (
189
+ key text[] PRIMARY KEY,
190
+ value jsonb NOT NULL,
191
+ created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
192
+ ttl interval
193
+ );
194
+ `;
195
+ else {
196
+ await this.#sql`
197
+ CREATE TABLE IF NOT EXISTS ${this.#sql(this.#tableName)} (
198
+ key text[] PRIMARY KEY,
199
+ value jsonb NOT NULL,
200
+ created timestamp with time zone DEFAULT CURRENT_TIMESTAMP,
201
+ ttl interval
202
+ );
203
+ `;
204
+ if ((await this.#sql`
205
+ SELECT relpersistence
206
+ FROM pg_class
207
+ WHERE oid = to_regclass(${quoteIdentifier(this.#tableName)});
208
+ `)[0]?.relpersistence === "u") await this.#sql`
209
+ ALTER TABLE ${this.#sql(this.#tableName)} SET LOGGED;
210
+ `;
211
+ }
212
+ }
206
213
  /**
207
214
  * Drops the table used by the key–value store. Does nothing if the table
208
215
  * does not exist.
@@ -211,6 +218,7 @@ var PostgresKvStore = class {
211
218
  await this.#sql`DROP TABLE IF EXISTS ${this.#sql(this.#tableName)};`;
212
219
  }
213
220
  #json(value) {
221
+ if (value === null) return this.#sql`'null'::jsonb`;
214
222
  if (this.#driverSerializesJson) return this.#sql.json(value);
215
223
  return this.#sql.json(JSON.stringify(value));
216
224
  }
package/dist/mq.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
 
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const require_runtime = require("./_virtual/_rolldown/runtime.cjs");
4
- const require_utils = require("./utils.cjs");
5
4
  const require_index = require("./node_modules/.pnpm/temporal-polyfill@1.0.1/node_modules/temporal-polyfill/index.cjs");
5
+ const require_utils = require("./utils.cjs");
6
6
  let _logtape_logtape = require("@logtape/logtape");
7
7
  let postgres = require("postgres");
8
8
  postgres = require_runtime.__toESM(postgres, 1);
@@ -63,7 +63,8 @@ var PostgresMessageQueue = class {
63
63
  #channelName;
64
64
  #pollIntervalMs;
65
65
  #handlerTimeoutMs;
66
- #initialized;
66
+ #skipDdl;
67
+ #initialized = false;
67
68
  #initPromise;
68
69
  #driverSerializesJson = false;
69
70
  constructor(sql, options = {}) {
@@ -72,7 +73,7 @@ var PostgresMessageQueue = class {
72
73
  this.#channelName = options?.channelName ?? "fedify_channel";
73
74
  this.#pollIntervalMs = Temporal.Duration.from(options?.pollInterval ?? { seconds: 5 }).total("millisecond");
74
75
  this.#handlerTimeoutMs = Temporal.Duration.from(options?.handlerTimeout ?? { seconds: 60 }).total("millisecond");
75
- this.#initialized = options?.initialized ?? false;
76
+ this.#skipDdl = options?.initialized ?? false;
76
77
  }
77
78
  async enqueue(message, options) {
78
79
  await this.initialize();
@@ -160,6 +161,7 @@ var PostgresMessageQueue = class {
160
161
  async listen(handler, options = {}) {
161
162
  await this.initialize();
162
163
  const { signal } = options;
164
+ if (signal?.aborted) return;
163
165
  const poll = async () => {
164
166
  while (!signal?.aborted) {
165
167
  let processed = false;
@@ -253,6 +255,7 @@ var PostgresMessageQueue = class {
253
255
  };
254
256
  const timeouts = /* @__PURE__ */ new Set();
255
257
  const listen = await this.#sql.listen(this.#channelName, async (delay) => {
258
+ if (signal?.aborted) return;
256
259
  try {
257
260
  const durationMs = Temporal.Duration.from(delay).total("millisecond");
258
261
  if (durationMs < 1) await safeSerializedPoll("notify-immediate");
@@ -276,31 +279,35 @@ var PostgresMessageQueue = class {
276
279
  timeouts.clear();
277
280
  };
278
281
  signal?.addEventListener("abort", clearTimeouts, { once: true });
279
- let unlistenError;
280
282
  try {
281
283
  while (!signal?.aborted) {
282
- let timeout;
283
284
  await new Promise((resolve) => {
284
- signal?.addEventListener("abort", resolve, { once: true });
285
- timeout = setTimeout(() => {
286
- signal?.removeEventListener("abort", resolve);
287
- resolve(0);
285
+ const onAbort = () => {
286
+ clearTimeout(timeout);
287
+ signal?.removeEventListener("abort", onAbort);
288
+ resolve();
289
+ };
290
+ const timeout = setTimeout(() => {
291
+ signal?.removeEventListener("abort", onAbort);
292
+ resolve();
288
293
  }, this.#pollIntervalMs);
289
- timeouts.add(timeout);
294
+ signal?.addEventListener("abort", onAbort, { once: true });
290
295
  });
291
- if (timeout != null) timeouts.delete(timeout);
292
296
  await safeSerializedPoll("interval");
293
297
  }
294
298
  } finally {
295
299
  signal?.removeEventListener("abort", clearTimeouts);
296
300
  clearTimeouts();
301
+ await pollLock;
297
302
  try {
298
303
  await listen.unlisten();
299
304
  } catch (error) {
300
- if (!isConnectionDestroyedError(error)) unlistenError = error;
305
+ if (!isConnectionDestroyedError(error)) logger.error("Error while unlistening from channel {channelName}: {error}", {
306
+ channelName: this.#channelName,
307
+ error
308
+ });
301
309
  }
302
310
  }
303
- if (unlistenError != null) throw unlistenError;
304
311
  }
305
312
  /**
306
313
  * Initializes the message queue table if it does not already exist.
@@ -311,6 +318,12 @@ var PostgresMessageQueue = class {
311
318
  }
312
319
  async #doInitialize() {
313
320
  logger.debug("Initializing the message queue table {tableName}...", { tableName: this.#tableName });
321
+ if (!this.#skipDdl) await this.#initializeTable();
322
+ this.#driverSerializesJson = await require_utils.driverSerializesJson(this.#sql);
323
+ this.#initialized = true;
324
+ logger.debug("Initialized the message queue table {tableName}.", { tableName: this.#tableName });
325
+ }
326
+ async #initializeTable() {
314
327
  for (let attempt = 1; attempt <= INITIALIZE_MAX_ATTEMPTS; attempt++) try {
315
328
  await this.#sql`
316
329
  CREATE TABLE IF NOT EXISTS ${this.#sql(this.#tableName)} (
@@ -345,9 +358,6 @@ var PostgresMessageQueue = class {
345
358
  });
346
359
  await sleep(backoffMs);
347
360
  }
348
- this.#driverSerializesJson = await require_utils.driverSerializesJson(this.#sql);
349
- this.#initialized = true;
350
- logger.debug("Initialized the message queue table {tableName}.", { tableName: this.#tableName });
351
361
  }
352
362
  /**
353
363
  * Drops the message queue table if it exists.
package/dist/mq.d.cts CHANGED
@@ -21,6 +21,10 @@ interface PostgresMessageQueueOptions {
21
21
  readonly channelName?: string;
22
22
  /**
23
23
  * Whether the table has been initialized. `false` by default.
24
+ *
25
+ * This skips only the table's schema DDL. Driver-specific runtime setup,
26
+ * such as detecting whether the driver serializes JSON parameters on its
27
+ * own, still runs before the first message is enqueued.
24
28
  * @default `false`
25
29
  */
26
30
  readonly initialized?: boolean;
package/dist/mq.d.ts CHANGED
@@ -21,6 +21,10 @@ interface PostgresMessageQueueOptions {
21
21
  readonly channelName?: string;
22
22
  /**
23
23
  * Whether the table has been initialized. `false` by default.
24
+ *
25
+ * This skips only the table's schema DDL. Driver-specific runtime setup,
26
+ * such as detecting whether the driver serializes JSON parameters on its
27
+ * own, still runs before the first message is enqueued.
24
28
  * @default `false`
25
29
  */
26
30
  readonly initialized?: boolean;
package/dist/mq.js CHANGED
@@ -58,7 +58,8 @@ var PostgresMessageQueue = class {
58
58
  #channelName;
59
59
  #pollIntervalMs;
60
60
  #handlerTimeoutMs;
61
- #initialized;
61
+ #skipDdl;
62
+ #initialized = false;
62
63
  #initPromise;
63
64
  #driverSerializesJson = false;
64
65
  constructor(sql, options = {}) {
@@ -67,7 +68,7 @@ var PostgresMessageQueue = class {
67
68
  this.#channelName = options?.channelName ?? "fedify_channel";
68
69
  this.#pollIntervalMs = Temporal.Duration.from(options?.pollInterval ?? { seconds: 5 }).total("millisecond");
69
70
  this.#handlerTimeoutMs = Temporal.Duration.from(options?.handlerTimeout ?? { seconds: 60 }).total("millisecond");
70
- this.#initialized = options?.initialized ?? false;
71
+ this.#skipDdl = options?.initialized ?? false;
71
72
  }
72
73
  async enqueue(message, options) {
73
74
  await this.initialize();
@@ -155,6 +156,7 @@ var PostgresMessageQueue = class {
155
156
  async listen(handler, options = {}) {
156
157
  await this.initialize();
157
158
  const { signal } = options;
159
+ if (signal?.aborted) return;
158
160
  const poll = async () => {
159
161
  while (!signal?.aborted) {
160
162
  let processed = false;
@@ -248,6 +250,7 @@ var PostgresMessageQueue = class {
248
250
  };
249
251
  const timeouts = /* @__PURE__ */ new Set();
250
252
  const listen = await this.#sql.listen(this.#channelName, async (delay) => {
253
+ if (signal?.aborted) return;
251
254
  try {
252
255
  const durationMs = Temporal.Duration.from(delay).total("millisecond");
253
256
  if (durationMs < 1) await safeSerializedPoll("notify-immediate");
@@ -271,31 +274,35 @@ var PostgresMessageQueue = class {
271
274
  timeouts.clear();
272
275
  };
273
276
  signal?.addEventListener("abort", clearTimeouts, { once: true });
274
- let unlistenError;
275
277
  try {
276
278
  while (!signal?.aborted) {
277
- let timeout;
278
279
  await new Promise((resolve) => {
279
- signal?.addEventListener("abort", resolve, { once: true });
280
- timeout = setTimeout(() => {
281
- signal?.removeEventListener("abort", resolve);
282
- resolve(0);
280
+ const onAbort = () => {
281
+ clearTimeout(timeout);
282
+ signal?.removeEventListener("abort", onAbort);
283
+ resolve();
284
+ };
285
+ const timeout = setTimeout(() => {
286
+ signal?.removeEventListener("abort", onAbort);
287
+ resolve();
283
288
  }, this.#pollIntervalMs);
284
- timeouts.add(timeout);
289
+ signal?.addEventListener("abort", onAbort, { once: true });
285
290
  });
286
- if (timeout != null) timeouts.delete(timeout);
287
291
  await safeSerializedPoll("interval");
288
292
  }
289
293
  } finally {
290
294
  signal?.removeEventListener("abort", clearTimeouts);
291
295
  clearTimeouts();
296
+ await pollLock;
292
297
  try {
293
298
  await listen.unlisten();
294
299
  } catch (error) {
295
- if (!isConnectionDestroyedError(error)) unlistenError = error;
300
+ if (!isConnectionDestroyedError(error)) logger.error("Error while unlistening from channel {channelName}: {error}", {
301
+ channelName: this.#channelName,
302
+ error
303
+ });
296
304
  }
297
305
  }
298
- if (unlistenError != null) throw unlistenError;
299
306
  }
300
307
  /**
301
308
  * Initializes the message queue table if it does not already exist.
@@ -306,6 +313,12 @@ var PostgresMessageQueue = class {
306
313
  }
307
314
  async #doInitialize() {
308
315
  logger.debug("Initializing the message queue table {tableName}...", { tableName: this.#tableName });
316
+ if (!this.#skipDdl) await this.#initializeTable();
317
+ this.#driverSerializesJson = await driverSerializesJson(this.#sql);
318
+ this.#initialized = true;
319
+ logger.debug("Initialized the message queue table {tableName}.", { tableName: this.#tableName });
320
+ }
321
+ async #initializeTable() {
309
322
  for (let attempt = 1; attempt <= INITIALIZE_MAX_ATTEMPTS; attempt++) try {
310
323
  await this.#sql`
311
324
  CREATE TABLE IF NOT EXISTS ${this.#sql(this.#tableName)} (
@@ -340,9 +353,6 @@ var PostgresMessageQueue = class {
340
353
  });
341
354
  await sleep(backoffMs);
342
355
  }
343
- this.#driverSerializesJson = await driverSerializesJson(this.#sql);
344
- this.#initialized = true;
345
- logger.debug("Initialized the message queue table {tableName}.", { tableName: this.#tableName });
346
356
  }
347
357
  /**
348
358
  * Drops the message queue table if it exists.
@@ -134,10 +134,10 @@ exports.PlainYearMonthBranding = PlainYearMonthBranding;
134
134
  exports.ZonedDateTimeBranding = ZonedDateTimeBranding;
135
135
  exports.attachDebugString = attachDebugString;
136
136
  exports.dateDerivedGetters = dateDerivedGetters;
137
- exports.dateFieldGetters$1 = dateFieldGetters$1;
137
+ exports.dateFieldGetters = dateFieldGetters$1;
138
138
  exports.defineTemporalClass = defineTemporalClass;
139
139
  exports.forbiddenValueOf = forbiddenValueOf;
140
140
  exports.invalidRecordType = invalidRecordType;
141
- exports.monthDayFieldGetters$1 = monthDayFieldGetters$1;
141
+ exports.monthDayFieldGetters = monthDayFieldGetters$1;
142
142
  exports.yearMonthDerivedGetters = yearMonthDerivedGetters;
143
- exports.yearMonthFieldGetters$1 = yearMonthFieldGetters$1;
143
+ exports.yearMonthFieldGetters = yearMonthFieldGetters$1;
@@ -10,8 +10,8 @@ function resolveBasicCalendarId(rawCalendarId) {
10
10
  function resolveBasicCalendarArg(rawCalendarId = require_internal.isoCalendarId) {
11
11
  return resolveBasicCalendarId(rawCalendarId);
12
12
  }
13
- const zonedDateTimeSlotsMap = /* @__PURE__ */ new WeakMap();
14
- const ZonedDateTime = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(require_apiHelpers.ZonedDateTimeBranding, class {
13
+ const zonedDateTimeSlotsMap = /*@__PURE__*/ new WeakMap();
14
+ const ZonedDateTime = /*@__PURE__*/ require_apiHelpers.defineTemporalClass(require_apiHelpers.ZonedDateTimeBranding, class {
15
15
  constructor(epochNanoseconds, timeZoneId, calendar = void 0) {
16
16
  const epochNano = require_internal.checkEpochNanoInBounds(require_internal.toBigInt(epochNanoseconds));
17
17
  const timeZone = require_internal.queryTimeZone(require_internal.refineTimeZoneId(timeZoneId));
@@ -124,7 +124,7 @@ const ZonedDateTime = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(req
124
124
  valueOf() {
125
125
  return require_apiHelpers.forbiddenValueOf();
126
126
  }
127
- }, getZonedDateTimeIsoSlots, require_apiHelpers.dateFieldGetters$1, require_apiHelpers.dateDerivedGetters, require_internal.timeGetters);
127
+ }, getZonedDateTimeIsoSlots, require_apiHelpers.dateFieldGetters, require_apiHelpers.dateDerivedGetters, require_internal.timeGetters);
128
128
  function createZonedDateTime(slots) {
129
129
  return initZonedDateTime(Object.create(ZonedDateTime.prototype), slots);
130
130
  }
@@ -159,8 +159,8 @@ function refineTimeZoneArg(arg) {
159
159
  }
160
160
  return ((arg) => require_internal.resolveTimeZoneId(require_internal.parseTimeZoneId(require_internal.requireString(arg))))(arg);
161
161
  }
162
- const instantSlotsMap = /* @__PURE__ */ new WeakMap();
163
- const Instant = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(require_apiHelpers.InstantBranding, class {
162
+ const instantSlotsMap = /*@__PURE__*/ new WeakMap();
163
+ const Instant = /*@__PURE__*/ require_apiHelpers.defineTemporalClass(require_apiHelpers.InstantBranding, class {
164
164
  constructor(epochNanoseconds) {
165
165
  const epochNano = require_internal.checkEpochNanoInBounds(require_internal.toBigInt(epochNanoseconds));
166
166
  initInstant(this, require_internal.createEpochNanoSlots(epochNano));
@@ -245,8 +245,8 @@ const { toTemporalInstant } = { toTemporalInstant() {
245
245
  function initInstant(instance, slots) {
246
246
  return instantSlotsMap.set(instance, slots), require_apiHelpers.attachDebugString(instance), instance;
247
247
  }
248
- const plainMonthDaySlotsMap = /* @__PURE__ */ new WeakMap();
249
- const PlainMonthDay = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(require_apiHelpers.PlainMonthDayBranding, class {
248
+ const plainMonthDaySlotsMap = /*@__PURE__*/ new WeakMap();
249
+ const PlainMonthDay = /*@__PURE__*/ require_apiHelpers.defineTemporalClass(require_apiHelpers.PlainMonthDayBranding, class {
250
250
  constructor(isoMonth, isoDay, calendar = void 0, referenceIsoYear) {
251
251
  const isoMonthInt = require_utils.toIntegerWithTrunc(isoMonth);
252
252
  const isoDayInt = require_utils.toIntegerWithTrunc(isoDay);
@@ -287,7 +287,7 @@ const PlainMonthDay = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(req
287
287
  valueOf() {
288
288
  return require_apiHelpers.forbiddenValueOf();
289
289
  }
290
- }, getPlainMonthDaySlots, require_apiHelpers.monthDayFieldGetters$1);
290
+ }, getPlainMonthDaySlots, require_apiHelpers.monthDayFieldGetters);
291
291
  function createPlainMonthDay(slots) {
292
292
  return initPlainMonthDay(Object.create(PlainMonthDay.prototype), slots);
293
293
  }
@@ -310,8 +310,8 @@ function toPlainMonthDaySlots(arg, options) {
310
310
  function initPlainMonthDay(instance, slots) {
311
311
  return plainMonthDaySlotsMap.set(instance, slots), require_apiHelpers.attachDebugString(instance), instance;
312
312
  }
313
- const plainYearMonthSlotsMap = /* @__PURE__ */ new WeakMap();
314
- const PlainYearMonth = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(require_apiHelpers.PlainYearMonthBranding, class {
313
+ const plainYearMonthSlotsMap = /*@__PURE__*/ new WeakMap();
314
+ const PlainYearMonth = /*@__PURE__*/ require_apiHelpers.defineTemporalClass(require_apiHelpers.PlainYearMonthBranding, class {
315
315
  constructor(isoYear, isoMonth, calendar = void 0, referenceIsoDay) {
316
316
  const isoYearInt = require_utils.toIntegerWithTrunc(isoYear);
317
317
  const isoMonthInt = require_utils.toIntegerWithTrunc(isoMonth);
@@ -373,7 +373,7 @@ const PlainYearMonth = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(re
373
373
  valueOf() {
374
374
  return require_apiHelpers.forbiddenValueOf();
375
375
  }
376
- }, getPlainYearMonthSlots, require_apiHelpers.yearMonthFieldGetters$1, require_apiHelpers.yearMonthDerivedGetters);
376
+ }, getPlainYearMonthSlots, require_apiHelpers.yearMonthFieldGetters, require_apiHelpers.yearMonthDerivedGetters);
377
377
  function createPlainYearMonth(slots) {
378
378
  return initPlainYearMonth(Object.create(PlainYearMonth.prototype), slots);
379
379
  }
@@ -403,8 +403,8 @@ function getTemporalBrandingAndSlots(obj) {
403
403
  function validateBag(bag) {
404
404
  return (getTemporalBrandingAndSlots(bag) || void 0 !== bag.calendar || void 0 !== bag.timeZone) && require_internal.throwTypeError("Invalid bag"), bag;
405
405
  }
406
- const plainTimeSlotsMap = /* @__PURE__ */ new WeakMap();
407
- const PlainTime = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(require_apiHelpers.PlainTimeBranding, class {
406
+ const plainTimeSlotsMap = /*@__PURE__*/ new WeakMap();
407
+ const PlainTime = /*@__PURE__*/ require_apiHelpers.defineTemporalClass(require_apiHelpers.PlainTimeBranding, class {
408
408
  constructor(hour = 0, minute = 0, second = 0, millisecond = 0, microsecond = 0, nanosecond = 0) {
409
409
  const fields = require_internal.validateTimeFields(require_internal.mapProps(require_utils.toIntegerWithTrunc, {
410
410
  hour,
@@ -486,8 +486,8 @@ function optionalToPlainTimeFields(timeArg) {
486
486
  function initPlainTime(instance, slots) {
487
487
  return plainTimeSlotsMap.set(instance, slots), require_apiHelpers.attachDebugString(instance), instance;
488
488
  }
489
- const plainDateTimeSlotsMap = /* @__PURE__ */ new WeakMap();
490
- const PlainDateTime = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(require_apiHelpers.PlainDateTimeBranding, class {
489
+ const plainDateTimeSlotsMap = /*@__PURE__*/ new WeakMap();
490
+ const PlainDateTime = /*@__PURE__*/ require_apiHelpers.defineTemporalClass(require_apiHelpers.PlainDateTimeBranding, class {
491
491
  constructor(isoYear, isoMonth, isoDay, hour = 0, minute = 0, second = 0, millisecond = 0, microsecond = 0, nanosecond = 0, calendar = void 0) {
492
492
  const fields = require_internal.checkIsoDateTimeInBounds(require_internal.validateIsoDateTimeFields(require_internal.mapProps(require_utils.toIntegerWithTrunc, {
493
493
  year: isoYear,
@@ -572,7 +572,7 @@ const PlainDateTime = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(req
572
572
  valueOf() {
573
573
  return require_apiHelpers.forbiddenValueOf();
574
574
  }
575
- }, getPlainDateTimeSlots, require_apiHelpers.dateFieldGetters$1, require_apiHelpers.dateDerivedGetters, require_internal.timeGetters);
575
+ }, getPlainDateTimeSlots, require_apiHelpers.dateFieldGetters, require_apiHelpers.dateDerivedGetters, require_internal.timeGetters);
576
576
  function createPlainDateTime(slots) {
577
577
  return initPlainDateTime(Object.create(PlainDateTime.prototype), slots);
578
578
  }
@@ -598,8 +598,8 @@ function toPlainDateTimeSlots(arg, options) {
598
598
  function initPlainDateTime(instance, slots) {
599
599
  return plainDateTimeSlotsMap.set(instance, slots), require_apiHelpers.attachDebugString(instance), instance;
600
600
  }
601
- const plainDateSlotsMap = /* @__PURE__ */ new WeakMap();
602
- const PlainDate = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(require_apiHelpers.PlainDateBranding, class {
601
+ const plainDateSlotsMap = /*@__PURE__*/ new WeakMap();
602
+ const PlainDate = /*@__PURE__*/ require_apiHelpers.defineTemporalClass(require_apiHelpers.PlainDateBranding, class {
603
603
  constructor(isoYear, isoMonth, isoDay, calendar = void 0) {
604
604
  const fields = require_internal.checkIsoDateInBounds(require_internal.validateIsoDateFields(require_internal.mapProps(require_utils.toIntegerWithTrunc, {
605
605
  year: isoYear,
@@ -676,7 +676,7 @@ const PlainDate = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(require
676
676
  valueOf() {
677
677
  return require_apiHelpers.forbiddenValueOf();
678
678
  }
679
- }, getPlainDateSlots, require_apiHelpers.dateFieldGetters$1, require_apiHelpers.dateDerivedGetters);
679
+ }, getPlainDateSlots, require_apiHelpers.dateFieldGetters, require_apiHelpers.dateDerivedGetters);
680
680
  function createPlainDate(slots) {
681
681
  return initPlainDate(Object.create(PlainDate.prototype), slots);
682
682
  }
@@ -717,8 +717,8 @@ function refineCalendarArg(arg) {
717
717
  }
718
718
  return ((arg) => resolveBasicCalendarId(require_internal.parseCalendarId(require_internal.requireString(arg))))(arg);
719
719
  }
720
- const durationSlotsMap = /* @__PURE__ */ new WeakMap();
721
- const Duration = /* @__PURE__ */ require_apiHelpers.defineTemporalClass(require_apiHelpers.DurationBranding, class {
720
+ const durationSlotsMap = /*@__PURE__*/ new WeakMap();
721
+ const Duration = /*@__PURE__*/ require_apiHelpers.defineTemporalClass(require_apiHelpers.DurationBranding, class {
722
722
  constructor(years = 0, months = 0, weeks = 0, days = 0, hours = 0, minutes = 0, seconds = 0, milliseconds = 0, microseconds = 0, nanoseconds = 0) {
723
723
  const fields = require_internal.validateDurationFields(require_internal.mapProps(require_internal.toStrictInteger, {
724
724
  years,
@@ -811,7 +811,7 @@ function refinePublicRelativeTo(relativeTo) {
811
811
  function initDuration(instance, slots) {
812
812
  return durationSlotsMap.set(instance, slots), require_apiHelpers.attachDebugString(instance), instance;
813
813
  }
814
- const Now = /* @__PURE__ */ Object.defineProperties({}, {
814
+ const Now = /*@__PURE__*/ Object.defineProperties({}, {
815
815
  ...require_internal.createStringTagDescriptors("Temporal.Now"),
816
816
  ...require_internal.createPropDescriptors({
817
817
  timeZoneId() {
@@ -835,7 +835,7 @@ const Now = /* @__PURE__ */ Object.defineProperties({}, {
835
835
  }
836
836
  })
837
837
  });
838
- const Temporal = /* @__PURE__ */ Object.defineProperties({}, {
838
+ const Temporal = /*@__PURE__*/ Object.defineProperties({}, {
839
839
  ...require_internal.createStringTagDescriptors("Temporal"),
840
840
  ...require_internal.createPropDescriptors({
841
841
  PlainYearMonth,
@@ -14,6 +14,7 @@ const invalidLeapMonth = "Invalid leap month";
14
14
  const invalidCalendar = (calendarId) => require_errorMessages.invalidEntity("Calendar", calendarId);
15
15
  const exoticCalendarRequired = (calendarId, remedy) => `Unknown calendar ${calendarId}; might need ${remedy}`;
16
16
  const invalidTimeZone = (calendarId) => require_errorMessages.invalidEntity("TimeZone", calendarId);
17
+ const outOfBoundsDate = "Out-of-bounds date";
17
18
  const failedParse = (s) => `Cannot parse: ${s}`;
18
19
  const invalidSubstring = (substring) => `Invalid substring: ${substring}`;
19
20
  const constrainToRange = require_utils.constrainToRange;
@@ -105,7 +106,7 @@ function parseInt0(s) {
105
106
  function padNumber(digits, num) {
106
107
  return String(num).padStart(digits, "0");
107
108
  }
108
- const padNumber2 = /* @__PURE__ */ bindArgs(padNumber, 2);
109
+ const padNumber2 = /*@__PURE__*/ bindArgs(padNumber, 2);
109
110
  function compareNumbers(a, b) {
110
111
  return Math.sign(a - b);
111
112
  }
@@ -174,7 +175,7 @@ const unitNameMap = {
174
175
  month: 8,
175
176
  year: 9
176
177
  };
177
- const unitNamesAsc = /* @__PURE__ */ Object.keys(unitNameMap);
178
+ const unitNamesAsc = /*@__PURE__*/ Object.keys(unitNameMap);
178
179
  const nanoInMicro = require_utils.nanoInMicro;
179
180
  const nanoInMilli = require_utils.nanoInMilli;
180
181
  const nanoInSec = require_utils.nanoInSec;
@@ -190,19 +191,19 @@ const unitNanoMap = [
190
191
  nanoInHour,
191
192
  nanoInUtcDay
192
193
  ];
193
- const bigNanoInMicro = /* @__PURE__ */ BigInt(nanoInMicro);
194
- const bigNanoInMilli = /* @__PURE__ */ BigInt(nanoInMilli);
195
- const bigNanoInSec = /* @__PURE__ */ BigInt(nanoInSec);
196
- const bigNanoInMinute = /* @__PURE__ */ BigInt(nanoInMinute);
197
- const bigNanoInHour = /* @__PURE__ */ BigInt(nanoInHour);
198
- const bigNanoInUtcDay = /* @__PURE__ */ BigInt(nanoInUtcDay);
194
+ const bigNanoInMicro = /*@__PURE__*/ BigInt(nanoInMicro);
195
+ const bigNanoInMilli = /*@__PURE__*/ BigInt(nanoInMilli);
196
+ const bigNanoInSec = /*@__PURE__*/ BigInt(nanoInSec);
197
+ const bigNanoInMinute = /*@__PURE__*/ BigInt(nanoInMinute);
198
+ const bigNanoInHour = /*@__PURE__*/ BigInt(nanoInHour);
199
+ const bigNanoInUtcDay = /*@__PURE__*/ BigInt(nanoInUtcDay);
199
200
  function divideBigNanoToExactNumber(bigNano, divisorNano) {
200
201
  const days = Number(bigNano / bigNanoInUtcDay);
201
202
  const timeNano = Number(bigNano % bigNanoInUtcDay);
202
203
  return days * (nanoInUtcDay / divisorNano) + (Math.trunc(timeNano / divisorNano) + timeNano % divisorNano / divisorNano);
203
204
  }
204
- const timeFieldNamesAsc = /* @__PURE__ */ unitNamesAsc.slice(0, 6);
205
- const timeGetters = /* @__PURE__ */ createPropGetters(timeFieldNamesAsc);
205
+ const timeFieldNamesAsc = /*@__PURE__*/ unitNamesAsc.slice(0, 6);
206
+ const timeGetters = /*@__PURE__*/ createPropGetters(timeFieldNamesAsc);
206
207
  const yearFieldNamesAsc = ["year"];
207
208
  const dayFieldNamesAsc = ["day"];
208
209
  const calendarDateFieldNamesAsc = [
@@ -224,24 +225,24 @@ const monthDayFieldNames = [
224
225
  "month",
225
226
  "monthCode"
226
227
  ];
227
- const timeFieldNamesAlpha = /* @__PURE__ */ sortStrings(timeFieldNamesAsc);
228
- const yearFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(eraYearFieldNames, yearFieldNamesAsc);
229
- const yearMonthFieldNamesAlpha = /* @__PURE__ */ sortStrings(monthFieldNames, yearFieldNamesAsc);
230
- const yearMonthFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(eraYearFieldNames, yearMonthFieldNamesAlpha);
231
- const yearMonthCodeFieldNamesAlpha = /* @__PURE__ */ sortStrings(["monthCode"], yearFieldNamesAsc);
232
- const yearMonthCodeFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(eraYearFieldNames, yearMonthCodeFieldNamesAlpha);
233
- const monthCodeDayFieldNamesAlpha = /* @__PURE__ */ sortStrings(dayFieldNamesAsc, ["monthCode"]);
234
- const dateFieldNamesAlpha = /* @__PURE__ */ sortStrings(dayFieldNamesAsc, yearMonthFieldNamesAlpha);
235
- const dateFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(dayFieldNamesAsc, eraYearFieldNames, yearMonthFieldNamesAlpha);
236
- const dateTimeFieldNamesAlpha = /* @__PURE__ */ sortStrings(dateFieldNamesAlpha, timeFieldNamesAsc);
237
- const dateTimeFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(dateFieldNamesWithEraAlpha, timeFieldNamesAsc);
238
- const dateTimeAndOffsetFieldNamesAlpha = /* @__PURE__ */ sortStrings(dateFieldNamesAlpha, timeFieldNamesAsc, offsetFieldNames);
239
- const dateTimeAndOffsetFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(dateFieldNamesWithEraAlpha, timeFieldNamesAsc, offsetFieldNames);
240
- const dateTimeAndZoneFieldNamesAlpha = /* @__PURE__ */ sortStrings(dateFieldNamesAlpha, timeFieldNamesAsc, offsetFieldNames, timeZoneFieldNames);
241
- const dateTimeAndZoneFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(dateFieldNamesWithEraAlpha, timeFieldNamesAsc, offsetFieldNames, timeZoneFieldNames);
242
- const yearMonthCodeDayFieldNamesAlpha = /* @__PURE__ */ sortStrings(dayFieldNamesAsc, yearMonthCodeFieldNamesAlpha);
243
- const yearMonthCodeDayFieldNamesWithEraAlpha = /* @__PURE__ */ sortStrings(dayFieldNamesAsc, eraYearFieldNames, yearMonthCodeFieldNamesAlpha);
244
- const timeFieldDefaults = /* @__PURE__ */ zipPropsConst(timeFieldNamesAsc, 0);
228
+ const timeFieldNamesAlpha = /*@__PURE__*/ sortStrings(timeFieldNamesAsc);
229
+ const yearFieldNamesWithEraAlpha = /*@__PURE__*/ sortStrings(eraYearFieldNames, yearFieldNamesAsc);
230
+ const yearMonthFieldNamesAlpha = /*@__PURE__*/ sortStrings(monthFieldNames, yearFieldNamesAsc);
231
+ const yearMonthFieldNamesWithEraAlpha = /*@__PURE__*/ sortStrings(eraYearFieldNames, yearMonthFieldNamesAlpha);
232
+ const yearMonthCodeFieldNamesAlpha = /*@__PURE__*/ sortStrings(["monthCode"], yearFieldNamesAsc);
233
+ const yearMonthCodeFieldNamesWithEraAlpha = /*@__PURE__*/ sortStrings(eraYearFieldNames, yearMonthCodeFieldNamesAlpha);
234
+ const monthCodeDayFieldNamesAlpha = /*@__PURE__*/ sortStrings(dayFieldNamesAsc, ["monthCode"]);
235
+ const dateFieldNamesAlpha = /*@__PURE__*/ sortStrings(dayFieldNamesAsc, yearMonthFieldNamesAlpha);
236
+ const dateFieldNamesWithEraAlpha = /*@__PURE__*/ sortStrings(dayFieldNamesAsc, eraYearFieldNames, yearMonthFieldNamesAlpha);
237
+ const dateTimeFieldNamesAlpha = /*@__PURE__*/ sortStrings(dateFieldNamesAlpha, timeFieldNamesAsc);
238
+ const dateTimeFieldNamesWithEraAlpha = /*@__PURE__*/ sortStrings(dateFieldNamesWithEraAlpha, timeFieldNamesAsc);
239
+ const dateTimeAndOffsetFieldNamesAlpha = /*@__PURE__*/ sortStrings(dateFieldNamesAlpha, timeFieldNamesAsc, offsetFieldNames);
240
+ const dateTimeAndOffsetFieldNamesWithEraAlpha = /*@__PURE__*/ sortStrings(dateFieldNamesWithEraAlpha, timeFieldNamesAsc, offsetFieldNames);
241
+ const dateTimeAndZoneFieldNamesAlpha = /*@__PURE__*/ sortStrings(dateFieldNamesAlpha, timeFieldNamesAsc, offsetFieldNames, timeZoneFieldNames);
242
+ const dateTimeAndZoneFieldNamesWithEraAlpha = /*@__PURE__*/ sortStrings(dateFieldNamesWithEraAlpha, timeFieldNamesAsc, offsetFieldNames, timeZoneFieldNames);
243
+ const yearMonthCodeDayFieldNamesAlpha = /*@__PURE__*/ sortStrings(dayFieldNamesAsc, yearMonthCodeFieldNamesAlpha);
244
+ const yearMonthCodeDayFieldNamesWithEraAlpha = /*@__PURE__*/ sortStrings(dayFieldNamesAsc, eraYearFieldNames, yearMonthCodeFieldNamesAlpha);
245
+ const timeFieldDefaults = /*@__PURE__*/ zipPropsConst(timeFieldNamesAsc, 0);
245
246
  function validateTimeFields(timeFields) {
246
247
  return constrainTimeFields(timeFields, 1), timeFields;
247
248
  }
@@ -471,20 +472,20 @@ function computeCalendarWeekOfYear(calendar, isoDate) {
471
472
  function computeCalendarYearOfWeek(calendar, isoDate) {
472
473
  return calendar === void 0 ? computeIsoWeekFields(isoDate).yearOfWeek : void 0;
473
474
  }
474
- const durationFieldNamesAsc = /* @__PURE__ */ unitNamesAsc.map((unitName) => unitName + "s");
475
- const durationGetters = /* @__PURE__ */ createPropGetters(durationFieldNamesAsc);
476
- const durationFieldNamesAlpha = /* @__PURE__ */ sortStrings(durationFieldNamesAsc);
477
- const durationTimeFieldNamesAsc = /* @__PURE__ */ durationFieldNamesAsc.slice(0, 6);
478
- const durationDateFieldNamesAsc = /* @__PURE__ */ durationFieldNamesAsc.slice(6);
479
- const durationCalendarFieldNamesAsc = /* @__PURE__ */ durationDateFieldNamesAsc.slice(1);
480
- const durationFieldIndexes = /* @__PURE__ */ durationFieldNamesAsc.reduce((indexes, fieldName, i) => (indexes[fieldName] = i, indexes), {});
481
- const durationFieldDefaults = /* @__PURE__ */ zipPropsConst(durationFieldNamesAsc, 0);
482
- const durationTimeFieldDefaults = /* @__PURE__ */ zipPropsConst(durationTimeFieldNamesAsc, 0);
483
- const clearDurationFields = /* @__PURE__ */ bindArgs(zeroOutProps, durationFieldNamesAsc);
475
+ const durationFieldNamesAsc = /*@__PURE__*/ unitNamesAsc.map((unitName) => unitName + "s");
476
+ const durationGetters = /*@__PURE__*/ createPropGetters(durationFieldNamesAsc);
477
+ const durationFieldNamesAlpha = /*@__PURE__*/ sortStrings(durationFieldNamesAsc);
478
+ const durationTimeFieldNamesAsc = /*@__PURE__*/ durationFieldNamesAsc.slice(0, 6);
479
+ const durationDateFieldNamesAsc = /*@__PURE__*/ durationFieldNamesAsc.slice(6);
480
+ const durationCalendarFieldNamesAsc = /*@__PURE__*/ durationDateFieldNamesAsc.slice(1);
481
+ const durationFieldIndexes = /*@__PURE__*/ durationFieldNamesAsc.reduce((indexes, fieldName, i) => (indexes[fieldName] = i, indexes), {});
482
+ const durationFieldDefaults = /*@__PURE__*/ zipPropsConst(durationFieldNamesAsc, 0);
483
+ const durationTimeFieldDefaults = /*@__PURE__*/ zipPropsConst(durationTimeFieldNamesAsc, 0);
484
+ const clearDurationFields = /*@__PURE__*/ bindArgs(zeroOutProps, durationFieldNamesAsc);
484
485
  function requirePropDefined(optionName, optionVal) {
485
486
  return optionVal ?? throwRangeError(missingField(optionName)), optionVal;
486
487
  }
487
- const requireString = /* @__PURE__ */ bindArgs(requireType, "string");
488
+ const requireString = /*@__PURE__*/ bindArgs(requireType, "string");
488
489
  function requireType(typeName, arg, entityName = typeName) {
489
490
  return typeof arg !== typeName && throwTypeError(invalidEntity(entityName, arg)), arg;
490
491
  }
@@ -596,17 +597,17 @@ function coerceChoiceOption(optionName, enumNameMap, options, defaultChoice = 0)
596
597
  const enumNum = enumNameMap[enumStr];
597
598
  return void 0 === enumNum && throwRangeError(invalidChoice(optionName, enumStr, enumNameMap)), enumNum;
598
599
  }
599
- const coerceSmallestUnit = /* @__PURE__ */ bindArgs(coerceUnitOption, smallestUnitStr);
600
- const coerceLargestUnit = /* @__PURE__ */ bindArgs(coerceUnitOption, "largestUnit");
601
- const coerceTotalUnit = /* @__PURE__ */ bindArgs(coerceUnitOption, "unit");
602
- const coerceOverflow = /* @__PURE__ */ bindArgs(coerceChoiceOption, "overflow", overflowMap);
603
- const coerceEpochDisambig = /* @__PURE__ */ bindArgs(coerceChoiceOption, "disambiguation", epochDisambigMap);
604
- const coerceOffsetDisambig = /* @__PURE__ */ bindArgs(coerceChoiceOption, "offset", offsetDisambigMap);
605
- const coerceCalendarDisplay = /* @__PURE__ */ bindArgs(coerceChoiceOption, "calendarName", calendarDisplayMap);
606
- const coerceTimeZoneDisplay = /* @__PURE__ */ bindArgs(coerceChoiceOption, "timeZoneName", timeZoneDisplayMap);
607
- const coerceOffsetDisplay = /* @__PURE__ */ bindArgs(coerceChoiceOption, "offset", offsetDisplayMap);
608
- const coerceRoundingMode = /* @__PURE__ */ bindArgs(coerceChoiceOption, "roundingMode", roundingModeMap);
609
- const coerceDirection = /* @__PURE__ */ bindArgs(coerceChoiceOption, "direction", directionMap);
600
+ const coerceSmallestUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, smallestUnitStr);
601
+ const coerceLargestUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, "largestUnit");
602
+ const coerceTotalUnit = /*@__PURE__*/ bindArgs(coerceUnitOption, "unit");
603
+ const coerceOverflow = /*@__PURE__*/ bindArgs(coerceChoiceOption, "overflow", overflowMap);
604
+ const coerceEpochDisambig = /*@__PURE__*/ bindArgs(coerceChoiceOption, "disambiguation", epochDisambigMap);
605
+ const coerceOffsetDisambig = /*@__PURE__*/ bindArgs(coerceChoiceOption, "offset", offsetDisambigMap);
606
+ const coerceCalendarDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "calendarName", calendarDisplayMap);
607
+ const coerceTimeZoneDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "timeZoneName", timeZoneDisplayMap);
608
+ const coerceOffsetDisplay = /*@__PURE__*/ bindArgs(coerceChoiceOption, "offset", offsetDisplayMap);
609
+ const coerceRoundingMode = /*@__PURE__*/ bindArgs(coerceChoiceOption, "roundingMode", roundingModeMap);
610
+ const coerceDirection = /*@__PURE__*/ bindArgs(coerceChoiceOption, "direction", directionMap);
610
611
  function validateRoundingInc(roundingInc, smallestUnit, allowManyLargeUnits, solarMode) {
611
612
  const upUnitNano = solarMode ? nanoInUtcDay : unitNanoMap[smallestUnit + 1];
612
613
  if (upUnitNano) {
@@ -660,8 +661,8 @@ function refineZonedFieldOptions(options, defaultOffsetDisambig = 0) {
660
661
  epochDisambig
661
662
  ];
662
663
  }
663
- const epochNanoMax = /* @__PURE__ */ BigInt(1e8) * bigNanoInUtcDay;
664
- const epochNanoMin = /* @__PURE__ */ BigInt(-1e8) * bigNanoInUtcDay;
664
+ const epochNanoMax = /*@__PURE__*/ BigInt(1e8) * bigNanoInUtcDay;
665
+ const epochNanoMin = /*@__PURE__*/ BigInt(-1e8) * bigNanoInUtcDay;
665
666
  const plainDateEpochNanoMin = epochNanoMin - bigNanoInUtcDay;
666
667
  const isoYearMonthIndexMin = -3261848;
667
668
  function checkIsoYearMonthInBounds(isoDate) {
@@ -932,11 +933,12 @@ function nudgeRelativeDuration(sign, durationFields, endEpochNano, _largestUnit,
932
933
  }
933
934
  function getTimeZoneTransitionEpochNanoseconds(slots, options) {
934
935
  return slots.timeZone.U(slots.epochNanoseconds, ((options) => {
935
- const res = coerceDirection(normalizeOptionsOrString(options, "direction"), 0);
936
+ const normalizedOptions = normalizeOptionsOrString(options, "direction");
937
+ const res = coerceDirection(normalizedOptions, 0);
936
938
  return res || throwRangeError(invalidEntity("direction", res)), res;
937
939
  })(options));
938
940
  }
939
- const zonedEpochSlotsToIso = /* @__PURE__ */ memoize(_zonedEpochSlotsToIso, WeakMap);
941
+ const zonedEpochSlotsToIso = /*@__PURE__*/ memoize(_zonedEpochSlotsToIso, WeakMap);
940
942
  function _zonedEpochSlotsToIso(slots) {
941
943
  const { epochNanoseconds, timeZone } = slots;
942
944
  const offsetNanoseconds = timeZone.C(epochNanoseconds);
@@ -1502,7 +1504,7 @@ function resolveTimeFields(fields, overflow) {
1502
1504
  ...fields
1503
1505
  }), overflow);
1504
1506
  }
1505
- const offsetRegExp = /* @__PURE__ */ createRegExp("([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?");
1507
+ const offsetRegExp = /*@__PURE__*/ createRegExp("([+-])(\\d{2})(?::?(\\d{2})(?::?(\\d{2})(?:[.,](\\d{1,9}))?)?)?");
1506
1508
  function parseOffsetNano(s) {
1507
1509
  const offsetNano = parseOffsetNanoMaybe(s);
1508
1510
  return void 0 === offsetNano && throwRangeError(failedParse(s)), offsetNano;
@@ -1537,13 +1539,13 @@ const dateFieldRefiners = {
1537
1539
  },
1538
1540
  day: require_utils.toPositiveIntegerWithTruncation
1539
1541
  };
1540
- const timeFieldRefiners = /* @__PURE__ */ zipPropsConst(timeFieldNamesAsc, require_utils.toIntegerWithTrunc);
1541
- const durationFieldRefiners = /* @__PURE__ */ zipPropsConst(durationFieldNamesAsc, toStrictInteger);
1542
+ const timeFieldRefiners = /*@__PURE__*/ zipPropsConst(timeFieldNamesAsc, require_utils.toIntegerWithTrunc);
1543
+ const durationFieldRefiners = /*@__PURE__*/ zipPropsConst(durationFieldNamesAsc, toStrictInteger);
1542
1544
  const offsetFieldRefiners = { offset(offsetString) {
1543
1545
  return parseOffsetNano(toStringViaPrimitive(offsetString));
1544
1546
  } };
1545
- const dateTimeFieldRefiners = /* @__PURE__ */ Object.assign({}, dateFieldRefiners, timeFieldRefiners);
1546
- const zonedDateTimeFieldRefiners = /* @__PURE__ */ Object.assign({}, dateTimeFieldRefiners, offsetFieldRefiners);
1547
+ const dateTimeFieldRefiners = /*@__PURE__*/ Object.assign({}, dateFieldRefiners, timeFieldRefiners);
1548
+ const zonedDateTimeFieldRefiners = /*@__PURE__*/ Object.assign({}, dateTimeFieldRefiners, offsetFieldRefiners);
1547
1549
  function readAndRefineBagFields(bag, validFieldNames, fieldRefiners, requiredFieldNames, disallowEmpty = !requiredFieldNames) {
1548
1550
  const res = {};
1549
1551
  let anyMatching = 0;
@@ -1646,7 +1648,9 @@ const timeZonePeriodDaysByName = {
1646
1648
  const minPossibleTransitionSec = -388152e4;
1647
1649
  function refineTimeDisplayTuple(options, maxSmallestUnit = 4) {
1648
1650
  const subsecDigits = coerceFractionalSecondDigits(options);
1649
- return [coerceRoundingMode(options, 4), ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, coerceSmallestUnit(options), 0, maxSmallestUnit), subsecDigits)];
1651
+ const roundingMode = coerceRoundingMode(options, 4);
1652
+ const smallestUnit = coerceSmallestUnit(options);
1653
+ return [roundingMode, ...resolveSmallestUnitAndSubsecDigits(validateUnitRange(smallestUnitStr, smallestUnit, 0, maxSmallestUnit), subsecDigits)];
1650
1654
  }
1651
1655
  function refineDateDisplayOptions(options) {
1652
1656
  return coerceCalendarDisplay(require_utils.normalizeOptions(options));
@@ -1821,15 +1825,17 @@ function resolveTimeZoneRecord(rawId) {
1821
1825
  kind: "fixed",
1822
1826
  ...offsetRecord
1823
1827
  };
1824
- return queryNamedTimeZoneRecord("UTC" === upperRawId ? "UTC" : ((rawId) => (badCharactersRegExp.test(rawId) && throwRangeError(invalidTimeZone(rawId)), icuRegExp.test(rawId) && throwRangeError("Forbidden ICU TimeZone"), rawId.toLowerCase().split("/").map((part, partI) => (part.length <= 3 || /\d/.test(part)) && !/etc|yap/.test(part) ? part.toUpperCase() : part.replace(/baja|dumont|[a-z]+/g, (a, i) => a.length <= 2 && !partI || "in" === a || "chat" === a ? a.toUpperCase() : a.length > 2 || !i ? capitalize(a).replace(/island|noronha|murdo|rivadavia|urville/, capitalize) : a)).join("/")))(rawId));
1828
+ const normId = "UTC" === upperRawId ? "UTC" : ((rawId) => (badCharactersRegExp.test(rawId) && throwRangeError(invalidTimeZone(rawId)), icuRegExp.test(rawId) && throwRangeError("Forbidden ICU TimeZone"), rawId.toLowerCase().split("/").map((part, partI) => (part.length <= 3 || /\d/.test(part)) && !/etc|yap/.test(part) ? part.toUpperCase() : part.replace(/baja|dumont|[a-z]+/g, (a, i) => a.length <= 2 && !partI || "in" === a || "chat" === a ? a.toUpperCase() : a.length > 2 || !i ? capitalize(a).replace(/island|noronha|murdo|rivadavia|urville/, capitalize) : a)).join("/")))(rawId);
1829
+ return queryNamedTimeZoneRecord(normId);
1825
1830
  }
1826
- const queryNamedTimeZoneRecord = /* @__PURE__ */ memoize((normId) => {
1831
+ const queryNamedTimeZoneRecord = /*@__PURE__*/ memoize((normId) => {
1827
1832
  if ("UTC" === normId) return {
1828
1833
  kind: "utc",
1829
1834
  id: normId,
1830
1835
  o: normId
1831
1836
  };
1832
- const format = queryTimeZoneIntlFormat(normId.toUpperCase());
1837
+ const upperNormId = normId.toUpperCase();
1838
+ const format = queryTimeZoneIntlFormat(upperNormId);
1833
1839
  return {
1834
1840
  kind: "named",
1835
1841
  id: normId,
@@ -1837,7 +1843,7 @@ const queryNamedTimeZoneRecord = /* @__PURE__ */ memoize((normId) => {
1837
1843
  o: format.resolvedOptions().timeZone
1838
1844
  };
1839
1845
  });
1840
- const queryTimeZoneIntlFormat = /* @__PURE__ */ memoize((upperNormId) => new RawDateTimeFormat("en-u-hc-h23", {
1846
+ const queryTimeZoneIntlFormat = /*@__PURE__*/ memoize((upperNormId) => new RawDateTimeFormat("en-u-hc-h23", {
1841
1847
  calendar: "iso8601",
1842
1848
  timeZone: upperNormId,
1843
1849
  era: "short",
@@ -1852,7 +1858,7 @@ function queryTimeZone(rawTimeZoneId) {
1852
1858
  const record = resolveTimeZoneRecord(rawTimeZoneId);
1853
1859
  return queryTimeZoneRecord(record.id, record);
1854
1860
  }
1855
- const queryTimeZoneRecord = /* @__PURE__ */ memoize((normTimeZoneId, record) => "named" === record.kind ? new IntlTimeZone(normTimeZoneId, record.o, record.format) : new FixedTimeZone(normTimeZoneId, record.o, "fixed" === record.kind ? record._ : 0));
1861
+ const queryTimeZoneRecord = /*@__PURE__*/ memoize((normTimeZoneId, record) => "named" === record.kind ? new IntlTimeZone(normTimeZoneId, record.o, record.format) : new FixedTimeZone(normTimeZoneId, record.o, "fixed" === record.kind ? record._ : 0));
1856
1862
  var FixedTimeZone = class {
1857
1863
  constructor(id, compareKey, offsetNano) {
1858
1864
  this.id = id, this.o = compareKey, this._ = offsetNano;
@@ -1934,7 +1940,8 @@ var IntlTimeZone = class {
1934
1940
  return void 0 !== intlParts.era && "bce" === normalizeEraName(intlParts.era) ? 1 - year : year;
1935
1941
  })(intlParts), parseInt(intlParts.month), parseInt(intlParts.day)) + 3600 * parseInt(intlParts.hour) + 60 * parseInt(intlParts.minute) + parseInt(intlParts.second) - epochSec;
1936
1942
  })(format), ((timeZoneId) => {
1937
- return timeZonePeriodDaysByName[timeZoneId.split("/").pop()] || 60;
1943
+ const timeZoneName = timeZoneId.split("/").pop();
1944
+ return timeZonePeriodDaysByName[timeZoneName] || 60;
1938
1945
  })(id));
1939
1946
  }
1940
1947
  C(epochNano) {
@@ -2158,12 +2165,12 @@ function offsetRegExpStr(separatorIndex) {
2158
2165
  return "([+-])" + timeRegExpStr(separatorIndex);
2159
2166
  }
2160
2167
  const dateTimeRegExpStr = "(?:(?:([+-])(\\d{6}))|(\\d{4}))(-?)(\\d{2})\\4(\\d{2})(?:[T ]" + timeRegExpStr(8) + "(Z|" + offsetRegExpStr(15) + ")?)?";
2161
- const yearMonthRegExp = /* @__PURE__ */ createRegExp("(?:(?:([+-])(\\d{6}))|(\\d{4}))-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})");
2162
- const monthDayRegExp = /* @__PURE__ */ createRegExp("(?:--)?(\\d{2})-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})");
2163
- const dateTimeRegExp = /* @__PURE__ */ createRegExp(dateTimeRegExpStr + "((?:\\[(!?)([^\\]]*)\\]){0,9})");
2164
- const timeRegExp = /* @__PURE__ */ createRegExp("T?" + timeRegExpStr(2) + `(${offsetRegExpStr(9)})?((?:\\[(!?)([^\\]]*)\\]){0,9})`);
2165
- const annotationRegExp = /* @__PURE__ */ new RegExp("\\[(!?)([^\\]]*)\\]", "g");
2166
- const durationRegExp = /* @__PURE__ */ createRegExp("([+-])?P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(?:T(?:(\\d+)(?:[.,](\\d{1,9}))?H)?(?:(\\d+)(?:[.,](\\d{1,9}))?M)?(?:(\\d+)(?:[.,](\\d{1,9}))?S)?)?");
2168
+ const yearMonthRegExp = /*@__PURE__*/ createRegExp("(?:(?:([+-])(\\d{6}))|(\\d{4}))-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})");
2169
+ const monthDayRegExp = /*@__PURE__*/ createRegExp("(?:--)?(\\d{2})-?(\\d{2})((?:\\[(!?)([^\\]]*)\\]){0,9})");
2170
+ const dateTimeRegExp = /*@__PURE__*/ createRegExp(dateTimeRegExpStr + "((?:\\[(!?)([^\\]]*)\\]){0,9})");
2171
+ const timeRegExp = /*@__PURE__*/ createRegExp("T?" + timeRegExpStr(2) + `(${offsetRegExpStr(9)})?((?:\\[(!?)([^\\]]*)\\]){0,9})`);
2172
+ const annotationRegExp = /*@__PURE__*/ new RegExp("\\[(!?)([^\\]]*)\\]", "g");
2173
+ const durationRegExp = /*@__PURE__*/ createRegExp("([+-])?P(\\d+Y)?(\\d+M)?(\\d+W)?(\\d+D)?(?:T(?:(\\d+)(?:[.,](\\d{1,9}))?H)?(?:(\\d+)(?:[.,](\\d{1,9}))?M)?(?:(\\d+)(?:[.,](\\d{1,9}))?S)?)?");
2167
2174
  function parseDateTimeLike(s) {
2168
2175
  const parts = dateTimeRegExp.exec(s);
2169
2176
  return parts ? ((parts) => {
@@ -2441,8 +2448,8 @@ const timeDefaultShapeFields = {
2441
2448
  minute: "numeric",
2442
2449
  second: "numeric"
2443
2450
  };
2444
- const dateTimeDefaultShapeFields = /* @__PURE__ */ Object.assign({}, dateDefaultShapeFields, timeDefaultShapeFields);
2445
- const zonedDateTimeDefaultShapeFields = /* @__PURE__ */ Object.assign({}, dateTimeDefaultShapeFields, { timeZoneName: "short" });
2451
+ const dateTimeDefaultShapeFields = /*@__PURE__*/ Object.assign({}, dateDefaultShapeFields, timeDefaultShapeFields);
2452
+ const zonedDateTimeDefaultShapeFields = /*@__PURE__*/ Object.assign({}, dateTimeDefaultShapeFields, { timeZoneName: "short" });
2446
2453
  const yearMonthDefaultShapeFields = {
2447
2454
  year: "numeric",
2448
2455
  month: "numeric"
@@ -2466,15 +2473,15 @@ const timeShapeFieldNames = [
2466
2473
  "fractionalSecondDigits",
2467
2474
  "timeStyle"
2468
2475
  ];
2469
- const dateTimeShapeFieldNames = /* @__PURE__ */ dateShapeFieldNames.concat(timeShapeFieldNames);
2470
- const yearMonthIgnoredFieldNames = /* @__PURE__ */ ["weekday", "day"].concat(timeShapeFieldNames);
2471
- const monthDayIgnoredFieldNames = /* @__PURE__ */ ["weekday", "year"].concat(timeShapeFieldNames);
2472
- const transformInstantOptions = /* @__PURE__ */ createOptionsTransformer(dateTimeShapeFieldNames, [], [], dateTimeDefaultShapeFields);
2473
- const transformZonedOptions = /* @__PURE__ */ createOptionsTransformer(dateTimeShapeFieldNames, [], [], zonedDateTimeDefaultShapeFields);
2474
- const transformDateTimeOptions = /* @__PURE__ */ createOptionsTransformer(dateTimeShapeFieldNames, [], ["timeZoneName"], dateTimeDefaultShapeFields);
2475
- const transformDateOptions = /* @__PURE__ */ createOptionsTransformer(dateShapeFieldNames, timeShapeFieldNames, ["timeZoneName"], dateDefaultShapeFields);
2476
- const transformTimeOptions = /* @__PURE__ */ createOptionsTransformer(timeShapeFieldNames, dateShapeFieldNames, ["timeZoneName", "era"], timeDefaultShapeFields);
2477
- const transformYearMonthOptions = /* @__PURE__ */ createOptionsTransformer([
2476
+ const dateTimeShapeFieldNames = /*@__PURE__*/ dateShapeFieldNames.concat(timeShapeFieldNames);
2477
+ const yearMonthIgnoredFieldNames = /*@__PURE__*/ ["weekday", "day"].concat(timeShapeFieldNames);
2478
+ const monthDayIgnoredFieldNames = /*@__PURE__*/ ["weekday", "year"].concat(timeShapeFieldNames);
2479
+ const transformInstantOptions = /*@__PURE__*/ createOptionsTransformer(dateTimeShapeFieldNames, [], [], dateTimeDefaultShapeFields);
2480
+ const transformZonedOptions = /*@__PURE__*/ createOptionsTransformer(dateTimeShapeFieldNames, [], [], zonedDateTimeDefaultShapeFields);
2481
+ const transformDateTimeOptions = /*@__PURE__*/ createOptionsTransformer(dateTimeShapeFieldNames, [], ["timeZoneName"], dateTimeDefaultShapeFields);
2482
+ const transformDateOptions = /*@__PURE__*/ createOptionsTransformer(dateShapeFieldNames, timeShapeFieldNames, ["timeZoneName"], dateDefaultShapeFields);
2483
+ const transformTimeOptions = /*@__PURE__*/ createOptionsTransformer(timeShapeFieldNames, dateShapeFieldNames, ["timeZoneName", "era"], timeDefaultShapeFields);
2484
+ const transformYearMonthOptions = /*@__PURE__*/ createOptionsTransformer([
2478
2485
  "year",
2479
2486
  "month",
2480
2487
  "dateStyle"
@@ -2496,7 +2503,7 @@ const transformYearMonthOptions = /* @__PURE__ */ createOptionsTransformer([
2496
2503
  month: "numeric"
2497
2504
  }
2498
2505
  });
2499
- const transformMonthDayOptions = /* @__PURE__ */ createOptionsTransformer([
2506
+ const transformMonthDayOptions = /*@__PURE__*/ createOptionsTransformer([
2500
2507
  "month",
2501
2508
  "day",
2502
2509
  "dateStyle"
@@ -2540,20 +2547,33 @@ function getCurrentTimeZoneId() {
2540
2547
  //#endregion
2541
2548
  exports.RawDateTimeFormat = RawDateTimeFormat;
2542
2549
  exports.absDuration = absDuration;
2550
+ exports.addDateMonths = addDateMonths;
2543
2551
  exports.addDurations = addDurations;
2552
+ exports.addIsoMonths = addIsoMonths;
2544
2553
  exports.applyPlainFormatTimeZone = applyPlainFormatTimeZone;
2545
2554
  exports.applyZonedFormatTimeZone = applyZonedFormatTimeZone;
2555
+ exports.bigNanoInHour = bigNanoInHour;
2556
+ exports.bigNanoInMicro = bigNanoInMicro;
2546
2557
  exports.bigNanoInMilli = bigNanoInMilli;
2558
+ exports.bigNanoInMinute = bigNanoInMinute;
2559
+ exports.bigNanoInSec = bigNanoInSec;
2560
+ exports.bigNanoInUtcDay = bigNanoInUtcDay;
2561
+ exports.bindArgs = bindArgs;
2547
2562
  exports.checkEpochNanoInBounds = checkEpochNanoInBounds;
2548
2563
  exports.checkIsoDateInBounds = checkIsoDateInBounds;
2549
2564
  exports.checkIsoDateTimeInBounds = checkIsoDateTimeInBounds;
2550
2565
  exports.checkIsoYearMonthInBounds = checkIsoYearMonthInBounds;
2551
2566
  exports.checkResolvedCalendarCompatible = checkResolvedCalendarCompatible;
2567
+ exports.clampEntity = clampEntity;
2568
+ exports.coerceRoundingIncInteger = coerceRoundingIncInteger;
2569
+ exports.coerceRoundingMode = coerceRoundingMode;
2552
2570
  exports.combineDateAndTime = combineDateAndTime;
2571
+ exports.compareBigInts = compareBigInts;
2553
2572
  exports.compareDurations = compareDurations;
2554
2573
  exports.compareInstants = compareInstants;
2555
2574
  exports.compareIsoDateFields = compareIsoDateFields;
2556
2575
  exports.compareIsoDateTimeFields = compareIsoDateTimeFields;
2576
+ exports.compareNumbers = compareNumbers;
2557
2577
  exports.compareTimeFields = compareTimeFields;
2558
2578
  exports.compareZonedDateTimes = compareZonedDateTimes;
2559
2579
  exports.computeBigNanoInc = computeBigNanoInc;
@@ -2563,14 +2583,25 @@ exports.computeCalendarDaysInMonth = computeCalendarDaysInMonth;
2563
2583
  exports.computeCalendarDaysInYear = computeCalendarDaysInYear;
2564
2584
  exports.computeCalendarEraFields = computeCalendarEraFields;
2565
2585
  exports.computeCalendarInLeapYear = computeCalendarInLeapYear;
2586
+ exports.computeCalendarIsoFieldsFromParts = computeCalendarIsoFieldsFromParts;
2566
2587
  exports.computeCalendarMonthCode = computeCalendarMonthCode;
2567
2588
  exports.computeCalendarMonthsInYear = computeCalendarMonthsInYear;
2568
2589
  exports.computeCalendarWeekOfYear = computeCalendarWeekOfYear;
2569
2590
  exports.computeCalendarYearOfWeek = computeCalendarYearOfWeek;
2591
+ exports.computeEpochNanoFrac = computeEpochNanoFrac;
2592
+ exports.computeGregoryEraFields = computeGregoryEraFields;
2570
2593
  exports.computeIsoDayOfWeek = computeIsoDayOfWeek;
2594
+ exports.computeIsoDaysInMonth = computeIsoDaysInMonth;
2595
+ exports.computeIsoDaysInYear = computeIsoDaysInYear;
2596
+ exports.computeIsoFieldsFromParts = computeIsoFieldsFromParts;
2597
+ exports.computeIsoInLeapYear = computeIsoInLeapYear;
2598
+ exports.computeIsoMonthCodeParts = computeIsoMonthCodeParts;
2599
+ exports.computeIsoWeekFields = computeIsoWeekFields;
2600
+ exports.computeIsoYearMonthFieldsForMonthDay = computeIsoYearMonthFieldsForMonthDay;
2571
2601
  exports.computeNanoInc = computeNanoInc;
2572
2602
  exports.computeZonedHoursInDay = computeZonedHoursInDay;
2573
2603
  exports.computeZonedStartOfDay = computeZonedStartOfDay;
2604
+ exports.constrainToRange = constrainToRange;
2574
2605
  exports.convertPlainMonthDayToDate = convertPlainMonthDayToDate;
2575
2606
  exports.convertPlainYearMonthToDate = convertPlainYearMonthToDate;
2576
2607
  exports.convertToPlainMonthDay = convertToPlainMonthDay;
@@ -2579,25 +2610,36 @@ exports.createDateSlots = createDateSlots;
2579
2610
  exports.createDateTimeSlots = createDateTimeSlots;
2580
2611
  exports.createDurationSlots = createDurationSlots;
2581
2612
  exports.createEpochNanoSlots = createEpochNanoSlots;
2613
+ exports.createMarkerMoveOps = createMarkerMoveOps;
2582
2614
  exports.createNameDescriptors = createNameDescriptors;
2583
2615
  exports.createPlainDateTimeFromRefinedFields = createPlainDateTimeFromRefinedFields;
2616
+ exports.createPlainMonthDayFromFields = createPlainMonthDayFromFields;
2617
+ exports.createPlainYearMonthFromFields = createPlainYearMonthFromFields;
2584
2618
  exports.createPropDescriptors = createPropDescriptors;
2585
2619
  exports.createPropGetters = createPropGetters;
2586
2620
  exports.createStringTagDescriptors = createStringTagDescriptors;
2587
2621
  exports.createTimeSlots = createTimeSlots;
2588
2622
  exports.createZonedEpochNanoSlots = createZonedEpochNanoSlots;
2623
+ exports.diffCalendarDates = diffCalendarDates;
2589
2624
  exports.diffInstants = diffInstants;
2625
+ exports.diffIsoMonthSlots = diffIsoMonthSlots;
2590
2626
  exports.diffPlainDateTimes = diffPlainDateTimes;
2591
2627
  exports.diffPlainDates = diffPlainDates;
2592
2628
  exports.diffPlainTimes = diffPlainTimes;
2593
2629
  exports.diffPlainYearMonth = diffPlainYearMonth;
2594
2630
  exports.diffZonedDateTimes = diffZonedDateTimes;
2631
+ exports.divideBigNanoToExactNumber = divideBigNanoToExactNumber;
2632
+ exports.durationFieldDefaults = durationFieldDefaults;
2595
2633
  exports.durationGetters = durationGetters;
2634
+ exports.epochDaysToIsoDate = epochDaysToIsoDate;
2596
2635
  exports.epochMilliToInstant = epochMilliToInstant;
2597
2636
  exports.epochNanoToInstant = epochNanoToInstant;
2637
+ exports.epochNanoToIsoDateTime = epochNanoToIsoDateTime;
2638
+ exports.eraYearToYear = eraYearToYear;
2598
2639
  exports.exoticCalendarRequired = exoticCalendarRequired;
2599
2640
  exports.forbiddenValueOf = forbiddenValueOf;
2600
2641
  exports.formatDurationIso = formatDurationIso;
2642
+ exports.formatEpochMilliToPartsRecord = formatEpochMilliToPartsRecord;
2601
2643
  exports.formatInstantIso = formatInstantIso;
2602
2644
  exports.formatOffsetNano = formatOffsetNano;
2603
2645
  exports.formatPlainDateIso = formatPlainDateIso;
@@ -2608,14 +2650,18 @@ exports.formatPlainYearMonthIso = formatPlainYearMonthIso;
2608
2650
  exports.formatZonedDateTimeIso = formatZonedDateTimeIso;
2609
2651
  exports.getCalendarSlotId = getCalendarSlotId;
2610
2652
  exports.getCommonCalendar = getCommonCalendar;
2653
+ exports.getCommonTimeZone = getCommonTimeZone;
2611
2654
  exports.getCurrentEpochNano = getCurrentEpochNano;
2612
2655
  exports.getCurrentIsoDateTime = getCurrentIsoDateTime;
2613
2656
  exports.getCurrentTimeZoneId = getCurrentTimeZoneId;
2614
2657
  exports.getEpochMilli = getEpochMilli;
2615
2658
  exports.getEpochNano = getEpochNano;
2659
+ exports.getMatchingInstantFor = getMatchingInstantFor;
2660
+ exports.getSingleInstantFor = getSingleInstantFor;
2616
2661
  exports.getTimeZoneTransitionEpochNanoseconds = getTimeZoneTransitionEpochNanoseconds;
2617
2662
  exports.getZonedTimeZoneId = getZonedTimeZoneId;
2618
2663
  exports.gregoryCalendarId = gregoryCalendarId;
2664
+ exports.gregoryEraOrigins = gregoryEraOrigins;
2619
2665
  exports.instantToZonedDateTime = instantToZonedDateTime;
2620
2666
  exports.instantsEqual = instantsEqual;
2621
2667
  exports.invalidBag = invalidBag;
@@ -2623,11 +2669,16 @@ exports.invalidCalendar = invalidCalendar;
2623
2669
  exports.invalidCallingContext = invalidCallingContext;
2624
2670
  exports.invalidTimeZone = invalidTimeZone;
2625
2671
  exports.isObjectLike = isObjectLike;
2672
+ exports.isoArgsToEpochDays = isoArgsToEpochDays;
2626
2673
  exports.isoCalendarId = isoCalendarId;
2627
2674
  exports.isoDateTimeToEpochMilli = isoDateTimeToEpochMilli;
2675
+ exports.isoDateTimeToEpochNano = isoDateTimeToEpochNano;
2676
+ exports.isoDateToEpochDays = isoDateToEpochDays;
2628
2677
  exports.isoDateToEpochMilli = isoDateToEpochMilli;
2678
+ exports.isoDateToEpochNano = isoDateToEpochNano;
2629
2679
  exports.isoEpochFirstLeapYear = isoEpochFirstLeapYear;
2630
2680
  exports.mapProps = mapProps;
2681
+ exports.memoize = memoize;
2631
2682
  exports.mergeDurationFields = mergeDurationFields;
2632
2683
  exports.mergePlainDateFields = mergePlainDateFields;
2633
2684
  exports.mergePlainDateTimeFields = mergePlainDateTimeFields;
@@ -2635,15 +2686,27 @@ exports.mergePlainMonthDayFields = mergePlainMonthDayFields;
2635
2686
  exports.mergePlainTimeFields = mergePlainTimeFields;
2636
2687
  exports.mergePlainYearMonthFields = mergePlainYearMonthFields;
2637
2688
  exports.mergeZonedDateTimeFields = mergeZonedDateTimeFields;
2689
+ exports.modFloor = modFloor;
2690
+ exports.monthCodeNumberToMonth = monthCodeNumberToMonth;
2691
+ exports.moveByDays = moveByDays;
2638
2692
  exports.moveDate = moveDate;
2639
2693
  exports.moveDateTime = moveDateTime;
2640
2694
  exports.moveEpochNano = moveEpochNano;
2641
2695
  exports.moveTime = moveTime;
2642
2696
  exports.moveYearMonth = moveYearMonth;
2643
2697
  exports.moveZonedEpochSlots = moveZonedEpochSlots;
2698
+ exports.nanoInHour = nanoInHour;
2699
+ exports.nanoInMicro = nanoInMicro;
2700
+ exports.nanoInMilli = nanoInMilli;
2701
+ exports.nanoInMinute = nanoInMinute;
2702
+ exports.nanoInSec = nanoInSec;
2703
+ exports.nanoInUtcDay = nanoInUtcDay;
2704
+ exports.nanoToTimeAndDay = nanoToTimeAndDay;
2644
2705
  exports.negateDuration = negateDuration;
2645
2706
  exports.negateDurationFields = negateDurationFields;
2646
2707
  exports.noop = noop;
2708
+ exports.normalizeOptionsOrString = normalizeOptionsOrString;
2709
+ exports.outOfBoundsDate = outOfBoundsDate;
2647
2710
  exports.parseCalendarId = parseCalendarId;
2648
2711
  exports.parseDuration = parseDuration;
2649
2712
  exports.parseInstant = parseInstant;
@@ -2662,6 +2725,7 @@ exports.plainDatesEqual = plainDatesEqual;
2662
2725
  exports.plainMonthDaysEqual = plainMonthDaysEqual;
2663
2726
  exports.plainTimesEqual = plainTimesEqual;
2664
2727
  exports.plainYearMonthsEqual = plainYearMonthsEqual;
2728
+ exports.prepareZonedEpochDiff = prepareZonedEpochDiff;
2665
2729
  exports.queryTimeZone = queryTimeZone;
2666
2730
  exports.refineDurationObjectLike = refineDurationObjectLike;
2667
2731
  exports.refineMaybeZonedDateTimeObjectLike = refineMaybeZonedDateTimeObjectLike;
@@ -2679,18 +2743,23 @@ exports.requireNumberIsInteger = requireNumberIsInteger;
2679
2743
  exports.requireString = requireString;
2680
2744
  exports.resolveTimeZoneId = resolveTimeZoneId;
2681
2745
  exports.roundBigNanoToDayOriginInc = roundBigNanoToDayOriginInc;
2746
+ exports.roundBigNanoToInc = roundBigNanoToInc;
2682
2747
  exports.roundDateTimeToNano = roundDateTimeToNano;
2683
2748
  exports.roundDuration = roundDuration;
2749
+ exports.roundNumberToInc = roundNumberToInc;
2684
2750
  exports.roundTimeToNano = roundTimeToNano;
2751
+ exports.roundWithMode = roundWithMode;
2685
2752
  exports.roundZonedEpochSlotsToUnit = roundZonedEpochSlotsToUnit;
2686
2753
  exports.throwRangeError = throwRangeError;
2687
2754
  exports.throwTypeError = throwTypeError;
2688
2755
  exports.timeFieldDefaults = timeFieldDefaults;
2689
2756
  exports.timeFieldsToMilli = timeFieldsToMilli;
2757
+ exports.timeFieldsToNano = timeFieldsToNano;
2690
2758
  exports.timeGetters = timeGetters;
2691
2759
  exports.toBigInt = toBigInt;
2692
2760
  exports.toStrictInteger = toStrictInteger;
2693
2761
  exports.totalDuration = totalDuration;
2762
+ exports.totalRelativeDuration = totalRelativeDuration;
2694
2763
  exports.transformDateOptions = transformDateOptions;
2695
2764
  exports.transformDateTimeOptions = transformDateTimeOptions;
2696
2765
  exports.transformInstantOptions = transformInstantOptions;
@@ -2701,6 +2770,7 @@ exports.transformZonedOptions = transformZonedOptions;
2701
2770
  exports.validateDurationFields = validateDurationFields;
2702
2771
  exports.validateIsoDateFields = validateIsoDateFields;
2703
2772
  exports.validateIsoDateTimeFields = validateIsoDateTimeFields;
2773
+ exports.validateRoundingInc = validateRoundingInc;
2704
2774
  exports.validateTimeFields = validateTimeFields;
2705
2775
  exports.zonedDateTimeToInstant = zonedDateTimeToInstant;
2706
2776
  exports.zonedDateTimeToPlainDate = zonedDateTimeToPlainDate;
@@ -45,6 +45,7 @@ exports.nanoInMilli = nanoInMilli;
45
45
  exports.nanoInMinute = nanoInMinute;
46
46
  exports.nanoInSec = nanoInSec;
47
47
  exports.normalizeOptions = normalizeOptions;
48
+ exports.requireNumberIsPositive = requireNumberIsPositive;
48
49
  exports.requireObjectLike = requireObjectLike;
49
50
  exports.toFiniteNumber = toFiniteNumber;
50
51
  exports.toIntegerWithTrunc = toIntegerWithTrunc;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/postgres",
3
- "version": "2.4.0-pr.934.40+3331d302",
3
+ "version": "2.4.0",
4
4
  "description": "PostgreSQL drivers for Fedify",
5
5
  "keywords": [
6
6
  "fedify",
@@ -71,15 +71,15 @@
71
71
  },
72
72
  "peerDependencies": {
73
73
  "postgres": "^3.4.7",
74
- "@fedify/fedify": "^2.4.0-pr.934.40+3331d302"
74
+ "@fedify/fedify": "^2.4.0"
75
75
  },
76
76
  "devDependencies": {
77
77
  "@js-temporal/polyfill": "^0.5.1",
78
78
  "@std/async": "npm:@jsr/std__async@^1.0.13",
79
79
  "tsdown": "^0.22.0",
80
80
  "typescript": "^6.0.0",
81
- "@fedify/testing": "^2.4.0-pr.934.40+3331d302",
82
- "@fedify/fixture": "^2.0.0"
81
+ "@fedify/fixture": "^2.0.0",
82
+ "@fedify/testing": "^2.4.0"
83
83
  },
84
84
  "scripts": {
85
85
  "build:self": "tsdown",