@start9labs/start-sdk 0.4.0-beta.51 → 0.4.0-beta.52

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 (146) hide show
  1. package/base/lib/actions/input/builder/inputSpec.d.ts +126 -5
  2. package/base/lib/actions/input/builder/inputSpec.js +219 -9
  3. package/base/lib/actions/input/builder/inputSpec.js.map +1 -1
  4. package/base/lib/actions/input/builder/list.d.ts +21 -0
  5. package/base/lib/actions/input/builder/list.js +21 -0
  6. package/base/lib/actions/input/builder/list.js.map +1 -1
  7. package/base/lib/actions/input/builder/value.d.ts +54 -0
  8. package/base/lib/actions/input/builder/value.js +56 -1
  9. package/base/lib/actions/input/builder/value.js.map +1 -1
  10. package/base/lib/actions/input/builder/variants.d.ts +11 -0
  11. package/base/lib/actions/input/builder/variants.js +17 -2
  12. package/base/lib/actions/input/builder/variants.js.map +1 -1
  13. package/base/lib/actions/input/inputSpecConstants.d.ts +203 -5
  14. package/base/lib/actions/input/inputSpecConstants.js +118 -38
  15. package/base/lib/actions/input/inputSpecConstants.js.map +1 -1
  16. package/base/lib/actions/input/inputSpecTypes.d.ts +99 -0
  17. package/base/lib/actions/input/inputSpecTypes.js +6 -1
  18. package/base/lib/actions/input/inputSpecTypes.js.map +1 -1
  19. package/base/lib/actions/setupActions.d.ts +6 -3
  20. package/base/lib/actions/setupActions.js +6 -3
  21. package/base/lib/actions/setupActions.js.map +1 -1
  22. package/base/lib/exver/index.d.ts +233 -2
  23. package/base/lib/exver/index.js +197 -3
  24. package/base/lib/exver/index.js.map +1 -1
  25. package/base/lib/index.d.ts +23 -1
  26. package/base/lib/index.js +3 -2
  27. package/base/lib/index.js.map +1 -1
  28. package/base/lib/inits/setupInit.d.ts +17 -0
  29. package/base/lib/inits/setupInit.js +7 -0
  30. package/base/lib/inits/setupInit.js.map +1 -1
  31. package/base/lib/inits/setupUninit.d.ts +12 -0
  32. package/base/lib/inits/setupUninit.js +7 -0
  33. package/base/lib/inits/setupUninit.js.map +1 -1
  34. package/base/lib/osBindings/ServerHostname.d.ts +1 -0
  35. package/base/lib/osBindings/ServerHostname.js +4 -0
  36. package/base/lib/osBindings/ServerHostname.js.map +1 -0
  37. package/base/lib/osBindings/ServerInfo.d.ts +1 -0
  38. package/base/lib/osBindings/SetServerHostnameParams.d.ts +4 -0
  39. package/base/lib/osBindings/SetServerHostnameParams.js +4 -0
  40. package/base/lib/osBindings/SetServerHostnameParams.js.map +1 -0
  41. package/base/lib/osBindings/SetupExecuteParams.d.ts +3 -1
  42. package/base/lib/osBindings/SmtpSecurity.d.ts +1 -0
  43. package/base/lib/osBindings/SmtpSecurity.js +4 -0
  44. package/base/lib/osBindings/SmtpSecurity.js.map +1 -0
  45. package/base/lib/osBindings/SmtpValue.d.ts +4 -2
  46. package/base/lib/osBindings/SmtpValue.js +0 -1
  47. package/base/lib/osBindings/SmtpValue.js.map +1 -1
  48. package/base/lib/osBindings/StartOsRecoveryInfo.d.ts +2 -2
  49. package/base/lib/osBindings/TestSmtpParams.d.ts +4 -2
  50. package/base/lib/osBindings/TestSmtpParams.js +0 -1
  51. package/base/lib/osBindings/TestSmtpParams.js.map +1 -1
  52. package/base/lib/osBindings/index.d.ts +3 -1
  53. package/base/lib/s9pk/index.d.ts +66 -0
  54. package/base/lib/s9pk/index.js +70 -1
  55. package/base/lib/s9pk/index.js.map +1 -1
  56. package/base/lib/types.d.ts +68 -2
  57. package/base/lib/types.js +14 -0
  58. package/base/lib/types.js.map +1 -1
  59. package/base/lib/util/asError.d.ts +8 -0
  60. package/base/lib/util/asError.js +8 -0
  61. package/base/lib/util/asError.js.map +1 -1
  62. package/base/lib/util/deepEqual.d.ts +15 -0
  63. package/base/lib/util/deepEqual.js +15 -0
  64. package/base/lib/util/deepEqual.js.map +1 -1
  65. package/base/lib/util/deepMerge.d.ts +18 -0
  66. package/base/lib/util/deepMerge.js +18 -0
  67. package/base/lib/util/deepMerge.js.map +1 -1
  68. package/base/lib/util/getDefaultString.d.ts +8 -0
  69. package/base/lib/util/getDefaultString.js +8 -0
  70. package/base/lib/util/getDefaultString.js.map +1 -1
  71. package/base/lib/util/graph.d.ts +57 -0
  72. package/base/lib/util/graph.js +47 -0
  73. package/base/lib/util/graph.js.map +1 -1
  74. package/base/lib/util/inMs.d.ts +15 -0
  75. package/base/lib/util/inMs.js +15 -0
  76. package/base/lib/util/inMs.js.map +1 -1
  77. package/base/lib/util/ip.d.ts +81 -0
  78. package/base/lib/util/ip.js +81 -0
  79. package/base/lib/util/ip.js.map +1 -1
  80. package/base/lib/util/once.d.ts +13 -0
  81. package/base/lib/util/once.js +13 -0
  82. package/base/lib/util/once.js.map +1 -1
  83. package/base/lib/util/patterns.d.ts +11 -0
  84. package/base/lib/util/patterns.js +11 -0
  85. package/base/lib/util/patterns.js.map +1 -1
  86. package/base/lib/util/regexes.d.ts +38 -0
  87. package/base/lib/util/regexes.js +38 -0
  88. package/base/lib/util/regexes.js.map +1 -1
  89. package/base/lib/util/splitCommand.d.ts +14 -0
  90. package/base/lib/util/splitCommand.js +14 -0
  91. package/base/lib/util/splitCommand.js.map +1 -1
  92. package/base/lib/util/stringFromStdErrOut.d.ts +7 -0
  93. package/base/lib/util/stringFromStdErrOut.js +7 -0
  94. package/base/lib/util/stringFromStdErrOut.js.map +1 -1
  95. package/base/lib/util/typeHelpers.d.ts +35 -0
  96. package/base/lib/util/typeHelpers.js +7 -0
  97. package/base/lib/util/typeHelpers.js.map +1 -1
  98. package/package/lib/StartSdk.d.ts +328 -2
  99. package/package/lib/StartSdk.js +142 -1
  100. package/package/lib/StartSdk.js.map +1 -1
  101. package/package/lib/backup/Backups.d.ts +71 -0
  102. package/package/lib/backup/Backups.js +69 -0
  103. package/package/lib/backup/Backups.js.map +1 -1
  104. package/package/lib/backup/setupBackups.d.ts +14 -0
  105. package/package/lib/backup/setupBackups.js +9 -0
  106. package/package/lib/backup/setupBackups.js.map +1 -1
  107. package/package/lib/health/HealthCheck.d.ts +16 -0
  108. package/package/lib/health/HealthCheck.js +15 -0
  109. package/package/lib/health/HealthCheck.js.map +1 -1
  110. package/package/lib/health/checkFns/HealthCheckResult.d.ts +6 -0
  111. package/package/lib/health/checkFns/index.d.ts +8 -0
  112. package/package/lib/health/checkFns/index.js +8 -0
  113. package/package/lib/health/checkFns/index.js.map +1 -1
  114. package/package/lib/mainFn/CommandController.d.ts +29 -0
  115. package/package/lib/mainFn/CommandController.js +29 -0
  116. package/package/lib/mainFn/CommandController.js.map +1 -1
  117. package/package/lib/mainFn/Daemon.d.ts +38 -2
  118. package/package/lib/mainFn/Daemon.js +38 -2
  119. package/package/lib/mainFn/Daemon.js.map +1 -1
  120. package/package/lib/mainFn/Daemons.d.ts +31 -0
  121. package/package/lib/mainFn/Daemons.js +13 -0
  122. package/package/lib/mainFn/Daemons.js.map +1 -1
  123. package/package/lib/mainFn/Mounts.d.ts +38 -0
  124. package/package/lib/mainFn/Mounts.js +38 -0
  125. package/package/lib/mainFn/Mounts.js.map +1 -1
  126. package/package/lib/mainFn/index.d.ts +1 -0
  127. package/package/lib/mainFn/index.js +1 -0
  128. package/package/lib/mainFn/index.js.map +1 -1
  129. package/package/lib/manifest/setupManifest.d.ts +9 -0
  130. package/package/lib/manifest/setupManifest.js +9 -0
  131. package/package/lib/manifest/setupManifest.js.map +1 -1
  132. package/package/lib/test/output.sdk.d.ts +192 -2
  133. package/package/lib/util/SubContainer.d.ts +46 -0
  134. package/package/lib/util/SubContainer.js +10 -0
  135. package/package/lib/util/SubContainer.js.map +1 -1
  136. package/package/lib/util/fileHelper.d.ts +41 -8
  137. package/package/lib/util/fileHelper.js +6 -4
  138. package/package/lib/util/fileHelper.js.map +1 -1
  139. package/package/lib/version/VersionGraph.d.ts +61 -0
  140. package/package/lib/version/VersionGraph.js +61 -0
  141. package/package/lib/version/VersionGraph.js.map +1 -1
  142. package/package/lib/version/VersionInfo.d.ts +17 -0
  143. package/package/lib/version/VersionInfo.js +12 -0
  144. package/package/lib/version/VersionInfo.js.map +1 -1
  145. package/package/package.json +3 -2
  146. package/package.json +3 -2
