Hyperlinkv0.8.0-beta.28

Store

Store.effectsconstsrc/Store.ts:1240
<const C extends StoreContractValue>(
  scope: string | StoreScopeTag,
  contract: C
): StoreEffectsOf<C>

Build a PURE object of effects from a contract — the HandleOf structure (nested shape tree + custom methods) where each method is (...args) => resolveOrDie(scope, contract).flatMap((handle) => handle.<path>(...args)). So every method carries Storage in its requirement (see StoreEffectsOf), the error channel stays clean (resolveOrDie dies on an unregistered custom store rather than surfacing StoreScopeNotRegistered), and there is no resolution / yield* / memo cell here — the handle memo lives in the storage bridge's .at. No error handling (catchWriteErrors owns that).

Write methods honestly carry StoreWriteError in their error channel (a journal/IO write failure); catchWriteErrors narrows it out. Reads carry no error.

Source src/Store.ts:124025 lines
export const effects = <const C extends StoreContractValue>(
  scope: string | StoreScopeTag,
  contract: C,
): StoreEffectsOf<C> => {
  const method =
    (path: string) =>
    (...args: ReadonlyArray<unknown>) =>
      resolveOrDie(scope, contract).pipe(
        Effect.flatMap((handle) => callAt(handle, path, args)),
      );

  const flat: Record<string, unknown> = {};
  for (const shapeKey of shapeRowsByKey(contract.shapes).keys()) {
    flat[`${shapeKey}.append`] = method(`${shapeKey}.append`);
    flat[`${shapeKey}.read`] = method(`${shapeKey}.read`);
  }
  for (const name of Object.keys(contract.customEntries)) {
    flat[name] = method(name);
  }
  const built = nestHandle(flat);
  stampEffectsBrand(built);
  // Same generic-object structural-rebuild idiom as `makeShapeHandles` / `makeShapeRefs`: the effects
  // object is assembled by dynamic assignment (then nested), so its type is asserted once here.
  return built as StoreEffectsOf<C>;
};