Skip to content

Commit c6df37e

Browse files
committed
update references to b2c instance env config
1 parent 4adb1b1 commit c6df37e

8 files changed

Lines changed: 25 additions & 25 deletions

File tree

docs/api-readme.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ npm install @salesforce/b2c-tooling-sdk
1010

1111
## Quick Start
1212

13-
### From dw.json (Recommended)
13+
### From Environment Configuration (Recommended)
1414

15-
The easiest way to create an instance is from a `dw.json` file:
15+
The easiest way to create an instance is from environment configuration files:
1616

1717
```typescript
1818
import { B2CInstance } from '@salesforce/b2c-tooling-sdk';
1919

20-
// Load configuration from dw.json, override secrets from environment
21-
const instance = B2CInstance.fromDwJson({
20+
// Load configuration from environment files (dw.json, etc.), override secrets from environment
21+
const instance = B2CInstance.fromEnvironment({
2222
clientId: process.env.SFCC_CLIENT_ID,
2323
clientSecret: process.env.SFCC_CLIENT_SECRET,
2424
});

packages/b2c-tooling-sdk/src/clients/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
* ```typescript
2626
* import { B2CInstance } from '@salesforce/b2c-tooling-sdk';
2727
*
28-
* const instance = B2CInstance.fromDwJson({
28+
* const instance = B2CInstance.fromEnvironment({
2929
* clientSecret: process.env.SFCC_CLIENT_SECRET,
3030
* });
3131
*

packages/b2c-tooling-sdk/src/clients/ocapi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export {createAuthMiddleware, createLoggingMiddleware};
7575
*
7676
* @example
7777
* // Via B2CInstance (recommended)
78-
* const instance = B2CInstance.fromDwJson();
78+
* const instance = B2CInstance.fromEnvironment();
7979
* const { data, error } = await instance.ocapi.GET('/sites', {});
8080
*
8181
* @example

packages/b2c-tooling-sdk/src/clients/webdav.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export interface PropfindEntry {
3939
*
4040
* @example
4141
* // Via B2CInstance (recommended)
42-
* const instance = B2CInstance.fromDwJson();
42+
* const instance = B2CInstance.fromEnvironment();
4343
* await instance.webdav.mkcol('Cartridges/v1');
4444
* await instance.webdav.put('Cartridges/v1/app.zip', zipBuffer);
4545
*

packages/b2c-tooling-sdk/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export type {
4747

4848
// Context Layer - Instance
4949
export {B2CInstance} from './instance/index.js';
50-
export type {InstanceConfig, FromDwJsonOptions, B2CInstanceOptions} from './instance/index.js';
50+
export type {InstanceConfig, FromEnvironmentOptions, B2CInstanceOptions} from './instance/index.js';
5151

5252
// Clients
5353
export {

packages/b2c-tooling-sdk/src/instance/index.ts

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212
*
1313
* ## Usage
1414
*
15-
* ### From dw.json (recommended)
15+
* ### From environment configuration (recommended)
1616
*
1717
* ```typescript
1818
* import { B2CInstance } from '@salesforce/b2c-tooling-sdk';
1919
*
20-
* // Load from dw.json, override secrets from environment
21-
* const instance = B2CInstance.fromDwJson({
20+
* // Load from environment files (dw.json, etc.), override secrets from environment
21+
* const instance = B2CInstance.fromEnvironment({
2222
* clientId: process.env.SFCC_CLIENT_ID,
2323
* clientSecret: process.env.SFCC_CLIENT_SECRET,
2424
* });
@@ -59,9 +59,9 @@ export interface InstanceConfig {
5959
}
6060

6161
/**
62-
* Options for creating a B2CInstance from dw.json.
62+
* Options for creating a B2CInstance from environment configuration.
6363
*/
64-
export interface FromDwJsonOptions {
64+
export interface FromEnvironmentOptions {
6565
/** Named instance from dw.json "configs" array */
6666
instance?: string;
6767
/** Path to dw.json (defaults to searching up from cwd) */
@@ -95,8 +95,8 @@ export interface FromDwJsonOptions {
9595
* Authentication is handled automatically based on the configured credentials.
9696
*
9797
* @example
98-
* // From dw.json
99-
* const instance = B2CInstance.fromDwJson({
98+
* // From environment configuration
99+
* const instance = B2CInstance.fromEnvironment({
100100
* clientSecret: process.env.SFCC_CLIENT_SECRET,
101101
* });
102102
*
@@ -111,28 +111,28 @@ export class B2CInstance {
111111
private _ocapi?: OcapiClient;
112112

113113
/**
114-
* Creates a B2CInstance from a dw.json file with optional overrides.
114+
* Creates a B2CInstance from environment configuration files with optional overrides.
115115
*
116-
* Searches upward from the current directory for a dw.json file,
116+
* Searches upward from the current directory for configuration files (dw.json, etc.),
117117
* then applies any provided overrides.
118118
*
119119
* @param options - Loading options and overrides
120120
* @returns Configured B2CInstance
121-
* @throws Error if no dw.json found or required configuration missing
121+
* @throws Error if no configuration found or required configuration missing
122122
*
123123
* @example
124-
* // Auto-find dw.json, override secrets
125-
* const instance = B2CInstance.fromDwJson({
124+
* // Auto-find configuration, override secrets
125+
* const instance = B2CInstance.fromEnvironment({
126126
* clientId: process.env.SFCC_CLIENT_ID,
127127
* clientSecret: process.env.SFCC_CLIENT_SECRET,
128128
* });
129129
*
130130
* // Use named instance
131-
* const instance = B2CInstance.fromDwJson({
131+
* const instance = B2CInstance.fromEnvironment({
132132
* instance: 'staging',
133133
* });
134134
*/
135-
static fromDwJson(options: FromDwJsonOptions = {}): B2CInstance {
135+
static fromEnvironment(options: FromEnvironmentOptions = {}): B2CInstance {
136136
const dwConfig = loadDwJson({
137137
instance: options.instance,
138138
path: options.configPath,
@@ -287,4 +287,4 @@ export class B2CInstance {
287287
}
288288

289289
// Re-export types for convenience
290-
export type {AuthConfig, FromDwJsonOptions as B2CInstanceOptions};
290+
export type {AuthConfig, FromEnvironmentOptions as B2CInstanceOptions};

packages/b2c-tooling-sdk/src/operations/code/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* } from '@salesforce/b2c-tooling-sdk/operations/code';
4242
* import { B2CInstance } from '@salesforce/b2c-tooling-sdk';
4343
*
44-
* const instance = B2CInstance.fromDwJson();
44+
* const instance = B2CInstance.fromEnvironment();
4545
*
4646
* // Deploy cartridges (requires instance.config.codeVersion to be set)
4747
* await findAndDeployCartridges(instance, './cartridges', { reload: true });

packages/b2c-tooling-sdk/src/operations/jobs/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
* } from '@salesforce/b2c-tooling-sdk/operations/jobs';
3737
* import { B2CInstance } from '@salesforce/b2c-tooling-sdk';
3838
*
39-
* const instance = B2CInstance.fromDwJson();
39+
* const instance = B2CInstance.fromEnvironment();
4040
*
4141
* // Run a custom job and wait for completion
4242
* const execution = await executeJob(instance, 'my-job-id');

0 commit comments

Comments
 (0)