declastruct-github 1.0.7 → 1.2.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 (145) hide show
  1. package/dist/access/daos/DeclaredGithubAppDao.d.ts +8 -0
  2. package/dist/access/daos/DeclaredGithubAppDao.js +32 -0
  3. package/dist/access/daos/DeclaredGithubAppDao.js.map +1 -0
  4. package/dist/access/daos/DeclaredGithubAppInstallationDao.d.ts +9 -0
  5. package/dist/access/daos/DeclaredGithubAppInstallationDao.js +33 -0
  6. package/dist/access/daos/DeclaredGithubAppInstallationDao.js.map +1 -0
  7. package/dist/access/daos/DeclaredGithubBranchDao.js +4 -4
  8. package/dist/access/daos/DeclaredGithubBranchDao.js.map +1 -1
  9. package/dist/access/daos/DeclaredGithubBranchProtectionDao.js +4 -4
  10. package/dist/access/daos/DeclaredGithubBranchProtectionDao.js.map +1 -1
  11. package/dist/access/daos/DeclaredGithubOrgDao.d.ts +10 -0
  12. package/dist/access/daos/DeclaredGithubOrgDao.js +44 -0
  13. package/dist/access/daos/DeclaredGithubOrgDao.js.map +1 -0
  14. package/dist/access/daos/DeclaredGithubOrgMemberPrivilegesDao.d.ts +10 -0
  15. package/dist/access/daos/DeclaredGithubOrgMemberPrivilegesDao.js +44 -0
  16. package/dist/access/daos/DeclaredGithubOrgMemberPrivilegesDao.js.map +1 -0
  17. package/dist/access/daos/DeclaredGithubOrgSecretDao.d.ts +10 -0
  18. package/dist/access/daos/DeclaredGithubOrgSecretDao.js +47 -0
  19. package/dist/access/daos/DeclaredGithubOrgSecretDao.js.map +1 -0
  20. package/dist/access/daos/DeclaredGithubOrgVariableDao.d.ts +9 -0
  21. package/dist/access/daos/DeclaredGithubOrgVariableDao.js +46 -0
  22. package/dist/access/daos/DeclaredGithubOrgVariableDao.js.map +1 -0
  23. package/dist/access/daos/DeclaredGithubRepoConfigDao.js +4 -4
  24. package/dist/access/daos/DeclaredGithubRepoConfigDao.js.map +1 -1
  25. package/dist/access/daos/DeclaredGithubRepoDao.js +4 -4
  26. package/dist/access/daos/DeclaredGithubRepoDao.js.map +1 -1
  27. package/dist/contract/sdks/index.d.ts +8 -0
  28. package/dist/contract/sdks/index.js +18 -3
  29. package/dist/contract/sdks/index.js.map +1 -1
  30. package/dist/domain.objects/DeclaredGithubApp.d.ts +75 -0
  31. package/dist/domain.objects/DeclaredGithubApp.js +16 -0
  32. package/dist/domain.objects/DeclaredGithubApp.js.map +1 -0
  33. package/dist/domain.objects/DeclaredGithubAppInstallation.d.ts +61 -0
  34. package/dist/domain.objects/DeclaredGithubAppInstallation.js +16 -0
  35. package/dist/domain.objects/DeclaredGithubAppInstallation.js.map +1 -0
  36. package/dist/domain.objects/DeclaredGithubAppPermissions.d.ts +130 -0
  37. package/dist/domain.objects/DeclaredGithubAppPermissions.js +12 -0
  38. package/dist/domain.objects/DeclaredGithubAppPermissions.js.map +1 -0
  39. package/dist/domain.objects/DeclaredGithubOrg.d.ts +59 -0
  40. package/dist/domain.objects/DeclaredGithubOrg.js +15 -0
  41. package/dist/domain.objects/DeclaredGithubOrg.js.map +1 -0
  42. package/dist/domain.objects/DeclaredGithubOrgMemberPrivileges.d.ts +85 -0
  43. package/dist/domain.objects/DeclaredGithubOrgMemberPrivileges.js +13 -0
  44. package/dist/domain.objects/DeclaredGithubOrgMemberPrivileges.js.map +1 -0
  45. package/dist/domain.objects/DeclaredGithubOrgSecret.d.ts +63 -0
  46. package/dist/domain.objects/DeclaredGithubOrgSecret.js +14 -0
  47. package/dist/domain.objects/DeclaredGithubOrgSecret.js.map +1 -0
  48. package/dist/domain.objects/DeclaredGithubOrgVariable.d.ts +54 -0
  49. package/dist/domain.objects/DeclaredGithubOrgVariable.js +13 -0
  50. package/dist/domain.objects/DeclaredGithubOrgVariable.js.map +1 -0
  51. package/dist/domain.objects/DeclaredGithubOwner.d.ts +17 -0
  52. package/dist/domain.objects/DeclaredGithubOwner.js +8 -0
  53. package/dist/domain.objects/DeclaredGithubOwner.js.map +1 -0
  54. package/dist/domain.objects/DeclaredGithubRepo.d.ts +1 -0
  55. package/dist/domain.objects/DeclaredGithubRepo.js +1 -0
  56. package/dist/domain.objects/DeclaredGithubRepo.js.map +1 -1
  57. package/dist/domain.objects/DeclaredGithubRepoConfig.d.ts +0 -4
  58. package/dist/domain.objects/DeclaredGithubRepoConfig.js.map +1 -1
  59. package/dist/domain.objects/DeclastructGithubProvider.d.ts +12 -0
  60. package/dist/domain.operations/app/castToDeclaredGithubApp.d.ts +12 -0
  61. package/dist/domain.operations/app/castToDeclaredGithubApp.js +134 -0
  62. package/dist/domain.operations/app/castToDeclaredGithubApp.js.map +1 -0
  63. package/dist/domain.operations/app/getOneApp.d.ts +15 -0
  64. package/dist/domain.operations/app/getOneApp.js +67 -0
  65. package/dist/domain.operations/app/getOneApp.js.map +1 -0
  66. package/dist/domain.operations/app/setApp.d.ts +13 -0
  67. package/dist/domain.operations/app/setApp.js +77 -0
  68. package/dist/domain.operations/app/setApp.js.map +1 -0
  69. package/dist/domain.operations/appInstallation/castToDeclaredGithubAppInstallation.d.ts +19 -0
  70. package/dist/domain.operations/appInstallation/castToDeclaredGithubAppInstallation.js +61 -0
  71. package/dist/domain.operations/appInstallation/castToDeclaredGithubAppInstallation.js.map +1 -0
  72. package/dist/domain.operations/appInstallation/deleteAppInstallation.d.ts +11 -0
  73. package/dist/domain.operations/appInstallation/deleteAppInstallation.js +30 -0
  74. package/dist/domain.operations/appInstallation/deleteAppInstallation.js.map +1 -0
  75. package/dist/domain.operations/appInstallation/getOneAppInstallation.d.ts +15 -0
  76. package/dist/domain.operations/appInstallation/getOneAppInstallation.js +92 -0
  77. package/dist/domain.operations/appInstallation/getOneAppInstallation.js.map +1 -0
  78. package/dist/domain.operations/appInstallation/setAppInstallation.d.ts +13 -0
  79. package/dist/domain.operations/appInstallation/setAppInstallation.js +131 -0
  80. package/dist/domain.operations/appInstallation/setAppInstallation.js.map +1 -0
  81. package/dist/domain.operations/branch/setBranch.js +19 -10
  82. package/dist/domain.operations/branch/setBranch.js.map +1 -1
  83. package/dist/domain.operations/context/hasContextWithAppToken.d.ts +6 -0
  84. package/dist/domain.operations/context/hasContextWithAppToken.js +15 -0
  85. package/dist/domain.operations/context/hasContextWithAppToken.js.map +1 -0
  86. package/dist/domain.operations/context/hasContextWithPatToken.d.ts +6 -0
  87. package/dist/domain.operations/context/hasContextWithPatToken.js +17 -0
  88. package/dist/domain.operations/context/hasContextWithPatToken.js.map +1 -0
  89. package/dist/domain.operations/org/castToDeclaredGithubOrg.d.ts +12 -0
  90. package/dist/domain.operations/org/castToDeclaredGithubOrg.js +29 -0
  91. package/dist/domain.operations/org/castToDeclaredGithubOrg.js.map +1 -0
  92. package/dist/domain.operations/org/getOneOrg.d.ts +14 -0
  93. package/dist/domain.operations/org/getOneOrg.js +31 -0
  94. package/dist/domain.operations/org/getOneOrg.js.map +1 -0
  95. package/dist/domain.operations/org/setOrg.d.ts +17 -0
  96. package/dist/domain.operations/org/setOrg.js +50 -0
  97. package/dist/domain.operations/org/setOrg.js.map +1 -0
  98. package/dist/domain.operations/orgMemberPrivileges/castToDeclaredGithubOrgMemberPrivileges.d.ts +15 -0
  99. package/dist/domain.operations/orgMemberPrivileges/castToDeclaredGithubOrgMemberPrivileges.js +47 -0
  100. package/dist/domain.operations/orgMemberPrivileges/castToDeclaredGithubOrgMemberPrivileges.js.map +1 -0
  101. package/dist/domain.operations/orgMemberPrivileges/getOneOrgMemberPrivileges.d.ts +14 -0
  102. package/dist/domain.operations/orgMemberPrivileges/getOneOrgMemberPrivileges.js +36 -0
  103. package/dist/domain.operations/orgMemberPrivileges/getOneOrgMemberPrivileges.js.map +1 -0
  104. package/dist/domain.operations/orgMemberPrivileges/setOrgMemberPrivileges.d.ts +16 -0
  105. package/dist/domain.operations/orgMemberPrivileges/setOrgMemberPrivileges.js +64 -0
  106. package/dist/domain.operations/orgMemberPrivileges/setOrgMemberPrivileges.js.map +1 -0
  107. package/dist/domain.operations/orgSecret/castToDeclaredGithubOrgSecret.d.ts +17 -0
  108. package/dist/domain.operations/orgSecret/castToDeclaredGithubOrgSecret.js +28 -0
  109. package/dist/domain.operations/orgSecret/castToDeclaredGithubOrgSecret.js.map +1 -0
  110. package/dist/domain.operations/orgSecret/delOrgSecret.d.ts +11 -0
  111. package/dist/domain.operations/orgSecret/delOrgSecret.js +27 -0
  112. package/dist/domain.operations/orgSecret/delOrgSecret.js.map +1 -0
  113. package/dist/domain.operations/orgSecret/getAllOrgSecrets.d.ts +14 -0
  114. package/dist/domain.operations/orgSecret/getAllOrgSecrets.js +27 -0
  115. package/dist/domain.operations/orgSecret/getAllOrgSecrets.js.map +1 -0
  116. package/dist/domain.operations/orgSecret/getOneOrgSecret.d.ts +15 -0
  117. package/dist/domain.operations/orgSecret/getOneOrgSecret.js +35 -0
  118. package/dist/domain.operations/orgSecret/getOneOrgSecret.js.map +1 -0
  119. package/dist/domain.operations/orgSecret/setOrgSecret.d.ts +17 -0
  120. package/dist/domain.operations/orgSecret/setOrgSecret.js +123 -0
  121. package/dist/domain.operations/orgSecret/setOrgSecret.js.map +1 -0
  122. package/dist/domain.operations/orgVariable/castToDeclaredGithubOrgVariable.d.ts +16 -0
  123. package/dist/domain.operations/orgVariable/castToDeclaredGithubOrgVariable.js +26 -0
  124. package/dist/domain.operations/orgVariable/castToDeclaredGithubOrgVariable.js.map +1 -0
  125. package/dist/domain.operations/orgVariable/delOrgVariable.d.ts +11 -0
  126. package/dist/domain.operations/orgVariable/delOrgVariable.js +27 -0
  127. package/dist/domain.operations/orgVariable/delOrgVariable.js.map +1 -0
  128. package/dist/domain.operations/orgVariable/getAllOrgVariables.d.ts +13 -0
  129. package/dist/domain.operations/orgVariable/getAllOrgVariables.js +28 -0
  130. package/dist/domain.operations/orgVariable/getAllOrgVariables.js.map +1 -0
  131. package/dist/domain.operations/orgVariable/getOneOrgVariable.d.ts +14 -0
  132. package/dist/domain.operations/orgVariable/getOneOrgVariable.js +34 -0
  133. package/dist/domain.operations/orgVariable/getOneOrgVariable.js.map +1 -0
  134. package/dist/domain.operations/orgVariable/setOrgVariable.d.ts +12 -0
  135. package/dist/domain.operations/orgVariable/setOrgVariable.js +69 -0
  136. package/dist/domain.operations/orgVariable/setOrgVariable.js.map +1 -0
  137. package/dist/domain.operations/provider/getDeclastructGithubProvider.js +13 -0
  138. package/dist/domain.operations/provider/getDeclastructGithubProvider.js.map +1 -1
  139. package/dist/domain.operations/repo/getRepos.js +22 -5
  140. package/dist/domain.operations/repo/getRepos.js.map +1 -1
  141. package/dist/domain.operations/repoConfig/castToDeclaredGithubRepoConfig.js +0 -1
  142. package/dist/domain.operations/repoConfig/castToDeclaredGithubRepoConfig.js.map +1 -1
  143. package/dist/domain.operations/repoConfig/setRepoConfig.js +0 -1
  144. package/dist/domain.operations/repoConfig/setRepoConfig.js.map +1 -1
  145. package/package.json +7 -5
