@stoker-platform/types 0.5.66 → 0.5.68

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoker-platform/types",
3
- "version": "0.5.66",
3
+ "version": "0.5.68",
4
4
  "type": "module",
5
5
  "license": "SEE LICENSE IN LICENSE.md",
6
6
  "main": "src/main.ts",
@@ -3,6 +3,7 @@ import { Timestamp, WhereFilterOp, WriteBatch } from "firebase/firestore"
3
3
  import { NodeUtilities, WebUtilities } from "./app"
4
4
  import { CalendarOptions } from "@fullcalendar/core"
5
5
  import { SearchOptions } from "minisearch"
6
+ import { UserRecord } from "firebase-admin/auth"
6
7
 
7
8
  export type StokerRole = string
8
9
  export type StokerCollection = string
@@ -453,10 +454,15 @@ export interface PreloadCacheInitial {
453
454
 
454
455
  export interface CollectionCustom extends Hooks {
455
456
  serverAccess?: {
456
- read?: (role: StokerRole, record?: StokerRecord) => boolean | Promise<boolean>
457
- create?: (role: StokerRole, record: StokerRecord) => boolean | Promise<boolean>
458
- update?: (role: StokerRole, record: StokerRecord, originalRecord?: StokerRecord) => boolean | Promise<boolean>
459
- delete?: (role: StokerRole, record: StokerRecord) => boolean | Promise<boolean>
457
+ read?: (permissions: StokerPermissions, user: UserRecord, record?: StokerRecord) => boolean | Promise<boolean>
458
+ create?: (permissions: StokerPermissions, user: UserRecord, record: StokerRecord) => boolean | Promise<boolean>
459
+ update?: (
460
+ permissions: StokerPermissions,
461
+ user: UserRecord,
462
+ record: StokerRecord,
463
+ originalRecord?: StokerRecord,
464
+ ) => boolean | Promise<boolean>
465
+ delete?: (permissions: StokerPermissions, user: UserRecord, record: StokerRecord) => boolean | Promise<boolean>
460
466
  }
461
467
  preloadCacheConstraints?:
462
468
  | [string, WhereFilterOp, unknown][]
@@ -904,9 +910,14 @@ export interface CollectionAdminCache {
904
910
  export interface FieldCustom extends Hooks {
905
911
  initialValue?: unknown | ((record?: StokerRecord) => unknown | Promise<unknown>)
906
912
  serverAccess?: {
907
- read?: (role: StokerRole, record?: StokerRecord) => boolean | Promise<boolean>
908
- create?: (role: StokerRole, record: StokerRecord) => boolean | Promise<boolean>
909
- update?: (role: StokerRole, record: StokerRecord, originalRecord?: StokerRecord) => boolean | Promise<boolean>
913
+ read?: (permissions: StokerPermissions, user: UserRecord, record?: StokerRecord) => boolean | Promise<boolean>
914
+ create?: (permissions: StokerPermissions, user: UserRecord, record: StokerRecord) => boolean | Promise<boolean>
915
+ update?: (
916
+ permissions: StokerPermissions,
917
+ user: UserRecord,
918
+ record: StokerRecord,
919
+ originalRecord?: StokerRecord,
920
+ ) => boolean | Promise<boolean>
910
921
  }
911
922
  }
912
923
 
@@ -959,7 +970,11 @@ export interface FieldAdmin {
959
970
  noExport?: boolean | (() => boolean)
960
971
  exportSeparator?: string | (() => string)
961
972
  skipFormRequiredValidation?: boolean | (() => boolean)
962
- overrideFormRequiredValidation?: (operation: "create" | "update", record?: StokerRecord) => boolean
973
+ overrideFormRequiredValidation?: (
974
+ operation: "create" | "update",
975
+ record?: StokerRecord,
976
+ originalRecord?: StokerRecord,
977
+ ) => boolean
963
978
  filterValues?: (value: string | number, parentCollection: CollectionSchema, parentRecord?: StokerRecord) => boolean
964
979
  filterResults?: (result: StokerRecord, parentCollection: CollectionSchema, parentRecord?: StokerRecord) => boolean
965
980
  modifyResultTitle?: (