@salesforce/core-bundle 8.18.7 → 8.19.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 (3) hide show
  1. package/lib/index.d.ts +60 -15
  2. package/lib/index.js +6083 -1767
  3. package/package.json +3 -2
package/lib/index.d.ts CHANGED
@@ -563,7 +563,7 @@ declare module '@salesforce/core-bundle/config/configFile' {
563
563
  * const myConfig = await MyConfig.create({
564
564
  * isGlobal: true
565
565
  * });
566
- * myConfig.set('mykey', 'myvalue');
566
+ * myConfig.set('myKey', 'myValue');
567
567
  * await myConfig.write();
568
568
  * ```
569
569
  */
@@ -1352,9 +1352,9 @@ declare module '@salesforce/core-bundle/crypto/keyChain' {
1352
1352
  }
1353
1353
  declare module '@salesforce/core-bundle/crypto/keyChainImpl' {
1354
1354
  import * as childProcess from 'node:child_process';
1355
- import * as nodeFs from 'node:fs';
1356
1355
  import { Nullable } from '@salesforce/ts-types';
1357
- export type FsIfc = Pick<typeof nodeFs, 'statSync'>;
1356
+ import { fs } from '@salesforce/core-bundle/fs/fs';
1357
+ export type FsIfc = Pick<typeof fs, 'statSync'>;
1358
1358
  /**
1359
1359
  * Basic keychain interface.
1360
1360
  */
@@ -1587,6 +1587,49 @@ declare module '@salesforce/core-bundle/deviceOauthService' {
1587
1587
  private pollForDeviceApproval;
1588
1588
  }
1589
1589
 
1590
+ }
1591
+ declare module '@salesforce/core-bundle/fs/fs' {
1592
+ import * as memfs from 'memfs';
1593
+ import type { VirtualFs } from '@salesforce/core-bundle/fs/types';
1594
+ export let fs: VirtualFs;
1595
+ export const getVirtualFs: (memfsVolume?: memfs.Volume) => VirtualFs;
1596
+ export const setFs: (providedFs: VirtualFs) => void;
1597
+ export const resetFs: () => void;
1598
+
1599
+ }
1600
+ declare module '@salesforce/core-bundle/fs/types' {
1601
+ import type * as nodeFs from 'node:fs';
1602
+ import type { IFs as MemFs } from 'memfs';
1603
+ type NodeFs = typeof nodeFs;
1604
+ type CommonKeys<T, U> = keyof T & keyof U;
1605
+ type IntersectionType<T, U> = {
1606
+ [K in CommonKeys<T, U>]: T[K] extends (...args: any[]) => any ? T[K] extends U[K] ? T[K] : U[K] extends T[K] ? U[K] : any : T[K] extends U[K] ? T[K] : U[K] extends T[K] ? U[K] : T[K];
1607
+ };
1608
+ type BaseVirtualFs = IntersectionType<NodeFs, MemFs>;
1609
+ export type VirtualFs = Omit<BaseVirtualFs, 'writeFileSync' | 'readFileSync' | 'statSync' | 'promises' | 'mkdtempSync' | 'createWriteStream' | 'mkdirSync'> & {
1610
+ promises: Omit<BaseVirtualFs['promises'], 'writeFile' | 'readFile'> & {
1611
+ writeFile: (file: string, data: string | Buffer, options?: BufferEncoding | {
1612
+ encoding?: BufferEncoding;
1613
+ mode?: string | number;
1614
+ }) => Promise<void>;
1615
+ readFile: {
1616
+ (path: string): Promise<Buffer>;
1617
+ (path: string, encoding: BufferEncoding): Promise<string>;
1618
+ };
1619
+ };
1620
+ readFileSync: {
1621
+ (path: string): Buffer;
1622
+ (path: string, encoding: BufferEncoding): string;
1623
+ };
1624
+ writeFileSync: (file: string, data: string | Buffer, encoding?: BufferEncoding) => void;
1625
+ /** there are some differences between node:fs and memfs for statSync around bigint stats. Be careful if using those */
1626
+ statSync: typeof nodeFs.statSync;
1627
+ mkdtempSync: typeof nodeFs.mkdtempSync;
1628
+ createWriteStream: typeof nodeFs.createWriteStream;
1629
+ mkdirSync: typeof nodeFs.mkdirSync;
1630
+ };
1631
+ export {};
1632
+
1590
1633
  }
1591
1634
  declare module '@salesforce/core-bundle/global' {
1592
1635
  /**
@@ -1662,7 +1705,8 @@ declare module '@salesforce/core-bundle/global' {
1662
1705
 
1663
1706
  }
1664
1707
  declare module '@salesforce/core-bundle/index' {
1665
- export { OAuth2Config } from '@jsforce/jsforce-node';
1708
+ import { OAuth2Config } from '@jsforce/jsforce-node';
1709
+ export { OAuth2Config };
1666
1710
  export { ConfigFile } from '@salesforce/core-bundle/config/configFile';
1667
1711
  export { TTLConfig } from '@salesforce/core-bundle/config/ttlConfig';
1668
1712
  export { envVars, EnvironmentVariable, SUPPORTED_ENV_VARS, EnvVars } from '@salesforce/core-bundle/config/envVars';
@@ -1702,6 +1746,8 @@ declare module '@salesforce/core-bundle/index' {
1702
1746
  export { ScratchOrgCache } from '@salesforce/core-bundle/org/scratchOrgCache';
1703
1747
  export { default as ScratchOrgSettingsGenerator } from '@salesforce/core-bundle/org/scratchOrgSettingsGenerator';
1704
1748
  export * from '@salesforce/core-bundle/util/sfdc';
1749
+ /** for use by other libraries that need to support web and node */
1750
+ export { fs } from '@salesforce/core-bundle/fs/fs';
1705
1751
  export * from '@salesforce/core-bundle/util/mutex';
1706
1752
  export * from '@salesforce/core-bundle/testSetup';
1707
1753
 
@@ -1832,7 +1878,7 @@ declare module '@salesforce/core-bundle/logger/filters' {
1832
1878
 
1833
1879
  }
1834
1880
  declare module '@salesforce/core-bundle/logger/logger' {
1835
- import { Logger as PinoLogger } from 'pino';
1881
+ import { type Logger as PinoLogger } from 'pino';
1836
1882
  /**
1837
1883
  * The common set of `Logger` options.
1838
1884
  */
@@ -2890,8 +2936,8 @@ declare module '@salesforce/core-bundle/org/connection' {
2890
2936
  import { ConfigAggregator } from '@salesforce/core-bundle/config/configAggregator';
2891
2937
  import { AuthFields, AuthInfo } from '@salesforce/core-bundle/org/authInfo';
2892
2938
  export const SFDX_HTTP_HEADERS: {
2939
+ 'user-agent'?: string | undefined;
2893
2940
  'content-type': string;
2894
- 'user-agent': string;
2895
2941
  };
2896
2942
  export const DNS_ERROR_NAME = "DomainNotFoundError";
2897
2943
  export type DeployOptionsWithRest = Partial<DeployOptions> & {
@@ -5077,9 +5123,9 @@ declare module '@salesforce/core-bundle/stateAggregator/accessors/aliasAccessor'
5077
5123
 
5078
5124
  }
5079
5125
  declare module '@salesforce/core-bundle/stateAggregator/accessors/orgAccessor' {
5080
- import * as fs from 'node:fs';
5081
5126
  import { Nullable } from '@salesforce/ts-types';
5082
5127
  import { AsyncOptionalCreatable } from '@salesforce/kit';
5128
+ import { fs } from '@salesforce/core-bundle/fs/fs';
5083
5129
  import { AuthInfoConfig } from '@salesforce/core-bundle/config/authInfoConfig';
5084
5130
  import { AuthFields } from '@salesforce/core-bundle/org/authInfo';
5085
5131
  import { ConfigFile } from '@salesforce/core-bundle/config/configFile';
@@ -5128,7 +5174,7 @@ declare module '@salesforce/core-bundle/stateAggregator/accessors/orgAccessor' {
5128
5174
  *
5129
5175
  * @param username
5130
5176
  */
5131
- stat(username: string): Promise<Nullable<fs.Stats>>;
5177
+ stat(username: string): Promise<Nullable<Awaited<ReturnType<typeof fs.promises.stat>>>>;
5132
5178
  /**
5133
5179
  * Returns true if there is an auth file for the given username
5134
5180
  *
@@ -5266,8 +5312,6 @@ declare module '@salesforce/core-bundle/status/myDomainResolver' {
5266
5312
  * executing the dns loookup.
5267
5313
  */
5268
5314
  resolve(): Promise<string>;
5269
- /** @deprecated there is nothing using this in forcedotcom, salesforcecli, or public github search */
5270
- getCnames(): Promise<string[]>;
5271
5315
  /**
5272
5316
  * Used to initialize asynchronous components.
5273
5317
  */
@@ -5388,8 +5432,8 @@ declare module '@salesforce/core-bundle/status/pollingClient' {
5388
5432
 
5389
5433
  }
5390
5434
  declare module '@salesforce/core-bundle/status/streamingClient' {
5391
- import { AsyncOptionalCreatable, Duration, Env } from '@salesforce/kit/lib';
5392
- import { AnyJson } from '@salesforce/ts-types/lib';
5435
+ import { AsyncOptionalCreatable, Duration, Env } from '@salesforce/kit';
5436
+ import { AnyJson } from '@salesforce/ts-types';
5393
5437
  import { Org } from '@salesforce/core-bundle/org/org';
5394
5438
  import { CometClient, CometSubscription, Message, StatusResult, StreamingExtension, StreamProcessor } from '@salesforce/core-bundle/status/types';
5395
5439
  export { CometClient, CometSubscription, Message, StatusResult, StreamingExtension, StreamProcessor };
@@ -6265,7 +6309,7 @@ declare module '@salesforce/core-bundle/util/directoryWriter' {
6265
6309
 
6266
6310
  }
6267
6311
  declare module '@salesforce/core-bundle/util/fileLocking' {
6268
- type LockInitResponse = {
6312
+ export type LockInitResponse = {
6269
6313
  writeAndUnlock: (data: string) => Promise<void>;
6270
6314
  unlock: () => Promise<void>;
6271
6315
  };
@@ -6273,6 +6317,8 @@ declare module '@salesforce/core-bundle/util/fileLocking' {
6273
6317
  writeAndUnlock: (data: string) => void;
6274
6318
  unlock: () => void;
6275
6319
  };
6320
+ export const noop: () => void;
6321
+ export const asyncNoop: () => Promise<void>;
6276
6322
  /**
6277
6323
  *
6278
6324
  *This method exists as a separate function so it can be used by ConfigFile OR outside of ConfigFile.
@@ -6393,7 +6439,6 @@ declare module '@salesforce/core-bundle/util/internal' {
6393
6439
 
6394
6440
  }
6395
6441
  declare module '@salesforce/core-bundle/util/lockRetryOptions' {
6396
- import fs from 'node:fs';
6397
6442
  export const lockOptions: {
6398
6443
  stale: number;
6399
6444
  };
@@ -6403,7 +6448,7 @@ declare module '@salesforce/core-bundle/util/lockRetryOptions' {
6403
6448
  maxTimeout: number;
6404
6449
  factor: number;
6405
6450
  };
6406
- fs: typeof fs;
6451
+ fs: import("@salesforce/core-bundle/fs/types").VirtualFs;
6407
6452
  stale: number;
6408
6453
  };
6409
6454