declastruct-github 1.0.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.
Files changed (138) hide show
  1. package/LICENSE +21 -0
  2. package/dist/.test/assets/getSampleGithubContext.d.ts +6 -0
  3. package/dist/.test/assets/getSampleGithubContext.js +18 -0
  4. package/dist/.test/assets/getSampleGithubContext.js.map +1 -0
  5. package/dist/.test/assets/getSampleRepo.d.ts +9 -0
  6. package/dist/.test/assets/getSampleRepo.js +19 -0
  7. package/dist/.test/assets/getSampleRepo.js.map +1 -0
  8. package/dist/access/daos/DeclaredGithubBranchDao.d.ts +10 -0
  9. package/dist/access/daos/DeclaredGithubBranchDao.js +35 -0
  10. package/dist/access/daos/DeclaredGithubBranchDao.js.map +1 -0
  11. package/dist/access/daos/DeclaredGithubBranchProtectionDao.d.ts +9 -0
  12. package/dist/access/daos/DeclaredGithubBranchProtectionDao.js +34 -0
  13. package/dist/access/daos/DeclaredGithubBranchProtectionDao.js.map +1 -0
  14. package/dist/access/daos/DeclaredGithubRepoConfigDao.d.ts +9 -0
  15. package/dist/access/daos/DeclaredGithubRepoConfigDao.js +34 -0
  16. package/dist/access/daos/DeclaredGithubRepoConfigDao.js.map +1 -0
  17. package/dist/access/daos/DeclaredGithubRepoDao.d.ts +9 -0
  18. package/dist/access/daos/DeclaredGithubRepoDao.js +34 -0
  19. package/dist/access/daos/DeclaredGithubRepoDao.js.map +1 -0
  20. package/dist/access/sdks/getGithubClient.d.ts +8 -0
  21. package/dist/access/sdks/getGithubClient.js +22 -0
  22. package/dist/access/sdks/getGithubClient.js.map +1 -0
  23. package/dist/contract/sdks/declastruct.acceptance.test.d.ts +1 -0
  24. package/dist/contract/sdks/declastruct.acceptance.test.js +104 -0
  25. package/dist/contract/sdks/declastruct.acceptance.test.js.map +1 -0
  26. package/dist/contract/sdks/index.d.ts +10 -0
  27. package/dist/contract/sdks/index.js +20 -0
  28. package/dist/contract/sdks/index.js.map +1 -0
  29. package/dist/domain.objects/ContextGithubApi.d.ts +9 -0
  30. package/dist/domain.objects/ContextGithubApi.js +3 -0
  31. package/dist/domain.objects/ContextGithubApi.js.map +1 -0
  32. package/dist/domain.objects/DeclaredGithubBranch.d.ts +39 -0
  33. package/dist/domain.objects/DeclaredGithubBranch.js +12 -0
  34. package/dist/domain.objects/DeclaredGithubBranch.js.map +1 -0
  35. package/dist/domain.objects/DeclaredGithubBranchProtection.d.ts +108 -0
  36. package/dist/domain.objects/DeclaredGithubBranchProtection.js +12 -0
  37. package/dist/domain.objects/DeclaredGithubBranchProtection.js.map +1 -0
  38. package/dist/domain.objects/DeclaredGithubRepo.d.ts +57 -0
  39. package/dist/domain.objects/DeclaredGithubRepo.js +9 -0
  40. package/dist/domain.objects/DeclaredGithubRepo.js.map +1 -0
  41. package/dist/domain.objects/DeclaredGithubRepoConfig.d.ts +100 -0
  42. package/dist/domain.objects/DeclaredGithubRepoConfig.js +12 -0
  43. package/dist/domain.objects/DeclaredGithubRepoConfig.js.map +1 -0
  44. package/dist/domain.objects/DeclastructGithubProvider.d.ts +17 -0
  45. package/dist/domain.objects/DeclastructGithubProvider.js +3 -0
  46. package/dist/domain.objects/DeclastructGithubProvider.js.map +1 -0
  47. package/dist/domain.operations/branch/castToDeclaredGithubBranch.d.ts +15 -0
  48. package/dist/domain.operations/branch/castToDeclaredGithubBranch.js +39 -0
  49. package/dist/domain.operations/branch/castToDeclaredGithubBranch.js.map +1 -0
  50. package/dist/domain.operations/branch/getBranch.d.ts +14 -0
  51. package/dist/domain.operations/branch/getBranch.integration.test.d.ts +1 -0
  52. package/dist/domain.operations/branch/getBranch.integration.test.js +59 -0
  53. package/dist/domain.operations/branch/getBranch.integration.test.js.map +1 -0
  54. package/dist/domain.operations/branch/getBranch.js +50 -0
  55. package/dist/domain.operations/branch/getBranch.js.map +1 -0
  56. package/dist/domain.operations/branch/getBranchCommitShaByRepoDefault.d.ts +11 -0
  57. package/dist/domain.operations/branch/getBranchCommitShaByRepoDefault.js +37 -0
  58. package/dist/domain.operations/branch/getBranchCommitShaByRepoDefault.js.map +1 -0
  59. package/dist/domain.operations/branch/getBranches.d.ts +23 -0
  60. package/dist/domain.operations/branch/getBranches.integration.test.d.ts +1 -0
  61. package/dist/domain.operations/branch/getBranches.integration.test.js +40 -0
  62. package/dist/domain.operations/branch/getBranches.integration.test.js.map +1 -0
  63. package/dist/domain.operations/branch/getBranches.js +33 -0
  64. package/dist/domain.operations/branch/getBranches.js.map +1 -0
  65. package/dist/domain.operations/branch/setBranch.d.ts +12 -0
  66. package/dist/domain.operations/branch/setBranch.integration.test.d.ts +1 -0
  67. package/dist/domain.operations/branch/setBranch.integration.test.js +65 -0
  68. package/dist/domain.operations/branch/setBranch.integration.test.js.map +1 -0
  69. package/dist/domain.operations/branch/setBranch.js +100 -0
  70. package/dist/domain.operations/branch/setBranch.js.map +1 -0
  71. package/dist/domain.operations/branch/setBranch.test.d.ts +1 -0
  72. package/dist/domain.operations/branch/setBranch.test.js +151 -0
  73. package/dist/domain.operations/branch/setBranch.test.js.map +1 -0
  74. package/dist/domain.operations/branchProtection/castToDeclaredGithubBranchProtection.d.ts +14 -0
  75. package/dist/domain.operations/branchProtection/castToDeclaredGithubBranchProtection.js +66 -0
  76. package/dist/domain.operations/branchProtection/castToDeclaredGithubBranchProtection.js.map +1 -0
  77. package/dist/domain.operations/branchProtection/getBranchProtection.d.ts +14 -0
  78. package/dist/domain.operations/branchProtection/getBranchProtection.integration.test.d.ts +1 -0
  79. package/dist/domain.operations/branchProtection/getBranchProtection.integration.test.js +63 -0
  80. package/dist/domain.operations/branchProtection/getBranchProtection.integration.test.js.map +1 -0
  81. package/dist/domain.operations/branchProtection/getBranchProtection.js +53 -0
  82. package/dist/domain.operations/branchProtection/getBranchProtection.js.map +1 -0
  83. package/dist/domain.operations/branchProtection/setBranchProtection.d.ts +12 -0
  84. package/dist/domain.operations/branchProtection/setBranchProtection.integration.test.d.ts +1 -0
  85. package/dist/domain.operations/branchProtection/setBranchProtection.integration.test.js +96 -0
  86. package/dist/domain.operations/branchProtection/setBranchProtection.integration.test.js.map +1 -0
  87. package/dist/domain.operations/branchProtection/setBranchProtection.js +90 -0
  88. package/dist/domain.operations/branchProtection/setBranchProtection.js.map +1 -0
  89. package/dist/domain.operations/branchProtection/setBranchProtection.test.d.ts +1 -0
  90. package/dist/domain.operations/branchProtection/setBranchProtection.test.js +173 -0
  91. package/dist/domain.operations/branchProtection/setBranchProtection.test.js.map +1 -0
  92. package/dist/domain.operations/provider/getDeclastructGithubProvider.d.ts +11 -0
  93. package/dist/domain.operations/provider/getDeclastructGithubProvider.integration.test.d.ts +1 -0
  94. package/dist/domain.operations/provider/getDeclastructGithubProvider.integration.test.js +212 -0
  95. package/dist/domain.operations/provider/getDeclastructGithubProvider.integration.test.js.map +1 -0
  96. package/dist/domain.operations/provider/getDeclastructGithubProvider.js +44 -0
  97. package/dist/domain.operations/provider/getDeclastructGithubProvider.js.map +1 -0
  98. package/dist/domain.operations/repo/castToDeclaredGithubRepo.d.ts +10 -0
  99. package/dist/domain.operations/repo/castToDeclaredGithubRepo.js +42 -0
  100. package/dist/domain.operations/repo/castToDeclaredGithubRepo.js.map +1 -0
  101. package/dist/domain.operations/repo/getRepo.d.ts +14 -0
  102. package/dist/domain.operations/repo/getRepo.integration.test.d.ts +1 -0
  103. package/dist/domain.operations/repo/getRepo.integration.test.js +45 -0
  104. package/dist/domain.operations/repo/getRepo.integration.test.js.map +1 -0
  105. package/dist/domain.operations/repo/getRepo.js +38 -0
  106. package/dist/domain.operations/repo/getRepo.js.map +1 -0
  107. package/dist/domain.operations/repo/getRepos.d.ts +21 -0
  108. package/dist/domain.operations/repo/getRepos.integration.test.d.ts +1 -0
  109. package/dist/domain.operations/repo/getRepos.integration.test.js +28 -0
  110. package/dist/domain.operations/repo/getRepos.integration.test.js.map +1 -0
  111. package/dist/domain.operations/repo/getRepos.js +41 -0
  112. package/dist/domain.operations/repo/getRepos.js.map +1 -0
  113. package/dist/domain.operations/repo/setRepo.d.ts +12 -0
  114. package/dist/domain.operations/repo/setRepo.integration.test.d.ts +1 -0
  115. package/dist/domain.operations/repo/setRepo.integration.test.js +29 -0
  116. package/dist/domain.operations/repo/setRepo.integration.test.js.map +1 -0
  117. package/dist/domain.operations/repo/setRepo.js +70 -0
  118. package/dist/domain.operations/repo/setRepo.js.map +1 -0
  119. package/dist/domain.operations/repo/setRepo.test.d.ts +1 -0
  120. package/dist/domain.operations/repo/setRepo.test.js +150 -0
  121. package/dist/domain.operations/repo/setRepo.test.js.map +1 -0
  122. package/dist/domain.operations/repoConfig/castToDeclaredGithubRepoConfig.d.ts +15 -0
  123. package/dist/domain.operations/repoConfig/castToDeclaredGithubRepoConfig.js +36 -0
  124. package/dist/domain.operations/repoConfig/castToDeclaredGithubRepoConfig.js.map +1 -0
  125. package/dist/domain.operations/repoConfig/getRepoConfig.d.ts +14 -0
  126. package/dist/domain.operations/repoConfig/getRepoConfig.integration.test.d.ts +1 -0
  127. package/dist/domain.operations/repoConfig/getRepoConfig.integration.test.js +55 -0
  128. package/dist/domain.operations/repoConfig/getRepoConfig.integration.test.js.map +1 -0
  129. package/dist/domain.operations/repoConfig/getRepoConfig.js +47 -0
  130. package/dist/domain.operations/repoConfig/getRepoConfig.js.map +1 -0
  131. package/dist/domain.operations/repoConfig/setRepoConfig.d.ts +12 -0
  132. package/dist/domain.operations/repoConfig/setRepoConfig.integration.test.d.ts +1 -0
  133. package/dist/domain.operations/repoConfig/setRepoConfig.integration.test.js +87 -0
  134. package/dist/domain.operations/repoConfig/setRepoConfig.integration.test.js.map +1 -0
  135. package/dist/domain.operations/repoConfig/setRepoConfig.js +65 -0
  136. package/dist/domain.operations/repoConfig/setRepoConfig.js.map +1 -0
  137. package/package.json +104 -0
  138. package/readme.md +181 -0
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBranchProtection = void 0;
4
+ const as_procedure_1 = require("as-procedure");
5
+ const helpful_errors_1 = require("helpful-errors");
6
+ const getGithubClient_1 = require("../../access/sdks/getGithubClient");
7
+ const castToDeclaredGithubBranchProtection_1 = require("./castToDeclaredGithubBranchProtection");
8
+ /**
9
+ * .what = gets a GitHub branch's protection rules
10
+ * .why = retrieves current protection state from GitHub API for declarative management
11
+ */
12
+ exports.getBranchProtection = (0, as_procedure_1.asProcedure)(async (input, context) => {
13
+ // get cached GitHub client
14
+ const github = (0, getGithubClient_1.getGithubClient)({}, context);
15
+ // determine owner, repo, and branch name from input
16
+ const { branch } = (() => {
17
+ if (input.by.unique) {
18
+ return {
19
+ branch: input.by.unique.branch,
20
+ };
21
+ }
22
+ helpful_errors_1.UnexpectedCodePathError.throw('not referenced by unique. how not?', {
23
+ input,
24
+ });
25
+ })();
26
+ // execute the GitHub API call
27
+ try {
28
+ const branchRef = branch;
29
+ const response = await github.repos.getBranchProtection({
30
+ owner: branchRef.repo.owner,
31
+ repo: branchRef.repo.name,
32
+ branch: branchRef.name,
33
+ });
34
+ return (0, castToDeclaredGithubBranchProtection_1.castToDeclaredGithubBranchProtection)({
35
+ response: response.data,
36
+ branch,
37
+ });
38
+ }
39
+ catch (error) {
40
+ if (!(error instanceof Error))
41
+ throw error;
42
+ // return null for 404/not found (no protection exists)
43
+ if (error.message.includes('Not Found') ||
44
+ error.message.includes('Branch not protected') ||
45
+ error.message.includes('Branch not found'))
46
+ return null;
47
+ // throw helpful error for all other failures
48
+ throw new helpful_errors_1.HelpfulError('github.getBranchProtection error', {
49
+ cause: error,
50
+ });
51
+ }
52
+ });
53
+ //# sourceMappingURL=getBranchProtection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getBranchProtection.js","sourceRoot":"","sources":["../../../src/domain.operations/branchProtection/getBranchProtection.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,mDAAuE;AAIvE,uEAAoE;AAGpE,iGAA8F;AAE9F;;;GAGG;AACU,QAAA,mBAAmB,GAAG,IAAA,0BAAW,EAC5C,KAA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;YACzD,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CACF,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { HasMetadata, PickOne } from 'type-fns';
2
+ import { VisualogicContext } from 'visualogic';
3
+ import { ContextGithubApi } from '../../domain.objects/ContextGithubApi';
4
+ import { DeclaredGithubBranchProtection } from '../../domain.objects/DeclaredGithubBranchProtection';
5
+ /**
6
+ * .what = sets a GitHub branch's protection rules: upsert or finsert
7
+ * .why = enables declarative updates of branch protection following declastruct patterns
8
+ */
9
+ export declare const setBranchProtection: (input: PickOne<{
10
+ finsert: DeclaredGithubBranchProtection;
11
+ upsert: DeclaredGithubBranchProtection;
12
+ }>, context: ContextGithubApi & VisualogicContext) => Promise<HasMetadata<DeclaredGithubBranchProtection>>;
@@ -0,0 +1,96 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const getSampleGithubContext_1 = require("../../.test/assets/getSampleGithubContext");
4
+ const getSampleRepo_1 = require("../../.test/assets/getSampleRepo");
5
+ const getBranchProtection_1 = require("./getBranchProtection");
6
+ const setBranchProtection_1 = require("./setBranchProtection");
7
+ const log = console;
8
+ describe('setBranchProtection', () => {
9
+ const context = { log, ...(0, getSampleGithubContext_1.getSampleGithubContext)() };
10
+ describe('live tests', () => {
11
+ it('should update branch protection rules', async () => {
12
+ const sampleRepo = (0, getSampleRepo_1.getSampleRepo)({
13
+ owner: 'ehmpathy',
14
+ name: 'declastruct-github-demo',
15
+ });
16
+ // Get current protection (if any)
17
+ const currentProtection = await (0, getBranchProtection_1.getBranchProtection)({
18
+ by: {
19
+ unique: {
20
+ branch: {
21
+ repo: {
22
+ owner: sampleRepo.owner,
23
+ name: sampleRepo.name,
24
+ },
25
+ name: 'main',
26
+ },
27
+ },
28
+ },
29
+ }, context);
30
+ console.log('Current protection:', currentProtection);
31
+ // Update protection with upsert
32
+ const result = await (0, setBranchProtection_1.setBranchProtection)({
33
+ upsert: {
34
+ branch: {
35
+ repo: { owner: sampleRepo.owner, name: sampleRepo.name },
36
+ name: 'main',
37
+ },
38
+ enforceAdmins: false,
39
+ allowsDeletions: false,
40
+ allowsForcePushes: false,
41
+ requireLinearHistory: false,
42
+ requiredStatusChecks: null,
43
+ requiredPullRequestReviews: {
44
+ requiredApprovingReviewCount: 1,
45
+ },
46
+ restrictions: null,
47
+ },
48
+ }, context);
49
+ expect(result).toBeDefined();
50
+ expect(result.branch.repo.owner).toBe(sampleRepo.owner);
51
+ expect(result.branch.repo.name).toBe(sampleRepo.name);
52
+ expect(result.branch.name).toBe('main');
53
+ });
54
+ it('should return existing protection for finsert', async () => {
55
+ const sampleRepo = (0, getSampleRepo_1.getSampleRepo)({
56
+ owner: 'ehmpathy',
57
+ name: 'declastruct-github-demo',
58
+ });
59
+ // Get current protection
60
+ const currentProtection = await (0, getBranchProtection_1.getBranchProtection)({
61
+ by: {
62
+ unique: {
63
+ branch: {
64
+ repo: {
65
+ owner: sampleRepo.owner,
66
+ name: sampleRepo.name,
67
+ },
68
+ name: 'main',
69
+ },
70
+ },
71
+ },
72
+ }, context);
73
+ // Only run finsert test if protection exists
74
+ if (currentProtection) {
75
+ // Finsert should return existing protection without making changes
76
+ const result = await (0, setBranchProtection_1.setBranchProtection)({
77
+ finsert: {
78
+ branch: {
79
+ repo: { owner: sampleRepo.owner, name: sampleRepo.name },
80
+ name: 'main',
81
+ },
82
+ enforceAdmins: true,
83
+ allowsDeletions: true,
84
+ allowsForcePushes: true,
85
+ requireLinearHistory: true,
86
+ },
87
+ }, context);
88
+ expect(result).toBeDefined();
89
+ expect(result.branch.name).toBe('main');
90
+ // Should match current protection, not the finsert values
91
+ expect(result).toEqual(currentProtection);
92
+ }
93
+ });
94
+ });
95
+ });
96
+ //# sourceMappingURL=setBranchProtection.integration.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setBranchProtection.integration.test.js","sourceRoot":"","sources":["../../../src/domain.operations/branchProtection/setBranchProtection.integration.test.ts"],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AAI;wBACrB,iBAAiB,EAAE,IAAI;wBACvB,oBAAoB,EAAE,IAAI;qBAC3B;iBACF,EACD,OAAO,CACR,CAAC;gBAEF,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;gBAC7B,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACxC,0DAA0D;gBAC1D,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,iBAAiB,CAAC,CAAC;YAC5C,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setBranchProtection = void 0;
4
+ const as_procedure_1 = require("as-procedure");
5
+ const helpful_errors_1 = require("helpful-errors");
6
+ const getGithubClient_1 = require("../../access/sdks/getGithubClient");
7
+ const castToDeclaredGithubBranchProtection_1 = require("./castToDeclaredGithubBranchProtection");
8
+ const getBranchProtection_1 = require("./getBranchProtection");
9
+ /**
10
+ * .what = sets a GitHub branch's protection rules: upsert or finsert
11
+ * .why = enables declarative updates of branch protection following declastruct patterns
12
+ */
13
+ exports.setBranchProtection = (0, as_procedure_1.asProcedure)(async (input, context) => {
14
+ const desired = input.finsert ?? input.upsert;
15
+ // get cached GitHub client
16
+ const github = (0, getGithubClient_1.getGithubClient)({}, context);
17
+ // check whether it already exists
18
+ const before = await (0, getBranchProtection_1.getBranchProtection)({
19
+ by: {
20
+ unique: {
21
+ branch: desired.branch,
22
+ },
23
+ },
24
+ }, context);
25
+ // if it's a finsert and had a before, then return that
26
+ if (before && input.finsert)
27
+ return before;
28
+ // update the branch protection (always use update since protection is part of branch, not a separate resource)
29
+ try {
30
+ const branchRef = desired.branch;
31
+ const updated = await github.repos.updateBranchProtection({
32
+ owner: branchRef.repo.owner,
33
+ repo: branchRef.repo.name,
34
+ branch: branchRef.name,
35
+ enforce_admins: desired.enforceAdmins ?? null,
36
+ allow_deletions: desired.allowsDeletions,
37
+ allow_force_pushes: desired.allowsForcePushes,
38
+ required_linear_history: desired.requireLinearHistory,
39
+ block_creations: desired.blockCreations,
40
+ lock_branch: desired.lockBranch,
41
+ allow_fork_syncing: desired.allowForkSyncing,
42
+ required_status_checks: desired.requiredStatusChecks
43
+ ? {
44
+ strict: desired.requiredStatusChecks.strict,
45
+ contexts: desired.requiredStatusChecks.contexts,
46
+ }
47
+ : null,
48
+ required_pull_request_reviews: desired.requiredPullRequestReviews
49
+ ? {
50
+ dismiss_stale_reviews: desired.requiredPullRequestReviews.dismissStaleReviews ?? false,
51
+ require_code_owner_reviews: desired.requiredPullRequestReviews.requireCodeOwnerReviews ??
52
+ false,
53
+ required_approving_review_count: desired.requiredPullRequestReviews
54
+ .requiredApprovingReviewCount ?? 1,
55
+ dismissal_restrictions: desired.requiredPullRequestReviews
56
+ .dismissalRestrictions
57
+ ? {
58
+ users: desired.requiredPullRequestReviews.dismissalRestrictions
59
+ .users,
60
+ teams: desired.requiredPullRequestReviews.dismissalRestrictions
61
+ .teams,
62
+ apps: desired.requiredPullRequestReviews
63
+ .dismissalRestrictions.apps,
64
+ }
65
+ : undefined,
66
+ }
67
+ : null,
68
+ restrictions: desired.restrictions
69
+ ? {
70
+ users: desired.restrictions.users ?? [],
71
+ teams: desired.restrictions.teams ?? [],
72
+ apps: desired.restrictions.apps ?? [],
73
+ }
74
+ : null,
75
+ required_conversation_resolution: desired.requiredConversationResolution,
76
+ });
77
+ return (0, castToDeclaredGithubBranchProtection_1.castToDeclaredGithubBranchProtection)({
78
+ response: updated.data,
79
+ branch: desired.branch,
80
+ });
81
+ }
82
+ catch (error) {
83
+ if (!(error instanceof Error))
84
+ throw error;
85
+ throw new helpful_errors_1.HelpfulError('github.setBranchProtection.update error', {
86
+ cause: error,
87
+ });
88
+ }
89
+ });
90
+ //# sourceMappingURL=setBranchProtection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setBranchProtection.js","sourceRoot":"","sources":["../../../src/domain.operations/branchProtection/setBranchProtection.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,mDAA8C;AAI9C,uEAAoE;AAGpE,iGAGgD;AAChD,+DAA4D;AAE5D;;;GAGG;AACU,QAAA,mBAAmB,GAAG,IAAA,0BAAW,EAC5C,KAAK,EACH,KAGE,EACF,OAA6C,EACS,EAAE;IACxD,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC;IAE9C,2BAA2B;IAC3B,MAAM,MAAM,GAAG,IAAA,iCAAe,EAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAE5C,kCAAkC;IAClC,MAAM,MAAM,GAAG,MAAM,IAAA,yCAAmB,EACtC;QACE,EAAE,EAAE;YACF,MAAM,EAAE;gBACN,MAAM,EAAE,OAAO,CAAC,MAAM;aACvB;SACF;KACF,EACD,OAAO,CACR,CAAC;IAEF,uDAAuD;IACvD,IAAI,MAAM,IAAI,KAAK,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC;IAE3C,+GAA+G;IAC/G,IAAI,CAAC;QACH,MAAM,SAAS,GAAG,OAAO,CAAC,MAGzB,CAAC;QACF,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,KAAK,CAAC,sBAAsB,CAAC;YACxD,KAAK,EAAE,SAAS,CAAC,IAAI,CAAC,KAAK;YAC3B,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC,IAAI;YACzB,MAAM,EAAE,SAAS,CAAC,IAAI;YACtB,cAAc,EAAE,OAAO,CAAC,aAAa,IAAI,IAAI;YAC7C,eAAe,EAAE,OAAO,CAAC,eAAe;YACxC,kBAAkB,EAAE,OAAO,CAAC,iBAAiB;YAC7C,uBAAuB,EAAE,OAAO,CAAC,oBAAoB;YACrD,eAAe,EAAE,OAAO,CAAC,cAAc;YACvC,WAAW,EAAE,OAAO,CAAC,UAAU;YAC/B,kBAAkB,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xD,MAAM,EAAE,OAAO,CAAC,MAAM;SACvB,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;YAAE,MAAM,KAAK,CAAC;QAC3C,MAAM,IAAI,6BAAY,CAAC,yCAAyC,EAAE;YAChE,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CACF,CAAC"}
@@ -0,0 +1,173 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ const castModule = __importStar(require("./castToDeclaredGithubBranchProtection"));
27
+ const getBranchProtectionModule = __importStar(require("./getBranchProtection"));
28
+ // create mock functions first
29
+ const mockUpdateBranchProtection = jest.fn();
30
+ jest.mock('../../access/sdks/getGithubClient', () => ({
31
+ getGithubClient: jest.fn(() => ({
32
+ repos: {
33
+ updateBranchProtection: mockUpdateBranchProtection,
34
+ },
35
+ })),
36
+ }));
37
+ jest.mock('./castToDeclaredGithubBranchProtection');
38
+ jest.mock('./getBranchProtection');
39
+ const { setBranchProtection } = require('./setBranchProtection');
40
+ const context = {
41
+ github: { token: 'test-token' },
42
+ log: console,
43
+ };
44
+ const protectionSample = {
45
+ branch: {
46
+ repo: { owner: 'test-owner', name: 'test-repo' },
47
+ name: 'main',
48
+ },
49
+ enforceAdmins: true,
50
+ allowsDeletions: false,
51
+ allowsForcePushes: false,
52
+ requireLinearHistory: true,
53
+ requiredStatusChecks: {
54
+ strict: true,
55
+ contexts: ['ci/test'],
56
+ },
57
+ requiredPullRequestReviews: {
58
+ requiredApprovingReviewCount: 1,
59
+ dismissStaleReviews: true,
60
+ },
61
+ restrictions: null,
62
+ };
63
+ describe('setBranchProtection', () => {
64
+ beforeEach(() => {
65
+ jest.clearAllMocks();
66
+ });
67
+ it('returns early for finsert if protection already exists (before)', async () => {
68
+ const before = { ...protectionSample };
69
+ getBranchProtectionModule.getBranchProtection.mockResolvedValue(before);
70
+ const result = await setBranchProtection({ finsert: protectionSample }, context);
71
+ expect(result).toBe(before);
72
+ expect(getBranchProtectionModule.getBranchProtection).toHaveBeenCalled();
73
+ expect(mockUpdateBranchProtection).not.toHaveBeenCalled();
74
+ });
75
+ it('updates protection if upsert and protection exists (before)', async () => {
76
+ const before = { ...protectionSample };
77
+ getBranchProtectionModule.getBranchProtection.mockResolvedValue(before);
78
+ const updatedProtectionResponse = {
79
+ enforce_admins: { enabled: true },
80
+ allow_deletions: { enabled: false },
81
+ allow_force_pushes: { enabled: false },
82
+ required_linear_history: { enabled: true },
83
+ required_status_checks: {
84
+ strict: true,
85
+ contexts: ['ci/test'],
86
+ },
87
+ required_pull_request_reviews: {
88
+ required_approving_review_count: 1,
89
+ dismiss_stale_reviews: true,
90
+ },
91
+ };
92
+ mockUpdateBranchProtection.mockResolvedValue({
93
+ data: updatedProtectionResponse,
94
+ });
95
+ castModule.castToDeclaredGithubBranchProtection.mockReturnValue(protectionSample);
96
+ const result = await setBranchProtection({ upsert: protectionSample }, context);
97
+ expect(getBranchProtectionModule.getBranchProtection).toHaveBeenCalled();
98
+ expect(mockUpdateBranchProtection).toHaveBeenCalledWith({
99
+ owner: 'test-owner',
100
+ repo: 'test-repo',
101
+ branch: 'main',
102
+ enforce_admins: true,
103
+ allow_deletions: false,
104
+ allow_force_pushes: false,
105
+ required_linear_history: true,
106
+ block_creations: undefined,
107
+ lock_branch: undefined,
108
+ allow_fork_syncing: undefined,
109
+ required_status_checks: {
110
+ strict: true,
111
+ contexts: ['ci/test'],
112
+ },
113
+ required_pull_request_reviews: {
114
+ dismiss_stale_reviews: true,
115
+ require_code_owner_reviews: false,
116
+ required_approving_review_count: 1,
117
+ dismissal_restrictions: undefined,
118
+ },
119
+ restrictions: null,
120
+ required_conversation_resolution: undefined,
121
+ });
122
+ expect(result.branch.name).toEqual('main');
123
+ });
124
+ it('creates (updates) protection if protection does not exist (before = null)', async () => {
125
+ getBranchProtectionModule.getBranchProtection.mockResolvedValue(null);
126
+ const updatedProtectionResponse = {
127
+ enforce_admins: { enabled: true },
128
+ allow_deletions: { enabled: false },
129
+ allow_force_pushes: { enabled: false },
130
+ required_linear_history: { enabled: true },
131
+ required_status_checks: {
132
+ strict: true,
133
+ contexts: ['ci/test'],
134
+ },
135
+ required_pull_request_reviews: {
136
+ required_approving_review_count: 1,
137
+ dismiss_stale_reviews: true,
138
+ },
139
+ };
140
+ mockUpdateBranchProtection.mockResolvedValue({
141
+ data: updatedProtectionResponse,
142
+ });
143
+ castModule.castToDeclaredGithubBranchProtection.mockReturnValue(protectionSample);
144
+ const result = await setBranchProtection({ finsert: protectionSample }, context);
145
+ expect(getBranchProtectionModule.getBranchProtection).toHaveBeenCalled();
146
+ expect(mockUpdateBranchProtection).toHaveBeenCalledWith({
147
+ owner: 'test-owner',
148
+ repo: 'test-repo',
149
+ branch: 'main',
150
+ enforce_admins: true,
151
+ allow_deletions: false,
152
+ allow_force_pushes: false,
153
+ required_linear_history: true,
154
+ block_creations: undefined,
155
+ lock_branch: undefined,
156
+ allow_fork_syncing: undefined,
157
+ required_status_checks: {
158
+ strict: true,
159
+ contexts: ['ci/test'],
160
+ },
161
+ required_pull_request_reviews: {
162
+ dismiss_stale_reviews: true,
163
+ require_code_owner_reviews: false,
164
+ required_approving_review_count: 1,
165
+ dismissal_restrictions: undefined,
166
+ },
167
+ restrictions: null,
168
+ required_conversation_resolution: undefined,
169
+ });
170
+ expect(result.branch.name).toEqual('main');
171
+ });
172
+ });
173
+ //# sourceMappingURL=setBranchProtection.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setBranchProtection.test.js","sourceRoot":"","sources":["../../../src/domain.operations/branchProtection/setBranchProtection.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mFAAqE;AACrE,iFAAmE;AAEnE,8BAA8B;AAC9B,MAAM,0BAA0B,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;AAE7C,IAAI,CAAC,IAAI,CAAC,mCAAmC,EAAE,GAAG,EAAE,CAAC,CAAC;IACpD,eAAe,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC;QAC9B,KAAK,EAAE;YACL,sBAAsB,EAAE,0BAA0B;SACnD;KACF,CAAC,CAAC;CACJ,CAAC,CAAC,CAAC;AAEJ,IAAI,CAAC,IAAI,CAAC,wCAAwC,CAAC,CAAC;AACpD,IAAI,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;AAEnC,MAAM,EAAE,mBAAmB,EAAE,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAAC;AAEjE,MAAM,OAAO,GAAyC;IACpD,MAAM,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE;IAC/B,GAAG,EAAE,OAAO;CACb,CAAC;AAEF,MAAM,gBAAgB,GAAmC;IACvD,MAAM,EAAE;QACN,IAAI,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,WAAW,EAAE;QA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AS;YAC1B,WAAW,EAAE,SAAS;YACtB,kBAAkB,EAAE,SAAS;YAC7B,sBAAsB,EAAE;gBACtB,MAAM,EAAE,IAAI;gBACZ,QAAQ,EAAE,CAAC,SAAS,CAAC;aACtB;YACD,6BAA6B,EAAE;gBAC7B,qBAAqB,EAAE,IAAI;gBAC3B,0BAA0B,EAAE,KAAK;gBACjC,+BAA+B,EAAE,CAAC;gBAClC,sBAAsB,EAAE,SAAS;aAClC;YACD,YAAY,EAAE,IAAI;YAClB,gCAAgC,EAAE,SAAS;SAC5C,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ import type { ContextLogTrail } from 'simple-log-methods';
2
+ import { DeclastructGithubProvider } from '../../domain.objects/DeclastructGithubProvider';
3
+ /**
4
+ * .what = creates a declastruct provider for github resources
5
+ * .why = enables github resource management via declastruct framework
6
+ */
7
+ export declare const getDeclastructGithubProvider: (input: {
8
+ credentials: {
9
+ token: string;
10
+ };
11
+ }, context: ContextLogTrail) => DeclastructGithubProvider;