@databricks/appkit 0.72.0 → 0.74.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.
Files changed (156) hide show
  1. package/CLAUDE.md +24 -0
  2. package/NOTICE.md +1 -0
  3. package/dist/appkit/package.js +1 -1
  4. package/dist/beta.d.ts +11 -8
  5. package/dist/beta.js +7 -6
  6. package/dist/cli/commands/agent/eval.js +85 -16
  7. package/dist/cli/commands/agent/eval.js.map +1 -1
  8. package/dist/connectors/index.js +1 -1
  9. package/dist/connectors/mlflow/auth.d.ts +11 -1
  10. package/dist/connectors/mlflow/auth.d.ts.map +1 -1
  11. package/dist/connectors/mlflow/auth.js +22 -2
  12. package/dist/connectors/mlflow/auth.js.map +1 -1
  13. package/dist/connectors/mlflow/index.d.ts +2 -0
  14. package/dist/database/errors.js +15 -5
  15. package/dist/database/errors.js.map +1 -1
  16. package/dist/database/runtime/data-path.d.ts +7 -0
  17. package/dist/database/runtime/data-path.d.ts.map +1 -0
  18. package/dist/database/runtime/data-path.js.map +1 -1
  19. package/dist/database/runtime/engine/drizzle-data-path.js +7 -5
  20. package/dist/database/runtime/engine/drizzle-data-path.js.map +1 -1
  21. package/dist/database/schema-builder/define-schema.d.ts +1 -1
  22. package/dist/database/schema-builder/define-schema.js +1 -1
  23. package/dist/database/schema-builder/define-schema.js.map +1 -1
  24. package/dist/errors/database-validation.d.ts +23 -0
  25. package/dist/errors/database-validation.d.ts.map +1 -0
  26. package/dist/errors/database-validation.js +24 -0
  27. package/dist/errors/database-validation.js.map +1 -0
  28. package/dist/errors/index.js +1 -0
  29. package/dist/evals/dataset.d.ts +49 -0
  30. package/dist/evals/dataset.d.ts.map +1 -0
  31. package/dist/evals/dataset.js +51 -0
  32. package/dist/evals/dataset.js.map +1 -0
  33. package/dist/evals/define-eval.d.ts +4 -2
  34. package/dist/evals/define-eval.d.ts.map +1 -1
  35. package/dist/evals/define-eval.js +5 -1
  36. package/dist/evals/define-eval.js.map +1 -1
  37. package/dist/evals/discover.d.ts +15 -1
  38. package/dist/evals/discover.d.ts.map +1 -1
  39. package/dist/evals/discover.js +26 -2
  40. package/dist/evals/discover.js.map +1 -1
  41. package/dist/evals/http-driver.d.ts.map +1 -1
  42. package/dist/evals/http-driver.js +82 -55
  43. package/dist/evals/http-driver.js.map +1 -1
  44. package/dist/evals/index.d.ts +14 -0
  45. package/dist/evals/index.js +6 -5
  46. package/dist/evals/judge.d.ts +1 -0
  47. package/dist/evals/judge.d.ts.map +1 -1
  48. package/dist/evals/mlflow-report.d.ts +1 -0
  49. package/dist/evals/mlflow-report.d.ts.map +1 -1
  50. package/dist/evals/mlflow-run.d.ts +2 -0
  51. package/dist/evals/mlflow-run.d.ts.map +1 -1
  52. package/dist/evals/report.d.ts +16 -1
  53. package/dist/evals/report.d.ts.map +1 -1
  54. package/dist/evals/report.js +64 -2
  55. package/dist/evals/report.js.map +1 -1
  56. package/dist/evals/run-eval.d.ts +8 -0
  57. package/dist/evals/run-eval.d.ts.map +1 -1
  58. package/dist/evals/run-eval.js +54 -5
  59. package/dist/evals/run-eval.js.map +1 -1
  60. package/dist/evals/run-evals.d.ts +41 -3
  61. package/dist/evals/run-evals.d.ts.map +1 -1
  62. package/dist/evals/run-evals.js +215 -34
  63. package/dist/evals/run-evals.js.map +1 -1
  64. package/dist/evals/types.d.ts +80 -6
  65. package/dist/evals/types.d.ts.map +1 -1
  66. package/dist/index.d.ts +2 -1
  67. package/dist/index.js +2 -1
  68. package/dist/plugin/plugin.d.ts.map +1 -1
  69. package/dist/plugin/plugin.js +1 -1
  70. package/dist/plugin/plugin.js.map +1 -1
  71. package/dist/plugins/database/crud/contract.js +17 -8
  72. package/dist/plugins/database/crud/contract.js.map +1 -1
  73. package/dist/plugins/database/crud/exposure.js +63 -22
  74. package/dist/plugins/database/crud/exposure.js.map +1 -1
  75. package/dist/plugins/database/crud/request.js +50 -0
  76. package/dist/plugins/database/crud/request.js.map +1 -0
  77. package/dist/plugins/database/crud/response.js +77 -0
  78. package/dist/plugins/database/crud/response.js.map +1 -0
  79. package/dist/plugins/database/crud/routes.js +71 -52
  80. package/dist/plugins/database/crud/routes.js.map +1 -1
  81. package/dist/plugins/database/database.d.ts +6 -4
  82. package/dist/plugins/database/database.d.ts.map +1 -1
  83. package/dist/plugins/database/database.js +46 -16
  84. package/dist/plugins/database/database.js.map +1 -1
  85. package/dist/plugins/database/defaults.js +5 -1
  86. package/dist/plugins/database/defaults.js.map +1 -1
  87. package/dist/plugins/database/entity-client.js +143 -10
  88. package/dist/plugins/database/entity-client.js.map +1 -1
  89. package/dist/plugins/database/entity-types.d.ts +1 -1
  90. package/dist/plugins/database/hooks.d.ts +38 -0
  91. package/dist/plugins/database/hooks.d.ts.map +1 -0
  92. package/dist/plugins/database/index.d.ts +3 -2
  93. package/dist/plugins/database/lifecycle.js +67 -28
  94. package/dist/plugins/database/lifecycle.js.map +1 -1
  95. package/dist/plugins/database/scope.js +58 -0
  96. package/dist/plugins/database/scope.js.map +1 -0
  97. package/dist/plugins/database/types.d.ts +40 -12
  98. package/dist/plugins/database/types.d.ts.map +1 -1
  99. package/dist/plugins/server/index.js +2 -2
  100. package/dist/plugins/server/index.js.map +1 -1
  101. package/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js +3 -3
  102. package/dist/plugins/server/remote-tunnel/remote-tunnel-manager.js.map +1 -1
  103. package/dist/plugins/server/static-server.js +3 -3
  104. package/dist/plugins/server/static-server.js.map +1 -1
  105. package/dist/plugins/server/utils.js +3 -3
  106. package/dist/plugins/server/utils.js.map +1 -1
  107. package/dist/plugins/server/vite-dev-server.js +4 -4
  108. package/dist/plugins/server/vite-dev-server.js.map +1 -1
  109. package/dist/shared/src/schemas/manifest.d.ts +87 -87
  110. package/dist/type-generator/database/generate.js +3 -3
  111. package/dist/type-generator/database/generate.js.map +1 -1
  112. package/dist/type-generator/migration.js +2 -2
  113. package/dist/type-generator/migration.js.map +1 -1
  114. package/dist/type-generator/serving/server-file-extractor.js +3 -3
  115. package/dist/type-generator/serving/server-file-extractor.js.map +1 -1
  116. package/docs/api/appkit/Class.AppKitError.md +1 -0
  117. package/docs/api/appkit/Class.DatabaseValidationError.md +191 -0
  118. package/docs/api/appkit/Function.defineEvalConfig.md +18 -0
  119. package/docs/api/appkit/Function.defineSchema.md +1 -1
  120. package/docs/api/appkit/Function.discoverEvalConfigs.md +18 -0
  121. package/docs/api/appkit/Function.formatResultsJUnit.md +18 -0
  122. package/docs/api/appkit/Function.formatResultsJson.md +18 -0
  123. package/docs/api/appkit/Function.readEvalDataset.md +21 -0
  124. package/docs/api/appkit/Function.resolveWorkspaceClient.md +18 -0
  125. package/docs/api/appkit/Function.runWithRetries.md +28 -0
  126. package/docs/api/appkit/Function.userTurns.md +20 -0
  127. package/docs/api/appkit/Interface.AssertionHandle.md +1 -1
  128. package/docs/api/appkit/Interface.DatabaseValidationIssue.md +21 -0
  129. package/docs/api/appkit/Interface.DatasetRow.md +21 -0
  130. package/docs/api/appkit/Interface.DiscoveredEvalConfig.md +25 -0
  131. package/docs/api/appkit/Interface.DriveResult.md +28 -0
  132. package/docs/api/appkit/Interface.EntityMutationHooks.md +173 -0
  133. package/docs/api/appkit/Interface.EvalDefinition.md +50 -0
  134. package/docs/api/appkit/Interface.EvalDriver.md +26 -5
  135. package/docs/api/appkit/Interface.EvalResult.md +11 -0
  136. package/docs/api/appkit/Interface.EvalSummary.md +11 -0
  137. package/docs/api/appkit/Interface.HookApp.md +12 -0
  138. package/docs/api/appkit/Interface.HookContext.md +21 -0
  139. package/docs/api/appkit/Interface.ReadEvalDatasetOptions.md +34 -0
  140. package/docs/api/appkit/Interface.ReadSerializerContext.md +21 -0
  141. package/docs/api/appkit/Interface.RunEvalOptions.md +22 -0
  142. package/docs/api/appkit/Interface.RunEvalsOptions.md +45 -1
  143. package/docs/api/appkit/Interface.TestContext.md +67 -8
  144. package/docs/api/appkit/TypeAlias.DatabaseApiConfig.md +53 -0
  145. package/docs/api/appkit/TypeAlias.DatabaseApiWriteOperation.md +8 -0
  146. package/docs/api/appkit/TypeAlias.DatabaseApiWritesConfig.md +49 -0
  147. package/docs/api/appkit/TypeAlias.DatabaseExports.md +3 -3
  148. package/docs/api/appkit/TypeAlias.EntityHooks.md +25 -0
  149. package/docs/api/appkit/TypeAlias.IDatabaseConfig.md +16 -5
  150. package/docs/api/appkit/TypeAlias.ReadSerializer.md +19 -0
  151. package/docs/api/appkit/TypeAlias.TransactionClient.md +19 -0
  152. package/docs/api/appkit.md +142 -119
  153. package/docs/plugins/database.md +144 -0
  154. package/llms.txt +24 -0
  155. package/package.json +2 -2
  156. package/sbom.cdx.json +1 -1
