@fabrika/provider-zerops 0.8.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.
Files changed (102) hide show
  1. package/package.json +15 -14
  2. package/src/api/client.ts +6 -0
  3. package/src/api/types.ts +12 -0
  4. package/src/control.ts +26 -0
  5. package/src/execution.ts +147 -14
  6. package/src/installation/generated/platform-proxy-manifest.ts +20 -0
  7. package/src/manifest.ts +9 -5
  8. package/src/namespace/provisioning.ts +4 -2
  9. package/src/namespace/proxy-attempt.ts +29 -0
  10. package/src/plan.ts +1 -1
  11. package/src/provider.ts +40 -0
  12. package/types/src/api/client.d.ts +5 -0
  13. package/types/src/api/errors.d.ts +24 -0
  14. package/types/src/api/polling.d.ts +41 -0
  15. package/types/src/api/readers.d.ts +977 -0
  16. package/types/src/api/service-env-limit.d.ts +17 -0
  17. package/types/src/api/service-env-response.d.ts +23 -0
  18. package/types/src/api/types.d.ts +638 -0
  19. package/types/src/api.d.ts +6 -0
  20. package/types/src/authoring.d.ts +9 -0
  21. package/types/src/cli-args.d.ts +19 -0
  22. package/types/src/cli.d.ts +10 -0
  23. package/types/src/collaborators.d.ts +18 -0
  24. package/types/src/compile.d.ts +91 -0
  25. package/types/src/control.d.ts +41 -0
  26. package/types/src/database-budget.d.ts +38 -0
  27. package/types/src/descriptor.d.ts +28 -0
  28. package/types/src/execution.d.ts +137 -0
  29. package/types/src/exposure.d.ts +47 -0
  30. package/types/src/index.d.ts +31 -0
  31. package/types/src/installation/admin-options.d.ts +24 -0
  32. package/types/src/installation/admin.d.ts +35 -0
  33. package/types/src/installation/checker-release.d.ts +12 -0
  34. package/types/src/installation/deploy-options.d.ts +37 -0
  35. package/types/src/installation/deploy.d.ts +96 -0
  36. package/types/src/installation/generated/platform-console-schema.d.ts +2 -0
  37. package/types/src/installation/generated/platform-proxy-manifest.d.ts +2 -0
  38. package/types/src/installation/hosts.d.ts +38 -0
  39. package/types/src/installation/index.d.ts +9 -0
  40. package/types/src/installation/init-options.d.ts +38 -0
  41. package/types/src/installation/init.d.ts +60 -0
  42. package/types/src/installation/install-collaborators.d.ts +24 -0
  43. package/types/src/installation/install-environment.d.ts +70 -0
  44. package/types/src/installation/install-options.d.ts +49 -0
  45. package/types/src/installation/install-project.d.ts +13 -0
  46. package/types/src/installation/install-provisioning.d.ts +58 -0
  47. package/types/src/installation/install-secrets.d.ts +30 -0
  48. package/types/src/installation/install-token.d.ts +10 -0
  49. package/types/src/installation/install.d.ts +23 -0
  50. package/types/src/installation/installation-source.d.ts +8 -0
  51. package/types/src/installation/log.d.ts +44 -0
  52. package/types/src/installation/machine-key.d.ts +19 -0
  53. package/types/src/installation/mcp.d.ts +18 -0
  54. package/types/src/installation/placement-options.d.ts +11 -0
  55. package/types/src/installation/platform-archive.d.ts +7 -0
  56. package/types/src/installation/platform-source.d.ts +8 -0
  57. package/types/src/installation/platform-upload.d.ts +3 -0
  58. package/types/src/installation/proxy-manifest.d.ts +105 -0
  59. package/types/src/installation/secrets.d.ts +17 -0
  60. package/types/src/installation/sidecar.d.ts +51 -0
  61. package/types/src/installation/source-options.d.ts +1 -0
  62. package/types/src/installation/topology/artifacts.d.ts +8 -0
  63. package/types/src/installation/topology/index.d.ts +5 -0
  64. package/types/src/installation/topology/installation-schemas.d.ts +2242 -0
  65. package/types/src/installation/topology/invariants.d.ts +23 -0
  66. package/types/src/installation/topology/setups.d.ts +58 -0
  67. package/types/src/installation/topology/topology.d.ts +148 -0
  68. package/types/src/installation/topology/validate.d.ts +11 -0
  69. package/types/src/installation/upgrade-options.d.ts +26 -0
  70. package/types/src/installation/upgrade-output.d.ts +6 -0
  71. package/types/src/installation/upgrade.d.ts +88 -0
  72. package/types/src/managed-env.d.ts +57 -0
  73. package/types/src/manifest.d.ts +206 -0
  74. package/types/src/namespace/claims.d.ts +3 -0
  75. package/types/src/namespace/codec.d.ts +334 -0
  76. package/types/src/namespace/constants.d.ts +25 -0
  77. package/types/src/namespace/errors.d.ts +15 -0
  78. package/types/src/namespace/manifest.d.ts +4 -0
  79. package/types/src/namespace/operator.d.ts +12 -0
  80. package/types/src/namespace/provisioning.d.ts +4 -0
  81. package/types/src/namespace/proxy-attempt.d.ts +36 -0
  82. package/types/src/namespace/proxy-reads.d.ts +33 -0
  83. package/types/src/namespace/proxy-secrets.d.ts +8 -0
  84. package/types/src/namespace/proxy-source.d.ts +74 -0
  85. package/types/src/namespace/topology.d.ts +9 -0
  86. package/types/src/namespace/types.d.ts +99 -0
  87. package/types/src/namespace/update.d.ts +6 -0
  88. package/types/src/namespace/validation.d.ts +12 -0
  89. package/types/src/namespace.d.ts +9 -0
  90. package/types/src/plan.d.ts +12 -0
  91. package/types/src/provider.d.ts +65 -0
  92. package/types/src/proxy-manifest-carrier.d.ts +16 -0
  93. package/types/src/schema.generated.d.ts +376 -0
  94. package/types/src/service-names.d.ts +4 -0
  95. package/types/src/service-references.d.ts +13 -0
  96. package/types/src/source/constants.d.ts +6 -0
  97. package/types/src/source/port.d.ts +60 -0
  98. package/types/src/source/types.d.ts +4 -0
  99. package/types/src/source/validation.d.ts +19 -0
  100. package/types/src/source.d.ts +2 -0
  101. package/types/src/types.d.ts +121 -0
  102. package/types/src/version-attempt.d.ts +8 -0
