@anievo-id/rbac-evolution-nuxt 0.4.0 → 0.5.0

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/dist/server.d.ts CHANGED
@@ -68,8 +68,9 @@ export declare class RbacHttpError extends Error {
68
68
  }
69
69
  export interface RbacServer<E extends RbacEvent = RbacEvent> {
70
70
  /**
71
- * Resolves the subject once per request and stores it on `event.context.rbac`
72
- * (a `SubjectRbac`, or `null` for guests). The Nuxt plugin reads it to hydrate the client.
71
+ * Resolves the subject once per request (cached per helper instance) and stores it on
72
+ * `event.context.rbac` (a `SubjectRbac`, or `null` for guests) unless another instance did
73
+ * first. The Nuxt plugin reads it to hydrate the client.
73
74
  */
74
75
  resolve(event: E): Promise<SubjectRbac | null>;
75
76
  /** The current subject's `{ roles, permissions }`, or `null` for guests. */
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AACjG,OAAO,EAA+B,KAAK,eAAe,EAAE,KAAK,gBAAgB,EAA2B,MAAM,gBAAgB,CAAA;AAElI,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEvE,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;AAErC,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACxB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS;IAChE,sDAAsD;IACtD,IAAI,EAAE,IAAI,CAAA;IACV,kHAAkH;IAClH,UAAU,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,YAAY,CAAC,OAAO,GAAG,IAAI,GAA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OAAO,CAAC,WAAW,CAAC,CAAA;CACrE;AAkBD;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,SAAS,SAAS,GAAG,SAAS,EAAE,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC,GAAG,UAAU,CAAC,CAAC,CAAC,CAmE9G"}
package/dist/server.js CHANGED
@@ -38,10 +38,10 @@ async function passes(rbac, kind, group) {
38
38
  }
39
39
  function createRbacServer(options) {
40
40
  const { rbac, getSubject, guard, team, exposeRequirements = false } = options;
41
+ const resolved = /* @__PURE__ */ new WeakMap();
41
42
  async function resolve(event) {
42
43
  const context = event.context;
43
- const cached = context[CONTEXT_KEY];
44
- if (cached !== void 0) return cached;
44
+ if (resolved.has(context)) return resolved.get(context);
45
45
  const subject = await getSubject(event);
46
46
  let result = null;
47
47
  if (subject) {
@@ -51,7 +51,8 @@ function createRbacServer(options) {
51
51
  ...teamId !== void 0 && { team: teamId }
52
52
  });
53
53
  }
54
- context[CONTEXT_KEY] = result;
54
+ resolved.set(context, result);
55
+ if (context[CONTEXT_KEY] === void 0) context[CONTEXT_KEY] = result;
55
56
  return result;
56
57
  }
57
58
  async function enforce(event, kind, requirements) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/server.ts"],"names":[],"mappings":";;;AAsDO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EACvC,OAAgB,YAAA,GAAe,IAAA;AAAA,EACtB,UAAA;AAAA,EACA,aAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA,GAAQ,KAAA;AAAA,EACR,SAAA,GAAY,KAAA;AAAA,EAErB,YAAY,IAAA,EAAqB;AAC/B,IAAA,KAAA,CAAM,KAAK,OAAO,CAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AACZ,IAAA,IAAA,CAAK,UAAA,GAAa,IAAA,CAAK,KAAA,KAAU,iBAAA,GAAoB,GAAA,GAAM,GAAA;AAC3D,IAAA,IAAA,C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AAO,oBAAA,EAAsB,iBAAA,CAAkB,oBAAA,EAAsB,KAAK,CAAC,CAAA;AAAA,IAC5F,CAAA;AAAA,IACA,MAAA,CAAO,UAAU,KAAA,EAAO;AACtB,MAAA,OAAO,OAAA,CAAQ,KAAA,EAAO,YAAA,EAAc,iBAAA,CAAkB,YAAA,EAAc,OAAO,EAAE,GAAA,EAAK,IAAA,EAAM,CAAC,CAAA;AAAA,IAC3F,CAAA;AAAA,IACA,MAAA,CAAO,UAAU,KAAA,EAAO;AACtB,MAAA,OAAO,QAAQ,KAAA,EAAO,YAAA,EAAc,iBAAA,CAAkB,YAAA,EAAc,KAAK,CAAC,CAAA;AAAA,IAC5E;AAAA,GACF;AACF","file":"server.js","sourcesContent":["/**\n * @anievo-id/rbac-evolution-nuxt/server\n *\n * Server-side enforcement for Nitro / h3 event handlers. Runs on the server only.\n */\n\nimport type { Rbac, RbacSnapshot, Subject, SubjectRbac, TeamId } from '@anievo-id/rbac-evolution'\nimport { MESSAGES, requirementGroups, type RequirementKind, type RequirementNames, UNAUTHENTICATED_MESSAGE } from './requirements'\n\nexport type { RequirementKind, RequirementNames } from './requirements'\n\ntype MaybePromise<T> = T | Promise<T>\n\n/** The part of an h3 `H3Event` this helper uses. */\nexport interface RbacEvent {\n context: object\n}\n\nexport interface RbacServerOptions<E extends RbacEvent = RbacEvent> {\n /** The RBAC engine created with `createRbac(...)`. */\n rbac: Rbac\n /** Resolves the authenticated subject for this request (e.g. from a session). `null` / `undefined` for guests. */\n getSubject: (event: E) => MaybePromise<Subject | null | undefined>\n /** Guard name (e.g. `web` or `api`). Defaults to the engine's `defaultGuard`. */\n guard?: string\n /** Resolves the current team (only when the engine was created with `teams: true`). */\n team?: (event: E) => MaybePromise<TeamId | undefined>\n /** Include the required roles/permissions in the 403 body (`required`). Default: `false`. */\n exposeRequirements?: boolean\n}\n\nexport interface PermissionRequirementOptions {\n /** Pass when the subject has ANY of the permissions (instead of all). Default: `false`. */\n any?: boolean\n}\n\nexport interface RoleRequirementOptions {\n /** Require ALL of the roles (instead of any). Default: `false`. */\n all?: boolean\n}\n\n/** The JSON body of a failed check — identical to `@anievo-id/rbac-evolution-express`. */\nexport type RbacErrorBody =\n | { error: 'UNAUTHENTICATED'; message: string }\n | { error: 'FORBIDDEN'; reason: RequirementKind; message: string; required?: string[][] }\n\n/**\n * Thrown by the `require*` helpers. h3 turns it into an error response with this `statusCode`\n * and the Express-style body under `data`.\n *\n * It is shaped like h3's `H3Error` (including the `__h3_error__` marker h3 checks), so h3 / Nitro\n * treat it as an expected HTTP error instead of logging it as an unhandled exception —\n * without this package depending on h3.\n */\nexport class RbacHttpError extends Error {\n static readonly __h3_error__ = true\n readonly statusCode: 401 | 403\n readonly statusMessage: string\n readonly data: RbacErrorBody\n readonly fatal = false\n readonly unhandled = false\n\n constructor(data: RbacErrorBody) {\n super(data.message)\n this.name = 'RbacHttpError'\n this.statusCode = data.error === 'UNAUTHENTICATED' ? 401 : 403\n this.statusMessage = data.error === 'UNAUTHENTICATED' ? 'Unauthorized' : 'Forbidden'\n this.data = data\n }\n\n /** Alias of `statusCode`. */\n get status(): 401 | 403 {\n return this.statusCode\n }\n\n toJSON() {\n return { message: this.message, statusCode: this.statusCode, statusMessage: this.statusMessage, data: this.data }\n }\n}\n\nexport interface RbacServer<E extends RbacEvent = RbacEvent> {\n /**\n * Resolves the subject once per request and stores it on `event.context.rbac`\n * (a `SubjectRbac`, or `null` for guests). The Nuxt plugin reads it to hydrate the client.\n */\n resolve(event: E): Promise<SubjectRbac | null>\n /** The current subject's `{ roles, permissions }`, or `null` for guests. */\n snapshot(event: E): Promise<RbacSnapshot | null>\n /** Like Express `requirePermission`: arguments are all required, pipes mean any, `{ any: true }`. */\n requirePermission(event: E, ...args: (RequirementNames | PermissionRequirementOptions)[]): Promise<SubjectRbac>\n /** Like Express `requireRole`: any of the roles, `{ all: true }` for all. */\n requireRole(event: E, ...args: (RequirementNames | RoleRequirementOptions)[]): Promise<SubjectRbac>\n /** Like Express `requireRoleOrPermission`: any of the names as a role OR a permission. */\n requireRoleOrPermission(event: E, ...names: RequirementNames[]): Promise<SubjectRbac>\n /** spatie v8.5 `canAny()`: requires ANY of the listed permissions. */\n canAny(event: E, ...names: RequirementNames[]): Promise<SubjectRbac>\n /** spatie v8.5 `canAll()`: requires EVERY listed entry; a `'a|b'` entry still means \"a or b\". */\n canAll(event: E, ...names: RequirementNames[]): Promise<SubjectRbac>\n}\n\nconst CONTEXT_KEY = 'rbac'\n\nfunction parseArgs<O extends object>(args: readonly (RequirementNames | O)[]): { names: RequirementNames[]; options: O | undefined } {\n const last = args[args.length - 1]\n if (last !== undefined && typeof last === 'object' && !Array.isArray(last)) {\n return { names: args.slice(0, -1) as RequirementNames[], options: last as O }\n }\n return { names: args as RequirementNames[], options: undefined }\n}\n\nasync function passes(rbac: SubjectRbac, kind: RequirementKind, group: string[]): Promise<boolean> {\n if (kind === 'permission') return rbac.canAny(group)\n if (kind === 'role') return rbac.hasAnyRole(group)\n return (await rbac.hasAnyRole(group)) || rbac.canAny(group)\n}\n\n/**\n * Creates request helpers for Nitro event handlers.\n *\n * ```ts\n * // server/utils/rbac.ts\n * export const rbacServer = createRbacServer({\n * rbac,\n * getSubject: async (event) => {\n * const user = await getUserFromSession(event)\n * return user ? { type: 'user', id: user.id } : null\n * },\n * })\n *\n * // server/api/articles.post.ts\n * export default defineEventHandler(async (event) => {\n * await rbacServer.requirePermission(event, 'articles.create')\n * })\n * ```\n */\nexport function createRbacServer<E extends RbacEvent = RbacEvent>(options: RbacServerOptions<E>): RbacServer<E> {\n const { rbac, getSubject, guard, team, exposeRequirements = false } = options\n\n async function resolve(event: E): Promise<SubjectRbac | null> {\n const context = event.context as Record<string, unknown>\n const cached = context[CONTEXT_KEY]\n if (cached !== undefined) return cached as SubjectRbac | null\n\n const subject = await getSubject(event)\n let result: SubjectRbac | null = null\n if (subject) {\n const teamId = team ? await team(event) : undefined\n result = rbac.for(subject, {\n ...(guard !== undefined && { guard }),\n ...(teamId !== undefined && { team: teamId }),\n })\n }\n context[CONTEXT_KEY] = result\n return result\n }\n\n async function enforce(event: E, kind: RequirementKind, requirements: string[][]): Promise<SubjectRbac> {\n if (requirements.length === 0) {\n throw new TypeError(`[rbac-evolution] A ${kind} requirement needs at least one name.`)\n }\n const subject = await resolve(event)\n if (subject === null) throw new RbacHttpError({ error: 'UNAUTHENTICATED', message: UNAUTHENTICATED_MESSAGE })\n for (const group of requirements) {\n if (!(await passes(subject, kind, group))) {\n throw new RbacHttpError({\n error: 'FORBIDDEN',\n reason: kind,\n message: MESSAGES[kind],\n ...(exposeRequirements && { required: requirements }),\n })\n }\n }\n return subject\n }\n\n return {\n resolve,\n async snapshot(event) {\n const subject = await resolve(event)\n return subject ? subject.snapshot() : null\n },\n requirePermission(event, ...args) {\n const { names, options: opts } = parseArgs<PermissionRequirementOptions>(args)\n return enforce(event, 'permission', requirementGroups('permission', names, { any: opts?.any }))\n },\n requireRole(event, ...args) {\n const { names, options: opts } = parseArgs<RoleRequirementOptions>(args)\n return enforce(event, 'role', requirementGroups('role', names, { all: opts?.all }))\n },\n requireRoleOrPermission(event, ...names) {\n return enforce(event, 'role_or_permission', requirementGroups('role_or_permission', names))\n },\n canAny(event, ...names) {\n return enforce(event, 'permission', requirementGroups('permission', names, { any: true }))\n },\n canAll(event, ...names) {\n return enforce(event, 'permission', requirementGroups('permission', names))\n },\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/server.ts"],"names":[],"mappings":";;;AAsDO,IAAM,aAAA,GAAN,cAA4B,KAAA,CAAM;AAAA,EACvC,OAAgB,YAAA,GAAe,IAAA;AAAA,EACtB,UAAA;AAAA,EACA,aAAA;AAAA,EACA,IAAA;AAAA,EACA,KAAA,GAAQ,KAAA;AAAA,EACR,SAAA,GAAY,KAAA;AAAA,EAErB,YAAY,IAAA,EAAqB;AAC/B,IAAA,KAAA,CAAM,KAAK,OAAO,CAAA;AAClB,IAAA,IAAA,CAAK,IAAA,GAAO,eAAA;AACZ,IA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AAA,OAAO,OAAA,CAAQ,KAAA,EAAO,MAAA,EAAQ,iBAAA,CAAkB,MAAA,EAAQ,KAAA,EAAO,EAAE,GAAA,EAAK,IAAA,EAAM,GAAA,EAAK,CAAC,CAAA;AAAA,IACpF,CAAA;AAAA,IACA,uBAAA,CAAwB,UAAU,KAAA,EAAO;AACvC,MAAA,OAAO,QAAQ,KAAA,EAAO,oBAAA,EAAsB,iBAAA,CAAkB,oBAAA,EAAsB,KAAK,CAAC,CAAA;AAAA,IAC5F,CAAA;AAAA,IACA,MAAA,CAAO,UAAU,KAAA,EAAO;AACtB,MAAA,OAAO,OAAA,CAAQ,KAAA,EAAO,YAAA,EAAc,iBAAA,CAAkB,YAAA,EAAc,OAAO,EAAE,GAAA,EAAK,IAAA,EAAM,CAAC,CAAA;AAAA,IAC3F,CAAA;AAAA,IACA,MAAA,CAAO,UAAU,KAAA,EAAO;AACtB,MAAA,OAAO,QAAQ,KAAA,EAAO,YAAA,EAAc,iBAAA,CAAkB,YAAA,EAAc,KAAK,CAAC,CAAA;AAAA,IAC5E;AAAA,GACF;AACF","file":"server.js","sourcesContent":["/**\n * @anievo-id/rbac-evolution-nuxt/server\n *\n * Server-side enforcement for Nitro / h3 event handlers. Runs on the server only.\n */\n\nimport type { Rbac, RbacSnapshot, Subject, SubjectRbac, TeamId } from '@anievo-id/rbac-evolution'\nimport { MESSAGES, requirementGroups, type RequirementKind, type RequirementNames, UNAUTHENTICATED_MESSAGE } from './requirements'\n\nexport type { RequirementKind, RequirementNames } from './requirements'\n\ntype MaybePromise<T> = T | Promise<T>\n\n/** The part of an h3 `H3Event` this helper uses. */\nexport interface RbacEvent {\n context: object\n}\n\nexport interface RbacServerOptions<E extends RbacEvent = RbacEvent> {\n /** The RBAC engine created with `createRbac(...)`. */\n rbac: Rbac\n /** Resolves the authenticated subject for this request (e.g. from a session). `null` / `undefined` for guests. */\n getSubject: (event: E) => MaybePromise<Subject | null | undefined>\n /** Guard name (e.g. `web` or `api`). Defaults to the engine's `defaultGuard`. */\n guard?: string\n /** Resolves the current team (only when the engine was created with `teams: true`). */\n team?: (event: E) => MaybePromise<TeamId | undefined>\n /** Include the required roles/permissions in the 403 body (`required`). Default: `false`. */\n exposeRequirements?: boolean\n}\n\nexport interface PermissionRequirementOptions {\n /** Pass when the subject has ANY of the permissions (instead of all). Default: `false`. */\n any?: boolean\n}\n\nexport interface RoleRequirementOptions {\n /** Require ALL of the roles (instead of any). Default: `false`. */\n all?: boolean\n}\n\n/** The JSON body of a failed check — identical to `@anievo-id/rbac-evolution-express`. */\nexport type RbacErrorBody =\n | { error: 'UNAUTHENTICATED'; message: string }\n | { error: 'FORBIDDEN'; reason: RequirementKind; message: string; required?: string[][] }\n\n/**\n * Thrown by the `require*` helpers. h3 turns it into an error response with this `statusCode`\n * and the Express-style body under `data`.\n *\n * It is shaped like h3's `H3Error` (including the `__h3_error__` marker h3 checks), so h3 / Nitro\n * treat it as an expected HTTP error instead of logging it as an unhandled exception —\n * without this package depending on h3.\n */\nexport class RbacHttpError extends Error {\n static readonly __h3_error__ = true\n readonly statusCode: 401 | 403\n readonly statusMessage: string\n readonly data: RbacErrorBody\n readonly fatal = false\n readonly unhandled = false\n\n constructor(data: RbacErrorBody) {\n super(data.message)\n this.name = 'RbacHttpError'\n this.statusCode = data.error === 'UNAUTHENTICATED' ? 401 : 403\n this.statusMessage = data.error === 'UNAUTHENTICATED' ? 'Unauthorized' : 'Forbidden'\n this.data = data\n }\n\n /** Alias of `statusCode`. */\n get status(): 401 | 403 {\n return this.statusCode\n }\n\n toJSON() {\n return { message: this.message, statusCode: this.statusCode, statusMessage: this.statusMessage, data: this.data }\n }\n}\n\nexport interface RbacServer<E extends RbacEvent = RbacEvent> {\n /**\n * Resolves the subject once per request (cached per helper instance) and stores it on\n * `event.context.rbac` (a `SubjectRbac`, or `null` for guests) unless another instance did\n * first. The Nuxt plugin reads it to hydrate the client.\n */\n resolve(event: E): Promise<SubjectRbac | null>\n /** The current subject's `{ roles, permissions }`, or `null` for guests. */\n snapshot(event: E): Promise<RbacSnapshot | null>\n /** Like Express `requirePermission`: arguments are all required, pipes mean any, `{ any: true }`. */\n requirePermission(event: E, ...args: (RequirementNames | PermissionRequirementOptions)[]): Promise<SubjectRbac>\n /** Like Express `requireRole`: any of the roles, `{ all: true }` for all. */\n requireRole(event: E, ...args: (RequirementNames | RoleRequirementOptions)[]): Promise<SubjectRbac>\n /** Like Express `requireRoleOrPermission`: any of the names as a role OR a permission. */\n requireRoleOrPermission(event: E, ...names: RequirementNames[]): Promise<SubjectRbac>\n /** spatie v8.5 `canAny()`: requires ANY of the listed permissions. */\n canAny(event: E, ...names: RequirementNames[]): Promise<SubjectRbac>\n /** spatie v8.5 `canAll()`: requires EVERY listed entry; a `'a|b'` entry still means \"a or b\". */\n canAll(event: E, ...names: RequirementNames[]): Promise<SubjectRbac>\n}\n\nconst CONTEXT_KEY = 'rbac'\n\nfunction parseArgs<O extends object>(args: readonly (RequirementNames | O)[]): { names: RequirementNames[]; options: O | undefined } {\n const last = args[args.length - 1]\n if (last !== undefined && typeof last === 'object' && !Array.isArray(last)) {\n return { names: args.slice(0, -1) as RequirementNames[], options: last as O }\n }\n return { names: args as RequirementNames[], options: undefined }\n}\n\nasync function passes(rbac: SubjectRbac, kind: RequirementKind, group: string[]): Promise<boolean> {\n if (kind === 'permission') return rbac.canAny(group)\n if (kind === 'role') return rbac.hasAnyRole(group)\n return (await rbac.hasAnyRole(group)) || rbac.canAny(group)\n}\n\n/**\n * Creates request helpers for Nitro event handlers.\n *\n * ```ts\n * // server/utils/rbac.ts\n * export const rbacServer = createRbacServer({\n * rbac,\n * getSubject: async (event) => {\n * const user = await getUserFromSession(event)\n * return user ? { type: 'user', id: user.id } : null\n * },\n * })\n *\n * // server/api/articles.post.ts\n * export default defineEventHandler(async (event) => {\n * await rbacServer.requirePermission(event, 'articles.create')\n * })\n * ```\n */\nexport function createRbacServer<E extends RbacEvent = RbacEvent>(options: RbacServerOptions<E>): RbacServer<E> {\n const { rbac, getSubject, guard, team, exposeRequirements = false } = options\n // Per instance, so a second server (e.g. guard 'api') never reuses another guard's subject.\n const resolved = new WeakMap<object, SubjectRbac | null>()\n\n async function resolve(event: E): Promise<SubjectRbac | null> {\n const context = event.context as Record<string, unknown>\n if (resolved.has(context)) return resolved.get(context)!\n\n const subject = await getSubject(event)\n let result: SubjectRbac | null = null\n if (subject) {\n const teamId = team ? await team(event) : undefined\n result = rbac.for(subject, {\n ...(guard !== undefined && { guard }),\n ...(teamId !== undefined && { team: teamId }),\n })\n }\n resolved.set(context, result)\n // The client plugin hydrates from `event.context.rbac`: the first instance to resolve fills it.\n if (context[CONTEXT_KEY] === undefined) context[CONTEXT_KEY] = result\n return result\n }\n\n async function enforce(event: E, kind: RequirementKind, requirements: string[][]): Promise<SubjectRbac> {\n if (requirements.length === 0) {\n throw new TypeError(`[rbac-evolution] A ${kind} requirement needs at least one name.`)\n }\n const subject = await resolve(event)\n if (subject === null) throw new RbacHttpError({ error: 'UNAUTHENTICATED', message: UNAUTHENTICATED_MESSAGE })\n for (const group of requirements) {\n if (!(await passes(subject, kind, group))) {\n throw new RbacHttpError({\n error: 'FORBIDDEN',\n reason: kind,\n message: MESSAGES[kind],\n ...(exposeRequirements && { required: requirements }),\n })\n }\n }\n return subject\n }\n\n return {\n resolve,\n async snapshot(event) {\n const subject = await resolve(event)\n return subject ? subject.snapshot() : null\n },\n requirePermission(event, ...args) {\n const { names, options: opts } = parseArgs<PermissionRequirementOptions>(args)\n return enforce(event, 'permission', requirementGroups('permission', names, { any: opts?.any }))\n },\n requireRole(event, ...args) {\n const { names, options: opts } = parseArgs<RoleRequirementOptions>(args)\n return enforce(event, 'role', requirementGroups('role', names, { all: opts?.all }))\n },\n requireRoleOrPermission(event, ...names) {\n return enforce(event, 'role_or_permission', requirementGroups('role_or_permission', names))\n },\n canAny(event, ...names) {\n return enforce(event, 'permission', requirementGroups('permission', names, { any: true }))\n },\n canAll(event, ...names) {\n return enforce(event, 'permission', requirementGroups('permission', names))\n },\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anievo-id/rbac-evolution-nuxt",
3
- "version": "0.4.0",
3
+ "version": "0.5.0",
4
4
  "description": "Nuxt 3/4 module for rbac-evolution: SSR-hydrated permissions, auto-imported composables, route middleware & Nitro helpers.",
5
5
  "license": "MIT",
6
6
  "author": "AniEvo-ID (https://github.com/AniEvo-ID)",
@@ -50,8 +50,8 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@nuxt/kit": "^3.13.0 || ^4.0.0",
53
- "@anievo-id/rbac-evolution": "^0.4.0",
54
- "@anievo-id/rbac-evolution-vue": "^0.4.0"
53
+ "@anievo-id/rbac-evolution": "^0.5.0",
54
+ "@anievo-id/rbac-evolution-vue": "^0.5.0"
55
55
  },
56
56
  "peerDependencies": {
57
57
  "nuxt": "^3.0.0 || ^4.0.0",