@kyro-cms/core 0.9.4 → 0.9.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.
Files changed (61) hide show
  1. package/dist/api-handler-graphql.cjs +10 -10
  2. package/dist/api-handler-graphql.js +6 -6
  3. package/dist/api-handler-trpc.cjs +8 -8
  4. package/dist/api-handler-trpc.js +6 -6
  5. package/dist/api-handler.cjs +9 -9
  6. package/dist/api-handler.js +6 -6
  7. package/dist/{chunk-YFAVQQTU.js → chunk-AX2TZRQJ.js} +3 -3
  8. package/dist/{chunk-YFAVQQTU.js.map → chunk-AX2TZRQJ.js.map} +1 -1
  9. package/dist/{chunk-5H3MWQJS.js → chunk-CMXVTUYV.js} +12 -12
  10. package/dist/chunk-CMXVTUYV.js.map +1 -0
  11. package/dist/{chunk-E2763JUP.cjs → chunk-DRVOUQMT.cjs} +27 -27
  12. package/dist/chunk-DRVOUQMT.cjs.map +1 -0
  13. package/dist/{chunk-4M7X5HAB.cjs → chunk-FKKQUMXR.cjs} +109 -3
  14. package/dist/chunk-FKKQUMXR.cjs.map +1 -0
  15. package/dist/{chunk-PV2I2KMI.cjs → chunk-HVCUIII2.cjs} +21 -75
  16. package/dist/chunk-HVCUIII2.cjs.map +1 -0
  17. package/dist/{chunk-CJONKRHJ.js → chunk-NZEUU7QB.js} +108 -3
  18. package/dist/chunk-NZEUU7QB.js.map +1 -0
  19. package/dist/{chunk-NWUEVLQT.cjs → chunk-OZ3CCTTA.cjs} +5 -5
  20. package/dist/{chunk-NWUEVLQT.cjs.map → chunk-OZ3CCTTA.cjs.map} +1 -1
  21. package/dist/chunk-PONTBXR5.js +842 -0
  22. package/dist/chunk-PONTBXR5.js.map +1 -0
  23. package/dist/{chunk-CNKT4PME.cjs → chunk-QVJNSAQL.cjs} +71 -149
  24. package/dist/chunk-QVJNSAQL.cjs.map +1 -0
  25. package/dist/{chunk-OHC6UHFY.js → chunk-QX3WNQ7V.js} +18 -72
  26. package/dist/chunk-QX3WNQ7V.js.map +1 -0
  27. package/dist/chunk-RRKCIAPU.cjs +848 -0
  28. package/dist/chunk-RRKCIAPU.cjs.map +1 -0
  29. package/dist/{chunk-NI5D3F7H.cjs → chunk-U3VVLYXG.cjs} +55 -7
  30. package/dist/chunk-U3VVLYXG.cjs.map +1 -0
  31. package/dist/{chunk-IPTZM3VE.js → chunk-VLK5SJRI.js} +56 -134
  32. package/dist/chunk-VLK5SJRI.js.map +1 -0
  33. package/dist/{chunk-NFKRKH3P.js → chunk-X4BPPD6K.js} +52 -4
  34. package/dist/chunk-X4BPPD6K.js.map +1 -0
  35. package/dist/graphql/index.cjs +8 -4
  36. package/dist/graphql/index.d.cts +4 -1
  37. package/dist/graphql/index.d.ts +4 -1
  38. package/dist/graphql/index.js +2 -2
  39. package/dist/index.cjs +59 -59
  40. package/dist/index.js +7 -7
  41. package/dist/integration.cjs +2 -2
  42. package/dist/integration.js +1 -1
  43. package/dist/rest/index.cjs +4 -4
  44. package/dist/rest/index.js +2 -2
  45. package/dist/trpc/index.cjs +11 -11
  46. package/dist/trpc/index.js +2 -2
  47. package/package.json +2 -2
  48. package/dist/chunk-3HR772HI.cjs +0 -555
  49. package/dist/chunk-3HR772HI.cjs.map +0 -1
  50. package/dist/chunk-4M7X5HAB.cjs.map +0 -1
  51. package/dist/chunk-5H3MWQJS.js.map +0 -1
  52. package/dist/chunk-CJONKRHJ.js.map +0 -1
  53. package/dist/chunk-CNKT4PME.cjs.map +0 -1
  54. package/dist/chunk-E2763JUP.cjs.map +0 -1
  55. package/dist/chunk-IPTZM3VE.js.map +0 -1
  56. package/dist/chunk-L5UKKZQN.js +0 -552
  57. package/dist/chunk-L5UKKZQN.js.map +0 -1
  58. package/dist/chunk-NFKRKH3P.js.map +0 -1
  59. package/dist/chunk-NI5D3F7H.cjs.map +0 -1
  60. package/dist/chunk-OHC6UHFY.js.map +0 -1
  61. package/dist/chunk-PV2I2KMI.cjs.map +0 -1
