@wtfalch/foundry 0.17.1 → 0.19.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.
Files changed (44) hide show
  1. package/dist/bootstrap/declare.d.ts +11 -2
  2. package/dist/bootstrap/declare.js +20 -11
  3. package/dist/index.d.ts +4 -2
  4. package/dist/index.js +2 -1
  5. package/dist/migrations/0045_names_to_edge.sql +107 -0
  6. package/dist/org.d.ts +17 -17
  7. package/dist/org.js +48 -58
  8. package/dist/plan/agora.d.ts +25 -0
  9. package/dist/plan/agora.js +25 -0
  10. package/dist/plan/boule.d.ts +8 -0
  11. package/dist/plan/boule.js +8 -0
  12. package/dist/plan/diff.d.ts +3 -1
  13. package/dist/plan/diff.js +115 -52
  14. package/dist/plan/entry-edge-key.d.ts +79 -0
  15. package/dist/plan/{entry-names-key.js → entry-edge-key.js} +90 -66
  16. package/dist/plan/executor.d.ts +87 -42
  17. package/dist/plan/executor.js +277 -120
  18. package/dist/plan/index.d.ts +2 -2
  19. package/dist/plan/index.js +1 -1
  20. package/dist/plan/live.d.ts +3 -3
  21. package/dist/plan/login-host.d.ts +15 -11
  22. package/dist/plan/login-host.js +16 -16
  23. package/dist/plan/plan-apply.d.ts +6 -5
  24. package/dist/plan/plan-apply.js +40 -38
  25. package/dist/plan/platform-diff.d.ts +22 -22
  26. package/dist/plan/platform-diff.js +45 -45
  27. package/dist/plan/platform-org-ports.d.ts +1 -0
  28. package/dist/plan/platform-org-ports.js +3 -0
  29. package/dist/plan/platform-org.d.ts +8 -8
  30. package/dist/plan/platform-org.js +7 -7
  31. package/dist/plan/platform-providers.d.ts +17 -16
  32. package/dist/plan/platform-providers.js +136 -118
  33. package/dist/plan/providers-readers.d.ts +34 -11
  34. package/dist/plan/providers-readers.js +72 -15
  35. package/dist/plan/step-system.js +1 -1
  36. package/dist/plan/{edge-worker.d.ts → worker.d.ts} +53 -33
  37. package/dist/plan/{edge-worker.js → worker.js} +92 -54
  38. package/dist/platform.d.ts +3 -3
  39. package/dist/platform.js +1 -1
  40. package/dist/store/postgres.js +7 -7
  41. package/dist/store/schema.d.ts +6 -6
  42. package/dist/store/schema.js +4 -4
  43. package/package.json +1 -1
  44. package/dist/plan/entry-names-key.d.ts +0 -73
@@ -598,10 +598,10 @@ function rowToPlatform(row) {
598
598
  hostname: row.archonHostname,
599
599
  gitRef: row.archonGitRef,
600
600
  },
601
- names: {
602
- enabled: row.namesEnabled,
603
- hostname: row.namesHostname,
604
- gitRef: row.namesGitRef,
601
+ edge: {
602
+ enabled: row.edgeEnabled,
603
+ hostname: row.edgeHostname,
604
+ gitRef: row.edgeGitRef,
605
605
  },
606
606
  };
607
607
  }
@@ -636,9 +636,9 @@ function platformToRow(platform) {
636
636
  archonEnabled: platform.archon.enabled,
637
637
  archonHostname: platform.archon.hostname,
638
638
  archonGitRef: platform.archon.gitRef,
639
- namesEnabled: platform.names.enabled,
640
- namesHostname: platform.names.hostname,
641
- namesGitRef: platform.names.gitRef,
639
+ edgeEnabled: platform.edge.enabled,
640
+ edgeHostname: platform.edge.hostname,
641
+ edgeGitRef: platform.edge.gitRef,
642
642
  };
643
643
  }
