@fabrika/provider-zerops 0.0.1
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 +40 -0
- package/src/api.ts +825 -0
- package/src/authoring.ts +33 -0
- package/src/cli-args.ts +101 -0
- package/src/cli.ts +82 -0
- package/src/codec.ts +50 -0
- package/src/collaborators.ts +47 -0
- package/src/compile.ts +382 -0
- package/src/control.ts +390 -0
- package/src/index.ts +98 -0
- package/src/manifest.ts +442 -0
- package/src/namespace-command.ts +209 -0
- package/src/namespace.ts +1028 -0
- package/src/plan.ts +51 -0
- package/src/provider.ts +311 -0
- package/src/schema.generated.ts +607 -0
- package/src/service-names.ts +38 -0
- package/src/types.ts +125 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import type { AppGates } from '@fabrika/auth-core'
|
|
2
|
+
import type { AppConfigBase } from '@fabrika/provider-contract'
|
|
3
|
+
import type {
|
|
4
|
+
ZeropsHealthCheck,
|
|
5
|
+
ZeropsImportProject,
|
|
6
|
+
ZeropsImportService,
|
|
7
|
+
ZeropsReadinessCheck,
|
|
8
|
+
ZeropsYamlDeploy,
|
|
9
|
+
ZeropsYamlRun,
|
|
10
|
+
ZeropsYamlSetup,
|
|
11
|
+
} from './schema.generated'
|
|
12
|
+
|
|
13
|
+
export interface ZeropsResourceContext {
|
|
14
|
+
env: string
|
|
15
|
+
domain?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* A probe interval or timeout, as the PLATFORM takes it — a Go duration with a unit, e.g. `30s`.
|
|
20
|
+
*
|
|
21
|
+
* The published JSON schema types all six of these as `integer`, and the platform refuses an integer:
|
|
22
|
+
* `POST /service-stack/zerops-yaml-validation` answers `yamlValidationInvalidYaml` with
|
|
23
|
+
* `cannot unmarshal !!int into time.Duration`. The account wins, so this type does. Every value is also
|
|
24
|
+
* bounded to **[10s, 1h]** — `5s` is refused with `invalid execPeriod <10s, 1h0m0s>` — which no
|
|
25
|
+
* published document states; see `docs/reference/zerops-platform.md`.
|
|
26
|
+
*/
|
|
27
|
+
export type ZeropsDuration = `${number}${'s' | 'm' | 'h'}`
|
|
28
|
+
|
|
29
|
+
/** `run.healthCheck`, with the four duration fields corrected to what the platform accepts. */
|
|
30
|
+
export interface ZeropsHealthCheckSpec extends Omit<ZeropsHealthCheck, ZeropsHealthCheckDurationField> {
|
|
31
|
+
failureTimeout?: ZeropsDuration
|
|
32
|
+
disconnectTimeout?: ZeropsDuration
|
|
33
|
+
recoveryTimeout?: ZeropsDuration
|
|
34
|
+
execPeriod?: ZeropsDuration
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
type ZeropsHealthCheckDurationField = 'failureTimeout' | 'disconnectTimeout' | 'recoveryTimeout' | 'execPeriod'
|
|
38
|
+
|
|
39
|
+
/** `deploy.readinessCheck`, with its two duration fields corrected. */
|
|
40
|
+
export interface ZeropsReadinessCheckSpec extends Omit<ZeropsReadinessCheck, 'failureTimeout' | 'retryPeriod'> {
|
|
41
|
+
failureTimeout?: ZeropsDuration
|
|
42
|
+
retryPeriod?: ZeropsDuration
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface ZeropsYamlRunSpec extends Omit<ZeropsYamlRun, 'healthCheck'> {
|
|
46
|
+
healthCheck?: ZeropsHealthCheckSpec
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface ZeropsYamlDeploySpec extends Omit<ZeropsYamlDeploy, 'readinessCheck'> {
|
|
50
|
+
readinessCheck?: ZeropsReadinessCheckSpec
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
export interface ZeropsYamlSetupSpec extends Omit<ZeropsYamlSetup, 'run' | 'deploy'> {
|
|
54
|
+
run?: ZeropsYamlRunSpec
|
|
55
|
+
deploy?: ZeropsYamlDeploySpec
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* A `zerops.yaml` as fabrika AUTHORS it.
|
|
60
|
+
*
|
|
61
|
+
* Same relationship to `ZeropsYaml` that `ZeropsServiceSpec` has to `ZeropsImportService`: the generated
|
|
62
|
+
* transcription is the platform's published contract, and this is the authoring surface, which diverges
|
|
63
|
+
* from it only where a live account has proved the publication wrong.
|
|
64
|
+
*/
|
|
65
|
+
export interface ZeropsYamlSpec {
|
|
66
|
+
zerops: ZeropsYamlSetupSpec[]
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export type ZeropsCompilerOwnedServiceField =
|
|
70
|
+
| 'envIsolation'
|
|
71
|
+
| 'override'
|
|
72
|
+
| 'envSecrets'
|
|
73
|
+
| 'dotEnvSecrets'
|
|
74
|
+
| 'mode'
|
|
75
|
+
| 'os'
|
|
76
|
+
|
|
77
|
+
export type ZeropsCompilerOwnedProjectField = 'envVariables' | 'envIsolation'
|
|
78
|
+
|
|
79
|
+
export type ZeropsServiceSpec = Omit<ZeropsImportService, ZeropsCompilerOwnedServiceField>
|
|
80
|
+
|
|
81
|
+
export type ZeropsProjectSpec = Omit<ZeropsImportProject, ZeropsCompilerOwnedProjectField>
|
|
82
|
+
|
|
83
|
+
export interface ZeropsProxySpec {
|
|
84
|
+
upstream: string
|
|
85
|
+
gates: AppGates
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* A typed reference to the namespace-owned PostgreSQL service; it never contains its credential.
|
|
90
|
+
*
|
|
91
|
+
* The reference names its DATABASE and its TLS MODE rather than inheriting either from the driver — see
|
|
92
|
+
* `ZEROPS_SHARED_POSTGRES_CONNECTION_STRING` in `./namespace.ts` for what the account proved about both.
|
|
93
|
+
*/
|
|
94
|
+
export interface ZeropsSharedPostgresBinding {
|
|
95
|
+
readonly resourceKey: 'service:postgres'
|
|
96
|
+
readonly hostname: 'postgres'
|
|
97
|
+
readonly connectionString: '${postgres_connectionString}/${postgres_dbName}?sslmode=require'
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export type ZeropsNamespaceResourceRequirement = ZeropsSharedPostgresBinding
|
|
101
|
+
|
|
102
|
+
export interface ZeropsSourceTarget {
|
|
103
|
+
platform: 'zerops'
|
|
104
|
+
deployService?: string
|
|
105
|
+
zeropsSetup?: string
|
|
106
|
+
proxy?: ZeropsProxySpec
|
|
107
|
+
namespaceResources?: ZeropsNamespaceResourceRequirement[]
|
|
108
|
+
services: (ctx: ZeropsResourceContext) => ZeropsServiceSpec[]
|
|
109
|
+
project?: ZeropsProjectSpec
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface ZeropsAppConfig extends AppConfigBase {
|
|
113
|
+
target: ZeropsSourceTarget
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** Ephemeral runtime coordinates. This value is encoded only after credentials are composed. */
|
|
117
|
+
export interface ZeropsRuntimeTarget {
|
|
118
|
+
projectId: string
|
|
119
|
+
serviceId: string
|
|
120
|
+
accessToken: string
|
|
121
|
+
buildFromGit?: string
|
|
122
|
+
apiBaseUrl?: string
|
|
123
|
+
propustkaUrl?: string
|
|
124
|
+
adminKey?: string
|
|
125
|
+
}
|