@develit-services/ledger 0.4.3 → 0.4.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.
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
- const database_schema = require('../shared/ledger.C2YQGhdM.cjs');
3
+ const database_schema = require('../shared/ledger.Bc5z2uKn.cjs');
4
4
  require('@develit-io/backend-sdk');
5
5
  require('drizzle-orm');
6
6
  require('drizzle-orm/sqlite-core');
7
- require('../shared/ledger.ChjFG1yE.cjs');
7
+ require('../shared/ledger.CU5seGBN.cjs');
8
8
  require('zod');
9
9
  require('@develit-io/general-codes');
10
10
 
@@ -1,7 +1,7 @@
1
- export { a as account, b as accountIdentifier, c as accountIdentifierMapping, d as accountIdentifierMappingRelations, e as accountIdentifierRelations, f as accountRelations, g as entry, t as transaction } from '../shared/ledger.B3xjxvWW.mjs';
1
+ export { a as account, b as accountIdentifier, c as accountIdentifierMapping, d as accountIdentifierMappingRelations, e as accountIdentifierRelations, f as accountRelations, g as entry, t as transaction } from '../shared/ledger.Dyw24XDs.mjs';
2
2
  import '@develit-io/backend-sdk';
3
3
  import 'drizzle-orm';
4
4
  import 'drizzle-orm/sqlite-core';
5
- import '../shared/ledger.DvHIBJap.mjs';
5
+ import '../shared/ledger.ZPgXf5Gd.mjs';
6
6
  import 'zod';
7
7
  import '@develit-io/general-codes';
@@ -5,9 +5,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const backendSdk = require('@develit-io/backend-sdk');
6
6
  const cloudflare_workers = require('cloudflare:workers');
7
7
  const d1 = require('drizzle-orm/d1');
8
- const database_schema = require('../shared/ledger.C2YQGhdM.cjs');
8
+ const database_schema = require('../shared/ledger.Bc5z2uKn.cjs');
9
9
  const drizzleOrm = require('drizzle-orm');
10
- const updateTransactionStatus = require('../shared/ledger.ChjFG1yE.cjs');
10
+ const updateTransactionStatus = require('../shared/ledger.CU5seGBN.cjs');
11
11
  require('@develit-io/general-codes');
12
12
  require('drizzle-orm/sqlite-core');
13
13
  require('zod');
@@ -383,15 +383,12 @@ let LedgerServiceBase = class extends backendSdk.develitWorker(
383
383
  value,
384
384
  currency
385
385
  };
