@hubspot/project-parsing-lib 0.3.1-beta.0 → 0.3.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hubspot/project-parsing-lib",
3
- "version": "0.3.1-beta.0",
3
+ "version": "0.3.2",
4
4
  "description": "Parsing library for converting projects directory structures to their intermediate representation",
5
5
  "license": "Apache-2.0",
6
6
  "main": "src/index.js",
@@ -5,6 +5,7 @@ export declare const errorMessages: {
5
5
  accountIdIsRequiredToFetchSchemas: string;
6
6
  };
7
7
  project: {
8
+ mustHaveAppComponent: (componentType: string) => string;
8
9
  noHsMetaFiles: string;
9
10
  failedToTranslateProject: string;
10
11
  duplicateUid: (uid: string, files: string[]) => string;
package/src/lang/copy.js CHANGED
@@ -16,6 +16,7 @@ exports.errorMessages = {
16
16
  accountIdIsRequiredToFetchSchemas: 'Account id is required to fetch schemas',
17
17
  },
18
18
  project: {
19
+ mustHaveAppComponent: (componentType) => `No *-hsmeta.json files were found with type '${constants_1.AppKey}'. You must have an '${constants_1.AppKey}' to associate '${componentType}'`,
19
20
  noHsMetaFiles: 'No *-hsmeta.json files found in the current directory. Please make sure you are inside the correct project directory.',
20
21
  failedToTranslateProject: 'Project validation failed',
21
22
  duplicateUid: (uid, files) => `Duplicate uid '${uid}' found in:\n- ${files.join('\n- ')}`,
@@ -1,15 +1,16 @@
1
1
  export declare const AppKey = "app";
2
2
  export declare const ThemeKey = "theme";
3
+ export declare const AppEventsKey = "app-event";
3
4
  export declare const AppFunctionsKey = "app-function";
4
5
  export declare const AppObjectKey = "app-object";
5
6
  export declare const AppObjectAssociationKey = "app-object-association";
6
7
  export declare const CallingKey = "calling";
7
8
  export declare const CardsKey = "card";
8
9
  export declare const SCIMKey = "scim";
9
- export declare const SettingsKey = "settings";
10
10
  export declare const MarketingEventsKey = "marketing-event";
11
11
  export declare const MediaBridgeKey = "media-bridge";
12
- export declare const AppEventsKey = "app-event";
12
+ export declare const SettingsKey = "settings";
13
+ export declare const TelemetryKey = "telemetry";
13
14
  export declare const VideoConferencingKey = "video-conferencing";
14
15
  export declare const WebhooksKey = "webhooks";
15
16
  export declare const WorkflowActionsKey = "workflow-action";
@@ -33,23 +33,24 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.allowedSubComponentDirectories = exports.allowedComponentDirectories = exports.ProjectStructure = exports.allowedThemeSubComponentsDirs = exports.allowedAppSubComponentsDirs = exports.packageLockJson = exports.packageJson = exports.hsProjectJsonFilename = exports.profileFilePrefix = exports.metafileExtension = exports.internalTypeToUserFacing = exports.userFacingToInternalType = exports.Components = exports.AutoGeneratedComponentTypes = exports.AppFunctionsPackageKey = exports.WorkflowActionsKey = exports.WebhooksKey = exports.VideoConferencingKey = exports.AppEventsKey = exports.MediaBridgeKey = exports.MarketingEventsKey = exports.SettingsKey = exports.SCIMKey = exports.CardsKey = exports.CallingKey = exports.AppObjectAssociationKey = exports.AppObjectKey = exports.AppFunctionsKey = exports.ThemeKey = exports.AppKey = void 0;
36
+ exports.allowedSubComponentDirectories = exports.allowedComponentDirectories = exports.ProjectStructure = exports.allowedThemeSubComponentsDirs = exports.allowedAppSubComponentsDirs = exports.packageLockJson = exports.packageJson = exports.hsProjectJsonFilename = exports.profileFilePrefix = exports.metafileExtension = exports.internalTypeToUserFacing = exports.userFacingToInternalType = exports.Components = exports.AutoGeneratedComponentTypes = exports.AppFunctionsPackageKey = exports.WorkflowActionsKey = exports.WebhooksKey = exports.VideoConferencingKey = exports.TelemetryKey = exports.SettingsKey = exports.MediaBridgeKey = exports.MarketingEventsKey = exports.SCIMKey = exports.CardsKey = exports.CallingKey = exports.AppObjectAssociationKey = exports.AppObjectKey = exports.AppFunctionsKey = exports.AppEventsKey = exports.ThemeKey = exports.AppKey = void 0;
37
37
  // Top Level Component types
38
38
  const path = __importStar(require("path"));
39
39
  // Component types
40
40
  exports.AppKey = 'app';
41
41
  exports.ThemeKey = 'theme';
42
42
  // Sub-Component types
43
+ exports.AppEventsKey = 'app-event';
43
44
  exports.AppFunctionsKey = 'app-function';
44
45
  exports.AppObjectKey = 'app-object';
45
46
  exports.AppObjectAssociationKey = 'app-object-association';
46
47
  exports.CallingKey = 'calling';
47
48
  exports.CardsKey = 'card';
48
49
  exports.SCIMKey = 'scim';
49
- exports.SettingsKey = 'settings';
50
50
  exports.MarketingEventsKey = 'marketing-event';
51
51
  exports.MediaBridgeKey = 'media-bridge';
52
- exports.AppEventsKey = 'app-event';
52
+ exports.SettingsKey = 'settings';
53
+ exports.TelemetryKey = 'telemetry';
53
54
  exports.VideoConferencingKey = 'video-conferencing';
54
55
  exports.WebhooksKey = 'webhooks';
55
56
  exports.WorkflowActionsKey = 'workflow-action';
@@ -160,10 +161,18 @@ exports.Components = {
160
161
  userFriendlyName: 'Workflow Action',
161
162
  ...SubComponentFields,
162
163
  },
164
+ [exports.TelemetryKey]: {
165
+ dir: exports.TelemetryKey,
166
+ parentComponent: exports.AppKey,
167
+ userFriendlyName: 'Telemetry',
168
+ singularComponent: true,
169
+ ...SubComponentFields,
170
+ },
163
171
  };
164
172
  exports.userFacingToInternalType = {
165
173
  [exports.AppKey]: 'APPLICATION',
166
174
  [exports.SCIMKey]: 'SCIM_INTEGRATION',
175
+ [exports.TelemetryKey]: 'TELEMETRY_CONFIG',
167
176
  };
168
177
  exports.internalTypeToUserFacing = Object.fromEntries(Object.entries(exports.userFacingToInternalType).map(([key, value]) => [value, key]));
169
178
  exports.metafileExtension = '-hsmeta.json';
@@ -14,6 +14,7 @@ const constants_1 = require("./constants");
14
14
  const copy_1 = require("../lang/copy");
15
15
  const path_1 = __importDefault(require("path"));
16
16
  const fs_1 = __importDefault(require("fs"));
17
+ const logger_1 = require("@hubspot/local-dev-lib/logger");
17
18
  function calculateComponentDeps(fileValidationResult, parentComponents, appObjects, appFunctionsPackageUid) {
18
19
  let dependencies = {};
19
20
  // If there are dependencies in the config file, pass them through
@@ -23,10 +24,14 @@ function calculateComponentDeps(fileValidationResult, parentComponents, appObjec
23
24
  const { type } = fileValidationResult.content;
24
25
  // If the component is a child of the App component, add the app and appObjects as dependencies
25
26
  if (constants_1.Components[type]?.parentComponent === constants_1.AppKey) {
26
- const parentUid = parentComponents[fileValidationResult.parentDirectory];
27
+ const parentUid = parentComponents[constants_1.AppKey];
27
28
  if (parentUid) {
28
29
  dependencies.app = parentUid;
29
30
  }
31
+ else {
32
+ logger_1.logger.debug(parentComponents);
33
+ throw new Error(copy_1.errorMessages.project.mustHaveAppComponent(type));
34
+ }
30
35
  if (type !== constants_1.AppObjectKey) {
31
36
  dependencies.allAppObjects = appObjects;
32
37
  }