npm package diff
Package: @forge/cli-shared
Versions: 6.6.1-next.15 - 6.6.1-next.16
Modified: package/out/graphql/graphql-types.js
Large diffs are not rendered by default.
Modified: package/out/service/supported-products-service.js
Index: package/out/service/supported-products-service.js
===================================================================
--- package/out/service/supported-products-service.js
+++ package/out/service/supported-products-service.js
@@ -67,31 +67,46 @@
return definitionsForEnabledProducts.map((pd) => {
return new SupportedProductEntry(pd.name, pd.productType, pd.special?.supportedByCrossProductApps ?? false);
});
}
-class SupportedProductsService {
- supportedProducts;
- constructor(supportedProducts) {
- this.supportedProducts = supportedProducts;
+class SupportedProductEntriesHolder {
+ value;
+ constructor(value) {
+ this.value = value;
}
- async initializeWithSupportedProducts(statsigService) {
- if (this.supportedProducts) {
- throw new Error('SupportedProductsService is already initialized');
+ async initialize(valueProvider) {
+ if (this.value) {
+ throw new Error('SupportedProductsService was already initialized - is initialization called multiple times?');
}
- this.supportedProducts = await resolveEnabledProducts(statsigService);
+ this.value = await valueProvider();
}
- getSupportedProductsNames(filter = () => true) {
- if (!this.supportedProducts) {
- throw new Error('SupportedProductsService is not initialized, are you calling it from some constructor?');
+ get() {
+ if (!this.value) {
+ throw new Error('SupportedProductsService is not initialized - are you calling it from some constructor?');
}
- return this.supportedProducts.filter((p) => filter(p)).map((p) => p.productName);
+ return this.value;
}
+}
+class SupportedProductsService {
+ supportedProductEntriesHolder;
+ constructor(supportedProductEntries) {
+ this.supportedProductEntriesHolder = new SupportedProductEntriesHolder(supportedProductEntries);
+ }
+ async initializeWithSupportedProducts(statsigService) {
+ await this.supportedProductEntriesHolder.initialize(async () => await resolveEnabledProducts(statsigService));
+ }
+ getFilteredSupportedProducts(filter) {
+ return this.supportedProductEntriesHolder
+ .get()
+ .filter((p) => filter(p))
+ .map((p) => p.productName);
+ }
getSupportedProducts() {
- return this.getSupportedProductsNames();
+ return this.supportedProductEntriesHolder.get().map((p) => p.productName);
}
getSupportedSecondaryProductsForXPA(requiredProducts) {
const requiredProductsNames = requiredProducts.map((p) => (0, shared_1.productDisplayName)(p));
- return this.getSupportedProductsNames((p) => p.supportedByCrossProductApps && !requiredProductsNames.includes(p.productName));
+ return this.getFilteredSupportedProducts((p) => p.supportedByCrossProductApps && !requiredProductsNames.includes(p.productName));
}
validateSupportedProduct(productNameInput) {
const productName = (0, shared_1.productDisplayName)(productNameInput);
const supportedProducts = this.getSupportedProducts();
@@ -102,9 +117,9 @@
throw new shared_1.ValidationError(ui_1.Text.error.invalidProduct);
}
}
isWorkspaceProduct(product) {
- return this.getSupportedProductsNames((p) => p.productType === 'workspace').includes((0, shared_1.productDisplayName)(product));
+ return this.getFilteredSupportedProducts((p) => p.productType === 'workspace').includes((0, shared_1.productDisplayName)(product));
}
validateSite(site, product) {
const trySites = [site, `https://${site}`];
for (const trySite of trySites) {
Modified: package/package.json
Index: package/package.json
===================================================================
--- package/package.json
+++ package/package.json
@@ -1,7 +1,7 @@
{
"name": "@forge/cli-shared",
- "version": "6.6.1-next.15",
+ "version": "6.6.1-next.16",
"description": "Common functionality for Forge CLI",
"author": "Atlassian",
"license": "SEE LICENSE IN LICENSE.txt",
"main": "out/index.js",
Modified: package/out/graphql/graphql-types.d.ts.map
Large diffs are not rendered by default.
Modified: package/out/service/supported-products-service.d.ts.map
Index: package/out/service/supported-products-service.d.ts.map
===================================================================
--- package/out/service/supported-products-service.d.ts.map
+++ package/out/service/supported-products-service.d.ts.map
@@ -1,1 +1,1 @@
-{"version":3,"file":"supported-products-service.d.ts","sourceRoot":"","sources":["../../src/service/supported-products-service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,EAAE,kBAAkB,EAAuC,MAAM,WAAW,CAAC;AAKpF,oBAAY,gBAAgB,GAAG,MAAM,GAAG,YAAY,GAAG,SAAS,GAAG,gBAAgB,GAAG,OAAO,GAAG,WAAW,CAAC;AA8C5G,aAAK,WAAW,GAAG,OAAO,GAAG,WAAW,CAAC;AAEzC,oBAAY,iBAAiB,GAAG;IAC9B,IAAI,EAAE,gBAAgB,CAAC;IACvB,WAAW,EAAE,WAAW,CAAC;IACzB,OAAO,CAAC,EAAE;QACR,2BAA2B,CAAC,EAAE,OAAO,CAAC;QACtC,sBAAsB,CAAC,EAAE,CAAC,cAAc,EAAE,cAAc,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;KAC/E,CAAC;CACH,CAAC;AAEF,cAAM,qBAAqB;IAEhB,WAAW,EAAE,gBAAgB;IAC7B,WAAW,EAAE,WAAW;IACxB,2BAA2B,EAAE,OAAO;gBAFpC,WAAW,EAAE,gBAAgB,EAC7B,WAAW,EAAE,WAAW,EACxB,2BAA2B,EAAE,OAAO;CAE9C;AAED,iBAAe,sBAAsB,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC,qBAAqB,EAAE,CAAC,CAgBtG;AAED,qBAAa,wBAAwB;IAKvB,OAAO,CAAC,iBAAiB,CAAC;gBAAlB,iBAAiB,CAAC,qCAAyB;IAElD,+BAA+B,CAAC,cAAc,EAAE,cAAc;IAS3E,OAAO,CAAC,yBAAyB;IAS1B,oBAAoB,IAAI,gBAAgB,EAAE;IAI1C,mCAAmC,CAAC,gBAAgB,EAAE,MAAM,EAAE,GAAG,gBAAgB,EAAE;IAOnF,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,GAAG,gBAAgB;IAWpE,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;IAO5C,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,SAAS,GAAG,GAAG;CAqBhF;AAID,eAAO,MAAM,kBAAkB,YAAa,MAAM,KAAG,OAEpD,CAAC;AAGF,eAAO,MAAM,iBAAiB;;CAE7B,CAAC"}
\ No newline at end of file
+{"version":3,"file":"supported-products-service.d.ts","sourceRoot":"","sources":["../../src/service/supported-products-service.ts"],"names":[],"mappings":";AAAA,OAAO,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AAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,SAAS,GAAG,GAAG;CAqBhF;AAID,eAAO,MAAM,kBAAkB,YAAa,MAAM,KAAG,OAEpD,CAAC;AAGF,eAAO,MAAM,iBAAiB;;CAE7B,CAAC"}
\ No newline at end of file
Modified: package/CHANGELOG.md
Large diffs are not rendered by default.
Modified: package/out/graphql/graphql-types.d.ts
Large diffs are not rendered by default.
Modified: package/out/service/supported-products-service.d.ts
Index: package/out/service/supported-products-service.d.ts
===================================================================
--- package/out/service/supported-products-service.d.ts
+++ package/out/service/supported-products-service.d.ts
@@ -19,12 +19,12 @@
constructor(productName: SupportedProduct, productType: ProductType, supportedByCrossProductApps: boolean);
}
declare function resolveEnabledProducts(statsigService: StatsigService): Promise<SupportedProductEntry[]>;
export declare class SupportedProductsService {
- private supportedProducts?;
- constructor(supportedProducts?: SupportedProductEntry[] | undefined);
+ private supportedProductEntriesHolder;
+ constructor(supportedProductEntries?: SupportedProductEntry[]);
initializeWithSupportedProducts(statsigService: StatsigService): Promise<void>;
- private getSupportedProductsNames;
+ private getFilteredSupportedProducts;
getSupportedProducts(): SupportedProduct[];
getSupportedSecondaryProductsForXPA(requiredProducts: string[]): SupportedProduct[];
validateSupportedProduct(productNameInput: string): SupportedProduct;
isWorkspaceProduct(product: string): boolean;