declastruct-github 1.1.1 → 1.2.1
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/access/daos/DeclaredGithubAppDao.js.map +1 -1
- package/dist/access/daos/DeclaredGithubAppInstallationDao.js.map +1 -1
- package/dist/access/daos/DeclaredGithubBranchDao.js.map +1 -1
- package/dist/access/daos/DeclaredGithubBranchProtectionDao.js.map +1 -1
- package/dist/access/daos/DeclaredGithubOrgDao.d.ts +10 -0
- package/dist/access/daos/DeclaredGithubOrgDao.js +44 -0
- package/dist/access/daos/DeclaredGithubOrgDao.js.map +1 -0
- package/dist/access/daos/DeclaredGithubOrgMemberPrivilegesDao.d.ts +10 -0
- package/dist/access/daos/DeclaredGithubOrgMemberPrivilegesDao.js +44 -0
- package/dist/access/daos/DeclaredGithubOrgMemberPrivilegesDao.js.map +1 -0
- package/dist/access/daos/DeclaredGithubOrgSecretDao.d.ts +10 -0
- package/dist/access/daos/DeclaredGithubOrgSecretDao.js +47 -0
- package/dist/access/daos/DeclaredGithubOrgSecretDao.js.map +1 -0
- package/dist/access/daos/DeclaredGithubOrgVariableDao.d.ts +9 -0
- package/dist/access/daos/DeclaredGithubOrgVariableDao.js +46 -0
- package/dist/access/daos/DeclaredGithubOrgVariableDao.js.map +1 -0
- package/dist/access/daos/DeclaredGithubRepoConfigDao.js.map +1 -1
- package/dist/access/daos/DeclaredGithubRepoDao.js.map +1 -1
- package/dist/contract/sdks/index.d.ts +4 -0
- package/dist/contract/sdks/index.js +10 -1
- package/dist/contract/sdks/index.js.map +1 -1
- package/dist/domain.objects/DeclaredGithubApp.js.map +1 -1
- package/dist/domain.objects/DeclaredGithubAppPermissions.d.ts +6 -2
- package/dist/domain.objects/DeclaredGithubAppPermissions.js.map +1 -1
- package/dist/domain.objects/DeclaredGithubOrg.d.ts +59 -0
- package/dist/domain.objects/DeclaredGithubOrg.js +15 -0
- package/dist/domain.objects/DeclaredGithubOrg.js.map +1 -0
- package/dist/domain.objects/DeclaredGithubOrgMemberPrivileges.d.ts +85 -0
- package/dist/domain.objects/DeclaredGithubOrgMemberPrivileges.js +13 -0
- package/dist/domain.objects/DeclaredGithubOrgMemberPrivileges.js.map +1 -0
- package/dist/domain.objects/DeclaredGithubOrgSecret.d.ts +63 -0
- package/dist/domain.objects/DeclaredGithubOrgSecret.js +14 -0
- package/dist/domain.objects/DeclaredGithubOrgSecret.js.map +1 -0
- package/dist/domain.objects/DeclaredGithubOrgVariable.d.ts +54 -0
- package/dist/domain.objects/DeclaredGithubOrgVariable.js +13 -0
- package/dist/domain.objects/DeclaredGithubOrgVariable.js.map +1 -0
- package/dist/domain.objects/DeclaredGithubRepo.d.ts +1 -0
- package/dist/domain.objects/DeclaredGithubRepo.js +1 -0
- package/dist/domain.objects/DeclaredGithubRepo.js.map +1 -1
- package/dist/domain.objects/DeclastructGithubProvider.d.ts +8 -0
- package/dist/domain.operations/app/castToDeclaredGithubApp.js +2 -1
- package/dist/domain.operations/app/castToDeclaredGithubApp.js.map +1 -1
- package/dist/domain.operations/app/getOneApp.js +2 -2
- package/dist/domain.operations/app/getOneApp.js.map +1 -1
- package/dist/domain.operations/app/setApp.js.map +1 -1
- package/dist/domain.operations/appInstallation/castToDeclaredGithubAppInstallation.js.map +1 -1
- package/dist/domain.operations/appInstallation/getOneAppInstallation.js +2 -2
- package/dist/domain.operations/appInstallation/getOneAppInstallation.js.map +1 -1
- package/dist/domain.operations/appInstallation/setAppInstallation.js.map +1 -1
- package/dist/domain.operations/branch/castToDeclaredGithubBranch.js.map +1 -1
- package/dist/domain.operations/branch/getBranch.js.map +1 -1
- package/dist/domain.operations/branch/getBranchCommitShaByRepoDefault.js.map +1 -1
- package/dist/domain.operations/branch/getBranches.js.map +1 -1
- package/dist/domain.operations/branch/setBranch.js.map +1 -1
- package/dist/domain.operations/branchProtection/castToDeclaredGithubBranchProtection.js.map +1 -1
- package/dist/domain.operations/branchProtection/getBranchProtection.js.map +1 -1
- package/dist/domain.operations/branchProtection/setBranchProtection.js.map +1 -1
- package/dist/domain.operations/org/castToDeclaredGithubOrg.d.ts +12 -0
- package/dist/domain.operations/org/castToDeclaredGithubOrg.js +29 -0
- package/dist/domain.operations/org/castToDeclaredGithubOrg.js.map +1 -0
- package/dist/domain.operations/org/getOneOrg.d.ts +14 -0
- package/dist/domain.operations/org/getOneOrg.js +31 -0
- package/dist/domain.operations/org/getOneOrg.js.map +1 -0
- package/dist/domain.operations/org/setOrg.d.ts +17 -0
- package/dist/domain.operations/org/setOrg.js +50 -0
- package/dist/domain.operations/org/setOrg.js.map +1 -0
- package/dist/domain.operations/orgMemberPrivileges/castToDeclaredGithubOrgMemberPrivileges.d.ts +15 -0
- package/dist/domain.operations/orgMemberPrivileges/castToDeclaredGithubOrgMemberPrivileges.js +47 -0
- package/dist/domain.operations/orgMemberPrivileges/castToDeclaredGithubOrgMemberPrivileges.js.map +1 -0
- package/dist/domain.operations/orgMemberPrivileges/getOneOrgMemberPrivileges.d.ts +14 -0
- package/dist/domain.operations/orgMemberPrivileges/getOneOrgMemberPrivileges.js +36 -0
- package/dist/domain.operations/orgMemberPrivileges/getOneOrgMemberPrivileges.js.map +1 -0
- package/dist/domain.operations/orgMemberPrivileges/setOrgMemberPrivileges.d.ts +16 -0
- package/dist/domain.operations/orgMemberPrivileges/setOrgMemberPrivileges.js +64 -0
- package/dist/domain.operations/orgMemberPrivileges/setOrgMemberPrivileges.js.map +1 -0
- package/dist/domain.operations/orgSecret/castToDeclaredGithubOrgSecret.d.ts +17 -0
- package/dist/domain.operations/orgSecret/castToDeclaredGithubOrgSecret.js +28 -0
- package/dist/domain.operations/orgSecret/castToDeclaredGithubOrgSecret.js.map +1 -0
- package/dist/domain.operations/orgSecret/delOrgSecret.d.ts +11 -0
- package/dist/domain.operations/orgSecret/delOrgSecret.js +27 -0
- package/dist/domain.operations/orgSecret/delOrgSecret.js.map +1 -0
- package/dist/domain.operations/orgSecret/getAllOrgSecrets.d.ts +14 -0
- package/dist/domain.operations/orgSecret/getAllOrgSecrets.js +27 -0
- package/dist/domain.operations/orgSecret/getAllOrgSecrets.js.map +1 -0
- package/dist/domain.operations/orgSecret/getOneOrgSecret.d.ts +15 -0
- package/dist/domain.operations/orgSecret/getOneOrgSecret.js +35 -0
- package/dist/domain.operations/orgSecret/getOneOrgSecret.js.map +1 -0
- package/dist/domain.operations/orgSecret/setOrgSecret.d.ts +17 -0
- package/dist/domain.operations/orgSecret/setOrgSecret.js +123 -0
- package/dist/domain.operations/orgSecret/setOrgSecret.js.map +1 -0
- package/dist/domain.operations/orgVariable/castToDeclaredGithubOrgVariable.d.ts +16 -0
- package/dist/domain.operations/orgVariable/castToDeclaredGithubOrgVariable.js +26 -0
- package/dist/domain.operations/orgVariable/castToDeclaredGithubOrgVariable.js.map +1 -0
- package/dist/domain.operations/orgVariable/delOrgVariable.d.ts +11 -0
- package/dist/domain.operations/orgVariable/delOrgVariable.js +27 -0
- package/dist/domain.operations/orgVariable/delOrgVariable.js.map +1 -0
- package/dist/domain.operations/orgVariable/getAllOrgVariables.d.ts +13 -0
- package/dist/domain.operations/orgVariable/getAllOrgVariables.js +28 -0
- package/dist/domain.operations/orgVariable/getAllOrgVariables.js.map +1 -0
- package/dist/domain.operations/orgVariable/getOneOrgVariable.d.ts +14 -0
- package/dist/domain.operations/orgVariable/getOneOrgVariable.js +34 -0
- package/dist/domain.operations/orgVariable/getOneOrgVariable.js.map +1 -0
- package/dist/domain.operations/orgVariable/setOrgVariable.d.ts +12 -0
- package/dist/domain.operations/orgVariable/setOrgVariable.js +69 -0
- package/dist/domain.operations/orgVariable/setOrgVariable.js.map +1 -0
- package/dist/domain.operations/provider/getDeclastructGithubProvider.js +9 -0
- package/dist/domain.operations/provider/getDeclastructGithubProvider.js.map +1 -1
- package/dist/domain.operations/repo/castToDeclaredGithubRepo.js.map +1 -1
- package/dist/domain.operations/repo/getRepo.js.map +1 -1
- package/dist/domain.operations/repo/getRepos.js +2 -2
- package/dist/domain.operations/repo/getRepos.js.map +1 -1
- package/dist/domain.operations/repo/setRepo.js.map +1 -1
- package/dist/domain.operations/repoConfig/castToDeclaredGithubRepoConfig.js.map +1 -1
- package/dist/domain.operations/repoConfig/getRepoConfig.js.map +1 -1
- package/dist/domain.operations/repoConfig/setRepoConfig.js.map +1 -1
- package/package.json +16 -13
package/dist/domain.operations/orgMemberPrivileges/castToDeclaredGithubOrgMemberPrivileges.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
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 { DeclaredGithubOrgMemberPrivileges } from '../../domain.objects/DeclaredGithubOrgMemberPrivileges';
|
|
6
|
+
type GithubOrgResponse = Endpoints['GET /orgs/{org}']['response']['data'];
|
|
7
|
+
/**
|
|
8
|
+
* .what = casts GitHub API org response to DeclaredGithubOrgMemberPrivileges
|
|
9
|
+
* .why = extracts member privilege fields from org API response
|
|
10
|
+
*/
|
|
11
|
+
export declare const castToDeclaredGithubOrgMemberPrivileges: (input: {
|
|
12
|
+
data: GithubOrgResponse;
|
|
13
|
+
org: RefByUnique<typeof DeclaredGithubOrg>;
|
|
14
|
+
}) => HasMetadata<DeclaredGithubOrgMemberPrivileges>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.castToDeclaredGithubOrgMemberPrivileges = void 0;
|
|
4
|
+
const uni_time_1 = require("@ehmpathy/uni-time");
|
|
5
|
+
const DeclaredGithubOrgMemberPrivileges_1 = require("../../domain.objects/DeclaredGithubOrgMemberPrivileges");
|
|
6
|
+
/**
|
|
7
|
+
* .what = casts GitHub API org response to DeclaredGithubOrgMemberPrivileges
|
|
8
|
+
* .why = extracts member privilege fields from org API response
|
|
9
|
+
*/
|
|
10
|
+
const castToDeclaredGithubOrgMemberPrivileges = (input) => {
|
|
11
|
+
return DeclaredGithubOrgMemberPrivileges_1.DeclaredGithubOrgMemberPrivileges.as({
|
|
12
|
+
org: input.org,
|
|
13
|
+
updatedAt: input.data.updated_at
|
|
14
|
+
? (0, uni_time_1.asUniDateTime)(input.data.updated_at)
|
|
15
|
+
: undefined,
|
|
16
|
+
// Repository creation
|
|
17
|
+
membersCanCreateRepositories: input.data.members_can_create_repositories ?? true,
|
|
18
|
+
membersCanCreatePublicRepositories: input.data.members_can_create_public_repositories ?? true,
|
|
19
|
+
membersCanCreatePrivateRepositories: input.data.members_can_create_private_repositories ?? true,
|
|
20
|
+
membersCanCreateInternalRepositories: (() => {
|
|
21
|
+
// internal repos only available for enterprise orgs
|
|
22
|
+
const isEnterprise = input.data.plan?.name
|
|
23
|
+
?.toLowerCase()
|
|
24
|
+
.includes('enterprise');
|
|
25
|
+
if (!isEnterprise)
|
|
26
|
+
return null;
|
|
27
|
+
return input.data.members_can_create_internal_repositories ?? null;
|
|
28
|
+
})(),
|
|
29
|
+
// Repository management (KEY SECURITY)
|
|
30
|
+
membersCanDeleteRepositories:
|
|
31
|
+
// Note: GitHub API uses 'members_can_delete_repositories' field
|
|
32
|
+
input.data
|
|
33
|
+
.members_can_delete_repositories ?? true,
|
|
34
|
+
membersCanChangeRepoVisibility: input.data
|
|
35
|
+
.members_can_change_repo_visibility ?? true,
|
|
36
|
+
membersCanForkPrivateRepositories: input.data.members_can_fork_private_repositories ?? false,
|
|
37
|
+
// Collaboration
|
|
38
|
+
membersCanInviteOutsideCollaborators: true, // Not directly exposed in API
|
|
39
|
+
// GitHub Pages
|
|
40
|
+
membersCanCreatePages: input.data.members_can_create_pages ?? true,
|
|
41
|
+
membersCanCreatePublicPages: input.data.members_can_create_public_pages ?? true,
|
|
42
|
+
membersCanCreatePrivatePages: input.data.members_can_create_private_pages ?? true,
|
|
43
|
+
defaultRepositoryPermission: input.data.default_repository_permission ?? 'read',
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
exports.castToDeclaredGithubOrgMemberPrivileges = castToDeclaredGithubOrgMemberPrivileges;
|
|
47
|
+
//# sourceMappingURL=castToDeclaredGithubOrgMemberPrivileges.js.map
|
package/dist/domain.operations/orgMemberPrivileges/castToDeclaredGithubOrgMemberPrivileges.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"castToDeclaredGithubOrgMemberPrivileges.js","sourceRoot":"","sources":["../../../src/domain.operations/orgMemberPrivileges/castToDeclaredGithubOrgMemberPrivileges.ts"],"names":[],"mappings":";;;AAAA,iDAAmD;AAMnD,6GAA0G;AAI1G;;;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,sEAAmE;AAInE,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,sEAAmE;AAInE,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,OAAO,CAAC,CAAC;IAE5C,sBAAsB;IACtB,MAAM,MAAM,GAAG,MAAM,IAAA,qDAAyB,EAC5C,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,GAAG,EAAE,OAAO,CAAC,GAAG,EAAE,EAAE,EAAE,EACxC,OAAO,CACR,CAAC;IAEF,iBAAiB;IACjB,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,6BAAY,CAAC,qCAAqC,EAAE;YAC5D,iBAAiB,EAAE,OAAO;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,kDAAkD;IAClD,IAAI,MAAM,IAAI,KAAK,CAAC,OAAO;QAAE,OAAO,MAAM,CAAC;IAE3C,2CAA2C;IAC3C,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC;YACxC,GAAG,EAAE,OAAO,CAAC,GAAG,CAAC,KAAK;YACtB,sBAAsB;YACtB,+BAA+B,EAAE,OAAO,CAAC,4BAA4B;YACrE,sCAAsC,EACpC,OAAO,CAAC,kCAAkC;YAC5C,uCAAuC,EACrC,OAAO,CAAC,mCAAmC;YAC7C,wCAAwC,EACtC,OAAO,CAAC,oCAAoC,IAAI,SAAS;YAC3D,wBAAwB;YACxB,uEAAuE;YACvE,iEAAiE;YACjE,qCAAqC,EACnC,OAAO,CAAC,iCAAiC;YAC3C,eAAe;YACf,wBAAwB,EAAE,OAAO,CAAC,qBAAqB;YACvD,+BAA+B,EAAE,OAAO,CAAC,2BAA2B;YACpE,gCAAgC,EAAE,OAAO,CAAC,4BAA4B;YACtE,QAAQ;YACR,6BAA6B,EAAE,OAAO,CAAC,2BAA2B;SACnE,CAAC,CAAC;QAEH,OAAO,IAAA,iFAAuC,EAAC;YAC7C,IAAI,EAAE,QAAQ,CAAC,IAAI;YACnB,GAAG,EAAE,OAAO,CAAC,GAAG;SACjB,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,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,yFAAsF;AAQtF;;;;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,sEAAmE;AAInE;;;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,sEAAmE;AAKnE,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","sour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ACF,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("../../domain.operations/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.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C,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,6FAA0F;AAQ1F;;;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>;
|