@ripwords/myinvois-client 0.1.5 → 0.1.7

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.
Files changed (81) hide show
  1. package/package.json +8 -11
  2. package/.prettierrc +0 -8
  3. package/CHANGELOG.md +0 -140
  4. package/bun.lock +0 -460
  5. package/myinvois-cert.conf.template +0 -23
  6. package/scripts/gen-cert.sh +0 -159
  7. package/src/api/platform/platformLogin.ts +0 -34
  8. package/src/index.ts +0 -530
  9. package/src/types/classification-codes.d.ts +0 -115
  10. package/src/types/country-code.d.ts +0 -790
  11. package/src/types/currencies.d.ts +0 -383
  12. package/src/types/documents.d.ts +0 -869
  13. package/src/types/e-invoice.d.ts +0 -41
  14. package/src/types/index.d.ts +0 -24
  15. package/src/types/msic/0X.d.ts +0 -408
  16. package/src/types/msic/1X.d.ts +0 -210
  17. package/src/types/msic/2X.d.ts +0 -266
  18. package/src/types/msic/3X.d.ts +0 -114
  19. package/src/types/msic/4X.d.ts +0 -520
  20. package/src/types/msic/5X.d.ts +0 -144
  21. package/src/types/msic/6X.d.ts +0 -200
  22. package/src/types/msic/7X.d.ts +0 -132
  23. package/src/types/msic/8X.d.ts +0 -210
  24. package/src/types/msic/9X.d.ts +0 -186
  25. package/src/types/msic-codes.d.ts +0 -31
  26. package/src/types/payment-modes.d.ts +0 -41
  27. package/src/types/signatures.d.ts +0 -169
  28. package/src/types/state-codes.d.ts +0 -59
  29. package/src/types/tax-types.d.ts +0 -39
  30. package/src/types/unit/1X.d.ts +0 -16
  31. package/src/types/unit/2X.d.ts +0 -62
  32. package/src/types/unit/3X.d.ts +0 -17
  33. package/src/types/unit/4X.d.ts +0 -44
  34. package/src/types/unit/5X.d.ts +0 -26
  35. package/src/types/unit/6X.d.ts +0 -12
  36. package/src/types/unit/7X.d.ts +0 -12
  37. package/src/types/unit/8X.d.ts +0 -15
  38. package/src/types/unit/9X.d.ts +0 -11
  39. package/src/types/unit/AX.d.ts +0 -202
  40. package/src/types/unit/BX.d.ts +0 -212
  41. package/src/types/unit/CX.d.ts +0 -238
  42. package/src/types/unit/DX.d.ts +0 -212
  43. package/src/types/unit/EX.d.ts +0 -196
  44. package/src/types/unit/FX.d.ts +0 -236
  45. package/src/types/unit/GX.d.ts +0 -254
  46. package/src/types/unit/HX.d.ts +0 -234
  47. package/src/types/unit/IX.d.ts +0 -28
  48. package/src/types/unit/JX.d.ts +0 -190
  49. package/src/types/unit/KX.d.ts +0 -284
  50. package/src/types/unit/LX.d.ts +0 -228
  51. package/src/types/unit/MX.d.ts +0 -288
  52. package/src/types/unit/NX.d.ts +0 -226
  53. package/src/types/unit/OX.d.ts +0 -34
  54. package/src/types/unit/PX.d.ts +0 -224
  55. package/src/types/unit/QX.d.ts +0 -94
  56. package/src/types/unit/RX.d.ts +0 -28
  57. package/src/types/unit/SX.d.ts +0 -56
  58. package/src/types/unit/TX.d.ts +0 -44
  59. package/src/types/unit/UX.d.ts +0 -14
  60. package/src/types/unit/VX.d.ts +0 -13
  61. package/src/types/unit/WX.d.ts +0 -34
  62. package/src/types/unit/XX.d.ts +0 -825
  63. package/src/types/unit/YX.d.ts +0 -17
  64. package/src/types/unit/ZX.d.ts +0 -19
  65. package/src/types/unit-types.d.ts +0 -86
  66. package/src/utils/base64.ts +0 -7
  67. package/src/utils/certificate.ts +0 -60
  68. package/src/utils/document.ts +0 -852
  69. package/src/utils/getBaseUrl.ts +0 -5
  70. package/src/utils/helpers.ts +0 -552
  71. package/src/utils/signature-diagnostics.ts +0 -583
  72. package/src/utils/validation.ts +0 -268
  73. package/test/MyInvoiClientWithRealData.test.ts +0 -40
  74. package/test/MyInvoisClient.test.ts +0 -204
  75. package/test/base64.test.ts +0 -43
  76. package/test/dynamicInvoiceFeatures.test.ts +0 -451
  77. package/test/signAndSubmitInvoice.test.ts +0 -452
  78. package/test/signature-diagnostics.test.ts +0 -130
  79. package/tsconfig.json +0 -39
  80. package/tsdown.config.ts +0 -31
  81. package/vitest.config.ts +0 -8
