@ts-cloud/core 0.9.1 → 0.9.3

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.
Files changed (2) hide show
  1. package/dist/types.d.ts +91 -1
  2. package/package.json +2 -2
package/dist/types.d.ts CHANGED
@@ -14,7 +14,34 @@ export interface CloudProviderConfig {
14
14
  * this project's sites, and adds its own additive rpx `sites.d/<slug>.json`
15
15
  * fragment + DNS — never touching the owner's box lifecycle, firewall, or other
16
16
  * tenants. The owner provisions and manages the shared box; attachers only
17
- * deploy onto it. Requires read access via the same `HCLOUD_TOKEN`.
17
+ * deploy onto it.
18
+ *
19
+ * ## This widens what your CI credential can reach
20
+ *
21
+ * Attaching resolves the host by listing the provider's servers with THIS
22
+ * project's own token, so the owner's box has to be visible to it, which means
23
+ * both projects live in the same provider project. On Hetzner that is the whole
24
+ * story: Cloud API tokens are scoped to a project with Read or Read & Write and
25
+ * offer no per-resource scoping, and a deploy needs write. So the moment this is
26
+ * set, this project's CI token can modify and delete EVERY server in that
27
+ * provider project, not just the box it deploys to.
28
+ *
29
+ * Concretely, three apps that each owned one box become three pipelines that
30
+ * each reach all three, plus anything else in the project. That is a real change
31
+ * in blast radius: a compromised CI run or a mistargeted teardown now reaches
32
+ * production systems belonging to unrelated apps.
33
+ *
34
+ * **Per-project isolation and attaching are mutually exclusive.** An app kept in
35
+ * its own provider project cannot be attached at all, because its token cannot
36
+ * see the owner's box. Choosing to co-host is choosing to trade credential
37
+ * isolation for a shared box; the reverse trade is equally available, and neither
38
+ * is a default worth stumbling into.
39
+ *
40
+ * `describeCredentialReach()` reports what a given token can actually reach, so
41
+ * the radius can be shown before an attach is approved rather than discovered
42
+ * afterwards.
43
+ *
44
+ * @see https://github.com/stacksjs/ts-cloud/issues/169
18
45
  */
19
46
  attachTo?: string;
20
47
  }
@@ -1660,6 +1687,69 @@ export interface DnsConfig {
1660
1687
  * instead of Route53
1661
1688
  */
1662
1689
  provider?: 'route53' | 'cloudflare' | 'porkbun' | 'godaddy';
1690
+ /**
1691
+ * Records to publish on every deploy, alongside the address records ts-cloud
1692
+ * derives from `sites`.
1693
+ *
1694
+ * This is for the half of a zone a deploy cannot infer — mail (MX, SPF,
1695
+ * DMARC, autodiscover), domain-verification TXT records, third-party CNAMEs.
1696
+ * Those are exactly the records that go missing in a nameserver migration and
1697
+ * are not noticed until someone reports that mail stopped, because nothing in
1698
+ * a normal deploy touches or checks them. Declaring them here makes the zone
1699
+ * reproducible from the repo instead of from someone's memory of a dashboard.
1700
+ *
1701
+ * Reconciliation is **upsert-only**: ts-cloud never deletes a record it was
1702
+ * not asked to manage, because a zone routinely holds records owned by other
1703
+ * tools and people. The one exception is a policy TXT record (SPF, DMARC),
1704
+ * where a *second* record is not additive but a hard failure — see
1705
+ * {@link DnsRecordConfig}.
1706
+ */
1707
+ records?: DnsRecordConfig[];
1708
+ }
1709
+ /**
1710
+ * One record published by {@link DnsConfig.records}.
1711
+ *
1712
+ * How a record is matched against what already exists depends on its type,
1713
+ * because "the same record" means different things:
1714
+ *
1715
+ * - **A, AAAA, CNAME** — one value per name in practice, so an existing record
1716
+ * with this name and type is UPDATED.
1717
+ * - **MX, SRV, CAA, NS** — legitimately multi-valued, so a record is matched on
1718
+ * its content and only created when that exact value is absent. Undeclared
1719
+ * values at the same name are reported, never removed: a stray MX means split
1720
+ * mail delivery, which the operator must see, but deleting someone else's
1721
+ * record on a shared zone is worse.
1722
+ * - **TXT** — multi-valued in general (verification tokens sit beside each
1723
+ * other), EXCEPT for policy records. Two `v=spf1` records are not two
1724
+ * policies; they are a permerror, and receivers treat the domain as having no
1725
+ * usable SPF at all. Two `v=DMARC1` records are likewise ignored wholesale.
1726
+ * So a TXT whose value opens with a policy tag REPLACES the existing record
1727
+ * carrying that same tag, and any other TXT at that name is left untouched.
1728
+ */
1729
+ export interface DnsRecordConfig {
1730
+ type: 'A' | 'AAAA' | 'CNAME' | 'MX' | 'TXT' | 'SRV' | 'CAA' | 'NS';
1731
+ /**
1732
+ * Record name: `'@'` (or omitted) for the zone apex, a bare label such as
1733
+ * `'autodiscover'`, or a fully-qualified name. Bare labels are qualified with
1734
+ * the zone.
1735
+ */
1736
+ name?: string;
1737
+ /** Record value. */
1738
+ content: string;
1739
+ /** TTL in seconds. @default 3600 */
1740
+ ttl?: number;
1741
+ /** Priority — required for MX, used by SRV. */
1742
+ priority?: number;
1743
+ /**
1744
+ * Cloudflare only: serve through the proxy. @default false
1745
+ *
1746
+ * Declared records default to DNS-only deliberately. Mail records cannot be
1747
+ * proxied at all, and a proxied `autodiscover` CNAME resolves to Cloudflare
1748
+ * rather than Microsoft and quietly breaks client auto-configuration.
1749
+ */
1750
+ proxied?: boolean;
1751
+ /** Free-text note stored with the record where the provider supports it. */
1752
+ comment?: string;
1663
1753
  }
1664
1754
  export interface SecurityConfig {
1665
1755
  waf?: WafConfig;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@ts-cloud/core",
3
3
  "type": "module",
4
- "version": "0.9.1",
4
+ "version": "0.9.3",
5
5
  "description": "Core CloudFormation generation library for ts-cloud",
6
6
  "author": "Chris Breuer <chris@stacksjs.com>",
7
7
  "license": "MIT",
@@ -31,7 +31,7 @@
31
31
  "typecheck": "tsc --noEmit"
32
32
  },
33
33
  "dependencies": {
34
- "@ts-cloud/aws-types": "0.9.1"
34
+ "@ts-cloud/aws-types": "0.9.3"
35
35
  },
36
36
  "devDependencies": {
37
37
  "typescript": "^7.0.2"