@tailorkit/app 0.1.0-beta.29 → 0.1.0-beta.32

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 (53) hide show
  1. package/LICENSE.md +47 -174
  2. package/README.md +37 -38
  3. package/dist/chunk-7ZQPXG7O.js +34 -0
  4. package/dist/chunk-PJBDA2RU.js +415 -0
  5. package/dist/{chunk-STTKSRAI.js → chunk-UDXPIO6D.js} +267 -112
  6. package/dist/{chunk-ANTVMHDZ.js → chunk-YX3JURMG.js} +100 -59
  7. package/dist/client/connection.d.ts +11 -11
  8. package/dist/client/query-store.d.ts +2 -2
  9. package/dist/client/reference.d.ts +4 -4
  10. package/dist/client/session.d.ts +27 -4
  11. package/dist/client/tools.d.ts +11 -5
  12. package/dist/client-connection.js +4 -2
  13. package/dist/client.d.ts +2 -2
  14. package/dist/client.js +3 -3
  15. package/dist/database/definition.d.ts +1 -1
  16. package/dist/database/schema.d.ts +1 -1
  17. package/dist/errors.d.ts +1 -1
  18. package/dist/index.js +6 -6
  19. package/dist/preact.d.ts +5 -5
  20. package/dist/protocol.d.ts +23 -23
  21. package/dist/protocol.js +11 -9
  22. package/dist/routing.d.ts +4 -4
  23. package/dist/server/builder.d.ts +6 -6
  24. package/dist/server/bundle.d.ts +1 -6
  25. package/dist/server/functions.d.ts +19 -19
  26. package/dist/server/instances.d.ts +5 -4
  27. package/dist/server.d.ts +1 -1
  28. package/dist/server.js +4 -4
  29. package/dist/views.d.ts +4 -3
  30. package/package.json +34 -22
  31. package/dist/builder/client-views.d.ts +0 -16
  32. package/dist/builder/database-paths.d.ts +0 -4
  33. package/dist/builder/define-view.d.ts +0 -3
  34. package/dist/builder/drizzle.d.ts +0 -2
  35. package/dist/builder/file-routes.d.ts +0 -34
  36. package/dist/builder/generate-migrations.d.ts +0 -6
  37. package/dist/builder/index.d.ts +0 -11
  38. package/dist/builder/instances.d.ts +0 -19
  39. package/dist/builder/migrations.d.ts +0 -6
  40. package/dist/builder/schema-check.d.ts +0 -2
  41. package/dist/builder/server.d.ts +0 -6
  42. package/dist/builder/upload-manifest.d.ts +0 -20
  43. package/dist/builder.js +0 -1531
  44. package/dist/chunk-DA2TE2FW.js +0 -27
  45. package/dist/chunk-IJBQ77AH.js +0 -35
  46. package/dist/chunk-L5ECQGR7.js +0 -26
  47. package/dist/chunk-SWBQZDWT.js +0 -321
  48. package/dist/config/config.d.ts +0 -86
  49. package/dist/config/index.d.ts +0 -1
  50. package/dist/config/loader.d.ts +0 -7
  51. package/dist/config-loader.js +0 -7
  52. package/dist/config.js +0 -8
  53. package/dist/preact-version.d.ts +0 -7
@@ -1,34 +1,26 @@
1
1
  import {
2
2
  AppError
3
- } from "./chunk-IJBQ77AH.js";
3
+ } from "./chunk-7ZQPXG7O.js";
4
4
 
5
5
  // src/server/functions.ts
6
- function query(definition) {
7
- return Object.freeze({ ...definition, kind: "query" });
8
- }
9
- function mutation(definition) {
10
- return Object.freeze({ ...definition, kind: "mutation" });
11
- }
12
- function action(definition) {
13
- return Object.freeze({ ...definition, kind: "action" });
14
- }
15
- function isFunction(value) {
16
- return typeof value.kind === "string" && typeof value.handler === "function";
17
- }
18
- function defineServer(functions) {
6
+ var query = (definition) => Object.freeze({ ...definition, kind: "query" });
7
+ var mutation = (definition) => Object.freeze({ ...definition, kind: "mutation" });
8
+ var action = (definition) => Object.freeze({ ...definition, kind: "action" });
9
+ var isFunction = (value) => typeof value.kind === "string" && typeof value.handler === "function";
10
+ var defineServer = (functions) => {
19
11
  for (const [name, value] of Object.entries(functions)) {
20
12
  if (!/^[a-zA-Z][a-zA-Z0-9_]{0,63}$/u.test(name)) {
21
13
  throw new Error("Invalid function name");
22
14
  }
23
- if (!isFunction(value)) defineServer(value);
15
+ if (!isFunction(value)) {
16
+ defineServer(value);
17
+ }
24
18
  }
25
19
  return Object.freeze({ functions });
26
- }
20
+ };
27
21
 
