@dagger.io/dagger 0.8.6 → 0.8.8

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.
@@ -85,6 +85,44 @@ export var NetworkProtocol;
85
85
  */
86
86
  NetworkProtocol["Udp"] = "UDP";
87
87
  })(NetworkProtocol || (NetworkProtocol = {}));
88
+ /**
89
+ * Distinguishes the different kinds of TypeDefs.
90
+ */
91
+ export var TypeDefKind;
92
+ (function (TypeDefKind) {
93
+ /**
94
+ * A boolean value
95
+ */
96
+ TypeDefKind["Booleankind"] = "BooleanKind";
97
+ /**
98
+ * An integer value
99
+ */
100
+ TypeDefKind["Integerkind"] = "IntegerKind";
101
+ /**
102
+ * A list of values all having the same type.
103
+ *
104
+ * Always paired with a ListTypeDef.
105
+ */
106
+ TypeDefKind["Listkind"] = "ListKind";
107
+ /**
108
+ * A named type defined in the GraphQL schema, with fields and functions.
109
+ *
110
+ * Always paired with an ObjectTypeDef.
111
+ */
112
+ TypeDefKind["Objectkind"] = "ObjectKind";
113
+ /**
114
+ * A string value
115
+ */
116
+ TypeDefKind["Stringkind"] = "StringKind";
117
+ /**
118
+ * A special kind used to signify that no value is returned.
119
+ *
120
+ * This is used for functions that have no return value. The outer TypeDef
121
+ * specifying this Kind is always Optional, as the Void is never actually
122
+ * represented.
123
+ */
124
+ TypeDefKind["Voidkind"] = "VoidKind";
125
+ })(TypeDefKind || (TypeDefKind = {}));
88
126
  /**
89
127
  * A directory whose contents persist across runs.
90
128
  */
