@wtfalch/foundry 0.60.0 → 0.62.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 (236) hide show
  1. package/dist/apps/cloudflare.d.ts +173 -0
  2. package/dist/apps/cloudflare.js +17 -0
  3. package/dist/apps/deploy.d.ts +116 -0
  4. package/dist/apps/deploy.js +791 -0
  5. package/dist/apps/github.d.ts +47 -0
  6. package/dist/apps/github.js +201 -0
  7. package/dist/apps/index.d.ts +9 -0
  8. package/dist/apps/index.js +9 -0
  9. package/dist/apps/migrations.d.ts +110 -0
  10. package/dist/apps/migrations.js +458 -0
  11. package/dist/audit/connector.d.ts +43 -0
  12. package/dist/audit/connector.js +22 -0
  13. package/dist/audit/evidence.d.ts +49 -0
  14. package/dist/audit/evidence.js +56 -0
  15. package/dist/audit/index.d.ts +9 -0
  16. package/dist/audit/index.js +9 -0
  17. package/dist/audit/migrations.d.ts +5 -0
  18. package/dist/audit/migrations.js +5 -0
  19. package/dist/audit/registry.d.ts +49 -0
  20. package/dist/audit/registry.js +44 -0
  21. package/dist/audit/seal.d.ts +49 -0
  22. package/dist/audit/seal.js +131 -0
  23. package/dist/audit/sealer-role.d.ts +33 -0
  24. package/dist/audit/sealer-role.js +56 -0
  25. package/dist/audit/signer.d.ts +40 -0
  26. package/dist/audit/signer.js +78 -0
  27. package/dist/audit/tick.d.ts +36 -0
  28. package/dist/audit/tick.js +87 -0
  29. package/dist/catalogue/copy-en.d.ts +1 -0
  30. package/dist/catalogue/copy-en.js +129 -0
  31. package/dist/catalogue/index.d.ts +9 -0
  32. package/dist/catalogue/index.js +21 -0
  33. package/dist/catalogue/integrations.d.ts +4 -0
  34. package/dist/catalogue/integrations.js +104 -0
  35. package/dist/catalogue/systems.d.ts +7 -0
  36. package/dist/catalogue/systems.js +31 -0
  37. package/dist/catalogue/types.d.ts +110 -0
  38. package/dist/catalogue/types.js +1 -0
  39. package/dist/entry-rules.d.ts +53 -0
  40. package/dist/entry-rules.js +71 -0
  41. package/dist/hosted-label.d.ts +13 -0
  42. package/dist/hosted-label.js +81 -0
  43. package/dist/index.d.ts +14 -5
  44. package/dist/index.js +7 -3
  45. package/dist/migrations/0062_hosting_github.sql +6 -0
  46. package/dist/migrations/0063_boule_apps.sql +7 -0
  47. package/dist/migrations/0064_requested_changes_boule_apps.sql +6 -0
  48. package/dist/migrations/0065_native_build_runs.sql +32 -0
  49. package/dist/migrations/0066_org_kosmos.sql +10 -0
  50. package/dist/modules/ai.d.ts +3 -0
  51. package/dist/modules/ai.js +64 -0
  52. package/dist/modules/assistants.d.ts +3 -0
  53. package/dist/modules/assistants.js +72 -0
  54. package/dist/modules/audit-ledger.d.ts +29 -0
  55. package/dist/modules/audit-ledger.js +49 -0
  56. package/dist/modules/audit.d.ts +7 -0
  57. package/dist/modules/audit.js +44 -0
  58. package/dist/modules/database.d.ts +23 -0
  59. package/dist/modules/database.js +189 -0
  60. package/dist/modules/email.d.ts +3 -0
  61. package/dist/modules/email.js +18 -0
  62. package/dist/modules/entry-parts.d.ts +23 -0
  63. package/dist/modules/entry-parts.js +63 -0
  64. package/dist/modules/files.d.ts +3 -0
  65. package/dist/modules/files.js +64 -0
  66. package/dist/modules/index.d.ts +74 -0
  67. package/dist/modules/index.js +774 -0
  68. package/dist/modules/jobs.d.ts +3 -0
  69. package/dist/modules/jobs.js +23 -0
  70. package/dist/modules/organisations.d.ts +3 -0
  71. package/dist/modules/organisations.js +20 -0
  72. package/dist/modules/outputs.d.ts +9 -0
  73. package/dist/modules/outputs.js +38 -0
  74. package/dist/modules/sign-in.d.ts +3 -0
  75. package/dist/modules/sign-in.js +197 -0
  76. package/dist/modules/signed-records.d.ts +3 -0
  77. package/dist/modules/signed-records.js +32 -0
  78. package/dist/modules/types.d.ts +194 -0
  79. package/dist/modules/types.js +1 -0
  80. package/dist/modules/workspaces.d.ts +3 -0
  81. package/dist/modules/workspaces.js +75 -0
  82. package/dist/native-build.d.ts +70 -0
  83. package/dist/native-build.js +92 -0
  84. package/dist/org.d.ts +184 -24
  85. package/dist/org.js +444 -49
  86. package/dist/plan/agora.d.ts +1 -1
  87. package/dist/plan/agora.js +4 -0
  88. package/dist/plan/apps-db-route.d.ts +90 -0
  89. package/dist/plan/apps-db-route.js +168 -0
  90. package/dist/plan/apps-zones.d.ts +56 -0
  91. package/dist/plan/apps-zones.js +118 -0
  92. package/dist/plan/archon-blue-green.js +11 -1
  93. package/dist/plan/blue-green-apply.d.ts +37 -1
  94. package/dist/plan/blue-green-apply.js +55 -15
  95. package/dist/plan/blue-green.d.ts +60 -8
  96. package/dist/plan/blue-green.js +115 -10
  97. package/dist/plan/boule.d.ts +23 -1
  98. package/dist/plan/boule.js +35 -2
  99. package/dist/plan/broker-entries.d.ts +28 -3
  100. package/dist/plan/broker-entries.js +74 -3
  101. package/dist/plan/broker-registrar.d.ts +168 -0
  102. package/dist/plan/broker-registrar.js +440 -0
  103. package/dist/plan/broker-workspaces-database.d.ts +48 -0
  104. package/dist/plan/broker-workspaces-database.js +87 -0
  105. package/dist/plan/deploy-health.js +9 -2
  106. package/dist/plan/desktop-callback.js +15 -7
  107. package/dist/plan/diff.d.ts +8 -2
  108. package/dist/plan/diff.js +552 -104
  109. package/dist/plan/edge-access.d.ts +6 -0
  110. package/dist/plan/edge-access.js +1 -0
  111. package/dist/plan/edge-dns.d.ts +6 -0
  112. package/dist/plan/edge-dns.js +9 -7
  113. package/dist/plan/entry-ai-key.d.ts +1 -1
  114. package/dist/plan/entry-ai-key.js +2 -2
  115. package/dist/plan/entry-audit.d.ts +58 -0
  116. package/dist/plan/entry-audit.js +122 -0
  117. package/dist/plan/entry-customer-grants.d.ts +75 -0
  118. package/dist/plan/entry-customer-grants.js +154 -0
  119. package/dist/plan/entry-edge-key.d.ts +26 -1
  120. package/dist/plan/entry-edge-key.js +42 -3
  121. package/dist/plan/entry-jobs.d.ts +64 -0
  122. package/dist/plan/entry-jobs.js +92 -0
  123. package/dist/plan/entry-repo-key-apply.d.ts +55 -0
  124. package/dist/plan/entry-repo-key-apply.js +185 -0
  125. package/dist/plan/entry-repo-key.d.ts +92 -0
  126. package/dist/plan/entry-repo-key.js +235 -0
  127. package/dist/plan/entry-workspaces.d.ts +55 -0
  128. package/dist/plan/entry-workspaces.js +90 -0
  129. package/dist/plan/executor.d.ts +231 -19
  130. package/dist/plan/executor.js +1648 -129
  131. package/dist/plan/gates.d.ts +1 -1
  132. package/dist/plan/gates.js +62 -9
  133. package/dist/plan/github-deploy-keys.d.ts +78 -0
  134. package/dist/plan/github-deploy-keys.js +305 -0
  135. package/dist/plan/github-source.d.ts +53 -0
  136. package/dist/plan/github-source.js +140 -0
  137. package/dist/plan/held-key-refs.d.ts +12 -0
  138. package/dist/plan/held-key-refs.js +12 -0
  139. package/dist/plan/hostnames.d.ts +9 -0
  140. package/dist/plan/hostnames.js +28 -1
  141. package/dist/plan/index.d.ts +9 -0
  142. package/dist/plan/index.js +6 -0
  143. package/dist/plan/jobs-scheduler-http.js +3 -0
  144. package/dist/plan/keys-registrar-http.d.ts +32 -0
  145. package/dist/plan/keys-registrar-http.js +105 -0
  146. package/dist/plan/keys-registrar.d.ts +67 -0
  147. package/dist/plan/keys-registrar.js +103 -0
  148. package/dist/plan/kosmos.d.ts +56 -0
  149. package/dist/plan/kosmos.js +84 -0
  150. package/dist/plan/live.d.ts +1 -1
  151. package/dist/plan/locked-hostnames.d.ts +2 -2
  152. package/dist/plan/locked-hostnames.js +7 -4
  153. package/dist/plan/login-host.js +11 -5
  154. package/dist/plan/machine-paths.d.ts +36 -0
  155. package/dist/plan/machine-paths.js +137 -0
  156. package/dist/plan/mcp.d.ts +1 -1
  157. package/dist/plan/mcp.js +49 -17
  158. package/dist/plan/org-apps-admin.d.ts +108 -0
  159. package/dist/plan/org-apps-admin.js +434 -0
  160. package/dist/plan/org-names.d.ts +3 -3
  161. package/dist/plan/org-names.js +15 -2
  162. package/dist/plan/org-postgres-migrate.js +1 -0
  163. package/dist/plan/own-diff.d.ts +23 -0
  164. package/dist/plan/own-diff.js +53 -0
  165. package/dist/plan/own-hostnames.d.ts +2 -0
  166. package/dist/plan/own-hostnames.js +1 -0
  167. package/dist/plan/own-jobs-route.d.ts +47 -0
  168. package/dist/plan/own-jobs-route.js +91 -0
  169. package/dist/plan/own-limits.d.ts +6 -0
  170. package/dist/plan/own-limits.js +1 -0
  171. package/dist/plan/own-services.d.ts +4 -0
  172. package/dist/plan/own-services.js +4 -0
  173. package/dist/plan/plan-apply.d.ts +39 -0
  174. package/dist/plan/plan-apply.js +163 -9
  175. package/dist/plan/platform-diff.d.ts +2 -2
  176. package/dist/plan/platform-diff.js +7 -2
  177. package/dist/plan/platform-org.d.ts +30 -0
  178. package/dist/plan/platform-org.js +12 -1
  179. package/dist/plan/platform-providers.d.ts +2 -0
  180. package/dist/plan/platform-providers.js +13 -2
  181. package/dist/plan/post-logout-uris.d.ts +1 -1
  182. package/dist/plan/post-logout-uris.js +12 -3
  183. package/dist/plan/private-pages.d.ts +26 -0
  184. package/dist/plan/private-pages.js +39 -0
  185. package/dist/plan/providers-readers.js +20 -1
  186. package/dist/plan/proxy-labels.d.ts +12 -1
  187. package/dist/plan/proxy-labels.js +32 -2
  188. package/dist/plan/release-host.d.ts +6 -2
  189. package/dist/plan/release-host.js +36 -8
  190. package/dist/plan/stage-env.d.ts +19 -1
  191. package/dist/plan/stage-env.js +25 -1
  192. package/dist/plan/stage-guards.d.ts +20 -0
  193. package/dist/plan/stage-guards.js +24 -0
  194. package/dist/plan/stage-isolation.d.ts +24 -0
  195. package/dist/plan/stage-isolation.js +29 -1
  196. package/dist/plan/worker-app-database.d.ts +46 -42
  197. package/dist/plan/worker-app-database.js +150 -153
  198. package/dist/plan/worker-app.d.ts +5 -65
  199. package/dist/plan/worker-app.js +28 -105
  200. package/dist/plan/worker.d.ts +2 -2
  201. package/dist/plan/worker.js +2 -1
  202. package/dist/plan/workspace-client.d.ts +25 -0
  203. package/dist/plan/workspace-client.js +48 -0
  204. package/dist/plan/workspace-sign-in.d.ts +55 -0
  205. package/dist/plan/workspace-sign-in.js +273 -0
  206. package/dist/plan/workspace-worker.d.ts +4 -0
  207. package/dist/plan/workspace-worker.js +13 -0
  208. package/dist/plan/workspace.d.ts +101 -0
  209. package/dist/plan/workspace.js +305 -0
  210. package/dist/release/decide.d.ts +30 -1
  211. package/dist/release/decide.js +73 -11
  212. package/dist/release/health.d.ts +8 -3
  213. package/dist/release/health.js +58 -5
  214. package/dist/release/migration-compatibility.d.ts +66 -0
  215. package/dist/release/migration-compatibility.js +340 -0
  216. package/dist/release/run.d.ts +2 -5
  217. package/dist/release/run.js +4 -0
  218. package/dist/release/state.d.ts +3 -1
  219. package/dist/release/state.js +6 -0
  220. package/dist/release/types.d.ts +20 -0
  221. package/dist/requested-changes.d.ts +11 -2
  222. package/dist/requested-changes.js +13 -1
  223. package/dist/service-labels.d.ts +4 -0
  224. package/dist/service-labels.js +11 -0
  225. package/dist/slug.d.ts +2 -0
  226. package/dist/slug.js +20 -7
  227. package/dist/store/postgres.js +25 -2
  228. package/dist/store/schema.d.ts +73 -1
  229. package/dist/store/schema.js +10 -0
  230. package/dist/worker-app-config.d.ts +1 -11
  231. package/dist/worker-app-config.js +4 -17
  232. package/dist/worker-app-migrations.d.ts +105 -0
  233. package/dist/worker-app-migrations.js +166 -0
  234. package/dist/worker-app-upload.d.ts +103 -0
  235. package/dist/worker-app-upload.js +128 -0
  236. package/package.json +19 -2
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- export type { OrgId, MailMode, MailConfig, ChatConfig, CallsConfig, IssuerConfig, SiteConfig, IssuerAppKind, IssuerApp, HostingConfig, HostingEntry, BlueGreenConfig, OrgBuiltinApp, OrgRefusal, OrgRefusalCode, WorkerAppConfig, EntryGate, EntryVolume, HostingEntryUses, EntryAuth, EntryAuthRoom, EntryFiles, EntryAi, EnvValue, EnvHeldSecret, SsoConfig, GuestsConfig, SoloConfig, StorageConfig, AiConfig, BuyerAddress, BuyerIdentity, AdoptedAppForm, AdoptedApp, OwnerIdentity, OwnerMailbox, DeclaredOrg, OrgServiceDatabase, OrgServiceSchema, ServicesConfig, SignInConfig, VersionPin, VersionPinPart, } from './org.js';
2
- export { APP_ENTRY_KEY, DEFAULT_GATE_LIMIT, FILES_ENTRY_PERMISSIONS, AI_ENTRY_PERMISSIONS, DEFAULT_MAIL_APPS, ORG_SERVICE_SCHEMAS, orgServiceDatabase, orgServiceDatabases, SFU_SLOT_MAX, VERSION_PIN_PARTS, isMainEntry, mainEntry, heldEnvRef, ownerMailboxes, ownsServices, validateBuyerIdentity, validateHosting, normalizeHostingRepos, validateMail, validateOwners, validateServices, validateCustomers, validateSignIn, validateVersionPin, validateSite, } from './org.js';
1
+ export type { OrgId, MailMode, MailConfig, ChatConfig, CallsConfig, IssuerConfig, SiteConfig, IssuerAppKind, IssuerApp, HostingConfig, HostingEntry, HostingGithub, BlueGreenConfig, OrgBuiltinApp, BouleApp, KosmosApp, OrgRefusal, OrgRefusalCode, WorkerAppConfig, EntryGate, EntryVolume, HostingEntryUses, EntryAuth, EntryAuthRoom, EntryFiles, EntryAi, EnvValue, EnvHeldSecret, SsoConfig, GuestsConfig, SoloConfig, StorageConfig, AiConfig, BuyerAddress, BuyerIdentity, AdoptedAppForm, AdoptedApp, OwnerIdentity, OwnerMailbox, DeclaredOrg, OrgServiceDatabase, OrgServiceSchema, EntryWorkspace, ServicesConfig, SignInConfig, VersionPin, VersionPinPart, } from './org.js';
2
+ export { APP_ENTRY_KEY, APPS_DOMAIN, DEFAULT_GATE_LIMIT, MAX_WORKSPACE_TESTERS, isLiveEntry, normalizeTesters, FILES_ENTRY_PERMISSIONS, AI_ENTRY_PERMISSIONS, DEFAULT_MAIL_APPS, ORG_SERVICE_SCHEMAS, orgServiceDatabase, orgServiceDatabases, SFU_SLOT_MAX, VERSION_PIN_PARTS, isMainEntry, mainEntry, companyGithubFor, heldEnvRef, ownerMailboxes, ownsServices, validateBuyerIdentity, validateHosting, normalizeHostingRepos, validateMail, validateOwners, validateServices, validateCustomers, validateSignIn, validateVersionPin, validateSite, } from './org.js';
3
3
  export { refuseOrg } from './refuse-org.js';
