@things-factory/attachment-base 8.0.0-alpha.25 → 8.0.0-alpha.26
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-server/index.js +7 -0
- package/dist-server/index.js.map +1 -1
- package/dist-server/nfc-normalize.d.ts +1 -0
- package/dist-server/nfc-normalize.js +24 -0
- package/dist-server/nfc-normalize.js.map +1 -0
- package/dist-server/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/server/index.ts +9 -0
- package/server/nfc-normalize.ts +25 -0
package/dist-server/index.js
CHANGED
@@ -14,4 +14,11 @@ Object.defineProperty(exports, "singleUpload", { enumerable: true, get: function
|
|
14
14
|
require("./routes");
|
15
15
|
tslib_1.__exportStar(require("./attachment-const"), exports);
|
16
16
|
tslib_1.__exportStar(require("./util"), exports);
|
17
|
+
const nfc_normalize_1 = require("./nfc-normalize");
|
18
|
+
process.on('bootstrap-module-start', async ({ app, config, client }) => {
|
19
|
+
/* 이 코드는 기존 첨부파일의 NFC 정규화를 강제로 실행하기 위해서 임시로 작성되었다. */
|
20
|
+
(0, nfc_normalize_1.normalizeNamesToNFC)()
|
21
|
+
.then(() => console.log('Normalization completed.'))
|
22
|
+
.catch(err => console.error('Error during normalization:', err));
|
23
|
+
});
|
17
24
|
//# sourceMappingURL=index.js.map
|
package/dist-server/index.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;AAAA,6DAAkC;AAClC,oDAAyB;AACzB,gFAOiD;AAN/C,uHAAA,gBAAgB,OAAA;AAChB,wHAAA,iBAAiB,OAAA;AACjB,uHAAA,gBAAgB,OAAA;AAChB,6HAAA,sBAAsB,OAAA;AACtB,qHAAA,cAAc,OAAA;AACd,mHAAA,YAAY,OAAA;AAGd,oBAAiB;AAEjB,6DAAkC;AAClC,iDAAsB","sourcesContent":["export * from './attachment-const'\nexport * from './service'\nexport {\n createAttachment,\n createAttachments,\n deleteAttachment,\n deleteAttachmentsByRef,\n multipleUpload,\n singleUpload\n} from './service/attachment/attachment-mutation'\n\nimport './routes'\n\nexport * from './attachment-const'\nexport * from './util'\n"]}
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../server/index.ts"],"names":[],"mappings":";;;;AAAA,6DAAkC;AAClC,oDAAyB;AACzB,gFAOiD;AAN/C,uHAAA,gBAAgB,OAAA;AAChB,wHAAA,iBAAiB,OAAA;AACjB,uHAAA,gBAAgB,OAAA;AAChB,6HAAA,sBAAsB,OAAA;AACtB,qHAAA,cAAc,OAAA;AACd,mHAAA,YAAY,OAAA;AAGd,oBAAiB;AAEjB,6DAAkC;AAClC,iDAAsB;AAEtB,mDAAqD;AAErD,OAAO,CAAC,EAAE,CAAC,wBAA+B,EAAE,KAAK,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAO,EAAE,EAAE;IACjF,qDAAqD;IACrD,IAAA,mCAAmB,GAAE;SAClB,IAAI,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;SACnD,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,GAAG,CAAC,CAAC,CAAA;AACpE,CAAC,CAAC,CAAA","sourcesContent":["export * from './attachment-const'\nexport * from './service'\nexport {\n createAttachment,\n createAttachments,\n deleteAttachment,\n deleteAttachmentsByRef,\n multipleUpload,\n singleUpload\n} from './service/attachment/attachment-mutation'\n\nimport './routes'\n\nexport * from './attachment-const'\nexport * from './util'\n\nimport { normalizeNamesToNFC } from './nfc-normalize'\n\nprocess.on('bootstrap-module-start' as any, async ({ app, config, client }: any) => {\n /* 이 코드는 기존 첨부파일의 NFC 정규화를 강제로 실행하기 위해서 임시로 작성되었다. */\n normalizeNamesToNFC()\n .then(() => console.log('Normalization completed.'))\n .catch(err => console.error('Error during normalization:', err))\n})\n"]}
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function normalizeNamesToNFC(): Promise<void>;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.normalizeNamesToNFC = normalizeNamesToNFC;
|
4
|
+
const shell_1 = require("@things-factory/shell");
|
5
|
+
const attachment_1 = require("./service/attachment/attachment");
|
6
|
+
async function normalizeNamesToNFC() {
|
7
|
+
const attachmentRepository = (0, shell_1.getRepository)(attachment_1.Attachment);
|
8
|
+
// 모든 Attachment 항목을 조회
|
9
|
+
const attachments = await attachmentRepository.find();
|
10
|
+
// NFD로 저장된 name을 NFC로 변환하여 업데이트
|
11
|
+
for (const attachment of attachments) {
|
12
|
+
if (attachment.name) {
|
13
|
+
const normalizedName = attachment.name.normalize('NFC');
|
14
|
+
// name이 NFD로 저장된 경우만 업데이트
|
15
|
+
if (attachment.name !== normalizedName) {
|
16
|
+
attachment.name = normalizedName;
|
17
|
+
await attachmentRepository.save(attachment);
|
18
|
+
console.log(`Updated name for attachment ID ${attachment.id}: ${normalizedName}`);
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
console.log('All names have been normalized to NFC.');
|
23
|
+
}
|
24
|
+
//# sourceMappingURL=nfc-normalize.js.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"nfc-normalize.js","sourceRoot":"","sources":["../server/nfc-normalize.ts"],"names":[],"mappings":";;AAGA,kDAqBC;AAxBD,iDAAqD;AACrD,gEAA4D;AAErD,KAAK,UAAU,mBAAmB;IACvC,MAAM,oBAAoB,GAAG,IAAA,qBAAa,EAAC,uBAAU,CAAC,CAAA;IAEtD,uBAAuB;IACvB,MAAM,WAAW,GAAG,MAAM,oBAAoB,CAAC,IAAI,EAAE,CAAA;IAErD,gCAAgC;IAChC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;QACrC,IAAI,UAAU,CAAC,IAAI,EAAE,CAAC;YACpB,MAAM,cAAc,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAA;YAEvD,0BAA0B;YAC1B,IAAI,UAAU,CAAC,IAAI,KAAK,cAAc,EAAE,CAAC;gBACvC,UAAU,CAAC,IAAI,GAAG,cAAc,CAAA;gBAChC,MAAM,oBAAoB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;gBAC3C,OAAO,CAAC,GAAG,CAAC,kCAAkC,UAAU,CAAC,EAAE,KAAK,cAAc,EAAE,CAAC,CAAA;YACnF,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAA;AACvD,CAAC","sourcesContent":["import { getRepository } from '@things-factory/shell'\nimport { Attachment } from './service/attachment/attachment'\n\nexport async function normalizeNamesToNFC() {\n const attachmentRepository = getRepository(Attachment)\n\n // 모든 Attachment 항목을 조회\n const attachments = await attachmentRepository.find()\n\n // NFD로 저장된 name을 NFC로 변환하여 업데이트\n for (const attachment of attachments) {\n if (attachment.name) {\n const normalizedName = attachment.name.normalize('NFC')\n\n // name이 NFD로 저장된 경우만 업데이트\n if (attachment.name !== normalizedName) {\n attachment.name = normalizedName\n await attachmentRepository.save(attachment)\n console.log(`Updated name for attachment ID ${attachment.id}: ${normalizedName}`)\n }\n }\n }\n\n console.log('All names have been normalized to NFC.')\n}\n"]}
|