@@ -0,0 +1 @@
1
+ {"version":3,"file":"castToDeclaredGithubOrgMemberPrivileges.js","sourceRoot":"","sources":["../../../src/domain.operations/orgMemberPrivileges/castToDeclaredGithubOrgMemberPrivileges.ts"],"names":[],"mappings":";;;AAAA,iDAAmD;AAMnD,8GAA2G;AAI3G;;;GAGG;AACI,MAAM,uCAAuC,GAAG,CAAC,KAGvD,EAAkD,EAAE;IACnD,OAAO,qEAAiC,CAAC,EAAE,CAAC;QAC1C,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU;YAC9B,CAAC,CAAC,IAAA,wBAAa,EAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;YACtC,CAAC,CAAC,SAAS;QAEb,sBAAsB;QACtB,4BAA4B,EAC1B,KAAK,CAAC,IAAI,CAAC,+BAA+B,IAAI,IAAI;QACpD,kCAAkC,EAChC,KAAK,CAAC,IAAI,CAAC,sCAAsC,IAAI,IAAI;QAC3D,mCAAmC,EACjC,KAAK,CAAC,IAAI,CAAC,uCAAuC,IAAI,IAAI;QAC5D,oCAAoC,EAAE,CAAC,GAAG,EAAE;YAC1C,oDAAoD;YACpD,MAAM,YAAY,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI;gBACxC,EAAE,WAAW,EAAE;iBACd,QAAQ,CAAC,YAAY,CAAC,CAAC;YAC1B,IAAI,CAAC,YAAY;gBAAE,OAAO,IAAI,CAAC;YAC/B,OAAO,KAAK,CAAC,IAAI,CAAC,wCAAwC,IAAI,IAAI,CAAC;QACrE,CAAC,CAAC,EAAE;QAEJ,uCAAuC;QACvC,4BAA4B;QAC1B,gEAAgE;QAC9D,KAAK,CAAC,IAAgC;aACrC,+BAA2C,IAAI,IAAI;QACxD,8BAA8B,EAC1B,KAAK,CAAC,IAAgC;aACrC,kCAA8C,IAAI,IAAI;QAC3D,iCAAiC,EAC/B,KAAK,CAAC,IAAI,CAAC,qCAAqC,IAAI,KAAK;QAE3D,gBAAgB;QAChB,oCAAoC,EAAE,IAAI,EAAE,8BAA8B;QAE1E,eAAe;QACf,qBAAqB,EAAE,KAAK,CAAC,IAAI,CAAC,wBAAwB,IAAI,IAAI;QAClE,2BAA2B,EACzB,KAAK,CAAC,IAAI,CAAC,+BAA+B,IAAI,IAAI;QACpD,4BAA4B,EAC1B,KAAK,CAAC,IAAI,CAAC,gCAAgC,IAAI,IAAI;QAErD,2BAA2B,EACxB,KAAK,CAAC,IAAI,CAAC,6BAID,IAAI,MAAM;KACxB,CAAmD,CAAC;AACvD,CAAC,CAAC;AAtDW,QAAA,uCAAuC,2CAsDlD"}
@@ -0,0 +1,14 @@
1
+ import type { RefByUnique } from 'domain-objects';
2
+ import type { HasMetadata, PickOne } from 'type-fns';
3
+ import type { VisualogicContext } from 'visualogic';
4
+ import type { ContextGithubApi } from '../../domain.objects/ContextGithubApi';
5
+ import type { DeclaredGithubOrgMemberPrivileges } from '../../domain.objects/DeclaredGithubOrgMemberPrivileges';
6
+ /**
7
+ * .what = gets GitHub Organization member privileges
8
+ * .why = retrieves current security settings for declarative management
9
+ */
10
+ export declare const getOneOrgMemberPrivileges: (input: {
11
+ by: PickOne<{
12
+ unique: RefByUnique<typeof DeclaredGithubOrgMemberPrivileges>;
13
+ }>;
14
+ }, context: ContextGithubApi & VisualogicContext) => Promise<HasMetadata<DeclaredGithubOrgMemberPrivileges> | null>;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOneOrgMemberPrivileges = 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 castToDeclaredGithubOrgMemberPrivileges_1 = require("./castToDeclaredGithubOrgMemberPrivileges");
8
+ /**
9
+ * .what = gets GitHub Organization member privileges
10
+ * .why = retrieves current security settings for declarative management
11
+ */
12
+ exports.getOneOrgMemberPrivileges = (0, as_procedure_1.asProcedure)(async (input, context) => {
13
+ const github = (0, getGithubClient_1.getGithubClient)({}, context);
14
+ const org = (() => {
15
+ if (input.by.unique)
16
+ return input.by.unique.org;
17
+ helpful_errors_1.UnexpectedCodePathError.throw('not referenced by unique', { input });
18
+ })();
19
+ try {
20
+ const response = await github.orgs.get({ org: org.login });
21
+ return (0, castToDeclaredGithubOrgMemberPrivileges_1.castToDeclaredGithubOrgMemberPrivileges)({
22
+ data: response.data,
23
+ org,
24
+ });
25
+ }
26
+ catch (error) {
27
+ if (!(error instanceof Error))
28
+ throw error;
29
+ if (error.message.includes('Not Found'))
30
+ return null;
31
+ throw new helpful_errors_1.HelpfulError('github.getOrgMemberPrivileges error', {
32
+ cause: error,
33
+ });
34
+ }
35
+ });
36
+ //# sourceMappingURL=getOneOrgMemberPrivileges.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOneOrgMemberPrivileges.js","sourceRoot":"","sources":["../../../src/domain.operations/orgMemberPrivileges/getOneOrgMemberPrivileges.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,mDAAuE;AAIvE,uEAAoE;AAGpE,uGAAoG;AAEpG;;;GAGG;AACU,QAAA,yBAAyB,GAAG,IAAA,0BAAW,EAClD,KAAK,EACH,KAIC,EACD,OAA6C,EACmB,EAAE;IAClE,MAAM,MAAM,GAAG,IAAA,iCAAe,EAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAE5C,MAAM,GAAG,GAAG,CAAC,GAAG,EAAE;QAChB,IAAI,KAAK,CAAC,EAAE,CAAC,MAAM;YAAE,OAAO,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,CAAC;QAChD,wCAAuB,CAAC,KAAK,CAAC,0BAA0B,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC,CAAC,EAAE,CAAC;IAEL,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3D,OAAO,IAAA,iFAAuC,EAAC;YAC7C,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,GAAG;SACJ,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;YAAE,MAAM,KAAK,CAAC;QAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;YAAE,OAAO,IAAI,CAAC;QACrD,MAAM,IAAI,6BAAY,CAAC,qCAAqC,EAAE;YAC5D,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CACF,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { HasMetadata, PickOne } from 'type-fns';
2
+ import type { VisualogicContext } from 'visualogic';
3
+ import type { ContextGithubApi } from '../../domain.objects/ContextGithubApi';
4
+ import type { DeclaredGithubOrgMemberPrivileges } from '../../domain.objects/DeclaredGithubOrgMemberPrivileges';
5
+ /**
6
+ * .what = sets GitHub Organization member privileges
7
+ * .why = enables declarative management of org security settings
8
+ *
9
+ * KEY SECURITY SETTINGS:
10
+ * - membersCanDeleteRepositories: false -> only owners can delete/transfer repos
11
+ * - membersCanChangeRepoVisibility: false -> only owners can change visibility
12
+ */
13
+ export declare const setOrgMemberPrivileges: (input: PickOne<{
14
+ finsert: DeclaredGithubOrgMemberPrivileges;
15
+ upsert: DeclaredGithubOrgMemberPrivileges;
16
+ }>, context: ContextGithubApi & VisualogicContext) => Promise<HasMetadata<DeclaredGithubOrgMemberPrivileges>>;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setOrgMemberPrivileges = 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 castToDeclaredGithubOrgMemberPrivileges_1 = require("./castToDeclaredGithubOrgMemberPrivileges");
8
+ const getOneOrgMemberPrivileges_1 = require("./getOneOrgMemberPrivileges");
9
+ /**
10
+ * .what = sets GitHub Organization member privileges
11
+ * .why = enables declarative management of org security settings
12
+ *
13
+ * KEY SECURITY SETTINGS:
14
+ * - membersCanDeleteRepositories: false -> only owners can delete/transfer repos
15
+ * - membersCanChangeRepoVisibility: false -> only owners can change visibility
16
+ */
17
+ exports.setOrgMemberPrivileges = (0, as_procedure_1.asProcedure)(async (input, context) => {
18
+ const desired = input.finsert ?? input.upsert;
19
+ const github = (0, getGithubClient_1.getGithubClient)({}, context);
20
+ // Check current state
21
+ const before = await (0, getOneOrgMemberPrivileges_1.getOneOrgMemberPrivileges)({ by: { unique: { org: desired.org } } }, context);
22
+ // Org must exist
23
+ if (!before) {
24
+ throw new helpful_errors_1.HelpfulError('GitHub Organization does not exist.', {
25
+ desiredPrivileges: desired,
26
+ });
27
+ }
28
+ // If finsert and found, return as-is (no changes)
29
+ if (before && input.finsert)
30
+ return before;
31
+ // Apply member privilege updates via PATCH
32
+ try {
33
+ const response = await github.orgs.update({
34
+ org: desired.org.login,
35
+ // Repository creation
36
+ members_can_create_repositories: desired.membersCanCreateRepositories,
37
+ members_can_create_public_repositories: desired.membersCanCreatePublicRepositories,
38
+ members_can_create_private_repositories: desired.membersCanCreatePrivateRepositories,
39
+ members_can_create_internal_repositories: desired.membersCanCreateInternalRepositories ?? undefined,
40
+ // KEY SECURITY SETTINGS
41
+ // Note: These fields may not be directly settable via the standard API
42
+ // They are typically org settings that require admin permissions
43
+ members_can_fork_private_repositories: desired.membersCanForkPrivateRepositories,
44
+ // GitHub Pages
45
+ members_can_create_pages: desired.membersCanCreatePages,
46
+ members_can_create_public_pages: desired.membersCanCreatePublicPages,
47
+ members_can_create_private_pages: desired.membersCanCreatePrivatePages,
48
+ // Other
49
+ default_repository_permission: desired.defaultRepositoryPermission,
50
+ });
51
+ return (0, castToDeclaredGithubOrgMemberPrivileges_1.castToDeclaredGithubOrgMemberPrivileges)({
52
+ data: response.data,
53
+ org: desired.org,
54
+ });
55
+ }
56
+ catch (error) {
57
+ if (!(error instanceof Error))
58
+ throw error;
59
+ throw new helpful_errors_1.HelpfulError('github.setOrgMemberPrivileges.update error', {
60
+ cause: error,
61
+ });
62
+ }
63
+ });
64
+ //# sourceMappingURL=setOrgMemberPrivileges.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setOrgMemberPrivileges.js","sourceRoot":"","sources":["../../../src/domain.operations/orgMemberPrivileges/setOrgMemberPrivileges.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,mDAA8C;AAI9C,uEAAoE;AAGpE,uGAAoG;AACpG,2EAAwE;AAExE;;;;;;;GAOG;AACU,QAAA,sBAAsB,GAAG,IAAA,0BAAW,EAC/C,KAAK,EACH,KAGE,EACF,OAA6C,EACY,EAAE;IAC3D,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,CAAC;IAC9C,MAAM,MAAM,GAAG,IAAA,iCAAe,EAAC,EAAE,EAAE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QACf,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;YAAE,MAAM,KAAK,CAAC;QAC3C,MAAM,IAAI,6BAAY,CAAC,4CAA4C,EAAE;YACnE,KAAK,EAAE,KAAK;SACb,CAAC,CAAC;IACL,CAAC;AACH,CAAC,CACF,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { Endpoints } from '@octokit/types';
2
+ import type { RefByUnique } from 'domain-objects';
3
+ import type { HasMetadata } from 'type-fns';
4
+ import type { DeclaredGithubOrg } from '../../domain.objects/DeclaredGithubOrg';
5
+ import { DeclaredGithubOrgSecret } from '../../domain.objects/DeclaredGithubOrgSecret';
6
+ type GithubOrgSecretResponse = Endpoints['GET /orgs/{org}/actions/secrets/{secret_name}']['response']['data'];
7
+ type GithubOrgSecretListItem = Endpoints['GET /orgs/{org}/actions/secrets']['response']['data']['secrets'][number];
8
+ /**
9
+ * .what = casts GitHub API secret response to DeclaredGithubOrgSecret
10
+ * .why = transforms external API shape to our domain model
11
+ * .note = value is NEVER returned - secrets are write-only
12
+ */
13
+ export declare const castToDeclaredGithubOrgSecret: (input: {
14
+ data: GithubOrgSecretResponse | GithubOrgSecretListItem;
15
+ org: RefByUnique<typeof DeclaredGithubOrg>;
16
+ }) => HasMetadata<DeclaredGithubOrgSecret>;
17
+ export {};
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.castToDeclaredGithubOrgSecret = void 0;
4
+ const uni_time_1 = require("@ehmpathy/uni-time");
5
+ const DeclaredGithubOrgSecret_1 = require("../../domain.objects/DeclaredGithubOrgSecret");
6
+ /**
7
+ * .what = casts GitHub API secret response to DeclaredGithubOrgSecret
8
+ * .why = transforms external API shape to our domain model
9
+ * .note = value is NEVER returned - secrets are write-only
10
+ */
11
+ const castToDeclaredGithubOrgSecret = (input) => {
12
+ return DeclaredGithubOrgSecret_1.DeclaredGithubOrgSecret.as({
13
+ org: input.org,
14
+ name: input.data.name,
15
+ // value is NEVER returned from API - secrets are write-only
16
+ value: undefined,
17
+ visibility: input.data.visibility,
18
+ // selectedRepositoryNames not set - not returned in API response
19
+ createdAt: input.data.created_at
20
+ ? (0, uni_time_1.asUniDateTime)(input.data.created_at)
21
+ : undefined,
22
+ updatedAt: input.data.updated_at
23
+ ? (0, uni_time_1.asUniDateTime)(input.data.updated_at)
24
+ : undefined,
25
+ });
26
+ };
27
+ exports.castToDeclaredGithubOrgSecret = castToDeclaredGithubOrgSecret;
28
+ //# sourceMappingURL=castToDeclaredGithubOrgSecret.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"castToDeclaredGithubOrgSecret.js","sourceRoot":"","sources":["../../../src/domain.operations/orgSecret/castToDeclaredGithubOrgSecret.ts"],"names":[],"mappings":";;;AAAA,iDAAmD;AAMnD,0FAAuF;AAQvF;;;;GAIG;AACI,MAAM,6BAA6B,GAAG,CAAC,KAG7C,EAAwC,EAAE;IACzC,OAAO,iDAAuB,CAAC,EAAE,CAAC;QAChC,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI;QACrB,4DAA4D;QAC5D,KAAK,EAAE,SAAS;QAChB,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,UAA4C;QACnE,iEAAiE;QACjE,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU;YAC9B,CAAC,CAAC,IAAA,wBAAa,EAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;YACtC,CAAC,CAAC,SAAS;QACb,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU;YAC9B,CAAC,CAAC,IAAA,wBAAa,EAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;YACtC,CAAC,CAAC,SAAS;KACd,CAAyC,CAAC;AAC7C,CAAC,CAAC;AAlBW,QAAA,6BAA6B,iCAkBxC"}
@@ -0,0 +1,11 @@
1
+ import type { Ref } from 'domain-objects';
2
+ import type { VisualogicContext } from 'visualogic';
3
+ import type { ContextGithubApi } from '../../domain.objects/ContextGithubApi';
4
+ import type { DeclaredGithubOrgSecret } from '../../domain.objects/DeclaredGithubOrgSecret';
5
+ /**
6
+ * .what = deletes a GitHub Organization secret
7
+ * .why = enables declarative management of org-level secrets
8
+ */
9
+ export declare const delOrgSecret: (input: {
10
+ secret: Ref<typeof DeclaredGithubOrgSecret>;
11
+ }, context: ContextGithubApi & VisualogicContext) => Promise<void>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.delOrgSecret = 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
+ /**
8
+ * .what = deletes a GitHub Organization secret
9
+ * .why = enables declarative management of org-level secrets
10
+ */
11
+ exports.delOrgSecret = (0, as_procedure_1.asProcedure)(async (input, context) => {
12
+ const github = (0, getGithubClient_1.getGithubClient)({}, context);
13
+ // extract unique key fields
14
+ const secret = input.secret;
15
+ try {
16
+ await github.actions.deleteOrgSecret({
17
+ org: secret.org.login,
18
+ secret_name: secret.name,
19
+ });
20
+ }
21
+ catch (error) {
22
+ if (!(error instanceof Error))
23
+ throw error;
24
+ throw new helpful_errors_1.HelpfulError('github.delOrgSecret error', { cause: error });
25
+ }
26
+ });
27
+ //# sourceMappingURL=delOrgSecret.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delOrgSecret.js","sourceRoot":"","sources":["../../../src/domain.operations/orgSecret/delOrgSecret.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,mDAA8C;AAG9C,uEAAoE;AAIpE;;;GAGG;AACU,QAAA,YAAY,GAAG,IAAA,0BAAW,EACrC,KAAK,EACH,KAAsD,EACtD,OAA6C,EAC9B,EAAE;IACjB,MAAM,MAAM,GAAG,IAAA,iCAAe,EAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAE5C,4BAA4B;IAC5B,MAAM,MAAM,GAAG,KAAK,CAAC,MAAkD,CAAC;IAExE,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,OAAO,CAAC,eAAe,CAAC;YACnC,GAAG,EAAE,MAAM,CAAC,GAAG,CAAC,KAAK;YACrB,WAAW,EAAE,MAAM,CAAC,IAAI;SACzB,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,2BAA2B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACxE,CAAC;AACH,CAAC,CACF,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { RefByUnique } from 'domain-objects';
2
+ import type { HasMetadata } from 'type-fns';
3
+ import type { VisualogicContext } from 'visualogic';
4
+ import type { ContextGithubApi } from '../../domain.objects/ContextGithubApi';
5
+ import type { DeclaredGithubOrg } from '../../domain.objects/DeclaredGithubOrg';
6
+ import type { DeclaredGithubOrgSecret } from '../../domain.objects/DeclaredGithubOrgSecret';
7
+ /**
8
+ * .what = gets all GitHub Organization secrets (metadata only)
9
+ * .why = retrieves current state for declarative management
10
+ * .note = values are NEVER returned - secrets are write-only
11
+ */
12
+ export declare const getAllOrgSecrets: (input: {
13
+ org: RefByUnique<typeof DeclaredGithubOrg>;
14
+ }, context: ContextGithubApi & VisualogicContext) => Promise<HasMetadata<DeclaredGithubOrgSecret>[]>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllOrgSecrets = 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 castToDeclaredGithubOrgSecret_1 = require("./castToDeclaredGithubOrgSecret");
8
+ /**
9
+ * .what = gets all GitHub Organization secrets (metadata only)
10
+ * .why = retrieves current state for declarative management
11
+ * .note = values are NEVER returned - secrets are write-only
12
+ */
13
+ exports.getAllOrgSecrets = (0, as_procedure_1.asProcedure)(async (input, context) => {
14
+ const github = (0, getGithubClient_1.getGithubClient)({}, context);
15
+ try {
16
+ const response = await github.actions.listOrgSecrets({
17
+ org: input.org.login,
18
+ });
19
+ return response.data.secrets.map((s) => (0, castToDeclaredGithubOrgSecret_1.castToDeclaredGithubOrgSecret)({ data: s, org: input.org }));
20
+ }
21
+ catch (error) {
22
+ if (!(error instanceof Error))
23
+ throw error;
24
+ throw new helpful_errors_1.HelpfulError('github.getAllOrgSecrets error', { cause: error });
25
+ }
26
+ });
27
+ //# sourceMappingURL=getAllOrgSecrets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAllOrgSecrets.js","sourceRoot":"","sources":["../../../src/domain.operations/orgSecret/getAllOrgSecrets.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,mDAA8C;AAI9C,uEAAoE;AAIpE,mFAAgF;AAEhF;;;;GAIG;AACU,QAAA,gBAAgB,GAAG,IAAA,0BAAW,EACzC,KAAK,EACH,KAAqD,EACrD,OAA6C,EACI,EAAE;IACnD,MAAM,MAAM,GAAG,IAAA,iCAAe,EAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAE5C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,cAAc,CAAC;YACnD,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK;SACrB,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CACrC,IAAA,6DAA6B,EAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC,CAC3D,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;YAAE,MAAM,KAAK,CAAC;QAC3C,MAAM,IAAI,6BAAY,CAAC,+BAA+B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC5E,CAAC;AACH,CAAC,CACF,CAAC"}
@@ -0,0 +1,15 @@
1
+ import type { RefByUnique } from 'domain-objects';
2
+ import type { HasMetadata, PickOne } from 'type-fns';
3
+ import type { VisualogicContext } from 'visualogic';
4
+ import type { ContextGithubApi } from '../../domain.objects/ContextGithubApi';
5
+ import type { DeclaredGithubOrgSecret } from '../../domain.objects/DeclaredGithubOrgSecret';
6
+ /**
7
+ * .what = gets a GitHub Organization secret (metadata only)
8
+ * .why = retrieves current state for declarative management
9
+ * .note = value is NEVER returned - secrets are write-only
10
+ */
11
+ export declare const getOneOrgSecret: (input: {
12
+ by: PickOne<{
13
+ unique: RefByUnique<typeof DeclaredGithubOrgSecret>;
14
+ }>;
15
+ }, context: ContextGithubApi & VisualogicContext) => Promise<HasMetadata<DeclaredGithubOrgSecret> | null>;
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getOneOrgSecret = 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 castToDeclaredGithubOrgSecret_1 = require("./castToDeclaredGithubOrgSecret");
8
+ /**
9
+ * .what = gets a GitHub Organization secret (metadata only)
10
+ * .why = retrieves current state for declarative management
11
+ * .note = value is NEVER returned - secrets are write-only
12
+ */
13
+ exports.getOneOrgSecret = (0, as_procedure_1.asProcedure)(async (input, context) => {
14
+ const github = (0, getGithubClient_1.getGithubClient)({}, context);
15
+ const { org, name } = (() => {
16
+ if (input.by.unique)
17
+ return { org: input.by.unique.org, name: input.by.unique.name };
18
+ helpful_errors_1.UnexpectedCodePathError.throw('not referenced by unique', { input });
19
+ })();
20
+ try {
21
+ const response = await github.actions.getOrgSecret({
22
+ org: org.login,
23
+ secret_name: name,
24
+ });
25
+ return (0, castToDeclaredGithubOrgSecret_1.castToDeclaredGithubOrgSecret)({ data: response.data, org });
26
+ }
27
+ catch (error) {
28
+ if (!(error instanceof Error))
29
+ throw error;
30
+ if (error.message.includes('Not Found'))
31
+ return null;
32
+ throw new helpful_errors_1.HelpfulError('github.getOrgSecret error', { cause: error });
33
+ }
34
+ });
35
+ //# sourceMappingURL=getOneOrgSecret.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getOneOrgSecret.js","sourceRoot":"","sources":["../../../src/domain.operations/orgSecret/getOneOrgSecret.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,mDAAuE;AAIvE,uEAAoE;AAGpE,mFAAgF;AAEhF;;;;GAIG;AACU,QAAA,eAAe,GAAG,IAAA,0BAAW,EACxC,KAAK,EACH,KAIC,EACD,OAA6C,EACS,EAAE;IACxD,MAAM,MAAM,GAAG,IAAA,iCAAe,EAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAE5C,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,GAAG,EAAE;QAC1B,IAAI,KAAK,CAAC,EAAE,CAAC,MAAM;YACjB,OAAO,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC;QAClE,wCAAuB,CAAC,KAAK,CAAC,0BAA0B,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC,CAAC,EAAE,CAAC;IAEL,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC;YACjD,GAAG,EAAE,GAAG,CAAC,KAAK;YACd,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QACH,OAAO,IAAA,6DAA6B,EAAC,EAAE,IAAI,EAAE,QAAQ,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;IACrE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;YAAE,MAAM,KAAK,CAAC;QAC3C,IAAI,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC;YAAE,OAAO,IAAI,CAAC;QACrD,MAAM,IAAI,6BAAY,CAAC,2BAA2B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACxE,CAAC;AACH,CAAC,CACF,CAAC"}
@@ -0,0 +1,17 @@
1
+ import type { HasMetadata, PickOne } from 'type-fns';
2
+ import type { VisualogicContext } from 'visualogic';
3
+ import type { ContextGithubApi } from '../../domain.objects/ContextGithubApi';
4
+ import type { DeclaredGithubOrgSecret } from '../../domain.objects/DeclaredGithubOrgSecret';
5
+ /**
6
+ * .what = sets a GitHub Organization secret
7
+ * .why = enables declarative management of org-level secrets
8
+ *
9
+ * WRITE-ONLY PATTERN:
10
+ * - If value is undefined and secret exists: keeps existing value (no-op)
11
+ * - If value is undefined and secret doesn't exist: throws error (must provide value)
12
+ * - If value is provided: encrypts and creates/updates secret
13
+ */
14
+ export declare const setOrgSecret: (input: PickOne<{
15
+ finsert: DeclaredGithubOrgSecret;
16
+ upsert: DeclaredGithubOrgSecret;
17
+ }>, context: ContextGithubApi & VisualogicContext) => Promise<HasMetadata<DeclaredGithubOrgSecret>>;
@@ -0,0 +1,123 @@
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
+ exports.setOrgSecret = void 0;
27
+ const as_procedure_1 = require("as-procedure");
28
+ const helpful_errors_1 = require("helpful-errors");
29
+ const getGithubClient_1 = require("../../access/sdks/getGithubClient");
30
+ const getRepo_1 = require("../repo/getRepo");
31
+ const getOneOrgSecret_1 = require("./getOneOrgSecret");
32
+ /**
33
+ * .what = encrypts a secret value using the org's public key
34
+ * .why = GitHub requires secrets to be encrypted before sending
35
+ * .note = uses dynamic import to avoid module init issues in test environments
36
+ */
37
+ const encryptSecret = async (input) => {
38
+ // dynamic import to avoid libsodium init issues at module load time
39
+ const sodium = await Promise.resolve().then(() => __importStar(require('libsodium-wrappers'))).then((m) => m.default);
40
+ await sodium.ready;
41
+ const binKey = sodium.from_base64(input.publicKey, sodium.base64_variants.ORIGINAL);
42
+ const binSec = sodium.from_string(input.value);
43
+ const encBytes = sodium.crypto_box_seal(binSec, binKey);
44
+ return sodium.to_base64(encBytes, sodium.base64_variants.ORIGINAL);
45
+ };
46
+ /**
47
+ * .what = sets a GitHub Organization secret
48
+ * .why = enables declarative management of org-level secrets
49
+ *
50
+ * WRITE-ONLY PATTERN:
51
+ * - If value is undefined and secret exists: keeps existing value (no-op)
52
+ * - If value is undefined and secret doesn't exist: throws error (must provide value)
53
+ * - If value is provided: encrypts and creates/updates secret
54
+ */
55
+ exports.setOrgSecret = (0, as_procedure_1.asProcedure)(async (input, context) => {
56
+ const desired = input.finsert ?? input.upsert;
57
+ const github = (0, getGithubClient_1.getGithubClient)({}, context);
58
+ // Check if secret exists (metadata only)
59
+ const before = await (0, getOneOrgSecret_1.getOneOrgSecret)({ by: { unique: { org: desired.org, name: desired.name } } }, context);
60
+ // If finsert and found, return as-is (no changes needed)
61
+ if (before && input.finsert)
62
+ return before;
63
+ // If no value provided and secret doesn't exist, error
64
+ if (!desired.value && !before) {
65
+ throw new helpful_errors_1.HelpfulError('Cannot create secret without a value. ' +
66
+ 'Provide the secret value via process.env or directly.', { desiredSecret: desired });
67
+ }
68
+ // If no value provided and secret exists, check if we can skip the update
69
+ // NOTE: GitHub API requires encrypted_value for PUT, so we cannot update
70
+ // visibility without re-providing the value.
71
+ if (!desired.value && before) {
72
+ const visibilityChanged = desired.visibility !== before.visibility;
73
+ const selectedReposChanged = desired.visibility === 'selected' &&
74
+ JSON.stringify(desired.selectedRepositoryNames?.sort()) !==
75
+ JSON.stringify(before.selectedRepositoryNames?.sort());
76
+ if (visibilityChanged || selectedReposChanged) {
77
+ throw new helpful_errors_1.HelpfulError('Cannot update secret visibility without re-providing the secret value. ' +
78
+ 'GitHub API requires the encrypted value for any secret update.', {
79
+ desiredSecret: desired,
80
+ currentVisibility: before.visibility,
81
+ desiredVisibility: desired.visibility,
82
+ });
83
+ }
84
+ // No changes needed, return existing metadata
85
+ return before;
86
+ }
87
+ // Get org's public key for encryption
88
+ const keyResponse = await github.actions.getOrgPublicKey({
89
+ org: desired.org.login,
90
+ });
91
+ // Encrypt the secret value
92
+ const encryptedValue = await encryptSecret({
93
+ value: desired.value,
94
+ publicKey: keyResponse.data.key,
95
+ });
96
+ // Resolve repo IDs if visibility is 'selected'
97
+ const selectedRepositoryIds = desired.visibility === 'selected' && desired.selectedRepositoryNames
98
+ ? await Promise.all(desired.selectedRepositoryNames.map(async (name) => {
99
+ const repo = await (0, getRepo_1.getRepo)({ by: { unique: { owner: desired.org.login, name } } }, context);
100
+ if (!repo)
101
+ throw new helpful_errors_1.HelpfulError(`Repository not found: ${desired.org.login}/${name}`);
102
+ return repo.id;
103
+ }))
104
+ : undefined;
105
+ // Create or update secret
106
+ try {
107
+ await github.actions.createOrUpdateOrgSecret({
108
+ org: desired.org.login,
109
+ secret_name: desired.name,
110
+ encrypted_value: encryptedValue,
111
+ key_id: keyResponse.data.key_id,
112
+ visibility: desired.visibility,
113
+ selected_repository_ids: selectedRepositoryIds,
114
+ });
115
+ return (await (0, getOneOrgSecret_1.getOneOrgSecret)({ by: { unique: { org: desired.org, name: desired.name } } }, context));
116
+ }
117
+ catch (error) {
118
+ if (!(error instanceof Error))
119
+ throw error;
120
+ throw new helpful_errors_1.HelpfulError('github.setOrgSecret error', { cause: error });
121
+ }
122
+ });
123
+ //# sourceMappingURL=setOrgSecret.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setOrgSecret.js","sourceRoot":"","sources":["../../../src/domain.operations/orgSecret/setOrgSecret.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2C;AAC3C,mDAA8C;AAI9C,uEAAoE;AAGpE,6CAA0C;AAC1C,uDAAoD;AAEpD;;;;GAIG;AACH,MAAM,aAAa,GAAG,KAAK,EAAE,KAG5B,EAAmB,EAAE;IACpB,oEAAoE;IACpE,MAAM,MAAM,GAAG,MAAM,kDAAO,oBAAoB,IAAE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IACzE,MAAM,MAAM,CAAC,KAAK,CAAC;IACnB,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAC/B,KAAK,CAAC,SAAS,EACf,MAAM,CAAC,eAAe,CAAC,QAAQ,CAChC,CAAC;IACF,MAAM,MAAM,GAAG,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;IAC/C,MAAM,QAAQ,GAAG,MAAM,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACx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AA0B;IAC1B,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,OAAO,CAAC,uBAAuB,CAAC;YAC3C,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK;YACtB,WAAW,EAAE,OAAO,CAAC,IAAI;YACzB,eAAe,EAAE,cAAc;YAC/B,MAAM,EAAE,WAAW,CAAC,IAAI,CAAC,MAAM;YAC/B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,uBAAuB,EAAE,qBAAqB;SAC/C,CAAC,CAAC;QAEH,OAAO,CAAC,MAAM,IAAA,iCAAe,EAC3B,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,EAAE,EAC5D,OAAO,CACR,CAAE,CAAC;IACN,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,CAAC,CAAC,KAAK,YAAY,KAAK,CAAC;YAAE,MAAM,KAAK,CAAC;QAC3C,MAAM,IAAI,6BAAY,CAAC,2BAA2B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IACxE,CAAC;AACH,CAAC,CACF,CAAC"}
@@ -0,0 +1,16 @@
1
+ import type { Endpoints } from '@octokit/types';
2
+ import type { RefByUnique } from 'domain-objects';
3
+ import type { HasMetadata } from 'type-fns';
4
+ import type { DeclaredGithubOrg } from '../../domain.objects/DeclaredGithubOrg';
5
+ import { DeclaredGithubOrgVariable } from '../../domain.objects/DeclaredGithubOrgVariable';
6
+ type GithubOrgVariableResponse = Endpoints['GET /orgs/{org}/actions/variables/{name}']['response']['data'];
7
+ type GithubOrgVariableListItem = Endpoints['GET /orgs/{org}/actions/variables']['response']['data']['variables'][number];
8
+ /**
9
+ * .what = casts GitHub API variable response to DeclaredGithubOrgVariable
10
+ * .why = transforms external API shape to our domain model
11
+ */
12
+ export declare const castToDeclaredGithubOrgVariable: (input: {
13
+ data: GithubOrgVariableResponse | GithubOrgVariableListItem;
14
+ org: RefByUnique<typeof DeclaredGithubOrg>;
15
+ }) => HasMetadata<DeclaredGithubOrgVariable>;
16
+ export {};
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.castToDeclaredGithubOrgVariable = void 0;
4
+ const uni_time_1 = require("@ehmpathy/uni-time");
5
+ const DeclaredGithubOrgVariable_1 = require("../../domain.objects/DeclaredGithubOrgVariable");
6
+ /**
7
+ * .what = casts GitHub API variable response to DeclaredGithubOrgVariable
8
+ * .why = transforms external API shape to our domain model
9
+ */
10
+ const castToDeclaredGithubOrgVariable = (input) => {
11
+ return DeclaredGithubOrgVariable_1.DeclaredGithubOrgVariable.as({
12
+ org: input.org,
13
+ name: input.data.name,
14
+ value: input.data.value,
15
+ visibility: input.data.visibility,
16
+ // selectedRepositoryNames not set - not returned in API response
17
+ createdAt: input.data.created_at
18
+ ? (0, uni_time_1.asUniDateTime)(input.data.created_at)
19
+ : undefined,
20
+ updatedAt: input.data.updated_at
21
+ ? (0, uni_time_1.asUniDateTime)(input.data.updated_at)
22
+ : undefined,
23
+ });
24
+ };
25
+ exports.castToDeclaredGithubOrgVariable = castToDeclaredGithubOrgVariable;
26
+ //# sourceMappingURL=castToDeclaredGithubOrgVariable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"castToDeclaredGithubOrgVariable.js","sourceRoot":"","sources":["../../../src/domain.operations/orgVariable/castToDeclaredGithubOrgVariable.ts"],"names":[],"mappings":";;;AAAA,iDAAmD;AAMnD,8FAA2F;AAQ3F;;;GAGG;AACI,MAAM,+BAA+B,GAAG,CAAC,KAG/C,EAA0C,EAAE;IAC3C,OAAO,qDAAyB,CAAC,EAAE,CAAC;QAClC,GAAG,EAAE,KAAK,CAAC,GAAG;QACd,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI;QACrB,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,KAAK;QACvB,UAAU,EAAE,KAAK,CAAC,IAAI,CAAC,UAA4C;QACnE,iEAAiE;QACjE,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU;YAC9B,CAAC,CAAC,IAAA,wBAAa,EAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;YACtC,CAAC,CAAC,SAAS;QACb,SAAS,EAAE,KAAK,CAAC,IAAI,CAAC,UAAU;YAC9B,CAAC,CAAC,IAAA,wBAAa,EAAC,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC;YACtC,CAAC,CAAC,SAAS;KACd,CAA2C,CAAC;AAC/C,CAAC,CAAC;AAjBW,QAAA,+BAA+B,mCAiB1C"}
@@ -0,0 +1,11 @@
1
+ import type { Ref } from 'domain-objects';
2
+ import type { VisualogicContext } from 'visualogic';
3
+ import type { ContextGithubApi } from '../../domain.objects/ContextGithubApi';
4
+ import type { DeclaredGithubOrgVariable } from '../../domain.objects/DeclaredGithubOrgVariable';
5
+ /**
6
+ * .what = deletes a GitHub Organization variable
7
+ * .why = enables declarative management of org-level variables
8
+ */
9
+ export declare const delOrgVariable: (input: {
10
+ variable: Ref<typeof DeclaredGithubOrgVariable>;
11
+ }, context: ContextGithubApi & VisualogicContext) => Promise<void>;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.delOrgVariable = 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
+ /**
8
+ * .what = deletes a GitHub Organization variable
9
+ * .why = enables declarative management of org-level variables
10
+ */
11
+ exports.delOrgVariable = (0, as_procedure_1.asProcedure)(async (input, context) => {
12
+ const github = (0, getGithubClient_1.getGithubClient)({}, context);
13
+ // extract unique key fields
14
+ const variable = input.variable;
15
+ try {
16
+ await github.actions.deleteOrgVariable({
17
+ org: variable.org.login,
18
+ name: variable.name,
19
+ });
20
+ }
21
+ catch (error) {
22
+ if (!(error instanceof Error))
23
+ throw error;
24
+ throw new helpful_errors_1.HelpfulError('github.delOrgVariable error', { cause: error });
25
+ }
26
+ });
27
+ //# sourceMappingURL=delOrgVariable.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"delOrgVariable.js","sourceRoot":"","sources":["../../../src/domain.operations/orgVariable/delOrgVariable.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAE3C,mDAA8C;AAG9C,uEAAoE;AAIpE;;;GAGG;AACU,QAAA,cAAc,GAAG,IAAA,0BAAW,EACvC,KAAK,EACH,KAA0D,EAC1D,OAA6C,EAC9B,EAAE;IACjB,MAAM,MAAM,GAAG,IAAA,iCAAe,EAAC,EAAE,EAAE,OAAO,CAAC,CAAC;IAE5C,4BAA4B;IAC5B,MAAM,QAAQ,GAAG,KAAK,CAAC,QAAoD,CAAC;IAE5E,IAAI,CAAC;QACH,MAAM,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC;YACrC,GAAG,EAAE,QAAQ,CAAC,GAAG,CAAC,KAAK;YACvB,IAAI,EAAE,QAAQ,CAAC,IAAI;SACpB,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,6BAA6B,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,CAAC;IAC1E,CAAC;AACH,CAAC,CACF,CAAC"}
@@ -0,0 +1,13 @@
1
+ import type { RefByUnique } from 'domain-objects';
2
+ import type { HasMetadata } from 'type-fns';
3
+ import type { VisualogicContext } from 'visualogic';
4
+ import type { ContextGithubApi } from '../../domain.objects/ContextGithubApi';
5
+ import type { DeclaredGithubOrg } from '../../domain.objects/DeclaredGithubOrg';
6
+ import type { DeclaredGithubOrgVariable } from '../../domain.objects/DeclaredGithubOrgVariable';
7
+ /**
8
+ * .what = gets all GitHub Organization variables
9
+ * .why = retrieves current state for declarative management
10
+ */
11
+ export declare const getAllOrgVariables: (input: {
12
+ org: RefByUnique<typeof DeclaredGithubOrg>;
13
+ }, context: ContextGithubApi & VisualogicContext) => Promise<HasMetadata<DeclaredGithubOrgVariable>[]>;