package/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@ripwords/myinvois-client",
3
- "version": "0.1.5",
3
+ "version": "0.1.7",
4
4
  "description": "MyInvois client",
5
5
  "scripts": {
6
6
  "build": "tsdown",
7
7
  "prerelease": "bun run lint && bun run build",
8
8
  "postrelease": "git push --follow-tags",
9
9
  "changelog": "changelogen --release",
10
- "release": "bun run prerelease && bun run changelog && git push --follow-tags && npm publish --access public",
11
- "release:minor": "bun run prerelease && bun run changelog --minor && git push --follow-tags && npm publish --access public",
12
- "release:major": "bun run prerelease && bun run changelog --major && git push --follow-tags && npm publish --access public",
10
+ "release": "bun run prerelease && bun run changelog && npm publish --access public",
11
+ "release:minor": "bun run prerelease && bun run changelog --minor && npm publish --access public",
12
+ "release:major": "bun run prerelease && bun run changelog --major && npm publish --access public",
13
13
  "lint": "oxlint",
14
14
  "test": "vitest"
15
15
  },
@@ -17,13 +17,15 @@
17
17
  "module": "src/index.ts",
18
18
  "type": "module",
19
19
  "types": "dist/index.d.ts",
20
+ "files": [
21
+ "dist"
22
+ ],
20
23
  "exports": {
21
24
  "import": "./dist/index.js",
22
25
  "require": "./dist/index.cjs"
23
26
  },
24
27
  "devDependencies": {
25
28
  "@types/bun": "latest",
26
- "@types/xml-c14n": "^0.0.3",
27
29
  "changelogen": "^0.6.1",
28
30
  "dotenv": "^16.5.0",
29
31
  "oxlint": "^0.16.6",
@@ -35,11 +37,6 @@
35
37
  "typescript": "^5.8.3"
36
38
  },
37
39
  "dependencies": {
38
- "@xmldom/xmldom": "^0.9.8",
39
- "crypto": "^1.0.1",
40
- "xml-c14n": "^0.0.6",
41
- "xml-crypto": "^6.1.2",
42
- "xmldom-ts": "^0.3.1",
43
- "xpath-ts": "^1.3.13"
40
+ "crypto": "^1.0.1"
44
41
  }
45
42
  }
