@prismicio/e2e-tests-utils 1.18.0 → 1.19.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 (159) hide show
  1. package/README.md +24 -27
  2. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  3. package/dist/clients/apiClient.cjs +38 -38
  4. package/dist/clients/apiClient.cjs.map +1 -1
  5. package/dist/clients/apiClient.d.cts +30 -0
  6. package/dist/clients/apiClient.d.cts.map +1 -0
  7. package/dist/clients/apiClient.d.ts +23 -23
  8. package/dist/clients/apiClient.d.ts.map +1 -0
  9. package/dist/clients/apiClient.js +38 -38
  10. package/dist/clients/apiClient.js.map +1 -1
  11. package/dist/clients/assetApi.cjs +81 -93
  12. package/dist/clients/assetApi.cjs.map +1 -1
  13. package/dist/clients/assetApi.d.cts +105 -0
  14. package/dist/clients/assetApi.d.cts.map +1 -0
  15. package/dist/clients/assetApi.d.ts +96 -97
  16. package/dist/clients/assetApi.d.ts.map +1 -0
  17. package/dist/clients/assetApi.js +79 -91
  18. package/dist/clients/assetApi.js.map +1 -1
  19. package/dist/clients/authenticationApi.cjs +66 -73
  20. package/dist/clients/authenticationApi.cjs.map +1 -1
  21. package/dist/clients/authenticationApi.d.cts +20 -0
  22. package/dist/clients/authenticationApi.d.cts.map +1 -0
  23. package/dist/clients/authenticationApi.d.ts +18 -13
  24. package/dist/clients/authenticationApi.d.ts.map +1 -0
  25. package/dist/clients/authenticationApi.js +65 -72
  26. package/dist/clients/authenticationApi.js.map +1 -1
  27. package/dist/clients/contentApi.cjs +94 -103
  28. package/dist/clients/contentApi.cjs.map +1 -1
  29. package/dist/clients/contentApi.d.cts +116 -0
  30. package/dist/clients/contentApi.d.cts.map +1 -0
  31. package/dist/clients/contentApi.d.ts +102 -98
  32. package/dist/clients/contentApi.d.ts.map +1 -0
  33. package/dist/clients/contentApi.js +94 -103
  34. package/dist/clients/contentApi.js.map +1 -1
  35. package/dist/clients/coreApi.cjs +123 -145
  36. package/dist/clients/coreApi.cjs.map +1 -1
  37. package/dist/clients/coreApi.d.cts +122 -0
  38. package/dist/clients/coreApi.d.cts.map +1 -0
  39. package/dist/clients/coreApi.d.ts +111 -109
  40. package/dist/clients/coreApi.d.ts.map +1 -0
  41. package/dist/clients/coreApi.js +122 -144
  42. package/dist/clients/coreApi.js.map +1 -1
  43. package/dist/clients/customTypesApi.cjs +90 -99
  44. package/dist/clients/customTypesApi.cjs.map +1 -1
  45. package/dist/clients/customTypesApi.d.cts +46 -0
  46. package/dist/clients/customTypesApi.d.cts.map +1 -0
  47. package/dist/clients/customTypesApi.d.ts +45 -45
  48. package/dist/clients/customTypesApi.d.ts.map +1 -0
  49. package/dist/clients/customTypesApi.js +87 -98
  50. package/dist/clients/customTypesApi.js.map +1 -1
  51. package/dist/clients/integrationFields.cjs +96 -87
  52. package/dist/clients/integrationFields.cjs.map +1 -1
  53. package/dist/clients/integrationFields.d.cts +30 -0
  54. package/dist/clients/integrationFields.d.cts.map +1 -0
  55. package/dist/clients/integrationFields.d.ts +27 -22
  56. package/dist/clients/integrationFields.d.ts.map +1 -0
  57. package/dist/clients/integrationFields.js +93 -86
  58. package/dist/clients/integrationFields.js.map +1 -1
  59. package/dist/clients/manageV2.cjs +154 -171
  60. package/dist/clients/manageV2.cjs.map +1 -1
  61. package/dist/clients/manageV2.d.cts +105 -0
  62. package/dist/clients/manageV2.d.cts.map +1 -0
  63. package/dist/clients/manageV2.d.ts +103 -111
  64. package/dist/clients/manageV2.d.ts.map +1 -0
  65. package/dist/clients/manageV2.js +149 -169
  66. package/dist/clients/manageV2.js.map +1 -1
  67. package/dist/clients/migrationApi.cjs +37 -36
  68. package/dist/clients/migrationApi.cjs.map +1 -1
  69. package/dist/clients/migrationApi.d.cts +48 -0
  70. package/dist/clients/migrationApi.d.cts.map +1 -0
  71. package/dist/clients/migrationApi.d.ts +45 -39
  72. package/dist/clients/migrationApi.d.ts.map +1 -0
  73. package/dist/clients/migrationApi.js +35 -34
  74. package/dist/clients/migrationApi.js.map +1 -1
  75. package/dist/clients/wroom.cjs +101 -122
  76. package/dist/clients/wroom.cjs.map +1 -1
  77. package/dist/clients/wroom.d.cts +48 -0
  78. package/dist/clients/wroom.d.cts.map +1 -0
  79. package/dist/clients/wroom.d.ts +46 -47
  80. package/dist/clients/wroom.d.ts.map +1 -0
  81. package/dist/clients/wroom.js +99 -122
  82. package/dist/clients/wroom.js.map +1 -1
  83. package/dist/index.cjs +13 -15
  84. package/dist/index.d.cts +8 -0
  85. package/dist/index.d.ts +8 -7
  86. package/dist/index.js +5 -14
  87. package/dist/managers/repositories.cjs +159 -169
  88. package/dist/managers/repositories.cjs.map +1 -1
  89. package/dist/managers/repositories.d.cts +67 -0
  90. package/dist/managers/repositories.d.cts.map +1 -0
  91. package/dist/managers/repositories.d.ts +56 -63
  92. package/dist/managers/repositories.d.ts.map +1 -0
  93. package/dist/managers/repositories.js +148 -159
  94. package/dist/managers/repositories.js.map +1 -1
  95. package/dist/managers/repository.cjs +529 -616
  96. package/dist/managers/repository.cjs.map +1 -1
  97. package/dist/managers/repository.d.cts +308 -0
  98. package/dist/managers/repository.d.cts.map +1 -0
  99. package/dist/managers/repository.d.ts +303 -307
  100. package/dist/managers/repository.d.ts.map +1 -0
  101. package/dist/managers/repository.js +529 -616
  102. package/dist/managers/repository.js.map +1 -1
  103. package/dist/types.d.cts +41 -0
  104. package/dist/types.d.cts.map +1 -0
  105. package/dist/types.d.ts +35 -37
  106. package/dist/types.d.ts.map +1 -0
  107. package/dist/utils/cookies.cjs +19 -17
  108. package/dist/utils/cookies.cjs.map +1 -1
  109. package/dist/utils/cookies.js +20 -18
  110. package/dist/utils/cookies.js.map +1 -1
  111. package/dist/utils/envVariableManager.cjs +33 -34
  112. package/dist/utils/envVariableManager.cjs.map +1 -1
  113. package/dist/utils/envVariableManager.js +34 -35
  114. package/dist/utils/envVariableManager.js.map +1 -1
  115. package/dist/utils/log.cjs +18 -19
  116. package/dist/utils/log.cjs.map +1 -1
  117. package/dist/utils/log.js +18 -21
  118. package/dist/utils/log.js.map +1 -1
  119. package/dist/utils/random.cjs +13 -6
  120. package/dist/utils/random.cjs.map +1 -1
  121. package/dist/utils/random.js +13 -6
  122. package/dist/utils/random.js.map +1 -1
  123. package/dist/utils/strings.cjs +13 -7
  124. package/dist/utils/strings.cjs.map +1 -1
  125. package/dist/utils/strings.js +14 -8
  126. package/dist/utils/strings.js.map +1 -1
  127. package/dist/utils/urls.cjs +21 -10
  128. package/dist/utils/urls.cjs.map +1 -1
  129. package/dist/utils/urls.js +22 -12
  130. package/dist/utils/urls.js.map +1 -1
  131. package/package.json +42 -67
  132. package/src/clients/apiClient.ts +16 -21
  133. package/src/clients/assetApi.ts +75 -82
  134. package/src/clients/authenticationApi.ts +54 -27
  135. package/src/clients/contentApi.ts +109 -129
  136. package/src/clients/coreApi.ts +113 -117
  137. package/src/clients/customTypesApi.ts +54 -76
  138. package/src/clients/integrationFields.ts +59 -74
  139. package/src/clients/manageV2.ts +72 -96
  140. package/src/clients/migrationApi.ts +35 -39
  141. package/src/clients/wroom.ts +42 -56
  142. package/src/index.ts +7 -7
  143. package/src/managers/repositories.ts +85 -108
  144. package/src/managers/repository.ts +303 -368
  145. package/src/types.ts +31 -31
  146. package/src/utils/cookies.ts +8 -8
  147. package/src/utils/envVariableManager.ts +15 -15
  148. package/src/utils/log.ts +17 -21
  149. package/src/utils/random.ts +5 -6
  150. package/src/utils/strings.ts +7 -9
  151. package/src/utils/urls.ts +10 -12
  152. package/dist/index.cjs.map +0 -1
  153. package/dist/index.js.map +0 -1
  154. package/dist/utils/cookies.d.ts +0 -8
  155. package/dist/utils/envVariableManager.d.ts +0 -16
  156. package/dist/utils/log.d.ts +0 -5
  157. package/dist/utils/random.d.ts +0 -8
  158. package/dist/utils/strings.d.ts +0 -11
  159. package/dist/utils/urls.d.ts +0 -16
