@gsc-basic/shared-service 1.3.0 → 1.4.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/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { App, DefineComponent, Plugin, Ref } from 'vue';
1
+ import type { App, DefineComponent, InjectionKey, Plugin, Ref } from 'vue';
2
2
 
3
3
  declare const SharedServicePlugin: Plugin;
4
4
  export default SharedServicePlugin;
@@ -23,6 +23,7 @@ export interface LocaleMessages {
23
23
  export interface SharedGridComponentProps {
24
24
  locale?: LocaleMessages;
25
25
  gridProps?: AnyRecord;
26
+ client?: SharedServiceClient;
26
27
  }
27
28
 
28
29
  export interface UploadButtonPreUploadConfig extends AnyRecord {
@@ -34,6 +35,7 @@ export interface UploadButtonProps {
34
35
  btnProps?: AnyRecord;
35
36
  locale?: LocaleMessages;
36
37
  preUpload?: UploadButtonPreUploadConfig;
38
+ client?: SharedServiceClient;
37
39
  }
38
40
 
39
41
  export interface EmailCenterTemplateProps extends SharedGridComponentProps {
@@ -129,6 +131,7 @@ export interface RequestOptions extends AnyRecord {
129
131
  export interface CreateRequestOptions {
130
132
  baseUrl?: string;
131
133
  defaultOptions?: RequestOptions;
134
+ getToken?: () => Promise<string | null>;
132
135
  }
133
136
 
134
137
  export interface RequestInstance {
@@ -152,6 +155,44 @@ export const setRequestBaseUrl: (baseUrl: string) => void;
152
155
  export const getRequestBaseUrl: () => string;
153
156
  export function setBasicAuthCacheKeySuffix(cacheKeySuffix?: string): void;
154
157
 
158
+ export interface SharedServiceClient {
159
+ transport: RequestInstance;
160
+ request: <TResult = unknown, TPayload = AnyRecord>(
161
+ args: RequestApiArgs<TPayload>,
162
+ ) => Promise<StandardApiResponse<TResult> | TResult>;
163
+ }
164
+
165
+ export interface CreateSharedServiceClientOptions extends CreateRequestOptions {
166
+ basicAuth?: {
167
+ getBasicToken: () => Promise<string | null>;
168
+ };
169
+ }
170
+
171
+ export function createSharedServiceClient(
172
+ options?: CreateSharedServiceClientOptions,
173
+ ): SharedServiceClient;
174
+
175
+ export const defaultSharedServiceClient: SharedServiceClient;
176
+
177
+ export const SHARED_SERVICE_CLIENT_KEY: InjectionKey<MaybeRef<SharedServiceClient>>;
178
+
179
+ export const SharedServiceClientProvider: DefineComponent<{
180
+ client: SharedServiceClient;
181
+ }>;
182
+
183
+ export function useSharedServiceClient(
184
+ explicitClient?: SharedServiceClient,
185
+ ): SharedServiceClient;
186
+
187
+ export function createRequestExecutor(
188
+ requestTransport: RequestInstance,
189
+ ): SharedServiceClient['request'];
190
+
191
+ export function bindApiModuleToClient<TApi extends Record<string, unknown>>(
192
+ client: SharedServiceClient,
193
+ apiModule: TApi,
194
+ ): TApi;
195
+
155
196
  export interface RequestApiArgs<TPayload = AnyRecord> {
156
197
  method: RequestMethod;
157
198
  url: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gsc-basic/shared-service",
3
3
  "type": "module",
4
- "version": "1.3.0",
4
+ "version": "1.4.0",
5
5
  "description": "Web Shared Service for GSC Basic Team",
6
6
  "author": "Lenovo SSG BASD <-GSC_Scaffolding_Support@lenovo.com>",
7
7
  "license": "LicenseRef-Proprietary",
@@ -40,33 +40,33 @@
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@gsc-basic/hooks": "1.2.7",
43
- "@gsc-basic/utils": "1.4.5",
44
- "vue": "^3.5.44",
45
- "vxe-pc-ui": "~4.20.37",
46
- "vxe-table": "~4.23.15",
43
+ "@gsc-basic/utils": "1.4.6",
44
+ "vue": "^3.5.46",
45
+ "vxe-pc-ui": "~4.21.7",
46
+ "vxe-table": "~4.24.5",
47
47
  "xe-utils": "~4.1.5"
48
48
  },
49
49
  "dependencies": {
50
50
  "@gsc-basic/service-auth": "1.0.5",
51
- "@iconify/json": "^2.2.553",
51
+ "@iconify/json": "^2.2.561",
52
52
  "@tinymce/tinymce-vue": "^6.3.0",
53
- "@vueuse/core": "^15.0.0",
53
+ "@vueuse/core": "^15.1.0",
54
54
  "dayjs": "^1.11.23",
55
55
  "lodash-es": "^4.18.1",
56
- "tinymce": "^8.10.1"
56
+ "tinymce": "^8.11.0"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@gsc-basic/hooks": "1.2.7",
60
60
  "@gsc-basic/unocss-config": "1.1.7",
61
- "@gsc-basic/utils": "1.4.5",
61
+ "@gsc-basic/utils": "1.4.6",
62
62
  "less": "^4.9.1",
63
- "postcss": "^8.5.32",
64
- "postcss-preset-env": "^11.6.2",
65
- "sass": "^1.107.1",
66
- "unocss": "^66.12.0",
67
- "vue": "^3.5.44",
68
- "vxe-pc-ui": "~4.20.37",
69
- "vxe-table": "~4.23.15",
63
+ "postcss": "^8.5.33",
64
+ "postcss-preset-env": "^11.6.3",
65
+ "sass": "^1.108.2",
66
+ "unocss": "^66.13.0",
67
+ "vue": "^3.5.46",
68
+ "vxe-pc-ui": "~4.21.7",
69
+ "vxe-table": "~4.24.5",
70
70
  "xe-utils": "~4.1.5"
71
71
  },
72
72
  "scripts": {