@develit-services/bank 0.0.32 → 0.0.33
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 +2 -2
- 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 +2 -2
- package/dist/export/worker.cjs +65 -56
- package/dist/export/worker.d.cts +9 -8
- package/dist/export/worker.d.mts +9 -8
- package/dist/export/worker.d.ts +9 -8
- package/dist/export/worker.mjs +66 -57
- package/dist/shared/{bank.e_XSg9KV.d.mts → bank.B1d_PE1-.d.cts} +6 -6
- package/dist/shared/{bank.e_XSg9KV.d.cts → bank.B1d_PE1-.d.mts} +6 -6
- package/dist/shared/{bank.e_XSg9KV.d.ts → bank.B1d_PE1-.d.ts} +6 -6
- package/dist/shared/{bank.-qiBc98X.d.mts → bank.B31ygxgn.d.mts} +1 -1
- package/dist/shared/{bank.BiZtZWed.cjs → bank.BVW0vOQS.cjs} +1 -1
- package/dist/shared/{bank.uJ3YtInA.mjs → bank.ClfukJ-T.mjs} +2 -2
- package/dist/shared/{bank.Dx7kRjFL.cjs → bank.D4BlThGx.cjs} +2 -2
- package/dist/shared/{bank._5C74-4K.d.cts → bank.DclyB3RM.d.ts} +1 -1
- package/dist/shared/{bank.A5zjotaU.mjs → bank.De_ddIjl.mjs} +1 -1
- package/dist/shared/{bank.BRiDHyNf.d.ts → bank.DkHmB4jn.d.cts} +1 -1
- package/dist/types.cjs +3 -3
- package/dist/types.d.cts +4 -4
- package/dist/types.d.mts +4 -4
- package/dist/types.d.ts +4 -4
- package/dist/types.mjs +3 -3
- package/package.json +1 -1
package/dist/database/schema.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const database_schema = require('../shared/bank.
|
|
3
|
+
const database_schema = require('../shared/bank.D4BlThGx.cjs');
|
|
4
4
|
require('@develit-io/backend-sdk');
|
|
5
|
+
require('drizzle-orm/sqlite-core');
|
|
5
6
|
require('drizzle-orm');
|
|
6
7
|
require('@develit-io/general-codes');
|
|
7
8
|
require('zod');
|
|
8
9
|
require('jose');
|
|
9
10
|
require('drizzle-zod');
|
|
10
|
-
require('drizzle-orm/sqlite-core');
|
|
11
11
|
require('date-fns');
|
|
12
12
|
require('drizzle-orm/relations');
|
|
13
13
|
|
|
@@ -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.B1d_PE1-.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.B1d_PE1-.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.B1d_PE1-.js';
|
|
2
2
|
import 'drizzle-orm/sqlite-core';
|
|
3
3
|
import 'drizzle-orm';
|
|
4
4
|
import 'zod';
|
package/dist/database/schema.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export { y as account, z as accountCredentials, r as batch, x as ott, v as payment, w as paymentRelations } from '../shared/bank.
|
|
1
|
+
export { y as account, z as accountCredentials, r as batch, x as ott, v as payment, w as paymentRelations } from '../shared/bank.ClfukJ-T.mjs';
|
|
2
2
|
import '@develit-io/backend-sdk';
|
|
3
|
+
import 'drizzle-orm/sqlite-core';
|
|
3
4
|
import 'drizzle-orm';
|
|
4
5
|
import '@develit-io/general-codes';
|
|
5
6
|
import 'zod';
|
|
6
7
|
import 'jose';
|
|
7
8
|
import 'drizzle-zod';
|
|
8
|
-
import 'drizzle-orm/sqlite-core';
|
|
9
9
|
import 'date-fns';
|
|
10
10
|
import 'drizzle-orm/relations';
|
package/dist/export/worker.cjs
CHANGED
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
6
|
-
const database_schema = require('../shared/bank.Dx7kRjFL.cjs');
|
|
7
6
|
const cloudflare_workers = require('cloudflare:workers');
|
|
8
7
|
const d1 = require('drizzle-orm/d1');
|
|
9
|
-
const
|
|
10
|
-
const generalCodes = require('@develit-io/general-codes');
|
|
8
|
+
const database_schema = require('../shared/bank.D4BlThGx.cjs');
|
|
11
9
|
require('jose');
|
|
10
|
+
const generalCodes = require('@develit-io/general-codes');
|
|
11
|
+
const zod = require('zod');
|
|
12
12
|
const drizzleOrm = require('drizzle-orm');
|
|
13
|
-
const mockCobs_connector = require('../shared/bank.
|
|
14
|
-
require('drizzle-zod');
|
|
13
|
+
const mockCobs_connector = require('../shared/bank.BVW0vOQS.cjs');
|
|
15
14
|
require('drizzle-orm/sqlite-core');
|
|
15
|
+
require('drizzle-zod');
|
|
16
16
|
require('date-fns');
|
|
17
17
|
require('drizzle-orm/relations');
|
|
18
18
|
|
|
@@ -111,52 +111,14 @@ const updateAccountLastSyncCommand = (db, { lastSyncedAt, accountId }) => {
|
|
|
111
111
|
};
|
|
112
112
|
};
|
|
113
113
|
|
|
114
|
-
const
|
|
115
|
-
|
|
116
|
-
return payment;
|
|
117
|
-
};
|
|
118
|
-
|
|
119
|
-
const getOpenBatchByAccountIdQuery = async (db, { accountId }) => {
|
|
120
|
-
const batch = await db.select().from(database_schema.tables.batch).where(
|
|
121
|
-
drizzleOrm.and(
|
|
122
|
-
drizzleOrm.eq(database_schema.tables.batch.accountId, accountId),
|
|
123
|
-
drizzleOrm.eq(database_schema.tables.batch.status, "OPEN")
|
|
124
|
-
)
|
|
125
|
-
).limit(1).get();
|
|
126
|
-
return batch;
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const getPaymentsByBankRefIdsQuery = async (db, { ids }) => {
|
|
130
|
-
return await db.select().from(database_schema.tables.payment).where(drizzleOrm.inArray(database_schema.tables.payment.bankRefId, ids));
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const getOttQuery = async (db, { ott }) => {
|
|
134
|
-
return await db.select().from(database_schema.tables.ott).where(drizzleOrm.eq(database_schema.tables.ott.oneTimeToken, ott)).get();
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const getAllPendingBatchesQuery = (db) => {
|
|
138
|
-
return db.select().from(database_schema.tables.batch).where(
|
|
139
|
-
drizzleOrm.inArray(database_schema.tables.batch.status, [
|
|
140
|
-
"PROCESSING",
|
|
141
|
-
"READY_TO_SIGN",
|
|
142
|
-
"WAITING_FOR_PROCESSING"
|
|
143
|
-
])
|
|
144
|
-
);
|
|
114
|
+
const getAccountByIbanQuery = async (db, { iban }) => {
|
|
115
|
+
return await db.select().from(database_schema.tables.account).where(drizzleOrm.eq(database_schema.tables.account.iban, iban)).get();
|
|
145
116
|
};
|
|
146
117
|
|
|
147
118
|
const getAccountByIdQuery = async (db, { accountId }) => {
|
|
148
119
|
return await db.select().from(database_schema.tables.account).where(drizzleOrm.eq(database_schema.tables.account.id, accountId)).get();
|
|
149
120
|
};
|
|
150
121
|
|
|
151
|
-
const getCredentialsByAccountId = async (db, { accountId }) => {
|
|
152
|
-
const cred = await db.select().from(database_schema.tables.accountCredentials).where(drizzleOrm.eq(database_schema.tables.accountCredentials.accountId, accountId)).get();
|
|
153
|
-
return cred;
|
|
154
|
-
};
|
|
155
|
-
|
|
156
|
-
const getAccountByIbanQuery = async (db, { iban }) => {
|
|
157
|
-
return await db.select().from(database_schema.tables.account).where(drizzleOrm.eq(database_schema.tables.account.iban, iban)).get();
|
|
158
|
-
};
|
|
159
|
-
|
|
160
122
|
const getAllAccountsQuery = async (db) => {
|
|
161
123
|
const accountsWithExpiration = await db.select().from(database_schema.tables.account).leftJoin(
|
|
162
124
|
database_schema.tables.accountCredentials,
|
|
@@ -170,6 +132,16 @@ const getAllAccountsQuery = async (db) => {
|
|
|
170
132
|
});
|
|
171
133
|
};
|
|
172
134
|
|
|
135
|
+
const getAllPendingBatchesQuery = (db) => {
|
|
136
|
+
return db.select().from(database_schema.tables.batch).where(
|
|
137
|
+
drizzleOrm.inArray(database_schema.tables.batch.status, [
|
|
138
|
+
"PROCESSING",
|
|
139
|
+
"READY_TO_SIGN",
|
|
140
|
+
"WAITING_FOR_PROCESSING"
|
|
141
|
+
])
|
|
142
|
+
);
|
|
143
|
+
};
|
|
144
|
+
|
|
173
145
|
const buildMultiFilterConditions = (column, value) => {
|
|
174
146
|
if (value === void 0) return void 0;
|
|
175
147
|
if (Array.isArray(value)) {
|
|
@@ -234,6 +206,50 @@ const getPaymentsWithPaginationQuery = async (db, {
|
|
|
234
206
|
};
|
|
235
207
|
};
|
|
236
208
|
|
|
209
|
+
const getBatchesQuery = async (db, { limit = 100, offset = 0, filterBatchAccountId }) => {
|
|
210
|
+
const whereConditions = buildMultiFilterConditions(
|
|
211
|
+
database_schema.tables.batch.accountId,
|
|
212
|
+
filterBatchAccountId
|
|
213
|
+
);
|
|
214
|
+
const [batches, countResult] = await Promise.all([
|
|
215
|
+
db.select().from(database_schema.tables.batch).where(whereConditions).limit(limit).offset(offset).orderBy(drizzleOrm.desc(database_schema.tables.batch.createdAt)),
|
|
216
|
+
db.select({ totalCount: drizzleOrm.sql`count(*)` }).from(database_schema.tables.batch).where(whereConditions)
|
|
217
|
+
]);
|
|
218
|
+
const totalCount = Number(countResult[0]?.totalCount) || 0;
|
|
219
|
+
return {
|
|
220
|
+
batches,
|
|
221
|
+
totalCount
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
const getCredentialsByAccountId = async (db, { accountId }) => {
|
|
226
|
+
const cred = await db.select().from(database_schema.tables.accountCredentials).where(drizzleOrm.eq(database_schema.tables.accountCredentials.accountId, accountId)).get();
|
|
227
|
+
return cred;
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
const getOpenBatchByAccountIdQuery = async (db, { accountId }) => {
|
|
231
|
+
const batch = await db.select().from(database_schema.tables.batch).where(
|
|
232
|
+
drizzleOrm.and(
|
|
233
|
+
drizzleOrm.eq(database_schema.tables.batch.accountId, accountId),
|
|
234
|
+
drizzleOrm.eq(database_schema.tables.batch.status, "OPEN")
|
|
235
|
+
)
|
|
236
|
+
).limit(1).get();
|
|
237
|
+
return batch;
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const getOttQuery = async (db, { ott }) => {
|
|
241
|
+
return await db.select().from(database_schema.tables.ott).where(drizzleOrm.eq(database_schema.tables.ott.oneTimeToken, ott)).get();
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const getPaymentByRefIdQuery = async (db, { refId }) => {
|
|
245
|
+
const payment = await db.select().from(database_schema.tables.payment).where(drizzleOrm.eq(database_schema.tables.payment.refId, refId)).limit(1).get();
|
|
246
|
+
return payment;
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
const getPaymentsByBankRefIdsQuery = async (db, { ids }) => {
|
|
250
|
+
return await db.select().from(database_schema.tables.payment).where(drizzleOrm.inArray(database_schema.tables.payment.bankRefId, ids));
|
|
251
|
+
};
|
|
252
|
+
|
|
237
253
|
class CreditasConnector extends database_schema.FinbricksConnector {
|
|
238
254
|
constructor(config) {
|
|
239
255
|
super("CREDITAS", config);
|
|
@@ -379,7 +395,8 @@ const initiateConnectorInputSchema = zod.z.object({
|
|
|
379
395
|
|
|
380
396
|
const getBatchesInputSchema = zod.z.object({
|
|
381
397
|
limit: zod.z.number().positive().optional().default(100),
|
|
382
|
-
offset: zod.z.number().min(0).optional().default(0)
|
|
398
|
+
offset: zod.z.number().min(0).optional().default(0),
|
|
399
|
+
filterBatchAccountId: zod.z.union([zod.z.uuid(), zod.z.uuid().array()]).optional()
|
|
383
400
|
});
|
|
384
401
|
|
|
385
402
|
const processBatchInputSchema = zod.z.object({
|
|
@@ -1112,16 +1129,8 @@ let BankServiceBase = class extends backendSdk.develitWorker(cloudflare_workers.
|
|
|
1112
1129
|
return this.handleAction(
|
|
1113
1130
|
{ data: input, schema: getBatchesInputSchema },
|
|
1114
1131
|
{ successMessage: "Batches retrieved successfully" },
|
|
1115
|
-
async (
|
|
1116
|
-
|
|
1117
|
-
this.db.select().from(database_schema.tables.batch).limit(limit).offset(offset).orderBy(drizzleOrm.desc(database_schema.tables.batch.createdAt)),
|
|
1118
|
-
this.db.select({ count: drizzleOrm.sql`count(*)`.as("count") }).from(database_schema.tables.batch)
|
|
1119
|
-
]);
|
|
1120
|
-
const totalCount = Number(countResult[0]?.count) || 0;
|
|
1121
|
-
return {
|
|
1122
|
-
batches: batchesResult,
|
|
1123
|
-
totalCount
|
|
1124
|
-
};
|
|
1132
|
+
async (params) => {
|
|
1133
|
+
return await getBatchesQuery(this.db, params);
|
|
1125
1134
|
}
|
|
1126
1135
|
);
|
|
1127
1136
|
}
|
package/dist/export/worker.d.cts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
2
2
|
import { IRPCResponse } from '@develit-io/backend-sdk';
|
|
3
|
-
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.e_XSg9KV.cjs';
|
|
4
3
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
|
+
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.B1d_PE1-.cjs';
|
|
6
|
+
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.DkHmB4jn.cjs';
|
|
6
7
|
import { z } from 'zod';
|
|
7
|
-
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank._5C74-4K.cjs';
|
|
8
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
9
|
import 'drizzle-orm';
|
|
10
10
|
import '@develit-io/general-codes';
|
|
@@ -223,6 +223,7 @@ interface initiateConnectorOutput {
|
|
|
223
223
|
declare const getBatchesInputSchema: z.ZodObject<{
|
|
224
224
|
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
225
225
|
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
226
|
+
filterBatchAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
226
227
|
}, z.core.$strip>;
|
|
227
228
|
interface GetBatchesInput extends z.infer<typeof getBatchesInputSchema> {
|
|
228
229
|
}
|
|
@@ -251,9 +252,9 @@ declare const getPaymentsInputSchema: z.ZodObject<{
|
|
|
251
252
|
limit: z.ZodNumber;
|
|
252
253
|
sort: z.ZodObject<{
|
|
253
254
|
column: z.ZodEnum<{
|
|
255
|
+
amount: "amount";
|
|
254
256
|
createdAt: "createdAt";
|
|
255
257
|
updatedAt: "updatedAt";
|
|
256
|
-
amount: "amount";
|
|
257
258
|
}>;
|
|
258
259
|
direction: z.ZodEnum<{
|
|
259
260
|
asc: "asc";
|
|
@@ -382,17 +383,17 @@ declare const getPaymentsInputSchema: z.ZodObject<{
|
|
|
382
383
|
filterPaymentDateTo: z.ZodOptional<z.ZodDate>;
|
|
383
384
|
filterPaymentStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
384
385
|
PREPARED: "PREPARED";
|
|
385
|
-
COMPLETED: "COMPLETED";
|
|
386
|
-
FAILED: "FAILED";
|
|
387
386
|
INITIALIZED: "INITIALIZED";
|
|
387
|
+
FAILED: "FAILED";
|
|
388
388
|
PENDING: "PENDING";
|
|
389
|
+
COMPLETED: "COMPLETED";
|
|
389
390
|
CREATED: "CREATED";
|
|
390
391
|
}>, z.ZodArray<z.ZodEnum<{
|
|
391
392
|
PREPARED: "PREPARED";
|
|
392
|
-
COMPLETED: "COMPLETED";
|
|
393
|
-
FAILED: "FAILED";
|
|
394
393
|
INITIALIZED: "INITIALIZED";
|
|
394
|
+
FAILED: "FAILED";
|
|
395
395
|
PENDING: "PENDING";
|
|
396
|
+
COMPLETED: "COMPLETED";
|
|
396
397
|
CREATED: "CREATED";
|
|
397
398
|
}>>]>>;
|
|
398
399
|
}, z.core.$strip>;
|
|
@@ -450,7 +451,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
450
451
|
addPaymentsToBatch({ paymentsToBatch, }: {
|
|
451
452
|
paymentsToBatch: SendPaymentInput[];
|
|
452
453
|
}): Promise<IRPCResponse<{
|
|
453
|
-
status: "
|
|
454
|
+
status: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "WAITING_FOR_PROCESSING" | null;
|
|
454
455
|
id: string;
|
|
455
456
|
createdAt: Date | null;
|
|
456
457
|
updatedAt: Date | null;
|
package/dist/export/worker.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
2
2
|
import { IRPCResponse } from '@develit-io/backend-sdk';
|
|
3
|
-
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.e_XSg9KV.mjs';
|
|
4
3
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
|
+
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.B1d_PE1-.mjs';
|
|
6
|
+
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.B31ygxgn.mjs';
|
|
6
7
|
import { z } from 'zod';
|
|
7
|
-
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.-qiBc98X.mjs';
|
|
8
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
9
|
import 'drizzle-orm';
|
|
10
10
|
import '@develit-io/general-codes';
|
|
@@ -223,6 +223,7 @@ interface initiateConnectorOutput {
|
|
|
223
223
|
declare const getBatchesInputSchema: z.ZodObject<{
|
|
224
224
|
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
225
225
|
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
226
|
+
filterBatchAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
226
227
|
}, z.core.$strip>;
|
|
227
228
|
interface GetBatchesInput extends z.infer<typeof getBatchesInputSchema> {
|
|
228
229
|
}
|
|
@@ -251,9 +252,9 @@ declare const getPaymentsInputSchema: z.ZodObject<{
|
|
|
251
252
|
limit: z.ZodNumber;
|
|
252
253
|
sort: z.ZodObject<{
|
|
253
254
|
column: z.ZodEnum<{
|
|
255
|
+
amount: "amount";
|
|
254
256
|
createdAt: "createdAt";
|
|
255
257
|
updatedAt: "updatedAt";
|
|
256
|
-
amount: "amount";
|
|
257
258
|
}>;
|
|
258
259
|
direction: z.ZodEnum<{
|
|
259
260
|
asc: "asc";
|
|
@@ -382,17 +383,17 @@ declare const getPaymentsInputSchema: z.ZodObject<{
|
|
|
382
383
|
filterPaymentDateTo: z.ZodOptional<z.ZodDate>;
|
|
383
384
|
filterPaymentStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
384
385
|
PREPARED: "PREPARED";
|
|
385
|
-
COMPLETED: "COMPLETED";
|
|
386
|
-
FAILED: "FAILED";
|
|
387
386
|
INITIALIZED: "INITIALIZED";
|
|
387
|
+
FAILED: "FAILED";
|
|
388
388
|
PENDING: "PENDING";
|
|
389
|
+
COMPLETED: "COMPLETED";
|
|
389
390
|
CREATED: "CREATED";
|
|
390
391
|
}>, z.ZodArray<z.ZodEnum<{
|
|
391
392
|
PREPARED: "PREPARED";
|
|
392
|
-
COMPLETED: "COMPLETED";
|
|
393
|
-
FAILED: "FAILED";
|
|
394
393
|
INITIALIZED: "INITIALIZED";
|
|
394
|
+
FAILED: "FAILED";
|
|
395
395
|
PENDING: "PENDING";
|
|
396
|
+
COMPLETED: "COMPLETED";
|
|
396
397
|
CREATED: "CREATED";
|
|
397
398
|
}>>]>>;
|
|
398
399
|
}, z.core.$strip>;
|
|
@@ -450,7 +451,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
450
451
|
addPaymentsToBatch({ paymentsToBatch, }: {
|
|
451
452
|
paymentsToBatch: SendPaymentInput[];
|
|
452
453
|
}): Promise<IRPCResponse<{
|
|
453
|
-
status: "
|
|
454
|
+
status: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "WAITING_FOR_PROCESSING" | null;
|
|
454
455
|
id: string;
|
|
455
456
|
createdAt: Date | null;
|
|
456
457
|
updatedAt: Date | null;
|
package/dist/export/worker.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _develit_io_backend_sdk from '@develit-io/backend-sdk';
|
|
2
2
|
import { IRPCResponse } from '@develit-io/backend-sdk';
|
|
3
|
-
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.e_XSg9KV.js';
|
|
4
3
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
5
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
|
+
import { P as PaymentSelectType, B as BatchSelectType, t as tables, a as PaymentInsertType } from '../shared/bank.B1d_PE1-.js';
|
|
6
|
+
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.DclyB3RM.js';
|
|
6
7
|
import { z } from 'zod';
|
|
7
|
-
import { A as AccountSelectType, C as ConfigEnvironmentBank, I as IBankConnector, a as ConnectorKey } from '../shared/bank.BRiDHyNf.js';
|
|
8
8
|
import 'drizzle-orm/sqlite-core';
|
|
9
9
|
import 'drizzle-orm';
|
|
10
10
|
import '@develit-io/general-codes';
|
|
@@ -223,6 +223,7 @@ interface initiateConnectorOutput {
|
|
|
223
223
|
declare const getBatchesInputSchema: z.ZodObject<{
|
|
224
224
|
limit: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
225
225
|
offset: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
226
|
+
filterBatchAccountId: z.ZodOptional<z.ZodUnion<readonly [z.ZodUUID, z.ZodArray<z.ZodUUID>]>>;
|
|
226
227
|
}, z.core.$strip>;
|
|
227
228
|
interface GetBatchesInput extends z.infer<typeof getBatchesInputSchema> {
|
|
228
229
|
}
|
|
@@ -251,9 +252,9 @@ declare const getPaymentsInputSchema: z.ZodObject<{
|
|
|
251
252
|
limit: z.ZodNumber;
|
|
252
253
|
sort: z.ZodObject<{
|
|
253
254
|
column: z.ZodEnum<{
|
|
255
|
+
amount: "amount";
|
|
254
256
|
createdAt: "createdAt";
|
|
255
257
|
updatedAt: "updatedAt";
|
|
256
|
-
amount: "amount";
|
|
257
258
|
}>;
|
|
258
259
|
direction: z.ZodEnum<{
|
|
259
260
|
asc: "asc";
|
|
@@ -382,17 +383,17 @@ declare const getPaymentsInputSchema: z.ZodObject<{
|
|
|
382
383
|
filterPaymentDateTo: z.ZodOptional<z.ZodDate>;
|
|
383
384
|
filterPaymentStatus: z.ZodOptional<z.ZodUnion<readonly [z.ZodEnum<{
|
|
384
385
|
PREPARED: "PREPARED";
|
|
385
|
-
COMPLETED: "COMPLETED";
|
|
386
|
-
FAILED: "FAILED";
|
|
387
386
|
INITIALIZED: "INITIALIZED";
|
|
387
|
+
FAILED: "FAILED";
|
|
388
388
|
PENDING: "PENDING";
|
|
389
|
+
COMPLETED: "COMPLETED";
|
|
389
390
|
CREATED: "CREATED";
|
|
390
391
|
}>, z.ZodArray<z.ZodEnum<{
|
|
391
392
|
PREPARED: "PREPARED";
|
|
392
|
-
COMPLETED: "COMPLETED";
|
|
393
|
-
FAILED: "FAILED";
|
|
394
393
|
INITIALIZED: "INITIALIZED";
|
|
394
|
+
FAILED: "FAILED";
|
|
395
395
|
PENDING: "PENDING";
|
|
396
|
+
COMPLETED: "COMPLETED";
|
|
396
397
|
CREATED: "CREATED";
|
|
397
398
|
}>>]>>;
|
|
398
399
|
}, z.core.$strip>;
|
|
@@ -450,7 +451,7 @@ declare class BankServiceBase extends BankServiceBase_base {
|
|
|
450
451
|
addPaymentsToBatch({ paymentsToBatch, }: {
|
|
451
452
|
paymentsToBatch: SendPaymentInput[];
|
|
452
453
|
}): Promise<IRPCResponse<{
|
|
453
|
-
status: "
|
|
454
|
+
status: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "WAITING_FOR_PROCESSING" | null;
|
|
454
455
|
id: string;
|
|
455
456
|
createdAt: Date | null;
|
|
456
457
|
updatedAt: Date | null;
|
package/dist/export/worker.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { uuidv4, develitWorker, createInternalError, first, RPCResponse, action, service } from '@develit-io/backend-sdk';
|
|
2
|
-
import { t as tables, F as FinbricksConnector, M as MockConnector, E as ErsteConnector, P as PAYMENT_TYPES, e as CONNECTOR_KEYS, c as PAYMENT_STATUSES, d as PAYMENT_DIRECTIONS, q as getPaymentDirection } from '../shared/bank.uJ3YtInA.mjs';
|
|
3
2
|
import { WorkerEntrypoint } from 'cloudflare:workers';
|
|
4
3
|
import { drizzle } from 'drizzle-orm/d1';
|
|
5
|
-
import {
|
|
6
|
-
import { CURRENCY_CODES } from '@develit-io/general-codes';
|
|
4
|
+
import { t as tables, F as FinbricksConnector, M as MockConnector, E as ErsteConnector, P as PAYMENT_TYPES, e as CONNECTOR_KEYS, c as PAYMENT_STATUSES, d as PAYMENT_DIRECTIONS, q as getPaymentDirection } from '../shared/bank.ClfukJ-T.mjs';
|
|
7
5
|
import 'jose';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import 'drizzle-
|
|
6
|
+
import { CURRENCY_CODES } from '@develit-io/general-codes';
|
|
7
|
+
import { z } from 'zod';
|
|
8
|
+
import { eq, inArray, and, sql, asc, desc, gte, lte } from 'drizzle-orm';
|
|
9
|
+
import { M as MockCobsConnector } from '../shared/bank.De_ddIjl.mjs';
|
|
11
10
|
import 'drizzle-orm/sqlite-core';
|
|
11
|
+
import 'drizzle-zod';
|
|
12
12
|
import 'date-fns';
|
|
13
13
|
import 'drizzle-orm/relations';
|
|
14
14
|
|
|
@@ -107,52 +107,14 @@ const updateAccountLastSyncCommand = (db, { lastSyncedAt, accountId }) => {
|
|
|
107
107
|
};
|
|
108
108
|
};
|
|
109
109
|
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
return payment;
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const getOpenBatchByAccountIdQuery = async (db, { accountId }) => {
|
|
116
|
-
const batch = await db.select().from(tables.batch).where(
|
|
117
|
-
and(
|
|
118
|
-
eq(tables.batch.accountId, accountId),
|
|
119
|
-
eq(tables.batch.status, "OPEN")
|
|
120
|
-
)
|
|
121
|
-
).limit(1).get();
|
|
122
|
-
return batch;
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const getPaymentsByBankRefIdsQuery = async (db, { ids }) => {
|
|
126
|
-
return await db.select().from(tables.payment).where(inArray(tables.payment.bankRefId, ids));
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
const getOttQuery = async (db, { ott }) => {
|
|
130
|
-
return await db.select().from(tables.ott).where(eq(tables.ott.oneTimeToken, ott)).get();
|
|
131
|
-
};
|
|
132
|
-
|
|
133
|
-
const getAllPendingBatchesQuery = (db) => {
|
|
134
|
-
return db.select().from(tables.batch).where(
|
|
135
|
-
inArray(tables.batch.status, [
|
|
136
|
-
"PROCESSING",
|
|
137
|
-
"READY_TO_SIGN",
|
|
138
|
-
"WAITING_FOR_PROCESSING"
|
|
139
|
-
])
|
|
140
|
-
);
|
|
110
|
+
const getAccountByIbanQuery = async (db, { iban }) => {
|
|
111
|
+
return await db.select().from(tables.account).where(eq(tables.account.iban, iban)).get();
|
|
141
112
|
};
|
|
142
113
|
|
|
143
114
|
const getAccountByIdQuery = async (db, { accountId }) => {
|
|
144
115
|
return await db.select().from(tables.account).where(eq(tables.account.id, accountId)).get();
|
|
145
116
|
};
|
|
146
117
|
|
|
147
|
-
const getCredentialsByAccountId = async (db, { accountId }) => {
|
|
148
|
-
const cred = await db.select().from(tables.accountCredentials).where(eq(tables.accountCredentials.accountId, accountId)).get();
|
|
149
|
-
return cred;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const getAccountByIbanQuery = async (db, { iban }) => {
|
|
153
|
-
return await db.select().from(tables.account).where(eq(tables.account.iban, iban)).get();
|
|
154
|
-
};
|
|
155
|
-
|
|
156
118
|
const getAllAccountsQuery = async (db) => {
|
|
157
119
|
const accountsWithExpiration = await db.select().from(tables.account).leftJoin(
|
|
158
120
|
tables.accountCredentials,
|
|
@@ -166,6 +128,16 @@ const getAllAccountsQuery = async (db) => {
|
|
|
166
128
|
});
|
|
167
129
|
};
|
|
168
130
|
|
|
131
|
+
const getAllPendingBatchesQuery = (db) => {
|
|
132
|
+
return db.select().from(tables.batch).where(
|
|
133
|
+
inArray(tables.batch.status, [
|
|
134
|
+
"PROCESSING",
|
|
135
|
+
"READY_TO_SIGN",
|
|
136
|
+
"WAITING_FOR_PROCESSING"
|
|
137
|
+
])
|
|
138
|
+
);
|
|
139
|
+
};
|
|
140
|
+
|
|
169
141
|
const buildMultiFilterConditions = (column, value) => {
|
|
170
142
|
if (value === void 0) return void 0;
|
|
171
143
|
if (Array.isArray(value)) {
|
|
@@ -230,6 +202,50 @@ const getPaymentsWithPaginationQuery = async (db, {
|
|
|
230
202
|
};
|
|
231
203
|
};
|
|
232
204
|
|
|
205
|
+
const getBatchesQuery = async (db, { limit = 100, offset = 0, filterBatchAccountId }) => {
|
|
206
|
+
const whereConditions = buildMultiFilterConditions(
|
|
207
|
+
tables.batch.accountId,
|
|
208
|
+
filterBatchAccountId
|
|
209
|
+
);
|
|
210
|
+
const [batches, countResult] = await Promise.all([
|
|
211
|
+
db.select().from(tables.batch).where(whereConditions).limit(limit).offset(offset).orderBy(desc(tables.batch.createdAt)),
|
|
212
|
+
db.select({ totalCount: sql`count(*)` }).from(tables.batch).where(whereConditions)
|
|
213
|
+
]);
|
|
214
|
+
const totalCount = Number(countResult[0]?.totalCount) || 0;
|
|
215
|
+
return {
|
|
216
|
+
batches,
|
|
217
|
+
totalCount
|
|
218
|
+
};
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
const getCredentialsByAccountId = async (db, { accountId }) => {
|
|
222
|
+
const cred = await db.select().from(tables.accountCredentials).where(eq(tables.accountCredentials.accountId, accountId)).get();
|
|
223
|
+
return cred;
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
const getOpenBatchByAccountIdQuery = async (db, { accountId }) => {
|
|
227
|
+
const batch = await db.select().from(tables.batch).where(
|
|
228
|
+
and(
|
|
229
|
+
eq(tables.batch.accountId, accountId),
|
|
230
|
+
eq(tables.batch.status, "OPEN")
|
|
231
|
+
)
|
|
232
|
+
).limit(1).get();
|
|
233
|
+
return batch;
|
|
234
|
+
};
|
|
235
|
+
|
|
236
|
+
const getOttQuery = async (db, { ott }) => {
|
|
237
|
+
return await db.select().from(tables.ott).where(eq(tables.ott.oneTimeToken, ott)).get();
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
const getPaymentByRefIdQuery = async (db, { refId }) => {
|
|
241
|
+
const payment = await db.select().from(tables.payment).where(eq(tables.payment.refId, refId)).limit(1).get();
|
|
242
|
+
return payment;
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
const getPaymentsByBankRefIdsQuery = async (db, { ids }) => {
|
|
246
|
+
return await db.select().from(tables.payment).where(inArray(tables.payment.bankRefId, ids));
|
|
247
|
+
};
|
|
248
|
+
|
|
233
249
|
class CreditasConnector extends FinbricksConnector {
|
|
234
250
|
constructor(config) {
|
|
235
251
|
super("CREDITAS", config);
|
|
@@ -375,7 +391,8 @@ const initiateConnectorInputSchema = z.object({
|
|
|
375
391
|
|
|
376
392
|
const getBatchesInputSchema = z.object({
|
|
377
393
|
limit: z.number().positive().optional().default(100),
|
|
378
|
-
offset: z.number().min(0).optional().default(0)
|
|
394
|
+
offset: z.number().min(0).optional().default(0),
|
|
395
|
+
filterBatchAccountId: z.union([z.uuid(), z.uuid().array()]).optional()
|
|
379
396
|
});
|
|
380
397
|
|
|
381
398
|
const processBatchInputSchema = z.object({
|
|
@@ -1108,16 +1125,8 @@ let BankServiceBase = class extends develitWorker(WorkerEntrypoint) {
|
|
|
1108
1125
|
return this.handleAction(
|
|
1109
1126
|
{ data: input, schema: getBatchesInputSchema },
|
|
1110
1127
|
{ successMessage: "Batches retrieved successfully" },
|
|
1111
|
-
async (
|
|
1112
|
-
|
|
1113
|
-
this.db.select().from(tables.batch).limit(limit).offset(offset).orderBy(desc(tables.batch.createdAt)),
|
|
1114
|
-
this.db.select({ count: sql`count(*)`.as("count") }).from(tables.batch)
|
|
1115
|
-
]);
|
|
1116
|
-
const totalCount = Number(countResult[0]?.count) || 0;
|
|
1117
|
-
return {
|
|
1118
|
-
batches: batchesResult,
|
|
1119
|
-
totalCount
|
|
1120
|
-
};
|
|
1128
|
+
async (params) => {
|
|
1129
|
+
return await getBatchesQuery(this.db, params);
|
|
1121
1130
|
}
|
|
1122
1131
|
);
|
|
1123
1132
|
}
|
|
@@ -82,10 +82,10 @@ declare const paymentInsertTypeZod: z.ZodObject<{
|
|
|
82
82
|
}>;
|
|
83
83
|
status: z.ZodEnum<{
|
|
84
84
|
PREPARED: "PREPARED";
|
|
85
|
-
COMPLETED: "COMPLETED";
|
|
86
|
-
FAILED: "FAILED";
|
|
87
85
|
INITIALIZED: "INITIALIZED";
|
|
86
|
+
FAILED: "FAILED";
|
|
88
87
|
PENDING: "PENDING";
|
|
88
|
+
COMPLETED: "COMPLETED";
|
|
89
89
|
CREATED: "CREATED";
|
|
90
90
|
}>;
|
|
91
91
|
batchId: z.ZodString;
|
|
@@ -165,7 +165,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
165
165
|
tableName: "batch";
|
|
166
166
|
dataType: "string";
|
|
167
167
|
columnType: "SQLiteText";
|
|
168
|
-
data: "
|
|
168
|
+
data: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "WAITING_FOR_PROCESSING";
|
|
169
169
|
driverParam: string;
|
|
170
170
|
notNull: false;
|
|
171
171
|
hasDefault: false;
|
|
@@ -178,7 +178,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
178
178
|
generated: undefined;
|
|
179
179
|
}, {}, {
|
|
180
180
|
length: number | undefined;
|
|
181
|
-
$type: "
|
|
181
|
+
$type: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "WAITING_FOR_PROCESSING";
|
|
182
182
|
}>;
|
|
183
183
|
payments: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
184
184
|
name: "payments";
|
|
@@ -455,7 +455,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
455
455
|
tableName: "payment";
|
|
456
456
|
dataType: "string";
|
|
457
457
|
columnType: "SQLiteText";
|
|
458
|
-
data: "PREPARED" | "
|
|
458
|
+
data: "PREPARED" | "INITIALIZED" | "FAILED" | "PENDING" | "COMPLETED" | "CREATED";
|
|
459
459
|
driverParam: string;
|
|
460
460
|
notNull: true;
|
|
461
461
|
hasDefault: false;
|
|
@@ -468,7 +468,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
468
468
|
generated: undefined;
|
|
469
469
|
}, {}, {
|
|
470
470
|
length: number | undefined;
|
|
471
|
-
$type: "PREPARED" | "
|
|
471
|
+
$type: "PREPARED" | "INITIALIZED" | "FAILED" | "PENDING" | "COMPLETED" | "CREATED";
|
|
472
472
|
}>;
|
|
473
473
|
statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
474
474
|
name: "status_reason";
|
|
@@ -82,10 +82,10 @@ declare const paymentInsertTypeZod: z.ZodObject<{
|
|
|
82
82
|
}>;
|
|
83
83
|
status: z.ZodEnum<{
|
|
84
84
|
PREPARED: "PREPARED";
|
|
85
|
-
COMPLETED: "COMPLETED";
|
|
86
|
-
FAILED: "FAILED";
|
|
87
85
|
INITIALIZED: "INITIALIZED";
|
|
86
|
+
FAILED: "FAILED";
|
|
88
87
|
PENDING: "PENDING";
|
|
88
|
+
COMPLETED: "COMPLETED";
|
|
89
89
|
CREATED: "CREATED";
|
|
90
90
|
}>;
|
|
91
91
|
batchId: z.ZodString;
|
|
@@ -165,7 +165,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
165
165
|
tableName: "batch";
|
|
166
166
|
dataType: "string";
|
|
167
167
|
columnType: "SQLiteText";
|
|
168
|
-
data: "
|
|
168
|
+
data: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "WAITING_FOR_PROCESSING";
|
|
169
169
|
driverParam: string;
|
|
170
170
|
notNull: false;
|
|
171
171
|
hasDefault: false;
|
|
@@ -178,7 +178,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
178
178
|
generated: undefined;
|
|
179
179
|
}, {}, {
|
|
180
180
|
length: number | undefined;
|
|
181
|
-
$type: "
|
|
181
|
+
$type: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "WAITING_FOR_PROCESSING";
|
|
182
182
|
}>;
|
|
183
183
|
payments: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
184
184
|
name: "payments";
|
|
@@ -455,7 +455,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
455
455
|
tableName: "payment";
|
|
456
456
|
dataType: "string";
|
|
457
457
|
columnType: "SQLiteText";
|
|
458
|
-
data: "PREPARED" | "
|
|
458
|
+
data: "PREPARED" | "INITIALIZED" | "FAILED" | "PENDING" | "COMPLETED" | "CREATED";
|
|
459
459
|
driverParam: string;
|
|
460
460
|
notNull: true;
|
|
461
461
|
hasDefault: false;
|
|
@@ -468,7 +468,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
468
468
|
generated: undefined;
|
|
469
469
|
}, {}, {
|
|
470
470
|
length: number | undefined;
|
|
471
|
-
$type: "PREPARED" | "
|
|
471
|
+
$type: "PREPARED" | "INITIALIZED" | "FAILED" | "PENDING" | "COMPLETED" | "CREATED";
|
|
472
472
|
}>;
|
|
473
473
|
statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
474
474
|
name: "status_reason";
|
|
@@ -82,10 +82,10 @@ declare const paymentInsertTypeZod: z.ZodObject<{
|
|
|
82
82
|
}>;
|
|
83
83
|
status: z.ZodEnum<{
|
|
84
84
|
PREPARED: "PREPARED";
|
|
85
|
-
COMPLETED: "COMPLETED";
|
|
86
|
-
FAILED: "FAILED";
|
|
87
85
|
INITIALIZED: "INITIALIZED";
|
|
86
|
+
FAILED: "FAILED";
|
|
88
87
|
PENDING: "PENDING";
|
|
88
|
+
COMPLETED: "COMPLETED";
|
|
89
89
|
CREATED: "CREATED";
|
|
90
90
|
}>;
|
|
91
91
|
batchId: z.ZodString;
|
|
@@ -165,7 +165,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
165
165
|
tableName: "batch";
|
|
166
166
|
dataType: "string";
|
|
167
167
|
columnType: "SQLiteText";
|
|
168
|
-
data: "
|
|
168
|
+
data: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "WAITING_FOR_PROCESSING";
|
|
169
169
|
driverParam: string;
|
|
170
170
|
notNull: false;
|
|
171
171
|
hasDefault: false;
|
|
@@ -178,7 +178,7 @@ declare const batch: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
178
178
|
generated: undefined;
|
|
179
179
|
}, {}, {
|
|
180
180
|
length: number | undefined;
|
|
181
|
-
$type: "
|
|
181
|
+
$type: "PREPARED" | "FAILED" | "COMPLETED" | "OPEN" | "PROCESSING" | "READY_TO_SIGN" | "WAITING_FOR_PROCESSING";
|
|
182
182
|
}>;
|
|
183
183
|
payments: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
184
184
|
name: "payments";
|
|
@@ -455,7 +455,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
455
455
|
tableName: "payment";
|
|
456
456
|
dataType: "string";
|
|
457
457
|
columnType: "SQLiteText";
|
|
458
|
-
data: "PREPARED" | "
|
|
458
|
+
data: "PREPARED" | "INITIALIZED" | "FAILED" | "PENDING" | "COMPLETED" | "CREATED";
|
|
459
459
|
driverParam: string;
|
|
460
460
|
notNull: true;
|
|
461
461
|
hasDefault: false;
|
|
@@ -468,7 +468,7 @@ declare const payment: drizzle_orm_sqlite_core.SQLiteTableWithColumns<{
|
|
|
468
468
|
generated: undefined;
|
|
469
469
|
}, {}, {
|
|
470
470
|
length: number | undefined;
|
|
471
|
-
$type: "PREPARED" | "
|
|
471
|
+
$type: "PREPARED" | "INITIALIZED" | "FAILED" | "PENDING" | "COMPLETED" | "CREATED";
|
|
472
472
|
}>;
|
|
473
473
|
statusReason: drizzle_orm_sqlite_core.SQLiteColumn<{
|
|
474
474
|
name: "status_reason";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Environment } from '@develit-io/backend-sdk';
|
|
2
2
|
import { CURRENCY_CODES, BANK_CODES, CODES } from '@develit-io/general-codes';
|
|
3
|
-
import { a as PaymentInsertType, t as tables } from './bank.
|
|
3
|
+
import { a as PaymentInsertType, t as tables } from './bank.B1d_PE1-.mjs';
|
|
4
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import * as drizzle_zod from 'drizzle-zod';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { uuidv4, useResult, createInternalError, bankAccount, base } from '@develit-io/backend-sdk';
|
|
2
|
+
import { sqliteTable, integer, text, unique, real } from 'drizzle-orm/sqlite-core';
|
|
2
3
|
import { and, eq } from 'drizzle-orm';
|
|
3
4
|
import { COUNTRY_CODES_2, CURRENCY_CODES } from '@develit-io/general-codes';
|
|
4
5
|
import { z } from 'zod';
|
|
5
6
|
import { importPKCS8, SignJWT } from 'jose';
|
|
6
7
|
import { createInsertSchema, createUpdateSchema, createSelectSchema } from 'drizzle-zod';
|
|
7
|
-
import { sqliteTable, integer, text, unique, real } from 'drizzle-orm/sqlite-core';
|
|
8
8
|
import { format, parseISO } from 'date-fns';
|
|
9
9
|
import { relations } from 'drizzle-orm/relations';
|
|
10
10
|
|
|
@@ -1106,7 +1106,7 @@ const batch = sqliteTable("batch", {
|
|
|
1106
1106
|
mode: "timestamp_ms"
|
|
1107
1107
|
}),
|
|
1108
1108
|
authorizationUrls: text("authorization_urls", { mode: "json" }).$type(),
|
|
1109
|
-
accountId: text("account_id"),
|
|
1109
|
+
accountId: text("account_id").references(() => account.id),
|
|
1110
1110
|
status: text("status", { enum: BATCH_STATUSES }).$type(),
|
|
1111
1111
|
payments: text("payments", { mode: "json" }).$type().notNull(),
|
|
1112
1112
|
metadata: text("metadata", { mode: "json" }).$type()
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const backendSdk = require('@develit-io/backend-sdk');
|
|
4
|
+
const sqliteCore = require('drizzle-orm/sqlite-core');
|
|
4
5
|
const drizzleOrm = require('drizzle-orm');
|
|
5
6
|
const generalCodes = require('@develit-io/general-codes');
|
|
6
7
|
const zod = require('zod');
|
|
7
8
|
const jose = require('jose');
|
|
8
9
|
const drizzleZod = require('drizzle-zod');
|
|
9
|
-
const sqliteCore = require('drizzle-orm/sqlite-core');
|
|
10
10
|
const dateFns = require('date-fns');
|
|
11
11
|
const relations = require('drizzle-orm/relations');
|
|
12
12
|
|
|
@@ -1108,7 +1108,7 @@ const batch = sqliteCore.sqliteTable("batch", {
|
|
|
1108
1108
|
mode: "timestamp_ms"
|
|
1109
1109
|
}),
|
|
1110
1110
|
authorizationUrls: sqliteCore.text("authorization_urls", { mode: "json" }).$type(),
|
|
1111
|
-
accountId: sqliteCore.text("account_id"),
|
|
1111
|
+
accountId: sqliteCore.text("account_id").references(() => account.id),
|
|
1112
1112
|
status: sqliteCore.text("status", { enum: BATCH_STATUSES }).$type(),
|
|
1113
1113
|
payments: sqliteCore.text("payments", { mode: "json" }).$type().notNull(),
|
|
1114
1114
|
metadata: sqliteCore.text("metadata", { mode: "json" }).$type()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Environment } from '@develit-io/backend-sdk';
|
|
2
2
|
import { CURRENCY_CODES, BANK_CODES, CODES } from '@develit-io/general-codes';
|
|
3
|
-
import { a as PaymentInsertType, t as tables } from './bank.
|
|
3
|
+
import { a as PaymentInsertType, t as tables } from './bank.B1d_PE1-.js';
|
|
4
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import * as drizzle_zod from 'drizzle-zod';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Environment } from '@develit-io/backend-sdk';
|
|
2
2
|
import { CURRENCY_CODES, BANK_CODES, CODES } from '@develit-io/general-codes';
|
|
3
|
-
import { a as PaymentInsertType, t as tables } from './bank.
|
|
3
|
+
import { a as PaymentInsertType, t as tables } from './bank.B1d_PE1-.cjs';
|
|
4
4
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
5
5
|
import { z } from 'zod';
|
|
6
6
|
import * as drizzle_zod from 'drizzle-zod';
|
package/dist/types.cjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
const database_schema = require('./shared/bank.
|
|
4
|
-
const mockCobs_connector = require('./shared/bank.
|
|
3
|
+
const database_schema = require('./shared/bank.D4BlThGx.cjs');
|
|
4
|
+
const mockCobs_connector = require('./shared/bank.BVW0vOQS.cjs');
|
|
5
5
|
const generalCodes = require('@develit-io/general-codes');
|
|
6
6
|
require('@develit-io/backend-sdk');
|
|
7
|
+
require('drizzle-orm/sqlite-core');
|
|
7
8
|
require('drizzle-orm');
|
|
8
9
|
require('zod');
|
|
9
10
|
require('jose');
|
|
10
11
|
require('drizzle-zod');
|
|
11
|
-
require('drizzle-orm/sqlite-core');
|
|
12
12
|
require('date-fns');
|
|
13
13
|
require('drizzle-orm/relations');
|
|
14
14
|
|
package/dist/types.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IBankConnector, b as IncomingPaymentMessage, c as InitiatedPayment, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, P as PaymentPreparedInsertType, g as InitiatedBatch, B as BatchMetadata, A as AccountSelectType, h as PaymentStatus, i as BatchStatus, j as CurrencyCode, k as BankCode, l as CountryCode, m as AuthInput, n as Currency } from './shared/bank.
|
|
2
|
-
export { w as ACCOUNT_STATUSES, U as AccountCredentialsPatchType, V as AccountCredentialsSelectType, S as AccountCredentialsUpdateType, M as AccountPatchType, x as AccountStatus, L as AccountUpdateType, q as BATCH_STATUES, q as BATCH_STATUSES, z as BankAccountWithLastSync, D as CONNECTOR_KEYS, y as COUNTRY_CODES, E as CREDENTIALS_TYPES, C as ConfigEnvironmentBank, F as CredentialsType, O as OutgoingPaymentMessage, u as PAYMENT_DIRECTIONS, t as PAYMENT_STATUSES, r as PAYMENT_TYPES, v as PaymentDirection, o as PaymentFailedInsertType, s as PaymentType, T as TOKEN_TYPES, G as TokenType, N as accountCredentialsInsertSchema, R as accountCredentialsSelectSchema, Q as accountCredentialsUpdateSchema, H as accountInsertSchema, K as accountSelectSchema, J as accountUpdateSchema, p as paymentInitializedInsertType } from './shared/bank.
|
|
3
|
-
import { a as PaymentInsertType, t as tables, P as PaymentSelectType } from './shared/bank.
|
|
4
|
-
export { b as BatchInsertType, B as BatchSelectType, p as paymentInsertTypeZod } from './shared/bank.
|
|
1
|
+
import { I as IBankConnector, b as IncomingPaymentMessage, c as InitiatedPayment, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, P as PaymentPreparedInsertType, g as InitiatedBatch, B as BatchMetadata, A as AccountSelectType, h as PaymentStatus, i as BatchStatus, j as CurrencyCode, k as BankCode, l as CountryCode, m as AuthInput, n as Currency } from './shared/bank.DkHmB4jn.cjs';
|
|
2
|
+
export { w as ACCOUNT_STATUSES, U as AccountCredentialsPatchType, V as AccountCredentialsSelectType, S as AccountCredentialsUpdateType, M as AccountPatchType, x as AccountStatus, L as AccountUpdateType, q as BATCH_STATUES, q as BATCH_STATUSES, z as BankAccountWithLastSync, D as CONNECTOR_KEYS, y as COUNTRY_CODES, E as CREDENTIALS_TYPES, C as ConfigEnvironmentBank, F as CredentialsType, O as OutgoingPaymentMessage, u as PAYMENT_DIRECTIONS, t as PAYMENT_STATUSES, r as PAYMENT_TYPES, v as PaymentDirection, o as PaymentFailedInsertType, s as PaymentType, T as TOKEN_TYPES, G as TokenType, N as accountCredentialsInsertSchema, R as accountCredentialsSelectSchema, Q as accountCredentialsUpdateSchema, H as accountInsertSchema, K as accountSelectSchema, J as accountUpdateSchema, p as paymentInitializedInsertType } from './shared/bank.DkHmB4jn.cjs';
|
|
3
|
+
import { a as PaymentInsertType, t as tables, P as PaymentSelectType } from './shared/bank.B1d_PE1-.cjs';
|
|
4
|
+
export { b as BatchInsertType, B as BatchSelectType, p as paymentInsertTypeZod } from './shared/bank.B1d_PE1-.cjs';
|
|
5
5
|
import { Environment, BaseEvent } from '@develit-io/backend-sdk';
|
|
6
6
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
7
7
|
export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.BchnXQDL.cjs';
|
package/dist/types.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IBankConnector, b as IncomingPaymentMessage, c as InitiatedPayment, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, P as PaymentPreparedInsertType, g as InitiatedBatch, B as BatchMetadata, A as AccountSelectType, h as PaymentStatus, i as BatchStatus, j as CurrencyCode, k as BankCode, l as CountryCode, m as AuthInput, n as Currency } from './shared/bank
|
|
2
|
-
export { w as ACCOUNT_STATUSES, U as AccountCredentialsPatchType, V as AccountCredentialsSelectType, S as AccountCredentialsUpdateType, M as AccountPatchType, x as AccountStatus, L as AccountUpdateType, q as BATCH_STATUES, q as BATCH_STATUSES, z as BankAccountWithLastSync, D as CONNECTOR_KEYS, y as COUNTRY_CODES, E as CREDENTIALS_TYPES, C as ConfigEnvironmentBank, F as CredentialsType, O as OutgoingPaymentMessage, u as PAYMENT_DIRECTIONS, t as PAYMENT_STATUSES, r as PAYMENT_TYPES, v as PaymentDirection, o as PaymentFailedInsertType, s as PaymentType, T as TOKEN_TYPES, G as TokenType, N as accountCredentialsInsertSchema, R as accountCredentialsSelectSchema, Q as accountCredentialsUpdateSchema, H as accountInsertSchema, K as accountSelectSchema, J as accountUpdateSchema, p as paymentInitializedInsertType } from './shared/bank
|
|
3
|
-
import { a as PaymentInsertType, t as tables, P as PaymentSelectType } from './shared/bank.
|
|
4
|
-
export { b as BatchInsertType, B as BatchSelectType, p as paymentInsertTypeZod } from './shared/bank.
|
|
1
|
+
import { I as IBankConnector, b as IncomingPaymentMessage, c as InitiatedPayment, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, P as PaymentPreparedInsertType, g as InitiatedBatch, B as BatchMetadata, A as AccountSelectType, h as PaymentStatus, i as BatchStatus, j as CurrencyCode, k as BankCode, l as CountryCode, m as AuthInput, n as Currency } from './shared/bank.B31ygxgn.mjs';
|
|
2
|
+
export { w as ACCOUNT_STATUSES, U as AccountCredentialsPatchType, V as AccountCredentialsSelectType, S as AccountCredentialsUpdateType, M as AccountPatchType, x as AccountStatus, L as AccountUpdateType, q as BATCH_STATUES, q as BATCH_STATUSES, z as BankAccountWithLastSync, D as CONNECTOR_KEYS, y as COUNTRY_CODES, E as CREDENTIALS_TYPES, C as ConfigEnvironmentBank, F as CredentialsType, O as OutgoingPaymentMessage, u as PAYMENT_DIRECTIONS, t as PAYMENT_STATUSES, r as PAYMENT_TYPES, v as PaymentDirection, o as PaymentFailedInsertType, s as PaymentType, T as TOKEN_TYPES, G as TokenType, N as accountCredentialsInsertSchema, R as accountCredentialsSelectSchema, Q as accountCredentialsUpdateSchema, H as accountInsertSchema, K as accountSelectSchema, J as accountUpdateSchema, p as paymentInitializedInsertType } from './shared/bank.B31ygxgn.mjs';
|
|
3
|
+
import { a as PaymentInsertType, t as tables, P as PaymentSelectType } from './shared/bank.B1d_PE1-.mjs';
|
|
4
|
+
export { b as BatchInsertType, B as BatchSelectType, p as paymentInsertTypeZod } from './shared/bank.B1d_PE1-.mjs';
|
|
5
5
|
import { Environment, BaseEvent } from '@develit-io/backend-sdk';
|
|
6
6
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
7
7
|
export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.BchnXQDL.mjs';
|
package/dist/types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { I as IBankConnector, b as IncomingPaymentMessage, c as InitiatedPayment, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, P as PaymentPreparedInsertType, g as InitiatedBatch, B as BatchMetadata, A as AccountSelectType, h as PaymentStatus, i as BatchStatus, j as CurrencyCode, k as BankCode, l as CountryCode, m as AuthInput, n as Currency } from './shared/bank.
|
|
2
|
-
export { w as ACCOUNT_STATUSES, U as AccountCredentialsPatchType, V as AccountCredentialsSelectType, S as AccountCredentialsUpdateType, M as AccountPatchType, x as AccountStatus, L as AccountUpdateType, q as BATCH_STATUES, q as BATCH_STATUSES, z as BankAccountWithLastSync, D as CONNECTOR_KEYS, y as COUNTRY_CODES, E as CREDENTIALS_TYPES, C as ConfigEnvironmentBank, F as CredentialsType, O as OutgoingPaymentMessage, u as PAYMENT_DIRECTIONS, t as PAYMENT_STATUSES, r as PAYMENT_TYPES, v as PaymentDirection, o as PaymentFailedInsertType, s as PaymentType, T as TOKEN_TYPES, G as TokenType, N as accountCredentialsInsertSchema, R as accountCredentialsSelectSchema, Q as accountCredentialsUpdateSchema, H as accountInsertSchema, K as accountSelectSchema, J as accountUpdateSchema, p as paymentInitializedInsertType } from './shared/bank.
|
|
3
|
-
import { a as PaymentInsertType, t as tables, P as PaymentSelectType } from './shared/bank.
|
|
4
|
-
export { b as BatchInsertType, B as BatchSelectType, p as paymentInsertTypeZod } from './shared/bank.
|
|
1
|
+
import { I as IBankConnector, b as IncomingPaymentMessage, c as InitiatedPayment, a as ConnectorKey, d as ConnectedAccount, e as AccountCredentialsInsertType, f as AccountInsertType, P as PaymentPreparedInsertType, g as InitiatedBatch, B as BatchMetadata, A as AccountSelectType, h as PaymentStatus, i as BatchStatus, j as CurrencyCode, k as BankCode, l as CountryCode, m as AuthInput, n as Currency } from './shared/bank.DclyB3RM.js';
|
|
2
|
+
export { w as ACCOUNT_STATUSES, U as AccountCredentialsPatchType, V as AccountCredentialsSelectType, S as AccountCredentialsUpdateType, M as AccountPatchType, x as AccountStatus, L as AccountUpdateType, q as BATCH_STATUES, q as BATCH_STATUSES, z as BankAccountWithLastSync, D as CONNECTOR_KEYS, y as COUNTRY_CODES, E as CREDENTIALS_TYPES, C as ConfigEnvironmentBank, F as CredentialsType, O as OutgoingPaymentMessage, u as PAYMENT_DIRECTIONS, t as PAYMENT_STATUSES, r as PAYMENT_TYPES, v as PaymentDirection, o as PaymentFailedInsertType, s as PaymentType, T as TOKEN_TYPES, G as TokenType, N as accountCredentialsInsertSchema, R as accountCredentialsSelectSchema, Q as accountCredentialsUpdateSchema, H as accountInsertSchema, K as accountSelectSchema, J as accountUpdateSchema, p as paymentInitializedInsertType } from './shared/bank.DclyB3RM.js';
|
|
3
|
+
import { a as PaymentInsertType, t as tables, P as PaymentSelectType } from './shared/bank.B1d_PE1-.js';
|
|
4
|
+
export { b as BatchInsertType, B as BatchSelectType, p as paymentInsertTypeZod } from './shared/bank.B1d_PE1-.js';
|
|
5
5
|
import { Environment, BaseEvent } from '@develit-io/backend-sdk';
|
|
6
6
|
import { DrizzleD1Database } from 'drizzle-orm/d1';
|
|
7
7
|
export { b as BankServiceEnv, a as BankServiceEnvironmentConfig, B as BankServiceWranglerConfig } from './shared/bank.BchnXQDL.js';
|
package/dist/types.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, e as CONNECTOR_KEYS, C as COUNTRY_CODES, f as CREDENTIALS_TYPES, E as ErsteConnector, b as FINBRICKS_ENDPOINTS, a as FinbricksClient, F as FinbricksConnector, I as IBankConnector, M as MockConnector, d as PAYMENT_DIRECTIONS, c as PAYMENT_STATUSES, P as PAYMENT_TYPES, T as TOKEN_TYPES, j as accountCredentialsInsertSchema, l as accountCredentialsSelectSchema, k as accountCredentialsUpdateSchema, g as accountInsertSchema, i as accountSelectSchema, h as accountUpdateSchema, o as ottInsertSchema, n as ottSelectSchema, m as ottUpdateSchema, p as paymentInsertTypeZod, s as signFinbricksJws, u as useFinbricksFetch } from './shared/bank.
|
|
2
|
-
export { M as MockCobsConnector } from './shared/bank.
|
|
1
|
+
export { A as ACCOUNT_STATUSES, B as BATCH_STATUES, B as BATCH_STATUSES, e as CONNECTOR_KEYS, C as COUNTRY_CODES, f as CREDENTIALS_TYPES, E as ErsteConnector, b as FINBRICKS_ENDPOINTS, a as FinbricksClient, F as FinbricksConnector, I as IBankConnector, M as MockConnector, d as PAYMENT_DIRECTIONS, c as PAYMENT_STATUSES, P as PAYMENT_TYPES, T as TOKEN_TYPES, j as accountCredentialsInsertSchema, l as accountCredentialsSelectSchema, k as accountCredentialsUpdateSchema, g as accountInsertSchema, i as accountSelectSchema, h as accountUpdateSchema, o as ottInsertSchema, n as ottSelectSchema, m as ottUpdateSchema, p as paymentInsertTypeZod, s as signFinbricksJws, u as useFinbricksFetch } from './shared/bank.ClfukJ-T.mjs';
|
|
2
|
+
export { M as MockCobsConnector } from './shared/bank.De_ddIjl.mjs';
|
|
3
3
|
export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
|
|
4
4
|
import '@develit-io/backend-sdk';
|
|
5
|
+
import 'drizzle-orm/sqlite-core';
|
|
5
6
|
import 'drizzle-orm';
|
|
6
7
|
import 'zod';
|
|
7
8
|
import 'jose';
|
|
8
9
|
import 'drizzle-zod';
|
|
9
|
-
import 'drizzle-orm/sqlite-core';
|
|
10
10
|
import 'date-fns';
|
|
11
11
|
import 'drizzle-orm/relations';
|