@lark-apaas/dataloom 0.1.4-alpha.0 → 0.1.4-alpha.2

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.
Files changed (67) hide show
  1. package/README.md +32 -24
  2. package/lib/DataloomClient.d.ts +7 -7
  3. package/lib/DataloomClient.d.ts.map +1 -1
  4. package/lib/DataloomClient.js +15 -6
  5. package/lib/index.d.ts +1 -5
  6. package/lib/index.d.ts.map +1 -1
  7. package/lib/index.js +1 -1
  8. package/lib/service/index.d.ts +5 -26
  9. package/lib/service/index.d.ts.map +1 -1
  10. package/lib/service/index.js +6 -3
  11. package/lib/service/services/DataloomServiceBase.d.ts +17 -0
  12. package/lib/service/services/DataloomServiceBase.d.ts.map +1 -0
  13. package/lib/service/services/DataloomServiceBase.js +126 -0
  14. package/lib/service/services/session-service/index.d.ts +45 -0
  15. package/lib/service/services/session-service/index.d.ts.map +1 -0
  16. package/lib/service/services/session-service/index.js +137 -0
  17. package/lib/service/services/session-service/types.d.ts +34 -0
  18. package/lib/service/services/session-service/types.d.ts.map +1 -0
  19. package/lib/service/services/types.d.ts +12 -0
  20. package/lib/service/services/types.d.ts.map +1 -0
  21. package/lib/service/services/types.js +14 -0
  22. package/lib/service/services/user-service/index.d.ts +9 -0
  23. package/lib/service/services/user-service/index.d.ts.map +1 -0
  24. package/lib/service/services/user-service/index.js +62 -0
  25. package/lib/service/services/user-service/types.d.ts +57 -0
  26. package/lib/service/services/user-service/types.d.ts.map +1 -0
  27. package/lib/service/services/user-service/types.js +0 -0
  28. package/lib/service/utils/helpers.d.ts +8 -0
  29. package/lib/service/utils/helpers.d.ts.map +1 -0
  30. package/lib/service/utils/helpers.js +18 -0
  31. package/lib/service/utils/logger.d.ts +15 -0
  32. package/lib/service/utils/logger.d.ts.map +1 -0
  33. package/lib/service/utils/logger.js +18 -0
  34. package/lib/service/utils/trace-id.d.ts +45 -0
  35. package/lib/service/utils/trace-id.d.ts.map +1 -0
  36. package/lib/service/utils/trace-id.js +20 -0
  37. package/lib/service/utils/types.d.ts +49 -0
  38. package/lib/service/utils/types.d.ts.map +1 -0
  39. package/lib/service/utils/types.js +7 -0
  40. package/lib/storage/StorageClient.d.ts +2 -1
  41. package/lib/storage/StorageClient.d.ts.map +1 -1
  42. package/lib/storage/StorageClient.js +4 -4
  43. package/lib/storage/libs/fetch.d.ts +0 -6
  44. package/lib/storage/libs/fetch.d.ts.map +1 -1
  45. package/lib/storage/libs/fetch.js +1 -11
  46. package/lib/storage/libs/helpers.d.ts +0 -14
  47. package/lib/storage/libs/helpers.d.ts.map +1 -1
  48. package/lib/storage/libs/helpers.js +1 -6
  49. package/lib/storage/libs/types.d.ts +6 -5
  50. package/lib/storage/libs/types.d.ts.map +1 -1
  51. package/lib/storage/packages/StorageFileApi.d.ts.map +1 -1
  52. package/lib/storage/packages/StorageFileApi.js +14 -14
  53. package/lib/utils/fetch.d.ts +1 -8
  54. package/lib/utils/fetch.d.ts.map +1 -1
  55. package/lib/utils/fetch.js +8 -3
  56. package/lib/utils/helpers.d.ts +1 -0
  57. package/lib/utils/helpers.d.ts.map +1 -1
  58. package/lib/utils/helpers.js +4 -1
  59. package/lib/utils/types.d.ts +0 -10
  60. package/lib/utils/types.d.ts.map +1 -1
  61. package/package.json +1 -1
  62. package/lib/service/types.d.ts +0 -113
  63. package/lib/service/types.d.ts.map +0 -1
  64. package/lib/storage/utils/csrf.d.ts +0 -15
  65. package/lib/storage/utils/csrf.d.ts.map +0 -1
  66. package/lib/storage/utils/csrf.js +0 -12
  67. /package/lib/service/{types.js → services/session-service/types.js} +0 -0
