@salesforce/plugin-org 4.3.5 → 4.3.6-dev.1

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 CHANGED
@@ -229,7 +229,7 @@ FLAG DESCRIPTIONS
229
229
  sandbox.
230
230
  ```
231
231
 
232
- _See code: [src/commands/org/create/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/create/sandbox.ts)_
232
+ _See code: [src/commands/org/create/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/create/sandbox.ts)_
233
233
 
234
234
  ## `sf org create scratch`
235
235
 
@@ -383,7 +383,7 @@ FLAG DESCRIPTIONS
383
383
  Omit this flag to have Salesforce generate a unique username for your org.
384
384
  ```
385
385
 
386
- _See code: [src/commands/org/create/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/create/scratch.ts)_
386
+ _See code: [src/commands/org/create/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/create/scratch.ts)_
387
387
 
388
388
  ## `sf org delete sandbox`
389
389
 
@@ -429,7 +429,7 @@ EXAMPLES
429
429
  $ sf org delete sandbox --target-org my-sandbox --no-prompt
430
430
  ```
431
431
 
432
- _See code: [src/commands/org/delete/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/delete/sandbox.ts)_
432
+ _See code: [src/commands/org/delete/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/delete/sandbox.ts)_
433
433
 
434
434
  ## `sf org delete scratch`
435
435
 
@@ -473,7 +473,7 @@ EXAMPLES
473
473
  $ sf org delete scratch --target-org my-scratch-org --no-prompt
474
474
  ```
475
475
 
476
- _See code: [src/commands/org/delete/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/delete/scratch.ts)_
476
+ _See code: [src/commands/org/delete/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/delete/scratch.ts)_
477
477
 
478
478
  ## `sf org disable tracking`
479
479
 
@@ -512,7 +512,7 @@ EXAMPLES
512
512
  $ sf org disable tracking
513
513
  ```
514
514
 
515
- _See code: [src/commands/org/disable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/disable/tracking.ts)_
515
+ _See code: [src/commands/org/disable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/disable/tracking.ts)_
516
516
 
517
517
  ## `sf org display`
518
518
 
@@ -557,7 +557,7 @@ EXAMPLES
557
557
  $ sf org display --target-org TestOrg1 --verbose
558
558
  ```
559
559
 
560
- _See code: [src/commands/org/display.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/display.ts)_
560
+ _See code: [src/commands/org/display.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/display.ts)_
561
561
 
562
562
  ## `sf org enable tracking`
563
563
 
@@ -599,7 +599,7 @@ EXAMPLES
599
599
  $ sf org enable tracking
600
600
  ```
601
601
 
602
- _See code: [src/commands/org/enable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/enable/tracking.ts)_
602
+ _See code: [src/commands/org/enable/tracking.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/enable/tracking.ts)_
603
603
 
604
604
  ## `sf org list`
605
605
 
@@ -638,7 +638,7 @@ EXAMPLES
638
638
  $ sf org list --clean
639
639
  ```
640
640
 
641
- _See code: [src/commands/org/list.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/list.ts)_
641
+ _See code: [src/commands/org/list.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/list.ts)_
642
642
 
643
643
  ## `sf org list metadata`
644
644
 
@@ -705,7 +705,7 @@ FLAG DESCRIPTIONS
705
705
  Examples of metadata types that use folders are Dashboard, Document, EmailTemplate, and Report.
706
706
  ```
707
707
 
708
- _See code: [src/commands/org/list/metadata.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/list/metadata.ts)_
708
+ _See code: [src/commands/org/list/metadata.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/list/metadata.ts)_
709
709
 
710
710
  ## `sf org list metadata-types`
711
711
 
@@ -760,7 +760,7 @@ FLAG DESCRIPTIONS
760
760
  Override the api version used for api requests made by this command
761
761
  ```
762
762
 
763
- _See code: [src/commands/org/list/metadata-types.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/list/metadata-types.ts)_
763
+ _See code: [src/commands/org/list/metadata-types.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/list/metadata-types.ts)_
764
764
 
765
765
  ## `sf org open`
766
766
 
@@ -832,7 +832,7 @@ EXAMPLES
832
832
  $ sf org open --source-file force-app/main/default/flows/Hello.flow-meta.xml
833
833
  ```
834
834
 
835
- _See code: [src/commands/org/open.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/open.ts)_
835
+ _See code: [src/commands/org/open.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/open.ts)_
836
836
 
837
837
  ## `sf org refresh sandbox`
838
838
 
@@ -909,7 +909,7 @@ FLAG DESCRIPTIONS
909
909
  By default, a sandbox auto-activates after a refresh. Use this flag to control sandbox activation manually.
910
910
  ```
911
911
 
912
- _See code: [src/commands/org/refresh/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/refresh/sandbox.ts)_
912
+ _See code: [src/commands/org/refresh/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/refresh/sandbox.ts)_
913
913
 
914
914
  ## `sf org resume sandbox`
915
915
 
@@ -972,7 +972,7 @@ FLAG DESCRIPTIONS
972
972
  returns the job ID. To resume checking the sandbox creation, rerun this command.
973
973
  ```
974
974
 
975
- _See code: [src/commands/org/resume/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/resume/sandbox.ts)_
975
+ _See code: [src/commands/org/resume/sandbox.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/resume/sandbox.ts)_
976
976
 
977
977
  ## `sf org resume scratch`
978
978
 
@@ -1019,6 +1019,6 @@ FLAG DESCRIPTIONS
1019
1019
  The job ID is valid for 24 hours after you start the scratch org creation.
1020
1020
  ```
