@highstate/backend 0.20.0 → 0.21.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/dist/chunk-b05q6fm2.js +37 -0
- package/dist/{chunk-52MY2TCE.js → chunk-gxjwa93h.js} +506 -734
- package/dist/{chunk-X2WG3WGL.js → chunk-vzdz6chj.js} +18 -15
- package/dist/highstate.manifest.json +4 -4
- package/dist/index.js +4020 -3558
- package/dist/library/package-resolution-worker.js +121 -10
- package/dist/library/worker/main.js +27 -16
- package/dist/shared/index.js +254 -4
- package/package.json +15 -16
- package/src/artifact/factory.ts +3 -2
- package/src/library/find-package-json.test.ts +77 -0
- package/src/library/find-package-json.ts +149 -0
- package/src/library/package-resolution-worker.ts +7 -3
- package/src/orchestrator/operation.ts +2 -0
- package/src/orchestrator/operation.update.skip.test.ts +86 -0
- package/src/runner/factory.ts +3 -3
- package/src/runner/force-abort.ts +7 -2
- package/src/runner/local.ts +8 -3
- package/src/runner/pulumi.ts +3 -5
- package/src/services.ts +1 -1
- package/src/terminal/run.sh.ts +9 -4
- package/LICENSE +0 -21
- package/dist/chunk-52MY2TCE.js.map +0 -1
- package/dist/chunk-UAWBPTDW.js +0 -49
- package/dist/chunk-UAWBPTDW.js.map +0 -1
- package/dist/chunk-X2WG3WGL.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/library/package-resolution-worker.js.map +0 -1
- package/dist/library/worker/main.js.map +0 -1
- package/dist/shared/index.js.map +0 -1
|
@@ -1,13 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import { z as z$1 } from 'zod';
|
|
3
|
-
import { mapValues, constant, unique, fromEntries } from 'remeda';
|
|
4
|
-
import { crc32 } from '@aws-crypto/crc32';
|
|
5
|
-
import { encode } from '@msgpack/msgpack';
|
|
6
|
-
import { Buffer } from 'buffer-polyfill';
|
|
7
|
-
import { Ajv } from 'ajv';
|
|
8
|
-
import styles from 'ansi-styles';
|
|
9
|
-
|
|
1
|
+
// @bun
|
|
10
2
|
// src/shared/models/backend/library.ts
|
|
3
|
+
import { z } from "@highstate/contract";
|
|
11
4
|
var librarySpecSchema = z.discriminatedUnion("type", [
|
|
12
5
|
z.object({
|
|
13
6
|
type: z.literal("host")
|
|
@@ -55,6 +48,8 @@ function applyLibraryUpdate(components, entities, update) {
|
|
|
55
48
|
break;
|
|
56
49
|
}
|
|
57
50
|
}
|
|
51
|
+
// src/shared/models/backend/project.ts
|
|
52
|
+
import { commonObjectMetaSchema, genericNameSchema, timestampsSchema, z as z2 } from "@highstate/contract";
|
|
58
53
|
|
|
59
54
|
// src/shared/models/backend/well-known.ts
|
|
60
55
|
var globalProjectSpace = {
|
|
@@ -104,219 +99,202 @@ var databaseProjectModelStorage = {
|
|
|
104
99
|
};
|
|
105
100
|
|
|
106
101
|
// src/shared/models/backend/project.ts
|
|
107
|
-
var projectModelStorageSpecSchema =
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
* The project model is stored in the codebase where Highstate is running.
|
|
111
|
-
*/
|
|
112
|
-
type: z.literal("codebase")
|
|
102
|
+
var projectModelStorageSpecSchema = z2.discriminatedUnion("type", [
|
|
103
|
+
z2.object({
|
|
104
|
+
type: z2.literal("codebase")
|
|
113
105
|
}),
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
* The project model is stored in the project database alongside the project data.
|
|
117
|
-
*/
|
|
118
|
-
type: z.literal("database")
|
|
106
|
+
z2.object({
|
|
107
|
+
type: z2.literal("database")
|
|
119
108
|
})
|
|
120
109
|
]);
|
|
121
|
-
var projectInputSchema =
|
|
110
|
+
var projectInputSchema = z2.object({
|
|
122
111
|
name: genericNameSchema,
|
|
123
|
-
spaceId:
|
|
124
|
-
modelStorageId:
|
|
125
|
-
libraryId:
|
|
126
|
-
pulumiBackendId:
|
|
112
|
+
spaceId: z2.cuid2().default(globalProjectSpace.id),
|
|
113
|
+
modelStorageId: z2.cuid2().default(codebaseProjectModelStorage.id),
|
|
114
|
+
libraryId: z2.cuid2().default(codebaseLibrary.id),
|
|
115
|
+
pulumiBackendId: z2.cuid2().default(hostPulumiBackend.id),
|
|
127
116
|
meta: commonObjectMetaSchema
|
|
128
117
|
});
|
|
129
|
-
var projectOutputSchema =
|
|
130
|
-
id:
|
|
118
|
+
var projectOutputSchema = z2.object({
|
|
119
|
+
id: z2.string(),
|
|
131
120
|
name: genericNameSchema,
|
|
132
121
|
meta: commonObjectMetaSchema,
|
|
133
|
-
spaceId:
|
|
134
|
-
modelStorageId:
|
|
135
|
-
libraryId:
|
|
136
|
-
pulumiBackendId:
|
|
122
|
+
spaceId: z2.cuid2(),
|
|
123
|
+
modelStorageId: z2.cuid2(),
|
|
124
|
+
libraryId: z2.cuid2(),
|
|
125
|
+
pulumiBackendId: z2.cuid2(),
|
|
137
126
|
...timestampsSchema.shape
|
|
138
127
|
});
|
|
139
|
-
var projectUnlockSuiteSchema =
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
*
|
|
143
|
-
* The frontend should try to decrypt at least one of these identities
|
|
144
|
-
* using the password or passkey.
|
|
145
|
-
*/
|
|
146
|
-
encryptedIdentities: z.array(z.string()),
|
|
147
|
-
/**
|
|
148
|
-
* Whether one of the identities is a passkey and user should be asked to use it.
|
|
149
|
-
*/
|
|
150
|
-
hasPasskey: z.boolean()
|
|
128
|
+
var projectUnlockSuiteSchema = z2.object({
|
|
129
|
+
encryptedIdentities: z2.array(z2.string()),
|
|
130
|
+
hasPasskey: z2.boolean()
|
|
151
131
|
});
|
|
152
|
-
var projectUnlockStateSchema =
|
|
153
|
-
|
|
154
|
-
type:
|
|
132
|
+
var projectUnlockStateSchema = z2.discriminatedUnion("type", [
|
|
133
|
+
z2.object({
|
|
134
|
+
type: z2.literal("locked"),
|
|
155
135
|
unlockSuite: projectUnlockSuiteSchema.optional()
|
|
156
136
|
}),
|
|
157
|
-
|
|
158
|
-
type:
|
|
137
|
+
z2.object({
|
|
138
|
+
type: z2.literal("unlocked")
|
|
159
139
|
})
|
|
160
140
|
]);
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
* The backend is expected to be configured with the `pulumi login` command by the user.
|
|
167
|
-
*/
|
|
168
|
-
type: z.literal("host")
|
|
141
|
+
// src/shared/models/backend/pulumi.ts
|
|
142
|
+
import { z as z3 } from "@highstate/contract";
|
|
143
|
+
var pulumiBackendSpecSchema = z3.discriminatedUnion("type", [
|
|
144
|
+
z3.object({
|
|
145
|
+
type: z3.literal("host")
|
|
169
146
|
})
|
|
170
147
|
]);
|
|
148
|
+
// src/shared/models/backend/unlock-method.ts
|
|
149
|
+
import { objectMetaSchema } from "@highstate/contract";
|
|
150
|
+
import { z as z4 } from "zod";
|
|
171
151
|
var backendUnlockMethodMetaSchema = objectMetaSchema.pick({ title: true, description: true }).required({ title: true });
|
|
172
|
-
var backendUnlockMethodInputSchema =
|
|
152
|
+
var backendUnlockMethodInputSchema = z4.object({
|
|
173
153
|
meta: backendUnlockMethodMetaSchema,
|
|
174
|
-
recipient:
|
|
154
|
+
recipient: z4.string()
|
|
175
155
|
});
|
|
156
|
+
// src/shared/models/base.ts
|
|
157
|
+
import { constant, mapValues } from "remeda";
|
|
158
|
+
import { z as z5 } from "zod";
|
|
176
159
|
function hasObjectMeta(value) {
|
|
177
160
|
return typeof value === "object" && value !== null && "meta" in value;
|
|
178
161
|
}
|
|
179
|
-
var sortBySchema =
|
|
180
|
-
key:
|
|
181
|
-
order:
|
|
162
|
+
var sortBySchema = z5.object({
|
|
163
|
+
key: z5.string(),
|
|
164
|
+
order: z5.enum(["asc", "desc"])
|
|
182
165
|
});
|
|
183
|
-
var collectionQuerySchema =
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* The sorting configuration for the results.
|
|
190
|
-
*
|
|
191
|
-
* Can be a single sort field or an array of sort fields.
|
|
192
|
-
* Each sort field contains the key and order.
|
|
193
|
-
*/
|
|
194
|
-
sortBy: z$1.array(sortBySchema).optional(),
|
|
195
|
-
/**
|
|
196
|
-
* The number of items to skip.
|
|
197
|
-
*
|
|
198
|
-
* Defaults to 0 if not specified.
|
|
199
|
-
*/
|
|
200
|
-
skip: z$1.number().int().nonnegative().default(0).optional(),
|
|
201
|
-
/**
|
|
202
|
-
* The count of documents to return.
|
|
203
|
-
*
|
|
204
|
-
* Defaults to 20 if not specified.
|
|
205
|
-
* Maximum value is 100.
|
|
206
|
-
*/
|
|
207
|
-
count: z$1.number().int().positive().max(100).default(20).optional()
|
|
166
|
+
var collectionQuerySchema = z5.object({
|
|
167
|
+
search: z5.string().optional(),
|
|
168
|
+
sortBy: z5.array(sortBySchema).optional(),
|
|
169
|
+
skip: z5.number().int().nonnegative().default(0).optional(),
|
|
170
|
+
count: z5.number().int().positive().max(100).default(20).optional()
|
|
208
171
|
});
|
|
209
172
|
function collectionQueryResult(schema) {
|
|
210
|
-
return
|
|
211
|
-
items:
|
|
212
|
-
total:
|
|
173
|
+
return z5.object({
|
|
174
|
+
items: z5.array(schema),
|
|
175
|
+
total: z5.number().int().nonnegative()
|
|
213
176
|
});
|
|
214
177
|
}
|
|
215
178
|
function forSchema(schema) {
|
|
216
179
|
return mapValues(schema.shape, constant(true));
|
|
217
180
|
}
|
|
218
|
-
|
|
219
181
|
// src/shared/models/errors.ts
|
|
220
|
-
|
|
182
|
+
class BackendError extends Error {
|
|
221
183
|
constructor(message, cause) {
|
|
222
184
|
super(message, { cause });
|
|
223
185
|
this.name = "BackendError";
|
|
224
186
|
}
|
|
225
|
-
}
|
|
226
|
-
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
class AccessError extends BackendError {
|
|
227
190
|
constructor(message) {
|
|
228
191
|
super(message);
|
|
229
192
|
this.name = "AccessError";
|
|
230
193
|
}
|
|
231
|
-
}
|
|
232
|
-
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
class ProjectLockedError extends AccessError {
|
|
233
197
|
constructor(projectId) {
|
|
234
198
|
super(`The project with ID "${projectId}" is locked, decryption is not possible.`);
|
|
235
199
|
}
|
|
236
|
-
}
|
|
237
|
-
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
class ProjectNotFoundError extends BackendError {
|
|
238
203
|
constructor(projectId) {
|
|
239
204
|
super(`Project with ID "${projectId}" not found.`);
|
|
240
205
|
this.name = "ProjectNotFoundError";
|
|
241
206
|
}
|
|
242
|
-
}
|
|
243
|
-
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
class CannotDeleteLastUnlockMethodError extends BackendError {
|
|
244
210
|
constructor(projectId) {
|
|
245
211
|
super(`Refused to delete the last unlock method for project "${projectId}".`);
|
|
246
212
|
this.name = "CannotDeleteLastUnlockMethodError";
|
|
247
213
|
}
|
|
248
|
-
}
|
|
249
|
-
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
class InstanceNotFoundError extends BackendError {
|
|
250
217
|
constructor(projectId, instanceId) {
|
|
251
218
|
super(`Instance with ID "${instanceId}" not found in project "${projectId}".`);
|
|
252
219
|
this.name = "InstanceNotFoundError";
|
|
253
220
|
}
|
|
254
|
-
}
|
|
255
|
-
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
class InvalidInstanceKindError extends BackendError {
|
|
256
224
|
constructor(projectId, instanceId, expectedKind, actualKind) {
|
|
257
|
-
super(
|
|
258
|
-
`Instance "${instanceId}" in project "${projectId}" has kind "${actualKind}", but expected "${expectedKind}".`
|
|
259
|
-
);
|
|
225
|
+
super(`Instance "${instanceId}" in project "${projectId}" has kind "${actualKind}", but expected "${expectedKind}".`);
|
|
260
226
|
this.name = "InvalidInstanceKindError";
|
|
261
227
|
}
|
|
262
|
-
}
|
|
263
|
-
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
class OperationNotFoundError extends BackendError {
|
|
264
231
|
constructor(projectId, operationId) {
|
|
265
232
|
super(`Operation with ID "${operationId}" not found in project "${projectId}".`);
|
|
266
233
|
this.name = "OperationNotFoundError";
|
|
267
234
|
}
|
|
268
|
-
}
|
|
269
|
-
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
class InstanceLockLostError extends BackendError {
|
|
270
238
|
constructor(projectId, instanceIds, token) {
|
|
271
|
-
super(
|
|
272
|
-
`Instance lock lost for instances [${instanceIds.join(", ")}] in project "${projectId}" with token "${token}".`
|
|
273
|
-
);
|
|
239
|
+
super(`Instance lock lost for instances [${instanceIds.join(", ")}] in project "${projectId}" with token "${token}".`);
|
|
274
240
|
this.name = "InstanceLockLostError";
|
|
275
241
|
}
|
|
276
|
-
}
|
|
277
|
-
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
class InstanceStateNotFoundError extends BackendError {
|
|
278
245
|
constructor(projectId, instanceId) {
|
|
279
246
|
super(`State for instance with ID "${instanceId}" not found in project "${projectId}".`);
|
|
280
247
|
this.name = "InstanceStateNotFoundError";
|
|
281
248
|
}
|
|
282
|
-
}
|
|
283
|
-
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
class InstanceLockedError extends BackendError {
|
|
284
252
|
constructor(projectId, instanceId) {
|
|
285
253
|
super(`Instance with ID "${instanceId}" in project "${projectId}" is locked.`);
|
|
286
254
|
this.name = "InstanceLockedError";
|
|
287
255
|
}
|
|
288
|
-
}
|
|
289
|
-
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
class WorkerVersionNotFoundError extends BackendError {
|
|
290
259
|
constructor(projectId, workerVersionId) {
|
|
291
260
|
super(`Worker version with ID "${workerVersionId}" not found in project "${projectId}".`);
|
|
292
261
|
this.name = "WorkerVersionNotFoundError";
|
|
293
262
|
}
|
|
294
|
-
}
|
|
295
|
-
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
class BackendUnlockMethodNotFoundError extends BackendError {
|
|
296
266
|
constructor(id) {
|
|
297
267
|
super(`Backend unlock method with ID "${id}" not found.`);
|
|
298
268
|
this.name = "BackendUnlockMethodNotFoundError";
|
|
299
269
|
}
|
|
300
|
-
}
|
|
301
|
-
|
|
270
|
+
}
|
|
271
|
+
|
|
272
|
+
class CannotDeleteLastBackendUnlockMethodError extends BackendError {
|
|
302
273
|
constructor() {
|
|
303
274
|
super(`Refused to delete the last backend unlock method.`);
|
|
304
275
|
this.name = "CannotDeleteLastBackendUnlockMethodError";
|
|
305
276
|
}
|
|
306
|
-
}
|
|
307
|
-
|
|
277
|
+
}
|
|
278
|
+
// src/shared/models/project/api-key.ts
|
|
279
|
+
import {
|
|
280
|
+
commonObjectMetaSchema as commonObjectMetaSchema2,
|
|
281
|
+
objectMetaSchema as objectMetaSchema2,
|
|
282
|
+
serviceAccountMetaSchema,
|
|
283
|
+
z as z6
|
|
284
|
+
} from "@highstate/contract";
|
|
285
|
+
var apiKeyMetaSchema = objectMetaSchema2.pick({
|
|
308
286
|
title: true,
|
|
309
287
|
description: true
|
|
310
288
|
}).required({ title: true });
|
|
311
|
-
var apiKeyOutputSchema =
|
|
312
|
-
id:
|
|
313
|
-
meta:
|
|
314
|
-
serviceAccountId:
|
|
289
|
+
var apiKeyOutputSchema = z6.object({
|
|
290
|
+
id: z6.cuid2(),
|
|
291
|
+
meta: commonObjectMetaSchema2,
|
|
292
|
+
serviceAccountId: z6.cuid2(),
|
|
315
293
|
serviceAccountMeta: serviceAccountMetaSchema.nullable(),
|
|
316
|
-
createdAt:
|
|
294
|
+
createdAt: z6.date()
|
|
317
295
|
});
|
|
318
296
|
var apiKeyQuerySchema = collectionQuerySchema.extend({
|
|
319
|
-
serviceAccountId:
|
|
297
|
+
serviceAccountId: z6.string().optional()
|
|
320
298
|
});
|
|
321
299
|
function toApiKeyOutput(apiKey, serviceAccount) {
|
|
322
300
|
return {
|
|
@@ -324,97 +302,97 @@ function toApiKeyOutput(apiKey, serviceAccount) {
|
|
|
324
302
|
serviceAccountMeta: serviceAccount?.meta ?? null
|
|
325
303
|
};
|
|
326
304
|
}
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
305
|
+
// src/shared/models/project/artifact.ts
|
|
306
|
+
import { commonObjectMetaSchema as commonObjectMetaSchema3 } from "@highstate/contract";
|
|
307
|
+
import { z as z7 } from "zod";
|
|
308
|
+
var artifactOutputSchema = z7.object({
|
|
309
|
+
id: z7.cuid2(),
|
|
310
|
+
hash: z7.string(),
|
|
311
|
+
size: z7.number(),
|
|
312
|
+
meta: commonObjectMetaSchema3,
|
|
313
|
+
createdAt: z7.date(),
|
|
314
|
+
updatedAt: z7.date()
|
|
334
315
|
});
|
|
335
316
|
var artifactQuerySchema = collectionQuerySchema.extend({
|
|
336
|
-
stateId:
|
|
337
|
-
serviceAccountId:
|
|
338
|
-
terminalId:
|
|
339
|
-
pageId:
|
|
317
|
+
stateId: z7.string().optional(),
|
|
318
|
+
serviceAccountId: z7.string().optional(),
|
|
319
|
+
terminalId: z7.string().optional(),
|
|
320
|
+
pageId: z7.string().optional()
|
|
340
321
|
});
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
322
|
+
// src/shared/models/project/custom-status.ts
|
|
323
|
+
import { commonObjectMetaSchema as commonObjectMetaSchema4 } from "@highstate/contract";
|
|
324
|
+
import { z as z8 } from "zod";
|
|
325
|
+
var instanceCustomStatusInputSchema = z8.object({
|
|
326
|
+
name: z8.string(),
|
|
327
|
+
meta: commonObjectMetaSchema4,
|
|
328
|
+
value: z8.string(),
|
|
329
|
+
message: z8.string().optional(),
|
|
330
|
+
order: z8.number().min(0).max(100).optional()
|
|
347
331
|
});
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
332
|
+
// src/shared/models/project/entity.ts
|
|
333
|
+
import { commonObjectMetaSchema as commonObjectMetaSchema5 } from "@highstate/contract";
|
|
334
|
+
import { z as z9 } from "zod";
|
|
335
|
+
var rawEntityMetaSchema = z9.object({
|
|
336
|
+
identity: z9.string().optional(),
|
|
337
|
+
title: z9.string().optional(),
|
|
338
|
+
description: z9.string().optional(),
|
|
339
|
+
icon: z9.string().optional(),
|
|
340
|
+
iconColor: z9.string().optional()
|
|
354
341
|
}).passthrough();
|
|
355
|
-
var entityOutputSchema =
|
|
356
|
-
id:
|
|
357
|
-
type:
|
|
358
|
-
identity:
|
|
359
|
-
meta:
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
*/
|
|
363
|
-
snapshotId: z$1.string().optional(),
|
|
364
|
-
/**
|
|
365
|
-
* The timestamp of the last known entity snapshot.
|
|
366
|
-
*/
|
|
367
|
-
createdAt: z$1.date().optional()
|
|
342
|
+
var entityOutputSchema = z9.object({
|
|
343
|
+
id: z9.string(),
|
|
344
|
+
type: z9.string(),
|
|
345
|
+
identity: z9.string(),
|
|
346
|
+
meta: commonObjectMetaSchema5,
|
|
347
|
+
snapshotId: z9.string().optional(),
|
|
348
|
+
createdAt: z9.date().optional()
|
|
368
349
|
});
|
|
369
350
|
var entityQuerySchema = collectionQuerySchema.extend({
|
|
370
|
-
type:
|
|
351
|
+
type: z9.string().optional()
|
|
371
352
|
});
|
|
372
|
-
var entitySnapshotOutputSchema =
|
|
373
|
-
id:
|
|
374
|
-
meta:
|
|
375
|
-
content:
|
|
376
|
-
operationId:
|
|
377
|
-
stateId:
|
|
378
|
-
referencedInOutputs:
|
|
379
|
-
exportedInOutputs:
|
|
380
|
-
createdAt:
|
|
353
|
+
var entitySnapshotOutputSchema = z9.object({
|
|
354
|
+
id: z9.string(),
|
|
355
|
+
meta: commonObjectMetaSchema5,
|
|
356
|
+
content: z9.unknown(),
|
|
357
|
+
operationId: z9.string(),
|
|
358
|
+
stateId: z9.string(),
|
|
359
|
+
referencedInOutputs: z9.string().array(),
|
|
360
|
+
exportedInOutputs: z9.string().array(),
|
|
361
|
+
createdAt: z9.date()
|
|
381
362
|
});
|
|
382
|
-
var entitySnapshotListItemOutputSchema =
|
|
383
|
-
id:
|
|
384
|
-
meta:
|
|
385
|
-
operationId:
|
|
386
|
-
stateId:
|
|
387
|
-
createdAt:
|
|
363
|
+
var entitySnapshotListItemOutputSchema = z9.object({
|
|
364
|
+
id: z9.string(),
|
|
365
|
+
meta: commonObjectMetaSchema5,
|
|
366
|
+
operationId: z9.string(),
|
|
367
|
+
stateId: z9.string(),
|
|
368
|
+
createdAt: z9.date()
|
|
388
369
|
});
|
|
389
|
-
var entitySnapshotDetailsOutputSchema =
|
|
390
|
-
entity:
|
|
391
|
-
id:
|
|
392
|
-
type:
|
|
393
|
-
identity:
|
|
370
|
+
var entitySnapshotDetailsOutputSchema = z9.object({
|
|
371
|
+
entity: z9.object({
|
|
372
|
+
id: z9.string(),
|
|
373
|
+
type: z9.string(),
|
|
374
|
+
identity: z9.string()
|
|
394
375
|
}),
|
|
395
376
|
snapshot: entitySnapshotOutputSchema
|
|
396
377
|
});
|
|
397
|
-
var entityDetailsOutputSchema =
|
|
378
|
+
var entityDetailsOutputSchema = z9.object({
|
|
398
379
|
...entityOutputSchema.shape,
|
|
399
|
-
/**
|
|
400
|
-
* The last known entity snapshot.
|
|
401
|
-
*/
|
|
402
380
|
lastSnapshot: entitySnapshotOutputSchema.nullable()
|
|
403
381
|
});
|
|
404
|
-
var entityReferenceOutputSchema =
|
|
405
|
-
id:
|
|
406
|
-
meta:
|
|
407
|
-
group:
|
|
408
|
-
fromSnapshotId:
|
|
409
|
-
fromEntityId:
|
|
410
|
-
fromEntityType:
|
|
411
|
-
fromEntityIdentity:
|
|
412
|
-
fromEntityMeta:
|
|
413
|
-
toSnapshotId:
|
|
414
|
-
toEntityId:
|
|
415
|
-
toEntityType:
|
|
416
|
-
toEntityIdentity:
|
|
417
|
-
toEntityMeta:
|
|
382
|
+
var entityReferenceOutputSchema = z9.object({
|
|
383
|
+
id: z9.string(),
|
|
384
|
+
meta: commonObjectMetaSchema5,
|
|
385
|
+
group: z9.string(),
|
|
386
|
+
fromSnapshotId: z9.string(),
|
|
387
|
+
fromEntityId: z9.string(),
|
|
388
|
+
fromEntityType: z9.string(),
|
|
389
|
+
fromEntityIdentity: z9.string(),
|
|
390
|
+
fromEntityMeta: commonObjectMetaSchema5,
|
|
391
|
+
toSnapshotId: z9.string(),
|
|
392
|
+
toEntityId: z9.string(),
|
|
393
|
+
toEntityType: z9.string(),
|
|
394
|
+
toEntityIdentity: z9.string(),
|
|
395
|
+
toEntityMeta: commonObjectMetaSchema5
|
|
418
396
|
});
|
|
419
397
|
function toCommonEntityMeta(meta) {
|
|
420
398
|
const parsedRawMeta = rawEntityMetaSchema.safeParse(meta);
|
|
@@ -430,263 +408,78 @@ function toCommonEntityMeta(meta) {
|
|
|
430
408
|
title: "Unknown"
|
|
431
409
|
};
|
|
432
410
|
}
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
411
|
+
// src/shared/models/project/lock.ts
|
|
412
|
+
import { commonObjectMetaSchema as commonObjectMetaSchema6 } from "@highstate/contract";
|
|
413
|
+
import { z as z10 } from "zod";
|
|
414
|
+
var instanceLockOutputSchema = z10.object({
|
|
415
|
+
stateId: z10.cuid2(),
|
|
416
|
+
meta: commonObjectMetaSchema6,
|
|
417
|
+
acquiredAt: z10.date()
|
|
437
418
|
});
|
|
438
|
-
var instanceLockEventSchema =
|
|
439
|
-
|
|
440
|
-
type:
|
|
419
|
+
var instanceLockEventSchema = z10.discriminatedUnion("type", [
|
|
420
|
+
z10.object({
|
|
421
|
+
type: z10.literal("locked"),
|
|
441
422
|
locks: instanceLockOutputSchema.array()
|
|
442
423
|
}),
|
|
443
|
-
|
|
444
|
-
type:
|
|
445
|
-
stateIds:
|
|
424
|
+
z10.object({
|
|
425
|
+
type: z10.literal("unlocked"),
|
|
426
|
+
stateIds: z10.array(z10.string())
|
|
446
427
|
})
|
|
447
428
|
]);
|
|
448
|
-
|
|
429
|
+
// src/shared/models/project/model.ts
|
|
430
|
+
import {
|
|
431
|
+
hubModelSchema,
|
|
432
|
+
instanceIdSchema,
|
|
433
|
+
instanceModelSchema
|
|
434
|
+
} from "@highstate/contract";
|
|
435
|
+
import { z as z11 } from "zod";
|
|
436
|
+
var projectModelEventSchema = z11.object({
|
|
449
437
|
updatedInstances: instanceModelSchema.array().optional(),
|
|
450
438
|
updatedHubs: hubModelSchema.array().optional(),
|
|
451
439
|
updatedVirtualInstances: instanceModelSchema.array().optional(),
|
|
452
440
|
updatedGhostInstances: instanceModelSchema.array().optional(),
|
|
453
441
|
deletedInstanceIds: instanceIdSchema.array().optional(),
|
|
454
|
-
deletedHubIds:
|
|
442
|
+
deletedHubIds: z11.string().array().optional(),
|
|
455
443
|
deletedVirtualInstanceIds: instanceIdSchema.array().optional(),
|
|
456
444
|
deletedGhostInstanceIds: instanceIdSchema.array().optional()
|
|
457
445
|
});
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
* The parent ID of the instance, either from the model or the state.
|
|
466
|
-
*/
|
|
467
|
-
parentId: z.string().optional(),
|
|
468
|
-
/**
|
|
469
|
-
* Human-readable explanation of the decision.
|
|
470
|
-
* */
|
|
471
|
-
message: z.string()
|
|
446
|
+
// src/shared/models/project/operation.ts
|
|
447
|
+
import { instanceIdSchema as instanceIdSchema2, objectMetaSchema as objectMetaSchema3, z as z12 } from "@highstate/contract";
|
|
448
|
+
var operationPhaseTypeSchema = z12.enum(["destroy", "preview", "update", "refresh"]);
|
|
449
|
+
var operationPhaseInstanceSchema = z12.object({
|
|
450
|
+
id: instanceIdSchema2,
|
|
451
|
+
parentId: z12.string().optional(),
|
|
452
|
+
message: z12.string()
|
|
472
453
|
});
|
|
473
|
-
var operationPhaseSchema =
|
|
474
|
-
/**
|
|
475
|
-
* Type of phase being executed.
|
|
476
|
-
*/
|
|
454
|
+
var operationPhaseSchema = z12.object({
|
|
477
455
|
type: operationPhaseTypeSchema,
|
|
478
|
-
|
|
479
|
-
* List of instances to be processed in this phase.
|
|
480
|
-
*/
|
|
481
|
-
instances: z.array(operationPhaseInstanceSchema)
|
|
456
|
+
instances: z12.array(operationPhaseInstanceSchema)
|
|
482
457
|
});
|
|
483
|
-
var operationOptionsSchema =
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
*
|
|
500
|
-
* **Operation Behavior Impact:**
|
|
501
|
-
* - skips dependency inclusion when dependency is only changed;
|
|
502
|
-
* - still includes failed or undeployed dependencies to preserve safety for missing/broken prerequisites;
|
|
503
|
-
* - useful for targeted updates where stale-but-healthy dependencies are intentionally not traversed.
|
|
504
|
-
*
|
|
505
|
-
* **Usage with other options:**
|
|
506
|
-
* - mutually exclusive with `forceUpdateDependencies`;
|
|
507
|
-
* - mutually exclusive with `ignoreDependencies`;
|
|
508
|
-
* - independent of child/composite inclusion options.
|
|
509
|
-
*/
|
|
510
|
-
ignoreChangedDependencies: z.boolean().default(false),
|
|
511
|
-
/**
|
|
512
|
-
* Ignore all dependencies and operate only on explicitly requested instances.
|
|
513
|
-
*
|
|
514
|
-
* **Operation Behavior Impact:**
|
|
515
|
-
* - skips dependency inclusion entirely, including failed and undeployed prerequisites;
|
|
516
|
-
* - caller must explicitly include every prerequisite instance to avoid failures;
|
|
517
|
-
* - intended for fully manual execution flows.
|
|
518
|
-
*
|
|
519
|
-
* **Usage with other options:**
|
|
520
|
-
* - mutually exclusive with `forceUpdateDependencies`;
|
|
521
|
-
* - mutually exclusive with `ignoreChangedDependencies`;
|
|
522
|
-
* - independent of child/composite inclusion options.
|
|
523
|
-
*/
|
|
524
|
-
ignoreDependencies: z.boolean().default(false),
|
|
525
|
-
/**
|
|
526
|
-
* Force update all children of composite instances regardless of their state.
|
|
527
|
-
*
|
|
528
|
-
* **Operation Behavior Impact:**
|
|
529
|
-
* - overrides selective child inclusion logic for composites;
|
|
530
|
-
* - includes **ALL** children of affected composites (up-to-date, out-of-date, and error states);
|
|
531
|
-
* - applied after dependency traversal and parent inclusion.
|
|
532
|
-
*
|
|
533
|
-
* **Usage with other options:**
|
|
534
|
-
* - combined with `forceUpdateDependencies`: creates comprehensive force-update behavior;
|
|
535
|
-
* - overrides `allowPartialCompositeInstanceCreation`: when enabled, **ALL** children are included regardless of existence.
|
|
536
|
-
*/
|
|
537
|
-
forceUpdateChildren: z.boolean().default(false),
|
|
538
|
-
/**
|
|
539
|
-
* Run only ghost cleanup destroy phase and skip update phase entirely.
|
|
540
|
-
*
|
|
541
|
-
* **Operation Behavior Impact:**
|
|
542
|
-
* - applies to update operations only;
|
|
543
|
-
* - skips update phase even if normal update candidates exist;
|
|
544
|
-
* - keeps only ghost cleanup destroy phase for affected substantive composites.
|
|
545
|
-
*
|
|
546
|
-
* **Usage with other options:**
|
|
547
|
-
* - mutually exclusive with `firstDestroyGhosts`;
|
|
548
|
-
* - mutually exclusive with `ignoreGhosts`.
|
|
549
|
-
*/
|
|
550
|
-
onlyDestroyGhosts: z.boolean().default(false),
|
|
551
|
-
/**
|
|
552
|
-
* Run ghost cleanup destroy phase before update phase.
|
|
553
|
-
*
|
|
554
|
-
* **Operation Behavior Impact:**
|
|
555
|
-
* - applies to update operations only;
|
|
556
|
-
* - keeps both phases but changes order to destroy ghosts first;
|
|
557
|
-
* - useful when stale ghost resources should be removed prior to update execution.
|
|
558
|
-
*
|
|
559
|
-
* **Usage with other options:**
|
|
560
|
-
* - mutually exclusive with `onlyDestroyGhosts`;
|
|
561
|
-
* - mutually exclusive with `ignoreGhosts`.
|
|
562
|
-
*/
|
|
563
|
-
firstDestroyGhosts: z.boolean().default(false),
|
|
564
|
-
/**
|
|
565
|
-
* Ignore ghost cleanup and skip destroy phase for ghosts.
|
|
566
|
-
*
|
|
567
|
-
* **Operation Behavior Impact:**
|
|
568
|
-
* - applies to update operations only;
|
|
569
|
-
* - disables ghost cleanup destroy phase generation;
|
|
570
|
-
* - update phase remains unchanged.
|
|
571
|
-
*
|
|
572
|
-
* **Usage with other options:**
|
|
573
|
-
* - mutually exclusive with `onlyDestroyGhosts`;
|
|
574
|
-
* - mutually exclusive with `firstDestroyGhosts`.
|
|
575
|
-
*/
|
|
576
|
-
ignoreGhosts: z.boolean().default(false),
|
|
577
|
-
/**
|
|
578
|
-
* Include dependent instances when destroying instances.
|
|
579
|
-
*
|
|
580
|
-
* **Operation Behavior Impact:**
|
|
581
|
-
* - extends destroy operations to include instances that depend on the target;
|
|
582
|
-
* - traverses the dependency graph in reverse (dependents, not dependencies);
|
|
583
|
-
* - prevents orphaned instances that would fail without their dependencies.
|
|
584
|
-
*
|
|
585
|
-
* **Usage with other options:**
|
|
586
|
-
* - works with `invokeDestroyTriggers`: ensures triggers run for all dependents;
|
|
587
|
-
* - independent of update-related options.
|
|
588
|
-
*/
|
|
589
|
-
destroyDependentInstances: z.boolean().default(true),
|
|
590
|
-
/**
|
|
591
|
-
* Execute destroy triggers when destroying instances.
|
|
592
|
-
*
|
|
593
|
-
* **Operation Behavior Impact:**
|
|
594
|
-
* - affects how individual units are destroyed (triggers vs direct deletion);
|
|
595
|
-
* - does not change which instances are selected for destruction;
|
|
596
|
-
* - controls trigger execution during the destruction phase.
|
|
597
|
-
*
|
|
598
|
-
* **Usage with other options:**
|
|
599
|
-
* - used with `destroyDependentInstances`: ensures triggers run for cascade deletions;
|
|
600
|
-
* - independent of update-related options.
|
|
601
|
-
*/
|
|
602
|
-
invokeDestroyTriggers: z.boolean().default(true),
|
|
603
|
-
/**
|
|
604
|
-
* Delete Pulumi resources that are no longer referenced in the state.
|
|
605
|
-
*
|
|
606
|
-
* **Operation Behavior Impact:**
|
|
607
|
-
* - does not affect which instances are selected for operations;
|
|
608
|
-
* - deletes orphaned Pulumi resources within individual instances.
|
|
609
|
-
*
|
|
610
|
-
* **Usage with other options:**
|
|
611
|
-
* - independent of instance selection options;
|
|
612
|
-
* - complements destroy-related options for thorough cleanup.
|
|
613
|
-
*/
|
|
614
|
-
deleteUnreachableResources: z.boolean().default(false),
|
|
615
|
-
/**
|
|
616
|
-
* Force deletion of instance state even if the destroy operation fails.
|
|
617
|
-
*
|
|
618
|
-
* **Operation Behavior Impact:**
|
|
619
|
-
* - forces state deletion even when destroy operations fail;
|
|
620
|
-
* - does not affect which instances are selected for operations;
|
|
621
|
-
* - bypasses normal destroy procedures as emergency fallback.
|
|
622
|
-
*
|
|
623
|
-
* **Usage with other options:**
|
|
624
|
-
* - used with destroy-related options when normal cleanup fails;
|
|
625
|
-
* - should be used cautiously as it can create state inconsistencies.
|
|
626
|
-
*/
|
|
627
|
-
forceDeleteState: z.boolean().default(false),
|
|
628
|
-
/**
|
|
629
|
-
* Allow partial update of composite instances without requiring all outdated children.
|
|
630
|
-
*
|
|
631
|
-
* **Operation Behavior Impact:**
|
|
632
|
-
* - controls whether composite operations must include all outdated children or only necessary ones;
|
|
633
|
-
* - when `false` (default): all outdated children of substantive composites are included in operations;
|
|
634
|
-
* - when `true`: only necessary children are included, allowing partial composite operations;
|
|
635
|
-
* - applied during composite child traversal phase for substantive composites only.
|
|
636
|
-
*
|
|
637
|
-
* **Usage with other options:**
|
|
638
|
-
* - overridden by `forceUpdateChildren`: when force is enabled, **ALL** children are included regardless;
|
|
639
|
-
* - independent of `forceUpdateDependencies`: affects composite logic, not dependency traversal.
|
|
640
|
-
*/
|
|
641
|
-
allowPartialCompositeInstanceUpdate: z.boolean().default(false),
|
|
642
|
-
/**
|
|
643
|
-
* Allow partial destruction of composite instances during cascade operations.
|
|
644
|
-
*
|
|
645
|
-
* **Operation Behavior Impact:**
|
|
646
|
-
* - controls whether cascade destruction must include all children or only necessary ones;
|
|
647
|
-
* - when `false` (default): cascade destruction includes **ALL** children of affected composites;
|
|
648
|
-
* - when `true`: cascade destruction includes only directly dependent children;
|
|
649
|
-
* - does not affect explicit composite destruction (always destroys all children);
|
|
650
|
-
* - does not affect parent propagation when destroying sibling composites.
|
|
651
|
-
*
|
|
652
|
-
* **Usage with other options:**
|
|
653
|
-
* - works with `destroyDependentInstances`: controls completeness of cascade destruction;
|
|
654
|
-
* - independent of update-related options.
|
|
655
|
-
*/
|
|
656
|
-
allowPartialCompositeInstanceDestruction: z.boolean().default(false),
|
|
657
|
-
/**
|
|
658
|
-
* Also refresh the state of instances during the operation.
|
|
659
|
-
*
|
|
660
|
-
* **Operation Behavior Impact:**
|
|
661
|
-
* - does not change which instances are selected for operations;
|
|
662
|
-
* - synchronizes state with actual infrastructure during the operation.
|
|
663
|
-
*
|
|
664
|
-
* **Usage with other options:**
|
|
665
|
-
* - additive with dependency resolution options: refreshes all selected instances;
|
|
666
|
-
* - works with both all operation types.
|
|
667
|
-
*/
|
|
668
|
-
refresh: z.boolean().default(false),
|
|
669
|
-
/**
|
|
670
|
-
* Enable debug logging for Pulumi engine and resource providers.
|
|
671
|
-
*
|
|
672
|
-
* **Security Note:**
|
|
673
|
-
* Debug mode may expose sensitive information including credentials in the logs.
|
|
674
|
-
* Use only when absolutely necessary for troubleshooting.
|
|
675
|
-
*
|
|
676
|
-
* **Implementation:**
|
|
677
|
-
* - sets Pulumi's debug option to true;
|
|
678
|
-
* - sets TF_LOG=DEBUG environment variable for Terraform providers.
|
|
679
|
-
*/
|
|
680
|
-
debug: z.boolean().default(false)
|
|
458
|
+
var operationOptionsSchema = z12.object({
|
|
459
|
+
forceUpdateDependencies: z12.boolean().default(false),
|
|
460
|
+
ignoreChangedDependencies: z12.boolean().default(false),
|
|
461
|
+
ignoreDependencies: z12.boolean().default(false),
|
|
462
|
+
forceUpdateChildren: z12.boolean().default(false),
|
|
463
|
+
onlyDestroyGhosts: z12.boolean().default(false),
|
|
464
|
+
firstDestroyGhosts: z12.boolean().default(false),
|
|
465
|
+
ignoreGhosts: z12.boolean().default(false),
|
|
466
|
+
destroyDependentInstances: z12.boolean().default(true),
|
|
467
|
+
invokeDestroyTriggers: z12.boolean().default(true),
|
|
468
|
+
deleteUnreachableResources: z12.boolean().default(false),
|
|
469
|
+
forceDeleteState: z12.boolean().default(false),
|
|
470
|
+
allowPartialCompositeInstanceUpdate: z12.boolean().default(false),
|
|
471
|
+
allowPartialCompositeInstanceDestruction: z12.boolean().default(false),
|
|
472
|
+
refresh: z12.boolean().default(false),
|
|
473
|
+
debug: z12.boolean().default(false)
|
|
681
474
|
}).partial();
|
|
682
|
-
var operationTypeSchema =
|
|
475
|
+
var operationTypeSchema = z12.enum([
|
|
683
476
|
"update",
|
|
684
477
|
"preview",
|
|
685
478
|
"destroy",
|
|
686
479
|
"recreate",
|
|
687
480
|
"refresh"
|
|
688
481
|
]);
|
|
689
|
-
var operationStatusSchema =
|
|
482
|
+
var operationStatusSchema = z12.enum([
|
|
690
483
|
"pending",
|
|
691
484
|
"running",
|
|
692
485
|
"failing",
|
|
@@ -695,38 +488,38 @@ var operationStatusSchema = z.enum([
|
|
|
695
488
|
"cancelled",
|
|
696
489
|
"cancelling"
|
|
697
490
|
]);
|
|
698
|
-
var operationMetaSchema =
|
|
491
|
+
var operationMetaSchema = objectMetaSchema3.pick({
|
|
699
492
|
title: true,
|
|
700
493
|
description: true
|
|
701
494
|
}).required({ title: true });
|
|
702
|
-
var operationPlanInputSchema =
|
|
703
|
-
projectId:
|
|
495
|
+
var operationPlanInputSchema = z12.object({
|
|
496
|
+
projectId: z12.string(),
|
|
704
497
|
type: operationTypeSchema,
|
|
705
|
-
instanceIds:
|
|
498
|
+
instanceIds: z12.array(instanceIdSchema2).min(1),
|
|
706
499
|
options: operationOptionsSchema.partial().optional()
|
|
707
500
|
});
|
|
708
501
|
var operationLaunchInputSchema = operationPlanInputSchema.extend({
|
|
709
502
|
meta: operationMetaSchema,
|
|
710
503
|
plan: operationPhaseSchema.array().optional()
|
|
711
504
|
});
|
|
712
|
-
var operationEventSchema =
|
|
713
|
-
|
|
714
|
-
type:
|
|
715
|
-
operation:
|
|
505
|
+
var operationEventSchema = z12.discriminatedUnion("type", [
|
|
506
|
+
z12.object({
|
|
507
|
+
type: z12.literal("updated"),
|
|
508
|
+
operation: z12.custom()
|
|
716
509
|
}),
|
|
717
|
-
|
|
718
|
-
type:
|
|
719
|
-
operationId:
|
|
510
|
+
z12.object({
|
|
511
|
+
type: z12.literal("deleted"),
|
|
512
|
+
operationId: z12.string()
|
|
720
513
|
})
|
|
721
514
|
]);
|
|
722
|
-
var operationOutputSchema =
|
|
723
|
-
id:
|
|
515
|
+
var operationOutputSchema = z12.object({
|
|
516
|
+
id: z12.cuid2(),
|
|
724
517
|
type: operationTypeSchema,
|
|
725
518
|
status: operationStatusSchema,
|
|
726
519
|
meta: operationMetaSchema,
|
|
727
|
-
startedAt:
|
|
728
|
-
updatedAt:
|
|
729
|
-
finishedAt:
|
|
520
|
+
startedAt: z12.date(),
|
|
521
|
+
updatedAt: z12.date(),
|
|
522
|
+
finishedAt: z12.date().nullable()
|
|
730
523
|
});
|
|
731
524
|
var finalOperationStatuses = ["completed", "failed", "cancelled"];
|
|
732
525
|
function isFinalOperationStatus(status) {
|
|
@@ -735,24 +528,31 @@ function isFinalOperationStatus(status) {
|
|
|
735
528
|
function isTransientOperationStatus(status) {
|
|
736
529
|
return !!status && !finalOperationStatuses.includes(status);
|
|
737
530
|
}
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
531
|
+
// src/shared/models/project/page.ts
|
|
532
|
+
import {
|
|
533
|
+
commonObjectMetaSchema as commonObjectMetaSchema7,
|
|
534
|
+
pageBlockSchema,
|
|
535
|
+
serviceAccountMetaSchema as serviceAccountMetaSchema2
|
|
536
|
+
} from "@highstate/contract";
|
|
537
|
+
import { z as z13 } from "zod";
|
|
538
|
+
var pageOutputSchema = z13.object({
|
|
539
|
+
id: z13.cuid2(),
|
|
540
|
+
meta: commonObjectMetaSchema7,
|
|
541
|
+
name: z13.string().nullable(),
|
|
542
|
+
stateId: z13.cuid2().nullable(),
|
|
543
|
+
serviceAccountId: z13.cuid2().nullable(),
|
|
544
|
+
serviceAccountMeta: serviceAccountMetaSchema2.nullable(),
|
|
545
|
+
createdAt: z13.date(),
|
|
546
|
+
updatedAt: z13.date()
|
|
747
547
|
});
|
|
748
548
|
var pageQuerySchema = collectionQuerySchema.extend({
|
|
749
|
-
serviceAccountId:
|
|
750
|
-
stateId:
|
|
751
|
-
artifactId:
|
|
549
|
+
serviceAccountId: z13.string().optional(),
|
|
550
|
+
stateId: z13.string().optional(),
|
|
551
|
+
artifactId: z13.string().optional()
|
|
752
552
|
});
|
|
753
|
-
var pageDetailsOutputSchema =
|
|
553
|
+
var pageDetailsOutputSchema = z13.object({
|
|
754
554
|
...pageOutputSchema.shape,
|
|
755
|
-
content:
|
|
555
|
+
content: z13.array(pageBlockSchema)
|
|
756
556
|
});
|
|
757
557
|
function toPageOutput(page, serviceAccount) {
|
|
758
558
|
return {
|
|
@@ -760,20 +560,22 @@ function toPageOutput(page, serviceAccount) {
|
|
|
760
560
|
serviceAccountMeta: serviceAccount?.meta ?? null
|
|
761
561
|
};
|
|
762
562
|
}
|
|
763
|
-
|
|
764
|
-
|
|
563
|
+
// src/shared/models/project/secret.ts
|
|
564
|
+
import { globalCommonObjectMetaSchema, serviceAccountMetaSchema as serviceAccountMetaSchema3, z as z14 } from "@highstate/contract";
|
|
565
|
+
var secretOutputSchema = z14.object({
|
|
566
|
+
id: z14.cuid2(),
|
|
765
567
|
meta: globalCommonObjectMetaSchema,
|
|
766
|
-
name:
|
|
767
|
-
systemName:
|
|
768
|
-
stateId:
|
|
769
|
-
serviceAccountId:
|
|
770
|
-
serviceAccountMeta:
|
|
771
|
-
createdAt:
|
|
772
|
-
updatedAt:
|
|
568
|
+
name: z14.string().nullable(),
|
|
569
|
+
systemName: z14.string().nullable(),
|
|
570
|
+
stateId: z14.cuid2().nullable(),
|
|
571
|
+
serviceAccountId: z14.cuid2().nullable(),
|
|
572
|
+
serviceAccountMeta: serviceAccountMetaSchema3.nullable(),
|
|
573
|
+
createdAt: z14.date(),
|
|
574
|
+
updatedAt: z14.date()
|
|
773
575
|
});
|
|
774
576
|
var secretQuerySchema = collectionQuerySchema.extend({
|
|
775
|
-
serviceAccountId:
|
|
776
|
-
stateId:
|
|
577
|
+
serviceAccountId: z14.string().optional(),
|
|
578
|
+
stateId: z14.string().optional()
|
|
777
579
|
});
|
|
778
580
|
function toSecretOutput(secret, serviceAccount) {
|
|
779
581
|
return {
|
|
@@ -781,51 +583,55 @@ function toSecretOutput(secret, serviceAccount) {
|
|
|
781
583
|
serviceAccountMeta: serviceAccount?.meta ?? null
|
|
782
584
|
};
|
|
783
585
|
}
|
|
784
|
-
var SystemSecretNames
|
|
586
|
+
var SystemSecretNames;
|
|
587
|
+
((SystemSecretNames2) => {
|
|
785
588
|
SystemSecretNames2["PulumiPassword"] = "pulumi-password";
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
589
|
+
})(SystemSecretNames ||= {});
|
|
590
|
+
// src/shared/models/project/service-account.ts
|
|
591
|
+
import { serviceAccountMetaSchema as serviceAccountMetaSchema4, z as z15 } from "@highstate/contract";
|
|
592
|
+
var serviceAccountOutputSchema = z15.object({
|
|
593
|
+
id: z15.cuid2(),
|
|
594
|
+
meta: serviceAccountMetaSchema4,
|
|
595
|
+
createdAt: z15.date(),
|
|
596
|
+
updatedAt: z15.date()
|
|
793
597
|
});
|
|
794
598
|
var serviceAccountQuerySchema = collectionQuerySchema.extend({
|
|
795
|
-
artifactId:
|
|
599
|
+
artifactId: z15.string().optional()
|
|
796
600
|
});
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
601
|
+
// src/shared/models/project/state.ts
|
|
602
|
+
import { z as z16 } from "zod";
|
|
603
|
+
var stableInstanceInputSchema = z16.object({
|
|
604
|
+
stateId: z16.string(),
|
|
605
|
+
output: z16.string(),
|
|
606
|
+
path: z16.string().optional()
|
|
801
607
|
});
|
|
802
|
-
var instanceStateEventSchema =
|
|
803
|
-
|
|
804
|
-
type:
|
|
805
|
-
state:
|
|
608
|
+
var instanceStateEventSchema = z16.discriminatedUnion("type", [
|
|
609
|
+
z16.object({
|
|
610
|
+
type: z16.literal("updated"),
|
|
611
|
+
state: z16.custom()
|
|
806
612
|
}),
|
|
807
|
-
|
|
808
|
-
type:
|
|
809
|
-
stateId:
|
|
810
|
-
patch:
|
|
613
|
+
z16.object({
|
|
614
|
+
type: z16.literal("patched"),
|
|
615
|
+
stateId: z16.string(),
|
|
616
|
+
patch: z16.custom()
|
|
811
617
|
}),
|
|
812
|
-
|
|
813
|
-
type:
|
|
814
|
-
patches:
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
})
|
|
819
|
-
)
|
|
618
|
+
z16.object({
|
|
619
|
+
type: z16.literal("patched-batch"),
|
|
620
|
+
patches: z16.array(z16.object({
|
|
621
|
+
stateId: z16.string(),
|
|
622
|
+
patch: z16.custom()
|
|
623
|
+
}))
|
|
820
624
|
}),
|
|
821
|
-
|
|
822
|
-
type:
|
|
823
|
-
stateId:
|
|
625
|
+
z16.object({
|
|
626
|
+
type: z16.literal("deleted"),
|
|
627
|
+
stateId: z16.string()
|
|
824
628
|
})
|
|
825
629
|
]);
|
|
826
630
|
function isVirtualGhostInstance(state) {
|
|
827
|
-
if (state.source !== "virtual")
|
|
828
|
-
|
|
631
|
+
if (state.source !== "virtual")
|
|
632
|
+
return false;
|
|
633
|
+
if (state.status === "undeployed")
|
|
634
|
+
return false;
|
|
829
635
|
return !state.evaluationState;
|
|
830
636
|
}
|
|
831
637
|
function isInstanceDeployed(state) {
|
|
@@ -843,43 +649,51 @@ var finalInstanceOperationStatuses = [
|
|
|
843
649
|
function isTransientInstanceOperationStatus(status) {
|
|
844
650
|
return !!status && !finalInstanceOperationStatuses.includes(status);
|
|
845
651
|
}
|
|
846
|
-
var workerUnitRegistrationEventSchema =
|
|
847
|
-
|
|
848
|
-
type:
|
|
849
|
-
instanceId:
|
|
850
|
-
params:
|
|
652
|
+
var workerUnitRegistrationEventSchema = z16.discriminatedUnion("type", [
|
|
653
|
+
z16.object({
|
|
654
|
+
type: z16.literal("registered"),
|
|
655
|
+
instanceId: z16.string(),
|
|
656
|
+
params: z16.record(z16.string(), z16.unknown())
|
|
851
657
|
}),
|
|
852
|
-
|
|
853
|
-
type:
|
|
854
|
-
instanceId:
|
|
658
|
+
z16.object({
|
|
659
|
+
type: z16.literal("deregistered"),
|
|
660
|
+
instanceId: z16.string()
|
|
855
661
|
})
|
|
856
662
|
]);
|
|
857
|
-
|
|
663
|
+
// src/shared/models/project/terminal.ts
|
|
664
|
+
import {
|
|
665
|
+
commonObjectMetaSchema as commonObjectMetaSchema8,
|
|
666
|
+
globalCommonObjectMetaSchema as globalCommonObjectMetaSchema2,
|
|
667
|
+
serviceAccountMetaSchema as serviceAccountMetaSchema5,
|
|
668
|
+
terminalSpecSchema
|
|
669
|
+
} from "@highstate/contract";
|
|
670
|
+
import { z as z17 } from "zod";
|
|
671
|
+
var terminalStatusSchema = z17.enum([
|
|
858
672
|
"active",
|
|
859
673
|
"unavailable"
|
|
860
674
|
]);
|
|
861
|
-
var terminalSessionOutputSchema =
|
|
862
|
-
id:
|
|
863
|
-
terminalId:
|
|
864
|
-
meta:
|
|
865
|
-
startedAt:
|
|
866
|
-
finishedAt:
|
|
675
|
+
var terminalSessionOutputSchema = z17.object({
|
|
676
|
+
id: z17.cuid2(),
|
|
677
|
+
terminalId: z17.cuid2(),
|
|
678
|
+
meta: globalCommonObjectMetaSchema2,
|
|
679
|
+
startedAt: z17.date(),
|
|
680
|
+
finishedAt: z17.date().nullable()
|
|
867
681
|
});
|
|
868
|
-
var terminalOutputSchema =
|
|
869
|
-
id:
|
|
870
|
-
name:
|
|
871
|
-
meta:
|
|
682
|
+
var terminalOutputSchema = z17.object({
|
|
683
|
+
id: z17.cuid2(),
|
|
684
|
+
name: z17.string().nullable(),
|
|
685
|
+
meta: commonObjectMetaSchema8,
|
|
872
686
|
status: terminalStatusSchema,
|
|
873
|
-
stateId:
|
|
874
|
-
serviceAccountId:
|
|
875
|
-
serviceAccountMeta:
|
|
876
|
-
createdAt:
|
|
877
|
-
updatedAt:
|
|
687
|
+
stateId: z17.string().nullable(),
|
|
688
|
+
serviceAccountId: z17.string().nullable(),
|
|
689
|
+
serviceAccountMeta: serviceAccountMetaSchema5.nullable(),
|
|
690
|
+
createdAt: z17.date(),
|
|
691
|
+
updatedAt: z17.date()
|
|
878
692
|
});
|
|
879
693
|
var terminalQuerySchema = collectionQuerySchema.extend({
|
|
880
|
-
serviceAccountId:
|
|
881
|
-
stateId:
|
|
882
|
-
artifactId:
|
|
694
|
+
serviceAccountId: z17.string().optional(),
|
|
695
|
+
stateId: z17.string().optional(),
|
|
696
|
+
artifactId: z17.string().optional()
|
|
883
697
|
});
|
|
884
698
|
function toTerminalOutput(terminal, serviceAccount) {
|
|
885
699
|
return {
|
|
@@ -893,7 +707,7 @@ function toTerminalDetailsOutput(terminal, serviceAccount) {
|
|
|
893
707
|
serviceAccountMeta: serviceAccount?.meta ?? null
|
|
894
708
|
};
|
|
895
709
|
}
|
|
896
|
-
var terminalDetailsOutputSchema =
|
|
710
|
+
var terminalDetailsOutputSchema = z17.object({
|
|
897
711
|
...terminalOutputSchema.shape,
|
|
898
712
|
spec: terminalSpecSchema
|
|
899
713
|
});
|
|
@@ -906,36 +720,44 @@ function toTerminalSessionOutput(terminal, session) {
|
|
|
906
720
|
finishedAt: session.finishedAt
|
|
907
721
|
};
|
|
908
722
|
}
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
723
|
+
// src/shared/models/project/trigger.ts
|
|
724
|
+
import { commonObjectMetaSchema as commonObjectMetaSchema9 } from "@highstate/contract";
|
|
725
|
+
import { z as z18 } from "zod";
|
|
726
|
+
var triggerOutputSchema = z18.object({
|
|
727
|
+
id: z18.cuid2(),
|
|
728
|
+
meta: commonObjectMetaSchema9,
|
|
729
|
+
name: z18.string(),
|
|
730
|
+
stateId: z18.cuid2(),
|
|
731
|
+
createdAt: z18.date(),
|
|
732
|
+
updatedAt: z18.date()
|
|
916
733
|
});
|
|
917
734
|
var triggerQuerySchema = collectionQuerySchema.extend({
|
|
918
|
-
stateId:
|
|
735
|
+
stateId: z18.string().optional()
|
|
919
736
|
});
|
|
920
|
-
|
|
921
|
-
|
|
737
|
+
// src/shared/models/project/unlock-method.ts
|
|
738
|
+
import { objectMetaSchema as objectMetaSchema4, z as z19 } from "@highstate/contract";
|
|
739
|
+
var unlockMethodType = z19.enum(["password", "passkey"]);
|
|
740
|
+
var unlockMethodMetaSchema = objectMetaSchema4.pick({
|
|
922
741
|
title: true,
|
|
923
742
|
description: true
|
|
924
743
|
}).required({ title: true });
|
|
925
|
-
var unlockMethodInputSchema =
|
|
744
|
+
var unlockMethodInputSchema = z19.object({
|
|
926
745
|
meta: unlockMethodMetaSchema,
|
|
927
746
|
type: unlockMethodType,
|
|
928
|
-
encryptedIdentity:
|
|
929
|
-
recipient:
|
|
747
|
+
encryptedIdentity: z19.string(),
|
|
748
|
+
recipient: z19.string()
|
|
930
749
|
});
|
|
931
|
-
var unlockMethodOutputSchema =
|
|
932
|
-
id:
|
|
750
|
+
var unlockMethodOutputSchema = z19.object({
|
|
751
|
+
id: z19.cuid2(),
|
|
933
752
|
type: unlockMethodType,
|
|
934
753
|
meta: unlockMethodMetaSchema,
|
|
935
|
-
recipient:
|
|
936
|
-
createdAt:
|
|
937
|
-
updatedAt:
|
|
754
|
+
recipient: z19.string(),
|
|
755
|
+
createdAt: z19.date(),
|
|
756
|
+
updatedAt: z19.date()
|
|
938
757
|
});
|
|
758
|
+
// src/shared/models/project/worker.ts
|
|
759
|
+
import { commonObjectMetaSchema as commonObjectMetaSchema10, serviceAccountMetaSchema as serviceAccountMetaSchema6 } from "@highstate/contract";
|
|
760
|
+
import { z as z20 } from "zod";
|
|
939
761
|
var MAX_WORKER_START_ATTEMPTS = 3;
|
|
940
762
|
var SHA256_PREFIX = "sha256:";
|
|
941
763
|
var SHA256_REGEX = /^[a-f0-9]{64}$/;
|
|
@@ -964,7 +786,7 @@ function getWorkerIdentity(image) {
|
|
|
964
786
|
}
|
|
965
787
|
return withoutDigest;
|
|
966
788
|
}
|
|
967
|
-
var workerVersionStatusSchema =
|
|
789
|
+
var workerVersionStatusSchema = z20.enum([
|
|
968
790
|
"unknown",
|
|
969
791
|
"starting",
|
|
970
792
|
"running",
|
|
@@ -972,31 +794,31 @@ var workerVersionStatusSchema = z$1.enum([
|
|
|
972
794
|
"stopped",
|
|
973
795
|
"error"
|
|
974
796
|
]);
|
|
975
|
-
var workerVersionStatusEventSchema =
|
|
976
|
-
workerVersionId:
|
|
797
|
+
var workerVersionStatusEventSchema = z20.object({
|
|
798
|
+
workerVersionId: z20.cuid2(),
|
|
977
799
|
status: workerVersionStatusSchema
|
|
978
800
|
});
|
|
979
|
-
var workerVersionOutputSchema =
|
|
980
|
-
id:
|
|
981
|
-
digest:
|
|
982
|
-
meta:
|
|
801
|
+
var workerVersionOutputSchema = z20.object({
|
|
802
|
+
id: z20.cuid2(),
|
|
803
|
+
digest: z20.string(),
|
|
804
|
+
meta: commonObjectMetaSchema10,
|
|
983
805
|
status: workerVersionStatusSchema,
|
|
984
|
-
enabled:
|
|
985
|
-
apiKeyId:
|
|
806
|
+
enabled: z20.boolean(),
|
|
807
|
+
apiKeyId: z20.string(),
|
|
986
808
|
apiKeyMeta: apiKeyMetaSchema,
|
|
987
|
-
createdAt:
|
|
988
|
-
updatedAt:
|
|
809
|
+
createdAt: z20.date(),
|
|
810
|
+
updatedAt: z20.date()
|
|
989
811
|
});
|
|
990
|
-
var workerOutputSchema =
|
|
991
|
-
id:
|
|
992
|
-
identity:
|
|
993
|
-
meta:
|
|
994
|
-
serviceAccountId:
|
|
995
|
-
serviceAccountMeta:
|
|
996
|
-
createdAt:
|
|
812
|
+
var workerOutputSchema = z20.object({
|
|
813
|
+
id: z20.cuid2(),
|
|
814
|
+
identity: z20.string(),
|
|
815
|
+
meta: commonObjectMetaSchema10,
|
|
816
|
+
serviceAccountId: z20.string(),
|
|
817
|
+
serviceAccountMeta: serviceAccountMetaSchema6,
|
|
818
|
+
createdAt: z20.date()
|
|
997
819
|
});
|
|
998
820
|
var workerQuerySchema = collectionQuerySchema.extend({
|
|
999
|
-
serviceAccountId:
|
|
821
|
+
serviceAccountId: z20.string().optional()
|
|
1000
822
|
});
|
|
1001
823
|
function toWorkerOutput(worker, lastVersion, serviceAccount) {
|
|
1002
824
|
return {
|
|
@@ -1011,16 +833,15 @@ function toWorkerVersionOutput(version, apiKey) {
|
|
|
1011
833
|
apiKeyMeta: apiKey.meta
|
|
1012
834
|
};
|
|
1013
835
|
}
|
|
1014
|
-
|
|
1015
836
|
// src/shared/resolvers/effective-output-type.ts
|
|
1016
837
|
function resolveEffectiveOutputType(options) {
|
|
1017
|
-
const visited = options.visited ??
|
|
838
|
+
const visited = options.visited ?? new Set;
|
|
1018
839
|
const producer = options.getInstanceContext(options.input.instanceId);
|
|
1019
840
|
if (!producer) {
|
|
1020
841
|
return resolveTypeByPathOrFallbackInclusion({
|
|
1021
842
|
rootType: options.fallbackType,
|
|
1022
843
|
path: options.input.path,
|
|
1023
|
-
entities:
|
|
844
|
+
entities: undefined,
|
|
1024
845
|
fallbackType: options.fallbackType
|
|
1025
846
|
});
|
|
1026
847
|
}
|
|
@@ -1075,11 +896,11 @@ function resolveTypeByPathOrFallbackInclusion(options) {
|
|
|
1075
896
|
let currentType = rootType;
|
|
1076
897
|
const segments = path.split(".");
|
|
1077
898
|
for (const segment of segments) {
|
|
1078
|
-
const
|
|
1079
|
-
if (!
|
|
899
|
+
const entity2 = entities[currentType];
|
|
900
|
+
if (!entity2) {
|
|
1080
901
|
return rootType;
|
|
1081
902
|
}
|
|
1082
|
-
const inclusion =
|
|
903
|
+
const inclusion = entity2.inclusions?.find((inc) => inc.field === segment);
|
|
1083
904
|
if (!inclusion) {
|
|
1084
905
|
return rootType;
|
|
1085
906
|
}
|
|
@@ -1107,17 +928,24 @@ function resolveTypeByImplicitInclusion(rootType, fallbackType, entities) {
|
|
|
1107
928
|
}
|
|
1108
929
|
return rootType;
|
|
1109
930
|
}
|
|
1110
|
-
|
|
931
|
+
// src/shared/resolvers/graph-resolver.ts
|
|
932
|
+
import { unique } from "remeda";
|
|
933
|
+
|
|
934
|
+
class GraphResolver {
|
|
935
|
+
nodes;
|
|
936
|
+
logger;
|
|
937
|
+
outputHandler;
|
|
938
|
+
dependentSetHandler;
|
|
939
|
+
workset = new Set;
|
|
940
|
+
dependencyMap = new Map;
|
|
941
|
+
dependentMap = new Map;
|
|
942
|
+
outputMap = new Map;
|
|
1111
943
|
constructor(nodes, logger, outputHandler, dependentSetHandler) {
|
|
1112
944
|
this.nodes = nodes;
|
|
1113
945
|
this.logger = logger;
|
|
1114
946
|
this.outputHandler = outputHandler;
|
|
1115
947
|
this.dependentSetHandler = dependentSetHandler;
|
|
1116
948
|
}
|
|
1117
|
-
workset = /* @__PURE__ */ new Set();
|
|
1118
|
-
dependencyMap = /* @__PURE__ */ new Map();
|
|
1119
|
-
dependentMap = /* @__PURE__ */ new Map();
|
|
1120
|
-
outputMap = /* @__PURE__ */ new Map();
|
|
1121
949
|
addToWorkset(nodeId) {
|
|
1122
950
|
this.workset.add(nodeId);
|
|
1123
951
|
}
|
|
@@ -1126,17 +954,9 @@ var GraphResolver = class {
|
|
|
1126
954
|
this.workset.add(nodeId);
|
|
1127
955
|
}
|
|
1128
956
|
}
|
|
1129
|
-
/**
|
|
1130
|
-
* The map of calculated outputs.
|
|
1131
|
-
*/
|
|
1132
957
|
get outputs() {
|
|
1133
958
|
return this.outputMap;
|
|
1134
959
|
}
|
|
1135
|
-
/**
|
|
1136
|
-
* The map of dependencies for each node.
|
|
1137
|
-
*
|
|
1138
|
-
* The key is the node identifier, and the value is an array of identifiers of the nodes which depend on it.
|
|
1139
|
-
*/
|
|
1140
960
|
get dependents() {
|
|
1141
961
|
return this.dependentMap;
|
|
1142
962
|
}
|
|
@@ -1147,11 +967,6 @@ var GraphResolver = class {
|
|
|
1147
967
|
}
|
|
1148
968
|
return output;
|
|
1149
969
|
}
|
|
1150
|
-
/**
|
|
1151
|
-
* Gets the identifiers of the nodes that depend on the given node directly.
|
|
1152
|
-
*
|
|
1153
|
-
* Returns an empty array if there are no dependents.
|
|
1154
|
-
*/
|
|
1155
970
|
getDependents(nodeId) {
|
|
1156
971
|
const dependents = this.dependentMap.get(nodeId);
|
|
1157
972
|
if (!dependents) {
|
|
@@ -1159,11 +974,6 @@ var GraphResolver = class {
|
|
|
1159
974
|
}
|
|
1160
975
|
return Array.from(dependents);
|
|
1161
976
|
}
|
|
1162
|
-
/**
|
|
1163
|
-
* Invalidates the node and all nodes that depend on it.
|
|
1164
|
-
*
|
|
1165
|
-
* Also adds the node to the work set for processing.
|
|
1166
|
-
*/
|
|
1167
977
|
invalidate(nodeId) {
|
|
1168
978
|
const stack = [nodeId];
|
|
1169
979
|
while (stack.length > 0) {
|
|
@@ -1184,13 +994,6 @@ var GraphResolver = class {
|
|
|
1184
994
|
}
|
|
1185
995
|
}
|
|
1186
996
|
}
|
|
1187
|
-
/**
|
|
1188
|
-
* Invalidates a single node without invalidating its dependents.
|
|
1189
|
-
*
|
|
1190
|
-
* Also adds the node to the work set for processing.
|
|
1191
|
-
*
|
|
1192
|
-
* Should be used with caution, as it may lead to inconsistent state if the dependents are not re-processed separately.
|
|
1193
|
-
*/
|
|
1194
997
|
invalidateSingle(nodeId) {
|
|
1195
998
|
if (!this.nodes.has(nodeId)) {
|
|
1196
999
|
return;
|
|
@@ -1198,11 +1001,6 @@ var GraphResolver = class {
|
|
|
1198
1001
|
this.outputMap.delete(nodeId);
|
|
1199
1002
|
this.workset.add(nodeId);
|
|
1200
1003
|
}
|
|
1201
|
-
/**
|
|
1202
|
-
* Resolves all not-resolved or invalidated nodes in the graph.
|
|
1203
|
-
*
|
|
1204
|
-
* The abort signal of the previous operation must be called before calling this method again.
|
|
1205
|
-
*/
|
|
1206
1004
|
async process(signal) {
|
|
1207
1005
|
while (this.workset.size > 0) {
|
|
1208
1006
|
const rootNodeId = this.workset.values().next().value;
|
|
@@ -1243,7 +1041,7 @@ var GraphResolver = class {
|
|
|
1243
1041
|
this.logger.warn({ nodeId }, "processing aborted, skipping output");
|
|
1244
1042
|
return;
|
|
1245
1043
|
}
|
|
1246
|
-
const changedDependentMaps =
|
|
1044
|
+
const changedDependentMaps = new Set;
|
|
1247
1045
|
const oldDependencies = this.dependencyMap.get(nodeId) ?? [];
|
|
1248
1046
|
for (const depId of oldDependencies) {
|
|
1249
1047
|
const dependantSet = this.dependentMap.get(depId);
|
|
@@ -1258,7 +1056,7 @@ var GraphResolver = class {
|
|
|
1258
1056
|
for (const depId of stackItem.dependencies) {
|
|
1259
1057
|
let dependantSet = this.dependentMap.get(depId);
|
|
1260
1058
|
if (!dependantSet) {
|
|
1261
|
-
dependantSet =
|
|
1059
|
+
dependantSet = new Set;
|
|
1262
1060
|
this.dependentMap.set(depId, dependantSet);
|
|
1263
1061
|
}
|
|
1264
1062
|
dependantSet.add(nodeId);
|
|
@@ -1278,9 +1076,9 @@ var GraphResolver = class {
|
|
|
1278
1076
|
this.workset.delete(rootNodeId);
|
|
1279
1077
|
}
|
|
1280
1078
|
}
|
|
1281
|
-
}
|
|
1079
|
+
}
|
|
1282
1080
|
function getAllDependents(dependentMap, nodeId) {
|
|
1283
|
-
const result =
|
|
1081
|
+
const result = new Set;
|
|
1284
1082
|
const stack = [nodeId];
|
|
1285
1083
|
while (stack.length > 0) {
|
|
1286
1084
|
const dependents = dependentMap.get(stack.pop());
|
|
@@ -1296,7 +1094,13 @@ function getAllDependents(dependentMap, nodeId) {
|
|
|
1296
1094
|
}
|
|
1297
1095
|
return Array.from(result);
|
|
1298
1096
|
}
|
|
1299
|
-
|
|
1097
|
+
// src/shared/resolvers/input.ts
|
|
1098
|
+
import {
|
|
1099
|
+
inputKey,
|
|
1100
|
+
isUnitModel
|
|
1101
|
+
} from "@highstate/contract";
|
|
1102
|
+
import { fromEntries, mapValues as mapValues2 } from "remeda";
|
|
1103
|
+
class InputResolver extends GraphResolver {
|
|
1300
1104
|
getNodeDependencies(node) {
|
|
1301
1105
|
const dependencies = [];
|
|
1302
1106
|
if (node.kind === "hub") {
|
|
@@ -1330,7 +1134,7 @@ var InputResolver = class extends GraphResolver {
|
|
|
1330
1134
|
getInstanceContext: (instanceId) => {
|
|
1331
1135
|
const output = this.outputs.get(`instance:${instanceId}`);
|
|
1332
1136
|
if (!output || output.kind !== "instance") {
|
|
1333
|
-
return
|
|
1137
|
+
return;
|
|
1334
1138
|
}
|
|
1335
1139
|
return {
|
|
1336
1140
|
instance: output.instance,
|
|
@@ -1370,7 +1174,7 @@ var InputResolver = class extends GraphResolver {
|
|
|
1370
1174
|
};
|
|
1371
1175
|
};
|
|
1372
1176
|
if (node.kind === "hub") {
|
|
1373
|
-
const hubResult =
|
|
1177
|
+
const hubResult = new Map;
|
|
1374
1178
|
const addHubResult = (input) => {
|
|
1375
1179
|
hubResult.set(inputKey(input.input), input);
|
|
1376
1180
|
};
|
|
@@ -1404,7 +1208,7 @@ var InputResolver = class extends GraphResolver {
|
|
|
1404
1208
|
instance: node.instance,
|
|
1405
1209
|
component: node.component,
|
|
1406
1210
|
entities: node.entities,
|
|
1407
|
-
resolvedInputs:
|
|
1211
|
+
resolvedInputs: mapValues2(node.instance.resolvedInputs, (inputs, inputName) => {
|
|
1408
1212
|
const componentInput = node.component.inputs[inputName];
|
|
1409
1213
|
if (!componentInput) {
|
|
1410
1214
|
this.logger.warn({
|
|
@@ -1421,11 +1225,11 @@ var InputResolver = class extends GraphResolver {
|
|
|
1421
1225
|
matchedInjectionInputs: []
|
|
1422
1226
|
};
|
|
1423
1227
|
}
|
|
1424
|
-
const resolvedInputsMap =
|
|
1228
|
+
const resolvedInputsMap = new Map;
|
|
1425
1229
|
const addInstanceResult = (inputName, input) => {
|
|
1426
1230
|
let inputs = resolvedInputsMap.get(inputName);
|
|
1427
1231
|
if (!inputs) {
|
|
1428
|
-
inputs =
|
|
1232
|
+
inputs = new Map;
|
|
1429
1233
|
resolvedInputsMap.set(inputName, inputs);
|
|
1430
1234
|
}
|
|
1431
1235
|
inputs.set(inputKey(input.input), input);
|
|
@@ -1457,17 +1261,13 @@ var InputResolver = class extends GraphResolver {
|
|
|
1457
1261
|
addInstanceResult(inputName, {
|
|
1458
1262
|
input: {
|
|
1459
1263
|
...output,
|
|
1460
|
-
// keep explicit path from the edge while preserving already-resolved output path
|
|
1461
1264
|
path: input.path ?? output.path
|
|
1462
1265
|
},
|
|
1463
|
-
type: this.resolveOutputTypeForInput(
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
},
|
|
1469
|
-
componentInput.type
|
|
1470
|
-
)
|
|
1266
|
+
type: this.resolveOutputTypeForInput({
|
|
1267
|
+
instanceId: input.instanceId,
|
|
1268
|
+
output: input.output,
|
|
1269
|
+
path: input.path ?? output.path
|
|
1270
|
+
}, componentInput.type)
|
|
1471
1271
|
});
|
|
1472
1272
|
}
|
|
1473
1273
|
} else {
|
|
@@ -1482,8 +1282,8 @@ var InputResolver = class extends GraphResolver {
|
|
|
1482
1282
|
addInstanceInput(inputName, input);
|
|
1483
1283
|
}
|
|
1484
1284
|
}
|
|
1485
|
-
const injectionInputs =
|
|
1486
|
-
const matchedInjectionInputs =
|
|
1285
|
+
const injectionInputs = new Map;
|
|
1286
|
+
const matchedInjectionInputs = new Map;
|
|
1487
1287
|
for (const injectionInput of node.instance.injectionInputs ?? []) {
|
|
1488
1288
|
const { resolvedInputs: resolvedInputs2 } = getHubOutput(injectionInput);
|
|
1489
1289
|
for (const input of resolvedInputs2) {
|
|
@@ -1509,12 +1309,10 @@ var InputResolver = class extends GraphResolver {
|
|
|
1509
1309
|
}
|
|
1510
1310
|
}
|
|
1511
1311
|
}
|
|
1512
|
-
const resolvedInputs = fromEntries(
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
])
|
|
1517
|
-
);
|
|
1312
|
+
const resolvedInputs = fromEntries(Array.from(resolvedInputsMap.entries()).map(([inputName, inputs]) => [
|
|
1313
|
+
inputName,
|
|
1314
|
+
Array.from(inputs.values())
|
|
1315
|
+
]));
|
|
1518
1316
|
return {
|
|
1519
1317
|
kind: "instance",
|
|
1520
1318
|
instance: node.instance,
|
|
@@ -1526,7 +1324,7 @@ var InputResolver = class extends GraphResolver {
|
|
|
1526
1324
|
matchedInjectionInputs: Array.from(matchedInjectionInputs.values())
|
|
1527
1325
|
};
|
|
1528
1326
|
}
|
|
1529
|
-
}
|
|
1327
|
+
}
|
|
1530
1328
|
function getResolvedHubInputs(outputMap, hubId) {
|
|
1531
1329
|
const output = outputMap.get(`hub:${hubId}`);
|
|
1532
1330
|
if (!output) {
|
|
@@ -1570,22 +1368,28 @@ function getMatchedInjectionInstanceInputs(outputMap, instanceId) {
|
|
|
1570
1368
|
function getResolvedInstanceOutputs(outputMap, instanceId) {
|
|
1571
1369
|
const output = outputMap.get(`instance:${instanceId}`);
|
|
1572
1370
|
if (!output) {
|
|
1573
|
-
return
|
|
1371
|
+
return;
|
|
1574
1372
|
}
|
|
1575
1373
|
if (output.kind !== "instance") {
|
|
1576
1374
|
throw new Error("Expected instance node");
|
|
1577
1375
|
}
|
|
1578
1376
|
return output.resolvedOutputs;
|
|
1579
1377
|
}
|
|
1378
|
+
// src/shared/resolvers/input-hash.ts
|
|
1379
|
+
import { crc32 } from "@aws-crypto/crc32";
|
|
1380
|
+
import { isUnitModel as isUnitModel2 } from "@highstate/contract";
|
|
1381
|
+
import { encode } from "@msgpack/msgpack";
|
|
1382
|
+
import { Buffer } from "buffer-polyfill";
|
|
1580
1383
|
|
|
1581
1384
|
// src/shared/utils/async-batcher.ts
|
|
1582
|
-
function createAsyncBatcher(fn, { waitMs = 100, maxWaitTimeMs =
|
|
1385
|
+
function createAsyncBatcher(fn, { waitMs = 100, maxWaitTimeMs = 1000 } = {}) {
|
|
1583
1386
|
let batch = [];
|
|
1584
1387
|
let activeTimeout = null;
|
|
1585
1388
|
let maxWaitTimeout = null;
|
|
1586
1389
|
let firstCallTimestamp = null;
|
|
1587
1390
|
async function processBatch() {
|
|
1588
|
-
if (batch.length === 0)
|
|
1391
|
+
if (batch.length === 0)
|
|
1392
|
+
return;
|
|
1589
1393
|
const currentBatch = batch;
|
|
1590
1394
|
batch = [];
|
|
1591
1395
|
await fn(currentBatch);
|
|
@@ -1596,31 +1400,27 @@ function createAsyncBatcher(fn, { waitMs = 100, maxWaitTimeMs = 1e3 } = {}) {
|
|
|
1596
1400
|
firstCallTimestamp = null;
|
|
1597
1401
|
}
|
|
1598
1402
|
function schedule() {
|
|
1599
|
-
if (activeTimeout)
|
|
1403
|
+
if (activeTimeout)
|
|
1404
|
+
clearTimeout(activeTimeout);
|
|
1600
1405
|
activeTimeout = setTimeout(() => {
|
|
1601
1406
|
activeTimeout = null;
|
|
1602
|
-
|
|
1407
|
+
processBatch();
|
|
1603
1408
|
}, waitMs);
|
|
1604
1409
|
if (!firstCallTimestamp) {
|
|
1605
1410
|
firstCallTimestamp = Date.now();
|
|
1606
1411
|
maxWaitTimeout = setTimeout(() => {
|
|
1607
|
-
if (activeTimeout)
|
|
1412
|
+
if (activeTimeout)
|
|
1413
|
+
clearTimeout(activeTimeout);
|
|
1608
1414
|
activeTimeout = null;
|
|
1609
|
-
|
|
1415
|
+
processBatch();
|
|
1610
1416
|
}, maxWaitTimeMs);
|
|
1611
1417
|
}
|
|
1612
1418
|
}
|
|
1613
1419
|
return {
|
|
1614
|
-
/**
|
|
1615
|
-
* Add an item to the batch.
|
|
1616
|
-
*/
|
|
1617
1420
|
call(item) {
|
|
1618
1421
|
batch.push(item);
|
|
1619
1422
|
schedule();
|
|
1620
1423
|
},
|
|
1621
|
-
/**
|
|
1622
|
-
* Immediately flush the pending batch (if any).
|
|
1623
|
-
*/
|
|
1624
1424
|
async flush() {
|
|
1625
1425
|
if (activeTimeout) {
|
|
1626
1426
|
clearTimeout(activeTimeout);
|
|
@@ -1634,7 +1434,6 @@ function createAsyncBatcher(fn, { waitMs = 100, maxWaitTimeMs = 1e3 } = {}) {
|
|
|
1634
1434
|
}
|
|
1635
1435
|
};
|
|
1636
1436
|
}
|
|
1637
|
-
|
|
1638
1437
|
// src/shared/utils/hash.ts
|
|
1639
1438
|
function int32ToBytes(value) {
|
|
1640
1439
|
const buffer = new ArrayBuffer(4);
|
|
@@ -1642,20 +1441,13 @@ function int32ToBytes(value) {
|
|
|
1642
1441
|
view.setInt32(0, value, true);
|
|
1643
1442
|
return new Uint8Array(buffer);
|
|
1644
1443
|
}
|
|
1645
|
-
|
|
1646
1444
|
// src/shared/utils/promise-tracker.ts
|
|
1647
|
-
|
|
1648
|
-
trackedPromises =
|
|
1649
|
-
/**
|
|
1650
|
-
* Tracks a promise to ensure its rejection is handled inside the tracker's scope.
|
|
1651
|
-
*/
|
|
1445
|
+
class PromiseTracker {
|
|
1446
|
+
trackedPromises = new Set;
|
|
1652
1447
|
track(promise) {
|
|
1653
1448
|
const wrapped = promise.finally(() => this.trackedPromises.delete(promise));
|
|
1654
1449
|
this.trackedPromises.add(wrapped);
|
|
1655
1450
|
}
|
|
1656
|
-
/**
|
|
1657
|
-
* Waits for all tracked promises to resolve or reject.
|
|
1658
|
-
*/
|
|
1659
1451
|
async waitForAll() {
|
|
1660
1452
|
if (this.trackedPromises.size === 0) {
|
|
1661
1453
|
return;
|
|
@@ -1664,19 +1456,15 @@ var PromiseTracker = class {
|
|
|
1664
1456
|
this.trackedPromises.clear();
|
|
1665
1457
|
await waitAll(toTrack);
|
|
1666
1458
|
}
|
|
1667
|
-
}
|
|
1459
|
+
}
|
|
1668
1460
|
async function waitAll(promises) {
|
|
1669
1461
|
const results = await Promise.allSettled(promises);
|
|
1670
1462
|
const rejected = results.filter((p) => p.status === "rejected");
|
|
1671
1463
|
if (!rejected.length) {
|
|
1672
1464
|
return;
|
|
1673
1465
|
}
|
|
1674
|
-
throw new AggregateError(
|
|
1675
|
-
rejected.map((p) => p.reason),
|
|
1676
|
-
"Some promises were rejected"
|
|
1677
|
-
);
|
|
1466
|
+
throw new AggregateError(rejected.map((p) => p.reason), "Some promises were rejected");
|
|
1678
1467
|
}
|
|
1679
|
-
|
|
1680
1468
|
// src/shared/utils/stable-json.ts
|
|
1681
1469
|
function stableJsonStringify(value) {
|
|
1682
1470
|
if (value === null) {
|
|
@@ -1702,7 +1490,7 @@ function stableJsonStringify(value) {
|
|
|
1702
1490
|
const parts = [];
|
|
1703
1491
|
for (const key of keys) {
|
|
1704
1492
|
const item = record[key];
|
|
1705
|
-
if (item ===
|
|
1493
|
+
if (item === undefined) {
|
|
1706
1494
|
throw new Error("Snapshot content contains undefined");
|
|
1707
1495
|
}
|
|
1708
1496
|
parts.push(`${JSON.stringify(key)}:${stableJsonStringify(item)}`);
|
|
@@ -1713,9 +1501,8 @@ function stableJsonStringify(value) {
|
|
|
1713
1501
|
throw new Error(`Snapshot content contains non-JSON value of type "${typeof value}"`);
|
|
1714
1502
|
}
|
|
1715
1503
|
}
|
|
1716
|
-
|
|
1717
1504
|
// src/shared/resolvers/input-hash.ts
|
|
1718
|
-
|
|
1505
|
+
class InputHashResolver extends GraphResolver {
|
|
1719
1506
|
getNodeDependencies({ resolvedInputs }) {
|
|
1720
1507
|
const dependencies = [];
|
|
1721
1508
|
for (const inputs of Object.values(resolvedInputs ?? {})) {
|
|
@@ -1730,28 +1517,25 @@ var InputHashResolver = class extends GraphResolver {
|
|
|
1730
1517
|
component,
|
|
1731
1518
|
resolvedInputs,
|
|
1732
1519
|
sourceHash,
|
|
1733
|
-
state
|
|
1520
|
+
state: state2
|
|
1734
1521
|
}) {
|
|
1735
1522
|
const selfHashSink = [];
|
|
1736
1523
|
selfHashSink.push(Buffer.from(instance.id));
|
|
1737
1524
|
selfHashSink.push(int32ToBytes(component.definitionHash));
|
|
1738
|
-
if (
|
|
1739
|
-
selfHashSink.push(int32ToBytes(
|
|
1525
|
+
if (state2?.inputHashNonce) {
|
|
1526
|
+
selfHashSink.push(int32ToBytes(state2.inputHashNonce));
|
|
1740
1527
|
}
|
|
1741
1528
|
if (instance.args) {
|
|
1742
1529
|
selfHashSink.push(encode(instance.args));
|
|
1743
1530
|
}
|
|
1744
1531
|
if (sourceHash) {
|
|
1745
1532
|
selfHashSink.push(int32ToBytes(sourceHash));
|
|
1746
|
-
} else if (
|
|
1747
|
-
this.logger.warn(
|
|
1748
|
-
{ instanceId: instance.id },
|
|
1749
|
-
"missing source hash for unit model, this may lead to incorrect input hash"
|
|
1750
|
-
);
|
|
1533
|
+
} else if (isUnitModel2(component)) {
|
|
1534
|
+
this.logger.warn({ instanceId: instance.id }, "missing source hash for unit model, this may lead to incorrect input hash");
|
|
1751
1535
|
}
|
|
1752
1536
|
const inputHashSink = [...selfHashSink];
|
|
1753
1537
|
const sortedInputs = Object.entries(resolvedInputs).sort(([a], [b]) => a.localeCompare(b));
|
|
1754
|
-
const dependencyInstanceIds =
|
|
1538
|
+
const dependencyInstanceIds = new Set;
|
|
1755
1539
|
for (const [inputKey2, inputs] of sortedInputs) {
|
|
1756
1540
|
if (Object.keys(inputs).length === 0) {
|
|
1757
1541
|
continue;
|
|
@@ -1761,10 +1545,7 @@ var InputHashResolver = class extends GraphResolver {
|
|
|
1761
1545
|
for (const instanceId of instanceIds) {
|
|
1762
1546
|
const dependency = this.outputs.get(instanceId);
|
|
1763
1547
|
if (!dependency) {
|
|
1764
|
-
this.logger.warn(
|
|
1765
|
-
{ instanceId, dependentInstanceId: instance.id },
|
|
1766
|
-
"missing dependency when calculating input hash, this may lead to incorrect input hash"
|
|
1767
|
-
);
|
|
1548
|
+
this.logger.warn({ instanceId, dependentInstanceId: instance.id }, "missing dependency when calculating input hash, this may lead to incorrect input hash");
|
|
1768
1549
|
continue;
|
|
1769
1550
|
}
|
|
1770
1551
|
inputHashSink.push(int32ToBytes(dependency.inputHash));
|
|
@@ -1777,10 +1558,7 @@ var InputHashResolver = class extends GraphResolver {
|
|
|
1777
1558
|
for (const dependencyInstanceId of sortedDependencyInstanceIds) {
|
|
1778
1559
|
const dependency = this.outputs.get(dependencyInstanceId);
|
|
1779
1560
|
if (!dependency) {
|
|
1780
|
-
this.logger.warn(
|
|
1781
|
-
{ instanceId: dependencyInstanceId, dependentInstanceId: instance.id },
|
|
1782
|
-
"missing dependency when calculating dependency output hash, this may lead to incorrect input hash"
|
|
1783
|
-
);
|
|
1561
|
+
this.logger.warn({ instanceId: dependencyInstanceId, dependentInstanceId: instance.id }, "missing dependency when calculating dependency output hash, this may lead to incorrect input hash");
|
|
1784
1562
|
continue;
|
|
1785
1563
|
}
|
|
1786
1564
|
dependencyOutputHashSink.push(int32ToBytes(dependency.outputHash));
|
|
@@ -1789,11 +1567,18 @@ var InputHashResolver = class extends GraphResolver {
|
|
|
1789
1567
|
selfHash: crc32(Buffer.concat(selfHashSink)),
|
|
1790
1568
|
inputHash: crc32(Buffer.concat(inputHashSink)),
|
|
1791
1569
|
dependencyOutputHash: crc32(Buffer.concat(dependencyOutputHashSink)),
|
|
1792
|
-
outputHash:
|
|
1570
|
+
outputHash: state2?.outputHash ?? 0
|
|
1793
1571
|
};
|
|
1794
1572
|
}
|
|
1795
|
-
}
|
|
1796
|
-
|
|
1573
|
+
}
|
|
1574
|
+
// src/shared/resolvers/validation.ts
|
|
1575
|
+
import {
|
|
1576
|
+
isUnitModel as isUnitModel3,
|
|
1577
|
+
parseArgumentValue
|
|
1578
|
+
} from "@highstate/contract";
|
|
1579
|
+
import { Ajv } from "ajv";
|
|
1580
|
+
import styles from "ansi-styles";
|
|
1581
|
+
class ValidationResolver extends GraphResolver {
|
|
1797
1582
|
getNodeDependencies({ resolvedInputs }) {
|
|
1798
1583
|
const dependencies = [];
|
|
1799
1584
|
for (const inputs of Object.values(resolvedInputs)) {
|
|
@@ -1803,38 +1588,29 @@ var ValidationResolver = class extends GraphResolver {
|
|
|
1803
1588
|
}
|
|
1804
1589
|
return dependencies;
|
|
1805
1590
|
}
|
|
1806
|
-
processNode({ instance, component, state, resolvedInputs }) {
|
|
1591
|
+
processNode({ instance, component, state: state2, resolvedInputs }) {
|
|
1807
1592
|
const ajv = new Ajv({ strict: false });
|
|
1808
1593
|
this.logger.debug({ instanceId: instance.id }, "validating instance");
|
|
1809
1594
|
const validationErrors = [];
|
|
1810
1595
|
for (const [name, argument] of Object.entries(component.args)) {
|
|
1811
1596
|
try {
|
|
1812
1597
|
const value = parseArgumentValue(instance.args?.[name]);
|
|
1813
|
-
if (!argument.required && value ===
|
|
1598
|
+
if (!argument.required && value === undefined) {
|
|
1814
1599
|
continue;
|
|
1815
1600
|
}
|
|
1816
1601
|
if (!ajv.validate(argument.schema, value)) {
|
|
1817
1602
|
this.logger.debug({ instanceId: instance.id, argumentName: name }, "invalid argument");
|
|
1818
|
-
validationErrors.push(
|
|
1819
|
-
`Invalid argument "${styles.blueBright.open}${name}${styles.reset.close}": ` + ajv.errorsText()
|
|
1820
|
-
);
|
|
1603
|
+
validationErrors.push(`Invalid argument ` + `"${styles.blueBright.open}${name}${styles.reset.close}": ` + ajv.errorsText());
|
|
1821
1604
|
}
|
|
1822
1605
|
} catch (error) {
|
|
1823
|
-
this.logger.debug(
|
|
1824
|
-
|
|
1825
|
-
"failed to validate argument"
|
|
1826
|
-
);
|
|
1827
|
-
validationErrors.push(
|
|
1828
|
-
`Failed to validate argument "${styles.blueBright.open}${name}${styles.reset.close}": ` + (error instanceof Error ? error.message : String(error))
|
|
1829
|
-
);
|
|
1606
|
+
this.logger.debug({ instanceId: instance.id, argumentName: name, error }, "failed to validate argument");
|
|
1607
|
+
validationErrors.push(`Failed to validate argument ` + `"${styles.blueBright.open}${name}${styles.reset.close}": ` + (error instanceof Error ? error.message : String(error)));
|
|
1830
1608
|
}
|
|
1831
1609
|
}
|
|
1832
|
-
if (
|
|
1833
|
-
for (const [
|
|
1834
|
-
if (secretSchema.required && !
|
|
1835
|
-
validationErrors.push(
|
|
1836
|
-
`Missing required secret "${styles.blueBright.open}${secret}${styles.reset.close}"`
|
|
1837
|
-
);
|
|
1610
|
+
if (isUnitModel3(component)) {
|
|
1611
|
+
for (const [secret2, secretSchema] of Object.entries(component.secrets)) {
|
|
1612
|
+
if (secretSchema.required && !state2?.secretNames?.includes(secret2)) {
|
|
1613
|
+
validationErrors.push(`Missing required secret ` + `"${styles.blueBright.open}${secret2}${styles.reset.close}"`);
|
|
1838
1614
|
}
|
|
1839
1615
|
}
|
|
1840
1616
|
}
|
|
@@ -1842,10 +1618,8 @@ var ValidationResolver = class extends GraphResolver {
|
|
|
1842
1618
|
for (const input of inputs) {
|
|
1843
1619
|
const inputInstance = this.outputs.get(input.input.instanceId);
|
|
1844
1620
|
if (inputInstance?.status !== "ok") {
|
|
1845
|
-
validationErrors.push(
|
|
1846
|
-
|
|
1847
|
-
"${styles.blueBright.open}${input.input.instanceId}${styles.reset.close}" has validation errors`
|
|
1848
|
-
);
|
|
1621
|
+
validationErrors.push(`Invalid input ` + `"${styles.blueBright.open}${key}${styles.reset.close}":
|
|
1622
|
+
` + `"${styles.blueBright.open}${input.input.instanceId}${styles.reset.close}" ` + `has validation errors`);
|
|
1849
1623
|
}
|
|
1850
1624
|
}
|
|
1851
1625
|
}
|
|
@@ -1854,9 +1628,7 @@ var ValidationResolver = class extends GraphResolver {
|
|
|
1854
1628
|
continue;
|
|
1855
1629
|
}
|
|
1856
1630
|
if (!resolvedInputs[name] || !resolvedInputs[name].length) {
|
|
1857
|
-
validationErrors.push(
|
|
1858
|
-
`Missing required input "${styles.blueBright.open}${name}${styles.reset.close}" of type "${styles.greenBright.open}${input.type}${styles.reset.close}"`
|
|
1859
|
-
);
|
|
1631
|
+
validationErrors.push(`Missing required input ` + `"${styles.blueBright.open}${name}${styles.reset.close}" ` + `of type ` + `"${styles.greenBright.open}${input.type}${styles.reset.close}"`);
|
|
1860
1632
|
}
|
|
1861
1633
|
}
|
|
1862
1634
|
if (validationErrors.length === 0) {
|
|
@@ -1864,19 +1636,22 @@ var ValidationResolver = class extends GraphResolver {
|
|
|
1864
1636
|
}
|
|
1865
1637
|
const numberPrefixLength = (validationErrors.length + 1).toString().length + 2;
|
|
1866
1638
|
const formattedError = validationErrors.map((error, index) => {
|
|
1867
|
-
const lines = error.split(
|
|
1639
|
+
const lines = error.split(`
|
|
1640
|
+
`);
|
|
1868
1641
|
const prefix = `${index + 1}. `;
|
|
1869
1642
|
return lines.map((line, lineIndex) => {
|
|
1870
1643
|
const linePrefix = lineIndex === 0 ? prefix : " ".repeat(numberPrefixLength);
|
|
1871
1644
|
return `${linePrefix}${line}`;
|
|
1872
|
-
}).join(
|
|
1873
|
-
|
|
1645
|
+
}).join(`\r
|
|
1646
|
+
`);
|
|
1647
|
+
}).join(`\r
|
|
1648
|
+
`);
|
|
1874
1649
|
return {
|
|
1875
1650
|
status: "error",
|
|
1876
1651
|
errorText: formattedError
|
|
1877
1652
|
};
|
|
1878
1653
|
}
|
|
1879
|
-
}
|
|
1654
|
+
}
|
|
1880
1655
|
|
|
1881
1656
|
// src/shared/resolvers/registry.ts
|
|
1882
1657
|
var resolverFactories = {
|
|
@@ -1884,7 +1659,4 @@ var resolverFactories = {
|
|
|
1884
1659
|
InputHashResolver,
|
|
1885
1660
|
ValidationResolver
|
|
1886
1661
|
};
|
|
1887
|
-
|
|
1888
|
-
export { AccessError, BackendError, BackendUnlockMethodNotFoundError, CannotDeleteLastBackendUnlockMethodError, CannotDeleteLastUnlockMethodError, GraphResolver, InputHashResolver, InputResolver, InstanceLockLostError, InstanceLockedError, InstanceNotFoundError, InstanceStateNotFoundError, InvalidInstanceKindError, MAX_WORKER_START_ATTEMPTS, OperationNotFoundError, ProjectLockedError, ProjectNotFoundError, PromiseTracker, SystemSecretNames, ValidationResolver, WorkerVersionNotFoundError, apiKeyMetaSchema, apiKeyOutputSchema, apiKeyQuerySchema, applyLibraryUpdate, artifactOutputSchema, artifactQuerySchema, backendUnlockMethodInputSchema, backendUnlockMethodMetaSchema, codebaseLibrary, codebaseProjectModelStorage, collectionQueryResult, collectionQuerySchema, createAsyncBatcher, databaseProjectModelStorage, diffLibraries, entityDetailsOutputSchema, entityOutputSchema, entityQuerySchema, entityReferenceOutputSchema, entitySnapshotDetailsOutputSchema, entitySnapshotListItemOutputSchema, entitySnapshotOutputSchema, extractDigestFromImage, finalInstanceOperationStatuses, finalOperationStatuses, forSchema, getAllDependents, getMatchedInjectionInstanceInputs, getResolvedHubInputs, getResolvedInjectionInstanceInputs, getResolvedInstanceInputs, getResolvedInstanceOutputs, getWorkerIdentity, globalProjectSpace, hasObjectMeta, hostPulumiBackend, instanceCustomStatusInputSchema, instanceLockEventSchema, instanceLockOutputSchema, instanceStateEventSchema, int32ToBytes, isFinalOperationStatus, isInstanceDeployed, isTransientInstanceOperationStatus, isTransientOperationStatus, isVirtualGhostInstance, librarySpecSchema, operationEventSchema, operationLaunchInputSchema, operationMetaSchema, operationOptionsSchema, operationOutputSchema, operationPhaseInstanceSchema, operationPhaseSchema, operationPhaseTypeSchema, operationPlanInputSchema, operationStatusSchema, operationTypeSchema, pageDetailsOutputSchema, pageOutputSchema, pageQuerySchema, projectInputSchema, projectModelEventSchema, projectModelStorageSpecSchema, projectOutputSchema, projectUnlockStateSchema, projectUnlockSuiteSchema, pulumiBackendSpecSchema, resolveEffectiveOutputType, resolverFactories, secretOutputSchema, secretQuerySchema, serviceAccountOutputSchema, serviceAccountQuerySchema, stableInstanceInputSchema, stableJsonStringify, terminalDetailsOutputSchema, terminalOutputSchema, terminalQuerySchema, terminalSessionOutputSchema, terminalStatusSchema, toApiKeyOutput, toCommonEntityMeta, toPageOutput, toSecretOutput, toTerminalDetailsOutput, toTerminalOutput, toTerminalSessionOutput, toWorkerOutput, toWorkerVersionOutput, triggerOutputSchema, triggerQuerySchema, unlockMethodInputSchema, unlockMethodMetaSchema, unlockMethodOutputSchema, unlockMethodType, waitAll, workerOutputSchema, workerQuerySchema, workerUnitRegistrationEventSchema, workerVersionOutputSchema, workerVersionStatusEventSchema, workerVersionStatusSchema };
|
|
1889
|
-
//# sourceMappingURL=chunk-52MY2TCE.js.map
|
|
1890
|
-
//# sourceMappingURL=chunk-52MY2TCE.js.map
|
|
1662
|
+
export { librarySpecSchema, diffLibraries, applyLibraryUpdate, globalProjectSpace, codebaseLibrary, hostPulumiBackend, codebaseProjectModelStorage, databaseProjectModelStorage, projectModelStorageSpecSchema, projectInputSchema, projectOutputSchema, projectUnlockSuiteSchema, projectUnlockStateSchema, pulumiBackendSpecSchema, backendUnlockMethodMetaSchema, backendUnlockMethodInputSchema, hasObjectMeta, collectionQuerySchema, collectionQueryResult, forSchema, BackendError, AccessError, ProjectLockedError, ProjectNotFoundError, CannotDeleteLastUnlockMethodError, InstanceNotFoundError, InvalidInstanceKindError, OperationNotFoundError, InstanceLockLostError, InstanceStateNotFoundError, InstanceLockedError, WorkerVersionNotFoundError, BackendUnlockMethodNotFoundError, CannotDeleteLastBackendUnlockMethodError, apiKeyMetaSchema, apiKeyOutputSchema, apiKeyQuerySchema, toApiKeyOutput, artifactOutputSchema, artifactQuerySchema, instanceCustomStatusInputSchema, entityOutputSchema, entityQuerySchema, entitySnapshotOutputSchema, entitySnapshotListItemOutputSchema, entitySnapshotDetailsOutputSchema, entityDetailsOutputSchema, entityReferenceOutputSchema, toCommonEntityMeta, instanceLockOutputSchema, instanceLockEventSchema, projectModelEventSchema, operationPhaseTypeSchema, operationPhaseInstanceSchema, operationPhaseSchema, operationOptionsSchema, operationTypeSchema, operationStatusSchema, operationMetaSchema, operationPlanInputSchema, operationLaunchInputSchema, operationEventSchema, operationOutputSchema, finalOperationStatuses, isFinalOperationStatus, isTransientOperationStatus, pageOutputSchema, pageQuerySchema, pageDetailsOutputSchema, toPageOutput, secretOutputSchema, secretQuerySchema, toSecretOutput, SystemSecretNames, serviceAccountOutputSchema, serviceAccountQuerySchema, stableInstanceInputSchema, instanceStateEventSchema, isVirtualGhostInstance, isInstanceDeployed, finalInstanceOperationStatuses, isTransientInstanceOperationStatus, workerUnitRegistrationEventSchema, terminalStatusSchema, terminalSessionOutputSchema, terminalOutputSchema, terminalQuerySchema, toTerminalOutput, toTerminalDetailsOutput, terminalDetailsOutputSchema, toTerminalSessionOutput, triggerOutputSchema, triggerQuerySchema, unlockMethodType, unlockMethodMetaSchema, unlockMethodInputSchema, unlockMethodOutputSchema, MAX_WORKER_START_ATTEMPTS, extractDigestFromImage, getWorkerIdentity, workerVersionStatusSchema, workerVersionStatusEventSchema, workerVersionOutputSchema, workerOutputSchema, workerQuerySchema, toWorkerOutput, toWorkerVersionOutput, resolveEffectiveOutputType, GraphResolver, getAllDependents, InputResolver, getResolvedHubInputs, getResolvedInstanceInputs, getResolvedInjectionInstanceInputs, getMatchedInjectionInstanceInputs, getResolvedInstanceOutputs, createAsyncBatcher, int32ToBytes, PromiseTracker, waitAll, stableJsonStringify, InputHashResolver, ValidationResolver, resolverFactories };
|