@forge/cli-shared 3.0.0 → 3.1.0-next.0

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
+ ## 3.1.0-next.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 89ae99e0: Add support for auto-bundling resources
8
+
3
9
  ## 3.0.0
4
10
 
5
11
  ### Major Changes
@@ -10,7 +10,7 @@ export interface ConfigInteractor {
10
10
  snapshotsEnabled(): Promise<boolean>;
11
11
  }
12
12
  export declare type Resource = Resources[0];
13
- export declare type ResourceType = 'customUI' | 'default';
13
+ export declare type ResourceType = 'customUI' | 'nativeUI' | 'default';
14
14
  export interface ResourceDetails extends Resource {
15
15
  resourceType: ResourceType;
16
16
  }
@@ -25,8 +25,8 @@ export declare class ConfigFile implements ConfigReader, ConfigWriter, ConfigInt
25
25
  private makeManifestUnique;
26
26
  prependAppNameToModules(name: string): Promise<void>;
27
27
  writeToConfigFile<K extends string, V>(configKey: K, config: V): Promise<void>;
28
- private getHostedResourceKeys;
29
- private findMissingResources;
28
+ private getHostedResourceModules;
29
+ private assertNoMissingResources;
30
30
  private getRemoteFromEgressPermission;
31
31
  private instanceOfRemote;
32
32
  getEgressPermissions(): Promise<{
@@ -39,5 +39,6 @@ export declare class ConfigFile implements ConfigReader, ConfigWriter, ConfigInt
39
39
  }>>;
40
40
  getResources(): Promise<ResourceDetails[]>;
41
41
  getConnectKey(): Promise<string | undefined>;
42
+ private getResourceType;
42
43
  }
43
44
  //# sourceMappingURL=config-file.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config-file.d.ts","sourceRoot":"","sources":["../../src/config/config-file.ts"],"names":[],"mappings":"AAAA,OAAa,EAAwB,QAAQ,EAAE,MAAM,MAAM,CAAC;AAI5D,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGp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AC,QAAQ,CAAC,UAAU;IAAoB,OAAO,CAAC,QAAQ,CAAC,UAAU;gBAAzD,UAAU,EAAE,gBAAgB,EAAmB,UAAU,EAAE,gBAAgB;IAE3F,cAAc,IAAI,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IASxC,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC;IAUrC,oBAAoB,IAAI,OAAO,CAAC,QAAQ,CAAC,MAAM,GAAG,SAAS,CAAC;IAW5D,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAMjD,OAAO,CAAC,kBAAkB;IAmBb,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAapD,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAe3F,OAAO,CAAC,wBAAwB;IAKhC,OAAO,CAAC,wBAAwB;IAShC,OAAO,CAAC,6BAA6B;IAYrC,OAAO,CAAC,gBAAgB;IAIX,oBAAoB,IAAI,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;KAAE,EAAE,CAAC;IAoClF,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAe1E,YAAY,IAAI,OAAO,CAAC,eAAe,EAAE,CAAC;IAgB1C,aAAa,IAAI,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAKzD,OAAO,CAAC,eAAe;CAcxB"}
@@ -97,20 +97,15 @@ class ConfigFile {
97
97
  currentConfigDoc.set(configKey, config);
98
98
  this.fileWriter.writeStringToFile(currentConfigDoc.toString(), _1.manifestFileName);
99
99
  }
