@start9labs/start-sdk 0.3.6-alpha.22 → 0.3.6-alpha.23
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 +2 -2
- package/base/lib/actions/setupActions.d.ts +3 -1
- package/base/lib/osBindings/BindInfo.d.ts +2 -2
- package/base/lib/osBindings/GitHash.d.ts +1 -0
- package/base/lib/osBindings/GitHash.js +4 -0
- package/base/lib/osBindings/GitHash.js.map +1 -0
- package/base/lib/osBindings/IpInfo.d.ts +1 -6
- package/base/lib/osBindings/Manifest.d.ts +2 -1
- package/base/lib/osBindings/NetInfo.d.ts +5 -0
- package/base/lib/osBindings/NetInfo.js +4 -0
- package/base/lib/osBindings/NetInfo.js.map +1 -0
- package/base/lib/osBindings/NetworkInterfaceInfo.d.ts +5 -0
- package/base/lib/osBindings/NetworkInterfaceInfo.js +3 -0
- package/base/lib/osBindings/NetworkInterfaceInfo.js.map +1 -0
- package/base/lib/osBindings/PackageVersionInfo.d.ts +2 -1
- package/base/lib/osBindings/ServerInfo.d.ts +3 -3
- package/base/lib/osBindings/index.d.ts +3 -1
- package/package/lib/StartSdk.d.ts +151 -91
- package/package/lib/StartSdk.js +136 -81
- package/package/lib/StartSdk.js.map +1 -1
- package/package/lib/backup/Backups.d.ts +0 -22
- package/package/lib/backup/Backups.js +0 -22
- package/package/lib/backup/Backups.js.map +1 -1
- package/package/lib/health/checkFns/checkPortListening.js +0 -1
- package/package/lib/health/checkFns/checkPortListening.js.map +1 -1
- package/package/lib/mainFn/CommandController.js.map +1 -1
- package/package/lib/manifest/setupManifest.d.ts +1 -2
- package/package/lib/manifest/setupManifest.js +0 -13
- package/package/lib/manifest/setupManifest.js.map +1 -1
- package/package/lib/store/setupExposeStore.js.map +1 -1
- package/package/lib/test/output.sdk.d.ts +1 -1
- package/package/lib/trigger/defaultTrigger.js.map +1 -1
- package/package/lib/util/SubContainer.js +0 -1
- package/package/lib/util/SubContainer.js.map +1 -1
- package/package/lib/util/fileHelper.d.ts +16 -9
- package/package/lib/util/fileHelper.js +16 -9
- package/package/lib/util/fileHelper.js.map +1 -1
- package/package.json +1 -1
package/base/lib/Effects.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ActionId, ActionInput, ActionMetadata, SetMainStatus, DependencyRequirement, CheckDependenciesResult, SetHealth, BindParams, HostId,
|
|
1
|
+
import { ActionId, ActionInput, ActionMetadata, SetMainStatus, DependencyRequirement, CheckDependenciesResult, SetHealth, BindParams, HostId, NetInfo, Host, ExportServiceInterfaceParams, ServiceInterface, RequestActionParams, MainStatus } from "./osBindings";
|
|
2
2
|
import { StorePath } from "./util/PathBuilder";
|
|
3
3
|
import { PackageId, Dependencies, ServiceInterfaceId, SmtpValue, ActionResult } from "./types";
|
|
4
4
|
import { UrlString } from "./util/getServiceInterface";
|
|
@@ -93,7 +93,7 @@ export type Effects = {
|
|
|
93
93
|
packageId?: PackageId;
|
|
94
94
|
hostId: HostId;
|
|
95
95
|
internalPort: number;
|
|
96
|
-
}): Promise<
|
|
96
|
+
}): Promise<NetInfo>;
|
|
97
97
|
/** Removes all network bindings, called in the setupInputSpec */
|
|
98
98
|
clearBindings(options: {
|
|
99
99
|
except: {
|
|
@@ -4,7 +4,9 @@ import * as T from "../types";
|
|
|
4
4
|
export type Run<A extends Record<string, any> | InputSpec<Record<string, any>, any> | InputSpec<Record<string, never>, never>> = (options: {
|
|
5
5
|
effects: T.Effects;
|
|
6
6
|
input: ExtractInputSpecType<A> & Record<string, any>;
|
|
7
|
-
}) => Promise<T.ActionResult
|
|
7
|
+
}) => Promise<(T.ActionResult & {
|
|
8
|
+
version: "1";
|
|
9
|
+
}) | null | void | undefined>;
|
|
8
10
|
export type GetInput<A extends Record<string, any> | InputSpec<Record<string, any>, any> | InputSpec<Record<string, any>, never>> = (options: {
|
|
9
11
|
effects: T.Effects;
|
|
10
12
|
}) => Promise<null | void | undefined | (ExtractPartialInputSpecType<A> & Record<string, any>)>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type GitHash = string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GitHash.js","sourceRoot":"","sources":["../../../../base/lib/osBindings/GitHash.ts"],"names":[],"mappings":";AAAA,4GAA4G"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Alerts } from "./Alerts";
|
|
2
2
|
import type { Dependencies } from "./Dependencies";
|
|
3
3
|
import type { Description } from "./Description";
|
|
4
|
+
import type { GitHash } from "./GitHash";
|
|
4
5
|
import type { HardwareRequirements } from "./HardwareRequirements";
|
|
5
6
|
import type { ImageConfig } from "./ImageConfig";
|
|
6
7
|
import type { ImageId } from "./ImageId";
|
|
@@ -30,6 +31,6 @@ export type Manifest = {
|
|
|
30
31
|
alerts: Alerts;
|
|
31
32
|
dependencies: Dependencies;
|
|
32
33
|
hardwareRequirements: HardwareRequirements;
|
|
33
|
-
gitHash
|
|
34
|
+
gitHash?: GitHash;
|
|
34
35
|
osVersion: string;
|
|
35
36
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetInfo.js","sourceRoot":"","sources":["../../../../base/lib/osBindings/NetInfo.ts"],"names":[],"mappings":";AAAA,4GAA4G"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkInterfaceInfo.js","sourceRoot":"","sources":["../../../../base/lib/osBindings/NetworkInterfaceInfo.ts"],"names":[],"mappings":""}
|
|
@@ -2,6 +2,7 @@ import type { Alerts } from "./Alerts";
|
|
|
2
2
|
import type { DataUrl } from "./DataUrl";
|
|
3
3
|
import type { DependencyMetadata } from "./DependencyMetadata";
|
|
4
4
|
import type { Description } from "./Description";
|
|
5
|
+
import type { GitHash } from "./GitHash";
|
|
5
6
|
import type { HardwareRequirements } from "./HardwareRequirements";
|
|
6
7
|
import type { MerkleArchiveCommitment } from "./MerkleArchiveCommitment";
|
|
7
8
|
import type { PackageId } from "./PackageId";
|
|
@@ -11,7 +12,7 @@ export type PackageVersionInfo = {
|
|
|
11
12
|
icon: DataUrl;
|
|
12
13
|
description: Description;
|
|
13
14
|
releaseNotes: string;
|
|
14
|
-
gitHash:
|
|
15
|
+
gitHash: GitHash;
|
|
15
16
|
license: string;
|
|
16
17
|
wrapperRepo: string;
|
|
17
18
|
upstreamRepo: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { AcmeSettings } from "./AcmeSettings";
|
|
2
2
|
import type { Governor } from "./Governor";
|
|
3
|
-
import type { IpInfo } from "./IpInfo";
|
|
4
3
|
import type { LshwDevice } from "./LshwDevice";
|
|
4
|
+
import type { NetworkInterfaceInfo } from "./NetworkInterfaceInfo";
|
|
5
5
|
import type { ServerStatus } from "./ServerStatus";
|
|
6
6
|
import type { SmtpValue } from "./SmtpValue";
|
|
7
7
|
import type { WifiInfo } from "./WifiInfo";
|
|
@@ -20,8 +20,8 @@ export type ServerInfo = {
|
|
|
20
20
|
* for backwards compatibility
|
|
21
21
|
*/
|
|
22
22
|
torAddress: string;
|
|
23
|
-
|
|
24
|
-
[key: string]:
|
|
23
|
+
networkInterfaces: {
|
|
24
|
+
[key: string]: NetworkInterfaceInfo;
|
|
25
25
|
};
|
|
26
26
|
acme: AcmeSettings | null;
|
|
27
27
|
statusInfo: ServerStatus;
|
|
@@ -90,6 +90,7 @@ export { GetSslKeyParams } from "./GetSslKeyParams";
|
|
|
90
90
|
export { GetStatusParams } from "./GetStatusParams";
|
|
91
91
|
export { GetStoreParams } from "./GetStoreParams";
|
|
92
92
|
export { GetSystemSmtpParams } from "./GetSystemSmtpParams";
|
|
93
|
+
export { GitHash } from "./GitHash";
|
|
93
94
|
export { Governor } from "./Governor";
|
|
94
95
|
export { Guid } from "./Guid";
|
|
95
96
|
export { HardwareRequirements } from "./HardwareRequirements";
|
|
@@ -112,7 +113,6 @@ export { InstallingState } from "./InstallingState";
|
|
|
112
113
|
export { InstallParams } from "./InstallParams";
|
|
113
114
|
export { IpHostname } from "./IpHostname";
|
|
114
115
|
export { IpInfo } from "./IpInfo";
|
|
115
|
-
export { LanInfo } from "./LanInfo";
|
|
116
116
|
export { ListPackageSignersParams } from "./ListPackageSignersParams";
|
|
117
117
|
export { ListServiceInterfacesParams } from "./ListServiceInterfacesParams";
|
|
118
118
|
export { ListVersionSignersParams } from "./ListVersionSignersParams";
|
|
@@ -128,6 +128,8 @@ export { MountParams } from "./MountParams";
|
|
|
128
128
|
export { MountTarget } from "./MountTarget";
|
|
129
129
|
export { NamedHealthCheckResult } from "./NamedHealthCheckResult";
|
|
130
130
|
export { NamedProgress } from "./NamedProgress";
|
|
131
|
+
export { NetInfo } from "./NetInfo";
|
|
132
|
+
export { NetworkInterfaceInfo } from "./NetworkInterfaceInfo";
|
|
131
133
|
export { OnionHostname } from "./OnionHostname";
|
|
132
134
|
export { OsIndex } from "./OsIndex";
|
|
133
135
|
export { OsVersionInfoMap } from "./OsVersionInfoMap";
|
|
@@ -13,7 +13,7 @@ import { checkPortListening } from "./health/checkFns/checkPortListening";
|
|
|
13
13
|
import { List } from "../../base/lib/actions/input/builder/list";
|
|
14
14
|
import { Install, InstallFn } from "./inits/setupInstall";
|
|
15
15
|
import { SetupBackupsParams } from "./backup/setupBackups";
|
|
16
|
-
import {
|
|
16
|
+
import { UninstallFn } from "./inits/setupUninstall";
|
|
17
17
|
import { changeOnFirstSuccess, cooldownTrigger } from "./trigger";
|
|
18
18
|
import { UpdateServiceInterfaces } from "../../base/lib/interfaces/setupInterfaces";
|
|
19
19
|
import { MultiHost, Scheme } from "../../base/lib/interfaces/Host";
|
|
@@ -84,69 +84,112 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
84
84
|
stderr: string | Buffer;
|
|
85
85
|
}>;
|
|
86
86
|
/**
|
|
87
|
-
*
|
|
88
|
-
* @description Use this function to create a static Action, including optional form input.
|
|
87
|
+
* @description Use this class to create an Action. By convention, each Action should receive its own file.
|
|
89
88
|
*
|
|
90
|
-
* By convention, each Action should receive its own file.
|
|
91
|
-
*
|
|
92
|
-
* @param id
|
|
93
|
-
* @param metaData
|
|
94
|
-
* @param fn
|
|
95
|
-
* @returns
|
|
96
|
-
* @example
|
|
97
|
-
* In this example, we create an Action that prints a name to the console. We present a user
|
|
98
|
-
* with a form for optionally entering a temp name. If no temp name is provided, we use the name
|
|
99
|
-
* from the underlying `inputSpec.yaml` file. If no name is there, we use "Unknown". Then, we return
|
|
100
|
-
* a message to the user informing them what happened.
|
|
101
|
-
*
|
|
102
|
-
* ```
|
|
103
|
-
import { sdk } from '../sdk'
|
|
104
|
-
const { InputSpec, Value } = sdk
|
|
105
|
-
import { yamlFile } from '../file-models/inputSpec.yml'
|
|
106
|
-
|
|
107
|
-
const input = InputSpec.of({
|
|
108
|
-
nameToPrint: Value.text({
|
|
109
|
-
name: 'Temp Name',
|
|
110
|
-
description: 'If no name is provided, the name from inputSpec will be used',
|
|
111
|
-
required: false,
|
|
112
|
-
}),
|
|
113
|
-
})
|
|
114
|
-
|
|
115
|
-
export const nameToLog = sdk.createAction(
|
|
116
|
-
// id
|
|
117
|
-
'nameToLogs',
|
|
118
|
-
|
|
119
|
-
// metadata
|
|
120
|
-
{
|
|
121
|
-
name: 'Name to Logs',
|
|
122
|
-
description: 'Prints "Hello [Name]" to the service logs.',
|
|
123
|
-
warning: null,
|
|
124
|
-
disabled: false,
|
|
125
|
-
input,
|
|
126
|
-
allowedStatuses: 'onlyRunning',
|
|
127
|
-
group: null,
|
|
128
|
-
},
|
|
129
|
-
|
|
130
|
-
// the execution function
|
|
131
|
-
async ({ effects, input }) => {
|
|
132
|
-
const name =
|
|
133
|
-
input.nameToPrint || (await yamlFile.read(effects))?.name || 'Unknown'
|
|
134
|
-
|
|
135
|
-
console.info(`Hello ${name}`)
|
|
136
|
-
|
|
137
|
-
return {
|
|
138
|
-
version: '0',
|
|
139
|
-
message: `"Hello ${name}" has been written to the service logs. Open your logs to view it.`,
|
|
140
|
-
value: name,
|
|
141
|
-
copyable: true,
|
|
142
|
-
qr: false,
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
)
|
|
146
|
-
* ```
|
|
147
89
|
*/
|
|
148
90
|
Action: {
|
|
91
|
+
/**
|
|
92
|
+
* @description Use this function to create an action that accepts form input
|
|
93
|
+
* @param id - a unique ID for this action
|
|
94
|
+
* @param metadata - information describing the action and its availability
|
|
95
|
+
* @param inputSpec - define the form input using the InputSpec and Value classes
|
|
96
|
+
* @param prefillFn - optionally fetch data from the file system to pre-fill the input form. Must returns a deep partial of the input spec
|
|
97
|
+
* @param executionFn - execute the action. Optionally return data for the user to view. Must be in the structure of an ActionResult, version "1"
|
|
98
|
+
* @example
|
|
99
|
+
* In this example, we create an action for a user to provide their name.
|
|
100
|
+
* We prefill the input form with their existing name from the service's yaml file.
|
|
101
|
+
* The new name is saved to the yaml file, and we return nothing to the user, which
|
|
102
|
+
* means they will receive a generic success message.
|
|
103
|
+
*
|
|
104
|
+
* ```
|
|
105
|
+
import { sdk } from '../sdk'
|
|
106
|
+
import { yamlFile } from '../file-models/config.yml'
|
|
107
|
+
|
|
108
|
+
const { InputSpec, Value } = sdk
|
|
109
|
+
|
|
110
|
+
export const inputSpec = InputSpec.of({
|
|
111
|
+
name: Value.text({
|
|
112
|
+
name: 'Name',
|
|
113
|
+
description:
|
|
114
|
+
'When you launch the Hello World UI, it will display "Hello [Name]"',
|
|
115
|
+
required: true,
|
|
116
|
+
default: 'World',
|
|
117
|
+
}),
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
export const setName = sdk.Action.withInput(
|
|
121
|
+
// id
|
|
122
|
+
'set-name',
|
|
123
|
+
|
|
124
|
+
// metadata
|
|
125
|
+
async ({ effects }) => ({
|
|
126
|
+
name: 'Set Name',
|
|
127
|
+
description: 'Set your name so Hello World can say hello to you',
|
|
128
|
+
warning: null,
|
|
129
|
+
allowedStatuses: 'any',
|
|
130
|
+
group: null,
|
|
131
|
+
visibility: 'enabled',
|
|
132
|
+
}),
|
|
133
|
+
|
|
134
|
+
// form input specification
|
|
135
|
+
inputSpec,
|
|
136
|
+
|
|
137
|
+
// optionally pre-fill the input form
|
|
138
|
+
async ({ effects }) => {
|
|
139
|
+
const name = await yamlFile.read.const(effects)?.name
|
|
140
|
+
return { name }
|
|
141
|
+
},
|
|
142
|
+
|
|
143
|
+
// the execution function
|
|
144
|
+
async ({ effects, input }) => yamlFile.merge(input)
|
|
145
|
+
)
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
149
148
|
withInput: <Id extends string, InputSpecType extends Record<string, any> | InputSpec<any, never> | InputSpec<any, any>, Type extends ExtractInputSpecType<InputSpecType> = ExtractInputSpecType<InputSpecType>>(id: Id, metadata: MaybeFn<Omit<T.ActionMetadata, "hasInput">>, inputSpec: InputSpecType, getInput: GetInput<Type>, run: Run<Type>) => Action<Id, unknown, InputSpecType>;
|
|
149
|
+
/**
|
|
150
|
+
* @description Use this function to create an action that does not accept form input
|
|
151
|
+
* @param id - a unique ID for this action
|
|
152
|
+
* @param metadata - information describing the action and its availability
|
|
153
|
+
* @param executionFn - execute the action. Optionally return data for the user to view. Must be in the structure of an ActionResult, version "1"
|
|
154
|
+
* @example
|
|
155
|
+
* In this example, we create an action that returns a secret phrase for the user to see.
|
|
156
|
+
*
|
|
157
|
+
* ```
|
|
158
|
+
import { sdk } from '../sdk'
|
|
159
|
+
|
|
160
|
+
export const showSecretPhrase = sdk.Action.withoutInput(
|
|
161
|
+
// id
|
|
162
|
+
'show-secret-phrase',
|
|
163
|
+
|
|
164
|
+
// metadata
|
|
165
|
+
async ({ effects }) => ({
|
|
166
|
+
name: 'Show Secret Phrase',
|
|
167
|
+
description: 'Reveal the secret phrase for Hello World',
|
|
168
|
+
warning: null,
|
|
169
|
+
allowedStatuses: 'any',
|
|
170
|
+
group: null,
|
|
171
|
+
visibility: 'enabled',
|
|
172
|
+
}),
|
|
173
|
+
|
|
174
|
+
// the execution function
|
|
175
|
+
async ({ effects }) => ({
|
|
176
|
+
version: '1',
|
|
177
|
+
title: 'Secret Phrase',
|
|
178
|
+
message:
|
|
179
|
+
'Below is your secret phrase. Use it to gain access to extraordinary places',
|
|
180
|
+
result: {
|
|
181
|
+
type: 'single',
|
|
182
|
+
value: await sdk.store
|
|
183
|
+
.getOwn(effects, sdk.StorePath.secretPhrase)
|
|
184
|
+
.const(),
|
|
185
|
+
copyable: true,
|
|
186
|
+
qr: true,
|
|
187
|
+
masked: true,
|
|
188
|
+
},
|
|
189
|
+
}),
|
|
190
|
+
)
|
|
191
|
+
* ```
|
|
192
|
+
*/
|
|
150
193
|
withoutInput: <Id_1 extends string>(id: Id_1, metadata: MaybeFn<Omit<T.ActionMetadata, "hasInput">>, run: Run<{}>) => Action<Id_1, unknown, {}>;
|
|
151
194
|
};
|
|
152
195
|
inputSpecConstants: {
|
|
@@ -202,9 +245,9 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
202
245
|
id: string;
|
|
203
246
|
/** The human readable description. */
|
|
204
247
|
description: string;
|
|
205
|
-
/**
|
|
248
|
+
/** No effect until StartOS v0.4.0. If true, forces the user to select one URL (i.e. .onion, .local, or IP address) as the primary URL. This is needed by some services to function properly. */
|
|
206
249
|
hasPrimary: boolean;
|
|
207
|
-
/** Affects how the interface appears to the user. One of: 'ui', 'api', 'p2p'. */
|
|
250
|
+
/** Affects how the interface appears to the user. One of: 'ui', 'api', 'p2p'. If 'ui', the user will see a "Launch UI" button */
|
|
208
251
|
type: ServiceInterfaceType;
|
|
209
252
|
/** (optional) prepends the provided username to all URLs. */
|
|
210
253
|
username: null | string;
|
|
@@ -266,15 +309,22 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
266
309
|
* In this example, we back up the entire "main" volume and nothing else.
|
|
267
310
|
*
|
|
268
311
|
* ```
|
|
269
|
-
|
|
312
|
+
import { sdk } from './sdk'
|
|
313
|
+
|
|
314
|
+
export const { createBackup, restoreBackup } = sdk.setupBackups(
|
|
315
|
+
async ({ effects }) => sdk.Backups.volumes('main'),
|
|
316
|
+
)
|
|
270
317
|
* ```
|
|
271
318
|
* @example
|
|
272
|
-
* In this example, we back up the "main"
|
|
319
|
+
* In this example, we back up the "main" volume, but exclude hypothetical directory "excludedDir".
|
|
273
320
|
*
|
|
274
321
|
* ```
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
322
|
+
import { sdk } from './sdk'
|
|
323
|
+
|
|
324
|
+
export const { createBackup, restoreBackup } = sdk.setupBackups(async () =>
|
|
325
|
+
sdk.Backups.volumes('main').setOptions({
|
|
326
|
+
exclude: ['excludedDir'],
|
|
327
|
+
}),
|
|
278
328
|
)
|
|
279
329
|
* ```
|
|
280
330
|
*/
|
|
@@ -284,37 +334,36 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
284
334
|
};
|
|
285
335
|
/**
|
|
286
336
|
* @description Use this function to set dependency information.
|
|
287
|
-
*
|
|
288
|
-
* The function executes on service install, update, and inputSpec save. "input" will be of type `Input` for inputSpec save. It will be `null` for install and update.
|
|
289
337
|
* @example
|
|
290
|
-
* In this example, we create a
|
|
338
|
+
* In this example, we create a perpetual dependency on Hello World >=1.0.0:0, where Hello World must be running and passing its "primary" health check.
|
|
291
339
|
*
|
|
292
340
|
* ```
|
|
293
341
|
export const setDependencies = sdk.setupDependencies(
|
|
294
342
|
async ({ effects, input }) => {
|
|
295
343
|
return {
|
|
296
|
-
'hello-world':
|
|
297
|
-
|
|
298
|
-
versionRange:
|
|
299
|
-
healthChecks: ['
|
|
300
|
-
}
|
|
344
|
+
'hello-world': {
|
|
345
|
+
kind: 'running',
|
|
346
|
+
versionRange: '>=1.0.0',
|
|
347
|
+
healthChecks: ['primary'],
|
|
348
|
+
},
|
|
301
349
|
}
|
|
302
350
|
},
|
|
303
351
|
)
|
|
304
352
|
* ```
|
|
305
353
|
* @example
|
|
306
|
-
* In this example, we create a conditional dependency on Hello World based on a hypothetical "needsWorld" boolean in
|
|
354
|
+
* In this example, we create a conditional dependency on Hello World based on a hypothetical "needsWorld" boolean in our Store.
|
|
355
|
+
* Using .const() ensures that if the "needsWorld" boolean changes, setupDependencies will re-run.
|
|
307
356
|
*
|
|
308
357
|
* ```
|
|
309
358
|
export const setDependencies = sdk.setupDependencies(
|
|
310
359
|
async ({ effects }) => {
|
|
311
360
|
if (sdk.store.getOwn(sdk.StorePath.needsWorld).const()) {
|
|
312
361
|
return {
|
|
313
|
-
'hello-world':
|
|
314
|
-
|
|
315
|
-
versionRange:
|
|
316
|
-
healthChecks: ['
|
|
317
|
-
}
|
|
362
|
+
'hello-world': {
|
|
363
|
+
kind: 'running',
|
|
364
|
+
versionRange: '>=1.0.0',
|
|
365
|
+
healthChecks: ['primary'],
|
|
366
|
+
},
|
|
318
367
|
}
|
|
319
368
|
}
|
|
320
369
|
return {}
|
|
@@ -327,7 +376,7 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
327
376
|
}) => Promise<T.CurrentDependenciesResult<Manifest>>) => (options: {
|
|
328
377
|
effects: Effects;
|
|
329
378
|
}) => Promise<null>;
|
|
330
|
-
setupInit: (versions: VersionGraph<string>, install: Install<Manifest, Store>, uninstall: Uninstall<Manifest, Store>, setServiceInterfaces: UpdateServiceInterfaces<any>, setDependencies: (options: {
|
|
379
|
+
setupInit: (versions: VersionGraph<string>, install: Install<Manifest, Store>, uninstall: import("./inits/setupUninstall").Uninstall<Manifest, Store>, setServiceInterfaces: UpdateServiceInterfaces<any>, setDependencies: (options: {
|
|
331
380
|
effects: Effects;
|
|
332
381
|
}) => Promise<void | null | undefined>, actions: Actions<Store, any>, exposedStore: T.ExposedStorePaths) => {
|
|
333
382
|
packageInit: T.ExpectedExports.packageInit;
|
|
@@ -437,7 +486,7 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
437
486
|
/**
|
|
438
487
|
* Use this function to execute arbitrary logic *once*, on uninstall only. Most services will not use this.
|
|
439
488
|
*/
|
|
440
|
-
setupUninstall: (fn: UninstallFn<Manifest, Store>) => Uninstall<Manifest, Store>;
|
|
489
|
+
setupUninstall: (fn: UninstallFn<Manifest, Store>) => import("./inits/setupUninstall").Uninstall<Manifest, Store>;
|
|
441
490
|
trigger: {
|
|
442
491
|
defaultTrigger: import("./trigger").Trigger;
|
|
443
492
|
cooldownTrigger: typeof cooldownTrigger;
|
|
@@ -472,7 +521,8 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
472
521
|
name: 'Name',
|
|
473
522
|
description:
|
|
474
523
|
'When you launch the Hello World UI, it will display "Hello [Name]"',
|
|
475
|
-
required:
|
|
524
|
+
required: true,
|
|
525
|
+
default: 'World'
|
|
476
526
|
}),
|
|
477
527
|
makePublic: Value.toggle({
|
|
478
528
|
name: 'Make Public',
|
|
@@ -519,6 +569,7 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
519
569
|
label: Value.text({
|
|
520
570
|
name: 'Label',
|
|
521
571
|
required: false,
|
|
572
|
+
default: null,
|
|
522
573
|
})
|
|
523
574
|
})
|
|
524
575
|
displayAs: 'label',
|
|
@@ -536,11 +587,13 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
536
587
|
spec: InputSpec.of({
|
|
537
588
|
label: Value.text({
|
|
538
589
|
name: 'Label',
|
|
539
|
-
required:
|
|
590
|
+
required: true,
|
|
591
|
+
default: null,
|
|
540
592
|
})
|
|
541
593
|
pubkey: Value.text({
|
|
542
594
|
name: 'Pubkey',
|
|
543
|
-
required:
|
|
595
|
+
required: true,
|
|
596
|
+
default: null,
|
|
544
597
|
})
|
|
545
598
|
})
|
|
546
599
|
displayAs: 'label',
|
|
@@ -553,11 +606,13 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
553
606
|
spec: InputSpec.of({
|
|
554
607
|
label: Value.text({
|
|
555
608
|
name: 'Label',
|
|
556
|
-
required:
|
|
609
|
+
required: true,
|
|
610
|
+
default: null,
|
|
557
611
|
})
|
|
558
612
|
pubkey: Value.text({
|
|
559
613
|
name: 'Pubkey',
|
|
560
|
-
required:
|
|
614
|
+
required: true,
|
|
615
|
+
default: null,
|
|
561
616
|
})
|
|
562
617
|
})
|
|
563
618
|
displayAs: 'label',
|
|
@@ -617,6 +672,7 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
617
672
|
// required
|
|
618
673
|
name: 'Text Example',
|
|
619
674
|
required: false,
|
|
675
|
+
default: null,
|
|
620
676
|
|
|
621
677
|
// optional
|
|
622
678
|
description: null,
|
|
@@ -641,6 +697,7 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
641
697
|
// required
|
|
642
698
|
name: 'Textarea Example',
|
|
643
699
|
required: false,
|
|
700
|
+
default: null,
|
|
644
701
|
|
|
645
702
|
// optional
|
|
646
703
|
description: null,
|
|
@@ -661,6 +718,7 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
661
718
|
// required
|
|
662
719
|
name: 'Number Example',
|
|
663
720
|
required: false,
|
|
721
|
+
default: null,
|
|
664
722
|
integer: true,
|
|
665
723
|
|
|
666
724
|
// optional
|
|
@@ -684,6 +742,7 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
684
742
|
// required
|
|
685
743
|
name: 'Color Example',
|
|
686
744
|
required: false,
|
|
745
|
+
default: null,
|
|
687
746
|
|
|
688
747
|
// optional
|
|
689
748
|
description: null,
|
|
@@ -701,6 +760,7 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
701
760
|
// required
|
|
702
761
|
name: 'Datetime Example',
|
|
703
762
|
required: false,
|
|
763
|
+
default: null,
|
|
704
764
|
|
|
705
765
|
// optional
|
|
706
766
|
description: null,
|
|
@@ -720,7 +780,7 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
720
780
|
selectExample: Value.select({
|
|
721
781
|
// required
|
|
722
782
|
name: 'Select Example',
|
|
723
|
-
|
|
783
|
+
default: 'radio1',
|
|
724
784
|
values: {
|
|
725
785
|
radio1: 'Radio 1',
|
|
726
786
|
radio2: 'Radio 2',
|
|
@@ -785,7 +845,7 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
785
845
|
{
|
|
786
846
|
// required
|
|
787
847
|
name: 'Union Example',
|
|
788
|
-
|
|
848
|
+
default: 'option1',
|
|
789
849
|
|
|
790
850
|
// optional
|
|
791
851
|
description: null,
|
|
@@ -1144,7 +1204,7 @@ export declare class StartSdk<Manifest extends T.SDKManifest, Store> {
|
|
|
1144
1204
|
packageId?: string | undefined;
|
|
1145
1205
|
hostId: string;
|
|
1146
1206
|
internalPort: number;
|
|
1147
|
-
}) => Promise<T.
|
|
1207
|
+
}) => Promise<T.NetInfo>;
|
|
1148
1208
|
clearBindings: (effects: Effects, options: {
|
|
1149
1209
|
except: {
|
|
1150
1210
|
id: string;
|