@knpkv/codecommit-core 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AwsClient/createPullRequest.d.ts +9 -0
- package/dist/AwsClient/createPullRequest.d.ts.map +1 -0
- package/dist/AwsClient/createPullRequest.js +25 -0
- package/dist/AwsClient/createPullRequest.js.map +1 -0
- package/dist/AwsClient/getCallerIdentity.d.ts +9 -0
- package/dist/AwsClient/getCallerIdentity.d.ts.map +1 -0
- package/dist/AwsClient/getCallerIdentity.js +17 -0
- package/dist/AwsClient/getCallerIdentity.js.map +1 -0
- package/dist/AwsClient/getCommentsForPullRequest.d.ts +10 -0
- package/dist/AwsClient/getCommentsForPullRequest.d.ts.map +1 -0
- package/dist/AwsClient/getCommentsForPullRequest.js +111 -0
- package/dist/AwsClient/getCommentsForPullRequest.js.map +1 -0
- package/dist/AwsClient/getPullRequest.d.ts +9 -0
- package/dist/AwsClient/getPullRequest.d.ts.map +1 -0
- package/dist/AwsClient/getPullRequest.js +74 -0
- package/dist/AwsClient/getPullRequest.js.map +1 -0
- package/dist/AwsClient/getPullRequests.d.ts +13 -0
- package/dist/AwsClient/getPullRequests.d.ts.map +1 -0
- package/dist/AwsClient/getPullRequests.js +123 -0
- package/dist/AwsClient/getPullRequests.js.map +1 -0
- package/dist/AwsClient/index.d.ts +30 -0
- package/dist/AwsClient/index.d.ts.map +1 -0
- package/dist/AwsClient/index.js +42 -0
- package/dist/AwsClient/index.js.map +1 -0
- package/dist/AwsClient/internal.d.ts +83 -0
- package/dist/AwsClient/internal.d.ts.map +1 -0
- package/dist/AwsClient/internal.js +52 -0
- package/dist/AwsClient/internal.js.map +1 -0
- package/dist/AwsClient/listBranches.d.ts +9 -0
- package/dist/AwsClient/listBranches.d.ts.map +1 -0
- package/dist/AwsClient/listBranches.js +23 -0
- package/dist/AwsClient/listBranches.js.map +1 -0
- package/dist/AwsClient/updatePullRequestDescription.d.ts +9 -0
- package/dist/AwsClient/updatePullRequestDescription.d.ts.map +1 -0
- package/dist/AwsClient/updatePullRequestDescription.js +20 -0
- package/dist/AwsClient/updatePullRequestDescription.js.map +1 -0
- package/dist/AwsClient/updatePullRequestTitle.d.ts +9 -0
- package/dist/AwsClient/updatePullRequestTitle.d.ts.map +1 -0
- package/dist/AwsClient/updatePullRequestTitle.js +20 -0
- package/dist/AwsClient/updatePullRequestTitle.js.map +1 -0
- package/dist/AwsClientConfig.d.ts +58 -0
- package/dist/AwsClientConfig.d.ts.map +1 -0
- package/dist/AwsClientConfig.js +28 -0
- package/dist/AwsClientConfig.js.map +1 -0
- package/dist/ConfigService/detectProfiles.d.ts +8 -0
- package/dist/ConfigService/detectProfiles.d.ts.map +1 -0
- package/dist/ConfigService/detectProfiles.js +21 -0
- package/dist/ConfigService/detectProfiles.js.map +1 -0
- package/dist/ConfigService/index.d.ts +21 -0
- package/dist/ConfigService/index.d.ts.map +1 -0
- package/dist/ConfigService/index.js +33 -0
- package/dist/ConfigService/index.js.map +1 -0
- package/dist/ConfigService/internal.d.ts +57 -0
- package/dist/ConfigService/internal.d.ts.map +1 -0
- package/dist/ConfigService/internal.js +55 -0
- package/dist/ConfigService/internal.js.map +1 -0
- package/dist/ConfigService/load.d.ts +18 -0
- package/dist/ConfigService/load.d.ts.map +1 -0
- package/dist/ConfigService/load.js +41 -0
- package/dist/ConfigService/load.js.map +1 -0
- package/dist/ConfigService/save.d.ts +9 -0
- package/dist/ConfigService/save.d.ts.map +1 -0
- package/dist/ConfigService/save.js +18 -0
- package/dist/ConfigService/save.js.map +1 -0
- package/dist/DateUtils.d.ts +4 -0
- package/dist/DateUtils.d.ts.map +1 -0
- package/dist/DateUtils.js +17 -0
- package/dist/DateUtils.js.map +1 -0
- package/dist/Domain.d.ts +277 -0
- package/dist/Domain.d.ts.map +1 -0
- package/dist/Domain.js +138 -0
- package/dist/Domain.js.map +1 -0
- package/dist/Errors.d.ts +135 -0
- package/dist/Errors.d.ts.map +1 -0
- package/dist/Errors.js +102 -0
- package/dist/Errors.js.map +1 -0
- package/dist/NotificationsService.d.ts +45 -0
- package/dist/NotificationsService.d.ts.map +1 -0
- package/dist/NotificationsService.js +57 -0
- package/dist/NotificationsService.js.map +1 -0
- package/dist/PRService/index.d.ts +28 -0
- package/dist/PRService/index.d.ts.map +1 -0
- package/dist/PRService/index.js +41 -0
- package/dist/PRService/index.js.map +1 -0
- package/dist/PRService/internal.d.ts +7 -0
- package/dist/PRService/internal.d.ts.map +1 -0
- package/dist/PRService/internal.js +2 -0
- package/dist/PRService/internal.js.map +1 -0
- package/dist/PRService/refresh.d.ts +10 -0
- package/dist/PRService/refresh.d.ts.map +1 -0
- package/dist/PRService/refresh.js +76 -0
- package/dist/PRService/refresh.js.map +1 -0
- package/dist/PRService/setAllAccounts.d.ts +9 -0
- package/dist/PRService/setAllAccounts.d.ts.map +1 -0
- package/dist/PRService/setAllAccounts.js +23 -0
- package/dist/PRService/setAllAccounts.js.map +1 -0
- package/dist/PRService/toggleAccount.d.ts +9 -0
- package/dist/PRService/toggleAccount.d.ts.map +1 -0
- package/dist/PRService/toggleAccount.js +29 -0
- package/dist/PRService/toggleAccount.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +27 -0
- package/dist/index.js.map +1 -0
- package/package.json +42 -0
- package/src/index.ts +27 -0
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Effect } from "effect";
|
|
2
|
+
import { AwsClientConfig } from "../AwsClientConfig.js";
|
|
3
|
+
import type { AwsProfileName, AwsRegion } from "../Domain.js";
|
|
4
|
+
import { AwsApiError, AwsCredentialError } from "../Errors.js";
|
|
5
|
+
export { AwsApiError, AwsCredentialError } from "../Errors.js";
|
|
6
|
+
export type { AwsClientError } from "../Errors.js";
|
|
7
|
+
/**
|
|
8
|
+
* Check if an error is an AWS throttling exception.
|
|
9
|
+
*/
|
|
10
|
+
export declare const isThrottlingError: (error: unknown) => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Pipe-friendly throttle retry. Reads schedule config from AwsClientConfig context.
|
|
13
|
+
*/
|
|
14
|
+
export declare const throttleRetry: <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R | AwsClientConfig>;
|
|
15
|
+
/**
|
|
16
|
+
* Normalize AWS author ARN to a human-readable name.
|
|
17
|
+
*
|
|
18
|
+
* e.g. `arn:aws:sts::...:assumed-role/Role/SessionName` → `SessionName`
|
|
19
|
+
*/
|
|
20
|
+
export declare const normalizeAuthor: (arn: string) => string;
|
|
21
|
+
/**
|
|
22
|
+
* Acquire AWS credentials for a profile.
|
|
23
|
+
* Reads credential timeout from AwsClientConfig context.
|
|
24
|
+
*/
|
|
25
|
+
export declare const acquireCredentials: (profile: AwsProfileName, region: AwsRegion) => Effect.Effect<{
|
|
26
|
+
accessKeyId: import("effect/Redacted").Redacted<string>;
|
|
27
|
+
secretAccessKey: import("effect/Redacted").Redacted<string>;
|
|
28
|
+
sessionToken: import("effect/Redacted").Redacted<string> | undefined;
|
|
29
|
+
expiration?: number | undefined;
|
|
30
|
+
}, AwsCredentialError, AwsClientConfig>;
|
|
31
|
+
/**
|
|
32
|
+
* Create a typed AwsApiError for a specific operation.
|
|
33
|
+
*/
|
|
34
|
+
export declare const makeApiError: (operation: string, profile: AwsProfileName, region: AwsRegion, cause: unknown) => AwsApiError;
|
|
35
|
+
/**
|
|
36
|
+
* Common account parameter shape.
|
|
37
|
+
*/
|
|
38
|
+
export interface AccountParams {
|
|
39
|
+
readonly profile: AwsProfileName;
|
|
40
|
+
readonly region: AwsRegion;
|
|
41
|
+
}
|
|
42
|
+
export interface CreatePullRequestParams {
|
|
43
|
+
readonly account: AccountParams;
|
|
44
|
+
readonly repositoryName: string;
|
|
45
|
+
readonly title: string;
|
|
46
|
+
readonly description?: string;
|
|
47
|
+
readonly sourceReference: string;
|
|
48
|
+
readonly destinationReference: string;
|
|
49
|
+
}
|
|
50
|
+
export interface ListBranchesParams {
|
|
51
|
+
readonly account: AccountParams;
|
|
52
|
+
readonly repositoryName: string;
|
|
53
|
+
}
|
|
54
|
+
export interface GetCommentsForPullRequestParams {
|
|
55
|
+
readonly account: AccountParams;
|
|
56
|
+
readonly pullRequestId: string;
|
|
57
|
+
readonly repositoryName: string;
|
|
58
|
+
}
|
|
59
|
+
export interface UpdatePullRequestTitleParams {
|
|
60
|
+
readonly account: AccountParams;
|
|
61
|
+
readonly pullRequestId: string;
|
|
62
|
+
readonly title: string;
|
|
63
|
+
}
|
|
64
|
+
export interface UpdatePullRequestDescriptionParams {
|
|
65
|
+
readonly account: AccountParams;
|
|
66
|
+
readonly pullRequestId: string;
|
|
67
|
+
readonly description: string;
|
|
68
|
+
}
|
|
69
|
+
export interface GetPullRequestParams {
|
|
70
|
+
readonly account: AccountParams;
|
|
71
|
+
readonly pullRequestId: string;
|
|
72
|
+
}
|
|
73
|
+
export interface PullRequestDetail {
|
|
74
|
+
readonly title: string;
|
|
75
|
+
readonly description?: string;
|
|
76
|
+
readonly author: string;
|
|
77
|
+
readonly status: string;
|
|
78
|
+
readonly repositoryName: string;
|
|
79
|
+
readonly sourceBranch: string;
|
|
80
|
+
readonly destinationBranch: string;
|
|
81
|
+
readonly creationDate: Date;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/AwsClient/internal.ts"],"names":[],"mappings":"AAOA,OAAO,EAAS,MAAM,EAAY,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE,eAAe,EAA6B,MAAM,uBAAuB,CAAA;AAClF,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAE9D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAC9D,YAAY,E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AC,OAAO,EAAE,aAAa,CAAA;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;CAChC;AAED,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAA;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;CACvB;AAED,MAAM,WAAW,kCAAkC;IACjD,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAA;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;IAC9B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAA;CAC7B;AAED,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAA;IAC/B,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAA;CAC/B;AAED,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAA;IAC/B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAA;IAC7B,QAAQ,CAAC,iBAAiB,EAAE,MAAM,CAAA;IAClC,QAAQ,CAAC,YAAY,EAAE,IAAI,CAAA;CAC5B"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared internal helpers for AwsClient methods.
|
|
3
|
+
*
|
|
4
|
+
* @internal
|
|
5
|
+
*/
|
|
6
|
+
import { fromNodeProviderChain } from "@aws-sdk/credential-providers";
|
|
7
|
+
import { Credentials } from "distilled-aws";
|
|
8
|
+
import { Cause, Effect, Schedule } from "effect";
|
|
9
|
+
import { AwsClientConfig } from "../AwsClientConfig.js";
|
|
10
|
+
import { AwsApiError, AwsCredentialError } from "../Errors.js";
|
|
11
|
+
export { AwsApiError, AwsCredentialError } from "../Errors.js";
|
|
12
|
+
/**
|
|
13
|
+
* Check if an error is an AWS throttling exception.
|
|
14
|
+
*/
|
|
15
|
+
export const isThrottlingError = (error) => {
|
|
16
|
+
const errorStr = Cause.pretty(Cause.fail(error)).toLowerCase();
|
|
17
|
+
return errorStr.includes("throttl")
|
|
18
|
+
|| errorStr.includes("rate exceed")
|
|
19
|
+
|| errorStr.includes("too many requests")
|
|
20
|
+
|| errorStr.includes("requestlimitexceeded")
|
|
21
|
+
|| errorStr.includes("slowdown")
|
|
22
|
+
|| errorStr.includes("toomanyrequestsexception");
|
|
23
|
+
};
|
|
24
|
+
const makeThrottleSchedule = (config) => Schedule.intersect(Schedule.exponential(config.retryBaseDelay, 2).pipe(Schedule.jittered), Schedule.recurs(config.maxRetries)).pipe(Schedule.upTo(config.maxRetryDelay));
|
|
25
|
+
/**
|
|
26
|
+
* Pipe-friendly throttle retry. Reads schedule config from AwsClientConfig context.
|
|
27
|
+
*/
|
|
28
|
+
export const throttleRetry = (effect) => Effect.flatMap(AwsClientConfig, (config) => effect.pipe(Effect.retry(makeThrottleSchedule(config).pipe(Schedule.whileInput((error) => isThrottlingError(error))))));
|
|
29
|
+
/**
|
|
30
|
+
* Normalize AWS author ARN to a human-readable name.
|
|
31
|
+
*
|
|
32
|
+
* e.g. `arn:aws:sts::...:assumed-role/Role/SessionName` → `SessionName`
|
|
33
|
+
*/
|
|
34
|
+
export const normalizeAuthor = (arn) => {
|
|
35
|
+
const parts = arn.split(":");
|
|
36
|
+
const identityPart = parts[parts.length - 1] ?? "";
|
|
37
|
+
const segments = identityPart.split("/");
|
|
38
|
+
return segments[segments.length - 1] || arn;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Acquire AWS credentials for a profile.
|
|
42
|
+
* Reads credential timeout from AwsClientConfig context.
|
|
43
|
+
*/
|
|
44
|
+
export const acquireCredentials = (profile, region) => Effect.flatMap(AwsClientConfig, (config) => Effect.tryPromise({
|
|
45
|
+
try: () => fromNodeProviderChain(profile === "default" ? {} : { profile })(),
|
|
46
|
+
catch: (cause) => new AwsCredentialError({ profile, region, cause })
|
|
47
|
+
}).pipe(Effect.map(Credentials.fromAwsCredentialIdentity), Effect.timeout(config.credentialTimeout), Effect.catchTag("TimeoutException", (cause) => new AwsCredentialError({ profile, region, cause }))));
|
|
48
|
+
/**
|
|
49
|
+
* Create a typed AwsApiError for a specific operation.
|
|
50
|
+
*/
|
|
51
|
+
export const makeApiError = (operation, profile, region, cause) => new AwsApiError({ operation, profile, region, cause });
|
|
52
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/AwsClient/internal.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAA;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AAChD,OAAO,EAAE,eAAe,EAA6B,MAAM,uBAAuB,CAAA;AAElF,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAE9D,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AAG9D;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAc,EAAW,EAAE;IAC3D,MAAM,QAAQ,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,WAAW,EAAE,CAAA;IAC9D,OAAO,QAAQ,CAAC,QAAQ,CAAC,SAAS,CAAC;WAC9B,QAAQ,CAAC,QAAQ,CAAC,aAAa,CAAC;WAChC,QA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,GAAG,CAAC,CAAC,IAAI,GAAG,CAAA;AAC7C,CAAC,CAAA;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,OAAuB,EAAE,MAAiB,EAAE,EAAE,CAC/E,MAAM,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,EAAE,CACzC,MAAM,CAAC,UAAU,CAAC;IAChB,GAAG,EAAE,GAAG,EAAE,CAAC,qBAAqB,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE;IAC5E,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;CACrE,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,GAAG,CAAC,WAAW,CAAC,yBAAyB,CAAC,EACjD,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,EACxC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,kBAAkB,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC,CACnG,CAAC,CAAA;AAEN;;GAEG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAiB,EAAE,OAAuB,EAAE,MAAiB,EAAE,KAAc,EAAE,EAAE,CAC5G,IAAI,WAAW,CAAC,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
import { HttpClient } from "@effect/platform";
|
|
5
|
+
import { Effect } from "effect";
|
|
6
|
+
import { AwsClientConfig } from "../AwsClientConfig.js";
|
|
7
|
+
import { type ListBranchesParams } from "./internal.js";
|
|
8
|
+
export declare const listBranches: (params: ListBranchesParams) => Effect.Effect<string[], import("./internal.js").AwsCredentialError | import("./internal.js").AwsApiError, AwsClientConfig | HttpClient.HttpClient>;
|
|
9
|
+
//# sourceMappingURL=listBranches.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listBranches.d.ts","sourceRoot":"","sources":["../../src/AwsClient/listBranches.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG7C,OAAO,EAAE,MAAM,EAAyB,MAAM,QAAQ,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAsB,KAAK,kBAAkB,EAA+B,MAAM,eAAe,CAAA;AAqBxG,eAAO,MAAM,YAAY,GAAI,QAAQ,kBAAkB,uJAuBnD,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
import { HttpClient } from "@effect/platform";
|
|
5
|
+
import { Credentials, Region } from "distilled-aws";
|
|
6
|
+
import * as codecommit from "distilled-aws/codecommit";
|
|
7
|
+
import { Effect, Layer, Option, Stream } from "effect";
|
|
8
|
+
import { AwsClientConfig } from "../AwsClientConfig.js";
|
|
9
|
+
import { acquireCredentials, makeApiError, throttleRetry } from "./internal.js";
|
|
10
|
+
const fetchBranchPages = (repositoryName) => Stream.paginateEffect(undefined, (nextToken) => codecommit.listBranches({
|
|
11
|
+
repositoryName,
|
|
12
|
+
...(nextToken && { nextToken })
|
|
13
|
+
}).pipe(Effect.map((resp) => [
|
|
14
|
+
resp.branches ?? [],
|
|
15
|
+
resp.nextToken ? Option.some(resp.nextToken) : Option.none()
|
|
16
|
+
]))).pipe(Stream.flatMap(Stream.fromIterable));
|
|
17
|
+
export const listBranches = (params) => Effect.gen(function* () {
|
|
18
|
+
const config = yield* AwsClientConfig;
|
|
19
|
+
const httpClient = yield* HttpClient.HttpClient;
|
|
20
|
+
const credentials = yield* acquireCredentials(params.account.profile, params.account.region);
|
|
21
|
+
return yield* Effect.provide(fetchBranchPages(params.repositoryName).pipe(Stream.mapError((cause) => makeApiError("listBranches", params.account.profile, params.account.region, cause)), Stream.runCollect), Layer.mergeAll(Layer.succeed(HttpClient.HttpClient, httpClient), Layer.succeed(Region.Region, params.account.region), Layer.succeed(Credentials.Credentials, credentials))).pipe(throttleRetry, Effect.map((chunk) => Array.from(chunk)), Effect.timeout(config.operationTimeout), Effect.catchTag("TimeoutException", (cause) => Effect.fail(makeApiError("listBranches", params.account.profile, params.account.region, cause))));
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=listBranches.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"listBranches.js","sourceRoot":"","sources":["../../src/AwsClient/listBranches.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,UAAU,MAAM,0BAA0B,CAAA;AACtD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACtD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAA2B,YAAY,EAAE,aAAa,EAAE,MAAM,eAAe,CAAA;AAExG,MAAM,gBAAgB,GAAG,CAAC,cAAsB,EAAE,EAAE,CAClD,MAAM,CAAC,cAAc,CACnB,SAA+B,EAC/B,CAAC,SAAS,EAAE,EAAE,CACZ,UAAU,CAAC,YAAY,CAAC;IACtB,cAAc;IACd,GAAG,CAAC,SAAS,IAAI,EAAE,SAAS,EAAE,CAAC;CAChC,CAAC,CAAC,IAAI,CACL,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAA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a,EACb,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EACxC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,EACvC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE,CAC5C,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAAC,CACnG,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
import { HttpClient } from "@effect/platform";
|
|
5
|
+
import { Effect } from "effect";
|
|
6
|
+
import { AwsClientConfig } from "../AwsClientConfig.js";
|
|
7
|
+
import { type UpdatePullRequestDescriptionParams } from "./internal.js";
|
|
8
|
+
export declare const updatePullRequestDescription: (params: UpdatePullRequestDescriptionParams) => Effect.Effect<void, import("./internal.js").AwsCredentialError | import("./internal.js").AwsApiError, AwsClientConfig | HttpClient.HttpClient>;
|
|
9
|
+
//# sourceMappingURL=updatePullRequestDescription.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updatePullRequestDescription.d.ts","sourceRoot":"","sources":["../../src/AwsClient/updatePullRequestDescription.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG7C,OAAO,EAAE,MAAM,EAAS,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAmD,KAAK,kCAAkC,EAAE,MAAM,eAAe,CAAA;AAaxH,eAAO,MAAM,4BAA4B,GACvC,QAAQ,kCAAkC,mJAsBxC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
import { HttpClient } from "@effect/platform";
|
|
5
|
+
import { Credentials, Region } from "distilled-aws";
|
|
6
|
+
import * as codecommit from "distilled-aws/codecommit";
|
|
7
|
+
import { Effect, Layer } from "effect";
|
|
8
|
+
import { AwsClientConfig } from "../AwsClientConfig.js";
|
|
9
|
+
import { acquireCredentials, makeApiError, throttleRetry } from "./internal.js";
|
|
10
|
+
const callUpdateDescription = (params) => codecommit.updatePullRequestDescription({
|
|
11
|
+
pullRequestId: params.pullRequestId,
|
|
12
|
+
description: params.description
|
|
13
|
+
}).pipe(Effect.asVoid, Effect.mapError((cause) => makeApiError("updatePullRequestDescription", params.account.profile, params.account.region, cause)));
|
|
14
|
+
export const updatePullRequestDescription = (params) => Effect.gen(function* () {
|
|
15
|
+
const config = yield* AwsClientConfig;
|
|
16
|
+
const httpClient = yield* HttpClient.HttpClient;
|
|
17
|
+
const credentials = yield* acquireCredentials(params.account.profile, params.account.region);
|
|
18
|
+
return yield* Effect.provide(callUpdateDescription(params), Layer.mergeAll(Layer.succeed(HttpClient.HttpClient, httpClient), Layer.succeed(Region.Region, params.account.region), Layer.succeed(Credentials.Credentials, credentials))).pipe(throttleRetry, Effect.timeout(config.operationTimeout), Effect.catchTag("TimeoutException", (cause) => Effect.fail(makeApiError("updatePullRequestDescription", params.account.profile, params.account.region, cause))));
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=updatePullRequestDescription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updatePullRequestDescription.js","sourceRoot":"","sources":["../../src/AwsClient/updatePullRequestDescription.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAA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,CAAC,EACnD,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,CACpD,CACF,CAAC,IAAI,CACJ,aAAa,EACb,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,EACvC,MAAM,CAAC,QAAQ,CAAC,kBAAkB,EAAE,CAAC,KAAK,EAAE,EAAE,CAC5C,MAAM,CAAC,IAAI,CACT,YAAY,CAAC,8BAA8B,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CACnG,CAAC,CACL,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
import { HttpClient } from "@effect/platform";
|
|
5
|
+
import { Effect } from "effect";
|
|
6
|
+
import { AwsClientConfig } from "../AwsClientConfig.js";
|
|
7
|
+
import { type UpdatePullRequestTitleParams } from "./internal.js";
|
|
8
|
+
export declare const updatePullRequestTitle: (params: UpdatePullRequestTitleParams) => Effect.Effect<void, import("./internal.js").AwsCredentialError | import("./internal.js").AwsApiError, AwsClientConfig | HttpClient.HttpClient>;
|
|
9
|
+
//# sourceMappingURL=updatePullRequestTitle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updatePullRequestTitle.d.ts","sourceRoot":"","sources":["../../src/AwsClient/updatePullRequestTitle.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAG7C,OAAO,EAAE,MAAM,EAAS,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAmD,KAAK,4BAA4B,EAAE,MAAM,eAAe,CAAA;AAalH,eAAO,MAAM,sBAAsB,GAAI,QAAQ,4BAA4B,mJAsBvE,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
import { HttpClient } from "@effect/platform";
|
|
5
|
+
import { Credentials, Region } from "distilled-aws";
|
|
6
|
+
import * as codecommit from "distilled-aws/codecommit";
|
|
7
|
+
import { Effect, Layer } from "effect";
|
|
8
|
+
import { AwsClientConfig } from "../AwsClientConfig.js";
|
|
9
|
+
import { acquireCredentials, makeApiError, throttleRetry } from "./internal.js";
|
|
10
|
+
const callUpdateTitle = (params) => codecommit.updatePullRequestTitle({
|
|
11
|
+
pullRequestId: params.pullRequestId,
|
|
12
|
+
title: params.title
|
|
13
|
+
}).pipe(Effect.asVoid, Effect.mapError((cause) => makeApiError("updatePullRequestTitle", params.account.profile, params.account.region, cause)));
|
|
14
|
+
export const updatePullRequestTitle = (params) => Effect.gen(function* () {
|
|
15
|
+
const config = yield* AwsClientConfig;
|
|
16
|
+
const httpClient = yield* HttpClient.HttpClient;
|
|
17
|
+
const credentials = yield* acquireCredentials(params.account.profile, params.account.region);
|
|
18
|
+
return yield* Effect.provide(callUpdateTitle(params), Layer.mergeAll(Layer.succeed(HttpClient.HttpClient, httpClient), Layer.succeed(Region.Region, params.account.region), Layer.succeed(Credentials.Credentials, credentials))).pipe(throttleRetry, Effect.timeout(config.operationTimeout), Effect.catchTag("TimeoutException", (cause) => Effect.fail(makeApiError("updatePullRequestTitle", params.account.profile, params.account.region, cause))));
|
|
19
|
+
});
|
|
20
|
+
//# sourceMappingURL=updatePullRequestTitle.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"updatePullRequestTitle.js","sourceRoot":"","sources":["../../src/AwsClient/updatePullRequestTitle.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAA;AACnD,OAAO,KAAK,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EACnD,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,WAAW,EAAE,WAAW,CAAC,CACpD,CACF,CAAC,IAAI,CACJ,aAAa,EACb,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,gBAAgB,CAAC,EACvC,MAAM,CAAC,QAAQ,CACb,kBAAkB,EAClB,CAAC,KAAK,EAAE,EAAE,CACR,MAAM,CAAC,IAAI,CAAC,YAAY,CAAC,wBAAwB,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,CAC5G,CACF,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Centralized configuration for AWS client timeouts and retry behavior.
|
|
3
|
+
*
|
|
4
|
+
* Replaces all hardcoded timeout/retry values scattered across AwsClient.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* import { AwsClientConfig } from "@knpkv/codecommit-core"
|
|
9
|
+
*
|
|
10
|
+
* // Use defaults
|
|
11
|
+
* const layer = AwsClientConfig.Default
|
|
12
|
+
*
|
|
13
|
+
* // Custom overrides
|
|
14
|
+
* const layer = AwsClientConfig.layer({
|
|
15
|
+
* credentialTimeout: "10 seconds",
|
|
16
|
+
* maxRetries: 3
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @category Config
|
|
21
|
+
* @module
|
|
22
|
+
*/
|
|
23
|
+
import type { Duration } from "effect";
|
|
24
|
+
import { Context, Layer } from "effect";
|
|
25
|
+
/**
|
|
26
|
+
* Shape of the AWS client configuration.
|
|
27
|
+
*
|
|
28
|
+
* @category Config
|
|
29
|
+
*/
|
|
30
|
+
export interface AwsClientConfigShape {
|
|
31
|
+
readonly credentialTimeout: Duration.DurationInput;
|
|
32
|
+
readonly operationTimeout: Duration.DurationInput;
|
|
33
|
+
readonly streamTimeout: Duration.DurationInput;
|
|
34
|
+
readonly refreshTimeout: Duration.DurationInput;
|
|
35
|
+
readonly maxRetries: number;
|
|
36
|
+
readonly retryBaseDelay: Duration.DurationInput;
|
|
37
|
+
readonly maxRetryDelay: Duration.DurationInput;
|
|
38
|
+
}
|
|
39
|
+
declare const AwsClientConfig_base: Context.TagClass<AwsClientConfig, "@knpkv/codecommit-core/AwsClientConfig", AwsClientConfigShape>;
|
|
40
|
+
/**
|
|
41
|
+
* AWS client configuration service.
|
|
42
|
+
*
|
|
43
|
+
* Provides timeout and retry settings consumed by AwsClient methods.
|
|
44
|
+
*
|
|
45
|
+
* @category Config
|
|
46
|
+
*/
|
|
47
|
+
export declare class AwsClientConfig extends AwsClientConfig_base {
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Default configuration with production-ready values.
|
|
51
|
+
*/
|
|
52
|
+
export declare const Default: Layer.Layer<AwsClientConfig>;
|
|
53
|
+
/**
|
|
54
|
+
* Create a configuration layer with custom overrides.
|
|
55
|
+
*/
|
|
56
|
+
export declare const layer: (overrides: Partial<AwsClientConfigShape>) => Layer.Layer<AwsClientConfig>;
|
|
57
|
+
export {};
|
|
58
|
+
//# sourceMappingURL=AwsClientConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AwsClientConfig.d.ts","sourceRoot":"","sources":["../src/AwsClientConfig.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAA;AACtC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAEvC;;;;GAIG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,iBAAiB,EAAE,QAAQ,CAAC,aAAa,CAAA;IAClD,QAAQ,CAAC,gBAAgB,EAAE,QAAQ,CAAC,aAAa,CAAA;IACjD,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,aAAa,CAAA;IAC9C,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,aAAa,CAAA;IAC/C,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAA;IAC3B,QAAQ,CAAC,cAAc,EAAE,QAAQ,CAAC,aAAa,CAAA;IAC/C,QAAQ,CAAC,aAAa,EAAE,QAAQ,CAAC,aAAa,CAAA;CAC/C;;AAED;;;;;;GAMG;AACH,qBAAa,eAAgB,SAAQ,oBAGlC;CAAG;AAYN;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,KAAK,CAAC,KAAK,CAAC,eAAe,CAA4C,CAAA;AAE7F;;GAEG;AACH,eAAO,MAAM,KAAK,GAAI,WAAW,OAAO,CAAC,oBAAoB,CAAC,KAAG,KAAK,CAAC,KAAK,CAAC,eAAe,CAC7B,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Context, Layer } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* AWS client configuration service.
|
|
4
|
+
*
|
|
5
|
+
* Provides timeout and retry settings consumed by AwsClient methods.
|
|
6
|
+
*
|
|
7
|
+
* @category Config
|
|
8
|
+
*/
|
|
9
|
+
export class AwsClientConfig extends Context.Tag("@knpkv/codecommit-core/AwsClientConfig")() {
|
|
10
|
+
}
|
|
11
|
+
const defaults = {
|
|
12
|
+
credentialTimeout: "5 seconds",
|
|
13
|
+
operationTimeout: "30 seconds",
|
|
14
|
+
streamTimeout: "60 seconds",
|
|
15
|
+
refreshTimeout: "120 seconds",
|
|
16
|
+
maxRetries: 10,
|
|
17
|
+
retryBaseDelay: "2 seconds",
|
|
18
|
+
maxRetryDelay: "60 seconds"
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Default configuration with production-ready values.
|
|
22
|
+
*/
|
|
23
|
+
export const Default = Layer.succeed(AwsClientConfig, defaults);
|
|
24
|
+
/**
|
|
25
|
+
* Create a configuration layer with custom overrides.
|
|
26
|
+
*/
|
|
27
|
+
export const layer = (overrides) => Layer.succeed(AwsClientConfig, { ...defaults, ...overrides });
|
|
28
|
+
//# sourceMappingURL=AwsClientConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AwsClientConfig.js","sourceRoot":"","sources":["../src/AwsClientConfig.ts"],"names":[],"mappings":"AAuBA,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AAiBvC;;;;;;GAMG;AACH,MAAM,OAAO,eAAgB,SAAQ,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,EAGvF;CAAG;AAEN,MAAM,QAAQ,GAAyB;IACrC,iBAAiB,EAAE,WAAW;IAC9B,gBAAgB,EAAE,YAAY;IAC9B,aAAa,EAAE,YAAY;IAC3B,cAAc,EAAE,aAAa;IAC7B,UAAU,EAAE,EAAE;IACd,cAAc,EAAE,WAAW;IAC3B,aAAa,EAAE,YAAY;CAC5B,CAAA;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,OAAO,GAAiC,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,QAAQ,CAAC,CAAA;AAE7F;;GAEG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,SAAwC,EAAgC,EAAE,CAC9F,KAAK,CAAC,OAAO,CAAC,eAAe,EAAE,EAAE,GAAG,QAAQ,EAAE,GAAG,SAAS,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
import { FileSystem, Path } from "@effect/platform";
|
|
5
|
+
import { Effect } from "effect";
|
|
6
|
+
import { ConfigPaths } from "./internal.js";
|
|
7
|
+
export declare const detectProfiles: Effect.Effect<import("./internal.js").DetectedProfile[], import("../Errors.ts").ProfileDetectionError, ConfigPaths | Path.Path | FileSystem.FileSystem>;
|
|
8
|
+
//# sourceMappingURL=detectProfiles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectProfiles.d.ts","sourceRoot":"","sources":["../../src/ConfigService/detectProfiles.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACnD,OAAO,EAAgB,MAAM,EAAiB,MAAM,QAAQ,CAAA;AAC5D,OAAO,EAAE,WAAW,EAAkB,MAAM,eAAe,CAAA;AAE3D,eAAO,MAAM,cAAc,yJA0B6B,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
import { FileSystem, Path } from "@effect/platform";
|
|
5
|
+
import { Array as Arr, Effect, HashMap, pipe } from "effect";
|
|
6
|
+
import { ConfigPaths, parseAwsConfig } from "./internal.js";
|
|
7
|
+
export const detectProfiles = Effect.gen(function* () {
|
|
8
|
+
const fs = yield* FileSystem.FileSystem;
|
|
9
|
+
const path = yield* Path.Path;
|
|
10
|
+
const paths = yield* ConfigPaths;
|
|
11
|
+
const home = yield* paths.homePath;
|
|
12
|
+
const configPath = path.join(home, ".aws", "config");
|
|
13
|
+
const credsPath = path.join(home, ".aws", "credentials");
|
|
14
|
+
const read = (p) => fs.readFileString(p).pipe(Effect.catchAll(() => Effect.succeed("")));
|
|
15
|
+
const [configContent, credsContent] = yield* Effect.all([read(configPath), read(credsPath)]);
|
|
16
|
+
const profiles = [...parseAwsConfig(configContent), ...parseAwsConfig(credsContent)];
|
|
17
|
+
return pipe(profiles, Arr.reduce(HashMap.empty(), (map, p) => HashMap.has(map, p.name) && p.region === "us-east-1"
|
|
18
|
+
? map
|
|
19
|
+
: HashMap.set(map, p.name, p)), HashMap.values, Arr.fromIterable);
|
|
20
|
+
}).pipe(Effect.withSpan("ConfigService.detectProfiles"));
|
|
21
|
+
//# sourceMappingURL=detectProfiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detectProfiles.js","sourceRoot":"","sources":["../../src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Ac,CAAC,YAAY,CAAC,CAAC,CAAA;IAEpF,OAAO,IAAI,CACT,QAAQ,EACR,GAAG,CAAC,MAAM,CACR,OAAO,CAAC,KAAK,EAAmC,EAChD,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE,CACT,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,KAAK,WAAW;QAClD,CAAC,CAAC,GAAG;QACL,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAClC,EACD,OAAO,CAAC,MAAM,EACd,GAAG,CAAC,YAAY,CACjB,CAAA;AACH,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,8BAA8B,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration service for CodeCommit application.
|
|
3
|
+
*
|
|
4
|
+
* @category Config
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
import type { FileSystem, Path } from "@effect/platform";
|
|
8
|
+
import { Context, Effect, Layer } from "effect";
|
|
9
|
+
import { ConfigError, ProfileDetectionError } from "../Errors.js";
|
|
10
|
+
import type { ConfigParseError } from "../Errors.js";
|
|
11
|
+
import type { DetectedProfile, TuiConfig } from "./internal.js";
|
|
12
|
+
export { AccountConfig, DetectedProfile, TuiConfig } from "./internal.js";
|
|
13
|
+
declare const ConfigService_base: Context.TagClass<ConfigService, "@knpkv/codecommit-core/ConfigService", {
|
|
14
|
+
readonly load: Effect.Effect<TuiConfig, ConfigError | ConfigParseError>;
|
|
15
|
+
readonly save: (config: TuiConfig) => Effect.Effect<void, ConfigError>;
|
|
16
|
+
readonly detectProfiles: Effect.Effect<ReadonlyArray<DetectedProfile>, ProfileDetectionError>;
|
|
17
|
+
}>;
|
|
18
|
+
export declare class ConfigService extends ConfigService_base {
|
|
19
|
+
}
|
|
20
|
+
export declare const ConfigServiceLive: Layer.Layer<ConfigService, never, Path.Path | FileSystem.FileSystem>;
|
|
21
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ConfigService/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACxD,OAAO,EAAU,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAA;AACvD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AACjE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAEpD,OAAO,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAK/D,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;;mBAStD,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,WAAW,GAAG,gBAAgB,CAAC;mBACxD,CAAC,MAAM,EAAE,SAAS,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,WAAW,CAAC;6BAC7C,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,eAAe,CAAC,EAAE,qBAAqB,CAAC;;AALjG,qBAAa,aAAc,SAAQ,kBAOhC;CAAG;AAoCN,eAAO,MAAM,iBAAiB,sEAgBQ,CAAA"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Config, Context, Effect, Layer } from "effect";
|
|
2
|
+
import { ConfigError, ProfileDetectionError } from "../Errors.js";
|
|
3
|
+
import { detectProfiles } from "./detectProfiles.js";
|
|
4
|
+
import { ConfigPaths } from "./internal.js";
|
|
5
|
+
import { makeLoad } from "./load.js";
|
|
6
|
+
import { save } from "./save.js";
|
|
7
|
+
export { AccountConfig, DetectedProfile, TuiConfig } from "./internal.js";
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Service Definition
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
export class ConfigService extends Context.Tag("@knpkv/codecommit-core/ConfigService")() {
|
|
12
|
+
}
|
|
13
|
+
// ---------------------------------------------------------------------------
|
|
14
|
+
// Live Implementation
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
const ConfigPathsLive = Layer.effect(ConfigPaths, Effect.gen(function* () {
|
|
17
|
+
const getConfigPath = Config.string("HOME").pipe(Config.map((h) => `${h}/.codecommit/config.json`), Config.orElse(() => Config.string("USERPROFILE").pipe(Config.map((h) => `${h}/.codecommit/config.json`))));
|
|
18
|
+
const getHomePath = Config.string("HOME").pipe(Config.orElse(() => Config.string("USERPROFILE")));
|
|
19
|
+
const configPath = Effect.configProviderWith((provider) => provider.load(getConfigPath)).pipe(Effect.catchAll(() => Effect.fail(new ConfigError({ message: "Could not determine home directory (HOME/USERPROFILE)" }))));
|
|
20
|
+
const homePath = Effect.configProviderWith((provider) => provider.load(getHomePath)).pipe(Effect.catchAll(() => Effect.fail(new ProfileDetectionError({ message: "Could not determine home directory" }))));
|
|
21
|
+
return { configPath, homePath };
|
|
22
|
+
}));
|
|
23
|
+
export const ConfigServiceLive = Layer.effect(ConfigService, Effect.gen(function* () {
|
|
24
|
+
const ctx = yield* Effect.context();
|
|
25
|
+
const provide = (effect) => Effect.provide(effect, ctx);
|
|
26
|
+
const load = makeLoad(detectProfiles);
|
|
27
|
+
return {
|
|
28
|
+
load: provide(load),
|
|
29
|
+
save: (config) => provide(save(config)),
|
|
30
|
+
detectProfiles: provide(detectProfiles)
|
|
31
|
+
};
|
|
32
|
+
})).pipe(Layer.provide(ConfigPathsLive));
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/ConfigService/index.ts"],"names":[],"mappings":"AA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AC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @internal
|
|
3
|
+
*/
|
|
4
|
+
import type { Effect } from "effect";
|
|
5
|
+
import { Context, Schema } from "effect";
|
|
6
|
+
import type { ConfigError, ProfileDetectionError } from "../Errors.js";
|
|
7
|
+
declare const DetectedProfile_base: Schema.Class<DetectedProfile, {
|
|
8
|
+
name: Schema.filter<Schema.brand<typeof Schema.String, "AwsProfileName">>;
|
|
9
|
+
region: Schema.optionalWith<Schema.brand<typeof Schema.String, "AwsRegion">, {
|
|
10
|
+
exact: true;
|
|
11
|
+
}>;
|
|
12
|
+
}, Schema.Struct.Encoded<{
|
|
13
|
+
name: Schema.filter<Schema.brand<typeof Schema.String, "AwsProfileName">>;
|
|
14
|
+
region: Schema.optionalWith<Schema.brand<typeof Schema.String, "AwsRegion">, {
|
|
15
|
+
exact: true;
|
|
16
|
+
}>;
|
|
17
|
+
}>, never, {
|
|
18
|
+
readonly region?: string & import("effect/Brand").Brand<"AwsRegion">;
|
|
19
|
+
} & {
|
|
20
|
+
readonly name: string & import("effect/Brand").Brand<"AwsProfileName">;
|
|
21
|
+
}, {}, {}>;
|
|
22
|
+
export declare class DetectedProfile extends DetectedProfile_base {
|
|
23
|
+
}
|
|
24
|
+
export declare const AccountConfig: Schema.Struct<{
|
|
25
|
+
profile: Schema.brand<typeof Schema.String, "AwsProfileName">;
|
|
26
|
+
regions: Schema.optionalWith<Schema.Array$<Schema.brand<typeof Schema.String, "AwsRegion">>, {
|
|
27
|
+
default: () => (string & import("effect/Brand").Brand<"AwsRegion">)[];
|
|
28
|
+
}>;
|
|
29
|
+
enabled: Schema.optionalWith<typeof Schema.Boolean, {
|
|
30
|
+
default: () => true;
|
|
31
|
+
}>;
|
|
32
|
+
}>;
|
|
33
|
+
export type AccountConfig = typeof AccountConfig.Type;
|
|
34
|
+
export declare const TuiConfig: Schema.Struct<{
|
|
35
|
+
accounts: Schema.Array$<Schema.Struct<{
|
|
36
|
+
profile: Schema.brand<typeof Schema.String, "AwsProfileName">;
|
|
37
|
+
regions: Schema.optionalWith<Schema.Array$<Schema.brand<typeof Schema.String, "AwsRegion">>, {
|
|
38
|
+
default: () => (string & import("effect/Brand").Brand<"AwsRegion">)[];
|
|
39
|
+
}>;
|
|
40
|
+
enabled: Schema.optionalWith<typeof Schema.Boolean, {
|
|
41
|
+
default: () => true;
|
|
42
|
+
}>;
|
|
43
|
+
}>>;
|
|
44
|
+
autoDetect: Schema.optionalWith<typeof Schema.Boolean, {
|
|
45
|
+
default: () => true;
|
|
46
|
+
}>;
|
|
47
|
+
}>;
|
|
48
|
+
export type TuiConfig = typeof TuiConfig.Type;
|
|
49
|
+
export declare const parseAwsConfig: (content: string) => ReadonlyArray<DetectedProfile>;
|
|
50
|
+
declare const ConfigPaths_base: Context.TagClass<ConfigPaths, "@knpkv/codecommit-core/ConfigPaths", {
|
|
51
|
+
readonly configPath: Effect.Effect<string, ConfigError>;
|
|
52
|
+
readonly homePath: Effect.Effect<string, ProfileDetectionError>;
|
|
53
|
+
}>;
|
|
54
|
+
export declare class ConfigPaths extends ConfigPaths_base {
|
|
55
|
+
}
|
|
56
|
+
export {};
|
|
57
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/ConfigService/internal.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACpC,OAAO,EAAgB,OAAO,EAAgB,MAAM,EAAE,MAAM,QAAQ,CAAA;AAEpE,OAAO,KAAK,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;;;;;;;;;;;;;;;;AAMtE,qBAAa,eAAgB,SAAQ,oBAGnC;CAAG;AAEL,eAAO,MAAM,aAAa;;;;;;;;EAIxB,CAAA;AAEF,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AAErD,eAAO,MAAM,SAAS;;;;;;;;;;;;;EAGpB,CAAA;AAEF,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAA;AAqC7C,eAAO,MAAM,cAAc,GAAI,SAAS,MAAM,KAAG,aAAa,CAAC,eAAe,CAK3E,CAAA;;yBASsB,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC;uBACpC,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAAC;;AAJnE,qBAAa,WAAY,SAAQ,gBAM9B;CAAG"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Array as Arr, Context, Either, pipe, Schema } from "effect";
|
|
2
|
+
import { AwsProfileName, AwsRegion } from "../Domain.js";
|
|
3
|
+
// ---------------------------------------------------------------------------
|
|
4
|
+
// Schemas
|
|
5
|
+
// ---------------------------------------------------------------------------
|
|
6
|
+
export class DetectedProfile extends Schema.Class("DetectedProfile")({
|
|
7
|
+
name: AwsProfileName.pipe(Schema.nonEmptyString()),
|
|
8
|
+
region: Schema.optionalWith(AwsRegion, { exact: true })
|
|
9
|
+
}) {
|
|
10
|
+
}
|
|
11
|
+
export const AccountConfig = Schema.Struct({
|
|
12
|
+
profile: AwsProfileName,
|
|
13
|
+
regions: Schema.Array(AwsRegion).pipe(Schema.optionalWith({ default: () => ["us-east-1"] })),
|
|
14
|
+
enabled: Schema.Boolean.pipe(Schema.optionalWith({ default: () => true }))
|
|
15
|
+
});
|
|
16
|
+
export const TuiConfig = Schema.Struct({
|
|
17
|
+
accounts: Schema.Array(AccountConfig),
|
|
18
|
+
autoDetect: Schema.Boolean.pipe(Schema.optionalWith({ default: () => true }))
|
|
19
|
+
});
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// INI Parsing (Schema-validated)
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
const decodeDetectedProfile = Schema.decodeUnknownEither(DetectedProfile);
|
|
24
|
+
const parseIniSections = (content) => {
|
|
25
|
+
const lines = content.split("\n");
|
|
26
|
+
const sections = [];
|
|
27
|
+
let current = null;
|
|
28
|
+
for (const line of lines) {
|
|
29
|
+
const trimmed = line.trim();
|
|
30
|
+
if (!trimmed || trimmed.startsWith("#") || trimmed.startsWith(";"))
|
|
31
|
+
continue;
|
|
32
|
+
const profileMatch = trimmed.match(/^\[(?:profile\s+)?(.+)\]$/);
|
|
33
|
+
if (profileMatch?.[1]) {
|
|
34
|
+
if (current)
|
|
35
|
+
sections.push(current);
|
|
36
|
+
current = { name: profileMatch[1].trim() };
|
|
37
|
+
}
|
|
38
|
+
else if (current && trimmed.includes("=")) {
|
|
39
|
+
const [key, ...valueParts] = trimmed.split("=");
|
|
40
|
+
if (key?.trim().toLowerCase() === "region") {
|
|
41
|
+
current.region = valueParts.join("=").trim();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
if (current)
|
|
46
|
+
sections.push(current);
|
|
47
|
+
return sections;
|
|
48
|
+
};
|
|
49
|
+
export const parseAwsConfig = (content) => pipe(parseIniSections(content), Arr.filterMap((section) => Either.getRight(decodeDetectedProfile(section))), Arr.dedupeWith((a, b) => a.name === b.name));
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Internal service: resolved config paths
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
export class ConfigPaths extends Context.Tag("@knpkv/codecommit-core/ConfigPaths")() {
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=internal.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../../src/ConfigService/internal.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,IAAI,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC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