@constructor-io/constructorio-connect-cli 1.18.0 → 1.18.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/README.md CHANGED
@@ -56,13 +56,14 @@ Deploys all templates defined on the `connectrc.js` file to the specified enviro
56
56
 
57
57
  ```
58
58
  USAGE
59
- $ constructorio-connect-cli deploy ENV [-f]
59
+ $ constructorio-connect-cli deploy ENV [--cloud] [-f]
60
60
 
61
61
  ARGUMENTS
62
62
  ENV (development|qa|production|demo) The target Constructor environment to deploy to.
63
63
 
64
64
  FLAGS
65
65
  -f, --force Skip tests before deploying
66
+ --cloud Use the cloud config (connectrc.js) even if a local config (connectrc.local.js) exists
66
67
 
67
68
  DESCRIPTION
68
69
  Deploys all templates defined on the `connectrc.js` file to the specified environment, after running tests ('--force'
@@ -87,10 +88,11 @@ Execute a template against a connection and fixture to see the resulting transfo
87
88
 
88
89
  ```
89
90
  USAGE
90
- $ constructorio-connect-cli execute [--template-path <value>] [--fixture-path <value>]
91
+ $ constructorio-connect-cli execute [--cloud] [--template-path <value>] [--fixture-path <value>]
91
92
  [--external-data-path <value>] [--connection-id <value>] [--override-date <value>]
92
93
 
93
94
  FLAGS
95
+ --cloud Use the cloud config (connectrc.js) even if a local config (connectrc.local.js) exists
94
96
  --connection-id=<value> The ID of the connection to execute the template against.
95
97
  --external-data-path=<value> The path to the external data to execute the template against. Must be in the
96
98
  'src/fixtures/external_data' directory.
@@ -108,6 +110,10 @@ EXAMPLES
108
110
 
109
111
  $ constructorio-connect-cli execute --template-path=item/item.jsonata
110
112
 
113
+ $ constructorio-connect-cli execute --template-path=item/item.js
114
+
115
+ $ constructorio-connect-cli execute --template-path=item/item.ts
116
+
111
117
  $ constructorio-connect-cli execute --template-path=variation/variation.jsonata
112
118
 
113
119
  $ constructorio-connect-cli execute --template-path=item_group/item_group.jsonata --fixture-path=item_group.json
@@ -124,11 +130,12 @@ This command will fetch one fixture from the server and save it into a specified
124
130
 
125
131
  ```
126
132
  USAGE
127
- $ constructorio-connect-cli generate-fixture [--connection <value>] [--type
133
+ $ constructorio-connect-cli generate-fixture [--cloud] [--connection <value>] [--type
128
134
  item|variation|item_group|external_data|mapping] [--filename <value>] [--item-id <value>] [--variation-id <value>]
129
135
  [--replace-file]
130
136
 
131
137
  FLAGS
138
+ --cloud Use the cloud config (connectrc.js) even if a local config (connectrc.local.js) exists
132
139
  --connection=<value> The connection to generate the fixture for
133
140
  --filename=<value> The name of the fixture file to generate
134
141
  --item-id=<value> The ID of the item to generate the fixture for
@@ -206,7 +213,10 @@ Refresh the connections list
206
213
 
207
214
  ```
208
215
  USAGE
209
- $ constructorio-connect-cli refresh-connections
216
+ $ constructorio-connect-cli refresh-connections [--cloud]
217
+
218
+ FLAGS
219
+ --cloud Use the cloud config (connectrc.js) even if a local config (connectrc.local.js) exists
210
220
 
211
221
  DESCRIPTION
212
222
  Refresh the connections list
@@ -219,7 +229,10 @@ Triggers a catalog sync for selected connection.
219
229
 
