diff --git a/packages/tools/package.json b/packages/tools/package.json index 5ffe723..4f80372 100644 --- a/packages/tools/package.json +++ b/packages/tools/package.json @@ -38,6 +38,8 @@ "vue-eslint-parser": "^9.4.3" }, "dependencies": { + "@rgrove/parse-xml": "^4.1.0", + "fast-xml-parser": "^4.5.0", "handlebars": "^4.7.8", "ibantools": "^4.5.1" } diff --git a/packages/tools/src/camt/index.ts b/packages/tools/src/camt/index.ts new file mode 100644 index 0000000..c6de764 --- /dev/null +++ b/packages/tools/src/camt/index.ts @@ -0,0 +1,14 @@ +import { type X2jOptions, XMLParser } from 'fast-xml-parser' + +export const parseCamt053 = ({ + xml, + options +}: { + xml: string + options: X2jOptions +}) => { + const parser = new XMLParser(options) + const json = parser.parse(xml) + + return json.Document +} diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 2453b4a..a6a1194 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -481,6 +481,12 @@ importers: packages/tools: dependencies: + '@rgrove/parse-xml': + specifier: ^4.1.0 + version: 4.1.0 + fast-xml-parser: + specifier: ^4.5.0 + version: 4.5.0 handlebars: specifier: ^4.7.8 version: 4.7.8 @@ -1844,6 +1850,10 @@ packages: '@quasar/quasar-ui-qcalendar@4.0.0-beta.16': resolution: {integrity: sha512-KVbFJD1HQp91tiklv+6XsG7bq8FKK6mhhnoVzmjgoyhUAEb9csfbDPbpegy1/FzXy3o0wITe6mmRZ8nbaiMEZg==} + '@rgrove/parse-xml@4.1.0': + resolution: {integrity: sha512-pBiltENdy8SfI0AeR1e5TRpS9/9Gl0eiOEt6ful2jQfzsgvZYWqsKiBWaOCLdocQuk0wS7KOHI37n0C1pnKqTw==} + engines: {node: '>=14.0.0'} + '@rollup/plugin-babel@5.3.1': resolution: {integrity: sha512-WFfdLWU/xVWKeRQnKmIAQULUI7Il0gZnBIH/ZFO069wYIfPu+8zrfp/KMW0atmELoRDq8FbiP3VCss9MhCut7Q==} engines: {node: '>= 10.0.0'} @@ -3236,6 +3246,10 @@ packages: fast-uri@3.0.1: resolution: {integrity: sha512-MWipKbbYiYI0UC7cl8m/i/IWTqfC8YXsqjzybjddLsFjStroQzsHXkc73JutMvBiXmOvapk+axIl79ig5t55Bw==} + fast-xml-parser@4.5.0: + resolution: {integrity: sha512-/PlTQCI96+fZMAOLMZK4CWG1ItCbfZ/0jx7UIJFChPNrx7tcEgerUgWbeieCM9MfHInUDyK8DWYZ+YrywDJuTg==} + hasBin: true + fastify-mailer@2.3.1: resolution: {integrity: sha512-SKMkgws+nYXLW1wwZuStxfRZ/y+QFfAfIakv70VSyqxm8uHqelbDX8p8d7bFUNOTH8gg5VeQnXymrKjKD6hOJw==} engines: {node: '>=10'} @@ -5125,6 +5139,9 @@ packages: resolution: {integrity: sha512-6fPc+R4ihwqP6N/aIv2f1gMH8lOVtWQHoqC4yK6oSDVVocumAsfCqjkXnqiYMhmMwS/mEHLp7Vehlt3ql6lEig==} engines: {node: '>=8'} + strnum@1.0.5: + resolution: {integrity: sha512-J8bbNyKKXl5qYcR36TIO8W3mVGVHrmmxsd5PAItGkmyzwJvybiw2IVq5nqd0i4LSNSkB/sx9VHllbfFdr9k1JA==} + sudo-prompt@8.2.5: resolution: {integrity: sha512-rlBo3HU/1zAJUrkY6jNxDOC9eVYliG6nS4JA8u8KAshITd07tafMc/Br7xQwCSseXwJ2iCcHCE8SNWX3q8Z+kw==} @@ -7342,6 +7359,8 @@ snapshots: '@quasar/quasar-ui-qcalendar@4.0.0-beta.16': {} + '@rgrove/parse-xml@4.1.0': {} + '@rollup/plugin-babel@5.3.1(@babel/core@7.25.2)(rollup@2.79.1)': dependencies: '@babel/core': 7.25.2 @@ -8900,6 +8919,10 @@ snapshots: fast-uri@3.0.1: {} + fast-xml-parser@4.5.0: + dependencies: + strnum: 1.0.5 + fastify-mailer@2.3.1(nodemailer@6.9.15): dependencies: fastify-plugin: 3.0.1 @@ -10760,6 +10783,8 @@ snapshots: strip-json-comments@3.1.1: {} + strnum@1.0.5: {} + sudo-prompt@8.2.5: {} supports-color@5.5.0: