@prismicio/e2e-tests-utils 1.17.1-alpha.0 → 1.18.0-canary.933a809

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 +52 -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 +52 -73
  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 +25 -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,312 +1,308 @@
1
- import { CustomType, SharedSlice } from "@prismicio/types-internal/lib/customtypes";
2
- import { IntegrationFieldConfig } from "../types";
3
- import { AssetApiClient } from "../clients/assetApi";
4
- import { AuthenticationApiClient } from "../clients/authenticationApi";
5
- import { ContentApiClient } from "../clients/contentApi";
6
- import { CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentsPayload, CoreApiDocumentsResponse, Release } from "../clients/coreApi";
7
- import { CustomTypesApiClient } from "../clients/customTypesApi";
8
- import { IntegrationFieldsClient } from "../clients/integrationFields";
9
- import { ManageV2Client } from "../clients/manageV2";
10
- import { MigrationApiClient } from "../clients/migrationApi";
11
- import { WroomClient } from "../clients/wroom";
1
+ import { IntegrationFieldConfig } from "../types.js";
2
+ import { AssetApiClient } from "../clients/assetApi.js";
3
+ import { AuthenticationApiClient } from "../clients/authenticationApi.js";
4
+ import { ContentApiClient } from "../clients/contentApi.js";
5
+ import { CoreApiClient, CoreApiDocumentCreationPayload, CoreApiDocumentCreationResponse, CoreApiDocumentData, CoreApiDocumentsPayload, CoreApiDocumentsResponse, Release } from "../clients/coreApi.js";
6
+ import { CustomTypesApiClient } from "../clients/customTypesApi.js";
7
+ import { WroomClient } from "../clients/wroom.js";
8
+ import { IntegrationFieldsClient } from "../clients/integrationFields.js";
9
+ import { ManageV2Client } from "../clients/manageV2.js";
10
+ import { MigrationApiClient } from "../clients/migrationApi.js";
11
+ import { SharedSliceModel, StaticCustomTypeModel } from "@prismicio/types-internal";
12
+
13
+ //#region src/managers/repository.d.ts
12
14
  /** Utility to manage test data for a Prismic repository */