4
4
  export { workerAppHasBuild } from './worker-app-config.js';
5
5
  export type { DeclaredPlatform, PlatformService, PlatformServiceKey, PlatformSfuService, HeartbeatsProvider, } from './platform.js';
@@ -15,6 +15,8 @@ export type { SlugRejectionReason, SlugRejection } from './slug.js';
15
15
  export { validateSlug, slugFromName, RESERVED_SLUGS } from './slug.js';
16
16
  export type { Checkpoint, LastApplied, AppliedState, DestroyRecord, DestroyStepRecord, } from './state.js';
17
17
  export type { PlanStep, UnmanagedItem, PlanNote, Plan, VersionChangeItem } from './plan.js';
18
+ export type { NativeBuildDispatchDeps, NativeBuildKeyEnvPort, } from './native-build.js';
19
+ export { NATIVE_BUILD_REPO, NATIVE_BUILD_WORKFLOW_FILE, NATIVE_BUILD_WORKFLOW_REF, NATIVE_BUILD_DISPATCH_TIMEOUT_MS, NATIVE_BUILD_KEY_ENV, NATIVE_BUILD_KEY_BYTES, NativeBuildDispatchError, dispatchNativeBuild, mintNativeBuildKey, } from './native-build.js';
18
20
  export type { AppliedVersion, AppliedVersionsStore, DeclaredOrgStore, HeldLease, MutationLease, PlatformStore, RequestedChangeStore, StaleUpdate, UpdateOptions, } from './store.js';
