@camox/cli 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +98 -6
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -372,6 +372,7 @@ async function dispatch(opts) {
|
|
|
372
372
|
const projectFlag$3 = optional(option("--project", string({ metavar: "SLUG" })));
|
|
373
373
|
const jsonFlag$3 = option("--json");
|
|
374
374
|
const productionFlag$2 = option("--production");
|
|
375
|
+
const liveFlag$1 = option("--live");
|
|
375
376
|
const parser$7 = command("blocks", or(command("types", object({
|
|
376
377
|
command: constant("blocks.types"),
|
|
377
378
|
project: projectFlag$3,
|
|
@@ -386,6 +387,7 @@ const parser$7 = command("blocks", or(command("types", object({
|
|
|
386
387
|
})), command("get", object({
|
|
387
388
|
command: constant("blocks.get"),
|
|
388
389
|
id: option("--id", integer({ metavar: "ID" })),
|
|
390
|
+
live: liveFlag$1,
|
|
389
391
|
project: projectFlag$3,
|
|
390
392
|
production: productionFlag$2,
|
|
391
393
|
json: jsonFlag$3
|
|
@@ -477,7 +479,10 @@ async function handler$7(args) {
|
|
|
477
479
|
});
|
|
478
480
|
case "blocks.get": return dispatch({
|
|
479
481
|
toolName: "getBlock",
|
|
480
|
-
args: {
|
|
482
|
+
args: {
|
|
483
|
+
id: args.id,
|
|
484
|
+
source: args.live ? "live" : "draft"
|
|
485
|
+
},
|
|
481
486
|
projectFlag,
|
|
482
487
|
production,
|
|
483
488
|
outputMode
|
|
@@ -919,20 +924,50 @@ function logout() {
|
|
|
919
924
|
const projectFlag = optional(option("--project", string({ metavar: "SLUG" })));
|
|
920
925
|
const jsonFlag = option("--json");
|
|
921
926
|
const productionFlag = option("--production");
|
|
922
|
-
const
|
|
927
|
+
const liveFlag = option("--live");
|
|
928
|
+
const list = command("list", object({
|
|
923
929
|
command: constant("pages.list"),
|
|
924
930
|
project: projectFlag,
|
|
925
931
|
production: productionFlag,
|
|
926
932
|
json: jsonFlag
|
|
927
|
-
}))
|
|
933
|
+
}));
|
|
934
|
+
const get = command("get", object({
|
|
928
935
|
command: constant("pages.get"),
|
|
929
936
|
id: optional(option("--id", integer({ metavar: "ID" }))),
|
|
930
937
|
path: optional(option("--path", string({ metavar: "PATH" }))),
|
|
938
|
+
live: liveFlag,
|
|
931
939
|
project: projectFlag,
|
|
932
940
|
production: productionFlag,
|
|
933
941
|
json: jsonFlag
|
|
934
|
-
}))
|
|
942
|
+
}));
|
|
943
|
+
const publish = command("publish", object({
|
|
944
|
+
command: constant("pages.publish"),
|
|
945
|
+
id: optional(option("--id", integer({ metavar: "ID" }))),
|
|
946
|
+
path: optional(option("--path", string({ metavar: "PATH" }))),
|
|
947
|
+
noLayout: option("--no-layout"),
|
|
948
|
+
project: projectFlag,
|
|
949
|
+
production: productionFlag,
|
|
950
|
+
json: jsonFlag
|
|
951
|
+
}));
|
|
952
|
+
const unpublish = command("unpublish", object({
|
|
953
|
+
command: constant("pages.unpublish"),
|
|
954
|
+
id: optional(option("--id", integer({ metavar: "ID" }))),
|
|
955
|
+
path: optional(option("--path", string({ metavar: "PATH" }))),
|
|
956
|
+
project: projectFlag,
|
|
957
|
+
production: productionFlag,
|
|
958
|
+
json: jsonFlag
|
|
959
|
+
}));
|
|
960
|
+
const discardChanges = command("discard-changes", object({
|
|
961
|
+
command: constant("pages.discard-changes"),
|
|
962
|
+
id: optional(option("--id", integer({ metavar: "ID" }))),
|
|
963
|
+
path: optional(option("--path", string({ metavar: "PATH" }))),
|
|
964
|
+
project: projectFlag,
|
|
965
|
+
production: productionFlag,
|
|
966
|
+
json: jsonFlag
|
|
967
|
+
}));
|
|
968
|
+
const parser$1 = command("pages", or(list, get, command("create", object({
|
|
935
969
|
command: constant("pages.create"),
|
|
970
|
+
nickname: optional(option("--nickname", string({ metavar: "TEXT" }))),
|
|
936
971
|
pathSegment: option("--path-segment", string({ metavar: "SEGMENT" })),
|
|
937
972
|
layoutId: option("--layout-id", integer({ metavar: "ID" })),
|
|
938
973
|
parentPageId: optional(option("--parent-page-id", integer({ metavar: "ID" }))),
|
|
@@ -943,6 +978,7 @@ const parser$1 = command("pages", or(command("list", object({
|
|
|
943
978
|
})), command("update", object({
|
|
944
979
|
command: constant("pages.update"),
|
|
945
980
|
id: option("--id", integer({ metavar: "ID" })),
|
|
981
|
+
nickname: optional(option("--nickname", string({ metavar: "TEXT" }))),
|
|
946
982
|
pathSegment: optional(option("--path-segment", string({ metavar: "SEGMENT" }))),
|
|
947
983
|
parentPageId: optional(option("--parent-page-id", integer({ metavar: "ID" }))),
|
|
948
984
|
project: projectFlag,
|
|
@@ -961,7 +997,7 @@ const parser$1 = command("pages", or(command("list", object({
|
|
|
961
997
|
project: projectFlag,
|
|
962
998
|
production: productionFlag,
|
|
963
999
|
json: jsonFlag
|
|
964
|
-
}))));
|
|
1000
|
+
})), publish, unpublish, discardChanges));
|
|
965
1001
|
async function handler$1(args) {
|
|
966
1002
|
const outputMode = args.json ? "json" : "auto";
|
|
967
1003
|
const projectFlag = args.project;
|
|
@@ -984,7 +1020,10 @@ async function handler$1(args) {
|
|
|
984
1020
|
}
|
|
985
1021
|
return dispatch({
|
|
986
1022
|
toolName: "getPage",
|
|
987
|
-
args:
|
|
1023
|
+
args: {
|
|
1024
|
+
...args.id != null ? { id: args.id } : { path: args.path },
|
|
1025
|
+
source: args.live ? "live" : "draft"
|
|
1026
|
+
},
|
|
988
1027
|
projectFlag,
|
|
989
1028
|
production,
|
|
990
1029
|
outputMode
|
|
@@ -992,6 +1031,7 @@ async function handler$1(args) {
|
|
|
992
1031
|
case "pages.create": return dispatch({
|
|
993
1032
|
toolName: "createPage",
|
|
994
1033
|
args: {
|
|
1034
|
+
nickname: args.nickname,
|
|
995
1035
|
pathSegment: args.pathSegment,
|
|
996
1036
|
layoutId: args.layoutId,
|
|
997
1037
|
parentPageId: args.parentPageId,
|
|
@@ -1005,6 +1045,7 @@ async function handler$1(args) {
|
|
|
1005
1045
|
toolName: "updatePage",
|
|
1006
1046
|
args: {
|
|
1007
1047
|
id: args.id,
|
|
1048
|
+
nickname: args.nickname,
|
|
1008
1049
|
pathSegment: args.pathSegment,
|
|
1009
1050
|
parentPageId: args.parentPageId
|
|
1010
1051
|
},
|
|
@@ -1029,6 +1070,54 @@ async function handler$1(args) {
|
|
|
1029
1070
|
production,
|
|
1030
1071
|
outputMode
|
|
1031
1072
|
});
|
|
1073
|
+
case "pages.publish":
|
|
1074
|
+
if (args.id == null === (args.path == null)) {
|
|
1075
|
+
printError({
|
|
1076
|
+
code: "INVALID_ARGS",
|
|
1077
|
+
message: "Pass exactly one of --id or --path."
|
|
1078
|
+
});
|
|
1079
|
+
process.exit(2);
|
|
1080
|
+
}
|
|
1081
|
+
return dispatch({
|
|
1082
|
+
toolName: "publishPage",
|
|
1083
|
+
args: {
|
|
1084
|
+
...args.id != null ? { id: args.id } : { path: args.path },
|
|
1085
|
+
alsoPublishLayout: !args.noLayout
|
|
1086
|
+
},
|
|
1087
|
+
projectFlag,
|
|
1088
|
+
production,
|
|
1089
|
+
outputMode
|
|
1090
|
+
});
|
|
1091
|
+
case "pages.unpublish":
|
|
1092
|
+
if (args.id == null === (args.path == null)) {
|
|
1093
|
+
printError({
|
|
1094
|
+
code: "INVALID_ARGS",
|
|
1095
|
+
message: "Pass exactly one of --id or --path."
|
|
1096
|
+
});
|
|
1097
|
+
process.exit(2);
|
|
1098
|
+
}
|
|
1099
|
+
return dispatch({
|
|
1100
|
+
toolName: "unpublishPage",
|
|
1101
|
+
args: args.id != null ? { id: args.id } : { path: args.path },
|
|
1102
|
+
projectFlag,
|
|
1103
|
+
production,
|
|
1104
|
+
outputMode
|
|
1105
|
+
});
|
|
1106
|
+
case "pages.discard-changes":
|
|
1107
|
+
if (args.id == null === (args.path == null)) {
|
|
1108
|
+
printError({
|
|
1109
|
+
code: "INVALID_ARGS",
|
|
1110
|
+
message: "Pass exactly one of --id or --path."
|
|
1111
|
+
});
|
|
1112
|
+
process.exit(2);
|
|
1113
|
+
}
|
|
1114
|
+
return dispatch({
|
|
1115
|
+
toolName: "discardPageChanges",
|
|
1116
|
+
args: args.id != null ? { id: args.id } : { path: args.path },
|
|
1117
|
+
projectFlag,
|
|
1118
|
+
production,
|
|
1119
|
+
outputMode
|
|
1120
|
+
});
|
|
1032
1121
|
}
|
|
1033
1122
|
}
|
|
1034
1123
|
//#endregion
|
|
@@ -1107,6 +1196,9 @@ switch (result.command) {
|
|
|
1107
1196
|
case "pages.update":
|
|
1108
1197
|
case "pages.set-layout":
|
|
1109
1198
|
case "pages.delete":
|
|
1199
|
+
case "pages.publish":
|
|
1200
|
+
case "pages.unpublish":
|
|
1201
|
+
case "pages.discard-changes":
|
|
1110
1202
|
await handler$1(result);
|
|
1111
1203
|
break;
|
|
1112
1204
|
case "blocks.types":
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@camox/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"bin": {
|
|
5
5
|
"camox": "./dist/index.mjs"
|
|
6
6
|
},
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"@types/node": "^24.12.2",
|
|
27
27
|
"@typescript/native-preview": "7.0.0-dev.20260412.1",
|
|
28
28
|
"vite-plus": "latest",
|
|
29
|
-
"@camox/api-contract": "0.
|
|
29
|
+
"@camox/api-contract": "0.27.0"
|
|
30
30
|
},
|
|
31
31
|
"nx": {
|
|
32
32
|
"tags": [
|