@@ -0,0 +1,53 @@
1
+ # Type Alias: DatabaseApiConfig\<TSchema>
2
+
3
+ ```ts
4
+ type DatabaseApiConfig<TSchema> =
5
+ | boolean
6
+ | {
7
+ tables?: readonly SchemaTableName<TSchema>[];
8
+ writes?: DatabaseApiWritesConfig<TSchema>;
9
+ };
10
+
11
+ ```
12
+
13
+ Full generated CRUD for every declared table by default. Set false to disable all generated routes, or use an object to restrict tables and writes. Keyed routes require a public primary key; upsert stays programmatic. Route names must start with a letter, contain only letters, digits, `_`, or `-`, be at most 64 characters, and be unique ignoring case. Invalid names fail setup; exclude internal tables with `api.tables` or use `api: false`.
14
+
15
+ Routes run as the app's service principal and apply no per-user filter, so anyone the app admits receives every enabled operation. An exposed table also becomes includable from its neighbours; a relation whose target stays off cannot be included.
16
+
17
+ Text filters accept caller-supplied `like`/`ilike` patterns; a server-side `statement_timeout` cancels a pattern that would otherwise hold its pooled connection to completion.
18
+
19
+ ## Type Parameters[​](#type-parameters "Direct link to Type Parameters")
20
+
21
+ | Type Parameter |
22
+ | --------------------------------------------------------------------------- |
23
+ | `TSchema` *extends* [`Schema`](./docs/api/appkit/Interface.Schema.md) |
24
+
25
+ ## Type Declaration[​](#type-declaration "Direct link to Type Declaration")
26
+
27
+ `boolean`
28
+
29
+ ```ts
30
+ {
31
+ tables?: readonly SchemaTableName<TSchema>[];
32
+ writes?: DatabaseApiWritesConfig<TSchema>;
33
+ }
34
+
35
+ ```
36
+
37
+ ### tables?[​](#tables "Direct link to tables?")
38
+
39
+ ```ts
40
+ readonly optional tables: readonly SchemaTableName<TSchema>[];
41
+
42
+ ```
43
+
44
+ Tables that remain exposed. Defaults to every declared table.
45
+
46
+ ### writes?[​](#writes "Direct link to writes?")
47
+
48
+ ```ts
49
+ readonly optional writes: DatabaseApiWritesConfig<TSchema>;
50
+
51
+ ```
52
+
53
+ All writes by default. Set false for read-only routes.
@@ -0,0 +1,8 @@
1
+ # Type Alias: DatabaseApiWriteOperation
2
+
3
+ ```ts
4
+ type DatabaseApiWriteOperation = "create" | "update" | "delete";
5
+
6
+ ```
7
+
8
+ Generated HTTP write operations.
@@ -0,0 +1,49 @@
1
+ # Type Alias: DatabaseApiWritesConfig\<TSchema>
2
+
3
+ ```ts
4
+ type DatabaseApiWritesConfig<TSchema> =
5
+ | boolean
6
+ | {
7
+ operations?: readonly DatabaseApiWriteOperation[];
8
+ tables?: readonly SchemaTableName<TSchema>[];
9
+ };
10
+
11
+ ```
12
+
13
+ All writes by default; false keeps reads only, and an object narrows writes.
14
+
15
+ ## Type Parameters[​](#type-parameters "Direct link to Type Parameters")
16
+
17
+ | Type Parameter |
18
+ | --------------------------------------------------------------------------- |
19
+ | `TSchema` *extends* [`Schema`](./docs/api/appkit/Interface.Schema.md) |
20
+
21
+ ## Type Declaration[​](#type-declaration "Direct link to Type Declaration")
22
+
23
+ `boolean`
24
+
25
+ ```ts
26
+ {
27
+ operations?: readonly DatabaseApiWriteOperation[];
28
+ tables?: readonly SchemaTableName<TSchema>[];
29
+ }
30
+
31
+ ```
32
+
33
+ ### operations?[​](#operations "Direct link to operations?")
34
+
35
+ ```ts
36
+ readonly optional operations: readonly DatabaseApiWriteOperation[];
37
+
38
+ ```
39
+
40
+ Operations that remain enabled. Defaults to create, update, and delete.
41
+
42
+ ### tables?[​](#tables "Direct link to tables?")
43
+
44
+ ```ts
45
+ readonly optional tables: readonly SchemaTableName<TSchema>[];
46
+
47
+ ```
48
+
49
+ Tables that remain writable. Defaults to every exposed table.
@@ -26,9 +26,9 @@ transaction<T>(callback: (tx: TransactionClient) => Promise<T>): Promise<T>;
26
26
 
