@tryarcanist/cli 0.1.303 → 0.1.304
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/index.js +130 -26
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -24487,6 +24487,103 @@ async function parseSandboxLayerSource(input) {
|
|
|
24487
24487
|
};
|
|
24488
24488
|
}
|
|
24489
24489
|
|
|
24490
|
+
// ../../shared/types/sandbox-layer-api.ts
|
|
24491
|
+
var sandboxLayerBuildActorSchema = external_exports.object({
|
|
24492
|
+
userId: external_exports.number(),
|
|
24493
|
+
login: external_exports.string().nullable(),
|
|
24494
|
+
name: external_exports.string().nullable()
|
|
24495
|
+
});
|
|
24496
|
+
var sandboxLayerFailureSummarySchema = external_exports.object({
|
|
24497
|
+
phase: external_exports.enum(["validation", "provider_build", "smoke", "runtime", "unknown"]),
|
|
24498
|
+
reason: external_exports.string(),
|
|
24499
|
+
command: external_exports.string().optional(),
|
|
24500
|
+
commandIndex: external_exports.number().optional(),
|
|
24501
|
+
exitCode: external_exports.number().optional(),
|
|
24502
|
+
stdoutPreview: external_exports.string().optional(),
|
|
24503
|
+
stderrPreview: external_exports.string().optional(),
|
|
24504
|
+
activeTemplateUnchanged: external_exports.boolean()
|
|
24505
|
+
});
|
|
24506
|
+
var baseSourceSchema = external_exports.enum(["registry", "env_fallback"]);
|
|
24507
|
+
var baseVersionQualitySchema = external_exports.enum(["versioned", "unversioned"]);
|
|
24508
|
+
var sandboxLayerBuildRequestSchema = external_exports.object({
|
|
24509
|
+
id: external_exports.string(),
|
|
24510
|
+
status: external_exports.string(),
|
|
24511
|
+
repo: external_exports.string(),
|
|
24512
|
+
sourceRepo: external_exports.string(),
|
|
24513
|
+
targetRepo: external_exports.string(),
|
|
24514
|
+
requestedRef: external_exports.string(),
|
|
24515
|
+
commitSha: external_exports.string(),
|
|
24516
|
+
manifestPath: external_exports.string(),
|
|
24517
|
+
layerPath: external_exports.string(),
|
|
24518
|
+
sourceContentHash: external_exports.string(),
|
|
24519
|
+
baseTemplateRef: external_exports.string(),
|
|
24520
|
+
baseVersion: external_exports.string(),
|
|
24521
|
+
baseSource: baseSourceSchema,
|
|
24522
|
+
baseVersionQuality: baseVersionQualitySchema,
|
|
24523
|
+
resourceProfileKey: external_exports.string(),
|
|
24524
|
+
promotionEligibility: external_exports.enum(["default_branch_head", "non_default_ref", "unknown"]),
|
|
24525
|
+
willPromote: external_exports.number().optional(),
|
|
24526
|
+
providerArtifactRef: external_exports.string().nullable().optional(),
|
|
24527
|
+
activeTemplateRef: external_exports.string().nullable().optional(),
|
|
24528
|
+
createdBy: sandboxLayerBuildActorSchema,
|
|
24529
|
+
failureSummary: sandboxLayerFailureSummarySchema.nullable().optional()
|
|
24530
|
+
});
|
|
24531
|
+
var sandboxLayerBuildHistoryItemSchema = external_exports.object({
|
|
24532
|
+
id: external_exports.string(),
|
|
24533
|
+
status: external_exports.string(),
|
|
24534
|
+
sourceRepo: external_exports.string(),
|
|
24535
|
+
commitSha: external_exports.string(),
|
|
24536
|
+
resourceProfileKey: external_exports.string(),
|
|
24537
|
+
templateId: external_exports.string().nullable(),
|
|
24538
|
+
baseTemplateRef: external_exports.string(),
|
|
24539
|
+
baseVersion: external_exports.string(),
|
|
24540
|
+
baseSource: baseSourceSchema,
|
|
24541
|
+
baseVersionQuality: baseVersionQualitySchema,
|
|
24542
|
+
createdBy: sandboxLayerBuildActorSchema,
|
|
24543
|
+
createdAt: external_exports.number(),
|
|
24544
|
+
startedAt: external_exports.number().nullable(),
|
|
24545
|
+
completedAt: external_exports.number().nullable(),
|
|
24546
|
+
smokeStatus: external_exports.enum(["passed", "failed"]).nullable(),
|
|
24547
|
+
failureSummary: sandboxLayerFailureSummarySchema.nullable()
|
|
24548
|
+
});
|
|
24549
|
+
var sandboxLayerBuildLogSchema = external_exports.object({
|
|
24550
|
+
id: external_exports.string(),
|
|
24551
|
+
build_id: external_exports.string(),
|
|
24552
|
+
sequence: external_exports.number(),
|
|
24553
|
+
message: external_exports.string(),
|
|
24554
|
+
created_at: external_exports.number()
|
|
24555
|
+
});
|
|
24556
|
+
var sandboxLayerBuildRequestResponseSchema = external_exports.object({
|
|
24557
|
+
ok: external_exports.boolean(),
|
|
24558
|
+
buildRequest: sandboxLayerBuildRequestSchema
|
|
24559
|
+
});
|
|
24560
|
+
var sandboxLayerBuildHistoryResponseSchema = external_exports.object({
|
|
24561
|
+
ok: external_exports.boolean(),
|
|
24562
|
+
builds: external_exports.array(sandboxLayerBuildHistoryItemSchema)
|
|
24563
|
+
});
|
|
24564
|
+
var sandboxLayerBuildLogsResponseSchema = external_exports.object({
|
|
24565
|
+
ok: external_exports.boolean(),
|
|
24566
|
+
logs: external_exports.array(sandboxLayerBuildLogSchema)
|
|
24567
|
+
});
|
|
24568
|
+
var sandboxLayerCliBuildRequestSchema = sandboxLayerBuildRequestSchema.partial().required({ id: true, status: true }).extend({ createdBy: sandboxLayerBuildActorSchema.nullable().optional() });
|
|
24569
|
+
var sandboxLayerCliBuildHistoryItemSchema = sandboxLayerBuildHistoryItemSchema.extend({
|
|
24570
|
+
startedAt: external_exports.number().nullable().optional(),
|
|
24571
|
+
failureSummary: sandboxLayerFailureSummarySchema.nullable().optional()
|
|
24572
|
+
});
|
|
24573
|
+
var sandboxLayerCliBuildLogSchema = sandboxLayerBuildLogSchema.partial().required({ sequence: true, message: true }).extend({ created_at: external_exports.union([external_exports.string(), external_exports.number()]).optional() });
|
|
24574
|
+
var sandboxLayerCliBuildRequestResponseSchema = external_exports.object({
|
|
24575
|
+
ok: external_exports.boolean(),
|
|
24576
|
+
buildRequest: sandboxLayerCliBuildRequestSchema
|
|
24577
|
+
});
|
|
24578
|
+
var sandboxLayerCliBuildHistoryResponseSchema = external_exports.object({
|
|
24579
|
+
ok: external_exports.boolean(),
|
|
24580
|
+
builds: external_exports.array(sandboxLayerCliBuildHistoryItemSchema)
|
|
24581
|
+
});
|
|
24582
|
+
var sandboxLayerCliBuildLogsResponseSchema = external_exports.object({
|
|
24583
|
+
ok: external_exports.boolean(),
|
|
24584
|
+
logs: external_exports.array(sandboxLayerCliBuildLogSchema)
|
|
24585
|
+
});
|
|
24586
|
+
|
|
24490
24587
|
// src/commands/sandbox.ts
|
|
24491
24588
|
var DEFAULT_MANIFEST_PATH = SANDBOX_LAYER_MANIFEST_PATH;
|
|
24492
24589
|
var DEFAULT_POLL_INTERVAL_MS = 2500;
|
|
@@ -24636,9 +24733,11 @@ function buildLogsPath(businessId, buildId, options = {}) {
|
|
|
24636
24733
|
)}/logs${suffix}`;
|
|
24637
24734
|
}
|
|
24638
24735
|
async function fetchAndEmitBuildLogs(config2, businessId, buildId, options) {
|
|
24639
|
-
const logs =
|
|
24640
|
-
|
|
24641
|
-
|
|
24736
|
+
const logs = sandboxLayerCliBuildLogsResponseSchema.parse(
|
|
24737
|
+
await apiFetch(
|
|
24738
|
+
config2,
|
|
24739
|
+
buildLogsPath(businessId, buildId, { afterSequence: options.afterSequence, limit: options.limit })
|
|
24740
|
+
)
|
|
24642
24741
|
);
|
|
24643
24742
|
if (logs.logs.length === 0) return { afterSequence: options.afterSequence, count: 0 };
|
|
24644
24743
|
if (options.json) writeJson({ type: "logs", logs: logs.logs });
|
|
@@ -24664,9 +24763,11 @@ async function waitForBuild(config2, businessId, buildId, options) {
|
|
|
24664
24763
|
const result = await fetchAndEmitBuildLogs(config2, businessId, buildId, { afterSequence, json: options.json });
|
|
24665
24764
|
afterSequence = result.afterSequence;
|
|
24666
24765
|
}
|
|
24667
|
-
const status =
|
|
24668
|
-
|
|
24669
|
-
|
|
24766
|
+
const status = sandboxLayerCliBuildRequestResponseSchema.parse(
|
|
24767
|
+
await apiFetch(
|
|
24768
|
+
config2,
|
|
24769
|
+
`/api/businesses/${encodeURIComponent(businessId)}/sandbox-layer/build-requests/${encodeURIComponent(buildId)}`
|
|
24770
|
+
)
|
|
24670
24771
|
);
|
|
24671
24772
|
if (TERMINAL_BUILD_STATUSES.has(status.buildRequest.status)) {
|
|
24672
24773
|
if (options.follow) {
|
|
@@ -24786,20 +24887,22 @@ async function sandboxBuildCommand(sourceRepoArg, options = {}, command) {
|
|
|
24786
24887
|
const ref = options.ref ?? currentRef();
|
|
24787
24888
|
let payload;
|
|
24788
24889
|
try {
|
|
24789
|
-
payload =
|
|
24790
|
-
|
|
24791
|
-
|
|
24792
|
-
sourceRepo.
|
|
24793
|
-
|
|
24794
|
-
|
|
24795
|
-
|
|
24796
|
-
|
|
24797
|
-
|
|
24798
|
-
|
|
24799
|
-
|
|
24800
|
-
|
|
24801
|
-
|
|
24802
|
-
|
|
24890
|
+
payload = sandboxLayerCliBuildRequestResponseSchema.parse(
|
|
24891
|
+
await apiFetch(
|
|
24892
|
+
config2,
|
|
24893
|
+
`/api/businesses/${encodeURIComponent(businessId)}/repos/${encodeURIComponent(sourceRepo.owner)}/${encodeURIComponent(
|
|
24894
|
+
sourceRepo.repo
|
|
24895
|
+
)}/sandbox-layer/build-requests`,
|
|
24896
|
+
{
|
|
24897
|
+
method: "POST",
|
|
24898
|
+
headers: { "Idempotency-Key": options.idempotencyKey ?? randomIdempotencyKey() },
|
|
24899
|
+
body: JSON.stringify({
|
|
24900
|
+
ref,
|
|
24901
|
+
manifestPath,
|
|
24902
|
+
...targetRepo ? { targetRepo: { owner: targetRepo.owner, name: targetRepo.repo } } : {}
|
|
24903
|
+
})
|
|
24904
|
+
}
|
|
24905
|
+
)
|
|
24803
24906
|
);
|
|
24804
24907
|
} catch (err) {
|
|
24805
24908
|
if (err instanceof ApiError && err.status === 409 && err.data?.serverCode === "duplicate_request") {
|
|
@@ -24859,9 +24962,11 @@ async function sandboxHistoryCommand(sourceRepoArg, options = {}, command) {
|
|
|
24859
24962
|
}
|
|
24860
24963
|
params.set("limit", String(limit));
|
|
24861
24964
|
}
|
|
24862
|
-
const payload =
|
|
24863
|
-
|
|
24864
|
-
|
|
24965
|
+
const payload = sandboxLayerCliBuildHistoryResponseSchema.parse(
|
|
24966
|
+
await apiFetch(
|
|
24967
|
+
config2,
|
|
24968
|
+
`/api/businesses/${encodeURIComponent(businessId)}/sandbox-layer/build-requests?${params.toString()}`
|
|
24969
|
+
)
|
|
24865
24970
|
);
|
|
24866
24971
|
emit(command, options, payload, (historyPayload) => printBuildHistory(historyPayload.builds));
|
|
24867
24972
|
}
|
|
@@ -24935,9 +25040,8 @@ async function sandboxLogsCommand(buildId, options = {}, command) {
|
|
|
24935
25040
|
throw new CliError("user", "--limit must be a positive integer.");
|
|
24936
25041
|
}
|
|
24937
25042
|
for (; ; ) {
|
|
24938
|
-
const payload =
|
|
24939
|
-
config2,
|
|
24940
|
-
buildLogsPath(businessId, buildId, { afterSequence, limit })
|
|
25043
|
+
const payload = sandboxLayerCliBuildLogsResponseSchema.parse(
|
|
25044
|
+
await apiFetch(config2, buildLogsPath(businessId, buildId, { afterSequence, limit }))
|
|
24941
25045
|
);
|
|
24942
25046
|
if (payload.logs.length > 0 || !options.follow) {
|
|
24943
25047
|
if (isJson(command, options)) writeJson(options.follow ? { type: "logs", logs: payload.logs } : payload);
|