@fabrika/provider-contract 0.0.4 → 0.0.5
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 +2 -2
- package/src/control.ts +20 -0
- package/src/deploy.ts +5 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fabrika/provider-contract",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -26,6 +26,6 @@
|
|
|
26
26
|
"test": "bun test"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@fabrika/auth-core": "^0.0.
|
|
29
|
+
"@fabrika/auth-core": "^0.0.5"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/src/control.ts
CHANGED
|
@@ -46,6 +46,21 @@ export interface ProviderRegistrationInput {
|
|
|
46
46
|
/** Canonical registration returned after provider-owned validation and normalization. */
|
|
47
47
|
export type ProviderRegistration = ProviderRegistrationInput
|
|
48
48
|
|
|
49
|
+
/** Provider-neutral input for resolving one requested source ref to an immutable Git object id. */
|
|
50
|
+
export interface ProviderSourceResolutionInput {
|
|
51
|
+
readonly runId: string
|
|
52
|
+
readonly app: ProviderApp
|
|
53
|
+
readonly environment: ProviderEnvironment
|
|
54
|
+
/** An immutable commit already recorded by the trigger, which resolution must verify exactly. */
|
|
55
|
+
readonly expectedCommitSha?: string
|
|
56
|
+
readonly signal: AbortSignal
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/** The exact source revision a provider resolved before starting deploy work. */
|
|
60
|
+
export interface ProviderSourceResolution {
|
|
61
|
+
readonly commitSha: string
|
|
62
|
+
}
|
|
63
|
+
|
|
49
64
|
/** One control-plane deploy invocation. */
|
|
50
65
|
export interface ProviderDeployInput {
|
|
51
66
|
readonly runId: string
|
|
@@ -89,6 +104,8 @@ export interface ProviderRunReference {
|
|
|
89
104
|
readonly runId: string
|
|
90
105
|
readonly externalId: string
|
|
91
106
|
readonly environment: ProviderEnvironment
|
|
107
|
+
/** Credential-free provider-owned progress needed to resume the external operation. */
|
|
108
|
+
readonly providerState?: JsonValue
|
|
92
109
|
}
|
|
93
110
|
|
|
94
111
|
export type ProviderCancelInput = ProviderRunReference
|
|
@@ -96,6 +113,8 @@ export type ProviderCancelInput = ProviderRunReference
|
|
|
96
113
|
export interface ProviderReconcileInput extends ProviderRunReference {
|
|
97
114
|
/** See `ProviderDeployInput.returnOrigins`; a provider that finishes a resumed deploy projects the same set. */
|
|
98
115
|
readonly returnOrigins?: readonly string[]
|
|
116
|
+
/** Persist a credential-free recovery checkpoint before the next irreversible provider call. */
|
|
117
|
+
checkpoint(state: JsonValue): Promise<void>
|
|
99
118
|
}
|
|
100
119
|
|
|
101
120
|
/** The latest state reported while reconciling a platform-owned run. */
|
|
@@ -216,6 +235,7 @@ export interface ProviderNamespaceCapabilities {
|
|
|
216
235
|
export interface ControlProvider {
|
|
217
236
|
readonly id: string
|
|
218
237
|
normalizeRegistration(input: ProviderRegistrationInput): ProviderRegistration
|
|
238
|
+
resolveSource?(input: ProviderSourceResolutionInput): Promise<ProviderSourceResolution>
|
|
219
239
|
deploy(input: ProviderDeployInput): Promise<ProviderTerminalOutcome>
|
|
220
240
|
cancel?(input: ProviderCancelInput): Promise<void>
|
|
221
241
|
reconcile?(input: ProviderReconcileInput): Promise<ProviderReconcileOutcome>
|
package/src/deploy.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ProviderEnvelope } from './json'
|
|
1
|
+
import type { JsonValue, ProviderEnvelope } from './json'
|
|
2
2
|
|
|
3
3
|
/** One provider-owned unit of deploy work. Core treats `kind` as an open string. */
|
|
4
4
|
export interface ProviderJobSpec {
|
|
@@ -45,7 +45,10 @@ export interface ProviderDeployResult {
|
|
|
45
45
|
/** Events whose persistence and presentation belong to the control plane. */
|
|
46
46
|
export interface ProviderRunEvents {
|
|
47
47
|
log(line: string): void
|
|
48
|
-
|
|
48
|
+
/** Atomically persist the external operation id and, when supplied, its credential-free resume state. */
|
|
49
|
+
externalId(id: string, state?: JsonValue): Promise<void>
|
|
50
|
+
/** Replace the credential-free resume state while this run remains active. */
|
|
51
|
+
checkpoint(state: JsonValue): Promise<void>
|
|
49
52
|
}
|
|
50
53
|
|
|
51
54
|
/** Complete platform-owned runtime state. A null value removes the key from persistent targets. */
|