@forge/cli-shared 5.5.0-next.10 → 5.5.0-next.12

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.
@@ -17,7 +17,7 @@ exports.JsmChatInteractionType = exports.JsmChatConversationUserRole = exports.J
17
17
  exports.MarketplaceStorePartnerEnrollmentProgram = exports.MarketplaceStoreInstallationTargetProduct = exports.MarketplaceStoreInstallAppStatus = exports.MarketplaceStoreHomePageHighlightedSectionVariation = exports.MarketplaceStoreDeveloperSpaceStatus = exports.MarketplaceProgramStatus = exports.MarketplacePricingTierType = exports.MarketplacePricingTierPolicy = exports.MarketplacePricingTierMode = exports.MarketplacePricingPlanStatus = exports.MarketplacePartnerType = exports.MarketplacePartnerTierType = exports.MarketplacePartnerSupportHolidayFrequency = exports.MarketplaceLocation = exports.MarketplaceListingStatus = exports.MarketplaceEntityStatus = exports.MarketplaceConsolePricingPlanStatus = exports.MarketplaceConsolePricingCurrency = exports.MarketplaceConsolePaymentModel = exports.MarketplaceConsoleParentSoftwareState = exports.MarketplaceConsoleLegacyMongoStatus = exports.MarketplaceConsoleLegacyMongoPluginHiddenIn = exports.MarketplaceConsoleHosting = exports.MarketplaceConsoleEditionsActivationStatus = exports.MarketplaceConsoleEditionType = exports.MarketplaceConsoleDevSpaceTier = exports.MarketplaceConsoleDevSpaceProgram = exports.MarketplaceConsoleAppSoftwareVersionState = exports.MarketplaceConsoleAppSoftwareVersionLicenseTypeId = exports.MarketplaceCloudFortifiedStatus = exports.MarketplaceBillingCycle = exports.MarketplaceAppVersionVisibility = exports.MarketplaceAppPaymentModel = exports.LpSortOrder = exports.LpCourseStatus = exports.LpCourseSortField = exports.LpCertType = exports.LpCertStatus = exports.LpCertSortField = exports.LifecycleStage = exports.LicenseOverrideState = exports.KnowledgeDiscoveryTopicType = exports.KnowledgeDiscoverySummaryLength = exports.KnowledgeDiscoverySearchQueryClassification = exports.KnowledgeDiscoveryKeyPhraseInputTextFormat = exports.KnowledgeDiscoveryKeyPhraseCategory = exports.KnowledgeDiscoveryEntityType = exports.KnowledgeDiscoveryDefinitionScope = exports.JsmChatMessageType = exports.JsmChatMessageSource = void 0;
18
18
  exports.RateLimitingCurrency = exports.PrincipalType = exports.PolarisVisualizationType = exports.PolarisViewSortMode = exports.PolarisViewSetType = exports.PolarisViewLayoutType = exports.PolarisViewFilterOperator = exports.PolarisViewFilterKind = exports.PolarisViewFieldRollupType = exports.PolarisValueOperator = exports.PolarisTimelineMode = exports.PolarisSortOrder = exports.PolarisSnippetPropertyKind = exports.PolarisResolvedObjectAuthType = exports.PolarisRefreshError = exports.PolarisPlayKind = exports.PolarisFieldType = exports.PolarisCommentKind = exports.PlanModeDestination = exports.PartnerInvoiceJsonCurrency = exports.PartnerCurrency = exports.PartnerCloudLicenseType = exports.PartnerBtfLicenseType = exports.PeapProgramStatus = exports.NlpSearchResultType = exports.NlpSearchResultFormat = exports.NlpGetKeywordsTextFormat = exports.NlpErrorState = exports.NlpDisclaimer = exports.NadelHydrationTemplate = exports.MigrationEventType = exports.MigrationEventStatus = exports.MercuryTeamSortField = exports.MercuryTeamFocusAreaAllocationSortField = exports.MercuryTargetDateType = exports.MercuryProviderWorkTargetDateType = exports.MercuryProviderWorkStatusColor = exports.MercuryProviderWorkErrorType = exports.MercuryProviderConfigurationStatus = exports.MercuryFocusAreaTeamAllocationAggregationSortField = exports.MercuryFocusAreaSortField = exports.MercuryFocusAreaHierarchySortField = exports.MercuryFocusAreaHealthColor = exports.MercuryEntityType = exports.MercuryAggregatedHeadcountSortField = exports.MembershipState = exports.MembershipSetting = exports.MembershipRole = exports.MarketplaceStorePartnerSupportAvailabilityDay = exports.MarketplaceStorePartnerEnrollmentProgramValue = void 0;
