@prismicio/e2e-tests-utils 1.18.0 → 1.19.0-pr.37.6283e4a

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 +142 -0
  38. package/dist/clients/coreApi.d.cts.map +1 -0
  39. package/dist/clients/coreApi.d.ts +131 -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 +591 -616
  96. package/dist/managers/repository.cjs.map +1 -1
  97. package/dist/managers/repository.d.cts +338 -0
  98. package/dist/managers/repository.d.cts.map +1 -0
  99. package/dist/managers/repository.d.ts +333 -307
  100. package/dist/managers/repository.d.ts.map +1 -0
  101. package/dist/managers/repository.js +591 -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 +165 -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 +393 -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,113 +1,105 @@
1
+ import { ManageV2Config } from "../types.js";
1
2
  import { AxiosInstance, AxiosResponse } from "axios";
2
- import { ManageV2Config } from "../types";
3
- /**
4
- * Client for interacting with ManageV2 routes to perform operations on
5
- * repositories.
6
- */
7
- export declare class ManageV2Client {
8
- readonly client: AxiosInstance;
9
- private token;
10
- /**
11
- * @param baseURL - The base URL of the Wroom app. ex: https://prismic.io
12
- * @param config - ManageV2 configuration variable to call ManageV2.
13
- */
14
- constructor(baseUrl: string, config?: ManageV2Config | undefined);
15
- /**
16
- * The function generates a JWT token using the provided configuration
17
- * parameters.
18
- *
19
- * @param {ManageV2Config} config - The `config` parameter in the
20
- * `generateToken` function is of type `ManageV2Config`. It contains the
21
- * following properties:
22
- *
23
- * @returns A JSON Web Token (JWT) is being returned by the `generateToken`
24
- * function. The token is signed using the provided `config.secret` with the
25
- * HS256 algorithm and includes the specified audience and issuer values.
26
- */
27
- private generateToken;
28
- /**
29
- * The function `assertTokenExist` checks if a token exists before executing a
30
- * given function.
31
- *
32
- * @param f - The `assertTokenExist` function takes a function `f` as a
33
- * parameter. This function `f` should accept a parameter of type
34
- * `Parameters` and return a Promise that resolves to an AxiosResponse. The
35
- * `assertTokenExist` function ensures that a token is not null before
36
- * calling the provided
37
- *
38
- * @returns A function is being returned that takes a parameter of type
39
- * Parameters and checks if the token is null. If the token is null, an
40
- * error is thrown. Otherwise, the function f is called with the provided
41
- * parameters.
42
- */
43
- private assertTokenExist;
44
- getBaseURL(): string;
45
- /**
46
- * The function `toggleRolePerLocal` enables or disables the RolesPerLocale
47
- * workflow
48
- *
49
- * @param repository - The Repository name
50
- * @param enabled - The feature new status
51
- */
52
- toggleRolePerLocal: (params: {
53
- repository: string;
54
- enabled: boolean;
55
- }) => Promise<AxiosResponse<any, any>>;
56
- /**
57
- * The function `toggleCustomRoles` enables or disables the CustomRoles
58
- * workflow
59
- *
60
- * @param repository - The Repository name
61
- * @param enabled - The feature new status
62
- */
63
- toggleCustomRoles: (params: {
64
- repository: string;
65
- enabled: boolean;
66
- }) => Promise<AxiosResponse<any, any>>;
67
- /**
68
- * The function `toggleIntegrationFields` enables or disables the Integration
69
- * Fields feature
70
- *
71
- * @param repository - The Repository name
72
- * @param enabled - The feature new status
73
- */
74
- toggleIntegrationFields: (params: {
75
- repository: string;
76
- enabled: boolean;
77
- }) => Promise<AxiosResponse<any, any>>;
78
- /**
79
- * The function `changePlan` changes the plan of a repository the database
80
- *
81
- * @param repository - The Repository name
82
- * @param newPlanId - The new planId
83
- * @param bypassManualBilling - Beware that using this will not verify that
84
- * the database and Stripe are in sync
85
- */
86
- changePlan: (params: {
87
- repository: string;
88
- newPlanId: string;
89
- bypassManualBilling?: boolean | undefined;
90
- }) => Promise<AxiosResponse<any, any>>;
91
- /**
92
- * The function `addUserToRepository` adds a user corresponding to the email
93
- * to the given repository
94
- *
95
- * @param repository - The Repository name
96
- * @param email - The user email
97
- */
98
- addUserToRepository: (params: {
99
- repository: string;
100
- email: string;
101
- }) => Promise<AxiosResponse<any, any>>;
102
- /**
103
- * The function `removeUserFromRepository` removes a user corresponding to the
104
- * email from the given repository
105
- *
106
- * @param repository - The Repository name
107
- * @param email - The user email
108
- */
109
- removeUserFromRepository: (params: {
110
- repository: string;
111
- email: string;
112
- }) => Promise<AxiosResponse<any, any>>;
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, {}>>;
113
102
  }
