@intellegens/cornerstone-client-angular 0.0.9999-alpha-5 → 0.0.9999-alpha-7
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intellegens-cornerstone-client-angular.mjs","sources":["../../../../projects/intellegens/cornerstone-client-angular/src/lib/services/AngularHttpService/index.ts","../../../../projects/intellegens/cornerstone-client-angular/src/public-api.ts","../../../../projects/intellegens/cornerstone-client-angular/src/intellegens-cornerstone-client-angular.ts"],"sourcesContent":["// Ignore eslint any error in this file\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { IHttpService, HttpRequestConfig, HttpResponse } from '@intellegens/cornerstone-client';\nimport { HttpClient } from '@angular/common/http';\nimport { firstValueFrom, fromEvent, throwError, switchMap, race } from 'rxjs';\n\n/**\n * Angular HttpClient-based HTTP service implementation\n */\nexport class AngularHttpService implements IHttpService {\n private httpClient: HttpClient;\n\n constructor(httpClient: HttpClient) {\n if (!httpClient) {\n throw new Error('Angular HttpClient instance is required');\n }\n this.httpClient = httpClient;\n }\n\n public async
|
|
1
|
+
{"version":3,"file":"intellegens-cornerstone-client-angular.mjs","sources":["../../../../projects/intellegens/cornerstone-client-angular/src/lib/services/AngularHttpService/index.ts","../../../../projects/intellegens/cornerstone-client-angular/src/public-api.ts","../../../../projects/intellegens/cornerstone-client-angular/src/intellegens-cornerstone-client-angular.ts"],"sourcesContent":["// Ignore eslint any error in this file\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { IHttpService, HttpRequestConfig, HttpResponse } from '@intellegens/cornerstone-client';\nimport { HttpClient } from '@angular/common/http';\nimport { firstValueFrom, fromEvent, throwError, switchMap, race } from 'rxjs';\n\n/**\n * Angular HttpClient-based HTTP service implementation\n */\nexport class AngularHttpService implements IHttpService {\n private httpClient: HttpClient;\n\n constructor(httpClient: HttpClient) {\n if (!httpClient) {\n throw new Error('Angular HttpClient instance is required');\n }\n this.httpClient = httpClient;\n }\n\n public async request<T = any>(url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>> {\n try {\n const method = config?.method || 'GET';\n const headers = config?.headers || {};\n const body = config?.body;\n const withCredentials = config?.credentials === 'include';\n\n const options = {\n headers,\n withCredentials,\n observe: 'response' as const,\n responseType: 'json' as const,\n };\n\n let request: any;\n\n switch (method.toUpperCase()) {\n case 'GET':\n request = this.httpClient.get(url, options);\n break;\n case 'POST':\n request = this.httpClient.post(url, body ? JSON.parse(body) : null, options);\n break;\n case 'PUT':\n request = this.httpClient.put(url, body ? JSON.parse(body) : null, options);\n break;\n case 'DELETE':\n request = this.httpClient.delete(url, options);\n break;\n case 'PATCH':\n request = this.httpClient.patch(url, body ? JSON.parse(body) : null, options);\n break;\n default:\n throw new Error(`Unsupported HTTP method: ${method}`);\n }\n\n // Handle cancellation using AbortSignal\n if (config?.signal) {\n // Check if signal is already aborted\n if (config.signal.aborted) {\n throw new Error('Request was aborted');\n }\n\n const abort$ = fromEvent(config.signal, 'abort').pipe(switchMap(() => throwError(() => new Error('Request was aborted'))));\n\n request = race(request, abort$);\n }\n\n const response = (await firstValueFrom(request)) as any;\n\n // Convert Angular HttpResponse headers to plain object\n const responseHeaders: Record<string, string> = {};\n if (response.headers) {\n response.headers.keys().forEach((key: string) => {\n responseHeaders[key] = response.headers.get(key);\n });\n }\n\n return {\n ok: response.status >= 200 && response.status < 300,\n status: response.status,\n statusText: response.statusText || 'OK',\n headers: responseHeaders,\n json: async () => response.body,\n text: async () => (typeof response.body === 'string' ? response.body : JSON.stringify(response.body)),\n };\n } catch (error: any) {\n if (error.status !== undefined) {\n // Angular HttpErrorResponse\n const errorHeaders: Record<string, string> = {};\n if (error.headers) {\n error.headers.keys().forEach((key: string) => {\n errorHeaders[key] = error.headers.get(key);\n });\n }\n\n return {\n ok: false,\n status: error.status,\n statusText: error.statusText || 'Error',\n headers: errorHeaders,\n json: async () => error.error,\n text: async () => (typeof error.error === 'string' ? error.error : JSON.stringify(error.error)),\n };\n } else {\n // Other errors\n throw error;\n }\n }\n }\n}\n","/*\n * Public API Surface of cornerstone-client-angular\n */\n\nexport * from './lib/';\nexport * from '@intellegens/cornerstone-client';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":[],"mappings":";;;AAAA;AACA;AAMA;;AAEG;MACU,kBAAkB,CAAA;AACrB,IAAA,UAAU;AAElB,IAAA,WAAA,CAAY,UAAsB,EAAA;QAChC,IAAI,CAAC,UAAU,EAAE;AACf,YAAA,MAAM,IAAI,KAAK,CAAC,yCAAyC,CAAC;QAC5D;AACA,QAAA,IAAI,CAAC,UAAU,GAAG,UAAU;IAC9B;AAEO,IAAA,MAAM,OAAO,CAAU,GAAW,EAAE,MAA0B,EAAA;AACnE,QAAA,IAAI;AACF,YAAA,MAAM,MAAM,GAAG,MAAM,EAAE,MAAM,IAAI,KAAK;AACtC,YAAA,MAAM,OAAO,GAAG,MAAM,EAAE,OAAO,IAAI,EAAE;AACrC,YAAA,MAAM,IAAI,GAAG,MAAM,EAAE,IAAI;AACzB,YAAA,MAAM,eAAe,GAAG,MAAM,EAAE,WAAW,KAAK,SAAS;AAEzD,YAAA,MAAM,OAAO,GAAG;gBACd,OAAO;gBACP,eAAe;AACf,gBAAA,OAAO,EAAE,UAAmB;AAC5B,gBAAA,YAAY,EAAE,MAAe;aAC9B;AAED,YAAA,IAAI,OAAY;AAEhB,YAAA,QAAQ,MAAM,CAAC,WAAW,EAAE;AAC1B,gBAAA,KAAK,KAAK;oBACR,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC;oBAC3C;AACF,gBAAA,KAAK,MAAM;oBACT,OAAO,GAAG,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,IAAI,EAAE,OAAO,CAAC;oBAC5E;AACF,gBAAA,KAAK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;iBAChG;YACH;iBAAO;;AAEL,gBAAA,MAAM,KAAK;YACb;QACF;IACF;AACD;;AC9GD;;AAEG;;ACFH;;AAEG;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ import { HttpClient } from '@angular/common/http';
|
|
|
8
8
|
declare class AngularHttpService implements IHttpService {
|
|
9
9
|
private httpClient;
|
|
10
10
|
constructor(httpClient: HttpClient);
|
|
11
|
-
|
|
11
|
+
request<T = any>(url: string, config?: HttpRequestConfig): Promise<HttpResponse<T>>;
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
export { AngularHttpService };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intellegens/cornerstone-client-angular",
|
|
3
|
-
"version": "0.0.9999-alpha-
|
|
3
|
+
"version": "0.0.9999-alpha-7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"publishable": true,
|
|
6
6
|
"sideEffects": false,
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"@angular/platform-browser": "^20.0.0",
|
|
13
13
|
"@angular/router": "^20.0.0",
|
|
14
14
|
"rxjs": "~7.8.0",
|
|
15
|
-
"@intellegens/cornerstone-client": "0.0.9999-alpha-
|
|
15
|
+
"@intellegens/cornerstone-client": "0.0.9999-alpha-7"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"tslib": "^2.3.0"
|