@dagger.io/dagger 0.3.2 → 0.3.4
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 +356 -9
- package/dist/api/client.gen.d.ts.map +1 -1
- package/dist/api/client.gen.js +373 -0
- package/dist/api/utils.d.ts.map +1 -1
- package/dist/api/utils.js +6 -2
- package/dist/common/errors/DaggerSDKError.d.ts +1 -1
- package/dist/common/errors/DaggerSDKError.d.ts.map +1 -1
- package/dist/common/errors/{EngineSessionEOFErrorOptions.d.ts → EngineSessionErrorOptions.d.ts} +5 -5
- package/dist/common/errors/EngineSessionErrorOptions.d.ts.map +1 -0
- package/dist/common/errors/{EngineSessionEOFErrorOptions.js → EngineSessionErrorOptions.js} +3 -3
- package/dist/common/errors/NotAwaitedRequestError.d.ts +13 -0
- package/dist/common/errors/NotAwaitedRequestError.d.ts.map +1 -0
- package/dist/common/errors/NotAwaitedRequestError.js +15 -0
- package/dist/common/errors/errors-codes.d.ts +6 -2
- package/dist/common/errors/errors-codes.d.ts.map +1 -1
- package/dist/common/errors/errors-codes.js +6 -2
- package/dist/common/errors/index.d.ts +2 -1
- package/dist/common/errors/index.d.ts.map +1 -1
- package/dist/common/errors/index.js +2 -1
- package/dist/connect.d.ts.map +1 -1
- package/dist/connect.js +1 -4
- package/dist/provisioning/bin.d.ts.map +1 -1
- package/dist/provisioning/bin.js +16 -5
- package/dist/provisioning/default.d.ts +1 -1
- package/dist/provisioning/default.js +1 -1
- package/package.json +7 -7
- package/dist/common/errors/EngineSessionEOFErrorOptions.d.ts.map +0 -1
package/dist/api/client.gen.js
CHANGED
|
@@ -34,6 +34,25 @@ class BaseClient {
|
|
|
34
34
|
return this._queryTree;
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
|
+
/**
|
|
38
|
+
* Sharing mode of the cache volume.
|
|
39
|
+
*/
|
|
40
|
+
export var CacheSharingMode;
|
|
41
|
+
(function (CacheSharingMode) {
|
|
42
|
+
/**
|
|
43
|
+
* Shares the cache volume amongst many build pipelines,
|
|
44
|
+
* but will serialize the writes
|
|
45
|
+
*/
|
|
46
|
+
CacheSharingMode[CacheSharingMode["Locked"] = 0] = "Locked";
|
|
47
|
+
/**
|
|
48
|
+
* Keeps a cache volume for a single build pipeline
|
|
49
|
+
*/
|
|
50
|
+
CacheSharingMode[CacheSharingMode["Private"] = 1] = "Private";
|
|
51
|
+
/**
|
|
52
|
+
* Shares the cache volume amongst many build pipelines
|
|
53
|
+
*/
|
|
54
|
+
CacheSharingMode[CacheSharingMode["Shared"] = 2] = "Shared";
|
|
55
|
+
})(CacheSharingMode || (CacheSharingMode = {}));
|
|
37
56
|
/**
|
|
38
57
|
* A directory whose contents persist across runs.
|
|
39
58
|
*/
|
|
@@ -49,6 +68,30 @@ export class CacheVolume extends BaseClient {
|
|
|
49
68
|
return response;
|
|
50
69
|
});
|
|
51
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Chain objects together
|
|
73
|
+
* @example
|
|
74
|
+
* ```ts
|
|
75
|
+
* function AddAFewMounts(c) {
|
|
76
|
+
* return c
|
|
77
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
78
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
79
|
+
* }
|
|
80
|
+
*
|
|
81
|
+
* connect(async (client) => {
|
|
82
|
+
* const tree = await client
|
|
83
|
+
* .container()
|
|
84
|
+
* .from("alpine")
|
|
85
|
+
* .withWorkdir("/foo")
|
|
86
|
+
* .with(AddAFewMounts)
|
|
87
|
+
* .withExec(["ls", "-lh"])
|
|
88
|
+
* .stdout()
|
|
89
|
+
* })
|
|
90
|
+
*```
|
|
91
|
+
*/
|
|
92
|
+
with(arg) {
|
|
93
|
+
return arg(this);
|
|
94
|
+
}
|
|
52
95
|
}
|
|
53
96
|
/**
|
|
54
97
|
* An OCI-compatible container, also known as a docker container.
|
|
@@ -560,6 +603,10 @@ export class Container extends BaseClient {
|
|
|
560
603
|
}
|
|
561
604
|
/**
|
|
562
605
|
* Retrieves this container plus a cache volume mounted at the given path.
|
|
606
|
+
* @param path Path to mount the cache volume at.
|
|
607
|
+
* @param cache ID of the cache to mount.
|
|
608
|
+
* @param opts.source Directory to use as the cache volume's root.
|
|
609
|
+
* @param opts.sharing Sharing mode of the cache volume.
|
|
563
610
|
*/
|
|
564
611
|
withMountedCache(path, cache, opts) {
|
|
565
612
|
return new Container({
|
|
@@ -654,6 +701,26 @@ export class Container extends BaseClient {
|
|
|
654
701
|
sessionToken: this.sessionToken,
|
|
655
702
|
});
|
|
656
703
|
}
|
|
704
|
+
/**
|
|
705
|
+
* Retrieves this container with a registry authentication for a given address.
|
|
706
|
+
* @param address Registry's address to bind the authentication to.
|
|
707
|
+
Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
|
|
708
|
+
* @param username The username of the registry's account (e.g., "Dagger").
|
|
709
|
+
* @param secret The API key, password or token to authenticate to this registry.
|
|
710
|
+
*/
|
|
711
|
+
withRegistryAuth(address, username, secret) {
|
|
712
|
+
return new Container({
|
|
713
|
+
queryTree: [
|
|
714
|
+
...this._queryTree,
|
|
715
|
+
{
|
|
716
|
+
operation: "withRegistryAuth",
|
|
717
|
+
args: { address, username, secret },
|
|
718
|
+
},
|
|
719
|
+
],
|
|
720
|
+
host: this.clientHost,
|
|
721
|
+
sessionToken: this.sessionToken,
|
|
722
|
+
});
|
|
723
|
+
}
|
|
657
724
|
/**
|
|
658
725
|
* Initializes this container from this DirectoryID.
|
|
659
726
|
*/
|
|
@@ -782,6 +849,24 @@ export class Container extends BaseClient {
|
|
|
782
849
|
sessionToken: this.sessionToken,
|
|
783
850
|
});
|
|
784
851
|
}
|
|
852
|
+
/**
|
|
853
|
+
* Retrieves this container without the registry authentication of a given address.
|
|
854
|
+
* @param address Registry's address to remove the authentication from.
|
|
855
|
+
Formatted as [host]/[user]/[repo]:[tag] (e.g. docker.io/dagger/dagger:main).
|
|
856
|
+
*/
|
|
857
|
+
withoutRegistryAuth(address) {
|
|
858
|
+
return new Container({
|
|
859
|
+
queryTree: [
|
|
860
|
+
...this._queryTree,
|
|
861
|
+
{
|
|
862
|
+
operation: "withoutRegistryAuth",
|
|
863
|
+
args: { address },
|
|
864
|
+
},
|
|
865
|
+
],
|
|
866
|
+
host: this.clientHost,
|
|
867
|
+
sessionToken: this.sessionToken,
|
|
868
|
+
});
|
|
869
|
+
}
|
|
785
870
|
/**
|
|
786
871
|
* Retrieves this container with a previously added Unix socket removed.
|
|
787
872
|
*/
|
|
@@ -812,6 +897,30 @@ export class Container extends BaseClient {
|
|
|
812
897
|
return response;
|
|
813
898
|
});
|
|
814
899
|
}
|
|
900
|
+
/**
|
|
901
|
+
* Chain objects together
|
|
902
|
+
* @example
|
|
903
|
+
* ```ts
|
|
904
|
+
* function AddAFewMounts(c) {
|
|
905
|
+
* return c
|
|
906
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
907
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
908
|
+
* }
|
|
909
|
+
*
|
|
910
|
+
* connect(async (client) => {
|
|
911
|
+
* const tree = await client
|
|
912
|
+
* .container()
|
|
913
|
+
* .from("alpine")
|
|
914
|
+
* .withWorkdir("/foo")
|
|
915
|
+
* .with(AddAFewMounts)
|
|
916
|
+
* .withExec(["ls", "-lh"])
|
|
917
|
+
* .stdout()
|
|
918
|
+
* })
|
|
919
|
+
*```
|
|
920
|
+
*/
|
|
921
|
+
with(arg) {
|
|
922
|
+
return arg(this);
|
|
923
|
+
}
|
|
815
924
|
}
|
|
816
925
|
/**
|
|
817
926
|
* A directory.
|
|
@@ -1078,6 +1187,30 @@ export class Directory extends BaseClient {
|
|
|
1078
1187
|
sessionToken: this.sessionToken,
|
|
1079
1188
|
});
|
|
1080
1189
|
}
|
|
1190
|
+
/**
|
|
1191
|
+
* Chain objects together
|
|
1192
|
+
* @example
|
|
1193
|
+
* ```ts
|
|
1194
|
+
* function AddAFewMounts(c) {
|
|
1195
|
+
* return c
|
|
1196
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1197
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1198
|
+
* }
|
|
1199
|
+
*
|
|
1200
|
+
* connect(async (client) => {
|
|
1201
|
+
* const tree = await client
|
|
1202
|
+
* .container()
|
|
1203
|
+
* .from("alpine")
|
|
1204
|
+
* .withWorkdir("/foo")
|
|
1205
|
+
* .with(AddAFewMounts)
|
|
1206
|
+
* .withExec(["ls", "-lh"])
|
|
1207
|
+
* .stdout()
|
|
1208
|
+
* })
|
|
1209
|
+
*```
|
|
1210
|
+
*/
|
|
1211
|
+
with(arg) {
|
|
1212
|
+
return arg(this);
|
|
1213
|
+
}
|
|
1081
1214
|
}
|
|
1082
1215
|
/**
|
|
1083
1216
|
* A simple key value object that represents an environment variable.
|
|
@@ -1111,6 +1244,30 @@ export class EnvVariable extends BaseClient {
|
|
|
1111
1244
|
return response;
|
|
1112
1245
|
});
|
|
1113
1246
|
}
|
|
1247
|
+
/**
|
|
1248
|
+
* Chain objects together
|
|
1249
|
+
* @example
|
|
1250
|
+
* ```ts
|
|
1251
|
+
* function AddAFewMounts(c) {
|
|
1252
|
+
* return c
|
|
1253
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1254
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1255
|
+
* }
|
|
1256
|
+
*
|
|
1257
|
+
* connect(async (client) => {
|
|
1258
|
+
* const tree = await client
|
|
1259
|
+
* .container()
|
|
1260
|
+
* .from("alpine")
|
|
1261
|
+
* .withWorkdir("/foo")
|
|
1262
|
+
* .with(AddAFewMounts)
|
|
1263
|
+
* .withExec(["ls", "-lh"])
|
|
1264
|
+
* .stdout()
|
|
1265
|
+
* })
|
|
1266
|
+
*```
|
|
1267
|
+
*/
|
|
1268
|
+
with(arg) {
|
|
1269
|
+
return arg(this);
|
|
1270
|
+
}
|
|
1114
1271
|
}
|
|
1115
1272
|
/**
|
|
1116
1273
|
* A file.
|
|
@@ -1204,6 +1361,30 @@ export class File extends BaseClient {
|
|
|
1204
1361
|
sessionToken: this.sessionToken,
|
|
1205
1362
|
});
|
|
1206
1363
|
}
|
|
1364
|
+
/**
|
|
1365
|
+
* Chain objects together
|
|
1366
|
+
* @example
|
|
1367
|
+
* ```ts
|
|
1368
|
+
* function AddAFewMounts(c) {
|
|
1369
|
+
* return c
|
|
1370
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1371
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1372
|
+
* }
|
|
1373
|
+
*
|
|
1374
|
+
* connect(async (client) => {
|
|
1375
|
+
* const tree = await client
|
|
1376
|
+
* .container()
|
|
1377
|
+
* .from("alpine")
|
|
1378
|
+
* .withWorkdir("/foo")
|
|
1379
|
+
* .with(AddAFewMounts)
|
|
1380
|
+
* .withExec(["ls", "-lh"])
|
|
1381
|
+
* .stdout()
|
|
1382
|
+
* })
|
|
1383
|
+
*```
|
|
1384
|
+
*/
|
|
1385
|
+
with(arg) {
|
|
1386
|
+
return arg(this);
|
|
1387
|
+
}
|
|
1207
1388
|
}
|
|
1208
1389
|
/**
|
|
1209
1390
|
* A git ref (tag, branch or commit).
|
|
@@ -1239,6 +1420,30 @@ export class GitRef extends BaseClient {
|
|
|
1239
1420
|
sessionToken: this.sessionToken,
|
|
1240
1421
|
});
|
|
1241
1422
|
}
|
|
1423
|
+
/**
|
|
1424
|
+
* Chain objects together
|
|
1425
|
+
* @example
|
|
1426
|
+
* ```ts
|
|
1427
|
+
* function AddAFewMounts(c) {
|
|
1428
|
+
* return c
|
|
1429
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1430
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1431
|
+
* }
|
|
1432
|
+
*
|
|
1433
|
+
* connect(async (client) => {
|
|
1434
|
+
* const tree = await client
|
|
1435
|
+
* .container()
|
|
1436
|
+
* .from("alpine")
|
|
1437
|
+
* .withWorkdir("/foo")
|
|
1438
|
+
* .with(AddAFewMounts)
|
|
1439
|
+
* .withExec(["ls", "-lh"])
|
|
1440
|
+
* .stdout()
|
|
1441
|
+
* })
|
|
1442
|
+
*```
|
|
1443
|
+
*/
|
|
1444
|
+
with(arg) {
|
|
1445
|
+
return arg(this);
|
|
1446
|
+
}
|
|
1242
1447
|
}
|
|
1243
1448
|
/**
|
|
1244
1449
|
* A git repository.
|
|
@@ -1320,6 +1525,30 @@ export class GitRepository extends BaseClient {
|
|
|
1320
1525
|
return response;
|
|
1321
1526
|
});
|
|
1322
1527
|
}
|
|
1528
|
+
/**
|
|
1529
|
+
* Chain objects together
|
|
1530
|
+
* @example
|
|
1531
|
+
* ```ts
|
|
1532
|
+
* function AddAFewMounts(c) {
|
|
1533
|
+
* return c
|
|
1534
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1535
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1536
|
+
* }
|
|
1537
|
+
*
|
|
1538
|
+
* connect(async (client) => {
|
|
1539
|
+
* const tree = await client
|
|
1540
|
+
* .container()
|
|
1541
|
+
* .from("alpine")
|
|
1542
|
+
* .withWorkdir("/foo")
|
|
1543
|
+
* .with(AddAFewMounts)
|
|
1544
|
+
* .withExec(["ls", "-lh"])
|
|
1545
|
+
* .stdout()
|
|
1546
|
+
* })
|
|
1547
|
+
*```
|
|
1548
|
+
*/
|
|
1549
|
+
with(arg) {
|
|
1550
|
+
return arg(this);
|
|
1551
|
+
}
|
|
1323
1552
|
}
|
|
1324
1553
|
/**
|
|
1325
1554
|
* Information about the host execution environment.
|
|
@@ -1390,6 +1619,30 @@ export class Host extends BaseClient {
|
|
|
1390
1619
|
sessionToken: this.sessionToken,
|
|
1391
1620
|
});
|
|
1392
1621
|
}
|
|
1622
|
+
/**
|
|
1623
|
+
* Chain objects together
|
|
1624
|
+
* @example
|
|
1625
|
+
* ```ts
|
|
1626
|
+
* function AddAFewMounts(c) {
|
|
1627
|
+
* return c
|
|
1628
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1629
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1630
|
+
* }
|
|
1631
|
+
*
|
|
1632
|
+
* connect(async (client) => {
|
|
1633
|
+
* const tree = await client
|
|
1634
|
+
* .container()
|
|
1635
|
+
* .from("alpine")
|
|
1636
|
+
* .withWorkdir("/foo")
|
|
1637
|
+
* .with(AddAFewMounts)
|
|
1638
|
+
* .withExec(["ls", "-lh"])
|
|
1639
|
+
* .stdout()
|
|
1640
|
+
* })
|
|
1641
|
+
*```
|
|
1642
|
+
*/
|
|
1643
|
+
with(arg) {
|
|
1644
|
+
return arg(this);
|
|
1645
|
+
}
|
|
1393
1646
|
}
|
|
1394
1647
|
/**
|
|
1395
1648
|
* An environment variable on the host environment.
|
|
@@ -1424,6 +1677,30 @@ export class HostVariable extends BaseClient {
|
|
|
1424
1677
|
return response;
|
|
1425
1678
|
});
|
|
1426
1679
|
}
|
|
1680
|
+
/**
|
|
1681
|
+
* Chain objects together
|
|
1682
|
+
* @example
|
|
1683
|
+
* ```ts
|
|
1684
|
+
* function AddAFewMounts(c) {
|
|
1685
|
+
* return c
|
|
1686
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1687
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1688
|
+
* }
|
|
1689
|
+
*
|
|
1690
|
+
* connect(async (client) => {
|
|
1691
|
+
* const tree = await client
|
|
1692
|
+
* .container()
|
|
1693
|
+
* .from("alpine")
|
|
1694
|
+
* .withWorkdir("/foo")
|
|
1695
|
+
* .with(AddAFewMounts)
|
|
1696
|
+
* .withExec(["ls", "-lh"])
|
|
1697
|
+
* .stdout()
|
|
1698
|
+
* })
|
|
1699
|
+
*```
|
|
1700
|
+
*/
|
|
1701
|
+
with(arg) {
|
|
1702
|
+
return arg(this);
|
|
1703
|
+
}
|
|
1427
1704
|
}
|
|
1428
1705
|
/**
|
|
1429
1706
|
* A simple key value object that represents a label.
|
|
@@ -1457,6 +1734,30 @@ export class Label extends BaseClient {
|
|
|
1457
1734
|
return response;
|
|
1458
1735
|
});
|
|
1459
1736
|
}
|
|
1737
|
+
/**
|
|
1738
|
+
* Chain objects together
|
|
1739
|
+
* @example
|
|
1740
|
+
* ```ts
|
|
1741
|
+
* function AddAFewMounts(c) {
|
|
1742
|
+
* return c
|
|
1743
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1744
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1745
|
+
* }
|
|
1746
|
+
*
|
|
1747
|
+
* connect(async (client) => {
|
|
1748
|
+
* const tree = await client
|
|
1749
|
+
* .container()
|
|
1750
|
+
* .from("alpine")
|
|
1751
|
+
* .withWorkdir("/foo")
|
|
1752
|
+
* .with(AddAFewMounts)
|
|
1753
|
+
* .withExec(["ls", "-lh"])
|
|
1754
|
+
* .stdout()
|
|
1755
|
+
* })
|
|
1756
|
+
*```
|
|
1757
|
+
*/
|
|
1758
|
+
with(arg) {
|
|
1759
|
+
return arg(this);
|
|
1760
|
+
}
|
|
1460
1761
|
}
|
|
1461
1762
|
/**
|
|
1462
1763
|
* A set of scripts and/or extensions
|
|
@@ -1547,6 +1848,30 @@ export class Project extends BaseClient {
|
|
|
1547
1848
|
return response;
|
|
1548
1849
|
});
|
|
1549
1850
|
}
|
|
1851
|
+
/**
|
|
1852
|
+
* Chain objects together
|
|
1853
|
+
* @example
|
|
1854
|
+
* ```ts
|
|
1855
|
+
* function AddAFewMounts(c) {
|
|
1856
|
+
* return c
|
|
1857
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
1858
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
1859
|
+
* }
|
|
1860
|
+
*
|
|
1861
|
+
* connect(async (client) => {
|
|
1862
|
+
* const tree = await client
|
|
1863
|
+
* .container()
|
|
1864
|
+
* .from("alpine")
|
|
1865
|
+
* .withWorkdir("/foo")
|
|
1866
|
+
* .with(AddAFewMounts)
|
|
1867
|
+
* .withExec(["ls", "-lh"])
|
|
1868
|
+
* .stdout()
|
|
1869
|
+
* })
|
|
1870
|
+
*```
|
|
1871
|
+
*/
|
|
1872
|
+
with(arg) {
|
|
1873
|
+
return arg(this);
|
|
1874
|
+
}
|
|
1550
1875
|
}
|
|
1551
1876
|
export default class Client extends BaseClient {
|
|
1552
1877
|
/**
|
|
@@ -1774,6 +2099,30 @@ export class Secret extends BaseClient {
|
|
|
1774
2099
|
return response;
|
|
1775
2100
|
});
|
|
1776
2101
|
}
|
|
2102
|
+
/**
|
|
2103
|
+
* Chain objects together
|
|
2104
|
+
* @example
|
|
2105
|
+
* ```ts
|
|
2106
|
+
* function AddAFewMounts(c) {
|
|
2107
|
+
* return c
|
|
2108
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
2109
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
2110
|
+
* }
|
|
2111
|
+
*
|
|
2112
|
+
* connect(async (client) => {
|
|
2113
|
+
* const tree = await client
|
|
2114
|
+
* .container()
|
|
2115
|
+
* .from("alpine")
|
|
2116
|
+
* .withWorkdir("/foo")
|
|
2117
|
+
* .with(AddAFewMounts)
|
|
2118
|
+
* .withExec(["ls", "-lh"])
|
|
2119
|
+
* .stdout()
|
|
2120
|
+
* })
|
|
2121
|
+
*```
|
|
2122
|
+
*/
|
|
2123
|
+
with(arg) {
|
|
2124
|
+
return arg(this);
|
|
2125
|
+
}
|
|
1777
2126
|
}
|
|
1778
2127
|
export class Socket extends BaseClient {
|
|
1779
2128
|
/**
|
|
@@ -1790,4 +2139,28 @@ export class Socket extends BaseClient {
|
|
|
1790
2139
|
return response;
|
|
1791
2140
|
});
|
|
1792
2141
|
}
|
|
2142
|
+
/**
|
|
2143
|
+
* Chain objects together
|
|
2144
|
+
* @example
|
|
2145
|
+
* ```ts
|
|
2146
|
+
* function AddAFewMounts(c) {
|
|
2147
|
+
* return c
|
|
2148
|
+
* .withMountedDirectory("/foo", new Client().host().directory("/Users/slumbering/forks/dagger"))
|
|
2149
|
+
* .withMountedDirectory("/bar", new Client().host().directory("/Users/slumbering/forks/dagger/sdk/nodejs"))
|
|
2150
|
+
* }
|
|
2151
|
+
*
|
|
2152
|
+
* connect(async (client) => {
|
|
2153
|
+
* const tree = await client
|
|
2154
|
+
* .container()
|
|
2155
|
+
* .from("alpine")
|
|
2156
|
+
* .withWorkdir("/foo")
|
|
2157
|
+
* .with(AddAFewMounts)
|
|
2158
|
+
* .withExec(["ls", "-lh"])
|
|
2159
|
+
* .stdout()
|
|
2160
|
+
* })
|
|
2161
|
+
*```
|
|
2162
|
+
*/
|
|
2163
|
+
with(arg) {
|
|
2164
|
+
return arg(this);
|
|
2165
|
+
}
|
|
1793
2166
|
}
|
package/dist/api/utils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../api/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,aAAa,EAAE,MAAM,iBAAiB,CAAA;
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../api/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAoB,aAAa,EAAE,MAAM,iBAAiB,CAAA;AAQjE,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAoE3C;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAAE,SAAS,EAAE,GAAG,MAAM,CAYjD;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,CAAC,EAClC,CAAC,EAAE,SAAS,EAAE,EACd,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,CAAC,CAAC,CAMZ;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,GAAG,GAAG,CAAC,CAqBhD;AAED;;;;GAIG;AACH,wBAAsB,OAAO,CAAC,CAAC,EAC7B,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,CAAC,CAAC,CAiCZ"}
|
package/dist/api/utils.js
CHANGED
|
@@ -9,13 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
11
11
|
import { ClientError, gql } from "graphql-request";
|
|
12
|
-
import { GraphQLRequestError, TooManyNestedObjectsError, UnknownDaggerError, } from "../common/errors/index.js";
|
|
12
|
+
import { GraphQLRequestError, TooManyNestedObjectsError, UnknownDaggerError, NotAwaitedRequestError, } from "../common/errors/index.js";
|
|
13
13
|
/**
|
|
14
14
|
* Format argument into GraphQL query format.
|
|
15
15
|
*/
|
|
16
16
|
function buildArgs(args) {
|
|
17
17
|
// Remove unwanted quotes
|
|
18
|
-
const formatValue = (value) => JSON.stringify(value).replace(/\{"[a-zA-Z]+"
|
|
18
|
+
const formatValue = (value) => JSON.stringify(value).replace(/\{"[a-zA-Z]+":|,"[a-zA-Z]+":/gi, (str) => str.replace(/"/g, ""));
|
|
19
19
|
const formattedArgs = Object.entries(args).reduce((acc, [key, value]) => {
|
|
20
20
|
if (value) {
|
|
21
21
|
acc.push(`${key}: ${formatValue(value)}`);
|
|
@@ -124,6 +124,10 @@ export function compute(query, client) {
|
|
|
124
124
|
cause: e,
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
+
// Looking for connection error in case the function has not been awaited.
|
|
128
|
+
if (e.errno === "ECONNREFUSED") {
|
|
129
|
+
throw new NotAwaitedRequestError("Encountered an error while requesting data via graphql through a synchronous call. Make sure the function called is awaited.", { cause: e });
|
|
130
|
+
}
|
|
127
131
|
// Just throw the unknown error
|
|
128
132
|
throw new UnknownDaggerError("Encountered an unknown error while requesting data via graphql", { cause: e });
|
|
129
133
|
}
|
|
@@ -23,7 +23,7 @@ export declare abstract class DaggerSDKError extends Error {
|
|
|
23
23
|
/**
|
|
24
24
|
* @hidden
|
|
25
25
|
*/
|
|
26
|
-
get [Symbol.toStringTag](): "GraphQLRequestError" | "UnknownDaggerError" | "TooManyNestedObjectsError" | "EngineSessionConnectParamsParseError" | "EngineSessionConnectionTimeoutError" | "
|
|
26
|
+
get [Symbol.toStringTag](): "GraphQLRequestError" | "UnknownDaggerError" | "TooManyNestedObjectsError" | "EngineSessionConnectParamsParseError" | "EngineSessionConnectionTimeoutError" | "EngineSessionError" | "InitEngineSessionBinaryError" | "DockerImageRefValidationError" | "NotAwaitedRequestError";
|
|
27
27
|
/**
|
|
28
28
|
* Pretty prints the error
|
|
29
29
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DaggerSDKError.d.ts","sourceRoot":"","sources":["../../../common/errors/DaggerSDKError.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEvD,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED;;GAEG;AACH,8BAAsB,cAAe,SAAQ,KAAK;IAChD;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IAElC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IAElC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;IAEb,SAAS,aAAa,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB;IAKtE;;OAEG;IACH,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"DaggerSDKError.d.ts","sourceRoot":"","sources":["../../../common/errors/DaggerSDKError.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAEvD,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,EAAE,KAAK,CAAA;CACd;AAED;;GAEG;AACH,8BAAsB,cAAe,SAAQ,KAAK;IAChD;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IAElC;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAA;IAElC;;OAEG;IACH,KAAK,CAAC,EAAE,KAAK,CAAA;IAEb,SAAS,aAAa,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB;IAKtE;;OAEG;IACH,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,qRAEvB;IAED;;OAEG;IACH,eAAe;CAGhB"}
|
package/dist/common/errors/{EngineSessionEOFErrorOptions.d.ts → EngineSessionErrorOptions.d.ts}
RENAMED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { DaggerSDKError, DaggerSDKErrorOptions } from "./DaggerSDKError.js";
|
|
2
|
-
type
|
|
2
|
+
type EngineSessionErrorOptions = DaggerSDKErrorOptions;
|
|
3
3
|
/**
|
|
4
4
|
* This error is thrown if the EngineSession does not manage to parse the required port successfully because a EOF is read before any valid port.
|
|
5
5
|
* This usually happens if no connection can be established.
|
|
6
6
|
*/
|
|
7
|
-
export declare class
|
|
8
|
-
name: "
|
|
7
|
+
export declare class EngineSessionError extends DaggerSDKError {
|
|
8
|
+
name: "EngineSessionError";
|
|
9
9
|
code: "D105";
|
|
10
10
|
/**
|
|
11
11
|
* @hidden
|
|
12
12
|
*/
|
|
13
|
-
constructor(message: string, options?:
|
|
13
|
+
constructor(message: string, options?: EngineSessionErrorOptions);
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
16
|
-
//# sourceMappingURL=
|
|
16
|
+
//# sourceMappingURL=EngineSessionErrorOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"EngineSessionErrorOptions.d.ts","sourceRoot":"","sources":["../../../common/errors/EngineSessionErrorOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAG3E,KAAK,yBAAyB,GAAG,qBAAqB,CAAA;AAEtD;;;GAGG;AACH,qBAAa,kBAAmB,SAAQ,cAAc;IACpD,IAAI,uBAAiC;IACrC,IAAI,SAAiC;IAErC;;OAEG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,yBAAyB;CAGjE"}
|
|
@@ -4,13 +4,13 @@ import { ERROR_CODES, ERROR_NAMES } from "./errors-codes.js";
|
|
|
4
4
|
* This error is thrown if the EngineSession does not manage to parse the required port successfully because a EOF is read before any valid port.
|
|
5
5
|
* This usually happens if no connection can be established.
|
|
6
6
|
*/
|
|
7
|
-
export class
|
|
7
|
+
export class EngineSessionError extends DaggerSDKError {
|
|
8
8
|
/**
|
|
9
9
|
* @hidden
|
|
10
10
|
*/
|
|
11
11
|
constructor(message, options) {
|
|
12
12
|
super(message, options);
|
|
13
|
-
this.name = ERROR_NAMES.
|
|
14
|
-
this.code = ERROR_CODES.
|
|
13
|
+
this.name = ERROR_NAMES.EngineSessionError;
|
|
14
|
+
this.code = ERROR_CODES.EngineSessionError;
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { DaggerSDKError, DaggerSDKErrorOptions } from "./DaggerSDKError.js";
|
|
2
|
+
/**
|
|
3
|
+
* This error is thrown when the compute function isn't awaited.
|
|
4
|
+
*/
|
|
5
|
+
export declare class NotAwaitedRequestError extends DaggerSDKError {
|
|
6
|
+
name: "NotAwaitedRequestError";
|
|
7
|
+
code: "D108";
|
|
8
|
+
/**
|
|
9
|
+
* @hidden
|
|
10
|
+
*/
|
|
11
|
+
constructor(message: string, options?: DaggerSDKErrorOptions);
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=NotAwaitedRequestError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotAwaitedRequestError.d.ts","sourceRoot":"","sources":["../../../common/errors/NotAwaitedRequestError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAG3E;;GAEG;AACH,qBAAa,sBAAuB,SAAQ,cAAc;IACxD,IAAI,2BAAqC;IACzC,IAAI,SAAqC;IAEzC;;OAEG;gBACS,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,qBAAqB;CAG7D"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { DaggerSDKError } from "./DaggerSDKError.js";
|
|
2
|
+
import { ERROR_CODES, ERROR_NAMES } from "./errors-codes.js";
|
|
3
|
+
/**
|
|
4
|
+
* This error is thrown when the compute function isn't awaited.
|
|
5
|
+
*/
|
|
6
|
+
export class NotAwaitedRequestError extends DaggerSDKError {
|
|
7
|
+
/**
|
|
8
|
+
* @hidden
|
|
9
|
+
*/
|
|
10
|
+
constructor(message, options) {
|
|
11
|
+
super(message, options);
|
|
12
|
+
this.name = ERROR_NAMES.NotAwaitedRequestError;
|
|
13
|
+
this.code = ERROR_CODES.NotAwaitedRequestError;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -20,9 +20,9 @@ export declare const ERROR_CODES: {
|
|
|
20
20
|
*/
|
|
21
21
|
readonly EngineSessionConnectionTimeoutError: "D104";
|
|
22
22
|
/**
|
|
23
|
-
* {@link
|
|
23
|
+
* {@link EngineSessionError}
|
|
24
24
|
*/
|
|
25
|
-
readonly
|
|
25
|
+
readonly EngineSessionError: "D105";
|
|
26
26
|
/**
|
|
27
27
|
* {@link InitEngineSessionBinaryError}
|
|
28
28
|
*/
|
|
@@ -31,6 +31,10 @@ export declare const ERROR_CODES: {
|
|
|
31
31
|
* {@link DockerImageRefValidationError}
|
|
32
32
|
*/
|
|
33
33
|
readonly DockerImageRefValidationError: "D107";
|
|
34
|
+
/**
|
|
35
|
+
* @link NotAwaitedRequestError
|
|
36
|
+
*/
|
|
37
|
+
readonly NotAwaitedRequestError: "D108";
|
|
34
38
|
};
|
|
35
39
|
type ErrorCodesType = typeof ERROR_CODES;
|
|
36
40
|
export type ErrorNames = keyof ErrorCodesType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors-codes.d.ts","sourceRoot":"","sources":["../../../common/errors/errors-codes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;IACtB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEK,CAAA;AAEV,KAAK,cAAc,GAAG,OAAO,WAAW,CAAA;AACxC,MAAM,MAAM,UAAU,GAAG,MAAM,cAAc,CAAA;AAC7C,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,CAAA;AAEnD,KAAK,aAAa,GAAG;IAAE,QAAQ,EAAE,GAAG,IAAI,UAAU,GAAG,GAAG;CAAE,CAAA;AAC1D,eAAO,MAAM,WAAW,EAAE,aAKzB,CAAA"}
|
|
1
|
+
{"version":3,"file":"errors-codes.d.ts","sourceRoot":"","sources":["../../../common/errors/errors-codes.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;IACtB;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;IAGH;;OAEG;;CAEK,CAAA;AAEV,KAAK,cAAc,GAAG,OAAO,WAAW,CAAA;AACxC,MAAM,MAAM,UAAU,GAAG,MAAM,cAAc,CAAA;AAC7C,MAAM,MAAM,UAAU,GAAG,cAAc,CAAC,UAAU,CAAC,CAAA;AAEnD,KAAK,aAAa,GAAG;IAAE,QAAQ,EAAE,GAAG,IAAI,UAAU,GAAG,GAAG;CAAE,CAAA;AAC1D,eAAO,MAAM,WAAW,EAAE,aAKzB,CAAA"}
|
|
@@ -20,9 +20,9 @@ export const ERROR_CODES = {
|
|
|
20
20
|
*/
|
|
21
21
|
EngineSessionConnectionTimeoutError: "D104",
|
|
22
22
|
/**
|
|
23
|
-
* {@link
|
|
23
|
+
* {@link EngineSessionError}
|
|
24
24
|
*/
|
|
25
|
-
|
|
25
|
+
EngineSessionError: "D105",
|
|
26
26
|
/**
|
|
27
27
|
* {@link InitEngineSessionBinaryError}
|
|
28
28
|
*/
|
|
@@ -31,5 +31,9 @@ export const ERROR_CODES = {
|
|
|
31
31
|
* {@link DockerImageRefValidationError}
|
|
32
32
|
*/
|
|
33
33
|
DockerImageRefValidationError: "D107",
|
|
34
|
+
/**
|
|
35
|
+
* @link NotAwaitedRequestError
|
|
36
|
+
*/
|
|
37
|
+
NotAwaitedRequestError: "D108",
|
|
34
38
|
};
|
|
35
39
|
export const ERROR_NAMES = Object.keys(ERROR_CODES).reduce((obj, item) => (Object.assign(Object.assign({}, obj), { [item]: item })), {});
|
|
@@ -5,7 +5,8 @@ export { EngineSessionConnectParamsParseError } from "./EngineSessionConnectPara
|
|
|
5
5
|
export { GraphQLRequestError } from "./GraphQLRequestError.js";
|
|
6
6
|
export { InitEngineSessionBinaryError } from "./InitEngineSessionBinaryError.js";
|
|
7
7
|
export { TooManyNestedObjectsError } from "./TooManyNestedObjectsError.js";
|
|
8
|
-
export {
|
|
8
|
+
export { EngineSessionError } from "./EngineSessionErrorOptions.js";
|
|
9
9
|
export { EngineSessionConnectionTimeoutError } from "./EngineSessionConnectionTimeoutError.js";
|
|
10
|
+
export { NotAwaitedRequestError } from "./NotAwaitedRequestError.js";
|
|
10
11
|
export { ERROR_CODES } from "./errors-codes.js";
|
|
11
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAA;AAClF,OAAO,EAAE,oCAAoC,EAAE,MAAM,2CAA2C,CAAA;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAA;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../common/errors/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC5D,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAA;AAClF,OAAO,EAAE,oCAAoC,EAAE,MAAM,2CAA2C,CAAA;AAChG,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAA;AAC9D,OAAO,EAAE,4BAA4B,EAAE,MAAM,mCAAmC,CAAA;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAA;AAC1E,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAA;AACnE,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAA;AAC9F,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA"}
|