@usine/config 0.0.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/README.md +50 -2
  2. package/dist/agent.d.ts +23 -0
  3. package/dist/agent.d.ts.map +1 -0
  4. package/dist/agent.js +22 -0
  5. package/dist/agent.js.map +1 -0
  6. package/dist/board.d.ts +31 -0
  7. package/dist/board.d.ts.map +1 -0
  8. package/dist/board.js +32 -0
  9. package/dist/board.js.map +1 -0
  10. package/dist/checks.d.ts +3 -0
  11. package/dist/checks.d.ts.map +1 -0
  12. package/dist/checks.js +3 -0
  13. package/dist/checks.js.map +1 -0
  14. package/dist/factory.d.ts +86 -0
  15. package/dist/factory.d.ts.map +1 -0
  16. package/dist/factory.js +87 -0
  17. package/dist/factory.js.map +1 -0
  18. package/dist/file.d.ts +27 -0
  19. package/dist/file.d.ts.map +1 -0
  20. package/dist/file.js +29 -0
  21. package/dist/file.js.map +1 -0
  22. package/dist/frontmatter.d.ts +10 -0
  23. package/dist/frontmatter.d.ts.map +1 -0
  24. package/dist/frontmatter.js +51 -0
  25. package/dist/frontmatter.js.map +1 -0
  26. package/dist/instance/diagnostics.d.ts +19 -0
  27. package/dist/instance/diagnostics.d.ts.map +1 -0
  28. package/dist/instance/diagnostics.js +22 -0
  29. package/dist/instance/diagnostics.js.map +1 -0
  30. package/dist/instance/instance.d.ts +17 -0
  31. package/dist/instance/instance.d.ts.map +1 -0
  32. package/dist/instance/instance.js +21 -0
  33. package/dist/instance/instance.js.map +1 -0
  34. package/dist/instance/references.d.ts +21 -0
  35. package/dist/instance/references.d.ts.map +1 -0
  36. package/dist/instance/references.js +38 -0
  37. package/dist/instance/references.js.map +1 -0
  38. package/dist/instance-folder.d.ts +14 -0
  39. package/dist/instance-folder.d.ts.map +1 -0
  40. package/dist/instance-folder.js +101 -0
  41. package/dist/instance-folder.js.map +1 -0
  42. package/dist/label.d.ts +22 -0
  43. package/dist/label.d.ts.map +1 -0
  44. package/dist/label.js +25 -0
  45. package/dist/label.js.map +1 -0
  46. package/dist/loop.d.ts +42 -0
  47. package/dist/loop.d.ts.map +1 -0
  48. package/dist/loop.js +36 -0
  49. package/dist/loop.js.map +1 -0
  50. package/dist/parser.d.ts +25 -0
  51. package/dist/parser.d.ts.map +1 -0
  52. package/dist/parser.js +204 -0
  53. package/dist/parser.js.map +1 -0
  54. package/dist/payload-slices.d.ts +17 -0
  55. package/dist/payload-slices.d.ts.map +1 -0
  56. package/dist/payload-slices.js +218 -0
  57. package/dist/payload-slices.js.map +1 -0
  58. package/dist/selector.d.ts +27 -0
  59. package/dist/selector.d.ts.map +1 -0
  60. package/dist/selector.js +29 -0
  61. package/dist/selector.js.map +1 -0
  62. package/dist/trigger.d.ts +37 -0
  63. package/dist/trigger.d.ts.map +1 -0
  64. package/dist/trigger.js +34 -0
  65. package/dist/trigger.js.map +1 -0
  66. package/dist/yaml/document.d.ts +9 -0
  67. package/dist/yaml/document.d.ts.map +1 -0
  68. package/dist/yaml/document.js +38 -0
  69. package/dist/yaml/document.js.map +1 -0
  70. package/dist/yaml/writer.d.ts +16 -0
  71. package/dist/yaml/writer.d.ts.map +1 -0
  72. package/dist/yaml/writer.js +33 -0
  73. package/dist/yaml/writer.js.map +1 -0
  74. package/package.json +64 -5
  75. package/dist/index.d.ts +0 -10
  76. package/dist/index.d.ts.map +0 -1
  77. package/dist/index.js +0 -10
  78. package/dist/index.js.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parser.js","sourceRoot":"","sources":["../src/parser.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,EACL,gBAAgB,EAIhB,MAAM,GACP,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,M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ACxC,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,2BAA2B,CAAC,CAClD,CAAC,IAAc,EAAE,OAA0B,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,CAAC,CAC9E;SACF,CAAC;IACJ,CAAC,CAAC,CACH,CAAC;CACH"}