19
19
  exports.SupportRequestQueryOwnership = exports.SupportRequestNamedContactOperation = exports.SupportRequestFieldDataType = exports.SprintState = exports.SprintReportsEstimationStatisticType = exports.SortOrder = exports.SortDirection = exports.SoftwareCardsDestinationEnum = exports.ShepherdWebhookType = exports.ShepherdWebhookDestinationType = exports.ShepherdVortexModeStatus = exports.ShepherdSubscriptionStatus = exports.ShepherdSearchOrigin = exports.ShepherdRemediationActionType = exports.ShepherdRateThresholdValue = exports.ShepherdQueryErrorType = exports.ShepherdMutationErrorType = exports.ShepherdLoginDeviceType = exports.ShepherdDetectionScanningFrequency = exports.ShepherdCustomScanningMatchType = exports.ShepherdClassificationStatus = exports.ShepherdClassificationLevelColor = exports.ShepherdAtlassianProduct = exports.ShepherdAlertTemplateType = exports.ShepherdAlertStatus = exports.ShepherdAlertDetectionCategory = exports.ShepherdActorOrgStatus = exports.ShepherdActionType = exports.SearchThirdPartyRangeField = exports.SearchSortOrder = exports.SearchResultType = exports.SearchProjectType = exports.SearchIssueStatusCategory = exports.SearchContainerStatus = exports.SearchConfluenceRangeField = exports.SearchConfluenceDocumentStatus = exports.SearchBoardProductType = exports.Scope = exports.SandboxEventType = exports.SandboxEventStatus = exports.SandboxEventSource = exports.SandboxEventResult = exports.RoadmapVersionStatus = exports.RoadmapTimelineMode = exports.RoadmapSprintState = exports.RoadmapRankPosition = exports.RoadmapPaletteColor = exports.RoadmapLevelOneView = exports.RoadmapEpicView = exports.RoadmapChildIssuePlanningMode = void 0;
20
- exports.SourceBillingType = exports.WorkSuggestionsVulnerabilityStatus = exports.WorkSuggestionsUserPersona = exports.WorkSuggestionsEnvironmentType = exports.WorkSuggestionsAutoDevJobState = exports.WorkSuggestionsApprovalStatus = exports.WorkSuggestionsAction = exports.VirtualAgentIntentTemplateType = exports.VirtualAgentConversationState = exports.VirtualAgentConversationCsatOptionType = exports.VirtualAgentConversationActionType = exports.UserInstallationRuleValue = exports.TrelloWorkspaceTier = exports.TrelloWorkspaceMembershipType = exports.TrelloSupportedPlannerProviders = exports.TrelloPowerUpDataScope = exports.TrelloPowerUpDataAccess = exports.TrelloCardRole = exports.TrelloCardExternalSource = exports.TrelloCardCoverSize = exports.TrelloCardCoverColor = exports.TrelloCardCoverBrightness = exports.TrelloBoardMembershipType = exports.TownsquareTargetDateType = exports.TownsquareProjectStateValue = exports.TownsquareProjectSortEnum = exports.TownsquareGoalTypeState = exports.TownsquareGoalStateValue = exports.TownsquareGoalSortEnum = exports.ToolchainWorkspaceConnectionErrorCode = exports.ToolchainSyncState = exports.ToolchainProviderType = exports.ToolchainDisassociateEntitiesErrorCode = exports.ToolchainCreateContainerErrorCode = exports.ToolchainCheckAuthErrorCode = exports.ToolchainAssociateEntitiesErrorCode = exports.TeamStateV2 = exports.TeamState = exports.TeamSortOrder = exports.TeamSortField = exports.TeamSearchField = exports.TeamRole = exports.TeamMembershipState = exports.TeamMembershipSettings = exports.TeamMembershipRole = exports.SwimlaneStrategy = exports.SupportRequestUserType = exports.SupportRequestStatusCategory = exports.SupportRequestQueryStatusCategory = void 0;
20
+ exports.SourceBillingType = exports.WorkSuggestionsVulnerabilityStatus = exports.WorkSuggestionsUserPersona = exports.WorkSuggestionsTargetAudience = exports.WorkSuggestionsEnvironmentType = exports.WorkSuggestionsAutoDevJobState = exports.WorkSuggestionsApprovalStatus = exports.WorkSuggestionsAction = exports.VirtualAgentIntentTemplateType = exports.VirtualAgentConversationState = exports.VirtualAgentConversationCsatOptionType = exports.VirtualAgentConversationActionType = exports.UserInstallationRuleValue = exports.TrelloWorkspaceTier = exports.TrelloWorkspaceMembershipType = exports.TrelloSupportedPlannerProviders = exports.TrelloPowerUpDataScope = exports.TrelloPowerUpDataAccess = exports.TrelloCardRole = exports.TrelloCardExternalSource = exports.TrelloCardCoverSize = exports.TrelloCardCoverColor = exports.TrelloCardCoverBrightness = exports.TrelloBoardMembershipType = exports.TownsquareTargetDateType = exports.TownsquareProjectStateValue = exports.TownsquareProjectSortEnum = exports.TownsquareGoalTypeState = exports.TownsquareGoalStateValue = exports.TownsquareGoalSortEnum = exports.ToolchainWorkspaceConnectionErrorCode = exports.ToolchainSyncState = exports.ToolchainProviderType = exports.ToolchainDisassociateEntitiesErrorCode = exports.ToolchainCreateContainerErrorCode = exports.ToolchainCheckAuthErrorCode = exports.ToolchainAssociateEntitiesErrorCode = exports.TeamStateV2 = exports.TeamState = exports.TeamSortOrder = exports.TeamSortField = exports.TeamSearchField = exports.TeamRole = exports.TeamMembershipState = exports.TeamMembershipSettings = exports.TeamMembershipRole = exports.SwimlaneStrategy = exports.SupportRequestUserType = exports.SupportRequestStatusCategory = exports.SupportRequestQueryStatusCategory = void 0;
21
21
  var AcceptableResponse;
