@things-factory/document-template-base 8.0.0 → 9.0.0-beta.3
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/tsconfig.tsbuildinfo +1 -1
- package/package.json +5 -5
- package/server/constants/index.ts +0 -1
- package/server/constants/template-type.ts +0 -18
- package/server/controllers/index.ts +0 -1
- package/server/controllers/report-to-html.ts +0 -45
- package/server/index.ts +0 -5
- package/server/migrations/index.ts +0 -9
- package/server/routes.ts +0 -561
- package/server/service/doc-template/doc-template-mutation.ts +0 -120
- package/server/service/doc-template/doc-template-query.ts +0 -48
- package/server/service/doc-template/doc-template-type.ts +0 -80
- package/server/service/doc-template/doc-template.ts +0 -89
- package/server/service/doc-template/index.ts +0 -7
- package/server/service/index.ts +0 -25
- package/server/service/template-file/index.ts +0 -7
- package/server/service/template-file/template-file-mutation.ts +0 -117
- package/server/service/template-file/template-file-query.ts +0 -54
- package/server/service/template-file/template-file-type.ts +0 -73
- package/server/service/template-file/template-file.ts +0 -93
- package/server/templates/Invoice.jrxml +0 -392
- package/server/templates/response.xlsx +0 -0
- package/server/templates/template-java.xlsx +0 -0
- package/server/templates/template1.xls +0 -0
- package/server/templates/template1.xlsx +0 -0
- package/server/templates/template2.xlsx +0 -0
- package/server/templates/template3.xls +0 -0
- package/server/templates/template3.xlsx +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@things-factory/document-template-base",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "9.0.0-beta.3",
|
|
4
4
|
"main": "dist-server/index.js",
|
|
5
5
|
"browser": "client/index.js",
|
|
6
6
|
"things-factory": true,
|
|
@@ -24,11 +24,11 @@
|
|
|
24
24
|
"migration:create": "node ../../node_modules/typeorm/cli.js migration:create ./server/migrations/migration"
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@things-factory/auth-base": "^
|
|
28
|
-
"@things-factory/env": "^8.0.0",
|
|
29
|
-
"@things-factory/shell": "^
|
|
27
|
+
"@things-factory/auth-base": "^9.0.0-beta.3",
|
|
28
|
+
"@things-factory/env": "^8.0.0-beta.4",
|
|
29
|
+
"@things-factory/shell": "^9.0.0-beta.0",
|
|
30
30
|
"form-data": "^3.0.0",
|
|
31
31
|
"node-fetch": "^2.6.0"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "1d7e0dd4c88f3c3f3bd311c00e4b1d1542d53634"
|
|
34
34
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './template-type'
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
export const TEMPLATE_TYPES = {
|
|
2
|
-
GRN_TEMPLATE: {
|
|
3
|
-
name: 'grn_template',
|
|
4
|
-
value: 'GRN_TEMPLATE'
|
|
5
|
-
},
|
|
6
|
-
DO_TEMPLATE: {
|
|
7
|
-
name: 'do_template',
|
|
8
|
-
value: 'DO_TEMPLATE'
|
|
9
|
-
},
|
|
10
|
-
CO_TEMPLATE: {
|
|
11
|
-
name: 'co_template',
|
|
12
|
-
value: 'CO_TEMPLATE'
|
|
13
|
-
},
|
|
14
|
-
INVOICE_TEMPLATE: {
|
|
15
|
-
name: 'invoice_template',
|
|
16
|
-
value: 'INVOICE_TEMPLATE'
|
|
17
|
-
}
|
|
18
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './report-to-html'
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { config } from '@things-factory/env'
|
|
2
|
-
import FormData from 'form-data'
|
|
3
|
-
import fs from 'fs'
|
|
4
|
-
import fetch from 'node-fetch'
|
|
5
|
-
|
|
6
|
-
const REPORT_API_URL = config.get('reportApiUrl', 'http://localhost:8888/rest/report/show_html')
|
|
7
|
-
|
|
8
|
-
type report2htmlInput = {
|
|
9
|
-
reportFile: String | fs.ReadStream
|
|
10
|
-
data: Object
|
|
11
|
-
isFile?: Boolean
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export async function report2html({ reportFile, data = {}, isFile }: report2htmlInput) {
|
|
15
|
-
const formData = new FormData()
|
|
16
|
-
|
|
17
|
-
formData.append('template', reportFile)
|
|
18
|
-
formData.append('jsonString', JSON.stringify(data))
|
|
19
|
-
if (isFile) formData.append('isFile', isFile)
|
|
20
|
-
|
|
21
|
-
const response = await fetch(REPORT_API_URL, {
|
|
22
|
-
method: 'POST',
|
|
23
|
-
body: formData
|
|
24
|
-
})
|
|
25
|
-
|
|
26
|
-
return await response.text()
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export async function reportPath2html({ reportFilePath, data = {} }) {
|
|
30
|
-
const reportFileStream = fs.createReadStream(reportFilePath)
|
|
31
|
-
|
|
32
|
-
return await report2html({ reportFile: reportFileStream, data, isFile: true })
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export async function reportUrl2html({ reportUrl, data = {} }) {
|
|
36
|
-
const response = await fetch(reportUrl)
|
|
37
|
-
|
|
38
|
-
const xml = await response.text()
|
|
39
|
-
|
|
40
|
-
return await report2html({ reportFile: xml, data })
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export async function reportString2html({ reportTemplateString, data = {} }) {
|
|
44
|
-
return await report2html({ reportFile: reportTemplateString, data })
|
|
45
|
-
}
|
package/server/index.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
const glob = require('glob')
|
|
2
|
-
const path = require('path')
|
|
3
|
-
|
|
4
|
-
export var migrations = []
|
|
5
|
-
|
|
6
|
-
glob.sync(path.resolve(__dirname, '.', '**', '*.js')).forEach(function(file) {
|
|
7
|
-
if (file.indexOf('index.js') !== -1) return
|
|
8
|
-
migrations = migrations.concat(Object.values(require(path.resolve(file))) || [])
|
|
9
|
-
})
|