@rebasepro/types 0.10.1-canary.14e53ae → 0.10.1-canary.262a5be
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.
|
@@ -24,38 +24,6 @@ export interface StorageAuthorizeContext {
|
|
|
24
24
|
user: StorageAuthorizeUser | null;
|
|
25
25
|
/** Named backend the request targeted, when one was given. */
|
|
26
26
|
storageId?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Trusted, RLS-bypassing data access, so the hook can answer the question it
|
|
29
|
-
* actually has to answer: *who owns this object?*
|
|
30
|
-
*
|
|
31
|
-
* Without it the hook can only do prefix arithmetic on the key, which
|
|
32
|
-
* expresses no real multi-tenant rule — ownership lives in a row, not in a
|
|
33
|
-
* string. And it cannot simply import the server to get one: a project
|
|
34
|
-
* declares this hook from its **config** package, which depends on
|
|
35
|
-
* `@rebasepro/types` alone and cannot resolve `@rebasepro/server` at
|
|
36
|
-
* runtime. So the accessor is handed in.
|
|
37
|
-
*
|
|
38
|
-
* It bypasses row-level security on purpose. The hook IS the authorization
|
|
39
|
-
* decision; asking it to make that decision through a reader that has
|
|
40
|
-
* already been narrowed by the caller's own permissions is circular.
|
|
41
|
-
*/
|
|
42
|
-
data?: StorageAuthorizeData;
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* The slice of the data API a storage hook needs: read a collection, in the
|
|
46
|
-
* trusted server context.
|
|
47
|
-
*
|
|
48
|
-
* Deliberately read-only and deliberately tiny. A hook that can write is a hook
|
|
49
|
-
* that can be tricked into writing, and an authorization check has no business
|
|
50
|
-
* mutating anything.
|
|
51
|
-
*/
|
|
52
|
-
export interface StorageAuthorizeData {
|
|
53
|
-
collection(slug: string): {
|
|
54
|
-
find(query?: Record<string, unknown>): Promise<{
|
|
55
|
-
data: Record<string, unknown>[];
|
|
56
|
-
}>;
|
|
57
|
-
findById(id: string): Promise<Record<string, unknown> | null>;
|
|
58
|
-
};
|
|
59
27
|
}
|
|
60
28
|
/**
|
|
61
29
|
* Per-object access control for storage, the analogue of an RLS policy on a
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rebasepro/types",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.10.1-canary.
|
|
4
|
+
"version": "0.10.1-canary.262a5be",
|
|
5
5
|
"description": "Rebase type definitions — shared interfaces and controller types",
|
|
6
6
|
"funding": {
|
|
7
7
|
"url": "https://github.com/sponsors/rebaseco"
|
|
@@ -27,37 +27,6 @@ export interface StorageAuthorizeContext {
|
|
|
27
27
|
user: StorageAuthorizeUser | null;
|
|
28
28
|
/** Named backend the request targeted, when one was given. */
|
|
29
29
|
storageId?: string;
|
|
30
|
-
/**
|
|
31
|
-
* Trusted, RLS-bypassing data access, so the hook can answer the question it
|
|
32
|
-
* actually has to answer: *who owns this object?*
|
|
33
|
-
*
|
|
34
|
-
* Without it the hook can only do prefix arithmetic on the key, which
|
|
35
|
-
* expresses no real multi-tenant rule — ownership lives in a row, not in a
|
|
36
|
-
* string. And it cannot simply import the server to get one: a project
|
|
37
|
-
* declares this hook from its **config** package, which depends on
|
|
38
|
-
* `@rebasepro/types` alone and cannot resolve `@rebasepro/server` at
|
|
39
|
-
* runtime. So the accessor is handed in.
|
|
40
|
-
*
|
|
41
|
-
* It bypasses row-level security on purpose. The hook IS the authorization
|
|
42
|
-
* decision; asking it to make that decision through a reader that has
|
|
43
|
-
* already been narrowed by the caller's own permissions is circular.
|
|
44
|
-
*/
|
|
45
|
-
data?: StorageAuthorizeData;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
* The slice of the data API a storage hook needs: read a collection, in the
|
|
50
|
-
* trusted server context.
|
|
51
|
-
*
|
|
52
|
-
* Deliberately read-only and deliberately tiny. A hook that can write is a hook
|
|
53
|
-
* that can be tricked into writing, and an authorization check has no business
|
|
54
|
-
* mutating anything.
|
|
55
|
-
*/
|
|
56
|
-
export interface StorageAuthorizeData {
|
|
57
|
-
collection(slug: string): {
|
|
58
|
-
find(query?: Record<string, unknown>): Promise<{ data: Record<string, unknown>[] }>;
|
|
59
|
-
findById(id: string): Promise<Record<string, unknown> | null>;
|
|
60
|
-
};
|
|
61
30
|
}
|
|
62
31
|
|
|
63
32
|
/**
|