@slates/test 1.0.0-rc.6 → 1.0.0-rc.8
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 +12 -4
- package/dist/index.d.cts +14 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.module.js +12 -4
- package/package.json +6 -6
- package/src/index.test.ts +1 -1
- package/src/runtime.ts +25 -14
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(
|
|
158
|
-
|
|
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(
|
|
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(
|
|
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
|
@@ -225,6 +225,13 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
225
225
|
description?: string | undefined;
|
|
226
226
|
defaultChecked?: boolean | undefined;
|
|
227
227
|
}[] | undefined;
|
|
228
|
+
docs?: {
|
|
229
|
+
oauthDocsLink?: string | undefined;
|
|
230
|
+
oauthScopesLink?: string | undefined;
|
|
231
|
+
tokenDocsLink?: string | undefined;
|
|
232
|
+
serviceAccountDocsLink?: string | undefined;
|
|
233
|
+
customAuthDocsLink?: string | undefined;
|
|
234
|
+
} | undefined;
|
|
228
235
|
}[];
|
|
229
236
|
configSchema: Record<string, any>;
|
|
230
237
|
}>;
|
|
@@ -373,6 +380,13 @@ declare let expectSlateContract: (d: {
|
|
|
373
380
|
description?: string | undefined;
|
|
374
381
|
defaultChecked?: boolean | undefined;
|
|
375
382
|
}[] | undefined;
|
|
383
|
+
docs?: {
|
|
384
|
+
oauthDocsLink?: string | undefined;
|
|
385
|
+
oauthScopesLink?: string | undefined;
|
|
386
|
+
tokenDocsLink?: string | undefined;
|
|
387
|
+
serviceAccountDocsLink?: string | undefined;
|
|
388
|
+
customAuthDocsLink?: string | undefined;
|
|
389
|
+
} | undefined;
|
|
376
390
|
}[];
|
|
377
391
|
configSchema: Record<string, any>;
|
|
378
392
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -225,6 +225,13 @@ declare let getSlateContract: (client: SlatesTestClient) => Promise<{
|
|
|
225
225
|
description?: string | undefined;
|
|
226
226
|
defaultChecked?: boolean | undefined;
|
|
227
227
|
}[] | undefined;
|
|
228
|
+
docs?: {
|
|
229
|
+
oauthDocsLink?: string | undefined;
|
|
230
|
+
oauthScopesLink?: string | undefined;
|
|
231
|
+
tokenDocsLink?: string | undefined;
|
|
232
|
+
serviceAccountDocsLink?: string | undefined;
|
|
233
|
+
customAuthDocsLink?: string | undefined;
|
|
234
|
+
} | undefined;
|
|
228
235
|
}[];
|
|
229
236
|
configSchema: Record<string, any>;
|
|
230
237
|
}>;
|
|
@@ -373,6 +380,13 @@ declare let expectSlateContract: (d: {
|
|
|
373
380
|
description?: string | undefined;
|
|
374
381
|
defaultChecked?: boolean | undefined;
|
|
375
382
|
}[] | undefined;
|
|
383
|
+
docs?: {
|
|
384
|
+
oauthDocsLink?: string | undefined;
|
|
385
|
+
oauthScopesLink?: string | undefined;
|
|
386
|
+
tokenDocsLink?: string | undefined;
|
|
387
|
+
serviceAccountDocsLink?: string | undefined;
|
|
388
|
+
customAuthDocsLink?: string | undefined;
|
|
389
|
+
} | undefined;
|
|
376
390
|
}[];
|
|
377
391
|
configSchema: Record<string, any>;
|
|
378
392
|
}>;
|
package/dist/index.module.js
CHANGED
|
@@ -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(
|
|
125
|
-
|
|
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(
|
|
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(
|
|
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.
|
|
3
|
+
"version": "1.0.0-rc.8",
|
|
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.
|
|
44
|
-
"@slates/profiles": "1.0.0-rc.
|
|
43
|
+
"@slates/client": "1.0.0-rc.11",
|
|
44
|
+
"@slates/profiles": "1.0.0-rc.9"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@slates/provider": "1.0.0-rc.
|
|
47
|
+
"@slates/provider": "1.0.0-rc.14",
|
|
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(
|
|
207
|
-
|
|
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(
|
|
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(
|
|
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
|
}
|