@fabrika/provider-zerops 0.9.0-dev.1 → 0.9.0-dev.2
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/package.json +15 -14
- package/src/execution.ts +45 -8
- package/types/src/api/client.d.ts +5 -0
- package/types/src/api/errors.d.ts +24 -0
- package/types/src/api/polling.d.ts +41 -0
- package/types/src/api/readers.d.ts +977 -0
- package/types/src/api/service-env-limit.d.ts +17 -0
- package/types/src/api/service-env-response.d.ts +23 -0
- package/types/src/api/types.d.ts +638 -0
- package/types/src/api.d.ts +6 -0
- package/types/src/authoring.d.ts +9 -0
- package/types/src/cli-args.d.ts +19 -0
- package/types/src/cli.d.ts +10 -0
- package/types/src/collaborators.d.ts +18 -0
- package/types/src/compile.d.ts +91 -0
- package/types/src/control.d.ts +41 -0
- package/types/src/database-budget.d.ts +38 -0
- package/types/src/descriptor.d.ts +28 -0
- package/types/src/execution.d.ts +137 -0
- package/types/src/exposure.d.ts +47 -0
- package/types/src/index.d.ts +31 -0
- package/types/src/installation/admin-options.d.ts +24 -0
- package/types/src/installation/admin.d.ts +35 -0
- package/types/src/installation/checker-release.d.ts +12 -0
- package/types/src/installation/deploy-options.d.ts +37 -0
- package/types/src/installation/deploy.d.ts +96 -0
- package/types/src/installation/generated/platform-console-schema.d.ts +2 -0
- package/types/src/installation/generated/platform-proxy-manifest.d.ts +2 -0
- package/types/src/installation/hosts.d.ts +38 -0
- package/types/src/installation/index.d.ts +9 -0
- package/types/src/installation/init-options.d.ts +38 -0
- package/types/src/installation/init.d.ts +60 -0
- package/types/src/installation/install-collaborators.d.ts +24 -0
- package/types/src/installation/install-environment.d.ts +70 -0
- package/types/src/installation/install-options.d.ts +49 -0
- package/types/src/installation/install-project.d.ts +13 -0
- package/types/src/installation/install-provisioning.d.ts +58 -0
- package/types/src/installation/install-secrets.d.ts +30 -0
- package/types/src/installation/install-token.d.ts +10 -0
- package/types/src/installation/install.d.ts +23 -0
- package/types/src/installation/installation-source.d.ts +8 -0
- package/types/src/installation/log.d.ts +44 -0
- package/types/src/installation/machine-key.d.ts +19 -0
- package/types/src/installation/mcp.d.ts +18 -0
- package/types/src/installation/placement-options.d.ts +11 -0
- package/types/src/installation/platform-archive.d.ts +7 -0
- package/types/src/installation/platform-source.d.ts +8 -0
- package/types/src/installation/platform-upload.d.ts +3 -0
- package/types/src/installation/proxy-manifest.d.ts +105 -0
- package/types/src/installation/secrets.d.ts +17 -0
- package/types/src/installation/sidecar.d.ts +51 -0
- package/types/src/installation/source-options.d.ts +1 -0
- package/types/src/installation/topology/artifacts.d.ts +8 -0
- package/types/src/installation/topology/index.d.ts +5 -0
- package/types/src/installation/topology/installation-schemas.d.ts +2242 -0
- package/types/src/installation/topology/invariants.d.ts +23 -0
- package/types/src/installation/topology/setups.d.ts +58 -0
- package/types/src/installation/topology/topology.d.ts +148 -0
- package/types/src/installation/topology/validate.d.ts +11 -0
- package/types/src/installation/upgrade-options.d.ts +26 -0
- package/types/src/installation/upgrade-output.d.ts +6 -0
- package/types/src/installation/upgrade.d.ts +88 -0
- package/types/src/managed-env.d.ts +57 -0
- package/types/src/manifest.d.ts +206 -0
- package/types/src/namespace/claims.d.ts +3 -0
- package/types/src/namespace/codec.d.ts +334 -0
- package/types/src/namespace/constants.d.ts +25 -0
- package/types/src/namespace/errors.d.ts +15 -0
- package/types/src/namespace/manifest.d.ts +4 -0
- package/types/src/namespace/operator.d.ts +12 -0
- package/types/src/namespace/provisioning.d.ts +4 -0
- package/types/src/namespace/proxy-attempt.d.ts +36 -0
- package/types/src/namespace/proxy-reads.d.ts +33 -0
- package/types/src/namespace/proxy-secrets.d.ts +8 -0
- package/types/src/namespace/proxy-source.d.ts +74 -0
- package/types/src/namespace/topology.d.ts +9 -0
- package/types/src/namespace/types.d.ts +99 -0
- package/types/src/namespace/update.d.ts +6 -0
- package/types/src/namespace/validation.d.ts +12 -0
- package/types/src/namespace.d.ts +9 -0
- package/types/src/plan.d.ts +12 -0
- package/types/src/provider.d.ts +65 -0
- package/types/src/proxy-manifest-carrier.d.ts +16 -0
- package/types/src/schema.generated.d.ts +376 -0
- package/types/src/service-names.d.ts +4 -0
- package/types/src/service-references.d.ts +13 -0
- package/types/src/source/constants.d.ts +6 -0
- package/types/src/source/port.d.ts +60 -0
- package/types/src/source/types.d.ts +4 -0
- package/types/src/source/validation.d.ts +19 -0
- package/types/src/source.d.ts +2 -0
- package/types/src/types.d.ts +121 -0
- package/types/src/version-attempt.d.ts +8 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const parsePlatformScheme: (raw: string | undefined) => "http" | "https";
|
|
2
|
+
export declare const parsePlatformHostname: (raw: string) => string;
|
|
3
|
+
export declare const parsePlatformHosts: (raw: {
|
|
4
|
+
iam: string | undefined;
|
|
5
|
+
control: string | undefined;
|
|
6
|
+
operations: string | undefined;
|
|
7
|
+
}) => {
|
|
8
|
+
iam: string;
|
|
9
|
+
control: string;
|
|
10
|
+
operations: string;
|
|
11
|
+
} | undefined;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ZeropsSourceDataFile } from '../source/port';
|
|
2
|
+
/**
|
|
3
|
+
* The prepared platform archive plus the one generated data file (ADR-0045): every entry of the commit is copied
|
|
4
|
+
* byte for byte, and the file is appended after the last one. A commit that already holds the path, as a file or
|
|
5
|
+
* as a directory, is refused rather than overridden.
|
|
6
|
+
*/
|
|
7
|
+
export declare const archiveWithDataFile: (compressed: Uint8Array<ArrayBuffer>, file: ZeropsSourceDataFile) => Uint8Array<ArrayBuffer>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ZeropsArtifactSourceDescriptor } from '../index';
|
|
2
|
+
export interface PreparedPlatformSource {
|
|
3
|
+
commitSha: string;
|
|
4
|
+
descriptor: ZeropsArtifactSourceDescriptor;
|
|
5
|
+
archivePath: string;
|
|
6
|
+
dispose(): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare function preparePlatformSource(sourceDir: string, signal: AbortSignal): Promise<PreparedPlatformSource>;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export type PlatformUploadFetch = (url: string, init: RequestInit) => Promise<Response>;
|
|
2
|
+
export declare const validatePlatformUploadUrl: (value: string) => void;
|
|
3
|
+
export declare const uploadPlatformArchive: (url: string, archive: Blob, signal: AbortSignal, uploadFetch: PlatformUploadFetch) => Promise<void>;
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { type InstallationEndpointTable } from '@fabrika/auth-core';
|
|
2
|
+
import { type InstallationProxyApp } from '@fabrika/proxy-core/manifest';
|
|
3
|
+
/** The platform services an installation's proxy fronts. Each name is a service hostname in the topology. */
|
|
4
|
+
export type PlatformProxyService = 'iam' | 'control' | 'operations';
|
|
5
|
+
/** What one OAuth scope lets a token do: the owning app's actions, resolved by IAM at the token endpoint. */
|
|
6
|
+
export interface PlatformOAuthScopeGrant {
|
|
7
|
+
readonly scope: string;
|
|
8
|
+
readonly actions: readonly string[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* A path an app serves to OAuth clients, protected only on an installation that enables it.
|
|
12
|
+
*
|
|
13
|
+
* The resource URI is the app's public origin plus `path`, so the template holds the path and a deploy
|
|
14
|
+
* binds the origin. Copied from the owning service module by the generator, like `table`.
|
|
15
|
+
*/
|
|
16
|
+
export interface PlatformOAuthResourceTemplate {
|
|
17
|
+
readonly path: string;
|
|
18
|
+
readonly scopes: readonly string[];
|
|
19
|
+
readonly scopeGrants: readonly PlatformOAuthScopeGrant[];
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* One fronted app, in the form that is the same on every installation: protected by its service contract (ADR-0022
|
|
23
|
+
* "Installation entries"), copied in by the generator and never written by hand.
|
|
24
|
+
*/
|
|
25
|
+
export interface PlatformProxyApp {
|
|
26
|
+
/** The IAM app id. It is the audience of every token the proxy mints for this app's host. */
|
|
27
|
+
readonly id: string;
|
|
28
|
+
/** The topology service that answers for it. */
|
|
29
|
+
readonly service: PlatformProxyService;
|
|
30
|
+
/**
|
|
31
|
+
* The proxy's public listener this app answers on.
|
|
32
|
+
*
|
|
33
|
+
* On a `zerops-subdomain` installation a port IS a hostname — Zerops mints one generated host per
|
|
34
|
+
* HTTP port — so this is the only installation-independent half of `hosts`. A custom-domain
|
|
35
|
+
* installation ignores it: every domain arrives on one listener and the `Host` header decides.
|
|
36
|
+
*/
|
|
37
|
+
readonly port: number;
|
|
38
|
+
/** Where the proxy dials it over the project's private network. */
|
|
39
|
+
readonly upstream: string;
|
|
40
|
+
/** The service's rows; with an `oauthResource`, the table served when the composition names an authorization server. */
|
|
41
|
+
readonly table: InstallationEndpointTable;
|
|
42
|
+
/** Present only on an app that can serve OAuth clients; off unless the composition names an authorization server. */
|
|
43
|
+
readonly oauthResource?: PlatformOAuthResourceTemplate;
|
|
44
|
+
/**
|
|
45
|
+
* Present exactly with `oauthResource`: the service's table when it serves no OAuth client. The service picks the
|
|
46
|
+
* same one, by the digest the deploy writes beside it (`platformServiceTableDigest`).
|
|
47
|
+
*/
|
|
48
|
+
readonly tableWithoutOAuth?: InstallationEndpointTable;
|
|
49
|
+
}
|
|
50
|
+
/** Everything about an installation's manifest that does not depend on WHICH installation it is. */
|
|
51
|
+
export interface PlatformProxyManifestTemplate {
|
|
52
|
+
readonly apps: readonly PlatformProxyApp[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* The template's entry for one platform service.
|
|
56
|
+
*
|
|
57
|
+
* The app IDS live in the template, so a caller that needs one — the deploy's schema reconcile needs
|
|
58
|
+
* the console's — reads it from there rather than restating a literal that could drift from the
|
|
59
|
+
* document the proxy is actually configured with.
|
|
60
|
+
*/
|
|
61
|
+
export declare const platformProxyAppFor: (template: PlatformProxyManifestTemplate, service: PlatformProxyService) => PlatformProxyApp;
|
|
62
|
+
/** Where one app answers in a particular composition. */
|
|
63
|
+
export interface PlatformProxyPlacement {
|
|
64
|
+
/** Public hostnames, without a port — `parseProxyManifest` refuses a `:port` suffix. */
|
|
65
|
+
readonly hosts: readonly string[];
|
|
66
|
+
/** Overrides the private dial address. The local composition runs IAM on a port of its own. */
|
|
67
|
+
readonly upstream?: string;
|
|
68
|
+
}
|
|
69
|
+
/** One composition of the platform: a deployed installation, or the local Docker stack. */
|
|
70
|
+
export interface PlatformProxyComposition {
|
|
71
|
+
/** The scheme the BROWSER speaks to these apps — configuration, never a header (see `ProxyApp.scheme`). */
|
|
72
|
+
readonly scheme: 'http' | 'https';
|
|
73
|
+
readonly placement: Readonly<Record<PlatformProxyService, PlatformProxyPlacement>>;
|
|
74
|
+
/**
|
|
75
|
+
* The public IAM origin that issues OAuth tokens. Present only when the installation enables MCP
|
|
76
|
+
* authoring; absent leaves every `oauthResource` unregistered and serves each service's table without OAuth.
|
|
77
|
+
*/
|
|
78
|
+
readonly authorizationServer?: string;
|
|
79
|
+
/** The port browsers reach every app on, when it is not the scheme's default. The local composition's is 18080. */
|
|
80
|
+
readonly publicPort?: number;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* The RFC 8707 resource URI and RFC 9728 metadata URL of an app's OAuth resource, bound to the app's
|
|
84
|
+
* FIRST host: the proxy refuses a resource on a host the app does not answer on.
|
|
85
|
+
*/
|
|
86
|
+
export declare const platformOAuthResourceUris: (composition: Pick<PlatformProxyComposition, "scheme" | "publicPort">, hosts: readonly string[], template: PlatformOAuthResourceTemplate) => {
|
|
87
|
+
readonly resource: string;
|
|
88
|
+
readonly resourceMetadata: string;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Bind a template to one composition and get the document the proxy actually parses.
|
|
92
|
+
*
|
|
93
|
+
* The result is returned THROUGH `parseProxyManifest`, so a duplicate id, a repeated host or a `:port`
|
|
94
|
+
* suffix is refused right here instead of at a deployed proxy's next build.
|
|
95
|
+
*/
|
|
96
|
+
export declare const resolvePlatformProxyManifest: (template: PlatformProxyManifestTemplate, composition: PlatformProxyComposition) => PlatformProxyManifest;
|
|
97
|
+
/** The platform proxy's manifest: one installation entry per platform service. */
|
|
98
|
+
export interface PlatformProxyManifest {
|
|
99
|
+
apps: InstallationProxyApp[];
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* `FABRIKA_SERVICE_TABLE_DIGEST` for a service: the digest of the table this manifest publishes for it, which the
|
|
103
|
+
* service compares with its own and refuses to start under another.
|
|
104
|
+
*/
|
|
105
|
+
export declare const platformServiceTableDigest: (manifest: PlatformProxyManifest, appId: string) => string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/** Everything one installation is seeded with. Several of these are shared by more than one service. */
|
|
2
|
+
export interface InstallationSecrets {
|
|
3
|
+
/** IAM's token-signing material: a JSON array of ES256 private JWKs, index 0 active. */
|
|
4
|
+
readonly signingKeys: string;
|
|
5
|
+
/** Authenticates IAM's management `/rpc/*` surface. Held by IAM, control and Operations. */
|
|
6
|
+
readonly rpcKey: string;
|
|
7
|
+
/** Authenticates IAM's `/auth/mint/*` surface, which the proxy calls on the cold path. */
|
|
8
|
+
readonly proxyKey: string;
|
|
9
|
+
/** The `px_` admin bearer IAM admits as a synthetic global admin. `platform init` and `admin` take it. */
|
|
10
|
+
readonly provisioningKey: string;
|
|
11
|
+
/** The catalog credential control and Operations share. No `px_` prefix — it is not an IAM credential. */
|
|
12
|
+
readonly operationsSyncKey: string;
|
|
13
|
+
/** The control plane's vault KEK: 32 raw bytes at base64. Its loss is unrecoverable by design. */
|
|
14
|
+
readonly vaultKey: string;
|
|
15
|
+
}
|
|
16
|
+
/** Roll one installation's secrets. Pure entropy in, no I/O, nothing persisted. */
|
|
17
|
+
export declare const generateInstallationSecrets: () => InstallationSecrets;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/** Everything the scaffold stages: the CLI-owned trio plus the operator-owned, write-once pin. */
|
|
2
|
+
export declare const SIDECAR_FILES: readonly [".gitignore", "README.md", "fabrika.ref", ".github/workflows/platform.yml"];
|
|
3
|
+
/** The file that pins which published fabrika tag this installation runs. */
|
|
4
|
+
export declare const FABRIKA_REF_FILE = "fabrika.ref";
|
|
5
|
+
/** The generated pipeline. CLI-owned: `init` and `upgrade` both rewrite it. */
|
|
6
|
+
export declare const SIDECAR_WORKFLOW_PATH = ".github/workflows/platform.yml";
|
|
7
|
+
/** What a rendered sidecar repository is named after. */
|
|
8
|
+
export interface SidecarValues {
|
|
9
|
+
/** The operator's name for this installation. The GitHub Environment is named after it too. */
|
|
10
|
+
readonly installation: string;
|
|
11
|
+
/** `<owner>/<name>` of the sidecar repository itself. */
|
|
12
|
+
readonly repo: string;
|
|
13
|
+
/** The published fabrika tag to pin, used only when `fabrika.ref` does not exist yet. */
|
|
14
|
+
readonly fabrikaRef: string;
|
|
15
|
+
}
|
|
16
|
+
/** The pinned ref, or an error naming what was found. A branch is refused, deliberately and loudly. */
|
|
17
|
+
export declare const assertPinnedTag: (ref: string) => string;
|
|
18
|
+
/** The generated pipeline for one installation. Its only placeholder is the installation, which names its GitHub Environment. */
|
|
19
|
+
export declare const renderSidecarWorkflow: (installation: string) => Promise<string>;
|
|
20
|
+
/**
|
|
21
|
+
* The installation a sidecar's current workflow was rendered for, read back from its GitHub Environment.
|
|
22
|
+
*
|
|
23
|
+
* Not from the repository name: `init --repo` accepts any name, and a workflow rendered for the wrong
|
|
24
|
+
* Environment deploys with no credentials.
|
|
25
|
+
*/
|
|
26
|
+
export declare const readSidecarWorkflowInstallation: (dir: string) => Promise<string>;
|
|
27
|
+
/**
|
|
28
|
+
* Write the sidecar files into `dir`.
|
|
29
|
+
*
|
|
30
|
+
* The workflow, the README and the `.gitignore` are CLI-owned and refreshed on every run, so a fix to
|
|
31
|
+
* the generated pipeline reaches every installation on its operator's next `init` (and the workflow on
|
|
32
|
+
* the next `upgrade`). `fabrika.ref` is
|
|
33
|
+
* written ONLY when absent: bumping it is how an operator rolls the installation forward, and a refresh
|
|
34
|
+
* that reset it would silently roll them back.
|
|
35
|
+
*
|
|
36
|
+
* An existing `fabrika.ref` is validated rather than ignored — a sidecar that has drifted onto a branch
|
|
37
|
+
* is exactly the case the two gates exist for, and finding it here beats finding it in a failed run.
|
|
38
|
+
*/
|
|
39
|
+
export declare const materializeSidecarScaffold: (dir: string, values: SidecarValues) => Promise<void>;
|
|
40
|
+
/** The pin a checkout carries, for the closing summary. */
|
|
41
|
+
export declare const readPinnedTag: (dir: string) => Promise<string>;
|
|
42
|
+
/**
|
|
43
|
+
* The default sidecar repository for an installation, following the predecessor's `vozka-platform-<account>`
|
|
44
|
+
* precedent: named so its relation to the installation is obvious. A parameter, never a constant — one
|
|
45
|
+
* operator's installations are not another's.
|
|
46
|
+
*/
|
|
47
|
+
export declare const defaultSidecarRepo: (installation: string) => string;
|
|
48
|
+
/** Where the sidecar is checked out locally: `./fabrika-zerops-<installation>` under the cwd. */
|
|
49
|
+
/** The sidecar checkout's directory name when `--checkout` is not given; `init` creates it and `upgrade` reads it. */
|
|
50
|
+
export declare const defaultCheckoutName: (installation: string) => string;
|
|
51
|
+
export declare const defaultCheckoutDir: (installation: string) => string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const readInstallationSourceDir: (argv: readonly string[], env: Record<string, string | undefined>) => string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** One file to write, with a path relative to the repository root. */
|
|
2
|
+
export interface Artifact {
|
|
3
|
+
/** Repo-relative, POSIX-separated. */
|
|
4
|
+
path: string;
|
|
5
|
+
content: string;
|
|
6
|
+
}
|
|
7
|
+
/** Every artifact this package generates, in a stable order. */
|
|
8
|
+
export declare const generatedArtifacts: () => Artifact[];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { type Artifact, generatedArtifacts } from './artifacts';
|
|
2
|
+
export { assertCorePackageIsExplicit, assertOnlyPublicService, assertZeropsHostnames } from './invariants';
|
|
3
|
+
export { fabrikaZeropsYaml, PROXY_HEALTH_PORT, PROXY_PUBLIC_PORTS } from './setups';
|
|
4
|
+
export { appsTopology, type CompiledDocument, type CompiledTopology, compileTopology, fabrikaTopologies, platformTopology, PROXY_HOSTNAME, } from './topology';
|
|
5
|
+
export { assertArtifactMatchesSchema, parseYaml, validateYaml } from './validate';
|