@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 +5 -4
- package/dist/database.d.ts +4 -2
- package/package.json +1 -1
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(
|
|
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, '
|
|
143
|
-
|
|
144
|
-
|
|
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
|
/**
|
package/dist/database.d.ts
CHANGED
|
@@ -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
|
|
535
|
-
|
|
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>;
|