@neopress/cli 4.5.0 → 4.6.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/bin.cjs +29 -7
- package/dist/index.js +27 -5
- package/package.json +6 -3
package/dist/bin.cjs
CHANGED
|
@@ -24893,6 +24893,7 @@ function serializeRedirect(r) {
|
|
|
24893
24893
|
siteId: r.site_id,
|
|
24894
24894
|
source: r.source,
|
|
24895
24895
|
destination: r.destination,
|
|
24896
|
+
mode: r.mode,
|
|
24896
24897
|
redirectType: r.redirect_type,
|
|
24897
24898
|
includeChildren: r.include_children,
|
|
24898
24899
|
preservePath: r.preserve_path,
|
|
@@ -25117,7 +25118,8 @@ var COLLECTION_FIELD_TYPES = [
|
|
|
25117
25118
|
"checkbox",
|
|
25118
25119
|
"radio",
|
|
25119
25120
|
"multi_checkbox",
|
|
25120
|
-
"consent"
|
|
25121
|
+
"consent",
|
|
25122
|
+
"place"
|
|
25121
25123
|
];
|
|
25122
25124
|
var COLLECTION_FIELD_TYPE_ALIASES = {
|
|
25123
25125
|
boolean: "bool",
|
|
@@ -38995,12 +38997,10 @@ var COLLECTION_PRESET_CONTRACTS = {
|
|
|
38995
38997
|
schema: {
|
|
38996
38998
|
title: titleField("Name"),
|
|
38997
38999
|
slug: slugField(),
|
|
38998
|
-
|
|
38999
|
-
address: field("address", "Address", "text"),
|
|
39000
|
-
city: field("city", "City", "text"),
|
|
39000
|
+
location: field("location", "Location", "place"),
|
|
39001
39001
|
description: field("description", "Description", "content")
|
|
39002
39002
|
},
|
|
39003
|
-
lockedFieldIds: ["title", "slug", "
|
|
39003
|
+
lockedFieldIds: ["title", "slug", "location"]
|
|
39004
39004
|
},
|
|
39005
39005
|
category: {
|
|
39006
39006
|
schema: {
|
|
@@ -40440,6 +40440,12 @@ var SiteEndpoint = class {
|
|
|
40440
40440
|
};
|
|
40441
40441
|
|
|
40442
40442
|
// ../sdk/dist/endpoints/redirects.js
|
|
40443
|
+
var DASHBOARD_ONLY_REWRITE_MESSAGE = "Rewrite proxy rules can only be managed in the dashboard.";
|
|
40444
|
+
function rejectModeParam(data) {
|
|
40445
|
+
if (data && typeof data === "object" && Object.prototype.hasOwnProperty.call(data, "mode")) {
|
|
40446
|
+
throw new NeopressApiError("REDIRECT_RULE_DASHBOARD_ONLY", DASHBOARD_ONLY_REWRITE_MESSAGE, 400);
|
|
40447
|
+
}
|
|
40448
|
+
}
|
|
40443
40449
|
var RedirectsEndpoint = class {
|
|
40444
40450
|
client;
|
|
40445
40451
|
constructor(client) {
|
|
@@ -40454,6 +40460,7 @@ var RedirectsEndpoint = class {
|
|
|
40454
40460
|
return (data ?? []).map((r) => serializeRedirect(r));
|
|
40455
40461
|
}
|
|
40456
40462
|
async create(data) {
|
|
40463
|
+
rejectModeParam(data);
|
|
40457
40464
|
const values = {
|
|
40458
40465
|
site_id: this.client.siteIdNumber,
|
|
40459
40466
|
source: data.source,
|
|
@@ -40469,7 +40476,21 @@ var RedirectsEndpoint = class {
|
|
|
40469
40476
|
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
40470
40477
|
return serializeRedirect(row);
|
|
40471
40478
|
}
|
|
40479
|
+
async assertRedirectRuleWritable(ruleId) {
|
|
40480
|
+
const { data, error: error48 } = await this.client.db.from("redirect_rules").select("id, mode").eq("site_id", this.client.siteIdNumber).eq("id", ruleId).maybeSingle();
|
|
40481
|
+
if (error48)
|
|
40482
|
+
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
40483
|
+
if (!data) {
|
|
40484
|
+
throw new NeopressApiError("REDIRECT_RULE_NOT_FOUND", `Redirect rule ${ruleId} not found for this site`, 404);
|
|
40485
|
+
}
|
|
40486
|
+
const row = data;
|
|
40487
|
+
if (row.mode === "proxy") {
|
|
40488
|
+
throw new NeopressApiError("REDIRECT_RULE_DASHBOARD_ONLY", DASHBOARD_ONLY_REWRITE_MESSAGE, 400);
|
|
40489
|
+
}
|
|
40490
|
+
}
|
|
40472
40491
|
async update(ruleId, data) {
|
|
40492
|
+
rejectModeParam(data);
|
|
40493
|
+
await this.assertRedirectRuleWritable(ruleId);
|
|
40473
40494
|
const values = {};
|
|
40474
40495
|
if ("source" in data)
|
|
40475
40496
|
values.source = data.source;
|
|
@@ -40491,6 +40512,7 @@ var RedirectsEndpoint = class {
|
|
|
40491
40512
|
return serializeRedirect(row);
|
|
40492
40513
|
}
|
|
40493
40514
|
async delete(ruleId) {
|
|
40515
|
+
await this.assertRedirectRuleWritable(ruleId);
|
|
40494
40516
|
const { error: error48 } = await this.client.db.from("redirect_rules").delete().eq("site_id", this.client.siteIdNumber).eq("id", ruleId);
|
|
40495
40517
|
if (error48)
|
|
40496
40518
|
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
@@ -41990,7 +42012,7 @@ Examples:
|
|
|
41990
42012
|
var AGE_BANDS = ["young", "middle"];
|
|
41991
42013
|
var GENDERS = ["male", "female"];
|
|
41992
42014
|
var ETHNICITIES = ["asian", "white", "black", "latino"];
|
|
41993
|
-
var ATTIRES = ["formal"];
|
|
42015
|
+
var ATTIRES = ["formal", "casual"];
|
|
41994
42016
|
function validateEnum(value, allowed, flag) {
|
|
41995
42017
|
if (value !== void 0 && !allowed.includes(value)) {
|
|
41996
42018
|
fail(`${flag} must be one of: ${allowed.join(", ")}`);
|
|
@@ -42356,7 +42378,7 @@ function registerGuideCommands(program3) {
|
|
|
42356
42378
|
|
|
42357
42379
|
// src/bin.ts
|
|
42358
42380
|
var program2 = new Command();
|
|
42359
|
-
program2.name("neopress").description("Neopress CLI \u2014 manage your site from the terminal").version("4.
|
|
42381
|
+
program2.name("neopress").description("Neopress CLI \u2014 manage your site from the terminal").version("4.6.0").option("--json", "Output in JSON format (for AI tools and pipes)").option("--site <idOrHandle>", "Target a specific site (overrides active site; not persisted)").option("--no-input", "Non-interactive mode").hook("preAction", (thisCommand) => {
|
|
42360
42382
|
const opts = thisCommand.optsWithGlobals();
|
|
42361
42383
|
if (opts.site) setSiteOverride(String(opts.site));
|
|
42362
42384
|
if (opts.json || !process.stdout.isTTY) setJsonMode(true);
|
package/dist/index.js
CHANGED
|
@@ -21115,6 +21115,7 @@ function serializeRedirect(r) {
|
|
|
21115
21115
|
siteId: r.site_id,
|
|
21116
21116
|
source: r.source,
|
|
21117
21117
|
destination: r.destination,
|
|
21118
|
+
mode: r.mode,
|
|
21118
21119
|
redirectType: r.redirect_type,
|
|
21119
21120
|
includeChildren: r.include_children,
|
|
21120
21121
|
preservePath: r.preserve_path,
|
|
@@ -21339,7 +21340,8 @@ var COLLECTION_FIELD_TYPES = [
|
|
|
21339
21340
|
"checkbox",
|
|
21340
21341
|
"radio",
|
|
21341
21342
|
"multi_checkbox",
|
|
21342
|
-
"consent"
|
|
21343
|
+
"consent",
|
|
21344
|
+
"place"
|
|
21343
21345
|
];
|
|
21344
21346
|
var COLLECTION_FIELD_TYPE_ALIASES = {
|
|
21345
21347
|
boolean: "bool",
|
|
@@ -35217,12 +35219,10 @@ var COLLECTION_PRESET_CONTRACTS = {
|
|
|
35217
35219
|
schema: {
|
|
35218
35220
|
title: titleField("Name"),
|
|
35219
35221
|
slug: slugField(),
|
|
35220
|
-
|
|
35221
|
-
address: field("address", "Address", "text"),
|
|
35222
|
-
city: field("city", "City", "text"),
|
|
35222
|
+
location: field("location", "Location", "place"),
|
|
35223
35223
|
description: field("description", "Description", "content")
|
|
35224
35224
|
},
|
|
35225
|
-
lockedFieldIds: ["title", "slug", "
|
|
35225
|
+
lockedFieldIds: ["title", "slug", "location"]
|
|
35226
35226
|
},
|
|
35227
35227
|
category: {
|
|
35228
35228
|
schema: {
|
|
@@ -36662,6 +36662,12 @@ var SiteEndpoint = class {
|
|
|
36662
36662
|
};
|
|
36663
36663
|
|
|
36664
36664
|
// ../sdk/dist/endpoints/redirects.js
|
|
36665
|
+
var DASHBOARD_ONLY_REWRITE_MESSAGE = "Rewrite proxy rules can only be managed in the dashboard.";
|
|
36666
|
+
function rejectModeParam(data) {
|
|
36667
|
+
if (data && typeof data === "object" && Object.prototype.hasOwnProperty.call(data, "mode")) {
|
|
36668
|
+
throw new NeopressApiError("REDIRECT_RULE_DASHBOARD_ONLY", DASHBOARD_ONLY_REWRITE_MESSAGE, 400);
|
|
36669
|
+
}
|
|
36670
|
+
}
|
|
36665
36671
|
var RedirectsEndpoint = class {
|
|
36666
36672
|
client;
|
|
36667
36673
|
constructor(client) {
|
|
@@ -36676,6 +36682,7 @@ var RedirectsEndpoint = class {
|
|
|
36676
36682
|
return (data ?? []).map((r) => serializeRedirect(r));
|
|
36677
36683
|
}
|
|
36678
36684
|
async create(data) {
|
|
36685
|
+
rejectModeParam(data);
|
|
36679
36686
|
const values = {
|
|
36680
36687
|
site_id: this.client.siteIdNumber,
|
|
36681
36688
|
source: data.source,
|
|
@@ -36691,7 +36698,21 @@ var RedirectsEndpoint = class {
|
|
|
36691
36698
|
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
36692
36699
|
return serializeRedirect(row);
|
|
36693
36700
|
}
|
|
36701
|
+
async assertRedirectRuleWritable(ruleId) {
|
|
36702
|
+
const { data, error: error48 } = await this.client.db.from("redirect_rules").select("id, mode").eq("site_id", this.client.siteIdNumber).eq("id", ruleId).maybeSingle();
|
|
36703
|
+
if (error48)
|
|
36704
|
+
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
|
36705
|
+
if (!data) {
|
|
36706
|
+
throw new NeopressApiError("REDIRECT_RULE_NOT_FOUND", `Redirect rule ${ruleId} not found for this site`, 404);
|
|
36707
|
+
}
|
|
36708
|
+
const row = data;
|
|
36709
|
+
if (row.mode === "proxy") {
|
|
36710
|
+
throw new NeopressApiError("REDIRECT_RULE_DASHBOARD_ONLY", DASHBOARD_ONLY_REWRITE_MESSAGE, 400);
|
|
36711
|
+
}
|
|
36712
|
+
}
|
|
36694
36713
|
async update(ruleId, data) {
|
|
36714
|
+
rejectModeParam(data);
|
|
36715
|
+
await this.assertRedirectRuleWritable(ruleId);
|
|
36695
36716
|
const values = {};
|
|
36696
36717
|
if ("source" in data)
|
|
36697
36718
|
values.source = data.source;
|
|
@@ -36713,6 +36734,7 @@ var RedirectsEndpoint = class {
|
|
|
36713
36734
|
return serializeRedirect(row);
|
|
36714
36735
|
}
|
|
36715
36736
|
async delete(ruleId) {
|
|
36737
|
+
await this.assertRedirectRuleWritable(ruleId);
|
|
36716
36738
|
const { error: error48 } = await this.client.db.from("redirect_rules").delete().eq("site_id", this.client.siteIdNumber).eq("id", ruleId);
|
|
36717
36739
|
if (error48)
|
|
36718
36740
|
throw new NeopressApiError("DB_ERROR", error48.message, 0, error48);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neopress/cli",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"description": "Neopress CLI — manage your Neopress site from the terminal",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -21,14 +21,17 @@
|
|
|
21
21
|
"dist",
|
|
22
22
|
"README.md"
|
|
23
23
|
],
|
|
24
|
+
"engines": {
|
|
25
|
+
"node": ">=24"
|
|
26
|
+
},
|
|
24
27
|
"publishConfig": {
|
|
25
28
|
"access": "public"
|
|
26
29
|
},
|
|
27
30
|
"devDependencies": {
|
|
28
|
-
"@types/node": "^
|
|
31
|
+
"@types/node": "^24",
|
|
29
32
|
"commander": "^13.0.0",
|
|
30
33
|
"tsup": "^8.5.1",
|
|
31
|
-
"typescript": "^5.
|
|
34
|
+
"typescript": "^5.9.3",
|
|
32
35
|
"@neopress/sdk": "0.4.0"
|
|
33
36
|
},
|
|
34
37
|
"scripts": {
|