@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.
Files changed (60) hide show
  1. package/README.md +154 -12
  2. package/dist/args.d.ts +8 -0
  3. package/dist/args.js +73 -28
  4. package/dist/assets/http-adapter.js +4 -1
  5. package/dist/assets/platform/README.md +68 -19
  6. package/dist/assets/platform/index.ts.tmpl +1 -1
  7. package/dist/assets/platform/tsconfig.json +2 -2
  8. package/dist/assets/sqlite/BUILD-INFO.txt +1 -1
  9. package/dist/build.d.ts +27 -4
  10. package/dist/build.js +159 -18
  11. package/dist/bundle.d.ts +85 -0
  12. package/dist/bundle.js +608 -0
  13. package/dist/command.js +85 -3
  14. package/dist/console/catalog.js +2 -1
  15. package/dist/console/cluster.d.ts +4 -2
  16. package/dist/console/cluster.js +38 -40
  17. package/dist/control/auth.js +14 -2
  18. package/dist/controller/client.d.ts +47 -0
  19. package/dist/controller/client.js +157 -0
  20. package/dist/controller/commands.d.ts +48 -0
  21. package/dist/controller/commands.js +584 -0
  22. package/dist/controller/credentials.d.ts +63 -0
  23. package/dist/controller/credentials.js +156 -0
  24. package/dist/controller/index.d.ts +6 -0
  25. package/dist/controller/index.js +6 -0
  26. package/dist/controller/oidc.d.ts +54 -0
  27. package/dist/controller/oidc.js +121 -0
  28. package/dist/controller/registry.d.ts +15 -0
  29. package/dist/controller/registry.js +47 -0
  30. package/dist/controller/schema.d.ts +157 -0
  31. package/dist/controller/schema.js +1 -0
  32. package/dist/controller/sse.d.ts +12 -0
  33. package/dist/controller/sse.js +61 -0
  34. package/dist/controller/trust.d.ts +14 -0
  35. package/dist/controller/trust.js +39 -0
  36. package/dist/deploy.d.ts +14 -7
  37. package/dist/deploy.js +96 -5
  38. package/dist/deps.d.ts +4 -0
  39. package/dist/destroy.js +26 -2
  40. package/dist/environment-names.d.ts +6 -0
  41. package/dist/environment-names.js +10 -0
  42. package/dist/index.d.ts +5 -3
  43. package/dist/index.js +5 -3
  44. package/dist/manifest.d.ts +45 -1
  45. package/dist/manifest.js +197 -4
  46. package/dist/pglite-encryption.d.ts +79 -0
  47. package/dist/pglite-encryption.js +196 -0
  48. package/dist/pglite.d.ts +61 -4
  49. package/dist/pglite.js +124 -40
  50. package/dist/project.d.ts +7 -0
  51. package/dist/project.js +35 -0
  52. package/dist/publish.d.ts +7 -1
  53. package/dist/publish.js +33 -1
  54. package/dist/service.d.ts +34 -0
  55. package/dist/service.js +156 -145
  56. package/dist/target.d.ts +7 -1
  57. package/dist/target.js +19 -0
  58. package/dist/workload.d.ts +50 -12
  59. package/dist/workload.js +239 -44
  60. package/package.json +1 -1
