@things-factory/integration-base 6.1.119 → 6.1.123

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.
@@ -5,16 +5,21 @@ Oracle 데이터베이스에 저장되어 있는 프로시저를 호출하는
5
5
 
6
6
  ## Parameters
7
7
 
8
- ### 프로시저
9
- - 프로시저를 호출하는 함수부를 작성한다. 작성 시에 BEGIN과 END는 실제 내부에서 추가되기 때문에 별도로 지정할 필요가 없다.
10
- - 호출 이후에 ;을 추가해야 한다.
11
- - 프로시저의 입출력 파라미터는 :과 함께 사용한다.
12
- - 프로시저 작성 예는 다음과 같다.
13
-
14
- ```sql
8
+ ### 프로시저 코드
9
+ - 프로시저 코드는 *프로시저 이름*과 *파라미터*에 의해서 자동으로 생성되는 코드로서, 별도로 사용자가 입력할 필요는 없다.
10
+ - 만약, 프로시저의 이름이 *mcs.myproc*이고, 파라미터가 *id*와 *out_name*으로 구성된다면, 다음과 같이 표현된다.
11
+ ```text
15
12
  mcs.myproc(:id, :out_name);
16
13
  ```
17
14
 
15
+ ### 프로시저 이름
16
+ - 프로시저의 이름을 지정한다.
17
+ - 프로시저가 패키지나 사용자 이름등으로 구분이 필요할 경우 '.'을 통해서 구분한다.
18
+ - 사용 예.
19
+ ```text
20
+ mcs.myproc
21
+ ```
22
+
18
23
  ### 파라미터
19
24
  - 파라미터는 다음과 같은 요소로 구성되어 있다.
20
25
  - 파라미터 이름
@@ -101,7 +106,6 @@ BEGIN
101
106
  SELECT * FROM FARMWEATHER WHERE rownum <= 1000;
102
107
  END;
103
108
  END PROCEDURE1;
104
-
105
109
  ```
106
110
 
107
111
  ### 프로시저 호출 예
@@ -1,48 +1,51 @@
1
1
  # Oracle Procedure Task
2
2
 
3
- A task that calls a procedure stored in an Oracle database,
4
- Depending on the individual data type, it returns a list of data or a value of a specific data type.
3
+ A task that calls a procedure stored in the Oracle database,
4
+ It returns a list of data or a value of a specific data type, depending on the individual data type.
5
5
 
6
6
  ## Parameters
7
7
 
8
- ### Procedure
9
- - Write a function that calls the procedure. You don't need to specify BEGIN and END at the time of writing because they are actually added internally.
10
- - You need to add ;after the call.
11
- - The input and output parameters of a procedure are used with :.
12
- - An example of writing a procedure is as follows
13
-
14
- ```sql
8
+ ### Procedure Code
9
+ - The procedure code is the code that is automatically generated by the *procedure name* and *parameters* and does not need to be entered by the user.
10
+ - If a procedure is named *mcs.myproc* and the parameters consist of *id* and *out_name*, it would look like this
11
+ ```text
15
12
  mcs.myproc(:id, :out_name);
16
13
  ```
17
14
 
15
+ ### Procedure Name
16
+ - Specifies the name of the procedure.
17
+ - If the procedure needs to be separated by a package or user name, use a '.' to separate them.
18
+ - Example.
19
+ ```text
20
+ mcs.myproc
21
+ ```text mcs.myproc
22
+
18
23
  ### Parameters
19
24
  - A parameter consists of the following elements
20
- - The parameter name
25
+ - A parameter name
21
26
  - Input/output designation: IN, INOUT, OUT
22
27
  - Parameter type: String, Number, Date, Cursor
23
28
  - Value: If the variable is an input, the value for that input.
24
- - MaxSize: If the variable is of type String or Buffer, specifies the maximum size of the variable.
29
+ - MaxSize: If the variable is of type String or Buffer, the maximum size of the variable.
25
30
 
26
- #### Paramter name
31
+ #### Parameter names
27
32
 
28
- Parameter name specifies the name of the parameter used in the procedure.
33
+ The parameter name specifies the name of the parameter used in the procedure.
29
34
  For the previous example,
30
-
31
35
  ```sql
