@develit-services/bank 0.1.2 → 0.1.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/database/schema.cjs +1 -1
- package/dist/database/schema.d.cts +1 -1
- package/dist/database/schema.d.mts +1 -1
- package/dist/database/schema.d.ts +1 -1
- package/dist/database/schema.mjs +1 -1
- package/dist/export/worker.cjs +23 -3
- package/dist/export/worker.d.cts +19 -7
- package/dist/export/worker.d.mts +19 -7
- package/dist/export/worker.d.ts +19 -7
- package/dist/export/worker.mjs +24 -4
- package/dist/export/workflows.cjs +3 -3
- package/dist/export/workflows.mjs +3 -3
- package/dist/shared/{bank.DJ9d1yaR.mjs → bank.BVoTAfMF.mjs} +75 -62
- package/dist/shared/{bank.RUV2HUFo.mjs → bank.Buq4PwHY.mjs} +28 -28
- package/dist/shared/{bank.mub5_S4r.d.cts → bank.CgiMSTo7.d.cts} +4 -4
- package/dist/shared/{bank.mub5_S4r.d.mts → bank.CgiMSTo7.d.mts} +4 -4
- package/dist/shared/{bank.mub5_S4r.d.ts → bank.CgiMSTo7.d.ts} +4 -4
- package/dist/shared/{bank.8lAQLFNI.mjs → bank.DC5Hk4UF.mjs} +1 -1
- package/dist/shared/{bank.UfRkUN2y.cjs → bank.DN3pRw5j.cjs} +28 -28
- package/dist/shared/{bank.DOJ8gbXQ.cjs → bank.DTMwkDFH.cjs} +75 -62
- package/dist/shared/{bank.BQSnGZ-3.d.cts → bank.DV-Kvdzh.d.cts} +3 -3
- package/dist/shared/{bank.DW3cHO1u.d.mts → bank._W3dtG8P.d.ts} +3 -3
- package/dist/shared/{bank.DISsqBb6.cjs → bank._ilV3SSc.cjs} +1 -1
- package/dist/shared/{bank.CouYVuOf.d.ts → bank.b_ehHCuG.d.mts} +3 -3
- package/dist/types.cjs +2 -2
- package/dist/types.d.cts +6 -5
- package/dist/types.d.mts +6 -5
- package/dist/types.d.ts +6 -5
- package/dist/types.mjs +2 -2
- package/package.json +1 -1
package/dist/database/schema.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as account, g as accountCredentials, c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { f as account, g as accountCredentials, c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.CgiMSTo7.cjs';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import 'zod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as account, g as accountCredentials, c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { f as account, g as accountCredentials, c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.CgiMSTo7.mjs';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import 'zod';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { f as account, g as accountCredentials, c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { f as account, g as accountCredentials, c as batch, o as ott, d as payment, e as paymentRelations } from '../shared/bank.CgiMSTo7.js';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import 'zod';
|
package/dist/database/schema.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { D as account, G as accountCredentials, w as batch, z as ott, x as payment, y as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { D as account, G as accountCredentials, w as batch, z as ott, x as payment, y as paymentRelations } from '../shared/bank.Buq4PwHY.mjs';
|
|
2
2
|
import '@develit-io/backend-sdk';
|
|
3
3
|
import 'drizzle-orm/sqlite-core';
|
|
4
4
|
import 'date-fns';
|
package/dist/export/worker.cjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const export_workflows = require('../shared/bank.
|
|
3
|
+
const export_workflows = require('../shared/bank.DTMwkDFH.cjs');
|
|
4
4
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
5
5
|
const cloudflare_workers = require('cloudflare:workers');
|
|
6
6
|
const d1 = require('drizzle-orm/d1');
|
|
7
|
-
const database_schema = require('../shared/bank.
|
|
7
|
+
const database_schema = require('../shared/bank.DN3pRw5j.cjs');
|
|
8
8
|
require('jose');
|
|
9
9
|
const generalCodes = require('@develit-io/general-codes');
|
|
10
10
|
const zod = require('zod');
|
|
11
11
|
const drizzleOrm = require('drizzle-orm');
|
|
12
12
|
require('cloudflare:workflows');
|
|
13
|
-
require('../shared/bank.
|
|
13
|
+
require('../shared/bank._ilV3SSc.cjs');
|
|
14
14
|
require('drizzle-orm/sqlite-core');
|
|
15
15
|
require('date-fns');
|
|
16
16
|
require('drizzle-zod');
|
|
@@ -355,6 +355,13 @@ zod.z.object({
|
|
|
355
355
|
details: backendSdk.workflowInstanceStatusSchema
|
|
356
356
|
});
|
|
357
357
|
|
|
358
|
+
const syncAccountTerminateInputSchema = zod.z.object({
|
|
359
|
+
accountId: zod.z.uuid()
|
|
360
|
+
});
|
|
361
|
+
zod.z.object({
|
|
362
|
+
instanceId: zod.z.string()
|
|
363
|
+
});
|
|
364
|
+
|
|
358
365
|
const updateAccountInputSchema = zod.z.object({
|
|
359
366
|
account: database_schema.accountInsertSchema
|
|
360
367
|
});
|
|
@@ -581,6 +588,19 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
581
588
|
}
|
|
582
589
|
);
|
|
583
590
|
}
|
|
591
|
+
async syncAccountTerminate(input) {
|
|
592
|
+
return this.handleAction(
|
|
593
|
+
{ data: input, schema: syncAccountTerminateInputSchema },
|
|
594
|
+
{ successMessage: "Account sync workflow terminated" },
|
|
595
|
+
async ({ accountId }) => {
|
|
596
|
+
const instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(accountId);
|
|
597
|
+
await instance.terminate();
|
|
598
|
+
return {
|
|
599
|
+
instanceId: instance.id
|
|
600
|
+
};
|
|
601
|
+
}
|
|
602
|
+
);
|
|
603
|
+
}
|
|
584
604
|
async syncAccounts(options) {
|
|
585
605
|
return this.handleAction(
|
|
586
606
|
null,
|
package/dist/export/worker.d.cts
CHANGED
|
@@ -3,8 +3,8 @@ import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
|
3
3
|
import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
6
|
-
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.
|
|
7
|
-
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.
|
|
6
|
+
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.CgiMSTo7.cjs';
|
|
7
|
+
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.DV-Kvdzh.cjs';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import * as drizzle_zod from 'drizzle-zod';
|
|
10
10
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
@@ -18,8 +18,8 @@ declare const sendPaymentInputSchema: z.ZodObject<{
|
|
|
18
18
|
paymentType: z.ZodEnum<{
|
|
19
19
|
SEPA: "SEPA";
|
|
20
20
|
SWIFT: "SWIFT";
|
|
21
|
-
IFSC: "IFSC";
|
|
22
21
|
DOMESTIC: "DOMESTIC";
|
|
22
|
+
UNKNOWN: "UNKNOWN";
|
|
23
23
|
}>;
|
|
24
24
|
chargeBearer: z.ZodOptional<z.ZodEnum<{
|
|
25
25
|
SHA: "SHA";
|
|
@@ -29,6 +29,7 @@ declare const sendPaymentInputSchema: z.ZodObject<{
|
|
|
29
29
|
executionDate: z.ZodOptional<z.ZodString>;
|
|
30
30
|
instructionPriority: z.ZodOptional<z.ZodEnum<{
|
|
31
31
|
NORM: "NORM";
|
|
32
|
+
HIGH: "HIGH";
|
|
32
33
|
INST: "INST";
|
|
33
34
|
}>>;
|
|
34
35
|
currency: z.ZodEnum<{
|
|
@@ -201,7 +202,7 @@ declare const sendPaymentInputSchema: z.ZodObject<{
|
|
|
201
202
|
MATIC: "MATIC";
|
|
202
203
|
AVAX: "AVAX";
|
|
203
204
|
}>>;
|
|
204
|
-
|
|
205
|
+
countryCode: z.ZodOptional<z.ZodEnum<{
|
|
205
206
|
AF: "AF";
|
|
206
207
|
AL: "AL";
|
|
207
208
|
DZ: "DZ";
|
|
@@ -530,7 +531,7 @@ declare const sendPaymentInputSchema: z.ZodObject<{
|
|
|
530
531
|
MATIC: "MATIC";
|
|
531
532
|
AVAX: "AVAX";
|
|
532
533
|
}>>;
|
|
533
|
-
|
|
534
|
+
countryCode: z.ZodOptional<z.ZodEnum<{
|
|
534
535
|
AF: "AF";
|
|
535
536
|
AL: "AL";
|
|
536
537
|
DZ: "DZ";
|
|
@@ -952,7 +953,7 @@ declare const simulateDepositInputSchema: z.ZodObject<{
|
|
|
952
953
|
MATIC: "MATIC";
|
|
953
954
|
AVAX: "AVAX";
|
|
954
955
|
}>>;
|
|
955
|
-
|
|
956
|
+
countryCode: z.ZodOptional<z.ZodEnum<{
|
|
956
957
|
AF: "AF";
|
|
957
958
|
AL: "AL";
|
|
958
959
|
DZ: "DZ";
|
|
@@ -1281,7 +1282,7 @@ declare const simulateDepositInputSchema: z.ZodObject<{
|
|
|
1281
1282
|
MATIC: "MATIC";
|
|
1282
1283
|
AVAX: "AVAX";
|
|
1283
1284
|
}>>;
|
|
1284
|
-
|
|
1285
|
+
countryCode: z.ZodOptional<z.ZodEnum<{
|
|
1285
1286
|
AF: "AF";
|
|
1286
1287
|
AL: "AL";
|
|
1287
1288
|
DZ: "DZ";
|
|
@@ -1807,6 +1808,16 @@ interface SyncAccountRestartInput extends z.infer<typeof syncAccountRestartInput
|
|
|
1807
1808
|
}
|
|
1808
1809
|
type SyncAccountRestartOutput = z.infer<typeof syncAccountRestartOutputSchema>;
|
|
1809
1810
|
|
|
1811
|
+
declare const syncAccountTerminateInputSchema: z.ZodObject<{
|
|
1812
|
+
accountId: z.ZodUUID;
|
|
1813
|
+
}, z.core.$strip>;
|
|
1814
|
+
declare const syncAccountTerminateOutputSchema: z.ZodObject<{
|
|
1815
|
+
instanceId: z.ZodString;
|
|
1816
|
+
}, z.core.$strip>;
|
|
1817
|
+
interface SyncAccountTerminateInput extends z.infer<typeof syncAccountTerminateInputSchema> {
|
|
1818
|
+
}
|
|
1819
|
+
type SyncAccountTerminateOutput = z.infer<typeof syncAccountTerminateOutputSchema>;
|
|
1820
|
+
|
|
1810
1821
|
declare const updateAccountInputSchema: z.ZodObject<{
|
|
1811
1822
|
account: drizzle_zod.BuildSchema<"insert", {
|
|
1812
1823
|
connectorKey: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
@@ -2314,6 +2325,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
2314
2325
|
syncAccount(input: SyncAccountInput): Promise<IRPCResponse<SyncAccountOutput>>;
|
|
2315
2326
|
syncAccountStatus(input: SyncAccountStatusInput): Promise<IRPCResponse<SyncAccountStatusOutput>>;
|
|
2316
2327
|
syncAccountRestart(input: SyncAccountRestartInput): Promise<IRPCResponse<SyncAccountRestartOutput>>;
|
|
2328
|
+
syncAccountTerminate(input: SyncAccountTerminateInput): Promise<IRPCResponse<SyncAccountTerminateOutput>>;
|
|
2317
2329
|
syncAccounts(options?: {
|
|
2318
2330
|
accounts?: AccountSelectType[];
|
|
2319
2331
|
}): Promise<IRPCResponse<void>>;
|
package/dist/export/worker.d.mts
CHANGED
|
@@ -3,8 +3,8 @@ import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
|
3
3
|
import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
6
|
-
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.
|
|
7
|
-
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.
|
|
6
|
+
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.CgiMSTo7.mjs';
|
|
7
|
+
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.b_ehHCuG.mjs';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import * as drizzle_zod from 'drizzle-zod';
|
|
10
10
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
@@ -18,8 +18,8 @@ declare const sendPaymentInputSchema: z.ZodObject<{
|
|
|
18
18
|
paymentType: z.ZodEnum<{
|
|
19
19
|
SEPA: "SEPA";
|
|
20
20
|
SWIFT: "SWIFT";
|
|
21
|
-
IFSC: "IFSC";
|
|
22
21
|
DOMESTIC: "DOMESTIC";
|
|
22
|
+
UNKNOWN: "UNKNOWN";
|
|
23
23
|
}>;
|
|
24
24
|
chargeBearer: z.ZodOptional<z.ZodEnum<{
|
|
25
25
|
SHA: "SHA";
|
|
@@ -29,6 +29,7 @@ declare const sendPaymentInputSchema: z.ZodObject<{
|
|
|
29
29
|
executionDate: z.ZodOptional<z.ZodString>;
|
|
30
30
|
instructionPriority: z.ZodOptional<z.ZodEnum<{
|
|
31
31
|
NORM: "NORM";
|
|
32
|
+
HIGH: "HIGH";
|
|
32
33
|
INST: "INST";
|
|
33
34
|
}>>;
|
|
34
35
|
currency: z.ZodEnum<{
|
|
@@ -201,7 +202,7 @@ declare const sendPaymentInputSchema: z.ZodObject<{
|
|
|
201
202
|
MATIC: "MATIC";
|
|
202
203
|
AVAX: "AVAX";
|
|
203
204
|
}>>;
|
|
204
|
-
|
|
205
|
+
countryCode: z.ZodOptional<z.ZodEnum<{
|
|
205
206
|
AF: "AF";
|
|
206
207
|
AL: "AL";
|
|
207
208
|
DZ: "DZ";
|
|
@@ -530,7 +531,7 @@ declare const sendPaymentInputSchema: z.ZodObject<{
|
|
|
530
531
|
MATIC: "MATIC";
|
|
531
532
|
AVAX: "AVAX";
|
|
532
533
|
}>>;
|
|
533
|
-
|
|
534
|
+
countryCode: z.ZodOptional<z.ZodEnum<{
|
|
534
535
|
AF: "AF";
|
|
535
536
|
AL: "AL";
|
|
536
537
|
DZ: "DZ";
|
|
@@ -952,7 +953,7 @@ declare const simulateDepositInputSchema: z.ZodObject<{
|
|
|
952
953
|
MATIC: "MATIC";
|
|
953
954
|
AVAX: "AVAX";
|
|
954
955
|
}>>;
|
|
955
|
-
|
|
956
|
+
countryCode: z.ZodOptional<z.ZodEnum<{
|
|
956
957
|
AF: "AF";
|
|
957
958
|
AL: "AL";
|
|
958
959
|
DZ: "DZ";
|
|
@@ -1281,7 +1282,7 @@ declare const simulateDepositInputSchema: z.ZodObject<{
|
|
|
1281
1282
|
MATIC: "MATIC";
|
|
1282
1283
|
AVAX: "AVAX";
|
|
1283
1284
|
}>>;
|
|
1284
|
-
|
|
1285
|
+
countryCode: z.ZodOptional<z.ZodEnum<{
|
|
1285
1286
|
AF: "AF";
|
|
1286
1287
|
AL: "AL";
|
|
1287
1288
|
DZ: "DZ";
|
|
@@ -1807,6 +1808,16 @@ interface SyncAccountRestartInput extends z.infer<typeof syncAccountRestartInput
|
|
|
1807
1808
|
}
|
|
1808
1809
|
type SyncAccountRestartOutput = z.infer<typeof syncAccountRestartOutputSchema>;
|
|
1809
1810
|
|
|
1811
|
+
declare const syncAccountTerminateInputSchema: z.ZodObject<{
|
|
1812
|
+
accountId: z.ZodUUID;
|
|
1813
|
+
}, z.core.$strip>;
|
|
1814
|
+
declare const syncAccountTerminateOutputSchema: z.ZodObject<{
|
|
1815
|
+
instanceId: z.ZodString;
|
|
1816
|
+
}, z.core.$strip>;
|
|
1817
|
+
interface SyncAccountTerminateInput extends z.infer<typeof syncAccountTerminateInputSchema> {
|
|
1818
|
+
}
|
|
1819
|
+
type SyncAccountTerminateOutput = z.infer<typeof syncAccountTerminateOutputSchema>;
|
|
1820
|
+
|
|
1810
1821
|
declare const updateAccountInputSchema: z.ZodObject<{
|
|
1811
1822
|
account: drizzle_zod.BuildSchema<"insert", {
|
|
1812
1823
|
connectorKey: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
@@ -2314,6 +2325,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
2314
2325
|
syncAccount(input: SyncAccountInput): Promise<IRPCResponse<SyncAccountOutput>>;
|
|
2315
2326
|
syncAccountStatus(input: SyncAccountStatusInput): Promise<IRPCResponse<SyncAccountStatusOutput>>;
|
|
2316
2327
|
syncAccountRestart(input: SyncAccountRestartInput): Promise<IRPCResponse<SyncAccountRestartOutput>>;
|
|
2328
|
+
syncAccountTerminate(input: SyncAccountTerminateInput): Promise<IRPCResponse<SyncAccountTerminateOutput>>;
|
|
2317
2329
|
syncAccounts(options?: {
|
|
2318
2330
|
accounts?: AccountSelectType[];
|
|
2319
2331
|
}): Promise<IRPCResponse<void>>;
|
package/dist/export/worker.d.ts
CHANGED
|
@@ -3,8 +3,8 @@ import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
|
3
3
|
import { WorkflowInstanceStatus, IRPCResponse } from '@develit-io/backend-sdk';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
6
|
-
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.
|
|
7
|
-
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.
|
|
6
|
+
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.CgiMSTo7.js';
|
|
7
|
+
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank._W3dtG8P.js';
|
|
8
8
|
import { z } from 'zod';
|
|
9
9
|
import * as drizzle_zod from 'drizzle-zod';
|
|
10
10
|
import * as drizzle_orm_sqlite_core from 'drizzle-orm/sqlite-core';
|
|
@@ -18,8 +18,8 @@ declare const sendPaymentInputSchema: z.ZodObject<{
|
|
|
18
18
|
paymentType: z.ZodEnum<{
|
|
19
19
|
SEPA: "SEPA";
|
|
20
20
|
SWIFT: "SWIFT";
|
|
21
|
-
IFSC: "IFSC";
|
|
22
21
|
DOMESTIC: "DOMESTIC";
|
|
22
|
+
UNKNOWN: "UNKNOWN";
|
|
23
23
|
}>;
|
|
24
24
|
chargeBearer: z.ZodOptional<z.ZodEnum<{
|
|
25
25
|
SHA: "SHA";
|
|
@@ -29,6 +29,7 @@ declare const sendPaymentInputSchema: z.ZodObject<{
|
|
|
29
29
|
executionDate: z.ZodOptional<z.ZodString>;
|
|
30
30
|
instructionPriority: z.ZodOptional<z.ZodEnum<{
|
|
31
31
|
NORM: "NORM";
|
|
32
|
+
HIGH: "HIGH";
|
|
32
33
|
INST: "INST";
|
|
33
34
|
}>>;
|
|
34
35
|
currency: z.ZodEnum<{
|
|
@@ -201,7 +202,7 @@ declare const sendPaymentInputSchema: z.ZodObject<{
|
|
|
201
202
|
MATIC: "MATIC";
|
|
202
203
|
AVAX: "AVAX";
|
|
203
204
|
}>>;
|
|
204
|
-
|
|
205
|
+
countryCode: z.ZodOptional<z.ZodEnum<{
|
|
205
206
|
AF: "AF";
|
|
206
207
|
AL: "AL";
|
|
207
208
|
DZ: "DZ";
|
|
@@ -530,7 +531,7 @@ declare const sendPaymentInputSchema: z.ZodObject<{
|
|
|
530
531
|
MATIC: "MATIC";
|
|
531
532
|
AVAX: "AVAX";
|
|
532
533
|
}>>;
|
|
533
|
-
|
|
534
|
+
countryCode: z.ZodOptional<z.ZodEnum<{
|
|
534
535
|
AF: "AF";
|
|
535
536
|
AL: "AL";
|
|
536
537
|
DZ: "DZ";
|
|
@@ -952,7 +953,7 @@ declare const simulateDepositInputSchema: z.ZodObject<{
|
|
|
952
953
|
MATIC: "MATIC";
|
|
953
954
|
AVAX: "AVAX";
|
|
954
955
|
}>>;
|
|
955
|
-
|
|
956
|
+
countryCode: z.ZodOptional<z.ZodEnum<{
|
|
956
957
|
AF: "AF";
|
|
957
958
|
AL: "AL";
|
|
958
959
|
DZ: "DZ";
|
|
@@ -1281,7 +1282,7 @@ declare const simulateDepositInputSchema: z.ZodObject<{
|
|
|
1281
1282
|
MATIC: "MATIC";
|
|
1282
1283
|
AVAX: "AVAX";
|
|
1283
1284
|
}>>;
|
|
1284
|
-
|
|
1285
|
+
countryCode: z.ZodOptional<z.ZodEnum<{
|
|
1285
1286
|
AF: "AF";
|
|
1286
1287
|
AL: "AL";
|
|
1287
1288
|
DZ: "DZ";
|
|
@@ -1807,6 +1808,16 @@ interface SyncAccountRestartInput extends z.infer<typeof syncAccountRestartInput
|
|
|
1807
1808
|
}
|
|
1808
1809
|
type SyncAccountRestartOutput = z.infer<typeof syncAccountRestartOutputSchema>;
|
|
1809
1810
|
|
|
1811
|
+
declare const syncAccountTerminateInputSchema: z.ZodObject<{
|
|
1812
|
+
accountId: z.ZodUUID;
|
|
1813
|
+
}, z.core.$strip>;
|
|
1814
|
+
declare const syncAccountTerminateOutputSchema: z.ZodObject<{
|
|
1815
|
+
instanceId: z.ZodString;
|
|
1816
|
+
}, z.core.$strip>;
|
|
1817
|
+
interface SyncAccountTerminateInput extends z.infer<typeof syncAccountTerminateInputSchema> {
|
|
1818
|
+
}
|
|
1819
|
+
type SyncAccountTerminateOutput = z.infer<typeof syncAccountTerminateOutputSchema>;
|
|
1820
|
+
|
|
1810
1821
|
declare const updateAccountInputSchema: z.ZodObject<{
|
|
1811
1822
|
account: drizzle_zod.BuildSchema<"insert", {
|
|
1812
1823
|
connectorKey: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
@@ -2314,6 +2325,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
2314
2325
|
syncAccount(input: SyncAccountInput): Promise<IRPCResponse<SyncAccountOutput>>;
|
|
2315
2326
|
syncAccountStatus(input: SyncAccountStatusInput): Promise<IRPCResponse<SyncAccountStatusOutput>>;
|
|
2316
2327
|
syncAccountRestart(input: SyncAccountRestartInput): Promise<IRPCResponse<SyncAccountRestartOutput>>;
|
|
2328
|
+
syncAccountTerminate(input: SyncAccountTerminateInput): Promise<IRPCResponse<SyncAccountTerminateOutput>>;
|
|
2317
2329
|
syncAccounts(options?: {
|
|
2318
2330
|
accounts?: AccountSelectType[];
|
|
2319
2331
|
}): Promise<IRPCResponse<void>>;
|
package/dist/export/worker.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { g as getPaymentsByBankRefIdsQuery, u as updatePaymentCommand, c as createPaymentCommand, a as updateAccountLastSyncCommand, b as getCredentialsByAccountId, i as initiateConnector } from '../shared/bank.
|
|
2
|
-
export { w as BankWorkflows } from '../shared/bank.
|
|
1
|
+
import { g as getPaymentsByBankRefIdsQuery, u as updatePaymentCommand, c as createPaymentCommand, a as updateAccountLastSyncCommand, b as getCredentialsByAccountId, i as initiateConnector } from '../shared/bank.BVoTAfMF.mjs';
|
|
2
|
+
export { w as BankWorkflows } from '../shared/bank.BVoTAfMF.mjs';
|
|
3
3
|
import { uuidv4, bankAccountMetadataSchema, workflowInstanceStatusSchema, develitWorker, createInternalError, first, action, service } from '@develit-io/backend-sdk';
|
|
4
4
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
5
|
import { drizzle } from 'drizzle-orm/d1';
|
|
6
|
-
import { t as tables, c as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, P as PAYMENT_TYPES, g as CONNECTOR_KEYS, B as BATCH_STATUSES, d as PAYMENT_STATUSES, e as PAYMENT_DIRECTIONS, i as accountInsertSchema, v as getPaymentDirection, M as MockConnector, F as FinbricksConnector, E as ErsteConnector } from '../shared/bank.
|
|
6
|
+
import { t as tables, c as INSTRUCTION_PRIORITIES, C as CHARGE_BEARERS, P as PAYMENT_TYPES, g as CONNECTOR_KEYS, B as BATCH_STATUSES, d as PAYMENT_STATUSES, e as PAYMENT_DIRECTIONS, i as accountInsertSchema, v as getPaymentDirection, M as MockConnector, F as FinbricksConnector, E as ErsteConnector } from '../shared/bank.Buq4PwHY.mjs';
|
|
7
7
|
import 'jose';
|
|
8
8
|
import { CURRENCY_CODES } from '@develit-io/general-codes';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
import { eq, inArray, and, sql, asc, desc, gte, lte } from 'drizzle-orm';
|
|
11
11
|
import 'cloudflare:workflows';
|
|
12
|
-
import '../shared/bank.
|
|
12
|
+
import '../shared/bank.DC5Hk4UF.mjs';
|
|
13
13
|
import 'drizzle-orm/sqlite-core';
|
|
14
14
|
import 'date-fns';
|
|
15
15
|
import 'drizzle-zod';
|
|
@@ -354,6 +354,13 @@ z.object({
|
|
|
354
354
|
details: workflowInstanceStatusSchema
|
|
355
355
|
});
|
|
356
356
|
|
|
357
|
+
const syncAccountTerminateInputSchema = z.object({
|
|
358
|
+
accountId: z.uuid()
|
|
359
|
+
});
|
|
360
|
+
z.object({
|
|
361
|
+
instanceId: z.string()
|
|
362
|
+
});
|
|
363
|
+
|
|
357
364
|
const updateAccountInputSchema = z.object({
|
|
358
365
|
account: accountInsertSchema
|
|
359
366
|
});
|
|
@@ -580,6 +587,19 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
580
587
|
}
|
|
581
588
|
);
|
|
582
589
|
}
|
|
590
|
+
async syncAccountTerminate(input) {
|
|
591
|
+
return this.handleAction(
|
|
592
|
+
{ data: input, schema: syncAccountTerminateInputSchema },
|
|
593
|
+
{ successMessage: "Account sync workflow terminated" },
|
|
594
|
+
async ({ accountId }) => {
|
|
595
|
+
const instance = await this.env.SYNC_ACCOUNT_PAYMENTS_WORKFLOW.get(accountId);
|
|
596
|
+
await instance.terminate();
|
|
597
|
+
return {
|
|
598
|
+
instanceId: instance.id
|
|
599
|
+
};
|
|
600
|
+
}
|
|
601
|
+
);
|
|
602
|
+
}
|
|
583
603
|
async syncAccounts(options) {
|
|
584
604
|
return this.handleAction(
|
|
585
605
|
null,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const export_workflows = require('../shared/bank.
|
|
3
|
+
const export_workflows = require('../shared/bank.DTMwkDFH.cjs');
|
|
4
4
|
require('cloudflare:workers');
|
|
5
5
|
require('cloudflare:workflows');
|
|
6
6
|
require('drizzle-orm/d1');
|
|
7
|
-
require('../shared/bank.
|
|
7
|
+
require('../shared/bank.DN3pRw5j.cjs');
|
|
8
8
|
require('@develit-io/backend-sdk');
|
|
9
9
|
require('drizzle-orm/sqlite-core');
|
|
10
10
|
require('date-fns');
|
|
@@ -14,7 +14,7 @@ require('zod');
|
|
|
14
14
|
require('jose');
|
|
15
15
|
require('drizzle-zod');
|
|
16
16
|
require('drizzle-orm/relations');
|
|
17
|
-
require('../shared/bank.
|
|
17
|
+
require('../shared/bank._ilV3SSc.cjs');
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { S as SyncAccountPaymentsWorkflow } from '../shared/bank.
|
|
1
|
+
export { S as SyncAccountPaymentsWorkflow } from '../shared/bank.BVoTAfMF.mjs';
|
|
2
2
|
import 'cloudflare:workers';
|
|
3
3
|
import 'cloudflare:workflows';
|
|
4
4
|
import 'drizzle-orm/d1';
|
|
5
|
-
import '../shared/bank.
|
|
5
|
+
import '../shared/bank.Buq4PwHY.mjs';
|
|
6
6
|
import '@develit-io/backend-sdk';
|
|
7
7
|
import 'drizzle-orm/sqlite-core';
|
|
8
8
|
import 'date-fns';
|
|
@@ -12,4 +12,4 @@ import 'zod';
|
|
|
12
12
|
import 'jose';
|
|
13
13
|
import 'drizzle-zod';
|
|
14
14
|
import 'drizzle-orm/relations';
|
|
15
|
-
import '../shared/bank.
|
|
15
|
+
import '../shared/bank.DC5Hk4UF.mjs';
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { WorkflowEntrypoint } from 'cloudflare:workers';
|
|
2
2
|
import { NonRetryableError } from 'cloudflare:workflows';
|
|
3
3
|
import { drizzle } from 'drizzle-orm/d1';
|
|
4
|
-
import { t as tables, F as FinbricksConnector, M as MockConnector, E as ErsteConnector, v as getPaymentDirection } from './bank.
|
|
5
|
-
import '@develit-io/backend-sdk';
|
|
4
|
+
import { t as tables, F as FinbricksConnector, M as MockConnector, E as ErsteConnector, v as getPaymentDirection } from './bank.Buq4PwHY.mjs';
|
|
5
|
+
import { asNonEmpty } from '@develit-io/backend-sdk';
|
|
6
6
|
import { eq, inArray } from 'drizzle-orm';
|
|
7
|
-
import { M as MockCobsConnector } from './bank.
|
|
7
|
+
import { M as MockCobsConnector } from './bank.DC5Hk4UF.mjs';
|
|
8
8
|
import 'jose';
|
|
9
9
|
import '@develit-io/general-codes';
|
|
10
10
|
|
|
11
11
|
const createPaymentCommand = (db, { payment }) => {
|
|
12
12
|
return {
|
|
13
|
-
command: db.insert(tables.payment).values(
|
|
13
|
+
command: db.insert(tables.payment).values({
|
|
14
|
+
...payment,
|
|
15
|
+
creditorIban: payment.creditor.iban,
|
|
16
|
+
debtorIban: payment.debtor.iban
|
|
17
|
+
}).returning()
|
|
14
18
|
};
|
|
15
19
|
};
|
|
16
20
|
|
|
@@ -152,10 +156,15 @@ class SyncAccountPaymentsWorkflow extends WorkflowEntrypoint {
|
|
|
152
156
|
return credentials2;
|
|
153
157
|
}
|
|
154
158
|
);
|
|
155
|
-
const
|
|
156
|
-
|
|
159
|
+
const payments = await step.do(
|
|
160
|
+
"fetch bank payments",
|
|
161
|
+
{
|
|
162
|
+
retries: { limit: 5, delay: 2e3, backoff: "constant" },
|
|
163
|
+
timeout: "30 seconds"
|
|
164
|
+
},
|
|
157
165
|
async () => {
|
|
158
|
-
|
|
166
|
+
console.log("starting connector initiation");
|
|
167
|
+
const connector = initiateConnector({
|
|
159
168
|
env: this.env,
|
|
160
169
|
bank: account.connectorKey,
|
|
161
170
|
connectedAccounts: [
|
|
@@ -166,15 +175,7 @@ class SyncAccountPaymentsWorkflow extends WorkflowEntrypoint {
|
|
|
166
175
|
}
|
|
167
176
|
]
|
|
168
177
|
});
|
|
169
|
-
|
|
170
|
-
);
|
|
171
|
-
const payments = await step.do(
|
|
172
|
-
"fetch bank payments",
|
|
173
|
-
{
|
|
174
|
-
retries: { limit: 5, delay: 2e3, backoff: "constant" },
|
|
175
|
-
timeout: "30 seconds"
|
|
176
|
-
},
|
|
177
|
-
async () => {
|
|
178
|
+
console.log("fetching payments from connector");
|
|
178
179
|
const fetched = await connector.getAllAccountPayments({
|
|
179
180
|
environment: this.env.ENVIRONMENT,
|
|
180
181
|
db,
|
|
@@ -192,6 +193,7 @@ class SyncAccountPaymentsWorkflow extends WorkflowEntrypoint {
|
|
|
192
193
|
}
|
|
193
194
|
const bankRefIds = payments.map((payment) => payment.bankRefId).filter(Boolean);
|
|
194
195
|
const existing = await step.do("load existing payments", async () => {
|
|
196
|
+
console.log("load existing payments");
|
|
195
197
|
return await getPaymentsByBankRefIdsQuery(db, {
|
|
196
198
|
ids: bankRefIds
|
|
197
199
|
});
|
|
@@ -199,59 +201,70 @@ class SyncAccountPaymentsWorkflow extends WorkflowEntrypoint {
|
|
|
199
201
|
const paymentsToUpdate = payments.filter(
|
|
200
202
|
(p) => existing.some((e) => e.bankRefId === p.bankRefId)
|
|
201
203
|
);
|
|
202
|
-
if (paymentsToUpdate.length)
|
|
203
|
-
await step.do("update existing payments", async () => {
|
|
204
|
-
const commands = paymentsToUpdate.map(
|
|
205
|
-
(p) => updatePaymentCommand(db, { payment: p }).command
|
|
206
|
-
);
|
|
207
|
-
await db.batch([commands[0], ...commands.slice(1)]);
|
|
208
|
-
await pushToQueue(
|
|
209
|
-
this.env.QUEUE_BUS_QUEUE,
|
|
210
|
-
paymentsToUpdate.map((p) => ({
|
|
211
|
-
eventType: "BANK_PAYMENT",
|
|
212
|
-
eventSignal: "paymentUpdated",
|
|
213
|
-
bankPayment: p,
|
|
214
|
-
metadata: {
|
|
215
|
-
correlationId: p.correlationId,
|
|
216
|
-
entityId: p.id,
|
|
217
|
-
idempotencySuffix: p.status,
|
|
218
|
-
timestamp: (/* @__PURE__ */ new Date()).toDateString()
|
|
219
|
-
}
|
|
220
|
-
}))
|
|
221
|
-
);
|
|
222
|
-
});
|
|
223
204
|
const paymentsToCreate = payments.filter(
|
|
224
205
|
(p) => !existing.some((e) => e.bankRefId === p.bankRefId)
|
|
225
206
|
);
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
207
|
+
await step.do("process payments and update lastSyncAt", async () => {
|
|
208
|
+
const eventsToEmit = [];
|
|
209
|
+
console.log("process payments and update lastSyncAt");
|
|
210
|
+
const updateCommands = paymentsToUpdate.map(
|
|
211
|
+
(p) => updatePaymentCommand(db, { payment: p }).command
|
|
212
|
+
);
|
|
213
|
+
eventsToEmit.push(
|
|
214
|
+
...paymentsToUpdate.map((p) => ({
|
|
215
|
+
eventType: "BANK_PAYMENT",
|
|
216
|
+
eventSignal: "paymentUpdated",
|
|
217
|
+
bankPayment: p,
|
|
218
|
+
metadata: {
|
|
219
|
+
correlationId: p.correlationId,
|
|
220
|
+
entityId: p.id,
|
|
221
|
+
idempotencySuffix: p.status,
|
|
222
|
+
timestamp: (/* @__PURE__ */ new Date()).toDateString()
|
|
223
|
+
}
|
|
224
|
+
}))
|
|
225
|
+
);
|
|
226
|
+
const createCommands = paymentsToCreate.map(
|
|
227
|
+
(p) => createPaymentCommand(db, { payment: p }).command
|
|
228
|
+
);
|
|
229
|
+
eventsToEmit.push(
|
|
230
|
+
...paymentsToCreate.map((p) => ({
|
|
231
|
+
eventType: "BANK_PAYMENT",
|
|
232
|
+
eventSignal: "paymentCreated",
|
|
233
|
+
bankPayment: p,
|
|
234
|
+
metadata: {
|
|
235
|
+
correlationId: p.correlationId,
|
|
236
|
+
entityId: p.id,
|
|
237
|
+
timestamp: (/* @__PURE__ */ new Date()).toDateString()
|
|
238
|
+
}
|
|
239
|
+
}))
|
|
240
|
+
);
|
|
241
|
+
const latest = payments.reduce((current, p) => {
|
|
242
|
+
return new Date(p.processedAt).getTime() > new Date(current.processedAt).getTime() ? p : current;
|
|
243
|
+
}, payments[0]);
|
|
244
|
+
const updateLastSyncCommand = updateAccountLastSyncCommand(db, {
|
|
245
|
+
accountId: account.id,
|
|
246
|
+
lastSyncedAt: latest.processedAt
|
|
247
|
+
}).command;
|
|
248
|
+
if (eventsToEmit.length) {
|
|
249
|
+
await db.batch(
|
|
250
|
+
asNonEmpty([
|
|
251
|
+
updateLastSyncCommand,
|
|
252
|
+
...updateCommands,
|
|
253
|
+
...createCommands
|
|
254
|
+
])
|
|
230
255
|
);
|
|
231
|
-
await db.batch([commands[0], ...commands.slice(1)]);
|
|
232
256
|
await pushToQueue(
|
|
233
257
|
this.env.QUEUE_BUS_QUEUE,
|
|
234
|
-
|
|
235
|
-
eventType: "BANK_PAYMENT",
|
|
236
|
-
eventSignal: "paymentCreated",
|
|
237
|
-
bankPayment: p,
|
|
238
|
-
metadata: {
|
|
239
|
-
correlationId: p.correlationId,
|
|
240
|
-
entityId: p.id,
|
|
241
|
-
timestamp: (/* @__PURE__ */ new Date()).toDateString()
|
|
242
|
-
}
|
|
243
|
-
}))
|
|
258
|
+
eventsToEmit
|
|
244
259
|
);
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
}).command.execute();
|
|
254
|
-
return latest.createdAt;
|
|
260
|
+
}
|
|
261
|
+
return {
|
|
262
|
+
payments: payments.length,
|
|
263
|
+
updated: paymentsToUpdate.length,
|
|
264
|
+
created: paymentsToCreate.length,
|
|
265
|
+
eventsEmitted: eventsToEmit.length,
|
|
266
|
+
lastSyncedAt: latest?.createdAt
|
|
267
|
+
};
|
|
255
268
|
});
|
|
256
269
|
await step.sleep(
|
|
257
270
|
"Sleep for next sync",
|