@hubspot/project-parsing-lib 0.8.2 → 0.8.3

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,11 +1,11 @@
1
1
  {
2
2
  "name": "@hubspot/project-parsing-lib",
3
- "version": "0.8.2",
3
+ "version": "0.8.3",
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",
7
7
  "devDependencies": {
8
- "@hubspot/local-dev-lib": "^3.17.0",
8
+ "@hubspot/local-dev-lib": "^3.18.0",
9
9
  "@inquirer/prompts": "^7.1.0",
10
10
  "@types/jest": "^29.5.14",
11
11
  "@types/semver": "^7.5.8",
@@ -46,3 +46,9 @@ export declare const ProjectStructure: {
46
46
  };
47
47
  export declare const allowedComponentDirectories: string[];
48
48
  export declare const allowedSubComponentDirectories: string[];
49
+ export declare const ProfileVariableTypes: {
50
+ readonly PROFILE_INT: "PROFILE_INT";
51
+ readonly PROFILE_LONG: "PROFILE_LONG";
52
+ readonly PROFILE_STRING: "PROFILE_STRING";
53
+ readonly PROFILE_BOOLEAN: "PROFILE_BOOLEAN";
54
+ };
@@ -33,7 +33,7 @@ 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.allowedReactThemeSubComponentsDirs = 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.MCPRegistryKey = exports.MarketingEventsKey = exports.SCIMKey = exports.CardsKey = exports.CallingKey = exports.AppObjectAssociationKey = exports.AppObjectKey = exports.PagesKey = exports.AppFunctionsKey = exports.AppEventsKey = exports.ReactThemeKey = exports.ThemeKey = exports.AppKey = void 0;
36
+ exports.ProfileVariableTypes = exports.allowedSubComponentDirectories = exports.allowedComponentDirectories = exports.ProjectStructure = exports.allowedReactThemeSubComponentsDirs = 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.MCPRegistryKey = exports.MarketingEventsKey = exports.SCIMKey = exports.CardsKey = exports.CallingKey = exports.AppObjectAssociationKey = exports.AppObjectKey = exports.PagesKey = exports.AppFunctionsKey = exports.AppEventsKey = exports.ReactThemeKey = exports.ThemeKey = exports.AppKey = void 0;
37
37
  // Top Level Component types
38
38
  const path = __importStar(require("path"));
39
39
  // Component types
@@ -222,3 +222,10 @@ exports.allowedComponentDirectories = Object.keys(exports.ProjectStructure);
222
222
  exports.allowedSubComponentDirectories = Object.entries(exports.ProjectStructure)
223
223
  .map(([key, value]) => value.map((value) => path.join(key, value)))
224
224
  .flat();
225
+ // Profile variable types
226
+ exports.ProfileVariableTypes = {
227
+ PROFILE_INT: 'PROFILE_INT',
228
+ PROFILE_LONG: 'PROFILE_LONG',
229
+ PROFILE_STRING: 'PROFILE_STRING',
230
+ PROFILE_BOOLEAN: 'PROFILE_BOOLEAN',
231
+ };
@@ -9,12 +9,13 @@ exports.mapToUserFriendlyName = mapToUserFriendlyName;
9
9
  exports.transform = transform;
10
10
  exports.getIntermediateRepresentation = getIntermediateRepresentation;
11
11
  exports.generateServerlessPackageComponent = generateServerlessPackageComponent;
12
- const profiles_1 = require("./profiles");
13
- const constants_1 = require("./constants");
14
- const copy_1 = require("../lang/copy");
15
12
  const path_1 = __importDefault(require("path"));
16
13
  const fs_1 = __importDefault(require("fs"));
17
14
  const logger_1 = require("@hubspot/local-dev-lib/logger");
15
+ const profiles_1 = require("./profiles");
16
+ const constants_1 = require("./constants");
17
+ const copy_1 = require("../lang/copy");
18
+ const utils_1 = require("./utils");
18
19
  function calculateComponentDeps(fileValidationResult, parentComponents, appObjects, appFunctionsPackageUid) {
19
20
  let dependencies = {};
20
21
  // If there are dependencies in the config file, pass them through
@@ -152,13 +153,13 @@ function getProfileData(hsProfileContents) {
152
153
  let variableTypeForBE;
153
154
  switch (typeof profileVar) {
154
155
  case 'string':
155
- variableTypeForBE = 'PROFILE_STRING';
156
+ variableTypeForBE = constants_1.ProfileVariableTypes.PROFILE_STRING;
156
157
  break;
157
158
  case 'number':
158
- variableTypeForBE = 'PROFILE_INT';
159
+ variableTypeForBE = (0, utils_1.getJavaNumberType)(profileVar);
159
160
  break;
160
161
  case 'boolean':
161
- variableTypeForBE = 'PROFILE_BOOLEAN';
162
+ variableTypeForBE = constants_1.ProfileVariableTypes.PROFILE_BOOLEAN;
162
163
  break;
163
164
  default:
164
165
  break;
@@ -25,7 +25,7 @@ export interface IntermediateRepresentationNode {
25
25
  config: unknown;
26
26
  files: unknown;
27
27
  }
28
- export type BEProfileVariableType = 'PROFILE_INT' | 'PROFILE_STRING' | 'PROFILE_BOOLEAN';
28
+ export type BEProfileVariableType = 'PROFILE_INT' | 'PROFILE_LONG' | 'PROFILE_STRING' | 'PROFILE_BOOLEAN';
29
29
  export interface BEProfileVariables {
30
30
  [key: string]: {
31
31
  variableType: BEProfileVariableType;
@@ -1 +1,3 @@
1
+ import { BEProfileVariableType } from './types';
1
2
  export declare function loadJsonFile(filename: string): any;
3
+ export declare function getJavaNumberType(value: number): BEProfileVariableType;
package/src/lib/utils.js CHANGED
@@ -4,9 +4,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.loadJsonFile = loadJsonFile;
7
+ exports.getJavaNumberType = getJavaNumberType;
7
8
  const fs_1 = __importDefault(require("fs"));
9
+ const constants_1 = require("./constants");
8
10
  function loadJsonFile(filename) {
9
11
  return JSON.parse(fs_1.default.readFileSync(filename, {
10
12
  encoding: 'utf-8',
11
13
  }));
12
14
  }
15
+ function getJavaNumberType(value) {
16
+ const JAVA_INT_MIN = -2_147_483_648;
17
+ const JAVA_INT_MAX = 2_147_483_647;
18
+ // Check if the value fits in Java int range
19
+ if (value >= JAVA_INT_MIN && value <= JAVA_INT_MAX) {
20
+ return constants_1.ProfileVariableTypes.PROFILE_INT;
21
+ }
22
+ return constants_1.ProfileVariableTypes.PROFILE_LONG;
23
+ }