@prismicio/e2e-tests-utils 1.18.0 → 1.19.0-canary.d349d21

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 +154 -145
  36. package/dist/clients/coreApi.cjs.map +1 -1
  37. package/dist/clients/coreApi.d.cts +143 -0
  38. package/dist/clients/coreApi.d.cts.map +1 -0
  39. package/dist/clients/coreApi.d.ts +132 -109
  40. package/dist/clients/coreApi.d.ts.map +1 -0
  41. package/dist/clients/coreApi.js +153 -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 +595 -616
  96. package/dist/managers/repository.cjs.map +1 -1
  97. package/dist/managers/repository.d.cts +341 -0
  98. package/dist/managers/repository.d.cts.map +1 -0
  99. package/dist/managers/repository.d.ts +336 -307
  100. package/dist/managers/repository.d.ts.map +1 -0
  101. package/dist/managers/repository.js +595 -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 +111 -129
  136. package/src/clients/coreApi.ts +166 -117
  137. package/src/clients/customTypesApi.ts +54 -74
  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 +410 -378
  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,173 +1,156 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
- var __publicField = (obj, key, value) => {
5
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
6
- return value;
7
- };
8
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
9
- const axios = require("axios");
10
- const jwt = require("jsonwebtoken");
11
- const cookies = require("../utils/cookies.cjs");
1
+ const require_runtime = require("../_virtual/_rolldown/runtime.cjs");
2
+ const require_cookies = require("../utils/cookies.cjs");
3
+ let axios = require("axios");
4
+ axios = require_runtime.__toESM(axios, 1);
5
+ let jsonwebtoken = require("jsonwebtoken");
6
+ jsonwebtoken = require_runtime.__toESM(jsonwebtoken, 1);
7
+ //#region src/clients/manageV2.ts
12
8
  const ManageV2StaticAuthor = "prismic-e2e-tests-utils";
