@le-space/node 0.1.0
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/README.md +5 -0
- package/index.d.ts +218 -0
- package/index.js +2061 -0
- package/package.json +23 -0
package/README.md
ADDED
package/index.d.ts
ADDED
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import * as _shared_aleph_shared_types from '@shared-aleph/shared-types';
|
|
2
|
+
import { MessageSigner, InstanceAllocation, PortMapping, RuntimeDiagnostics, CrnRecord, RootfsRequiredPortForward, MessageHasher, RootfsManifest } from '@shared-aleph/shared-types';
|
|
3
|
+
|
|
4
|
+
declare function requiredEnv(name: string, env?: NodeJS.ProcessEnv): string;
|
|
5
|
+
declare function optionalEnv(name: string, fallback?: string, env?: NodeJS.ProcessEnv): string;
|
|
6
|
+
declare function integerEnv(name: string, fallback: number, env?: NodeJS.ProcessEnv): number;
|
|
7
|
+
declare function booleanEnv(name: string, fallback: boolean, env?: NodeJS.ProcessEnv): boolean;
|
|
8
|
+
declare function jsonEnv<T>(name: string, fallback: string, env?: NodeJS.ProcessEnv): T;
|
|
9
|
+
|
|
10
|
+
declare function appendGithubOutput(name: string, value: unknown, env?: NodeJS.ProcessEnv): Promise<void>;
|
|
11
|
+
declare function appendGithubSummary(lines: string[], env?: NodeJS.ProcessEnv): Promise<void>;
|
|
12
|
+
declare function actionLog(level: 'notice' | 'warning' | 'error' | string, message: string, options?: {
|
|
13
|
+
githubActions?: boolean;
|
|
14
|
+
stderr?: NodeJS.WriteStream;
|
|
15
|
+
}): void;
|
|
16
|
+
|
|
17
|
+
type WalletLike = {
|
|
18
|
+
address?: string;
|
|
19
|
+
getAddress?(): Promise<string>;
|
|
20
|
+
signMessage(message: string): Promise<string>;
|
|
21
|
+
};
|
|
22
|
+
type WalletCtor = new (privateKey: string) => WalletLike;
|
|
23
|
+
interface PrivateKeyIdentity {
|
|
24
|
+
address: string;
|
|
25
|
+
signer: MessageSigner;
|
|
26
|
+
}
|
|
27
|
+
declare function createPrivateKeySigner(privateKey: string, options?: {
|
|
28
|
+
walletCtor?: WalletCtor;
|
|
29
|
+
}): Promise<MessageSigner>;
|
|
30
|
+
declare function createPrivateKeyIdentity(privateKey: string, options?: {
|
|
31
|
+
walletCtor?: WalletCtor;
|
|
32
|
+
}): Promise<PrivateKeyIdentity>;
|
|
33
|
+
|
|
34
|
+
interface DeployMetadataResult {
|
|
35
|
+
peer_id?: string;
|
|
36
|
+
probe_multiaddrs?: string[];
|
|
37
|
+
browser_bootstrap_multiaddrs?: string[];
|
|
38
|
+
[key: string]: unknown;
|
|
39
|
+
}
|
|
40
|
+
interface DeployConfigurationResult {
|
|
41
|
+
metadata?: DeployMetadataResult | null;
|
|
42
|
+
[key: string]: unknown;
|
|
43
|
+
}
|
|
44
|
+
interface DeployOutputResult {
|
|
45
|
+
sender?: string;
|
|
46
|
+
itemHash?: string;
|
|
47
|
+
httpStatus?: number;
|
|
48
|
+
status?: string;
|
|
49
|
+
selectedCrn?: {
|
|
50
|
+
hash?: string;
|
|
51
|
+
name?: string;
|
|
52
|
+
} | null;
|
|
53
|
+
portForwarding?: {
|
|
54
|
+
aggregateItemHash?: string;
|
|
55
|
+
aggregateStatus?: string;
|
|
56
|
+
} | null;
|
|
57
|
+
runtime?: {
|
|
58
|
+
allocation?: InstanceAllocation | null;
|
|
59
|
+
hostIpv4?: string | null;
|
|
60
|
+
ipv6?: string | null;
|
|
61
|
+
proxyUrl?: string | null;
|
|
62
|
+
sshCommand?: string | null;
|
|
63
|
+
setupHealth?: {
|
|
64
|
+
ok?: boolean;
|
|
65
|
+
status?: number;
|
|
66
|
+
url?: string;
|
|
67
|
+
error?: string;
|
|
68
|
+
} | null;
|
|
69
|
+
mappedPorts?: Record<string, PortMapping>;
|
|
70
|
+
diagnostics?: RuntimeDiagnostics | null;
|
|
71
|
+
selectedCrn?: CrnRecord | null;
|
|
72
|
+
} | null;
|
|
73
|
+
configuration?: DeployConfigurationResult | null;
|
|
74
|
+
verification?: {
|
|
75
|
+
ok?: boolean;
|
|
76
|
+
[key: string]: unknown;
|
|
77
|
+
} | null;
|
|
78
|
+
}
|
|
79
|
+
declare function emitDeployOutputs(deployResult: DeployOutputResult, env?: NodeJS.ProcessEnv): Promise<{
|
|
80
|
+
runtimeJson: string;
|
|
81
|
+
verificationJson: string;
|
|
82
|
+
}>;
|
|
83
|
+
declare function emitGeocodedCrnOutputs(geocodedCrns: unknown[], env?: NodeJS.ProcessEnv): Promise<void>;
|
|
84
|
+
|
|
85
|
+
interface DeployPlan {
|
|
86
|
+
profile: string;
|
|
87
|
+
privateKey: string;
|
|
88
|
+
apiHost: string;
|
|
89
|
+
crnListUrl: string;
|
|
90
|
+
name: string;
|
|
91
|
+
sshPublicKey: string;
|
|
92
|
+
rootfsItemHash: string;
|
|
93
|
+
rootfsVersion: string;
|
|
94
|
+
rootfsSizeMiB: number;
|
|
95
|
+
crnHash: string;
|
|
96
|
+
preferredCountryCode: string;
|
|
97
|
+
geoCrnLimit: number;
|
|
98
|
+
maxCrnAttempts: number;
|
|
99
|
+
vcpus: number;
|
|
100
|
+
memoryMiB: number;
|
|
101
|
+
seconds: number;
|
|
102
|
+
channel: string;
|
|
103
|
+
waitAttempts: number;
|
|
104
|
+
waitDelayMs: number;
|
|
105
|
+
runtimeAttempts: number;
|
|
106
|
+
runtimeDelayMs: number;
|
|
107
|
+
setupAttempts: number;
|
|
108
|
+
setupDelayMs: number;
|
|
109
|
+
verifyAttempts: number;
|
|
110
|
+
verifyDelayMs: number;
|
|
111
|
+
tcpTimeoutMs: number;
|
|
112
|
+
httpTimeoutMs: number;
|
|
113
|
+
metadataAttempts: number;
|
|
114
|
+
metadataDelayMs: number;
|
|
115
|
+
metadataTimeoutMs: number;
|
|
116
|
+
configureTimeoutMs: number;
|
|
117
|
+
enableCaddyProxy: boolean;
|
|
118
|
+
autoConfigure: boolean;
|
|
119
|
+
verifyReachability: boolean;
|
|
120
|
+
requiredPorts: RootfsRequiredPortForward[];
|
|
121
|
+
publishPortForwards: boolean;
|
|
122
|
+
}
|
|
123
|
+
declare function parseDeployPlan(env?: NodeJS.ProcessEnv): DeployPlan;
|
|
124
|
+
|
|
125
|
+
interface DeployExecutorDependencies {
|
|
126
|
+
fetch?: typeof fetch;
|
|
127
|
+
sleep?: (ms: number) => Promise<void>;
|
|
128
|
+
tcpProbe?: (host: string, port: number, timeoutMs?: number) => Promise<{
|
|
129
|
+
ok: boolean | null;
|
|
130
|
+
error?: string;
|
|
131
|
+
}>;
|
|
132
|
+
signer?: MessageSigner;
|
|
133
|
+
sender?: string;
|
|
134
|
+
hasher?: MessageHasher;
|
|
135
|
+
manifest?: RootfsManifest | null;
|
|
136
|
+
}
|
|
137
|
+
declare function executeDeployPlan(plan: DeployPlan, dependencies?: DeployExecutorDependencies): Promise<DeployOutputResult>;
|
|
138
|
+
|
|
139
|
+
interface FetchLikeResponse {
|
|
140
|
+
ok: boolean;
|
|
141
|
+
status: number;
|
|
142
|
+
url?: string;
|
|
143
|
+
json(): Promise<unknown>;
|
|
144
|
+
}
|
|
145
|
+
type FetchLike = (url: string, init?: RequestInit) => Promise<FetchLikeResponse>;
|
|
146
|
+
|
|
147
|
+
declare function listGeocodedCrns(options: {
|
|
148
|
+
fetch: FetchLike;
|
|
149
|
+
url?: string;
|
|
150
|
+
limit?: number;
|
|
151
|
+
dnsResolveUrl?: string;
|
|
152
|
+
countryLookupBaseUrl?: string;
|
|
153
|
+
}): Promise<CrnRecord[]>;
|
|
154
|
+
|
|
155
|
+
interface JsonFetchLikeResponse {
|
|
156
|
+
ok: boolean;
|
|
157
|
+
status: number;
|
|
158
|
+
json(): Promise<unknown>;
|
|
159
|
+
}
|
|
160
|
+
type JsonFetchLike = (url: string, init?: RequestInit) => Promise<JsonFetchLikeResponse>;
|
|
161
|
+
|
|
162
|
+
interface RetentionRecord {
|
|
163
|
+
instance_item_hash: string;
|
|
164
|
+
rootfs_item_hash: string;
|
|
165
|
+
site_item_hash: string;
|
|
166
|
+
rootfs_cid: string;
|
|
167
|
+
site_url: string;
|
|
168
|
+
relay_peer_id: string;
|
|
169
|
+
rootfs_version: string;
|
|
170
|
+
deployed_at: string;
|
|
171
|
+
vm_name: string;
|
|
172
|
+
}
|
|
173
|
+
declare function retainSuccessfulDeployments(args: {
|
|
174
|
+
sender: string;
|
|
175
|
+
currentRecord: unknown;
|
|
176
|
+
keepCount: number;
|
|
177
|
+
signer: MessageSigner;
|
|
178
|
+
hasher: MessageHasher;
|
|
179
|
+
fetch: JsonFetchLike;
|
|
180
|
+
aggregateKey?: string;
|
|
181
|
+
extraForgetHashes?: string[];
|
|
182
|
+
reason?: string;
|
|
183
|
+
channel?: string;
|
|
184
|
+
apiHost?: string;
|
|
185
|
+
now?: number;
|
|
186
|
+
}): Promise<{
|
|
187
|
+
sender: string;
|
|
188
|
+
aggregateKey: string;
|
|
189
|
+
keepCount: number;
|
|
190
|
+
aggregatePublication: {
|
|
191
|
+
itemHash: string;
|
|
192
|
+
status: _shared_aleph_shared_types.MessageStatus;
|
|
193
|
+
response: _shared_aleph_shared_types.AlephBroadcastResponse;
|
|
194
|
+
httpStatus: number;
|
|
195
|
+
};
|
|
196
|
+
retainedRecords: RetentionRecord[];
|
|
197
|
+
prunedRecords: RetentionRecord[];
|
|
198
|
+
forgetHashes: string[];
|
|
199
|
+
forgetResult: {
|
|
200
|
+
sender: string;
|
|
201
|
+
itemHash: string;
|
|
202
|
+
response: _shared_aleph_shared_types.AlephBroadcastResponse;
|
|
203
|
+
httpStatus: number;
|
|
204
|
+
status: _shared_aleph_shared_types.MessageStatus;
|
|
205
|
+
} | null;
|
|
206
|
+
}>;
|
|
207
|
+
|
|
208
|
+
declare function buildScaffoldDeployResult(env?: NodeJS.ProcessEnv): DeployOutputResult;
|
|
209
|
+
declare function runActionMode(env?: NodeJS.ProcessEnv, hooks?: {
|
|
210
|
+
stdout?: (text: string) => void;
|
|
211
|
+
listGeocodedCrns?: typeof listGeocodedCrns;
|
|
212
|
+
deployExecutor?: typeof executeDeployPlan;
|
|
213
|
+
retainSuccessfulDeployments?: typeof retainSuccessfulDeployments;
|
|
214
|
+
createPrivateKeyIdentity?: (privateKey: string) => Promise<PrivateKeyIdentity>;
|
|
215
|
+
}): Promise<void>;
|
|
216
|
+
declare function main(): Promise<void>;
|
|
217
|
+
|
|
218
|
+
export { type DeployConfigurationResult, type DeployExecutorDependencies, type DeployMetadataResult, type DeployOutputResult, type DeployPlan, type PrivateKeyIdentity, actionLog, appendGithubOutput, appendGithubSummary, booleanEnv, buildScaffoldDeployResult, createPrivateKeyIdentity, createPrivateKeySigner, emitDeployOutputs, emitGeocodedCrnOutputs, executeDeployPlan, integerEnv, jsonEnv, main, optionalEnv, parseDeployPlan, requiredEnv, runActionMode };
|