<
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.
export const 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
>
Standalone store for one scope — class with layerMemory / layer({ filename? }) like
Service
, but single-scope.
scoped = <
const function (type parameter) ScopeKey in <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>
ScopeKey extends string | StoreScopeTag,
const function (type parameter) C in <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>
C extends type StoreContractValue<Shapes extends StoreShapes = Readonly<Record<string, StoreShapeInput>>, Custom extends Readonly<Record<string, unknown>> = Readonly<Record<never, never>>> = StoreContractDef<Shapes, Custom> & PipeableStoreContractValue,
>(
scope: const ScopeKey extends string | StoreScopeTagscope: function (type parameter) ScopeKey in <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>
ScopeKey,
contract: const C extends StoreContractValuecontract: function (type parameter) C in <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>
C,
): type StandaloneStore<
Self,
Id extends string,
K extends string = string,
C extends StoreContractValue = StoreContractValue,
Tag extends
| StoreScopeTag
| undefined = undefined
> = Context.ServiceClass<
Self,
Id,
Simplify<
Simplify<StoreShapeHandleTree<C["shapes"]>> &
Simplify<{
readonly [K in CustomHandleKeys<C>]: CustomMethodOf<
C,
K
>
}>
>
> & {
readonly scopeKey: K
readonly spec: C["spec"]
readonly contract: C
readonly [storeStandaloneSym]: true
} & (Tag extends undefined
? unknown
: {
readonly tag: Tag
}) &
StoreLayers<Self>
Standalone single-scope store class with attached
Storage
layers.
StandaloneStore<
{ readonly _tag: ScopeKeyOf<ScopeKey>_tag: type ScopeKeyOf<Scope extends string | StoreScopeTag> = Scope extends string ? Scope : Scope extends {
readonly key: infer Id extends string;
} ? Id : never
ScopeKeyOf<function (type parameter) ScopeKey in <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>
ScopeKey> },
`hyperlink-ts/Store/scope/${type ScopeKeyOf<Scope extends string | StoreScopeTag> = Scope extends string ? Scope : Scope extends {
readonly key: infer Id extends string;
} ? Id : never
ScopeKeyOf<function (type parameter) ScopeKey in <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>
ScopeKey>}`,
type ScopeKeyOf<Scope extends string | StoreScopeTag> = Scope extends string ? Scope : Scope extends {
readonly key: infer Id extends string;
} ? Id : never
ScopeKeyOf<function (type parameter) ScopeKey in <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>
ScopeKey>,
function (type parameter) C in <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>
C,
function (type parameter) ScopeKey in <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>
ScopeKey extends StoreScopeTag ? function (type parameter) ScopeKey in <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>
ScopeKey : undefined
> => {
const const standaloneClass: StandaloneStoreClass<
{
readonly _tag: ScopeKeyOf<ScopeKey>
},
`hyperlink-ts/Store/scope/${ScopeKeyOf<ScopeKey>}`,
ScopeKeyOf<ScopeKey>,
C,
ScopeKey extends StoreScopeTag
? ScopeKey
: undefined
>
standaloneClass = defineStandaloneStore<ScopeKey, C>(scope: ScopeKey, contract: C): StandaloneStoreClass<{
readonly _tag: ScopeKeyOf<ScopeKey>;
}, `hyperlink-ts/Store/scope/${ScopeKeyOf<ScopeKey>}`, ScopeKeyOf<ScopeKey>, C, ScopeKey extends StoreScopeTag ? ScopeKey : undefined>
defineStandaloneStore(scope: const ScopeKey extends string | StoreScopeTagscope, contract: const C extends StoreContractValuecontract);
const const registration: NormalizedStoreRegistration<
string,
string,
Readonly<Record<string, StoreSpecEntry>>
>
const registration: {
scopeKey: K;
accessor: A;
spec: S;
contract: StoreContractValue;
tag: StoreRegistrationAny["tag"];
logLevel: StoreRegistrationAny["logLevel"];
streamLevel: StoreRegistrationAny["streamLevel"];
maxRows: number;
journal: StoreRegistrationAny["journal"];
}
registration = buildStandaloneRegistration<ScopeKey, C>(scope: ScopeKey, contract: C): NormalizedStoreRegistrationNormalized registration for a standalone store — shared by
defineStandaloneStore
and
the layer attachment in src/Store.ts (single source for the standalone → registration shape).
buildStandaloneRegistration(scope: const ScopeKey extends string | StoreScopeTagscope, contract: const C extends StoreContractValuecontract);
const const layerMemory: Layer.Layer<
| { readonly _tag: ScopeKeyOf<ScopeKey> }
| Storage
| LogRelay,
never,
never
>
const layerMemory: {
build: (memoMap: MemoMap, scope: Scope.Scope) => Effect<Context.Context<{ readonly _tag: ScopeKeyOf<ScopeKey> } | Storage | LogRelay>, never, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
layerMemory = const buildStandaloneMemoryLayer: <
Self,
Id extends string,
C extends StoreContractValue
>(
tag: Context.ServiceClass<
Self,
Id,
StoreHandleFromContract<C>
>,
registration: NormalizedStoreRegistration
) => Layer.Layer<Self | Storage | LogRelay>
buildStandaloneMemoryLayer(const standaloneClass: StandaloneStoreClass<
{
readonly _tag: ScopeKeyOf<ScopeKey>
},
`hyperlink-ts/Store/scope/${ScopeKeyOf<ScopeKey>}`,
ScopeKeyOf<ScopeKey>,
C,
ScopeKey extends StoreScopeTag
? ScopeKey
: undefined
>
standaloneClass, const registration: NormalizedStoreRegistration<
string,
string,
Readonly<Record<string, StoreSpecEntry>>
>
const registration: {
scopeKey: K;
accessor: A;
spec: S;
contract: StoreContractValue;
tag: StoreRegistrationAny["tag"];
logLevel: StoreRegistrationAny["logLevel"];
streamLevel: StoreRegistrationAny["streamLevel"];
maxRows: number;
journal: StoreRegistrationAny["journal"];
}
registration);
const const layer: (
options: StoreLayerOptions
) => Layer.Layer<
| {
readonly _tag: ScopeKeyOf<ScopeKey>
}
| Storage
| LogRelay,
StoreSqliteConnectionError,
Scope.Scope
>
layer = (options: StoreLayerOptions(parameter) options: {
filename: string;
logLevel: StoreLogLevel;
}
options: StoreLayerOptions) =>
const buildStandaloneSqliteLayer: <
Self,
Id extends string,
C extends StoreContractValue
>(
tag: Context.ServiceClass<
Self,
Id,
StoreHandleFromContract<C>
>,
registration: NormalizedStoreRegistration,
filename: string
) => Layer.Layer<
Self | Storage | LogRelay,
StoreSqliteConnectionError,
Scope.Scope
>
buildStandaloneSqliteLayer(const standaloneClass: StandaloneStoreClass<
{
readonly _tag: ScopeKeyOf<ScopeKey>
},
`hyperlink-ts/Store/scope/${ScopeKeyOf<ScopeKey>}`,
ScopeKeyOf<ScopeKey>,
C,
ScopeKey extends StoreScopeTag
? ScopeKey
: undefined
>
standaloneClass, const registration: NormalizedStoreRegistration<
string,
string,
Readonly<Record<string, StoreSpecEntry>>
>
const registration: {
scopeKey: K;
accessor: A;
spec: S;
contract: StoreContractValue;
tag: StoreRegistrationAny["tag"];
logLevel: StoreRegistrationAny["logLevel"];
streamLevel: StoreRegistrationAny["streamLevel"];
maxRows: number;
journal: StoreRegistrationAny["journal"];
}
registration, options: StoreLayerOptions(parameter) options: {
filename: string;
logLevel: StoreLogLevel;
}
options.StoreLayerOptions.filename: stringSQLite database file path (:memory: or a durable path). Required —
use
Service.layerMemory
for an in-memory journal.
filename);
return var Object: ObjectConstructorProvides functionality common to all JavaScript objects.
Object.ObjectConstructor.assign<StandaloneStoreClass<{
readonly _tag: ScopeKeyOf<ScopeKey>;
}, `hyperlink-ts/Store/scope/${ScopeKeyOf<ScopeKey>}`, ScopeKeyOf<ScopeKey>, C, ScopeKey extends StoreScopeTag ? ScopeKey : undefined>, {
layerMemory: Layer.Layer<{
readonly _tag: ScopeKeyOf<ScopeKey>;
} | Storage | LogRelay, never, never>;
layer: (options: StoreLayerOptions) => Layer.Layer<{
readonly _tag: ScopeKeyOf<ScopeKey>;
} | Storage | LogRelay, StoreSqliteConnectionError, Scope.Scope>;
}>(target: StandaloneStoreClass<...>, source: {
layerMemory: Layer.Layer<{
readonly _tag: ScopeKeyOf<ScopeKey>;
} | Storage | LogRelay, never, never>;
layer: (options: StoreLayerOptions) => Layer.Layer<{
readonly _tag: ScopeKeyOf<ScopeKey>;
} | Storage | LogRelay, StoreSqliteConnectionError, Scope.Scope>;
}): Context.ServiceClass<...> & ... 2 more ... & {
layerMemory: Layer.Layer<{
readonly _tag: ScopeKeyOf<ScopeKey>;
} | Storage | LogRelay, never, never>;
layer: (options: StoreLayerOptions) => Layer.Layer<{
readonly _tag: ScopeKeyOf<ScopeKey>;
} | Storage | LogRelay, StoreSqliteConnectionError, Scope.Scope>;
} (+3 overloads)
Copy the values of all of the enumerable own properties from one or more source objects to a
target object. Returns the target object.
assign(const standaloneClass: StandaloneStoreClass<
{
readonly _tag: ScopeKeyOf<ScopeKey>
},
`hyperlink-ts/Store/scope/${ScopeKeyOf<ScopeKey>}`,
ScopeKeyOf<ScopeKey>,
C,
ScopeKey extends StoreScopeTag
? ScopeKey
: undefined
>
standaloneClass, {
layerMemory: Layer.Layer<
| { readonly _tag: ScopeKeyOf<ScopeKey> }
| Storage
| LogRelay,
never,
never
>
(property) layerMemory: {
build: (memoMap: MemoMap, scope: Scope.Scope) => Effect<Context.Context<{ readonly _tag: ScopeKeyOf<ScopeKey> } | Storage | LogRelay>, never, never>;
pipe: { <A>(this: A): A; <A, B = never>(this: A, ab: (_: A) => B): B; <A, B = never, C = never>(this: A, ab: (_: A) => B, bc: (_: B) => C): C; <A, B = never, C = never, D = never>(this: A, ab: (_: A) => B, bc: (_: B) => C, cd: (_: C) => D): D; <…;
}
layerMemory,
layer: (
options: StoreLayerOptions
) => Layer.Layer<
| {
readonly _tag: ScopeKeyOf<ScopeKey>
}
| Storage
| LogRelay,
StoreSqliteConnectionError,
Scope.Scope
>
layer,
});
};