jdev_helpers 1.4.6 → 1.4.8

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