@fecommunity/reactpress-toolkit 1.0.0-beta.3 → 1.0.0-beta.4

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/README.md CHANGED
@@ -42,7 +42,7 @@ pnpm add @fecommunity/reactpress-toolkit
42
42
  ### Using the Default API Instance
43
43
 
44
44
  ```typescript
45
- import api from '@fecommunity/reactpress-toolkit';
45
+ import { api } from '@fecommunity/reactpress-toolkit';
46
46
 
47
47
  // Get all articles
48
48
  const articles = await api.article.findAll();
@@ -74,32 +74,14 @@ const article: types.IArticle = {
74
74
  const formattedDate = utils.formatDate(new Date());
75
75
  ```
76
76
 
77
- ## API Modules
78
-
79
- The toolkit provides clients for all ReactPress backend modules:
80
-
81
- - `api.article` - Article management
82
- - `api.auth` - Authentication services
83
- - `api.category` - Category management
84
- - `api.comment` - Comment system
85
- - `api.file` - File management
86
- - `api.knowledge` - Knowledge base
87
- - `api.page` - Page management
88
- - `api.search` - Search functionality
89
- - `api.setting` - System settings
90
- - `api.smtp` - SMTP services
91
- - `api.tag` - Tag management
92
- - `api.user` - User management
93
- - `api.view` - View analytics
94
-
95
77
  ## Configuration
96
78
 
97
79
  You can create a custom API instance with specific configuration:
98
80
 
99
81
  ```typescript
100
- import { api } from '@fecommunity/reactpress-toolkit';
82
+ import { http } from '@fecommunity/reactpress-toolkit';
101
83
 
102
- const customApi = api.createApiInstance({
84
+ const customApi = http.createApiInstance({
103
85
  baseURL: 'https://api.yourdomain.com',
104
86
  timeout: 10000,
105
87
  // ... other axios configuration options
@@ -113,10 +95,10 @@ const articles = await customApi.article.findAll();
113
95
 
114
96
  ### Automatic Retry Mechanisms
115
97
  ```typescript
116
- import { api } from '@fecommunity/reactpress-toolkit';
98
+ import { http } from '@fecommunity/reactpress-toolkit';
117
99
 
118
100
  // Configure retry settings
