@slates/client 1.0.0-rc.11

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.
@@ -0,0 +1,227 @@
1
+ import { SlatesProtocolVersion, SlatesParticipant, SlatesNotifications, SlatesRequests, SlatesResponses, SlatesResponsesByMethod, SlatesMessageProviderIdentifyResponse, SlatesMessageActionsListResponse, SlatesAction, SlatesMessageActionGetResponse, SlatesMessageConfigSchemaGetResponse, SlatesMessageConfigDefaultGetResponse, SlatesMessageConfigChangedResponse, SlateAuthenticationMethod, SlatesMessageAuthMethodGetResponse, SlatesMessageAuthDefaultInputGetResponse, SlatesMessageAuthInputChangedResponse, SlatesMessageAuthOutputGetResponse, SlatesMessageAuthAuthorizationUrlGetResponse, SlatesMessageAuthTokenRefreshHandleResponse, SlatesMessageAuthProfileGetResponse, SlatesMessageActionInvokeResponse, SlatesMessageActionTriggerEventMapResponse, SlatesMessageActionTriggerWebhookRegisterResponse, SlatesMessageActionTriggerWebhookHandleResponse, SlatesMessageActionTriggerWebhookUnregisterResponse } from '@slates/proto';
2
+ import { Slate, SlateLogListener } from '@slates/provider';
3
+
4
+ type SlatesJsonObject = Record<string, any>;
5
+ type SlatesProtocolMessage = SlatesNotifications | SlatesRequests;
6
+ type SlatesProtocolResponse = SlatesNotifications | SlatesResponses;
7
+ interface SlatesClientState {
8
+ protocol: SlatesProtocolVersion;
9
+ participants: SlatesParticipant[];
10
+ config: SlatesJsonObject | null;
11
+ auth: {
12
+ authenticationMethodId: string;
13
+ output: SlatesJsonObject;
14
+ } | null;
15
+ session: {
16
+ id: string;
17
+ state: SlatesJsonObject;
18
+ } | null;
19
+ }
20
+ interface SlatesMessageTransport {
21
+ send(messages: SlatesProtocolMessage[]): Promise<SlatesProtocolResponse[]>;
22
+ close?(): Promise<void> | void;
23
+ }
24
+ interface SlatesProtocolClientOptions {
25
+ transport: SlatesMessageTransport;
26
+ participants?: SlatesParticipant[];
27
+ state?: Partial<SlatesClientState>;
28
+ }
29
+
30
+ declare class SlatesProtocolClient {
31
+ readonly transport: SlatesProtocolClientOptions['transport'];
32
+ state: SlatesClientState;
33
+ constructor(opts: SlatesProtocolClientOptions);
34
+ setParticipants(participants: SlatesParticipant[]): this;
35
+ setConfig(config: Record<string, any> | null): this;
36
+ setAuth(auth: SlatesClientState['auth']): this;
37
+ clearAuth(): this;
38
+ setSession(session: SlatesClientState['session']): this;
39
+ ensureSession(): {
40
+ id: string;
41
+ state: SlatesJsonObject;
42
+ };
43
+ private buildStateMessages;
44
+ request<Key extends keyof SlatesResponsesByMethod & SlatesRequests['method']>(method: Key, params: Extract<SlatesRequests, {
45
+ method: Key;
46
+ }>['params']): Promise<SlatesResponsesByMethod[Key]['result']>;
47
+ identify(): Promise<SlatesMessageProviderIdentifyResponse['result']>;
48
+ listActions(): Promise<SlatesMessageActionsListResponse['result']>;
49
+ listTools(): Promise<SlatesAction[]>;
50
+ listTriggers(): Promise<SlatesAction[]>;
51
+ getAction(actionId: string): Promise<SlatesMessageActionGetResponse['result']>;
52
+ getTool(actionId: string): Promise<{
53
+ id: string;
54
+ name: string;
55
+ inputSchema: Record<string, any>;
56
+ outputSchema: Record<string, any>;
57
+ type: "action.tool";
58
+ capabilities: Record<string, never>;
59
+ description?: string | undefined;
60
+ instructions?: string[] | undefined;
61
+ constraints?: string[] | undefined;
62
+ tags?: {
63
+ destructive?: boolean | undefined;
64
+ readOnly?: boolean | undefined;
65
+ } | undefined;
66
+ metadata?: Record<string, any> | undefined;
67
+ scopes?: {
68
+ AND: {
69
+ OR: string[];
70
+ }[];
71
+ } | undefined;
72
+ }>;
73
+ getTrigger(actionId: string): Promise<{
74
+ id: string;
75
+ name: string;
76
+ inputSchema: Record<string, any>;
77
+ outputSchema: Record<string, any>;
78
+ type: "action.trigger";
79
+ capabilities: Record<string, never>;
80
+ invocation: {
81
+ type: "polling";
82
+ intervalSeconds: number;
83
+ } | {
84
+ type: "webhook";
85
+ autoRegistration: boolean;
86
+ autoUnregistration: boolean;
87
+ };
88
+ description?: string | undefined;
89
+ instructions?: string[] | undefined;
90
+ constraints?: string[] | undefined;
91
+ tags?: {
92
+ destructive?: boolean | undefined;
93
+ readOnly?: boolean | undefined;
94
+ } | undefined;
95
+ metadata?: Record<string, any> | undefined;
96
+ scopes?: {
97
+ AND: {
98
+ OR: string[];
99
+ }[];
100
+ } | undefined;
101
+ }>;
102
+ getConfigSchema(): Promise<SlatesMessageConfigSchemaGetResponse['result']>;
103
+ getDefaultConfig(): Promise<SlatesMessageConfigDefaultGetResponse['result']>;
104
+ updateConfig(previousConfig: Record<string, any> | null, newConfig: Record<string, any>): Promise<SlatesMessageConfigChangedResponse['result']>;
105
+ listAuthMethods(): Promise<{
106
+ authenticationMethods: SlateAuthenticationMethod[];
107
+ }>;
108
+ getAuthMethod(authenticationMethodId: string): Promise<SlatesMessageAuthMethodGetResponse['result']>;
109
+ getDefaultAuthInput(authenticationMethodId: string): Promise<SlatesMessageAuthDefaultInputGetResponse['result']>;
110
+ updateAuthInput(d: {
111
+ authenticationMethodId: string;
112
+ previousInput: Record<string, any> | null;
113
+ newInput: Record<string, any>;
114
+ }): Promise<SlatesMessageAuthInputChangedResponse['result']>;
115
+ getAuthOutput(d: {
116
+ authenticationMethodId: string;
117
+ input: Record<string, any>;
118
+ }): Promise<SlatesMessageAuthOutputGetResponse['result']>;
119
+ getAuthorizationUrl(d: {
120
+ authenticationMethodId: string;
121
+ redirectUri: string;
122
+ state: string;
123
+ input: Record<string, any>;
124
+ clientId: string;
125
+ clientSecret: string;
126
+ scopes: string[];
127
+ }): Promise<SlatesMessageAuthAuthorizationUrlGetResponse['result']>;
128
+ handleAuthorizationCallback(d: {
129
+ authenticationMethodId: string;
130
+ code: string;
131
+ state: string;
132
+ redirectUri: string;
133
+ input: Record<string, any>;
134
+ clientId: string;
135
+ clientSecret: string;
136
+ scopes: string[];
137
+ callbackParams?: Record<string, string>;
138
+ callbackState?: Record<string, any>;
139
+ }): Promise<{
140
+ output: Record<string, any>;
141
+ input?: Record<string, any>;
142
+ scopes?: string[];
143
+ }>;
144
+ refreshToken(d: {
145
+ authenticationMethodId: string;
146
+ output: Record<string, any>;
147
+ input: Record<string, any>;
148
+ clientId: string;
149
+ clientSecret: string;
150
+ scopes: string[];
151
+ }): Promise<SlatesMessageAuthTokenRefreshHandleResponse['result']>;
152
+ getAuthProfile(d: {
153
+ authenticationMethodId: string;
154
+ output: Record<string, any>;
155
+ input: Record<string, any>;
156
+ scopes: string[];
157
+ }): Promise<SlatesMessageAuthProfileGetResponse['result']>;
158
+ invokeTool(actionId: string, input: Record<string, any>): Promise<SlatesMessageActionInvokeResponse['result']>;
159
+ mapTriggerEvent(actionId: string, input: Record<string, any>): Promise<SlatesMessageActionTriggerEventMapResponse['result']>;
160
+ registerTriggerWebhook(actionId: string, webhookBaseUrl: string): Promise<SlatesMessageActionTriggerWebhookRegisterResponse['result']>;
161
+ handleTriggerWebhook(d: {
162
+ actionId: string;
163
+ url: string;
164
+ method: string;
165
+ headers?: Record<string, string>;
166
+ body?: string | Uint8Array | null;
167
+ state?: any;
168
+ }): Promise<SlatesMessageActionTriggerWebhookHandleResponse['result']>;
169
+ unregisterTriggerWebhook(d: {
170
+ actionId: string;
171
+ webhookBaseUrl: string;
172
+ registrationDetails: any;
173
+ state?: any;
174
+ }): Promise<SlatesMessageActionTriggerWebhookUnregisterResponse['result']>;
175
+ close(): Promise<void>;
176
+ }
177
+
178
+ type SlateProtocolErrorSource = 'provider' | 'transport';
179
+ type SlateProtocolErrorKind = 'declaration' | 'validation' | 'request' | 'auth' | 'config' | 'resource' | 'payment' | 'upstream' | 'transport' | 'internal';
180
+ interface SlateProtocolErrorResponse {
181
+ code: string;
182
+ message: string;
183
+ kind: SlateProtocolErrorKind;
184
+ retryable?: boolean;
185
+ status?: number;
186
+ issues?: Record<string, unknown>[];
187
+ provider?: Record<string, unknown>;
188
+ upstream?: Record<string, unknown>;
189
+ baggage?: Record<string, unknown>;
190
+ requestTraces?: Record<string, unknown>[];
191
+ [key: string]: unknown;
192
+ }
193
+ declare class SlateProtocolError extends Error {
194
+ cause?: unknown;
195
+ data: SlateProtocolErrorResponse;
196
+ source: SlateProtocolErrorSource;
197
+ constructor(data: SlateProtocolErrorResponse, source?: SlateProtocolErrorSource, cause?: unknown);
198
+ get code(): string;
199
+ get kind(): SlateProtocolErrorKind;
200
+ get retryable(): boolean | undefined;
201
+ get status(): number | undefined;
202
+ toJSON(): {
203
+ source: SlateProtocolErrorSource;
204
+ code: string;
205
+ message: string;
206
+ kind: SlateProtocolErrorKind;
207
+ retryable?: boolean;
208
+ status?: number;
209
+ issues?: Record<string, unknown>[];
210
+ provider?: Record<string, unknown>;
211
+ upstream?: Record<string, unknown>;
212
+ baggage?: Record<string, unknown>;
213
+ requestTraces?: Record<string, unknown>[];
214
+ };
215
+ static is(error: unknown): error is SlateProtocolError;
216
+ static fromResponse(error: unknown, source?: SlateProtocolErrorSource): SlateProtocolError;
217
+ static fromUnknown(error: unknown, defaults?: Partial<SlateProtocolErrorResponse>, source?: SlateProtocolErrorSource): SlateProtocolError;
218
+ }
219
+
220
+ declare let createLocalSlateTransport: <ConfigType extends {}, AuthType extends {}>(d: {
221
+ slate: Slate<ConfigType, AuthType>;
222
+ listeners?: SlateLogListener[];
223
+ }) => SlatesMessageTransport;
224
+
225
+ declare let createSlatesClient: (opts: SlatesProtocolClientOptions) => SlatesProtocolClient;
226
+
227
+ export { SlateProtocolError, type SlateProtocolErrorKind, type SlateProtocolErrorResponse, type SlateProtocolErrorSource, type SlatesClientState, type SlatesJsonObject, type SlatesMessageTransport, SlatesProtocolClient, type SlatesProtocolClientOptions, type SlatesProtocolMessage, type SlatesProtocolResponse, createLocalSlateTransport, createSlatesClient };
@@ -0,0 +1,383 @@
1
+ // src/client.ts
2
+ import {
3
+ SLATES_PROTOCOL_VERSION
4
+ } from "@slates/proto";
5
+ import { randomUUID } from "crypto";
6
+
7
+ // src/error.ts
8
+ var isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
9
+ var isSlateErrorResponse = (error) => isRecord(error) && typeof error.code === "string" && typeof error.message === "string";
10
+ var inferKindFromCode = (code) => {
11
+ if (code.startsWith("declaration.")) return "declaration";
12
+ if (code.startsWith("input.")) return "validation";
13
+ if (code.startsWith("request.")) return "request";
14
+ if (code.startsWith("config.")) return "config";
15
+ if (code.startsWith("auth.") || code.startsWith("permission.")) return "auth";
16
+ if (code.startsWith("resource.")) return "resource";
17
+ if (code.startsWith("payment.")) return "payment";
18
+ if (code.startsWith("transport.")) return "transport";
19
+ if (code.startsWith("upstream.")) return "upstream";
20
+ return "internal";
21
+ };
22
+ var normalizeResponse = (error, source, defaults = {}) => {
23
+ if (isSlateErrorResponse(error)) {
24
+ return {
25
+ ...defaults,
26
+ ...error,
27
+ kind: error.kind ?? inferKindFromCode(error.code)
28
+ };
29
+ }
30
+ if (isRecord(error) && typeof error.message === "string") {
31
+ let code2 = typeof error.code === "string" ? error.code : defaults.code ?? (source === "transport" ? "transport.invoke_failed" : "internal.unexpected");
32
+ return {
33
+ ...defaults,
34
+ ...error,
35
+ code: code2,
36
+ message: error.message,
37
+ kind: (typeof error.kind === "string" ? error.kind : defaults.kind) ?? inferKindFromCode(code2)
38
+ };
39
+ }
40
+ let code = defaults.code ?? (source === "transport" ? "transport.invoke_failed" : "internal.unexpected");
41
+ return {
42
+ ...defaults,
43
+ code,
44
+ message: error instanceof Error ? error.message : defaults.message ?? "The slate returned an unexpected error.",
45
+ kind: defaults.kind ?? inferKindFromCode(code),
46
+ baggage: {
47
+ ...defaults.baggage ?? {},
48
+ ...error instanceof Error ? { originalName: error.name } : { originalValue: error }
49
+ }
50
+ };
51
+ };
52
+ var SlateProtocolError = class _SlateProtocolError extends Error {
53
+ cause;
54
+ data;
55
+ source;
56
+ constructor(data, source = "provider", cause) {
57
+ super(data.message);
58
+ this.name = "SlateProtocolError";
59
+ this.data = data;
60
+ this.source = source;
61
+ this.cause = cause;
62
+ }
63
+ get code() {
64
+ return this.data.code;
65
+ }
66
+ get kind() {
67
+ return this.data.kind;
68
+ }
69
+ get retryable() {
70
+ return this.data.retryable;
71
+ }
72
+ get status() {
73
+ return this.data.status;
74
+ }
75
+ toJSON() {
76
+ return {
77
+ ...this.data,
78
+ source: this.source
79
+ };
80
+ }
81
+ static is(error) {
82
+ return error instanceof _SlateProtocolError;
83
+ }
84
+ static fromResponse(error, source = "provider") {
85
+ if (_SlateProtocolError.is(error)) return error;
86
+ return new _SlateProtocolError(normalizeResponse(error, source), source, error);
87
+ }
88
+ static fromUnknown(error, defaults = {}, source = "transport") {
89
+ if (_SlateProtocolError.is(error)) return error;
90
+ return new _SlateProtocolError(normalizeResponse(error, source, defaults), source, error);
91
+ }
92
+ };
93
+
94
+ // src/client.ts
95
+ var createDefaultParticipants = () => [
96
+ {
97
+ type: "consumer",
98
+ id: "slates-client",
99
+ name: "Slates Client"
100
+ }
101
+ ];
102
+ var SlatesProtocolClient = class {
103
+ transport;
104
+ state;
105
+ constructor(opts) {
106
+ this.transport = opts.transport;
107
+ this.state = {
108
+ protocol: SLATES_PROTOCOL_VERSION,
109
+ participants: opts.participants ?? createDefaultParticipants(),
110
+ config: opts.state?.config ?? null,
111
+ auth: opts.state?.auth ?? null,
112
+ session: opts.state?.session ?? null
113
+ };
114
+ }
115
+ setParticipants(participants) {
116
+ this.state.participants = participants;
117
+ return this;
118
+ }
119
+ setConfig(config) {
120
+ this.state.config = config;
121
+ return this;
122
+ }
123
+ setAuth(auth) {
124
+ this.state.auth = auth;
125
+ return this;
126
+ }
127
+ clearAuth() {
128
+ this.state.auth = null;
129
+ return this;
130
+ }
131
+ setSession(session) {
132
+ this.state.session = session;
133
+ return this;
134
+ }
135
+ ensureSession() {
136
+ if (!this.state.session) {
137
+ this.state.session = {
138
+ id: randomUUID(),
139
+ state: {}
140
+ };
141
+ }
142
+ return this.state.session;
143
+ }
144
+ buildStateMessages() {
145
+ return [
146
+ {
147
+ jsonrpc: "2.0",
148
+ method: "slates/hello",
149
+ params: { protocol: this.state.protocol }
150
+ },
151
+ {
152
+ jsonrpc: "2.0",
153
+ method: "slates/participant.set",
154
+ params: { participants: this.state.participants }
155
+ },
156
+ ...this.state.config ? [
157
+ {
158
+ jsonrpc: "2.0",
159
+ method: "slates/config.set",
160
+ params: { config: this.state.config }
161
+ }
162
+ ] : [],
163
+ ...this.state.auth ? [
164
+ {
165
+ jsonrpc: "2.0",
166
+ method: "slates/auth.set",
167
+ params: {
168
+ authenticationMethodId: this.state.auth.authenticationMethodId,
169
+ output: this.state.auth.output
170
+ }
171
+ }
172
+ ] : [],
173
+ ...this.state.session ? [
174
+ {
175
+ jsonrpc: "2.0",
176
+ method: "slates/session.start",
177
+ params: {
178
+ sessionId: this.state.session.id,
179
+ state: this.state.session.state
180
+ }
181
+ }
182
+ ] : []
183
+ ];
184
+ }
185
+ async request(method, params) {
186
+ let id = randomUUID();
187
+ let responses = await this.transport.send([
188
+ ...this.buildStateMessages(),
189
+ {
190
+ jsonrpc: "2.0",
191
+ id,
192
+ method,
193
+ params
194
+ }
195
+ ]);
196
+ let response = responses.find((message) => "id" in message && message.id === id);
197
+ if (!response) {
198
+ throw new Error(`No response was returned for method ${String(method)}.`);
199
+ }
200
+ if (response.error) {
201
+ throw SlateProtocolError.fromResponse(response.error);
202
+ }
203
+ return response.result;
204
+ }
205
+ async identify() {
206
+ return this.request("slates/provider.identify", {});
207
+ }
208
+ async listActions() {
209
+ return this.request("slates/actions.list", {});
210
+ }
211
+ async listTools() {
212
+ let result = await this.listActions();
213
+ return result.actions.filter((action) => action.type === "action.tool");
214
+ }
215
+ async listTriggers() {
216
+ let result = await this.listActions();
217
+ return result.actions.filter((action) => action.type === "action.trigger");
218
+ }
219
+ async getAction(actionId) {
220
+ return this.request("slates/action.get", { actionId });
221
+ }
222
+ async getTool(actionId) {
223
+ let result = await this.getAction(actionId);
224
+ if (result.action.type !== "action.tool") {
225
+ throw new Error(`Action ${actionId} is not a tool.`);
226
+ }
227
+ return result.action;
228
+ }
229
+ async getTrigger(actionId) {
230
+ let result = await this.getAction(actionId);
231
+ if (result.action.type !== "action.trigger") {
232
+ throw new Error(`Action ${actionId} is not a trigger.`);
233
+ }
234
+ return result.action;
235
+ }
236
+ async getConfigSchema() {
237
+ return this.request("slates/config.schema.get", {});
238
+ }
239
+ async getDefaultConfig() {
240
+ return this.request("slates/config.get_default", {});
241
+ }
242
+ async updateConfig(previousConfig, newConfig) {
243
+ return this.request("slates/config.changed", {
244
+ previousConfig,
245
+ newConfig
246
+ });
247
+ }
248
+ async listAuthMethods() {
249
+ return this.request("slates/auth.methods.list", {});
250
+ }
251
+ async getAuthMethod(authenticationMethodId) {
252
+ return this.request("slates/auth.method.get", {
253
+ authenticationMethodId
254
+ });
255
+ }
256
+ async getDefaultAuthInput(authenticationMethodId) {
257
+ return this.request("slates/auth.input.get_default", {
258
+ authenticationMethodId
259
+ });
260
+ }
261
+ async updateAuthInput(d) {
262
+ return this.request("slates/auth.input.changed", {
263
+ authenticationMethodId: d.authenticationMethodId,
264
+ previousInput: d.previousInput,
265
+ newInput: d.newInput
266
+ });
267
+ }
268
+ async getAuthOutput(d) {
269
+ return this.request("slates/auth.output.get", {
270
+ authenticationMethodId: d.authenticationMethodId,
271
+ input: d.input
272
+ });
273
+ }
274
+ async getAuthorizationUrl(d) {
275
+ return this.request("slates/auth.authorization_url.get", d);
276
+ }
277
+ async handleAuthorizationCallback(d) {
278
+ return this.request("slates/auth.authorization_callback.handle", d);
279
+ }
280
+ async refreshToken(d) {
281
+ return this.request("slates/auth.token_refresh.handle", d);
282
+ }
283
+ async getAuthProfile(d) {
284
+ return this.request("slates/auth.profile.get", d);
285
+ }
286
+ async invokeTool(actionId, input) {
287
+ this.ensureSession();
288
+ return this.request("slates/action.tool.invoke", {
289
+ actionId,
290
+ input
291
+ });
292
+ }
293
+ async mapTriggerEvent(actionId, input) {
294
+ this.ensureSession();
295
+ return this.request("slates/action.trigger.map_event", {
296
+ actionId,
297
+ input
298
+ });
299
+ }
300
+ async registerTriggerWebhook(actionId, webhookBaseUrl) {
301
+ this.ensureSession();
302
+ return this.request("slates/action.trigger.webhook_register", {
303
+ actionId,
304
+ webhookBaseUrl
305
+ });
306
+ }
307
+ async handleTriggerWebhook(d) {
308
+ this.ensureSession();
309
+ let encodedBody = typeof d.body === "string" ? Buffer.from(d.body, "utf-8").toString("base64") : d.body ? Buffer.from(d.body).toString("base64") : null;
310
+ return this.request("slates/action.trigger.webhook_handle", {
311
+ actionId: d.actionId,
312
+ url: d.url,
313
+ method: d.method,
314
+ headers: d.headers ?? {},
315
+ body: encodedBody ? {
316
+ encoding: "base64",
317
+ content: encodedBody
318
+ } : null,
319
+ state: d.state ?? null
320
+ });
321
+ }
322
+ async unregisterTriggerWebhook(d) {
323
+ this.ensureSession();
324
+ return this.request("slates/action.trigger.webhook_unregister", {
325
+ actionId: d.actionId,
326
+ webhookBaseUrl: d.webhookBaseUrl,
327
+ registrationDetails: d.registrationDetails,
328
+ state: d.state ?? null
329
+ });
330
+ }
331
+ async close() {
332
+ await this.transport.close?.();
333
+ }
334
+ };
335
+
336
+ // src/transport.ts
337
+ import {
338
+ SlatesProviderProtoHandlerManager
339
+ } from "@slates/proto";
340
+ import { createProviderHandler } from "@slates/provider-handler";
341
+ var toTransportError = (value, defaultMessage) => SlateProtocolError.fromUnknown(
342
+ value,
343
+ {
344
+ code: "transport.invoke_failed",
345
+ kind: "transport",
346
+ message: defaultMessage,
347
+ retryable: true,
348
+ baggage: {
349
+ response: value
350
+ }
351
+ },
352
+ "transport"
353
+ );
354
+ var createLocalSlateTransport = (d) => {
355
+ let managerPromise = createProviderHandler(d.slate, d.listeners ?? []).run();
356
+ return {
357
+ async send(messages) {
358
+ let manager = await managerPromise;
359
+ let responses = [];
360
+ for (let message of messages) {
361
+ let response;
362
+ try {
363
+ response = await SlatesProviderProtoHandlerManager.handleInput(manager, message);
364
+ } catch (error) {
365
+ throw toTransportError(error, "Local slate invocation failed");
366
+ }
367
+ if (response) {
368
+ responses.push(response);
369
+ }
370
+ }
371
+ return responses;
372
+ }
373
+ };
374
+ };
375
+
376
+ // src/index.ts
377
+ var createSlatesClient = (opts) => new SlatesProtocolClient(opts);
378
+ export {
379
+ SlateProtocolError,
380
+ SlatesProtocolClient,
381
+ createLocalSlateTransport,
382
+ createSlatesClient
383
+ };
package/package.json ADDED
@@ -0,0 +1,43 @@
1
+ {
2
+ "name": "@slates/client",
3
+ "version": "1.0.0-rc.11",
4
+ "publishConfig": {
5
+ "access": "public"
6
+ },
7
+ "files": [
8
+ "src/**",
9
+ "dist/**",
10
+ "README.md",
11
+ "package.json"
12
+ ],
13
+ "author": "Tobias Herber",
14
+ "license": "FSL 1.1",
15
+ "type": "module",
16
+ "source": "src/index.ts",
17
+ "exports": {
18
+ "types": "./dist/index.d.ts",
19
+ "require": "./dist/index.cjs",
20
+ "import": "./dist/index.module.js",
21
+ "default": "./dist/index.module.js"
22
+ },
23
+ "main": "./dist/index.cjs",
24
+ "module": "./dist/index.module.js",
25
+ "types": "dist/index.d.ts",
26
+ "unpkg": "./dist/index.module.js",
27
+ "scripts": {
28
+ "test": "vitest run --passWithNoTests",
29
+ "build": "tsup --config ../../tsup.packages.config.ts --external async_hooks",
30
+ "typecheck": "tsc --noEmit",
31
+ "biome:check": "biome check --write src"
32
+ },
33
+ "dependencies": {
34
+ "@slates/proto": "1.0.0-rc.10",
35
+ "@slates/provider": "1.0.0-rc.14",
36
+ "@slates/provider-handler": "1.0.0-rc.15"
37
+ },
38
+ "devDependencies": {
39
+ "@slates/tsconfig": "1.0.0-rc.1",
40
+ "typescript": "5.8.2",
41
+ "vitest": "^3.1.2"
42
+ }
43
+ }