@heddendorp/effect-platform-angular 0.0.3
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/README.md
ADDED
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# effect-platform-angular
|
|
2
|
+
|
|
3
|
+
Angular HttpClient adapter for Effect Platform. Use it to run Effect HttpClient requests with Angular's HttpClient and to power Effect RPC protocol layers in Angular apps.
|
|
4
|
+
|
|
5
|
+
## Quickstart
|
|
6
|
+
|
|
7
|
+
### Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @heddendorp/effect-platform-angular
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
bun add @heddendorp/effect-platform-angular
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Install required peers in your app:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
bun add @effect/platform effect
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
### Register the adapter
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
import { provideHttpClient } from '@angular/common/http';
|
|
27
|
+
import { bootstrapApplication } from '@angular/platform-browser';
|
|
28
|
+
import { provideEffectHttpClient } from '@heddendorp/effect-platform-angular';
|
|
29
|
+
|
|
30
|
+
import { AppComponent } from './app/app.component';
|
|
31
|
+
|
|
32
|
+
bootstrapApplication(AppComponent, {
|
|
33
|
+
providers: [provideHttpClient(), provideEffectHttpClient()],
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### Use the adapter in a service
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { inject, Injectable } from '@angular/core';
|
|
41
|
+
import { HttpClient } from '@effect/platform';
|
|
42
|
+
import * as Effect from 'effect/Effect';
|
|
43
|
+
import { EFFECT_HTTP_CLIENT } from '@heddendorp/effect-platform-angular';
|
|
44
|
+
|
|
45
|
+
@Injectable({ providedIn: 'root' })
|
|
46
|
+
export class ProfileService {
|
|
47
|
+
private readonly httpClient = inject(EFFECT_HTTP_CLIENT);
|
|
48
|
+
|
|
49
|
+
fetchProfile(id: string) {
|
|
50
|
+
const request = HttpClient.get(`https://api.example.com/users/${id}`).pipe(
|
|
51
|
+
Effect.provideService(HttpClient.HttpClient, this.httpClient),
|
|
52
|
+
Effect.flatMap((response) => response.json),
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
return Effect.runPromise(request);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Concepts
|
|
61
|
+
|
|
62
|
+
- Adapter boundaries: `provideEffectHttpClient()` exposes an Effect HttpClient backed by Angular HttpClient.
|
|
63
|
+
- Request mapping: `HttpBody` values become Angular request bodies; stream bodies are buffered into a `Uint8Array`.
|
|
64
|
+
- Response mapping: non-2xx HTTP responses are returned as `HttpClientResponse` values, while transport failures map to `HttpClientError.RequestError`.
|
|
65
|
+
- Cancellation: canceling an Effect fiber aborts the underlying HttpClient subscription.
|
|
66
|
+
- DI + Effect: inject `EFFECT_HTTP_CLIENT` and provide it to Effect with `Effect.provideService(HttpClient.HttpClient, client)`.
|
|
67
|
+
|
|
68
|
+
## Effect RPC (minimal example)
|
|
69
|
+
|
|
70
|
+
This example shows the intended path for using Effect RPC over HTTP with Angular. It assumes you have a server exposing the Effect RPC HTTP protocol at `/rpc` and that `@effect/rpc` is installed in your app. The Angular service is the boundary where you stop Effect-style handling and return Promises to components, so components can inject the client and call procedures directly.
|
|
71
|
+
|
|
72
|
+
```ts
|
|
73
|
+
import { inject, Injectable } from '@angular/core';
|
|
74
|
+
import { HttpClient } from '@effect/platform';
|
|
75
|
+
import { Rpc, RpcClient, RpcClientError, RpcGroup, RpcSerialization } from '@effect/rpc';
|
|
76
|
+
import * as Effect from 'effect/Effect';
|
|
77
|
+
import * as Layer from 'effect/Layer';
|
|
78
|
+
import * as Schema from 'effect/Schema';
|
|
79
|
+
import { EFFECT_HTTP_CLIENT } from '@heddendorp/effect-platform-angular';
|
|
80
|
+
|
|
81
|
+
const Ping = Rpc.make('Ping', {
|
|
82
|
+
payload: Schema.Struct({ message: Schema.String }),
|
|
83
|
+
success: Schema.Struct({ reply: Schema.String }),
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
export class AppRpcs extends RpcGroup.make(Ping) {}
|
|
87
|
+
|
|
88
|
+
type PromiseClient<T> = {
|
|
89
|
+
-readonly [K in keyof T]: T[K] extends (...args: infer Args) => Effect.Effect<infer A, infer _E, infer _R>
|
|
90
|
+
? (...args: Args) => Promise<A>
|
|
91
|
+
: never;
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
type RawClient = RpcClient.FromGroup<typeof AppRpcs, RpcClientError.RpcClientError>;
|
|
95
|
+
type AppRpcPromiseClient = PromiseClient<RawClient>;
|
|
96
|
+
|
|
97
|
+
const createPromiseClient = (
|
|
98
|
+
layer: Layer.Layer<RpcClient.Protocol, never, never>,
|
|
99
|
+
): AppRpcPromiseClient => {
|
|
100
|
+
const runRpc = <A, E>(call: (client: RawClient) => Effect.Effect<A, E, never>): Promise<A> => {
|
|
101
|
+
const program = Effect.flatMap(RpcClient.make(AppRpcs), call).pipe(
|
|
102
|
+
Effect.provide(layer),
|
|
103
|
+
Effect.scoped,
|
|
104
|
+
);
|
|
105
|
+
|
|
106
|
+
return Effect.runPromise(program);
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
const client = {} as AppRpcPromiseClient;
|
|
110
|
+
const procedureKeys = Array.from(AppRpcs.requests.keys()) as Array<keyof RawClient>;
|
|
111
|
+
for (const key of procedureKeys) {
|
|
112
|
+
client[key] = ((...args: Parameters<RawClient[typeof key]>) =>
|
|
113
|
+
runRpc((rpcClient) => rpcClient[key](...args))) as AppRpcPromiseClient[typeof key];
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
return client;
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
@Injectable({ providedIn: 'root' })
|
|
120
|
+
export class AppRpcClient implements AppRpcPromiseClient {
|
|
121
|
+
private readonly httpClient = inject(EFFECT_HTTP_CLIENT);
|
|
122
|
+
private readonly rpcLayer = RpcClient.layerProtocolHttp({ url: '/rpc' }).pipe(
|
|
123
|
+
Layer.provide([
|
|
124
|
+
RpcSerialization.layerJson,
|
|
125
|
+
Layer.succeed(HttpClient.HttpClient, this.httpClient),
|
|
126
|
+
]),
|
|
127
|
+
);
|
|
128
|
+
|
|
129
|
+
readonly Ping: AppRpcPromiseClient['Ping'];
|
|
130
|
+
|
|
131
|
+
constructor() {
|
|
132
|
+
const promiseClient = createPromiseClient(this.rpcLayer);
|
|
133
|
+
this.Ping = promiseClient.Ping;
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## API reference
|
|
139
|
+
|
|
140
|
+
### Providers
|
|
141
|
+
|
|
142
|
+
- `provideEffectHttpClient(): EnvironmentProviders` - registers the Angular HttpClient adapter.
|
|
143
|
+
- `EFFECT_HTTP_CLIENT: InjectionToken<HttpClient.HttpClient>` - the adapter instance to inject and provide to Effect.
|
|
144
|
+
|
|
145
|
+
## Compatibility
|
|
146
|
+
|
|
147
|
+
- Angular 21.x (peer dependency range currently `^21.1.0`)
|
|
148
|
+
- `@effect/platform` 0.94+
|
|
149
|
+
- `effect` 3.19+
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import { HttpHeaders, HttpErrorResponse, HttpResponse, HttpClient as HttpClient$1 } from '@angular/common/http';
|
|
2
|
+
import { InjectionToken, makeEnvironmentProviders, inject } from '@angular/core';
|
|
3
|
+
import { HttpClientError, HttpClientResponse, HttpClient } from '@effect/platform';
|
|
4
|
+
import * as Effect from 'effect/Effect';
|
|
5
|
+
import * as Stream from 'effect/Stream';
|
|
6
|
+
|
|
7
|
+
// Convert Effect stream bodies into a single Uint8Array payload for HttpClient.
|
|
8
|
+
const collectStreamBody = (request, body) => Effect.matchEffect(Effect.scoped(Stream.runFold(body.stream, new Uint8Array(0), appendChunk)), {
|
|
9
|
+
onFailure: (cause) => Effect.fail(new HttpClientError.RequestError({
|
|
10
|
+
request,
|
|
11
|
+
reason: 'Encode',
|
|
12
|
+
cause,
|
|
13
|
+
})),
|
|
14
|
+
onSuccess: (payload) => Effect.succeed(payload),
|
|
15
|
+
});
|
|
16
|
+
const appendChunk = (acc, chunk) => {
|
|
17
|
+
const next = new Uint8Array(acc.length + chunk.length);
|
|
18
|
+
next.set(acc, 0);
|
|
19
|
+
next.set(chunk, acc.length);
|
|
20
|
+
return next;
|
|
21
|
+
};
|
|
22
|
+
// Normalize Effect request bodies into something HttpClient can send.
|
|
23
|
+
const resolveBody = (request) => {
|
|
24
|
+
const body = request.body;
|
|
25
|
+
switch (body._tag) {
|
|
26
|
+
case 'Empty':
|
|
27
|
+
return Effect.succeed(undefined);
|
|
28
|
+
case 'Raw':
|
|
29
|
+
return Effect.succeed(body.body);
|
|
30
|
+
case 'Uint8Array':
|
|
31
|
+
return Effect.succeed(body.body);
|
|
32
|
+
case 'FormData':
|
|
33
|
+
return Effect.succeed(body.formData);
|
|
34
|
+
case 'Stream':
|
|
35
|
+
return collectStreamBody(request, body);
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
// Preserve repeated response headers for the Fetch Response conversion.
|
|
39
|
+
const toHeaderEntries = (headers) => {
|
|
40
|
+
const entries = [];
|
|
41
|
+
for (const name of headers.keys()) {
|
|
42
|
+
const values = headers.getAll(name);
|
|
43
|
+
if (!values) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
for (const value of values) {
|
|
47
|
+
entries.push([name, value]);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return entries;
|
|
51
|
+
};
|
|
52
|
+
// Reuse the Effect response helpers by adapting HttpClient responses to Fetch Response.
|
|
53
|
+
const toEffectResponse = (request, response) => {
|
|
54
|
+
const headers = toHeaderEntries(response.headers);
|
|
55
|
+
const body = response.body ?? null;
|
|
56
|
+
const webResponse = new Response(body, {
|
|
57
|
+
status: response.status,
|
|
58
|
+
statusText: response.statusText ?? '',
|
|
59
|
+
headers,
|
|
60
|
+
});
|
|
61
|
+
return HttpClientResponse.fromWeb(request, webResponse);
|
|
62
|
+
};
|
|
63
|
+
const createAngularHttpClient = (httpClient) => HttpClient.make((request, url, signal) => Effect.flatMap(resolveBody(request), (body) => Effect.async((resume) => {
|
|
64
|
+
const subscription = httpClient
|
|
65
|
+
.request('' + request.method, url.toString(), {
|
|
66
|
+
body,
|
|
67
|
+
headers: new HttpHeaders(request.headers),
|
|
68
|
+
observe: 'response',
|
|
69
|
+
responseType: 'arraybuffer',
|
|
70
|
+
})
|
|
71
|
+
.subscribe({
|
|
72
|
+
next: (response) => resume(Effect.succeed(toEffectResponse(request, response))),
|
|
73
|
+
error: (cause) => {
|
|
74
|
+
// HttpClient reports non-2xx statuses as HttpErrorResponse; map them into a response.
|
|
75
|
+
if (cause instanceof HttpErrorResponse && cause.status !== 0) {
|
|
76
|
+
const response = new HttpResponse({
|
|
77
|
+
body: cause.error ?? null,
|
|
78
|
+
headers: cause.headers,
|
|
79
|
+
status: cause.status,
|
|
80
|
+
statusText: cause.statusText,
|
|
81
|
+
url: cause.url ?? undefined,
|
|
82
|
+
});
|
|
83
|
+
resume(Effect.succeed(toEffectResponse(request, response)));
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
resume(Effect.fail(new HttpClientError.RequestError({
|
|
87
|
+
request,
|
|
88
|
+
reason: 'Transport',
|
|
89
|
+
cause,
|
|
90
|
+
})));
|
|
91
|
+
},
|
|
92
|
+
});
|
|
93
|
+
// Abort signals should cancel the in-flight HttpClient request.
|
|
94
|
+
const abort = () => {
|
|
95
|
+
subscription.unsubscribe();
|
|
96
|
+
};
|
|
97
|
+
if (signal.aborted) {
|
|
98
|
+
abort();
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
signal.addEventListener('abort', abort, { once: true });
|
|
102
|
+
}
|
|
103
|
+
return Effect.sync(() => {
|
|
104
|
+
signal.removeEventListener('abort', abort);
|
|
105
|
+
subscription.unsubscribe();
|
|
106
|
+
});
|
|
107
|
+
})));
|
|
108
|
+
|
|
109
|
+
const EFFECT_HTTP_CLIENT = new InjectionToken('EFFECT_HTTP_CLIENT');
|
|
110
|
+
const provideEffectHttpClient = () => makeEnvironmentProviders([
|
|
111
|
+
{
|
|
112
|
+
provide: EFFECT_HTTP_CLIENT,
|
|
113
|
+
useFactory: () => createAngularHttpClient(inject(HttpClient$1)),
|
|
114
|
+
},
|
|
115
|
+
]);
|
|
116
|
+
|
|
117
|
+
/*
|
|
118
|
+
* Public API Surface of effect-platform-angular
|
|
119
|
+
*/
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Generated bundle index. Do not edit.
|
|
123
|
+
*/
|
|
124
|
+
|
|
125
|
+
export { EFFECT_HTTP_CLIENT, provideEffectHttpClient };
|
|
126
|
+
//# sourceMappingURL=heddendorp-effect-platform-angular.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heddendorp-effect-platform-angular.mjs","sources":["../../../projects/effect-platform-angular/src/lib/http-client-adapter.ts","../../../projects/effect-platform-angular/src/lib/effect-http-client.ts","../../../projects/effect-platform-angular/src/public-api.ts","../../../projects/effect-platform-angular/src/heddendorp-effect-platform-angular.ts"],"sourcesContent":["import {\n HttpClient as AngularHttpClient,\n HttpErrorResponse,\n HttpHeaders,\n HttpResponse,\n} from '@angular/common/http';\nimport {\n HttpBody,\n HttpClient as EffectHttpClient,\n HttpClientError,\n type HttpClientRequest,\n HttpClientResponse,\n} from '@effect/platform';\nimport * as Effect from 'effect/Effect';\nimport * as Stream from 'effect/Stream';\n\n// Convert Effect stream bodies into a single Uint8Array payload for HttpClient.\nconst collectStreamBody = (\n request: HttpClientRequest.HttpClientRequest,\n body: HttpBody.Stream,\n): Effect.Effect<Uint8Array, HttpClientError.RequestError> =>\n Effect.matchEffect(Effect.scoped(Stream.runFold(body.stream, new Uint8Array(0), appendChunk)), {\n onFailure: (cause) =>\n Effect.fail(\n new HttpClientError.RequestError({\n request,\n reason: 'Encode',\n cause,\n }),\n ),\n onSuccess: (payload) => Effect.succeed(payload),\n });\n\nconst appendChunk = (acc: Uint8Array, chunk: Uint8Array): Uint8Array => {\n const next = new Uint8Array(acc.length + chunk.length);\n next.set(acc, 0);\n next.set(chunk, acc.length);\n return next;\n};\n\n// Normalize Effect request bodies into something HttpClient can send.\nconst resolveBody = (\n request: HttpClientRequest.HttpClientRequest,\n): Effect.Effect<unknown, HttpClientError.RequestError> => {\n const body = request.body;\n switch (body._tag) {\n case 'Empty':\n return Effect.succeed(undefined);\n case 'Raw':\n return Effect.succeed(body.body);\n case 'Uint8Array':\n return Effect.succeed(body.body);\n case 'FormData':\n return Effect.succeed(body.formData);\n case 'Stream':\n return collectStreamBody(request, body);\n }\n};\n\n// Preserve repeated response headers for the Fetch Response conversion.\nconst toHeaderEntries = (headers: HttpHeaders): Array<[string, string]> => {\n const entries: Array<[string, string]> = [];\n for (const name of headers.keys()) {\n const values = headers.getAll(name);\n if (!values) {\n continue;\n }\n for (const value of values) {\n entries.push([name, value]);\n }\n }\n return entries;\n};\n\n// Reuse the Effect response helpers by adapting HttpClient responses to Fetch Response.\nconst toEffectResponse = (\n request: HttpClientRequest.HttpClientRequest,\n response: HttpResponse<ArrayBuffer>,\n): HttpClientResponse.HttpClientResponse => {\n const headers = toHeaderEntries(response.headers);\n const body = response.body ?? null;\n const webResponse = new Response(body, {\n status: response.status,\n statusText: response.statusText ?? '',\n headers,\n });\n return HttpClientResponse.fromWeb(request, webResponse);\n};\n\nexport const createAngularHttpClient = (httpClient: AngularHttpClient): EffectHttpClient.HttpClient =>\n EffectHttpClient.make((request, url, signal) =>\n Effect.flatMap(resolveBody(request), (body) =>\n Effect.async((resume) => {\n const subscription = httpClient\n .request('' + request.method, url.toString(), {\n body,\n headers: new HttpHeaders(request.headers),\n observe: 'response',\n responseType: 'arraybuffer',\n })\n .subscribe({\n next: (response) => resume(Effect.succeed(toEffectResponse(request, response))),\n error: (cause) => {\n // HttpClient reports non-2xx statuses as HttpErrorResponse; map them into a response.\n if (cause instanceof HttpErrorResponse && cause.status !== 0) {\n const response = new HttpResponse<ArrayBuffer>({\n body: (cause.error as ArrayBuffer | null) ?? null,\n headers: cause.headers,\n status: cause.status,\n statusText: cause.statusText,\n url: cause.url ?? undefined,\n });\n resume(Effect.succeed(toEffectResponse(request, response)));\n return;\n }\n\n resume(\n Effect.fail(\n new HttpClientError.RequestError({\n request,\n reason: 'Transport',\n cause,\n }),\n ),\n );\n },\n });\n\n // Abort signals should cancel the in-flight HttpClient request.\n const abort = () => {\n subscription.unsubscribe();\n };\n\n if (signal.aborted) {\n abort();\n } else {\n signal.addEventListener('abort', abort, { once: true });\n }\n\n return Effect.sync(() => {\n signal.removeEventListener('abort', abort);\n subscription.unsubscribe();\n });\n }),\n ),\n );\n","import { HttpClient as AngularHttpClient } from '@angular/common/http';\nimport { EnvironmentProviders, InjectionToken, inject, makeEnvironmentProviders } from '@angular/core';\nimport type { HttpClient as EffectHttpClient } from '@effect/platform';\n\nimport { createAngularHttpClient } from './http-client-adapter';\n\nexport const EFFECT_HTTP_CLIENT: InjectionToken<EffectHttpClient.HttpClient> =\n new InjectionToken<EffectHttpClient.HttpClient>('EFFECT_HTTP_CLIENT');\n\nexport const provideEffectHttpClient = (): EnvironmentProviders =>\n makeEnvironmentProviders([\n {\n provide: EFFECT_HTTP_CLIENT,\n useFactory: () => createAngularHttpClient(inject(AngularHttpClient)),\n },\n ]);\n","/*\n * Public API Surface of effect-platform-angular\n */\n\nexport * from './lib/effect-http-client';\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './public-api';\n"],"names":["EffectHttpClient","AngularHttpClient"],"mappings":";;;;;;AAgBA;AACA,MAAM,iBAAiB,GAAG,CACxB,OAA4C,EAC5C,IAAqB,KAErB,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CA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,MAAM,CAAC,IAAI,CAAC,MAAK;AACtB,QAAA,MAAM,CAAC,mBAAmB,CAAC,OAAO,EAAE,KAAK,CAAC;QAC1C,YAAY,CAAC,WAAW,EAAE;AAC5B,IAAA,CAAC,CAAC;AACJ,CAAC,CAAC,CACH,CACF;;MC3IU,kBAAkB,GAC7B,IAAI,cAAc,CAA8B,oBAAoB;MAEzD,uBAAuB,GAAG,MACrC,wBAAwB,CAAC;AACvB,IAAA;AACE,QAAA,OAAO,EAAE,kBAAkB;QAC3B,UAAU,EAAE,MAAM,uBAAuB,CAAC,MAAM,CAACC,YAAiB,CAAC,CAAC;AACrE,KAAA;AACF,CAAA;;ACfH;;AAEG;;ACFH;;AAEG;;;;"}
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@heddendorp/effect-platform-angular",
|
|
3
|
+
"version": "0.0.3",
|
|
4
|
+
"peerDependencies": {
|
|
5
|
+
"@effect/platform": "^0.94.2",
|
|
6
|
+
"@angular/common": "^21.1.0",
|
|
7
|
+
"@angular/core": "^21.1.0",
|
|
8
|
+
"effect": "^3.19.15"
|
|
9
|
+
},
|
|
10
|
+
"dependencies": {
|
|
11
|
+
"tslib": "^2.3.0"
|
|
12
|
+
},
|
|
13
|
+
"repository": {
|
|
14
|
+
"type": "git",
|
|
15
|
+
"url": "git+https://github.com/heddendorp/effect-angular.git",
|
|
16
|
+
"directory": "projects/effect-platform-angular"
|
|
17
|
+
},
|
|
18
|
+
"bugs": {
|
|
19
|
+
"url": "https://github.com/heddendorp/effect-angular/issues"
|
|
20
|
+
},
|
|
21
|
+
"homepage": "https://github.com/heddendorp/effect-angular#readme",
|
|
22
|
+
"publishConfig": {
|
|
23
|
+
"access": "public"
|
|
24
|
+
},
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"module": "fesm2022/heddendorp-effect-platform-angular.mjs",
|
|
27
|
+
"typings": "types/heddendorp-effect-platform-angular.d.ts",
|
|
28
|
+
"exports": {
|
|
29
|
+
"./package.json": {
|
|
30
|
+
"default": "./package.json"
|
|
31
|
+
},
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./types/heddendorp-effect-platform-angular.d.ts",
|
|
34
|
+
"default": "./fesm2022/heddendorp-effect-platform-angular.mjs"
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { InjectionToken, EnvironmentProviders } from '@angular/core';
|
|
2
|
+
import { HttpClient } from '@effect/platform';
|
|
3
|
+
|
|
4
|
+
declare const EFFECT_HTTP_CLIENT: InjectionToken<HttpClient.HttpClient>;
|
|
5
|
+
declare const provideEffectHttpClient: () => EnvironmentProviders;
|
|
6
|
+
|
|
7
|
+
export { EFFECT_HTTP_CLIENT, provideEffectHttpClient };
|