@stoker-platform/cli 0.5.69 → 0.5.70

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/lib/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoker-platform/cli",
3
- "version": "0.5.68",
3
+ "version": "0.5.69",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "./lib/src/main.js",
@@ -24,9 +24,9 @@
24
24
  "@google-cloud/secret-manager": "^6.1.1",
25
25
  "@google-cloud/storage": "^7.19.0",
26
26
  "@inquirer/prompts": "^8.4.2",
27
- "@stoker-platform/node-client": "0.5.48",
27
+ "@stoker-platform/node-client": "0.5.49",
28
28
  "@stoker-platform/types": "0.5.31",
29
- "@stoker-platform/utils": "0.5.40",
29
+ "@stoker-platform/utils": "0.5.41",
30
30
  "algoliasearch": "^5.51.0",
31
31
  "commander": "^14.0.0",
32
32
  "cross-spawn": "^7.0.6",
@@ -127,6 +127,7 @@ export const lintSchema = async (noLog = false) => {
127
127
  }
128
128
  for (const [collectionName, collectionSchema] of collectionSchemas) {
129
129
  const { auth, fields, access, ttl, parentCollection, recordTitleField, softDelete, roleSystemFields, preloadCache, relationLists, fullTextSearch, ai, } = collectionSchema;
130
+ const { auth: authAccess, operations, attributeRestrictions, entityRestrictions, permissionWriteRestrictions, serverReadOnly, serverWriteOnly, files, } = access;
130
131
  // eslint-disable-next-line security/detect-object-injection
131
132
  const customization = customizationModules[collectionName];
132
133
  const readRoles = roles.filter((role) => roleHasOperationAccess(collectionSchema, role, "read"));
@@ -416,9 +417,18 @@ export const lintSchema = async (noLog = false) => {
416
417
  }
417
418
  const defaultSort = (await tryPromise(customization?.admin?.defaultSort));
418
419
  if (defaultSort) {
419
- if (!fieldNames.includes(defaultSort.field)) {
420
+ const fieldSchema = getField(fields, defaultSort.field);
421
+ if (!fieldSchema) {
420
422
  errors.push(`Collection ${collectionName} has a default sort field ${defaultSort.field} that does not exist`);
421
423
  }
424
+ else {
425
+ for (const role of readRoles) {
426
+ if (!(preloadCache?.roles.includes(role) || serverReadOnly?.includes(role)) &&
427
+ !(fieldSchema.name === recordTitleField || fieldSchema.sorting)) {
428
+ errors.push(`Collection ${collectionName} has a default sort field ${defaultSort.field} that must have sorting enabled.`);
429
+ }
430
+ }
431
+ }
422
432
  }
423
433
  const breadcrumbs = (await tryPromise(customization?.admin?.breadcrumbs));
424
434
  if (breadcrumbs) {
@@ -671,7 +681,6 @@ export const lintSchema = async (noLog = false) => {
671
681
  }
672
682
  }
673
683
  }
674
- const { auth: authAccess, operations, attributeRestrictions, entityRestrictions, permissionWriteRestrictions, serverReadOnly, serverWriteOnly, files, } = access;
675
684
  if (authAccess) {
676
685
  for (const role of authAccess) {
677
686
  if (!roles.includes(role)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoker-platform/cli",
3
- "version": "0.5.69",
3
+ "version": "0.5.70",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "./lib/src/main.js",
@@ -24,9 +24,9 @@
24
24
  "@google-cloud/secret-manager": "^6.1.1",
25
25
  "@google-cloud/storage": "^7.19.0",
26
26
  "@inquirer/prompts": "^8.4.2",
27
- "@stoker-platform/node-client": "0.5.49",
27
+ "@stoker-platform/node-client": "0.5.50",
28
28
  "@stoker-platform/types": "0.5.31",
29
- "@stoker-platform/utils": "0.5.41",
29
+ "@stoker-platform/utils": "0.5.42",
30
30
  "algoliasearch": "^5.51.0",
31
31
  "commander": "^14.0.0",
32
32
  "cross-spawn": "^7.0.6",