package/.prettierrc DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "semi": false,
3
- "singleQuote": true,
4
- "tabWidth": 2,
5
- "trailingComma": "all",
6
- "printWidth": 80,
7
- "arrowParens": "avoid"
8
- }
package/CHANGELOG.md DELETED
@@ -1,140 +0,0 @@
1
- # Changelog
2
-
3
-
4
- ## v0.1.5
5
-
6
- [compare changes](https://github.com/Ripwords/MyInvoisClient/compare/v0.1.4...v0.1.5)
7
-
8
- ### 🏡 Chore
9
-
10
- - Update release scripts to include 'bun publish' for public access after changelog generation ([3ace843](https://github.com/Ripwords/MyInvoisClient/commit/3ace843))
11
- - Update release scripts to use 'npm publish' instead of 'bun publish' for public access after changelog generation ([cd6854f](https://github.com/Ripwords/MyInvoisClient/commit/cd6854f))
12
-
13
- ### ❤️ Contributors
14
-
15
- - JJ <teohjjteoh@gmail.com>
16
-
17
- ## v0.1.4
18
-
19
- [compare changes](https://github.com/Ripwords/MyInvoisClient/compare/v0.1.3...v0.1.4)
20
-
21
- ### 💅 Refactors
22
-
23
- - Extend RegistrationType to include 'ARMY' and update related interfaces in documents.d.ts and index.ts for improved type safety ([955ccee](https://github.com/Ripwords/MyInvoisClient/commit/955ccee))
24
-
25
- ### 🏡 Chore
26
-
27
- - Update release scripts to remove npm publish command and ensure git push follows changelog generation ([ba56b4a](https://github.com/Ripwords/MyInvoisClient/commit/ba56b4a))
28
-
29
- ### ❤️ Contributors
30
-
31
- - JJ <teohjjteoh@gmail.com>
32
-
33
- ## v0.1.3
34
-
35
- [compare changes](https://github.com/Ripwords/MyInvoisClient/compare/v0.1.2...v0.1.3)
36
-
37
- ### 💅 Refactors
38
-
39
- - Add industry classification fields to Supplier interface in documents.d.ts, update invoice generation logic in document.ts, and enhance related tests for improved type safety and clarity ([648858a](https://github.com/Ripwords/MyInvoisClient/commit/648858a))
40
-
41
- ### ❤️ Contributors
42
-
43
- - JJ <teohjjteoh@gmail.com>
44
-
45
- ## v0.1.2
46
-
47
- [compare changes](https://github.com/Ripwords/MyInvoisClient/compare/v0.1.1...v0.1.2)
48
-
49
- ### 🚀 Enhancements
50
-
51
- - Introduce RegistrationType type and update registrationType fields in Supplier and Buyer interfaces for improved type safety ([28bcd5b](https://github.com/Ripwords/MyInvoisClient/commit/28bcd5b))
52
- - Consolidate and expand invoice type definitions by merging index.ts into index.d.ts, enhancing type safety and clarity across various invoice-related interfaces ([e8ba3f9](https://github.com/Ripwords/MyInvoisClient/commit/e8ba3f9))
53
-
54
- ### 💅 Refactors
55
-
56
- - Update type exports by removing the deprecated index.d.ts file and directly exporting from documents.d.ts to streamline type definitions and improve clarity ([b5fcd79](https://github.com/Ripwords/MyInvoisClient/commit/b5fcd79))
57
- - Streamline invoice type definitions by removing unused fields and enhancing clarity in the documents.d.ts and document.ts files, while updating tests to reflect these changes ([834bb63](https://github.com/Ripwords/MyInvoisClient/commit/834bb63))
58
-
59
- ### 🏡 Chore
60
-
61
- - Enhance release script to run linting before building and publishing ([230e15c](https://github.com/Ripwords/MyInvoisClient/commit/230e15c))
62
-
63
- ### ❤️ Contributors
64
-
65
- - JJ <teohjjteoh@gmail.com>
66
-
67
- ## v0.1.1
68
-
69
-
70
- ### 🚀 Enhancements
71
-
72
- - First commit ([c03ee2c](https://github.com/Ripwords/MyInvoisClient/commit/c03ee2c))
73
- - Add docs ([cb80529](https://github.com/Ripwords/MyInvoisClient/commit/cb80529))
74
- - Add base64 encoding utility ([51cbad8](https://github.com/Ripwords/MyInvoisClient/commit/51cbad8))
75
- - Add XML-related dependencies and update rolldown config for external modules ([5237aad](https://github.com/Ripwords/MyInvoisClient/commit/5237aad))
76
- - Add support for new XML processing features and enhance rolldown configuration for better module handling ([a492bb8](https://github.com/Ripwords/MyInvoisClient/commit/a492bb8))
77
- - Populate signed properties (step 6) ([87397b1](https://github.com/Ripwords/MyInvoisClient/commit/87397b1))
78
- - Implement new XML processing enhancements and refine rolldown configuration for improved module management ([d1b4455](https://github.com/Ripwords/MyInvoisClient/commit/d1b4455))
79
- - Document signature implementation ([b42604c](https://github.com/Ripwords/MyInvoisClient/commit/b42604c))
80
- - Add debugDocumentHash and testSubmissionHashMethods functions for validating document hash calculations ([b0921ac](https://github.com/Ripwords/MyInvoisClient/commit/b0921ac))
81
- - Expand invoice type definitions with InvoiceSubmission and SignedInvoiceSubmission interfaces, enhance document generation utilities to support new structures, and improve type safety in signature handling ([eae4ed7](https://github.com/Ripwords/MyInvoisClient/commit/eae4ed7))
82
-
83
- ### 🩹 Fixes
84
-
85
- - Update release script in package.json to use bun run for building ([d41b5d3](https://github.com/Ripwords/MyInvoisClient/commit/d41b5d3))
86
- - Update release script in package.json to include public access for npm publish ([36c4e14](https://github.com/Ripwords/MyInvoisClient/commit/36c4e14))
87
-
88
- ### 💅 Refactors
89
-
90
- - Update rolldown.config.ts to support multiple output formats and entry file naming ([eacd967](https://github.com/Ripwords/MyInvoisClient/commit/eacd967))
91
- - Update MyInvoisClient to use taxpayerLogin for token management and remove redundant TokenResponse interface; delete obsolete test file ([4844b2c](https://github.com/Ripwords/MyInvoisClient/commit/4844b2c))
92
- - Simplify UnitTypeCode definition by replacing hardcoded values with imports from unit-specific modules ([62484e3](https://github.com/Ripwords/MyInvoisClient/commit/62484e3))
93
- - Update unit type imports to include .d.ts extensions for better type resolution ([db2ea18](https://github.com/Ripwords/MyInvoisClient/commit/db2ea18))
94
- - Remove taxpayerLogin function and update MyInvoisClient to use platformLogin; add optional onBehalfOf parameter to ClientCredentials ([790ea53](https://github.com/Ripwords/MyInvoisClient/commit/790ea53))
95
- - Enhance PEM certificate handling by adding validation for Base64 content and improving error messages ([9d9d8ae](https://github.com/Ripwords/MyInvoisClient/commit/9d9d8ae))
96
- - Remove unused imports related to Document and Node types from xmldom-ts in signature utility files ([15ae5bb](https://github.com/Ripwords/MyInvoisClient/commit/15ae5bb))
97
- - Remove debug logging from populateFinalDocument function in signature utility ([980b322](https://github.com/Ripwords/MyInvoisClient/commit/980b322))
98
- - Update verifyTin method to support multiple ID types and improve parameter naming for clarity ([3d09585](https://github.com/Ripwords/MyInvoisClient/commit/3d09585))
99
- - Initialize tokenExpiration to undefined and enhance token validation logic in MyInvoisClient ([a7edd3e](https://github.com/Ripwords/MyInvoisClient/commit/a7edd3e))
100
- - Remove unnecessary ts-ignore for private method call in MyInvoisClientWithBRN test ([c04ea76](https://github.com/Ripwords/MyInvoisClient/commit/c04ea76))
101
- - Update MSIC code types and integrate into invoice supplier interface ([f28fa71](https://github.com/Ripwords/MyInvoisClient/commit/f28fa71))
102
- - Enhance hashSignedProperties function to support optional canonicalization algorithm and add fallback for C14N 1.1 ([b7d693b](https://github.com/Ripwords/MyInvoisClient/commit/b7d693b))
103
- - Add registrationType field to Supplier interface in invoice-1_1.d.ts ([225ffeb](https://github.com/Ripwords/MyInvoisClient/commit/225ffeb))
104
- - Enhance canonicalization process in canonicalizeAndHashDocument function with optional algorithm support and fallback for C14N 1.1 ([41a5570](https://github.com/Ripwords/MyInvoisClient/commit/41a5570))
105
- - Restructure invoice1-1.ts for improved readability and maintainability; add XML minification and error handling in document hash generation ([9df51cb](https://github.com/Ripwords/MyInvoisClient/commit/9df51cb))
106
- - Update canonicalization algorithm URIs in signature utilities to use C14N 1.1 and ensure proper fallback handling ([20e375a](https://github.com/Ripwords/MyInvoisClient/commit/20e375a))
107
- - Remove unused MyInvoisClient and invoice1-1 utility files, update tsconfig.json to improve type declaration settings, and enhance invoice-1_1 type definitions with additional fields for better clarity ([2bbe651](https://github.com/Ripwords/MyInvoisClient/commit/2bbe651))
108
-
109
- ### 🏡 Chore
110
-
111
- - Update package.json with new name, version, description, and main entry point ([b952d5a](https://github.com/Ripwords/MyInvoisClient/commit/b952d5a))
112
- - Update package.json to add rolldown and rolldown-plugin-dts as devDependencies ([1322bac](https://github.com/Ripwords/MyInvoisClient/commit/1322bac))
113
- - Add release script to package.json ([7ab378d](https://github.com/Ripwords/MyInvoisClient/commit/7ab378d))
114
- - Bump version to 0.0.2 in package.json ([863187a](https://github.com/Ripwords/MyInvoisClient/commit/863187a))
115
- - Bump version to 0.0.4 in package.json and add dotenv as a devDependency; update rolldown output directory and enable sourcemaps ([a53bc25](https://github.com/Ripwords/MyInvoisClient/commit/a53bc25))
116
- - Bump version to 0.0.5 in package.json; update ofetch import path in MyInvoisClient and tests ([c5ef1d3](https://github.com/Ripwords/MyInvoisClient/commit/c5ef1d3))
117
- - Bump version to 0.0.6 in package.json; remove ofetch dependency and update MyInvoisClient to use fetch; add dotenv setup in vitest.config.ts ([4b73f11](https://github.com/Ripwords/MyInvoisClient/commit/4b73f11))
118
- - Bump version to 0.0.7 in package.json; add exports field and update rolldown output directory; enhance MyInvoisClient with debug option ([7bfa137](https://github.com/Ripwords/MyInvoisClient/commit/7bfa137))
119
- - Organise package.json fields ([94afac0](https://github.com/Ripwords/MyInvoisClient/commit/94afac0))
120
- - Bump version to 0.0.8 in package.json; update rolldown-plugin-dts and typescript dependencies; remove git push from release script ([04fc74c](https://github.com/Ripwords/MyInvoisClient/commit/04fc74c))
121
- - Bump version to 0.0.9 in package.json; add clean script using rimraf; update rolldown config for isolated declaration; fix import path in MyInvoisClient ([f820113](https://github.com/Ripwords/MyInvoisClient/commit/f820113))
122
- - Bump version to 0.0.10 in package.json ([0baa610](https://github.com/Ripwords/MyInvoisClient/commit/0baa610))
123
- - Add @vitest/coverage-v8 dependency to package.json and bun.lock for improved test coverage reporting ([02c11da](https://github.com/Ripwords/MyInvoisClient/commit/02c11da))
124
- - Add *.pem to .gitignore to exclude PEM files from version control ([f86ad14](https://github.com/Ripwords/MyInvoisClient/commit/f86ad14))
125
- - Update dependencies in package.json and bun.lock to include xml-crypto and related packages ([48539ea](https://github.com/Ripwords/MyInvoisClient/commit/48539ea))
126
- - Update package version to 0.0.11, add crypto dependency, and adjust type imports for improved clarity ([1b78281](https://github.com/Ripwords/MyInvoisClient/commit/1b78281))
127
- - Remove rolldown and related dependencies, update build script to use tsdown, and enhance type definitions for better clarity and maintainability ([6c06af9](https://github.com/Ripwords/MyInvoisClient/commit/6c06af9))
128
- - Bump package version to 0.1.0 for release readiness ([8b75664](https://github.com/Ripwords/MyInvoisClient/commit/8b75664))
129
- - Update .gitignore to exclude *.conf files, enhance release script to include changelog generation, and expand README with detailed installation and testing instructions for MyInvois client ([ca968bc](https://github.com/Ripwords/MyInvoisClient/commit/ca968bc))
130
- - Add changelogen dependency for automated changelog generation ([3c6592e](https://github.com/Ripwords/MyInvoisClient/commit/3c6592e))
131
-
132
- ### ✅ Tests
133
-
134
- - Skip MyInvoisClient tests if required environment variables are missing; use hardcoded values for TIN and NRIC in tests ([3200a8e](https://github.com/Ripwords/MyInvoisClient/commit/3200a8e))
135
- - Improve handling of potential canonicalization failures in canonicalizeAndHashDocument test ([16d3f58](https://github.com/Ripwords/MyInvoisClient/commit/16d3f58))
136
-
137
- ### ❤️ Contributors
138
-
139
- - JJ <teohjjteoh@gmail.com>
140
-