32
36
  mcs.myproc(:id, :out_name);
33
37
  ```
38
+ id and out_name are the parameter names.
34
39
 
35
- id and out_name are the parameter names, respectively.
40
+ ### Specifying input and output
36
41
 
37
- ### In/Out Type
42
+ Specifies whether the variable is input (IN) or output (OUT).
38
43
 
39
- Specifies whether the variable is an input (IN) or output (OUT).
44
+ ### parameter type
40
45
 
41
- ### Paramter type
46
+ Specifies the type of the parameter. The type must be the same as the name specified in the actual procedure creation.
42
47
 
43
- Specifies the parameter type. The type must be the same as the name given to the actual procedure when it is created.
44
-
45
- If the procedure is implemented as follows,
48
+ If the procedure is implemented like this
46
49
 
47
50
  ```sql
48
51
  CREATE OR REPLACE NONEDITIONABLE PROCEDURE myproc (in_id IN VARCHAR2, out_name OUT VARCHAR2) AS
@@ -51,35 +54,36 @@ BEGIN
51
54
  END;
52
55
  ```
53
56
 
54
- Both the first and second parameters are specified as VARCHAR2,
57
+ Note that both the first and second parameters are specified as VARCHAR2,
55
58
 
56
- If you need to call these procedures, the parameter types should all be String,
59
+ If you need to call these procedures, the parameter types must be specified as String,
57
60
  For the output, the maximum size should be specified.
58
61
 
59
62
  An example call specification is as follows
60
63
 
61
- ![procedure example1](./assets/../../../../assets/images/oracle-procedure-example1.png 'procedure example1')
64
+ ![procedure example1](./assets/../../../../../assets/images/oracle-procedure-example1.png 'procedure example1')
65
+
62
66
 
67
+ ### Accessor [accessor](../concept/data-accessor.md)
63
68
 
64
- # Accessor [accessor](../concept/data-accessor.md)
69
+ Follow the [JSONATA documentation](http://docs.jsonata.org/overview.html) for configuration.
65
70
 
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
71
 
69
- ### Value(for Input)
72
+ ### Value
70
73
 
71
74
  If the parameter is an input (IN), specify its value.
72
- Do not enter a constant value directly into the value, but rather specify a specific task name.
75
+ Do not enter a constant value directly into the value, but specify a specific task name.
73
76
 
74
- In the example above, if the input value for id is specified as ID, specify the value returned by the ID task as the input value.
77
+ In the example above, if the input value of id is specified as ID, specify the value returned by the ID task as the input value.
75
78
 
76
- ### Maxsize
77
79
 
78
- If the parameter type is String or Buffer, specify the maximum size. For other types, no value is specified and it is ignored.
80
+ ### Maximum size
81
+
82
+ If the parameter type is String or Buffer, specify the maximum size. For other types, do not specify a value and ignore it.
79
83
 
80
84
  ## Task Result
81
85
 
82
- The result of a procedure call is returned as an Object, where the name of the parameter specified as output is the key, and the value is returned.
86
+ The result of the procedure call is returned in the form of an Object, and the parameter name specified as the output is the key and returns the value.
83
87
 
84
88
  For example, the task introduced above returns the following result value.
85
89
 
@@ -90,26 +94,25 @@ For example, the task introduced above returns the following result value.
90
94
  ```
91
95
 
92
96
 
93
- ## Another Example(using cursor)
97
+ ## Other usage examples (cursor)
94
98
 
95
- ### Procedure using cursor parameter
99
+ ### Example of writing a procedure
96
100
 
97
101
  ```sql
98
- CREATE OR REPLACDE NONEDITIONABLE PROCEDURE PROCEDURE1(out_cursor OUT SYS_REFCURSOR) AS
102
+ CREATE OR REPLACE NONEDITIONABLE PROCEDURE PROCEDURE1(out_cursor OUT SYS_REFCURSOR) AS
99
103
  BEGIN
100
104
  BEGIN
101
105
  OPEN out_cursor FOR
102
106
  SELECT * FROM FARMWEATHER WHERE rownum <= 1000;
103
107
  END;
104
108
  END PROCEDURE1;
105
-
106
109
  ```
107
110
 
108
- ### Task example to call the procedure using a cursor as an output
111
+ ### Example of calling a procedure
109
112
 
110
- ![procedure example2](./assets/../../../../assets/images/oracle-procedure-example2.png 'procedure example2')
113
+ ![procedure example2](./assets/../../../../../assets/images/oracle-procedure-example2.png 'procedure example2')
111
114
 
112
- ### Task result
115
+ ### Procedure task call result
113
116
 
114
117
  ```javascript
115
118
  {
@@ -133,4 +136,4 @@ END PROCEDURE1;
133
136
  ...
134
137
  ]
135
138
  }
136
- ```
139
+ ```
@@ -0,0 +1,139 @@
1
+ # Tugas Prosedur Oracle
2
+
3
+ Tugas ini memanggil prosedur yang disimpan dalam pangkalan data Oracle,
4
+ dan mengembalikan senarai data atau nilai jenis data tertentu bergantung pada jenis data individu.
5
+
6
+ ## Parameter
7
+
8
+ ### Kod Prosedur
9
+ - Kod prosedur adalah kod yang dihasilkan secara automatik oleh *nama prosedur* dan *parameter*, dan pengguna tidak perlu memasukkannya secara berasingan.
10
+ - Jika nama prosedur adalah *mcs.myproc* dan parameter terdiri daripada *id* dan *out_name*, ia akan dinyatakan seperti berikut.
11
+ ```text
12
+ mcs.myproc(:id, :out_name);
13
+ ```
14
+
15
+ ### Nama Prosedur
16
+ - Tentukan nama prosedur.
17
+ - Jika prosedur perlu dibezakan dengan nama pakej atau pengguna, dll., ia dibezakan dengan '.'.
18
+ - Contoh penggunaan.
19
+ ```text
20
+ mcs.myproc
21
+ ```
22
+
23
+ ### Parameter
24
+ - Parameter terdiri daripada elemen-elemen berikut.
25
+ - Nama parameter
26
+ - Penentuan input / output: IN, INOUT, OUT
27
+ - Jenis parameter: String, Number, Date, Cursor
28
+ - Nilai: Jika pemboleh ubah itu adalah input, nilai untuk input itu
29
+ - Saiz maksimum: Jika jenis pemboleh ubah adalah String atau Buffer, tentukan saiz maksimum pemboleh ubah.
30
+
31
+ #### Nama Parameter
32
+
33
+ Nama parameter menentukan nama parameter yang digunakan semasa membuat prosedur.
34
+ Dalam contoh di atas,
35
+ ```sql
36
+ mcs.myproc(:id, :out_name);
37
+ ```
38
+ id dan out_name adalah nama parameter masing-masing.
39
+
40
+ ### Penentuan Input / Output
41
+
42
+ Tentukan sama ada pemboleh ubah itu adalah input (IN) atau output (OUT).
43
+
44
+ ### Jenis Parameter
45
+
46
+ Tentukan jenis parameter. Jenis harus ditentukan sama dengan nama yang ditentukan semasa membuat prosedur sebenar.
47
+
48
+ Jika prosedur diimplementasikan seperti berikut,
49
+
50
+ ```sql
51
+ CREATE OR REPLACE NONEDITIONABLE PROCEDURE myproc (in_id IN VARCHAR2, out_name OUT VARCHAR2) AS
52
+ BEGIN
53
+ SELECT name INTO out_name FROM MCS.FMB_USERS WHERE id = in_id ;
54
+ END;
55
+ ```
56
+
57
+ Parameter pertama dan kedua kedua-duanya ditentukan sebagai VARCHAR2,
58
+
59
+ Jika anda perlu memanggil prosedur seperti itu, anda harus menentukan semua jenis parameter sebagai String,
60
+ dan dalam kes output, anda juga harus menentukan saiz maksimum.
61
+
62
+ Contoh penentuan panggilan adalah seperti berikut.
63
+
64
+ ![contoh prosedur1](./assets/../../../../assets/images/oracle-procedure-example1.png 'contoh prosedur1')
65
+
66
+
67
+ ### Akses [accessor](../concept/data-accessor.md)
68
+
69
+ Cara menetapkan mengikuti [dokumen JSONATA](http://docs.jsonata.org/overview.html).
70
+
71
+
72
+ ### Nilai
73
+
74
+ Jika parameter adalah input (IN), tentukan nilainya.
75
+ Alih-alih memasukkan nilai konstan secara langsung ke dalam nilai ini, tentukan nama tugas tertentu.
76
+
77
+ Dalam contoh di atas, jika nilai input untuk id ditetapkan sebagai ID, nilai yang dikembalikan oleh tugas ID ditetapkan sebagai nilai input.
78
+
79
+
80
+ ### Saiz Maksimum
81
+
82
+ Jika jenis parameter adalah String atau Buffer, tentukan saiz maksimum. Untuk jenis lain, abaikan nilai yang tidak ditentukan.
83
+
84
+ ## Hasil Tugas
85
+
86
+ Hasil panggilan prosedur dikembalikan dalam bentuk Objek, dan nama parameter yang ditetapkan sebagai output menjadi kunci untuk mengembalikan nilainya.
87
+
88
+ Jika tugas yang diperkenalkan di atas mengembalikan hasil seperti berikut.
89
+
90
+ ```javascript
91
+ {
92
+ out_name: 'Admin'
93
+ }
94
+ ```
95
+
96
+
97
+ ## Contoh Penggunaan Lain (Kursor)
98
+
99
+ ### Contoh Pembuatan Prosedur
100
+
101
+ ```sql
102
+ CREATE OR REPLACDE NONEDITIONABLE PROCEDURE PROCEDURE1(out_cursor OUT SYS_REFCURSOR) AS
103
+ BEGIN
104
+ BEGIN
105
+ OPEN out_cursor FOR
106
+ SELECT * FROM FARMWEATHER WHERE rownum <= 1000;
107
+ END;
108
+ END PROCEDURE1;
109
+ ```
110
+
111
+ ### Contoh Panggilan Prosedur
112
+
113
+ ![contoh prosedur2](./assets/../../../../assets/images/oracle-procedure-example2.png 'contoh prosedur2')
114
+
115
+ ### Hasil Panggilan Tugas Prosedur
116
+
117
+ ```javascript
118
+ {
119
+ "out_cursor": [
120
+ {
121
+ "FARMDATE": "2006-01-07T15:00:00.000Z",
122
+ "MAXT": 29.5,
123
+ "MINT": 21.8,
124
+ "WINDSPEED": 1.6,
125
+ "FARMHUM": 70.2,
126
+ "PRECIPITATION": 0
127
+ },
128
+ {
129
+ "FARMDATE": "2006-01-08T15:00:00.000Z",
130
+ "MAXT": 30.1,
131
+ "MINT": 21,
132
+ "WINDSPEED": 1.6,
133
+ "FARMHUM": 67.4,
134
+ "PRECIPITATION": 0
135
+ },
136
+ ..
137
+ ]
138
+ }
139
+ ```
@@ -0,0 +1,141 @@
1
+ # Oracle 存储过程任务
2
+
3
+ 调用 Oracle 数据库中存储的存储过程的任务、
4
+ 它根据数据类型返回数据列表或特定数据类型的值。
5
+
6
+ ### 参数
7
+
8
+ ### 过程代码
9
+ - 存储过程代码是由*存储过程名称*和*参数*自动生成的代码,用户无需输入。
10
+ - 例如,如果存储过程的名称为 *mcs.myproc*,参数为 *id* 和 *out_name*,那么存储过程代码将如下所示
11
+ ```文本
12
+ mcs.myproc(:id, :out_name);
13
+ ```
14
+
15
+ ### 存储过程名称
16
+ - 指定存储过程的名称。
17
+ - 如果存储过程需要用包或用户名分隔,请使用". "分隔。
18
+ - 例如
19
+ 文本
20
+ mcs.myproc
21
+ 文本 mcs.myproc
22
+
23
+ ### 参数
24
+ - 参数由以下元素组成
25
+ - 参数名称
26
+ - 输入/输出名称:IN、INOUT、OUT
27
+ - 参数类型:字符串、数字、日期、光标
28
+ - 值:如果变量是输入,则是该输入的值。
29
+ - MaxSize:如果变量是字符串或缓冲区类型,则为变量的最大大小。
30
+
31
+ #### 参数名称
32
+
33
+ 参数名指定存储过程中使用的参数名称。
34
+ 例如
35
+ ``sql
36
+ mcs.myproc(:id, :out_name);
37
+ ```
38
+ id 和 out_name 是参数名。
39
+
40
+ ### 指定输入和输出
41
+
42
+ 指定变量是输入(IN)还是输出(OUT)。
43
+
44
+ ### 参数类型
45
+
46
+ 指定参数的类型。类型必须与实际创建存储过程时指定的名称相同。
47
+
48
+ 如果存储过程以
49
+
50
+ 存储过程
51
+ CREATE OR REPLACE NONEDITIONABLE PROCEDURE myproc (in_id IN VARCHAR2, out_name OUT VARCHAR2) AS
52
+ 开始
53
+ SELECT name INTO out_name FROM MCS.FMB_USERS WHERE id = in_id ;
54
+ 结束;
55
+ ```
56
+
57
+ 请注意,第一个和第二个参数都指定为 VARCHAR2、
58
+
59
+ 如果需要调用这些存储过程,必须将参数类型指定为字符串、
60
+ 对于输出,必须指定最大大小。
61
+
62
+ 调用说明示例如下
63
+
64
+ [存储过程 example1](./assets/././././././././assets/images/oracle-procedure-example1.png '存储过程 example1')
65
+
66
+
67
+ ### Accessor [accessor](../concept/data-accessor.md)
68
+
69
+ 按照 [JSONATA 文档](http://docs.jsonata.org/overview.html) 进行配置。
70
+
71
+
72
+ ### 值
73
+
74
+ 如果参数是输入(IN),请指定其值。
75
+ 不要直接在值中输入常量,而应指定具体的任务名称。
76
+
77
+ 在上例中,如果 id 的输入值指定为 ID,则指定 ID 任务返回的值作为输入值。
78
+
79
+
80
+ ### 最大大小
81
+
82
+ 如果参数类型为字符串或缓冲区,请指定最大大小。对于其他类型,请不要指定值,并忽略它。
83
+
84
+ ### 任务结果
85
+
86
+ 存储过程调用的结果以对象的形式返回,指定为输出的参数名称是关键字,并返回值。
87
+
88
+ 例如,上面介绍的任务会返回以下结果值。
89
+
90
+ ```javascript
91
+ }
92
+ out_name: 'Admin
93
+ }
94
+ ```
95
+
96
+
97
+ ### 其他使用示例(光标)
98
+
99
+ ### 编写存储过程的示例
100
+
101
+ ``sql
102
+ CREATE OR REPLACE NONEDITIONABLE PROCEDURE PROCEDURE1(out_cursor OUT SYS_REFCURSOR) AS
103
+ 开始
104
+ 开始
105
+ 打开 out_cursor FOR
106
+ SELECT * FROM FARMWEATHER WHERE rownum <= 1000;
107
+ 结束;
108
+ 结束过程1;
109
+ ```
110
+
111
+ ### 调用存储过程的示例
112
+
113
+ ![存储过程 example2](./assets/././././././././assets/images/oracle-procedure-example2.png'存储过程 example2')
114
+
115
+ ### 程序任务调用结果
116
+
117
+ ```javascript
118
+ { }
119
+ "out_cursor": [].
120
+ {
121
+ "FARMDATE": "2006-01-07T15:00:00.000Z",
122
+ "MAXT": 29.5,
123
+ "MINT": 21.8,
124
+ "WINDSPEED": 1.6,
125
+ "FARMHUM": 70: 70.2,
126
+ "降水量": 0 0
127
+ },
128
+ {
129
+ "FARMDATE": "2006-01-08T15:00:00.000Z",
130
+ "MAXT": 30.1,
131
+ "MINT": 21,
132
+ "WINDSPEED": 1.6,
133
+ "FARMHUM": 67: 67.4,
134
+ "precipitation": 0 0
135
+ },
136
+ ...
137
+ ]
138
+ }
139
+ ```
140
+
141
+ 通过www.DeepL.com/Translator(免费版)翻译
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@things-factory/integration-base",
3
- "version": "6.1.119",
3
+ "version": "6.1.123",
4
4
  "main": "dist-server/index.js",