644
644
  /**
@@ -1881,8 +1881,8 @@ export declare const foundryDeclaredPlatform: import("drizzle-orm/pg-core").PgTa
1881
1881
  identity: undefined;
1882
1882
  generated: undefined;
1883
1883
  }, {}, {}>;
1884
- namesEnabled: import("drizzle-orm/pg-core").PgColumn<{
1885
- name: "names_enabled";
1884
+ edgeEnabled: import("drizzle-orm/pg-core").PgColumn<{
1885
+ name: "edge_enabled";
1886
1886
  tableName: "foundry_declared_platform";
1887
1887
  dataType: "boolean";
1888
1888
  columnType: "PgBoolean";
@@ -1898,8 +1898,8 @@ export declare const foundryDeclaredPlatform: import("drizzle-orm/pg-core").PgTa
1898
1898
  identity: undefined;
1899
1899
  generated: undefined;
1900
1900
  }, {}, {}>;
1901
- namesHostname: import("drizzle-orm/pg-core").PgColumn<{
1902
- name: "names_hostname";
1901
+ edgeHostname: import("drizzle-orm/pg-core").PgColumn<{
1902
+ name: "edge_hostname";
1903
1903
  tableName: "foundry_declared_platform";
1904
1904
  dataType: "string";
1905
1905
  columnType: "PgText";
@@ -1915,8 +1915,8 @@ export declare const foundryDeclaredPlatform: import("drizzle-orm/pg-core").PgTa
1915
1915
  identity: undefined;
1916
1916
  generated: undefined;
1917
1917
  }, {}, {}>;
1918
- namesGitRef: import("drizzle-orm/pg-core").PgColumn<{
1919
- name: "names_git_ref";
1918
+ edgeGitRef: import("drizzle-orm/pg-core").PgColumn<{
1919
+ name: "edge_git_ref";
1920
1920
  tableName: "foundry_declared_platform";
1921
1921
  dataType: "string";
1922
1922
  columnType: "PgText";
@@ -178,10 +178,10 @@ export const foundryDeclaredPlatform = pgTable('foundry_declared_platform', {
178
178
  archonEnabled: boolean('archon_enabled').notNull().default(false),
179
179
  archonHostname: text('archon_hostname').notNull(),
180
180
  archonGitRef: text('archon_git_ref').notNull().default(''),
181
- /** #317 (F7), `migrations/0038_platform_names.sql`. */
182
- namesEnabled: boolean('names_enabled').notNull().default(false),
183
- namesHostname: text('names_hostname').notNull(),
184
- namesGitRef: text('names_git_ref').notNull().default(''),
181
+ /** #317 (F7), `migrations/0043_platform_names.sql`, renamed from `names_*` by `0045_names_to_edge.sql`. */
182
+ edgeEnabled: boolean('edge_enabled').notNull().default(false),
183
+ edgeHostname: text('edge_hostname').notNull(),
184
+ edgeGitRef: text('edge_git_ref').notNull().default(''),
185
185
  /** `migrations/0018_platform_apply.sql`: the platform's applied state, `system:kind:key` to provider id. */
186
186
  serviceIds: jsonb('service_ids').$type().notNull().default({}),
