@cardano-sdk/projection-typeorm 0.5.3 → 0.7.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/cjs/TypeormStabilityWindowBuffer.d.ts +6 -7
- package/dist/cjs/TypeormStabilityWindowBuffer.d.ts.map +1 -1
- package/dist/cjs/TypeormStabilityWindowBuffer.js +40 -108
- package/dist/cjs/TypeormStabilityWindowBuffer.js.map +1 -1
- package/dist/cjs/createDataSource.d.ts +13 -0
- package/dist/cjs/createDataSource.d.ts.map +1 -1
- package/dist/cjs/createDataSource.js +53 -2
- package/dist/cjs/createDataSource.js.map +1 -1
- package/dist/cjs/createTypeormTipTracker.d.ts +16 -0
- package/dist/cjs/createTypeormTipTracker.d.ts.map +1 -0
- package/dist/cjs/createTypeormTipTracker.js +55 -0
- package/dist/cjs/createTypeormTipTracker.js.map +1 -0
- package/dist/cjs/entity/Address.entity.d.ts.map +1 -1
- package/dist/cjs/entity/Address.entity.js.map +1 -1
- package/dist/cjs/entity/CurrentPoolMetrics.entity.d.ts +2 -1
- package/dist/cjs/entity/CurrentPoolMetrics.entity.d.ts.map +1 -1
- package/dist/cjs/entity/CurrentPoolMetrics.entity.js +15 -11
- package/dist/cjs/entity/CurrentPoolMetrics.entity.js.map +1 -1
- package/dist/cjs/entity/Handle.entity.d.ts.map +1 -1
- package/dist/cjs/entity/Handle.entity.js.map +1 -1
- package/dist/cjs/entity/HandleMetadata.entity.d.ts.map +1 -1
- package/dist/cjs/entity/HandleMetadata.entity.js.map +1 -1
- package/dist/cjs/entity/NftMetadata.entity.d.ts.map +1 -1
- package/dist/cjs/entity/NftMetadata.entity.js.map +1 -1
- package/dist/cjs/entity/PoolDelisted.entity.d.ts +5 -0
- package/dist/cjs/entity/PoolDelisted.entity.d.ts.map +1 -0
- package/dist/cjs/entity/PoolDelisted.entity.js +25 -0
- package/dist/cjs/entity/PoolDelisted.entity.js.map +1 -0
- package/dist/cjs/entity/PoolRegistration.entity.d.ts +1 -0
- package/dist/cjs/entity/PoolRegistration.entity.d.ts.map +1 -1
- package/dist/cjs/entity/PoolRegistration.entity.js +4 -0
- package/dist/cjs/entity/PoolRegistration.entity.js.map +1 -1
- package/dist/cjs/entity/PoolRetirement.entity.d.ts +1 -0
- package/dist/cjs/entity/PoolRetirement.entity.d.ts.map +1 -1
- package/dist/cjs/entity/PoolRetirement.entity.js +4 -0
- package/dist/cjs/entity/PoolRetirement.entity.js.map +1 -1
- package/dist/cjs/entity/PoolRewards.entity.d.ts +18 -0
- package/dist/cjs/entity/PoolRewards.entity.d.ts.map +1 -0
- package/dist/cjs/entity/PoolRewards.entity.js +77 -0
- package/dist/cjs/entity/PoolRewards.entity.js.map +1 -0
- package/dist/cjs/entity/StakeKeyRegistration.entity.d.ts.map +1 -1
- package/dist/cjs/entity/StakeKeyRegistration.entity.js.map +1 -1
- package/dist/cjs/entity/index.d.ts +12 -10
- package/dist/cjs/entity/index.d.ts.map +1 -1
- package/dist/cjs/entity/index.js +12 -10
- package/dist/cjs/entity/index.js.map +1 -1
- package/dist/cjs/entity/util.d.ts.map +1 -1
- package/dist/cjs/entity/util.js.map +1 -1
- package/dist/cjs/index.d.ts +4 -5
- package/dist/cjs/index.d.ts.map +1 -1
- package/dist/cjs/index.js +4 -10
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/operators/index.d.ts +10 -9
- package/dist/cjs/operators/index.d.ts.map +1 -1
- package/dist/cjs/operators/index.js +10 -11
- package/dist/cjs/operators/index.js.map +1 -1
- package/dist/cjs/operators/storePoolMetricsUpdateJob.d.ts +1 -1
- package/dist/cjs/operators/storePoolMetricsUpdateJob.d.ts.map +1 -1
- package/dist/cjs/operators/storePoolMetricsUpdateJob.js +20 -4
- package/dist/cjs/operators/storePoolMetricsUpdateJob.js.map +1 -1
- package/dist/cjs/operators/storeStakePoolMetadataJob.d.ts.map +1 -1
- package/dist/cjs/operators/storeStakePoolMetadataJob.js +3 -6
- package/dist/cjs/operators/storeStakePoolMetadataJob.js.map +1 -1
- package/dist/cjs/operators/storeStakePoolRewardsJob.d.ts +3 -0
- package/dist/cjs/operators/storeStakePoolRewardsJob.d.ts.map +1 -0
- package/dist/cjs/operators/storeStakePoolRewardsJob.js +16 -0
- package/dist/cjs/operators/storeStakePoolRewardsJob.js.map +1 -0
- package/dist/cjs/operators/withTypeormTransaction.d.ts +10 -11
- package/dist/cjs/operators/withTypeormTransaction.d.ts.map +1 -1
- package/dist/cjs/operators/withTypeormTransaction.js +4 -33
- package/dist/cjs/operators/withTypeormTransaction.js.map +1 -1
- package/dist/cjs/pgBoss.d.ts +8 -0
- package/dist/cjs/pgBoss.d.ts.map +1 -1
- package/dist/cjs/pgBoss.js +13 -1
- package/dist/cjs/pgBoss.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/TypeormStabilityWindowBuffer.d.ts +6 -7
- package/dist/esm/TypeormStabilityWindowBuffer.d.ts.map +1 -1
- package/dist/esm/TypeormStabilityWindowBuffer.js +41 -109
- package/dist/esm/TypeormStabilityWindowBuffer.js.map +1 -1
- package/dist/esm/createDataSource.d.ts +13 -0
- package/dist/esm/createDataSource.d.ts.map +1 -1
- package/dist/esm/createDataSource.js +49 -1
- package/dist/esm/createDataSource.js.map +1 -1
- package/dist/esm/createTypeormTipTracker.d.ts +16 -0
- package/dist/esm/createTypeormTipTracker.d.ts.map +1 -0
- package/dist/esm/createTypeormTipTracker.js +51 -0
- package/dist/esm/createTypeormTipTracker.js.map +1 -0
- package/dist/esm/entity/Address.entity.d.ts.map +1 -1
- package/dist/esm/entity/Address.entity.js.map +1 -1
- package/dist/esm/entity/CurrentPoolMetrics.entity.d.ts +2 -1
- package/dist/esm/entity/CurrentPoolMetrics.entity.d.ts.map +1 -1
- package/dist/esm/entity/CurrentPoolMetrics.entity.js +15 -11
- package/dist/esm/entity/CurrentPoolMetrics.entity.js.map +1 -1
- package/dist/esm/entity/Handle.entity.d.ts.map +1 -1
- package/dist/esm/entity/Handle.entity.js.map +1 -1
- package/dist/esm/entity/HandleMetadata.entity.d.ts.map +1 -1
- package/dist/esm/entity/HandleMetadata.entity.js.map +1 -1
- package/dist/esm/entity/NftMetadata.entity.d.ts.map +1 -1
- package/dist/esm/entity/NftMetadata.entity.js.map +1 -1
- package/dist/esm/entity/PoolDelisted.entity.d.ts +5 -0
- package/dist/esm/entity/PoolDelisted.entity.d.ts.map +1 -0
- package/dist/esm/entity/PoolDelisted.entity.js +22 -0
- package/dist/esm/entity/PoolDelisted.entity.js.map +1 -0
- package/dist/esm/entity/PoolRegistration.entity.d.ts +1 -0
- package/dist/esm/entity/PoolRegistration.entity.d.ts.map +1 -1
- package/dist/esm/entity/PoolRegistration.entity.js +4 -0
- package/dist/esm/entity/PoolRegistration.entity.js.map +1 -1
- package/dist/esm/entity/PoolRetirement.entity.d.ts +1 -0
- package/dist/esm/entity/PoolRetirement.entity.d.ts.map +1 -1
- package/dist/esm/entity/PoolRetirement.entity.js +4 -0
- package/dist/esm/entity/PoolRetirement.entity.js.map +1 -1
- package/dist/esm/entity/PoolRewards.entity.d.ts +18 -0
- package/dist/esm/entity/PoolRewards.entity.d.ts.map +1 -0
- package/dist/esm/entity/PoolRewards.entity.js +74 -0
- package/dist/esm/entity/PoolRewards.entity.js.map +1 -0
- package/dist/esm/entity/StakeKeyRegistration.entity.d.ts.map +1 -1
- package/dist/esm/entity/StakeKeyRegistration.entity.js.map +1 -1
- package/dist/esm/entity/index.d.ts +12 -10
- package/dist/esm/entity/index.d.ts.map +1 -1
- package/dist/esm/entity/index.js +12 -10
- package/dist/esm/entity/index.js.map +1 -1
- package/dist/esm/entity/util.d.ts.map +1 -1
- package/dist/esm/entity/util.js.map +1 -1
- package/dist/esm/index.d.ts +4 -5
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +4 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/operators/index.d.ts +10 -9
- package/dist/esm/operators/index.d.ts.map +1 -1
- package/dist/esm/operators/index.js +10 -9
- package/dist/esm/operators/index.js.map +1 -1
- package/dist/esm/operators/storePoolMetricsUpdateJob.d.ts +1 -1
- package/dist/esm/operators/storePoolMetricsUpdateJob.d.ts.map +1 -1
- package/dist/esm/operators/storePoolMetricsUpdateJob.js +20 -4
- package/dist/esm/operators/storePoolMetricsUpdateJob.js.map +1 -1
- package/dist/esm/operators/storeStakePoolMetadataJob.d.ts.map +1 -1
- package/dist/esm/operators/storeStakePoolMetadataJob.js +4 -7
- package/dist/esm/operators/storeStakePoolMetadataJob.js.map +1 -1
- package/dist/esm/operators/storeStakePoolRewardsJob.d.ts +3 -0
- package/dist/esm/operators/storeStakePoolRewardsJob.d.ts.map +1 -0
- package/dist/esm/operators/storeStakePoolRewardsJob.js +13 -0
- package/dist/esm/operators/storeStakePoolRewardsJob.js.map +1 -0
- package/dist/esm/operators/withTypeormTransaction.d.ts +10 -11
- package/dist/esm/operators/withTypeormTransaction.d.ts.map +1 -1
- package/dist/esm/operators/withTypeormTransaction.js +5 -34
- package/dist/esm/operators/withTypeormTransaction.js.map +1 -1
- package/dist/esm/pgBoss.d.ts +8 -0
- package/dist/esm/pgBoss.d.ts.map +1 -1
- package/dist/esm/pgBoss.js +12 -0
- package/dist/esm/pgBoss.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +15 -15
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storeStakePoolRewardsJob.js","sourceRoot":"","sources":["../../../src/operators/storeStakePoolRewardsJob.ts"],"names":[],"mappings":";;;AAAA,4CAAgE;AAChE,sCAAkE;AAElE,iCAAyC;AAE5B,QAAA,wBAAwB,GAAG,IAAA,sBAAe,EACrD,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,kBAAkB,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE;IAC9E,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,CAAC;IAExB,IAAI,SAAS,KAAK,yBAAkB,CAAC,WAAW,IAAI,kBAAkB,EAAE;QACtE,IAAI,OAAO,KAAK,CAAC;YAAE,OAAO;QAE1B,OAAO,GAAG,cAAO,CAAC,OAAO,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;QAEvC,MAAM,MAAM,CAAC,IAAI,CACf,2BAAkB,EAClB,EAAE,OAAO,EAAE,EACX,EAAE,GAAG,0BAAiB,EAAE,UAAU,EAAE,EAAE,EAAE,YAAY,EAAE,OAAO,CAAC,QAAQ,EAAE,EAAE,IAAI,EAAE,CACjF,CAAC;KACH;AACH,CAAC,CACF,CAAC"}
|
|
@@ -1,25 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { DataSourceExtensions } from '../createDataSource';
|
|
3
|
-
import { Observable, Subject } from 'rxjs';
|
|
1
|
+
import { Observable } from 'rxjs';
|
|
4
2
|
import { PgBossExtension } from '../pgBoss';
|
|
5
3
|
import { ProjectionEvent, UnifiedExtChainSyncOperator } from '@cardano-sdk/projection';
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import { QueryRunner } from 'typeorm';
|
|
5
|
+
import { TypeormConnection } from '../createDataSource';
|
|
6
|
+
export interface WithTypeormTransactionDependencies {
|
|
7
|
+
connection$: Observable<TypeormConnection>;
|
|
9
8
|
}
|
|
10
9
|
export interface WithTypeormContext {
|
|
11
10
|
queryRunner: QueryRunner;
|
|
12
|
-
transactionCommitted$: Subject<void>;
|
|
13
11
|
}
|
|
14
12
|
export interface WithPgBoss {
|
|
15
13
|
pgBoss: PgBossExtension;
|
|
16
14
|
}
|
|
17
15
|
declare type TypeormContextProp = keyof (WithTypeormContext & WithPgBoss);
|
|
18
|
-
export declare function withTypeormTransaction<Props>(dependencies: WithTypeormTransactionDependencies
|
|
19
|
-
|
|
16
|
+
export declare function withTypeormTransaction<Props>(dependencies: WithTypeormTransactionDependencies & {
|
|
17
|
+
pgBoss?: false;
|
|
18
|
+
}): UnifiedExtChainSyncOperator<Props, Props & WithTypeormContext>;
|
|
19
|
+
export declare function withTypeormTransaction<Props>(dependencies: WithTypeormTransactionDependencies & {
|
|
20
20
|
pgBoss: true;
|
|
21
21
|
}): UnifiedExtChainSyncOperator<Props, Props & WithTypeormContext & WithPgBoss>;
|
|
22
|
-
export declare
|
|
23
|
-
export declare const typeormTransactionCommit: <T extends WithTypeormContext>() => (evt$: Observable<ProjectionEvent<T>>) => Observable<ProjectionEvent<Omit<T, keyof WithTypeormContext | "pgBoss">>>;
|
|
22
|
+
export declare const typeormTransactionCommit: <T extends WithTypeormContext>() => (evt$: Observable<ProjectionEvent<T>>) => Observable<ProjectionEvent<Omit<T, "pgBoss" | "queryRunner">>>;
|
|
24
23
|
export {};
|
|
25
24
|
//# sourceMappingURL=withTypeormTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withTypeormTransaction.d.ts","sourceRoot":"","sources":["../../../src/operators/withTypeormTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"withTypeormTransaction.d.ts","sourceRoot":"","sources":["../../../src/operators/withTypeormTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAuC,MAAM,MAAM,CAAC;AACvE,OAAO,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,EACL,eAAe,EAEf,2BAA2B,EAG5B,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,WAAW,kCAAkC;IACjD,WAAW,EAAE,UAAU,CAAC,iBAAiB,CAAC,CAAC;CAC5C;AAED,MAAM,WAAW,kBAAkB;IACjC,WAAW,EAAE,WAAW,CAAC;CAC1B;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,aAAK,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,GAAG,UAAU,CAAC,CAAC;AAGlE,wBAAgB,sBAAsB,CAAC,KAAK,EAC1C,YAAY,EAAE,kCAAkC,GAAG;IAAE,MAAM,CAAC,EAAE,KAAK,CAAA;CAAE,GACpE,2BAA2B,CAAC,KAAK,EAAE,KAAK,GAAG,kBAAkB,CAAC,CAAC;AAElE,wBAAgB,sBAAsB,CAAC,KAAK,EAC1C,YAAY,EAAE,kCAAkC,GAAG;IAAE,MAAM,EAAE,IAAI,CAAA;CAAE,GAClE,2BAA2B,CAAC,KAAK,EAAE,KAAK,GAAG,kBAAkB,GAAG,UAAU,CAAC,CAAC;AA8B/E,eAAO,MAAM,wBAAwB,8IAchC,CAAC"}
|
|
@@ -5,43 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.typeormTransactionCommit = exports.withTypeormTransaction = void 0;
|
|
7
7
|
const rxjs_1 = require("rxjs");
|
|
8
|
-
const pgBoss_1 = require("../pgBoss");
|
|
9
8
|
const projection_1 = require("@cardano-sdk/projection");
|
|
10
|
-
const util_rxjs_1 = require("@cardano-sdk/util-rxjs");
|
|
11
9
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
12
|
-
const WithTypeormTransactionProps = ['queryRunner', '
|
|
13
|
-
function withTypeormTransaction({
|
|
14
|
-
return (evt$) => evt$.pipe((0, projection_1.withStaticContext)((0, rxjs_1.defer)(() =>
|
|
15
|
-
const queryRunner = dataSource.createQueryRunner('master');
|
|
16
|
-
await queryRunner.connect();
|
|
17
|
-
if (extensions?.pgBoss) {
|
|
18
|
-
const pgBoss = (0, pgBoss_1.createPgBossExtension)(queryRunner, logger);
|
|
19
|
-
return { pgBoss, queryRunner };
|
|
20
|
-
}
|
|
21
|
-
return { queryRunner };
|
|
22
|
-
})()), rxjs_1.NEVER).pipe((0, util_rxjs_1.finalizeWithLatest)(async (evt) => {
|
|
23
|
-
if (!evt)
|
|
24
|
-
return;
|
|
25
|
-
if (evt.queryRunner.isTransactionActive) {
|
|
26
|
-
try {
|
|
27
|
-
await evt.queryRunner.rollbackTransaction();
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
logger.error('Failed to rollback transaction', error);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
if (!evt.queryRunner.isReleased) {
|
|
34
|
-
try {
|
|
35
|
-
await evt.queryRunner.release();
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
logger.error('Failed to "release" query runner', error);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
})))))), (0, projection_1.withEventContext)(({ queryRunner }) => (0, rxjs_1.from)(queryRunner.startTransaction('SERIALIZABLE').then(() => ({ transactionCommitted$: new rxjs_1.Subject() })))));
|
|
10
|
+
const WithTypeormTransactionProps = ['queryRunner', 'pgBoss'];
|
|
11
|
+
function withTypeormTransaction({ connection$ }) {
|
|
12
|
+
return (evt$) => evt$.pipe((0, projection_1.withStaticContext)((0, rxjs_1.defer)(() => connection$)), (0, projection_1.withEventContext)(({ queryRunner }) => (0, rxjs_1.from)(queryRunner.startTransaction('SERIALIZABLE').then(() => ({ transactionCommitted$: new rxjs_1.Subject() })))));
|
|
42
13
|
}
|
|
43
14
|
exports.withTypeormTransaction = withTypeormTransaction;
|
|
44
|
-
const typeormTransactionCommit = () => (evt$) => evt$.pipe((0, rxjs_1.mergeMap)((evt) => (0, rxjs_1.from)(evt.queryRunner.commitTransaction()).pipe((0, rxjs_1.
|
|
15
|
+
const typeormTransactionCommit = () => (evt$) => evt$.pipe((0, rxjs_1.mergeMap)((evt) => (0, rxjs_1.from)(evt.queryRunner.commitTransaction()).pipe((0, rxjs_1.map)(() => {
|
|
45
16
|
const result = (0, omit_1.default)(evt, WithTypeormTransactionProps);
|
|
46
17
|
return result;
|
|
47
18
|
}))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withTypeormTransaction.js","sourceRoot":"","sources":["../../../src/operators/withTypeormTransaction.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"withTypeormTransaction.js","sourceRoot":"","sources":["../../../src/operators/withTypeormTransaction.ts"],"names":[],"mappings":";;;;;;AACA,+BAAuE;AAEvE,wDAMiC;AAGjC,uDAA+B;AAe/B,MAAM,2BAA2B,GAA8B,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;AAWzF,SAAgB,sBAAsB,CAAQ,EAC5C,WAAW,EAC+C;IAK1D,OAAO,CAAC,IAA0C,EAAE,EAAE,CACpD,IAAI,CAAC,IAAI,CACP,IAAA,8BAAiB,EAAC,IAAA,YAAK,EAAC,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,EAC3C,IAAA,6BAAgB,EAAC,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,CACnC,IAAA,WAAI,EAMF,WAAW,CAAC,gBAAgB,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,qBAAqB,EAAE,IAAI,cAAO,EAAQ,EAAE,CAAC,CAAC,CAC1G,CACF,CACF,CAAC;AACN,CAAC;AArBD,wDAqBC;AAMM,MAAM,wBAAwB,GACnC,GAAiC,EAAE,CACnC,CAAC,IAAoC,EAA4D,EAAE,CACjG,IAAI,CAAC,IAAI,CACP,IAAA,eAAQ,EAAC,CAAC,GAAG,EAAE,EAAE,CACf,IAAA,WAAI,EAAC,GAAG,CAAC,WAAW,CAAC,iBAAiB,EAAE,CAAC,CAAC,IAAI,CAC5C,IAAA,UAAG,EAAC,GAAG,EAAE;IAGP,MAAM,MAAM,GAAG,IAAA,cAAI,EAAC,GAAG,EAAE,2BAA2B,CAAC,CAAC;IACtD,OAAO,MAAsD,CAAC;AAChE,CAAC,CAAC,CACH,CACF,CACF,CAAC;AAdO,QAAA,wBAAwB,4BAc/B"}
|
package/dist/cjs/pgBoss.d.ts
CHANGED
|
@@ -2,8 +2,11 @@ import { Cardano } from '@cardano-sdk/core';
|
|
|
2
2
|
import { DataSource, QueryRunner } from 'typeorm';
|
|
3
3
|
import { Logger } from 'ts-log';
|
|
4
4
|
import PgBoss, { SendOptions } from 'pg-boss';
|
|
5
|
+
export declare const POOL_DELIST_SCHEDULE = "pool-delist-schedule";
|
|
5
6
|
export declare const STAKE_POOL_METADATA_QUEUE = "pool-metadata";
|
|
6
7
|
export declare const STAKE_POOL_METRICS_UPDATE = "pool-metrics";
|
|
8
|
+
export declare const STAKE_POOL_REWARDS = "pool-rewards";
|
|
9
|
+
export declare const availableQueues: readonly ["pool-delist-schedule", "pool-metadata", "pool-metrics", "pool-rewards"];
|
|
7
10
|
export interface PgBossExtension {
|
|
8
11
|
send: <T extends object>(taskName: string, data: T, options: SendOptions & {
|
|
9
12
|
slot: Cardano.Slot;
|
|
@@ -11,12 +14,17 @@ export interface PgBossExtension {
|
|
|
11
14
|
}
|
|
12
15
|
export interface StakePoolMetricsUpdateJob {
|
|
13
16
|
slot: Cardano.Slot;
|
|
17
|
+
outdatedSlot?: Cardano.Slot;
|
|
14
18
|
}
|
|
15
19
|
export interface StakePoolMetadataJob {
|
|
16
20
|
poolRegistrationId: string;
|
|
17
21
|
poolId: Cardano.PoolId;
|
|
18
22
|
metadataJson: NonNullable<Cardano.StakePool['metadataJson']>;
|
|
19
23
|
}
|
|
24
|
+
export interface StakePoolRewardsJob {
|
|
25
|
+
epochNo: Cardano.EpochNo;
|
|
26
|
+
}
|
|
27
|
+
export declare const defaultJobOptions: SendOptions;
|
|
20
28
|
export declare const createPgBoss: (queryRunner: QueryRunner | null, logger: Logger, dataSource?: DataSource) => PgBoss;
|
|
21
29
|
export declare const createPgBossExtension: (queryRunner: QueryRunner, logger: Logger) => PgBossExtension;
|
|
22
30
|
//# sourceMappingURL=pgBoss.d.ts.map
|
package/dist/cjs/pgBoss.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pgBoss.d.ts","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C7B;AAED,MAAM,WAAW,oBAAoB;IAEnC,kBAAkB,EAAE,MAAM,CAAC;IAC3B,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC;IACvB,YAAY,EAAE,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC;CAC9D;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;CAC1B;AAED,eAAO,MAAM,iBAAiB,EAAE,WAG/B,CAAC;AAsCF,eAAO,MAAM,YAAY,gBAAiB,WAAW,GAAG,IAAI,UAAU,MAAM,eAAe,UAAU,WAQpG,CAAC;AA6JF,eAAO,MAAM,qBAAqB,gBAAiB,WAAW,UAAU,MAAM,KAAG,eAUhF,CAAC"}
|
package/dist/cjs/pgBoss.js
CHANGED
|
@@ -3,13 +3,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.createPgBossExtension = exports.createPgBoss = exports.STAKE_POOL_METRICS_UPDATE = exports.STAKE_POOL_METADATA_QUEUE = void 0;
|
|
6
|
+
exports.createPgBossExtension = exports.createPgBoss = exports.defaultJobOptions = exports.availableQueues = exports.STAKE_POOL_REWARDS = exports.STAKE_POOL_METRICS_UPDATE = exports.STAKE_POOL_METADATA_QUEUE = exports.POOL_DELIST_SCHEDULE = void 0;
|
|
7
7
|
const util_1 = require("@cardano-sdk/util");
|
|
8
8
|
const uuid_1 = require("uuid");
|
|
9
9
|
const attorney_1 = __importDefault(require("pg-boss/src/attorney"));
|
|
10
10
|
const pg_boss_1 = __importDefault(require("pg-boss"));
|
|
11
|
+
exports.POOL_DELIST_SCHEDULE = 'pool-delist-schedule';
|
|
11
12
|
exports.STAKE_POOL_METADATA_QUEUE = 'pool-metadata';
|
|
12
13
|
exports.STAKE_POOL_METRICS_UPDATE = 'pool-metrics';
|
|
14
|
+
exports.STAKE_POOL_REWARDS = 'pool-rewards';
|
|
15
|
+
exports.availableQueues = [
|
|
16
|
+
exports.POOL_DELIST_SCHEDULE,
|
|
17
|
+
exports.STAKE_POOL_METADATA_QUEUE,
|
|
18
|
+
exports.STAKE_POOL_METRICS_UPDATE,
|
|
19
|
+
exports.STAKE_POOL_REWARDS
|
|
20
|
+
];
|
|
21
|
+
exports.defaultJobOptions = {
|
|
22
|
+
retryDelay: 6 * 3600,
|
|
23
|
+
retryLimit: 1000000
|
|
24
|
+
};
|
|
13
25
|
class BossDb {
|
|
14
26
|
constructor(queryRunner, logger, dataSource) {
|
|
15
27
|
this.queryRunner = queryRunner;
|
package/dist/cjs/pgBoss.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pgBoss.js","sourceRoot":"","sources":["../../src/pgBoss.ts"],"names":[],"mappings":";;;;;;AAQA,4CAAkD;AAClD,+BAA0B;AAC1B,oEAA4C;AAC5C,sDAA8C;AAEjC,QAAA,yBAAyB,GAAG,eAAe,CAAC;AAC5C,QAAA,yBAAyB,GAAG,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"pgBoss.js","sourceRoot":"","sources":["../../src/pgBoss.ts"],"names":[],"mappings":";;;;;;AAQA,4CAAkD;AAClD,+BAA0B;AAC1B,oEAA4C;AAC5C,sDAA8C;AAEjC,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAC9C,QAAA,yBAAyB,GAAG,eAAe,CAAC;AAC5C,QAAA,yBAAyB,GAAG,cAAc,CAAC;AAC3C,QAAA,kBAAkB,GAAG,cAAc,CAAC;AAEpC,QAAA,eAAe,GAAG;IAC7B,4BAAoB;IACpB,iCAAyB;IACzB,iCAAyB;IACzB,0BAAkB;CACV,CAAC;AA0BE,QAAA,iBAAiB,GAAgB;IAC5C,UAAU,EAAE,CAAC,GAAG,IAAI;IACpB,UAAU,EAAE,OAAS;CACtB,CAAC;AAEF,MAAM,MA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