@dagger.io/dagger 0.13.5 → 0.13.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/client.gen.d.ts +156 -4
- package/dist/api/client.gen.d.ts.map +1 -1
- package/dist/api/client.gen.js +342 -5
- package/dist/common/errors/FunctionNotFound.d.ts +7 -0
- package/dist/common/errors/FunctionNotFound.d.ts.map +1 -0
- package/dist/common/errors/FunctionNotFound.js +9 -0
- package/dist/entrypoint/context.d.ts +1 -1
- package/dist/entrypoint/entrypoint.d.ts.map +1 -1
- package/dist/entrypoint/entrypoint.js +4 -2
- package/dist/entrypoint/invoke.d.ts +2 -1
- package/dist/entrypoint/invoke.d.ts.map +1 -1
- package/dist/entrypoint/invoke.js +20 -4
- package/dist/entrypoint/load.d.ts +7 -5
- package/dist/entrypoint/load.d.ts.map +1 -1
- package/dist/entrypoint/load.js +8 -9
- package/dist/introspector/executor/executor.d.ts +13 -0
- package/dist/introspector/executor/executor.d.ts.map +1 -0
- package/dist/introspector/executor/executor.js +32 -0
- package/dist/provisioning/default.d.ts +1 -1
- package/dist/provisioning/default.js +1 -1
- package/package.json +1 -1
package/dist/api/client.gen.js
CHANGED
|
@@ -73,6 +73,24 @@ export var NetworkProtocol;
|
|
|
73
73
|
NetworkProtocol["Tcp"] = "TCP";
|
|
74
74
|
NetworkProtocol["Udp"] = "UDP";
|
|
75
75
|
})(NetworkProtocol || (NetworkProtocol = {}));
|
|
76
|
+
/**
|
|
77
|
+
* Expected return type of an execution
|
|
78
|
+
*/
|
|
79
|
+
export var ReturnType;
|
|
80
|
+
(function (ReturnType) {
|
|
81
|
+
/**
|
|
82
|
+
* Any execution (exit codes 0-127)
|
|
83
|
+
*/
|
|
84
|
+
ReturnType["Any"] = "ANY";
|
|
85
|
+
/**
|
|
86
|
+
* A failed execution (exit codes 1-127)
|
|
87
|
+
*/
|
|
88
|
+
ReturnType["Failure"] = "FAILURE";
|
|
89
|
+
/**
|
|
90
|
+
* A successful execution (exit code 0)
|
|
91
|
+
*/
|
|
92
|
+
ReturnType["Success"] = "SUCCESS";
|
|
93
|
+
})(ReturnType || (ReturnType = {}));
|
|
76
94
|
/**
|
|
77
95
|
* Distinguishes the different kinds of TypeDefs.
|
|
78
96
|
*/
|
|
@@ -163,6 +181,7 @@ export class CacheVolume extends BaseClient {
|
|
|
163
181
|
export class Container extends BaseClient {
|
|
164
182
|
_id = undefined;
|
|
165
183
|
_envVariable = undefined;
|
|
184
|
+
_exitCode = undefined;
|
|
166
185
|
_export = undefined;
|
|
167
186
|
_imageRef = undefined;
|
|
168
187
|
_label = undefined;
|
|
@@ -177,10 +196,11 @@ export class Container extends BaseClient {
|
|
|
177
196
|
/**
|
|
178
197
|
* Constructor is used for internal usage only, do not create object from it.
|
|
179
198
|
*/
|
|
180
|
-
constructor(parent, _id, _envVariable, _export, _imageRef, _label, _platform, _publish, _stderr, _stdout, _sync, _up, _user, _workdir) {
|
|
199
|
+
constructor(parent, _id, _envVariable, _exitCode, _export, _imageRef, _label, _platform, _publish, _stderr, _stdout, _sync, _up, _user, _workdir) {
|
|
181
200
|
super(parent);
|
|
182
201
|
this._id = _id;
|
|
183
202
|
this._envVariable = _envVariable;
|
|
203
|
+
this._exitCode = _exitCode;
|
|
184
204
|
this._export = _export;
|
|
185
205
|
this._imageRef = _imageRef;
|
|
186
206
|
this._label = _label;
|
|
@@ -359,6 +379,23 @@ export class Container extends BaseClient {
|
|
|
359
379
|
ctx: this._ctx,
|
|
360
380
|
}, r.id));
|
|
361
381
|
};
|
|
382
|
+
/**
|
|
383
|
+
* The exit code of the last executed command.
|
|
384
|
+
*
|
|
385
|
+
* Returns an error if no command was set.
|
|
386
|
+
*/
|
|
387
|
+
exitCode = async () => {
|
|
388
|
+
if (this._exitCode) {
|
|
389
|
+
return this._exitCode;
|
|
390
|
+
}
|
|
391
|
+
const response = await computeQuery([
|
|
392
|
+
...this._queryTree,
|
|
393
|
+
{
|
|
394
|
+
operation: "exitCode",
|
|
395
|
+
},
|
|
396
|
+
], await this._ctx.connection());
|
|
397
|
+
return response;
|
|
398
|
+
};
|
|
362
399
|
/**
|
|
363
400
|
* EXPERIMENTAL API! Subject to change/removal at any time.
|
|
364
401
|
*
|
|
@@ -646,7 +683,7 @@ export class Container extends BaseClient {
|
|
|
646
683
|
/**
|
|
647
684
|
* The error stream of the last executed command.
|
|
648
685
|
*
|
|
649
|
-
*
|
|
686
|
+
* Returns an error if no command was set.
|
|
650
687
|
*/
|
|
651
688
|
stderr = async () => {
|
|
652
689
|
if (this._stderr) {
|
|
@@ -663,7 +700,7 @@ export class Container extends BaseClient {
|
|
|
663
700
|
/**
|
|
664
701
|
* The output stream of the last executed command.
|
|
665
702
|
*
|
|
666
|
-
*
|
|
703
|
+
* Returns an error if no command was set.
|
|
667
704
|
*/
|
|
668
705
|
stdout = async () => {
|
|
669
706
|
if (this._stdout) {
|
|
@@ -877,6 +914,7 @@ export class Container extends BaseClient {
|
|
|
877
914
|
* @param opts.stdin Content to write to the command's standard input before closing (e.g., "Hello world").
|
|
878
915
|
* @param opts.redirectStdout Redirect the command's standard output to a file in the container (e.g., "/tmp/stdout").
|
|
879
916
|
* @param opts.redirectStderr Redirect the command's standard error to a file in the container (e.g., "/tmp/stderr").
|
|
917
|
+
* @param opts.expect Exit codes this command is allowed to exit with without error
|
|
880
918
|
* @param opts.experimentalPrivilegedNesting Provides Dagger access to the executed command.
|
|
881
919
|
*
|
|
882
920
|
* Do not use this option unless you trust the command being executed; the command being executed WILL BE GRANTED FULL ACCESS TO YOUR HOST FILESYSTEM.
|
|
@@ -887,12 +925,15 @@ export class Container extends BaseClient {
|
|
|
887
925
|
* This should only be used if the user requires that their exec process be the pid 1 process in the container. Otherwise it may result in unexpected behavior.
|
|
888
926
|
*/
|
|
889
927
|
withExec = (args, opts) => {
|
|
928
|
+
const metadata = {
|
|
929
|
+
expect: { is_enum: true },
|
|
930
|
+
};
|
|
890
931
|
return new Container({
|
|
891
932
|
queryTree: [
|
|
892
933
|
...this._queryTree,
|
|
893
934
|
{
|
|
894
935
|
operation: "withExec",
|
|
895
|
-
args: { args, ...opts },
|
|
936
|
+
args: { args, ...opts, __metadata: metadata },
|
|
896
937
|
},
|
|
897
938
|
],
|
|
898
939
|
ctx: this._ctx,
|
|
@@ -1711,15 +1752,21 @@ export class DaggerEngine extends BaseClient {
|
|
|
1711
1752
|
export class DaggerEngineCache extends BaseClient {
|
|
1712
1753
|
_id = undefined;
|
|
1713
1754
|
_keepBytes = undefined;
|
|
1755
|
+
_maxUsedSpace = undefined;
|
|
1756
|
+
_minFreeSpace = undefined;
|
|
1714
1757
|
_prune = undefined;
|
|
1758
|
+
_reservedSpace = undefined;
|
|
1715
1759
|
/**
|
|
1716
1760
|
* Constructor is used for internal usage only, do not create object from it.
|
|
1717
1761
|
*/
|
|
1718
|
-
constructor(parent, _id, _keepBytes, _prune) {
|
|
1762
|
+
constructor(parent, _id, _keepBytes, _maxUsedSpace, _minFreeSpace, _prune, _reservedSpace) {
|
|
1719
1763
|
super(parent);
|
|
1720
1764
|
this._id = _id;
|
|
1721
1765
|
this._keepBytes = _keepBytes;
|
|
1766
|
+
this._maxUsedSpace = _maxUsedSpace;
|
|
1767
|
+
this._minFreeSpace = _minFreeSpace;
|
|
1722
1768
|
this._prune = _prune;
|
|
1769
|
+
this._reservedSpace = _reservedSpace;
|
|
1723
1770
|
}
|
|
1724
1771
|
/**
|
|
1725
1772
|
* A unique identifier for this DaggerEngineCache.
|
|
@@ -1752,6 +1799,7 @@ export class DaggerEngineCache extends BaseClient {
|
|
|
1752
1799
|
};
|
|
1753
1800
|
/**
|
|
1754
1801
|
* The maximum bytes to keep in the cache without pruning, after which automatic pruning may kick in.
|
|
1802
|
+
* @deprecated Use minFreeSpace instead.
|
|
1755
1803
|
*/
|
|
1756
1804
|
keepBytes = async () => {
|
|
1757
1805
|
if (this._keepBytes) {
|
|
@@ -1765,6 +1813,36 @@ export class DaggerEngineCache extends BaseClient {
|
|
|
1765
1813
|
], await this._ctx.connection());
|
|
1766
1814
|
return response;
|
|
1767
1815
|
};
|
|
1816
|
+
/**
|
|
1817
|
+
* The maximum bytes to keep in the cache without pruning.
|
|
1818
|
+
*/
|
|
1819
|
+
maxUsedSpace = async () => {
|
|
1820
|
+
if (this._maxUsedSpace) {
|
|
1821
|
+
return this._maxUsedSpace;
|
|
1822
|
+
}
|
|
1823
|
+
const response = await computeQuery([
|
|
1824
|
+
...this._queryTree,
|
|
1825
|
+
{
|
|
1826
|
+
operation: "maxUsedSpace",
|
|
1827
|
+
},
|
|
1828
|
+
], await this._ctx.connection());
|
|
1829
|
+
return response;
|
|
1830
|
+
};
|
|
1831
|
+
/**
|
|
1832
|
+
* The target amount of free disk space the garbage collector will attempt to leave.
|
|
1833
|
+
*/
|
|
1834
|
+
minFreeSpace = async () => {
|
|
1835
|
+
if (this._minFreeSpace) {
|
|
1836
|
+
return this._minFreeSpace;
|
|
1837
|
+
}
|
|
1838
|
+
const response = await computeQuery([
|
|
1839
|
+
...this._queryTree,
|
|
1840
|
+
{
|
|
1841
|
+
operation: "minFreeSpace",
|
|
1842
|
+
},
|
|
1843
|
+
], await this._ctx.connection());
|
|
1844
|
+
return response;
|
|
1845
|
+
};
|
|
1768
1846
|
/**
|
|
1769
1847
|
* Prune the cache of releaseable entries
|
|
1770
1848
|
*/
|
|
@@ -1779,6 +1857,18 @@ export class DaggerEngineCache extends BaseClient {
|
|
|
1779
1857
|
},
|
|
1780
1858
|
], await this._ctx.connection());
|
|
1781
1859
|
};
|
|
1860
|
+
reservedSpace = async () => {
|
|
1861
|
+
if (this._reservedSpace) {
|
|
1862
|
+
return this._reservedSpace;
|
|
1863
|
+
}
|
|
1864
|
+
const response = await computeQuery([
|
|
1865
|
+
...this._queryTree,
|
|
1866
|
+
{
|
|
1867
|
+
operation: "reservedSpace",
|
|
1868
|
+
},
|
|
1869
|
+
], await this._ctx.connection());
|
|
1870
|
+
return response;
|
|
1871
|
+
};
|
|
1782
1872
|
}
|
|
1783
1873
|
/**
|
|
1784
1874
|
* An individual cache entry in a cache entry set
|
|
@@ -2432,6 +2522,20 @@ export class EnumTypeDef extends BaseClient {
|
|
|
2432
2522
|
], await this._ctx.connection());
|
|
2433
2523
|
return response;
|
|
2434
2524
|
};
|
|
2525
|
+
/**
|
|
2526
|
+
* The location of this enum declaration.
|
|
2527
|
+
*/
|
|
2528
|
+
sourceMap = () => {
|
|
2529
|
+
return new SourceMap({
|
|
2530
|
+
queryTree: [
|
|
2531
|
+
...this._queryTree,
|
|
2532
|
+
{
|
|
2533
|
+
operation: "sourceMap",
|
|
2534
|
+
},
|
|
2535
|
+
],
|
|
2536
|
+
ctx: this._ctx,
|
|
2537
|
+
});
|
|
2538
|
+
};
|
|
2435
2539
|
/**
|
|
2436
2540
|
* If this EnumTypeDef is associated with a Module, the name of the module. Unset otherwise.
|
|
2437
2541
|
*/
|
|
@@ -2532,6 +2636,20 @@ export class EnumValueTypeDef extends BaseClient {
|
|
|
2532
2636
|
], await this._ctx.connection());
|
|
2533
2637
|
return response;
|
|
2534
2638
|
};
|
|
2639
|
+
/**
|
|
2640
|
+
* The location of this enum value declaration.
|
|
2641
|
+
*/
|
|
2642
|
+
sourceMap = () => {
|
|
2643
|
+
return new SourceMap({
|
|
2644
|
+
queryTree: [
|
|
2645
|
+
...this._queryTree,
|
|
2646
|
+
{
|
|
2647
|
+
operation: "sourceMap",
|
|
2648
|
+
},
|
|
2649
|
+
],
|
|
2650
|
+
ctx: this._ctx,
|
|
2651
|
+
});
|
|
2652
|
+
};
|
|
2535
2653
|
}
|
|
2536
2654
|
/**
|
|
2537
2655
|
* An environment variable name and value.
|
|
@@ -2658,6 +2776,20 @@ export class FieldTypeDef extends BaseClient {
|
|
|
2658
2776
|
], await this._ctx.connection());
|
|
2659
2777
|
return response;
|
|
2660
2778
|
};
|
|
2779
|
+
/**
|
|
2780
|
+
* The location of this field declaration.
|
|
2781
|
+
*/
|
|
2782
|
+
sourceMap = () => {
|
|
2783
|
+
return new SourceMap({
|
|
2784
|
+
queryTree: [
|
|
2785
|
+
...this._queryTree,
|
|
2786
|
+
{
|
|
2787
|
+
operation: "sourceMap",
|
|
2788
|
+
},
|
|
2789
|
+
],
|
|
2790
|
+
ctx: this._ctx,
|
|
2791
|
+
});
|
|
2792
|
+
};
|
|
2661
2793
|
/**
|
|
2662
2794
|
* The type of the field.
|
|
2663
2795
|
*/
|
|
@@ -2955,6 +3087,20 @@ export class Function_ extends BaseClient {
|
|
|
2955
3087
|
ctx: this._ctx,
|
|
2956
3088
|
});
|
|
2957
3089
|
};
|
|
3090
|
+
/**
|
|
3091
|
+
* The location of this function declaration.
|
|
3092
|
+
*/
|
|
3093
|
+
sourceMap = () => {
|
|
3094
|
+
return new SourceMap({
|
|
3095
|
+
queryTree: [
|
|
3096
|
+
...this._queryTree,
|
|
3097
|
+
{
|
|
3098
|
+
operation: "sourceMap",
|
|
3099
|
+
},
|
|
3100
|
+
],
|
|
3101
|
+
ctx: this._ctx,
|
|
3102
|
+
});
|
|
3103
|
+
};
|
|
2958
3104
|
/**
|
|
2959
3105
|
* Returns the function with the provided argument
|
|
2960
3106
|
* @param name The name of the argument
|
|
@@ -2992,6 +3138,22 @@ export class Function_ extends BaseClient {
|
|
|
2992
3138
|
ctx: this._ctx,
|
|
2993
3139
|
});
|
|
2994
3140
|
};
|
|
3141
|
+
/**
|
|
3142
|
+
* Returns the function with the given source map.
|
|
3143
|
+
* @param sourceMap The source map for the function definition.
|
|
3144
|
+
*/
|
|
3145
|
+
withSourceMap = (sourceMap) => {
|
|
3146
|
+
return new Function_({
|
|
3147
|
+
queryTree: [
|
|
3148
|
+
...this._queryTree,
|
|
3149
|
+
{
|
|
3150
|
+
operation: "withSourceMap",
|
|
3151
|
+
args: { sourceMap },
|
|
3152
|
+
},
|
|
3153
|
+
],
|
|
3154
|
+
ctx: this._ctx,
|
|
3155
|
+
});
|
|
3156
|
+
};
|
|
2995
3157
|
/**
|
|
2996
3158
|
* Call the provided function with current Function.
|
|
2997
3159
|
*
|
|
@@ -3110,6 +3272,20 @@ export class FunctionArg extends BaseClient {
|
|
|
3110
3272
|
], await this._ctx.connection());
|
|
3111
3273
|
return response;
|
|
3112
3274
|
};
|
|
3275
|
+
/**
|
|
3276
|
+
* The location of this arg declaration.
|
|
3277
|
+
*/
|
|
3278
|
+
sourceMap = () => {
|
|
3279
|
+
return new SourceMap({
|
|
3280
|
+
queryTree: [
|
|
3281
|
+
...this._queryTree,
|
|
3282
|
+
{
|
|
3283
|
+
operation: "sourceMap",
|
|
3284
|
+
},
|
|
3285
|
+
],
|
|
3286
|
+
ctx: this._ctx,
|
|
3287
|
+
});
|
|
3288
|
+
};
|
|
3113
3289
|
/**
|
|
3114
3290
|
* The type of the argument.
|
|
3115
3291
|
*/
|
|
@@ -4094,6 +4270,20 @@ export class InterfaceTypeDef extends BaseClient {
|
|
|
4094
4270
|
], await this._ctx.connection());
|
|
4095
4271
|
return response;
|
|
4096
4272
|
};
|
|
4273
|
+
/**
|
|
4274
|
+
* The location of this interface declaration.
|
|
4275
|
+
*/
|
|
4276
|
+
sourceMap = () => {
|
|
4277
|
+
return new SourceMap({
|
|
4278
|
+
queryTree: [
|
|
4279
|
+
...this._queryTree,
|
|
4280
|
+
{
|
|
4281
|
+
operation: "sourceMap",
|
|
4282
|
+
},
|
|
4283
|
+
],
|
|
4284
|
+
ctx: this._ctx,
|
|
4285
|
+
});
|
|
4286
|
+
};
|
|
4097
4287
|
/**
|
|
4098
4288
|
* If this InterfaceTypeDef is associated with a Module, the name of the module. Unset otherwise.
|
|
4099
4289
|
*/
|
|
@@ -5385,6 +5575,20 @@ export class ObjectTypeDef extends BaseClient {
|
|
|
5385
5575
|
], await this._ctx.connection());
|
|
5386
5576
|
return response;
|
|
5387
5577
|
};
|
|
5578
|
+
/**
|
|
5579
|
+
* The location of this object declaration.
|
|
5580
|
+
*/
|
|
5581
|
+
sourceMap = () => {
|
|
5582
|
+
return new SourceMap({
|
|
5583
|
+
queryTree: [
|
|
5584
|
+
...this._queryTree,
|
|
5585
|
+
{
|
|
5586
|
+
operation: "sourceMap",
|
|
5587
|
+
},
|
|
5588
|
+
],
|
|
5589
|
+
ctx: this._ctx,
|
|
5590
|
+
});
|
|
5591
|
+
};
|
|
5388
5592
|
/**
|
|
5389
5593
|
* If this ObjectTypeDef is associated with a Module, the name of the module. Unset otherwise.
|
|
5390
5594
|
*/
|
|
@@ -6321,6 +6525,21 @@ export class Client extends BaseClient {
|
|
|
6321
6525
|
ctx: this._ctx,
|
|
6322
6526
|
});
|
|
6323
6527
|
};
|
|
6528
|
+
/**
|
|
6529
|
+
* Load a SourceMap from its ID.
|
|
6530
|
+
*/
|
|
6531
|
+
loadSourceMapFromID = (id) => {
|
|
6532
|
+
return new SourceMap({
|
|
6533
|
+
queryTree: [
|
|
6534
|
+
...this._queryTree,
|
|
6535
|
+
{
|
|
6536
|
+
operation: "loadSourceMapFromID",
|
|
6537
|
+
args: { id },
|
|
6538
|
+
},
|
|
6539
|
+
],
|
|
6540
|
+
ctx: this._ctx,
|
|
6541
|
+
});
|
|
6542
|
+
};
|
|
6324
6543
|
/**
|
|
6325
6544
|
* Load a Terminal from its ID.
|
|
6326
6545
|
*/
|
|
@@ -6385,6 +6604,7 @@ export class Client extends BaseClient {
|
|
|
6385
6604
|
/**
|
|
6386
6605
|
* Create a new module source instance from a source ref string.
|
|
6387
6606
|
* @param refString The string ref representation of the module source
|
|
6607
|
+
* @param opts.refPin The pinned version of the module source
|
|
6388
6608
|
* @param opts.stable If true, enforce that the source is a stable version for source kinds that support versioning.
|
|
6389
6609
|
* @param opts.relHostPath The relative path to the module root from the host directory
|
|
6390
6610
|
*/
|
|
@@ -6434,6 +6654,24 @@ export class Client extends BaseClient {
|
|
|
6434
6654
|
ctx: this._ctx,
|
|
6435
6655
|
});
|
|
6436
6656
|
};
|
|
6657
|
+
/**
|
|
6658
|
+
* Creates source map metadata.
|
|
6659
|
+
* @param filename The filename from the module source.
|
|
6660
|
+
* @param line The line number within the filename.
|
|
6661
|
+
* @param column The column number within the line.
|
|
6662
|
+
*/
|
|
6663
|
+
sourceMap = (filename, line, column) => {
|
|
6664
|
+
return new SourceMap({
|
|
6665
|
+
queryTree: [
|
|
6666
|
+
...this._queryTree,
|
|
6667
|
+
{
|
|
6668
|
+
operation: "sourceMap",
|
|
6669
|
+
args: { filename, line, column },
|
|
6670
|
+
},
|
|
6671
|
+
],
|
|
6672
|
+
ctx: this._ctx,
|
|
6673
|
+
});
|
|
6674
|
+
};
|
|
6437
6675
|
/**
|
|
6438
6676
|
* Create a new TypeDef.
|
|
6439
6677
|
*/
|
|
@@ -6815,6 +7053,102 @@ export class Socket extends BaseClient {
|
|
|
6815
7053
|
return response;
|
|
6816
7054
|
};
|
|
6817
7055
|
}
|
|
7056
|
+
/**
|
|
7057
|
+
* Source location information.
|
|
7058
|
+
*/
|
|
7059
|
+
export class SourceMap extends BaseClient {
|
|
7060
|
+
_id = undefined;
|
|
7061
|
+
_column = undefined;
|
|
7062
|
+
_filename = undefined;
|
|
7063
|
+
_line = undefined;
|
|
7064
|
+
_module = undefined;
|
|
7065
|
+
/**
|
|
7066
|
+
* Constructor is used for internal usage only, do not create object from it.
|
|
7067
|
+
*/
|
|
7068
|
+
constructor(parent, _id, _column, _filename, _line, _module) {
|
|
7069
|
+
super(parent);
|
|
7070
|
+
this._id = _id;
|
|
7071
|
+
this._column = _column;
|
|
7072
|
+
this._filename = _filename;
|
|
7073
|
+
this._line = _line;
|
|
7074
|
+
this._module = _module;
|
|
7075
|
+
}
|
|
7076
|
+
/**
|
|
7077
|
+
* A unique identifier for this SourceMap.
|
|
7078
|
+
*/
|
|
7079
|
+
id = async () => {
|
|
7080
|
+
if (this._id) {
|
|
7081
|
+
return this._id;
|
|
7082
|
+
}
|
|
7083
|
+
const response = await computeQuery([
|
|
7084
|
+
...this._queryTree,
|
|
7085
|
+
{
|
|
7086
|
+
operation: "id",
|
|
7087
|
+
},
|
|
7088
|
+
], await this._ctx.connection());
|
|
7089
|
+
return response;
|
|
7090
|
+
};
|
|
7091
|
+
/**
|
|
7092
|
+
* The column number within the line.
|
|
7093
|
+
*/
|
|
7094
|
+
column = async () => {
|
|
7095
|
+
if (this._column) {
|
|
7096
|
+
return this._column;
|
|
7097
|
+
}
|
|
7098
|
+
const response = await computeQuery([
|
|
7099
|
+
...this._queryTree,
|
|
7100
|
+
{
|
|
7101
|
+
operation: "column",
|
|
7102
|
+
},
|
|
7103
|
+
], await this._ctx.connection());
|
|
7104
|
+
return response;
|
|
7105
|
+
};
|
|
7106
|
+
/**
|
|
7107
|
+
* The filename from the module source.
|
|
7108
|
+
*/
|
|
7109
|
+
filename = async () => {
|
|
7110
|
+
if (this._filename) {
|
|
7111
|
+
return this._filename;
|
|
7112
|
+
}
|
|
7113
|
+
const response = await computeQuery([
|
|
7114
|
+
...this._queryTree,
|
|
7115
|
+
{
|
|
7116
|
+
operation: "filename",
|
|
7117
|
+
},
|
|
7118
|
+
], await this._ctx.connection());
|
|
7119
|
+
return response;
|
|
7120
|
+
};
|
|
7121
|
+
/**
|
|
7122
|
+
* The line number within the filename.
|
|
7123
|
+
*/
|
|
7124
|
+
line = async () => {
|
|
7125
|
+
if (this._line) {
|
|
7126
|
+
return this._line;
|
|
7127
|
+
}
|
|
7128
|
+
const response = await computeQuery([
|
|
7129
|
+
...this._queryTree,
|
|
7130
|
+
{
|
|
7131
|
+
operation: "line",
|
|
7132
|
+
},
|
|
7133
|
+
], await this._ctx.connection());
|
|
7134
|
+
return response;
|
|
7135
|
+
};
|
|
7136
|
+
/**
|
|
7137
|
+
* The module dependency this was declared in.
|
|
7138
|
+
*/
|
|
7139
|
+
module_ = async () => {
|
|
7140
|
+
if (this._module) {
|
|
7141
|
+
return this._module;
|
|
7142
|
+
}
|
|
7143
|
+
const response = await computeQuery([
|
|
7144
|
+
...this._queryTree,
|
|
7145
|
+
{
|
|
7146
|
+
operation: "module",
|
|
7147
|
+
},
|
|
7148
|
+
], await this._ctx.connection());
|
|
7149
|
+
return response;
|
|
7150
|
+
};
|
|
7151
|
+
}
|
|
6818
7152
|
/**
|
|
6819
7153
|
* An interactive terminal that clients can connect to.
|
|
6820
7154
|
*/
|
|
@@ -7035,6 +7369,7 @@ export class TypeDef extends BaseClient {
|
|
|
7035
7369
|
* Note that an enum's values may be omitted if the intent is only to refer to an enum. This is how functions are able to return their own, or any other circular reference.
|
|
7036
7370
|
* @param name The name of the enum
|
|
7037
7371
|
* @param opts.description A doc string for the enum, if any
|
|
7372
|
+
* @param opts.sourceMap The source map for the enum definition.
|
|
7038
7373
|
*/
|
|
7039
7374
|
withEnum = (name, opts) => {
|
|
7040
7375
|
return new TypeDef({
|
|
@@ -7052,6 +7387,7 @@ export class TypeDef extends BaseClient {
|
|
|
7052
7387
|
* Adds a static value for an Enum TypeDef, failing if the type is not an enum.
|
|
7053
7388
|
* @param value The name of the value in the enum
|
|
7054
7389
|
* @param opts.description A doc string for the value, if any
|
|
7390
|
+
* @param opts.sourceMap The source map for the enum value definition.
|
|
7055
7391
|
*/
|
|
7056
7392
|
withEnumValue = (value, opts) => {
|
|
7057
7393
|
return new TypeDef({
|
|
@@ -7070,6 +7406,7 @@ export class TypeDef extends BaseClient {
|
|
|
7070
7406
|
* @param name The name of the field in the object
|
|
7071
7407
|
* @param typeDef The type of the field
|
|
7072
7408
|
* @param opts.description A doc string for the field, if any
|
|
7409
|
+
* @param opts.sourceMap The source map for the field definition.
|
|
7073
7410
|
*/
|
|
7074
7411
|
withField = (name, typeDef, opts) => {
|
|
7075
7412
|
return new TypeDef({
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { DaggerSDKError, DaggerSDKErrorOptions } from "./DaggerSDKError.js";
|
|
2
|
+
export declare class FunctionNotFound extends DaggerSDKError {
|
|
3
|
+
name: "ExecError";
|
|
4
|
+
code: "D109";
|
|
5
|
+
constructor(message: string, options?: DaggerSDKErrorOptions);
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=FunctionNotFound.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FunctionNotFound.d.ts","sourceRoot":"","sources":["../../../common/errors/FunctionNotFound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAG3E,qBAAa,gBAAiB,SAAQ,cAAc;IAClD,IAAI,cAAwB;IAC5B,IAAI,SAAwB;gBAEhB,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB;CAG7D"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { DaggerSDKError } from "./DaggerSDKError.js";
|
|
2
|
+
import { ERROR_CODES, ERROR_NAMES } from "./errors-codes.js";
|
|
3
|
+
export class FunctionNotFound extends DaggerSDKError {
|
|
4
|
+
name = ERROR_NAMES.ExecError;
|
|
5
|
+
code = ERROR_CODES.ExecError;
|
|
6
|
+
constructor(message, options) {
|
|
7
|
+
super(message, options);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../../entrypoint/entrypoint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"entrypoint.d.ts","sourceRoot":"","sources":["../../entrypoint/entrypoint.ts"],"names":[],"mappings":"AAkBA,wBAAsB,UAAU,kBAoE/B"}
|
|
@@ -2,6 +2,7 @@ import * as path from "path";
|
|
|
2
2
|
import { fileURLToPath } from "url";
|
|
3
3
|
import { dag } from "../api/client.gen.js";
|
|
4
4
|
import { connection } from "../connect.js";
|
|
5
|
+
import { Executor } from "../introspector/executor/executor.js";
|
|
5
6
|
import { scan } from "../introspector/scanner/scan.js";
|
|
6
7
|
import { listFiles } from "../introspector/utils/files.js";
|
|
7
8
|
import { invoke } from "./invoke.js";
|
|
@@ -36,9 +37,10 @@ export async function entrypoint() {
|
|
|
36
37
|
for (const arg of fnArgs) {
|
|
37
38
|
args[await arg.name()] = JSON.parse(await arg.value());
|
|
38
39
|
}
|
|
39
|
-
await load(files);
|
|
40
|
+
const modules = await load(files);
|
|
41
|
+
const executor = new Executor(modules);
|
|
40
42
|
try {
|
|
41
|
-
result = await invoke(scanResult, {
|
|
43
|
+
result = await invoke(executor, scanResult, {
|
|
42
44
|
parentName,
|
|
43
45
|
fnName,
|
|
44
46
|
parentArgs,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Executor } from "../introspector/executor/executor.js";
|
|
1
2
|
import { DaggerModule } from "../introspector/scanner/abtractions/module.js";
|
|
2
3
|
import { InvokeCtx } from "./context.js";
|
|
3
4
|
/**
|
|
@@ -9,5 +10,5 @@ import { InvokeCtx } from "./context.js";
|
|
|
9
10
|
* @param parentArgs The arguments of the parent object.
|
|
10
11
|
* @param fnArgs The arguments of the function to call.
|
|
11
12
|
*/
|
|
12
|
-
export declare function invoke(module: DaggerModule, ctx: InvokeCtx): Promise<any>;
|
|
13
|
+
export declare function invoke(executor: Executor, module: DaggerModule, ctx: InvokeCtx): Promise<any>;
|
|
13
14
|
//# sourceMappingURL=invoke.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../entrypoint/invoke.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"invoke.d.ts","sourceRoot":"","sources":["../../entrypoint/invoke.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAA;AAK/D,OAAO,EAAE,YAAY,EAAE,MAAM,+CAA+C,CAAA;AAE5E,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAcxC;;;;;;;;GAQG;AACH,wBAAsB,MAAM,CAC1B,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,YAAY,EACpB,GAAG,EAAE,SAAS,gBAwDf"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { FunctionNotFound } from "../common/errors/FunctionNotFound.js";
|
|
1
2
|
import { registry } from "../introspector/registry/registry.js";
|
|
2
3
|
import { loadResult, loadInvokedMethod, loadInvokedObject, loadArgs, loadParentState, loadObjectReturnType, } from "./load.js";
|
|
3
4
|
function isConstructor(method) {
|
|
@@ -12,7 +13,7 @@ function isConstructor(method) {
|
|
|
12
13
|
* @param parentArgs The arguments of the parent object.
|
|
13
14
|
* @param fnArgs The arguments of the function to call.
|
|
14
15
|
*/
|
|
15
|
-
export async function invoke(module, ctx) {
|
|
16
|
+
export async function invoke(executor, module, ctx) {
|
|
16
17
|
const object = loadInvokedObject(module, ctx.parentName);
|
|
17
18
|
if (!object) {
|
|
18
19
|
throw new Error(`could not find object ${ctx.parentName}`);
|
|
@@ -21,9 +22,24 @@ export async function invoke(module, ctx) {
|
|
|
21
22
|
if (!method) {
|
|
22
23
|
throw new Error(`could not find method ${ctx.fnName}`);
|
|
23
24
|
}
|
|
24
|
-
const args = await loadArgs(
|
|
25
|
-
const parentState = await loadParentState(
|
|
26
|
-
|
|
25
|
+
const args = await loadArgs(executor, method, ctx);
|
|
26
|
+
const parentState = await loadParentState(executor, object, ctx);
|
|
27
|
+
// Disabling linter because the result could be anything.
|
|
28
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
29
|
+
let result = {};
|
|
30
|
+
try {
|
|
31
|
+
result = await executor.getResult(object.name, method.name, parentState, args);
|
|
32
|
+
}
|
|
33
|
+
catch (e) {
|
|
34
|
+
// If the function isn't found because it's
|
|
35
|
+
// not exported, we try to get the result from the registry.
|
|
36
|
+
if (e instanceof FunctionNotFound) {
|
|
37
|
+
result = await registry.getResult(object.name, method.name, parentState, args);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
throw e;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
27
43
|
if (result) {
|
|
28
44
|
let returnType;
|
|
29
45
|
// Handle alias serialization by getting the return type to load
|