@@ -119,37 +157,56 @@ export class Container extends BaseClient {
119
157
  /**
120
158
  * Constructor is used for internal usage only, do not create object from it.
121
159
  */
122
- constructor(parent, _endpoint, _envVariable, _export, _hostname, _id, _imageRef, _label, _platform, _publish, _stderr, _stdout, _sync, _user, _workdir) {
160
+ constructor(parent, _id, _endpoint, _envVariable, _export, _hostname, _imageRef, _label, _platform, _publish, _shellEndpoint, _stderr, _stdout, _sync, _user, _workdir) {
123
161
  super(parent);
162
+ this._id = undefined;
124
163
  this._endpoint = undefined;
125
164
  this._envVariable = undefined;
126
165
  this._export = undefined;
127
166
  this._hostname = undefined;
128
- this._id = undefined;
129
167
  this._imageRef = undefined;
130
168
  this._label = undefined;
131
169
  this._platform = undefined;
132
170
  this._publish = undefined;
171
+ this._shellEndpoint = undefined;
133
172
  this._stderr = undefined;
134
173
  this._stdout = undefined;
135
174
  this._sync = undefined;
136
175
  this._user = undefined;
137
176
  this._workdir = undefined;
177
+ this._id = _id;
138
178
  this._endpoint = _endpoint;
139
179
  this._envVariable = _envVariable;
140
180
  this._export = _export;
141
181
  this._hostname = _hostname;
142
- this._id = _id;
143
182
  this._imageRef = _imageRef;
144
183
  this._label = _label;
145
184
  this._platform = _platform;
146
185
  this._publish = _publish;
186
+ this._shellEndpoint = _shellEndpoint;
147
187
  this._stderr = _stderr;
148
188
  this._stdout = _stdout;
149
189
  this._sync = _sync;
150
190
  this._user = _user;
151
191
  this._workdir = _workdir;
152
192
  }
193
+ /**
194
+ * A unique identifier for this container.
195
+ */
196
+ id() {
197
+ return __awaiter(this, void 0, void 0, function* () {
198
+ if (this._id) {
199
+ return this._id;
200
+ }
201
+ const response = yield computeQuery([
202
+ ...this._queryTree,
203
+ {
204
+ operation: "id",
205
+ },
206
+ ], this.client);
207
+ return response;
208
+ });
209
+ }
153
210
  /**
154
211
  * Initializes this container from a Dockerfile build.
155
212
  * @param context Directory context used by the Dockerfile.
@@ -412,23 +469,6 @@ export class Container extends BaseClient {
412
469
  return response;
413
470
  });
414
471
  }
415
- /**
416
- * A unique identifier for this container.
417
- */
418
- id() {
419
- return __awaiter(this, void 0, void 0, function* () {
420
- if (this._id) {
421
- return this._id;
422
- }
423
- const response = yield computeQuery([
424
- ...this._queryTree,
425
- {
426
- operation: "id",
427
- },
428
- ], this.client);
429
- return response;
430
- });
431
- }
432
472
  /**
433
473
  * The unique image reference which can only be retrieved immediately after the 'Container.From' call.
434
474
  */
@@ -455,7 +495,7 @@ export class Container extends BaseClient {
455
495
  * @param opts.tag Identifies the tag to import from the archive, if the archive bundles
456
496
  * multiple tags.
457
497
  */
458
- import(source, opts) {
498
+ import_(source, opts) {
459
499
  return new Container({
460
500
  queryTree: [
461
501
  ...this._queryTree,
@@ -610,6 +650,26 @@ export class Container extends BaseClient {
610
650
  sessionToken: this.sessionToken,
611
651
  });
612
652
  }
653
+ /**
654
+ * Return a websocket endpoint that, if connected to, will start the container with a TTY streamed
655
+ * over the websocket.
656
+ *
657
+ * Primarily intended for internal use with the dagger CLI.
658
+ */
659
+ shellEndpoint() {
660
+ return __awaiter(this, void 0, void 0, function* () {
661
+ if (this._shellEndpoint) {
662
+ return this._shellEndpoint;
663
+ }
664
+ const response = yield computeQuery([
665
+ ...this._queryTree,
666
+ {
667
+ operation: "shellEndpoint",
668
+ },
669
+ ], this.client);
670
+ return response;
671
+ });
672
+ }
613
673
  /**
614
674
  * The error stream of the last executed command.
615
675
  *
@@ -1325,15 +1385,62 @@ export class Directory extends BaseClient {
1325
1385
  /**
1326
1386
  * Constructor is used for internal usage only, do not create object from it.
1327
1387
  */
1328
- constructor(parent, _export, _id, _sync) {
1388
+ constructor(parent, _id, _export, _sync) {
1329
1389
  super(parent);
1330
- this._export = undefined;
1331
1390
  this._id = undefined;
1391
+ this._export = undefined;
1332
1392
  this._sync = undefined;
1333
- this._export = _export;
1334
1393
  this._id = _id;
1394
+ this._export = _export;
1335
1395
  this._sync = _sync;
1336
1396
  }
1397
+ /**
1398
+ * The content-addressed identifier of the directory.
1399
+ */
1400
+ id() {
1401
+ return __awaiter(this, void 0, void 0, function* () {
1402
+ if (this._id) {
1403
+ return this._id;
1404
+ }
1405
+ const response = yield computeQuery([
1406
+ ...this._queryTree,
1407
+ {
1408
+ operation: "id",
1409
+ },
1410
+ ], this.client);
1411
+ return response;
1412
+ });
1413
+ }
1414
+ /**
1415
+ * Load the directory as a Dagger module
1416
+ * @param opts.sourceSubpath An optional subpath of the directory which contains the module's source
1417
+ * code.
1418
+ *
1419
+ * This is needed when the module code is in a subdirectory but requires
1420
+ * parent directories to be loaded in order to execute. For example, the
1421
+ * module source code may need a go.mod, project.toml, package.json, etc. file
1422
+ * from a parent directory.
1423
+ *
1424
+ * If not set, the module source code is loaded from the root of the
1425
+ * directory.
1426
+ * @param opts.runtime A pre-built runtime container to use instead of building one from the
1427
+ * source code. This is useful for bootstrapping.
1428
+ *
1429
+ * You should ignore this unless you're building a Dagger SDK.
1430
+ */
1431
+ asModule(opts) {
1432
+ return new Module_({
1433
+ queryTree: [
1434
+ ...this._queryTree,
1435
+ {
1436
+ operation: "asModule",
1437
+ args: Object.assign({}, opts),
1438
+ },
1439
+ ],
1440
+ host: this.clientHost,
1441
+ sessionToken: this.sessionToken,
1442
+ });
1443
+ }
1337
1444
  /**
1338
1445
  * Gets the difference between this directory and an another directory.
1339
1446
  * @param other Identifier of the directory to compare.
@@ -1445,23 +1552,6 @@ export class Directory extends BaseClient {
1445
1552
  sessionToken: this.sessionToken,
1446
1553
  });
1447
1554
  }
1448
- /**
1449
- * The content-addressed identifier of the directory.
1450
- */
1451
- id() {
1452
- return __awaiter(this, void 0, void 0, function* () {
1453
- if (this._id) {
1454
- return this._id;
1455
- }
1456
- const response = yield computeQuery([
1457
- ...this._queryTree,
1458
- {
1459
- operation: "id",
1460
- },
1461
- ], this.client);
1462
- return response;
1463
- });
1464
- }
1465
1555
  /**
1466
1556
  * Creates a named sub-pipeline
1467
1557
  * @param name Pipeline name.
@@ -1688,6 +1778,72 @@ export class EnvVariable extends BaseClient {
1688
1778
  });
1689
1779
  }
1690
1780
  }
1781
+ /**
1782
+ * A definition of a field on a custom object defined in a Module.
1783
+ * A field on an object has a static value, as opposed to a function on an
1784
+ * object whose value is computed by invoking code (and can accept arguments).
1785
+ */
1786
+ export class FieldTypeDef extends BaseClient {
1787
+ /**
1788
+ * Constructor is used for internal usage only, do not create object from it.
1789
+ */
1790
+ constructor(parent, _description, _name) {
1791
+ super(parent);
1792
+ this._description = undefined;
1793
+ this._name = undefined;
1794
+ this._description = _description;
1795
+ this._name = _name;
1796
+ }
1797
+ /**
1798
+ * A doc string for the field, if any
1799
+ */
1800
+ description() {
1801
+ return __awaiter(this, void 0, void 0, function* () {
1802
+ if (this._description) {
1803
+ return this._description;
1804
+ }
1805
+ const response = yield computeQuery([
1806
+ ...this._queryTree,
1807
+ {
1808
+ operation: "description",
1809
+ },
1810
+ ], this.client);
1811
+ return response;
1812
+ });
1813
+ }
1814
+ /**
1815
+ * The name of the field in the object
1816
+ */
1817
+ name() {
1818
+ return __awaiter(this, void 0, void 0, function* () {
1819
+ if (this._name) {
1820
+ return this._name;
1821
+ }
1822
+ const response = yield computeQuery([
1823
+ ...this._queryTree,
1824
+ {
1825
+ operation: "name",
1826
+ },
1827
+ ], this.client);
1828
+ return response;
1829
+ });
1830
+ }
1831
+ /**
1832
+ * The type of the field
1833
+ */
1834
+ typeDef() {
1835
+ return new TypeDef({
1836
+ queryTree: [
1837
+ ...this._queryTree,
1838
+ {
1839
+ operation: "typeDef",
1840
+ },
1841
+ ],
1842
+ host: this.clientHost,
1843
+ sessionToken: this.sessionToken,
1844
+ });
1845
+ }
1846
+ }
1691
1847
  /**
1692
1848
  * A file.
1693
1849
  */
@@ -1695,19 +1851,36 @@ export class File extends BaseClient {
1695
1851
  /**
1696
1852
  * Constructor is used for internal usage only, do not create object from it.
1697
1853
  */
1698
- constructor(parent, _contents, _export, _id, _size, _sync) {
1854
+ constructor(parent, _id, _contents, _export, _size, _sync) {
1699
1855
  super(parent);
1856
+ this._id = undefined;
1700
1857
  this._contents = undefined;
1701
1858
  this._export = undefined;
1702
- this._id = undefined;
1703
1859
  this._size = undefined;
1704
1860
  this._sync = undefined;
1861
+ this._id = _id;
1705
1862
  this._contents = _contents;
1706
1863
  this._export = _export;
1707
- this._id = _id;
1708
1864
  this._size = _size;
1709
1865
  this._sync = _sync;
1710
1866
  }
1867
+ /**
1868
+ * Retrieves the content-addressed identifier of the file.
1869
+ */
1870
+ id() {
1871
+ return __awaiter(this, void 0, void 0, function* () {
1872
+ if (this._id) {
1873
+ return this._id;
1874
+ }
1875
+ const response = yield computeQuery([
1876
+ ...this._queryTree,
1877
+ {
1878
+ operation: "id",
1879
+ },
1880
+ ], this.client);
1881
+ return response;
1882
+ });
1883
+ }
1711
1884
  /**
1712
1885
  * Retrieves the contents of the file.
1713
1886
  */
@@ -1746,23 +1919,6 @@ export class File extends BaseClient {
1746
1919
  return response;
1747
1920
  });
1748
1921
  }
1749
- /**
1750
- * Retrieves the content-addressed identifier of the file.
1751
- */
1752
- id() {
1753
- return __awaiter(this, void 0, void 0, function* () {
1754
- if (this._id) {
1755
- return this._id;
1756
- }
1757
- const response = yield computeQuery([
1758
- ...this._queryTree,
1759
- {
1760
- operation: "id",
1761
- },
1762
- ], this.client);
1763
- return response;
1764
- });
1765
- }
1766
1922
  /**
1767
1923
  * Gets the size of the file, in bytes.
1768
1924
  */
@@ -1823,47 +1979,588 @@ export class File extends BaseClient {
1823
1979
  }
1824
1980
  }
1825
1981
  /**
1826
- * A git ref (tag, branch or commit).
1982
+ * Function represents a resolver provided by a Module.
1983
+ *
1984
+ * A function always evaluates against a parent object and is given a set of
1985
+ * named arguments.
1827
1986
  */
1828
- export class GitRef extends BaseClient {
1987
+ export class Function_ extends BaseClient {
1829
1988
  /**
1830
1989
  * Constructor is used for internal usage only, do not create object from it.
1831
1990
  */
1832
- constructor(parent) {
1991
+ constructor(parent, _id, _call, _description, _name) {
1833
1992
  super(parent);
1993
+ this._id = undefined;
1994
+ this._call = undefined;
1995
+ this._description = undefined;
1996
+ this._name = undefined;
1997
+ this._id = _id;
1998
+ this._call = _call;
1999
+ this._description = _description;
2000
+ this._name = _name;
1834
2001
  }
1835
2002
  /**
1836
- * The filesystem tree at this ref.
2003
+ * The ID of the function
1837
2004
  */
1838
- tree(opts) {
1839
- return new Directory({
1840
- queryTree: [
2005
+ id() {
2006
+ return __awaiter(this, void 0, void 0, function* () {
2007
+ if (this._id) {
2008
+ return this._id;
2009
+ }
2010
+ const response = yield computeQuery([
1841
2011
  ...this._queryTree,
1842
2012
  {
1843
- operation: "tree",
1844
- args: Object.assign({}, opts),
2013
+ operation: "id",
1845
2014
  },
1846
- ],
1847
- host: this.clientHost,
1848
- sessionToken: this.sessionToken,
2015
+ ], this.client);
2016
+ return response;
1849
2017
  });
1850
2018
  }
1851
- }
1852
- /**
1853
- * A git repository.
1854
- */
1855
- export class GitRepository extends BaseClient {
1856
- /**
1857
- * Constructor is used for internal usage only, do not create object from it.
1858
- */
1859
- constructor(parent) {
1860
- super(parent);
1861
- }
1862
2019
  /**
1863
- * Returns details on one branch.
1864
- * @param name Branch's name (e.g., "main").
2020
+ * Arguments accepted by this function, if any
1865
2021
  */
1866
- branch(name) {
2022
+ args() {
2023
+ return __awaiter(this, void 0, void 0, function* () {
2024
+ const response = yield computeQuery([
2025
+ ...this._queryTree,
2026
+ {
2027
+ operation: "args",
2028
+ },
2029
+ {
2030
+ operation: "defaultValue description name",
2031
+ },
2032
+ ], this.client);
2033
+ return response.map((r) => new FunctionArg({
2034
+ queryTree: this.queryTree,
2035
+ host: this.clientHost,
2036
+ sessionToken: this.sessionToken,
2037
+ }, r.defaultValue, r.description, r.name));
2038
+ });
2039
+ }
2040
+ /**
2041
+ * Execute this function using dynamic input+output types.
2042
+ *
2043
+ * Typically, it's preferable to invoke a function using a type
2044
+ * safe graphql query rather than using this call field. However,
2045
+ * call is useful for some advanced use cases where dynamically
2046
+ * loading arbitrary modules and invoking functions in them is
2047
+ * required.
2048
+ */
2049
+ call(opts) {
2050
+ return __awaiter(this, void 0, void 0, function* () {
2051
+ if (this._call) {
2052
+ return this._call;
2053
+ }
2054
+ const response = yield computeQuery([
2055
+ ...this._queryTree,
2056
+ {
2057
+ operation: "call",
2058
+ args: Object.assign({}, opts),
2059
+ },
2060
+ ], this.client);
2061
+ return response;
2062
+ });
2063
+ }
2064
+ /**
2065
+ * A doc string for the function, if any
2066
+ */
2067
+ description() {
2068
+ return __awaiter(this, void 0, void 0, function* () {
2069
+ if (this._description) {
2070
+ return this._description;
2071
+ }
2072
+ const response = yield computeQuery([
2073
+ ...this._queryTree,
2074
+ {
2075
+ operation: "description",
2076
+ },
2077
+ ], this.client);
2078
+ return response;
2079
+ });
2080
+ }
2081
+ /**
2082
+ * The name of the function
2083
+ */
2084
+ name() {
2085
+ return __awaiter(this, void 0, void 0, function* () {
2086
+ if (this._name) {
2087
+ return this._name;
2088
+ }
2089
+ const response = yield computeQuery([
2090
+ ...this._queryTree,
2091
+ {
2092
+ operation: "name",
2093
+ },
2094
+ ], this.client);
2095
+ return response;
2096
+ });
2097
+ }
2098
+ /**
2099
+ * The type returned by this function
2100
+ */
2101
+ returnType() {
2102
+ return new TypeDef({
2103
+ queryTree: [
2104
+ ...this._queryTree,
2105
+ {
2106
+ operation: "returnType",
2107
+ },
2108
+ ],
2109
+ host: this.clientHost,
2110
+ sessionToken: this.sessionToken,
2111
+ });
2112
+ }
2113
+ /**
2114
+ * Returns the function with the provided argument
2115
+ * @param name The name of the argument
2116
+ * @param typeDef The type of the argument
2117
+ * @param opts.description A doc string for the argument, if any
2118
+ * @param opts.defaultValue A default value to use for this argument if not explicitly set by the caller, if any
2119
+ */
2120
+ withArg(name, typeDef, opts) {
2121
+ return new Function_({
2122
+ queryTree: [
2123
+ ...this._queryTree,
2124
+ {
2125
+ operation: "withArg",
2126
+ args: Object.assign({ name, typeDef }, opts),
2127
+ },
2128
+ ],
2129
+ host: this.clientHost,
2130
+ sessionToken: this.sessionToken,
2131
+ });
2132
+ }
2133
+ /**
2134
+ * Returns the function with the doc string
2135
+ */
2136
+ withDescription(description) {
2137
+ return new Function_({
2138
+ queryTree: [
2139
+ ...this._queryTree,
2140
+ {
2141
+ operation: "withDescription",
2142
+ args: { description },
2143
+ },
2144
+ ],
2145
+ host: this.clientHost,
2146
+ sessionToken: this.sessionToken,
2147
+ });
2148
+ }
2149
+ /**
2150
+ * Call the provided function with current Function.
2151
+ *
2152
+ * This is useful for reusability and readability by not breaking the calling chain.
2153
+ */
2154
+ with(arg) {
2155
+ return arg(this);
2156
+ }
2157
+ }
2158
+ /**
2159
+ * An argument accepted by a function.
2160
+ *
2161
+ * This is a specification for an argument at function definition time, not an
2162
+ * argument passed at function call time.
2163
+ */
2164
+ export class FunctionArg extends BaseClient {
2165
+ /**
2166
+ * Constructor is used for internal usage only, do not create object from it.
2167
+ */
2168
+ constructor(parent, _defaultValue, _description, _name) {
2169
+ super(parent);
2170
+ this._defaultValue = undefined;
2171
+ this._description = undefined;
2172
+ this._name = undefined;
2173
+ this._defaultValue = _defaultValue;
2174
+ this._description = _description;
2175
+ this._name = _name;
2176
+ }
2177
+ /**
2178
+ * A default value to use for this argument when not explicitly set by the caller, if any
2179
+ */
2180
+ defaultValue() {
2181
+ return __awaiter(this, void 0, void 0, function* () {
2182
+ if (this._defaultValue) {
2183
+ return this._defaultValue;
2184
+ }
2185
+ const response = yield computeQuery([
2186
+ ...this._queryTree,
2187
+ {
2188
+ operation: "defaultValue",
2189
+ },
2190
+ ], this.client);
2191
+ return response;
2192
+ });
2193
+ }
2194
+ /**
2195
+ * A doc string for the argument, if any
2196
+ */
2197
+ description() {
2198
+ return __awaiter(this, void 0, void 0, function* () {
2199
+ if (this._description) {
2200
+ return this._description;
2201
+ }
2202
+ const response = yield computeQuery([
2203
+ ...this._queryTree,
2204
+ {
2205
+ operation: "description",
2206
+ },
2207
+ ], this.client);
2208
+ return response;
2209
+ });
2210
+ }
2211
+ /**
2212
+ * The name of the argument
2213
+ */
2214
+ name() {
2215
+ return __awaiter(this, void 0, void 0, function* () {
2216
+ if (this._name) {
2217
+ return this._name;
2218
+ }
2219
+ const response = yield computeQuery([
2220
+ ...this._queryTree,
2221
+ {
2222
+ operation: "name",
2223
+ },
2224
+ ], this.client);
2225
+ return response;
2226
+ });
2227
+ }
2228
+ /**
2229
+ * The type of the argument
2230
+ */
2231
+ typeDef() {
2232
+ return new TypeDef({
2233
+ queryTree: [
2234
+ ...this._queryTree,
2235
+ {
2236
+ operation: "typeDef",
2237
+ },
2238
+ ],
2239
+ host: this.clientHost,
2240
+ sessionToken: this.sessionToken,
2241
+ });
2242
+ }
2243
+ }
2244
+ export class FunctionCall extends BaseClient {
2245
+ /**
2246
+ * Constructor is used for internal usage only, do not create object from it.
2247
+ */
2248
+ constructor(parent, _name, _parent, _parentName, _returnValue) {
2249
+ super(parent);
2250
+ this._name = undefined;
2251
+ this._parent = undefined;
2252
+ this._parentName = undefined;
2253
+ this._returnValue = undefined;
2254
+ this._name = _name;
2255
+ this._parent = _parent;
2256
+ this._parentName = _parentName;
2257
+ this._returnValue = _returnValue;
2258
+ }
2259
+ /**
2260
+ * The argument values the function is being invoked with.
2261
+ */
2262
+ inputArgs() {
2263
+ return __awaiter(this, void 0, void 0, function* () {
2264
+ const response = yield computeQuery([
2265
+ ...this._queryTree,
2266
+ {
2267
+ operation: "inputArgs",
2268
+ },
2269
+ {
2270
+ operation: "name value",
2271
+ },
2272
+ ], this.client);
2273
+ return response.map((r) => new FunctionCallArgValue({
2274
+ queryTree: this.queryTree,
2275
+ host: this.clientHost,
2276
+ sessionToken: this.sessionToken,
2277
+ }, r.name, r.value));
2278
+ });
2279
+ }
2280
+ /**
2281
+ * The name of the function being called.
2282
+ */
2283
+ name() {
2284
+ return __awaiter(this, void 0, void 0, function* () {
2285
+ if (this._name) {
2286
+ return this._name;
2287
+ }
2288
+ const response = yield computeQuery([
2289
+ ...this._queryTree,
2290
+ {
2291
+ operation: "name",
2292
+ },
2293
+ ], this.client);
2294
+ return response;
2295
+ });
2296
+ }
2297
+ /**
2298
+ * The value of the parent object of the function being called.
2299
+ * If the function is "top-level" to the module, this is always an empty object.
2300
+ */
2301
+ parent() {
2302
+ return __awaiter(this, void 0, void 0, function* () {
2303
+ if (this._parent) {
2304
+ return this._parent;
2305
+ }
2306
+ const response = yield computeQuery([
2307
+ ...this._queryTree,
2308
+ {
2309
+ operation: "parent",
2310
+ },
2311
+ ], this.client);
2312
+ return response;
2313
+ });
2314
+ }
2315
+ /**
2316
+ * The name of the parent object of the function being called.
2317
+ * If the function is "top-level" to the module, this is the name of the module.
2318
+ */
2319
+ parentName() {
2320
+ return __awaiter(this, void 0, void 0, function* () {
2321
+ if (this._parentName) {
2322
+ return this._parentName;
2323
+ }
2324
+ const response = yield computeQuery([
2325
+ ...this._queryTree,
2326
+ {
2327
+ operation: "parentName",
2328
+ },
2329
+ ], this.client);
2330
+ return response;
2331
+ });
2332
+ }
2333
+ /**
2334
+ * Set the return value of the function call to the provided value.
2335
+ * The value should be a string of the JSON serialization of the return value.
2336
+ */
2337
+ returnValue(value) {
2338
+ return __awaiter(this, void 0, void 0, function* () {
2339
+ if (this._returnValue) {
2340
+ return this._returnValue;
2341
+ }
2342
+ const response = yield computeQuery([
2343
+ ...this._queryTree,
2344
+ {
2345
+ operation: "returnValue",
2346
+ args: { value },
2347
+ },
2348
+ ], this.client);
2349
+ return response;
2350
+ });
2351
+ }
2352
+ }
2353
+ export class FunctionCallArgValue extends BaseClient {
2354
+ /**
2355
+ * Constructor is used for internal usage only, do not create object from it.
2356
+ */
2357
+ constructor(parent, _name, _value) {
2358
+ super(parent);
2359
+ this._name = undefined;
2360
+ this._value = undefined;
2361
+ this._name = _name;
2362
+ this._value = _value;
2363
+ }
2364
+ /**
2365
+ * The name of the argument.
2366
+ */
2367
+ name() {
2368
+ return __awaiter(this, void 0, void 0, function* () {
2369
+ if (this._name) {
2370
+ return this._name;
2371
+ }
2372
+ const response = yield computeQuery([
2373
+ ...this._queryTree,
2374
+ {
2375
+ operation: "name",
2376
+ },
2377
+ ], this.client);
2378
+ return response;
2379
+ });
2380
+ }
2381
+ /**
2382
+ * The value of the argument represented as a string of the JSON serialization.
2383
+ */
2384
+ value() {
2385
+ return __awaiter(this, void 0, void 0, function* () {
2386
+ if (this._value) {
2387
+ return this._value;
2388
+ }
2389
+ const response = yield computeQuery([
2390
+ ...this._queryTree,
2391
+ {
2392
+ operation: "value",
2393
+ },
2394
+ ], this.client);
2395
+ return response;
2396
+ });
2397
+ }
2398
+ }
2399
+ export class GeneratedCode extends BaseClient {
2400
+ /**
2401
+ * Constructor is used for internal usage only, do not create object from it.
2402
+ */
2403
+ constructor(parent, _id) {
2404
+ super(parent);
2405
+ this._id = undefined;
2406
+ this._id = _id;
2407
+ }
2408
+ id() {
2409
+ return __awaiter(this, void 0, void 0, function* () {
2410
+ if (this._id) {
2411
+ return this._id;
2412
+ }
2413
+ const response = yield computeQuery([
2414
+ ...this._queryTree,
2415
+ {
2416
+ operation: "id",
2417
+ },
2418
+ ], this.client);
2419
+ return response;
2420
+ });
2421
+ }
2422
+ /**
2423
+ * The directory containing the generated code
2424
+ */
2425
+ code() {
2426
+ return new Directory({
2427
+ queryTree: [
2428
+ ...this._queryTree,
2429
+ {
2430
+ operation: "code",
2431
+ },
2432
+ ],
2433
+ host: this.clientHost,
2434
+ sessionToken: this.sessionToken,
2435
+ });
2436
+ }
2437
+ /**
2438
+ * List of paths to mark generated in version control (i.e. .gitattributes)
2439
+ */
2440
+ vcsGeneratedPaths() {
2441
+ return __awaiter(this, void 0, void 0, function* () {
2442
+ const response = yield computeQuery([
2443
+ ...this._queryTree,
2444
+ {
2445
+ operation: "vcsGeneratedPaths",
2446
+ },
2447
+ ], this.client);
2448
+ return response;
2449
+ });
2450
+ }
2451
+ /**
2452
+ * List of paths to ignore in version control (i.e. .gitignore)
2453
+ */
2454
+ vcsIgnoredPaths() {
2455
+ return __awaiter(this, void 0, void 0, function* () {
2456
+ const response = yield computeQuery([
2457
+ ...this._queryTree,
2458
+ {
2459
+ operation: "vcsIgnoredPaths",
2460
+ },
2461
+ ], this.client);
2462
+ return response;
2463
+ });
2464
+ }
2465
+ /**
2466
+ * Set the directory containing the generated code
2467
+ */
2468
+ withCode(code) {
2469
+ return new GeneratedCode({
2470
+ queryTree: [
2471
+ ...this._queryTree,
2472
+ {
2473
+ operation: "withCode",
2474
+ args: { code },
2475
+ },
2476
+ ],
2477
+ host: this.clientHost,
2478
+ sessionToken: this.sessionToken,
2479
+ });
2480
+ }
2481
+ /**
2482
+ * Set the list of paths to mark generated in version control
2483
+ */
2484
+ withVCSGeneratedPaths(paths) {
2485
+ return new GeneratedCode({
2486
+ queryTree: [
2487
+ ...this._queryTree,
2488
+ {
2489
+ operation: "withVCSGeneratedPaths",
2490
+ args: { paths },
2491
+ },
2492
+ ],
2493
+ host: this.clientHost,
2494
+ sessionToken: this.sessionToken,
2495
+ });
2496
+ }
2497
+ /**
2498
+ * Set the list of paths to ignore in version control
2499
+ */
2500
+ withVCSIgnoredPaths(paths) {
2501
+ return new GeneratedCode({
2502
+ queryTree: [
2503
+ ...this._queryTree,
2504
+ {
2505
+ operation: "withVCSIgnoredPaths",
2506
+ args: { paths },
2507
+ },
2508
+ ],
2509
+ host: this.clientHost,
2510
+ sessionToken: this.sessionToken,
2511
+ });
2512
+ }
2513
+ /**
2514
+ * Call the provided function with current GeneratedCode.
2515
+ *
2516
+ * This is useful for reusability and readability by not breaking the calling chain.
2517
+ */
2518
+ with(arg) {
2519
+ return arg(this);
2520
+ }
2521
+ }
2522
+ /**
2523
+ * A git ref (tag, branch or commit).
2524
+ */
2525
+ export class GitRef extends BaseClient {
2526
+ /**
2527
+ * Constructor is used for internal usage only, do not create object from it.
2528
+ */
2529
+ constructor(parent) {
2530
+ super(parent);
2531
+ }
2532
+ /**
2533
+ * The filesystem tree at this ref.
2534
+ */
2535
+ tree(opts) {
2536
+ return new Directory({
2537
+ queryTree: [
2538
+ ...this._queryTree,
2539
+ {
2540
+ operation: "tree",
2541
+ args: Object.assign({}, opts),
2542
+ },
2543
+ ],
2544
+ host: this.clientHost,
2545
+ sessionToken: this.sessionToken,
2546
+ });
2547
+ }
2548
+ }
2549
+ /**
2550
+ * A git repository.
2551
+ */
2552
+ export class GitRepository extends BaseClient {
2553
+ /**
2554
+ * Constructor is used for internal usage only, do not create object from it.
2555
+ */
2556
+ constructor(parent) {
2557
+ super(parent);
2558
+ }
2559
+ /**
2560
+ * Returns details on one branch.
2561
+ * @param name Branch's name (e.g., "main").
2562
+ */
2563
+ branch(name) {
1867
2564
  return new GitRef({
1868
2565
  queryTree: [
1869
2566
  ...this._queryTree,
@@ -2044,135 +2741,237 @@ export class Label extends BaseClient {
2044
2741
  }
2045
2742
  }
2046
2743
  /**
2047
- * A port exposed by a container.
2744
+ * A definition of a list type in a Module.
2048
2745
  */
2049
- export class Port extends BaseClient {
2746
+ export class ListTypeDef extends BaseClient {
2050
2747
  /**
2051
2748
  * Constructor is used for internal usage only, do not create object from it.
2052
2749
  */
2053
- constructor(parent, _description, _port, _protocol) {
2750
+ constructor(parent) {
2751
+ super(parent);
2752
+ }
2753
+ /**
2754
+ * The type of the elements in the list
2755
+ */
2756
+ elementTypeDef() {
2757
+ return new TypeDef({
2758
+ queryTree: [
2759
+ ...this._queryTree,
2760
+ {
2761
+ operation: "elementTypeDef",
2762
+ },
2763
+ ],
2764
+ host: this.clientHost,
2765
+ sessionToken: this.sessionToken,
2766
+ });
2767
+ }
2768
+ }
2769
+ export class Module_ extends BaseClient {
2770
+ /**
2771
+ * Constructor is used for internal usage only, do not create object from it.
2772
+ */
2773
+ constructor(parent, _id, _description, _name, _sdk, _sdkRuntime, _serve, _sourceDirectorySubPath) {
2054
2774
  super(parent);
2775
+ this._id = undefined;
2055
2776
  this._description = undefined;
2056
- this._port = undefined;
2057
- this._protocol = undefined;
2777
+ this._name = undefined;
2778
+ this._sdk = undefined;
2779
+ this._sdkRuntime = undefined;
2780
+ this._serve = undefined;
2781
+ this._sourceDirectorySubPath = undefined;
2782
+ this._id = _id;
2058
2783
  this._description = _description;
2059
- this._port = _port;
2060
- this._protocol = _protocol;
2784
+ this._name = _name;
2785
+ this._sdk = _sdk;
2786
+ this._sdkRuntime = _sdkRuntime;
2787
+ this._serve = _serve;
2788
+ this._sourceDirectorySubPath = _sourceDirectorySubPath;
2061
2789
  }
2062
2790
  /**
2063
- * The port description.
2791
+ * The ID of the module
2064
2792
  */
2065
- description() {
2793
+ id() {
2066
2794
  return __awaiter(this, void 0, void 0, function* () {
2067
- if (this._description) {
2068
- return this._description;
2795
+ if (this._id) {
2796
+ return this._id;
2069
2797
  }
2070
2798
  const response = yield computeQuery([
2071
2799
  ...this._queryTree,
2072
2800
  {
2073
- operation: "description",
2801
+ operation: "id",
2074
2802
  },
2075
2803
  ], this.client);
2076
2804
  return response;
2077
2805
  });
2078
2806
  }
2079
2807
  /**
2080
- * The port number.
2808
+ * Modules used by this module
2081
2809
  */
2082
- port() {
2810
+ dependencies() {
2083
2811
  return __awaiter(this, void 0, void 0, function* () {
2084
- if (this._port) {
2085
- return this._port;
2086
- }
2087
2812
  const response = yield computeQuery([
2088
2813
  ...this._queryTree,
2089
2814
  {
2090
- operation: "port",
2815
+ operation: "dependencies",
2816
+ },
2817
+ {
2818
+ operation: "id",
2819
+ },
2820
+ ], this.client);
2821
+ return response.map((r) => new Module_({
2822
+ queryTree: this.queryTree,
2823
+ host: this.clientHost,
2824
+ sessionToken: this.sessionToken,
2825
+ }, r.id));
2826
+ });
2827
+ }
2828
+ /**
2829
+ * The dependencies as configured by the module
2830
+ */
2831
+ dependencyConfig() {
2832
+ return __awaiter(this, void 0, void 0, function* () {
2833
+ const response = yield computeQuery([
2834
+ ...this._queryTree,
2835
+ {
2836
+ operation: "dependencyConfig",
2091
2837
  },
2092
2838
  ], this.client);
2093
2839
  return response;
2094
2840
  });
2095
2841
  }
2096
2842
  /**
2097
- * The transport layer network protocol.
2843
+ * The doc string of the module, if any
2098
2844
  */
2099
- protocol() {
2845
+ description() {
2100
2846
  return __awaiter(this, void 0, void 0, function* () {
2101
- if (this._protocol) {
2102
- return this._protocol;
2847
+ if (this._description) {
2848
+ return this._description;
2103
2849
  }
2104
2850
  const response = yield computeQuery([
2105
2851
  ...this._queryTree,
2106
2852
  {
2107
- operation: "protocol",
2853
+ operation: "description",
2108
2854
  },
2109
2855
  ], this.client);
2110
2856
  return response;
2111
2857
  });
2112
2858
  }
2113
- }
2114
- /**
2115
- * A collection of Dagger resources that can be queried and invoked.
2116
- */
2117
- export class Project extends BaseClient {
2118
2859
  /**
2119
- * Constructor is used for internal usage only, do not create object from it.
2860
+ * The code generated by the SDK's runtime
2120
2861
  */
2121
- constructor(parent, _id, _name) {
2122
- super(parent);
2123
- this._id = undefined;
2124
- this._name = undefined;
2125
- this._id = _id;
2126
- this._name = _name;
2862
+ generatedCode() {
2863
+ return new GeneratedCode({
2864
+ queryTree: [
2865
+ ...this._queryTree,
2866
+ {
2867
+ operation: "generatedCode",
2868
+ },
2869
+ ],
2870
+ host: this.clientHost,
2871
+ sessionToken: this.sessionToken,
2872
+ });
2873
+ }
2874
+ /**
2875
+ * The name of the module
2876
+ */
2877
+ name() {
2878
+ return __awaiter(this, void 0, void 0, function* () {
2879
+ if (this._name) {
2880
+ return this._name;
2881
+ }
2882
+ const response = yield computeQuery([
2883
+ ...this._queryTree,
2884
+ {
2885
+ operation: "name",
2886
+ },
2887
+ ], this.client);
2888
+ return response;
2889
+ });
2127
2890
  }
2128
2891
  /**
2129
- * Commands provided by this project
2892
+ * Objects served by this module
2130
2893
  */
2131
- commands() {
2894
+ objects() {
2132
2895
  return __awaiter(this, void 0, void 0, function* () {
2133
2896
  const response = yield computeQuery([
2134
2897
  ...this._queryTree,
2135
2898
  {
2136
- operation: "commands",
2899
+ operation: "objects",
2137
2900
  },
2138
2901
  {
2139
- operation: "description id name resultType",
2902
+ operation: "id",
2140
2903
  },
2141
2904
  ], this.client);
2142
- return response.map((r) => new ProjectCommand({
2905
+ return response.map((r) => new TypeDef({
2143
2906
  queryTree: this.queryTree,
2144
2907
  host: this.clientHost,
2145
2908
  sessionToken: this.sessionToken,
2146
- }, r.description, r.id, r.name, r.resultType));
2909
+ }, r.id));
2147
2910
  });
2148
2911
  }
2149
2912
  /**
2150
- * A unique identifier for this project.
2913
+ * The SDK used by this module
2151
2914
  */
2152
- id() {
2915
+ sdk() {
2153
2916
  return __awaiter(this, void 0, void 0, function* () {
2154
- if (this._id) {
2155
- return this._id;
2917
+ if (this._sdk) {
2918
+ return this._sdk;
2156
2919
  }
2157
2920
  const response = yield computeQuery([
2158
2921
  ...this._queryTree,
2159
2922
  {
2160
- operation: "id",
2923
+ operation: "sdk",
2924
+ },
2925
+ ], this.client);
2926
+ return response;
2927
+ });
2928
+ }
2929
+ /**
2930
+ * The SDK runtime module image ref.
2931
+ */
2932
+ sdkRuntime() {
2933
+ return __awaiter(this, void 0, void 0, function* () {
2934
+ if (this._sdkRuntime) {
2935
+ return this._sdkRuntime;
2936
+ }
2937
+ const response = yield computeQuery([
2938
+ ...this._queryTree,
2939
+ {
2940
+ operation: "sdkRuntime",
2941
+ },
2942
+ ], this.client);
2943
+ return response;
2944
+ });
2945
+ }
2946
+ /**
2947
+ * Serve a module's API in the current session.
2948
+ * Note: this can only be called once per session.
2949
+ * In the future, it could return a stream or service to remove the side effect.
2950
+ */
2951
+ serve(opts) {
2952
+ return __awaiter(this, void 0, void 0, function* () {
2953
+ if (this._serve) {
2954
+ return this._serve;
2955
+ }
2956
+ const response = yield computeQuery([
2957
+ ...this._queryTree,
2958
+ {
2959
+ operation: "serve",
2960
+ args: Object.assign({}, opts),
2161
2961
  },
2162
2962
  ], this.client);
2163
2963
  return response;
2164
2964
  });
2165
2965
  }
2166
2966
  /**
2167
- * Initialize this project from the given directory and config path
2967
+ * The directory containing the module's source code
2168
2968
  */
2169
- load(source, configPath) {
2170
- return new Project({
2969
+ sourceDirectory() {
2970
+ return new Directory({
2171
2971
  queryTree: [
2172
2972
  ...this._queryTree,
2173
2973
  {
2174
- operation: "load",
2175
- args: { source, configPath },
2974
+ operation: "sourceDirectory",
2176
2975
  },
2177
2976
  ],
2178
2977
  host: this.clientHost,
@@ -2180,24 +2979,40 @@ export class Project extends BaseClient {
2180
2979
  });
2181
2980
  }
2182
2981
  /**
2183
- * Name of the project
2982
+ * The module's subpath within the source directory
2184
2983
  */
2185
- name() {
2984
+ sourceDirectorySubPath() {
2186
2985
  return __awaiter(this, void 0, void 0, function* () {
2187
- if (this._name) {
2188
- return this._name;
2986
+ if (this._sourceDirectorySubPath) {
2987
+ return this._sourceDirectorySubPath;
2189
2988
  }
2190
2989
  const response = yield computeQuery([
2191
2990
  ...this._queryTree,
2192
2991
  {
2193
- operation: "name",
2992
+ operation: "sourceDirectorySubPath",
2194
2993
  },
2195
2994
  ], this.client);
2196
2995
  return response;
2197
2996
  });
2198
2997
  }
2199
2998
  /**
2200
- * Call the provided function with current Project.
2999
+ * This module plus the given Object type and associated functions
3000
+ */
3001
+ withObject(object) {
3002
+ return new Module_({
3003
+ queryTree: [
3004
+ ...this._queryTree,
3005
+ {
3006
+ operation: "withObject",
3007
+ args: { object },
3008
+ },
3009
+ ],
3010
+ host: this.clientHost,
3011
+ sessionToken: this.sessionToken,
3012
+ });
3013
+ }
3014
+ /**
3015
+ * Call the provided function with current Module.
2201
3016
  *
2202
3017
  * This is useful for reusability and readability by not breaking the calling chain.
2203
3018
  */
@@ -2206,25 +3021,21 @@ export class Project extends BaseClient {
2206
3021
  }
2207
3022
  }
2208
3023
  /**
2209
- * A command defined in a project that can be invoked from the CLI.
3024
+ * A definition of a custom object defined in a Module.
2210
3025
  */
2211
- export class ProjectCommand extends BaseClient {
3026
+ export class ObjectTypeDef extends BaseClient {
2212
3027
  /**
2213
3028
  * Constructor is used for internal usage only, do not create object from it.
2214
3029
  */
2215
- constructor(parent, _description, _id, _name, _resultType) {
3030
+ constructor(parent, _description, _name) {
2216
3031
  super(parent);
2217
3032
  this._description = undefined;
2218
- this._id = undefined;
2219
3033
  this._name = undefined;
2220
- this._resultType = undefined;
2221
3034
  this._description = _description;
2222
- this._id = _id;
2223
3035
  this._name = _name;
2224
- this._resultType = _resultType;
2225
3036
  }
2226
3037
  /**
2227
- * Documentation for what this command does.
3038
+ * The doc string for the object, if any
2228
3039
  */
2229
3040
  description() {
2230
3041
  return __awaiter(this, void 0, void 0, function* () {
@@ -2241,20 +3052,20 @@ export class ProjectCommand extends BaseClient {
2241
3052
  });
2242
3053
  }
2243
3054
  /**
2244
- * Flags accepted by this command.
3055
+ * Static fields defined on this object, if any
2245
3056
  */
2246
- flags() {
3057
+ fields() {
2247
3058
  return __awaiter(this, void 0, void 0, function* () {
2248
3059
  const response = yield computeQuery([
2249
3060
  ...this._queryTree,
2250
3061
  {
2251
- operation: "flags",
3062
+ operation: "fields",
2252
3063
  },
2253
3064
  {
2254
3065
  operation: "description name",
2255
3066
  },
2256
3067
  ], this.client);
2257
- return response.map((r) => new ProjectCommandFlag({
3068
+ return response.map((r) => new FieldTypeDef({
2258
3069
  queryTree: this.queryTree,
2259
3070
  host: this.clientHost,
2260
3071
  sessionToken: this.sessionToken,
@@ -2262,24 +3073,28 @@ export class ProjectCommand extends BaseClient {
2262
3073
  });
2263
3074
  }
2264
3075
  /**
2265
- * A unique identifier for this command.
3076
+ * Functions defined on this object, if any
2266
3077
  */
2267
- id() {
3078
+ functions() {
2268
3079
  return __awaiter(this, void 0, void 0, function* () {
2269
- if (this._id) {
2270
- return this._id;
2271
- }
2272
3080
  const response = yield computeQuery([
2273
3081
  ...this._queryTree,
3082
+ {
3083
+ operation: "functions",
3084
+ },
2274
3085
  {
2275
3086
  operation: "id",
2276
3087
  },
2277
3088
  ], this.client);
2278
- return response;
3089
+ return response.map((r) => new Function_({
3090
+ queryTree: this.queryTree,
3091
+ host: this.clientHost,
3092
+ sessionToken: this.sessionToken,
3093
+ }, r.id));
2279
3094
  });
2280
3095
  }
2281
3096
  /**
2282
- * The name of the command.
3097
+ * The name of the object
2283
3098
  */
2284
3099
  name() {
2285
3100
  return __awaiter(this, void 0, void 0, function* () {
@@ -2295,61 +3110,25 @@ export class ProjectCommand extends BaseClient {
2295
3110
  return response;
2296
3111
  });
2297
3112
  }
2298
- /**
2299
- * The name of the type returned by this command.
2300
- */
2301
- resultType() {
2302
- return __awaiter(this, void 0, void 0, function* () {
2303
- if (this._resultType) {
2304
- return this._resultType;
2305
- }
2306
- const response = yield computeQuery([
2307
- ...this._queryTree,
2308
- {
2309
- operation: "resultType",
2310
- },
2311
- ], this.client);
2312
- return response;
2313
- });
2314
- }
2315
- /**
2316
- * Subcommands, if any, that this command provides.
2317
- */
2318
- subcommands() {
2319
- return __awaiter(this, void 0, void 0, function* () {
2320
- const response = yield computeQuery([
2321
- ...this._queryTree,
2322
- {
2323
- operation: "subcommands",
2324
- },
2325
- {
2326
- operation: "description id name resultType",
2327
- },
2328
- ], this.client);
2329
- return response.map((r) => new ProjectCommand({
2330
- queryTree: this.queryTree,
2331
- host: this.clientHost,
2332
- sessionToken: this.sessionToken,
2333
- }, r.description, r.id, r.name, r.resultType));
2334
- });
2335
- }
2336
3113
  }
2337
3114
  /**
2338
- * A flag accepted by a project command.
3115
+ * A port exposed by a container.
2339
3116
  */
2340
- export class ProjectCommandFlag extends BaseClient {
3117
+ export class Port extends BaseClient {
2341
3118
  /**
2342
3119
  * Constructor is used for internal usage only, do not create object from it.
2343
3120
  */
2344
- constructor(parent, _description, _name) {
3121
+ constructor(parent, _description, _port, _protocol) {
2345
3122
  super(parent);
2346
3123
  this._description = undefined;
2347
- this._name = undefined;
3124
+ this._port = undefined;
3125
+ this._protocol = undefined;
2348
3126
  this._description = _description;
2349
- this._name = _name;
3127
+ this._port = _port;
3128
+ this._protocol = _protocol;
2350
3129
  }
2351
3130
  /**
2352
- * Documentation for what this flag sets.
3131
+ * The port description.
2353
3132
  */
2354
3133
  description() {
2355
3134
  return __awaiter(this, void 0, void 0, function* () {
@@ -2366,17 +3145,34 @@ export class ProjectCommandFlag extends BaseClient {
2366
3145
  });
2367
3146
  }
2368
3147
  /**
2369
- * The name of the flag.
3148
+ * The port number.
2370
3149
  */
2371
- name() {
3150
+ port() {
2372
3151
  return __awaiter(this, void 0, void 0, function* () {
2373
- if (this._name) {
2374
- return this._name;
3152
+ if (this._port) {
3153
+ return this._port;
2375
3154
  }
2376
3155
  const response = yield computeQuery([
2377
3156
  ...this._queryTree,
2378
3157
  {
2379
- operation: "name",
3158
+ operation: "port",
3159
+ },
3160
+ ], this.client);
3161
+ return response;
3162
+ });
3163
+ }
3164
+ /**
3165
+ * The transport layer network protocol.
3166
+ */
3167
+ protocol() {
3168
+ return __awaiter(this, void 0, void 0, function* () {
3169
+ if (this._protocol) {
3170
+ return this._protocol;
3171
+ }
3172
+ const response = yield computeQuery([
3173
+ ...this._queryTree,
3174
+ {
3175
+ operation: "protocol",
2380
3176
  },
2381
3177
  ], this.client);
2382
3178
  return response;
@@ -2447,6 +3243,38 @@ export class Client extends BaseClient {
2447
3243
  sessionToken: this.sessionToken,
2448
3244
  });
2449
3245
  }
3246
+ /**
3247
+ * The FunctionCall context that the SDK caller is currently executing in.
3248
+ * If the caller is not currently executing in a function, this will return
3249
+ * an error.
3250
+ */
3251
+ currentFunctionCall() {
3252
+ return new FunctionCall({
3253
+ queryTree: [
3254
+ ...this._queryTree,
3255
+ {
3256
+ operation: "currentFunctionCall",
3257
+ },
3258
+ ],
3259
+ host: this.clientHost,
3260
+ sessionToken: this.sessionToken,
3261
+ });
3262
+ }
3263
+ /**
3264
+ * The module currently being served in the session, if any.
3265
+ */
3266
+ currentModule() {
3267
+ return new Module_({
3268
+ queryTree: [
3269
+ ...this._queryTree,
3270
+ {
3271
+ operation: "currentModule",
3272
+ },
3273
+ ],
3274
+ host: this.clientHost,
3275
+ sessionToken: this.sessionToken,
3276
+ });
3277
+ }
2450
3278
  /**
2451
3279
  * The default platform of the builder.
2452
3280
  */
@@ -2493,6 +3321,38 @@ export class Client extends BaseClient {
2493
3321
  sessionToken: this.sessionToken,
2494
3322
  });
2495
3323
  }
3324
+ /**
3325
+ * Load a function by ID
3326
+ */
3327
+ function_(id) {
3328
+ return new Function_({
3329
+ queryTree: [
3330
+ ...this._queryTree,
3331
+ {
3332
+ operation: "function",
3333
+ args: { id },
3334
+ },
3335
+ ],
3336
+ host: this.clientHost,
3337
+ sessionToken: this.sessionToken,
3338
+ });
3339
+ }
3340
+ /**
3341
+ * Load GeneratedCode by ID, or create a new one if id is unset.
3342
+ */
3343
+ generatedCode(opts) {
3344
+ return new GeneratedCode({
3345
+ queryTree: [
3346
+ ...this._queryTree,
3347
+ {
3348
+ operation: "generatedCode",
3349
+ args: Object.assign({}, opts),
3350
+ },
3351
+ ],
3352
+ host: this.clientHost,
3353
+ sessionToken: this.sessionToken,
3354
+ });
3355
+ }
2496
3356
  /**
2497
3357
  * Queries a git repository.
2498
3358
  * @param url Url of the git repository.
@@ -2548,18 +3408,15 @@ export class Client extends BaseClient {
2548
3408
  });
2549
3409
  }
2550
3410
  /**
2551
- * Creates a named sub-pipeline.
2552
- * @param name Pipeline name.
2553
- * @param opts.description Pipeline description.
2554
- * @param opts.labels Pipeline labels.
3411
+ * Load a module by ID, or create a new one if id is unset.
2555
3412
  */
2556
- pipeline(name, opts) {
2557
- return new Client({
3413
+ module_(opts) {
3414
+ return new Module_({
2558
3415
  queryTree: [
2559
3416
  ...this._queryTree,
2560
3417
  {
2561
- operation: "pipeline",
2562
- args: Object.assign({ name }, opts),
3418
+ operation: "module",
3419
+ args: Object.assign({}, opts),
2563
3420
  },
2564
3421
  ],
2565
3422
  host: this.clientHost,
@@ -2567,15 +3424,15 @@ export class Client extends BaseClient {
2567
3424
  });
2568
3425
  }
2569
3426
  /**
2570
- * Load a project from ID.
3427
+ * Create a new function from the provided definition.
2571
3428
  */
2572
- project(opts) {
2573
- return new Project({
3429
+ newFunction(name, returnType) {
3430
+ return new Function_({
2574
3431
  queryTree: [
2575
3432
  ...this._queryTree,
2576
3433
  {
2577
- operation: "project",
2578
- args: Object.assign({}, opts),
3434
+ operation: "newFunction",
3435
+ args: { name, returnType },
2579
3436
  },
2580
3437
  ],
2581
3438
  host: this.clientHost,
@@ -2583,15 +3440,18 @@ export class Client extends BaseClient {
2583
3440
  });
2584
3441
  }
2585
3442
  /**
2586
- * Load a project command from ID.
3443
+ * Creates a named sub-pipeline.
3444
+ * @param name Pipeline name.
3445
+ * @param opts.description Pipeline description.
3446
+ * @param opts.labels Pipeline labels.
2587
3447
  */
2588
- projectCommand(opts) {
2589
- return new ProjectCommand({
3448
+ pipeline(name, opts) {
3449
+ return new Client({
2590
3450
  queryTree: [
2591
3451
  ...this._queryTree,
2592
3452
  {
2593
- operation: "projectCommand",
2594
- args: Object.assign({}, opts),
3453
+ operation: "pipeline",
3454
+ args: Object.assign({ name }, opts),
2595
3455
  },
2596
3456
  ],
2597
3457
  host: this.clientHost,
@@ -2649,6 +3509,19 @@ export class Client extends BaseClient {
2649
3509
  sessionToken: this.sessionToken,
2650
3510
  });
2651
3511
  }
3512
+ typeDef(opts) {
3513
+ return new TypeDef({
3514
+ queryTree: [
3515
+ ...this._queryTree,
3516
+ {
3517
+ operation: "typeDef",
3518
+ args: Object.assign({}, opts),
3519
+ },
3520
+ ],
3521
+ host: this.clientHost,
3522
+ sessionToken: this.sessionToken,
3523
+ });
3524
+ }
2652
3525
  /**
2653
3526
  * Call the provided function with current Client.
2654
3527
  *
@@ -2734,3 +3607,211 @@ export class Socket extends BaseClient {
2734
3607
  });
2735
3608
  }
2736
3609
  }
3610
+ /**
3611
+ * A definition of a parameter or return type in a Module.
3612
+ */
3613
+ export class TypeDef extends BaseClient {
3614
+ /**
3615
+ * Constructor is used for internal usage only, do not create object from it.
3616
+ */
3617
+ constructor(parent, _id, _kind, _optional) {
3618
+ super(parent);
3619
+ this._id = undefined;
3620
+ this._kind = undefined;
3621
+ this._optional = undefined;
3622
+ this._id = _id;
3623
+ this._kind = _kind;
3624
+ this._optional = _optional;
3625
+ }
3626
+ id() {
3627
+ return __awaiter(this, void 0, void 0, function* () {
3628
+ if (this._id) {
3629
+ return this._id;
3630
+ }
3631
+ const response = yield computeQuery([
3632
+ ...this._queryTree,
3633
+ {
3634
+ operation: "id",
3635
+ },
3636
+ ], this.client);
3637
+ return response;
3638
+ });
3639
+ }
3640
+ /**
3641
+ * If kind is LIST, the list-specific type definition.
3642
+ * If kind is not LIST, this will be null.
3643
+ */
3644
+ asList() {
3645
+ return new ListTypeDef({
3646
+ queryTree: [
3647
+ ...this._queryTree,
3648
+ {
3649
+ operation: "asList",
3650
+ },
3651
+ ],
3652
+ host: this.clientHost,
3653
+ sessionToken: this.sessionToken,
3654
+ });
3655
+ }
3656
+ /**
3657
+ * If kind is OBJECT, the object-specific type definition.
3658
+ * If kind is not OBJECT, this will be null.
3659
+ */
3660
+ asObject() {
3661
+ return new ObjectTypeDef({
3662
+ queryTree: [
3663
+ ...this._queryTree,
3664
+ {
3665
+ operation: "asObject",
3666
+ },
3667
+ ],
3668
+ host: this.clientHost,
3669
+ sessionToken: this.sessionToken,
3670
+ });
3671
+ }
3672
+ /**
3673
+ * The kind of type this is (e.g. primitive, list, object)
3674
+ */
3675
+ kind() {
3676
+ return __awaiter(this, void 0, void 0, function* () {
3677
+ if (this._kind) {
3678
+ return this._kind;
3679
+ }
3680
+ const response = yield computeQuery([
3681
+ ...this._queryTree,
3682
+ {
3683
+ operation: "kind",
3684
+ },
3685
+ ], this.client);
3686
+ return response;
3687
+ });
3688
+ }
3689
+ /**
3690
+ * Whether this type can be set to null. Defaults to false.
3691
+ */
3692
+ optional() {
3693
+ return __awaiter(this, void 0, void 0, function* () {
3694
+ if (this._optional) {
3695
+ return this._optional;
3696
+ }
3697
+ const response = yield computeQuery([
3698
+ ...this._queryTree,
3699
+ {
3700
+ operation: "optional",
3701
+ },
3702
+ ], this.client);
3703
+ return response;
3704
+ });
3705
+ }
3706
+ /**
3707
+ * Adds a static field for an Object TypeDef, failing if the type is not an object.
3708
+ * @param name The name of the field in the object
3709
+ * @param typeDef The type of the field
3710
+ * @param opts.description A doc string for the field, if any
3711
+ */
3712
+ withField(name, typeDef, opts) {
3713
+ return new TypeDef({
3714
+ queryTree: [
3715
+ ...this._queryTree,
3716
+ {
3717
+ operation: "withField",
3718
+ args: Object.assign({ name, typeDef }, opts),
3719
+ },
3720
+ ],
3721
+ host: this.clientHost,
3722
+ sessionToken: this.sessionToken,
3723
+ });
3724
+ }
3725
+ /**
3726
+ * Adds a function for an Object TypeDef, failing if the type is not an object.
3727
+ */
3728
+ withFunction(function_) {
3729
+ return new TypeDef({
3730
+ queryTree: [
3731
+ ...this._queryTree,
3732
+ {
3733
+ operation: "withFunction",
3734
+ args: { function_ },
3735
+ },
3736
+ ],
3737
+ host: this.clientHost,
3738
+ sessionToken: this.sessionToken,
3739
+ });
3740
+ }
3741
+ /**
3742
+ * Sets the kind of the type.
3743
+ */
3744
+ withKind(kind) {
3745
+ return new TypeDef({
3746
+ queryTree: [
3747
+ ...this._queryTree,
3748
+ {
3749
+ operation: "withKind",
3750
+ args: { kind },
3751
+ },
3752
+ ],
3753
+ host: this.clientHost,
3754
+ sessionToken: this.sessionToken,
3755
+ });
3756
+ }
3757
+ /**
3758
+ * Returns a TypeDef of kind List with the provided type for its elements.
3759
+ */
3760
+ withListOf(elementType) {
3761
+ return new TypeDef({
3762
+ queryTree: [
3763
+ ...this._queryTree,
3764
+ {
3765
+ operation: "withListOf",
3766
+ args: { elementType },
3767
+ },
3768
+ ],
3769
+ host: this.clientHost,
3770
+ sessionToken: this.sessionToken,
3771
+ });
3772
+ }
3773
+ /**
3774
+ * Returns a TypeDef of kind Object with the provided name.
3775
+ *
3776
+ * Note that an object's fields and functions may be omitted if the intent is
3777
+ * only to refer to an object. This is how functions are able to return their
3778
+ * own object, or any other circular reference.
3779
+ */
3780
+ withObject(name, opts) {
3781
+ return new TypeDef({
3782
+ queryTree: [
3783
+ ...this._queryTree,
3784
+ {
3785
+ operation: "withObject",
3786
+ args: Object.assign({ name }, opts),
3787
+ },
3788
+ ],
3789
+ host: this.clientHost,
3790
+ sessionToken: this.sessionToken,
3791
+ });
3792
+ }
3793
+ /**
3794
+ * Sets whether this type can be set to null.
3795
+ */
3796
+ withOptional(optional) {
3797
+ return new TypeDef({
3798
+ queryTree: [
3799
+ ...this._queryTree,
3800
+ {
3801
+ operation: "withOptional",
3802
+ args: { optional },
3803
+ },
3804
+ ],
3805
+ host: this.clientHost,
3806
+ sessionToken: this.sessionToken,
3807
+ });
3808
+ }
3809
+ /**
3810
+ * Call the provided function with current TypeDef.
3811
+ *
3812
+ * This is useful for reusability and readability by not breaking the calling chain.
3813
+ */
3814
+ with(arg) {
3815
+ return arg(this);
3816
+ }
3817
+ }