@forge/cli-shared 6.6.0-next.7 → 6.6.0-next.8

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
@@ -1,5 +1,11 @@
1
1
  # @forge/cli-shared
2
2
 
3
+ ## 6.6.0-next.8
4
+
5
+ ### Minor Changes
6
+
7
+ - 1a76049: Added support for Teamwork Graph.
8
+
3
9
  ## 6.6.0-next.7
4
10
 
5
11
  ### Patch Changes
package/out/ari/ari.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { Ari, AnyAri, JiraWorkspaceAri, ConfluenceWorkspaceAri, CompassWorkspaceAri } from '@forge/util/packages/ari';
1
+ import { Ari, AnyAri, JiraWorkspaceAri, ConfluenceWorkspaceAri, CompassWorkspaceAri, GraphWorkspaceAri } from '@forge/util/packages/ari';
2
2
  export declare const SITE_RESOURCE_TYPE = "site";
3
3
  export declare const WORKSPACE_RESOURCE_TYPE = "workspace";
4
4
  export declare const TRELLO_RESOURCE_OWNER = "trello";
@@ -10,19 +10,14 @@ export declare function encodeContext(context: Ari, extension: Ari): string;
10
10
  export declare class UnknownSiteWithoutResourceIdError extends Error {
11
11
  constructor();
12
12
  }