@@ -1,47 +1,81 @@
1
+ /**
2
+ * A record mapping field keys to their {@link ValueSpec} definitions.
3
+ * This is the root shape of a dynamic form specification — it defines the complete set
4
+ * of configurable fields for a service or action.
5
+ */
1
6
  export type InputSpec = Record<string, ValueSpec>;
7
+ /**
8
+ * The discriminator for all supported form field types.
9
+ */
2
10
  export type ValueType = 'text' | 'textarea' | 'number' | 'color' | 'datetime' | 'toggle' | 'select' | 'multiselect' | 'list' | 'object' | 'file' | 'union' | 'hidden';
11
+ /** Union of all concrete form field spec types. Discriminate on the `type` field. */
3
12
  export type ValueSpec = ValueSpecOf<ValueType>;
4
13
  /** core spec types. These types provide the metadata for performing validations */
5
14
  export type ValueSpecOf<T extends ValueType> = T extends "text" ? ValueSpecText : T extends "textarea" ? ValueSpecTextarea : T extends "number" ? ValueSpecNumber : T extends "color" ? ValueSpecColor : T extends "datetime" ? ValueSpecDatetime : T extends "toggle" ? ValueSpecToggle : T extends "select" ? ValueSpecSelect : T extends "multiselect" ? ValueSpecMultiselect : T extends "list" ? ValueSpecList : T extends "object" ? ValueSpecObject : T extends "file" ? ValueSpecFile : T extends "union" ? ValueSpecUnion : T extends "hidden" ? ValueSpecHidden : never;