187
187
  createdAt: timestamp('created_at', { withTimezone: true }).notNull().defaultNow(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wtfalch/foundry",
3
- "version": "0.17.1",
3
+ "version": "0.19.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",
@@ -1,73 +0,0 @@
1
- import type { DeclaredOrg, HostingEntry } from '../org.js';
2
- import type { DraftStep } from './diff.js';
3
- import type { OrgPlatformReadiness } from './platform-org.js';
4
- /**
5
- * F7 (#317): one names key per entry with `uses.names`, minted directly
6
- * below the org with the names service (`NamesPort.mintKey({
7
- * organisationId, ... })` -- no org-level root key the way files/ai have
8
- * one, since the names service takes the org id itself). `NAMES_URL` and
9
- * `NAMES_API_KEY` go to the entry's env and nowhere else. A names key has no
10
- * declared renewal window in the issue, so unlike `planEntryAiKeys`/
11
- * `planFilesKeys` this mints once and never renews.
12
- *
13
- * `NAMES_*` is written in this step, after the app's own `coolify:app`
14
- * create (which never knows the key yet), so the app's first boot has
15
- * neither and its first deploy restarts once this step's env write lands --
16
- * the same one-extra-restart shape `planEntryAiKeys`'s `AI_*`/
17
- * `planFilesKeys`'s `FILES_*` already have, not a names-specific gap.
18
- *
19
- * A domain change after mint is not detected (#317 re-review): the key is
20
- * bound to the domain passed at mint time, but nothing here records that
21
- * domain to compare against a later `org.domain`, so an org that changes
22
- * domains keeps a names key still bound to the old one. Not built --
23
- * resolving it needs a manual revoke-and-re-mint (drop `uses.names`, apply,
24
- * re-add it) until this is.
25
- */
26
- export declare const entryNamesUndeliveredScopeKey: (entryKey: string) => string;
27
- /** The id of a key that was live when its entry stopped declaring `uses.names`, once handled. */
28
- export declare const entryNamesRetiredScopeKey: (entryKey: string) => string;
29
- export declare const ENTRY_NAMES_KEY_DELIVERY_ATTEMPTS = 3;
30
- /** How long an entry's names key lives. The issue names no renewal window, so this mints once and never renews. */
31
- export declare const NAMES_ENTRY_KEY_DAYS = 365;
32
- /** The ISO time a delivered key's mint succeeded -- the only trace of its age, since there is no renewal to track against. */
33
- export declare const entryNamesMintedAtScopeKey: (entryKey: string) => string;
34
- /** A key with fewer days left than this is surfaced as a blocked warning row (#317 review): still live, but nothing here renews it. */
35
- export declare const NAMES_ENTRY_KEY_WARN_WINDOW_DAYS = 30;
36
- /** The reserved labels last sent to the names service, as that sorted list's own JSON. */
37
- export declare const NAMES_RESERVED_LABELS_APPLIED_SCOPE_KEY = "names_reserved_labels_applied";
38
- export declare const entryNamesKeyName: (org: DeclaredOrg, entry: HostingEntry) => string;
39
- /**
40
- * Every label a declared entry serves (`@`/`*` reserve nothing of their own:
41
- * the bare domain and the wildcard are not names a customer could claim
42
- * under names anyway), plus `www`, which `setReservedLabels`'s own doc
43
- * comment in `executor.ts` explains is reserved unconditionally.
44
- */
45
- export declare function namesReservedLabels(org: DeclaredOrg): string[];
46
- type Blocked = Array<{
47
- description: string;
48
- key: string;
49
- }>;
50
- /**
51
- * One step per entry whose names key is missing, plus one retire step per
52
- * entry whose `uses.names` was removed but still has a recorded key.
53
- * Blocked, not planned (rule 2), while the platform has no names service
54
- * wired, the entry's app is not recorded, or a previous mint's delivery
55
- * failed.
56
- */
57
- export declare function planEntryNamesKeys(org: DeclaredOrg, recordedIds: Readonly<Record<string, string>>, plannedSteps: readonly DraftStep[], readiness: OrgPlatformReadiness, now?: number): {
58
- steps: DraftStep[];
59
- blocked: Blocked;
60
- };
61
- /**
62
- * The reserved-labels step: resent whenever the org's own label set
63
- * (`namesReservedLabels`) differs from what was last sent. While the org
64
- * uses names at all (at least one entry with `uses.names`) that set is
65
- * `namesReservedLabels(org)`; once the last entry drops `uses.names`, this
66
- * clears whatever was last sent (an empty list) rather than leaving it
67
- * stuck in names forever -- a one-time step, same as any other change.
68
- */
69
- export declare function planNamesReservedLabels(org: DeclaredOrg, recordedIds: Readonly<Record<string, string>>, readiness: OrgPlatformReadiness): {
70
- step: DraftStep | null;
71
- blocked: Blocked;
72
- };
73
- export {};