@fabrika/app 0.9.0-dev.11 → 0.9.0-dev.13
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/package.json +10 -10
- package/skill/SKILL.md +7 -5
- package/skill/references/app-setup.md +8 -8
- package/skill/references/endpoint.md +12 -4
- package/skill/references/files.md +11 -1
- package/skill/references/relations.md +558 -0
- package/skill/references/table-and-migration.md +30 -0
- package/src/contract/artifact-schema.ts +94 -5
- package/src/contract/build.ts +127 -34
- package/src/contract/compile.ts +1 -0
- package/src/contract/declaration.ts +8 -2
- package/src/contract/define.ts +18 -1
- package/src/contract/group.ts +12 -10
- package/src/contract/index.ts +2 -0
- package/src/contract/kit.ts +1 -0
- package/src/contract/platform.ts +1 -0
- package/src/contract/vocabulary.ts +3 -0
- package/src/dev/launcher.ts +14 -15
- package/src/dev/output.ts +8 -11
- package/src/files/kinds.ts +1 -1
- package/src/files/sniff.ts +18 -1
- package/src/files/treatment.ts +12 -10
- package/src/implement/boot.ts +33 -2
- package/src/implement/capability.ts +19 -4
- package/src/implement/client-address.ts +5 -71
- package/src/implement/dispatch.ts +117 -14
- package/src/implement/egress.ts +30 -12
- package/src/implement/implement.ts +7 -0
- package/src/implement/public.ts +3 -3
- package/src/jobs/report.ts +32 -5
- package/src/jobs/scrub.ts +1 -1
- package/src/testing/caller.ts +9 -2
- package/src/testing/endpoint-access.ts +2 -1
- package/src/testing/sample-file.ts +4 -1
- package/types/src/contract/declaration.d.ts +9 -1
- package/types/src/contract/define.d.ts +20 -1
- package/types/src/contract/group.d.ts +5 -3
- package/types/src/contract/index.d.ts +1 -0
- package/types/src/contract/vocabulary.d.ts +4 -1
- package/types/src/dev/output.d.ts +7 -6
- package/types/src/files/treatment.d.ts +4 -3
- package/types/src/implement/capability.d.ts +4 -4
- package/types/src/implement/client-address.d.ts +0 -5
- package/types/src/implement/dispatch.d.ts +11 -0
- package/types/src/implement/implement.d.ts +7 -0
- package/types/src/testing/caller.d.ts +1 -1
|
@@ -12,7 +12,8 @@ export declare class FileDownload {
|
|
|
12
12
|
readonly name: string | null;
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
export declare function
|
|
15
|
+
/** `inline` is the row's `inlineFileTypes`. */
|
|
16
|
+
export declare function contentDisposition(contentType: string, name: string | null, inline?: readonly string[]): string;
|
|
17
|
+
export declare function fileResponse(file: FileDownload, inline: readonly string[]): Response;
|
|
17
18
|
/** An error of a download endpoint, with the file treatment in place of the header policy. */
|
|
18
|
-
export declare function withFileTreatment(response: Response): Response;
|
|
19
|
+
export declare function withFileTreatment(response: Response, inline: readonly string[]): Response;
|
|
@@ -63,7 +63,7 @@ export declare class Ref<D extends string, A extends string> implements RefCapab
|
|
|
63
63
|
readonly dimension: D;
|
|
64
64
|
readonly action: A;
|
|
65
65
|
};
|
|
66
|
-
constructor(token: typeof MINT, issuer: object, frame: RequestFrame, dimension: D, action: A, principal: string, id: string, chain: ReadonlyMap<string, string
|
|
66
|
+
constructor(token: typeof MINT, issuer: object, frame: RequestFrame, dimension: D, action: A, principal: string, id: string, chain: ReadonlyMap<string, string>, relations: readonly string[]);
|
|
67
67
|
get dimension(): D;
|
|
68
68
|
get action(): A;
|
|
69
69
|
/** The object's id: the value of its dimension. */
|
|
@@ -82,7 +82,7 @@ export declare class Within<D extends string, A extends string> implements Withi
|
|
|
82
82
|
readonly dimension: D;
|
|
83
83
|
readonly action: A;
|
|
84
84
|
};
|
|
85
|
-
constructor(token: typeof MINT, issuer: object, frame: RequestFrame, dimension: D, action: A, principal: string, values: readonly string[] | 'all', containers: readonly ContainerGrant[], contained: readonly ContainerGrant[]);
|
|
85
|
+
constructor(token: typeof MINT, issuer: object, frame: RequestFrame, dimension: D, action: A, principal: string, values: readonly string[] | 'all', containers: readonly ContainerGrant[], contained: readonly ContainerGrant[], relations: readonly string[], revealing: readonly ContainerGrant[]);
|
|
86
86
|
get dimension(): D;
|
|
87
87
|
get action(): A;
|
|
88
88
|
/** The values of this dimension itself. */
|
|
@@ -124,8 +124,8 @@ export declare class RowRef<T extends string, A extends string> implements RowRe
|
|
|
124
124
|
}
|
|
125
125
|
/** Makes the capabilities one authority accepts; a runtime's is held by the `boot` call that made it alone. */
|
|
126
126
|
export interface CapabilityMint {
|
|
127
|
-
ref<D extends string, A extends string>(frame: RequestFrame, dimension: D, action: A, principal: string, id: string, chain: ReadonlyMap<string, string
|
|
128
|
-
within<D extends string, A extends string>(frame: RequestFrame, dimension: D, action: A, principal: string, values: readonly string[] | 'all', containers?: readonly ContainerGrant[], contained?: readonly ContainerGrant[]): Within<D, A>;
|
|
127
|
+
ref<D extends string, A extends string>(frame: RequestFrame, dimension: D, action: A, principal: string, id: string, chain: ReadonlyMap<string, string>, relations?: readonly string[]): Ref<D, A>;
|
|
128
|
+
within<D extends string, A extends string>(frame: RequestFrame, dimension: D, action: A, principal: string, values: readonly string[] | 'all', containers?: readonly ContainerGrant[], contained?: readonly ContainerGrant[], relations?: readonly string[], revealing?: readonly ContainerGrant[]): Within<D, A>;
|
|
129
129
|
app<A extends string>(frame: RequestFrame, action: A, principal: string): AppCapability<A>;
|
|
130
130
|
}
|
|
131
131
|
/** A mint and the one authority that accepts what it mints. */
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The client a per-client limit counts: an IPv4 address, or an IPv6 address's /64 (one subscriber's prefix, of which
|
|
3
|
-
* it may hold every address). Anything else, the header's absence included, is one shared `unknown` client.
|
|
4
|
-
*/
|
|
5
|
-
export declare function clientKey(header: string | null): string;
|
|
6
1
|
/**
|
|
7
2
|
* The bucket of the client the proxy saw. Only `X-Fabrika-Client-Ip` is read: the proxy deletes it and sets it from
|
|
8
3
|
* the connection on every request, and the proxy secret proves the request came through it. A forwarding header a
|
|
@@ -188,6 +188,11 @@ export interface ProcedureQuery {
|
|
|
188
188
|
readonly schema: Schema;
|
|
189
189
|
readonly shape: SchemaShape;
|
|
190
190
|
}
|
|
191
|
+
/** A relation's reveal: a row it reaches reveals its node in `dimension` for `actions`. */
|
|
192
|
+
export interface RevealedNode {
|
|
193
|
+
readonly dimension: string;
|
|
194
|
+
readonly actions: readonly string[];
|
|
195
|
+
}
|
|
191
196
|
export interface RuntimeParts {
|
|
192
197
|
readonly table: CompiledEndpointTable;
|
|
193
198
|
readonly endpoints: ReadonlyMap<string, ServedEndpoint>;
|
|
@@ -204,6 +209,12 @@ export interface RuntimeParts {
|
|
|
204
209
|
readonly ownedDimensions: ReadonlySet<string>;
|
|
205
210
|
/** Each dimension's containers, nearest first; a grant on one reaches every value inside it. */
|
|
206
211
|
readonly containers: ReadonlyMap<string, readonly string[]>;
|
|
212
|
+
/** Each relation of the contract with its dimension: a `~rel` entry holds its action at that dimension's nodes. */
|
|
213
|
+
readonly relations: ReadonlyMap<string, string>;
|
|
214
|
+
/** Each relation's reveals: a `~rel` entry of one of their actions also holds it at the ancestor nodes they reveal. */
|
|
215
|
+
readonly reveals: ReadonlyMap<string, readonly RevealedNode[]>;
|
|
216
|
+
/** Each dimension's member reveals: a grant of one of their actions at its node also reads under the ancestor they reveal. */
|
|
217
|
+
readonly memberReveals: ReadonlyMap<string, readonly RevealedNode[]>;
|
|
207
218
|
readonly assets: SpaAssets | null;
|
|
208
219
|
/** IAM's membership operations; `boot` refuses a contract that needs them when the adapter supplies none. */
|
|
209
220
|
readonly membership: IamMembership | null;
|
|
@@ -18,6 +18,13 @@ export interface ContractDatabase {
|
|
|
18
18
|
* `using` is a job's transaction, which also sees the object it wrote; a layer of the application's own ignores it.
|
|
19
19
|
*/
|
|
20
20
|
locate(dimension: string, id: string, using?: Session): Promise<ReadonlyMap<string, string> | null>;
|
|
21
|
+
/**
|
|
22
|
+
* Whether a row of `relation`'s source names `principal` at `node` and confers it now. A layer of the application's
|
|
23
|
+
* own has none, so no Ref is ever held through a relation there.
|
|
24
|
+
*/
|
|
25
|
+
relates?(relation: string, node: string, principal: string): Promise<boolean>;
|
|
26
|
+
/** Whether a row `relation` reaches for `principal` reveals `node` of `dimension` now; none in a layer of the application's own. */
|
|
27
|
+
reveals?(relation: string, dimension: string, node: string, principal: string): Promise<boolean>;
|
|
21
28
|
}
|
|
22
29
|
/** `scoped(tables)` of `@fabrika/db`, which `boot` binds, or a `ContractDatabase` of the application's own. */
|
|
23
30
|
export type ImplementationDatabase = DataLayer | ContractDatabase;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type PermissionEntry, type PrincipalAffiliation } from '@fabrika/auth-core';
|
|
2
2
|
import type { ActionOf, AnyContract, DimensionOf, RoleOf } from '../contract/define';
|
|
3
3
|
/** `app` is the connector of another application: its key reaches only the exports that application consumes. */
|
|
4
4
|
export type TestCallerKind = 'human' | 'machine' | 'link' | 'app';
|