@speedkit/cli 2.14.2 → 2.15.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.
Files changed (111) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +5 -2
  3. package/dist/commands/generate-pop-config.js +6 -5
  4. package/dist/dummy.spec.js +4 -4
  5. package/dist/helpers/build-query-helper.js +49 -35
  6. package/dist/helpers/file-helper.d.ts +2 -8
  7. package/dist/helpers/file-helper.js +6 -41
  8. package/dist/helpers/get-parsed-config.js +7 -7
  9. package/dist/helpers/getChromePath.js +11 -7
  10. package/dist/helpers/isDirectory.js +1 -1
  11. package/dist/helpers/isFile.js +1 -1
  12. package/dist/helpers/normalize.d.ts +2 -0
  13. package/dist/helpers/normalize.js +14 -12
  14. package/dist/helpers/race.js +3 -1
  15. package/dist/helpers/scrape.js +3 -2
  16. package/dist/helpers/speedKitRuleToRegExp.js +2 -2
  17. package/dist/models/cli-parameters.d.ts +2 -2
  18. package/dist/models/cli-parameters.js +8 -2
  19. package/dist/models/files.js +13 -13
  20. package/dist/services/athena/athena-service-factory.d.ts +13 -0
  21. package/dist/services/athena/athena-service-factory.js +40 -0
  22. package/dist/services/athena/athena-service-model.d.ts +4 -0
  23. package/dist/services/athena/athena-service-model.js +7 -0
  24. package/dist/services/{athena-service.d.ts → athena/athena-service.d.ts} +4 -8
  25. package/dist/services/{athena-service.js → athena/athena-service.js} +12 -36
  26. package/dist/services/athena/error/fetch-credentials-error.d.ts +2 -0
  27. package/dist/services/athena/error/fetch-credentials-error.js +6 -0
  28. package/dist/services/athena/index.d.ts +4 -0
  29. package/dist/services/athena/index.js +7 -0
  30. package/dist/services/bundler/bundle-service-factory.d.ts +1 -1
  31. package/dist/services/bundler/bundle-service.d.ts +2 -2
  32. package/dist/services/bundler/bundle-service.js +29 -23
  33. package/dist/services/bundler/index.d.ts +2 -2
  34. package/dist/services/cli/cli-service.js +5 -5
  35. package/dist/services/cli/hooks.js +2 -2
  36. package/dist/services/cli/index.d.ts +3 -3
  37. package/dist/services/config-api/client.d.ts +1 -1
  38. package/dist/services/config-api/client.js +9 -7
  39. package/dist/services/config-api/config-api-service.js +20 -8
  40. package/dist/services/config-api/factory/config-api-service-factory.js +1 -1
  41. package/dist/services/config-api/interface/request-extension-interface.d.ts +2 -2
  42. package/dist/services/customer-config/customer-config-service-context.js +1 -1
  43. package/dist/services/customer-config/customer-config-service.d.ts +1 -0
  44. package/dist/services/customer-config/customer-config-service.js +68 -57
  45. package/dist/services/customer-config/index.d.ts +4 -4
  46. package/dist/services/deploy/builder/install-resource-builder.js +9 -7
  47. package/dist/services/deploy/checks/post-deploy/revalidated-module-check.js +2 -2
  48. package/dist/services/deploy/checks/post-deploy/save-files-check.js +2 -2
  49. package/dist/services/deploy/deploy-service.js +7 -7
  50. package/dist/services/deploy/handler/customer-config-handler.js +12 -11
  51. package/dist/services/deploy/handler/install-resource-handler.js +14 -12
  52. package/dist/services/deploy/handler/install-resource-modifier/deleted-file-check.js +10 -10
  53. package/dist/services/deploy/handler/module-handler.js +9 -9
  54. package/dist/services/deploy/handler/module-modifier/deployment-detection-modifier.js +2 -2
  55. package/dist/services/deploy/handler/server-config-handler.js +4 -4
  56. package/dist/services/deploy/interface/install.d.ts +1 -1
  57. package/dist/services/document-handler-runtime/context/document-handler-runtime-context.js +37 -18
  58. package/dist/services/document-handler-runtime/document-handler-runtime-service.js +45 -35
  59. package/dist/services/document-handler-runtime/document-handler-server.js +56 -33
  60. package/dist/services/document-handler-runtime/error/handler/required-file-not-found-handler.js +1 -1
  61. package/dist/services/document-handler-runtime/factory/document-handler-runtime-service-factory.js +20 -16
  62. package/dist/services/document-handler-runtime/templates/abstract-template.d.ts +1 -1
  63. package/dist/services/document-handler-runtime/templates/abstract-template.js +1 -1
  64. package/dist/services/error-handling/abstract/abstract-async-error-handling-factory.js +1 -1
  65. package/dist/services/error-handling/abstract/abstract-async-error-handling-service.js +1 -1
  66. package/dist/services/error-handling/abstract/abstract-error-handling-factory.js +1 -1
  67. package/dist/services/error-handling/abstract/abstract-error-handling-service.js +1 -1
  68. package/dist/services/error-handling/error/handler/default-error-handler.d.ts +1 -1
  69. package/dist/services/error-handling/error/handler/default-error-handler.js +1 -1
  70. package/dist/services/error-handling/error-handling-service.js +2 -2
  71. package/dist/services/integration-api/context/integration-api-context.js +1 -1
  72. package/dist/services/integration-api/external/external-file-reader.js +1 -1
  73. package/dist/services/integration-api/factory/integration-api-service-factory.js +3 -3
  74. package/dist/services/integration-api/file-list.js +6 -4
  75. package/dist/services/integration-api/file-reader.js +17 -12
  76. package/dist/services/integration-api/handler/file-handler.d.ts +1 -1
  77. package/dist/services/integration-api/handler/file-handler.js +8 -4
  78. package/dist/services/integration-api/handler/install-resource-handler.js +21 -20
  79. package/dist/services/integration-api/handler/server-config-handler.js +1 -3
  80. package/dist/services/integration-api/integration-api-model.d.ts +2 -2
  81. package/dist/services/integration-api/integration-api-service.js +10 -7
  82. package/dist/services/integration-api/struct/customer-config.js +3 -2
  83. package/dist/services/integration-api/struct/file.js +4 -4
  84. package/dist/services/integration-api/struct/module-file.d.ts +1 -1
  85. package/dist/services/integration-api/struct/module-file.js +3 -1
  86. package/dist/services/integration-api/struct/server-config-file.d.ts +1 -1
  87. package/dist/services/integration-api/validator/customer-config-validator.js +13 -4
  88. package/dist/services/integration-api/validator/mandatory-files-validator.js +9 -5
  89. package/dist/services/integration-api/virtual/virtual-file-handler.js +1 -1
  90. package/dist/services/onboarding/dashboard/frontend-dist/assets/{index-87b53ed4.css → index-e3bd4f6e.css} +1 -1
  91. package/dist/services/onboarding/dashboard/frontend-dist/assets/{main-274b5625.js → main-215271c2.js} +3 -3
  92. package/dist/services/onboarding/dashboard/frontend-dist/index.html +2 -2
  93. package/dist/services/onboarding/dashboard/index.d.ts +2 -1
  94. package/dist/services/onboarding/dashboard/index.js +6 -5
  95. package/dist/services/onboarding/dashboard/request-diff-service.d.ts +4 -2
  96. package/dist/services/onboarding/dashboard/request-diff-service.js +23 -14
  97. package/dist/services/onboarding/onboarding-service-factory.d.ts +0 -1
  98. package/dist/services/onboarding/onboarding-service-factory.js +9 -34
  99. package/dist/services/pop-config/index.d.ts +3 -0
  100. package/dist/services/pop-config/index.js +6 -0
  101. package/dist/services/pop-config/pop-config-factory.d.ts +4 -0
  102. package/dist/services/pop-config/pop-config-factory.js +12 -0
  103. package/dist/services/pop-config/pop-config-model.d.ts +6 -0
  104. package/dist/services/pop-config/pop-config-model.js +2 -0
  105. package/dist/services/pop-config/pop-config-service.d.ts +7 -0
  106. package/dist/services/pop-config/pop-config-service.js +39 -0
  107. package/dist/services/prewarm-service.js +22 -16
  108. package/oclif.manifest.json +1 -1
  109. package/package.json +4 -6
  110. package/dist/services/onboarding/dashboard/athena-service.d.ts +0 -11
  111. package/dist/services/onboarding/dashboard/athena-service.js +0 -75
@@ -3,21 +3,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.INTEGRATION_FILES = void 0;
4
4
  exports.INTEGRATION_FILES = {
5
5
  CONFIG: {
6
- CUSTOMER: 'config_customer',
7
- SPEED_KIT: 'config_SpeedKit',
8
- DOCUMENT_HANDLER: 'config_documentHandler',
9
- DYNAMIC_BLOCKS: 'config_dynamicBlocks',
10
- LOAD_HANDLER: 'config_loadHandler',
11
- DYNAMIC_STYLES: 'config_dynamicStyles'
6
+ CUSTOMER: "config_customer",
7
+ SPEED_KIT: "config_SpeedKit",
8
+ DOCUMENT_HANDLER: "config_documentHandler",
9
+ DYNAMIC_BLOCKS: "config_dynamicBlocks",
10
+ LOAD_HANDLER: "config_loadHandler",
11
+ DYNAMIC_STYLES: "config_dynamicStyles",
12
12
  },
13
13
  CUSTOM: {
14
- LOADER: 'custom_loader',
15
- SW: 'custom_sw',
16
- DOCUMENT_HANDLER: 'custom_documentHandler',
17
- DYNAMIC_FETCHER: 'custom_dynamicFetcher',
14
+ LOADER: "custom_loader",
15
+ SW: "custom_sw",
16
+ DOCUMENT_HANDLER: "custom_documentHandler",
17
+ DYNAMIC_FETCHER: "custom_dynamicFetcher",
18
18
  },
19
19
  BUILD: {
20
- INSTALL: 'bundle_install',
21
- DOCUMENT_HANDLER: 'bundle_documentHandler',
22
- }
20
+ INSTALL: "bundle_install",
21
+ DOCUMENT_HANDLER: "bundle_documentHandler",
22
+ },
23
23
  };
