@nextsparkjs/core 0.1.0-beta.101 → 0.1.0-beta.102
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generic-handler.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/entity/generic-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AA2VvD;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,
|
|
1
|
+
{"version":3,"file":"generic-handler.d.ts","sourceRoot":"","sources":["../../../../src/lib/api/entity/generic-handler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AA2VvD;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAicnF;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CA2SrF;AAED;;GAEG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAkKpJ;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAyStJ;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,WAAW,EAAE,EAAE,MAAM,EAAE,EAAE;IAAE,MAAM,EAAE,OAAO,CAAC;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,EAAE,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,GAAG,OAAO,CAAC,YAAY,CAAC,CAqGtJ;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC,CAEtF"}
|
|
@@ -199,7 +199,7 @@ async function validateTeamContextWithBypass(request, authResult, userId) {
|
|
|
199
199
|
return { valid: true, teamId, isBypass: false };
|
|
200
200
|
}
|
|
201
201
|
async function handleGenericList(request) {
|
|
202
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
202
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i;
|
|
203
203
|
try {
|
|
204
204
|
const resolution = await resolveEntityFromUrl(request.nextUrl.pathname);
|
|
205
205
|
if (!resolution.isValidEntity || !resolution.entityConfig) {
|
|
@@ -433,12 +433,22 @@ async function handleGenericList(request) {
|
|
|
433
433
|
) pu ON t.id = pu."patternId"
|
|
434
434
|
`;
|
|
435
435
|
}
|
|
436
|
+
const sortByParam = url.searchParams.get("sortBy");
|
|
437
|
+
const sortOrderParam = ((_h = url.searchParams.get("sortOrder")) == null ? void 0 : _h.toUpperCase()) === "ASC" ? "ASC" : "DESC";
|
|
438
|
+
let orderByClause = 't."createdAt" DESC';
|
|
439
|
+
if (sortByParam) {
|
|
440
|
+
const baseFields = ["id", "createdAt", "updatedAt", "teamId"];
|
|
441
|
+
const isValidField = entityConfig.fields.some((f) => f.name === sortByParam) || baseFields.includes(sortByParam);
|
|
442
|
+
if (isValidField) {
|
|
443
|
+
orderByClause = `t."${sortByParam}" ${sortOrderParam}`;
|
|
444
|
+
}
|
|
445
|
+
}
|
|
436
446
|
query = `
|
|
437
447
|
SELECT ${fields}, COUNT(*) OVER() as total_count
|
|
438
448
|
FROM "${tableName}" t
|
|
439
449
|
${joinClause}
|
|
440
450
|
${whereClause}
|
|
441
|
-
ORDER BY
|
|
451
|
+
ORDER BY ${orderByClause}
|
|
442
452
|
LIMIT $${paramIndex++} OFFSET $${paramIndex++}
|
|
443
453
|
`;
|
|
444
454
|
queryParams.push(pagination.limit, pagination.offset);
|
|
@@ -471,7 +481,7 @@ async function handleGenericList(request) {
|
|
|
471
481
|
);
|
|
472
482
|
}
|
|
473
483
|
let dataWithTaxonomies = dataWithChild;
|
|
474
|
-
if ((
|
|
484
|
+
if ((_i = entityConfig.taxonomies) == null ? void 0 : _i.enabled) {
|
|
475
485
|
dataWithTaxonomies = await includeTaxonomiesInData(
|
|
476
486
|
entityConfig,
|
|
477
487
|
dataWithChild,
|
package/dist/styles/classes.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nextsparkjs/core",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.102",
|
|
4
4
|
"description": "NextSpark - The complete SaaS framework for Next.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "NextSpark <hello@nextspark.dev>",
|
|
@@ -453,7 +453,7 @@
|
|
|
453
453
|
"tailwind-merge": "^3.3.1",
|
|
454
454
|
"uuid": "^13.0.0",
|
|
455
455
|
"zod": "^4.1.5",
|
|
456
|
-
"@nextsparkjs/testing": "0.1.0-beta.
|
|
456
|
+
"@nextsparkjs/testing": "0.1.0-beta.102"
|
|
457
457
|
},
|
|
458
458
|
"scripts": {
|
|
459
459
|
"postinstall": "node scripts/postinstall.mjs || true",
|