@@ -0,0 +1,121 @@
1
+ import type { ContractArtifact } from '@fabrika/auth-core';
2
+ import type { AppConfigBase } from '@fabrika/provider-contract';
3
+ import type { ContractProxyApp } from '@fabrika/proxy-core/manifest';
4
+ import type { ZeropsRuntimePackage } from './execution';
5
+ import type { ZeropsHealthCheck, ZeropsImportProject, ZeropsImportService, ZeropsReadinessCheck, ZeropsYamlDeploy, ZeropsYamlRun, ZeropsYamlSetup } from './schema.generated';
6
+ import type { ZeropsSourceRepository } from './source';
7
+ import type { ZeropsSourcePrivateBinding } from './source/port';
8
+ export interface ZeropsResourceContext {
9
+ env: string;
10
+ domain?: string;
11
+ }
12
+ /**
13
+ * A probe interval or timeout, as the PLATFORM takes it — a Go duration with a unit, e.g. `30s`.
14
+ *
15
+ * The published JSON schema types all six of these as `integer`, and the platform refuses an integer:
16
+ * `POST /service-stack/zerops-yaml-validation` answers `yamlValidationInvalidYaml` with
17
+ * `cannot unmarshal !!int into time.Duration`. The account wins, so this type does. Every value is also
18
+ * bounded to **[10s, 1h]** — `5s` is refused with `invalid execPeriod <10s, 1h0m0s>` — which no
19
+ * published document states; see `docs/reference/zerops-platform.md`.
20
+ */
21
+ export type ZeropsDuration = `${number}${'s' | 'm' | 'h'}`;
22
+ /** `run.healthCheck`, with the four duration fields corrected to what the platform accepts. */
23
+ export interface ZeropsHealthCheckSpec extends Omit<ZeropsHealthCheck, ZeropsHealthCheckDurationField> {
24
+ failureTimeout?: ZeropsDuration;
25
+ disconnectTimeout?: ZeropsDuration;
26
+ recoveryTimeout?: ZeropsDuration;
27
+ execPeriod?: ZeropsDuration;
28
+ }
29
+ type ZeropsHealthCheckDurationField = 'failureTimeout' | 'disconnectTimeout' | 'recoveryTimeout' | 'execPeriod';
30
+ /** `deploy.readinessCheck`, with its two duration fields corrected. */
31
+ export interface ZeropsReadinessCheckSpec extends Omit<ZeropsReadinessCheck, 'failureTimeout' | 'retryPeriod'> {
32
+ failureTimeout?: ZeropsDuration;
33
+ retryPeriod?: ZeropsDuration;
34
+ }
35
+ export interface ZeropsYamlRunSpec extends Omit<ZeropsYamlRun, 'healthCheck'> {
36
+ healthCheck?: ZeropsHealthCheckSpec;
37
+ }
38
+ export interface ZeropsYamlDeploySpec extends Omit<ZeropsYamlDeploy, 'readinessCheck'> {
39
+ readinessCheck?: ZeropsReadinessCheckSpec;
40
+ }
41
+ export interface ZeropsYamlSetupSpec extends Omit<ZeropsYamlSetup, 'run' | 'deploy'> {
42
+ run?: ZeropsYamlRunSpec;
43
+ deploy?: ZeropsYamlDeploySpec;
44
+ }
45
+ /**
46
+ * A `zerops.yaml` as fabrika AUTHORS it.
47
+ *
48
+ * Same relationship to `ZeropsYaml` that `ZeropsServiceSpec` has to `ZeropsImportService`: the generated
49
+ * transcription is the platform's published contract, and this is the authoring surface, which diverges
50
+ * from it only where a live account has proved the publication wrong.
51
+ */
52
+ export interface ZeropsYamlSpec {
53
+ zerops: ZeropsYamlSetupSpec[];
54
+ }
55
+ export type ZeropsCompilerOwnedServiceField = 'envIsolation' | 'override' | 'envSecrets' | 'dotEnvSecrets' | 'mode' | 'os';
56
+ export type ZeropsCompilerOwnedProjectField = 'envVariables' | 'envIsolation';
57
+ export type ZeropsServiceSpec = Omit<ZeropsImportService, ZeropsCompilerOwnedServiceField>;
58
+ export type ZeropsProjectSpec = Omit<ZeropsImportProject, ZeropsCompilerOwnedProjectField>;
59
+ /** What the namespace proxy applies to the app: the manifest form of its compiled contract, from `contractProxyTable`. */
60
+ export interface ZeropsProxySpec extends Pick<ContractProxyApp, 'endpoints' | 'reservedPrefixes' | 'snapshot'> {
61
+ upstream: string;
62
+ }
63
+ /**
64
+ * A typed reference to the namespace-owned PostgreSQL service; it never contains its credential.
65
+ *
66
+ * The reference names its PORT, its DATABASE and its TLS MODE rather than inheriting any from the driver — see
67
+ * `ZEROPS_SHARED_POSTGRES_CONNECTION_STRING` in `./namespace.ts` for what the account proved about each. It is the
68
+ * service user's; a contract application's `FABRIKA_APP_DATABASE_URL` is generated from `hostname` instead.
69
+ */
70
+ export interface ZeropsSharedPostgresBinding {
71
+ readonly resourceKey: 'service:postgres';
72
+ readonly hostname: 'postgres';
73
+ readonly connectionString: '${postgres_connectionString}/${postgres_dbName}?sslmode=disable';
74
+ }
75
+ export type ZeropsNamespaceResourceRequirement = ZeropsSharedPostgresBinding;
76
+ export interface ZeropsSourceTarget {
77
+ platform: 'zerops';
78
+ deployService?: string;
79
+ zeropsSetup?: string;
80
+ proxy?: ZeropsProxySpec;
81
+ namespaceResources?: ZeropsNamespaceResourceRequirement[];
82
+ /**
83
+ * The compiled contract of a contract application. Its presence locks the setup down (ADR-0043): the platform
84
+ * generates the run section and the server build, and the authored `zerops.yaml` keeps only the SPA build.
85
+ */
86
+ contract?: ContractArtifact;
87
+ /** System packages for the runtime image of a contract application, from a closed list. */
88
+ runtimePackages?: ZeropsRuntimePackage[];
89
+ services: (ctx: ZeropsResourceContext) => ZeropsServiceSpec[];
90
+ project?: ZeropsProjectSpec;
91
+ }
92
+ export interface ZeropsAppConfig extends AppConfigBase {
93
+ target: ZeropsSourceTarget;
94
+ }
95
+ /** Exact, credential-free source coordinates composed for one non-dry runtime invocation. */
96
+ export interface ZeropsRuntimeSource {
97
+ runId: string;
98
+ repository: ZeropsSourceRepository;
99
+ commitSha: string;
100
+ /** Absent for a public repository. */
101
+ privateBinding?: ZeropsSourcePrivateBinding;
102
+ }
103
+ /** The run checkpoint (ADR-0044): the reserved version, and whether its build request may have been sent. */
104
+ export interface ZeropsRunState {
105
+ appVersionId: string;
106
+ triggered: boolean;
107
+ }
108
+ /** Ephemeral runtime coordinates. This value is encoded only after credentials are composed. */
109
+ export interface ZeropsRuntimeTarget {
110
+ projectId: string;
111
+ serviceId: string;
112
+ /** The buckets the environment's registration created, from its stored target (creation evidence, ADR-0043). */
113
+ createdBuckets?: readonly string[];
114
+ accessToken: string;
115
+ /** Absent only for dry runs, which perform no source or Zerops mutation. */
116
+ source?: ZeropsRuntimeSource;
117
+ apiBaseUrl?: string;
118
+ propustkaUrl?: string;
119
+ adminKey?: string;
120
+ }
121
+ export {};
@@ -0,0 +1,8 @@
1
+ import type { ZeropsApi } from './api/types';
2
+ export declare const isVersionNotFound: (error: unknown) => boolean;
3
+ /**
4
+ * Delete a reserved version whose build was never requested. Deletion is the barrier: a later upload to
5
+ * it leaves nothing buildable and a build request fails `appVersionNotFound` (ADR-0044). An already
6
+ * absent version counts as deleted. Never call this once a build may have been submitted.
7
+ */
8
+ export declare function deleteVersion(api: Pick<ZeropsApi, 'deleteAppVersion'>, appVersionId: string, signal: AbortSignal): Promise<void>;