19
21
  export { StaleLeaseError } from './store.js';
20
22
  export type { PlanApply, DestroyProgress } from './apply.js';
@@ -23,6 +25,8 @@ export { createPostgresAuditLog } from './store/audit.js';
23
25
  export type { Color, ReleaseAction, ReleaseSignal, ReleaseState, WindowState, } from './release/types.js';
24
26
  export type { ReleaseStore } from './release/state.js';
25
27
  export { readReleaseState, requestReleaseAction } from './release/state.js';
28
+ export type { DeclaredClassRemoval, MigrationCompatibilityInput, MigrationCompatibilityProblem, MigrationCompatibilityResult, } from './release/migration-compatibility.js';
29
+ export { checkMigrationCompatibility } from './release/migration-compatibility.js';
26
30
  export { createPostgresReleaseStore } from './store/postgres.js';
27
31
  export type { FoundryStoreDb } from './store/postgres.js';
28
32
  export { declaredOrgs, foundryAppliedState, foundryAppliedVersions, foundryAuditEvents, foundryDeclaredPlatform, foundryReleaseRequests, foundryRequestedChanges, type AuditEventRow, type DeclaredOrgRow, type NewDeclaredOrgRow, type AppliedStateRow, type NewAppliedStateRow, type AppliedVersionRow, type NewAppliedVersionRow, type DeclaredPlatformRow, type NewDeclaredPlatformRow, type RequestedChangeRow, type NewRequestedChangeRow, } from './store/schema.js';
