@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.
Files changed (159) hide show
  1. package/base/lib/Effects.d.ts +7 -2
  2. package/base/lib/actions/index.d.ts +5 -4
  3. package/base/lib/actions/index.js.map +1 -1
  4. package/base/lib/actions/input/builder/inputSpec.d.ts +4 -0
  5. package/base/lib/actions/input/builder/inputSpec.js +2 -0
  6. package/base/lib/actions/input/builder/inputSpec.js.map +1 -1
  7. package/base/lib/actions/input/builder/value.d.ts +82 -84
  8. package/base/lib/actions/input/builder/value.js +57 -52
  9. package/base/lib/actions/input/builder/value.js.map +1 -1
  10. package/base/lib/actions/input/builder/variants.d.ts +25 -10
  11. package/base/lib/actions/input/builder/variants.js +2 -3
  12. package/base/lib/actions/input/builder/variants.js.map +1 -1
  13. package/base/lib/actions/input/inputSpecConstants.d.ts +20 -16
  14. package/base/lib/actions/input/inputSpecConstants.js +11 -11
  15. package/base/lib/actions/input/inputSpecConstants.js.map +1 -1
  16. package/base/lib/actions/input/inputSpecTypes.d.ts +0 -2
  17. package/base/lib/actions/input/inputSpecTypes.js.map +1 -1
  18. package/base/lib/actions/setupActions.d.ts +11 -9
  19. package/base/lib/actions/setupActions.js +1 -1
  20. package/base/lib/actions/setupActions.js.map +1 -1
  21. package/base/lib/dependencies/setupDependencies.d.ts +18 -11
  22. package/base/lib/dependencies/setupDependencies.js +3 -10
  23. package/base/lib/dependencies/setupDependencies.js.map +1 -1
  24. package/base/lib/osBindings/AcmeSettings.d.ts +11 -0
  25. package/base/lib/osBindings/AcmeSettings.js +4 -0
  26. package/base/lib/osBindings/AcmeSettings.js.map +1 -0
  27. package/base/lib/osBindings/ActionMetadata.d.ts +24 -0
  28. package/base/lib/osBindings/ActionResultMember.d.ts +34 -0
  29. package/base/lib/osBindings/ActionResultMember.js +4 -0
  30. package/base/lib/osBindings/ActionResultMember.js.map +1 -0
  31. package/base/lib/osBindings/ActionResultV1.d.ts +13 -12
  32. package/base/lib/osBindings/ActionResultV1.js +0 -1
  33. package/base/lib/osBindings/ActionResultV1.js.map +1 -1
  34. package/base/lib/osBindings/ActionResultValue.d.ts +26 -0
  35. package/base/lib/osBindings/ActionResultValue.js +3 -0
  36. package/base/lib/osBindings/ActionResultValue.js.map +1 -0
  37. package/base/lib/osBindings/AddCategoryParams.d.ts +6 -0
  38. package/base/lib/osBindings/AddCategoryParams.js +4 -0
  39. package/base/lib/osBindings/AddCategoryParams.js.map +1 -0
  40. package/base/lib/osBindings/BindInfo.d.ts +2 -2
  41. package/base/lib/osBindings/BuildArg.d.ts +3 -0
  42. package/base/lib/osBindings/BuildArg.js +4 -0
  43. package/base/lib/osBindings/BuildArg.js.map +1 -0
  44. package/base/lib/osBindings/CliSetIconParams.d.ts +3 -0
  45. package/base/lib/osBindings/CliSetIconParams.js +4 -0
  46. package/base/lib/osBindings/CliSetIconParams.js.map +1 -0
  47. package/base/lib/osBindings/DeviceFilter.d.ts +5 -0
  48. package/base/lib/osBindings/DeviceFilter.js +4 -0
  49. package/base/lib/osBindings/DeviceFilter.js.map +1 -0
  50. package/base/lib/osBindings/EditSignerParams.d.ts +11 -0
  51. package/base/lib/osBindings/EditSignerParams.js +3 -0
  52. package/base/lib/osBindings/EditSignerParams.js.map +1 -0
  53. package/base/lib/osBindings/GetStatusParams.d.ts +6 -0
  54. package/base/lib/osBindings/GetStatusParams.js +3 -0
  55. package/base/lib/osBindings/GetStatusParams.js.map +1 -0
  56. package/base/lib/osBindings/GitHash.d.ts +1 -0
  57. package/base/lib/osBindings/GitHash.js +4 -0
  58. package/base/lib/osBindings/GitHash.js.map +1 -0
  59. package/base/lib/osBindings/HardwareRequirements.d.ts +2 -4
  60. package/base/lib/osBindings/HardwareRequirements.js +0 -1
  61. package/base/lib/osBindings/HardwareRequirements.js.map +1 -1
  62. package/base/lib/osBindings/ImageSource.d.ts +6 -2
  63. package/base/lib/osBindings/ImageSource.js +0 -1
  64. package/base/lib/osBindings/ImageSource.js.map +1 -1
  65. package/base/lib/osBindings/IpInfo.d.ts +3 -4
  66. package/base/lib/osBindings/ListPackageSignersParams.d.ts +4 -0
  67. package/base/lib/osBindings/ListPackageSignersParams.js +3 -0
  68. package/base/lib/osBindings/ListPackageSignersParams.js.map +1 -0
  69. package/base/lib/osBindings/LshwDevice.d.ts +7 -0
  70. package/base/lib/osBindings/LshwDevice.js +3 -0
  71. package/base/lib/osBindings/LshwDevice.js.map +1 -0
  72. package/base/lib/osBindings/LshwDisplay.d.ts +3 -0
  73. package/base/lib/osBindings/LshwDisplay.js +4 -0
  74. package/base/lib/osBindings/LshwDisplay.js.map +1 -0
  75. package/base/lib/osBindings/LshwProcessor.d.ts +3 -0
  76. package/base/lib/osBindings/LshwProcessor.js +4 -0
  77. package/base/lib/osBindings/LshwProcessor.js.map +1 -0
  78. package/base/lib/osBindings/Manifest.d.ts +2 -1
  79. package/base/lib/osBindings/NetInfo.d.ts +5 -0
  80. package/base/lib/osBindings/NetInfo.js +4 -0
  81. package/base/lib/osBindings/NetInfo.js.map +1 -0
  82. package/base/lib/osBindings/NetworkInterfaceInfo.d.ts +5 -0
  83. package/base/lib/osBindings/NetworkInterfaceInfo.js +3 -0
  84. package/base/lib/osBindings/NetworkInterfaceInfo.js.map +1 -0
  85. package/base/lib/osBindings/PackageSignerParams.d.ts +6 -0
  86. package/base/lib/osBindings/PackageSignerParams.js +3 -0
  87. package/base/lib/osBindings/PackageSignerParams.js.map +1 -0
  88. package/base/lib/osBindings/PackageVersionInfo.d.ts +2 -1
  89. package/base/lib/osBindings/RemoveCategoryParams.d.ts +3 -0
  90. package/base/lib/osBindings/RemoveCategoryParams.js +4 -0
  91. package/base/lib/osBindings/RemoveCategoryParams.js.map +1 -0
  92. package/base/lib/osBindings/ServerInfo.d.ts +10 -4
  93. package/base/lib/osBindings/SetIconParams.d.ts +4 -0
  94. package/base/lib/osBindings/SetIconParams.js +3 -0
  95. package/base/lib/osBindings/SetIconParams.js.map +1 -0
  96. package/base/lib/osBindings/SetNameParams.d.ts +3 -0
  97. package/base/lib/osBindings/SetNameParams.js +4 -0
  98. package/base/lib/osBindings/SetNameParams.js.map +1 -0
  99. package/base/lib/osBindings/SetPublicParams.d.ts +4 -0
  100. package/base/lib/osBindings/SetPublicParams.js +4 -0
  101. package/base/lib/osBindings/SetPublicParams.js.map +1 -0
  102. package/base/lib/osBindings/SetupResult.d.ts +1 -0
  103. package/base/lib/osBindings/UnsetPublicParams.d.ts +3 -0
  104. package/base/lib/osBindings/UnsetPublicParams.js +4 -0
  105. package/base/lib/osBindings/UnsetPublicParams.js.map +1 -0
  106. package/base/lib/osBindings/index.d.ts +22 -1
  107. package/base/lib/types/ManifestTypes.d.ts +14 -8
  108. package/base/lib/types.d.ts +3 -2
  109. package/base/lib/types.js.map +1 -1
  110. package/package/lib/StartSdk.d.ts +254 -198
  111. package/package/lib/StartSdk.js +143 -97
  112. package/package/lib/StartSdk.js.map +1 -1
  113. package/package/lib/backup/Backups.d.ts +4 -26
  114. package/package/lib/backup/Backups.js +0 -22
  115. package/package/lib/backup/Backups.js.map +1 -1
  116. package/package/lib/backup/setupBackups.d.ts +2 -2
  117. package/package/lib/health/checkFns/checkPortListening.js +0 -1
  118. package/package/lib/health/checkFns/checkPortListening.js.map +1 -1
  119. package/package/lib/index.d.ts +1 -1
  120. package/package/lib/index.js +2 -1
  121. package/package/lib/index.js.map +1 -1
  122. package/package/lib/inits/setupInit.d.ts +1 -1
  123. package/package/lib/inits/setupInit.js.map +1 -1
  124. package/package/lib/inits/setupInstall.d.ts +4 -4
  125. package/package/lib/inits/setupUninstall.d.ts +4 -4
  126. package/package/lib/mainFn/CommandController.d.ts +3 -3
  127. package/package/lib/mainFn/CommandController.js +6 -0
  128. package/package/lib/mainFn/CommandController.js.map +1 -1
  129. package/package/lib/mainFn/Daemon.d.ts +3 -3
  130. package/package/lib/mainFn/Daemons.d.ts +32 -6
  131. package/package/lib/mainFn/Daemons.js.map +1 -1
  132. package/package/lib/mainFn/Mounts.d.ts +29 -5
  133. package/package/lib/mainFn/Mounts.js +27 -3
  134. package/package/lib/mainFn/Mounts.js.map +1 -1
  135. package/package/lib/mainFn/index.d.ts +1 -1
  136. package/package/lib/manifest/setupManifest.d.ts +7 -3
  137. package/package/lib/manifest/setupManifest.js +11 -7
  138. package/package/lib/manifest/setupManifest.js.map +1 -1
  139. package/package/lib/store/setupExposeStore.js.map +1 -1
  140. package/package/lib/test/inputSpecBuilder.test.js +40 -31
  141. package/package/lib/test/inputSpecBuilder.test.js.map +1 -1
  142. package/package/lib/test/output.d.ts +72 -30
  143. package/package/lib/test/output.js +31 -41
  144. package/package/lib/test/output.js.map +1 -1
  145. package/package/lib/test/output.sdk.d.ts +307 -107
  146. package/package/lib/test/output.sdk.js +10 -10
  147. package/package/lib/test/output.sdk.js.map +1 -1
  148. package/package/lib/test/output.test.js +1 -1
  149. package/package/lib/test/output.test.js.map +1 -1
  150. package/package/lib/trigger/defaultTrigger.js.map +1 -1
  151. package/package/lib/util/SubContainer.d.ts +6 -3
  152. package/package/lib/util/SubContainer.js +7 -14
  153. package/package/lib/util/SubContainer.js.map +1 -1
  154. package/package/lib/util/fileHelper.d.ts +32 -14
  155. package/package/lib/util/fileHelper.js +53 -33
  156. package/package/lib/util/fileHelper.js.map +1 -1
  157. package/package/scripts/oldSpecToBuilder.js +11 -27
  158. package/package/scripts/oldSpecToBuilder.js.map +1 -1
  159. package/package.json +4 -4