103
+ //#endregion
104
+ export { ManageV2Client };
105
+ //# sourceMappingURL=manageV2.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manageV2.d.ts","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"}
@@ -1,173 +1,153 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => {
4
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
- return value;
6
- };
1
+ import { extractCookie } from "../utils/cookies.js";
7
2
  import axios from "axios";
8
3
  import jwt from "jsonwebtoken";
9
- import { extractCookie } from "../utils/cookies.js";
4
+ //#region src/clients/manageV2.ts
10
5
  const ManageV2StaticAuthor = "prismic-e2e-tests-utils";
11
- class ManageV2Client {
12
- /**
13
- * @param baseURL - The base URL of the Wroom app. ex: https://prismic.io
14
- * @param config - ManageV2 configuration variable to call ManageV2.
15
- */
16
- constructor(baseUrl, config) {
17
- __publicField(this, "client");
18
- // Not private to have it available on tests
19
- __publicField(this, "token", null);
20
- /**
21
- * The function `toggleRolePerLocal` enables or disables the RolesPerLocale
22
- * workflow
23
- *
24
- * @param repository - The Repository name
25
- * @param enabled - The feature new status
26
- */
27
- __publicField(this, "toggleRolePerLocal", this.assertTokenExist((params) => {
28
- return this.client.post("/repository/toggleRolesPerLocale", {
29
- domain: params.repository,
30
- enabled: params.enabled,
31
- author: ManageV2StaticAuthor
32
- });
33
- }));
34
- /**
35
- * The function `toggleCustomRoles` enables or disables the CustomRoles
36
- * workflow
37
- *
38
- * @param repository - The Repository name
39
- * @param enabled - The feature new status
40
- */
41
- __publicField(this, "toggleCustomRoles", this.assertTokenExist((params) => {
42
- return this.client.post("/repository/toggleCustomRoles", {
43
- domain: params.repository,
44
- enabled: params.enabled,
45
- author: ManageV2StaticAuthor
46
- });
47
- }));
48
- /**
49
- * The function `toggleIntegrationFields` enables or disables the Integration
50
- * Fields feature
51
- *
52
- * @param repository - The Repository name
53
- * @param enabled - The feature new status
54
- */
55
- __publicField(this, "toggleIntegrationFields", this.assertTokenExist((params) => {
56
- return this.client.post("/repository/toggleIntegrationFields", {
57
- domain: params.repository,
58
- enabled: params.enabled,
59
- author: ManageV2StaticAuthor
60
- });
61
- }));
62
- /**
63
- * The function `changePlan` changes the plan of a repository the database
64
- *
65
- * @param repository - The Repository name
66
- * @param newPlanId - The new planId
67
- * @param bypassManualBilling - Beware that using this will not verify that
68
- * the database and Stripe are in sync
69
- */
70
- __publicField(this, "changePlan", this.assertTokenExist(({ repository, newPlanId, bypassManualBilling = false }) => {
71
- return this.client.post(`/repository/changePlan?bypassManualBilling=${bypassManualBilling}`, {
72
- domain: repository,
73
- newPlan: newPlanId,
74
- author: ManageV2StaticAuthor
75
- });
76
- }));
77
- /**
78
- * The function `addUserToRepository` adds a user corresponding to the email
79
- * to the given repository
80
- *
81
- * @param repository - The Repository name
82
- * @param email - The user email
83
- */
84
- __publicField(this, "addUserToRepository", this.assertTokenExist(({ repository, email }) => {
85
- return this.client.post("/repository/addUser", {
86
- domain: repository,
87
- email,
88
- author: ManageV2StaticAuthor
89
- });
90
- }));
91
- /**
92
- * The function `removeUserFromRepository` removes a user corresponding to the
93
- * email from the given repository
94
- *
95
- * @param repository - The Repository name
96
- * @param email - The user email
97
- */
98
- __publicField(this, "removeUserFromRepository", this.assertTokenExist(({ repository, email }) => {
99
- return this.client.post("/repository/removeUser", {
100
- domain: repository,
101
- email,
102
- author: ManageV2StaticAuthor
103
- });
104
- }));
105
- this.token = config ? this.generateToken(config) : null;
106
- this.client = axios.create({
107
- baseURL: `${baseUrl}/manageroutes/`,
108
- withCredentials: true,
109
- validateStatus: () => true,
110
- headers: {
111
- "User-Agent": "prismic-cli/prismic-e2e-tests-utils",
112
- Authorization: `Bearer ${this.token}`
113
- }
114
- });
115
- this.client.interceptors.response.use((response) => {
116
- const cookies = response.headers["set-cookie"];
117
- if (cookies && extractCookie(cookies, "SESSION")) {
118
- this.client.defaults.headers["Cookie"] = cookies;
119
- }
120
- return response;
121
- });
122
- }
123
- /**
124
- * The function generates a JWT token using the provided configuration
125
- * parameters.
126
- *
127
- * @param {ManageV2Config} config - The `config` parameter in the
128
- * `generateToken` function is of type `ManageV2Config`. It contains the
129
- * following properties:
130
- *
131
- * @returns A JSON Web Token (JWT) is being returned by the `generateToken`
132
- * function. The token is signed using the provided `config.secret` with the
133
- * HS256 algorithm and includes the specified audience and issuer values.
134
- */
135
- generateToken(config) {
136
- return jwt.sign({}, config.secret, {
137
- algorithm: "HS256",
138
- audience: config.audience,
139
- issuer: "prismic.io"
140
- });
141
- }
142
- /**
143
- * The function `assertTokenExist` checks if a token exists before executing a
144
- * given function.
145
- *
146
- * @param f - The `assertTokenExist` function takes a function `f` as a
147
- * parameter. This function `f` should accept a parameter of type
148
- * `Parameters` and return a Promise that resolves to an AxiosResponse. The
149
- * `assertTokenExist` function ensures that a token is not null before
150
- * calling the provided
151
- *
152
- * @returns A function is being returned that takes a parameter of type
153
- * Parameters and checks if the token is null. If the token is null, an
154
- * error is thrown. Otherwise, the function f is called with the provided
155
- * parameters.
156
- */
157
- assertTokenExist(f) {
158
- return (params) => {
159
- if (this.token === null) {
160
- throw new Error("Undefined configuration for ManageV2 while trying to use it's routes");
161
- } else {
162
- return f(params);
163
- }
164
- };
165
- }
166
- getBaseURL() {
167
- return this.client.getUri();
168
- }
169
- }
170
- export {
171
- ManageV2Client
6
+ /** Client for interacting with ManageV2 routes to perform operations on repositories. */
7
+ var ManageV2Client = class {
8
+ client;
9
+ token = null;
10
+ /**
11
+ * @param baseURL - The base URL of the Wroom app. ex: https://prismic.io
12
+ * @param config - ManageV2 configuration variable to call ManageV2.
13
+ */
14
+ constructor(baseUrl, config) {
15
+ this.token = config ? this.generateToken(config) : null;
16
+ this.client = axios.create({
17
+ baseURL: `${baseUrl}/manageroutes/`,
18
+ withCredentials: true,
19
+ validateStatus: () => true,
20
+ headers: {
21
+ "User-Agent": "prismic-cli/prismic-e2e-tests-utils",
22
+ Authorization: `Bearer ${this.token}`
23
+ }
24
+ });
25
+ this.client.interceptors.response.use((response) => {
26
+ const cookies = response.headers["set-cookie"];
27
+ if (cookies && extractCookie(cookies, "SESSION")) this.client.defaults.headers["Cookie"] = cookies;
28
+ return response;
29
+ });
30
+ }
31
+ /**
32
+ * The function generates a JWT token using the provided configuration parameters.
33
+ *
34
+ * @param {ManageV2Config} config - The `config` parameter in the `generateToken` function is of
35
+ * type `ManageV2Config`. It contains the following properties:
36
+ * @returns A JSON Web Token (JWT) is being returned by the `generateToken` function. The token is
37
+ * signed using the provided `config.secret` with the HS256 algorithm and includes the specified
38
+ * audience and issuer values.
39
+ */
40
+ generateToken(config) {
41
+ return jwt.sign({}, config.secret, {
42
+ algorithm: "HS256",
43
+ audience: config.audience,
44
+ issuer: "prismic.io"
45
+ });
46
+ }
47
+ /**
48
+ * The function `assertTokenExist` checks if a token exists before executing a given function.
49
+ *
50
+ * @param f - The `assertTokenExist` function takes a function `f` as a parameter. This function
51
+ * `f` should accept a parameter of type `Parameters` and return a Promise that resolves to an
52
+ * AxiosResponse. The `assertTokenExist` function ensures that a token is not null before
53
+ * calling the provided
54
+ * @returns A function is being returned that takes a parameter of type Parameters and checks if
55
+ * the token is null. If the token is null, an error is thrown. Otherwise, the function f is
56
+ * called with the provided parameters.
57
+ */
58
+ assertTokenExist(f) {
59
+ return (params) => {
60
+ if (this.token === null) throw new Error("Undefined configuration for ManageV2 while trying to use it's routes");
61
+ else return f(params);
62
+ };
63
+ }
64
+ getBaseURL() {
65
+ return this.client.getUri();
66
+ }
67
+ /**
68
+ * The function `toggleRolePerLocal` enables or disables the RolesPerLocale workflow
69
+ *
70
+ * @param repository - The Repository name
71
+ * @param enabled - The feature new status
72
+ */
73
+ toggleRolePerLocal = this.assertTokenExist((params) => {
74
+ return this.client.post("/repository/toggleRolesPerLocale", {
75
+ domain: params.repository,
76
+ enabled: params.enabled,
77
+ author: ManageV2StaticAuthor
78
+ });
79
+ });
80
+ /**
81
+ * The function `toggleCustomRoles` enables or disables the CustomRoles workflow
82
+ *
83
+ * @param repository - The Repository name
84
+ * @param enabled - The feature new status
85
+ */
86
+ toggleCustomRoles = this.assertTokenExist((params) => {
87
+ return this.client.post("/repository/toggleCustomRoles", {
88
+ domain: params.repository,
89
+ enabled: params.enabled,
90
+ author: ManageV2StaticAuthor
91
+ });
92
+ });
93
+ /**
94
+ * The function `toggleIntegrationFields` enables or disables the Integration Fields feature
95
+ *
96
+ * @param repository - The Repository name
97
+ * @param enabled - The feature new status
98
+ */
99
+ toggleIntegrationFields = this.assertTokenExist((params) => {
100
+ return this.client.post("/repository/toggleIntegrationFields", {
101
+ domain: params.repository,
102
+ enabled: params.enabled,
103
+ author: ManageV2StaticAuthor
104
+ });
105
+ });
106
+ /**
107
+ * The function `changePlan` changes the plan of a repository the database
108
+ *
109
+ * @param repository - The Repository name
110
+ * @param newPlanId - The new planId
111
+ * @param bypassManualBilling - Beware that using this will not verify that the database and
112
+ * Stripe are in sync
113
+ */
114
+ changePlan = this.assertTokenExist(({ repository, newPlanId, bypassManualBilling = false }) => {
115
+ return this.client.post(`/repository/changePlan?bypassManualBilling=${bypassManualBilling}`, {
116
+ domain: repository,
117
+ newPlan: newPlanId,
118
+ author: ManageV2StaticAuthor
119
+ });
120
+ });
121
+ /**
122
+ * The function `addUserToRepository` adds a user corresponding to the email to the given
123
+ * repository
124
+ *
125
+ * @param repository - The Repository name
126
+ * @param email - The user email
127
+ */
128
+ addUserToRepository = this.assertTokenExist(({ repository, email }) => {
129
+ return this.client.post("/repository/addUser", {
130
+ domain: repository,
131
+ email,
132
+ author: ManageV2StaticAuthor
133
+ });
134
+ });
135
+ /**
136
+ * The function `removeUserFromRepository` removes a user corresponding to the email from the
137
+ * given repository
138
+ *
139
+ * @param repository - The Repository name
140
+ * @param email - The user email
141
+ */
142
+ removeUserFromRepository = this.assertTokenExist(({ repository, email }) => {
143
+ return this.client.post("/repository/removeUser", {
144
+ domain: repository,
145
+ email,
146
+ author: ManageV2StaticAuthor
147
+ });
148
+ });
172
149
  };
173
- //# sourceMappingURL=manageV2.js.map
150
+ //#endregion
151
+ export { ManageV2Client };
152
+
153
+ //# sourceMappingURL=manageV2.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"manageV2.js","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":[],"mappings":";;;;;;;;;AAOA,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;AAAA,EAEF;AAAA,EAEA,aAAU;AACF,WAAA,KAAK,OAAO;EACpB;AAmHA;"}
1
+ {"version":3,"file":"manageV2.js","names":[],"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,MAAM,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,WAAW,cAAc,SAAS,SAAS,GAC9C,KAAK,OAAO,SAAS,QAAQ,YAAY;GAG1C,OAAO;EACR,CAAC;CACF;;;;;;;;;;CAWA,cAAsB,QAAgC;EACrD,OAAO,IAAI,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,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