@cloudbase/js-sdk 3.8.2-beta.1 → 3.8.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 (153) hide show
  1. package/ai/dist/AI.d.ts +29 -0
  2. package/ai/dist/bot/index.d.ts +41 -0
  3. package/ai/dist/bot/types.d.ts +144 -0
  4. package/ai/dist/errors.d.ts +10 -0
  5. package/ai/dist/eventsource_parser/index.d.ts +2 -0
  6. package/ai/dist/eventsource_parser/parse.d.ts +2 -0
  7. package/ai/dist/eventsource_parser/stream.d.ts +5 -0
  8. package/ai/dist/eventsource_parser/types.d.ts +16 -0
  9. package/ai/dist/index.d.ts +42 -1
  10. package/ai/dist/models/Ark/index.d.ts +10 -0
  11. package/ai/dist/models/Ark/type.d.ts +71 -0
  12. package/ai/dist/models/DashScope/index.d.ts +10 -0
  13. package/ai/dist/models/DashScope/type.d.ts +74 -0
  14. package/ai/dist/models/DeepSeek/index.d.ts +10 -0
  15. package/ai/dist/models/Default/index.d.ts +10 -0
  16. package/ai/dist/models/HunYuan/index.d.ts +10 -0
  17. package/ai/dist/models/HunYuan/type.d.ts +74 -0
  18. package/ai/dist/models/HunYuan/util.d.ts +4 -0
  19. package/ai/dist/models/HunYuanBeta/index.d.ts +10 -0
  20. package/ai/dist/models/HunYuanExp/index.d.ts +10 -0
  21. package/ai/dist/models/HunYuanOpen/index.d.ts +10 -0
  22. package/ai/dist/models/Moonshot/index.d.ts +10 -0
  23. package/ai/dist/models/Moonshot/type.d.ts +85 -0
  24. package/ai/dist/models/Yi/index.d.ts +10 -0
  25. package/ai/dist/models/Yi/type.d.ts +75 -0
  26. package/ai/dist/models/ZhiPu/index.d.ts +10 -0
  27. package/ai/dist/models/ZhiPu/type.d.ts +71 -0
  28. package/ai/dist/models/image-model.d.ts +19 -0
  29. package/ai/dist/models/index.d.ts +26 -0
  30. package/ai/dist/models/model.d.ts +40 -0
  31. package/ai/dist/type.d.ts +192 -0
  32. package/ai/dist/utils.d.ts +38 -0
  33. package/apis/dist/callApis.d.ts +20 -0
  34. package/apis/dist/index.d.ts +5 -1
  35. package/apis/dist/type.d.ts +14 -0
  36. package/app/dist/constants/common.d.ts +38 -0
  37. package/app/dist/index.d.ts +66 -7
  38. package/app/dist/index.esm.js +1 -1
  39. package/app/dist/index.esm.js.map +1 -1
  40. package/app/dist/index.js +1 -1
  41. package/app/dist/index.js.map +1 -1
  42. package/app/dist/index.node.d.ts +6 -0
  43. package/app/dist/index.node.esm.js +1 -1
  44. package/app/dist/index.node.esm.js.map +1 -1
  45. package/app/dist/index.node.js +1 -1
  46. package/app/dist/index.node.js.map +1 -1
  47. package/app/dist/libs/adapter-node/constants.d.ts +33 -0
  48. package/app/dist/libs/adapter-node/context.d.ts +18 -0
  49. package/app/dist/libs/adapter-node/index.d.ts +26 -0
  50. package/app/dist/libs/adapter-node/metadata.d.ts +14 -0
  51. package/app/dist/libs/adapter-node/optional-require.d.ts +1 -0
  52. package/app/dist/libs/adapter-node/request.d.ts +44 -0
  53. package/app/dist/libs/adapter-node/tool.d.ts +2 -0
  54. package/app/dist/libs/adapter-node/types.d.ts +103 -0
  55. package/app/dist/libs/adapter-node/utils.d.ts +37 -0
  56. package/app/dist/libs/adapter-node/wx.d.ts +39 -0
  57. package/app/dist/libs/adapter.d.ts +3 -0
  58. package/app/dist/libs/cache.d.ts +6 -0
  59. package/app/dist/libs/component.d.ts +3 -0
  60. package/app/dist/libs/lang.d.ts +23 -0
  61. package/app/dist/libs/request.d.ts +62 -0
  62. package/auth/dist/adapter.d.ts +2 -0
  63. package/auth/dist/index.d.ts +271 -2
  64. package/auth/dist/type.d.ts +295 -0
  65. package/auth/dist/utilities.d.ts +7 -0
  66. package/auth/dist/utils.d.ts +5 -0
  67. package/auth/dist/v1-compat.d.ts +77 -0
  68. package/cloudrun/dist/index.d.ts +4 -1
  69. package/container/dist/constants/index.d.ts +1 -0
  70. package/container/dist/go_wams_exec.d.ts +2 -0
  71. package/container/dist/index.d.ts +13 -2
  72. package/container/dist/utils/index.d.ts +3 -0
  73. package/container/dist/utils/loader.d.ts +8 -0
  74. package/container/dist/utils/request.d.ts +12 -0
  75. package/core.d.ts +84 -81
  76. package/database/dist/index.d.ts +1 -1
  77. package/dist/index.cjs.js +1 -1
  78. package/dist/index.cjs.js.map +1 -1
  79. package/dist/index.esm.js +1 -1
  80. package/dist/index.esm.js.map +1 -1
  81. package/dist/index.node.cjs.js +1 -1
  82. package/dist/index.node.cjs.js.map +1 -1
  83. package/dist/index.node.esm.js +1 -1
  84. package/dist/index.node.esm.js.map +1 -1
  85. package/functions/dist/index.d.ts +2 -2
  86. package/miniprogram_dist/ai/index.d.ts +1 -1
  87. package/miniprogram_dist/apis/index.d.ts +1 -1
  88. package/miniprogram_dist/app/index.d.ts +5 -5
  89. package/miniprogram_dist/auth/index.d.ts +7 -7
  90. package/miniprogram_dist/cloudrun/index.d.ts +2 -2
  91. package/miniprogram_dist/container/index.d.ts +2 -2
  92. package/miniprogram_dist/database/index.d.ts +1 -1
  93. package/miniprogram_dist/functions/index.d.ts +1 -1
  94. package/miniprogram_dist/index.js +1 -1
  95. package/miniprogram_dist/model/index.d.ts +1 -1
  96. package/miniprogram_dist/mysql/index.d.ts +1 -1
  97. package/miniprogram_dist/realtime/index.d.ts +1 -1
  98. package/miniprogram_dist/storage/index.d.ts +1 -1
  99. package/model/dist/index.d.ts +5 -1
  100. package/mysql/dist/index.d.ts +4 -1
  101. package/oauth/dist/auth/apis.d.ts +143 -0
  102. package/oauth/dist/auth/auth-error.d.ts +32 -0
  103. package/oauth/dist/auth/consts.d.ts +165 -0
  104. package/oauth/dist/auth/models.d.ts +557 -0
  105. package/oauth/dist/captcha/captcha-dom.d.ts +3 -0
  106. package/oauth/dist/captcha/captcha.d.ts +42 -0
  107. package/oauth/dist/index.d.ts +22 -1
  108. package/oauth/dist/oauth2client/consts.d.ts +20 -0
  109. package/oauth/dist/oauth2client/interface.d.ts +15 -0
  110. package/oauth/dist/oauth2client/models.d.ts +75 -0
  111. package/oauth/dist/oauth2client/oauth2client.d.ts +154 -0
  112. package/oauth/dist/utils/base64.d.ts +9 -0
  113. package/oauth/dist/utils/encrypt.d.ts +4 -0
  114. package/oauth/dist/utils/encryptlong/index.d.ts +546 -0
  115. package/oauth/dist/utils/function/single-promise.d.ts +10 -0
  116. package/oauth/dist/utils/index.d.ts +2 -0
  117. package/oauth/dist/utils/mp.d.ts +2 -0
  118. package/oauth/dist/utils/urlSearchParams.d.ts +13 -0
  119. package/oauth/dist/utils/uuid.d.ts +1 -0
  120. package/package.json +24 -4
  121. package/realtime/dist/common.d.ts +4 -0
  122. package/realtime/dist/error.d.ts +36 -0
  123. package/realtime/dist/index.d.ts +4 -2
  124. package/realtime/dist/listener.d.ts +14 -0
  125. package/realtime/dist/message.d.ts +3 -0
  126. package/realtime/dist/snapshot.d.ts +17 -0
  127. package/realtime/dist/utils.d.ts +1 -0
  128. package/realtime/dist/virtual-websocket-client.d.ts +62 -0
  129. package/realtime/dist/websocket-client.d.ts +78 -0
  130. package/realtime/dist/ws-event.d.ts +126 -0
  131. package/storage/dist/cloudbase-storage.d.ts +58 -0
  132. package/storage/dist/download-builder.d.ts +24 -0
  133. package/storage/dist/encoding.d.ts +3 -0
  134. package/storage/dist/http.d.ts +38 -0
  135. package/storage/dist/index.d.ts +13 -2
  136. package/storage/dist/node-types.d.ts +6 -0
  137. package/storage/dist/storage-bucket-api-neo.d.ts +15 -0
  138. package/storage/dist/storage-file-api-classic.d.ts +80 -0
  139. package/storage/dist/storage-file-api-neo.d.ts +48 -0
  140. package/storage/dist/supabase/errors.d.ts +20 -0
  141. package/storage/dist/supabase/types.d.ts +63 -0
  142. package/storage/dist/types.d.ts +142 -0
  143. package/storage/dist/validation.d.ts +2 -0
  144. package/types/auth.d.ts +1 -1
  145. package/types/index.d.ts +3 -2
  146. package/types/package.json +1 -1
  147. package/utilities/dist/cjs/libs/cache.d.ts +2 -2
  148. package/utilities/dist/cjs/libs/events.d.ts +1 -1
  149. package/utilities/dist/cjs/libs/util.d.ts +1 -1
  150. package/utilities/dist/esm/libs/cache.d.ts +2 -2
  151. package/utilities/dist/esm/libs/events.d.ts +1 -1
  152. package/utilities/dist/esm/libs/util.d.ts +1 -1
  153. package/utilities/package.json +1 -1
