@databricks/appkit-ui 0.95.0 → 0.97.0
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/CLAUDE.md +16 -7
- package/dist/cli/commands/generate-types.js +36 -7
- package/dist/cli/commands/generate-types.js.map +1 -1
- package/dist/cli/commands/spawn-lock.js +18 -5
- package/dist/cli/commands/spawn-lock.js.map +1 -1
- package/dist/js/database/client.d.ts +2 -2
- package/dist/js/database/client.js +1 -1
- package/dist/js/database/client.js.map +1 -1
- package/dist/react/beta.d.ts +2 -2
- package/dist/react/beta.js +1 -2
- package/dist/react/hooks/use-database-list.d.ts +4 -4
- package/dist/react/hooks/use-database-list.d.ts.map +1 -1
- package/dist/react/hooks/use-database-list.js +1 -2
- package/dist/react/hooks/use-database-list.js.map +1 -1
- package/dist/react/hooks/use-database-read.d.ts +4 -41
- package/dist/react/hooks/use-database-read.d.ts.map +1 -1
- package/dist/react/hooks/use-database-read.js +7 -68
- package/dist/react/hooks/use-database-read.js.map +1 -1
- package/dist/react/hooks/use-database-record.d.ts +3 -3
- package/dist/react/hooks/use-database-record.d.ts.map +1 -1
- package/dist/react/hooks/use-database-record.js +2 -3
- package/dist/react/hooks/use-database-record.js.map +1 -1
- package/dist/react/hooks/use-database-write.d.ts +3 -3
- package/dist/react/hooks/use-database-write.js.map +1 -1
- package/dist/react/ui/button.d.ts +1 -1
- package/dist/shared/src/database/api-types.d.ts +1 -4
- package/dist/shared/src/database/api-types.d.ts.map +1 -1
- package/dist/shared/src/database/index.d.ts +3 -0
- package/dist/shared/src/database/operations.d.ts +11 -0
- package/dist/shared/src/database/operations.d.ts.map +1 -0
- package/dist/shared/src/index.d.ts +1 -0
- package/docs/api/appkit/Class.DatabaseValidationError.md +1 -1
- package/docs/api/appkit/Function.defineOperation.md +61 -0
- package/docs/api/appkit/Function.definePolicy.md +52 -0
- package/docs/api/appkit/Function.defineSchema.md +1 -1
- package/docs/api/appkit/Interface.Actor.md +21 -0
- package/docs/api/appkit/Interface.DatabaseOperationContract.md +30 -0
- package/docs/api/appkit/Interface.DatabaseRoutes.md +30 -0
- package/docs/api/appkit/Interface.OperationContext.md +75 -0
- package/docs/api/appkit/Interface.OperationDefinition.md +77 -0
- package/docs/api/appkit/Interface.PolicyContext.md +49 -0
- package/docs/api/appkit/Interface.PolicyDenial.md +21 -0
- package/docs/api/appkit/TypeAlias.DatabricksAppKitDatabaseOperations.md +8 -0
- package/docs/api/appkit/TypeAlias.IDatabaseConfig.md +0 -10
- package/docs/api/appkit/TypeAlias.OperationMethod.md +8 -0
- package/docs/api/appkit/TypeAlias.OperationWireInput.md +14 -0
- package/docs/api/appkit/TypeAlias.OperationWireOutput.md +14 -0
- package/docs/api/appkit/TypeAlias.Policy.md +15 -0
- package/docs/api/appkit/TypeAlias.PolicyDecision.md +8 -0
- package/docs/api/appkit.md +60 -51
- package/docs/development/type-generation.md +20 -1
- package/docs/plugins/database.md +17 -70
- package/llms.txt +16 -7
- package/package.json +1 -1
- package/sbom.cdx.json +1 -1
- package/docs/api/appkit/Interface.EntityMutationHooks.md +0 -173
- package/docs/api/appkit/Interface.HookApp.md +0 -12
- package/docs/api/appkit/Interface.HookContext.md +0 -21
- package/docs/api/appkit/Interface.ReadSerializerContext.md +0 -21
- package/docs/api/appkit/TypeAlias.EntityHooks.md +0 -25
- package/docs/api/appkit/TypeAlias.ReadSerializer.md +0 -19
|
@@ -1,173 +0,0 @@
|
|
|
1
|
-
# Interface: EntityMutationHooks\<TTable>
|
|
2
|
-
|
|
3
|
-
Mutation lifecycle for one entity. A before hook may return a replacement payload, which is revalidated against the trusted schema before it is persisted. Every hook, the mutation, and any write a hook issues through `ctx.app.database` share one transaction, so a rejection anywhere rolls all of them back. Throw `DatabaseValidationError` to answer a generated route with `422`; any other failure stays an opaque server error.
|
|
4
|
-
|
|
5
|
-
## Type Parameters[](#type-parameters "Direct link to Type Parameters")
|
|
6
|
-
|
|
7
|
-
| Type Parameter | Default type |
|
|
8
|
-
| --------------------------- | ------------ |
|
|
9
|
-
| `TTable` *extends* `string` | `string` |
|
|
10
|
-
|
|
11
|
-
## Methods[](#methods "Direct link to Methods")
|
|
12
|
-
|
|
13
|
-
### afterCreate()?[](#aftercreate "Direct link to afterCreate()?")
|
|
14
|
-
|
|
15
|
-
```ts
|
|
16
|
-
optional afterCreate(row: FacetOf<TTable, "row">, context: HookContext): MaybePromise<void>;
|
|
17
|
-
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
#### Parameters[](#parameters "Direct link to Parameters")
|
|
21
|
-
|
|
22
|
-
| Parameter | Type |
|
|
23
|
-
| --------- | ----------------------------------------------------------------- |
|
|
24
|
-
| `row` | `FacetOf`<`TTable`, `"row"`> |
|
|
25
|
-
| `context` | [`HookContext`](./docs/api/appkit/Interface.HookContext.md) |
|
|
26
|
-
|
|
27
|
-
#### Returns[](#returns "Direct link to Returns")
|
|
28
|
-
|
|
29
|
-
`MaybePromise`<`void`>
|
|
30
|
-
|
|
31
|
-
***
|
|
32
|
-
|
|
33
|
-
### afterDelete()?[](#afterdelete "Direct link to afterDelete()?")
|
|
34
|
-
|
|
35
|
-
```ts
|
|
36
|
-
optional afterDelete(id: IdValue, context: HookContext): MaybePromise<void>;
|
|
37
|
-
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
#### Parameters[](#parameters-1 "Direct link to Parameters")
|
|
41
|
-
|
|
42
|
-
| Parameter | Type |
|
|
43
|
-
| --------- | ----------------------------------------------------------------- |
|
|
44
|
-
| `id` | `IdValue` |
|
|
45
|
-
| `context` | [`HookContext`](./docs/api/appkit/Interface.HookContext.md) |
|
|
46
|
-
|
|
47
|
-
#### Returns[](#returns-1 "Direct link to Returns")
|
|
48
|
-
|
|
49
|
-
`MaybePromise`<`void`>
|
|
50
|
-
|
|
51
|
-
***
|
|
52
|
-
|
|
53
|
-
### afterUpdate()?[](#afterupdate "Direct link to afterUpdate()?")
|
|
54
|
-
|
|
55
|
-
```ts
|
|
56
|
-
optional afterUpdate(row: FacetOf<TTable, "row">, context: HookContext): MaybePromise<void>;
|
|
57
|
-
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
#### Parameters[](#parameters-2 "Direct link to Parameters")
|
|
61
|
-
|
|
62
|
-
| Parameter | Type |
|
|
63
|
-
| --------- | ----------------------------------------------------------------- |
|
|
64
|
-
| `row` | `FacetOf`<`TTable`, `"row"`> |
|
|
65
|
-
| `context` | [`HookContext`](./docs/api/appkit/Interface.HookContext.md) |
|
|
66
|
-
|
|
67
|
-
#### Returns[](#returns-2 "Direct link to Returns")
|
|
68
|
-
|
|
69
|
-
`MaybePromise`<`void`>
|
|
70
|
-
|
|
71
|
-
***
|
|
72
|
-
|
|
73
|
-
### afterUpsert()?[](#afterupsert "Direct link to afterUpsert()?")
|
|
74
|
-
|
|
75
|
-
```ts
|
|
76
|
-
optional afterUpsert(row: FacetOf<TTable, "row">, context: HookContext): MaybePromise<void>;
|
|
77
|
-
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
#### Parameters[](#parameters-3 "Direct link to Parameters")
|
|
81
|
-
|
|
82
|
-
| Parameter | Type |
|
|
83
|
-
| --------- | ----------------------------------------------------------------- |
|
|
84
|
-
| `row` | `FacetOf`<`TTable`, `"row"`> |
|
|
85
|
-
| `context` | [`HookContext`](./docs/api/appkit/Interface.HookContext.md) |
|
|
86
|
-
|
|
87
|
-
#### Returns[](#returns-3 "Direct link to Returns")
|
|
88
|
-
|
|
89
|
-
`MaybePromise`<`void`>
|
|
90
|
-
|
|
91
|
-
***
|
|
92
|
-
|
|
93
|
-
### beforeCreate()?[](#beforecreate "Direct link to beforeCreate()?")
|
|
94
|
-
|
|
95
|
-
```ts
|
|
96
|
-
optional beforeCreate(values: FacetOf<TTable, "insert">, context: HookContext): MaybePromise<void | FacetOf<TTable, "insert">>;
|
|
97
|
-
|
|
98
|
-
```
|
|
99
|
-
|
|
100
|
-
#### Parameters[](#parameters-4 "Direct link to Parameters")
|
|
101
|
-
|
|
102
|
-
| Parameter | Type |
|
|
103
|
-
| --------- | ----------------------------------------------------------------- |
|
|
104
|
-
| `values` | `FacetOf`<`TTable`, `"insert"`> |
|
|
105
|
-
| `context` | [`HookContext`](./docs/api/appkit/Interface.HookContext.md) |
|
|
106
|
-
|
|
107
|
-
#### Returns[](#returns-4 "Direct link to Returns")
|
|
108
|
-
|
|
109
|
-
`MaybePromise`<`void` | `FacetOf`<`TTable`, `"insert"`>>
|
|
110
|
-
|
|
111
|
-
***
|
|
112
|
-
|
|
113
|
-
### beforeDelete()?[](#beforedelete "Direct link to beforeDelete()?")
|
|
114
|
-
|
|
115
|
-
```ts
|
|
116
|
-
optional beforeDelete(id: IdValue, context: HookContext): MaybePromise<void>;
|
|
117
|
-
|
|
118
|
-
```
|
|
119
|
-
|
|
120
|
-
#### Parameters[](#parameters-5 "Direct link to Parameters")
|
|
121
|
-
|
|
122
|
-
| Parameter | Type |
|
|
123
|
-
| --------- | ----------------------------------------------------------------- |
|
|
124
|
-
| `id` | `IdValue` |
|
|
125
|
-
| `context` | [`HookContext`](./docs/api/appkit/Interface.HookContext.md) |
|
|
126
|
-
|
|
127
|
-
#### Returns[](#returns-5 "Direct link to Returns")
|
|
128
|
-
|
|
129
|
-
`MaybePromise`<`void`>
|
|
130
|
-
|
|
131
|
-
***
|
|
132
|
-
|
|
133
|
-
### beforeUpdate()?[](#beforeupdate "Direct link to beforeUpdate()?")
|
|
134
|
-
|
|
135
|
-
```ts
|
|
136
|
-
optional beforeUpdate(
|
|
137
|
-
id: IdValue,
|
|
138
|
-
values: FacetOf<TTable, "update">,
|
|
139
|
-
context: HookContext): MaybePromise<void | FacetOf<TTable, "update">>;
|
|
140
|
-
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
#### Parameters[](#parameters-6 "Direct link to Parameters")
|
|
144
|
-
|
|
145
|
-
| Parameter | Type |
|
|
146
|
-
| --------- | ----------------------------------------------------------------- |
|
|
147
|
-
| `id` | `IdValue` |
|
|
148
|
-
| `values` | `FacetOf`<`TTable`, `"update"`> |
|
|
149
|
-
| `context` | [`HookContext`](./docs/api/appkit/Interface.HookContext.md) |
|
|
150
|
-
|
|
151
|
-
#### Returns[](#returns-6 "Direct link to Returns")
|
|
152
|
-
|
|
153
|
-
`MaybePromise`<`void` | `FacetOf`<`TTable`, `"update"`>>
|
|
154
|
-
|
|
155
|
-
***
|
|
156
|
-
|
|
157
|
-
### beforeUpsert()?[](#beforeupsert "Direct link to beforeUpsert()?")
|
|
158
|
-
|
|
159
|
-
```ts
|
|
160
|
-
optional beforeUpsert(values: FacetOf<TTable, "insert">, context: HookContext): MaybePromise<void | FacetOf<TTable, "insert">>;
|
|
161
|
-
|
|
162
|
-
```
|
|
163
|
-
|
|
164
|
-
#### Parameters[](#parameters-7 "Direct link to Parameters")
|
|
165
|
-
|
|
166
|
-
| Parameter | Type |
|
|
167
|
-
| --------- | ----------------------------------------------------------------- |
|
|
168
|
-
| `values` | `FacetOf`<`TTable`, `"insert"`> |
|
|
169
|
-
| `context` | [`HookContext`](./docs/api/appkit/Interface.HookContext.md) |
|
|
170
|
-
|
|
171
|
-
#### Returns[](#returns-7 "Direct link to Returns")
|
|
172
|
-
|
|
173
|
-
`MaybePromise`<`void` | `FacetOf`<`TTable`, `"insert"`>>
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
# Interface: HookApp
|
|
2
|
-
|
|
3
|
-
The only capability a hook receives: entities bound to its transaction.
|
|
4
|
-
|
|
5
|
-
## Properties[](#properties "Direct link to Properties")
|
|
6
|
-
|
|
7
|
-
### database[](#database "Direct link to database")
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
readonly database: TransactionClient;
|
|
11
|
-
|
|
12
|
-
```
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Interface: HookContext
|
|
2
|
-
|
|
3
|
-
Which entity is being mutated, and the surface a hook may write through.
|
|
4
|
-
|
|
5
|
-
## Properties[](#properties "Direct link to Properties")
|
|
6
|
-
|
|
7
|
-
### app[](#app "Direct link to app")
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
readonly app: HookApp;
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
***
|
|
15
|
-
|
|
16
|
-
### entity[](#entity "Direct link to entity")
|
|
17
|
-
|
|
18
|
-
```ts
|
|
19
|
-
readonly entity: string;
|
|
20
|
-
|
|
21
|
-
```
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
# Interface: ReadSerializerContext
|
|
2
|
-
|
|
3
|
-
Which entity and generated operation produced the row being shaped.
|
|
4
|
-
|
|
5
|
-
## Properties[](#properties "Direct link to Properties")
|
|
6
|
-
|
|
7
|
-
### entity[](#entity "Direct link to entity")
|
|
8
|
-
|
|
9
|
-
```ts
|
|
10
|
-
readonly entity: string;
|
|
11
|
-
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
***
|
|
15
|
-
|
|
16
|
-
### operation[](#operation "Direct link to operation")
|
|
17
|
-
|
|
18
|
-
```ts
|
|
19
|
-
readonly operation: "detail" | "list";
|
|
20
|
-
|
|
21
|
-
```
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
# Type Alias: EntityHooks\<TTable>
|
|
2
|
-
|
|
3
|
-
```ts
|
|
4
|
-
type EntityHooks<TTable> = EntityMutationHooks<TTable> & {
|
|
5
|
-
serialize?: ReadSerializer;
|
|
6
|
-
};
|
|
7
|
-
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
Response shaping and mutation lifecycle declared for one table.
|
|
11
|
-
|
|
12
|
-
## Type Declaration[](#type-declaration "Direct link to Type Declaration")
|
|
13
|
-
|
|
14
|
-
### serialize?[](#serialize "Direct link to serialize?")
|
|
15
|
-
|
|
16
|
-
```ts
|
|
17
|
-
readonly optional serialize: ReadSerializer;
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
## Type Parameters[](#type-parameters "Direct link to Type Parameters")
|
|
22
|
-
|
|
23
|
-
| Type Parameter | Default type |
|
|
24
|
-
| --------------------------- | ------------ |
|
|
25
|
-
| `TTable` *extends* `string` | `string` |
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Type Alias: ReadSerializer()
|
|
2
|
-
|
|
3
|
-
```ts
|
|
4
|
-
type ReadSerializer = (row: Record<string, unknown>, context: ReadSerializerContext) => Record<string, unknown>;
|
|
5
|
-
|
|
6
|
-
```
|
|
7
|
-
|
|
8
|
-
Shape one already private-safe row before it reaches the wire. A `Promise` is not assignable to the return type, so an async callback fails to compile: serializers run inside the response path and must not add latency there.
|
|
9
|
-
|
|
10
|
-
## Parameters[](#parameters "Direct link to Parameters")
|
|
11
|
-
|
|
12
|
-
| Parameter | Type |
|
|
13
|
-
| --------- | ------------------------------------------------------------------------------------- |
|
|
14
|
-
| `row` | `Record`<`string`, `unknown`> |
|
|
15
|
-
| `context` | [`ReadSerializerContext`](./docs/api/appkit/Interface.ReadSerializerContext.md) |
|
|
16
|
-
|
|
17
|
-
## Returns[](#returns "Direct link to Returns")
|
|
18
|
-
|
|
19
|
-
`Record`<`string`, `unknown`>
|