119
- const customApi = api.createApiInstance({
101
+ const customApi = http.createApiInstance({
120
102
  baseURL: 'https://api.yourdomain.com',
121
103
  retry: {
122
104
  retries: 3,
@@ -130,9 +112,9 @@ const customApi = api.createApiInstance({
130
112
 
131
113
  ### Request/Response Interceptors
132
114
  ```typescript
133
- import { api } from '@fecommunity/reactpress-toolkit';
115
+ import { http } from '@fecommunity/reactpress-toolkit';
134
116
 
135
- const monitoredApi = api.createApiInstance({
117
+ const monitoredApi = http.createApiInstance({
136
118
  baseURL: 'https://api.yourdomain.com',
137
119
  interceptors: {
138
120
  request: (config) => {
@@ -151,10 +133,10 @@ const monitoredApi = api.createApiInstance({
151
133
 
152
134
  ### Authentication Handling
153
135
  ```typescript
154
- import { api, utils } from '@fecommunity/reactpress-toolkit';
136
+ import { http, api, utils } from '@fecommunity/reactpress-toolkit';
155
137
 
156
138
  // Automatic token refresh
157
- const secureApi = api.createApiInstance({
139
+ const secureApi = http.createApiInstance({
158
140
  baseURL: 'https://api.yourdomain.com',
159
141
  auth: {
160
142
  tokenRefresh: async (refreshToken) => {
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
@@ -48,7 +44,7 @@ function parseEnv() {
48
44
  path.resolve(__dirname, '../../../'),
49
45
  path.resolve(__dirname, '../'),
50
46
  process.cwd(),
51
- path.resolve(process.cwd(), '../'), // From client directory to project root
47
+ path.resolve(process.cwd(), '../'),
52
48
  ];
53
49
  let foundEnvFiles = [];
54
50
  // Search for .env files in all possible locations
@@ -232,7 +232,7 @@ const urlConfig = [
232
232
  type: '数据转换工具',
233
233
  description: '用于将Excel文件转换为JSON格式的在线工具,便于在Web应用程序中使用。',
234
234
  icon: 'https://www.convertio.co/favicon.ico',
235
- url: 'https://www.convertio.co/zh/excel-json/', // 真实的Excel转JSON工具网址(convertio可能是一个综合转换工具,但支持Excel到JSON的转换)
235
+ url: 'https://www.convertio.co/zh/excel-json/',
236
236
  },
237
237
  {
238
238
  key: 'chuangkit',
@@ -1,5 +1,4 @@
1
- interface I18nMessages {
1
+ export interface I18nMessages {
2
2
  [key: string]: Record<string, string>;
3
3
  }
4
4
  export declare const messages: I18nMessages, locales: string[], defaultLocale: string;
5
- export {};
@@ -1,11 +1,7 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
4
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
9
5
  }) : (function(o, m, k, k2) {
10
6
  if (k2 === undefined) k2 = k;
11
7
  o[k2] = m[k];
@@ -1,14 +1,15 @@
1
1
  /**
2
2
  * 环境变量配置
3
3
  */
4
- export * from './env';
5
- /**
6
- * 国际化配置
7
- * 包括多语言消息和区域设置
8
- */
9
- export * from './i18n';
10
- /**
11
- * 全局配置
12
- * 包括导航设置和URL配置
13
- */
14
- export * from './global';
4
+ import { file } from './env';
5
+ import { messages, locales, defaultLocale } from './i18n';
6
+ import { globalSetting } from './global';
7
+ declare const config: {
8
+ locales: string[];
9
+ defaultLocale: string;
10
+ messages: import("./i18n").I18nMessages;
11
+ globalSetting: import("./global").GlobalSetting;
12
+ file: string;
13
+ };
14
+ export { config, file, messages, locales, defaultLocale, globalSetting };
15
+ export default config;
@@ -1,30 +1,25 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.globalSetting = exports.defaultLocale = exports.locales = exports.messages = exports.file = exports.config = void 0;
17
4
  /**
18
5
  * 环境变量配置
19
6
  */
20
- __exportStar(require("./env"), exports);
21
- /**
22
- * 国际化配置
23
- * 包括多语言消息和区域设置
24
- */
25
- __exportStar(require("./i18n"), exports);
26
- /**
27
- * 全局配置
28
- * 包括导航设置和URL配置
29
- */
30
- __exportStar(require("./global"), exports);
7
+ const env_1 = require("./env");
8
+ Object.defineProperty(exports, "file", { enumerable: true, get: function () { return env_1.file; } });
9
+ const i18n_1 = require("./i18n");
10
+ Object.defineProperty(exports, "messages", { enumerable: true, get: function () { return i18n_1.messages; } });
11
+ Object.defineProperty(exports, "locales", { enumerable: true, get: function () { return i18n_1.locales; } });
12
+ Object.defineProperty(exports, "defaultLocale", { enumerable: true, get: function () { return i18n_1.defaultLocale; } });
13
+ const global_1 = require("./global");
14
+ Object.defineProperty(exports, "globalSetting", { enumerable: true, get: function () { return global_1.globalSetting; } });
15
+ // Create a unified config object that includes all configuration properties
16
+ const config = {
17
+ ...env_1.config,
18
+ locales: i18n_1.locales,
19
+ defaultLocale: i18n_1.defaultLocale,
20
+ messages: i18n_1.messages,
21
+ globalSetting: global_1.globalSetting,
22
+ file: env_1.file
23
+ };
24
+ exports.config = config;
25
+ exports.default = config;
package/dist/index.d.ts CHANGED
@@ -1,8 +1,11 @@
1
- export { api, http, createApiInstance } from './api/instance';
2
- export { HttpClient } from './api/HttpClient';
3
- export * as utils from './utils';
4
- export * as types from './types';
5
- export { api as default } from './api/instance';
6
- export * from './config/env';
7
- export * from './config/i18n';
8
- export * from './config/global';
1
+ import { api, createApiInstance } from './api/instance';
2
+ import * as types from './types';
3
+ import * as utils from './utils';
4
+ import * as config from './config';
5
+ declare const http: {
6
+ createApiInstance: typeof createApiInstance;
7
+ instance: import("axios").AxiosInstance;
8
+ setSecurityData: (data: unknown) => void;
9
+ request: <T = any, _E = any>({ secure, path, type, query, format, body, ...params }: import("./api/HttpClient").FullRequestParams) => Promise<T>;
10
+ };
11
+ export { api, types, utils, config, http };
package/dist/index.js CHANGED
@@ -1,12 +1,10 @@
1
1
  "use strict";
2
- // Main index file for ReactPress Toolkit
2
+ // Automatically generated API toolkit for ReactPress
3
+ // Do not manually modify this file
4
+ // Generated at: 9/25/2025, 9:47:27 PM
3
5
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
6
  if (k2 === undefined) k2 = k;
5
- var desc = Object.getOwnPropertyDescriptor(m, k);
6
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
- desc = { enumerable: true, get: function() { return m[k]; } };
8
- }
9
- Object.defineProperty(o, k2, desc);
7
+ Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
10
8
  }) : (function(o, m, k, k2) {
11
9
  if (k2 === undefined) k2 = k;
12
10
  o[k2] = m[k];
@@ -23,26 +21,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
21
  __setModuleDefault(result, mod);
24
22
  return result;
25
23
  };
26
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
27
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
28
- };
29
24
  Object.defineProperty(exports, "__esModule", { value: true });
30
- exports.default = exports.types = exports.utils = exports.HttpClient = exports.createApiInstance = exports.http = exports.api = void 0;
31
- // Export API instance and HTTP client
32
- var instance_1 = require("./api/instance");
25
+ exports.http = exports.config = exports.utils = exports.types = exports.api = void 0;
26
+ const instance_1 = require("./api/instance");
33
27
  Object.defineProperty(exports, "api", { enumerable: true, get: function () { return instance_1.api; } });
34
- Object.defineProperty(exports, "http", { enumerable: true, get: function () { return instance_1.http; } });
35
- Object.defineProperty(exports, "createApiInstance", { enumerable: true, get: function () { return instance_1.createApiInstance; } });
36
- var HttpClient_1 = require("./api/HttpClient");
37
- Object.defineProperty(exports, "HttpClient", { enumerable: true, get: function () { return HttpClient_1.HttpClient; } });
38
- // Export utility functions
39
- exports.utils = __importStar(require("./utils"));
40
- // Re-export types for convenience
41
- exports.types = __importStar(require("./types"));
42
- // Export default API instance
43
- var instance_2 = require("./api/instance");
44
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return instance_2.api; } });
45
- // Export config functionality
46
- __exportStar(require("./config/env"), exports);
47
- __exportStar(require("./config/i18n"), exports);
48
- __exportStar(require("./config/global"), exports);
28
+ const types = __importStar(require("./types"));
29
+ exports.types = types;
30
+ const utils = __importStar(require("./utils"));
31
+ exports.utils = utils;
32
+ const config = __importStar(require("./config"));
33
+ exports.config = config;
34
+ const http = {
35
+ ...instance_1.http,
36
+ createApiInstance: instance_1.createApiInstance,
37
+ };
38
+ exports.http = http;
package/package.json CHANGED
@@ -1,8 +1,16 @@
1
1
  {
2
2
  "name": "@fecommunity/reactpress-toolkit",
3
- "version": "1.0.0-beta.3",
3
+ "version": "1.0.0-beta.4",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
+ "exports": {
7
+ ".": "./dist/index.js",
8
+ "./api": "./dist/api/index.js",
9
+ "./api/instance": "./dist/api/instance.js",
10
+ "./types": "./dist/types/index.js",
11
+ "./utils": "./dist/utils/index.js",
12
+ "./config": "./dist/config/index.js"
13
+ },
6
14
  "files": [
7
15
  "dist"
8
16
  ],
@@ -19,10 +27,10 @@
19
27
  },
20
28
  "devDependencies": {
21
29
  "@types/fs-extra": "^9.0.13",
22
- "@types/node": "^24.5.2"
30
+ "@types/node": "^17.0.22"
23
31
  },
24
32
  "scripts": {
25
33
  "generate": "node scripts/generate-swagger.js",
26
- "build": "tsc && cp -r src/locales dist/"
34
+ "build": "ls -la src/api/ && tsc && cp -r src/locales dist/"
27
35
  }
28
36
  }