@ysk-kit/sdk 1.0.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/LICENSE +21 -0
- package/dist/http.d.ts +18 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/http.js +113 -0
- package/dist/http.js.map +1 -0
- package/dist/index.d.ts +341 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/ports/device.d.ts +5 -0
- package/dist/ports/device.d.ts.map +1 -0
- package/dist/ports/device.js +2 -0
- package/dist/ports/device.js.map +1 -0
- package/dist/ports/file-picker.d.ts +7 -0
- package/dist/ports/file-picker.d.ts.map +1 -0
- package/dist/ports/file-picker.js +2 -0
- package/dist/ports/file-picker.js.map +1 -0
- package/dist/realtime.d.ts +11 -0
- package/dist/realtime.d.ts.map +1 -0
- package/dist/realtime.js +17 -0
- package/dist/realtime.js.map +1 -0
- package/dist/resources/api-keys.d.ts +27 -0
- package/dist/resources/api-keys.d.ts.map +1 -0
- package/dist/resources/api-keys.js +9 -0
- package/dist/resources/api-keys.js.map +1 -0
- package/dist/resources/audit.d.ts +18 -0
- package/dist/resources/audit.d.ts.map +1 -0
- package/dist/resources/audit.js +13 -0
- package/dist/resources/audit.js.map +1 -0
- package/dist/resources/auth.d.ts +103 -0
- package/dist/resources/auth.d.ts.map +1 -0
- package/dist/resources/auth.js +74 -0
- package/dist/resources/auth.js.map +1 -0
- package/dist/resources/billing.d.ts +36 -0
- package/dist/resources/billing.d.ts.map +1 -0
- package/dist/resources/billing.js +20 -0
- package/dist/resources/billing.js.map +1 -0
- package/dist/resources/devices.d.ts +20 -0
- package/dist/resources/devices.d.ts.map +1 -0
- package/dist/resources/devices.js +6 -0
- package/dist/resources/devices.js.map +1 -0
- package/dist/resources/llm.d.ts +30 -0
- package/dist/resources/llm.d.ts.map +1 -0
- package/dist/resources/llm.js +49 -0
- package/dist/resources/llm.js.map +1 -0
- package/dist/resources/notifications.d.ts +20 -0
- package/dist/resources/notifications.d.ts.map +1 -0
- package/dist/resources/notifications.js +12 -0
- package/dist/resources/notifications.js.map +1 -0
- package/dist/resources/organizations.d.ts +62 -0
- package/dist/resources/organizations.d.ts.map +1 -0
- package/dist/resources/organizations.js +33 -0
- package/dist/resources/organizations.js.map +1 -0
- package/dist/resources/users.d.ts +38 -0
- package/dist/resources/users.d.ts.map +1 -0
- package/dist/resources/users.js +15 -0
- package/dist/resources/users.js.map +1 -0
- package/dist/token-store.d.ts +13 -0
- package/dist/token-store.d.ts.map +1 -0
- package/dist/token-store.js +35 -0
- package/dist/token-store.js.map +1 -0
- package/package.json +35 -0
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { CreateUserCommand } from '@ysk-kit/contracts';
|
|
2
|
+
import type { HttpClient } from '../http';
|
|
3
|
+
export declare const usersResource: (http: HttpClient) => {
|
|
4
|
+
list: (query?: {
|
|
5
|
+
cursor?: string;
|
|
6
|
+
limit?: number;
|
|
7
|
+
}) => Promise<{
|
|
8
|
+
items: {
|
|
9
|
+
id: string;
|
|
10
|
+
email: string | null;
|
|
11
|
+
phone: string | null;
|
|
12
|
+
displayName: string;
|
|
13
|
+
role: "USER" | "ADMIN" | "OPS";
|
|
14
|
+
status: "ACTIVE" | "INVITED" | "SUSPENDED" | "DELETED";
|
|
15
|
+
createdAt: string;
|
|
16
|
+
}[];
|
|
17
|
+
nextCursor: string | null;
|
|
18
|
+
}>;
|
|
19
|
+
create: (body: CreateUserCommand) => Promise<{
|
|
20
|
+
id: string;
|
|
21
|
+
email: string | null;
|
|
22
|
+
phone: string | null;
|
|
23
|
+
displayName: string;
|
|
24
|
+
role: "USER" | "ADMIN" | "OPS";
|
|
25
|
+
status: "ACTIVE" | "INVITED" | "SUSPENDED" | "DELETED";
|
|
26
|
+
createdAt: string;
|
|
27
|
+
}>;
|
|
28
|
+
suspend: (id: string) => Promise<{
|
|
29
|
+
id: string;
|
|
30
|
+
email: string | null;
|
|
31
|
+
phone: string | null;
|
|
32
|
+
displayName: string;
|
|
33
|
+
role: "USER" | "ADMIN" | "OPS";
|
|
34
|
+
status: "ACTIVE" | "INVITED" | "SUSPENDED" | "DELETED";
|
|
35
|
+
createdAt: string;
|
|
36
|
+
}>;
|
|
37
|
+
};
|
|
38
|
+
//# sourceMappingURL=users.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.d.ts","sourceRoot":"","sources":["../../src/resources/users.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAA2B,MAAM,oBAAoB,CAAC;AACrF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAU1C,eAAO,MAAM,aAAa,GAAI,MAAM,UAAU;mBAC7B;QAAE,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAA;KAAE;;;;;;;;;;;;mBAEnC,iBAAiB;;;;;;;;;kBAElB,MAAM;;;;;;;;;CAEpB,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const toQuery = (query) => {
|
|
2
|
+
const params = new URLSearchParams();
|
|
3
|
+
if (query?.cursor)
|
|
4
|
+
params.set('cursor', query.cursor);
|
|
5
|
+
if (query?.limit)
|
|
6
|
+
params.set('limit', String(query.limit));
|
|
7
|
+
const encoded = params.toString();
|
|
8
|
+
return encoded.length > 0 ? `?${encoded}` : '';
|
|
9
|
+
};
|
|
10
|
+
export const usersResource = (http) => ({
|
|
11
|
+
list: (query) => http.request(`/v1/users${toQuery(query)}`),
|
|
12
|
+
create: (body) => http.request('/v1/users', { method: 'POST', body: JSON.stringify(body) }),
|
|
13
|
+
suspend: (id) => http.request(`/v1/users/${id}/suspend`, { method: 'POST', body: '{}' }),
|
|
14
|
+
});
|
|
15
|
+
//# sourceMappingURL=users.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"users.js","sourceRoot":"","sources":["../../src/resources/users.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,GAAG,CAAC,KAA2C,EAAU,EAAE;IACtE,MAAM,MAAM,GAAG,IAAI,eAAe,EAAE,CAAC;IACrC,IAAI,KAAK,EAAE,MAAM;QAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;IACtD,IAAI,KAAK,EAAE,KAAK;QAAE,MAAM,CAAC,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3D,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClC,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACjD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,IAAgB,EAAE,EAAE,CAAC,CAAC;IAClD,IAAI,EAAE,CAAC,KAA2C,EAAE,EAAE,CACpD,IAAI,CAAC,OAAO,CAAiB,YAAY,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;IAC5D,MAAM,EAAE,CAAC,IAAuB,EAAE,EAAE,CAClC,IAAI,CAAC,OAAO,CAAU,WAAW,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC;IACpF,OAAO,EAAE,CAAC,EAAU,EAAE,EAAE,CACtB,IAAI,CAAC,OAAO,CAAU,aAAa,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;CACnF,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface TokenStore {
|
|
2
|
+
get(): Promise<string | null>;
|
|
3
|
+
set(token: string): Promise<void>;
|
|
4
|
+
clear(): Promise<void>;
|
|
5
|
+
getRefresh?(): Promise<string | null>;
|
|
6
|
+
setPair?(access: string, refresh: string): Promise<void>;
|
|
7
|
+
}
|
|
8
|
+
export declare const createWebStorageTokenStore: (keys: {
|
|
9
|
+
access: string;
|
|
10
|
+
refresh: string;
|
|
11
|
+
}) => TokenStore;
|
|
12
|
+
export declare const memoryTokenStore: () => TokenStore;
|
|
13
|
+
//# sourceMappingURL=token-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-store.d.ts","sourceRoot":"","sources":["../src/token-store.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,UAAU;IACzB,GAAG,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC9B,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAClC,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,UAAU,CAAC,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACtC,OAAO,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC1D;AAED,eAAO,MAAM,0BAA0B,GAAI,MAAM;IAC/C,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB,KAAG,UAcF,CAAC;AAEH,eAAO,MAAM,gBAAgB,QAAO,UAkBnC,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export const createWebStorageTokenStore = (keys) => ({
|
|
2
|
+
get: async () => globalThis.localStorage.getItem(keys.access),
|
|
3
|
+
set: async (token) => {
|
|
4
|
+
globalThis.localStorage.setItem(keys.access, token);
|
|
5
|
+
},
|
|
6
|
+
getRefresh: async () => globalThis.localStorage.getItem(keys.refresh),
|
|
7
|
+
setPair: async (access, refresh) => {
|
|
8
|
+
globalThis.localStorage.setItem(keys.access, access);
|
|
9
|
+
globalThis.localStorage.setItem(keys.refresh, refresh);
|
|
10
|
+
},
|
|
11
|
+
clear: async () => {
|
|
12
|
+
globalThis.localStorage.removeItem(keys.access);
|
|
13
|
+
globalThis.localStorage.removeItem(keys.refresh);
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
export const memoryTokenStore = () => {
|
|
17
|
+
let access = null;
|
|
18
|
+
let refresh = null;
|
|
19
|
+
return {
|
|
20
|
+
get: async () => access,
|
|
21
|
+
set: async (value) => {
|
|
22
|
+
access = value;
|
|
23
|
+
},
|
|
24
|
+
getRefresh: async () => refresh,
|
|
25
|
+
setPair: async (nextAccess, nextRefresh) => {
|
|
26
|
+
access = nextAccess;
|
|
27
|
+
refresh = nextRefresh;
|
|
28
|
+
},
|
|
29
|
+
clear: async () => {
|
|
30
|
+
access = null;
|
|
31
|
+
refresh = null;
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=token-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"token-store.js","sourceRoot":"","sources":["../src/token-store.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,IAG1C,EAAc,EAAE,CAAC,CAAC;IACjB,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC;IAC7D,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACnB,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;IACtD,CAAC;IACD,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC;IACrE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE;QACjC,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrD,UAAU,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACzD,CAAC;IACD,KAAK,EAAE,KAAK,IAAI,EAAE;QAChB,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAChD,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACnD,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,gBAAgB,GAAG,GAAe,EAAE;IAC/C,IAAI,MAAM,GAAkB,IAAI,CAAC;IACjC,IAAI,OAAO,GAAkB,IAAI,CAAC;IAClC,OAAO;QACL,GAAG,EAAE,KAAK,IAAI,EAAE,CAAC,MAAM;QACvB,GAAG,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACnB,MAAM,GAAG,KAAK,CAAC;QACjB,CAAC;QACD,UAAU,EAAE,KAAK,IAAI,EAAE,CAAC,OAAO;QAC/B,OAAO,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,EAAE;YACzC,MAAM,GAAG,UAAU,CAAC;YACpB,OAAO,GAAG,WAAW,CAAC;QACxB,CAAC;QACD,KAAK,EAAE,KAAK,IAAI,EAAE;YAChB,MAAM,GAAG,IAAI,CAAC;YACd,OAAO,GAAG,IAAI,CAAC;QACjB,CAAC;KACF,CAAC;AACJ,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@ysk-kit/sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"import": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@ysk-kit/contracts": "1.0.0",
|
|
15
|
+
"@ysk-kit/domain-kernel": "1.0.0",
|
|
16
|
+
"socket.io-client": "^4.8.1"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "^24.5.2",
|
|
20
|
+
"typescript": "^6.0.3",
|
|
21
|
+
"vitest": "^5.0.2"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"registry": "https://registry.npmjs.org",
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
32
|
+
"test": "vitest run --passWithNoTests",
|
|
33
|
+
"build": "tsc -p tsconfig.build.json"
|
|
34
|
+
}
|
|
35
|
+
}
|