@@ -5,7 +5,7 @@ var chunkKC2GDBLS_cjs = require('./chunk-KC2GDBLS.cjs');
5
5
  var chunkIDVRRRAK_cjs = require('./chunk-IDVRRRAK.cjs');
6
6
  var chunkADLJSJSN_cjs = require('./chunk-ADLJSJSN.cjs');
7
7
  var chunkQFLB4EIJ_cjs = require('./chunk-QFLB4EIJ.cjs');
8
- var chunk4M7X5HAB_cjs = require('./chunk-4M7X5HAB.cjs');
8
+ var chunkFKKQUMXR_cjs = require('./chunk-FKKQUMXR.cjs');
9
9
  var chunkRFFSZSCL_cjs = require('./chunk-RFFSZSCL.cjs');
10
10
  var chunk7OS7TX2Q_cjs = require('./chunk-7OS7TX2Q.cjs');
11
11
  var chunkQ23GAMLE_cjs = require('./chunk-Q23GAMLE.cjs');
@@ -391,14 +391,14 @@ function createAuthMiddleware(config) {
391
391
  userLookup
392
392
  } = config;
393
393
  return async function authMiddleware(req) {
394
- const apiKeyRaw = chunk4M7X5HAB_cjs.extractApiKeyFromRequest(req);
394
+ const apiKeyRaw = chunkFKKQUMXR_cjs.extractApiKeyFromRequest(req);
395
395
  if (apiKeyRaw && db) {
396
- const result = await chunk4M7X5HAB_cjs.validateApiKey(apiKeyRaw, db, userLookup);
396
+ const result = await chunkFKKQUMXR_cjs.validateApiKey(apiKeyRaw, db, userLookup);
397
397
  if (result.valid && result.user) {
398
398
  return {
399
399
  user: result.user,
400
400
  tenantContext: createTenantContextFromUser(result.user),
401
- apiKeyContext: chunk4M7X5HAB_cjs.createApiKeyContext(result),
401
+ apiKeyContext: chunkFKKQUMXR_cjs.createApiKeyContext(result),
402
402
  status: 200,
403
403
  authType: "apikey"
404
404
  };
@@ -3545,105 +3545,27 @@ function buildConflictResponse(expectedUpdatedAt, currentDoc) {
3545
3545
  }
3546
3546
  };
3547
3547
  }
3548
- async function checkCollectionAccess(collection, operation, req, ctxUser, ctxTenantID, apiKeyContext, enablePublicAccess = true, defaultCollectionAccess = "none") {
3549
- const accessRule = collection.access?.[operation];
3550
- const accessLevels = {
3551
- none: false,
3552
- read: operation === "read",
3553
- create: operation === "read" || operation === "create",
3554
- update: operation === "read" || operation === "create" || operation === "update",
3555
- delete: operation === "read" || operation === "create" || operation === "update" || operation === "delete",
3556
- admin: true
3557
- };
3558
- const isDefaultAllowed = accessLevels[defaultCollectionAccess] || false;
3559
- if (accessRule) {
3560
- const allowed = await chunk4M7X5HAB_cjs.evaluateAccess(accessRule, {
3561
- req,
3562
- user: ctxUser,
3563
- tenantID: ctxTenantID
3564
- });
3565
- if (allowed === false) {
3566
- return { allowed: false, error: "Access denied", status: 403 };
3567
- }
3568
- } else if (!ctxUser) {
3569
- const allowed = enablePublicAccess && isDefaultAllowed;
3570
- if (!allowed) {
3571
- return {
3572
- allowed: false,
3573
- error: "Authentication required",
3574
- status: 401
3575
- };
3576
- }
3577
- }
3578
- if (apiKeyContext?.permissions?.length > 0) {
3579
- const resource = collection.slug;
3580
- const action = operation === "read" ? "read" : operation === "create" ? "create" : "update";
3581
- const permission = `${resource}:${action}`;
3582
- if (!chunk4M7X5HAB_cjs.hasApiKeyPermission(apiKeyContext.permissions, permission) && !chunk4M7X5HAB_cjs.hasApiKeyPermission(apiKeyContext.permissions, `${resource}:admin`)) {
3583
- return {
3584
- allowed: false,
3585
- error: `Missing permission: ${permission}`,
3586
- status: 403
3587
- };
3588
- }
3589
- }
3590
- if (ctxUser && !(apiKeyContext?.permissions?.length > 0)) {
3591
- const resource = collection.slug;
3592
- const action = operation === "read" ? "read" : operation === "create" ? "create" : operation === "update" ? "update" : "delete";
3593
- const permission = `${resource}:${action}`;
3594
- let rbacAllowed = false;
3595
- if (ctxUser.role) {
3596
- const userHasPermission = chunkNKPKR5BW_cjs.hasPermission(
3597
- { id: ctxUser.id, email: ctxUser.email, role: ctxUser.role },
3598
- permission
3599
- );
3600
- if (userHasPermission) {
3601
- rbacAllowed = true;
3602
- } else {
3603
- const adminPermission = chunkNKPKR5BW_cjs.hasPermission(
3604
- { id: ctxUser.id, email: ctxUser.email, role: ctxUser.role },
3605
- `${resource}:admin`
3606
- );
3607
- if (adminPermission) rbacAllowed = true;
3608
- }
3609
- }
3610
- if (!rbacAllowed && !isDefaultAllowed && !accessRule) {
3611
- return {
3612
- allowed: false,
3613
- error: `Missing RBAC permission: ${permission}`,
3614
- status: 403
3615
- };
3616
- }
3617
- }
3618
- return { allowed: true };
3548
+ async function checkCollectionAccess2(collection, operation, req, ctxUser, ctxTenantID, apiKeyContext, enablePublicAccess = true, defaultCollectionAccess = "none") {
3549
+ const result = await chunkFKKQUMXR_cjs.checkCollectionAccess(collection, operation, {
3550
+ user: ctxUser,
3551
+ req,
3552
+ tenantID: ctxTenantID,
3553
+ apiKey: apiKeyContext
3554
+ }, {
3555
+ enablePublicAccess,
3556
+ defaultAccess: defaultCollectionAccess
3557
+ });
3558
+ return result;
3619
3559
  }
3620
- async function checkGlobalAccess(global, operation, req, ctxUser, ctxTenantID, enablePublicAccess = true) {
3621
- const accessRule = global.access?.[operation];
3622
- if (accessRule) {
3623
- const allowed = await chunk4M7X5HAB_cjs.evaluateAccess(accessRule, {
3624
- req,
3625
- user: ctxUser,
3626
- tenantID: ctxTenantID
3627
- });
3628
- if (allowed === false) {
3629
- return { allowed: false, error: "Access denied", status: 403 };
3630
- }
3631
- } else if (!ctxUser) {
3632
- const accessLevels = {
3633
- none: false,
3634
- read: operation === "read",
3635
- update: operation === "read" || operation === "update"
3636
- };
3637
- const allowed = enablePublicAccess && accessLevels[operation === "read" ? "read" : "admin"];
3638
- if (!allowed) {
3639
- return {
3640
- allowed: false,
3641
- error: "Authentication required",
3642
- status: 401
3643
- };
3644
- }
3645
- }
3646
- return { allowed: true };
3560
+ async function checkGlobalAccess2(global, operation, req, ctxUser, ctxTenantID, enablePublicAccess = true) {
3561
+ const result = await chunkFKKQUMXR_cjs.checkGlobalAccess(global, operation, {
3562
+ user: ctxUser,
3563
+ req,
3564
+ tenantID: ctxTenantID
3565
+ }, {
3566
+ enablePublicAccess
3567
+ });
3568
+ return result;
3647
3569
  }
3648
3570
  async function resolveAuthContext(req, authMw, staticUser, staticTenantID) {
3649
3571
  if (staticUser) {
@@ -3815,7 +3737,7 @@ function createHonoApp(options) {
3815
3737
  const globals = {};
3816
3738
  for (const col of registry.getCollections()) {
3817
3739
  const permissions = {
3818
- read: (await checkCollectionAccess(
3740
+ read: (await checkCollectionAccess2(
3819
3741
  col,
3820
3742
  "read",
3821
3743
  c.req.raw,
@@ -3825,7 +3747,7 @@ function createHonoApp(options) {
3825
3747
  enablePublicAccess,
3826
3748
  defaultCollectionAccess
3827
3749
  )).allowed,
3828
- create: (await checkCollectionAccess(
3750
+ create: (await checkCollectionAccess2(
3829
3751
  col,
3830
3752
  "create",
3831
3753
  c.req.raw,
@@ -3835,7 +3757,7 @@ function createHonoApp(options) {
3835
3757
  enablePublicAccess,
3836
3758
  defaultCollectionAccess
3837
3759
  )).allowed,
3838
- update: (await checkCollectionAccess(
3760
+ update: (await checkCollectionAccess2(
3839
3761
  col,
3840
3762
  "update",
3841
3763
  c.req.raw,
@@ -3845,7 +3767,7 @@ function createHonoApp(options) {
3845
3767
  enablePublicAccess,
3846
3768
  defaultCollectionAccess
3847
3769
  )).allowed,
3848
- delete: (await checkCollectionAccess(
3770
+ delete: (await checkCollectionAccess2(
3849
3771
  col,
3850
3772
  "delete",
3851
3773
  c.req.raw,
@@ -3860,7 +3782,7 @@ function createHonoApp(options) {
3860
3782
  }
3861
3783
  for (const globalConfig of registry.getGlobals()) {
3862
3784
  const permissions = {
3863
- read: (await checkGlobalAccess(
3785
+ read: (await checkGlobalAccess2(
3864
3786
  globalConfig,
3865
3787
  "read",
3866
3788
  c.req.raw,
@@ -3868,7 +3790,7 @@ function createHonoApp(options) {
3868
3790
  ctxTenantID,
3869
3791
  enablePublicAccess
3870
3792
  )).allowed,
3871
- update: (await checkGlobalAccess(
3793
+ update: (await checkGlobalAccess2(
3872
3794
  globalConfig,
3873
3795
  "update",
3874
3796
  c.req.raw,
@@ -3899,7 +3821,7 @@ function createHonoApp(options) {
3899
3821
  user,
3900
3822
  tenantID
3901
3823
  );
3902
- const access = await checkCollectionAccess(
3824
+ const access = await checkCollectionAccess2(
3903
3825
  usersCollection2,
3904
3826
  "read",
3905
3827
  c.req.raw,
@@ -3963,7 +3885,7 @@ function createHonoApp(options) {
3963
3885
  user,
3964
3886
  tenantID
3965
3887
  );
3966
- const access = await checkCollectionAccess(
3888
+ const access = await checkCollectionAccess2(
3967
3889
  usersCollection2,
3968
3890
  "create",
3969
3891
  c.req.raw,
@@ -4017,7 +3939,7 @@ function createHonoApp(options) {
4017
3939
  user,
4018
3940
  tenantID
4019
3941
  );
4020
- const access = await checkCollectionAccess(
3942
+ const access = await checkCollectionAccess2(
4021
3943
  usersCollection2,
4022
3944
  "update",
4023
3945
  c.req.raw,
@@ -4086,7 +4008,7 @@ function createHonoApp(options) {
4086
4008
  user,
4087
4009
  tenantID
4088
4010
  );
4089
- const access = await checkCollectionAccess(
4011
+ const access = await checkCollectionAccess2(
4090
4012
  usersCollection2,
4091
4013
  "delete",
4092
4014
  c.req.raw,
@@ -4135,7 +4057,7 @@ function createHonoApp(options) {
4135
4057
  );
4136
4058
  const auditLogsCollection = registry.getCollection("audit_logs");
4137
4059
  if (auditLogsCollection) {
4138
- const access = await checkCollectionAccess(
4060
+ const access = await checkCollectionAccess2(
4139
4061
  auditLogsCollection,
4140
4062
  "read",
4141
4063
  c.req.raw,
@@ -4810,7 +4732,7 @@ function createHonoApp(options) {
4810
4732
  );
4811
4733
  for (const collection of registry.getCollections()) {
4812
4734
  if (!targetCollections.includes(collection.slug)) continue;
4813
- const access = await checkCollectionAccess(
4735
+ const access = await checkCollectionAccess2(
4814
4736
  collection,
4815
4737
  "read",
4816
4738
  c.req.raw,
@@ -4871,7 +4793,7 @@ function createHonoApp(options) {
4871
4793
  }
4872
4794
  const page = parseInt(c.req.query("page") || "1");
4873
4795
  const limit = Math.min(parseInt(c.req.query("limit") || "50"), 100);
4874
- const result = await db.find({ collection: chunk4M7X5HAB_cjs.API_KEY_COLLECTION, where: {}, page, limit, tenantID: ctxTenantID });
4796
+ const result = await db.find({ collection: chunkFKKQUMXR_cjs.API_KEY_COLLECTION, where: {}, page, limit, tenantID: ctxTenantID });
4875
4797
  const docs = (result.docs || []).map((doc) => ({
4876
4798
  id: doc.id,
4877
4799
  name: doc.name,
@@ -4896,14 +4818,14 @@ function createHonoApp(options) {
4896
4818
  if (!body.name || typeof body.name !== "string") {
4897
4819
  return c.json({ error: "name is required" }, 400);
4898
4820
  }
4899
- const rawKey = chunk4M7X5HAB_cjs.generateApiKey();
4821
+ const rawKey = chunkFKKQUMXR_cjs.generateApiKey();
4900
4822
  const doc = await db.create({
4901
- collection: chunk4M7X5HAB_cjs.API_KEY_COLLECTION,
4823
+ collection: chunkFKKQUMXR_cjs.API_KEY_COLLECTION,
4902
4824
  data: {
4903
4825
  userId: ctxUser.id,
4904
4826
  name: body.name,
4905
4827
  key: rawKey,
4906
- keyPrefix: chunk4M7X5HAB_cjs.generateApiKeyPrefix(rawKey),
4828
+ keyPrefix: chunkFKKQUMXR_cjs.generateApiKeyPrefix(rawKey),
4907
4829
  permissions: Array.isArray(body.permissions) ? body.permissions : ["*"],
4908
4830
  expiresAt: body.expiresAt || null,
4909
4831
  createdAt: (/* @__PURE__ */ new Date()).toISOString()
@@ -4934,9 +4856,9 @@ function createHonoApp(options) {
4934
4856
  return c.json({ error: "Forbidden" }, 403);
4935
4857
  }
4936
4858
  const id = c.req.param("id");
4937
- const existing = await db.findByID({ collection: chunk4M7X5HAB_cjs.API_KEY_COLLECTION, id });
4859
+ const existing = await db.findByID({ collection: chunkFKKQUMXR_cjs.API_KEY_COLLECTION, id });
4938
4860
  if (!existing) return c.json({ error: "API key not found" }, 404);
4939
- await db.delete({ collection: chunk4M7X5HAB_cjs.API_KEY_COLLECTION, id });
4861
+ await db.delete({ collection: chunkFKKQUMXR_cjs.API_KEY_COLLECTION, id });
4940
4862
  await sessionAuthAdapter?.createAuditLog({
4941
4863
  action: "api_key_delete",
4942
4864
  userId: ctxUser.id,
@@ -4959,14 +4881,14 @@ function createHonoApp(options) {
4959
4881
  }
4960
4882
  const id = c.req.param("id");
4961
4883
  const body = await c.req.json();
4962
- const existing = await db.findByID({ collection: chunk4M7X5HAB_cjs.API_KEY_COLLECTION, id });
4884
+ const existing = await db.findByID({ collection: chunkFKKQUMXR_cjs.API_KEY_COLLECTION, id });
4963
4885
  if (!existing) return c.json({ error: "API key not found" }, 404);
4964
4886
  const updateData = {};
4965
4887
  if (typeof body.name === "string" && body.name.trim()) updateData.name = body.name.trim();
4966
4888
  if (Array.isArray(body.permissions)) updateData.permissions = body.permissions;
4967
4889
  if (body.expiresAt !== void 0) updateData.expiresAt = body.expiresAt || null;
4968
4890
  if (Object.keys(updateData).length === 0) return c.json({ error: "Nothing to update" }, 400);
4969
- const updated = await db.update({ collection: chunk4M7X5HAB_cjs.API_KEY_COLLECTION, id, data: updateData });
4891
+ const updated = await db.update({ collection: chunkFKKQUMXR_cjs.API_KEY_COLLECTION, id, data: updateData });
4970
4892
  return c.json({ ...updated, keyPrefix: existing.keyPrefix });
4971
4893
  } catch (error) {
4972
4894
  console.error("[ApiKeys] PATCH error:", error);
@@ -4980,15 +4902,15 @@ function createHonoApp(options) {
4980
4902
  return c.json({ error: "Forbidden" }, 403);
4981
4903
  }
4982
4904
  const id = c.req.param("id");
4983
- const existing = await db.findByID({ collection: chunk4M7X5HAB_cjs.API_KEY_COLLECTION, id });
4905
+ const existing = await db.findByID({ collection: chunkFKKQUMXR_cjs.API_KEY_COLLECTION, id });
4984
4906
  if (!existing) return c.json({ error: "API key not found" }, 404);
4985
- const rawKey = chunk4M7X5HAB_cjs.generateApiKey();
4907
+ const rawKey = chunkFKKQUMXR_cjs.generateApiKey();
4986
4908
  const updated = await db.update({
4987
- collection: chunk4M7X5HAB_cjs.API_KEY_COLLECTION,
4909
+ collection: chunkFKKQUMXR_cjs.API_KEY_COLLECTION,
4988
4910
  id,
4989
4911
  data: {
4990
4912
  key: rawKey,
4991
- keyPrefix: chunk4M7X5HAB_cjs.generateApiKeyPrefix(rawKey),
4913
+ keyPrefix: chunkFKKQUMXR_cjs.generateApiKeyPrefix(rawKey),
4992
4914
  lastUsedAt: null
4993
4915
  }
4994
4916
  });
@@ -5169,7 +5091,7 @@ function createHonoApp(options) {
5169
5091
  tenantID: ctxTenantID,
5170
5092
  apiKeyContext
5171
5093
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
5172
- const access = await checkCollectionAccess(
5094
+ const access = await checkCollectionAccess2(
5173
5095
  collection,
5174
5096
  "read",
5175
5097
  c.req.raw,
@@ -5217,7 +5139,7 @@ function createHonoApp(options) {
5217
5139
  tenantID: ctxTenantID,
5218
5140
  apiKeyContext
5219
5141
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
5220
- const access = await checkCollectionAccess(
5142
+ const access = await checkCollectionAccess2(
5221
5143
  collection,
5222
5144
  "read",
5223
5145
  c.req.raw,
@@ -5271,7 +5193,7 @@ function createHonoApp(options) {
5271
5193
  tenantID: ctxTenantID,
5272
5194
  apiKeyContext
5273
5195
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
5274
- const access = await checkCollectionAccess(
5196
+ const access = await checkCollectionAccess2(
5275
5197
  collection,
5276
5198
  "update",
5277
5199
  c.req.raw,
@@ -5331,7 +5253,7 @@ function createHonoApp(options) {
5331
5253
  tenantID: ctxTenantID,
5332
5254
  apiKeyContext
5333
5255
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
5334
- const access = await checkCollectionAccess(
5256
+ const access = await checkCollectionAccess2(
5335
5257
  collection,
5336
5258
  "update",
5337
5259
  c.req.raw,
@@ -5366,7 +5288,7 @@ function createHonoApp(options) {
5366
5288
  tenantID: ctxTenantID,
5367
5289
  apiKeyContext
5368
5290
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
5369
- const access = await checkCollectionAccess(
5291
+ const access = await checkCollectionAccess2(
5370
5292
  collection,
5371
5293
  "read",
5372
5294
  c.req.raw,
@@ -5416,7 +5338,7 @@ function createHonoApp(options) {
5416
5338
  tenantID: ctxTenantID,
5417
5339
  apiKeyContext
5418
5340
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
5419
- const access = await checkCollectionAccess(
5341
+ const access = await checkCollectionAccess2(
5420
5342
  collection,
5421
5343
  "create",
5422
5344
  c.req.raw,
@@ -5540,7 +5462,7 @@ function createHonoApp(options) {
5540
5462
  tenantID: ctxTenantID,
5541
5463
  apiKeyContext
5542
5464
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
5543
- const access = await checkCollectionAccess(
5465
+ const access = await checkCollectionAccess2(
5544
5466
  collection,
5545
5467
  "update",
5546
5468
  c.req.raw,
@@ -5705,7 +5627,7 @@ function createHonoApp(options) {
5705
5627
  tenantID: ctxTenantID,
5706
5628
  apiKeyContext
5707
5629
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
5708
- const access = await checkCollectionAccess(
5630
+ const access = await checkCollectionAccess2(
5709
5631
  collection,
5710
5632
  "delete",
5711
5633
  c.req.raw,
@@ -5795,7 +5717,7 @@ function createHonoApp(options) {
5795
5717
  tenantID: ctxTenantID,
5796
5718
  apiKeyContext
5797
5719
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
5798
- const access = await checkCollectionAccess(
5720
+ const access = await checkCollectionAccess2(
5799
5721
  collection,
5800
5722
  "create",
5801
5723
  c.req.raw,
@@ -5843,7 +5765,7 @@ function createHonoApp(options) {
5843
5765
  tenantID: ctxTenantID,
5844
5766
  apiKeyContext
5845
5767
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
5846
- const access = await checkCollectionAccess(
5768
+ const access = await checkCollectionAccess2(
5847
5769
  collection,
5848
5770
  "update",
5849
5771
  c.req.raw,
@@ -5887,7 +5809,7 @@ function createHonoApp(options) {
5887
5809
  tenantID: ctxTenantID,
5888
5810
  apiKeyContext
5889
5811
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
5890
- const access = await checkCollectionAccess(
5812
+ const access = await checkCollectionAccess2(
5891
5813
  collection,
5892
5814
  "update",
5893
5815
  c.req.raw,
@@ -5934,7 +5856,7 @@ function createHonoApp(options) {
5934
5856
  tenantID: ctxTenantID,
5935
5857
  apiKeyContext
5936
5858
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
5937
- const access = await checkCollectionAccess(
5859
+ const access = await checkCollectionAccess2(
5938
5860
  collection,
5939
5861
  "update",
5940
5862
  c.req.raw,
@@ -6019,7 +5941,7 @@ function createHonoApp(options) {
6019
5941
  tenantID: ctxTenantID,
6020
5942
  apiKeyContext
6021
5943
  } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
6022
- const access = await checkCollectionAccess(
5944
+ const access = await checkCollectionAccess2(
6023
5945
  collection,
6024
5946
  "update",
6025
5947
  c.req.raw,
@@ -6069,7 +5991,7 @@ function createHonoApp(options) {
6069
5991
  app.get(basePath, async (c) => {
6070
5992
  try {
6071
5993
  const { user: ctxUser, tenantID: ctxTenantID } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
6072
- const access = await checkGlobalAccess(
5994
+ const access = await checkGlobalAccess2(
6073
5995
  globalConfig,
6074
5996
  "read",
6075
5997
  c.req.raw,
@@ -6113,7 +6035,7 @@ function createHonoApp(options) {
6113
6035
  const upsertGlobal = async (c) => {
6114
6036
  try {
6115
6037
  const { user: ctxUser, tenantID: ctxTenantID } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
6116
- const access = await checkGlobalAccess(
6038
+ const access = await checkGlobalAccess2(
6117
6039
  globalConfig,
6118
6040
  "update",
6119
6041
  c.req.raw,
@@ -6248,7 +6170,7 @@ function createHonoApp(options) {
6248
6170
  app.post(`${basePath}/publish`, async (c) => {
6249
6171
  try {
6250
6172
  const { user: ctxUser, tenantID: ctxTenantID } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
6251
- const access = await checkGlobalAccess(globalConfig, "update", c.req.raw, ctxUser, ctxTenantID, enablePublicAccess);
6173
+ const access = await checkGlobalAccess2(globalConfig, "update", c.req.raw, ctxUser, ctxTenantID, enablePublicAccess);
6252
6174
  if (!access.allowed) return c.json({ error: access.error }, 403);
6253
6175
  const collectionSlug = `_globals_${slug}`;
6254
6176
  const originalDoc = await db.findOne({
@@ -6298,7 +6220,7 @@ function createHonoApp(options) {
6298
6220
  app.post(`${basePath}/unpublish`, async (c) => {
6299
6221
  try {
6300
6222
  const { user: ctxUser, tenantID: ctxTenantID } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
6301
- const access = await checkGlobalAccess(globalConfig, "update", c.req.raw, ctxUser, ctxTenantID, enablePublicAccess);
6223
+ const access = await checkGlobalAccess2(globalConfig, "update", c.req.raw, ctxUser, ctxTenantID, enablePublicAccess);
6302
6224
  if (!access.allowed) return c.json({ error: access.error }, 403);
6303
6225
  const doc = await db.update({
6304
6226
  collection: `_globals_${slug}`,
@@ -6314,7 +6236,7 @@ function createHonoApp(options) {
6314
6236
  app.get(`${basePath}/versions`, async (c) => {
6315
6237
  try {
6316
6238
  const { user: ctxUser, tenantID: ctxTenantID } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
6317
- const access = await checkGlobalAccess(globalConfig, "read", c.req.raw, ctxUser, ctxTenantID, enablePublicAccess);
6239
+ const access = await checkGlobalAccess2(globalConfig, "read", c.req.raw, ctxUser, ctxTenantID, enablePublicAccess);
6318
6240
  if (!access.allowed) return c.json({ error: access.error }, 403);
6319
6241
  const limit = parseInt(c.req.query("limit") || "10");
6320
6242
  const page = parseInt(c.req.query("page") || "1");
@@ -6334,7 +6256,7 @@ function createHonoApp(options) {
6334
6256
  try {
6335
6257
  const versionId = c.req.param("versionId");
6336
6258
  const { user: ctxUser, tenantID: ctxTenantID } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
6337
- const access = await checkGlobalAccess(globalConfig, "read", c.req.raw, ctxUser, ctxTenantID, enablePublicAccess);
6259
+ const access = await checkGlobalAccess2(globalConfig, "read", c.req.raw, ctxUser, ctxTenantID, enablePublicAccess);
6338
6260
  if (!access.allowed) return c.json({ error: access.error }, 403);
6339
6261
  const version = await db.findVersionByID({
6340
6262
  collection: `_globals_${slug}`,
@@ -6351,7 +6273,7 @@ function createHonoApp(options) {
6351
6273
  try {
6352
6274
  const versionId = c.req.param("versionId");
6353
6275
  const { user: ctxUser, tenantID: ctxTenantID } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
6354
- const access = await checkGlobalAccess(globalConfig, "update", c.req.raw, ctxUser, ctxTenantID, enablePublicAccess);
6276
+ const access = await checkGlobalAccess2(globalConfig, "update", c.req.raw, ctxUser, ctxTenantID, enablePublicAccess);
6355
6277
  if (!access.allowed) return c.json({ error: access.error }, 403);
6356
6278
  const collectionSlug = `_globals_${slug}`;
6357
6279
  const version = await db.findVersionByID({
@@ -6379,7 +6301,7 @@ function createHonoApp(options) {
6379
6301
  app.post(`${basePath}/test`, async (c) => {
6380
6302
  try {
6381
6303
  const { user: ctxUser, tenantID: ctxTenantID } = await resolveAuthContext(c.req.raw, authMw, user, tenantID);
6382
- const access = await checkGlobalAccess(
6304
+ const access = await checkGlobalAccess2(
6383
6305
  globalConfig,
6384
6306
  "update",
6385
6307
  c.req.raw,
@@ -6491,5 +6413,5 @@ exports.init_secret = init_secret;
6491
6413
  exports.loadSecrets = loadSecrets;
6492
6414
  exports.resolveProvider = resolveProvider;
6493
6415
  exports.setDbAdapter = setDbAdapter;
6494
- //# sourceMappingURL=chunk-CNKT4PME.cjs.map
6495
- //# sourceMappingURL=chunk-CNKT4PME.cjs.map
6416
+ //# sourceMappingURL=chunk-QVJNSAQL.cjs.map
6417
+ //# sourceMappingURL=chunk-QVJNSAQL.cjs.map