@usine/github 0.1.0 → 0.1.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/README.md +14 -4
- package/dist/access.d.ts +48 -0
- package/dist/access.d.ts.map +1 -0
- package/dist/access.js +53 -0
- package/dist/access.js.map +1 -0
- package/dist/credentials.d.ts +28 -0
- package/dist/credentials.d.ts.map +1 -0
- package/dist/credentials.js +22 -0
- package/dist/credentials.js.map +1 -0
- package/dist/error.d.ts +36 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/error.js +48 -0
- package/dist/error.js.map +1 -0
- package/dist/github-app.d.ts +17 -10
- package/dist/github-app.d.ts.map +1 -1
- package/dist/github-app.js +31 -16
- package/dist/github-app.js.map +1 -1
- package/dist/http.d.ts +3 -4
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +4 -4
- package/dist/http.js.map +1 -1
- package/dist/installation.d.ts +48 -0
- package/dist/installation.d.ts.map +1 -0
- package/dist/installation.js +40 -0
- package/dist/installation.js.map +1 -0
- package/dist/item-writer.d.ts +7 -6
- package/dist/item-writer.d.ts.map +1 -1
- package/dist/item-writer.js +5 -4
- package/dist/item-writer.js.map +1 -1
- package/dist/jwt.d.ts +6 -5
- package/dist/jwt.d.ts.map +1 -1
- package/dist/jwt.js +4 -4
- package/dist/jwt.js.map +1 -1
- package/dist/label-writer.d.ts +23 -0
- package/dist/label-writer.d.ts.map +1 -0
- package/dist/label-writer.js +54 -0
- package/dist/label-writer.js.map +1 -0
- package/dist/local-secrets.d.ts +5 -5
- package/dist/local-secrets.d.ts.map +1 -1
- package/dist/local-secrets.js +5 -5
- package/dist/local-secrets.js.map +1 -1
- package/dist/polling/content.d.ts +3 -0
- package/dist/polling/content.d.ts.map +1 -0
- package/dist/polling/content.js +24 -0
- package/dist/polling/content.js.map +1 -0
- package/dist/polling/detection.d.ts +55 -0
- package/dist/polling/detection.d.ts.map +1 -0
- package/dist/polling/detection.js +49 -0
- package/dist/polling/detection.js.map +1 -0
- package/dist/polling/labels.d.ts +31 -0
- package/dist/polling/labels.d.ts.map +1 -0
- package/dist/polling/labels.js +29 -0
- package/dist/polling/labels.js.map +1 -0
- package/dist/polling/{model.d.ts → payload.d.ts} +7 -66
- package/dist/polling/payload.d.ts.map +1 -0
- package/dist/polling/{model.js → payload.js} +12 -72
- package/dist/polling/payload.js.map +1 -0
- package/dist/polling/polling.d.ts +15 -9
- package/dist/polling/polling.d.ts.map +1 -1
- package/dist/polling/polling.js +49 -44
- package/dist/polling/polling.js.map +1 -1
- package/package.json +17 -5
- package/dist/index.d.ts +0 -7
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -7
- package/dist/index.js.map +0 -1
- package/dist/model.d.ts +0 -128
- package/dist/model.d.ts.map +0 -1
- package/dist/model.js +0 -133
- package/dist/model.js.map +0 -1
- package/dist/polling/model.d.ts.map +0 -1
- package/dist/polling/model.js.map +0 -1
package/dist/http.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAA2B,MAAM,sBAAsB,CAAC;AAElF,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,0BAA0B,GAE3B,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,QAAQ,GAAG,wBAAwB,CAAC;AACjD,MAAM,
|
|
1
|
+
{"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAA2B,MAAM,sBAAsB,CAAC;AAElF,OAAO,EACL,cAAc,EACd,oBAAoB,EACpB,0BAA0B,GAE3B,MAAM,YAAY,CAAC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AAQ,CAAC,MAAM,KAAK,GAAG,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC;QACnF,CAAC,CAAC,IAAI,oBAAoB,CAAC;YACvB,SAAS;YACT,OAAO,EAAE,OAAO,CAAC,KAAK;YACtB,OAAO,EAAE,iDAAiD;SAC3D,CAAC;QACJ,CAAC,CAAC,IAAI,cAAc,CAAC;YACjB,SAAS;YACT,MAAM,EAAE,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC;YACpC,OAAO,EAAE,2CAA2C,QAAQ,CAAC,MAAM,EAAE;SACtE,CAAC,CAAC;AACT,CAAC,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** The numeric identity of an installation of the factory's GitHub App. */
|
|
3
|
+
export declare const InstallationId: Schema.brand<Schema.Int, "GitHubInstallationId">;
|
|
4
|
+
export type InstallationId = typeof InstallationId.Type;
|
|
5
|
+
/** GitHub's numeric repository identity, used to restrict installation tokens. */
|
|
6
|
+
export declare const RepositoryId: Schema.brand<Schema.Int, "GitHubRepositoryId">;
|
|
7
|
+
export type RepositoryId = typeof RepositoryId.Type;
|
|
8
|
+
declare const Installation_base: Schema.Class<Installation, Schema.Struct<{
|
|
9
|
+
readonly id: Schema.brand<Schema.Int, "GitHubInstallationId">;
|
|
10
|
+
readonly accountLogin: Schema.NonEmptyString;
|
|
11
|
+
}>, {}>;
|
|
12
|
+
/** The discovered App installation and the account that owns it. */
|
|
13
|
+
export declare class Installation extends Installation_base {
|
|
14
|
+
}
|
|
15
|
+
declare const InstallationWide_base: Schema.Class<InstallationWide, Schema.TaggedStruct<"InstallationWide", {}>, {}>;
|
|
16
|
+
/** Token access to every repository covered by the installation. */
|
|
17
|
+
export declare class InstallationWide extends InstallationWide_base {
|
|
18
|
+
}
|
|
19
|
+
declare const SingleRepository_base: Schema.Class<SingleRepository, Schema.TaggedStruct<"SingleRepository", {
|
|
20
|
+
readonly repository: Schema.brand<Schema.String, "RepositoryName">;
|
|
21
|
+
readonly repositoryId: Schema.brand<Schema.Int, "GitHubRepositoryId">;
|
|
22
|
+
}>, {}>;
|
|
23
|
+
/** Token access restricted to the repository assigned to one Attempt. */
|
|
24
|
+
export declare class SingleRepository extends SingleRepository_base {
|
|
25
|
+
}
|
|
26
|
+
/** The repository coverage requested when minting an installation token. */
|
|
27
|
+
export declare const TokenScope: Schema.Union<readonly [typeof InstallationWide, typeof SingleRepository]>;
|
|
28
|
+
export type TokenScope = typeof TokenScope.Type;
|
|
29
|
+
declare const InstallationToken_base: Schema.Class<InstallationToken, Schema.Struct<{
|
|
30
|
+
readonly value: Schema.Redacted<Schema.NonEmptyString>;
|
|
31
|
+
readonly expiresAt: Schema.DateTimeUtc;
|
|
32
|
+
readonly scope: Schema.Union<readonly [typeof InstallationWide, typeof SingleRepository]>;
|
|
33
|
+
}>, {}>;
|
|
34
|
+
/** A redacted installation credential with its expiry and permitted repository scope. */
|
|
35
|
+
export declare class InstallationToken extends InstallationToken_base {
|
|
36
|
+
}
|
|
37
|
+
/** Why App installation discovery could not select one usable installation. */
|
|
38
|
+
export declare const InstallationDiscoveryReason: Schema.Literals<readonly ["missing", "multiple", "suspended"]>;
|
|
39
|
+
export type InstallationDiscoveryReason = typeof InstallationDiscoveryReason.Type;
|
|
40
|
+
declare const InstallationDiscoveryError_base: Schema.Class<InstallationDiscoveryError, Schema.TaggedStruct<"InstallationDiscoveryError", {
|
|
41
|
+
readonly reason: Schema.Literals<readonly ["missing", "multiple", "suspended"]>;
|
|
42
|
+
readonly message: Schema.NonEmptyString;
|
|
43
|
+
}>, import("effect/Cause").YieldableError>;
|
|
44
|
+
/** The App has no unambiguous active installation to use for repository access. */
|
|
45
|
+
export declare class InstallationDiscoveryError extends InstallationDiscoveryError_base {
|
|
46
|
+
}
|
|
47
|
+
export {};
|
|
48
|
+
//# sourceMappingURL=installation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installation.d.ts","sourceRoot":"","sources":["../src/installation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,2EAA2E;AAC3E,eAAO,MAAM,cAAc,kDAAyD,CAAC;AACrF,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAC;AAExD,kFAAkF;AAClF,eAAO,MAAM,YAAY,gDAAuD,CAAC;AACjF,MAAM,MAAM,YAAY,GAAG,OAAO,YAAY,CAAC,IAAI,CAAC;;;;;AAEpD,oEAAoE;AACpE,qBAAa,YAAa,SAAQ,iBAGhC;CAAG;;AAEL,oEAAoE;AACpE,qBAAa,gBAAiB,SAAQ,qBAEb;CAAG;;;;;AAE5B,yEAAyE;AACzE,qBAAa,gBAAiB,SAAQ,qBAKpC;CAAG;AAEL,4EAA4E;AAC5E,eAAO,MAAM,UAAU,2EAAqD,CAAC;AAC7E,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAC;;;;;;AAEhD,yFAAyF;AACzF,qBAAa,iBAAkB,SAAQ,sBAMrC;CAAG;AAEL,+EAA+E;AAC/E,eAAO,MAAM,2BAA2B,gEAAwD,CAAC;AACjG,MAAM,MAAM,2BAA2B,GAAG,OAAO,2BAA2B,CAAC,IAAI,CAAC;;;;;AAElF,mFAAmF;AACnF,qBAAa,0BAA2B,SAAQ,+BAK9C;CAAG"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { RepositoryName } from "@usine/core/repository";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
const PositiveInt = Schema.Int.check(Schema.isGreaterThanOrEqualTo(1));
|
|
4
|
+
/** The numeric identity of an installation of the factory's GitHub App. */
|
|
5
|
+
export const InstallationId = PositiveInt.pipe(Schema.brand("GitHubInstallationId"));
|
|
6
|
+
/** GitHub's numeric repository identity, used to restrict installation tokens. */
|
|
7
|
+
export const RepositoryId = PositiveInt.pipe(Schema.brand("GitHubRepositoryId"));
|
|
8
|
+
/** The discovered App installation and the account that owns it. */
|
|
9
|
+
export class Installation extends Schema.Class("@usine/github/Installation")({
|
|
10
|
+
id: InstallationId,
|
|
11
|
+
accountLogin: Schema.NonEmptyString,
|
|
12
|
+
}) {
|
|
13
|
+
}
|
|
14
|
+
/** Token access to every repository covered by the installation. */
|
|
15
|
+
export class InstallationWide extends Schema.TaggedClass("@usine/github/TokenScope/InstallationWide")("InstallationWide", {}) {
|
|
16
|
+
}
|
|
17
|
+
/** Token access restricted to the repository assigned to one Attempt. */
|
|
18
|
+
export class SingleRepository extends Schema.TaggedClass("@usine/github/TokenScope/SingleRepository")("SingleRepository", {
|
|
19
|
+
repository: RepositoryName,
|
|
20
|
+
repositoryId: RepositoryId,
|
|
21
|
+
}) {
|
|
22
|
+
}
|
|
23
|
+
/** The repository coverage requested when minting an installation token. */
|
|
24
|
+
export const TokenScope = Schema.Union([InstallationWide, SingleRepository]);
|
|
25
|
+
/** A redacted installation credential with its expiry and permitted repository scope. */
|
|
26
|
+
export class InstallationToken extends Schema.Class("@usine/github/InstallationToken")({
|
|
27
|
+
value: Schema.Redacted(Schema.NonEmptyString, { disallowJsonEncode: true }),
|
|
28
|
+
expiresAt: Schema.DateTimeUtc,
|
|
29
|
+
scope: TokenScope,
|
|
30
|
+
}) {
|
|
31
|
+
}
|
|
32
|
+
/** Why App installation discovery could not select one usable installation. */
|
|
33
|
+
export const InstallationDiscoveryReason = Schema.Literals(["missing", "multiple", "suspended"]);
|
|
34
|
+
/** The App has no unambiguous active installation to use for repository access. */
|
|
35
|
+
export class InstallationDiscoveryError extends Schema.TaggedError("@usine/github/InstallationDiscoveryError")("InstallationDiscoveryError", {
|
|
36
|
+
reason: InstallationDiscoveryReason,
|
|
37
|
+
message: Schema.NonEmptyString,
|
|
38
|
+
}) {
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=installation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"installation.js","sourceRoot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MAAM,CAAC,cAAc,EAAE,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC;IAC3E,SAAS,EAAE,MAAM,CAAC,WAAW;IAC7B,KAAK,EAAE,UAAU;CAClB,CAAC;CAAG;AAEL,+EAA+E;AAC/E,MAAM,CAAC,MAAM,2BAA2B,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,UAAU,EAAE,WAAW,CAAC,CAAC,CAAC;AAGjG,mFAAmF;AACnF,MAAM,OAAO,0BAA2B,SAAQ,MAAM,CAAC,WAAW,CAChE,0CAA0C,CAC3C,CAAC,4BAA4B,EAAE;IAC9B,MAAM,EAAE,2BAA2B;IACnC,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC;CAAG"}
|
package/dist/item-writer.d.ts
CHANGED
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RepositoryName } from "@usine/core/repository";
|
|
2
|
+
import { ItemNumber } from "@usine/core/item";
|
|
2
3
|
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
4
|
import { HttpClient } from "effect/unstable/http";
|
|
4
5
|
import { GitHubApp } from "./github-app.ts";
|
|
5
|
-
import type { GitHubAppError } from "./
|
|
6
|
+
import type { GitHubAppError } from "./error.ts";
|
|
6
7
|
declare const ItemLabelMutation_base: Schema.Class<ItemLabelMutation, Schema.Struct<{
|
|
7
8
|
readonly add: Schema.$Array<Schema.NonEmptyString>;
|
|
8
9
|
readonly remove: Schema.$Array<Schema.NonEmptyString>;
|
|
9
10
|
}>, {}>;
|
|
10
|
-
/**
|
|
11
|
+
/** Labels to add and remove on one Item. Labels outside these two sets are left alone. */
|
|
11
12
|
export declare class ItemLabelMutation extends ItemLabelMutation_base {
|
|
12
13
|
}
|
|
13
14
|
declare const GitHubItemWriter_base: Context.ServiceClass<GitHubItemWriter, "@usine/github/GitHubItemWriter", {
|
|
14
|
-
/** Adds
|
|
15
|
-
readonly updateLabels: (repository:
|
|
15
|
+
/** Adds and removes only the named labels and keeps every other applied label. */
|
|
16
|
+
readonly updateLabels: (repository: RepositoryName, item: ItemNumber, mutation: ItemLabelMutation) => Effect.Effect<ReadonlyArray<string>, GitHubAppError>;
|
|
16
17
|
}>;
|
|
17
|
-
/**
|
|
18
|
+
/** Label writes on GitHub Items, used when the Board moves a card between lanes. */
|
|
18
19
|
export declare class GitHubItemWriter extends GitHubItemWriter_base {
|
|
19
20
|
static readonly layer: Layer.Layer<GitHubItemWriter, never, GitHubApp | HttpClient.HttpClient>;
|
|
20
21
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-writer.d.ts","sourceRoot":"","sources":["../src/item-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"item-writer.d.ts","sourceRoot":"","sources":["../src/item-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAS,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAyC,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;;;;;AAKjD,0FAA0F;AAC1F,qBAAa,iBAAkB,SAAQ,sBAKrC;CAAG;;IAcD,kFAAkF;2BAC3D,CACrB,UAAU,EAAE,cAAc,EAC1B,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,iBAAiB,KACxB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,cAAc,CAAC;;AAT7D,oFAAoF;AACpF,qBAAa,gBAAiB,SAAQ,qBAUD;IACnC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,gBAAgB,EAAE,KAAK,EAAE,SAAS,GAAG,UAAU,CAAC,UAAU,CAAC,CA4E1F;CACL"}
|
package/dist/item-writer.js
CHANGED
|
@@ -1,22 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RepositoryName, splitRepositoryName } from "@usine/core/repository";
|
|
2
|
+
import { ItemNumber } from "@usine/core/item";
|
|
2
3
|
import { Clock, Context, Effect, Layer, Schema } from "effect";
|
|
3
4
|
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http";
|
|
4
5
|
import { GitHubApp } from "./github-app.js";
|
|
5
6
|
import { API_ROOT, authorized, invalidResponse, statusError, transportError } from "./http.js";
|
|
6
7
|
const LabelResponse = Schema.Array(Schema.Struct({ name: Schema.NonEmptyString }));
|
|
7
8
|
const LabelNames = Schema.Array(Schema.NonEmptyString).check(Schema.isUnique());
|
|
8
|
-
/**
|
|
9
|
+
/** Labels to add and remove on one Item. Labels outside these two sets are left alone. */
|
|
9
10
|
export class ItemLabelMutation extends Schema.Class("@usine/github/ItemLabelMutation")({
|
|
10
11
|
add: LabelNames.check(Schema.isNonEmpty()),
|
|
11
12
|
remove: LabelNames,
|
|
12
13
|
}) {
|
|
13
14
|
}
|
|
14
15
|
const labelsUrl = (repository, item) => {
|
|
15
|
-
const { name, owner } =
|
|
16
|
+
const { name, owner } = splitRepositoryName(repository);
|
|
16
17
|
return `${API_ROOT}/repos/${encodeURIComponent(owner)}/${encodeURIComponent(name)}/issues/${item}/labels`;
|
|
17
18
|
};
|
|
18
19
|
const labelUrl = (repository, item, label) => `${labelsUrl(repository, item)}/${encodeURIComponent(label)}`;
|
|
19
|
-
/**
|
|
20
|
+
/** Label writes on GitHub Items, used when the Board moves a card between lanes. */
|
|
20
21
|
export class GitHubItemWriter extends Context.Service()("@usine/github/GitHubItemWriter") {
|
|
21
22
|
static layer = Layer.effect(GitHubItemWriter, Effect.gen(function* () {
|
|
22
23
|
const app = yield* GitHubApp;
|
package/dist/item-writer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"item-writer.js","sourceRoot":"","sources":["../src/item-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"item-writer.js","sourceRoot":"","sources":["../src/item-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG/F,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC;AACnF,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;AAEhF,0FAA0F;AAC1F,MAAM,OAAO,iBAAkB,SAAQ,MAAM,CAAC,KAAK,CACjD,iCAAiC,CAClC,CAAC;IACA,GAAG,EAAE,UAAU,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IAC1C,MAAM,EAAE,UAAU;CACnB,CAAC;CAAG;AAEL,MAAM,SAAS,GAAG,CAAC,UAA0B,EAAE,IAAY,EAAU,EAAE;IACrE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAA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M,CAAC,QAAQ,CAAC,iDAAiD,EAAE;4BACxE,UAAU;4BACV,IAAI;4BACJ,KAAK;yBACN,CAAC,CAAC;wBACH,SAAS;oBACX,CAAC;oBACD,IAAI,cAAc,CAAC,MAAM,GAAG,GAAG,IAAI,cAAc,CAAC,MAAM,IAAI,GAAG,EAAE,CAAC;wBAChE,OAAO,KAAK,CAAC,CAAC,WAAW,CACvB,oBAAoB,EACpB,cAAc,EACd,KAAK,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAC/B,CAAC;oBACJ,CAAC;oBACD,OAAO,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;gBAC1C,CAAC;gBACD,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,mDAAmD,EAAE;oBACzE,UAAU;oBACV,IAAI;oBACJ,WAAW,EAAE,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC;oBACpC,aAAa,EAAE,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC;oBACzC,MAAM,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;iBACnD,CAAC,CAAC;gBACH,OAAO,OAAO,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;YACzC,CAAC,CAAC;SACH,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;CACL"}
|
package/dist/jwt.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { Effect, Redacted } from "effect";
|
|
2
|
-
import { AppAuthenticationError, type AppCredentials } from "./
|
|
3
|
-
/** Signs App
|
|
4
|
-
|
|
2
|
+
import { AppAuthenticationError, type AppCredentials } from "./credentials.ts";
|
|
3
|
+
/** Signs an App JWT with `iat` backdated a minute for clock skew and `exp` under GitHub's ten-minute cap. */
|
|
4
|
+
type AppJwtSigner = () => Effect.Effect<Redacted.Redacted<string>>;
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* Imports the App private key once with WebCrypto RS256. A key that cannot be
|
|
7
|
+
* imported fails here, when the layer is built, not on the first request.
|
|
8
8
|
*/
|
|
9
9
|
export declare const appJwtSigner: (credentials: AppCredentials) => Effect.Effect<AppJwtSigner, AppAuthenticationError, never>;
|
|
10
|
+
export {};
|
|
10
11
|
//# sourceMappingURL=jwt.d.ts.map
|
package/dist/jwt.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../src/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,KAAK,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"jwt.d.ts","sourceRoot":"","sources":["../src/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAoE/E,6GAA6G;AAC7G,KAAK,YAAY,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC;AAEnE;;;GAGG;AACH,eAAO,MAAM,YAAY,6FA6BvB,CAAC"}
|
package/dist/jwt.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Clock, Effect, Redacted } from "effect";
|
|
2
|
-
import { AppAuthenticationError } from "./
|
|
2
|
+
import { AppAuthenticationError } from "./credentials.js";
|
|
3
3
|
const encoder = new TextEncoder();
|
|
4
4
|
const RSA_ALGORITHM_IDENTIFIER = new Uint8Array([
|
|
5
5
|
0x30, 0x0d, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x01, 0x01, 0x05, 0x00,
|
|
@@ -22,7 +22,7 @@ const derLength = (length) => {
|
|
|
22
22
|
return new Uint8Array([0x80 | bytes.length, ...bytes]);
|
|
23
23
|
};
|
|
24
24
|
const der = (tag, value) => concat(new Uint8Array([tag]), derLength(value.length), value);
|
|
25
|
-
/** WebCrypto imports PKCS#8 only
|
|
25
|
+
/** WebCrypto imports PKCS#8 keys only, and GitHub downloads PKCS#1, so wrap the key. */
|
|
26
26
|
const wrapPkcs1AsPkcs8 = (pkcs1) => der(0x30, concat(new Uint8Array([0x02, 0x01, 0x00]), RSA_ALGORITHM_IDENTIFIER, der(0x04, pkcs1)));
|
|
27
27
|
const decodePem = (pem) => {
|
|
28
28
|
const pkcs1 = pem.includes("-----BEGIN RSA PRIVATE KEY-----");
|
|
@@ -47,8 +47,8 @@ const toArrayBuffer = (value) => {
|
|
|
47
47
|
return buffer;
|
|
48
48
|
};
|
|
49
49
|
/**
|
|
50
|
-
*
|
|
51
|
-
*
|
|
50
|
+
* Imports the App private key once with WebCrypto RS256. A key that cannot be
|
|
51
|
+
* imported fails here, when the layer is built, not on the first request.
|
|
52
52
|
*/
|
|
53
53
|
export const appJwtSigner = Effect.fn("AppJwt.import")(function* (credentials) {
|
|
54
54
|
const key = yield* Effect.tryPromise({
|
package/dist/jwt.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"jwt.js","sourceRoot":"","sources":["../src/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjD,OAAO,EAAE,sBAAsB,EAAuB,MAAM,
|
|
1
|
+
{"version":3,"file":"jwt.js","sourceRoot":"","sources":["../src/jwt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACjD,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AM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,CAAC;QACjE,MAAM,QAAQ,GAAG,GAAG,UAAU,CAAC,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,KAAK,EAAE,CAAC,IAAI,UAAU,CAAC;YACzE,GAAG,EAAE,GAAG,GAAG,EAAE;YACb,GAAG,EAAE,GAAG,GAAG,CAAC,GAAG,EAAE;YACjB,GAAG,EAAE,WAAW,CAAC,KAAK;SACvB,CAAC,EAAE,CAAC;QACL,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAC3C,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,mBAAmB,EAAE,GAAG,EAAE,aAAa,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,CAAC,CACtF,CAAC;QACF,OAAO,QAAQ,CAAC,IAAI,CAAC,GAAG,QAAQ,IAAI,SAAS,CAAC,IAAI,UAAU,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,CAAC;IAC9E,CAAC,CAAC,CAAC;IACH,OAAO,IAAI,CAAC;AACd,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RepositoryName } from "@usine/core/repository";
|
|
2
|
+
import { Context, Effect, Layer, Schema } from "effect";
|
|
3
|
+
import { HttpClient } from "effect/unstable/http";
|
|
4
|
+
import { GitHubApp } from "./github-app.ts";
|
|
5
|
+
import type { GitHubAppError } from "./error.ts";
|
|
6
|
+
import { RepositoryLabel } from "./polling/labels.ts";
|
|
7
|
+
declare const NewRepositoryLabel_base: Schema.Class<NewRepositoryLabel, Schema.Struct<{
|
|
8
|
+
readonly name: Schema.brand<Schema.NonEmptyString, "GitHubRepositoryLabelName">;
|
|
9
|
+
readonly color: Schema.Option<Schema.brand<Schema.String, "GitHubRepositoryLabelColor">>;
|
|
10
|
+
readonly description: Schema.Option<Schema.String>;
|
|
11
|
+
}>, {}>;
|
|
12
|
+
/** One label definition as GitHub's create-label endpoint accepts it. */
|
|
13
|
+
export declare class NewRepositoryLabel extends NewRepositoryLabel_base {
|
|
14
|
+
}
|
|
15
|
+
declare const GitHubLabelWriter_base: Context.ServiceClass<GitHubLabelWriter, "@usine/github/GitHubLabelWriter", {
|
|
16
|
+
readonly create: (repository: RepositoryName, label: NewRepositoryLabel) => Effect.Effect<RepositoryLabel, GitHubAppError>;
|
|
17
|
+
}>;
|
|
18
|
+
/** Creates repository labels under the App installation token. */
|
|
19
|
+
export declare class GitHubLabelWriter extends GitHubLabelWriter_base {
|
|
20
|
+
static readonly layer: Layer.Layer<GitHubLabelWriter, never, GitHubApp | HttpClient.HttpClient>;
|
|
21
|
+
}
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=label-writer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label-writer.d.ts","sourceRoot":"","sources":["../src/label-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAS,OAAO,EAAE,MAAM,EAAE,KAAK,EAAU,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvE,OAAO,EAAE,UAAU,EAAyC,MAAM,sBAAsB,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,EAAE,eAAe,EAA6C,MAAM,qBAAqB,CAAC;;;;;;AAEjG,yEAAyE;AACzE,qBAAa,kBAAmB,SAAQ,uBAMtC;CAAG;;qBAuBgB,CACf,UAAU,EAAE,cAAc,EAC1B,KAAK,EAAE,kBAAkB,KACtB,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,cAAc,CAAC;;AAPvD,kEAAkE;AAClE,qBAAa,iBAAkB,SAAQ,sBAQD;IACpC,MAAM,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,iBAAiB,EAAE,KAAK,EAAE,SAAS,GAAG,UAAU,CAAC,UAAU,CAAC,CA4C3F;CACL"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { RepositoryName, splitRepositoryName } from "@usine/core/repository";
|
|
2
|
+
import { Clock, Context, Effect, Layer, Option, Schema } from "effect";
|
|
3
|
+
import { HttpClient, HttpClientRequest, HttpClientResponse } from "effect/unstable/http";
|
|
4
|
+
import { GitHubApp } from "./github-app.js";
|
|
5
|
+
import { API_ROOT, authorized, invalidResponse, statusError, transportError } from "./http.js";
|
|
6
|
+
import { RepositoryLabel, RepositoryLabelColor, RepositoryLabelName } from "./polling/labels.js";
|
|
7
|
+
/** One label definition as GitHub's create-label endpoint accepts it. */
|
|
8
|
+
export class NewRepositoryLabel extends Schema.Class("@usine/github/NewRepositoryLabel")({
|
|
9
|
+
name: RepositoryLabelName,
|
|
10
|
+
color: Schema.Option(RepositoryLabelColor),
|
|
11
|
+
description: Schema.Option(Schema.String),
|
|
12
|
+
}) {
|
|
13
|
+
}
|
|
14
|
+
const CreateLabelResponse = Schema.Struct({
|
|
15
|
+
name: RepositoryLabelName,
|
|
16
|
+
color: RepositoryLabelColor,
|
|
17
|
+
description: Schema.NullOr(Schema.String),
|
|
18
|
+
});
|
|
19
|
+
const labelsUrl = (repository) => {
|
|
20
|
+
const { name, owner } = splitRepositoryName(repository);
|
|
21
|
+
return `${API_ROOT}/repos/${encodeURIComponent(owner)}/${encodeURIComponent(name)}/labels`;
|
|
22
|
+
};
|
|
23
|
+
/** Creates repository labels under the App installation token. */
|
|
24
|
+
export class GitHubLabelWriter extends Context.Service()("@usine/github/GitHubLabelWriter") {
|
|
25
|
+
static layer = Layer.effect(GitHubLabelWriter, Effect.gen(function* () {
|
|
26
|
+
const app = yield* GitHubApp;
|
|
27
|
+
const http = yield* HttpClient.HttpClient;
|
|
28
|
+
return {
|
|
29
|
+
create: Effect.fn("GitHubLabelWriter.create")(function* (repository, label) {
|
|
30
|
+
yield* Effect.annotateCurrentSpan({ repository, label: label.name });
|
|
31
|
+
const token = yield* app.installationToken();
|
|
32
|
+
const body = { name: label.name };
|
|
33
|
+
if (Option.isSome(label.color))
|
|
34
|
+
body.color = label.color.value;
|
|
35
|
+
if (Option.isSome(label.description))
|
|
36
|
+
body.description = label.description.value;
|
|
37
|
+
const request = HttpClientRequest.post(labelsUrl(repository)).pipe(HttpClientRequest.bodyJsonUnsafe(body), authorized(token.value));
|
|
38
|
+
const response = yield* http
|
|
39
|
+
.execute(request)
|
|
40
|
+
.pipe(Effect.mapError((error) => transportError("create-repository-label", error)));
|
|
41
|
+
if (response.status < 200 || response.status >= 300) {
|
|
42
|
+
return yield* statusError("create-repository-label", response, yield* Clock.currentTimeMillis);
|
|
43
|
+
}
|
|
44
|
+
const created = yield* HttpClientResponse.schemaBodyJson(CreateLabelResponse)(response).pipe(Effect.mapError((error) => invalidResponse("create-repository-label", error.message)));
|
|
45
|
+
return new RepositoryLabel({
|
|
46
|
+
name: created.name,
|
|
47
|
+
color: created.color,
|
|
48
|
+
description: Option.fromNullishOr(created.description),
|
|
49
|
+
});
|
|
50
|
+
}),
|
|
51
|
+
};
|
|
52
|
+
}));
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=label-writer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"label-writer.js","sourceRoot":"","sources":["../src/label-writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACvE,OAAO,EAAE,UAAU,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC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KAAK,CAAC,CAAC,KAAK,CAAC,iBAAiB,CAC/B,CAAC;gBACJ,CAAC;gBACD,MAAM,OAAO,GAAG,KAAK,CAAC,CAAC,kBAAkB,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAC3E,QAAQ,CACT,CAAC,IAAI,CACJ,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,eAAe,CAAC,yBAAyB,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC,CACtF,CAAC;gBACF,OAAO,IAAI,eAAe,CAAC;oBACzB,IAAI,EAAE,OAAO,CAAC,IAAI;oBAClB,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,WAAW,EAAE,MAAM,CAAC,aAAa,CAAC,OAAO,CAAC,WAAW,CAAC;iBACvD,CAAC,CAAC;YACL,CAAC,CAAC;SACH,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;CACL"}
|
package/dist/local-secrets.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InstanceDirectory } from "@usine/core/instance";
|
|
2
2
|
import { Effect, FileSystem, Layer, Path, Schema } from "effect";
|
|
3
|
-
import { AppCredentials, GitHubCredentials } from "./
|
|
3
|
+
import { AppCredentials, GitHubCredentials } from "./credentials.ts";
|
|
4
4
|
export declare const GITHUB_APP_SECRETS_PATH = ".usine/github-app.json";
|
|
5
5
|
declare const EnvironmentCredentialsError_base: Schema.Class<EnvironmentCredentialsError, Schema.TaggedStruct<"EnvironmentCredentialsError", {
|
|
6
6
|
readonly message: Schema.NonEmptyString;
|
|
@@ -19,10 +19,10 @@ export declare class SecretsFileError extends SecretsFileError_base {
|
|
|
19
19
|
export declare const LocalSecretsError: Schema.Union<readonly [typeof EnvironmentCredentialsError, typeof SecretsFileError]>;
|
|
20
20
|
export type LocalSecretsError = typeof LocalSecretsError.Type;
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* Loads the orchestrator's App credentials. An environment variable wins over
|
|
23
|
+
* its file field, and the file is not read when both variables are set.
|
|
24
24
|
*/
|
|
25
25
|
export declare const loadLocalCredentials: (root: string & import("effect/Brand").Brand<"InstanceDirectory">) => Effect.Effect<AppCredentials, EnvironmentCredentialsError | SecretsFileError, FileSystem.FileSystem | Path.Path>;
|
|
26
|
-
export declare const localSecretsLayer: (root:
|
|
26
|
+
export declare const localSecretsLayer: (root: InstanceDirectory) => Layer.Layer<GitHubCredentials, LocalSecretsError, FileSystem.FileSystem | Path.Path>;
|
|
27
27
|
export {};
|
|
28
28
|
//# sourceMappingURL=local-secrets.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-secrets.d.ts","sourceRoot":"","sources":["../src/local-secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"local-secrets.d.ts","sourceRoot":"","sources":["../src/local-secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAU,MAAM,EAAE,UAAU,EAAE,KAAK,EAAU,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACjF,OAAO,EAAE,cAAc,EAAS,iBAAiB,EAAsB,MAAM,kBAAkB,CAAC;AAEhG,eAAO,MAAM,uBAAuB,2BAA2B,CAAC;;;;AAEhE,qBAAa,2BAA4B,SAAQ,gCAI/C;CAAG;AAEL,eAAO,MAAM,iBAAiB,4DAAoD,CAAC;AACnF,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;;;;;;AAE9D,qBAAa,gBAAiB,SAAQ,qBAMpC;CAAG;AAEL,eAAO,MAAM,iBAAiB,sFAAgE,CAAC;AAC/F,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAC;AAwC9D;;;GAGG;AACH,eAAO,MAAM,oBAAoB,wLAoB/B,CAAC;AAEH,eAAO,MAAM,iBAAiB,SACtB,iBAAiB,KACtB,KAAK,CAAC,KAAK,CAAC,iBAAiB,EAAE,iBAAiB,EAAE,UAAU,CAAC,UAAU,GAAG,IAAI,CAAC,IAAI,CACzB,CAAC"}
|
package/dist/local-secrets.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { InstanceDirectory } from "@usine/core/instance";
|
|
2
2
|
import { Config, Effect, FileSystem, Layer, Option, Path, Schema } from "effect";
|
|
3
|
-
import { AppCredentials, AppId, GitHubCredentials, RedactedPrivateKey } from "./
|
|
3
|
+
import { AppCredentials, AppId, GitHubCredentials, RedactedPrivateKey } from "./credentials.js";
|
|
4
4
|
export const GITHUB_APP_SECRETS_PATH = ".usine/github-app.json";
|
|
5
5
|
export class EnvironmentCredentialsError extends Schema.TaggedError("@usine/github/EnvironmentCredentialsError")("EnvironmentCredentialsError", {
|
|
6
6
|
message: Schema.NonEmptyString,
|
|
@@ -15,7 +15,7 @@ export class SecretsFileError extends Schema.TaggedError("@usine/github/SecretsF
|
|
|
15
15
|
}
|
|
16
16
|
export const LocalSecretsError = Schema.Union([EnvironmentCredentialsError, SecretsFileError]);
|
|
17
17
|
const AppIdFromString = Schema.FiniteFromString.pipe(Schema.decodeTo(AppId));
|
|
18
|
-
/** Each variable
|
|
18
|
+
/** Each variable may be absent on its own. A present but invalid one is an error, not a fallback to the file. */
|
|
19
19
|
const environment = Config.all({
|
|
20
20
|
appId: Config.option(Config.schema(AppIdFromString, "USINE_GITHUB_APP_ID")),
|
|
21
21
|
privateKey: Config.option(Config.schema(RedactedPrivateKey, "USINE_GITHUB_PRIVATE_KEY")),
|
|
@@ -36,8 +36,8 @@ const readSecretsFile = Effect.fn("GitHubCredentials.readSecretsFile")(function*
|
|
|
36
36
|
return yield* decodeCredentialsFile(source, { onExcessProperty: "error" }).pipe(Effect.mapError(() => fail("parse", `GitHub App secrets are invalid at ${secretsPath}`)));
|
|
37
37
|
});
|
|
38
38
|
/**
|
|
39
|
-
*
|
|
40
|
-
*
|
|
39
|
+
* Loads the orchestrator's App credentials. An environment variable wins over
|
|
40
|
+
* its file field, and the file is not read when both variables are set.
|
|
41
41
|
*/
|
|
42
42
|
export const loadLocalCredentials = Effect.fn("GitHubCredentials.loadLocal")(function* (root) {
|
|
43
43
|
const env = yield* environment.pipe(Effect.mapError(() => new EnvironmentCredentialsError({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local-secrets.js","sourceRoot":"","sources":["../src/local-secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"local-secrets.js","sourceRoot":"","sources":["../src/local-secrets.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACjF,OAAO,EAAE,cAAc,EAAE,KAAK,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAEhG,MAAM,CAAC,MAAM,uBAAuB,GAAG,wBAAwB,CAAC;AAEhE,MAAM,OAAO,2BAA4B,SAAQ,MAAM,CAAC,WAAW,CACjE,2CAA2C,CAC5C,CAAC,6BAA6B,EAAE;IAC/B,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,CAAC;CAAG;AAEL,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,CAAC,CAAC,CAAC;AAGnF,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,WAAW,CACtD,gCAAgC,CACjC,CAAC,kBAAkB,EAAE;IACpB,IAAI,EAAE,MAAM,CAAC,cAAc;IAC3B,MAAM,EAAE,iBAAiB;IACzB,OAAO,EAAE,MAAM,CAAC,cAAc;CAC/B,C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CACL,CACF,CAAC;IACF,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE,CAAC;QAC9D,OAAO,IAAI,cAAc,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,CAAC;IAC1F,CAAC;IACD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC1C,OAAO,IAAI,cAAc,CAAC;QACxB,KAAK,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;QACpD,UAAU,EAAE,MAAM,CAAC,SAAS,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC;KACpE,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,IAAuB,EAC+D,EAAE,CACxF,KAAK,CAAC,MAAM,CAAC,iBAAiB,EAAE,oBAAoB,CAAC,IAAI,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.d.ts","sourceRoot":"","sources":["../../src/polling/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAchC,eAAO,MAAM,gBAAgB,UAAW,MAAM,CAAC,IAAI,KAAG,MAAM,CAAC,IAW5D,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/**
|
|
3
|
+
* Timestamp fields in the payload schemas in payload.ts. Add each new timestamp
|
|
4
|
+
* field here so changes to it remain outside the content hash (ADR 0007).
|
|
5
|
+
*/
|
|
6
|
+
const TIMESTAMP_FIELDS = new Set([
|
|
7
|
+
"closedAt",
|
|
8
|
+
"createdAt",
|
|
9
|
+
"mergedAt",
|
|
10
|
+
"submittedAt",
|
|
11
|
+
"updatedAt",
|
|
12
|
+
]);
|
|
13
|
+
export const canonicalContent = (value) => {
|
|
14
|
+
if (Array.isArray(value))
|
|
15
|
+
return value.map(canonicalContent);
|
|
16
|
+
if (Schema.is(Schema.JsonObject)(value)) {
|
|
17
|
+
return Object.fromEntries(Object.entries(value)
|
|
18
|
+
.filter(([key]) => !TIMESTAMP_FIELDS.has(key))
|
|
19
|
+
.sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
|
|
20
|
+
.map(([key, child]) => [key, canonicalContent(child)]));
|
|
21
|
+
}
|
|
22
|
+
return value;
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=content.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content.js","sourceRoot":"","sources":["../../src/polling/content.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhC;;;GAGG;AACH,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC;IACpD,UAAU;IACV,WAAW;IACX,UAAU;IACV,aAAa;IACb,WAAW;CACZ,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,KAAkB,EAAe,EAAE;IAClE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;IAC7D,IAAI,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC;QACxC,OAAO,MAAM,CAAC,WAAW,CACvB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC;aAClB,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;aAC7C,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;aACrE,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC,CACzD,CAAC;IACJ,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { Schema } from "effect";
|
|
2
|
+
/** GitHub's opaque HTTP validator for a conditional repository or label-catalog request. */
|
|
3
|
+
export declare const EntityTag: Schema.brand<Schema.NonEmptyString, "GitHubEntityTag">;
|
|
4
|
+
export type EntityTag = typeof EntityTag.Type;
|
|
5
|
+
declare const PollCursor_base: Schema.Class<PollCursor, Schema.Struct<{
|
|
6
|
+
readonly entityTag: Schema.OptionFromNullOr<Schema.brand<Schema.NonEmptyString, "GitHubEntityTag">>;
|
|
7
|
+
readonly watermark: Schema.OptionFromNullOr<Schema.DateTimeUtcFromString>;
|
|
8
|
+
}>, {}>;
|
|
9
|
+
/** REST cursor for efficiency only. Losing it is safe because Event dedup is permanent (ADR 0007). */
|
|
10
|
+
export declare class PollCursor extends PollCursor_base {
|
|
11
|
+
static readonly empty: PollCursor;
|
|
12
|
+
}
|
|
13
|
+
declare const ChangedIssue_base: Schema.Class<ChangedIssue, Schema.TaggedStruct<"ChangedIssue", {
|
|
14
|
+
readonly number: Schema.Int;
|
|
15
|
+
readonly updatedAt: Schema.DateTimeUtc;
|
|
16
|
+
}>, {}>;
|
|
17
|
+
/** An issue number and update time reported by repository change detection. */
|
|
18
|
+
export declare class ChangedIssue extends ChangedIssue_base {
|
|
19
|
+
}
|
|
20
|
+
declare const ChangedPullRequest_base: Schema.Class<ChangedPullRequest, Schema.TaggedStruct<"ChangedPullRequest", {
|
|
21
|
+
readonly number: Schema.Int;
|
|
22
|
+
readonly updatedAt: Schema.DateTimeUtc;
|
|
23
|
+
}>, {}>;
|
|
24
|
+
/** A pull request number and update time reported by repository change detection. */
|
|
25
|
+
export declare class ChangedPullRequest extends ChangedPullRequest_base {
|
|
26
|
+
}
|
|
27
|
+
/** An issue or pull request whose payload needs to be fetched after change detection. */
|
|
28
|
+
export declare const ChangedItem: Schema.Union<readonly [typeof ChangedIssue, typeof ChangedPullRequest]>;
|
|
29
|
+
export type ChangedItem = typeof ChangedItem.Type;
|
|
30
|
+
declare const RepositoryNotModified_base: Schema.Class<RepositoryNotModified, Schema.TaggedStruct<"RepositoryNotModified", {
|
|
31
|
+
readonly cursor: typeof PollCursor;
|
|
32
|
+
readonly nextPollAt: Schema.Option<Schema.DateTimeUtc>;
|
|
33
|
+
/** Request backoff from rate pressure or Retry-After; excludes the normal polling interval. */
|
|
34
|
+
readonly backoffUntil: Schema.withConstructorDefault<Schema.Option<Schema.DateTimeUtc>>;
|
|
35
|
+
}>, {}>;
|
|
36
|
+
/** GitHub confirmed that the repository cursor still describes its current state. */
|
|
37
|
+
export declare class RepositoryNotModified extends RepositoryNotModified_base {
|
|
38
|
+
}
|
|
39
|
+
declare const RepositoryChanges_base: Schema.Class<RepositoryChanges, Schema.TaggedStruct<"RepositoryChanges", {
|
|
40
|
+
readonly cursor: typeof PollCursor;
|
|
41
|
+
readonly items: Schema.$Array<Schema.Union<readonly [typeof ChangedIssue, typeof ChangedPullRequest]>>;
|
|
42
|
+
/** True when the page cap ended the walk early. The rest arrives next cycle. */
|
|
43
|
+
readonly backlog: Schema.Boolean;
|
|
44
|
+
readonly nextPollAt: Schema.Option<Schema.DateTimeUtc>;
|
|
45
|
+
/** Request backoff from rate pressure or Retry-After; excludes the normal polling interval. */
|
|
46
|
+
readonly backoffUntil: Schema.withConstructorDefault<Schema.Option<Schema.DateTimeUtc>>;
|
|
47
|
+
}>, {}>;
|
|
48
|
+
/** Changed Items, the next cursor, and whether the page cap left more Items to fetch. */
|
|
49
|
+
export declare class RepositoryChanges extends RepositoryChanges_base {
|
|
50
|
+
}
|
|
51
|
+
/** The result of checking repository changes, including the earliest next poll time. */
|
|
52
|
+
export declare const ChangeDetection: Schema.Union<readonly [typeof RepositoryNotModified, typeof RepositoryChanges]>;
|
|
53
|
+
export type ChangeDetection = typeof ChangeDetection.Type;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../src/polling/detection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEhD,4FAA4F;AAC5F,eAAO,MAAM,SAAS,wDAA8D,CAAC;AACrF,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAC;;;;;AAE9C,sGAAsG;AACtG,qBAAa,UAAW,SAAQ,eAG9B;IACA,MAAM,CAAC,QAAQ,CAAC,KAAK,aAGlB;CACJ;;;;;AAED,+EAA+E;AAC/E,qBAAa,YAAa,SAAQ,iBAMjC;CAAG;;;;;AAEJ,qFAAqF;AACrF,qBAAa,kBAAmB,SAAQ,uBAKtC;CAAG;AAEL,yFAAyF;AACzF,eAAO,MAAM,WAAW,yEAAmD,CAAC;AAC5E,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAC;;;;IAQhD,+FAA+F;;;AANjG,qFAAqF;AACrF,qBAAa,qBAAsB,SAAQ,0BASzC;CAAG;;;;IAQH,gFAAgF;;;IAGhF,+FAA+F;;;AATjG,yFAAyF;AACzF,qBAAa,iBAAkB,SAAQ,sBAYrC;CAAG;AAEL,wFAAwF;AACxF,eAAO,MAAM,eAAe,iFAA2D,CAAC;AACxF,MAAM,MAAM,eAAe,GAAG,OAAO,eAAe,CAAC,IAAI,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Effect, Option, Schema } from "effect";
|
|
2
|
+
/** GitHub's opaque HTTP validator for a conditional repository or label-catalog request. */
|
|
3
|
+
export const EntityTag = Schema.NonEmptyString.pipe(Schema.brand("GitHubEntityTag"));
|
|
4
|
+
/** REST cursor for efficiency only. Losing it is safe because Event dedup is permanent (ADR 0007). */
|
|
5
|
+
export class PollCursor extends Schema.Class("@usine/github/PollCursor")({
|
|
6
|
+
entityTag: Schema.OptionFromNullOr(EntityTag),
|
|
7
|
+
watermark: Schema.OptionFromNullOr(Schema.DateTimeUtcFromString),
|
|
8
|
+
}) {
|
|
9
|
+
static empty = new PollCursor({
|
|
10
|
+
entityTag: Option.none(),
|
|
11
|
+
watermark: Option.none(),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
/** An issue number and update time reported by repository change detection. */
|
|
15
|
+
export class ChangedIssue extends Schema.TaggedClass("@usine/github/ChangedIssue")("ChangedIssue", {
|
|
16
|
+
number: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)),
|
|
17
|
+
updatedAt: Schema.DateTimeUtc,
|
|
18
|
+
}) {
|
|
19
|
+
}
|
|
20
|
+
/** A pull request number and update time reported by repository change detection. */
|
|
21
|
+
export class ChangedPullRequest extends Schema.TaggedClass("@usine/github/ChangedPullRequest")("ChangedPullRequest", {
|
|
22
|
+
number: Schema.Int.check(Schema.isGreaterThanOrEqualTo(1)),
|
|
23
|
+
updatedAt: Schema.DateTimeUtc,
|
|
24
|
+
}) {
|
|
25
|
+
}
|
|
26
|
+
/** An issue or pull request whose payload needs to be fetched after change detection. */
|
|
27
|
+
export const ChangedItem = Schema.Union([ChangedIssue, ChangedPullRequest]);
|
|
28
|
+
/** GitHub confirmed that the repository cursor still describes its current state. */
|
|
29
|
+
export class RepositoryNotModified extends Schema.TaggedClass("@usine/github/RepositoryNotModified")("RepositoryNotModified", {
|
|
30
|
+
cursor: PollCursor,
|
|
31
|
+
nextPollAt: Schema.Option(Schema.DateTimeUtc),
|
|
32
|
+
/** Request backoff from rate pressure or Retry-After; excludes the normal polling interval. */
|
|
33
|
+
backoffUntil: Schema.Option(Schema.DateTimeUtc).pipe(Schema.withConstructorDefault(Effect.succeed(Option.none()))),
|
|
34
|
+
}) {
|
|
35
|
+
}
|
|
36
|
+
/** Changed Items, the next cursor, and whether the page cap left more Items to fetch. */
|
|
37
|
+
export class RepositoryChanges extends Schema.TaggedClass("@usine/github/RepositoryChanges")("RepositoryChanges", {
|
|
38
|
+
cursor: PollCursor,
|
|
39
|
+
items: Schema.Array(ChangedItem),
|
|
40
|
+
/** True when the page cap ended the walk early. The rest arrives next cycle. */
|
|
41
|
+
backlog: Schema.Boolean,
|
|
42
|
+
nextPollAt: Schema.Option(Schema.DateTimeUtc),
|
|
43
|
+
/** Request backoff from rate pressure or Retry-After; excludes the normal polling interval. */
|
|
44
|
+
backoffUntil: Schema.Option(Schema.DateTimeUtc).pipe(Schema.withConstructorDefault(Effect.succeed(Option.none()))),
|
|
45
|
+
}) {
|
|
46
|
+
}
|
|
47
|
+
/** The result of checking repository changes, including the earliest next poll time. */
|
|
48
|
+
export const ChangeDetection = Schema.Union([RepositoryNotModified, RepositoryChanges]);
|
|
49
|
+
//# sourceMappingURL=detection.js.map
|