15
+ /** Spec for a single-line text input field. */
6
16
  export type ValueSpecText = {
17
+ /** Display label for the field. */
7
18
  name: string;
19
+ /** Optional help text displayed below the field. */
8
20
  description: string | null;
21
+ /** Optional warning message displayed to the user. */
9
22
  warning: string | null;
10
23
  type: 'text';
24
+ /** Regex patterns used to validate the input value. */
11
25
  patterns: Pattern[];
26
+ /** Minimum character length, or `null` for no minimum. */
12
27
  minLength: number | null;
28
+ /** Maximum character length, or `null` for no maximum. */
13
29
  maxLength: number | null;
30
+ /** Whether the field should obscure input (e.g. for passwords). */
14
31
  masked: boolean;
32
+ /** HTML input mode hint for mobile keyboards. */
15
33
  inputmode: 'text' | 'email' | 'tel' | 'url';
34
+ /** Placeholder text shown when the field is empty. */
16
35
  placeholder: string | null;
36
+ /** Whether the field must have a value. */
17
37
  required: boolean;
38
+ /** Default value, which may be a literal string or a {@link RandomString} generation spec. */
18
39
  default: DefaultString | null;
40
+ /** `false` if editable, or a string message explaining why the field is disabled. */
19
41
  disabled: false | string;
42
+ /** If set, provides a "generate" button that fills the field with a random string matching this spec. */
20
43
  generate: null | RandomString;
44
+ /** Whether the field value cannot be changed after initial configuration. */
21
45
  immutable: boolean;
22
46
  };
47
+ /** Spec for a multi-line textarea input field. */
23
48
  export type ValueSpecTextarea = {
24
49
  name: string;
25
50
  description: string | null;
26
51
  warning: string | null;
27
52
  type: 'textarea';
53
+ /** Regex patterns used to validate the input value. */
28
54
  patterns: Pattern[];
29
55
  placeholder: string | null;
30
56
  minLength: number | null;
31
57
  maxLength: number | null;
58
+ /** Minimum number of visible rows. */
32
59
  minRows: number;
60
+ /** Maximum number of visible rows before scrolling. */
33
61
  maxRows: number;
34
62
  required: boolean;
35
63
  default: string | null;
36
64
  disabled: false | string;
37
65
  immutable: boolean;
38
66
  };
