@getcommunity/gc-validators 0.0.271-alpha.0 → 0.0.271-alpha.10

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.
Files changed (259) hide show
  1. package/README.md +16 -0
  2. package/dist/abac-BeKQtxIF.cjs +648 -0
  3. package/dist/abac-DPd9oLKR.mjs +643 -0
  4. package/dist/base/index.cjs +19 -19
  5. package/dist/base/index.d.cts +2 -3
  6. package/dist/base/index.d.mts +3 -4
  7. package/dist/base/index.mjs +2 -2
  8. package/dist/components/blocks/index.cjs +16 -14
  9. package/dist/components/blocks/index.d.cts +2 -1322
  10. package/dist/components/blocks/index.d.mts +2 -1322
  11. package/dist/components/blocks/index.mjs +16 -14
  12. package/dist/components/brand/index.d.cts +1 -314
  13. package/dist/components/brand/index.d.mts +1 -314
  14. package/dist/components/forms/index.cjs +10 -8
  15. package/dist/components/forms/index.d.cts +6 -3
  16. package/dist/components/forms/index.d.mts +6 -3
  17. package/dist/components/forms/index.mjs +10 -8
  18. package/dist/components/shared/index.cjs +3 -1
  19. package/dist/components/shared/index.d.cts +1 -916
  20. package/dist/components/shared/index.d.mts +1 -916
  21. package/dist/components/shared/index.mjs +3 -1
  22. package/dist/components/slideshow/index.cjs +15 -13
  23. package/dist/components/slideshow/index.d.cts +7 -5
  24. package/dist/components/slideshow/index.d.mts +7 -5
  25. package/dist/components/slideshow/index.mjs +15 -13
  26. package/dist/components/utm/index.cjs +7 -5
  27. package/dist/components/utm/index.d.cts +2 -32
  28. package/dist/components/utm/index.d.mts +2 -32
  29. package/dist/components/utm/index.mjs +7 -5
  30. package/dist/{document-BMxLOdrT.d.cts → document-BVhB_t1g.d.mts} +158 -104
  31. package/dist/{document-Bpr9mbCs.d.mts → document-CbE38CzE.d.mts} +6 -6
  32. package/dist/document-Ccvtwgy_.cjs +26 -0
  33. package/dist/document-CrnqUGRk.cjs +243 -0
  34. package/dist/document-Cx4Klv8A.mjs +128 -0
  35. package/dist/document-D060zybc.mjs +19 -0
  36. package/dist/document-D7jG_DvK.cjs +728 -0
  37. package/dist/document-DEUmfrbE.mjs +457 -0
  38. package/dist/document-DaICHS9G.cjs +17 -0
  39. package/dist/{document-Gx2Vrg_w.d.mts → document-DtDSYDbn.d.cts} +158 -104
  40. package/dist/document-c3GNPelp.mjs +10 -0
  41. package/dist/{document-hEBlSep8.d.cts → document-i-h3Orv7.d.cts} +6 -6
  42. package/dist/entities/audit-log/index.cjs +2 -2
  43. package/dist/entities/audit-log/index.d.cts +2 -2
  44. package/dist/entities/audit-log/index.d.mts +3 -3
  45. package/dist/entities/audit-log/index.mjs +1 -1
  46. package/dist/entities/blog-page/index.d.mts +1 -1
  47. package/dist/entities/blog-post/index.cjs +1 -1
  48. package/dist/entities/blog-post/index.d.cts +1 -916
  49. package/dist/entities/blog-post/index.d.mts +1 -916
  50. package/dist/entities/blog-post/index.mjs +1 -1
  51. package/dist/entities/careers-page/index.d.mts +1 -1
  52. package/dist/entities/category/index.cjs +4 -13
  53. package/dist/entities/category/index.d.cts +3 -260
  54. package/dist/entities/category/index.d.mts +3 -260
  55. package/dist/entities/category/index.mjs +2 -11
  56. package/dist/entities/client/index.cjs +3 -3
  57. package/dist/entities/client/index.d.cts +1 -84
  58. package/dist/entities/client/index.d.mts +1 -84
  59. package/dist/entities/client/index.mjs +2 -2
  60. package/dist/entities/client-content-pillar/index.cjs +10 -20
  61. package/dist/entities/client-content-pillar/index.d.cts +1 -48
  62. package/dist/entities/client-content-pillar/index.d.mts +1 -48
  63. package/dist/entities/client-content-pillar/index.mjs +2 -12
  64. package/dist/entities/client-media-platform/index.cjs +10 -17
  65. package/dist/entities/client-media-platform/index.d.cts +1 -52
  66. package/dist/entities/client-media-platform/index.d.mts +1 -52
  67. package/dist/entities/client-media-platform/index.mjs +2 -9
  68. package/dist/entities/client-project/index.cjs +22 -129
  69. package/dist/entities/client-project/index.d.cts +1 -146
  70. package/dist/entities/client-project/index.d.mts +1 -146
  71. package/dist/entities/client-project/index.mjs +2 -109
  72. package/dist/entities/client-report/index.cjs +7 -18
  73. package/dist/entities/client-report/index.d.cts +1 -62
  74. package/dist/entities/client-report/index.d.mts +1 -62
  75. package/dist/entities/client-report/index.mjs +2 -13
  76. package/dist/entities/client-styleguide/index.cjs +7 -27
  77. package/dist/entities/client-styleguide/index.d.cts +1 -47
  78. package/dist/entities/client-styleguide/index.d.mts +1 -47
  79. package/dist/entities/client-styleguide/index.mjs +2 -22
  80. package/dist/entities/client-user/index.cjs +17 -53
  81. package/dist/entities/client-user/index.d.cts +2 -47
  82. package/dist/entities/client-user/index.d.mts +2 -47
  83. package/dist/entities/client-user/index.mjs +5 -41
  84. package/dist/entities/comment/index.d.cts +1 -1
  85. package/dist/entities/comment/index.d.mts +1 -1
  86. package/dist/entities/content-pillar/index.cjs +5 -5
  87. package/dist/entities/content-pillar/index.d.cts +1 -49
  88. package/dist/entities/content-pillar/index.d.mts +1 -49
  89. package/dist/entities/content-pillar/index.mjs +2 -2
  90. package/dist/entities/faq-page/index.d.mts +1 -1
  91. package/dist/entities/gcflytour/index.cjs +9 -19
  92. package/dist/entities/gcflytour/index.d.cts +1 -60
  93. package/dist/entities/gcflytour/index.d.mts +1 -60
  94. package/dist/entities/gcflytour/index.mjs +2 -12
  95. package/dist/entities/gcflytour-snap/index.cjs +7 -17
  96. package/dist/entities/gcflytour-snap/index.d.cts +1 -58
  97. package/dist/entities/gcflytour-snap/index.d.mts +1 -58
  98. package/dist/entities/gcflytour-snap/index.mjs +2 -12
  99. package/dist/entities/landing-page/index.d.cts +1 -0
  100. package/dist/entities/landing-page/index.d.mts +2 -1
  101. package/dist/entities/lead/index.cjs +2 -2
  102. package/dist/entities/lead/index.mjs +1 -1
  103. package/dist/entities/media-content-type/index.cjs +10 -23
  104. package/dist/entities/media-content-type/index.d.cts +3 -3
  105. package/dist/entities/media-content-type/index.d.mts +3 -3
  106. package/dist/entities/media-content-type/index.mjs +2 -15
  107. package/dist/entities/media-creative-format/index.cjs +7 -16
  108. package/dist/entities/media-creative-format/index.d.cts +3 -3
  109. package/dist/entities/media-creative-format/index.d.mts +3 -3
  110. package/dist/entities/media-creative-format/index.mjs +2 -11
  111. package/dist/entities/media-medium/index.cjs +7 -18
  112. package/dist/entities/media-medium/index.d.cts +3 -18
  113. package/dist/entities/media-medium/index.d.mts +3 -18
  114. package/dist/entities/media-medium/index.mjs +2 -13
  115. package/dist/entities/media-platform/index.cjs +13 -29
  116. package/dist/entities/media-platform/index.d.cts +1 -73
  117. package/dist/entities/media-platform/index.d.mts +1 -73
  118. package/dist/entities/media-platform/index.mjs +2 -18
  119. package/dist/entities/monday-workspace/index.cjs +7 -14
  120. package/dist/entities/monday-workspace/index.d.cts +1 -46
  121. package/dist/entities/monday-workspace/index.d.mts +1 -46
  122. package/dist/entities/monday-workspace/index.mjs +2 -9
  123. package/dist/entities/newsletter-signup/index.cjs +2 -2
  124. package/dist/entities/newsletter-signup/index.mjs +1 -1
  125. package/dist/entities/policy-page/index.d.cts +1 -0
  126. package/dist/entities/policy-page/index.d.mts +2 -1
  127. package/dist/entities/product/index.cjs +2 -21
  128. package/dist/entities/product/index.d.cts +1 -319
  129. package/dist/entities/product/index.d.mts +1 -319
  130. package/dist/entities/product/index.mjs +1 -18
  131. package/dist/entities/product-highlight/index.cjs +2 -21
  132. package/dist/entities/product-highlight/index.d.cts +1 -244
  133. package/dist/entities/product-highlight/index.d.mts +1 -244
  134. package/dist/entities/product-highlight/index.mjs +1 -18
  135. package/dist/entities/resume/index.cjs +2 -2
  136. package/dist/entities/resume/index.mjs +1 -1
  137. package/dist/entities/tag/index.cjs +4 -11
  138. package/dist/entities/tag/index.d.cts +3 -14
  139. package/dist/entities/tag/index.d.mts +3 -14
  140. package/dist/entities/tag/index.mjs +2 -9
  141. package/dist/entities/team-member/index.cjs +1 -1
  142. package/dist/entities/team-member/index.d.cts +1 -209
  143. package/dist/entities/team-member/index.d.mts +1 -209
  144. package/dist/entities/team-member/index.mjs +1 -1
  145. package/dist/entities/team-page/index.d.mts +1 -1
  146. package/dist/entities/trend/index.cjs +4 -18
  147. package/dist/entities/trend/index.d.cts +1 -333
  148. package/dist/entities/trend/index.d.mts +1 -333
  149. package/dist/entities/trend/index.mjs +2 -16
  150. package/dist/entities/up-auth/index.d.cts +2 -2
  151. package/dist/entities/up-auth/index.d.mts +2 -2
  152. package/dist/entities/up-permission/index.cjs +2 -11
  153. package/dist/entities/up-permission/index.d.cts +1 -13
  154. package/dist/entities/up-permission/index.d.mts +1 -13
  155. package/dist/entities/up-permission/index.mjs +1 -8
  156. package/dist/entities/up-role/index.cjs +4 -27
  157. package/dist/entities/up-role/index.d.cts +1 -2
  158. package/dist/entities/up-role/index.d.mts +1 -2
  159. package/dist/entities/up-role/index.mjs +1 -22
  160. package/dist/entities/up-user/index.cjs +9 -63
  161. package/dist/entities/up-user/index.d.cts +1 -37
  162. package/dist/entities/up-user/index.d.mts +1 -37
  163. package/dist/entities/up-user/index.mjs +1 -53
  164. package/dist/entities/url-redirect/index.d.cts +2 -2
  165. package/dist/entities/url-redirect/index.d.mts +2 -2
  166. package/dist/entities/user-account/index.cjs +10 -18
  167. package/dist/entities/user-account/index.d.cts +2 -2
  168. package/dist/entities/user-account/index.d.mts +2 -2
  169. package/dist/entities/user-account/index.mjs +3 -11
  170. package/dist/entities/utm-link-builder/index.cjs +9 -8
  171. package/dist/entities/utm-link-builder/index.d.cts +2 -3
  172. package/dist/entities/utm-link-builder/index.d.mts +2 -3
  173. package/dist/entities/utm-link-builder/index.mjs +6 -4
  174. package/dist/entities/utm-meta/index.d.cts +7 -7
  175. package/dist/entities/utm-meta/index.d.mts +7 -7
  176. package/dist/entities/utm-tracking-link/index.cjs +7 -28
  177. package/dist/entities/utm-tracking-link/index.d.cts +1 -234
  178. package/dist/entities/utm-tracking-link/index.d.mts +1 -234
  179. package/dist/entities/utm-tracking-link/index.mjs +2 -23
  180. package/dist/index-4XzJDMTp.d.mts +4744 -0
  181. package/dist/index-B3VtiObV.d.mts +317 -0
  182. package/dist/index-BD4hPqIw.d.cts +940 -0
  183. package/dist/index-BbwsFaWE.d.cts +921 -0
  184. package/dist/{index-DDYmaYSm.d.mts → index-Brw4Hq18.d.cts} +3 -3
  185. package/dist/{index-Dl6KBLdT.d.mts → index-CJ2_Z1gW.d.mts} +99 -142
  186. package/dist/index-CQP_vcmO.d.cts +317 -0
  187. package/dist/index-CRoWUxGV.d.cts +1324 -0
  188. package/dist/index-CrZiM45q.d.cts +4744 -0
  189. package/dist/index-CygWlTrU.d.mts +940 -0
  190. package/dist/index-D11tQdCv.d.cts +34 -0
  191. package/dist/{index-DmLVZdb3.d.cts → index-D6rOxDlM.d.mts} +3 -3
  192. package/dist/index-DJ-0EDJN.d.mts +921 -0
  193. package/dist/index-DLICmJ_-.d.mts +34 -0
  194. package/dist/{index-Dv9bgrpo.d.cts → index-efk0FfOP.d.cts} +98 -141
  195. package/dist/index-oCLNrzIj.d.mts +1324 -0
  196. package/dist/media-upload-D-nP8FR1.d.cts +140 -0
  197. package/dist/media-upload-DKeA1eD-.d.mts +140 -0
  198. package/dist/permissions/index.cjs +3 -663
  199. package/dist/permissions/index.d.cts +2 -2
  200. package/dist/permissions/index.d.mts +2 -2
  201. package/dist/permissions/index.mjs +3 -661
  202. package/dist/{query.schema-DHTf6rTw.cjs → query-7g1AOXN9.cjs} +3 -3
  203. package/dist/{query.schema-YKoOuBnk.mjs → query-CeUev0uJ.mjs} +2 -2
  204. package/dist/{relations-C04F46xL.mjs → relationships-BosK0kyG.mjs} +1 -1
  205. package/dist/{relations-CGu18hfT.cjs → relationships-CWVJebkQ.cjs} +1 -1
  206. package/dist/utilities/index.cjs +20 -0
  207. package/dist/utilities/index.d.cts +7 -2
  208. package/dist/utilities/index.d.mts +7 -2
  209. package/dist/utilities/index.mjs +19 -1
  210. package/package.json +1 -1
  211. package/dist/document-BAzLIprH.d.mts +0 -100
  212. package/dist/document-BFukanLe.mjs +0 -54
  213. package/dist/document-BK1ASowb.d.cts +0 -17
  214. package/dist/document-BNoXPGwF.d.mts +0 -27
  215. package/dist/document-B_pJW777.d.mts +0 -30
  216. package/dist/document-Bd2AyLs8.d.mts +0 -16
  217. package/dist/document-BezYxNmb.d.cts +0 -16
  218. package/dist/document-Bj7SRTOn.d.cts +0 -18
  219. package/dist/document-Bo869pZx.d.mts +0 -18
  220. package/dist/document-Bs8c1mok.d.cts +0 -15
  221. package/dist/document-C0c7azOe.d.mts +0 -434
  222. package/dist/document-CTTDXzOF.mjs +0 -13
  223. package/dist/document-CUl_Ys6-.mjs +0 -23
  224. package/dist/document-CWYzG60q.d.cts +0 -19
  225. package/dist/document-Ccszj8lR.cjs +0 -20
  226. package/dist/document-CjNHI7Eb.d.cts +0 -27
  227. package/dist/document-Cu_HUDC5.mjs +0 -51
  228. package/dist/document-D-KvyEb5.d.cts +0 -238
  229. package/dist/document-D2nLVGig.d.mts +0 -238
  230. package/dist/document-D5yDIDIx.d.mts +0 -15
  231. package/dist/document-D73dqRle.d.cts +0 -19
  232. package/dist/document-DA6YVZz-.d.cts +0 -100
  233. package/dist/document-DJ0YiVte.d.cts +0 -30
  234. package/dist/document-DMHIUE3J.d.mts +0 -17
  235. package/dist/document-DN3g0EFx.d.cts +0 -434
  236. package/dist/document-DWapIF7V.d.cts +0 -12223
  237. package/dist/document-DYzRVV1C.d.mts +0 -16
  238. package/dist/document-D_ZMbzn6.d.cts +0 -18
  239. package/dist/document-DeoRGh7p.d.mts +0 -19
  240. package/dist/document-DsIPBTG8.cjs +0 -30
  241. package/dist/document-DsSaMVGb.cjs +0 -106
  242. package/dist/document-IIJpsOIO.d.cts +0 -16
  243. package/dist/document-WHS8GHY5.d.mts +0 -18
  244. package/dist/document-dqrWptdY.d.cts +0 -244
  245. package/dist/document-qcC-10Nd.d.mts +0 -12223
  246. package/dist/document-rbMXLGxt.cjs +0 -103
  247. package/dist/document-si7GYS5g.d.mts +0 -19
  248. package/dist/document-vq-7rcU5.d.mts +0 -244
  249. package/dist/fields-BQHSYj70.d.cts +0 -7
  250. package/dist/fields-qx-5saY5.d.mts +0 -7
  251. package/dist/index-CPUGB8lZ.d.mts +0 -95
  252. package/dist/index-H4RC0v4h.d.cts +0 -95
  253. package/dist/query.schema-BOn5Kk_p.d.mts +0 -41
  254. package/dist/query.schema-CItKlb0x.d.cts +0 -41
  255. package/dist/response-C-7nyNVD.d.mts +0 -57
  256. package/dist/response-c6SgLvi9.d.cts +0 -57
  257. /package/dist/{constants-L2goO7Eg.mjs → constants-Htf-MeCA.mjs} +0 -0
  258. /package/dist/{constants-PBZKggHL.cjs → constants-f1GP2eiq.cjs} +0 -0
  259. /package/dist/{json-CqAaKeHA.d.mts → json-CiA5ZRzc.d.mts} +0 -0