386
- const [data, error] = await backendSdk.useResult(
387
- this.db.insert(tables.transaction).values(transaction).returning().then(backendSdk.first)
388
- );
389
- if (error) {
386
+ const data = await this.db.insert(tables.transaction).values(transaction).returning().then(backendSdk.first);
387
+ if (!data) {
390
388
  throw backendSdk.createInternalError(null, {
391
389
  message: "Failed to create transaction",
392
390
  status: 500,
393
391
  code: "DB-L-01"
394
- // database, ledger, error 01
395
392
  });
396
393
  }
397
394
  const result = {
@@ -1,9 +1,9 @@
1
- import { first, develitWorker, uuidv4, useResult, createInternalError, action, service } from '@develit-io/backend-sdk';
1
+ import { first, develitWorker, uuidv4, createInternalError, action, service } from '@develit-io/backend-sdk';
2
2
  import { WorkerEntrypoint } from 'cloudflare:workers';
3
3
  import { drizzle } from 'drizzle-orm/d1';
4
- import { s as schema } from '../shared/ledger.B3xjxvWW.mjs';
4
+ import { s as schema } from '../shared/ledger.Dyw24XDs.mjs';
5
5
  import { eq, and, inArray, or, count, gte, lte, sql, asc, desc } from 'drizzle-orm';
6
- import { k as createTransactionInputSchema, x as matchTransactionInputSchema, z as resolveUnmatchedTransactionInputSchema, m as failTransactionInputSchema, i as cancelTransactionInputSchema, y as refundTransactionInputSchema, g as REFUNDABLE_TRANSACTION_STATUSES, s as getTransactionByIdInputSchema, t as getTransactionsByReferenceIdInputSchema, u as getTransactionsInputSchema, j as createAccountInputSchema, D as updateAccountInputSchema, l as deleteAccountInputSchema, q as getAccountInputSchema, r as getAccountsByOwnerInputSchema, w as listAccountsInputSchema, p as getAccountIdentifierInputSchema, v as listAccountIdentifiersInputSchema, n as findAccountByIdentifierInputSchema, o as getAccountBalanceInputSchema, F as updateTransactionConfirmationSentAtInputSchema, G as updateTransactionStatusInputSchema } from '../shared/ledger.DvHIBJap.mjs';
6
+ import { k as createTransactionInputSchema, x as matchTransactionInputSchema, z as resolveUnmatchedTransactionInputSchema, m as failTransactionInputSchema, i as cancelTransactionInputSchema, y as refundTransactionInputSchema, g as REFUNDABLE_TRANSACTION_STATUSES, s as getTransactionByIdInputSchema, t as getTransactionsByReferenceIdInputSchema, u as getTransactionsInputSchema, j as createAccountInputSchema, D as updateAccountInputSchema, l as deleteAccountInputSchema, q as getAccountInputSchema, r as getAccountsByOwnerInputSchema, w as listAccountsInputSchema, p as getAccountIdentifierInputSchema, v as listAccountIdentifiersInputSchema, n as findAccountByIdentifierInputSchema, o as getAccountBalanceInputSchema, F as updateTransactionConfirmationSentAtInputSchema, G as updateTransactionStatusInputSchema } from '../shared/ledger.ZPgXf5Gd.mjs';
7
7
  import '@develit-io/general-codes';
8
8
  import 'drizzle-orm/sqlite-core';
9
9
  import 'zod';
@@ -379,15 +379,12 @@ let LedgerServiceBase = class extends develitWorker(
379
379
  value,
380
380
  currency
381
381
  };
382
- const [data, error] = await useResult(
383
- this.db.insert(tables.transaction).values(transaction).returning().then(first)
384
- );
385
- if (error) {
382
+ const data = await this.db.insert(tables.transaction).values(transaction).returning().then(first);
383
+ if (!data) {
386
384
  throw createInternalError(null, {
387
385
  message: "Failed to create transaction",
388
386
  status: 500,
389
387
  code: "DB-L-01"
390
- // database, ledger, error 01
391
388
  });
392
389
  }
393
390
  const result = {
@@ -3,7 +3,7 @@
3
3
  const backendSdk = require('@develit-io/backend-sdk');
4
4
  const drizzleOrm = require('drizzle-orm');
5
5
  const sqliteCore = require('drizzle-orm/sqlite-core');
6
- const updateTransactionStatus = require('./ledger.ChjFG1yE.cjs');
6
+ const updateTransactionStatus = require('./ledger.CU5seGBN.cjs');
7
7
  require('@develit-io/general-codes');
8
8
 
9
9
  const account = sqliteCore.sqliteTable("account", {
@@ -309,7 +309,7 @@ const matchTransactionInputSchema = zod.z.object({
309
309
  amount: zod.z.number().positive().optional(),
310
310
  completedAt: zod.z.date().optional()
311
311
  }).refine((data) => data.paymentId || data.paymentRequestId, {
312
- message: "Either paymentId or paymentRequestId is required"
312
+ message: "Either paymentId or paymentRequestId must be provided"
313
313
  });
314
314
 
315
315
  const updateAccountInputSchema = zod.z.object({
@@ -1,7 +1,7 @@
1
1
  import { base } from '@develit-io/backend-sdk';
2
2
  import { relations } from 'drizzle-orm';
3
3
  import { sqliteTable, integer, text, real } from 'drizzle-orm/sqlite-core';
4
- import { T as TRANSACTION_STATUSES, h as TRANSACTION_TYPES, R as REFERENCE_TYPES } from './ledger.DvHIBJap.mjs';
4
+ import { T as TRANSACTION_STATUSES, h as TRANSACTION_TYPES, R as REFERENCE_TYPES } from './ledger.ZPgXf5Gd.mjs';
5
5
  import '@develit-io/general-codes';
6
6
 
7
7
  const account = sqliteTable("account", {
@@ -307,7 +307,7 @@ const matchTransactionInputSchema = z.object({
307
307
  amount: z.number().positive().optional(),
308
308
  completedAt: z.date().optional()
309
309
  }).refine((data) => data.paymentId || data.paymentRequestId, {
310
- message: "Either paymentId or paymentRequestId is required"
310
+ message: "Either paymentId or paymentRequestId must be provided"
311
311
  });
312
312
 
313
313
  const updateAccountInputSchema = z.object({
package/dist/types.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- const updateTransactionStatus = require('./shared/ledger.ChjFG1yE.cjs');
3
+ const updateTransactionStatus = require('./shared/ledger.CU5seGBN.cjs');
4
4
  const generalCodes = require('@develit-io/general-codes');
5
5
  require('zod');
6
6
  require('@develit-io/backend-sdk');
package/dist/types.mjs CHANGED
@@ -1,4 +1,4 @@
1
- export { A as ACCOUNT_TYPES, a as ALLOWED_TRANSACTION_FILTERS, b as ASSET_TYPES, B as BALANCE_STRATEGIES, c as BATCH_STATUSES, C as CHARGE_BEARERS, d as COUNTRY_CODES, E as ENTRY_STATUSES, I as IDENTIFIER_KINDS, P as PAYMENT_DIRECTIONS, e as PAYMENT_STATUSES, f as PAYMENT_TYPES, R as REFERENCE_TYPES, g as REFUNDABLE_TRANSACTION_STATUSES, T as TRANSACTION_STATUSES, h as TRANSACTION_TYPES, i as cancelTransactionInputSchema, j as createAccountInputSchema, k as createTransactionInputSchema, l as deleteAccountInputSchema, m as failTransactionInputSchema, n as findAccountByIdentifierInputSchema, o as getAccountBalanceInputSchema, p as getAccountIdentifierInputSchema, q as getAccountInputSchema, r as getAccountsByOwnerInputSchema, s as getTransactionByIdInputSchema, t as getTransactionsByReferenceIdInputSchema, u as getTransactionsInputSchema, v as listAccountIdentifiersInputSchema, w as listAccountsInputSchema, x as matchTransactionInputSchema, y as refundTransactionInputSchema, z as resolveUnmatchedTransactionInputSchema, D as updateAccountInputSchema, F as updateTransactionConfirmationSentAtInputSchema, G as updateTransactionStatusInputSchema } from './shared/ledger.DvHIBJap.mjs';
1
+ export { A as ACCOUNT_TYPES, a as ALLOWED_TRANSACTION_FILTERS, b as ASSET_TYPES, B as BALANCE_STRATEGIES, c as BATCH_STATUSES, C as CHARGE_BEARERS, d as COUNTRY_CODES, E as ENTRY_STATUSES, I as IDENTIFIER_KINDS, P as PAYMENT_DIRECTIONS, e as PAYMENT_STATUSES, f as PAYMENT_TYPES, R as REFERENCE_TYPES, g as REFUNDABLE_TRANSACTION_STATUSES, T as TRANSACTION_STATUSES, h as TRANSACTION_TYPES, i as cancelTransactionInputSchema, j as createAccountInputSchema, k as createTransactionInputSchema, l as deleteAccountInputSchema, m as failTransactionInputSchema, n as findAccountByIdentifierInputSchema, o as getAccountBalanceInputSchema, p as getAccountIdentifierInputSchema, q as getAccountInputSchema, r as getAccountsByOwnerInputSchema, s as getTransactionByIdInputSchema, t as getTransactionsByReferenceIdInputSchema, u as getTransactionsInputSchema, v as listAccountIdentifiersInputSchema, w as listAccountsInputSchema, x as matchTransactionInputSchema, y as refundTransactionInputSchema, z as resolveUnmatchedTransactionInputSchema, D as updateAccountInputSchema, F as updateTransactionConfirmationSentAtInputSchema, G as updateTransactionStatusInputSchema } from './shared/ledger.ZPgXf5Gd.mjs';
2
2
  export { BANK_CODES, CURRENCY_CODES } from '@develit-io/general-codes';
3
3
  import 'zod';
4
4
  import '@develit-io/backend-sdk';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@develit-services/ledger",
3
- "version": "0.4.3",
3
+ "version": "0.4.4",
4
4
  "author": "Develit.io s.r.o.",
5
5
  "type": "module",
6
6
  "exports": {