@wtfalch/foundry 0.26.4 → 0.28.0

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.
@@ -12,6 +12,14 @@ export interface PlatformService {
12
12
  hostname: string;
13
13
  gitRef: string;
14
14
  }
15
+ /**
16
+ * `sfu`'s own extra field. A host that changes what the SFU VM is reached
17
+ * with (its SSH key, host key or tunnel token) sets a new `connectionRevision`
18
+ * so the platform plan shows the `sfu` step again; foundry never reads it.
19
+ */
20
+ export interface PlatformSfuService extends PlatformService {
21
+ connectionRevision?: string;
22
+ }
15
23
  /**
16
24
  * #491: `mail`'s own extra field, on top of every other service's shape.
17
25
  * Company Included (or whichever org's mail domain is the platform's own
@@ -76,7 +84,7 @@ export interface DeclaredPlatform {
76
84
  serverIpv4?: string | null;
77
85
  auth: PlatformService;
78
86
  mail: PlatformMailService;
79
- sfu: PlatformService;
87
+ sfu: PlatformSfuService;
80
88
  files: PlatformService;
81
89
  ai: PlatformService;
82
90
  jobs: PlatformService;
@@ -116,6 +124,8 @@ export declare function defaultPlatformHostname(service: PlatformServiceKey, ape
116
124
  * - `serverIpv4`, when declared, is a dotted-quad IPv4 address.
117
125
  * - Every service's `hostname` is the apex itself or a subdomain of it -- a
118
126
  * platform service does not live outside the platform's own apex.
127
+ * - `sfu.connectionRevision`, when declared, is at most 64 characters of
128
+ * `A-Za-z0-9:.-`.
119
129
  * - Every service's `gitRef` is non-empty once that service is `enabled` --
120
130
  * an enabled service with nothing to deploy is not yet declared.
121
131
  */
package/dist/platform.js CHANGED
@@ -32,6 +32,8 @@ function serviceOf(platform, key) {
32
32
  * - `serverIpv4`, when declared, is a dotted-quad IPv4 address.
33
33
  * - Every service's `hostname` is the apex itself or a subdomain of it -- a
34
34
  * platform service does not live outside the platform's own apex.
35
+ * - `sfu.connectionRevision`, when declared, is at most 64 characters of
36
+ * `A-Za-z0-9:.-`.
35
37
  * - Every service's `gitRef` is non-empty once that service is `enabled` --
36
38
  * an enabled service with nothing to deploy is not yet declared.
37
39
  */
@@ -54,6 +56,10 @@ export function validatePlatform(platform) {
54
56
  return `${key}.gitRef must not be empty once ${key}.enabled is true`;
55
57
  }
56
58
  }
59
+ const revision = platform.sfu.connectionRevision;
60
+ if (revision != null && !/^[A-Za-z0-9:.-]{0,64}$/.test(revision)) {
61
+ return 'sfu.connectionRevision must be at most 64 characters of A-Z, a-z, 0-9, ":", "." and "-"';
62
+ }
57
63
  const { uptime } = platform;
58
64
  if (Boolean(uptime.tag.trim()) !== Boolean(uptime.sha256.trim())) {
59
65
  return 'uptime.tag and uptime.sha256 must be set together: a pin is both';
@@ -606,7 +606,12 @@ function rowToPlatform(row) {
606
606
  gitRef: row.mailGitRef,
607
607
  ...(row.mailLettermintProjectId ? { lettermintProjectId: row.mailLettermintProjectId } : {}),
608
608
  },
609
- sfu: { enabled: row.sfuEnabled, hostname: row.sfuHostname, gitRef: row.sfuGitRef },
609
+ sfu: {
610
+ enabled: row.sfuEnabled,
611
+ hostname: row.sfuHostname,
612
+ gitRef: row.sfuGitRef,
613
+ ...(row.sfuConnectionRevision ? { connectionRevision: row.sfuConnectionRevision } : {}),
614
+ },
610
615
  files: { enabled: row.filesEnabled, hostname: row.filesHostname, gitRef: row.filesGitRef },
611
616
  ai: { enabled: row.aiEnabled, hostname: row.aiHostname, gitRef: row.aiGitRef },
612
617
  jobs: { enabled: row.jobsEnabled, hostname: row.jobsHostname, gitRef: row.jobsGitRef },
@@ -654,6 +659,7 @@ function platformToRow(platform) {
654
659
  sfuEnabled: platform.sfu.enabled,
655
660
  sfuHostname: platform.sfu.hostname,
656
661
  sfuGitRef: platform.sfu.gitRef,
662
+ sfuConnectionRevision: platform.sfu.connectionRevision ?? null,
657
663
  filesEnabled: platform.files.enabled,
658
664
  filesHostname: platform.files.hostname,
659
665
  filesGitRef: platform.files.gitRef,
@@ -1643,6 +1643,23 @@ export declare const foundryDeclaredPlatform: import("drizzle-orm/pg-core").PgTa
1643
1643
  identity: undefined;
1644
1644
  generated: undefined;
1645
1645
  }, {}, {}>;
1646
+ sfuConnectionRevision: import("drizzle-orm/pg-core").PgColumn<{
1647
+ name: "sfu_connection_revision";
1648
+ tableName: "foundry_declared_platform";
1649
+ dataType: "string";
1650
+ columnType: "PgText";
1651
+ data: string;
1652
+ driverParam: string;
1653
+ notNull: false;
1654
+ hasDefault: false;
1655
+ isPrimaryKey: false;
1656
+ isAutoincrement: false;
1657
+ hasRuntimeDefault: false;
1658
+ enumValues: [string, ...string[]];
1659
+ baseColumn: never;
1660
+ identity: undefined;
1661
+ generated: undefined;
1662
+ }, {}, {}>;
1646
1663
  filesEnabled: import("drizzle-orm/pg-core").PgColumn<{
1647
1664
  name: "files_enabled";
1648
1665
  tableName: "foundry_declared_platform";
@@ -165,6 +165,8 @@ export const foundryDeclaredPlatform = pgTable('foundry_declared_platform', {
165
165
  sfuEnabled: boolean('sfu_enabled').notNull().default(false),
166
166
  sfuHostname: text('sfu_hostname').notNull(),
167
167
  sfuGitRef: text('sfu_git_ref').notNull().default(''),
168
+ /** `migrations/0050_platform_sfu_connection_revision.sql`. Declared; null means unset. */
169
+ sfuConnectionRevision: text('sfu_connection_revision'),
168
170
  filesEnabled: boolean('files_enabled').notNull().default(false),
169
171
  filesHostname: text('files_hostname').notNull(),
170
172
  filesGitRef: text('files_git_ref').notNull().default(''),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/foundry",
3
- "version": "0.26.4",
3
+ "version": "0.28.0",
4
4
  "description": "Foundry's SDK: the declared org's types, the plan and apply contracts, and the state store's interface.",
5
5
  "repository": {
6
6
  "type": "git",