@start9labs/start-sdk 0.4.0-beta.4 → 0.4.0-beta.41
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 +6 -34
- package/base/lib/actions/index.d.ts +13 -14
- package/base/lib/actions/index.js +4 -4
- package/base/lib/actions/index.js.map +1 -1
- package/base/lib/actions/input/builder/inputSpec.d.ts +16 -26
- package/base/lib/actions/input/builder/inputSpec.js +9 -24
- package/base/lib/actions/input/builder/inputSpec.js.map +1 -1
- package/base/lib/actions/input/builder/list.d.ts +13 -24
- package/base/lib/actions/input/builder/list.js +19 -30
- package/base/lib/actions/input/builder/list.js.map +1 -1
- package/base/lib/actions/input/builder/value.d.ts +394 -64
- package/base/lib/actions/input/builder/value.js +542 -213
- package/base/lib/actions/input/builder/value.js.map +1 -1
- package/base/lib/actions/input/builder/variants.d.ts +27 -24
- package/base/lib/actions/input/builder/variants.js +25 -24
- package/base/lib/actions/input/builder/variants.js.map +1 -1
- package/base/lib/actions/input/inputSpecConstants.d.ts +25 -17
- package/base/lib/actions/input/inputSpecConstants.js +16 -12
- package/base/lib/actions/input/inputSpecConstants.js.map +1 -1
- package/base/lib/actions/input/inputSpecTypes.d.ts +0 -3
- package/base/lib/actions/input/inputSpecTypes.js.map +1 -1
- package/base/lib/actions/setupActions.d.ts +21 -15
- package/base/lib/actions/setupActions.js +42 -7
- package/base/lib/actions/setupActions.js.map +1 -1
- package/base/lib/dependencies/dependencies.d.ts +7 -3
- package/base/lib/dependencies/dependencies.js +34 -25
- package/base/lib/dependencies/dependencies.js.map +1 -1
- package/base/lib/dependencies/setupDependencies.d.ts +2 -4
- package/base/lib/dependencies/setupDependencies.js +3 -10
- package/base/lib/dependencies/setupDependencies.js.map +1 -1
- package/base/lib/exver/index.js +1 -1
- package/base/lib/exver/index.js.map +1 -1
- package/base/lib/index.d.ts +1 -0
- package/base/lib/index.js +2 -1
- package/base/lib/index.js.map +1 -1
- package/base/lib/inits/index.d.ts +2 -0
- package/base/lib/inits/index.js +19 -0
- package/base/lib/inits/index.js.map +1 -0
- package/base/lib/inits/setupInit.d.ts +9 -0
- package/base/lib/inits/setupInit.js +40 -0
- package/base/lib/inits/setupInit.js.map +1 -0
- package/base/lib/inits/setupUninit.d.ts +25 -0
- package/base/lib/inits/setupUninit.js +24 -0
- package/base/lib/inits/setupUninit.js.map +1 -0
- package/base/lib/interfaces/Host.js +18 -6
- package/base/lib/interfaces/Host.js.map +1 -1
- package/base/lib/interfaces/Origin.d.ts +2 -2
- package/base/lib/interfaces/Origin.js +3 -3
- package/base/lib/interfaces/Origin.js.map +1 -1
- package/base/lib/interfaces/ServiceInterfaceBuilder.d.ts +2 -2
- package/base/lib/interfaces/setupInterfaces.d.ts +2 -4
- package/base/lib/interfaces/setupInterfaces.js +8 -17
- package/base/lib/interfaces/setupInterfaces.js.map +1 -1
- package/base/lib/osBindings/ActionInput.d.ts +2 -0
- package/base/lib/osBindings/ActionInput.js +0 -1
- package/base/lib/osBindings/ActionInput.js.map +1 -1
- package/base/lib/osBindings/AddCategoryParams.d.ts +0 -2
- package/base/lib/osBindings/AddPackageToCategoryParams.d.ts +5 -0
- package/base/lib/osBindings/AddPackageToCategoryParams.js +3 -0
- package/base/lib/osBindings/AddPackageToCategoryParams.js.map +1 -0
- package/base/lib/osBindings/AddProxyParams.d.ts +5 -0
- package/base/lib/osBindings/AddProxyParams.js +4 -0
- package/base/lib/osBindings/AddProxyParams.js.map +1 -0
- package/base/lib/osBindings/AddTunnelParams.d.ts +5 -0
- package/base/lib/osBindings/AddTunnelParams.js +4 -0
- package/base/lib/osBindings/AddTunnelParams.js.map +1 -0
- package/base/lib/osBindings/AttachParams.d.ts +1 -0
- package/base/lib/osBindings/BindingGatewaySetEnabledParams.d.ts +6 -0
- package/base/lib/osBindings/BindingGatewaySetEnabledParams.js +3 -0
- package/base/lib/osBindings/BindingGatewaySetEnabledParams.js.map +1 -0
- package/base/lib/osBindings/Category.d.ts +0 -2
- package/base/lib/osBindings/Category.js +1 -0
- package/base/lib/osBindings/Category.js.map +1 -1
- package/base/lib/osBindings/CheckDependenciesResult.d.ts +3 -3
- package/base/lib/osBindings/ClearTasksParams.d.ts +5 -0
- package/base/lib/osBindings/ClearTasksParams.js +4 -0
- package/base/lib/osBindings/ClearTasksParams.js.map +1 -0
- package/base/lib/osBindings/CreateTaskParams.d.ts +15 -0
- package/base/lib/osBindings/CreateTaskParams.js +3 -0
- package/base/lib/osBindings/CreateTaskParams.js.map +1 -0
- package/base/lib/osBindings/DepInfo.d.ts +2 -3
- package/base/lib/osBindings/DnsSettings.d.ts +4 -0
- package/base/lib/osBindings/DnsSettings.js +4 -0
- package/base/lib/osBindings/DnsSettings.js.map +1 -0
- package/base/lib/osBindings/DomainConfig.d.ts +1 -0
- package/base/lib/osBindings/DomainSettings.d.ts +4 -0
- package/base/lib/osBindings/DomainSettings.js +3 -0
- package/base/lib/osBindings/DomainSettings.js.map +1 -0
- package/base/lib/osBindings/Domains.d.ts +7 -0
- package/base/lib/osBindings/Domains.js +3 -0
- package/base/lib/osBindings/Domains.js.map +1 -0
- package/base/lib/osBindings/EventId.d.ts +4 -0
- package/base/lib/osBindings/EventId.js +3 -0
- package/base/lib/osBindings/EventId.js.map +1 -0
- package/base/lib/osBindings/FileType.d.ts +1 -0
- package/base/lib/osBindings/FileType.js +4 -0
- package/base/lib/osBindings/FileType.js.map +1 -0
- package/base/lib/osBindings/ForgetGatewayParams.d.ts +4 -0
- package/base/lib/osBindings/ForgetGatewayParams.js +3 -0
- package/base/lib/osBindings/ForgetGatewayParams.js.map +1 -0
- package/base/lib/osBindings/ForgetInterfaceParams.d.ts +2 -1
- package/base/lib/osBindings/ForgetInterfaceParams.js +0 -1
- package/base/lib/osBindings/ForgetInterfaceParams.js.map +1 -1
- package/base/lib/osBindings/GatewayId.d.ts +1 -0
- package/base/lib/osBindings/GatewayId.js +4 -0
- package/base/lib/osBindings/GatewayId.js.map +1 -0
- package/base/lib/osBindings/GatewayInfo.d.ts +6 -0
- package/base/lib/osBindings/GatewayInfo.js +3 -0
- package/base/lib/osBindings/GatewayInfo.js.map +1 -0
- package/base/lib/osBindings/GetOsVersionParams.d.ts +3 -3
- package/base/lib/osBindings/GetPackageParams.d.ts +1 -1
- package/base/lib/osBindings/Host.d.ts +4 -3
- package/base/lib/osBindings/HostnameInfo.d.ts +2 -1
- package/base/lib/osBindings/IpHostname.d.ts +1 -2
- package/base/lib/osBindings/IpInfo.d.ts +2 -0
- package/base/lib/osBindings/LoginParams.d.ts +1 -2
- package/base/lib/osBindings/LoginParams.js +1 -0
- package/base/lib/osBindings/LoginParams.js.map +1 -1
- package/base/lib/osBindings/MainStatus.d.ts +0 -2
- package/base/lib/osBindings/Manifest.d.ts +3 -1
- package/base/lib/osBindings/Metadata.d.ts +5 -0
- package/base/lib/osBindings/Metadata.js +3 -0
- package/base/lib/osBindings/Metadata.js.map +1 -0
- package/base/lib/osBindings/MetadataSrc.d.ts +7 -0
- package/base/lib/osBindings/MetadataSrc.js +3 -0
- package/base/lib/osBindings/MetadataSrc.js.map +1 -0
- package/base/lib/osBindings/MountTarget.d.ts +2 -0
- package/base/lib/osBindings/NetInfo.d.ts +3 -1
- package/base/lib/osBindings/NetInfo.js +0 -1
- package/base/lib/osBindings/NetInfo.js.map +1 -1
- package/base/lib/osBindings/NetworkInfo.d.ts +5 -2
- package/base/lib/osBindings/NetworkInterfaceInfo.d.ts +3 -2
- package/base/lib/osBindings/NetworkInterfaceSetPublicParams.d.ts +2 -1
- package/base/lib/osBindings/NetworkInterfaceSetPublicParams.js +0 -1
- package/base/lib/osBindings/NetworkInterfaceSetPublicParams.js.map +1 -1
- package/base/lib/osBindings/PackageDataEntry.d.ts +5 -5
- package/base/lib/osBindings/PackageVersionInfo.d.ts +2 -0
- package/base/lib/osBindings/Progress.d.ts +2 -0
- package/base/lib/osBindings/Progress.js +0 -1
- package/base/lib/osBindings/Progress.js.map +1 -1
- package/base/lib/osBindings/ProgressUnits.d.ts +1 -0
- package/base/lib/osBindings/ProgressUnits.js +4 -0
- package/base/lib/osBindings/ProgressUnits.js.map +1 -0
- package/base/lib/osBindings/Proxies.d.ts +4 -0
- package/base/lib/osBindings/Proxies.js +3 -0
- package/base/lib/osBindings/Proxies.js.map +1 -0
- package/base/lib/osBindings/ProxyInfo.d.ts +4 -0
- package/base/lib/osBindings/ProxyInfo.js +4 -0
- package/base/lib/osBindings/ProxyInfo.js.map +1 -0
- package/base/lib/osBindings/PublicDomainConfig.d.ts +6 -0
- package/base/lib/osBindings/PublicDomainConfig.js +3 -0
- package/base/lib/osBindings/PublicDomainConfig.js.map +1 -0
- package/base/lib/osBindings/RemoveAdminParams.d.ts +4 -0
- package/base/lib/osBindings/RemoveAdminParams.js +3 -0
- package/base/lib/osBindings/RemoveAdminParams.js.map +1 -0
- package/base/lib/osBindings/RemoveAssetParams.d.ts +4 -0
- package/base/lib/osBindings/RemoveAssetParams.js +4 -0
- package/base/lib/osBindings/RemoveAssetParams.js.map +1 -0
- package/base/lib/osBindings/RemovePackageFromCategoryParams.d.ts +5 -0
- package/base/lib/osBindings/RemovePackageFromCategoryParams.js +3 -0
- package/base/lib/osBindings/RemovePackageFromCategoryParams.js.map +1 -0
- package/base/lib/osBindings/RemovePackageParams.d.ts +6 -0
- package/base/lib/osBindings/RemovePackageParams.js +3 -0
- package/base/lib/osBindings/RemovePackageParams.js.map +1 -0
- package/base/lib/osBindings/RemoveProxyParams.d.ts +3 -0
- package/base/lib/osBindings/RemoveProxyParams.js +4 -0
- package/base/lib/osBindings/RemoveProxyParams.js.map +1 -0
- package/base/lib/osBindings/RemoveTunnelParams.d.ts +4 -0
- package/base/lib/osBindings/RemoveTunnelParams.js +3 -0
- package/base/lib/osBindings/RemoveTunnelParams.js.map +1 -0
- package/base/lib/osBindings/RenameGatewayParams.d.ts +5 -0
- package/base/lib/osBindings/RenameGatewayParams.js +3 -0
- package/base/lib/osBindings/RenameGatewayParams.js.map +1 -0
- package/base/lib/osBindings/RenameInterfaceParams.d.ts +5 -0
- package/base/lib/osBindings/RenameInterfaceParams.js +3 -0
- package/base/lib/osBindings/RenameInterfaceParams.js.map +1 -0
- package/base/lib/osBindings/ServerInfo.d.ts +2 -1
- package/base/lib/osBindings/Sessions.d.ts +2 -5
- package/base/lib/osBindings/Sessions.js +0 -1
- package/base/lib/osBindings/Sessions.js.map +1 -1
- package/base/lib/osBindings/SetupExecuteParams.d.ts +1 -0
- package/base/lib/osBindings/Task.d.ts +13 -0
- package/base/lib/osBindings/Task.js +3 -0
- package/base/lib/osBindings/Task.js.map +1 -0
- package/base/lib/osBindings/TaskCondition.d.ts +1 -0
- package/base/lib/osBindings/TaskCondition.js +4 -0
- package/base/lib/osBindings/TaskCondition.js.map +1 -0
- package/base/lib/osBindings/TaskEntry.d.ts +5 -0
- package/base/lib/osBindings/TaskEntry.js +3 -0
- package/base/lib/osBindings/TaskEntry.js.map +1 -0
- package/base/lib/osBindings/TaskInput.d.ts +4 -0
- package/base/lib/osBindings/TaskInput.js +4 -0
- package/base/lib/osBindings/TaskInput.js.map +1 -0
- package/base/lib/osBindings/TaskSeverity.d.ts +1 -0
- package/base/lib/osBindings/TaskSeverity.js +4 -0
- package/base/lib/osBindings/TaskSeverity.js.map +1 -0
- package/base/lib/osBindings/TaskTrigger.d.ts +5 -0
- package/base/lib/osBindings/TaskTrigger.js +3 -0
- package/base/lib/osBindings/TaskTrigger.js.map +1 -0
- package/base/lib/osBindings/UnsetInboundParams.d.ts +2 -1
- package/base/lib/osBindings/UnsetInboundParams.js +0 -1
- package/base/lib/osBindings/UnsetInboundParams.js.map +1 -1
- package/base/lib/osBindings/UnsetPublicParams.d.ts +2 -1
- package/base/lib/osBindings/UnsetPublicParams.js +0 -1
- package/base/lib/osBindings/UnsetPublicParams.js.map +1 -1
- package/base/lib/osBindings/UpdatingState.d.ts +1 -0
- package/base/lib/osBindings/index.d.ts +30 -18
- package/base/lib/s9pk/index.d.ts +2 -3
- package/base/lib/s9pk/index.js +9 -15
- package/base/lib/s9pk/index.js.map +1 -1
- package/base/lib/types/ManifestTypes.d.ts +4 -0
- package/base/lib/types.d.ts +23 -34
- package/base/lib/types.js +13 -0
- package/base/lib/types.js.map +1 -1
- package/base/lib/util/Drop.d.ts +47 -0
- package/base/lib/util/Drop.js +130 -0
- package/base/lib/util/Drop.js.map +1 -0
- package/base/lib/util/GetSystemSmtp.d.ts +11 -2
- package/base/lib/util/GetSystemSmtp.js +33 -7
- package/base/lib/util/GetSystemSmtp.js.map +1 -1
- package/base/lib/util/deepMerge.js +6 -1
- package/base/lib/util/deepMerge.js.map +1 -1
- package/base/lib/util/getServiceInterface.d.ts +53 -5
- package/base/lib/util/getServiceInterface.js +54 -19
- package/base/lib/util/getServiceInterface.js.map +1 -1
- package/base/lib/util/getServiceInterfaces.d.ts +11 -2
- package/base/lib/util/getServiceInterfaces.js +33 -7
- package/base/lib/util/getServiceInterfaces.js.map +1 -1
- package/base/lib/util/graph.d.ts +1 -0
- package/base/lib/util/graph.js +12 -0
- package/base/lib/util/graph.js.map +1 -1
- package/base/lib/util/index.d.ts +1 -2
- package/base/lib/util/index.js +5 -8
- package/base/lib/util/index.js.map +1 -1
- package/base/lib/util/ip.d.ts +19 -0
- package/base/lib/util/ip.js +92 -0
- package/base/lib/util/ip.js.map +1 -0
- package/package/lib/StartSdk.d.ts +116 -572
- package/package/lib/StartSdk.js +111 -435
- package/package/lib/StartSdk.js.map +1 -1
- package/package/lib/backup/Backups.d.ts +9 -3
- package/package/lib/backup/Backups.js +38 -28
- package/package/lib/backup/Backups.js.map +1 -1
- package/package/lib/backup/setupBackups.d.ts +5 -2
- package/package/lib/backup/setupBackups.js +7 -5
- package/package/lib/backup/setupBackups.js.map +1 -1
- package/package/lib/health/HealthCheck.d.ts +0 -1
- package/package/lib/health/HealthCheck.js +1 -7
- package/package/lib/health/HealthCheck.js.map +1 -1
- package/package/lib/health/checkFns/runHealthScript.js +1 -1
- package/package/lib/health/checkFns/runHealthScript.js.map +1 -1
- package/package/lib/index.d.ts +0 -3
- package/package/lib/index.js +1 -8
- package/package/lib/index.js.map +1 -1
- package/package/lib/inits/index.d.ts +2 -3
- package/package/lib/inits/index.js +16 -3
- package/package/lib/inits/index.js.map +1 -1
- package/package/lib/inits/setupInit.d.ts +7 -13
- package/package/lib/inits/setupInit.js +22 -48
- package/package/lib/inits/setupInit.js.map +1 -1
- package/package/lib/inits/setupInstall.d.ts +10 -10
- package/package/lib/inits/setupInstall.js.map +1 -1
- package/package/lib/inits/setupUninit.d.ts +7 -0
- package/package/lib/inits/setupUninit.js +14 -0
- package/package/lib/inits/setupUninit.js.map +1 -0
- package/package/lib/inits/setupUninstall.d.ts +5 -5
- package/package/lib/inits/setupUninstall.js.map +1 -1
- package/package/lib/mainFn/CommandController.d.ts +6 -22
- package/package/lib/mainFn/CommandController.js +68 -41
- package/package/lib/mainFn/CommandController.js.map +1 -1
- package/package/lib/mainFn/Daemon.d.ts +15 -20
- package/package/lib/mainFn/Daemon.js +71 -17
- package/package/lib/mainFn/Daemon.js.map +1 -1
- package/package/lib/mainFn/Daemons.d.ts +76 -45
- package/package/lib/mainFn/Daemons.js +104 -30
- package/package/lib/mainFn/Daemons.js.map +1 -1
- package/package/lib/mainFn/HealthDaemon.d.ts +6 -5
- package/package/lib/mainFn/HealthDaemon.js +79 -38
- package/package/lib/mainFn/HealthDaemon.js.map +1 -1
- package/package/lib/mainFn/Mounts.d.ts +32 -45
- package/package/lib/mainFn/Mounts.js +13 -55
- package/package/lib/mainFn/Mounts.js.map +1 -1
- package/package/lib/mainFn/Oneshot.d.ts +12 -0
- package/package/lib/mainFn/Oneshot.js +23 -0
- package/package/lib/mainFn/Oneshot.js.map +1 -0
- package/package/lib/mainFn/index.d.ts +1 -1
- package/package/lib/manifest/setupManifest.js +3 -0
- package/package/lib/manifest/setupManifest.js.map +1 -1
- package/package/lib/test/host.test.js +1 -1
- package/package/lib/test/host.test.js.map +1 -1
- package/package/lib/test/inputSpecBuilder.test.js +153 -158
- package/package/lib/test/inputSpecBuilder.test.js.map +1 -1
- package/package/lib/test/output.d.ts +8 -37
- package/package/lib/test/output.js +41 -40
- package/package/lib/test/output.js.map +1 -1
- package/package/lib/test/output.sdk.d.ts +154 -949
- package/package/lib/test/output.sdk.js +1 -4
- package/package/lib/test/output.sdk.js.map +1 -1
- package/package/lib/test/output.test.js +12 -8
- package/package/lib/test/output.test.js.map +1 -1
- package/package/lib/util/Drop.d.ts +4 -2
- package/package/lib/util/Drop.js +29 -7
- package/package/lib/util/Drop.js.map +1 -1
- package/package/lib/util/GetSslCertificate.d.ts +11 -2
- package/package/lib/util/GetSslCertificate.js +33 -7
- package/package/lib/util/GetSslCertificate.js.map +1 -1
- package/package/lib/util/SubContainer.d.ts +131 -37
- package/package/lib/util/SubContainer.js +155 -42
- package/package/lib/util/SubContainer.js.map +1 -1
- package/package/lib/util/fileHelper.d.ts +50 -17
- package/package/lib/util/fileHelper.js +166 -52
- package/package/lib/util/fileHelper.js.map +1 -1
- package/package/lib/util/index.d.ts +1 -2
- package/package/lib/util/index.js +2 -4
- package/package/lib/util/index.js.map +1 -1
- package/package/lib/version/VersionGraph.d.ts +27 -5
- package/package/lib/version/VersionGraph.js +110 -24
- package/package/lib/version/VersionGraph.js.map +1 -1
- package/package/lib/version/VersionInfo.d.ts +8 -3
- package/package/lib/version/VersionInfo.js.map +1 -1
- package/package/package.json +63 -0
- package/package/scripts/oldSpecToBuilder.js +5 -4
- package/package/scripts/oldSpecToBuilder.js.map +1 -1
- package/package.json +7 -8
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Value = void 0;
|
|
3
|
+
exports.Value = exports.fileInfoParser = void 0;
|
|
4
4
|
const util_1 = require("../../../util");
|
|
5
5
|
const ts_matches_1 = require("ts-matches");
|
|
6
|
+
exports.fileInfoParser = (0, ts_matches_1.object)({
|
|
7
|
+
path: ts_matches_1.string,
|
|
8
|
+
commitment: (0, ts_matches_1.object)({ hash: ts_matches_1.string, size: ts_matches_1.number }),
|
|
9
|
+
});
|
|
6
10
|
const testForAsRequiredParser = (0, util_1.once)(() => (0, ts_matches_1.object)({ required: (0, ts_matches_1.literal)(true) }).test);
|
|
7
11
|
function asRequiredParser(parser, input) {
|
|
8
12
|
if (testForAsRequiredParser()(input))
|
|
@@ -16,47 +20,78 @@ class Value {
|
|
|
16
20
|
this._TYPE = null;
|
|
17
21
|
this._PARTIAL = null;
|
|
18
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* @description Displays a boolean toggle to enable/disable
|
|
25
|
+
* @example
|
|
26
|
+
* ```
|
|
27
|
+
toggleExample: Value.toggle({
|
|
28
|
+
// required
|
|
29
|
+
name: 'Toggle Example',
|
|
30
|
+
default: true,
|
|
31
|
+
|
|
32
|
+
// optional
|
|
33
|
+
description: null,
|
|
34
|
+
warning: null,
|
|
35
|
+
immutable: false,
|
|
36
|
+
}),
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
19
39
|
static toggle(a) {
|
|
40
|
+
const validator = ts_matches_1.boolean;
|
|
20
41
|
return new Value(async () => ({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
42
|
+
spec: {
|
|
43
|
+
description: null,
|
|
44
|
+
warning: null,
|
|
45
|
+
type: "toggle",
|
|
46
|
+
disabled: false,
|
|
47
|
+
immutable: a.immutable ?? false,
|
|
48
|
+
...a,
|
|
49
|
+
},
|
|
50
|
+
validator,
|
|
51
|
+
}), validator);
|
|
28
52
|
}
|
|
29
53
|
static dynamicToggle(a) {
|
|
54
|
+
const validator = ts_matches_1.boolean;
|
|
30
55
|
return new Value(async (options) => ({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
56
|
+
spec: {
|
|
57
|
+
description: null,
|
|
58
|
+
warning: null,
|
|
59
|
+
type: "toggle",
|
|
60
|
+
disabled: false,
|
|
61
|
+
immutable: false,
|
|
62
|
+
...(await a(options)),
|
|
63
|
+
},
|
|
64
|
+
validator,
|
|
65
|
+
}), validator);
|
|
38
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* @description Displays a text input field
|
|
69
|
+
* @example
|
|
70
|
+
* ```
|
|
71
|
+
textExample: Value.text({
|
|
72
|
+
// required
|
|
73
|
+
name: 'Text Example',
|
|
74
|
+
required: false,
|
|
75
|
+
default: null,
|
|
76
|
+
|
|
77
|
+
// optional
|
|
78
|
+
description: null,
|
|
79
|
+
placeholder: null,
|
|
80
|
+
warning: null,
|
|
81
|
+
generate: null,
|
|
82
|
+
inputmode: 'text',
|
|
83
|
+
masked: false,
|
|
84
|
+
minLength: null,
|
|
85
|
+
maxLength: null,
|
|
86
|
+
patterns: [],
|
|
87
|
+
immutable: false,
|
|
88
|
+
}),
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
39
91
|
static text(a) {
|
|
92
|
+
const validator = asRequiredParser(ts_matches_1.string, a);
|
|
40
93
|
return new Value(async () => ({
|
|
41
|
-
|
|
42
|
-
description: null,
|
|
43
|
-
warning: null,
|
|
44
|
-
masked: false,
|
|
45
|
-
placeholder: null,
|
|
46
|
-
minLength: null,
|
|
47
|
-
maxLength: null,
|
|
48
|
-
patterns: [],
|
|
49
|
-
inputmode: "text",
|
|
50
|
-
disabled: false,
|
|
51
|
-
immutable: a.immutable ?? false,
|
|
52
|
-
generate: a.generate ?? null,
|
|
53
|
-
...a,
|
|
54
|
-
}), asRequiredParser(ts_matches_1.string, a));
|
|
55
|
-
}
|
|
56
|
-
static dynamicText(getA) {
|
|
57
|
-
return new Value(async (options) => {
|
|
58
|
-
const a = await getA(options);
|
|
59
|
-
return {
|
|
94
|
+
spec: {
|
|
60
95
|
type: "text",
|
|
61
96
|
description: null,
|
|
62
97
|
warning: null,
|
|
@@ -67,13 +102,58 @@ class Value {
|
|
|
67
102
|
patterns: [],
|
|
68
103
|
inputmode: "text",
|
|
69
104
|
disabled: false,
|
|
70
|
-
immutable: false,
|
|
105
|
+
immutable: a.immutable ?? false,
|
|
71
106
|
generate: a.generate ?? null,
|
|
72
107
|
...a,
|
|
108
|
+
},
|
|
109
|
+
validator,
|
|
110
|
+
}), validator);
|
|
111
|
+
}
|
|
112
|
+
static dynamicText(getA) {
|
|
113
|
+
return new Value(async (options) => {
|
|
114
|
+
const a = await getA(options);
|
|
115
|
+
return {
|
|
116
|
+
spec: {
|
|
117
|
+
type: "text",
|
|
118
|
+
description: null,
|
|
119
|
+
warning: null,
|
|
120
|
+
masked: false,
|
|
121
|
+
placeholder: null,
|
|
122
|
+
minLength: null,
|
|
123
|
+
maxLength: null,
|
|
124
|
+
patterns: [],
|
|
125
|
+
inputmode: "text",
|
|
126
|
+
disabled: false,
|
|
127
|
+
immutable: false,
|
|
128
|
+
generate: a.generate ?? null,
|
|
129
|
+
...a,
|
|
130
|
+
},
|
|
131
|
+
validator: asRequiredParser(ts_matches_1.string, a),
|
|
73
132
|
};
|
|
74
133
|
}, ts_matches_1.string.nullable());
|
|
75
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* @description Displays a large textarea field for long form entry.
|
|
137
|
+
* @example
|
|
138
|
+
* ```
|
|
139
|
+
textareaExample: Value.textarea({
|
|
140
|
+
// required
|
|
141
|
+
name: 'Textarea Example',
|
|
142
|
+
required: false,
|
|
143
|
+
default: null,
|
|
144
|
+
|
|
145
|
+
// optional
|
|
146
|
+
description: null,
|
|
147
|
+
placeholder: null,
|
|
148
|
+
warning: null,
|
|
149
|
+
minLength: null,
|
|
150
|
+
maxLength: null,
|
|
151
|
+
immutable: false,
|
|
152
|
+
}),
|
|
153
|
+
* ```
|
|
154
|
+
*/
|
|
76
155
|
static textarea(a) {
|
|
156
|
+
const validator = asRequiredParser(ts_matches_1.string, a);
|
|
77
157
|
return new Value(async () => {
|
|
78
158
|
const built = {
|
|
79
159
|
description: null,
|
|
@@ -86,44 +166,55 @@ class Value {
|
|
|
86
166
|
immutable: a.immutable ?? false,
|
|
87
167
|
...a,
|
|
88
168
|
};
|
|
89
|
-
return built;
|
|
90
|
-
},
|
|
169
|
+
return { spec: built, validator };
|
|
170
|
+
}, validator);
|
|
91
171
|
}
|
|
92
172
|
static dynamicTextarea(getA) {
|
|
93
173
|
return new Value(async (options) => {
|
|
94
174
|
const a = await getA(options);
|
|
95
175
|
return {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
176
|
+
spec: {
|
|
177
|
+
description: null,
|
|
178
|
+
warning: null,
|
|
179
|
+
minLength: null,
|
|
180
|
+
maxLength: null,
|
|
181
|
+
placeholder: null,
|
|
182
|
+
type: "textarea",
|
|
183
|
+
disabled: false,
|
|
184
|
+
immutable: false,
|
|
185
|
+
...a,
|
|
186
|
+
},
|
|
187
|
+
validator: asRequiredParser(ts_matches_1.string, a),
|
|
105
188
|
};
|
|
106
189
|
}, ts_matches_1.string.nullable());
|
|
107
190
|
}
|
|
191
|
+
/**
|
|
192
|
+
* @description Displays a number input field
|
|
193
|
+
* @example
|
|
194
|
+
* ```
|
|
195
|
+
numberExample: Value.number({
|
|
196
|
+
// required
|
|
197
|
+
name: 'Number Example',
|
|
198
|
+
required: false,
|
|
199
|
+
default: null,
|
|
200
|
+
integer: true,
|
|
201
|
+
|
|
202
|
+
// optional
|
|
203
|
+
description: null,
|
|
204
|
+
placeholder: null,
|
|
205
|
+
warning: null,
|
|
206
|
+
min: null,
|
|
207
|
+
max: null,
|
|
208
|
+
immutable: false,
|
|
209
|
+
step: null,
|
|
210
|
+
units: null,
|
|
211
|
+
}),
|
|
212
|
+
* ```
|
|
213
|
+
*/
|
|
108
214
|
static number(a) {
|
|
215
|
+
const validator = asRequiredParser(ts_matches_1.number, a);
|
|
109
216
|
return new Value(() => ({
|
|
110
|
-
|
|
111
|
-
description: null,
|
|
112
|
-
warning: null,
|
|
113
|
-
min: null,
|
|
114
|
-
max: null,
|
|
115
|
-
step: null,
|
|
116
|
-
units: null,
|
|
117
|
-
placeholder: null,
|
|
118
|
-
disabled: false,
|
|
119
|
-
immutable: a.immutable ?? false,
|
|
120
|
-
...a,
|
|
121
|
-
}), asRequiredParser(ts_matches_1.number, a));
|
|
122
|
-
}
|
|
123
|
-
static dynamicNumber(getA) {
|
|
124
|
-
return new Value(async (options) => {
|
|
125
|
-
const a = await getA(options);
|
|
126
|
-
return {
|
|
217
|
+
spec: {
|
|
127
218
|
type: "number",
|
|
128
219
|
description: null,
|
|
129
220
|
warning: null,
|
|
@@ -133,232 +224,470 @@ class Value {
|
|
|
133
224
|
units: null,
|
|
134
225
|
placeholder: null,
|
|
135
226
|
disabled: false,
|
|
136
|
-
immutable: false,
|
|
227
|
+
immutable: a.immutable ?? false,
|
|
137
228
|
...a,
|
|
229
|
+
},
|
|
230
|
+
validator,
|
|
231
|
+
}), validator);
|
|
232
|
+
}
|
|
233
|
+
static dynamicNumber(getA) {
|
|
234
|
+
return new Value(async (options) => {
|
|
235
|
+
const a = await getA(options);
|
|
236
|
+
return {
|
|
237
|
+
spec: {
|
|
238
|
+
type: "number",
|
|
239
|
+
description: null,
|
|
240
|
+
warning: null,
|
|
241
|
+
min: null,
|
|
242
|
+
max: null,
|
|
243
|
+
step: null,
|
|
244
|
+
units: null,
|
|
245
|
+
placeholder: null,
|
|
246
|
+
disabled: false,
|
|
247
|
+
immutable: false,
|
|
248
|
+
...a,
|
|
249
|
+
},
|
|
250
|
+
validator: asRequiredParser(ts_matches_1.number, a),
|
|
138
251
|
};
|
|
139
252
|
}, ts_matches_1.number.nullable());
|
|
140
253
|
}
|
|
254
|
+
/**
|
|
255
|
+
* @description Displays a browser-native color selector.
|
|
256
|
+
* @example
|
|
257
|
+
* ```
|
|
258
|
+
colorExample: Value.color({
|
|
259
|
+
// required
|
|
260
|
+
name: 'Color Example',
|
|
261
|
+
required: false,
|
|
262
|
+
default: null,
|
|
263
|
+
|
|
264
|
+
// optional
|
|
265
|
+
description: null,
|
|
266
|
+
warning: null,
|
|
267
|
+
immutable: false,
|
|
268
|
+
}),
|
|
269
|
+
* ```
|
|
270
|
+
*/
|
|
141
271
|
static color(a) {
|
|
272
|
+
const validator = asRequiredParser(ts_matches_1.string, a);
|
|
142
273
|
return new Value(() => ({
|
|
143
|
-
|
|
144
|
-
description: null,
|
|
145
|
-
warning: null,
|
|
146
|
-
disabled: false,
|
|
147
|
-
immutable: a.immutable ?? false,
|
|
148
|
-
...a,
|
|
149
|
-
}), asRequiredParser(ts_matches_1.string, a));
|
|
150
|
-
}
|
|
151
|
-
static dynamicColor(getA) {
|
|
152
|
-
return new Value(async (options) => {
|
|
153
|
-
const a = await getA(options);
|
|
154
|
-
return {
|
|
274
|
+
spec: {
|
|
155
275
|
type: "color",
|
|
156
276
|
description: null,
|
|
157
277
|
warning: null,
|
|
158
278
|
disabled: false,
|
|
159
|
-
immutable: false,
|
|
279
|
+
immutable: a.immutable ?? false,
|
|
160
280
|
...a,
|
|
281
|
+
},
|
|
282
|
+
validator,
|
|
283
|
+
}), validator);
|
|
284
|
+
}
|
|
285
|
+
static dynamicColor(getA) {
|
|
286
|
+
return new Value(async (options) => {
|
|
287
|
+
const a = await getA(options);
|
|
288
|
+
return {
|
|
289
|
+
spec: {
|
|
290
|
+
type: "color",
|
|
291
|
+
description: null,
|
|
292
|
+
warning: null,
|
|
293
|
+
disabled: false,
|
|
294
|
+
immutable: false,
|
|
295
|
+
...a,
|
|
296
|
+
},
|
|
297
|
+
validator: asRequiredParser(ts_matches_1.string, a),
|
|
161
298
|
};
|
|
162
299
|
}, ts_matches_1.string.nullable());
|
|
163
300
|
}
|
|
301
|
+
/**
|
|
302
|
+
* @description Displays a browser-native date/time selector.
|
|
303
|
+
* @example
|
|
304
|
+
* ```
|
|
305
|
+
datetimeExample: Value.datetime({
|
|
306
|
+
// required
|
|
307
|
+
name: 'Datetime Example',
|
|
308
|
+
required: false,
|
|
309
|
+
default: null,
|
|
310
|
+
|
|
311
|
+
// optional
|
|
312
|
+
description: null,
|
|
313
|
+
warning: null,
|
|
314
|
+
immutable: false,
|
|
315
|
+
inputmode: 'datetime-local',
|
|
316
|
+
min: null,
|
|
317
|
+
max: null,
|
|
318
|
+
}),
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
164
321
|
static datetime(a) {
|
|
322
|
+
const validator = asRequiredParser(ts_matches_1.string, a);
|
|
165
323
|
return new Value(() => ({
|
|
166
|
-
|
|
167
|
-
description: null,
|
|
168
|
-
warning: null,
|
|
169
|
-
inputmode: "datetime-local",
|
|
170
|
-
min: null,
|
|
171
|
-
max: null,
|
|
172
|
-
step: null,
|
|
173
|
-
disabled: false,
|
|
174
|
-
immutable: a.immutable ?? false,
|
|
175
|
-
...a,
|
|
176
|
-
}), asRequiredParser(ts_matches_1.string, a));
|
|
177
|
-
}
|
|
178
|
-
static dynamicDatetime(getA) {
|
|
179
|
-
return new Value(async (options) => {
|
|
180
|
-
const a = await getA(options);
|
|
181
|
-
return {
|
|
324
|
+
spec: {
|
|
182
325
|
type: "datetime",
|
|
183
326
|
description: null,
|
|
184
327
|
warning: null,
|
|
185
328
|
inputmode: "datetime-local",
|
|
186
329
|
min: null,
|
|
187
330
|
max: null,
|
|
331
|
+
step: null,
|
|
188
332
|
disabled: false,
|
|
189
|
-
immutable: false,
|
|
333
|
+
immutable: a.immutable ?? false,
|
|
190
334
|
...a,
|
|
335
|
+
},
|
|
336
|
+
validator,
|
|
337
|
+
}), validator);
|
|
338
|
+
}
|
|
339
|
+
static dynamicDatetime(getA) {
|
|
340
|
+
return new Value(async (options) => {
|
|
341
|
+
const a = await getA(options);
|
|
342
|
+
return {
|
|
343
|
+
spec: {
|
|
344
|
+
type: "datetime",
|
|
345
|
+
description: null,
|
|
346
|
+
warning: null,
|
|
347
|
+
inputmode: "datetime-local",
|
|
348
|
+
min: null,
|
|
349
|
+
max: null,
|
|
350
|
+
disabled: false,
|
|
351
|
+
immutable: false,
|
|
352
|
+
...a,
|
|
353
|
+
},
|
|
354
|
+
validator: asRequiredParser(ts_matches_1.string, a),
|
|
191
355
|
};
|
|
192
356
|
}, ts_matches_1.string.nullable());
|
|
193
357
|
}
|
|
358
|
+
/**
|
|
359
|
+
* @description Displays a select modal with radio buttons, allowing for a single selection.
|
|
360
|
+
* @example
|
|
361
|
+
* ```
|
|
362
|
+
selectExample: Value.select({
|
|
363
|
+
// required
|
|
364
|
+
name: 'Select Example',
|
|
365
|
+
default: 'radio1',
|
|
366
|
+
values: {
|
|
367
|
+
radio1: 'Radio 1',
|
|
368
|
+
radio2: 'Radio 2',
|
|
369
|
+
},
|
|
370
|
+
|
|
371
|
+
// optional
|
|
372
|
+
description: null,
|
|
373
|
+
warning: null,
|
|
374
|
+
immutable: false,
|
|
375
|
+
disabled: false,
|
|
376
|
+
}),
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
194
379
|
static select(a) {
|
|
380
|
+
const validator = (0, ts_matches_1.anyOf)(...Object.keys(a.values).map((x) => (0, ts_matches_1.literal)(x)));
|
|
195
381
|
return new Value(() => ({
|
|
196
|
-
|
|
197
|
-
warning: null,
|
|
198
|
-
type: "select",
|
|
199
|
-
disabled: false,
|
|
200
|
-
immutable: a.immutable ?? false,
|
|
201
|
-
...a,
|
|
202
|
-
}), (0, ts_matches_1.anyOf)(...Object.keys(a.values).map((x) => (0, ts_matches_1.literal)(x))));
|
|
203
|
-
}
|
|
204
|
-
static dynamicSelect(getA) {
|
|
205
|
-
return new Value(async (options) => {
|
|
206
|
-
const a = await getA(options);
|
|
207
|
-
return {
|
|
382
|
+
spec: {
|
|
208
383
|
description: null,
|
|
209
384
|
warning: null,
|
|
210
385
|
type: "select",
|
|
211
386
|
disabled: false,
|
|
212
|
-
immutable: false,
|
|
387
|
+
immutable: a.immutable ?? false,
|
|
213
388
|
...a,
|
|
389
|
+
},
|
|
390
|
+
validator,
|
|
391
|
+
}), validator);
|
|
392
|
+
}
|
|
393
|
+
static dynamicSelect(getA) {
|
|
394
|
+
return new Value(async (options) => {
|
|
395
|
+
const a = await getA(options);
|
|
396
|
+
return {
|
|
397
|
+
spec: {
|
|
398
|
+
description: null,
|
|
399
|
+
warning: null,
|
|
400
|
+
type: "select",
|
|
401
|
+
disabled: false,
|
|
402
|
+
immutable: false,
|
|
403
|
+
...a,
|
|
404
|
+
},
|
|
405
|
+
validator: (0, ts_matches_1.anyOf)(...Object.keys(a.values).map((x) => (0, ts_matches_1.literal)(x))),
|
|
214
406
|
};
|
|
215
407
|
}, ts_matches_1.string);
|
|
216
408
|
}
|
|
409
|
+
/**
|
|
410
|
+
* @description Displays a select modal with checkboxes, allowing for multiple selections.
|
|
411
|
+
* @example
|
|
412
|
+
* ```
|
|
413
|
+
multiselectExample: Value.multiselect({
|
|
414
|
+
// required
|
|
415
|
+
name: 'Multiselect Example',
|
|
416
|
+
values: {
|
|
417
|
+
option1: 'Option 1',
|
|
418
|
+
option2: 'Option 2',
|
|
419
|
+
},
|
|
420
|
+
default: [],
|
|
421
|
+
|
|
422
|
+
// optional
|
|
423
|
+
description: null,
|
|
424
|
+
warning: null,
|
|
425
|
+
immutable: false,
|
|
426
|
+
disabled: false,
|
|
427
|
+
minlength: null,
|
|
428
|
+
maxLength: null,
|
|
429
|
+
}),
|
|
430
|
+
* ```
|
|
431
|
+
*/
|
|
217
432
|
static multiselect(a) {
|
|
433
|
+
const validator = (0, ts_matches_1.arrayOf)((0, ts_matches_1.literals)(...Object.keys(a.values)));
|
|
218
434
|
return new Value(() => ({
|
|
219
|
-
|
|
220
|
-
minLength: null,
|
|
221
|
-
maxLength: null,
|
|
222
|
-
warning: null,
|
|
223
|
-
description: null,
|
|
224
|
-
disabled: false,
|
|
225
|
-
immutable: a.immutable ?? false,
|
|
226
|
-
...a,
|
|
227
|
-
}), (0, ts_matches_1.arrayOf)((0, ts_matches_1.literals)(...Object.keys(a.values))));
|
|
228
|
-
}
|
|
229
|
-
static dynamicMultiselect(getA) {
|
|
230
|
-
return new Value(async (options) => {
|
|
231
|
-
const a = await getA(options);
|
|
232
|
-
return {
|
|
435
|
+
spec: {
|
|
233
436
|
type: "multiselect",
|
|
234
437
|
minLength: null,
|
|
235
438
|
maxLength: null,
|
|
236
439
|
warning: null,
|
|
237
440
|
description: null,
|
|
238
441
|
disabled: false,
|
|
239
|
-
immutable: false,
|
|
442
|
+
immutable: a.immutable ?? false,
|
|
240
443
|
...a,
|
|
444
|
+
},
|
|
445
|
+
validator,
|
|
446
|
+
}), validator);
|
|
447
|
+
}
|
|
448
|
+
static dynamicMultiselect(getA) {
|
|
449
|
+
return new Value(async (options) => {
|
|
450
|
+
const a = await getA(options);
|
|
451
|
+
return {
|
|
452
|
+
spec: {
|
|
453
|
+
type: "multiselect",
|
|
454
|
+
minLength: null,
|
|
455
|
+
maxLength: null,
|
|
456
|
+
warning: null,
|
|
457
|
+
description: null,
|
|
458
|
+
disabled: false,
|
|
459
|
+
immutable: false,
|
|
460
|
+
...a,
|
|
461
|
+
},
|
|
462
|
+
validator: (0, ts_matches_1.arrayOf)((0, ts_matches_1.literals)(...Object.keys(a.values))),
|
|
241
463
|
};
|
|
242
464
|
}, (0, ts_matches_1.arrayOf)(ts_matches_1.string));
|
|
243
465
|
}
|
|
466
|
+
/**
|
|
467
|
+
* @description Display a collapsable grouping of additional fields, a "sub form". The second value is the inputSpec spec for the sub form.
|
|
468
|
+
* @example
|
|
469
|
+
* ```
|
|
470
|
+
objectExample: Value.object(
|
|
471
|
+
{
|
|
472
|
+
// required
|
|
473
|
+
name: 'Object Example',
|
|
474
|
+
|
|
475
|
+
// optional
|
|
476
|
+
description: null,
|
|
477
|
+
warning: null,
|
|
478
|
+
},
|
|
479
|
+
InputSpec.of({}),
|
|
480
|
+
),
|
|
481
|
+
* ```
|
|
482
|
+
*/
|
|
244
483
|
static object(a, spec) {
|
|
245
484
|
return new Value(async (options) => {
|
|
246
485
|
const built = await spec.build(options);
|
|
247
486
|
return {
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
487
|
+
spec: {
|
|
488
|
+
type: "object",
|
|
489
|
+
description: null,
|
|
490
|
+
warning: null,
|
|
491
|
+
...a,
|
|
492
|
+
spec: built.spec,
|
|
493
|
+
},
|
|
494
|
+
validator: built.validator,
|
|
253
495
|
};
|
|
254
496
|
}, spec.validator);
|
|
255
497
|
}
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
// extensions: string[]
|
|
260
|
-
// required: Required
|
|
261
|
-
// }) {
|
|
262
|
-
// const buildValue = {
|
|
263
|
-
// type: "file" as const,
|
|
264
|
-
// description: null,
|
|
265
|
-
// warning: null,
|
|
266
|
-
// ...a,
|
|
267
|
-
// }
|
|
268
|
-
// return new Value<AsRequired<FilePath, Required>, Store>(
|
|
269
|
-
// () => ({
|
|
270
|
-
// ...buildValue,
|
|
271
|
-
// }),
|
|
272
|
-
// asRequiredParser(object({ filePath: string }), a),
|
|
273
|
-
// )
|
|
274
|
-
// }
|
|
275
|
-
// static dynamicFile<Store>(
|
|
276
|
-
// a: LazyBuild<
|
|
277
|
-
// Store,
|
|
278
|
-
// {
|
|
279
|
-
// name: string
|
|
280
|
-
// description?: string | null
|
|
281
|
-
// warning?: string | null
|
|
282
|
-
// extensions: string[]
|
|
283
|
-
// required: boolean
|
|
284
|
-
// }
|
|
285
|
-
// >,
|
|
286
|
-
// ) {
|
|
287
|
-
// return new Value<FilePath | null, Store>(
|
|
288
|
-
// async (options) => ({
|
|
289
|
-
// type: "file" as const,
|
|
290
|
-
// description: null,
|
|
291
|
-
// warning: null,
|
|
292
|
-
// ...(await a(options)),
|
|
293
|
-
// }),
|
|
294
|
-
// object({ filePath: string }).nullable(),
|
|
295
|
-
// )
|
|
296
|
-
// }
|
|
297
|
-
static union(a, aVariants) {
|
|
298
|
-
return new Value(async (options) => ({
|
|
299
|
-
type: "union",
|
|
498
|
+
static file(a) {
|
|
499
|
+
const buildValue = {
|
|
500
|
+
type: "file",
|
|
300
501
|
description: null,
|
|
301
502
|
warning: null,
|
|
302
|
-
disabled: false,
|
|
303
503
|
...a,
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
504
|
+
};
|
|
505
|
+
return new Value(() => ({
|
|
506
|
+
spec: {
|
|
507
|
+
...buildValue,
|
|
508
|
+
},
|
|
509
|
+
validator: asRequiredParser(exports.fileInfoParser, a),
|
|
510
|
+
}), asRequiredParser(exports.fileInfoParser, a));
|
|
307
511
|
}
|
|
308
|
-
static
|
|
309
|
-
return new Value(async (options) =>
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
512
|
+
static dynamicFile(a) {
|
|
513
|
+
return new Value(async (options) => {
|
|
514
|
+
const spec = {
|
|
515
|
+
type: "file",
|
|
516
|
+
description: null,
|
|
517
|
+
warning: null,
|
|
518
|
+
...(await a(options)),
|
|
519
|
+
};
|
|
520
|
+
return {
|
|
521
|
+
spec,
|
|
522
|
+
validator: asRequiredParser(exports.fileInfoParser, spec),
|
|
523
|
+
};
|
|
524
|
+
}, exports.fileInfoParser.nullable());
|
|
525
|
+
}
|
|
526
|
+
/**
|
|
527
|
+
* @description Displays a dropdown, allowing for a single selection. Depending on the selection, a different object ("sub form") is presented.
|
|
528
|
+
* @example
|
|
529
|
+
* ```
|
|
530
|
+
unionExample: Value.union(
|
|
531
|
+
{
|
|
532
|
+
// required
|
|
533
|
+
name: 'Union Example',
|
|
534
|
+
default: 'option1',
|
|
535
|
+
|
|
536
|
+
// optional
|
|
537
|
+
description: null,
|
|
538
|
+
warning: null,
|
|
539
|
+
disabled: false,
|
|
540
|
+
immutable: false,
|
|
541
|
+
},
|
|
542
|
+
Variants.of({
|
|
543
|
+
option1: {
|
|
544
|
+
name: 'Option 1',
|
|
545
|
+
spec: InputSpec.of({}),
|
|
546
|
+
},
|
|
547
|
+
option2: {
|
|
548
|
+
name: 'Option 2',
|
|
549
|
+
spec: InputSpec.of({}),
|
|
550
|
+
},
|
|
551
|
+
}),
|
|
552
|
+
),
|
|
553
|
+
* ```
|
|
554
|
+
*/
|
|
555
|
+
static union(a) {
|
|
556
|
+
return new Value(async (options) => {
|
|
557
|
+
const built = await a.variants.build(options);
|
|
558
|
+
return {
|
|
559
|
+
spec: {
|
|
560
|
+
type: "union",
|
|
561
|
+
description: null,
|
|
562
|
+
warning: null,
|
|
563
|
+
disabled: false,
|
|
564
|
+
...a,
|
|
565
|
+
variants: built.spec,
|
|
566
|
+
immutable: a.immutable ?? false,
|
|
567
|
+
},
|
|
568
|
+
validator: built.validator,
|
|
569
|
+
};
|
|
570
|
+
}, a.variants.validator);
|
|
318
571
|
}
|
|
319
|
-
static dynamicUnion(getA,
|
|
572
|
+
static dynamicUnion(getA, validator = ts_matches_1.any) {
|
|
320
573
|
return new Value(async (options) => {
|
|
321
574
|
const newValues = await getA(options);
|
|
575
|
+
const built = await newValues.variants.build(options);
|
|
322
576
|
return {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
577
|
+
spec: {
|
|
578
|
+
type: "union",
|
|
579
|
+
description: null,
|
|
580
|
+
warning: null,
|
|
581
|
+
...newValues,
|
|
582
|
+
variants: built.spec,
|
|
583
|
+
immutable: false,
|
|
584
|
+
},
|
|
585
|
+
validator: built.validator,
|
|
329
586
|
};
|
|
330
|
-
},
|
|
587
|
+
}, validator);
|
|
331
588
|
}
|
|
589
|
+
/**
|
|
590
|
+
* @description Presents an interface to add/remove/edit items in a list.
|
|
591
|
+
* @example
|
|
592
|
+
* In this example, we create a list of text inputs.
|
|
593
|
+
*
|
|
594
|
+
* ```
|
|
595
|
+
listExampleText: Value.list(
|
|
596
|
+
List.text(
|
|
597
|
+
{
|
|
598
|
+
// required
|
|
599
|
+
name: 'Text List',
|
|
600
|
+
|
|
601
|
+
// optional
|
|
602
|
+
description: null,
|
|
603
|
+
warning: null,
|
|
604
|
+
default: [],
|
|
605
|
+
minLength: null,
|
|
606
|
+
maxLength: null,
|
|
607
|
+
},
|
|
608
|
+
{
|
|
609
|
+
// required
|
|
610
|
+
patterns: [],
|
|
611
|
+
|
|
612
|
+
// optional
|
|
613
|
+
placeholder: null,
|
|
614
|
+
generate: null,
|
|
615
|
+
inputmode: 'url',
|
|
616
|
+
masked: false,
|
|
617
|
+
minLength: null,
|
|
618
|
+
maxLength: null,
|
|
619
|
+
},
|
|
620
|
+
),
|
|
621
|
+
),
|
|
622
|
+
* ```
|
|
623
|
+
* @example
|
|
624
|
+
* In this example, we create a list of objects.
|
|
625
|
+
*
|
|
626
|
+
* ```
|
|
627
|
+
listExampleObject: Value.list(
|
|
628
|
+
List.obj(
|
|
629
|
+
{
|
|
630
|
+
// required
|
|
631
|
+
name: 'Object List',
|
|
632
|
+
|
|
633
|
+
// optional
|
|
634
|
+
description: null,
|
|
635
|
+
warning: null,
|
|
636
|
+
default: [],
|
|
637
|
+
minLength: null,
|
|
638
|
+
maxLength: null,
|
|
639
|
+
},
|
|
640
|
+
{
|
|
641
|
+
// required
|
|
642
|
+
spec: InputSpec.of({}),
|
|
643
|
+
|
|
644
|
+
// optional
|
|
645
|
+
displayAs: null,
|
|
646
|
+
uniqueBy: null,
|
|
647
|
+
},
|
|
648
|
+
),
|
|
649
|
+
),
|
|
650
|
+
* ```
|
|
651
|
+
*/
|
|
332
652
|
static list(a) {
|
|
333
653
|
return new Value((options) => a.build(options), a.validator);
|
|
334
654
|
}
|
|
335
655
|
static hidden(parser = ts_matches_1.any) {
|
|
336
656
|
return new Value(async () => {
|
|
337
|
-
|
|
338
|
-
|
|
657
|
+
return {
|
|
658
|
+
spec: {
|
|
659
|
+
type: "hidden",
|
|
660
|
+
},
|
|
661
|
+
validator: parser,
|
|
339
662
|
};
|
|
340
|
-
return built;
|
|
341
663
|
}, parser);
|
|
342
664
|
}
|
|
343
|
-
map(fn) {
|
|
344
|
-
return new Value(this.build, this.validator.map(fn));
|
|
345
|
-
}
|
|
346
665
|
/**
|
|
347
|
-
*
|
|
348
|
-
*
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
required: false,
|
|
353
|
-
})
|
|
354
|
-
|
|
355
|
-
return InputSpec.of<Store>()({
|
|
356
|
-
myValue: a.withStore(),
|
|
357
|
-
})
|
|
358
|
-
```
|
|
666
|
+
* @description Provides a way to define a hidden field with a static value. Useful for tracking
|
|
667
|
+
* @example
|
|
668
|
+
* ```
|
|
669
|
+
hiddenExample: Value.hidden(),
|
|
670
|
+
* ```
|
|
359
671
|
*/
|
|
360
|
-
|
|
361
|
-
return
|
|
672
|
+
static dynamicHidden(getParser) {
|
|
673
|
+
return new Value(async (options) => {
|
|
674
|
+
const validator = await getParser(options);
|
|
675
|
+
return {
|
|
676
|
+
spec: {
|
|
677
|
+
type: "hidden",
|
|
678
|
+
},
|
|
679
|
+
validator,
|
|
680
|
+
};
|
|
681
|
+
}, ts_matches_1.any);
|
|
682
|
+
}
|
|
683
|
+
map(fn) {
|
|
684
|
+
return new Value(async (effects) => {
|
|
685
|
+
const built = await this.build(effects);
|
|
686
|
+
return {
|
|
687
|
+
spec: built.spec,
|
|
688
|
+
validator: built.validator.map(fn),
|
|
689
|
+
};
|
|
690
|
+
}, this.validator.map(fn));
|
|
362
691
|
}
|
|
363
692
|
}
|
|
364
693
|
exports.Value = Value;
|