@bobbykim/manguito-cms-cli 0.4.4 → 0.4.6
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
CHANGED
|
@@ -38,7 +38,7 @@ import {
|
|
|
38
38
|
resolveRelationField,
|
|
39
39
|
sql,
|
|
40
40
|
tracer
|
|
41
|
-
} from "./chunk-
|
|
41
|
+
} from "./chunk-LFMOJRYP.js";
|
|
42
42
|
|
|
43
43
|
// ../../node_modules/.pnpm/yaml@2.9.0/node_modules/yaml/dist/nodes/identity.js
|
|
44
44
|
var require_identity = __commonJS({
|
|
@@ -119,17 +119,17 @@ var require_visit = __commonJS({
|
|
|
119
119
|
visit.BREAK = BREAK;
|
|
120
120
|
visit.SKIP = SKIP;
|
|
121
121
|
visit.REMOVE = REMOVE;
|
|
122
|
-
function visit_(key, node, visitor,
|
|
123
|
-
const ctrl = callVisitor(key, node, visitor,
|
|
122
|
+
function visit_(key, node, visitor, path4) {
|
|
123
|
+
const ctrl = callVisitor(key, node, visitor, path4);
|
|
124
124
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
125
|
-
replaceNode(key,
|
|
126
|
-
return visit_(key, ctrl, visitor,
|
|
125
|
+
replaceNode(key, path4, ctrl);
|
|
126
|
+
return visit_(key, ctrl, visitor, path4);
|
|
127
127
|
}
|
|
128
128
|
if (typeof ctrl !== "symbol") {
|
|
129
129
|
if (identity.isCollection(node)) {
|
|
130
|
-
|
|
130
|
+
path4 = Object.freeze(path4.concat(node));
|
|
131
131
|
for (let i = 0; i < node.items.length; ++i) {
|
|
132
|
-
const ci = visit_(i, node.items[i], visitor,
|
|
132
|
+
const ci = visit_(i, node.items[i], visitor, path4);
|
|
133
133
|
if (typeof ci === "number")
|
|
134
134
|
i = ci - 1;
|
|
135
135
|
else if (ci === BREAK)
|
|
@@ -140,13 +140,13 @@ var require_visit = __commonJS({
|
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
} else if (identity.isPair(node)) {
|
|
143
|
-
|
|
144
|
-
const ck = visit_("key", node.key, visitor,
|
|
143
|
+
path4 = Object.freeze(path4.concat(node));
|
|
144
|
+
const ck = visit_("key", node.key, visitor, path4);
|
|
145
145
|
if (ck === BREAK)
|
|
146
146
|
return BREAK;
|
|
147
147
|
else if (ck === REMOVE)
|
|
148
148
|
node.key = null;
|
|
149
|
-
const cv = visit_("value", node.value, visitor,
|
|
149
|
+
const cv = visit_("value", node.value, visitor, path4);
|
|
150
150
|
if (cv === BREAK)
|
|
151
151
|
return BREAK;
|
|
152
152
|
else if (cv === REMOVE)
|
|
@@ -167,17 +167,17 @@ var require_visit = __commonJS({
|
|
|
167
167
|
visitAsync.BREAK = BREAK;
|
|
168
168
|
visitAsync.SKIP = SKIP;
|
|
169
169
|
visitAsync.REMOVE = REMOVE;
|
|
170
|
-
async function visitAsync_(key, node, visitor,
|
|
171
|
-
const ctrl = await callVisitor(key, node, visitor,
|
|
170
|
+
async function visitAsync_(key, node, visitor, path4) {
|
|
171
|
+
const ctrl = await callVisitor(key, node, visitor, path4);
|
|
172
172
|
if (identity.isNode(ctrl) || identity.isPair(ctrl)) {
|
|
173
|
-
replaceNode(key,
|
|
174
|
-
return visitAsync_(key, ctrl, visitor,
|
|
173
|
+
replaceNode(key, path4, ctrl);
|
|
174
|
+
return visitAsync_(key, ctrl, visitor, path4);
|
|
175
175
|
}
|
|
176
176
|
if (typeof ctrl !== "symbol") {
|
|
177
177
|
if (identity.isCollection(node)) {
|
|
178
|
-
|
|
178
|
+
path4 = Object.freeze(path4.concat(node));
|
|
179
179
|
for (let i = 0; i < node.items.length; ++i) {
|
|
180
|
-
const ci = await visitAsync_(i, node.items[i], visitor,
|
|
180
|
+
const ci = await visitAsync_(i, node.items[i], visitor, path4);
|
|
181
181
|
if (typeof ci === "number")
|
|
182
182
|
i = ci - 1;
|
|
183
183
|
else if (ci === BREAK)
|
|
@@ -188,13 +188,13 @@ var require_visit = __commonJS({
|
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
190
|
} else if (identity.isPair(node)) {
|
|
191
|
-
|
|
192
|
-
const ck = await visitAsync_("key", node.key, visitor,
|
|
191
|
+
path4 = Object.freeze(path4.concat(node));
|
|
192
|
+
const ck = await visitAsync_("key", node.key, visitor, path4);
|
|
193
193
|
if (ck === BREAK)
|
|
194
194
|
return BREAK;
|
|
195
195
|
else if (ck === REMOVE)
|
|
196
196
|
node.key = null;
|
|
197
|
-
const cv = await visitAsync_("value", node.value, visitor,
|
|
197
|
+
const cv = await visitAsync_("value", node.value, visitor, path4);
|
|
198
198
|
if (cv === BREAK)
|
|
199
199
|
return BREAK;
|
|
200
200
|
else if (cv === REMOVE)
|
|
@@ -221,23 +221,23 @@ var require_visit = __commonJS({
|
|
|
221
221
|
}
|
|
222
222
|
return visitor;
|
|
223
223
|
}
|
|
224
|
-
function callVisitor(key, node, visitor,
|
|
224
|
+
function callVisitor(key, node, visitor, path4) {
|
|
225
225
|
if (typeof visitor === "function")
|
|
226
|
-
return visitor(key, node,
|
|
226
|
+
return visitor(key, node, path4);
|
|
227
227
|
if (identity.isMap(node))
|
|
228
|
-
return visitor.Map?.(key, node,
|
|
228
|
+
return visitor.Map?.(key, node, path4);
|
|
229
229
|
if (identity.isSeq(node))
|
|
230
|
-
return visitor.Seq?.(key, node,
|
|
230
|
+
return visitor.Seq?.(key, node, path4);
|
|
231
231
|
if (identity.isPair(node))
|
|
232
|
-
return visitor.Pair?.(key, node,
|
|
232
|
+
return visitor.Pair?.(key, node, path4);
|
|
233
233
|
if (identity.isScalar(node))
|
|
234
|
-
return visitor.Scalar?.(key, node,
|
|
234
|
+
return visitor.Scalar?.(key, node, path4);
|
|
235
235
|
if (identity.isAlias(node))
|
|
236
|
-
return visitor.Alias?.(key, node,
|
|
236
|
+
return visitor.Alias?.(key, node, path4);
|
|
237
237
|
return void 0;
|
|
238
238
|
}
|
|
239
|
-
function replaceNode(key,
|
|
240
|
-
const parent =
|
|
239
|
+
function replaceNode(key, path4, node) {
|
|
240
|
+
const parent = path4[path4.length - 1];
|
|
241
241
|
if (identity.isCollection(parent)) {
|
|
242
242
|
parent.items[key] = node;
|
|
243
243
|
} else if (identity.isPair(parent)) {
|
|
@@ -856,10 +856,10 @@ var require_Collection = __commonJS({
|
|
|
856
856
|
var createNode = require_createNode();
|
|
857
857
|
var identity = require_identity();
|
|
858
858
|
var Node3 = require_Node();
|
|
859
|
-
function collectionFromPath(schema,
|
|
859
|
+
function collectionFromPath(schema, path4, value) {
|
|
860
860
|
let v2 = value;
|
|
861
|
-
for (let i =
|
|
862
|
-
const k =
|
|
861
|
+
for (let i = path4.length - 1; i >= 0; --i) {
|
|
862
|
+
const k = path4[i];
|
|
863
863
|
if (typeof k === "number" && Number.isInteger(k) && k >= 0) {
|
|
864
864
|
const a2 = [];
|
|
865
865
|
a2[k] = v2;
|
|
@@ -878,7 +878,7 @@ var require_Collection = __commonJS({
|
|
|
878
878
|
sourceObjects: /* @__PURE__ */ new Map()
|
|
879
879
|
});
|
|
880
880
|
}
|
|
881
|
-
var isEmptyPath = (
|
|
881
|
+
var isEmptyPath = (path4) => path4 == null || typeof path4 === "object" && !!path4[Symbol.iterator]().next().done;
|
|
882
882
|
var Collection = class extends Node3.NodeBase {
|
|
883
883
|
constructor(type, schema) {
|
|
884
884
|
super(type);
|
|
@@ -908,11 +908,11 @@ var require_Collection = __commonJS({
|
|
|
908
908
|
* be a Pair instance or a `{ key, value }` object, which may not have a key
|
|
909
909
|
* that already exists in the map.
|
|
910
910
|
*/
|
|
911
|
-
addIn(
|
|
912
|
-
if (isEmptyPath(
|
|
911
|
+
addIn(path4, value) {
|
|
912
|
+
if (isEmptyPath(path4))
|
|
913
913
|
this.add(value);
|
|
914
914
|
else {
|
|
915
|
-
const [key, ...rest] =
|
|
915
|
+
const [key, ...rest] = path4;
|
|
916
916
|
const node = this.get(key, true);
|
|
917
917
|
if (identity.isCollection(node))
|
|
918
918
|
node.addIn(rest, value);
|
|
@@ -926,8 +926,8 @@ var require_Collection = __commonJS({
|
|
|
926
926
|
* Removes a value from the collection.
|
|
927
927
|
* @returns `true` if the item was found and removed.
|
|
928
928
|
*/
|
|
929
|
-
deleteIn(
|
|
930
|
-
const [key, ...rest] =
|
|
929
|
+
deleteIn(path4) {
|
|
930
|
+
const [key, ...rest] = path4;
|
|
931
931
|
if (rest.length === 0)
|
|
932
932
|
return this.delete(key);
|
|
933
933
|
const node = this.get(key, true);
|
|
@@ -941,8 +941,8 @@ var require_Collection = __commonJS({
|
|
|
941
941
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
942
942
|
* `true` (collections are always returned intact).
|
|
943
943
|
*/
|
|
944
|
-
getIn(
|
|
945
|
-
const [key, ...rest] =
|
|
944
|
+
getIn(path4, keepScalar) {
|
|
945
|
+
const [key, ...rest] = path4;
|
|
946
946
|
const node = this.get(key, true);
|
|
947
947
|
if (rest.length === 0)
|
|
948
948
|
return !keepScalar && identity.isScalar(node) ? node.value : node;
|
|
@@ -960,8 +960,8 @@ var require_Collection = __commonJS({
|
|
|
960
960
|
/**
|
|
961
961
|
* Checks if the collection includes a value with the key `key`.
|
|
962
962
|
*/
|
|
963
|
-
hasIn(
|
|
964
|
-
const [key, ...rest] =
|
|
963
|
+
hasIn(path4) {
|
|
964
|
+
const [key, ...rest] = path4;
|
|
965
965
|
if (rest.length === 0)
|
|
966
966
|
return this.has(key);
|
|
967
967
|
const node = this.get(key, true);
|
|
@@ -971,8 +971,8 @@ var require_Collection = __commonJS({
|
|
|
971
971
|
* Sets a value in this collection. For `!!set`, `value` needs to be a
|
|
972
972
|
* boolean to add/remove the item from the set.
|
|
973
973
|
*/
|
|
974
|
-
setIn(
|
|
975
|
-
const [key, ...rest] =
|
|
974
|
+
setIn(path4, value) {
|
|
975
|
+
const [key, ...rest] = path4;
|
|
976
976
|
if (rest.length === 0) {
|
|
977
977
|
this.set(key, value);
|
|
978
978
|
} else {
|
|
@@ -3522,9 +3522,9 @@ var require_Document = __commonJS({
|
|
|
3522
3522
|
this.contents.add(value);
|
|
3523
3523
|
}
|
|
3524
3524
|
/** Adds a value to the document. */
|
|
3525
|
-
addIn(
|
|
3525
|
+
addIn(path4, value) {
|
|
3526
3526
|
if (assertCollection(this.contents))
|
|
3527
|
-
this.contents.addIn(
|
|
3527
|
+
this.contents.addIn(path4, value);
|
|
3528
3528
|
}
|
|
3529
3529
|
/**
|
|
3530
3530
|
* Create a new `Alias` node, ensuring that the target `node` has the required anchor.
|
|
@@ -3599,14 +3599,14 @@ var require_Document = __commonJS({
|
|
|
3599
3599
|
* Removes a value from the document.
|
|
3600
3600
|
* @returns `true` if the item was found and removed.
|
|
3601
3601
|
*/
|
|
3602
|
-
deleteIn(
|
|
3603
|
-
if (Collection.isEmptyPath(
|
|
3602
|
+
deleteIn(path4) {
|
|
3603
|
+
if (Collection.isEmptyPath(path4)) {
|
|
3604
3604
|
if (this.contents == null)
|
|
3605
3605
|
return false;
|
|
3606
3606
|
this.contents = null;
|
|
3607
3607
|
return true;
|
|
3608
3608
|
}
|
|
3609
|
-
return assertCollection(this.contents) ? this.contents.deleteIn(
|
|
3609
|
+
return assertCollection(this.contents) ? this.contents.deleteIn(path4) : false;
|
|
3610
3610
|
}
|
|
3611
3611
|
/**
|
|
3612
3612
|
* Returns item at `key`, or `undefined` if not found. By default unwraps
|
|
@@ -3621,10 +3621,10 @@ var require_Document = __commonJS({
|
|
|
3621
3621
|
* scalar values from their surrounding node; to disable set `keepScalar` to
|
|
3622
3622
|
* `true` (collections are always returned intact).
|
|
3623
3623
|
*/
|
|
3624
|
-
getIn(
|
|
3625
|
-
if (Collection.isEmptyPath(
|
|
3624
|
+
getIn(path4, keepScalar) {
|
|
3625
|
+
if (Collection.isEmptyPath(path4))
|
|
3626
3626
|
return !keepScalar && identity.isScalar(this.contents) ? this.contents.value : this.contents;
|
|
3627
|
-
return identity.isCollection(this.contents) ? this.contents.getIn(
|
|
3627
|
+
return identity.isCollection(this.contents) ? this.contents.getIn(path4, keepScalar) : void 0;
|
|
3628
3628
|
}
|
|
3629
3629
|
/**
|
|
3630
3630
|
* Checks if the document includes a value with the key `key`.
|
|
@@ -3635,10 +3635,10 @@ var require_Document = __commonJS({
|
|
|
3635
3635
|
/**
|
|
3636
3636
|
* Checks if the document includes a value at `path`.
|
|
3637
3637
|
*/
|
|
3638
|
-
hasIn(
|
|
3639
|
-
if (Collection.isEmptyPath(
|
|
3638
|
+
hasIn(path4) {
|
|
3639
|
+
if (Collection.isEmptyPath(path4))
|
|
3640
3640
|
return this.contents !== void 0;
|
|
3641
|
-
return identity.isCollection(this.contents) ? this.contents.hasIn(
|
|
3641
|
+
return identity.isCollection(this.contents) ? this.contents.hasIn(path4) : false;
|
|
3642
3642
|
}
|
|
3643
3643
|
/**
|
|
3644
3644
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
@@ -3655,13 +3655,13 @@ var require_Document = __commonJS({
|
|
|
3655
3655
|
* Sets a value in this document. For `!!set`, `value` needs to be a
|
|
3656
3656
|
* boolean to add/remove the item from the set.
|
|
3657
3657
|
*/
|
|
3658
|
-
setIn(
|
|
3659
|
-
if (Collection.isEmptyPath(
|
|
3658
|
+
setIn(path4, value) {
|
|
3659
|
+
if (Collection.isEmptyPath(path4)) {
|
|
3660
3660
|
this.contents = value;
|
|
3661
3661
|
} else if (this.contents == null) {
|
|
3662
|
-
this.contents = Collection.collectionFromPath(this.schema, Array.from(
|
|
3662
|
+
this.contents = Collection.collectionFromPath(this.schema, Array.from(path4), value);
|
|
3663
3663
|
} else if (assertCollection(this.contents)) {
|
|
3664
|
-
this.contents.setIn(
|
|
3664
|
+
this.contents.setIn(path4, value);
|
|
3665
3665
|
}
|
|
3666
3666
|
}
|
|
3667
3667
|
/**
|
|
@@ -5641,9 +5641,9 @@ var require_cst_visit = __commonJS({
|
|
|
5641
5641
|
visit.BREAK = BREAK;
|
|
5642
5642
|
visit.SKIP = SKIP;
|
|
5643
5643
|
visit.REMOVE = REMOVE;
|
|
5644
|
-
visit.itemAtPath = (cst,
|
|
5644
|
+
visit.itemAtPath = (cst, path4) => {
|
|
5645
5645
|
let item = cst;
|
|
5646
|
-
for (const [field, index] of
|
|
5646
|
+
for (const [field, index] of path4) {
|
|
5647
5647
|
const tok = item?.[field];
|
|
5648
5648
|
if (tok && "items" in tok) {
|
|
5649
5649
|
item = tok.items[index];
|
|
@@ -5652,23 +5652,23 @@ var require_cst_visit = __commonJS({
|
|
|
5652
5652
|
}
|
|
5653
5653
|
return item;
|
|
5654
5654
|
};
|
|
5655
|
-
visit.parentCollection = (cst,
|
|
5656
|
-
const parent = visit.itemAtPath(cst,
|
|
5657
|
-
const field =
|
|
5655
|
+
visit.parentCollection = (cst, path4) => {
|
|
5656
|
+
const parent = visit.itemAtPath(cst, path4.slice(0, -1));
|
|
5657
|
+
const field = path4[path4.length - 1][0];
|
|
5658
5658
|
const coll = parent?.[field];
|
|
5659
5659
|
if (coll && "items" in coll)
|
|
5660
5660
|
return coll;
|
|
5661
5661
|
throw new Error("Parent collection not found");
|
|
5662
5662
|
};
|
|
5663
|
-
function _visit(
|
|
5664
|
-
let ctrl = visitor(item,
|
|
5663
|
+
function _visit(path4, item, visitor) {
|
|
5664
|
+
let ctrl = visitor(item, path4);
|
|
5665
5665
|
if (typeof ctrl === "symbol")
|
|
5666
5666
|
return ctrl;
|
|
5667
5667
|
for (const field of ["key", "value"]) {
|
|
5668
5668
|
const token = item[field];
|
|
5669
5669
|
if (token && "items" in token) {
|
|
5670
5670
|
for (let i = 0; i < token.items.length; ++i) {
|
|
5671
|
-
const ci = _visit(Object.freeze(
|
|
5671
|
+
const ci = _visit(Object.freeze(path4.concat([[field, i]])), token.items[i], visitor);
|
|
5672
5672
|
if (typeof ci === "number")
|
|
5673
5673
|
i = ci - 1;
|
|
5674
5674
|
else if (ci === BREAK)
|
|
@@ -5679,10 +5679,10 @@ var require_cst_visit = __commonJS({
|
|
|
5679
5679
|
}
|
|
5680
5680
|
}
|
|
5681
5681
|
if (typeof ctrl === "function" && field === "key")
|
|
5682
|
-
ctrl = ctrl(item,
|
|
5682
|
+
ctrl = ctrl(item, path4);
|
|
5683
5683
|
}
|
|
5684
5684
|
}
|
|
5685
|
-
return typeof ctrl === "function" ? ctrl(item,
|
|
5685
|
+
return typeof ctrl === "function" ? ctrl(item, path4) : ctrl;
|
|
5686
5686
|
}
|
|
5687
5687
|
exports.visit = visit;
|
|
5688
5688
|
}
|
|
@@ -6988,14 +6988,14 @@ var require_parser = __commonJS({
|
|
|
6988
6988
|
case "scalar":
|
|
6989
6989
|
case "single-quoted-scalar":
|
|
6990
6990
|
case "double-quoted-scalar": {
|
|
6991
|
-
const
|
|
6991
|
+
const fs4 = this.flowScalar(this.type);
|
|
6992
6992
|
if (atNextItem || it2.value) {
|
|
6993
|
-
map2.items.push({ start, key:
|
|
6993
|
+
map2.items.push({ start, key: fs4, sep: [] });
|
|
6994
6994
|
this.onKeyLine = true;
|
|
6995
6995
|
} else if (it2.sep) {
|
|
6996
|
-
this.stack.push(
|
|
6996
|
+
this.stack.push(fs4);
|
|
6997
6997
|
} else {
|
|
6998
|
-
Object.assign(it2, { key:
|
|
6998
|
+
Object.assign(it2, { key: fs4, sep: [] });
|
|
6999
6999
|
this.onKeyLine = true;
|
|
7000
7000
|
}
|
|
7001
7001
|
return;
|
|
@@ -7123,13 +7123,13 @@ var require_parser = __commonJS({
|
|
|
7123
7123
|
case "scalar":
|
|
7124
7124
|
case "single-quoted-scalar":
|
|
7125
7125
|
case "double-quoted-scalar": {
|
|
7126
|
-
const
|
|
7126
|
+
const fs4 = this.flowScalar(this.type);
|
|
7127
7127
|
if (!it2 || it2.value)
|
|
7128
|
-
fc.items.push({ start: [], key:
|
|
7128
|
+
fc.items.push({ start: [], key: fs4, sep: [] });
|
|
7129
7129
|
else if (it2.sep)
|
|
7130
|
-
this.stack.push(
|
|
7130
|
+
this.stack.push(fs4);
|
|
7131
7131
|
else
|
|
7132
|
-
Object.assign(it2, { key:
|
|
7132
|
+
Object.assign(it2, { key: fs4, sep: [] });
|
|
7133
7133
|
return;
|
|
7134
7134
|
}
|
|
7135
7135
|
case "flow-map-end":
|
|
@@ -10880,15 +10880,15 @@ var require_pg_connection_string = __commonJS({
|
|
|
10880
10880
|
if (config3.sslnegotiation === "direct" && config3.ssl === void 0) {
|
|
10881
10881
|
config3.ssl = true;
|
|
10882
10882
|
}
|
|
10883
|
-
const
|
|
10883
|
+
const fs4 = config3.sslcert || config3.sslkey || config3.sslrootcert ? __require("fs") : null;
|
|
10884
10884
|
if (config3.sslcert) {
|
|
10885
|
-
config3.ssl.cert =
|
|
10885
|
+
config3.ssl.cert = fs4.readFileSync(config3.sslcert).toString();
|
|
10886
10886
|
}
|
|
10887
10887
|
if (config3.sslkey) {
|
|
10888
|
-
config3.ssl.key =
|
|
10888
|
+
config3.ssl.key = fs4.readFileSync(config3.sslkey).toString();
|
|
10889
10889
|
}
|
|
10890
10890
|
if (config3.sslrootcert) {
|
|
10891
|
-
config3.ssl.ca =
|
|
10891
|
+
config3.ssl.ca = fs4.readFileSync(config3.sslrootcert).toString();
|
|
10892
10892
|
}
|
|
10893
10893
|
if (options.useLibpqCompat && config3.uselibpqcompat) {
|
|
10894
10894
|
throw new Error("Both useLibpqCompat and uselibpqcompat are set. Please use only one of them.");
|
|
@@ -12722,7 +12722,7 @@ var require_helper = __commonJS({
|
|
|
12722
12722
|
"../../node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/helper.js"(exports, module) {
|
|
12723
12723
|
"use strict";
|
|
12724
12724
|
init_esm_shims();
|
|
12725
|
-
var
|
|
12725
|
+
var path4 = __require("path");
|
|
12726
12726
|
var Stream = __require("stream").Stream;
|
|
12727
12727
|
var split = require_split2();
|
|
12728
12728
|
var util = __require("util");
|
|
@@ -12761,7 +12761,7 @@ var require_helper = __commonJS({
|
|
|
12761
12761
|
};
|
|
12762
12762
|
module.exports.getFileName = function(rawEnv) {
|
|
12763
12763
|
var env = rawEnv || process.env;
|
|
12764
|
-
var file2 = env.PGPASSFILE || (isWin ?
|
|
12764
|
+
var file2 = env.PGPASSFILE || (isWin ? path4.join(env.APPDATA || "./", "postgresql", "pgpass.conf") : path4.join(env.HOME || "./", ".pgpass"));
|
|
12765
12765
|
return file2;
|
|
12766
12766
|
};
|
|
12767
12767
|
module.exports.usePgPass = function(stats, fname) {
|
|
@@ -12894,16 +12894,16 @@ var require_lib = __commonJS({
|
|
|
12894
12894
|
"../../node_modules/.pnpm/pgpass@1.0.5/node_modules/pgpass/lib/index.js"(exports, module) {
|
|
12895
12895
|
"use strict";
|
|
12896
12896
|
init_esm_shims();
|
|
12897
|
-
var
|
|
12898
|
-
var
|
|
12897
|
+
var path4 = __require("path");
|
|
12898
|
+
var fs4 = __require("fs");
|
|
12899
12899
|
var helper = require_helper();
|
|
12900
12900
|
module.exports = function(connInfo, cb) {
|
|
12901
12901
|
var file2 = helper.getFileName();
|
|
12902
|
-
|
|
12902
|
+
fs4.stat(file2, function(err, stat) {
|
|
12903
12903
|
if (err || !helper.usePgPass(stat, file2)) {
|
|
12904
12904
|
return cb(void 0);
|
|
12905
12905
|
}
|
|
12906
|
-
var st =
|
|
12906
|
+
var st = fs4.createReadStream(file2);
|
|
12907
12907
|
helper.getPassword(connInfo, st, cb);
|
|
12908
12908
|
});
|
|
12909
12909
|
};
|
|
@@ -15256,10 +15256,10 @@ function mergeDefs(...defs) {
|
|
|
15256
15256
|
function cloneDef(schema) {
|
|
15257
15257
|
return mergeDefs(schema._zod.def);
|
|
15258
15258
|
}
|
|
15259
|
-
function getElementAtPath(obj,
|
|
15260
|
-
if (!
|
|
15259
|
+
function getElementAtPath(obj, path4) {
|
|
15260
|
+
if (!path4)
|
|
15261
15261
|
return obj;
|
|
15262
|
-
return
|
|
15262
|
+
return path4.reduce((acc, key) => acc?.[key], obj);
|
|
15263
15263
|
}
|
|
15264
15264
|
function promiseAllObject(promisesObj) {
|
|
15265
15265
|
const keys = Object.keys(promisesObj);
|
|
@@ -15668,11 +15668,11 @@ function explicitlyAborted(x2, startIndex = 0) {
|
|
|
15668
15668
|
}
|
|
15669
15669
|
return false;
|
|
15670
15670
|
}
|
|
15671
|
-
function prefixIssues(
|
|
15671
|
+
function prefixIssues(path4, issues) {
|
|
15672
15672
|
return issues.map((iss) => {
|
|
15673
15673
|
var _a3;
|
|
15674
15674
|
(_a3 = iss).path ?? (_a3.path = []);
|
|
15675
|
-
iss.path.unshift(
|
|
15675
|
+
iss.path.unshift(path4);
|
|
15676
15676
|
return iss;
|
|
15677
15677
|
});
|
|
15678
15678
|
}
|
|
@@ -15819,16 +15819,16 @@ function flattenError(error51, mapper = (issue2) => issue2.message) {
|
|
|
15819
15819
|
}
|
|
15820
15820
|
function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
15821
15821
|
const fieldErrors = { _errors: [] };
|
|
15822
|
-
const processError = (error52,
|
|
15822
|
+
const processError = (error52, path4 = []) => {
|
|
15823
15823
|
for (const issue2 of error52.issues) {
|
|
15824
15824
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
15825
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
15825
|
+
issue2.errors.map((issues) => processError({ issues }, [...path4, ...issue2.path]));
|
|
15826
15826
|
} else if (issue2.code === "invalid_key") {
|
|
15827
|
-
processError({ issues: issue2.issues }, [...
|
|
15827
|
+
processError({ issues: issue2.issues }, [...path4, ...issue2.path]);
|
|
15828
15828
|
} else if (issue2.code === "invalid_element") {
|
|
15829
|
-
processError({ issues: issue2.issues }, [...
|
|
15829
|
+
processError({ issues: issue2.issues }, [...path4, ...issue2.path]);
|
|
15830
15830
|
} else {
|
|
15831
|
-
const fullpath = [...
|
|
15831
|
+
const fullpath = [...path4, ...issue2.path];
|
|
15832
15832
|
if (fullpath.length === 0) {
|
|
15833
15833
|
fieldErrors._errors.push(mapper(issue2));
|
|
15834
15834
|
} else {
|
|
@@ -15855,17 +15855,17 @@ function formatError(error51, mapper = (issue2) => issue2.message) {
|
|
|
15855
15855
|
}
|
|
15856
15856
|
function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
15857
15857
|
const result = { errors: [] };
|
|
15858
|
-
const processError = (error52,
|
|
15858
|
+
const processError = (error52, path4 = []) => {
|
|
15859
15859
|
var _a3, _b;
|
|
15860
15860
|
for (const issue2 of error52.issues) {
|
|
15861
15861
|
if (issue2.code === "invalid_union" && issue2.errors.length) {
|
|
15862
|
-
issue2.errors.map((issues) => processError({ issues }, [...
|
|
15862
|
+
issue2.errors.map((issues) => processError({ issues }, [...path4, ...issue2.path]));
|
|
15863
15863
|
} else if (issue2.code === "invalid_key") {
|
|
15864
|
-
processError({ issues: issue2.issues }, [...
|
|
15864
|
+
processError({ issues: issue2.issues }, [...path4, ...issue2.path]);
|
|
15865
15865
|
} else if (issue2.code === "invalid_element") {
|
|
15866
|
-
processError({ issues: issue2.issues }, [...
|
|
15866
|
+
processError({ issues: issue2.issues }, [...path4, ...issue2.path]);
|
|
15867
15867
|
} else {
|
|
15868
|
-
const fullpath = [...
|
|
15868
|
+
const fullpath = [...path4, ...issue2.path];
|
|
15869
15869
|
if (fullpath.length === 0) {
|
|
15870
15870
|
result.errors.push(mapper(issue2));
|
|
15871
15871
|
continue;
|
|
@@ -15897,8 +15897,8 @@ function treeifyError(error51, mapper = (issue2) => issue2.message) {
|
|
|
15897
15897
|
}
|
|
15898
15898
|
function toDotPath(_path) {
|
|
15899
15899
|
const segs = [];
|
|
15900
|
-
const
|
|
15901
|
-
for (const seg of
|
|
15900
|
+
const path4 = _path.map((seg) => typeof seg === "object" ? seg.key : seg);
|
|
15901
|
+
for (const seg of path4) {
|
|
15902
15902
|
if (typeof seg === "number")
|
|
15903
15903
|
segs.push(`[${seg}]`);
|
|
15904
15904
|
else if (typeof seg === "symbol")
|
|
@@ -28671,13 +28671,13 @@ function resolveRef(ref, ctx) {
|
|
|
28671
28671
|
if (!ref.startsWith("#")) {
|
|
28672
28672
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
28673
28673
|
}
|
|
28674
|
-
const
|
|
28675
|
-
if (
|
|
28674
|
+
const path4 = ref.slice(1).split("/").filter(Boolean);
|
|
28675
|
+
if (path4.length === 0) {
|
|
28676
28676
|
return ctx.rootSchema;
|
|
28677
28677
|
}
|
|
28678
28678
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
28679
|
-
if (
|
|
28680
|
-
const key =
|
|
28679
|
+
if (path4[0] === defsKey) {
|
|
28680
|
+
const key = path4[1];
|
|
28681
28681
|
if (!key || !ctx.defs[key]) {
|
|
28682
28682
|
throw new Error(`Reference not found: ${ref}`);
|
|
28683
28683
|
}
|
|
@@ -29088,6 +29088,8 @@ config(en_default());
|
|
|
29088
29088
|
|
|
29089
29089
|
// ../core/dist/index.mjs
|
|
29090
29090
|
var import_yaml = __toESM(require_dist(), 1);
|
|
29091
|
+
import * as fs2 from "fs";
|
|
29092
|
+
import * as path2 from "path";
|
|
29091
29093
|
import * as fs from "fs";
|
|
29092
29094
|
import * as path from "path";
|
|
29093
29095
|
var import_bcryptjs = __toESM(require_bcryptjs(), 1);
|
|
@@ -29119,7 +29121,19 @@ var refTargetMachineName = external_exports.string().regex(
|
|
|
29119
29121
|
var RawFieldBase = external_exports.object({
|
|
29120
29122
|
name: snakeCaseName,
|
|
29121
29123
|
label: external_exports.string().min(1),
|
|
29122
|
-
required: external_exports.boolean()
|
|
29124
|
+
required: external_exports.boolean(),
|
|
29125
|
+
// ─── Version declarations ───────────────────────────────────────────────────
|
|
29126
|
+
//
|
|
29127
|
+
// A field's storage column is STATED here, never derived from a rename
|
|
29128
|
+
// history. All three are optional and default to the pre-versioning
|
|
29129
|
+
// behaviour, so every schema authored before versioning existed keeps its
|
|
29130
|
+
// exact meaning.
|
|
29131
|
+
/** Storage column. Defaults to `name`. Stating it is how a rename works: the name changes, the column does not. */
|
|
29132
|
+
column: snakeCaseName.optional(),
|
|
29133
|
+
/** Tombstone — the column is retained for older live versions, and this version does not expose it. */
|
|
29134
|
+
removed: external_exports.boolean().optional(),
|
|
29135
|
+
/** Value served for rows created after the removal. Meaningful only on a tombstone. */
|
|
29136
|
+
fallback: external_exports.unknown().optional()
|
|
29123
29137
|
});
|
|
29124
29138
|
var RawTextPlainFieldSchema = RawFieldBase.extend({
|
|
29125
29139
|
type: external_exports.literal("text/plain"),
|
|
@@ -29456,6 +29470,17 @@ var FOLDER_KEY_TO_SCHEMA_TYPE = {
|
|
|
29456
29470
|
taxonomy_types: "taxonomy-type",
|
|
29457
29471
|
enum_types: "enum-type"
|
|
29458
29472
|
};
|
|
29473
|
+
function directoryExists(dirPath) {
|
|
29474
|
+
try {
|
|
29475
|
+
return fs.statSync(dirPath).isDirectory();
|
|
29476
|
+
} catch {
|
|
29477
|
+
return false;
|
|
29478
|
+
}
|
|
29479
|
+
}
|
|
29480
|
+
function isSupportedExtension(filename) {
|
|
29481
|
+
const ext = path.extname(filename).toLowerCase();
|
|
29482
|
+
return ext === ".json" || ext === ".yaml" || ext === ".yml";
|
|
29483
|
+
}
|
|
29459
29484
|
var SCHEMA_TYPE_TO_PREFIX = {
|
|
29460
29485
|
"content-type": "content",
|
|
29461
29486
|
"paragraph-type": "paragraph",
|
|
@@ -29465,7 +29490,7 @@ var SCHEMA_TYPE_TO_PREFIX = {
|
|
|
29465
29490
|
function loadSchemaFile(filePath) {
|
|
29466
29491
|
let raw2;
|
|
29467
29492
|
try {
|
|
29468
|
-
raw2 =
|
|
29493
|
+
raw2 = fs2.readFileSync(filePath, "utf-8");
|
|
29469
29494
|
} catch (err) {
|
|
29470
29495
|
return {
|
|
29471
29496
|
ok: false,
|
|
@@ -29478,7 +29503,7 @@ function loadSchemaFile(filePath) {
|
|
|
29478
29503
|
]
|
|
29479
29504
|
};
|
|
29480
29505
|
}
|
|
29481
|
-
const ext =
|
|
29506
|
+
const ext = path2.extname(filePath).toLowerCase();
|
|
29482
29507
|
if (ext === ".json") {
|
|
29483
29508
|
try {
|
|
29484
29509
|
return { ok: true, value: JSON.parse(raw2) };
|
|
@@ -29540,7 +29565,7 @@ function walkSchemaDirectory(config3) {
|
|
|
29540
29565
|
const resolvedFolderPaths = /* @__PURE__ */ new Map();
|
|
29541
29566
|
for (const folderKey of Object.keys(FOLDER_KEY_TO_SCHEMA_TYPE)) {
|
|
29542
29567
|
const folderName = config3.folders[folderKey];
|
|
29543
|
-
const absFolder =
|
|
29568
|
+
const absFolder = path2.resolve(config3.base_path, folderName);
|
|
29544
29569
|
const existing = resolvedFolderPaths.get(absFolder);
|
|
29545
29570
|
if (existing !== void 0) {
|
|
29546
29571
|
errors.push({
|
|
@@ -29557,7 +29582,7 @@ function walkSchemaDirectory(config3) {
|
|
|
29557
29582
|
FOLDER_KEY_TO_SCHEMA_TYPE
|
|
29558
29583
|
)) {
|
|
29559
29584
|
const folderName = config3.folders[folderKey];
|
|
29560
|
-
const folderPath =
|
|
29585
|
+
const folderPath = path2.resolve(config3.base_path, folderName);
|
|
29561
29586
|
if (!directoryExists(folderPath)) {
|
|
29562
29587
|
errors.push({
|
|
29563
29588
|
file: folderPath,
|
|
@@ -29570,8 +29595,8 @@ function walkSchemaDirectory(config3) {
|
|
|
29570
29595
|
const expectedPrefix = SCHEMA_TYPE_TO_PREFIX[schemaType];
|
|
29571
29596
|
for (const entry of entries) {
|
|
29572
29597
|
if (!isSupportedExtension(entry)) continue;
|
|
29573
|
-
const filePath =
|
|
29574
|
-
const baseName =
|
|
29598
|
+
const filePath = path2.join(folderPath, entry);
|
|
29599
|
+
const baseName = path2.basename(entry, path2.extname(entry));
|
|
29575
29600
|
if (!hasCorrectPrefix(baseName, expectedPrefix)) {
|
|
29576
29601
|
errors.push({
|
|
29577
29602
|
file: filePath,
|
|
@@ -29591,24 +29616,13 @@ function walkSchemaDirectory(config3) {
|
|
|
29591
29616
|
if (errors.length > 0) return { ok: false, errors };
|
|
29592
29617
|
return { ok: true, value: files };
|
|
29593
29618
|
}
|
|
29594
|
-
function directoryExists(dirPath) {
|
|
29595
|
-
try {
|
|
29596
|
-
return fs.statSync(dirPath).isDirectory();
|
|
29597
|
-
} catch {
|
|
29598
|
-
return false;
|
|
29599
|
-
}
|
|
29600
|
-
}
|
|
29601
29619
|
function readDirEntries(dirPath) {
|
|
29602
29620
|
try {
|
|
29603
|
-
return
|
|
29621
|
+
return fs2.readdirSync(dirPath);
|
|
29604
29622
|
} catch {
|
|
29605
29623
|
return [];
|
|
29606
29624
|
}
|
|
29607
29625
|
}
|
|
29608
|
-
function isSupportedExtension(filename) {
|
|
29609
|
-
const ext = path.extname(filename).toLowerCase();
|
|
29610
|
-
return ext === ".json" || ext === ".yaml" || ext === ".yml";
|
|
29611
|
-
}
|
|
29612
29626
|
function hasCorrectPrefix(baseName, expectedPrefix) {
|
|
29613
29627
|
return baseName.startsWith(`${expectedPrefix}--`);
|
|
29614
29628
|
}
|
|
@@ -29791,6 +29805,10 @@ var fieldTypeRegistry = {
|
|
|
29791
29805
|
ui_component: { component: "computed-display" }
|
|
29792
29806
|
})
|
|
29793
29807
|
};
|
|
29808
|
+
function isColumnBacked2(field) {
|
|
29809
|
+
const col = field.db_column;
|
|
29810
|
+
return col !== null && col.column_name !== "" && !col.junction;
|
|
29811
|
+
}
|
|
29794
29812
|
var CONTENT_SYSTEM_FIELDS = [
|
|
29795
29813
|
{ name: "id", db_type: "uuid", primary_key: true, default: "gen_random_uuid()", nullable: false },
|
|
29796
29814
|
{ name: "slug", db_type: "varchar", nullable: false },
|
|
@@ -29821,8 +29839,8 @@ function getNameSegment(machineName) {
|
|
|
29821
29839
|
const idx = machineName.indexOf("--");
|
|
29822
29840
|
return idx === -1 ? machineName : machineName.slice(idx + 2);
|
|
29823
29841
|
}
|
|
29824
|
-
function zodPathToString(
|
|
29825
|
-
return
|
|
29842
|
+
function zodPathToString(path4) {
|
|
29843
|
+
return path4.reduce((acc, seg) => {
|
|
29826
29844
|
const s = typeof seg === "symbol" ? String(seg) : seg;
|
|
29827
29845
|
return typeof s === "number" ? `${acc}[${s}]` : acc ? `${acc}.${s}` : s;
|
|
29828
29846
|
}, "");
|
|
@@ -29858,6 +29876,61 @@ function checkDuplicateFieldNames(fields, sourceFile, schemaName) {
|
|
|
29858
29876
|
}
|
|
29859
29877
|
return errors;
|
|
29860
29878
|
}
|
|
29879
|
+
function hasStorageColumn(f) {
|
|
29880
|
+
if (f.type === "paragraph" || f.type === "programmatic") return false;
|
|
29881
|
+
if (f.type === "reference" && f.rel === "many-to-many") return false;
|
|
29882
|
+
return true;
|
|
29883
|
+
}
|
|
29884
|
+
function checkDuplicateColumns(fields, sourceFile, schemaName) {
|
|
29885
|
+
const owner = /* @__PURE__ */ new Map();
|
|
29886
|
+
const errors = [];
|
|
29887
|
+
for (const f of fields) {
|
|
29888
|
+
if (!hasStorageColumn(f)) continue;
|
|
29889
|
+
const column = f.column ?? f.name;
|
|
29890
|
+
const first = owner.get(column);
|
|
29891
|
+
if (first !== void 0) {
|
|
29892
|
+
errors.push({
|
|
29893
|
+
file: sourceFile,
|
|
29894
|
+
code: "DUPLICATE_COLUMN",
|
|
29895
|
+
message: `Fields "${first}" and "${f.name}" in schema "${schemaName}" both resolve to column "${column}". One column backs exactly one field. If "${f.name}" replaced "${first}", delete the old field instead of keeping both; if they are genuinely different fields, give one an explicit "column".`
|
|
29896
|
+
});
|
|
29897
|
+
continue;
|
|
29898
|
+
}
|
|
29899
|
+
owner.set(column, f.name);
|
|
29900
|
+
}
|
|
29901
|
+
return errors;
|
|
29902
|
+
}
|
|
29903
|
+
function checkFieldDeclarations(rawField, built, sourceFile, schemaName) {
|
|
29904
|
+
const errors = [];
|
|
29905
|
+
const tombstone = rawField.removed === true;
|
|
29906
|
+
if (!isColumnBacked2(built) && (rawField.column !== void 0 || tombstone)) {
|
|
29907
|
+
const declaredKeys = [
|
|
29908
|
+
...rawField.column !== void 0 ? ['"column"'] : [],
|
|
29909
|
+
...tombstone ? ['"removed"'] : []
|
|
29910
|
+
];
|
|
29911
|
+
const declared = declaredKeys.join(" and ");
|
|
29912
|
+
errors.push({
|
|
29913
|
+
file: sourceFile,
|
|
29914
|
+
code: "UNRENAMEABLE_FIELD_KIND",
|
|
29915
|
+
message: `Field "${rawField.name}" in "${schemaName}" declares ${declared}, but a ${rawField.type} field has no storage column of its own \u2014 its name already is its identity, so there is nothing to rename or retain. Remove the declaration.`
|
|
29916
|
+
});
|
|
29917
|
+
}
|
|
29918
|
+
if (tombstone && rawField.required) {
|
|
29919
|
+
errors.push({
|
|
29920
|
+
file: sourceFile,
|
|
29921
|
+
code: "TOMBSTONE_REQUIRED",
|
|
29922
|
+
message: `Field "${rawField.name}" in "${schemaName}" is marked both "removed" and "required". A tombstone retains a column nothing writes any more, so a required tombstone can never be satisfied. Set "required": false, or remove "removed" to bring the field back.`
|
|
29923
|
+
});
|
|
29924
|
+
}
|
|
29925
|
+
if (rawField.fallback !== void 0 && !tombstone) {
|
|
29926
|
+
errors.push({
|
|
29927
|
+
file: sourceFile,
|
|
29928
|
+
code: "FALLBACK_WITHOUT_TOMBSTONE",
|
|
29929
|
+
message: `Field "${rawField.name}" in "${schemaName}" declares a "fallback" but is not marked "removed": true. A fallback is the value served for rows created after a removal, so it is meaningful only on a tombstone. Add "removed": true, or remove the fallback.`
|
|
29930
|
+
});
|
|
29931
|
+
}
|
|
29932
|
+
return errors;
|
|
29933
|
+
}
|
|
29861
29934
|
function buildParsedField(rawField, order, sourceFile, ownerTableName) {
|
|
29862
29935
|
const build = fieldTypeRegistry[rawField.type];
|
|
29863
29936
|
if (!build) {
|
|
@@ -29871,20 +29944,40 @@ function buildParsedField(rawField, order, sourceFile, ownerTableName) {
|
|
|
29871
29944
|
};
|
|
29872
29945
|
}
|
|
29873
29946
|
const { name, label } = rawField;
|
|
29874
|
-
const
|
|
29947
|
+
const built = build(rawField, { ownerTableName });
|
|
29948
|
+
const declErrors = checkFieldDeclarations(rawField, built, sourceFile, ownerTableName);
|
|
29949
|
+
if (declErrors.length > 0) return { ok: false, errors: declErrors };
|
|
29950
|
+
const { validation, ui_component } = built;
|
|
29875
29951
|
const required2 = validation.required;
|
|
29952
|
+
const tombstone = rawField.removed === true;
|
|
29953
|
+
let db_column = built.db_column;
|
|
29954
|
+
if (isColumnBacked2(built)) {
|
|
29955
|
+
db_column = {
|
|
29956
|
+
...db_column,
|
|
29957
|
+
column_name: rawField.column ?? db_column.column_name,
|
|
29958
|
+
// A tombstone is always nullable, overriding the builder — including
|
|
29959
|
+
// `boolean`, the one type whose column is otherwise always NOT NULL.
|
|
29960
|
+
// Rows written after the removal cannot populate the column.
|
|
29961
|
+
...tombstone && { nullable: true }
|
|
29962
|
+
};
|
|
29963
|
+
}
|
|
29876
29964
|
return {
|
|
29877
29965
|
ok: true,
|
|
29878
29966
|
value: {
|
|
29879
29967
|
name,
|
|
29880
29968
|
label,
|
|
29881
29969
|
field_type: rawField.type,
|
|
29882
|
-
required
|
|
29883
|
-
|
|
29970
|
+
// Nothing writes a tombstone, so it can be neither required nor NOT NULL.
|
|
29971
|
+
required: tombstone ? false : required2,
|
|
29972
|
+
nullable: tombstone ? true : !required2,
|
|
29884
29973
|
order,
|
|
29885
|
-
validation,
|
|
29974
|
+
validation: tombstone ? { ...validation, required: false } : validation,
|
|
29886
29975
|
db_column,
|
|
29887
|
-
ui_component
|
|
29976
|
+
ui_component,
|
|
29977
|
+
// Omitted entirely when absent, never set to `false`/`undefined`: an
|
|
29978
|
+
// ordinary field must be byte-identical to its pre-versioning shape.
|
|
29979
|
+
...tombstone && { removed: true },
|
|
29980
|
+
...rawField.fallback !== void 0 && { fallback: rawField.fallback }
|
|
29888
29981
|
}
|
|
29889
29982
|
};
|
|
29890
29983
|
}
|
|
@@ -29918,7 +30011,10 @@ function parseContentType(raw2, sourceFile) {
|
|
|
29918
30011
|
}
|
|
29919
30012
|
tabs.push({ name: tab.name, label: tab.label, fields: tabFieldNames });
|
|
29920
30013
|
}
|
|
29921
|
-
const dupErrors =
|
|
30014
|
+
const dupErrors = [
|
|
30015
|
+
...checkDuplicateFieldNames(flatRawFields, sourceFile, v2.name),
|
|
30016
|
+
...checkDuplicateColumns(flatRawFields, sourceFile, v2.name)
|
|
30017
|
+
];
|
|
29922
30018
|
if (dupErrors.length > 0) return { ok: false, errors: dupErrors };
|
|
29923
30019
|
const tableName = machineNameToTableName(v2.name);
|
|
29924
30020
|
const { fields, errors } = buildFields(flatRawFields, sourceFile, tableName);
|
|
@@ -29968,7 +30064,10 @@ function parseParagraphType(raw2, sourceFile) {
|
|
|
29968
30064
|
return { ok: false, errors: zodErrorsToParseErrors(result.error, sourceFile) };
|
|
29969
30065
|
}
|
|
29970
30066
|
const v2 = result.data;
|
|
29971
|
-
const dupErrors =
|
|
30067
|
+
const dupErrors = [
|
|
30068
|
+
...checkDuplicateFieldNames(v2.fields, sourceFile, v2.name),
|
|
30069
|
+
...checkDuplicateColumns(v2.fields, sourceFile, v2.name)
|
|
30070
|
+
];
|
|
29972
30071
|
if (dupErrors.length > 0) return { ok: false, errors: dupErrors };
|
|
29973
30072
|
const tableName = machineNameToTableName(v2.name);
|
|
29974
30073
|
const { fields, errors } = buildFields(v2.fields, sourceFile, tableName);
|
|
@@ -29990,7 +30089,10 @@ function parseTaxonomyType(raw2, sourceFile) {
|
|
|
29990
30089
|
return { ok: false, errors: zodErrorsToParseErrors(result.error, sourceFile) };
|
|
29991
30090
|
}
|
|
29992
30091
|
const v2 = result.data;
|
|
29993
|
-
const dupErrors =
|
|
30092
|
+
const dupErrors = [
|
|
30093
|
+
...checkDuplicateFieldNames(v2.fields, sourceFile, v2.name),
|
|
30094
|
+
...checkDuplicateColumns(v2.fields, sourceFile, v2.name)
|
|
30095
|
+
];
|
|
29994
30096
|
if (dupErrors.length > 0) return { ok: false, errors: dupErrors };
|
|
29995
30097
|
const tableName = machineNameToTableName(v2.name);
|
|
29996
30098
|
const { fields, errors } = buildFields(v2.fields, sourceFile, tableName);
|
|
@@ -30365,7 +30467,7 @@ init_esm_shims();
|
|
|
30365
30467
|
function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
30366
30468
|
const nullifyMap = {};
|
|
30367
30469
|
const result = columns.reduce(
|
|
30368
|
-
(result2, { path:
|
|
30470
|
+
(result2, { path: path4, field }, columnIndex) => {
|
|
30369
30471
|
let decoder;
|
|
30370
30472
|
if (is(field, Column)) {
|
|
30371
30473
|
decoder = field;
|
|
@@ -30377,8 +30479,8 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
|
30377
30479
|
decoder = field.sql.decoder;
|
|
30378
30480
|
}
|
|
30379
30481
|
let node = result2;
|
|
30380
|
-
for (const [pathChunkIndex, pathChunk] of
|
|
30381
|
-
if (pathChunkIndex <
|
|
30482
|
+
for (const [pathChunkIndex, pathChunk] of path4.entries()) {
|
|
30483
|
+
if (pathChunkIndex < path4.length - 1) {
|
|
30382
30484
|
if (!(pathChunk in node)) {
|
|
30383
30485
|
node[pathChunk] = {};
|
|
30384
30486
|
}
|
|
@@ -30386,8 +30488,8 @@ function mapResultRow(columns, row, joinsNotNullableMap) {
|
|
|
30386
30488
|
} else {
|
|
30387
30489
|
const rawValue = row[columnIndex];
|
|
30388
30490
|
const value = node[pathChunk] = rawValue === null ? null : decoder.mapFromDriverValue(rawValue);
|
|
30389
|
-
if (joinsNotNullableMap && is(field, Column) &&
|
|
30390
|
-
const objectName =
|
|
30491
|
+
if (joinsNotNullableMap && is(field, Column) && path4.length === 2) {
|
|
30492
|
+
const objectName = path4[0];
|
|
30391
30493
|
if (!(objectName in nullifyMap)) {
|
|
30392
30494
|
nullifyMap[objectName] = value === null ? getTableName(field.table) : false;
|
|
30393
30495
|
} else if (typeof nullifyMap[objectName] === "string" && nullifyMap[objectName] !== getTableName(field.table)) {
|
|
@@ -38842,7 +38944,7 @@ var ds = T((th, ps) => {
|
|
|
38842
38944
|
return /^(?:[a-zA-Z0-9+/]{4})*(?:[a-zA-Z0-9+/]{2}==|[a-zA-Z0-9+/]{3}=)?$/.test(r);
|
|
38843
38945
|
}
|
|
38844
38946
|
a(ls, "isBase64");
|
|
38845
|
-
function
|
|
38947
|
+
function fs4(r) {
|
|
38846
38948
|
if (typeof r != "string") throw new TypeError("SASL: attribute pairs text must be a string");
|
|
38847
38949
|
return new Map(r.split(",").map((e) => {
|
|
38848
38950
|
if (!/^.=/.test(e)) throw new Error("SASL: Invalid attribute pair entry");
|
|
@@ -38850,9 +38952,9 @@ var ds = T((th, ps) => {
|
|
|
38850
38952
|
return [t, n];
|
|
38851
38953
|
}));
|
|
38852
38954
|
}
|
|
38853
|
-
a(
|
|
38955
|
+
a(fs4, "parseAttributePairs");
|
|
38854
38956
|
function qu(r) {
|
|
38855
|
-
let e =
|
|
38957
|
+
let e = fs4(r), t = e.get("r");
|
|
38856
38958
|
if (t) {
|
|
38857
38959
|
if (!Ou(t)) throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce must only contain printable characters");
|
|
38858
38960
|
} else throw new Error("SASL: SCRAM-SERVER-FIRST-MESSAGE: nonce missing");
|
|
@@ -38869,7 +38971,7 @@ var ds = T((th, ps) => {
|
|
|
38869
38971
|
}
|
|
38870
38972
|
a(qu, "parseServerFirstMessage");
|
|
38871
38973
|
function Qu(r) {
|
|
38872
|
-
let t =
|
|
38974
|
+
let t = fs4(r).get("v");
|
|
38873
38975
|
if (t) {
|
|
38874
38976
|
if (!ls(t)) throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature must be base64");
|
|
38875
38977
|
} else throw new Error("SASL: SCRAM-SERVER-FINAL-MESSAGE: server signature is missing");
|
|
@@ -41605,8 +41707,8 @@ function drizzle2(...params) {
|
|
|
41605
41707
|
// ../db/dist/index.mjs
|
|
41606
41708
|
import { execSync, spawnSync } from "child_process";
|
|
41607
41709
|
import crypto2 from "crypto";
|
|
41608
|
-
import
|
|
41609
|
-
import
|
|
41710
|
+
import path3 from "path";
|
|
41711
|
+
import fs3 from "fs/promises";
|
|
41610
41712
|
import { readFileSync as readFileSync2 } from "fs";
|
|
41611
41713
|
import path22 from "path";
|
|
41612
41714
|
function createPostgresAdapter(options = {}) {
|
|
@@ -42092,32 +42194,32 @@ async function seedSystemTables(db, registry2, options = {}) {
|
|
|
42092
42194
|
}
|
|
42093
42195
|
function resolvedPathEnv() {
|
|
42094
42196
|
const root = process.cwd();
|
|
42095
|
-
const localBin =
|
|
42096
|
-
const existing = (process.env.PATH ?? "").split(
|
|
42097
|
-
return { ...process.env, PATH: [localBin, ...existing].join(
|
|
42197
|
+
const localBin = path3.join(root, "node_modules", ".bin");
|
|
42198
|
+
const existing = (process.env.PATH ?? "").split(path3.delimiter).filter(Boolean).map((entry) => path3.isAbsolute(entry) ? entry : path3.resolve(root, entry));
|
|
42199
|
+
return { ...process.env, PATH: [localBin, ...existing].join(path3.delimiter) };
|
|
42098
42200
|
}
|
|
42099
42201
|
async function runDevMigration(configPath) {
|
|
42100
42202
|
execSync(`drizzle-kit push --config=${configPath}`, {
|
|
42101
42203
|
stdio: "inherit",
|
|
42102
|
-
cwd:
|
|
42204
|
+
cwd: path3.dirname(configPath),
|
|
42103
42205
|
env: resolvedPathEnv()
|
|
42104
42206
|
});
|
|
42105
42207
|
}
|
|
42106
42208
|
async function generateMigration(configPath, migrationsFolder) {
|
|
42107
42209
|
let beforeFiles = [];
|
|
42108
42210
|
try {
|
|
42109
|
-
const entries = await
|
|
42211
|
+
const entries = await fs3.readdir(migrationsFolder);
|
|
42110
42212
|
beforeFiles = entries.filter((f) => f.endsWith(".sql"));
|
|
42111
42213
|
} catch {
|
|
42112
42214
|
}
|
|
42113
42215
|
execSync(`drizzle-kit generate --config=${configPath}`, {
|
|
42114
42216
|
stdio: "inherit",
|
|
42115
|
-
cwd:
|
|
42217
|
+
cwd: path3.dirname(configPath),
|
|
42116
42218
|
env: resolvedPathEnv()
|
|
42117
42219
|
});
|
|
42118
42220
|
let afterFiles = [];
|
|
42119
42221
|
try {
|
|
42120
|
-
const entries = await
|
|
42222
|
+
const entries = await fs3.readdir(migrationsFolder);
|
|
42121
42223
|
afterFiles = entries.filter((f) => f.endsWith(".sql"));
|
|
42122
42224
|
} catch {
|
|
42123
42225
|
}
|
|
@@ -42138,16 +42240,16 @@ async function applyMigrations(configPath, db, options) {
|
|
|
42138
42240
|
if (statusBefore.pending.length > 0) {
|
|
42139
42241
|
let journalEntries = [];
|
|
42140
42242
|
try {
|
|
42141
|
-
const journalPath =
|
|
42142
|
-
const raw2 = await
|
|
42243
|
+
const journalPath = path3.join(migrationsFolder, "meta", "_journal.json");
|
|
42244
|
+
const raw2 = await fs3.readFile(journalPath, "utf-8");
|
|
42143
42245
|
journalEntries = JSON.parse(raw2).entries;
|
|
42144
42246
|
} catch {
|
|
42145
42247
|
}
|
|
42146
42248
|
for (const pendingFile of statusBefore.pending) {
|
|
42147
|
-
const sqlPath =
|
|
42249
|
+
const sqlPath = path3.join(migrationsFolder, pendingFile);
|
|
42148
42250
|
let sqlContent;
|
|
42149
42251
|
try {
|
|
42150
|
-
sqlContent = await
|
|
42252
|
+
sqlContent = await fs3.readFile(sqlPath, "utf-8");
|
|
42151
42253
|
} catch {
|
|
42152
42254
|
continue;
|
|
42153
42255
|
}
|
|
@@ -42177,7 +42279,7 @@ async function applyMigrations(configPath, db, options) {
|
|
|
42177
42279
|
"drizzle-kit",
|
|
42178
42280
|
["migrate", `--config=${configPath}`],
|
|
42179
42281
|
{
|
|
42180
|
-
cwd:
|
|
42282
|
+
cwd: path3.dirname(configPath),
|
|
42181
42283
|
// inherit lets drizzle-kit write its spinner and errors directly to the
|
|
42182
42284
|
// terminal in real time — capturing stdout/stderr swallows ANSI overwrites
|
|
42183
42285
|
// and hides the actual error message.
|
|
@@ -42203,8 +42305,8 @@ async function getMigrationStatus(db, options) {
|
|
|
42203
42305
|
const { migrationsTable, migrationsFolder } = options;
|
|
42204
42306
|
let journalEntries;
|
|
42205
42307
|
try {
|
|
42206
|
-
const journalPath =
|
|
42207
|
-
const raw2 = await
|
|
42308
|
+
const journalPath = path3.join(migrationsFolder, "meta", "_journal.json");
|
|
42309
|
+
const raw2 = await fs3.readFile(journalPath, "utf-8");
|
|
42208
42310
|
const journal = JSON.parse(raw2);
|
|
42209
42311
|
journalEntries = journal.entries;
|
|
42210
42312
|
} catch {
|
|
@@ -43082,7 +43184,7 @@ function renderField(field, indent) {
|
|
|
43082
43184
|
return lines.join("\n");
|
|
43083
43185
|
}
|
|
43084
43186
|
function generateFormComponent(schema) {
|
|
43085
|
-
const
|
|
43187
|
+
const fields = schema.fields.filter((f) => f.removed !== true);
|
|
43086
43188
|
const neededComponents = /* @__PURE__ */ new Set();
|
|
43087
43189
|
const paragraphRefs = [];
|
|
43088
43190
|
const seenRefs = /* @__PURE__ */ new Set();
|
|
@@ -43132,7 +43234,9 @@ function generateFormComponent(schema) {
|
|
|
43132
43234
|
for (const tab of schema.ui.tabs) {
|
|
43133
43235
|
templateLines.push(` <Tab name="${escAttr(tab.name)}" label="${escAttr(tab.label)}">`);
|
|
43134
43236
|
for (const fieldName of tab.fields) {
|
|
43135
|
-
|
|
43237
|
+
const field = fieldByName.get(fieldName);
|
|
43238
|
+
if (!field) continue;
|
|
43239
|
+
templateLines.push(renderField(field, " "));
|
|
43136
43240
|
}
|
|
43137
43241
|
templateLines.push(" </Tab>");
|
|
43138
43242
|
}
|
|
@@ -43646,7 +43750,7 @@ function walkFiles(dir) {
|
|
|
43646
43750
|
init_esm_shims();
|
|
43647
43751
|
import { createServer as createHttpServer } from "http";
|
|
43648
43752
|
import { existsSync as existsSync5 } from "fs";
|
|
43649
|
-
import { resolve as resolve6, join as join11, dirname as dirname2, extname as
|
|
43753
|
+
import { resolve as resolve6, join as join11, dirname as dirname2, extname as extname4 } from "path";
|
|
43650
43754
|
import { mkdir as mkdir2, writeFile as writeFile8, watch, readFile } from "fs/promises";
|
|
43651
43755
|
import { createRequire as createRequire2 } from "module";
|
|
43652
43756
|
import { createServer as createViteServer, searchForWorkspaceRoot } from "vite";
|
|
@@ -43823,26 +43927,26 @@ var handleParsingNestedValues = (form, key, value) => {
|
|
|
43823
43927
|
|
|
43824
43928
|
// ../../node_modules/.pnpm/hono@4.12.28/node_modules/hono/dist/utils/url.js
|
|
43825
43929
|
init_esm_shims();
|
|
43826
|
-
var splitPath = (
|
|
43827
|
-
const paths =
|
|
43930
|
+
var splitPath = (path4) => {
|
|
43931
|
+
const paths = path4.split("/");
|
|
43828
43932
|
if (paths[0] === "") {
|
|
43829
43933
|
paths.shift();
|
|
43830
43934
|
}
|
|
43831
43935
|
return paths;
|
|
43832
43936
|
};
|
|
43833
43937
|
var splitRoutingPath = (routePath) => {
|
|
43834
|
-
const { groups, path:
|
|
43835
|
-
const paths = splitPath(
|
|
43938
|
+
const { groups, path: path4 } = extractGroupsFromPath(routePath);
|
|
43939
|
+
const paths = splitPath(path4);
|
|
43836
43940
|
return replaceGroupMarks(paths, groups);
|
|
43837
43941
|
};
|
|
43838
|
-
var extractGroupsFromPath = (
|
|
43942
|
+
var extractGroupsFromPath = (path4) => {
|
|
43839
43943
|
const groups = [];
|
|
43840
|
-
|
|
43944
|
+
path4 = path4.replace(/\{[^}]+\}/g, (match2, index) => {
|
|
43841
43945
|
const mark = `@${index}`;
|
|
43842
43946
|
groups.push([mark, match2]);
|
|
43843
43947
|
return mark;
|
|
43844
43948
|
});
|
|
43845
|
-
return { groups, path:
|
|
43949
|
+
return { groups, path: path4 };
|
|
43846
43950
|
};
|
|
43847
43951
|
var replaceGroupMarks = (paths, groups) => {
|
|
43848
43952
|
for (let i = groups.length - 1; i >= 0; i--) {
|
|
@@ -43899,8 +44003,8 @@ var getPath = (request) => {
|
|
|
43899
44003
|
const queryIndex = url2.indexOf("?", i);
|
|
43900
44004
|
const hashIndex = url2.indexOf("#", i);
|
|
43901
44005
|
const end = queryIndex === -1 ? hashIndex === -1 ? void 0 : hashIndex : hashIndex === -1 ? queryIndex : Math.min(queryIndex, hashIndex);
|
|
43902
|
-
const
|
|
43903
|
-
return tryDecodeURI(
|
|
44006
|
+
const path4 = url2.slice(start, end);
|
|
44007
|
+
return tryDecodeURI(path4.includes("%25") ? path4.replace(/%25/g, "%2525") : path4);
|
|
43904
44008
|
} else if (charCode === 63 || charCode === 35) {
|
|
43905
44009
|
break;
|
|
43906
44010
|
}
|
|
@@ -43917,11 +44021,11 @@ var mergePath = (base, sub, ...rest) => {
|
|
|
43917
44021
|
}
|
|
43918
44022
|
return `${base?.[0] === "/" ? "" : "/"}${base}${sub === "/" ? "" : `${base?.at(-1) === "/" ? "" : "/"}${sub?.[0] === "/" ? sub.slice(1) : sub}`}`;
|
|
43919
44023
|
};
|
|
43920
|
-
var checkOptionalParameter = (
|
|
43921
|
-
if (
|
|
44024
|
+
var checkOptionalParameter = (path4) => {
|
|
44025
|
+
if (path4.charCodeAt(path4.length - 1) !== 63 || !path4.includes(":")) {
|
|
43922
44026
|
return null;
|
|
43923
44027
|
}
|
|
43924
|
-
const segments =
|
|
44028
|
+
const segments = path4.split("/");
|
|
43925
44029
|
const results = [];
|
|
43926
44030
|
let basePath = "";
|
|
43927
44031
|
segments.forEach((segment) => {
|
|
@@ -44062,9 +44166,9 @@ var HonoRequest = class {
|
|
|
44062
44166
|
*/
|
|
44063
44167
|
path;
|
|
44064
44168
|
bodyCache = {};
|
|
44065
|
-
constructor(request,
|
|
44169
|
+
constructor(request, path4 = "/", matchResult = [[]]) {
|
|
44066
44170
|
this.raw = request;
|
|
44067
|
-
this.path =
|
|
44171
|
+
this.path = path4;
|
|
44068
44172
|
this.#matchResult = matchResult;
|
|
44069
44173
|
this.#validatedData = {};
|
|
44070
44174
|
}
|
|
@@ -44819,8 +44923,8 @@ var Hono = class _Hono {
|
|
|
44819
44923
|
return this;
|
|
44820
44924
|
};
|
|
44821
44925
|
});
|
|
44822
|
-
this.on = (method,
|
|
44823
|
-
for (const p2 of [
|
|
44926
|
+
this.on = (method, path4, ...handlers) => {
|
|
44927
|
+
for (const p2 of [path4].flat()) {
|
|
44824
44928
|
this.#path = p2;
|
|
44825
44929
|
for (const m2 of [method].flat()) {
|
|
44826
44930
|
handlers.map((handler) => {
|
|
@@ -44877,8 +44981,8 @@ var Hono = class _Hono {
|
|
|
44877
44981
|
* app.route("/api", app2) // GET /api/user
|
|
44878
44982
|
* ```
|
|
44879
44983
|
*/
|
|
44880
|
-
route(
|
|
44881
|
-
const subApp = this.basePath(
|
|
44984
|
+
route(path4, app) {
|
|
44985
|
+
const subApp = this.basePath(path4);
|
|
44882
44986
|
app.routes.map((r) => {
|
|
44883
44987
|
let handler;
|
|
44884
44988
|
if (app.errorHandler === errorHandler) {
|
|
@@ -44904,9 +45008,9 @@ var Hono = class _Hono {
|
|
|
44904
45008
|
* const api = new Hono().basePath('/api')
|
|
44905
45009
|
* ```
|
|
44906
45010
|
*/
|
|
44907
|
-
basePath(
|
|
45011
|
+
basePath(path4) {
|
|
44908
45012
|
const subApp = this.#clone();
|
|
44909
|
-
subApp._basePath = mergePath(this._basePath,
|
|
45013
|
+
subApp._basePath = mergePath(this._basePath, path4);
|
|
44910
45014
|
return subApp;
|
|
44911
45015
|
}
|
|
44912
45016
|
/**
|
|
@@ -44980,7 +45084,7 @@ var Hono = class _Hono {
|
|
|
44980
45084
|
* })
|
|
44981
45085
|
* ```
|
|
44982
45086
|
*/
|
|
44983
|
-
mount(
|
|
45087
|
+
mount(path4, applicationHandler, options) {
|
|
44984
45088
|
let replaceRequest;
|
|
44985
45089
|
let optionHandler;
|
|
44986
45090
|
if (options) {
|
|
@@ -45007,7 +45111,7 @@ var Hono = class _Hono {
|
|
|
45007
45111
|
return [c.env, executionContext];
|
|
45008
45112
|
};
|
|
45009
45113
|
replaceRequest ||= (() => {
|
|
45010
|
-
const mergedPath = mergePath(this._basePath,
|
|
45114
|
+
const mergedPath = mergePath(this._basePath, path4);
|
|
45011
45115
|
const pathPrefixLength = mergedPath === "/" ? 0 : mergedPath.length;
|
|
45012
45116
|
return (request) => {
|
|
45013
45117
|
const url2 = new URL(request.url);
|
|
@@ -45022,19 +45126,19 @@ var Hono = class _Hono {
|
|
|
45022
45126
|
}
|
|
45023
45127
|
await next();
|
|
45024
45128
|
};
|
|
45025
|
-
this.#addRoute(METHOD_NAME_ALL, mergePath(
|
|
45129
|
+
this.#addRoute(METHOD_NAME_ALL, mergePath(path4, "*"), handler);
|
|
45026
45130
|
return this;
|
|
45027
45131
|
}
|
|
45028
|
-
#addRoute(method,
|
|
45132
|
+
#addRoute(method, path4, handler, baseRoutePath) {
|
|
45029
45133
|
method = method.toUpperCase();
|
|
45030
|
-
|
|
45134
|
+
path4 = mergePath(this._basePath, path4);
|
|
45031
45135
|
const r = {
|
|
45032
45136
|
basePath: baseRoutePath !== void 0 ? mergePath(this._basePath, baseRoutePath) : this._basePath,
|
|
45033
|
-
path:
|
|
45137
|
+
path: path4,
|
|
45034
45138
|
method,
|
|
45035
45139
|
handler
|
|
45036
45140
|
};
|
|
45037
|
-
this.router.add(method,
|
|
45141
|
+
this.router.add(method, path4, [handler, r]);
|
|
45038
45142
|
this.routes.push(r);
|
|
45039
45143
|
}
|
|
45040
45144
|
#handleError(err, c) {
|
|
@@ -45047,10 +45151,10 @@ var Hono = class _Hono {
|
|
|
45047
45151
|
if (method === "HEAD") {
|
|
45048
45152
|
return (async () => new Response(null, await this.#dispatch(request, executionCtx, env, "GET")))();
|
|
45049
45153
|
}
|
|
45050
|
-
const
|
|
45051
|
-
const matchResult = this.router.match(method,
|
|
45154
|
+
const path4 = this.getPath(request, { env });
|
|
45155
|
+
const matchResult = this.router.match(method, path4);
|
|
45052
45156
|
const c = new Context(request, {
|
|
45053
|
-
path:
|
|
45157
|
+
path: path4,
|
|
45054
45158
|
matchResult,
|
|
45055
45159
|
env,
|
|
45056
45160
|
executionCtx,
|
|
@@ -45157,7 +45261,7 @@ init_esm_shims();
|
|
|
45157
45261
|
// ../../node_modules/.pnpm/hono@4.12.28/node_modules/hono/dist/router/reg-exp-router/matcher.js
|
|
45158
45262
|
init_esm_shims();
|
|
45159
45263
|
var emptyParam = [];
|
|
45160
|
-
function match(method,
|
|
45264
|
+
function match(method, path4) {
|
|
45161
45265
|
const matchers = this.buildAllMatchers();
|
|
45162
45266
|
const match2 = ((method2, path23) => {
|
|
45163
45267
|
const matcher = matchers[method2] || matchers[METHOD_NAME_ALL];
|
|
@@ -45173,7 +45277,7 @@ function match(method, path3) {
|
|
|
45173
45277
|
return [matcher[1][index], match3];
|
|
45174
45278
|
});
|
|
45175
45279
|
this.match = match2;
|
|
45176
|
-
return match2(method,
|
|
45280
|
+
return match2(method, path4);
|
|
45177
45281
|
}
|
|
45178
45282
|
|
|
45179
45283
|
// ../../node_modules/.pnpm/hono@4.12.28/node_modules/hono/dist/router/reg-exp-router/node.js
|
|
@@ -45290,12 +45394,12 @@ init_esm_shims();
|
|
|
45290
45394
|
var Trie = class {
|
|
45291
45395
|
#context = { varIndex: 0 };
|
|
45292
45396
|
#root = new Node();
|
|
45293
|
-
insert(
|
|
45397
|
+
insert(path4, index, pathErrorCheckOnly) {
|
|
45294
45398
|
const paramAssoc = [];
|
|
45295
45399
|
const groups = [];
|
|
45296
45400
|
for (let i = 0; ; ) {
|
|
45297
45401
|
let replaced = false;
|
|
45298
|
-
|
|
45402
|
+
path4 = path4.replace(/\{[^}]+\}/g, (m2) => {
|
|
45299
45403
|
const mark = `@\\${i}`;
|
|
45300
45404
|
groups[i] = [mark, m2];
|
|
45301
45405
|
i++;
|
|
@@ -45306,7 +45410,7 @@ var Trie = class {
|
|
|
45306
45410
|
break;
|
|
45307
45411
|
}
|
|
45308
45412
|
}
|
|
45309
|
-
const tokens =
|
|
45413
|
+
const tokens = path4.match(/(?::[^\/]+)|(?:\/\*$)|./g) || [];
|
|
45310
45414
|
for (let i = groups.length - 1; i >= 0; i--) {
|
|
45311
45415
|
const [mark] = groups[i];
|
|
45312
45416
|
for (let j = tokens.length - 1; j >= 0; j--) {
|
|
@@ -45345,9 +45449,9 @@ var Trie = class {
|
|
|
45345
45449
|
// ../../node_modules/.pnpm/hono@4.12.28/node_modules/hono/dist/router/reg-exp-router/router.js
|
|
45346
45450
|
var nullMatcher = [/^$/, [], /* @__PURE__ */ Object.create(null)];
|
|
45347
45451
|
var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
|
|
45348
|
-
function buildWildcardRegExp(
|
|
45349
|
-
return wildcardRegExpCache[
|
|
45350
|
-
|
|
45452
|
+
function buildWildcardRegExp(path4) {
|
|
45453
|
+
return wildcardRegExpCache[path4] ??= new RegExp(
|
|
45454
|
+
path4 === "*" ? "" : `^${path4.replace(
|
|
45351
45455
|
/\/\*$|([.\\+*[^\]$()])/g,
|
|
45352
45456
|
(_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)"
|
|
45353
45457
|
)}$`
|
|
@@ -45369,17 +45473,17 @@ function buildMatcherFromPreprocessedRoutes(routes) {
|
|
|
45369
45473
|
);
|
|
45370
45474
|
const staticMap = /* @__PURE__ */ Object.create(null);
|
|
45371
45475
|
for (let i = 0, j = -1, len = routesWithStaticPathFlag.length; i < len; i++) {
|
|
45372
|
-
const [pathErrorCheckOnly,
|
|
45476
|
+
const [pathErrorCheckOnly, path4, handlers] = routesWithStaticPathFlag[i];
|
|
45373
45477
|
if (pathErrorCheckOnly) {
|
|
45374
|
-
staticMap[
|
|
45478
|
+
staticMap[path4] = [handlers.map(([h]) => [h, /* @__PURE__ */ Object.create(null)]), emptyParam];
|
|
45375
45479
|
} else {
|
|
45376
45480
|
j++;
|
|
45377
45481
|
}
|
|
45378
45482
|
let paramAssoc;
|
|
45379
45483
|
try {
|
|
45380
|
-
paramAssoc = trie.insert(
|
|
45484
|
+
paramAssoc = trie.insert(path4, j, pathErrorCheckOnly);
|
|
45381
45485
|
} catch (e) {
|
|
45382
|
-
throw e === PATH_ERROR ? new UnsupportedPathError(
|
|
45486
|
+
throw e === PATH_ERROR ? new UnsupportedPathError(path4) : e;
|
|
45383
45487
|
}
|
|
45384
45488
|
if (pathErrorCheckOnly) {
|
|
45385
45489
|
continue;
|
|
@@ -45413,12 +45517,12 @@ function buildMatcherFromPreprocessedRoutes(routes) {
|
|
|
45413
45517
|
}
|
|
45414
45518
|
return [regexp, handlerMap, staticMap];
|
|
45415
45519
|
}
|
|
45416
|
-
function findMiddleware(middleware,
|
|
45520
|
+
function findMiddleware(middleware, path4) {
|
|
45417
45521
|
if (!middleware) {
|
|
45418
45522
|
return void 0;
|
|
45419
45523
|
}
|
|
45420
45524
|
for (const k of Object.keys(middleware).sort((a2, b2) => b2.length - a2.length)) {
|
|
45421
|
-
if (buildWildcardRegExp(k).test(
|
|
45525
|
+
if (buildWildcardRegExp(k).test(path4)) {
|
|
45422
45526
|
return [...middleware[k]];
|
|
45423
45527
|
}
|
|
45424
45528
|
}
|
|
@@ -45432,7 +45536,7 @@ var RegExpRouter = class {
|
|
|
45432
45536
|
this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
|
|
45433
45537
|
this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
|
|
45434
45538
|
}
|
|
45435
|
-
add(method,
|
|
45539
|
+
add(method, path4, handler) {
|
|
45436
45540
|
const middleware = this.#middleware;
|
|
45437
45541
|
const routes = this.#routes;
|
|
45438
45542
|
if (!middleware || !routes) {
|
|
@@ -45447,18 +45551,18 @@ var RegExpRouter = class {
|
|
|
45447
45551
|
});
|
|
45448
45552
|
});
|
|
45449
45553
|
}
|
|
45450
|
-
if (
|
|
45451
|
-
|
|
45554
|
+
if (path4 === "/*") {
|
|
45555
|
+
path4 = "*";
|
|
45452
45556
|
}
|
|
45453
|
-
const paramCount = (
|
|
45454
|
-
if (/\*$/.test(
|
|
45455
|
-
const re = buildWildcardRegExp(
|
|
45557
|
+
const paramCount = (path4.match(/\/:/g) || []).length;
|
|
45558
|
+
if (/\*$/.test(path4)) {
|
|
45559
|
+
const re = buildWildcardRegExp(path4);
|
|
45456
45560
|
if (method === METHOD_NAME_ALL) {
|
|
45457
45561
|
Object.keys(middleware).forEach((m2) => {
|
|
45458
|
-
middleware[m2][
|
|
45562
|
+
middleware[m2][path4] ||= findMiddleware(middleware[m2], path4) || findMiddleware(middleware[METHOD_NAME_ALL], path4) || [];
|
|
45459
45563
|
});
|
|
45460
45564
|
} else {
|
|
45461
|
-
middleware[method][
|
|
45565
|
+
middleware[method][path4] ||= findMiddleware(middleware[method], path4) || findMiddleware(middleware[METHOD_NAME_ALL], path4) || [];
|
|
45462
45566
|
}
|
|
45463
45567
|
Object.keys(middleware).forEach((m2) => {
|
|
45464
45568
|
if (method === METHOD_NAME_ALL || method === m2) {
|
|
@@ -45476,7 +45580,7 @@ var RegExpRouter = class {
|
|
|
45476
45580
|
});
|
|
45477
45581
|
return;
|
|
45478
45582
|
}
|
|
45479
|
-
const paths = checkOptionalParameter(
|
|
45583
|
+
const paths = checkOptionalParameter(path4) || [path4];
|
|
45480
45584
|
for (let i = 0, len = paths.length; i < len; i++) {
|
|
45481
45585
|
const path23 = paths[i];
|
|
45482
45586
|
Object.keys(routes).forEach((m2) => {
|
|
@@ -45503,13 +45607,13 @@ var RegExpRouter = class {
|
|
|
45503
45607
|
const routes = [];
|
|
45504
45608
|
let hasOwnRoute = method === METHOD_NAME_ALL;
|
|
45505
45609
|
[this.#middleware, this.#routes].forEach((r) => {
|
|
45506
|
-
const ownRoute = r[method] ? Object.keys(r[method]).map((
|
|
45610
|
+
const ownRoute = r[method] ? Object.keys(r[method]).map((path4) => [path4, r[method][path4]]) : [];
|
|
45507
45611
|
if (ownRoute.length !== 0) {
|
|
45508
45612
|
hasOwnRoute ||= true;
|
|
45509
45613
|
routes.push(...ownRoute);
|
|
45510
45614
|
} else if (method !== METHOD_NAME_ALL) {
|
|
45511
45615
|
routes.push(
|
|
45512
|
-
...Object.keys(r[METHOD_NAME_ALL]).map((
|
|
45616
|
+
...Object.keys(r[METHOD_NAME_ALL]).map((path4) => [path4, r[METHOD_NAME_ALL][path4]])
|
|
45513
45617
|
);
|
|
45514
45618
|
}
|
|
45515
45619
|
});
|
|
@@ -45536,13 +45640,13 @@ var SmartRouter = class {
|
|
|
45536
45640
|
constructor(init) {
|
|
45537
45641
|
this.#routers = init.routers;
|
|
45538
45642
|
}
|
|
45539
|
-
add(method,
|
|
45643
|
+
add(method, path4, handler) {
|
|
45540
45644
|
if (!this.#routes) {
|
|
45541
45645
|
throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
|
|
45542
45646
|
}
|
|
45543
|
-
this.#routes.push([method,
|
|
45647
|
+
this.#routes.push([method, path4, handler]);
|
|
45544
45648
|
}
|
|
45545
|
-
match(method,
|
|
45649
|
+
match(method, path4) {
|
|
45546
45650
|
if (!this.#routes) {
|
|
45547
45651
|
throw new Error("Fatal error");
|
|
45548
45652
|
}
|
|
@@ -45557,7 +45661,7 @@ var SmartRouter = class {
|
|
|
45557
45661
|
for (let i2 = 0, len2 = routes.length; i2 < len2; i2++) {
|
|
45558
45662
|
router.add(...routes[i2]);
|
|
45559
45663
|
}
|
|
45560
|
-
res = router.match(method,
|
|
45664
|
+
res = router.match(method, path4);
|
|
45561
45665
|
} catch (e) {
|
|
45562
45666
|
if (e instanceof UnsupportedPathError) {
|
|
45563
45667
|
continue;
|
|
@@ -45614,10 +45718,10 @@ var Node2 = class _Node2 {
|
|
|
45614
45718
|
}
|
|
45615
45719
|
this.#patterns = [];
|
|
45616
45720
|
}
|
|
45617
|
-
insert(method,
|
|
45721
|
+
insert(method, path4, handler) {
|
|
45618
45722
|
this.#order = ++this.#order;
|
|
45619
45723
|
let curNode = this;
|
|
45620
|
-
const parts = splitRoutingPath(
|
|
45724
|
+
const parts = splitRoutingPath(path4);
|
|
45621
45725
|
const possibleKeys = [];
|
|
45622
45726
|
for (let i = 0, len = parts.length; i < len; i++) {
|
|
45623
45727
|
const p2 = parts[i];
|
|
@@ -45666,12 +45770,12 @@ var Node2 = class _Node2 {
|
|
|
45666
45770
|
}
|
|
45667
45771
|
}
|
|
45668
45772
|
}
|
|
45669
|
-
search(method,
|
|
45773
|
+
search(method, path4) {
|
|
45670
45774
|
const handlerSets = [];
|
|
45671
45775
|
this.#params = emptyParams;
|
|
45672
45776
|
const curNode = this;
|
|
45673
45777
|
let curNodes = [curNode];
|
|
45674
|
-
const parts = splitPath(
|
|
45778
|
+
const parts = splitPath(path4);
|
|
45675
45779
|
const curNodesQueue = [];
|
|
45676
45780
|
const len = parts.length;
|
|
45677
45781
|
let partOffsets = null;
|
|
@@ -45713,13 +45817,13 @@ var Node2 = class _Node2 {
|
|
|
45713
45817
|
if (matcher instanceof RegExp) {
|
|
45714
45818
|
if (partOffsets === null) {
|
|
45715
45819
|
partOffsets = new Array(len);
|
|
45716
|
-
let offset =
|
|
45820
|
+
let offset = path4[0] === "/" ? 1 : 0;
|
|
45717
45821
|
for (let p2 = 0; p2 < len; p2++) {
|
|
45718
45822
|
partOffsets[p2] = offset;
|
|
45719
45823
|
offset += parts[p2].length + 1;
|
|
45720
45824
|
}
|
|
45721
45825
|
}
|
|
45722
|
-
const restPathString =
|
|
45826
|
+
const restPathString = path4.substring(partOffsets[i]);
|
|
45723
45827
|
const m2 = matcher.exec(restPathString);
|
|
45724
45828
|
if (m2) {
|
|
45725
45829
|
params[name] = m2[0];
|
|
@@ -45772,18 +45876,18 @@ var TrieRouter = class {
|
|
|
45772
45876
|
constructor() {
|
|
45773
45877
|
this.#node = new Node2();
|
|
45774
45878
|
}
|
|
45775
|
-
add(method,
|
|
45776
|
-
const results = checkOptionalParameter(
|
|
45879
|
+
add(method, path4, handler) {
|
|
45880
|
+
const results = checkOptionalParameter(path4);
|
|
45777
45881
|
if (results) {
|
|
45778
45882
|
for (let i = 0, len = results.length; i < len; i++) {
|
|
45779
45883
|
this.#node.insert(method, results[i], handler);
|
|
45780
45884
|
}
|
|
45781
45885
|
return;
|
|
45782
45886
|
}
|
|
45783
|
-
this.#node.insert(method,
|
|
45887
|
+
this.#node.insert(method, path4, handler);
|
|
45784
45888
|
}
|
|
45785
|
-
match(method,
|
|
45786
|
-
return this.#node.search(method,
|
|
45889
|
+
match(method, path4) {
|
|
45890
|
+
return this.#node.search(method, path4);
|
|
45787
45891
|
}
|
|
45788
45892
|
};
|
|
45789
45893
|
|
|
@@ -46713,8 +46817,8 @@ function setAuthCookie(c, name, token, options) {
|
|
|
46713
46817
|
sameSite: "Strict"
|
|
46714
46818
|
});
|
|
46715
46819
|
}
|
|
46716
|
-
function clearAuthCookie(c, name,
|
|
46717
|
-
deleteCookie(c, name,
|
|
46820
|
+
function clearAuthCookie(c, name, path4) {
|
|
46821
|
+
deleteCookie(c, name, path4 !== void 0 ? { path: path4 } : void 0);
|
|
46718
46822
|
}
|
|
46719
46823
|
function createAuthMiddleware(db) {
|
|
46720
46824
|
return async (c, next) => {
|
|
@@ -47122,6 +47226,52 @@ function createProgrammaticResolver(resolvers, options) {
|
|
|
47122
47226
|
}
|
|
47123
47227
|
return { resolveItem, resolveList, hasSchema };
|
|
47124
47228
|
}
|
|
47229
|
+
function isPlainRow(v2) {
|
|
47230
|
+
return typeof v2 === "object" && v2 !== null && !Array.isArray(v2) && !(v2 instanceof Date);
|
|
47231
|
+
}
|
|
47232
|
+
var MEDIA_FIELD_TYPES = /* @__PURE__ */ new Set(["image", "video", "file"]);
|
|
47233
|
+
function nestedTargets(fields) {
|
|
47234
|
+
const out = [];
|
|
47235
|
+
for (const f of fields) {
|
|
47236
|
+
if (MEDIA_FIELD_TYPES.has(f.field_type)) continue;
|
|
47237
|
+
if (f.field_type !== "paragraph" && f.field_type !== "reference") continue;
|
|
47238
|
+
const ref = f.ui_component.ref;
|
|
47239
|
+
if (!ref) continue;
|
|
47240
|
+
out.push({ label: f.name, target: ref });
|
|
47241
|
+
}
|
|
47242
|
+
return out;
|
|
47243
|
+
}
|
|
47244
|
+
function buildProjectors(registry2, fieldKeyMaps) {
|
|
47245
|
+
const projectors = {};
|
|
47246
|
+
const sources = [
|
|
47247
|
+
registry2.content_types,
|
|
47248
|
+
registry2.taxonomy_types,
|
|
47249
|
+
registry2.paragraph_types
|
|
47250
|
+
];
|
|
47251
|
+
for (const source of sources) {
|
|
47252
|
+
for (const [typeName, type] of Object.entries(source)) {
|
|
47253
|
+
const map2 = fieldKeyMaps[typeName];
|
|
47254
|
+
if (!map2) continue;
|
|
47255
|
+
projectors[typeName] = { map: map2, nested: nestedTargets(type.fields) };
|
|
47256
|
+
}
|
|
47257
|
+
}
|
|
47258
|
+
return projectors;
|
|
47259
|
+
}
|
|
47260
|
+
function projectRow(row, typeName, projectors) {
|
|
47261
|
+
const p2 = projectors[typeName];
|
|
47262
|
+
if (!p2) return row;
|
|
47263
|
+
const out = p2.map.toLabels(row);
|
|
47264
|
+
for (const { label, target } of p2.nested) {
|
|
47265
|
+
const v2 = out[label];
|
|
47266
|
+
if (v2 === null || v2 === void 0) continue;
|
|
47267
|
+
if (Array.isArray(v2)) {
|
|
47268
|
+
out[label] = v2.map((item) => isPlainRow(item) ? projectRow(item, target, projectors) : item);
|
|
47269
|
+
} else if (isPlainRow(v2)) {
|
|
47270
|
+
out[label] = projectRow(v2, target, projectors);
|
|
47271
|
+
}
|
|
47272
|
+
}
|
|
47273
|
+
return out;
|
|
47274
|
+
}
|
|
47125
47275
|
var SORTABLE_FIELDS = /* @__PURE__ */ new Set(["title", "created_at", "updated_at"]);
|
|
47126
47276
|
var RELATION_FIELD_TYPES = /* @__PURE__ */ new Set([
|
|
47127
47277
|
"paragraph",
|
|
@@ -47173,12 +47323,12 @@ function parseFilters(url2, validFields, columnFor) {
|
|
|
47173
47323
|
function isPublished(item) {
|
|
47174
47324
|
return item["published"] === true;
|
|
47175
47325
|
}
|
|
47176
|
-
function registerPublicContentRoutes(app, registry2, repos,
|
|
47177
|
-
function registerListRoute(
|
|
47326
|
+
function registerPublicContentRoutes(app, registry2, repos, projectors, paths, listRateLimit, resolver) {
|
|
47327
|
+
function registerListRoute(path4, handler) {
|
|
47178
47328
|
if (listRateLimit) {
|
|
47179
|
-
app.get(
|
|
47329
|
+
app.get(path4, listRateLimit, handler);
|
|
47180
47330
|
} else {
|
|
47181
|
-
app.get(
|
|
47331
|
+
app.get(path4, handler);
|
|
47182
47332
|
}
|
|
47183
47333
|
}
|
|
47184
47334
|
registerListRoute(paths.collection("content"), (c) => {
|
|
@@ -47216,13 +47366,14 @@ function registerPublicContentRoutes(app, registry2, repos, fieldKeyMaps, paths,
|
|
|
47216
47366
|
404
|
|
47217
47367
|
);
|
|
47218
47368
|
}
|
|
47219
|
-
let data =
|
|
47369
|
+
let data = projectRow(result.data[0], typeName, projectors);
|
|
47220
47370
|
if (resolver?.hasSchema(typeName)) data = await resolver.resolveItem(typeName, data);
|
|
47221
47371
|
return c.json({ ok: true, data });
|
|
47222
47372
|
});
|
|
47223
47373
|
} else {
|
|
47224
47374
|
registerListRoute(paths.collection(basePath), async (c) => {
|
|
47225
|
-
const
|
|
47375
|
+
const projector = projectors[typeName];
|
|
47376
|
+
const fieldKeys = projector.map;
|
|
47226
47377
|
const pagination = parsePagination(c.req.query("page"), c.req.query("per_page"));
|
|
47227
47378
|
if (!pagination.ok) {
|
|
47228
47379
|
return c.json(
|
|
@@ -47290,17 +47441,18 @@ function registerPublicContentRoutes(app, registry2, repos, fieldKeyMaps, paths,
|
|
|
47290
47441
|
);
|
|
47291
47442
|
}
|
|
47292
47443
|
}
|
|
47444
|
+
const sortColumn = fieldKeys.columnFor(sortBy) ?? sortBy;
|
|
47293
47445
|
const result = await repo.findMany({
|
|
47294
47446
|
published_only: true,
|
|
47295
47447
|
page: pagination.page,
|
|
47296
47448
|
per_page: pagination.per_page,
|
|
47297
|
-
sort_by:
|
|
47449
|
+
sort_by: sortColumn,
|
|
47298
47450
|
sort_order: sortOrder,
|
|
47299
47451
|
filters: filtersResult.filters,
|
|
47300
47452
|
include
|
|
47301
47453
|
});
|
|
47302
47454
|
const labeled = result.data.map(
|
|
47303
|
-
(row) =>
|
|
47455
|
+
(row) => projectRow(row, typeName, projectors)
|
|
47304
47456
|
);
|
|
47305
47457
|
const data = resolver?.hasSchema(typeName) ? await resolver.resolveList(typeName, labeled) : labeled;
|
|
47306
47458
|
return c.json({ ...result, data });
|
|
@@ -47332,7 +47484,7 @@ function registerPublicContentRoutes(app, registry2, repos, fieldKeyMaps, paths,
|
|
|
47332
47484
|
404
|
|
47333
47485
|
);
|
|
47334
47486
|
}
|
|
47335
|
-
let data =
|
|
47487
|
+
let data = projectRow(item, typeName, projectors);
|
|
47336
47488
|
if (resolver?.hasSchema(typeName)) data = await resolver.resolveItem(typeName, data);
|
|
47337
47489
|
return c.json({ ok: true, data });
|
|
47338
47490
|
});
|
|
@@ -47360,9 +47512,8 @@ function registerPublicContentRoutes(app, registry2, repos, fieldKeyMaps, paths,
|
|
|
47360
47512
|
page: pagination.page,
|
|
47361
47513
|
per_page: pagination.per_page
|
|
47362
47514
|
});
|
|
47363
|
-
const fieldKeys = fieldKeyMaps[typeName];
|
|
47364
47515
|
const labeled = result.data.map(
|
|
47365
|
-
(row) =>
|
|
47516
|
+
(row) => projectRow(row, typeName, projectors)
|
|
47366
47517
|
);
|
|
47367
47518
|
const data = resolver?.hasSchema(typeName) ? await resolver.resolveList(typeName, labeled) : labeled;
|
|
47368
47519
|
return c.json({ ...result, data });
|
|
@@ -47379,7 +47530,7 @@ function registerPublicContentRoutes(app, registry2, repos, fieldKeyMaps, paths,
|
|
|
47379
47530
|
404
|
|
47380
47531
|
);
|
|
47381
47532
|
}
|
|
47382
|
-
let data =
|
|
47533
|
+
let data = projectRow(item, typeName, projectors);
|
|
47383
47534
|
if (resolver?.hasSchema(typeName)) data = await resolver.resolveItem(typeName, data);
|
|
47384
47535
|
return c.json({ ok: true, data });
|
|
47385
47536
|
});
|
|
@@ -47584,7 +47735,7 @@ function parseListQuery(url2, schemaFieldNames, relationFieldNames, columnFor) {
|
|
|
47584
47735
|
search
|
|
47585
47736
|
};
|
|
47586
47737
|
}
|
|
47587
|
-
function registerAdminContentRoutes(app, registry2, repos,
|
|
47738
|
+
function registerAdminContentRoutes(app, registry2, repos, projectors, mediaRepo, requirePermission, db) {
|
|
47588
47739
|
for (const [typeName, contentType] of Object.entries(registry2.content_types)) {
|
|
47589
47740
|
const basePath = `content/${typeName}`;
|
|
47590
47741
|
const repo = repos[typeName];
|
|
@@ -47596,7 +47747,8 @@ function registerAdminContentRoutes(app, registry2, repos, fieldKeyMaps, mediaRe
|
|
|
47596
47747
|
const relationFieldNames = new Set(
|
|
47597
47748
|
contentType.fields.filter((f) => RELATION_FIELD_TYPES.has(f.field_type)).map((f) => f.name)
|
|
47598
47749
|
);
|
|
47599
|
-
const
|
|
47750
|
+
const projector = projectors[typeName];
|
|
47751
|
+
const fieldKeys = projector.map;
|
|
47600
47752
|
const requiredFields = contentType.fields.filter((f) => f.required);
|
|
47601
47753
|
const mediaFields = contentType.fields.filter(
|
|
47602
47754
|
(f) => f.field_type === "image" || f.field_type === "video" || f.field_type === "file"
|
|
@@ -47617,10 +47769,11 @@ function registerAdminContentRoutes(app, registry2, repos, fieldKeyMaps, mediaRe
|
|
|
47617
47769
|
const publishedParam = c.req.query("published");
|
|
47618
47770
|
const extraFilters = {};
|
|
47619
47771
|
if (publishedParam === "false") extraFilters["published"] = false;
|
|
47772
|
+
const sortColumn = fieldKeys.columnFor(parsed.sortBy) ?? parsed.sortBy;
|
|
47620
47773
|
const findOpts = {
|
|
47621
47774
|
page: parsed.pagination.page,
|
|
47622
47775
|
per_page: parsed.pagination.per_page,
|
|
47623
|
-
sort_by:
|
|
47776
|
+
sort_by: sortColumn,
|
|
47624
47777
|
sort_order: parsed.sortOrder,
|
|
47625
47778
|
filters: { ...parsed.filters, ...extraFilters },
|
|
47626
47779
|
include: parsed.include
|
|
@@ -47630,7 +47783,9 @@ function registerAdminContentRoutes(app, registry2, repos, fieldKeyMaps, mediaRe
|
|
|
47630
47783
|
findOpts.search = { term: parsed.search, columns: searchableColumns };
|
|
47631
47784
|
}
|
|
47632
47785
|
const result = await repo.findMany(findOpts);
|
|
47633
|
-
const data = result.data.map(
|
|
47786
|
+
const data = result.data.map(
|
|
47787
|
+
(row) => projectRow(row, typeName, projectors)
|
|
47788
|
+
);
|
|
47634
47789
|
return c.json({ ...result, data });
|
|
47635
47790
|
}
|
|
47636
47791
|
);
|
|
@@ -47666,7 +47821,7 @@ function registerAdminContentRoutes(app, registry2, repos, fieldKeyMaps, mediaRe
|
|
|
47666
47821
|
}
|
|
47667
47822
|
}
|
|
47668
47823
|
}
|
|
47669
|
-
const data =
|
|
47824
|
+
const data = projectRow(item, typeName, projectors);
|
|
47670
47825
|
return c.json({ ok: true, data });
|
|
47671
47826
|
}
|
|
47672
47827
|
);
|
|
@@ -47807,7 +47962,7 @@ function registerAdminContentRoutes(app, registry2, repos, fieldKeyMaps, mediaRe
|
|
|
47807
47962
|
}
|
|
47808
47963
|
}
|
|
47809
47964
|
await applyMediaReferenceDelta(mergeMediaDeltas(...mediaDeltas), mediaRepo);
|
|
47810
|
-
const data =
|
|
47965
|
+
const data = projectRow(item, typeName, projectors);
|
|
47811
47966
|
return c.json({ ok: true, data }, 201);
|
|
47812
47967
|
};
|
|
47813
47968
|
app.patch(
|
|
@@ -47928,7 +48083,7 @@ function registerAdminContentRoutes(app, registry2, repos, fieldKeyMaps, mediaRe
|
|
|
47928
48083
|
}
|
|
47929
48084
|
}
|
|
47930
48085
|
await applyMediaReferenceDelta(mergeMediaDeltas(...mediaDeltas), mediaRepo);
|
|
47931
|
-
const data =
|
|
48086
|
+
const data = projectRow(updated, typeName, projectors);
|
|
47932
48087
|
return c.json({ ok: true, data });
|
|
47933
48088
|
};
|
|
47934
48089
|
if (contentType.only_one) {
|
|
@@ -47989,7 +48144,8 @@ function registerAdminContentRoutes(app, registry2, repos, fieldKeyMaps, mediaRe
|
|
|
47989
48144
|
const relationFieldNames = new Set(
|
|
47990
48145
|
taxonomyType.fields.filter((f) => RELATION_FIELD_TYPES.has(f.field_type)).map((f) => f.name)
|
|
47991
48146
|
);
|
|
47992
|
-
const
|
|
48147
|
+
const projector = projectors[typeName];
|
|
48148
|
+
const fieldKeys = projector.map;
|
|
47993
48149
|
const requiredFields = taxonomyType.fields.filter((f) => f.required);
|
|
47994
48150
|
const mediaFields = taxonomyType.fields.filter(
|
|
47995
48151
|
(f) => f.field_type === "image" || f.field_type === "video" || f.field_type === "file"
|
|
@@ -48010,10 +48166,11 @@ function registerAdminContentRoutes(app, registry2, repos, fieldKeyMaps, mediaRe
|
|
|
48010
48166
|
const publishedParam = c.req.query("published");
|
|
48011
48167
|
const extraFilters = {};
|
|
48012
48168
|
if (publishedParam === "false") extraFilters["published"] = false;
|
|
48169
|
+
const sortColumn = fieldKeys.columnFor(parsed.sortBy) ?? parsed.sortBy;
|
|
48013
48170
|
const findOpts = {
|
|
48014
48171
|
page: parsed.pagination.page,
|
|
48015
48172
|
per_page: parsed.pagination.per_page,
|
|
48016
|
-
sort_by:
|
|
48173
|
+
sort_by: sortColumn,
|
|
48017
48174
|
sort_order: parsed.sortOrder,
|
|
48018
48175
|
filters: { ...parsed.filters, ...extraFilters },
|
|
48019
48176
|
include: parsed.include
|
|
@@ -48023,7 +48180,9 @@ function registerAdminContentRoutes(app, registry2, repos, fieldKeyMaps, mediaRe
|
|
|
48023
48180
|
findOpts.search = { term: parsed.search, columns: searchableColumns };
|
|
48024
48181
|
}
|
|
48025
48182
|
const result = await repo.findMany(findOpts);
|
|
48026
|
-
const data = result.data.map(
|
|
48183
|
+
const data = result.data.map(
|
|
48184
|
+
(row) => projectRow(row, typeName, projectors)
|
|
48185
|
+
);
|
|
48027
48186
|
return c.json({ ...result, data });
|
|
48028
48187
|
}
|
|
48029
48188
|
);
|
|
@@ -48039,7 +48198,7 @@ function registerAdminContentRoutes(app, registry2, repos, fieldKeyMaps, mediaRe
|
|
|
48039
48198
|
404
|
|
48040
48199
|
);
|
|
48041
48200
|
}
|
|
48042
|
-
const data =
|
|
48201
|
+
const data = projectRow(item, typeName, projectors);
|
|
48043
48202
|
return c.json({ ok: true, data });
|
|
48044
48203
|
}
|
|
48045
48204
|
);
|
|
@@ -48092,7 +48251,7 @@ function registerAdminContentRoutes(app, registry2, repos, fieldKeyMaps, mediaRe
|
|
|
48092
48251
|
}
|
|
48093
48252
|
}
|
|
48094
48253
|
await applyMediaReferenceDelta(mergeMediaDeltas(...mediaDeltas), mediaRepo);
|
|
48095
|
-
const data =
|
|
48254
|
+
const data = projectRow(item, typeName, projectors);
|
|
48096
48255
|
return c.json({ ok: true, data }, 201);
|
|
48097
48256
|
}
|
|
48098
48257
|
);
|
|
@@ -48160,7 +48319,7 @@ function registerAdminContentRoutes(app, registry2, repos, fieldKeyMaps, mediaRe
|
|
|
48160
48319
|
}
|
|
48161
48320
|
}
|
|
48162
48321
|
await applyMediaReferenceDelta(mergeMediaDeltas(...mediaDeltas), mediaRepo);
|
|
48163
|
-
const data =
|
|
48322
|
+
const data = projectRow(updated, typeName, projectors);
|
|
48164
48323
|
return c.json({ ok: true, data });
|
|
48165
48324
|
}
|
|
48166
48325
|
);
|
|
@@ -49134,7 +49293,7 @@ function registerUserRoutes(app, db, requirePermission, requireHierarchy) {
|
|
|
49134
49293
|
}
|
|
49135
49294
|
var API_VERSION = (() => {
|
|
49136
49295
|
try {
|
|
49137
|
-
return "0.4.
|
|
49296
|
+
return "0.4.2";
|
|
49138
49297
|
} catch {
|
|
49139
49298
|
return "0.0.0";
|
|
49140
49299
|
}
|
|
@@ -49177,6 +49336,9 @@ function registerConfigRoute(app, config3, registry2, db) {
|
|
|
49177
49336
|
});
|
|
49178
49337
|
});
|
|
49179
49338
|
}
|
|
49339
|
+
function liveFields(fields) {
|
|
49340
|
+
return fields.filter((f) => f.removed !== true);
|
|
49341
|
+
}
|
|
49180
49342
|
function registerSchemaRoute(app, registry2, db) {
|
|
49181
49343
|
app.get("/admin/api/schema", (c) => {
|
|
49182
49344
|
const content_types = Object.values(registry2.content_types).map((ct2) => ({
|
|
@@ -49185,19 +49347,19 @@ function registerSchemaRoute(app, registry2, db) {
|
|
|
49185
49347
|
only_one: ct2.only_one,
|
|
49186
49348
|
ui: ct2.ui,
|
|
49187
49349
|
system_fields: ct2.system_fields,
|
|
49188
|
-
fields: ct2.fields
|
|
49350
|
+
fields: liveFields(ct2.fields)
|
|
49189
49351
|
}));
|
|
49190
49352
|
const taxonomy_types = Object.values(registry2.taxonomy_types).map((tt2) => ({
|
|
49191
49353
|
name: tt2.name,
|
|
49192
49354
|
label: tt2.label,
|
|
49193
49355
|
system_fields: tt2.system_fields,
|
|
49194
|
-
fields: tt2.fields
|
|
49356
|
+
fields: liveFields(tt2.fields)
|
|
49195
49357
|
}));
|
|
49196
49358
|
const paragraph_types = Object.values(registry2.paragraph_types).map((pt) => ({
|
|
49197
49359
|
name: pt.name,
|
|
49198
49360
|
label: pt.label,
|
|
49199
49361
|
system_fields: pt.system_fields,
|
|
49200
|
-
fields: pt.fields
|
|
49362
|
+
fields: liveFields(pt.fields)
|
|
49201
49363
|
}));
|
|
49202
49364
|
const enum_types = Object.values(registry2.enum_types).map((et2) => ({
|
|
49203
49365
|
name: et2.name,
|
|
@@ -49289,7 +49451,7 @@ function whereFragment(conds) {
|
|
|
49289
49451
|
return conds.length > 0 ? sql` WHERE ${sql.join(conds, sql` AND `)}` : sql``;
|
|
49290
49452
|
}
|
|
49291
49453
|
function createDrizzleContentRepository(db, tableName, options = {}) {
|
|
49292
|
-
const { relations = {}, publishedRelations = false } = options;
|
|
49454
|
+
const { relations = {}, publishedRelations = false, sortableColumns } = options;
|
|
49293
49455
|
function tableRaw() {
|
|
49294
49456
|
return sql.raw(quoteIdent2(tableName));
|
|
49295
49457
|
}
|
|
@@ -49327,8 +49489,9 @@ function createDrizzleContentRepository(db, tableName, options = {}) {
|
|
|
49327
49489
|
sort_order = "asc",
|
|
49328
49490
|
search
|
|
49329
49491
|
} = opts;
|
|
49330
|
-
|
|
49331
|
-
|
|
49492
|
+
const allowed = sortableColumns ?? SORTABLE_FIELDS2;
|
|
49493
|
+
if (!allowed.has(sort_by)) {
|
|
49494
|
+
throw codeError("INVALID_SORT_FIELD", `'${sort_by}' is not sortable.`);
|
|
49332
49495
|
}
|
|
49333
49496
|
const offset = (page - 1) * per_page;
|
|
49334
49497
|
const conds = buildConditions(published_only, filters, search);
|
|
@@ -49567,16 +49730,38 @@ function createCmsApp(options) {
|
|
|
49567
49730
|
return result.rows[0]?.role ?? null;
|
|
49568
49731
|
};
|
|
49569
49732
|
const requireHierarchy = createHierarchyMiddleware(rolesRegistry, getUserRole);
|
|
49733
|
+
const fieldKeyMaps = Object.fromEntries([
|
|
49734
|
+
...Object.entries(registry2.content_types).map(([typeName, ct2]) => [
|
|
49735
|
+
typeName,
|
|
49736
|
+
createFieldKeyMap(ct2.fields)
|
|
49737
|
+
]),
|
|
49738
|
+
...Object.entries(registry2.taxonomy_types).map(([typeName, tt2]) => [
|
|
49739
|
+
typeName,
|
|
49740
|
+
createFieldKeyMap(tt2.fields)
|
|
49741
|
+
]),
|
|
49742
|
+
...Object.entries(registry2.paragraph_types).map(([typeName, pt]) => [
|
|
49743
|
+
typeName,
|
|
49744
|
+
createFieldKeyMap(pt.fields)
|
|
49745
|
+
])
|
|
49746
|
+
]);
|
|
49747
|
+
const projectors = buildProjectors(registry2, fieldKeyMaps);
|
|
49748
|
+
const sortableColumnsFor = (typeName) => new Set(
|
|
49749
|
+
[...SORTABLE_FIELDS].map((label) => fieldKeyMaps[typeName].columnFor(label) ?? label)
|
|
49750
|
+
);
|
|
49570
49751
|
const contentRepos = Object.fromEntries(
|
|
49571
49752
|
Object.entries(registry2.content_types).map(([typeName, ct2]) => [
|
|
49572
49753
|
typeName,
|
|
49573
|
-
createDrizzleContentRepository(db, ct2.db.table_name
|
|
49754
|
+
createDrizzleContentRepository(db, ct2.db.table_name, {
|
|
49755
|
+
sortableColumns: sortableColumnsFor(typeName)
|
|
49756
|
+
})
|
|
49574
49757
|
])
|
|
49575
49758
|
);
|
|
49576
49759
|
const taxonomyRepos = Object.fromEntries(
|
|
49577
49760
|
Object.entries(registry2.taxonomy_types).map(([typeName, tt2]) => [
|
|
49578
49761
|
typeName,
|
|
49579
|
-
createDrizzleContentRepository(db, tt2.db.table_name
|
|
49762
|
+
createDrizzleContentRepository(db, tt2.db.table_name, {
|
|
49763
|
+
sortableColumns: sortableColumnsFor(typeName)
|
|
49764
|
+
})
|
|
49580
49765
|
])
|
|
49581
49766
|
);
|
|
49582
49767
|
const repos = { ...contentRepos, ...taxonomyRepos };
|
|
@@ -49586,7 +49771,8 @@ function createCmsApp(options) {
|
|
|
49586
49771
|
typeName,
|
|
49587
49772
|
createDrizzleContentRepository(db, ct2.db.table_name, {
|
|
49588
49773
|
relations: buildRelationsMap(ct2.fields, registry2),
|
|
49589
|
-
publishedRelations: true
|
|
49774
|
+
publishedRelations: true,
|
|
49775
|
+
sortableColumns: sortableColumnsFor(typeName)
|
|
49590
49776
|
})
|
|
49591
49777
|
])
|
|
49592
49778
|
);
|
|
@@ -49595,7 +49781,8 @@ function createCmsApp(options) {
|
|
|
49595
49781
|
typeName,
|
|
49596
49782
|
createDrizzleContentRepository(db, tt2.db.table_name, {
|
|
49597
49783
|
relations: buildRelationsMap(tt2.fields, registry2),
|
|
49598
|
-
publishedRelations: true
|
|
49784
|
+
publishedRelations: true,
|
|
49785
|
+
sortableColumns: sortableColumnsFor(typeName)
|
|
49599
49786
|
})
|
|
49600
49787
|
])
|
|
49601
49788
|
);
|
|
@@ -49603,11 +49790,15 @@ function createCmsApp(options) {
|
|
|
49603
49790
|
const graphqlRepos = Object.fromEntries([
|
|
49604
49791
|
...Object.entries(registry2.content_types).map(([typeName, ct2]) => [
|
|
49605
49792
|
typeName,
|
|
49606
|
-
createDrizzleContentRepository(db, ct2.db.table_name
|
|
49793
|
+
createDrizzleContentRepository(db, ct2.db.table_name, {
|
|
49794
|
+
sortableColumns: sortableColumnsFor(typeName)
|
|
49795
|
+
})
|
|
49607
49796
|
]),
|
|
49608
49797
|
...Object.entries(registry2.taxonomy_types).map(([typeName, tt2]) => [
|
|
49609
49798
|
typeName,
|
|
49610
|
-
createDrizzleContentRepository(db, tt2.db.table_name
|
|
49799
|
+
createDrizzleContentRepository(db, tt2.db.table_name, {
|
|
49800
|
+
sortableColumns: sortableColumnsFor(typeName)
|
|
49801
|
+
})
|
|
49611
49802
|
])
|
|
49612
49803
|
]);
|
|
49613
49804
|
registerAuthRoutes(app, db);
|
|
@@ -49648,23 +49839,13 @@ function createCmsApp(options) {
|
|
|
49648
49839
|
paths: {}
|
|
49649
49840
|
})
|
|
49650
49841
|
);
|
|
49651
|
-
|
|
49652
|
-
...Object.entries(registry2.content_types).map(([typeName, ct2]) => [
|
|
49653
|
-
typeName,
|
|
49654
|
-
createFieldKeyMap(ct2.fields)
|
|
49655
|
-
]),
|
|
49656
|
-
...Object.entries(registry2.taxonomy_types).map(([typeName, tt2]) => [
|
|
49657
|
-
typeName,
|
|
49658
|
-
createFieldKeyMap(tt2.fields)
|
|
49659
|
-
])
|
|
49660
|
-
]);
|
|
49661
|
-
registerPublicContentRoutes(app, registry2, publicRepos, fieldKeyMaps, publicPaths, listRateLimit, programmaticResolver);
|
|
49842
|
+
registerPublicContentRoutes(app, registry2, publicRepos, projectors, publicPaths, listRateLimit, programmaticResolver);
|
|
49662
49843
|
registerPublicMediaRoutes(app, mediaRepo, publicPaths, listRateLimit);
|
|
49663
49844
|
if (options.graphql?.enabled) {
|
|
49664
49845
|
const gqlOptions = options.graphql;
|
|
49665
49846
|
let gqlHandler = null;
|
|
49666
49847
|
let initError = null;
|
|
49667
|
-
const ready = import("./handler-
|
|
49848
|
+
const ready = import("./handler-45O5OX2C-OIEJ52PN.js").then(({ createGraphQLHandler }) => {
|
|
49668
49849
|
gqlHandler = createGraphQLHandler(registry2, graphqlRepos, fieldKeyMaps, programmaticResolver, db, gqlOptions);
|
|
49669
49850
|
}).catch((err) => {
|
|
49670
49851
|
initError = err;
|
|
@@ -49705,7 +49886,7 @@ function createCmsApp(options) {
|
|
|
49705
49886
|
);
|
|
49706
49887
|
registerSchemaRoute(app, registry2, db);
|
|
49707
49888
|
registerUserRoutes(app, db, requirePermission, requireHierarchy);
|
|
49708
|
-
registerAdminContentRoutes(app, registry2, repos,
|
|
49889
|
+
registerAdminContentRoutes(app, registry2, repos, projectors, mediaRepo, requirePermission, db);
|
|
49709
49890
|
registerAdminMediaRoutes(app, mediaRepo, storage, requirePermission, maxFileSize);
|
|
49710
49891
|
return { prefix, app };
|
|
49711
49892
|
}
|
|
@@ -49766,10 +49947,10 @@ async function generateNav(registry2, targetDir) {
|
|
|
49766
49947
|
init_esm_shims();
|
|
49767
49948
|
var ABSOLUTE_BACKEND_PATHS = ["/graphql"];
|
|
49768
49949
|
function shouldBridgeToHono(url2, apiPrefix) {
|
|
49769
|
-
const
|
|
49770
|
-
if (
|
|
49771
|
-
if (
|
|
49772
|
-
return ABSOLUTE_BACKEND_PATHS.includes(
|
|
49950
|
+
const path4 = url2.split("?")[0] ?? "";
|
|
49951
|
+
if (path4.startsWith(apiPrefix)) return true;
|
|
49952
|
+
if (path4.startsWith("/admin/api")) return true;
|
|
49953
|
+
return ABSOLUTE_BACKEND_PATHS.includes(path4);
|
|
49773
49954
|
}
|
|
49774
49955
|
|
|
49775
49956
|
// src/utils/db.ts
|
|
@@ -49804,7 +49985,7 @@ function createPromptAdapter() {
|
|
|
49804
49985
|
init_esm_shims();
|
|
49805
49986
|
import { existsSync as existsSync4 } from "fs";
|
|
49806
49987
|
import { readdir } from "fs/promises";
|
|
49807
|
-
import { resolve as resolve5, join as join10, extname as
|
|
49988
|
+
import { resolve as resolve5, join as join10, extname as extname3 } from "path";
|
|
49808
49989
|
import { pathToFileURL as pathToFileURL2 } from "url";
|
|
49809
49990
|
var RESOLVER_EXTENSIONS = /* @__PURE__ */ new Set([".ts", ".mjs", ".js"]);
|
|
49810
49991
|
function isProgrammaticFieldDefinition(v2) {
|
|
@@ -49816,7 +49997,7 @@ async function walkTsFiles(dir) {
|
|
|
49816
49997
|
const full = join10(dir, entry.name);
|
|
49817
49998
|
if (entry.isDirectory()) {
|
|
49818
49999
|
out.push(...await walkTsFiles(full));
|
|
49819
|
-
} else if (RESOLVER_EXTENSIONS.has(
|
|
50000
|
+
} else if (RESOLVER_EXTENSIONS.has(extname3(entry.name))) {
|
|
49820
50001
|
out.push(full);
|
|
49821
50002
|
}
|
|
49822
50003
|
}
|
|
@@ -49972,7 +50153,7 @@ async function runDev(options, deps) {
|
|
|
49972
50153
|
}
|
|
49973
50154
|
try {
|
|
49974
50155
|
const data = await readFile(filePath);
|
|
49975
|
-
const ext =
|
|
50156
|
+
const ext = extname4(filePath).slice(1).toLowerCase();
|
|
49976
50157
|
const mime = UPLOAD_MIME_MAP[ext] ?? "application/octet-stream";
|
|
49977
50158
|
res.setHeader("Content-Type", mime);
|
|
49978
50159
|
res.setHeader("X-Content-Type-Options", "nosniff");
|