toiljs 0.0.64 → 0.0.66

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.
@@ -92,7 +92,7 @@ function routeKindsSection(routes: readonly (readonly [number, number, string])[
92
92
  return Buffer.concat(chunks);
93
93
  }
94
94
 
95
- function catalogSectionV2(fillMaxWaitMs: number, fillAllowStale: number): Buffer {
95
+ function catalogSectionV2(fillMaxWaitMs: number, fillAllowStale: number, replication = 5): Buffer {
96
96
  const chunks: Buffer[] = [];
97
97
  const u8 = (v: number) => chunks.push(Buffer.from([v & 0xff]));
98
98
  const u16 = (v: number) => {
@@ -122,7 +122,7 @@ function catalogSectionV2(fillMaxWaitMs: number, fillAllowStale: number): Buffer
122
122
  u32(0xaaaa);
123
123
  u32(0x1234);
124
124
  u32(0); // generation
125
- u8(5); // replication = localOnly, accepted by the backend ABI
125
+ u8(replication); // replication
126
126
  u8(0); // placement = hashKey
127
127
  u32(fillMaxWaitMs);
128
128
  u8(fillAllowStale);
@@ -231,6 +231,16 @@ describe('toildb dev emulator (record family)', () => {
231
231
  });
232
232
  });
233
233
 
234
+ it('rejects replication policies that require catalog v3 metadata', () => {
235
+ for (const replication of [3, 4]) {
236
+ setDbCatalog(wasmWithSection('toildb.catalog', catalogSectionV2(7, 0, replication)));
237
+ const { imports, buf } = setupRaw();
238
+ const [p, l] = put(buf, 0, 'App/users');
239
+
240
+ expect(imports['data.resolve_collection'](p, l, 16)).toBe(-1070);
241
+ }
242
+ });
243
+
234
244
  it('rejects malformed catalog v2 fill policy', () => {
235
245
  setDbCatalog(wasmWithSection('toildb.catalog', catalogSectionV2(7, 2)));
236
246
  const { imports, buf } = setupRaw();