@futdevpro/fsm-dynamo 1.10.45 → 1.10.47
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/build/_enums/http/http-call-type.enum.d.ts.map +1 -0
- package/build/_enums/http/http-call-type.enum.js.map +1 -0
- package/build/_enums/http/http-event-type.enum.d.ts +34 -0
- package/build/_enums/http/http-event-type.enum.d.ts.map +1 -0
- package/build/_enums/http/http-event-type.enum.js +38 -0
- package/build/_enums/http/http-event-type.enum.js.map +1 -0
- package/build/_enums/http/http-response-type.enum.d.ts.map +1 -0
- package/build/_enums/http/http-response-type.enum.js.map +1 -0
- package/build/_models/control-models/error.control-model.d.ts +22 -1
- package/build/_models/control-models/error.control-model.d.ts.map +1 -1
- package/build/_models/control-models/error.control-model.js +57 -5
- package/build/_models/control-models/error.control-model.js.map +1 -1
- package/build/_models/control-models/http/http-error-response.control-model.d.ts +15 -0
- package/build/_models/control-models/http/http-error-response.control-model.d.ts.map +1 -0
- package/build/_models/control-models/http/http-error-response.control-model.js +25 -0
- package/build/_models/control-models/http/http-error-response.control-model.js.map +1 -0
- package/build/_models/control-models/http/http-headers.control-model.d.ts +31 -0
- package/build/_models/control-models/http/http-headers.control-model.d.ts.map +1 -0
- package/build/_models/control-models/http/http-headers.control-model.js +37 -0
- package/build/_models/control-models/http/http-headers.control-model.js.map +1 -0
- package/build/_models/control-models/http/http-response.model-base.d.ts +43 -0
- package/build/_models/control-models/http/http-response.model-base.d.ts.map +1 -0
- package/build/_models/control-models/http/http-response.model-base.js +50 -0
- package/build/_models/control-models/http/http-response.model-base.js.map +1 -0
- package/build/_models/control-models/service-endpoint-settings-base.control-model.d.ts +1 -1
- package/build/_models/control-models/service-endpoint-settings-base.control-model.d.ts.map +1 -1
- package/build/index.d.ts +6 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +8 -2
- package/build/index.js.map +1 -1
- package/futdevpro-fsm-dynamo-01.10.47.tgz +0 -0
- package/package.json +1 -1
- package/src/_enums/http/http-event-type.enum.ts +35 -0
- package/src/_models/control-models/error.control-model.ts +68 -6
- package/src/_models/control-models/http/http-error-response.control-model.ts +27 -0
- package/src/_models/control-models/http/http-headers.control-model.ts +117 -0
- package/src/_models/control-models/http/http-response.model-base.ts +49 -0
- package/src/_models/control-models/service-endpoint-settings-base.control-model.ts +1 -1
- package/src/index.ts +10 -2
- package/build/_enums/http-call-type.enum.d.ts.map +0 -1
- package/build/_enums/http-call-type.enum.js.map +0 -1
- package/build/_enums/http-response-type.enum.d.ts.map +0 -1
- package/build/_enums/http-response-type.enum.js.map +0 -1
- package/build/_models/todo.http.d.ts +0 -1
- package/build/_models/todo.http.d.ts.map +0 -1
- package/build/_models/todo.http.js +0 -208
- package/build/_models/todo.http.js.map +0 -1
- package/futdevpro-fsm-dynamo-01.10.45.tgz +0 -0
- package/src/_models/todo.http.ts +0 -207
- /package/build/_enums/{http-call-type.enum.d.ts → http/http-call-type.enum.d.ts} +0 -0
- /package/build/_enums/{http-call-type.enum.js → http/http-call-type.enum.js} +0 -0
- /package/build/_enums/{http-response-type.enum.d.ts → http/http-response-type.enum.d.ts} +0 -0
- /package/build/_enums/{http-response-type.enum.js → http/http-response-type.enum.js} +0 -0
- /package/src/_enums/{http-call-type.enum.ts → http/http-call-type.enum.ts} +0 -0
- /package/src/_enums/{http-response-type.enum.ts → http/http-response-type.enum.ts} +0 -0
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AACA,cAAc;AACd,wBAAwB;AACxB,wFAA8D;AAC9D,yFAA+D;AAC/D,iFAAuD;AACvD,+EAAqD;AAErD,oBAAoB;AACpB,0EAAgD;AAChD,wEAA8C;AAC9C,+EAAqD;AACrD,2EAAiD;AACjD,0EAAgD;AAChD,2EAAiD;AACjD,yEAA+C;AAC/C,0FAAgE;AAChE,8EAAoD;AACpD,yEAA+C;AAE/C,y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4D;AAC5D,uFAA6D;AAC7D,iGAAuE;AACvE,iFAAuD;AAEvD,gCAAgC;AAChC,yGAA+E;AAC/E,qGAA2E;AAE3E,eAAe;AACf,yEAA+C;AAC/C,uEAA6C;AAC7C,+EAAgD;AAChD,6EAA8C"}
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@futdevpro/fsm-dynamo",
|
|
3
|
-
"version": "01.10.
|
|
3
|
+
"version": "01.10.47",
|
|
4
4
|
"description": "Full Stack Model Collection for Dynamic (NodeJS-Typescript) Framework called Dynamo, by Future Development Ltd.",
|
|
5
5
|
"DyBu_settings": {
|
|
6
6
|
"packageType": "full-stack-package",
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Type enumeration for the different kinds of `HttpEvent`.
|
|
5
|
+
*
|
|
6
|
+
* @publicApi
|
|
7
|
+
*/
|
|
8
|
+
export enum DyFM_HttpEventType {
|
|
9
|
+
/**
|
|
10
|
+
* The request was sent out over the wire.
|
|
11
|
+
*/
|
|
12
|
+
sent = 0,
|
|
13
|
+
/**
|
|
14
|
+
* An upload progress event was received.
|
|
15
|
+
*
|
|
16
|
+
* Note: The `FetchBackend` doesn't support progress report on uploads.
|
|
17
|
+
*/
|
|
18
|
+
uploadProgress = 1,
|
|
19
|
+
/**
|
|
20
|
+
* The response status code and headers were received.
|
|
21
|
+
*/
|
|
22
|
+
responseHeader = 2,
|
|
23
|
+
/**
|
|
24
|
+
* A download progress event was received.
|
|
25
|
+
*/
|
|
26
|
+
downloadProgress = 3,
|
|
27
|
+
/**
|
|
28
|
+
* The full response including the body was received.
|
|
29
|
+
*/
|
|
30
|
+
response = 4,
|
|
31
|
+
/**
|
|
32
|
+
* A custom event from an interceptor or a backend.
|
|
33
|
+
*/
|
|
34
|
+
user = 5
|
|
35
|
+
}
|
|
@@ -2,6 +2,7 @@ import { DyFM_error_defaults } from '../../_collections/constants/error-defaults
|
|
|
2
2
|
import { DyFM_Log } from '../../_collections/utils/log.util';
|
|
3
3
|
import { DyFM_ErrorLevel } from '../../_enums/error-level.enum';
|
|
4
4
|
import { DyFM_Metadata } from '../data-models/metadata.data-model';
|
|
5
|
+
import { DyFM_HttpErrorResponse, DyFM_httpErrorResponse_name } from './http/http-error-response.control-model';
|
|
5
6
|
|
|
6
7
|
export const DyFM_errorFlag = 'DYNAMO-ERROR-OBJECT';
|
|
7
8
|
export const DyFM_errorĐFlagParts= [
|
|
@@ -9,7 +10,8 @@ export const DyFM_errorĐFlagParts= [
|
|
|
9
10
|
'DyFM-',
|
|
10
11
|
]
|
|
11
12
|
|
|
12
|
-
export type DyFM_AnyError = DyFM_Error |
|
|
13
|
+
export type DyFM_AnyError = DyFM_Error | DyFM_HttpErrorResponse | Error;
|
|
14
|
+
export type DyFM_NonHttpError = DyFM_Error | Error;
|
|
13
15
|
|
|
14
16
|
export interface DyFM_Error_Settings {
|
|
15
17
|
_id?: string;
|
|
@@ -195,10 +197,15 @@ export class DyFM_Error extends DyFM_Metadata {
|
|
|
195
197
|
set.error.stack = errorStack.join('\n');
|
|
196
198
|
}
|
|
197
199
|
|
|
198
|
-
|
|
199
|
-
this.stack = (set as
|
|
200
|
-
} else if (set.error
|
|
201
|
-
this.stack = set.error
|
|
200
|
+
if ((set as DyFM_NonHttpError)?.stack) {
|
|
201
|
+
this.stack = (set as DyFM_NonHttpError)?.stack;
|
|
202
|
+
} else if ((set.error as DyFM_NonHttpError)?.stack) {
|
|
203
|
+
this.stack = (set.error as DyFM_NonHttpError)?.stack;
|
|
204
|
+
} else if (
|
|
205
|
+
(set.error as DyFM_HttpErrorResponse)?.name === DyFM_httpErrorResponse_name &&
|
|
206
|
+
(set.error as DyFM_HttpErrorResponse)?.error?.stack
|
|
207
|
+
) {
|
|
208
|
+
this.stack = (set.error as DyFM_HttpErrorResponse)?.error?.stack;
|
|
202
209
|
} else {
|
|
203
210
|
this.stack = new Error().stack;
|
|
204
211
|
}
|
|
@@ -369,7 +376,7 @@ export class DyFM_Error extends DyFM_Metadata {
|
|
|
369
376
|
DyFM_Log.error(
|
|
370
377
|
'Internal Dynamo ERROR: error is not JSON.stringifyable... ' +
|
|
371
378
|
'(it will be removed!)',
|
|
372
|
-
'\nerrorCode:', subError
|
|
379
|
+
'\nerrorCode:', (subError as DyFM_Error)?._errorCode,
|
|
373
380
|
);
|
|
374
381
|
|
|
375
382
|
return false;
|
|
@@ -549,6 +556,61 @@ export class DyFM_Error extends DyFM_Metadata {
|
|
|
549
556
|
|
|
550
557
|
/* static errorMessage(error: DyFM_AnyError): string { */
|
|
551
558
|
|
|
559
|
+
static getErrorMessage(error: DyFM_AnyError): string {
|
|
560
|
+
return (error as DyFM_Error)?._message ??
|
|
561
|
+
(error as Error)?.message ??
|
|
562
|
+
((error as DyFM_HttpErrorResponse)?.error as DyFM_Error)?._message ??
|
|
563
|
+
((error as DyFM_HttpErrorResponse)?.error as Error)?.message;
|
|
564
|
+
}
|
|
565
|
+
|
|
566
|
+
/**
|
|
567
|
+
* Returns the message of the error.
|
|
568
|
+
* Returns the userMessage if the message is not set.
|
|
569
|
+
* (prioritizes the message over the userMessage)
|
|
570
|
+
*/
|
|
571
|
+
static getAnyMessage(error: DyFM_AnyError): string {
|
|
572
|
+
return this.getErrorMessage(error) ?? this.getUserMessage(error);
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
static getUserMessage(error: DyFM_AnyError): string {
|
|
576
|
+
return (error as DyFM_Error)?.__userMessage ??
|
|
577
|
+
((error as DyFM_HttpErrorResponse)?.error as DyFM_Error)?.__userMessage;
|
|
578
|
+
}
|
|
579
|
+
|
|
580
|
+
/**
|
|
581
|
+
* Returns the user message of the error.
|
|
582
|
+
* Returns the message if the userMessage is not set.
|
|
583
|
+
* (prioritizes the userMessage over the message)
|
|
584
|
+
*/
|
|
585
|
+
static getAnyUserMessage(error: DyFM_AnyError): string {
|
|
586
|
+
return this.getUserMessage(error) ?? this.getErrorMessage(error);
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
static getErrorStatus(error: DyFM_AnyError): number {
|
|
590
|
+
return (error as DyFM_Error)?.___status ??
|
|
591
|
+
(error as DyFM_HttpErrorResponse)?.status ??
|
|
592
|
+
((error as DyFM_HttpErrorResponse)?.error as DyFM_Error)?.___status ?? 500;
|
|
593
|
+
}
|
|
594
|
+
|
|
595
|
+
static getErrorCode(error: DyFM_AnyError): string {
|
|
596
|
+
return (error as DyFM_Error)?._errorCode ??
|
|
597
|
+
((error as DyFM_HttpErrorResponse)?.error as DyFM_Error)?._errorCode;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
static getErrorStack(error: DyFM_AnyError): string {
|
|
601
|
+
return (error as DyFM_Error)?.stack ??
|
|
602
|
+
((error as DyFM_HttpErrorResponse)?.error as DyFM_NonHttpError)?.stack;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
static isDyFMError(error: any): error is DyFM_Error {
|
|
606
|
+
return (error as DyFM_Error)?.flag?.includes('DYNAMO');
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
static isAnyDyFMError(error: any): error is DyFM_AnyError {
|
|
610
|
+
return this.isDyFMError(error) ||
|
|
611
|
+
(error as DyFM_HttpErrorResponse)?.name === DyFM_httpErrorResponse_name ||
|
|
612
|
+
error instanceof Error;
|
|
613
|
+
}
|
|
552
614
|
|
|
553
615
|
static getStatusText(status: number): string {
|
|
554
616
|
switch (status) {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DyFM_AnyError, DyFM_Error } from '../error.control-model';
|
|
2
|
+
import { DyFM_HttpResponseBase } from './http-response.model-base';
|
|
3
|
+
|
|
4
|
+
export const DyFM_httpErrorResponse_name = 'HttpErrorResponse';
|
|
5
|
+
|
|
6
|
+
export class DyFM_HttpErrorResponse extends DyFM_HttpResponseBase implements Error {
|
|
7
|
+
readonly name = DyFM_httpErrorResponse_name;
|
|
8
|
+
readonly message: string;
|
|
9
|
+
readonly error?: DyFM_Error | Error;
|
|
10
|
+
/**
|
|
11
|
+
* Errors are never okay, even when the status code is in the 2xx success range.
|
|
12
|
+
*/
|
|
13
|
+
override readonly ok = false;
|
|
14
|
+
constructor(
|
|
15
|
+
set: Partial<DyFM_HttpErrorResponse>
|
|
16
|
+
) {
|
|
17
|
+
super(set);
|
|
18
|
+
|
|
19
|
+
if (set) {
|
|
20
|
+
Object.assign(this, set);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
static isHttpErrorResponse(error: DyFM_AnyError): error is DyFM_HttpErrorResponse {
|
|
25
|
+
return (error as DyFM_HttpErrorResponse)?.name === DyFM_httpErrorResponse_name;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents the header configuration options for an HTTP request.
|
|
5
|
+
* Instances are immutable. Modifying methods return a cloned
|
|
6
|
+
* instance with the change. The original object is never changed.
|
|
7
|
+
*
|
|
8
|
+
* @publicApi
|
|
9
|
+
*/
|
|
10
|
+
export class DyFM_HttpHeaders {
|
|
11
|
+
/**
|
|
12
|
+
* Internal map of lowercase header names to values.
|
|
13
|
+
*/
|
|
14
|
+
private headers: { [name: string]: string | number | (string | number)[] } = {};
|
|
15
|
+
/**
|
|
16
|
+
* Internal map of lowercased header names to the normalized
|
|
17
|
+
* form of the name (the form seen first).
|
|
18
|
+
*/
|
|
19
|
+
private normalizedNames;
|
|
20
|
+
/**
|
|
21
|
+
* Complete the lazy initialization of this object (needed before reading).
|
|
22
|
+
*/
|
|
23
|
+
private lazyInit;
|
|
24
|
+
/**
|
|
25
|
+
* Queued updates to be materialized the next initialization.
|
|
26
|
+
*/
|
|
27
|
+
private lazyUpdate;
|
|
28
|
+
/** Constructs a new HTTP header object with the given values.*/
|
|
29
|
+
constructor(
|
|
30
|
+
setHeaders?: string | { [name: string]: string | number | (string | number)[] } | Headers
|
|
31
|
+
) {
|
|
32
|
+
if (setHeaders) {
|
|
33
|
+
this.headers = setHeaders as { [name: string]: string | number | (string | number)[] };
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
///**
|
|
37
|
+
// * Checks for existence of a given header.
|
|
38
|
+
// *
|
|
39
|
+
// * @param name The header name to check for existence.
|
|
40
|
+
// *
|
|
41
|
+
// * @returns True if the header exists, false otherwise.
|
|
42
|
+
// */
|
|
43
|
+
//has(name: string): boolean {
|
|
44
|
+
// return Boolean(this.headers[name]);
|
|
45
|
+
//}
|
|
46
|
+
///**
|
|
47
|
+
// * Retrieves the first value of a given header.
|
|
48
|
+
// *
|
|
49
|
+
// * @param name The header name.
|
|
50
|
+
// *
|
|
51
|
+
// * @returns The value string if the header exists, null otherwise
|
|
52
|
+
// */
|
|
53
|
+
//get(name: string): string | number | (string | number)[] {
|
|
54
|
+
// return this.headers[name];
|
|
55
|
+
//}
|
|
56
|
+
///**
|
|
57
|
+
// * Retrieves the names of the headers.
|
|
58
|
+
// *
|
|
59
|
+
// * @returns A list of header names.
|
|
60
|
+
// */
|
|
61
|
+
//keys(): string[] {
|
|
62
|
+
// return Object.keys(this.headers);
|
|
63
|
+
//}
|
|
64
|
+
///**
|
|
65
|
+
// * Retrieves a list of values for a given header.
|
|
66
|
+
// *
|
|
67
|
+
// * @param name The header name from which to retrieve values.
|
|
68
|
+
// *
|
|
69
|
+
// * @returns A string of values if the header exists, null otherwise.
|
|
70
|
+
// */
|
|
71
|
+
//getAll(name: string): string[] | number[] | (string | number)[] | null {
|
|
72
|
+
// return this.headers[name] as string[] | number[] | (string | number)[] | null;
|
|
73
|
+
//}
|
|
74
|
+
///**
|
|
75
|
+
// * Appends a new value to the existing set of values for a header
|
|
76
|
+
// * and returns them in a clone of the original instance.
|
|
77
|
+
// *
|
|
78
|
+
// * @param name The header name for which to append the values.
|
|
79
|
+
// * @param value The value to append.
|
|
80
|
+
// *
|
|
81
|
+
// * @returns A clone of the HTTP headers object with the value appended to the given header.
|
|
82
|
+
// */
|
|
83
|
+
//append(name: string, value: string | string[]): DyFM_HttpHeaders {
|
|
84
|
+
// return new DyFM_HttpHeaders(this.headers);
|
|
85
|
+
//}
|
|
86
|
+
///**
|
|
87
|
+
// * Sets or modifies a value for a given header in a clone of the original instance.
|
|
88
|
+
// * If the header already exists, its value is replaced with the given value
|
|
89
|
+
// * in the returned object.
|
|
90
|
+
// *
|
|
91
|
+
// * @param name The header name.
|
|
92
|
+
// * @param value The value or values to set or override for the given header.
|
|
93
|
+
// *
|
|
94
|
+
// * @returns A clone of the HTTP headers object with the newly set header value.
|
|
95
|
+
// */
|
|
96
|
+
//set(name: string, value: string | string[]): DyFM_HttpHeaders {
|
|
97
|
+
// return new DyFM_HttpHeaders(this.headers);
|
|
98
|
+
//}
|
|
99
|
+
///**
|
|
100
|
+
// * Deletes values for a given header in a clone of the original instance.
|
|
101
|
+
// *
|
|
102
|
+
// * @param name The header name.
|
|
103
|
+
// * @param value The value or values to delete for the given header.
|
|
104
|
+
// *
|
|
105
|
+
// * @returns A clone of the HTTP headers object with the given value deleted.
|
|
106
|
+
// */
|
|
107
|
+
//delete(name: string, value?: string | string[]): DyFM_HttpHeaders {
|
|
108
|
+
// return new DyFM_HttpHeaders(this.headers);
|
|
109
|
+
//}
|
|
110
|
+
|
|
111
|
+
/* private maybeSetNormalizedName;
|
|
112
|
+
private init;
|
|
113
|
+
private copyFrom;
|
|
114
|
+
private clone;
|
|
115
|
+
private applyUpdate;
|
|
116
|
+
private setHeaderEntries; */
|
|
117
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { DyFM_HttpEventType } from '../../../_enums/http/http-event-type.enum';
|
|
2
|
+
import { DyFM_HttpHeaders } from './http-headers.control-model';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Base class for both `HttpResponse` and `HttpHeaderResponse`.
|
|
6
|
+
*
|
|
7
|
+
* @publicApi
|
|
8
|
+
*/
|
|
9
|
+
export abstract class DyFM_HttpResponseBase {
|
|
10
|
+
/**
|
|
11
|
+
* All response headers.
|
|
12
|
+
*/
|
|
13
|
+
readonly headers: DyFM_HttpHeaders = new DyFM_HttpHeaders();
|
|
14
|
+
/**
|
|
15
|
+
* Response status code.
|
|
16
|
+
*/
|
|
17
|
+
readonly status: number = 200;
|
|
18
|
+
/**
|
|
19
|
+
* Textual description of response status code, defaults to OK.
|
|
20
|
+
*
|
|
21
|
+
* Do not depend on this.
|
|
22
|
+
*/
|
|
23
|
+
readonly statusText: string = 'OK';
|
|
24
|
+
/**
|
|
25
|
+
* URL of the resource retrieved, or null if not available.
|
|
26
|
+
*/
|
|
27
|
+
readonly url: string | null;
|
|
28
|
+
/**
|
|
29
|
+
* Whether the status code falls in the 2xx range.
|
|
30
|
+
*/
|
|
31
|
+
readonly ok: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Type of the response, narrowed to either the full response or the header.
|
|
34
|
+
*/
|
|
35
|
+
readonly type: DyFM_HttpEventType.response | DyFM_HttpEventType.responseHeader;
|
|
36
|
+
/**
|
|
37
|
+
* Super-constructor for all responses.
|
|
38
|
+
*
|
|
39
|
+
* The single parameter accepted is an initialization hash. Any properties
|
|
40
|
+
* of the response passed there will override the default values.
|
|
41
|
+
*/
|
|
42
|
+
constructor(
|
|
43
|
+
set: Partial<DyFM_HttpResponseBase>
|
|
44
|
+
) {
|
|
45
|
+
if (set) {
|
|
46
|
+
Object.assign(this, set);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -36,10 +36,13 @@ export * from './_enums/basic-property-type.enum';
|
|
|
36
36
|
export * from './_enums/data-model-type.enum';
|
|
37
37
|
export * from './_enums/environment-flag.enum';
|
|
38
38
|
export * from './_enums/error-level.enum';
|
|
39
|
-
export * from './_enums/http-call-type.enum';
|
|
40
|
-
export * from './_enums/http-response-type.enum';
|
|
41
39
|
export * from './_enums/log-style.enum';
|
|
42
40
|
|
|
41
|
+
// enums/HTTP
|
|
42
|
+
export * from './_enums/http/http-call-type.enum';
|
|
43
|
+
export * from './_enums/http/http-event-type.enum';
|
|
44
|
+
export * from './_enums/http/http-response-type.enum';
|
|
45
|
+
|
|
43
46
|
// enums/PIPE
|
|
44
47
|
export * from './_enums/time/day-of-week.enum';
|
|
45
48
|
export * from './_enums/time/month.enum';
|
|
@@ -56,6 +59,11 @@ export * from './_models/control-models/range-value.control-model';
|
|
|
56
59
|
export * from './_models/control-models/server-status.control-model';
|
|
57
60
|
export * from './_models/control-models/service-endpoint-settings-base.control-model';
|
|
58
61
|
|
|
62
|
+
// models/control-models/HTTP
|
|
63
|
+
export * from './_models/control-models/http/http-error-response.control-model';
|
|
64
|
+
export * from './_models/control-models/http/http-headers.control-model';
|
|
65
|
+
export * from './_models/control-models/http/http-response.model-base';
|
|
66
|
+
|
|
59
67
|
// models/DATA MODELS
|
|
60
68
|
export * from './_models/data-models/errors.data-model';
|
|
61
69
|
export * from './_models/data-models/metadata.data-model';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-call-type.enum.d.ts","sourceRoot":"","sources":["../../src/_enums/http-call-type.enum.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AACH,oBAAY,iBAAiB;IAC3B,GAAG,QAAQ;IACX,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,KAAK,UAAU;IACf,MAAM,WAAW;CAClB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-call-type.enum.js","sourceRoot":"","sources":["../../src/_enums/http-call-type.enum.ts"],"names":[],"mappings":";;;AACA;;;;;;;GAOG;AACH,IAAY,iBAMX;AAND,WAAY,iBAAiB;IAC3B,gCAAW,CAAA;IACX,kCAAa,CAAA;IACb,gCAAW,CAAA;IACX,oCAAe,CAAA;IACf,sCAAiB,CAAA;AACnB,CAAC,EANW,iBAAiB,iCAAjB,iBAAiB,QAM5B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-response-type.enum.d.ts","sourceRoot":"","sources":["../../src/_enums/http-response-type.enum.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AACH,oBAAY,qBAAqB;IAC/B,WAAW,gBAAgB;IAC3B,IAAI,SAAS;IACb,IAAI,SAAS;IACb,IAAI,SAAS;CACd"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"http-response-type.enum.js","sourceRoot":"","sources":["../../src/_enums/http-response-type.enum.ts"],"names":[],"mappings":";;;AACA;;;;;;;GAOG;AACH,IAAY,qBAKX;AALD,WAAY,qBAAqB;IAC/B,oDAA2B,CAAA;IAC3B,sCAAa,CAAA;IACb,sCAAa,CAAA;IACb,sCAAa,CAAA;AACf,CAAC,EALW,qBAAqB,qCAArB,qBAAqB,QAKhC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
//# sourceMappingURL=todo.http.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"todo.http.d.ts","sourceRoot":"","sources":["../../src/_models/todo.http.ts"],"names":[],"mappings":""}
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//export type DyFM_AnyError = DyFM_Error | DyFM_HttpErrorResponse | Error;
|
|
4
|
-
//
|
|
5
|
-
///**
|
|
6
|
-
// * Base class for both `HttpResponse` and `HttpHeaderResponse`.
|
|
7
|
-
// *
|
|
8
|
-
// * @publicApi
|
|
9
|
-
// */
|
|
10
|
-
//export abstract class DyFM_HttpResponseBase {
|
|
11
|
-
// /**
|
|
12
|
-
// * All response headers.
|
|
13
|
-
// */
|
|
14
|
-
// readonly headers: DyFM_HttpHeaders = new DyFM_HttpHeaders();
|
|
15
|
-
// /**
|
|
16
|
-
// * Response status code.
|
|
17
|
-
// */
|
|
18
|
-
// readonly status: number = 200;
|
|
19
|
-
// /**
|
|
20
|
-
// * Textual description of response status code, defaults to OK.
|
|
21
|
-
// *
|
|
22
|
-
// * Do not depend on this.
|
|
23
|
-
// */
|
|
24
|
-
// readonly statusText: string = 'OK';
|
|
25
|
-
// /**
|
|
26
|
-
// * URL of the resource retrieved, or null if not available.
|
|
27
|
-
// */
|
|
28
|
-
// readonly url: string | null;
|
|
29
|
-
// /**
|
|
30
|
-
// * Whether the status code falls in the 2xx range.
|
|
31
|
-
// */
|
|
32
|
-
// readonly ok: boolean;
|
|
33
|
-
// /**
|
|
34
|
-
// * Type of the response, narrowed to either the full response or the header.
|
|
35
|
-
// */
|
|
36
|
-
// readonly type: DyFM_HttpEventType.Response | DyFM_HttpEventType.ResponseHeader;
|
|
37
|
-
// /**
|
|
38
|
-
// * Super-constructor for all responses.
|
|
39
|
-
// *
|
|
40
|
-
// * The single parameter accepted is an initialization hash. Any properties
|
|
41
|
-
// * of the response passed there will override the default values.
|
|
42
|
-
// */
|
|
43
|
-
// constructor(init: {
|
|
44
|
-
// headers?: DyFM_HttpHeaders;
|
|
45
|
-
// status?: number;
|
|
46
|
-
// statusText?: string;
|
|
47
|
-
// url?: string;
|
|
48
|
-
// }, defaultStatus?: number, defaultStatusText?: string) {
|
|
49
|
-
// if (init) {
|
|
50
|
-
// Object.assign(this, init);
|
|
51
|
-
// /* this.headers = init.headers ?? new DyFM_HttpHeaders();
|
|
52
|
-
// this.status = init.status ?? defaultStatus ?? 200;
|
|
53
|
-
// this.statusText = init.statusText ?? defaultStatusText ?? 'OK';
|
|
54
|
-
// this.url = init.url ?? null; */
|
|
55
|
-
// }
|
|
56
|
-
// }
|
|
57
|
-
//}
|
|
58
|
-
///**
|
|
59
|
-
// * Type enumeration for the different kinds of `HttpEvent`.
|
|
60
|
-
// *
|
|
61
|
-
// * @publicApi
|
|
62
|
-
// */
|
|
63
|
-
//export enum DyFM_HttpEventType {
|
|
64
|
-
// /**
|
|
65
|
-
// * The request was sent out over the wire.
|
|
66
|
-
// */
|
|
67
|
-
// Sent = 0,
|
|
68
|
-
// /**
|
|
69
|
-
// * An upload progress event was received.
|
|
70
|
-
// *
|
|
71
|
-
// * Note: The `FetchBackend` doesn't support progress report on uploads.
|
|
72
|
-
// */
|
|
73
|
-
// UploadProgress = 1,
|
|
74
|
-
// /**
|
|
75
|
-
// * The response status code and headers were received.
|
|
76
|
-
// */
|
|
77
|
-
// ResponseHeader = 2,
|
|
78
|
-
// /**
|
|
79
|
-
// * A download progress event was received.
|
|
80
|
-
// */
|
|
81
|
-
// DownloadProgress = 3,
|
|
82
|
-
// /**
|
|
83
|
-
// * The full response including the body was received.
|
|
84
|
-
// */
|
|
85
|
-
// Response = 4,
|
|
86
|
-
// /**
|
|
87
|
-
// * A custom event from an interceptor or a backend.
|
|
88
|
-
// */
|
|
89
|
-
// User = 5
|
|
90
|
-
//}
|
|
91
|
-
//
|
|
92
|
-
//export class DyFM_HttpErrorResponse extends DyFM_HttpResponseBase implements Error {
|
|
93
|
-
// readonly name = "HttpErrorResponse";
|
|
94
|
-
// readonly message: string;
|
|
95
|
-
// readonly error: any | null;
|
|
96
|
-
// /**
|
|
97
|
-
// * Errors are never okay, even when the status code is in the 2xx success range.
|
|
98
|
-
// */
|
|
99
|
-
// override readonly ok = false;
|
|
100
|
-
// constructor(init: {
|
|
101
|
-
// error?: any;
|
|
102
|
-
// headers?: DyFM_HttpHeaders;
|
|
103
|
-
// status?: number;
|
|
104
|
-
// statusText?: string;
|
|
105
|
-
// url?: string;
|
|
106
|
-
// }) {
|
|
107
|
-
// super(init);
|
|
108
|
-
// }
|
|
109
|
-
//}
|
|
110
|
-
//
|
|
111
|
-
//
|
|
112
|
-
///**
|
|
113
|
-
// * Represents the header configuration options for an HTTP request.
|
|
114
|
-
// * Instances are immutable. Modifying methods return a cloned
|
|
115
|
-
// * instance with the change. The original object is never changed.
|
|
116
|
-
// *
|
|
117
|
-
// * @publicApi
|
|
118
|
-
// */
|
|
119
|
-
//export class DyFM_HttpHeaders {
|
|
120
|
-
// /**
|
|
121
|
-
// * Internal map of lowercase header names to values.
|
|
122
|
-
// */
|
|
123
|
-
// private headers;
|
|
124
|
-
// /**
|
|
125
|
-
// * Internal map of lowercased header names to the normalized
|
|
126
|
-
// * form of the name (the form seen first).
|
|
127
|
-
// */
|
|
128
|
-
// private normalizedNames;
|
|
129
|
-
// /**
|
|
130
|
-
// * Complete the lazy initialization of this object (needed before reading).
|
|
131
|
-
// */
|
|
132
|
-
// private lazyInit;
|
|
133
|
-
// /**
|
|
134
|
-
// * Queued updates to be materialized the next initialization.
|
|
135
|
-
// */
|
|
136
|
-
// private lazyUpdate;
|
|
137
|
-
// /** Constructs a new HTTP header object with the given values.*/
|
|
138
|
-
// constructor(headers?: string | {
|
|
139
|
-
// [name: string]: string | number | (string | number)[];
|
|
140
|
-
// } | Headers);
|
|
141
|
-
// /**
|
|
142
|
-
// * Checks for existence of a given header.
|
|
143
|
-
// *
|
|
144
|
-
// * @param name The header name to check for existence.
|
|
145
|
-
// *
|
|
146
|
-
// * @returns True if the header exists, false otherwise.
|
|
147
|
-
// */
|
|
148
|
-
// has(name: string): boolean;
|
|
149
|
-
// /**
|
|
150
|
-
// * Retrieves the first value of a given header.
|
|
151
|
-
// *
|
|
152
|
-
// * @param name The header name.
|
|
153
|
-
// *
|
|
154
|
-
// * @returns The value string if the header exists, null otherwise
|
|
155
|
-
// */
|
|
156
|
-
// get(name: string): string | null;
|
|
157
|
-
// /**
|
|
158
|
-
// * Retrieves the names of the headers.
|
|
159
|
-
// *
|
|
160
|
-
// * @returns A list of header names.
|
|
161
|
-
// */
|
|
162
|
-
// keys(): string[];
|
|
163
|
-
// /**
|
|
164
|
-
// * Retrieves a list of values for a given header.
|
|
165
|
-
// *
|
|
166
|
-
// * @param name The header name from which to retrieve values.
|
|
167
|
-
// *
|
|
168
|
-
// * @returns A string of values if the header exists, null otherwise.
|
|
169
|
-
// */
|
|
170
|
-
// getAll(name: string): string[] | null;
|
|
171
|
-
// /**
|
|
172
|
-
// * Appends a new value to the existing set of values for a header
|
|
173
|
-
// * and returns them in a clone of the original instance.
|
|
174
|
-
// *
|
|
175
|
-
// * @param name The header name for which to append the values.
|
|
176
|
-
// * @param value The value to append.
|
|
177
|
-
// *
|
|
178
|
-
// * @returns A clone of the HTTP headers object with the value appended to the given header.
|
|
179
|
-
// */
|
|
180
|
-
// append(name: string, value: string | string[]): DyFM_HttpHeaders;
|
|
181
|
-
// /**
|
|
182
|
-
// * Sets or modifies a value for a given header in a clone of the original instance.
|
|
183
|
-
// * If the header already exists, its value is replaced with the given value
|
|
184
|
-
// * in the returned object.
|
|
185
|
-
// *
|
|
186
|
-
// * @param name The header name.
|
|
187
|
-
// * @param value The value or values to set or override for the given header.
|
|
188
|
-
// *
|
|
189
|
-
// * @returns A clone of the HTTP headers object with the newly set header value.
|
|
190
|
-
// */
|
|
191
|
-
// set(name: string, value: string | string[]): DyFM_HttpHeaders;
|
|
192
|
-
// /**
|
|
193
|
-
// * Deletes values for a given header in a clone of the original instance.
|
|
194
|
-
// *
|
|
195
|
-
// * @param name The header name.
|
|
196
|
-
// * @param value The value or values to delete for the given header.
|
|
197
|
-
// *
|
|
198
|
-
// * @returns A clone of the HTTP headers object with the given value deleted.
|
|
199
|
-
// */
|
|
200
|
-
// delete(name: string, value?: string | string[]): DyFM_HttpHeaders;
|
|
201
|
-
// private maybeSetNormalizedName;
|
|
202
|
-
// private init;
|
|
203
|
-
// private copyFrom;
|
|
204
|
-
// private clone;
|
|
205
|
-
// private applyUpdate;
|
|
206
|
-
// private setHeaderEntries;
|
|
207
|
-
//}
|
|
208
|
-
//# sourceMappingURL=todo.http.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"todo.http.js","sourceRoot":"","sources":["../../src/_models/todo.http.ts"],"names":[],"mappings":"AAAA,EAAE;AACF,EAAE;AACF,0EAA0E;AAC1E,EAAE;AACF,KAAK;AACL,iEAAiE;AACjE,IAAI;AACJ,eAAe;AACf,KAAK;AACL,+CAA+C;AAC/C,OAAO;AACP,4BAA4B;AAC5B,OAAO;AACP,gEAAgE;AAChE,OAAO;AAC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