@crvouga/mockingbird-service-postgres 3.4.0 → 3.5.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.
@@ -209,6 +209,8 @@ type SnapshotDocument = {
209
209
  faults?: unknown;
210
210
  latency?: unknown;
211
211
  virtualTime?: boolean;
212
+ /** Quiescent webhook endpoints, delivery history and fault state. Contains private configuration. */
213
+ webhooks?: unknown;
212
214
  };
213
215
  /** Controls for one namespace. */
214
216
  type NamespaceControls = {
@@ -246,7 +248,15 @@ type FleetDiagnostics = {
246
248
  };
247
249
  /** Protocol packages own their state, listeners, credentials and namespace selection. */
248
250
  type FleetChild = {
249
- protocol: "http" | "postgres" | "redis";
251
+ targetName?: string;
252
+ dependencies?: string[];
253
+ coverage?: {
254
+ included: string[];
255
+ excluded: string[];
256
+ };
257
+ outboundPolicy?: "webhook-hub" | "unsupported";
258
+ packageVersion?: string;
259
+ protocol: "http" | "postgres" | "redis" | "external";
250
260
  url: string;
251
261
  connection?: string;
252
262
  connections?: Record<string, string>;
@@ -262,11 +272,37 @@ type FleetChild = {
262
272
  restore(namespace: string, checkpoint: unknown): Promise<void>;
263
273
  reset(namespace: string): Promise<void>;
264
274
  clock(namespace: string): Clock;
265
- settle?(namespace: string): Promise<void>;
275
+ nextEvent?(namespace: string): number | undefined | Promise<number | undefined>;
276
+ settle?(namespace: string, signal?: AbortSignal): Promise<void>;
277
+ exportCheckpoint?(namespace: string, checkpoint: unknown): Promise<unknown>;
278
+ importCheckpoint?(namespace: string, document: unknown): Promise<unknown>;
279
+ createNamespace?(namespace: string): Promise<void>;
280
+ deleteNamespace?(namespace: string): Promise<void>;
281
+ inspect?(namespace: string, options: {
282
+ offset: number;
283
+ limit: number;
284
+ collection?: string;
285
+ }): Promise<unknown>;
286
+ configure?(namespace: string, controls: Record<string, unknown>): Promise<unknown>;
287
+ unmatched?(namespace: string, limit: number): {
288
+ entries: unknown[];
289
+ truncated: boolean;
290
+ };
291
+ lastActivity?(namespace: string): number;
292
+ setAdmission?(allow: (namespace: string) => boolean): void;
293
+ initializationAccess?(): Promise<{
294
+ connections: Record<string, string>;
295
+ close(): Promise<void>;
296
+ }>;
266
297
  };
267
298
 
268
299
  /** A service entry in `mockingbird.json`. */
269
300
  type ConfigService = {
301
+ /** Stable config key is the instance identity; target defaults to that key. */
302
+ target?: string;
303
+ publicOrigin?: string;
304
+ publicPath?: string;
305
+ dependsOn?: string[];
270
306
  protocol?: "http" | "postgres" | "redis";
271
307
  port?: number;
272
308
  host?: string;
@@ -26967,7 +26967,7 @@ function readSlabCell(column, rowIndex, intern, rowCount) {
26967
26967
  }
26968
26968
  if (pack === PACK_INT) {
26969
26969
  const integer2 = view.getBigInt64(nonNullIndex * 8, true);
26970
- return integer2 <= BigInt(Number.MAX_SAFE_INTEGER) && integer2 >= BigInt(Number.MIN_SAFE_INTEGER) ? Number(integer2) : integer2;
26970
+ return !column.integerBigInt && integer2 <= BigInt(Number.MAX_SAFE_INTEGER) && integer2 >= BigInt(Number.MIN_SAFE_INTEGER) ? Number(integer2) : integer2;
26971
26971
  }
26972
26972
  if (pack === PACK_TEXT_INTERN) {
26973
26973
  const id = view.getUint32(nonNullIndex * 4, true);
@@ -27528,7 +27528,8 @@ function decodeInner(snapshot, prng, clock) {
27528
27528
  if (meta.stats) state.tableStats.set(table.oid, meta.stats);
27529
27529
  const rowCount = readVarintU32(r);
27530
27530
  const slabColumns = [];
27531
- for (let c = 0; c < meta.columns.length; c++) slabColumns.push(readPackedColumn(r, rowCount, intern));
27531
+ for (let c = 0; c < meta.columns.length; c++)
27532
+ slabColumns.push(readPackedColumn(r, rowCount, intern, meta.columns[c].type.id));
27532
27533
  table.attachSlab(new ColumnarSlab(snapshot, rowCount, slabColumns, intern));
27533
27534
  schema.tables.set(table.name, table);
27534
27535
  }
@@ -27541,7 +27542,7 @@ function decodeInner(snapshot, prng, clock) {
27541
27542
  const matRowCount = readVarintU32(r);
27542
27543
  const width = readVarintU32(r);
27543
27544
  const cols = [];
27544
- for (let c = 0; c < width; c++) cols.push(readPackedColumn(r, matRowCount, intern));
27545
+ for (let c = 0; c < width; c++) cols.push(readPackedColumn(r, matRowCount, intern, meta.matColumns?.[c]?.type));
27545
27546
  const slab = new ColumnarSlab(snapshot, matRowCount, cols, intern);
27546
27547
  matRows = slab.materialize();
27547
27548
  }
@@ -27813,7 +27814,7 @@ function writePackedColumn(w, rows, col, internId, forceId) {
27813
27814
  writeTaggedDatum(w, rows[i][col], internId, forceId);
27814
27815
  }
27815
27816
  }
27816
- function readPackedColumn(r, n, intern) {
27817
+ function readPackedColumn(r, n, intern, type) {
27817
27818
  const pack = r.u8();
27818
27819
  if (pack === PACK_NULL) return { pack, nullBitmap: null, payload: new Uint8Array(0) };
27819
27820
  const bits = r.raw(n + 7 >> 3);
@@ -27826,7 +27827,8 @@ function readPackedColumn(r, n, intern) {
27826
27827
  r.skipAlign4();
27827
27828
  const width = 8;
27828
27829
  const payload = r.raw(nonNull * width);
27829
- return { pack, nullBitmap: bits, payload };
27830
+ const integerBigInt = type !== void 0 && ["int8", "money", "time", "timestamp", "timestamptz"].includes(type);
27831
+ return { pack, nullBitmap: bits, payload, integerBigInt };
27830
27832
  }
27831
27833
  if (pack === PACK_TEXT_INTERN) {
27832
27834
  r.skipAlign4();