13
- export declare class UnknownWorkspaceWithoutCloudIdError extends Error {
13
+ export declare class UnknownWorkspaceWithoutResourceIdError extends Error {
14
14
  constructor();
15
15
  }
16
- export declare class UnknownBBWorkspaceWithoutResourceIdError extends Error {
17
- constructor();
18
- }
19
- export interface EnrichedAri extends AnyAri {
20
- derivedCloudId: string;
21
- }
22
- export declare function parseInstallationContext(installationContext: string): EnrichedAri;
16
+ export declare function parseInstallationContext(installationContext: string): AnyAri;
23
17
  export declare const createWorkspaceAriByProduct: {
24
18
  jira: (siteId: string, activationId: string) => JiraWorkspaceAri;
25
19
  confluence: (siteId: string, activationId: string) => ConfluenceWorkspaceAri;
26
20
  compass: (siteId: string, workspaceId: string) => CompassWorkspaceAri;
21
+ graph: (_siteId: string, activationId: string) => GraphWorkspaceAri;
27
22
  };
28
23
  //# sourceMappingURL=ari.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ari.d.ts","sourceRoot":"","sources":["../../src/ari/ari.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAItH,eAAO,MAAM,kBAAkB,SAAS,CAAC;AACzC,eAAO,MAAM,uBAAuB,cAAc,CAAC;AACnD,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,wBAAwB,cAAc,CAAC;AAEpD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAID,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,GAAG,CAMrE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,GAAG,CAMhG;AAGD,wBAAgB,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,MAAM,CAKlE;AACD,qBAAa,iCAAkC,SAAQ,KAAK;;CAI3D;AACD,qBAAa,mCAAoC,SAAQ,KAAK;;CAI7D;AAED,qBAAa,wCAAyC,SAAQ,KAAK;;CAIlE;AASD,MAAM,WAAW,WAAY,SAAQ,MAAM;IACzC,cAAc,EAAE,MAAM,CAAC;CACxB;AACD,wBAAgB,wBAAwB,CAAC,mBAAmB,EAAE,MAAM,GAAG,WAAW,CAyBjF;AAED,eAAO,MAAM,2BAA2B;mBACvB,MAAM,gBAAgB,MAAM;yBACtB,MAAM,gBAAgB,MAAM;sBAC/B,MAAM,eAAe,MAAM;CAC9C,CAAC"}
1
+ {"version":3,"file":"ari.d.ts","sourceRoot":"","sources":["../../src/ari/ari.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,EACH,MAAM,EACN,gBAAgB,EAChB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,0BAA0B,CAAC;AAIlC,eAAO,MAAM,kBAAkB,SAAS,CAAC;AACzC,eAAO,MAAM,uBAAuB,cAAc,CAAC;AACnD,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,wBAAwB,cAAc,CAAC;AAEpD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEtD;AAID,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,GAAG,CAMrE;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,GAAG,CAMhG;AAGD,wBAAgB,aAAa,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,GAAG,GAAG,MAAM,CAKlE;AACD,qBAAa,iCAAkC,SAAQ,KAAK;;CAI3D;AACD,qBAAa,sCAAuC,SAAQ,KAAK;;CAIhE;AASD,wBAAgB,wBAAwB,CAAC,mBAAmB,EAAE,MAAM,GAAG,MAAM,CAoB5E;AAGD,eAAO,MAAM,2BAA2B;mBACvB,MAAM,gBAAgB,MAAM;yBACtB,MAAM,gBAAgB,MAAM;sBAC/B,MAAM,eAAe,MAAM;qBAC5B,MAAM,gBAAgB,MAAM;CAC9C,CAAC"}
package/out/ari/ari.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createWorkspaceAriByProduct = exports.parseInstallationContext = exports.UnknownBBWorkspaceWithoutResourceIdError = exports.UnknownWorkspaceWithoutCloudIdError = exports.UnknownSiteWithoutResourceIdError = exports.encodeContext = exports.buildExtensionAri = exports.buildContextAri = exports.appIdToAriString = exports.BITBUCKET_RESOURCE_OWNER = exports.TRELLO_RESOURCE_OWNER = exports.WORKSPACE_RESOURCE_TYPE = exports.SITE_RESOURCE_TYPE = void 0;
3
+ exports.createWorkspaceAriByProduct = exports.parseInstallationContext = exports.UnknownWorkspaceWithoutResourceIdError = exports.UnknownSiteWithoutResourceIdError = exports.encodeContext = exports.buildExtensionAri = exports.buildContextAri = exports.appIdToAriString = exports.BITBUCKET_RESOURCE_OWNER = exports.TRELLO_RESOURCE_OWNER = exports.WORKSPACE_RESOURCE_TYPE = exports.SITE_RESOURCE_TYPE = void 0;
4
4
  const ari_1 = require("@forge/util/packages/ari");
5
5
  const shared_1 = require("../shared");
6
6
  const ui_1 = require("../ui");
@@ -39,18 +39,12 @@ class UnknownSiteWithoutResourceIdError extends Error {
39
39
  }
40
40
  }
41
41
  exports.UnknownSiteWithoutResourceIdError = UnknownSiteWithoutResourceIdError;
42
- class UnknownWorkspaceWithoutCloudIdError extends Error {
42
+ class UnknownWorkspaceWithoutResourceIdError extends Error {
43
43
  constructor() {
44
- super(ui_1.Text.installList.noCloudId);
44
+ super(ui_1.Text.installList.noResourceIdInWorkspace);
45
45
  }
46
46
  }
47
- exports.UnknownWorkspaceWithoutCloudIdError = UnknownWorkspaceWithoutCloudIdError;
48
- class UnknownBBWorkspaceWithoutResourceIdError extends Error {
49
- constructor() {
50
- super(ui_1.Text.installList.bbNoResourceId);
51
- }
52
- }
53
- exports.UnknownBBWorkspaceWithoutResourceIdError = UnknownBBWorkspaceWithoutResourceIdError;
47
+ exports.UnknownWorkspaceWithoutResourceIdError = UnknownWorkspaceWithoutResourceIdError;
54
48
  function parseInstallationContext(installationContext) {
55
49
  const context = ari_1.AnyAri.parse(installationContext);
56
50
  switch (context.resourceType) {
@@ -58,20 +52,11 @@ function parseInstallationContext(installationContext) {
58
52
  if (!context.resourceId) {
59
53
  throw new UnknownSiteWithoutResourceIdError();
60
54
  }
61
- context.derivedCloudId = context.resourceId;
62
55
  break;
63
56
  case exports.WORKSPACE_RESOURCE_TYPE:
64
- if (context.resourceOwner === exports.BITBUCKET_RESOURCE_OWNER) {
65
- if (!context.resourceId) {
66
- throw new UnknownBBWorkspaceWithoutResourceIdError();
67
- }
68
- context.derivedCloudId = context.resourceId;
69
- break;
70
- }
71
- else if (!context.cloudId) {
72
- throw new UnknownWorkspaceWithoutCloudIdError();
57
+ if (!context.resourceId) {
58
+ throw new UnknownWorkspaceWithoutResourceIdError();
73
59
  }
74
- context.derivedCloudId = context.cloudId;
75
60
  break;
76
61
  default:
77
62
  throw new Error('Unknown resource type');
@@ -82,5 +67,6 @@ exports.parseInstallationContext = parseInstallationContext;
82
67
  exports.createWorkspaceAriByProduct = {
83
68
  jira: (siteId, activationId) => ari_1.JiraWorkspaceAri.create({ siteId, activationId }),
84
69
  confluence: (siteId, activationId) => ari_1.ConfluenceWorkspaceAri.create({ siteId, activationId }),
85
- compass: (siteId, workspaceId) => ari_1.CompassWorkspaceAri.create({ siteId, workspaceId })
70
+ compass: (siteId, workspaceId) => ari_1.CompassWorkspaceAri.create({ siteId, workspaceId }),
71
+ graph: (_siteId, activationId) => ari_1.GraphWorkspaceAri.create({ workspaceId: activationId })
86
72
  };
@@ -3,4 +3,5 @@ export * from './iframe-resizer-script-service';
3
3
  export * from './feature-flag-service';
4
4
  export * from './i18n-resource-bundling-service';
5
5
  export * from './statsig-service';
6
+ export * from './supported-products-service';
6
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAEA,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,mBAAmB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAEA,cAAc,yBAAyB,CAAC;AACxC,cAAc,iCAAiC,CAAC;AAChD,cAAc,wBAAwB,CAAC;AACvC,cAAc,kCAAkC,CAAC;AACjD,cAAc,mBAAmB,CAAC;AAClC,cAAc,8BAA8B,CAAC"}
@@ -6,3 +6,4 @@ tslib_1.__exportStar(require("./iframe-resizer-script-service"), exports);
6
6
  tslib_1.__exportStar(require("./feature-flag-service"), exports);
7
7
  tslib_1.__exportStar(require("./i18n-resource-bundling-service"), exports);
8
8
  tslib_1.__exportStar(require("./statsig-service"), exports);
9
+ tslib_1.__exportStar(require("./supported-products-service"), exports);
@@ -1,5 +1,5 @@
1
1
  import { CLIDetails, ConfigSectionReader, CredentialGetter, getEnvironmentConfig, Logger } from '../index';
2
- export declare type FeatureGate = 'forge-cli-test-gate' | 'is-logs-v-2-api-enabled' | 'forge-cli-bundle-runtime-loader' | 'forge-cli-enable-atlas-product-support' | 'forge-cli-enable-xpa-installation';
2
+ export declare type FeatureGate = 'forge-cli-test-gate' | 'is-logs-v-2-api-enabled' | 'forge-cli-bundle-runtime-loader' | 'forge-cli-enable-atlas-product-support' | 'forge-cli-enable-teamwork-graph-product-support' | 'forge-cli-enable-xpa-installation';
3
3
  export declare type DynamicConfig = {
4
4
  'forge-cli-test-dynamic-configs': {
5
5
  value: string[];
@@ -13,6 +13,7 @@ export declare abstract class StatsigReader {
13
13
  getForgeCliTestDynamicConfig(): Promise<any>;
14
14
  isLogsV2ApiEnabled(): Promise<boolean>;
15
15
  isAtlasProductSupported(): Promise<boolean>;
16
+ isTeamworkGraphProductSupported(): Promise<boolean>;
16
17
  testForgeCliBundleRuntimeLoaderGate(): Promise<boolean>;
17
18
  enableCrossProductAppInstallation(): Promise<boolean>;
18
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"statsig-service.d.ts","sourceRoot":"","sources":["../../src/service/statsig-service.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,gBAAgB,EAChB,oBAAoB,EAEpB,MAAM,EACP,MAAM,UAAU,CAAC;AAElB,oBAAY,WAAW,GACnB,qBAAqB,GACrB,yBAAyB,GACzB,iCA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eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,eAAe;IAChC,OAAO,CAAC,QAAQ,CAAC,gBAAgB;gBAJhB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,IAAI,CAAC,UAAU,EAAE,SAAS,CAAC,GAAG,SAAS,EACnD,eAAe,EAAE,gBAAgB,EACjC,eAAe,EAAE,mBAAmB,CAAC;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,EACpD,gBAAgB,GAAE,OAAO,oBAA2C;IAKvF,OAAO,CAAC,KAAK,CAOV;IAEH,OAAO,CAAC,OAAO,CAkBb;IAEF,OAAO,CAAC,UAAU,CA+BhB;IAEF,OAAO,CAAC,mBAAmB,CA+BzB;IAEF,OAAO,CAAC,WAAW,CAGhB;IAEH,OAAO,CAAC,mBAAmB,CAGxB;IAEG,SAAS,CAAC,CAAC,SAAS,WAAW,EACnC,IAAI,EAAE,CAAC,EACP,gBAAgB,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GAC5C,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;IAcpB,gBAAgB,CAAC,CAAC,SAAS,gBAAgB,EAC/C,aAAa,EAAE,CAAC,EAChB,QAAQ,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACpC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;CAapC"}
@@ -15,6 +15,9 @@ class StatsigReader {
15
15
  async isAtlasProductSupported() {
16
16
  return (await this.checkGate('forge-cli-enable-atlas-product-support')) ?? false;
17
17
  }
18
+ async isTeamworkGraphProductSupported() {
19
+ return (await this.checkGate('forge-cli-enable-teamwork-graph-product-support')) ?? false;
20
+ }
18
21
  async testForgeCliBundleRuntimeLoaderGate() {
19
22
  return (await this.checkGate('forge-cli-bundle-runtime-loader')) ?? false;
20
23
  }
@@ -0,0 +1,28 @@
1
+ /// <reference types="node" />
2
+ import { StatsigService } from './statsig-service';
3
+ import { URL } from 'url';
4
+ import { ProductDisplayName } from '../shared';
5
+ declare const SUPPORTED_PRODUCTS_ALL: readonly ["Jira", "Confluence", "Compass", "Teamwork Graph", "Atlas", "Bitbucket"];
6
+ export declare const TEST_ONLY_EXPORTS: {
7
+ SITED_PRODUCTS_ALL: readonly ["Jira", "Confluence", "Compass", "Teamwork Graph", "Atlas"];
8
+ WORKSPACE_PRODUCTS_ALL: readonly ["Bitbucket"];
9
+ SUPPORTED_PRODUCTS_ALWAYS_ENABLED: readonly ["Jira", "Confluence", "Compass", "Bitbucket"];
10
+ };
11
+ export declare type SupportedProduct = (typeof SUPPORTED_PRODUCTS_ALL)[number] & ProductDisplayName;
12
+ export declare class SupportedProductsService {
13
+ private readonly statsigService;
14
+ private featureGatedProductsCache;
15
+ constructor(statsigService: StatsigService);
16
+ private buildFeatureGatedProduct;
17
+ private getFeatureGatedProducts;
18
+ private getProductsEnabledByFeatureGate;
19
+ private ensureProductDisplayName;
20
+ getSupportedProducts(): Promise<SupportedProduct[]>;
21
+ private getSupportedWorkspaceProducts;
22
+ validateSupportedProduct(productNameInput: string): Promise<SupportedProduct>;
23
+ isWorkspaceProduct(product: string): Promise<boolean>;
24
+ validateSite(site: string, product: ProductDisplayName | undefined): Promise<URL>;
25
+ }
26
+ export declare const isBitbucketProduct: (product: string) => boolean;
27
+ export {};
28
+ //# sourceMappingURL=supported-products-service.d.ts.map
@@ -0,0 +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;AAgCpF,QAAA,MAAM,sBAAsB,oFAA8D,CAAC;AAO3F,eAAO,MAAM,iBAAiB;;;;CAI7B,CAAC;AAGF,oBAAY,gBAAgB,GAAG,CAAC,OAAO,sBAAsB,CAAC,CAAC,MAAM,CAAC,GAAG,kBAAkB,CAAC;AAa5F,qBAAa,wBAAwB;IAGvB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAF3C,OAAO,CAAC,yBAAyB,CAAsC;gBAE1C,cAAc,EAAE,cAAc;YAE7C,wBAAwB;YAYxB,uBAAuB;YAUvB,+BAA+B;IAS7C,OAAO,CAAC,wBAAwB;IAWnB,oBAAoB,IAAI,OAAO,CAAC,gBAAgB,EAAE,CAAC;YAQlD,6BAA6B;IAO9B,wBAAwB,CAAC,gBAAgB,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAW7E,kBAAkB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC;IAIrD,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,kBAAkB,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG,CAAC;CAmB/F;AAID,eAAO,MAAM,kBAAkB,YAAa,MAAM,KAAG,OAEpD,CAAC"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isBitbucketProduct = exports.SupportedProductsService = exports.TEST_ONLY_EXPORTS = void 0;
4
+ const url_1 = require("url");
5
+ const shared_1 = require("../shared");
6
+ const ui_1 = require("../ui");
7
+ const SITED_PRODUCTS_ALWAYS_ENABLED = ['Jira', 'Confluence', 'Compass'];
8
+ const SITED_PRODUCTS_UNDER_FEATURE_FLAG = ['Teamwork Graph', 'Atlas'];
9
+ const WORKSPACE_PRODUCTS_ALWAYS_ENABLED = ['Bitbucket'];
10
+ const WORKSPACE_PRODUCTS_UNDER_FEATURE_FLAG = [];
11
+ const SITED_PRODUCTS_ALL = [...SITED_PRODUCTS_ALWAYS_ENABLED, ...SITED_PRODUCTS_UNDER_FEATURE_FLAG];
12
+ const WORKSPACE_PRODUCTS_ALL = [
13
+ ...WORKSPACE_PRODUCTS_ALWAYS_ENABLED,
14
+ ...WORKSPACE_PRODUCTS_UNDER_FEATURE_FLAG
15
+ ];
16
+ const SUPPORTED_PRODUCTS_ALWAYS_ENABLED = [
17
+ ...SITED_PRODUCTS_ALWAYS_ENABLED,
18
+ ...WORKSPACE_PRODUCTS_ALWAYS_ENABLED
19
+ ];
20
+ const SUPPORTED_PRODUCTS_ALL = [...SITED_PRODUCTS_ALL, ...WORKSPACE_PRODUCTS_ALL];
21
+ exports.TEST_ONLY_EXPORTS = {
22
+ SITED_PRODUCTS_ALL,
23
+ WORKSPACE_PRODUCTS_ALL,
24
+ SUPPORTED_PRODUCTS_ALWAYS_ENABLED
25
+ };
26
+ function arrayContains(arr, e) {
27
+ return arr.includes(e);
28
+ }
29
+ class SupportedProductsService {
30
+ statsigService;
31
+ featureGatedProductsCache = null;
32
+ constructor(statsigService) {
33
+ this.statsigService = statsigService;
34
+ }
35
+ async buildFeatureGatedProduct(productName, productType, isEnabledPromise) {
36
+ return {
37
+ productName,
38
+ productType,
39
+ isEnabled: await isEnabledPromise
40
+ };
41
+ }
42
+ async getFeatureGatedProducts() {
43
+ if (this.featureGatedProductsCache === null) {
44
+ this.featureGatedProductsCache = await Promise.all([
45
+ this.buildFeatureGatedProduct('Teamwork Graph', 'sited', this.statsigService.isTeamworkGraphProductSupported()),
46
+ this.buildFeatureGatedProduct('Atlas', 'sited', this.statsigService.isAtlasProductSupported())
47
+ ]);
48
+ }
49
+ return this.featureGatedProductsCache;
50
+ }
51
+ async getProductsEnabledByFeatureGate(filter = () => true) {
52
+ const featureGatedProducts = await this.getFeatureGatedProducts();
53
+ return featureGatedProducts
54
+ .filter((gatedProductInfo) => gatedProductInfo.isEnabled && filter(gatedProductInfo))
55
+ .map((product) => product.productName);
56
+ }
57
+ ensureProductDisplayName(product) {
58
+ if (arrayContains(SUPPORTED_PRODUCTS_ALL, product)) {
59
+ return product;
60
+ }
61
+ else {
62
+ return (0, shared_1.productDisplayName)(product);
63
+ }
64
+ }
65
+ async getSupportedProducts() {
66
+ return [
67
+ ...SITED_PRODUCTS_ALWAYS_ENABLED,
68
+ ...WORKSPACE_PRODUCTS_ALWAYS_ENABLED,
69
+ ...(await this.getProductsEnabledByFeatureGate())
70
+ ];
71
+ }
72
+ async getSupportedWorkspaceProducts() {
73
+ return [
74
+ ...WORKSPACE_PRODUCTS_ALWAYS_ENABLED,
75
+ ...(await this.getProductsEnabledByFeatureGate((product) => product.productType == 'workspace'))
76
+ ];
77
+ }
78
+ async validateSupportedProduct(productNameInput) {
79
+ const productName = (0, shared_1.productDisplayName)(productNameInput);
80
+ const supportedProducts = await this.getSupportedProducts();
81
+ if (arrayContains(supportedProducts, productName)) {
82
+ return productName;
83
+ }
84
+ else {
85
+ throw new shared_1.ValidationError(ui_1.Text.error.invalidProduct);
86
+ }
87
+ }
88
+ async isWorkspaceProduct(product) {
89
+ return arrayContains(await this.getSupportedWorkspaceProducts(), this.ensureProductDisplayName(product));
90
+ }
91
+ async validateSite(site, product) {
92
+ const trySites = [site, `https://${site}`];
93
+ for (const trySite of trySites) {
94
+ try {
95
+ const urlObj = new url_1.URL(trySite);
96
+ if (product && (await this.isWorkspaceProduct(product))) {
97
+ return urlObj;
98
+ }
99
+ urlObj.pathname = '/';
100
+ return urlObj;
101
+ }
102
+ catch {
103
+ }
104
+ }
105
+ throw new shared_1.ValidationError(ui_1.Text.error.invalidSite);
106
+ }
107
+ }
108
+ exports.SupportedProductsService = SupportedProductsService;
109
+ const isBitbucketProduct = (product) => {
110
+ return (0, shared_1.productDisplayName)(product) === 'Bitbucket';
111
+ };
112
+ exports.isBitbucketProduct = isBitbucketProduct;
@@ -4,7 +4,6 @@ export * from './error-handling';
4
4
  export * from './mock-logger';
5
5
  export * from './pause';
6
6
  export * from './product';
7
- export * from './validate';
8
7
  export * from './read-app-config-files';
9
8
  export * from './cli-details';
10
9
  export * from './assertUnreachable';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAEA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AAEpC,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,QAAA,MAAM,IAAI,0BAAqD,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/shared/index.ts"],"names":[],"mappings":"AAEA,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,yBAAyB,CAAC;AACxC,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AAEpC,OAAO,OAAO,MAAM,yBAAyB,CAAC;AAC9C,QAAA,MAAM,IAAI,0BAAqD,CAAC;AAChE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC"}
@@ -8,7 +8,6 @@ tslib_1.__exportStar(require("./error-handling"), exports);
8
8
  tslib_1.__exportStar(require("./mock-logger"), exports);
9
9
  tslib_1.__exportStar(require("./pause"), exports);
10
10
  tslib_1.__exportStar(require("./product"), exports);
11
- tslib_1.__exportStar(require("./validate"), exports);
12
11
  tslib_1.__exportStar(require("./read-app-config-files"), exports);
13
12
  tslib_1.__exportStar(require("./cli-details"), exports);
14
13
  tslib_1.__exportStar(require("./assertUnreachable"), exports);
@@ -1,13 +1,4 @@
1
- declare const SUPPORTED_PRODUCTS: readonly ["Jira", "Confluence", "Compass"];
2
- export declare const WORKSPACE_PRODUCTS: readonly ["Bitbucket"];
3
- export declare type SupportedProduct = (typeof SUPPORTED_PRODUCTS)[number] | (typeof WORKSPACE_PRODUCTS)[number];
4
- export declare function getSupportedProducts({ enableAtlas }?: {
5
- enableAtlas?: boolean;
6
- }): (SupportedProduct | "Atlas")[];
7
- export declare function productDisplayName(ariResourceOwner: string): string;
1
+ export declare type ProductDisplayName = string;
2
+ export declare function productDisplayName(ariResourceOwnerOrUserProvidedProductName: string): ProductDisplayName;
8
3
  export declare function ariResourceOwner(productDisplayName: string): string;
9
- export declare const isWorkspaceProduct: (product: string) => product is "Bitbucket";
10
- export declare const isBitbucketProduct: (product: string) => boolean;
11
- export declare const isSupportedProduct: (product: string) => product is SupportedProduct;
12
- export {};
13
4
  //# sourceMappingURL=product.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../src/shared/product.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,kBAAkB,4CAA6C,CAAC;AACtE,eAAO,MAAM,kBAAkB,wBAAyB,CAAC;AACzD,oBAAY,gBAAgB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAUzG,wBAAgB,oBAAoB,CAAC,EAAE,WAAmB,EAAE,GAAE;IAAE,WAAW,CAAC,EAAE,OAAO,CAAA;CAAO,kCAQ3F;AAED,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,wBAAgB,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED,eAAO,MAAM,kBAAkB,YAAa,MAAM,2BAEjD,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAAa,MAAM,KAAG,OAEpD,CAAC;AAEF,eAAO,MAAM,kBAAkB,YAAa,MAAM,gCAEjD,CAAC"}
1
+ {"version":3,"file":"product.d.ts","sourceRoot":"","sources":["../../src/shared/product.ts"],"names":[],"mappings":"AAeA,oBAAY,kBAAkB,GAAG,MAAM,CAAC;AAiBxC,wBAAgB,kBAAkB,CAAC,yCAAyC,EAAE,MAAM,GAAG,kBAAkB,CAGxG;AAED,wBAAgB,gBAAgB,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,CAEnE"}
@@ -1,43 +1,21 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSupportedProduct = exports.isBitbucketProduct = exports.isWorkspaceProduct = exports.ariResourceOwner = exports.productDisplayName = exports.getSupportedProducts = exports.WORKSPACE_PRODUCTS = void 0;
3
+ exports.ariResourceOwner = exports.productDisplayName = void 0;
4
4
  const case_1 = require("case");
5
- const SUPPORTED_PRODUCTS = ['Jira', 'Confluence', 'Compass'];
6
- exports.WORKSPACE_PRODUCTS = ['Bitbucket'];
7
- const PRODUCT_ARI_MAPPING = {
8
- Atlas: 'townsquare'
5
+ const RESOURCE_OWNER_TO_PRODUCT_DISPLAY_NAME = {
6
+ townsquare: 'Atlas',
7
+ graph: 'Teamwork Graph'
9
8
  };
10
- const PRODUCT_DISPLAY_NAME_MAPPING = {
11
- townsquare: 'Atlas'
12
- };
13
- function getSupportedProducts({ enableAtlas = false } = {}) {
14
- const result = [...SUPPORTED_PRODUCTS, ...exports.WORKSPACE_PRODUCTS];
15
- if (enableAtlas) {
16
- result.push('Atlas');
17
- }
18
- return result;
19
- }
20
- exports.getSupportedProducts = getSupportedProducts;
21
- function productDisplayName(ariResourceOwner) {
22
- return PRODUCT_DISPLAY_NAME_MAPPING[ariResourceOwner] ?? (0, case_1.capital)(ariResourceOwner);
9
+ const PRODUCT_DISPLAY_NAME_TO_RESOURCE_OWNER = Object.entries(RESOURCE_OWNER_TO_PRODUCT_DISPLAY_NAME).reduce((acc, [key, value]) => {
10
+ acc[value] = key;
11
+ return acc;
12
+ }, {});
13
+ function productDisplayName(ariResourceOwnerOrUserProvidedProductName) {
14
+ const resourceOwner = ariResourceOwnerOrUserProvidedProductName.toLowerCase();
15
+ return RESOURCE_OWNER_TO_PRODUCT_DISPLAY_NAME[resourceOwner] ?? (0, case_1.capital)(ariResourceOwnerOrUserProvidedProductName);
23
16
  }
24
17
  exports.productDisplayName = productDisplayName;
25
18
  function ariResourceOwner(productDisplayName) {
26
- return PRODUCT_ARI_MAPPING[productDisplayName] ?? productDisplayName.toLowerCase();
19
+ return PRODUCT_DISPLAY_NAME_TO_RESOURCE_OWNER[productDisplayName] ?? productDisplayName.toLowerCase();
27
20
  }
28
21
  exports.ariResourceOwner = ariResourceOwner;
29
- const isWorkspaceProduct = (product) => {
30
- return isSupported(exports.WORKSPACE_PRODUCTS, productDisplayName(product));
31
- };
32
- exports.isWorkspaceProduct = isWorkspaceProduct;
33
- const isBitbucketProduct = (product) => {
34
- return productDisplayName(product) === 'Bitbucket';
35
- };
36
- exports.isBitbucketProduct = isBitbucketProduct;
37
- const isSupportedProduct = (product) => {
38
- return isSupported(SUPPORTED_PRODUCTS, productDisplayName(product)) || (0, exports.isWorkspaceProduct)(product);
39
- };
40
- exports.isSupportedProduct = isSupportedProduct;
41
- function isSupported(arr, e) {
42
- return arr.includes(e);
43
- }
package/out/ui/text.d.ts CHANGED
@@ -668,7 +668,7 @@ export declare const Text: {
668
668
  banner: string;
669
669
  noResourceId: string;
670
670
  noCloudId: string;
671
- bbNoResourceId: string;
671
+ noResourceIdInWorkspace: string;
672
672
  noInstallations: string;
673
673
  };
674
674
  tunnel: {
package/out/ui/text.js CHANGED
@@ -804,7 +804,7 @@ ${buildTerminalLink(link)}\n`,
804
804
  banner: `\nShowing all the current installations of your app:`,
805
805
  noResourceId: 'Unknown site with no resource ID',
806
806
  noCloudId: 'Unknown workspace with no cloud ID',
807
- bbNoResourceId: 'Unknown bitbucket workspace with no resource ID',
807
+ noResourceIdInWorkspace: 'Unknown workspace with no resource ID',
808
808
  noInstallations: `The app is not installed anywhere.\nRun ${forge('install')} to install your app on an Atlassian site.\n`
809
809
  },
810
810
  tunnel: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/cli-shared",
3
- "version": "6.6.0-next.7",
3
+ "version": "6.6.0-next.8",
4
4
  "description": "Common functionality for Forge CLI",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -1,3 +0,0 @@
1
- import { URL } from 'url';
2
- export declare const validateSite: (site: string, product: string | undefined) => URL;
3
- //# sourceMappingURL=validate.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/shared/validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAK1B,eAAO,MAAM,YAAY,SAAU,MAAM,WAAW,MAAM,GAAG,SAAS,KAAG,GAkBxE,CAAC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.validateSite = void 0;
4
- const url_1 = require("url");
5
- const ui_1 = require("../ui");
6
- const error_handling_1 = require("./error-handling");
7
- const product_1 = require("./product");
8
- const validateSite = (site, product) => {
9
- const trySites = [site, `https://${site}`];
10
- for (const trySite of trySites) {
11
- try {
12
- const urlObj = new url_1.URL(trySite);
13
- if (product && (0, product_1.isWorkspaceProduct)(product)) {
14
- return urlObj;
15
- }
16
- urlObj.pathname = '/';
17
- return urlObj;
18
- }
19
- catch {
20
- }
21
- }
22
- throw new error_handling_1.ValidationError(ui_1.Text.error.invalidSite);
23
- };
24
- exports.validateSite = validateSite;