@@ -0,0 +1,17 @@
1
+ import { Environment } from "@usine/expression/expression-engine";
2
+ import { Schema } from "effect";
3
+ import type { ManagedRepo } from "./factory.ts";
4
+ import type { Stream } from "./trigger.ts";
5
+ /** The CEL environment for issue triggers: the `item` type mirrors the issue payload slice. */
6
+ export declare const issueEnvironment: Environment;
7
+ /** The CEL environment for pull-request triggers: the `item` type mirrors the pull-request payload slice. */
8
+ export declare const pullRequestEnvironment: Environment;
9
+ /** The CEL environment for schedule triggers: `item.tick` has `scheduledAt`, `scheduledAtLocal`, `cron`, and `tz`. */
10
+ export declare const scheduleEnvironment: Environment;
11
+ export declare const environmentFor: (stream: Stream) => Environment;
12
+ /**
13
+ * The value of the CEL `repo` variable. A field added here must also be added
14
+ * to the `RepoContext` type, and the reverse.
15
+ */
16
+ export declare const repositoryContext: (repository: ManagedRepo) => Schema.JsonObject;
17
+ //# sourceMappingURL=payload-slices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload-slices.d.ts","sourceRoot":"","sources":["../src/payload-slices.ts"],"names":[],"mappings":"AACA,OAAO,EACL,WAAW,EAKZ,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAyK3C,+FAA+F;AAC/F,eAAO,MAAM,gBAAgB,aAe5B,CAAC;AAEF,6GAA6G;AAC7G,eAAO,MAAM,sBAAsB,aAuBlC,CAAC;AAEF,sHAAsH;AACtH,eAAO,MAAM,mBAAmB,aAAmD,CAAC;AAEpF,eAAO,MAAM,cAAc,WAAY,MAAM,KAAG,WAS/C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,eAAgB,WAAW,KAAG,MAAM,CAAC,UAOlE,CAAC"}
@@ -0,0 +1,218 @@
1
+ import { splitRepositoryName } from "@usine/core/repository";
2
+ import { Environment, ObjectField, ObjectType, TypeReference, Variable, } from "@usine/expression/expression-engine";
3
+ import { Schema } from "effect";
4
+ const reference = Schema.decodeUnknownSync(TypeReference);
5
+ const objectType = (name, fields) => new ObjectType({
6
+ name,
7
+ fields: fields.map(([fieldName, fieldType]) => new ObjectField({ name: fieldName, type: reference(fieldType) })),
8
+ });
9
+ const actor = objectType("Actor", [["login", "string"]]);
10
+ const label = objectType("Label", [["name", "string"]]);
11
+ const milestone = objectType("Milestone", [["title", "string"]]);
12
+ const issueType = objectType("IssueType", [["name", "string"]]);
13
+ const commit = objectType("Commit", [["oid", "string"]]);
14
+ const repo = objectType("RepoContext", [
15
+ ["name", "string"],
16
+ ["owner", "string"],
17
+ ["url", "string"],
18
+ ]);
19
+ const labels = objectType("Labels", [
20
+ ["totalCount", "int"],
21
+ ["nodes", "list<Label>"],
22
+ ]);
23
+ const assignees = objectType("Assignees", [
24
+ ["totalCount", "int"],
25
+ ["nodes", "list<Actor>"],
26
+ ]);
27
+ const issueComment = objectType("IssueComment", [
28
+ ["author", "Actor"],
29
+ ["body", "string"],
30
+ ["createdAt", "string"],
31
+ ]);
32
+ const issueComments = objectType("IssueComments", [
33
+ ["totalCount", "int"],
34
+ ["nodes", "list<IssueComment>"],
35
+ ]);
36
+ const pullRequestReference = objectType("PullRequestReference", [
37
+ ["number", "int"],
38
+ ["state", "string"],
39
+ ["isDraft", "bool"],
40
+ ["url", "string"],
41
+ ]);
42
+ const pullRequestReferences = objectType("PullRequestReferences", [
43
+ ["totalCount", "int"],
44
+ ["nodes", "list<PullRequestReference>"],
45
+ ]);
46
+ const issue = objectType("IssuePayload", [
47
+ ["number", "int"],
48
+ ["title", "string"],
49
+ ["body", "string"],
50
+ ["url", "string"],
51
+ ["state", "string"],
52
+ ["stateReason", "string"],
53
+ ["createdAt", "string"],
54
+ ["updatedAt", "string"],
55
+ ["closedAt", "string"],
56
+ ["author", "Actor"],
57
+ ["issueType", "IssueType"],
58
+ ["milestone", "Milestone"],
59
+ ["labels", "Labels"],
60
+ ["assignees", "Assignees"],
61
+ ["comments", "IssueComments"],
62
+ ["closedByPullRequestsReferences", "PullRequestReferences"],
63
+ ]);
64
+ const requestedReviewer = objectType("RequestedReviewer", [["login", "string"]]);
65
+ const reviewRequest = objectType("ReviewRequest", [["requestedReviewer", "RequestedReviewer"]]);
66
+ const reviewRequests = objectType("ReviewRequests", [
67
+ ["totalCount", "int"],
68
+ ["nodes", "list<ReviewRequest>"],
69
+ ]);
70
+ const review = objectType("Review", [
71
+ ["author", "Actor"],
72
+ ["state", "string"],
73
+ ["body", "string"],
74
+ ["submittedAt", "string"],
75
+ ["commit", "Commit"],
76
+ ]);
77
+ const reviews = objectType("Reviews", [
78
+ ["totalCount", "int"],
79
+ ["nodes", "list<Review>"],
80
+ ]);
81
+ const reviewThreadComment = objectType("ReviewThreadComment", [
82
+ ["author", "Actor"],
83
+ ["body", "string"],
84
+ ]);
85
+ const reviewThreadComments = objectType("ReviewThreadComments", [
86
+ ["totalCount", "int"],
87
+ ["nodes", "list<ReviewThreadComment>"],
88
+ ]);
89
+ const reviewThread = objectType("ReviewThread", [
90
+ ["isResolved", "bool"],
91
+ ["isOutdated", "bool"],
92
+ ["path", "string"],
93
+ ["comments", "ReviewThreadComments"],
94
+ ]);
95
+ const reviewThreads = objectType("ReviewThreads", [
96
+ ["totalCount", "int"],
97
+ ["nodes", "list<ReviewThread>"],
98
+ ]);
99
+ const pullRequestComment = objectType("PullRequestComment", [
100
+ ["author", "Actor"],
101
+ ["body", "string"],
102
+ ["createdAt", "string"],
103
+ ]);
104
+ const pullRequestComments = objectType("PullRequestComments", [
105
+ ["totalCount", "int"],
106
+ ["nodes", "list<PullRequestComment>"],
107
+ ]);
108
+ const closingIssueReference = objectType("ClosingIssueReference", [
109
+ ["number", "int"],
110
+ ["state", "string"],
111
+ ]);
112
+ const closingIssueReferences = objectType("ClosingIssueReferences", [
113
+ ["totalCount", "int"],
114
+ ["nodes", "list<ClosingIssueReference>"],
115
+ ]);
116
+ const statusCheckRollup = objectType("StatusCheckRollup", [["state", "string"]]);
117
+ const pullRequest = objectType("PullRequestPayload", [
118
+ ["number", "int"],
119
+ ["title", "string"],
120
+ ["body", "string"],
121
+ ["url", "string"],
122
+ ["state", "string"],
123
+ ["isDraft", "bool"],
124
+ ["merged", "bool"],
125
+ ["createdAt", "string"],
126
+ ["updatedAt", "string"],
127
+ ["mergedAt", "string"],
128
+ ["author", "Actor"],
129
+ ["baseRefName", "string"],
130
+ ["headRefName", "string"],
131
+ ["headRefOid", "string"],
132
+ ["additions", "int"],
133
+ ["deletions", "int"],
134
+ ["changedFiles", "int"],
135
+ ["reviewDecision", "string"],
136
+ ["statusCheckRollup", "StatusCheckRollup"],
137
+ ["labels", "Labels"],
138
+ ["reviewRequests", "ReviewRequests"],
139
+ ["reviews", "Reviews"],
140
+ ["reviewThreads", "ReviewThreads"],
141
+ ["comments", "PullRequestComments"],
142
+ ["closingIssuesReferences", "ClosingIssueReferences"],
143
+ ]);
144
+ const tick = objectType("Tick", [
145
+ ["scheduledAt", "string"],
146
+ ["scheduledAtLocal", "string"],
147
+ ["cron", "string"],
148
+ ["tz", "string"],
149
+ ]);
150
+ const schedule = objectType("SchedulePayload", [["tick", "Tick"]]);
151
+ const environment = (types, itemType) => new Environment({
152
+ types: [repo, ...types],
153
+ variables: [
154
+ new Variable({ name: "repo", type: reference("RepoContext") }),
155
+ new Variable({ name: "item", type: reference(itemType) }),
156
+ ],
157
+ });
158
+ /** The CEL environment for issue triggers: the `item` type mirrors the issue payload slice. */
159
+ export const issueEnvironment = environment([
160
+ actor,
161
+ label,
162
+ milestone,
163
+ issueType,
164
+ labels,
165
+ assignees,
166
+ issueComment,
167
+ issueComments,
168
+ pullRequestReference,
169
+ pullRequestReferences,
170
+ issue,
171
+ ], "IssuePayload");
172
+ /** The CEL environment for pull-request triggers: the `item` type mirrors the pull-request payload slice. */
173
+ export const pullRequestEnvironment = environment([
174
+ actor,
175
+ label,
176
+ commit,
177
+ labels,
178
+ requestedReviewer,
179
+ reviewRequest,
180
+ reviewRequests,
181
+ review,
182
+ reviews,
183
+ reviewThreadComment,
184
+ reviewThreadComments,
185
+ reviewThread,
186
+ reviewThreads,
187
+ pullRequestComment,
188
+ pullRequestComments,
189
+ closingIssueReference,
190
+ closingIssueReferences,
191
+ statusCheckRollup,
192
+ pullRequest,
193
+ ], "PullRequestPayload");
194
+ /** The CEL environment for schedule triggers: `item.tick` has `scheduledAt`, `scheduledAtLocal`, `cron`, and `tz`. */
195
+ export const scheduleEnvironment = environment([tick, schedule], "SchedulePayload");
196
+ export const environmentFor = (stream) => {
197
+ switch (stream) {
198
+ case "issue":
199
+ return issueEnvironment;
200
+ case "pr":
201
+ return pullRequestEnvironment;
202
+ case "schedule":
203
+ return scheduleEnvironment;
204
+ }
205
+ };
206
+ /**
207
+ * The value of the CEL `repo` variable. A field added here must also be added
208
+ * to the `RepoContext` type, and the reverse.
209
+ */
210
+ export const repositoryContext = (repository) => {
211
+ const { owner } = splitRepositoryName(repository.name);
212
+ return {
213
+ name: repository.name,
214
+ owner,
215
+ url: `https://github.com/${repository.name}`,
216
+ };
217
+ };
218
+ //# sourceMappingURL=payload-slices.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payload-slices.js","sourceRoot":"","sources":["../src/payload-slices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,EACb,QAAQ,GACT,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,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YACP,OAAO,sBAAsB,CAAC;QAChC,KAAK,UAAU;YACb,OAAO,mBAAmB,CAAC;IAC/B,CAAC;AACH,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,UAAuB,EAAqB,EAAE;IAC9E,MAAM,EAAE,KAAK,EAAE,GAAG,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACvD,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK;QACL,GAAG,EAAE,sBAAsB,UAAU,CAAC,IAAI,EAAE;KAC7C,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ import { Option, Schema } from "effect";
2
+ import { type ManagedRepo } from "./factory.ts";
3
+ declare const Selector_base: Schema.Class<Selector, Schema.Struct<{
4
+ readonly repos: Schema.OptionFromOptionalKey<Schema.$Array<Schema.brand<Schema.String, "RepositoryName">>>;
5
+ readonly tags: Schema.OptionFromOptionalKey<Schema.$Array<Schema.brand<Schema.String, "RegistryTag">>>;
6
+ }>, {}>;
7
+ /** Narrows a Loop to registry repositories by name, by any listed tag, or by both criteria together. */
8
+ export declare class Selector extends Selector_base {
9
+ }
10
+ /** An authored selector must name repositories or tags; omit the selector entirely to include every repository. */
11
+ export declare const ValidSelector: Schema.decodeTo<Schema.declareConstructor<Selector, {
12
+ readonly repos?: readonly string[];
13
+ readonly tags?: readonly string[];
14
+ }, readonly [Schema.Struct<{
15
+ readonly repos: Schema.OptionFromOptionalKey<Schema.$Array<Schema.brand<Schema.String, "RepositoryName">>>;
16
+ readonly tags: Schema.OptionFromOptionalKey<Schema.$Array<Schema.brand<Schema.String, "RegistryTag">>>;
17
+ }>], {
18
+ readonly repos: Schema.OptionIso<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "RepositoryName">>>>;
19
+ readonly tags: Schema.OptionIso<Schema.toType<Schema.$Array<Schema.brand<Schema.String, "RegistryTag">>>>;
20
+ }>, Schema.Struct<{
21
+ readonly repos: Schema.OptionFromOptionalKey<Schema.$Array<Schema.brand<Schema.String, "RepositoryName">>>;
22
+ readonly tags: Schema.OptionFromOptionalKey<Schema.$Array<Schema.brand<Schema.String, "RegistryTag">>>;
23
+ }>, never, never>;
24
+ /** Whether a repo passes the selector. Both axes must match when present; no selector matches every repo. */
25
+ export declare const matchesSelector: (selector: Option.Option<Selector>, repo: ManagedRepo) => boolean;
26
+ export {};
27
+ //# sourceMappingURL=selector.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../src/selector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;;;;;AAE7D,wGAAwG;AACxG,qBAAa,QAAS,SAAQ,aAO5B;CAAG;AAEL,mHAAmH;AACnH,eAAO,MAAM,aAAa;;;;;;;;;;;;iBAIzB,CAAC;AAEF,6GAA6G;AAC7G,eAAO,MAAM,eAAe,aAAc,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,WAAW,KAAG,OAcnF,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { RepositoryName } from "@usine/core/repository";
2
+ import { Option, Schema } from "effect";
3
+ import { RegistryTag } from "./factory.js";
4
+ /** Narrows a Loop to registry repositories by name, by any listed tag, or by both criteria together. */
5
+ export class Selector extends Schema.Class("@usine/config/Selector")({
6
+ repos: Schema.OptionFromOptionalKey(Schema.Array(RepositoryName).check(Schema.isNonEmpty(), Schema.isUnique())),
7
+ tags: Schema.OptionFromOptionalKey(Schema.Array(RegistryTag).check(Schema.isNonEmpty(), Schema.isUnique())),
8
+ }) {
9
+ }
10
+ /** An authored selector must name repositories or tags; omit the selector entirely to include every repository. */
11
+ export const ValidSelector = Selector.check(Schema.makeFilter((selector) => Option.isSome(selector.repos) || Option.isSome(selector.tags), {
12
+ message: "Expected selector.repos, selector.tags, or both",
13
+ }));
14
+ /** Whether a repo passes the selector. Both axes must match when present; no selector matches every repo. */
15
+ export const matchesSelector = (selector, repo) => Option.match(selector, {
16
+ onNone: () => true,
17
+ onSome: (value) => {
18
+ const matchesRepo = Option.match(value.repos, {
19
+ onNone: () => true,
20
+ onSome: (repos) => repos.includes(repo.name),
21
+ });
22
+ const matchesTag = Option.match(value.tags, {
23
+ onNone: () => true,
24
+ onSome: (tags) => tags.some((tag) => repo.tags.includes(tag)),
25
+ });
26
+ return matchesRepo && matchesTag;
27
+ },
28
+ });
29
+ //# sourceMappingURL=selector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"selector.js","sourceRoot":"","sources":["../src/selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,WAAW,EAAoB,MAAM,cAAc,CAAC;AAE7D,wGAAwG;AACxG,MAAM,OAAO,QAAS,SAAQ,MAAM,CAAC,KAAK,CAAW,wBAAwB,CAAC,CAAC;IAC7E,KAAK,EAAE,MAAM,CAAC,qBAAqB,CACjC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAC3E;IACD,IAAI,EAAE,MAAM,CAAC,qBAAqB,CAChC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CACxE;CACF,CAAC;CAAG;AAEL,mHAAmH;AACnH,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CACzC,MAAM,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,EAAE;IAC7F,OAAO,EAAE,iDAAiD;CAC3D,CAAC,CACH,CAAC;AAEF,6GAA6G;AAC7G,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,QAAiC,EAAE,IAAiB,EAAW,EAAE,CAC/F,MAAM,CAAC,KAAK,CAAC,QAAQ,EAAE;IACrB,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;IAClB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE;QAChB,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE;YAC5C,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;YAClB,MAAM,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC;SAC7C,CAAC,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE;YAC1C,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;YAClB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;SAC9D,CAAC,CAAC;QACH,OAAO,WAAW,IAAI,UAAU,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ import { Schema } from "effect";
2
+ /** A five-field schedule evaluated in the trigger's time zone. */
3
+ export declare const Cron: Schema.brand<Schema.String, "Cron">;
4
+ export type Cron = typeof Cron.Type;
5
+ /** The IANA time zone whose local clock defines a schedule's firing times. */
6
+ export declare const TimeZone: Schema.brand<Schema.String, "TimeZone">;
7
+ export type TimeZone = typeof TimeZone.Type;
8
+ declare const IssueTrigger_base: Schema.Class<IssueTrigger, Schema.Struct<{
9
+ readonly on: Schema.Literal<"issue">;
10
+ readonly if: Schema.brand<Schema.String, "ExpressionSource">;
11
+ }>, {}>;
12
+ /** Watches issues and selects matching payloads with the Loop's `if` expression. */
13
+ export declare class IssueTrigger extends IssueTrigger_base {
14
+ }
15
+ declare const PullRequestTrigger_base: Schema.Class<PullRequestTrigger, Schema.Struct<{
16
+ readonly on: Schema.Literal<"pr">;
17
+ readonly if: Schema.brand<Schema.String, "ExpressionSource">;
18
+ }>, {}>;
19
+ /** Watches pull requests and selects matching payloads with the Loop's `if` expression. */
20
+ export declare class PullRequestTrigger extends PullRequestTrigger_base {
21
+ }
22
+ declare const ScheduleTrigger_base: Schema.Class<ScheduleTrigger, Schema.Struct<{
23
+ readonly on: Schema.Literal<"schedule">;
24
+ readonly if: Schema.brand<Schema.String, "ExpressionSource">;
25
+ readonly cron: Schema.brand<Schema.String, "Cron">;
26
+ readonly tz: Schema.withDecodingDefaultKey<Schema.brand<Schema.String, "TimeZone">, never>;
27
+ }>, {}>;
28
+ /** Fires per selected repository on a schedule, catching up only the latest missed Tick after downtime. */
29
+ export declare class ScheduleTrigger extends ScheduleTrigger_base {
30
+ }
31
+ /** The standing Item condition or schedule that produces Events for a Loop. */
32
+ export declare const Trigger: Schema.Union<readonly [typeof IssueTrigger, typeof PullRequestTrigger, typeof ScheduleTrigger]>;
33
+ export type Trigger = typeof Trigger.Type;
34
+ /** The class of state a Loop watches: issues, pull requests, or scheduled Ticks. */
35
+ export type Stream = Trigger["on"];
36
+ export {};
37
+ //# sourceMappingURL=trigger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../src/trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAwD,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQtF,kEAAkE;AAClE,eAAO,MAAM,IAAI,qCAEW,CAAC;AAE7B,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC;AAIpC,8EAA8E;AAC9E,eAAO,MAAM,QAAQ,yCAEW,CAAC;AAEjC,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;;;;;AAE5C,oFAAoF;AACpF,qBAAa,YAAa,SAAQ,iBAGhC;CAAG;;;;;AAEL,2FAA2F;AAC3F,qBAAa,kBAAmB,SAAQ,uBAKtC;CAAG;;;;;;;AAEL,2GAA2G;AAC3G,qBAAa,eAAgB,SAAQ,oBAOpC;CAAG;AAEJ,+EAA+E;AAC/E,eAAO,MAAM,OAAO,iGAAoE,CAAC;AAEzF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAE1C,oFAAoF;AACpF,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { Source } from "@usine/expression/expression-engine";
2
+ import { Cron as EffectCron, DateTime, Effect, Option, Result, Schema } from "effect";
3
+ // Uses the same Cron parser the scheduler evaluates with, so a cron that parses
4
+ // here parses at tick time too. Cron.prev and Cron.next can still fail inside a
5
+ // DST gap; the scheduler isolates that per schedule.
6
+ const isFiveFieldCron = (value) => value.trim().split(/\s+/u).length === 5 && Result.isSuccess(EffectCron.parse(value));
7
+ /** A five-field schedule evaluated in the trigger's time zone. */
8
+ export const Cron = Schema.String.check(Schema.makeFilter(isFiveFieldCron, { message: "Expected a valid five-field cron expression" })).pipe(Schema.brand("Cron"));
9
+ const isTimeZone = (value) => Option.isSome(DateTime.zoneMakeNamed(value));
10
+ /** The IANA time zone whose local clock defines a schedule's firing times. */
11
+ export const TimeZone = Schema.String.check(Schema.makeFilter(isTimeZone, { message: "Expected an IANA time-zone name" })).pipe(Schema.brand("TimeZone"));
12
+ /** Watches issues and selects matching payloads with the Loop's `if` expression. */
13
+ export class IssueTrigger extends Schema.Class("@usine/config/IssueTrigger")({
14
+ on: Schema.Literal("issue"),
15
+ if: Source,
16
+ }) {
17
+ }
18
+ /** Watches pull requests and selects matching payloads with the Loop's `if` expression. */
19
+ export class PullRequestTrigger extends Schema.Class("@usine/config/PullRequestTrigger")({
20
+ on: Schema.Literal("pr"),
21
+ if: Source,
22
+ }) {
23
+ }
24
+ /** Fires per selected repository on a schedule, catching up only the latest missed Tick after downtime. */
25
+ export class ScheduleTrigger extends Schema.Class("@usine/config/ScheduleTrigger")({
26
+ on: Schema.Literal("schedule"),
27
+ if: Source,
28
+ cron: Cron,
29
+ tz: TimeZone.pipe(Schema.withDecodingDefaultKey(Effect.succeed("UTC"))),
30
+ }) {
31
+ }
32
+ /** The standing Item condition or schedule that produces Events for a Loop. */
33
+ export const Trigger = Schema.Union([IssueTrigger, PullRequestTrigger, ScheduleTrigger]);
34
+ //# sourceMappingURL=trigger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"trigger.js","sourceRoot":"","sources":["../src/trigger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAEtF,gFAAgF;AAChF,gFAAgF;AAChF,qDAAqD;AACrD,MAAM,eAAe,GAAG,CAAC,KAAa,EAAW,EAAE,CACjD,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,MAAM,KAAK,CAAC,IAAI,MAAM,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;AAEvF,kEAAkE;AAClE,MAAM,CAAC,MAAM,IAAI,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CACrC,MAAM,CAAC,UAAU,CAAC,eAAe,EAAE,EAAE,OAAO,EAAE,6CAA6C,EAAE,CAAC,CAC/F,CAAC,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;AAI7B,MAAM,UAAU,GAAG,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from "yaml";
3
+ import { ConfigFileError, type InstancePath } from "../file.ts";
4
+ /**
5
+ * Parses YAML into a Document AST that keeps source tokens, so an edit through
6
+ * it preserves formatting. Duplicate keys and parser warnings are errors.
7
+ */
8
+ export declare const parseYamlDocument: (file: InstancePath, source: string) => Effect.Effect<Document.Parsed, ConfigFileError>;
9
+ //# sourceMappingURL=document.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../src/yaml/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,KAAK,QAAQ,EAAiB,MAAM,MAAM,CAAC;AACpD,OAAO,EAAE,eAAe,EAAE,KAAK,YAAY,EAAE,MAAM,YAAY,CAAC;AAWhE;;;GAGG;AACH,eAAO,MAAM,iBAAiB,SACtB,YAAY,UACV,MAAM,KACb,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,eAAe,CA4B7C,CAAC"}
@@ -0,0 +1,38 @@
1
+ import { Effect, Option, Schema } from "effect";
2
+ import { parseDocument } from "yaml";
3
+ import { ConfigFileError } from "../file.js";
4
+ const causeMessage = (cause) => Option.match(Schema.decodeUnknownOption(Schema.Struct({ message: Schema.NonEmptyString }))(cause), {
5
+ onNone: () => "Unknown YAML parsing failure",
6
+ onSome: ({ message }) => message,
7
+ });
8
+ /**
9
+ * Parses YAML into a Document AST that keeps source tokens, so an edit through
10
+ * it preserves formatting. Duplicate keys and parser warnings are errors.
11
+ */
12
+ export const parseYamlDocument = (file, source) => Effect.gen(function* () {
13
+ const document = yield* Effect.try({
14
+ try: () => parseDocument(source, {
15
+ keepSourceTokens: true,
16
+ prettyErrors: true,
17
+ strict: true,
18
+ uniqueKeys: true,
19
+ }),
20
+ catch: (cause) => new ConfigFileError({
21
+ file,
22
+ stage: "yaml",
23
+ expression: Option.none(),
24
+ message: causeMessage(cause),
25
+ }),
26
+ });
27
+ const syntaxIssue = document.errors[0] ?? document.warnings[0];
28
+ if (syntaxIssue !== undefined) {
29
+ return yield* new ConfigFileError({
30
+ file,
31
+ stage: "yaml",
32
+ expression: Option.none(),
33
+ message: syntaxIssue.message,
34
+ });
35
+ }
36
+ return document;
37
+ });
38
+ //# sourceMappingURL=document.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/yaml/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAiB,aAAa,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,EAAE,eAAe,EAAqB,MAAM,YAAY,CAAC;AAEhE,MAAM,YAAY,GAAG,CAAC,KAAc,EAAU,EAAE,CAC9C,MAAM,CAAC,KAAK,CACV,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,EACpF;IACE,MAAM,EAAE,GAAG,EAAE,CAAC,8BAA8B;IAC5C,MAAM,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO;CACjC,CACF,CAAC;AAEJ;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAC/B,IAAkB,EAClB,MAAc,EACmC,EAAE,CACnD,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QACjC,GAAG,EAAE,GAAG,EAAE,CACR,aAAa,CAAC,MAAM,EAAE;YACpB,gBAAgB,EAAE,IAAI;YACtB,YAAY,EAAE,IAAI;YAClB,MAAM,EAAE,IAAI;YACZ,UAAU,EAAE,IAAI;SACjB,CAAC;QACJ,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CACf,IAAI,eAAe,CAAC;YAClB,IAAI;YACJ,KAAK,EAAE,MAAM;YACb,UAAU,EAAE,MAAM,CAAC,IAAI,EAAE;YACzB,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC;SAC7B,CAAC;KACL,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC/D,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,CAAC,IAAI,eAAe,CAAC;YAChC,IAAI;YACJ,KAAK,EAAE,MAAM;YACb,UAAU,EAAE,MAAM,CAAC,IAAI,EAAE;YACzB,OAAO,EAAE,WAAW,CAAC,OAAO;SAC7B,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { Effect, Schema } from "effect";
2
+ import type { ConfigFileError } from "../file.ts";
3
+ declare const YamlEdit_base: Schema.Class<YamlEdit, Schema.Struct<{
4
+ /** Path in file-key spelling, for example `["settings", "max_children"]`. */
5
+ readonly path: Schema.$Array<Schema.NonEmptyString>;
6
+ readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
7
+ }>, {}>;
8
+ /** One replacement in authored YAML, preserving the surrounding file. */
9
+ export declare class YamlEdit extends YamlEdit_base {
10
+ }
11
+ /** Sets one YAML path and returns the file with its comments, key order, and newline style intact. */
12
+ export declare const updateYaml: (file: string & import("effect/Brand").Brand<"InstancePath">, source: string, edit: YamlEdit) => Effect.Effect<string, ConfigFileError, never>;
13
+ /** Sets one YAML path in the frontmatter of a Markdown config file and returns the whole file. */
14
+ export declare const updateFrontmatter: (file: string & import("effect/Brand").Brand<"InstancePath">, source: string, edit: YamlEdit) => Effect.Effect<string, ConfigFileError, never>;
15
+ export {};
16
+ //# sourceMappingURL=writer.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/yaml/writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,YAAY,CAAC;;IAM9D,6EAA6E;;;;AAF/E,yEAAyE;AACzE,qBAAa,QAAS,SAAQ,aAI5B;CAAG;AAOL,sGAAsG;AACtG,eAAO,MAAM,UAAU,gJAQtB,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,gJAe7B,CAAC"}
@@ -0,0 +1,33 @@
1
+ import { Effect, Schema } from "effect";
2
+ import { splitMarkdown } from "../frontmatter.js";
3
+ import { parseYamlDocument } from "./document.js";
4
+ /** One replacement in authored YAML, preserving the surrounding file. */
5
+ export class YamlEdit extends Schema.Class("@usine/config/YamlEdit")({
6
+ /** Path in file-key spelling, for example `["settings", "max_children"]`. */
7
+ path: Schema.Array(Schema.NonEmptyString).check(Schema.isNonEmpty()),
8
+ value: Schema.Json,
9
+ }) {
10
+ }
11
+ const restoreNewlines = (text, newline) => {
12
+ const normalized = text.replaceAll("\r\n", "\n");
13
+ return newline === "\r\n" ? normalized.replaceAll("\n", "\r\n") : normalized;
14
+ };
15
+ /** Sets one YAML path and returns the file with its comments, key order, and newline style intact. */
16
+ export const updateYaml = Effect.fn("YamlWriter.updateYaml")((file, source, edit) => Effect.gen(function* () {
17
+ const document = yield* parseYamlDocument(file, source);
18
+ document.setIn(edit.path, edit.value);
19
+ // The stringifier always emits LF.
20
+ return restoreNewlines(document.toString(), source.includes("\r\n") ? "\r\n" : "\n");
21
+ }));
22
+ /** Sets one YAML path in the frontmatter of a Markdown config file and returns the whole file. */
23
+ export const updateFrontmatter = Effect.fn("YamlWriter.updateFrontmatter")((file, source, edit) => Effect.gen(function* () {
24
+ const markdown = yield* splitMarkdown(file, source);
25
+ // A one-line YAML half has no newline to infer a style from, so the file's
26
+ // delimiter decides.
27
+ const updated = restoreNewlines(yield* updateYaml(file, markdown.yaml, edit), markdown.newline);
28
+ const yaml = updated.endsWith(markdown.newline)
29
+ ? updated.slice(0, -markdown.newline.length)
30
+ : updated;
31
+ return `---${markdown.newline}${yaml}${markdown.newline}---${markdown.newline}${markdown.body}`;
32
+ }));
33
+ //# sourceMappingURL=writer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writer.js","sourceRoot":"","sources":["../../src/yaml/writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,yEAAyE;AACzE,MAAM,OAAO,QAAS,SAAQ,MAAM,CAAC,KAAK,CAAW,wBAAwB,CAAC,CAAC;IAC7E,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IACpE,KAAK,EAAE,MAAM,CAAC,IAAI;CACnB,CAAC;CAAG;AAEL,MAAM,eAAe,GAAG,CAAC,IAAY,EAAE,OAAsB,EAAU,EAAE;IACvE,MAAM,UAAU,GAAG,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACjD,OAAO,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;AAC/E,CAAC,CAAC;AAEF,sGAAsG;AACtG,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,EAAE,CAAC,uBAAuB,CAAC,CAC1D,CAAC,IAAkB,EAAE,MAAc,EAAE,IAAc,EAA0C,EAAE,CAC7F,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;IAClB,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,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