@prismicio/e2e-tests-utils 1.12.0-alpha.6 → 1.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/src/index.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  export * from "./managers/repositories";
2
2
  export * from "./managers/repository";
3
+ export * from "./clients/coreApi";
3
4
  export * from "./clients/contentApi";
5
+ export * from "./clients/assetApi";
4
6
  export * from "./clients/migrationApi";
5
7
  export * from "./types";
@@ -15,6 +15,10 @@ import {
15
15
  CoreApiClient,
16
16
  CoreApiDocumentCreationPayload,
17
17
  CoreApiDocumentCreationResponse,
18
+ CoreApiDocumentData,
19
+ CoreApiDocumentsPayload,
20
+ CoreApiDocumentsResponse,
21
+ Release,
18
22
  } from "../clients/coreApi";
19
23
  import { CustomTypesApiClient } from "../clients/customTypesApi";
20
24
  import { IntegrationFieldsClient } from "../clients/integrationFields";
@@ -279,6 +283,19 @@ export class RepositoryManager {
279
283
  profiler.done({ message: `default locale set to '${locale}'` });
280
284
  }
281
285
 
286
+ /**
287
+ * Retrieves documents.
288
+ *
289
+ * @param args - Configure which documents are retrieved.
290
+ *
291
+ * @returns A paginated set of documents.
292
+ */
293
+ async getDocuments(
294
+ args: CoreApiDocumentsPayload,
295
+ ): Promise<CoreApiDocumentsResponse> {
296
+ return this.coreApiClient.getDocuments(args);
297
+ }
298
+
282
299
  /**
283
300
  * Creates a release.
284
301
  *
@@ -298,6 +315,21 @@ export class RepositoryManager {
298
315
  return response.data;
299
316
  }
300
317
 
318
+ /**
319
+ * Retrieves the migration release.
320
+ *
321
+ * @returns The migration relese metadata.
322
+ */
323
+ async getMigrationRelease(): Promise<Release> {
324
+ const releases = await this.coreApiClient.getReleases();
325
+ const migrationRelease = releases.find((release) => release.migration);
326
+ if (!migrationRelease) {
327
+ throw new Error(`The repository does not have a migration release`);
328
+ }
329
+
330
+ return migrationRelease;
331
+ }
332
+
301
333
  /**
302
334
  * Deletes a repository release.
303
335
  *
@@ -753,6 +785,17 @@ export class RepositoryManager {
753
785
  return result;
754
786
  }
755
787
 
788
+ /**
789
+ * Retrieves data for a specific document version.
790
+ *
791
+ * @param versionId - The document's version ID.
792
+ *
793
+ * @returns The document's version data.
794
+ */
795
+ async getDocumentData(versionId: string): Promise<CoreApiDocumentData> {
796
+ return await this.coreApiClient.getDocumentData(versionId);
797
+ }
798
+
756
799
  async setupIntegrationFields(
757
800
  integrationFields: IntegrationFieldConfig[],
758
801
  ): Promise<void> {