1021
1021
 
1022
- _See code: [src/commands/org/resume/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.5/src/commands/org/resume/scratch.ts)_
1022
+ _See code: [src/commands/org/resume/scratch.ts](https://github.com/salesforcecli/plugin-org/blob/4.3.6-dev.1/src/commands/org/resume/scratch.ts)_
1023
1023
 
1024
1024
  <!-- commandsstop -->
@@ -4,11 +4,12 @@
4
4
  * Licensed under the BSD 3-Clause license.
5
5
  * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
6
  */
7
- import { Lifecycle, Messages, Org, scratchOrgCreate, scratchOrgLifecycleEventName, SfError, } from '@salesforce/core';
7
+ import { Lifecycle, Messages, Org, scratchOrgCreate, scratchOrgLifecycleEventName, scratchOrgLifecycleStages, SfError, } from '@salesforce/core';
8
8
  import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
9
9
  import { Duration } from '@salesforce/kit';
10
+ import terminalLink from 'terminal-link';
11
+ import { MultiStageRenderer } from '../../../components/stages.js';
10
12
  import { buildScratchOrgRequest } from '../../../shared/scratchOrgRequest.js';
11
- import { buildStatus } from '../../../shared/scratchOrgOutput.js';
12
13
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
13
14
  const messages = Messages.loadMessages('@salesforce/plugin-org', 'create_scratch');
14
15
  const definitionFileHelpGroupName = 'Definition File Override';
@@ -91,7 +92,7 @@ export default class OrgCreateScratch extends SfCommand {
91
92
  wait: Flags.duration({
92
93
  unit: 'minutes',
93
94
  default: Duration.minutes(5),
94
- min: 2,
95
+ min: 1,
95
96
  char: 'w',
96
97
  helpValue: '<minutes>',
97
98
  summary: messages.getMessage('flags.wait.summary'),
@@ -149,36 +150,67 @@ export default class OrgCreateScratch extends SfCommand {
149
150
  throw new SfError('No instance URL found for the dev hub');
150
151
  }
151
152
  const createCommandOptions = await buildScratchOrgRequest(flags, flags['client-id'] ? await this.secretPrompt({ message: messages.getMessage('prompt.secret') }) : undefined);
152
- let lastStatus;
153
- if (!flags.async) {
154
- lifecycle.on(scratchOrgLifecycleEventName, async (data) => {
155
- lastStatus = buildStatus(data, baseUrl);
156
- this.spinner.status = lastStatus;
157
- return Promise.resolve();
158
- });
153
+ const ms = new MultiStageRenderer({
154
+ stages: flags.async ? ['prepare request', 'send request', 'done'] : scratchOrgLifecycleStages,
155
+ title: flags.async ? 'Creating Scratch Org (async)' : 'Creating Scratch Org',
156
+ info: [
157
+ {
158
+ label: 'Request Id',
159
+ get: (data) => data.scratchOrgInfo?.Id && terminalLink(data.scratchOrgInfo.Id, `${baseUrl}/${data.scratchOrgInfo.Id}`),
160
+ isBold: true,
161
+ },
162
+ {
163
+ label: 'OrgId',
164
+ get: (data) => data.scratchOrgInfo?.ScratchOrg,
165
+ isBold: true,
166
+ color: 'cyan',
167
+ },
168
+ {
169
+ label: 'Username',
170
+ get: (data) => data.scratchOrgInfo?.SignupUsername,
171
+ isBold: true,
172
+ color: 'cyan',
173
+ },
174
+ {
175
+ label: 'Alias',
176
+ get: (data) => data.alias,
177
+ isStatic: true,
178
+ },
179
+ ],
180
+ });
181
+ if (!this.jsonEnabled()) {
182
+ ms.start({ alias: flags.alias });
159
183
  }
160
- this.log();
161
- this.spinner.start(flags.async ? 'Requesting Scratch Org (will not wait for completion because --async)' : 'Creating Scratch Org');
184
+ lifecycle.on(scratchOrgLifecycleEventName, async (data) => {
185
+ ms.goto(data.stage, data);
186
+ if (data.stage === 'done') {
187
+ ms.stop();
188
+ }
189
+ return Promise.resolve();
190
+ });
162
191
  try {
163
192
  const { username, scratchOrgInfo, authFields, warnings } = await scratchOrgCreate(createCommandOptions);
164
- this.spinner.stop(lastStatus);
165
193
  if (!scratchOrgInfo) {
166
194
  throw new SfError('The scratch org did not return with any information');
167
195
  }
168
- this.log();
169
196
  if (flags.async) {
197
+ ms.last({ scratchOrgInfo });
198
+ ms.stop();
199
+ this.log();
170
200
  this.info(messages.getMessage('action.resume', [this.config.bin, scratchOrgInfo.Id]));
171
201
  }
172
202
  else {
203
+ this.log();
173
204
  this.logSuccess(messages.getMessage('success'));
174
205
  }
175
206
  return { username, scratchOrgInfo, authFields, warnings, orgId: authFields?.orgId };
176
207
  }
177
208
  catch (error) {
209
+ ms.stop(error);
178
210
  if (error instanceof SfError && error.name === 'ScratchOrgInfoTimeoutError') {
179
- this.spinner.stop(lastStatus);
180
211
  const scratchOrgInfoId = error.data.scratchOrgInfoId;
181
212
  const resumeMessage = messages.getMessage('action.resume', [this.config.bin, scratchOrgInfoId]);
213
+ this.log();
182
214
  this.info(resumeMessage);
183
215
  this.error('The scratch org did not complete within your wait time', { code: '69', exit: 69 });
184
216
  }
@@ -1 +1 @@
1
- {"version":3,"file":"scratch.js","sourceRoot":"","sources":["../../../../src/commands/org/create/scratch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,GAAG,EACH,gBAAgB,EAEhB,4BAA4B,EAC5B,OAAO,GACR,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sCAAsC,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAGlE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,C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GAAG,EAAE,cAAc,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACxF,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,GAAG,EAAE,CAAC;gBACX,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC;YAClD,CAAC;YAED,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;QACtF,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,EAAE,CAAC,IAAI,CAAC,KAAc,CAAC,CAAC;YACxB,IAAI,KAAK,YAAY,OAAO,IAAI,KAAK,CAAC,IAAI,KAAK,4BAA4B,EAAE,CAAC;gBAC5E,MAAM,gBAAgB,GAAI,KAAK,CAAC,IAAqC,CAAC,gBAAgB,CAAC;gBACvF,MAAM,aAAa,GAAG,QAAQ,CAAC,UAAU,CAAC,eAAe,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC,CAAC;gBAEhG,IAAI,CAAC,GAAG,EAAE,CAAC;gBACX,IAAI,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;gBACzB,IAAI,CAAC,KAAK,CAAC,wDAAwD,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC;YACjG,CAAC;iBAAM,CAAC;gBACN,MAAM,KAAK,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC"}
@@ -6,8 +6,9 @@
6
6
  */
7
7
  import { strict as assert } from 'node:assert';
8
8
  import { Flags, SfCommand } from '@salesforce/sf-plugins-core';
9
- import { Lifecycle, Messages, ScratchOrgCache, scratchOrgLifecycleEventName, scratchOrgResume, SfError, } from '@salesforce/core';
10
- import { buildStatus } from '../../../shared/scratchOrgOutput.js';
9
+ import { Lifecycle, Messages, ScratchOrgCache, scratchOrgLifecycleEventName, scratchOrgLifecycleStages, scratchOrgResume, SfError, } from '@salesforce/core';
10
+ import terminalLink from 'terminal-link';
11
+ import { MultiStageRenderer } from '../../../components/stages.js';
11
12
  Messages.importMessagesDirectoryFromMetaUrl(import.meta.url);
12
13
  const messages = Messages.loadMessages('@salesforce/plugin-org', 'resume_scratch');
13
14
  export default class OrgResumeScratch extends SfCommand {
@@ -40,23 +41,54 @@ export default class OrgResumeScratch extends SfCommand {
40
41
  throw messages.createError('error.NoRecentJobId');
41
42
  // oclif doesn't know that the exactlyOne flag will ensure that one of these is set, and there we definitely have a jobID.
42
43
  assert(jobId);
43
- const hubBaseUrl = cache.get(jobId)?.hubBaseUrl;
44
- let lastStatus;
44
+ const cached = cache.get(jobId);
45
+ const hubBaseUrl = cached?.hubBaseUrl;
46
+ const ms = new MultiStageRenderer({
47
+ stages: scratchOrgLifecycleStages,
48
+ title: 'Resuming Scratch Org',
49
+ info: [
50
+ {
51
+ label: 'Request Id',
52
+ get: (data) => data.scratchOrgInfo?.Id && terminalLink(data.scratchOrgInfo.Id, `${hubBaseUrl}/${data.scratchOrgInfo.Id}`),
53
+ isBold: true,
54
+ },
55
+ {
56
+ label: 'OrgId',
57
+ get: (data) => data.scratchOrgInfo?.ScratchOrg,
58
+ isBold: true,
59
+ color: 'cyan',
60
+ },
61
+ {
62
+ label: 'Username',
63
+ get: (data) => data.scratchOrgInfo?.SignupUsername,
64
+ isBold: true,
65
+ color: 'cyan',
66
+ },
67
+ {
68
+ label: 'Alias',
69
+ get: (data) => data.alias,
70
+ isStatic: true,
71
+ },
72
+ ],
73
+ });
74
+ if (!this.jsonEnabled()) {
75
+ ms.start({ alias: cached?.alias });
76
+ }
45
77
  lifecycle.on(scratchOrgLifecycleEventName, async (data) => {
46
- lastStatus = buildStatus(data, hubBaseUrl);
47
- this.spinner.status = lastStatus;
78
+ ms.goto(data.stage, data);
79
+ if (data.stage === 'done') {
80
+ ms.stop();
81
+ }
48
82
  return Promise.resolve();
49
83
  });
50
- this.log();
51
- this.spinner.start('Creating Scratch Org');
52
84
  try {
53
85
  const { username, scratchOrgInfo, authFields, warnings } = await scratchOrgResume(jobId);
54
- this.spinner.stop(lastStatus);
55
86
  this.log();
56
87
  this.logSuccess(messages.getMessage('success'));
57
88
  return { username, scratchOrgInfo, authFields, warnings, orgId: authFields?.orgId };
58
89
  }
59
90
  catch (e) {
91
+ ms.stop(e);
60
92
  if (cache.keys() && e instanceof Error && e.name === 'CacheMissError') {
61
93
  // we have something in the cache, but it didn't match what the user passed in
62
94
  throw messages.createError('error.jobIdMismatch', [jobId]);
@@ -1 +1 @@
1
- {"version":3,"file":"scratch.js","sourceRoot":"","sources":["../../../../src/commands/org/resume/scratch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAE/C,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC/D,OAAO,EACL,SAAS,EACT,QAAQ,EACR,eAAe,EAEf,4BAA4B,EAC5B,gBAAgB,EAChB,OAAO,GACR,MAAM,kBAAkB,CAAC;AAE1B,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAElE,QAAQ,CAAC,kCAAkC,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC7D,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAC,wBAAwB,EAAE,gBAAgB,CAAC,CAAC;AAEnF,MAAM,CAAC,OAAO,OAAO,gBAAiB,SAAQ,SAAgC;IACrE,MAAM,CAAU,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC;IACzD,MAAM,CAAU,WAAW,GAAG,QAAQ,CAAC,UAAU,CAAC,aAAa,CAAC,CAAC;IACjE,MAAM,CAAU,QAAQ,GAAG,QAAQ,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAC5D,MAAM,CAAU,OAAO,GAAG,CAAC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AE,QAAQ,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,CAAC;QACtF,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,EAAE,CAAC,IAAI,CAAC,CAAU,CAAC,CAAC;YAEpB,IAAI,KAAK,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,IAAI,KAAK,gBAAgB,EAAE,CAAC;gBACtE,8EAA8E;gBAC9E,MAAM,QAAQ,CAAC,WAAW,CAAC,qBAAqB,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;YAC7D,CAAC;iBAAM,CAAC;gBACN,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;YACxB,CAAC;QACH,CAAC;IACH,CAAC"}
@@ -0,0 +1,31 @@
1
+ import React from 'react';
2
+ import { type SpinnerName } from 'cli-spinners';
3
+ export type UseSpinnerProps = {
4
+ /**
5
+ * Type of a spinner.
6
+ * See [cli-spinners](https://github.com/sindresorhus/cli-spinners) for available spinners.
7
+ *
8
+ * @default dots
9
+ */
10
+ readonly type?: SpinnerName;
11
+ };
12
+ export type UseSpinnerResult = {
13
+ frame: string;
14
+ };
15
+ export declare function useSpinner({ type }: UseSpinnerProps): UseSpinnerResult;
16
+ export type SpinnerProps = UseSpinnerProps & {
17
+ /**
18
+ * Label to show near the spinner.
19
+ */
20
+ readonly label?: string;
21
+ readonly isBold?: boolean;
22
+ readonly labelPosition?: 'left' | 'right';
23
+ };
24
+ export declare function Spinner({ isBold, label, type, labelPosition }: SpinnerProps): React.ReactElement;
25
+ export declare function SpinnerOrError({ error, labelPosition, ...props }: SpinnerProps & {
26
+ readonly error?: Error;
27
+ }): React.ReactElement;
28
+ export declare function SpinnerOrErrorOrChildren({ children, error, ...props }: SpinnerProps & {
29
+ readonly children?: React.ReactNode;
30
+ readonly error?: Error;
31
+ }): React.ReactElement;
@@ -0,0 +1,55 @@
1
+ /*
2
+ * Copyright (c) 2024, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import React, { useEffect, useState } from 'react';
8
+ import spinners from 'cli-spinners';
9
+ import { Box, Text } from 'ink';
10
+ export function useSpinner({ type = 'dots' }) {
11
+ const [frame, setFrame] = useState(0);
12
+ const spinner = spinners[type];
13
+ useEffect(() => {
14
+ const timer = setInterval(() => {
15
+ setFrame((previousFrame) => {
16
+ const isLastFrame = previousFrame === spinner.frames.length - 1;
17
+ return isLastFrame ? 0 : previousFrame + 1;
18
+ });
19
+ }, spinner.interval);
20
+ return () => {
21
+ clearInterval(timer);
22
+ };
23
+ }, [spinner]);
24
+ return {
25
+ frame: spinner.frames[frame] ?? '',
26
+ };
27
+ }
28
+ export function Spinner({ isBold, label, type, labelPosition = 'right' }) {
29
+ const { frame } = useSpinner({ type });
30
+ return (React.createElement(Box, null,
31
+ label && labelPosition === 'left' && React.createElement(Text, null, label),
32
+ isBold ? (React.createElement(Text, { bold: true, color: "magenta" }, frame)) : (React.createElement(Text, { color: "magenta" },
33
+ frame,
34
+ " ")),
35
+ label && labelPosition === 'right' && React.createElement(Text, null, label)));
36
+ }
37
+ export function SpinnerOrError({ error, labelPosition = 'right', ...props }) {
38
+ if (error) {
39
+ return (React.createElement(Box, null,
40
+ props.label && labelPosition === 'left' && React.createElement(Text, null, props.label),
41
+ React.createElement(Text, { color: "red" }, "\u2716"),
42
+ props.label && labelPosition === 'right' && React.createElement(Text, null, props.label)));
43
+ }
44
+ return React.createElement(Spinner, { labelPosition: labelPosition, ...props });
45
+ }
46
+ export function SpinnerOrErrorOrChildren({ children, error, ...props }) {
47
+ if (children) {
48
+ return (React.createElement(Box, null,
49
+ props.label && props.labelPosition === 'left' && React.createElement(Text, null, props.label),
50
+ children,
51
+ props.label && props.labelPosition === 'right' && React.createElement(Text, null, props.label)));
52
+ }
53
+ return React.createElement(SpinnerOrError, { error: error, ...props });
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C,KAAK,IAAI,KAAK,CAAC,aAAa,KAAK,OAAO,IAAI,oBAAC,IAAI,QAAE,KAAK,CAAC,KAAK,CAAQ,CACzE,CACP,CAAC;IACJ,CAAC;IAED,OAAO,oBAAC,cAAc,IAAC,KAAK,EAAE,KAAK,KAAM,KAAK,GAAI,CAAC;AACrD,CAAC"}
@@ -0,0 +1,72 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { ScratchOrgLifecycleEvent, SfError } from '@salesforce/core';
3
+ import React from 'react';
4
+ import { Duration } from '@salesforce/kit';
5
+ export declare function Divider({ title, width, padding, titlePadding, titleColor, dividerChar, dividerColor, }: {
6
+ readonly title?: string;
7
+ readonly width?: number | 'full';
8
+ readonly padding?: number;
9
+ readonly titleColor?: string;
10
+ readonly titlePadding?: number;
11
+ readonly dividerChar?: string;
12
+ readonly dividerColor?: string;
13
+ }): React.ReactNode;
14
+ export declare function Timer(props: {
15
+ readonly color?: string;
16
+ readonly isStopped?: boolean;
17
+ }): React.ReactNode;
18
+ export declare function Space({ repeat }: {
19
+ readonly repeat?: number;
20
+ }): React.ReactNode;
21
+ export declare function Stages(props: {
22
+ readonly info?: FormattedInfo[];
23
+ readonly currentStage: string;
24
+ readonly stages: string[] | readonly string[];
25
+ readonly title: string;
26
+ readonly error?: SfError | Error | undefined;
27
+ readonly timeout?: Duration | undefined;
28
+ }): React.ReactNode;
29
+ export declare function Status(props: {
30
+ readonly data?: ScratchOrgLifecycleEvent;
31
+ readonly baseUrl: string;
32
+ readonly isAsync?: boolean;
33
+ readonly error?: SfError | Error | undefined;
34
+ }): React.ReactNode;
35
+ type Info<T extends Record<string, unknown>> = {
36
+ color?: string;
37
+ get?: (data: T) => string | undefined;
38
+ isBold?: boolean;
39
+ isStatic?: boolean;
40
+ label: string;
41
+ };
42
+ type FormattedInfo = {
43
+ readonly color?: string;
44
+ readonly isBold?: boolean;
45
+ readonly isStatic?: boolean;
46
+ readonly label: string;
47
+ readonly value: string | undefined;
48
+ };
49
+ type MultiStageRendererOptions<T extends Record<string, unknown>> = {
50
+ readonly stages: readonly string[] | string[];
51
+ readonly title: string;
52
+ readonly info?: Array<Info<T>>;
53
+ };
54
+ export declare class MultiStageRenderer<T extends Record<string, unknown>> implements Disposable {
55
+ private currentStage;
56
+ private data?;
57
+ private readonly info?;
58
+ private readonly stages;
59
+ private readonly title;
60
+ private instance;
61
+ constructor({ info, stages, title }: MultiStageRendererOptions<T>);
62
+ start(data?: Partial<T>): void;
63
+ next(data?: Partial<T>): void;
64
+ previous(data?: Partial<T>): void;
65
+ goto(stage: string, data?: Partial<T>): void;
66
+ last(data?: Partial<T>): void;
67
+ stop(error?: Error | SfError): void;
68
+ [Symbol.dispose](): void;
69
+ private update;
70
+ private formatInfo;
71
+ }
72
+ export {};
@@ -0,0 +1,196 @@
1
+ /*
2
+ * Copyright (c) 2024, salesforce.com, inc.
3
+ * All rights reserved.
4
+ * Licensed under the BSD 3-Clause license.
5
+ * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+ import { scratchOrgLifecycleStages } from '@salesforce/core';
8
+ import { Box, render, Text } from 'ink';
9
+ import { capitalCase } from 'change-case';
10
+ import React from 'react';
11
+ import terminalLink from 'terminal-link';
12
+ import { Performance } from '@oclif/core';
13
+ import { SpinnerOrError, SpinnerOrErrorOrChildren } from './spinner.js';
14
+ function round(value, decimals = 2) {
15
+ const factor = Math.pow(10, decimals);
16
+ return (Math.round(value * factor) / factor).toFixed(decimals);
17
+ }
18
+ function timeInMostReadableFormat(time, decimals = 2) {
19
+ // if time < 1000ms, return time in ms
20
+ if (time < 1000) {
21
+ return `${time}ms`;
22
+ }
23
+ // if time < 60s, return time in seconds
24
+ if (time < 60_000) {
25
+ return `${round(time / 1000, decimals)}s`;
26
+ }
27
+ // if time < 60m, return time in minutes and seconds
28
+ if (time < 3_600_000) {
29
+ const minutes = Math.floor(time / 60_000);
30
+ const seconds = round((time % 60_000) / 1000, 0);
31
+ return `${minutes}m ${seconds}s`;
32
+ }
33
+ return time.toString();
34
+ }
35
+ const getSideDividerWidth = (width, titleWidth) => (width - titleWidth) / 2;
36
+ const getNumberOfCharsPerWidth = (char, width) => width / char.length;
37
+ const PAD = ' ';
38
+ export function Divider({ title = '', width = 50, padding = 1, titlePadding = 1, titleColor = 'white', dividerChar = '─', dividerColor = 'dim', }) {
39
+ const titleString = title ? `${PAD.repeat(titlePadding) + title + PAD.repeat(titlePadding)}` : '';
40
+ const titleWidth = titleString.length;
41
+ // width ??= process.stdout.columns ? process.stdout.columns - titlePadding : 80;
42
+ const terminalWidth = process.stdout.columns ?? 80;
43
+ const widthToUse = width === 'full' ? terminalWidth - titlePadding : width > terminalWidth ? terminalWidth : width;
44
+ const dividerWidth = getSideDividerWidth(widthToUse, titleWidth);
45
+ const numberOfCharsPerSide = getNumberOfCharsPerWidth(dividerChar, dividerWidth);
46
+ const dividerSideString = dividerChar.repeat(numberOfCharsPerSide);
47
+ const paddingString = PAD.repeat(padding);
48
+ return (React.createElement(Box, { flexDirection: "row" },
49
+ React.createElement(Text, null,
50
+ paddingString,
51
+ React.createElement(Text, { color: dividerColor }, dividerSideString),
52
+ React.createElement(Text, { color: titleColor }, titleString),
53
+ React.createElement(Text, { color: dividerColor }, dividerSideString),
54
+ paddingString)));
55
+ }
56
+ export function Timer(props) {
57
+ const [time, setTime] = React.useState(0);
58
+ const interval = 10;
59
+ React.useEffect(() => {
60
+ const intervalId = setInterval(() => {
61
+ if (!props.isStopped) {
62
+ setTime((prevTime) => prevTime + interval);
63
+ }
64
+ }, interval);
65
+ return () => {
66
+ clearInterval(intervalId);
67
+ };
68
+ }, [interval, props.isStopped]);
69
+ if (props.isStopped) {
70
+ return React.createElement(Text, { ...props }, timeInMostReadableFormat(time));
71
+ }
72
+ return React.createElement(Text, { ...props }, timeInMostReadableFormat(time));
73
+ }
74
+ export function Space({ repeat = 1 }) {
75
+ return React.createElement(Text, null, ' '.repeat(repeat));
76
+ }
77
+ function StaticKeyValue({ label, value, isBold, color, isStatic }) {
78
+ if (!value || !isStatic)
79
+ return;
80
+ return (React.createElement(Box, null,
81
+ React.createElement(Text, { bold: isBold },
82
+ label,
83
+ ": "),
84
+ React.createElement(Text, { color: color }, value)));
85
+ }
86
+ // How to integrate with telemetry?
87
+ export function Stages(props) {
88
+ const markers = new Map();
89
+ const spinnerType = process.platform === 'win32' ? 'line' : 'arc';
90
+ return (React.createElement(Box, { flexDirection: "column", paddingTop: 1 },
91
+ React.createElement(Divider, { title: props.title }),
92
+ React.createElement(Box, { flexDirection: "column", paddingTop: 1, marginLeft: 1 }, props.stages.map((stage, stageIndex) => {
93
+ const isCurrent = props.currentStage === stage && stageIndex < props.stages.length - 1;
94
+ const isCompleted = !isCurrent && props.stages.indexOf(props.currentStage) >= stageIndex;
95
+ const isFuture = !isCompleted && !isCurrent && props.stages.indexOf(props.currentStage) < stageIndex;
96
+ if (isCurrent) {
97
+ markers.set(stage, Performance.mark('plugin-org', stage));
98
+ }
99
+ if (isCompleted) {
100
+ markers.get(stage)?.stop();
101
+ }
102
+ return (React.createElement(Box, { key: stage },
103
+ isCurrent && React.createElement(SpinnerOrError, { error: props.error, type: "dots2", label: capitalCase(stage) }),
104
+ isCompleted && (React.createElement(Box, null,
105
+ React.createElement(Text, { color: "green" }, "\u2713 "),
106
+ React.createElement(Text, null,
107
+ capitalCase(stage),
108
+ " "))),
109
+ isFuture && React.createElement(Text, { color: "dim" },
110
+ "\u25FC ",
111
+ capitalCase(stage)),
112
+ !isFuture && (React.createElement(Box, null,
113
+ React.createElement(Space, null),
114
+ React.createElement(Timer, { color: "dim", isStopped: isCompleted })))));
115
+ })),
116
+ React.createElement(Box, { paddingTop: 1, marginLeft: 1 },
117
+ React.createElement(Text, null, "Elapsed Time: "),
118
+ React.createElement(Timer, null)),
119
+ React.createElement(Box, { flexDirection: "column", paddingTop: 1, marginLeft: 1 }, props.info?.map((info) => info.isStatic ? (React.createElement(StaticKeyValue, { key: info.label, ...info })) : (React.createElement(SpinnerOrErrorOrChildren, { key: info.label, label: `${info.label}: `, labelPosition: "left", error: props.error, type: spinnerType }, info.value && (React.createElement(Text, { bold: info.isBold, color: info.color }, info.value))))))));
120
+ }
121
+ export function Status(props) {
122
+ if (!props.data)
123
+ return;
124
+ const spinnerType = process.platform === 'win32' ? 'line' : 'arc';
125
+ return (React.createElement(Box, { flexDirection: "column" },
126
+ React.createElement(Stages, { title: props.isAsync ? 'Creating Scratch Org (async)' : 'Creating Scratch Org', currentStage: props.data.stage, stages: props.isAsync ? ['prepare request', 'send request', 'done'] : scratchOrgLifecycleStages, error: props.error }),
127
+ React.createElement(Box, { flexDirection: "column", paddingTop: 1, marginLeft: 1 },
128
+ React.createElement(SpinnerOrErrorOrChildren, { label: "Request Id: ", labelPosition: "left", error: props.error, type: spinnerType }, props.data?.scratchOrgInfo?.Id && (React.createElement(Text, { bold: true }, terminalLink(props.data?.scratchOrgInfo?.Id, `${props.baseUrl}/${props.data?.scratchOrgInfo?.Id}`)))),
129
+ React.createElement(SpinnerOrErrorOrChildren, { label: "OrgId: ", labelPosition: "left", error: props.error, type: spinnerType }, props.data?.scratchOrgInfo?.ScratchOrg && (React.createElement(Text, { bold: true, color: "cyan" }, props.data?.scratchOrgInfo?.ScratchOrg))),
130
+ React.createElement(SpinnerOrErrorOrChildren, { label: "Username: ", labelPosition: "left", error: props.error, type: spinnerType }, props.data?.scratchOrgInfo?.SignupUsername && (React.createElement(Text, { bold: true, color: "cyan" }, props.data?.scratchOrgInfo?.SignupUsername))))));
131
+ }
132
+ export class MultiStageRenderer {
133
+ currentStage;
134
+ data;
135
+ info;
136
+ stages;
137
+ title;
138
+ instance;
139
+ constructor({ info, stages, title }) {
140
+ this.stages = stages;
141
+ this.title = title;
142
+ this.info = info;
143
+ this.currentStage = stages[0];
144
+ }
145
+ start(data) {
146
+ this.data = { ...this.data, ...data };
147
+ this.instance = render(React.createElement(Stages, { info: this.formatInfo(), currentStage: this.stages[0], stages: this.stages, title: this.title }), { debug: false });
148
+ }
149
+ next(data) {
150
+ const nextStageIndex = this.stages.indexOf(this.currentStage) + 1;
151
+ if (nextStageIndex < this.stages.length) {
152
+ this.update(this.stages[nextStageIndex], data);
153
+ }
154
+ }
155
+ previous(data) {
156
+ const previousStageIndex = this.stages.indexOf(this.currentStage) - 1;
157
+ if (previousStageIndex >= 0) {
158
+ this.update(this.stages[previousStageIndex], data);
159
+ }
160
+ }
161
+ goto(stage, data) {
162
+ if (this.stages.includes(stage)) {
163
+ this.update(stage, data);
164
+ }
165
+ }
166
+ last(data) {
167
+ this.update(this.stages[this.stages.length - 1], data);
168
+ }
169
+ stop(error) {
170
+ if (error) {
171
+ this.instance?.rerender(React.createElement(Stages, { info: this.formatInfo(), currentStage: this.currentStage ?? this.stages[0], stages: this.stages, title: this.title, error: error }));
172
+ }
173
+ this.instance?.unmount();
174
+ }
175
+ [Symbol.dispose]() {
176
+ this.instance?.unmount();
177
+ }
178
+ update(stage, data) {
179
+ this.currentStage = stage;
180
+ this.data = { ...this.data, ...data };
181
+ this.instance?.rerender(React.createElement(Stages, { info: this.formatInfo(), currentStage: this.currentStage, stages: this.stages, title: this.title }));
182
+ }
183
+ formatInfo() {
184
+ return (this.info?.map((info) => {
185
+ const formattedData = info.get ? info.get(this.data) : undefined;
186
+ return {
187
+ value: formattedData,
188
+ label: info.label,
189
+ isBold: info.isBold,
190
+ color: info.color,
191
+ isStatic: info.isStatic,
192
+ };
193
+ }) ?? []);
194
+ }
195
+ }
196
+ //# sourceMappingURL=stages.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stages.js","sourceRoot":"","sources":["../../src/components/stages.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAA4B,yBAAyB,EAAW,MAAM,kBAAkB,CAAC;AAChG,OAAO,EAAE,GAAG,EAAY,MAAM,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,K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AI,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAS,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YACtE,OAAO;gBACL,KAAK,EAAE,aAAa;gBACpB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,MAAM,EAAE,IAAI,CAAC,MAAM;gBACnB,KAAK,EAAE,IAAI,CAAC,KAAK;gBACjB,QAAQ,EAAE,IAAI,CAAC,QAAQ;aACxB,CAAC;QACJ,CAAC,CAAC,IAAI,EAAE,CACT,CAAC;IACJ,CAAC;CACF"}
@@ -1982,5 +1982,5 @@
1982
1982
  ]
1983
1983
  }
1984
1984
  },
1985
- "version": "4.3.5"
1985
+ "version": "4.3.6-dev.1"
1986
1986
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@salesforce/plugin-org",
3
3
  "description": "Commands to interact with Salesforce orgs",
4
- "version": "4.3.5",
4
+ "version": "4.3.6-dev.1",
5
5
  "author": "Salesforce",
6
6
  "bugs": "https://github.com/forcedotcom/cli/issues",
7
7
  "dependencies": {
@@ -12,15 +12,24 @@
12
12
  "@salesforce/source-deploy-retrieve": "^12.0.1",
13
13
  "ansis": "^3.2.0",
14
14
  "change-case": "^5.4.4",
15
+ "cli-spinners": "^2",
16
+ "ink": "^5.0.1",
15
17
  "is-wsl": "^3.1.0",
16
- "open": "^10.1.0"
18
+ "open": "^10.1.0",
19
+ "react": "^18.3.1",
20
+ "terminal-link": "^3.0.0"
17
21
  },
18
22
  "devDependencies": {
19
23
  "@oclif/plugin-command-snapshot": "^5.2.6",
20
24
  "@salesforce/cli-plugins-testkit": "^5.3.15",
21
25
  "@salesforce/dev-scripts": "^10.2.2",
22
- "@salesforce/plugin-command-reference": "^3.1.8",
26
+ "@salesforce/plugin-command-reference": "^3.1.9",
23
27
  "@salesforce/ts-sinon": "1.4.22",
28
+ "@types/react": "^18.3.3",
29
+ "eslint-config-xo": "^0.45.0",
30
+ "eslint-config-xo-react": "^0.27.0",
31
+ "eslint-plugin-react": "^7.34.3",
32
+ "eslint-plugin-react-hooks": "^4.6.2",
24
33
  "eslint-plugin-sf-plugin": "^1.18.11",
25
34
  "moment": "^2.30.1",
26
35
  "oclif": "^4.13.9",
@@ -233,7 +242,7 @@
233
242
  "exports": "./lib/index.js",
234
243
  "type": "module",
235
244
  "sfdx": {
236
- "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/4.3.5.crt",
237
- "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/4.3.5.sig"
245
+ "publicKeyUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/4.3.6-dev.1.crt",
246
+ "signatureUrl": "https://developer.salesforce.com/media/salesforce-cli/security/@salesforce/plugin-org/4.3.6-dev.1.sig"
238
247
  }
239
248
  }
@@ -1,9 +0,0 @@
1
- import { ScratchOrgLifecycleEvent } from '@salesforce/core';
2
- export declare const buildStatus: (data: ScratchOrgLifecycleEvent, baseUrl: string) => string;
3
- export declare const formatStage: (currentStage: ScratchOrgLifecycleEvent['stage']) => string;
4
- export declare const formatRequest: (baseUrl: string, id?: string) => string;
5
- export declare const formatUsername: (username?: string) => string;
6
- export declare const formatOrgId: (id?: string) => string;
7
- export declare const formatCurrentStage: (stage: string) => string;
8
- export declare const formatCompletedStage: (stage: string) => string;
9
- export declare const formatFutureStage: (stage: string) => string;
@@ -1,36 +0,0 @@
1
- /*
2
- * Copyright (c) 2020, salesforce.com, inc.
3
- * All rights reserved.
4
- * Licensed under the BSD 3-Clause license.
5
- * For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
6
- */
7
- import { scratchOrgLifecycleStages } from '@salesforce/core';
8
- import ansis from 'ansis';
9
- import { capitalCase } from 'change-case';
10
- import { StandardColors } from '@salesforce/sf-plugins-core';
11
- const boldBlue = (input) => ansis.rgb(81, 176, 235).bold(input);
12
- const boldPurple = (input) => ansis.rgb(157, 129, 221).bold(input);
13
- export const buildStatus = (data, baseUrl) => `
14
- RequestId: ${formatRequest(baseUrl, data.scratchOrgInfo?.Id)}
15
- OrgId: ${formatOrgId(data.scratchOrgInfo?.ScratchOrg)}
16
- Username: ${formatUsername(data.scratchOrgInfo?.SignupUsername)}
17
- ${formatStage(data.stage)}`;
18
- export const formatStage = (currentStage) => scratchOrgLifecycleStages
19
- .map((stage, stageIndex) => {
20
- // current stage
21
- if (currentStage === stage)
22
- return formatCurrentStage(stage);
23
- // completed stages
24
- if (scratchOrgLifecycleStages.indexOf(currentStage) > stageIndex)
25
- return formatCompletedStage(stage);
26
- // future stage
27
- return formatFutureStage(stage);
28
- })
29
- .join('\n');
30
- export const formatRequest = (baseUrl, id) => `${id ? `${ansis.bold(id)} (${baseUrl}/${id})` : ''}`;
31
- export const formatUsername = (username) => `${username ? `${boldBlue(username)} ` : ''}`;
32
- export const formatOrgId = (id) => `${id ? `${boldBlue(id)} ` : ''}`;
33
- export const formatCurrentStage = (stage) => boldPurple(capitalCase(stage));
34
- export const formatCompletedStage = (stage) => StandardColors.success.bold(`✓ ${capitalCase(stage)}`);
35
- export const formatFutureStage = (stage) => StandardColors.info(capitalCase(stage));
36
- //# sourceMappingURL=scratchOrgOutput.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scratchOrgOutput.js","sourceRoot":"","sources":["../../src/shared/scratchOrgOutput.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAA4B,yBAAyB,EAAE,MAAM,kBAAkB,CAAC;AACvF,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAE7D,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,IAA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