kodzero-front-sdk-alfa 0.0.12 → 0.0.15
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/Kodzero.d.ts +2 -0
- package/dist/Kodzero.js +6 -1
- package/dist/auth/email.d.ts +1 -1
- package/dist/auth/email.js +1 -1
- package/dist/auth/index.d.ts +1 -0
- package/package.json +1 -1
- package/src/Kodzero.ts +7 -1
- package/src/__tests__/Kodzero.test.ts +2 -1
- package/src/auth/email.ts +2 -2
- package/src/auth/index.ts +1 -0
package/dist/Kodzero.d.ts
CHANGED
|
@@ -4,9 +4,11 @@ import { ModelOptions } from "./model/BaseModel.js";
|
|
|
4
4
|
import TokensManagerClass from "./auth/tokens.js";
|
|
5
5
|
interface Options {
|
|
6
6
|
host: string;
|
|
7
|
+
collection: string;
|
|
7
8
|
}
|
|
8
9
|
declare class Kodzero {
|
|
9
10
|
host: string;
|
|
11
|
+
collection: string;
|
|
10
12
|
auth: KodzeroAuth;
|
|
11
13
|
tokensManager: TokensManagerClass;
|
|
12
14
|
api: typeof FluidFetch;
|
package/dist/Kodzero.js
CHANGED
|
@@ -4,14 +4,19 @@ import createModel from "./model/createModel.js";
|
|
|
4
4
|
import TokensManagerClass from "./auth/tokens.js";
|
|
5
5
|
class Kodzero {
|
|
6
6
|
host;
|
|
7
|
+
collection;
|
|
7
8
|
auth;
|
|
8
9
|
tokensManager;
|
|
9
10
|
api;
|
|
10
11
|
constructor(options) {
|
|
11
12
|
this.tokensManager = new TokensManagerClass('', '');
|
|
13
|
+
this.collection = options.collection;
|
|
12
14
|
this.host = options.host;
|
|
13
15
|
this.api = new FluidFetch();
|
|
14
|
-
this.auth = new KodzeroAuth({
|
|
16
|
+
this.auth = new KodzeroAuth({
|
|
17
|
+
host: options.host,
|
|
18
|
+
collection: options.collection
|
|
19
|
+
}, this.api, this.tokensManager);
|
|
15
20
|
this.api.middlewares.request.use((req) => {
|
|
16
21
|
const accessToken = this.tokensManager.access;
|
|
17
22
|
if (accessToken)
|
package/dist/auth/email.d.ts
CHANGED
|
@@ -39,7 +39,7 @@ type RefreshResponse = SuccessResponse<{
|
|
|
39
39
|
}>;
|
|
40
40
|
declare class KodzeroAuthEmail extends KodzeroAuthBase {
|
|
41
41
|
tokensManager: TokensManagerClass;
|
|
42
|
-
collection:
|
|
42
|
+
collection: string;
|
|
43
43
|
constructor(options: AuthOptions, api: typeof FluidFetch, tokensManager: TokensManagerClass);
|
|
44
44
|
_setTokens: (access: string, refresh?: string) => void;
|
|
45
45
|
login: (input: KodzeroAuthEmailLogin) => Promise<LoginResponse["result"]>;
|
package/dist/auth/email.js
CHANGED
|
@@ -6,7 +6,7 @@ class KodzeroAuthEmail extends KodzeroAuthBase {
|
|
|
6
6
|
constructor(options, api, tokensManager) {
|
|
7
7
|
super(options, api, tokensManager);
|
|
8
8
|
this.tokensManager = tokensManager;
|
|
9
|
-
this.collection =
|
|
9
|
+
this.collection = `${options.collection}/password`;
|
|
10
10
|
}
|
|
11
11
|
_setTokens = (access, refresh) => {
|
|
12
12
|
this.tokensManager.setAccess(access);
|
package/dist/auth/index.d.ts
CHANGED
package/package.json
CHANGED
package/src/Kodzero.ts
CHANGED
|
@@ -6,19 +6,25 @@ import TokensManagerClass from "./auth/tokens.js"
|
|
|
6
6
|
|
|
7
7
|
interface Options {
|
|
8
8
|
host: string
|
|
9
|
+
collection: string
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
class Kodzero {
|
|
12
13
|
host: string
|
|
14
|
+
collection: string
|
|
13
15
|
auth: KodzeroAuth
|
|
14
16
|
tokensManager: TokensManagerClass
|
|
15
17
|
api: typeof FluidFetch
|
|
16
18
|
|
|
17
19
|
constructor (options: Options) {
|
|
18
20
|
this.tokensManager = new TokensManagerClass('', '')
|
|
21
|
+
this.collection = options.collection
|
|
19
22
|
this.host = options.host
|
|
20
23
|
this.api = new FluidFetch()
|
|
21
|
-
this.auth = new KodzeroAuth({
|
|
24
|
+
this.auth = new KodzeroAuth({
|
|
25
|
+
host: options.host,
|
|
26
|
+
collection: options.collection
|
|
27
|
+
}, this.api, this.tokensManager)
|
|
22
28
|
|
|
23
29
|
this.api.middlewares.request.use((req: any) => {
|
|
24
30
|
const accessToken = this.tokensManager.access
|
|
@@ -2,7 +2,8 @@ import Kodzero from '../Kodzero.js';
|
|
|
2
2
|
|
|
3
3
|
it('should create an instance if host provided', async () => {
|
|
4
4
|
const kodzero = new Kodzero({
|
|
5
|
-
host: 'http://localhost:6969'
|
|
5
|
+
host: 'http://localhost:6969',
|
|
6
|
+
collection: "_auth_"
|
|
6
7
|
});
|
|
7
8
|
|
|
8
9
|
expect(kodzero).toBeInstanceOf(Kodzero);
|
package/src/auth/email.ts
CHANGED
|
@@ -47,13 +47,13 @@ type LogoutResponse = SuccessResponse<boolean>
|
|
|
47
47
|
|
|
48
48
|
class KodzeroAuthEmail extends KodzeroAuthBase {
|
|
49
49
|
tokensManager: TokensManagerClass
|
|
50
|
-
collection:
|
|
50
|
+
collection: string
|
|
51
51
|
|
|
52
52
|
constructor(options: AuthOptions, api: typeof FluidFetch, tokensManager: TokensManagerClass) {
|
|
53
53
|
super(options, api, tokensManager)
|
|
54
54
|
|
|
55
55
|
this.tokensManager = tokensManager
|
|
56
|
-
this.collection =
|
|
56
|
+
this.collection = `${options.collection}/password`
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
/**
|