67
+ /** Spec for a numeric input field. */
39
68
  export type ValueSpecNumber = {
40
69
  type: 'number';
70
+ /** Minimum allowed value, or `null` for unbounded. */
41
71
  min: number | null;
72
+ /** Maximum allowed value, or `null` for unbounded. */
42
73
  max: number | null;
74
+ /** Whether only whole numbers are accepted. */
43
75
  integer: boolean;
76
+ /** Step increment for the input spinner, or `null` for any precision. */
44
77
  step: number | null;
78
+ /** Display label for the unit (e.g. `"MB"`, `"seconds"`), shown next to the field. */
45
79
  units: string | null;
46
80
  placeholder: string | null;
47
81
  name: string;
@@ -52,51 +86,67 @@ export type ValueSpecNumber = {
52
86
  disabled: false | string;
53
87
  immutable: boolean;
54
88
  };
89
+ /** Spec for a browser-native color picker field. */
55
90
  export type ValueSpecColor = {
56
91
  name: string;
57
92
  description: string | null;
58
93
  warning: string | null;
59
94
  type: 'color';
60
95
  required: boolean;
96
+ /** Default hex color string (e.g. `"#ff0000"`), or `null`. */
61
97
  default: string | null;
62
98
  disabled: false | string;
63
99
  immutable: boolean;
64
100
  };
101
+ /** Spec for a date, time, or datetime input field. */
65
102
  export type ValueSpecDatetime = {
66
103
  name: string;
67
104
  description: string | null;
68
105
  warning: string | null;
69
106
  type: 'datetime';
70
107
  required: boolean;
108
+ /** Controls which kind of picker is displayed. */
71
109
  inputmode: 'date' | 'time' | 'datetime-local';
110
+ /** Minimum selectable date/time as an ISO string, or `null`. */
72
111
  min: string | null;
112
+ /** Maximum selectable date/time as an ISO string, or `null`. */
73
113
  max: string | null;
74
114
  default: string | null;
75
115
  disabled: false | string;
76
116
  immutable: boolean;
77
117
  };
118
+ /** Spec for a single-select field displayed as radio buttons in a modal. */
78
119
  export type ValueSpecSelect = {
120
+ /** Map of option keys to display labels. */
79
121
  values: Record<string, string>;
80
122
  name: string;
81
123
  description: string | null;
82
124
  warning: string | null;
83
125
  type: 'select';
84
126
  default: string | null;
127
+ /** `false` if all enabled, a string disabling the whole field, or an array of disabled option keys. */
85
128
  disabled: false | string | string[];
86
129
  immutable: boolean;
87
130
  };
131
+ /** Spec for a multi-select field displayed as checkboxes in a modal. */
88
132
  export type ValueSpecMultiselect = {
133
+ /** Map of option keys to display labels. */
89
134
  values: Record<string, string>;
90
135
  name: string;
91
136
  description: string | null;
92
137
  warning: string | null;
93
138
  type: 'multiselect';
139
+ /** Minimum number of selections required, or `null`. */
94
140
  minLength: number | null;
141
+ /** Maximum number of selections allowed, or `null`. */
95
142
  maxLength: number | null;
143
+ /** `false` if all enabled, a string disabling the whole field, or an array of disabled option keys. */
96
144
  disabled: false | string | string[];
145
+ /** Array of option keys selected by default. */
97
146
  default: string[];
98
147
  immutable: boolean;
99
148
  };
149
+ /** Spec for a boolean toggle (on/off switch). */
100
150
  export type ValueSpecToggle = {
101
151
  name: string;
102
152
  description: string | null;
@@ -106,55 +156,83 @@ export type ValueSpecToggle = {
106
156
  disabled: false | string;
107
157
  immutable: boolean;
108
158
  };
159
+ /**
160
+ * Spec for a discriminated union field — displays a dropdown for variant selection,
161
+ * and each variant can have its own nested sub-form.
162
+ */
109
163
  export type ValueSpecUnion = {
110
164
  name: string;
111
165
  description: string | null;
112
166
  warning: string | null;
113
167
  type: 'union';
168
+ /** Map of variant keys to their display name and nested form spec. */
114
169
  variants: Record<string, {
170
+ /** Display name for this variant in the dropdown. */
115
171
  name: string;
172
+ /** Nested form spec shown when this variant is selected. */
116
173
  spec: InputSpec;
117
174
  }>;
175
+ /** `false` if all enabled, a string disabling the whole field, or an array of disabled variant keys. */
118
176
  disabled: false | string | string[];
119
177
  default: string | null;
120
178
  immutable: boolean;
121
179
  };
180
+ /** Spec for a file upload input field. */
122
181
  export type ValueSpecFile = {
123
182
  name: string;
124
183
  description: string | null;
125
184
  warning: string | null;
126
185
  type: 'file';
186
+ /** Allowed file extensions (e.g. `[".pem", ".crt"]`). */
127
187
  extensions: string[];
128
188
  required: boolean;
129
189
  };
190
+ /** Spec for a collapsible grouping of nested fields (a "sub-form"). */
130
191
  export type ValueSpecObject = {
131
192
  name: string;
132
193
  description: string | null;
133
194
  warning: string | null;
134
195
  type: 'object';
196
+ /** The nested form spec containing this object's fields. */
135
197
  spec: InputSpec;
136
198
  };
199
+ /** Spec for a hidden field — not displayed to the user but included in the form data. */
137
200
  export type ValueSpecHidden = {
138
201
  type: 'hidden';
139
202
  };
203
+ /** The two supported list item types. */
140
204
  export type ListValueSpecType = 'text' | 'object';
205
+ /** Maps a {@link ListValueSpecType} to its concrete list item spec. */
141
206
  export type ListValueSpecOf<T extends ListValueSpecType> = T extends "text" ? ListValueSpecText : T extends "object" ? ListValueSpecObject : never;
207
+ /** A list field spec — union of text-list and object-list variants. */
142
208
  export type ValueSpecList = ValueSpecListOf<ListValueSpecType>;
209
+ /**
210
+ * Spec for a list field — an interface to add, remove, and edit items in an ordered collection.
211
+ * The `spec` field determines whether list items are text strings or structured objects.
212
+ */
143
213
  export type ValueSpecListOf<T extends ListValueSpecType> = {
144
214
  name: string;
145
215
  description: string | null;
146
216
  warning: string | null;
147
217
  type: 'list';
218
+ /** The item spec — determines whether this is a list of text values or objects. */
148
219
  spec: ListValueSpecOf<T>;
220
+ /** Minimum number of items, or `null` for no minimum. */
149
221
  minLength: number | null;
222
+ /** Maximum number of items, or `null` for no maximum. */
150
223
  maxLength: number | null;
151
224
  disabled: false | string;
225
+ /** Default list items to populate on creation. */
152
226
  default: string[] | DefaultString[] | Record<string, unknown>[] | readonly string[] | readonly DefaultString[] | readonly Record<string, unknown>[];
153
227
  };
228
+ /** A regex validation pattern with a human-readable description of what it enforces. */
154
229
  export type Pattern = {
230
+ /** The regex pattern string (without delimiters). */
155
231
  regex: string;
232
+ /** A user-facing explanation shown when validation fails (e.g. `"Must be a valid email"`). */
156
233
  description: string;
157
234
  };
235
+ /** Spec for text items within a list field. */
158
236
  export type ListValueSpecText = {
159
237
  type: 'text';
160
238
  patterns: Pattern[];
@@ -165,22 +243,43 @@ export type ListValueSpecText = {
165
243
  inputmode: 'text' | 'email' | 'tel' | 'url';
166
244
  placeholder: string | null;
167
245
  };
246
+ /** Spec for object items within a list field. */
168
247
  export type ListValueSpecObject = {
169
248
  type: 'object';
249
+ /** The form spec for each object item. */
170
250
  spec: InputSpec;
251
+ /** Defines how uniqueness is determined among list items. */
171
252
  uniqueBy: UniqueBy;
253
+ /** An expression used to generate the display string for each item in the list summary (e.g. a key path). */
172
254
  displayAs: string | null;
173
255
  };
256
+ /**
257
+ * Describes how list items determine uniqueness.
258
+ * - `null`: no uniqueness constraint
259
+ * - `string`: unique by a specific field key
260
+ * - `{ any: UniqueBy[] }`: unique if any of the sub-constraints match
261
+ * - `{ all: UniqueBy[] }`: unique if all sub-constraints match together
262
+ */
174
263
  export type UniqueBy = null | string | {
175
264
  any: readonly UniqueBy[] | UniqueBy[];
176
265
  } | {
177
266
  all: readonly UniqueBy[] | UniqueBy[];
178
267
  };
268
+ /** A default value that is either a literal string or a {@link RandomString} generation spec. */
179
269
  export type DefaultString = string | RandomString;
270
+ /** Spec for generating a random string — used for default passwords, API keys, etc. */
180
271
  export type RandomString = {
272
+ /** The character set to draw from (e.g. `"a-zA-Z0-9"`). */
181
273
  charset: string;
274
+ /** The length of the generated string. */
182
275
  len: number;
183
276
  };
277
+ /**
278
+ * Type guard that narrows a {@link ValueSpec} to a {@link ValueSpecListOf} of a specific item type.
279
+ *
280
+ * @param t - The value spec to check
281
+ * @param s - The list item type to narrow to (`"text"` or `"object"`)
282
+ */
184
283
  export declare function isValueSpecListOf<S extends ListValueSpecType>(t: ValueSpec, s: S): t is ValueSpecListOf<S> & {
185
284
  spec: ListValueSpecOf<S>;
186
285
  };
@@ -1,7 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isValueSpecListOf = isValueSpecListOf;
4
- // sometimes the type checker needs just a little bit of help
4
+ /**
5
+ * Type guard that narrows a {@link ValueSpec} to a {@link ValueSpecListOf} of a specific item type.
6
+ *
7
+ * @param t - The value spec to check
8
+ * @param s - The list item type to narrow to (`"text"` or `"object"`)
9
+ */
5
10
  function isValueSpecListOf(t, s) {
6
11
  return 'spec' in t && t.spec.type === s;
7
12
  }
@@ -1 +1 @@
1
- {"version":3,"file":"inputSpecTypes.js","sourceRoot":"","sources":["../../../../../base/lib/actions/input/inputSpecTypes.ts"],"names":[],"mappings":";;AAkPA,8CAKC;AAND,6DAA6D;AAC7D,SAAgB,iBAAiB,CAC/B,CAAY,EACZ,CAAI;IAEJ,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAA;AACzC,CAAC"}
1
+ {"version":3,"file":"inputSpecTypes.js","sourceRoot":"","sources":["../../../../../base/lib/actions/input/inputSpecTypes.ts"],"names":[],"mappings":";;AAoVA,8CAKC;AAXD;;;;;GAKG;AACH,SAAgB,iBAAiB,CAC/B,CAAY,EACZ,CAAI;IAEJ,OAAO,MAAM,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,CAAA;AACzC,CAAC"}
@@ -13,9 +13,9 @@ export type GetInput<A extends Record<string, any>> = (options: {
13
13
  effects: T.Effects;
14
14
  prefill: T.DeepPartial<A> | null;
15
15
  }) => Promise<null | void | undefined | T.DeepPartial<A>>;
16
- export type MaybeFn<T> = T | ((options: {
16
+ export type MaybeFn<T, Opts = {
17
17
  effects: T.Effects;
18
- }) => Promise<T>);
18
+ }> = T | ((options: Opts) => Promise<T>);
19
19
  export interface ActionInfo<Id extends T.ActionId, Type extends Record<string, any>> {
20
20
  readonly id: Id;
21
21
  readonly _INPUT: Type;
@@ -29,7 +29,10 @@ export declare class Action<Id extends T.ActionId, Type extends Record<string, a
29
29
  readonly _INPUT: Type;
30
30
  private prevInputSpec;
31
31
  private constructor();
32
- static withInput<Id extends T.ActionId, InputSpecType extends InputSpec<Record<string, any>>>(id: Id, metadata: MaybeFn<Omit<T.ActionMetadata, 'hasInput'>>, inputSpec: InputSpecType, getInput: GetInput<ExtractInputSpecType<InputSpecType>>, run: Run<ExtractInputSpecType<InputSpecType>>): Action<Id, ExtractInputSpecType<InputSpecType>>;
32
+ static withInput<Id extends T.ActionId, InputSpecType extends InputSpec<Record<string, any>>>(id: Id, metadata: MaybeFn<Omit<T.ActionMetadata, 'hasInput'>>, inputSpec: MaybeFn<InputSpecType, {
33
+ effects: T.Effects;
34
+ prefill: unknown | null;
35
+ }>, getInput: GetInput<ExtractInputSpecType<InputSpecType>>, run: Run<ExtractInputSpecType<InputSpecType>>): Action<Id, ExtractInputSpecType<InputSpecType>>;
33
36
  static withoutInput<Id extends T.ActionId>(id: Id, metadata: MaybeFn<Omit<T.ActionMetadata, 'hasInput'>>, run: Run<{}>): Action<Id, {}>;
34
37
  exportMetadata(options: {
35
38
  effects: T.Effects;
@@ -48,9 +48,12 @@ class Action {
48
48
  async getInput(options) {
49
49
  let spec = {};
50
50
  if (this.inputSpec) {
51
- const built = await this.inputSpec.build(options);
52
- this.prevInputSpec[options.effects.eventId] = built;
53
- spec = built.spec;
51
+ const inputSpec = await callMaybeFn(this.inputSpec, options);
52
+ const built = await inputSpec?.build(options);
53
+ if (built) {
54
+ this.prevInputSpec[options.effects.eventId] = built;
55
+ spec = built.spec;
56
+ }
54
57
  }
55
58
  return {
56
59
  eventId: options.effects.eventId,
@@ -1 +1 @@
1
- {"version":3,"file":"setupActions.js","sourceRoot":"","sources":["../../../../base/lib/actions/setupActions.ts"],"names":[],"mappings":";;;AAGA,kCAA8B;AAgB9B,SAAS,WAAW,CAClB,OAAmB,EACnB,OAA+B;IAE/B,IAAI,OAAO,YAAY,QAAQ,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,CAAA;IACzB,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC;AACH,CAAC;AACD,SAAS,UAAU,CACjB,OAAmB,EACnB,GAAoB;IAEpB,IAAI,OAAO,YAAY,QAAQ,EAAE,CAAC;QAChC,OAAO,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;IACvD,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,CAAC;AACH,CAAC;AAUD,MAAa,MAAM;IAQjB,YACW,EAAM,EACE,UAAqC,EACrC,SAA+B,EAC/B,UAA0B,EAC1B,KAAgB;QAJxB,OAAE,GAAF,EAAE,CAAI;QACE,eAAU,GAAV,UAAU,CAA2B;QACrC,cAAS,GAAT,SAAS,CAAsB;QAC/B,eAAU,GAAV,UAAU,CAAgB;QAC1B,UAAK,GAAL,KAAK,CAAW;QAV1B,WAAM,GAAS,IAAmB,CAAA;QACnC,kBAAa,GAGjB,EAAE,CAAA;IAOH,CAAC;IACJ,MAAM,CAAC,SAAS,CAId,EAAM,EACN,QAAqD,EACrD,SAAwB,EACxB,QAAuD,EACvD,GAA6C;QA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C"}
1
+ {"version":3,"file":"setupActions.js","sourceRoot":"","sources":["../../../../base/lib/actions/setupActions.ts"],"names":[],"mappings":";;;AAGA,kCAA8B;AAkB9B,SAAS,WAAW,CAClB,OAAyB,EACzB,OAAa;IAEb,IAAI,OAAO,YAAY,QAAQ,EAAE,CAAC;QAChC,OAAO,OAAO,CAAC,OAAO,CAAC,CAAA;IACzB,CAAC;SAAM,CAAC;QACN,OAAO,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAA;IACjC,CAAC;AACH,CAAC;AACD,SAAS,UAAU,CACjB,OAAmB,EACnB,GAAoB;IAEpB,IAAI,OAAO,YAAY,QAAQ,EAAE,CAAC;QAChC,OAAO,KAAK,EAAE,GAAG,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,CAAA;IACvD,CAAC;SAAM,CAAC;QACN,OAAO,GAAG,CAAC,OAAO,CAAC,CAAA;IACrB,CAAC;AACH,CAAC;AAUD,MAAa,MAAM;IAQjB,YACW,EAAM,EACE,UAAqC,EACrC,SAMhB,EACgB,UAA0B,EAC1B,KAAgB;QAVxB,OAAE,GAAF,EAAE,CAAI;QACE,eAAU,GAAV,UAAU,CAA2B;QACrC,cAAS,GAAT,SAAS,CAMzB;QACgB,eAAU,GAAV,UAAU,CAAgB;QAC1B,UAAK,GAAL,KAAK,CAAW;QAhB1B,WAAM,GAAS,IAAmB,CAAA;QACnC,kBAAa,GAGjB,EAAE,CAAA;IAaH,CAAC;IACJ,MAAM,CAAC,SAAS,CAId,EAAM,EACN,QAAqD,EACrD,SAMC,EACD,QAAuD,EACvD,GAA6C;QAE7C,OAAO,IAAI,MAAM,CACf,EAAE,EACF,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,EACvD,SAAgB,EAChB,QAAQ,EACR,GAAG,CAC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
+ * Compile-time utility type that validates a version string literal conforms to semver format.
5
+ *
6
+ * Resolves to `unknown` if valid, `never` if invalid. Used with {@link testTypeVersion}.
7
+ *
8
+ * @example
9
+ * ```ts
10
+ * type Valid = ValidateVersion<"1.2.3"> // unknown (valid)
11
+ * type Invalid = ValidateVersion<"-3"> // never (invalid)
12
+ * ```
13
+ */
3
14
  export type ValidateVersion<T extends String> = T extends `-${infer A}` ? never : T extends `${infer A}-${string}` ? ValidateVersion<A> : T extends `${bigint}` ? unknown : T extends `${bigint}.${infer A}` ? ValidateVersion<A> : never;
15
+ /**
16
+ * Compile-time utility type that validates an extended version string literal.
17
+ *
18
+ * Extended versions have the format `upstream:downstream` or `#flavor:upstream:downstream`.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * type Valid = ValidateExVer<"1.2.3:0"> // valid
23
+ * type Flavored = ValidateExVer<"#bitcoin:1.0:0"> // valid
24
+ * type Bad = ValidateExVer<"1.2-3"> // never (invalid)
25
+ * ```
26
+ */
4
27
  export type ValidateExVer<T extends string> = T extends `#${string}:${infer A}:${infer B}` ? ValidateVersion<A> & ValidateVersion<B> : T extends `${infer A}:${infer B}` ? ValidateVersion<A> & ValidateVersion<B> : never;
28
+ /**
29
+ * Validates a tuple of extended version string literals at compile time.
30
+ *
31
+ * @example
32
+ * ```ts
33
+ * type Valid = ValidateExVers<["1.0:0", "2.0:0"]> // valid
34
+ * ```
35
+ */
5
36
  export type ValidateExVers<T> = T extends [] ? unknown[] : T extends [infer A, ...infer B] ? ValidateExVer<A & string> & ValidateExVers<B> : never[];
6
37
  type Anchor = {
7
38
  type: 'Anchor';
@@ -85,55 +116,234 @@ declare class VersionRangeTable {
85
116
  */
86
117
  static minterms(tables: VersionRangeTables): VersionRange;
87
118
  }
119
+ /**
120
+ * Represents a parsed version range expression used to match against {@link Version} or {@link ExtendedVersion} values.
121
+ *
122
+ * Version ranges support standard comparison operators (`=`, `>`, `<`, `>=`, `<=`, `!=`),
123
+ * caret (`^`) and tilde (`~`) ranges, boolean logic (`&&`, `||`, `!`), and flavor matching (`#flavor`).
124
+ *
125
+ * @example
126
+ * ```ts
127
+ * const range = VersionRange.parse(">=1.0.0:0 && <2.0.0:0")
128
+ * const version = ExtendedVersion.parse("1.5.0:0")
129
+ * console.log(range.satisfiedBy(version)) // true
130
+ *
131
+ * // Combine ranges with boolean logic
132
+ * const combined = VersionRange.and(
133
+ * VersionRange.parse(">=1.0:0"),
134
+ * VersionRange.parse("<3.0:0"),
135
+ * )
136
+ *
137
+ * // Match a specific flavor
138
+ * const flavored = VersionRange.parse("#bitcoin")
139
+ * ```
140
+ */
88
141
  export declare class VersionRange {
89
142
  atom: Anchor | And | Or | Not | P.Any | P.None | Flavor;
90
143
  constructor(atom: Anchor | And | Or | Not | P.Any | P.None | Flavor);
91
144
  toStringParens(parent: 'And' | 'Or' | 'Not'): string;
145
+ /** Serializes this version range back to its canonical string representation. */
92
146
  toString(): string;
93
147
  private static parseAtom;
94
148
  private static parseRange;
149
+ /**
150
+ * Parses a version range string into a `VersionRange`.
151
+ *
152
+ * @param range - A version range expression, e.g. `">=1.0.0:0 && <2.0.0:0"`, `"^1.2:0"`, `"*"`
153
+ * @returns The parsed `VersionRange`
154
+ * @throws If the string is not a valid version range expression
155
+ */
95
156
  static parse(range: string): VersionRange;
157
+ /**
158
+ * Creates a version range from a comparison operator and an {@link ExtendedVersion}.
159
+ *
160
+ * @param operator - One of `"="`, `">"`, `"<"`, `">="`, `"<="`, `"!="`, `"^"`, `"~"`
161
+ * @param version - The version to compare against
162
+ */
96
163
  static anchor(operator: P.CmpOp, version: ExtendedVersion): VersionRange;
164
+ /**
165
+ * Creates a version range that matches only versions with the specified flavor.
166
+ *
167
+ * @param flavor - The flavor string to match, or `null` for the default (unflavored) variant
168
+ */
97
169
  static flavor(flavor: string | null): VersionRange;
170
+ /**
171
+ * Parses a legacy "emver" format version range string.
172
+ *
173
+ * @param range - A version range in the legacy emver format
174
+ * @returns The parsed `VersionRange`
175
+ */
98
176
  static parseEmver(range: string): VersionRange;
177
+ /** Returns the intersection of this range with another (logical AND). */
99
178
  and(right: VersionRange): VersionRange;
179
+ /** Returns the union of this range with another (logical OR). */
100
180
  or(right: VersionRange): VersionRange;
181
+ /** Returns the negation of this range (logical NOT). */
101
182
  not(): VersionRange;
183
+ /**
184
+ * Returns the logical AND (intersection) of multiple version ranges.
185
+ * Short-circuits on `none()` and skips `any()`.
186
+ */
102
187
  static and(...xs: Array<VersionRange>): VersionRange;
188
+ /**
189
+ * Returns the logical OR (union) of multiple version ranges.
190
+ * Short-circuits on `any()` and skips `none()`.
191
+ */
103
192
  static or(...xs: Array<VersionRange>): VersionRange;
193
+ /** Returns a version range that matches all versions (wildcard `*`). */
104
194
  static any(): VersionRange;
195
+ /** Returns a version range that matches no versions (`!`). */
105
196
  static none(): VersionRange;
197
+ /**
198
+ * Returns `true` if the given version satisfies this range.
199
+ *
200
+ * @param version - A {@link Version} or {@link ExtendedVersion} to test
201
+ */
106
202
  satisfiedBy(version: Version | ExtendedVersion): boolean;
107
203
  tables(): VersionRangeTables;
204
+ /** Returns `true` if any version exists that could satisfy this range. */
108
205
  satisfiable(): boolean;
206
+ /** Returns `true` if this range and `other` share at least one satisfying version. */
109
207
  intersects(other: VersionRange): boolean;
208
+ /**
209
+ * Returns a canonical (simplified) form of this range using minterm expansion.
210
+ * Useful for normalizing complex boolean expressions into a minimal representation.
211
+ */
110
212
  normalize(): VersionRange;
111
213
  }
214
+ /**
215
+ * Represents a semantic version number with numeric segments and optional prerelease identifiers.
216
+ *
217
+ * Follows semver precedence rules: numeric segments are compared left-to-right,
218
+ * and a version with prerelease identifiers has lower precedence than the same version without.
219
+ *
220
+ * @example
221
+ * ```ts
222
+ * const v = Version.parse("1.2.3")
223
+ * console.log(v.toString()) // "1.2.3"
224
+ * console.log(v.compare(Version.parse("1.3.0"))) // "less"
225
+ *
226
+ * const pre = Version.parse("2.0.0-beta.1")
227
+ * console.log(pre.compare(Version.parse("2.0.0"))) // "less" (prerelease < release)
228
+ * ```
229
+ */
112
230
  export declare class Version {
231
+ /** The numeric version segments (e.g. `[1, 2, 3]` for `"1.2.3"`). */
113
232
  number: number[];
233
+ /** Optional prerelease identifiers (e.g. `["beta", 1]` for `"-beta.1"`). */
114
234
  prerelease: (string | number)[];
115
- constructor(number: number[], prerelease: (string | number)[]);
235
+ constructor(
236
+ /** The numeric version segments (e.g. `[1, 2, 3]` for `"1.2.3"`). */
237
+ number: number[],
238
+ /** Optional prerelease identifiers (e.g. `["beta", 1]` for `"-beta.1"`). */
239
+ prerelease: (string | number)[]);
240
+ /** Serializes this version to its string form (e.g. `"1.2.3"` or `"1.0.0-beta.1"`). */
116
241
  toString(): string;
242
+ /**
243
+ * Compares this version against another using semver precedence rules.
244
+ *
245
+ * @param other - The version to compare against
246
+ * @returns `'greater'`, `'equal'`, or `'less'`
247
+ */
117
248
  compare(other: Version): 'greater' | 'equal' | 'less';
249
+ /**
250
+ * Compares two versions, returning a numeric value suitable for use with `Array.sort()`.
251
+ *
252
+ * @returns `-1` if less, `0` if equal, `1` if greater
253
+ */
118
254
  compareForSort(other: Version): -1 | 0 | 1;
255
+ /**
256
+ * Parses a version string into a `Version` instance.
257
+ *
258
+ * @param version - A semver-compatible string, e.g. `"1.2.3"` or `"1.0.0-beta.1"`
259
+ * @throws If the string is not a valid version
260
+ */
119
261
  static parse(version: string): Version;
262
+ /**
263
+ * Returns `true` if this version satisfies the given {@link VersionRange}.
264
+ * Internally treats this as an unflavored {@link ExtendedVersion} with downstream `0`.
265
+ */
120
266
  satisfies(versionRange: VersionRange): boolean;
121
267
  }
268
+ /**
269
+ * Represents an extended version with an optional flavor, an upstream version, and a downstream version.
270
+ *
271
+ * The format is `#flavor:upstream:downstream` (e.g. `#bitcoin:1.2.3:0`) or `upstream:downstream`
272
+ * for unflavored versions. Flavors allow multiple variants of a package to coexist.
273
+ *
274
+ * - **flavor**: An optional string identifier for the variant (e.g. `"bitcoin"`, `"litecoin"`)
275
+ * - **upstream**: The version of the upstream software being packaged
276
+ * - **downstream**: The version of the StartOS packaging itself
277
+ *
278
+ * Versions with different flavors are incomparable (comparison returns `null`).
279
+ *
280
+ * @example
281
+ * ```ts
282
+ * const v = ExtendedVersion.parse("#bitcoin:1.2.3:0")
283
+ * console.log(v.flavor) // "bitcoin"
284
+ * console.log(v.upstream) // Version { number: [1, 2, 3] }
285
+ * console.log(v.downstream) // Version { number: [0] }
286
+ * console.log(v.toString()) // "#bitcoin:1.2.3:0"
287
+ *
288
+ * const range = VersionRange.parse(">=1.0.0:0")
289
+ * console.log(v.satisfies(range)) // true
290
+ * ```
291
+ */
122
292
  export declare class ExtendedVersion {
293
+ /** The flavor identifier (e.g. `"bitcoin"`), or `null` for unflavored versions. */
123
294
  flavor: string | null;
295
+ /** The upstream software version. */
124
296
  upstream: Version;
297
+ /** The downstream packaging version. */
125
298
  downstream: Version;
126
- constructor(flavor: string | null, upstream: Version, downstream: Version);
299
+ constructor(
300
+ /** The flavor identifier (e.g. `"bitcoin"`), or `null` for unflavored versions. */
301
+ flavor: string | null,
302
+ /** The upstream software version. */
303
+ upstream: Version,
304
+ /** The downstream packaging version. */
305
+ downstream: Version);
306
+ /** Serializes this extended version to its string form (e.g. `"#bitcoin:1.2.3:0"` or `"1.0.0:1"`). */
127
307
  toString(): string;
308
+ /**
309
+ * Compares this extended version against another.
310
+ *
311
+ * @returns `'greater'`, `'equal'`, `'less'`, or `null` if the flavors differ (incomparable)
312
+ */
128
313
  compare(other: ExtendedVersion): 'greater' | 'equal' | 'less' | null;
314
+ /**
315
+ * Lexicographic comparison — compares flavors alphabetically first, then versions.
316
+ * Unlike {@link compare}, this never returns `null`: different flavors are ordered alphabetically.
317
+ */
129
318
  compareLexicographic(other: ExtendedVersion): 'greater' | 'equal' | 'less';
319
+ /**
320
+ * Returns a numeric comparison result suitable for use with `Array.sort()`.
321
+ * Uses lexicographic ordering (flavors sorted alphabetically, then by version).
322
+ */
130
323
  compareForSort(other: ExtendedVersion): 1 | 0 | -1;
324
+ /** Returns `true` if this version is strictly greater than `other`. Returns `false` if flavors differ. */
131
325
  greaterThan(other: ExtendedVersion): boolean;
326
+ /** Returns `true` if this version is greater than or equal to `other`. Returns `false` if flavors differ. */
132
327
  greaterThanOrEqual(other: ExtendedVersion): boolean;
328
+ /** Returns `true` if this version equals `other` (same flavor, upstream, and downstream). */
133
329
  equals(other: ExtendedVersion): boolean;
330
+ /** Returns `true` if this version is strictly less than `other`. Returns `false` if flavors differ. */
134
331
  lessThan(other: ExtendedVersion): boolean;
332
+ /** Returns `true` if this version is less than or equal to `other`. Returns `false` if flavors differ. */
135
333
  lessThanOrEqual(other: ExtendedVersion): boolean;
334
+ /**
335
+ * Parses an extended version string into an `ExtendedVersion`.
336
+ *
337
+ * @param extendedVersion - A string like `"1.2.3:0"` or `"#bitcoin:1.0.0:0"`
338
+ * @throws If the string is not a valid extended version
339
+ */
136
340
  static parse(extendedVersion: string): ExtendedVersion;
341
+ /**
342
+ * Parses a legacy "emver" format extended version string.
343
+ *
344
+ * @param extendedVersion - A version string in the legacy emver format
345
+ * @throws If the string is not a valid emver version (error message includes the input string)
346
+ */
137
347
  static parseEmver(extendedVersion: string): ExtendedVersion;
138
348
  /**
139
349
  * Returns an ExtendedVersion with the Upstream major version version incremented by 1
@@ -153,6 +363,27 @@ export declare class ExtendedVersion {
153
363
  */
154
364
  satisfies(versionRange: VersionRange): boolean;
155
365
  }
366
+ /**
367
+ * Compile-time type-checking helper that validates an extended version string literal.
368
+ * If the string is invalid, TypeScript will report a type error at the call site.
369
+ *
370
+ * @example
371
+ * ```ts
372
+ * testTypeExVer("1.2.3:0") // compiles
373
+ * testTypeExVer("#bitcoin:1.0:0") // compiles
374
+ * testTypeExVer("invalid") // type error
375
+ * ```
376
+ */
156
377
  export declare const testTypeExVer: <T extends string>(t: T & ValidateExVer<T>) => T & ValidateExVer<T>;
378
+ /**
379
+ * Compile-time type-checking helper that validates a version string literal.
380
+ * If the string is invalid, TypeScript will report a type error at the call site.
381
+ *
382
+ * @example
383
+ * ```ts
384
+ * testTypeVersion("1.2.3") // compiles
385
+ * testTypeVersion("-3") // type error
386
+ * ```
387
+ */
157
388
  export declare const testTypeVersion: <T extends string>(t: T & ValidateVersion<T>) => T & ValidateVersion<T>;
158
389
  export {};