27
27
  #### Parameters[​](#parameters "Direct link to Parameters")
28
28
 
29
- | Parameter | Type |
30
- | ---------- | --------------------------------------------- |
31
- | `callback` | (`tx`: `TransactionClient`) => `Promise`<`T`> |
29
+ | Parameter | Type |
30
+ | ---------- | ------------------------------------------------------------------------------------------------------- |
31
+ | `callback` | (`tx`: [`TransactionClient`](./docs/api/appkit/TypeAlias.TransactionClient.md)) => `Promise`<`T`> |
32
32
 
33
33
  #### Returns[​](#returns "Direct link to Returns")
34
34
 
@@ -0,0 +1,25 @@
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` |
@@ -2,8 +2,8 @@
2
2
 
3
3
  ```ts
4
4
  type IDatabaseConfig<TSchema> = {
5
- crudRoutes?: CrudRoutesConfig<TSchema>;
6
- hooks?: { readonly [TTable in SchemaTableName<TSchema>]?: { serialize?: ReadSerializer } };
5
+ api?: DatabaseApiConfig<TSchema>;
6
+ hooks?: { readonly [TTable in SchemaTableName<TSchema>]?: EntityHooks<TTable> };
7
7
  schema: TSchema;
8
8
  };
9
9
 
@@ -19,10 +19,21 @@ Configuration for one schema-bound DatabasePlugin instance.
19
19
 