@@ -0,0 +1,13 @@
1
+ import { AthenaService } from "./athena-service";
2
+ export declare class AthenaServiceFactory {
3
+ service?: AthenaService;
4
+ getService(): Promise<AthenaService>;
5
+ private createService;
6
+ /**
7
+ * create awsAthenaClient
8
+ *
9
+ * @param cli
10
+ * @private
11
+ */
12
+ private getAthenaClient;
13
+ }
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AthenaServiceFactory = void 0;
4
+ const client_athena_1 = require("@aws-sdk/client-athena");
5
+ const safe_1 = require("../../helpers/safe");
6
+ const cli_1 = require("../cli");
7
+ const _1 = require("./");
8
+ const athena_service_1 = require("./athena-service");
9
+ class AthenaServiceFactory {
10
+ service;
11
+ async getService() {
12
+ if (!(this.service instanceof athena_service_1.AthenaService)) {
13
+ this.service = await this.createService();
14
+ }
15
+ return this.service;
16
+ }
17
+ async createService() {
18
+ const cli = new cli_1.CliServiceFactory().getService();
19
+ const client = await this.getAthenaClient(cli);
20
+ return new athena_service_1.AthenaService(client);
21
+ }
22
+ /**
23
+ * create awsAthenaClient
24
+ *
25
+ * @param cli
26
+ * @private
27
+ */
28
+ async getAthenaClient(cli) {
29
+ const client = new client_athena_1.AthenaClient(_1.ATHENA_CONFIG);
30
+ cli.startAction("check for aws credentials");
31
+ const credentialsResult = await (0, safe_1.safe)(client.config.credentials());
32
+ if (credentialsResult.success === true) {
33
+ cli.endAction(cli_1.CliActionStatus.COMPLETED);
34
+ return client;
35
+ }
36
+ cli.endAction(cli_1.CliActionStatus.FAILED);
37
+ throw new _1.FetchCredentialsError(credentialsResult.error);
38
+ }
39
+ }
40
+ exports.AthenaServiceFactory = AthenaServiceFactory;
@@ -0,0 +1,4 @@
1
+ export declare const DEFAULT_MAX_AGE_IN_MINUTES = 60;
2
+ export declare const ATHENA_CONFIG: {
3
+ region: string;
4
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ATHENA_CONFIG = exports.DEFAULT_MAX_AGE_IN_MINUTES = void 0;
4
+ exports.DEFAULT_MAX_AGE_IN_MINUTES = 60;
5
+ exports.ATHENA_CONFIG = {
6
+ region: "eu-central-1",
7
+ };
@@ -1,12 +1,8 @@
1
- export type UsedPopsPerOrigin = {
2
- hits: number;
3
- origin: string;
4
- pop: string;
5
- region: string;
6
- };
1
+ import { AthenaClient } from "@aws-sdk/client-athena";
7
2
  export declare class AthenaService {
8
3
  private client;
9
- getUsedPopsPerOrigin(app: string, useRum: any): Promise<UsedPopsPerOrigin[]>;
4
+ constructor(client: AthenaClient);
5
+ getResult<T>(query: string, parameters?: string[], maxAgeInMinutes?: number): Promise<T[]>;
10
6
  private castValueToType;
11
7
  /**
12
8
  * Fetch the query result of the given query id, if the result is still available
@@ -19,7 +15,7 @@ export declare class AthenaService {
19
15
  * Runs the given SQL query against Athena and returns the query id when the query has successfully been executed.
20
16
  * @param sql - The query to execute
21
17
  * @param parameters - the parameters ? which should be passed to the query. In the order they are occurring in the query
22
- * @param useCacheTTLMinutes - enable query caching to the given amount of minutes, if the same query is
18
+ * @param maxAgeInMinutes - enable query caching to the given amount of minutes, if the same query is
23
19
  * issued within the cached time causes that the results from the previous execution will be returned without any
24
20
  * additional costs
25
21
  * @return The query id which can be used to fetch the query results
@@ -2,38 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AthenaService = void 0;
4
4
  const client_athena_1 = require("@aws-sdk/client-athena");
5
+ const athena_service_model_1 = require("./athena-service-model");
5
6
  class AthenaService {
6
- client = new client_athena_1.AthenaClient({ region: "eu-central-1" });
7
- async getUsedPopsPerOrigin(app, useRum) {
8
- const query = `
9
- with data as (
10
- select
11
- *,
12
- coalesce('https://' || url_extract_host(assetUrl) || regexp_extract(url_extract_path(assetUrl), '(?i)/([a-z]{2}([-/_][a-z]{2})*/)', 0), 'Unknown') as originWithPrefix
13
- from fastly.logs
14
- where date between ? and ?
15
- and app = ?
16
- and ${useRum ? "ispibeacon" : "isassetrequest and isnavigaterequest"}
17
- and client.bot is null
18
- and origin not in('Unknown', '')
19
- )
20
-
21
- select
22
- region,
23
- pop,
24
- coalesce(originWithPrefix, origin) as origin,
25
- count() as hits
26
- from data
27
- group by grouping sets (
28
- (region, pop, origin),
29
- (region, pop, origin, originWithPrefix)
30
- )
31
- having originWithPrefix is null or originWithPrefix <> 'Unknown'`;
32
- const endDate = new Date();
33
- const startDate = new Date(endDate.getFullYear(), endDate.getMonth(), endDate.getDate() - 7);
34
- const start = startDate.toISOString().slice(0, 10);
35
- const end = endDate.toISOString().slice(0, 10);
36
- const queryId = await this.runQuery(query, [start, end, app], 12 * 60);
7
+ client;
8
+ constructor(client) {
9
+ this.client = client;
10
+ }
11
+ async getResult(query, parameters = [], maxAgeInMinutes = athena_service_model_1.DEFAULT_MAX_AGE_IN_MINUTES) {
12
+ const queryId = await this.runQuery(query, parameters, maxAgeInMinutes);
37
13
  return (await this.fetchResult(queryId));
38
14
  }
39
15
  castValueToType(value, type) {
@@ -87,15 +63,15 @@ class AthenaService {
87
63
  * Runs the given SQL query against Athena and returns the query id when the query has successfully been executed.
88
64
  * @param sql - The query to execute
89
65
  * @param parameters - the parameters ? which should be passed to the query. In the order they are occurring in the query
90
- * @param useCacheTTLMinutes - enable query caching to the given amount of minutes, if the same query is
66
+ * @param maxAgeInMinutes - enable query caching to the given amount of minutes, if the same query is
91
67
  * issued within the cached time causes that the results from the previous execution will be returned without any
92
68
  * additional costs
93
69
  * @return The query id which can be used to fetch the query results
94
70
  */
95
- async runQuery(sql, parameters, useCacheTTLMinutes = 60) {
96
- const ExecutionParameters = parameters.map((value) => typeof value === "string" ? `'${value}'` : String(value));
71
+ async runQuery(sql, parameters, maxAgeInMinutes) {
72
+ const executionParameters = parameters.map((value) => typeof value === "string" ? `'${value}'` : String(value));
97
73
  const command = new client_athena_1.StartQueryExecutionCommand({
98
- ExecutionParameters,
74
+ ExecutionParameters: executionParameters.length > 0 ? executionParameters : null,
99
75
  QueryExecutionContext: {
100
76
  Catalog: "live",
101
77
  },
@@ -103,7 +79,7 @@ class AthenaService {
103
79
  ResultReuseConfiguration: {
104
80
  ResultReuseByAgeConfiguration: {
105
81
  Enabled: true,
106
- MaxAgeInMinutes: useCacheTTLMinutes,
82
+ MaxAgeInMinutes: maxAgeInMinutes,
107
83
  },
108
84
  },
109
85
  });
@@ -0,0 +1,2 @@
1
+ export declare class FetchCredentialsError extends Error {
2
+ }
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FetchCredentialsError = void 0;
4
+ class FetchCredentialsError extends Error {
5
+ }
6
+ exports.FetchCredentialsError = FetchCredentialsError;
@@ -0,0 +1,4 @@
1
+ export * from "./athena-service";
2
+ export * from "./athena-service-factory";
3
+ export * from "./athena-service-model";
4
+ export * from "./error/fetch-credentials-error";
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const tslib_1 = require("tslib");
4
+ tslib_1.__exportStar(require("./athena-service"), exports);
5
+ tslib_1.__exportStar(require("./athena-service-factory"), exports);
6
+ tslib_1.__exportStar(require("./athena-service-model"), exports);
7
+ tslib_1.__exportStar(require("./error/fetch-credentials-error"), exports);
@@ -1,4 +1,4 @@
1
- import { BundleService } from './bundle-service';
1
+ import { BundleService } from "./bundle-service";
2
2
  export declare class BundleServiceFactory {
3
3
  buildService(): BundleService;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { PluginBuild, LogLevel } from 'esbuild';
1
+ import { PluginBuild, LogLevel } from "esbuild";
2
2
  export type BundleEntryPoints = {
3
3
  [entryPoint: string]: string;
4
4
  };
@@ -6,7 +6,7 @@ export type BundleBasePaths = {
6
6
  [basePath: string]: string;
7
7
  };
8
8
  export declare class BundleService {
9
- bundle({ entryPoints, basePaths, define, target, minify, logLevel }: {
9
+ bundle({ entryPoints, basePaths, define, target, minify, logLevel, }: {
10
10
  entryPoints: BundleEntryPoints;
11
11
  basePaths: BundleBasePaths;
12
12
  target?: string | string[];
@@ -7,64 +7,70 @@ const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
7
7
  const node_url_1 = require("node:url");
8
8
  const importCache = {};
9
9
  class BundleService {
10
- async bundle({ entryPoints, basePaths, define, target = 'es5', minify = true, logLevel = 'silent' }) {
10
+ async bundle({ entryPoints, basePaths, define, target = "es5", minify = true, logLevel = "silent", }) {
11
11
  const result = await (0, esbuild_1.build)({
12
- plugins: [this.baqendPlugin(basePaths), this.entryPointsPlugin(entryPoints)],
12
+ plugins: [
13
+ this.baqendPlugin(basePaths),
14
+ this.entryPointsPlugin(entryPoints),
15
+ ],
13
16
  bundle: true,
14
17
  target,
15
18
  define,
16
19
  write: false,
17
20
  minify,
18
- outdir: 'out',
21
+ outdir: "out",
19
22
  entryPoints: Object.keys(entryPoints),
20
23
  logLevel,
21
24
  });
22
- return result.outputFiles.map(e => e.text).join('').trim();
25
+ return result.outputFiles
26
+ .map((e) => e.text)
27
+ .join("")
28
+ .trim();
23
29
  }
24
30
  entryPointsPlugin(entryPoints) {
25
31
  return {
26
- name: 'entryPoints',
32
+ name: "entryPoints",
27
33
  setup(build) {
28
- build.onResolve({ filter: /.*/ }, args => {
34
+ build.onResolve({ filter: /.*/ }, (args) => {
29
35
  if (!entryPoints[args.path]) {
30
- throw new Error('Could not resolve ' + args.path);
36
+ throw new Error("Could not resolve " + args.path);
31
37
  }
32
- return ({
38
+ return {
33
39
  path: args.path,
34
- namespace: 'entryPoint',
35
- });
40
+ namespace: "entryPoint",
41
+ };
36
42
  });
37
- build.onLoad({ filter: /.*/, namespace: 'entryPoint' }, (args) => {
43
+ build.onLoad({ filter: /.*/, namespace: "entryPoint" }, (args) => {
38
44
  return {
39
45
  contents: entryPoints[args.path],
40
- loader: 'js',
46
+ loader: "js",
41
47
  };
42
48
  });
43
49
  },
44
50
  };
45
51
  }
46
52
  baqendPlugin(basePaths) {
47
- const filter = new RegExp(`^(${Object.keys(basePaths).join('|')})/`);
53
+ const filter = new RegExp(`^(${Object.keys(basePaths).join("|")})/`);
48
54
  return {
49
- name: 'baqend',
55
+ name: "baqend",
50
56
  setup(build) {
51
- build.onResolve({ filter }, args => {
52
- const [base, path] = args.path.split('/', 2);
57
+ build.onResolve({ filter }, (args) => {
58
+ const [base, path] = args.path.split("/", 2);
53
59
  const url = new node_url_1.URL(path, basePaths[base]).toString();
54
60
  if (!url.startsWith(basePaths[base])) {
55
61
  throw new Error(`Importing ${path} failed. Can't resolve the path`);