28
22
  // src/database/definition.ts
29
- function defineDatabase(definition) {
30
- return Object.freeze({ relations: definition.relations });
31
- }
23
+ var defineDatabase = (definition) => Object.freeze({ relations: definition.relations });
32
24
 
33
25
  // src/server/builder.ts
34
26
  import { z } from "zod";
@@ -46,10 +38,22 @@ var FunctionBuilder = class _FunctionBuilder {
46
38
  this.databaseDefinition = database;
47
39
  }
48
40
  input(schema) {
49
- return new _FunctionBuilder(this.kind, schema, this.result, this.calls, this.databaseDefinition);
41
+ return new _FunctionBuilder(
42
+ this.kind,
43
+ schema,
44
+ this.result,
45
+ this.calls,
46
+ this.databaseDefinition
47
+ );
50
48
  }
51
49
  output(schema) {
52
- return new _FunctionBuilder(this.kind, this.args, schema, this.calls, this.databaseDefinition);
50
+ return new _FunctionBuilder(
51
+ this.kind,
52
+ this.args,
53
+ schema,
54
+ this.calls,
55
+ this.databaseDefinition
56
+ );
53
57
  }
54
58
  functions(functions) {
55
59
  return new _FunctionBuilder(
@@ -70,43 +74,67 @@ var FunctionBuilder = class _FunctionBuilder {
70
74
  );
71
75
  }
72
76
  handler(handler) {
73
- return Object.freeze({
74
- kind: this.kind,
75
- args: this.args,
76
- ...this.databaseDefinition ? { database: this.databaseDefinition } : {},
77
- ...this.result ? { result: this.result } : {},
78
- ...this.kind === "action" ? { functions: this.calls } : {},
79
- handler: (context) => handler({ ...context, input: context.args })
80
- });
77
+ const metadata = {};
78
+ if (this.databaseDefinition) {
79
+ metadata.database = this.databaseDefinition;
80
+ }
81
+ if (this.result) {
82
+ metadata.result = this.result;
83
+ }
84
+ if (this.kind === "action") {
85
+ metadata.functions = this.calls;
86
+ }
87
+ return (
88
+ /* oxlint-disable typescript/no-unsafe-type-assertion, anti-slop/no-chained-type-assertions -- This builder or fixture preserves the declared capabilities across an erased generic boundary. */
89
+ Object.freeze({
90
+ ...metadata,
91
+ args: this.args,
92
+ handler: (context) => (
93
+ // SAFETY: The adapter reconstructs the same runtime contract, but TypeScript cannot relate the erased generic parameters across this library boundary.
94
+ // oxlint-disable-next-line anti-slop/no-chained-type-assertions -- The adapter reconstructs the same runtime contract, but TypeScript cannot relate the erased generic parameters across this library boundary.
95
+ handler({
96
+ ...context,
97
+ input: context.args
98
+ })
99
+ ),
100
+ kind: this.kind
101
+ })
102
+ );
81
103
  }
82
104
  };