13
- class ManageV2Client {
14
- /**
15
- * @param baseURL - The base URL of the Wroom app. ex: https://prismic.io
16
- * @param config - ManageV2 configuration variable to call ManageV2.
17
- */
18
- constructor(baseUrl, config) {
19
- __publicField(this, "client");
20
- // Not private to have it available on tests
21
- __publicField(this, "token", null);
22
- /**
23
- * The function `toggleRolePerLocal` enables or disables the RolesPerLocale
24
- * workflow
25
- *
26
- * @param repository - The Repository name
27
- * @param enabled - The feature new status
28
- */
29
- __publicField(this, "toggleRolePerLocal", this.assertTokenExist((params) => {
30
- return this.client.post("/repository/toggleRolesPerLocale", {
31
- domain: params.repository,
32
- enabled: params.enabled,
33
- author: ManageV2StaticAuthor
34
- });
35
- }));
36
- /**
37
- * The function `toggleCustomRoles` enables or disables the CustomRoles
38
- * workflow
39
- *
40
- * @param repository - The Repository name
41
- * @param enabled - The feature new status
42
- */
43
- __publicField(this, "toggleCustomRoles", this.assertTokenExist((params) => {
44
- return this.client.post("/repository/toggleCustomRoles", {
45
- domain: params.repository,
46
- enabled: params.enabled,
47
- author: ManageV2StaticAuthor
48
- });
49
- }));
50
- /**
51
- * The function `toggleIntegrationFields` enables or disables the Integration
52
- * Fields feature
53
- *
54
- * @param repository - The Repository name
55
- * @param enabled - The feature new status
56
- */
57
- __publicField(this, "toggleIntegrationFields", this.assertTokenExist((params) => {
58
- return this.client.post("/repository/toggleIntegrationFields", {
59
- domain: params.repository,
60
- enabled: params.enabled,
61
- author: ManageV2StaticAuthor
62
- });
63
- }));
64
- /**
65
- * The function `changePlan` changes the plan of a repository the database
66
- *
67
- * @param repository - The Repository name
68
- * @param newPlanId - The new planId
69
- * @param bypassManualBilling - Beware that using this will not verify that
70
- * the database and Stripe are in sync
71
- */
72
- __publicField(this, "changePlan", this.assertTokenExist(({ repository, newPlanId, bypassManualBilling = false }) => {
73
- return this.client.post(`/repository/changePlan?bypassManualBilling=${bypassManualBilling}`, {
74
- domain: repository,
75
- newPlan: newPlanId,
76
- author: ManageV2StaticAuthor
77
- });
78
- }));
79
- /**
80
- * The function `addUserToRepository` adds a user corresponding to the email
81
- * to the given repository
82
- *
83
- * @param repository - The Repository name
84
- * @param email - The user email
85
- */
86
- __publicField(this, "addUserToRepository", this.assertTokenExist(({ repository, email }) => {
87
- return this.client.post("/repository/addUser", {
88
- domain: repository,
89
- email,
90
- author: ManageV2StaticAuthor
91
- });
92
- }));
93
- /**
94
- * The function `removeUserFromRepository` removes a user corresponding to the
95
- * email from the given repository
96
- *
97
- * @param repository - The Repository name
98
- * @param email - The user email
99
- */
100
- __publicField(this, "removeUserFromRepository", this.assertTokenExist(({ repository, email }) => {
101
- return this.client.post("/repository/removeUser", {
102
- domain: repository,
103
- email,
104
- author: ManageV2StaticAuthor
105
- });
106
- }));
107
- this.token = config ? this.generateToken(config) : null;
108
- this.client = axios.create({
109
- baseURL: `${baseUrl}/manageroutes/`,
110
- withCredentials: true,
111
- validateStatus: () => true,
112
- headers: {
113
- "User-Agent": "prismic-cli/prismic-e2e-tests-utils",
114
- Authorization: `Bearer ${this.token}`
115
- }
116
- });
117
- this.client.interceptors.response.use((response) => {
118
- const cookies$1 = response.headers["set-cookie"];
119
- if (cookies$1 && cookies.extractCookie(cookies$1, "SESSION")) {
120
- this.client.defaults.headers["Cookie"] = cookies$1;
121
- }
122
- return response;
123
- });
124
- }
125
- /**
126
- * The function generates a JWT token using the provided configuration
127
- * parameters.
128
- *
129
- * @param {ManageV2Config} config - The `config` parameter in the
130
- * `generateToken` function is of type `ManageV2Config`. It contains the
131
- * following properties:
132
- *
133
- * @returns A JSON Web Token (JWT) is being returned by the `generateToken`
134
- * function. The token is signed using the provided `config.secret` with the
135
- * HS256 algorithm and includes the specified audience and issuer values.
136
- */
137
- generateToken(config) {
138
- return jwt.sign({}, config.secret, {
139
- algorithm: "HS256",
140
- audience: config.audience,
141
- issuer: "prismic.io"
142
- });
143
- }
144
- /**
145
- * The function `assertTokenExist` checks if a token exists before executing a
146
- * given function.
147
- *
148
- * @param f - The `assertTokenExist` function takes a function `f` as a
149
- * parameter. This function `f` should accept a parameter of type
150
- * `Parameters` and return a Promise that resolves to an AxiosResponse. The
151
- * `assertTokenExist` function ensures that a token is not null before
152
- * calling the provided
153
- *
154
- * @returns A function is being returned that takes a parameter of type
155
- * Parameters and checks if the token is null. If the token is null, an
156
- * error is thrown. Otherwise, the function f is called with the provided
157
- * parameters.
158
- */
159
- assertTokenExist(f) {
160
- return (params) => {
161
- if (this.token === null) {
162
- throw new Error("Undefined configuration for ManageV2 while trying to use it's routes");
163
- } else {
164
- return f(params);
165
- }
166
- };
167
- }
168
- getBaseURL() {
169
- return this.client.getUri();
170
- }
171
- }
9
+ /** Client for interacting with ManageV2 routes to perform operations on repositories. */
10
+ var ManageV2Client = class {
11
+ client;
12
+ token = null;
13
+ /**
14
+ * @param baseURL - The base URL of the Wroom app. ex: https://prismic.io
15
+ * @param config - ManageV2 configuration variable to call ManageV2.
16
+ */
17
+ constructor(baseUrl, config) {
18
+ this.token = config ? this.generateToken(config) : null;
19
+ this.client = axios.default.create({
20
+ baseURL: `${baseUrl}/manageroutes/`,
21
+ withCredentials: true,
22
+ validateStatus: () => true,
23
+ headers: {
24
+ "User-Agent": "prismic-cli/prismic-e2e-tests-utils",
25
+ Authorization: `Bearer ${this.token}`
26
+ }
27
+ });
28
+ this.client.interceptors.response.use((response) => {
29
+ const cookies = response.headers["set-cookie"];
30
+ if (cookies && require_cookies.extractCookie(cookies, "SESSION")) this.client.defaults.headers["Cookie"] = cookies;
31
+ return response;
32
+ });
33
+ }
34
+ /**
35
+ * The function generates a JWT token using the provided configuration parameters.
36
+ *
37
+ * @param {ManageV2Config} config - The `config` parameter in the `generateToken` function is of
38
+ * type `ManageV2Config`. It contains the following properties:
39
+ * @returns A JSON Web Token (JWT) is being returned by the `generateToken` function. The token is
40
+ * signed using the provided `config.secret` with the HS256 algorithm and includes the specified
41
+ * audience and issuer values.
42
+ */
43
+ generateToken(config) {
44
+ return jsonwebtoken.default.sign({}, config.secret, {
45
+ algorithm: "HS256",
46
+ audience: config.audience,
47
+ issuer: "prismic.io"
48
+ });
49
+ }
50
+ /**
51
+ * The function `assertTokenExist` checks if a token exists before executing a given function.
52
+ *
53
+ * @param f - The `assertTokenExist` function takes a function `f` as a parameter. This function
54
+ * `f` should accept a parameter of type `Parameters` and return a Promise that resolves to an
55
+ * AxiosResponse. The `assertTokenExist` function ensures that a token is not null before
56
+ * calling the provided
57
+ * @returns A function is being returned that takes a parameter of type Parameters and checks if
58
+ * the token is null. If the token is null, an error is thrown. Otherwise, the function f is
59
+ * called with the provided parameters.
60
+ */
61
+ assertTokenExist(f) {
62
+ return (params) => {
63
+ if (this.token === null) throw new Error("Undefined configuration for ManageV2 while trying to use it's routes");
64
+ else return f(params);
65
+ };
66
+ }
67
+ getBaseURL() {
68
+ return this.client.getUri();
69
+ }
70
+ /**
71
+ * The function `toggleRolePerLocal` enables or disables the RolesPerLocale workflow
72
+ *
73
+ * @param repository - The Repository name
74
+ * @param enabled - The feature new status
75
+ */
76
+ toggleRolePerLocal = this.assertTokenExist((params) => {
77
+ return this.client.post("/repository/toggleRolesPerLocale", {
78
+ domain: params.repository,
79
+ enabled: params.enabled,
80
+ author: ManageV2StaticAuthor
81
+ });
82
+ });
83
+ /**
84
+ * The function `toggleCustomRoles` enables or disables the CustomRoles workflow
85
+ *
86
+ * @param repository - The Repository name
87
+ * @param enabled - The feature new status
88
+ */
89
+ toggleCustomRoles = this.assertTokenExist((params) => {
90
+ return this.client.post("/repository/toggleCustomRoles", {
91
+ domain: params.repository,
92
+ enabled: params.enabled,
93
+ author: ManageV2StaticAuthor
94
+ });
95
+ });
96
+ /**
97
+ * The function `toggleIntegrationFields` enables or disables the Integration Fields feature
98
+ *
99
+ * @param repository - The Repository name
100
+ * @param enabled - The feature new status
101
+ */
102
+ toggleIntegrationFields = this.assertTokenExist((params) => {
103
+ return this.client.post("/repository/toggleIntegrationFields", {
104
+ domain: params.repository,
105
+ enabled: params.enabled,
106
+ author: ManageV2StaticAuthor
107
+ });
108
+ });
109
+ /**
110
+ * The function `changePlan` changes the plan of a repository the database
111
+ *
112
+ * @param repository - The Repository name
113
+ * @param newPlanId - The new planId
114
+ * @param bypassManualBilling - Beware that using this will not verify that the database and
115
+ * Stripe are in sync
116
+ */
117
+ changePlan = this.assertTokenExist(({ repository, newPlanId, bypassManualBilling = false }) => {
118
+ return this.client.post(`/repository/changePlan?bypassManualBilling=${bypassManualBilling}`, {
119
+ domain: repository,
120
+ newPlan: newPlanId,
121
+ author: ManageV2StaticAuthor
122
+ });
123
+ });
124
+ /**
125
+ * The function `addUserToRepository` adds a user corresponding to the email to the given
126
+ * repository
127
+ *
128
+ * @param repository - The Repository name
129
+ * @param email - The user email
130
+ */
131
+ addUserToRepository = this.assertTokenExist(({ repository, email }) => {
132
+ return this.client.post("/repository/addUser", {
133
+ domain: repository,
134
+ email,
135
+ author: ManageV2StaticAuthor
136
+ });
137
+ });
138
+ /**
139
+ * The function `removeUserFromRepository` removes a user corresponding to the email from the
140
+ * given repository
141
+ *
142
+ * @param repository - The Repository name
143
+ * @param email - The user email
144
+ */
145
+ removeUserFromRepository = this.assertTokenExist(({ repository, email }) => {
146
+ return this.client.post("/repository/removeUser", {
147
+ domain: repository,
148
+ email,
149
+ author: ManageV2StaticAuthor
150
+ });
151
+ });
152
+ };
153
+ //#endregion
172
154
  exports.ManageV2Client = ManageV2Client;
