@slates/test 1.0.0-rc.6 → 1.0.0-rc.9

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/dist/index.cjs CHANGED
@@ -154,8 +154,12 @@ var getSlateContract = async (client) => {
154
154
  return {
155
155
  provider: provider.provider,
156
156
  actions: actions.actions,
157
- tools: actions.actions.filter((action) => action.type === "action.tool"),
158
- triggers: actions.actions.filter((action) => action.type === "action.trigger"),
157
+ tools: actions.actions.filter(
158
+ (action) => action.type === "action.tool"
159
+ ),
160
+ triggers: actions.actions.filter(
161
+ (action) => action.type === "action.trigger"
162
+ ),
159
163
  authMethods: authMethods.authenticationMethods,
160
164
  configSchema: configSchema.schema
161
165
  };
@@ -198,10 +202,14 @@ var expectSlateContract = async (d) => {
198
202
  expect(contract.tools.map((action) => action.id)).toEqual(d.toolIds);
199
203
  }
200
204
  if (d.triggerIds) {
201
- expect(contract.triggers.map((action) => action.id)).toEqual(d.triggerIds);
205
+ expect(contract.triggers.map((action) => action.id)).toEqual(
206
+ d.triggerIds
207
+ );
202
208
  }
203
209
  if (d.authMethodIds) {
204
- expect(contract.authMethods.map((method) => method.id)).toEqual(d.authMethodIds);
210
+ expect(contract.authMethods.map((method) => method.id)).toEqual(
211
+ d.authMethodIds
212
+ );
205
213
  }
206
214
  for (let tool of d.tools ?? []) {
207
215
  expectActionMatches(
package/dist/index.d.cts CHANGED
@@ -105,6 +105,11 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
105
105
  name: string;
106
106
  inputSchema: Record<string, any>;
107
107
  outputSchema: Record<string, any>;
108
+ docs: {
109
+ name: string;
110
+ url: string;
111
+ type?: "docs.action.general" | undefined;
112
+ }[];
108
113
  type: "action.tool";
109
114
  capabilities: Record<string, never>;
110
115
  description?: string | undefined;
@@ -125,6 +130,11 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
125
130
  name: string;
126
131
  inputSchema: Record<string, any>;
127
132
  outputSchema: Record<string, any>;
133
+ docs: {
134
+ name: string;
135
+ url: string;
136
+ type?: "docs.action.general" | undefined;
137
+ }[];
128
138
  type: "action.trigger";
129
139
  capabilities: Record<string, never>;
130
140
  invocation: {
@@ -154,6 +164,11 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
154
164
  name: string;
155
165
  inputSchema: Record<string, any>;
156
166
  outputSchema: Record<string, any>;
167
+ docs: {
168
+ name: string;
169
+ url: string;
170
+ type?: "docs.action.general" | undefined;
171
+ }[];
157
172
  type: "action.tool";
158
173
  capabilities: Record<string, never>;
159
174
  description?: string | undefined;
@@ -175,6 +190,11 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
175
190
  name: string;
176
191
  inputSchema: Record<string, any>;
177
192
  outputSchema: Record<string, any>;
193
+ docs: {
194
+ name: string;
195
+ url: string;
196
+ type?: "docs.action.general" | undefined;
197
+ }[];
178
198
  type: "action.trigger";
179
199
  capabilities: Record<string, never>;
180
200
  invocation: {
@@ -219,6 +239,11 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
219
239
  enabled: boolean;
220
240
  } | undefined;
221
241
  };
242
+ docs: {
243
+ name: string;
244
+ url: string;
245
+ type?: "docs.auth.oauth" | "docs.auth.oauth_scopes" | "docs.auth.token" | "docs.auth.service_account" | "docs.auth.custom" | undefined;
246
+ }[];
222
247
  scopes?: {
223
248
  id: string;
224
249
  title: string;
@@ -253,6 +278,11 @@ declare let expectSlateContract: (d: {
253
278
  name: string;
254
279
  inputSchema: Record<string, any>;
255
280
  outputSchema: Record<string, any>;
281
+ docs: {
282
+ name: string;
283
+ url: string;
284
+ type?: "docs.action.general" | undefined;
285
+ }[];
256
286
  type: "action.tool";
257
287
  capabilities: Record<string, never>;
258
288
  description?: string | undefined;
@@ -273,6 +303,11 @@ declare let expectSlateContract: (d: {
273
303
  name: string;
274
304
  inputSchema: Record<string, any>;
275
305
  outputSchema: Record<string, any>;
306
+ docs: {
307
+ name: string;
308
+ url: string;
309
+ type?: "docs.action.general" | undefined;
310
+ }[];
276
311
  type: "action.trigger";
277
312
  capabilities: Record<string, never>;
278
313
  invocation: {
@@ -302,6 +337,11 @@ declare let expectSlateContract: (d: {
302
337
  name: string;
303
338
  inputSchema: Record<string, any>;
304
339
  outputSchema: Record<string, any>;
340
+ docs: {
341
+ name: string;
342
+ url: string;
343
+ type?: "docs.action.general" | undefined;
344
+ }[];
305
345
  type: "action.tool";
306
346
  capabilities: Record<string, never>;
307
347
  description?: string | undefined;
@@ -323,6 +363,11 @@ declare let expectSlateContract: (d: {
323
363
  name: string;
324
364
  inputSchema: Record<string, any>;
325
365
  outputSchema: Record<string, any>;
366
+ docs: {
367
+ name: string;
368
+ url: string;
369
+ type?: "docs.action.general" | undefined;
370
+ }[];
326
371
  type: "action.trigger";
327
372
  capabilities: Record<string, never>;
328
373
  invocation: {
@@ -367,6 +412,11 @@ declare let expectSlateContract: (d: {
367
412
  enabled: boolean;
368
413
  } | undefined;
369
414
  };
415
+ docs: {
416
+ name: string;
417
+ url: string;
418
+ type?: "docs.auth.oauth" | "docs.auth.oauth_scopes" | "docs.auth.token" | "docs.auth.service_account" | "docs.auth.custom" | undefined;
419
+ }[];
370
420
  scopes?: {
371
421
  id: string;
372
422
  title: string;
package/dist/index.d.ts CHANGED
@@ -105,6 +105,11 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
105
105
  name: string;
106
106
  inputSchema: Record<string, any>;
107
107
  outputSchema: Record<string, any>;
108
+ docs: {
109
+ name: string;
110
+ url: string;
111
+ type?: "docs.action.general" | undefined;
112
+ }[];
108
113
  type: "action.tool";
109
114
  capabilities: Record<string, never>;
110
115
  description?: string | undefined;
@@ -125,6 +130,11 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
125
130
  name: string;
126
131
  inputSchema: Record<string, any>;
127
132
  outputSchema: Record<string, any>;
133
+ docs: {
134
+ name: string;
135
+ url: string;
136
+ type?: "docs.action.general" | undefined;
137
+ }[];
128
138
  type: "action.trigger";
129
139
  capabilities: Record<string, never>;
130
140
  invocation: {
@@ -154,6 +164,11 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
154
164
  name: string;
155
165
  inputSchema: Record<string, any>;
156
166
  outputSchema: Record<string, any>;
167
+ docs: {
168
+ name: string;
169
+ url: string;
170
+ type?: "docs.action.general" | undefined;
171
+ }[];
157
172
  type: "action.tool";
158
173
  capabilities: Record<string, never>;
159
174
  description?: string | undefined;
@@ -175,6 +190,11 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
175
190
  name: string;
176
191
  inputSchema: Record<string, any>;
177
192
  outputSchema: Record<string, any>;
193
+ docs: {
194
+ name: string;
195
+ url: string;
196
+ type?: "docs.action.general" | undefined;
197
+ }[];
178
198
  type: "action.trigger";
179
199
  capabilities: Record<string, never>;
180
200
  invocation: {
@@ -219,6 +239,11 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
219
239
  enabled: boolean;
220
240
  } | undefined;
221
241
  };
242
+ docs: {
243
+ name: string;
244
+ url: string;
245
+ type?: "docs.auth.oauth" | "docs.auth.oauth_scopes" | "docs.auth.token" | "docs.auth.service_account" | "docs.auth.custom" | undefined;
246
+ }[];
222
247
  scopes?: {
223
248
  id: string;
224
249
  title: string;
@@ -253,6 +278,11 @@ declare let expectSlateContract: (d: {
253
278
  name: string;
254
279
  inputSchema: Record<string, any>;
255
280
  outputSchema: Record<string, any>;
281
+ docs: {
282
+ name: string;
283
+ url: string;
284
+ type?: "docs.action.general" | undefined;
285
+ }[];
256
286
  type: "action.tool";
257
287
  capabilities: Record<string, never>;
258
288
  description?: string | undefined;
@@ -273,6 +303,11 @@ declare let expectSlateContract: (d: {
273
303
  name: string;
274
304
  inputSchema: Record<string, any>;
275
305
  outputSchema: Record<string, any>;
306
+ docs: {
307
+ name: string;
308
+ url: string;
309
+ type?: "docs.action.general" | undefined;
310
+ }[];
276
311
  type: "action.trigger";
277
312
  capabilities: Record<string, never>;
278
313
  invocation: {
@@ -302,6 +337,11 @@ declare let expectSlateContract: (d: {
302
337
  name: string;
303
338
  inputSchema: Record<string, any>;
304
339
  outputSchema: Record<string, any>;
340
+ docs: {
341
+ name: string;
342
+ url: string;
343
+ type?: "docs.action.general" | undefined;
344
+ }[];
305
345
  type: "action.tool";
306
346
  capabilities: Record<string, never>;
307
347
  description?: string | undefined;
@@ -323,6 +363,11 @@ declare let expectSlateContract: (d: {
323
363
  name: string;
324
364
  inputSchema: Record<string, any>;
325
365
  outputSchema: Record<string, any>;
366
+ docs: {
367
+ name: string;
368
+ url: string;
369
+ type?: "docs.action.general" | undefined;
370
+ }[];
326
371
  type: "action.trigger";
327
372
  capabilities: Record<string, never>;
328
373
  invocation: {
@@ -367,6 +412,11 @@ declare let expectSlateContract: (d: {
367
412
  enabled: boolean;
368
413
  } | undefined;
369
414
  };
415
+ docs: {
416
+ name: string;
417
+ url: string;
418
+ type?: "docs.auth.oauth" | "docs.auth.oauth_scopes" | "docs.auth.token" | "docs.auth.service_account" | "docs.auth.custom" | undefined;
419
+ }[];
370
420
  scopes?: {
371
421
  id: string;
372
422
  title: string;
@@ -121,8 +121,12 @@ var getSlateContract = async (client) => {
121
121
  return {
122
122
  provider: provider.provider,
123
123
  actions: actions.actions,
124
- tools: actions.actions.filter((action) => action.type === "action.tool"),
125
- triggers: actions.actions.filter((action) => action.type === "action.trigger"),
124
+ tools: actions.actions.filter(
125
+ (action) => action.type === "action.tool"
126
+ ),
127
+ triggers: actions.actions.filter(
128
+ (action) => action.type === "action.trigger"
129
+ ),
126
130
  authMethods: authMethods.authenticationMethods,
127
131
  configSchema: configSchema.schema
128
132
  };
@@ -165,10 +169,14 @@ var expectSlateContract = async (d) => {
165
169
  expect(contract.tools.map((action) => action.id)).toEqual(d.toolIds);
166
170
  }
167
171
  if (d.triggerIds) {
168
- expect(contract.triggers.map((action) => action.id)).toEqual(d.triggerIds);
172
+ expect(contract.triggers.map((action) => action.id)).toEqual(
173
+ d.triggerIds
174
+ );
169
175
  }
170
176
  if (d.authMethodIds) {
171
- expect(contract.authMethods.map((method) => method.id)).toEqual(d.authMethodIds);
177
+ expect(contract.authMethods.map((method) => method.id)).toEqual(
178
+ d.authMethodIds
179
+ );
172
180
  }
173
181
  for (let tool of d.tools ?? []) {
174
182
  expectActionMatches(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@slates/test",
3
- "version": "1.0.0-rc.6",
3
+ "version": "1.0.0-rc.9",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -34,17 +34,17 @@
34
34
  "unpkg": "./dist/index.module.js",
35
35
  "scripts": {
36
36
  "test": "vitest run --passWithNoTests",
37
- "lint": "prettier src/**/*.ts --check",
38
37
  "build": "tsup --config tsup.config.ts",
39
- "typecheck": "tsc --noEmit"
38
+ "typecheck": "tsc --noEmit",
39
+ "biome:check": "biome check --write src"
40
40
  },
41
41
  "dependencies": {
42
42
  "@lowerdeck/testing-tools": "latest",
43
- "@slates/client": "1.0.0-rc.8",
44
- "@slates/profiles": "1.0.0-rc.6"
43
+ "@slates/client": "1.0.0-rc.12",
44
+ "@slates/profiles": "1.0.0-rc.10"
45
45
  },
46
46
  "devDependencies": {
47
- "@slates/provider": "1.0.0-rc.12",
47
+ "@slates/provider": "1.0.0-rc.15",
48
48
  "@slates/tsconfig": "1.0.0-rc.1",
49
49
  "typescript": "5.8.2",
50
50
  "vitest": "^3.1.2",
package/src/index.test.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { openSlatesCliStore } from '@slates/profiles';
1
2
  import {
2
3
  createTextAttachment,
3
4
  Slate,
@@ -7,7 +8,6 @@ import {
7
8
  SlateTool,
8
9
  SlateTrigger
9
10
  } from '@slates/provider';
10
- import { openSlatesCliStore } from '@slates/profiles';
11
11
  import { mkdtemp, rm, writeFile } from 'fs/promises';
12
12
  import { tmpdir } from 'os';
13
13
  import path from 'path';
package/src/runtime.ts CHANGED
@@ -1,13 +1,13 @@
1
+ import type { SlatesProtocolClientOptions } from '@slates/client';
1
2
  import {
2
3
  createLocalSlateTransport,
3
4
  createSlatesClient,
4
5
  SlateProtocolError
5
6
  } from '@slates/client';
6
- import type { SlatesProtocolClientOptions } from '@slates/client';
7
7
  import {
8
8
  createSlatesClientFromProfile,
9
9
  openSlatesCliStore,
10
- SlatesProfileRecord
10
+ type SlatesProfileRecord
11
11
  } from '@slates/profiles';
12
12
  import { readFile } from 'fs/promises';
13
13
 
@@ -24,6 +24,12 @@ export interface SlatesRuntimeContext {
24
24
  export type SlatesTestClient = ReturnType<typeof createSlatesClient>;
25
25
 
26
26
  type LocalSlate = Parameters<typeof createLocalSlateTransport>[0]['slate'];
27
+ type SlatesAction = Awaited<ReturnType<SlatesTestClient['listActions']>>['actions'][number];
28
+ type SlatesToolAction = Extract<SlatesAction, { type: 'action.tool' }>;
29
+ type SlatesTriggerAction = Extract<SlatesAction, { type: 'action.trigger' }>;
30
+ type SlateAuthenticationMethod = Awaited<
31
+ ReturnType<SlatesTestClient['listAuthMethods']>
32
+ >['authenticationMethods'][number];
27
33
 
28
34
  let selectProfileAuth = (profile: SlatesProfileRecord | null, authMethodId: string | null) => {
29
35
  if (!profile || !authMethodId) {
@@ -71,10 +77,7 @@ export let getVitestExpect = () => {
71
77
  };
72
78
 
73
79
  export let loadSlatesRuntimeContext = async (
74
- opts: {
75
- cwd?: string;
76
- profile?: string | null;
77
- } = {}
80
+ opts: { cwd?: string; profile?: string | null } = {}
78
81
  ): Promise<SlatesRuntimeContext> => {
79
82
  let runtimeContextPath = process.env.SLATES_TEST_CONTEXT_PATH;
80
83
  if (runtimeContextPath) {
@@ -115,7 +118,7 @@ export let loadSlatesRuntimeContext = async (
115
118
  })
116
119
  : await openSlatesCliStore({ cwd: opts.cwd });
117
120
  let profileId = opts.profile ?? process.env.SLATES_PROFILE_ID ?? null;
118
- let authMethodId = null;
121
+ let authMethodId: any = null;
119
122
  let profile = selectProfileAuth(store.getProfile(profileId), authMethodId);
120
123
 
121
124
  return {
@@ -203,8 +206,12 @@ export let getSlateContract = async (client: SlatesTestClient) => {
203
206
  return {
204
207
  provider: provider.provider,
205
208
  actions: actions.actions,
206
- tools: actions.actions.filter(action => action.type === 'action.tool'),
207
- triggers: actions.actions.filter(action => action.type === 'action.trigger'),
209
+ tools: actions.actions.filter(
210
+ (action: SlatesAction): action is SlatesToolAction => action.type === 'action.tool'
211
+ ),
212
+ triggers: actions.actions.filter(
213
+ (action: SlatesAction): action is SlatesTriggerAction => action.type === 'action.trigger'
214
+ ),
208
215
  authMethods: authMethods.authenticationMethods,
209
216
  configSchema: configSchema.schema
210
217
  };
@@ -268,27 +275,31 @@ export let expectSlateContract = async (d: {
268
275
  }
269
276
 
270
277
  if (d.toolIds) {
271
- expect(contract.tools.map(action => action.id)).toEqual(d.toolIds);
278
+ expect(contract.tools.map((action: SlatesToolAction) => action.id)).toEqual(d.toolIds);
272
279
  }
273
280
 
274
281
  if (d.triggerIds) {
275
- expect(contract.triggers.map(action => action.id)).toEqual(d.triggerIds);
282
+ expect(contract.triggers.map((action: SlatesTriggerAction) => action.id)).toEqual(
283
+ d.triggerIds
284
+ );
276
285
  }
277
286
 
278
287
  if (d.authMethodIds) {
279
- expect(contract.authMethods.map(method => method.id)).toEqual(d.authMethodIds);
288
+ expect(contract.authMethods.map((method: SlateAuthenticationMethod) => method.id)).toEqual(
289
+ d.authMethodIds
290
+ );
280
291
  }
281
292
 
282
293
  for (let tool of d.tools ?? []) {
283
294
  expectActionMatches(
284
- contract.tools.find(action => action.id === tool.id),
295
+ contract.tools.find((action: SlatesToolAction) => action.id === tool.id),
285
296
  tool
286
297
  );
287
298
  }
288
299
 
289
300
  for (let trigger of d.triggers ?? []) {
290
301
  expectActionMatches(
291
- contract.triggers.find(action => action.id === trigger.id),
302
+ contract.triggers.find((action: SlatesTriggerAction) => action.id === trigger.id),
292
303
  trigger
293
304
  );
294
305
  }