jdev_helpers 1.4.7 → 1.4.9
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/dist/index.d.mts +14 -11
- package/dist/index.d.ts +14 -11
- package/dist/index.js +44 -37
- package/dist/index.mjs +42 -36
- package/package.json +3 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
2
|
+
import { FormControl } from '@angular/forms';
|
|
2
3
|
|
|
3
|
-
declare
|
|
4
|
+
declare abstract class HttpParentService {
|
|
5
|
+
protected readonly http: HttpClient;
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare function formControlSetValue<T>(formControl: FormControl<T>, value: T): void;
|
|
4
10
|
|
|
5
11
|
declare const REQUEST_PARAM_PAGE_NUMBER = "pageNumber";
|
|
6
12
|
declare const REQUEST_PARAM_QUERY = "query";
|
|
@@ -15,10 +21,7 @@ declare const OBSERVE_BODY = "body";
|
|
|
15
21
|
declare const HTTP_HEADER_CONTENT_TYPE = "content-type";
|
|
16
22
|
declare const MIME_TYPE_TEXT_PLAIN = "text/plain";
|
|
17
23
|
|
|
18
|
-
declare const
|
|
19
|
-
declare const WRITE_TO_SESSION_STORAGE: (storageName: string, obj: any) => void;
|
|
20
|
-
declare const READ_FROM_LOCAL_STORAGE: (storageName: string) => any;
|
|
21
|
-
declare const READ_FROM_SESSION_STORAGE: (storageName: string) => any;
|
|
24
|
+
declare const debug: (message?: any, ...optionalParams: any[]) => void;
|
|
22
25
|
|
|
23
26
|
interface CustomHttpParam {
|
|
24
27
|
key: string;
|
|
@@ -28,9 +31,9 @@ interface CustomHttpParam {
|
|
|
28
31
|
declare function createHttpParams(customHttpParams: CustomHttpParam[]): HttpParams;
|
|
29
32
|
declare function addHttpParams(hp: HttpParams, customHttpParams: CustomHttpParam): HttpParams;
|
|
30
33
|
|
|
31
|
-
declare
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
declare const WRITE_TO_LOCAL_STORAGE: (storageName: string, obj: any) => void;
|
|
35
|
+
declare const WRITE_TO_SESSION_STORAGE: (storageName: string, obj: any) => void;
|
|
36
|
+
declare const READ_FROM_LOCAL_STORAGE: (storageName: string) => any;
|
|
37
|
+
declare const READ_FROM_SESSION_STORAGE: (storageName: string) => any;
|
|
35
38
|
|
|
36
|
-
export { type CustomHttpParam, HTTP_HEADER_CONTENT_TYPE, HttpParentService, MIME_TYPE_TEXT_PLAIN, OBSERVE_BODY, OBSERVE_RESPONSE, READ_FROM_LOCAL_STORAGE, READ_FROM_SESSION_STORAGE, REQUEST_PARAM_LIMIT, REQUEST_PARAM_LOCALE, REQUEST_PARAM_MATCH_SCORE, REQUEST_PARAM_NEXT_CURSOR, REQUEST_PARAM_PAGE_NUMBER, REQUEST_PARAM_QUERY, REQUEST_PARAM_SIMILARITY, RESPONSE_TYPE_JSON, WRITE_TO_LOCAL_STORAGE, WRITE_TO_SESSION_STORAGE, addHttpParams, createHttpParams, debug };
|
|
39
|
+
export { type CustomHttpParam, HTTP_HEADER_CONTENT_TYPE, HttpParentService, MIME_TYPE_TEXT_PLAIN, OBSERVE_BODY, OBSERVE_RESPONSE, READ_FROM_LOCAL_STORAGE, READ_FROM_SESSION_STORAGE, REQUEST_PARAM_LIMIT, REQUEST_PARAM_LOCALE, REQUEST_PARAM_MATCH_SCORE, REQUEST_PARAM_NEXT_CURSOR, REQUEST_PARAM_PAGE_NUMBER, REQUEST_PARAM_QUERY, REQUEST_PARAM_SIMILARITY, RESPONSE_TYPE_JSON, WRITE_TO_LOCAL_STORAGE, WRITE_TO_SESSION_STORAGE, addHttpParams, createHttpParams, debug, formControlSetValue };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { HttpClient, HttpParams } from '@angular/common/http';
|
|
2
|
+
import { FormControl } from '@angular/forms';
|
|
2
3
|
|
|
3
|
-
declare
|
|
4
|
+
declare abstract class HttpParentService {
|
|
5
|
+
protected readonly http: HttpClient;
|
|
6
|
+
constructor();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
declare function formControlSetValue<T>(formControl: FormControl<T>, value: T): void;
|
|
4
10
|
|
|
5
11
|
declare const REQUEST_PARAM_PAGE_NUMBER = "pageNumber";
|
|
6
12
|
declare const REQUEST_PARAM_QUERY = "query";
|
|
@@ -15,10 +21,7 @@ declare const OBSERVE_BODY = "body";
|
|
|
15
21
|
declare const HTTP_HEADER_CONTENT_TYPE = "content-type";
|
|
16
22
|
declare const MIME_TYPE_TEXT_PLAIN = "text/plain";
|
|
17
23
|
|
|
18
|
-
declare const
|
|
19
|
-
declare const WRITE_TO_SESSION_STORAGE: (storageName: string, obj: any) => void;
|
|
20
|
-
declare const READ_FROM_LOCAL_STORAGE: (storageName: string) => any;
|
|
21
|
-
declare const READ_FROM_SESSION_STORAGE: (storageName: string) => any;
|
|
24
|
+
declare const debug: (message?: any, ...optionalParams: any[]) => void;
|
|
22
25
|
|
|
23
26
|
interface CustomHttpParam {
|
|
24
27
|
key: string;
|
|
@@ -28,9 +31,9 @@ interface CustomHttpParam {
|
|
|
28
31
|
declare function createHttpParams(customHttpParams: CustomHttpParam[]): HttpParams;
|
|
29
32
|
declare function addHttpParams(hp: HttpParams, customHttpParams: CustomHttpParam): HttpParams;
|
|
30
33
|
|
|
31
|
-
declare
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
declare const WRITE_TO_LOCAL_STORAGE: (storageName: string, obj: any) => void;
|
|
35
|
+
declare const WRITE_TO_SESSION_STORAGE: (storageName: string, obj: any) => void;
|
|
36
|
+
declare const READ_FROM_LOCAL_STORAGE: (storageName: string) => any;
|
|
37
|
+
declare const READ_FROM_SESSION_STORAGE: (storageName: string) => any;
|
|
35
38
|
|
|
36
|
-
export { type CustomHttpParam, HTTP_HEADER_CONTENT_TYPE, HttpParentService, MIME_TYPE_TEXT_PLAIN, OBSERVE_BODY, OBSERVE_RESPONSE, READ_FROM_LOCAL_STORAGE, READ_FROM_SESSION_STORAGE, REQUEST_PARAM_LIMIT, REQUEST_PARAM_LOCALE, REQUEST_PARAM_MATCH_SCORE, REQUEST_PARAM_NEXT_CURSOR, REQUEST_PARAM_PAGE_NUMBER, REQUEST_PARAM_QUERY, REQUEST_PARAM_SIMILARITY, RESPONSE_TYPE_JSON, WRITE_TO_LOCAL_STORAGE, WRITE_TO_SESSION_STORAGE, addHttpParams, createHttpParams, debug };
|
|
39
|
+
export { type CustomHttpParam, HTTP_HEADER_CONTENT_TYPE, HttpParentService, MIME_TYPE_TEXT_PLAIN, OBSERVE_BODY, OBSERVE_RESPONSE, READ_FROM_LOCAL_STORAGE, READ_FROM_SESSION_STORAGE, REQUEST_PARAM_LIMIT, REQUEST_PARAM_LOCALE, REQUEST_PARAM_MATCH_SCORE, REQUEST_PARAM_NEXT_CURSOR, REQUEST_PARAM_PAGE_NUMBER, REQUEST_PARAM_QUERY, REQUEST_PARAM_SIMILARITY, RESPONSE_TYPE_JSON, WRITE_TO_LOCAL_STORAGE, WRITE_TO_SESSION_STORAGE, addHttpParams, createHttpParams, debug, formControlSetValue };
|
package/dist/index.js
CHANGED
|
@@ -39,15 +39,25 @@ __export(index_exports, {
|
|
|
39
39
|
WRITE_TO_SESSION_STORAGE: () => WRITE_TO_SESSION_STORAGE,
|
|
40
40
|
addHttpParams: () => addHttpParams,
|
|
41
41
|
createHttpParams: () => createHttpParams,
|
|
42
|
-
debug: () => debug
|
|
42
|
+
debug: () => debug,
|
|
43
|
+
formControlSetValue: () => formControlSetValue
|
|
43
44
|
});
|
|
44
45
|
module.exports = __toCommonJS(index_exports);
|
|
45
46
|
|
|
46
|
-
// src/
|
|
47
|
-
var
|
|
48
|
-
|
|
47
|
+
// src/angular/http-parent.service.ts
|
|
48
|
+
var import_http = require("@angular/common/http");
|
|
49
|
+
var import_core = require("@angular/core");
|
|
50
|
+
var HttpParentService = class {
|
|
51
|
+
http = (0, import_core.inject)(import_http.HttpClient);
|
|
52
|
+
constructor() {
|
|
53
|
+
}
|
|
49
54
|
};
|
|
50
55
|
|
|
56
|
+
// src/angular/angular-helpers.ts
|
|
57
|
+
function formControlSetValue(formControl, value) {
|
|
58
|
+
formControl.setValue(value);
|
|
59
|
+
}
|
|
60
|
+
|
|
51
61
|
// src/js/common-constants.ts
|
|
52
62
|
var REQUEST_PARAM_PAGE_NUMBER = "pageNumber";
|
|
53
63
|
var REQUEST_PARAM_QUERY = "query";
|
|
@@ -62,6 +72,34 @@ var OBSERVE_BODY = "body";
|
|
|
62
72
|
var HTTP_HEADER_CONTENT_TYPE = "content-type";
|
|
63
73
|
var MIME_TYPE_TEXT_PLAIN = "text/plain";
|
|
64
74
|
|
|
75
|
+
// src/js/common-helpers.ts
|
|
76
|
+
var debug = (message, ...optionalParams) => {
|
|
77
|
+
console.log(message, ...optionalParams);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
// src/js/http-helpers.ts
|
|
81
|
+
var import_http2 = require("@angular/common/http");
|
|
82
|
+
function createHttpParams(customHttpParams) {
|
|
83
|
+
return addParamsToHttpParamsProcess(new import_http2.HttpParams(), customHttpParams);
|
|
84
|
+
}
|
|
85
|
+
function addHttpParams(hp, customHttpParams) {
|
|
86
|
+
if (customHttpParams.needToCheckValue) {
|
|
87
|
+
if (customHttpParams.value === null || customHttpParams.value === void 0) {
|
|
88
|
+
return hp;
|
|
89
|
+
} else {
|
|
90
|
+
return hp.append(customHttpParams.key, customHttpParams.value);
|
|
91
|
+
}
|
|
92
|
+
} else {
|
|
93
|
+
return hp.append(customHttpParams.key, customHttpParams.value);
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function addParamsToHttpParamsProcess(hp, customHttpParams) {
|
|
97
|
+
customHttpParams.forEach((currentCustomHttpParam) => {
|
|
98
|
+
hp = addHttpParams(hp, currentCustomHttpParam);
|
|
99
|
+
});
|
|
100
|
+
return hp;
|
|
101
|
+
}
|
|
102
|
+
|
|
65
103
|
// src/js/storage-helpers.ts
|
|
66
104
|
var WRITE_TO_LOCAL_STORAGE = (storageName, obj) => {
|
|
67
105
|
writeToStorage(storageName, obj, true);
|
|
@@ -96,38 +134,6 @@ var writeToStorage = (storageName, obj, isLocalStorage) => {
|
|
|
96
134
|
}
|
|
97
135
|
}
|
|
98
136
|
};
|
|
99
|
-
|
|
100
|
-
// src/js/http-helpers.ts
|
|
101
|
-
var import_http = require("@angular/common/http");
|
|
102
|
-
function createHttpParams(customHttpParams) {
|
|
103
|
-
return addParamsToHttpParamsProcess(new import_http.HttpParams(), customHttpParams);
|
|
104
|
-
}
|
|
105
|
-
function addHttpParams(hp, customHttpParams) {
|
|
106
|
-
if (customHttpParams.needToCheckValue) {
|
|
107
|
-
if (customHttpParams.value === null || customHttpParams.value === void 0) {
|
|
108
|
-
return hp;
|
|
109
|
-
} else {
|
|
110
|
-
return hp.append(customHttpParams.key, customHttpParams.value);
|
|
111
|
-
}
|
|
112
|
-
} else {
|
|
113
|
-
return hp.append(customHttpParams.key, customHttpParams.value);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
function addParamsToHttpParamsProcess(hp, customHttpParams) {
|
|
117
|
-
customHttpParams.forEach((currentCustomHttpParam) => {
|
|
118
|
-
hp = addHttpParams(hp, currentCustomHttpParam);
|
|
119
|
-
});
|
|
120
|
-
return hp;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// src/angular/http-parent.service.ts
|
|
124
|
-
var import_http2 = require("@angular/common/http");
|
|
125
|
-
var import_core = require("@angular/core");
|
|
126
|
-
var HttpParentService = class {
|
|
127
|
-
http = (0, import_core.inject)(import_http2.HttpClient);
|
|
128
|
-
constructor() {
|
|
129
|
-
}
|
|
130
|
-
};
|
|
131
137
|
// Annotate the CommonJS export names for ESM import in node:
|
|
132
138
|
0 && (module.exports = {
|
|
133
139
|
HTTP_HEADER_CONTENT_TYPE,
|
|
@@ -149,5 +155,6 @@ var HttpParentService = class {
|
|
|
149
155
|
WRITE_TO_SESSION_STORAGE,
|
|
150
156
|
addHttpParams,
|
|
151
157
|
createHttpParams,
|
|
152
|
-
debug
|
|
158
|
+
debug,
|
|
159
|
+
formControlSetValue
|
|
153
160
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
// src/angular/http-parent.service.ts
|
|
2
|
+
import { HttpClient } from "@angular/common/http";
|
|
3
|
+
import { inject } from "@angular/core";
|
|
4
|
+
var HttpParentService = class {
|
|
5
|
+
http = inject(HttpClient);
|
|
6
|
+
constructor() {
|
|
7
|
+
}
|
|
4
8
|
};
|
|
5
9
|
|
|
10
|
+
// src/angular/angular-helpers.ts
|
|
11
|
+
function formControlSetValue(formControl, value) {
|
|
12
|
+
formControl.setValue(value);
|
|
13
|
+
}
|
|
14
|
+
|
|
6
15
|
// src/js/common-constants.ts
|
|
7
16
|
var REQUEST_PARAM_PAGE_NUMBER = "pageNumber";
|
|
8
17
|
var REQUEST_PARAM_QUERY = "query";
|
|
@@ -17,6 +26,34 @@ var OBSERVE_BODY = "body";
|
|
|
17
26
|
var HTTP_HEADER_CONTENT_TYPE = "content-type";
|
|
18
27
|
var MIME_TYPE_TEXT_PLAIN = "text/plain";
|
|
19
28
|
|
|
29
|
+
// src/js/common-helpers.ts
|
|
30
|
+
var debug = (message, ...optionalParams) => {
|
|
31
|
+
console.log(message, ...optionalParams);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
// src/js/http-helpers.ts
|
|
35
|
+
import { HttpParams } from "@angular/common/http";
|
|
36
|
+
function createHttpParams(customHttpParams) {
|
|
37
|
+
return addParamsToHttpParamsProcess(new HttpParams(), customHttpParams);
|
|
38
|
+
}
|
|
39
|
+
function addHttpParams(hp, customHttpParams) {
|
|
40
|
+
if (customHttpParams.needToCheckValue) {
|
|
41
|
+
if (customHttpParams.value === null || customHttpParams.value === void 0) {
|
|
42
|
+
return hp;
|
|
43
|
+
} else {
|
|
44
|
+
return hp.append(customHttpParams.key, customHttpParams.value);
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
return hp.append(customHttpParams.key, customHttpParams.value);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function addParamsToHttpParamsProcess(hp, customHttpParams) {
|
|
51
|
+
customHttpParams.forEach((currentCustomHttpParam) => {
|
|
52
|
+
hp = addHttpParams(hp, currentCustomHttpParam);
|
|
53
|
+
});
|
|
54
|
+
return hp;
|
|
55
|
+
}
|
|
56
|
+
|
|
20
57
|
// src/js/storage-helpers.ts
|
|
21
58
|
var WRITE_TO_LOCAL_STORAGE = (storageName, obj) => {
|
|
22
59
|
writeToStorage(storageName, obj, true);
|
|
@@ -51,38 +88,6 @@ var writeToStorage = (storageName, obj, isLocalStorage) => {
|
|
|
51
88
|
}
|
|
52
89
|
}
|
|
53
90
|
};
|
|
54
|
-
|
|
55
|
-
// src/js/http-helpers.ts
|
|
56
|
-
import { HttpParams } from "@angular/common/http";
|
|
57
|
-
function createHttpParams(customHttpParams) {
|
|
58
|
-
return addParamsToHttpParamsProcess(new HttpParams(), customHttpParams);
|
|
59
|
-
}
|
|
60
|
-
function addHttpParams(hp, customHttpParams) {
|
|
61
|
-
if (customHttpParams.needToCheckValue) {
|
|
62
|
-
if (customHttpParams.value === null || customHttpParams.value === void 0) {
|
|
63
|
-
return hp;
|
|
64
|
-
} else {
|
|
65
|
-
return hp.append(customHttpParams.key, customHttpParams.value);
|
|
66
|
-
}
|
|
67
|
-
} else {
|
|
68
|
-
return hp.append(customHttpParams.key, customHttpParams.value);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
function addParamsToHttpParamsProcess(hp, customHttpParams) {
|
|
72
|
-
customHttpParams.forEach((currentCustomHttpParam) => {
|
|
73
|
-
hp = addHttpParams(hp, currentCustomHttpParam);
|
|
74
|
-
});
|
|
75
|
-
return hp;
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// src/angular/http-parent.service.ts
|
|
79
|
-
import { HttpClient } from "@angular/common/http";
|
|
80
|
-
import { inject } from "@angular/core";
|
|
81
|
-
var HttpParentService = class {
|
|
82
|
-
http = inject(HttpClient);
|
|
83
|
-
constructor() {
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
91
|
export {
|
|
87
92
|
HTTP_HEADER_CONTENT_TYPE,
|
|
88
93
|
HttpParentService,
|
|
@@ -103,5 +108,6 @@ export {
|
|
|
103
108
|
WRITE_TO_SESSION_STORAGE,
|
|
104
109
|
addHttpParams,
|
|
105
110
|
createHttpParams,
|
|
106
|
-
debug
|
|
111
|
+
debug,
|
|
112
|
+
formControlSetValue
|
|
107
113
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "jdev_helpers",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.9",
|
|
4
4
|
"description": "jdev helpers for js and angular",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
31
|
"@angular/core": "^20.0.0",
|
|
32
|
-
"@angular/common": "^20.0.0"
|
|
32
|
+
"@angular/common": "^20.0.0",
|
|
33
|
+
"@angular/forms": "^20.0.0"
|
|
33
34
|
}
|
|
34
35
|
}
|