linkup-lib 0.1.0 → 0.1.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/CustomButton.d.ts +6 -0
- package/dist/CustomButton.js +21 -0
- package/dist/LinkupButton.d.ts +7 -0
- package/dist/LinkupButton.js +8 -0
- package/dist/Registry.d.ts +9 -0
- package/dist/Registry.js +16 -0
- package/dist/color.d.ts +7 -0
- package/dist/color.js +15 -0
- package/dist/compoenets/registry/AntdRegistry.d.ts +9 -0
- package/dist/compoenets/registry/AntdRegistry.js +13 -0
- package/dist/compoenets/registry/ErrorHandler.d.ts +2 -0
- package/dist/compoenets/registry/ErrorHandler.js +10 -0
- package/dist/compoenets/registry/NextAuthRegistry.d.ts +7 -0
- package/dist/compoenets/registry/NextAuthRegistry.js +13 -0
- package/dist/compoenets/registry/ReactQueryRegistry.d.ts +6 -0
- package/dist/compoenets/registry/ReactQueryRegistry.js +56 -0
- package/dist/compoenets/ui/header.d.ts +2 -0
- package/dist/compoenets/ui/header.js +29 -0
- package/dist/components/registry/AntdRegistry.d.ts +9 -0
- package/dist/components/registry/AntdRegistry.js +13 -0
- package/dist/components/registry/ErrorHandler.d.ts +2 -0
- package/dist/components/registry/ErrorHandler.js +10 -0
- package/dist/components/registry/ErrorRegistry.d.ts +5 -0
- package/dist/components/registry/ErrorRegistry.js +13 -0
- package/dist/components/registry/NextAuthRegistry.d.ts +7 -0
- package/dist/components/registry/NextAuthRegistry.js +13 -0
- package/dist/components/registry/ReactQueryRegistry.d.ts +6 -0
- package/dist/components/registry/ReactQueryRegistry.js +56 -0
- package/dist/components/ui/Aside.d.ts +14 -0
- package/dist/components/ui/Aside.js +133 -0
- package/dist/components/ui/Header.d.ts +5 -0
- package/dist/components/ui/Header.js +45 -0
- package/dist/components/ui/Header2.d.ts +5 -0
- package/dist/components/ui/Header2.js +20 -0
- package/dist/components/ui/Page.d.ts +5 -0
- package/dist/components/ui/Page.js +15 -0
- package/dist/components/ui/PageTitle.d.ts +7 -0
- package/dist/components/ui/PageTitle.js +21 -0
- package/dist/db.d.ts +4 -0
- package/dist/db.js +59 -0
- package/dist/image.d.ts +129 -0
- package/dist/image.js +158 -0
- package/dist/index.d.ts +133 -2
- package/dist/index.js +29 -9
- package/dist/util.d.ts +95 -0
- package/dist/util.js +254 -0
- package/package.json +34 -2
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Component = ({ logo }) => {
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("header", { style: {
|
|
7
|
+
width: '100%',
|
|
8
|
+
height: '56px',
|
|
9
|
+
background: 'white',
|
|
10
|
+
borderBottom: `1px solid #E4E4E7`,
|
|
11
|
+
display: 'flex',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
justifyContent: 'center',
|
|
14
|
+
}, children: (0, jsx_runtime_1.jsx)("div", { style: {
|
|
15
|
+
display: 'flex',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
justifyContent: 'center',
|
|
18
|
+
}, children: logo }) }));
|
|
19
|
+
};
|
|
20
|
+
exports.default = Component;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const Aside_1 = require("./Aside");
|
|
6
|
+
const jotai_1 = require("jotai");
|
|
7
|
+
const Component = ({ children }) => {
|
|
8
|
+
// 사이드바 열림 상태
|
|
9
|
+
const [asideOpen, setAsideOpen] = (0, jotai_1.useAtom)(Aside_1.asideAtom);
|
|
10
|
+
return ((0, jsx_runtime_1.jsx)("div", { style: {
|
|
11
|
+
padding: `56px 0px 0px ${asideOpen ? 210 : 0}px`, minHeight: "100dvh",
|
|
12
|
+
transition: 'all 0.3s',
|
|
13
|
+
}, children: children }));
|
|
14
|
+
};
|
|
15
|
+
exports.default = Component;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const cg_1 = require("react-icons/cg");
|
|
6
|
+
const Aside_1 = require("./Aside");
|
|
7
|
+
const jotai_1 = require("jotai");
|
|
8
|
+
const Component = ({ title, section1, section2 }) => {
|
|
9
|
+
// 사이드바 열림 상태
|
|
10
|
+
const [asideOpen, setAsideOpen] = (0, jotai_1.useAtom)(Aside_1.asideAtom);
|
|
11
|
+
return ((0, jsx_runtime_1.jsxs)("section", { style: {
|
|
12
|
+
display: 'flex', alignItems: 'center',
|
|
13
|
+
width: '100%', height: 60, background: '#fff',
|
|
14
|
+
transition: 'all 0.3s',
|
|
15
|
+
}, children: [(0, jsx_runtime_1.jsx)("div", { style: {
|
|
16
|
+
width: 26, height: 60, background: '#EEF0F5',
|
|
17
|
+
borderRight: '1px solid #DCDDE2', borderBottom: '1px solid #DCDDE2',
|
|
18
|
+
display: 'flex', justifyContent: 'center', alignItems: 'center', cursor: 'pointer'
|
|
19
|
+
}, onClick: () => setAsideOpen(!asideOpen), children: (0, jsx_runtime_1.jsx)(cg_1.CgChevronLeft, { style: { color: '#616673', fontSize: 16, transform: asideOpen ? 'rotate(0deg)' : 'rotate(180deg)', transition: 'transform 0.3s ease' } }) }), (0, jsx_runtime_1.jsxs)("div", { style: { flex: 1, display: 'flex', alignItems: 'center', height: '100%', borderBottom: '1px solid #E4E7EE', }, children: [(0, jsx_runtime_1.jsx)("div", { style: { padding: '0px 30px' }, children: (0, jsx_runtime_1.jsx)("p", { style: { fontSize: 20, fontWeight: '600' }, children: title }) }), (0, jsx_runtime_1.jsx)("section", { style: { flex: 1 }, children: section1 }), (0, jsx_runtime_1.jsx)("section", { style: { flex: 1 }, children: section2 })] })] }));
|
|
20
|
+
};
|
|
21
|
+
exports.default = Component;
|
package/dist/db.d.ts
ADDED
package/dist/db.js
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.pool = void 0;
|
|
16
|
+
const promise_1 = __importDefault(require("mysql2/promise"));
|
|
17
|
+
/**
|
|
18
|
+
* check, globalObject, registerService
|
|
19
|
+
* Next.js는 개발 모드에서 API 경로를 지속적으로 재구축하는데, initFn()의 경로를 전역으로 지정하여 변경되지 않도록 합니다.
|
|
20
|
+
*/
|
|
21
|
+
function check(it) {
|
|
22
|
+
return it && it.Math === Math && it;
|
|
23
|
+
}
|
|
24
|
+
const globalObject = check(typeof window === 'object' && window) ||
|
|
25
|
+
check(typeof self === 'object' && self) ||
|
|
26
|
+
check(typeof global === 'object' && global) ||
|
|
27
|
+
(() => {
|
|
28
|
+
return this;
|
|
29
|
+
})() ||
|
|
30
|
+
Function('return this')();
|
|
31
|
+
const registerService = (name, initFn) => {
|
|
32
|
+
if (process.env.NODE_ENV === 'development') {
|
|
33
|
+
if (!(name in globalObject)) {
|
|
34
|
+
globalObject[name] = initFn();
|
|
35
|
+
}
|
|
36
|
+
return globalObject[name];
|
|
37
|
+
}
|
|
38
|
+
return initFn();
|
|
39
|
+
};
|
|
40
|
+
exports.pool = registerService('mysql', () => promise_1.default.createPool({
|
|
41
|
+
host: "database-secretorder.cfk0kqmkqkbd.ap-northeast-2.rds.amazonaws.com",
|
|
42
|
+
port: 3306,
|
|
43
|
+
user: 'admin',
|
|
44
|
+
password: "linkup1!",
|
|
45
|
+
database: 'secretorder',
|
|
46
|
+
connectionLimit: 1000,
|
|
47
|
+
waitForConnections: true,
|
|
48
|
+
keepAliveInitialDelay: 10000, // 0 by default.
|
|
49
|
+
enableKeepAlive: true, // false by default.
|
|
50
|
+
}));
|
|
51
|
+
// 🛑 서버 종료 시 MySQL 커넥션 풀 닫기
|
|
52
|
+
process.on('SIGINT', () => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
+
if (exports.pool) {
|
|
54
|
+
console.debug('Closing MySQL connection pool...');
|
|
55
|
+
yield exports.pool.end();
|
|
56
|
+
}
|
|
57
|
+
process.exit();
|
|
58
|
+
}));
|
|
59
|
+
exports.default = exports.pool;
|
package/dist/image.d.ts
ADDED
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
export declare const convertWebpAndUploadFile: ({ file, path, fileName, size }: {
|
|
2
|
+
file: File;
|
|
3
|
+
path: string;
|
|
4
|
+
fileName?: string;
|
|
5
|
+
size?: number;
|
|
6
|
+
}) => Promise<{
|
|
7
|
+
result: boolean;
|
|
8
|
+
location: string;
|
|
9
|
+
key: string;
|
|
10
|
+
Expiration?: string | undefined;
|
|
11
|
+
ETag?: string | undefined;
|
|
12
|
+
ChecksumCRC32?: string | undefined;
|
|
13
|
+
ChecksumCRC32C?: string | undefined;
|
|
14
|
+
ChecksumCRC64NVME?: string | undefined;
|
|
15
|
+
ChecksumSHA1?: string | undefined;
|
|
16
|
+
ChecksumSHA256?: string | undefined;
|
|
17
|
+
ChecksumType?: import("@aws-sdk/client-s3").ChecksumType | undefined;
|
|
18
|
+
ServerSideEncryption?: import("@aws-sdk/client-s3").ServerSideEncryption | undefined;
|
|
19
|
+
VersionId?: string | undefined;
|
|
20
|
+
SSECustomerAlgorithm?: string | undefined;
|
|
21
|
+
SSECustomerKeyMD5?: string | undefined;
|
|
22
|
+
SSEKMSKeyId?: string | undefined;
|
|
23
|
+
SSEKMSEncryptionContext?: string | undefined;
|
|
24
|
+
BucketKeyEnabled?: boolean | undefined;
|
|
25
|
+
Size?: number | undefined;
|
|
26
|
+
RequestCharged?: import("@aws-sdk/client-s3").RequestCharged | undefined;
|
|
27
|
+
$metadata: import("@smithy/types").ResponseMetadata;
|
|
28
|
+
}>;
|
|
29
|
+
export declare const convertWebpAndUploadBuffer: ({ buffer, path, fileName, size }: {
|
|
30
|
+
buffer: Buffer;
|
|
31
|
+
path: string;
|
|
32
|
+
fileName?: string;
|
|
33
|
+
size?: number;
|
|
34
|
+
}) => Promise<{
|
|
35
|
+
result: boolean;
|
|
36
|
+
location: string;
|
|
37
|
+
key: string;
|
|
38
|
+
Expiration?: string | undefined;
|
|
39
|
+
ETag?: string | undefined;
|
|
40
|
+
ChecksumCRC32?: string | undefined;
|
|
41
|
+
ChecksumCRC32C?: string | undefined;
|
|
42
|
+
ChecksumCRC64NVME?: string | undefined;
|
|
43
|
+
ChecksumSHA1?: string | undefined;
|
|
44
|
+
ChecksumSHA256?: string | undefined;
|
|
45
|
+
ChecksumType?: import("@aws-sdk/client-s3").ChecksumType | undefined;
|
|
46
|
+
ServerSideEncryption?: import("@aws-sdk/client-s3").ServerSideEncryption | undefined;
|
|
47
|
+
VersionId?: string | undefined;
|
|
48
|
+
SSECustomerAlgorithm?: string | undefined;
|
|
49
|
+
SSECustomerKeyMD5?: string | undefined;
|
|
50
|
+
SSEKMSKeyId?: string | undefined;
|
|
51
|
+
SSEKMSEncryptionContext?: string | undefined;
|
|
52
|
+
BucketKeyEnabled?: boolean | undefined;
|
|
53
|
+
Size?: number | undefined;
|
|
54
|
+
RequestCharged?: import("@aws-sdk/client-s3").RequestCharged | undefined;
|
|
55
|
+
$metadata: import("@smithy/types").ResponseMetadata;
|
|
56
|
+
}>;
|
|
57
|
+
export declare const deleteS3Object: (key: string) => Promise<{
|
|
58
|
+
result: boolean;
|
|
59
|
+
DeleteMarker?: boolean | undefined;
|
|
60
|
+
VersionId?: string | undefined;
|
|
61
|
+
RequestCharged?: import("@aws-sdk/client-s3").RequestCharged | undefined;
|
|
62
|
+
$metadata: import("@smithy/types").ResponseMetadata;
|
|
63
|
+
}>;
|
|
64
|
+
declare const _default: {
|
|
65
|
+
convertWebpAndUploadFile: ({ file, path, fileName, size }: {
|
|
66
|
+
file: File;
|
|
67
|
+
path: string;
|
|
68
|
+
fileName?: string;
|
|
69
|
+
size?: number;
|
|
70
|
+
}) => Promise<{
|
|
71
|
+
result: boolean;
|
|
72
|
+
location: string;
|
|
73
|
+
key: string;
|
|
74
|
+
Expiration?: string | undefined;
|
|
75
|
+
ETag?: string | undefined;
|
|
76
|
+
ChecksumCRC32?: string | undefined;
|
|
77
|
+
ChecksumCRC32C?: string | undefined;
|
|
78
|
+
ChecksumCRC64NVME?: string | undefined;
|
|
79
|
+
ChecksumSHA1?: string | undefined;
|
|
80
|
+
ChecksumSHA256?: string | undefined;
|
|
81
|
+
ChecksumType?: import("@aws-sdk/client-s3").ChecksumType | undefined;
|
|
82
|
+
ServerSideEncryption?: import("@aws-sdk/client-s3").ServerSideEncryption | undefined;
|
|
83
|
+
VersionId?: string | undefined;
|
|
84
|
+
SSECustomerAlgorithm?: string | undefined;
|
|
85
|
+
SSECustomerKeyMD5?: string | undefined;
|
|
86
|
+
SSEKMSKeyId?: string | undefined;
|
|
87
|
+
SSEKMSEncryptionContext?: string | undefined;
|
|
88
|
+
BucketKeyEnabled?: boolean | undefined;
|
|
89
|
+
Size?: number | undefined;
|
|
90
|
+
RequestCharged?: import("@aws-sdk/client-s3").RequestCharged | undefined;
|
|
91
|
+
$metadata: import("@smithy/types").ResponseMetadata;
|
|
92
|
+
}>;
|
|
93
|
+
convertWebpAndUploadBuffer: ({ buffer, path, fileName, size }: {
|
|
94
|
+
buffer: Buffer;
|
|
95
|
+
path: string;
|
|
96
|
+
fileName?: string;
|
|
97
|
+
size?: number;
|
|
98
|
+
}) => Promise<{
|
|
99
|
+
result: boolean;
|
|
100
|
+
location: string;
|
|
101
|
+
key: string;
|
|
102
|
+
Expiration?: string | undefined;
|
|
103
|
+
ETag?: string | undefined;
|
|
104
|
+
ChecksumCRC32?: string | undefined;
|
|
105
|
+
ChecksumCRC32C?: string | undefined;
|
|
106
|
+
ChecksumCRC64NVME?: string | undefined;
|
|
107
|
+
ChecksumSHA1?: string | undefined;
|
|
108
|
+
ChecksumSHA256?: string | undefined;
|
|
109
|
+
ChecksumType?: import("@aws-sdk/client-s3").ChecksumType | undefined;
|
|
110
|
+
ServerSideEncryption?: import("@aws-sdk/client-s3").ServerSideEncryption | undefined;
|
|
111
|
+
VersionId?: string | undefined;
|
|
112
|
+
SSECustomerAlgorithm?: string | undefined;
|
|
113
|
+
SSECustomerKeyMD5?: string | undefined;
|
|
114
|
+
SSEKMSKeyId?: string | undefined;
|
|
115
|
+
SSEKMSEncryptionContext?: string | undefined;
|
|
116
|
+
BucketKeyEnabled?: boolean | undefined;
|
|
117
|
+
Size?: number | undefined;
|
|
118
|
+
RequestCharged?: import("@aws-sdk/client-s3").RequestCharged | undefined;
|
|
119
|
+
$metadata: import("@smithy/types").ResponseMetadata;
|
|
120
|
+
}>;
|
|
121
|
+
deleteS3Object: (key: string) => Promise<{
|
|
122
|
+
result: boolean;
|
|
123
|
+
DeleteMarker?: boolean | undefined;
|
|
124
|
+
VersionId?: string | undefined;
|
|
125
|
+
RequestCharged?: import("@aws-sdk/client-s3").RequestCharged | undefined;
|
|
126
|
+
$metadata: import("@smithy/types").ResponseMetadata;
|
|
127
|
+
}>;
|
|
128
|
+
};
|
|
129
|
+
export default _default;
|
package/dist/image.js
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
45
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
46
|
+
};
|
|
47
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
48
|
+
exports.deleteS3Object = exports.convertWebpAndUploadBuffer = exports.convertWebpAndUploadFile = void 0;
|
|
49
|
+
const dayjs_1 = __importDefault(require("dayjs"));
|
|
50
|
+
const client_s3_1 = require("@aws-sdk/client-s3");
|
|
51
|
+
const Bucket = process.env.AWS_S3_BUCKET || ""; // 'secret-order';
|
|
52
|
+
let s3 = null;
|
|
53
|
+
const getS3Client = () => {
|
|
54
|
+
if (!s3) {
|
|
55
|
+
s3 = new client_s3_1.S3Client({
|
|
56
|
+
region: process.env.AWS_REGION || "",
|
|
57
|
+
credentials: {
|
|
58
|
+
accessKeyId: process.env.AWS_ACCESS_KEY_ID || "",
|
|
59
|
+
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY || "",
|
|
60
|
+
},
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
return s3;
|
|
64
|
+
};
|
|
65
|
+
// 이미지를 webp로 변환 후 업로드
|
|
66
|
+
const convertWebpAndUploadFile = (_a) => __awaiter(void 0, [_a], void 0, function* ({ file, path, fileName, size }) {
|
|
67
|
+
try {
|
|
68
|
+
const buffer = yield file.arrayBuffer();
|
|
69
|
+
// 이미지를 webp로 변환
|
|
70
|
+
const sharp = (yield Promise.resolve().then(() => __importStar(require("sharp")))).default;
|
|
71
|
+
const convert = yield sharp(buffer).webp({
|
|
72
|
+
quality: 90,
|
|
73
|
+
// lossless: true,
|
|
74
|
+
// nearLossless: true,
|
|
75
|
+
effort: 5,
|
|
76
|
+
}).toBuffer();
|
|
77
|
+
// 변환 실패!
|
|
78
|
+
if (!convert) {
|
|
79
|
+
throw new Error('이미지 변환에 실패했습니다.');
|
|
80
|
+
}
|
|
81
|
+
const resized = size ? yield sharp(convert)
|
|
82
|
+
.resize({ width: size, withoutEnlargement: true })
|
|
83
|
+
.toBuffer() : convert;
|
|
84
|
+
if (!fileName)
|
|
85
|
+
fileName = (0, dayjs_1.default)().format('YYYYMMDDHHmmssSSS');
|
|
86
|
+
// 스트림을 사용하여 S3에 업로드
|
|
87
|
+
const Key = `${path}/${fileName}.webp`;
|
|
88
|
+
// S3에 업로드하고 결과 출력
|
|
89
|
+
const res = yield getS3Client().send(new client_s3_1.PutObjectCommand({
|
|
90
|
+
Bucket,
|
|
91
|
+
Key,
|
|
92
|
+
Body: resized,
|
|
93
|
+
ACL: 'public-read'
|
|
94
|
+
}));
|
|
95
|
+
return Object.assign(Object.assign({}, res), { result: true, location: `https://${Bucket}.s3.ap-northeast-2.amazonaws.com/${Key}`, key: Key });
|
|
96
|
+
}
|
|
97
|
+
catch (err) {
|
|
98
|
+
console.error('이미지 변환 및 업로드 실패:', err);
|
|
99
|
+
throw new Error('이미지 변환 및 업로드에 실패했습니다.');
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
exports.convertWebpAndUploadFile = convertWebpAndUploadFile;
|
|
103
|
+
// 이미지를 webp로 변환 후 업로드
|
|
104
|
+
const convertWebpAndUploadBuffer = (_a) => __awaiter(void 0, [_a], void 0, function* ({ buffer, path, fileName, size }) {
|
|
105
|
+
try {
|
|
106
|
+
// 이미지를 webp로 변환
|
|
107
|
+
const sharp = (yield Promise.resolve().then(() => __importStar(require("sharp")))).default;
|
|
108
|
+
const convert = yield sharp(buffer).webp({
|
|
109
|
+
quality: 90,
|
|
110
|
+
// lossless: true,
|
|
111
|
+
// nearLossless: true,
|
|
112
|
+
effort: 5,
|
|
113
|
+
}).toBuffer();
|
|
114
|
+
// 변환 실패!
|
|
115
|
+
if (!convert) {
|
|
116
|
+
throw new Error('이미지 변환에 실패했습니다.');
|
|
117
|
+
}
|
|
118
|
+
const resized = size ? yield sharp(convert)
|
|
119
|
+
.resize({ width: size, withoutEnlargement: true })
|
|
120
|
+
.toBuffer() : convert;
|
|
121
|
+
if (!fileName)
|
|
122
|
+
fileName = (0, dayjs_1.default)().format('YYYYMMDDHHmmssSSS');
|
|
123
|
+
// 스트림을 사용하여 S3에 업로드
|
|
124
|
+
const Key = `${path}/${fileName}.webp`;
|
|
125
|
+
// S3에 업로드하고 결과 출력
|
|
126
|
+
const res = yield getS3Client().send(new client_s3_1.PutObjectCommand({
|
|
127
|
+
Bucket,
|
|
128
|
+
Key,
|
|
129
|
+
Body: resized,
|
|
130
|
+
ACL: 'public-read'
|
|
131
|
+
}));
|
|
132
|
+
return Object.assign(Object.assign({}, res), { result: true, location: `https://${Bucket}.s3.ap-northeast-2.amazonaws.com/${Key}`, key: Key });
|
|
133
|
+
}
|
|
134
|
+
catch (err) {
|
|
135
|
+
console.error('이미지 변환 및 업로드 실패:', err);
|
|
136
|
+
throw new Error('이미지 변환 및 업로드에 실패했습니다.');
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
exports.convertWebpAndUploadBuffer = convertWebpAndUploadBuffer;
|
|
140
|
+
const deleteS3Object = (key) => __awaiter(void 0, void 0, void 0, function* () {
|
|
141
|
+
try {
|
|
142
|
+
const res = yield getS3Client().send(new client_s3_1.DeleteObjectCommand({
|
|
143
|
+
Bucket,
|
|
144
|
+
Key: key,
|
|
145
|
+
}));
|
|
146
|
+
return Object.assign(Object.assign({}, res), { result: true });
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
console.error('S3 객체 삭제 실패:', err);
|
|
150
|
+
throw new Error('S3 객체 삭제에 실패했습니다.');
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
exports.deleteS3Object = deleteS3Object;
|
|
154
|
+
exports.default = {
|
|
155
|
+
convertWebpAndUploadFile: exports.convertWebpAndUploadFile,
|
|
156
|
+
convertWebpAndUploadBuffer: exports.convertWebpAndUploadBuffer,
|
|
157
|
+
deleteS3Object: exports.deleteS3Object,
|
|
158
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,133 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import util from './util';
|
|
2
|
+
import image from './image';
|
|
3
|
+
import Registry from './Registry';
|
|
4
|
+
import ReactQueryRegistry from './components/registry/ReactQueryRegistry';
|
|
5
|
+
import AntdRegistry from "./components/registry/AntdRegistry";
|
|
6
|
+
import NextAuthRegistry from './components/registry/NextAuthRegistry';
|
|
7
|
+
import ErrorRegistry from './components/registry/ErrorRegistry';
|
|
8
|
+
import PageTitle from './components/ui/PageTitle';
|
|
9
|
+
import Header from './components/ui/Header';
|
|
10
|
+
import Header2 from './components/ui/Header2';
|
|
11
|
+
import Aside from './components/ui/Aside';
|
|
12
|
+
import Page from './components/ui/Page';
|
|
13
|
+
declare const _default: {
|
|
14
|
+
util: {
|
|
15
|
+
format: {
|
|
16
|
+
comma: (target: string | number) => string | 0 | undefined;
|
|
17
|
+
card: (cardNumber: string) => string;
|
|
18
|
+
tel: (tel: string) => string;
|
|
19
|
+
bizNum: (bizNum: string) => string;
|
|
20
|
+
};
|
|
21
|
+
is: {
|
|
22
|
+
isEng: (s: string) => boolean;
|
|
23
|
+
isKorean: (s: string) => boolean;
|
|
24
|
+
isNumber: (s: string) => boolean;
|
|
25
|
+
isSpecialChar: (s: string) => boolean;
|
|
26
|
+
};
|
|
27
|
+
feature: {
|
|
28
|
+
onChangeBrowserUrl: (searchParams: any) => void;
|
|
29
|
+
};
|
|
30
|
+
get: {
|
|
31
|
+
number: (value: string | number) => number;
|
|
32
|
+
josa: (word: string) => {
|
|
33
|
+
이가: string;
|
|
34
|
+
은는: string;
|
|
35
|
+
을를: string;
|
|
36
|
+
과와: string;
|
|
37
|
+
아야: string;
|
|
38
|
+
으로로: string;
|
|
39
|
+
};
|
|
40
|
+
byte: (str: string) => number;
|
|
41
|
+
age: (birth: string | number, isMonth?: boolean) => string;
|
|
42
|
+
time: (sec: number) => string;
|
|
43
|
+
diffProperties: (prev: any, next: any) => any;
|
|
44
|
+
};
|
|
45
|
+
validate: {
|
|
46
|
+
id: (value: string) => {
|
|
47
|
+
message: string;
|
|
48
|
+
result: boolean;
|
|
49
|
+
};
|
|
50
|
+
password: (value: string) => {
|
|
51
|
+
message: string;
|
|
52
|
+
result: boolean;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
image: {
|
|
57
|
+
convertWebpAndUploadFile: ({ file, path, fileName, size }: {
|
|
58
|
+
file: File;
|
|
59
|
+
path: string;
|
|
60
|
+
fileName?: string;
|
|
61
|
+
size?: number;
|
|
62
|
+
}) => Promise<{
|
|
63
|
+
result: boolean;
|
|
64
|
+
location: string;
|
|
65
|
+
key: string;
|
|
66
|
+
Expiration?: string | undefined;
|
|
67
|
+
ETag?: string | undefined;
|
|
68
|
+
ChecksumCRC32?: string | undefined;
|
|
69
|
+
ChecksumCRC32C?: string | undefined;
|
|
70
|
+
ChecksumCRC64NVME?: string | undefined;
|
|
71
|
+
ChecksumSHA1?: string | undefined;
|
|
72
|
+
ChecksumSHA256?: string | undefined;
|
|
73
|
+
ChecksumType?: import("@aws-sdk/client-s3").ChecksumType | undefined;
|
|
74
|
+
ServerSideEncryption?: import("@aws-sdk/client-s3").ServerSideEncryption | undefined;
|
|
75
|
+
VersionId?: string | undefined;
|
|
76
|
+
SSECustomerAlgorithm?: string | undefined;
|
|
77
|
+
SSECustomerKeyMD5?: string | undefined;
|
|
78
|
+
SSEKMSKeyId?: string | undefined;
|
|
79
|
+
SSEKMSEncryptionContext?: string | undefined;
|
|
80
|
+
BucketKeyEnabled?: boolean | undefined;
|
|
81
|
+
Size?: number | undefined;
|
|
82
|
+
RequestCharged?: import("@aws-sdk/client-s3").RequestCharged | undefined;
|
|
83
|
+
$metadata: import("@smithy/types").ResponseMetadata;
|
|
84
|
+
}>;
|
|
85
|
+
convertWebpAndUploadBuffer: ({ buffer, path, fileName, size }: {
|
|
86
|
+
buffer: Buffer;
|
|
87
|
+
path: string;
|
|
88
|
+
fileName?: string;
|
|
89
|
+
size?: number;
|
|
90
|
+
}) => Promise<{
|
|
91
|
+
result: boolean;
|
|
92
|
+
location: string;
|
|
93
|
+
key: string;
|
|
94
|
+
Expiration?: string | undefined;
|
|
95
|
+
ETag?: string | undefined;
|
|
96
|
+
ChecksumCRC32?: string | undefined;
|
|
97
|
+
ChecksumCRC32C?: string | undefined;
|
|
98
|
+
ChecksumCRC64NVME?: string | undefined;
|
|
99
|
+
ChecksumSHA1?: string | undefined;
|
|
100
|
+
ChecksumSHA256?: string | undefined;
|
|
101
|
+
ChecksumType?: import("@aws-sdk/client-s3").ChecksumType | undefined;
|
|
102
|
+
ServerSideEncryption?: import("@aws-sdk/client-s3").ServerSideEncryption | undefined;
|
|
103
|
+
VersionId?: string | undefined;
|
|
104
|
+
SSECustomerAlgorithm?: string | undefined;
|
|
105
|
+
SSECustomerKeyMD5?: string | undefined;
|
|
106
|
+
SSEKMSKeyId?: string | undefined;
|
|
107
|
+
SSEKMSEncryptionContext?: string | undefined;
|
|
108
|
+
BucketKeyEnabled?: boolean | undefined;
|
|
109
|
+
Size?: number | undefined;
|
|
110
|
+
RequestCharged?: import("@aws-sdk/client-s3").RequestCharged | undefined;
|
|
111
|
+
$metadata: import("@smithy/types").ResponseMetadata;
|
|
112
|
+
}>;
|
|
113
|
+
deleteS3Object: (key: string) => Promise<{
|
|
114
|
+
result: boolean;
|
|
115
|
+
DeleteMarker?: boolean | undefined;
|
|
116
|
+
VersionId?: string | undefined;
|
|
117
|
+
RequestCharged?: import("@aws-sdk/client-s3").RequestCharged | undefined;
|
|
118
|
+
$metadata: import("@smithy/types").ResponseMetadata;
|
|
119
|
+
}>;
|
|
120
|
+
};
|
|
121
|
+
Registry: ({ size, theme, children }: import("./Registry").RegistryProps) => import("react/jsx-runtime").JSX.Element;
|
|
122
|
+
Header: ({ logo }: import("./components/ui/Header").HeaderProps) => import("react/jsx-runtime").JSX.Element;
|
|
123
|
+
Header2: ({ logo }: import("./components/ui/Header2").Header2Props) => import("react/jsx-runtime").JSX.Element;
|
|
124
|
+
Aside: ({ primaryColor, menus }: import("./components/ui/Aside").AsideProps) => import("react/jsx-runtime").JSX.Element;
|
|
125
|
+
Page: ({ children }: import("./components/ui/Page").PageProps) => import("react/jsx-runtime").JSX.Element;
|
|
126
|
+
PageTitle: ({ title, section1, section2 }: import("./components/ui/PageTitle").PageTitleProps) => import("react/jsx-runtime").JSX.Element;
|
|
127
|
+
ReactQueryRegistry: import("react").MemoExoticComponent<({ children }: import("./components/registry/ReactQueryRegistry").Props) => import("react/jsx-runtime").JSX.Element>;
|
|
128
|
+
AntdRegistry: ({ size, theme, children }: import("./components/registry/AntdRegistry").RootLayoutProps) => import("react/jsx-runtime").JSX.Element;
|
|
129
|
+
NextAuthRegistry: import("react").MemoExoticComponent<({ children }: import("./components/registry/NextAuthRegistry").Props) => import("react/jsx-runtime").JSX.Element>;
|
|
130
|
+
ErrorRegistry: ({ children }: import("./components/registry/ErrorRegistry").Props) => import("react/jsx-runtime").JSX.Element;
|
|
131
|
+
};
|
|
132
|
+
export default _default;
|
|
133
|
+
export { util, image, Registry, Header, Header2, Aside, Page, PageTitle, ReactQueryRegistry, AntdRegistry, NextAuthRegistry, ErrorRegistry };
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const hello = (name) => {
|
|
5
|
-
return `Hello, ${name}!`;
|
|
6
|
-
};
|
|
7
|
-
exports.hello = hello;
|
|
8
|
-
const add = (a, b) => {
|
|
9
|
-
return a + b;
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
10
4
|
};
|
|
11
|
-
exports
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ErrorRegistry = exports.NextAuthRegistry = exports.AntdRegistry = exports.ReactQueryRegistry = exports.PageTitle = exports.Page = exports.Aside = exports.Header2 = exports.Header = exports.Registry = exports.image = exports.util = void 0;
|
|
7
|
+
const util_1 = __importDefault(require("./util"));
|
|
8
|
+
exports.util = util_1.default;
|
|
9
|
+
const image_1 = __importDefault(require("./image"));
|
|
10
|
+
exports.image = image_1.default;
|
|
11
|
+
const Registry_1 = __importDefault(require("./Registry"));
|
|
12
|
+
exports.Registry = Registry_1.default;
|
|
13
|
+
const ReactQueryRegistry_1 = __importDefault(require("./components/registry/ReactQueryRegistry"));
|
|
14
|
+
exports.ReactQueryRegistry = ReactQueryRegistry_1.default;
|
|
15
|
+
const AntdRegistry_1 = __importDefault(require("./components/registry/AntdRegistry"));
|
|
16
|
+
exports.AntdRegistry = AntdRegistry_1.default;
|
|
17
|
+
const NextAuthRegistry_1 = __importDefault(require("./components/registry/NextAuthRegistry"));
|
|
18
|
+
exports.NextAuthRegistry = NextAuthRegistry_1.default;
|
|
19
|
+
const ErrorRegistry_1 = __importDefault(require("./components/registry/ErrorRegistry"));
|
|
20
|
+
exports.ErrorRegistry = ErrorRegistry_1.default;
|
|
21
|
+
const PageTitle_1 = __importDefault(require("./components/ui/PageTitle"));
|
|
22
|
+
exports.PageTitle = PageTitle_1.default;
|
|
23
|
+
const Header_1 = __importDefault(require("./components/ui/Header"));
|
|
24
|
+
exports.Header = Header_1.default;
|
|
25
|
+
const Header2_1 = __importDefault(require("./components/ui/Header2"));
|
|
26
|
+
exports.Header2 = Header2_1.default;
|
|
27
|
+
const Aside_1 = __importDefault(require("./components/ui/Aside"));
|
|
28
|
+
exports.Aside = Aside_1.default;
|
|
29
|
+
const Page_1 = __importDefault(require("./components/ui/Page"));
|
|
30
|
+
exports.Page = Page_1.default;
|
|
31
|
+
exports.default = { util: util_1.default, image: image_1.default, Registry: Registry_1.default, Header: Header_1.default, Header2: Header2_1.default, Aside: Aside_1.default, Page: Page_1.default, PageTitle: PageTitle_1.default, ReactQueryRegistry: ReactQueryRegistry_1.default, AntdRegistry: AntdRegistry_1.default, NextAuthRegistry: NextAuthRegistry_1.default, ErrorRegistry: ErrorRegistry_1.default };
|