Hyperlinkv0.8.0-beta.28

Store

Store.scopedconstsrc/Store.ts:1554
<
  const ScopeKey extends string | StoreScopeTag,
  const C extends StoreContractValue
>(
  scope: ScopeKey,
  contract: C
): StandaloneStore<
  { readonly _tag: ScopeKeyOf<ScopeKey> },
  `hyperlink-ts/Store/scope/${ScopeKeyOf<ScopeKey>}`,
  ScopeKeyOf<ScopeKey>,
  C,
  ScopeKey extends StoreScopeTag ? ScopeKey : undefined
>

Standalone store for one scope — class with layerMemory / layer({ filename? }) like Service, but single-scope.

constructorsService
Source src/Store.ts:155423 lines
export const scoped = <
  const ScopeKey extends string | StoreScopeTag,
  const C extends StoreContractValue,
>(
  scope: ScopeKey,
  contract: C,
): StandaloneStore<
  { readonly _tag: ScopeKeyOf<ScopeKey> },
  `hyperlink-ts/Store/scope/${ScopeKeyOf<ScopeKey>}`,
  ScopeKeyOf<ScopeKey>,
  C,
  ScopeKey extends StoreScopeTag ? ScopeKey : undefined
> => {
  const standaloneClass = defineStandaloneStore(scope, contract);
  const registration = buildStandaloneRegistration(scope, contract);
  const layerMemory = buildStandaloneMemoryLayer(standaloneClass, registration);
  const layer = (options: StoreLayerOptions) =>
    buildStandaloneSqliteLayer(standaloneClass, registration, options.filename);
  return Object.assign(standaloneClass, {
    layerMemory,
    layer,
  });
};