@streamlayer/sdk-web-api 0.20.1 → 0.21.1
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.
|
@@ -3,7 +3,7 @@ import type { BypassAuthRequest } from '@streamlayer/sl-eslib/users/users_pb';
|
|
|
3
3
|
import { PlainMessage } from '@bufbuild/protobuf';
|
|
4
4
|
import { Transport } from '../transport';
|
|
5
5
|
export declare const $user: ($userToken: ReadableAtom<string | undefined>, transport: Transport) => import("@nanostores/query").FetcherStore<import("@streamlayer/sl-eslib/users/users_pb").MeResponse, any>;
|
|
6
|
-
export declare const bypassLogin: (transport: Transport) => ({ userKey, schema, init }: PlainMessage<BypassAuthRequest>) => Promise<import("@streamlayer/sl-eslib/users/users_pb").BypassAuthResponse>;
|
|
6
|
+
export declare const bypassLogin: (transport: Transport) => ({ userKey, schema, init, inviterKey }: PlainMessage<BypassAuthRequest>) => Promise<import("@streamlayer/sl-eslib/users/users_pb").BypassAuthResponse>;
|
|
7
7
|
export declare const bypassAuth: (transport: Transport, params: {
|
|
8
8
|
userKey?: string;
|
|
9
9
|
schema?: string;
|
package/lib/grpc/queries/user.js
CHANGED
|
@@ -14,7 +14,14 @@ export const $user = ($userToken, transport) => {
|
|
|
14
14
|
};
|
|
15
15
|
export const bypassLogin = (transport) => {
|
|
16
16
|
const { client } = transport.createPromiseClient(Users, { method: 'bypassAuth' });
|
|
17
|
-
|
|
17
|
+
// inviterKey to do add to payload
|
|
18
|
+
return async ({ userKey, schema, init, inviterKey }) => {
|
|
19
|
+
const res = await client.bypassAuth({ userKey, schema, init });
|
|
20
|
+
if (res.meta) {
|
|
21
|
+
res.meta.inviterKey = inviterKey;
|
|
22
|
+
}
|
|
23
|
+
return res;
|
|
24
|
+
};
|
|
18
25
|
};
|
|
19
26
|
export const bypassAuth = (transport, params) => {
|
|
20
27
|
const { client } = transport.createPromiseClient(Users, { method: 'bypassAuth' });
|
package/lib/grpc/transport.js
CHANGED
|
@@ -72,6 +72,15 @@ export class Transport {
|
|
|
72
72
|
subscription.disconnect();
|
|
73
73
|
this.subscriptions.delete(params);
|
|
74
74
|
}
|
|
75
|
+
this.clients.clear();
|
|
76
|
+
this.callbackClients.clear();
|
|
77
|
+
this.subscriptions.clear();
|
|
78
|
+
// ToDo: reset nanoquery instance, basically we should add connect
|
|
79
|
+
// method where setup nanoquery, transports and interceptors, not in constructor
|
|
80
|
+
const [createFetcherStore, createMutatorStore, utils] = nanoquery();
|
|
81
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
82
|
+
// @ts-ignore
|
|
83
|
+
this.nanoquery = { createFetcherStore, createMutatorStore, utils };
|
|
75
84
|
};
|
|
76
85
|
registerInterceptor = (interceptor) => {
|
|
77
86
|
this.interceptors.push(interceptor);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamlayer/sdk-web-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
@@ -21,14 +21,14 @@
|
|
|
21
21
|
}
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@streamlayer/sdk-web-interfaces": "^0.20.
|
|
24
|
+
"@streamlayer/sdk-web-interfaces": "^0.20.3"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"@bufbuild/protobuf": "^1.6.0",
|
|
28
28
|
"@connectrpc/connect": "^1.3.0",
|
|
29
29
|
"@connectrpc/connect-web": "^1.3.0",
|
|
30
30
|
"@nanostores/query": "^0.2.9",
|
|
31
|
-
"@streamlayer/sl-eslib": "^5.
|
|
31
|
+
"@streamlayer/sl-eslib": "^5.67.0",
|
|
32
32
|
"@swc/helpers": "^0.5.3",
|
|
33
33
|
"nanostores": "^0.9.5",
|
|
34
34
|
"tslib": "^2.6.2"
|