@fabrika/provider-zerops 0.9.0-dev.1 → 0.9.0-dev.11

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 (180) hide show
  1. package/package.json +17 -14
  2. package/sandbox/Dockerfile +16 -0
  3. package/sandbox/bin/postgres-auth.sh +38 -0
  4. package/sandbox/bin/reset.sh +12 -0
  5. package/sandbox/bin/run-build.sh +35 -0
  6. package/sandbox/bin/run-launcher.sh +18 -0
  7. package/sandbox/bin/start-launcher.sh +25 -0
  8. package/sandbox/bin/stop.sh +47 -0
  9. package/sandbox/init.sh +61 -0
  10. package/src/api/client.ts +15 -1
  11. package/src/api/errors.ts +7 -3
  12. package/src/api/readers.ts +29 -0
  13. package/src/api/types.ts +52 -0
  14. package/src/api.ts +2 -0
  15. package/src/cli.ts +11 -0
  16. package/src/collaborators.ts +0 -14
  17. package/src/compile.ts +1 -1
  18. package/src/control.ts +159 -92
  19. package/src/execution.ts +45 -195
  20. package/src/index.ts +2 -0
  21. package/src/installation/admin.ts +1 -1
  22. package/src/installation/deploy-options.ts +10 -2
  23. package/src/installation/deploy.ts +241 -81
  24. package/src/installation/generated/platform-console-schema.ts +3 -0
  25. package/src/installation/generated/platform-proxy-manifest.ts +1 -1
  26. package/src/installation/guide.md +53 -19
  27. package/src/installation/hosts.ts +1 -7
  28. package/src/installation/index.ts +20 -16
  29. package/src/installation/init-options.ts +2 -1
  30. package/src/installation/install-environment.ts +47 -108
  31. package/src/installation/install-options.ts +3 -1
  32. package/src/installation/install-secrets.ts +24 -68
  33. package/src/installation/install.ts +9 -4
  34. package/src/installation/plain-credentials.ts +91 -0
  35. package/src/installation/sidecar.ts +5 -26
  36. package/src/installation/templates/README.md +13 -12
  37. package/src/installation/templates/platform.yml +3 -0
  38. package/src/installation/topology/setups.ts +17 -4
  39. package/src/installation/topology/topology.ts +33 -23
  40. package/src/installation/upgrade-options.ts +2 -2
  41. package/src/managed-env.ts +1 -174
  42. package/src/manifest.ts +14 -17
  43. package/src/namespace/claims.ts +60 -1
  44. package/src/namespace/codec.ts +17 -0
  45. package/src/namespace/errors.ts +22 -1
  46. package/src/namespace/manifest.ts +36 -23
  47. package/src/namespace/provisioning.ts +88 -114
  48. package/src/namespace/proxy-attempt.ts +14 -2
  49. package/src/namespace/proxy-reads.ts +28 -23
  50. package/src/namespace/proxy-secrets.ts +18 -5
  51. package/src/namespace/sandbox-host.ts +212 -0
  52. package/src/namespace/subdomain.ts +113 -0
  53. package/src/namespace/topology.ts +1 -1
  54. package/src/namespace/types.ts +13 -0
  55. package/src/namespace/update.ts +1 -0
  56. package/src/namespace-cli.ts +152 -0
  57. package/src/plain-credentials.ts +90 -0
  58. package/src/plan.ts +1 -6
  59. package/src/provider.ts +88 -166
  60. package/src/proxy-manifest-carrier.ts +39 -0
  61. package/src/sandbox/base-image.ts +100 -0
  62. package/src/sandbox/constants.ts +44 -0
  63. package/src/sandbox/deploy.ts +471 -0
  64. package/src/sandbox/dev-artifact.ts +206 -0
  65. package/src/sandbox/lifecycle.ts +204 -0
  66. package/src/sandbox/scripts.ts +26 -0
  67. package/src/sandbox-host.ts +28 -0
  68. package/src/source/port.ts +5 -0
  69. package/src/types.ts +6 -2
  70. package/src/zbox/client.ts +259 -0
  71. package/src/zbox/errors.ts +45 -0
  72. package/src/zbox/index.ts +22 -0
  73. package/src/zbox/types.ts +165 -0
  74. package/types/src/api/client.d.ts +5 -0
  75. package/types/src/api/errors.d.ts +26 -0
  76. package/types/src/api/polling.d.ts +41 -0
  77. package/types/src/api/readers.d.ts +1115 -0
  78. package/types/src/api/service-env-limit.d.ts +17 -0
  79. package/types/src/api/service-env-response.d.ts +23 -0
  80. package/types/src/api/types.d.ts +687 -0
  81. package/types/src/api.d.ts +6 -0
  82. package/types/src/authoring.d.ts +9 -0
  83. package/types/src/cli-args.d.ts +19 -0
  84. package/types/src/cli.d.ts +13 -0
  85. package/types/src/collaborators.d.ts +16 -0
  86. package/types/src/compile.d.ts +91 -0
  87. package/types/src/control.d.ts +51 -0
  88. package/types/src/database-budget.d.ts +38 -0
  89. package/types/src/descriptor.d.ts +28 -0
  90. package/types/src/execution.d.ts +114 -0
  91. package/types/src/exposure.d.ts +47 -0
  92. package/types/src/index.d.ts +31 -0
  93. package/types/src/installation/admin-options.d.ts +24 -0
  94. package/types/src/installation/admin.d.ts +35 -0
  95. package/types/src/installation/checker-release.d.ts +12 -0
  96. package/types/src/installation/deploy-options.d.ts +42 -0
  97. package/types/src/installation/deploy.d.ts +136 -0
  98. package/types/src/installation/generated/platform-console-schema.d.ts +2 -0
  99. package/types/src/installation/generated/platform-proxy-manifest.d.ts +2 -0
  100. package/types/src/installation/hosts.d.ts +34 -0
  101. package/types/src/installation/index.d.ts +7 -0
  102. package/types/src/installation/init-options.d.ts +38 -0
  103. package/types/src/installation/init.d.ts +60 -0
  104. package/types/src/installation/install-collaborators.d.ts +24 -0
  105. package/types/src/installation/install-environment.d.ts +63 -0
  106. package/types/src/installation/install-options.d.ts +49 -0
  107. package/types/src/installation/install-project.d.ts +13 -0
  108. package/types/src/installation/install-provisioning.d.ts +58 -0
  109. package/types/src/installation/install-secrets.d.ts +17 -0
  110. package/types/src/installation/install-token.d.ts +10 -0
  111. package/types/src/installation/install.d.ts +23 -0
  112. package/types/src/installation/installation-source.d.ts +8 -0
  113. package/types/src/installation/log.d.ts +44 -0
  114. package/types/src/installation/machine-key.d.ts +19 -0
  115. package/types/src/installation/placement-options.d.ts +11 -0
  116. package/types/src/installation/plain-credentials.d.ts +20 -0
  117. package/types/src/installation/platform-archive.d.ts +7 -0
  118. package/types/src/installation/platform-source.d.ts +8 -0
  119. package/types/src/installation/platform-upload.d.ts +3 -0
  120. package/types/src/installation/sidecar.d.ts +49 -0
  121. package/types/src/installation/source-options.d.ts +1 -0
  122. package/types/src/installation/topology/artifacts.d.ts +8 -0
  123. package/types/src/installation/topology/index.d.ts +5 -0
  124. package/types/src/installation/topology/installation-schemas.d.ts +2242 -0
  125. package/types/src/installation/topology/invariants.d.ts +23 -0
  126. package/types/src/installation/topology/setups.d.ts +59 -0
  127. package/types/src/installation/topology/topology.d.ts +153 -0
  128. package/types/src/installation/topology/validate.d.ts +11 -0
  129. package/types/src/installation/upgrade-options.d.ts +26 -0
  130. package/types/src/installation/upgrade-output.d.ts +6 -0
  131. package/types/src/installation/upgrade.d.ts +88 -0
  132. package/types/src/managed-env.d.ts +24 -0
  133. package/types/src/manifest.d.ts +199 -0
  134. package/types/src/namespace/claims.d.ts +16 -0
  135. package/types/src/namespace/codec.d.ts +352 -0
  136. package/types/src/namespace/constants.d.ts +25 -0
  137. package/types/src/namespace/errors.d.ts +25 -0
  138. package/types/src/namespace/manifest.d.ts +4 -0
  139. package/types/src/namespace/operator.d.ts +12 -0
  140. package/types/src/namespace/provisioning.d.ts +4 -0
  141. package/types/src/namespace/proxy-attempt.d.ts +39 -0
  142. package/types/src/namespace/proxy-reads.d.ts +27 -0
  143. package/types/src/namespace/proxy-secrets.d.ts +8 -0
  144. package/types/src/namespace/proxy-source.d.ts +74 -0
  145. package/types/src/namespace/sandbox-host.d.ts +23 -0
  146. package/types/src/namespace/subdomain.d.ts +43 -0
  147. package/types/src/namespace/topology.d.ts +9 -0
  148. package/types/src/namespace/types.d.ts +111 -0
  149. package/types/src/namespace/update.d.ts +6 -0
  150. package/types/src/namespace/validation.d.ts +12 -0
  151. package/types/src/namespace-cli.d.ts +2 -0
  152. package/types/src/namespace.d.ts +9 -0
  153. package/types/src/plain-credentials.d.ts +7 -0
  154. package/types/src/plan.d.ts +11 -0
  155. package/types/src/provider.d.ts +60 -0
  156. package/types/src/proxy-manifest-carrier.d.ts +37 -0
  157. package/types/src/sandbox/base-image.d.ts +28 -0
  158. package/types/src/sandbox/constants.d.ts +30 -0
  159. package/types/src/sandbox/deploy.d.ts +75 -0
  160. package/types/src/sandbox/dev-artifact.d.ts +51 -0
  161. package/types/src/sandbox/lifecycle.d.ts +27 -0
  162. package/types/src/sandbox/scripts.d.ts +11 -0
  163. package/types/src/sandbox-host.d.ts +16 -0
  164. package/types/src/schema.generated.d.ts +376 -0
  165. package/types/src/service-names.d.ts +4 -0
  166. package/types/src/service-references.d.ts +13 -0
  167. package/types/src/source/constants.d.ts +6 -0
  168. package/types/src/source/port.d.ts +65 -0
  169. package/types/src/source/types.d.ts +4 -0
  170. package/types/src/source/validation.d.ts +19 -0
  171. package/types/src/source.d.ts +2 -0
  172. package/types/src/types.d.ts +125 -0
  173. package/types/src/version-attempt.d.ts +8 -0
  174. package/types/src/zbox/client.d.ts +2 -0
  175. package/types/src/zbox/errors.d.ts +25 -0
  176. package/types/src/zbox/index.d.ts +3 -0
  177. package/types/src/zbox/types.d.ts +433 -0
  178. package/src/installation/mcp.ts +0 -102
  179. package/src/installation/proxy-manifest.ts +0 -214
  180. package/src/installation/secrets.ts +0 -78
