zentao-api 0.5.5 → 0.6.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.
- package/README.md +16 -0
- package/dist/browser/zentao-api.global.js +2 -2
- package/dist/index.d.ts +1 -1
- package/dist/misc/errors.d.ts +5 -0
- package/dist/misc/errors.js +5 -0
- package/dist/modules/export.d.ts +3 -1
- package/dist/modules/export.js +1 -0
- package/dist/modules/generated.d.ts +9543 -3955
- package/dist/modules/generated.js +4850 -702
- package/dist/modules/object-props.js +330 -0
- package/dist/modules/registry.d.ts +8839 -3955
- package/dist/request/index.d.ts +10 -88
- package/dist/request/index.js +6 -1
- package/dist/request/prepare-body.d.ts +12 -0
- package/dist/request/prepare-body.js +221 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.js +1 -0
- package/dist/types/module.d.ts +6 -0
- package/dist/types/options.d.ts +2 -0
- package/dist/types/upload.d.ts +38 -0
- package/dist/types/upload.js +1 -0
- package/dist/version.js +2 -2
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -6,4 +6,4 @@ export { defineModuleActions, defineModules, type DefineModulesOptions, type Exp
|
|
|
6
6
|
export { request, type BuiltinRequestName, type RequestParamsFor, type RequestResultFor, } from './request/index.js';
|
|
7
7
|
export { pickFields, pickFieldsSingle, filterData, searchData, sortData, processData, } from './utils/index.js';
|
|
8
8
|
export { BUILD, VERSION } from './version.js';
|
|
9
|
-
export type { ApiListResponse, ApiResponse, ClientRequestBodyType, ClientRequestOptions, ClientResponseType, DataRecord, DataRecordFilter, DataRecordFilterGroup, GlobalOptions, HttpMethod, ListPagerInfo, LoginResponse, ModuleAction, ModuleActionMethod, ModuleActionName, ModuleActionPagerGetterMap, ModuleActionParam, ModuleActionParamOption, ModuleActionRequest, ModuleActionRequestBody, ModuleActionResponse, ModuleActionResultType, ModuleActionType, ModuleDefinition, ModuleName, Pager, ProcessListOptions, ProcessSingleOptions, RequestOptions, ResponseData, ServerConfig, SortExpr, SortFn, ZentaoProfile, ZentaoProfileConfig, ZentaoProfileRecord, ZentaoProfilesStore, ZentaoClientOptions, } from './types/index.js';
|
|
9
|
+
export type { ApiListResponse, ApiResponse, ClientRequestBodyType, ClientRequestOptions, ClientResponseType, DataRecord, DataRecordFilter, DataRecordFilterGroup, FileCreateParams, FileCreateResult, FileUploadDataInput, FileUploadPathInput, FileUploadSource, GlobalOptions, HttpMethod, ListPagerInfo, LoginResponse, ModuleAction, ModuleActionMethod, ModuleActionName, ModuleActionPagerGetterMap, ModuleActionParam, ModuleActionParamOption, ModuleActionRequest, ModuleActionRequestBody, ModuleActionRequestMediaType, ModuleActionResponse, ModuleActionResultType, ModuleActionType, ModuleDefinition, ModuleName, Pager, ProcessListOptions, ProcessSingleOptions, RequestOptions, ResponseData, ServerConfig, SortExpr, SortFn, ZentaoProfile, ZentaoProfileConfig, ZentaoProfileRecord, ZentaoProfilesStore, ZentaoClientOptions, } from './types/index.js';
|
package/dist/misc/errors.d.ts
CHANGED
|
@@ -27,6 +27,11 @@ export declare const ERRORS: {
|
|
|
27
27
|
readonly E_INVALID_PARAM: "Invalid value for parameter {param}: {value}";
|
|
28
28
|
readonly E_INVALID_REQUEST_NAME: "Request name must use the form \"moduleName\", \"moduleName/methodName\", or \"moduleName/<objectID>\".";
|
|
29
29
|
readonly E_API_FAILED: "ZenTao API returned failure: {message}";
|
|
30
|
+
readonly E_UPLOAD_PATH_UNSUPPORTED: "Local file paths are not supported in browser runtimes. Pass a File or Blob instead.";
|
|
31
|
+
readonly E_UPLOAD_FILE_NOT_FOUND: "Upload file not found: {path}";
|
|
32
|
+
readonly E_UPLOAD_FILE_READ_FAILED: "Failed to read upload file: {path}";
|
|
33
|
+
readonly E_UPLOAD_FILE_TOO_LARGE: "Upload file is {size} bytes and exceeds the {limit} byte limit.";
|
|
34
|
+
readonly E_INVALID_UPLOAD_SOURCE: "Invalid upload source for field: {field}";
|
|
30
35
|
};
|
|
31
36
|
/** SDK 已知错误码,对应 {@link ERRORS} 的 key。 */
|
|
32
37
|
export type ErrorCode = keyof typeof ERRORS;
|
package/dist/misc/errors.js
CHANGED
|
@@ -27,6 +27,11 @@ export const ERRORS = {
|
|
|
27
27
|
E_INVALID_PARAM: 'Invalid value for parameter {param}: {value}',
|
|
28
28
|
E_INVALID_REQUEST_NAME: 'Request name must use the form "moduleName", "moduleName/methodName", or "moduleName/<objectID>".',
|
|
29
29
|
E_API_FAILED: 'ZenTao API returned failure: {message}',
|
|
30
|
+
E_UPLOAD_PATH_UNSUPPORTED: 'Local file paths are not supported in browser runtimes. Pass a File or Blob instead.',
|
|
31
|
+
E_UPLOAD_FILE_NOT_FOUND: 'Upload file not found: {path}',
|
|
32
|
+
E_UPLOAD_FILE_READ_FAILED: 'Failed to read upload file: {path}',
|
|
33
|
+
E_UPLOAD_FILE_TOO_LARGE: 'Upload file is {size} bytes and exceeds the {limit} byte limit.',
|
|
34
|
+
E_INVALID_UPLOAD_SOURCE: 'Invalid upload source for field: {field}',
|
|
30
35
|
};
|
|
31
36
|
/**
|
|
32
37
|
* SDK 统一错误类型。
|
package/dist/modules/export.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import type { ModuleAction, ModuleActionParam, ModuleDefinition } from '../types/index.js';
|
|
1
|
+
import type { ModuleAction, ModuleActionParam, ModuleActionRequestMediaType, ModuleDefinition } from '../types/index.js';
|
|
2
2
|
/** 导出的模块动作定义。 */
|
|
3
3
|
export type ExportedModuleAction = Omit<ModuleAction, 'requestBody'> & {
|
|
4
4
|
bodyParams: ModuleActionParam[];
|
|
5
|
+
/** 请求体媒体类型;省略时为 `application/json`。 */
|
|
6
|
+
bodyMediaType?: ModuleActionRequestMediaType;
|
|
5
7
|
};
|
|
6
8
|
/** 导出的模块定义。 */
|
|
7
9
|
export type ExportedModuleDefinition = Omit<ModuleDefinition, 'actions'> & {
|
package/dist/modules/export.js
CHANGED
|
@@ -30,6 +30,7 @@ export function exportRegistry(options = {}) {
|
|
|
30
30
|
const { requestBody, ...exportedAction } = action;
|
|
31
31
|
return {
|
|
32
32
|
...exportedAction,
|
|
33
|
+
...(requestBody?.mediaType ? { bodyMediaType: requestBody.mediaType } : {}),
|
|
33
34
|
bodyParams: requestBody
|
|
34
35
|
? getModuleActionParams(module.name, action.name, { roles: ['body'] })
|
|
35
36
|
: [],
|