173
- //# sourceMappingURL=manageV2.cjs.map
155
+
156
+ //# sourceMappingURL=manageV2.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"manageV2.cjs","sources":["../../../src/clients/manageV2.ts"],"sourcesContent":["import axios, { AxiosInstance, AxiosResponse } from \"axios\";\nimport jwt from \"jsonwebtoken\";\n\nimport { ManageV2Config } from \"../types\";\n\nimport { extractCookie } from \"../utils/cookies\";\n\nconst ManageV2StaticAuthor = \"prismic-e2e-tests-utils\";\n\n/**\n * Client for interacting with ManageV2 routes to perform operations on\n * repositories.\n */\nexport class ManageV2Client {\n\treadonly client: AxiosInstance; // Not private to have it available on tests\n\tprivate token: string | null = null;\n\n\t/**\n\t * @param baseURL - The base URL of the Wroom app. ex: https://prismic.io\n\t * @param config - ManageV2 configuration variable to call ManageV2.\n\t */\n\tconstructor(baseUrl: string, config?: ManageV2Config | undefined) {\n\t\tthis.token = config ? this.generateToken(config) : null;\n\n\t\tthis.client = axios.create({\n\t\t\tbaseURL: `${baseUrl}/manageroutes/`,\n\t\t\twithCredentials: true,\n\t\t\tvalidateStatus: () => true,\n\t\t\theaders: {\n\t\t\t\t\"User-Agent\": \"prismic-cli/prismic-e2e-tests-utils\",\n\t\t\t\tAuthorization: `Bearer ${this.token}`,\n\t\t\t},\n\t\t});\n\n\t\t// cookies are not forwarded automatically in a non-browser env\n\t\tthis.client.interceptors.response.use((response) => {\n\t\t\tconst cookies = response.headers[\"set-cookie\"];\n\t\t\tif (cookies && extractCookie(cookies, \"SESSION\")) {\n\t\t\t\tthis.client.defaults.headers[\"Cookie\"] = cookies;\n\t\t\t}\n\n\t\t\treturn response;\n\t\t});\n\t}\n\n\t/**\n\t * The function generates a JWT token using the provided configuration\n\t * parameters.\n\t *\n\t * @param {ManageV2Config} config - The `config` parameter in the\n\t * `generateToken` function is of type `ManageV2Config`. It contains the\n\t * following properties:\n\t *\n\t * @returns A JSON Web Token (JWT) is being returned by the `generateToken`\n\t * function. The token is signed using the provided `config.secret` with the\n\t * HS256 algorithm and includes the specified audience and issuer values.\n\t */\n\tprivate generateToken(config: ManageV2Config): string {\n\t\treturn jwt.sign({}, config.secret, {\n\t\t\talgorithm: \"HS256\",\n\t\t\taudience: config.audience,\n\t\t\tissuer: \"prismic.io\",\n\t\t});\n\t}\n\n\t/**\n\t * The function `assertTokenExist` checks if a token exists before executing a\n\t * given function.\n\t *\n\t * @param f - The `assertTokenExist` function takes a function `f` as a\n\t * parameter. This function `f` should accept a parameter of type\n\t * `Parameters` and return a Promise that resolves to an AxiosResponse. The\n\t * `assertTokenExist` function ensures that a token is not null before\n\t * calling the provided\n\t *\n\t * @returns A function is being returned that takes a parameter of type\n\t * Parameters and checks if the token is null. If the token is null, an\n\t * error is thrown. Otherwise, the function f is called with the provided\n\t * parameters.\n\t */\n\tprivate assertTokenExist<Parameters>(\n\t\tf: (_: Parameters) => Promise<AxiosResponse>,\n\t) {\n\t\treturn (params: Parameters) => {\n\t\t\tif (this.token === null) {\n\t\t\t\tthrow new Error(\n\t\t\t\t\t\"Undefined configuration for ManageV2 while trying to use it's routes\",\n\t\t\t\t);\n\t\t\t} else {\n\t\t\t\treturn f(params);\n\t\t\t}\n\t\t};\n\t}\n\n\tgetBaseURL(): string {\n\t\treturn this.client.getUri();\n\t}\n\n\t/**\n\t * The function `toggleRolePerLocal` enables or disables the RolesPerLocale\n\t * workflow\n\t *\n\t * @param repository - The Repository name\n\t * @param enabled - The feature new status\n\t */\n\ttoggleRolePerLocal = this.assertTokenExist(\n\t\t(params: { repository: string; enabled: boolean }) => {\n\t\t\treturn this.client.post(\"/repository/toggleRolesPerLocale\", {\n\t\t\t\tdomain: params.repository,\n\t\t\t\tenabled: params.enabled,\n\t\t\t\tauthor: ManageV2StaticAuthor,\n\t\t\t});\n\t\t},\n\t);\n\n\t/**\n\t * The function `toggleCustomRoles` enables or disables the CustomRoles\n\t * workflow\n\t *\n\t * @param repository - The Repository name\n\t * @param enabled - The feature new status\n\t */\n\ttoggleCustomRoles = this.assertTokenExist(\n\t\t(params: { repository: string; enabled: boolean }) => {\n\t\t\treturn this.client.post(\"/repository/toggleCustomRoles\", {\n\t\t\t\tdomain: params.repository,\n\t\t\t\tenabled: params.enabled,\n\t\t\t\tauthor: ManageV2StaticAuthor,\n\t\t\t});\n\t\t},\n\t);\n\n\t/**\n\t * The function `toggleIntegrationFields` enables or disables the Integration\n\t * Fields feature\n\t *\n\t * @param repository - The Repository name\n\t * @param enabled - The feature new status\n\t */\n\ttoggleIntegrationFields = this.assertTokenExist(\n\t\t(params: { repository: string; enabled: boolean }) => {\n\t\t\treturn this.client.post(\"/repository/toggleIntegrationFields\", {\n\t\t\t\tdomain: params.repository,\n\t\t\t\tenabled: params.enabled,\n\t\t\t\tauthor: ManageV2StaticAuthor,\n\t\t\t});\n\t\t},\n\t);\n\n\t/**\n\t * The function `changePlan` changes the plan of a repository the database\n\t *\n\t * @param repository - The Repository name\n\t * @param newPlanId - The new planId\n\t * @param bypassManualBilling - Beware that using this will not verify that\n\t * the database and Stripe are in sync\n\t */\n\tchangePlan = this.assertTokenExist(\n\t\t({\n\t\t\trepository,\n\t\t\tnewPlanId,\n\t\t\tbypassManualBilling = false,\n\t\t}: {\n\t\t\trepository: string;\n\t\t\tnewPlanId: string;\n\t\t\tbypassManualBilling?: boolean;\n\t\t}) => {\n\t\t\treturn this.client.post(\n\t\t\t\t`/repository/changePlan?bypassManualBilling=${bypassManualBilling}`,\n\t\t\t\t{\n\t\t\t\t\tdomain: repository,\n\t\t\t\t\tnewPlan: newPlanId,\n\t\t\t\t\tauthor: ManageV2StaticAuthor,\n\t\t\t\t},\n\t\t\t);\n\t\t},\n\t);\n\n\t/**\n\t * The function `addUserToRepository` adds a user corresponding to the email\n\t * to the given repository\n\t *\n\t * @param repository - The Repository name\n\t * @param email - The user email\n\t */\n\taddUserToRepository = this.assertTokenExist(\n\t\t({ repository, email }: { repository: string; email: string }) => {\n\t\t\treturn this.client.post(\"/repository/addUser\", {\n\t\t\t\tdomain: repository,\n\t\t\t\temail: email,\n\t\t\t\tauthor: ManageV2StaticAuthor,\n\t\t\t});\n\t\t},\n\t);\n\n\t/**\n\t * The function `removeUserFromRepository` removes a user corresponding to the\n\t * email from the given repository\n\t *\n\t * @param repository - The Repository name\n\t * @param email - The user email\n\t */\n\tremoveUserFromRepository = this.assertTokenExist(\n\t\t({ repository, email }: { repository: string; email: string }) => {\n\t\t\treturn this.client.post(\"/repository/removeUser\", {\n\t\t\t\tdomain: repository,\n\t\t\t\temail: email,\n\t\t\t\tauthor: ManageV2StaticAuthor,\n\t\t\t});\n\t\t},\n\t);\n}\n"],"names":["cookies","extractCookie"],"mappings":"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"}
1
+ {"version":3,"file":"manageV2.cjs","names":["extractCookie","jwt"],"sources":["../../src/clients/manageV2.ts"],"sourcesContent":["import type { AxiosInstance, AxiosResponse } from \"axios\"\nimport axios from \"axios\"\nimport jwt from \"jsonwebtoken\"\n\nimport type { ManageV2Config } from \"../types\"\nimport { extractCookie } from \"../utils/cookies\"\n\nconst ManageV2StaticAuthor = \"prismic-e2e-tests-utils\"\n\n/** Client for interacting with ManageV2 routes to perform operations on repositories. */\nexport class ManageV2Client {\n\treadonly client: AxiosInstance // Not private to have it available on tests\n\tprivate token: string | null = null\n\n\t/**\n\t * @param baseURL - The base URL of the Wroom app. ex: https://prismic.io\n\t * @param config - ManageV2 configuration variable to call ManageV2.\n\t */\n\tconstructor(baseUrl: string, config?: ManageV2Config | undefined) {\n\t\tthis.token = config ? this.generateToken(config) : null\n\n\t\tthis.client = axios.create({\n\t\t\tbaseURL: `${baseUrl}/manageroutes/`,\n\t\t\twithCredentials: true,\n\t\t\tvalidateStatus: () => true,\n\t\t\theaders: {\n\t\t\t\t\"User-Agent\": \"prismic-cli/prismic-e2e-tests-utils\",\n\t\t\t\tAuthorization: `Bearer ${this.token}`,\n\t\t\t},\n\t\t})\n\n\t\t// cookies are not forwarded automatically in a non-browser env\n\t\tthis.client.interceptors.response.use((response) => {\n\t\t\tconst cookies = response.headers[\"set-cookie\"]\n\t\t\tif (cookies && extractCookie(cookies, \"SESSION\")) {\n\t\t\t\tthis.client.defaults.headers[\"Cookie\"] = cookies\n\t\t\t}\n\n\t\t\treturn response\n\t\t})\n\t}\n\n\t/**\n\t * The function generates a JWT token using the provided configuration parameters.\n\t *\n\t * @param {ManageV2Config} config - The `config` parameter in the `generateToken` function is of\n\t * type `ManageV2Config`. It contains the following properties:\n\t * @returns A JSON Web Token (JWT) is being returned by the `generateToken` function. The token is\n\t * signed using the provided `config.secret` with the HS256 algorithm and includes the specified\n\t * audience and issuer values.\n\t */\n\tprivate generateToken(config: ManageV2Config): string {\n\t\treturn jwt.sign({}, config.secret, {\n\t\t\talgorithm: \"HS256\",\n\t\t\taudience: config.audience,\n\t\t\tissuer: \"prismic.io\",\n\t\t})\n\t}\n\n\t/**\n\t * The function `assertTokenExist` checks if a token exists before executing a given function.\n\t *\n\t * @param f - The `assertTokenExist` function takes a function `f` as a parameter. This function\n\t * `f` should accept a parameter of type `Parameters` and return a Promise that resolves to an\n\t * AxiosResponse. The `assertTokenExist` function ensures that a token is not null before\n\t * calling the provided\n\t * @returns A function is being returned that takes a parameter of type Parameters and checks if\n\t * the token is null. If the token is null, an error is thrown. Otherwise, the function f is\n\t * called with the provided parameters.\n\t */\n\tprivate assertTokenExist<Parameters>(f: (_: Parameters) => Promise<AxiosResponse>) {\n\t\treturn (params: Parameters) => {\n\t\t\tif (this.token === null) {\n\t\t\t\tthrow new Error(\"Undefined configuration for ManageV2 while trying to use it's routes\")\n\t\t\t} else {\n\t\t\t\treturn f(params)\n\t\t\t}\n\t\t}\n\t}\n\n\tgetBaseURL(): string {\n\t\treturn this.client.getUri()\n\t}\n\n\t/**\n\t * The function `toggleRolePerLocal` enables or disables the RolesPerLocale workflow\n\t *\n\t * @param repository - The Repository name\n\t * @param enabled - The feature new status\n\t */\n\ttoggleRolePerLocal = this.assertTokenExist((params: { repository: string; enabled: boolean }) => {\n\t\treturn this.client.post(\"/repository/toggleRolesPerLocale\", {\n\t\t\tdomain: params.repository,\n\t\t\tenabled: params.enabled,\n\t\t\tauthor: ManageV2StaticAuthor,\n\t\t})\n\t})\n\n\t/**\n\t * The function `toggleCustomRoles` enables or disables the CustomRoles workflow\n\t *\n\t * @param repository - The Repository name\n\t * @param enabled - The feature new status\n\t */\n\ttoggleCustomRoles = this.assertTokenExist((params: { repository: string; enabled: boolean }) => {\n\t\treturn this.client.post(\"/repository/toggleCustomRoles\", {\n\t\t\tdomain: params.repository,\n\t\t\tenabled: params.enabled,\n\t\t\tauthor: ManageV2StaticAuthor,\n\t\t})\n\t})\n\n\t/**\n\t * The function `toggleIntegrationFields` enables or disables the Integration Fields feature\n\t *\n\t * @param repository - The Repository name\n\t * @param enabled - The feature new status\n\t */\n\ttoggleIntegrationFields = this.assertTokenExist(\n\t\t(params: { repository: string; enabled: boolean }) => {\n\t\t\treturn this.client.post(\"/repository/toggleIntegrationFields\", {\n\t\t\t\tdomain: params.repository,\n\t\t\t\tenabled: params.enabled,\n\t\t\t\tauthor: ManageV2StaticAuthor,\n\t\t\t})\n\t\t},\n\t)\n\n\t/**\n\t * The function `changePlan` changes the plan of a repository the database\n\t *\n\t * @param repository - The Repository name\n\t * @param newPlanId - The new planId\n\t * @param bypassManualBilling - Beware that using this will not verify that the database and\n\t * Stripe are in sync\n\t */\n\tchangePlan = this.assertTokenExist(\n\t\t({\n\t\t\trepository,\n\t\t\tnewPlanId,\n\t\t\tbypassManualBilling = false,\n\t\t}: {\n\t\t\trepository: string\n\t\t\tnewPlanId: string\n\t\t\tbypassManualBilling?: boolean\n\t\t}) => {\n\t\t\treturn this.client.post(`/repository/changePlan?bypassManualBilling=${bypassManualBilling}`, {\n\t\t\t\tdomain: repository,\n\t\t\t\tnewPlan: newPlanId,\n\t\t\t\tauthor: ManageV2StaticAuthor,\n\t\t\t})\n\t\t},\n\t)\n\n\t/**\n\t * The function `addUserToRepository` adds a user corresponding to the email to the given\n\t * repository\n\t *\n\t * @param repository - The Repository name\n\t * @param email - The user email\n\t */\n\taddUserToRepository = this.assertTokenExist(\n\t\t({ repository, email }: { repository: string; email: string }) => {\n\t\t\treturn this.client.post(\"/repository/addUser\", {\n\t\t\t\tdomain: repository,\n\t\t\t\temail: email,\n\t\t\t\tauthor: ManageV2StaticAuthor,\n\t\t\t})\n\t\t},\n\t)\n\n\t/**\n\t * The function `removeUserFromRepository` removes a user corresponding to the email from the\n\t * given repository\n\t *\n\t * @param repository - The Repository name\n\t * @param email - The user email\n\t */\n\tremoveUserFromRepository = this.assertTokenExist(\n\t\t({ repository, email }: { repository: string; email: string }) => {\n\t\t\treturn this.client.post(\"/repository/removeUser\", {\n\t\t\t\tdomain: repository,\n\t\t\t\temail: email,\n\t\t\t\tauthor: ManageV2StaticAuthor,\n\t\t\t})\n\t\t},\n\t)\n}\n"],"mappings":";;;;;;;AAOA,MAAM,uBAAuB;;AAG7B,IAAa,iBAAb,MAA4B;CAC3B;CACA,QAA+B;;;;;CAM/B,YAAY,SAAiB,QAAqC;EACjE,KAAK,QAAQ,SAAS,KAAK,cAAc,MAAM,IAAI;EAEnD,KAAK,SAAS,MAAA,QAAM,OAAO;GAC1B,SAAS,GAAG,QAAQ;GACpB,iBAAiB;GACjB,sBAAsB;GACtB,SAAS;IACR,cAAc;IACd,eAAe,UAAU,KAAK;GAC/B;EACD,CAAC;EAGD,KAAK,OAAO,aAAa,SAAS,KAAK,aAAa;GACnD,MAAM,UAAU,SAAS,QAAQ;GACjC,IAAI,WAAWA,gBAAAA,cAAc,SAAS,SAAS,GAC9C,KAAK,OAAO,SAAS,QAAQ,YAAY;GAG1C,OAAO;EACR,CAAC;CACF;;;;;;;;;;CAWA,cAAsB,QAAgC;EACrD,OAAOC,aAAAA,QAAI,KAAK,CAAC,GAAG,OAAO,QAAQ;GAClC,WAAW;GACX,UAAU,OAAO;GACjB,QAAQ;EACT,CAAC;CACF;;;;;;;;;;;;CAaA,iBAAqC,GAA8C;EAClF,QAAQ,WAAuB;GAC9B,IAAI,KAAK,UAAU,MAClB,MAAM,IAAI,MAAM,sEAAsE;QAEtF,OAAO,EAAE,MAAM;EAEjB;CACD;CAEA,aAAqB;EACpB,OAAO,KAAK,OAAO,OAAO;CAC3B;;;;;;;CAQA,qBAAqB,KAAK,kBAAkB,WAAqD;EAChG,OAAO,KAAK,OAAO,KAAK,oCAAoC;GAC3D,QAAQ,OAAO;GACf,SAAS,OAAO;GAChB,QAAQ;EACT,CAAC;CACF,CAAC;;;;;;;CAQD,oBAAoB,KAAK,kBAAkB,WAAqD;EAC/F,OAAO,KAAK,OAAO,KAAK,iCAAiC;GACxD,QAAQ,OAAO;GACf,SAAS,OAAO;GAChB,QAAQ;EACT,CAAC;CACF,CAAC;;;;;;;CAQD,0BAA0B,KAAK,kBAC7B,WAAqD;EACrD,OAAO,KAAK,OAAO,KAAK,uCAAuC;GAC9D,QAAQ,OAAO;GACf,SAAS,OAAO;GAChB,QAAQ;EACT,CAAC;CACF,CACD;;;;;;;;;CAUA,aAAa,KAAK,kBAChB,EACA,YACA,WACA,sBAAsB,YAKjB;EACL,OAAO,KAAK,OAAO,KAAK,8CAA8C,uBAAuB;GAC5F,QAAQ;GACR,SAAS;GACT,QAAQ;EACT,CAAC;CACF,CACD;;;;;;;;CASA,sBAAsB,KAAK,kBACzB,EAAE,YAAY,YAAmD;EACjE,OAAO,KAAK,OAAO,KAAK,uBAAuB;GAC9C,QAAQ;GACD;GACP,QAAQ;EACT,CAAC;CACF,CACD;;;;;;;;CASA,2BAA2B,KAAK,kBAC9B,EAAE,YAAY,YAAmD;EACjE,OAAO,KAAK,OAAO,KAAK,0BAA0B;GACjD,QAAQ;GACD;GACP,QAAQ;EACT,CAAC;CACF,CACD;AACD"}
@@ -0,0 +1,105 @@
1
+ import { ManageV2Config } from "../types.cjs";
2
+ import { AxiosInstance, AxiosResponse } from "axios";
3
+
4
+ //#region src/clients/manageV2.d.ts
5
+ /** Client for interacting with ManageV2 routes to perform operations on repositories. */
6
+ declare class ManageV2Client {
7
+ readonly client: AxiosInstance;
8
+ private token;
9
+ /**
10
+ * @param baseURL - The base URL of the Wroom app. ex: https://prismic.io
11
+ * @param config - ManageV2 configuration variable to call ManageV2.
12
+ */
13
+ constructor(baseUrl: string, config?: ManageV2Config | undefined);
14
+ /**
15
+ * The function generates a JWT token using the provided configuration parameters.
16
+ *
17
+ * @param {ManageV2Config} config - The `config` parameter in the `generateToken` function is of
18
+ * type `ManageV2Config`. It contains the following properties:
19
+ * @returns A JSON Web Token (JWT) is being returned by the `generateToken` function. The token is
20
+ * signed using the provided `config.secret` with the HS256 algorithm and includes the specified
21
+ * audience and issuer values.
22
+ */
23
+ private generateToken;
24
+ /**
25
+ * The function `assertTokenExist` checks if a token exists before executing a given function.
26
+ *
27
+ * @param f - The `assertTokenExist` function takes a function `f` as a parameter. This function
28
+ * `f` should accept a parameter of type `Parameters` and return a Promise that resolves to an
29
+ * AxiosResponse. The `assertTokenExist` function ensures that a token is not null before
30
+ * calling the provided
31
+ * @returns A function is being returned that takes a parameter of type Parameters and checks if
32
+ * the token is null. If the token is null, an error is thrown. Otherwise, the function f is
33
+ * called with the provided parameters.
34
+ */
35
+ private assertTokenExist;
36
+ getBaseURL(): string;
37
+ /**
38
+ * The function `toggleRolePerLocal` enables or disables the RolesPerLocale workflow
39
+ *
40
+ * @param repository - The Repository name
41
+ * @param enabled - The feature new status
42
+ */
43
+ toggleRolePerLocal: (params: {
44
+ repository: string;
45
+ enabled: boolean;
46
+ }) => Promise<AxiosResponse<any, any, {}>>;
47
+ /**
48
+ * The function `toggleCustomRoles` enables or disables the CustomRoles workflow
49
+ *
50
+ * @param repository - The Repository name
51
+ * @param enabled - The feature new status
52
+ */
53
+ toggleCustomRoles: (params: {
54
+ repository: string;
55
+ enabled: boolean;
56
+ }) => Promise<AxiosResponse<any, any, {}>>;
57
+ /**
58
+ * The function `toggleIntegrationFields` enables or disables the Integration Fields feature
59
+ *
60
+ * @param repository - The Repository name
61
+ * @param enabled - The feature new status
62
+ */
63
+ toggleIntegrationFields: (params: {
64
+ repository: string;
65
+ enabled: boolean;
66
+ }) => Promise<AxiosResponse<any, any, {}>>;
67
+ /**
68
+ * The function `changePlan` changes the plan of a repository the database
69
+ *
70
+ * @param repository - The Repository name
71
+ * @param newPlanId - The new planId
72
+ * @param bypassManualBilling - Beware that using this will not verify that the database and
73
+ * Stripe are in sync
74
+ */
75
+ changePlan: (params: {
76
+ repository: string;
77
+ newPlanId: string;
78
+ bypassManualBilling?: boolean;
79
+ }) => Promise<AxiosResponse<any, any, {}>>;
80
+ /**
81
+ * The function `addUserToRepository` adds a user corresponding to the email to the given
82
+ * repository
83
+ *
84
+ * @param repository - The Repository name
85
+ * @param email - The user email
86
+ */
87
+ addUserToRepository: (params: {
88
+ repository: string;
89
+ email: string;
90
+ }) => Promise<AxiosResponse<any, any, {}>>;
91
+ /**
92
+ * The function `removeUserFromRepository` removes a user corresponding to the email from the
93
+ * given repository
94
+ *
95
+ * @param repository - The Repository name
96
+ * @param email - The user email
97
+ */
98
+ removeUserFromRepository: (params: {
99
+ repository: string;
100
+ email: string;
101
+ }) => Promise<AxiosResponse<any, any, {}>>;
102
+ }
103
+ //#endregion
104
+ export { ManageV2Client };
105
+ //# sourceMappingURL=manageV2.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manageV2.d.cts","names":[],"sources":["../../src/clients/manageV2.ts"],"mappings":";;;;;cAUa,cAAA;EAAA,SACH,MAAA,EAAQ,aAAA;EAAA,QACT,KAAA;;;;;cAMI,OAAA,UAAiB,MAAA,GAAS,cAAA;;;;;;;;;;UAiC9B,aAAA;;;;;;;;;;;;UAmBA,gBAAA;EAUR,UAAA;;;;;;;EAUA,kBAAA,GAAkB,MAAA;;;;;;;;;;EAclB,iBAAA,GAAiB,MAAA;;;;;;;;;;EAcjB,uBAAA,GAAuB,MAAA;;;;EA4DvB;;;;;;;;EA1CA,UAAA,GAAU,MAAA;;;;;;;;;;;;EAyBV,mBAAA,GAAmB,MAAA;;;;;;;;;;;EAiBnB,wBAAA,GAAwB,MAAA"}