taxdrop-core 1.0.0 → 1.0.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/.vscode/launch.json +34 -0
- package/.vscode/settings.json +26 -0
- package/README.md +1 -1
- package/eslint.config.js +43 -0
- package/index.js +1 -0
- package/package.json +24 -5
- package/prettier.config.js +5 -0
- package/scripts/bump-version.js +68 -0
- package/src/invoices/document-types/document-types.js +51 -0
- package/src/invoices/document-types/index.js +11 -0
- package/tests/invoices/document-types.js/document-types.test.js +135 -0
- package/tsconfig.json +11 -0
- package/types/document-types.d.ts +70 -0
- package/types/index.d.ts +8 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
{
|
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
|
3
|
+
// Hover to view descriptions of existing attributes.
|
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
|
5
|
+
|
|
6
|
+
"version": "0.2.0",
|
|
7
|
+
"configurations": [
|
|
8
|
+
{
|
|
9
|
+
"type": "node",
|
|
10
|
+
"request": "launch",
|
|
11
|
+
"name": "Debug Vitest",
|
|
12
|
+
"autoAttachChildProcesses": true,
|
|
13
|
+
"program": "${workspaceFolder}/node_modules/vitest/vitest.mjs",
|
|
14
|
+
"args": ["run"],
|
|
15
|
+
"smartStep": true,
|
|
16
|
+
"skipFiles": ["<node_internals>/**"],
|
|
17
|
+
"console": "integratedTerminal"
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
"type": "node",
|
|
21
|
+
"request": "launch",
|
|
22
|
+
"name": "Debug Vitest Current File",
|
|
23
|
+
"autoAttachChildProcesses": true,
|
|
24
|
+
"program": "${workspaceFolder}/node_modules/vitest/vitest.mjs",
|
|
25
|
+
"args": [
|
|
26
|
+
"run",
|
|
27
|
+
"${relativeFile}" // ← no `--test`
|
|
28
|
+
],
|
|
29
|
+
"smartStep": true,
|
|
30
|
+
"skipFiles": ["<node_internals>/**"],
|
|
31
|
+
"console": "integratedTerminal"
|
|
32
|
+
}
|
|
33
|
+
]
|
|
34
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"explorer.sortOrder": "filesFirst",
|
|
3
|
+
"explorer.openEditors.visible": 0,
|
|
4
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
5
|
+
"editor.formatOnSave": true,
|
|
6
|
+
"[javascript]": {
|
|
7
|
+
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
|
8
|
+
"editor.formatOnSave": true
|
|
9
|
+
},
|
|
10
|
+
"launch": {
|
|
11
|
+
"configurations": [],
|
|
12
|
+
"compounds": []
|
|
13
|
+
},
|
|
14
|
+
"javascript.preferences.importModuleSpecifierEnding": "js",
|
|
15
|
+
"js/ts.implicitProjectConfig.checkJs": true,
|
|
16
|
+
"javascript.validate.enable": true,
|
|
17
|
+
"javascript.format.enable": false,
|
|
18
|
+
"typescript.format.enable": false,
|
|
19
|
+
"eslint.enable": true,
|
|
20
|
+
"eslint.validate": ["javascript"],
|
|
21
|
+
"editor.codeActionsOnSave": {
|
|
22
|
+
"source.fixAll.eslint": "explicit"
|
|
23
|
+
},
|
|
24
|
+
"prettier.requireConfig": true,
|
|
25
|
+
"eslint.format.enable": false
|
|
26
|
+
}
|
package/README.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
# taxdrop-core
|
|
1
|
+
# taxdrop-core
|
package/eslint.config.js
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import js from '@eslint/js'
|
|
2
|
+
import eslintPluginPrettier from 'eslint-plugin-prettier'
|
|
3
|
+
import eslintConfigPrettier from 'eslint-config-prettier'
|
|
4
|
+
|
|
5
|
+
/** @type {import("eslint").Linter.FlatConfig[]} */
|
|
6
|
+
export default [
|
|
7
|
+
js.configs.recommended,
|
|
8
|
+
eslintConfigPrettier,
|
|
9
|
+
{
|
|
10
|
+
files: ['**/*.js'],
|
|
11
|
+
languageOptions: {
|
|
12
|
+
sourceType: 'module',
|
|
13
|
+
ecmaVersion: 'latest',
|
|
14
|
+
globals: {
|
|
15
|
+
console: 'readonly',
|
|
16
|
+
process: 'readonly',
|
|
17
|
+
Buffer: 'readonly',
|
|
18
|
+
__dirname: 'readonly',
|
|
19
|
+
__filename: 'readonly',
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
plugins: {
|
|
23
|
+
prettier: eslintPluginPrettier,
|
|
24
|
+
},
|
|
25
|
+
rules: {
|
|
26
|
+
'no-console': 'off',
|
|
27
|
+
'no-unused-vars': ['warn', { argsIgnorePattern: '^_' }],
|
|
28
|
+
curly: ['error', 'all'],
|
|
29
|
+
'prettier/prettier': [
|
|
30
|
+
'error',
|
|
31
|
+
{
|
|
32
|
+
semi: false,
|
|
33
|
+
singleQuote: true,
|
|
34
|
+
trailingComma: 'all',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
semi: ['error', 'never'],
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
ignores: ['node_modules/**', 'dist/**', 'build/**', 'coverage/**'],
|
|
42
|
+
},
|
|
43
|
+
]
|
package/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './src/invoices/document-types/index.js'
|
package/package.json
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "taxdrop-core",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
|
-
"type":"module",
|
|
6
|
+
"type": "module",
|
|
7
7
|
"scripts": {
|
|
8
|
-
"
|
|
8
|
+
"lint": "eslint .",
|
|
9
|
+
"lint:fix": "eslint . --fix",
|
|
10
|
+
"format": "prettier --write .",
|
|
11
|
+
"test": "vitest run --coverage",
|
|
12
|
+
"check-format": "prettier --check .",
|
|
13
|
+
"bump": "node ./scripts/bump-version.js",
|
|
14
|
+
"check": "npm run lint && npm run check-format && npm run test",
|
|
15
|
+
"build:types": "tsc --project tsconfig.json && prettier --write ."
|
|
9
16
|
},
|
|
10
17
|
"repository": {
|
|
11
18
|
"type": "git",
|
|
@@ -13,12 +20,24 @@
|
|
|
13
20
|
},
|
|
14
21
|
"keywords": [],
|
|
15
22
|
"author": "",
|
|
16
|
-
"license": "ISC",
|
|
23
|
+
"license": "ISC",
|
|
17
24
|
"bugs": {
|
|
18
25
|
"url": "https://github.com/fchange-ltd/taxdrop-core/issues"
|
|
19
26
|
},
|
|
20
27
|
"homepage": "https://github.com/fchange-ltd/taxdrop-core#readme",
|
|
21
|
-
|
|
28
|
+
"exports": {
|
|
22
29
|
".": "./src/index.js"
|
|
30
|
+
},
|
|
31
|
+
"dependencies": {
|
|
32
|
+
"eslint": "^9.39.2",
|
|
33
|
+
"prettier": "^3.8.1",
|
|
34
|
+
"typescript": "^5.9.3",
|
|
35
|
+
"vitest": "^4.0.17"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@eslint/js": "^9.39.2",
|
|
39
|
+
"@vitest/coverage-v8": "^4.0.17",
|
|
40
|
+
"eslint-config-prettier": "^10.1.8",
|
|
41
|
+
"eslint-plugin-prettier": "^5.5.5"
|
|
23
42
|
}
|
|
24
43
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import fs from 'fs'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import { execSync } from 'child_process'
|
|
4
|
+
|
|
5
|
+
const type = process.argv[2] // "major" | "minor" | "patch" | "-major" | "-minor" | "-patch"
|
|
6
|
+
|
|
7
|
+
if (!['major', 'minor', 'patch', '-major', '-minor', '-patch'].includes(type)) {
|
|
8
|
+
console.error(`Usage: npm run bump <major|minor|patch|-major|-minor|-patch>`)
|
|
9
|
+
process.exit(1)
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const pkgPath = path.resolve(process.cwd(), 'package.json')
|
|
13
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'))
|
|
14
|
+
|
|
15
|
+
let [major, minor, patch] = pkg.version.split('.').map(Number)
|
|
16
|
+
|
|
17
|
+
const bump = () => {
|
|
18
|
+
switch (type) {
|
|
19
|
+
case 'major':
|
|
20
|
+
return [major + 1, 0, 0]
|
|
21
|
+
case 'minor':
|
|
22
|
+
return [major, minor + 1, 0]
|
|
23
|
+
case 'patch':
|
|
24
|
+
return [major, minor, patch + 1]
|
|
25
|
+
case '-major':
|
|
26
|
+
if (major === 0) {
|
|
27
|
+
throw new Error('Cannot decrement major below 0')
|
|
28
|
+
}
|
|
29
|
+
return [major - 1, 0, 0]
|
|
30
|
+
case '-minor':
|
|
31
|
+
if (minor === 0) {
|
|
32
|
+
if (major === 0) {
|
|
33
|
+
throw new Error('Cannot decrement minor below 0.0')
|
|
34
|
+
}
|
|
35
|
+
return [major - 1, 0, 0]
|
|
36
|
+
}
|
|
37
|
+
return [major, minor - 1, 0]
|
|
38
|
+
case '-patch':
|
|
39
|
+
if (patch === 0) {
|
|
40
|
+
if (minor === 0) {
|
|
41
|
+
if (major === 0) {
|
|
42
|
+
throw new Error('Cannot decrement below 0.0.0')
|
|
43
|
+
}
|
|
44
|
+
return [major - 1, 0, 0]
|
|
45
|
+
}
|
|
46
|
+
return [major, minor - 1, 0]
|
|
47
|
+
}
|
|
48
|
+
return [major, minor, patch - 1]
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const [newMajor, newMinor, newPatch] = bump()
|
|
53
|
+
const newVersion = `${newMajor}.${newMinor}.${newPatch}`
|
|
54
|
+
|
|
55
|
+
pkg.version = newVersion
|
|
56
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n')
|
|
57
|
+
|
|
58
|
+
console.log(`✔ Updated version to ${newVersion}`)
|
|
59
|
+
|
|
60
|
+
// update package-lock.json if exists
|
|
61
|
+
if (fs.existsSync('./package-lock.json')) {
|
|
62
|
+
try {
|
|
63
|
+
execSync('npm install --package-lock-only', { stdio: 'inherit' })
|
|
64
|
+
console.log('✔ package-lock.json updated')
|
|
65
|
+
} catch (err) {
|
|
66
|
+
console.error('Failed to update package-lock.json', err)
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document type constants.
|
|
3
|
+
* Defines all valid document types in the system.
|
|
4
|
+
*
|
|
5
|
+
* @module document-types.constants
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Document type enum values.
|
|
10
|
+
* These are the internal document type identifiers used throughout the system.
|
|
11
|
+
*
|
|
12
|
+
* @readonly
|
|
13
|
+
* @enum {string}
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
export const LEGAL_DOCUMENT_TYPES = Object.freeze({
|
|
17
|
+
RECEIPT: 'receipt',
|
|
18
|
+
TAX_INVOICE: 'tax_invoice',
|
|
19
|
+
CREDIT_INVOICE: 'credit_invoice',
|
|
20
|
+
PAYMENT_REQUEST: 'payment_request',
|
|
21
|
+
TAX_INVOICE_RECEIPT: 'tax_invoice_receipt',
|
|
22
|
+
})
|
|
23
|
+
/**
|
|
24
|
+
* Document type enum values.
|
|
25
|
+
* These are the internal document type identifiers used throughout the system.
|
|
26
|
+
*
|
|
27
|
+
* @readonly
|
|
28
|
+
* @enum {string}
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
export const OPERATIONAL_DOCUMENT_TYPES = Object.freeze({
|
|
32
|
+
ORDER: 'order',
|
|
33
|
+
QUOTE: 'quote',
|
|
34
|
+
INVOICE: 'invoice',
|
|
35
|
+
DELIVERY_NOTE: 'delivery_note',
|
|
36
|
+
PURCHASE_ORDER: 'purchase_order',
|
|
37
|
+
PROFORMA_INVOICE: 'proforma_invoice',
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Document type enum values.
|
|
42
|
+
* These are the internal document type identifiers used throughout the system.
|
|
43
|
+
*
|
|
44
|
+
* @readonly
|
|
45
|
+
* @enum {string}
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
export const DOCUMENT_TYPES = Object.freeze({
|
|
49
|
+
...LEGAL_DOCUMENT_TYPES,
|
|
50
|
+
...OPERATIONAL_DOCUMENT_TYPES,
|
|
51
|
+
})
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import {
|
|
3
|
+
LEGAL_DOCUMENT_TYPES,
|
|
4
|
+
OPERATIONAL_DOCUMENT_TYPES,
|
|
5
|
+
DOCUMENT_TYPES,
|
|
6
|
+
} from '../../../src/invoices/document-types/document-types.js'
|
|
7
|
+
|
|
8
|
+
describe('document-types', () => {
|
|
9
|
+
describe('LEGAL_DOCUMENT_TYPES', () => {
|
|
10
|
+
it('should be a frozen object', () => {
|
|
11
|
+
expect(Object.isFrozen(LEGAL_DOCUMENT_TYPES)).toBe(true)
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
it('should contain all expected legal document types', () => {
|
|
15
|
+
expect(LEGAL_DOCUMENT_TYPES).toEqual({
|
|
16
|
+
RECEIPT: 'receipt',
|
|
17
|
+
TAX_INVOICE: 'tax_invoice',
|
|
18
|
+
CREDIT_INVOICE: 'credit_invoice',
|
|
19
|
+
PAYMENT_REQUEST: 'payment_request',
|
|
20
|
+
TAX_INVOICE_RECEIPT: 'tax_invoice_receipt',
|
|
21
|
+
})
|
|
22
|
+
})
|
|
23
|
+
|
|
24
|
+
it('should have all values as strings', () => {
|
|
25
|
+
Object.values(LEGAL_DOCUMENT_TYPES).forEach((value) => {
|
|
26
|
+
expect(typeof value).toBe('string')
|
|
27
|
+
})
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
it('should be immutable', () => {
|
|
31
|
+
expect(() => {
|
|
32
|
+
// @ts-expect-error - we want to test the immutability
|
|
33
|
+
LEGAL_DOCUMENT_TYPES.NEW_TYPE = 'new_type'
|
|
34
|
+
}).toThrow()
|
|
35
|
+
})
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
describe('OPERATIONAL_DOCUMENT_TYPES', () => {
|
|
39
|
+
it('should be a frozen object', () => {
|
|
40
|
+
expect(Object.isFrozen(OPERATIONAL_DOCUMENT_TYPES)).toBe(true)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
it('should contain all expected operational document types', () => {
|
|
44
|
+
expect(OPERATIONAL_DOCUMENT_TYPES).toEqual({
|
|
45
|
+
ORDER: 'order',
|
|
46
|
+
QUOTE: 'quote',
|
|
47
|
+
INVOICE: 'invoice',
|
|
48
|
+
DELIVERY_NOTE: 'delivery_note',
|
|
49
|
+
PURCHASE_ORDER: 'purchase_order',
|
|
50
|
+
PROFORMA_INVOICE: 'proforma_invoice',
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('should have all values as strings', () => {
|
|
55
|
+
Object.values(OPERATIONAL_DOCUMENT_TYPES).forEach((value) => {
|
|
56
|
+
expect(typeof value).toBe('string')
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
it('should be immutable', () => {
|
|
61
|
+
expect(() => {
|
|
62
|
+
// @ts-expect-error - we want to test the immutability
|
|
63
|
+
OPERATIONAL_DOCUMENT_TYPES.NEW_TYPE = 'new_type'
|
|
64
|
+
}).toThrow()
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
describe('DOCUMENT_TYPES', () => {
|
|
69
|
+
it('should be a frozen object', () => {
|
|
70
|
+
expect(Object.isFrozen(DOCUMENT_TYPES)).toBe(true)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it('should contain all legal document types', () => {
|
|
74
|
+
expect(DOCUMENT_TYPES.RECEIPT).toBe(LEGAL_DOCUMENT_TYPES.RECEIPT)
|
|
75
|
+
expect(DOCUMENT_TYPES.TAX_INVOICE).toBe(LEGAL_DOCUMENT_TYPES.TAX_INVOICE)
|
|
76
|
+
expect(DOCUMENT_TYPES.CREDIT_INVOICE).toBe(
|
|
77
|
+
LEGAL_DOCUMENT_TYPES.CREDIT_INVOICE,
|
|
78
|
+
)
|
|
79
|
+
expect(DOCUMENT_TYPES.PAYMENT_REQUEST).toBe(
|
|
80
|
+
LEGAL_DOCUMENT_TYPES.PAYMENT_REQUEST,
|
|
81
|
+
)
|
|
82
|
+
expect(DOCUMENT_TYPES.TAX_INVOICE_RECEIPT).toBe(
|
|
83
|
+
LEGAL_DOCUMENT_TYPES.TAX_INVOICE_RECEIPT,
|
|
84
|
+
)
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
it('should contain all operational document types', () => {
|
|
88
|
+
expect(DOCUMENT_TYPES.ORDER).toBe(OPERATIONAL_DOCUMENT_TYPES.ORDER)
|
|
89
|
+
expect(DOCUMENT_TYPES.QUOTE).toBe(OPERATIONAL_DOCUMENT_TYPES.QUOTE)
|
|
90
|
+
expect(DOCUMENT_TYPES.INVOICE).toBe(OPERATIONAL_DOCUMENT_TYPES.INVOICE)
|
|
91
|
+
expect(DOCUMENT_TYPES.DELIVERY_NOTE).toBe(
|
|
92
|
+
OPERATIONAL_DOCUMENT_TYPES.DELIVERY_NOTE,
|
|
93
|
+
)
|
|
94
|
+
expect(DOCUMENT_TYPES.PURCHASE_ORDER).toBe(
|
|
95
|
+
OPERATIONAL_DOCUMENT_TYPES.PURCHASE_ORDER,
|
|
96
|
+
)
|
|
97
|
+
expect(DOCUMENT_TYPES.PROFORMA_INVOICE).toBe(
|
|
98
|
+
OPERATIONAL_DOCUMENT_TYPES.PROFORMA_INVOICE,
|
|
99
|
+
)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
it('should contain all document types from both legal and operational', () => {
|
|
103
|
+
const allLegalKeys = Object.keys(LEGAL_DOCUMENT_TYPES)
|
|
104
|
+
const allOperationalKeys = Object.keys(OPERATIONAL_DOCUMENT_TYPES)
|
|
105
|
+
const allDocumentKeys = Object.keys(DOCUMENT_TYPES)
|
|
106
|
+
|
|
107
|
+
expect(allDocumentKeys.length).toBe(
|
|
108
|
+
allLegalKeys.length + allOperationalKeys.length,
|
|
109
|
+
)
|
|
110
|
+
|
|
111
|
+
allLegalKeys.forEach((key) => {
|
|
112
|
+
expect(DOCUMENT_TYPES).toHaveProperty(key)
|
|
113
|
+
expect(DOCUMENT_TYPES[key]).toBe(LEGAL_DOCUMENT_TYPES[key])
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
allOperationalKeys.forEach((key) => {
|
|
117
|
+
expect(DOCUMENT_TYPES).toHaveProperty(key)
|
|
118
|
+
expect(DOCUMENT_TYPES[key]).toBe(OPERATIONAL_DOCUMENT_TYPES[key])
|
|
119
|
+
})
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
it('should have all values as strings', () => {
|
|
123
|
+
Object.values(DOCUMENT_TYPES).forEach((value) => {
|
|
124
|
+
expect(typeof value).toBe('string')
|
|
125
|
+
})
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
it('should be immutable', () => {
|
|
129
|
+
expect(() => {
|
|
130
|
+
// @ts-expect-error - we want to test the immutability
|
|
131
|
+
DOCUMENT_TYPES.NEW_TYPE = 'new_type'
|
|
132
|
+
}).toThrow()
|
|
133
|
+
})
|
|
134
|
+
})
|
|
135
|
+
})
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Document type enum values.
|
|
3
|
+
* These are the internal document type identifiers used throughout the system.
|
|
4
|
+
*/
|
|
5
|
+
export type LEGAL_DOCUMENT_TYPES = string
|
|
6
|
+
/**
|
|
7
|
+
* Document type constants.
|
|
8
|
+
* Defines all valid document types in the system.
|
|
9
|
+
*
|
|
10
|
+
* @module document-types.constants
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Document type enum values.
|
|
14
|
+
* These are the internal document type identifiers used throughout the system.
|
|
15
|
+
*
|
|
16
|
+
* @readonly
|
|
17
|
+
* @enum {string}
|
|
18
|
+
*/
|
|
19
|
+
export const LEGAL_DOCUMENT_TYPES: Readonly<{
|
|
20
|
+
RECEIPT: 'receipt'
|
|
21
|
+
TAX_INVOICE: 'tax_invoice'
|
|
22
|
+
CREDIT_INVOICE: 'credit_invoice'
|
|
23
|
+
PAYMENT_REQUEST: 'payment_request'
|
|
24
|
+
TAX_INVOICE_RECEIPT: 'tax_invoice_receipt'
|
|
25
|
+
}>
|
|
26
|
+
/**
|
|
27
|
+
* Document type enum values.
|
|
28
|
+
* These are the internal document type identifiers used throughout the system.
|
|
29
|
+
*/
|
|
30
|
+
export type OPERATIONAL_DOCUMENT_TYPES = string
|
|
31
|
+
/**
|
|
32
|
+
* Document type enum values.
|
|
33
|
+
* These are the internal document type identifiers used throughout the system.
|
|
34
|
+
*
|
|
35
|
+
* @readonly
|
|
36
|
+
* @enum {string}
|
|
37
|
+
*/
|
|
38
|
+
export const OPERATIONAL_DOCUMENT_TYPES: Readonly<{
|
|
39
|
+
ORDER: 'order'
|
|
40
|
+
QUOTE: 'quote'
|
|
41
|
+
INVOICE: 'invoice'
|
|
42
|
+
DELIVERY_NOTE: 'delivery_note'
|
|
43
|
+
PURCHASE_ORDER: 'purchase_order'
|
|
44
|
+
PROFORMA_INVOICE: 'proforma_invoice'
|
|
45
|
+
}>
|
|
46
|
+
/**
|
|
47
|
+
* Document type enum values.
|
|
48
|
+
* These are the internal document type identifiers used throughout the system.
|
|
49
|
+
*/
|
|
50
|
+
export type DOCUMENT_TYPES = string
|
|
51
|
+
/**
|
|
52
|
+
* Document type enum values.
|
|
53
|
+
* These are the internal document type identifiers used throughout the system.
|
|
54
|
+
*
|
|
55
|
+
* @readonly
|
|
56
|
+
* @enum {string}
|
|
57
|
+
*/
|
|
58
|
+
export const DOCUMENT_TYPES: Readonly<{
|
|
59
|
+
ORDER: 'order'
|
|
60
|
+
QUOTE: 'quote'
|
|
61
|
+
INVOICE: 'invoice'
|
|
62
|
+
DELIVERY_NOTE: 'delivery_note'
|
|
63
|
+
PURCHASE_ORDER: 'purchase_order'
|
|
64
|
+
PROFORMA_INVOICE: 'proforma_invoice'
|
|
65
|
+
RECEIPT: 'receipt'
|
|
66
|
+
TAX_INVOICE: 'tax_invoice'
|
|
67
|
+
CREDIT_INVOICE: 'credit_invoice'
|
|
68
|
+
PAYMENT_REQUEST: 'payment_request'
|
|
69
|
+
TAX_INVOICE_RECEIPT: 'tax_invoice_receipt'
|
|
70
|
+
}>
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export namespace DocumentTypes {
|
|
2
|
+
export { DOCUMENT_TYPES as ALL }
|
|
3
|
+
export { LEGAL_DOCUMENT_TYPES as LEGAL }
|
|
4
|
+
export { OPERATIONAL_DOCUMENT_TYPES as OPERATIONAL }
|
|
5
|
+
}
|
|
6
|
+
import { DOCUMENT_TYPES } from './document-types.js'
|
|
7
|
+
import { LEGAL_DOCUMENT_TYPES } from './document-types.js'
|
|
8
|
+
import { OPERATIONAL_DOCUMENT_TYPES } from './document-types.js'
|