83
- var tk = Object.freeze({
84
- query: new FunctionBuilder("query", z.undefined(), void 0, {}),
105
+ var fn = Object.freeze({
106
+ action: new FunctionBuilder("action", z.undefined(), void 0, {}),
85
107
  mutation: new FunctionBuilder("mutation", z.undefined(), void 0, {}),
86
- action: new FunctionBuilder("action", z.undefined(), void 0, {})
108
+ query: new FunctionBuilder("query", z.undefined(), void 0, {})
87
109
  });
88
110
 
89
111
  // src/server/instances.ts
90
112
  import { z as z2 } from "zod";
91
113
  var addressSchema = z2.object({
92
- slot: z2.string().min(1).max(255),
93
- path: z2.string().startsWith("/").max(1024)
114
+ path: z2.string().startsWith("/").max(1024),
115
+ slot: z2.string().min(1).max(255)
94
116
  });
95
- function registeredQueries(functions) {
117
+ var registeredQueries = (functions) => {
96
118
  const queries = {};
97
- for (const [name, fn] of Object.entries(functions)) {
98
- if (isFunction(fn)) {
99
- if (fn.kind === "query") queries[name] = fn;
119
+ for (const [name, fn2] of Object.entries(functions)) {
120
+ if (isFunction(fn2)) {
121
+ if (fn2.kind === "query") {
122
+ queries[name] = fn2;
123
+ }
100
124
  } else {
101
- const nested = registeredQueries(fn);
102
- if (Object.keys(nested).length) queries[name] = nested;
125
+ const nested = registeredQueries(fn2);
126
+ if (Object.keys(nested).length) {
127
+ queries[name] = nested;
128
+ }
103
129
  }
104
130
  }
105
131
  return queries;
106
- }
107
- function withInstanceResolvers(app, resolvers) {
132
+ };
133
+ var withInstanceResolvers = (app, resolvers) => {
108
134
  if (Object.hasOwn(app.functions, "_tailorkit")) {
109
- throw new Error("The _tailorkit function namespace is reserved by TailorKit.");
135
+ throw new Error(
136
+ "The _tailorkit function namespace is reserved by TailorKit."
137
+ );
110
138
  }
111
139
  const queries = registeredQueries(app.functions);
112
140
  const registry = /* @__PURE__ */ new Map();
@@ -124,30 +152,42 @@ function withInstanceResolvers(app, resolvers) {
124
152
  }
125
153
  const result = z2.array(
126
154
  z2.object({
155
+ data: resolver.dataSchema,
127
156
  key: z2.string().min(1),
128
- metadata: z2.record(z2.string(), z2.unknown()),
129
- data: resolver.dataSchema
157
+ metadata: z2.record(z2.string(), z2.unknown())
130
158
  })
131
- ).refine((items) => new Set(items.map((item) => item.key)).size === items.length, {
132
- message: "Instance keys must be unique"
133
- });
159
+ ).refine(
160
+ (items) => new Set(items.map((item) => item.key)).size === items.length,
161
+ {
162
+ message: "Instance keys must be unique"
163
+ }
164
+ );
134
165
  paths.set(resolver.path, { resolver, result });
135
166
  }
136
167
  const instances = {
137
168
  resolve: action({
169
+ args: addressSchema.extend({
170
+ context: z2.record(z2.string(), z2.unknown())
171
+ }),
138
172
  functions: queries,
139
- args: addressSchema.extend({ context: z2.record(z2.string(), z2.unknown()) }),
140
- async handler({ args, identity, signal, queries: queries2 }) {
173
+ handler: async ({ args, identity, signal, queries: queriesValue }) => {
141
174
  const entry = registry.get(args.slot)?.get(args.path);
142
- if (!entry) throw new AppError("NOT_FOUND", "Instance resolver not found");
175
+ if (!entry) {
176
+ throw new AppError("NOT_FOUND", "Instance resolver not found");
177
+ }
143
178
  const value = await entry.resolver.resolve({
144
179
  context: args.context,
145
180
  identity,
146
- signal,
147
- queries: queries2
181
+ queries: queriesValue,
182
+ signal
148
183
  });
149
184
  const result = entry.result.safeParse(value);
150
- if (!result.success) throw new AppError("INTERNAL_SERVER_ERROR", "Invalid function result");
185
+ if (!result.success) {
186
+ throw new AppError(
187
+ "INTERNAL_SERVER_ERROR",
188
+ "Invalid function result"
189
+ );
190
+ }
151
191
  return result.data;
152
192
  }
153
193
  })
@@ -156,7 +196,7 @@ function withInstanceResolvers(app, resolvers) {
156
196
  return Object.freeze({
157
197
  functions: { ...app.functions, _tailorkit: internal.functions }
158
198
  });
159
- }
199
+ };
160
200
 
161
201
  // src/database/schema.ts
162
202
  import {
@@ -181,11 +221,12 @@ import {
181
221
  isNotNull,
182
222
  inArray
183
223
  } from "drizzle-orm";
184
- function table(name, columns) {
185
- if (!/^[a-zA-Z][a-zA-Z0-9_]{0,62}$/u.test(name) || name.startsWith("sqlite_") || name.startsWith("tailorkit_"))
224
+ var table = (name, columns) => {
225
+ if (!/^[a-zA-Z][a-zA-Z0-9_]{0,62}$/u.test(name) || name.startsWith("sqlite_") || name.startsWith("tailorkit_")) {
186
226
  throw new Error("Invalid or reserved table name");
227
+ }
187
228
  return sqliteTable(name, columns);
188
- }
229
+ };
189
230
  var text = (name = "") => sqliteText(name);
190
231
  var integer = (name = "") => sqliteInteger(name);
191
232
  var real = (name = "") => sqliteReal(name);
@@ -197,7 +238,7 @@ export {
197
238
  action,
198
239
  defineServer,
199
240
  defineDatabase,
200
- tk,
241
+ fn,
201
242
  withInstanceResolvers,
202
243
  table,
203
244
  text,
@@ -1,10 +1,10 @@
1
- import { AppError } from "../errors";
1
+ import { AppError } from "#errors";
2
2
  import type { Reference } from "./reference";
3
3
  import type { Session } from "./session";
4
4
  export type { Session } from "./session";
5
5
  export { reference } from "./reference";
6
6
  export type { Reference, References } from "./reference";
7
- export { AppError } from "../errors";
7
+ export { AppError } from "#errors";
8
8
  type InputArguments<I> = undefined extends I ? [args?: I] : [args: I];
9
9
  type MutationArguments<I> = undefined extends I ? [args?: I, options?: {
10
10
  requestId?: string;
@@ -12,20 +12,20 @@ type MutationArguments<I> = undefined extends I ? [args?: I, options?: {
12
12
  requestId?: string;
13
13
  }];
14
14
  export interface Client {
15
- query<I, O>(reference: Reference<"query", I, O>, ...args: InputArguments<NoInfer<I>>): Promise<O>;
16
- mutate<I, O>(reference: Reference<"mutation", I, O>, ...args: MutationArguments<NoInfer<I>>): Promise<O>;
17
- action<I, O>(reference: Reference<"action", I, O>, ...args: InputArguments<NoInfer<I>>): Promise<O>;
18
- subscribe<I, O>(reference: Reference<"query", I, O>, args: NoInfer<I>, next: (value: O) => void, options?: {
15
+ query: <I, O>(reference: Reference<"query", I, O>, ...args: InputArguments<NoInfer<I>>) => Promise<O>;
16
+ mutate: <I, O>(reference: Reference<"mutation", I, O>, ...args: MutationArguments<NoInfer<I>>) => Promise<O>;
17
+ action: <I, O>(reference: Reference<"action", I, O>, ...args: InputArguments<NoInfer<I>>) => Promise<O>;
18
+ subscribe: <I, O>(reference: Reference<"query", I, O>, args: NoInfer<I>, next: (value: O) => void, options?: {
19
19
  onError?: (error: AppError) => void;
20
- }): () => void;
21
- close(): void;
20
+ }) => () => void;
21
+ close: () => void;
22
22
  }
23
- export declare function createClient(options?: {
23
+ export declare const createClient: (options?: {
24
24
  getSession?: (options: {
25
25
  refresh: boolean;
26
26
  }) => Promise<Session>;
27
27
  connect?: (url: string, protocols: string[]) => WebSocket | Promise<WebSocket>;
28
28
  fetch?: typeof fetch;
29
29
  retryDelayMs?: number;
30
- }): Client;
31
- export { createSessionProvider } from "./session";
30
+ }) => Client;
31
+ export { createSessionProvider, parseSession } from "./session";
@@ -1,13 +1,13 @@
1
+ import type { AppError } from "#errors";
1
2
  import type { Client } from "./connection";
2
3
  import type { Reference } from "./reference";
3
- import type { AppError } from "../errors";
4
4
  export interface QueryState<T> {
5
5
  data: T | undefined;
6
6
  error: AppError | null;
7
7
  status: "pending" | "success" | "error";
8
8
  }
9
9
  export declare const pendingQuery: QueryState<never>;
10
- export declare function serializeInput(input: unknown): string;
10
+ export declare const serializeInput: (input: unknown) => string;
11
11
  /** One subscription per active query/input pair, scoped to this provider's client. */
12
12
  export declare class QueryStore {
13
13
  readonly state: import("nanostores").PreinitializedWritableAtom<Map<string, QueryState<unknown>>> & object;
@@ -1,5 +1,5 @@
1
1
  import type { z } from "zod";
2
- import type { FunctionResult, Functions } from "../server/functions";
2
+ import type { FunctionResult, Functions } from "#server/functions";
3
3
  export interface Reference<K extends "query" | "mutation" | "action", I, O> {
4
4
  readonly name: string;
5
5
  readonly $types?: {
@@ -8,13 +8,13 @@ export interface Reference<K extends "query" | "mutation" | "action", I, O> {
8
8
  output: O;
9
9
  };
10
10
  }
11
- export declare function reference<K extends "query" | "mutation" | "action", I, O>(name: string, _kind: K): Reference<K, I, O>;
11
+ export declare const reference: <K extends "query" | "mutation" | "action", I, O>(name: string, _kind: K) => Reference<K, I, O>;
12
12
  export type References<F> = {
13
13
  readonly [N in keyof F]: F[N] extends {
14
14
  kind: infer K extends "query" | "mutation" | "action";
15
15
  args: infer A extends z.ZodType;
16
- handler: (...args: never[]) => unknown;
16
+ handler: (...args: never[]) => infer _Output;
17
17
  } ? Reference<K, z.input<A>, FunctionResult<F[N]>> : F[N] extends Functions ? References<F[N]> : never;
18
18
  };
19
19
  /** Browser references inferred directly from the server's exported function type. */
20
- export declare function createApi<F extends Functions>(): References<F>;
20
+ export declare const createApi: <F extends Functions>() => References<F>;
@@ -1,4 +1,26 @@
1
- import type { Identity } from "../server/functions";
1
+ import { z } from "zod";
2
+ import type { Identity } from "#server/functions";
3
+ declare const sessionSchema: z.ZodObject<{
4
+ expiresAt: z.ZodNumber;
5
+ identity: z.ZodOptional<z.ZodObject<{
6
+ appId: z.ZodString;
7
+ deploymentId: z.ZodString;
8
+ expiresAt: z.ZodNumber;
9
+ installationId: z.ZodString;
10
+ projectId: z.ZodString;
11
+ scope: z.ZodObject<{
12
+ name: z.ZodString;
13
+ value: z.ZodRecord<z.ZodString, z.ZodJSONSchema>;
14
+ }, z.core.$strip>;
15
+ subjectId: z.ZodOptional<z.ZodString>;
16
+ toolUrl: z.ZodString;
17
+ }, z.core.$strip>>;
18
+ subjectId: z.ZodOptional<z.ZodString>;
19
+ token: z.ZodString;
20
+ toolUrl: z.ZodOptional<z.ZodString>;
21
+ url: z.ZodString;
22
+ }, z.core.$strip>;
23
+ export declare const parseSession: (value: Parameters<typeof sessionSchema.parse>[0]) => Session;
2
24
  export interface Session {
3
25
  toolUrl?: string;
4
26
  identity?: Identity;
@@ -7,12 +29,13 @@ export interface Session {
7
29
  expiresAt: number;
8
30
  url: string;
9
31
  }
10
- export declare function sessionRenewalDelay(session: Session): number;
32
+ export declare const sessionRenewalDelay: (session: Session) => number;
11
33
  /** Host-owned provider: project credentials never cross into the sandbox. */
12
- export declare function createSessionProvider(options: {
34
+ export declare const createSessionProvider: (options: {
13
35
  baseUrl: string | URL;
14
36
  appId: string;
15
37
  fetch?: typeof fetch;
16
- }): (input: {
38
+ }) => (input: {
17
39
  refresh: boolean;
18
40
  }) => Promise<Session>;
41
+ export {};
@@ -1,10 +1,16 @@
1
1
  import type { Session } from "./session";
2
- export interface ToolBridge {
3
- client(path: string, input: unknown): Promise<unknown>;
4
- session(path: string): Promise<Session>;
2
+ export interface ToolBridge<TInput = unknown, TOutput = unknown> {
3
+ client: (path: string, input: TInput) => Promise<TOutput>;
4
+ session: (path: string) => Promise<Session>;
5
+ }
6
+ declare global {
7
+ var __tailorkitTools: ToolBridge | undefined;
8
+ var __tailorkitBackendSession: ((options: {
9
+ refresh: boolean;
10
+ }) => Promise<Session>) | undefined;
5
11
  }
6
12
  export interface TailorKitServerTools {
7
13
  }
14
+ export declare const executeServerTool: (session: Session, path: string, input: unknown, request?: typeof fetch, signal?: AbortSignal) => Promise<unknown>;
8
15
  /** Generated callers delegate only transport; host/server declarations validate both directions. */
9
- export declare function callTool(kind: "client" | "server", path: string, input?: unknown): Promise<unknown>;
10
- export declare function executeServerTool(session: Session, path: string, input: unknown, request?: typeof fetch, signal?: AbortSignal): Promise<unknown>;
16
+ export declare const callTool: (kind: "client" | "server", path: string, input?: Parameters<ToolBridge["client"]>[1]) => ReturnType<ToolBridge["client"]>;
@@ -1,14 +1,16 @@
1
1
  import {
2
2
  createClient,
3
3
  createSessionProvider,
4
+ parseSession,
4
5
  reference
5
- } from "./chunk-SWBQZDWT.js";
6
+ } from "./chunk-PJBDA2RU.js";
6
7
  import {
7
8
  AppError
8
- } from "./chunk-IJBQ77AH.js";
9
+ } from "./chunk-7ZQPXG7O.js";
9
10
  export {
10
11
  AppError,
11
12
  createClient,
12
13
  createSessionProvider,
14
+ parseSession,
13
15
  reference
14
16
  };
package/dist/client.d.ts CHANGED
@@ -2,9 +2,9 @@ export * from "./views";
2
2
  export * from "./preact";
3
3
  export { defineRoute, Route, createFileClient } from "./routing";
4
4
  export type { RouteDefinition, ShellProps } from "./routing";
5
- export { createClient, createSessionProvider, reference } from "./client/connection";
5
+ export { createClient, createSessionProvider, reference, } from "./client/connection";
6
6
  export { createApi } from "./client/reference";
7
- export type { Client, Session, Reference, References } from "./client/connection";
7
+ export type { Client, Session, Reference, References, } from "./client/connection";
8
8
  export { AppError, appError } from "./errors";
9
9
  export type { ErrorCode } from "./errors";
10
10
  export { callTool } from "./client/tools";
package/dist/client.js CHANGED
@@ -9,17 +9,17 @@ import {
9
9
  useAction,
10
10
  useMutation,
11
11
  useQuery
12
- } from "./chunk-STTKSRAI.js";
12
+ } from "./chunk-UDXPIO6D.js";
13
13
  import {
14
14
  createApi,
15
15
  createClient,
16
16
  createSessionProvider,
17
17
  reference
18
- } from "./chunk-SWBQZDWT.js";
18
+ } from "./chunk-PJBDA2RU.js";
19
19
  import {
20
20
  AppError,
21
21
  appError
22
- } from "./chunk-IJBQ77AH.js";
22
+ } from "./chunk-7ZQPXG7O.js";
23
23
  export {
24
24
  AppError,
25
25
  ClientProvider,
@@ -3,6 +3,6 @@ export interface DatabaseDefinition<R extends AnyRelations = AnyRelations> {
3
3
  readonly relations: R;
4
4
  }
5
5
  /** Configure the installation database with Drizzle relations, which also contain its tables. */
6
- export declare function defineDatabase<const R extends AnyRelations>(definition: DatabaseDefinition<R>): Readonly<{
6
+ export declare const defineDatabase: <const R extends AnyRelations>(definition: DatabaseDefinition<R>) => Readonly<{
7
7
  relations: R;
8
8
  }>;
@@ -1,5 +1,5 @@
1
1
  import type { ColumnBuilderBase } from "drizzle-orm";
2
- export declare function table<N extends string, C extends Record<string, ColumnBuilderBase>>(name: N, columns: C): import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
2
+ export declare const table: <N extends string, C extends Record<string, ColumnBuilderBase>>(name: N, columns: C) => import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
3
3
  name: N;
4
4
  schema: undefined;
5
5
  columns: { [Key in keyof C]: import("drizzle-orm/sqlite-core").SQLiteColumn<{
package/dist/errors.d.ts CHANGED
@@ -3,4 +3,4 @@ export declare class AppError extends Error {
3
3
  readonly code: ErrorCode;
4
4
  constructor(code: ErrorCode, message?: string);
5
5
  }
6
- export declare function appError(error: unknown): AppError;
6
+ export declare const appError: (cause: unknown) => AppError;
package/dist/index.js CHANGED
@@ -9,13 +9,13 @@ import {
9
9
  useAction,
10
10
  useMutation,
11
11
  useQuery
12
- } from "./chunk-STTKSRAI.js";
12
+ } from "./chunk-UDXPIO6D.js";
13
13
  import {
14
14
  createApi,
15
15
  createClient,
16
16
  createSessionProvider,
17
17
  reference
18
- } from "./chunk-SWBQZDWT.js";
18
+ } from "./chunk-PJBDA2RU.js";
19
19
  import {
20
20
  action,
21
21
  and,
@@ -26,6 +26,7 @@ import {
26
26
  defineServer,
27
27
  desc,
28
28
  eq,
29
+ fn,
29
30
  gt,
30
31
  gte,
31
32
  inArray,
@@ -41,13 +42,12 @@ import {
41
42
  real,
42
43
  table,
43
44
  text,
44
- tk,
45
45
  withInstanceResolvers
46
- } from "./chunk-ANTVMHDZ.js";
46
+ } from "./chunk-YX3JURMG.js";
47
47
  import {
48
48
  AppError,
49
49
  appError
50
- } from "./chunk-IJBQ77AH.js";
50
+ } from "./chunk-7ZQPXG7O.js";
51
51
  export {
52
52
  AppError,
53
53
  ClientProvider,
@@ -70,6 +70,7 @@ export {
70
70
  defineView,
71
71
  desc,
72
72
  eq,
73
+ fn,
73
74
  gt,
74
75
  gte,
75
76
  inArray,
@@ -86,7 +87,6 @@ export {
86
87
  reference,
87
88
  table,
88
89
  text,
89
- tk,
90
90
  useAction,
91
91
  useMutation,
92
92
  useQuery,
package/dist/preact.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import type { ComponentChildren } from "preact";
2
2
  import type { Client } from "./client/connection";
3
- import type { Reference } from "./client/reference";
4
3
  import { QueryStore } from "./client/query-store";
5
4
  import type { QueryState } from "./client/query-store";
5
+ import type { Reference } from "./client/reference";
6
6
  import type { AppError } from "./errors";
7
7
  export interface ClientProviderProps {
8
8
  children?: ComponentChildren;
@@ -10,7 +10,7 @@ export interface ClientProviderProps {
10
10
  client?: Client;
11
11
  onError?: (error: AppError) => void;
12
12
  }
13
- export declare function ClientProvider({ children, client, onError }: ClientProviderProps): import("preact").VNode<import("preact").Attributes & {
13
+ export declare const ClientProvider: ({ children, client, onError, }: ClientProviderProps) => import("preact").VNode<import("preact").Attributes & {
14
14
  value: QueryStore | null;
15
15
  children?: ComponentChildren;
16
16
  }>;
@@ -25,7 +25,7 @@ export interface QueryResult<T> extends QueryState<T> {
25
25
  isSuccess: boolean;
26
26
  isError: boolean;
27
27
  }
28
- export declare function useQuery<I, O>(ref: Reference<"query", I, O>, ...[input, options]: QueryArguments<NoInfer<I>>): QueryResult<O>;
28
+ export declare const useQuery: <I, O>(ref: Reference<"query", I, O>, ...[input, options]: QueryArguments<NoInfer<I>>) => QueryResult<O>;
29
29
  export interface CallOptions<I, O> {
30
30
  onSuccess?: (data: O, input: I) => void;
31
31
  onError?: (error: AppError, input: I) => void;
@@ -43,10 +43,10 @@ export interface MutationResult<I, O> extends CallState<O> {
43
43
  mutate: (...args: InputArguments<I>) => void;
44
44
  mutateAsync: (...args: InputArguments<I>) => Promise<O>;
45
45
  }
46
- export declare function useMutation<I, O>(ref: Reference<"mutation", I, O>, options?: CallOptions<I, O>): MutationResult<I, O>;
46
+ export declare const useMutation: <I, O>(ref: Reference<"mutation", I, O>, options?: CallOptions<I, O>) => MutationResult<I, O>;
47
47
  export interface ActionResult<I, O> extends CallState<O> {
48
48
  execute: (...args: InputArguments<I>) => void;
49
49
  executeAsync: (...args: InputArguments<I>) => Promise<O>;
50
50
  }
51
- export declare function useAction<I, O>(ref: Reference<"action", I, O>, options?: CallOptions<I, O>): ActionResult<I, O>;
51
+ export declare const useAction: <I, O>(ref: Reference<"action", I, O>, options?: CallOptions<I, O>) => ActionResult<I, O>;
52
52
  export {};