@riverbankcms/sdk 0.70.2 → 0.70.3
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 +29 -0
- package/dist/_dts/sdk/src/cli/commands/delete.d.ts +3 -0
- package/dist/_dts/sdk/src/cli/commands/style.d.ts +18 -0
- package/dist/_dts/sdk/src/cli/helpers.d.ts +8 -33
- package/dist/_dts/sdk/src/cli/site-commands/oneOffCommands.d.ts +81 -0
- package/dist/_dts/sdk/src/components.d.ts +2 -1
- package/dist/_dts/sdk/src/next/types.d.ts +4 -2
- package/dist/_dts/sdk/src/rendering/index.d.ts +2 -1
- package/dist/_dts/sdk/src/rendering/overrideResolution.d.ts +10 -0
- package/dist/_dts/sdk/src/rendering/overrides.d.ts +12 -0
- package/dist/_dts/sdk/src/version.d.ts +1 -1
- package/dist/cli/index.mjs +678 -100
- package/dist/client/client.mjs +201 -201
- package/dist/client/rendering.mjs +25412 -25402
- package/dist/preview-next/client/runtime.mjs +8 -1
- package/dist/server/components.mjs +10 -0
- package/dist/server/index.mjs +1 -1
- package/dist/server/next.mjs +82 -3
- package/dist/server/prebuild.mjs +1 -1
- package/dist/server/rendering.mjs +10 -0
- package/dist/server/server.mjs +1 -1
- package/package.json +4 -3
package/dist/cli/index.mjs
CHANGED
|
@@ -3402,7 +3402,10 @@ var init_soft_pill = __esm({
|
|
|
3402
3402
|
});
|
|
3403
3403
|
|
|
3404
3404
|
// ../theme-core/src/buttons/personalities/index.ts
|
|
3405
|
-
|
|
3405
|
+
function findButtonPersonality(id) {
|
|
3406
|
+
return personalitiesById.get(id);
|
|
3407
|
+
}
|
|
3408
|
+
var buttonPersonalities, personalitiesById;
|
|
3406
3409
|
var init_personalities = __esm({
|
|
3407
3410
|
"../theme-core/src/buttons/personalities/index.ts"() {
|
|
3408
3411
|
init_brushed_wash();
|
|
@@ -3422,7 +3425,7 @@ var init_personalities = __esm({
|
|
|
3422
3425
|
brushedWash,
|
|
3423
3426
|
showtimePill
|
|
3424
3427
|
];
|
|
3425
|
-
new Map(
|
|
3428
|
+
personalitiesById = new Map(
|
|
3426
3429
|
buttonPersonalities.map((p) => [p.id, p])
|
|
3427
3430
|
);
|
|
3428
3431
|
}
|
|
@@ -5115,7 +5118,10 @@ var init_warm_neutral = __esm({
|
|
|
5115
5118
|
});
|
|
5116
5119
|
|
|
5117
5120
|
// ../theme-core/src/palette/variants/index.ts
|
|
5118
|
-
|
|
5121
|
+
function findPaletteVariant(id) {
|
|
5122
|
+
return paletteVariantsById.get(id);
|
|
5123
|
+
}
|
|
5124
|
+
var paletteVariants, paletteVariantsById;
|
|
5119
5125
|
var init_variants = __esm({
|
|
5120
5126
|
"../theme-core/src/palette/variants/index.ts"() {
|
|
5121
5127
|
init_brand_led();
|
|
@@ -5142,7 +5148,7 @@ var init_variants = __esm({
|
|
|
5142
5148
|
softNaturalStone,
|
|
5143
5149
|
softNaturalWatercolor
|
|
5144
5150
|
];
|
|
5145
|
-
new Map(
|
|
5151
|
+
paletteVariantsById = new Map(
|
|
5146
5152
|
paletteVariants.map((v) => [v.id, v])
|
|
5147
5153
|
);
|
|
5148
5154
|
}
|
|
@@ -5407,7 +5413,10 @@ function floatingGlassHeader(theme) {
|
|
|
5407
5413
|
}
|
|
5408
5414
|
};
|
|
5409
5415
|
}
|
|
5410
|
-
|
|
5416
|
+
function findHeaderLook(id) {
|
|
5417
|
+
return headerLooksById.get(id);
|
|
5418
|
+
}
|
|
5419
|
+
var headerLookCatalog, headerLooksById;
|
|
5411
5420
|
var init_headerLooks = __esm({
|
|
5412
5421
|
"../theme-core/src/site-styles/headerLooks.ts"() {
|
|
5413
5422
|
init_headerCtaVariants();
|
|
@@ -5487,7 +5496,7 @@ var init_headerLooks = __esm({
|
|
|
5487
5496
|
compile: floatingGlassHeader
|
|
5488
5497
|
}
|
|
5489
5498
|
];
|
|
5490
|
-
new Map(
|
|
5499
|
+
headerLooksById = new Map(
|
|
5491
5500
|
headerLookCatalog.map((look) => [look.id, look])
|
|
5492
5501
|
);
|
|
5493
5502
|
}
|
|
@@ -5556,7 +5565,10 @@ function brandTwoBandFooter(theme) {
|
|
|
5556
5565
|
}
|
|
5557
5566
|
};
|
|
5558
5567
|
}
|
|
5559
|
-
|
|
5568
|
+
function findFooterLook(id) {
|
|
5569
|
+
return footerLooksById.get(id);
|
|
5570
|
+
}
|
|
5571
|
+
var footerLookCatalog, footerLooksById;
|
|
5560
5572
|
var init_footerLooks = __esm({
|
|
5561
5573
|
"../theme-core/src/site-styles/footerLooks.ts"() {
|
|
5562
5574
|
init_customizableSurfaces();
|
|
@@ -5575,7 +5587,7 @@ var init_footerLooks = __esm({
|
|
|
5575
5587
|
compile: brandTwoBandFooter
|
|
5576
5588
|
}
|
|
5577
5589
|
];
|
|
5578
|
-
new Map(
|
|
5590
|
+
footerLooksById = new Map(
|
|
5579
5591
|
footerLookCatalog.map((look) => [look.id, look])
|
|
5580
5592
|
);
|
|
5581
5593
|
}
|
|
@@ -37529,14 +37541,14 @@ function createCommandContext(command) {
|
|
|
37529
37541
|
"This command does not support --env=both. Use --env=local or --env=remote."
|
|
37530
37542
|
);
|
|
37531
37543
|
}
|
|
37532
|
-
const
|
|
37533
|
-
const env = loadEnvironment(
|
|
37544
|
+
const targetEnv = envTargets[0] ?? "local";
|
|
37545
|
+
const env = loadEnvironment(targetEnv === "remote");
|
|
37534
37546
|
const client = createManagementClient({
|
|
37535
37547
|
dashboardUrl: env.dashboardUrl,
|
|
37536
37548
|
managementApiKey: env.managementApiKey,
|
|
37537
37549
|
siteId: env.siteId
|
|
37538
37550
|
});
|
|
37539
|
-
return { output, client, isRemote, isJsonOutput, envTargets };
|
|
37551
|
+
return { output, client, isRemote, isJsonOutput, targetEnv, siteId: env.siteId, envTargets };
|
|
37540
37552
|
}
|
|
37541
37553
|
function getOutputContext(command) {
|
|
37542
37554
|
const globalOpts = command.optsWithGlobals();
|
|
@@ -37582,6 +37594,14 @@ function withErrorHandling(action) {
|
|
|
37582
37594
|
}
|
|
37583
37595
|
};
|
|
37584
37596
|
}
|
|
37597
|
+
function withCommandContext(action) {
|
|
37598
|
+
return withErrorHandling(async (...allArgs) => {
|
|
37599
|
+
const command = allArgs[allArgs.length - 1];
|
|
37600
|
+
const actionArgs = allArgs.slice(0, -1);
|
|
37601
|
+
const ctx = createCommandContext(command);
|
|
37602
|
+
await action(ctx, ...actionArgs);
|
|
37603
|
+
});
|
|
37604
|
+
}
|
|
37585
37605
|
function withConfirmation(getMessage, action) {
|
|
37586
37606
|
return async (...allArgs) => {
|
|
37587
37607
|
const command = allArgs[allArgs.length - 1];
|
|
@@ -37616,40 +37636,6 @@ function withConfirmation(getMessage, action) {
|
|
|
37616
37636
|
function capitalize(str) {
|
|
37617
37637
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
37618
37638
|
}
|
|
37619
|
-
function createPublishCommand(config2) {
|
|
37620
|
-
const cmd = new Command("publish").description(`Publish a ${config2.resourceName}`);
|
|
37621
|
-
for (const arg of config2.args) {
|
|
37622
|
-
cmd.argument(`<${arg}>`, `${capitalize(arg.replace("-", " "))}`);
|
|
37623
|
-
}
|
|
37624
|
-
return cmd.action(
|
|
37625
|
-
withErrorHandling(async (...actionArgs) => {
|
|
37626
|
-
const args = actionArgs.slice(0, config2.args.length);
|
|
37627
|
-
const command = actionArgs[actionArgs.length - 1];
|
|
37628
|
-
const { output, client } = createCommandContext(command);
|
|
37629
|
-
const label = args.join("/");
|
|
37630
|
-
output.info(`Publishing ${config2.resourceName}: ${label}`);
|
|
37631
|
-
await config2.action(client, ...args);
|
|
37632
|
-
output.success(`${capitalize(config2.resourceName)} published: ${label}`);
|
|
37633
|
-
})
|
|
37634
|
-
);
|
|
37635
|
-
}
|
|
37636
|
-
function createUnpublishCommand(config2) {
|
|
37637
|
-
const cmd = new Command("unpublish").description(`Unpublish a ${config2.resourceName}`);
|
|
37638
|
-
for (const arg of config2.args) {
|
|
37639
|
-
cmd.argument(`<${arg}>`, `${capitalize(arg.replace("-", " "))}`);
|
|
37640
|
-
}
|
|
37641
|
-
return cmd.action(
|
|
37642
|
-
withErrorHandling(async (...actionArgs) => {
|
|
37643
|
-
const args = actionArgs.slice(0, config2.args.length);
|
|
37644
|
-
const command = actionArgs[actionArgs.length - 1];
|
|
37645
|
-
const { output, client } = createCommandContext(command);
|
|
37646
|
-
const label = args.join("/");
|
|
37647
|
-
output.info(`Unpublishing ${config2.resourceName}: ${label}`);
|
|
37648
|
-
await config2.action(client, ...args);
|
|
37649
|
-
output.success(`${capitalize(config2.resourceName)} unpublished: ${label}`);
|
|
37650
|
-
})
|
|
37651
|
-
);
|
|
37652
|
-
}
|
|
37653
37639
|
function createGetCommand(config2) {
|
|
37654
37640
|
const cmd = new Command("get").description(`Get a single ${config2.resourceName}`);
|
|
37655
37641
|
for (const arg of config2.args) {
|
|
@@ -52226,6 +52212,403 @@ function reportMediaValidationWarningsAndCollectBlocking(output, validation) {
|
|
|
52226
52212
|
return validation.diagnostics.filter((diagnostic) => diagnostic.severity === "error").map((diagnostic) => formatMediaGuardDiagnostic(diagnostic));
|
|
52227
52213
|
}
|
|
52228
52214
|
|
|
52215
|
+
// src/cli/site-commands/oneOffCommands.ts
|
|
52216
|
+
init_src();
|
|
52217
|
+
function compileOneOffEntryCommand(input) {
|
|
52218
|
+
const commandBinding2 = oneOffEntryCommandBinding(input.mutation);
|
|
52219
|
+
return planCliCommandBatchForBindings({
|
|
52220
|
+
source: input.source,
|
|
52221
|
+
siteId: input.siteId,
|
|
52222
|
+
targetEnv: input.targetEnv,
|
|
52223
|
+
commandTypes: entrySiteCommandTypes,
|
|
52224
|
+
commandBindings: [commandBinding2]
|
|
52225
|
+
});
|
|
52226
|
+
}
|
|
52227
|
+
function compileOneOffPageCommand(input) {
|
|
52228
|
+
const commandBinding2 = oneOffPageCommandBinding(input.mutation);
|
|
52229
|
+
return planCliCommandBatchForBindings({
|
|
52230
|
+
source: input.source,
|
|
52231
|
+
siteId: input.siteId,
|
|
52232
|
+
targetEnv: input.targetEnv,
|
|
52233
|
+
commandTypes: pageSiteCommandTypes,
|
|
52234
|
+
commandBindings: [commandBinding2]
|
|
52235
|
+
});
|
|
52236
|
+
}
|
|
52237
|
+
function compileOneOffBlockCommand(input) {
|
|
52238
|
+
const commandBinding2 = oneOffBlockCommandBinding(input.mutation);
|
|
52239
|
+
return planCliCommandBatchForBindings({
|
|
52240
|
+
source: input.source,
|
|
52241
|
+
siteId: input.siteId,
|
|
52242
|
+
targetEnv: input.targetEnv,
|
|
52243
|
+
commandTypes: pageSiteCommandTypes,
|
|
52244
|
+
commandBindings: [commandBinding2]
|
|
52245
|
+
});
|
|
52246
|
+
}
|
|
52247
|
+
function compileOneOffNavigationCommand(input) {
|
|
52248
|
+
const commandBinding2 = oneOffNavigationCommandBinding(input.mutation);
|
|
52249
|
+
return planCliCommandBatchForBindings({
|
|
52250
|
+
source: input.source,
|
|
52251
|
+
siteId: input.siteId,
|
|
52252
|
+
targetEnv: input.targetEnv,
|
|
52253
|
+
commandTypes: navigationSiteCommandTypes,
|
|
52254
|
+
commandBindings: [commandBinding2]
|
|
52255
|
+
});
|
|
52256
|
+
}
|
|
52257
|
+
async function executeOneOffEntryCommand(input) {
|
|
52258
|
+
const plannedCommand = singlePlannedCommand(input.compiledPlan.plan.commands);
|
|
52259
|
+
return input.apply(plannedCommand.command, input.client);
|
|
52260
|
+
}
|
|
52261
|
+
async function executeOneOffPageCommand(input) {
|
|
52262
|
+
const plannedCommand = singlePlannedCommand(input.compiledPlan.plan.commands);
|
|
52263
|
+
return input.apply(plannedCommand.command, input.client);
|
|
52264
|
+
}
|
|
52265
|
+
async function executeOneOffNavigationCommand(input) {
|
|
52266
|
+
const plannedCommand = singlePlannedCommand(input.compiledPlan.plan.commands);
|
|
52267
|
+
return input.apply(plannedCommand.command, input.client);
|
|
52268
|
+
}
|
|
52269
|
+
async function applyOneOffEntryCommand(command, client) {
|
|
52270
|
+
switch (command.type) {
|
|
52271
|
+
case "upsertContentEntry":
|
|
52272
|
+
return client.entries.upsert({
|
|
52273
|
+
identifier: entryIdentifierForCommand(command),
|
|
52274
|
+
contentType: command.input.contentTypeKey,
|
|
52275
|
+
data: command.input.data ?? {},
|
|
52276
|
+
slug: command.input.slug
|
|
52277
|
+
});
|
|
52278
|
+
case "publishContentEntry":
|
|
52279
|
+
await client.entries.publish(
|
|
52280
|
+
command.input.contentTypeKey,
|
|
52281
|
+
entryIdentifierForCommand(command)
|
|
52282
|
+
);
|
|
52283
|
+
return;
|
|
52284
|
+
case "unpublishContentEntry":
|
|
52285
|
+
await client.entries.unpublish(
|
|
52286
|
+
command.input.contentTypeKey,
|
|
52287
|
+
entryIdentifierForCommand(command)
|
|
52288
|
+
);
|
|
52289
|
+
return;
|
|
52290
|
+
case "deleteContentEntry":
|
|
52291
|
+
await client.entries.delete(
|
|
52292
|
+
command.input.contentTypeKey,
|
|
52293
|
+
entryIdentifierForCommand(command)
|
|
52294
|
+
);
|
|
52295
|
+
return;
|
|
52296
|
+
default:
|
|
52297
|
+
assertNever(command);
|
|
52298
|
+
}
|
|
52299
|
+
}
|
|
52300
|
+
async function applyOneOffEntryCommandReturningEntry(command, client) {
|
|
52301
|
+
const result = await applyOneOffEntryCommand(command, client);
|
|
52302
|
+
if (!result) {
|
|
52303
|
+
throw new Error("Entry upsert completed without returning an entry.");
|
|
52304
|
+
}
|
|
52305
|
+
return result;
|
|
52306
|
+
}
|
|
52307
|
+
async function applyOneOffPageCommand(command, client) {
|
|
52308
|
+
switch (command.type) {
|
|
52309
|
+
case "upsertPage":
|
|
52310
|
+
return client.pages.upsert({
|
|
52311
|
+
identifier: pageIdentifierForCommand(command),
|
|
52312
|
+
title: command.input.title,
|
|
52313
|
+
path: pagePathForCommand(command),
|
|
52314
|
+
seoTitle: command.input.seoTitle,
|
|
52315
|
+
seoDescription: command.input.seoDescription
|
|
52316
|
+
});
|
|
52317
|
+
case "publishPage":
|
|
52318
|
+
await client.pages.publish(pageIdentifierForCommand(command));
|
|
52319
|
+
return;
|
|
52320
|
+
case "unpublishPage":
|
|
52321
|
+
await client.pages.unpublish(pageIdentifierForCommand(command));
|
|
52322
|
+
return;
|
|
52323
|
+
case "upsertPageBlock":
|
|
52324
|
+
return client.blocks.upsert(pageIdentifierForBlockCommand(command), {
|
|
52325
|
+
identifier: blockIdentifierForCommand(command),
|
|
52326
|
+
kind: command.input.type,
|
|
52327
|
+
data: command.input.props ?? {}
|
|
52328
|
+
});
|
|
52329
|
+
case "reorderPageBlocks":
|
|
52330
|
+
await client.blocks.reorder(
|
|
52331
|
+
pageIdentifierForBlockCommand(command),
|
|
52332
|
+
[...blockOrderIdentifiersForCommand(command)]
|
|
52333
|
+
);
|
|
52334
|
+
return;
|
|
52335
|
+
case "deletePageBlock":
|
|
52336
|
+
await client.blocks.delete(
|
|
52337
|
+
pageIdentifierForBlockCommand(command),
|
|
52338
|
+
blockIdentifierForCommand(command)
|
|
52339
|
+
);
|
|
52340
|
+
return;
|
|
52341
|
+
default:
|
|
52342
|
+
assertNever(command);
|
|
52343
|
+
}
|
|
52344
|
+
}
|
|
52345
|
+
async function applyOneOffPageCommandReturningPage(command, client) {
|
|
52346
|
+
const result = await applyOneOffPageCommand(command, client);
|
|
52347
|
+
if (!result || !isManagementPage(result)) {
|
|
52348
|
+
throw new Error("Page upsert completed without returning a page.");
|
|
52349
|
+
}
|
|
52350
|
+
return result;
|
|
52351
|
+
}
|
|
52352
|
+
async function applyOneOffPageCommandReturningBlock(command, client) {
|
|
52353
|
+
const result = await applyOneOffPageCommand(command, client);
|
|
52354
|
+
if (!result || !isManagementBlock(result)) {
|
|
52355
|
+
throw new Error("Block upsert completed without returning a block.");
|
|
52356
|
+
}
|
|
52357
|
+
return result;
|
|
52358
|
+
}
|
|
52359
|
+
async function applyOneOffNavigationCommand(command, client) {
|
|
52360
|
+
const role = navigationCommandRole2(command);
|
|
52361
|
+
return client.navigation.upsert({
|
|
52362
|
+
name: navigationCommandMenuName2(command),
|
|
52363
|
+
items: command.input.items.map(navigationItemInput2),
|
|
52364
|
+
...role === "primary" ? { isPrimary: true } : {},
|
|
52365
|
+
...role === "footer" ? { isFooter: true } : {}
|
|
52366
|
+
});
|
|
52367
|
+
}
|
|
52368
|
+
function oneOffEntryCommandBinding(mutation) {
|
|
52369
|
+
const contentType = asCliContentTypeKey(mutation.contentType);
|
|
52370
|
+
const identifier = asCliEntryIdentifier(mutation.identifier);
|
|
52371
|
+
switch (mutation.kind) {
|
|
52372
|
+
case "upsert": {
|
|
52373
|
+
const title = titleFromEntryData(mutation.data);
|
|
52374
|
+
const command = {
|
|
52375
|
+
type: "upsertContentEntry",
|
|
52376
|
+
ref: createContentEntryRef([contentType, identifier]),
|
|
52377
|
+
input: {
|
|
52378
|
+
identifier,
|
|
52379
|
+
contentTypeKey: contentType,
|
|
52380
|
+
...mutation.slug ? { slug: mutation.slug } : {},
|
|
52381
|
+
...title ? { title } : {},
|
|
52382
|
+
data: mutation.data
|
|
52383
|
+
}
|
|
52384
|
+
};
|
|
52385
|
+
return {
|
|
52386
|
+
command,
|
|
52387
|
+
reportSubject: { contentType, identifier, counter: "updated" }
|
|
52388
|
+
};
|
|
52389
|
+
}
|
|
52390
|
+
case "publish": {
|
|
52391
|
+
const command = {
|
|
52392
|
+
type: "publishContentEntry",
|
|
52393
|
+
ref: createCommandRef("publish", [contentType, identifier]),
|
|
52394
|
+
input: { contentTypeKey: contentType, identifier }
|
|
52395
|
+
};
|
|
52396
|
+
return {
|
|
52397
|
+
command,
|
|
52398
|
+
reportSubject: { contentType, identifier, counter: "published" }
|
|
52399
|
+
};
|
|
52400
|
+
}
|
|
52401
|
+
case "unpublish": {
|
|
52402
|
+
const command = {
|
|
52403
|
+
type: "unpublishContentEntry",
|
|
52404
|
+
ref: createCommandRef("unpublish", [contentType, identifier]),
|
|
52405
|
+
input: { contentTypeKey: contentType, identifier }
|
|
52406
|
+
};
|
|
52407
|
+
return {
|
|
52408
|
+
command,
|
|
52409
|
+
reportSubject: { contentType, identifier, counter: "unpublished" }
|
|
52410
|
+
};
|
|
52411
|
+
}
|
|
52412
|
+
default:
|
|
52413
|
+
assertNever(mutation);
|
|
52414
|
+
}
|
|
52415
|
+
}
|
|
52416
|
+
function oneOffPageCommandBinding(mutation) {
|
|
52417
|
+
const identifier = asCliPageIdentifier(mutation.identifier);
|
|
52418
|
+
switch (mutation.kind) {
|
|
52419
|
+
case "upsert": {
|
|
52420
|
+
const command = {
|
|
52421
|
+
type: "upsertPage",
|
|
52422
|
+
ref: createPageRef([identifier]),
|
|
52423
|
+
input: {
|
|
52424
|
+
identifier,
|
|
52425
|
+
slug: identifier,
|
|
52426
|
+
title: mutation.title,
|
|
52427
|
+
path: mutation.path,
|
|
52428
|
+
...mutation.seoTitle ? { seoTitle: mutation.seoTitle } : {},
|
|
52429
|
+
...mutation.seoDescription ? { seoDescription: mutation.seoDescription } : {}
|
|
52430
|
+
}
|
|
52431
|
+
};
|
|
52432
|
+
return {
|
|
52433
|
+
command,
|
|
52434
|
+
reportSubject: { resource: "page", identifier, counter: "updated" }
|
|
52435
|
+
};
|
|
52436
|
+
}
|
|
52437
|
+
case "publish": {
|
|
52438
|
+
const command = {
|
|
52439
|
+
type: "publishPage",
|
|
52440
|
+
ref: createCommandRef("publish-page", [identifier]),
|
|
52441
|
+
input: { identifier }
|
|
52442
|
+
};
|
|
52443
|
+
return {
|
|
52444
|
+
command,
|
|
52445
|
+
reportSubject: { resource: "page", identifier, counter: "published" }
|
|
52446
|
+
};
|
|
52447
|
+
}
|
|
52448
|
+
case "unpublish": {
|
|
52449
|
+
const command = {
|
|
52450
|
+
type: "unpublishPage",
|
|
52451
|
+
ref: createCommandRef("unpublish-page", [identifier]),
|
|
52452
|
+
input: { identifier }
|
|
52453
|
+
};
|
|
52454
|
+
return {
|
|
52455
|
+
command,
|
|
52456
|
+
reportSubject: { resource: "page", identifier, counter: "unpublished" }
|
|
52457
|
+
};
|
|
52458
|
+
}
|
|
52459
|
+
default:
|
|
52460
|
+
assertNever(mutation);
|
|
52461
|
+
}
|
|
52462
|
+
}
|
|
52463
|
+
function oneOffBlockCommandBinding(mutation) {
|
|
52464
|
+
const pageIdentifier = asCliPageIdentifier(mutation.pageIdentifier);
|
|
52465
|
+
switch (mutation.kind) {
|
|
52466
|
+
case "upsert": {
|
|
52467
|
+
const identifier = asCliBlockIdentifier(mutation.blockIdentifier);
|
|
52468
|
+
const command = {
|
|
52469
|
+
type: "upsertPageBlock",
|
|
52470
|
+
ref: createBlockRef([pageIdentifier, identifier]),
|
|
52471
|
+
input: {
|
|
52472
|
+
pageIdentifier,
|
|
52473
|
+
identifier,
|
|
52474
|
+
type: mutation.blockKind,
|
|
52475
|
+
props: mutation.data
|
|
52476
|
+
}
|
|
52477
|
+
};
|
|
52478
|
+
return {
|
|
52479
|
+
command,
|
|
52480
|
+
reportSubject: {
|
|
52481
|
+
resource: "block",
|
|
52482
|
+
pageIdentifier,
|
|
52483
|
+
identifier,
|
|
52484
|
+
counter: "updated"
|
|
52485
|
+
}
|
|
52486
|
+
};
|
|
52487
|
+
}
|
|
52488
|
+
case "reorder": {
|
|
52489
|
+
const identifiers = mutation.blockIdentifiers.map(asCliBlockIdentifier);
|
|
52490
|
+
const command = {
|
|
52491
|
+
type: "reorderPageBlocks",
|
|
52492
|
+
ref: createBlocksRef([pageIdentifier]),
|
|
52493
|
+
input: {
|
|
52494
|
+
pageIdentifier,
|
|
52495
|
+
blocks: identifiers.map((identifier) => ({
|
|
52496
|
+
blockRef: createBlockRef([pageIdentifier, identifier]),
|
|
52497
|
+
identifier
|
|
52498
|
+
}))
|
|
52499
|
+
}
|
|
52500
|
+
};
|
|
52501
|
+
return {
|
|
52502
|
+
command,
|
|
52503
|
+
reportSubject: {
|
|
52504
|
+
resource: "block",
|
|
52505
|
+
pageIdentifier,
|
|
52506
|
+
identifier: pageIdentifier,
|
|
52507
|
+
counter: "reordered"
|
|
52508
|
+
}
|
|
52509
|
+
};
|
|
52510
|
+
}
|
|
52511
|
+
default:
|
|
52512
|
+
assertNever(mutation);
|
|
52513
|
+
}
|
|
52514
|
+
}
|
|
52515
|
+
function oneOffNavigationCommandBinding(mutation) {
|
|
52516
|
+
const name = asCliNavigationMenuName(mutation.menuName);
|
|
52517
|
+
const command = {
|
|
52518
|
+
type: "upsertNavigationMenu",
|
|
52519
|
+
ref: createNavigationRef([name]),
|
|
52520
|
+
input: {
|
|
52521
|
+
name,
|
|
52522
|
+
items: mutation.items.map(navigationItemForCommand2)
|
|
52523
|
+
}
|
|
52524
|
+
};
|
|
52525
|
+
return {
|
|
52526
|
+
command,
|
|
52527
|
+
reportSubject: { name, counter: "updated" }
|
|
52528
|
+
};
|
|
52529
|
+
}
|
|
52530
|
+
function navigationItemForCommand2(item) {
|
|
52531
|
+
return {
|
|
52532
|
+
label: item.label,
|
|
52533
|
+
...item.isCta ? { isCta: true } : {},
|
|
52534
|
+
...item.link ? { link: navigationLinkForCommand(item.link) } : {},
|
|
52535
|
+
...item.children ? { children: item.children.map(navigationItemForCommand2) } : {}
|
|
52536
|
+
};
|
|
52537
|
+
}
|
|
52538
|
+
function navigationLinkForCommand(link2) {
|
|
52539
|
+
switch (link2.kind) {
|
|
52540
|
+
case "page":
|
|
52541
|
+
return { kind: "page", identifier: link2.identifier };
|
|
52542
|
+
case "entry":
|
|
52543
|
+
return {
|
|
52544
|
+
kind: "entry",
|
|
52545
|
+
contentType: link2.contentType,
|
|
52546
|
+
identifier: link2.identifier
|
|
52547
|
+
};
|
|
52548
|
+
case "external":
|
|
52549
|
+
return { kind: "external", href: link2.href };
|
|
52550
|
+
case "url":
|
|
52551
|
+
return { kind: "url", href: link2.href };
|
|
52552
|
+
case "portal":
|
|
52553
|
+
return {
|
|
52554
|
+
kind: "portal",
|
|
52555
|
+
...link2.path ? { path: link2.path } : {},
|
|
52556
|
+
...link2.labels ? { labels: link2.labels } : {}
|
|
52557
|
+
};
|
|
52558
|
+
case "cart":
|
|
52559
|
+
return {
|
|
52560
|
+
kind: "cart",
|
|
52561
|
+
badge: link2.badge,
|
|
52562
|
+
label: link2.label
|
|
52563
|
+
};
|
|
52564
|
+
default:
|
|
52565
|
+
assertNever(link2);
|
|
52566
|
+
}
|
|
52567
|
+
}
|
|
52568
|
+
function navigationItemInput2(item) {
|
|
52569
|
+
return {
|
|
52570
|
+
label: item.label,
|
|
52571
|
+
...item.isCta ? { isCta: true } : {},
|
|
52572
|
+
...item.link ? { link: item.link } : {},
|
|
52573
|
+
...item.children ? { children: item.children.map(navigationItemInput2) } : {}
|
|
52574
|
+
};
|
|
52575
|
+
}
|
|
52576
|
+
function navigationCommandMenuName2(command) {
|
|
52577
|
+
const name = command.input.name ?? command.input.location;
|
|
52578
|
+
if (name) return name;
|
|
52579
|
+
throw new Error(`Invalid navigation command ${command.ref}: missing input.name or input.location.`);
|
|
52580
|
+
}
|
|
52581
|
+
function navigationCommandRole2(command) {
|
|
52582
|
+
if (command.input.role) return command.input.role;
|
|
52583
|
+
switch (command.input.location) {
|
|
52584
|
+
case "main":
|
|
52585
|
+
case "header":
|
|
52586
|
+
return "primary";
|
|
52587
|
+
case "footer":
|
|
52588
|
+
return "footer";
|
|
52589
|
+
case void 0:
|
|
52590
|
+
return void 0;
|
|
52591
|
+
default:
|
|
52592
|
+
return assertNever(command.input.location);
|
|
52593
|
+
}
|
|
52594
|
+
}
|
|
52595
|
+
function isManagementPage(value) {
|
|
52596
|
+
return "path" in value;
|
|
52597
|
+
}
|
|
52598
|
+
function isManagementBlock(value) {
|
|
52599
|
+
return "kind" in value;
|
|
52600
|
+
}
|
|
52601
|
+
function singlePlannedCommand(commands) {
|
|
52602
|
+
if (commands.length !== 1) {
|
|
52603
|
+
throw new Error(`Expected exactly one one-off site command, got ${commands.length}.`);
|
|
52604
|
+
}
|
|
52605
|
+
const plannedCommand = commands[0];
|
|
52606
|
+
if (!plannedCommand) {
|
|
52607
|
+
throw new Error("Expected one one-off site command, got none.");
|
|
52608
|
+
}
|
|
52609
|
+
return plannedCommand;
|
|
52610
|
+
}
|
|
52611
|
+
|
|
52229
52612
|
// src/cli/commands/entry.ts
|
|
52230
52613
|
var ENTRY_LIST_COLUMNS = [
|
|
52231
52614
|
"id",
|
|
@@ -52389,8 +52772,8 @@ async function validateEntryUpsertMedia(options) {
|
|
|
52389
52772
|
};
|
|
52390
52773
|
}
|
|
52391
52774
|
var upsertCommand = new Command("upsert").description("Create or update an entry").argument("<type>", "Content type").argument("<identifier>", "Entry identifier").option("--data <json>", "Entry data as JSON string").option("--file <path>", "Path to JSON file with entry data").option("--slug <slug>", "Entry slug (defaults to identifier)").action(
|
|
52392
|
-
|
|
52393
|
-
const { output, client } =
|
|
52775
|
+
withCommandContext(async (ctx, type, identifier, options) => {
|
|
52776
|
+
const { output, client, siteId, targetEnv } = ctx;
|
|
52394
52777
|
const data = await parseJsonData(options);
|
|
52395
52778
|
output.info(`Upserting entry: ${type}/${identifier}`);
|
|
52396
52779
|
const mediaValidation = await validateEntryUpsertMedia({
|
|
@@ -52406,11 +52789,25 @@ var upsertCommand = new Command("upsert").description("Create or update an entry
|
|
|
52406
52789
|
suggestion: "Resolve media identifiers on the CMS first, or remove invalid media references."
|
|
52407
52790
|
});
|
|
52408
52791
|
}
|
|
52409
|
-
const
|
|
52410
|
-
|
|
52411
|
-
|
|
52412
|
-
|
|
52413
|
-
|
|
52792
|
+
const compiled = compileOneOffEntryCommand({
|
|
52793
|
+
source: "one_off_entry",
|
|
52794
|
+
siteId,
|
|
52795
|
+
targetEnv,
|
|
52796
|
+
mutation: {
|
|
52797
|
+
kind: "upsert",
|
|
52798
|
+
contentType: type,
|
|
52799
|
+
identifier,
|
|
52800
|
+
data,
|
|
52801
|
+
...options.slug ? { slug: options.slug } : {}
|
|
52802
|
+
}
|
|
52803
|
+
});
|
|
52804
|
+
if (!compiled.ok) {
|
|
52805
|
+
return output.error(compiled.error.message);
|
|
52806
|
+
}
|
|
52807
|
+
const entry = await executeOneOffEntryCommand({
|
|
52808
|
+
compiledPlan: compiled.value,
|
|
52809
|
+
client,
|
|
52810
|
+
apply: applyOneOffEntryCommandReturningEntry
|
|
52414
52811
|
});
|
|
52415
52812
|
output.success(`Entry upserted: ${entry.identifier}`, {
|
|
52416
52813
|
id: entry.id,
|
|
@@ -52420,16 +52817,50 @@ var upsertCommand = new Command("upsert").description("Create or update an entry
|
|
|
52420
52817
|
});
|
|
52421
52818
|
})
|
|
52422
52819
|
);
|
|
52423
|
-
var publishCommand =
|
|
52424
|
-
|
|
52425
|
-
|
|
52426
|
-
|
|
52427
|
-
});
|
|
52428
|
-
|
|
52429
|
-
|
|
52430
|
-
|
|
52431
|
-
|
|
52432
|
-
}
|
|
52820
|
+
var publishCommand = new Command("publish").description("Publish a entry").argument("<type>", "Type").argument("<identifier>", "Identifier").action(
|
|
52821
|
+
withCommandContext(async (ctx, type, identifier) => {
|
|
52822
|
+
const { output, client, siteId, targetEnv } = ctx;
|
|
52823
|
+
const label = `${type}/${identifier}`;
|
|
52824
|
+
output.info(`Publishing entry: ${label}`);
|
|
52825
|
+
const compiled = compileOneOffEntryCommand({
|
|
52826
|
+
source: "one_off_entry",
|
|
52827
|
+
siteId,
|
|
52828
|
+
targetEnv,
|
|
52829
|
+
mutation: { kind: "publish", contentType: type, identifier }
|
|
52830
|
+
});
|
|
52831
|
+
if (!compiled.ok) {
|
|
52832
|
+
return output.error(compiled.error.message);
|
|
52833
|
+
}
|
|
52834
|
+
await executeOneOffEntryCommand({
|
|
52835
|
+
compiledPlan: compiled.value,
|
|
52836
|
+
client,
|
|
52837
|
+
apply: applyOneOffEntryCommand
|
|
52838
|
+
});
|
|
52839
|
+
output.success(`Entry published: ${label}`);
|
|
52840
|
+
})
|
|
52841
|
+
);
|
|
52842
|
+
var unpublishCommand = new Command("unpublish").description("Unpublish a entry").argument("<type>", "Type").argument("<identifier>", "Identifier").action(
|
|
52843
|
+
withCommandContext(async (ctx, type, identifier) => {
|
|
52844
|
+
const { output, client, siteId, targetEnv } = ctx;
|
|
52845
|
+
const label = `${type}/${identifier}`;
|
|
52846
|
+
output.info(`Unpublishing entry: ${label}`);
|
|
52847
|
+
const compiled = compileOneOffEntryCommand({
|
|
52848
|
+
source: "one_off_entry",
|
|
52849
|
+
siteId,
|
|
52850
|
+
targetEnv,
|
|
52851
|
+
mutation: { kind: "unpublish", contentType: type, identifier }
|
|
52852
|
+
});
|
|
52853
|
+
if (!compiled.ok) {
|
|
52854
|
+
return output.error(compiled.error.message);
|
|
52855
|
+
}
|
|
52856
|
+
await executeOneOffEntryCommand({
|
|
52857
|
+
compiledPlan: compiled.value,
|
|
52858
|
+
client,
|
|
52859
|
+
apply: applyOneOffEntryCommand
|
|
52860
|
+
});
|
|
52861
|
+
output.success(`Entry unpublished: ${label}`);
|
|
52862
|
+
})
|
|
52863
|
+
);
|
|
52433
52864
|
async function findEntryById(client, contentType, entryId, options = {}) {
|
|
52434
52865
|
const limit = options.limit ?? 20;
|
|
52435
52866
|
if (!Number.isFinite(limit) || limit <= 0) {
|
|
@@ -52564,15 +52995,29 @@ var formatPageRow = (page) => [
|
|
|
52564
52995
|
formatDateShort(page.updatedAt)
|
|
52565
52996
|
];
|
|
52566
52997
|
var upsertCommand2 = new Command("upsert").description("Create or update a page").argument("<identifier>", "Page identifier").requiredOption("--title <title>", "Page title").requiredOption("--path <path>", "Page path (e.g., /about)").option("--seo-title <title>", "SEO title").option("--seo-description <description>", "SEO description").action(
|
|
52567
|
-
|
|
52568
|
-
const { output, client } =
|
|
52998
|
+
withCommandContext(async (ctx, identifier, options) => {
|
|
52999
|
+
const { output, client, siteId, targetEnv } = ctx;
|
|
52569
53000
|
output.info(`Upserting page: ${identifier}`);
|
|
52570
|
-
const
|
|
52571
|
-
|
|
52572
|
-
|
|
52573
|
-
|
|
52574
|
-
|
|
52575
|
-
|
|
53001
|
+
const compiled = compileOneOffPageCommand({
|
|
53002
|
+
source: "one_off_page",
|
|
53003
|
+
siteId,
|
|
53004
|
+
targetEnv,
|
|
53005
|
+
mutation: {
|
|
53006
|
+
kind: "upsert",
|
|
53007
|
+
identifier,
|
|
53008
|
+
title: options.title,
|
|
53009
|
+
path: options.path,
|
|
53010
|
+
...options.seoTitle ? { seoTitle: options.seoTitle } : {},
|
|
53011
|
+
...options.seoDescription ? { seoDescription: options.seoDescription } : {}
|
|
53012
|
+
}
|
|
53013
|
+
});
|
|
53014
|
+
if (!compiled.ok) {
|
|
53015
|
+
return output.error(compiled.error.message);
|
|
53016
|
+
}
|
|
53017
|
+
const page = await executeOneOffPageCommand({
|
|
53018
|
+
compiledPlan: compiled.value,
|
|
53019
|
+
client,
|
|
53020
|
+
apply: applyOneOffPageCommandReturningPage
|
|
52576
53021
|
});
|
|
52577
53022
|
output.success(`Page upserted: ${page.identifier}`, {
|
|
52578
53023
|
id: page.id,
|
|
@@ -52582,16 +53027,48 @@ var upsertCommand2 = new Command("upsert").description("Create or update a page"
|
|
|
52582
53027
|
});
|
|
52583
53028
|
})
|
|
52584
53029
|
);
|
|
52585
|
-
var publishCommand2 =
|
|
52586
|
-
|
|
52587
|
-
|
|
52588
|
-
|
|
52589
|
-
|
|
52590
|
-
|
|
52591
|
-
|
|
52592
|
-
|
|
52593
|
-
|
|
52594
|
-
});
|
|
53030
|
+
var publishCommand2 = new Command("publish").description("Publish a page").argument("<identifier>", "Identifier").action(
|
|
53031
|
+
withCommandContext(async (ctx, identifier) => {
|
|
53032
|
+
const { output, client, siteId, targetEnv } = ctx;
|
|
53033
|
+
output.info(`Publishing page: ${identifier}`);
|
|
53034
|
+
const compiled = compileOneOffPageCommand({
|
|
53035
|
+
source: "one_off_page",
|
|
53036
|
+
siteId,
|
|
53037
|
+
targetEnv,
|
|
53038
|
+
mutation: { kind: "publish", identifier }
|
|
53039
|
+
});
|
|
53040
|
+
if (!compiled.ok) {
|
|
53041
|
+
return output.error(compiled.error.message);
|
|
53042
|
+
}
|
|
53043
|
+
await executeOneOffPageCommand({
|
|
53044
|
+
compiledPlan: compiled.value,
|
|
53045
|
+
client,
|
|
53046
|
+
apply: applyOneOffPageCommand
|
|
53047
|
+
});
|
|
53048
|
+
output.success(`Page published: ${identifier}`);
|
|
53049
|
+
})
|
|
53050
|
+
);
|
|
53051
|
+
var unpublishCommand2 = new Command("unpublish").description("Unpublish a page").argument("<identifier>", "Identifier").action(
|
|
53052
|
+
withCommandContext(async (ctx, identifier) => {
|
|
53053
|
+
const { output, client, siteId, targetEnv } = ctx;
|
|
53054
|
+
output.info(`Unpublishing page: ${identifier}`);
|
|
53055
|
+
const compiled = compileOneOffPageCommand({
|
|
53056
|
+
source: "one_off_page",
|
|
53057
|
+
siteId,
|
|
53058
|
+
targetEnv,
|
|
53059
|
+
mutation: { kind: "unpublish", identifier }
|
|
53060
|
+
});
|
|
53061
|
+
if (!compiled.ok) {
|
|
53062
|
+
return output.error(compiled.error.message);
|
|
53063
|
+
}
|
|
53064
|
+
await executeOneOffPageCommand({
|
|
53065
|
+
compiledPlan: compiled.value,
|
|
53066
|
+
client,
|
|
53067
|
+
apply: applyOneOffPageCommand
|
|
53068
|
+
});
|
|
53069
|
+
output.success(`Page unpublished: ${identifier}`);
|
|
53070
|
+
})
|
|
53071
|
+
);
|
|
52595
53072
|
var getCommand2 = createGetCommand({
|
|
52596
53073
|
resourceName: "page",
|
|
52597
53074
|
args: ["identifier"],
|
|
@@ -52653,9 +53130,9 @@ async function validateBlockUpsertMedia(options) {
|
|
|
52653
53130
|
};
|
|
52654
53131
|
}
|
|
52655
53132
|
var upsertCommand3 = new Command("upsert").description("Create or update a block on a page").argument("<page-identifier>", "Page identifier").argument("<block-identifier>", "Block identifier").requiredOption("--kind <kind>", "Block kind (e.g., block.hero, block.body-text)").option("--data <json>", "Block data as JSON string").option("--file <path>", "Path to JSON file with block data").option("--position <n>", "Block position (0-indexed)").action(
|
|
52656
|
-
|
|
52657
|
-
async (pageIdentifier, blockIdentifier, options
|
|
52658
|
-
const { output, client } =
|
|
53133
|
+
withCommandContext(
|
|
53134
|
+
async (ctx, pageIdentifier, blockIdentifier, options) => {
|
|
53135
|
+
const { output, client, siteId, targetEnv } = ctx;
|
|
52659
53136
|
const data = await parseJsonData(options);
|
|
52660
53137
|
output.info(`Upserting block: ${pageIdentifier}/${blockIdentifier}`);
|
|
52661
53138
|
const mediaValidation = await validateBlockUpsertMedia({
|
|
@@ -52672,12 +53149,37 @@ var upsertCommand3 = new Command("upsert").description("Create or update a block
|
|
|
52672
53149
|
suggestion: "Resolve media identifiers on the CMS first, or remove invalid media references."
|
|
52673
53150
|
});
|
|
52674
53151
|
}
|
|
52675
|
-
const
|
|
52676
|
-
|
|
52677
|
-
|
|
52678
|
-
|
|
52679
|
-
|
|
52680
|
-
|
|
53152
|
+
const position = options.position ? parseInt(options.position, 10) : void 0;
|
|
53153
|
+
let block;
|
|
53154
|
+
if (position !== void 0) {
|
|
53155
|
+
block = await client.blocks.upsert(pageIdentifier, {
|
|
53156
|
+
identifier: blockIdentifier,
|
|
53157
|
+
kind: options.kind,
|
|
53158
|
+
data,
|
|
53159
|
+
position
|
|
53160
|
+
});
|
|
53161
|
+
} else {
|
|
53162
|
+
const compiled = compileOneOffBlockCommand({
|
|
53163
|
+
source: "one_off_block",
|
|
53164
|
+
siteId,
|
|
53165
|
+
targetEnv,
|
|
53166
|
+
mutation: {
|
|
53167
|
+
kind: "upsert",
|
|
53168
|
+
pageIdentifier,
|
|
53169
|
+
blockIdentifier,
|
|
53170
|
+
blockKind: options.kind,
|
|
53171
|
+
data
|
|
53172
|
+
}
|
|
53173
|
+
});
|
|
53174
|
+
if (!compiled.ok) {
|
|
53175
|
+
return output.error(compiled.error.message);
|
|
53176
|
+
}
|
|
53177
|
+
block = await executeOneOffPageCommand({
|
|
53178
|
+
compiledPlan: compiled.value,
|
|
53179
|
+
client,
|
|
53180
|
+
apply: applyOneOffPageCommandReturningBlock
|
|
53181
|
+
});
|
|
53182
|
+
}
|
|
52681
53183
|
output.success(`Block upserted: ${block.identifier}`, {
|
|
52682
53184
|
id: block.id,
|
|
52683
53185
|
identifier: block.identifier,
|
|
@@ -52688,14 +53190,27 @@ var upsertCommand3 = new Command("upsert").description("Create or update a block
|
|
|
52688
53190
|
)
|
|
52689
53191
|
);
|
|
52690
53192
|
var reorderCommand = new Command("reorder").description("Reorder blocks on a page").argument("<page-identifier>", "Page identifier").argument("<identifiers...>", "Block identifiers in desired order").action(
|
|
52691
|
-
|
|
52692
|
-
async (pageIdentifier, identifiers
|
|
52693
|
-
const { output, client } =
|
|
53193
|
+
withCommandContext(
|
|
53194
|
+
async (ctx, pageIdentifier, identifiers) => {
|
|
53195
|
+
const { output, client, siteId, targetEnv } = ctx;
|
|
52694
53196
|
if (identifiers.length < 2) {
|
|
52695
53197
|
return output.error("At least 2 block identifiers are required for reordering");
|
|
52696
53198
|
}
|
|
52697
53199
|
output.info(`Reordering blocks on page: ${pageIdentifier}`);
|
|
52698
|
-
|
|
53200
|
+
const compiled = compileOneOffBlockCommand({
|
|
53201
|
+
source: "one_off_block",
|
|
53202
|
+
siteId,
|
|
53203
|
+
targetEnv,
|
|
53204
|
+
mutation: { kind: "reorder", pageIdentifier, blockIdentifiers: identifiers }
|
|
53205
|
+
});
|
|
53206
|
+
if (!compiled.ok) {
|
|
53207
|
+
return output.error(compiled.error.message);
|
|
53208
|
+
}
|
|
53209
|
+
await executeOneOffPageCommand({
|
|
53210
|
+
compiledPlan: compiled.value,
|
|
53211
|
+
client,
|
|
53212
|
+
apply: applyOneOffPageCommand
|
|
53213
|
+
});
|
|
52699
53214
|
output.success(`Blocks reordered`, {
|
|
52700
53215
|
page: pageIdentifier,
|
|
52701
53216
|
order: identifiers
|
|
@@ -52763,13 +53278,23 @@ function countItems(items) {
|
|
|
52763
53278
|
return count;
|
|
52764
53279
|
}
|
|
52765
53280
|
var upsertCommand4 = new Command("upsert").description("Create or update a navigation menu").argument("<menu-name>", "Navigation menu name").option("--file <path>", "Path to JSON file with menu items").option("--data <json>", "Menu items as JSON string").action(
|
|
52766
|
-
|
|
52767
|
-
const { output, client } =
|
|
53281
|
+
withCommandContext(async (ctx, menuName, options) => {
|
|
53282
|
+
const { output, client, siteId, targetEnv } = ctx;
|
|
52768
53283
|
const items = await parseJsonArray(options);
|
|
52769
53284
|
output.info(`Upserting navigation menu: ${menuName}`);
|
|
52770
|
-
const
|
|
52771
|
-
|
|
52772
|
-
|
|
53285
|
+
const compiled = compileOneOffNavigationCommand({
|
|
53286
|
+
source: "one_off_navigation",
|
|
53287
|
+
siteId,
|
|
53288
|
+
targetEnv,
|
|
53289
|
+
mutation: { kind: "upsert", menuName, items }
|
|
53290
|
+
});
|
|
53291
|
+
if (!compiled.ok) {
|
|
53292
|
+
return output.error(compiled.error.message);
|
|
53293
|
+
}
|
|
53294
|
+
const menu = await executeOneOffNavigationCommand({
|
|
53295
|
+
compiledPlan: compiled.value,
|
|
53296
|
+
client,
|
|
53297
|
+
apply: applyOneOffNavigationCommand
|
|
52773
53298
|
});
|
|
52774
53299
|
output.success(`Navigation menu upserted: ${menu.name}`, {
|
|
52775
53300
|
id: menu.id,
|
|
@@ -54249,7 +54774,7 @@ var SimpleCache = class {
|
|
|
54249
54774
|
};
|
|
54250
54775
|
|
|
54251
54776
|
// src/version.ts
|
|
54252
|
-
var SDK_VERSION = "0.70.
|
|
54777
|
+
var SDK_VERSION = "0.70.3";
|
|
54253
54778
|
|
|
54254
54779
|
// src/client/error.ts
|
|
54255
54780
|
var RiverbankApiError = class _RiverbankApiError extends Error {
|
|
@@ -60883,6 +61408,10 @@ Examples:
|
|
|
60883
61408
|
}
|
|
60884
61409
|
})
|
|
60885
61410
|
);
|
|
61411
|
+
|
|
61412
|
+
// src/cli/commands/style.ts
|
|
61413
|
+
init_buttons();
|
|
61414
|
+
init_site_styles();
|
|
60886
61415
|
function buildStyleSelectionApplyInputFromOptions(options) {
|
|
60887
61416
|
const baseSelectionVersion = Number(options.baseSelectionVersion);
|
|
60888
61417
|
if (!Number.isInteger(baseSelectionVersion) || baseSelectionVersion < 0) {
|
|
@@ -60915,6 +61444,55 @@ function isStringRecord(value) {
|
|
|
60915
61444
|
}
|
|
60916
61445
|
return Object.values(value).every((entry) => typeof entry === "string");
|
|
60917
61446
|
}
|
|
61447
|
+
function buildStyleCatalogListRows(styles = curatedSiteStyles, options = {}) {
|
|
61448
|
+
const filteredStyles = options.siteStyleId ? styles.filter((style) => String(style.id) === options.siteStyleId) : styles;
|
|
61449
|
+
return filteredStyles.map((style) => ({
|
|
61450
|
+
siteStyleId: style.id,
|
|
61451
|
+
name: style.name,
|
|
61452
|
+
palettes: style.paletteVariantChoices.map((choice) => ({
|
|
61453
|
+
id: choice.id,
|
|
61454
|
+
label: findPaletteVariant(choice.id)?.name ?? choice.id
|
|
61455
|
+
})),
|
|
61456
|
+
buttonPersonalities: style.buttonPersonalityChoices.map((choice) => ({
|
|
61457
|
+
id: choice.id,
|
|
61458
|
+
label: findButtonPersonality(choice.id)?.name ?? choice.id
|
|
61459
|
+
})),
|
|
61460
|
+
headerLooks: style.recommendedHeaderLookIds.map((lookId) => ({
|
|
61461
|
+
id: lookId,
|
|
61462
|
+
label: findHeaderLook(lookId)?.label ?? lookId
|
|
61463
|
+
})),
|
|
61464
|
+
footerLooks: style.recommendedFooterLookIds.map((lookId) => ({
|
|
61465
|
+
id: lookId,
|
|
61466
|
+
label: findFooterLook(lookId)?.label ?? lookId
|
|
61467
|
+
}))
|
|
61468
|
+
}));
|
|
61469
|
+
}
|
|
61470
|
+
function formatStyleCatalogListRow(row) {
|
|
61471
|
+
return [
|
|
61472
|
+
row.siteStyleId,
|
|
61473
|
+
row.name,
|
|
61474
|
+
formatChoiceList(row.palettes),
|
|
61475
|
+
formatChoiceList(row.buttonPersonalities),
|
|
61476
|
+
formatChoiceList(row.headerLooks),
|
|
61477
|
+
formatChoiceList(row.footerLooks)
|
|
61478
|
+
];
|
|
61479
|
+
}
|
|
61480
|
+
function formatChoiceList(choices) {
|
|
61481
|
+
return choices.map((choice) => `${choice.id} (${choice.label})`).join(", ");
|
|
61482
|
+
}
|
|
61483
|
+
var listCommand8 = new Command("list").description("List curated site styles and compatible selection IDs").option("--site-style-id <id>", "Show one curated site style").action(
|
|
61484
|
+
withErrorHandling(async (options, command) => {
|
|
61485
|
+
const { output } = getOutputContext(command);
|
|
61486
|
+
const rows = buildStyleCatalogListRows(curatedSiteStyles, options);
|
|
61487
|
+
if (options.siteStyleId && rows.length === 0) {
|
|
61488
|
+
output.error(`Unknown site style: ${options.siteStyleId}`);
|
|
61489
|
+
}
|
|
61490
|
+
output.table(
|
|
61491
|
+
["Site Style ID", "Name", "Palettes", "Buttons", "Header Looks", "Footer Looks"],
|
|
61492
|
+
rows.map(formatStyleCatalogListRow)
|
|
61493
|
+
);
|
|
61494
|
+
})
|
|
61495
|
+
);
|
|
60918
61496
|
var applyCommand = new Command("apply").description("Apply a curated site-style selection").requiredOption("--site-style-id <id>", "Site style ID, e.g. site-style:calm-studio").requiredOption("--base-selection-version <version>", "Current style selection version").option("--selection-id <id>", "Current style selection row ID").option("--button-personality-id <id>", "Button personality ID").option("--palette-variant-id <id>", "Palette variant ID").option("--palette-overrides <json>", "JSON object of palette token overrides").option("--header-look-id <id>", "Header look ID").option("--footer-look-id <id>", "Footer look ID").action(
|
|
60919
61497
|
withErrorHandling(async (options, command) => {
|
|
60920
61498
|
const { output, client } = createCommandContext(command);
|
|
@@ -60935,7 +61513,7 @@ var styleCommand = new Command("style").description("Manage curated site styles"
|
|
|
60935
61513
|
Examples:
|
|
60936
61514
|
$ riverbankcms style apply --site-style-id site-style:calm-studio --base-selection-version 3
|
|
60937
61515
|
$ riverbankcms style apply --site-style-id site-style:calm-studio --base-selection-version 3 --palette-variant-id soft-natural-sage
|
|
60938
|
-
`).addCommand(applyCommand);
|
|
61516
|
+
`).addCommand(listCommand8).addCommand(applyCommand);
|
|
60939
61517
|
|
|
60940
61518
|
// src/cli/index.ts
|
|
60941
61519
|
config({ path: ".env.local" });
|