@20baht/app 0.0.0-stage → 0.1.1
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/CHANGELOG.md +11 -0
- package/LICENSE +21 -0
- package/README.md +136 -2
- package/dist/browser.d.ts +65 -0
- package/dist/browser.js +40 -0
- package/dist/index.d.ts +149 -0
- package/dist/index.js +179 -0
- package/dist/policy.d.ts +49 -0
- package/dist/policy.js +21 -0
- package/package.json +68 -4
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @20baht/app changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
- `@20baht/app/browser`: `appClient<typeof app>({ url, fetch, headers })`, the client of the app's form and table routes, typed by the app's type alone. `submit(name, data)` answers `{ ok, answer }`, `invalid` with the 422's `issues`, or `refused` with the status and message; `search(name, query)` answers `{ ok, page }` or `refused`. No dependency, no element.
|
|
6
|
+
|
|
7
|
+
## 0.1.0
|
|
8
|
+
|
|
9
|
+
- First release. `defineApp({ forms, tables, definitions, validation, caller, policy })`: a write route per form, a search route per table and the routes of `@20baht/definitions`, as a `fetch` handler any server runs.
|
|
10
|
+
- One `policy({ caller, action, resource })` guards every route, asked before the body is read; only `'allow'` allows. An app with none says `open: true`.
|
|
11
|
+
- `RoutesOf<typeof app>`: the form and table routes as a plain type, for a client on any framework.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Nattapong Promthong
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,137 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @20baht/app
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
One typed definition of an app's server. It replaces the wiring each app writes by hand: a write
|
|
4
|
+
route per form, a search route per table and the definitions routes. What no longer fits after an
|
|
5
|
+
update fails in `tsc`. No framework: it is a fetch handler, and `@20baht/app-elysia` mounts the same
|
|
6
|
+
definition on Elysia.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
bun add @20baht/app @20baht/engine
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { appForm, appTable, defineApp, type RoutesOf } from '@20baht/app';
|
|
14
|
+
|
|
15
|
+
export const app = defineApp({
|
|
16
|
+
forms: { order: appForm(orderForm, ({ data }) => orders.add(data)) },
|
|
17
|
+
tables: { orders: appTable(ordersTable, ({ query }) => orders.search(query)) },
|
|
18
|
+
definitions: { service: definitions }, // @20baht/definitions
|
|
19
|
+
validation: { registry }, // checkSubmission's options, for every form
|
|
20
|
+
caller: (request) => sessions.user(request), // { id, … } or null
|
|
21
|
+
policy: ({ caller, action, resource }) => {
|
|
22
|
+
if (action === 'forms.submit') return resource === 'order' && caller ? 'allow' : 'deny';
|
|
23
|
+
if (action === 'tables.search' || action === 'definitions.read') {
|
|
24
|
+
return caller ? 'allow' : 'deny';
|
|
25
|
+
}
|
|
26
|
+
return caller?.admin ? 'allow' : 'deny';
|
|
27
|
+
},
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
Bun.serve({ fetch: app.fetch });
|
|
31
|
+
export type Routes = RoutesOf<typeof app>;
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Routes
|
|
35
|
+
|
|
36
|
+
| Route | Body | Answer |
|
|
37
|
+
| --- | --- | --- |
|
|
38
|
+
| `POST /forms/<name>` | the form's data | what the handler returns; `422 { issues }` when refused |
|
|
39
|
+
| `POST /tables/<name>` | a table query | `{ rows, total }`; `400 { message }` when refused |
|
|
40
|
+
| `/definitions/…` | | the routes of `@20baht/definitions` |
|
|
41
|
+
|
|
42
|
+
- A name is letters, digits, `-` and `_`; `defineApp` throws on another.
|
|
43
|
+
- A body is read only as `application/json` (415 otherwise, 400 when it is not JSON), after the
|
|
44
|
+
policy allows. Limit its size at your server.
|
|
45
|
+
- A handler gets `{ data, request }` (a form) or `{ query, request }` (a table). It may return a
|
|
46
|
+
`Response`, sent as it is (a rule about the data itself is refused here). Nothing
|
|
47
|
+
returned is an empty 200; a handler that throws makes `fetch` reject.
|
|
48
|
+
- `appForm` takes what `checkSubmission` takes: a form, a workflow, or `{ schema, form }`.
|
|
49
|
+
- `appTable(table, search, limits?)` takes `parseTableQuery`'s limits. Tables are paged by `page`;
|
|
50
|
+
there is no cursor route yet.
|
|
51
|
+
- `app.routes` is `{ method, path, handle }[]`, for an adapter that mounts them itself.
|
|
52
|
+
|
|
53
|
+
## The policy
|
|
54
|
+
|
|
55
|
+
One function guards every route: `policy({ caller, action, resource })`.
|
|
56
|
+
|
|
57
|
+
| action | resource | asked for |
|
|
58
|
+
| --- | --- | --- |
|
|
59
|
+
| `forms.submit` | the form's name | `POST /forms/<name>` |
|
|
60
|
+
| `tables.search` | the table's name | `POST /tables/<name>` |
|
|
61
|
+
| `definitions.read` | the definition, `null` for the list | list, active, versions, one version |
|
|
62
|
+
| `definitions.edit` | the definition, `null` for `check` | `check`; get, save, discard a draft |
|
|
63
|
+
| `definitions.publish` | the definition | publish |
|
|
64
|
+
| `definitions.activate` | the definition | activate, **and a publish with `activate`** |
|
|
65
|
+
|
|
66
|
+
- **Only `'allow'` allows.** `'deny'`, no answer (an action you did not think of), any other value,
|
|
67
|
+
a throw and a rejection deny. A throw is also logged with `console.error`.
|
|
68
|
+
- A refusal is `403 { message }` (definitions: `403 { reason: 'denied', message }`).
|
|
69
|
+
- It is asked **before the body is read or checked**, so a refused caller never reaches your
|
|
70
|
+
handlers, `options_from` fetchers or `references.resolve` (`validation.verify`).
|
|
71
|
+
- **`caller(request)`** says who is asking: an object with an `id`, or `null` for nobody. The policy
|
|
72
|
+
decides what nobody may do. Read headers (or what your server keeps by the request), never the
|
|
73
|
+
body. A throw denies, without asking the policy.
|
|
74
|
+
- A definitions write is signed with `caller.id`: without one, only `definitions.read` can be
|
|
75
|
+
allowed.
|
|
76
|
+
- `definitions.names` (`['contact', 'claim']`) are the only definitions the routes answer about;
|
|
77
|
+
another name is refused without asking, and `resource` is typed as those. Without it, any name,
|
|
78
|
+
`resource: string`. The list answers every stored definition either way.
|
|
79
|
+
- The actions and resources are typed: a misspelt action, or a form compared with a table's name,
|
|
80
|
+
is a type error. `Policy<Caller>` and `PolicyInput<Caller>` type one written in its own file.
|
|
81
|
+
- The definitions' `authorize` port is derived from the policy, so `definitions` takes none. A
|
|
82
|
+
definitions route asks the policy twice (before the request is read, then by that port): keep it
|
|
83
|
+
free of side effects. A library used on its own is unchanged.
|
|
84
|
+
- Answers are not cached: each request asks again.
|
|
85
|
+
|
|
86
|
+
**An app with no policy** says `open: true`. Anyone who reaches a form or table route is served;
|
|
87
|
+
`definitions` then needs its own `authorize`. A definition with neither `policy` nor `open: true`
|
|
88
|
+
does not compile, and throws.
|
|
89
|
+
|
|
90
|
+
```ts
|
|
91
|
+
defineApp({ forms, tables, open: true }); // guard it yourself, in front of `fetch`
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
An adapter that mounts `forms` and `tables` itself asks `app.allows(request, action, resource)`
|
|
95
|
+
before it reads the body.
|
|
96
|
+
|
|
97
|
+
## The types a client reads
|
|
98
|
+
|
|
99
|
+
`RoutesOf<typeof app>` is a plain map, so a client on any framework can use it:
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
type Order = Routes['POST /forms/order']; // { body, answer, 422 }
|
|
103
|
+
type Search = Routes['POST /tables/orders']; // { body: TableQueryOf, answer: TablePage<Row>, 400 }
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
A form, table or column the definition does not have is a type error. The definitions routes are not
|
|
107
|
+
in the map.
|
|
108
|
+
|
|
109
|
+
## The client: `@20baht/app/browser`
|
|
110
|
+
|
|
111
|
+
The same routes as two calls, typed by the app. Only the app's type is imported, so nothing of the
|
|
112
|
+
server reaches the bundle; it has no dependency and knows no element.
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
import { appClient } from '@20baht/app/browser';
|
|
116
|
+
import type { app } from '../server/app';
|
|
117
|
+
|
|
118
|
+
const api = appClient<typeof app>({ url: '/api' });
|
|
119
|
+
|
|
120
|
+
const sent = await api.submit('order', { customer: 'Ann', qty: 2 });
|
|
121
|
+
if (sent.ok) sent.answer; // what the form's handler returned
|
|
122
|
+
else if (sent.reason === 'invalid') sent.issues; // the 422: { ref, message }[], refs the form's
|
|
123
|
+
else sent.message; // 'refused': any other answer, with its status
|
|
124
|
+
|
|
125
|
+
const found = await api.search('orders', { sort: { key: 'qty', dir: 'desc' } });
|
|
126
|
+
if (found.ok) found.page.rows; // the table's rows
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- `url`: where the app is mounted (the page's own origin without it). `fetch`: the host's own, for
|
|
130
|
+
its credentials. `headers`: asked on every request, for a token that is refreshed.
|
|
131
|
+
- A call resolves for whatever the server answers and rejects only when no answer came.
|
|
132
|
+
- With `@20baht/ui/typed`: `order.onSubmit((data) => api.submit('order', data))` and
|
|
133
|
+
`orders.onQuery((query) => api.search('orders', query))` fit without a cast.
|
|
134
|
+
|
|
135
|
+
## Not in this version
|
|
136
|
+
|
|
137
|
+
Runs (their actions will be `runs.*`), live queries and MCP.
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import type { RoutesOf } from './index.js';
|
|
2
|
+
/** The names after `prefix` among the routes `Routes`. */
|
|
3
|
+
type Names<Routes, Prefix extends string> = keyof Routes extends infer Key ? Key extends `${Prefix}${infer Name}` ? Name : never : never;
|
|
4
|
+
type Route<Routes, Key> = Key extends keyof Routes ? Routes[Key] : never;
|
|
5
|
+
type Part<R, Key extends PropertyKey> = R extends Record<Key, infer Value> ? Value : never;
|
|
6
|
+
/** The names of an app's forms. */
|
|
7
|
+
export type FormName<A> = Names<RoutesOf<A>, 'POST /forms/'>;
|
|
8
|
+
/** The names of an app's tables. */
|
|
9
|
+
export type TableName<A> = Names<RoutesOf<A>, 'POST /tables/'>;
|
|
10
|
+
type FormRouteOf<A, Name extends string> = Route<RoutesOf<A>, `POST /forms/${Name}`>;
|
|
11
|
+
type TableRouteOf<A, Name extends string> = Route<RoutesOf<A>, `POST /tables/${Name}`>;
|
|
12
|
+
/** The body a form's route takes. */
|
|
13
|
+
export type FormBody<A, Name extends string> = Part<FormRouteOf<A, Name>, 'body'>;
|
|
14
|
+
/** What a form's handler answers. */
|
|
15
|
+
export type FormAnswer<A, Name extends string> = Part<FormRouteOf<A, Name>, 'answer'>;
|
|
16
|
+
/** A refused submission's issues. */
|
|
17
|
+
export type FormIssues<A, Name extends string> = Part<Part<FormRouteOf<A, Name>, 422>, 'issues'>;
|
|
18
|
+
/** The query a table's route takes. */
|
|
19
|
+
export type TableBody<A, Name extends string> = Part<TableRouteOf<A, Name>, 'body'>;
|
|
20
|
+
/** The page a table's route answers. */
|
|
21
|
+
export type TableAnswer<A, Name extends string> = Part<TableRouteOf<A, Name>, 'answer'>;
|
|
22
|
+
/** The server said no for another reason than the form's own checks: its status and message. */
|
|
23
|
+
export interface Refused {
|
|
24
|
+
ok: false;
|
|
25
|
+
reason: 'refused';
|
|
26
|
+
status: number;
|
|
27
|
+
/** The answer's `message`, or `HTTP <status>` when it has none. */
|
|
28
|
+
message: string;
|
|
29
|
+
}
|
|
30
|
+
export type SubmitResult<A, Name extends string> = {
|
|
31
|
+
ok: true;
|
|
32
|
+
answer: FormAnswer<A, Name>;
|
|
33
|
+
} | {
|
|
34
|
+
ok: false;
|
|
35
|
+
reason: 'invalid';
|
|
36
|
+
issues: FormIssues<A, Name>;
|
|
37
|
+
} | Refused;
|
|
38
|
+
export type SearchResult<A, Name extends string> = {
|
|
39
|
+
ok: true;
|
|
40
|
+
page: TableAnswer<A, Name>;
|
|
41
|
+
} | Refused;
|
|
42
|
+
export interface AppClientOptions {
|
|
43
|
+
/** Where the app is mounted: `/api`, or another origin. The page's own origin without it. */
|
|
44
|
+
url?: string;
|
|
45
|
+
/** The page's `fetch` without it. A host's own carries its credentials. */
|
|
46
|
+
fetch?: (url: string, init: RequestInit) => Promise<Response>;
|
|
47
|
+
/** Headers of every request, asked each time (a token that is refreshed). */
|
|
48
|
+
headers?: () => Record<string, string> | Promise<Record<string, string>>;
|
|
49
|
+
}
|
|
50
|
+
export interface AppClient<A> {
|
|
51
|
+
/**
|
|
52
|
+
* `POST /forms/<name>`. Resolves for whatever the server answers; rejects only when no answer
|
|
53
|
+
* came (the network, an abort).
|
|
54
|
+
*/
|
|
55
|
+
submit<Name extends FormName<A>>(name: Name, data: FormBody<A, NoInfer<Name>>): Promise<SubmitResult<A, Name>>;
|
|
56
|
+
/** `POST /tables/<name>`. */
|
|
57
|
+
search<Name extends TableName<A>>(name: Name, query: TableBody<A, NoInfer<Name>>): Promise<SearchResult<A, Name>>;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The client of an app's routes. `A` is the app's type (`typeof app`, imported as a type): a
|
|
61
|
+
* form or table it does not have, a body that is not the form's, a column that is not the
|
|
62
|
+
* table's, is a type error.
|
|
63
|
+
*/
|
|
64
|
+
export declare function appClient<A>(options?: AppClientOptions): AppClient<A>;
|
|
65
|
+
export {};
|
package/dist/browser.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const isRecord = (value) => typeof value === 'object' && value !== null;
|
|
2
|
+
async function jsonOf(response) {
|
|
3
|
+
const [type = ''] = (response.headers.get('content-type') ?? '').split(';');
|
|
4
|
+
if (type.trim().toLowerCase() !== 'application/json')
|
|
5
|
+
return undefined;
|
|
6
|
+
const text = await response.text();
|
|
7
|
+
return text === '' ? undefined : JSON.parse(text);
|
|
8
|
+
}
|
|
9
|
+
function refused(status, body) {
|
|
10
|
+
const message = isRecord(body) && typeof body.message === 'string' ? body.message : `HTTP ${String(status)}`;
|
|
11
|
+
return { ok: false, reason: 'refused', status, message };
|
|
12
|
+
}
|
|
13
|
+
export function appClient(options = {}) {
|
|
14
|
+
const base = (options.url ?? '').replace(/\/+$/, '');
|
|
15
|
+
const send = options.fetch ?? ((url, init) => globalThis.fetch(url, init));
|
|
16
|
+
const post = async (path, body) => {
|
|
17
|
+
const response = await send(`${base}${path}`, {
|
|
18
|
+
method: 'POST',
|
|
19
|
+
headers: { ...(await options.headers?.()), 'content-type': 'application/json' },
|
|
20
|
+
body: JSON.stringify(body),
|
|
21
|
+
});
|
|
22
|
+
return { status: response.status, body: await jsonOf(response) };
|
|
23
|
+
};
|
|
24
|
+
const passed = (status) => status >= 200 && status < 300;
|
|
25
|
+
return {
|
|
26
|
+
async submit(name, data) {
|
|
27
|
+
const { status, body } = await post(`/forms/${name}`, data);
|
|
28
|
+
if (passed(status))
|
|
29
|
+
return { ok: true, answer: body };
|
|
30
|
+
if (status === 422 && isRecord(body) && Array.isArray(body.issues)) {
|
|
31
|
+
return { ok: false, reason: 'invalid', issues: body.issues };
|
|
32
|
+
}
|
|
33
|
+
return refused(status, body);
|
|
34
|
+
},
|
|
35
|
+
async search(name, query) {
|
|
36
|
+
const { status, body } = await post(`/tables/${name}`, query);
|
|
37
|
+
return passed(status) ? { ok: true, page: body } : refused(status, body);
|
|
38
|
+
},
|
|
39
|
+
};
|
|
40
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { type DefinitionAuthorize, type Definitions } from '@20baht/definitions';
|
|
2
|
+
import { type TableLike, type TablePage, type TableQueryOf } from '@20baht/table-query';
|
|
3
|
+
import type { ParseLimits } from '@20baht/table-query';
|
|
4
|
+
import { type CheckSubmissionOptions, type FormFailure, type KnownForm, type TargetData, type TargetInput, type ValidateTarget } from '@20baht/validator';
|
|
5
|
+
import { type Policy, type PolicyAction, type PolicyCaller, type ResolveCaller } from './policy.js';
|
|
6
|
+
export type { DefinitionsAction, FormsAction, Policy, PolicyAction, PolicyCaller, PolicyDecision, PolicyInput, PolicyResources, ResolveCaller, TablesAction, } from './policy.js';
|
|
7
|
+
/** What a route's handler answers with, as a client reads it: its value, not a `Response`. */
|
|
8
|
+
type Answer<Result> = Exclude<Awaited<Result>, Response>;
|
|
9
|
+
/** What a form's route runs once the body passed. */
|
|
10
|
+
export interface FormInput<Data> {
|
|
11
|
+
/** The canonical data: defaults filled, hidden fields dropped, unknown keys gone. */
|
|
12
|
+
data: Data;
|
|
13
|
+
request: Request;
|
|
14
|
+
}
|
|
15
|
+
/** What a table's route runs once the query passed. */
|
|
16
|
+
export interface TableInput<Key extends string> {
|
|
17
|
+
/** A query naming only the table's own columns. */
|
|
18
|
+
query: TableQueryOf<Key>;
|
|
19
|
+
request: Request;
|
|
20
|
+
}
|
|
21
|
+
/** A form's write route: made by `appForm`. */
|
|
22
|
+
export interface AppForm<Target extends ValidateTarget = ValidateTarget, Result = unknown> {
|
|
23
|
+
readonly target: Target;
|
|
24
|
+
readonly submit: (input: FormInput<never>) => unknown;
|
|
25
|
+
/** Types only. */
|
|
26
|
+
readonly '~answer'?: Result;
|
|
27
|
+
}
|
|
28
|
+
/** A table's search route: made by `appTable`. */
|
|
29
|
+
export interface AppTable<Key extends string = string, Row = unknown> {
|
|
30
|
+
readonly table: TableLike<Key, Row>;
|
|
31
|
+
readonly limits: ParseLimits;
|
|
32
|
+
readonly search: (input: TableInput<never>) => unknown;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A form's write route. `target` is what `checkSubmission` takes (a form, a workflow, or
|
|
36
|
+
* `{ schema, form }`); `submit` gets the canonical data and its return value is the answer, as
|
|
37
|
+
* JSON. A `Response` it returns is sent as it is.
|
|
38
|
+
*/
|
|
39
|
+
export declare function appForm<const Target extends ValidateTarget, Result>(target: Target & KnownForm<Target>, submit: (input: FormInput<TargetData<Target>>) => Result): AppForm<Target, Answer<Result>>;
|
|
40
|
+
/**
|
|
41
|
+
* A table's search route: `search` answers a page of the table's rows for a checked query.
|
|
42
|
+
* `limits` are `parseTableQuery`'s.
|
|
43
|
+
*/
|
|
44
|
+
export declare function appTable<Key extends string, Row>(table: TableLike<Key, Row>, search: (input: TableInput<Key>) => TablePage<NoInfer<Row>> | Response | Promise<TablePage<NoInfer<Row>> | Response>, limits?: ParseLimits): AppTable<Key, Row>;
|
|
45
|
+
/** The definitions routes of an app, served under `/definitions`. */
|
|
46
|
+
export interface AppDefinitions {
|
|
47
|
+
service: Definitions;
|
|
48
|
+
/** Who is asking, or nothing when they may not: the route answers 403. */
|
|
49
|
+
authorize: DefinitionAuthorize;
|
|
50
|
+
}
|
|
51
|
+
export type AppForms = Readonly<Record<string, AppForm>>;
|
|
52
|
+
export type AppTables = Readonly<Record<string, AppTable>>;
|
|
53
|
+
type None = Record<never, never>;
|
|
54
|
+
interface AppEntries<Forms extends AppForms, Tables extends AppTables> {
|
|
55
|
+
forms?: Forms;
|
|
56
|
+
tables?: Tables;
|
|
57
|
+
/** What every form is checked with: `checkSubmission`'s options. */
|
|
58
|
+
validation?: CheckSubmissionOptions;
|
|
59
|
+
}
|
|
60
|
+
/** An app whose routes one policy guards. */
|
|
61
|
+
export interface GuardedAppSpec<Forms extends AppForms, Tables extends AppTables, Caller extends PolicyCaller, Name extends string> extends AppEntries<Forms, Tables> {
|
|
62
|
+
/** Who is asking. */
|
|
63
|
+
caller: ResolveCaller<Caller>;
|
|
64
|
+
/** May they? Asked before the body is read. Only `'allow'` does. */
|
|
65
|
+
policy: Policy<NoInfer<Caller>, {
|
|
66
|
+
forms: keyof NoInfer<Forms> & string;
|
|
67
|
+
tables: keyof NoInfer<Tables> & string;
|
|
68
|
+
definitions: NoInfer<Name>;
|
|
69
|
+
}>;
|
|
70
|
+
definitions?: {
|
|
71
|
+
service: Definitions;
|
|
72
|
+
/** The only definitions the routes answer about; without it, any name. */
|
|
73
|
+
names?: readonly Name[];
|
|
74
|
+
/** The policy is the `authorize`. */
|
|
75
|
+
authorize?: never;
|
|
76
|
+
};
|
|
77
|
+
open?: never;
|
|
78
|
+
}
|
|
79
|
+
/** An app with no policy: whoever reaches a form or table route is served. */
|
|
80
|
+
export interface OpenAppSpec<Forms extends AppForms, Tables extends AppTables> extends AppEntries<Forms, Tables> {
|
|
81
|
+
/** Say so on purpose. The definitions routes still ask their own `authorize`. */
|
|
82
|
+
open: true;
|
|
83
|
+
definitions?: AppDefinitions;
|
|
84
|
+
policy?: never;
|
|
85
|
+
caller?: never;
|
|
86
|
+
}
|
|
87
|
+
export type AppSpec<Forms extends AppForms = AppForms, Tables extends AppTables = AppTables, Caller extends PolicyCaller = PolicyCaller, Name extends string = string> = GuardedAppSpec<Forms, Tables, Caller, Name> | OpenAppSpec<Forms, Tables>;
|
|
88
|
+
/** One route of the app. `path` may hold `:param` segments. */
|
|
89
|
+
export interface AppRoute {
|
|
90
|
+
readonly method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
|
91
|
+
readonly path: string;
|
|
92
|
+
readonly handle: (request: Request, params: Record<string, string>) => Promise<Response>;
|
|
93
|
+
}
|
|
94
|
+
export interface App<Forms extends AppForms = AppForms, Tables extends AppTables = AppTables> {
|
|
95
|
+
readonly forms: Forms;
|
|
96
|
+
readonly tables: Tables;
|
|
97
|
+
/** With a policy, `authorize` is the policy's. */
|
|
98
|
+
readonly definitions: AppDefinitions | undefined;
|
|
99
|
+
/** No policy: `open: true`. */
|
|
100
|
+
readonly open: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* May this request do `action` on `resource`? An adapter that mounts `forms` and `tables`
|
|
103
|
+
* itself asks before it reads the body. Always true for an open app; never throws.
|
|
104
|
+
*/
|
|
105
|
+
readonly allows: (request: Request, action: PolicyAction, resource: string | null) => Promise<boolean>;
|
|
106
|
+
readonly validation: CheckSubmissionOptions;
|
|
107
|
+
readonly routes: readonly AppRoute[];
|
|
108
|
+
/** The app as a server: 404 for what it has no route for. A handler that throws, rejects. */
|
|
109
|
+
readonly fetch: (request: Request) => Promise<Response>;
|
|
110
|
+
}
|
|
111
|
+
type FormRoute<Form> = Form extends AppForm<infer Target, infer Result> ? {
|
|
112
|
+
body: TargetInput<Target>;
|
|
113
|
+
answer: Result;
|
|
114
|
+
422: FormFailure<Target>;
|
|
115
|
+
} : never;
|
|
116
|
+
type TableSearchRoute<Table> = Table extends AppTable<infer Key, infer Row> ? {
|
|
117
|
+
body: TableQueryOf<Key>;
|
|
118
|
+
answer: TablePage<Row>;
|
|
119
|
+
400: {
|
|
120
|
+
message: string;
|
|
121
|
+
};
|
|
122
|
+
} : never;
|
|
123
|
+
/**
|
|
124
|
+
* The app's form and table routes as a plain type, for a client on any framework:
|
|
125
|
+
*
|
|
126
|
+
* type Routes = RoutesOf<typeof app>
|
|
127
|
+
* Routes['POST /forms/order']['body']
|
|
128
|
+
*
|
|
129
|
+
* The definitions routes are not in it: their client is the builder's.
|
|
130
|
+
*/
|
|
131
|
+
export type RoutesOf<A> = A extends App<infer Forms, infer Tables> ? {
|
|
132
|
+
[Name in keyof Forms & string as `POST /forms/${Name}`]: FormRoute<Forms[Name]>;
|
|
133
|
+
} & {
|
|
134
|
+
[Name in keyof Tables & string as `POST /tables/${Name}`]: TableSearchRoute<Tables[Name]>;
|
|
135
|
+
} : never;
|
|
136
|
+
/** A handler's return value as the answer: JSON, empty for nothing, a `Response` as it is. */
|
|
137
|
+
export declare function respond(result: unknown): Response;
|
|
138
|
+
/**
|
|
139
|
+
* Does this publish body also activate? Anything but no `activate` or `false` counts, so no
|
|
140
|
+
* coercion of a server's can turn what was not asked into an activation.
|
|
141
|
+
*/
|
|
142
|
+
export declare function asksToActivate(body: unknown): boolean;
|
|
143
|
+
/**
|
|
144
|
+
* The app's server from its definitions. Routes: `POST /forms/<name>`, `POST /tables/<name>` and,
|
|
145
|
+
* with `definitions`, the routes of `@20baht/definitions` under `/definitions`. `policy` (with
|
|
146
|
+
* `caller`) guards every one of them; `open: true` says there is none.
|
|
147
|
+
*/
|
|
148
|
+
export declare function defineApp<Caller extends PolicyCaller, const Forms extends AppForms = None, const Tables extends AppTables = None, const Name extends string = string>(spec: GuardedAppSpec<Forms, Tables, Caller, Name>): App<Forms, Tables>;
|
|
149
|
+
export declare function defineApp<const Forms extends AppForms = None, const Tables extends AppTables = None>(spec: OpenAppSpec<Forms, Tables>): App<Forms, Tables>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
import { definitionEndpoints, } from '@20baht/definitions';
|
|
2
|
+
import { checkTableQuery, } from '@20baht/table-query';
|
|
3
|
+
import { checkSubmission, } from '@20baht/validator';
|
|
4
|
+
import { decider, definitionsAuthorize, } from './policy.js';
|
|
5
|
+
export function appForm(target, submit) {
|
|
6
|
+
return { target, submit };
|
|
7
|
+
}
|
|
8
|
+
export function appTable(table, search, limits = {}) {
|
|
9
|
+
return { table, search, limits };
|
|
10
|
+
}
|
|
11
|
+
const NAME = /^[A-Za-z0-9_-]+$/;
|
|
12
|
+
function checkName(name) {
|
|
13
|
+
if (!NAME.test(name)) {
|
|
14
|
+
throw new Error(`a route name holds letters, digits, "-" and "_" only: ${JSON.stringify(name)}`);
|
|
15
|
+
}
|
|
16
|
+
return name;
|
|
17
|
+
}
|
|
18
|
+
const message = (status, text) => Response.json({ message: text }, { status });
|
|
19
|
+
async function jsonBody(request) {
|
|
20
|
+
const [type = ''] = (request.headers.get('content-type') ?? '').split(';');
|
|
21
|
+
if (type.trim().toLowerCase() !== 'application/json') {
|
|
22
|
+
return message(415, 'the body must be application/json');
|
|
23
|
+
}
|
|
24
|
+
try {
|
|
25
|
+
return { body: (await request.json()) };
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return message(400, 'the body is not JSON');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function respond(result) {
|
|
32
|
+
if (result instanceof Response)
|
|
33
|
+
return result;
|
|
34
|
+
return result === undefined ? new Response(null) : Response.json(result);
|
|
35
|
+
}
|
|
36
|
+
function formRoute(name, form, validation, allows) {
|
|
37
|
+
return {
|
|
38
|
+
method: 'POST',
|
|
39
|
+
path: `/forms/${checkName(name)}`,
|
|
40
|
+
async handle(request) {
|
|
41
|
+
if (!(await allows(request, 'forms.submit', name)))
|
|
42
|
+
return message(403, 'not allowed');
|
|
43
|
+
const read = await jsonBody(request);
|
|
44
|
+
if (read instanceof Response)
|
|
45
|
+
return read;
|
|
46
|
+
const checked = await checkSubmission(form.target, read.body, validation);
|
|
47
|
+
if (!checked.ok)
|
|
48
|
+
return Response.json({ issues: checked.issues }, { status: 422 });
|
|
49
|
+
return respond(await form.submit({ data: checked.data, request }));
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
function tableRoute(name, entry, allows) {
|
|
54
|
+
return {
|
|
55
|
+
method: 'POST',
|
|
56
|
+
path: `/tables/${checkName(name)}`,
|
|
57
|
+
async handle(request) {
|
|
58
|
+
if (!(await allows(request, 'tables.search', name)))
|
|
59
|
+
return message(403, 'not allowed');
|
|
60
|
+
const read = await jsonBody(request);
|
|
61
|
+
if (read instanceof Response)
|
|
62
|
+
return read;
|
|
63
|
+
const checked = checkTableQuery(entry.table, read.body, entry.limits);
|
|
64
|
+
if (!checked.ok)
|
|
65
|
+
return message(400, checked.message);
|
|
66
|
+
return respond(await entry.search({ query: checked.query, request }));
|
|
67
|
+
},
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
const segments = (path) => path.split('/').filter((part) => part !== '');
|
|
71
|
+
function match(route, pathname) {
|
|
72
|
+
const wanted = segments(route);
|
|
73
|
+
const found = segments(pathname);
|
|
74
|
+
if (wanted.length !== found.length)
|
|
75
|
+
return undefined;
|
|
76
|
+
const params = {};
|
|
77
|
+
for (const [at, part] of wanted.entries()) {
|
|
78
|
+
const value = found[at] ?? '';
|
|
79
|
+
if (!part.startsWith(':')) {
|
|
80
|
+
if (part !== value)
|
|
81
|
+
return undefined;
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
try {
|
|
85
|
+
params[part.slice(1)] = decodeURIComponent(value);
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
return params;
|
|
92
|
+
}
|
|
93
|
+
export function asksToActivate(body) {
|
|
94
|
+
if (typeof body !== 'object' || body === null || !('activate' in body))
|
|
95
|
+
return false;
|
|
96
|
+
return body.activate !== false && body.activate !== undefined;
|
|
97
|
+
}
|
|
98
|
+
async function publishActivates(request) {
|
|
99
|
+
try {
|
|
100
|
+
return asksToActivate(await request.clone().json());
|
|
101
|
+
}
|
|
102
|
+
catch {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function definitionAppRoutes(definitions, allows, open) {
|
|
107
|
+
const { service, authorize } = definitions;
|
|
108
|
+
return definitionEndpoints(service, { authorize }).map(({ method, path, action, handle }) => ({
|
|
109
|
+
method,
|
|
110
|
+
path: `/definitions${path}`,
|
|
111
|
+
async handle(request, params) {
|
|
112
|
+
if (open)
|
|
113
|
+
return handle(request, params);
|
|
114
|
+
const name = params.name ?? null;
|
|
115
|
+
const refuse = (what) => Response.json({ reason: 'denied', message: `not allowed to ${what} definitions` }, { status: 403 });
|
|
116
|
+
if (!(await allows(request, `definitions.${action}`, name)))
|
|
117
|
+
return refuse(action);
|
|
118
|
+
if (action === 'publish' &&
|
|
119
|
+
(await publishActivates(request)) &&
|
|
120
|
+
!(await allows(request, 'definitions.activate', name))) {
|
|
121
|
+
return refuse('activate');
|
|
122
|
+
}
|
|
123
|
+
return handle(request, params);
|
|
124
|
+
},
|
|
125
|
+
}));
|
|
126
|
+
}
|
|
127
|
+
function guardOf(spec) {
|
|
128
|
+
const { open, policy, caller, definitions } = spec;
|
|
129
|
+
const guarded = policy !== undefined || caller !== undefined;
|
|
130
|
+
if (open !== undefined && guarded) {
|
|
131
|
+
throw new Error('defineApp takes a policy (with its caller) or open: true, not both');
|
|
132
|
+
}
|
|
133
|
+
if (!guarded) {
|
|
134
|
+
if (open !== true)
|
|
135
|
+
throw new Error('defineApp needs a policy and a caller, or open: true');
|
|
136
|
+
if (definitions && typeof definitions.authorize !== 'function') {
|
|
137
|
+
throw new Error('the definitions of an open app need their own authorize');
|
|
138
|
+
}
|
|
139
|
+
return undefined;
|
|
140
|
+
}
|
|
141
|
+
if (typeof policy !== 'function')
|
|
142
|
+
throw new Error('a caller is nothing without a policy');
|
|
143
|
+
if (typeof caller !== 'function')
|
|
144
|
+
throw new Error('a policy needs a caller: (request) => who');
|
|
145
|
+
if (definitions?.authorize !== undefined) {
|
|
146
|
+
throw new Error('with a policy, definitions take no authorize: the policy is asked');
|
|
147
|
+
}
|
|
148
|
+
return decider(caller, policy, definitions?.names);
|
|
149
|
+
}
|
|
150
|
+
export function defineApp(spec) {
|
|
151
|
+
const { forms = {}, tables = {}, validation = {} } = spec;
|
|
152
|
+
const decide = guardOf(spec);
|
|
153
|
+
const allows = decide
|
|
154
|
+
? async (request, action, resource) => (await decide(request, action, resource)) !== null
|
|
155
|
+
: () => Promise.resolve(true);
|
|
156
|
+
const definitions = spec.definitions && {
|
|
157
|
+
service: spec.definitions.service,
|
|
158
|
+
authorize: decide
|
|
159
|
+
? definitionsAuthorize(decide)
|
|
160
|
+
: spec.definitions.authorize,
|
|
161
|
+
};
|
|
162
|
+
const routes = [
|
|
163
|
+
...Object.entries(forms).map(([name, form]) => formRoute(name, form, validation, allows)),
|
|
164
|
+
...Object.entries(tables).map(([name, table]) => tableRoute(name, table, allows)),
|
|
165
|
+
...(definitions ? definitionAppRoutes(definitions, allows, !decide) : []),
|
|
166
|
+
];
|
|
167
|
+
const fetch = async (request) => {
|
|
168
|
+
const { pathname } = new URL(request.url);
|
|
169
|
+
for (const route of routes) {
|
|
170
|
+
if (route.method !== request.method)
|
|
171
|
+
continue;
|
|
172
|
+
const params = match(route.path, pathname);
|
|
173
|
+
if (params)
|
|
174
|
+
return route.handle(request, params);
|
|
175
|
+
}
|
|
176
|
+
return message(404, 'no such route');
|
|
177
|
+
};
|
|
178
|
+
return { forms, tables, definitions, open: !decide, allows, validation, routes, fetch };
|
|
179
|
+
}
|
package/dist/policy.d.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import type { DefinitionAction, DefinitionAuthorize } from '@20baht/definitions';
|
|
2
|
+
export type FormsAction = 'forms.submit';
|
|
3
|
+
export type TablesAction = 'tables.search';
|
|
4
|
+
export type DefinitionsAction = `definitions.${DefinitionAction}`;
|
|
5
|
+
export type PolicyAction = FormsAction | TablesAction | DefinitionsAction;
|
|
6
|
+
/** The names each library's `resource` may be, in one app. */
|
|
7
|
+
export interface PolicyResources {
|
|
8
|
+
forms: string;
|
|
9
|
+
tables: string;
|
|
10
|
+
definitions: string;
|
|
11
|
+
}
|
|
12
|
+
/** One member per action, so that testing `action` narrows `resource` either way. */
|
|
13
|
+
type Asked<Caller, Action, Resource> = Action extends unknown ? {
|
|
14
|
+
caller: Caller | null;
|
|
15
|
+
action: Action;
|
|
16
|
+
resource: Resource;
|
|
17
|
+
} : never;
|
|
18
|
+
/**
|
|
19
|
+
* What the policy is asked. `caller` is `null` for nobody; `resource` goes with the action: it is
|
|
20
|
+
* `null` for the definitions list (`read`) and `check` (`edit`), which are about no one definition.
|
|
21
|
+
*/
|
|
22
|
+
export type PolicyInput<Caller, Resources extends PolicyResources = PolicyResources> = Asked<Caller, FormsAction, Resources['forms']> | Asked<Caller, TablesAction, Resources['tables']> | Asked<Caller, 'definitions.read' | 'definitions.edit', Resources['definitions'] | null> | Asked<Caller, 'definitions.publish' | 'definitions.activate', Resources['definitions']>;
|
|
23
|
+
export type PolicyDecision = 'allow' | 'deny';
|
|
24
|
+
/**
|
|
25
|
+
* May this caller do this? Only `'allow'` does: no answer, any other value, a throw and a
|
|
26
|
+
* rejection deny.
|
|
27
|
+
*/
|
|
28
|
+
export type Policy<Caller, Resources extends PolicyResources = PolicyResources> = (input: PolicyInput<Caller, Resources>) => PolicyDecision | undefined | Promise<PolicyDecision | undefined>;
|
|
29
|
+
/** The least a caller is: `id` signs what they write (a definition's draft and versions). */
|
|
30
|
+
export interface PolicyCaller {
|
|
31
|
+
readonly id: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Who is asking, or `null` for nobody. Read the request's headers (or what your server keeps by
|
|
35
|
+
* the request), never its body. A throw or a rejection denies.
|
|
36
|
+
*/
|
|
37
|
+
export type ResolveCaller<Caller extends PolicyCaller> = (request: Request) => Caller | null | Promise<Caller | null>;
|
|
38
|
+
/** Who was allowed (`by` is `''` for nobody), or `null`: denied. */
|
|
39
|
+
export type Decide = (request: Request, action: PolicyAction, resource: string | null) => Promise<{
|
|
40
|
+
by: string;
|
|
41
|
+
} | null>;
|
|
42
|
+
/**
|
|
43
|
+
* The one place a request is decided. `names`, when given, are the only definitions there are to
|
|
44
|
+
* ask about.
|
|
45
|
+
*/
|
|
46
|
+
export declare function decider<Caller extends PolicyCaller>(resolve: ResolveCaller<Caller>, policy: Policy<Caller>, names: readonly string[] | undefined): Decide;
|
|
47
|
+
/** The definitions' own `authorize` port, asked of the policy. */
|
|
48
|
+
export declare const definitionsAuthorize: (decide: Decide) => DefinitionAuthorize;
|
|
49
|
+
export {};
|
package/dist/policy.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export function decider(resolve, policy, names) {
|
|
2
|
+
return async (request, action, resource) => {
|
|
3
|
+
const definitions = action.startsWith('definitions.');
|
|
4
|
+
if (definitions && names && resource !== null && !names.includes(resource))
|
|
5
|
+
return null;
|
|
6
|
+
try {
|
|
7
|
+
const caller = (await resolve(request)) ?? null;
|
|
8
|
+
const id = caller?.id;
|
|
9
|
+
const by = typeof id === 'string' ? id : '';
|
|
10
|
+
const input = { caller, action, resource };
|
|
11
|
+
if ((await policy(input)) !== 'allow')
|
|
12
|
+
return null;
|
|
13
|
+
return definitions && action !== 'definitions.read' && by === '' ? null : { by };
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
console.error(`[@20baht/app] ${action} denied: the caller or the policy threw`, error);
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export const definitionsAuthorize = (decide) => ({ request, action, name }) => decide(request, `definitions.${action}`, name);
|
package/package.json
CHANGED
|
@@ -1,6 +1,70 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@20baht/app",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"engines": {
|
|
6
|
+
"node": ">=20.19.0"
|
|
7
|
+
},
|
|
8
|
+
"description": "One typed definition of an app's server: a write route per form, a search route per table and the definitions routes, as a fetch handler any server runs, with a plain route map a client on any framework reads.",
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "Nattapong Promthong",
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/bank20baht/20baht.git",
|
|
14
|
+
"directory": "packages/core/app"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/bank20baht/20baht/tree/main/packages/core/app#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/bank20baht/20baht/issues"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"CHANGELOG.md"
|
|
23
|
+
],
|
|
24
|
+
"exports": {
|
|
25
|
+
".": {
|
|
26
|
+
"types": "./dist/index.d.ts",
|
|
27
|
+
"import": "./dist/index.js",
|
|
28
|
+
"default": "./dist/index.js"
|
|
29
|
+
},
|
|
30
|
+
"./browser": {
|
|
31
|
+
"types": "./dist/browser.d.ts",
|
|
32
|
+
"import": "./dist/browser.js",
|
|
33
|
+
"default": "./dist/browser.js"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "rm -rf dist && tsc -p tsconfig.json --removeComments && tsc -p tsconfig.json --emitDeclarationOnly",
|
|
39
|
+
"test": "vitest run",
|
|
40
|
+
"test:watch": "vitest",
|
|
41
|
+
"test:coverage": "vitest run --coverage"
|
|
42
|
+
},
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@20baht/definitions": ">=0.4.0 <0.5.0",
|
|
45
|
+
"@20baht/table-query": ">=0.4.3 <0.5.0",
|
|
46
|
+
"@20baht/validator": ">=0.5.0 <0.6.0"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@20baht/engine": ">=0.5.0 <0.6.0"
|
|
50
|
+
},
|
|
51
|
+
"devDependencies": {
|
|
52
|
+
"@20baht/engine": "workspace:*",
|
|
53
|
+
"typescript": "^5.9.3",
|
|
54
|
+
"vitest": "^3.2.4"
|
|
55
|
+
},
|
|
56
|
+
"main": "./dist/index.js",
|
|
57
|
+
"types": "./dist/index.d.ts",
|
|
58
|
+
"sideEffects": false,
|
|
59
|
+
"keywords": [
|
|
60
|
+
"bahtui",
|
|
61
|
+
"forms",
|
|
62
|
+
"tables",
|
|
63
|
+
"server",
|
|
64
|
+
"policy",
|
|
65
|
+
"typescript"
|
|
66
|
+
],
|
|
67
|
+
"publishConfig": {
|
|
68
|
+
"access": "public"
|
|
69
|
+
}
|
|
70
|
+
}
|