@qawolf/ci-sdk 0.23.1 → 1.1.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/dist/index.js CHANGED
@@ -1,11 +1,3 @@
1
- 'use strict';
2
-
3
- var slugify = require('slugify');
4
-
5
- function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
6
-
7
- var slugify__default = /*#__PURE__*/_interopDefault(slugify);
8
-
9
1
  var __defProp = Object.defineProperty;
10
2
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
3
 
@@ -18,10 +10,6 @@ function pluralize(count) {
18
10
  return count === 1 ? "" : "s";
19
11
  }
20
12
  __name(pluralize, "pluralize");
21
- function getBackoffMs(attemptNumber, minWaitMs = 1e3, maxWaitMs = 1e4) {
22
- return Math.min(maxWaitMs, minWaitMs * 1.2 ** attemptNumber);
23
- }
24
- __name(getBackoffMs, "getBackoffMs");
25
13
  var buildFetchWithTimeout = /* @__PURE__ */ __name((fetch, timeout) => async (...args) => fetch(args[0], {
26
14
  ...args[1],
27
15
  signal: AbortSignal.timeout(timeout)
@@ -47,10 +35,53 @@ var defaultLogDriver = {
47
35
  var defaultServiceBase = "https://app.qawolf.com/";
48
36
 
49
37
  // package.json
50
- var version = "0.23.1";
38
+ var package_default = {
39
+ name: "@qawolf/ci-sdk",
40
+ version: "1.1.0",
41
+ private: false,
42
+ description: "A simple SDK for interacting with QAWolf in CI scripts.",
43
+ keywords: [],
44
+ license: "MIT",
45
+ author: "Jules Sam. Randolph<jules@qawolf.com>",
46
+ sideEffects: false,
47
+ type: "module",
48
+ exports: {
49
+ ".": {
50
+ types: "./dist/index.d.ts",
51
+ require: "./dist/index.cjs",
52
+ import: "./dist/index.js",
53
+ default: "./dist/index.js"
54
+ }
55
+ },
56
+ files: [
57
+ "/dist",
58
+ "/README.md"
59
+ ],
60
+ scripts: {
61
+ build: "tsup src/index.ts --format esm,cjs --dts --clean --splitting --treeshake --sourcemap --outDir dist --target es2022",
62
+ lint: "dpdm --exit-code circular:1 --no-tree --no-warning --transform --include='.*' --exclude='/(dist|node_modules)/' '**/*' && eslint . --ext cjs,cts,js,jsx,mjs,ts,tsx --quiet && prettier --check .",
63
+ "lint:fix": "eslint . --ext cjs,cts,js,jsx,mjs,ts,tsx --fix --quiet && prettier --log-level=warn --write .",
64
+ "lint:warnings": "eslint . --ext cjs,cts,js,jsx,mjs,ts,tsx",
65
+ prepublishOnly: "nx run ci-sdk:build",
66
+ test: 'NODE_OPTIONS="--experimental-vm-modules" NODE_NO_WARNINGS=1 jest',
67
+ "tsc:check": "tsc --noEmit"
68
+ },
69
+ dependencies: {
70
+ "@qawolf/ci-utils": "^1.0.0",
71
+ "@sinonjs/fake-timers": "^10.3.0",
72
+ slugify: "^1.6.6",
73
+ tslib: "^2.6.2"
74
+ },
75
+ devDependencies: {
76
+ tsup: "8.3.5"
77
+ },
78
+ engines: {
79
+ node: ">=20"
80
+ }
81
+ };
51
82
 
52
83
  // src/lib/sdk/defaults/userAgent.ts
53
- var defaultUserAgent = `ci-sdk/${version}`;
84
+ var defaultUserAgent = `ci-sdk/${package_default.version}`;
54
85
 
55
86
  // src/lib/api/log.ts
56
87
  async function logFetchError({ log, methodName, response }) {
@@ -93,10 +124,14 @@ async function attemptNotifyDeploy(deps, apiConfig, config) {
93
124
  deduplication_key: config.deduplicationKey,
94
125
  deployment_type: config.deploymentType,
95
126
  deployment_url: config.deploymentUrl,
96
- hosting_service: config.hostingService,
97
- merge_request_number: config.hostingService === "GitLab" ? config.mergeRequestNumber : void 0,
98
- pull_request_number: config.hostingService === "GitHub" ? config.pullRequestNumber : void 0,
99
- repository: config.repository,
127
+ ..."ephemeralEnvironment" in config ? {
128
+ ephemeral_environment: config.ephemeralEnvironment
129
+ } : "hostingService" in config && {
130
+ hosting_service: config.hostingService,
131
+ merge_request_number: config.hostingService === "GitLab" ? config.mergeRequestNumber : void 0,
132
+ pull_request_number: config.hostingService === "GitHub" ? config.pullRequestNumber : void 0,
133
+ repository: config.repository
134
+ },
100
135
  sha: config.sha,
101
136
  variables: config.variables
102
137
  }),
@@ -363,523 +398,6 @@ async function generateSignedUrlForTempTeamStorage(deps, apiConfig, config) {
363
398
  }
364
399
  __name(generateSignedUrlForTempTeamStorage, "generateSignedUrlForTempTeamStorage");
365
400
 
366
- // src/lib/sdk/domain/legacy_previewTesting/constants.ts
367
- var qawolfBaseUrl = "https://app.qawolf.com";
368
- var qawolfGraphQLEndpoint = `${qawolfBaseUrl}/api/graphql`;
369
- var previewDeploymentType = "qawolf-preview";
370
-
371
- // src/lib/sdk/domain/legacy_previewTesting/createEnvironmentVariables.ts
372
- async function createEnvironmentVariables(deps, apiConfig, { environmentId, variables }) {
373
- const environmentVariableRequests = Object.keys(variables).map(async (key) => {
374
- const value = variables[key];
375
- return deps.fetch(qawolfGraphQLEndpoint, {
376
- body: JSON.stringify({
377
- query: `
378
- mutation UpsertEnvironmentVariable($environmentId: ID!, $value: String!, $name: String) {
379
- upsertEnvironmentVariable(environmentId: $environmentId, value: $value, name: $name) {
380
- id
381
- }
382
- }
383
- `,
384
- variables: {
385
- environmentId,
386
- name: key,
387
- value
388
- }
389
- }),
390
- headers: {
391
- Authorization: `Bearer ${apiConfig.apiKey}`,
392
- "Content-Type": "application/json"
393
- },
394
- method: "post"
395
- });
396
- });
397
- await Promise.all(environmentVariableRequests);
398
- }
399
- __name(createEnvironmentVariables, "createEnvironmentVariables");
400
-
401
- // src/lib/sdk/domain/legacy_previewTesting/findOrCreateEnvironment.ts
402
- async function findOrCreateEnvironment(deps, apiConfig, { baseEnvironmentId, branch, pr, qaWolfTeamId }) {
403
- const retrievalResponse = await deps.fetch(qawolfGraphQLEndpoint, {
404
- body: JSON.stringify({
405
- query: `
406
- query Environments($where: EnvironmentWhereInput) {
407
- environments(where: $where) {
408
- id
409
- }
410
- }
411
- `,
412
- variables: {
413
- where: {
414
- deletedAt: {
415
- equals: null
416
- },
417
- name: {
418
- equals: pr ? `[PR] #${pr.number} - ${pr.title}` : `[Preview] ${branch}`
419
- }
420
- }
421
- }
422
- }),
423
- headers: {
424
- Authorization: `Bearer ${apiConfig.apiKey}`,
425
- "Content-Type": "application/json"
426
- },
427
- method: "post"
428
- });
429
- const jsonResponse = await retrievalResponse.json();
430
- if (jsonResponse.data.environments[0]) {
431
- const environmentId = jsonResponse.data.environments[0].id;
432
- deps.log.info(`Environment already exists with ID: ${environmentId}`);
433
- return environmentId;
434
- }
435
- const creationResponse = await deps.fetch(qawolfGraphQLEndpoint, {
436
- body: JSON.stringify({
437
- operationName: "createEnvironment",
438
- query: `
439
- mutation createEnvironment($name: String!, $teamId: String!) {
440
- createEnvironment(name: $name, teamId: $teamId) {
441
- id
442
- branchId
443
- }
444
- }
445
- `,
446
- variables: {
447
- name: pr ? `[PR] #${pr.number} - ${pr.title}` : `[Preview] ${branch}`,
448
- teamId: qaWolfTeamId
449
- }
450
- }),
451
- headers: {
452
- Authorization: `Bearer ${apiConfig.apiKey}`,
453
- "Content-Type": "application/json"
454
- },
455
- method: "post"
456
- });
457
- const createionResponseJson = await creationResponse.json();
458
- deps.log.info(`Environment response: ${JSON.stringify(createionResponseJson)}`);
459
- if (!createionResponseJson.data.createEnvironment.id) throw Error("Environment ID not found in response");
460
- const multiBranchResponse = await deps.fetch(qawolfGraphQLEndpoint, {
461
- body: JSON.stringify({
462
- query: `
463
- query teamBranches($teamId: String!) {
464
- teamBranches: activeTeamBranches(teamId: $teamId) {
465
- id
466
- environments{
467
- id
468
- }
469
- }
470
- }
471
- `,
472
- variables: {
473
- teamId: qaWolfTeamId
474
- }
475
- }),
476
- headers: {
477
- Authorization: `Bearer ${apiConfig.apiKey}`,
478
- "Content-Type": "application/json"
479
- },
480
- method: "post"
481
- });
482
- const multiBranchResponseJson = await multiBranchResponse.json();
483
- const hasMultipleBranches = multiBranchResponseJson.data.teamBranches.length > 1;
484
- if (!hasMultipleBranches) return createionResponseJson.data.createEnvironment.id;
485
- const sourceEnvironmentResponse = await deps.fetch(qawolfGraphQLEndpoint, {
486
- body: JSON.stringify({
487
- query: `
488
- query EnvironmentWithBranch($where: EnvironmentWhereUniqueInput!) {
489
- environment(where: $where) {
490
- id
491
- branchId
492
- }
493
- }
494
- `,
495
- variables: {
496
- where: {
497
- id: baseEnvironmentId
498
- }
499
- }
500
- }),
501
- headers: {
502
- Authorization: `Bearer ${apiConfig.apiKey}`,
503
- "Content-Type": "application/json"
504
- },
505
- method: "post"
506
- });
507
- const sourceEnvironmentJson = await sourceEnvironmentResponse.json();
508
- const baseBranchId = sourceEnvironmentJson.data.environment.branchId;
509
- const targetBranchId = createionResponseJson.data.createEnvironment.branchId;
510
- if (!baseBranchId) throw Error("Base branch ID not found in response");
511
- deps.log.info(`Promoting workflows from branch ${baseBranchId} to ${targetBranchId}`);
512
- const promotionResponse = await deps.fetch(qawolfGraphQLEndpoint, {
513
- body: JSON.stringify({
514
- query: `
515
- mutation PromoteWorkflowsToBranch(
516
- $sourceTeamBranchId: String!
517
- $targetTeamBranchId: String!
518
- ) {
519
- promoteWorkflowsToBranch(
520
- mergeStrategy: overwrite
521
- sourceTeamBranchId: $sourceTeamBranchId
522
- targetTeamBranchId: $targetTeamBranchId
523
- )
524
- }
525
- `,
526
- variables: {
527
- sourceTeamBranchId: baseBranchId,
528
- targetTeamBranchId: targetBranchId
529
- }
530
- }),
531
- headers: {
532
- Authorization: `Bearer ${apiConfig.apiKey}`,
533
- "Content-Type": "application/json"
534
- },
535
- method: "post"
536
- });
537
- const promotionResponseJson = await promotionResponse.json();
538
- if (!promotionResponseJson) throw Error("Promotion failed");
539
- return createionResponseJson.data.createEnvironment.id;
540
- }
541
- __name(findOrCreateEnvironment, "findOrCreateEnvironment");
542
-
543
- // src/lib/sdk/domain/legacy_previewTesting/findOrCreateTrigger.ts
544
- async function findOrCreateTrigger(deps, apiConfig, args) {
545
- const { branch, environmentId, pr, qaWolfTeamId, repositoryId, tags } = args;
546
- const triggerName = `Deployments of ${pr ? `PR #${pr.number} - ${pr.title}` : `branch ${branch}`}`;
547
- const retrievalResponse = await deps.fetch(qawolfGraphQLEndpoint, {
548
- body: JSON.stringify({
549
- query: `query getTriggersForBranch($where: TriggerWhereInput) {
550
- triggers(where: $where) {
551
- environment_id
552
- id
553
- }
554
- }
555
- `,
556
- variables: {
557
- where: {
558
- environment_id: {
559
- equals: environmentId
560
- },
561
- name: {
562
- equals: triggerName
563
- }
564
- }
565
- }
566
- }),
567
- headers: {
568
- Authorization: `Bearer ${apiConfig.apiKey}`,
569
- "Content-Type": "application/json"
570
- },
571
- method: "post"
572
- });
573
- const retrievalResponseJson = await retrievalResponse.json();
574
- if (retrievalResponseJson.data.triggers[0]) {
575
- const triggerId2 = retrievalResponseJson.data.triggers[0].id;
576
- const environmentId2 = retrievalResponseJson.data.triggers[0].environment_id;
577
- deps.log.info(`Trigger with name ${triggerName} already exists with id ${triggerId2} in environment ${environmentId2}`);
578
- return triggerId2;
579
- }
580
- const creationResponse = await deps.fetch(qawolfGraphQLEndpoint, {
581
- body: JSON.stringify({
582
- operationName: "createTrigger",
583
- query: `
584
- mutation createTrigger(
585
- $codeHostingServiceRepositoryId: ID!,
586
- $deploymentBranches: String!,
587
- $deploymentEnvironment: String!,
588
- $deploymentProvider: String!,
589
- $environmentId: ID!,
590
- $name: String!,
591
- $teamId: ID!,
592
- $tag_ids: [ID!]
593
- ) {
594
- createTrigger(
595
- codeHostingServiceRepositoryId: $codeHostingServiceRepositoryId,
596
- deployment_branches: $deploymentBranches,
597
- deployment_environment: $deploymentEnvironment,
598
- deployment_provider: $deploymentProvider,
599
- environment_id: $environmentId,
600
- name: $name,
601
- team_id: $teamId,
602
- tag_ids: $tag_ids
603
- ) {
604
- id
605
- __typename
606
- }
607
- }
608
- `,
609
- variables: {
610
- codeHostingServiceRepositoryId: repositoryId,
611
- deploymentBranches: branch,
612
- deploymentEnvironment: previewDeploymentType,
613
- deploymentProvider: "generic",
614
- environmentId,
615
- name: triggerName,
616
- tag_ids: tags?.map((tag) => tag.id),
617
- teamId: qaWolfTeamId
618
- }
619
- }),
620
- headers: {
621
- Authorization: `Bearer ${apiConfig.apiKey}`,
622
- "Content-Type": "application/json"
623
- },
624
- method: "post"
625
- });
626
- const creationResponseJson = await creationResponse.json();
627
- deps.log.info(`Trigger response: ${JSON.stringify(creationResponseJson)}`);
628
- const triggerId = creationResponseJson.data?.createTrigger?.id;
629
- if (!triggerId) throw Error("Trigger ID not found in response");
630
- deps.log.info(`Trigger created with ID: ${triggerId}`);
631
- return triggerId;
632
- }
633
- __name(findOrCreateTrigger, "findOrCreateTrigger");
634
-
635
- // src/lib/sdk/domain/legacy_previewTesting/findRepositoryIdByName.ts
636
- async function findRepositoryIdByName(deps, apiConfig, { headRepoFullName }) {
637
- const response = await deps.fetch(qawolfGraphQLEndpoint, {
638
- body: JSON.stringify({
639
- query: `
640
- query codeHostingServiceRepositories($where: CodeHostingServiceRepositoryWhereInput) {
641
- codeHostingServiceRepositories(where: $where) {
642
- id
643
- }
644
- }
645
- `,
646
- variables: {
647
- where: {
648
- externalFullName: {
649
- equals: headRepoFullName
650
- }
651
- }
652
- }
653
- }),
654
- headers: {
655
- Authorization: `Bearer ${apiConfig.apiKey}`,
656
- "Content-Type": "application/json"
657
- },
658
- method: "post"
659
- });
660
- const responseJson = await response.json();
661
- deps.log.info(`Repository response: ${JSON.stringify(responseJson)}`);
662
- const repositories = responseJson.data.codeHostingServiceRepositories;
663
- if (!repositories[0]) return;
664
- return repositories[0].id;
665
- }
666
- __name(findRepositoryIdByName, "findRepositoryIdByName");
667
-
668
- // src/lib/sdk/domain/legacy_previewTesting/getEnvironmentVariablesFromEnvironment.ts
669
- async function getEnvironmentVariablesFromEnvironment(deps, apiConfig, { environmentId }) {
670
- const retrievalResponse = await deps.fetch(qawolfGraphQLEndpoint, {
671
- body: JSON.stringify({
672
- query: `
673
- query EnvironmentVariables($where: EnvironmentWhereUniqueInput!) {
674
- environment(where: $where) {
675
- id
676
- variablesJSON
677
- }
678
- }
679
- `,
680
- variables: {
681
- where: {
682
- id: environmentId
683
- }
684
- }
685
- }),
686
- headers: {
687
- Authorization: `Bearer ${apiConfig.apiKey}`,
688
- "Content-Type": "application/json"
689
- },
690
- method: "post"
691
- });
692
- const retrievalResponseJson = await retrievalResponse.json();
693
- if (!retrievalResponseJson.data.environment) {
694
- throw Error(`Environment not found with ID: ${environmentId}. Please check the environment ID is correct.`);
695
- }
696
- return JSON.parse(retrievalResponseJson.data.environment.variablesJSON);
697
- }
698
- __name(getEnvironmentVariablesFromEnvironment, "getEnvironmentVariablesFromEnvironment");
699
-
700
- // src/lib/sdk/domain/legacy_previewTesting/getTagsFromEnvironment.ts
701
- async function getTagsFromGenericTriggerInEnvironment(deps, apiConfig, { environmentId }) {
702
- const retrievalResponse = await deps.fetch(qawolfGraphQLEndpoint, {
703
- body: JSON.stringify({
704
- query: `
705
- query GenericTriggerTagsFromEnvironment($where: EnvironmentWhereUniqueInput!) {
706
- environment(where: $where) {
707
- id
708
- triggers(where: {deployment_provider: {equals: "generic"}}) {
709
- id
710
- tags {
711
- id
712
- name
713
- }
714
- }
715
- }
716
- }
717
- `,
718
- variables: {
719
- where: {
720
- id: environmentId
721
- }
722
- }
723
- }),
724
- headers: {
725
- Authorization: `Bearer ${apiConfig.apiKey}`,
726
- "Content-Type": "application/json"
727
- },
728
- method: "post"
729
- });
730
- const retrievalResponseJson = await retrievalResponse.json();
731
- if (!retrievalResponseJson.data.environment) {
732
- throw Error(`Environment not found with ID: ${environmentId}. Please check the environment ID is correct.`);
733
- }
734
- return retrievalResponseJson.data.environment.triggers[0]?.tags?.map((tag) => tag);
735
- }
736
- __name(getTagsFromGenericTriggerInEnvironment, "getTagsFromGenericTriggerInEnvironment");
737
-
738
- // src/lib/sdk/domain/legacy_previewTesting/createEnvironmentAction.ts
739
- var createEnvironmentAction = /* @__PURE__ */ __name(async (deps, apiConfig, { baseEnvironmentId, branch, deploymentUrl, headRepoFullName, pr, qaWolfTeamId, variables }) => {
740
- deps.log.info("Creating environment for pull request...");
741
- const environmentId = await findOrCreateEnvironment(deps, apiConfig, {
742
- baseEnvironmentId,
743
- branch,
744
- pr,
745
- qaWolfTeamId
746
- });
747
- deps.log.info(`Environment created with ID: ${environmentId}`);
748
- const baseEnvironmentVariablesJSON = baseEnvironmentId ? await getEnvironmentVariablesFromEnvironment(deps, apiConfig, {
749
- environmentId: baseEnvironmentId
750
- }) : {};
751
- if (typeof baseEnvironmentVariablesJSON !== "object") {
752
- deps.log.error("baseEnvironmentVariablesJSON is not an object");
753
- throw Error("baseEnvironmentVariablesJSON is not an object");
754
- }
755
- const combinedEnvironmentVariables = {
756
- ...baseEnvironmentVariablesJSON,
757
- ...variables,
758
- ...deploymentUrl ? {
759
- URL: deploymentUrl
760
- } : {}
761
- };
762
- deps.log.info("Creating environment variables...");
763
- await createEnvironmentVariables(deps, apiConfig, {
764
- environmentId,
765
- variables: combinedEnvironmentVariables
766
- });
767
- deps.log.info(`Environment variables created for environment ID: ${environmentId}`);
768
- deps.log.info("Retrieving repository ID...");
769
- const repositoryId = await findRepositoryIdByName(deps, apiConfig, {
770
- headRepoFullName
771
- });
772
- deps.log.info(repositoryId ? `Repository ID retrieved: ${repositoryId}` : "Repository not integrated with QA Wolf, enable it in the settings page to get PR comments and checks.");
773
- const tags = baseEnvironmentId ? await getTagsFromGenericTriggerInEnvironment(deps, apiConfig, {
774
- environmentId: baseEnvironmentId
775
- }) : undefined;
776
- deps.log.info(`Tags retrieved: ${tags?.map((tag) => tag.name).join(", ")}`);
777
- deps.log.info("Creating trigger for deployment...");
778
- await findOrCreateTrigger(deps, apiConfig, {
779
- branch,
780
- environmentId,
781
- pr,
782
- qaWolfTeamId,
783
- repositoryId,
784
- tags
785
- });
786
- }, "createEnvironmentAction");
787
-
788
- // src/lib/sdk/domain/legacy_previewTesting/deleteEnvironment.ts
789
- async function deleteEnvironment(deps, apiConfig, { environmentId }) {
790
- await deps.fetch(qawolfGraphQLEndpoint, {
791
- body: JSON.stringify({
792
- query: `
793
- mutation deleteEnvironment($environmentId: ID!) {
794
- deleteEnvironment(environment_id: $environmentId) {
795
- id
796
- }
797
- }
798
- `,
799
- variables: {
800
- environmentId
801
- }
802
- }),
803
- headers: {
804
- Authorization: `Bearer ${apiConfig.apiKey}`,
805
- "Content-Type": "application/json"
806
- },
807
- method: "post"
808
- });
809
- deps.log.info(`Environment deleted with ID: ${environmentId}`);
810
- }
811
- __name(deleteEnvironment, "deleteEnvironment");
812
-
813
- // src/lib/sdk/domain/legacy_previewTesting/getEnvironmentIdForBranch.ts
814
- async function getEnvironmentIdForBranch(deps, apiConfig, branch) {
815
- const response = await deps.fetch(qawolfGraphQLEndpoint, {
816
- body: JSON.stringify({
817
- query: `
818
- query getTriggersForBranch($where: TriggerWhereInput) {
819
- triggers(where: $where) {
820
- id
821
- environment_id
822
- }
823
- }
824
- `,
825
- variables: {
826
- where: {
827
- deployment_branches: {
828
- contains: branch
829
- }
830
- }
831
- }
832
- }),
833
- headers: {
834
- Authorization: `Bearer ${apiConfig.apiKey}`,
835
- "Content-Type": "application/json"
836
- },
837
- method: "post"
838
- });
839
- const responseJson = await response.json();
840
- deps.log.info(`Trigger response: ${JSON.stringify(responseJson)}`);
841
- const triggers = responseJson.data.triggers;
842
- if (!triggers || !triggers[0]) throw Error(`No environment found for branch: ${branch}`);
843
- return triggers[0].environment_id;
844
- }
845
- __name(getEnvironmentIdForBranch, "getEnvironmentIdForBranch");
846
-
847
- // src/lib/sdk/domain/legacy_previewTesting/deleteEnvironmentAction.ts
848
- var deleteEnvironmentAction = /* @__PURE__ */ __name(async (deps, apiConfig, { branch }) => {
849
- deps.log.info("Retrieving environment ID for deletion...");
850
- const environmentId = await getEnvironmentIdForBranch(deps, apiConfig, branch);
851
- deps.log.info(`Deleting environment with ID: ${environmentId}`);
852
- await deleteEnvironment(deps, apiConfig, {
853
- environmentId
854
- });
855
- }, "deleteEnvironmentAction");
856
-
857
- // src/lib/sdk/domain/legacy_previewTesting/index.ts
858
- async function testPreview(deps, apiConfig, config) {
859
- await createEnvironmentAction(deps, apiConfig, {
860
- baseEnvironmentId: config.baseEnvironmentId,
861
- branch: config.branch,
862
- deploymentUrl: config.deploymentUrl,
863
- headRepoFullName: config.repoFullName,
864
- pr: config.pr,
865
- qaWolfTeamId: config.qaWolfTeamId,
866
- variables: config.variables
867
- });
868
- return attemptNotifyDeploy(deps, apiConfig, {
869
- branch: config.branch,
870
- commitUrl: config.commitUrl,
871
- deploymentType: previewDeploymentType,
872
- deploymentUrl: config.deploymentUrl,
873
- sha: config.sha,
874
- variables: config.variables
875
- });
876
- }
877
- __name(testPreview, "testPreview");
878
- async function removeEnvironment(deps, apiConfig, config) {
879
- await deleteEnvironmentAction(deps, apiConfig, config);
880
- }
881
- __name(removeEnvironment, "removeEnvironment");
882
-
883
401
  // src/lib/api/ci-greenlight.ts
884
402
  async function fetchCiGreenlightStatus({ apiKey, serviceBase, userAgent }, { runId }, { fetch: localFetch, log }) {
885
403
  try {
@@ -1080,503 +598,6 @@ ${urlInfo}`);
1080
598
  }
1081
599
  __name(pollCiGreenlightStatus, "pollCiGreenlightStatus");
1082
600
 
1083
- // src/lib/api/graphql.ts
1084
- var GraphQLBadResponseError = class GraphQLBadResponseError2 extends Error {
1085
- static {
1086
- __name(this, "GraphQLBadResponseError");
1087
- }
1088
- constructor(message) {
1089
- super(message);
1090
- this.name = "GraphQLBadResponseError";
1091
- }
1092
- };
1093
- function mapErrorCodeToAbortReason({ errorCode, log }) {
1094
- switch (errorCode) {
1095
- case "BAD_USER_INPUT":
1096
- return "invalid-input";
1097
- case "FORBIDDEN":
1098
- return "forbidden";
1099
- case "INTERNAL":
1100
- return "server-error";
1101
- case "UNAUTHENTICATED":
1102
- return "unauthenticated";
1103
- default:
1104
- log.error(`Unknown error code. ${errorCode}`);
1105
- return "server-error";
1106
- }
1107
- }
1108
- __name(mapErrorCodeToAbortReason, "mapErrorCodeToAbortReason");
1109
- async function qawolfGraphql({ apiConfig: { apiKey, serviceBase, userAgent }, deps: { fetch: localFetch, log }, name, query: queryGql, variables }) {
1110
- try {
1111
- const response = await localFetch(new URL(`/api/graphql`, serviceBase), {
1112
- body: JSON.stringify({
1113
- query: queryGql,
1114
- variables
1115
- }),
1116
- headers: {
1117
- Authorization: `Bearer ${apiKey}`,
1118
- "Content-Type": "application/json",
1119
- "User-Agent": userAgent
1120
- },
1121
- method: "post"
1122
- });
1123
- let rawBody;
1124
- try {
1125
- rawBody = await response.json();
1126
- } catch (e) {
1127
- throw new GraphQLBadResponseError(`[GraphQL] Unexpected response schema. Not valid JSON body.`);
1128
- }
1129
- if ("errors" in rawBody) {
1130
- for (const error of rawBody.errors) log.warn(`\u274C [GraphQL] error: ${error.message}`);
1131
- const firstError = rawBody.errors[0];
1132
- const eventId = firstError?.extensions?.eventId;
1133
- const errorCode = firstError?.extensions?.code;
1134
- return {
1135
- abortReason: mapErrorCodeToAbortReason({
1136
- errorCode,
1137
- log
1138
- }),
1139
- eventId,
1140
- isGqlError: true
1141
- };
1142
- }
1143
- if (!("data" in rawBody)) {
1144
- throw new GraphQLBadResponseError(`[GraphQL] Unexpected response schema. Missing 'data' in response body. This is a bug.`);
1145
- }
1146
- if (!(name in rawBody.data)) {
1147
- throw new GraphQLBadResponseError(`[GraphQL] Unexpected response schema. Missing 'data.${name}' in response body. This is a bug.`);
1148
- }
1149
- return {
1150
- isGqlError: false,
1151
- responseBody: rawBody.data[name]
1152
- };
1153
- } catch (e) {
1154
- if (e instanceof GraphQLBadResponseError) throw e;
1155
- log.error(`\u274C [GraphQL] network error: ${e instanceof Error ? e.message : e}`);
1156
- return {
1157
- abortReason: "network-error",
1158
- isGqlError: true
1159
- };
1160
- }
1161
- }
1162
- __name(qawolfGraphql, "qawolfGraphql");
1163
- function logGraphQLError({ log, methodName, payload }) {
1164
- const eventIdSuffix = payload.eventId ? ` (Event ID: ${payload.eventId})` : "";
1165
- switch (payload.abortReason) {
1166
- case "forbidden":
1167
- log.error(`\u274C [${methodName}] Forbidden. Aborting${eventIdSuffix}`);
1168
- break;
1169
- case "invalid-input":
1170
- log.error(`\u274C [${methodName}] Bad GraphQL input. This is a bug. Aborting${eventIdSuffix}`);
1171
- break;
1172
- case "network-error":
1173
- log.error(`\u274C [${methodName}] Network error. Aborting${eventIdSuffix}`);
1174
- break;
1175
- case "server-error":
1176
- log.error(`\u274C [${methodName}] Server error. Aborting${eventIdSuffix}`);
1177
- break;
1178
- case "unauthenticated":
1179
- log.error(`\u274C [${methodName}] Unauthenticated. Aborting${eventIdSuffix}`);
1180
- break;
1181
- default:
1182
- payload.abortReason;
1183
- log.error(`\u274C [${methodName}] Unknown error. ${payload.abortReason} This is a bug${eventIdSuffix}`);
1184
- }
1185
- }
1186
- __name(logGraphQLError, "logGraphQLError");
1187
-
1188
- // src/lib/api/notify-vcs-branch-merge-canceled-mutation.ts
1189
- var mutationName = "notifyVCSBranchMergeCanceled";
1190
- var mutationGql = `
1191
- mutation NotifyVCSBranchMergeCanceled($headEnvironmentAlias: String!) {
1192
- ${mutationName}(headEnvironmentAlias: $headEnvironmentAlias) {
1193
- outcome
1194
- failureCode
1195
- failureDetails
1196
- }
1197
- }`;
1198
- async function callNotifyVCSBranchMergeCanceledMutation(deps, apiConfig, { headEnvironmentAlias }) {
1199
- return qawolfGraphql({
1200
- apiConfig,
1201
- deps,
1202
- name: mutationName,
1203
- query: mutationGql,
1204
- variables: {
1205
- headEnvironmentAlias
1206
- }
1207
- });
1208
- }
1209
- __name(callNotifyVCSBranchMergeCanceledMutation, "callNotifyVCSBranchMergeCanceledMutation");
1210
-
1211
- // src/lib/sdk/domain/vcsBranchTesting/lib/domain-failure.ts
1212
- function domainFailureToAbortResult({ log, methodName, result }) {
1213
- switch (result.failureCode) {
1214
- case "base-environment-not-found":
1215
- log.error(`\u274C [${methodName}] Base environment not found. Aborting.`);
1216
- return {
1217
- abortReason: result.failureCode,
1218
- outcome: "aborted"
1219
- };
1220
- case "base-trigger-not-found":
1221
- log.error(`\u274C [${methodName}] Base trigger not found. A QA Wolf representative should set this up for you. Aborting.`);
1222
- return {
1223
- abortReason: result.failureCode,
1224
- outcome: "aborted"
1225
- };
1226
- case "head-environment-not-found":
1227
- log.error(`\u274C [${methodName}] Head environment not found. Aborting.`);
1228
- return {
1229
- abortReason: result.failureCode,
1230
- outcome: "aborted"
1231
- };
1232
- case "head-trigger-not-found":
1233
- log.error(`\u274C [${methodName}] Head trigger not found. Aborting.`);
1234
- return {
1235
- abortReason: result.failureCode,
1236
- outcome: "aborted"
1237
- };
1238
- case "invalid-input":
1239
- log.error(`\u274C [${methodName}] Invalid input: ${result.failureDetails} Aborting.`);
1240
- return {
1241
- abortReason: result.failureCode,
1242
- outcome: "aborted"
1243
- };
1244
- case "non-ephemeral-head-environment-violation":
1245
- log.error(`\u274C [${methodName}] Non-ephemeral head environment violation. Aborting.`);
1246
- return {
1247
- abortReason: result.failureCode,
1248
- outcome: "aborted"
1249
- };
1250
- case "repository-not-found":
1251
- log.error(`\u274C [${methodName}] Repository not found: ${result.failureDetails} Aborting.`);
1252
- return {
1253
- abortReason: result.failureCode,
1254
- outcome: "aborted"
1255
- };
1256
- case "run-creation-failed":
1257
- log.error(`\u274C [${methodName}] Run creation failed: ${result.failureDetails}. Aborting.`);
1258
- return {
1259
- abortReason: result.failureCode,
1260
- outcome: "aborted"
1261
- };
1262
- default:
1263
- result.failureCode;
1264
- throw Error(`[${methodName}] Unreachable code detected. This is a bug. ${result.failureCode}`);
1265
- }
1266
- }
1267
- __name(domainFailureToAbortResult, "domainFailureToAbortResult");
1268
-
1269
- // src/lib/sdk/domain/vcsBranchTesting/lib/retry.ts
1270
- async function retryWithExponentialBackoff({ log, maxRetries, methodName, retriableAbortReasons, runOnce }) {
1271
- let attemptNumber = 0;
1272
- let result;
1273
- do {
1274
- attemptNumber++;
1275
- log.info(`\u{1F501} [${methodName}] Attempt ${attemptNumber}/${maxRetries + 1}.`);
1276
- result = await runOnce();
1277
- if (result.outcome === "success" || !retriableAbortReasons.includes(result.abortReason)) return result;
1278
- if (attemptNumber >= maxRetries + 1) return result;
1279
- const backoffMs = getBackoffMs(attemptNumber);
1280
- const secondsApproximation = (backoffMs / 1e3).toFixed(1);
1281
- log.warn(`\u23F3 [${methodName}] Retrying in ${secondsApproximation} seconds.`);
1282
- await sleep(backoffMs);
1283
- } while (true);
1284
- }
1285
- __name(retryWithExponentialBackoff, "retryWithExponentialBackoff");
1286
-
1287
- // src/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-canceled.ts
1288
- async function runNotifyVCSMergeCanceledOnce(deps, apiConfig, input) {
1289
- const log = deps.log;
1290
- const { headEnvironmentAlias } = input;
1291
- const resp = await callNotifyVCSBranchMergeCanceledMutation(deps, apiConfig, {
1292
- headEnvironmentAlias
1293
- });
1294
- if (resp.isGqlError) {
1295
- logGraphQLError({
1296
- log,
1297
- methodName: "notifyVCSBranchMergeCanceled",
1298
- payload: resp
1299
- });
1300
- return {
1301
- abortReason: resp.abortReason,
1302
- eventId: resp.eventId,
1303
- outcome: "aborted"
1304
- };
1305
- }
1306
- const result = resp.responseBody;
1307
- if (result.outcome === "success") {
1308
- log.info(`\u2705 [notifyVCSBranchMergeCanceled] Successfully notified the CI system that the merge was canceled.`);
1309
- return {
1310
- outcome: "success"
1311
- };
1312
- }
1313
- result.outcome;
1314
- return domainFailureToAbortResult({
1315
- log,
1316
- methodName: "notifyVCSBranchMergeCanceled",
1317
- result
1318
- });
1319
- }
1320
- __name(runNotifyVCSMergeCanceledOnce, "runNotifyVCSMergeCanceledOnce");
1321
- async function notifyVCSBranchMergeCanceled(deps, apiConfig, input) {
1322
- const { maxRetries = 10 } = input;
1323
- return retryWithExponentialBackoff({
1324
- log: deps.log,
1325
- maxRetries,
1326
- methodName: "notifyVCSBranchMergeCanceled",
1327
- retriableAbortReasons: [
1328
- "network-error",
1329
- "server-error"
1330
- ],
1331
- runOnce: /* @__PURE__ */ __name(() => runNotifyVCSMergeCanceledOnce(deps, apiConfig, input), "runOnce")
1332
- });
1333
- }
1334
- __name(notifyVCSBranchMergeCanceled, "notifyVCSBranchMergeCanceled");
1335
-
1336
- // src/lib/api/notify-vcs-branch-merge-completed-mutation.ts
1337
- var mutationName2 = "notifyVCSBranchMergeCompleted";
1338
- var mutationGql2 = `
1339
- mutation NotifyVCSBranchMergeCompleted($baseEnvironmentAlias: String, $headEnvironmentAlias: String!) {
1340
- ${mutationName2}(baseEnvironmentAlias: $baseEnvironmentAlias, headEnvironmentAlias: $headEnvironmentAlias) {
1341
- outcome
1342
- failureCode
1343
- failureDetails
1344
- }
1345
- }`;
1346
- async function callNotifyVCSBranchMergeCompletedMutation(deps, apiConfig, { baseEnvironmentAlias, headEnvironmentAlias }) {
1347
- return qawolfGraphql({
1348
- apiConfig,
1349
- deps,
1350
- name: mutationName2,
1351
- query: mutationGql2,
1352
- variables: {
1353
- baseEnvironmentAlias: baseEnvironmentAlias ?? null,
1354
- headEnvironmentAlias
1355
- }
1356
- });
1357
- }
1358
- __name(callNotifyVCSBranchMergeCompletedMutation, "callNotifyVCSBranchMergeCompletedMutation");
1359
-
1360
- // src/lib/sdk/domain/vcsBranchTesting/notify-vcs-branch-merge-completed.ts
1361
- async function runNotifyVCSBranchMergeCompletedOnce(deps, apiConfig, input) {
1362
- const log = deps.log;
1363
- const { baseEnvironmentsMapping, baseVcsBranch: vcsBaseBranch } = input;
1364
- const baseEnvironmentAlias = baseEnvironmentsMapping?.find((mapping) => mapping.vcsBranch === vcsBaseBranch)?.environmentAlias;
1365
- if (baseEnvironmentAlias === undefined) {
1366
- log.info(`\u2139\uFE0F [notifyVCSBranchMergeCompleted] Could not find a base environment for VCS branch '${vcsBaseBranch}'. Fall back to use the default base environment`);
1367
- }
1368
- const resp = await callNotifyVCSBranchMergeCompletedMutation(deps, apiConfig, {
1369
- baseEnvironmentAlias,
1370
- headEnvironmentAlias: input.headEnvironmentAlias
1371
- });
1372
- if (resp.isGqlError) {
1373
- logGraphQLError({
1374
- log,
1375
- methodName: "notifyVCSBranchMergeCompleted",
1376
- payload: resp
1377
- });
1378
- return {
1379
- abortReason: resp.abortReason,
1380
- eventId: resp.eventId,
1381
- outcome: "aborted"
1382
- };
1383
- }
1384
- const result = resp.responseBody;
1385
- if (result.outcome === "success") {
1386
- log.info(`\u2705 [notifyVCSBranchMergeCompleted] Successfully notified the CI system that the merge was completed.`);
1387
- return {
1388
- outcome: "success"
1389
- };
1390
- }
1391
- result.outcome;
1392
- return domainFailureToAbortResult({
1393
- log,
1394
- methodName: "notifyVCSBranchMergeCompleted",
1395
- result
1396
- });
1397
- }
1398
- __name(runNotifyVCSBranchMergeCompletedOnce, "runNotifyVCSBranchMergeCompletedOnce");
1399
- async function notifyVCSBranchMergeCompleted(deps, apiConfig, input) {
1400
- const { maxRetries = 10 } = input;
1401
- return retryWithExponentialBackoff({
1402
- log: deps.log,
1403
- maxRetries,
1404
- methodName: "notifyVCSBranchMergeCompleted",
1405
- retriableAbortReasons: [
1406
- "network-error",
1407
- "server-error"
1408
- ],
1409
- runOnce: /* @__PURE__ */ __name(() => runNotifyVCSBranchMergeCompletedOnce(deps, apiConfig, input), "runOnce")
1410
- });
1411
- }
1412
- __name(notifyVCSBranchMergeCompleted, "notifyVCSBranchMergeCompleted");
1413
-
1414
- // src/lib/api/notify-vcs-branch-build-deployed-mutation.ts
1415
- var mutationName3 = "notifyVCSBranchBuildDeployed";
1416
- var mutationGql3 = `
1417
- mutation NotifyVCSBranchBuildDeployed(
1418
- $headVcsCommitId: String!,
1419
- $baseVcsBranch: String,
1420
- $headEnvironmentVariablesJson: String!,
1421
- $baseEnvironmentAlias: String,
1422
- $headEnvironmentAlias: String!,
1423
- $concurrencyLimit: Int,
1424
- $headEnvironmentName: String,
1425
- $headVcsBranch: String,
1426
- $headVcsCommitUrl: String,
1427
- $pullOrMergeRequestNumber: Int
1428
- ) {
1429
- ${mutationName3}(
1430
- headVcsCommitId: $headVcsCommitId,
1431
- baseVcsBranch: $baseVcsBranch,
1432
- headEnvironmentVariablesJson: $headEnvironmentVariablesJson,
1433
- baseEnvironmentAlias: $baseEnvironmentAlias,
1434
- headEnvironmentAlias: $headEnvironmentAlias,
1435
- concurrencyLimit: $concurrencyLimit,
1436
- headEnvironmentName: $headEnvironmentName,
1437
- headVcsBranch: $headVcsBranch,
1438
- headVcsCommitUrl: $headVcsCommitUrl,
1439
- pullOrMergeRequestNumber: $pullOrMergeRequestNumber
1440
- ) {
1441
- outcome
1442
- codeHostingServiceInstallationPlatform
1443
- failureCode
1444
- failureDetails
1445
- runId
1446
- }
1447
- }`;
1448
- async function callNotifyVCSBranchBuildDeployedMutation(deps, apiConfig, { baseEnvironmentAlias, baseVcsBranch, concurrencyLimit, headEnvironmentAlias, headEnvironmentName, headEnvironmentVariables, headVcsBranch, headVcsCommitId, headVcsCommitUrl, pullOrMergeRequestNumber }) {
1449
- return qawolfGraphql({
1450
- apiConfig,
1451
- deps,
1452
- name: mutationName3,
1453
- query: mutationGql3,
1454
- variables: {
1455
- baseEnvironmentAlias: baseEnvironmentAlias ?? null,
1456
- baseVcsBranch: baseVcsBranch ?? null,
1457
- concurrencyLimit: concurrencyLimit ?? null,
1458
- headEnvironmentAlias,
1459
- headEnvironmentName,
1460
- headEnvironmentVariablesJson: JSON.stringify(headEnvironmentVariables),
1461
- headVcsBranch: headVcsBranch ?? null,
1462
- headVcsCommitId,
1463
- headVcsCommitUrl: headVcsCommitUrl ?? null,
1464
- pullOrMergeRequestNumber: pullOrMergeRequestNumber ?? null
1465
- }
1466
- });
1467
- }
1468
- __name(callNotifyVCSBranchBuildDeployedMutation, "callNotifyVCSBranchBuildDeployedMutation");
1469
-
1470
- // src/lib/sdk/domain/vcsBranchTesting/notifyVCSBranchBuildDeployed/index.ts
1471
- async function runNotifyVCSBranchBuildDeployedOnce(deps, apiConfig, input) {
1472
- const { baseEnvironmentsMapping, baseVcsBranch, concurrencyLimit, headEnvironmentAlias, headEnvironmentName, headEnvironmentVariables, headVcsBranch, headVcsCommitId, headVcsCommitUrl, pullOrMergeRequestNumber } = input;
1473
- const log = deps.log;
1474
- const baseEnvironmentAlias = baseEnvironmentsMapping?.find((mapping) => mapping.vcsBranch === baseVcsBranch)?.environmentAlias;
1475
- let finalConcurrencyLimit = concurrencyLimit;
1476
- if (typeof concurrencyLimit === "number") {
1477
- if (concurrencyLimit === Infinity) finalConcurrencyLimit = 0;
1478
- else if (Number.isNaN(concurrencyLimit) || !Number.isInteger(concurrencyLimit)) {
1479
- log.error(`\u274C [notifyVCSBranchBuildDeployed] Invalid concurrency limit '${concurrencyLimit}'. Must be a positive integer.`);
1480
- return {
1481
- abortReason: "invalid-input",
1482
- outcome: "aborted"
1483
- };
1484
- }
1485
- if (concurrencyLimit < 0) {
1486
- log.error(`\u274C [notifyVCSBranchBuildDeployed] Invalid concurrency limit '${concurrencyLimit}'. Must be a positive integer.`);
1487
- return {
1488
- abortReason: "invalid-input",
1489
- outcome: "aborted"
1490
- };
1491
- }
1492
- }
1493
- const resp = await callNotifyVCSBranchBuildDeployedMutation(deps, apiConfig, {
1494
- baseEnvironmentAlias,
1495
- baseVcsBranch,
1496
- concurrencyLimit: finalConcurrencyLimit,
1497
- headEnvironmentAlias,
1498
- headEnvironmentName,
1499
- headEnvironmentVariables,
1500
- headVcsBranch,
1501
- headVcsCommitId,
1502
- headVcsCommitUrl,
1503
- pullOrMergeRequestNumber
1504
- });
1505
- if (resp.isGqlError) {
1506
- logGraphQLError({
1507
- log,
1508
- methodName: "notifyVCSBranchBuildDeployed",
1509
- payload: resp
1510
- });
1511
- return {
1512
- abortReason: resp.abortReason,
1513
- eventId: resp.eventId,
1514
- outcome: "aborted"
1515
- };
1516
- }
1517
- const result = resp.responseBody;
1518
- if (result.outcome === "success") {
1519
- const codeHostingInfo = result.codeHostingServiceInstallationPlatform == null ? "" : `, and code hosting service integration '${result.codeHostingServiceInstallationPlatform}'.`;
1520
- log.info(`\u2705 [notifyVCSBranchBuildDeployed] Success. Run was deployed with ID: '${result.runId}'${codeHostingInfo}`);
1521
- return {
1522
- codeHostingServiceInstallationType: result.codeHostingServiceInstallationPlatform ?? undefined,
1523
- outcome: "success",
1524
- runId: result.runId
1525
- };
1526
- }
1527
- result.outcome;
1528
- return domainFailureToAbortResult({
1529
- log,
1530
- methodName: "notifyVCSBranchBuildDeployed",
1531
- result
1532
- });
1533
- }
1534
- __name(runNotifyVCSBranchBuildDeployedOnce, "runNotifyVCSBranchBuildDeployedOnce");
1535
- async function notifyVCSBranchBuildDeployed(deps, apiConfig, input) {
1536
- const { maxRetries = 10 } = input;
1537
- return retryWithExponentialBackoff({
1538
- log: deps.log,
1539
- maxRetries,
1540
- methodName: "notifyVCSBranchBuildDeployed",
1541
- retriableAbortReasons: [
1542
- "network-error",
1543
- "server-error",
1544
- "run-creation-failed"
1545
- ],
1546
- runOnce: /* @__PURE__ */ __name(() => runNotifyVCSBranchBuildDeployedOnce(deps, apiConfig, input), "runOnce")
1547
- });
1548
- }
1549
- __name(notifyVCSBranchBuildDeployed, "notifyVCSBranchBuildDeployed");
1550
- function pullRequestDetailsToEnvironmentAlias({ codeHostingServiceOrganization, codeHostingServiceRepositoryName, pullRequestIdentifier }) {
1551
- return arbitraryStringToEnvironmentAlias(`${codeHostingServiceOrganization}-${codeHostingServiceRepositoryName}-pr-${pullRequestIdentifier}`);
1552
- }
1553
- __name(pullRequestDetailsToEnvironmentAlias, "pullRequestDetailsToEnvironmentAlias");
1554
- function arbitraryStringToEnvironmentAlias(arbitraryString) {
1555
- return slugify__default.default(arbitraryString, {
1556
- lower: true
1557
- });
1558
- }
1559
- __name(arbitraryStringToEnvironmentAlias, "arbitraryStringToEnvironmentAlias");
1560
-
1561
- // src/lib/sdk/domain/vcsBranchTesting/index.ts
1562
- function makeVCSBranchTestingSDK({ apiKey, serviceBase = defaultServiceBase, userAgent = defaultUserAgent }, { fetch = defaultFetch, log = defaultLogDriver } = {}) {
1563
- const deps = {
1564
- fetch,
1565
- log
1566
- };
1567
- const apiConfig = {
1568
- apiKey,
1569
- serviceBase,
1570
- userAgent
1571
- };
1572
- return {
1573
- notifyVCSBranchBuildDeployed: notifyVCSBranchBuildDeployed.bind(null, deps, apiConfig),
1574
- notifyVCSBranchMergeCanceled: notifyVCSBranchMergeCanceled.bind(null, deps, apiConfig),
1575
- notifyVCSBranchMergeCompleted: notifyVCSBranchMergeCompleted.bind(null, deps, apiConfig)
1576
- };
1577
- }
1578
- __name(makeVCSBranchTestingSDK, "makeVCSBranchTestingSDK");
1579
-
1580
601
  // src/lib/sdk/index.ts
1581
602
  function makeQaWolfSdk({ apiKey, serviceBase = defaultServiceBase, userAgent = defaultUserAgent }, { fetch = defaultFetch, log = defaultLogDriver } = {}) {
1582
603
  if (typeof fetch !== "function") {
@@ -1584,8 +605,10 @@ function makeQaWolfSdk({ apiKey, serviceBase = defaultServiceBase, userAgent = d
1584
605
  We recommend 'undici' package for that purpose. See the Requirement section of our README for more guidance.`);
1585
606
  }
1586
607
  const deps = {
1587
- // Versions of fetch may have different default timeouts. For consistency, we explicitly set it to 60 seconds here.
1588
- fetch: buildFetchWithTimeout(fetch, 6e4),
608
+ // Versions of fetch may have different default timeouts. For consistency, we explicitly set it to 2 minutes here.
609
+ // The increased timeout helps avoid edge cases where we need to search for a commit against multiple
610
+ // code hosting service repositories as a fallback when not finding the repository based on organization/name.
611
+ fetch: buildFetchWithTimeout(fetch, 12e4),
1589
612
  log
1590
613
  };
1591
614
  const apiConfig = {
@@ -1595,15 +618,6 @@ We recommend 'undici' package for that purpose. See the Requirement section of o
1595
618
  };
1596
619
  return {
1597
620
  attemptNotifyDeploy: attemptNotifyDeploy.bind(null, deps, apiConfig),
1598
- /**
1599
- * @deprecated Use `experimental_vcsBranchTesting` instead.
1600
- */
1601
- experimental_removeEnvironment: removeEnvironment.bind(null, deps, apiConfig),
1602
- /**
1603
- * @deprecated Use `experimental_vcsBranchTesting` instead.
1604
- */
1605
- experimental_testPreview: testPreview.bind(null, deps, apiConfig),
1606
- experimental_vcsBranchTesting: makeVCSBranchTestingSDK(apiConfig, deps),
1607
621
  generateSignedUrlForRunInputsExecutablesStorage: generateSignedUrlForRunInputsExecutablesStorage.bind(null, deps, apiConfig),
1608
622
  generateSignedUrlForTempTeamStorage: generateSignedUrlForTempTeamStorage.bind(null, deps, apiConfig),
1609
623
  pollCiGreenlightStatus: pollCiGreenlightStatus.bind(null, deps, apiConfig)
@@ -1611,9 +625,6 @@ We recommend 'undici' package for that purpose. See the Requirement section of o
1611
625
  }
1612
626
  __name(makeQaWolfSdk, "makeQaWolfSdk");
1613
627
 
1614
- exports.arbitraryStringToEnvironmentAlias = arbitraryStringToEnvironmentAlias;
1615
- exports.makeQaWolfSdk = makeQaWolfSdk;
1616
- exports.makeVCSBranchTestingSDK = makeVCSBranchTestingSDK;
1617
- exports.pullRequestDetailsToEnvironmentAlias = pullRequestDetailsToEnvironmentAlias;
628
+ export { makeQaWolfSdk };
1618
629
  //# sourceMappingURL=index.js.map
1619
630
  //# sourceMappingURL=index.js.map