@slates/client 1.0.0-rc.12 → 1.0.0-rc.13
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.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/package.json +4 -4
- package/src/client.test.ts +16 -10
package/dist/index.d.cts
CHANGED
|
@@ -74,6 +74,7 @@ declare class SlatesProtocolClient {
|
|
|
74
74
|
OR: string[];
|
|
75
75
|
}[];
|
|
76
76
|
} | undefined;
|
|
77
|
+
authMethods?: string[] | undefined;
|
|
77
78
|
}>;
|
|
78
79
|
getTrigger(actionId: string): Promise<{
|
|
79
80
|
id: string;
|
|
@@ -108,6 +109,7 @@ declare class SlatesProtocolClient {
|
|
|
108
109
|
OR: string[];
|
|
109
110
|
}[];
|
|
110
111
|
} | undefined;
|
|
112
|
+
authMethods?: string[] | undefined;
|
|
111
113
|
}>;
|
|
112
114
|
getConfigSchema(): Promise<SlatesMessageConfigSchemaGetResponse['result']>;
|
|
113
115
|
getDefaultConfig(): Promise<SlatesMessageConfigDefaultGetResponse['result']>;
|
package/dist/index.d.ts
CHANGED
|
@@ -74,6 +74,7 @@ declare class SlatesProtocolClient {
|
|
|
74
74
|
OR: string[];
|
|
75
75
|
}[];
|
|
76
76
|
} | undefined;
|
|
77
|
+
authMethods?: string[] | undefined;
|
|
77
78
|
}>;
|
|
78
79
|
getTrigger(actionId: string): Promise<{
|
|
79
80
|
id: string;
|
|
@@ -108,6 +109,7 @@ declare class SlatesProtocolClient {
|
|
|
108
109
|
OR: string[];
|
|
109
110
|
}[];
|
|
110
111
|
} | undefined;
|
|
112
|
+
authMethods?: string[] | undefined;
|
|
111
113
|
}>;
|
|
112
114
|
getConfigSchema(): Promise<SlatesMessageConfigSchemaGetResponse['result']>;
|
|
113
115
|
getDefaultConfig(): Promise<SlatesMessageConfigDefaultGetResponse['result']>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slates/client",
|
|
3
|
-
"version": "1.0.0-rc.
|
|
3
|
+
"version": "1.0.0-rc.13",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
"biome:check": "biome check --write src"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@slates/proto": "1.0.0-rc.
|
|
35
|
-
"@slates/provider": "1.0.0-rc.
|
|
36
|
-
"@slates/provider-handler": "1.0.0-rc.
|
|
34
|
+
"@slates/proto": "1.0.0-rc.12",
|
|
35
|
+
"@slates/provider": "1.0.0-rc.16",
|
|
36
|
+
"@slates/provider-handler": "1.0.0-rc.18"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@slates/tsconfig": "1.0.0-rc.1",
|
package/src/client.test.ts
CHANGED
|
@@ -30,15 +30,17 @@ let createDemoSlate = () => {
|
|
|
30
30
|
z.object({
|
|
31
31
|
prefix: z.string()
|
|
32
32
|
})
|
|
33
|
-
)
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
)
|
|
34
|
+
.getDefaultConfig(() => ({
|
|
35
|
+
prefix: 'Hello'
|
|
36
|
+
}))
|
|
37
|
+
.docs([
|
|
38
|
+
{
|
|
39
|
+
type: 'docs.config.general',
|
|
40
|
+
name: 'Demo config docs',
|
|
41
|
+
url: 'https://example.com/docs/config'
|
|
42
|
+
}
|
|
43
|
+
]);
|
|
42
44
|
|
|
43
45
|
let demoAuth = SlateAuth.create<{ token: string }>()
|
|
44
46
|
.output(
|
|
@@ -71,7 +73,8 @@ let createDemoSlate = () => {
|
|
|
71
73
|
getOutput: async (ctx: { input: { token: string } }) => ({
|
|
72
74
|
output: {
|
|
73
75
|
token: ctx.input.token
|
|
74
|
-
}
|
|
76
|
+
},
|
|
77
|
+
scopes: [`scope:${ctx.input.token}`]
|
|
75
78
|
}),
|
|
76
79
|
getProfile: async (ctx: { output: { token: string } }) => ({
|
|
77
80
|
profile: {
|
|
@@ -123,6 +126,7 @@ let createDemoSlate = () => {
|
|
|
123
126
|
}
|
|
124
127
|
]
|
|
125
128
|
})
|
|
129
|
+
.authMethods(['token_auth'])
|
|
126
130
|
.handleInvocation(async ctx => ({
|
|
127
131
|
output: {
|
|
128
132
|
greeting: `${ctx.config.prefix} ${ctx.input.name}`,
|
|
@@ -458,6 +462,7 @@ describe('@slates/client local transport', () => {
|
|
|
458
462
|
}
|
|
459
463
|
]
|
|
460
464
|
});
|
|
465
|
+
expect(actions[0]!.authMethods).toEqual(['token_auth']);
|
|
461
466
|
|
|
462
467
|
let configSchema = await client.getConfigSchema();
|
|
463
468
|
expect(configSchema.schema.properties.prefix.type).toBe('string');
|
|
@@ -498,6 +503,7 @@ describe('@slates/client local transport', () => {
|
|
|
498
503
|
input: changedInput.input ?? { token: '' }
|
|
499
504
|
});
|
|
500
505
|
expect(authOutput.output).toEqual({ token: 'trimmed-token' });
|
|
506
|
+
expect(authOutput.scopes).toEqual(['scope:trimmed-token']);
|
|
501
507
|
|
|
502
508
|
client.setConfig({ prefix: 'Hi' });
|
|
503
509
|
client.setAuth({
|