@robosystems/client 0.3.20 → 0.3.22

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.
@@ -143,6 +143,13 @@ export interface CreateJournalEntryOptions {
143
143
  type?: LedgerEntryType;
144
144
  status?: 'draft' | 'posted';
145
145
  transactionId?: string | null;
146
+ /**
147
+ * Who fired the event. Defaults to `'manual'` (user-initiated journal
148
+ * entry). Sync adapters (QuickBooks, Plaid, etc.) override with their
149
+ * adapter name. Must match the server's CHECK constraint set:
150
+ * `manual | schedule | system | quickbooks | xero | plaid`.
151
+ */
152
+ source?: string;
146
153
  idempotencyKey?: string | null;
147
154
  }
148
155
  interface LedgerClientConfig {
@@ -337,6 +344,8 @@ export declare class LedgerClient {
337
344
  *
338
345
  * Routes through `create-event-block` with `event_type='asset_disposed'`.
339
346
  * `occurred_at` is required and represents the disposal date.
347
+ * `source` defaults to `'manual'` (user-initiated disposal); sync
348
+ * adapters override.
340
349
  */
341
350
  disposeSchedule(graphId: string, options: {
342
351
  scheduleId: string;
@@ -346,6 +355,7 @@ export declare class LedgerClient {
346
355
  gainLossElementId?: string | null;
347
356
  memo?: string | null;
348
357
  reason?: string;
358
+ source?: string;
349
359
  }): Promise<EventBlockEnvelope>;
350
360
  /** Evaluate taxonomy rules against facts in a structure. */
351
361
  evaluateRules(graphId: string, body: EvaluateRulesRequest): Promise<EvaluateRulesResponse>;
@@ -400,12 +410,14 @@ export declare class LedgerClient {
400
410
  * the original as reversed.
401
411
  *
402
412
  * Routes through `create-event-block` with
403
- * `event_type='journal_entry_reversed'`.
413
+ * `event_type='journal_entry_reversed'`. `source` defaults to `'manual'`
414
+ * — sync adapters override.
404
415
  */
405
416
  reverseJournalEntry(graphId: string, entryId: string, options?: {
406
417
  postingDate?: string | null;
407
418
  memo?: string | null;
408
419
  reason?: string | null;
420
+ source?: string;
409
421
  }): Promise<EventBlockEnvelope>;
410
422
  /**
411
423
  * Dry-run an event block — resolve the handler, evaluate metadata, and
@@ -315,12 +315,14 @@ class LedgerClient {
315
315
  *
316
316
  * Routes through `create-event-block` with `event_type='asset_disposed'`.
317
317
  * `occurred_at` is required and represents the disposal date.
318
+ * `source` defaults to `'manual'` (user-initiated disposal); sync
319
+ * adapters override.
318
320
  */
319
321
  async disposeSchedule(graphId, options) {
320
322
  const body = {
321
323
  event_type: 'asset_disposed',
322
324
  event_category: 'adjustment',
323
- source: 'native',
325
+ source: options.source ?? 'manual',
324
326
  occurred_at: options.occurredAt,
325
327
  apply_handlers: true,
326
328
  metadata: {
@@ -362,7 +364,8 @@ class LedgerClient {
362
364
  const body = {
363
365
  event_type: 'schedule_entry_due',
364
366
  event_category: 'recognition',
365
- source: 'scheduled',
367
+ // Always 'schedule' — this op is schedule-driven by definition.
368
+ source: 'schedule',
366
369
  occurred_at: `${postingDate}T00:00:00Z`,
367
370
  apply_handlers: true,
368
371
  metadata: {
@@ -455,7 +458,7 @@ class LedgerClient {
455
458
  const body = {
456
459
  event_type: 'journal_entry_recorded',
457
460
  event_category: 'adjustment',
458
- source: 'native',
461
+ source: options.source ?? 'manual',
459
462
  occurred_at: `${options.postingDate}T00:00:00Z`,
460
463
  apply_handlers: true,
461
464
  metadata: {
@@ -494,14 +497,15 @@ class LedgerClient {
494
497
  * the original as reversed.
495
498
  *
496
499
  * Routes through `create-event-block` with
497
- * `event_type='journal_entry_reversed'`.
500
+ * `event_type='journal_entry_reversed'`. `source` defaults to `'manual'`
501
+ * — sync adapters override.
498
502
  */
499
503
  async reverseJournalEntry(graphId, entryId, options) {
500
504
  const occurredDate = options?.postingDate ?? new Date().toISOString().slice(0, 10);
501
505
  const body = {
502
506
  event_type: 'journal_entry_reversed',
503
507
  event_category: 'adjustment',
504
- source: 'native',
508
+ source: options?.source ?? 'manual',
505
509
  occurred_at: `${occurredDate}T00:00:00Z`,
506
510
  apply_handlers: true,
507
511
  metadata: {
@@ -430,6 +430,13 @@ export interface CreateJournalEntryOptions {
430
430
  type?: LedgerEntryType
431
431
  status?: 'draft' | 'posted'
432
432
  transactionId?: string | null
433
+ /**
434
+ * Who fired the event. Defaults to `'manual'` (user-initiated journal
435
+ * entry). Sync adapters (QuickBooks, Plaid, etc.) override with their
436
+ * adapter name. Must match the server's CHECK constraint set:
437
+ * `manual | schedule | system | quickbooks | xero | plaid`.
438
+ */
439
+ source?: string
433
440
  idempotencyKey?: string | null
434
441
  }
435
442
 
@@ -1100,6 +1107,8 @@ export class LedgerClient {
1100
1107
  *
1101
1108
  * Routes through `create-event-block` with `event_type='asset_disposed'`.
1102
1109
  * `occurred_at` is required and represents the disposal date.
1110
+ * `source` defaults to `'manual'` (user-initiated disposal); sync
1111
+ * adapters override.
1103
1112
  */
1104
1113
  async disposeSchedule(
1105
1114
  graphId: string,
@@ -1111,12 +1120,13 @@ export class LedgerClient {
1111
1120
  gainLossElementId?: string | null
1112
1121
  memo?: string | null
1113
1122
  reason?: string
1123
+ source?: string
1114
1124
  }
1115
1125
  ): Promise<EventBlockEnvelope> {
1116
1126
  const body: CreateEventBlockRequest = {
1117
1127
  event_type: 'asset_disposed',
1118
1128
  event_category: 'adjustment',
1119
- source: 'native',
1129
+ source: options.source ?? 'manual',
1120
1130
  occurred_at: options.occurredAt,
1121
1131
  apply_handlers: true,
1122
1132
  metadata: {
@@ -1192,7 +1202,8 @@ export class LedgerClient {
1192
1202
  const body: CreateEventBlockRequest = {
1193
1203
  event_type: 'schedule_entry_due',
1194
1204
  event_category: 'recognition',
1195
- source: 'scheduled',
1205
+ // Always 'schedule' — this op is schedule-driven by definition.
1206
+ source: 'schedule',
1196
1207
  occurred_at: `${postingDate}T00:00:00Z`,
1197
1208
  apply_handlers: true,
1198
1209
  metadata: {
@@ -1341,7 +1352,7 @@ export class LedgerClient {
1341
1352
  const body: CreateEventBlockRequest = {
1342
1353
  event_type: 'journal_entry_recorded',
1343
1354
  event_category: 'adjustment',
1344
- source: 'native',
1355
+ source: options.source ?? 'manual',
1345
1356
  occurred_at: `${options.postingDate}T00:00:00Z`,
1346
1357
  apply_handlers: true,
1347
1358
  metadata: {
@@ -1395,7 +1406,8 @@ export class LedgerClient {
1395
1406
  * the original as reversed.
1396
1407
  *
1397
1408
  * Routes through `create-event-block` with
1398
- * `event_type='journal_entry_reversed'`.
1409
+ * `event_type='journal_entry_reversed'`. `source` defaults to `'manual'`
1410
+ * — sync adapters override.
1399
1411
  */
1400
1412
  async reverseJournalEntry(
1401
1413
  graphId: string,
@@ -1404,13 +1416,14 @@ export class LedgerClient {
1404
1416
  postingDate?: string | null
1405
1417
  memo?: string | null
1406
1418
  reason?: string | null
1419
+ source?: string
1407
1420
  }
1408
1421
  ): Promise<EventBlockEnvelope> {
1409
1422
  const occurredDate = options?.postingDate ?? new Date().toISOString().slice(0, 10)
1410
1423
  const body: CreateEventBlockRequest = {
1411
1424
  event_type: 'journal_entry_reversed',
1412
1425
  event_category: 'adjustment',
1413
- source: 'native',
1426
+ source: options?.source ?? 'manual',
1414
1427
  occurred_at: `${occurredDate}T00:00:00Z`,
1415
1428
  apply_handlers: true,
1416
1429
  metadata: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robosystems/client",
3
- "version": "0.3.20",
3
+ "version": "0.3.22",
4
4
  "description": "TypeScript client library for RoboSystems Financial Knowledge Graph API",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",