@develit-services/bank 0.3.2 → 0.3.4
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/export/worker.cjs +26 -2
- package/dist/export/worker.d.cts +7 -1
- package/dist/export/worker.d.mts +7 -1
- package/dist/export/worker.d.ts +7 -1
- package/dist/export/worker.mjs +26 -2
- package/dist/export/workflows.cjs +4 -4
- package/dist/export/workflows.d.cts +3 -3
- package/dist/export/workflows.d.mts +3 -3
- package/dist/export/workflows.d.ts +3 -3
- package/dist/export/workflows.mjs +4 -4
- package/dist/export/wrangler.cjs +2 -2
- package/dist/export/wrangler.mjs +2 -2
- package/dist/shared/{bank.mZtcXaJo.mjs → bank.BX43jn5k.mjs} +2 -2
- package/dist/shared/{bank.CIJDq7GL.cjs → bank.wqkNncOE.cjs} +2 -2
- package/package.json +1 -1
package/dist/export/worker.cjs
CHANGED
|
@@ -7,7 +7,7 @@ const database_schema = require('../shared/bank.CpcK1Dse.cjs');
|
|
|
7
7
|
require('jose');
|
|
8
8
|
const generalCodes = require('@develit-io/general-codes');
|
|
9
9
|
const zod = require('zod');
|
|
10
|
-
const processBatch_workflow = require('../shared/bank.
|
|
10
|
+
const processBatch_workflow = require('../shared/bank.wqkNncOE.cjs');
|
|
11
11
|
const drizzleOrm = require('drizzle-orm');
|
|
12
12
|
require('drizzle-orm/sqlite-core');
|
|
13
13
|
require('date-fns');
|
|
@@ -1079,7 +1079,31 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
1079
1079
|
{ data: input, schema: getBatchesInputSchema },
|
|
1080
1080
|
{ successMessage: "Batches retrieved successfully" },
|
|
1081
1081
|
async (params) => {
|
|
1082
|
-
|
|
1082
|
+
const { batches, totalCount } = await getBatchesQuery(this.db, params);
|
|
1083
|
+
const batchesWithWorkflows = await Promise.all(
|
|
1084
|
+
batches.map(async (batch) => {
|
|
1085
|
+
let status;
|
|
1086
|
+
try {
|
|
1087
|
+
const instance = await this.env.PROCESS_BATCH_WORKFLOW.get(
|
|
1088
|
+
batch.id
|
|
1089
|
+
);
|
|
1090
|
+
status = await instance.status();
|
|
1091
|
+
} catch (_) {
|
|
1092
|
+
status = null;
|
|
1093
|
+
}
|
|
1094
|
+
return {
|
|
1095
|
+
...batch,
|
|
1096
|
+
workflow: status ? {
|
|
1097
|
+
instanceId: batch.id,
|
|
1098
|
+
details: status
|
|
1099
|
+
} : null
|
|
1100
|
+
};
|
|
1101
|
+
})
|
|
1102
|
+
);
|
|
1103
|
+
return {
|
|
1104
|
+
batches: batchesWithWorkflows,
|
|
1105
|
+
totalCount
|
|
1106
|
+
};
|
|
1083
1107
|
}
|
|
1084
1108
|
);
|
|
1085
1109
|
}
|
package/dist/export/worker.d.cts
CHANGED
|
@@ -1547,8 +1547,14 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
1547
1547
|
}>>]>>;
|
|
1548
1548
|
}, z.core.$strip>;
|
|
1549
1549
|
type GetBatchesInput = z.input<typeof getBatchesInputSchema>;
|
|
1550
|
+
type BatchWithWorkflow = BatchSelectType & {
|
|
1551
|
+
workflow: {
|
|
1552
|
+
instanceId: string;
|
|
1553
|
+
details: WorkflowInstanceStatus;
|
|
1554
|
+
} | null;
|
|
1555
|
+
};
|
|
1550
1556
|
type GetBatchesOutput = {
|
|
1551
|
-
batches:
|
|
1557
|
+
batches: BatchWithWorkflow[];
|
|
1552
1558
|
totalCount: number;
|
|
1553
1559
|
};
|
|
1554
1560
|
|
package/dist/export/worker.d.mts
CHANGED
|
@@ -1547,8 +1547,14 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
1547
1547
|
}>>]>>;
|
|
1548
1548
|
}, z.core.$strip>;
|
|
1549
1549
|
type GetBatchesInput = z.input<typeof getBatchesInputSchema>;
|
|
1550
|
+
type BatchWithWorkflow = BatchSelectType & {
|
|
1551
|
+
workflow: {
|
|
1552
|
+
instanceId: string;
|
|
1553
|
+
details: WorkflowInstanceStatus;
|
|
1554
|
+
} | null;
|
|
1555
|
+
};
|
|
1550
1556
|
type GetBatchesOutput = {
|
|
1551
|
-
batches:
|
|
1557
|
+
batches: BatchWithWorkflow[];
|
|
1552
1558
|
totalCount: number;
|
|
1553
1559
|
};
|
|
1554
1560
|
|
package/dist/export/worker.d.ts
CHANGED
|
@@ -1547,8 +1547,14 @@ declare const getBatchesInputSchema: z.ZodObject<{
|
|
|
1547
1547
|
}>>]>>;
|
|
1548
1548
|
}, z.core.$strip>;
|
|
1549
1549
|
type GetBatchesInput = z.input<typeof getBatchesInputSchema>;
|
|
1550
|
+
type BatchWithWorkflow = BatchSelectType & {
|
|
1551
|
+
workflow: {
|
|
1552
|
+
instanceId: string;
|
|
1553
|
+
details: WorkflowInstanceStatus;
|
|
1554
|
+
} | null;
|
|
1555
|
+
};
|
|
1550
1556
|
type GetBatchesOutput = {
|
|
1551
|
-
batches:
|
|
1557
|
+
batches: BatchWithWorkflow[];
|
|
1552
1558
|
totalCount: number;
|
|
1553
1559
|
};
|
|
1554
1560
|
|
package/dist/export/worker.mjs
CHANGED
|
@@ -5,7 +5,7 @@ import { t as tables, c as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, P as PAY
|
|
|
5
5
|
import 'jose';
|
|
6
6
|
import { CURRENCY_CODES } from '@develit-io/general-codes';
|
|
7
7
|
import { z } from 'zod';
|
|
8
|
-
import { e as encrypt, P as PROCESS_BATCH_WORKFLOW_EVENTS, i as importAesKey, a as getCredentialsByAccountId, b as initiateConnector, u as upsertBatchCommand, c as createPaymentCommand, g as getAccountByIdQuery } from '../shared/bank.
|
|
8
|
+
import { e as encrypt, P as PROCESS_BATCH_WORKFLOW_EVENTS, i as importAesKey, a as getCredentialsByAccountId, b as initiateConnector, u as upsertBatchCommand, c as createPaymentCommand, g as getAccountByIdQuery } from '../shared/bank.BX43jn5k.mjs';
|
|
9
9
|
import { eq, inArray, and, sql, asc, desc, gte, lte } from 'drizzle-orm';
|
|
10
10
|
import 'drizzle-orm/sqlite-core';
|
|
11
11
|
import 'date-fns';
|
|
@@ -1077,7 +1077,31 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
1077
1077
|
{ data: input, schema: getBatchesInputSchema },
|
|
1078
1078
|
{ successMessage: "Batches retrieved successfully" },
|
|
1079
1079
|
async (params) => {
|
|
1080
|
-
|
|
1080
|
+
const { batches, totalCount } = await getBatchesQuery(this.db, params);
|
|
1081
|
+
const batchesWithWorkflows = await Promise.all(
|
|
1082
|
+
batches.map(async (batch) => {
|
|
1083
|
+
let status;
|
|
1084
|
+
try {
|
|
1085
|
+
const instance = await this.env.PROCESS_BATCH_WORKFLOW.get(
|
|
1086
|
+
batch.id
|
|
1087
|
+
);
|
|
1088
|
+
status = await instance.status();
|
|
1089
|
+
} catch (_) {
|
|
1090
|
+
status = null;
|
|
1091
|
+
}
|
|
1092
|
+
return {
|
|
1093
|
+
...batch,
|
|
1094
|
+
workflow: status ? {
|
|
1095
|
+
instanceId: batch.id,
|
|
1096
|
+
details: status
|
|
1097
|
+
} : null
|
|
1098
|
+
};
|
|
1099
|
+
})
|
|
1100
|
+
);
|
|
1101
|
+
return {
|
|
1102
|
+
batches: batchesWithWorkflows,
|
|
1103
|
+
totalCount
|
|
1104
|
+
};
|
|
1081
1105
|
}
|
|
1082
1106
|
);
|
|
1083
1107
|
}
|
|
@@ -5,7 +5,7 @@ const cloudflare_workflows = require('cloudflare:workflows');
|
|
|
5
5
|
const d1 = require('drizzle-orm/d1');
|
|
6
6
|
const database_schema = require('../shared/bank.CpcK1Dse.cjs');
|
|
7
7
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
8
|
-
const processBatch_workflow = require('../shared/bank.
|
|
8
|
+
const processBatch_workflow = require('../shared/bank.wqkNncOE.cjs');
|
|
9
9
|
const drizzleOrm = require('drizzle-orm');
|
|
10
10
|
require('drizzle-orm/sqlite-core');
|
|
11
11
|
require('date-fns');
|
|
@@ -39,7 +39,7 @@ function pushToQueue(queue, message) {
|
|
|
39
39
|
}))
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
|
-
class
|
|
42
|
+
class BankSyncAccountPayments extends cloudflare_workers.WorkflowEntrypoint {
|
|
43
43
|
async run(event, step) {
|
|
44
44
|
const { accountId } = event.payload;
|
|
45
45
|
const db = d1.drizzle(this.env.BANK_D1, { schema: database_schema.tables });
|
|
@@ -164,5 +164,5 @@ class BankSyncAccountPaymentsWorkflow extends cloudflare_workers.WorkflowEntrypo
|
|
|
164
164
|
}
|
|
165
165
|
}
|
|
166
166
|
|
|
167
|
-
exports.
|
|
168
|
-
exports.
|
|
167
|
+
exports.BankProcessBatch = processBatch_workflow.BankProcessBatch;
|
|
168
|
+
exports.BankSyncAccountPayments = BankSyncAccountPayments;
|
|
@@ -3,15 +3,15 @@ import { WorkflowEntrypoint, WorkflowEvent, WorkflowStep } from 'cloudflare:work
|
|
|
3
3
|
type Params$1 = {
|
|
4
4
|
accountId: string;
|
|
5
5
|
};
|
|
6
|
-
declare class
|
|
6
|
+
declare class BankSyncAccountPayments extends WorkflowEntrypoint<BankEnv, Params$1> {
|
|
7
7
|
run(event: WorkflowEvent<Params$1>, step: WorkflowStep): Promise<void>;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
type Params = {
|
|
11
11
|
batchId: string;
|
|
12
12
|
};
|
|
13
|
-
declare class
|
|
13
|
+
declare class BankProcessBatch extends WorkflowEntrypoint<BankEnv, Params> {
|
|
14
14
|
run(event: WorkflowEvent<Params>, step: WorkflowStep): Promise<void>;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export {
|
|
17
|
+
export { BankProcessBatch, BankSyncAccountPayments };
|
|
@@ -3,15 +3,15 @@ import { WorkflowEntrypoint, WorkflowEvent, WorkflowStep } from 'cloudflare:work
|
|
|
3
3
|
type Params$1 = {
|
|
4
4
|
accountId: string;
|
|
5
5
|
};
|
|
6
|
-
declare class
|
|
6
|
+
declare class BankSyncAccountPayments extends WorkflowEntrypoint<BankEnv, Params$1> {
|
|
7
7
|
run(event: WorkflowEvent<Params$1>, step: WorkflowStep): Promise<void>;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
type Params = {
|
|
11
11
|
batchId: string;
|
|
12
12
|
};
|
|
13
|
-
declare class
|
|
13
|
+
declare class BankProcessBatch extends WorkflowEntrypoint<BankEnv, Params> {
|
|
14
14
|
run(event: WorkflowEvent<Params>, step: WorkflowStep): Promise<void>;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export {
|
|
17
|
+
export { BankProcessBatch, BankSyncAccountPayments };
|
|
@@ -3,15 +3,15 @@ import { WorkflowEntrypoint, WorkflowEvent, WorkflowStep } from 'cloudflare:work
|
|
|
3
3
|
type Params$1 = {
|
|
4
4
|
accountId: string;
|
|
5
5
|
};
|
|
6
|
-
declare class
|
|
6
|
+
declare class BankSyncAccountPayments extends WorkflowEntrypoint<BankEnv, Params$1> {
|
|
7
7
|
run(event: WorkflowEvent<Params$1>, step: WorkflowStep): Promise<void>;
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
type Params = {
|
|
11
11
|
batchId: string;
|
|
12
12
|
};
|
|
13
|
-
declare class
|
|
13
|
+
declare class BankProcessBatch extends WorkflowEntrypoint<BankEnv, Params> {
|
|
14
14
|
run(event: WorkflowEvent<Params>, step: WorkflowStep): Promise<void>;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
-
export {
|
|
17
|
+
export { BankProcessBatch, BankSyncAccountPayments };
|
|
@@ -3,8 +3,8 @@ import { NonRetryableError } from 'cloudflare:workflows';
|
|
|
3
3
|
import { drizzle } from 'drizzle-orm/d1';
|
|
4
4
|
import { t as tables } from '../shared/bank.lZMrqjVR.mjs';
|
|
5
5
|
import { asNonEmpty } from '@develit-io/backend-sdk';
|
|
6
|
-
import { g as getAccountByIdQuery, i as importAesKey, a as getCredentialsByAccountId, b as initiateConnector, c as createPaymentCommand } from '../shared/bank.
|
|
7
|
-
export { B as
|
|
6
|
+
import { g as getAccountByIdQuery, i as importAesKey, a as getCredentialsByAccountId, b as initiateConnector, c as createPaymentCommand } from '../shared/bank.BX43jn5k.mjs';
|
|
7
|
+
export { B as BankProcessBatch } from '../shared/bank.BX43jn5k.mjs';
|
|
8
8
|
import { eq } from 'drizzle-orm';
|
|
9
9
|
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
import 'date-fns';
|
|
@@ -38,7 +38,7 @@ function pushToQueue(queue, message) {
|
|
|
38
38
|
}))
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
|
-
class
|
|
41
|
+
class BankSyncAccountPayments extends WorkflowEntrypoint {
|
|
42
42
|
async run(event, step) {
|
|
43
43
|
const { accountId } = event.payload;
|
|
44
44
|
const db = drizzle(this.env.BANK_D1, { schema: tables });
|
|
@@ -163,4 +163,4 @@ class BankSyncAccountPaymentsWorkflow extends WorkflowEntrypoint {
|
|
|
163
163
|
}
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
export {
|
|
166
|
+
export { BankSyncAccountPayments };
|
package/dist/export/wrangler.cjs
CHANGED
|
@@ -39,12 +39,12 @@ function defineBankServiceWrangler(config) {
|
|
|
39
39
|
{
|
|
40
40
|
name: `${project}-bank-sync-account-payments`,
|
|
41
41
|
binding: "SYNC_ACCOUNT_PAYMENTS_WORKFLOW",
|
|
42
|
-
class_name: "
|
|
42
|
+
class_name: "BankSyncAccountPayments"
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
name: `${project}-bank-process-batch`,
|
|
46
46
|
binding: "PROCESS_BATCH_WORKFLOW",
|
|
47
|
-
class_name: "
|
|
47
|
+
class_name: "BankProcessBatch"
|
|
48
48
|
}
|
|
49
49
|
],
|
|
50
50
|
queues: {
|
package/dist/export/wrangler.mjs
CHANGED
|
@@ -37,12 +37,12 @@ function defineBankServiceWrangler(config) {
|
|
|
37
37
|
{
|
|
38
38
|
name: `${project}-bank-sync-account-payments`,
|
|
39
39
|
binding: "SYNC_ACCOUNT_PAYMENTS_WORKFLOW",
|
|
40
|
-
class_name: "
|
|
40
|
+
class_name: "BankSyncAccountPayments"
|
|
41
41
|
},
|
|
42
42
|
{
|
|
43
43
|
name: `${project}-bank-process-batch`,
|
|
44
44
|
binding: "PROCESS_BATCH_WORKFLOW",
|
|
45
|
-
class_name: "
|
|
45
|
+
class_name: "BankProcessBatch"
|
|
46
46
|
}
|
|
47
47
|
],
|
|
48
48
|
queues: {
|
|
@@ -185,7 +185,7 @@ function pushToQueue(queue, message) {
|
|
|
185
185
|
}))
|
|
186
186
|
);
|
|
187
187
|
}
|
|
188
|
-
class
|
|
188
|
+
class BankProcessBatch extends WorkflowEntrypoint {
|
|
189
189
|
async run(event, step) {
|
|
190
190
|
const { batchId } = event.payload;
|
|
191
191
|
const db = drizzle(this.env.BANK_D1, { schema: tables });
|
|
@@ -388,4 +388,4 @@ class BankProcessBatchWorkflow extends WorkflowEntrypoint {
|
|
|
388
388
|
}
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
export {
|
|
391
|
+
export { BankProcessBatch as B, PROCESS_BATCH_WORKFLOW_EVENTS as P, getCredentialsByAccountId as a, initiateConnector as b, createPaymentCommand as c, encrypt as e, getAccountByIdQuery as g, importAesKey as i, upsertBatchCommand as u };
|
|
@@ -187,7 +187,7 @@ function pushToQueue(queue, message) {
|
|
|
187
187
|
}))
|
|
188
188
|
);
|
|
189
189
|
}
|
|
190
|
-
class
|
|
190
|
+
class BankProcessBatch extends cloudflare_workers.WorkflowEntrypoint {
|
|
191
191
|
async run(event, step) {
|
|
192
192
|
const { batchId } = event.payload;
|
|
193
193
|
const db = d1.drizzle(this.env.BANK_D1, { schema: database_schema.tables });
|
|
@@ -390,7 +390,7 @@ class BankProcessBatchWorkflow extends cloudflare_workers.WorkflowEntrypoint {
|
|
|
390
390
|
}
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
-
exports.
|
|
393
|
+
exports.BankProcessBatch = BankProcessBatch;
|
|
394
394
|
exports.PROCESS_BATCH_WORKFLOW_EVENTS = PROCESS_BATCH_WORKFLOW_EVENTS;
|
|
395
395
|
exports.createPaymentCommand = createPaymentCommand;
|
|
396
396
|
exports.encrypt = encrypt;
|