cdktn 0.25.0.dev38__tar.gz → 0.25.0.dev39__tar.gz

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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cdktn
3
- Version: 0.25.0.dev38
3
+ Version: 0.25.0.dev39
4
4
  Summary: Cloud Development Kit for Terraform
5
5
  Home-page: https://github.com/open-constructs/cdk-terrain
6
6
  Author: OpenConstructs
@@ -5,7 +5,7 @@ kwargs = json.loads(
5
5
  """
6
6
  {
7
7
  "name": "cdktn",
8
- "version": "0.25.0.dev38",
8
+ "version": "0.25.0.dev39",
9
9
  "description": "Cloud Development Kit for Terraform",
10
10
  "license": "MPL-2.0",
11
11
  "url": "https://github.com/open-constructs/cdk-terrain",
@@ -27,7 +27,7 @@ kwargs = json.loads(
27
27
  ],
28
28
  "package_data": {
29
29
  "cdktn._jsii": [
30
- "cdktn@0.25.0-pre.38.jsii.tgz"
30
+ "cdktn@0.25.0-pre.39.jsii.tgz"
31
31
  ],
32
32
  "cdktn": [
33
33
  "py.typed"
@@ -790,6 +790,8 @@ class AssetPackaging(metaclass=jsii.JSIIMeta, jsii_type="cdktn.AssetPackaging"):
790
790
  "asset_hash_type": "assetHashType",
791
791
  "packaging": "packaging",
792
792
  "source_path": "sourcePath",
793
+ "bundler": "bundler",
794
+ "display_name": "displayName",
793
795
  "exclude": "exclude",
794
796
  "extra_hash": "extraHash",
795
797
  "ignore_strategy": "ignoreStrategy",
@@ -803,6 +805,8 @@ class AssetStagingOptions(AssetOptions):
803
805
  asset_hash_type: typing.Optional["AssetHashType"] = None,
804
806
  packaging: "IAssetPackaging",
805
807
  source_path: builtins.str,
808
+ bundler: typing.Optional["IAssetBundler"] = None,
809
+ display_name: typing.Optional[builtins.str] = None,
806
810
  exclude: typing.Optional[typing.Sequence[builtins.str]] = None,
807
811
  extra_hash: typing.Optional[builtins.str] = None,
808
812
  ignore_strategy: typing.Optional["IIgnoreStrategy"] = None,
@@ -813,6 +817,8 @@ class AssetStagingOptions(AssetOptions):
813
817
  :param asset_hash_type: (experimental) Specifies the type of hash to calculate for this asset. If ``assetHash`` is configured, this option must be ``undefined`` or ``AssetHashType.CUSTOM``. Default: - the default is ``AssetHashType.SOURCE``, but if ``assetHash`` is explicitly specified this value defaults to ``AssetHashType.CUSTOM``.
814
818
  :param packaging: (experimental) How the staged result is produced and shaped. The caller decides this (e.g. from its own ``AssetType``) — ``AssetStaging`` never infers or changes it based on ``exclude``/``extraHash``.
815
819
  :param source_path: (experimental) Absolute path to the source file or directory. Resolving a relative path against ``cdktf.json`` is the caller's responsibility.
820
+ :param bundler: (experimental) A bundler that builds the source into an artifact before staging. Under the default ``SOURCE`` hashing the build is deferred to ``stage()`` and stays skippable; ``OUTPUT`` hashing builds eagerly at construction time to hash the artifact, forgoing skippability. A bundler always produces a directory, so single-file packaging (``AssetType.FILE``) is rejected. Default: - the source is staged verbatim, with no build step
821
+ :param display_name: (experimental) Identifier used in error messages, so they name the user-facing construct (e.g. the ``TerraformAsset``) rather than this internal staging child. Default: - the staging construct's own id
816
822
  :param exclude: (experimental) Paths to exclude, relative to ``sourcePath``. Cannot be combined with ``ignoreStrategy``, which replaces this matcher rather than layering on top of it. Default: - nothing is excluded
817
823
  :param extra_hash: (experimental) Extra information to fold into the hash (e.g. build instructions and other inputs). Default: - no extra hash
818
824
  :param ignore_strategy: (experimental) Exclusion matching, for callers that need ``.gitignore`` / ``.dockerignore`` parity rather than the built-in exact-path / suffix / directory matcher. Default: - ``exclude`` is used with the built-in matcher
@@ -825,6 +831,8 @@ class AssetStagingOptions(AssetOptions):
825
831
  check_type(argname="argument asset_hash_type", value=asset_hash_type, expected_type=type_hints["asset_hash_type"])
826
832
  check_type(argname="argument packaging", value=packaging, expected_type=type_hints["packaging"])
827
833
  check_type(argname="argument source_path", value=source_path, expected_type=type_hints["source_path"])
834
+ check_type(argname="argument bundler", value=bundler, expected_type=type_hints["bundler"])
835
+ check_type(argname="argument display_name", value=display_name, expected_type=type_hints["display_name"])
828
836
  check_type(argname="argument exclude", value=exclude, expected_type=type_hints["exclude"])
829
837
  check_type(argname="argument extra_hash", value=extra_hash, expected_type=type_hints["extra_hash"])
830
838
  check_type(argname="argument ignore_strategy", value=ignore_strategy, expected_type=type_hints["ignore_strategy"])
@@ -836,6 +844,10 @@ class AssetStagingOptions(AssetOptions):
836
844
  self._values["asset_hash"] = asset_hash
837
845
  if asset_hash_type is not None:
838
846
  self._values["asset_hash_type"] = asset_hash_type
847
+ if bundler is not None:
848
+ self._values["bundler"] = bundler
849
+ if display_name is not None:
850
+ self._values["display_name"] = display_name
839
851
  if exclude is not None:
840
852
  self._values["exclude"] = exclude
841
853
  if extra_hash is not None:
@@ -909,6 +921,33 @@ class AssetStagingOptions(AssetOptions):
909
921
  assert result is not None, "Required property 'source_path' is missing"
910
922
  return typing.cast(builtins.str, result)
911
923
 
924
+ @builtins.property
925
+ def bundler(self) -> typing.Optional["IAssetBundler"]:
926
+ '''(experimental) A bundler that builds the source into an artifact before staging.
927
+
928
+ Under the default ``SOURCE`` hashing the build is deferred to ``stage()`` and
929
+ stays skippable; ``OUTPUT`` hashing builds eagerly at construction time to
930
+ hash the artifact, forgoing skippability. A bundler always produces a
931
+ directory, so single-file packaging (``AssetType.FILE``) is rejected.
932
+
933
+ :default: - the source is staged verbatim, with no build step
934
+
935
+ :stability: experimental
936
+ '''
937
+ result = self._values.get("bundler")
938
+ return typing.cast(typing.Optional["IAssetBundler"], result)
939
+
940
+ @builtins.property
941
+ def display_name(self) -> typing.Optional[builtins.str]:
942
+ '''(experimental) Identifier used in error messages, so they name the user-facing construct (e.g. the ``TerraformAsset``) rather than this internal staging child.
943
+
944
+ :default: - the staging construct's own id
945
+
946
+ :stability: experimental
947
+ '''
948
+ result = self._values.get("display_name")
949
+ return typing.cast(typing.Optional[builtins.str], result)
950
+
912
951
  @builtins.property
913
952
  def exclude(self) -> typing.Optional[typing.List[builtins.str]]:
914
953
  '''(experimental) Paths to exclude, relative to ``sourcePath``.
@@ -1455,6 +1494,146 @@ class AzurermBackendConfig:
1455
1494
  )
1456
1495
 
1457
1496
 
1497
+ @jsii.data_type(
1498
+ jsii_type="cdktn.BundleOptions",
1499
+ jsii_struct_bases=[],
1500
+ name_mapping={"output_dir": "outputDir", "source": "source"},
1501
+ )
1502
+ class BundleOptions:
1503
+ def __init__(self, *, output_dir: builtins.str, source: builtins.str) -> None:
1504
+ '''(experimental) Options handed to an {@link IAssetBundler} when it runs.
1505
+
1506
+ A struct rather than positional parameters: adding a field is additive,
1507
+ adding a method parameter is not, and ``bundle`` is called through JSII where
1508
+ that distinction is a breaking-change boundary.
1509
+
1510
+ :param output_dir: (experimental) A scratch directory the bundler may write into, owned and created by the caller. The bundler produces its output here (or in a subdirectory) and returns the directory that holds the finished artifact — see {@link IAssetBundler.bundle}.
1511
+ :param source: (experimental) Absolute path to the asset's source file or directory. The bundler reads from here and must not modify it. Exclusions (``exclude`` / ``ignoreStrategy``) are already applied: when any are configured this points at a filtered copy, not the original tree, so the bundler reads exactly the file set the asset hash was taken over.
1512
+
1513
+ :stability: experimental
1514
+ '''
1515
+ if __debug__:
1516
+ type_hints = cached_type_hints(_typecheckingstub__e4984c7b158b6fd9f304d19bf1be6b525991aa5c57db01aa1dd6d282c3369f9e)
1517
+ check_type(argname="argument output_dir", value=output_dir, expected_type=type_hints["output_dir"])
1518
+ check_type(argname="argument source", value=source, expected_type=type_hints["source"])
1519
+ self._values: typing.Dict[builtins.str, typing.Any] = {
1520
+ "output_dir": output_dir,
1521
+ "source": source,
1522
+ }
1523
+
1524
+ @builtins.property
1525
+ def output_dir(self) -> builtins.str:
1526
+ '''(experimental) A scratch directory the bundler may write into, owned and created by the caller.
1527
+
1528
+ The bundler produces its output here (or in a subdirectory) and
1529
+ returns the directory that holds the finished artifact — see
1530
+ {@link IAssetBundler.bundle}.
1531
+
1532
+ :stability: experimental
1533
+ '''
1534
+ result = self._values.get("output_dir")
1535
+ assert result is not None, "Required property 'output_dir' is missing"
1536
+ return typing.cast(builtins.str, result)
1537
+
1538
+ @builtins.property
1539
+ def source(self) -> builtins.str:
1540
+ '''(experimental) Absolute path to the asset's source file or directory. The bundler reads from here and must not modify it.
1541
+
1542
+ Exclusions (``exclude`` / ``ignoreStrategy``) are already applied: when any
1543
+ are configured this points at a filtered copy, not the original tree, so
1544
+ the bundler reads exactly the file set the asset hash was taken over.
1545
+
1546
+ :stability: experimental
1547
+ '''
1548
+ result = self._values.get("source")
1549
+ assert result is not None, "Required property 'source' is missing"
1550
+ return typing.cast(builtins.str, result)
1551
+
1552
+ def __eq__(self, rhs: typing.Any) -> builtins.bool:
1553
+ return isinstance(rhs, self.__class__) and rhs._values == self._values
1554
+
1555
+ def __ne__(self, rhs: typing.Any) -> builtins.bool:
1556
+ return not (rhs == self)
1557
+
1558
+ def __repr__(self) -> str:
1559
+ return "BundleOptions(%s)" % ", ".join(
1560
+ k + "=" + repr(v) for k, v in self._values.items()
1561
+ )
1562
+
1563
+
1564
+ class BundlerKey(metaclass=jsii.JSIIMeta, jsii_type="cdktn.BundlerKey"):
1565
+ '''(experimental) Builds an {@link IAssetBundler.bundlerKey} from an ordered set of parts.
1566
+
1567
+ A ``bundlerKey`` has to serialize everything that can move a build's output;
1568
+ done ad hoc, every bundler invents its own delimiter and forgets an input
1569
+ differently. This gives the convention one implementation: parts are joined
1570
+ with a separator that is escaped where it appears in a value, so distinct
1571
+ inputs can never collide into the same key (``["a:b", "c"]`` and
1572
+ ``["a", "b:c"]`` stay different).
1573
+
1574
+ :stability: experimental
1575
+
1576
+ Example::
1577
+
1578
+ const key = BundlerKey.of("docker", image, command)
1579
+ .withEnv({ NODE_ENV: nodeEnv })
1580
+ .toString();
1581
+ '''
1582
+
1583
+ @jsii.member(jsii_name="of")
1584
+ @builtins.classmethod
1585
+ def of(cls, *parts: builtins.str) -> "BundlerKey":
1586
+ '''(experimental) Start a key from an ordered list of parts.
1587
+
1588
+ Order is significant: it is part of what the key identifies.
1589
+
1590
+ :param parts: -
1591
+
1592
+ :stability: experimental
1593
+ '''
1594
+ if __debug__:
1595
+ type_hints = cached_type_hints(_typecheckingstub__76b2ba8d3e61fcbea83025fd36866ed49e2970a52cbe09f43be16a01cf5a6858)
1596
+ check_type(argname="argument parts", value=parts, expected_type=typing.Tuple[type_hints["parts"], ...]) # pyright: ignore [reportGeneralTypeIssues]
1597
+ return typing.cast("BundlerKey", jsii.sinvoke(cls, "of", [*parts]))
1598
+
1599
+ @jsii.member(jsii_name="add")
1600
+ def add(self, *parts: builtins.str) -> "BundlerKey":
1601
+ '''(experimental) Append parts, returning a new key.
1602
+
1603
+ :param parts: -
1604
+
1605
+ :stability: experimental
1606
+ '''
1607
+ if __debug__:
1608
+ type_hints = cached_type_hints(_typecheckingstub__5542e2e8a7f529585fff07dcaf5ca7a0425baa3a9af1286723c0b3fb21d976c6)
1609
+ check_type(argname="argument parts", value=parts, expected_type=typing.Tuple[type_hints["parts"], ...]) # pyright: ignore [reportGeneralTypeIssues]
1610
+ return typing.cast("BundlerKey", jsii.invoke(self, "add", [*parts]))
1611
+
1612
+ @jsii.member(jsii_name="toString")
1613
+ def to_string(self) -> builtins.str:
1614
+ '''(experimental) Render the collected parts to the string passed as ``bundlerKey``.
1615
+
1616
+ :stability: experimental
1617
+ '''
1618
+ return typing.cast(builtins.str, jsii.invoke(self, "toString", []))
1619
+
1620
+ @jsii.member(jsii_name="withEnv")
1621
+ def with_env(
1622
+ self,
1623
+ entries: typing.Mapping[builtins.str, builtins.str],
1624
+ ) -> "BundlerKey":
1625
+ '''(experimental) Append ``key=value`` parts for a record, sorted by key so the result does not depend on property order.
1626
+
1627
+ :param entries: -
1628
+
1629
+ :stability: experimental
1630
+ '''
1631
+ if __debug__:
1632
+ type_hints = cached_type_hints(_typecheckingstub__89d2ee0220c33c5357157d502001eb29e4d7acc5dd0985be2aeb7f269d3ef50b)
1633
+ check_type(argname="argument entries", value=entries, expected_type=type_hints["entries"])
1634
+ return typing.cast("BundlerKey", jsii.invoke(self, "withEnv", [entries]))
1635
+
1636
+
1458
1637
  @jsii.data_type(
1459
1638
  jsii_type="cdktn.CloudBackendConfig",
1460
1639
  jsii_struct_bases=[],
@@ -5371,6 +5550,138 @@ class _IAssetProxy:
5371
5550
  typing.cast(typing.Any, IAsset).__jsii_proxy_class__ = lambda : _IAssetProxy
5372
5551
 
5373
5552
 
5553
+ @jsii.interface(jsii_type="cdktn.IAssetBundler")
5554
+ class IAssetBundler(typing_extensions.Protocol):
5555
+ '''(experimental) Transforms a source tree into a built artifact. Runs at synth, before the output is packaged and staged.
5556
+
5557
+ This is the extension point for asset bundling: core ships no bundler.
5558
+ Docker, esbuild, pip, ``go build``, and similar are an open-ended set that
5559
+ is not cloud-specific, so each lives in its own package and implements this
5560
+ one interface — the same way {@link IIgnoreStrategy} lets richer exclusion
5561
+ live outside core without core taking on a glob parser. A third party
5562
+ develops a bundler by implementing this interface and publishing it as a
5563
+ package; users pass an instance via the consuming construct's ``bundler``
5564
+ option.
5565
+
5566
+ ``bundle`` runs during the owning construct's ``onSynthesize`` hook and may
5567
+ touch the filesystem. Deferring it there keeps it skippable when the asset's
5568
+ stack is not being synthesized, which holds as long as the hash is taken
5569
+ over the source rather than the built output.
5570
+
5571
+ :stability: experimental
5572
+ '''
5573
+
5574
+ @builtins.property
5575
+ @jsii.member(jsii_name="bundlerKey")
5576
+ def bundler_key(self) -> typing.Optional[builtins.str]:
5577
+ '''(experimental) A value identifying the build, folded into the asset hash.
5578
+
5579
+ The source tree alone cannot see the build, so swapping a ``node:18`` base
5580
+ image for ``node:20`` would otherwise leave identity unchanged. A value
5581
+ capturing the build (e.g. ``docker:<image>:<command>``) closes that gap.
5582
+
5583
+ Under ``SOURCE`` hashing this is the only channel by which the build reaches
5584
+ identity, so it must serialize every input that can move the output —
5585
+ base image, command, tool version, environment, arguments. Anything left
5586
+ out means a changed build silently reuses a stale artifact. {@link * BundlerKey} builds one from an ordered set of parts so the format is not
5587
+ reinvented per bundler.
5588
+
5589
+ Mirrors {@link IIgnoreStrategy.cacheKey}: omit it when the build cannot be
5590
+ summarized as a string, and fall back to ``extraHash``.
5591
+
5592
+ :default: - the build does not contribute to the hash
5593
+
5594
+ :stability: experimental
5595
+ '''
5596
+ ...
5597
+
5598
+ @jsii.member(jsii_name="bundle")
5599
+ def bundle(self, *, output_dir: builtins.str, source: builtins.str) -> builtins.str:
5600
+ '''(experimental) Produce the artifact and return the directory holding it.
5601
+
5602
+ Implementations write into ``options.outputDir`` and return it or a
5603
+ subdirectory, never writing back to ``options.source``. The returned
5604
+ directory is then packaged as an unbundled source directory would be.
5605
+ Returning a file, or a path that does not exist, is rejected — the
5606
+ contract is a directory, and packaging always treats the result as one.
5607
+
5608
+ :param output_dir: (experimental) A scratch directory the bundler may write into, owned and created by the caller. The bundler produces its output here (or in a subdirectory) and returns the directory that holds the finished artifact — see {@link IAssetBundler.bundle}.
5609
+ :param source: (experimental) Absolute path to the asset's source file or directory. The bundler reads from here and must not modify it. Exclusions (``exclude`` / ``ignoreStrategy``) are already applied: when any are configured this points at a filtered copy, not the original tree, so the bundler reads exactly the file set the asset hash was taken over.
5610
+
5611
+ :stability: experimental
5612
+ '''
5613
+ ...
5614
+
5615
+
5616
+ class _IAssetBundlerProxy:
5617
+ '''(experimental) Transforms a source tree into a built artifact. Runs at synth, before the output is packaged and staged.
5618
+
5619
+ This is the extension point for asset bundling: core ships no bundler.
5620
+ Docker, esbuild, pip, ``go build``, and similar are an open-ended set that
5621
+ is not cloud-specific, so each lives in its own package and implements this
5622
+ one interface — the same way {@link IIgnoreStrategy} lets richer exclusion
5623
+ live outside core without core taking on a glob parser. A third party
5624
+ develops a bundler by implementing this interface and publishing it as a
5625
+ package; users pass an instance via the consuming construct's ``bundler``
5626
+ option.
5627
+
5628
+ ``bundle`` runs during the owning construct's ``onSynthesize`` hook and may
5629
+ touch the filesystem. Deferring it there keeps it skippable when the asset's
5630
+ stack is not being synthesized, which holds as long as the hash is taken
5631
+ over the source rather than the built output.
5632
+
5633
+ :stability: experimental
5634
+ '''
5635
+
5636
+ __jsii_type__: typing.ClassVar[str] = "cdktn.IAssetBundler"
5637
+
5638
+ @builtins.property
5639
+ @jsii.member(jsii_name="bundlerKey")
5640
+ def bundler_key(self) -> typing.Optional[builtins.str]:
5641
+ '''(experimental) A value identifying the build, folded into the asset hash.
5642
+
5643
+ The source tree alone cannot see the build, so swapping a ``node:18`` base
5644
+ image for ``node:20`` would otherwise leave identity unchanged. A value
5645
+ capturing the build (e.g. ``docker:<image>:<command>``) closes that gap.
5646
+
5647
+ Under ``SOURCE`` hashing this is the only channel by which the build reaches
5648
+ identity, so it must serialize every input that can move the output —
5649
+ base image, command, tool version, environment, arguments. Anything left
5650
+ out means a changed build silently reuses a stale artifact. {@link * BundlerKey} builds one from an ordered set of parts so the format is not
5651
+ reinvented per bundler.
5652
+
5653
+ Mirrors {@link IIgnoreStrategy.cacheKey}: omit it when the build cannot be
5654
+ summarized as a string, and fall back to ``extraHash``.
5655
+
5656
+ :default: - the build does not contribute to the hash
5657
+
5658
+ :stability: experimental
5659
+ '''
5660
+ return typing.cast(typing.Optional[builtins.str], jsii.get(self, "bundlerKey"))
5661
+
5662
+ @jsii.member(jsii_name="bundle")
5663
+ def bundle(self, *, output_dir: builtins.str, source: builtins.str) -> builtins.str:
5664
+ '''(experimental) Produce the artifact and return the directory holding it.
5665
+
5666
+ Implementations write into ``options.outputDir`` and return it or a
5667
+ subdirectory, never writing back to ``options.source``. The returned
5668
+ directory is then packaged as an unbundled source directory would be.
5669
+ Returning a file, or a path that does not exist, is rejected — the
5670
+ contract is a directory, and packaging always treats the result as one.
5671
+
5672
+ :param output_dir: (experimental) A scratch directory the bundler may write into, owned and created by the caller. The bundler produces its output here (or in a subdirectory) and returns the directory that holds the finished artifact — see {@link IAssetBundler.bundle}.
5673
+ :param source: (experimental) Absolute path to the asset's source file or directory. The bundler reads from here and must not modify it. Exclusions (``exclude`` / ``ignoreStrategy``) are already applied: when any are configured this points at a filtered copy, not the original tree, so the bundler reads exactly the file set the asset hash was taken over.
5674
+
5675
+ :stability: experimental
5676
+ '''
5677
+ options = BundleOptions(output_dir=output_dir, source=source)
5678
+
5679
+ return typing.cast(builtins.str, jsii.invoke(self, "bundle", [options]))
5680
+
5681
+ # Adding a "__jsii_proxy_class__(): typing.Type" function to the interface
5682
+ typing.cast(typing.Any, IAssetBundler).__jsii_proxy_class__ = lambda : _IAssetBundlerProxy
5683
+
5684
+
5374
5685
  @jsii.interface(jsii_type="cdktn.IAssetPackaging")
5375
5686
  class IAssetPackaging(typing_extensions.Protocol):
5376
5687
  '''(experimental) How a staged asset is produced and what shape it takes on disk.
@@ -5384,6 +5695,20 @@ class IAssetPackaging(typing_extensions.Protocol):
5384
5695
  :stability: experimental
5385
5696
  '''
5386
5697
 
5698
+ @builtins.property
5699
+ @jsii.member(jsii_name="acceptsDirectorySource")
5700
+ def accepts_directory_source(self) -> builtins.bool:
5701
+ '''(experimental) Whether ``pack`` accepts a directory as its ``source``.
5702
+
5703
+ Independent of ``producesDirectory`` and ``omitsDirectoryEntries``, both of
5704
+ which describe the output: a ``tar.gz`` packaging takes a directory source
5705
+ yet emits a single file. Bundler output is always a directory, so a
5706
+ packaging that is ``false`` here cannot stage it.
5707
+
5708
+ :stability: experimental
5709
+ '''
5710
+ ...
5711
+
5387
5712
  @builtins.property
5388
5713
  @jsii.member(jsii_name="extension")
5389
5714
  def extension(self) -> builtins.str:
@@ -5431,7 +5756,7 @@ class IAssetPackaging(typing_extensions.Protocol):
5431
5756
  target: builtins.str,
5432
5757
  ignore_strategy: typing.Optional["IIgnoreStrategy"] = None,
5433
5758
  ) -> None:
5434
- '''(experimental) Perform the staging transformation, writing the packaged result to ``options.target``.
5759
+ '''(experimental) Write the packaged result to ``options.target``.
5435
5760
 
5436
5761
  :param source: (experimental) Path to the resolved (already bundled, if applicable) source.
5437
5762
  :param target: (experimental) Path the packaged result should be written to.
@@ -5456,6 +5781,20 @@ class _IAssetPackagingProxy:
5456
5781
 
5457
5782
  __jsii_type__: typing.ClassVar[str] = "cdktn.IAssetPackaging"
5458
5783
 
5784
+ @builtins.property
5785
+ @jsii.member(jsii_name="acceptsDirectorySource")
5786
+ def accepts_directory_source(self) -> builtins.bool:
5787
+ '''(experimental) Whether ``pack`` accepts a directory as its ``source``.
5788
+
5789
+ Independent of ``producesDirectory`` and ``omitsDirectoryEntries``, both of
5790
+ which describe the output: a ``tar.gz`` packaging takes a directory source
5791
+ yet emits a single file. Bundler output is always a directory, so a
5792
+ packaging that is ``false`` here cannot stage it.
5793
+
5794
+ :stability: experimental
5795
+ '''
5796
+ return typing.cast(builtins.bool, jsii.get(self, "acceptsDirectorySource"))
5797
+
5459
5798
  @builtins.property
5460
5799
  @jsii.member(jsii_name="extension")
5461
5800
  def extension(self) -> builtins.str:
@@ -5503,7 +5842,7 @@ class _IAssetPackagingProxy:
5503
5842
  target: builtins.str,
5504
5843
  ignore_strategy: typing.Optional["IIgnoreStrategy"] = None,
5505
5844
  ) -> None:
5506
- '''(experimental) Perform the staging transformation, writing the packaged result to ``options.target``.
5845
+ '''(experimental) Write the packaged result to ``options.target``.
5507
5846
 
5508
5847
  :param source: (experimental) Path to the resolved (already bundled, if applicable) source.
5509
5848
  :param target: (experimental) Path the packaged result should be written to.
@@ -13145,6 +13484,7 @@ class TerraformAsset(
13145
13484
  path: builtins.str,
13146
13485
  asset_hash: typing.Optional[builtins.str] = None,
13147
13486
  asset_hash_type: typing.Optional["AssetHashType"] = None,
13487
+ bundler: typing.Optional["IAssetBundler"] = None,
13148
13488
  exclude: typing.Optional[typing.Sequence[builtins.str]] = None,
13149
13489
  extra_hash: typing.Optional[builtins.str] = None,
13150
13490
  type: typing.Optional["AssetType"] = None,
@@ -13157,7 +13497,8 @@ class TerraformAsset(
13157
13497
  :param id: -
13158
13498
  :param path:
13159
13499
  :param asset_hash:
13160
- :param asset_hash_type: (experimental) How the ``assetHash`` is derived. ``SOURCE`` (the default) hashes the source path. ``CUSTOM`` uses the ``assetHash`` value verbatim and requires it to be set. ``OUTPUT`` also hashes the source path today — there is no bundling step yet, so the "output" of an asset is its source verbatim — but will hash the bundler's output once bundling is introduced. If ``assetHash`` is set, this must be ``undefined`` or ``AssetHashType.CUSTOM``. Default: AssetHashType.SOURCE
13500
+ :param asset_hash_type: (experimental) How the ``assetHash`` is derived. ``SOURCE`` (the default) hashes the source path. ``CUSTOM`` uses the ``assetHash`` value verbatim and requires it to be set. ``OUTPUT`` hashes the source too, unless a ``bundler`` is set — then it hashes the bundler's built output, which forces an eager build (see ``bundler``). If ``assetHash`` is set, this must be ``undefined`` or ``AssetHashType.CUSTOM``. Default: AssetHashType.SOURCE
13501
+ :param bundler: (experimental) A bundler that builds the source into an artifact before staging. Core ships no bundler; implement ``IAssetBundler`` or use one from a bundler package. Under the default ``SOURCE`` hashing the build is deferred to synth and stays skippable; ``OUTPUT`` hashing builds eagerly to hash the artifact. ``AssetType.FILE`` is rejected, since bundler output is always a directory. See ``AssetStagingOptions.bundler``. Default: - the source is staged verbatim, with no build step
13161
13502
  :param exclude: (experimental) Paths to exclude from the asset, relative to ``path``. See ``AssetStagingOptions.exclude`` for the accepted forms. Both the computed hash and the staged/packed content honor the exclusion. Default: - nothing is excluded
13162
13503
  :param extra_hash: (experimental) Extra information to fold into the hash (e.g. build instructions and other inputs). Default: - no extra hash
13163
13504
  :param type:
@@ -13172,6 +13513,7 @@ class TerraformAsset(
13172
13513
  path=path,
13173
13514
  asset_hash=asset_hash,
13174
13515
  asset_hash_type=asset_hash_type,
13516
+ bundler=bundler,
13175
13517
  exclude=exclude,
13176
13518
  extra_hash=extra_hash,
13177
13519
  type=type,
@@ -13233,6 +13575,7 @@ class TerraformAsset(
13233
13575
  "path": "path",
13234
13576
  "asset_hash": "assetHash",
13235
13577
  "asset_hash_type": "assetHashType",
13578
+ "bundler": "bundler",
13236
13579
  "exclude": "exclude",
13237
13580
  "extra_hash": "extraHash",
13238
13581
  "type": "type",
@@ -13245,6 +13588,7 @@ class TerraformAssetConfig:
13245
13588
  path: builtins.str,
13246
13589
  asset_hash: typing.Optional[builtins.str] = None,
13247
13590
  asset_hash_type: typing.Optional["AssetHashType"] = None,
13591
+ bundler: typing.Optional["IAssetBundler"] = None,
13248
13592
  exclude: typing.Optional[typing.Sequence[builtins.str]] = None,
13249
13593
  extra_hash: typing.Optional[builtins.str] = None,
13250
13594
  type: typing.Optional["AssetType"] = None,
@@ -13252,7 +13596,8 @@ class TerraformAssetConfig:
13252
13596
  '''
13253
13597
  :param path:
13254
13598
  :param asset_hash:
13255
- :param asset_hash_type: (experimental) How the ``assetHash`` is derived. ``SOURCE`` (the default) hashes the source path. ``CUSTOM`` uses the ``assetHash`` value verbatim and requires it to be set. ``OUTPUT`` also hashes the source path today — there is no bundling step yet, so the "output" of an asset is its source verbatim — but will hash the bundler's output once bundling is introduced. If ``assetHash`` is set, this must be ``undefined`` or ``AssetHashType.CUSTOM``. Default: AssetHashType.SOURCE
13599
+ :param asset_hash_type: (experimental) How the ``assetHash`` is derived. ``SOURCE`` (the default) hashes the source path. ``CUSTOM`` uses the ``assetHash`` value verbatim and requires it to be set. ``OUTPUT`` hashes the source too, unless a ``bundler`` is set — then it hashes the bundler's built output, which forces an eager build (see ``bundler``). If ``assetHash`` is set, this must be ``undefined`` or ``AssetHashType.CUSTOM``. Default: AssetHashType.SOURCE
13600
+ :param bundler: (experimental) A bundler that builds the source into an artifact before staging. Core ships no bundler; implement ``IAssetBundler`` or use one from a bundler package. Under the default ``SOURCE`` hashing the build is deferred to synth and stays skippable; ``OUTPUT`` hashing builds eagerly to hash the artifact. ``AssetType.FILE`` is rejected, since bundler output is always a directory. See ``AssetStagingOptions.bundler``. Default: - the source is staged verbatim, with no build step
13256
13601
  :param exclude: (experimental) Paths to exclude from the asset, relative to ``path``. See ``AssetStagingOptions.exclude`` for the accepted forms. Both the computed hash and the staged/packed content honor the exclusion. Default: - nothing is excluded
13257
13602
  :param extra_hash: (experimental) Extra information to fold into the hash (e.g. build instructions and other inputs). Default: - no extra hash
13258
13603
  :param type:
@@ -13264,6 +13609,7 @@ class TerraformAssetConfig:
13264
13609
  check_type(argname="argument path", value=path, expected_type=type_hints["path"])
13265
13610
  check_type(argname="argument asset_hash", value=asset_hash, expected_type=type_hints["asset_hash"])
13266
13611
  check_type(argname="argument asset_hash_type", value=asset_hash_type, expected_type=type_hints["asset_hash_type"])
13612
+ check_type(argname="argument bundler", value=bundler, expected_type=type_hints["bundler"])
13267
13613
  check_type(argname="argument exclude", value=exclude, expected_type=type_hints["exclude"])
13268
13614
  check_type(argname="argument extra_hash", value=extra_hash, expected_type=type_hints["extra_hash"])
13269
13615
  check_type(argname="argument type", value=type, expected_type=type_hints["type"])
@@ -13274,6 +13620,8 @@ class TerraformAssetConfig:
13274
13620
  self._values["asset_hash"] = asset_hash
13275
13621
  if asset_hash_type is not None:
13276
13622
  self._values["asset_hash_type"] = asset_hash_type
13623
+ if bundler is not None:
13624
+ self._values["bundler"] = bundler
13277
13625
  if exclude is not None:
13278
13626
  self._values["exclude"] = exclude
13279
13627
  if extra_hash is not None:
@@ -13303,10 +13651,9 @@ class TerraformAssetConfig:
13303
13651
  '''(experimental) How the ``assetHash`` is derived.
13304
13652
 
13305
13653
  ``SOURCE`` (the default) hashes the source path. ``CUSTOM`` uses the
13306
- ``assetHash`` value verbatim and requires it to be set. ``OUTPUT`` also
13307
- hashes the source path today — there is no bundling step yet, so the
13308
- "output" of an asset is its source verbatim — but will hash the
13309
- bundler's output once bundling is introduced.
13654
+ ``assetHash`` value verbatim and requires it to be set. ``OUTPUT`` hashes the
13655
+ source too, unless a ``bundler`` is set — then it hashes the bundler's
13656
+ built output, which forces an eager build (see ``bundler``).
13310
13657
 
13311
13658
  If ``assetHash`` is set, this must be ``undefined`` or ``AssetHashType.CUSTOM``.
13312
13659
 
@@ -13317,6 +13664,23 @@ class TerraformAssetConfig:
13317
13664
  result = self._values.get("asset_hash_type")
13318
13665
  return typing.cast(typing.Optional["AssetHashType"], result)
13319
13666
 
13667
+ @builtins.property
13668
+ def bundler(self) -> typing.Optional["IAssetBundler"]:
13669
+ '''(experimental) A bundler that builds the source into an artifact before staging.
13670
+
13671
+ Core ships no bundler; implement ``IAssetBundler`` or use one from a bundler
13672
+ package. Under the default ``SOURCE`` hashing the build is deferred to synth
13673
+ and stays skippable; ``OUTPUT`` hashing builds eagerly to hash the artifact.
13674
+ ``AssetType.FILE`` is rejected, since bundler output is always a directory.
13675
+ See ``AssetStagingOptions.bundler``.
13676
+
13677
+ :default: - the source is staged verbatim, with no build step
13678
+
13679
+ :stability: experimental
13680
+ '''
13681
+ result = self._values.get("bundler")
13682
+ return typing.cast(typing.Optional["IAssetBundler"], result)
13683
+
13320
13684
  @builtins.property
13321
13685
  def exclude(self) -> typing.Optional[typing.List[builtins.str]]:
13322
13686
  '''(experimental) Paths to exclude from the asset, relative to ``path``.
@@ -19831,23 +20195,14 @@ class AssetStaging(
19831
20195
  metaclass=jsii.JSIIMeta,
19832
20196
  jsii_type="cdktn.AssetStaging",
19833
20197
  ):
19834
- '''(experimental) Resolves an asset's identity (``SOURCE``/``OUTPUT``/``CUSTOM`` hashing, with ``exclude``/``extraHash``) and stages it to disk.
20198
+ '''(experimental) Resolves an asset's identity and stages its content to disk.
19835
20199
 
19836
- Hashing happens eagerly in the constructor; staging the content to
19837
- ``targetPath`` only happens when ``stage()`` is called, which callers do from
19838
- their own ``onSynthesize`` hook. This keeps the filesystem side effect in the
19839
- one window where it is safe to run, and keeps this class skippable once a
19840
- bundler is introduced.
19841
-
19842
- ``SOURCE`` and ``OUTPUT`` compute identically here: without a bundler, the
19843
- "output" of an asset is its source verbatim. A future bundler changes what
19844
- ``OUTPUT`` hashes, not this class.
19845
-
19846
- The source-tree walk behind ``SOURCE``/``OUTPUT`` is cached per synth (see
19847
- {@link hashCachesByRoot}), so referencing the same asset from more than one
19848
- resource or stack hashes it once. ``ASSET_HASH_SALT_CONTEXT_KEY`` folds an
19849
- app-wide value into every computed hash, for bulk cache-busting across an
19850
- entire tree rather than one asset's ``extraHash``.
20200
+ The hash is available immediately after construction; the filesystem write
20201
+ is deferred to ``stage()``, the one window where it is safe. Hashing is
20202
+ cached per synth (see {@link hashCachesByRoot}) so an asset referenced from
20203
+ several places is walked once. Without a bundler, ``SOURCE`` and ``OUTPUT`` both
20204
+ hash the source; with one they diverge, as ``AssetStagingOptions.bundler``
20205
+ describes.
19851
20206
 
19852
20207
  :stability: experimental
19853
20208
  '''
@@ -19859,6 +20214,8 @@ class AssetStaging(
19859
20214
  *,
19860
20215
  packaging: "IAssetPackaging",
19861
20216
  source_path: builtins.str,
20217
+ bundler: typing.Optional["IAssetBundler"] = None,
20218
+ display_name: typing.Optional[builtins.str] = None,
19862
20219
  exclude: typing.Optional[typing.Sequence[builtins.str]] = None,
19863
20220
  extra_hash: typing.Optional[builtins.str] = None,
19864
20221
  ignore_strategy: typing.Optional["IIgnoreStrategy"] = None,
@@ -19870,6 +20227,8 @@ class AssetStaging(
19870
20227
  :param id: -
19871
20228
  :param packaging: (experimental) How the staged result is produced and shaped. The caller decides this (e.g. from its own ``AssetType``) — ``AssetStaging`` never infers or changes it based on ``exclude``/``extraHash``.
19872
20229
  :param source_path: (experimental) Absolute path to the source file or directory. Resolving a relative path against ``cdktf.json`` is the caller's responsibility.
20230
+ :param bundler: (experimental) A bundler that builds the source into an artifact before staging. Under the default ``SOURCE`` hashing the build is deferred to ``stage()`` and stays skippable; ``OUTPUT`` hashing builds eagerly at construction time to hash the artifact, forgoing skippability. A bundler always produces a directory, so single-file packaging (``AssetType.FILE``) is rejected. Default: - the source is staged verbatim, with no build step
20231
+ :param display_name: (experimental) Identifier used in error messages, so they name the user-facing construct (e.g. the ``TerraformAsset``) rather than this internal staging child. Default: - the staging construct's own id
19873
20232
  :param exclude: (experimental) Paths to exclude, relative to ``sourcePath``. Cannot be combined with ``ignoreStrategy``, which replaces this matcher rather than layering on top of it. Default: - nothing is excluded
19874
20233
  :param extra_hash: (experimental) Extra information to fold into the hash (e.g. build instructions and other inputs). Default: - no extra hash
19875
20234
  :param ignore_strategy: (experimental) Exclusion matching, for callers that need ``.gitignore`` / ``.dockerignore`` parity rather than the built-in exact-path / suffix / directory matcher. Default: - ``exclude`` is used with the built-in matcher
@@ -19885,6 +20244,8 @@ class AssetStaging(
19885
20244
  props = AssetStagingOptions(
19886
20245
  packaging=packaging,
19887
20246
  source_path=source_path,
20247
+ bundler=bundler,
20248
+ display_name=display_name,
19888
20249
  exclude=exclude,
19889
20250
  extra_hash=extra_hash,
19890
20251
  ignore_strategy=ignore_strategy,
@@ -19896,12 +20257,13 @@ class AssetStaging(
19896
20257
 
19897
20258
  @jsii.member(jsii_name="stage")
19898
20259
  def stage(self, target_path: builtins.str) -> None:
19899
- '''(experimental) Write the staged content to ``targetPath``.
20260
+ '''(experimental) Stage the asset's content to ``targetPath``.
19900
20261
 
19901
- Called from the owning
19902
- construct's ``onSynthesize`` hook, once the target path is known.
20262
+ Called from the owning construct's ``onSynthesize`` hook. Without a bundler
20263
+ the source is packaged verbatim; with one, the bundler's output is, built
20264
+ eagerly for ``OUTPUT`` hashing or deferred to here for ``SOURCE``.
19903
20265
 
19904
- :param target_path: - path the packaged result should be written to.
20266
+ :param target_path: -
19905
20267
 
19906
20268
  :stability: experimental
19907
20269
  '''
@@ -29244,6 +29606,8 @@ __all__ = [
29244
29606
  "BooleanMap",
29245
29607
  "BooleanMapList",
29246
29608
  "BooleanMapMap",
29609
+ "BundleOptions",
29610
+ "BundlerKey",
29247
29611
  "CloudBackend",
29248
29612
  "CloudBackendConfig",
29249
29613
  "CloudWorkspace",
@@ -29295,6 +29659,7 @@ __all__ = [
29295
29659
  "IAnyProducer",
29296
29660
  "IAspect",
29297
29661
  "IAsset",
29662
+ "IAssetBundler",
29298
29663
  "IAssetPackaging",
29299
29664
  "IFragmentConcatenator",
29300
29665
  "IIgnoreStrategy",
@@ -29555,6 +29920,8 @@ def _typecheckingstub__5026244ff290924dad88f65421d8025b8bcb105d693dec43cd93a0c7d
29555
29920
  asset_hash_type: typing.Optional[AssetHashType] = None,
29556
29921
  packaging: IAssetPackaging,
29557
29922
  source_path: builtins.str,
29923
+ bundler: typing.Optional[IAssetBundler] = None,
29924
+ display_name: typing.Optional[builtins.str] = None,
29558
29925
  exclude: typing.Optional[typing.Sequence[builtins.str]] = None,
29559
29926
  extra_hash: typing.Optional[builtins.str] = None,
29560
29927
  ignore_strategy: typing.Optional[IIgnoreStrategy] = None,
@@ -29593,6 +29960,32 @@ def _typecheckingstub__912173407c419eae209032e0ac104680f082bb5aad4825d0e858e8efc
29593
29960
  """Type checking stubs"""
29594
29961
  pass
29595
29962
 
29963
+ def _typecheckingstub__e4984c7b158b6fd9f304d19bf1be6b525991aa5c57db01aa1dd6d282c3369f9e(
29964
+ *,
29965
+ output_dir: builtins.str,
29966
+ source: builtins.str,
29967
+ ) -> None:
29968
+ """Type checking stubs"""
29969
+ pass
29970
+
29971
+ def _typecheckingstub__76b2ba8d3e61fcbea83025fd36866ed49e2970a52cbe09f43be16a01cf5a6858(
29972
+ *parts: builtins.str,
29973
+ ) -> None:
29974
+ """Type checking stubs"""
29975
+ pass
29976
+
29977
+ def _typecheckingstub__5542e2e8a7f529585fff07dcaf5ca7a0425baa3a9af1286723c0b3fb21d976c6(
29978
+ *parts: builtins.str,
29979
+ ) -> None:
29980
+ """Type checking stubs"""
29981
+ pass
29982
+
29983
+ def _typecheckingstub__89d2ee0220c33c5357157d502001eb29e4d7acc5dd0985be2aeb7f269d3ef50b(
29984
+ entries: typing.Mapping[builtins.str, builtins.str],
29985
+ ) -> None:
29986
+ """Type checking stubs"""
29987
+ pass
29988
+
29596
29989
  def _typecheckingstub__4c43a277c741c97005cffe2a27390aad01d95fded1b13c16a35f07ccaec84f7a(
29597
29990
  *,
29598
29991
  organization: builtins.str,
@@ -31530,6 +31923,7 @@ def _typecheckingstub__6f29998a5dacee0da3977e8d51379662670eb6942990ac7e6e052ab5e
31530
31923
  path: builtins.str,
31531
31924
  asset_hash: typing.Optional[builtins.str] = None,
31532
31925
  asset_hash_type: typing.Optional[AssetHashType] = None,
31926
+ bundler: typing.Optional[IAssetBundler] = None,
31533
31927
  exclude: typing.Optional[typing.Sequence[builtins.str]] = None,
31534
31928
  extra_hash: typing.Optional[builtins.str] = None,
31535
31929
  type: typing.Optional[AssetType] = None,
@@ -31548,6 +31942,7 @@ def _typecheckingstub__e7a613b39a707470fb3fa76a5d5d750aa8285bec8b92786190d69d5b7
31548
31942
  path: builtins.str,
31549
31943
  asset_hash: typing.Optional[builtins.str] = None,
31550
31944
  asset_hash_type: typing.Optional[AssetHashType] = None,
31945
+ bundler: typing.Optional[IAssetBundler] = None,
31551
31946
  exclude: typing.Optional[typing.Sequence[builtins.str]] = None,
31552
31947
  extra_hash: typing.Optional[builtins.str] = None,
31553
31948
  type: typing.Optional[AssetType] = None,
@@ -32940,6 +33335,8 @@ def _typecheckingstub__a694062800c2f527dfda0d5a21ceaa0607085c2bef7277ea0a3217058
32940
33335
  *,
32941
33336
  packaging: IAssetPackaging,
32942
33337
  source_path: builtins.str,
33338
+ bundler: typing.Optional[IAssetBundler] = None,
33339
+ display_name: typing.Optional[builtins.str] = None,
32943
33340
  exclude: typing.Optional[typing.Sequence[builtins.str]] = None,
32944
33341
  extra_hash: typing.Optional[builtins.str] = None,
32945
33342
  ignore_strategy: typing.Optional[IIgnoreStrategy] = None,
@@ -34874,5 +35271,5 @@ def _typecheckingstub__0930e68f78776f6767a34b896806a2c7f0841f069ff5f5b3f5b121add
34874
35271
  """Type checking stubs"""
34875
35272
  pass
34876
35273
 
34877
- for cls in [IAnyProducer, IAspect, IAsset, IAssetPackaging, IFragmentConcatenator, IIgnoreStrategy, IImportableConfig, IInterpolatingParent, IListProducer, IManifest, INumberProducer, IPostProcessor, IRemoteWorkspace, IResolvable, IResolveContext, IResource, IResourceConstructor, IScopeCallback, IStackSynthesizer, IStringProducer, ISynthesisSession, ITerraformAddressable, ITerraformDependable, ITerraformEphemeralResource, ITerraformIterator, ITerraformResource, ITokenMapper, ITokenResolver]:
35274
+ for cls in [IAnyProducer, IAspect, IAsset, IAssetBundler, IAssetPackaging, IFragmentConcatenator, IIgnoreStrategy, IImportableConfig, IInterpolatingParent, IListProducer, IManifest, INumberProducer, IPostProcessor, IRemoteWorkspace, IResolvable, IResolveContext, IResource, IResourceConstructor, IScopeCallback, IStackSynthesizer, IStringProducer, ISynthesisSession, ITerraformAddressable, ITerraformDependable, ITerraformEphemeralResource, ITerraformIterator, ITerraformResource, ITokenMapper, ITokenResolver]:
34878
35275
  typing.cast(typing.Any, cls).__protocol_attrs__ = typing.cast(typing.Any, cls).__protocol_attrs__ - set(['__jsii_proxy_class__', '__jsii_type__'])
@@ -21,7 +21,7 @@ _SUBMODULE_FQN_MAP = {
21
21
  }
22
22
 
23
23
  __jsii_assembly__ = jsii.JSIIAssembly.load(
24
- "cdktn", "0.25.0-pre.38", __name__[0:-6], "cdktn@0.25.0-pre.38.jsii.tgz"
24
+ "cdktn", "0.25.0-pre.39", __name__[0:-6], "cdktn@0.25.0-pre.39.jsii.tgz"
25
25
  )
26
26
 
27
27
  __all__ = [
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: cdktn
3
- Version: 0.25.0.dev38
3
+ Version: 0.25.0.dev39
4
4
  Summary: Cloud Development Kit for Terraform
5
5
  Home-page: https://github.com/open-constructs/cdk-terrain
6
6
  Author: OpenConstructs
@@ -11,5 +11,5 @@ src/cdktn.egg-info/dependency_links.txt
11
11
  src/cdktn.egg-info/requires.txt
12
12
  src/cdktn.egg-info/top_level.txt
13
13
  src/cdktn/_jsii/__init__.py
14
- src/cdktn/_jsii/cdktn@0.25.0-pre.38.jsii.tgz
14
+ src/cdktn/_jsii/cdktn@0.25.0-pre.39.jsii.tgz
15
15
  src/cdktn/testing_matchers/__init__.py
File without changes
File without changes
File without changes
File without changes