mcl-axios-kit 0.0.1 → 0.0.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.
- package/dist/index.d.ts +36 -0
- package/dist/index.js +23 -0
- package/package.json +3 -2
- package/dist/McSerializable.d.ts +0 -0
- package/dist/McSerializable.js +0 -1
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import McAxiosOrigin from './McAxios';
|
|
2
|
+
import McAxiosManager from './McAxiosManager';
|
|
3
|
+
import McAxiosAnnotations from './McAxiosAnnotations';
|
|
4
|
+
import McDataAnnotations from './McDataAnnotations';
|
|
5
|
+
import McRequest from './McRequest';
|
|
6
|
+
import McResponse from './McResponse';
|
|
7
|
+
/**
|
|
8
|
+
* 2. McAxios 클래스에 다른 클래스들을 정적(static) 속성으로 결합합니다.
|
|
9
|
+
* 이렇게 하면 McAxios.Manager와 같은 방식으로 접근이 가능해집니다.
|
|
10
|
+
*/
|
|
11
|
+
declare const McAxios: typeof McAxiosOrigin & {
|
|
12
|
+
Manager: typeof McAxiosManager;
|
|
13
|
+
AxiosAnnotations: {
|
|
14
|
+
GET: (url: string, type: new (res: any) => any) => (target: any, propertyKey: string) => void;
|
|
15
|
+
POST: (url: string, type: new (res: any) => any) => (target: any, propertyKey: string) => void;
|
|
16
|
+
PUT: (url: string, type: new (res: any) => any) => (target: any, propertyKey: string) => void;
|
|
17
|
+
DELETE: (url: string, type: new (res: any) => any) => (target: any, propertyKey: string) => void;
|
|
18
|
+
PATCH: (url: string, type: new (res: any) => any) => (target: any, propertyKey: string) => void;
|
|
19
|
+
Request: (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
20
|
+
Path: (name: string) => (target: Object, propertyKey: string | symbol, parameterIndex: number) => void;
|
|
21
|
+
Success: (fn: Function) => (target: any, propertyKey: string) => void;
|
|
22
|
+
Error: (fn: Function) => (target: any, propertyKey: string) => void;
|
|
23
|
+
};
|
|
24
|
+
DataAnnotations: {
|
|
25
|
+
Entity: <T extends {
|
|
26
|
+
new (...args: any[]): {};
|
|
27
|
+
}>(constructor: T) => T;
|
|
28
|
+
Serialize: (jsonKey: string) => (target: any, propertyKey: string) => void;
|
|
29
|
+
Field: (type: any, path?: string, defaultValue?: any) => (target: any, propertyKey: string) => void;
|
|
30
|
+
ArrayField: (type: any, path?: string, defaultValue?: any) => (target: any, propertyKey: string) => void;
|
|
31
|
+
};
|
|
32
|
+
Request: typeof McRequest;
|
|
33
|
+
Response: typeof McResponse;
|
|
34
|
+
};
|
|
35
|
+
export default McAxios;
|
|
36
|
+
export { McAxios, McAxiosManager, McAxiosAnnotations, McDataAnnotations, McRequest, McResponse };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// 1. 모든 클래스를 가져옵니다.
|
|
2
|
+
// (각 파일들이 export default로 되어 있다고 가정합니다.)
|
|
3
|
+
import McAxiosOrigin from './McAxios';
|
|
4
|
+
import McAxiosManager from './McAxiosManager';
|
|
5
|
+
import McAxiosAnnotations from './McAxiosAnnotations';
|
|
6
|
+
import McDataAnnotations from './McDataAnnotations';
|
|
7
|
+
import McRequest from './McRequest';
|
|
8
|
+
import McResponse from './McResponse';
|
|
9
|
+
/**
|
|
10
|
+
* 2. McAxios 클래스에 다른 클래스들을 정적(static) 속성으로 결합합니다.
|
|
11
|
+
* 이렇게 하면 McAxios.Manager와 같은 방식으로 접근이 가능해집니다.
|
|
12
|
+
*/
|
|
13
|
+
const McAxios = Object.assign(McAxiosOrigin, {
|
|
14
|
+
Manager: McAxiosManager,
|
|
15
|
+
AxiosAnnotations: McAxiosAnnotations,
|
|
16
|
+
DataAnnotations: McDataAnnotations,
|
|
17
|
+
Request: McRequest,
|
|
18
|
+
Response: McResponse,
|
|
19
|
+
});
|
|
20
|
+
// 3. 통합된 McAxios를 default로 내보냅니다.
|
|
21
|
+
export default McAxios;
|
|
22
|
+
// 4. 필요한 경우 { McAxiosManager } 처럼 별도로 쓰고 싶을 때를 대비한 Named Export
|
|
23
|
+
export { McAxios, McAxiosManager, McAxiosAnnotations, McDataAnnotations, McRequest, McResponse };
|
package/package.json
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "mcl-axios-kit",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"description": "McL에서 Axios를 활용해 API를 보다 효율적이고 깔끔하게 활용할 수 있도록 구현된 Kit",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
8
8
|
"exports": {
|
|
9
9
|
".": {
|
|
10
|
+
"types": "./dist/index.d.ts",
|
|
10
11
|
"import": "./dist/index.js",
|
|
11
|
-
"
|
|
12
|
+
"require": "./dist/index.js"
|
|
12
13
|
}
|
|
13
14
|
},
|
|
14
15
|
"files": [
|
package/dist/McSerializable.d.ts
DELETED
|
File without changes
|
package/dist/McSerializable.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";
|