@salesforce/core 3.23.2 → 3.23.5

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/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ### [3.23.5](https://github.com/forcedotcom/sfdx-core/compare/v3.23.4...v3.23.5) (2022-07-06)
6
+
7
+ ### Bug Fixes
8
+
9
+ - add resolveAlias ([#605](https://github.com/forcedotcom/sfdx-core/issues/605)) ([ffa9ed6](https://github.com/forcedotcom/sfdx-core/commit/ffa9ed63ea583baa327071db4030ea5346d1128f))
10
+
11
+ ### [3.23.4](https://github.com/forcedotcom/sfdx-core/compare/v3.23.3...v3.23.4) (2022-07-05)
12
+
13
+ ### Bug Fixes
14
+
15
+ - force publish ([3eb660d](https://github.com/forcedotcom/sfdx-core/commit/3eb660dd23ee959e085a9ac3dbd65de92e511d74))
16
+
17
+ ### [3.23.3](https://github.com/forcedotcom/sfdx-core/compare/v3.23.2...v3.23.3) (2022-06-30)
18
+
19
+ ### Bug Fixes
20
+
21
+ - force publish ([b767232](https://github.com/forcedotcom/sfdx-core/commit/b767232f2f76a4a00387e37128428ad18221a594))
22
+
5
23
  ### [3.23.2](https://github.com/forcedotcom/sfdx-core/compare/v3.23.1...v3.23.2) (2022-06-30)
6
24
 
7
25
  ### Bug Fixes
@@ -138,6 +138,16 @@ export declare class AliasAccessor extends AsyncOptionalCreatable {
138
138
  * @param usernameOrAlias a string that might be a username or might be an alias
139
139
  */
140
140
  resolveUsername(usernameOrAlias: string): string;
141
+ /**
142
+ * If the provided string is an alias, return it.
143
+ * If the provided string is not an alias, return the username of the provided alias
144
+ *
145
+ * This method is helpful when you don't know if the string you have is a username
146
+ * or an alias.
147
+ *
148
+ * @param usernameOrAlias a string that might be a username or might be an alias
149
+ */
150
+ resolveAlias(usernameOrAlias: string): Nullable<string>;
141
151
  /**
142
152
  * Set an alias for the given aliasable entity
143
153
  *
@@ -145,14 +155,24 @@ export declare class AliasAccessor extends AsyncOptionalCreatable {
145
155
  * @param entity the aliasable entity that's being aliased
146
156
  */
147
157
  set(alias: string, entity: Aliasable): void;
158
+ /**
159
+ * Unset the given alias.
160
+ *
161
+ */
148
162
  unset(alias: string): void;
149
163
  /**
150
- * This method unsets all the aliases for the given entity.
164
+ * Unsets all the aliases for the given entity.
151
165
  *
152
166
  * @param entity the aliasable entity for which you want to unset all aliases
153
167
  */
154
168
  unsetAll(entity: Aliasable): void;
155
169
  write(): Promise<ConfigContents>;
170
+ /**
171
+ * Returns true if the provided alias exists
172
+ *
173
+ * @param alias the alias you want to check
174
+ */
175
+ has(alias: string): boolean;
156
176
  protected init(): Promise<void>;
157
177
  /**
158
178
  * Returns the username of given aliasable entity
@@ -202,6 +202,21 @@ class AliasAccessor extends kit_1.AsyncOptionalCreatable {
202
202
  var _a;
203
203
  return (_a = this.getUsername(usernameOrAlias)) !== null && _a !== void 0 ? _a : usernameOrAlias;
204
204
  }
205
+ /**
206
+ * If the provided string is an alias, return it.
207
+ * If the provided string is not an alias, return the username of the provided alias
208
+ *
209
+ * This method is helpful when you don't know if the string you have is a username
210
+ * or an alias.
211
+ *
212
+ * @param usernameOrAlias a string that might be a username or might be an alias
213
+ */
214
+ resolveAlias(usernameOrAlias) {
215
+ var _a;
216
+ if (this.has(usernameOrAlias))
217
+ return usernameOrAlias;
218
+ return (_a = Object.entries(this.getAll()).find(([, username]) => username === usernameOrAlias)) === null || _a === void 0 ? void 0 : _a[0];
219
+ }
205
220
  /**
206
221
  * Set an alias for the given aliasable entity
207
222
  *
@@ -211,11 +226,15 @@ class AliasAccessor extends kit_1.AsyncOptionalCreatable {
211
226
  set(alias, entity) {
212
227
  this.config.set(alias, this.getNameOf(entity));
213
228
  }
229
+ /**
230
+ * Unset the given alias.
231
+ *
232
+ */
214
233
  unset(alias) {
215
234
  this.config.unset(alias);
216
235
  }
217
236
  /**
218
- * This method unsets all the aliases for the given entity.
237
+ * Unsets all the aliases for the given entity.
219
238
  *
220
239
  * @param entity the aliasable entity for which you want to unset all aliases
221
240
  */
@@ -226,6 +245,14 @@ class AliasAccessor extends kit_1.AsyncOptionalCreatable {
226
245
  async write() {
227
246
  return this.config.write();
228
247
  }
248
+ /**
249
+ * Returns true if the provided alias exists
250
+ *
251
+ * @param alias the alias you want to check
252
+ */
253
+ has(alias) {
254
+ return this.config.has(alias);
255
+ }
229
256
  async init() {
230
257
  this.config = await aliasesConfig_1.AliasesConfig.create(aliasesConfig_1.AliasesConfig.getDefaultOptions());
231
258
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforce/core",
3
- "version": "3.23.2",
3
+ "version": "3.23.5",
4
4
  "description": "Core libraries to interact with SFDX projects, orgs, and APIs.",
5
5
  "main": "lib/exported",
6
6
  "types": "lib/exported.d.ts",