13
- export declare class RepositoryManager {
14
- readonly name: string;
15
- private readonly coreApiClient;
16
- private readonly authApiClient;
17
- private readonly wroomClient;
18
- private readonly customTypesApiClient;
19
- private readonly migrationApiClient;
20
- private readonly assetApiClient;
21
- private readonly manageV2Client;
22
- private readonly integrationFieldsClient;
23
- constructor(name: string, coreApiClient: CoreApiClient, authApiClient: AuthenticationApiClient, wroomClient: WroomClient, customTypesApiClient: CustomTypesApiClient, migrationApiClient: MigrationApiClient | undefined, assetApiClient: AssetApiClient, manageV2Client: ManageV2Client, integrationFieldsClient: IntegrationFieldsClient | undefined);
24
- configure(config: RepositoryConfig): Promise<void>;
25
- /** @returns the repository base url, like https://my-repo.prismic.io */
26
- getBaseURL(): string;
27
- /** @returns the repository base cdn url, like https://my-repo.cdn.prismic.io */
28
- getBaseCdnURL(): string;
29
- /**
30
- * @returns a Content Type api client configured to target the repository CDN
31
- * url. Uses Playwright for requests so if your project uses Playwright too,
32
- * any network request will be present in Playwright test reports.
33
- */
34
- getContentApiClient(config?: {
35
- version?: "v1" | "v2";
36
- accessToken?: string;
37
- }): ContentApiClient;
38
- /**
39
- * @returns an instance of the Migration api client, see
40
- * https://prismic.io/docs/migration-api-technical-reference
41
- */
42
- getMigrationApiClient(): MigrationApiClient;
43
- /**
44
- * @returns an instance of the Asset api client, see
45
- * https://prismic.io/docs/asset-api-technical-reference
46
- */
47
- getAssetApiClient(): AssetApiClient;
48
- /** @returns the Wroom commit hash deployed on the current repository */
49
- getDeployedVersion(): Promise<string | undefined>;
50
- /**
51
- * Set additional standard locales for a repository in Wroom, does not fail if
52
- * the locales already exist.
53
- *
54
- * @param locales - An array of all locales to be added to the repository.
55
- *
56
- * @throws Error if setting the locales fails.
57
- */
58
- createLocales(locales: string[]): Promise<void>;
59
- /**
60
- * Set additional custom locale for a repository in Wroom, does not fail if
61
- * the locales already exist.
62
- *
63
- * @param locale - The locale to be added to the repository.
64
- *
65
- * @throws Error if setting the locale fails.
66
- */
67
- createCustomLocale(locale: CustomLocale): Promise<void>;
68
- private failIfNot200;
69
- /**
70
- * Delete a locale from a repository.
71
- *
72
- * @param locale - locale to remove from the repository configuration.
73
- *
74
- * @throws Error if deleting the locale fails.
75
- */
76
- deleteLocale(locale: string): Promise<void>;
77
- /**
78
- * Create or update the default (master) locale for a repository in Wroom, the
79
- * locale needs to exist in the repository.
80
- *
81
- * @param locale - The locale to be set as the default.
82
- * @param endpoint - "createMasterLang" to create it, "defineAsMaster" to
83
- * update it.
84
- *
85
- * @throws Error if setting the default locale fails.
86
- */
87
- setDefaultLocale(locale: string, action: "create" | "update"): Promise<void>;
88
- /**
89
- * Retrieves documents.
90
- *
91
- * @param args - Configure which documents are retrieved.
92
- *
93
- * @returns A paginated set of documents.
94
- */
95
- getDocuments(args: CoreApiDocumentsPayload): Promise<CoreApiDocumentsResponse>;
96
- /**
97
- * Creates a release.
98
- *
99
- * @param label - The label for the release.
100
- *
101
- * @returns A Promise that resolves when the release is created.
102
- */
103
- createRelease(label: string): Promise<{
104
- id: string;
105
- }>;
106
- /**
107
- * Retrieves the migration release.
108
- *
109
- * @returns The migration relese metadata.
110
- */
111
- getMigrationRelease(): Promise<Release>;
112
- /**
113
- * Publishes a release.
114
- *
115
- * @param id - The ID of the release.
116
- *
117
- * @returns A Promise that resolves when the release is published and a new
118
- * master ref is available.
119
- */
120
- publishRelease(id: string): Promise<void>;
121
- /**
122
- * Deletes a repository release.
123
- *
124
- * @param id - The ID of the release to be deleted.
125
- */
126
- deleteRelease(id: string): Promise<void>;
127
- /**
128
- * Creates a preview for a repository.
129
- *
130
- * @param data - The data for creating the preview.
131
- */
132
- createPreview(data: Preview): Promise<void>;
133
- /**
134
- * Set the simulator URL (table of slices) for a repository.
135
- *
136
- * @param data - The simulator URL to set.
137
- */
138
- setSimulatorURL(simulatorURL: string): Promise<void>;
139
- /**
140
- * Deletes a preview from a repository.
141
- *
142
- * @param id - The ID of the preview to be deleted.
143
- */
144
- deletePreview(id: string): Promise<void>;
145
- /**
146
- * Create a webhook.
147
- *
148
- * @returns A Promise that resolves with the webhook id.
149
- */
150
- createWebhook(name: string, url: string, secret: string, triggers: {
151
- documentsPublished?: boolean;
152
- documentsUnpublished?: boolean;
153
- releasesCreated?: boolean;
154
- releasesUpdated?: boolean;
155
- tagsCreated?: boolean;
156
- tagsDeleted?: boolean;
157
- }, active: boolean): Promise<string>;
158
- /**
159
- * Deletes a webhook.
160
- *
161
- * @param id - The webhook ID.
162
- */
163
- deleteWebhook(id: string): Promise<void>;
164
- /**
165
- * Create Custom Types using the Custom types api.
166
- *
167
- * @param customTypes -
168
- */
169
- createCustomTypes(customTypes: CustomType[]): Promise<void>;
170
- deleteCustomType(customTypeId: string): Promise<void>;
171
- /**
172
- * Create slices using the Custom types api.
173
- *
174
- * @param slices -
175
- */
176
- createSlices(slices: SharedSlice[]): Promise<void>;
177
- /**
178
- * Create an access token to query private items of the Content api.
179
- *
180
- * @param appName - mandatory authorized application name
181
- * @param tokenScope - access token scope. Use "master" to when your content
182
- * api is fully private or "master+releases" to access private releases
183
- */
184
- createContentAPIToken(appName: string, tokenScope?: "master" | "master+releases"): Promise<string>;
185
- /** Create a permanent access token to authenticate to Prismic public apis. */
186
- createPermanentAccessToken(): Promise<string>;
187
- /**
188
- * Toggle the Role per Locale workflow
189
- *
190
- * @param enabled - The feature new status
191
- */
192
- toggleRolePerLocal(enabled: boolean): Promise<void>;
193
- /**
194
- * Toggle the Custom Roles workflow
195
- *
196
- * @param enabled - The feature new status
197
- */
198
- toggleCustomRoles(enabled: boolean): Promise<void>;
199
- /**
200
- * Toggle the Integration Fields feature
201
- *
202
- * @param enabled - The feature new status
203
- */
204
- toggleIntegrationFields(enabled: boolean): Promise<void>;
205
- /**
206
- * Change the Repository Plan
207
- *
208
- * @param {string} newPlanId - The Id of the new Plan to apply
209
- */
210
- changePlan(newPlanId: string): Promise<void>;
211
- /**
212
- * Add a new user to the repository
213
- *
214
- * @param {string} email - The email of the user
215
- */
216
- addUser(email: string): Promise<void>;
217
- /**
218
- * Remove a user from the repository
219
- *
220
- * @param {string} email - The email of the user
221
- */
222
- removeUser(email: string): Promise<void>;
223
- /**
224
- * Update the role of a user in a repository
225
- *
226
- * @param {string} email - The email of the user
227
- * @param {string | Record<string, string>} role - The new Role of the user,
228
- * either a string for basic workflow or an object such as `{ "lang_id":
229
- * "Writer" }`
230
- *
231
- * Example of roles are
232
- *
233
- * - Administrator
234
- * - Writer
235
- * - Contributor
236
- * - Manager (publisher)
237
- */
238
- updateUserRole(email: string, role: string | Record<string, string>): Promise<void>;
239
- /**
240
- * Creates a document using the core api. If the Core api format is too
241
- * specific, use the migration api client to create a document with the
242
- * MigrationApiClient. See the `getMigrationApiClient()` method.
243
- *
244
- * @example To create a document by converting it from the Page Builder to
245
- * Core api format
246
- *
247
- * ```js
248
- * import { DocumentLegacy, UIDContentType } from '@prismicio/types-internal/lib/content';
249
- *
250
- * const document = {
251
- * title: 'A new document',
252
- * custom_type_id: 'home-page',
253
- * locale: 'en-gb',
254
- * integration_field_ids: [],
255
- * tags: [],
256
- * data: DocumentLegacy.encode({
257
- * uid: {
258
- * __TYPE__: UIDContentType,
259
- * value: 'home-page',
260
- * },
261
- * })
262
- * }
263
- * await repository.createDocument(document, 'published');
264
- * * ```
265
- * ```
266
- *
267
- * @returns
268
- *
269
- * @param document - in the core api format.
270
- *
271
- * @param status - status of the document, if published, the function will
272
- * wait for a new content api master ref to be created
273
- */
274
- createDocument(document: CoreApiDocumentCreationPayload, status: "draft" | "published"): Promise<CoreApiDocumentCreationResponse>;
275
- /**
276
- * Retrieves data for a specific document version.
277
- *
278
- * @param versionId - The document's version ID.
279
- *
280
- * @returns The document's version data.
281
- */
282
- getDocumentData(versionId: string): Promise<CoreApiDocumentData>;
283
- setupIntegrationFields(integrationFields: IntegrationFieldConfig[]): Promise<void>;
15
+ declare class RepositoryManager {
16
+ readonly name: string;
17
+ private readonly coreApiClient;
18
+ private readonly authApiClient;
19
+ private readonly wroomClient;
20
+ private readonly customTypesApiClient;
21
+ private readonly migrationApiClient;
22
+ private readonly assetApiClient;
23
+ private readonly manageV2Client;
24
+ private readonly integrationFieldsClient;
25
+ constructor(name: string, coreApiClient: CoreApiClient, authApiClient: AuthenticationApiClient, wroomClient: WroomClient, customTypesApiClient: CustomTypesApiClient, migrationApiClient: MigrationApiClient | undefined, assetApiClient: AssetApiClient, manageV2Client: ManageV2Client, integrationFieldsClient: IntegrationFieldsClient | undefined);
26
+ configure(config: RepositoryConfig): Promise<void>;
27
+ /** @returns The repository base url, like https://my-repo.prismic.io */
28
+ getBaseURL(): string;
29
+ /** @returns The repository base cdn url, like https://my-repo.cdn.prismic.io */
30
+ getBaseCdnURL(): string;
31
+ /**
32
+ * @returns A Content Type api client configured to target the repository CDN url. Uses Playwright
33
+ * for requests so if your project uses Playwright too, any network request will be present in
34
+ * Playwright test reports.
35
+ */
36
+ getContentApiClient(config?: {
37
+ version?: "v1" | "v2";
38
+ accessToken?: string;
39
+ }): ContentApiClient;
40
+ /**
41
+ * @returns An instance of the Migration api client, see
42
+ * https://prismic.io/docs/migration-api-technical-reference
43
+ */
44
+ getMigrationApiClient(): MigrationApiClient;
45
+ /**
46
+ * @returns An instance of the Asset api client, see
47
+ * https://prismic.io/docs/asset-api-technical-reference
48
+ */
49
+ getAssetApiClient(): AssetApiClient;
50
+ /** @returns The Wroom commit hash deployed on the current repository */
51
+ getDeployedVersion(): Promise<string | undefined>;
52
+ /**
53
+ * Set additional standard locales for a repository in Wroom, does not fail if the locales already
54
+ * exist.
55
+ *
56
+ * @param locales - An array of all locales to be added to the repository.
57
+ * @throws Error if setting the locales fails.
58
+ */
59
+ createLocales(locales: string[]): Promise<void>;
60
+ /**
61
+ * Set additional custom locale for a repository in Wroom, does not fail if the locales already
62
+ * exist.
63
+ *
64
+ * @param locale - The locale to be added to the repository.
65
+ * @throws Error if setting the locale fails.
66
+ */
67
+ createCustomLocale(locale: CustomLocale): Promise<void>;
68
+ private failIfNot200;
69
+ /**
70
+ * Delete a locale from a repository.
71
+ *
72
+ * @param locale - Locale to remove from the repository configuration.
73
+ * @throws Error if deleting the locale fails.
74
+ */
75
+ deleteLocale(locale: string): Promise<void>;
76
+ /**
77
+ * Create or update the default (master) locale for a repository in Wroom, the locale needs to
78
+ * exist in the repository.
79
+ *
80
+ * @param locale - The locale to be set as the default.
81
+ * @param endpoint - "createMasterLang" to create it, "defineAsMaster" to update it.
82
+ * @throws Error if setting the default locale fails.
83
+ */
84
+ setDefaultLocale(locale: string, action: "create" | "update"): Promise<void>;
85
+ /**
86
+ * Retrieves documents.
87
+ *
88
+ * @param args - Configure which documents are retrieved.
89
+ * @returns A paginated set of documents.
90
+ */
91
+ getDocuments(args: CoreApiDocumentsPayload): Promise<CoreApiDocumentsResponse>;
92
+ /**
93
+ * Creates a release.
94
+ *
95
+ * @param label - The label for the release.
96
+ * @returns A Promise that resolves when the release is created.
97
+ */
98
+ createRelease(label: string): Promise<{
99
+ id: string;
100
+ }>;
101
+ /**
102
+ * Retrieves the migration release.
103
+ *
104
+ * @returns The migration relese metadata.
105
+ */
106
+ getMigrationRelease(): Promise<Release>;
107
+ /**
108
+ * Publishes a release.
109
+ *
110
+ * @param id - The ID of the release.
111
+ * @returns A Promise that resolves when the release is published and a new master ref is
112
+ * available.
113
+ */
114
+ publishRelease(id: string): Promise<void>;
115
+ /**
116
+ * Deletes a repository release.
117
+ *
118
+ * @param id - The ID of the release to be deleted.
119
+ */
120
+ deleteRelease(id: string): Promise<void>;
121
+ /**
122
+ * Creates a preview for a repository.
123
+ *
124
+ * @param data - The data for creating the preview.
125
+ */
126
+ createPreview(data: Preview): Promise<void>;
127
+ /**
128
+ * Set the simulator URL (table of slices) for a repository.
129
+ *
130
+ * @param data - The simulator URL to set.
131
+ */
132
+ setSimulatorURL(simulatorURL: string): Promise<void>;
133
+ /**
134
+ * Deletes a preview from a repository.
135
+ *
136
+ * @param id - The ID of the preview to be deleted.
137
+ */
138
+ deletePreview(id: string): Promise<void>;
139
+ /**
140
+ * Create a webhook.
141
+ *
142
+ * @returns A Promise that resolves with the webhook id.
143
+ */
144
+ createWebhook(name: string, url: string, secret: string, triggers: {
145
+ documentsPublished?: boolean;
146
+ documentsUnpublished?: boolean;
147
+ releasesCreated?: boolean;
148
+ releasesUpdated?: boolean;
149
+ tagsCreated?: boolean;
150
+ tagsDeleted?: boolean;
151
+ }, active: boolean): Promise<string>;
152
+ /**
153
+ * Deletes a webhook.
154
+ *
155
+ * @param id - The webhook ID.
156
+ */
157
+ deleteWebhook(id: string): Promise<void>;
158
+ /**
159
+ * Create Custom Types using the Custom types api.
160
+ *
161
+ * @param customTypes
162
+ */
163
+ createCustomTypes(customTypes: StaticCustomTypeModel[]): Promise<void>;
164
+ deleteCustomType(customTypeId: string): Promise<void>;
165
+ /**
166
+ * Create slices using the Custom types api.
167
+ *
168
+ * @param slices
169
+ */
170
+ createSlices(slices: SharedSliceModel[]): Promise<void>;
171
+ /**
172
+ * Create an access token to query private items of the Content api.
173
+ *
174
+ * @param appName - Mandatory authorized application name
175
+ * @param tokenScope - Access token scope. Use "master" to when your content api is fully private
176
+ * or "master+releases" to access private releases
177
+ */
178
+ createContentAPIToken(appName: string, tokenScope?: "master" | "master+releases"): Promise<string>;
179
+ /** Create a permanent access token to authenticate to Prismic public apis. */
180
+ createPermanentAccessToken(): Promise<string>;
181
+ /**
182
+ * Toggle the Role per Locale workflow
183
+ *
184
+ * @param enabled - The feature new status
185
+ */
186
+ toggleRolePerLocal(enabled: boolean): Promise<void>;
187
+ /**
188
+ * Toggle the Custom Roles workflow
189
+ *
190
+ * @param enabled - The feature new status
191
+ */
192
+ toggleCustomRoles(enabled: boolean): Promise<void>;
193
+ /**
194
+ * Toggle the Integration Fields feature
195
+ *
196
+ * @param enabled - The feature new status
197
+ */
198
+ toggleIntegrationFields(enabled: boolean): Promise<void>;
199
+ /**
200
+ * Change the Repository Plan
201
+ *
202
+ * @param {string} newPlanId - The Id of the new Plan to apply
203
+ */
204
+ changePlan(newPlanId: string): Promise<void>;
205
+ /**
206
+ * Add a new user to the repository
207
+ *
208
+ * @param {string} email - The email of the user
209
+ */
210
+ addUser(email: string): Promise<void>;
211
+ /**
212
+ * Remove a user from the repository
213
+ *
214
+ * @param {string} email - The email of the user
215
+ */
216
+ removeUser(email: string): Promise<void>;
217
+ /**
218
+ * Update the role of a user in a repository
219
+ *
220
+ * @param {string} email - The email of the user
221
+ * @param {string | Record<string, string>} role - The new Role of the user, either a string for
222
+ * basic workflow or an object such as `{ "lang_id": "Writer" }`
223
+ *
224
+ * Example of roles are
225
+ *
226
+ * - Administrator
227
+ * - Writer
228
+ * - Contributor
229
+ * - Manager (publisher)
230
+ */
231
+ updateUserRole(email: string, role: string | Record<string, string>): Promise<void>;
232
+ /**
233
+ * Creates a document using the core api. If the Core api format is too specific, use the
234
+ * migration api client to create a document with the MigrationApiClient. See the
235
+ * `getMigrationApiClient()` method.
236
+ *
237
+ * @example
238
+ * To create a document by converting it from the Page Builder to
239
+ * Core api format
240
+ *
241
+ * ```js
242
+ * import { DocumentLegacy, UIDContentType } from '@prismicio/types-internal/lib/content';
243
+ *
244
+ * const document = {
245
+ * title: 'A new document',
246
+ * custom_type_id: 'home-page',
247
+ * locale: 'en-gb',
248
+ * integration_field_ids: [],
249
+ * tags: [],
250
+ * data: DocumentLegacy.encode({
251
+ * uid: {
252
+ * __TYPE__: UIDContentType,
253
+ * value: 'home-page',
254
+ * },
255
+ * })
256
+ * }
257
+ * await repository.createDocument(document, 'published');
258
+ * * ```
259
+ * ```
260
+ *
261
+ * @returns
262
+ *
263
+ * @param document - in the core api format.
264
+ *
265
+ * @param status - status of the document, if published, the function will
266
+ * wait for a new content api master ref to be created
267
+ */
268
+ createDocument(document: CoreApiDocumentCreationPayload, status: "draft" | "published"): Promise<CoreApiDocumentCreationResponse>;
269
+ /**
270
+ * Retrieves data for a specific document version.
271
+ *
272
+ * @param versionId - The document's version ID.
273
+ * @returns The document's version data.
274
+ */
275
+ getDocumentData(versionId: string): Promise<CoreApiDocumentData>;
276
+ setupIntegrationFields(integrationFields: IntegrationFieldConfig[]): Promise<void>;
284
277
  }
285
- export type RepositoryConfig = {
286
- customLocale?: CustomLocale;
287
- locales?: string[];
288
- defaultLocale?: string;
289
- slices?: SharedSlice[];
290
- customTypes?: CustomType[];
291
- preview?: Preview;
292
- simulatorURL?: string;
293
- rolePerLocal?: boolean;
294
- customRoles?: boolean;
295
- integrationFields?: IntegrationFieldConfig[];
278
+ type RepositoryConfig = {
279
+ customLocale?: CustomLocale;
280
+ locales?: string[];
281
+ defaultLocale?: string;
282
+ slices?: SharedSliceModel[];
283
+ customTypes?: StaticCustomTypeModel[];
284
+ preview?: Preview;
285
+ simulatorURL?: string;
286
+ rolePerLocal?: boolean;
287
+ customRoles?: boolean;
288
+ integrationFields?: IntegrationFieldConfig[];
296
289
  };
297
- export type Preview = {
298
- name: string;
299
- websiteURL: string;
300
- resolverPath: string;
290
+ type Preview = {
291
+ name: string;
292
+ websiteURL: string;
293
+ resolverPath: string;
301
294
  };
302
- export type CustomLocale = {
303
- lang: {
304
- label: string;
305
- id: string;
306
- useStandardAnalyzer?: boolean;
307
- };
308
- region: {
309
- label: string;
310
- id: string;
311
- };
295
+ type CustomLocale = {
296
+ lang: {
297
+ label: string;
298
+ id: string;
299
+ useStandardAnalyzer?: boolean;
300
+ };
301
+ region: {
302
+ label: string;
303
+ id: string;
304
+ };
312
305
  };
306
+ //#endregion
307
+ export { CustomLocale, Preview, RepositoryConfig, RepositoryManager };
308
+ //# sourceMappingURL=repository.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repository.d.ts","names":[],"sources":["../../src/managers/repository.ts"],"mappings":";;;;;;;;;;;;;;cA0Ba,iBAAA;EAAA,SAEF,IAAA;EAAA,iBACQ,aAAA;EAAA,iBACA,aAAA;EAAA,iBACA,WAAA;EAAA,iBACA,oBAAA;EAAA,iBACA,kBAAA;EAAA,iBACA,cAAA;EAAA,iBACA,cAAA;EAAA,iBACA,uBAAA;cARR,IAAA,UACQ,aAAA,EAAe,aAAA,EACf,aAAA,EAAe,uBAAA,EACf,WAAA,EAAa,WAAA,EACb,oBAAA,EAAsB,oBAAA,EACtB,kBAAA,EAAoB,kBAAA,cACpB,cAAA,EAAgB,cAAA,EAChB,cAAA,EAAgB,cAAA,EAChB,uBAAA,EAAyB,uBAAA;EAGrC,SAAA,CAAU,MAAA,EAAQ,gBAAA,GAAmB,OAAA;EAAnB;EAoExB,UAAA;EA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