@alliumcloud/avatar-sso-internal 2.5.5-dev.0
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/README.md +144 -0
- package/dist/config/environment.d.ts +3 -0
- package/dist/config/environment.d.ts.map +1 -0
- package/dist/config/environment.js +3 -0
- package/dist/config/environment.js.map +1 -0
- package/dist/config/index.d.ts +43 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +48 -0
- package/dist/config/index.js.map +1 -0
- package/dist/lib/CustomStorage.d.ts +20 -0
- package/dist/lib/CustomStorage.d.ts.map +1 -0
- package/dist/lib/CustomStorage.js +39 -0
- package/dist/lib/CustomStorage.js.map +1 -0
- package/dist/lib/database.d.ts +19 -0
- package/dist/lib/database.d.ts.map +1 -0
- package/dist/lib/database.js +94 -0
- package/dist/lib/database.js.map +1 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +2 -0
- package/dist/lib/utils.js.map +1 -0
- package/dist/main.d.ts +85 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +1109 -0
- package/dist/main.js.map +1 -0
- package/dist/types/index.d.ts +458 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +58 -0
package/README.md
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
# Odyssey SSO SDK
|
|
2
|
+
|
|
3
|
+
The **Odyssey SSO SDK** provides an easy way to integrate Single Sign-On (SSO) functionality, user profile management, and resource management in your browser-based applications.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @alliumcloud/avatar-sso
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import SSO from "@alliumcloud/avatar-sso";
|
|
19
|
+
|
|
20
|
+
const sso = new SSO({
|
|
21
|
+
sdkKey: process.env.NEXT_PUBLIC_SDK_KEY,
|
|
22
|
+
debug: true,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
// Login
|
|
26
|
+
sso.login("https://your-app.com/redirect");
|
|
27
|
+
|
|
28
|
+
// Exchange token from URL and get profile (put it in the root component so that it has access to the url all the time)
|
|
29
|
+
const user = await sso.exchange();
|
|
30
|
+
|
|
31
|
+
// Fetch user profile
|
|
32
|
+
const profile = await sso.fetchProfile();
|
|
33
|
+
|
|
34
|
+
// Refresh token
|
|
35
|
+
const tokens = await sso.refresh();
|
|
36
|
+
|
|
37
|
+
// Logout
|
|
38
|
+
await sso.logout("https://your-app.com/redirect");
|
|
39
|
+
|
|
40
|
+
// Listen to SDK events
|
|
41
|
+
sso.onEvents((event) => {
|
|
42
|
+
console.log("SSO Event:", event);
|
|
43
|
+
});
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## SDK Configuration
|
|
49
|
+
|
|
50
|
+
| Field | Type | Description |
|
|
51
|
+
| -------- | ------- | ---------------------------- |
|
|
52
|
+
| `sdkKey` | string | Your SSO SDK key |
|
|
53
|
+
| `debug` | boolean | Enable debug logs (optional) |
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Public Methods
|
|
58
|
+
|
|
59
|
+
### Auth
|
|
60
|
+
|
|
61
|
+
* `localLogin(email: string, password: string)`
|
|
62
|
+
* `localRegister(email: string, password: string, username: string)`
|
|
63
|
+
* `localLogout()`
|
|
64
|
+
* `login(redirectUrl: string)`
|
|
65
|
+
* `exchange()`
|
|
66
|
+
* `fetchProfile()`
|
|
67
|
+
* `refresh()`
|
|
68
|
+
* `logout(redirectUrl: string)`
|
|
69
|
+
|
|
70
|
+
### Profile
|
|
71
|
+
|
|
72
|
+
* `profileUpdate(payload: UpdateProfilePayload)`
|
|
73
|
+
* `avatarUpdate(file: File)`
|
|
74
|
+
|
|
75
|
+
### Cloth
|
|
76
|
+
|
|
77
|
+
* `clothGetAll(options?: GetClothsOptions)`
|
|
78
|
+
* `clothGetById(clothId: string)`
|
|
79
|
+
|
|
80
|
+
### Material
|
|
81
|
+
|
|
82
|
+
* `materialGetAll(options?: GetMaterialsOptions)`
|
|
83
|
+
* `materialGetById(materialId: string)`
|
|
84
|
+
|
|
85
|
+
### Skull
|
|
86
|
+
|
|
87
|
+
* `skullGetAll()`
|
|
88
|
+
* `skullGetById(skullId: string)`
|
|
89
|
+
|
|
90
|
+
### Skull Material
|
|
91
|
+
|
|
92
|
+
* `skullMaterialGetAll()`
|
|
93
|
+
* `skullMaterialGetById(id: string)`
|
|
94
|
+
|
|
95
|
+
### Body
|
|
96
|
+
|
|
97
|
+
* `bodyGetAll()`
|
|
98
|
+
* `bodyGetById(id: string)`
|
|
99
|
+
|
|
100
|
+
### Events
|
|
101
|
+
|
|
102
|
+
`onEvents(cb: Cb)` subscribes to SDK events.
|
|
103
|
+
|
|
104
|
+
**Event types:**
|
|
105
|
+
|
|
106
|
+
* **login** — user logged in
|
|
107
|
+
* **logout** — user logged out
|
|
108
|
+
* **refresh** — token refreshed
|
|
109
|
+
* **profile.fetch** — profile fetched
|
|
110
|
+
* **profile.update** — profile updated
|
|
111
|
+
* **profile-photo.update** — avatar updated
|
|
112
|
+
* **cloth.add** — cloth added
|
|
113
|
+
* **cloth.fetch-all** — all cloths fetched
|
|
114
|
+
* **cloth.fetch** — single cloth fetched
|
|
115
|
+
* **cloth.update** — cloth updated
|
|
116
|
+
* **cloth.delete** — cloth deleted
|
|
117
|
+
* **material.add** — material added
|
|
118
|
+
* **material.fetch-all** — all materials fetched
|
|
119
|
+
* **material.fetch** — single material fetched
|
|
120
|
+
* **material.update** — material updated
|
|
121
|
+
* **material.delete** — material deleted
|
|
122
|
+
* **skull.add** — skull added
|
|
123
|
+
* **skull.update** — skull updated
|
|
124
|
+
* **skull.fetch-all** — all skulls fetched
|
|
125
|
+
* **skull.fetch** — single skull fetched
|
|
126
|
+
* **skull.delete** — skull deleted
|
|
127
|
+
* **skull-material.add** — skull material added
|
|
128
|
+
* **skull-material.fetch-all** — all skull materials fetched
|
|
129
|
+
* **skull-material.fetch** — single skull material fetched
|
|
130
|
+
* **skull-material.update** — skull material updated
|
|
131
|
+
* **skull-material.delete** — skull material deleted
|
|
132
|
+
* **body.add** — body added
|
|
133
|
+
* **body.fetch-all** — all bodies fetched
|
|
134
|
+
* **body.fetch** — single body fetched
|
|
135
|
+
* **body.update** — body updated
|
|
136
|
+
* **body.delete** — body deleted
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Notes
|
|
141
|
+
|
|
142
|
+
* This SDK is **browser-only**. All methods check for the browser environment.
|
|
143
|
+
* Uses a local database (`IndexedDB`) to store tokens and user profile for session persistence.
|
|
144
|
+
* Automatically handles token refresh for API requests.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/config/environment.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,6BAA6B,CAAC;AACvD,eAAO,MAAM,YAAY,2CAA2C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"environment.js","sourceRoot":"","sources":["../../src/config/environment.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,0BAA0B,CAAC;AACvD,MAAM,CAAC,MAAM,YAAY,GAAG,wCAAwC,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Database from "../lib/database";
|
|
2
|
+
export declare const db: Database;
|
|
3
|
+
export declare const ssoClientUrl = "https://app-dev.2x22.com";
|
|
4
|
+
export declare const ssoServerUrl = "https://api-gw-dev.2x22.com/sso/api/v1";
|
|
5
|
+
export declare const actions: {
|
|
6
|
+
local_login: "local-login";
|
|
7
|
+
local_register: "local-register";
|
|
8
|
+
local_logout: "local-logout";
|
|
9
|
+
local_exchange: "local-exchange";
|
|
10
|
+
sso_exchange: "sso-exchange";
|
|
11
|
+
logout: "logout";
|
|
12
|
+
session_cleared: "session-cleared";
|
|
13
|
+
refresh: "refresh";
|
|
14
|
+
profile_fetch: "profile.fetch";
|
|
15
|
+
profile_update: "profile.update";
|
|
16
|
+
profile_photo_update: "profile-photo.update";
|
|
17
|
+
cloth_add: "cloth.add";
|
|
18
|
+
cloth_fetch_all: "cloth.fetch-all";
|
|
19
|
+
cloth_fetch: "cloth.fetch";
|
|
20
|
+
cloth_update: "cloth.update";
|
|
21
|
+
cloth_delete: "cloth.delete";
|
|
22
|
+
material_add: "material.add";
|
|
23
|
+
material_fetch_all: "material.fetch-all";
|
|
24
|
+
material_fetch: "material.fetch";
|
|
25
|
+
material_update: "material.update";
|
|
26
|
+
material_delete: "material.delete";
|
|
27
|
+
skull_add: "skull.add";
|
|
28
|
+
skull_update: "skull.update";
|
|
29
|
+
skull_fetch_all: "skull.fetch-all";
|
|
30
|
+
skull_fetch: "skull.fetch";
|
|
31
|
+
skull_delete: "skull.delete";
|
|
32
|
+
skull_material_add: "skull-material.add";
|
|
33
|
+
skull_material_fetch_all: "skull-material.fetch-all";
|
|
34
|
+
skull_material_fetch: "skull-material.fetch";
|
|
35
|
+
skull_material_update: "skull-material.update";
|
|
36
|
+
skull_material_delete: "skull-material.delete";
|
|
37
|
+
body_add: "body.add";
|
|
38
|
+
body_fetch_all: "body.fetch-all";
|
|
39
|
+
body_fetch: "body.fetch";
|
|
40
|
+
body_update: "body.update";
|
|
41
|
+
body_delete: "body.delete";
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAIvC,eAAO,MAAM,EAAE,UAIb,CAAC;AAEH,eAAO,MAAM,YAAY,6BAA4B,CAAC;AACtD,eAAO,MAAM,YAAY,2CAA4B,CAAC;AAEtD,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqCuB,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import Database from "../lib/database";
|
|
2
|
+
import * as environment from "./environment";
|
|
3
|
+
export const db = new Database({
|
|
4
|
+
dbName: "sso-sdk",
|
|
5
|
+
dbVersion: 1,
|
|
6
|
+
storeName: "credentials",
|
|
7
|
+
});
|
|
8
|
+
export const ssoClientUrl = environment?.ssoClientUrl;
|
|
9
|
+
export const ssoServerUrl = environment?.ssoServerUrl;
|
|
10
|
+
export const actions = {
|
|
11
|
+
local_login: "local-login",
|
|
12
|
+
local_register: "local-register",
|
|
13
|
+
local_logout: "local-logout",
|
|
14
|
+
local_exchange: "local-exchange",
|
|
15
|
+
sso_exchange: "sso-exchange",
|
|
16
|
+
logout: "logout",
|
|
17
|
+
session_cleared: "session-cleared",
|
|
18
|
+
refresh: "refresh",
|
|
19
|
+
profile_fetch: "profile.fetch",
|
|
20
|
+
profile_update: "profile.update",
|
|
21
|
+
profile_photo_update: "profile-photo.update",
|
|
22
|
+
cloth_add: "cloth.add",
|
|
23
|
+
cloth_fetch_all: "cloth.fetch-all",
|
|
24
|
+
cloth_fetch: "cloth.fetch",
|
|
25
|
+
cloth_update: "cloth.update",
|
|
26
|
+
cloth_delete: "cloth.delete",
|
|
27
|
+
material_add: "material.add",
|
|
28
|
+
material_fetch_all: "material.fetch-all",
|
|
29
|
+
material_fetch: "material.fetch",
|
|
30
|
+
material_update: "material.update",
|
|
31
|
+
material_delete: "material.delete",
|
|
32
|
+
skull_add: "skull.add",
|
|
33
|
+
skull_update: "skull.update",
|
|
34
|
+
skull_fetch_all: "skull.fetch-all",
|
|
35
|
+
skull_fetch: "skull.fetch",
|
|
36
|
+
skull_delete: "skull.delete",
|
|
37
|
+
skull_material_add: "skull-material.add",
|
|
38
|
+
skull_material_fetch_all: "skull-material.fetch-all",
|
|
39
|
+
skull_material_fetch: "skull-material.fetch",
|
|
40
|
+
skull_material_update: "skull-material.update",
|
|
41
|
+
skull_material_delete: "skull-material.delete",
|
|
42
|
+
body_add: "body.add",
|
|
43
|
+
body_fetch_all: "body.fetch-all",
|
|
44
|
+
body_fetch: "body.fetch",
|
|
45
|
+
body_update: "body.update",
|
|
46
|
+
body_delete: "body.delete",
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,iBAAiB,CAAC;AAEvC,OAAO,KAAK,WAAW,MAAM,eAAe,CAAC;AAE7C,MAAM,CAAC,MAAM,EAAE,GAAG,IAAI,QAAQ,CAAC;IAC7B,MAAM,EAAE,SAAS;IACjB,SAAS,EAAE,CAAC;IACZ,SAAS,EAAE,aAAa;CACzB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,EAAE,YAAY,CAAC;AACtD,MAAM,CAAC,MAAM,YAAY,GAAG,WAAW,EAAE,YAAY,CAAC;AAEtD,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,WAAW,EAAE,aAAa;IAC1B,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IAC5B,cAAc,EAAE,gBAAgB;IAChC,YAAY,EAAE,cAAc;IAC5B,MAAM,EAAE,QAAQ;IAChB,eAAe,EAAE,iBAAiB;IAClC,OAAO,EAAE,SAAS;IAClB,aAAa,EAAE,eAAe;IAC9B,cAAc,EAAE,gBAAgB;IAChC,oBAAoB,EAAE,sBAAsB;IAC5C,SAAS,EAAE,WAAW;IACtB,eAAe,EAAE,iBAAiB;IAClC,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,kBAAkB,EAAE,oBAAoB;IACxC,cAAc,EAAE,gBAAgB;IAChC,eAAe,EAAE,iBAAiB;IAClC,eAAe,EAAE,iBAAiB;IAClC,SAAS,EAAE,WAAW;IACtB,YAAY,EAAE,cAAc;IAC5B,eAAe,EAAE,iBAAiB;IAClC,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,kBAAkB,EAAE,oBAAoB;IACxC,wBAAwB,EAAE,0BAA0B;IACpD,oBAAoB,EAAE,sBAAsB;IAC5C,qBAAqB,EAAE,uBAAuB;IAC9C,qBAAqB,EAAE,uBAAuB;IAC9C,QAAQ,EAAE,UAAU;IACpB,cAAc,EAAE,gBAAgB;IAChC,UAAU,EAAE,YAAY;IACxB,WAAW,EAAE,aAAa;IAC1B,WAAW,EAAE,aAAa;CACe,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
interface StorageDriver {
|
|
2
|
+
get(key: string): string | null;
|
|
3
|
+
set(key: string, value: string): void;
|
|
4
|
+
remove(key: string): void;
|
|
5
|
+
}
|
|
6
|
+
export default class CustomStorage {
|
|
7
|
+
private readonly storage;
|
|
8
|
+
constructor(storage: StorageDriver);
|
|
9
|
+
open: () => Promise<StorageDriver>;
|
|
10
|
+
create: <T extends {
|
|
11
|
+
id: string;
|
|
12
|
+
}>(user: T) => Promise<T>;
|
|
13
|
+
getById: <T = unknown>(id: string) => Promise<T | null>;
|
|
14
|
+
getAll: () => Promise<never[]>;
|
|
15
|
+
update: <T extends Record<string, unknown>>(id: string, updates: Partial<T>) => Promise<T & Partial<T>>;
|
|
16
|
+
delete: (id: string) => Promise<boolean>;
|
|
17
|
+
reset: () => Promise<boolean>;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
20
|
+
//# sourceMappingURL=CustomStorage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomStorage.d.ts","sourceRoot":"","sources":["../../src/lib/CustomStorage.ts"],"names":[],"mappings":"AAAA,UAAU,aAAa;IACrB,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;IAChC,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,MAAM,CAAC,OAAO,OAAO,aAAa;IACpB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,aAAa;IAEnD,IAAI,+BAA4B;IAEhC,MAAM,GAAU,CAAC,SAAS;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE,EAAE,MAAM,CAAC,gBAI/C;IAEF,OAAO,GAAU,CAAC,GAAG,OAAO,EAAE,IAAI,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAM1D;IAEF,MAAM,yBAEJ;IAEF,MAAM,GAAU,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC/C,IAAI,MAAM,EACV,SAAS,OAAO,CAAC,CAAC,CAAC,6BAcnB;IAEF,MAAM,GAAU,IAAI,MAAM,sBAIxB;IAEF,KAAK,yBAIH;CACH"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export default class CustomStorage {
|
|
2
|
+
constructor(storage) {
|
|
3
|
+
this.storage = storage;
|
|
4
|
+
this.open = async () => this.storage;
|
|
5
|
+
this.create = async (user) => {
|
|
6
|
+
this.storage.set(user.id, JSON.stringify(user));
|
|
7
|
+
return user;
|
|
8
|
+
};
|
|
9
|
+
this.getById = async (id) => {
|
|
10
|
+
const item = this.storage.get(id);
|
|
11
|
+
if (!item)
|
|
12
|
+
return null;
|
|
13
|
+
return JSON.parse(item);
|
|
14
|
+
};
|
|
15
|
+
this.getAll = async () => {
|
|
16
|
+
return [];
|
|
17
|
+
};
|
|
18
|
+
this.update = async (id, updates) => {
|
|
19
|
+
const item = await this.getById(id);
|
|
20
|
+
if (!item)
|
|
21
|
+
throw new Error("User not found");
|
|
22
|
+
const updatedItem = {
|
|
23
|
+
...item,
|
|
24
|
+
...updates,
|
|
25
|
+
};
|
|
26
|
+
this.storage.set(id, JSON.stringify(updatedItem));
|
|
27
|
+
return updatedItem;
|
|
28
|
+
};
|
|
29
|
+
this.delete = async (id) => {
|
|
30
|
+
this.storage.remove(id);
|
|
31
|
+
return true;
|
|
32
|
+
};
|
|
33
|
+
this.reset = async () => {
|
|
34
|
+
this.storage.remove("local-user");
|
|
35
|
+
return true;
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=CustomStorage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CustomStorage.js","sourceRoot":"","sources":["../../src/lib/CustomStorage.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,OAAO,aAAa;IAChC,YAA6B,OAAsB;QAAtB,YAAO,GAAP,OAAO,CAAe;QAEnD,SAAI,GAAG,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC;QAEhC,WAAM,GAAG,KAAK,EAA4B,IAAO,EAAE,EAAE;YACnD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;YAEhD,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;QAEF,YAAO,GAAG,KAAK,EAAe,EAAU,EAAqB,EAAE;YAC7D,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAElC,IAAI,CAAC,IAAI;gBAAE,OAAO,IAAI,CAAC;YAEvB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAM,CAAC;QAC/B,CAAC,CAAC;QAEF,WAAM,GAAG,KAAK,IAAI,EAAE;YAClB,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC;QAEF,WAAM,GAAG,KAAK,EACZ,EAAU,EACV,OAAmB,EACnB,EAAE;YACF,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,OAAO,CAAI,EAAE,CAAC,CAAC;YAEvC,IAAI,CAAC,IAAI;gBAAE,MAAM,IAAI,KAAK,CAAC,gBAAgB,CAAC,CAAC;YAE7C,MAAM,WAAW,GAAG;gBAClB,GAAG,IAAI;gBACP,GAAG,OAAO;aACX,CAAC;YAEF,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,EAAE,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC;YAElD,OAAO,WAAW,CAAC;QACrB,CAAC,CAAC;QAEF,WAAM,GAAG,KAAK,EAAE,EAAU,EAAE,EAAE;YAC5B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAExB,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;QAEF,UAAK,GAAG,KAAK,IAAI,EAAE;YACjB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;YAElC,OAAO,IAAI,CAAC;QACd,CAAC,CAAC;IAlDoD,CAAC;CAmDxD"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export default class Database {
|
|
2
|
+
private readonly config;
|
|
3
|
+
constructor(config: {
|
|
4
|
+
dbName: string;
|
|
5
|
+
dbVersion: number;
|
|
6
|
+
storeName: string;
|
|
7
|
+
});
|
|
8
|
+
open: () => Promise<IDBDatabase>;
|
|
9
|
+
create: (user: {
|
|
10
|
+
id: string;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}) => Promise<unknown>;
|
|
13
|
+
getById: <T = unknown>(id: string) => Promise<T | null>;
|
|
14
|
+
getAll: () => Promise<unknown>;
|
|
15
|
+
update: (id: string, updates: Partial<Record<string, any>>) => Promise<unknown>;
|
|
16
|
+
delete: (id: string) => Promise<unknown>;
|
|
17
|
+
reset: () => Promise<unknown>;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=database.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/lib/database.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,QAAQ;IAEzB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;QAClB,SAAS,EAAE,MAAM,CAAC;KACnB;IAGH,IAAI,QAAO,OAAO,CAAC,WAAW,CAAC,CAiB7B;IAGF,MAAM,GAAU,MAAM;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KAAE,sBAYtD;IAEF,OAAO,GAAU,CAAC,GAAG,OAAO,EAAE,IAAI,MAAM,KAAG,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAY1D;IAEF,MAAM,yBAYJ;IAGF,MAAM,GAAU,IAAI,MAAM,EAAE,SAAS,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,sBA4B/D;IAEF,MAAM,GAAU,IAAI,MAAM,sBAYxB;IAEF,KAAK,yBAYH;CACH"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
export default class Database {
|
|
2
|
+
constructor(config) {
|
|
3
|
+
this.config = config;
|
|
4
|
+
this.open = () => {
|
|
5
|
+
return new Promise((resolve, reject) => {
|
|
6
|
+
const request = indexedDB.open(this.config.dbName, this.config.dbVersion);
|
|
7
|
+
request.onerror = () => reject(request.error);
|
|
8
|
+
request.onupgradeneeded = () => {
|
|
9
|
+
const db = request.result;
|
|
10
|
+
if (!db.objectStoreNames.contains(this.config.storeName))
|
|
11
|
+
db.createObjectStore(this.config.storeName, {
|
|
12
|
+
keyPath: "id",
|
|
13
|
+
});
|
|
14
|
+
};
|
|
15
|
+
request.onsuccess = () => resolve(request.result);
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
19
|
+
this.create = async (user) => {
|
|
20
|
+
const db = await this.open();
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
const tx = db.transaction(this.config.storeName, "readwrite");
|
|
23
|
+
const store = tx.objectStore(this.config.storeName);
|
|
24
|
+
const request = store.add(user);
|
|
25
|
+
request.onsuccess = () => resolve(user);
|
|
26
|
+
request.onerror = () => reject(request.error);
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
this.getById = async (id) => {
|
|
30
|
+
const db = await this.open();
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
const tx = db.transaction(this.config.storeName, "readonly");
|
|
33
|
+
const store = tx.objectStore(this.config.storeName);
|
|
34
|
+
const request = store.get(id) ?? null;
|
|
35
|
+
request.onsuccess = () => resolve(request.result);
|
|
36
|
+
request.onerror = () => reject(request.error);
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
this.getAll = async () => {
|
|
40
|
+
const db = await this.open();
|
|
41
|
+
return new Promise((resolve, reject) => {
|
|
42
|
+
const tx = db.transaction(this.config.storeName, "readonly");
|
|
43
|
+
const store = tx.objectStore(this.config.storeName);
|
|
44
|
+
const request = store.getAll();
|
|
45
|
+
request.onsuccess = () => resolve(request.result);
|
|
46
|
+
request.onerror = () => reject(request.error);
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
+
this.update = async (id, updates) => {
|
|
51
|
+
const db = await this.open();
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
const tx = db.transaction(this.config.storeName, "readwrite");
|
|
54
|
+
const store = tx.objectStore(this.config.storeName);
|
|
55
|
+
const getReq = store.get(id);
|
|
56
|
+
getReq.onerror = () => reject(getReq.error);
|
|
57
|
+
getReq.onsuccess = () => {
|
|
58
|
+
if (!getReq.result) {
|
|
59
|
+
reject(new Error("User not found"));
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const updatedUser = {
|
|
63
|
+
...getReq.result,
|
|
64
|
+
...updates,
|
|
65
|
+
};
|
|
66
|
+
const putReq = store.put(updatedUser);
|
|
67
|
+
putReq.onsuccess = () => resolve(updatedUser);
|
|
68
|
+
putReq.onerror = () => reject(putReq.error);
|
|
69
|
+
};
|
|
70
|
+
});
|
|
71
|
+
};
|
|
72
|
+
this.delete = async (id) => {
|
|
73
|
+
const db = await this.open();
|
|
74
|
+
return new Promise((resolve, reject) => {
|
|
75
|
+
const tx = db.transaction(this.config.storeName, "readwrite");
|
|
76
|
+
const store = tx.objectStore(this.config.storeName);
|
|
77
|
+
const request = store.delete(id);
|
|
78
|
+
request.onsuccess = () => resolve(true);
|
|
79
|
+
request.onerror = () => reject(request.error);
|
|
80
|
+
});
|
|
81
|
+
};
|
|
82
|
+
this.reset = async () => {
|
|
83
|
+
const db = await this.open();
|
|
84
|
+
return new Promise((resolve, reject) => {
|
|
85
|
+
const tx = db.transaction(this.config.storeName, "readwrite");
|
|
86
|
+
const store = tx.objectStore(this.config.storeName);
|
|
87
|
+
const request = store.clear();
|
|
88
|
+
request.onsuccess = () => resolve(true);
|
|
89
|
+
request.onerror = () => reject(request.error);
|
|
90
|
+
});
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=database.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"database.js","sourceRoot":"","sources":["../../src/lib/database.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,OAAO,OAAO,QAAQ;IAC3B,YACmB,MAIhB;QAJgB,WAAM,GAAN,MAAM,CAItB;QAGH,SAAI,GAAG,GAAyB,EAAE;YAChC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;gBACrC,MAAM,OAAO,GAAG,SAAS,CAAC,I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CAAC,OAAO,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;YAChD,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IAzHC,CAAC;CA0HL"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,eAAsC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/lib/utils.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,OAAO,MAAM,KAAK,WAAW,CAAC"}
|
package/dist/main.d.ts
ADDED
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import CustomStorage from "./lib/CustomStorage";
|
|
2
|
+
import Database from "./lib/database";
|
|
3
|
+
import { Body, Cb, Cloth, Config, DBRes, Exchange, GetClothsOptions, GetMaterialsOptions, LocalRegister, LocalRegisterPayload, LoginPayload, Material, Profile, RefToken, Skull, SkullMaterial, UpdateProfilePayload, UpdateProfilePicture, VerifyOtpPayload } from "./types";
|
|
4
|
+
export type * from "./types";
|
|
5
|
+
export { default as CustomStorage } from "./lib/CustomStorage";
|
|
6
|
+
export default class SSO {
|
|
7
|
+
private readonly config;
|
|
8
|
+
readonly serviceType = "AVATAR_SSO";
|
|
9
|
+
protected readonly db: Database | CustomStorage;
|
|
10
|
+
protected ssoClientUrl: string;
|
|
11
|
+
protected ssoServerUrl: string;
|
|
12
|
+
readonly sdkKey: string;
|
|
13
|
+
readonly dbId = "local-user";
|
|
14
|
+
private callbacks;
|
|
15
|
+
private cb;
|
|
16
|
+
constructor(config: Config);
|
|
17
|
+
readonly register: (payload: LocalRegisterPayload) => Promise<LocalRegister>;
|
|
18
|
+
private readonly localLogin;
|
|
19
|
+
private readonly ssoLogin;
|
|
20
|
+
/**
|
|
21
|
+
* Login function that triggers both local and SSO login flows. If the payload is a string, it will trigger the SSO login flow with the payload as the redirect URL. If the payload is an object, it will trigger the local login flow with the payload as the login data.
|
|
22
|
+
* @param payload just redirect URL string for SSO login or LocalLoginPayload for local login
|
|
23
|
+
* @returns
|
|
24
|
+
*/
|
|
25
|
+
readonly login: (payload: LoginPayload) => Promise<void>;
|
|
26
|
+
private readonly decodeJwtPayload;
|
|
27
|
+
/**
|
|
28
|
+
* - it throws.
|
|
29
|
+
*/
|
|
30
|
+
private readonly autoRefresh;
|
|
31
|
+
private readonly localExchange;
|
|
32
|
+
readonly verifyOtp: (payload: VerifyOtpPayload) => Promise<Exchange>;
|
|
33
|
+
private readonly ssoExchange;
|
|
34
|
+
/**
|
|
35
|
+
* - this will just skip the exchange returning null if the query params are not correct and won't throw an error.
|
|
36
|
+
*/
|
|
37
|
+
readonly exchange: () => Promise<Exchange | null>;
|
|
38
|
+
readonly fetchProfile: () => Promise<Profile>;
|
|
39
|
+
readonly refresh: () => Promise<RefToken>;
|
|
40
|
+
private readonly localLogout;
|
|
41
|
+
private readonly ssoLogout;
|
|
42
|
+
/**
|
|
43
|
+
* - If a redirect URL is provided, it will trigger the SSO logout flow and redirect the user to the provided URL after logout.
|
|
44
|
+
* - If no redirect URL is provided, it will trigger the local logout flow and clear the user data from IndexedDB.
|
|
45
|
+
*/
|
|
46
|
+
readonly logout: (redirectUrl?: string) => Promise<Boolean>;
|
|
47
|
+
readonly onEvents: (cb: Cb) => () => boolean;
|
|
48
|
+
protected readonly withRefresh: (api: (aT: string) => Promise<Response>) => Promise<Response>;
|
|
49
|
+
readonly profileUpdate: (payload: UpdateProfilePayload) => Promise<Profile>;
|
|
50
|
+
readonly avatarUpdate: (file: File) => Promise<UpdateProfilePicture>;
|
|
51
|
+
private readonly fileUpload;
|
|
52
|
+
private readonly clothAdd;
|
|
53
|
+
readonly clothGetAll: (options?: GetClothsOptions) => Promise<Cloth[]>;
|
|
54
|
+
readonly clothGetById: (clothId: string) => Promise<Cloth>;
|
|
55
|
+
private readonly clothUpdate;
|
|
56
|
+
private readonly clothDelete;
|
|
57
|
+
private readonly materialAdd;
|
|
58
|
+
readonly materialGetAll: (options?: GetMaterialsOptions) => Promise<Material[]>;
|
|
59
|
+
readonly materialGetById: (materialId: string) => Promise<Material>;
|
|
60
|
+
private readonly materialUpdate;
|
|
61
|
+
private readonly materialDelete;
|
|
62
|
+
private readonly skullAdd;
|
|
63
|
+
private readonly skullUpdate;
|
|
64
|
+
readonly skullGetAll: () => Promise<Skull[]>;
|
|
65
|
+
readonly skullGetById: (skullId: string) => Promise<Skull>;
|
|
66
|
+
private readonly skullDelete;
|
|
67
|
+
private readonly skullMaterialAdd;
|
|
68
|
+
readonly skullMaterialGetAll: () => Promise<SkullMaterial[]>;
|
|
69
|
+
readonly skullMaterialGetById: (id: string) => Promise<SkullMaterial>;
|
|
70
|
+
private readonly skullMaterialUpdate;
|
|
71
|
+
private readonly skullMaterialDelete;
|
|
72
|
+
private readonly bodyAdd;
|
|
73
|
+
readonly bodyGetAll: () => Promise<Body[]>;
|
|
74
|
+
readonly bodyGetById: (id: string) => Promise<Body>;
|
|
75
|
+
private readonly bodyUpdate;
|
|
76
|
+
private readonly bodyDelete;
|
|
77
|
+
private validatedUrl;
|
|
78
|
+
private emailVerificationQuery;
|
|
79
|
+
private throwIfNotBrowser;
|
|
80
|
+
/**
|
|
81
|
+
* get user from indexedDB without validating tokens.
|
|
82
|
+
*/
|
|
83
|
+
readonly getLocalUser: () => Promise<DBRes>;
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=main.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AACA,OAAO,aAAa,MAAM,qBAAqB,CAAC;AAChD,OAAO,QAAQ,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAOL,IAAI,EAKJ,EAAE,EACF,KAAK,EACL,MAAM,EACN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