@start9labs/start-sdk 0.3.6-alpha9 → 0.3.6-beta.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.
- package/base/lib/Effects.d.ts +7 -2
- package/base/lib/actions/index.d.ts +5 -4
- package/base/lib/actions/index.js.map +1 -1
- package/base/lib/actions/input/builder/inputSpec.d.ts +4 -0
- package/base/lib/actions/input/builder/inputSpec.js +2 -0
- package/base/lib/actions/input/builder/inputSpec.js.map +1 -1
- package/base/lib/actions/input/builder/value.d.ts +82 -84
- package/base/lib/actions/input/builder/value.js +57 -52
- package/base/lib/actions/input/builder/value.js.map +1 -1
- package/base/lib/actions/input/builder/variants.d.ts +25 -10
- package/base/lib/actions/input/builder/variants.js +2 -3
- package/base/lib/actions/input/builder/variants.js.map +1 -1
- package/base/lib/actions/input/inputSpecConstants.d.ts +20 -16
- package/base/lib/actions/input/inputSpecConstants.js +11 -11
- package/base/lib/actions/input/inputSpecConstants.js.map +1 -1
- package/base/lib/actions/input/inputSpecTypes.d.ts +0 -2
- package/base/lib/actions/input/inputSpecTypes.js.map +1 -1
- package/base/lib/actions/setupActions.d.ts +11 -9
- package/base/lib/actions/setupActions.js +1 -1
- package/base/lib/actions/setupActions.js.map +1 -1
- package/base/lib/dependencies/setupDependencies.d.ts +18 -11
- package/base/lib/dependencies/setupDependencies.js +3 -10
- package/base/lib/dependencies/setupDependencies.js.map +1 -1
- package/base/lib/osBindings/AcmeSettings.d.ts +11 -0
- package/base/lib/osBindings/AcmeSettings.js +4 -0
- package/base/lib/osBindings/AcmeSettings.js.map +1 -0
- package/base/lib/osBindings/ActionMetadata.d.ts +24 -0
- package/base/lib/osBindings/ActionResultMember.d.ts +34 -0
- package/base/lib/osBindings/ActionResultMember.js +4 -0
- package/base/lib/osBindings/ActionResultMember.js.map +1 -0
- package/base/lib/osBindings/ActionResultV1.d.ts +13 -12
- package/base/lib/osBindings/ActionResultV1.js +0 -1
- package/base/lib/osBindings/ActionResultV1.js.map +1 -1
- package/base/lib/osBindings/ActionResultValue.d.ts +26 -0
- package/base/lib/osBindings/ActionResultValue.js +3 -0
- package/base/lib/osBindings/ActionResultValue.js.map +1 -0
- package/base/lib/osBindings/AddCategoryParams.d.ts +6 -0
- package/base/lib/osBindings/AddCategoryParams.js +4 -0
- package/base/lib/osBindings/AddCategoryParams.js.map +1 -0
- package/base/lib/osBindings/BindInfo.d.ts +2 -2
- package/base/lib/osBindings/BuildArg.d.ts +3 -0
- package/base/lib/osBindings/BuildArg.js +4 -0
- package/base/lib/osBindings/BuildArg.js.map +1 -0
- package/base/lib/osBindings/CliSetIconParams.d.ts +3 -0
- package/base/lib/osBindings/CliSetIconParams.js +4 -0
- package/base/lib/osBindings/CliSetIconParams.js.map +1 -0
- package/base/lib/osBindings/DeviceFilter.d.ts +5 -0
- package/base/lib/osBindings/DeviceFilter.js +4 -0
- package/base/lib/osBindings/DeviceFilter.js.map +1 -0
- package/base/lib/osBindings/EditSignerParams.d.ts +11 -0
- package/base/lib/osBindings/EditSignerParams.js +3 -0
- package/base/lib/osBindings/EditSignerParams.js.map +1 -0
- package/base/lib/osBindings/GetStatusParams.d.ts +6 -0
- package/base/lib/osBindings/GetStatusParams.js +3 -0
- package/base/lib/osBindings/GetStatusParams.js.map +1 -0
- package/base/lib/osBindings/GitHash.d.ts +1 -0
- package/base/lib/osBindings/GitHash.js +4 -0
- package/base/lib/osBindings/GitHash.js.map +1 -0
- package/base/lib/osBindings/HardwareRequirements.d.ts +2 -4
- package/base/lib/osBindings/HardwareRequirements.js +0 -1
- package/base/lib/osBindings/HardwareRequirements.js.map +1 -1
- package/base/lib/osBindings/ImageSource.d.ts +6 -2
- package/base/lib/osBindings/ImageSource.js +0 -1
- package/base/lib/osBindings/ImageSource.js.map +1 -1
- package/base/lib/osBindings/IpInfo.d.ts +3 -4
- package/base/lib/osBindings/ListPackageSignersParams.d.ts +4 -0
- package/base/lib/osBindings/ListPackageSignersParams.js +3 -0
- package/base/lib/osBindings/ListPackageSignersParams.js.map +1 -0
- package/base/lib/osBindings/LshwDevice.d.ts +7 -0
- package/base/lib/osBindings/LshwDevice.js +3 -0
- package/base/lib/osBindings/LshwDevice.js.map +1 -0
- package/base/lib/osBindings/LshwDisplay.d.ts +3 -0
- package/base/lib/osBindings/LshwDisplay.js +4 -0
- package/base/lib/osBindings/LshwDisplay.js.map +1 -0
- package/base/lib/osBindings/LshwProcessor.d.ts +3 -0
- package/base/lib/osBindings/LshwProcessor.js +4 -0
- package/base/lib/osBindings/LshwProcessor.js.map +1 -0
- package/base/lib/osBindings/Manifest.d.ts +2 -1
- package/base/lib/osBindings/NetInfo.d.ts +5 -0
- package/base/lib/osBindings/NetInfo.js +4 -0
- package/base/lib/osBindings/NetInfo.js.map +1 -0
- package/base/lib/osBindings/NetworkInterfaceInfo.d.ts +5 -0
- package/base/lib/osBindings/NetworkInterfaceInfo.js +3 -0
- package/base/lib/osBindings/NetworkInterfaceInfo.js.map +1 -0
- package/base/lib/osBindings/PackageSignerParams.d.ts +6 -0
- package/base/lib/osBindings/PackageSignerParams.js +3 -0
- package/base/lib/osBindings/PackageSignerParams.js.map +1 -0
- package/base/lib/osBindings/PackageVersionInfo.d.ts +2 -1
- package/base/lib/osBindings/RemoveCategoryParams.d.ts +3 -0
- package/base/lib/osBindings/RemoveCategoryParams.js +4 -0
- package/base/lib/osBindings/RemoveCategoryParams.js.map +1 -0
- package/base/lib/osBindings/ServerInfo.d.ts +10 -4
- package/base/lib/osBindings/SetIconParams.d.ts +4 -0
- package/base/lib/osBindings/SetIconParams.js +3 -0
- package/base/lib/osBindings/SetIconParams.js.map +1 -0
- package/base/lib/osBindings/SetNameParams.d.ts +3 -0
- package/base/lib/osBindings/SetNameParams.js +4 -0
- package/base/lib/osBindings/SetNameParams.js.map +1 -0
- package/base/lib/osBindings/SetPublicParams.d.ts +4 -0
- package/base/lib/osBindings/SetPublicParams.js +4 -0
- package/base/lib/osBindings/SetPublicParams.js.map +1 -0
- package/base/lib/osBindings/SetupResult.d.ts +1 -0
- package/base/lib/osBindings/UnsetPublicParams.d.ts +3 -0
- package/base/lib/osBindings/UnsetPublicParams.js +4 -0
- package/base/lib/osBindings/UnsetPublicParams.js.map +1 -0
- package/base/lib/osBindings/index.d.ts +22 -1
- package/base/lib/types/ManifestTypes.d.ts +14 -8
- package/base/lib/types.d.ts +3 -2
- package/base/lib/types.js.map +1 -1
- package/package/lib/StartSdk.d.ts +254 -198
- package/package/lib/StartSdk.js +143 -97
- package/package/lib/StartSdk.js.map +1 -1
- package/package/lib/backup/Backups.d.ts +4 -26
- package/package/lib/backup/Backups.js +0 -22
- package/package/lib/backup/Backups.js.map +1 -1
- package/package/lib/backup/setupBackups.d.ts +2 -2
- package/package/lib/health/checkFns/checkPortListening.js +0 -1
- package/package/lib/health/checkFns/checkPortListening.js.map +1 -1
- package/package/lib/index.d.ts +1 -1
- package/package/lib/index.js +2 -1
- package/package/lib/index.js.map +1 -1
- package/package/lib/inits/setupInit.d.ts +1 -1
- package/package/lib/inits/setupInit.js.map +1 -1
- package/package/lib/inits/setupInstall.d.ts +4 -4
- package/package/lib/inits/setupUninstall.d.ts +4 -4
- package/package/lib/mainFn/CommandController.d.ts +3 -3
- package/package/lib/mainFn/CommandController.js +6 -0
- package/package/lib/mainFn/CommandController.js.map +1 -1
- package/package/lib/mainFn/Daemon.d.ts +3 -3
- package/package/lib/mainFn/Daemons.d.ts +32 -6
- package/package/lib/mainFn/Daemons.js.map +1 -1
- package/package/lib/mainFn/Mounts.d.ts +29 -5
- package/package/lib/mainFn/Mounts.js +27 -3
- package/package/lib/mainFn/Mounts.js.map +1 -1
- package/package/lib/mainFn/index.d.ts +1 -1
- package/package/lib/manifest/setupManifest.d.ts +7 -3
- package/package/lib/manifest/setupManifest.js +11 -7
- package/package/lib/manifest/setupManifest.js.map +1 -1
- package/package/lib/store/setupExposeStore.js.map +1 -1
- package/package/lib/test/inputSpecBuilder.test.js +40 -31
- package/package/lib/test/inputSpecBuilder.test.js.map +1 -1
- package/package/lib/test/output.d.ts +72 -30
- package/package/lib/test/output.js +31 -41
- package/package/lib/test/output.js.map +1 -1
- package/package/lib/test/output.sdk.d.ts +307 -107
- package/package/lib/test/output.sdk.js +10 -10
- package/package/lib/test/output.sdk.js.map +1 -1
- package/package/lib/test/output.test.js +1 -1
- package/package/lib/test/output.test.js.map +1 -1
- package/package/lib/trigger/defaultTrigger.js.map +1 -1
- package/package/lib/util/SubContainer.d.ts +6 -3
- package/package/lib/util/SubContainer.js +7 -14
- package/package/lib/util/SubContainer.js.map +1 -1
- package/package/lib/util/fileHelper.d.ts +32 -14
- package/package/lib/util/fileHelper.js +53 -33
- package/package/lib/util/fileHelper.js.map +1 -1
- package/package/scripts/oldSpecToBuilder.js +11 -27
- package/package/scripts/oldSpecToBuilder.js.map +1 -1
- package/package.json +4 -4
package/base/lib/Effects.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionId, ActionInput, ActionMetadata, SetMainStatus, DependencyRequirement, CheckDependenciesResult, SetHealth, BindParams, HostId,
|
|
1
|
+
import { ActionId, ActionInput, ActionMetadata, SetMainStatus, DependencyRequirement, CheckDependenciesResult, SetHealth, BindParams, HostId, NetInfo, Host, ExportServiceInterfaceParams, ServiceInterface, RequestActionParams, MainStatus } from "./osBindings";
|
|
2
2
|
import { StorePath } from "./util/PathBuilder";
|
|
3
3
|
import { PackageId, Dependencies, ServiceInterfaceId, SmtpValue, ActionResult } from "./types";
|
|
4
4
|
import { UrlString } from "./util/getServiceInterface";
|
|
@@ -40,6 +40,11 @@ export type Effects = {
|
|
|
40
40
|
restart(): Promise<null>;
|
|
41
41
|
/** stop this service's main function */
|
|
42
42
|
shutdown(): Promise<null>;
|
|
43
|
+
/** ask the host os what the service's current status is */
|
|
44
|
+
getStatus(options: {
|
|
45
|
+
packageId?: PackageId;
|
|
46
|
+
callback?: () => void;
|
|
47
|
+
}): Promise<MainStatus>;
|
|
43
48
|
/** indicate to the host os what runstate the service is in */
|
|
44
49
|
setMainStatus(options: SetMainStatus): Promise<null>;
|
|
45
50
|
/** Set the dependencies of what the service needs, usually run during the inputSpec action as a best practice */
|
|
@@ -88,7 +93,7 @@ export type Effects = {
|
|
|
88
93
|
packageId?: PackageId;
|
|
89
94
|
hostId: HostId;
|
|
90
95
|
internalPort: number;
|
|
91
|
-
}): Promise<
|
|
96
|
+
}): Promise<NetInfo>;
|
|
92
97
|
/** Removes all network bindings, called in the setupInputSpec */
|
|
93
98
|
clearBindings(options: {
|
|
94
99
|
except: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as T from "../types";
|
|
2
2
|
import * as IST from "../actions/input/inputSpecTypes";
|
|
3
3
|
import { Action } from "./setupActions";
|
|
4
|
+
import { ExtractInputSpecType } from "./input/builder/inputSpec";
|
|
4
5
|
export type RunActionInput<Input> = Input | ((prev?: {
|
|
5
6
|
spec: IST.InputSpec;
|
|
6
7
|
value: Input | null;
|
|
@@ -10,16 +11,16 @@ export declare const runAction: <Input extends Record<string, unknown>>(options:
|
|
|
10
11
|
actionId: T.ActionId;
|
|
11
12
|
input?: RunActionInput<Input> | undefined;
|
|
12
13
|
}) => Promise<T.ActionResult | null>;
|
|
13
|
-
type GetActionInputType<A extends Action<T.ActionId, any, any
|
|
14
|
+
type GetActionInputType<A extends Action<T.ActionId, any, any>> = A extends Action<T.ActionId, any, infer I> ? ExtractInputSpecType<I> : never;
|
|
14
15
|
type ActionRequestBase = {
|
|
15
16
|
reason?: string;
|
|
16
17
|
replayId?: string;
|
|
17
18
|
};
|
|
18
|
-
type ActionRequestInput<T extends Action<T.ActionId, any, any
|
|
19
|
+
type ActionRequestInput<T extends Action<T.ActionId, any, any>> = {
|
|
19
20
|
kind: "partial";
|
|
20
21
|
value: Partial<GetActionInputType<T>>;
|
|
21
22
|
};
|
|
22
|
-
export type ActionRequestOptions<T extends Action<T.ActionId, any, any
|
|
23
|
+
export type ActionRequestOptions<T extends Action<T.ActionId, any, any>> = ActionRequestBase & ({
|
|
23
24
|
when?: Exclude<T.ActionRequestTrigger, {
|
|
24
25
|
condition: "input-not-matches";
|
|
25
26
|
}>;
|
|
@@ -30,7 +31,7 @@ export type ActionRequestOptions<T extends Action<T.ActionId, any, any, Record<s
|
|
|
30
31
|
};
|
|
31
32
|
input: ActionRequestInput<T>;
|
|
32
33
|
});
|
|
33
|
-
export declare const requestAction: <T extends Action<string, any, any
|
|
34
|
+
export declare const requestAction: <T extends Action<string, any, any>>(options: {
|
|
34
35
|
effects: T.Effects;
|
|
35
36
|
packageId: string;
|
|
36
37
|
action: T;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../base/lib/actions/index.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../base/lib/actions/index.ts"],"names":[],"mappings":";;;AASO,MAAM,SAAS,GAAG,KAAK,EAE5B,OAKD,EAAE,EAAE;IACH,IAAI,OAAO,CAAC,KAAK,EAAE;QACjB,IAAI,OAAO,CAAC,KAAK,YAAY,QAAQ,EAAE;YACrC,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;gBACjD,gCAAgC;gBAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;aAC3B,CAAC,CAAA;YACF,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CACzB,IAAI;gBACF,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,IAAqB,EAAE,KAAK,EAAE,IAAI,CAAC,KAAc,EAAE;gBAClE,CAAC,CAAC,SAAS,CACd,CAAA;YACD,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC;gBAChC,gCAAgC;gBAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,KAAK;aACN,CAAC,CAAA;SACH;aAAM;YACL,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC;gBAChC,gCAAgC;gBAChC,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,KAAK,EAAE,OAAO,CAAC,KAAK;aACrB,CAAC,CAAA;SACH;KACF;SAAM;QACL,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC;YAChC,kCAAkC;YAClC,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B,CAAC,CAAA;KACH;AACH,CAAC,CAAA;AArCY,QAAA,SAAS,aAqCrB;AA4BD,MAAM,SAAS,GAAoB,EAIlC,CAAA;AAEM,MAAM,aAAa,GAAG,CAAyC,OAMrE,EAAE,EAAE;IACH,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,IAAI,EAAE,CAAA;IACrC,MAAM,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC,EAAE,CAAA;IAClC,MAAM,GAAG,GAAG;QACV,GAAG,OAAO;QACV,QAAQ;QACR,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,MAAM,EAAE,SAAS;QACjB,QAAQ,EAAE,OAAO,CAAC,QAAQ;QAC1B,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,GAAG,OAAO,CAAC,SAAS,IAAI,QAAQ,EAAE;KACjE,CAAA;IACD,OAAO,GAAG,CAAC,MAAM,CAAA;IACjB,OAAO,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;AAC5C,CAAC,CAAA;AAnBY,QAAA,aAAa,iBAmBzB"}
|
|
@@ -2,11 +2,13 @@ import { ValueSpec } from "../inputSpecTypes";
|
|
|
2
2
|
import { Value } from "./value";
|
|
3
3
|
import { Effects } from "../../../Effects";
|
|
4
4
|
import { Parser } from "ts-matches";
|
|
5
|
+
import { DeepPartial } from "../../../types";
|
|
5
6
|
export type LazyBuildOptions<Store> = {
|
|
6
7
|
effects: Effects;
|
|
7
8
|
};
|
|
8
9
|
export type LazyBuild<Store, ExpectedOut> = (options: LazyBuildOptions<Store>) => Promise<ExpectedOut> | ExpectedOut;
|
|
9
10
|
export type ExtractInputSpecType<A extends Record<string, any> | InputSpec<Record<string, any>, any> | InputSpec<Record<string, any>, never>> = A extends InputSpec<infer B, any> | InputSpec<infer B, never> ? B : A;
|
|
11
|
+
export type ExtractPartialInputSpecType<A extends Record<string, any> | InputSpec<Record<string, any>, any> | InputSpec<Record<string, any>, never>> = A extends InputSpec<infer B, any> | InputSpec<infer B, never> ? DeepPartial<B> : DeepPartial<A>;
|
|
10
12
|
export type InputSpecOf<A extends Record<string, any>, Store = never> = {
|
|
11
13
|
[K in keyof A]: Value<A[K], Store>;
|
|
12
14
|
};
|
|
@@ -71,6 +73,8 @@ export declare class InputSpec<Type extends Record<string, any>, Store = never>
|
|
|
71
73
|
private readonly spec;
|
|
72
74
|
validator: Parser<unknown, Type>;
|
|
73
75
|
private constructor();
|
|
76
|
+
_TYPE: Type;
|
|
77
|
+
_PARTIAL: DeepPartial<Type>;
|
|
74
78
|
build(options: LazyBuildOptions<Store>): Promise<{ [K in keyof Type]: ValueSpec; }>;
|
|
75
79
|
static of<Spec extends Record<string, Value<any, Store> | Value<any, never>>, Store = never>(spec: Spec): InputSpec<{ [K in keyof Spec]: Spec[K] extends Value<infer T, Store> | Value<infer T, never> ? T : never; }, Store>;
|
|
76
80
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inputSpec.js","sourceRoot":"","sources":["../../../../../../base/lib/actions/input/builder/inputSpec.ts"],"names":[],"mappings":";;;AAIA,2CAA2C;
|
|
1
|
+
{"version":3,"file":"inputSpec.js","sourceRoot":"","sources":["../../../../../../base/lib/actions/input/builder/inputSpec.ts"],"names":[],"mappings":";;;AAIA,2CAA2C;AA6B3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAa,SAAS;IACpB,YACmB,IAEhB,EACM,SAAgC;QAHtB,SAAI,GAAJ,IAAI,CAEpB;QACM,cAAS,GAAT,SAAS,CAAuB;QAEzC,UAAK,GAAS,IAAmB,CAAA;QACjC,aAAQ,GAAsB,IAAgC,CAAA;IAF3D,CAAC;IAGJ,KAAK,CAAC,KAAK,CAAC,OAAgC;QAC1C,MAAM,MAAM,GAAG,EAEd,CAAA;QACD,KAAK,MAAM,CAAC,IAAI,IAAI,CAAC,IAAI,EAAE;YACzB,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAc,CAAC,CAAA;SACrD;QACD,OAAO,MAAM,CAAA;IACf,CAAC;IAED,MAAM,CAAC,EAAE,CAGP,IAAU;QACV,MAAM,YAAY,GAAG,EAEpB,CAAA;QACD,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,YAAY,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,SAAS,CAAA;SACxC;QACD,MAAM,SAAS,GAAG,IAAA,mBAAM,EAAC,YAAY,CAAC,CAAA;QACtC,OAAO,IAAI,SAAS,CASlB,IAAI,EAAE,SAAgB,CAAC,CAAA;IAC3B,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,SAAS;QACP,OAAO,IAAwC,CAAA;IACjD,CAAC;CACF;AA3DD,8BA2DC"}
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import { InputSpec, LazyBuild } from "./inputSpec";
|
|
2
2
|
import { List } from "./list";
|
|
3
3
|
import { Variants } from "./variants";
|
|
4
|
-
import {
|
|
4
|
+
import { Pattern, RandomString, ValueSpec, ValueSpecDatetime, ValueSpecText } from "../inputSpecTypes";
|
|
5
5
|
import { DefaultString } from "../inputSpecTypes";
|
|
6
6
|
import { Parser } from "ts-matches";
|
|
7
|
-
|
|
8
|
-
default: A | null;
|
|
9
|
-
};
|
|
10
|
-
type AsRequired<Type, MaybeRequiredType> = MaybeRequiredType extends {
|
|
11
|
-
default: unknown;
|
|
12
|
-
} | never ? Type : Type | null | undefined;
|
|
7
|
+
type AsRequired<T, Required extends boolean> = Required extends true ? T : T | null;
|
|
13
8
|
export declare class Value<Type, Store> {
|
|
14
9
|
build: LazyBuild<Store, ValueSpec>;
|
|
15
10
|
validator: Parser<unknown, Type>;
|
|
@@ -33,19 +28,19 @@ export declare class Value<Type, Store> {
|
|
|
33
28
|
default: boolean;
|
|
34
29
|
disabled?: false | string;
|
|
35
30
|
}>): Value<boolean, Store>;
|
|
36
|
-
static text<Required extends
|
|
31
|
+
static text<Required extends boolean>(a: {
|
|
37
32
|
name: string;
|
|
38
33
|
description?: string | null;
|
|
39
34
|
/** Presents a warning prompt before permitting the value to change. */
|
|
40
35
|
warning?: string | null;
|
|
41
36
|
/**
|
|
42
|
-
*
|
|
43
|
-
* @type {
|
|
44
|
-
* @example
|
|
45
|
-
* @example
|
|
46
|
-
* @example
|
|
47
|
-
* @example required: { default: { charset: 'abcdefg', len: 16 } }
|
|
37
|
+
* provide a default value.
|
|
38
|
+
* @type { string | RandomString | null }
|
|
39
|
+
* @example default: null
|
|
40
|
+
* @example default: 'World'
|
|
41
|
+
* @example default: { charset: 'abcdefg', len: 16 }
|
|
48
42
|
*/
|
|
43
|
+
default: string | RandomString | null;
|
|
49
44
|
required: Required;
|
|
50
45
|
/**
|
|
51
46
|
* @description Mask (aka camouflage) text input with dots: ● ● ●
|
|
@@ -88,7 +83,8 @@ export declare class Value<Type, Store> {
|
|
|
88
83
|
name: string;
|
|
89
84
|
description?: string | null;
|
|
90
85
|
warning?: string | null;
|
|
91
|
-
|
|
86
|
+
default: DefaultString | null;
|
|
87
|
+
required: boolean;
|
|
92
88
|
masked?: boolean;
|
|
93
89
|
placeholder?: string | null;
|
|
94
90
|
minLength?: number | null;
|
|
@@ -97,16 +93,14 @@ export declare class Value<Type, Store> {
|
|
|
97
93
|
inputmode?: ValueSpecText["inputmode"];
|
|
98
94
|
disabled?: string | false;
|
|
99
95
|
generate?: null | RandomString;
|
|
100
|
-
}>): Value<string | null
|
|
101
|
-
static textarea(a: {
|
|
96
|
+
}>): Value<string | null, Store>;
|
|
97
|
+
static textarea<Required extends boolean>(a: {
|
|
102
98
|
name: string;
|
|
103
99
|
description?: string | null;
|
|
104
100
|
/** Presents a warning prompt before permitting the value to change. */
|
|
105
101
|
warning?: string | null;
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
*/
|
|
109
|
-
required: boolean;
|
|
102
|
+
default: string | null;
|
|
103
|
+
required: Required;
|
|
110
104
|
minLength?: number | null;
|
|
111
105
|
maxLength?: number | null;
|
|
112
106
|
placeholder?: string | null;
|
|
@@ -115,29 +109,30 @@ export declare class Value<Type, Store> {
|
|
|
115
109
|
* @default false
|
|
116
110
|
*/
|
|
117
111
|
immutable?: boolean;
|
|
118
|
-
}): Value<string, never>;
|
|
112
|
+
}): Value<AsRequired<string, Required>, never>;
|
|
119
113
|
static dynamicTextarea<Store = never>(getA: LazyBuild<Store, {
|
|
120
114
|
name: string;
|
|
121
115
|
description?: string | null;
|
|
122
116
|
warning?: string | null;
|
|
117
|
+
default: string | null;
|
|
123
118
|
required: boolean;
|
|
124
119
|
minLength?: number | null;
|
|
125
120
|
maxLength?: number | null;
|
|
126
121
|
placeholder?: string | null;
|
|
127
122
|
disabled?: false | string;
|
|
128
|
-
}>): Value<string, Store>;
|
|
129
|
-
static number<Required extends
|
|
123
|
+
}>): Value<string | null, Store>;
|
|
124
|
+
static number<Required extends boolean>(a: {
|
|
130
125
|
name: string;
|
|
131
126
|
description?: string | null;
|
|
132
127
|
/** Presents a warning prompt before permitting the value to change. */
|
|
133
128
|
warning?: string | null;
|
|
134
129
|
/**
|
|
135
|
-
* @description
|
|
136
|
-
* @type {
|
|
137
|
-
* @example
|
|
138
|
-
* @example
|
|
139
|
-
* @example required: { default: 7 }
|
|
130
|
+
* @description optionally provide a default value.
|
|
131
|
+
* @type { default: number | null }
|
|
132
|
+
* @example default: null
|
|
133
|
+
* @example default: 7
|
|
140
134
|
*/
|
|
135
|
+
default: number | null;
|
|
141
136
|
required: Required;
|
|
142
137
|
min?: number | null;
|
|
143
138
|
max?: number | null;
|
|
@@ -165,7 +160,8 @@ export declare class Value<Type, Store> {
|
|
|
165
160
|
name: string;
|
|
166
161
|
description?: string | null;
|
|
167
162
|
warning?: string | null;
|
|
168
|
-
|
|
163
|
+
default: number | null;
|
|
164
|
+
required: boolean;
|
|
169
165
|
min?: number | null;
|
|
170
166
|
max?: number | null;
|
|
171
167
|
step?: number | null;
|
|
@@ -173,19 +169,19 @@ export declare class Value<Type, Store> {
|
|
|
173
169
|
units?: string | null;
|
|
174
170
|
placeholder?: string | null;
|
|
175
171
|
disabled?: false | string;
|
|
176
|
-
}>): Value<number | null
|
|
177
|
-
static color<Required extends
|
|
172
|
+
}>): Value<number | null, Store>;
|
|
173
|
+
static color<Required extends boolean>(a: {
|
|
178
174
|
name: string;
|
|
179
175
|
description?: string | null;
|
|
180
176
|
/** Presents a warning prompt before permitting the value to change. */
|
|
181
177
|
warning?: string | null;
|
|
182
178
|
/**
|
|
183
|
-
* @description
|
|
184
|
-
* @type {
|
|
185
|
-
* @example
|
|
186
|
-
* @example
|
|
187
|
-
* @example required: { default: 'ffffff' }
|
|
179
|
+
* @description optionally provide a default value.
|
|
180
|
+
* @type { default: string | null }
|
|
181
|
+
* @example default: null
|
|
182
|
+
* @example default: 'ffffff'
|
|
188
183
|
*/
|
|
184
|
+
default: string | null;
|
|
189
185
|
required: Required;
|
|
190
186
|
/**
|
|
191
187
|
* @description Once set, the value can never be changed.
|
|
@@ -197,21 +193,22 @@ export declare class Value<Type, Store> {
|
|
|
197
193
|
name: string;
|
|
198
194
|
description?: string | null;
|
|
199
195
|
warning?: string | null;
|
|
200
|
-
|
|
196
|
+
default: string | null;
|
|
197
|
+
required: boolean;
|
|
201
198
|
disabled?: false | string;
|
|
202
|
-
}>): Value<string | null
|
|
203
|
-
static datetime<Required extends
|
|
199
|
+
}>): Value<string | null, Store>;
|
|
200
|
+
static datetime<Required extends boolean>(a: {
|
|
204
201
|
name: string;
|
|
205
202
|
description?: string | null;
|
|
206
203
|
/** Presents a warning prompt before permitting the value to change. */
|
|
207
204
|
warning?: string | null;
|
|
208
205
|
/**
|
|
209
|
-
* @description
|
|
210
|
-
* @type {
|
|
211
|
-
* @example
|
|
212
|
-
* @example
|
|
213
|
-
* @example required: { default: '1985-12-16 18:00:00.000' }
|
|
206
|
+
* @description optionally provide a default value.
|
|
207
|
+
* @type { default: string | null }
|
|
208
|
+
* @example default: null
|
|
209
|
+
* @example default: '1985-12-16 18:00:00.000'
|
|
214
210
|
*/
|
|
211
|
+
default: string | null;
|
|
215
212
|
required: Required;
|
|
216
213
|
/**
|
|
217
214
|
* @description Informs the browser how to behave and which date/time component to display.
|
|
@@ -230,25 +227,25 @@ export declare class Value<Type, Store> {
|
|
|
230
227
|
name: string;
|
|
231
228
|
description?: string | null;
|
|
232
229
|
warning?: string | null;
|
|
233
|
-
|
|
230
|
+
default: string | null;
|
|
231
|
+
required: boolean;
|
|
234
232
|
inputmode?: ValueSpecDatetime["inputmode"];
|
|
235
233
|
min?: string | null;
|
|
236
234
|
max?: string | null;
|
|
237
235
|
disabled?: false | string;
|
|
238
|
-
}>): Value<string | null
|
|
239
|
-
static select<
|
|
236
|
+
}>): Value<string | null, Store>;
|
|
237
|
+
static select<Values extends Record<string, string>>(a: {
|
|
240
238
|
name: string;
|
|
241
239
|
description?: string | null;
|
|
242
240
|
/** Presents a warning prompt before permitting the value to change. */
|
|
243
241
|
warning?: string | null;
|
|
244
242
|
/**
|
|
245
243
|
* @description Determines if the field is required. If so, optionally provide a default value from the list of values.
|
|
246
|
-
* @type {
|
|
247
|
-
* @example
|
|
248
|
-
* @example
|
|
249
|
-
* @example required: { default: 'radio1' }
|
|
244
|
+
* @type { (keyof Values & string) | null }
|
|
245
|
+
* @example default: null
|
|
246
|
+
* @example default: 'radio1'
|
|
250
247
|
*/
|
|
251
|
-
|
|
248
|
+
default: keyof Values & string;
|
|
252
249
|
/**
|
|
253
250
|
* @description A mapping of unique radio options to their human readable display format.
|
|
254
251
|
* @example
|
|
@@ -266,15 +263,15 @@ export declare class Value<Type, Store> {
|
|
|
266
263
|
* @default false
|
|
267
264
|
*/
|
|
268
265
|
immutable?: boolean;
|
|
269
|
-
}): Value<
|
|
266
|
+
}): Value<keyof Values & string, never>;
|
|
270
267
|
static dynamicSelect<Store = never>(getA: LazyBuild<Store, {
|
|
271
268
|
name: string;
|
|
272
269
|
description?: string | null;
|
|
273
270
|
warning?: string | null;
|
|
274
|
-
|
|
271
|
+
default: string;
|
|
275
272
|
values: Record<string, string>;
|
|
276
273
|
disabled?: false | string | string[];
|
|
277
|
-
}>): Value<string
|
|
274
|
+
}>): Value<string, Store>;
|
|
278
275
|
static multiselect<Values extends Record<string, string>>(a: {
|
|
279
276
|
name: string;
|
|
280
277
|
description?: string | null;
|
|
@@ -283,7 +280,7 @@ export declare class Value<Type, Store> {
|
|
|
283
280
|
/**
|
|
284
281
|
* @description A simple list of which options should be checked by default.
|
|
285
282
|
*/
|
|
286
|
-
default: string[];
|
|
283
|
+
default: (keyof Values & string)[];
|
|
287
284
|
/**
|
|
288
285
|
* @description A mapping of checkbox options to their human readable display format.
|
|
289
286
|
* @example
|
|
@@ -318,53 +315,54 @@ export declare class Value<Type, Store> {
|
|
|
318
315
|
name: string;
|
|
319
316
|
description?: string | null;
|
|
320
317
|
}, spec: InputSpec<Type, Store>): Value<Type, Store>;
|
|
321
|
-
static
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
}
|
|
327
|
-
static dynamicFile<Required extends boolean, Store>(a: LazyBuild<Store, {
|
|
328
|
-
name: string;
|
|
329
|
-
description?: string | null;
|
|
330
|
-
warning?: string | null;
|
|
331
|
-
extensions: string[];
|
|
332
|
-
required: Required;
|
|
333
|
-
}>): Value<string | null | undefined, Store>;
|
|
334
|
-
static union<Required extends RequiredDefault<string>, Type, Store>(a: {
|
|
318
|
+
static union<VariantValues extends {
|
|
319
|
+
[K in string]: {
|
|
320
|
+
name: string;
|
|
321
|
+
spec: InputSpec<any, Store> | InputSpec<any, never>;
|
|
322
|
+
};
|
|
323
|
+
}, Store>(a: {
|
|
335
324
|
name: string;
|
|
336
325
|
description?: string | null;
|
|
337
326
|
/** Presents a warning prompt before permitting the value to change. */
|
|
338
327
|
warning?: string | null;
|
|
339
328
|
/**
|
|
340
|
-
* @description
|
|
341
|
-
* @type {
|
|
342
|
-
* @example
|
|
343
|
-
* @example required: { default: null }
|
|
344
|
-
* @example required: { default: 'variant1' }
|
|
329
|
+
* @description Provide a default value from the list of variants.
|
|
330
|
+
* @type { string }
|
|
331
|
+
* @example default: 'variant1'
|
|
345
332
|
*/
|
|
346
|
-
|
|
333
|
+
default: keyof VariantValues & string;
|
|
347
334
|
/**
|
|
348
335
|
* @description Once set, the value can never be changed.
|
|
349
336
|
* @default false
|
|
350
337
|
*/
|
|
351
338
|
immutable?: boolean;
|
|
352
|
-
}, aVariants: Variants<
|
|
353
|
-
static filteredUnion<
|
|
339
|
+
}, aVariants: Variants<VariantValues, Store>): Value<import("./variants").UnionRes<Store, VariantValues, keyof VariantValues & string>, Store>;
|
|
340
|
+
static filteredUnion<VariantValues extends {
|
|
341
|
+
[K in string]: {
|
|
342
|
+
name: string;
|
|
343
|
+
spec: InputSpec<any, Store> | InputSpec<any, never>;
|
|
344
|
+
};
|
|
345
|
+
}, Store>(getDisabledFn: LazyBuild<Store, string[] | false | string>, a: {
|
|
354
346
|
name: string;
|
|
355
347
|
description?: string | null;
|
|
356
348
|
warning?: string | null;
|
|
357
|
-
|
|
358
|
-
}, aVariants: Variants<
|
|
359
|
-
static dynamicUnion<
|
|
349
|
+
default: keyof VariantValues & string;
|
|
350
|
+
}, aVariants: Variants<VariantValues, Store> | Variants<VariantValues, never>): Value<import("./variants").UnionRes<Store, VariantValues, keyof VariantValues & string> | import("./variants").UnionRes<never, VariantValues, keyof VariantValues & string>, Store>;
|
|
351
|
+
static dynamicUnion<VariantValues extends {
|
|
352
|
+
[K in string]: {
|
|
353
|
+
name: string;
|
|
354
|
+
spec: InputSpec<any, Store> | InputSpec<any, never>;
|
|
355
|
+
};
|
|
356
|
+
}, Store>(getA: LazyBuild<Store, {
|
|
360
357
|
name: string;
|
|
361
358
|
description?: string | null;
|
|
362
359
|
warning?: string | null;
|
|
363
|
-
|
|
360
|
+
default: keyof VariantValues & string;
|
|
364
361
|
disabled: string[] | false | string;
|
|
365
|
-
}>, aVariants: Variants<
|
|
362
|
+
}>, aVariants: Variants<VariantValues, Store> | Variants<VariantValues, never>): Value<import("./variants").UnionRes<Store, VariantValues, keyof VariantValues & string> | import("./variants").UnionRes<never, VariantValues, keyof VariantValues & string>, Store>;
|
|
366
363
|
static list<Type, Store>(a: List<Type, Store>): Value<Type, Store>;
|
|
367
364
|
static hidden<T>(parser?: Parser<unknown, T>): Value<T, never>;
|
|
365
|
+
map<U>(fn: (value: Type) => U): Value<U, Store>;
|
|
368
366
|
/**
|
|
369
367
|
* Use this during the times that the input needs a more specific type.
|
|
370
368
|
* Used in types that the value/ variant/ list/ inputSpec is constructed somewhere else.
|