@@ -1,30 +1,29 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const winston = require("winston");
1
+ let winston = require("winston");
2
+ //#region src/utils/log.ts
4
3
  const logHttpResponse = (response) => {
5
- const { status, data } = response;
6
- const { baseURL = "", url = "" } = response.config;
7
- const fullUrl = url.startsWith("http") ? url : `${baseURL}/${url}`;
8
- logger.info(`Call to ${fullUrl} failed, received [${status}] ${JSON.stringify(data)}`);
4
+ const { status, data } = response;
5
+ const { baseURL = "", url = "" } = response.config;
6
+ const fullUrl = url.startsWith("http") ? url : `${baseURL}/${url}`;
7
+ logger.info(`Call to ${fullUrl} failed, received [${status}] ${JSON.stringify(data)}`);
9
8
  };
10
9
  const logPlaywrightApiResponse = async (response) => {
11
- logger.info(`Call to ${response.url()} failed, received [${response.status()}] ${JSON.stringify(await response.text())}`);
10
+ logger.info(`Call to ${response.url()} failed, received [${response.status()}] ${JSON.stringify(await response.text())}`);
12
11
  };
13
12
  const { combine, printf } = winston.format;
14
13
  const customFormat = printf(({ message, durationMs }) => {
15
- const baseMsg = `[test data] ${message}`;
16
- if (durationMs) {
17
- return `${baseMsg} in ${durationMs}ms`;
18
- }
19
- return baseMsg;
14
+ const baseMsg = `[test data] ${message}`;
15
+ if (durationMs) return `${baseMsg} in ${durationMs}ms`;
16
+ return baseMsg;
20
17
  });
