@rainbow-o23/n3 1.0.59 → 1.0.61

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/README.md CHANGED
@@ -492,10 +492,10 @@ Array<TypeOrmEntityToLoad>;
492
492
 
493
493
  ##### Environment Parameters
494
494
 
495
- | Name | Type | Default Value | Comments |
496
- |-----------------------------------|---------|---------------|----------------------------------------|
497
- | `typeorm.DB.fetch.size` | number | 20 | Fetch size. |
498
- | `typeorm.DB.stream.pause.enabled` | boolean | false | Pause and resume result stream or not. |
495
+ | Name | Type | Default Value | Comments |
496
+ |-----------------------------------|---------|---------------|-----------------------------------------------------------------------------------------------|
497
+ | `typeorm.DB.fetch.size` | number | 20 | Fetch size. |
498
+ | `typeorm.DB.stream.pause.enabled` | boolean | false | Pause and resume result stream or not. For Mysql, use default `false`. For Pgsql, use `true`. |
499
499
 
500
500
  ##### Constructor Parameters
501
501
 
package/index.cjs CHANGED
@@ -2401,46 +2401,34 @@ class TypeOrmLoadManyBySQLUseCursorPipelineStep extends AbstractTypeOrmBySQLPipe
2401
2401
  return await this.autoTrans(async (runner) => {
2402
2402
  const results = [];
2403
2403
  const rows = [];
2404
+ const fetchSize = this.getFetchSize();
2404
2405
  let cursorRound = 0;
2405
- const pipe = async ({ resolve, reject, end }) => {
2406
- if (!end && rows.length < this.getFetchSize()) {
2407
- return;
2406
+ const pipe = async ({ rows, end }) => {
2407
+ const contentForSub = await this._streamToFunc(rows, request, this.getHelpers(), this.getHelpers());
2408
+ let resultContent;
2409
+ if (this.getStepBuilders().length === 0) {
2410
+ resultContent = contentForSub;
2408
2411
  }
2409
- try {
2410
- const contentForSub = await this._streamToFunc([...rows], request, this.getHelpers(), this.getHelpers());
2411
- rows.length = 0;
2412
- let resultContent;
2413
- if (this.getStepBuilders().length === 0) {
2414
- resultContent = contentForSub;
2415
- }
2416
- else {
2417
- const sets = new PipelineStepSets({
2418
- ...this.buildStepOptions(), name: this.getName(), steps: this.getStepBuilders()
2419
- });
2420
- const { content: _, $context, ...rest } = request;
2421
- const contextForSub = $context.temporaryWith({
2422
- $typeOrmCursorRound: cursorRound, $typeOrmCursorEnd: end
2423
- });
2424
- const requestForSub = { ...rest, $context: contextForSub, content: contentForSub };
2425
- const result = await sets.perform(requestForSub);
2426
- const { content } = result;
2427
- resultContent = content;
2428
- }
2429
- cursorRound = cursorRound + 1;
2430
- if (resultContent == null || resultContent == n1.PIPELINE_STEP_RETURN_NULL) {
2431
- }
2432
- else if (Array.isArray(resultContent)) {
2433
- results.push(...resultContent);
2434
- }
2435
- else {
2436
- results.push(resultContent);
2437
- }
2412
+ else {
2413
+ const sets = new PipelineStepSets({
2414
+ ...this.buildStepOptions(), name: this.getName(), steps: this.getStepBuilders()
2415
+ });
2416
+ const { content: _, $context, ...rest } = request;
2417
+ const contextForSub = $context.temporaryWith({
2418
+ $typeOrmCursorRound: cursorRound, $typeOrmCursorEnd: end
2419
+ });
2420
+ const requestForSub = { ...rest, $context: contextForSub, content: contentForSub };
2421
+ const result = await sets.perform(requestForSub);
2422
+ const { content } = result;
2423
+ resultContent = content;
2438
2424
  }
2439
- catch (e) {
2440
- reject(e);
2425
+ cursorRound = cursorRound + 1;
2426
+ if (resultContent == null || resultContent == n1.PIPELINE_STEP_RETURN_NULL) ;
2427
+ else if (Array.isArray(resultContent)) {
2428
+ results.push(...resultContent);
2441
2429
  }
2442
- if (end) {
2443
- resolve(results);
2430
+ else {
2431
+ results.push(resultContent);
2444
2432
  }
2445
2433
  };
2446
2434
  const close = async (readable) => {
@@ -2452,9 +2440,26 @@ class TypeOrmLoadManyBySQLUseCursorPipelineStep extends AbstractTypeOrmBySQLPipe
2452
2440
  }
2453
2441
  };
2454
2442
  const read = async ({ resolve, reject }) => {
2443
+ const pipes = [];
2455
2444
  const readable = await runner.stream(sql, params, async () => {
2456
2445
  await close(readable);
2457
- await pipe({ resolve, reject, end: true });
2446
+ const data = [...rows];
2447
+ rows.length = 0;
2448
+ const last = async () => {
2449
+ try {
2450
+ await pipe({ rows: data, end: true });
2451
+ resolve(results);
2452
+ }
2453
+ catch (e) {
2454
+ reject(e);
2455
+ }
2456
+ };
2457
+ if (pipes.length !== 0) {
2458
+ pipes.push(last);
2459
+ }
2460
+ else {
2461
+ await last();
2462
+ }
2458
2463
  }, async (e) => {
2459
2464
  await close(readable);
2460
2465
  reject(e);
@@ -2464,12 +2469,28 @@ class TypeOrmLoadManyBySQLUseCursorPipelineStep extends AbstractTypeOrmBySQLPipe
2464
2469
  readable.pause();
2465
2470
  }
2466
2471
  rows.push(data);
2467
- await pipe({
2468
- resolve, reject: async (e) => {
2469
- await close(readable);
2470
- reject(e);
2471
- }, end: false
2472
- });
2472
+ if (rows.length < fetchSize) ;
2473
+ else {
2474
+ const data = [...rows];
2475
+ rows.length = 0;
2476
+ pipes.push(async () => {
2477
+ try {
2478
+ await pipe({ rows: data, end: false });
2479
+ }
2480
+ catch (e) {
2481
+ await close(readable);
2482
+ reject(e);
2483
+ return;
2484
+ }
2485
+ pipes.shift();
2486
+ if (pipes.length !== 0) {
2487
+ pipes[0]();
2488
+ }
2489
+ });
2490
+ if (pipes.length === 1) {
2491
+ await pipes[0]();
2492
+ }
2493
+ }
2473
2494
  if (this.isPauseStreamEnabled()) {
2474
2495
  readable.resume();
2475
2496
  }
package/index.js CHANGED
@@ -2399,46 +2399,34 @@ class TypeOrmLoadManyBySQLUseCursorPipelineStep extends AbstractTypeOrmBySQLPipe
2399
2399
  return await this.autoTrans(async (runner) => {
2400
2400
  const results = [];
2401
2401
  const rows = [];
2402
+ const fetchSize = this.getFetchSize();
2402
2403
  let cursorRound = 0;
2403
- const pipe = async ({ resolve, reject, end }) => {
2404
- if (!end && rows.length < this.getFetchSize()) {
2405
- return;
2404
+ const pipe = async ({ rows, end }) => {
2405
+ const contentForSub = await this._streamToFunc(rows, request, this.getHelpers(), this.getHelpers());
2406
+ let resultContent;
2407
+ if (this.getStepBuilders().length === 0) {
2408
+ resultContent = contentForSub;
2406
2409
  }
2407
- try {
2408
- const contentForSub = await this._streamToFunc([...rows], request, this.getHelpers(), this.getHelpers());
2409
- rows.length = 0;
2410
- let resultContent;
2411
- if (this.getStepBuilders().length === 0) {
2412
- resultContent = contentForSub;
2413
- }
2414
- else {
2415
- const sets = new PipelineStepSets({
2416
- ...this.buildStepOptions(), name: this.getName(), steps: this.getStepBuilders()
2417
- });
2418
- const { content: _, $context, ...rest } = request;
2419
- const contextForSub = $context.temporaryWith({
2420
- $typeOrmCursorRound: cursorRound, $typeOrmCursorEnd: end
2421
- });
2422
- const requestForSub = { ...rest, $context: contextForSub, content: contentForSub };
2423
- const result = await sets.perform(requestForSub);
2424
- const { content } = result;
2425
- resultContent = content;
2426
- }
2427
- cursorRound = cursorRound + 1;
2428
- if (resultContent == null || resultContent == PIPELINE_STEP_RETURN_NULL) {
2429
- }
2430
- else if (Array.isArray(resultContent)) {
2431
- results.push(...resultContent);
2432
- }
2433
- else {
2434
- results.push(resultContent);
2435
- }
2410
+ else {
2411
+ const sets = new PipelineStepSets({
2412
+ ...this.buildStepOptions(), name: this.getName(), steps: this.getStepBuilders()
2413
+ });
2414
+ const { content: _, $context, ...rest } = request;
2415
+ const contextForSub = $context.temporaryWith({
2416
+ $typeOrmCursorRound: cursorRound, $typeOrmCursorEnd: end
2417
+ });
2418
+ const requestForSub = { ...rest, $context: contextForSub, content: contentForSub };
2419
+ const result = await sets.perform(requestForSub);
2420
+ const { content } = result;
2421
+ resultContent = content;
2436
2422
  }
2437
- catch (e) {
2438
- reject(e);
2423
+ cursorRound = cursorRound + 1;
2424
+ if (resultContent == null || resultContent == PIPELINE_STEP_RETURN_NULL) ;
2425
+ else if (Array.isArray(resultContent)) {
2426
+ results.push(...resultContent);
2439
2427
  }
2440
- if (end) {
2441
- resolve(results);
2428
+ else {
2429
+ results.push(resultContent);
2442
2430
  }
2443
2431
  };
2444
2432
  const close = async (readable) => {
@@ -2450,9 +2438,26 @@ class TypeOrmLoadManyBySQLUseCursorPipelineStep extends AbstractTypeOrmBySQLPipe
2450
2438
  }
2451
2439
  };
2452
2440
  const read = async ({ resolve, reject }) => {
2441
+ const pipes = [];
2453
2442
  const readable = await runner.stream(sql, params, async () => {
2454
2443
  await close(readable);
2455
- await pipe({ resolve, reject, end: true });
2444
+ const data = [...rows];
2445
+ rows.length = 0;
2446
+ const last = async () => {
2447
+ try {
2448
+ await pipe({ rows: data, end: true });
2449
+ resolve(results);
2450
+ }
2451
+ catch (e) {
2452
+ reject(e);
2453
+ }
2454
+ };
2455
+ if (pipes.length !== 0) {
2456
+ pipes.push(last);
2457
+ }
2458
+ else {
2459
+ await last();
2460
+ }
2456
2461
  }, async (e) => {
2457
2462
  await close(readable);
2458
2463
  reject(e);
@@ -2462,12 +2467,28 @@ class TypeOrmLoadManyBySQLUseCursorPipelineStep extends AbstractTypeOrmBySQLPipe
2462
2467
  readable.pause();
2463
2468
  }
2464
2469
  rows.push(data);
2465
- await pipe({
2466
- resolve, reject: async (e) => {
2467
- await close(readable);
2468
- reject(e);
2469
- }, end: false
2470
- });
2470
+ if (rows.length < fetchSize) ;
2471
+ else {
2472
+ const data = [...rows];
2473
+ rows.length = 0;
2474
+ pipes.push(async () => {
2475
+ try {
2476
+ await pipe({ rows: data, end: false });
2477
+ }
2478
+ catch (e) {
2479
+ await close(readable);
2480
+ reject(e);
2481
+ return;
2482
+ }
2483
+ pipes.shift();
2484
+ if (pipes.length !== 0) {
2485
+ pipes[0]();
2486
+ }
2487
+ });
2488
+ if (pipes.length === 1) {
2489
+ await pipes[0]();
2490
+ }
2491
+ }
2471
2492
  if (this.isPauseStreamEnabled()) {
2472
2493
  readable.resume();
2473
2494
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainbow-o23/n3",
3
- "version": "1.0.59",
3
+ "version": "1.0.61",
4
4
  "description": "o23 pipelines",
5
5
  "main": "index.cjs",
6
6
  "module": "index.js",
@@ -21,9 +21,9 @@
21
21
  "url": "https://github.com/InsureMO/rainbow-o23/issues"
22
22
  },
23
23
  "dependencies": {
24
- "@rainbow-o23/n1": "1.0.59",
24
+ "@rainbow-o23/n1": "1.0.61",
25
25
  "node-fetch": "2.6.7",
26
- "typeorm": "^0.3.20",
26
+ "typeorm": "^0.3.28",
27
27
  "typescript": "5.5.4"
28
28
  },
29
29
  "devDependencies": {
@@ -42,7 +42,7 @@
42
42
  "better-sqlite3": "^11.5.0",
43
43
  "eslint": "^9.8.0",
44
44
  "mssql": "^11.0.1",
45
- "mysql2": "^3.11.4",
45
+ "mysql2": "^3.15.3",
46
46
  "oracledb": "^6.6.0",
47
47
  "pg": "^8.13.1",
48
48
  "pg-query-stream": "^4.7.1",
@@ -80,52 +80,39 @@ export class TypeOrmLoadManyBySQLUseCursorPipelineStep<In = PipelineStepPayload,
80
80
  return await this.autoTrans<OutFragment>(async (runner) => {
81
81
  const results = [];
82
82
  const rows = [];
83
+ const fetchSize = this.getFetchSize();
83
84
  let cursorRound = 0;
84
- const pipe = async ({resolve, reject, end}) => {
85
- if (!end && rows.length < this.getFetchSize()) {
86
- // not end, and size not meet the fresh required
87
- // do nothing, wait for next
88
- return;
89
- }
90
- try {
91
- // get data from cache
92
- const contentForSub = await this._streamToFunc([...rows], request, this.getHelpers(), this.getHelpers());
93
- // clear cache
94
- rows.length = 0;
95
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
96
- let resultContent: any;
97
- if (this.getStepBuilders().length === 0) {
98
- // no sub step, use content as result
99
- resultContent = contentForSub;
100
- } else {
101
- // create a step sets to run
102
- const sets = new PipelineStepSets({
103
- ...this.buildStepOptions(), name: this.getName(), steps: this.getStepBuilders()
104
- });
105
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
106
- const {content: _, $context, ...rest} = request;
107
- // pass a cursor end indicator to sub steps
108
- const contextForSub = $context.temporaryWith({
109
- $typeOrmCursorRound: cursorRound, $typeOrmCursorEnd: end
110
- });
111
- const requestForSub = {...rest, $context: contextForSub, content: contentForSub};
112
- const result = await sets.perform(requestForSub);
113
- const {content} = result;
114
- resultContent = content;
115
- }
116
- cursorRound = cursorRound + 1;
117
- if (resultContent == null || resultContent == PIPELINE_STEP_RETURN_NULL) {
118
- // ignore
119
- } else if (Array.isArray(resultContent)) {
120
- results.push(...resultContent);
121
- } else {
122
- results.push(resultContent);
123
- }
124
- } catch (e) {
125
- reject(e);
85
+ const pipe = async ({rows, end}) => {
86
+ // get data from cache
87
+ const contentForSub = await this._streamToFunc(rows, request, this.getHelpers(), this.getHelpers());
88
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
89
+ let resultContent: any;
90
+ if (this.getStepBuilders().length === 0) {
91
+ // no sub step, use content as result
92
+ resultContent = contentForSub;
93
+ } else {
94
+ // create a step sets to run
95
+ const sets = new PipelineStepSets({
96
+ ...this.buildStepOptions(), name: this.getName(), steps: this.getStepBuilders()
97
+ });
98
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
99
+ const {content: _, $context, ...rest} = request;
100
+ // pass a cursor end indicator to sub steps
101
+ const contextForSub = $context.temporaryWith({
102
+ $typeOrmCursorRound: cursorRound, $typeOrmCursorEnd: end
103
+ });
104
+ const requestForSub = {...rest, $context: contextForSub, content: contentForSub};
105
+ const result = await sets.perform(requestForSub);
106
+ const {content} = result;
107
+ resultContent = content;
126
108
  }
127
- if (end) {
128
- resolve(results);
109
+ cursorRound = cursorRound + 1;
110
+ if (resultContent == null || resultContent == PIPELINE_STEP_RETURN_NULL) {
111
+ // ignore
112
+ } else if (Array.isArray(resultContent)) {
113
+ results.push(...resultContent);
114
+ } else {
115
+ results.push(resultContent);
129
116
  }
130
117
  };
131
118
  const close = async (readable: ReadStream) => {
@@ -138,10 +125,27 @@ export class TypeOrmLoadManyBySQLUseCursorPipelineStep<In = PipelineStepPayload,
138
125
  }
139
126
  };
140
127
  const read = async ({resolve, reject}) => {
128
+ const pipes = [];
129
+
141
130
  const readable = await runner.stream(sql, params, async () => {
142
131
  // on end
143
132
  await close(readable);
144
- await pipe({resolve, reject, end: true});
133
+ const data = [...rows];
134
+ rows.length = 0;
135
+ const last = async () => {
136
+ try {
137
+ await pipe({rows: data, end: true});
138
+ resolve(results);
139
+ } catch (e) {
140
+ reject(e);
141
+ }
142
+ };
143
+ if (pipes.length !== 0) {
144
+ // there is not finished
145
+ pipes.push(last);
146
+ } else {
147
+ await last();
148
+ }
145
149
  }, async (e: Error) => {
146
150
  // on error
147
151
  await close(readable);
@@ -152,12 +156,32 @@ export class TypeOrmLoadManyBySQLUseCursorPipelineStep<In = PipelineStepPayload,
152
156
  readable.pause();
153
157
  }
154
158
  rows.push(data);
155
- await pipe({
156
- resolve, reject: async (e: Error) => {
157
- await close(readable);
158
- reject(e);
159
- }, end: false
160
- });
159
+ if (rows.length < fetchSize) {
160
+ // not end, and size not meet the fresh required
161
+ // do nothing, wait for next
162
+ } else {
163
+ const data = [...rows];
164
+ rows.length = 0;
165
+ pipes.push(async () => {
166
+ try {
167
+ await pipe({rows: data, end: false});
168
+ } catch (e) {
169
+ await close(readable);
170
+ reject(e);
171
+ return;
172
+ }
173
+ // drop the finished
174
+ pipes.shift();
175
+ // check there is more or not, if true, run the first one.
176
+ if (pipes.length !== 0) {
177
+ pipes[0]();
178
+ }
179
+ });
180
+ // if the only one, run it immediately
181
+ if (pipes.length === 1) {
182
+ await pipes[0]();
183
+ }
184
+ }
161
185
  if (this.isPauseStreamEnabled()) {
162
186
  readable.resume();
163
187
  }
@@ -1,4 +1,11 @@
1
- import {createConfig, createLogger, PipelineStep, PipelineStepBuilder, PipelineStepOptions} from '@rainbow-o23/n1';
1
+ import {
2
+ createConfig,
3
+ createLogger,
4
+ PipelineExecutionContext,
5
+ PipelineStep,
6
+ PipelineStepBuilder,
7
+ PipelineStepOptions
8
+ } from '@rainbow-o23/n1';
2
9
  import {ParallelPipelineStepSets, SnippetPipelineStep} from '../../src';
3
10
 
4
11
  const logger = createLogger();
@@ -19,7 +26,7 @@ test('Parallel Pipeline Step Test #1, + 100', async () => {
19
26
  }
20
27
  ]
21
28
  });
22
- const request = {content: {base: 1}};
29
+ const request = {content: {base: 1}, $context: new PipelineExecutionContext()};
23
30
  const response = await step.perform(request);
24
31
  expect(response.content).toEqual([100, 200]);
25
32
  });
@@ -1,4 +1,4 @@
1
- import {createConfig, createLogger} from '@rainbow-o23/n1';
1
+ import {createConfig, createLogger, PipelineExecutionContext} from '@rainbow-o23/n1';
2
2
  import {SnippetPipelineStep} from '../../src';
3
3
 
4
4
  const logger = createLogger();
@@ -7,7 +7,7 @@ const config = createConfig(logger);
7
7
  test('Snippet Pipeline Step Test #1, + 100', async () => {
8
8
  const snippet = 'return $factor.base + 100;';
9
9
  const step = new SnippetPipelineStep({config, logger, snippet});
10
- const request = {content: {base: 1}};
10
+ const request = {content: {base: 1}, $context: new PipelineExecutionContext()};
11
11
  const response = await step.perform(request);
12
12
  expect(response.content).toEqual(101);
13
13
  });
@@ -15,7 +15,7 @@ test('Snippet Pipeline Step Test #1, + 100', async () => {
15
15
  test('Snippet Pipeline Step Test #2, async + 100', async () => {
16
16
  const snippet = 'return await new Promise(resolve => resolve($factor.base + 100));';
17
17
  const step = new SnippetPipelineStep({config, logger, snippet});
18
- const request = {content: {base: 1}};
18
+ const request = {content: {base: 1}, $context: new PipelineExecutionContext()};
19
19
  const response = await step.perform(request);
20
20
  expect(response.content).toEqual(101);
21
21
  });
@@ -1,4 +1,4 @@
1
- import {createConfig, createLogger} from '@rainbow-o23/n1';
1
+ import {createConfig, createLogger, PipelineExecutionContext} from '@rainbow-o23/n1';
2
2
  import {SnowflakePipelineStep} from '../../src';
3
3
 
4
4
  const logger = createLogger();
@@ -6,7 +6,7 @@ const config = createConfig(logger);
6
6
 
7
7
  test('Snowflake Pipeline Step Test #1, replace content', async () => {
8
8
  const step = new SnowflakePipelineStep({config, logger, mergeRequest: '$id'});
9
- const request = {content: (void 0)};
9
+ const request = {content: (void 0), $context: new PipelineExecutionContext()};
10
10
  const response = await step.perform(request);
11
11
  expect(response.content).not.toBeNull();
12
12
  expect(response.content.$id).not.toBeNull();
@@ -14,7 +14,7 @@ test('Snowflake Pipeline Step Test #1, replace content', async () => {
14
14
 
15
15
  test('Snowflake Pipeline Step Test #2, merge content', async () => {
16
16
  const step = new SnowflakePipelineStep({config, logger, mergeRequest: '$id'});
17
- const request = {content: {base: 1}};
17
+ const request = {content: {base: 1}, $context: new PipelineExecutionContext()};
18
18
  const response = await step.perform(request);
19
19
  expect(response.content).not.toBeNull();
20
20
  expect(response.content.base).toEqual(1);
@@ -1,4 +1,4 @@
1
- import {createConfig, createLogger} from '@rainbow-o23/n1';
1
+ import {createConfig, createLogger, PipelineExecutionContext} from '@rainbow-o23/n1';
2
2
  import {TypeOrmDataSourceHelper, TypeOrmLoadManyBySQLUseCursorPipelineStep} from '../../src';
3
3
 
4
4
  const logger = createLogger();
@@ -44,7 +44,7 @@ describe('TypeORM Cursor Suite', () => {
44
44
  config, logger, dataSourceName: 'TEST', sql: 'SELECT * FROM T_O23_DB_CHANGE_LOG',
45
45
  autonomous: true
46
46
  });
47
- const request = {content: (void 0)};
47
+ const request = {content: (void 0), $context: new PipelineExecutionContext()};
48
48
  const response = await step.perform(request);
49
49
  expect(response.content).not.toBeNull();
50
50
  console.log(response.content);
@@ -1,4 +1,4 @@
1
- import {createConfig, createLogger} from '@rainbow-o23/n1';
1
+ import {createConfig, createLogger, PipelineExecutionContext} from '@rainbow-o23/n1';
2
2
  import {Column, Entity, PrimaryColumn} from 'typeorm';
3
3
  import {
4
4
  TypeOrmBulkSaveBySQLPipelineStep,
@@ -47,7 +47,7 @@ describe('TypeORM SQL Autonomous Suite', () => {
47
47
  config, logger, dataSourceName: 'TEST', sql: 'SELECT ID id, CONTENT content FROM T_TEST_TABLE WHERE ID = ?',
48
48
  autonomous: true
49
49
  });
50
- const request = {content: {params: [1]}};
50
+ const request = {content: {params: [1]}, $context: new PipelineExecutionContext()};
51
51
  const response = await step.perform(request);
52
52
  expect(response.content).not.toBeNull();
53
53
  expect(response.content.id).toBe(1);
@@ -60,7 +60,7 @@ describe('TypeORM SQL Autonomous Suite', () => {
60
60
  config, logger, dataSourceName: 'TEST', sql: 'INSERT INTO T_TEST_TABLE(ID, CONTENT) VALUES (?, ?)',
61
61
  autonomous: true, mergeRequest: 'id'
62
62
  });
63
- const request = {content: {values: [3, 'another world!']}};
63
+ const request = {content: {values: [3, 'another world!']}, $context: new PipelineExecutionContext()};
64
64
  const response = await step.perform(request);
65
65
  expect(response.content).not.toBeNull();
66
66
  expect(response.content.id).toBe(3);
@@ -72,7 +72,7 @@ describe('TypeORM SQL Autonomous Suite', () => {
72
72
  config, logger, dataSourceName: 'TEST', sql: 'UPDATE T_TEST_TABLE SET CONTENT = ? WHERE ID = ?',
73
73
  autonomous: true, mergeRequest: 'count'
74
74
  });
75
- const request = {content: {values: ['world #3!', 3]}};
75
+ const request = {content: {values: ['world #3!', 3]}, $context: new PipelineExecutionContext()};
76
76
  const response = await step.perform(request);
77
77
  expect(response.content).not.toBeNull();
78
78
  // DON'T KNOW WHY THIS IS 3, SEEMS SHOULD BE 1 ACCORDING TO BETTER-SQLITE3 DOCUMENT
@@ -89,7 +89,8 @@ describe('TypeORM SQL Autonomous Suite', () => {
89
89
  const request = {
90
90
  content: {
91
91
  items: [[4, 'world #4!'], [5, 'world #5!']]
92
- }
92
+ },
93
+ $context: new PipelineExecutionContext()
93
94
  };
94
95
  const response = await step.perform(request);
95
96
  expect(response.content).not.toBeNull();
@@ -104,7 +105,7 @@ describe('TypeORM SQL Autonomous Suite', () => {
104
105
  config, logger, dataSourceName: 'TEST', sql: 'SELECT ID id, CONTENT content FROM T_TEST_TABLE',
105
106
  autonomous: true
106
107
  });
107
- const request = {content: (void 0)};
108
+ const request = {content: (void 0), $context: new PipelineExecutionContext()};
108
109
  const response = await step.perform(request);
109
110
  expect(response.content).not.toBeNull();
110
111
  expect(Array.isArray(response.content)).toBeTruthy();
@@ -3,6 +3,7 @@ import {
3
3
  createConfig,
4
4
  createLogger,
5
5
  PipelineCode,
6
+ PipelineExecutionContext,
6
7
  PipelineStepData,
7
8
  PipelineStepType,
8
9
  Undefinable
@@ -201,7 +202,8 @@ describe('TypeORM SQL Transactional Suite', () => {
201
202
  item3ChangeTo: {id: 3, content: 'world #3!'},
202
203
  item4: {id: 4, content: 'world #4'},
203
204
  item5: {id: 5, content: 'world #5'}
204
- }
205
+ },
206
+ $context: new PipelineExecutionContext()
205
207
  });
206
208
  expect(response).not.toBeNull();
207
209
  });