gagen 0.2.10 → 0.2.12
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/esm/artifact.d.ts +4 -2
- package/esm/artifact.d.ts.map +1 -1
- package/esm/artifact.js +18 -8
- package/esm/expression.d.ts +13 -0
- package/esm/expression.d.ts.map +1 -1
- package/esm/expression.js +24 -15
- package/esm/mod.d.ts +1 -1
- package/esm/mod.d.ts.map +1 -1
- package/esm/mod.js +1 -1
- package/package.json +1 -1
package/esm/artifact.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Step } from "./step.js";
|
|
2
2
|
export interface UploadConfig {
|
|
3
|
-
path
|
|
3
|
+
path?: string;
|
|
4
4
|
retentionDays?: number;
|
|
5
5
|
}
|
|
6
6
|
export interface DownloadConfig {
|
|
@@ -8,12 +8,14 @@ export interface DownloadConfig {
|
|
|
8
8
|
}
|
|
9
9
|
export interface ArtifactOptions {
|
|
10
10
|
version?: string;
|
|
11
|
+
path?: string;
|
|
12
|
+
retentionDays?: number;
|
|
11
13
|
}
|
|
12
14
|
export declare class Artifact {
|
|
13
15
|
#private;
|
|
14
16
|
readonly name: string;
|
|
15
17
|
constructor(name: string, options?: ArtifactOptions);
|
|
16
|
-
upload(config
|
|
18
|
+
upload(config?: UploadConfig): Step;
|
|
17
19
|
download(config?: DownloadConfig): Step;
|
|
18
20
|
}
|
|
19
21
|
export declare function defineArtifact(name: string, options?: ArtifactOptions): Artifact;
|
package/esm/artifact.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../src/artifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../src/artifact.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,WAAW,YAAY;IAC3B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,QAAQ;;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;gBAMV,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,eAAe;IAOnD,MAAM,CAAC,MAAM,GAAE,YAAiB,GAAG,IAAI;IAuBvC,QAAQ,CAAC,MAAM,GAAE,cAAmB,GAAG,IAAI;CAgB5C;AAED,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,eAAe,GACxB,QAAQ,CAEV"}
|
package/esm/artifact.js
CHANGED
|
@@ -9,7 +9,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
9
9
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
10
10
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
11
11
|
};
|
|
12
|
-
var _Artifact_version, _Artifact_uploadStep;
|
|
12
|
+
var _Artifact_version, _Artifact_path, _Artifact_retentionDays, _Artifact_uploadStep;
|
|
13
13
|
import { Step } from "./step.js";
|
|
14
14
|
export class Artifact {
|
|
15
15
|
constructor(name, options) {
|
|
@@ -20,17 +20,26 @@ export class Artifact {
|
|
|
20
20
|
value: void 0
|
|
21
21
|
});
|
|
22
22
|
_Artifact_version.set(this, void 0);
|
|
23
|
+
_Artifact_path.set(this, void 0);
|
|
24
|
+
_Artifact_retentionDays.set(this, void 0);
|
|
23
25
|
_Artifact_uploadStep.set(this, void 0);
|
|
24
26
|
this.name = name;
|
|
25
27
|
__classPrivateFieldSet(this, _Artifact_version, options?.version ?? "v6", "f");
|
|
28
|
+
__classPrivateFieldSet(this, _Artifact_path, options?.path, "f");
|
|
29
|
+
__classPrivateFieldSet(this, _Artifact_retentionDays, options?.retentionDays, "f");
|
|
26
30
|
}
|
|
27
|
-
upload(config) {
|
|
31
|
+
upload(config = {}) {
|
|
32
|
+
const path = config.path ?? __classPrivateFieldGet(this, _Artifact_path, "f");
|
|
33
|
+
if (path == null) {
|
|
34
|
+
throw new Error(`Artifact "${this.name}": upload requires a path, either in ArtifactOptions or UploadConfig`);
|
|
35
|
+
}
|
|
28
36
|
const withObj = {
|
|
29
37
|
name: this.name,
|
|
30
|
-
path
|
|
38
|
+
path,
|
|
31
39
|
};
|
|
32
|
-
|
|
33
|
-
|
|
40
|
+
const retentionDays = config.retentionDays ?? __classPrivateFieldGet(this, _Artifact_retentionDays, "f");
|
|
41
|
+
if (retentionDays != null) {
|
|
42
|
+
withObj["retention-days"] = retentionDays;
|
|
34
43
|
}
|
|
35
44
|
const s = new Step({
|
|
36
45
|
uses: `actions/upload-artifact@${__classPrivateFieldGet(this, _Artifact_version, "f")}`,
|
|
@@ -43,8 +52,9 @@ export class Artifact {
|
|
|
43
52
|
const withObj = {
|
|
44
53
|
name: this.name,
|
|
45
54
|
};
|
|
46
|
-
|
|
47
|
-
|
|
55
|
+
const path = config.path ?? __classPrivateFieldGet(this, _Artifact_path, "f");
|
|
56
|
+
if (path != null) {
|
|
57
|
+
withObj.path = path;
|
|
48
58
|
}
|
|
49
59
|
return new Step({
|
|
50
60
|
uses: `actions/download-artifact@${__classPrivateFieldGet(this, _Artifact_version, "f")}`,
|
|
@@ -52,7 +62,7 @@ export class Artifact {
|
|
|
52
62
|
}, __classPrivateFieldGet(this, _Artifact_uploadStep, "f") ? [__classPrivateFieldGet(this, _Artifact_uploadStep, "f")] : []);
|
|
53
63
|
}
|
|
54
64
|
}
|
|
55
|
-
_Artifact_version = new WeakMap(), _Artifact_uploadStep = new WeakMap();
|
|
65
|
+
_Artifact_version = new WeakMap(), _Artifact_path = new WeakMap(), _Artifact_retentionDays = new WeakMap(), _Artifact_uploadStep = new WeakMap();
|
|
56
66
|
export function defineArtifact(name, options) {
|
|
57
67
|
return new Artifact(name, options);
|
|
58
68
|
}
|
package/esm/expression.d.ts
CHANGED
|
@@ -23,6 +23,11 @@ export declare class ExpressionValue {
|
|
|
23
23
|
/** wrap in `${{ }}` for use in YAML */
|
|
24
24
|
toString(): string;
|
|
25
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* A boolean condition used in `if` fields. Supports fluent `.and()`, `.or()`,
|
|
28
|
+
* `.not()` composition. Tracks all ExpressionSources referenced so that
|
|
29
|
+
* dependencies can be inferred automatically.
|
|
30
|
+
*/
|
|
26
31
|
export declare abstract class Condition {
|
|
27
32
|
readonly sources: ReadonlySet<ExpressionSource>;
|
|
28
33
|
constructor(sources: ReadonlySet<ExpressionSource>);
|
|
@@ -49,6 +54,10 @@ export declare abstract class Condition {
|
|
|
49
54
|
flattenOr(): Condition[];
|
|
50
55
|
/** returns true if this condition always evaluates to true */
|
|
51
56
|
isAlwaysTrue(): boolean;
|
|
57
|
+
/** returns true if this condition always evaluates to false */
|
|
58
|
+
isAlwaysFalse(): boolean;
|
|
59
|
+
/** returns true if this condition could possibly evaluate to true */
|
|
60
|
+
isPossiblyTrue(): boolean;
|
|
52
61
|
/** render without `${{ }}` wrapping */
|
|
53
62
|
abstract toExpression(): string;
|
|
54
63
|
/** render wrapped in `${{ }}` for YAML `if` fields */
|
|
@@ -72,6 +81,7 @@ export declare class RawCondition extends Condition {
|
|
|
72
81
|
#private;
|
|
73
82
|
constructor(expression: string, sources: ReadonlySet<ExpressionSource>);
|
|
74
83
|
isAlwaysTrue(): boolean;
|
|
84
|
+
isAlwaysFalse(): boolean;
|
|
75
85
|
not(): Condition;
|
|
76
86
|
toExpression(): string;
|
|
77
87
|
}
|
|
@@ -215,6 +225,9 @@ export declare class ElseIfBuilder {
|
|
|
215
225
|
/** Provide the value for this branch. */
|
|
216
226
|
then(value: TernaryValue): ThenBuilder;
|
|
217
227
|
}
|
|
228
|
+
/** Creates an ExpressionValue or Condition from a literal value. */
|
|
229
|
+
export declare function literal(value: boolean): Condition;
|
|
230
|
+
export declare function literal(value: string | number): ExpressionValue;
|
|
218
231
|
/** Maps a property type to Condition (for booleans/conditions) or ExpressionValue (for values). */
|
|
219
232
|
export type ExprOf<T> = [T] extends [boolean | Condition] ? Condition : ExpressionValue;
|
|
220
233
|
/** Maps all properties of an object to their expression/condition form. */
|
package/esm/expression.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"expression.d.ts","sourceRoot":"","sources":["../src/expression.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,gBAAgB,GAAG;IAAE,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAA;CAAE,CAAC;AAIvD,wEAAwE;AACxE,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,eAAe,CAAC;AAEvE;;;GAGG;AACH,qBAAa,eAAe;;IAE1B,QAAQ,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAAC;gBAI5C,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,gBAAgB,GAAG,WAAW,CAAC,gBAAgB,CAAC;IAa3D,sDAAsD;IACtD,IAAI,UAAU,IAAI,WAAW,CAAC,gBAAgB,CAAC,CAE9C;IAED,oDAAoD;IACpD,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS;IASnD,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,SAAS;IAStD,UAAU,C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allSources = new W
|
|
|
80
80
|
* `.not()` composition. Tracks all ExpressionSources referenced so that
|
|
81
81
|
* dependencies can be inferred automatically.
|
|
82
82
|
*/
|
|
83
|
-
// helpers for construction-time simplification
|
|
84
|
-
function isTrueCondition(c) {
|
|
85
|
-
return c instanceof RawCondition && c.toExpression() === "true";
|
|
86
|
-
}
|
|
87
|
-
function isFalseCondition(c) {
|
|
88
|
-
return c instanceof RawCondition && c.toExpression() === "false";
|
|
89
|
-
}
|
|
90
83
|
export class Condition {
|
|
91
84
|
constructor(sources) {
|
|
92
85
|
Object.defineProperty(this, "sources", {
|
|
@@ -101,11 +94,11 @@ export class Condition {
|
|
|
101
94
|
const right = typeof other === "boolean"
|
|
102
95
|
? new RawCondition(String(other), EMPTY_SOURCES)
|
|
103
96
|
: other;
|
|
104
|
-
if (
|
|
97
|
+
if (this.isAlwaysTrue())
|
|
105
98
|
return right;
|
|
106
|
-
if (
|
|
99
|
+
if (right.isAlwaysTrue())
|
|
107
100
|
return this;
|
|
108
|
-
if (
|
|
101
|
+
if (this.isAlwaysFalse() || right.isAlwaysFalse()) {
|
|
109
102
|
return new RawCondition("false", unionSources(this, right));
|
|
110
103
|
}
|
|
111
104
|
return new LogicalCondition("&&", this, right, unionSources(this, right));
|
|
@@ -114,11 +107,11 @@ export class Condition {
|
|
|
114
107
|
const right = typeof other === "boolean"
|
|
115
108
|
? new RawCondition(String(other), EMPTY_SOURCES)
|
|
116
109
|
: other;
|
|
117
|
-
if (
|
|
110
|
+
if (this.isAlwaysFalse())
|
|
118
111
|
return right;
|
|
119
|
-
if (
|
|
112
|
+
if (right.isAlwaysFalse())
|
|
120
113
|
return this;
|
|
121
|
-
if (
|
|
114
|
+
if (this.isAlwaysTrue() || right.isAlwaysTrue()) {
|
|
122
115
|
return new RawCondition("true", unionSources(this, right));
|
|
123
116
|
}
|
|
124
117
|
return new LogicalCondition("||", this, right, unionSources(this, right));
|
|
@@ -156,6 +149,14 @@ export class Condition {
|
|
|
156
149
|
isAlwaysTrue() {
|
|
157
150
|
return false;
|
|
158
151
|
}
|
|
152
|
+
/** returns true if this condition always evaluates to false */
|
|
153
|
+
isAlwaysFalse() {
|
|
154
|
+
return false;
|
|
155
|
+
}
|
|
156
|
+
/** returns true if this condition could possibly evaluate to true */
|
|
157
|
+
isPossiblyTrue() {
|
|
158
|
+
return !this.isAlwaysFalse();
|
|
159
|
+
}
|
|
159
160
|
/** render wrapped in `${{ }}` for YAML `if` fields */
|
|
160
161
|
toString() {
|
|
161
162
|
return `\${{ ${this.toExpression()} }}`;
|
|
@@ -280,6 +281,9 @@ export class RawCondition extends Condition {
|
|
|
280
281
|
isAlwaysTrue() {
|
|
281
282
|
return __classPrivateFieldGet(this, _RawCondition_expression, "f") === "true";
|
|
282
283
|
}
|
|
284
|
+
isAlwaysFalse() {
|
|
285
|
+
return __classPrivateFieldGet(this, _RawCondition_expression, "f") === "false";
|
|
286
|
+
}
|
|
283
287
|
not() {
|
|
284
288
|
if (__classPrivateFieldGet(this, _RawCondition_expression, "f") === "true") {
|
|
285
289
|
return new RawCondition("false", this.sources);
|
|
@@ -409,7 +413,7 @@ export function isAlwaysTrue(c) {
|
|
|
409
413
|
/** Checks if a condition-like value always evaluates to false. */
|
|
410
414
|
export function isAlwaysFalse(c) {
|
|
411
415
|
if (c instanceof Condition)
|
|
412
|
-
return
|
|
416
|
+
return c.isAlwaysFalse();
|
|
413
417
|
if (typeof c === "string")
|
|
414
418
|
return c === "false";
|
|
415
419
|
return false;
|
|
@@ -545,7 +549,12 @@ export class ElseIfBuilder {
|
|
|
545
549
|
}
|
|
546
550
|
}
|
|
547
551
|
_ElseIfBuilder_branches = new WeakMap(), _ElseIfBuilder_sources = new WeakMap(), _ElseIfBuilder_condition = new WeakMap();
|
|
548
|
-
|
|
552
|
+
export function literal(value) {
|
|
553
|
+
if (typeof value === "boolean") {
|
|
554
|
+
return new RawCondition(String(value), EMPTY_SOURCES);
|
|
555
|
+
}
|
|
556
|
+
return new InlineValue(value);
|
|
557
|
+
}
|
|
549
558
|
class InlineValue extends ExpressionValue {
|
|
550
559
|
constructor(value) {
|
|
551
560
|
super(typeof value === "string" ? `'${value}'` : String(value));
|
package/esm/mod.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export { Job, job } from "./job.js";
|
|
|
5
5
|
export type { JobConfig, JobDef, ReusableJobConfig, ReusableJobDef, ServiceContainer, StepsJobConfig, StepsJobDef, } from "./job.js";
|
|
6
6
|
export { createWorkflow, isLinting, Workflow } from "./workflow.js";
|
|
7
7
|
export type { WorkflowCallInput, WorkflowCallOutput, WorkflowCallSecret, WorkflowCallTrigger, WorkflowConfig, WorkflowTriggers, } from "./workflow.js";
|
|
8
|
-
export { Condition, conditions, defineExprObj, ElseIfBuilder, expr, ExpressionValue, ThenBuilder, } from "./expression.js";
|
|
8
|
+
export { Condition, conditions, defineExprObj, ElseIfBuilder, expr, ExpressionValue, literal, ThenBuilder, } from "./expression.js";
|
|
9
9
|
export type { ExpressionSource, ExprMap, ExprOf, TernaryValue, } from "./expression.js";
|
|
10
10
|
export { defineMatrix, Matrix } from "./matrix.js";
|
|
11
11
|
export type { PermissionLevel, Permissions, PermissionScope, } from "./permissions.js";
|
package/esm/mod.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../src/mod.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAChD,YAAY,EACV,aAAa,EACb,WAAW,EACX,WAAW,EACX,UAAU,EACV,YAAY,EACZ,QAAQ,GACT,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AACpC,YAAY,EACV,SAAS,EACT,MAAM,EACN,iBAAiB,EACjB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,WAAW,GACZ,MAAM,UAAU,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ClB,kBAAkB,EAClB,mBAAmB,EACnB,cAAc,EACd,gBAAgB,GACjB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,SAAS,EACT,UAAU,EACV,aAAa,EACb,aAAa,EACb,IAAI,EACJ,eAAe,EACf,OAAO,EACP,WAAW,GACZ,MAAM,iBAAiB,CAAC;AACzB,YAAY,EACV,gBAAgB,EAChB,OAAO,EACP,MAAM,EACN,YAAY,GACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACnD,YAAY,EACV,eAAe,EACf,WAAW,EACX,eAAe,GAChB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACzD,YAAY,EACV,eAAe,EACf,cAAc,EACd,YAAY,GACb,MAAM,eAAe,CAAC"}
|
package/esm/mod.js
CHANGED
|
@@ -2,6 +2,6 @@ import "./_dnt.polyfills.js";
|
|
|
2
2
|
export { Step, step, StepRef } from "./step.js";
|
|
3
3
|
export { Job, job } from "./job.js";
|
|
4
4
|
export { createWorkflow, isLinting, Workflow } from "./workflow.js";
|
|
5
|
-
export { Condition, conditions, defineExprObj, ElseIfBuilder, expr, ExpressionValue, ThenBuilder, } from "./expression.js";
|
|
5
|
+
export { Condition, conditions, defineExprObj, ElseIfBuilder, expr, ExpressionValue, literal, ThenBuilder, } from "./expression.js";
|
|
6
6
|
export { defineMatrix, Matrix } from "./matrix.js";
|
|
7
7
|
export { Artifact, defineArtifact } from "./artifact.js";
|