@@ -0,0 +1,39 @@
1
+ import { readFileSync } from 'node:fs';
2
+ import { rootCertificates } from 'node:tls';
3
+ import { CliError } from './credentials.js';
4
+ const PEM_CERTIFICATE = /-----BEGIN CERTIFICATE-----[\s\S]+?-----END CERTIFICATE-----/g;
5
+ /**
6
+ * Reads `--ca-file`: one or more PEM certificates, such as the tenant's `tenant-controller-ca`.
7
+ * Returns them base64-encoded, the form `controller.certificateAuthorityData` takes in the
8
+ * credential store.
9
+ */
10
+ export function readCaFile(path) {
11
+ let text;
12
+ try {
13
+ text = readFileSync(path, 'utf8');
14
+ }
15
+ catch (error) {
16
+ throw new CliError(`--ca-file ${path}: ${error.message}`);
17
+ }
18
+ const certificates = text.match(PEM_CERTIFICATE);
19
+ if (!certificates)
20
+ throw new CliError(`--ca-file ${path} holds no PEM certificate`);
21
+ return Buffer.from(`${certificates.join('\n')}\n`).toString('base64');
22
+ }
23
+ /** The PEM of the CA stored with the credential, if any. */
24
+ export function caPem(controller) {
25
+ const data = controller.certificateAuthorityData;
26
+ return data ? Buffer.from(data, 'base64').toString('utf8') : undefined;
27
+ }
28
+ /**
29
+ * A `fetch` that also trusts `pem` (on top of the bundled public roots) for TLS. Without a CA it
30
+ * is the given `fetch` unchanged, so `NODE_EXTRA_CA_CERTS` keeps working as before.
31
+ */
32
+ export function trusting(base, pem) {
33
+ if (!pem)
34
+ return base;
35
+ const doFetch = base ?? fetch;
36
+ const ca = [...rootCertificates, pem];
37
+ const wrapped = (input, init) => doFetch(input, { ...init, tls: { ...init?.tls, ca } });
38
+ return wrapped;
39
+ }
package/dist/deploy.d.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  import type { CliIo, CommandResult } from '@di-framework/cli-extension';
2
+ import { type BuildSummary } from './build.js';
3
+ import { type Deployment, type DeployPlan } from './controller/index.js';
2
4
  import { type WasmcloudDeps } from './deps.js';
