@deveye/types 0.16.1 → 0.17.1

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.
@@ -243,7 +243,7 @@ export interface TestContext<Repo> extends SdkFeatureContext<Repo> {
243
243
  recorded: RecordedCalls;
244
244
  store: TestFeatureStore;
245
245
  /** Item ids passed to `items.forget`, in order. */
246
- forgotten: number[];
246
+ forgotten: string[];
247
247
  }
248
248
 
249
249
  export interface TestContextOverrides<Repo> {
@@ -287,13 +287,13 @@ export interface TestContextOverrides<Repo> {
287
287
  */
288
288
  unlocked?: boolean;
289
289
  /** The caller's role restrictions on items, by item id. Default none. */
290
- itemRestrictions?: Readonly<Record<number, ItemAccess>>;
290
+ itemRestrictions?: Readonly<Record<string, ItemAccess>>;
291
291
  /**
292
292
  * Items projected INTO the workspace, as `itemId → home workspace id`.
293
293
  * Default none: every item is at home. `sharing.scope().cipherFor` is the
294
294
  * identity cipher either way.
295
295
  */
296
- shares?: Readonly<Record<number, number>>;
296
+ shares?: Readonly<Record<string, number>>;
297
297
  /** The named contracts the host holds (`ctx.providers.get(key)`). */
298
298
  providers?: Readonly<Record<string, unknown>>;
299
299
  }
@@ -331,13 +331,12 @@ export function createTestContext<Repo = undefined>(
331
331
  agents: recordingAgents(recorded),
332
332
  ...overrides.deveye
333
333
  };
334
- const restrictions = new Map<number, ItemAccess>(
335
- Object.entries(overrides.itemRestrictions ?? {}).map(([id, access]) => [Number(id), access])
334
+ const restrictions = new Map<string, ItemAccess>(
335
+ Object.entries(overrides.itemRestrictions ?? {})
336
336
  );
337
- const homes = new Map<number, number>(
338
- Object.entries(overrides.shares ?? {}).map(([id, home]) => [Number(id), home])
339
- );
340
- const forgotten: number[] = [];
337
+ const homes = new Map<string, number>(Object.entries(overrides.shares ?? {}));
338
+ const forgotten: string[] = [];
339
+ const orders: { itemId: string; order: number }[] = [];
341
340
  return {
342
341
  recorded,
343
342
  forgotten,
@@ -382,8 +381,16 @@ export function createTestContext<Repo = undefined>(
382
381
  Promise.resolve({
383
382
  foreignIds: new Set(homes.keys()),
384
383
  homeOf: (itemId) => homes.get(itemId) ?? null,
385
- cipherFor: () => Promise.resolve(identityCipher)
386
- })
384
+ cipherFor: () => Promise.resolve(identityCipher),
385
+ orderOf: (itemId) =>
386
+ homes.has(itemId)
387
+ ? (orders.find((o) => o.itemId === itemId)?.order ?? 0)
388
+ : null
389
+ }),
390
+ setOrder: (itemId, order) => {
391
+ orders.push({ itemId, order });
392
+ return Promise.resolve();
393
+ }
387
394
  },
388
395
  userId: overrides.userId ?? 1,
389
396
  workspaceId,