@adminiumjs/manifest 0.3.27 → 0.3.29
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/app-grants.d.ts +134 -0
- package/dist/app-grants.d.ts.map +1 -0
- package/dist/app-grants.js +263 -0
- package/dist/app-grants.js.map +1 -0
- package/dist/automations.d.ts +2255 -58
- package/dist/automations.d.ts.map +1 -1
- package/dist/automations.js +450 -25
- package/dist/automations.js.map +1 -1
- package/dist/compose.d.ts.map +1 -1
- package/dist/compose.js +3 -0
- package/dist/compose.js.map +1 -1
- package/dist/documents.d.ts +1 -0
- package/dist/documents.d.ts.map +1 -1
- package/dist/documents.js +2 -0
- package/dist/documents.js.map +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/ledgers.d.ts.map +1 -1
- package/dist/ledgers.js +2 -0
- package/dist/ledgers.js.map +1 -1
- package/dist/modules.d.ts +93 -0
- package/dist/modules.d.ts.map +1 -0
- package/dist/modules.js +489 -0
- package/dist/modules.js.map +1 -0
- package/dist/occupies.d.ts +50 -0
- package/dist/occupies.d.ts.map +1 -0
- package/dist/occupies.js +123 -0
- package/dist/occupies.js.map +1 -0
- package/dist/outbox.d.ts +223 -17
- package/dist/outbox.d.ts.map +1 -1
- package/dist/outbox.js +125 -13
- package/dist/outbox.js.map +1 -1
- package/dist/page-board.d.ts +144 -0
- package/dist/page-board.d.ts.map +1 -0
- package/dist/page-board.js +280 -0
- package/dist/page-board.js.map +1 -0
- package/dist/plan-context.d.ts.map +1 -1
- package/dist/plan-context.js +3 -0
- package/dist/plan-context.js.map +1 -1
- package/dist/plan-model.d.ts +7 -0
- package/dist/plan-model.d.ts.map +1 -1
- package/dist/public-access.d.ts +6 -0
- package/dist/public-access.d.ts.map +1 -1
- package/dist/public-access.js +75 -1
- package/dist/public-access.js.map +1 -1
- package/dist/rail.d.ts +50 -0
- package/dist/rail.d.ts.map +1 -0
- package/dist/rail.js +122 -0
- package/dist/rail.js.map +1 -0
- package/dist/roles.d.ts +647 -1
- package/dist/roles.d.ts.map +1 -1
- package/dist/roles.js +459 -3
- package/dist/roles.js.map +1 -1
- package/dist/sample.d.ts +62 -0
- package/dist/sample.d.ts.map +1 -1
- package/dist/sample.js +203 -4
- package/dist/sample.js.map +1 -1
- package/dist/schema.d.ts +4349 -169
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +540 -41
- package/dist/schema.js.map +1 -1
- package/dist/shapes.d.ts +3 -2
- package/dist/shapes.d.ts.map +1 -1
- package/dist/shapes.js +76 -7
- package/dist/shapes.js.map +1 -1
- package/dist/state-actions.d.ts +4 -0
- package/dist/state-actions.d.ts.map +1 -1
- package/dist/state-actions.js +7 -0
- package/dist/state-actions.js.map +1 -1
- package/dist/states.d.ts +20 -1
- package/dist/states.d.ts.map +1 -1
- package/dist/states.js +47 -5
- package/dist/states.js.map +1 -1
- package/dist/validate.d.ts.map +1 -1
- package/dist/validate.js +110 -3
- package/dist/validate.js.map +1 -1
- package/dist/words.d.ts +1 -1
- package/dist/words.d.ts.map +1 -1
- package/dist/words.js +332 -1
- package/dist/words.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WHAT AN APP'S ROLE MAY BE GIVEN OF AN ADD-ON'S TABLE (`appGrants`).
|
|
3
|
+
*
|
|
4
|
+
* An app gives its roles a hold on an add-on's tables (`roles[].tables`): a
|
|
5
|
+
* hotel's housekeeping moves stock between places, a sales team reads what is
|
|
6
|
+
* in stock. The table is the add-on's, so the add-on says how far an app may
|
|
7
|
+
* go on it, on the table itself:
|
|
8
|
+
*
|
|
9
|
+
* ```json
|
|
10
|
+
* { "ref": "suppliers", "columns": [ … ],
|
|
11
|
+
* "appGrants": { "actions": ["read"], "readable": ["id", "name", "lead_days", "active"] } }
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* - `actions`: the most an app's role is given here (read, create, update);
|
|
15
|
+
* - `readable`: the only columns an app's read shows; absent, every column
|
|
16
|
+
* but those `never` names;
|
|
17
|
+
* - `writable` / `creatable`: the only columns an app's update may change
|
|
18
|
+
* and a new row may be given — named whenever the action is allowed: a
|
|
19
|
+
* write is never "every column";
|
|
20
|
+
* - `never`: columns no app's grant reaches, whatever else is listed.
|
|
21
|
+
*
|
|
22
|
+
* An add-on that says this of one table says it of all of them: a table
|
|
23
|
+
* without `appGrants` is then given to no app's role. An add-on that says it
|
|
24
|
+
* of none is held only by its own shape, as before the word: no hold on a
|
|
25
|
+
* ledger's receipts, read only on a table a ledger's code writes.
|
|
26
|
+
*
|
|
27
|
+
* The grant an app asks for is cut to fit (`roleTableHold`): an action or a
|
|
28
|
+
* column outside the add-on's words is left out and said, by name; a grant on
|
|
29
|
+
* a table with `appGrants` is always written with its column lists, never
|
|
30
|
+
* whole. The key and the table's links to other rows are read with any read,
|
|
31
|
+
* as with every read limit: a link says which row, never what is in it.
|
|
32
|
+
*
|
|
33
|
+
* Pure: no I/O, and nothing imported from the manifest's own schema file, so
|
|
34
|
+
* that file may import this one.
|
|
35
|
+
*/
|
|
36
|
+
import { z } from 'zod';
|
|
37
|
+
import { type ReferenceIssue } from './refs.js';
|
|
38
|
+
import { ROLE_ADD_ON_ACTIONS, type RoleAddOnTable, type RoleLimit } from './roles.js';
|
|
39
|
+
export type RoleAddOnAction = (typeof ROLE_ADD_ON_ACTIONS)[number];
|
|
40
|
+
export declare const appGrantsSchema: z.ZodObject<{
|
|
41
|
+
actions: z.ZodArray<z.ZodEnum<{
|
|
42
|
+
read: "read";
|
|
43
|
+
update: "update";
|
|
44
|
+
create: "create";
|
|
45
|
+
}>>;
|
|
46
|
+
readable: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
47
|
+
writable: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
48
|
+
creatable: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
49
|
+
never: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
50
|
+
}, z.core.$strict>;
|
|
51
|
+
export type AppGrants = z.infer<typeof appGrantsSchema>;
|
|
52
|
+
/** One of the add-on's tables, as the ceiling reads it. */
|
|
53
|
+
export interface AppGrantTableShape {
|
|
54
|
+
ref: string;
|
|
55
|
+
columns: readonly {
|
|
56
|
+
ref: string;
|
|
57
|
+
type: string;
|
|
58
|
+
role?: string | undefined;
|
|
59
|
+
rules?: {
|
|
60
|
+
secret?: boolean | undefined;
|
|
61
|
+
} | undefined;
|
|
62
|
+
}[];
|
|
63
|
+
appGrants?: AppGrants | undefined;
|
|
64
|
+
}
|
|
65
|
+
/** One of the add-on's ledgers, as the ceiling reads it. */
|
|
66
|
+
export interface AppGrantLedgerShape {
|
|
67
|
+
receipts: string;
|
|
68
|
+
writes?: Readonly<Record<string, unknown>> | undefined;
|
|
69
|
+
}
|
|
70
|
+
/** Whether the add-on says, of any of its tables, what an app's role may be given. */
|
|
71
|
+
export declare const declaresAppGrants: (tables: readonly AppGrantTableShape[]) => boolean;
|
|
72
|
+
/** Everything wrong with an add-on's `appGrants`, against its own tables and ledgers. */
|
|
73
|
+
export declare function appGrantsIssues(tables: readonly AppGrantTableShape[], ledgers: readonly AppGrantLedgerShape[]): ReferenceIssue[];
|
|
74
|
+
/** Why an entry, or part of it, was left out. */
|
|
75
|
+
export type RoleTableSkip = 'unknown-table' | 'unknown-column' | 'ledger-table' | 'not-offered' | 'ceiling';
|
|
76
|
+
/** What an app asked of a table and does not get: whole actions, and columns of an action. */
|
|
77
|
+
export interface RoleTableNarrowed {
|
|
78
|
+
actions: string[];
|
|
79
|
+
readable?: string[];
|
|
80
|
+
writable?: string[];
|
|
81
|
+
creatable?: string[];
|
|
82
|
+
}
|
|
83
|
+
/** What one app's grant on an add-on's table comes to, against the add-on's words. */
|
|
84
|
+
/** What a settle gave one role of one add-on table: the role's key in the app, and what it holds now. */
|
|
85
|
+
export interface RoleTableResult {
|
|
86
|
+
/** The role's key in the app. */
|
|
87
|
+
role: string;
|
|
88
|
+
addOn: string;
|
|
89
|
+
table: string;
|
|
90
|
+
/** What the role holds of the table now by this grant (after any narrowing below). */
|
|
91
|
+
actions: string[];
|
|
92
|
+
/** The columns each action reaches; absent, every column (only where the add-on sets no `appGrants`). */
|
|
93
|
+
readable?: string[];
|
|
94
|
+
writable?: string[];
|
|
95
|
+
creatable?: string[];
|
|
96
|
+
/** What the app asked for and does not get, by name. */
|
|
97
|
+
narrowed?: RoleTableNarrowed;
|
|
98
|
+
/** Why the entry, or part of it, was left out. */
|
|
99
|
+
skipped?: RoleTableSkip;
|
|
100
|
+
}
|
|
101
|
+
export interface RoleTableHold {
|
|
102
|
+
/** What the role holds of the table by this grant. */
|
|
103
|
+
actions: RoleAddOnAction[];
|
|
104
|
+
/** The columns each kept action reaches; absent, every column (only on a table of an add-on that sets no `appGrants`). */
|
|
105
|
+
readable?: string[];
|
|
106
|
+
writable?: string[];
|
|
107
|
+
creatable?: string[];
|
|
108
|
+
/** The limit the grant is written with: the app's, cut to fit. Absent, the grant is whole. */
|
|
109
|
+
limit?: RoleLimit;
|
|
110
|
+
/** What the app asked for and does not get: actions, and each kept or cut action's columns. */
|
|
111
|
+
narrowed?: RoleTableNarrowed;
|
|
112
|
+
skipped?: RoleTableSkip;
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* What an app's grant on one of an add-on's tables comes to: the add-on's
|
|
116
|
+
* shape (receipts, ledger tables), the columns it has, and its `appGrants`.
|
|
117
|
+
* Narrower than asked, never wider; whatever is cut is named.
|
|
118
|
+
*/
|
|
119
|
+
export declare function roleTableHold(entry: RoleAddOnTable, addOn: {
|
|
120
|
+
tables: readonly AppGrantTableShape[];
|
|
121
|
+
ledgers: readonly AppGrantLedgerShape[];
|
|
122
|
+
}): RoleTableHold;
|
|
123
|
+
/** Every column, in a list of what a grant reaches: the grant is whole there. */
|
|
124
|
+
export declare const EVERY_COLUMN = "*";
|
|
125
|
+
/**
|
|
126
|
+
* What `after` holds of a table that `before` did not: actions, and columns
|
|
127
|
+
* any of its actions reaches (`*`: every column, where before it was some or
|
|
128
|
+
* none). Null when it holds nothing more.
|
|
129
|
+
*/
|
|
130
|
+
export declare function holdWider(before: Pick<RoleTableHold, 'actions' | 'readable' | 'writable' | 'creatable'> | null, after: Pick<RoleTableHold, 'actions' | 'readable' | 'writable' | 'creatable'>): {
|
|
131
|
+
actions: string[];
|
|
132
|
+
columns: string[];
|
|
133
|
+
} | null;
|
|
134
|
+
//# sourceMappingURL=app-grants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-grants.d.ts","sourceRoot":"","sources":["../src/app-grants.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAa,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAa,mBAAmB,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,YAAY,CAAC;AAEjG,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEnE,eAAO,MAAM,eAAe;;;;;;;;;;kBAajB,CAAC;AACZ,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,2DAA2D;AAC3D,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,EAAE,SAAS;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;QAAC,KAAK,CAAC,EAAE;YAAE,MAAM,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;SAAE,GAAG,SAAS,CAAA;KAAE,EAAE,CAAC;IACn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ACzB;AAED,MAAM,WAAW,aAAa;IAC5B,sDAAsD;IACtD,OAAO,EAAE,eAAe,EAAE,CAAC;IAC3B,0HAA0H;IAC1H,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,8FAA8F;IAC9F,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,iBAAiB,CAAC;IAC7B,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB;AASD;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE;IAAE,MAAM,EAAE,SAAS,kBAAkB,EAAE,CAAC;IAAC,OAAO,EAAE,SAAS,mBAAmB,EAAE,CAAA;CAAE,GAAG,aAAa,CA+G7J;AAED,iFAAiF;AACjF,eAAO,MAAM,YAAY,MAAM,CAAC;AAEhC;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,aAAa,EAAE,SAAS,GAAG,UAAU,GAAG,UAAU,GAAG,WAAW,CAAC,GAAG;IAAE,OAAO,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAiB/O"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
// SPDX-License-Identifier: AGPL-3.0-only
|
|
2
|
+
/**
|
|
3
|
+
* WHAT AN APP'S ROLE MAY BE GIVEN OF AN ADD-ON'S TABLE (`appGrants`).
|
|
4
|
+
*
|
|
5
|
+
* An app gives its roles a hold on an add-on's tables (`roles[].tables`): a
|
|
6
|
+
* hotel's housekeeping moves stock between places, a sales team reads what is
|
|
7
|
+
* in stock. The table is the add-on's, so the add-on says how far an app may
|
|
8
|
+
* go on it, on the table itself:
|
|
9
|
+
*
|
|
10
|
+
* ```json
|
|
11
|
+
* { "ref": "suppliers", "columns": [ … ],
|
|
12
|
+
* "appGrants": { "actions": ["read"], "readable": ["id", "name", "lead_days", "active"] } }
|
|
13
|
+
* ```
|
|
14
|
+
*
|
|
15
|
+
* - `actions`: the most an app's role is given here (read, create, update);
|
|
16
|
+
* - `readable`: the only columns an app's read shows; absent, every column
|
|
17
|
+
* but those `never` names;
|
|
18
|
+
* - `writable` / `creatable`: the only columns an app's update may change
|
|
19
|
+
* and a new row may be given — named whenever the action is allowed: a
|
|
20
|
+
* write is never "every column";
|
|
21
|
+
* - `never`: columns no app's grant reaches, whatever else is listed.
|
|
22
|
+
*
|
|
23
|
+
* An add-on that says this of one table says it of all of them: a table
|
|
24
|
+
* without `appGrants` is then given to no app's role. An add-on that says it
|
|
25
|
+
* of none is held only by its own shape, as before the word: no hold on a
|
|
26
|
+
* ledger's receipts, read only on a table a ledger's code writes.
|
|
27
|
+
*
|
|
28
|
+
* The grant an app asks for is cut to fit (`roleTableHold`): an action or a
|
|
29
|
+
* column outside the add-on's words is left out and said, by name; a grant on
|
|
30
|
+
* a table with `appGrants` is always written with its column lists, never
|
|
31
|
+
* whole. The key and the table's links to other rows are read with any read,
|
|
32
|
+
* as with every read limit: a link says which row, never what is in it.
|
|
33
|
+
*
|
|
34
|
+
* Pure: no I/O, and nothing imported from the manifest's own schema file, so
|
|
35
|
+
* that file may import this one.
|
|
36
|
+
*/
|
|
37
|
+
import { z } from 'zod';
|
|
38
|
+
import { refSchema } from './refs.js';
|
|
39
|
+
import { reachList, ROLE_ADD_ON_ACTIONS } from './roles.js';
|
|
40
|
+
export const appGrantsSchema = z
|
|
41
|
+
.object({
|
|
42
|
+
/** The most an app's role may be given on this table. */
|
|
43
|
+
actions: z.array(z.enum(ROLE_ADD_ON_ACTIONS)).min(1).max(3),
|
|
44
|
+
/** The only columns an app's read shows (with the key and the links); absent, every column but `never`'s. */
|
|
45
|
+
readable: z.array(refSchema).min(1).max(200).optional(),
|
|
46
|
+
/** The only columns an app's update may change. Named whenever `update` is allowed. */
|
|
47
|
+
writable: z.array(refSchema).min(1).max(200).optional(),
|
|
48
|
+
/** The only columns a new row an app's role makes may be given. Named whenever `create` is allowed. */
|
|
49
|
+
creatable: z.array(refSchema).min(1).max(200).optional(),
|
|
50
|
+
/** Columns no app's grant reaches, whatever else is listed. */
|
|
51
|
+
never: z.array(refSchema).min(1).max(200).optional(),
|
|
52
|
+
})
|
|
53
|
+
.strict();
|
|
54
|
+
/** Whether the add-on says, of any of its tables, what an app's role may be given. */
|
|
55
|
+
export const declaresAppGrants = (tables) => tables.some((table) => table.appGrants !== undefined);
|
|
56
|
+
const LIST_OF = { read: 'readable', update: 'writable', create: 'creatable' };
|
|
57
|
+
/** Everything wrong with an add-on's `appGrants`, against its own tables and ledgers. */
|
|
58
|
+
export function appGrantsIssues(tables, ledgers) {
|
|
59
|
+
const out = [];
|
|
60
|
+
tables.forEach((table, t) => {
|
|
61
|
+
const grants = table.appGrants;
|
|
62
|
+
if (grants === undefined)
|
|
63
|
+
return;
|
|
64
|
+
const at = (...rest) => ['requiredSchema', 'tables', t, 'appGrants', ...rest];
|
|
65
|
+
if (new Set(grants.actions).size !== grants.actions.length)
|
|
66
|
+
out.push({ path: at('actions'), message: 'an action is listed once' });
|
|
67
|
+
if (ledgers.some((ledger) => ledger.receipts === table.ref)) {
|
|
68
|
+
out.push({ path: at(), message: `"${table.ref}" is a ledger's receipt table, which no app's role ever holds: take "appGrants" off it` });
|
|
69
|
+
return;
|
|
70
|
+
}
|
|
71
|
+
if (ledgers.some((ledger) => Object.prototype.hasOwnProperty.call(ledger.writes ?? {}, table.ref))) {
|
|
72
|
+
grants.actions.forEach((action, a) => {
|
|
73
|
+
if (action !== 'read')
|
|
74
|
+
out.push({ path: at('actions', a), message: `a ledger's code writes "${table.ref}": an app's role may only read it` });
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
const columns = new Map(table.columns.map((column) => [column.ref, column]));
|
|
78
|
+
for (const action of ROLE_ADD_ON_ACTIONS) {
|
|
79
|
+
const key = LIST_OF[action];
|
|
80
|
+
const listed = grants[key];
|
|
81
|
+
const allowed = grants.actions.includes(action);
|
|
82
|
+
if (listed !== undefined && !allowed)
|
|
83
|
+
out.push({ path: at(key), message: `"${action}" is not allowed here, so there is nothing for "${key}" to name` });
|
|
84
|
+
// A write is never "every column": the add-on names what an app may change.
|
|
85
|
+
if (listed === undefined && allowed && action !== 'read')
|
|
86
|
+
out.push({ path: at(key), message: `an app's role may ${action === 'update' ? 'change rows' : 'add rows'} here: name the columns it may ${action === 'update' ? 'change' : 'fill'} ("${key}")` });
|
|
87
|
+
(listed ?? []).forEach((ref, c) => {
|
|
88
|
+
if (!columns.has(ref))
|
|
89
|
+
out.push({ path: at(key, c), message: `"${table.ref}" has no column "${ref}"` });
|
|
90
|
+
else if ((grants.never ?? []).includes(ref))
|
|
91
|
+
out.push({ path: at(key, c), message: `"${ref}" is listed in "never" too` });
|
|
92
|
+
});
|
|
93
|
+
if (listed !== undefined && new Set(listed).size !== listed.length)
|
|
94
|
+
out.push({ path: at(key), message: 'a column is listed once' });
|
|
95
|
+
}
|
|
96
|
+
(grants.never ?? []).forEach((ref, c) => {
|
|
97
|
+
const column = columns.get(ref);
|
|
98
|
+
if (column === undefined)
|
|
99
|
+
out.push({ path: at('never', c), message: `"${table.ref}" has no column "${ref}"` });
|
|
100
|
+
// Every read shows the key and the links: naming one here would promise what no read keeps.
|
|
101
|
+
else if (column.role === 'pk' || column.type === 'fk')
|
|
102
|
+
out.push({ path: at('never', c), message: `"${ref}" is the table's key or a link, which every read shows: leave it out of "writable" and "creatable" instead` });
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
return out;
|
|
106
|
+
}
|
|
107
|
+
const kept = (asked, allowed) => [...new Set(asked)].filter((ref) => allowed.has(ref));
|
|
108
|
+
const pickKeys = (record, keys) => {
|
|
109
|
+
if (record === undefined)
|
|
110
|
+
return undefined;
|
|
111
|
+
const out = Object.fromEntries(Object.entries(record).filter(([key]) => keys.includes(key)));
|
|
112
|
+
return Object.keys(out).length === 0 ? undefined : out;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* What an app's grant on one of an add-on's tables comes to: the add-on's
|
|
116
|
+
* shape (receipts, ledger tables), the columns it has, and its `appGrants`.
|
|
117
|
+
* Narrower than asked, never wider; whatever is cut is named.
|
|
118
|
+
*/
|
|
119
|
+
export function roleTableHold(entry, addOn) {
|
|
120
|
+
const asked = [...new Set(entry.actions)];
|
|
121
|
+
const none = (skipped) => ({ actions: [], narrowed: { actions: asked }, skipped });
|
|
122
|
+
const shape = addOn.tables.find((table) => table.ref === entry.table);
|
|
123
|
+
if (shape === undefined)
|
|
124
|
+
return none('unknown-table');
|
|
125
|
+
// No hold at all on a receipt.
|
|
126
|
+
if (addOn.ledgers.some((ledger) => ledger.receipts === entry.table))
|
|
127
|
+
return none('ledger-table');
|
|
128
|
+
const limit = entry.limit;
|
|
129
|
+
const all = shape.columns.map((column) => column.ref);
|
|
130
|
+
const columns = new Set(all);
|
|
131
|
+
const named = [...(limit?.readable ?? []), ...(limit?.writable ?? []), ...(limit?.creatable ?? []), ...Object.keys(limit?.writableValues ?? {}), ...Object.keys(limit?.writableFrom ?? {}), ...Object.keys(limit?.creatableValues ?? {}), ...Object.values(limit?.rows ?? {}).flatMap((written) => reachList(written).flatMap((reach) => (reach.while === undefined ? [] : [reach.while.column])))];
|
|
132
|
+
// A grant is never written without its limit: a limit that names a column the table has not skips the whole entry.
|
|
133
|
+
const unknown = named.filter((column) => !columns.has(column));
|
|
134
|
+
if (unknown.length > 0)
|
|
135
|
+
return none('unknown-column');
|
|
136
|
+
const ceilinged = declaresAppGrants(addOn.tables);
|
|
137
|
+
const grants = shape.appGrants;
|
|
138
|
+
if (ceilinged && grants === undefined)
|
|
139
|
+
return none('not-offered');
|
|
140
|
+
const written = addOn.ledgers.some((ledger) => Object.prototype.hasOwnProperty.call(ledger.writes ?? {}, entry.table));
|
|
141
|
+
const cutByLedger = asked.filter((action) => written && action !== 'read');
|
|
142
|
+
const cutActions = new Set(cutByLedger);
|
|
143
|
+
const cutColumns = {};
|
|
144
|
+
let byCeiling = false;
|
|
145
|
+
let actions = asked.filter((action) => !cutActions.has(action));
|
|
146
|
+
if (grants !== undefined) {
|
|
147
|
+
for (const action of actions) {
|
|
148
|
+
if (!grants.actions.includes(action)) {
|
|
149
|
+
cutActions.add(action);
|
|
150
|
+
byCeiling = true;
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
actions = actions.filter((action) => !cutActions.has(action));
|
|
154
|
+
}
|
|
155
|
+
const never = new Set(grants?.never ?? []);
|
|
156
|
+
const secret = new Set(shape.columns.filter((column) => column.rules?.secret === true).map((column) => column.ref));
|
|
157
|
+
/** The columns the add-on lets an app's action reach: null, every column (an add-on with no `appGrants`). */
|
|
158
|
+
const ceilingOf = (action) => {
|
|
159
|
+
if (grants === undefined)
|
|
160
|
+
return null;
|
|
161
|
+
const listed = grants[LIST_OF[action]];
|
|
162
|
+
if (listed !== undefined)
|
|
163
|
+
return new Set(listed.filter((ref) => !never.has(ref)));
|
|
164
|
+
// Only a read may be "every column": every one but `never`'s and the secrets no response carries.
|
|
165
|
+
return action === 'read' ? new Set(all.filter((ref) => !never.has(ref) && !secret.has(ref))) : new Set();
|
|
166
|
+
};
|
|
167
|
+
/*
|
|
168
|
+
* Which rows an action reaches, by a column's value, tells what that column
|
|
169
|
+
* holds: a role that sees only the items whose cost is 0 has read their
|
|
170
|
+
* cost. A row limit (`rows`, `writableFrom`) on a column an app's read may
|
|
171
|
+
* not show leaves the whole entry out — dropping the limit would widen it.
|
|
172
|
+
*/
|
|
173
|
+
if (grants !== undefined) {
|
|
174
|
+
const shown = grants.actions.includes('read') ? (ceilingOf('read') ?? new Set()) : new Set();
|
|
175
|
+
const judged = [...Object.keys(limit?.writableFrom ?? {}), ...Object.values(limit?.rows ?? {}).flatMap((written) => reachList(written).flatMap((reach) => (reach.while === undefined ? [] : [reach.while.column])))];
|
|
176
|
+
if (judged.some((column) => !shown.has(column)))
|
|
177
|
+
return none('ceiling');
|
|
178
|
+
}
|
|
179
|
+
const askedOf = (action) => (action === 'read' ? limit?.readable : action === 'update' ? limit?.writable : limit?.creatable);
|
|
180
|
+
const lists = {};
|
|
181
|
+
for (const action of [...actions]) {
|
|
182
|
+
const ceiling = ceilingOf(action);
|
|
183
|
+
const wanted = askedOf(action);
|
|
184
|
+
if (ceiling === null) {
|
|
185
|
+
if (wanted !== undefined)
|
|
186
|
+
lists[action] = [...new Set(wanted)];
|
|
187
|
+
continue;
|
|
188
|
+
}
|
|
189
|
+
// Asked for every column: given the add-on's, and what it keeps back is said.
|
|
190
|
+
const from = wanted ?? all;
|
|
191
|
+
const fits = kept(from, ceiling);
|
|
192
|
+
const cut = [...new Set(from)].filter((ref) => !ceiling.has(ref) && !(wanted === undefined && secret.has(ref)));
|
|
193
|
+
if (cut.length > 0) {
|
|
194
|
+
cutColumns[action] = cut;
|
|
195
|
+
byCeiling = true;
|
|
196
|
+
}
|
|
197
|
+
if (fits.length === 0) {
|
|
198
|
+
cutActions.add(action);
|
|
199
|
+
byCeiling = true;
|
|
200
|
+
actions = actions.filter((one) => one !== action);
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
lists[action] = fits;
|
|
204
|
+
}
|
|
205
|
+
const has = (action) => actions.includes(action);
|
|
206
|
+
const writable = has('update') ? lists.update : undefined;
|
|
207
|
+
const creatable = has('create') ? lists.create : undefined;
|
|
208
|
+
const writableValues = writable === undefined ? undefined : pickKeys(limit?.writableValues, writable);
|
|
209
|
+
const creatableValues = creatable === undefined ? undefined : pickKeys(limit?.creatableValues, creatable);
|
|
210
|
+
// Which rows an action reaches only ever narrows it: kept for the actions kept.
|
|
211
|
+
const rows = pickKeys(limit?.rows, actions);
|
|
212
|
+
const written_ = {
|
|
213
|
+
...(has('read') && lists.read !== undefined ? { readable: lists.read } : {}),
|
|
214
|
+
...(writable === undefined ? {} : { writable }),
|
|
215
|
+
...(writableValues === undefined ? {} : { writableValues }),
|
|
216
|
+
...(has('update') && limit?.writableFrom !== undefined ? { writableFrom: limit.writableFrom } : {}),
|
|
217
|
+
...(creatable === undefined ? {} : { creatable }),
|
|
218
|
+
...(creatableValues === undefined ? {} : { creatableValues }),
|
|
219
|
+
...(rows === undefined ? {} : { rows }),
|
|
220
|
+
};
|
|
221
|
+
const narrowed = cutActions.size + Object.keys(cutColumns).length === 0
|
|
222
|
+
? undefined
|
|
223
|
+
: { actions: asked.filter((action) => cutActions.has(action)), ...Object.fromEntries(ROLE_ADD_ON_ACTIONS.flatMap((action) => (cutColumns[action] === undefined ? [] : [[LIST_OF[action], cutColumns[action]]]))) };
|
|
224
|
+
const skipped = byCeiling ? 'ceiling' : cutByLedger.length > 0 ? 'ledger-table' : undefined;
|
|
225
|
+
return {
|
|
226
|
+
actions,
|
|
227
|
+
...(has('read') && lists.read !== undefined ? { readable: lists.read } : {}),
|
|
228
|
+
...(writable === undefined ? {} : { writable }),
|
|
229
|
+
...(creatable === undefined ? {} : { creatable }),
|
|
230
|
+
...(Object.keys(written_).length === 0 ? {} : { limit: written_ }),
|
|
231
|
+
...(narrowed === undefined ? {} : { narrowed }),
|
|
232
|
+
...(skipped === undefined ? {} : { skipped }),
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
/** Every column, in a list of what a grant reaches: the grant is whole there. */
|
|
236
|
+
export const EVERY_COLUMN = '*';
|
|
237
|
+
/**
|
|
238
|
+
* What `after` holds of a table that `before` did not: actions, and columns
|
|
239
|
+
* any of its actions reaches (`*`: every column, where before it was some or
|
|
240
|
+
* none). Null when it holds nothing more.
|
|
241
|
+
*/
|
|
242
|
+
export function holdWider(before, after) {
|
|
243
|
+
const had = new Set(before?.actions ?? []);
|
|
244
|
+
const actions = after.actions.filter((action) => !had.has(action));
|
|
245
|
+
const columns = new Set();
|
|
246
|
+
for (const action of after.actions) {
|
|
247
|
+
const key = LIST_OF[action];
|
|
248
|
+
const now = after[key];
|
|
249
|
+
const was = had.has(action) ? (before?.[key] ?? null) : [];
|
|
250
|
+
// null: every column.
|
|
251
|
+
if (was === null)
|
|
252
|
+
continue;
|
|
253
|
+
if (now === undefined) {
|
|
254
|
+
columns.add(EVERY_COLUMN);
|
|
255
|
+
continue;
|
|
256
|
+
}
|
|
257
|
+
for (const ref of now)
|
|
258
|
+
if (!was.includes(ref))
|
|
259
|
+
columns.add(ref);
|
|
260
|
+
}
|
|
261
|
+
return actions.length === 0 && columns.size === 0 ? null : { actions, columns: [...columns] };
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=app-grants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app-grants.js","sourceRoot":"","sources":["../src/app-grants.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,SAAS,EAAuB,MAAM,WAAW,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,mBAAmB,EAAuC,MAAM,YAAY,CAAC;AAIjG,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC;KAC7B,MAAM,CAAC;IACN,yDAAyD;IACzD,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,mBAAmB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3D,6GAA6G;IAC7G,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACvD,uFAAuF;IACvF,QAAQ,EAAE,CAAC,CAAC,KAAK,CAAC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