@dagger.io/dagger 0.8.7 → 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.
@@ -365,6 +365,28 @@ export type ContainerID = string & {
365
365
  export type DateTime = string & {
366
366
  __DateTime: never;
367
367
  };
368
+ export type DirectoryAsModuleOpts = {
369
+ /**
370
+ * An optional subpath of the directory which contains the module's source
371
+ * code.
372
+ *
373
+ * This is needed when the module code is in a subdirectory but requires
374
+ * parent directories to be loaded in order to execute. For example, the
375
+ * module source code may need a go.mod, project.toml, package.json, etc. file
376
+ * from a parent directory.
377
+ *
378
+ * If not set, the module source code is loaded from the root of the
379
+ * directory.
380
+ */
381
+ sourceSubpath?: string;
382
+ /**
383
+ * A pre-built runtime container to use instead of building one from the
384
+ * source code. This is useful for bootstrapping.
385
+ *
386
+ * You should ignore this unless you're building a Dagger SDK.
387
+ */
388
+ runtime?: Container;
389
+ };
368
390
  export type DirectoryDockerBuildOpts = {
369
391
  /**
370
392
  * Path to the Dockerfile to use (e.g., "frontend.Dockerfile").
@@ -460,6 +482,41 @@ export type FileExportOpts = {
460
482
  export type FileID = string & {
461
483
  __FileID: never;
462
484
  };
485
+ export type FunctionCallOpts = {
486
+ input?: FunctionCallInput[];
487
+ };
488
+ export type FunctionWithArgOpts = {
489
+ /**
490
+ * A doc string for the argument, if any
491
+ */
492
+ description?: string;
493
+ /**
494
+ * A default value to use for this argument if not explicitly set by the caller, if any
495
+ */
496
+ defaultValue?: JSON;
497
+ };
498
+ export type FunctionCallInput = {
499
+ /**
500
+ * The name of the argument to the function
501
+ */
502
+ name: string;
503
+ /**
504
+ * The value of the argument represented as a string of the JSON serialization.
505
+ */
506
+ value: JSON;
507
+ };
508
+ /**
509
+ * A reference to a Function.
510
+ */
511
+ export type FunctionID = string & {
512
+ __FunctionID: never;
513
+ };
514
+ /**
515
+ * A reference to GeneratedCode.
516
+ */
517
+ export type GeneratedCodeID = string & {
518
+ __GeneratedCodeID: never;
519
+ };
463
520
  export type GitRefTreeOpts = {
464
521
  sshKnownHosts?: string;
465
522
  sshAuthSocket?: Socket;
@@ -496,6 +553,25 @@ export declare enum ImageMediaTypes {
496
553
  Dockermediatypes = "DockerMediaTypes",
497
554
  Ocimediatypes = "OCIMediaTypes"
498
555
  }
556
+ /**
557
+ * An arbitrary JSON-encoded value.
558
+ */
559
+ export type JSON = string & {
560
+ __JSON: never;
561
+ };
562
+ export type ModuleServeOpts = {
563
+ environment?: ModuleEnvironmentVariable[];
564
+ };
565
+ export type ModuleEnvironmentVariable = {
566
+ name: string;
567
+ value?: string;
568
+ };
569
+ /**
570
+ * A reference to a Module.
571
+ */
572
+ export type ModuleID = string & {
573
+ __ModuleID: never;
574
+ };
499
575
  /**
500
576
  * Transport layer network protocol associated to a port.
501
577
  */
@@ -527,18 +603,6 @@ export type PipelineLabel = {
527
603
  export type Platform = string & {
528
604
  __Platform: never;
529
605
  };
530
- /**
531
- * A unique project command identifier.
532
- */
533
- export type ProjectCommandID = string & {
534
- __ProjectCommandID: never;
535
- };
536
- /**
537
- * A unique project identifier.
538
- */
539
- export type ProjectID = string & {
540
- __ProjectID: never;
541
- };
542
606
  export type ClientContainerOpts = {
543
607
  id?: ContainerID;
544
608
  platform?: Platform;
@@ -546,6 +610,9 @@ export type ClientContainerOpts = {
546
610
  export type ClientDirectoryOpts = {
547
611
  id?: DirectoryID;
548
612
  };
613
+ export type ClientGeneratedCodeOpts = {
614
+ id?: GeneratedCodeID;
615
+ };
549
616
  export type ClientGitOpts = {
550
617
  /**
551
618
  * Set to true to keep .git directory.
@@ -562,6 +629,9 @@ export type ClientHttpOpts = {
562
629
  */
563
630
  experimentalServiceHost?: Container;
564
631
  };
632
+ export type ClientModuleOpts = {
633
+ id?: ModuleID;
634
+ };
565
635
  export type ClientPipelineOpts = {
566
636
  /**
567
637
  * Pipeline description.
@@ -572,15 +642,12 @@ export type ClientPipelineOpts = {
572
642
  */
573
643
  labels?: PipelineLabel[];
574
644
  };
575
- export type ClientProjectOpts = {
576
- id?: ProjectID;
577
- };
578
- export type ClientProjectCommandOpts = {
579
- id?: ProjectCommandID;
580
- };
581
645
  export type ClientSocketOpts = {
582
646
  id?: SocketID;
583
647
  };
648
+ export type ClientTypeDefOpts = {
649
+ id?: TypeDefID;
650
+ };
584
651
  /**
585
652
  * A unique identifier for a secret.
586
653
  */
@@ -593,6 +660,66 @@ export type SecretID = string & {
593
660
  export type SocketID = string & {
594
661
  __SocketID: never;
595
662
  };
663
+ export type TypeDefWithFieldOpts = {
664
+ /**
665
+ * A doc string for the field, if any
666
+ */
667
+ description?: string;
668
+ };
669
+ export type TypeDefWithObjectOpts = {
670
+ description?: string;
671
+ };
672
+ /**
673
+ * A reference to a TypeDef.
674
+ */
675
+ export type TypeDefID = string & {
676
+ __TypeDefID: never;
677
+ };
678
+ /**
679
+ * Distinguishes the different kinds of TypeDefs.
680
+ */
681
+ export declare enum TypeDefKind {
682
+ /**
683
+ * A boolean value
684
+ */
685
+ Booleankind = "BooleanKind",
686
+ /**
687
+ * An integer value
688
+ */
689
+ Integerkind = "IntegerKind",
690
+ /**
691
+ * A list of values all having the same type.
692
+ *
693
+ * Always paired with a ListTypeDef.
694
+ */
695
+ Listkind = "ListKind",
696
+ /**
697
+ * A named type defined in the GraphQL schema, with fields and functions.
698
+ *
699
+ * Always paired with an ObjectTypeDef.
700
+ */
701
+ Objectkind = "ObjectKind",
702
+ /**
703
+ * A string value
704
+ */
705
+ Stringkind = "StringKind",
706
+ /**
707
+ * A special kind used to signify that no value is returned.
708
+ *
709
+ * This is used for functions that have no return value. The outer TypeDef
710
+ * specifying this Kind is always Optional, as the Void is never actually
711
+ * represented.
712
+ */
713
+ Voidkind = "VoidKind"
714
+ }
715
+ /**
716
+ * The absense of a value.
717
+ *
718
+ * A Null Void is used as a placeholder for resolvers that do not return anything.
719
+ */
720
+ export type Void = string & {
721
+ __Void: never;
722
+ };
596
723
  export type __TypeEnumValuesOpts = {
597
724
  includeDeprecated?: boolean;
598
725
  };
@@ -618,15 +745,16 @@ export declare class CacheVolume extends BaseClient {
618
745
  * An OCI-compatible container, also known as a docker container.
619
746
  */
620
747
  export declare class Container extends BaseClient {
748
+ private readonly _id?;
621
749
  private readonly _endpoint?;
622
750
  private readonly _envVariable?;
623
751
  private readonly _export?;
624
752
  private readonly _hostname?;
625
- private readonly _id?;
626
753
  private readonly _imageRef?;
627
754
  private readonly _label?;
628
755
  private readonly _platform?;
629
756
  private readonly _publish?;
757
+ private readonly _shellEndpoint?;
630
758
  private readonly _stderr?;
631
759
  private readonly _stdout?;
632
760
  private readonly _sync?;
@@ -639,7 +767,11 @@ export declare class Container extends BaseClient {
639
767
  queryTree?: QueryTree[];
640
768
  host?: string;
641
769
  sessionToken?: string;
642
- }, _endpoint?: string, _envVariable?: string, _export?: boolean, _hostname?: string, _id?: ContainerID, _imageRef?: string, _label?: string, _platform?: Platform, _publish?: string, _stderr?: string, _stdout?: string, _sync?: ContainerID, _user?: string, _workdir?: string);
770
+ }, _id?: ContainerID, _endpoint?: string, _envVariable?: string, _export?: boolean, _hostname?: string, _imageRef?: string, _label?: string, _platform?: Platform, _publish?: string, _shellEndpoint?: string, _stderr?: string, _stdout?: string, _sync?: ContainerID, _user?: string, _workdir?: string);
771
+ /**
772
+ * A unique identifier for this container.
773
+ */
774
+ id(): Promise<ContainerID>;
643
775
  /**
644
776
  * Initializes this container from a Dockerfile build.
645
777
  * @param context Directory context used by the Dockerfile.
@@ -741,10 +873,6 @@ export declare class Container extends BaseClient {
741
873
  * Currently experimental; set _EXPERIMENTAL_DAGGER_SERVICES_DNS=0 to disable.
742
874
  */
743
875
  hostname(): Promise<string>;
744
- /**
745
- * A unique identifier for this container.
746
- */
747
- id(): Promise<ContainerID>;
748
876
  /**
749
877
  * The unique image reference which can only be retrieved immediately after the 'Container.From' call.
750
878
  */
@@ -758,7 +886,7 @@ export declare class Container extends BaseClient {
758
886
  * @param opts.tag Identifies the tag to import from the archive, if the archive bundles
759
887
  * multiple tags.
760
888
  */
761
- import(source: File, opts?: ContainerImportOpts): Container;
889
+ import_(source: File, opts?: ContainerImportOpts): Container;
762
890
  /**
763
891
  * Retrieves the value of the specified label.
764
892
  */
@@ -806,6 +934,13 @@ export declare class Container extends BaseClient {
806
934
  * Retrieves this container's root filesystem. Mounts are not included.
807
935
  */
808
936
  rootfs(): Directory;
937
+ /**
938
+ * Return a websocket endpoint that, if connected to, will start the container with a TTY streamed
939
+ * over the websocket.
940
+ *
941
+ * Primarily intended for internal use with the dagger CLI.
942
+ */
943
+ shellEndpoint(): Promise<string>;
809
944
  /**
810
945
  * The error stream of the last executed command.
811
946
  *
@@ -1099,8 +1234,8 @@ export declare class Container extends BaseClient {
1099
1234
  * A directory.
1100
1235
  */
1101
1236
  export declare class Directory extends BaseClient {
1102
- private readonly _export?;
1103
1237
  private readonly _id?;
1238
+ private readonly _export?;
1104
1239
  private readonly _sync?;
1105
1240
  /**
1106
1241
  * Constructor is used for internal usage only, do not create object from it.
@@ -1109,7 +1244,29 @@ export declare class Directory extends BaseClient {
1109
1244
  queryTree?: QueryTree[];
1110
1245
  host?: string;
1111
1246
  sessionToken?: string;
1112
- }, _export?: boolean, _id?: DirectoryID, _sync?: DirectoryID);
1247
+ }, _id?: DirectoryID, _export?: boolean, _sync?: DirectoryID);
1248
+ /**
1249
+ * The content-addressed identifier of the directory.
1250
+ */
1251
+ id(): Promise<DirectoryID>;
1252
+ /**
1253
+ * Load the directory as a Dagger module
1254
+ * @param opts.sourceSubpath An optional subpath of the directory which contains the module's source
1255
+ * code.
1256
+ *
1257
+ * This is needed when the module code is in a subdirectory but requires
1258
+ * parent directories to be loaded in order to execute. For example, the
1259
+ * module source code may need a go.mod, project.toml, package.json, etc. file
1260
+ * from a parent directory.
1261
+ *
1262
+ * If not set, the module source code is loaded from the root of the
1263
+ * directory.
1264
+ * @param opts.runtime A pre-built runtime container to use instead of building one from the
1265
+ * source code. This is useful for bootstrapping.
1266
+ *
1267
+ * You should ignore this unless you're building a Dagger SDK.
1268
+ */
1269
+ asModule(opts?: DirectoryAsModuleOpts): Module_;
1113
1270
  /**
1114
1271
  * Gets the difference between this directory and an another directory.
1115
1272
  * @param other Identifier of the directory to compare.
@@ -1148,10 +1305,6 @@ export declare class Directory extends BaseClient {
1148
1305
  * @param path Location of the file to retrieve (e.g., "README.md").
1149
1306
  */
1150
1307
  file(path: string): File;
1151
- /**
1152
- * The content-addressed identifier of the directory.
1153
- */
1154
- id(): Promise<DirectoryID>;
1155
1308
  /**
1156
1309
  * Creates a named sub-pipeline
1157
1310
  * @param name Pipeline name.
@@ -1244,13 +1397,42 @@ export declare class EnvVariable extends BaseClient {
1244
1397
  */
1245
1398
  value(): Promise<string>;
1246
1399
  }
1400
+ /**
1401
+ * A definition of a field on a custom object defined in a Module.
1402
+ * A field on an object has a static value, as opposed to a function on an
1403
+ * object whose value is computed by invoking code (and can accept arguments).
1404
+ */
1405
+ export declare class FieldTypeDef extends BaseClient {
1406
+ private readonly _description?;
1407
+ private readonly _name?;
1408
+ /**
1409
+ * Constructor is used for internal usage only, do not create object from it.
1410
+ */
1411
+ constructor(parent?: {
1412
+ queryTree?: QueryTree[];
1413
+ host?: string;
1414
+ sessionToken?: string;
1415
+ }, _description?: string, _name?: string);
1416
+ /**
1417
+ * A doc string for the field, if any
1418
+ */
1419
+ description(): Promise<string>;
1420
+ /**
1421
+ * The name of the field in the object
1422
+ */
1423
+ name(): Promise<string>;
1424
+ /**
1425
+ * The type of the field
1426
+ */
1427
+ typeDef(): TypeDef;
1428
+ }
1247
1429
  /**
1248
1430
  * A file.
1249
1431
  */
1250
1432
  export declare class File extends BaseClient {
1433
+ private readonly _id?;
1251
1434
  private readonly _contents?;
1252
1435
  private readonly _export?;
1253
- private readonly _id?;
1254
1436
  private readonly _size?;
1255
1437
  private readonly _sync?;
1256
1438
  /**
@@ -1260,7 +1442,11 @@ export declare class File extends BaseClient {
1260
1442
  queryTree?: QueryTree[];
1261
1443
  host?: string;
1262
1444
  sessionToken?: string;
1263
- }, _contents?: string, _export?: boolean, _id?: FileID, _size?: number, _sync?: FileID);
1445
+ }, _id?: FileID, _contents?: string, _export?: boolean, _size?: number, _sync?: FileID);
1446
+ /**
1447
+ * Retrieves the content-addressed identifier of the file.
1448
+ */
1449
+ id(): Promise<FileID>;
1264
1450
  /**
1265
1451
  * Retrieves the contents of the file.
1266
1452
  */
@@ -1272,10 +1458,6 @@ export declare class File extends BaseClient {
1272
1458
  * the file will be created in that directory.
1273
1459
  */
1274
1460
  export(path: string, opts?: FileExportOpts): Promise<boolean>;
1275
- /**
1276
- * Retrieves the content-addressed identifier of the file.
1277
- */
1278
- id(): Promise<FileID>;
1279
1461
  /**
1280
1462
  * Gets the size of the file, in bytes.
1281
1463
  */
@@ -1298,6 +1480,208 @@ export declare class File extends BaseClient {
1298
1480
  */
1299
1481
  with(arg: (param: File) => File): File;
1300
1482
  }
1483
+ /**
1484
+ * Function represents a resolver provided by a Module.
1485
+ *
1486
+ * A function always evaluates against a parent object and is given a set of
1487
+ * named arguments.
1488
+ */
1489
+ export declare class Function_ extends BaseClient {
1490
+ private readonly _id?;
1491
+ private readonly _call?;
1492
+ private readonly _description?;
1493
+ private readonly _name?;
1494
+ /**
1495
+ * Constructor is used for internal usage only, do not create object from it.
1496
+ */
1497
+ constructor(parent?: {
1498
+ queryTree?: QueryTree[];
1499
+ host?: string;
1500
+ sessionToken?: string;
1501
+ }, _id?: FunctionID, _call?: JSON, _description?: string, _name?: string);
1502
+ /**
1503
+ * The ID of the function
1504
+ */
1505
+ id(): Promise<FunctionID>;
1506
+ /**
1507
+ * Arguments accepted by this function, if any
1508
+ */
1509
+ args(): Promise<FunctionArg[]>;
1510
+ /**
1511
+ * Execute this function using dynamic input+output types.
1512
+ *
1513
+ * Typically, it's preferable to invoke a function using a type
1514
+ * safe graphql query rather than using this call field. However,
1515
+ * call is useful for some advanced use cases where dynamically
1516
+ * loading arbitrary modules and invoking functions in them is
1517
+ * required.
1518
+ */
1519
+ call(opts?: FunctionCallOpts): Promise<JSON>;
1520
+ /**
1521
+ * A doc string for the function, if any
1522
+ */
1523
+ description(): Promise<string>;
1524
+ /**
1525
+ * The name of the function
1526
+ */
1527
+ name(): Promise<string>;
1528
+ /**
1529
+ * The type returned by this function
1530
+ */
1531
+ returnType(): TypeDef;
1532
+ /**
1533
+ * Returns the function with the provided argument
1534
+ * @param name The name of the argument
1535
+ * @param typeDef The type of the argument
1536
+ * @param opts.description A doc string for the argument, if any
1537
+ * @param opts.defaultValue A default value to use for this argument if not explicitly set by the caller, if any
1538
+ */
1539
+ withArg(name: string, typeDef: TypeDef, opts?: FunctionWithArgOpts): Function_;
1540
+ /**
1541
+ * Returns the function with the doc string
1542
+ */
1543
+ withDescription(description: string): Function_;
1544
+ /**
1545
+ * Call the provided function with current Function.
1546
+ *
1547
+ * This is useful for reusability and readability by not breaking the calling chain.
1548
+ */
1549
+ with(arg: (param: Function_) => Function_): Function_;
1550
+ }
1551
+ /**
1552
+ * An argument accepted by a function.
1553
+ *
1554
+ * This is a specification for an argument at function definition time, not an
1555
+ * argument passed at function call time.
1556
+ */
1557
+ export declare class FunctionArg extends BaseClient {
1558
+ private readonly _defaultValue?;
1559
+ private readonly _description?;
1560
+ private readonly _name?;
1561
+ /**
1562
+ * Constructor is used for internal usage only, do not create object from it.
1563
+ */
1564
+ constructor(parent?: {
1565
+ queryTree?: QueryTree[];
1566
+ host?: string;
1567
+ sessionToken?: string;
1568
+ }, _defaultValue?: JSON, _description?: string, _name?: string);
1569
+ /**
1570
+ * A default value to use for this argument when not explicitly set by the caller, if any
1571
+ */
1572
+ defaultValue(): Promise<JSON>;
1573
+ /**
1574
+ * A doc string for the argument, if any
1575
+ */
1576
+ description(): Promise<string>;
1577
+ /**
1578
+ * The name of the argument
1579
+ */
1580
+ name(): Promise<string>;
1581
+ /**
1582
+ * The type of the argument
1583
+ */
1584
+ typeDef(): TypeDef;
1585
+ }
1586
+ export declare class FunctionCall extends BaseClient {
1587
+ private readonly _name?;
1588
+ private readonly _parent?;
1589
+ private readonly _parentName?;
1590
+ private readonly _returnValue?;
1591
+ /**
1592
+ * Constructor is used for internal usage only, do not create object from it.
1593
+ */
1594
+ constructor(parent?: {
1595
+ queryTree?: QueryTree[];
1596
+ host?: string;
1597
+ sessionToken?: string;
1598
+ }, _name?: string, _parent?: JSON, _parentName?: string, _returnValue?: Void);
1599
+ /**
1600
+ * The argument values the function is being invoked with.
1601
+ */
1602
+ inputArgs(): Promise<FunctionCallArgValue[]>;
1603
+ /**
1604
+ * The name of the function being called.
1605
+ */
1606
+ name(): Promise<string>;
1607
+ /**
1608
+ * The value of the parent object of the function being called.
1609
+ * If the function is "top-level" to the module, this is always an empty object.
1610
+ */
1611
+ parent(): Promise<JSON>;
1612
+ /**
1613
+ * The name of the parent object of the function being called.
1614
+ * If the function is "top-level" to the module, this is the name of the module.
1615
+ */
1616
+ parentName(): Promise<string>;
1617
+ /**
1618
+ * Set the return value of the function call to the provided value.
1619
+ * The value should be a string of the JSON serialization of the return value.
1620
+ */
1621
+ returnValue(value: JSON): Promise<Void>;
1622
+ }
1623
+ export declare class FunctionCallArgValue extends BaseClient {
1624
+ private readonly _name?;
1625
+ private readonly _value?;
1626
+ /**
1627
+ * Constructor is used for internal usage only, do not create object from it.
1628
+ */
1629
+ constructor(parent?: {
1630
+ queryTree?: QueryTree[];
1631
+ host?: string;
1632
+ sessionToken?: string;
1633
+ }, _name?: string, _value?: JSON);
1634
+ /**
1635
+ * The name of the argument.
1636
+ */
1637
+ name(): Promise<string>;
1638
+ /**
1639
+ * The value of the argument represented as a string of the JSON serialization.
1640
+ */
1641
+ value(): Promise<JSON>;
1642
+ }
1643
+ export declare class GeneratedCode extends BaseClient {
1644
+ private readonly _id?;
1645
+ /**
1646
+ * Constructor is used for internal usage only, do not create object from it.
1647
+ */
1648
+ constructor(parent?: {
1649
+ queryTree?: QueryTree[];
1650
+ host?: string;
1651
+ sessionToken?: string;
1652
+ }, _id?: GeneratedCodeID);
1653
+ id(): Promise<GeneratedCodeID>;
1654
+ /**
1655
+ * The directory containing the generated code
1656
+ */
1657
+ code(): Directory;
1658
+ /**
1659
+ * List of paths to mark generated in version control (i.e. .gitattributes)
1660
+ */
1661
+ vcsGeneratedPaths(): Promise<string[]>;
1662
+ /**
1663
+ * List of paths to ignore in version control (i.e. .gitignore)
1664
+ */
1665
+ vcsIgnoredPaths(): Promise<string[]>;
1666
+ /**
1667
+ * Set the directory containing the generated code
1668
+ */
1669
+ withCode(code: Directory): GeneratedCode;
1670
+ /**
1671
+ * Set the list of paths to mark generated in version control
1672
+ */
1673
+ withVCSGeneratedPaths(paths: string[]): GeneratedCode;
1674
+ /**
1675
+ * Set the list of paths to ignore in version control
1676
+ */
1677
+ withVCSIgnoredPaths(paths: string[]): GeneratedCode;
1678
+ /**
1679
+ * Call the provided function with current GeneratedCode.
1680
+ *
1681
+ * This is useful for reusability and readability by not breaking the calling chain.
1682
+ */
1683
+ with(arg: (param: GeneratedCode) => GeneratedCode): GeneratedCode;
1684
+ }
1301
1685
  /**
1302
1686
  * A git ref (tag, branch or commit).
1303
1687
  */
@@ -1404,12 +1788,9 @@ export declare class Label extends BaseClient {
1404
1788
  value(): Promise<string>;
1405
1789
  }
1406
1790
  /**
1407
- * A port exposed by a container.
1791
+ * A definition of a list type in a Module.
1408
1792
  */
1409
- export declare class Port extends BaseClient {
1410
- private readonly _description?;
1411
- private readonly _port?;
1412
- private readonly _protocol?;
1793
+ export declare class ListTypeDef extends BaseClient {
1413
1794
  /**
1414
1795
  * Constructor is used for internal usage only, do not create object from it.
1415
1796
  */
@@ -1417,26 +1798,20 @@ export declare class Port extends BaseClient {
1417
1798
  queryTree?: QueryTree[];
1418
1799
  host?: string;
1419
1800
  sessionToken?: string;
1420
- }, _description?: string, _port?: number, _protocol?: NetworkProtocol);
1421
- /**
1422
- * The port description.
1423
- */
1424
- description(): Promise<string>;
1801
+ });
1425
1802
  /**
1426
- * The port number.
1803
+ * The type of the elements in the list
1427
1804
  */
1428
- port(): Promise<number>;
1429
- /**
1430
- * The transport layer network protocol.
1431
- */
1432
- protocol(): Promise<NetworkProtocol>;
1805
+ elementTypeDef(): TypeDef;
1433
1806
  }
1434
- /**
1435
- * A collection of Dagger resources that can be queried and invoked.
1436
- */
1437
- export declare class Project extends BaseClient {
1807
+ export declare class Module_ extends BaseClient {
1438
1808
  private readonly _id?;
1809
+ private readonly _description?;
1439
1810
  private readonly _name?;
1811
+ private readonly _sdk?;
1812
+ private readonly _sdkRuntime?;
1813
+ private readonly _serve?;
1814
+ private readonly _sourceDirectorySubPath?;
1440
1815
  /**
1441
1816
  * Constructor is used for internal usage only, do not create object from it.
1442
1817
  */
@@ -1444,38 +1819,74 @@ export declare class Project extends BaseClient {
1444
1819
  queryTree?: QueryTree[];
1445
1820
  host?: string;
1446
1821
  sessionToken?: string;
1447
- }, _id?: ProjectID, _name?: string);
1822
+ }, _id?: ModuleID, _description?: string, _name?: string, _sdk?: string, _sdkRuntime?: string, _serve?: Void, _sourceDirectorySubPath?: string);
1448
1823
  /**
1449
- * Commands provided by this project
1824
+ * The ID of the module
1450
1825
  */
1451
- commands(): Promise<ProjectCommand[]>;
1826
+ id(): Promise<ModuleID>;
1452
1827
  /**
1453
- * A unique identifier for this project.
1828
+ * Modules used by this module
1454
1829
  */
1455
- id(): Promise<ProjectID>;
1830
+ dependencies(): Promise<Module_[]>;
1456
1831
  /**
1457
- * Initialize this project from the given directory and config path
1832
+ * The dependencies as configured by the module
1458
1833
  */
1459
- load(source: Directory, configPath: string): Project;
1834
+ dependencyConfig(): Promise<string[]>;
1460
1835
  /**
1461
- * Name of the project
1836
+ * The doc string of the module, if any
1837
+ */
1838
+ description(): Promise<string>;
1839
+ /**
1840
+ * The code generated by the SDK's runtime
1841
+ */
1842
+ generatedCode(): GeneratedCode;
1843
+ /**
1844
+ * The name of the module
1462
1845
  */
1463
1846
  name(): Promise<string>;
1464
1847
  /**
1465
- * Call the provided function with current Project.
1848
+ * Objects served by this module
1849
+ */
1850
+ objects(): Promise<TypeDef[]>;
1851
+ /**
1852
+ * The SDK used by this module
1853
+ */
1854
+ sdk(): Promise<string>;
1855
+ /**
1856
+ * The SDK runtime module image ref.
1857
+ */
1858
+ sdkRuntime(): Promise<string>;
1859
+ /**
1860
+ * Serve a module's API in the current session.
1861
+ * Note: this can only be called once per session.
1862
+ * In the future, it could return a stream or service to remove the side effect.
1863
+ */
1864
+ serve(opts?: ModuleServeOpts): Promise<Void>;
1865
+ /**
1866
+ * The directory containing the module's source code
1867
+ */
1868
+ sourceDirectory(): Directory;
1869
+ /**
1870
+ * The module's subpath within the source directory
1871
+ */
1872
+ sourceDirectorySubPath(): Promise<string>;
1873
+ /**
1874
+ * This module plus the given Object type and associated functions
1875
+ */
1876
+ withObject(object: TypeDef): Module_;
1877
+ /**
1878
+ * Call the provided function with current Module.
1466
1879
  *
1467
1880
  * This is useful for reusability and readability by not breaking the calling chain.
1468
1881
  */
1469
- with(arg: (param: Project) => Project): Project;
1882
+ with(arg: (param: Module_) => Module_): Module_;
1470
1883
  }
1471
1884
  /**
1472
- * A command defined in a project that can be invoked from the CLI.
1885
+ * A definition of a custom object defined in a Module.
1473
1886
  */
1474
- export declare class ProjectCommand extends BaseClient {
1887
+ export declare class ObjectTypeDef extends BaseClient {
1475
1888
  private readonly _description?;
1476
- private readonly _id?;
1477
1889
  private readonly _name?;
1478
- private readonly _resultType?;
1479
1890
  /**
1480
1891
  * Constructor is used for internal usage only, do not create object from it.
1481
1892
  */
@@ -1483,38 +1894,31 @@ export declare class ProjectCommand extends BaseClient {
1483
1894
  queryTree?: QueryTree[];
1484
1895
  host?: string;
1485
1896
  sessionToken?: string;
1486
- }, _description?: string, _id?: ProjectCommandID, _name?: string, _resultType?: string);
1897
+ }, _description?: string, _name?: string);
1487
1898
  /**
1488
- * Documentation for what this command does.
1899
+ * The doc string for the object, if any
1489
1900
  */
1490
1901
  description(): Promise<string>;
1491
1902
  /**
1492
- * Flags accepted by this command.
1903
+ * Static fields defined on this object, if any
1493
1904
  */
1494
- flags(): Promise<ProjectCommandFlag[]>;
1905
+ fields(): Promise<FieldTypeDef[]>;
1495
1906
  /**
1496
- * A unique identifier for this command.
1907
+ * Functions defined on this object, if any
1497
1908
  */
1498
- id(): Promise<ProjectCommandID>;
1909
+ functions(): Promise<Function_[]>;
1499
1910
  /**
1500
- * The name of the command.
1911
+ * The name of the object
1501
1912
  */
1502
1913
  name(): Promise<string>;
1503
- /**
1504
- * The name of the type returned by this command.
1505
- */
1506
- resultType(): Promise<string>;
1507
- /**
1508
- * Subcommands, if any, that this command provides.
1509
- */
1510
- subcommands(): Promise<ProjectCommand[]>;
1511
1914
  }
1512
1915
  /**
1513
- * A flag accepted by a project command.
1916
+ * A port exposed by a container.
1514
1917
  */
1515
- export declare class ProjectCommandFlag extends BaseClient {
1918
+ export declare class Port extends BaseClient {
1516
1919
  private readonly _description?;
1517
- private readonly _name?;
1920
+ private readonly _port?;
1921
+ private readonly _protocol?;
1518
1922
  /**
1519
1923
  * Constructor is used for internal usage only, do not create object from it.
1520
1924
  */
@@ -1522,15 +1926,19 @@ export declare class ProjectCommandFlag extends BaseClient {
1522
1926
  queryTree?: QueryTree[];
1523
1927
  host?: string;
1524
1928
  sessionToken?: string;
1525
- }, _description?: string, _name?: string);
1929
+ }, _description?: string, _port?: number, _protocol?: NetworkProtocol);
1526
1930
  /**
1527
- * Documentation for what this flag sets.
1931
+ * The port description.
1528
1932
  */
1529
1933
  description(): Promise<string>;
1530
1934
  /**
1531
- * The name of the flag.
1935
+ * The port number.
1532
1936
  */
1533
- name(): Promise<string>;
1937
+ port(): Promise<number>;
1938
+ /**
1939
+ * The transport layer network protocol.
1940
+ */
1941
+ protocol(): Promise<NetworkProtocol>;
1534
1942
  }
1535
1943
  export declare class Client extends BaseClient {
1536
1944
  private readonly _checkVersionCompatibility?;
@@ -1561,6 +1969,16 @@ export declare class Client extends BaseClient {
1561
1969
  * Platform defaults to that of the builder's host.
1562
1970
  */
1563
1971
  container(opts?: ClientContainerOpts): Container;
1972
+ /**
1973
+ * The FunctionCall context that the SDK caller is currently executing in.
1974
+ * If the caller is not currently executing in a function, this will return
1975
+ * an error.
1976
+ */
1977
+ currentFunctionCall(): FunctionCall;
1978
+ /**
1979
+ * The module currently being served in the session, if any.
1980
+ */
1981
+ currentModule(): Module_;
1564
1982
  /**
1565
1983
  * The default platform of the builder.
1566
1984
  */
@@ -1573,6 +1991,14 @@ export declare class Client extends BaseClient {
1573
1991
  * Loads a file by ID.
1574
1992
  */
1575
1993
  file(id: FileID): File;
1994
+ /**
1995
+ * Load a function by ID
1996
+ */
1997
+ function_(id: FunctionID): Function_;
1998
+ /**
1999
+ * Load GeneratedCode by ID, or create a new one if id is unset.
2000
+ */
2001
+ generatedCode(opts?: ClientGeneratedCodeOpts): GeneratedCode;
1576
2002
  /**
1577
2003
  * Queries a git repository.
1578
2004
  * @param url Url of the git repository.
@@ -1592,6 +2018,14 @@ export declare class Client extends BaseClient {
1592
2018
  * @param opts.experimentalServiceHost A service which must be started before the URL is fetched.
1593
2019
  */
1594
2020
  http(url: string, opts?: ClientHttpOpts): File;
2021
+ /**
2022
+ * Load a module by ID, or create a new one if id is unset.
2023
+ */
2024
+ module_(opts?: ClientModuleOpts): Module_;
2025
+ /**
2026
+ * Create a new function from the provided definition.
2027
+ */
2028
+ newFunction(name: string, returnType: TypeDef): Function_;
1595
2029
  /**
1596
2030
  * Creates a named sub-pipeline.
1597
2031
  * @param name Pipeline name.
@@ -1599,14 +2033,6 @@ export declare class Client extends BaseClient {
1599
2033
  * @param opts.labels Pipeline labels.
1600
2034
  */
1601
2035
  pipeline(name: string, opts?: ClientPipelineOpts): Client;
1602
- /**
1603
- * Load a project from ID.
1604
- */
1605
- project(opts?: ClientProjectOpts): Project;
1606
- /**
1607
- * Load a project command from ID.
1608
- */
1609
- projectCommand(opts?: ClientProjectCommandOpts): ProjectCommand;
1610
2036
  /**
1611
2037
  * Loads a secret from its ID.
1612
2038
  */
@@ -1622,6 +2048,7 @@ export declare class Client extends BaseClient {
1622
2048
  * Loads a socket by its ID.
1623
2049
  */
1624
2050
  socket(opts?: ClientSocketOpts): Socket;
2051
+ typeDef(opts?: ClientTypeDefOpts): TypeDef;
1625
2052
  /**
1626
2053
  * Call the provided function with current Client.
1627
2054
  *
@@ -1667,5 +2094,77 @@ export declare class Socket extends BaseClient {
1667
2094
  */
1668
2095
  id(): Promise<SocketID>;
1669
2096
  }
2097
+ /**
2098
+ * A definition of a parameter or return type in a Module.
2099
+ */
2100
+ export declare class TypeDef extends BaseClient {
2101
+ private readonly _id?;
2102
+ private readonly _kind?;
2103
+ private readonly _optional?;
2104
+ /**
2105
+ * Constructor is used for internal usage only, do not create object from it.
2106
+ */
2107
+ constructor(parent?: {
2108
+ queryTree?: QueryTree[];
2109
+ host?: string;
2110
+ sessionToken?: string;
2111
+ }, _id?: TypeDefID, _kind?: TypeDefKind, _optional?: boolean);
2112
+ id(): Promise<TypeDefID>;
2113
+ /**
2114
+ * If kind is LIST, the list-specific type definition.
2115
+ * If kind is not LIST, this will be null.
2116
+ */
2117
+ asList(): ListTypeDef;
2118
+ /**
2119
+ * If kind is OBJECT, the object-specific type definition.
2120
+ * If kind is not OBJECT, this will be null.
2121
+ */
2122
+ asObject(): ObjectTypeDef;
2123
+ /**
2124
+ * The kind of type this is (e.g. primitive, list, object)
2125
+ */
2126
+ kind(): Promise<TypeDefKind>;
2127
+ /**
2128
+ * Whether this type can be set to null. Defaults to false.
2129
+ */
2130
+ optional(): Promise<boolean>;
2131
+ /**
2132
+ * Adds a static field for an Object TypeDef, failing if the type is not an object.
2133
+ * @param name The name of the field in the object
2134
+ * @param typeDef The type of the field
2135
+ * @param opts.description A doc string for the field, if any
2136
+ */
2137
+ withField(name: string, typeDef: TypeDef, opts?: TypeDefWithFieldOpts): TypeDef;
2138
+ /**
2139
+ * Adds a function for an Object TypeDef, failing if the type is not an object.
2140
+ */
2141
+ withFunction(function_: Function_): TypeDef;
2142
+ /**
2143
+ * Sets the kind of the type.
2144
+ */
2145
+ withKind(kind: TypeDefKind): TypeDef;
2146
+ /**
2147
+ * Returns a TypeDef of kind List with the provided type for its elements.
2148
+ */
2149
+ withListOf(elementType: TypeDef): TypeDef;
2150
+ /**
2151
+ * Returns a TypeDef of kind Object with the provided name.
2152
+ *
2153
+ * Note that an object's fields and functions may be omitted if the intent is
2154
+ * only to refer to an object. This is how functions are able to return their
2155
+ * own object, or any other circular reference.
2156
+ */
2157
+ withObject(name: string, opts?: TypeDefWithObjectOpts): TypeDef;
2158
+ /**
2159
+ * Sets whether this type can be set to null.
2160
+ */
2161
+ withOptional(optional: boolean): TypeDef;
2162
+ /**
2163
+ * Call the provided function with current TypeDef.
2164
+ *
2165
+ * This is useful for reusability and readability by not breaking the calling chain.
2166
+ */
2167
+ with(arg: (param: TypeDef) => TypeDef): TypeDef;
2168
+ }
1670
2169
  export {};
1671
2170
  //# sourceMappingURL=client.gen.d.ts.map