@@ -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,20 @@
1
+ import type { LiveServiceEnv, PlatformDeployService } from './deploy';
2
+ /** One readable variable that looks like a credential. Names only; the value is never carried. */
3
+ export interface PlainCredentialVariable {
4
+ readonly service: PlatformDeployService;
5
+ readonly key: string;
6
+ readonly because: string;
7
+ }
8
+ /** `<service>/<KEY>`, the form an operator names an exception in. */
9
+ export declare const plainVariableId: (service: string, key: string) => string;
10
+ /**
11
+ * The readable variables of one service that look like credentials.
12
+ *
13
+ * `written` are the keys this deploy writes itself, readable by design and about to be overwritten: they are its own
14
+ * configuration, never a credential. `allowed` are the `<service>/<KEY>` exceptions the operator named.
15
+ */
16
+ export declare const plainCredentialVariables: (service: PlatformDeployService, live: LiveServiceEnv, written: ReadonlySet<string>, allowed: ReadonlySet<string>) => PlainCredentialVariable[];
17
+ /** The refusal: each variable by name and reason, where it belongs instead, and the opt-out. Never a value. */
18
+ export declare const plainCredentialRefusal: (found: readonly PlainCredentialVariable[]) => Error;
19
+ /** Parse the operator's exceptions: comma-separated `<service>/<KEY>`, each naming a platform service. */
20
+ export declare const parsePlainVariables: (raw: string | undefined, services: readonly string[]) => ReadonlySet<string>;
@@ -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,49 @@
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 generated pipeline for one installation. Its only placeholder is the installation, which names its GitHub Environment. */
17
+ export declare const renderSidecarWorkflow: (installation: string) => Promise<string>;
18
+ /**
19
+ * The installation a sidecar's current workflow was rendered for, read back from its GitHub Environment.
20
+ *
21
+ * Not from the repository name: `init --repo` accepts any name, and a workflow rendered for the wrong
22
+ * Environment deploys with no credentials.
23
+ */
24
+ export declare const readSidecarWorkflowInstallation: (dir: string) => Promise<string>;
25
+ /**
26
+ * Write the sidecar files into `dir`.
27
+ *
28
+ * The workflow, the README and the `.gitignore` are CLI-owned and refreshed on every run, so a fix to
29
+ * the generated pipeline reaches every installation on its operator's next `init` (and the workflow on
30
+ * the next `upgrade`). `fabrika.ref` is
31
+ * written ONLY when absent: bumping it is how an operator rolls the installation forward, and a refresh
32
+ * that reset it would silently roll them back.
33
+ *
34
+ * An existing `fabrika.ref` is validated rather than ignored — a sidecar that has drifted onto a branch
35
+ * is exactly the case the two gates exist for, and finding it here beats finding it in a failed run.
36
+ */
37
+ export declare const materializeSidecarScaffold: (dir: string, values: SidecarValues) => Promise<void>;
38
+ /** The pin a checkout carries, for the closing summary. */
39
+ export declare const readPinnedTag: (dir: string) => Promise<string>;
40
+ /**
41
+ * The default sidecar repository for an installation, following the predecessor's `vozka-platform-<account>`
42
+ * precedent: named so its relation to the installation is obvious. A parameter, never a constant — one
43
+ * operator's installations are not another's.
44
+ */
45
+ export declare const defaultSidecarRepo: (installation: string) => string;
46
+ /** Where the sidecar is checked out locally: `./fabrika-zerops-<installation>` under the cwd. */
47
+ /** The sidecar checkout's directory name when `--checkout` is not given; `init` creates it and `upgrade` reads it. */
48
+ export declare const defaultCheckoutName: (installation: string) => string;
49
+ 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';