@@ -1,4 +1,4 @@
1
- import { ActionId, ActionInput, ActionMetadata, SetMainStatus, DependencyRequirement, CheckDependenciesResult, SetHealth, BindParams, HostId, LanInfo, Host, ExportServiceInterfaceParams, ServiceInterface, RequestActionParams } from "./osBindings";
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<LanInfo>;
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, Record<string, unknown>>> = A extends Action<T.ActionId, any, any, infer I> ? I : never;
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, Record<string, unknown>>> = {
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, Record<string, unknown>>> = ActionRequestBase & ({
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, Record<string, unknown>>>(options: {
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":";;;AAQO,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,OAA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,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
  /**
@@ -62,6 +62,8 @@ class InputSpec {
62
62
  constructor(spec, validator) {
63
63
  this.spec = spec;
64
64
  this.validator = validator;
65
+ this._TYPE = null;
66
+ this._PARTIAL = null;
65
67
  }
66
68
  async build(options) {
67
69
  const answer = {};
@@ -1 +1 @@
1
- {"version":3,"file":"inputSpec.js","sourceRoot":"","sources":["../../../../../../base/lib/actions/input/builder/inputSpec.ts"],"names":[],"mappings":";;;AAIA,2CAA2C;AAmB3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuDG;AACH,MAAa,SAAS;IACpB,YACmB,IAEhB,EACM,SAAgC;QAHtB,SAAI,GAAJ,IAAI,CAEpB;QACM,cAAS,GAAT,SAAS,CAAuB;IACtC,CAAC;IACJ,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;AAzDD,8BAyDC"}
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 { FilePath, Pattern, RandomString, ValueSpec, ValueSpecDatetime, ValueSpecText } from "../inputSpecTypes";
4
+ import { Pattern, RandomString, ValueSpec, ValueSpecDatetime, ValueSpecText } from "../inputSpecTypes";
5
5
  import { DefaultString } from "../inputSpecTypes";
6
6
  import { Parser } from "ts-matches";
7
- export type RequiredDefault<A> = false | {
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 RequiredDefault<DefaultString>>(a: {
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
- * @description Determines if the field is required. If so, optionally provide a default value.
43
- * @type { false | { default: string | RandomString | null } }
44
- * @example required: false
45
- * @example required: { default: null }
46
- * @example required: { default: 'World' }
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
- required: RequiredDefault<DefaultString>;
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 | undefined, Store>;
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
- * @description Unlike other "required" fields, for textarea this is a simple boolean.
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 RequiredDefault<number>>(a: {
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 Determines if the field is required. If so, optionally provide a default value.
136
- * @type { false | { default: number | null } }
137
- * @example required: false
138
- * @example required: { default: null }
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
- required: RequiredDefault<number>;
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 | undefined, Store>;
177
- static color<Required extends RequiredDefault<string>>(a: {
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 Determines if the field is required. If so, optionally provide a default value.
184
- * @type { false | { default: string | null } }
185
- * @example required: false
186
- * @example required: { default: null }
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
- required: RequiredDefault<string>;
196
+ default: string | null;
197
+ required: boolean;
201
198
  disabled?: false | string;
202
- }>): Value<string | null | undefined, Store>;
203
- static datetime<Required extends RequiredDefault<string>>(a: {
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 Determines if the field is required. If so, optionally provide a default value.
210
- * @type { false | { default: string | null } }
211
- * @example required: false
212
- * @example required: { default: null }
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
- required: RequiredDefault<string>;
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 | undefined, Store>;
239
- static select<Required extends RequiredDefault<string>, Values extends Record<string, string>>(a: {
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 { false | { default: string | null } }
247
- * @example required: false
248
- * @example required: { default: null }
249
- * @example required: { default: 'radio1' }
244
+ * @type { (keyof Values & string) | null }
245
+ * @example default: null
246
+ * @example default: 'radio1'
250
247
  */
251
- required: Required;
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<AsRequired<keyof Values, Required>, never>;
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
- required: RequiredDefault<string>;
271
+ default: string;
275
272
  values: Record<string, string>;
276
273
  disabled?: false | string | string[];
277
- }>): Value<string | null | undefined, Store>;
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 file<Store>(a: {
322
- name: string;
323
- description?: string | null;
324
- extensions: string[];
325
- required: boolean;
326
- }): Value<FilePath, Store>;
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 Determines if the field is required. If so, optionally provide a default value from the list of variants.
341
- * @type { false | { default: string | null } }
342
- * @example required: false
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
- required: Required;
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<Type, Store>): Value<AsRequired<Type, Required>, Store>;
353
- static filteredUnion<Required extends RequiredDefault<string>, Type extends Record<string, any>, Store = never>(getDisabledFn: LazyBuild<Store, string[] | false | string>, a: {
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
- required: Required;
358
- }, aVariants: Variants<Type, Store> | Variants<Type, never>): Value<AsRequired<Type, Required>, Store>;
359
- static dynamicUnion<Required extends RequiredDefault<string>, Type extends Record<string, any>, Store = never>(getA: LazyBuild<Store, {
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
- required: Required;
360
+ default: keyof VariantValues & string;
364
361
  disabled: string[] | false | string;
365
- }>, aVariants: Variants<Type, Store> | Variants<Type, never>): Value<Type | null | undefined, Store>;
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.