@rathnasgala2/adapter-github-pages 0.1.0
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/CHANGELOG.md +125 -0
- package/README.md +202 -0
- package/package.json +39 -0
- package/src/artifact-projection.js +78 -0
- package/src/capability.js +229 -0
- package/src/carrier.js +216 -0
- package/src/constants.js +156 -0
- package/src/deployment.js +333 -0
- package/src/index.d.ts +246 -0
- package/src/index.js +977 -0
- package/src/marker.js +73 -0
- package/src/oidc.js +515 -0
- package/src/public-read.js +61 -0
- package/src/recovery.js +784 -0
- package/src/redaction.js +112 -0
- package/src/request-catalog.js +417 -0
- package/src/rest.js +360 -0
- package/src/store.js +103 -0
package/src/index.d.ts
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import type { Buffer } from 'node:buffer';
|
|
2
|
+
|
|
3
|
+
export interface PagesCarrierFile {
|
|
4
|
+
readonly path: string;
|
|
5
|
+
readonly bytes: Buffer;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* The caller-supplied expected bindings a Pages OIDC token must carry. The
|
|
10
|
+
* adapter never mints the token and cannot invent these values; the
|
|
11
|
+
* `deploy-github-pages` job supplies both.
|
|
12
|
+
*/
|
|
13
|
+
export interface PagesOidcClaims {
|
|
14
|
+
readonly ref: string;
|
|
15
|
+
readonly sha: string;
|
|
16
|
+
readonly runId: string | number;
|
|
17
|
+
readonly runAttempt: string | number;
|
|
18
|
+
readonly jobWorkflowRef: string;
|
|
19
|
+
readonly jobWorkflowSha: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface PagesDestination {
|
|
23
|
+
readonly owner: string;
|
|
24
|
+
readonly repository: string;
|
|
25
|
+
readonly repositoryId?: string | number;
|
|
26
|
+
readonly repositoryOwnerId?: string | number;
|
|
27
|
+
/** The Pages OIDC JWT, when supplied at destination level. */
|
|
28
|
+
readonly oidcToken?: string;
|
|
29
|
+
/** The expected OIDC bindings, when supplied at destination level. */
|
|
30
|
+
readonly oidcClaims?: PagesOidcClaims;
|
|
31
|
+
readonly apiOrigin?: string;
|
|
32
|
+
readonly publicBaseUrl: string;
|
|
33
|
+
readonly token: string;
|
|
34
|
+
readonly publishCarrier: (input: {
|
|
35
|
+
bytes: Buffer;
|
|
36
|
+
generationId: string;
|
|
37
|
+
carrierDigest: string;
|
|
38
|
+
}) => Promise<{
|
|
39
|
+
pagesArtifactId: string | number;
|
|
40
|
+
artifactDigest?: string;
|
|
41
|
+
byteCount?: number;
|
|
42
|
+
}>;
|
|
43
|
+
readonly fetch?: typeof globalThis.fetch;
|
|
44
|
+
readonly publicFetch?: typeof globalThis.fetch;
|
|
45
|
+
readonly sleep?: (seconds: number) => Promise<void>;
|
|
46
|
+
readonly runId?: string;
|
|
47
|
+
readonly runAttempt?: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export declare const ADAPTER_VERSION: string;
|
|
51
|
+
export declare const GENERATION_MARKER_PATH: string;
|
|
52
|
+
export declare const PACKAGE_STATUS: Readonly<{
|
|
53
|
+
name: string;
|
|
54
|
+
implemented: true;
|
|
55
|
+
implementingTask: string;
|
|
56
|
+
}>;
|
|
57
|
+
|
|
58
|
+
export declare function generateUuidV7(): string;
|
|
59
|
+
/** Re-exported adapter-protocol 2.1.0 fence sentinel (LOCAL-47). */
|
|
60
|
+
export declare const EXPECT_NOTHING_SERVED: string;
|
|
61
|
+
/** Re-exported adapter-protocol fence constructor for an observation. */
|
|
62
|
+
export declare function fenceFor(
|
|
63
|
+
observedGenerationId: string | null | undefined,
|
|
64
|
+
): string;
|
|
65
|
+
export declare function computeArtifactDigest(
|
|
66
|
+
files: readonly PagesCarrierFile[],
|
|
67
|
+
): string;
|
|
68
|
+
export declare function encodeCarrier(
|
|
69
|
+
files: readonly PagesCarrierFile[],
|
|
70
|
+
): Buffer;
|
|
71
|
+
export declare function decodeCarrier(carrier: Buffer): PagesCarrierFile[];
|
|
72
|
+
export declare function forgetDestination(destination: {
|
|
73
|
+
owner: string;
|
|
74
|
+
repository: string;
|
|
75
|
+
repositoryId?: string | number;
|
|
76
|
+
}): void;
|
|
77
|
+
|
|
78
|
+
export declare function describeCapabilities(
|
|
79
|
+
destination: PagesDestination,
|
|
80
|
+
): Promise<Readonly<Record<string, unknown>>>;
|
|
81
|
+
export declare function inspectDestination(
|
|
82
|
+
destination: PagesDestination,
|
|
83
|
+
): Promise<Readonly<Record<string, unknown>>>;
|
|
84
|
+
export declare function preflight(input: {
|
|
85
|
+
destination: PagesDestination;
|
|
86
|
+
entries: readonly { path: string }[];
|
|
87
|
+
expectedGenerationId?: string;
|
|
88
|
+
}): Promise<Readonly<Record<string, unknown>>>;
|
|
89
|
+
export declare function stage(input: {
|
|
90
|
+
destination: PagesDestination;
|
|
91
|
+
operationId: string;
|
|
92
|
+
attemptId: string;
|
|
93
|
+
idempotencyKey: string;
|
|
94
|
+
generationId: string;
|
|
95
|
+
artifactId: string;
|
|
96
|
+
artifactDigest: string;
|
|
97
|
+
files: readonly PagesCarrierFile[];
|
|
98
|
+
}): Promise<Readonly<Record<string, unknown>>>;
|
|
99
|
+
export declare function activate(input: {
|
|
100
|
+
destination: PagesDestination;
|
|
101
|
+
stageToken: string;
|
|
102
|
+
generationId: string;
|
|
103
|
+
/**
|
|
104
|
+
* Adapter protocol 2.1.0 fence: a generation identity, or the
|
|
105
|
+
* `EXPECT_NOTHING_SERVED` sentinel. `null`/`undefined` are refused
|
|
106
|
+
* (`EXPECTED_GENERATION_FENCE_INVALID`, LOCAL-47).
|
|
107
|
+
*/
|
|
108
|
+
expectedCurrentGenerationId: string;
|
|
109
|
+
expectedArtifactDigest?: string;
|
|
110
|
+
/** The mandatory Pages OIDC JWT, unless supplied on the destination. */
|
|
111
|
+
pagesOidcToken?: string;
|
|
112
|
+
/** The mandatory expected OIDC bindings, unless on the destination. */
|
|
113
|
+
pagesOidcClaims?: PagesOidcClaims;
|
|
114
|
+
/** `normal` (default) or `pages-reconciliation-recovery`. */
|
|
115
|
+
mode?: 'normal' | 'pages-reconciliation-recovery';
|
|
116
|
+
/** The server-minted recovery record; forbidden in `normal` mode. */
|
|
117
|
+
pagesRecovery?: Readonly<Record<string, unknown>>;
|
|
118
|
+
crashInjectionHook?: () => void | Promise<void>;
|
|
119
|
+
}): Promise<Readonly<Record<string, unknown>>>;
|
|
120
|
+
|
|
121
|
+
export declare function recoverPriorAttempt(input: {
|
|
122
|
+
destination: PagesDestination;
|
|
123
|
+
pagesRecovery: Readonly<Record<string, unknown>>;
|
|
124
|
+
}): Promise<Readonly<Record<string, unknown>>>;
|
|
125
|
+
export declare function observe(input: {
|
|
126
|
+
destination: PagesDestination;
|
|
127
|
+
generationId: string;
|
|
128
|
+
expectedArtifactDigest: string;
|
|
129
|
+
}): Promise<Readonly<Record<string, unknown>>>;
|
|
130
|
+
export declare function cleanupStaged(input: {
|
|
131
|
+
destination: PagesDestination;
|
|
132
|
+
stageToken: string;
|
|
133
|
+
generationId?: string;
|
|
134
|
+
}): Promise<Readonly<{ removed: boolean; cancelled: boolean }>>;
|
|
135
|
+
export declare function rollback(input: {
|
|
136
|
+
destination: PagesDestination;
|
|
137
|
+
targetGenerationId: string;
|
|
138
|
+
newGenerationId: string;
|
|
139
|
+
newArtifactId: string;
|
|
140
|
+
operationId: string;
|
|
141
|
+
attemptId: string;
|
|
142
|
+
idempotencyKey: string;
|
|
143
|
+
files?: readonly PagesCarrierFile[];
|
|
144
|
+
artifactDigest?: string;
|
|
145
|
+
pagesOidcToken?: string;
|
|
146
|
+
pagesOidcClaims?: PagesOidcClaims;
|
|
147
|
+
}): Promise<Readonly<Record<string, unknown>>>;
|
|
148
|
+
|
|
149
|
+
export declare const NORMAL_MODE: 'normal';
|
|
150
|
+
export declare const RECOVERY_MODE: 'pages-reconciliation-recovery';
|
|
151
|
+
export declare const GITHUB_API_ORIGIN: string;
|
|
152
|
+
export declare const REQUEST_TEMPLATE_PROFILE: string;
|
|
153
|
+
export declare const PAGES_OIDC_PROFILE: string;
|
|
154
|
+
export declare const PAGES_OIDC_ISSUER: string;
|
|
155
|
+
export declare const PAGES_OIDC_ENVIRONMENT: string;
|
|
156
|
+
export declare const GAP_PROOF_PROFILE: string;
|
|
157
|
+
export declare const RECOVERY_RECORD_PROFILE: string;
|
|
158
|
+
export declare const NO_AUTHORITY_STATE: 'closed-no-destination-authority';
|
|
159
|
+
export declare const PAGES_CALL_PLAN: readonly Readonly<{
|
|
160
|
+
stage: string;
|
|
161
|
+
callClass: string;
|
|
162
|
+
}>[];
|
|
163
|
+
export declare const CALL_CLASS_BINDING: readonly Readonly<{
|
|
164
|
+
stage: string;
|
|
165
|
+
callClass: string;
|
|
166
|
+
pagesDeploymentIdSource: string;
|
|
167
|
+
recoveryOnly: boolean;
|
|
168
|
+
}>[];
|
|
169
|
+
export declare function callClassIdBinding(
|
|
170
|
+
stage: string,
|
|
171
|
+
callClass: string,
|
|
172
|
+
): Readonly<{
|
|
173
|
+
stage: string;
|
|
174
|
+
callClass: string;
|
|
175
|
+
pagesDeploymentIdSource: string;
|
|
176
|
+
recoveryOnly: boolean;
|
|
177
|
+
}>;
|
|
178
|
+
|
|
179
|
+
export declare function buildRequestTemplates(
|
|
180
|
+
apiOrigin?: string,
|
|
181
|
+
): readonly Readonly<Record<string, unknown>>[];
|
|
182
|
+
export declare function requireTemplate(
|
|
183
|
+
templates: readonly Readonly<Record<string, unknown>>[],
|
|
184
|
+
stage: string,
|
|
185
|
+
callClass: string,
|
|
186
|
+
): Readonly<Record<string, unknown>>;
|
|
187
|
+
|
|
188
|
+
export declare function verifyPagesOidcToken(
|
|
189
|
+
token: unknown,
|
|
190
|
+
expected: PagesOidcClaims & {
|
|
191
|
+
owner: string;
|
|
192
|
+
repository: string;
|
|
193
|
+
repositoryId: string | number;
|
|
194
|
+
repositoryOwnerId: string | number;
|
|
195
|
+
},
|
|
196
|
+
): Readonly<{
|
|
197
|
+
profile: string;
|
|
198
|
+
subjectForm: 'name' | 'identifier';
|
|
199
|
+
issuerSignatureVerified: false;
|
|
200
|
+
tokenByteCount: number;
|
|
201
|
+
}>;
|
|
202
|
+
export declare function buildSubjectForms(identity: {
|
|
203
|
+
owner: string;
|
|
204
|
+
repository: string;
|
|
205
|
+
repositoryId: string;
|
|
206
|
+
repositoryOwnerId: string;
|
|
207
|
+
}): { name: string; id: string };
|
|
208
|
+
|
|
209
|
+
export declare function computeInterveningAttemptDigest(input: {
|
|
210
|
+
repositoryId: string | number;
|
|
211
|
+
runId: string | number;
|
|
212
|
+
runAttempt: number;
|
|
213
|
+
}): string;
|
|
214
|
+
export declare function buildInterveningAttempts(input: {
|
|
215
|
+
repositoryId: string | number;
|
|
216
|
+
runId: string | number;
|
|
217
|
+
priorRunAttempt: number;
|
|
218
|
+
claimingRunAttempt: number;
|
|
219
|
+
}): readonly Readonly<{
|
|
220
|
+
runAttempt: number;
|
|
221
|
+
authorityState: string;
|
|
222
|
+
decisionDigest: string;
|
|
223
|
+
}>[];
|
|
224
|
+
export declare function buildRunAttemptGapProof(input: {
|
|
225
|
+
repositoryId: string | number;
|
|
226
|
+
runId: string | number;
|
|
227
|
+
priorRunAttempt: number;
|
|
228
|
+
claimingRunAttempt: number;
|
|
229
|
+
}): Readonly<Record<string, unknown>>;
|
|
230
|
+
export declare function computeGapProofDigest(
|
|
231
|
+
proof: Readonly<Record<string, unknown>>,
|
|
232
|
+
): string;
|
|
233
|
+
export declare function validateRunAttemptGapProof(
|
|
234
|
+
proof: unknown,
|
|
235
|
+
binding: { repositoryId: string | number },
|
|
236
|
+
): Readonly<Record<string, unknown>>;
|
|
237
|
+
export declare function computeRecoveryDigest(
|
|
238
|
+
recovery: Readonly<Record<string, unknown>>,
|
|
239
|
+
): string;
|
|
240
|
+
export declare function sealRecoveryRecord(
|
|
241
|
+
withoutDigest: Readonly<Record<string, unknown>>,
|
|
242
|
+
): Readonly<Record<string, unknown>>;
|
|
243
|
+
export declare function validateReconciliationRecovery(
|
|
244
|
+
recovery: unknown,
|
|
245
|
+
binding: { repositoryId: string | number },
|
|
246
|
+
): Readonly<Record<string, unknown>>;
|