56
62
  }
57
- return ({
63
+ return {
58
64
  path: url,
59
- namespace: 'baqend-url',
60
- });
65
+ namespace: "baqend-url",
66
+ };
61
67
  });
62
- build.onResolve({ filter: /.*/, namespace: 'baqend-url' }, args => ({
68
+ build.onResolve({ filter: /.*/, namespace: "baqend-url" }, (args) => ({
63
69
  path: new node_url_1.URL(args.path, args.importer).toString(),
64
70
  namespace: args.namespace,
65
71
  }));
66
- build.onLoad({ filter: /.*/, namespace: 'baqend-url' }, async (args) => {
67
- const url = args.path + (!args.path.endsWith('.js') ? '.js' : '');
72
+ build.onLoad({ filter: /.*/, namespace: "baqend-url" }, async (args) => {
73
+ const url = args.path + (!args.path.endsWith(".js") ? ".js" : "");
68
74
  if (importCache[url]) {
69
75
  return { contents: importCache[url] };
70
76
  }
@@ -73,7 +79,7 @@ class BundleService {
73
79
  throw new Error(`Importing ${url} failed with error ${fetched.status}`);
74
80
  }
75
81
  let text = await fetched.text();
76
- text = text.replace('window.SpeedKit=window.SpeedKit||{},window.SpeedKit.plugins=window.SpeedKit.plugins||{},window.SpeedKit.plugins.', 'export var ');
82
+ text = text.replace("window.SpeedKit=window.SpeedKit||{},window.SpeedKit.plugins=window.SpeedKit.plugins||{},window.SpeedKit.plugins.", "export var ");
77
83
  importCache[url] = text;
78
84
  return { contents: text };
79
85
  });
@@ -1,2 +1,2 @@
1
- export * from './bundle-service-factory';
2
- export * from './bundle-service';
1
+ export * from "./bundle-service-factory";
2
+ export * from "./bundle-service";
@@ -10,7 +10,7 @@ class CliService {
10
10
  buffer = [];
11
11
  style = chalk_1.default;
12
12
  codeStyle(code) {
13
- const padding = ' ';
13
+ const padding = " ";
14
14
  return this.style.bgGray.rgb(230, 126, 0)(`${padding}${code}${padding}`);
15
15
  }
16
16
  write(message, buffered = false) {
@@ -21,7 +21,7 @@ class CliService {
21
21
  core_1.ux.info(message);
22
22
  }
23
23
  spacer() {
24
- core_1.ux.info('');
24
+ core_1.ux.info("");
25
25
  }
26
26
  writeSuccess(message, buffered = false) {
27
27
  if (buffered) {
@@ -64,8 +64,8 @@ class CliService {
64
64
  return (0, prompts_1.input)({
65
65
  message: this.getFormattedMessage(message),
66
66
  default: defaultAnswer,
67
- validate: input => {
68
- if (typeof validator !== 'function')
67
+ validate: (input) => {
68
+ if (typeof validator !== "function")
69
69
  return true;
70
70
  const errorMessage = validator(input);
71
71
  if (!errorMessage) {
@@ -84,7 +84,7 @@ class CliService {
84
84
  async select(message, choices) {
85
85
  return (0, prompts_1.select)({
86
86
  message: this.getFormattedMessage(message),
87
- choices
87
+ choices,
88
88
  });
89
89
  }
90
90
  startAction(message) {
@@ -20,14 +20,14 @@ class Hooks {
20
20
  return;
21
21
  }
22
22
  this.cli.writeSuccess(this.preHook);
23
- this.cli.write((0, child_process_1.execSync)(this.preHook) + '');
23
+ this.cli.write((0, child_process_1.execSync)(this.preHook) + "");
24
24
  }
25
25
  async runPostHook() {
26
26
  if (!this.postHook) {
27
27
  return;
28
28
  }
29
29
  this.cli.writeSuccess(this.postHook);
30
- this.cli.write((0, child_process_1.execSync)(this.postHook) + '');
30
+ this.cli.write((0, child_process_1.execSync)(this.postHook) + "");
31
31
  }
32
32
  }
33
33
  exports.default = Hooks;
@@ -1,3 +1,3 @@
1
- export * from './cli-service';
2
- export * from './cli-service-model';
3
- export * from './cli-service-factory';
1
+ export * from "./cli-service";
2
+ export * from "./cli-service-model";
3
+ export * from "./cli-service-factory";
@@ -11,6 +11,6 @@ export default class Client {
11
11
  /**
12
12
  * @param requestExtension
13
13
  */
14
- createRequest(requestExtension: RequestExtensionInterface): Promise<{}>;
14
+ createRequest(requestExtension: RequestExtensionInterface): Promise<NonNullable<unknown>>;
15
15
  private getEntityManager;
16
16
  }
@@ -6,7 +6,7 @@ const node_fetch_1 = tslib_1.__importDefault(require("node-fetch"));
6
6
  const deepmerge_1 = tslib_1.__importDefault(require("deepmerge"));
7
7
  const race_1 = require("../../helpers/race");
8
8
  const REQUEST_TIMEOUT = 10_000;
9
- const CONTENT_TYPE = 'application/json;charset=UTF-8';
9
+ const CONTENT_TYPE = "application/json;charset=UTF-8";
10
10
  class Client {
11
11
  entityManagerFactory;
12
12
  app;
@@ -25,27 +25,29 @@ class Client {
25
25
  }
26
26
  async getModule(moduleName) {
27
27
  const entityManager = await this.getEntityManager();
28
- return await entityManager.code.loadCode(moduleName, 'module');
28
+ return await entityManager.code.loadCode(moduleName, "module");
29
29
  }
30
30
  async setModule(moduleName, moduleCode) {
31
31
  const entityManager = await this.getEntityManager();
32
- return await entityManager.code.saveCode(moduleName, 'module', moduleCode);
32
+ return await entityManager.code.saveCode(moduleName, "module", moduleCode);
33
33
  }
34
34
  /**
35
35
  * @param requestExtension
36
36
  */
37
37
  async createRequest(requestExtension) {
38
38
  const entityManager = await this.getEntityManager();
39
- let baseRequest = {
40
- method: 'GET',
39
+ const baseRequest = {
40
+ method: "GET",
41
41
  headers: {
42
42
  Host: `${this.app}.app.baqend.com`,
43
43
  authorization: `BAT ${entityManager.token}`,
44
- 'Content-Type': CONTENT_TYPE,
44
+ "Content-Type": CONTENT_TYPE,
45
45
  },
46
46
  timeout: REQUEST_TIMEOUT,
47
47
  };
48
- return Object.assign({}, (0, deepmerge_1.default)(baseRequest, requestExtension), { agent: this.agent });
48
+ return Object.assign({}, (0, deepmerge_1.default)(baseRequest, requestExtension), {
49
+ agent: this.agent,
50
+ });
49
51
  }
50
52
  async getEntityManager() {
51
53
  return await (0, race_1.race)(this.entityManagerFactory.getEntityManager(this.app));
@@ -14,21 +14,33 @@ class ConfigApiService {
14
14
  }
15
15
  async addInstall(configName, origins) {
16
16
  const updateUrl = `https://${this.app}.app.baqend.com/v1/speedkit/installation/${configName}`;
17
- const body = await this.client.send(updateUrl, { body: `{origins: ${JSON.stringify(origins)}}`, method: 'POST' });
17
+ const body = await this.client.send(updateUrl, {
18
+ body: `{origins: ${JSON.stringify(origins)}}`,
19
+ method: "POST",
20
+ });
18
21
  return body;
19
22
  }
20
23
  async setInstall(install) {
21
24
  const updateUrl = `https://${this.app}.app.baqend.com/v1/speedkit/installation/${install.domain}/${install.configVersion}`;
22
- return (await this.client.send(updateUrl, { body: JSON.stringify(install), method: 'PUT' }));
25
+ return (await this.client.send(updateUrl, {
26
+ body: JSON.stringify(install),
27
+ method: "PUT",
28
+ }));
23
29
  }
24
30
  async cloneInstall(install) {
25
31
  const cloneUrl = `https://${this.app}.app.baqend.com/v1/speedkit/installation/${install.domain}/${install.configVersion}/clone`;
26
- const body = await this.client.send(cloneUrl, { body: '{}', method: 'POST' });
32
+ const body = await this.client.send(cloneUrl, {
33
+ body: "{}",
34
+ method: "POST",
35
+ });
27
36
  return body;
28
37
  }
29
38
  async activateInstall(install) {
30
39
  const activateUrl = `https://${this.app}.app.baqend.com/v1/speedkit/installation/${install.domain}/${install.configVersion}/activate`;
31
- return (await this.client.send(activateUrl, { body: '{}', method: 'POST' }));
40
+ return (await this.client.send(activateUrl, {
41
+ body: "{}",
42
+ method: "POST",
43
+ }));
32
44
  }
33
45
  async getModule(moduleName) {
34
46
  return await this.client.getModule(moduleName);
@@ -39,16 +51,16 @@ class ConfigApiService {
39
51
  async getServerConfig() {
40
52
  const urlPath = `https://${this.app}.app.baqend.com/v1/config`;
41
53
  const body = await this.client.send(urlPath);
42
- return JSON.stringify(body, null, '\t');
54
+ return JSON.stringify(body, null, "\t");
43
55
  }
44
56
  async setServerConfig(localServerConfig, configurationVersion) {
45
57
  const urlPath = `https://${this.app}.app.baqend.com/v1/config`;
46
58
  await this.client.send(urlPath, {
47
59
  body: localServerConfig,
48
- method: 'PUT',
60
+ method: "PUT",
49
61
  headers: {
50
- 'Content-Type': 'application/json',
51
- 'If-Match': configurationVersion,
62
+ "Content-Type": "application/json",
63
+ "If-Match": configurationVersion,
52
64
  },
53
65
  });
54
66
  }
@@ -22,7 +22,7 @@ class ConfigApiServiceFactory {
22
22
  }
23
23
  buildService() {
24
24
  if (!this.context.app) {
25
- throw new context_runtime_error_1.default({ message: 'app is undefined' });
25
+ throw new context_runtime_error_1.default({ message: "app is undefined" });
26
26
  }
27
27
  this.createLoginTokenFileIfNotExists();
28
28
  const entityManagerFactory = new entity_manager_factory_1.default();
@@ -1,5 +1,5 @@
1
1
  export default interface RequestExtensionInterface {
2
2
  method?: string;
3
- headers?: {};
4
- body?: string | {};
3
+ headers?: NonNullable<unknown>;
4
+ body?: string | NonNullable<unknown>;
5
5
  }
@@ -5,7 +5,7 @@ const cli_parameters_1 = require("../../models/cli-parameters");
5
5
  class CustomerConfigServiceContext {
6
6
  appName;
7
7
  customersDir;
8
- constructor(appName = '', customersDir = cli_parameters_1.CLIParametersExample.CustomersDir) {
8
+ constructor(appName = "", customersDir = cli_parameters_1.CLIParametersExample.CustomersDir) {
9
9
  this.appName = appName;
10
10
  this.customersDir = customersDir;
11
11
  this.appName = appName;
@@ -16,6 +16,7 @@ export declare class CustomerConfigService {
16
16
  private getHandlebarsOutputFileName;
17
17
  private getPathWithChangedDir;
18
18
  private isDirNotEmpty;
19
+ private chooseNewOutputDirectoryName;
19
20
  private selectOutputDirectory;
20
21
  private compileHandlebarsFiles;
21
22
  private getEnvironmentConfig;