5
5
  "browser": "client/index.js",
6
6
  "things-factory": true,
@@ -26,11 +26,11 @@
26
26
  },
27
27
  "dependencies": {
28
28
  "@apollo/client": "^3.6.9",
29
- "@things-factory/api": "^6.1.118",
30
- "@things-factory/auth-base": "^6.1.118",
29
+ "@things-factory/api": "^6.1.123",
30
+ "@things-factory/auth-base": "^6.1.123",
31
31
  "@things-factory/env": "^6.1.116",
32
- "@things-factory/oauth2-client": "^6.1.118",
33
- "@things-factory/scheduler-client": "^6.1.118",
32
+ "@things-factory/oauth2-client": "^6.1.123",
33
+ "@things-factory/scheduler-client": "^6.1.123",
34
34
  "@things-factory/shell": "^6.1.118",
35
35
  "async-mqtt": "^2.5.0",
36
36
  "chance": "^1.1.11",
@@ -46,5 +46,5 @@
46
46
  "devDependencies": {
47
47
  "@types/cron": "^2.0.1"
48
48
  },
49
- "gitHead": "a3729089483f19175214666ef9959ad88328d4a6"
49
+ "gitHead": "b1440f932f519e74aca05dabf2dd7f6690fcb3cf"
50
50
  }
