@rainbow-o23/n3 1.0.54 → 1.0.56

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/index.cjs CHANGED
@@ -1324,7 +1324,7 @@ class FetchPipelineStep extends AbstractFragmentaryPipelineStep {
1324
1324
  this._bodyGenerateSnippet = options.bodyGenerate;
1325
1325
  this._bodyGenerateFunc = Utils.createAsyncFunction(this.getBodyGenerateSnippet(), {
1326
1326
  createDefault: () => async ($factor, _$request, _$helpers, _$) => {
1327
- return ($factor == null || (typeof $factor === 'string' && $factor.length === 0)) ? (void 0) : JSON.stringify($factor);
1327
+ return (($factor == null || (typeof $factor === 'string' && $factor.length === 0)) ? (void 0) : JSON.stringify($factor));
1328
1328
  },
1329
1329
  getVariableNames: () => this.getBodyGenerateVariableNames(),
1330
1330
  error: (e) => {
package/index.js CHANGED
@@ -1322,7 +1322,7 @@ class FetchPipelineStep extends AbstractFragmentaryPipelineStep {
1322
1322
  this._bodyGenerateSnippet = options.bodyGenerate;
1323
1323
  this._bodyGenerateFunc = Utils.createAsyncFunction(this.getBodyGenerateSnippet(), {
1324
1324
  createDefault: () => async ($factor, _$request, _$helpers, _$) => {
1325
- return ($factor == null || (typeof $factor === 'string' && $factor.length === 0)) ? (void 0) : JSON.stringify($factor);
1325
+ return (($factor == null || (typeof $factor === 'string' && $factor.length === 0)) ? (void 0) : JSON.stringify($factor));
1326
1326
  },
1327
1327
  getVariableNames: () => this.getBodyGenerateVariableNames(),
1328
1328
  error: (e) => {
@@ -1,7 +1,7 @@
1
1
  import { PipelineStepData, PipelineStepPayload } from '@rainbow-o23/n1';
2
2
  import { AbstractFragmentaryPipelineStep, FragmentaryPipelineStepOptions, ScriptFuncOrBody } from '../step';
3
3
  import { HttpErrorCode, HttpGenerateBody, HttpGenerateHeaders, HttpGenerateResponse, HttpGenerateUrl, HttpHandleError } from './types';
4
- export interface FetchPipelineStepOptions<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = In, OutFragment = Out> extends FragmentaryPipelineStepOptions<In, Out, InFragment, OutFragment> {
4
+ export interface FetchPipelineStepOptions<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = In, OutFragment = Out, BodyData = any> extends FragmentaryPipelineStepOptions<In, Out, InFragment, OutFragment> {
5
5
  endpointSystemCode: string;
6
6
  endpointName: string;
7
7
  urlGenerate?: ScriptFuncOrBody<HttpGenerateUrl<In, InFragment>>;
@@ -9,13 +9,13 @@ export interface FetchPipelineStepOptions<In = PipelineStepPayload, Out = Pipeli
9
9
  timeout?: number;
10
10
  headersGenerate?: ScriptFuncOrBody<HttpGenerateHeaders<In, InFragment>>;
11
11
  bodyUsed?: boolean;
12
- bodyGenerate?: ScriptFuncOrBody<HttpGenerateBody<In, InFragment>>;
13
- responseGenerate?: ScriptFuncOrBody<HttpGenerateResponse<In, InFragment>>;
12
+ bodyGenerate?: ScriptFuncOrBody<HttpGenerateBody<In, InFragment, BodyData>>;
13
+ responseGenerate?: ScriptFuncOrBody<HttpGenerateResponse<In, InFragment, OutFragment>>;
14
14
  responseErrorHandles?: ScriptFuncOrBody<HttpHandleError<In, InFragment, OutFragment>> | {
15
15
  [key: HttpErrorCode]: ScriptFuncOrBody<HttpHandleError<In, InFragment, OutFragment>>;
16
16
  };
17
17
  }
18
- export declare class FetchPipelineStep<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = In, OutFragment = Out> extends AbstractFragmentaryPipelineStep<In, Out, InFragment, OutFragment> {
18
+ export declare class FetchPipelineStep<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = In, OutFragment = Out, BodyData = any> extends AbstractFragmentaryPipelineStep<In, Out, InFragment, OutFragment> {
19
19
  private readonly _endpointSystemCode;
20
20
  private readonly _endpointName;
21
21
  private readonly _endpointUrl;
@@ -47,9 +47,9 @@ export declare class FetchPipelineStep<In = PipelineStepPayload, Out = PipelineS
47
47
  getHeadersGenerateSnippet(): ScriptFuncOrBody<HttpGenerateHeaders<In, InFragment>>;
48
48
  protected getHeadersGenerateVariableNames(): Array<string>;
49
49
  protected isBodyUsed(): boolean | undefined;
50
- getBodyGenerateSnippet(): ScriptFuncOrBody<HttpGenerateBody<In, InFragment>>;
50
+ getBodyGenerateSnippet(): ScriptFuncOrBody<HttpGenerateBody<In, InFragment, BodyData>>;
51
51
  protected getBodyGenerateVariableNames(): Array<string>;
52
- getResponseGenerateSnippet(): ScriptFuncOrBody<HttpGenerateResponse<In, InFragment>>;
52
+ getResponseGenerateSnippet(): ScriptFuncOrBody<HttpGenerateResponse<In, InFragment, OutFragment>>;
53
53
  protected getResponseGenerateVariableName(): Array<string>;
54
54
  protected getErrorHandlerVariableName(): Array<string>;
55
55
  protected doPerform(data: InFragment, request: PipelineStepData<In>): Promise<OutFragment>;
@@ -2,8 +2,8 @@ import { PipelineStepData, PipelineStepHelpers, Undefinable } from '@rainbow-o23
2
2
  import { Response } from 'node-fetch';
3
3
  export type HttpGenerateUrl<In, InFragment> = ($endpointUrl: string, $factor: InFragment, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<string>;
4
4
  export type HttpGenerateHeaders<In, InFragment> = ($factor: InFragment, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<Undefinable<Record<string, string>>>;
5
- export type HttpGenerateBody<In, InFragment> = ($factor: InFragment, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<any>;
6
- export type HttpGenerateResponse<In, InFragment> = ($response: Response, $factor: InFragment, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<any>;
5
+ export type HttpGenerateBody<In, InFragment, BodyData> = ($factor: InFragment, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<BodyData>;
6
+ export type HttpGenerateResponse<In, InFragment, OutFragment> = ($response: Response, $factor: InFragment, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<OutFragment>;
7
7
  export type HttpUnpredictedErrorCode = `0${number}`;
8
8
  export declare const HttpUnknownErrorCode: HttpUnpredictedErrorCode;
9
9
  export type HttpClientErrorCode = `4${number}`;
@@ -3,20 +3,20 @@ import { ScriptFuncOrBody } from '../step';
3
3
  import { AbstractTypeOrmBySQLPipelineStep, TypeOrmBySQLPipelineStepOptions } from './abstract-typeorm-by-sql-step';
4
4
  import { TypeOrmLoadBasis } from './abstract-typeorm-load-by-sql-step';
5
5
  export type StreamToSubSteps = any;
6
- export type StreamToFunc<In> = ($factor: Array<any>, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<StreamToSubSteps>;
7
- export interface TypeOrmLoadManyBySQLUseCursorPipelineStepOptions<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = TypeOrmLoadBasis, OutFragment = Out> extends TypeOrmBySQLPipelineStepOptions<In, Out, InFragment, OutFragment> {
6
+ export type StreamToFunc<In, Item> = ($factor: Array<Item>, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<StreamToSubSteps>;
7
+ export interface TypeOrmLoadManyBySQLUseCursorPipelineStepOptions<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = TypeOrmLoadBasis, OutFragment = Out, Item = any> extends TypeOrmBySQLPipelineStepOptions<In, Out, InFragment, OutFragment> {
8
8
  fetchSize?: number;
9
- streamTo?: ScriptFuncOrBody<StreamToFunc<In>>;
9
+ streamTo?: ScriptFuncOrBody<StreamToFunc<In, Item>>;
10
10
  steps?: Array<PipelineStepBuilder>;
11
11
  }
12
- export declare class TypeOrmLoadManyBySQLUseCursorPipelineStep<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = Undefinable<TypeOrmLoadBasis>, OutFragment = Out> extends AbstractTypeOrmBySQLPipelineStep<In, Out, Undefinable<TypeOrmLoadBasis>, OutFragment> {
12
+ export declare class TypeOrmLoadManyBySQLUseCursorPipelineStep<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = Undefinable<TypeOrmLoadBasis>, OutFragment = Out, Item = any> extends AbstractTypeOrmBySQLPipelineStep<In, Out, Undefinable<TypeOrmLoadBasis>, OutFragment> {
13
13
  private readonly _fetchSize;
14
14
  private readonly _streamToSnippet;
15
15
  private readonly _streamToFunc;
16
16
  private readonly _stepBuilders;
17
17
  constructor(options: TypeOrmLoadManyBySQLUseCursorPipelineStepOptions<In, Out, InFragment, OutFragment>);
18
18
  protected getFetchSize(): number;
19
- getStreamToSnippet(): ScriptFuncOrBody<StreamToFunc<In>>;
19
+ getStreamToSnippet(): ScriptFuncOrBody<StreamToFunc<In, Item>>;
20
20
  protected generateVariableNames(): Array<string>;
21
21
  protected getStepBuilders(): Array<PipelineStepBuilder>;
22
22
  protected doPerform(basis: Undefinable<TypeOrmLoadBasis>, request: PipelineStepData<In>): Promise<Undefinable<OutFragment>>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rainbow-o23/n3",
3
- "version": "1.0.54",
3
+ "version": "1.0.56",
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.54",
24
+ "@rainbow-o23/n1": "1.0.56",
25
25
  "node-fetch": "2.6.7",
26
26
  "typeorm": "^0.3.20",
27
27
  "typescript": "5.5.4"
@@ -14,7 +14,8 @@ import {
14
14
  HttpUnknownErrorCode
15
15
  } from './types';
16
16
 
17
- export interface FetchPipelineStepOptions<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = In, OutFragment = Out>
17
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
18
+ export interface FetchPipelineStepOptions<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = In, OutFragment = Out, BodyData = any>
18
19
  extends FragmentaryPipelineStepOptions<In, Out, InFragment, OutFragment> {
19
20
  endpointSystemCode: string;
20
21
  endpointName: string;
@@ -24,13 +25,14 @@ export interface FetchPipelineStepOptions<In = PipelineStepPayload, Out = Pipeli
24
25
  timeout?: number;
25
26
  headersGenerate?: ScriptFuncOrBody<HttpGenerateHeaders<In, InFragment>>;
26
27
  bodyUsed?: boolean;
27
- bodyGenerate?: ScriptFuncOrBody<HttpGenerateBody<In, InFragment>>;
28
- responseGenerate?: ScriptFuncOrBody<HttpGenerateResponse<In, InFragment>>;
28
+ bodyGenerate?: ScriptFuncOrBody<HttpGenerateBody<In, InFragment, BodyData>>;
29
+ responseGenerate?: ScriptFuncOrBody<HttpGenerateResponse<In, InFragment, OutFragment>>;
29
30
  responseErrorHandles?: ScriptFuncOrBody<HttpHandleError<In, InFragment, OutFragment>>
30
31
  | { [key: HttpErrorCode]: ScriptFuncOrBody<HttpHandleError<In, InFragment, OutFragment>>; };
31
32
  }
32
33
 
33
- export class FetchPipelineStep<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = In, OutFragment = Out>
34
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
+ export class FetchPipelineStep<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = In, OutFragment = Out, BodyData = any>
34
36
  extends AbstractFragmentaryPipelineStep<In, Out, InFragment, OutFragment> {
35
37
  private readonly _endpointSystemCode: string;
36
38
  private readonly _endpointName: string;
@@ -43,10 +45,10 @@ export class FetchPipelineStep<In = PipelineStepPayload, Out = PipelineStepPaylo
43
45
  private readonly _headersGenerateSnippet: ScriptFuncOrBody<HttpGenerateHeaders<In, InFragment>>;
44
46
  private readonly _headersGenerateFunc: HttpGenerateHeaders<In, InFragment>;
45
47
  private readonly _bodyUsed: boolean;
46
- private readonly _bodyGenerateSnippet: ScriptFuncOrBody<HttpGenerateBody<In, InFragment>>;
47
- private readonly _bodyGenerateFunc: HttpGenerateBody<In, InFragment>;
48
- private readonly _responseGenerateSnippet: ScriptFuncOrBody<HttpGenerateResponse<In, InFragment>>;
49
- private readonly _responseGenerateFunc: HttpGenerateResponse<In, InFragment>;
48
+ private readonly _bodyGenerateSnippet: ScriptFuncOrBody<HttpGenerateBody<In, InFragment, BodyData>>;
49
+ private readonly _bodyGenerateFunc: HttpGenerateBody<In, InFragment, BodyData>;
50
+ private readonly _responseGenerateSnippet: ScriptFuncOrBody<HttpGenerateResponse<In, InFragment, OutFragment>>;
51
+ private readonly _responseGenerateFunc: HttpGenerateResponse<In, InFragment, OutFragment>;
50
52
  private readonly _responseErrorHandleFunc: HttpHandleError<In, InFragment, OutFragment>;
51
53
 
52
54
  public constructor(options: FetchPipelineStepOptions<In, Out, InFragment, OutFragment>) {
@@ -91,7 +93,7 @@ export class FetchPipelineStep<In = PipelineStepPayload, Out = PipelineStepPaylo
91
93
  this._bodyGenerateFunc = Utils.createAsyncFunction(this.getBodyGenerateSnippet(), {
92
94
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
93
95
  createDefault: () => async ($factor: InFragment, _$request: PipelineStepData<In>, _$helpers: PipelineStepHelpers, _$: PipelineStepHelpers) => {
94
- return ($factor == null || (typeof $factor === 'string' && $factor.length === 0)) ? (void 0) : JSON.stringify($factor);
96
+ return (($factor == null || (typeof $factor === 'string' && $factor.length === 0)) ? (void 0) : JSON.stringify($factor)) as BodyData;
95
97
  },
96
98
  getVariableNames: () => this.getBodyGenerateVariableNames(),
97
99
  error: (e: Error) => {
@@ -224,7 +226,7 @@ export class FetchPipelineStep<In = PipelineStepPayload, Out = PipelineStepPaylo
224
226
  return this._bodyUsed;
225
227
  }
226
228
 
227
- public getBodyGenerateSnippet(): ScriptFuncOrBody<HttpGenerateBody<In, InFragment>> {
229
+ public getBodyGenerateSnippet(): ScriptFuncOrBody<HttpGenerateBody<In, InFragment, BodyData>> {
228
230
  return this._bodyGenerateSnippet;
229
231
  }
230
232
 
@@ -235,7 +237,7 @@ export class FetchPipelineStep<In = PipelineStepPayload, Out = PipelineStepPaylo
235
237
  return ['$factor', '$request', ...this.getHelpersVariableNames()];
236
238
  }
237
239
 
238
- public getResponseGenerateSnippet(): ScriptFuncOrBody<HttpGenerateResponse<In, InFragment>> {
240
+ public getResponseGenerateSnippet(): ScriptFuncOrBody<HttpGenerateResponse<In, InFragment, OutFragment>> {
239
241
  return this._responseGenerateSnippet;
240
242
  }
241
243
 
@@ -1,14 +1,10 @@
1
1
  import {PipelineStepData, PipelineStepHelpers, Undefinable} from '@rainbow-o23/n1';
2
2
  import {Response} from 'node-fetch';
3
3
 
4
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
5
4
  export type HttpGenerateUrl<In, InFragment> = ($endpointUrl: string, $factor: InFragment, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<string>;
6
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
7
5
  export type HttpGenerateHeaders<In, InFragment> = ($factor: InFragment, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<Undefinable<Record<string, string>>>;
8
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
9
- export type HttpGenerateBody<In, InFragment> = ($factor: InFragment, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<any>;
10
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
11
- export type HttpGenerateResponse<In, InFragment> = ($response: Response, $factor: InFragment, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<any>;
6
+ export type HttpGenerateBody<In, InFragment, BodyData> = ($factor: InFragment, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<BodyData>;
7
+ export type HttpGenerateResponse<In, InFragment, OutFragment> = ($response: Response, $factor: InFragment, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<OutFragment>;
12
8
 
13
9
  export type HttpUnpredictedErrorCode = `0${number}`;
14
10
  export const HttpUnknownErrorCode: HttpUnpredictedErrorCode = '000';
@@ -14,20 +14,22 @@ import {TypeOrmLoadBasis} from './abstract-typeorm-load-by-sql-step';
14
14
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
15
15
  export type StreamToSubSteps = any;
16
16
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
17
- export type StreamToFunc<In> = ($factor: Array<any>, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<StreamToSubSteps>;
17
+ export type StreamToFunc<In, Item> = ($factor: Array<Item>, $request: PipelineStepData<In>, $helpers: PipelineStepHelpers, $: PipelineStepHelpers) => Promise<StreamToSubSteps>;
18
18
 
19
- export interface TypeOrmLoadManyBySQLUseCursorPipelineStepOptions<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = TypeOrmLoadBasis, OutFragment = Out>
19
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
20
+ export interface TypeOrmLoadManyBySQLUseCursorPipelineStepOptions<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = TypeOrmLoadBasis, OutFragment = Out, Item = any>
20
21
  extends TypeOrmBySQLPipelineStepOptions<In, Out, InFragment, OutFragment> {
21
22
  fetchSize?: number;
22
- streamTo?: ScriptFuncOrBody<StreamToFunc<In>>;
23
+ streamTo?: ScriptFuncOrBody<StreamToFunc<In, Item>>;
23
24
  steps?: Array<PipelineStepBuilder>;
24
25
  }
25
26
 
26
- export class TypeOrmLoadManyBySQLUseCursorPipelineStep<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = Undefinable<TypeOrmLoadBasis>, OutFragment = Out>
27
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
28
+ export class TypeOrmLoadManyBySQLUseCursorPipelineStep<In = PipelineStepPayload, Out = PipelineStepPayload, InFragment = Undefinable<TypeOrmLoadBasis>, OutFragment = Out, Item = any>
27
29
  extends AbstractTypeOrmBySQLPipelineStep<In, Out, Undefinable<TypeOrmLoadBasis>, OutFragment> {
28
30
  private readonly _fetchSize: number;
29
- private readonly _streamToSnippet: ScriptFuncOrBody<StreamToFunc<In>>;
30
- private readonly _streamToFunc: StreamToFunc<In>;
31
+ private readonly _streamToSnippet: ScriptFuncOrBody<StreamToFunc<In, Item>>;
32
+ private readonly _streamToFunc: StreamToFunc<In, Item>;
31
33
  private readonly _stepBuilders: Array<PipelineStepBuilder>;
32
34
 
33
35
  public constructor(options: TypeOrmLoadManyBySQLUseCursorPipelineStepOptions<In, Out, InFragment, OutFragment>) {
@@ -51,7 +53,7 @@ export class TypeOrmLoadManyBySQLUseCursorPipelineStep<In = PipelineStepPayload,
51
53
  return this._fetchSize;
52
54
  }
53
55
 
54
- public getStreamToSnippet(): ScriptFuncOrBody<StreamToFunc<In>> {
56
+ public getStreamToSnippet(): ScriptFuncOrBody<StreamToFunc<In, Item>> {
55
57
  return this._streamToSnippet;
56
58
  }
57
59