22
22
  (function (AcceptableResponse) {
23
23
  AcceptableResponse["False"] = "FALSE";
@@ -5125,6 +5125,7 @@ var JiraUiModificationsViewType;
5125
5125
  JiraUiModificationsViewType["Gic"] = "GIC";
5126
5126
  JiraUiModificationsViewType["IssueTransition"] = "IssueTransition";
5127
5127
  JiraUiModificationsViewType["IssueView"] = "IssueView";
5128
+ JiraUiModificationsViewType["JsmRequestCreate"] = "JSMRequestCreate";
5128
5129
  })(JiraUiModificationsViewType = exports.JiraUiModificationsViewType || (exports.JiraUiModificationsViewType = {}));
5129
5130
  var JiraVersionApproverStatus;
5130
5131
  (function (JiraVersionApproverStatus) {
@@ -7194,6 +7195,11 @@ var WorkSuggestionsEnvironmentType;
7194
7195
  WorkSuggestionsEnvironmentType["Testing"] = "TESTING";
7195
7196
  WorkSuggestionsEnvironmentType["Unmapped"] = "UNMAPPED";
7196
7197
  })(WorkSuggestionsEnvironmentType = exports.WorkSuggestionsEnvironmentType || (exports.WorkSuggestionsEnvironmentType = {}));
7198
+ var WorkSuggestionsTargetAudience;
7199
+ (function (WorkSuggestionsTargetAudience) {
7200
+ WorkSuggestionsTargetAudience["Me"] = "ME";
7201
+ WorkSuggestionsTargetAudience["Team"] = "TEAM";
7202
+ })(WorkSuggestionsTargetAudience = exports.WorkSuggestionsTargetAudience || (exports.WorkSuggestionsTargetAudience = {}));
7197
7203
  var WorkSuggestionsUserPersona;