@@ -0,0 +1,75 @@
1
+ import { SimpleStorage } from './interface';
2
+ import { ErrorType } from './consts';
3
+ import { AuthOptions } from '../auth/apis';
4
+ import { ICloudbaseConfig } from '@cloudbase/js-sdk/types';
5
+ export interface Credentials {
6
+ token_type?: string | null;
7
+ access_token?: string | null;
8
+ refresh_token?: string | null;
9
+ scope?: string | null;
10
+ expires_in?: number | null;
11
+ expires_at?: Date | null;
12
+ sub?: string | null;
13
+ groups?: string[] | null;
14
+ version?: string;
15
+ }
16
+ export interface ResponseError {
17
+ error: ErrorType;
18
+ error_description?: string | null;
19
+ error_uri?: string | null;
20
+ details?: any | null;
21
+ }
22
+ export interface RequestOptions {
23
+ body?: any | null;
24
+ headers?: any | null;
25
+ method?: string;
26
+ [key: string]: any;
27
+ }
28
+ export type RequestFunction = <T>(url: string, options?: RequestOptions) => Promise<T>;
29
+ export interface AuthClientRequestOptions extends RequestOptions {
30
+ headers?: {
31
+ 'x-request-id'?: string;
32
+ [key: string]: any;
33
+ } | null;
34
+ withCredentials?: boolean;
35
+ withBasicAuth?: boolean;
36
+ retry?: number;
37
+ useWxCloud?: boolean;
38
+ getCredentials?: () => Credentials | Promise<Credentials | null> | null;
39
+ [key: string]: any;
40
+ }
41
+ export interface OAuth2ClientOptions {
42
+ devMode?: boolean;
43
+ apiOrigin?: string;
44
+ getApiOrigin?: () => string;
45
+ apiPath?: string;
46
+ clientId: string;
47
+ env: string;
48
+ retry?: number;
49
+ baseRequest?: <T>(url: string, options?: RequestOptions) => Promise<T>;
50
+ storage?: SimpleStorage;
51
+ clientSecret?: string;
52
+ refreshTokenFunc?: (refreshToken?: string) => Promise<Credentials>;
53
+ tokenInURL?: boolean;
54
+ headers?: {
55
+ [key: string]: string;
56
+ };
57
+ anonymousSignInFunc?: (Credentials: any) => Promise<Credentials | void>;
58
+ wxCloud?: any;
59
+ onCredentialsError?: AuthOptions['onCredentialsError'];
60
+ i18n?: ICloudbaseConfig['i18n'];
61
+ useWxCloud?: boolean;
62
+ eventBus?: any;
63
+ debug?: boolean;
64
+ getInitialSession?: () => Promise<{
65
+ data: {
66
+ session: Credentials;
67
+ user?: any;
68
+ } | null;
69
+ error: Error | null;
70
+ }>;
71
+ onInitialSessionObtained?: (data: {
72
+ session: Credentials;
73
+ user?: any;
74
+ }) => void | Promise<void>;
75
+ }
@@ -0,0 +1,154 @@
1
+ import { ErrorType } from './consts';
2
+ import { AuthClient, SimpleStorage } from './interface';
3
+ import { Credentials, ResponseError, RequestOptions, RequestFunction, OAuth2ClientOptions, AuthClientRequestOptions } from './models';
4
+ export interface ToResponseErrorOptions {
5
+ error?: ErrorType;
6
+ error_description?: string | null;
7
+ error_uri?: string | null;
8
+ details?: any | null;
9
+ }
10
+ export declare const defaultRequest: RequestFunction;
11
+ export declare const toResponseError: (error: ResponseError | Error, options?: ToResponseErrorOptions) => ResponseError;
12
+ export declare function generateRequestId(): string;
13
+ declare class DefaultStorage implements SimpleStorage {
14
+ private readonly _env;
15
+ constructor(opts?: {
16
+ env: string;
17
+ });
18
+ getItem(key: string): Promise<string | null>;
19
+ removeItem(key: string): Promise<void>;
20
+ setItem(key: string, value: string): Promise<void>;
21
+ getItemSync(key: string): string | null;
22
+ removeItemSync(key: string): void;
23
+ setItemSync(key: string, value: string): void;
24
+ }
25
+ export declare const defaultStorage: DefaultStorage;
26
+ type CredentialsChangeContext = {
27
+ isInit: boolean;
28
+ hadCredentials: boolean;
29
+ };
30
+ interface LocalCredentialsOptions {
31
+ tokenSectionName: string;
32
+ storage: SimpleStorage;
33
+ clientId: string;
34
+ credentials?: Credentials;
35
+ onCredentialsChange?: (credentials: Credentials | null, context: CredentialsChangeContext) => void;
36
+ }
37
+ declare class LocalCredentials {
38
+ private tokenSectionName;
39
+ private storage;
40
+ private clientId;
41
+ private credentials;
42
+ private accessKeyCredentials;
43
+ private singlePromise;
44
+ private onCredentialsChange?;
45
+ constructor(options: LocalCredentialsOptions);
46
+ syncMemoryCredentials(credentials: Credentials | null): void;
47
+ getMemoryCredentials(): Credentials | null;
48
+ getStorageCredentialsSync(): Credentials | null;
49
+ setCredentials(credentials?: Credentials, options?: {
50
+ isInit?: boolean;
51
+ }): Promise<void>;
52
+ setAccessKeyCredentials(credentials?: Credentials): void;
53
+ getCredentials(): Promise<Credentials | null>;
54
+ private getStorageCredentials;
55
+ }
56
+ export declare class OAuth2Client implements AuthClient {
57
+ private static defaultRetry;
58
+ private static minRetry;
59
+ private static maxRetry;
60
+ private static retryInterval;
61
+ localCredentials: LocalCredentials;
62
+ initializePromise: Promise<{
63
+ error: Error | null;
64
+ }> | null;
65
+ protected lockAcquired: boolean;
66
+ protected pendingInLock: Promise<any>[];
67
+ protected logDebugMessages: boolean;
68
+ protected getInitialSession?: () => Promise<{
69
+ data: {
70
+ session: Credentials;
71
+ user?: any;
72
+ } | null;
73
+ error: Error | null;
74
+ }>;
75
+ private apiOrigin;
76
+ private getApiOriginFunc?;
77
+ private apiPath;
78
+ private clientId;
79
+ private i18n;
80
+ private retry;
81
+ private clientSecret?;
82
+ private baseRequest;
83
+ private storage;
84
+ private deviceID?;
85
+ private tokenInURL?;
86
+ private refreshTokenFunc;
87
+ private headers?;
88
+ private singlePromise;
89
+ private anonymousSignInFunc;
90
+ private wxCloud;
91
+ private useWxCloud;
92
+ private eventBus;
93
+ private basicAuth;
94
+ private onCredentialsError;
95
+ private onInitialSessionObtained?;
96
+ private broadcastChannel?;
97
+ private broadcastChannelName?;
98
+ private visibilityEventHandler?;
99
+ private _initSessionEmitted;
100
+ constructor(options: OAuth2ClientOptions);
101
+ setGetInitialSession(callback: () => Promise<{
102
+ data: {
103
+ session: Credentials;
104
+ user?: any;
105
+ } | null;
106
+ error: Error | null;
107
+ }>): void;
108
+ setOnInitialSessionObtained(callback: (data: {
109
+ session: Credentials;
110
+ user?: any;
111
+ }) => void | Promise<void>): void;
112
+ initialize(func?: Promise<{
113
+ error: Error | null;
114
+ }>): Promise<{
115
+ error: Error | null;
116
+ }>;
117
+ setCredentials(credentials?: Credentials): Promise<void>;
118
+ get initSessionEmitted(): boolean;
119
+ destroy(): void;
120
+ setAccessKeyCredentials(credentials?: Credentials): void;
121
+ getAccessToken(): Promise<string>;
122
+ request<T>(url: string, options?: AuthClientRequestOptions): Promise<T>;
123
+ wxCloudCallFunction<T>(url: string, options?: RequestOptions): Promise<T>;
124
+ getCredentials(): Promise<Credentials | null>;
125
+ getCredentialsSync(): Credentials | null;
126
+ getCredentialsAsync(): Promise<Credentials | null>;
127
+ getScope(): Promise<string>;
128
+ getGroups(): Promise<string[]>;
129
+ refreshToken(credentials: Credentials, options?: {
130
+ throwError?: boolean;
131
+ }): Promise<Credentials>;
132
+ private _refreshToken;
133
+ private anonymousLogin;
134
+ private checkRetry;
135
+ private formatRetry;
136
+ private sleep;
137
+ private anonymousSignIn;
138
+ private defaultRefreshTokenFunc;
139
+ private getDeviceId;
140
+ private unAuthenticatedError;
141
+ private _debug;
142
+ private _initialize;
143
+ private _acquireLock;
144
+ private _getCredentials;
145
+ private _isUserCredentials;
146
+ private _fireCredentialsEvents;
147
+ private _handleCredentialsChange;
148
+ private _initBroadcastChannel;
149
+ private _broadcastCredentials;
150
+ private _handleBroadcastMessage;
151
+ private _initVisibilityListener;
152
+ private _onVisibilityChanged;
153
+ }
154
+ export {};
@@ -0,0 +1,9 @@
1
+ export declare function weBtoa(string: string): string;
2
+ export declare const weAtob: (string: string) => string;
3
+ export declare function base64_url_decode(str: string): string;
4
+ export declare function weappJwtDecode(token: string, options?: any): any;
5
+ export declare function weAppJwtDecodeAll(token: string): {
6
+ claims: any;
7
+ header: any;
8
+ signature: any;
9
+ };
@@ -0,0 +1,4 @@
1
+ export declare const getEncryptInfo: ({ publicKey, payload }?: {
2
+ publicKey?: string;
3
+ payload?: any;
4
+ }) => any;