220
230
  ```
221
231
  USAGE
222
- $ constructorio-connect-cli trigger-catalog-sync
232
+ $ constructorio-connect-cli trigger-catalog-sync [--cloud]
233
+
234
+ FLAGS
235
+ --cloud Use the cloud config (connectrc.js) even if a local config (connectrc.local.js) exists
223
236
 
224
237
  DESCRIPTION
225
238
  Triggers a catalog sync for selected connection.
@@ -1,3 +1,4 @@
1
1
  CONNECT_AUTH_TOKEN=
2
2
  AUTO_REFRESH_CONNECTIONS=true
3
3
  IS_CI=false
4
+ LOCAL_CONNECT_AUTH_TOKEN=
@@ -164,7 +164,7 @@ By running `npm run test`, Jest will search for all files with the `.test.js` or
164
164
  in the project and execute the corresponding tests.
165
165
 
166
166
  As a best practice, you should have at least one snapshot test to ensure the result of your template.
167
- You cna also add any logical tests to cover any rules you add to your templates,
167
+ You can also add any logical tests to cover any rules you add to your templates,
168
168
  such as "calculating the average price of your variations".
169
169
  If you need to, you can update your snapshots with the `--updateSnapshot` flag.
170
170
 
@@ -51,7 +51,7 @@ class Deploy extends refresh_connections_1.RefreshConnectionsCommand {
51
51
  }
52
52
  }
53
53
  const config = await (0, ux_action_1.uxAction)("📡 Reading your config", async () => {
54
- return await (0, config_1.getRepositoryConfigFile)();
54
+ return await (0, config_1.getRepositoryConfigFile)({ useCloud: !this.isLocal });
55
55
  })();
56
56
  const environment = await (0, ux_action_1.uxAction)("✨ Validating your environment", async () => {
57
57
  const env = config.environments.find(({ environment }) => environment === args.env);
@@ -1 +1 @@
1
- {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX;;;GAGG;AACH,UAAU,iBAAiB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,IAAI,CAAC;CACxB;AAaD,qBAAa,OAAQ,SAAQ,yBAAyB;IACpD,MAAM,CAAC,KAAK;;;;;;MAoBV;IAEF,MAAM,CAAC,WAAW,SACkK;IAEpL,MAAM,CAAC,QAAQ,WAOb;IAEF,KAAK,EAAE,iBAAiB,CAAM;IAExB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAmCnB,UAAU;YA0BV,oBAAoB;YAqDpB,wBAAwB;YA2BxB,wBAAwB;CAevC"}
1
+ {"version":3,"file":"execute.d.ts","sourceRoot":"","sources":["../../src/commands/execute.ts"],"names":[],"mappings":"AA0BA,OAAO,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAElE,eAAO,MAAM,qBAAqB;;;;;CAKxB,CAAC;AAEX;;;GAGG;AACH,UAAU,iBAAiB;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,eAAe,CAAC,EAAE,IAAI,CAAC;CACxB;AAaD,qBAAa,OAAQ,SAAQ,yBAAyB;IACpD,MAAM,CAAC,KAAK;;;;;;MAoBV;IAEF,MAAM,CAAC,WAAW,SACkK;IAEpL,MAAM,CAAC,QAAQ,WASb;IAEF,KAAK,EAAE,iBAAiB,CAAM;IAExB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;YAoCnB,UAAU;YA0BV,oBAAoB;YAqDpB,wBAAwB;YA2BxB,wBAAwB;CAevC"}
@@ -4,6 +4,7 @@ exports.Execute = exports.executePromptMessages = void 0;
4
4
  const core_1 = require("@oclif/core");
5
5
  const errors_1 = require("@oclif/core/errors");
6
6
  const file_loaders_1 = require("../helpers/file-loaders");
7
+ const extract_template_engine_1 = require("../helpers/extract-template-engine");
7
8
  const get_connections_request_1 = require("../http/get-connections-request");
8
9
  const send_template_execute_request_1 = require("../http/send-template-execute-request");
9
10
  const filter_connections_by_template_1 = require("../prompt-data/filter-connections-by-template");
@@ -48,6 +49,8 @@ class Execute extends refresh_connections_1.RefreshConnectionsCommand {
48
49
  static examples = [
49
50
  "$ <%= config.bin %> execute",
50
51
  "$ <%= config.bin %> execute --template-path=item/item.jsonata",
52
+ "$ <%= config.bin %> execute --template-path=item/item.js",
53
+ "$ <%= config.bin %> execute --template-path=item/item.ts",
51
54
  "$ <%= config.bin %> execute --template-path=variation/variation.jsonata",
52
55
  "$ <%= config.bin %> execute --template-path=item_group/item_group.jsonata --fixture-path=item_group.json",
53
56
  "$ <%= config.bin %> execute --template-path=grouping/grouping.jsonata --connection-id=example-connection-id",
@@ -58,10 +61,10 @@ class Execute extends refresh_connections_1.RefreshConnectionsCommand {
58
61
  try {
59
62
  const templateInput = await this.getTemplateExecInput();
60
63
  const config = await (0, ux_action_1.uxAction)("📡 Reading your config", async () => {
61
- return await (0, config_1.getRepositoryConfigFile)();
64
+ return await (0, config_1.getRepositoryConfigFile)({ useCloud: !this.isLocal });
62
65
  })();
63
66
  const result = await (0, send_template_execute_request_1.sendTemplateExecuteRequest)({
64
- template: (0, file_loaders_1.getJSONataTemplate)(templateInput.templatePath).toString(),
67
+ template: (0, file_loaders_1.getTemplate)(templateInput.templatePath).toString(),
65
68
  helpers: (await (0, template_source_code_1.getHelpersSourceCode)(config.helpers)) ?? "",
66
69
  data: (0, file_loaders_1.getCatalogFixture)(templateInput.fixturePath),
67
70
  external: templateInput.externalPath
@@ -70,6 +73,7 @@ class Execute extends refresh_connections_1.RefreshConnectionsCommand {
70
73
  connectionId: templateInput.connectionId,
71
74
  templateType: (0, extract_template_type_1.extractTemplateType)(templateInput.templatePath),
72
75
  overrideDate: templateInput.overrideDate,
76
+ engine: (0, extract_template_engine_1.extractTemplateEngine)(templateInput.templatePath),
73
77
  });
74
78
  (0, render_template_result_1.renderTemplateResult)(result);
75
79
  if (result.warnings.length > 0) {
@@ -1,8 +1,20 @@
1
1
  import { Command } from "@oclif/core";
2
2
  export declare abstract class RefreshConnectionsCommand extends Command {
3
3
  static description: string;
4
+ static baseFlags: {
5
+ cloud: import("@oclif/core/interfaces").BooleanFlag<boolean>;
6
+ };
7
+ protected isLocal: boolean;
4
8
  abstract runCommand(): Promise<any>;
5
9
  run(): Promise<any>;
10
+ /**
11
+ * Detects whether a connectrc.local.js file exists and configures
12
+ * the environment accordingly. When in local mode:
13
+ * - Sets HOST to http://localhost:3000 (unless already set)
14
+ * - Uses LOCAL_CONNECT_AUTH_TOKEN as the auth token
15
+ * - Skips auto-refresh of connections
16
+ */
17
+ private resolveLocalMode;
6
18
  /**
7
19
  * Checks if the connections list should be automatically refreshed if
8
20
  * 1) IS_CI environment variable is not true; and
@@ -1 +1 @@
1
- {"version":3,"file":"refresh-connections.d.ts","sourceRoot":"","sources":["../../src/commands/refresh-connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAKtC,8BAAsB,yBAA0B,SAAQ,OAAO;IAC7D,MAAM,CAAC,WAAW,SAAkC;IAEpD,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IAE7B,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IASzB;;;;;;;OAOG;IACH,OAAO,CAAC,4BAA4B;CAerC"}
1
+ {"version":3,"file":"refresh-connections.d.ts","sourceRoot":"","sources":["../../src/commands/refresh-connections.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAQ7C,8BAAsB,yBAA0B,SAAQ,OAAO;IAC7D,MAAM,CAAC,WAAW,SAAkC;IAEpD,MAAM,CAAC,SAAS;;MAMd;IAEF,SAAS,CAAC,OAAO,EAAE,OAAO,CAAS;IAEnC,QAAQ,CAAC,UAAU,IAAI,OAAO,CAAC,GAAG,CAAC;IAE7B,GAAG,IAAI,OAAO,CAAC,GAAG,CAAC;IAYzB;;;;;;OAMG;YACW,gBAAgB;IAoD9B;;;;;;;OAOG;IACH,OAAO,CAAC,4BAA4B;CAerC"}
@@ -2,18 +2,71 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.RefreshConnectionsCommand = void 0;
4
4
  const core_1 = require("@oclif/core");
5
+ const errors_1 = require("@oclif/core/errors");
6
+ const config_1 = require("../customer/config");
5
7
  const prepend_file_sync_1 = require("../helpers/prepend-file-sync");
6
8
  const refresh_connections_list_1 = require("../helpers/refresh-connections-list");
9
+ const render_tip_1 = require("../rendering/render-tip");
7
10
  class RefreshConnectionsCommand extends core_1.Command {
8
11
  static description = "Refresh the connections list";
12
+ static baseFlags = {
13
+ cloud: core_1.Flags.boolean({
14
+ description: "Use the cloud config (connectrc.js) even if a local config (connectrc.local.js) exists",
15
+ default: false,
16
+ }),
17
+ };
18
+ isLocal = false;
9
19
  async run() {
10
- if (this.shouldAutoRefreshConnections()) {
20
+ await this.resolveLocalMode();
21
+ if (!this.isLocal && this.shouldAutoRefreshConnections()) {
11
22
  await (0, refresh_connections_list_1.refreshConnectionsList)();
12
23
  }
13
24
  if (this.runCommand) {
14
25
  return await this.runCommand();
15
26
  }
16
27
  }
28
+ /**
29
+ * Detects whether a connectrc.local.js file exists and configures
30
+ * the environment accordingly. When in local mode:
31
+ * - Sets HOST to http://localhost:3000 (unless already set)
32
+ * - Uses LOCAL_CONNECT_AUTH_TOKEN as the auth token
33
+ * - Skips auto-refresh of connections
34
+ */
35
+ async resolveLocalMode() {
36
+ if (process.env.IS_CI === "true") {
37
+ this.isLocal = false;
38
+ return;
39
+ }
40
+ // Check if a local config file exists before parsing flags
41
+ const { isLocal: localExists } = await (0, config_1.resolveConfigFile)(false);
42
+ if (!localExists) {
43
+ this.isLocal = false;
44
+ return;
45
+ }
46
+ // Local config exists — check if --cloud flag overrides it
47
+ const { flags } = await this.parse(this.constructor);
48
+ if (flags.cloud) {
49
+ this.isLocal = false;
50
+ (0, render_tip_1.renderTip)(["--cloud: Using cloud config file (connectrc.js)."], {
51
+ emoji: "☁️",
52
+ });
53
+ return;
54
+ }
55
+ // Local mode is active
56
+ this.isLocal = true;
57
+ (0, render_tip_1.renderTip)([
58
+ "Using local config file (connectrc.local.js). Pass --cloud to override.",
59
+ ], { emoji: "📍" });
60
+ // Enforce LOCAL_CONNECT_AUTH_TOKEN
61
+ if (!process.env.LOCAL_CONNECT_AUTH_TOKEN) {
62
+ throw new errors_1.CLIError("LOCAL_CONNECT_AUTH_TOKEN is required for local deployments. Please set it in your .env file.");
63
+ }
64
+ // Set env vars so all downstream HTTP calls use the local config
65
+ process.env.CONNECT_AUTH_TOKEN = process.env.LOCAL_CONNECT_AUTH_TOKEN;
66
+ if (!process.env.HOST) {
67
+ process.env.HOST = "http://localhost:3000";
68
+ }
69
+ }
17
70
  /**
18
71
  * Checks if the connections list should be automatically refreshed if
19
72
  * 1) IS_CI environment variable is not true; and
@@ -1,11 +1,23 @@
1
1
  import { type Config, type ConnectionConfigDict } from "../types";
2
2
  /**
3
- * @returns The exported config from the connectrc.js file .
4
- * @throws CLIError if the connectrc.js file is not found or contains a syntax error.
5
- * @description This function attempts to load the connectrc.js file from the root directory of the repository.
6
- * If the file is not found, it throws a CLIError with a message indicating the expected path.
3
+ * Checks whether a `connectrc.local.js` file exists and resolves which config file to use.
4
+ *
5
+ * @param useCloud If true, always use the cloud config (connectrc.js) regardless of local file existence.
6
+ * @returns The resolved config path and whether the local config is being used.
7
7
  */
8
- export declare function getRepositoryConfigFile(): Promise<Config>;
8
+ export declare function resolveConfigFile(useCloud?: boolean): Promise<{
9
+ configPath: string;
10
+ isLocal: boolean;
11
+ }>;
12
+ /**
13
+ * @returns The exported config from the connectrc.js file (or connectrc.local.js if present and useCloud is false).
14
+ * @throws CLIError if the config file is not found or contains a syntax error.
15
+ * @description This function attempts to load the config file from the root directory of the repository.
16
+ * If connectrc.local.js exists and useCloud is false, it will be used instead of connectrc.js.
17
+ */
18
+ export declare function getRepositoryConfigFile({ useCloud, }?: {
19
+ useCloud?: boolean;
20
+ }): Promise<Config>;
9
21
  /**
10
22
  * Reads the content of the connectrc.js file and returns the connections object and the content of the file
11
23
  * @returns The connections object and the content of the connectrc.js file in {@link RawConfigContent}
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/customer/config.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIlE;;;;;GAKG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,CAAC,CAsC/D;AAED;;;GAGG;AACH,wBAAsB,iCAAiC,CAAC,EACtD,4BAAmC,GACpC;;CAAK,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA+CjC;AA+HD,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,oBAAoB,CAAC;CAC3C"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/customer/config.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAIlE;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,QAAQ,GAAE,OAAe,GACxB,OAAO,CAAC;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,OAAO,CAAA;CAAE,CAAC,CAcnD;AAED;;;;;GAKG;AACH,wBAAsB,uBAAuB,CAAC,EAC5C,QAAgB,GACjB,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,OAAO,CAAC,MAAM,CAAC,CA2C/C;AAED;;;GAGG;AACH,wBAAsB,iCAAiC,CAAC,EACtD,4BAAmC,GACpC;;CAAK,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA+CjC;AA+HD,UAAU,gBAAgB;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,oBAAoB,CAAC;CAC3C"}
@@ -33,6 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.resolveConfigFile = resolveConfigFile;
36
37
  exports.getRepositoryConfigFile = getRepositoryConfigFile;
37
38
  exports.getRepositoryConnectionsAndConfig = getRepositoryConnectionsAndConfig;
38
39
  const fs = __importStar(require("fs/promises"));
@@ -41,13 +42,36 @@ const errors_1 = require("@oclif/core/errors");
41
42
  const print_warnings_1 = require("../helpers/print-warnings");
42
43
  const path_1 = require("./path");
43
44
  /**
44
- * @returns The exported config from the connectrc.js file .
45
- * @throws CLIError if the connectrc.js file is not found or contains a syntax error.
46
- * @description This function attempts to load the connectrc.js file from the root directory of the repository.
47
- * If the file is not found, it throws a CLIError with a message indicating the expected path.
45
+ * Checks whether a `connectrc.local.js` file exists and resolves which config file to use.
46
+ *
47
+ * @param useCloud If true, always use the cloud config (connectrc.js) regardless of local file existence.
48
+ * @returns The resolved config path and whether the local config is being used.
48
49
  */
49
- async function getRepositoryConfigFile() {
50
- const configPath = (0, path_1.getCustomerOSSpecificPath)("connectrc.js");
50
+ async function resolveConfigFile(useCloud = false) {
51
+ if (!useCloud) {
52
+ const localPath = (0, path_1.getCustomerOSSpecificPath)("connectrc.local.js");
53
+ try {
54
+ await fs.access(localPath);
55
+ return { configPath: localPath, isLocal: true };
56
+ }
57
+ catch {
58
+ // local file doesn't exist, fall through
59
+ }
60
+ }
61
+ return {
62
+ configPath: (0, path_1.getCustomerOSSpecificPath)("connectrc.js"),
63
+ isLocal: false,
64
+ };
65
+ }
66
+ /**
67
+ * @returns The exported config from the connectrc.js file (or connectrc.local.js if present and useCloud is false).
68
+ * @throws CLIError if the config file is not found or contains a syntax error.
69
+ * @description This function attempts to load the config file from the root directory of the repository.
70
+ * If connectrc.local.js exists and useCloud is false, it will be used instead of connectrc.js.
71
+ */
72
+ async function getRepositoryConfigFile({ useCloud = false, } = {}) {
73
+ const { configPath, isLocal } = await resolveConfigFile(useCloud);
74
+ const configFileName = isLocal ? "connectrc.local.js" : "connectrc.js";
51
75
  try {
52
76
  return require(configPath);
53
77
  }
@@ -55,23 +79,23 @@ async function getRepositoryConfigFile() {
55
79
  // To get ux.warn to render properly, we need to stop the action first
56
80
  core_1.ux.action.stop("💥");
57
81
  if (error.code === "MODULE_NOT_FOUND") {
58
- throw new errors_1.CLIError(`💥 Could not find a connectrc.js file in the root directory!\nExpected to be at: ${configPath}`, {
82
+ throw new errors_1.CLIError(`💥 Could not find a ${configFileName} file in the root directory!\nExpected to be at: ${configPath}`, {
59
83
  code: error.code,
60
84
  suggestions: [
61
- "Make sure you have a connectrc.js file in the root directory of your repository.",
85
+ `Make sure you have a ${configFileName} file in the root directory of your repository.`,
62
86
  `If your root directory is not the same as your current working directory,