21
- const logger = winston.createLogger({
22
- silent: process.env["prismic_e2e_tests_utils_silent"] === "true",
23
- level: process.env["prismic_e2e_tests_utils_log_level"] || "info",
24
- format: combine(customFormat),
25
- transports: [new winston.transports.Console()]
18
+ const logger = (0, winston.createLogger)({
19
+ silent: process.env["prismic_e2e_tests_utils_silent"] === "true",
20
+ level: process.env["prismic_e2e_tests_utils_log_level"] || "info",
21
+ format: combine(customFormat),
22
+ transports: [new winston.transports.Console()]
26
23
  });
24
+ //#endregion
27
25
  exports.logHttpResponse = logHttpResponse;
28
26
  exports.logPlaywrightApiResponse = logPlaywrightApiResponse;
29
27
  exports.logger = logger;
30
- //# sourceMappingURL=log.cjs.map
28
+
29
+ //# sourceMappingURL=log.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.cjs","sources":["../../../src/utils/log.ts"],"sourcesContent":["import { APIResponse } from \"@playwright/test\";\nimport { AxiosResponse } from \"axios\";\nimport { createLogger, format, transports } from \"winston\";\n\nexport const logHttpResponse = (response: AxiosResponse): void => {\n\tconst { status, data } = response;\n\tconst { baseURL = \"\", url = \"\" } = response.config;\n\t// make sure the url always shows baseURL + path.\n\t// Depending on how the AxiosInstance was called, the url already contains the baseURL\n\tconst fullUrl = url.startsWith(\"http\") ? url : `${baseURL}/${url}`;\n\n\tlogger.info(\n\t\t`Call to ${fullUrl} failed, received [${status}] ${JSON.stringify(data)}`,\n\t);\n};\n\nexport const logPlaywrightApiResponse = async (\n\tresponse: APIResponse,\n): Promise<void> => {\n\tlogger.info(\n\t\t`Call to ${response.url()} failed, received [${response.status()}] ${JSON.stringify(\n\t\t\tawait response.text(),\n\t\t)}`,\n\t);\n};\n\nconst { combine, printf } = format;\n\nconst customFormat = printf(({ message, durationMs }) => {\n\tconst baseMsg = `[test data] ${message}`;\n\tif (durationMs) {\n\t\treturn `${baseMsg} in ${durationMs}ms`;\n\t}\n\n\treturn baseMsg;\n});\n\nexport const logger = createLogger({\n\tsilent: process.env[\"prismic_e2e_tests_utils_silent\"] === \"true\",\n\tlevel: process.env[\"prismic_e2e_tests_utils_log_level\"] || \"info\",\n\tformat: combine(customFormat),\n\ttransports: [new transports.Console()],\n});\n"],"names":["format","createLogger","transports"],"mappings":";;;AAIa,MAAA,kBAAkB,CAAC,aAAiC;AAC1D,QAAA,EAAE,QAAQ,KAAS,IAAA;AACzB,QAAM,EAAE,UAAU,IAAI,MAAM,OAAO,SAAS;AAGtC,QAAA,UAAU,IAAI,WAAW,MAAM,IAAI,MAAM,GAAG,OAAO,IAAI,GAAG;AAEzD,SAAA,KACN,WAAW,OAAO,sBAAsB,MAAM,KAAK,KAAK,UAAU,IAAI,CAAC,EAAE;AAE3E;AAEa,MAAA,2BAA2B,OACvC,aACkB;AAClB,SAAO,KACN,WAAW,SAAS,IAAK,CAAA,sBAAsB,SAAS,OAAQ,CAAA,KAAK,KAAK,UACzE,MAAM,SAAS,KAAM,CAAA,CACrB,EAAE;AAEL;AAEA,MAAM,EAAE,SAAS,OAAW,IAAAA;AAE5B,MAAM,eAAe,OAAO,CAAC,EAAE,SAAS,iBAAgB;AACjD,QAAA,UAAU,eAAe,OAAO;AACtC,MAAI,YAAY;AACR,WAAA,GAAG,OAAO,OAAO,UAAU;AAAA,EACnC;AAEO,SAAA;AACR,CAAC;AAEM,MAAM,SAASC,QAAAA,aAAa;AAAA,EAClC,QAAQ,QAAQ,IAAI,gCAAgC,MAAM;AAAA,EAC1D,OAAO,QAAQ,IAAI,mCAAmC,KAAK;AAAA,EAC3D,QAAQ,QAAQ,YAAY;AAAA,EAC5B,YAAY,CAAC,IAAIC,mBAAW,SAAS;AACrC,CAAA;;;;"}
1
+ {"version":3,"file":"log.cjs","names":["format","transports"],"sources":["../../src/utils/log.ts"],"sourcesContent":["import type { APIResponse } from \"@playwright/test\"\nimport type { AxiosResponse } from \"axios\"\nimport { createLogger, format, transports } from \"winston\"\n\nexport const logHttpResponse = (response: AxiosResponse): void => {\n\tconst { status, data } = response\n\tconst { baseURL = \"\", url = \"\" } = response.config\n\t// make sure the url always shows baseURL + path.\n\t// Depending on how the AxiosInstance was called, the url already contains the baseURL\n\tconst fullUrl = url.startsWith(\"http\") ? url : `${baseURL}/${url}`\n\n\tlogger.info(`Call to ${fullUrl} failed, received [${status}] ${JSON.stringify(data)}`)\n}\n\nexport const logPlaywrightApiResponse = async (response: APIResponse): Promise<void> => {\n\tlogger.info(\n\t\t`Call to ${response.url()} failed, received [${response.status()}] ${JSON.stringify(\n\t\t\tawait response.text(),\n\t\t)}`,\n\t)\n}\n\nconst { combine, printf } = format\n\nconst customFormat = printf(({ message, durationMs }) => {\n\tconst baseMsg = `[test data] ${message}`\n\tif (durationMs) {\n\t\treturn `${baseMsg} in ${durationMs}ms`\n\t}\n\n\treturn baseMsg\n})\n\nexport const logger = createLogger({\n\tsilent: process.env[\"prismic_e2e_tests_utils_silent\"] === \"true\",\n\tlevel: process.env[\"prismic_e2e_tests_utils_log_level\"] || \"info\",\n\tformat: combine(customFormat),\n\ttransports: [new transports.Console()],\n})\n"],"mappings":";;AAIA,MAAa,mBAAmB,aAAkC;CACjE,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,EAAE,UAAU,IAAI,MAAM,OAAO,SAAS;CAG5C,MAAM,UAAU,IAAI,WAAW,MAAM,IAAI,MAAM,GAAG,QAAQ,GAAG;CAE7D,OAAO,KAAK,WAAW,QAAQ,qBAAqB,OAAO,IAAI,KAAK,UAAU,IAAI,GAAG;AACtF;AAEA,MAAa,2BAA2B,OAAO,aAAyC;CACvF,OAAO,KACN,WAAW,SAAS,IAAI,EAAE,qBAAqB,SAAS,OAAO,EAAE,IAAI,KAAK,UACzE,MAAM,SAAS,KAAK,CACrB,GACD;AACD;AAEA,MAAM,EAAE,SAAS,WAAWA,QAAAA;AAE5B,MAAM,eAAe,QAAQ,EAAE,SAAS,iBAAiB;CACxD,MAAM,UAAU,eAAe;CAC/B,IAAI,YACH,OAAO,GAAG,QAAQ,MAAM,WAAW;CAGpC,OAAO;AACR,CAAC;AAED,MAAa,UAAA,GAAA,QAAA,aAAA,CAAsB;CAClC,QAAQ,QAAQ,IAAI,sCAAsC;CAC1D,OAAO,QAAQ,IAAI,wCAAwC;CAC3D,QAAQ,QAAQ,YAAY;CAC5B,YAAY,CAAC,IAAIC,QAAAA,WAAW,QAAQ,CAAC;AACtC,CAAC"}
package/dist/utils/log.js CHANGED
@@ -1,30 +1,27 @@
1
- import { createLogger, transports, format } from "winston";
1
+ import { createLogger, format, transports } from "winston";
2
+ //#region src/utils/log.ts
2
3
  const logHttpResponse = (response) => {
3
- const { status, data } = response;
4
- const { baseURL = "", url = "" } = response.config;
5
- const fullUrl = url.startsWith("http") ? url : `${baseURL}/${url}`;
6
- logger.info(`Call to ${fullUrl} failed, received [${status}] ${JSON.stringify(data)}`);
4
+ const { status, data } = response;
5
+ const { baseURL = "", url = "" } = response.config;
6
+ const fullUrl = url.startsWith("http") ? url : `${baseURL}/${url}`;
7
+ logger.info(`Call to ${fullUrl} failed, received [${status}] ${JSON.stringify(data)}`);
7
8
  };
8
9
  const logPlaywrightApiResponse = async (response) => {
9
- logger.info(`Call to ${response.url()} failed, received [${response.status()}] ${JSON.stringify(await response.text())}`);
10
+ logger.info(`Call to ${response.url()} failed, received [${response.status()}] ${JSON.stringify(await response.text())}`);
10
11
  };
11
12
  const { combine, printf } = format;
12
13
  const customFormat = printf(({ message, durationMs }) => {
13
- const baseMsg = `[test data] ${message}`;
14
- if (durationMs) {
15
- return `${baseMsg} in ${durationMs}ms`;
16
- }
17
- return baseMsg;
14
+ const baseMsg = `[test data] ${message}`;
15
+ if (durationMs) return `${baseMsg} in ${durationMs}ms`;
16
+ return baseMsg;
18
17
  });
19
18
  const logger = createLogger({
20
- silent: process.env["prismic_e2e_tests_utils_silent"] === "true",
21
- level: process.env["prismic_e2e_tests_utils_log_level"] || "info",
22
- format: combine(customFormat),
23
- transports: [new transports.Console()]
19
+ silent: process.env["prismic_e2e_tests_utils_silent"] === "true",
20
+ level: process.env["prismic_e2e_tests_utils_log_level"] || "info",
21
+ format: combine(customFormat),
22
+ transports: [new transports.Console()]
24
23
  });
25
- export {
26
- logHttpResponse,
27
- logPlaywrightApiResponse,
28
- logger
29
- };
30
- //# sourceMappingURL=log.js.map
24
+ //#endregion
25
+ export { logHttpResponse, logPlaywrightApiResponse, logger };
26
+
27
+ //# sourceMappingURL=log.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sources":["../../../src/utils/log.ts"],"sourcesContent":["import { APIResponse } from \"@playwright/test\";\nimport { AxiosResponse } from \"axios\";\nimport { createLogger, format, transports } from \"winston\";\n\nexport const logHttpResponse = (response: AxiosResponse): void => {\n\tconst { status, data } = response;\n\tconst { baseURL = \"\", url = \"\" } = response.config;\n\t// make sure the url always shows baseURL + path.\n\t// Depending on how the AxiosInstance was called, the url already contains the baseURL\n\tconst fullUrl = url.startsWith(\"http\") ? url : `${baseURL}/${url}`;\n\n\tlogger.info(\n\t\t`Call to ${fullUrl} failed, received [${status}] ${JSON.stringify(data)}`,\n\t);\n};\n\nexport const logPlaywrightApiResponse = async (\n\tresponse: APIResponse,\n): Promise<void> => {\n\tlogger.info(\n\t\t`Call to ${response.url()} failed, received [${response.status()}] ${JSON.stringify(\n\t\t\tawait response.text(),\n\t\t)}`,\n\t);\n};\n\nconst { combine, printf } = format;\n\nconst customFormat = printf(({ message, durationMs }) => {\n\tconst baseMsg = `[test data] ${message}`;\n\tif (durationMs) {\n\t\treturn `${baseMsg} in ${durationMs}ms`;\n\t}\n\n\treturn baseMsg;\n});\n\nexport const logger = createLogger({\n\tsilent: process.env[\"prismic_e2e_tests_utils_silent\"] === \"true\",\n\tlevel: process.env[\"prismic_e2e_tests_utils_log_level\"] || \"info\",\n\tformat: combine(customFormat),\n\ttransports: [new transports.Console()],\n});\n"],"names":[],"mappings":";AAIa,MAAA,kBAAkB,CAAC,aAAiC;AAC1D,QAAA,EAAE,QAAQ,KAAS,IAAA;AACzB,QAAM,EAAE,UAAU,IAAI,MAAM,OAAO,SAAS;AAGtC,QAAA,UAAU,IAAI,WAAW,MAAM,IAAI,MAAM,GAAG,OAAO,IAAI,GAAG;AAEzD,SAAA,KACN,WAAW,OAAO,sBAAsB,MAAM,KAAK,KAAK,UAAU,IAAI,CAAC,EAAE;AAE3E;AAEa,MAAA,2BAA2B,OACvC,aACkB;AAClB,SAAO,KACN,WAAW,SAAS,IAAK,CAAA,sBAAsB,SAAS,OAAQ,CAAA,KAAK,KAAK,UACzE,MAAM,SAAS,KAAM,CAAA,CACrB,EAAE;AAEL;AAEA,MAAM,EAAE,SAAS,OAAW,IAAA;AAE5B,MAAM,eAAe,OAAO,CAAC,EAAE,SAAS,iBAAgB;AACjD,QAAA,UAAU,eAAe,OAAO;AACtC,MAAI,YAAY;AACR,WAAA,GAAG,OAAO,OAAO,UAAU;AAAA,EACnC;AAEO,SAAA;AACR,CAAC;AAEM,MAAM,SAAS,aAAa;AAAA,EAClC,QAAQ,QAAQ,IAAI,gCAAgC,MAAM;AAAA,EAC1D,OAAO,QAAQ,IAAI,mCAAmC,KAAK;AAAA,EAC3D,QAAQ,QAAQ,YAAY;AAAA,EAC5B,YAAY,CAAC,IAAI,WAAW,SAAS;AACrC,CAAA;"}
1
+ {"version":3,"file":"log.js","names":[],"sources":["../../src/utils/log.ts"],"sourcesContent":["import type { APIResponse } from \"@playwright/test\"\nimport type { AxiosResponse } from \"axios\"\nimport { createLogger, format, transports } from \"winston\"\n\nexport const logHttpResponse = (response: AxiosResponse): void => {\n\tconst { status, data } = response\n\tconst { baseURL = \"\", url = \"\" } = response.config\n\t// make sure the url always shows baseURL + path.\n\t// Depending on how the AxiosInstance was called, the url already contains the baseURL\n\tconst fullUrl = url.startsWith(\"http\") ? url : `${baseURL}/${url}`\n\n\tlogger.info(`Call to ${fullUrl} failed, received [${status}] ${JSON.stringify(data)}`)\n}\n\nexport const logPlaywrightApiResponse = async (response: APIResponse): Promise<void> => {\n\tlogger.info(\n\t\t`Call to ${response.url()} failed, received [${response.status()}] ${JSON.stringify(\n\t\t\tawait response.text(),\n\t\t)}`,\n\t)\n}\n\nconst { combine, printf } = format\n\nconst customFormat = printf(({ message, durationMs }) => {\n\tconst baseMsg = `[test data] ${message}`\n\tif (durationMs) {\n\t\treturn `${baseMsg} in ${durationMs}ms`\n\t}\n\n\treturn baseMsg\n})\n\nexport const logger = createLogger({\n\tsilent: process.env[\"prismic_e2e_tests_utils_silent\"] === \"true\",\n\tlevel: process.env[\"prismic_e2e_tests_utils_log_level\"] || \"info\",\n\tformat: combine(customFormat),\n\ttransports: [new transports.Console()],\n})\n"],"mappings":";;AAIA,MAAa,mBAAmB,aAAkC;CACjE,MAAM,EAAE,QAAQ,SAAS;CACzB,MAAM,EAAE,UAAU,IAAI,MAAM,OAAO,SAAS;CAG5C,MAAM,UAAU,IAAI,WAAW,MAAM,IAAI,MAAM,GAAG,QAAQ,GAAG;CAE7D,OAAO,KAAK,WAAW,QAAQ,qBAAqB,OAAO,IAAI,KAAK,UAAU,IAAI,GAAG;AACtF;AAEA,MAAa,2BAA2B,OAAO,aAAyC;CACvF,OAAO,KACN,WAAW,SAAS,IAAI,EAAE,qBAAqB,SAAS,OAAO,EAAE,IAAI,KAAK,UACzE,MAAM,SAAS,KAAK,CACrB,GACD;AACD;AAEA,MAAM,EAAE,SAAS,WAAW;AAE5B,MAAM,eAAe,QAAQ,EAAE,SAAS,iBAAiB;CACxD,MAAM,UAAU,eAAe;CAC/B,IAAI,YACH,OAAO,GAAG,QAAQ,MAAM,WAAW;CAGpC,OAAO;AACR,CAAC;AAED,MAAa,SAAS,aAAa;CAClC,QAAQ,QAAQ,IAAI,sCAAsC;CAC1D,OAAO,QAAQ,IAAI,wCAAwC;CAC3D,QAAQ,QAAQ,YAAY;CAC5B,YAAY,CAAC,IAAI,WAAW,QAAQ,CAAC;AACtC,CAAC"}
@@ -1,9 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const crypto = require("crypto");
1
+ let crypto = require("crypto");
2
+ //#region src/utils/random.ts
3
+ /**
4
+ * Generate a random string
5
+ *
6
+ * @param length - Max 32
7
+ * @returns
8
+ */
4
9
  const randomString = (length = 16) => {
5
- const uniqueInput = Math.random().toString();
6
- return crypto.createHash("md5").update(uniqueInput).digest("hex").slice(0, length);
10
+ const uniqueInput = Math.random().toString();
11
+ return (0, crypto.createHash)("md5").update(uniqueInput).digest("hex").slice(0, length);
7
12
  };
13
+ //#endregion
8
14
  exports.randomString = randomString;
9
- //# sourceMappingURL=random.cjs.map
15
+
16
+ //# sourceMappingURL=random.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"random.cjs","sources":["../../../src/utils/random.ts"],"sourcesContent":["import { createHash } from \"crypto\";\n\n/**\n * Generate a random string\n *\n * @param length - max 32\n *\n * @returns\n */\nexport const randomString = (length = 16): string => {\n\tconst uniqueInput = Math.random().toString();\n\n\treturn createHash(\"md5\").update(uniqueInput).digest(\"hex\").slice(0, length);\n};\n"],"names":["createHash"],"mappings":";;;AASa,MAAA,eAAe,CAAC,SAAS,OAAc;AACnD,QAAM,cAAc,KAAK,OAAQ,EAAC,SAAQ;AAEnC,SAAAA,kBAAW,KAAK,EAAE,OAAO,WAAW,EAAE,OAAO,KAAK,EAAE,MAAM,GAAG,MAAM;AAC3E;;"}
1
+ {"version":3,"file":"random.cjs","names":[],"sources":["../../src/utils/random.ts"],"sourcesContent":["import { createHash } from \"crypto\"\n\n/**\n * Generate a random string\n *\n * @param length - Max 32\n * @returns\n */\nexport const randomString = (length = 16): string => {\n\tconst uniqueInput = Math.random().toString()\n\n\treturn createHash(\"md5\").update(uniqueInput).digest(\"hex\").slice(0, length)\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,gBAAgB,SAAS,OAAe;CACpD,MAAM,cAAc,KAAK,OAAO,CAAC,CAAC,SAAS;CAE3C,QAAA,GAAA,OAAA,WAAA,CAAkB,KAAK,CAAC,CAAC,OAAO,WAAW,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM;AAC3E"}
@@ -1,9 +1,16 @@
1
1
  import { createHash } from "crypto";
2
+ //#region src/utils/random.ts
3
+ /**
4
+ * Generate a random string
5
+ *
6
+ * @param length - Max 32
7
+ * @returns
8
+ */
2
9
  const randomString = (length = 16) => {
3
- const uniqueInput = Math.random().toString();
4
- return createHash("md5").update(uniqueInput).digest("hex").slice(0, length);
10
+ const uniqueInput = Math.random().toString();
11
+ return createHash("md5").update(uniqueInput).digest("hex").slice(0, length);
5
12
  };
6
- export {
7
- randomString
8
- };
9
- //# sourceMappingURL=random.js.map
13
+ //#endregion
14
+ export { randomString };
15
+
16
+ //# sourceMappingURL=random.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"random.js","sources":["../../../src/utils/random.ts"],"sourcesContent":["import { createHash } from \"crypto\";\n\n/**\n * Generate a random string\n *\n * @param length - max 32\n *\n * @returns\n */\nexport const randomString = (length = 16): string => {\n\tconst uniqueInput = Math.random().toString();\n\n\treturn createHash(\"md5\").update(uniqueInput).digest(\"hex\").slice(0, length);\n};\n"],"names":[],"mappings":";AASa,MAAA,eAAe,CAAC,SAAS,OAAc;AACnD,QAAM,cAAc,KAAK,OAAQ,EAAC,SAAQ;AAEnC,SAAA,WAAW,KAAK,EAAE,OAAO,WAAW,EAAE,OAAO,KAAK,EAAE,MAAM,GAAG,MAAM;AAC3E;"}
1
+ {"version":3,"file":"random.js","names":[],"sources":["../../src/utils/random.ts"],"sourcesContent":["import { createHash } from \"crypto\"\n\n/**\n * Generate a random string\n *\n * @param length - Max 32\n * @returns\n */\nexport const randomString = (length = 16): string => {\n\tconst uniqueInput = Math.random().toString()\n\n\treturn createHash(\"md5\").update(uniqueInput).digest(\"hex\").slice(0, length)\n}\n"],"mappings":";;;;;;;;AAQA,MAAa,gBAAgB,SAAS,OAAe;CACpD,MAAM,cAAc,KAAK,OAAO,CAAC,CAAC,SAAS;CAE3C,OAAO,WAAW,KAAK,CAAC,CAAC,OAAO,WAAW,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,MAAM;AAC3E"}
@@ -1,10 +1,16 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1
+ //#region src/utils/strings.ts
2
+ /**
3
+ * Convert string to a slug suitable for Integration Fields.
4
+ *
5
+ * @param str - The input string to slugify.
6
+ * @returns The slugified string (empty string if no valid characters remain). Inspired by the Wroom
7
+ * slugify function:
8
+ * https://github.com/prismicio/wroom/blob/09452b75fa5fabdaf3cd81383741cd02d30c9c9f/subprojects/common/app/utils/String.scala#L55
9
+ */
3
10
  const slugify = (str) => {
4
- const noWhitespace = str.trim().replace(/ /g, "_");
5
- const normalized = noWhitespace.normalize("NFD").replace(new RegExp("\\p{M}+", "gu"), "");
6
- const slug = normalized.replace(/[^A-Za-z0-9_-]/g, "").toLowerCase();
7
- return slug || "";
11
+ return str.trim().replace(/ /g, "_").normalize("NFD").replace(/\p{M}+/gu, "").replace(/[^A-Za-z0-9_-]/g, "").toLowerCase() || "";
8
12
  };
13
+ //#endregion
9
14
  exports.slugify = slugify;
10
- //# sourceMappingURL=strings.cjs.map
15
+
16
+ //# sourceMappingURL=strings.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"strings.cjs","sources":["../../../src/utils/strings.ts"],"sourcesContent":["/**\n * Convert string to a slug suitable for Integration Fields.\n *\n * @param str - The input string to slugify.\n *\n * @returns The slugified string (empty string if no valid characters remain).\n *\n * Inspired by the Wroom slugify function:\n * https://github.com/prismicio/wroom/blob/09452b75fa5fabdaf3cd81383741cd02d30c9c9f/subprojects/common/app/utils/String.scala#L55\n */\nexport const slugify = (str: string): string => {\n\tconst noWhitespace = str.trim().replace(/ /g, \"_\");\n\tconst normalized = noWhitespace.normalize(\"NFD\").replace(/\\p{M}+/gu, \"\");\n\tconst slug = normalized.replace(/[^A-Za-z0-9_-]/g, \"\").toLowerCase();\n\n\treturn slug || \"\";\n};\n"],"names":[],"mappings":";;AAUa,MAAA,UAAU,CAAC,QAAuB;AAC9C,QAAM,eAAe,IAAI,KAAA,EAAO,QAAQ,MAAM,GAAG;AACjD,QAAM,aAAa,aAAa,UAAU,KAAK,EAAE,QAAQ,WAAA,WAAA,OAAY,EAAE;AACvE,QAAM,OAAO,WAAW,QAAQ,mBAAmB,EAAE,EAAE;AAEvD,SAAO,QAAQ;AAChB;;"}
1
+ {"version":3,"file":"strings.cjs","names":[],"sources":["../../src/utils/strings.ts"],"sourcesContent":["/**\n * Convert string to a slug suitable for Integration Fields.\n *\n * @param str - The input string to slugify.\n * @returns The slugified string (empty string if no valid characters remain). Inspired by the Wroom\n * slugify function:\n * https://github.com/prismicio/wroom/blob/09452b75fa5fabdaf3cd81383741cd02d30c9c9f/subprojects/common/app/utils/String.scala#L55\n */\nexport const slugify = (str: string): string => {\n\tconst noWhitespace = str.trim().replace(/ /g, \"_\")\n\tconst normalized = noWhitespace.normalize(\"NFD\").replace(/\\p{M}+/gu, \"\")\n\tconst slug = normalized.replace(/[^A-Za-z0-9_-]/g, \"\").toLowerCase()\n\n\treturn slug || \"\"\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,WAAW,QAAwB;CAK/C,OAJqB,IAAI,KAAK,CAAC,CAAC,QAAQ,MAAM,GAChB,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,QAAQ,YAAY,EAC/C,CAAC,CAAC,QAAQ,mBAAmB,EAAE,CAAC,CAAC,YAE7C,KAAK;AAChB"}
@@ -1,10 +1,16 @@
1
+ //#region src/utils/strings.ts
2
+ /**
3
+ * Convert string to a slug suitable for Integration Fields.
4
+ *
5
+ * @param str - The input string to slugify.
6
+ * @returns The slugified string (empty string if no valid characters remain). Inspired by the Wroom
7
+ * slugify function:
8
+ * https://github.com/prismicio/wroom/blob/09452b75fa5fabdaf3cd81383741cd02d30c9c9f/subprojects/common/app/utils/String.scala#L55
9
+ */
1
10
  const slugify = (str) => {
2
- const noWhitespace = str.trim().replace(/ /g, "_");
3
- const normalized = noWhitespace.normalize("NFD").replace(new RegExp("\\p{M}+", "gu"), "");
4
- const slug = normalized.replace(/[^A-Za-z0-9_-]/g, "").toLowerCase();
5
- return slug || "";
11
+ return str.trim().replace(/ /g, "_").normalize("NFD").replace(/\p{M}+/gu, "").replace(/[^A-Za-z0-9_-]/g, "").toLowerCase() || "";
6
12
  };
7
- export {
8
- slugify
9
- };
10
- //# sourceMappingURL=strings.js.map
13
+ //#endregion
14
+ export { slugify };
15
+
16
+ //# sourceMappingURL=strings.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"strings.js","sources":["../../../src/utils/strings.ts"],"sourcesContent":["/**\n * Convert string to a slug suitable for Integration Fields.\n *\n * @param str - The input string to slugify.\n *\n * @returns The slugified string (empty string if no valid characters remain).\n *\n * Inspired by the Wroom slugify function:\n * https://github.com/prismicio/wroom/blob/09452b75fa5fabdaf3cd81383741cd02d30c9c9f/subprojects/common/app/utils/String.scala#L55\n */\nexport const slugify = (str: string): string => {\n\tconst noWhitespace = str.trim().replace(/ /g, \"_\");\n\tconst normalized = noWhitespace.normalize(\"NFD\").replace(/\\p{M}+/gu, \"\");\n\tconst slug = normalized.replace(/[^A-Za-z0-9_-]/g, \"\").toLowerCase();\n\n\treturn slug || \"\";\n};\n"],"names":[],"mappings":"AAUa,MAAA,UAAU,CAAC,QAAuB;AAC9C,QAAM,eAAe,IAAI,KAAA,EAAO,QAAQ,MAAM,GAAG;AACjD,QAAM,aAAa,aAAa,UAAU,KAAK,EAAE,QAAQ,WAAA,WAAA,OAAY,EAAE;AACvE,QAAM,OAAO,WAAW,QAAQ,mBAAmB,EAAE,EAAE;AAEvD,SAAO,QAAQ;AAChB;"}
1
+ {"version":3,"file":"strings.js","names":[],"sources":["../../src/utils/strings.ts"],"sourcesContent":["/**\n * Convert string to a slug suitable for Integration Fields.\n *\n * @param str - The input string to slugify.\n * @returns The slugified string (empty string if no valid characters remain). Inspired by the Wroom\n * slugify function:\n * https://github.com/prismicio/wroom/blob/09452b75fa5fabdaf3cd81383741cd02d30c9c9f/subprojects/common/app/utils/String.scala#L55\n */\nexport const slugify = (str: string): string => {\n\tconst noWhitespace = str.trim().replace(/ /g, \"_\")\n\tconst normalized = noWhitespace.normalize(\"NFD\").replace(/\\p{M}+/gu, \"\")\n\tconst slug = normalized.replace(/[^A-Za-z0-9_-]/g, \"\").toLowerCase()\n\n\treturn slug || \"\"\n}\n"],"mappings":";;;;;;;;;AAQA,MAAa,WAAW,QAAwB;CAK/C,OAJqB,IAAI,KAAK,CAAC,CAAC,QAAQ,MAAM,GAChB,CAAC,CAAC,UAAU,KAAK,CAAC,CAAC,QAAQ,YAAY,EAC/C,CAAC,CAAC,QAAQ,mBAAmB,EAAE,CAAC,CAAC,YAE7C,KAAK;AAChB"}
@@ -1,16 +1,27 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
1
+ //#region src/utils/urls.ts
2
+ /**
3
+ * Build a repository base url from the prismic base url
4
+ *
5
+ * @param baseUrl - Prismic base url like prismic.io
6
+ * @param repository - The repository name
7
+ * @returns The repository url like https://my-repo.prismic.io
8
+ */
3
9
  function getRepositoryUrl(baseUrl, repository) {
4
- const url = new URL(baseUrl);
5
- url.hostname = `${repository}.${url.hostname}`;
6
- return url.toString();
10
+ const url = new URL(baseUrl);
11
+ url.hostname = `${repository}.${url.hostname}`;
12
+ return url.toString();
7
13
  }
14
+ /**
15
+ * Prevent issues when building urls using `URL` that contain sub path without trailing slashes.
16
+ *
17
+ * @returns The original url with a trailing slash, if needed.
18
+ */
8
19
  function appendTrailingSlash(url) {
9
- if (!url.endsWith("/")) {
10
- return url + "/";
11
- }
12
- return url;
20
+ if (!url.endsWith("/")) return url + "/";
21
+ return url;
13
22
  }
23
+ //#endregion
14
24
  exports.appendTrailingSlash = appendTrailingSlash;
15
25
  exports.getRepositoryUrl = getRepositoryUrl;
16
- //# sourceMappingURL=urls.cjs.map
26
+
27
+ //# sourceMappingURL=urls.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"urls.cjs","sources":["../../../src/utils/urls.ts"],"sourcesContent":["/**\n * Build a repository base url from the prismic base url\n *\n * @param baseUrl - prismic base url like prismic.io\n * @param repository - the repository name\n *\n * @returns the repository url like https://my-repo.prismic.io\n */\nexport function getRepositoryUrl(baseUrl: string, repository: string): string {\n\tconst url = new URL(baseUrl);\n\turl.hostname = `${repository}.${url.hostname}`;\n\n\treturn url.toString();\n}\n\n/**\n * Prevent issues when building urls using `URL` that contain sub path without\n * trailing slashes.\n *\n * @returns the original url with a trailing slash, if needed.\n */\nexport function appendTrailingSlash(url: string): string {\n\tif (!url.endsWith(\"/\")) {\n\t\treturn url + \"/\";\n\t}\n\n\treturn url;\n}\n"],"names":[],"mappings":";;AAQgB,SAAA,iBAAiB,SAAiB,YAAkB;AAC7D,QAAA,MAAM,IAAI,IAAI,OAAO;AAC3B,MAAI,WAAW,GAAG,UAAU,IAAI,IAAI,QAAQ;AAE5C,SAAO,IAAI;AACZ;AAQM,SAAU,oBAAoB,KAAW;AAC9C,MAAI,CAAC,IAAI,SAAS,GAAG,GAAG;AACvB,WAAO,MAAM;AAAA,EACd;AAEO,SAAA;AACR;;;"}
1
+ {"version":3,"file":"urls.cjs","names":[],"sources":["../../src/utils/urls.ts"],"sourcesContent":["/**\n * Build a repository base url from the prismic base url\n *\n * @param baseUrl - Prismic base url like prismic.io\n * @param repository - The repository name\n * @returns The repository url like https://my-repo.prismic.io\n */\nexport function getRepositoryUrl(baseUrl: string, repository: string): string {\n\tconst url = new URL(baseUrl)\n\turl.hostname = `${repository}.${url.hostname}`\n\n\treturn url.toString()\n}\n\n/**\n * Prevent issues when building urls using `URL` that contain sub path without trailing slashes.\n *\n * @returns The original url with a trailing slash, if needed.\n */\nexport function appendTrailingSlash(url: string): string {\n\tif (!url.endsWith(\"/\")) {\n\t\treturn url + \"/\"\n\t}\n\n\treturn url\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,iBAAiB,SAAiB,YAA4B;CAC7E,MAAM,MAAM,IAAI,IAAI,OAAO;CAC3B,IAAI,WAAW,GAAG,WAAW,GAAG,IAAI;CAEpC,OAAO,IAAI,SAAS;AACrB;;;;;;AAOA,SAAgB,oBAAoB,KAAqB;CACxD,IAAI,CAAC,IAAI,SAAS,GAAG,GACpB,OAAO,MAAM;CAGd,OAAO;AACR"}
@@ -1,16 +1,26 @@
1
+ //#region src/utils/urls.ts
2
+ /**
3
+ * Build a repository base url from the prismic base url
4
+ *
5
+ * @param baseUrl - Prismic base url like prismic.io
6
+ * @param repository - The repository name
7
+ * @returns The repository url like https://my-repo.prismic.io
8
+ */
1
9
  function getRepositoryUrl(baseUrl, repository) {
2
- const url = new URL(baseUrl);
3
- url.hostname = `${repository}.${url.hostname}`;
4
- return url.toString();
10
+ const url = new URL(baseUrl);
11
+ url.hostname = `${repository}.${url.hostname}`;
12
+ return url.toString();
5
13
  }
14
+ /**
15
+ * Prevent issues when building urls using `URL` that contain sub path without trailing slashes.
16
+ *
17
+ * @returns The original url with a trailing slash, if needed.
18
+ */
6
19
  function appendTrailingSlash(url) {
7
- if (!url.endsWith("/")) {
8
- return url + "/";
9
- }
10
- return url;
20
+ if (!url.endsWith("/")) return url + "/";
21
+ return url;
11
22
  }
12
- export {
13
- appendTrailingSlash,
14
- getRepositoryUrl
15
- };
16
- //# sourceMappingURL=urls.js.map
23
+ //#endregion
24
+ export { appendTrailingSlash, getRepositoryUrl };
25
+
26
+ //# sourceMappingURL=urls.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"urls.js","sources":["../../../src/utils/urls.ts"],"sourcesContent":["/**\n * Build a repository base url from the prismic base url\n *\n * @param baseUrl - prismic base url like prismic.io\n * @param repository - the repository name\n *\n * @returns the repository url like https://my-repo.prismic.io\n */\nexport function getRepositoryUrl(baseUrl: string, repository: string): string {\n\tconst url = new URL(baseUrl);\n\turl.hostname = `${repository}.${url.hostname}`;\n\n\treturn url.toString();\n}\n\n/**\n * Prevent issues when building urls using `URL` that contain sub path without\n * trailing slashes.\n *\n * @returns the original url with a trailing slash, if needed.\n */\nexport function appendTrailingSlash(url: string): string {\n\tif (!url.endsWith(\"/\")) {\n\t\treturn url + \"/\";\n\t}\n\n\treturn url;\n}\n"],"names":[],"mappings":"AAQgB,SAAA,iBAAiB,SAAiB,YAAkB;AAC7D,QAAA,MAAM,IAAI,IAAI,OAAO;AAC3B,MAAI,WAAW,GAAG,UAAU,IAAI,IAAI,QAAQ;AAE5C,SAAO,IAAI;AACZ;AAQM,SAAU,oBAAoB,KAAW;AAC9C,MAAI,CAAC,IAAI,SAAS,GAAG,GAAG;AACvB,WAAO,MAAM;AAAA,EACd;AAEO,SAAA;AACR;"}
1
+ {"version":3,"file":"urls.js","names":[],"sources":["../../src/utils/urls.ts"],"sourcesContent":["/**\n * Build a repository base url from the prismic base url\n *\n * @param baseUrl - Prismic base url like prismic.io\n * @param repository - The repository name\n * @returns The repository url like https://my-repo.prismic.io\n */\nexport function getRepositoryUrl(baseUrl: string, repository: string): string {\n\tconst url = new URL(baseUrl)\n\turl.hostname = `${repository}.${url.hostname}`\n\n\treturn url.toString()\n}\n\n/**\n * Prevent issues when building urls using `URL` that contain sub path without trailing slashes.\n *\n * @returns The original url with a trailing slash, if needed.\n */\nexport function appendTrailingSlash(url: string): string {\n\tif (!url.endsWith(\"/\")) {\n\t\treturn url + \"/\"\n\t}\n\n\treturn url\n}\n"],"mappings":";;;;;;;;AAOA,SAAgB,iBAAiB,SAAiB,YAA4B;CAC7E,MAAM,MAAM,IAAI,IAAI,OAAO;CAC3B,IAAI,WAAW,GAAG,WAAW,GAAG,IAAI;CAEpC,OAAO,IAAI,SAAS;AACrB;;;;;;AAOA,SAAgB,oBAAoB,KAAqB;CACxD,IAAI,CAAC,IAAI,SAAS,GAAG,GACpB,OAAO,MAAM;CAGd,OAAO;AACR"}
package/package.json CHANGED
@@ -1,100 +1,75 @@
1
1
  {
2
2
  "name": "@prismicio/e2e-tests-utils",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "description": "A collection of utilities for to manage Prismic test data",
5
5
  "keywords": [
6
- "typescript",
7
- "prismic"
6
+ "prismic",
7
+ "typescript"
8
8
  ],
9
+ "license": "Apache-2.0",
10
+ "author": "Prismic <contact@prismic.io> (https://prismic.io)",
9
11
  "repository": {
10
12
  "type": "git",
11
- "url": "git+ssh://git@github.com/prismicio/prismic-e2e-tests-utils.git"
13
+ "url": "ssh://git@github.com/prismicio/prismic-e2e-tests-utils.git"
12
14
  },
13
- "license": "Apache-2.0",
14
- "author": "Prismic <contact@prismic.io> (https://prismic.io)",
15
+ "files": [
16
+ "./dist",
17
+ "./src"
18
+ ],
15
19
  "type": "module",
20
+ "main": "./dist/index.cjs",
21
+ "module": "./dist/index.js",
22
+ "types": "./dist/index.d.cts",
16
23
  "exports": {
17
24
  ".": {
18
- "require": {
19
- "types": "./dist/index.d.ts",
20
- "default": "./dist/index.cjs"
21
- },
22
- "import": {
23
- "types": "./dist/index.d.ts",
24
- "default": "./dist/index.js"
25
- }
25
+ "import": "./dist/index.js",
26
+ "require": "./dist/index.cjs"
26
27
  },
27
28
  "./package.json": "./package.json"
28
29
  },
29
- "main": "./dist/index.cjs",
30
- "module": "./dist/index.js",
31
- "types": "./dist/index.d.ts",
32
- "files": [
33
- "./dist",
34
- "./src"
35
- ],
30
+ "publishConfig": {
31
+ "access": "public"
32
+ },
36
33
  "scripts": {
37
- "build": "vite build",
38
- "dev": "vite build --watch",
39
- "format": "prettier --write .",
34
+ "build": "tsdown",
35
+ "dev": "tsdown --watch",
36
+ "format": "oxfmt",
40
37
  "prepare": "npm run build",
41
- "release": "npm run test && standard-version && git push --follow-tags && npm run build && npm publish",
42
- "release:dry": "standard-version --dry-run",
43
- "release:patch": "npm run test && standard-version --release-as patch && git push --follow-tags && npm run build && npm publish",
44
- "release:patch:dry": "standard-version --dry-run --release-as patch",
45
- "release:alpha": "npm run test && standard-version --prerelease alpha && git push --follow-tags && npm run build && npm publish --tag alpha",
46
- "release:alpha:dry": "standard-version --prerelease alpha --dry-run",
47
- "lint": "eslint --ext .js,.ts .",
48
- "lint:fix": "eslint --fix --ext .js,.ts .",
49
- "types": "vitest --typecheck --run && tsc --noEmit",
50
- "types:watch": "vitest --typecheck",
38
+ "lint": "oxlint --deny-warnings",
39
+ "types": "tsc --noEmit",
51
40
  "unit": "vitest run --coverage",
52
41
  "unit:watch": "vitest watch",
53
- "size": "size-limit",
54
- "test": "npm run lint && npm run types && npm run unit && npm run build && npm run size"
42
+ "test": "npm run lint && npm run types && npm run unit && npm run build"
55
43
  },
56
44
  "dependencies": {
57
- "axios": "^1.6.2",
58
- "jsonwebtoken": "^9.0.2",
45
+ "axios": "^1.18.1",
46
+ "jsonwebtoken": "^9.0.3",
59
47
  "lodash.isequal": "^4.5.0",
60
- "winston": "^3.11.0"
48
+ "winston": "^3.19.0"
49
+ },
50
+ "devDependencies": {
51
+ "@prismicio/types-internal": "^4.5.1",
52
+ "@types/jsonwebtoken": "^9.0.10",
53
+ "@types/lodash.isequal": "^4.5.8",
54
+ "@types/node": "^26.0.1",
55
+ "@vitest/coverage-v8": "^4.1.9",
56
+ "msw": "^2.14.6",
57
+ "oxfmt": "^0.57.0",
58
+ "oxlint": "^1.72.0",
59
+ "tsdown": "^0.22.3",
60
+ "typescript": "^6.0.3",
61
+ "vitest": "^4.1.9"
61
62
  },
62
63
  "peerDependencies": {
63
- "@playwright/test": ">= 1.16",
64
- "@prismicio/types-internal": ">= 2.3.1"
64
+ "@playwright/test": ">=1.16",
65
+ "@prismicio/types-internal": ">=2.3.1"
65
66
  },
66
67
  "peerDependenciesMeta": {
67
68
  "@prismicio/types-internal": {
68
69
  "optional": true
69
70
  }
70
71
  },
71
- "devDependencies": {
72
- "@size-limit/preset-small-lib": "^11.0.1",
73
- "@trivago/prettier-plugin-sort-imports": "^4.2.0",
74
- "@types/jsonwebtoken": "^9.0.6",
75
- "@types/lodash.isequal": "^4.5.8",
76
- "@types/node": "^20.9.2",
77
- "@typescript-eslint/eslint-plugin": "^6.8.0",
78
- "@typescript-eslint/parser": "^6.8.0",
79
- "@vitest/coverage-v8": "^1.0.4",
80
- "eslint": "^8.51.0",
81
- "eslint-config-prettier": "^9.0.0",
82
- "eslint-plugin-prettier": "^5.0.1",
83
- "eslint-plugin-tsdoc": "^0.2.17",
84
- "msw": "^2.2.13",
85
- "prettier": "^3.0.3",
86
- "prettier-plugin-jsdoc": "^1.1.1",
87
- "size-limit": "^11.0.1",
88
- "standard-version": "^9.5.0",
89
- "typescript": "^5.2.2",
90
- "vite": "^5.0.9",
91
- "vite-plugin-sdk": "^0.1.1",
92
- "vitest": "^1.0.4"
93
- },
94
72
  "engines": {
95
73
  "node": ">=18.0.0"
96
- },
97
- "publishConfig": {
98
- "access": "public"
99
74
  }
100
75
  }
@@ -1,25 +1,24 @@
1
- import { APIRequestContext, request } from "@playwright/test";
1
+ import type { APIRequestContext } from "@playwright/test"
2
+ import { request } from "@playwright/test"
2
3
 
3
- import { appendTrailingSlash } from "../utils/urls";
4
+ import { appendTrailingSlash } from "../utils/urls"
4
5
 
5
6
  /**
6
- * The authentication token. Can be a string or a function that returns a
7
- * promise resolving to the token.
7
+ * The authentication token. Can be a string or a function that returns a promise resolving to the
8
+ * token.
8
9
  */
9
- export type AuthServerToken = string | (() => Promise<string>);
10
+ export type AuthServerToken = string | (() => Promise<string>)
10
11
 
11
12
  /**
12
- * Abstract class for Prismic api clients that use the Prismic authentication
13
- * server. This class takes care or creating the Playwright context with the
14
- * necessary authorization headers.
13
+ * Abstract class for Prismic api clients that use the Prismic authentication server. This class
14
+ * takes care or creating the Playwright context with the necessary authorization headers.
15
15
  *
16
- * This class performs requests with Playwright instead of a library like Axios
17
- * which has the advantage of tracing all the network details in the Playwright
18
- * reports making test failures investigation easier for projects that use
19
- * Playwright.
16
+ * This class performs requests with Playwright instead of a library like Axios which has the
17
+ * advantage of tracing all the network details in the Playwright reports making test failures
18
+ * investigation easier for projects that use Playwright.
20
19
  */
21
20
  export abstract class AuthenticatedApiClient {
22
- private _context?: APIRequestContext;
21
+ private _context?: APIRequestContext
23
22
 
24
23
  constructor(
25
24
  private readonly baseURL: string,
@@ -27,14 +26,10 @@ export abstract class AuthenticatedApiClient {
27
26
  private readonly headers?: { [key: string]: string } | undefined,
28
27
  ) {}
29
28
 
30
- /**
31
- * Returns a Playwright ApiRequestContext instance with the necessary
32
- * authorization headers.
33
- */
29
+ /** Returns a Playwright ApiRequestContext instance with the necessary authorization headers. */
34
30
  protected async getContext(): Promise<APIRequestContext> {
35
31
  if (!this._context) {
36
- const token =
37
- typeof this.token === "string" ? this.token : await this.token();
32
+ const token = typeof this.token === "string" ? this.token : await this.token()
38
33
 
39
34
  this._context = await request.newContext({
40
35
  baseURL: appendTrailingSlash(this.baseURL),
@@ -42,9 +37,9 @@ export abstract class AuthenticatedApiClient {
42
37
  Authorization: `Bearer ${token}`,
43
38
  ...this.headers,
44
39
  },
45
- });
40
+ })
46
41
  }
47
42
 
48
- return this._context;
43
+ return this._context
49
44
  }
50
45
  }