<Self>(id: string): <const Args extends ReadonlyArray<unknown>>(
...args: Args
) => IsSingleStoreInput<Input> extends true
? SingleStoreServiceClass<Self, string, ContractForSingleInput<Input>>
: StoreServiceClass<Self, string, RegsOfStoreInput<Input>>Declare an app store — class extends with layerMemory / layer.
Three input shapes:
- Single store — bare registration:
QueueHyperlink.store(Mail)→yield* MailStore - Tag-keyed multi — array:
[QueueHyperlink.store(Mail), …]→yield* AppStore.at(Mail) - Custom-keyed — object:
{ mail: QueueHyperlink.store(Mail), … }→yield* AppStore.at("mail")
layerMemory uses in-memory refs. layer({ filename }) persists to SQLite (filename required).
constructorslayerMemorylayer
Source src/Store.ts:145011 lines
export const const Service: <Self>(
id: string
) => <const Args extends ReadonlyArray<unknown>>(
...args: Args
) => IsSingleStoreInput<Input> extends true
? SingleStoreServiceClass<
Self,
string,
ContractForSingleInput<Input>
>
: StoreServiceClass<
Self,
string,
RegsOfStoreInput<Input>
>
Declare an app store — class extends with
layerMemory
/
layer
.
Three input shapes:
- Single store — bare registration:
QueueHyperlink.store(Mail) → yield* MailStore
- Tag-keyed multi — array:
[QueueHyperlink.store(Mail), …] → yield* AppStore.at(Mail)
- Custom-keyed — object:
{ mail: QueueHyperlink.store(Mail), … } → yield* AppStore.at("mail")
layerMemory uses in-memory refs. layer({ filename }) persists to SQLite (filename required).
Service = <function (type parameter) Self in <Self>(id: string): <const Args extends ReadonlyArray<unknown>>(...args: Args) => IsSingleStoreInput<Input> extends true ? SingleStoreServiceClass<Self, string, ContractForSingleInput<Input>> : StoreServiceClass<Self, string, RegsOfStoreInput<Input>>Self>(id: stringid: string) => {
const const define: anydefine = import defineStoreTagdefineStoreTag<function (type parameter) Self in <Self>(id: string): <const Args extends ReadonlyArray<unknown>>(...args: Args) => IsSingleStoreInput<Input> extends true ? SingleStoreServiceClass<Self, string, ContractForSingleInput<Input>> : StoreServiceClass<Self, string, RegsOfStoreInput<Input>>Self, typeof id: stringid extends string ? typeof id: stringid : never>(id: stringid);
return <const function (type parameter) Args in <const Args extends ReadonlyArray<unknown>>(...args: Args): IsSingleStoreInput<Input> extends true ? SingleStoreServiceClass<Self, string, ContractForSingleInput<Input>> : StoreServiceClass<Self, string, RegsOfStoreInput<Input>>Args extends interface ReadonlyArray<T>ReadonlyArray<unknown>>(...args: const Args extends ReadonlyArray<unknown>args: function (type parameter) Args in <const Args extends ReadonlyArray<unknown>>(...args: Args): IsSingleStoreInput<Input> extends true ? SingleStoreServiceClass<Self, string, ContractForSingleInput<Input>> : StoreServiceClass<Self, string, RegsOfStoreInput<Input>>Args) => {
type type Input = Args extends readonly [
infer Only
]
? Only
: Args
Input = function (type parameter) Args in <const Args extends ReadonlyArray<unknown>>(...args: Args): IsSingleStoreInput<Input> extends true ? SingleStoreServiceClass<Self, string, ContractForSingleInput<Input>> : StoreServiceClass<Self, string, RegsOfStoreInput<Input>>Args extends readonly [infer function (type parameter) OnlyOnly] ? function (type parameter) OnlyOnly : function (type parameter) Args in <const Args extends ReadonlyArray<unknown>>(...args: Args): IsSingleStoreInput<Input> extends true ? SingleStoreServiceClass<Self, string, ContractForSingleInput<Input>> : StoreServiceClass<Self, string, RegsOfStoreInput<Input>>Args;
const const input: Inputinput = (args: const Args extends ReadonlyArray<unknown>args.ReadonlyArray<unknown>.length: numberGets the length of the array. This is a number one higher than the highest element defined in an array.
length === 1 ? args: const Args extends ReadonlyArray<unknown>args[0]! : args: const Args extends ReadonlyArray<unknown>args) as type Input = Args extends readonly [
infer Only
]
? Only
: Args
Input;
const const storeClass: anystoreClass = const define: anydefine(const input: Inputinput);
return const attachStoreLayers: <
Self,
string,
any
>(
storeClass: any
) => any
Attach layerMemory / layer to a registration-only store class.
attachStoreLayers<function (type parameter) Self in <Self>(id: string): <const Args extends ReadonlyArray<unknown>>(...args: Args) => IsSingleStoreInput<Input> extends true ? SingleStoreServiceClass<Self, string, ContractForSingleInput<Input>> : StoreServiceClass<Self, string, RegsOfStoreInput<Input>>Self, string, typeof const storeClass: anystoreClass>(const storeClass: anystoreClass) as import IsSingleStoreInputIsSingleStoreInput<type Input = Args extends readonly [
infer Only
]
? Only
: Args
Input> extends true
? type SingleStoreServiceClass<
Self = unknown,
Id extends string = string,
C extends StoreContractValue = StoreContractValue
> = any
Single-registration store class with attached
Storage
layers.
SingleStoreServiceClass<function (type parameter) Self in <Self>(id: string): <const Args extends ReadonlyArray<unknown>>(...args: Args) => IsSingleStoreInput<Input> extends true ? SingleStoreServiceClass<Self, string, ContractForSingleInput<Input>> : StoreServiceClass<Self, string, RegsOfStoreInput<Input>>Self, string, import ContractForSingleInputContractForSingleInput<type Input = Args extends readonly [
infer Only
]
? Only
: Args
Input>>
: type StoreServiceClass<
Self = unknown,
Id extends string = string,
Regs = readonly NormalizedStoreRegistration[]
> = any
Aggregate store class with attached
Storage
layers.
StoreServiceClass<function (type parameter) Self in <Self>(id: string): <const Args extends ReadonlyArray<unknown>>(...args: Args) => IsSingleStoreInput<Input> extends true ? SingleStoreServiceClass<Self, string, ContractForSingleInput<Input>> : StoreServiceClass<Self, string, RegsOfStoreInput<Input>>Self, string, import RegsOfStoreInputRegsOfStoreInput<type Input = Args extends readonly [
infer Only
]
? Only
: Args
Input>>;
};
};