@things-factory/integration-base 6.1.116 → 6.1.118

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.
@@ -58,6 +58,12 @@ END;
58
58
 
59
59
  ![procedure example1](./assets/../../../../assets/images/oracle-procedure-example1.png 'procedure example1')
60
60
 
61
+
62
+ ### 접근자 [accessor](../concept/data-accessor.md)
63
+
64
+ 설정 방법은 [JSONATA 도큐먼트](http://docs.jsonata.org/overview.html)를 따른다.
65
+
66
+
61
67
  ### 값
62
68
 
63
69
  파라미터가 입력(IN)일 경우, 해당 값을 지정한다.
@@ -65,6 +71,7 @@ END;
65
71
 
66
72
  위의 예어서 id의 입력 값을 ID라고 지정되어 있다면, ID 태스크에서 반환되는 값을 입력 값으로 지정한다.
67
73
 
74
+
68
75
  ### 최대 크기
69
76
 
70
77
  파라미터 타입이 String이나 Buffer 일 경우, 최대 크기를 지정한다. 다른 타입의 경우 값을 지정하지 않고 무시한다.
@@ -60,6 +60,12 @@ An example call specification is as follows
60
60
 
61
61
  ![procedure example1](./assets/../../../../assets/images/oracle-procedure-example1.png 'procedure example1')
62
62
 
63
+
64
+ # Accessor [accessor](../concept/data-accessor.md)
65
+
66
+ - Set when you want to propagate only a part of the data object of the source component or the transformed data.
67
+ - The setting method follows [JSONATA document](http://docs.jsonata.org/overview.html).
68
+
63
69
  ### Value(for Input)
64
70
 
65
71
  If the parameter is an input (IN), specify its value.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/integration-base",
3
- "version": "6.1.116",
3
+ "version": "6.1.118",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -26,12 +26,12 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@apollo/client": "^3.6.9",
29
- "@things-factory/api": "^6.1.116",
30
- "@things-factory/auth-base": "^6.1.116",
29
+ "@things-factory/api": "^6.1.118",
30
+ "@things-factory/auth-base": "^6.1.118",
31
31
  "@things-factory/env": "^6.1.116",
32
- "@things-factory/oauth2-client": "^6.1.116",
33
- "@things-factory/scheduler-client": "^6.1.116",
34
- "@things-factory/shell": "^6.1.116",
32
+ "@things-factory/oauth2-client": "^6.1.118",
33
+ "@things-factory/scheduler-client": "^6.1.118",
34
+ "@things-factory/shell": "^6.1.118",
35
35
  "async-mqtt": "^2.5.0",
36
36
  "chance": "^1.1.11",
37
37
  "cross-fetch": "^3.0.4",
@@ -46,5 +46,5 @@
46
46
  "devDependencies": {
47
47
  "@types/cron": "^2.0.1"
48
48
  },
49
- "gitHead": "4477d162a7008239bfd5f31dcfa879f59a2ad2ce"
49
+ "gitHead": "ea96bacb831bdc751bd1962a9d73a7d8abf0e304"
50
50
  }
@@ -10,7 +10,14 @@ try {
10
10
  logger.error('oracledb module loading failed')
11
11
  }
12
12
 
13
- type ProcedureParameterType = { name: string; dir: string; type: string; val: any; maxSize: number }
13
+ type ProcedureParameterType = {
14
+ name: string
15
+ dir: string
16
+ type: string
17
+ val?: any
18
+ accessor?: string
19
+ maxSize?: number
20
+ }
14
21
 
15
22
  const TYPES = {
16
23
  Number: oracledb.NUMBER,
@@ -48,20 +55,28 @@ async function OracleProcedure(step, context) {
48
55
 
49
56
  const procedureParameters =
50
57
  parameters &&
51
- parameters.reduce((sum, { name, val, dir, type, maxSize }) => {
58
+ parameters.reduce((sum, { name, val, dir, type, accessor, maxSize }) => {
52
59
  sum[name] = {
53
60
  dir: DIR[dir],
54
- type: TYPES[type],
55
- val: access(val, data),
56
- maxSize
61
+ type: TYPES[type]
62
+ }
63
+
64
+ const calculated = val !== undefined ? val : accessor ? access(accessor, data) : undefined
65
+
66
+ if (calculated !== undefined) {
67
+ sum[name].val =
68
+ type == 'Date'
69
+ ? new Date(calculated)
70
+ : type == 'Number'
71
+ ? Number(calculated)
72
+ : type == 'String'
73
+ ? String(calculated)
74
+ : calculated
57
75
  }
58
76
 
59
- // remove empty keys
60
- Object.keys(sum[name]).forEach(key => {
61
- if (!sum[name][key]) {
62
- delete sum[name][key]
63
- }
64
- })
77
+ if (maxSize) {
78
+ sum[name].maxSize = maxSize
79
+ }
65
80
 
66
81
  return sum
67
82
  }, {})