63
87
  you can set the \`REPOSITORY_ROOT_DIRECTORY\` environment variable as a relative path
64
- pointing to the correct connectrc.js directory.`,
88
+ pointing to the correct ${configFileName} directory.`,
65
89
  ],
66
90
  });
67
91
  }
68
92
  core_1.ux.warn(error.stack);
69
93
  if (error.name?.includes("SyntaxError")) {
70
- throw new errors_1.CLIError("💥 Syntax error found in your connectrc.js file!", {
94
+ throw new errors_1.CLIError(`💥 Syntax error found in your ${configFileName} file!`, {
71
95
  code: "SYNTAX_ERROR",
72
96
  });
73
97
  }
74
- throw new errors_1.CLIError("💥 Could not load your connectrc.js file! \nTake a look at the original error printed above.", {
98
+ throw new errors_1.CLIError(`💥 Could not load your ${configFileName} file! \nTake a look at the original error printed above.`, {
75
99
  code: error.code,
76
100
  });
77
101
  }
@@ -1 +1 @@
1
- {"version":3,"file":"execute-template.d.ts","sourceRoot":"","sources":["../../src/functions/execute-template.ts"],"names":[],"mappings":"AAWA,eAAO,MAAM,YAAY,qEAMf,CAAC;AAEX,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,mBAAmB,gCAwBjE"}
1
+ {"version":3,"file":"execute-template.d.ts","sourceRoot":"","sources":["../../src/functions/execute-template.ts"],"names":[],"mappings":"AAYA,eAAO,MAAM,YAAY,qEAMf,CAAC;AAEX,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,CAAC,OAAO,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,mBAAmB,gCAyBjE"}
@@ -9,6 +9,7 @@ const os_1 = __importDefault(require("os"));
9
9
  const path_1 = __importDefault(require("path"));
10
10
  const config_1 = require("../customer/config");
11
11
  const template_source_code_1 = require("../customer/template-source-code");
12
+ const extract_template_engine_1 = require("../helpers/extract-template-engine");
12
13
  const file_loaders_1 = require("../helpers/file-loaders");
13
14
  const print_warnings_1 = require("../helpers/print-warnings");
14
15
  const get_connections_request_1 = require("../http/get-connections-request");
@@ -37,7 +38,7 @@ async function executeTemplate(options) {
37
38
  const connection = await getConnection(options);
38
39
  const config = await (0, config_1.getRepositoryConfigFile)();
39
40
  const result = await (0, send_template_execute_request_1.sendTemplateExecuteRequest)({
40
- template: (0, file_loaders_1.getJSONataTemplate)(name).toString(),
41
+ template: (0, file_loaders_1.getTemplate)(name).toString(),
41
42
  helpers: (await (0, template_source_code_1.getHelpersSourceCode)(config.helpers)) ?? "",
42
43
  connectionId: connection.id,
43
44
  templateType: options.type,
@@ -45,6 +46,7 @@ async function executeTemplate(options) {
45
46
  showLogs: false,
46
47
  external,
47
48
  overrideDate,
49
+ engine: (0, extract_template_engine_1.extractTemplateEngine)(name),
48
50
  });
49
51
  if (!result.success) {
50
52
  throw new Error(`Error executing template: ${result.error.message}`);
@@ -0,0 +1,8 @@
1
+ import { type TemplatePath, type TemplateExecutionEngine } from "../types";
2
+ /**
3
+ * Extracts the template execution engine from the file extension.
4
+ * Throws if the extension is not a supported engine.
5
+ * Falls back to "jsonata" for files without an extension.
6
+ */
7
+ export declare function extractTemplateEngine(templatePath: TemplatePath): TemplateExecutionEngine;
8
+ //# sourceMappingURL=extract-template-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extract-template-engine.d.ts","sourceRoot":"","sources":["../../src/helpers/extract-template-engine.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,uBAAuB,EAC7B,MAAM,UAAU,CAAC;AAMlB;;;;GAIG;AACH,wBAAgB,qBAAqB,CACnC,YAAY,EAAE,YAAY,GACzB,uBAAuB,CAsBzB"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.extractTemplateEngine = extractTemplateEngine;
7
+ const path_1 = __importDefault(require("path"));
8
+ const errors_1 = require("@oclif/core/errors");
9
+ const types_1 = require("../types");
10
+ function isSupportedEngine(ext) {
11
+ return types_1.SupportedTemplateExecutionEngines.includes(ext);
12
+ }
13
+ /**
14
+ * Extracts the template execution engine from the file extension.
15
+ * Throws if the extension is not a supported engine.
16
+ * Falls back to "jsonata" for files without an extension.
17
+ */
18
+ function extractTemplateEngine(templatePath) {
19
+ const ext = path_1.default.extname(templatePath).slice(1);
20
+ const basename = path_1.default.basename(templatePath);
21
+ const isDotfile = !ext && basename.startsWith(".");
22
+ if (isDotfile) {
23
+ throw new errors_1.CLIError(`Dotfiles are not supported as template paths: "${templatePath}".`);
24
+ }
25
+ if (!ext) {
26
+ return "jsonata";
27
+ }
28
+ if (isSupportedEngine(ext)) {
29
+ return ext;
30
+ }
31
+ throw new errors_1.CLIError(`Unsupported template engine: "${ext}". Supported engines: ${types_1.SupportedTemplateExecutionEngines.join(", ")}`);
32
+ }
@@ -1,7 +1,7 @@
1
1
  import fs from "fs-extra";
2
2
  export declare const getCatalogFixture: (name: string, options?: fs.JsonReadOptions) => any;
3
3
  export declare const getExternalFixture: (name: string, options?: fs.JsonReadOptions) => any;
4
- export declare const getJSONataTemplate: (name: string, options?: BufferEncoding | (fs.ObjectEncodingOptions & {
4
+ export declare const getTemplate: (name: string, options?: BufferEncoding | (fs.ObjectEncodingOptions & {
5
5
  flag?: string | undefined;
6
6
  }) | null | undefined) => string | Buffer<ArrayBufferLike>;
7
7
  export declare function createFileLoader<T, S extends any[]>({ prefix, fileLoader, suggestions, }: Args<T, S>): (name: string, ...args: S) => T;
@@ -1 +1 @@
1
- {"version":3,"file":"file-loaders.d.ts","sourceRoot":"","sources":["../../src/helpers/file-loaders.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,UAAU,CAAC;AAI1B,eAAO,MAAM,iBAAiB,SAqBP,MAAM,sCAjB3B,CAAC;AAEH,eAAO,MAAM,kBAAkB,SAeR,MAAM,sCAX3B,CAAC;AAEH,eAAO,MAAM,kBAAkB,SASR,MAAM;;0DAN3B,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,GAAG,EAAE,EAAE,EACnD,MAAM,EACN,UAAU,EACV,WAAgB,GACjB,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAkB9C;AAED,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,GAAG,EAAE;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB"}
1
+ {"version":3,"file":"file-loaders.d.ts","sourceRoot":"","sources":["../../src/helpers/file-loaders.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,MAAM,UAAU,CAAC;AAI1B,eAAO,MAAM,iBAAiB,SAqBP,MAAM,sCAjB3B,CAAC;AAEH,eAAO,MAAM,kBAAkB,SAeR,MAAM,sCAX3B,CAAC;AAEH,eAAO,MAAM,WAAW,SASD,MAAM;;0DAN3B,CAAC;AAEH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,CAAC,SAAS,GAAG,EAAE,EAAE,EACnD,MAAM,EACN,UAAU,EACV,WAAgB,GACjB,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAkB9C;AAED,UAAU,IAAI,CAAC,CAAC,EAAE,CAAC,SAAS,GAAG,EAAE;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC;IAC9C,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB"}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.getJSONataTemplate = exports.getExternalFixture = exports.getCatalogFixture = void 0;
6
+ exports.getTemplate = exports.getExternalFixture = exports.getCatalogFixture = void 0;
7
7
  exports.createFileLoader = createFileLoader;
8
8
  const path_1 = __importDefault(require("path"));
9
9
  const errors_1 = require("@oclif/core/errors");
@@ -19,7 +19,7 @@ exports.getExternalFixture = createFileLoader({
19
19
  fileLoader: fs_extra_1.default.readJSONSync,
20
20
  suggestions: ["Ensure the file is a valid JSON file"],
21
21
  });
22
- exports.getJSONataTemplate = createFileLoader({
22
+ exports.getTemplate = createFileLoader({
23
23
  prefix: path_1.default.join("src", "templates"),
24
24
  fileLoader: fs_extra_1.default.readFileSync,
25
25
  });
@@ -1,5 +1,5 @@
1
- import { type TemplateExecutionSuccessResponse, type TemplateExecutionErrorResponse } from "../types";
2
- export declare function sendTemplateExecuteRequest({ template, helpers, data, external, connectionId, templateType, showLogs, overrideDate, }: Args): Promise<TemplateExecutionSuccessResponse | TemplateExecutionErrorResponse>;
1
+ import { type TemplateExecutionSuccessResponse, type TemplateExecutionErrorResponse, type TemplateExecutionEngine } from "../types";
2
+ export declare function sendTemplateExecuteRequest({ template, helpers, data, external, connectionId, templateType, showLogs, overrideDate, engine, }: Args): Promise<TemplateExecutionSuccessResponse | TemplateExecutionErrorResponse>;
3
3
  interface Args {
4
4
  template: string;
5
5
  helpers: string;
@@ -9,6 +9,7 @@ interface Args {
9
9
  templateType: string;
10
10
  showLogs?: boolean;
11
11
  overrideDate?: Date;
12
+ engine: TemplateExecutionEngine;
12
13
  }
13
14
  export {};
14
15
  //# sourceMappingURL=send-template-execute-request.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"send-template-execute-request.d.ts","sourceRoot":"","sources":["../../src/http/send-template-execute-request.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACpC,MAAM,UAAU,CAAC;AAIlB,wBAAsB,0BAA0B,CAAC,EAC/C,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,QAAe,EACf,YAAY,GACb,EAAE,IAAI,GAAG,OAAO,CACf,gCAAgC,GAAG,8BAA8B,CAClE,CA+BA;AAED,UAAU,IAAI;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,EAAE,GAAG,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,IAAI,CAAC;CACrB"}
1
+ {"version":3,"file":"send-template-execute-request.d.ts","sourceRoot":"","sources":["../../src/http/send-template-execute-request.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,KAAK,gCAAgC,EACrC,KAAK,8BAA8B,EACnC,KAAK,uBAAuB,EAC7B,MAAM,UAAU,CAAC;AAIlB,wBAAsB,0BAA0B,CAAC,EAC/C,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,QAAe,EACf,YAAY,EACZ,MAAM,GACP,EAAE,IAAI,GAAG,OAAO,CACf,gCAAgC,GAAG,8BAA8B,CAClE,CAgCA;AAED,UAAU,IAAI;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,GAAG,CAAC;IACV,QAAQ,EAAE,GAAG,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,YAAY,CAAC,EAAE,IAAI,CAAC;IACpB,MAAM,EAAE,uBAAuB,CAAC;CACjC"}
@@ -5,7 +5,7 @@ const axios_1 = require("axios");
5
5
  const errors_1 = require("@oclif/core/errors");
6
6
  const ux_action_1 = require("../helpers/ux-action");
7
7
  const http_client_1 = require("./http-client");
8
- async function sendTemplateExecuteRequest({ template, helpers, data, external, connectionId, templateType, showLogs = true, overrideDate, }) {
8
+ async function sendTemplateExecuteRequest({ template, helpers, data, external, connectionId, templateType, showLogs = true, overrideDate, engine, }) {
9
9
  const client = await (0, http_client_1.getHttpClient)();
10
10
  const httpRequest = async () => {
11
11
  return (await client.patch("templates/standalone/execute", {
@@ -15,7 +15,8 @@ async function sendTemplateExecuteRequest({ template, helpers, data, external, c
15
15
  external,
16
16
  connection_id: connectionId,
17
17
  template_type: templateType,
18
- ...(overrideDate ? { override_date: overrideDate.toISOString() } : {}),
18
+ override_date: overrideDate?.toISOString(),
19
+ engine,
19
20
  })).data;
20
21
  };
21
22
  try {
@@ -1 +1 @@
1
- {"version":3,"file":"get-template-files.d.ts","sourceRoot":"","sources":["../../src/prompt-data/get-template-files.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAgBvE"}
1
+ {"version":3,"file":"get-template-files.d.ts","sourceRoot":"","sources":["../../src/prompt-data/get-template-files.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,aAAa,EAEnB,MAAM,UAAU,CAAC;AAWlB;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC,CAevE"}
@@ -6,14 +6,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getTemplateFiles = getTemplateFiles;
7
7
  const path_1 = __importDefault(require("path"));
8
8
  const find_deep_files_1 = require("../helpers/find-deep-files");
9
+ const types_1 = require("../types");
9
10
  const path_2 = require("../customer/path");
11
+ const TEMPLATE_EXTENSIONS = new Set(types_1.SupportedTemplateExecutionEngines.map((ext) => `.${ext}`));
12
+ function hasSupportedExtension(file) {
13
+ return TEMPLATE_EXTENSIONS.has(path_1.default.extname(file));
14
+ }
10
15
  /**
11
16
  * Get a prompt-ready list of template files in the user repository
12
17
  */
13
18
  async function getTemplateFiles() {
14
19
  const filePath = path_1.default.join("src", "templates");
15
20
  const files = getTemplatePaths(filePath);
16
- const filteredFiles = files.filter((file) => file.endsWith(".jsonata") && !file.includes("helpers"));
21
+ const filteredFiles = files.filter((file) => hasSupportedExtension(file) && !file.includes("helpers"));
17
22
  return filteredFiles.map((file) => {
18
23
  const relativePath = (0, path_2.cleanupPath)(file);
19
24
  return {
package/dist/types.d.ts CHANGED
@@ -65,6 +65,9 @@ export declare enum CatalogFixtureType {
65
65
  MAPPING = "mapping"
66
66
  }
67
67
  export declare const TemplateTypes: readonly ["item", "variation", "item_group", "grouping", "mapping"];
68
+ /** The supported template execution engines. The backend uses these to determine how to evaluate a template. */
69
+ export declare const SupportedTemplateExecutionEngines: readonly ["jsonata", "js", "ts"];
70
+ export type TemplateExecutionEngine = (typeof SupportedTemplateExecutionEngines)[number];
68
71
  /**
69
72
  * The unix relative path of a given template.
70
73
  * With NO prefixed "/" or "./".
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,YAAY,EAAE,KAAK,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,KAAK,CAAC;YACf,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;YAC7C,cAAc,EAAE,MAAM,EAAE,CAAC;SAC1B,CAAC,CAAC;KACJ,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAErE,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAEjE,UAAU,aAAa;IACrB,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AACD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,QAAQ,EAAE,wBAAwB,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,wBAAwB,EAAE,CAAC;CACtC;AAED,oBAAY,kBAAkB;IAC5B,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,aAAa,qEAMhB,CAAC;AAEX;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,MAAM;IACrB,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,YAAY,EAAE,KAAK,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,KAAK,CAAC;YACf,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,YAAY,EAAE,MAAM,CAAC,CAAC,CAAC;YAC7C,cAAc,EAAE,MAAM,EAAE,CAAC;SAC1B,CAAC,CAAC;KACJ,CAAC,CAAC;CACJ;AAED,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,KAAK,EAAE,OAAO,CAAC;IACf,kBAAkB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACnC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,MAAM,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;AAErE,MAAM,MAAM,aAAa,CAAC,CAAC,IAAI,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAAC;AAEjE,UAAU,aAAa;IACrB,IAAI,EAAE,gBAAgB,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;CACpB;AACD,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC1B,QAAQ,EAAE,wBAAwB,EAAE,CAAC;CACtC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,KAAK,CAAC;IACf,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,wBAAwB,EAAE,CAAC;CACtC;AAED,oBAAY,kBAAkB;IAC5B,IAAI,SAAS;IACb,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,aAAa,kBAAkB;IAC/B,OAAO,YAAY;CACpB;AAED,eAAO,MAAM,aAAa,qEAMhB,CAAC;AAEX,gHAAgH;AAChH,eAAO,MAAM,iCAAiC,kCAIpC,CAAC;AAEX,MAAM,MAAM,uBAAuB,GACjC,CAAC,OAAO,iCAAiC,CAAC,CAAC,MAAM,CAAC,CAAC;AAErD;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC"}
package/dist/types.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.TemplateTypes = exports.CatalogFixtureType = void 0;
3
+ exports.SupportedTemplateExecutionEngines = exports.TemplateTypes = exports.CatalogFixtureType = void 0;
4
4
  var CatalogFixtureType;
5
5
  (function (CatalogFixtureType) {
6
6
  CatalogFixtureType["ITEM"] = "item";
@@ -16,3 +16,9 @@ exports.TemplateTypes = [
16
16
  "grouping",
17
17
  "mapping",
18
18
  ];
19
+ /** The supported template execution engines. The backend uses these to determine how to evaluate a template. */
20
+ exports.SupportedTemplateExecutionEngines = [
21
+ "jsonata",
22
+ "js",
23
+ "ts",
24
+ ];
package/dist/version.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- declare const _default: "1.18.0";
1
+ declare const _default: "1.18.2";
2
2
  export default _default;
3
3
  //# sourceMappingURL=version.d.ts.map
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = '1.18.0';
3
+ exports.default = '1.18.2';
@@ -23,6 +23,12 @@
23
23
  "$ <%= config.bin %> deploy production --force"
24
24
  ],
25
25
  "flags": {
26
+ "cloud": {
27
+ "description": "Use the cloud config (connectrc.js) even if a local config (connectrc.local.js) exists",
28
+ "name": "cloud",
29
+ "allowNo": false,
30
+ "type": "boolean"
31
+ },
26
32
  "force": {
27
33
  "char": "f",
28
34
  "description": "Skip tests before deploying",
@@ -53,12 +59,20 @@
53
59
  "examples": [
54
60
  "$ <%= config.bin %> execute",
55
61
  "$ <%= config.bin %> execute --template-path=item/item.jsonata",
62
+ "$ <%= config.bin %> execute --template-path=item/item.js",
63
+ "$ <%= config.bin %> execute --template-path=item/item.ts",
56
64
  "$ <%= config.bin %> execute --template-path=variation/variation.jsonata",
57
65
  "$ <%= config.bin %> execute --template-path=item_group/item_group.jsonata --fixture-path=item_group.json",
58
66
  "$ <%= config.bin %> execute --template-path=grouping/grouping.jsonata --connection-id=example-connection-id",
59
67
  "$ <%= config.bin %> execute --template-path=mapping/mapping.jsonata"
60
68
  ],
61
69
  "flags": {
70
+ "cloud": {
71
+ "description": "Use the cloud config (connectrc.js) even if a local config (connectrc.local.js) exists",
72
+ "name": "cloud",
73
+ "allowNo": false,
74
+ "type": "boolean"
75
+ },
62
76
  "template-path": {
63
77
  "description": "The path to the template to execute. Must be in the 'src/templates' directory.",
64
78
  "name": "template-path",
@@ -123,6 +137,12 @@
123
137
  "$ <%= config.bin %> generate-fixture --connection=my-connection-id --type=variation --filename=my-fixture.json --replace-file"
124
138
  ],
125
139
  "flags": {
140
+ "cloud": {
141
+ "description": "Use the cloud config (connectrc.js) even if a local config (connectrc.local.js) exists",
142
+ "name": "cloud",
143
+ "allowNo": false,
144
+ "type": "boolean"
145
+ },
126
146
  "connection": {
127
147
  "description": "The connection to generate the fixture for",
128
148
  "name": "connection",
@@ -237,7 +257,14 @@
237
257
  "aliases": [],
238
258
  "args": {},
239
259
  "description": "Refresh the connections list",
240
- "flags": {},
260
+ "flags": {
261
+ "cloud": {
262
+ "description": "Use the cloud config (connectrc.js) even if a local config (connectrc.local.js) exists",
263
+ "name": "cloud",
264
+ "allowNo": false,
265
+ "type": "boolean"
266
+ }
267
+ },
241
268
  "hasDynamicHelp": false,
242
269
  "hiddenAliases": [],
243
270
  "id": "refresh-connections",
@@ -260,7 +287,14 @@
260
287
  "examples": [
261
288
  "$ <%= config.bin %>"
262
289
  ],
263
- "flags": {},
290
+ "flags": {
291
+ "cloud": {
292
+ "description": "Use the cloud config (connectrc.js) even if a local config (connectrc.local.js) exists",
293
+ "name": "cloud",
294
+ "allowNo": false,
295
+ "type": "boolean"
296
+ }
297
+ },
264
298
  "hasDynamicHelp": false,
265
299
  "hiddenAliases": [],
266
300
  "id": "trigger-catalog-sync",
@@ -277,5 +311,5 @@
277
311
  ]
278
312
  }
279
313
  },
280
- "version": "1.18.0"
314
+ "version": "1.18.2"
281
315
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constructor-io/constructorio-connect-cli",
3
- "version": "1.18.0",
3
+ "version": "1.18.2",
4
4
  "description": "CLI tool to enable users to interface with the Constructor Connect Ecosystem",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -92,7 +92,7 @@
92
92
  "globals": "^16.0.0",
93
93
  "jest": "^29.7.0",
94
94
  "license-checker": "^25.0.1",
95
- "markdownlint-cli2": "^0.21.0",
95
+ "markdownlint-cli2": "^0.22.0",
96
96
  "mock-fs": "^5.2.0",
97
97
  "nock": "14.0.11",
98
98
  "oclif": "^4.17.42",