20
20
  ## Properties[​](#properties "Direct link to Properties")
21
21
 
22
- ### crudRoutes?[​](#crudroutes "Direct link to crudRoutes?")
22
+ ### api?[​](#api "Direct link to api?")
23
23
 
24
24
  ```ts
25
- readonly optional crudRoutes: CrudRoutesConfig<TSchema>;
25
+ readonly optional api: DatabaseApiConfig<TSchema>;
26
+
27
+ ```
28
+
29
+ Generated HTTP CRUD is enabled for all tables by default, using the app's service principal. Every admitted caller receives the enabled operations; no per-user or per-row authorization is applied. This plugin does not support OBO. Use custom routes for application-specific authorization.
30
+
31
+ Set `false` to disable routes, `{ writes: false }` for reads only, or `{ tables: ["notes"] }` to expose only selected tables. To disable delete, use `{ writes: { operations: ["create", "update"] } }`.
32
+
33
+ #### Default Value[​](#default-value "Direct link to Default Value")
34
+
35
+ ```ts
36
+ true
26
37
 
27
38
  ```
28
39
 
@@ -31,7 +42,7 @@ readonly optional crudRoutes: CrudRoutesConfig<TSchema>;
31
42
  ### hooks?[​](#hooks "Direct link to hooks?")
32
43
 
33
44
  ```ts
34
- readonly optional hooks: { readonly [TTable in SchemaTableName<TSchema>]?: { serialize?: ReadSerializer } };
45
+ readonly optional hooks: { readonly [TTable in SchemaTableName<TSchema>]?: EntityHooks<TTable> };
35
46
 
36
47
  ```
37
48
 
@@ -0,0 +1,19 @@
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`>
@@ -0,0 +1,19 @@
1
+ # Type Alias: TransactionClient
2
+
3
+ ```ts
4
+ type TransactionClient = { readonly [K in EntityName]: TypedEntityClient<K> } & {
5
+ sql: SqlTag;
6
+ };
7
+
8
+ ```
9
+
10
+ Entity and SQL capabilities bound to one transaction.
11
+
12
+ ## Type Declaration[​](#type-declaration "Direct link to Type Declaration")
13
+
14
+ ### sql[​](#sql "Direct link to sql")
15
+
16
+ ```ts
17
+ readonly sql: SqlTag;
18
+
19
+ ```