ff-effect 0.0.11 → 0.0.12
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/for/drizzle/index.cjs +3 -3
- package/dist/for/drizzle/index.cjs.map +1 -1
- package/dist/for/drizzle/index.d.cts +2 -2
- package/dist/for/drizzle/index.d.ts +2 -2
- package/dist/for/drizzle/index.js +2 -2
- package/dist/for/drizzle/index.js.map +1 -1
- package/dist/for/inngest/index.cjs +21 -32
- package/dist/for/inngest/index.cjs.map +1 -1
- package/dist/for/inngest/index.d.cts +6 -11
- package/dist/for/inngest/index.d.ts +6 -11
- package/dist/for/inngest/index.js +19 -30
- package/dist/for/inngest/index.js.map +1 -1
- package/package.json +1 -1
- package/src/for/drizzle/index.test.ts +7 -7
- package/src/for/drizzle/index.ts +1 -1
- package/src/for/inngest/index.test.ts +2 -2
- package/src/for/inngest/index.ts +8 -8
- package/src/for/inngest/step.ts +10 -8
|
@@ -39,7 +39,7 @@ __export(drizzle_exports, {
|
|
|
39
39
|
StreamTypeId: () => StreamTypeId2,
|
|
40
40
|
TagTypeId: () => TagTypeId2,
|
|
41
41
|
Unify: () => Unify,
|
|
42
|
-
|
|
42
|
+
createDrizzle: () => createDrizzle
|
|
43
43
|
});
|
|
44
44
|
module.exports = __toCommonJS(drizzle_exports);
|
|
45
45
|
var import_effect = require("effect");
|
|
@@ -63,7 +63,7 @@ var DrizzleError = class extends import_effect.Data.TaggedError("ff-effect/Drizz
|
|
|
63
63
|
var WrappedTxError = class extends Error {
|
|
64
64
|
};
|
|
65
65
|
var defaultPrefix = "@ff-effect/Drizzle";
|
|
66
|
-
function
|
|
66
|
+
function createDrizzle(createClient, opts) {
|
|
67
67
|
const tagId = opts?.tagId ?? defaultPrefix;
|
|
68
68
|
const Drizzle = Context.Tag(tagId)();
|
|
69
69
|
const drizzleTxTagId = `${tagId}.tx`;
|
|
@@ -124,6 +124,6 @@ function createDatabase(createClient, opts) {
|
|
|
124
124
|
StreamTypeId,
|
|
125
125
|
TagTypeId,
|
|
126
126
|
Unify,
|
|
127
|
-
|
|
127
|
+
createDrizzle
|
|
128
128
|
});
|
|
129
129
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/for/drizzle/index.ts"],"sourcesContent":["import { Data, Effect, FiberSet, Layer } from 'effect';\nimport * as Channel from 'effect/Channel';\nimport * as Context from 'effect/Context';\nimport * as Inspectable from 'effect/Inspectable';\nimport * as Sink from 'effect/Sink';\nimport * as STM from 'effect/STM';\nimport * as Stream from 'effect/Stream';\nimport * as EUnify from 'effect/Unify';\n\n// TypeScript issue where the return type of createDatabase\n// contains internal Effect types (TagTypeId) that aren't exported\n// from this module,\n// so TypeScript can't \"name\" them in the declaration file.\nexport const TagTypeId = Context.TagTypeId;\nexport const ChannelTypeId = Channel.ChannelTypeId;\nexport const EffectTypeId = Effect.EffectTypeId;\nexport const NodeInspectSymbol = Inspectable.NodeInspectSymbol;\nexport const STMTypeId = STM.STMTypeId;\nexport const SinkTypeId = Sink.SinkTypeId;\nexport const StreamTypeId = Stream.StreamTypeId;\nexport const Unify = EUnify;\n\nexport class DrizzleError extends Data.TaggedError('ff-effect/DrizzleError')<{\n\tmessage: string;\n\tcause?: unknown;\n}> {}\n\ntype AnyDrizzleClient = {\n\t// biome-ignore lint/suspicious/noExplicitAny: generic client type\n\ttransaction: (fn: (tx: any) => Promise<any>) => Promise<any>;\n};\n\ntype TxClient<TClient extends AnyDrizzleClient> = Parameters<\n\tParameters<TClient['transaction']>[0]\n>[0];\n\nclass WrappedTxError extends Error {}\n\nconst defaultPrefix = '@ff-effect/Drizzle' as const;\n\nexport function
|
|
1
|
+
{"version":3,"sources":["../../../src/for/drizzle/index.ts"],"sourcesContent":["import { Data, Effect, FiberSet, Layer } from 'effect';\nimport * as Channel from 'effect/Channel';\nimport * as Context from 'effect/Context';\nimport * as Inspectable from 'effect/Inspectable';\nimport * as Sink from 'effect/Sink';\nimport * as STM from 'effect/STM';\nimport * as Stream from 'effect/Stream';\nimport * as EUnify from 'effect/Unify';\n\n// TypeScript issue where the return type of createDatabase\n// contains internal Effect types (TagTypeId) that aren't exported\n// from this module,\n// so TypeScript can't \"name\" them in the declaration file.\nexport const TagTypeId = Context.TagTypeId;\nexport const ChannelTypeId = Channel.ChannelTypeId;\nexport const EffectTypeId = Effect.EffectTypeId;\nexport const NodeInspectSymbol = Inspectable.NodeInspectSymbol;\nexport const STMTypeId = STM.STMTypeId;\nexport const SinkTypeId = Sink.SinkTypeId;\nexport const StreamTypeId = Stream.StreamTypeId;\nexport const Unify = EUnify;\n\nexport class DrizzleError extends Data.TaggedError('ff-effect/DrizzleError')<{\n\tmessage: string;\n\tcause?: unknown;\n}> {}\n\ntype AnyDrizzleClient = {\n\t// biome-ignore lint/suspicious/noExplicitAny: generic client type\n\ttransaction: (fn: (tx: any) => Promise<any>) => Promise<any>;\n};\n\ntype TxClient<TClient extends AnyDrizzleClient> = Parameters<\n\tParameters<TClient['transaction']>[0]\n>[0];\n\nclass WrappedTxError extends Error {}\n\nconst defaultPrefix = '@ff-effect/Drizzle' as const;\n\nexport function createDrizzle<\n\tTClient extends AnyDrizzleClient,\n\tE,\n\tR,\n\tT extends string = typeof defaultPrefix,\n>(createClient: Effect.Effect<TClient, E, R>, opts?: { tagId?: T }) {\n\ttype Client = TClient | TxClient<TClient>;\n\ttype Tx = TxClient<TClient>;\n\n\tconst tagId = (opts?.tagId ?? defaultPrefix) as T;\n\n\ttype Drizzle = typeof tagId;\n\tconst Drizzle = Context.Tag(tagId)<Drizzle, Client>();\n\n\tconst drizzleTxTagId = `${tagId}.tx` as const;\n\ttype DrizzleTx = typeof drizzleTxTagId;\n\tconst DrizzleTx = Context.Tag(drizzleTxTagId)<DrizzleTx, Tx>();\n\n\tconst db = <T>(fn: (client: Client) => Promise<T>) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst client = yield* Drizzle;\n\t\t\treturn yield* Effect.tryPromise({\n\t\t\t\ttry: () => fn(client),\n\t\t\t\tcatch: (cause) =>\n\t\t\t\t\tnew DrizzleError({ message: 'Database operation failed', cause }),\n\t\t\t});\n\t\t});\n\n\t/** Requires being inside withTransaction - enforces transaction at compile time */\n\tconst tx = <T>(fn: (client: Tx) => Promise<T>) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst client = yield* DrizzleTx;\n\t\t\treturn yield* Effect.tryPromise({\n\t\t\t\ttry: () => fn(client),\n\t\t\t\tcatch: (cause) =>\n\t\t\t\t\tnew DrizzleError({ message: 'Database operation failed', cause }),\n\t\t\t});\n\t\t});\n\n\tconst withTransaction = <A, E, R>(effect: Effect.Effect<A, E, R>) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst client = yield* Drizzle;\n\t\t\tconst runFork =\n\t\t\t\tyield* FiberSet.makeRuntimePromise<Exclude<R, DrizzleTx>>();\n\n\t\t\treturn yield* Effect.tryPromise<A, E | DrizzleError>({\n\t\t\t\ttry: () =>\n\t\t\t\t\t(client as TClient).transaction((txClient) =>\n\t\t\t\t\t\trunFork(\n\t\t\t\t\t\t\teffect.pipe(\n\t\t\t\t\t\t\t\tEffect.provideService(Drizzle, txClient as Client),\n\t\t\t\t\t\t\t\tEffect.provideService(DrizzleTx, txClient as Tx),\n\t\t\t\t\t\t\t\tEffect.mapError((e) => new WrappedTxError('', { cause: e })),\n\t\t\t\t\t\t\t) as Effect.Effect<A, WrappedTxError, Exclude<R, DrizzleTx>>,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\tcatch: (error) => {\n\t\t\t\t\tif (error instanceof WrappedTxError) return error.cause as E;\n\t\t\t\t\treturn new DrizzleError({\n\t\t\t\t\t\tmessage: 'Transaction failed',\n\t\t\t\t\t\tcause: error,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t});\n\t\t}).pipe(Effect.scoped);\n\n\treturn {\n\t\tdb,\n\t\ttx,\n\t\tDrizzle,\n\t\tDrizzleTx,\n\t\twithTransaction,\n\t\tlayer: Layer.effect(Drizzle, createClient),\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,uBAAAA;AAAA,EAAA;AAAA;AAAA,2BAAAC;AAAA,EAAA,iBAAAC;AAAA,EAAA,kBAAAC;AAAA,EAAA,oBAAAC;AAAA,EAAA,iBAAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA,oBAA8C;AAC9C,cAAyB;AACzB,cAAyB;AACzB,kBAA6B;AAC7B,WAAsB;AACtB,UAAqB;AACrB,aAAwB;AACxB,aAAwB;AAMjB,IAAMA,aAAoB;AAC1B,IAAML,iBAAwB;AAC9B,IAAM,eAAe,qBAAO;AAC5B,IAAMC,qBAAgC;AACtC,IAAMC,aAAgB;AACtB,IAAMC,cAAkB;AACxB,IAAMC,gBAAsB;AAC5B,IAAM,QAAQ;AAEd,IAAM,eAAN,cAA2B,mBAAK,YAAY,wBAAwB,EAGxE;AAAC;AAWJ,IAAM,iBAAN,cAA6B,MAAM;AAAC;AAEpC,IAAM,gBAAgB;AAEf,SAAS,cAKd,cAA4C,MAAsB;AAInE,QAAM,QAAS,MAAM,SAAS;AAG9B,QAAM,UAAkB,YAAI,KAAK,EAAmB;AAEpD,QAAM,iBAAiB,GAAG,KAAK;AAE/B,QAAM,YAAoB,YAAI,cAAc,EAAiB;AAE7D,QAAM,KAAK,CAAI,OACd,qBAAO,IAAI,aAAa;AACvB,UAAM,SAAS,OAAO;AACtB,WAAO,OAAO,qBAAO,WAAW;AAAA,MAC/B,KAAK,MAAM,GAAG,MAAM;AAAA,MACpB,OAAO,CAAC,UACP,IAAI,aAAa,EAAE,SAAS,6BAA6B,MAAM,CAAC;AAAA,IAClE,CAAC;AAAA,EACF,CAAC;AAGF,QAAM,KAAK,CAAI,OACd,qBAAO,IAAI,aAAa;AACvB,UAAM,SAAS,OAAO;AACtB,WAAO,OAAO,qBAAO,WAAW;AAAA,MAC/B,KAAK,MAAM,GAAG,MAAM;AAAA,MACpB,OAAO,CAAC,UACP,IAAI,aAAa,EAAE,SAAS,6BAA6B,MAAM,CAAC;AAAA,IAClE,CAAC;AAAA,EACF,CAAC;AAEF,QAAM,kBAAkB,CAAU,WACjC,qBAAO,IAAI,aAAa;AACvB,UAAM,SAAS,OAAO;AACtB,UAAM,UACL,OAAO,uBAAS,mBAA0C;AAE3D,WAAO,OAAO,qBAAO,WAAgC;AAAA,MACpD,KAAK,MACH,OAAmB;AAAA,QAAY,CAAC,aAChC;AAAA,UACC,OAAO;AAAA,YACN,qBAAO,eAAe,SAAS,QAAkB;AAAA,YACjD,qBAAO,eAAe,WAAW,QAAc;AAAA,YAC/C,qBAAO,SAAS,CAAC,MAAM,IAAI,eAAe,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAAA,UAC5D;AAAA,QACD;AAAA,MACD;AAAA,MACD,OAAO,CAAC,UAAU;AACjB,YAAI,iBAAiB,eAAgB,QAAO,MAAM;AAClD,eAAO,IAAI,aAAa;AAAA,UACvB,SAAS;AAAA,UACT,OAAO;AAAA,QACR,CAAC;AAAA,MACF;AAAA,IACD,CAAC;AAAA,EACF,CAAC,EAAE,KAAK,qBAAO,MAAM;AAEtB,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,oBAAM,OAAO,SAAS,YAAY;AAAA,EAC1C;AACD;","names":["ChannelTypeId","NodeInspectSymbol","STMTypeId","SinkTypeId","StreamTypeId","TagTypeId"]}
|
|
@@ -26,7 +26,7 @@ type AnyDrizzleClient = {
|
|
|
26
26
|
};
|
|
27
27
|
type TxClient<TClient extends AnyDrizzleClient> = Parameters<Parameters<TClient['transaction']>[0]>[0];
|
|
28
28
|
declare const defaultPrefix: "@ff-effect/Drizzle";
|
|
29
|
-
declare function
|
|
29
|
+
declare function createDrizzle<TClient extends AnyDrizzleClient, E, R, T extends string = typeof defaultPrefix>(createClient: Effect.Effect<TClient, E, R>, opts?: {
|
|
30
30
|
tagId?: T;
|
|
31
31
|
}): {
|
|
32
32
|
db: <T_1>(fn: (client: TClient | TxClient<TClient>) => Promise<T_1>) => Effect.Effect<T_1, DrizzleError, T>;
|
|
@@ -37,4 +37,4 @@ declare function createDatabase<TClient extends AnyDrizzleClient, E, R, T extend
|
|
|
37
37
|
layer: Layer.Layer<T, E, R>;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
export { ChannelTypeId, DrizzleError, EffectTypeId, NodeInspectSymbol, STMTypeId, SinkTypeId, StreamTypeId, TagTypeId, Unify,
|
|
40
|
+
export { ChannelTypeId, DrizzleError, EffectTypeId, NodeInspectSymbol, STMTypeId, SinkTypeId, StreamTypeId, TagTypeId, Unify, createDrizzle };
|
|
@@ -26,7 +26,7 @@ type AnyDrizzleClient = {
|
|
|
26
26
|
};
|
|
27
27
|
type TxClient<TClient extends AnyDrizzleClient> = Parameters<Parameters<TClient['transaction']>[0]>[0];
|
|
28
28
|
declare const defaultPrefix: "@ff-effect/Drizzle";
|
|
29
|
-
declare function
|
|
29
|
+
declare function createDrizzle<TClient extends AnyDrizzleClient, E, R, T extends string = typeof defaultPrefix>(createClient: Effect.Effect<TClient, E, R>, opts?: {
|
|
30
30
|
tagId?: T;
|
|
31
31
|
}): {
|
|
32
32
|
db: <T_1>(fn: (client: TClient | TxClient<TClient>) => Promise<T_1>) => Effect.Effect<T_1, DrizzleError, T>;
|
|
@@ -37,4 +37,4 @@ declare function createDatabase<TClient extends AnyDrizzleClient, E, R, T extend
|
|
|
37
37
|
layer: Layer.Layer<T, E, R>;
|
|
38
38
|
};
|
|
39
39
|
|
|
40
|
-
export { ChannelTypeId, DrizzleError, EffectTypeId, NodeInspectSymbol, STMTypeId, SinkTypeId, StreamTypeId, TagTypeId, Unify,
|
|
40
|
+
export { ChannelTypeId, DrizzleError, EffectTypeId, NodeInspectSymbol, STMTypeId, SinkTypeId, StreamTypeId, TagTypeId, Unify, createDrizzle };
|
|
@@ -20,7 +20,7 @@ var DrizzleError = class extends Data.TaggedError("ff-effect/DrizzleError") {
|
|
|
20
20
|
var WrappedTxError = class extends Error {
|
|
21
21
|
};
|
|
22
22
|
var defaultPrefix = "@ff-effect/Drizzle";
|
|
23
|
-
function
|
|
23
|
+
function createDrizzle(createClient, opts) {
|
|
24
24
|
const tagId = opts?.tagId ?? defaultPrefix;
|
|
25
25
|
const Drizzle = Context.Tag(tagId)();
|
|
26
26
|
const drizzleTxTagId = `${tagId}.tx`;
|
|
@@ -80,6 +80,6 @@ export {
|
|
|
80
80
|
StreamTypeId2 as StreamTypeId,
|
|
81
81
|
TagTypeId2 as TagTypeId,
|
|
82
82
|
Unify,
|
|
83
|
-
|
|
83
|
+
createDrizzle
|
|
84
84
|
};
|
|
85
85
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/for/drizzle/index.ts"],"sourcesContent":["import { Data, Effect, FiberSet, Layer } from 'effect';\nimport * as Channel from 'effect/Channel';\nimport * as Context from 'effect/Context';\nimport * as Inspectable from 'effect/Inspectable';\nimport * as Sink from 'effect/Sink';\nimport * as STM from 'effect/STM';\nimport * as Stream from 'effect/Stream';\nimport * as EUnify from 'effect/Unify';\n\n// TypeScript issue where the return type of createDatabase\n// contains internal Effect types (TagTypeId) that aren't exported\n// from this module,\n// so TypeScript can't \"name\" them in the declaration file.\nexport const TagTypeId = Context.TagTypeId;\nexport const ChannelTypeId = Channel.ChannelTypeId;\nexport const EffectTypeId = Effect.EffectTypeId;\nexport const NodeInspectSymbol = Inspectable.NodeInspectSymbol;\nexport const STMTypeId = STM.STMTypeId;\nexport const SinkTypeId = Sink.SinkTypeId;\nexport const StreamTypeId = Stream.StreamTypeId;\nexport const Unify = EUnify;\n\nexport class DrizzleError extends Data.TaggedError('ff-effect/DrizzleError')<{\n\tmessage: string;\n\tcause?: unknown;\n}> {}\n\ntype AnyDrizzleClient = {\n\t// biome-ignore lint/suspicious/noExplicitAny: generic client type\n\ttransaction: (fn: (tx: any) => Promise<any>) => Promise<any>;\n};\n\ntype TxClient<TClient extends AnyDrizzleClient> = Parameters<\n\tParameters<TClient['transaction']>[0]\n>[0];\n\nclass WrappedTxError extends Error {}\n\nconst defaultPrefix = '@ff-effect/Drizzle' as const;\n\nexport function
|
|
1
|
+
{"version":3,"sources":["../../../src/for/drizzle/index.ts"],"sourcesContent":["import { Data, Effect, FiberSet, Layer } from 'effect';\nimport * as Channel from 'effect/Channel';\nimport * as Context from 'effect/Context';\nimport * as Inspectable from 'effect/Inspectable';\nimport * as Sink from 'effect/Sink';\nimport * as STM from 'effect/STM';\nimport * as Stream from 'effect/Stream';\nimport * as EUnify from 'effect/Unify';\n\n// TypeScript issue where the return type of createDatabase\n// contains internal Effect types (TagTypeId) that aren't exported\n// from this module,\n// so TypeScript can't \"name\" them in the declaration file.\nexport const TagTypeId = Context.TagTypeId;\nexport const ChannelTypeId = Channel.ChannelTypeId;\nexport const EffectTypeId = Effect.EffectTypeId;\nexport const NodeInspectSymbol = Inspectable.NodeInspectSymbol;\nexport const STMTypeId = STM.STMTypeId;\nexport const SinkTypeId = Sink.SinkTypeId;\nexport const StreamTypeId = Stream.StreamTypeId;\nexport const Unify = EUnify;\n\nexport class DrizzleError extends Data.TaggedError('ff-effect/DrizzleError')<{\n\tmessage: string;\n\tcause?: unknown;\n}> {}\n\ntype AnyDrizzleClient = {\n\t// biome-ignore lint/suspicious/noExplicitAny: generic client type\n\ttransaction: (fn: (tx: any) => Promise<any>) => Promise<any>;\n};\n\ntype TxClient<TClient extends AnyDrizzleClient> = Parameters<\n\tParameters<TClient['transaction']>[0]\n>[0];\n\nclass WrappedTxError extends Error {}\n\nconst defaultPrefix = '@ff-effect/Drizzle' as const;\n\nexport function createDrizzle<\n\tTClient extends AnyDrizzleClient,\n\tE,\n\tR,\n\tT extends string = typeof defaultPrefix,\n>(createClient: Effect.Effect<TClient, E, R>, opts?: { tagId?: T }) {\n\ttype Client = TClient | TxClient<TClient>;\n\ttype Tx = TxClient<TClient>;\n\n\tconst tagId = (opts?.tagId ?? defaultPrefix) as T;\n\n\ttype Drizzle = typeof tagId;\n\tconst Drizzle = Context.Tag(tagId)<Drizzle, Client>();\n\n\tconst drizzleTxTagId = `${tagId}.tx` as const;\n\ttype DrizzleTx = typeof drizzleTxTagId;\n\tconst DrizzleTx = Context.Tag(drizzleTxTagId)<DrizzleTx, Tx>();\n\n\tconst db = <T>(fn: (client: Client) => Promise<T>) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst client = yield* Drizzle;\n\t\t\treturn yield* Effect.tryPromise({\n\t\t\t\ttry: () => fn(client),\n\t\t\t\tcatch: (cause) =>\n\t\t\t\t\tnew DrizzleError({ message: 'Database operation failed', cause }),\n\t\t\t});\n\t\t});\n\n\t/** Requires being inside withTransaction - enforces transaction at compile time */\n\tconst tx = <T>(fn: (client: Tx) => Promise<T>) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst client = yield* DrizzleTx;\n\t\t\treturn yield* Effect.tryPromise({\n\t\t\t\ttry: () => fn(client),\n\t\t\t\tcatch: (cause) =>\n\t\t\t\t\tnew DrizzleError({ message: 'Database operation failed', cause }),\n\t\t\t});\n\t\t});\n\n\tconst withTransaction = <A, E, R>(effect: Effect.Effect<A, E, R>) =>\n\t\tEffect.gen(function* () {\n\t\t\tconst client = yield* Drizzle;\n\t\t\tconst runFork =\n\t\t\t\tyield* FiberSet.makeRuntimePromise<Exclude<R, DrizzleTx>>();\n\n\t\t\treturn yield* Effect.tryPromise<A, E | DrizzleError>({\n\t\t\t\ttry: () =>\n\t\t\t\t\t(client as TClient).transaction((txClient) =>\n\t\t\t\t\t\trunFork(\n\t\t\t\t\t\t\teffect.pipe(\n\t\t\t\t\t\t\t\tEffect.provideService(Drizzle, txClient as Client),\n\t\t\t\t\t\t\t\tEffect.provideService(DrizzleTx, txClient as Tx),\n\t\t\t\t\t\t\t\tEffect.mapError((e) => new WrappedTxError('', { cause: e })),\n\t\t\t\t\t\t\t) as Effect.Effect<A, WrappedTxError, Exclude<R, DrizzleTx>>,\n\t\t\t\t\t\t),\n\t\t\t\t\t),\n\t\t\t\tcatch: (error) => {\n\t\t\t\t\tif (error instanceof WrappedTxError) return error.cause as E;\n\t\t\t\t\treturn new DrizzleError({\n\t\t\t\t\t\tmessage: 'Transaction failed',\n\t\t\t\t\t\tcause: error,\n\t\t\t\t\t});\n\t\t\t\t},\n\t\t\t});\n\t\t}).pipe(Effect.scoped);\n\n\treturn {\n\t\tdb,\n\t\ttx,\n\t\tDrizzle,\n\t\tDrizzleTx,\n\t\twithTransaction,\n\t\tlayer: Layer.effect(Drizzle, createClient),\n\t};\n}\n"],"mappings":";AAAA,SAAS,MAAM,QAAQ,UAAU,aAAa;AAC9C,YAAY,aAAa;AACzB,YAAY,aAAa;AACzB,YAAY,iBAAiB;AAC7B,YAAY,UAAU;AACtB,YAAY,SAAS;AACrB,YAAY,YAAY;AACxB,YAAY,YAAY;AAMjB,IAAMA,aAAoB;AAC1B,IAAMC,iBAAwB;AAC9B,IAAM,eAAe,OAAO;AAC5B,IAAMC,qBAAgC;AACtC,IAAMC,aAAgB;AACtB,IAAMC,cAAkB;AACxB,IAAMC,gBAAsB;AAC5B,IAAM,QAAQ;AAEd,IAAM,eAAN,cAA2B,KAAK,YAAY,wBAAwB,EAGxE;AAAC;AAWJ,IAAM,iBAAN,cAA6B,MAAM;AAAC;AAEpC,IAAM,gBAAgB;AAEf,SAAS,cAKd,cAA4C,MAAsB;AAInE,QAAM,QAAS,MAAM,SAAS;AAG9B,QAAM,UAAkB,YAAI,KAAK,EAAmB;AAEpD,QAAM,iBAAiB,GAAG,KAAK;AAE/B,QAAM,YAAoB,YAAI,cAAc,EAAiB;AAE7D,QAAM,KAAK,CAAI,OACd,OAAO,IAAI,aAAa;AACvB,UAAM,SAAS,OAAO;AACtB,WAAO,OAAO,OAAO,WAAW;AAAA,MAC/B,KAAK,MAAM,GAAG,MAAM;AAAA,MACpB,OAAO,CAAC,UACP,IAAI,aAAa,EAAE,SAAS,6BAA6B,MAAM,CAAC;AAAA,IAClE,CAAC;AAAA,EACF,CAAC;AAGF,QAAM,KAAK,CAAI,OACd,OAAO,IAAI,aAAa;AACvB,UAAM,SAAS,OAAO;AACtB,WAAO,OAAO,OAAO,WAAW;AAAA,MAC/B,KAAK,MAAM,GAAG,MAAM;AAAA,MACpB,OAAO,CAAC,UACP,IAAI,aAAa,EAAE,SAAS,6BAA6B,MAAM,CAAC;AAAA,IAClE,CAAC;AAAA,EACF,CAAC;AAEF,QAAM,kBAAkB,CAAU,WACjC,OAAO,IAAI,aAAa;AACvB,UAAM,SAAS,OAAO;AACtB,UAAM,UACL,OAAO,SAAS,mBAA0C;AAE3D,WAAO,OAAO,OAAO,WAAgC;AAAA,MACpD,KAAK,MACH,OAAmB;AAAA,QAAY,CAAC,aAChC;AAAA,UACC,OAAO;AAAA,YACN,OAAO,eAAe,SAAS,QAAkB;AAAA,YACjD,OAAO,eAAe,WAAW,QAAc;AAAA,YAC/C,OAAO,SAAS,CAAC,MAAM,IAAI,eAAe,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAAA,UAC5D;AAAA,QACD;AAAA,MACD;AAAA,MACD,OAAO,CAAC,UAAU;AACjB,YAAI,iBAAiB,eAAgB,QAAO,MAAM;AAClD,eAAO,IAAI,aAAa;AAAA,UACvB,SAAS;AAAA,UACT,OAAO;AAAA,QACR,CAAC;AAAA,MACF;AAAA,IACD,CAAC;AAAA,EACF,CAAC,EAAE,KAAK,OAAO,MAAM;AAEtB,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,OAAO,MAAM,OAAO,SAAS,YAAY;AAAA,EAC1C;AACD;","names":["TagTypeId","ChannelTypeId","NodeInspectSymbol","STMTypeId","SinkTypeId","StreamTypeId"]}
|
|
@@ -2833,7 +2833,7 @@ var fromWebHandler = (handler) => Effect13.async((resume, signal) => {
|
|
|
2833
2833
|
});
|
|
2834
2834
|
|
|
2835
2835
|
// src/for/inngest/index.ts
|
|
2836
|
-
var
|
|
2836
|
+
var import_effect4 = require("effect");
|
|
2837
2837
|
var Context9 = __toESM(require("effect/Context"), 1);
|
|
2838
2838
|
var Inspectable7 = __toESM(require("effect/Inspectable"), 1);
|
|
2839
2839
|
var import_bun = require("inngest/bun");
|
|
@@ -2868,57 +2868,46 @@ function cronToString(cron) {
|
|
|
2868
2868
|
}
|
|
2869
2869
|
|
|
2870
2870
|
// src/for/inngest/step.ts
|
|
2871
|
-
var import_effect4 = require("effect");
|
|
2872
|
-
|
|
2873
|
-
// src/run-promise-unwrapped.ts
|
|
2874
2871
|
var import_effect3 = require("effect");
|
|
2875
|
-
async function runPromiseUnwrapped(effect) {
|
|
2876
|
-
const exit2 = await import_effect3.Effect.runPromiseExit(effect);
|
|
2877
|
-
return import_effect3.Exit.match(exit2, {
|
|
2878
|
-
onSuccess: (value) => value,
|
|
2879
|
-
onFailure: (cause) => {
|
|
2880
|
-
throw import_effect3.Cause.isFailType(cause) ? cause.error : cause;
|
|
2881
|
-
}
|
|
2882
|
-
});
|
|
2883
|
-
}
|
|
2884
|
-
|
|
2885
|
-
// src/for/inngest/step.ts
|
|
2886
2872
|
function wrapStep(step) {
|
|
2887
2873
|
const s = step;
|
|
2888
2874
|
return {
|
|
2889
|
-
run: (id, fn) =>
|
|
2890
|
-
|
|
2891
|
-
|
|
2875
|
+
run: (id, fn) => import_effect3.Effect.gen(function* () {
|
|
2876
|
+
const runPromise2 = yield* import_effect3.FiberSet.makeRuntimePromise();
|
|
2877
|
+
return yield* import_effect3.Effect.tryPromise({
|
|
2878
|
+
try: () => s.run(id, () => runPromise2(fn())),
|
|
2879
|
+
catch: (cause) => new InngestError({ message: `Step "${id}" failed`, cause })
|
|
2880
|
+
});
|
|
2892
2881
|
}),
|
|
2893
|
-
sleep: (id, duration) =>
|
|
2894
|
-
try: () => s.sleep(id,
|
|
2882
|
+
sleep: (id, duration) => import_effect3.Effect.tryPromise({
|
|
2883
|
+
try: () => s.sleep(id, import_effect3.Duration.toMillis(import_effect3.Duration.decode(duration))),
|
|
2895
2884
|
catch: (cause) => new InngestError({
|
|
2896
2885
|
message: `Step sleep "${id}" failed`,
|
|
2897
2886
|
cause
|
|
2898
2887
|
})
|
|
2899
2888
|
}),
|
|
2900
|
-
sleepUntil: (id, time) =>
|
|
2889
|
+
sleepUntil: (id, time) => import_effect3.Effect.tryPromise({
|
|
2901
2890
|
try: () => s.sleepUntil(id, time),
|
|
2902
2891
|
catch: (cause) => new InngestError({
|
|
2903
2892
|
message: `Step sleepUntil "${id}" failed`,
|
|
2904
2893
|
cause
|
|
2905
2894
|
})
|
|
2906
2895
|
}),
|
|
2907
|
-
invoke: (id, opts) =>
|
|
2896
|
+
invoke: (id, opts) => import_effect3.Effect.tryPromise({
|
|
2908
2897
|
try: () => s.invoke(id, opts),
|
|
2909
2898
|
catch: (cause) => new InngestError({
|
|
2910
2899
|
message: `Step invoke "${id}" failed`,
|
|
2911
2900
|
cause
|
|
2912
2901
|
})
|
|
2913
2902
|
}),
|
|
2914
|
-
waitForEvent: (id, opts) =>
|
|
2903
|
+
waitForEvent: (id, opts) => import_effect3.Effect.tryPromise({
|
|
2915
2904
|
try: () => s.waitForEvent(id, opts),
|
|
2916
2905
|
catch: (cause) => new InngestError({
|
|
2917
2906
|
message: `Step waitForEvent "${id}" failed`,
|
|
2918
2907
|
cause
|
|
2919
2908
|
})
|
|
2920
2909
|
}),
|
|
2921
|
-
sendEvent: (id, payload) =>
|
|
2910
|
+
sendEvent: (id, payload) => import_effect3.Effect.tryPromise({
|
|
2922
2911
|
try: () => s.sendEvent(id, payload),
|
|
2923
2912
|
catch: (cause) => new InngestError({
|
|
2924
2913
|
message: `Step sendEvent "${id}" failed`,
|
|
@@ -2931,7 +2920,7 @@ function wrapStep(step) {
|
|
|
2931
2920
|
// src/for/inngest/index.ts
|
|
2932
2921
|
var TagTypeId2 = Context9.TagTypeId;
|
|
2933
2922
|
var NodeInspectSymbol4 = Inspectable7.NodeInspectSymbol;
|
|
2934
|
-
var InngestError = class extends
|
|
2923
|
+
var InngestError = class extends import_effect4.Data.TaggedError("ff-effect/InngestError") {
|
|
2935
2924
|
};
|
|
2936
2925
|
function isCronTrigger(trigger) {
|
|
2937
2926
|
return typeof trigger === "object" && trigger !== null && "cron" in trigger && typeof trigger.cron === "object" && trigger.cron !== null && "minutes" in trigger.cron;
|
|
@@ -2951,19 +2940,19 @@ var defaultPrefix = "@ff-effect/Inngest";
|
|
|
2951
2940
|
function createInngest(createClient, opts) {
|
|
2952
2941
|
const tagId = opts?.tagId ?? defaultPrefix;
|
|
2953
2942
|
const Tag3 = Context9.Tag(tagId)();
|
|
2954
|
-
const send = (payload) =>
|
|
2943
|
+
const send = (payload) => import_effect4.Effect.gen(function* () {
|
|
2955
2944
|
const c = yield* Tag3;
|
|
2956
|
-
return yield*
|
|
2945
|
+
return yield* import_effect4.Effect.tryPromise({
|
|
2957
2946
|
// @ts-expect-error inngest generic variance issue between constrained and inferred client types
|
|
2958
2947
|
try: () => c.send(payload),
|
|
2959
2948
|
catch: (cause) => new InngestError({ message: "Failed to send event", cause })
|
|
2960
2949
|
});
|
|
2961
2950
|
});
|
|
2962
|
-
const createFunction = (config, trigger, handler) =>
|
|
2951
|
+
const createFunction = (config, trigger, handler) => import_effect4.Effect.gen(function* () {
|
|
2963
2952
|
const c = yield* Tag3;
|
|
2964
2953
|
const ext_handler = yield* extract(handler);
|
|
2965
2954
|
const resolvedTrigger = resolveTrigger(trigger);
|
|
2966
|
-
const runPromise2 = yield*
|
|
2955
|
+
const runPromise2 = yield* import_effect4.FiberSet.makeRuntimePromise();
|
|
2967
2956
|
return c.createFunction(
|
|
2968
2957
|
config,
|
|
2969
2958
|
resolvedTrigger,
|
|
@@ -2994,17 +2983,17 @@ function createInngest(createClient, opts) {
|
|
|
2994
2983
|
...httpOpts.streaming != null && { streaming: httpOpts.streaming }
|
|
2995
2984
|
});
|
|
2996
2985
|
}
|
|
2997
|
-
const fetchHandler = (httpOpts) =>
|
|
2986
|
+
const fetchHandler = (httpOpts) => import_effect4.Effect.gen(function* () {
|
|
2998
2987
|
const c = yield* Tag3;
|
|
2999
2988
|
return buildServe(c, httpOpts);
|
|
3000
2989
|
});
|
|
3001
|
-
const httpHandler = (httpOpts) =>
|
|
2990
|
+
const httpHandler = (httpOpts) => import_effect4.Effect.gen(function* () {
|
|
3002
2991
|
const c = yield* Tag3;
|
|
3003
2992
|
return HttpApp_exports.fromWebHandler(buildServe(c, httpOpts));
|
|
3004
2993
|
});
|
|
3005
2994
|
return {
|
|
3006
2995
|
Tag: Tag3,
|
|
3007
|
-
layer:
|
|
2996
|
+
layer: import_effect4.Layer.effect(Tag3, createClient),
|
|
3008
2997
|
createFunction,
|
|
3009
2998
|
send,
|
|
3010
2999
|
fetchHandler,
|