@rainbow-o23/n3 1.0.48 → 1.0.49

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
@@ -398,44 +398,6 @@ Autonomous transactions take precedence over the transaction name, meaning that
398
398
  specified by the transaction name will be ignored. If you need to use the transaction name, you must nest the pipeline steps within
399
399
  transactional step sets, and ensure that the datasource name and transaction name remain the same.
400
400
 
401
- ### By Entity (Deprecated, not recommended)
402
-
403
- #### Load Entity by ID
404
-
405
- ##### Constructor Parameters
406
-
407
- | Name | Type | Default Value | Comments |
408
- |------------|--------|---------------|----------------------|
409
- | entityName | string | | TypeOrm entity name. |
410
-
411
- ##### Request and Response
412
-
413
- ```typescript
414
- // request
415
- export type TypeOrmIdType = string | number | bigint;
416
- // response
417
- export type TypeOrmEntityToLoad = Undefinable<DeepPartial<ObjectLiteral>>;
418
- ```
419
-
420
- #### Save Entity
421
-
422
- ##### Constructor Parameters
423
-
424
- | Name | Type | Default Value | Comments |
425
- |------------------------|----------------------------------------|---------------|----------------------|
426
- | entityName | string | | TypeOrm entity name. |
427
- | fillIdBySnowflake | boolean | false | |
428
- | uniquenessCheckSnippet | ScriptFuncOrBody\<UniquenessCheckFunc> | | |
429
-
430
- ##### Request and Response
431
-
432
- ```typescript
433
- // request
434
- export type EntityToSave = DeepPartial<ObjectLiteral>;
435
- // response
436
- export type EntityToSave = DeepPartial<ObjectLiteral>;
437
- ```
438
-
439
401
  ### By SQL
440
402
 
441
403
  #### Environment Parameters
@@ -528,6 +490,12 @@ Array<TypeOrmEntityToLoad>;
528
490
 
529
491
  #### Load Many by SQL, Use Cursor
530
492
 
493
+ ##### Environment Parameters
494
+
495
+ | Name | Type | Default Value | Comments |
496
+ |-------------------------|--------|---------------|-------------|
497
+ | `typeorm.DB.fetch.size` | number | 20 | Fetch size. |
498
+
531
499
  ##### Request and Response
532
500
 
533
501
  ```typescript
package/index.cjs CHANGED
@@ -2297,9 +2297,7 @@ class TypeOrmLoadManyBySQLUseCursorPipelineStep extends AbstractTypeOrmBySQLPipe
2297
2297
  };
2298
2298
  const close = async (readable) => {
2299
2299
  try {
2300
- readable?.close((e) => {
2301
- this.getLogger().error(e);
2302
- });
2300
+ readable?.destroy();
2303
2301
  }
2304
2302
  catch (e) {
2305
2303
  this.getLogger().error(e);
@@ -2314,6 +2312,7 @@ class TypeOrmLoadManyBySQLUseCursorPipelineStep extends AbstractTypeOrmBySQLPipe
2314
2312
  reject(e);
2315
2313
  });
2316
2314
  readable.on('data', async (data) => {
2315
+ readable.pause();
2317
2316
  rows.push(data);
2318
2317
  await pipe({
2319
2318
  resolve, reject: async (e) => {
@@ -2321,9 +2320,8 @@ class TypeOrmLoadManyBySQLUseCursorPipelineStep extends AbstractTypeOrmBySQLPipe
2321
2320
  reject(e);
2322
2321
  }, end: false
2323
2322
  });
2324
- readable.read();
2323
+ readable.resume();
2325
2324
  });
2326
- readable.read();
2327
2325
  };
2328
2326
  return new Promise((resolve, reject) => read({ resolve, reject }));
2329
2327
  }, request);
package/index.js CHANGED
@@ -2295,9 +2295,7 @@ class TypeOrmLoadManyBySQLUseCursorPipelineStep extends AbstractTypeOrmBySQLPipe
2295
2295
  };
2296
2296
  const close = async (readable) => {
2297
2297
  try {
2298
- readable?.close((e) => {
2299
- this.getLogger().error(e);
2300
- });
2298
+ readable?.destroy();
2301
2299
  }
2302
2300
  catch (e) {
2303
2301
  this.getLogger().error(e);
@@ -2312,6 +2310,7 @@ class TypeOrmLoadManyBySQLUseCursorPipelineStep extends AbstractTypeOrmBySQLPipe
2312
2310
  reject(e);
2313
2311
  });
2314
2312
  readable.on('data', async (data) => {
2313
+ readable.pause();
2315
2314
  rows.push(data);
2316
2315
  await pipe({
2317
2316
  resolve, reject: async (e) => {
@@ -2319,9 +2318,8 @@ class TypeOrmLoadManyBySQLUseCursorPipelineStep extends AbstractTypeOrmBySQLPipe
2319
2318
  reject(e);
2320
2319
  }, end: false
2321
2320
  });
2322
- readable.read();
2321
+ readable.resume();
2323
2322
  });
2324
- readable.read();
2325
2323
  };
2326
2324
  return new Promise((resolve, reject) => read({ resolve, reject }));
2327
2325
  }, request);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainbow-o23/n3",
3
- "version": "1.0.48",
3
+ "version": "1.0.49",
4
4
  "description": "o23 pipelines",
5
5
  "main": "index.cjs",
6
6
  "module": "index.js",
@@ -21,7 +21,7 @@
21
21
  "url": "https://github.com/InsureMO/rainbow-o23/issues"
22
22
  },
23
23
  "dependencies": {
24
- "@rainbow-o23/n1": "1.0.48",
24
+ "@rainbow-o23/n1": "1.0.49",
25
25
  "node-fetch": "2.6.7",
26
26
  "typeorm": "^0.3.20",
27
27
  "typescript": "5.5.4"
@@ -117,10 +117,7 @@ export class TypeOrmLoadManyBySQLUseCursorPipelineStep<In = PipelineStepPayload,
117
117
  const close = async (readable: ReadStream) => {
118
118
  // never throw exception from this function
119
119
  try {
120
- readable?.close((e) => {
121
- // ignore this error
122
- this.getLogger().error(e);
123
- });
120
+ readable?.destroy();
124
121
  } catch (e) {
125
122
  // ignore this error
126
123
  this.getLogger().error(e);
@@ -137,6 +134,7 @@ export class TypeOrmLoadManyBySQLUseCursorPipelineStep<In = PipelineStepPayload,
137
134
  reject(e);
138
135
  });
139
136
  readable.on('data', async (data) => {
137
+ readable.pause();
140
138
  rows.push(data);
141
139
  await pipe({
142
140
  resolve, reject: async (e: Error) => {
@@ -144,9 +142,8 @@ export class TypeOrmLoadManyBySQLUseCursorPipelineStep<In = PipelineStepPayload,
144
142
  reject(e);
145
143
  }, end: false
146
144
  });
147
- readable.read();
145
+ readable.resume();
148
146
  });
149
- readable.read();
150
147
  };
151
148
  return new Promise<OutFragment>((resolve, reject) => read({resolve, reject}));
152
149
  }, request);