@grom.js/effect-tg 0.2.5 → 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/dist/BotApi.d.ts +3 -5
- package/dist/BotApi.d.ts.map +1 -1
- package/dist/BotApi.js +1 -1
- package/dist/BotApiTransport.d.ts +4 -10
- package/dist/BotApiTransport.d.ts.map +1 -1
- package/dist/BotApiTransport.js +3 -3
- package/dist/BotApiWebhook.d.ts +12 -8
- package/dist/BotApiWebhook.d.ts.map +1 -1
- package/dist/BotApiWebhook.js +14 -21
- package/dist/internal/botApi.d.ts +4 -6
- package/dist/internal/botApi.d.ts.map +1 -1
- package/dist/internal/botApi.js +6 -3
- package/dist/internal/botApiTransport.d.ts +4 -7
- package/dist/internal/botApiTransport.d.ts.map +1 -1
- package/dist/internal/botApiTransport.js +3 -2
- package/package.json +1 -1
package/dist/BotApi.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type * as Layer from 'effect/Layer';
|
|
2
|
+
import type { BotApiTransport } from './BotApiTransport.ts';
|
|
1
3
|
import type { MethodParams, MethodResults } from './internal/botApiMethods.gen.ts';
|
|
2
4
|
import type { BotApiShape } from './internal/botApiShape.gen.ts';
|
|
3
5
|
import type * as Types from './internal/botApiTypes.gen.ts';
|
|
@@ -19,9 +21,5 @@ export declare class BotApiError extends BotApiError_base<{
|
|
|
19
21
|
}> {
|
|
20
22
|
get message(): string;
|
|
21
23
|
}
|
|
22
|
-
export declare const
|
|
23
|
-
transport: {
|
|
24
|
-
sendRequest: (method: string, params: unknown) => import("effect/Effect").Effect<import("./BotApiTransport.ts").BotApiResponse, import("./BotApiTransport.ts").BotApiTransportError>;
|
|
25
|
-
};
|
|
26
|
-
}) => import("effect/Effect").Effect<BotApiShape, never, never>;
|
|
24
|
+
export declare const layer: Layer.Layer<BotApi, never, BotApiTransport>;
|
|
27
25
|
//# sourceMappingURL=BotApi.d.ts.map
|
package/dist/BotApi.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BotApi.d.ts","sourceRoot":"","sources":["../src/BotApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,KAAK,KAAK,KAAK,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAIzC,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,CAAA;;AAElD,qBAAa,MAAO,SAAQ,WAGzB;CAAG;;;;AAEN;;GAEG;AACH,qBAAa,WAAY,SAAQ,iBAAmD;IAClF,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAA;CACtC,CAAC;IACA,IAAa,OAAO,WAEnB;CACF;AAED,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"BotApi.d.ts","sourceRoot":"","sources":["../src/BotApi.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,cAAc,CAAA;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAA;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,KAAK,KAAK,KAAK,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;AAIzC,YAAY,EAAE,YAAY,EAAE,aAAa,EAAE,KAAK,EAAE,CAAA;;AAElD,qBAAa,MAAO,SAAQ,WAGzB;CAAG;;;;AAEN;;GAEG;AACH,qBAAa,WAAY,SAAQ,iBAAmD;IAClF,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAA;CACtC,CAAC;IACA,IAAa,OAAO,WAEnB;CACF;AAED,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,eAAe,CAAkB,CAAA"}
|
package/dist/BotApi.js
CHANGED
|
@@ -29,16 +29,10 @@ export declare class BotApiTransportError extends BotApiTransportError_base<{
|
|
|
29
29
|
cause: unknown;
|
|
30
30
|
}> {
|
|
31
31
|
}
|
|
32
|
-
export declare const
|
|
32
|
+
export declare const layerWith: (options: {
|
|
33
33
|
makeUrl: (method: string) => URL;
|
|
34
|
-
}) =>
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
export declare const makeProd: (token: string) => Effect.Effect<{
|
|
38
|
-
sendRequest: (method: string, params: unknown) => Effect.Effect<BotApiResponse, BotApiTransportError>;
|
|
39
|
-
}, never, import("@effect/platform/HttpClient").HttpClient>;
|
|
40
|
-
export declare const makeTest: (token: string) => Effect.Effect<{
|
|
41
|
-
sendRequest: (method: string, params: unknown) => Effect.Effect<BotApiResponse, BotApiTransportError>;
|
|
42
|
-
}, never, import("@effect/platform/HttpClient").HttpClient>;
|
|
34
|
+
}) => import("effect/Layer").Layer<BotApiTransport, never, import("@effect/platform/HttpClient").HttpClient>;
|
|
35
|
+
export declare const layerProd: (token: string) => import("effect/Layer").Layer<BotApiTransport, never, import("@effect/platform/HttpClient").HttpClient>;
|
|
36
|
+
export declare const layerTest: (token: string) => import("effect/Layer").Layer<BotApiTransport, never, import("@effect/platform/HttpClient").HttpClient>;
|
|
43
37
|
export {};
|
|
44
38
|
//# sourceMappingURL=BotApiTransport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BotApiTransport.d.ts","sourceRoot":"","sources":["../src/BotApiTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,KAAK,KAAK,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;;iBAOxB,CACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,KACZ,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,oBAAoB,CAAC;;AAN5D,qBAAa,eAAgB,SAAQ,oBAQlC;CACF;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB;IACA,EAAE,EAAE,IAAI,CAAA;IACR,MAAM,EAAE,OAAO,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG;IACF,EAAE,EAAE,KAAK,CAAA;IACT,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAA;CACtC,CAAA;;;;AAEH;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,0BAA4D;IACpG,KAAK,EAAE,OAAO,CAAA;CACf,CAAC;CAAG;AAEL,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"BotApiTransport.d.ts","sourceRoot":"","sources":["../src/BotApiTransport.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,MAAM,eAAe,CAAA;AAC5C,OAAO,KAAK,KAAK,KAAK,MAAM,+BAA+B,CAAA;AAC3D,OAAO,KAAK,OAAO,MAAM,gBAAgB,CAAA;;iBAOxB,CACX,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,OAAO,KACZ,MAAM,CAAC,MAAM,CAAC,cAAc,EAAE,oBAAoB,CAAC;;AAN5D,qBAAa,eAAgB,SAAQ,oBAQlC;CACF;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GACtB;IACA,EAAE,EAAE,IAAI,CAAA;IACR,MAAM,EAAE,OAAO,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GAAG;IACF,EAAE,EAAE,KAAK,CAAA;IACT,UAAU,EAAE,MAAM,CAAA;IAClB,WAAW,EAAE,MAAM,CAAA;IACnB,UAAU,CAAC,EAAE,KAAK,CAAC,kBAAkB,CAAA;CACtC,CAAA;;;;AAEH;;GAEG;AACH,qBAAa,oBAAqB,SAAQ,0BAA4D;IACpG,KAAK,EAAE,OAAO,CAAA;CACf,CAAC;CAAG;AAEL,eAAO,MAAM,SAAS;;4GAAqB,CAAA;AAE3C,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,2GAItC,CAAA;AAED,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,2GAItC,CAAA"}
|
package/dist/BotApiTransport.js
CHANGED
|
@@ -8,10 +8,10 @@ export class BotApiTransport extends Context.Tag('@grom.js/effect-tg/BotApiTrans
|
|
|
8
8
|
*/
|
|
9
9
|
export class BotApiTransportError extends Data.TaggedError('@grom.js/effect-tg/BotApiTransportError') {
|
|
10
10
|
}
|
|
11
|
-
export const
|
|
12
|
-
export const
|
|
11
|
+
export const layerWith = internal.layerWith;
|
|
12
|
+
export const layerProd = (token) => (layerWith({
|
|
13
13
|
makeUrl: method => new URL(`https://api.telegram.org/bot${token}/${method}`),
|
|
14
14
|
}));
|
|
15
|
-
export const
|
|
15
|
+
export const layerTest = (token) => (layerWith({
|
|
16
16
|
makeUrl: method => new URL(`https://api.telegram.org/bot${token}/test/${method}`),
|
|
17
17
|
}));
|
package/dist/BotApiWebhook.d.ts
CHANGED
|
@@ -3,30 +3,34 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @see https://core.telegram.org/bots/api#setwebhook
|
|
5
5
|
*/
|
|
6
|
+
import type * as HttpServerError from '@effect/platform/HttpServerError';
|
|
6
7
|
import type * as BotApi from './BotApi.ts';
|
|
7
8
|
import * as HttpApiMiddleware from '@effect/platform/HttpApiMiddleware';
|
|
8
|
-
import * as Context from 'effect/Context';
|
|
9
|
+
import * as $Context from 'effect/Context';
|
|
10
|
+
import * as Effect from 'effect/Effect';
|
|
9
11
|
import * as Layer from 'effect/Layer';
|
|
10
12
|
import * as Redacted from 'effect/Redacted';
|
|
11
13
|
import * as Schema from 'effect/Schema';
|
|
12
14
|
export declare const SECRET_HEADER = "x-telegram-bot-api-secret-token";
|
|
13
15
|
declare const VerificationFailedError_base: Schema.TaggedErrorClass<VerificationFailedError, "@grom.js/effect-tg/BotApiWebhook/VerificationFailedError", {
|
|
14
16
|
readonly _tag: Schema.tag<"@grom.js/effect-tg/BotApiWebhook/VerificationFailedError">;
|
|
15
|
-
} & {
|
|
16
|
-
reason: Schema.Literal<["MISSING_HEADER", "INVALID_SECRET", "INVALID_REQUEST", "BROKEN_TRANSPORT"]>;
|
|
17
17
|
}>;
|
|
18
18
|
export declare class VerificationFailedError extends VerificationFailedError_base {
|
|
19
19
|
}
|
|
20
|
-
declare const
|
|
21
|
-
|
|
20
|
+
declare const Context_base: $Context.TagClass<Context, "@grom.js/effect-tg/BotApiWebhook/Context", {
|
|
21
|
+
update: Effect.Effect<BotApi.Types.Update, HttpServerError.RequestError>;
|
|
22
|
+
}>;
|
|
23
|
+
export declare class Context extends Context_base {
|
|
22
24
|
}
|
|
23
25
|
declare const VerifyMiddleware_base: HttpApiMiddleware.TagClass.Base<VerifyMiddleware, "@grom.js/effect-tg/BotApiWebhook/VerifyMiddleware", {
|
|
24
26
|
readonly optional: false;
|
|
25
27
|
readonly failure: typeof VerificationFailedError;
|
|
26
|
-
readonly provides: typeof
|
|
27
|
-
}, HttpApiMiddleware.HttpApiMiddleware<
|
|
28
|
+
readonly provides: typeof Context;
|
|
29
|
+
}, HttpApiMiddleware.HttpApiMiddleware<{
|
|
30
|
+
update: Effect.Effect<BotApi.Types.Update, HttpServerError.RequestError>;
|
|
31
|
+
}, VerificationFailedError>>;
|
|
28
32
|
export declare class VerifyMiddleware extends VerifyMiddleware_base {
|
|
29
|
-
static
|
|
33
|
+
static layer(options: {
|
|
30
34
|
/**
|
|
31
35
|
* Telegram webhook secret token.
|
|
32
36
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BotApiWebhook.d.ts","sourceRoot":"","sources":["../src/BotApiWebhook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,MAAM,MAAM,aAAa,CAAA;
|
|
1
|
+
{"version":3,"file":"BotApiWebhook.d.ts","sourceRoot":"","sources":["../src/BotApiWebhook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,KAAK,eAAe,MAAM,kCAAkC,CAAA;AACxE,OAAO,KAAK,KAAK,MAAM,MAAM,aAAa,CAAA;AAC1C,OAAO,KAAK,iBAAiB,MAAM,oCAAoC,CAAA;AAGvE,OAAO,KAAK,QAAQ,MAAM,gBAAgB,CAAA;AAC1C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,KAAK,QAAQ,MAAM,iBAAiB,CAAA;AAC3C,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,eAAO,MAAM,aAAa,oCAAoC,CAAA;;;;AAG9D,qBAAa,uBAAwB,SAAQ,4BAO5C;CAAG;;YAIQ,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,eAAe,CAAC,YAAY,CAAC;;AAF5E,qBAAa,OAAQ,SAAQ,YAG1B;CAAG;;;;;;YADM,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,EAAE,eAAe,CAAC,YAAY,CAAC;;AAG5E,qBAAa,gBAAiB,SAAQ,qBAOrC;WACe,KAAK,CAAC,OAAO,EAAE;QAC3B;;WAEG;QACH,MAAM,EAAE,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAA;KAClC;CAkBF"}
|
package/dist/BotApiWebhook.js
CHANGED
|
@@ -3,48 +3,41 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @see https://core.telegram.org/bots/api#setwebhook
|
|
5
5
|
*/
|
|
6
|
-
import { Buffer } from 'node:buffer';
|
|
7
|
-
import * as crypto from 'node:crypto';
|
|
8
6
|
import * as HttpApiMiddleware from '@effect/platform/HttpApiMiddleware';
|
|
9
7
|
import * as HttpApiSchema from '@effect/platform/HttpApiSchema';
|
|
10
8
|
import * as HttpServerRequest from '@effect/platform/HttpServerRequest';
|
|
11
|
-
import * as Context from 'effect/Context';
|
|
9
|
+
import * as $Context from 'effect/Context';
|
|
12
10
|
import * as Effect from 'effect/Effect';
|
|
13
11
|
import * as Layer from 'effect/Layer';
|
|
14
|
-
import * as Match from 'effect/Match';
|
|
15
12
|
import * as Redacted from 'effect/Redacted';
|
|
16
13
|
import * as Schema from 'effect/Schema';
|
|
17
14
|
export const SECRET_HEADER = 'x-telegram-bot-api-secret-token';
|
|
18
15
|
// eslint-disable-next-line unicorn/throw-new-error
|
|
19
|
-
export class VerificationFailedError extends Schema.TaggedError()('@grom.js/effect-tg/BotApiWebhook/VerificationFailedError',
|
|
20
|
-
reason: Schema.Literal('MISSING_HEADER', 'INVALID_SECRET', 'INVALID_REQUEST', 'BROKEN_TRANSPORT'),
|
|
21
|
-
}), HttpApiSchema.annotations({
|
|
16
|
+
export class VerificationFailedError extends Schema.TaggedError()('@grom.js/effect-tg/BotApiWebhook/VerificationFailedError', {}, HttpApiSchema.annotations({
|
|
22
17
|
status: 401,
|
|
23
|
-
description: '
|
|
18
|
+
description: 'Missing or invalid webhook secret.',
|
|
24
19
|
})) {
|
|
25
20
|
}
|
|
26
|
-
export class
|
|
21
|
+
export class Context extends $Context.Tag('@grom.js/effect-tg/BotApiWebhook/Context')() {
|
|
27
22
|
}
|
|
28
23
|
export class VerifyMiddleware extends HttpApiMiddleware.Tag()('@grom.js/effect-tg/BotApiWebhook/VerifyMiddleware', {
|
|
29
24
|
optional: false,
|
|
30
25
|
failure: VerificationFailedError,
|
|
31
|
-
provides:
|
|
26
|
+
provides: Context,
|
|
32
27
|
}) {
|
|
33
|
-
static
|
|
28
|
+
static layer(options) {
|
|
34
29
|
return Layer.succeed(VerifyMiddleware, Effect.gen(function* () {
|
|
35
|
-
const
|
|
36
|
-
const actual =
|
|
30
|
+
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
31
|
+
const actual = request.headers[SECRET_HEADER];
|
|
37
32
|
if (actual == null) {
|
|
38
|
-
return yield* new VerificationFailedError(
|
|
33
|
+
return yield* new VerificationFailedError();
|
|
39
34
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
return yield* new VerificationFailedError({ reason: 'INVALID_SECRET' });
|
|
35
|
+
if (actual !== Redacted.value(options.secret)) {
|
|
36
|
+
return yield* new VerificationFailedError();
|
|
43
37
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
}
|
|
47
|
-
return update;
|
|
38
|
+
return {
|
|
39
|
+
update: Effect.map(request.json, update => update),
|
|
40
|
+
};
|
|
48
41
|
}));
|
|
49
42
|
}
|
|
50
43
|
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
export declare const
|
|
5
|
-
transport: typeof BotApiTransport.Service;
|
|
6
|
-
}) => Effect.Effect<BotApiShape, never, never>;
|
|
1
|
+
import * as Layer from 'effect/Layer';
|
|
2
|
+
import { BotApi } from '../BotApi.ts';
|
|
3
|
+
import { BotApiTransport } from '../BotApiTransport.ts';
|
|
4
|
+
export declare const layer: Layer.Layer<BotApi, never, BotApiTransport>;
|
|
7
5
|
//# sourceMappingURL=botApi.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"botApi.d.ts","sourceRoot":"","sources":["../../src/internal/botApi.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"botApi.d.ts","sourceRoot":"","sources":["../../src/internal/botApi.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,MAAM,EAAe,MAAM,cAAc,CAAA;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,eAAO,MAAM,KAAK,6CA6BjB,CAAA"}
|
package/dist/internal/botApi.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import * as Effect from 'effect/Effect';
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
import * as Layer from 'effect/Layer';
|
|
3
|
+
import { BotApi, BotApiError } from "../BotApi.js";
|
|
4
|
+
import { BotApiTransport } from "../BotApiTransport.js";
|
|
5
|
+
export const layer = Layer.effect(BotApi, Effect.gen(function* () {
|
|
6
|
+
const transport = yield* BotApiTransport;
|
|
4
7
|
const botApi = new Proxy({}, {
|
|
5
8
|
get: (_target, prop) => {
|
|
6
9
|
if (typeof prop !== 'string') {
|
|
@@ -8,7 +11,7 @@ export const make = (options) => (Effect.gen(function* () {
|
|
|
8
11
|
}
|
|
9
12
|
const method = prop;
|
|
10
13
|
return (params = {}) => (Effect.gen(function* () {
|
|
11
|
-
const response = yield*
|
|
14
|
+
const response = yield* transport.sendRequest(method, params);
|
|
12
15
|
if (response.ok) {
|
|
13
16
|
return response.result;
|
|
14
17
|
}
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import type { BotApiResponse } from '../BotApiTransport.ts';
|
|
2
1
|
import * as HttpClient from '@effect/platform/HttpClient';
|
|
3
|
-
import * as
|
|
4
|
-
import {
|
|
5
|
-
export declare const
|
|
2
|
+
import * as Layer from 'effect/Layer';
|
|
3
|
+
import { BotApiTransport } from '../BotApiTransport.ts';
|
|
4
|
+
export declare const layerWith: (options: {
|
|
6
5
|
makeUrl: (method: string) => URL;
|
|
7
|
-
}) =>
|
|
8
|
-
sendRequest: (method: string, params: unknown) => Effect.Effect<BotApiResponse, BotApiTransportError>;
|
|
9
|
-
}, never, HttpClient.HttpClient>;
|
|
6
|
+
}) => Layer.Layer<BotApiTransport, never, HttpClient.HttpClient>;
|
|
10
7
|
//# sourceMappingURL=botApiTransport.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"botApiTransport.d.ts","sourceRoot":"","sources":["../../src/internal/botApiTransport.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"botApiTransport.d.ts","sourceRoot":"","sources":["../../src/internal/botApiTransport.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,UAAU,MAAM,6BAA6B,CAAA;AAEzD,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,eAAe,EAAwB,MAAM,uBAAuB,CAAA;AAE7E,eAAO,MAAM,SAAS,GAAI,SAAS;IACjC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,GAAG,CAAA;CACjC,+DAyBA,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import * as HttpBody from '@effect/platform/HttpBody';
|
|
2
2
|
import * as HttpClient from '@effect/platform/HttpClient';
|
|
3
3
|
import * as Effect from 'effect/Effect';
|
|
4
|
-
import
|
|
5
|
-
|
|
4
|
+
import * as Layer from 'effect/Layer';
|
|
5
|
+
import { BotApiTransport, BotApiTransportError } from "../BotApiTransport.js";
|
|
6
|
+
export const layerWith = (options) => Layer.effect(BotApiTransport, Effect.gen(function* () {
|
|
6
7
|
const { makeUrl } = options;
|
|
7
8
|
const client = yield* HttpClient.HttpClient;
|
|
8
9
|
const transport = {
|