magic-renamer 18.0.15 → 18.0.17
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/assets/shared/shared_folder_info.txt +1 -1
- package/browser/fesm2022/magic-renamer.mjs.map +1 -1
- package/client/fesm2022/magic-renamer.mjs.map +1 -1
- package/migrations/index.d.ts +1 -0
- package/migrations/index.js +6 -0
- package/migrations/index.js.map +1 -0
- package/migrations/migrations_index._auto-generated_.d.ts +0 -0
- package/migrations/migrations_index._auto-generated_.js +4 -0
- package/migrations/migrations_index._auto-generated_.js.map +1 -0
- package/package.json +3 -3
- package/tmp-environment.json +32 -29
- package/websql/fesm2022/magic-renamer.mjs.map +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
THIS FILE IS GENERATED. THIS FILE IS GENERATED. THIS FILE IS GENERATED.
|
|
2
2
|
|
|
3
|
-
Assets from this folder are being shipped with this npm package (magic-renamer@18.0.
|
|
3
|
+
Assets from this folder are being shipped with this npm package (magic-renamer@18.0.17)
|
|
4
4
|
created from this project.
|
|
5
5
|
|
|
6
6
|
THIS FILE IS GENERATED.THIS FILE IS GENERATED. THIS FILE IS GENERATED.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"magic-renamer.mjs","sources":["../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/rename-rule.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/magic-renamer.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/index.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/magic-renamer.ts"],"sourcesContent":["\n\nimport { Helpers } from 'tnp-helpers/browser';\nimport { _, UtilsString } from 'tnp-core/browser';\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\nexport class RenameRule {\n static from(pArgs: string): RenameRule[] {\n pArgs = pArgs.replace(/\\=\\>/g, '->');\n let args = pArgs.split(/(\\'|\\\")(\\ )+(\\'|\\\")/).filter(f => !!f) as string[];\n log.d('---- Rules ----');\n args.forEach(a => {\n log.d(a);\n });\n log.d('---------------');\n return args\n .filter(a => a.search('->') !== -1)\n .map(a => {\n const [from, to] = a.split('->');\n if (!from || !to) {\n Helpers.error(\n `Incorrect rule\n \"${from}\" -> \"${to}\"\n please follow pattern: 'test name -> my new name '`,\n false,\n true,\n );\n }\n return new RenameRule(from.trim(), to.trim());\n });\n }\n\n public readonly fromWhiteSpaceReplaced: string;\n public readonly toWhiteSpaceReplaced: string;\n constructor(\n public readonly from: string,\n public readonly to: string,\n ) {\n this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\\W/g, ' ');\n this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\\W/g, ' ');\n }\n\n applyTo(s: string): boolean {\n s = s.trim().toLowerCase().replace(/\\W/g, '');\n const res = s.search(this.from.replace(/\\W/g, '')) !== -1;\n return res;\n }\n\n toString = () => {\n return `${this.from} => ${this.to}`;\n };\n\n includes(orgString) {\n return !_.isUndefined(\n this.combinations.find(v => {\n const [from, to] = v;\n return orgString === to;\n }),\n );\n }\n\n get combinations() {\n const thisTo = this.toWhiteSpaceReplaced;\n const thisFrom = this.fromWhiteSpaceReplaced;\n return [\n\n [\n UtilsString.kebabCaseNoSplitNumbers(thisFrom),\n UtilsString.kebabCaseNoSplitNumbers(thisTo),\n ], // my-entity => hello1-kitty\n [_.kebabCase(thisFrom), _.kebabCase(thisTo)], // my-entity => hello-kitty\n [_.camelCase(thisFrom), _.camelCase(thisTo)], // myEntity => helloKitty\n [_.upperFirst(_.camelCase(thisFrom)), _.upperFirst(_.camelCase(thisTo))], // MyEntity => HelloKitty\n [_.snakeCase(thisFrom), _.snakeCase(thisTo)], // my_entity => hello_kitty\n [_.snakeCase(thisFrom).toUpperCase(), _.snakeCase(thisTo).toUpperCase()], // MY_ENTITY => HELLO_KITTY\n [_.startCase(thisFrom), _.startCase(thisTo)], // My Entity => Hello Kitty\n [_.upperCase(thisFrom), _.upperCase(thisTo)], // MY ENTITY => HELLO KITTY\n [_.lowerCase(thisFrom), _.lowerCase(thisTo)], // my entity => hello kitty\n [\n _.camelCase(thisFrom).toLocaleLowerCase(),\n _.camelCase(thisTo).toLocaleLowerCase(),\n ], // myentity => hellokitty\n ];\n }\n\n /**\n * @param orgString input string\n * @returns string with all possible combinations replaced\n */\n replaceInString(orgString: string): string {\n return this.replace({\n orgString,\n replaceallPossibliliteis: true,\n });\n }\n\n /**\n *\n * @param orgString (file name OR file content)\n * @param replaceallPossibliliteis when changin file notent (not name only)\n * @returns\n */\n replace(options: {\n /**\n * file name for debugging\n */\n fileName?: string;\n orgString: string;\n replaceallPossibliliteis?: boolean;\n }) {\n let { fileName, orgString, replaceallPossibliliteis } = options;\n replaceallPossibliliteis = !!replaceallPossibliliteis;\n const combinations = this.combinations;\n for (let index = 0; index < combinations.length; index++) {\n const v = combinations[index];\n let [from, to] = v;\n if (orgString.search(from) !== -1) {\n const regex = new RegExp(Helpers.escapeStringForRegEx(from));\n log.i(`apply! \"${regex.source}\" to file ${fileName} => \"${to}\"`);\n orgString = orgString.replace(\n new RegExp(Helpers.escapeStringForRegEx(from), 'g'),\n to,\n );\n if (!replaceallPossibliliteis) {\n return orgString;\n }\n }\n }\n return orgString;\n }\n}\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/rename-rule.ts","\n\n\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n\nexport class MagicRenamer {\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n}\n\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/magic-renamer.ts","\n\nexport * from './rename-rule';\nexport * from './magic-renamer';\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/index.ts","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["log"],"mappings":";;;;AAKA,MAAMA,KAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC;MAE3C,UAAU,CAAA;IACrB,OAAO,IAAI,CAAC,KAAa,EAAA;QACvB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,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,KAAK,GAAG,YAAY,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;AACxD,YAAA,MAAM,CAAC,GAAG,YAAY,CAAC,KAAK,CAAC;AAC7B,YAAA,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC;YAClB,IAAI,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE;AACjC,gBAAA,MAAM,KAAK,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAC5D,gBAAAA,KAAG,CAAC,CAAC,CAAC,CAAA,QAAA,EAAW,KAAK,CAAC,MAAM,CAAA,UAAA,EAAa,QAAQ,CAAA,KAAA,EAAQ,EAAE,CAAA,CAAA,CAAG,CAAC;gBAChE,SAAS,GAAG,SAAS,CAAC,OAAO,CAC3B,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EACnD,EAAE,CACH;gBACD,IAAI,CAAC,wBAAwB,EAAE;AAC7B,oBAAA,OAAO,SAAS;;;;AAItB,QAAA,OAAO,SAAS;;AAEnB;AAEA;AAAC,CAAC,EAAE,EAAE;;ACjIP,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC;AAExD;AACA;AACA;AACA;AACA;MAIa,YAAY,CAAA;AA+JxB;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGC;AAAC,CAAC,EAAE,EAAE;;;ACjMN;AAAC,CAAC,EAAE,EAAE;;ACLP;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"magic-renamer.mjs","sources":["../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/rename-rule.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/magic-renamer.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/index.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/magic-renamer.ts"],"sourcesContent":["\n\nimport { Helpers } from 'tnp-helpers/browser';\nimport { _, UtilsString } from 'tnp-core/browser';\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\nexport class RenameRule {\n static from(pArgs: string): RenameRule[] {\n pArgs = pArgs.replace(/\\=\\>/g, '->');\n let args = pArgs.split(/(\\'|\\\")(\\ )+(\\'|\\\")/).filter(f => !!f) as string[];\n log.d('---- Rules ----');\n args.forEach(a => {\n log.d(a);\n });\n log.d('---------------');\n return args\n .filter(a => a.search('->') !== -1)\n .map(a => {\n const [from, to] = a.split('->');\n if (!from || !to) {\n Helpers.error(\n `Incorrect rule\n \"${from}\" -> \"${to}\"\n please follow pattern: 'test name -> my new name '`,\n false,\n true,\n );\n }\n return new RenameRule(from.trim(), to.trim());\n });\n }\n\n public readonly fromWhiteSpaceReplaced: string;\n public readonly toWhiteSpaceReplaced: string;\n constructor(\n public readonly from: string,\n public readonly to: string,\n ) {\n this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\\W/g, ' ');\n this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\\W/g, ' ');\n }\n\n applyTo(s: string): boolean {\n s = s.trim().toLowerCase().replace(/\\W/g, '');\n const res = s.search(this.from.replace(/\\W/g, '')) !== -1;\n return res;\n }\n\n toString = () => {\n return `${this.from} => ${this.to}`;\n };\n\n includes(orgString) {\n return !_.isUndefined(\n this.combinations.find(v => {\n const [from, to] = v;\n return orgString === to;\n }),\n );\n }\n\n get combinations() {\n const thisTo = this.toWhiteSpaceReplaced;\n const thisFrom = this.fromWhiteSpaceReplaced;\n return [\n\n [\n UtilsString.kebabCaseNoSplitNumbers(thisFrom),\n UtilsString.kebabCaseNoSplitNumbers(thisTo),\n ], // my-entity => hello1-kitty\n [_.kebabCase(thisFrom), _.kebabCase(thisTo)], // my-entity => hello-kitty\n [_.camelCase(thisFrom), _.camelCase(thisTo)], // myEntity => helloKitty\n [_.upperFirst(_.camelCase(thisFrom)), _.upperFirst(_.camelCase(thisTo))], // MyEntity => HelloKitty\n [_.snakeCase(thisFrom), _.snakeCase(thisTo)], // my_entity => hello_kitty\n [_.snakeCase(thisFrom).toUpperCase(), _.snakeCase(thisTo).toUpperCase()], // MY_ENTITY => HELLO_KITTY\n [_.startCase(thisFrom), _.startCase(thisTo)], // My Entity => Hello Kitty\n [_.upperCase(thisFrom), _.upperCase(thisTo)], // MY ENTITY => HELLO KITTY\n [_.lowerCase(thisFrom), _.lowerCase(thisTo)], // my entity => hello kitty\n [\n _.camelCase(thisFrom).toLocaleLowerCase(),\n _.camelCase(thisTo).toLocaleLowerCase(),\n ], // myentity => hellokitty\n ];\n }\n\n /**\n * @param orgString input string\n * @returns string with all possible combinations replaced\n */\n replaceInString(orgString: string): string {\n return this.replace({\n orgString,\n replaceallPossibliliteis: true,\n });\n }\n\n /**\n *\n * @param orgString (file name OR file content)\n * @param replaceallPossibliliteis when changin file notent (not name only)\n * @returns\n */\n replace(options: {\n /**\n * file name for debugging\n */\n fileName?: string;\n orgString: string;\n replaceallPossibliliteis?: boolean;\n }) {\n let { fileName, orgString, replaceallPossibliliteis } = options;\n replaceallPossibliliteis = !!replaceallPossibliliteis;\n const combinations = this.combinations;\n for (let index = 0; index < combinations.length; index++) {\n const v = combinations[index];\n let [from, to] = v;\n if (orgString.search(from) !== -1) {\n const regex = new RegExp(Helpers.escapeStringForRegEx(from));\n log.i(`apply! \"${regex.source}\" to file ${fileName} => \"${to}\"`);\n orgString = orgString.replace(\n new RegExp(Helpers.escapeStringForRegEx(from), 'g'),\n to,\n );\n if (!replaceallPossibliliteis) {\n return orgString;\n }\n }\n }\n return orgString;\n }\n}\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/rename-rule.ts","\n\n\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n\nexport class MagicRenamer {\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n}\n\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/magic-renamer.ts","\n\nexport * from './rename-rule';\nexport * from './magic-renamer';\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/index.ts","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["log"],"mappings":";;;;AAKA,MAAMA,KAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;MAE5C,UAAU,CAAA;IACrB,OAAO,IAAI,CAAC,KAAa,EAAA;QACvB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACrC,QAAA,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAa,CAAC;AAC3E,QAAAA,KAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;AACzB,QAAA,IAAI,CAAC,OAAO,CAAC,CAAC,IAAG;AACf,YAAAA,KAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACX,SAAC,CAAC,CAAC;AACH,QAAAA,KAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC;AACzB,QAAA,OAAO,IAAI;AACR,aAAA,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;aAClC,GAAG,CAAC,CAAC,IAAG;AACP,YAAA,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;AACjC,YAAA,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,EAAE;gBAChB,OAAO,CAAC,KAAK,CACX,CAAA;AACD,SAAA,EAAA,IAAI,SAAS,EAAE,CAAA;AACiC,0DAAA,CAAA,EAC/C,KAAK,EACL,IAAI,CACL,CAAC;aACH;AACD,YAAA,OAAO,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE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,CAAC;iBAClB;aACF;SACF;AACD,QAAA,OAAO,SAAS,CAAC;KAClB;AACF,CAAA;AAEA,CAAC;AAAA,CAAC,EAAE,EAAE;;ACjIP,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;AAEzD;AACA;AACA;AACA;AACA;MAIa,YAAY,CAAA;AA+JxB,CAAA;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGC,CAAC;AAAA,CAAC,EAAE,EAAE;;;ACjMN,CAAC;AAAA,CAAC,EAAE,EAAE;;ACLP;;AAEG;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"magic-renamer.mjs","sources":["../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/rename-rule.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/magic-renamer.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/index.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/magic-renamer.ts"],"sourcesContent":["\n\nimport { Helpers } from 'tnp-helpers/browser';\nimport { _, UtilsString } from 'tnp-core/browser';\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\nexport class RenameRule {\n static from(pArgs: string): RenameRule[] {\n pArgs = pArgs.replace(/\\=\\>/g, '->');\n let args = pArgs.split(/(\\'|\\\")(\\ )+(\\'|\\\")/).filter(f => !!f) as string[];\n log.d('---- Rules ----');\n args.forEach(a => {\n log.d(a);\n });\n log.d('---------------');\n return args\n .filter(a => a.search('->') !== -1)\n .map(a => {\n const [from, to] = a.split('->');\n if (!from || !to) {\n Helpers.error(\n `Incorrect rule\n \"${from}\" -> \"${to}\"\n please follow pattern: 'test name -> my new name '`,\n false,\n true,\n );\n }\n return new RenameRule(from.trim(), to.trim());\n });\n }\n\n public readonly fromWhiteSpaceReplaced: string;\n public readonly toWhiteSpaceReplaced: string;\n constructor(\n public readonly from: string,\n public readonly to: string,\n ) {\n this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\\W/g, ' ');\n this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\\W/g, ' ');\n }\n\n applyTo(s: string): boolean {\n s = s.trim().toLowerCase().replace(/\\W/g, '');\n const res = s.search(this.from.replace(/\\W/g, '')) !== -1;\n return res;\n }\n\n toString = () => {\n return `${this.from} => ${this.to}`;\n };\n\n includes(orgString) {\n return !_.isUndefined(\n this.combinations.find(v => {\n const [from, to] = v;\n return orgString === to;\n }),\n );\n }\n\n get combinations() {\n const thisTo = this.toWhiteSpaceReplaced;\n const thisFrom = this.fromWhiteSpaceReplaced;\n return [\n\n [\n UtilsString.kebabCaseNoSplitNumbers(thisFrom),\n UtilsString.kebabCaseNoSplitNumbers(thisTo),\n ], // my-entity => hello1-kitty\n [_.kebabCase(thisFrom), _.kebabCase(thisTo)], // my-entity => hello-kitty\n [_.camelCase(thisFrom), _.camelCase(thisTo)], // myEntity => helloKitty\n [_.upperFirst(_.camelCase(thisFrom)), _.upperFirst(_.camelCase(thisTo))], // MyEntity => HelloKitty\n [_.snakeCase(thisFrom), _.snakeCase(thisTo)], // my_entity => hello_kitty\n [_.snakeCase(thisFrom).toUpperCase(), _.snakeCase(thisTo).toUpperCase()], // MY_ENTITY => HELLO_KITTY\n [_.startCase(thisFrom), _.startCase(thisTo)], // My Entity => Hello Kitty\n [_.upperCase(thisFrom), _.upperCase(thisTo)], // MY ENTITY => HELLO KITTY\n [_.lowerCase(thisFrom), _.lowerCase(thisTo)], // my entity => hello kitty\n [\n _.camelCase(thisFrom).toLocaleLowerCase(),\n _.camelCase(thisTo).toLocaleLowerCase(),\n ], // myentity => hellokitty\n ];\n }\n\n /**\n * @param orgString input string\n * @returns string with all possible combinations replaced\n */\n replaceInString(orgString: string): string {\n return this.replace({\n orgString,\n replaceallPossibliliteis: true,\n });\n }\n\n /**\n *\n * @param orgString (file name OR file content)\n * @param replaceallPossibliliteis when changin file notent (not name only)\n * @returns\n */\n replace(options: {\n /**\n * file name for debugging\n */\n fileName?: string;\n orgString: string;\n replaceallPossibliliteis?: boolean;\n }) {\n let { fileName, orgString, replaceallPossibliliteis } = options;\n replaceallPossibliliteis = !!replaceallPossibliliteis;\n const combinations = this.combinations;\n for (let index = 0; index < combinations.length; index++) {\n const v = combinations[index];\n let [from, to] = v;\n if (orgString.search(from) !== -1) {\n const regex = new RegExp(Helpers.escapeStringForRegEx(from));\n log.i(`apply! \"${regex.source}\" to file ${fileName} => \"${to}\"`);\n orgString = orgString.replace(\n new RegExp(Helpers.escapeStringForRegEx(from), 'g'),\n to,\n );\n if (!replaceallPossibliliteis) {\n return orgString;\n }\n }\n }\n return orgString;\n }\n}\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/rename-rule.ts","\n\n\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n\nexport class MagicRenamer {\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n}\n\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/magic-renamer.ts","\n\nexport * from './rename-rule';\nexport * from './magic-renamer';\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/index.ts","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["log"],"mappings":";;;;AAKA,MAAMA,KAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC;MAE3C,UAAU,CAAA;IACrB,OAAO,IAAI,CAAC,KAAa,EAAA;QACvB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;AACpC,QAAA,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAa;AAC1E,QAAAA,KAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC;AACxB,QAAA,IAAI,CAAC,OAAO,CAAC,CAAC,IAAG;AACf,YAAAA,KAAG,CAAC,CAAC,CAAC,CAAC,C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,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAC;AAC5D,gBAAAA,KAAG,CAAC,CAAC,CAAC,CAAA,QAAA,EAAW,KAAK,CAAC,MAAM,CAAA,UAAA,EAAa,QAAQ,CAAA,KAAA,EAAQ,EAAE,CAAA,CAAA,CAAG,CAAC;gBAChE,SAAS,GAAG,SAAS,CAAC,OAAO,CAC3B,IAAI,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EACnD,EAAE,CACH;gBACD,IAAI,CAAC,wBAAwB,EAAE;AAC7B,oBAAA,OAAO,SAAS;;;;AAItB,QAAA,OAAO,SAAS;;AAEnB;AAEA;AAAC,CAAC,EAAE,EAAE;;ACjIP,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC;AAExD;AACA;AACA;AACA;AACA;MAIa,YAAY,CAAA;AA+JxB;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGC;AAAC,CAAC,EAAE,EAAE;;;ACjMN;AAAC,CAAC,EAAE,EAAE;;ACLP;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"magic-renamer.mjs","sources":["../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/rename-rule.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/magic-renamer.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/lib/index.ts","../../../tmp-libs-for-dist/magic-renamer/projects/magic-renamer/src/magic-renamer.ts"],"sourcesContent":["\n\nimport { Helpers } from 'tnp-helpers/browser';\nimport { _, UtilsString } from 'tnp-core/browser';\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\nexport class RenameRule {\n static from(pArgs: string): RenameRule[] {\n pArgs = pArgs.replace(/\\=\\>/g, '->');\n let args = pArgs.split(/(\\'|\\\")(\\ )+(\\'|\\\")/).filter(f => !!f) as string[];\n log.d('---- Rules ----');\n args.forEach(a => {\n log.d(a);\n });\n log.d('---------------');\n return args\n .filter(a => a.search('->') !== -1)\n .map(a => {\n const [from, to] = a.split('->');\n if (!from || !to) {\n Helpers.error(\n `Incorrect rule\n \"${from}\" -> \"${to}\"\n please follow pattern: 'test name -> my new name '`,\n false,\n true,\n );\n }\n return new RenameRule(from.trim(), to.trim());\n });\n }\n\n public readonly fromWhiteSpaceReplaced: string;\n public readonly toWhiteSpaceReplaced: string;\n constructor(\n public readonly from: string,\n public readonly to: string,\n ) {\n this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\\W/g, ' ');\n this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\\W/g, ' ');\n }\n\n applyTo(s: string): boolean {\n s = s.trim().toLowerCase().replace(/\\W/g, '');\n const res = s.search(this.from.replace(/\\W/g, '')) !== -1;\n return res;\n }\n\n toString = () => {\n return `${this.from} => ${this.to}`;\n };\n\n includes(orgString) {\n return !_.isUndefined(\n this.combinations.find(v => {\n const [from, to] = v;\n return orgString === to;\n }),\n );\n }\n\n get combinations() {\n const thisTo = this.toWhiteSpaceReplaced;\n const thisFrom = this.fromWhiteSpaceReplaced;\n return [\n\n [\n UtilsString.kebabCaseNoSplitNumbers(thisFrom),\n UtilsString.kebabCaseNoSplitNumbers(thisTo),\n ], // my-entity => hello1-kitty\n [_.kebabCase(thisFrom), _.kebabCase(thisTo)], // my-entity => hello-kitty\n [_.camelCase(thisFrom), _.camelCase(thisTo)], // myEntity => helloKitty\n [_.upperFirst(_.camelCase(thisFrom)), _.upperFirst(_.camelCase(thisTo))], // MyEntity => HelloKitty\n [_.snakeCase(thisFrom), _.snakeCase(thisTo)], // my_entity => hello_kitty\n [_.snakeCase(thisFrom).toUpperCase(), _.snakeCase(thisTo).toUpperCase()], // MY_ENTITY => HELLO_KITTY\n [_.startCase(thisFrom), _.startCase(thisTo)], // My Entity => Hello Kitty\n [_.upperCase(thisFrom), _.upperCase(thisTo)], // MY ENTITY => HELLO KITTY\n [_.lowerCase(thisFrom), _.lowerCase(thisTo)], // my entity => hello kitty\n [\n _.camelCase(thisFrom).toLocaleLowerCase(),\n _.camelCase(thisTo).toLocaleLowerCase(),\n ], // myentity => hellokitty\n ];\n }\n\n /**\n * @param orgString input string\n * @returns string with all possible combinations replaced\n */\n replaceInString(orgString: string): string {\n return this.replace({\n orgString,\n replaceallPossibliliteis: true,\n });\n }\n\n /**\n *\n * @param orgString (file name OR file content)\n * @param replaceallPossibliliteis when changin file notent (not name only)\n * @returns\n */\n replace(options: {\n /**\n * file name for debugging\n */\n fileName?: string;\n orgString: string;\n replaceallPossibliliteis?: boolean;\n }) {\n let { fileName, orgString, replaceallPossibliliteis } = options;\n replaceallPossibliliteis = !!replaceallPossibliliteis;\n const combinations = this.combinations;\n for (let index = 0; index < combinations.length; index++) {\n const v = combinations[index];\n let [from, to] = v;\n if (orgString.search(from) !== -1) {\n const regex = new RegExp(Helpers.escapeStringForRegEx(from));\n log.i(`apply! \"${regex.source}\" to file ${fileName} => \"${to}\"`);\n orgString = orgString.replace(\n new RegExp(Helpers.escapeStringForRegEx(from), 'g'),\n to,\n );\n if (!replaceallPossibliliteis) {\n return orgString;\n }\n }\n }\n return orgString;\n }\n}\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/rename-rule.ts","\n\n\nimport { Log, Level } from 'ng2-logger/browser';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n\nexport class MagicRenamer {\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n}\n\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/magic-renamer.ts","\n\nexport * from './rename-rule';\nexport * from './magic-renamer';\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/index.ts","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["log"],"mappings":";;;;AAKA,MAAMA,KAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;MAE5C,UAAU,CAAA;IACrB,OAAO,IAAI,CAAC,KAAa,EAAA;QACvB,KAAK,GAAG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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGC,CAAC;AAAA,CAAC,EAAE,EAAE;;;ACjMN,CAAC;AAAA,CAAC,EAAE,EAAE;;ACLP;;AAEG;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './migrations_index._auto-generated_';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;;AAAA,aAAa;AACb,8EAAoD"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrations_index._auto-generated_.js","sourceRoot":"","sources":[""],"names":[],"mappings":"AAAA,yCAAyC;AAEzC,yCAAyC;AAEzC,yCAAyC"}
|
package/package.json
CHANGED
|
@@ -39,17 +39,17 @@
|
|
|
39
39
|
"workerPlugins": {}
|
|
40
40
|
},
|
|
41
41
|
"name": "magic-renamer",
|
|
42
|
-
"version": "18.0.
|
|
42
|
+
"version": "18.0.17",
|
|
43
43
|
"bin": {
|
|
44
44
|
"magic-renamer": "bin/magic-renamer",
|
|
45
45
|
"magic-renamer-debug": "bin/magic-renamer-debug"
|
|
46
46
|
},
|
|
47
47
|
"license": "UNLICENSED",
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"tnp-helpers": "~18.0.
|
|
49
|
+
"tnp-helpers": "~18.0.17"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {},
|
|
52
52
|
"private": false,
|
|
53
|
-
"lastBuildTagHash": "
|
|
53
|
+
"lastBuildTagHash": "72b604c7b1cb49396508787330da403f077fb59c",
|
|
54
54
|
"main": "dist/app.electron.js"
|
|
55
55
|
}
|
package/tmp-environment.json
CHANGED
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"workerPlugins": {}
|
|
44
44
|
},
|
|
45
45
|
"name": "magic-renamer",
|
|
46
|
-
"version": "18.0.
|
|
46
|
+
"version": "18.0.17",
|
|
47
47
|
"bin": {
|
|
48
48
|
"magic-renamer": "bin/magic-renamer",
|
|
49
49
|
"magic-renamer-debug": "bin/magic-renamer-debug"
|
|
50
50
|
},
|
|
51
51
|
"license": "UNLICENSED",
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"tnp-helpers": "~18.0.
|
|
53
|
+
"tnp-helpers": "~18.0.17"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@angular-builders/custom-webpack": "~18.0.0",
|
|
@@ -165,6 +165,7 @@
|
|
|
165
165
|
"command-exists": "1.2.2",
|
|
166
166
|
"compression": "1.7.4",
|
|
167
167
|
"concurrently": "8.2.2",
|
|
168
|
+
"console-png": "1.2.1",
|
|
168
169
|
"content-type": "1.0.5",
|
|
169
170
|
"conventional-changelog-cli": "5.0.0",
|
|
170
171
|
"cookie-parser": "1.4.6",
|
|
@@ -215,13 +216,13 @@
|
|
|
215
216
|
"image-focus": "1.2.1",
|
|
216
217
|
"immer": "10.0.2",
|
|
217
218
|
"immutable": "4.3.7",
|
|
218
|
-
"incremental-compiler": "~18.0.
|
|
219
|
+
"incremental-compiler": "~18.0.17",
|
|
219
220
|
"inquirer": "7.3.3",
|
|
220
221
|
"inquirer-autocomplete-prompt": "1.4.0",
|
|
221
222
|
"inquirer-autocomplete-standalone": "0.8.1",
|
|
222
223
|
"inquirer-select-pro": "1.0.0-alpha.7",
|
|
223
224
|
"is-elevated": "3.0.0",
|
|
224
|
-
"isomorphic-region-loader": "~18.0.
|
|
225
|
+
"isomorphic-region-loader": "~18.0.17",
|
|
225
226
|
"istanbul-instrumenter-loader": "3.0.1",
|
|
226
227
|
"jest": "29.7.0",
|
|
227
228
|
"jest-date-mock": "1.0.10",
|
|
@@ -232,8 +233,8 @@
|
|
|
232
233
|
"joi": "17.13.3",
|
|
233
234
|
"jscodeshift": "0.6.3",
|
|
234
235
|
"json-stringify-safe": "5.0.1",
|
|
235
|
-
"json10": "~18.0.
|
|
236
|
-
"json10-writer": "~18.0.
|
|
236
|
+
"json10": "~18.0.17",
|
|
237
|
+
"json10-writer": "~18.0.17",
|
|
237
238
|
"json5": "2.2.3",
|
|
238
239
|
"json5-writer": "0.2.0",
|
|
239
240
|
"jszip": "3.10.1",
|
|
@@ -242,9 +243,9 @@
|
|
|
242
243
|
"localforage": "1.10.0",
|
|
243
244
|
"lockfile": "1.0.4",
|
|
244
245
|
"lodash": "4.17.21",
|
|
245
|
-
"lodash-walk-object": "~18.0.
|
|
246
|
+
"lodash-walk-object": "~18.0.17",
|
|
246
247
|
"lowdb": "7.0.1",
|
|
247
|
-
"magic-renamer": "~18.0.
|
|
248
|
+
"magic-renamer": "~18.0.16",
|
|
248
249
|
"material-design-icons": "3.0.1",
|
|
249
250
|
"method-override": "2.3.10",
|
|
250
251
|
"minimist": "1.2.8",
|
|
@@ -255,11 +256,11 @@
|
|
|
255
256
|
"ng-in-viewport": "16.1.0",
|
|
256
257
|
"ng-lock": "18.0.1",
|
|
257
258
|
"ng-packagr": "18.1.0",
|
|
258
|
-
"ng-talkback": "~18.0.
|
|
259
|
-
"ng2-logger": "~18.0.
|
|
259
|
+
"ng-talkback": "~18.0.15",
|
|
260
|
+
"ng2-logger": "~18.0.19",
|
|
260
261
|
"ng2-pdfjs-viewer": "18.0.0",
|
|
261
|
-
"ng2-rest": "~18.0.
|
|
262
|
-
"ng2-rest-swagger-generator": "18.0.
|
|
262
|
+
"ng2-rest": "~18.0.16",
|
|
263
|
+
"ng2-rest-swagger-generator": "18.0.13",
|
|
263
264
|
"ngx-ace-wrapper": "17.0.0",
|
|
264
265
|
"ngx-editor": "17.5.4",
|
|
265
266
|
"ngx-highlightjs": "12.0.0",
|
|
@@ -273,7 +274,7 @@
|
|
|
273
274
|
"ngx-scrolltop": "18.0.0",
|
|
274
275
|
"ngx-store": "3.1.1",
|
|
275
276
|
"ngx-typed-js": "2.1.1",
|
|
276
|
-
"node-cli-tester": "~18.0.
|
|
277
|
+
"node-cli-tester": "~18.0.15",
|
|
277
278
|
"node-localstorage": "2.1.6",
|
|
278
279
|
"node-notifier": "10.0.1",
|
|
279
280
|
"node-polyfill-webpack-plugin": "2.0.1",
|
|
@@ -304,7 +305,7 @@
|
|
|
304
305
|
"q": "1.5.1",
|
|
305
306
|
"rallax.js": "2.0.4",
|
|
306
307
|
"randomcolor": "0.5.3",
|
|
307
|
-
"record-replay-req-res-scenario": "~18.0.
|
|
308
|
+
"record-replay-req-res-scenario": "~18.0.15",
|
|
308
309
|
"reflect-metadata": "0.2.2",
|
|
309
310
|
"rimraf": "2.6.2",
|
|
310
311
|
"rxjs": "~7.8.1",
|
|
@@ -315,23 +316,25 @@
|
|
|
315
316
|
"socket.io": "4.7.5",
|
|
316
317
|
"socket.io-client": "4.7.5",
|
|
317
318
|
"sort-package-json": "1.11.0",
|
|
319
|
+
"sql-template-strings": "2.2.2",
|
|
320
|
+
"sql-template-tag": "5.2.1",
|
|
318
321
|
"sql.js": "1.8.0",
|
|
319
|
-
"static-columns": "~18.0.
|
|
322
|
+
"static-columns": "~18.0.17",
|
|
320
323
|
"string-similarity": "4.0.4",
|
|
321
324
|
"sudo-block": "3.0.0",
|
|
322
325
|
"supertest": "7.0.0",
|
|
323
326
|
"sweetalert2": "11.7.32",
|
|
324
327
|
"systeminformation": "3.45.7",
|
|
325
328
|
"taon": "^18",
|
|
326
|
-
"taon-storage": "18.0.
|
|
327
|
-
"taon-type-sql": "18.0.
|
|
328
|
-
"taon-typeorm": "18.0.
|
|
329
|
+
"taon-storage": "18.0.25",
|
|
330
|
+
"taon-type-sql": "18.0.16",
|
|
331
|
+
"taon-typeorm": "18.0.15",
|
|
329
332
|
"task.js": "0.1.5",
|
|
330
333
|
"threads": "1.7.0",
|
|
331
|
-
"tnp": "~18.0.
|
|
332
|
-
"tnp-config": "~18.0.
|
|
333
|
-
"tnp-core": "~18.0.
|
|
334
|
-
"tnp-models": "~18.0.
|
|
334
|
+
"tnp": "~18.0.18",
|
|
335
|
+
"tnp-config": "~18.0.19",
|
|
336
|
+
"tnp-core": "~18.0.43",
|
|
337
|
+
"tnp-models": "~18.0.18",
|
|
335
338
|
"ts-debug": "1.3.0",
|
|
336
339
|
"ts-json-schema-generator": "2.3.0-next.5",
|
|
337
340
|
"ts-loader": "2.3.1",
|
|
@@ -343,14 +346,14 @@
|
|
|
343
346
|
"typedoc": "0.26.5",
|
|
344
347
|
"typedoc-plugin-markdown": "4.2.3",
|
|
345
348
|
"typescript": "~5.5.4",
|
|
346
|
-
"typescript-class-helpers": "~18.0.
|
|
349
|
+
"typescript-class-helpers": "~18.0.18",
|
|
347
350
|
"typescript-formatter": "~7.2.2",
|
|
348
351
|
"typescript-string-enums": "~1.0.0",
|
|
349
352
|
"underscore": "1.13.7",
|
|
350
353
|
"uuid": "10.0.0",
|
|
351
354
|
"validator": "13.5.2",
|
|
352
355
|
"video.js": "8.3.0",
|
|
353
|
-
"vpn-split": "~18.0.
|
|
356
|
+
"vpn-split": "~18.0.15",
|
|
354
357
|
"vscode": "1.1.37",
|
|
355
358
|
"wait-on": "8.0.1",
|
|
356
359
|
"watch": "1.0.2",
|
|
@@ -361,18 +364,18 @@
|
|
|
361
364
|
"zone.js": "~0.13.0"
|
|
362
365
|
},
|
|
363
366
|
"private": false,
|
|
364
|
-
"lastBuildTagHash": "
|
|
367
|
+
"lastBuildTagHash": "72b604c7b1cb49396508787330da403f077fb59c",
|
|
365
368
|
"main": "dist/app.electron.js"
|
|
366
369
|
},
|
|
367
370
|
"build": {
|
|
368
|
-
"number":
|
|
369
|
-
"date": "2024-
|
|
370
|
-
"hash": "
|
|
371
|
+
"number": 296,
|
|
372
|
+
"date": "2024-12-31T17:54:13.000Z",
|
|
373
|
+
"hash": "b6fa5c4c87e84fbe2c90a6d9c56f3f17e3f92b88"
|
|
371
374
|
},
|
|
372
375
|
"currentProjectName": "magic-renamer",
|
|
373
376
|
"currentProjectGenericName": "magic-renamer",
|
|
374
377
|
"currentProjectType": "isomorphic-lib",
|
|
375
|
-
"currentFrameworkVersion": "18.0.
|
|
378
|
+
"currentFrameworkVersion": "18.0.18",
|
|
376
379
|
"isStandaloneProject": true,
|
|
377
380
|
"isSmartContainer": false,
|
|
378
381
|
"pathesTsconfig": "\"paths\": {\"magic-renamer\":[\"./src/lib\"],\"magic-renamer/*\":[\"./src/lib/*\"]},",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"magic-renamer.mjs","sources":["../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/lib/rename-rule.ts","../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/lib/magic-renamer.ts","../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/lib/index.ts","../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/magic-renamer.ts"],"sourcesContent":["\n\nimport { Helpers } from 'tnp-helpers/websql';\nimport { _, UtilsString } from 'tnp-core/websql';\nimport { Log, Level } from 'ng2-logger/websql';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\nexport class RenameRule {\n static from(pArgs: string): RenameRule[] {\n pArgs = pArgs.replace(/\\=\\>/g, '->');\n let args = pArgs.split(/(\\'|\\\")(\\ )+(\\'|\\\")/).filter(f => !!f) as string[];\n log.d('---- Rules ----');\n args.forEach(a => {\n log.d(a);\n });\n log.d('---------------');\n return args\n .filter(a => a.search('->') !== -1)\n .map(a => {\n const [from, to] = a.split('->');\n if (!from || !to) {\n Helpers.error(\n `Incorrect rule\n \"${from}\" -> \"${to}\"\n please follow pattern: 'test name -> my new name '`,\n false,\n true,\n );\n }\n return new RenameRule(from.trim(), to.trim());\n });\n }\n\n public readonly fromWhiteSpaceReplaced: string;\n public readonly toWhiteSpaceReplaced: string;\n constructor(\n public readonly from: string,\n public readonly to: string,\n ) {\n this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\\W/g, ' ');\n this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\\W/g, ' ');\n }\n\n applyTo(s: string): boolean {\n s = s.trim().toLowerCase().replace(/\\W/g, '');\n const res = s.search(this.from.replace(/\\W/g, '')) !== -1;\n return res;\n }\n\n toString = () => {\n return `${this.from} => ${this.to}`;\n };\n\n includes(orgString) {\n return !_.isUndefined(\n this.combinations.find(v => {\n const [from, to] = v;\n return orgString === to;\n }),\n );\n }\n\n get combinations() {\n const thisTo = this.toWhiteSpaceReplaced;\n const thisFrom = this.fromWhiteSpaceReplaced;\n return [\n\n [\n UtilsString.kebabCaseNoSplitNumbers(thisFrom),\n UtilsString.kebabCaseNoSplitNumbers(thisTo),\n ], // my-entity => hello1-kitty\n [_.kebabCase(thisFrom), _.kebabCase(thisTo)], // my-entity => hello-kitty\n [_.camelCase(thisFrom), _.camelCase(thisTo)], // myEntity => helloKitty\n [_.upperFirst(_.camelCase(thisFrom)), _.upperFirst(_.camelCase(thisTo))], // MyEntity => HelloKitty\n [_.snakeCase(thisFrom), _.snakeCase(thisTo)], // my_entity => hello_kitty\n [_.snakeCase(thisFrom).toUpperCase(), _.snakeCase(thisTo).toUpperCase()], // MY_ENTITY => HELLO_KITTY\n [_.startCase(thisFrom), _.startCase(thisTo)], // My Entity => Hello Kitty\n [_.upperCase(thisFrom), _.upperCase(thisTo)], // MY ENTITY => HELLO KITTY\n [_.lowerCase(thisFrom), _.lowerCase(thisTo)], // my entity => hello kitty\n [\n _.camelCase(thisFrom).toLocaleLowerCase(),\n _.camelCase(thisTo).toLocaleLowerCase(),\n ], // myentity => hellokitty\n ];\n }\n\n /**\n * @param orgString input string\n * @returns string with all possible combinations replaced\n */\n replaceInString(orgString: string): string {\n return this.replace({\n orgString,\n replaceallPossibliliteis: true,\n });\n }\n\n /**\n *\n * @param orgString (file name OR file content)\n * @param replaceallPossibliliteis when changin file notent (not name only)\n * @returns\n */\n replace(options: {\n /**\n * file name for debugging\n */\n fileName?: string;\n orgString: string;\n replaceallPossibliliteis?: boolean;\n }) {\n let { fileName, orgString, replaceallPossibliliteis } = options;\n replaceallPossibliliteis = !!replaceallPossibliliteis;\n const combinations = this.combinations;\n for (let index = 0; index < combinations.length; index++) {\n const v = combinations[index];\n let [from, to] = v;\n if (orgString.search(from) !== -1) {\n const regex = new RegExp(Helpers.escapeStringForRegEx(from));\n log.i(`apply! \"${regex.source}\" to file ${fileName} => \"${to}\"`);\n orgString = orgString.replace(\n new RegExp(Helpers.escapeStringForRegEx(from), 'g'),\n to,\n );\n if (!replaceallPossibliliteis) {\n return orgString;\n }\n }\n }\n return orgString;\n }\n}\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/rename-rule.ts","\n\n\nimport { Log, Level } from 'ng2-logger/websql';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n\nexport class MagicRenamer {\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n}\n\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/magic-renamer.ts","\n\nexport * from './rename-rule';\nexport * from './magic-renamer';\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/index.ts","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["log"],"mappings":";;;;AAKA,MAAMA,KAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC;MAE3C,UAAU,CAAA;IACrB,OAAO,IAAI,CAAC,KAAa,EAAA;QACvB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;AACpC,QAAA,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAa;AAC1E,QAAAA,KAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC;AACxB,QAAA,IAAI,CAAC,OAAO,CAAC,CAAC,IAAG;AACf,YAAAA,KAAG,CAAC,CAAC,CAAC,CAAC,CAAC;AACV,SAAC,CAAC;AACF,QAAAA,KAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC;AACxB,QAAA,OAAO;AACJ,aAAA,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;aACjC,GAAG,CAAC,CAAC,IAAG;AACP,YAAA,MAAM,CAAC,IAAI,EAAE,EAAE,CAAC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M,CAAC,OAAO,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAE,GAAG,CAAC,EACnD,EAAE,CACH;gBACD,IAAI,CAAC,wBAAwB,EAAE;AAC7B,oBAAA,OAAO,SAAS;;;;AAItB,QAAA,OAAO,SAAS;;AAEnB;AAEA;AAAC,CAAC,EAAE,EAAE;;ACjIP,MAAM,GAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC;AAExD;AACA;AACA;AACA;AACA;MAIa,YAAY,CAAA;AA+JxB;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGC;AAAC,CAAC,EAAE,EAAE;;;ACjMN;AAAC,CAAC,EAAE,EAAE;;ACLP;;AAEG;;;;"}
|
|
1
|
+
{"version":3,"file":"magic-renamer.mjs","sources":["../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/lib/rename-rule.ts","../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/lib/magic-renamer.ts","../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/lib/index.ts","../../../tmp-libs-for-dist-websql/magic-renamer/projects/magic-renamer/src/magic-renamer.ts"],"sourcesContent":["\n\nimport { Helpers } from 'tnp-helpers/websql';\nimport { _, UtilsString } from 'tnp-core/websql';\nimport { Log, Level } from 'ng2-logger/websql';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\nexport class RenameRule {\n static from(pArgs: string): RenameRule[] {\n pArgs = pArgs.replace(/\\=\\>/g, '->');\n let args = pArgs.split(/(\\'|\\\")(\\ )+(\\'|\\\")/).filter(f => !!f) as string[];\n log.d('---- Rules ----');\n args.forEach(a => {\n log.d(a);\n });\n log.d('---------------');\n return args\n .filter(a => a.search('->') !== -1)\n .map(a => {\n const [from, to] = a.split('->');\n if (!from || !to) {\n Helpers.error(\n `Incorrect rule\n \"${from}\" -> \"${to}\"\n please follow pattern: 'test name -> my new name '`,\n false,\n true,\n );\n }\n return new RenameRule(from.trim(), to.trim());\n });\n }\n\n public readonly fromWhiteSpaceReplaced: string;\n public readonly toWhiteSpaceReplaced: string;\n constructor(\n public readonly from: string,\n public readonly to: string,\n ) {\n this.fromWhiteSpaceReplaced = from.trim().toLowerCase().replace(/\\W/g, ' ');\n this.toWhiteSpaceReplaced = to.trim().toLowerCase().replace(/\\W/g, ' ');\n }\n\n applyTo(s: string): boolean {\n s = s.trim().toLowerCase().replace(/\\W/g, '');\n const res = s.search(this.from.replace(/\\W/g, '')) !== -1;\n return res;\n }\n\n toString = () => {\n return `${this.from} => ${this.to}`;\n };\n\n includes(orgString) {\n return !_.isUndefined(\n this.combinations.find(v => {\n const [from, to] = v;\n return orgString === to;\n }),\n );\n }\n\n get combinations() {\n const thisTo = this.toWhiteSpaceReplaced;\n const thisFrom = this.fromWhiteSpaceReplaced;\n return [\n\n [\n UtilsString.kebabCaseNoSplitNumbers(thisFrom),\n UtilsString.kebabCaseNoSplitNumbers(thisTo),\n ], // my-entity => hello1-kitty\n [_.kebabCase(thisFrom), _.kebabCase(thisTo)], // my-entity => hello-kitty\n [_.camelCase(thisFrom), _.camelCase(thisTo)], // myEntity => helloKitty\n [_.upperFirst(_.camelCase(thisFrom)), _.upperFirst(_.camelCase(thisTo))], // MyEntity => HelloKitty\n [_.snakeCase(thisFrom), _.snakeCase(thisTo)], // my_entity => hello_kitty\n [_.snakeCase(thisFrom).toUpperCase(), _.snakeCase(thisTo).toUpperCase()], // MY_ENTITY => HELLO_KITTY\n [_.startCase(thisFrom), _.startCase(thisTo)], // My Entity => Hello Kitty\n [_.upperCase(thisFrom), _.upperCase(thisTo)], // MY ENTITY => HELLO KITTY\n [_.lowerCase(thisFrom), _.lowerCase(thisTo)], // my entity => hello kitty\n [\n _.camelCase(thisFrom).toLocaleLowerCase(),\n _.camelCase(thisTo).toLocaleLowerCase(),\n ], // myentity => hellokitty\n ];\n }\n\n /**\n * @param orgString input string\n * @returns string with all possible combinations replaced\n */\n replaceInString(orgString: string): string {\n return this.replace({\n orgString,\n replaceallPossibliliteis: true,\n });\n }\n\n /**\n *\n * @param orgString (file name OR file content)\n * @param replaceallPossibliliteis when changin file notent (not name only)\n * @returns\n */\n replace(options: {\n /**\n * file name for debugging\n */\n fileName?: string;\n orgString: string;\n replaceallPossibliliteis?: boolean;\n }) {\n let { fileName, orgString, replaceallPossibliliteis } = options;\n replaceallPossibliliteis = !!replaceallPossibliliteis;\n const combinations = this.combinations;\n for (let index = 0; index < combinations.length; index++) {\n const v = combinations[index];\n let [from, to] = v;\n if (orgString.search(from) !== -1) {\n const regex = new RegExp(Helpers.escapeStringForRegEx(from));\n log.i(`apply! \"${regex.source}\" to file ${fileName} => \"${to}\"`);\n orgString = orgString.replace(\n new RegExp(Helpers.escapeStringForRegEx(from), 'g'),\n to,\n );\n if (!replaceallPossibliliteis) {\n return orgString;\n }\n }\n }\n return orgString;\n }\n}\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/rename-rule.ts","\n\n\nimport { Log, Level } from 'ng2-logger/websql';\nconst log = Log.create('magic-renemer', Level.__NOTHING);\n\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n\nexport class MagicRenamer {\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n}\n\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n/* */\n \n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/magic-renamer.ts","\n\nexport * from './rename-rule';\nexport * from './magic-renamer';\n\n ;({}); // @--end-of-file-for-module=magic-renamer lib/index.ts","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["log"],"mappings":";;;;AAKA,MAAMA,KAAG,GAAG,GAAG,CAAC,MAAM,CAAC,eAAe,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;MAE5C,UAAU,CAAA;IACrB,OAAO,IAAI,CAAC,KAAa,EAAA;QACvB,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACrC,QAAA,IAAI,IAAI,GAAG,KAAK,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAa,CAAC;AAC3E,QAAAA,KAAG,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC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