@wtfalch/foundry 0.60.0 → 0.61.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.
- package/dist/apps/cloudflare.d.ts +173 -0
- package/dist/apps/cloudflare.js +17 -0
- package/dist/apps/deploy.d.ts +116 -0
- package/dist/apps/deploy.js +791 -0
- package/dist/apps/github.d.ts +47 -0
- package/dist/apps/github.js +201 -0
- package/dist/apps/index.d.ts +9 -0
- package/dist/apps/index.js +9 -0
- package/dist/apps/migrations.d.ts +110 -0
- package/dist/apps/migrations.js +458 -0
- package/dist/audit/connector.d.ts +43 -0
- package/dist/audit/connector.js +22 -0
- package/dist/audit/evidence.d.ts +49 -0
- package/dist/audit/evidence.js +56 -0
- package/dist/audit/index.d.ts +9 -0
- package/dist/audit/index.js +9 -0
- package/dist/audit/migrations.d.ts +5 -0
- package/dist/audit/migrations.js +5 -0
- package/dist/audit/registry.d.ts +49 -0
- package/dist/audit/registry.js +44 -0
- package/dist/audit/seal.d.ts +49 -0
- package/dist/audit/seal.js +131 -0
- package/dist/audit/sealer-role.d.ts +33 -0
- package/dist/audit/sealer-role.js +56 -0
- package/dist/audit/signer.d.ts +40 -0
- package/dist/audit/signer.js +78 -0
- package/dist/audit/tick.d.ts +36 -0
- package/dist/audit/tick.js +87 -0
- package/dist/catalogue/copy-en.d.ts +1 -0
- package/dist/catalogue/copy-en.js +129 -0
- package/dist/catalogue/index.d.ts +9 -0
- package/dist/catalogue/index.js +21 -0
- package/dist/catalogue/integrations.d.ts +4 -0
- package/dist/catalogue/integrations.js +104 -0
- package/dist/catalogue/systems.d.ts +7 -0
- package/dist/catalogue/systems.js +31 -0
- package/dist/catalogue/types.d.ts +110 -0
- package/dist/catalogue/types.js +1 -0
- package/dist/entry-rules.d.ts +53 -0
- package/dist/entry-rules.js +71 -0
- package/dist/hosted-label.d.ts +13 -0
- package/dist/hosted-label.js +81 -0
- package/dist/index.d.ts +10 -5
- package/dist/index.js +5 -3
- package/dist/migrations/0062_hosting_github.sql +6 -0
- package/dist/migrations/0063_boule_apps.sql +7 -0
- package/dist/migrations/0064_requested_changes_boule_apps.sql +6 -0
- package/dist/modules/ai.d.ts +3 -0
- package/dist/modules/ai.js +64 -0
- package/dist/modules/assistants.d.ts +3 -0
- package/dist/modules/assistants.js +72 -0
- package/dist/modules/audit-ledger.d.ts +29 -0
- package/dist/modules/audit-ledger.js +49 -0
- package/dist/modules/audit.d.ts +7 -0
- package/dist/modules/audit.js +44 -0
- package/dist/modules/database.d.ts +23 -0
- package/dist/modules/database.js +189 -0
- package/dist/modules/email.d.ts +3 -0
- package/dist/modules/email.js +18 -0
- package/dist/modules/entry-parts.d.ts +23 -0
- package/dist/modules/entry-parts.js +63 -0
- package/dist/modules/files.d.ts +3 -0
- package/dist/modules/files.js +64 -0
- package/dist/modules/index.d.ts +74 -0
- package/dist/modules/index.js +774 -0
- package/dist/modules/jobs.d.ts +3 -0
- package/dist/modules/jobs.js +23 -0
- package/dist/modules/organisations.d.ts +3 -0
- package/dist/modules/organisations.js +20 -0
- package/dist/modules/outputs.d.ts +9 -0
- package/dist/modules/outputs.js +38 -0
- package/dist/modules/sign-in.d.ts +3 -0
- package/dist/modules/sign-in.js +197 -0
- package/dist/modules/signed-records.d.ts +3 -0
- package/dist/modules/signed-records.js +32 -0
- package/dist/modules/types.d.ts +194 -0
- package/dist/modules/types.js +1 -0
- package/dist/modules/workspaces.d.ts +3 -0
- package/dist/modules/workspaces.js +75 -0
- package/dist/org.d.ts +163 -22
- package/dist/org.js +419 -47
- package/dist/plan/apps-db-route.d.ts +90 -0
- package/dist/plan/apps-db-route.js +168 -0
- package/dist/plan/apps-zones.d.ts +56 -0
- package/dist/plan/apps-zones.js +118 -0
- package/dist/plan/archon-blue-green.js +11 -1
- package/dist/plan/blue-green-apply.d.ts +37 -1
- package/dist/plan/blue-green-apply.js +55 -15
- package/dist/plan/blue-green.d.ts +41 -1
- package/dist/plan/blue-green.js +80 -2
- package/dist/plan/boule.d.ts +23 -1
- package/dist/plan/boule.js +35 -2
- package/dist/plan/broker-entries.d.ts +28 -3
- package/dist/plan/broker-entries.js +74 -3
- package/dist/plan/broker-registrar.d.ts +168 -0
- package/dist/plan/broker-registrar.js +440 -0
- package/dist/plan/broker-workspaces-database.d.ts +48 -0
- package/dist/plan/broker-workspaces-database.js +87 -0
- package/dist/plan/desktop-callback.js +12 -7
- package/dist/plan/diff.d.ts +8 -2
- package/dist/plan/diff.js +373 -42
- package/dist/plan/edge-access.d.ts +6 -0
- package/dist/plan/edge-dns.d.ts +6 -0
- package/dist/plan/edge-dns.js +9 -7
- package/dist/plan/entry-ai-key.d.ts +1 -1
- package/dist/plan/entry-ai-key.js +2 -2
- package/dist/plan/entry-audit.d.ts +58 -0
- package/dist/plan/entry-audit.js +122 -0
- package/dist/plan/entry-customer-grants.d.ts +75 -0
- package/dist/plan/entry-customer-grants.js +154 -0
- package/dist/plan/entry-edge-key.d.ts +26 -1
- package/dist/plan/entry-edge-key.js +42 -3
- package/dist/plan/entry-jobs.d.ts +64 -0
- package/dist/plan/entry-jobs.js +92 -0
- package/dist/plan/entry-repo-key-apply.d.ts +55 -0
- package/dist/plan/entry-repo-key-apply.js +185 -0
- package/dist/plan/entry-repo-key.d.ts +92 -0
- package/dist/plan/entry-repo-key.js +235 -0
- package/dist/plan/entry-workspaces.d.ts +55 -0
- package/dist/plan/entry-workspaces.js +90 -0
- package/dist/plan/executor.d.ts +191 -1
- package/dist/plan/executor.js +1505 -90
- package/dist/plan/gates.d.ts +1 -1
- package/dist/plan/gates.js +62 -9
- package/dist/plan/github-deploy-keys.d.ts +78 -0
- package/dist/plan/github-deploy-keys.js +305 -0
- package/dist/plan/github-source.d.ts +53 -0
- package/dist/plan/github-source.js +140 -0
- package/dist/plan/held-key-refs.d.ts +12 -0
- package/dist/plan/held-key-refs.js +12 -0
- package/dist/plan/hostnames.d.ts +9 -0
- package/dist/plan/hostnames.js +28 -1
- package/dist/plan/index.d.ts +9 -0
- package/dist/plan/index.js +6 -0
- package/dist/plan/jobs-scheduler-http.js +3 -0
- package/dist/plan/keys-registrar-http.d.ts +32 -0
- package/dist/plan/keys-registrar-http.js +105 -0
- package/dist/plan/keys-registrar.d.ts +67 -0
- package/dist/plan/keys-registrar.js +103 -0
- package/dist/plan/live.d.ts +1 -1
- package/dist/plan/locked-hostnames.d.ts +2 -2
- package/dist/plan/locked-hostnames.js +2 -2
- package/dist/plan/login-host.js +11 -5
- package/dist/plan/machine-paths.d.ts +36 -0
- package/dist/plan/machine-paths.js +137 -0
- package/dist/plan/mcp.d.ts +1 -1
- package/dist/plan/mcp.js +49 -17
- package/dist/plan/org-apps-admin.d.ts +108 -0
- package/dist/plan/org-apps-admin.js +434 -0
- package/dist/plan/org-names.js +12 -1
- package/dist/plan/own-diff.d.ts +23 -0
- package/dist/plan/own-diff.js +53 -0
- package/dist/plan/own-hostnames.d.ts +2 -0
- package/dist/plan/own-hostnames.js +1 -0
- package/dist/plan/own-jobs-route.d.ts +47 -0
- package/dist/plan/own-jobs-route.js +91 -0
- package/dist/plan/own-services.d.ts +4 -0
- package/dist/plan/own-services.js +4 -0
- package/dist/plan/plan-apply.d.ts +39 -0
- package/dist/plan/plan-apply.js +163 -9
- package/dist/plan/platform-diff.d.ts +2 -2
- package/dist/plan/platform-diff.js +7 -2
- package/dist/plan/platform-org.d.ts +30 -0
- package/dist/plan/platform-org.js +12 -1
- package/dist/plan/platform-providers.d.ts +2 -0
- package/dist/plan/platform-providers.js +7 -2
- package/dist/plan/post-logout-uris.js +7 -1
- package/dist/plan/private-pages.d.ts +26 -0
- package/dist/plan/private-pages.js +39 -0
- package/dist/plan/proxy-labels.d.ts +12 -1
- package/dist/plan/proxy-labels.js +32 -2
- package/dist/plan/release-host.d.ts +6 -2
- package/dist/plan/release-host.js +36 -8
- package/dist/plan/stage-env.d.ts +19 -1
- package/dist/plan/stage-env.js +25 -1
- package/dist/plan/stage-guards.d.ts +20 -0
- package/dist/plan/stage-guards.js +24 -0
- package/dist/plan/stage-isolation.d.ts +24 -0
- package/dist/plan/stage-isolation.js +29 -1
- package/dist/plan/worker-app-database.d.ts +46 -42
- package/dist/plan/worker-app-database.js +150 -153
- package/dist/plan/worker-app.d.ts +5 -65
- package/dist/plan/worker-app.js +28 -105
- package/dist/plan/worker.d.ts +2 -2
- package/dist/plan/worker.js +2 -1
- package/dist/plan/workspace-client.d.ts +25 -0
- package/dist/plan/workspace-client.js +48 -0
- package/dist/plan/workspace-sign-in.d.ts +55 -0
- package/dist/plan/workspace-sign-in.js +273 -0
- package/dist/plan/workspace-worker.d.ts +4 -0
- package/dist/plan/workspace-worker.js +13 -0
- package/dist/plan/workspace.d.ts +101 -0
- package/dist/plan/workspace.js +305 -0
- package/dist/release/decide.d.ts +30 -1
- package/dist/release/decide.js +73 -11
- package/dist/release/health.d.ts +8 -3
- package/dist/release/health.js +58 -5
- package/dist/release/run.d.ts +2 -5
- package/dist/release/run.js +4 -0
- package/dist/release/state.d.ts +3 -1
- package/dist/release/state.js +6 -0
- package/dist/release/types.d.ts +20 -0
- package/dist/requested-changes.d.ts +11 -2
- package/dist/requested-changes.js +11 -0
- package/dist/service-labels.d.ts +4 -0
- package/dist/service-labels.js +11 -0
- package/dist/slug.d.ts +2 -0
- package/dist/slug.js +10 -6
- package/dist/store/postgres.js +12 -2
- package/dist/store/schema.d.ts +37 -1
- package/dist/store/schema.js +4 -0
- package/dist/worker-app-config.d.ts +1 -11
- package/dist/worker-app-config.js +4 -17
- package/dist/worker-app-migrations.d.ts +105 -0
- package/dist/worker-app-migrations.js +166 -0
- package/dist/worker-app-upload.d.ts +103 -0
- package/dist/worker-app-upload.js +128 -0
- package/package.json +18 -1
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/** Helpers the modules share to change one part of an entry without touching the caller's copy. */
|
|
2
|
+
export const clone = (value) => structuredClone(value);
|
|
3
|
+
/** A copy of `value` without `keys`. */
|
|
4
|
+
export function omit(value, ...keys) {
|
|
5
|
+
const drop = new Set(keys);
|
|
6
|
+
return Object.fromEntries(Object.entries(clone(value)).filter(([key]) => !drop.has(key)));
|
|
7
|
+
}
|
|
8
|
+
export const isProblem = (value) => 'message' in value && typeof value.message === 'string';
|
|
9
|
+
/** The entry with `uses` replaced; an empty `uses` is left out. */
|
|
10
|
+
export function withUses(entry, uses) {
|
|
11
|
+
if (Object.keys(uses).length === 0)
|
|
12
|
+
return omit(entry, 'uses');
|
|
13
|
+
return { ...clone(entry), uses };
|
|
14
|
+
}
|
|
15
|
+
/** The entry with `uses[key]` set, or removed when `value` is undefined. */
|
|
16
|
+
export function setUse(entry, key, value) {
|
|
17
|
+
const uses = clone(entry.uses ?? {});
|
|
18
|
+
if (value === undefined)
|
|
19
|
+
delete uses[key];
|
|
20
|
+
else
|
|
21
|
+
uses[key] = value;
|
|
22
|
+
return withUses(entry, uses);
|
|
23
|
+
}
|
|
24
|
+
/** The entry with `uses.auth[key]` changed. Without `uses.auth` the entry comes back unchanged. */
|
|
25
|
+
export function setAuthPart(entry, key, value) {
|
|
26
|
+
const auth = entry.uses?.auth;
|
|
27
|
+
if (!auth)
|
|
28
|
+
return clone(entry);
|
|
29
|
+
const next = clone(auth);
|
|
30
|
+
if (value === undefined)
|
|
31
|
+
delete next[key];
|
|
32
|
+
else
|
|
33
|
+
next[key] = value;
|
|
34
|
+
return setUse(entry, 'auth', next);
|
|
35
|
+
}
|
|
36
|
+
/** The entry with its `workerApp` replaced by `change`'s result. Without a `workerApp` the entry comes back unchanged. */
|
|
37
|
+
export function withWorkerApp(entry, change) {
|
|
38
|
+
if (!entry.workerApp)
|
|
39
|
+
return clone(entry);
|
|
40
|
+
return { ...clone(entry), workerApp: change(clone(entry.workerApp)) };
|
|
41
|
+
}
|
|
42
|
+
/** A text value, or undefined for an absent or empty one. */
|
|
43
|
+
export function text(values, key) {
|
|
44
|
+
const value = values[key];
|
|
45
|
+
return typeof value === 'string' && value !== '' ? value : undefined;
|
|
46
|
+
}
|
|
47
|
+
/** A list value, or undefined for an absent or empty one. */
|
|
48
|
+
export function list(values, key) {
|
|
49
|
+
const value = values[key];
|
|
50
|
+
return Array.isArray(value) && value.length > 0 ? [...value] : undefined;
|
|
51
|
+
}
|
|
52
|
+
/** `values` without the keys whose value is undefined. */
|
|
53
|
+
export function defined(values) {
|
|
54
|
+
const out = {};
|
|
55
|
+
for (const [key, value] of Object.entries(values))
|
|
56
|
+
if (value !== undefined)
|
|
57
|
+
out[key] = value;
|
|
58
|
+
return out;
|
|
59
|
+
}
|
|
60
|
+
export const problem = (field, message) => ({
|
|
61
|
+
field,
|
|
62
|
+
message,
|
|
63
|
+
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { FILES_COLLECTION_NAME, FILES_ENTRY_PERMISSIONS } from '../entry-rules.js';
|
|
2
|
+
import { list, setUse } from './entry-parts.js';
|
|
3
|
+
/** `uses.files`: the app keeps files (uploads, documents) in folders of its own. */
|
|
4
|
+
export const files = {
|
|
5
|
+
view: {
|
|
6
|
+
id: 'files',
|
|
7
|
+
name: 'Files',
|
|
8
|
+
line: 'The app keeps files people upload, such as documents and pictures.',
|
|
9
|
+
category: 'Data',
|
|
10
|
+
icon: 'folder',
|
|
11
|
+
runtimes: ['server'],
|
|
12
|
+
requires: [],
|
|
13
|
+
availability: 'ready',
|
|
14
|
+
fields: [
|
|
15
|
+
{
|
|
16
|
+
key: 'collections',
|
|
17
|
+
label: 'Folders',
|
|
18
|
+
help: 'A name for each kind of file the app keeps, in capital letters, such as INVOICES or PHOTOS.',
|
|
19
|
+
kind: 'list',
|
|
20
|
+
required: true,
|
|
21
|
+
pattern: FILES_COLLECTION_NAME.source,
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
key: 'shareHost',
|
|
25
|
+
label: 'Share links on your own address',
|
|
26
|
+
help: 'Links to shared files start with share. and your domain. Needs your own domain.',
|
|
27
|
+
kind: 'switch',
|
|
28
|
+
advanced: true,
|
|
29
|
+
default: false,
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
key: 'permissions',
|
|
33
|
+
label: 'What the app may do with files',
|
|
34
|
+
help: 'Leave it empty to allow all of them.',
|
|
35
|
+
kind: 'list',
|
|
36
|
+
advanced: true,
|
|
37
|
+
choices: FILES_ENTRY_PERMISSIONS.map((value) => ({ value, label: value })),
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
adds: [{ name: 'File storage', hint: 'Only this app reaches its folders.' }],
|
|
41
|
+
},
|
|
42
|
+
toEntry(entry, values) {
|
|
43
|
+
if (values === null)
|
|
44
|
+
return setUse(entry, 'files', undefined);
|
|
45
|
+
const next = { collections: list(values, 'collections') ?? [] };
|
|
46
|
+
const permissions = list(values, 'permissions');
|
|
47
|
+
if (permissions)
|
|
48
|
+
next.permissions = permissions;
|
|
49
|
+
if (values.shareHost === true)
|
|
50
|
+
next.shareHost = true;
|
|
51
|
+
return setUse(entry, 'files', next);
|
|
52
|
+
},
|
|
53
|
+
fromEntry(entry) {
|
|
54
|
+
const used = entry.uses?.files;
|
|
55
|
+
if (!used)
|
|
56
|
+
return null;
|
|
57
|
+
const values = { collections: [...used.collections] };
|
|
58
|
+
if (used.permissions?.length)
|
|
59
|
+
values.permissions = [...used.permissions];
|
|
60
|
+
if (used.shareHost !== undefined)
|
|
61
|
+
values.shareHost = used.shareHost;
|
|
62
|
+
return values;
|
|
63
|
+
},
|
|
64
|
+
};
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { HostingEntry } from '../org.js';
|
|
2
|
+
import type { AppManifest, AppModule, AppModules, ManifestAnswer, ModuleContext, ModuleRefusal, ModuleView } from './types.js';
|
|
3
|
+
export type * from './types.js';
|
|
4
|
+
export { type DatabaseAddresses, type DatabaseCopy, databaseAddressesOf } from './database.js';
|
|
5
|
+
/**
|
|
6
|
+
* Every module, in the order they are applied: a module comes after the ones it needs, so sign-in sets
|
|
7
|
+
* `uses.auth` before help for AI assistants and workspaces add to it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const MODULES: readonly AppModule[];
|
|
10
|
+
/** The views of every module, JSON-safe, for Boule to render. */
|
|
11
|
+
export declare function modulesCatalogue(): ModuleView[];
|
|
12
|
+
/**
|
|
13
|
+
* Null when the modules can be turned on together for an app on `ctx.runtime`; else the first problem, in
|
|
14
|
+
* words a company person can act on.
|
|
15
|
+
*/
|
|
16
|
+
export declare function checkModules(modules: AppModules, ctx: ModuleContext): ModuleRefusal | null;
|
|
17
|
+
export type ApplyModulesResult = {
|
|
18
|
+
ok: true;
|
|
19
|
+
entry: HostingEntry;
|
|
20
|
+
} | ({
|
|
21
|
+
ok: false;
|
|
22
|
+
} & ModuleRefusal);
|
|
23
|
+
/**
|
|
24
|
+
* `entry` with each module in `modules` set and every part an absent module owns removed. The rest of the
|
|
25
|
+
* entry (its build, address, env) is kept as it is. The caller still validates the whole company
|
|
26
|
+
* (`validateHosting`).
|
|
27
|
+
*/
|
|
28
|
+
export declare function applyModules(entry: HostingEntry, modules: AppModules, ctx: ModuleContext): ApplyModulesResult;
|
|
29
|
+
/** The modules `entry` has, with their values: the inverse of {@link applyModules}. */
|
|
30
|
+
export declare function modulesOf(entry: HostingEntry): AppModules;
|
|
31
|
+
export type ParseAppManifestResult = {
|
|
32
|
+
ok: true;
|
|
33
|
+
/** Always v2: a v1 file is read as v2 with its fields mapped. */
|
|
34
|
+
manifest: AppManifest;
|
|
35
|
+
/** The version the file itself was written in. */
|
|
36
|
+
from: 1 | 2;
|
|
37
|
+
} | {
|
|
38
|
+
ok: false;
|
|
39
|
+
message: string;
|
|
40
|
+
};
|
|
41
|
+
/** `company-app.json` (v1 or v2) read and checked: what the app's code asks for. */
|
|
42
|
+
export declare function parseAppManifest(json: unknown): ParseAppManifestResult;
|
|
43
|
+
export interface ManifestProblem {
|
|
44
|
+
/** The value's key, or null for a problem between them. */
|
|
45
|
+
key: string | null;
|
|
46
|
+
message: string;
|
|
47
|
+
}
|
|
48
|
+
/** What an install of the app is made from. Asked secrets are in `secrets`; hold them, never log them. */
|
|
49
|
+
export interface ManifestInstall {
|
|
50
|
+
/** The modules with the answers that fill module fields applied. */
|
|
51
|
+
modules: AppModules;
|
|
52
|
+
/** Environment name -> plain text for the app: defaults and answers. A list is its items joined by ",". */
|
|
53
|
+
plain: Record<string, string>;
|
|
54
|
+
/** Environment name -> a secret the company typed. */
|
|
55
|
+
secrets: Record<string, string>;
|
|
56
|
+
/** Environment name -> how the platform makes it. */
|
|
57
|
+
generate: Record<string, 'token' | 'hex' | 'uuid'>;
|
|
58
|
+
/** Environment name -> the output it is read from. */
|
|
59
|
+
references: Record<string, {
|
|
60
|
+
to: string;
|
|
61
|
+
secret: boolean;
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
64
|
+
export type CheckManifestAnswersResult = ({
|
|
65
|
+
ok: true;
|
|
66
|
+
} & ManifestInstall) | {
|
|
67
|
+
ok: false;
|
|
68
|
+
problems: ManifestProblem[];
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* The company's answers checked against the manifest: a required question left empty blocks the install,
|
|
72
|
+
* and every answer must fit its question. Questions with a default may be left out of `answers`.
|
|
73
|
+
*/
|
|
74
|
+
export declare function checkManifestAnswers(manifest: AppManifest, answers: Record<string, ManifestAnswer>): CheckManifestAnswersResult;
|