100
- getHostedResourceKeys(modules) {
101
- const resourceKeys = [];
102
- for (const moduleKey in modules) {
103
- modules[moduleKey].forEach((module) => {
104
- if (config_1.isHostedResourceModule(module)) {
105
- resourceKeys.push(module.resource);
106
- }
107
- });
108
- }
109
- return resourceKeys;
100
+ getHostedResourceModules(modules) {
101
+ const modulesArray = Object.values(modules).flat();
102
+ return modulesArray.filter((module) => config_1.isHostedResourceModule(module));
110
103
  }
111
- findMissingResources(resourceKeys, resources) {
112
- const missing = resourceKeys.filter((resourceKey) => !resources.some(({ key }) => resourceKey === key));
113
- return missing;
104
+ assertNoMissingResources(modules, resources) {
105
+ const missingResources = modules.filter(({ resource }) => !resources.some(({ key }) => resource === key));
106
+ if (missingResources.length > 0) {
107
+ throw new ResourceDefinitionMissingError(missingResources.map((m) => m.resource));
108
+ }
114
109
  }
115
110
  getRemoteFromEgressPermission(remoteEgressPermission, remotes) {
116
111
  if (!remotes) {
@@ -170,20 +165,11 @@ class ConfigFile {
170
165
  }
171
166
  async getResources() {
172
167
  const { modules, resources } = await this.readConfig();
173
- const hostedResourceKeys = modules ? this.getHostedResourceKeys(modules) : [];
168
+ const hostedResourceModules = modules ? this.getHostedResourceModules(modules) : [];
174
169
  const maybeResources = resources || [];
175
170
  const validResources = maybeResources.filter(config_1.validateResource);
176
- const missingResources = this.findMissingResources(hostedResourceKeys, validResources);
177
- if (missingResources.length > 0) {
178
- throw new ResourceDefinitionMissingError(missingResources);
179
- }
180
- const getResourceType = (resourceKey) => {
181
- if (hostedResourceKeys.includes(resourceKey)) {
182
- return 'customUI';
183
- }
184
- return 'default';
185
- };
186
- const validResourcesWithDetails = validResources.map((resource) => (Object.assign(Object.assign({}, resource), { resourceType: getResourceType(resource.key) })));
171
+ this.assertNoMissingResources(hostedResourceModules, validResources);
172
+ const validResourcesWithDetails = validResources.map((resource) => (Object.assign(Object.assign({}, resource), { resourceType: this.getResourceType(resource, hostedResourceModules) })));
187
173
  return validResourcesWithDetails || [];
188
174
  }
189
175
  async getConnectKey() {
@@ -191,5 +177,12 @@ class ConfigFile {
191
177
  const { app } = await this.readConfig();
192
178
  return (_a = app.connect) === null || _a === void 0 ? void 0 : _a.key;
193
179
  }
180
+ getResourceType({ key: resourceKey }, allModules) {
181
+ const linkedModule = allModules.find((m) => m.resource === resourceKey);
182
+ if (!linkedModule) {
183
+ return 'default';
184
+ }
185
+ return linkedModule.render === 'native' ? 'nativeUI' : 'customUI';
186
+ }
194
187
  }
195
188
  exports.ConfigFile = ConfigFile;
@@ -5,7 +5,8 @@ export interface BaseModule {
5
5
  key: string;
6
6
  }
7
7
  export interface HostedResourcesModule extends BaseModule {
8
- resource?: string;
8
+ resource: string;
9
+ render?: 'default' | 'native';
9
10
  }
10
11
  export interface ConfigReader {
11
12
  readConfig(): Promise<ManifestSchema>;
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5D,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAC/C,eAAO,MAAM,mBAAmB,UAAuE,CAAC;AAExG,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,qBAAsB,SAAQ,UAAU;IACvD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,YAAY;IAC3B,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9F,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,gBAAgB,aAAc,GAAG,0BAG7C,CAAC;AAEF,eAAO,MAAM,sBAAsB,WAAY,GAAG,oCAGjD,CAAC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5D,eAAO,MAAM,gBAAgB,iBAAiB,CAAC;AAC/C,eAAO,MAAM,mBAAmB,UAAuE,CAAC;AAExG,MAAM,WAAW,UAAU;IACzB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,qBAAsB,SAAQ,UAAU;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;CAC/B;AAED,MAAM,WAAW,YAAY;IAC3B,UAAU,IAAI,OAAO,CAAC,cAAc,CAAC,CAAC;CACvC;AAED,MAAM,WAAW,YAAY;IAC3B,iBAAiB,CAAC,CAAC,SAAS,MAAM,EAAE,CAAC,SAAS,MAAM,EAAE,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC9F,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtD;AAED,eAAO,MAAM,gBAAgB,aAAc,GAAG,0BAG7C,CAAC;AAEF,eAAO,MAAM,sBAAsB,WAAY,GAAG,oCAGjD,CAAC"}
@@ -2367,6 +2367,14 @@ export declare type CompassCustomFieldInput = {
2367
2367
  textField?: Maybe<CompassCustomTextFieldInput>;
2368
2368
  numberField?: Maybe<CompassCustomNumberFieldInput>;
2369
2369
  };
2370
+ export declare type CompassCustomFieldScorecardCriteria = {
2371
+ id: Scalars['ID'];
2372
+ weight: Scalars['Int'];
2373
+ scorecardCriteriaScore?: Maybe<CompassScorecardCriteriaScore>;
2374
+ };
2375
+ export declare type CompassCustomFieldScorecardCriteriaScorecardCriteriaScoreArgs = {
2376
+ query?: Maybe<CompassScorecardCriteriaScoreQuery>;
2377
+ };
2370
2378
  export declare type CompassCustomNumberField = CompassCustomField & {
2371
2379
  __typename?: 'CompassCustomNumberField';
2372
2380
  definition?: Maybe<CompassCustomNumberFieldDefinition>;
@@ -2633,7 +2641,7 @@ export declare type CompassFlagEventProperties = {
2633
2641
  id: Scalars['ID'];
2634
2642
  status?: Maybe<Scalars['String']>;
2635
2643
  };
2636
- export declare type CompassHasCustomBooleanFieldScorecardCriteria = CompassScorecardCriteria & {
2644
+ export declare type CompassHasCustomBooleanFieldScorecardCriteria = CompassScorecardCriteria & CompassCustomFieldScorecardCriteria & {
2637
2645
  __typename?: 'CompassHasCustomBooleanFieldScorecardCriteria';
2638
2646
  id: Scalars['ID'];
2639
2647
  weight: Scalars['Int'];
@@ -2645,7 +2653,7 @@ export declare type CompassHasCustomBooleanFieldScorecardCriteria = CompassScore
2645
2653
  export declare type CompassHasCustomBooleanFieldScorecardCriteriaScorecardCriteriaScoreArgs = {
2646
2654
  query?: Maybe<CompassScorecardCriteriaScoreQuery>;
2647
2655
  };
2648
- export declare type CompassHasCustomNumberFieldScorecardCriteria = CompassScorecardCriteria & {
2656
+ export declare type CompassHasCustomNumberFieldScorecardCriteria = CompassScorecardCriteria & CompassCustomFieldScorecardCriteria & {
2649
2657
  __typename?: 'CompassHasCustomNumberFieldScorecardCriteria';
2650
2658
  id: Scalars['ID'];
2651
2659
  weight: Scalars['Int'];
@@ -2657,7 +2665,7 @@ export declare type CompassHasCustomNumberFieldScorecardCriteria = CompassScorec
2657
2665
  export declare type CompassHasCustomNumberFieldScorecardCriteriaScorecardCriteriaScoreArgs = {
2658
2666
  query?: Maybe<CompassScorecardCriteriaScoreQuery>;
2659
2667
  };
2660
- export declare type CompassHasCustomTextFieldScorecardCriteria = CompassScorecardCriteria & {
2668
+ export declare type CompassHasCustomTextFieldScorecardCriteria = CompassScorecardCriteria & CompassCustomFieldScorecardCriteria & {
2661
2669
  __typename?: 'CompassHasCustomTextFieldScorecardCriteria';
2662
2670
  id: Scalars['ID'];
2663
2671
  weight: Scalars['Int'];
@@ -6607,8 +6615,10 @@ export declare type ForgeAlertsActivitiesResult = ForgeAlertsActivityConnection
6607
6615
  export declare type ForgeAlertsActivity = {
6608
6616
  __typename?: 'ForgeAlertsActivity';
6609
6617
  activityMessage: Scalars['String'];
6610
- timestamp: Scalars['Int'];
6618
+ timestamp: Scalars['String'];
6611
6619
  type: ForgeAlertsActivityType;
6620
+ isMuted: Scalars['Boolean'];
6621
+ status: ForgeAlertsStatus;
6612
6622
  };
6613
6623
  export declare type ForgeAlertsActivityConnection = {
6614
6624
  __typename?: 'ForgeAlertsActivityConnection';
@@ -6626,7 +6636,8 @@ export declare enum ForgeAlertsActivityType {
6626
6636
  AlertMuted = "ALERT_MUTED",
6627
6637
  AlertOpened = "ALERT_OPENED",
6628
6638
  AlertResolved = "ALERT_RESOLVED",
6629
- AlertSent = "ALERT_SENT",
6639
+ AlertSentFiring = "ALERT_SENT_FIRING",
6640
+ AlertSentResolved = "ALERT_SENT_RESOLVED",
6630
6641
  AlertUnmuted = "ALERT_UNMUTED",
6631
6642
  AlertUpdated = "ALERT_UPDATED"
6632
6643
  }