@relkit/effect-mq 0.7.2 → 0.7.6
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/postgres.d.ts +18 -12
- package/dist/postgres.d.ts.map +1 -1
- package/dist/postgres.js +24 -1
- package/dist/postgres.js.map +1 -1
- package/dist/postgres.types.d.ts +20 -0
- package/dist/postgres.types.d.ts.map +1 -0
- package/dist/postgres.types.js +2 -0
- package/dist/postgres.types.js.map +1 -0
- package/package.json +5 -5
package/dist/postgres.d.ts
CHANGED
|
@@ -1,16 +1,22 @@
|
|
|
1
|
+
/** Builds lazy native PostgreSQL job-store Layers with scoped driver ownership and explicit timestamp compatibility. */
|
|
2
|
+
import { PgClient } from "@effect/sql-pg";
|
|
3
|
+
import { JobStore } from "effect-mq";
|
|
1
4
|
import { Effect, Layer } from "effect";
|
|
2
|
-
import {
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
readonly flowChildren: ReturnType<typeof mqFlowChildren>;
|
|
10
|
-
readonly flowOutbox: ReturnType<typeof mqFlowOutbox>;
|
|
11
|
-
}
|
|
5
|
+
import type { EffectMqPostgresSchema } from "./postgres.types.js";
|
|
6
|
+
export type { EffectMqPostgresSchema } from "./postgres.types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Builds the existing native store's complete schema without opening a database connection.
|
|
9
|
+
* @param prefix - Validated PostgreSQL job-table name; related table names retain the SDK contract.
|
|
10
|
+
* @returns Native Drizzle tables borrowed by the scoped store Layer.
|
|
11
|
+
*/
|
|
12
12
|
export declare function createEffectMqPostgresSchema(prefix?: string): EffectMqPostgresSchema;
|
|
13
|
-
/**
|
|
14
|
-
|
|
13
|
+
/**
|
|
14
|
+
* Builds the native PostgreSQL store Layer; the calling application owns schema migration and Layer lifetime.
|
|
15
|
+
* @param postgresUrl - Explicit provider connection string, redacted before driver construction.
|
|
16
|
+
* @param prefix - Validated native job-table name.
|
|
17
|
+
* @returns A lazy store Layer retaining native SQL/store failures and requiring no remaining services.
|
|
18
|
+
*/
|
|
19
|
+
export declare function createEffectMqPostgresLayer(postgresUrl: string, prefix?: string): Layer.Layer<JobStore.JobStore, JobStore.JobStoreError | Layer.Error<ReturnType<typeof PgClient.layer>>>;
|
|
20
|
+
/** Existing native Promise edge; callers supply and own the complete store/worker Layer lifetime. */
|
|
15
21
|
export declare const runEffectMq: <A, E>(effect: Effect.Effect<A, E>, options?: Effect.RunOptions | undefined) => Promise<A>;
|
|
16
22
|
//# sourceMappingURL=postgres.d.ts.map
|
package/dist/postgres.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../src/postgres.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"postgres.d.ts","sourceRoot":"","sources":["../src/postgres.ts"],"names":[],"mappings":"AAAA,wHAAwH;AACxH,OAAO,EAAE,QAAQ,EAAW,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AACrC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAoB,MAAM,QAAQ,CAAC;AAYzD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAClE,YAAY,EAAE,sBAAsB,EAAE,MAAM,qBAAqB,CAAC;AAElE;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,SAAmB,GAAG,sBAAsB,CAa9F;AACD;;;;;GAKG;AACH,wBAAgB,2BAA2B,CACzC,WAAW,EAAE,MAAM,EACnB,MAAM,SAAmB,GACxB,KAAK,CAAC,KAAK,CACZ,QAAQ,CAAC,QAAQ,EACjB,QAAQ,CAAC,aAAa,GAAG,KAAK,CAAC,KAAK,CAAC,UAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CACxE,CAkCA;AACD,qGAAqG;AACrG,eAAO,MAAM,WAAW,4FAAoB,CAAC"}
|
package/dist/postgres.js
CHANGED
|
@@ -1,7 +1,14 @@
|
|
|
1
|
+
/** Builds lazy native PostgreSQL job-store Layers with scoped driver ownership and explicit timestamp compatibility. */
|
|
1
2
|
import { PgClient, PgTypes } from "@effect/sql-pg";
|
|
3
|
+
import { JobStore } from "effect-mq";
|
|
2
4
|
import { Effect, Layer, Redacted, Result } from "effect";
|
|
3
5
|
import { EffectMqPgCompatibility } from "./postgres-listen.js";
|
|
4
6
|
import { DrizzleJobStore, mqDedupe, mqFlowChildren, mqFlowOutbox, mqJobAttempts, mqJobs, mqQueueControl, mqSchedules, } from "effect-mq/drizzle-postgres";
|
|
7
|
+
/**
|
|
8
|
+
* Builds the existing native store's complete schema without opening a database connection.
|
|
9
|
+
* @param prefix - Validated PostgreSQL job-table name; related table names retain the SDK contract.
|
|
10
|
+
* @returns Native Drizzle tables borrowed by the scoped store Layer.
|
|
11
|
+
*/
|
|
5
12
|
export function createEffectMqPostgresSchema(prefix = "effect_mq_jobs") {
|
|
6
13
|
if (!/^[a-z][a-z0-9_]{2,62}$/u.test(prefix))
|
|
7
14
|
throw new TypeError("effect-mq table prefix is invalid");
|
|
@@ -16,7 +23,12 @@ export function createEffectMqPostgresSchema(prefix = "effect_mq_jobs") {
|
|
|
16
23
|
flowOutbox: mqFlowOutbox(),
|
|
17
24
|
});
|
|
18
25
|
}
|
|
19
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Builds the native PostgreSQL store Layer; the calling application owns schema migration and Layer lifetime.
|
|
28
|
+
* @param postgresUrl - Explicit provider connection string, redacted before driver construction.
|
|
29
|
+
* @param prefix - Validated native job-table name.
|
|
30
|
+
* @returns A lazy store Layer retaining native SQL/store failures and requiring no remaining services.
|
|
31
|
+
*/
|
|
20
32
|
export function createEffectMqPostgresLayer(postgresUrl, prefix = "effect_mq_jobs") {
|
|
21
33
|
if (typeof postgresUrl !== "string" || postgresUrl.trim() === "")
|
|
22
34
|
throw new TypeError("effect-mq postgres URL is invalid");
|
|
@@ -27,12 +39,23 @@ export function createEffectMqPostgresLayer(postgresUrl, prefix = "effect_mq_job
|
|
|
27
39
|
[PgTypes.OID.timestamptz, PgTypes.OID.timestamptzArray],
|
|
28
40
|
]) {
|
|
29
41
|
types.register(oid, {
|
|
42
|
+
/**
|
|
43
|
+
* Preserves native timestamp encoding for Date and epoch-millisecond inputs.
|
|
44
|
+
* @param value - SDK timestamp input.
|
|
45
|
+
* @returns Native PostgreSQL timestamp encoding.
|
|
46
|
+
*/
|
|
30
47
|
encode: (value) => PgTypes.encode(value instanceof Date ? value.getTime() : value, oid),
|
|
48
|
+
/**
|
|
49
|
+
* Restores the Date values required by the native job-store row contract.
|
|
50
|
+
* @param bytes - SDK timestamp bytes.
|
|
51
|
+
* @returns The native parse result with the decoded Date.
|
|
52
|
+
*/
|
|
31
53
|
decode: (bytes) => Result.map(PgTypes.decode(bytes, oid, 1), (value) => new Date(Number(value))),
|
|
32
54
|
}, { arrayOid });
|
|
33
55
|
}
|
|
34
56
|
const pg = PgClient.layer({ url: Redacted.make(postgresUrl), types });
|
|
35
57
|
return DrizzleJobStore.layer(schema).pipe(Layer.provide(EffectMqPgCompatibility.pipe(Layer.provide(pg))));
|
|
36
58
|
}
|
|
59
|
+
/** Existing native Promise edge; callers supply and own the complete store/worker Layer lifetime. */
|
|
37
60
|
export const runEffectMq = Effect.runPromise;
|
|
38
61
|
//# sourceMappingURL=postgres.js.map
|
package/dist/postgres.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postgres.js","sourceRoot":"","sources":["../src/postgres.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACzD,OAAO,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAC/D,OAAO,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E,CAAC,CAAC,CAAC,CAC/D,CAAC;AACJ,CAAC;AACD,qGAAqG;AACrG,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,UAAU,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Describes the complete native Drizzle PostgreSQL schema used by the scoped effect-mq integration. */
|
|
2
|
+
import type { mqJobs, mqJobAttempts, mqSchedules, mqQueueControl, mqDedupe, mqFlowChildren, mqFlowOutbox } from "effect-mq/drizzle-postgres";
|
|
3
|
+
/** Native table handles retain the SDK's exact row, query and foreign-key contracts. */
|
|
4
|
+
export interface EffectMqPostgresSchema {
|
|
5
|
+
/** Durable job state and acceptance metadata. */
|
|
6
|
+
readonly jobs: ReturnType<typeof mqJobs>;
|
|
7
|
+
/** Ordered native attempt ledger. */
|
|
8
|
+
readonly attempts: ReturnType<typeof mqJobAttempts>;
|
|
9
|
+
/** Provider-owned schedule definitions and next occurrences. */
|
|
10
|
+
readonly schedules: ReturnType<typeof mqSchedules>;
|
|
11
|
+
/** Native queue pause controls. */
|
|
12
|
+
readonly queues: ReturnType<typeof mqQueueControl>;
|
|
13
|
+
/** Native deduplication keys and windows. */
|
|
14
|
+
readonly dedupe: ReturnType<typeof mqDedupe>;
|
|
15
|
+
/** Durable child-flow admission and completion state. */
|
|
16
|
+
readonly flowChildren: ReturnType<typeof mqFlowChildren>;
|
|
17
|
+
/** Provider-owned parent-flow completion outbox. */
|
|
18
|
+
readonly flowOutbox: ReturnType<typeof mqFlowOutbox>;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=postgres.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres.types.d.ts","sourceRoot":"","sources":["../src/postgres.types.ts"],"names":[],"mappings":"AAAA,wGAAwG;AACxG,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,WAAW,EACX,cAAc,EACd,QAAQ,EACR,cAAc,EACd,YAAY,EACb,MAAM,4BAA4B,CAAC;AAEpC,wFAAwF;AACxF,MAAM,WAAW,sBAAsB;IACrC,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,UAAU,CAAC,OAAO,MAAM,CAAC,CAAC;IACzC,qCAAqC;IACrC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;IACpD,gEAAgE;IAChE,QAAQ,CAAC,SAAS,EAAE,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC;IACnD,mCAAmC;IACnC,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;IACnD,6CAA6C;IAC7C,QAAQ,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,QAAQ,CAAC,CAAC;IAC7C,yDAAyD;IACzD,QAAQ,CAAC,YAAY,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;IACzD,oDAAoD;IACpD,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;CACtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"postgres.types.js","sourceRoot":"","sources":["../src/postgres.types.ts"],"names":[],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@relkit/effect-mq",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.6",
|
|
4
4
|
"description": "Effect MQ retryable-jobs integration for RELKIT.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -115,10 +115,10 @@
|
|
|
115
115
|
},
|
|
116
116
|
"dependencies": {
|
|
117
117
|
"@effect/sql-pg": "4.0.1",
|
|
118
|
-
"@relkit/contracts": "0.7.
|
|
119
|
-
"@relkit/jobs": "0.7.
|
|
120
|
-
"@relkit/local-service": "0.7.
|
|
121
|
-
"@relkit/provider": "0.7.
|
|
118
|
+
"@relkit/contracts": "0.7.6",
|
|
119
|
+
"@relkit/jobs": "0.7.6",
|
|
120
|
+
"@relkit/local-service": "0.7.6",
|
|
121
|
+
"@relkit/provider": "0.7.6",
|
|
122
122
|
"drizzle-orm": "1.0.0-rc.5-169397b",
|
|
123
123
|
"effect": "4.0.1",
|
|
124
124
|
"effect-mq": "0.7.0"
|