@ng-desktop/http 0.0.0-stage → 0.3.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Gaspar1992 and NgDesktop Engine Contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,14 @@
1
- # Temporary Holding Version
1
+ # @ng-desktop/http
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Native Angular HttpBackend bridging HttpClient, interceptors, and httpResource() to the Rust host
4
+
5
+ Part of **[NgDesktop Engine](https://github.com/Gaspar1992/ng-desktop-engine)** — Native desktop rendering engine for Angular 22+ (`GTK4`, `WinUI 3`, `AppKit`).
6
+
7
+ ## Installation
8
+
9
+ ```bash
10
+ pnpm add @ng-desktop/http
11
+ ```
12
+
13
+ - Repository path: `packages/http-native`
14
+ - Documentation & Ecosystem Guide: https://github.com/Gaspar1992/ng-desktop-engine/blob/main/docs/ECOSYSTEM_COMPATIBILITY.md
@@ -0,0 +1,52 @@
1
+ import { HttpBackend, HttpEvent, HttpFeature, HttpFeatureKind, HttpRequest, withFetch, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXhr, withXsrfConfiguration } from '@angular/common/http';
2
+ import { EnvironmentProviders, InjectionToken } from '@angular/core';
3
+ import { NativeHttpCallKind, NativeHttpConfig } from '@ng-desktop/platform';
4
+ import { Observable } from 'rxjs';
5
+ import * as i0 from "@angular/core";
6
+ export { HttpFeatureKind, withFetch, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXhr, withXsrfConfiguration, };
7
+ /**
8
+ * Injection token holding the resolved `NativeHttpConfig` translated from `provideHttpClient(...)` features.
9
+ */
10
+ export declare const NATIVE_HTTP_CONFIG: InjectionToken<NativeHttpConfig>;
11
+ /**
12
+ * Translates Angular `HttpFeature` configurations (`withFetch`, `withXsrfConfiguration`,
13
+ * `withNoXsrfProtection`, `withInterceptors`, `withJsonpSupport`, and `@ng-desktop/http` features)
14
+ * into a Rust-compatible `NativeHttpConfig`.
15
+ */
16
+ export declare function resolveNativeHttpConfig(features: readonly HttpFeature<HttpFeatureKind>[]): NativeHttpConfig;
17
+ /**
18
+ * Configures native engine HTTP options alongside standard Angular `provideHttpClient(...)` features.
19
+ */
20
+ export declare function withNativeHttpConfig(config: Partial<NativeHttpConfig>): HttpFeature<HttpFeatureKind>;
21
+ /**
22
+ * Enables or disables response caching in the Rust OS-native HTTP engine.
23
+ */
24
+ export declare function withHttpCaching(cacheEnabled: boolean): HttpFeature<HttpFeatureKind>;
25
+ /**
26
+ * Tunes parallel multiplexed HTTP/2 connections for batch and asset transfers in Rust.
27
+ */
28
+ export declare function withParallelBatching(maxParallelConnections: number): HttpFeature<HttpFeatureKind>;
29
+ export declare function detectNativeCallKind(req: HttpRequest<unknown>): NativeHttpCallKind;
30
+ /**
31
+ * Custom Angular `HttpBackend` that bypasses browser `XMLHttpRequest` / `fetch`
32
+ * and executes requests through `globalThis.__NG_NATIVE__.httpRequest` in the Rust OS-native HTTP engine
33
+ * (`libsoup-3.0` on Linux, `NSURLSession` on macOS, `WinHTTP` on Windows).
34
+ * Compatible with `HttpClient`, functional `HttpInterceptorFn`, and `httpResource()`.
35
+ */
36
+ export declare class NativeHttpBackend implements HttpBackend {
37
+ handle(req: HttpRequest<unknown>): Observable<HttpEvent<unknown>>;
38
+ static ɵfac: i0.ɵɵFactoryDeclaration<NativeHttpBackend, never>;
39
+ static ɵprov: i0.ɵɵInjectableDeclaration<any>;
40
+ }
41
+ /**
42
+ * Drop-in Angular `provideHttpClient(...)` provider for native desktop apps.
43
+ * Translates Angular features (`withFetch`, `withInterceptors`, `withXsrfConfiguration`,
44
+ * `withNoXsrfProtection`, `withJsonpSupport`, `withRequestsMadeViaParent`, and native transport
45
+ * helpers) into the Rust OS-native HTTP engine and routes `HttpClient` through `NativeHttpBackend`.
46
+ */
47
+ export declare function provideHttpClient(...features: HttpFeature<HttpFeatureKind>[]): EnvironmentProviders;
48
+ /**
49
+ * Backward-compatible alias for `provideHttpClient(...)`.
50
+ */
51
+ export declare const provideNativeHttpClient: typeof provideHttpClient;
52
+ //# sourceMappingURL=http-backend.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-backend.d.ts","sourceRoot":"","sources":["../../../../packages/http-native/src/http-backend.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,SAAS,EACT,WAAW,EACX,eAAe,EAEf,WAAW,EAGX,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,yBAAyB,EACzB,OAAO,EACP,qBAAqB,EACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,oBAAoB,EAEpB,cA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, HttpErrorResponse, HttpFeatureKind, HttpHeaders, HttpResponse, provideHttpClient as angularProvideHttpClient, withFetch, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXhr, withXsrfConfiguration, } from '@angular/common/http';
2
+ import { Injectable, InjectionToken, makeEnvironmentProviders, } from '@angular/core';
3
+ import { ensureNgNativeBridge } from '@ng-desktop/platform';
4
+ import { Observable } from 'rxjs';
5
+ import * as i0 from "@angular/core";
6
+ export { HttpFeatureKind, withFetch, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNoXsrfProtection, withRequestsMadeViaParent, withXhr, withXsrfConfiguration, };
7
+ /**
8
+ * Injection token holding the resolved `NativeHttpConfig` translated from `provideHttpClient(...)` features.
9
+ */
10
+ export const NATIVE_HTTP_CONFIG = new InjectionToken('NATIVE_HTTP_CONFIG');
11
+ const NATIVE_CONFIG_OVERRIDE_TOKEN = new InjectionToken('NATIVE_HTTP_CONFIG_OVERRIDE');
12
+ function isNativeConfigProvider(item) {
13
+ return (typeof item === 'object' &&
14
+ item !== null &&
15
+ item.provide === NATIVE_CONFIG_OVERRIDE_TOKEN &&
16
+ typeof item.useValue === 'object' &&
17
+ item.useValue !== null);
18
+ }
19
+ function applyXsrfProviders(providers, config) {
20
+ if (!providers) {
21
+ return;
22
+ }
23
+ const stringValues = [];
24
+ for (const item of providers) {
25
+ if (typeof item !== 'object' || item === null) {
26
+ continue;
27
+ }
28
+ const candidate = item;
29
+ if (typeof candidate.useValue !== 'string') {
30
+ continue;
31
+ }
32
+ const desc = String(candidate.provide ?? '');
33
+ if (desc.includes('XSRF_COOKIE_NAME')) {
34
+ config.xsrfCookieName = candidate.useValue;
35
+ }
36
+ else if (desc.includes('XSRF_HEADER_NAME')) {
37
+ config.xsrfHeaderName = candidate.useValue;
38
+ }
39
+ else {
40
+ stringValues.push(candidate.useValue);
41
+ }
42
+ }
43
+ if (stringValues.length >= 1 && config.xsrfCookieName === 'XSRF-TOKEN') {
44
+ config.xsrfCookieName = stringValues[0];
45
+ }
46
+ if (stringValues.length >= 2 && config.xsrfHeaderName === 'X-XSRF-TOKEN') {
47
+ config.xsrfHeaderName = stringValues[1];
48
+ }
49
+ }
50
+ /**
51
+ * Translates Angular `HttpFeature` configurations (`withFetch`, `withXsrfConfiguration`,
52
+ * `withNoXsrfProtection`, `withInterceptors`, `withJsonpSupport`, and `@ng-desktop/http` features)
53
+ * into a Rust-compatible `NativeHttpConfig`.
54
+ */
55
+ export function resolveNativeHttpConfig(features) {
56
+ const config = {
57
+ useFetchTransport: true,
58
+ interceptorsEnabled: true,
59
+ xsrfEnabled: true,
60
+ xsrfCookieName: 'XSRF-TOKEN',
61
+ xsrfHeaderName: 'X-XSRF-TOKEN',
62
+ xsrfTokenValue: '',
63
+ jsonpEnabled: false,
64
+ requestsViaParent: false,
65
+ maxParallelConnections: 24,
66
+ cacheEnabled: true,
67
+ timeoutMs: 15_000,
68
+ };
69
+ for (const feature of features) {
70
+ const internal = feature;
71
+ if (internal.ɵproviders) {
72
+ for (const item of internal.ɵproviders) {
73
+ if (isNativeConfigProvider(item)) {
74
+ Object.assign(config, item.useValue);
75
+ }
76
+ }
77
+ }
78
+ switch (internal.ɵkind) {
79
+ case HttpFeatureKind.Fetch:
80
+ config.useFetchTransport = true;
81
+ break;
82
+ case HttpFeatureKind.Xhr:
83
+ config.useFetchTransport = false;
84
+ break;
85
+ case HttpFeatureKind.Interceptors:
86
+ case HttpFeatureKind.LegacyInterceptors:
87
+ config.interceptorsEnabled = true;
88
+ break;
89
+ case HttpFeatureKind.NoXsrfProtection:
90
+ config.xsrfEnabled = false;
91
+ break;
92
+ case HttpFeatureKind.CustomXsrfConfiguration:
93
+ config.xsrfEnabled = true;
94
+ applyXsrfProviders(internal.ɵproviders, config);
95
+ break;
96
+ case HttpFeatureKind.JsonpSupport:
97
+ config.jsonpEnabled = true;
98
+ break;
99
+ case HttpFeatureKind.RequestsMadeViaParent:
100
+ config.requestsViaParent = true;
101
+ break;
102
+ }
103
+ }
104
+ return config;
105
+ }
106
+ /**
107
+ * Configures native engine HTTP options alongside standard Angular `provideHttpClient(...)` features.
108
+ */
109
+ export function withNativeHttpConfig(config) {
110
+ return {
111
+ ɵkind: HttpFeatureKind.Interceptors,
112
+ ɵproviders: [{ provide: NATIVE_CONFIG_OVERRIDE_TOKEN, useValue: config }],
113
+ };
114
+ }
115
+ /**
116
+ * Enables or disables response caching in the Rust OS-native HTTP engine.
117
+ */
118
+ export function withHttpCaching(cacheEnabled) {
119
+ return withNativeHttpConfig({ cacheEnabled });
120
+ }
121
+ /**
122
+ * Tunes parallel multiplexed HTTP/2 connections for batch and asset transfers in Rust.
123
+ */
124
+ export function withParallelBatching(maxParallelConnections) {
125
+ return withNativeHttpConfig({ maxParallelConnections: Math.max(1, maxParallelConnections) });
126
+ }
127
+ export function detectNativeCallKind(req) {
128
+ const overrideKind = req.headers.get('X-Ng-Native-Call-Kind')?.trim().toLowerCase();
129
+ if (overrideKind === 'graphql' ||
130
+ overrideKind === 'asset' ||
131
+ overrideKind === 'batch' ||
132
+ overrideKind === 'text' ||
133
+ overrideKind === 'json') {
134
+ return overrideKind;
135
+ }
136
+ if (req.responseType === 'arraybuffer' || req.responseType === 'blob') {
137
+ return 'asset';
138
+ }
139
+ if (req.responseType === 'text') {
140
+ return 'text';
141
+ }
142
+ const cleanUrl = req.urlWithParams.split('?')[0].toLowerCase();
143
+ if (req.method.toUpperCase() === 'POST' && cleanUrl.includes('graphql')) {
144
+ return 'graphql';
145
+ }
146
+ if (/\.(png|jpe?g|webp|svg|ico|bin)$/i.test(cleanUrl)) {
147
+ return 'asset';
148
+ }
149
+ if (/\.(txt|html|css|xml|csv)$/i.test(cleanUrl)) {
150
+ return 'text';
151
+ }
152
+ return 'json';
153
+ }
154
+ function extractRequestHeaders(req) {
155
+ const headers = {};
156
+ for (const key of req.headers.keys()) {
157
+ const values = req.headers.getAll(key);
158
+ if (values && values.length > 0) {
159
+ headers[key] = values.join(', ');
160
+ }
161
+ }
162
+ return headers;
163
+ }
164
+ /**
165
+ * Custom Angular `HttpBackend` that bypasses browser `XMLHttpRequest` / `fetch`
166
+ * and executes requests through `globalThis.__NG_NATIVE__.httpRequest` in the Rust OS-native HTTP engine
167
+ * (`libsoup-3.0` on Linux, `NSURLSession` on macOS, `WinHTTP` on Windows).
168
+ * Compatible with `HttpClient`, functional `HttpInterceptorFn`, and `httpResource()`.
169
+ */
170
+ export class NativeHttpBackend {
171
+ handle(req) {
172
+ return new Observable((observer) => {
173
+ try {
174
+ const bridge = ensureNgNativeBridge();
175
+ const serializedBody = req.serializeBody();
176
+ const bodyStr = serializedBody === null || serializedBody === undefined
177
+ ? undefined
178
+ : typeof serializedBody === 'string'
179
+ ? serializedBody
180
+ : JSON.stringify(serializedBody);
181
+ const callKind = detectNativeCallKind(req);
182
+ const rawRes = bridge.httpRequest(req.method, req.urlWithParams, bodyStr, {
183
+ headers: extractRequestHeaders(req),
184
+ responseType: req.responseType,
185
+ callKind,
186
+ withCredentials: req.withCredentials,
187
+ });
188
+ let parsedBody = rawRes.body;
189
+ if (req.responseType === 'json' && rawRes.body.length > 0) {
190
+ try {
191
+ parsedBody = JSON.parse(rawRes.body);
192
+ }
193
+ catch {
194
+ parsedBody = rawRes.body;
195
+ }
196
+ }
197
+ else if (req.responseType === 'blob' && typeof Blob === 'function') {
198
+ parsedBody = new Blob([rawRes.body]);
199
+ }
200
+ else if (req.responseType === 'arraybuffer' && typeof TextEncoder === 'function') {
201
+ parsedBody = new TextEncoder().encode(rawRes.body).buffer;
202
+ }
203
+ const headers = new HttpHeaders(rawRes.headers ?? {});
204
+ if (rawRes.status >= 200 && rawRes.status < 300) {
205
+ observer.next(new HttpResponse({
206
+ body: parsedBody,
207
+ headers,
208
+ status: rawRes.status,
209
+ statusText: rawRes.statusText,
210
+ url: req.urlWithParams,
211
+ }));
212
+ observer.complete();
213
+ }
214
+ else {
215
+ observer.error(new HttpErrorResponse({
216
+ error: parsedBody,
217
+ headers,
218
+ status: rawRes.status,
219
+ statusText: rawRes.statusText,
220
+ url: req.urlWithParams,
221
+ }));
222
+ }
223
+ }
224
+ catch (err) {
225
+ observer.error(err);
226
+ }
227
+ });
228
+ }
229
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeHttpBackend, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
230
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeHttpBackend, providedIn: 'root' });
231
+ }
232
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.2.6", ngImport: i0, type: NativeHttpBackend, decorators: [{
233
+ type: Injectable,
234
+ args: [{ providedIn: 'root' }]
235
+ }] });
236
+ /**
237
+ * Drop-in Angular `provideHttpClient(...)` provider for native desktop apps.
238
+ * Translates Angular features (`withFetch`, `withInterceptors`, `withXsrfConfiguration`,
239
+ * `withNoXsrfProtection`, `withJsonpSupport`, `withRequestsMadeViaParent`, and native transport
240
+ * helpers) into the Rust OS-native HTTP engine and routes `HttpClient` through `NativeHttpBackend`.
241
+ */
242
+ export function provideHttpClient(...features) {
243
+ const resolvedConfig = resolveNativeHttpConfig(features);
244
+ const appliedConfig = ensureNgNativeBridge().configureHttp(resolvedConfig);
245
+ const sanitizedFeatures = features.filter((feature) => {
246
+ const kind = feature.ɵkind;
247
+ return kind !== HttpFeatureKind.Fetch && kind !== HttpFeatureKind.Xhr;
248
+ });
249
+ const providers = [
250
+ angularProvideHttpClient(...sanitizedFeatures),
251
+ { provide: NATIVE_HTTP_CONFIG, useValue: appliedConfig },
252
+ ];
253
+ if (!resolvedConfig.requestsViaParent) {
254
+ providers.push({ provide: HttpBackend, useExisting: NativeHttpBackend });
255
+ }
256
+ return makeEnvironmentProviders(providers);
257
+ }
258
+ /**
259
+ * Backward-compatible alias for `provideHttpClient(...)`.
260
+ */
261
+ export const provideNativeHttpClient = provideHttpClient;
262
+ //# sourceMappingURL=http-backend.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-backend.js","sourceRoot":"","sources":["../../../../packages/http-native/src/http-backend.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EACX,iBAAiB,EAGjB,eAAe,EACf,WAAW,EAEX,YAAY,EACZ,iBAAiB,IAAI,wBAAwB,EAC7C,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,yBAAyB,EACzB,OAAO,EACP,qBAAqB,GACtB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,UAAU,EACV,cAAc,EACd,wBAAwB,GAEzB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAwC,MAAM,sBAAsB,CAAC;AAClG,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;;AAElC,OAAO,EACL,eAAe,EACf,SAAS,EACT,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,yBAAyB,EACzB,OAAO,EACP,qBAAqB,GACtB,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,cAAc,CAAmB,oBAAoB,CAAC,CAAC;AAE7F,MAAM,4BAA4B,GAAG,IAAI,cAAc,CACrD,6BAA6B,CAC9B,CAAC;AAYF,SAAS,sBAAsB,CAC7B,IAAa;IAEb,OAAO,CACL,OAAO,IAAI,KAAK,QAAQ;QACxB,IAAI,KAAK,IAAI;QACZ,IAA0B,CAAC,OAAO,KAAK,4BAA4B;QACpE,OAAQ,IAA0B,CAAC,QAAQ,KAAK,QAAQ;QACvD,IAA0B,CAAC,QAAQ,KAAK,IAAI,CAC9C,CAAC;AACJ,CAAC;AAED,SAAS,kBAAkB,CAAC,SAAgC,EAAE,MAAwB;IACpF,IAAI,CAAC,SAAS,EAAE,CAAC;QACf,OAAO;IACT,CAAC;IACD,MAAM,YAAY,GAAa,EAAE,CAAC;IA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AK,eAAe,CAAC,KAAK,IAAI,IAAI,KAAK,eAAe,CAAC,GAAG,CAAC;IACxE,CAAC,CAAC,CAAC;IAEH,MAAM,SAAS,GAAwC;QACrD,wBAAwB,CAAC,GAAG,iBAAiB,CAAC;QAC9C,EAAE,OAAO,EAAE,kBAAkB,EAAE,QAAQ,EAAE,aAAa,EAAE;KACzD,CAAC;IAEF,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,CAAC;QACtC,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,wBAAwB,CAAC,SAAS,CAAC,CAAC;AAC7C,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,iBAAiB,CAAC","sourcesContent":["import {\n HttpBackend,\n HttpErrorResponse,\n HttpEvent,\n HttpFeature,\n HttpFeatureKind,\n HttpHeaders,\n HttpRequest,\n HttpResponse,\n provideHttpClient as angularProvideHttpClient,\n withFetch,\n withInterceptors,\n withInterceptorsFromDi,\n withJsonpSupport,\n withNoXsrfProtection,\n withRequestsMadeViaParent,\n withXhr,\n withXsrfConfiguration,\n} from '@angular/common/http';\nimport {\n EnvironmentProviders,\n Injectable,\n InjectionToken,\n makeEnvironmentProviders,\n Provider,\n} from '@angular/core';\nimport { ensureNgNativeBridge, NativeHttpCallKind, NativeHttpConfig } from '@ng-desktop/platform';\nimport { Observable } from 'rxjs';\n\nexport {\n HttpFeatureKind,\n withFetch,\n withInterceptors,\n withInterceptorsFromDi,\n withJsonpSupport,\n withNoXsrfProtection,\n withRequestsMadeViaParent,\n withXhr,\n withXsrfConfiguration,\n};\n\n/**\n * Injection token holding the resolved `NativeHttpConfig` translated from `provideHttpClient(...)` features.\n */\nexport const NATIVE_HTTP_CONFIG = new InjectionToken<NativeHttpConfig>('NATIVE_HTTP_CONFIG');\n\nconst NATIVE_CONFIG_OVERRIDE_TOKEN = new InjectionToken<Partial<NativeHttpConfig>>(\n 'NATIVE_HTTP_CONFIG_OVERRIDE',\n);\n\ninterface InternalHttpFeature {\n ɵkind: HttpFeatureKind;\n ɵproviders?: unknown[];\n}\n\ninterface ValueProviderLike {\n provide?: unknown;\n useValue?: unknown;\n}\n\nfunction isNativeConfigProvider(\n item: unknown,\n): item is { provide: unknown; useValue: Partial<NativeHttpConfig> } {\n return (\n typeof item === 'object' &&\n item !== null &&\n (item as ValueProviderLike).provide === NATIVE_CONFIG_OVERRIDE_TOKEN &&\n typeof (item as ValueProviderLike).useValue === 'object' &&\n (item as ValueProviderLike).useValue !== null\n );\n}\n\nfunction applyXsrfProviders(providers: unknown[] | undefined, config: NativeHttpConfig): void {\n if (!providers) {\n return;\n }\n const stringValues: string[] = [];\n for (const item of providers) {\n if (typeof item !== 'object' || item === null) {\n continue;\n }\n const candidate = item as ValueProviderLike;\n if (typeof candidate.useValue !== 'string') {\n continue;\n }\n const desc = String(candidate.provide ?? '');\n if (desc.includes('XSRF_COOKIE_NAME')) {\n config.xsrfCookieName = candidate.useValue;\n } else if (desc.includes('XSRF_HEADER_NAME')) {\n config.xsrfHeaderName = candidate.useValue;\n } else {\n stringValues.push(candidate.useValue);\n }\n }\n if (stringValues.length >= 1 && config.xsrfCookieName === 'XSRF-TOKEN') {\n config.xsrfCookieName = stringValues[0];\n }\n if (stringValues.length >= 2 && config.xsrfHeaderName === 'X-XSRF-TOKEN') {\n config.xsrfHeaderName = stringValues[1];\n }\n}\n\n/**\n * Translates Angular `HttpFeature` configurations (`withFetch`, `withXsrfConfiguration`,\n * `withNoXsrfProtection`, `withInterceptors`, `withJsonpSupport`, and `@ng-desktop/http` features)\n * into a Rust-compatible `NativeHttpConfig`.\n */\nexport function resolveNativeHttpConfig(\n features: readonly HttpFeature<HttpFeatureKind>[],\n): NativeHttpConfig {\n const config: NativeHttpConfig = {\n useFetchTransport: true,\n interceptorsEnabled: true,\n xsrfEnabled: true,\n xsrfCookieName: 'XSRF-TOKEN',\n xsrfHeaderName: 'X-XSRF-TOKEN',\n xsrfTokenValue: '',\n jsonpEnabled: false,\n requestsViaParent: false,\n maxParallelConnections: 24,\n cacheEnabled: true,\n timeoutMs: 15_000,\n };\n\n for (const feature of features) {\n const internal = feature as unknown as InternalHttpFeature;\n if (internal.ɵproviders) {\n for (const item of internal.ɵproviders) {\n if (isNativeConfigProvider(item)) {\n Object.assign(config, item.useValue);\n }\n }\n }\n\n switch (internal.ɵkind) {\n case HttpFeatureKind.Fetch:\n config.useFetchTransport = true;\n break;\n case HttpFeatureKind.Xhr:\n config.useFetchTransport = false;\n break;\n case HttpFeatureKind.Interceptors:\n case HttpFeatureKind.LegacyInterceptors:\n config.interceptorsEnabled = true;\n break;\n case HttpFeatureKind.NoXsrfProtection:\n config.xsrfEnabled = false;\n break;\n case HttpFeatureKind.CustomXsrfConfiguration:\n config.xsrfEnabled = true;\n applyXsrfProviders(internal.ɵproviders, config);\n break;\n case HttpFeatureKind.JsonpSupport:\n config.jsonpEnabled = true;\n break;\n case HttpFeatureKind.RequestsMadeViaParent:\n config.requestsViaParent = true;\n break;\n }\n }\n\n return config;\n}\n\n/**\n * Configures native engine HTTP options alongside standard Angular `provideHttpClient(...)` features.\n */\nexport function withNativeHttpConfig(\n config: Partial<NativeHttpConfig>,\n): HttpFeature<HttpFeatureKind> {\n return {\n ɵkind: HttpFeatureKind.Interceptors,\n ɵproviders: [{ provide: NATIVE_CONFIG_OVERRIDE_TOKEN, useValue: config } satisfies Provider],\n } as unknown as HttpFeature<HttpFeatureKind>;\n}\n\n/**\n * Enables or disables response caching in the Rust OS-native HTTP engine.\n */\nexport function withHttpCaching(cacheEnabled: boolean): HttpFeature<HttpFeatureKind> {\n return withNativeHttpConfig({ cacheEnabled });\n}\n\n/**\n * Tunes parallel multiplexed HTTP/2 connections for batch and asset transfers in Rust.\n */\nexport function withParallelBatching(maxParallelConnections: number): HttpFeature<HttpFeatureKind> {\n return withNativeHttpConfig({ maxParallelConnections: Math.max(1, maxParallelConnections) });\n}\n\nexport function detectNativeCallKind(req: HttpRequest<unknown>): NativeHttpCallKind {\n const overrideKind = req.headers.get('X-Ng-Native-Call-Kind')?.trim().toLowerCase();\n if (\n overrideKind === 'graphql' ||\n overrideKind === 'asset' ||\n overrideKind === 'batch' ||\n overrideKind === 'text' ||\n overrideKind === 'json'\n ) {\n return overrideKind;\n }\n if (req.responseType === 'arraybuffer' || req.responseType === 'blob') {\n return 'asset';\n }\n if (req.responseType === 'text') {\n return 'text';\n }\n const cleanUrl = req.urlWithParams.split('?')[0].toLowerCase();\n if (req.method.toUpperCase() === 'POST' && cleanUrl.includes('graphql')) {\n return 'graphql';\n }\n if (/\\.(png|jpe?g|webp|svg|ico|bin)$/i.test(cleanUrl)) {\n return 'asset';\n }\n if (/\\.(txt|html|css|xml|csv)$/i.test(cleanUrl)) {\n return 'text';\n }\n return 'json';\n}\n\nfunction extractRequestHeaders(req: HttpRequest<unknown>): Record<string, string> {\n const headers: Record<string, string> = {};\n for (const key of req.headers.keys()) {\n const values = req.headers.getAll(key);\n if (values && values.length > 0) {\n headers[key] = values.join(', ');\n }\n }\n return headers;\n}\n\n/**\n * Custom Angular `HttpBackend` that bypasses browser `XMLHttpRequest` / `fetch`\n * and executes requests through `globalThis.__NG_NATIVE__.httpRequest` in the Rust OS-native HTTP engine\n * (`libsoup-3.0` on Linux, `NSURLSession` on macOS, `WinHTTP` on Windows).\n * Compatible with `HttpClient`, functional `HttpInterceptorFn`, and `httpResource()`.\n */\n@Injectable({ providedIn: 'root' })\nexport class NativeHttpBackend implements HttpBackend {\n handle(req: HttpRequest<unknown>): Observable<HttpEvent<unknown>> {\n return new Observable<HttpEvent<unknown>>((observer) => {\n try {\n const bridge = ensureNgNativeBridge();\n const serializedBody = req.serializeBody();\n const bodyStr =\n serializedBody === null || serializedBody === undefined\n ? undefined\n : typeof serializedBody === 'string'\n ? serializedBody\n : JSON.stringify(serializedBody);\n\n const callKind = detectNativeCallKind(req);\n const rawRes = bridge.httpRequest(req.method, req.urlWithParams, bodyStr, {\n headers: extractRequestHeaders(req),\n responseType: req.responseType,\n callKind,\n withCredentials: req.withCredentials,\n });\n\n let parsedBody: unknown = rawRes.body;\n if (req.responseType === 'json' && rawRes.body.length > 0) {\n try {\n parsedBody = JSON.parse(rawRes.body);\n } catch {\n parsedBody = rawRes.body;\n }\n } else if (req.responseType === 'blob' && typeof Blob === 'function') {\n parsedBody = new Blob([rawRes.body]);\n } else if (req.responseType === 'arraybuffer' && typeof TextEncoder === 'function') {\n parsedBody = new TextEncoder().encode(rawRes.body).buffer;\n }\n\n const headers = new HttpHeaders(rawRes.headers ?? {});\n if (rawRes.status >= 200 && rawRes.status < 300) {\n observer.next(\n new HttpResponse({\n body: parsedBody,\n headers,\n status: rawRes.status,\n statusText: rawRes.statusText,\n url: req.urlWithParams,\n }),\n );\n observer.complete();\n } else {\n observer.error(\n new HttpErrorResponse({\n error: parsedBody,\n headers,\n status: rawRes.status,\n statusText: rawRes.statusText,\n url: req.urlWithParams,\n }),\n );\n }\n } catch (err) {\n observer.error(err);\n }\n });\n }\n}\n\n/**\n * Drop-in Angular `provideHttpClient(...)` provider for native desktop apps.\n * Translates Angular features (`withFetch`, `withInterceptors`, `withXsrfConfiguration`,\n * `withNoXsrfProtection`, `withJsonpSupport`, `withRequestsMadeViaParent`, and native transport\n * helpers) into the Rust OS-native HTTP engine and routes `HttpClient` through `NativeHttpBackend`.\n */\nexport function provideHttpClient(\n ...features: HttpFeature<HttpFeatureKind>[]\n): EnvironmentProviders {\n const resolvedConfig = resolveNativeHttpConfig(features);\n const appliedConfig = ensureNgNativeBridge().configureHttp(resolvedConfig);\n\n const sanitizedFeatures = features.filter((feature) => {\n const kind = (feature as unknown as InternalHttpFeature).ɵkind;\n return kind !== HttpFeatureKind.Fetch && kind !== HttpFeatureKind.Xhr;\n });\n\n const providers: (Provider | EnvironmentProviders)[] = [\n angularProvideHttpClient(...sanitizedFeatures),\n { provide: NATIVE_HTTP_CONFIG, useValue: appliedConfig },\n ];\n\n if (!resolvedConfig.requestsViaParent) {\n providers.push({ provide: HttpBackend, useExisting: NativeHttpBackend });\n }\n\n return makeEnvironmentProviders(providers);\n}\n\n/**\n * Backward-compatible alias for `provideHttpClient(...)`.\n */\nexport const provideNativeHttpClient = provideHttpClient;\n"]}
@@ -0,0 +1,23 @@
1
+ import { Signal, WritableSignal } from '@angular/core';
2
+ import { NativeHttpRequestOptions } from '@ng-desktop/platform';
3
+ export type NativeResourceStatus = 'idle' | 'loading' | 'resolved' | 'error';
4
+ export interface NativeHttpResourceOptions<T> {
5
+ request?: NativeHttpRequestOptions;
6
+ defaultValue?: T;
7
+ map?: (raw: unknown) => T;
8
+ }
9
+ export interface NativeHttpResourceRef<T> {
10
+ readonly url: Signal<string | undefined>;
11
+ readonly value: WritableSignal<T | undefined>;
12
+ readonly status: WritableSignal<NativeResourceStatus>;
13
+ readonly error: WritableSignal<unknown>;
14
+ readonly isLoading: Signal<boolean>;
15
+ readonly hasValue: Signal<boolean>;
16
+ reload(): boolean;
17
+ }
18
+ /**
19
+ * Signal-based reactive HTTP resource backed by the OS-native Rust HTTP bridge (`ensureNgNativeBridge()`).
20
+ * Mirrors Angular's `httpResource()` ergonomics (`value`, `status`, `error`, `isLoading`, `hasValue`, `reload`).
21
+ */
22
+ export declare function createNativeHttpResource<T = unknown>(urlOrFn: string | (() => string | undefined), options?: NativeHttpResourceOptions<T>): NativeHttpResourceRef<T>;
23
+ //# sourceMappingURL=http-resource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-resource.d.ts","sourceRoot":"","sources":["../../../../packages/http-native/src/http-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,MAAM,EAAU,cAAc,EAAE,MAAM,eAAe,CAAC;AACzE,OAAO,EAAwB,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAEtF,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,GAAG,OAAO,CAAC;AAE7E,MAAM,WAAW,yBAAyB,CAAC,CAAC;IAC1C,OAAO,CAAC,EAAE,wBAAwB,CAAC;IACnC,YAAY,CAAC,EAAE,CAAC,CAAC;IACjB,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,CAAC,CAAC;CAC3B;AAED,MAAM,WAAW,qBAAqB,CAAC,CAAC;IACtC,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACzC,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC,oBAAoB,CAAC,CAAC;IACtD,QAAQ,CAAC,KAAK,EAAE,cAAc,CAAC,OAAO,CAAC,CAAC;IACxC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IACnC,MAAM,IAAI,OAAO,CAAC;CACnB;AAED;;;GAGG;AACH,wBAAgB,wBAAwB,CAAC,CAAC,GAAG,OAAO,EAClD,OAAO,EAAE,MAAM,GAAG,CAAC,MAAM,MAAM,GAAG,SAAS,CAAC,EAC5C,OAAO,CAAC,EAAE,yBAAyB,CAAC,CAAC,CAAC,GACrC,qBAAqB,CAAC,CAAC,CAAC,CAiE1B"}
@@ -0,0 +1,74 @@
1
+ import { computed, signal } from '@angular/core';
2
+ import { ensureNgNativeBridge } from '@ng-desktop/platform';
3
+ /**
4
+ * Signal-based reactive HTTP resource backed by the OS-native Rust HTTP bridge (`ensureNgNativeBridge()`).
5
+ * Mirrors Angular's `httpResource()` ergonomics (`value`, `status`, `error`, `isLoading`, `hasValue`, `reload`).
6
+ */
7
+ export function createNativeHttpResource(urlOrFn, options) {
8
+ const resolveUrl = () => {
9
+ const raw = typeof urlOrFn === 'function' ? urlOrFn() : urlOrFn;
10
+ const clean = raw?.trim();
11
+ return clean && clean.length > 0 ? clean : undefined;
12
+ };
13
+ const url = computed(() => resolveUrl(), /* @ts-ignore */
14
+ ...(ngDevMode ? [{ debugName: "url" }] : /* istanbul ignore next */ []));
15
+ const value = signal(options?.defaultValue, /* @ts-ignore */
16
+ ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
17
+ const status = signal('idle', /* @ts-ignore */
18
+ ...(ngDevMode ? [{ debugName: "status" }] : /* istanbul ignore next */ []));
19
+ const error = signal(undefined, /* @ts-ignore */
20
+ ...(ngDevMode ? [{ debugName: "error" }] : /* istanbul ignore next */ []));
21
+ const isLoading = computed(() => status() === 'loading', /* @ts-ignore */
22
+ ...(ngDevMode ? [{ debugName: "isLoading" }] : /* istanbul ignore next */ []));
23
+ const hasValue = computed(() => value() !== undefined, /* @ts-ignore */
24
+ ...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
25
+ const reload = () => {
26
+ const targetUrl = resolveUrl();
27
+ if (!targetUrl) {
28
+ status.set('idle');
29
+ error.set(undefined);
30
+ return false;
31
+ }
32
+ status.set('loading');
33
+ error.set(undefined);
34
+ try {
35
+ const bridge = ensureNgNativeBridge();
36
+ const res = bridge.httpRequest('GET', targetUrl, undefined, options?.request);
37
+ if (res.status >= 200 && res.status < 300) {
38
+ const responseType = options?.request?.responseType ?? 'json';
39
+ let parsed = res.body;
40
+ if (responseType === 'json' && typeof res.body === 'string' && res.body.length > 0) {
41
+ parsed = JSON.parse(res.body);
42
+ }
43
+ const finalValue = options?.map ? options.map(parsed) : parsed;
44
+ value.set(finalValue);
45
+ status.set('resolved');
46
+ return true;
47
+ }
48
+ error.set({
49
+ status: res.status,
50
+ statusText: res.statusText,
51
+ body: res.body,
52
+ url: targetUrl,
53
+ });
54
+ status.set('error');
55
+ return false;
56
+ }
57
+ catch (err) {
58
+ error.set(err);
59
+ status.set('error');
60
+ return false;
61
+ }
62
+ };
63
+ reload();
64
+ return {
65
+ url,
66
+ value,
67
+ status,
68
+ error,
69
+ isLoading,
70
+ hasValue,
71
+ reload,
72
+ };
73
+ }
74
+ //# sourceMappingURL=http-resource.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http-resource.js","sourceRoot":"","sources":["../../../../packages/http-native/src/http-resource.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAU,MAAM,EAAkB,MAAM,eAAe,CAAC;AACzE,OAAO,EAAE,oBAAoB,EAA4B,MAAM,sBAAsB,CAAC;AAoBtF;;;GAGG;AACH,MAAM,UAAU,wBAAwB,CACtC,OAA4C,EAC5C,OAAsC;IAEtC,MAAM,UAAU,GAAG,GAAuB,EAAE;QAC1C,MAAM,GAAG,GAAG,OAAO,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;QAChE,MAAM,KAAK,GAAG,GAAG,EAAE,IAAI,EAAE,CAAC;QAC1B,OAAO,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;IACvD,CAAC,CAAC;IAEF,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,UAAU,EAAE;4EAAC,CAAC;IACzC,MAAM,KAAK,GAAG,MAAM,CAAgB,OAAO,EAAE,YAAY;8EAAC,CAAC;IAC3D,MAAM,MAAM,GAAG,MAAM,CAAuB,MAAM;+EAAC,CAAC;IACpD,MAAM,KAAK,GAAG,MAAM,CAAU,SAAS;8EAAC,CAAC;IACzC,MAAM,SAAS,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,MAAM,EAAE,KAAK,SAAS;kFAAC,CAAC;IACzD,MAAM,QAAQ,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,KAAK,SAAS;iFAAC,CAAC;IAEvD,MAAM,MAAM,GAAG,GAAY,EAAE;QAC3B,MAAM,SAAS,GAAG,UAAU,EAAE,CAAC;QAC/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AU;gBAC1B,IAAI,EAAE,GAAG,CAAC,IAAI;gBACd,GAAG,EAAE,SAAS;aACf,CAAC,CAAC;YACH,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACpB,OAAO,KAAK,CAAC;QACf,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACf,MAAM,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACpB,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC,CAAC;IAEF,MAAM,EAAE,CAAC;IAET,OAAO;QACL,GAAG;QACH,KAAK;QACL,MAAM;QACN,KAAK;QACL,SAAS;QACT,QAAQ;QACR,MAAM;KACP,CAAC;AACJ,CAAC","sourcesContent":["import { computed, Signal, signal, WritableSignal } from '@angular/core';\nimport { ensureNgNativeBridge, NativeHttpRequestOptions } from '@ng-desktop/platform';\n\nexport type NativeResourceStatus = 'idle' | 'loading' | 'resolved' | 'error';\n\nexport interface NativeHttpResourceOptions<T> {\n request?: NativeHttpRequestOptions;\n defaultValue?: T;\n map?: (raw: unknown) => T;\n}\n\nexport interface NativeHttpResourceRef<T> {\n readonly url: Signal<string | undefined>;\n readonly value: WritableSignal<T | undefined>;\n readonly status: WritableSignal<NativeResourceStatus>;\n readonly error: WritableSignal<unknown>;\n readonly isLoading: Signal<boolean>;\n readonly hasValue: Signal<boolean>;\n reload(): boolean;\n}\n\n/**\n * Signal-based reactive HTTP resource backed by the OS-native Rust HTTP bridge (`ensureNgNativeBridge()`).\n * Mirrors Angular's `httpResource()` ergonomics (`value`, `status`, `error`, `isLoading`, `hasValue`, `reload`).\n */\nexport function createNativeHttpResource<T = unknown>(\n urlOrFn: string | (() => string | undefined),\n options?: NativeHttpResourceOptions<T>,\n): NativeHttpResourceRef<T> {\n const resolveUrl = (): string | undefined => {\n const raw = typeof urlOrFn === 'function' ? urlOrFn() : urlOrFn;\n const clean = raw?.trim();\n return clean && clean.length > 0 ? clean : undefined;\n };\n\n const url = computed(() => resolveUrl());\n const value = signal<T | undefined>(options?.defaultValue);\n const status = signal<NativeResourceStatus>('idle');\n const error = signal<unknown>(undefined);\n const isLoading = computed(() => status() === 'loading');\n const hasValue = computed(() => value() !== undefined);\n\n const reload = (): boolean => {\n const targetUrl = resolveUrl();\n if (!targetUrl) {\n status.set('idle');\n error.set(undefined);\n return false;\n }\n\n status.set('loading');\n error.set(undefined);\n try {\n const bridge = ensureNgNativeBridge();\n const res = bridge.httpRequest('GET', targetUrl, undefined, options?.request);\n if (res.status >= 200 && res.status < 300) {\n const responseType = options?.request?.responseType ?? 'json';\n let parsed: unknown = res.body;\n if (responseType === 'json' && typeof res.body === 'string' && res.body.length > 0) {\n parsed = JSON.parse(res.body);\n }\n const finalValue = options?.map ? options.map(parsed) : (parsed as T);\n value.set(finalValue);\n status.set('resolved');\n return true;\n }\n\n error.set({\n status: res.status,\n statusText: res.statusText,\n body: res.body,\n url: targetUrl,\n });\n status.set('error');\n return false;\n } catch (err) {\n error.set(err);\n status.set('error');\n return false;\n }\n };\n\n reload();\n\n return {\n url,\n value,\n status,\n error,\n isLoading,\n hasValue,\n reload,\n };\n}\n"]}
@@ -0,0 +1,3 @@
1
+ export { detectNativeCallKind, HttpFeatureKind, NATIVE_HTTP_CONFIG, NativeHttpBackend, provideHttpClient, provideNativeHttpClient, resolveNativeHttpConfig, withFetch, withHttpCaching, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNativeHttpConfig, withNoXsrfProtection, withParallelBatching, withRequestsMadeViaParent, withXhr, withXsrfConfiguration, } from './http-backend';
2
+ export { createNativeHttpResource, type NativeHttpResourceOptions, type NativeHttpResourceRef, type NativeResourceStatus, } from './http-resource';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../packages/http-native/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,OAAO,EACP,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,wBAAwB,EACxB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,KAAK,oBAAoB,GAC1B,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { detectNativeCallKind, HttpFeatureKind, NATIVE_HTTP_CONFIG, NativeHttpBackend, provideHttpClient, provideNativeHttpClient, resolveNativeHttpConfig, withFetch, withHttpCaching, withInterceptors, withInterceptorsFromDi, withJsonpSupport, withNativeHttpConfig, withNoXsrfProtection, withParallelBatching, withRequestsMadeViaParent, withXhr, withXsrfConfiguration, } from './http-backend.js';
2
+ export { createNativeHttpResource, } from './http-resource.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../packages/http-native/src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,uBAAuB,EACvB,uBAAuB,EACvB,SAAS,EACT,eAAe,EACf,gBAAgB,EAChB,sBAAsB,EACtB,gBAAgB,EAChB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,yBAAyB,EACzB,OAAO,EACP,qBAAqB,GACtB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,wBAAwB,GAIzB,MAAM,iBAAiB,CAAC","sourcesContent":["export {\n detectNativeCallKind,\n HttpFeatureKind,\n NATIVE_HTTP_CONFIG,\n NativeHttpBackend,\n provideHttpClient,\n provideNativeHttpClient,\n resolveNativeHttpConfig,\n withFetch,\n withHttpCaching,\n withInterceptors,\n withInterceptorsFromDi,\n withJsonpSupport,\n withNativeHttpConfig,\n withNoXsrfProtection,\n withParallelBatching,\n withRequestsMadeViaParent,\n withXhr,\n withXsrfConfiguration,\n} from './http-backend';\nexport {\n createNativeHttpResource,\n type NativeHttpResourceOptions,\n type NativeHttpResourceRef,\n type NativeResourceStatus,\n} from './http-resource';\n"]}
package/package.json CHANGED
@@ -1,6 +1,53 @@
1
1
  {
2
2
  "name": "@ng-desktop/http",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.3.0",
4
+ "description": "Native Angular HttpBackend bridging HttpClient, interceptors, and httpResource() to the Rust host",
5
+ "license": "MIT",
6
+ "keywords": [
7
+ "angular",
8
+ "angular22",
9
+ "desktop",
10
+ "native",
11
+ "gtk4",
12
+ "winui3",
13
+ "appkit",
14
+ "rust"
15
+ ],
16
+ "homepage": "https://github.com/Gaspar1992/ng-desktop-engine",
17
+ "bugs": {
18
+ "url": "https://github.com/Gaspar1992/ng-desktop-engine/issues"
19
+ },
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/Gaspar1992/ng-desktop-engine.git",
23
+ "directory": "packages/http-native"
24
+ },
25
+ "publishConfig": {
26
+ "access": "public"
27
+ },
28
+ "type": "module",
29
+ "sideEffects": false,
30
+ "files": [
31
+ "fesm2022",
32
+ "README.md",
33
+ "LICENSE"
34
+ ],
35
+ "main": "./fesm2022/index.js",
36
+ "module": "./fesm2022/index.js",
37
+ "types": "./fesm2022/index.d.ts",
38
+ "exports": {
39
+ ".": {
40
+ "types": "./fesm2022/index.d.ts",
41
+ "default": "./fesm2022/index.js"
42
+ },
43
+ "./package.json": {
44
+ "default": "./package.json"
45
+ }
46
+ },
47
+ "peerDependencies": {
48
+ "@angular/common": ">=22.0.0",
49
+ "@angular/core": ">=22.0.0",
50
+ "@ng-desktop/platform": ">=0.3.0",
51
+ "rxjs": ">=7.8.0"
52
+ }
53
+ }