@@ -1,7 +1,25 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_chunk = require("../chunk-CKQMccvm.cjs");
3
+ const require_abac = require("../abac-BeKQtxIF.cjs");
3
4
  let valibot = require("valibot");
4
5
  valibot = require_chunk.__toESM(valibot, 1);
6
+ //#region src/utilities/permissions.ts
7
+ function hasPermission(user, permissions, resource, action, data) {
8
+ if (!user) return false;
9
+ const permission = require_abac.ROLE_PERMISSIONS[user.role.type][resource]?.[action];
10
+ if (permission == null) return false;
11
+ if (typeof permission === "boolean") return permission;
12
+ return permission(user, permissions, data);
13
+ }
14
+ function canAssignPermission(userRole, resource, action) {
15
+ if (!userRole) return false;
16
+ const permission = require_abac.ROLE_PERMISSIONS[userRole][resource]?.[action];
17
+ if (permission == null) return false;
18
+ if (typeof permission === "boolean") return permission;
19
+ if (typeof permission === "function") return true;
20
+ return false;
21
+ }
22
+ //#endregion
5
23
  //#region src/utilities/strapi.ts
6
24
  function isStrapiAttributeError(result) {
7
25
  return typeof result === "object" && result !== null && "error" in result && typeof result.error === "object" && result.error !== null && "details" in result.error && typeof result.error.details === "object" && result.error.details !== null && "errors" in result.error.details && Array.isArray(result.error.details.errors);
@@ -50,6 +68,8 @@ function isValidationFailure(result) {
50
68
  return result.error !== null || result.errors !== null;
51
69
  }
52
70
  //#endregion
71
+ exports.canAssignPermission = canAssignPermission;
72
+ exports.hasPermission = hasPermission;
53
73
  exports.isStrapiAttributeError = isStrapiAttributeError;
54
74
  exports.isStrapiStandardError = isStrapiStandardError;
55
75
  exports.isValidationFailure = isValidationFailure;
@@ -1,6 +1,11 @@
1
- import { a as StrapiErrorResponse, r as StrapiAttributeErrorResponse } from "../response-c6SgLvi9.cjs";
1
+ import { J as StrapiErrorResponse, K as StrapiAttributeErrorResponse } from "../index-efk0FfOP.cjs";
2
+ import { En as AuthorizedUserDocument, d as Permissions, kn as RoleType, l as ClientUserDocumentStatus } from "../index-CrZiM45q.cjs";
2
3
  import * as v from "valibot";
3
4
 
5
+ //#region src/utilities/permissions.d.ts
6
+ declare function hasPermission<Resource extends keyof Permissions>(user: AuthorizedUserDocument | null, permissions: ClientUserDocumentStatus, resource: Resource, action: Permissions[Resource]["action"], data?: Permissions[Resource]["dataType"]): boolean;
7
+ declare function canAssignPermission<Resource extends keyof Permissions>(userRole: RoleType, resource: Resource, action: Permissions[Resource]["action"]): boolean;
8
+ //#endregion
4
9
  //#region src/utilities/strapi.d.ts
5
10
  declare function isStrapiAttributeError<T>(result: unknown): result is StrapiAttributeErrorResponse<T>;
6
11
  declare function isStrapiStandardError<T>(result: unknown): result is StrapiErrorResponse<T>;
@@ -21,4 +26,4 @@ declare function validateAndClean<T>(schema: v.BaseSchema<T, Partial<T>, v.BaseI
21
26
  declare function isValidationSuccess<T>(result: ValidateAndCleanResult<T>): result is ValidateAndCleanSuccess<T>;
22
27
  declare function isValidationFailure<T>(result: ValidateAndCleanResult<T>): result is ValidateAndCleanFailure;
23
28
  //#endregion
24
- export { isStrapiAttributeError, isStrapiStandardError, isValidationFailure, isValidationSuccess, validateAndClean };
29
+ export { canAssignPermission, hasPermission, isStrapiAttributeError, isStrapiStandardError, isValidationFailure, isValidationSuccess, validateAndClean };
@@ -1,6 +1,11 @@
1
- import { a as StrapiErrorResponse, r as StrapiAttributeErrorResponse } from "../response-C-7nyNVD.mjs";
1
+ import { J as StrapiErrorResponse, K as StrapiAttributeErrorResponse } from "../index-CJ2_Z1gW.mjs";
2
+ import { En as AuthorizedUserDocument, d as Permissions, kn as RoleType, l as ClientUserDocumentStatus } from "../index-4XzJDMTp.mjs";
2
3
  import * as v from "valibot";
3
4
 
5
+ //#region src/utilities/permissions.d.ts
6
+ declare function hasPermission<Resource extends keyof Permissions>(user: AuthorizedUserDocument | null, permissions: ClientUserDocumentStatus, resource: Resource, action: Permissions[Resource]["action"], data?: Permissions[Resource]["dataType"]): boolean;
7
+ declare function canAssignPermission<Resource extends keyof Permissions>(userRole: RoleType, resource: Resource, action: Permissions[Resource]["action"]): boolean;
8
+ //#endregion
4
9
  //#region src/utilities/strapi.d.ts
5
10
  declare function isStrapiAttributeError<T>(result: unknown): result is StrapiAttributeErrorResponse<T>;
6
11
  declare function isStrapiStandardError<T>(result: unknown): result is StrapiErrorResponse<T>;
@@ -21,4 +26,4 @@ declare function validateAndClean<T>(schema: v.BaseSchema<T, Partial<T>, v.BaseI
21
26
  declare function isValidationSuccess<T>(result: ValidateAndCleanResult<T>): result is ValidateAndCleanSuccess<T>;
22
27
  declare function isValidationFailure<T>(result: ValidateAndCleanResult<T>): result is ValidateAndCleanFailure;
23
28
  //#endregion
24
- export { isStrapiAttributeError, isStrapiStandardError, isValidationFailure, isValidationSuccess, validateAndClean };
29
+ export { canAssignPermission, hasPermission, isStrapiAttributeError, isStrapiStandardError, isValidationFailure, isValidationSuccess, validateAndClean };
@@ -1,4 +1,22 @@
1
+ import { t as ROLE_PERMISSIONS } from "../abac-DPd9oLKR.mjs";
1
2
  import * as v from "valibot";
3
+ //#region src/utilities/permissions.ts
4
+ function hasPermission(user, permissions, resource, action, data) {
5
+ if (!user) return false;
6
+ const permission = ROLE_PERMISSIONS[user.role.type][resource]?.[action];
7
+ if (permission == null) return false;
8
+ if (typeof permission === "boolean") return permission;
9
+ return permission(user, permissions, data);
10
+ }
11
+ function canAssignPermission(userRole, resource, action) {
12
+ if (!userRole) return false;
13
+ const permission = ROLE_PERMISSIONS[userRole][resource]?.[action];
14
+ if (permission == null) return false;
15
+ if (typeof permission === "boolean") return permission;
16
+ if (typeof permission === "function") return true;
17
+ return false;
18
+ }
19
+ //#endregion
2
20
  //#region src/utilities/strapi.ts
3
21
  function isStrapiAttributeError(result) {
4
22
  return typeof result === "object" && result !== null && "error" in result && typeof result.error === "object" && result.error !== null && "details" in result.error && typeof result.error.details === "object" && result.error.details !== null && "errors" in result.error.details && Array.isArray(result.error.details.errors);
@@ -47,4 +65,4 @@ function isValidationFailure(result) {
47
65
  return result.error !== null || result.errors !== null;
48
66
  }
49
67
  //#endregion
50
- export { isStrapiAttributeError, isStrapiStandardError, isValidationFailure, isValidationSuccess, validateAndClean };
68
+ export { canAssignPermission, hasPermission, isStrapiAttributeError, isStrapiStandardError, isValidationFailure, isValidationSuccess, validateAndClean };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@getcommunity/gc-validators",
3
3
  "description": "Schema Validator for GetCommunity web-stack types",
4
- "version": "0.0.271-alpha.0",
4
+ "version": "0.0.271-alpha.10",
5
5
  "author": "Joey Grable <joey@getcommunity.com> (https://joeygrable.com)",
6
6
  "contributors": [],
7
7
  "type": "module",
@@ -1,100 +0,0 @@
1
- import * as v from "valibot";
2
-
3
- //#region src/entities/client-project/document.d.ts
4
- declare const ClientProjectDocument: v.ObjectSchema<{
5
- readonly title: v.StringSchema<undefined>;
6
- readonly slug: v.StringSchema<undefined>;
7
- readonly featured_image: v.OptionalSchema<v.NullableSchema<v.LazySchema<v.ObjectSchema<{
8
- readonly name: v.StringSchema<undefined>;
9
- readonly alternativeText: v.NullableSchema<v.StringSchema<undefined>, undefined>;
10
- readonly caption: v.NullableSchema<v.StringSchema<undefined>, undefined>;
11
- readonly width: v.NumberSchema<undefined>;
12
- readonly height: v.NumberSchema<undefined>;
13
- readonly formats: v.OptionalSchema<v.NullableSchema<v.ObjectSchema<{
14
- readonly large: v.OptionalSchema<v.ObjectSchema<{
15
- readonly ext: v.StringSchema<undefined>;
16
- readonly url: v.StringSchema<undefined>;
17
- readonly hash: v.StringSchema<undefined>;
18
- readonly mime: v.StringSchema<undefined>;
19
- readonly name: v.StringSchema<undefined>;
20
- readonly path: v.NullableSchema<v.StringSchema<undefined>, undefined>;
21
- readonly size: v.NumberSchema<undefined>;
22
- readonly width: v.NumberSchema<undefined>;
23
- readonly height: v.NumberSchema<undefined>;
24
- readonly sizeInBytes: v.NumberSchema<undefined>;
25
- }, undefined>, undefined>;
26
- readonly small: v.OptionalSchema<v.ObjectSchema<{
27
- readonly ext: v.StringSchema<undefined>;
28
- readonly url: v.StringSchema<undefined>;
29
- readonly hash: v.StringSchema<undefined>;
30
- readonly mime: v.StringSchema<undefined>;
31
- readonly name: v.StringSchema<undefined>;
32
- readonly path: v.NullableSchema<v.StringSchema<undefined>, undefined>;
33
- readonly size: v.NumberSchema<undefined>;
34
- readonly width: v.NumberSchema<undefined>;
35
- readonly height: v.NumberSchema<undefined>;
36
- readonly sizeInBytes: v.NumberSchema<undefined>;
37
- }, undefined>, undefined>;
38
- readonly medium: v.OptionalSchema<v.ObjectSchema<{
39
- readonly ext: v.StringSchema<undefined>;
40
- readonly url: v.StringSchema<undefined>;
41
- readonly hash: v.StringSchema<undefined>;
42
- readonly mime: v.StringSchema<undefined>;
43
- readonly name: v.StringSchema<undefined>;
44
- readonly path: v.NullableSchema<v.StringSchema<undefined>, undefined>;
45
- readonly size: v.NumberSchema<undefined>;
46
- readonly width: v.NumberSchema<undefined>;
47
- readonly height: v.NumberSchema<undefined>;
48
- readonly sizeInBytes: v.NumberSchema<undefined>;
49
- }, undefined>, undefined>;
50
- readonly thumbnail: v.OptionalSchema<v.ObjectSchema<{
51
- readonly ext: v.StringSchema<undefined>;
52
- readonly url: v.StringSchema<undefined>;
53
- readonly hash: v.StringSchema<undefined>;
54
- readonly mime: v.StringSchema<undefined>;
55
- readonly name: v.StringSchema<undefined>;
56
- readonly path: v.NullableSchema<v.StringSchema<undefined>, undefined>;
57
- readonly size: v.NumberSchema<undefined>;
58
- readonly width: v.NumberSchema<undefined>;
59
- readonly height: v.NumberSchema<undefined>;
60
- readonly sizeInBytes: v.NumberSchema<undefined>;
61
- }, undefined>, undefined>;
62
- }, undefined>, undefined>, undefined>;
63
- readonly hash: v.StringSchema<undefined>;
64
- readonly ext: v.StringSchema<undefined>;
65
- readonly mime: v.StringSchema<undefined>;
66
- readonly size: v.NumberSchema<undefined>;
67
- readonly url: v.StringSchema<undefined>;
68
- readonly previewUrl: v.NullableSchema<v.StringSchema<undefined>, undefined>;
69
- readonly provider: v.StringSchema<undefined>;
70
- readonly provider_metadata: v.NullSchema<undefined>;
71
- readonly id: v.NumberSchema<undefined>;
72
- readonly documentId: v.StringSchema<undefined>;
73
- readonly publishedAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
74
- readonly createdAt: v.StringSchema<undefined>;
75
- readonly updatedAt: v.StringSchema<undefined>;
76
- }, undefined>>, undefined>, undefined>;
77
- readonly is_active: v.BooleanSchema<undefined>;
78
- readonly is_hidden: v.BooleanSchema<undefined>;
79
- readonly project_status: v.ArraySchema<v.PicklistSchema<readonly ["coming-soon", "now-open", "for-sale", "sold-out", "available"], undefined>, undefined>;
80
- readonly project_phase: v.PicklistSchema<readonly ["brand", "p1", "p2", "p3", "p4", "p5", "closed"], undefined>;
81
- readonly project_url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
82
- readonly project_type: v.NullableSchema<v.StringSchema<undefined>, undefined>;
83
- readonly project_pricing: v.NullableSchema<v.StringSchema<undefined>, undefined>;
84
- readonly project_address: v.NullableSchema<v.StringSchema<undefined>, undefined>;
85
- readonly phone_number: v.NullableSchema<v.StringSchema<undefined>, undefined>;
86
- readonly num_of_models: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
87
- readonly num_of_units_remain: v.NullableSchema<v.NumberSchema<undefined>, undefined>;
88
- readonly buyer_profile: v.NullableSchema<v.StringSchema<undefined>, undefined>;
89
- readonly social_organic_start_date: v.NullableSchema<v.StringSchema<undefined>, undefined>;
90
- readonly paid_media_start_date: v.NullableSchema<v.StringSchema<undefined>, undefined>;
91
- readonly go_date: v.NullableSchema<v.StringSchema<undefined>, undefined>;
92
- readonly id: v.NumberSchema<undefined>;
93
- readonly documentId: v.StringSchema<undefined>;
94
- readonly publishedAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
95
- readonly createdAt: v.StringSchema<undefined>;
96
- readonly updatedAt: v.StringSchema<undefined>;
97
- }, undefined>;
98
- type ClientProjectDocument = v.InferOutput<typeof ClientProjectDocument>;
99
- //#endregion
100
- export { ClientProjectDocument as t };
@@ -1,54 +0,0 @@
1
- import { t as BaseDocument } from "./document-Bqoi1MdT.mjs";
2
- import { ComponentSharedRichTextBlock, SeoMeta } from "./components/shared/index.mjs";
3
- import { ComponentBlockButtonGroup, ComponentBlockContact, ComponentBlockFaq, ComponentBlockFullscreenContent, ComponentBlockGraphicImage, ComponentBlockPullQuote, ComponentBlockSectionTitle, ComponentBlockVideo } from "./components/blocks/index.mjs";
4
- import { ComponentFormSelect } from "./components/forms/index.mjs";
5
- import { ComponentSlideshow } from "./components/slideshow/index.mjs";
6
- import * as v from "valibot";
7
- //#region src/entities/blog-post/constants.ts
8
- const LIMIT_BLOG_POST_PAGINATION_DEFAULT_SIZE = 6;
9
- const LIMIT_BLOG_POST_PAGINATION_MAX_SIZE = 20;
10
- const BLOG_POST_SORT_KEYS = [
11
- "id",
12
- "title",
13
- "slug",
14
- "is_live",
15
- "is_featured",
16
- "is_public",
17
- "published",
18
- "createdAt",
19
- "updatedAt"
20
- ];
21
- const BLOG_POST_LAYOUT = ["main-aside", "center-column"];
22
- //#endregion
23
- //#region src/entities/blog-post/fields.ts
24
- const QuerySortBlogPosts = v.optional(v.pipe(v.array(v.picklist(BLOG_POST_SORT_KEYS.flatMap((k) => [`${k}:ASC`, `${k}:DESC`]))), v.maxLength(BLOG_POST_SORT_KEYS.length)));
25
- const BlogPostLayout = v.picklist(BLOG_POST_LAYOUT);
26
- const BlogPostBlock = v.union([
27
- v.lazy(() => ComponentBlockSectionTitle),
28
- v.lazy(() => ComponentBlockGraphicImage),
29
- v.lazy(() => ComponentBlockPullQuote),
30
- v.lazy(() => ComponentBlockVideo),
31
- v.lazy(() => ComponentBlockFaq),
32
- v.lazy(() => ComponentBlockContact),
33
- v.lazy(() => ComponentBlockButtonGroup),
34
- v.lazy(() => ComponentBlockFullscreenContent),
35
- v.lazy(() => ComponentFormSelect),
36
- v.lazy(() => ComponentSlideshow),
37
- v.lazy(() => ComponentSharedRichTextBlock)
38
- ]);
39
- //#endregion
40
- //#region src/entities/blog-post/document.ts
41
- const BlogPostDocument = v.object({
42
- ...BaseDocument.entries,
43
- title: v.string(),
44
- slug: v.string(),
45
- excerpt: v.string(),
46
- published: v.string(),
47
- is_live: v.boolean(),
48
- is_featured: v.boolean(),
49
- is_public: v.boolean(),
50
- seo: v.optional(v.nullable(SeoMeta)),
51
- layout: v.nullable(BlogPostLayout)
52
- });
53
- //#endregion
54
- export { BLOG_POST_LAYOUT as a, LIMIT_BLOG_POST_PAGINATION_MAX_SIZE as c, QuerySortBlogPosts as i, BlogPostBlock as n, BLOG_POST_SORT_KEYS as o, BlogPostLayout as r, LIMIT_BLOG_POST_PAGINATION_DEFAULT_SIZE as s, BlogPostDocument as t };
@@ -1,17 +0,0 @@
1
- import * as v from "valibot";
2
-
3
- //#region src/entities/media-creative-format/document.d.ts
4
- declare const MediaCreativeFormatDocument: v.ObjectSchema<{
5
- readonly title: v.StringSchema<undefined>;
6
- readonly slug: v.StringSchema<undefined>;
7
- readonly is_active: v.BooleanSchema<undefined>;
8
- readonly description: v.NullableSchema<v.StringSchema<undefined>, undefined>;
9
- readonly id: v.NumberSchema<undefined>;
10
- readonly documentId: v.StringSchema<undefined>;
11
- readonly publishedAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
12
- readonly createdAt: v.StringSchema<undefined>;
13
- readonly updatedAt: v.StringSchema<undefined>;
14
- }, undefined>;
15
- type MediaCreativeFormatDocument = v.InferOutput<typeof MediaCreativeFormatDocument>;
16
- //#endregion
17
- export { MediaCreativeFormatDocument as t };
@@ -1,27 +0,0 @@
1
- import * as v from "valibot";
2
-
3
- //#region src/entities/content-pillar/document.d.ts
4
- declare const ContentPillarDocument: v.ObjectSchema<{
5
- readonly title: v.StringSchema<undefined>;
6
- readonly slug: v.StringSchema<undefined>;
7
- readonly description: v.NullableSchema<v.StringSchema<undefined>, undefined>;
8
- readonly information: v.NullableSchema<v.ArraySchema<v.ObjectSchema<{
9
- readonly type: v.StringSchema<undefined>;
10
- readonly children: v.ArraySchema<v.ObjectSchema<{
11
- readonly type: v.StringSchema<undefined>;
12
- readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
13
- readonly text: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
14
- readonly bold: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
15
- readonly italic: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
16
- readonly underline: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
17
- }, undefined>, undefined>;
18
- }, undefined>, undefined>, undefined>;
19
- readonly id: v.NumberSchema<undefined>;
20
- readonly documentId: v.StringSchema<undefined>;
21
- readonly publishedAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
22
- readonly createdAt: v.StringSchema<undefined>;
23
- readonly updatedAt: v.StringSchema<undefined>;
24
- }, undefined>;
25
- type ContentPillarDocument = v.InferOutput<typeof ContentPillarDocument>;
26
- //#endregion
27
- export { ContentPillarDocument as t };
@@ -1,30 +0,0 @@
1
- import * as v from "valibot";
2
-
3
- //#region src/entities/media-content-type/document.d.ts
4
- declare const MediaContentTypeDocument: v.ObjectSchema<{
5
- readonly title: v.StringSchema<undefined>;
6
- readonly slug: v.StringSchema<undefined>;
7
- readonly is_active: v.BooleanSchema<undefined>;
8
- readonly is_organic_social: v.BooleanSchema<undefined>;
9
- readonly is_paid_media: v.BooleanSchema<undefined>;
10
- readonly description: v.NullableSchema<v.StringSchema<undefined>, undefined>;
11
- readonly information: v.NullableSchema<v.ArraySchema<v.ObjectSchema<{
12
- readonly type: v.StringSchema<undefined>;
13
- readonly children: v.ArraySchema<v.ObjectSchema<{
14
- readonly type: v.StringSchema<undefined>;
15
- readonly url: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
16
- readonly text: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
17
- readonly bold: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
18
- readonly italic: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
19
- readonly underline: v.OptionalSchema<v.BooleanSchema<undefined>, undefined>;
20
- }, undefined>, undefined>;
21
- }, undefined>, undefined>, undefined>;
22
- readonly id: v.NumberSchema<undefined>;
23
- readonly documentId: v.StringSchema<undefined>;
24
- readonly publishedAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
25
- readonly createdAt: v.StringSchema<undefined>;
26
- readonly updatedAt: v.StringSchema<undefined>;
27
- }, undefined>;
28
- type MediaContentTypeDocument = v.InferOutput<typeof MediaContentTypeDocument>;
29
- //#endregion
30
- export { MediaContentTypeDocument as t };
@@ -1,16 +0,0 @@
1
- import * as v from "valibot";
2
-
3
- //#region src/entities/user-account/document.d.ts
4
- declare const UserAccountDocument: v.ObjectSchema<{
5
- readonly preferred_name: v.NullableSchema<v.StringSchema<undefined>, undefined>;
6
- readonly first_name: v.StringSchema<undefined>;
7
- readonly last_name: v.StringSchema<undefined>;
8
- readonly id: v.NumberSchema<undefined>;
9
- readonly documentId: v.StringSchema<undefined>;
10
- readonly publishedAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
11
- readonly createdAt: v.StringSchema<undefined>;
12
- readonly updatedAt: v.StringSchema<undefined>;
13
- }, undefined>;
14
- type UserAccountDocument = v.InferOutput<typeof UserAccountDocument>;
15
- //#endregion
16
- export { UserAccountDocument as t };
@@ -1,16 +0,0 @@
1
- import * as v from "valibot";
2
-
3
- //#region src/entities/up-role/document.d.ts
4
- declare const RoleDocument: v.ObjectSchema<{
5
- readonly type: v.PicklistSchema<readonly ["authenticated", "public", "employee", "manager", "client"], undefined>;
6
- readonly name: v.StringSchema<undefined>;
7
- readonly description: v.NullableSchema<v.StringSchema<undefined>, undefined>;
8
- readonly id: v.NumberSchema<undefined>;
9
- readonly documentId: v.StringSchema<undefined>;
10
- readonly publishedAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
11
- readonly createdAt: v.StringSchema<undefined>;
12
- readonly updatedAt: v.StringSchema<undefined>;
13
- }, undefined>;
14
- type RoleDocument = v.InferOutput<typeof RoleDocument>;
15
- //#endregion
16
- export { RoleDocument as t };
@@ -1,18 +0,0 @@
1
- import * as v from "valibot";
2
-
3
- //#region src/entities/gcflytour/document.d.ts
4
- declare const GCFlyTourDocument: v.ObjectSchema<{
5
- readonly title: v.StringSchema<undefined>;
6
- readonly slug: v.StringSchema<undefined>;
7
- readonly description: v.NullableSchema<v.StringSchema<undefined>, undefined>;
8
- readonly is_active: v.BooleanSchema<undefined>;
9
- readonly is_hidden: v.BooleanSchema<undefined>;
10
- readonly id: v.NumberSchema<undefined>;
11
- readonly documentId: v.StringSchema<undefined>;
12
- readonly publishedAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
13
- readonly createdAt: v.StringSchema<undefined>;
14
- readonly updatedAt: v.StringSchema<undefined>;
15
- }, undefined>;
16
- type GCFlyTourDocument = v.InferOutput<typeof GCFlyTourDocument>;
17
- //#endregion
18
- export { GCFlyTourDocument as t };
@@ -1,18 +0,0 @@
1
- import * as v from "valibot";
2
-
3
- //#region src/entities/gcflytour/document.d.ts
4
- declare const GCFlyTourDocument: v.ObjectSchema<{
5
- readonly title: v.StringSchema<undefined>;
6
- readonly slug: v.StringSchema<undefined>;
7
- readonly description: v.NullableSchema<v.StringSchema<undefined>, undefined>;
8
- readonly is_active: v.BooleanSchema<undefined>;
9
- readonly is_hidden: v.BooleanSchema<undefined>;
10
- readonly id: v.NumberSchema<undefined>;
11
- readonly documentId: v.StringSchema<undefined>;
12
- readonly publishedAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
13
- readonly createdAt: v.StringSchema<undefined>;
14
- readonly updatedAt: v.StringSchema<undefined>;
15
- }, undefined>;
16
- type GCFlyTourDocument = v.InferOutput<typeof GCFlyTourDocument>;
17
- //#endregion
18
- export { GCFlyTourDocument as t };
@@ -1,15 +0,0 @@
1
- import * as v from "valibot";
2
-
3
- //#region src/entities/client-media-platform/document.d.ts
4
- declare const ClientMediaPlatformDocument: v.ObjectSchema<{
5
- readonly url: v.NullableSchema<v.StringSchema<undefined>, undefined>;
6
- readonly is_active: v.BooleanSchema<undefined>;
7
- readonly id: v.NumberSchema<undefined>;
8
- readonly documentId: v.StringSchema<undefined>;
9
- readonly publishedAt: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
10
- readonly createdAt: v.StringSchema<undefined>;
11
- readonly updatedAt: v.StringSchema<undefined>;
12
- }, undefined>;
13
- type ClientMediaPlatformDocument = v.InferOutput<typeof ClientMediaPlatformDocument>;
14
- //#endregion
15
- export { ClientMediaPlatformDocument as t };