makefx 0.2.3 → 0.2.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/makefx.mjs +26 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/makefx.mjs
CHANGED
|
@@ -21455,6 +21455,19 @@ var VIDEO_GENERATION_REQUEST_TIMEOUT_MS = 72e4;
|
|
|
21455
21455
|
function getGenerationRequestTimeoutMs(mediaKind) {
|
|
21456
21456
|
return mediaKind === "video" ? VIDEO_GENERATION_REQUEST_TIMEOUT_MS : GENERATION_REQUEST_TIMEOUT_MS;
|
|
21457
21457
|
}
|
|
21458
|
+
/**
|
|
21459
|
+
* Thrown when a mutation's confirmation broadcast does not arrive within the
|
|
21460
|
+
* timeout. The server write may still have landed — callers can re-read state
|
|
21461
|
+
* to confirm. Distinct from server-rejection errors (PERMISSION_DENIED,
|
|
21462
|
+
* VALIDATION_ERROR, …), which reject with their own message and must not be
|
|
21463
|
+
* treated as a missing confirmation.
|
|
21464
|
+
*/
|
|
21465
|
+
var ServerConfirmationTimeoutError = class extends Error {
|
|
21466
|
+
constructor(message = "Timed out waiting for server confirmation") {
|
|
21467
|
+
super(message);
|
|
21468
|
+
this.name = "ServerConfirmationTimeoutError";
|
|
21469
|
+
}
|
|
21470
|
+
};
|
|
21458
21471
|
var WebSocketClient = class WebSocketClient {
|
|
21459
21472
|
ws = null;
|
|
21460
21473
|
baseUrl;
|
|
@@ -22031,7 +22044,7 @@ var WebSocketClient = class WebSocketClient {
|
|
|
22031
22044
|
reject,
|
|
22032
22045
|
timeout: setTimeout(() => {
|
|
22033
22046
|
this.removeWaiter(waiter);
|
|
22034
|
-
reject(
|
|
22047
|
+
reject(new ServerConfirmationTimeoutError());
|
|
22035
22048
|
}, timeoutMs)
|
|
22036
22049
|
};
|
|
22037
22050
|
this.mutationWaiters.push(waiter);
|
|
@@ -24476,7 +24489,7 @@ async function executeAssets(parsed, deps = defaultDeps$6) {
|
|
|
24476
24489
|
const assetId = parsed.positionals[1];
|
|
24477
24490
|
const variantId = parsed.positionals[2] || normalizeOption(parsed.options.variant);
|
|
24478
24491
|
if (!assetId || !variantId) throw new Error("Usage: makefx assets set-active <asset-id> <variant-id>");
|
|
24479
|
-
const asset = await
|
|
24492
|
+
const asset = await setActiveVariant(ctx, deps, assetId, variantId);
|
|
24480
24493
|
deps.print(`Set active variant of asset ${assetId} to ${asset.active_variant_id}`);
|
|
24481
24494
|
return {
|
|
24482
24495
|
type: "set-active",
|
|
@@ -24511,6 +24524,16 @@ async function listAssets$1(ctx, deps) {
|
|
|
24511
24524
|
async function getAssetDetails(ctx, deps, assetId) {
|
|
24512
24525
|
return fetchJson(ctx, deps, `/api/spaces/${ctx.spaceId}/assets/${assetId}`);
|
|
24513
24526
|
}
|
|
24527
|
+
async function setActiveVariant(ctx, deps, assetId, variantId) {
|
|
24528
|
+
try {
|
|
24529
|
+
return await withAssetClient(ctx, deps, (client) => client.setActiveVariant(assetId, variantId));
|
|
24530
|
+
} catch (error) {
|
|
24531
|
+
if (!(error instanceof ServerConfirmationTimeoutError)) throw error;
|
|
24532
|
+
const { asset } = await getAssetDetails(ctx, deps, assetId);
|
|
24533
|
+
if (asset.active_variant_id === variantId) return asset;
|
|
24534
|
+
throw error;
|
|
24535
|
+
}
|
|
24536
|
+
}
|
|
24514
24537
|
async function fetchJson(ctx, deps, apiPath) {
|
|
24515
24538
|
const response = await deps.fetch(`${ctx.baseUrl}${apiPath}`, { headers: {
|
|
24516
24539
|
"Authorization": `Bearer ${ctx.accessToken}`,
|
|
@@ -26247,7 +26270,7 @@ Options:
|
|
|
26247
26270
|
}
|
|
26248
26271
|
//#endregion
|
|
26249
26272
|
//#region src/cli/index.ts
|
|
26250
|
-
var CLI_VERSION = "0.2.
|
|
26273
|
+
var CLI_VERSION = "0.2.5+fc579b35cabc";
|
|
26251
26274
|
async function main() {
|
|
26252
26275
|
const argv = process$1.argv.slice(2);
|
|
26253
26276
|
if (argv[0] === "--") argv.shift();
|