@di-framework/cli-plugin-platform 6.1.2 → 6.3.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 +154 -12
- package/dist/args.d.ts +8 -0
- package/dist/args.js +73 -28
- package/dist/assets/http-adapter.js +4 -1
- package/dist/assets/platform/README.md +68 -19
- package/dist/assets/platform/index.ts.tmpl +1 -1
- package/dist/assets/platform/tsconfig.json +2 -2
- package/dist/assets/sqlite/BUILD-INFO.txt +1 -1
- package/dist/build.d.ts +27 -4
- package/dist/build.js +159 -18
- package/dist/bundle.d.ts +85 -0
- package/dist/bundle.js +608 -0
- package/dist/command.js +85 -3
- package/dist/console/catalog.js +2 -1
- package/dist/console/cluster.d.ts +4 -2
- package/dist/console/cluster.js +38 -40
- package/dist/control/auth.js +14 -2
- package/dist/controller/client.d.ts +47 -0
- package/dist/controller/client.js +157 -0
- package/dist/controller/commands.d.ts +48 -0
- package/dist/controller/commands.js +584 -0
- package/dist/controller/credentials.d.ts +63 -0
- package/dist/controller/credentials.js +156 -0
- package/dist/controller/index.d.ts +6 -0
- package/dist/controller/index.js +6 -0
- package/dist/controller/oidc.d.ts +54 -0
- package/dist/controller/oidc.js +121 -0
- package/dist/controller/registry.d.ts +15 -0
- package/dist/controller/registry.js +47 -0
- package/dist/controller/schema.d.ts +157 -0
- package/dist/controller/schema.js +1 -0
- package/dist/controller/sse.d.ts +12 -0
- package/dist/controller/sse.js +61 -0
- package/dist/controller/trust.d.ts +14 -0
- package/dist/controller/trust.js +39 -0
- package/dist/deploy.d.ts +14 -7
- package/dist/deploy.js +96 -5
- package/dist/deps.d.ts +4 -0
- package/dist/destroy.js +26 -2
- package/dist/environment-names.d.ts +6 -0
- package/dist/environment-names.js +10 -0
- package/dist/index.d.ts +5 -3
- package/dist/index.js +5 -3
- package/dist/manifest.d.ts +45 -1
- package/dist/manifest.js +197 -4
- package/dist/pglite-encryption.d.ts +79 -0
- package/dist/pglite-encryption.js +196 -0
- package/dist/pglite.d.ts +61 -4
- package/dist/pglite.js +124 -40
- package/dist/project.d.ts +7 -0
- package/dist/project.js +35 -0
- package/dist/publish.d.ts +7 -1
- package/dist/publish.js +33 -1
- package/dist/service.d.ts +34 -0
- package/dist/service.js +156 -145
- package/dist/target.d.ts +7 -1
- package/dist/target.js +19 -0
- package/dist/workload.d.ts +50 -12
- package/dist/workload.js +239 -44
- package/package.json +1 -1
package/dist/build.js
CHANGED
|
@@ -2,25 +2,34 @@ import { createHash } from 'node:crypto';
|
|
|
2
2
|
import { cpSync, existsSync, mkdirSync, readdirSync, readFileSync, rmSync, writeFileSync, } from 'node:fs';
|
|
3
3
|
import { basename, dirname, join, relative, sep } from 'node:path';
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import { CommandFailure } from '@di-framework/cli-extension';
|
|
5
|
+
import { CommandFailure, } from '@di-framework/cli-extension';
|
|
6
6
|
import { discoverActors, renderActorsModule } from './actors.js';
|
|
7
7
|
import { discoverBindings, requirementsFromBindings } from './bindings.js';
|
|
8
|
+
import { buildDeployBundle, parseBuildArgs } from './bundle.js';
|
|
8
9
|
import { copyProviderWit, discoverComponentProviders, providerNamespaces, providerRequirementsFromJavaScript, providersToCompose, } from './components.js';
|
|
9
10
|
import { discoverScheduledJobs, renderCronAdapterModule, renderCronInvokerModule } from './cron.js';
|
|
10
11
|
import { DEFAULT_DEPS } from './deps.js';
|
|
11
12
|
import { renderGuestsModule } from './guests.js';
|
|
12
13
|
import { OCI_ARTIFACT_PLATFORM } from './oci.js';
|
|
13
|
-
import { DI_PGLITE_PACKAGE, DI_PGLITE_VERSION, PGLITE_WASM_FILE, resolvePgliteComponent, } from './pglite.js';
|
|
14
|
+
import { DI_PGLITE_PACKAGE, DI_PGLITE_VERSION, PGLITE_ENCFS_WASM_FILE, PGLITE_ENCRYPTED_WASM_FILE, PGLITE_KEY_ENV, PGLITE_WASM_FILE, resolvePgliteComponent, resolvePgliteEncryption, } from './pglite.js';
|
|
15
|
+
import { ENCFS_SECTION, encfsSection, encryptionComposition, LAYER_PACKAGE, PROVIDER_PACKAGE, planWiring, worldInterfaces, } from './pglite-encryption.js';
|
|
14
16
|
import { loadProject } from './project.js';
|
|
15
17
|
import { discoverQueueHandlers, isQueueWorkerProject } from './queues.js';
|
|
16
18
|
import { renderQueuesModule } from './queues-module.js';
|
|
17
|
-
import {
|
|
19
|
+
import { requireNodeBinary, toolFailed } from './support.js';
|
|
18
20
|
import { buildWitLock, COMPONENT_MODEL, defaultProjectRequirements, digestBytes, queueProjectRequirements, renderWorldWit, runtimeRequirementsFromJavaScript, sqliteProjectRequirements, WASI_HTTP_INTERFACE, WASI_HTTP_VERSION, } from './wit.js';
|
|
19
21
|
import { renderWorkloadServiceAdapter } from './workload-members.js';
|
|
20
22
|
export { COMPONENT_MODEL, WASI_HTTP_INTERFACE, WASI_HTTP_VERSION };
|
|
21
23
|
export const BUILD_PROFILE_NAME = 'wasmcloud-http';
|
|
22
24
|
export const CRON_BUILD_PROFILE_NAME = 'wasmcloud-cron';
|
|
23
25
|
export { BUILD_PROFILE_NAME as BUILD_PROFILE };
|
|
26
|
+
function originOf(component) {
|
|
27
|
+
return {
|
|
28
|
+
source: component.source,
|
|
29
|
+
...(component.image === undefined ? {} : { image: component.image }),
|
|
30
|
+
...(component.path === undefined ? {} : { path: component.path }),
|
|
31
|
+
};
|
|
32
|
+
}
|
|
24
33
|
export function requirementsForProject(project, deps = DEFAULT_DEPS) {
|
|
25
34
|
const bindings = discoverBindings(project, deps);
|
|
26
35
|
const queueHandlers = discoverQueueHandlers(project);
|
|
@@ -130,12 +139,8 @@ async function composeComponentProvider(project, deps, io, provider, namedImport
|
|
|
130
139
|
failureCode: 'WASMCLOUD_COMPONENT_COMPOSE_FAILED',
|
|
131
140
|
});
|
|
132
141
|
}
|
|
133
|
-
/**
|
|
134
|
-
|
|
135
|
-
* componentize-qjs composer when the guest has named imports to preserve.
|
|
136
|
-
*/
|
|
137
|
-
async function composeProvider(project, deps, io, options) {
|
|
138
|
-
const composed = `${project.outputPath}.composed`;
|
|
142
|
+
/** `wac` on PATH, else the SQLite toolchain's, and the PATH to run it with. */
|
|
143
|
+
function wacTool(deps) {
|
|
139
144
|
const toolsBin = sqliteToolsBin();
|
|
140
145
|
const envPath = [toolsBin, process.env.PATH ?? ''].filter(Boolean).join(':');
|
|
141
146
|
const wac = deps.capture('wac', ['--version']) !== undefined
|
|
@@ -143,13 +148,43 @@ async function composeProvider(project, deps, io, options) {
|
|
|
143
148
|
: toolsBin
|
|
144
149
|
? join(toolsBin, 'wac')
|
|
145
150
|
: 'wac';
|
|
151
|
+
return { wac, envPath };
|
|
152
|
+
}
|
|
153
|
+
/** Whether `error` is a spawn failure because the executable does not exist. */
|
|
154
|
+
function isMissingExecutable(error) {
|
|
155
|
+
const code = error?.code;
|
|
156
|
+
return (code === 'ENOENT' ||
|
|
157
|
+
(error instanceof Error && /ENOENT|Executable not found/i.test(error.message)));
|
|
158
|
+
}
|
|
159
|
+
/** Runs `wac` (or `command`), mapping a missing `wac` binary to `WASMCLOUD_WAC_REQUIRED`. */
|
|
160
|
+
async function runWac(project, deps, args, command) {
|
|
161
|
+
const { wac, envPath } = wacTool(deps);
|
|
162
|
+
try {
|
|
163
|
+
return await deps.runCaptured(command ?? wac, args, {
|
|
164
|
+
cwd: project.projectRoot,
|
|
165
|
+
env: { ...process.env, PATH: envPath },
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
catch (error) {
|
|
169
|
+
// A missing componentize-qjs compiler surfaces as it is; only wac has an install hint here.
|
|
170
|
+
if (command !== undefined || !isMissingExecutable(error))
|
|
171
|
+
throw error;
|
|
172
|
+
throw new CommandFailure('WASMCLOUD_WAC_REQUIRED', 'wac is required to compose components; install it (https://github.com/bytecodealliance/wac/releases, or `scripts/install-tools.sh --wac-only` in di-framework/platform `platform/sqlite-component`) and put it on PATH', 3, { application: project.applicationName, tool: 'wac' });
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Plugs one provider component into the built guest: `wac plug`, or the
|
|
177
|
+
* componentize-qjs composer when the guest has named imports to preserve.
|
|
178
|
+
*/
|
|
179
|
+
async function composeProvider(project, deps, io, options) {
|
|
180
|
+
const composed = `${project.outputPath}.composed`;
|
|
146
181
|
io.stdout.write(`Composing ${options.label} provider...\n`);
|
|
147
182
|
const compiler = options.namedImports ? deps.componentizeQjsPath() : undefined;
|
|
148
183
|
if (options.namedImports && !compiler)
|
|
149
184
|
throw new CommandFailure('WASMCLOUD_COMPILER_REQUIRED', 'Managed PostgreSQL needs componentize-qjs 0.4.4-di.3 or newer for named-import composition', 3);
|
|
150
|
-
const result = await
|
|
185
|
+
const result = await runWac(project, deps, compiler
|
|
151
186
|
? ['compose', project.outputPath, '--definition', options.wasm, '-o', composed]
|
|
152
|
-
: ['plug', '--plug', options.wasm, project.outputPath, '-o', composed],
|
|
187
|
+
: ['plug', '--plug', options.wasm, project.outputPath, '-o', composed], compiler);
|
|
153
188
|
if (result.exitCode !== 0) {
|
|
154
189
|
throw new CommandFailure(options.failureCode, `Composition of ${options.label} failed: ${result.stderr || result.stdout}`, 3, { application: project.applicationName, exitCode: result.exitCode });
|
|
155
190
|
}
|
|
@@ -180,6 +215,81 @@ async function inspectComponentImports(project, requirements, deps, composedAway
|
|
|
180
215
|
}
|
|
181
216
|
}
|
|
182
217
|
}
|
|
218
|
+
/** The world of a component, as `jco wit` prints it. */
|
|
219
|
+
async function componentWorld(project, deps, path, label) {
|
|
220
|
+
const captured = await deps.runCaptured(requireNodeBinary(deps.nodeBinaryPath()), [deps.jcoCliPath(), 'wit', path], { cwd: project.projectRoot });
|
|
221
|
+
if (captured.exitCode !== 0 && /Cannot find module/.test(captured.stderr)) {
|
|
222
|
+
throw new CommandFailure('WASMCLOUD_JCO_REQUIRED', `jco is required to read the WIT world of the ${label}, but ${deps.jcoCliPath()} could not be loaded; reinstall @di-framework/cli-plugin-platform (it depends on @bytecodealliance/jco)`, 3, { application: project.applicationName, tool: 'jco' });
|
|
223
|
+
}
|
|
224
|
+
if (captured.exitCode !== 0) {
|
|
225
|
+
throw new CommandFailure('WASMCLOUD_COMPONENT_IMPORTS_UNREADABLE', `Could not read the WIT world of the ${label}: ${(captured.stderr || captured.stdout).trim()}`, 3, { application: project.applicationName, path });
|
|
226
|
+
}
|
|
227
|
+
return worldInterfaces(captured.stdout);
|
|
228
|
+
}
|
|
229
|
+
function notInterposed(project, problem) {
|
|
230
|
+
return new CommandFailure('WASMCLOUD_PGLITE_ENCRYPTION_NOT_INTERPOSED', `The PGlite encryption layer would not sit between the provider and the host filesystem: ` +
|
|
231
|
+
`${problem}. PGlite would write its data directory in plaintext, so the build stops. ` +
|
|
232
|
+
'Use a layer built for the WASI versions the pinned provider imports.', 3, { application: project.applicationName });
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Composes the encryption layer into the provider and writes the result to `output`, which the
|
|
236
|
+
* build then plugs into the guest instead of the provider.
|
|
237
|
+
*
|
|
238
|
+
* `wac plug` silently skips a layer export whose name matches but whose type is not a subtype of
|
|
239
|
+
* the provider's import, and exits 0 when anything else plugged, so it cannot prove the layer is
|
|
240
|
+
* in the path. Instead the build reads both worlds with `jco wit`, plans which layer export each
|
|
241
|
+
* provider import takes (every `wasi:filesystem/*` import must have one), and composes a WAC
|
|
242
|
+
* document that passes each of them as a named instantiation argument (`wac compose`). wac
|
|
243
|
+
* type-checks every argument, so a layer that does not fit fails the build here rather than
|
|
244
|
+
* being bypassed. The document is kept at `.di-framework/pglite-encryption.wac`.
|
|
245
|
+
*
|
|
246
|
+
* Wiring cannot show that the layer encrypts: a pass-through layer wires the same way. So the
|
|
247
|
+
* layer must also carry the platform's `di-framework:pglite-encfs` custom section. That marker
|
|
248
|
+
* catches the wrong artifact (a no-op or debug layer, a stale local build); it is forgeable, so
|
|
249
|
+
* what the layer actually does rests on the digest pin.
|
|
250
|
+
*/
|
|
251
|
+
export async function encryptProvider(project, deps, io, provider, layer, output) {
|
|
252
|
+
if (encfsSection(readFileSync(layer)) === undefined) {
|
|
253
|
+
throw new CommandFailure('WASMCLOUD_PGLITE_ENCRYPTION_LAYER_UNMARKED', `The PGlite encryption layer ${layer} has no ${ENCFS_SECTION} custom section, so it is not ` +
|
|
254
|
+
"the platform's pglite-encfs component; pin the published ghcr.io/di-framework/pglite-encfs image", 3, { application: project.applicationName, path: layer });
|
|
255
|
+
}
|
|
256
|
+
const providerWorld = await componentWorld(project, deps, provider, 'PGlite provider');
|
|
257
|
+
const layerWorld = await componentWorld(project, deps, layer, 'PGlite encryption layer');
|
|
258
|
+
const plan = planWiring(providerWorld, layerWorld);
|
|
259
|
+
if (plan.problem !== undefined)
|
|
260
|
+
throw notInterposed(project, plan.problem);
|
|
261
|
+
const document = join(dirname(output), 'pglite-encryption.wac');
|
|
262
|
+
writeFileSync(document, encryptionComposition(plan.wires, providerWorld.exports));
|
|
263
|
+
rmSync(output, { force: true });
|
|
264
|
+
io.stdout.write('Composing the PGlite encryption layer into the provider...\n');
|
|
265
|
+
const result = await runWac(project, deps, [
|
|
266
|
+
'compose',
|
|
267
|
+
document,
|
|
268
|
+
'--dep',
|
|
269
|
+
`${LAYER_PACKAGE}=${layer}`,
|
|
270
|
+
'--dep',
|
|
271
|
+
`${PROVIDER_PACKAGE}=${provider}`,
|
|
272
|
+
'-o',
|
|
273
|
+
output,
|
|
274
|
+
]);
|
|
275
|
+
if (result.exitCode !== 0 || !existsSync(output)) {
|
|
276
|
+
const reason = (result.stderr || result.stdout).trim() || 'wac wrote no component';
|
|
277
|
+
throw notInterposed(project, `wac compose refused the wiring: ${reason}`);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* The encryption layer reads its key from `DI_PGLITE_KEY`, which reaches the guest only through
|
|
282
|
+
* the control Secret, and deploy keeps only the keys the project declares there.
|
|
283
|
+
*/
|
|
284
|
+
function assertPgliteKeyDeclared(project) {
|
|
285
|
+
if (project.pglite?.encryption === undefined)
|
|
286
|
+
return;
|
|
287
|
+
if (project.controlSecretKeys?.includes(PGLITE_KEY_ENV))
|
|
288
|
+
return;
|
|
289
|
+
throw new CommandFailure('WASMCLOUD_PGLITE_KEY_UNDECLARED', `${project.applicationName} turns on "pglite.encryption", whose layer reads its key from ` +
|
|
290
|
+
`${PGLITE_KEY_ENV} in the workload's control Secret; add "${PGLITE_KEY_ENV}" to ` +
|
|
291
|
+
`"controlSecretKeys" in di-framework.config.json`, 2, { application: project.applicationName });
|
|
292
|
+
}
|
|
183
293
|
/**
|
|
184
294
|
* The PGlite provider for a guest that imports `di-framework:pglite/database`. The config
|
|
185
295
|
* and the import must agree: the deploy marks the component exclusive and gives it storage
|
|
@@ -196,8 +306,17 @@ async function resolvePglite(project, imported, io, deps, deploy) {
|
|
|
196
306
|
}
|
|
197
307
|
return resolvePgliteComponent(project.pglite, io, deps, project.projectRoot, { deploy });
|
|
198
308
|
}
|
|
309
|
+
/** The encryption layer for the provider, when `pglite.encryption` is set. */
|
|
310
|
+
async function resolveEncryption(project, io, deps, deploy) {
|
|
311
|
+
const encryption = project.pglite?.encryption;
|
|
312
|
+
if (encryption === undefined)
|
|
313
|
+
return undefined;
|
|
314
|
+
return resolvePgliteEncryption(encryption, io, deps, project.projectRoot, { deploy });
|
|
315
|
+
}
|
|
199
316
|
/** The disposable `.di-framework/` build directory: WIT world, bundle, and manifests. */
|
|
200
317
|
export async function buildComponent(project, io, deps, options = {}) {
|
|
318
|
+
// A config check: before bundling and before anything is pulled.
|
|
319
|
+
assertPgliteKeyDeclared(project);
|
|
201
320
|
const generatedDirectory = join(project.projectRoot, '.di-framework');
|
|
202
321
|
const generatedWit = join(generatedDirectory, 'wit');
|
|
203
322
|
const bundledJavaScript = join(generatedDirectory, 'component.js');
|
|
@@ -305,10 +424,17 @@ export async function buildComponent(project, io, deps, options = {}) {
|
|
|
305
424
|
}
|
|
306
425
|
const needsPglite = finalRequirements.some((requirement) => requirement.package === DI_PGLITE_PACKAGE && requirement.direction === 'import');
|
|
307
426
|
const pglite = await resolvePglite(project, needsPglite, io, deps, options.deploy === true);
|
|
308
|
-
|
|
427
|
+
const encryption = pglite === undefined
|
|
428
|
+
? undefined
|
|
429
|
+
: await resolveEncryption(project, io, deps, options.deploy === true);
|
|
430
|
+
// Plug private copies of the verified bytes: the shared cache may change after verification.
|
|
309
431
|
const pgliteWasm = join(generatedDirectory, PGLITE_WASM_FILE);
|
|
432
|
+
const encfsWasm = join(generatedDirectory, PGLITE_ENCFS_WASM_FILE);
|
|
433
|
+
const encryptedWasm = join(generatedDirectory, PGLITE_ENCRYPTED_WASM_FILE);
|
|
310
434
|
if (pglite !== undefined)
|
|
311
435
|
writeFileSync(pgliteWasm, pglite.bytes);
|
|
436
|
+
if (encryption !== undefined)
|
|
437
|
+
writeFileSync(encfsWasm, encryption.bytes);
|
|
312
438
|
const componentize = await runComponentize(project, generatedWit, bundledJavaScript, deps);
|
|
313
439
|
if (componentize.exitCode !== 0) {
|
|
314
440
|
throw toolFailed(componentize.tool, componentize.exitCode);
|
|
@@ -323,9 +449,11 @@ export async function buildComponent(project, io, deps, options = {}) {
|
|
|
323
449
|
await composeComponentProvider(project, deps, io, provider, namedImports);
|
|
324
450
|
}
|
|
325
451
|
if (pglite !== undefined) {
|
|
452
|
+
if (encryption !== undefined)
|
|
453
|
+
await encryptProvider(project, deps, io, pgliteWasm, encfsWasm, encryptedWasm);
|
|
326
454
|
await composeProvider(project, deps, io, {
|
|
327
455
|
label: `${DI_PGLITE_PACKAGE}@${DI_PGLITE_VERSION}`,
|
|
328
|
-
wasm: pgliteWasm,
|
|
456
|
+
wasm: encryption === undefined ? pgliteWasm : encryptedWasm,
|
|
329
457
|
namedImports,
|
|
330
458
|
failureCode: 'WASMCLOUD_PGLITE_COMPOSE_FAILED',
|
|
331
459
|
});
|
|
@@ -342,7 +470,9 @@ export async function buildComponent(project, io, deps, options = {}) {
|
|
|
342
470
|
? join(deps.assetsDirectory(), 'sqlite', 'di-framework-sqlite.wasm')
|
|
343
471
|
: undefined, [
|
|
344
472
|
...composedProviders.map((provider) => provider.wasm),
|
|
473
|
+
// The raw provider and layer bytes, never wac's output, so only the inputs set the key.
|
|
345
474
|
...(pglite === undefined ? [] : [pgliteWasm]),
|
|
475
|
+
...(encryption === undefined ? [] : [encfsWasm]),
|
|
346
476
|
]);
|
|
347
477
|
const artifactDigest = digestBytes(readFileSync(project.outputPath));
|
|
348
478
|
const summary = {
|
|
@@ -358,9 +488,8 @@ export async function buildComponent(project, io, deps, options = {}) {
|
|
|
358
488
|
? {}
|
|
359
489
|
: {
|
|
360
490
|
pglite: {
|
|
361
|
-
|
|
362
|
-
...(
|
|
363
|
-
...(pglite.path === undefined ? {} : { path: pglite.path }),
|
|
491
|
+
...originOf(pglite),
|
|
492
|
+
...(encryption === undefined ? {} : { encryption: originOf(encryption) }),
|
|
364
493
|
},
|
|
365
494
|
}),
|
|
366
495
|
};
|
|
@@ -412,8 +541,20 @@ function listFiles(root) {
|
|
|
412
541
|
return files.sort();
|
|
413
542
|
}
|
|
414
543
|
export async function runWasmcloudBuild(args, io, deps = DEFAULT_DEPS) {
|
|
415
|
-
|
|
416
|
-
|
|
544
|
+
const parsed = parseBuildArgs(args);
|
|
545
|
+
if (parsed.bundle !== undefined) {
|
|
546
|
+
const bundle = await buildDeployBundle({
|
|
547
|
+
outputPath: parsed.bundle,
|
|
548
|
+
env: parsed.env,
|
|
549
|
+
target: parsed.target,
|
|
550
|
+
registry: parsed.registry,
|
|
551
|
+
tag: parsed.tag,
|
|
552
|
+
name: parsed.name,
|
|
553
|
+
}, io, deps);
|
|
554
|
+
return {
|
|
555
|
+
data: bundle,
|
|
556
|
+
text: `Wrote DeployBundle for ${bundle.service} (${bundle.env}) to ${parsed.bundle}`,
|
|
557
|
+
};
|
|
417
558
|
}
|
|
418
559
|
const project = loadProject(deps.cwd());
|
|
419
560
|
const summary = await buildComponent(project, io, deps);
|
package/dist/bundle.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { CliIo } from '@di-framework/cli-extension';
|
|
2
|
+
import { type BuildSummary, canonicalBuildDigest } from './build.js';
|
|
3
|
+
import { type WasmcloudDeps } from './deps.js';
|
|
4
|
+
import { type DeployEnvironment, type ManifestBinding } from './manifest.js';
|
|
5
|
+
import { type WasmcloudProject } from './project.js';
|
|
6
|
+
import { type PublishedImage } from './publish.js';
|
|
7
|
+
import { type RegistryInput } from './registry.js';
|
|
8
|
+
import { type ClusterConnection } from './target.js';
|
|
9
|
+
export type { DeployEnvironment, ManifestBinding };
|
|
10
|
+
export { canonicalBuildDigest };
|
|
11
|
+
export declare const PASSTHROUGH_LABEL_PREFIX = "app.di-framework.dev/";
|
|
12
|
+
export type ComponentReference = {
|
|
13
|
+
reference: string;
|
|
14
|
+
digest: string;
|
|
15
|
+
};
|
|
16
|
+
export type DeployBinding = {
|
|
17
|
+
name: string;
|
|
18
|
+
capability: string;
|
|
19
|
+
serviceName: string;
|
|
20
|
+
config?: Record<string, string>;
|
|
21
|
+
};
|
|
22
|
+
export type DeployBundle = {
|
|
23
|
+
env: DeployEnvironment;
|
|
24
|
+
service: string;
|
|
25
|
+
component: ComponentReference;
|
|
26
|
+
workload: Record<string, unknown>;
|
|
27
|
+
bindings: DeployBinding[];
|
|
28
|
+
secrets: string[];
|
|
29
|
+
};
|
|
30
|
+
export type BundleRegistryCredentials = {
|
|
31
|
+
registry?: RegistryInput;
|
|
32
|
+
repository?: string;
|
|
33
|
+
username?: string;
|
|
34
|
+
password?: string;
|
|
35
|
+
token?: string;
|
|
36
|
+
registryConfigPath?: string;
|
|
37
|
+
};
|
|
38
|
+
export type BundlePublishContext = {
|
|
39
|
+
project: WasmcloudProject;
|
|
40
|
+
connection: ClusterConnection;
|
|
41
|
+
build: BuildSummary;
|
|
42
|
+
io: CliIo;
|
|
43
|
+
deps: WasmcloudDeps;
|
|
44
|
+
tag?: string;
|
|
45
|
+
credentials?: BundleRegistryCredentials;
|
|
46
|
+
};
|
|
47
|
+
export type BuildDeployBundleOptions = {
|
|
48
|
+
name?: string;
|
|
49
|
+
project?: WasmcloudProject;
|
|
50
|
+
env?: DeployEnvironment;
|
|
51
|
+
target?: string;
|
|
52
|
+
registry?: RegistryInput;
|
|
53
|
+
tag?: string;
|
|
54
|
+
credentials?: BundleRegistryCredentials | (() => Promise<BundleRegistryCredentials> | BundleRegistryCredentials);
|
|
55
|
+
publish?: (context: BundlePublishContext) => Promise<PublishedImage | ComponentReference>;
|
|
56
|
+
bindings?: readonly DeployBinding[];
|
|
57
|
+
secrets?: readonly string[];
|
|
58
|
+
/** Optional passthrough labels (`app.di-framework.dev/*`) to merge onto workload.metadata.labels. */
|
|
59
|
+
labels?: Readonly<Record<string, string>>;
|
|
60
|
+
/** Optional passthrough annotations (`app.di-framework.dev/*`) to merge onto workload.metadata.annotations. */
|
|
61
|
+
annotations?: Readonly<Record<string, string>>;
|
|
62
|
+
outputPath?: string;
|
|
63
|
+
};
|
|
64
|
+
export type ParsedBuildArgs = {
|
|
65
|
+
bundle?: string;
|
|
66
|
+
env?: DeployEnvironment;
|
|
67
|
+
target?: string;
|
|
68
|
+
registry?: string;
|
|
69
|
+
tag?: string;
|
|
70
|
+
name?: string;
|
|
71
|
+
};
|
|
72
|
+
export declare function parseBuildArgs(args: readonly string[]): ParsedBuildArgs;
|
|
73
|
+
export declare function normalizeSha256Digest(digest: string): string;
|
|
74
|
+
export declare function pinImageToDigest(reference: string, digest: string): string;
|
|
75
|
+
export type SanitizeWorkloadOptions = {
|
|
76
|
+
service: string;
|
|
77
|
+
env: DeployEnvironment;
|
|
78
|
+
component: ComponentReference;
|
|
79
|
+
publicIngress?: boolean;
|
|
80
|
+
labels?: Readonly<Record<string, string>>;
|
|
81
|
+
annotations?: Readonly<Record<string, string>>;
|
|
82
|
+
};
|
|
83
|
+
export declare function sanitizeWorkloadForBundle(workload: Record<string, unknown>, options: SanitizeWorkloadOptions): Record<string, unknown>;
|
|
84
|
+
export declare function parseWorkloadDeploymentYaml(manifestYaml: string): Record<string, unknown>;
|
|
85
|
+
export declare function buildDeployBundle(options: BuildDeployBundleOptions | undefined, io: CliIo, deps?: WasmcloudDeps): Promise<DeployBundle>;
|