@@ -19,6 +19,12 @@ type ProcedureParameterType = {
19
19
  maxSize?: number
20
20
  }
21
21
 
22
+ type ValueType = {
23
+ code?: string
24
+ procedure?: string
25
+ parameters?: ProcedureParameterType[]
26
+ }
27
+
22
28
  const TYPES = {
23
29
  Number: oracledb?.NUMBER,
24
30
  String: oracledb?.STRING,
@@ -39,7 +45,7 @@ async function OracleProcedure(step, context) {
39
45
  var { domain, data, variables } = context
40
46
  var { connection: connectionName, params } = step
41
47
 
42
- var { procedure, parameters } = params as { procedure: string; parameters: ProcedureParameterType[] }
48
+ var { code = '', parameters = [] } = params.parameters as ValueType
43
49
 
44
50
  var dbconnection = ConnectionManager.getConnectionInstanceByName(domain, connectionName)
45
51
 
@@ -51,7 +57,11 @@ async function OracleProcedure(step, context) {
51
57
  }
52
58
  })
53
59
 
54
- procedure = vm.run('`' + procedure + '`')
60
+ if (!code) {
61
+ throw 'procedure code not defined'
62
+ }
63
+
64
+ code = vm.run('`' + code + '`')
55
65
 
56
66
  const procedureParameters =
57
67
  parameters &&
@@ -81,7 +91,7 @@ async function OracleProcedure(step, context) {
81
91
  return sum
82
92
  }, {})
83
93
 
84
- const result = await dbconnection.execute(procedure, procedureParameters)
94
+ const result = await dbconnection.execute(code, procedureParameters)
85
95
 
86
96
  var taskResult = {}
87
97
  let paramKeys = Object.keys(procedureParameters)
@@ -106,15 +116,10 @@ async function OracleProcedure(step, context) {
106
116
  }
107
117
 
108
118
  OracleProcedure.parameterSpec = [
109
- {
110
- type: 'textarea',
111
- name: 'procedure',
112
- label: 'procedure'
113
- },
114
119
  {
115
120
  type: 'procedure-parameters',
116
121
  name: 'parameters',
117
- label: 'params'
122
+ label: ''
118
123
  }
119
124
  ]
120
125