7198
7204
  (function (WorkSuggestionsUserPersona) {
7199
7205
  WorkSuggestionsUserPersona["Developer"] = "DEVELOPER";
@@ -0,0 +1,21 @@
1
+ /// <reference types="node" />
2
+ import { type Modules, type Translations, type ForgeSupportedLocaleCode } from '@forge/manifest';
3
+ export declare type I18nResourceBundle = {
4
+ path: string;
5
+ exists: true;
6
+ } | {
7
+ exists: false;
8
+ };
9
+ export declare const EMPTY_I18N_RESOURCE_BUNDLE: I18nResourceBundle;
10
+ declare type I18nResourceFileAccessor = (resourceKey: ForgeSupportedLocaleCode | string) => Promise<Buffer | null>;
11
+ export declare const listFilesInI18nResourceBundle: (i18nResourceBundle: I18nResourceBundle) => [string, string][];
12
+ export declare class I18nResourceBundlingService {
13
+ private copyLocaleFilesToBundleDir;
14
+ private createI18nInfoFile;
15
+ private createI18nInfo;
16
+ private loadTranslationLookup;
17
+ bundle(modules?: Modules, i18nConfig?: Translations): Promise<I18nResourceBundle>;
18
+ createFileAccessor(i18nConfig: Translations): I18nResourceFileAccessor;
19
+ }
20
+ export {};
21
+ //# sourceMappingURL=i18n-resource-bundling-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i18n-resource-bundling-service.d.ts","sourceRoot":"","sources":["../../src/service/i18n-resource-bundling-service.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAMjG,oBAAY,kBAAkB,GAC1B;IACE,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,IAAI,CAAC;CACd,GACD;IACE,MAAM,EAAE,KAAK,CAAC;CACf,CAAC;AAEN,eAAO,MAAM,0BAA0B,EAAE,kBAAsC,CAAC;AAIhF,aAAK,wBAAwB,GAAG,CAAC,WAAW,EAAE,wBAAwB,GAAG,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;AAE3G,eAAO,MAAM,6BAA6B,uBAAwB,kBAAkB,KAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAMtG,CAAC;AAEF,qBAAa,2BAA2B;YACxB,0BAA0B;YAU1B,kBAAkB;IAUhC,OAAO,CAAC,cAAc;YAgCR,qBAAqB;IActB,MAAM,CAAC,OAAO,CAAC,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAWvF,kBAAkB,CAAC,UAAU,EAAE,YAAY,GAAG,wBAAwB;CAuB9E"}
@@ -0,0 +1,97 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.I18nResourceBundlingService = exports.listFilesInI18nResourceBundle = exports.EMPTY_I18N_RESOURCE_BUNDLE = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const tmp_1 = tslib_1.__importDefault(require("tmp"));
6
+ const fs_1 = require("fs");
7
+ const path_1 = require("path");
8
+ const i18n_1 = require("@forge/i18n");
9
+ exports.EMPTY_I18N_RESOURCE_BUNDLE = { exists: false };
10
+ const listFilesInI18nResourceBundle = (i18nResourceBundle) => {
11
+ if (!i18nResourceBundle.exists) {
12
+ return [];
13
+ }
14
+ return (0, fs_1.readdirSync)(i18nResourceBundle.path).map((fileName) => [fileName, (0, path_1.join)(i18nResourceBundle.path, fileName)]);
15
+ };
16
+ exports.listFilesInI18nResourceBundle = listFilesInI18nResourceBundle;
17
+ class I18nResourceBundlingService {
18
+ async copyLocaleFilesToBundleDir(bundleDirPath, i18nConfig) {
19
+ const providedLocaleFilePaths = i18nConfig.resources.map((resource) => [resource.key, (0, path_1.resolve)(resource.path)]);
20
+ await Promise.all(providedLocaleFilePaths.map(async ([key, providedPath]) => {
21
+ const dest = (0, path_1.join)(bundleDirPath, `${key}.json`);
22
+ await fs_1.promises.copyFile(providedPath, dest);
23
+ }));
24
+ }
25
+ async createI18nInfoFile(bundleDirPath, i18nConfig, modules) {
26
+ const i18nKeys = (0, i18n_1.extractI18nKeysFromModules)(modules);
27
+ const translationLookup = await this.loadTranslationLookup(i18nConfig);
28
+ const i18nInfo = this.createI18nInfo(i18nConfig, i18nKeys, translationLookup);
29
+ const i18nInfoFilePath = (0, path_1.join)(bundleDirPath, i18n_1.I18N_INFO_FILE_NAME);
30
+ await fs_1.promises.writeFile(i18nInfoFilePath, JSON.stringify(i18nInfo));
31
+ }
32
+ createI18nInfo(i18nConfig, i18nKeys, translationLookup) {
33
+ const translations = {};
34
+ const localeKeys = Object.keys(translationLookup).sort();
35
+ i18nKeys.forEach((i18nKey) => {
36
+ const i18nInfoEntry = localeKeys.reduce((entry, locale) => {
37
+ const translationValue = (0, i18n_1.getTranslationValue)(translationLookup, i18nKey, locale);
38
+ if (translationValue) {
39
+ entry[locale] = translationValue;
40
+ }
41
+ return entry;
42
+ }, {});
43
+ translations[i18nKey] = i18nInfoEntry;
44
+ });
45
+ const defaultLocale = i18nConfig.fallback.default;
46
+ if (i18nKeys.some((key) => !translations[key][defaultLocale])) {
47
+ throw new Error(`Default locale '${defaultLocale}' is missing translations for some keys`);
48
+ }
49
+ return {
50
+ translations,
51
+ config: {
52
+ locales: localeKeys,
53
+ fallback: i18nConfig.fallback
54
+ }
55
+ };
56
+ }
57
+ async loadTranslationLookup(i18nConfig) {
58
+ const providedLocaleFilePaths = i18nConfig.resources.map((resource) => [
59
+ resource.key,
60
+ (0, path_1.resolve)(resource.path)
61
+ ]);
62
+ const results = await Promise.all(providedLocaleFilePaths.map(async ([key, providedPath]) => {
63
+ const file = await fs_1.promises.readFile(providedPath);
64
+ return [key, JSON.parse(file.toString())];
65
+ }));
66
+ return Object.fromEntries(results);
67
+ }
68
+ async bundle(modules, i18nConfig) {
69
+ if (!modules || !i18nConfig) {
70
+ return exports.EMPTY_I18N_RESOURCE_BUNDLE;
71
+ }
72
+ const bundleDirPath = tmp_1.default.dirSync().name;
73
+ await this.copyLocaleFilesToBundleDir(bundleDirPath, i18nConfig);
74
+ await this.createI18nInfoFile(bundleDirPath, i18nConfig, modules);
75
+ return { exists: true, path: bundleDirPath };
76
+ }
77
+ createFileAccessor(i18nConfig) {
78
+ const i18nInfoFileKey = i18n_1.I18N_INFO_FILE_NAME.split('.')[0];
79
+ return async (resourceKey) => {
80
+ if (resourceKey === i18nInfoFileKey) {
81
+ return Buffer.from(JSON.stringify({
82
+ translations: {},
83
+ config: {
84
+ locales: i18nConfig.resources.map((resource) => resource.key),
85
+ fallback: i18nConfig.fallback
86
+ }
87
+ }));
88
+ }
89
+ const i18nResource = i18nConfig.resources.find((resource) => resource.key === resourceKey);
90
+ if (!i18nResource || !(await fs_1.promises.stat((0, path_1.resolve)(i18nResource.path))).isFile()) {
91
+ return null;
92
+ }
93
+ return fs_1.promises.readFile((0, path_1.resolve)(i18nResource.path));
94
+ };
95
+ }
96
+ }
97
+ exports.I18nResourceBundlingService = I18nResourceBundlingService;
@@ -1,4 +1,5 @@
1
1
  export * from './bridge-script-service';
2
2
  export * from './iframe-resizer-script-service';
3
3
  export * from './feature-flag-service';
4
+ export * from './i18n-resource-bundling-service';
4
5
  //# 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"}
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"}
@@ -4,3 +4,4 @@ const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./bridge-script-service"), exports);
5
5
  tslib_1.__exportStar(require("./iframe-resizer-script-service"), exports);
6
6
  tslib_1.__exportStar(require("./feature-flag-service"), exports);
7
+ tslib_1.__exportStar(require("./i18n-resource-bundling-service"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/cli-shared",
3
- "version": "5.5.0-next.10",
3
+ "version": "5.5.0-next.12",
4
4
  "description": "Common functionality for Forge CLI",
5
5
  "author": "Atlassian",
6
6
  "license": "UNLICENSED",
@@ -12,8 +12,9 @@
12
12
  "generate-graphql-types": "graphql-codegen --config src/graphql/codegen.yml"
13
13
  },
14
14
  "dependencies": {
15
- "@forge/manifest": "7.7.0-next.10",
15
+ "@forge/manifest": "7.7.0-next.12",
16
16
  "@forge/util": "1.4.4",
17
+ "@forge/i18n": "0.0.1-next.11",
17
18
  "@sentry/node": "7.100.1",
18
19
  "adm-zip": "^0.5.10",
19
20
  "array.prototype.flatmap": "^1.3.2",