@lark-apaas/dataloom 0.1.2-alpha.1 → 0.1.2-alpha.3
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/lib/DataloomClient.d.ts +1 -1
- package/lib/DataloomClient.d.ts.map +1 -1
- package/lib/DataloomClient.js +1 -6
- package/lib/service/index.d.ts +14 -5
- package/lib/service/index.d.ts.map +1 -1
- package/lib/service/index.js +29 -6
- package/lib/service/types.d.ts +13 -0
- package/lib/service/types.d.ts.map +1 -0
- package/lib/storage/StorageClient.d.ts.map +1 -1
- package/lib/storage/StorageClient.js +5 -1
- package/lib/storage/libs/constants.d.ts +4 -0
- package/lib/storage/libs/constants.d.ts.map +1 -0
- package/lib/storage/libs/constants.js +5 -0
- package/lib/storage/libs/index.d.ts +1 -0
- package/lib/storage/libs/index.d.ts.map +1 -1
- package/lib/storage/libs/index.js +1 -0
- package/lib/storage/libs/version.d.ts +2 -0
- package/lib/storage/libs/version.d.ts.map +1 -0
- package/lib/storage/libs/version.js +2 -0
- package/lib/utils/slardar.d.ts.map +1 -1
- package/lib/utils/slardar.js +1 -15
- package/lib/utils/types.d.ts +13 -0
- package/lib/utils/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/lib/service/services/DataloomServiceBase.d.ts +0 -17
- package/lib/service/services/DataloomServiceBase.d.ts.map +0 -1
- package/lib/service/services/DataloomServiceBase.js +0 -126
- package/lib/service/services/session-service/index.d.ts +0 -45
- package/lib/service/services/session-service/index.d.ts.map +0 -1
- package/lib/service/services/session-service/index.js +0 -137
- package/lib/service/services/session-service/types.d.ts +0 -34
- package/lib/service/services/session-service/types.d.ts.map +0 -1
- package/lib/service/services/types.d.ts +0 -12
- package/lib/service/services/types.d.ts.map +0 -1
- package/lib/service/services/types.js +0 -14
- package/lib/service/services/user-service/index.d.ts +0 -9
- package/lib/service/services/user-service/index.d.ts.map +0 -1
- package/lib/service/services/user-service/index.js +0 -60
- package/lib/service/services/user-service/types.d.ts +0 -51
- package/lib/service/services/user-service/types.d.ts.map +0 -1
- package/lib/service/services/user-service/types.js +0 -0
- package/lib/service/utils/helpers.d.ts +0 -8
- package/lib/service/utils/helpers.d.ts.map +0 -1
- package/lib/service/utils/helpers.js +0 -18
- package/lib/service/utils/logger.d.ts +0 -15
- package/lib/service/utils/logger.d.ts.map +0 -1
- package/lib/service/utils/logger.js +0 -18
- package/lib/service/utils/trace-id.d.ts +0 -45
- package/lib/service/utils/trace-id.d.ts.map +0 -1
- package/lib/service/utils/trace-id.js +0 -20
- package/lib/service/utils/types.d.ts +0 -49
- package/lib/service/utils/types.d.ts.map +0 -1
- package/lib/service/utils/types.js +0 -7
- /package/lib/service/{services/session-service/types.js → types.js} +0 -0
package/lib/DataloomClient.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import RateLimiter from './RateLimiter';
|
|
|
2
2
|
import DataloomService from './service';
|
|
3
3
|
import { StorageClient } from './storage';
|
|
4
4
|
import type { DataloomClientOptions, Fetch } from './utils/types';
|
|
5
|
-
import type { OnRequestErrorType } from './
|
|
5
|
+
import type { OnRequestErrorType } from './storage/libs/types';
|
|
6
6
|
/**
|
|
7
7
|
* Dataloom Client.
|
|
8
8
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DataloomClient.d.ts","sourceRoot":"","sources":["../src/DataloomClient.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,eAAe,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAK1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"DataloomClient.d.ts","sourceRoot":"","sources":["../src/DataloomClient.ts"],"names":[],"mappings":"AAAA,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,eAAe,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAK1C,OAAO,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAClE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,cAAc;IAmB/B,SAAS,CAAC,WAAW,EAAE,MAAM;IAC7B,SAAS,CAAC,WAAW,EAAE,MAAM;IAnB/B,OAAO,EAAE,eAAe,CAAC;IACzB,OAAO,EAAE,aAAa,CAAC;IAEvB,SAAS,CAAC,UAAU,EAAE,MAAM,CAAC;IAC7B,SAAS,CAAC,KAAK,CAAC,EAAE,KAAK,CAAC;IACxB,SAAS,CAAC,WAAW,CAAC,EAAE,WAAW,CAAC;IACpC,SAAS,CAAC,cAAc,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;IAE9D,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE1C;;;;;;OAMG;gBAES,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,EAC7B,OAAO,CAAC,EAAE,qBAAqB;CAqDlC"}
|
package/lib/DataloomClient.js
CHANGED
|
@@ -27,12 +27,7 @@ class DataloomClient {
|
|
|
27
27
|
if (settings.global.requestRateLimit && settings.global.requestRateLimit > 0) this.rateLimiter = new RateLimiter(settings.global.requestRateLimit);
|
|
28
28
|
this.fetch = fetchWithAuth(dataloomKey, this.rateLimiter, settings.global.fetch);
|
|
29
29
|
this.service = new service({
|
|
30
|
-
|
|
31
|
-
fetch: this.fetch,
|
|
32
|
-
logger: settings.global.enableDataloomLog,
|
|
33
|
-
brandName: settings.global.brandName,
|
|
34
|
-
appId: settings.global.appId,
|
|
35
|
-
onRequestError: this.onRequestError
|
|
30
|
+
accountServices: settings.global.accountServices
|
|
36
31
|
});
|
|
37
32
|
this.storage = new StorageClient(this.storageUrl, this.headers, this.fetch, {
|
|
38
33
|
enableLogger: settings.global.enableDataloomLog,
|
package/lib/service/index.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { AccountServicesInjection } from './types';
|
|
2
|
+
export interface DataloomServiceOptions {
|
|
3
|
+
accountServices?: AccountServicesInjection;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Service 实现已迁移到 @lark-apaas/auth-sdk。
|
|
7
|
+
* dataloom v0.2.x 仅保留壳层做兼容(实例由 client-toolkit 在创建时注入),
|
|
8
|
+
* v0.3.0 计划移除。
|
|
9
|
+
*/
|
|
4
10
|
export default class DataloomService {
|
|
5
|
-
|
|
6
|
-
|
|
11
|
+
/** @deprecated 见 DataloomService 注释 */
|
|
12
|
+
readonly user: unknown;
|
|
13
|
+
/** @deprecated 见 DataloomService 注释 */
|
|
14
|
+
readonly session: unknown;
|
|
7
15
|
constructor(options: DataloomServiceOptions);
|
|
8
16
|
}
|
|
17
|
+
export type { AccountServicesInjection };
|
|
9
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/service/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAExD,MAAM,WAAW,sBAAsB;IACrC,eAAe,CAAC,EAAE,wBAAwB,CAAC;CAC5C;AAwCD;;;;GAIG;AACH,MAAM,CAAC,OAAO,OAAO,eAAe;IAClC,uCAAuC;IACvC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,uCAAuC;IACvC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;gBAEd,OAAO,EAAE,sBAAsB;CAU5C;AAED,YAAY,EAAE,wBAAwB,EAAE,CAAC"}
|
package/lib/service/index.js
CHANGED
|
@@ -1,11 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
const MIGRATION_HINT = "[dataloom] service.user / service.session has moved to @lark-apaas/auth-sdk in v0.2.0.\nUse `authClient` from @lark-apaas/client-toolkit/auth (or @lark-apaas/auth-sdk), e.g.:\n import { authClient } from '@lark-apaas/client-toolkit/auth';\n await authClient.user.search({ name: '张三' });\nIf you really need to keep using dataloom.service.*, ensure client-toolkit injects accountServices when constructing DataloomClient.";
|
|
2
|
+
const ALLOWED_REFLECTION_KEYS = new Set([
|
|
3
|
+
'constructor',
|
|
4
|
+
'then',
|
|
5
|
+
'toJSON',
|
|
6
|
+
'toString',
|
|
7
|
+
'asymmetricMatch',
|
|
8
|
+
'nodeType',
|
|
9
|
+
'tagName',
|
|
10
|
+
'Symbol(Symbol.toPrimitive)',
|
|
11
|
+
'$$typeof'
|
|
12
|
+
]);
|
|
13
|
+
const createUninjectedStub = (key)=>new Proxy({}, {
|
|
14
|
+
get (_target, prop) {
|
|
15
|
+
if ('symbol' == typeof prop) return;
|
|
16
|
+
if (ALLOWED_REFLECTION_KEYS.has(prop)) return;
|
|
17
|
+
return (..._args)=>{
|
|
18
|
+
throw new Error(`[dataloom] service.${key}.${String(prop)} ${MIGRATION_HINT}`);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
});
|
|
4
22
|
class DataloomService {
|
|
5
23
|
constructor(options){
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
24
|
+
const injected = options.accountServices;
|
|
25
|
+
if (injected) {
|
|
26
|
+
this.user = injected.user;
|
|
27
|
+
this.session = injected.session;
|
|
28
|
+
} else {
|
|
29
|
+
this.user = createUninjectedStub('user');
|
|
30
|
+
this.session = createUninjectedStub('session');
|
|
31
|
+
}
|
|
9
32
|
}
|
|
10
33
|
}
|
|
11
34
|
export { DataloomService as default };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 注入到 DataloomService 的 account services 引用。
|
|
3
|
+
*
|
|
4
|
+
* dataloom v0.2.0 起,service.user/session 的实现迁出至 @lark-apaas/auth-sdk。
|
|
5
|
+
* 此接口仅定义"形状契约",不 import auth-sdk,依赖方向单向解耦。
|
|
6
|
+
*
|
|
7
|
+
* 由 client-toolkit 在创建 DataloomClient 时通过 options.global.accountServices 注入。
|
|
8
|
+
*/
|
|
9
|
+
export interface AccountServicesInjection {
|
|
10
|
+
user: unknown;
|
|
11
|
+
session: unknown;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/service/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,OAAO,CAAC;CAClB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StorageClient.d.ts","sourceRoot":"","sources":["../../src/storage/StorageClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"StorageClient.d.ts","sourceRoot":"","sources":["../../src/storage/StorageClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,cAAc,MAAM,2BAA2B,CAAC;AAEvD,MAAM,WAAW,oBAAoB;IACnC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACrD;AAED,qBAAa,aAAa;IACxB,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC;IACtB,SAAS,CAAC,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC7C,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IACvB,SAAS,CAAC,aAAa,CAAC,EAAE,OAAO,CAAC;IAClC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;gBAG7D,GAAG,EAAE,MAAM,EACX,OAAO,GAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAO,EACvC,KAAK,CAAC,EAAE,KAAK,EACb,IAAI,CAAC,EAAE,oBAAoB;IAa7B;;;;OAIG;IACH,IAAI,CAAC,EAAE,EAAE,MAAM,GAAG,cAAc;CAWjC"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { DEFAULT_HEADERS } from "./libs/constants.js";
|
|
1
2
|
import { resolveFetch } from "./libs/helpers.js";
|
|
2
3
|
import StorageFileApi from "./packages/StorageFileApi.js";
|
|
3
4
|
class StorageClient {
|
|
4
5
|
constructor(url, headers = {}, fetch, opts){
|
|
5
6
|
this.url = url;
|
|
6
|
-
this.headers =
|
|
7
|
+
this.headers = {
|
|
8
|
+
...DEFAULT_HEADERS,
|
|
9
|
+
...headers
|
|
10
|
+
};
|
|
7
11
|
this.fetch = resolveFetch(fetch);
|
|
8
12
|
this.onRequestError = opts?.onRequestError;
|
|
9
13
|
this.appId = opts?.appId;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/storage/libs/constants.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,eAAe;;CAA+C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/libs/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/storage/libs/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../../src/storage/libs/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slardar.d.ts","sourceRoot":"","sources":["../../src/utils/slardar.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"slardar.d.ts","sourceRoot":"","sources":["../../src/utils/slardar.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,uBAAuB,GAClC,OAAO,OAAO,EACd,OAAO,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,SAY/B,CAAC"}
|
package/lib/utils/slardar.js
CHANGED
|
@@ -1,29 +1,15 @@
|
|
|
1
1
|
import { slardar } from "@lark-apaas/internal-slardar";
|
|
2
|
-
import { version } from "../../package.json";
|
|
3
2
|
const toRecordString = (record)=>Object.fromEntries(Object.entries(record).filter(([, value])=>null != value).map(([key, value])=>[
|
|
4
3
|
key,
|
|
5
4
|
String(value)
|
|
6
5
|
]));
|
|
7
|
-
function toNativeError(error) {
|
|
8
|
-
if (error instanceof Error) {
|
|
9
|
-
if (Object.prototype.isPrototypeOf.call(Error.prototype, error)) return error;
|
|
10
|
-
const native = new Error(error.message);
|
|
11
|
-
native.stack = error.stack;
|
|
12
|
-
native.name = error.name;
|
|
13
|
-
return native;
|
|
14
|
-
}
|
|
15
|
-
if ('string' == typeof error) return new Error(error);
|
|
16
|
-
if ('object' == typeof error && null !== error && 'message' in error) return new Error(String(error.message));
|
|
17
|
-
return new Error(String(error));
|
|
18
|
-
}
|
|
19
6
|
const reportDataloomException = (error, extra)=>{
|
|
20
7
|
try {
|
|
21
8
|
const categories = toRecordString({
|
|
22
9
|
source: 'dataloom',
|
|
23
|
-
sdkVersion: version,
|
|
24
10
|
...extra
|
|
25
11
|
});
|
|
26
|
-
slardar.captureException(
|
|
12
|
+
slardar.captureException(error, categories);
|
|
27
13
|
} catch {}
|
|
28
14
|
};
|
|
29
15
|
export { reportDataloomException };
|
package/lib/utils/types.d.ts
CHANGED
|
@@ -30,6 +30,19 @@ export type DataloomClientOptions = {
|
|
|
30
30
|
* Optional. The global hook that will be called when a request fails.
|
|
31
31
|
*/
|
|
32
32
|
onError?: OnError;
|
|
33
|
+
/**
|
|
34
|
+
* 由 client-toolkit 注入的 account services 引用(user/session)。
|
|
35
|
+
* dataloom v0.2.0 起,service.user/session 的实现迁出至 @lark-apaas/auth-sdk;
|
|
36
|
+
* 老调用方式 `(await getDataloom()).service.user/session` 仍可用,但底层实例由本字段提供。
|
|
37
|
+
*
|
|
38
|
+
* 直接构造 DataloomClient(不通过 toolkit)时若未传此字段,访问 service.user/session 会抛错并指向迁移文档。
|
|
39
|
+
*
|
|
40
|
+
* @see docs/superpowers/specs/2026-05-13-auth-sdk-account-services-split-design.md §4.4
|
|
41
|
+
*/
|
|
42
|
+
accountServices?: {
|
|
43
|
+
user: unknown;
|
|
44
|
+
session: unknown;
|
|
45
|
+
};
|
|
33
46
|
};
|
|
34
47
|
};
|
|
35
48
|
//# sourceMappingURL=types.d.ts.map
|
package/lib/utils/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAExF,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;AAElE,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,SAAS,EAAE,MAAM,CAAC;QAClB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,KAAK,CAAC,EAAE,KAAK,CAAC;QACd;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEjC;;WAEG;QACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAE5B;;WAEG;QACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAE1B;;WAEG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAExF,MAAM,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;AAElE,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,CAAC,EAAE;QACP;;WAEG;QACH,SAAS,EAAE,MAAM,CAAC;QAClB;;WAEG;QACH,KAAK,EAAE,MAAM,CAAC;QACd;;WAEG;QACH,KAAK,CAAC,EAAE,KAAK,CAAC;QACd;;WAEG;QACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAEjC;;WAEG;QACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;QAE5B;;WAEG;QACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAE1B;;WAEG;QACH,OAAO,CAAC,EAAE,OAAO,CAAC;QAElB;;;;;;;;WAQG;QACH,eAAe,CAAC,EAAE;YAChB,IAAI,EAAE,OAAO,CAAC;YACd,OAAO,EAAE,OAAO,CAAC;SAClB,CAAC;KACH,CAAC;CACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { type DataloomServiceOptions, type DataloomServiceResponse, type ExtraInfo, type Fetch, type FetchOptions, type OnRequestErrorType, ServiceName } from '../utils/types';
|
|
2
|
-
export default abstract class DataloomServiceBase {
|
|
3
|
-
protected baseUrl: string;
|
|
4
|
-
protected headers: {
|
|
5
|
-
[key: string]: string;
|
|
6
|
-
};
|
|
7
|
-
protected fetch: Fetch;
|
|
8
|
-
protected logger: boolean;
|
|
9
|
-
protected serviceName: ServiceName;
|
|
10
|
-
protected brandId: string;
|
|
11
|
-
protected bizSource: string;
|
|
12
|
-
protected appId: string;
|
|
13
|
-
protected onRequestError?: (error: OnRequestErrorType) => void;
|
|
14
|
-
constructor(baseUrl: string, options: DataloomServiceOptions);
|
|
15
|
-
fetchData<T>(url: string, options: FetchOptions, extras?: ExtraInfo): Promise<DataloomServiceResponse<T>>;
|
|
16
|
-
}
|
|
17
|
-
//# sourceMappingURL=DataloomServiceBase.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"DataloomServiceBase.d.ts","sourceRoot":"","sources":["../../../src/service/services/DataloomServiceBase.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC5B,KAAK,SAAS,EACd,KAAK,KAAK,EACV,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,WAAW,EACZ,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,mBAAmB;IAC/C,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,OAAO,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAC7C,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC;IACvB,SAAS,CAAC,MAAM,EAAE,OAAO,CAAC;IAC1B,SAAS,CAAC,WAAW,EAAE,WAAW,CAAC;IACnC,SAAS,CAAC,OAAO,EAAE,MAAM,CAAC;IAC1B,SAAS,CAAC,SAAS,EAAE,MAAM,CAAC;IAC5B,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;gBAEnD,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,sBAAsB;IAoBtD,SAAS,CAAC,CAAC,EACf,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,YAAY,EACrB,MAAM,CAAC,EAAE,SAAS,GACjB,OAAO,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC;CAsIvC"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import { getCookieByName, serializeSessionBrandId } from "../utils/helpers.js";
|
|
2
|
-
import { logRequest, logResponse } from "../utils/logger.js";
|
|
3
|
-
import { traceIdGenerator } from "../utils/trace-id.js";
|
|
4
|
-
import { ServiceName } from "../utils/types.js";
|
|
5
|
-
class DataloomServiceBase {
|
|
6
|
-
constructor(baseUrl, options){
|
|
7
|
-
this.baseUrl = baseUrl;
|
|
8
|
-
this.headers = {
|
|
9
|
-
...options.headers,
|
|
10
|
-
'X-Suda-Csrf-Token': getCookieByName('suda-csrf-token')
|
|
11
|
-
};
|
|
12
|
-
this.logger = options.logger ?? false;
|
|
13
|
-
this.serviceName = ServiceName.DEFAULT;
|
|
14
|
-
this.brandId = serializeSessionBrandId(options.brandName);
|
|
15
|
-
this.bizSource = options.brandName;
|
|
16
|
-
this.appId = options.appId;
|
|
17
|
-
this.onRequestError = options.onRequestError;
|
|
18
|
-
if (options.fetch) this.fetch = options.fetch;
|
|
19
|
-
else this.fetch = fetch;
|
|
20
|
-
}
|
|
21
|
-
async fetchData(url, options, extras) {
|
|
22
|
-
const fetchUrl = `${this.baseUrl.toString()}${url}`;
|
|
23
|
-
let traceId = -1;
|
|
24
|
-
if (this.logger) {
|
|
25
|
-
traceId = traceIdGenerator.next();
|
|
26
|
-
logRequest({
|
|
27
|
-
traceId,
|
|
28
|
-
url: fetchUrl,
|
|
29
|
-
method: options.method,
|
|
30
|
-
body: options.body
|
|
31
|
-
}, extras?.psmName);
|
|
32
|
-
}
|
|
33
|
-
try {
|
|
34
|
-
const res = await this.fetch(fetchUrl, {
|
|
35
|
-
method: options.method,
|
|
36
|
-
mode: 'cors',
|
|
37
|
-
redirect: 'manual',
|
|
38
|
-
credentials: 'include',
|
|
39
|
-
headers: this.headers,
|
|
40
|
-
body: JSON.stringify(options.body)
|
|
41
|
-
});
|
|
42
|
-
let error = null;
|
|
43
|
-
let data = null;
|
|
44
|
-
let status = res.status;
|
|
45
|
-
let statusText = res.statusText;
|
|
46
|
-
if (res.ok) {
|
|
47
|
-
const body = await res.text();
|
|
48
|
-
const parsedBody = JSON.parse(body);
|
|
49
|
-
if (parsedBody.status_code && parsedBody.error_msg) {
|
|
50
|
-
data = null;
|
|
51
|
-
error = {
|
|
52
|
-
code: parsedBody.status_code || res.status,
|
|
53
|
-
details: '',
|
|
54
|
-
hint: '',
|
|
55
|
-
message: parsedBody.error_msg || body
|
|
56
|
-
};
|
|
57
|
-
} else {
|
|
58
|
-
data = parsedBody.data;
|
|
59
|
-
error = null;
|
|
60
|
-
}
|
|
61
|
-
} else {
|
|
62
|
-
const body = await res.text();
|
|
63
|
-
const parsedBody = JSON.parse(body);
|
|
64
|
-
try {
|
|
65
|
-
error = 429 === res.status ? {
|
|
66
|
-
code: 429,
|
|
67
|
-
message: 'Too many requests received within 5 seconds.',
|
|
68
|
-
details: '',
|
|
69
|
-
hint: 'Retry after 5 seconds.'
|
|
70
|
-
} : {
|
|
71
|
-
code: parsedBody.status_code || res.status,
|
|
72
|
-
message: parsedBody.error_msg || body,
|
|
73
|
-
details: '',
|
|
74
|
-
hint: ''
|
|
75
|
-
};
|
|
76
|
-
} catch (_e) {
|
|
77
|
-
error = {
|
|
78
|
-
code: parsedBody.status_code || res.status,
|
|
79
|
-
message: parsedBody.error_msg || body,
|
|
80
|
-
details: '',
|
|
81
|
-
hint: ''
|
|
82
|
-
};
|
|
83
|
-
data = null;
|
|
84
|
-
status = 500;
|
|
85
|
-
statusText = 'Dataloom Internal Error';
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
const serviceResponse = {
|
|
89
|
-
data,
|
|
90
|
-
error,
|
|
91
|
-
status,
|
|
92
|
-
statusText
|
|
93
|
-
};
|
|
94
|
-
if (error) this.onRequestError?.({
|
|
95
|
-
...error,
|
|
96
|
-
status,
|
|
97
|
-
statusText
|
|
98
|
-
});
|
|
99
|
-
if (this.logger) logResponse(traceId, serviceResponse, extras?.psmName);
|
|
100
|
-
return serviceResponse;
|
|
101
|
-
} catch (e) {
|
|
102
|
-
const internalError = {
|
|
103
|
-
error: {
|
|
104
|
-
code: 500,
|
|
105
|
-
message: e instanceof Error ? e.message : String(e),
|
|
106
|
-
details: '',
|
|
107
|
-
hint: ''
|
|
108
|
-
},
|
|
109
|
-
status: 500,
|
|
110
|
-
statusText: 'Dataloom Internal Error'
|
|
111
|
-
};
|
|
112
|
-
this.onRequestError?.({
|
|
113
|
-
...internalError.error,
|
|
114
|
-
status: internalError.status,
|
|
115
|
-
statusText: internalError.statusText
|
|
116
|
-
});
|
|
117
|
-
const serviceResponse = {
|
|
118
|
-
data: null,
|
|
119
|
-
...internalError
|
|
120
|
-
};
|
|
121
|
-
if (this.logger) logResponse(traceId, serviceResponse, extras?.psmName);
|
|
122
|
-
return serviceResponse;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
export { DataloomServiceBase as default };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import type { DataloomServiceResponse } from '../../utils/types';
|
|
2
|
-
import { ServiceName } from '../../utils/types';
|
|
3
|
-
import DataloomServiceBase from '../DataloomServiceBase';
|
|
4
|
-
import type { SignInRedirectionOptions, UserInfoResponse } from './types';
|
|
5
|
-
export default class SessionService extends DataloomServiceBase {
|
|
6
|
-
serviceName: ServiceName;
|
|
7
|
-
/**
|
|
8
|
-
* Redirect to login page within app runtime environment.
|
|
9
|
-
*/
|
|
10
|
-
redirectToLogin(options?: SignInRedirectionOptions): DataloomServiceResponse<'success'>;
|
|
11
|
-
/**
|
|
12
|
-
* Sign out current user session.
|
|
13
|
-
*/
|
|
14
|
-
signOut(): Promise<DataloomServiceResponse<null>>;
|
|
15
|
-
/**
|
|
16
|
-
* Get current page URL with biz_source parameter
|
|
17
|
-
*/
|
|
18
|
-
getUrlWithBizSource(): string;
|
|
19
|
-
/**
|
|
20
|
-
* Gets the current user information if there is an existing session.
|
|
21
|
-
*/
|
|
22
|
-
getUserInfo(): Promise<DataloomServiceResponse<UserInfoResponse>>;
|
|
23
|
-
/**
|
|
24
|
-
* Navigate to user profile page within app runtime environment.
|
|
25
|
-
*/
|
|
26
|
-
navigateToUserProfile(options?: {
|
|
27
|
-
newTab?: boolean;
|
|
28
|
-
}): {
|
|
29
|
-
data: null;
|
|
30
|
-
error: {
|
|
31
|
-
code: number;
|
|
32
|
-
message: string;
|
|
33
|
-
hint: string;
|
|
34
|
-
details: string;
|
|
35
|
-
};
|
|
36
|
-
status: number;
|
|
37
|
-
statusText: string;
|
|
38
|
-
} | {
|
|
39
|
-
data: string;
|
|
40
|
-
error: null;
|
|
41
|
-
status: number;
|
|
42
|
-
statusText: string;
|
|
43
|
-
};
|
|
44
|
-
}
|
|
45
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/service/services/session-service/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,mBAAmB,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAGV,wBAAwB,EACxB,gBAAgB,EACjB,MAAM,SAAS,CAAC;AAcjB,MAAM,CAAC,OAAO,OAAO,cAAe,SAAQ,mBAAmB;IACpD,WAAW,cAA8B;IAElD;;OAEG;IACH,eAAe,CACb,OAAO,CAAC,EAAE,wBAAwB,GACjC,uBAAuB,CAAC,SAAS,CAAC;IAsCrC;;OAEG;IACG,OAAO,IAAI,OAAO,CAAC,uBAAuB,CAAC,IAAI,CAAC,CAAC;IAyBvD;;OAEG;IACH,mBAAmB,IAAI,MAAM;IAkB7B;;OAEG;IACG,WAAW,IAAI,OAAO,CAAC,uBAAuB,CAAC,gBAAgB,CAAC,CAAC;IAuDvE;;OAEG;IACH,qBAAqB,CAAC,OAAO,CAAC,EAAE;QAAE,MAAM,CAAC,EAAE,OAAO,CAAA;KAAE;;;;;;;;;;;;;;;;CA+BrD"}
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import { isBrowser } from "../../utils/helpers.js";
|
|
2
|
-
import { ServiceName } from "../../utils/types.js";
|
|
3
|
-
import { reportDataloomException } from "../../../utils/slardar.js";
|
|
4
|
-
import DataloomServiceBase from "../DataloomServiceBase.js";
|
|
5
|
-
const browserEnvError = {
|
|
6
|
-
data: null,
|
|
7
|
-
error: {
|
|
8
|
-
code: 400,
|
|
9
|
-
message: 'Incompatible runtime environment',
|
|
10
|
-
hint: 'Please check if the current environment is browser.',
|
|
11
|
-
details: 'This method can only be invoked in browser environment.'
|
|
12
|
-
},
|
|
13
|
-
status: 400,
|
|
14
|
-
statusText: 'Bad Request'
|
|
15
|
-
};
|
|
16
|
-
class SessionService extends DataloomServiceBase {
|
|
17
|
-
redirectToLogin(options) {
|
|
18
|
-
if (!isBrowser()) {
|
|
19
|
-
reportDataloomException(browserEnvError.error, {
|
|
20
|
-
module: 'session-service',
|
|
21
|
-
method: 'redirectToLogin',
|
|
22
|
-
type: 'runtime'
|
|
23
|
-
});
|
|
24
|
-
console.log('[Dataloom][SessionService.RedirectToLogin] dataloom.service.session.redirectToLogin can only be invoked in browser environment.');
|
|
25
|
-
return browserEnvError;
|
|
26
|
-
}
|
|
27
|
-
const { returnUrl, newTab = false } = options ?? {};
|
|
28
|
-
const encodedRedirectUrl = encodeURIComponent(decodeURIComponent(returnUrl || window.location.href));
|
|
29
|
-
const isSparkFaasPath = window.location.pathname.startsWith('/spark');
|
|
30
|
-
const baseLoginUrl = isSparkFaasPath ? `/spark/faas/${this.appId}/runtime/page/login` : `/app/${this.appId}/runtime/page/login`;
|
|
31
|
-
const loginPageUrl = `${baseLoginUrl}?biz_source=${this.bizSource}&redirect_uri=${encodedRedirectUrl}`;
|
|
32
|
-
if (newTab) window.open(loginPageUrl, '_blank');
|
|
33
|
-
else window.location.href = loginPageUrl;
|
|
34
|
-
return {
|
|
35
|
-
data: 'success',
|
|
36
|
-
error: null,
|
|
37
|
-
status: 200,
|
|
38
|
-
statusText: 'OK'
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
async signOut() {
|
|
42
|
-
if (!isBrowser()) {
|
|
43
|
-
reportDataloomException(browserEnvError.error, {
|
|
44
|
-
module: 'session-service',
|
|
45
|
-
method: 'signOut',
|
|
46
|
-
type: 'runtime'
|
|
47
|
-
});
|
|
48
|
-
console.log('[Dataloom][SessionService.SignOut] dataloom.service.session.signOut can only be invoked in browser environment.');
|
|
49
|
-
return browserEnvError;
|
|
50
|
-
}
|
|
51
|
-
const location = this.getUrlWithBizSource();
|
|
52
|
-
return this.fetchData('/af/runtime/api/v1/account/logout', {
|
|
53
|
-
method: 'POST',
|
|
54
|
-
body: {
|
|
55
|
-
appID: this.appId,
|
|
56
|
-
redirectURI: location
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
getUrlWithBizSource() {
|
|
61
|
-
if (!isBrowser()) {
|
|
62
|
-
reportDataloomException(browserEnvError.error, {
|
|
63
|
-
module: 'session-service',
|
|
64
|
-
method: 'getUrlWithBizSource',
|
|
65
|
-
type: 'runtime'
|
|
66
|
-
});
|
|
67
|
-
console.log('[Dataloom][SessionService.GetUrlWithBizSource] dataloom.service.session.getUrlWithBizSource can only be invoked in browser environment.');
|
|
68
|
-
return '';
|
|
69
|
-
}
|
|
70
|
-
const currentUrl = new URL(window.location.href);
|
|
71
|
-
currentUrl.searchParams.set('biz_source', this.bizSource);
|
|
72
|
-
return currentUrl.toString();
|
|
73
|
-
}
|
|
74
|
-
async getUserInfo() {
|
|
75
|
-
if (!isBrowser()) {
|
|
76
|
-
reportDataloomException(browserEnvError.error, {
|
|
77
|
-
module: 'session-service',
|
|
78
|
-
method: 'getUserInfo',
|
|
79
|
-
type: 'runtime'
|
|
80
|
-
});
|
|
81
|
-
console.log('[Dataloom][SessionService.GetUserInfo] dataloom.service.session.getUserInfo can only be invoked in browser environment.');
|
|
82
|
-
return Promise.resolve(browserEnvError);
|
|
83
|
-
}
|
|
84
|
-
const url = `/app/${this.appId}/__runtime__/api/v1/account/login/user`;
|
|
85
|
-
const urlObj = new URL(globalThis.location.href);
|
|
86
|
-
const pathSegments = urlObj.hostname.split('.');
|
|
87
|
-
const tenantDomainName = pathSegments[0] ?? '';
|
|
88
|
-
const response = await this.fetchData(url, {
|
|
89
|
-
method: 'POST',
|
|
90
|
-
body: {
|
|
91
|
-
appID: this.appId,
|
|
92
|
-
tenantDomainName
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
const userInfoResponse = {
|
|
96
|
-
data: {
|
|
97
|
-
user_info: {
|
|
98
|
-
user_id: response.data?.userInfo?.userID,
|
|
99
|
-
name: response.data?.userInfo?.name,
|
|
100
|
-
avatar: response.data?.userInfo?.avatar,
|
|
101
|
-
email: response.data?.userInfo?.email,
|
|
102
|
-
phone_number: response.data?.userInfo?.desensitizedPhoneNumber
|
|
103
|
-
}
|
|
104
|
-
},
|
|
105
|
-
error: null,
|
|
106
|
-
status: response.status,
|
|
107
|
-
statusText: response.statusText
|
|
108
|
-
};
|
|
109
|
-
return userInfoResponse;
|
|
110
|
-
}
|
|
111
|
-
navigateToUserProfile(options) {
|
|
112
|
-
if (!isBrowser()) {
|
|
113
|
-
reportDataloomException(browserEnvError.error, {
|
|
114
|
-
module: 'session-service',
|
|
115
|
-
method: 'navigateToUserProfile',
|
|
116
|
-
type: 'runtime'
|
|
117
|
-
});
|
|
118
|
-
console.log('[Dataloom][SessionService.NavigateToUserProfile] dataloom.service.session.navigateToUserProfile can only be invoked in browser environment.');
|
|
119
|
-
return browserEnvError;
|
|
120
|
-
}
|
|
121
|
-
const { newTab = false } = options ?? {};
|
|
122
|
-
const encodedReturnUrl = encodeURIComponent(window.location.href);
|
|
123
|
-
const profilePageUrl = `/suda/user?brand=${this.brandId}&returnUrl=${encodedReturnUrl}&appId=${this.appId}`;
|
|
124
|
-
if (newTab) window.open(profilePageUrl, '_blank');
|
|
125
|
-
else window.location.href = profilePageUrl;
|
|
126
|
-
return {
|
|
127
|
-
data: 'success',
|
|
128
|
-
error: null,
|
|
129
|
-
status: 200,
|
|
130
|
-
statusText: 'OK'
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
constructor(...args){
|
|
134
|
-
super(...args), this.serviceName = ServiceName.SessionService;
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
export { SessionService as default };
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
export interface I18n {
|
|
2
|
-
language_code: number;
|
|
3
|
-
text: string;
|
|
4
|
-
}
|
|
5
|
-
export type I18ns = I18n[];
|
|
6
|
-
export interface Avatar {
|
|
7
|
-
source?: string;
|
|
8
|
-
image?: {
|
|
9
|
-
large?: string;
|
|
10
|
-
};
|
|
11
|
-
color?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface SignInRedirectionOptions {
|
|
14
|
-
/**
|
|
15
|
-
* The URL to redirect to after a successful login. Defaults to the current URL.
|
|
16
|
-
*/
|
|
17
|
-
returnUrl?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Whether to open the login page in a new tab. Defaults to `false`.
|
|
20
|
-
*/
|
|
21
|
-
newTab?: boolean;
|
|
22
|
-
}
|
|
23
|
-
export interface UserBaseInfo {
|
|
24
|
-
user_id?: number;
|
|
25
|
-
name?: I18ns;
|
|
26
|
-
avatar?: Avatar;
|
|
27
|
-
email?: string;
|
|
28
|
-
phone_number?: string;
|
|
29
|
-
tenant_name?: string;
|
|
30
|
-
}
|
|
31
|
-
export interface UserInfoResponse {
|
|
32
|
-
user_info?: UserBaseInfo;
|
|
33
|
-
}
|
|
34
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/service/services/session-service/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,IAAI;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,KAAK,GAAG,IAAI,EAAE,CAAC;AAE3B,MAAM,WAAW,MAAM;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE;QACN,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,CAAC,EAAE,YAAY,CAAC;CAC1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/service/services/types.ts"],"names":[],"mappings":"AACA,oBAAY,aAAa;IACvB,WAAW,IAAI;IACf,QAAQ,IAAI,CAAE,MAAM;IACpB,MAAM,IAAI,CAAE,MAAM;IAClB,QAAQ,IAAI,CAAE,KAAK;IACnB,UAAU,IAAI;CACf;AAGD,oBAAY,UAAU;IACpB,MAAM,IAAI,CAAE,KAAK;IACjB,QAAQ,IAAI;CACb"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
var types_AccountStatus = /*#__PURE__*/ function(AccountStatus) {
|
|
2
|
-
AccountStatus[AccountStatus["Unspecified"] = 0] = "Unspecified";
|
|
3
|
-
AccountStatus[AccountStatus["Inactive"] = 1] = "Inactive";
|
|
4
|
-
AccountStatus[AccountStatus["Active"] = 2] = "Active";
|
|
5
|
-
AccountStatus[AccountStatus["Disabled"] = 3] = "Disabled";
|
|
6
|
-
AccountStatus[AccountStatus["Terminated"] = 4] = "Terminated";
|
|
7
|
-
return AccountStatus;
|
|
8
|
-
}({});
|
|
9
|
-
var types_UserStatus = /*#__PURE__*/ function(UserStatus) {
|
|
10
|
-
UserStatus[UserStatus["active"] = 1] = "active";
|
|
11
|
-
UserStatus[UserStatus["inactive"] = 2] = "inactive";
|
|
12
|
-
return UserStatus;
|
|
13
|
-
}({});
|
|
14
|
-
export { types_AccountStatus as AccountStatus, types_UserStatus as UserStatus };
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { type DataloomServiceResponse, ServiceName } from '../../utils/types';
|
|
2
|
-
import DataloomServiceBase from '../DataloomServiceBase';
|
|
3
|
-
import type { SearchParams, UserResponse } from './types';
|
|
4
|
-
export default class UserService extends DataloomServiceBase {
|
|
5
|
-
serviceName: ServiceName;
|
|
6
|
-
search(params: SearchParams): Promise<DataloomServiceResponse<UserResponse>>;
|
|
7
|
-
getByIds(ids: string[] | number[]): Promise<DataloomServiceResponse<UserResponse>>;
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/service/services/user-service/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,uBAAuB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC9E,OAAO,mBAAmB,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EAEV,YAAY,EAEZ,YAAY,EACb,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,mBAAmB;IACjD,WAAW,cAA2B;IAEzC,MAAM,CACV,MAAM,EAAE,YAAY,GACnB,OAAO,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAqC3C,QAAQ,CACZ,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,GACvB,OAAO,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;CAkClD"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { convertUserStatus, retrieveNameFromI18n } from "../../utils/helpers.js";
|
|
2
|
-
import { ServiceName } from "../../utils/types.js";
|
|
3
|
-
import DataloomServiceBase from "../DataloomServiceBase.js";
|
|
4
|
-
class UserService extends DataloomServiceBase {
|
|
5
|
-
async search(params) {
|
|
6
|
-
const { name, pageSize } = params;
|
|
7
|
-
const res = await this.fetchData(`/app/${this.appId}/__runtime__/api/v1/account/search_user`, {
|
|
8
|
-
method: 'POST',
|
|
9
|
-
body: {
|
|
10
|
-
query: name,
|
|
11
|
-
page_size: pageSize
|
|
12
|
-
}
|
|
13
|
-
}, {
|
|
14
|
-
psmName: 'UserService.Search'
|
|
15
|
-
});
|
|
16
|
-
if (res.error) return res;
|
|
17
|
-
return {
|
|
18
|
-
...res,
|
|
19
|
-
data: {
|
|
20
|
-
user_list: res.data?.userList?.map((item)=>({
|
|
21
|
-
avatar: item.avatar ?? '',
|
|
22
|
-
email: item.email ?? '',
|
|
23
|
-
name: retrieveNameFromI18n(item.name) ?? '',
|
|
24
|
-
status: convertUserStatus(item.userStatus),
|
|
25
|
-
user_id: item.userID ?? ''
|
|
26
|
-
})) ?? []
|
|
27
|
-
}
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
async getByIds(ids) {
|
|
31
|
-
const res = await this.fetchData(`/app/${this.appId}/__runtime__/api/v1/account/list_users`, {
|
|
32
|
-
method: 'POST',
|
|
33
|
-
body: {
|
|
34
|
-
userIDList: ids
|
|
35
|
-
}
|
|
36
|
-
}, {
|
|
37
|
-
psmName: 'UserService.GetByIds'
|
|
38
|
-
});
|
|
39
|
-
if (res.error) return res;
|
|
40
|
-
return {
|
|
41
|
-
...res,
|
|
42
|
-
data: {
|
|
43
|
-
user_list: ids.map((id)=>{
|
|
44
|
-
const item = res.data?.userInfoMap?.[id];
|
|
45
|
-
return {
|
|
46
|
-
avatar: item?.avatar?.image?.large ?? '',
|
|
47
|
-
email: item?.email ?? '',
|
|
48
|
-
name: retrieveNameFromI18n(item?.name) ?? '',
|
|
49
|
-
status: convertUserStatus(item?.userStatus),
|
|
50
|
-
user_id: item?.userID ? String(item.userID) : ''
|
|
51
|
-
};
|
|
52
|
-
})
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
constructor(...args){
|
|
57
|
-
super(...args), this.serviceName = ServiceName.UserService;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
export { UserService as default };
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import type { AccountStatus, UserStatus } from '../types';
|
|
2
|
-
export type I18n = {
|
|
3
|
-
zh_cn: string;
|
|
4
|
-
en_us: string;
|
|
5
|
-
ja_jp: string;
|
|
6
|
-
};
|
|
7
|
-
export type SearchParams = {
|
|
8
|
-
name: string;
|
|
9
|
-
pageSize?: number;
|
|
10
|
-
};
|
|
11
|
-
export type User = {
|
|
12
|
-
user_id: string;
|
|
13
|
-
email: string;
|
|
14
|
-
name: string;
|
|
15
|
-
avatar: string;
|
|
16
|
-
status: UserStatus;
|
|
17
|
-
};
|
|
18
|
-
export type DepartmentEntity = {
|
|
19
|
-
departmentID: string;
|
|
20
|
-
larkDepartmentID: string;
|
|
21
|
-
name: I18n;
|
|
22
|
-
};
|
|
23
|
-
export type SearchUserEntity = {
|
|
24
|
-
userID: string;
|
|
25
|
-
larkUserID: string;
|
|
26
|
-
name: I18n;
|
|
27
|
-
avatar: string;
|
|
28
|
-
userType: string;
|
|
29
|
-
email: string;
|
|
30
|
-
userStatus: AccountStatus;
|
|
31
|
-
department: DepartmentEntity;
|
|
32
|
-
};
|
|
33
|
-
export type GetByIdUserEntity = {
|
|
34
|
-
userID: number;
|
|
35
|
-
larkUserID: number;
|
|
36
|
-
name: I18n;
|
|
37
|
-
avatar: {
|
|
38
|
-
source: string;
|
|
39
|
-
image?: {
|
|
40
|
-
large: string;
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
userType: string;
|
|
44
|
-
email: string;
|
|
45
|
-
userStatus: AccountStatus;
|
|
46
|
-
department: DepartmentEntity;
|
|
47
|
-
};
|
|
48
|
-
export type UserResponse = {
|
|
49
|
-
user_list: User[];
|
|
50
|
-
};
|
|
51
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/service/services/user-service/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE1D,MAAM,MAAM,IAAI,GAAG;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,IAAI,GAAG;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,aAAa,CAAC;IAC1B,UAAU,EAAE,gBAAgB,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,IAAI,CAAC;IACX,MAAM,EAAE;QACN,MAAM,EAAE,MAAM,CAAC;QACf,KAAK,CAAC,EAAE;YACN,KAAK,EAAE,MAAM,CAAC;SACf,CAAC;KACH,CAAC;IACF,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,aAAa,CAAC;IAC1B,UAAU,EAAE,gBAAgB,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG;IACzB,SAAS,EAAE,IAAI,EAAE,CAAC;CACnB,CAAC"}
|
|
File without changes
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { AccountStatus, UserStatus } from '../services/types';
|
|
2
|
-
import type { I18n } from '../services/user-service/types';
|
|
3
|
-
export declare const isBrowser: () => boolean;
|
|
4
|
-
export declare const serializeSessionBrandId: (brand: string) => string;
|
|
5
|
-
export declare const getCookieByName: (name: string) => string;
|
|
6
|
-
export declare const retrieveNameFromI18n: (i18ns?: I18n) => string;
|
|
7
|
-
export declare const convertUserStatus: (status?: AccountStatus) => UserStatus;
|
|
8
|
-
//# sourceMappingURL=helpers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/service/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,gCAAgC,CAAC;AAE3D,eAAO,MAAM,SAAS,eAC4C,CAAC;AAEnE,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,MAMvD,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,MAAM,MAAM,KAAG,MAW9C,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,QAAQ,IAAI,WAEhD,CAAC;AAEF,eAAO,MAAM,iBAAiB,GAAI,SAAS,aAAa,KAAG,UAY1D,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { AccountStatus, UserStatus } from "../services/types.js";
|
|
2
|
-
const isBrowser = ()=>'undefined' != typeof window && 'undefined' != typeof document;
|
|
3
|
-
const serializeSessionBrandId = (brand)=>{
|
|
4
|
-
if ('miaoda' === brand) return '1';
|
|
5
|
-
return '0';
|
|
6
|
-
};
|
|
7
|
-
const getCookieByName = (name)=>{
|
|
8
|
-
if (!isBrowser()) return '';
|
|
9
|
-
const cookies = document.cookie.split(';');
|
|
10
|
-
return cookies.find((cookie)=>cookie.trim().startsWith(`${name}=`))?.split('=')[1] ?? '';
|
|
11
|
-
};
|
|
12
|
-
const retrieveNameFromI18n = (i18ns)=>i18ns?.zh_cn || i18ns?.en_us || i18ns?.ja_jp || '';
|
|
13
|
-
const convertUserStatus = (status)=>{
|
|
14
|
-
if (status === AccountStatus.Active || status === AccountStatus.Inactive) return UserStatus.active;
|
|
15
|
-
if (status === AccountStatus.Disabled || status === AccountStatus.Terminated) return UserStatus.inactive;
|
|
16
|
-
return UserStatus.active;
|
|
17
|
-
};
|
|
18
|
-
export { convertUserStatus, getCookieByName, isBrowser, retrieveNameFromI18n, serializeSessionBrandId };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { FetchMethod } from './types';
|
|
2
|
-
type LogParams = {
|
|
3
|
-
traceId: number;
|
|
4
|
-
url: string;
|
|
5
|
-
method: FetchMethod;
|
|
6
|
-
body?: unknown;
|
|
7
|
-
};
|
|
8
|
-
export declare const logRequest: (params: LogParams, psmName?: string) => void;
|
|
9
|
-
export declare const logResponse: (traceId: number, response: {
|
|
10
|
-
data: unknown;
|
|
11
|
-
error: unknown;
|
|
12
|
-
status: number;
|
|
13
|
-
}, psmName?: string) => void;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../../src/service/utils/logger.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C,KAAK,SAAS,GAAG;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,QAAQ,SAAS,EAAE,UAAS,MAAkB,SAwBxE,CAAC;AAEF,eAAO,MAAM,WAAW,GACtB,SAAS,MAAM,EACf,UAAU;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC3D,UAAS,MAAkB,SA0B5B,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
const logRequest = (params, psmName = 'Service')=>{
|
|
2
|
-
const { traceId, url, method, body } = params;
|
|
3
|
-
const decodedParams = Array.from(new URL(url, 'http://temp.invalid').searchParams.entries()).filter(([key])=>![
|
|
4
|
-
'count',
|
|
5
|
-
'tx',
|
|
6
|
-
'missing',
|
|
7
|
-
'resolution',
|
|
8
|
-
'column'
|
|
9
|
-
].includes(key)).map(([key, value])=>`${key}=${value}`);
|
|
10
|
-
console.log(`[Dataloom][${psmName}][Request]`, 'trace id:', traceId, 'method:', method, 'params:', decodedParams.join(','), 'body:', body);
|
|
11
|
-
};
|
|
12
|
-
const logResponse = (traceId, response, psmName = 'Service')=>{
|
|
13
|
-
const { data, error, status } = response;
|
|
14
|
-
const hasError = !!error;
|
|
15
|
-
if (hasError) console.error(`[Dataloom][${psmName}][Response Failed]`, 'trace id:', traceId, 'statusCode:', status, 'error:', error);
|
|
16
|
-
else console.log(`[Dataloom][${psmName}][Response Success]`, 'trace id:', traceId, 'statusCode:', status, 'data:', data);
|
|
17
|
-
};
|
|
18
|
-
export { logRequest, logResponse };
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TraceIdGenerator
|
|
3
|
-
*
|
|
4
|
-
* A singleton class for generating auto-incrementing trace IDs within a process.
|
|
5
|
-
* Each call to next() returns a unique, incremented number.
|
|
6
|
-
*
|
|
7
|
-
* @example
|
|
8
|
-
* const traceId = traceIdGenerator.next();
|
|
9
|
-
*/
|
|
10
|
-
declare class TraceIdGenerator {
|
|
11
|
-
/**
|
|
12
|
-
* The singleton instance of TraceIdGenerator.
|
|
13
|
-
*/
|
|
14
|
-
private static instance;
|
|
15
|
-
/**
|
|
16
|
-
* The current trace id value.
|
|
17
|
-
*/
|
|
18
|
-
private counter;
|
|
19
|
-
private constructor();
|
|
20
|
-
/**
|
|
21
|
-
* Get the singleton instance of TraceIdGenerator.
|
|
22
|
-
* @returns {TraceIdGenerator}
|
|
23
|
-
*/
|
|
24
|
-
static getInstance(): TraceIdGenerator;
|
|
25
|
-
/**
|
|
26
|
-
* Get the next trace id (auto-increment).
|
|
27
|
-
* @returns {number} The next trace id.
|
|
28
|
-
*/
|
|
29
|
-
next(): number;
|
|
30
|
-
/**
|
|
31
|
-
* Get the current trace id (without increment).
|
|
32
|
-
* @returns {number} The current trace id.
|
|
33
|
-
*/
|
|
34
|
-
getCurrent(): number;
|
|
35
|
-
/**
|
|
36
|
-
* Reset the trace id counter to 1. (For testing or special use only)
|
|
37
|
-
*/
|
|
38
|
-
reset(): void;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* The singleton instance for trace id generation.
|
|
42
|
-
*/
|
|
43
|
-
declare const traceIdGenerator: TraceIdGenerator;
|
|
44
|
-
export { TraceIdGenerator, traceIdGenerator };
|
|
45
|
-
//# sourceMappingURL=trace-id.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"trace-id.d.ts","sourceRoot":"","sources":["../../../src/service/utils/trace-id.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,cAAM,gBAAgB;IACpB;;OAEG;IACH,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAmB;IAE1C;;OAEG;IACH,OAAO,CAAC,OAAO,CAAa;IAE5B,OAAO;IAEP;;;OAGG;WACW,WAAW,IAAI,gBAAgB;IAO7C;;;OAGG;IACI,IAAI,IAAI,MAAM;IAIrB;;;OAGG;IACI,UAAU,IAAI,MAAM;IAI3B;;OAEG;IACI,KAAK,IAAI,IAAI;CAGrB;AAED;;GAEG;AACH,QAAA,MAAM,gBAAgB,kBAAiC,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
class TraceIdGenerator {
|
|
2
|
-
constructor(){
|
|
3
|
-
this.counter = 1;
|
|
4
|
-
}
|
|
5
|
-
static getInstance() {
|
|
6
|
-
if (!TraceIdGenerator.instance) TraceIdGenerator.instance = new TraceIdGenerator();
|
|
7
|
-
return TraceIdGenerator.instance;
|
|
8
|
-
}
|
|
9
|
-
next() {
|
|
10
|
-
return this.counter++;
|
|
11
|
-
}
|
|
12
|
-
getCurrent() {
|
|
13
|
-
return this.counter;
|
|
14
|
-
}
|
|
15
|
-
reset() {
|
|
16
|
-
this.counter = 1;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
const traceIdGenerator = TraceIdGenerator.getInstance();
|
|
20
|
-
export { TraceIdGenerator, traceIdGenerator };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
export declare enum ServiceName {
|
|
2
|
-
DEFAULT = "default",
|
|
3
|
-
UserService = "user-service",
|
|
4
|
-
SessionService = "session-service"
|
|
5
|
-
}
|
|
6
|
-
export type Fetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
7
|
-
export type FetchMethod = 'GET' | 'HEAD' | 'POST' | 'PATCH' | 'DELETE';
|
|
8
|
-
export type FetchOptions = {
|
|
9
|
-
method: FetchMethod;
|
|
10
|
-
body?: unknown;
|
|
11
|
-
};
|
|
12
|
-
export interface ExtraInfo {
|
|
13
|
-
psmName?: string;
|
|
14
|
-
}
|
|
15
|
-
export interface DataloomServiceError {
|
|
16
|
-
code: number;
|
|
17
|
-
details: string;
|
|
18
|
-
hint: string | null;
|
|
19
|
-
message: string;
|
|
20
|
-
}
|
|
21
|
-
export type OnRequestErrorType = DataloomServiceError & {
|
|
22
|
-
status: number;
|
|
23
|
-
statusText: string;
|
|
24
|
-
};
|
|
25
|
-
export type DataloomServiceOptions = {
|
|
26
|
-
headers?: {
|
|
27
|
-
[key: string]: string;
|
|
28
|
-
};
|
|
29
|
-
fetch?: Fetch;
|
|
30
|
-
logger?: boolean;
|
|
31
|
-
brandName: string;
|
|
32
|
-
appId: string;
|
|
33
|
-
onRequestError?: (error: OnRequestErrorType) => void;
|
|
34
|
-
};
|
|
35
|
-
interface DataloomServiceBase {
|
|
36
|
-
status: number;
|
|
37
|
-
statusText: string;
|
|
38
|
-
}
|
|
39
|
-
export interface DataloomServiceSuccess<T> extends DataloomServiceBase {
|
|
40
|
-
error: null;
|
|
41
|
-
data: T;
|
|
42
|
-
}
|
|
43
|
-
export interface DataloomServiceFailure extends DataloomServiceBase {
|
|
44
|
-
error: DataloomServiceError;
|
|
45
|
-
data: null;
|
|
46
|
-
}
|
|
47
|
-
export type DataloomServiceResponse<T> = DataloomServiceSuccess<T> | DataloomServiceFailure;
|
|
48
|
-
export {};
|
|
49
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/service/utils/types.ts"],"names":[],"mappings":"AAAA,oBAAY,WAAW;IACrB,OAAO,YAAY;IACnB,WAAW,iBAAiB;IAC5B,cAAc,oBAAoB;CACnC;AAED,MAAM,MAAM,KAAK,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,QAAQ,CAAC,CAAC;AAExF,MAAM,MAAM,WAAW,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,QAAQ,CAAC;AAEvE,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,WAAW,CAAC;IACpB,IAAI,CAAC,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF,MAAM,WAAW,SAAS;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,GAAG;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IAEnC,OAAO,CAAC,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAEpC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,kBAAkB,KAAK,IAAI,CAAC;CACtD,CAAC;AAEF,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,WAAW,sBAAsB,CAAC,CAAC,CAAE,SAAQ,mBAAmB;IACpE,KAAK,EAAE,IAAI,CAAC;IACZ,IAAI,EAAE,CAAC,CAAC;CACT;AACD,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,KAAK,EAAE,oBAAoB,CAAC;IAC5B,IAAI,EAAE,IAAI,CAAC;CACZ;AAED,MAAM,MAAM,uBAAuB,CAAC,CAAC,IACjC,sBAAsB,CAAC,CAAC,CAAC,GACzB,sBAAsB,CAAC"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
var types_ServiceName = /*#__PURE__*/ function(ServiceName) {
|
|
2
|
-
ServiceName["DEFAULT"] = "default";
|
|
3
|
-
ServiceName["UserService"] = "user-service";
|
|
4
|
-
ServiceName["SessionService"] = "session-service";
|
|
5
|
-
return ServiceName;
|
|
6
|
-
}({});
|
|
7
|
-
export { types_ServiceName as ServiceName };
|
|
File without changes
|