@axium/server 0.35.0 → 0.35.2

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/auth.js CHANGED
@@ -132,16 +132,17 @@ export async function authSessionForItem(itemType, itemId, permissions, session)
132
132
  fromACL: false,
133
133
  };
134
134
  if (!session || !user)
135
- error(403, 'Access denied');
135
+ error(401, 'Item is not public');
136
136
  if (user.isSuspended)
137
137
  error(403, 'User is suspended');
138
138
  if (userId == item.userId)
139
139
  return result;
140
140
  result.fromACL = true;
141
141
  if (!item.acl || !item.acl.length)
142
- error(403, 'Access denied');
143
- if (acl.check(item.acl, permissions).size)
144
- error(403, 'Access denied');
142
+ error(403, 'Item is not shared with you');
143
+ const missing = Array.from(acl.check(item.acl, permissions));
144
+ if (missing.length)
145
+ error(403, 'Missing permissions: ' + missing.join(', '));
145
146
  return result;
146
147
  }
147
148
  /**
@@ -531,8 +531,10 @@ type _DBFromSchema<TBs extends Record<string, z.input<typeof Table>>> = {
531
531
  /**
532
532
  * Convert an entire schema definition file info the Kysely database schema type
533
533
  */
534
- export type DatabaseFromSchemaFile<S extends ReadonlyRecursive<z.input<typeof SchemaFile>>> = _DBFromSchema<FullSchema<MutableRecursive<S>>['tables']>;
535
- type RawDB = DatabaseFromSchemaFile<typeof rawSchema>;
534
+ export type FromSchemaFile<S extends ReadonlyRecursive<z.input<typeof SchemaFile>>> = _DBFromSchema<FullSchema<MutableRecursive<S>>['tables']>;
535
+ /**@deprecated use {@link FromSchemaFile} */
536
+ export type DatabaseFromSchemaFile<S extends ReadonlyRecursive<z.input<typeof SchemaFile>>> = FromSchemaFile<S>;
537
+ type RawDB = FromSchemaFile<typeof rawSchema>;
536
538
  export interface Schema extends Omit<RawDB, 'users' | 'verifications' | 'passkeys'> {
537
539
  users: Expand<RawDB['users'] & {
538
540
  preferences: kysely.Generated<Preferences>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@axium/server",
3
- "version": "0.35.0",
3
+ "version": "0.35.2",
4
4
  "author": "James Prevett <axium@jamespre.dev>",
5
5
  "funding": {
6
6
  "type": "individual",