3
- import type { RegistryLocation } from './registry.js';
5
+ import { type DeployEnvironment } from './manifest.js';
6
+ import { type RegistryLocation } from './registry.js';
4
7
  export type WasmcloudDeployData = {
5
8
  cronJobs?: Array<{
6
9
  jobId: string;
@@ -16,17 +19,21 @@ export type WasmcloudDeployData = {
16
19
  digest: string;
17
20
  deploymentDigest: string;
18
21
  service: string;
22
+ env?: DeployEnvironment;
23
+ account?: string;
24
+ controller?: string;
25
+ deployment?: Deployment;
26
+ preview?: DeployPlan;
19
27
  http?: {
20
28
  url: string;
21
29
  host: string;
22
30
  };
23
31
  endpoints?: Record<string, string>;
24
- /** Where the composed PGlite provider came from: a digest pin or a local file. */
25
- pglite?: {
26
- source: 'local' | 'cache' | 'registry';
27
- image?: string;
28
- path?: string;
29
- };
32
+ /**
33
+ * Where the composed PGlite provider came from (a digest pin or a local file) and, when
34
+ * `pglite.encryption` is set, its encryption layer.
35
+ */
36
+ pglite?: BuildSummary['pglite'];
30
37
  };
31
38
  export type WasmcloudDeployResult = Omit<CommandResult, 'data' | 'text'> & {
32
39
  data: WasmcloudDeployData;
package/dist/deploy.js CHANGED
@@ -1,14 +1,98 @@
1
1
  import { parseAppCommandArgs } from './args.js';
2
2
  import { buildComponent } from './build.js';
3
+ import { buildDeployBundle } from './bundle.js';
4
+ import { bearer, registryOrigin, registryUsername, resolveControllerSession, wrapControllerError, } from './controller/index.js';
3
5
  import { discoverScheduledJobs } from './cron.js';
4
6
  import { DEFAULT_DEPS } from './deps.js';
5
7
  import { discoverProjects, resolveApplication } from './discovery.js';
6
- import { loadDeployManifest } from './manifest.js';
8
+ import { loadDeployManifest, tenantNamespace, } from './manifest.js';
7
9
  import { assertDistinctPgliteRoots } from './pglite.js';
8
10
  import { publishComponent } from './publish.js';
9
- import { resolveConnection, resolveTarget } from './target.js';
11
+ import { materializeRegistry } from './registry.js';
12
+ import { isControllerBackedTarget, resolveConnection, resolveTarget } from './target.js';
10
13
  import { applyWorkload, deploymentResourceName } from './workload.js';
11
14
  import { writeWorkloadManifest } from './workload-members.js';
15
+ async function runControllerDeploy(project, target, manifest, options, io, deps) {
16
+ try {
17
+ const { credential, client } = await resolveControllerSession({ target }, deps);
18
+ const registryInfo = await client.registry();
19
+ const regOrigin = registryOrigin(registryInfo.url);
20
+ const username = registryUsername(registryInfo.username);
21
+ const env = options.env ?? target.env ?? manifest.env ?? 'prod';
22
+ const repository = registryInfo.repositoryPrefix
23
+ ? `${registryInfo.repositoryPrefix}/${project.witName}`
24
+ : project.witName;
25
+ io.stdout.write(`Deploying ${project.applicationName} to target ${target.name} (${credential.account}/${env})...\n`);
26
+ const bundle = await buildDeployBundle({
27
+ project,
28
+ target: target.name,
29
+ env,
30
+ registry: regOrigin.origin,
31
+ credentials: {
32
+ username,
33
+ password: bearer(credential),
34
+ repository,
35
+ },
36
+ }, io, deps);
37
+ const cronJobs = discoverScheduledJobs(project.projectRoot);
38
+ const namespace = tenantNamespace(credential.account);
39
+ const registry = materializeRegistry(regOrigin.origin);
40
+ const deploymentDigest = bundle.component.digest.replace(/^sha256:/, '');
41
+ if (options.preview) {
42
+ const plan = await client.previewDeploy(bundle);
43
+ const changesSummary = plan.changes.length === 0
44
+ ? 'no changes'
45
+ : plan.changes.map((c) => `${c.kind} ${c.resource}/${c.name}`).join(', ');
46
+ const data = {
47
+ application: project.applicationName,
48
+ target: target.name,
49
+ namespace,
50
+ registry,
51
+ image: bundle.component.reference,
52
+ publishedImage: bundle.component.reference,
53
+ digest: bundle.component.digest,
54
+ deploymentDigest,
55
+ service: bundle.service,
56
+ env,
57
+ account: credential.account,
58
+ controller: credential.controller.url,
59
+ preview: plan,
60
+ };
61
+ const text = `Previewed ${project.applicationName} in ${plan.env} (${credential.account}): ${changesSummary}.`;
62
+ return { data, text };
63
+ }
64
+ const deployment = await client.deploy(bundle);
65
+ const cronSummary = cronJobs.map((j) => ({
66
+ jobId: j.jobId,
67
+ schedule: j.schedule,
68
+ cronExpression: j.cronExpression,
69
+ }));
70
+ const data = {
71
+ application: project.applicationName,
72
+ target: target.name,
73
+ namespace,
74
+ registry,
75
+ image: bundle.component.reference,
76
+ publishedImage: bundle.component.reference,
77
+ digest: bundle.component.digest,
78
+ deploymentDigest,
79
+ service: bundle.service,
80
+ env,
81
+ account: credential.account,
82
+ controller: credential.controller.url,
83
+ deployment,
84
+ ...(cronSummary.length > 0 ? { cronJobs: cronSummary } : {}),
85
+ };
86
+ const cronNote = cronJobs.length > 0
87
+ ? ` Scheduled jobs (${cronJobs.length}): ${cronJobs.map((j) => j.jobId).join(', ')}`
88
+ : '';
89
+ const text = `Deployed ${project.applicationName} to ${target.name} (${credential.account}/${deployment.env}: ${deployment.id} ${deployment.status}, ${bundle.component.reference}).${cronNote}`;
90
+ return { data, text };
91
+ }
92
+ catch (error) {
93
+ wrapControllerError(error);
94
+ }
95
+ }
12
96
  export async function runWasmcloudDeploy(args, io, deps = DEFAULT_DEPS) {
13
97
  const options = parseAppCommandArgs(args, 'platform deploy');
14
98
  const manifest = loadDeployManifest(deps.cwd(), deps.env);
@@ -20,6 +104,9 @@ export async function runWasmcloudDeploy(args, io, deps = DEFAULT_DEPS) {
20
104
  const path = writeWorkloadManifest(manifest.workspaceRoot, project.workload, members);
21
105
  io.stdout.write(`Generated workload manifest ${path}\n`);
22
106
  }
107
+ if (isControllerBackedTarget(target)) {
108
+ return runControllerDeploy(project, target, manifest, options, io, deps);
109
+ }
23
110
  const build = await buildComponent(project, io, deps, { deploy: true });
24
111
  const connection = await resolveConnection(target, manifest.workspaceRoot, manifest.path, deps);
25
112
  io.stdout.write(`Deploying ${project.applicationName} to target ${connection.target}...\n`);
@@ -66,10 +153,14 @@ export async function runWasmcloudDeploy(args, io, deps = DEFAULT_DEPS) {
66
153
  ].join(''),
67
154
  };
68
155
  }
156
+ function originText(origin) {
157
+ return origin.path === undefined ? `${origin.image}` : `local ${origin.path} (unverified)`;
158
+ }
69
159
  function pgliteText(pglite) {
70
160
  if (pglite === undefined)
71
161
  return '';
72
- return pglite.path === undefined
73
- ? ` PGlite: ${pglite.image}.`
74
- : ` PGlite: local ${pglite.path} (unverified).`;
162
+ const encryption = pglite.encryption === undefined
163
+ ? ''
164
+ : `, encrypted at rest by ${originText(pglite.encryption)}`;
165
+ return ` PGlite: ${originText(pglite)}${encryption}.`;
75
166
  }
package/dist/deps.d.ts CHANGED
@@ -61,6 +61,10 @@ export type WasmcloudDeps = {
61
61
  resolveFromProject(projectRoot: string, specifier: string): string | undefined;
62
62
  env: Record<string, string | undefined>;
63
63
  cwd(): string;
64
+ fetch?: typeof fetch;
65
+ openBrowser?(url: string): void;
66
+ loginTimeoutMs?: number;
67
+ stdin?(): string;
64
68
  };
65
69
  export type NodeCompatibilityPaths = {
66
70
  guestsPath?: string;
package/dist/destroy.js CHANGED
@@ -1,14 +1,38 @@
1
1
  import { parseAppCommandArgs } from './args.js';
2
+ import { resolveControllerSession, wrapControllerError } from './controller/index.js';
2
3
  import { DEFAULT_DEPS } from './deps.js';
3
4
  import { resolveApplication } from './discovery.js';
4
- import { loadDeployManifest } from './manifest.js';
5
- import { resolveConnection, resolveTarget } from './target.js';
5
+ import { loadDeployManifest, tenantNamespace } from './manifest.js';
6
+ import { isControllerBackedTarget, resolveConnection, resolveTarget } from './target.js';
6
7
  import { deleteWorkload, deploymentResourceName } from './workload.js';
7
8
  export async function runWasmcloudDestroy(args, io, deps = DEFAULT_DEPS) {
8
9
  const options = parseAppCommandArgs(args, 'platform destroy');
9
10
  const manifest = loadDeployManifest(deps.cwd(), deps.env);
10
11
  const target = resolveTarget(manifest, options.target);
11
12
  const project = resolveApplication(deps.cwd(), options.name, manifest.workspaceRoot, manifest.discovery);
13
+ if (isControllerBackedTarget(target)) {
14
+ try {
15
+ const { credential, client } = await resolveControllerSession({ target }, deps);
16
+ const env = options.env ?? target.env ?? manifest.env ?? 'prod';
17
+ const service = deploymentResourceName(project);
18
+ await client.removeDeployment(env, service);
19
+ const namespace = tenantNamespace(credential.account);
20
+ return {
21
+ data: {
22
+ application: project.applicationName,
23
+ target: target.name,
24
+ account: credential.account,
25
+ env,
26
+ namespace,
27
+ service,
28
+ },
29
+ text: `Removed ${project.applicationName} from ${target.name} (${credential.account}/${env}).`,
30
+ };
31
+ }
32
+ catch (error) {
33
+ wrapControllerError(error);
34
+ }
35
+ }
12
36
  const connection = await resolveConnection(target, manifest.workspaceRoot, manifest.path, deps);
13
37
  await deleteWorkload(project, connection, io, deps);
14
38
  const service = deploymentResourceName(project);
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Environment names the CLI renders into a workload's `localResources.environment.config`
3
+ * without a `DI_` prefix (every `DI_*` name is the framework's as well). The console hides them,
4
+ * and `controlSecretKeys` may not declare them, so a Secret key never shadows one.
5
+ */
6
+ export declare const RENDERED_ENVIRONMENT_KEYS: readonly string[];
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Environment names the CLI renders into a workload's `localResources.environment.config`
3
+ * without a `DI_` prefix (every `DI_*` name is the framework's as well). The console hides them,
4
+ * and `controlSecretKeys` may not declare them, so a Secret key never shadows one.
5
+ */
6
+ export const RENDERED_ENVIRONMENT_KEYS = [
7
+ 'ACTOR_STORAGE_DIR',
8
+ 'QUEUE_DB_PATH',
9
+ 'MIGRATION_DB_PATH',
10
+ ];
package/dist/index.d.ts CHANGED
@@ -3,8 +3,10 @@ export { ACTORS_INVOCATION_PATH, type ActorDiscoveredRecord, type ActorMethodRec
3
3
  export { parseAppCommandArgs, parsePlatformCommandArgs, parsePlatformInitArgs } from './args.js';
4
4
  export { type BindingRecord, defaultSecretName, discoverBindings, parseBindingsFile, requirementsFromBindings, } from './bindings.js';
5
5
  export { BUILD_PROFILE, buildComponent, canonicalBuildDigest, requirementsForProject, runWasmcloudBuild, WASI_HTTP_INTERFACE, WASI_HTTP_VERSION, } from './build.js';
6
+ export { type BuildDeployBundleOptions, type BundlePublishContext, type BundleRegistryCredentials, buildDeployBundle, type ComponentReference, type DeployBinding, type DeployBundle, type DeployEnvironment, type ManifestBinding, normalizeSha256Digest, PASSTHROUGH_LABEL_PREFIX, type ParsedBuildArgs, parseBuildArgs, parseWorkloadDeploymentYaml, pinImageToDigest, type SanitizeWorkloadOptions, sanitizeWorkloadForBundle, } from './bundle.js';
6
7
  export { createWasmcloudCommand } from './command.js';
7
8
  export { runWasmcloudConsole } from './console/run.js';
9
+ export { type AccountCommandOptions, type AuthInfo, type AuthorizationRequest, authorizationUrl, base64url, bearer, CliError, type ClientOptions, type ConfigAction, type ConfigCommandOptions, type ConfigList, type ControllerDeployBundle, ControllerError, type CreateServiceRequest, type Credential, type CredentialStore, caPem, createClient, type Deployment, type DeploymentList, type DeploymentStats, type DeployPlan, discover, type Env, events, exchangeCode, home, issuedTokens, type LogEvent, type LoginOptions, type LogsCommandOptions, type LogsQuery, load, needsRefresh, OidcError, type Principal, type Problem, type ProviderMetadata, type ProxyRequest, type ProxySession, parseAccountCommandArgs, parseConfigArgs, parseLoginArgs, parseLogsArgs, pkce, type RegistryInfo, type RegistryOrigin, type ResolveControllerSessionOptions, type RollbackRequest, randomToken, readCaFile, readStore, refreshCredential, refreshTokens, registryOrigin, registryUsername, resolveAccount, resolveControllerSession, revokeToken, runWasmcloudLogin, runWasmcloudLogout, runWasmcloudLogs, runWasmcloudSecrets, runWasmcloudVars, runWasmcloudWhoami, type SecretList, type Service, type SseEvent, type TenantClient, type TokenResponse, tlsTrustCode, trusting, type VarUnset, wrapControllerError, writeStore, } from './controller/index.js';
8
10
  export { runWasmcloudDeploy, type WasmcloudDeployData, type WasmcloudDeployResult, } from './deploy.js';
9
11
  export { type BundleOptions, COMPONENT_IMPORT_EXTERNAL, COMPONENTIZE_QJS_ENV, COMPONENTIZE_QJS_PACKAGE, componentizeQjsPlatformPackageName, DEFAULT_DEPS, findInstalledComponentizeQjsCli, nativeComponentizeQjsOnPath, nodeCompatibilityPlugin, resolveComponentizeQjsPath, type WasmcloudDeps, } from './deps.js';
10
12
  export { runWasmcloudDestroy } from './destroy.js';
@@ -14,7 +16,7 @@ export { discoverProjects, findConfigFiles, resolveApplication, } from './discov
14
16
  export { runWasmcloudDoctor } from './doctor.js';
15
17
  export { emptyGuestsModule, renderGuestsModule, WASMCLOUD_GUESTS_GLOBAL } from './guests.js';
16
18
  export { hostInterfacesFromRequirements } from './host-interface.js';
17
- export { DEPLOY_MANIFEST_NAME, type DeployManifest, type DeployTarget, loadDeployManifest, parseDeployManifest, } from './manifest.js';
19
+ export { type AccountTarget, type ControllerTarget, DEPLOY_MANIFEST_NAME, type DeployManifest, type DeployTarget, type ExternalTarget, isControllerDomain, isTenantName, loadDeployManifest, type ManagedTarget, normalizeControllerUrl, parseDeployManifest, tenantHostgroup, tenantNamespace, } from './manifest.js';
18
20
  export { wasmcloudNodeEnv, wasmcloudUnenvPreset } from './node-compat/env.js';
19
21
  export { compactEnviron, createNodeCompatSeed, NODE_COMPAT_SEED_ID, type NodeCompatSeed, } from './node-compat/seed.js';
20
22
  export { OCI_ARTIFACT_PLATFORM } from './oci.js';
@@ -26,9 +28,9 @@ export { pulumiEnvironment, runPulumi } from './pulumi.js';
26
28
  export { type DiscoveredQueueHandler, discoverQueueHandlers, isQueueWorkerProject, parseQueueHandlersInFile, } from './queues.js';
27
29
  export { materializeRegistry, type RegistryInput, type RegistryLocation, registryReferenceHost, registryUsesPlainHttp, } from './registry.js';
28
30
  export { BACKING_SERVICE_API_VERSION, BACKING_SERVICE_KIND, BACKING_SERVICE_RESOURCE, buildBackingServiceManifest, DEFAULT_SERVICE_CLASSES, isBackingServiceName, isServiceType, parseServiceCreateArgs, parseServiceListArgs, parseServiceNameArgs, runWasmcloudServiceClasses, runWasmcloudServiceCreate, runWasmcloudServiceDelete, runWasmcloudServiceGet, runWasmcloudServiceList, SERVICE_TYPES, summarizeService, } from './service.js';
29
- export { resolveConnection, resolveTarget } from './target.js';
31
+ export { type ClusterConnection, discoverAccountControllerUrl, isControllerBackedTarget, resolveConnection, resolveTarget, } from './target.js';
30
32
  export { renderWashDevYaml, writeWashDevConfig } from './wash-dev.js';
31
33
  export { aggregateRequirements, COMPONENT_MODEL, DI_QUEUES_INTERFACE, DI_QUEUES_PACKAGE, DI_QUEUES_VERSION, defaultProjectRequirements, HTTP_ADAPTER_REQUIREMENTS, QUEUE_ADAPTER_REQUIREMENTS, QUEUE_ADAPTER_SOURCE, queueProjectRequirements, renderWorldWit, runtimeRequirementsFromJavaScript, socketRequirementsFromJavaScript, type WitRequirement, } from './wit.js';
32
- export { applyWorkload, type ControlSecretWrite, CRON_INVOKER_IMAGE, controlSecretDocument, controlSecretResourceName, DEFAULT_STORAGE_MOUNT, deleteControlSecret, deleteWorkload, HOST_STORAGE_ROOT, hostStoragePath, isReady, renderWorkloadManifest, STORAGE_HOSTGROUP, type WorkloadManifestOptions, writeControlSecret, } from './workload.js';
34
+ export { applyWorkload, CONTROL_SECRET_CLI_KEYS, type ControlSecretWrite, CRON_INVOKER_IMAGE, controlSecretDocument, controlSecretResourceName, DEFAULT_STORAGE_MOUNT, deleteControlSecret, deleteWorkload, HOST_STORAGE_ROOT, hostStoragePath, isReady, renderWorkloadManifest, STORAGE_HOSTGROUP, type WorkloadManifestOptions, writeControlSecret, } from './workload.js';
33
35
  declare const _default: import("@di-framework/cli-extension").ExtensionManifest;
34
36
  export default _default;
package/dist/index.js CHANGED
@@ -5,8 +5,10 @@ export { ACTORS_INVOCATION_PATH, createWasmcloudActorAdapter, discoverActors, em
5
5
  export { parseAppCommandArgs, parsePlatformCommandArgs, parsePlatformInitArgs } from './args.js';
6
6
  export { defaultSecretName, discoverBindings, parseBindingsFile, requirementsFromBindings, } from './bindings.js';
7
7
  export { BUILD_PROFILE, buildComponent, canonicalBuildDigest, requirementsForProject, runWasmcloudBuild, WASI_HTTP_INTERFACE, WASI_HTTP_VERSION, } from './build.js';
8
+ export { buildDeployBundle, normalizeSha256Digest, PASSTHROUGH_LABEL_PREFIX, parseBuildArgs, parseWorkloadDeploymentYaml, pinImageToDigest, sanitizeWorkloadForBundle, } from './bundle.js';
8
9
  export { createWasmcloudCommand } from './command.js';
9
10
  export { runWasmcloudConsole } from './console/run.js';
11
+ export { authorizationUrl, base64url, bearer, CliError, ControllerError, caPem, createClient, discover, events, exchangeCode, home, issuedTokens, load, needsRefresh, OidcError, parseAccountCommandArgs, parseConfigArgs, parseLoginArgs, parseLogsArgs, pkce, randomToken, readCaFile, readStore, refreshCredential, refreshTokens, registryOrigin, registryUsername, resolveAccount, resolveControllerSession, revokeToken, runWasmcloudLogin, runWasmcloudLogout, runWasmcloudLogs, runWasmcloudSecrets, runWasmcloudVars, runWasmcloudWhoami, tlsTrustCode, trusting, wrapControllerError, writeStore, } from './controller/index.js';
10
12
  export { runWasmcloudDeploy, } from './deploy.js';
11
13
  export { COMPONENT_IMPORT_EXTERNAL, COMPONENTIZE_QJS_ENV, COMPONENTIZE_QJS_PACKAGE, componentizeQjsPlatformPackageName, DEFAULT_DEPS, findInstalledComponentizeQjsCli, nativeComponentizeQjsOnPath, nodeCompatibilityPlugin, resolveComponentizeQjsPath, } from './deps.js';
12
14
  export { runWasmcloudDestroy } from './destroy.js';
@@ -16,7 +18,7 @@ export { discoverProjects, findConfigFiles, resolveApplication, } from './discov
16
18
  export { runWasmcloudDoctor } from './doctor.js';
17
19
  export { emptyGuestsModule, renderGuestsModule, WASMCLOUD_GUESTS_GLOBAL } from './guests.js';
18
20
  export { hostInterfacesFromRequirements } from './host-interface.js';
19
- export { DEPLOY_MANIFEST_NAME, loadDeployManifest, parseDeployManifest, } from './manifest.js';
21
+ export { DEPLOY_MANIFEST_NAME, isControllerDomain, isTenantName, loadDeployManifest, normalizeControllerUrl, parseDeployManifest, tenantHostgroup, tenantNamespace, } from './manifest.js';
20
22
  export { wasmcloudNodeEnv, wasmcloudUnenvPreset } from './node-compat/env.js';
21
23
  export { compactEnviron, createNodeCompatSeed, NODE_COMPAT_SEED_ID, } from './node-compat/seed.js';
22
24
  export { OCI_ARTIFACT_PLATFORM } from './oci.js';
@@ -28,10 +30,10 @@ export { pulumiEnvironment, runPulumi } from './pulumi.js';
28
30
  export { discoverQueueHandlers, isQueueWorkerProject, parseQueueHandlersInFile, } from './queues.js';
29
31
  export { materializeRegistry, registryReferenceHost, registryUsesPlainHttp, } from './registry.js';
30
32
  export { BACKING_SERVICE_API_VERSION, BACKING_SERVICE_KIND, BACKING_SERVICE_RESOURCE, buildBackingServiceManifest, DEFAULT_SERVICE_CLASSES, isBackingServiceName, isServiceType, parseServiceCreateArgs, parseServiceListArgs, parseServiceNameArgs, runWasmcloudServiceClasses, runWasmcloudServiceCreate, runWasmcloudServiceDelete, runWasmcloudServiceGet, runWasmcloudServiceList, SERVICE_TYPES, summarizeService, } from './service.js';
31
- export { resolveConnection, resolveTarget } from './target.js';
33
+ export { discoverAccountControllerUrl, isControllerBackedTarget, resolveConnection, resolveTarget, } from './target.js';
32
34
  export { renderWashDevYaml, writeWashDevConfig } from './wash-dev.js';
33
35
  export { aggregateRequirements, COMPONENT_MODEL, DI_QUEUES_INTERFACE, DI_QUEUES_PACKAGE, DI_QUEUES_VERSION, defaultProjectRequirements, HTTP_ADAPTER_REQUIREMENTS, QUEUE_ADAPTER_REQUIREMENTS, QUEUE_ADAPTER_SOURCE, queueProjectRequirements, renderWorldWit, runtimeRequirementsFromJavaScript, socketRequirementsFromJavaScript, } from './wit.js';
34
- export { applyWorkload, CRON_INVOKER_IMAGE, controlSecretDocument, controlSecretResourceName, DEFAULT_STORAGE_MOUNT, deleteControlSecret, deleteWorkload, HOST_STORAGE_ROOT, hostStoragePath, isReady, renderWorkloadManifest, STORAGE_HOSTGROUP, writeControlSecret, } from './workload.js';
36
+ export { applyWorkload, CONTROL_SECRET_CLI_KEYS, CRON_INVOKER_IMAGE, controlSecretDocument, controlSecretResourceName, DEFAULT_STORAGE_MOUNT, deleteControlSecret, deleteWorkload, HOST_STORAGE_ROOT, hostStoragePath, isReady, renderWorkloadManifest, STORAGE_HOSTGROUP, writeControlSecret, } from './workload.js';
35
37
  export default defineExtension({
36
38
  schemaVersion: 1,
37
39
  name: 'platform',
@@ -6,11 +6,21 @@ export type DiscoveryConfig = {
6
6
  include: string[];
7
7
  exclude: string[];
8
8
  };
9
+ export type DeployEnvironment = 'prod' | 'staging';
10
+ export type ManifestBinding = {
11
+ name: string;
12
+ capability: string;
13
+ serviceName: string;
14
+ config?: Record<string, string>;
15
+ };
9
16
  export type ManagedTarget = {
10
17
  kind: 'managed';
11
18
  name: string;
12
19
  platform: string;
13
20
  stack: string;
21
+ env?: DeployEnvironment;
22
+ bindings?: ManifestBinding[];
23
+ secrets?: string[];
14
24
  };
15
25
  export type ExternalTarget = {
16
26
  kind: 'external';
@@ -23,21 +33,55 @@ export type ExternalTarget = {
23
33
  context?: string;
24
34
  hostgroup?: string;
25
35
  storageHostgroup?: string;
36
+ env?: DeployEnvironment;
37
+ bindings?: ManifestBinding[];
38
+ secrets?: string[];
39
+ };
40
+ export type AccountTarget = {
41
+ kind: 'account';
42
+ name: string;
43
+ account: string;
44
+ domain?: string;
45
+ env?: DeployEnvironment;
46
+ bindings?: ManifestBinding[];
47
+ secrets?: string[];
48
+ };
49
+ export type ControllerTarget = {
50
+ kind: 'controller';
51
+ name: string;
52
+ controller: string;
53
+ account?: string;
54
+ env?: DeployEnvironment;
55
+ bindings?: ManifestBinding[];
56
+ secrets?: string[];
26
57
  };
27
- export type DeployTarget = ManagedTarget | ExternalTarget;
58
+ export type DeployTarget = ManagedTarget | ExternalTarget | AccountTarget | ControllerTarget;
28
59
  export type DeployManifest = {
29
60
  path: string;
30
61
  workspaceRoot: string;
31
62
  defaultTarget?: string;
32
63
  discovery: DiscoveryConfig;
33
64
  targets: Record<string, DeployTarget>;
65
+ env?: DeployEnvironment;
66
+ bindings?: ManifestBinding[];
67
+ secrets?: string[];
34
68
  };
35
69
  export declare function isTenantName(value: string): boolean;
36
70
  /** Workload namespace the platform creates for a tenant. */
37
71
  export declare function tenantNamespace(tenant: string): string;
38
72
  /** Host group the platform creates for a tenant. */
39
73
  export declare function tenantHostgroup(tenant: string): string;
74
+ /** Valid DNS domain (and optional port) used to derive `https://<account>.controller.<domain>`. */
75
+ export declare function isControllerDomain(value: string): boolean;
76
+ /**
77
+ * Validates and normalizes a tenant controller URL (without trailing slash).
78
+ * Requires `https://`, or `http://` for loopback and in-cluster (`*.svc`) hosts only.
79
+ */
80
+ export declare function normalizeControllerUrl(value: string): string | undefined;
40
81
  export declare function findDeployManifest(startDirectory: string): string | undefined;
41
82
  export declare function loadDeployManifest(startDirectory: string, env: Record<string, string | undefined>): DeployManifest;
42
83
  export declare function parseDeployManifest(path: string, source: string, env: Record<string, string | undefined>): DeployManifest;
43
84
  export declare function interpolateEnv(value: unknown, env: Record<string, string | undefined>, manifestPath: string): unknown;
85
+ export declare function optionalDeployEnvironment(value: unknown, label: string, manifestPath: string): DeployEnvironment | undefined;
86
+ export declare function parseManifestSecrets(value: unknown, label: string, manifestPath: string): string[] | undefined;
87
+ export declare function parseManifestBindings(value: unknown, label: string, manifestPath: string): ManifestBinding[] | undefined;