@nocobase/client 0.7.6-alpha.2 → 0.7.7-alpha.1

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.
@@ -2,6 +2,7 @@ import { APIClient as APIClientSDK } from '@nocobase/sdk';
2
2
  import { Result } from 'ahooks/lib/useRequest/src/types';
3
3
  export declare class APIClient extends APIClientSDK {
4
4
  services: Record<string, Result<any, any>>;
5
+ service(uid: string): Result<any, any>;
5
6
  interceptors(): void;
6
7
  notification(): void;
7
8
  }
@@ -42,11 +42,16 @@ export var APIClient = /*#__PURE__*/function (_APIClientSDK) {
42
42
  }
43
43
 
44
44
  _this = _super.call.apply(_super, [this].concat(args));
45
- _this.services = void 0;
45
+ _this.services = {};
46
46
  return _this;
47
47
  }
48
48
 
49
49
  _createClass(APIClient, [{
50
+ key: "service",
51
+ value: function service(uid) {
52
+ return this.services[uid];
53
+ }
54
+ }, {
50
55
  key: "interceptors",
51
56
  value: function interceptors() {
52
57
  _get(_getPrototypeOf(APIClient.prototype), "interceptors", this).call(this);
@@ -10,7 +10,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
10
10
 
11
11
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
12
12
 
13
- import { useField } from '@formily/react';
13
+ import { useField, useFieldSchema } from '@formily/react';
14
14
  import { useRequest } from 'ahooks';
15
15
  import template from 'lodash/template';
16
16
  import React, { createContext, useContext } from 'react';
@@ -97,6 +97,8 @@ export var useResourceAction = function useResourceAction(props) {
97
97
  return field.name;
98
98
  });
99
99
  var params = useActionParams(props);
100
+ var api = useAPIClient();
101
+ var fieldSchema = useFieldSchema();
100
102
 
101
103
  if (!Object.keys(params).includes('appends') && (appends === null || appends === void 0 ? void 0 : appends.length)) {
102
104
  params['appends'] = appends;
@@ -117,6 +119,15 @@ export var useResourceAction = function useResourceAction(props) {
117
119
  return res.data;
118
120
  });
119
121
  }, _objectSpread(_objectSpread({}, opts), {}, {
122
+ onSuccess: function onSuccess(data, params) {
123
+ var _opts$onSuccess;
124
+
125
+ opts === null || opts === void 0 ? void 0 : (_opts$onSuccess = opts['onSuccess']) === null || _opts$onSuccess === void 0 ? void 0 : _opts$onSuccess.call(opts, data, params);
126
+
127
+ if (fieldSchema['x-uid']) {
128
+ api.services[fieldSchema['x-uid']] = result;
129
+ }
130
+ },
120
131
  defaultParams: [params],
121
132
  refreshDeps: [JSON.stringify(params.appends)]
122
133
  }));
@@ -413,6 +413,7 @@ declare const _default: {
413
413
  "Use the built-in static file server": string;
414
414
  "Local storage": string;
415
415
  "Aliyun OSS": string;
416
+ "Tencent COS": string;
416
417
  "Amazon S3": string;
417
418
  Workflow: string;
418
419
  "Execution History": string;
@@ -413,6 +413,7 @@ export default {
413
413
  "Use the built-in static file server": "Use the built-in static file server",
414
414
  "Local storage": "Local storage",
415
415
  "Aliyun OSS": "Aliyun OSS",
416
+ "Tencent COS": "Tencent COS",
416
417
  "Amazon S3": "Amazon S3",
417
418
  "Workflow": "Workflow",
418
419
  "Execution History": "Execution History",
@@ -413,6 +413,7 @@ declare const _default: {
413
413
  "Use the built-in static file server": string;
414
414
  "Local storage": string;
415
415
  "Aliyun OSS": string;
416
+ "Tencent COS": string;
416
417
  "Amazon S3": string;
417
418
  Workflow: string;
418
419
  "Execution History": string;
@@ -413,6 +413,7 @@ export default {
413
413
  "Use the built-in static file server": "組み込みの静的ファイル サービスを使用する",
414
414
  "Local storage": "ローカルストレージ",
415
415
  "Aliyun OSS": "Aliyun OSS",
416
+ "Tencent COS": "Tencent COS",
416
417
  "Amazon S3": "Amazon S3",
417
418
  "Workflow": "ワークフロー",
418
419
  "Execution History": "実行履歴",
@@ -413,6 +413,7 @@ declare const _default: {
413
413
  "Use the built-in static file server": string;
414
414
  "Local storage": string;
415
415
  "Aliyun OSS": string;
416
+ "Tencent COS": string;
416
417
  "Amazon S3": string;
417
418
  Workflow: string;
418
419
  "Execution History": string;
@@ -413,6 +413,7 @@ export default {
413
413
  "Use the built-in static file server": "Использовать встроенный статический файл-сервер",
414
414
  "Local storage": "Локальное хранилище",
415
415
  "Aliyun OSS": "Aliyun OSS",
416
+ "Tencent COS": "Tencent COS",
416
417
  "Amazon S3": "Amazon S3",
417
418
  "Workflow": "Workflow",
418
419
  "Execution History": "История запусков",
@@ -474,6 +474,7 @@ declare const _default: {
474
474
  'Local storage': string;
475
475
  'Aliyun OSS': string;
476
476
  'Amazon S3': string;
477
+ 'Tencent COS': string;
477
478
  Region: string;
478
479
  Bucket: string;
479
480
  Path: string;
@@ -474,6 +474,7 @@ export default {
474
474
  'Local storage': '本地存储',
475
475
  'Aliyun OSS': '阿里云 OSS',
476
476
  'Amazon S3': '亚马逊 S3',
477
+ 'Tencent COS': '腾讯云 COS',
477
478
  'Region': '区域',
478
479
  'Bucket': '存储桶',
479
480
  'Path': '路径(相对)',
@@ -2,6 +2,7 @@ import { APIClient as APIClientSDK } from '@nocobase/sdk';
2
2
  import { Result } from 'ahooks/lib/useRequest/src/types';
3
3
  export declare class APIClient extends APIClientSDK {
4
4
  services: Record<string, Result<any, any>>;
5
+ service(uid: string): Result<any, any>;
5
6
  interceptors(): void;
6
7
  notification(): void;
7
8
  }
@@ -54,11 +54,16 @@ var APIClient = /*#__PURE__*/function (_APIClientSDK) {
54
54
  }
55
55
 
56
56
  _this = _super.call.apply(_super, [this].concat(args));
57
- _this.services = void 0;
57
+ _this.services = {};
58
58
  return _this;
59
59
  }
60
60
 
61
61
  _createClass(APIClient, [{
62
+ key: "service",
63
+ value: function service(uid) {
64
+ return this.services[uid];
65
+ }
66
+ }, {
62
67
  key: "interceptors",
63
68
  value: function interceptors() {
64
69
  _get(_getPrototypeOf(APIClient.prototype), "interceptors", this).call(this);
@@ -125,6 +125,8 @@ var useResourceAction = function useResourceAction(props) {
125
125
  return field.name;
126
126
  });
127
127
  var params = useActionParams(props);
128
+ var api = (0, _.useAPIClient)();
129
+ var fieldSchema = (0, _react.useFieldSchema)();
128
130
 
129
131
  if (!Object.keys(params).includes('appends') && (appends === null || appends === void 0 ? void 0 : appends.length)) {
130
132
  params['appends'] = appends;
@@ -145,6 +147,15 @@ var useResourceAction = function useResourceAction(props) {
145
147
  return res.data;
146
148
  });
147
149
  }, _objectSpread(_objectSpread({}, opts), {}, {
150
+ onSuccess: function onSuccess(data, params) {
151
+ var _opts$onSuccess;
152
+
153
+ opts === null || opts === void 0 ? void 0 : (_opts$onSuccess = opts['onSuccess']) === null || _opts$onSuccess === void 0 ? void 0 : _opts$onSuccess.call(opts, data, params);
154
+
155
+ if (fieldSchema['x-uid']) {
156
+ api.services[fieldSchema['x-uid']] = result;
157
+ }
158
+ },
148
159
  defaultParams: [params],
149
160
  refreshDeps: [JSON.stringify(params.appends)]
150
161
  }));
@@ -413,6 +413,7 @@ declare const _default: {
413
413
  "Use the built-in static file server": string;
414
414
  "Local storage": string;
415
415
  "Aliyun OSS": string;
416
+ "Tencent COS": string;
416
417
  "Amazon S3": string;
417
418
  Workflow: string;
418
419
  "Execution History": string;
@@ -419,6 +419,7 @@ var _default = {
419
419
  "Use the built-in static file server": "Use the built-in static file server",
420
420
  "Local storage": "Local storage",
421
421
  "Aliyun OSS": "Aliyun OSS",
422
+ "Tencent COS": "Tencent COS",
422
423
  "Amazon S3": "Amazon S3",
423
424
  "Workflow": "Workflow",
424
425
  "Execution History": "Execution History",
@@ -413,6 +413,7 @@ declare const _default: {
413
413
  "Use the built-in static file server": string;
414
414
  "Local storage": string;
415
415
  "Aliyun OSS": string;
416
+ "Tencent COS": string;
416
417
  "Amazon S3": string;
417
418
  Workflow: string;
418
419
  "Execution History": string;
@@ -419,6 +419,7 @@ var _default = {
419
419
  "Use the built-in static file server": "組み込みの静的ファイル サービスを使用する",
420
420
  "Local storage": "ローカルストレージ",
421
421
  "Aliyun OSS": "Aliyun OSS",
422
+ "Tencent COS": "Tencent COS",
422
423
  "Amazon S3": "Amazon S3",
423
424
  "Workflow": "ワークフロー",
424
425
  "Execution History": "実行履歴",
@@ -413,6 +413,7 @@ declare const _default: {
413
413
  "Use the built-in static file server": string;
414
414
  "Local storage": string;
415
415
  "Aliyun OSS": string;
416
+ "Tencent COS": string;
416
417
  "Amazon S3": string;
417
418
  Workflow: string;
418
419
  "Execution History": string;
@@ -419,6 +419,7 @@ var _default = {
419
419
  "Use the built-in static file server": "Использовать встроенный статический файл-сервер",
420
420
  "Local storage": "Локальное хранилище",
421
421
  "Aliyun OSS": "Aliyun OSS",
422
+ "Tencent COS": "Tencent COS",
422
423
  "Amazon S3": "Amazon S3",
423
424
  "Workflow": "Workflow",
424
425
  "Execution History": "История запусков",
@@ -474,6 +474,7 @@ declare const _default: {
474
474
  'Local storage': string;
475
475
  'Aliyun OSS': string;
476
476
  'Amazon S3': string;
477
+ 'Tencent COS': string;
477
478
  Region: string;
478
479
  Bucket: string;
479
480
  Path: string;
@@ -480,6 +480,7 @@ var _default = {
480
480
  'Local storage': '本地存储',
481
481
  'Aliyun OSS': '阿里云 OSS',
482
482
  'Amazon S3': '亚马逊 S3',
483
+ 'Tencent COS': '腾讯云 COS',
483
484
  'Region': '区域',
484
485
  'Bucket': '存储桶',
485
486
  'Path': '路径(相对)',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nocobase/client",
3
- "version": "0.7.6-alpha.2",
3
+ "version": "0.7.7-alpha.1",
4
4
  "license": "Apache-2.0",
5
5
  "licenses": [
6
6
  {
@@ -19,8 +19,8 @@
19
19
  "@formily/antd": "2.0.20",
20
20
  "@formily/core": "2.0.20",
21
21
  "@formily/react": "2.0.20",
22
- "@nocobase/sdk": "0.7.6-alpha.2",
23
- "@nocobase/utils": "0.7.6-alpha.2",
22
+ "@nocobase/sdk": "0.7.7-alpha.1",
23
+ "@nocobase/utils": "0.7.7-alpha.1",
24
24
  "ahooks": "^3.0.5",
25
25
  "antd": "~4.19.5",
26
26
  "axios": "^0.26.1",
@@ -57,5 +57,5 @@
57
57
  "@types/marked": "^4.0.1",
58
58
  "axios-mock-adapter": "^1.20.0"
59
59
  },
60
- "gitHead": "2cfccff9d3ff14c521bf317fa7ee4efa18444c92"
60
+ "gitHead": "f82374e6f9daaf71ba63eaf156468ea7ddc042da"
61
61
  }