@@ -33,12 +33,12 @@ class StorageFileApi {
33
33
  if (options?.contentDisposition) contentDisposition = options?.contentDisposition;
34
34
  else if (fileBody instanceof File) contentDisposition = fileBody?.name;
35
35
  const preUploadBody = {
36
- fileSize: getUpdateFileSize(fileBody),
36
+ bucket_id: this.bucketId ?? '',
37
+ file_size: getUpdateFileSize(fileBody),
37
38
  upsert: options.upsert ?? false,
38
- filePath: cleanPath,
39
- fileName: fileBody instanceof File ? fileBody?.name : ''
39
+ file_path: cleanPath,
40
+ file_name: fileBody instanceof File ? fileBody?.name : ''
40
41
  };
41
- if (options.contentType) preUploadBody.contentType = options.contentType;
42
42
  const res = await post(this.fetch, `${this.url}/object/${this.bucketId}/pre_upload`, preUploadBody, {
43
43
  headers: this.headers,
44
44
  logFetch: this.loggerEnabled,
@@ -46,19 +46,18 @@ class StorageFileApi {
46
46
  }, void 0, {
47
47
  psmName: 'Storage.Upload.PreUpload'
48
48
  });
49
- const { uploadID, uploadURL } = res?.data ?? {};
50
- if (!uploadURL || !uploadID) return {
49
+ const { upload_id, upload_url } = res?.data ?? {};
50
+ if (!upload_url || !upload_id) return {
51
51
  data: null,
52
- error: new StorageError('uploadURL or uploadID is empty')
52
+ error: new StorageError('upload_url or upload_id is empty')
53
53
  };
54
54
  {
55
55
  const tosHeaders = {};
56
56
  if (contentDisposition) tosHeaders['content-disposition'] = `attachment; filename="${sanitizeFileName(contentDisposition)}"`;
57
57
  if (options.cacheControl || 0 === options.cacheControl) tosHeaders['cache-control'] = `max-age=${options.cacheControl}`;
58
58
  if (options.contentType) tosHeaders['content-type'] = options.contentType;
59
- const tosRes = await put(this.fetch, uploadURL, fileBody, {
59
+ const tosRes = await put(this.fetch, upload_url, fileBody, {
60
60
  noResolveJson: true,
61
- noCredentials: true,
62
61
  headers: tosHeaders,
63
62
  logFetch: this.loggerEnabled,
64
63
  onRequestError: this.onRequestError
@@ -67,8 +66,9 @@ class StorageFileApi {
67
66
  });
68
67
  const etag = tosRes?.headers?.get('Etag') ?? '';
69
68
  const callbackRes = await post(this.fetch, `${this.url}/object/callback`, {
70
- uploadID,
71
- eTag: etag
69
+ upload_id,
70
+ etag,
71
+ app_id: this.appId
72
72
  }, {
73
73
  headers: this.headers,
74
74
  logFetch: this.loggerEnabled,
@@ -113,7 +113,7 @@ class StorageFileApi {
113
113
  try {
114
114
  const _path = this._getFinalPath(path);
115
115
  const res = await post(this.fetch, `${this.url}/object/sign/${_path}`, {
116
- expiresIn: toValidExpiresIn(expiresIn)
116
+ expires_in: toValidExpiresIn(expiresIn)
117
117
  }, {
118
118
  headers: this.headers,
119
119
  logFetch: this.loggerEnabled,
@@ -140,7 +140,7 @@ class StorageFileApi {
140
140
  try {
141
141
  const _paths = paths.map((path)=>this._retrieveFilePathFromDownloadUrl(path));
142
142
  const res = await post(this.fetch, `${this.url}/object/sign/${this.bucketId}`, {
143
- expiresIn: toValidExpiresIn(expiresIn),
143
+ expires_in: toValidExpiresIn(expiresIn),
144
144
  paths: _paths
145
145
  }, {
146
146
  headers: this.headers,
@@ -359,7 +359,7 @@ class StorageFileApi {
359
359
  return '';
360
360
  }
361
361
  async _copyWithinVolcEngine(url) {
362
- const res = await post(this.fetch, `${this.url}/object/${this.bucketId}/copy`, {
362
+ const res = await post(this.fetch, `${this.url}/runtime/app/${this.appId}/object/${this.bucketId}/copy`, {
363
363
  source: {
364
364
  type: 'externalTOS',
365
365
  externalURL: url
@@ -1,12 +1,5 @@
1
1
  import type RateLimiter from '../RateLimiter';
2
2
  import type { Fetch } from './types';
3
3
  export declare const resolveFetch: (customFetch?: Fetch) => Fetch;
4
- /**
5
- * Wrap a fetch implementation with client-side rate limiting.
6
- *
7
- * Storage now relies on cookie session authentication (`credentials: 'include'`
8
- * is added at the storage request layer), so no `apikey` header is injected
9
- * here any more.
10
- */
11
- export declare const createRateLimitedFetch: (rateLimiter?: RateLimiter, customFetch?: Fetch) => Fetch;
4
+ export declare const fetchWithAuth: (dataloomKey: string, rateLimiter?: RateLimiter, customFetch?: Fetch) => Fetch;
12
5
  //# sourceMappingURL=fetch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/utils/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,YAAY,GAAI,cAAc,KAAK,KAAG,KAQlD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,sBAAsB,GACjC,cAAc,WAAW,EACzB,cAAc,KAAK,KAClB,KAeF,CAAC"}
1
+ {"version":3,"file":"fetch.d.ts","sourceRoot":"","sources":["../../src/utils/fetch.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,WAAW,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAErC,eAAO,MAAM,YAAY,GAAI,cAAc,KAAK,KAAG,KAQlD,CAAC;AAEF,eAAO,MAAM,aAAa,GACxB,aAAa,MAAM,EACnB,cAAc,WAAW,EACzB,cAAc,KAAK,KAClB,KAqBF,CAAC"}
@@ -3,14 +3,19 @@ const resolveFetch = (customFetch)=>{
3
3
  _fetch = customFetch ? customFetch : fetch;
4
4
  return (input, init)=>_fetch(input, init);
5
5
  };
6
- const createRateLimitedFetch = (rateLimiter, customFetch)=>{
6
+ const fetchWithAuth = (dataloomKey, rateLimiter, customFetch)=>{
7
7
  const resolvedFetch = resolveFetch(customFetch);
8
8
  return async (input, init)=>{
9
9
  if (rateLimiter && !rateLimiter.canRequest()) return Promise.resolve(new Response(`{"limit": ${rateLimiter.maxRequests}}`, {
10
10
  status: 429,
11
11
  statusText: 'Too Many Requests'
12
12
  }));
13
- return resolvedFetch(input, init);
13
+ const headers = new Headers(init?.headers);
14
+ if (!headers.has('apikey') && dataloomKey) headers.set('apikey', dataloomKey);
15
+ return resolvedFetch(input, {
16
+ ...init,
17
+ headers
18
+ });
14
19
  };
15
20
  };
16
- export { createRateLimitedFetch, resolveFetch };
21
+ export { fetchWithAuth, resolveFetch };
@@ -1,4 +1,5 @@
1
1
  import type { DataloomClientOptions } from './types';
2
+ export declare function stripTrailingSlash(url: string): string;
2
3
  export declare const isBrowser: () => boolean;
3
4
  export declare function applySettingDefaults(options: DataloomClientOptions, defaults: DataloomClientOptions): Required<DataloomClientOptions>;
4
5
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,eAAO,MAAM,SAAS,eAAsC,CAAC;AAE7D,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,qBAAqB,GAC9B,QAAQ,CAAC,qBAAqB,CAAC,CAYjC"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../src/utils/helpers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEtD;AAED,eAAO,MAAM,SAAS,eAAsC,CAAC;AAE7D,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,EAC9B,QAAQ,EAAE,qBAAqB,GAC9B,QAAQ,CAAC,qBAAqB,CAAC,CAYjC"}
@@ -1,3 +1,6 @@
1
+ function stripTrailingSlash(url) {
2
+ return url.replace(/\/$/, '');
3
+ }
1
4
  const isBrowser = ()=>'undefined' != typeof window;
2
5
  function applySettingDefaults(options, defaults) {
3
6
  const { global: globalOptions } = options;
@@ -11,4 +14,4 @@ function applySettingDefaults(options, defaults) {
11
14
  }
12
15
  };
13
16
  }
14
- export { applySettingDefaults, isBrowser };
17
+ export { applySettingDefaults, isBrowser, stripTrailingSlash };
@@ -1,4 +1,3 @@
1
- import type { AccountServicesInjection } from '../service/types';
2
1
  export type Fetch = (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
3
2
  export type OnError = (error: unknown, instance: unknown) => void;
4
3
  export type DataloomClientOptions = {
@@ -31,15 +30,6 @@ export type DataloomClientOptions = {
31
30
  * Optional. The global hook that will be called when a request fails.
32
31
  */
33
32
  onError?: OnError;
34
- /**
35
- * 由 client-toolkit 注入的 account services 引用(user/session)。
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?: AccountServicesInjection;
43
33
  };
44
34
  };
45
35
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/utils/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAEjE,MAAM,MAAM,KAAK,GAAG,CAClB,KAAK,EAAE,WAAW,GAAG,GAAG,EACxB,IAAI,CAAC,EAAE,WAAW,KACf,OAAO,CAAC,QAAQ,CAAC,CAAC;AAEvB,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;;;;;;;WAOG;QACH,eAAe,CAAC,EAAE,wBAAwB,CAAC;KAC5C,CAAC;CACH,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;KACnB,CAAC;CACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lark-apaas/dataloom",
3
- "version": "0.1.4-alpha.0",
3
+ "version": "0.1.4-alpha.2",
4
4
  "types": "./lib/index.d.ts",
5
5
  "main": "./lib/index.js",
6
6
  "files": [
@@ -1,113 +0,0 @@
1
- /**
2
- * Account services 形状契约。
3
- *
4
- * dataloom 自身不持有 user/session 实现(已迁出至 @lark-apaas/auth-sdk),
5
- * 但仍需要类型上的"形状契约"以保证:
6
- * 1. DataloomService.user/session 字段对老调用方有完整类型提示;
7
- * 2. client-toolkit 注入 authClient.user/session 时编译期可结构性校验。
8
- *
9
- * 此处类型镜像自 auth-sdk 的 public 类型(保持结构一致),
10
- * 但**不 import auth-sdk**,避免 dataloom → auth-sdk 的反向依赖。
11
- *
12
- * @see packages/client/auth-sdk/src/account/services/user-service/types.ts
13
- * @see packages/client/auth-sdk/src/account/services/session-service/types.ts
14
- */
15
- export interface AccountServiceError {
16
- code: number;
17
- details: string;
18
- hint: string | null;
19
- message: string;
20
- }
21
- interface AccountServiceBase {
22
- status: number;
23
- statusText: string;
24
- }
25
- export interface AccountServiceSuccess<T> extends AccountServiceBase {
26
- error: null;
27
- data: T;
28
- }
29
- export interface AccountServiceFailure extends AccountServiceBase {
30
- error: AccountServiceError;
31
- data: null;
32
- }
33
- export type AccountServiceResponse<T> = AccountServiceSuccess<T> | AccountServiceFailure;
34
- /** 与 auth-sdk UserStatus 对齐:1 = active / 2 = inactive */
35
- export type UserStatus = 1 | 2;
36
- export interface User {
37
- user_id: string;
38
- email: string;
39
- name: string;
40
- avatar: string;
41
- status: UserStatus;
42
- }
43
- export interface SearchParams {
44
- name: string;
45
- pageSize?: number;
46
- }
47
- export interface UserResponse {
48
- user_list: User[];
49
- }
50
- /**
51
- * 用户服务形状契约(与 auth-sdk `UserService` public 方法对齐)。
52
- */
53
- export interface UserServiceShape {
54
- search(params: SearchParams): Promise<AccountServiceResponse<UserResponse>>;
55
- getByIds(ids: string[] | number[]): Promise<AccountServiceResponse<UserResponse>>;
56
- }
57
- export interface I18n {
58
- language_code: number;
59
- text: string;
60
- }
61
- export type I18ns = I18n[];
62
- export interface Avatar {
63
- source?: string;
64
- image?: {
65
- large?: string;
66
- };
67
- color?: string;
68
- }
69
- export interface UserBaseInfo {
70
- user_id?: number;
71
- name?: I18ns;
72
- avatar?: Avatar;
73
- email?: string;
74
- phone_number?: string;
75
- tenant_name?: string;
76
- }
77
- export interface UserInfoResponse {
78
- user_info?: UserBaseInfo;
79
- }
80
- export interface SignInRedirectionOptions {
81
- /** The URL to redirect to after a successful login. Defaults to the current URL. */
82
- returnUrl?: string;
83
- /** Whether to open the login page in a new tab. Defaults to `false`. */
84
- newTab?: boolean;
85
- }
86
- export interface NavigateToUserProfileOptions {
87
- newTab?: boolean;
88
- }
89
- /**
90
- * 会话服务形状契约(与 auth-sdk `SessionService` public 方法对齐)。
91
- *
92
- * 注意:`redirectToLogin` / `navigateToUserProfile` 的成功分支在 auth-sdk
93
- * 实现中返回 `data: 'success'`;但其中 `navigateToUserProfile` 未显式标注
94
- * 返回类型,TS 会把字面量推断为 `string`。为了让 auth-sdk 的实例可结构性
95
- * 赋值到本契约,这里成功分支用 `string` 而非 `'success'` 字面量。
96
- */
97
- export interface SessionServiceShape {
98
- redirectToLogin(options?: SignInRedirectionOptions): AccountServiceResponse<string>;
99
- signOut(): Promise<AccountServiceResponse<null>>;
100
- getUrlWithBizSource(): string;
101
- getUserInfo(): Promise<AccountServiceResponse<UserInfoResponse>>;
102
- navigateToUserProfile(options?: NavigateToUserProfileOptions): AccountServiceResponse<string>;
103
- }
104
- /**
105
- * 注入到 DataloomService 的 account services 引用。
106
- * 由 client-toolkit 在创建 DataloomClient 时通过 options.global.accountServices 注入。
107
- */
108
- export interface AccountServicesInjection {
109
- user: UserServiceShape;
110
- session: SessionServiceShape;
111
- }
112
- export {};
113
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/service/types.ts"],"names":[],"mappings":"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"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Read the `suda-csrf-token` value used to guard state-changing requests
3
- * against CSRF.
4
- *
5
- * This intentionally re-implements the toolkit's `getCsrfToken` logic inside
6
- * dataloom: dataloom is a low-level package and must not import toolkit
7
- * (package boundary B1/B2). Keep the lookup order identical to toolkit:
8
- * 1. read the `suda-csrf-token` cookie (URL-decoded)
9
- * 2. fall back to `window.csrfToken` (set in fullstack mode)
10
- * 3. return '' in non-browser environments (no document)
11
- *
12
- * @returns the csrf token, or an empty string when unavailable.
13
- */
14
- export declare function getCsrfToken(): string;
15
- //# sourceMappingURL=csrf.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"csrf.d.ts","sourceRoot":"","sources":["../../../src/storage/utils/csrf.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,wBAAgB,YAAY,IAAI,MAAM,CAqBrC"}
@@ -1,12 +0,0 @@
1
- function getCsrfToken() {
2
- if ('undefined' == typeof document) return '';
3
- const cookieName = 'suda-csrf-token';
4
- const cookies = (document.cookie ?? '').split('; ');
5
- for (const cookie of cookies){
6
- const [name, value] = cookie.split('=');
7
- if (name === cookieName && void 0 !== value) return decodeURIComponent(value);
8
- }
9
- if ('undefined' != typeof window) return window.csrfToken ?? '';
10
- return '';
11
- }
12
- export { getCsrfToken };