@@ -53,13 +57,17 @@ export type { FilesHostInput, JobsHostDeps, JobsHostInput, OwnAuthInstance, Plan
53
57
  export { OWN_AUTH_APPLIED_GIT_REF_SCOPE_KEY, OWN_AUTH_APPLIED_HOSTNAME_SCOPE_KEY, OWN_AUTH_BLOCKED_KEY, OWN_FILES_BLOCKED_KEY, OWN_FILES_R2_BLOCKED_KEY, OWN_JOBS_BLOCKED_KEY, OWN_MAIL_BLOCKED_KEY, planOwnAuth, planOwnFiles, planOwnFilesR2, planOwnJobs, planOwnMail, provisionFilesHost, provisionJobsHost, provisionMailServer, } from './plan/index.js';
54
58
  export type { PlanOwnSfuOptions, SfuAppDeps, SfuAppInput } from './plan/index.js';
55
59
  export { OWN_SFU_BLOCKED_KEY, OWN_SFU_FIREWALL_KEY, planOwnSfu, provisionSfuApp, sfuConfig, sfuCompose, } from './plan/index.js';
56
- export type { CoolifyPort, CloudflarePort, ZitadelPort, CallsSfuPort, JobsSchedulerPort, FilesOrganisationPort, AiOrganisationPort, FoundryStepExecutorPorts, PlatformOrgPortSource, AgoraHostPort, AgoraHostValues, LoginHostBinding, LoginHostBindingsPort, LoginHostDiscoveryPort, } from './plan/index.js';
60
+ export type { CoolifyPort, CloudflarePort, ZitadelPort, CallsSfuPort, JobsSchedulerPort, FilesOrganisationPort, AiOrganisationPort, FoundryStepExecutorPorts, KeysRegistrarPort, PlatformOrgPortSource, AgoraHostPort, AgoraHostValues, LoginHostBinding, LoginHostBindingsPort, LoginHostDiscoveryPort, } from './plan/index.js';
57
61
  export { FoundryStepExecutor, NotBuiltError, healthUrls, loginHostnameFor } from './plan/index.js';
58
- export { NO_DOMAIN_ZONE, ownHostnames } from './plan/index.js';
62
+ export { NO_DOMAIN_ZONE, entryMachinePaths, ownHostnames, privatePageGateKey, workspaceHost, } from './plan/index.js';
63
+ export type { PrivatePageScope } from './plan/index.js';
64
+ export type { HostedLabelRefusal } from './hosted-label.js';
65
+ export { hostedLabelRefusal } from './hosted-label.js';
59
66
  export type { OwnHostnames } from './plan/index.js';
60
67
  export type { EnsureSignInOrgOptions } from './plan/index.js';
61
68
  export { ZITADEL_ORG_DOMAIN_SCOPE_KEY, ensureSignInOrg, registerSignInDomain, signInOrgDomain, } from './plan/index.js';
62
69
  export { HttpJobsSchedulerClient } from './plan/index.js';
70
+ export { httpKeysRegistrar, keysRegistrarFromConfig, KEYS_PLATFORM_TOKEN_ENV, KEYS_SERVICE_URL_ENV, } from './plan/index.js';
63
71
  export type { HealthTarget, HealthTargetDepth, HealthTargetExpect } from './plan/index.js';
64
72
  export { healthTargets, platformHealthTargets } from './plan/index.js';
65
73
  export type { ScopeResolver, RecordedIds, DnsRecordOwners } from './plan/index.js';
@@ -69,8 +77,9 @@ export { adaptZitadelListApps } from './plan/index.js';
69
77
  export type { MailIdentityApp, MailIdentityAudienceCheck } from './plan/index.js';
70
78
  export { checkMailIdentityAudience } from './plan/index.js';
71
79
  export type { MailAllowlistApp } from './plan/index.js';
80
+ export type { DeployKeyTarget, GithubDeployKey, GithubDeployKeysPort } from './plan/index.js';
72
81
  export { checkMailAppsAllowlist } from './plan/index.js';
73
- export { FoundryPlatformStepExecutor, ProvidersPlatformCloudflareReader, ProvidersPlatformCoolifyReader, createZitadelAdminMinter, createZitadelLoginPolicy, createZitadelOrgMetadata, createZitadelProjectRoles, PLATFORM_AUTH_KEY, PLATFORM_MAIL_KEY, PLATFORM_MAIL_RELAY_KEY, PLATFORM_MAIL_RELAY_ROUTES_SCOPE_KEY, PLATFORM_MAIL_ADMIN_KEY_DESCRIPTION, } from './plan/index.js';
82
+ export { FoundryPlatformStepExecutor, ProvidersPlatformCloudflareReader, ProvidersPlatformCoolifyReader, createGithubDeployKeys, createZitadelAdminMinter, createZitadelLoginPolicy, createZitadelOrgMetadata, createZitadelProjectRoles, PLATFORM_AUTH_KEY, PLATFORM_MAIL_KEY, PLATFORM_MAIL_RELAY_KEY, PLATFORM_MAIL_RELAY_ROUTES_SCOPE_KEY, PLATFORM_MAIL_ADMIN_KEY_DESCRIPTION, } from './plan/index.js';
74
83
  export type { PlatformAuthDeps, PlatformAuthSmtp, PlatformAuthRuntime, PlatformFilesDeps, PlatformFilesRuntime, PlatformEdgeDeps, PlatformDnsFactory, PlatformAccessFactory, PlatformUptimeAccessFactory, PlatformUptimeAccessPort, PlatformUptimeChatDeps, PlatformUptimeDeps, PlatformGithubReleaseHookDeps, PlatformWorkersFactory, PlatformWorkersPort, PlatformAccessPort, PlatformTunnelsFactory, PlatformEdgeRuntime, } from './plan/index.js';
75
84
  export type { PlatformMailDeps, PlatformMailAdminPort, PlatformMailRuntime, } from './plan/index.js';
76
85
  export { FILES_INTROSPECTION_SECRET_REF, FILES_MANAGEMENT_ISSUER, FILES_MANAGEMENT_KEY_ID, FILES_MANAGEMENT_KEY_REF, PLATFORM_AUTH_INSTANCE_BEARER_REF, } from './plan/index.js';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { APP_ENTRY_KEY, DEFAULT_GATE_LIMIT, FILES_ENTRY_PERMISSIONS, AI_ENTRY_PERMISSIONS, DEFAULT_MAIL_APPS, ORG_SERVICE_SCHEMAS, orgServiceDatabase, orgServiceDatabases, SFU_SLOT_MAX, VERSION_PIN_PARTS, isMainEntry, mainEntry, heldEnvRef, ownerMailboxes, ownsServices, validateBuyerIdentity, validateHosting, normalizeHostingRepos, validateMail, validateOwners, validateServices, validateCustomers, validateSignIn, validateVersionPin, validateSite, } from './org.js';
1
+ export { APP_ENTRY_KEY, APPS_DOMAIN, DEFAULT_GATE_LIMIT, MAX_WORKSPACE_TESTERS, isLiveEntry, normalizeTesters, FILES_ENTRY_PERMISSIONS, AI_ENTRY_PERMISSIONS, DEFAULT_MAIL_APPS, ORG_SERVICE_SCHEMAS, orgServiceDatabase, orgServiceDatabases, SFU_SLOT_MAX, VERSION_PIN_PARTS, isMainEntry, mainEntry, companyGithubFor, heldEnvRef, ownerMailboxes, ownsServices, validateBuyerIdentity, validateHosting, normalizeHostingRepos, validateMail, validateOwners, validateServices, validateCustomers, validateSignIn, validateVersionPin, validateSite, } from './org.js';
2
2
  export { refuseOrg } from './refuse-org.js';
3
3
  export { workerAppHasBuild } from './worker-app-config.js';
4
4
  export { PLATFORM_SERVICE_KEYS, HEARTBEATS_PROVIDERS, defaultPlatformHostname, validatePlatform, } from './platform.js';
@@ -10,10 +10,12 @@ export const PINNED_VERSIONS = VERSIONS;
10
10
  export { buildJsonSchema, parseBuildJson, BuildJsonError } from './build-json.js';
11
11
  export { REQUESTABLE_FIELDS, classifyChange, RequestedChangeError } from './requested-changes.js';
12
12
  export { validateSlug, slugFromName, RESERVED_SLUGS } from './slug.js';
13
+ export { NATIVE_BUILD_REPO, NATIVE_BUILD_WORKFLOW_FILE, NATIVE_BUILD_WORKFLOW_REF, NATIVE_BUILD_DISPATCH_TIMEOUT_MS, NATIVE_BUILD_KEY_ENV, NATIVE_BUILD_KEY_BYTES, NativeBuildDispatchError, dispatchNativeBuild, mintNativeBuildKey, } from './native-build.js';
13
14
  export { StaleLeaseError } from './store.js';
14
15
  export { createPostgresAppliedVersionsStore, createPostgresDeclaredOrgStore, createPostgresPlatformStore, createPostgresRequestedChangeStore, DeclaredOrgError, PlatformError, } from './store/postgres.js';
15
16
  export { createPostgresAuditLog } from './store/audit.js';
16
17
  export { readReleaseState, requestReleaseAction } from './release/state.js';
18
+ export { checkMigrationCompatibility } from './release/migration-compatibility.js';
17
19
  export { createPostgresReleaseStore } from './store/postgres.js';
18
20
  export { declaredOrgs, foundryAppliedState, foundryAppliedVersions, foundryAuditEvents, foundryDeclaredPlatform, foundryReleaseRequests, foundryRequestedChanges, } from './store/schema.js';
19
21
  export { COMPANY_DESTINATION_NAME_PREFIX, COMPANY_NETWORKS, DEFAULT_MAX_DESTINATIONS, DestinationCapacityError, PLATFORM_NETWORK, companyNetworkName, ensureDestination, findDestination, placed, placedOnPlatform, validateNetworkName, } from './plan/index.js';
@@ -32,15 +34,17 @@ export { OWN_FILES_R2_SCOPE_KEY, OWN_FILES_R2_UNDELIVERED_SCOPE_KEY, OWN_SERVICE
32
34
  export { OWN_AUTH_APPLIED_GIT_REF_SCOPE_KEY, OWN_AUTH_APPLIED_HOSTNAME_SCOPE_KEY, OWN_AUTH_BLOCKED_KEY, OWN_FILES_BLOCKED_KEY, OWN_FILES_R2_BLOCKED_KEY, OWN_JOBS_BLOCKED_KEY, OWN_MAIL_BLOCKED_KEY, planOwnAuth, planOwnFiles, planOwnFilesR2, planOwnJobs, planOwnMail, provisionFilesHost, provisionJobsHost, provisionMailServer, } from './plan/index.js';
33
35
  export { OWN_SFU_BLOCKED_KEY, OWN_SFU_FIREWALL_KEY, planOwnSfu, provisionSfuApp, sfuConfig, sfuCompose, } from './plan/index.js';
34
36
  export { FoundryStepExecutor, NotBuiltError, healthUrls, loginHostnameFor } from './plan/index.js';
35
- export { NO_DOMAIN_ZONE, ownHostnames } from './plan/index.js';
37
+ export { NO_DOMAIN_ZONE, entryMachinePaths, ownHostnames, privatePageGateKey, workspaceHost, } from './plan/index.js';
38
+ export { hostedLabelRefusal } from './hosted-label.js';
36
39
  export { ZITADEL_ORG_DOMAIN_SCOPE_KEY, ensureSignInOrg, registerSignInDomain, signInOrgDomain, } from './plan/index.js';
37
40
  export { HttpJobsSchedulerClient } from './plan/index.js';
41
+ export { httpKeysRegistrar, keysRegistrarFromConfig, KEYS_PLATFORM_TOKEN_ENV, KEYS_SERVICE_URL_ENV, } from './plan/index.js';
38
42
  export { healthTargets, platformHealthTargets } from './plan/index.js';
39
43
  export { ProvidersAiReader, ProvidersCloudflareReader, ProvidersCmsReader, ProvidersCoolifyReader, ProvidersZitadelReader, storeLoginHostResolver, storeScopeResolver, storeRecordedIds, } from './plan/index.js';
40
44
  export { adaptZitadelListApps } from './plan/index.js';
41
45
  export { checkMailIdentityAudience } from './plan/index.js';
42
46
  export { checkMailAppsAllowlist } from './plan/index.js';
43
- export { FoundryPlatformStepExecutor, ProvidersPlatformCloudflareReader, ProvidersPlatformCoolifyReader, createZitadelAdminMinter, createZitadelLoginPolicy, createZitadelOrgMetadata, createZitadelProjectRoles, PLATFORM_AUTH_KEY, PLATFORM_MAIL_KEY, PLATFORM_MAIL_RELAY_KEY, PLATFORM_MAIL_RELAY_ROUTES_SCOPE_KEY, PLATFORM_MAIL_ADMIN_KEY_DESCRIPTION, } from './plan/index.js';
47
+ export { FoundryPlatformStepExecutor, ProvidersPlatformCloudflareReader, ProvidersPlatformCoolifyReader, createGithubDeployKeys, createZitadelAdminMinter, createZitadelLoginPolicy, createZitadelOrgMetadata, createZitadelProjectRoles, PLATFORM_AUTH_KEY, PLATFORM_MAIL_KEY, PLATFORM_MAIL_RELAY_KEY, PLATFORM_MAIL_RELAY_ROUTES_SCOPE_KEY, PLATFORM_MAIL_ADMIN_KEY_DESCRIPTION, } from './plan/index.js';
44
48
  export { FILES_INTROSPECTION_SECRET_REF, FILES_MANAGEMENT_ISSUER, FILES_MANAGEMENT_KEY_ID, FILES_MANAGEMENT_KEY_REF, PLATFORM_AUTH_INSTANCE_BEARER_REF, } from './plan/index.js';
45
49
  export { AI_MANAGEMENT_ISSUER, AI_MANAGEMENT_KEY_ID, AI_SIGNING_KEY_REF, AiManagementKeyExistsError, createAiManagementKeyMinter, PLATFORM_AI_MANAGEMENT_KEY_REF, PLATFORM_AI_MANAGEMENT_PERMISSIONS, } from './plan/index.js';
46
50
  export { MissingCallsSfuConnectionError, applyCallsSfuPlatformStep, callsSfuAppliedFingerprint, } from './plan/index.js';
@@ -0,0 +1,6 @@
1
+ -- @wtfalch/foundry: the company's installation of the platform's GitHub App (`HostingConfig.github`).
2
+ -- Mirrors `src/store/schema.ts`'s `hostingGithub`. Additive and nullable, like 0060_hosting_repos.sql:
3
+ -- a row written before it reads as no installation, and an older reader ignores the column.
4
+
5
+ alter table foundry_declared_orgs
6
+ add column if not exists hosting_github jsonb;
@@ -0,0 +1,7 @@
1
+ -- @wtfalch/foundry: `boule_apps` is `org.boule.apps` (F3, F5, F7): the company's Boule installs and runs apps, so
2
+ -- foundry gives it the managed-apps platform keys (edge, sign-in broker registrar, signed-records registrar).
3
+ -- Default false. Additive like 0059_org_builtin_blue_green.sql: `if not exists`, safe to run at container start on
4
+ -- live rows. Mirrors src/store/schema.ts's `declaredOrgs`.
5
+
6
+ alter table foundry_declared_orgs
7
+ add column if not exists boule_apps boolean not null default false;
@@ -0,0 +1,6 @@
1
+ -- @wtfalch/foundry: a company's Boule can request `bouleApps` (turn `org.boule.apps` on or off).
2
+ alter table foundry_requested_changes
3
+ drop constraint if exists foundry_requested_changes_field_check;
4
+ alter table foundry_requested_changes
5
+ add constraint foundry_requested_changes_field_check
6
+ check (field in ('calls', 'customers', 'storageLimit', 'aiLimit', 'domain', 'mailTier', 'app', 'build', 'bouleApps'));
@@ -0,0 +1,32 @@
1
+ -- @wtfalch/foundry: a company's native app settings and its native build runs (foundry#948, estate
2
+ -- `.plans/2026-10-22-app-shells.md`). Additive, like 0060_hosting_repos.sql and
3
+ -- 0055_release_requests.sql: a column with a default plus a new table, so a row written before this
4
+ -- reads back `[]` and an older reader ignores both. Safe on live rows when the container starts.
5
+ --
6
+ -- foundry#951: Boule owns the native settings, build runs and store keys now (estate#262) -- the
7
+ -- column and the table below are unused by this package's code from here on, but foundry#951 also
8
+ -- establishes that a migration only adds in a release where idle and live share a database, so
9
+ -- neither is dropped here. A later release drops both.
10
+
11
+ alter table foundry_declared_orgs
12
+ add column if not exists hosting_native_apps jsonb not null default '[]'::jsonb;
13
+
14
+ create table if not exists foundry_native_build_runs (
15
+ id bigserial primary key,
16
+ org_id text not null,
17
+ app text not null,
18
+ state text not null default 'queued',
19
+ log text,
20
+ created_at timestamptz not null default now(),
21
+ updated_at timestamptz not null default now()
22
+ );
23
+
24
+ alter table foundry_native_build_runs
25
+ drop constraint if exists foundry_native_build_runs_state_check;
26
+ alter table foundry_native_build_runs
27
+ add constraint foundry_native_build_runs_state_check
28
+ check (state in ('queued', 'building', 'uploaded', 'failed'));
29
+
30
+ -- Listing one app's runs, and (while foundry still checked it, before foundry#951) the `uploaded` look-up.
31
+ create index if not exists foundry_native_build_runs_app_idx
32
+ on foundry_native_build_runs (org_id, app, id desc);
@@ -0,0 +1,10 @@
1
+ -- @wtfalch/foundry: `kosmos_enabled` is `org.kosmos.enabled` (foundry#949): the company's own kosmos is set up
2
+ -- only when it asks. `kosmos_blue_green` is `org.kosmos.blueGreen` ({ steps?, stepHoldMinutes? }, as the other
3
+ -- two built-ins' own columns hold it) -- kept even though kosmos always runs blue/green once enabled, so tuning
4
+ -- its steps needs no new column later. Both default to off. Additive like 0059_org_builtin_blue_green.sql and
5
+ -- 0063_boule_apps.sql: `if not exists`, safe to run at container start on live rows.
6
+ -- Mirrors src/store/schema.ts's `declaredOrgs`.
7
+
8
+ alter table foundry_declared_orgs
9
+ add column if not exists kosmos_enabled boolean not null default false,
10
+ add column if not exists kosmos_blue_green jsonb;
@@ -0,0 +1,3 @@
1
+ import type { AppModule } from './types.js';
2
+ /** `uses.ai`: the app calls the AI tasks set up for the company. */
3
+ export declare const ai: AppModule;
@@ -0,0 +1,64 @@
1
+ import { AI_ENTRY_PERMISSIONS, AI_WEBHOOK_PATH } from '../entry-rules.js';
2
+ import { list, setUse, text } from './entry-parts.js';
3
+ /** `uses.ai`: the app calls the AI tasks set up for the company. */
4
+ export const ai = {
5
+ view: {
6
+ id: 'ai',
7
+ name: 'AI',
8
+ line: 'The app uses AI to do work for people, such as writing a summary or reading a document.',
9
+ category: 'AI',
10
+ icon: 'sparkles',
11
+ runtimes: ['server'],
12
+ requires: [],
13
+ availability: 'ready',
14
+ fields: [
15
+ {
16
+ key: 'offerings',
17
+ label: 'AI tasks the app may use',
18
+ help: 'The names of the AI tasks set up for your company.',
19
+ kind: 'list',
20
+ required: true,
21
+ },
22
+ {
23
+ key: 'webhookPath',
24
+ label: 'Page that receives finished AI work',
25
+ help: 'A page on your app, such as /api/ai/done. Leave it empty if the app waits for the answer.',
26
+ kind: 'path',
27
+ advanced: true,
28
+ pattern: AI_WEBHOOK_PATH.source,
29
+ },
30
+ {
31
+ key: 'permissions',
32
+ label: 'What the app may do',
33
+ help: 'Leave it empty to allow all of them.',
34
+ kind: 'list',
35
+ advanced: true,
36
+ choices: AI_ENTRY_PERMISSIONS.map((value) => ({ value, label: value })),
37
+ },
38
+ ],
39
+ adds: [{ name: 'AI tasks', hint: "Run on your company's own AI account." }],
40
+ },
41
+ toEntry(entry, values) {
42
+ if (values === null)
43
+ return setUse(entry, 'ai', undefined);
44
+ const next = { offerings: list(values, 'offerings') ?? [] };
45
+ const permissions = list(values, 'permissions');
46
+ const webhookPath = text(values, 'webhookPath');
47
+ if (permissions)
48
+ next.permissions = permissions;
49
+ if (webhookPath !== undefined)
50
+ next.webhookPath = webhookPath;
51
+ return setUse(entry, 'ai', next);
52
+ },
53
+ fromEntry(entry) {
54
+ const used = entry.uses?.ai;
55
+ if (!used)
56
+ return null;
57
+ const values = { offerings: [...used.offerings] };
58
+ if (used.permissions?.length)
59
+ values.permissions = [...used.permissions];
60
+ if (used.webhookPath !== undefined)
61
+ values.webhookPath = used.webhookPath;
62
+ return values;
63
+ },
64
+ };
@@ -0,0 +1,3 @@
1
+ import type { AppModule } from './types.js';
2
+ /** `uses.auth.mcp`: the app serves AI assistants (MCP clients) that sign the customer in. */
3
+ export declare const assistants: AppModule;
@@ -0,0 +1,72 @@
1
+ import { MCP_PATH, isPagePath } from '../entry-rules.js';
2
+ import { problem, setAuthPart, text } from './entry-parts.js';
3
+ /** `uses.auth.mcp`: the app serves AI assistants (MCP clients) that sign the customer in. */
4
+ export const assistants = {
5
+ view: {
6
+ id: 'assistants',
7
+ name: 'Help for AI assistants',
8
+ line: 'Your customers connect their own AI assistant, such as Claude or ChatGPT, to the app and use it from their chat.',
9
+ category: 'AI',
10
+ icon: 'bot',
11
+ runtimes: ['server', 'worker'],
12
+ requires: ['sign-in'],
13
+ availability: 'ready',
14
+ fields: [
15
+ {
16
+ key: 'path',
17
+ label: 'Where assistants connect',
18
+ help: 'The address on your app that assistants connect to. Most apps use /mcp.',
19
+ kind: 'path',
20
+ required: true,
21
+ default: '/mcp',
22
+ pattern: MCP_PATH.source,
23
+ max: 200,
24
+ },
25
+ {
26
+ key: 'onboardingPath',
27
+ label: 'Page shown after the first sign-in',
28
+ help: 'A page on your app that tells a new customer what to do next, such as /onboarding. Leave it empty for none.',
29
+ kind: 'path',
30
+ advanced: true,
31
+ },
32
+ ],
33
+ adds: [
34
+ {
35
+ name: 'A connection for AI assistants',
36
+ hint: 'Each customer signs in once from their assistant; the assistant then acts as them.',
37
+ },
38
+ ],
39
+ },
40
+ check(values, modules) {
41
+ const signIn = modules['sign-in'];
42
+ if (signIn?.users !== 'customers' || signIn?.registration !== 'open') {
43
+ return problem(null, 'Help for AI assistants needs Sign-in for your customers, where anyone can make an account: each customer connects their own assistant. In Sign-in, choose "Your customers" and "Anyone".');
44
+ }
45
+ const onboarding = text(values, 'onboardingPath');
46
+ if (onboarding !== undefined && !isPagePath(onboarding)) {
47
+ return problem('onboardingPath', 'The page must start with "/", such as /onboarding, with no spaces, "?", "#" or "..".');
48
+ }
49
+ return null;
50
+ },
51
+ toEntry(entry, values) {
52
+ if (values === null)
53
+ return setAuthPart(entry, 'mcp', undefined);
54
+ if (!entry.uses?.auth) {
55
+ return problem(null, 'Help for AI assistants needs Sign-in. Turn on Sign-in first.');
56
+ }
57
+ const onboardingPath = text(values, 'onboardingPath');
58
+ return setAuthPart(entry, 'mcp', {
59
+ path: values.path,
60
+ ...(onboardingPath !== undefined ? { onboardingPath } : {}),
61
+ });
62
+ },
63
+ fromEntry(entry) {
64
+ const mcp = entry.uses?.auth?.mcp;
65
+ if (!mcp)
66
+ return null;
67
+ const values = { path: mcp.path };
68
+ if (mcp.onboardingPath !== undefined)
69
+ values.onboardingPath = mcp.onboardingPath;
70
+ return values;
71
+ },
72
+ };
@@ -0,0 +1,29 @@
1
+ import type { WorkerAppConfig } from '../worker-app-config.js';
2
+ /**
3
+ * What `uses.audit` derives from the pinned `@wtfalch/audit`, so an app never lists it by hand (foundry#929).
4
+ *
5
+ * The package is installed under the alias `@wtfalch/audit-sealing` because foundry's own ledger still runs the
6
+ * 0.6.0 migrations (`@wtfalch/audit`, migrations 0012 and 0024-0028 here); the sealing service needs the
7
+ * checkpoint, anchor and bundle code that came after. `audit/ledger-set.test.ts` checks every name below against the
8
+ * installed package's own migrations, so a bump that renames one fails there and not in a company's database.
9
+ */
10
+ /** The version the lists below were read from. */
11
+ export declare const AUDIT_PACKAGE_VERSION = "0.14.0";
12
+ /** Insert and read only: the runtime role has UPDATE, DELETE and TRUNCATE revoked on each. */
13
+ export declare const AUDIT_APPEND_ONLY_TABLES: readonly string[];
14
+ /**
15
+ * What the app's runtime role may run: the two functions the chain is written through. Not granted: the erase
16
+ * functions (`audit_erase_person`, `audit_seal_erasure`, `audit_pending_erasures`), because they change what the
17
+ * ledger shows and whether the app may call them is an open decision (foundry#929 item 10); and the sealing
18
+ * functions (`audit_chain_leaves`, `audit_retire_signing_key`), which only the platform's sealing role runs.
19
+ */
20
+ export declare const AUDIT_APP_GRANTS: readonly string[];
21
+ /** What the platform's sealing role runs, beside the app's own: reads every leaf, retires a signing key. */
22
+ export declare const AUDIT_SEALER_GRANTS: readonly string[];
23
+ type Database = NonNullable<WorkerAppConfig['database']>;
24
+ /**
25
+ * The database part with the derived tables and grants in (`on`) or out (`off`). Hand-listed names are kept, a
26
+ * name is never listed twice, and turning it off takes out exactly the derived names. Never changes `database`.
27
+ */
28
+ export declare function withAuditDatabase(database: Database, on: boolean): Database;
29
+ export {};
@@ -0,0 +1,49 @@
1
+ /**
2
+ * What `uses.audit` derives from the pinned `@wtfalch/audit`, so an app never lists it by hand (foundry#929).
3
+ *
4
+ * The package is installed under the alias `@wtfalch/audit-sealing` because foundry's own ledger still runs the
5
+ * 0.6.0 migrations (`@wtfalch/audit`, migrations 0012 and 0024-0028 here); the sealing service needs the
6
+ * checkpoint, anchor and bundle code that came after. `audit/ledger-set.test.ts` checks every name below against the
7
+ * installed package's own migrations, so a bump that renames one fails there and not in a company's database.
8
+ */
9
+ /** The version the lists below were read from. */
10
+ export const AUDIT_PACKAGE_VERSION = '0.14.0';
11
+ /** Insert and read only: the runtime role has UPDATE, DELETE and TRUNCATE revoked on each. */
12
+ export const AUDIT_APPEND_ONLY_TABLES = [
13
+ 'audit_events',
14
+ 'audit_checkpoints',
15
+ 'audit_signing_keys',
16
+ 'audit_anchors',
17
+ ];
18
+ /**
19
+ * What the app's runtime role may run: the two functions the chain is written through. Not granted: the erase
20
+ * functions (`audit_erase_person`, `audit_seal_erasure`, `audit_pending_erasures`), because they change what the
21
+ * ledger shows and whether the app may call them is an open decision (foundry#929 item 10); and the sealing
22
+ * functions (`audit_chain_leaves`, `audit_retire_signing_key`), which only the platform's sealing role runs.
23
+ */
24
+ export const AUDIT_APP_GRANTS = ['audit_chain_tail()', 'audit_chain_tail_v2()'];
25
+ /** What the platform's sealing role runs, beside the app's own: reads every leaf, retires a signing key. */
26
+ export const AUDIT_SEALER_GRANTS = [
27
+ 'audit_chain_leaves(bigint, integer)',
28
+ 'audit_retire_signing_key(text)',
29
+ ];
30
+ const without = (list, drop) => (list ?? []).filter((item) => !drop.includes(item));
31
+ /**
32
+ * The database part with the derived tables and grants in (`on`) or out (`off`). Hand-listed names are kept, a
33
+ * name is never listed twice, and turning it off takes out exactly the derived names. Never changes `database`.
34
+ */
35
+ export function withAuditDatabase(database, on) {
36
+ const { appendOnly: _tables, grants: _grants, ...rest } = database;
37
+ const next = rest;
38
+ const appendOnly = on
39
+ ? [...AUDIT_APPEND_ONLY_TABLES, ...without(database.appendOnly, AUDIT_APPEND_ONLY_TABLES)]
40
+ : without(database.appendOnly, AUDIT_APPEND_ONLY_TABLES);
41
+ const grants = on
42
+ ? [...AUDIT_APP_GRANTS, ...without(database.grants, AUDIT_APP_GRANTS)]
43
+ : without(database.grants, AUDIT_APP_GRANTS);
44
+ if (appendOnly.length > 0)
45
+ next.appendOnly = appendOnly;
46
+ if (grants.length > 0)
47
+ next.grants = grants;
48
+ return next;
49
+ }
@@ -0,0 +1,7 @@
1
+ import type { AppModule } from './types.js';
2
+ /**
3
+ * `uses.audit`: the app keeps a tamper-evident audit log. Applied after `database`, which it needs: it adds the
4
+ * derived append-only tables and chain functions to the Worker app's database part (`modules/audit-ledger.ts`) and
5
+ * registers the app's ledger for the platform's sealing service. Turning it off takes out only what it added.
6
+ */
7
+ export declare const audit: AppModule;
@@ -0,0 +1,44 @@
1
+ import { withAuditDatabase } from './audit-ledger.js';
2
+ import { setUse, withWorkerApp } from './entry-parts.js';
3
+ /**
4
+ * `uses.audit`: the app keeps a tamper-evident audit log. Applied after `database`, which it needs: it adds the
5
+ * derived append-only tables and chain functions to the Worker app's database part (`modules/audit-ledger.ts`) and
6
+ * registers the app's ledger for the platform's sealing service. Turning it off takes out only what it added.
7
+ */
8
+ export const audit = {
9
+ view: {
10
+ id: 'audit',
11
+ name: 'Audit log',
12
+ line: 'The app keeps a record of what happened that nobody can quietly change afterwards, not even us or your developers.',
13
+ category: 'Data',
14
+ icon: 'shield',
15
+ runtimes: ['worker'],
16
+ requires: ['database'],
17
+ availability: 'ready',
18
+ fields: [],
19
+ adds: [
20
+ {
21
+ name: 'A tamper-evident log',
22
+ hint: 'Each entry is chained to the one before it. The app can add and read entries but never change or delete them.',
23
+ },
24
+ {
25
+ name: 'Regular seals and outside time stamps',
26
+ hint: 'The platform signs the log on a schedule with a key the app never holds, and has an independent time authority stamp each seal.',
27
+ },
28
+ {
29
+ name: 'A proof you can check yourself',
30
+ hint: 'Download the log with its seals and check it offline, without trusting us.',
31
+ },
32
+ ],
33
+ },
34
+ toEntry(entry, values) {
35
+ const on = values !== null;
36
+ // Off takes out the derived names only when the entry had the module on: an app that still lists the
37
+ // same tables and grants by hand, and has not switched, keeps them.
38
+ if (!on && entry.uses?.audit !== true)
39
+ return setUse(entry, 'audit', undefined);
40
+ const withUse = setUse(entry, 'audit', on ? true : undefined);
41
+ return withWorkerApp(withUse, (app) => app.database ? { ...app, database: withAuditDatabase(app.database, on) } : app);
42
+ },
43
+ fromEntry: (entry) => (entry.uses?.audit === true ? {} : null),
44
+ };
@@ -0,0 +1,23 @@
1
+ import type { AppModule, ModuleProblem, ModuleValues } from './types.js';
2
+ /** Which copy of a Worker app a database is for. */
3
+ export type DatabaseCopy = 'workspace' | 'live';
4
+ /** One copy's Postgres: migrations run as the owner, the app (through Hyperdrive) as the runtime user. */
5
+ export interface DatabaseAddresses {
6
+ ownerUrl: string;
7
+ runtimeUrl: string;
8
+ }
9
+ /**
10
+ * The owner and runtime addresses of one copy's Postgres, for `applyWorkerAppMigrations` and `deployWorkerApp`
11
+ * (`database.url = runtimeUrl`). Null when the values give neither address of that copy; a problem, in plain
12
+ * words that never repeat an address, when one is missing, is not a Postgres address, uses the owner's user,
13
+ * or reaches another database than the owner.
14
+ */
15
+ export declare function databaseAddressesOf(values: ModuleValues, copy: DatabaseCopy): DatabaseAddresses | ModuleProblem | null;
16
+ /**
17
+ * A Postgres database for the app. A server app: `entry.database`. A Worker app: `workerApp.database`, reached
18
+ * through Hyperdrive, with its append-only tables and function grants. `migrationsSha256` is not a field: it
19
+ * comes from the build (`build.json`) and is kept as the entry holds it. A Worker app uses the company's own
20
+ * Postgres: an owner and an app address per copy, `secret` fields the caller holds and delivers itself. They
21
+ * never go into the entry, so `fromEntry` (and `modulesOf`) never gives them back.
22
+ */
23
+ export declare const database: AppModule;