@salesforce/b2c-tooling-sdk 2.1.0 → 2.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/data/content-schemas/databindingcontext.json +1 -1
- package/data/guides/enrichment.json +2887 -1480
- package/data/guides/index.json +3846 -1870
- package/data/help/index.json +1537 -1457
- package/data/help-kb/enrichment.json +6122 -0
- package/data/help-kb/index.json +8496 -0
- package/data/job-steps/index.json +1 -1
- package/data/job-steps/job-steps.json +1 -1
- package/data/script-api/index.json +137 -22
- package/data/tooling/index.json +22 -4
- package/data/xsd/channels.xsd +47 -0
- package/data/xsd/index.json +6 -2
- package/data/xsd/library.xsd +31 -0
- package/data/xsd/order.xsd +317 -0
- package/data/xsd/search2.xsd +1 -1
- package/data/xsd/sort.xsd +17 -0
- package/data/xsd/storefronts.xsd +34 -48
- package/dist/esm/auth/client-credentials.d.ts +43 -0
- package/dist/esm/auth/client-credentials.js +55 -0
- package/dist/esm/auth/client-credentials.js.map +1 -1
- package/dist/esm/auth/index.d.ts +2 -1
- package/dist/esm/auth/index.js +1 -1
- package/dist/esm/auth/index.js.map +1 -1
- package/dist/esm/auth/oauth.d.ts +3 -0
- package/dist/esm/auth/oauth.js +3 -3
- package/dist/esm/auth/oauth.js.map +1 -1
- package/dist/esm/auth/resolve.d.ts +2 -0
- package/dist/esm/auth/resolve.js +3 -2
- package/dist/esm/auth/resolve.js.map +1 -1
- package/dist/esm/auth/types.d.ts +5 -0
- package/dist/esm/auth/types.js +0 -5
- package/dist/esm/auth/types.js.map +1 -1
- package/dist/esm/cli/config.js +1 -0
- package/dist/esm/cli/config.js.map +1 -1
- package/dist/esm/cli/instance-command.d.ts +1 -0
- package/dist/esm/cli/mrt-command.d.ts +1 -0
- package/dist/esm/cli/oauth-command.d.ts +1 -0
- package/dist/esm/cli/oauth-command.js +8 -0
- package/dist/esm/cli/oauth-command.js.map +1 -1
- package/dist/esm/cli/ods-command.d.ts +1 -0
- package/dist/esm/cli/webdav-command.d.ts +1 -0
- package/dist/esm/clients/middleware-registry.d.ts +8 -36
- package/dist/esm/clients/middleware-registry.js +62 -1
- package/dist/esm/clients/middleware-registry.js.map +1 -1
- package/dist/esm/clients/slas-shopper.generated.d.ts +2 -1
- package/dist/esm/config/dw-json.d.ts +31 -0
- package/dist/esm/config/dw-json.js +47 -1
- package/dist/esm/config/dw-json.js.map +1 -1
- package/dist/esm/config/index.d.ts +2 -2
- package/dist/esm/config/index.js +1 -1
- package/dist/esm/config/index.js.map +1 -1
- package/dist/esm/config/mapping.js +7 -0
- package/dist/esm/config/mapping.js.map +1 -1
- package/dist/esm/config/resolved-config.js +1 -0
- package/dist/esm/config/resolved-config.js.map +1 -1
- package/dist/esm/config/sources/env-source.js +3 -0
- package/dist/esm/config/sources/env-source.js.map +1 -1
- package/dist/esm/config/types.d.ts +3 -0
- package/dist/esm/docs/search.js +4 -1
- package/dist/esm/docs/search.js.map +1 -1
- package/dist/esm/docs/types.d.ts +6 -1
- package/dist/esm/docs/types.js +1 -0
- package/dist/esm/docs/types.js.map +1 -1
- package/dist/esm/instance/index.js +1 -0
- package/dist/esm/instance/index.js.map +1 -1
- package/dist/esm/openshell/apply.d.ts +90 -0
- package/dist/esm/openshell/apply.js +225 -0
- package/dist/esm/openshell/apply.js.map +1 -0
- package/dist/esm/openshell/index.d.ts +30 -0
- package/dist/esm/openshell/index.js +34 -0
- package/dist/esm/openshell/index.js.map +1 -0
- package/dist/esm/openshell/setup.d.ts +94 -0
- package/dist/esm/openshell/setup.js +307 -0
- package/dist/esm/openshell/setup.js.map +1 -0
- package/dist/esm/operations/mtls/index.d.ts +135 -0
- package/dist/esm/operations/mtls/index.js +270 -0
- package/dist/esm/operations/mtls/index.js.map +1 -0
- package/dist/esm/scapi/auth-primitives.js +1 -0
- package/dist/esm/scapi/auth-primitives.js.map +1 -1
- package/dist/esm/scapi/authentication.d.ts +19 -0
- package/dist/esm/scapi/authentication.js +65 -6
- package/dist/esm/scapi/authentication.js.map +1 -1
- package/dist/esm/scapi/catalog.d.ts +2 -0
- package/dist/esm/scapi/catalog.js.map +1 -1
- package/dist/esm/scapi/index.d.ts +7 -3
- package/dist/esm/scapi/index.js +4 -2
- package/dist/esm/scapi/index.js.map +1 -1
- package/dist/esm/scapi/live.d.ts +52 -0
- package/dist/esm/scapi/live.js +142 -0
- package/dist/esm/scapi/live.js.map +1 -0
- package/dist/esm/scapi/request.d.ts +6 -0
- package/dist/esm/scapi/request.js +83 -61
- package/dist/esm/scapi/request.js.map +1 -1
- package/dist/esm/scapi/shopper.d.ts +31 -0
- package/dist/esm/scapi/shopper.js +79 -0
- package/dist/esm/scapi/shopper.js.map +1 -0
- package/dist/esm/scapi/worker-source.js +1 -1
- package/dist/esm/slas/index.d.ts +1 -1
- package/dist/esm/slas/index.js +1 -1
- package/dist/esm/slas/index.js.map +1 -1
- package/dist/esm/slas/token.d.ts +10 -0
- package/dist/esm/slas/token.js +27 -0
- package/dist/esm/slas/token.js.map +1 -1
- package/package.json +11 -1
- package/specs/slas-shopper-v1.yaml +2 -1
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2
|
|
4
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Writes an {@link OpenShellSetup} to disk and applies it with the `openshell`
|
|
8
|
+
* and `docker` command line tools.
|
|
9
|
+
*
|
|
10
|
+
* @module openshell/apply
|
|
11
|
+
*/
|
|
12
|
+
import { execFile } from 'node:child_process';
|
|
13
|
+
import { existsSync } from 'node:fs';
|
|
14
|
+
import * as fs from 'node:fs/promises';
|
|
15
|
+
import path from 'node:path';
|
|
16
|
+
import { OPENSHELL_SAFETY_CONFIG_PATH } from './setup.js';
|
|
17
|
+
/** Default {@link CommandRunner} using `child_process.execFile` (no shell). */
|
|
18
|
+
export const runCommand = (command, args, env) => new Promise((resolve) => {
|
|
19
|
+
execFile(command, args, { env: { ...process.env, ...env }, maxBuffer: 16 * 1024 * 1024 }, (error, stdout, stderr) => {
|
|
20
|
+
const code = error ? (typeof error.code === 'number' ? error.code : 127) : 0;
|
|
21
|
+
resolve({ code, stdout: String(stdout), stderr: String(stderr) });
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
/** Error thrown when an `openshell` or `docker` command fails. */
|
|
25
|
+
export class OpenShellCommandError extends Error {
|
|
26
|
+
command;
|
|
27
|
+
result;
|
|
28
|
+
constructor(command, result) {
|
|
29
|
+
super(`Command failed (${result.code}): ${command}\n${(result.stderr || result.stdout).trim()}`);
|
|
30
|
+
this.command = command;
|
|
31
|
+
this.result = result;
|
|
32
|
+
this.name = 'OpenShellCommandError';
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function quote(arg) {
|
|
36
|
+
return /^[\w@%+=:,./-]+$/.test(arg) ? arg : `'${arg.replaceAll("'", String.raw `'\''`)}'`;
|
|
37
|
+
}
|
|
38
|
+
function formatCommand(command, args) {
|
|
39
|
+
return [command, ...args].map((a) => quote(a)).join(' ');
|
|
40
|
+
}
|
|
41
|
+
/** Formats a command with one flag per line, for readability in scripts. */
|
|
42
|
+
function formatMultiline(command, args) {
|
|
43
|
+
const parts = [];
|
|
44
|
+
for (const arg of args) {
|
|
45
|
+
if (arg.startsWith('--') && parts.length > 0)
|
|
46
|
+
parts.push(' \\\n ');
|
|
47
|
+
else if (parts.length > 0)
|
|
48
|
+
parts.push(' ');
|
|
49
|
+
parts.push(quote(arg));
|
|
50
|
+
}
|
|
51
|
+
return `${command} ${parts.join('')}`;
|
|
52
|
+
}
|
|
53
|
+
function sandboxCreateArgs(setup, files, image) {
|
|
54
|
+
return [
|
|
55
|
+
'sandbox',
|
|
56
|
+
'create',
|
|
57
|
+
'--name',
|
|
58
|
+
setup.sandboxName,
|
|
59
|
+
'--from',
|
|
60
|
+
image,
|
|
61
|
+
'--policy',
|
|
62
|
+
files.policy,
|
|
63
|
+
...setup.providers.flatMap((p) => ['--provider', p.name]),
|
|
64
|
+
'--no-auto-providers',
|
|
65
|
+
...Object.entries(setup.env).flatMap(([key, value]) => ['--env', `${key}=${value}`]),
|
|
66
|
+
...(files.safetyConfig
|
|
67
|
+
? ['--upload', `${files.safetyConfig}:${OPENSHELL_SAFETY_CONFIG_PATH}`, '--no-git-ignore']
|
|
68
|
+
: []),
|
|
69
|
+
'--detach',
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Renders the shell commands that create the sandbox from scratch. Written
|
|
74
|
+
* next to the generated files so the setup can be reviewed or run by hand.
|
|
75
|
+
*/
|
|
76
|
+
export function formatOpenShellScript(setup, files, image) {
|
|
77
|
+
const lines = [
|
|
78
|
+
'#!/usr/bin/env bash',
|
|
79
|
+
`# Creates the OpenShell sandbox "${setup.sandboxName}". Generated by \`b2c setup openshell\`.`,
|
|
80
|
+
...(setup.providers.length > 0
|
|
81
|
+
? [
|
|
82
|
+
'# Export these secrets in your shell (or load them from a secret manager) first:',
|
|
83
|
+
...setup.providers.map((p) => `# ${p.envVar}`),
|
|
84
|
+
]
|
|
85
|
+
: []),
|
|
86
|
+
'set -euo pipefail',
|
|
87
|
+
'',
|
|
88
|
+
formatCommand('docker', ['build', '-t', image, files.dir]),
|
|
89
|
+
...Object.values(files.profiles).map((file) => formatCommand('openshell', ['profile', 'import', '--file', file])),
|
|
90
|
+
...setup.providers.map((p) => formatCommand('openshell', ['provider', 'create', '--name', p.name, '--type', p.type, '--credential', p.envVar])),
|
|
91
|
+
formatMultiline('openshell', sandboxCreateArgs(setup, files, image)),
|
|
92
|
+
'',
|
|
93
|
+
];
|
|
94
|
+
return lines.join('\n');
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Writes the profiles, policy, Dockerfile, and setup script to `dir`.
|
|
98
|
+
* An existing policy file is kept unless `force` is set, so edits to it
|
|
99
|
+
* survive re-runs.
|
|
100
|
+
*/
|
|
101
|
+
export async function writeOpenShellFiles(setup, dir, options) {
|
|
102
|
+
const absDir = path.resolve(dir);
|
|
103
|
+
await fs.mkdir(path.join(absDir, 'profiles'), { recursive: true });
|
|
104
|
+
const profiles = {};
|
|
105
|
+
for (const profile of setup.profiles) {
|
|
106
|
+
const file = path.join(absDir, 'profiles', `${profile.id}.yaml`);
|
|
107
|
+
await fs.writeFile(file, profile.content);
|
|
108
|
+
profiles[profile.id] = file;
|
|
109
|
+
}
|
|
110
|
+
const policy = path.join(absDir, 'policy.yaml');
|
|
111
|
+
const policyWritten = Boolean(options.force) || !existsSync(policy);
|
|
112
|
+
if (policyWritten) {
|
|
113
|
+
await fs.writeFile(policy, setup.policy);
|
|
114
|
+
}
|
|
115
|
+
const policyDiffers = !policyWritten && (await fs.readFile(policy, 'utf8')) !== setup.policy;
|
|
116
|
+
const dockerfile = path.join(absDir, 'Dockerfile');
|
|
117
|
+
await fs.writeFile(dockerfile, options.dockerfile);
|
|
118
|
+
const safetyConfig = path.join(absDir, 'safety.json');
|
|
119
|
+
if (setup.safetyConfig) {
|
|
120
|
+
await fs.writeFile(safetyConfig, setup.safetyConfig);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
await fs.rm(safetyConfig, { force: true });
|
|
124
|
+
}
|
|
125
|
+
const files = {
|
|
126
|
+
dir: absDir,
|
|
127
|
+
policy,
|
|
128
|
+
dockerfile,
|
|
129
|
+
script: path.join(absDir, 'setup.sh'),
|
|
130
|
+
profiles,
|
|
131
|
+
safetyConfig: setup.safetyConfig ? safetyConfig : undefined,
|
|
132
|
+
policyWritten,
|
|
133
|
+
policyDiffers,
|
|
134
|
+
};
|
|
135
|
+
await fs.writeFile(files.script, formatOpenShellScript(setup, files, options.image), { mode: 0o755 });
|
|
136
|
+
return files;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Applies the setup, converging on the desired state so it can be re-run:
|
|
140
|
+
*
|
|
141
|
+
* 1. Checks that the OpenShell gateway is reachable.
|
|
142
|
+
* 2. Builds the sandbox image if it does not exist.
|
|
143
|
+
* 3. Imports each provider profile, or updates it if it exists.
|
|
144
|
+
* 4. Creates each provider, or updates its secret if it exists.
|
|
145
|
+
* 5. Creates the sandbox, or applies the policy and Safety Mode configuration
|
|
146
|
+
* to the existing sandbox.
|
|
147
|
+
*
|
|
148
|
+
* @returns The steps that were run
|
|
149
|
+
*/
|
|
150
|
+
export async function applyOpenShellSetup(setup, files, options) {
|
|
151
|
+
const run = options.run ?? runCommand;
|
|
152
|
+
const steps = [];
|
|
153
|
+
const runStep = async (description, command, args, env) => {
|
|
154
|
+
const step = { description, command: formatCommand(command, args) };
|
|
155
|
+
options.onStep?.(step);
|
|
156
|
+
const result = await run(command, args, env);
|
|
157
|
+
if (result.code !== 0)
|
|
158
|
+
throw new OpenShellCommandError(step.command, result);
|
|
159
|
+
steps.push(step);
|
|
160
|
+
};
|
|
161
|
+
const succeeds = async (command, args) => (await run(command, args)).code === 0;
|
|
162
|
+
const status = await run('openshell', ['status']);
|
|
163
|
+
if (status.code !== 0) {
|
|
164
|
+
throw new OpenShellCommandError('openshell status', status);
|
|
165
|
+
}
|
|
166
|
+
if (options.build !== false && !(await succeeds('docker', ['image', 'inspect', options.image]))) {
|
|
167
|
+
await runStep(`Build image ${options.image}`, 'docker', ['build', '-t', options.image, files.dir]);
|
|
168
|
+
}
|
|
169
|
+
for (const [id, file] of Object.entries(files.profiles)) {
|
|
170
|
+
const existing = await run('openshell', ['profile', 'export', '-o', 'json', id]);
|
|
171
|
+
if (existing.code !== 0) {
|
|
172
|
+
await runStep(`Import profile ${id}`, 'openshell', ['profile', 'import', '--file', file]);
|
|
173
|
+
continue;
|
|
174
|
+
}
|
|
175
|
+
// Updates must carry the current resource_version of the profile.
|
|
176
|
+
const { resource_version: resourceVersion } = JSON.parse(existing.stdout);
|
|
177
|
+
const updateFile = path.join(files.dir, 'profiles', `.${id}.update.yaml`);
|
|
178
|
+
await fs.writeFile(updateFile, `${await fs.readFile(file, 'utf8')}resource_version: ${resourceVersion ?? 0}\n`);
|
|
179
|
+
try {
|
|
180
|
+
await runStep(`Update profile ${id}`, 'openshell', ['profile', 'update', '--file', updateFile, id]);
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
await fs.rm(updateFile, { force: true });
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
for (const provider of setup.providers) {
|
|
187
|
+
const secret = options.secrets[provider.envVar];
|
|
188
|
+
if (!secret)
|
|
189
|
+
throw new Error(`No value for ${provider.envVar}`);
|
|
190
|
+
const env = { [provider.envVar]: secret };
|
|
191
|
+
await ((await succeeds('openshell', ['provider', 'get', provider.name]))
|
|
192
|
+
? runStep(`Update provider ${provider.name}`, 'openshell', ['provider', 'update', provider.name, '--credential', provider.envVar], env)
|
|
193
|
+
: runStep(`Create provider ${provider.name}`, 'openshell', ['provider', 'create', '--name', provider.name, '--type', provider.type, '--credential', provider.envVar], env));
|
|
194
|
+
}
|
|
195
|
+
if (options.sandbox === false)
|
|
196
|
+
return steps;
|
|
197
|
+
const sandboxExists = await succeeds('openshell', ['sandbox', 'get', setup.sandboxName]);
|
|
198
|
+
if (sandboxExists && options.recreate) {
|
|
199
|
+
await runStep(`Delete sandbox ${setup.sandboxName}`, 'openshell', ['sandbox', 'delete', setup.sandboxName]);
|
|
200
|
+
}
|
|
201
|
+
if (!sandboxExists || options.recreate) {
|
|
202
|
+
await runStep(`Create sandbox ${setup.sandboxName}`, 'openshell', sandboxCreateArgs(setup, files, options.image));
|
|
203
|
+
return steps;
|
|
204
|
+
}
|
|
205
|
+
await runStep(`Apply policy to sandbox ${setup.sandboxName}`, 'openshell', [
|
|
206
|
+
'policy',
|
|
207
|
+
'set',
|
|
208
|
+
setup.sandboxName,
|
|
209
|
+
'--policy',
|
|
210
|
+
files.policy,
|
|
211
|
+
'--wait',
|
|
212
|
+
]);
|
|
213
|
+
if (files.safetyConfig) {
|
|
214
|
+
await runStep(`Upload Safety Mode configuration to ${setup.sandboxName}`, 'openshell', [
|
|
215
|
+
'sandbox',
|
|
216
|
+
'upload',
|
|
217
|
+
'--no-git-ignore',
|
|
218
|
+
setup.sandboxName,
|
|
219
|
+
files.safetyConfig,
|
|
220
|
+
OPENSHELL_SAFETY_CONFIG_PATH,
|
|
221
|
+
]);
|
|
222
|
+
}
|
|
223
|
+
return steps;
|
|
224
|
+
}
|
|
225
|
+
//# sourceMappingURL=apply.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.js","sourceRoot":"","sources":["../../../src/openshell/apply.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;GAKG;AACH,OAAO,EAAC,QAAQ,EAAC,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAC,UAAU,EAAC,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAC,4BAA4B,EAAsB,MAAM,YAAY,CAAC;AAgB7E,+EAA+E;AAC/E,MAAM,CAAC,MAAM,UAAU,GAAkB,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAC9D,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;IACtB,QAAQ,CAAC,OAAO,EAAE,IAAI,EAAE,EAAC,GAAG,EAAE,EAAC,GAAG,OAAO,CAAC,GAAG,EAAE,GAAG,GAAG,EAAC,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;QAC9G,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;Q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AAuC,KAAK,CAAC,WAAW,EAAE,EAAE,WAAW,EAAE;YACrF,SAAS;YACT,QAAQ;YACR,iBAAiB;YACjB,KAAK,CAAC,WAAW;YACjB,KAAK,CAAC,YAAY;YAClB,4BAA4B;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Run the B2C tooling inside an NVIDIA OpenShell sandbox.
|
|
3
|
+
*
|
|
4
|
+
* Builds provider profiles, providers, and a network policy from a resolved
|
|
5
|
+
* B2C configuration, then applies them with the `openshell` CLI. Secrets stay
|
|
6
|
+
* on the gateway; the sandbox receives placeholders.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```typescript
|
|
10
|
+
* import {resolveConfig} from '@salesforce/b2c-tooling-sdk/config';
|
|
11
|
+
* import {
|
|
12
|
+
* applyOpenShellSetup,
|
|
13
|
+
* buildOpenShellDockerfile,
|
|
14
|
+
* buildOpenShellSetup,
|
|
15
|
+
* writeOpenShellFiles,
|
|
16
|
+
* } from '@salesforce/b2c-tooling-sdk/openshell';
|
|
17
|
+
*
|
|
18
|
+
* const config = resolveConfig().values;
|
|
19
|
+
* const setup = buildOpenShellSetup(config, {accessLevel: 'READ_ONLY'});
|
|
20
|
+
* const options = {image: 'b2c-openshell:latest', dockerfile: buildOpenShellDockerfile()};
|
|
21
|
+
* const files = await writeOpenShellFiles(setup, '.openshell/b2c', options);
|
|
22
|
+
* await applyOpenShellSetup(setup, files, {...options, secrets: {SFCC_CLIENT_SECRET: config.clientSecret!}});
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* @module openshell
|
|
26
|
+
*/
|
|
27
|
+
export { buildOpenShellDockerfile, buildOpenShellSetup, OPENSHELL_ACCESS_LEVELS, OPENSHELL_SAFETY_CONFIG_PATH, secretNeedsBodyAuth, } from './setup.js';
|
|
28
|
+
export type { OpenShellAccessLevel, OpenShellProfile, OpenShellProvider, OpenShellSetup, OpenShellSetupOptions, } from './setup.js';
|
|
29
|
+
export { applyOpenShellSetup, runCommand, formatOpenShellScript, OpenShellCommandError, writeOpenShellFiles, } from './apply.js';
|
|
30
|
+
export type { ApplyOpenShellSetupOptions, CommandResult, CommandRunner, OpenShellApplyOptions, OpenShellFiles, OpenShellStep, } from './apply.js';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2025, Salesforce, Inc.
|
|
3
|
+
* SPDX-License-Identifier: Apache-2
|
|
4
|
+
* For full license text, see the license.txt file in the repo root or http://www.apache.org/licenses/LICENSE-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Run the B2C tooling inside an NVIDIA OpenShell sandbox.
|
|
8
|
+
*
|
|
9
|
+
* Builds provider profiles, providers, and a network policy from a resolved
|
|
10
|
+
* B2C configuration, then applies them with the `openshell` CLI. Secrets stay
|
|
11
|
+
* on the gateway; the sandbox receives placeholders.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* import {resolveConfig} from '@salesforce/b2c-tooling-sdk/config';
|
|
16
|
+
* import {
|
|
17
|
+
* applyOpenShellSetup,
|
|
18
|
+
* buildOpenShellDockerfile,
|
|
19
|
+
* buildOpenShellSetup,
|
|
20
|
+
* writeOpenShellFiles,
|
|
21
|
+
* } from '@salesforce/b2c-tooling-sdk/openshell';
|
|
22
|
+
*
|
|
23
|
+
* const config = resolveConfig().values;
|
|
24
|
+
* const setup = buildOpenShellSetup(config, {accessLevel: 'READ_ONLY'});
|
|
25
|
+
* const options = {image: 'b2c-openshell:latest', dockerfile: buildOpenShellDockerfile()};
|
|
26
|
+
* const files = await writeOpenShellFiles(setup, '.openshell/b2c', options);
|
|
27
|
+
* await applyOpenShellSetup(setup, files, {...options, secrets: {SFCC_CLIENT_SECRET: config.clientSecret!}});
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* @module openshell
|
|
31
|
+
*/
|
|
32
|
+
export { buildOpenShellDockerfile, buildOpenShellSetup, OPENSHELL_ACCESS_LEVELS, OPENSHELL_SAFETY_CONFIG_PATH, secretNeedsBodyAuth, } from './setup.js';
|
|
33
|
+
export { applyOpenShellSetup, runCommand, formatOpenShellScript, OpenShellCommandError, writeOpenShellFiles, } from './apply.js';
|
|
34
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/openshell/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EACL,wBAAwB,EACxB,mBAAmB,EACnB,uBAAuB,EACvB,4BAA4B,EAC5B,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAQpB,OAAO,EACL,mBAAmB,EACnB,UAAU,EACV,qBAAqB,EACrB,qBAAqB,EACrB,mBAAmB,GACpB,MAAM,YAAY,CAAC"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import type { NormalizedConfig } from '../config/types.js';
|
|
2
|
+
import type { SafetyLevel } from '../safety/safety-middleware.js';
|
|
3
|
+
import type { SafetyRule } from '../safety/types.js';
|
|
4
|
+
/** Sandbox access levels. These are the Safety Mode levels. */
|
|
5
|
+
export type OpenShellAccessLevel = SafetyLevel;
|
|
6
|
+
/** All supported sandbox access levels. */
|
|
7
|
+
export declare const OPENSHELL_ACCESS_LEVELS: readonly ["NONE", "NO_DELETE", "NO_UPDATE", "READ_ONLY"];
|
|
8
|
+
/** Path of the forwarded Safety Mode configuration inside the sandbox. */
|
|
9
|
+
export declare const OPENSHELL_SAFETY_CONFIG_PATH = "/sandbox/.b2c/safety.json";
|
|
10
|
+
/** A provider profile to register with the OpenShell gateway. */
|
|
11
|
+
export interface OpenShellProfile {
|
|
12
|
+
/** Profile id (the provider `--type`) */
|
|
13
|
+
id: string;
|
|
14
|
+
/** Profile YAML */
|
|
15
|
+
content: string;
|
|
16
|
+
}
|
|
17
|
+
/** A provider (stored secret) to create on the OpenShell gateway. */
|
|
18
|
+
export interface OpenShellProvider {
|
|
19
|
+
/** Provider name */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Profile id the provider is created from */
|
|
22
|
+
type: string;
|
|
23
|
+
/** Environment variable that carries the secret (on the host and in the sandbox) */
|
|
24
|
+
envVar: string;
|
|
25
|
+
/** Config field the secret is read from */
|
|
26
|
+
source: 'clientSecret' | 'mrtApiKey' | 'password';
|
|
27
|
+
}
|
|
28
|
+
/** Everything needed to create a B2C sandbox. Contains no secret values. */
|
|
29
|
+
export interface OpenShellSetup {
|
|
30
|
+
/** Sandbox name */
|
|
31
|
+
sandboxName: string;
|
|
32
|
+
/** Provider profiles to register */
|
|
33
|
+
profiles: OpenShellProfile[];
|
|
34
|
+
/** Providers to create and attach to the sandbox */
|
|
35
|
+
providers: OpenShellProvider[];
|
|
36
|
+
/** Sandbox policy YAML */
|
|
37
|
+
policy: string;
|
|
38
|
+
/** Non-secret environment variables for the sandbox */
|
|
39
|
+
env: Record<string, string>;
|
|
40
|
+
/** Hosts the policy allows, for display */
|
|
41
|
+
hosts: string[];
|
|
42
|
+
/** Safety Mode configuration (JSON) to upload to {@link OPENSHELL_SAFETY_CONFIG_PATH}, if any */
|
|
43
|
+
safetyConfig?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Forwarded command rules that permit operations. The network policy can't
|
|
46
|
+
* express them, so the requests they permit may still be denied.
|
|
47
|
+
*/
|
|
48
|
+
unmappedSafetyRules: SafetyRule[];
|
|
49
|
+
}
|
|
50
|
+
/** Options for {@link buildOpenShellSetup}. */
|
|
51
|
+
export interface OpenShellSetupOptions {
|
|
52
|
+
/** Sandbox name. Defaults to `b2c-<instance name or host prefix>`. */
|
|
53
|
+
sandboxName?: string;
|
|
54
|
+
/** Access level for B2C hosts, also applied to Safety Mode in the sandbox. Defaults to `NONE`. */
|
|
55
|
+
accessLevel?: OpenShellAccessLevel;
|
|
56
|
+
/**
|
|
57
|
+
* Safety Mode settings to forward to the sandbox. `allow` and `confirm`
|
|
58
|
+
* rules for HTTP requests and jobs are also added to the network policy.
|
|
59
|
+
*/
|
|
60
|
+
safety?: {
|
|
61
|
+
confirm?: boolean;
|
|
62
|
+
rules?: SafetyRule[];
|
|
63
|
+
};
|
|
64
|
+
/** Additional hosts to allow at the same access level (e.g. the sandbox API host) */
|
|
65
|
+
allowHosts?: string[];
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Returns true when a secret sent in an unencoded Basic header would reach
|
|
69
|
+
* Account Manager altered (it form-decodes `+` and `%xx`).
|
|
70
|
+
*/
|
|
71
|
+
export declare function secretNeedsBodyAuth(secret: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Builds the OpenShell setup for a resolved B2C configuration.
|
|
74
|
+
*
|
|
75
|
+
* Only secrets present in the configuration get a provider. The API client
|
|
76
|
+
* secret is released only to the Account Manager token endpoint, the WebDAV
|
|
77
|
+
* access key only to the instance host, and the MRT API key only to the MRT
|
|
78
|
+
* host. B2C hosts are limited to the HTTP methods of the access level.
|
|
79
|
+
*
|
|
80
|
+
* @param config - The resolved configuration (secrets are read but never included in the result)
|
|
81
|
+
* @param options - Sandbox name, access level, and extra hosts
|
|
82
|
+
*/
|
|
83
|
+
export declare function buildOpenShellSetup(config: NormalizedConfig, options?: OpenShellSetupOptions): OpenShellSetup;
|
|
84
|
+
/**
|
|
85
|
+
* Returns the Dockerfile for a sandbox image with the B2C CLI (and optionally
|
|
86
|
+
* the MCP server) installed.
|
|
87
|
+
*
|
|
88
|
+
* @param options - Package versions to install; defaults to `latest`
|
|
89
|
+
*/
|
|
90
|
+
export declare function buildOpenShellDockerfile(options?: {
|
|
91
|
+
cliVersion?: string;
|
|
92
|
+
mcpVersion?: string;
|
|
93
|
+
mcp?: boolean;
|
|
94
|
+
}): string;
|