@endora-commerce/mod-invoice-ledger 0.100.0

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.
Files changed (123) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +57 -0
  3. package/dist/admin/api/ledger-client.d.ts +15 -0
  4. package/dist/admin/api/ledger-client.d.ts.map +1 -0
  5. package/dist/admin/api/ledger-client.js +35 -0
  6. package/dist/admin/api/ledger-client.js.map +1 -0
  7. package/dist/admin/index.d.ts +11 -0
  8. package/dist/admin/index.d.ts.map +1 -0
  9. package/dist/admin/index.js +52 -0
  10. package/dist/admin/index.js.map +1 -0
  11. package/dist/admin/pages/LedgerDeliveriesPage.d.ts +4 -0
  12. package/dist/admin/pages/LedgerDeliveriesPage.d.ts.map +1 -0
  13. package/dist/admin/pages/LedgerDeliveriesPage.js +101 -0
  14. package/dist/admin/pages/LedgerDeliveriesPage.js.map +1 -0
  15. package/dist/admin/pages/LedgerRoutingPage.d.ts +4 -0
  16. package/dist/admin/pages/LedgerRoutingPage.d.ts.map +1 -0
  17. package/dist/admin/pages/LedgerRoutingPage.js +67 -0
  18. package/dist/admin/pages/LedgerRoutingPage.js.map +1 -0
  19. package/dist/admin/pages/merge-delivery-pages.d.ts +3 -0
  20. package/dist/admin/pages/merge-delivery-pages.d.ts.map +1 -0
  21. package/dist/admin/pages/merge-delivery-pages.js +5 -0
  22. package/dist/admin/pages/merge-delivery-pages.js.map +1 -0
  23. package/dist/admin/zones/InvoiceLedgerRemoteIdPanel.d.ts +11 -0
  24. package/dist/admin/zones/InvoiceLedgerRemoteIdPanel.d.ts.map +1 -0
  25. package/dist/admin/zones/InvoiceLedgerRemoteIdPanel.js +36 -0
  26. package/dist/admin/zones/InvoiceLedgerRemoteIdPanel.js.map +1 -0
  27. package/dist/admin/zones/LedgerDeliveriesTab.d.ts +10 -0
  28. package/dist/admin/zones/LedgerDeliveriesTab.d.ts.map +1 -0
  29. package/dist/admin/zones/LedgerDeliveriesTab.js +15 -0
  30. package/dist/admin/zones/LedgerDeliveriesTab.js.map +1 -0
  31. package/dist/admin/zones/LedgerRoutingTab.d.ts +11 -0
  32. package/dist/admin/zones/LedgerRoutingTab.d.ts.map +1 -0
  33. package/dist/admin/zones/LedgerRoutingTab.js +16 -0
  34. package/dist/admin/zones/LedgerRoutingTab.js.map +1 -0
  35. package/dist/backend/commands/retry-delivery.command.d.ts +8 -0
  36. package/dist/backend/commands/retry-delivery.command.d.ts.map +1 -0
  37. package/dist/backend/commands/retry-delivery.command.js +26 -0
  38. package/dist/backend/commands/retry-delivery.command.js.map +1 -0
  39. package/dist/backend/commands/routing.commands.d.ts +7 -0
  40. package/dist/backend/commands/routing.commands.d.ts.map +1 -0
  41. package/dist/backend/commands/routing.commands.js +13 -0
  42. package/dist/backend/commands/routing.commands.js.map +1 -0
  43. package/dist/backend/entities/invoice-ledger-activation-lock.entity.d.ts +15 -0
  44. package/dist/backend/entities/invoice-ledger-activation-lock.entity.d.ts.map +1 -0
  45. package/dist/backend/entities/invoice-ledger-activation-lock.entity.js +46 -0
  46. package/dist/backend/entities/invoice-ledger-activation-lock.entity.js.map +1 -0
  47. package/dist/backend/entities/invoice-ledger-client-map.entity.d.ts +18 -0
  48. package/dist/backend/entities/invoice-ledger-client-map.entity.d.ts.map +1 -0
  49. package/dist/backend/entities/invoice-ledger-client-map.entity.js +72 -0
  50. package/dist/backend/entities/invoice-ledger-client-map.entity.js.map +1 -0
  51. package/dist/backend/entities/invoice-ledger-delivery.entity.d.ts +65 -0
  52. package/dist/backend/entities/invoice-ledger-delivery.entity.d.ts.map +1 -0
  53. package/dist/backend/entities/invoice-ledger-delivery.entity.js +168 -0
  54. package/dist/backend/entities/invoice-ledger-delivery.entity.js.map +1 -0
  55. package/dist/backend/entities/invoice-ledger-document-map.entity.d.ts +25 -0
  56. package/dist/backend/entities/invoice-ledger-document-map.entity.d.ts.map +1 -0
  57. package/dist/backend/entities/invoice-ledger-document-map.entity.js +80 -0
  58. package/dist/backend/entities/invoice-ledger-document-map.entity.js.map +1 -0
  59. package/dist/backend/entities/invoice-ledger-webhook-receipt.entity.d.ts +18 -0
  60. package/dist/backend/entities/invoice-ledger-webhook-receipt.entity.d.ts.map +1 -0
  61. package/dist/backend/entities/invoice-ledger-webhook-receipt.entity.js +71 -0
  62. package/dist/backend/entities/invoice-ledger-webhook-receipt.entity.js.map +1 -0
  63. package/dist/backend/index.d.ts +12 -0
  64. package/dist/backend/index.d.ts.map +1 -0
  65. package/dist/backend/index.js +230 -0
  66. package/dist/backend/index.js.map +1 -0
  67. package/dist/backend/routes.admin.d.ts +11 -0
  68. package/dist/backend/routes.admin.d.ts.map +1 -0
  69. package/dist/backend/routes.admin.js +36 -0
  70. package/dist/backend/routes.admin.js.map +1 -0
  71. package/dist/backend/services/invoice-ledger-delivery-admin.service.d.ts +33 -0
  72. package/dist/backend/services/invoice-ledger-delivery-admin.service.d.ts.map +1 -0
  73. package/dist/backend/services/invoice-ledger-delivery-admin.service.js +104 -0
  74. package/dist/backend/services/invoice-ledger-delivery-admin.service.js.map +1 -0
  75. package/dist/backend/services/invoice-ledger-delivery.service.d.ts +55 -0
  76. package/dist/backend/services/invoice-ledger-delivery.service.d.ts.map +1 -0
  77. package/dist/backend/services/invoice-ledger-delivery.service.js +322 -0
  78. package/dist/backend/services/invoice-ledger-delivery.service.js.map +1 -0
  79. package/dist/backend/services/invoice-ledger-registry.service.d.ts +64 -0
  80. package/dist/backend/services/invoice-ledger-registry.service.d.ts.map +1 -0
  81. package/dist/backend/services/invoice-ledger-registry.service.js +119 -0
  82. package/dist/backend/services/invoice-ledger-registry.service.js.map +1 -0
  83. package/dist/backend/services/invoice-ledger-routing-write.service.d.ts +15 -0
  84. package/dist/backend/services/invoice-ledger-routing-write.service.d.ts.map +1 -0
  85. package/dist/backend/services/invoice-ledger-routing-write.service.js +85 -0
  86. package/dist/backend/services/invoice-ledger-routing-write.service.js.map +1 -0
  87. package/dist/backend/services/invoice-ledger-routing.service.d.ts +11 -0
  88. package/dist/backend/services/invoice-ledger-routing.service.d.ts.map +1 -0
  89. package/dist/backend/services/invoice-ledger-routing.service.js +20 -0
  90. package/dist/backend/services/invoice-ledger-routing.service.js.map +1 -0
  91. package/dist/backend/services/invoice-ledger-vendor-freeze-registry.d.ts +9 -0
  92. package/dist/backend/services/invoice-ledger-vendor-freeze-registry.d.ts.map +1 -0
  93. package/dist/backend/services/invoice-ledger-vendor-freeze-registry.js +13 -0
  94. package/dist/backend/services/invoice-ledger-vendor-freeze-registry.js.map +1 -0
  95. package/dist/backend/services/invoice-ledger-webhook.service.d.ts +30 -0
  96. package/dist/backend/services/invoice-ledger-webhook.service.d.ts.map +1 -0
  97. package/dist/backend/services/invoice-ledger-webhook.service.js +170 -0
  98. package/dist/backend/services/invoice-ledger-webhook.service.js.map +1 -0
  99. package/dist/backend/services/mapped-delivery-error.d.ts +25 -0
  100. package/dist/backend/services/mapped-delivery-error.d.ts.map +1 -0
  101. package/dist/backend/services/mapped-delivery-error.js +54 -0
  102. package/dist/backend/services/mapped-delivery-error.js.map +1 -0
  103. package/dist/manifest.d.ts +183 -0
  104. package/dist/manifest.d.ts.map +1 -0
  105. package/dist/manifest.js +112 -0
  106. package/dist/manifest.js.map +1 -0
  107. package/dist/migrations/20260908T125013_invoice_ledger_init.d.ts +12 -0
  108. package/dist/migrations/20260908T125013_invoice_ledger_init.d.ts.map +1 -0
  109. package/dist/migrations/20260908T125013_invoice_ledger_init.js +167 -0
  110. package/dist/migrations/20260908T125013_invoice_ledger_init.js.map +1 -0
  111. package/dist/migrations/20260914T140000_invoice_ledger_row_organization.d.ts +64 -0
  112. package/dist/migrations/20260914T140000_invoice_ledger_row_organization.d.ts.map +1 -0
  113. package/dist/migrations/20260914T140000_invoice_ledger_row_organization.js +126 -0
  114. package/dist/migrations/20260914T140000_invoice_ledger_row_organization.js.map +1 -0
  115. package/dist/migrations/index.d.ts +13 -0
  116. package/dist/migrations/index.d.ts.map +1 -0
  117. package/dist/migrations/index.js +16 -0
  118. package/dist/migrations/index.js.map +1 -0
  119. package/docs/invoice-ledger.md +22 -0
  120. package/i18n/en.json +50 -0
  121. package/i18n/pl.json +50 -0
  122. package/package.json +89 -0
  123. package/tailwind.css +14 -0
@@ -0,0 +1,26 @@
1
+ export function makeRetryInvoiceLedgerDeliveryCommand(input) {
2
+ return {
3
+ action: 'invoice_ledger.delivery.retry',
4
+ objectType: 'invoice_ledger_delivery',
5
+ objectId: input.deliveryId,
6
+ capture: async () => ({
7
+ status: input.before.status,
8
+ credentialCode: input.before.credentialCode,
9
+ environment: input.before.environment,
10
+ ksefRouting: input.before.ksefRouting,
11
+ }),
12
+ run: async () => {
13
+ const result = await input.retry();
14
+ return {
15
+ result,
16
+ after: {
17
+ status: result.status,
18
+ credentialCode: result.credentialCode,
19
+ environment: result.environment,
20
+ ksefRouting: result.ksefRouting,
21
+ },
22
+ };
23
+ },
24
+ };
25
+ }
26
+ //# sourceMappingURL=retry-delivery.command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry-delivery.command.js","sourceRoot":"","sources":["../../../src/backend/commands/retry-delivery.command.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,qCAAqC,CAAC,KAIrD;IACC,OAAO;QACL,MAAM,EAAE,+BAA+B;QACvC,UAAU,EAAE,yBAAyB;QACrC,QAAQ,EAAE,KAAK,CAAC,UAAU;QAC1B,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;YACpB,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM;YAC3B,cAAc,EAAE,KAAK,CAAC,MAAM,CAAC,cAAc;YAC3C,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW;YACrC,WAAW,EAAE,KAAK,CAAC,MAAM,CAAC,WAAW;SACtC,CAAC;QACF,GAAG,EAAE,KAAK,IAAI,EAAE;YACd,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;YACnC,OAAO;gBACL,MAAM;gBACN,KAAK,EAAE;oBACL,MAAM,EAAE,MAAM,CAAC,MAAM;oBACrB,cAAc,EAAE,MAAM,CAAC,cAAc;oBACrC,WAAW,EAAE,MAAM,CAAC,WAAW;oBAC/B,WAAW,EAAE,MAAM,CAAC,WAAW;iBAChC;aACF,CAAC;QACJ,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,7 @@
1
+ import type { InvoiceLedgerRoutingDto } from '@endora-commerce/contracts';
2
+ import type { Command } from '@endora-commerce/platform/commands';
3
+ export declare function makeWriteInvoiceLedgerRoutingCommand(input: {
4
+ before: InvoiceLedgerRoutingDto;
5
+ write: () => Promise<InvoiceLedgerRoutingDto>;
6
+ }): Command<InvoiceLedgerRoutingDto>;
7
+ //# sourceMappingURL=routing.commands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing.commands.d.ts","sourceRoot":"","sources":["../../../src/backend/commands/routing.commands.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,4BAA4B,CAAC;AAC1E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAElE,wBAAgB,oCAAoC,CAAC,KAAK,EAAE;IAC1D,MAAM,EAAE,uBAAuB,CAAC;IAChC,KAAK,EAAE,MAAM,OAAO,CAAC,uBAAuB,CAAC,CAAC;CAC/C,GAAG,OAAO,CAAC,uBAAuB,CAAC,CAWnC"}
@@ -0,0 +1,13 @@
1
+ export function makeWriteInvoiceLedgerRoutingCommand(input) {
2
+ return {
3
+ action: 'invoice_ledger.routing.write',
4
+ objectType: 'invoice_ledger_routing',
5
+ objectId: 'invoice_ledger',
6
+ capture: async () => ({ ...input.before }),
7
+ run: async () => {
8
+ const result = await input.write();
9
+ return { result, after: { ...result } };
10
+ },
11
+ };
12
+ }
13
+ //# sourceMappingURL=routing.commands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"routing.commands.js","sourceRoot":"","sources":["../../../src/backend/commands/routing.commands.ts"],"names":[],"mappings":"AAGA,MAAM,UAAU,oCAAoC,CAAC,KAGpD;IACC,OAAO;QACL,MAAM,EAAE,8BAA8B;QACtC,UAAU,EAAE,wBAAwB;QACpC,QAAQ,EAAE,gBAAgB;QAC1B,OAAO,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC,EAAE,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC;QAC1C,GAAG,EAAE,KAAK,IAAI,EAAE;YACd,MAAM,MAAM,GAAG,MAAM,KAAK,CAAC,KAAK,EAAE,CAAC;YACnC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,GAAG,MAAM,EAAE,EAAE,CAAC;QAC1C,CAAC;KACF,CAAC;AACJ,CAAC"}
@@ -0,0 +1,15 @@
1
+ import { OptionalProps } from '@mikro-orm/core';
2
+ /** Fixed primary key — one diagnostic row per deployment (feature 119, data-model.md). */
3
+ export declare const INVOICE_LEDGER_ACTIVATION_LOCK_SINGLETON_ID = "00000000-0000-4000-8000-000000000001";
4
+ /**
5
+ * Mirrors the last successful invoice-ledger vendor activation for diagnostics.
6
+ * Authoritative mutual-exclusion checks read sibling activation Settings.
7
+ */
8
+ export declare class InvoiceLedgerActivationLock {
9
+ [OptionalProps]?: 'updatedAt';
10
+ id: string;
11
+ activeModuleId?: string | null;
12
+ updatedAt: Date;
13
+ updatedByAdminId?: string | null;
14
+ }
15
+ //# sourceMappingURL=invoice-ledger-activation-lock.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-ledger-activation-lock.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/invoice-ledger-activation-lock.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,aAAa,EAAwB,MAAM,iBAAiB,CAAC;AAG9E,0FAA0F;AAC1F,eAAO,MAAM,2CAA2C,yCAAyC,CAAC;AAElG;;;GAGG;AACH,qBAEa,2BAA2B;IACtC,CAAC,aAAa,CAAC,CAAC,EAAE,WAAW,CAAC;IAG9B,EAAE,EAAE,MAAM,CAA+C;IAGzD,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG/B,SAAS,EAAE,IAAI,CAAc;IAG7B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAClC"}
@@ -0,0 +1,46 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Entity, OptionalProps, PrimaryKey, Property } from '@mikro-orm/core';
11
+ import { GlobalEntity } from '@endora-commerce/platform/tenancy';
12
+ /** Fixed primary key — one diagnostic row per deployment (feature 119, data-model.md). */
13
+ export const INVOICE_LEDGER_ACTIVATION_LOCK_SINGLETON_ID = '00000000-0000-4000-8000-000000000001';
14
+ /**
15
+ * Mirrors the last successful invoice-ledger vendor activation for diagnostics.
16
+ * Authoritative mutual-exclusion checks read sibling activation Settings.
17
+ */
18
+ let InvoiceLedgerActivationLock = class InvoiceLedgerActivationLock {
19
+ [OptionalProps];
20
+ id = INVOICE_LEDGER_ACTIVATION_LOCK_SINGLETON_ID;
21
+ activeModuleId;
22
+ updatedAt = new Date();
23
+ updatedByAdminId;
24
+ };
25
+ __decorate([
26
+ PrimaryKey({ type: 'uuid' }),
27
+ __metadata("design:type", String)
28
+ ], InvoiceLedgerActivationLock.prototype, "id", void 0);
29
+ __decorate([
30
+ Property({ type: 'varchar', length: 64, fieldName: 'active_module_id', nullable: true }),
31
+ __metadata("design:type", Object)
32
+ ], InvoiceLedgerActivationLock.prototype, "activeModuleId", void 0);
33
+ __decorate([
34
+ Property({ type: 'timestamptz', fieldName: 'updated_at' }),
35
+ __metadata("design:type", Date)
36
+ ], InvoiceLedgerActivationLock.prototype, "updatedAt", void 0);
37
+ __decorate([
38
+ Property({ type: 'uuid', fieldName: 'updated_by_admin_id', nullable: true }),
39
+ __metadata("design:type", Object)
40
+ ], InvoiceLedgerActivationLock.prototype, "updatedByAdminId", void 0);
41
+ InvoiceLedgerActivationLock = __decorate([
42
+ GlobalEntity(),
43
+ Entity({ tableName: 'invoice_ledger_activation_lock' })
44
+ ], InvoiceLedgerActivationLock);
45
+ export { InvoiceLedgerActivationLock };
46
+ //# sourceMappingURL=invoice-ledger-activation-lock.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-ledger-activation-lock.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/invoice-ledger-activation-lock.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,MAAM,mCAAmC,CAAC;AAEjE,0FAA0F;AAC1F,MAAM,CAAC,MAAM,2CAA2C,GAAG,sCAAsC,CAAC;AAElG;;;GAGG;AAGI,IAAM,2BAA2B,GAAjC,MAAM,2BAA2B;IACtC,CAAC,aAAa,CAAC,CAAe;IAG9B,EAAE,GAAW,2CAA2C,CAAC;IAGzD,cAAc,CAAiB;IAG/B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAG7B,gBAAgB,CAAiB;CAClC,CAAA;AAVC;IADC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;uDAC4B;AAGzD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,kBAAkB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mEAC1D;AAG/B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;8BAChD,IAAI;8DAAc;AAG7B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qEAC5C;AAbtB,2BAA2B;IAFvC,YAAY,EAAE;IACd,MAAM,CAAC,EAAE,SAAS,EAAE,gCAAgC,EAAE,CAAC;GAC3C,2BAA2B,CAcvC"}
@@ -0,0 +1,18 @@
1
+ import { OptionalProps } from '@mikro-orm/core';
2
+ /**
3
+ * Organization → remote client, keyed per Infakt company (credential_code).
4
+ * Unique `(adapter_id, organization_id, environment, credential_code)`.
5
+ */
6
+ export declare class InvoiceLedgerClientMap {
7
+ [OptionalProps]?: 'id' | 'salesChannelId' | 'updatedAt';
8
+ id: string;
9
+ adapterId: string;
10
+ organizationId: string;
11
+ nipUsed: string;
12
+ remoteClientId: string;
13
+ salesChannelId?: string | null;
14
+ credentialCode: string;
15
+ environment: 'sandbox' | 'production';
16
+ updatedAt: Date;
17
+ }
18
+ //# sourceMappingURL=invoice-ledger-client-map.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-ledger-client-map.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/invoice-ledger-client-map.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAgC,MAAM,iBAAiB,CAAC;AAI7F;;;GAGG;AACH,qBAGa,sBAAsB;IACjC,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,GAAG,gBAAgB,GAAG,WAAW,CAAC;IAGxD,EAAE,EAAE,MAAM,CAAgB;IAG1B,SAAS,EAAG,MAAM,CAAC;IAInB,cAAc,EAAG,MAAM,CAAC;IAGxB,OAAO,EAAG,MAAM,CAAC;IAGjB,cAAc,EAAG,MAAM,CAAC;IAGxB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG/B,cAAc,EAAG,MAAM,CAAC;IAGxB,WAAW,EAAG,SAAS,GAAG,YAAY,CAAC;IAGvC,SAAS,EAAE,IAAI,CAAc;CAC9B"}
@@ -0,0 +1,72 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Entity, Index, OptionalProps, PrimaryKey, Property, Unique } from '@mikro-orm/core';
11
+ import { OrgScoped } from '@endora-commerce/platform/tenancy';
12
+ import { randomUUID } from 'crypto';
13
+ /**
14
+ * Organization → remote client, keyed per Infakt company (credential_code).
15
+ * Unique `(adapter_id, organization_id, environment, credential_code)`.
16
+ */
17
+ let InvoiceLedgerClientMap = class InvoiceLedgerClientMap {
18
+ [OptionalProps];
19
+ id = randomUUID();
20
+ adapterId;
21
+ organizationId;
22
+ nipUsed;
23
+ remoteClientId;
24
+ salesChannelId;
25
+ credentialCode;
26
+ environment;
27
+ updatedAt = new Date();
28
+ };
29
+ __decorate([
30
+ PrimaryKey({ type: 'uuid' }),
31
+ __metadata("design:type", String)
32
+ ], InvoiceLedgerClientMap.prototype, "id", void 0);
33
+ __decorate([
34
+ Property({ type: 'varchar', length: 64, fieldName: 'adapter_id' }),
35
+ __metadata("design:type", String)
36
+ ], InvoiceLedgerClientMap.prototype, "adapterId", void 0);
37
+ __decorate([
38
+ Property({ type: 'uuid', fieldName: 'organization_id' }),
39
+ Index(),
40
+ __metadata("design:type", String)
41
+ ], InvoiceLedgerClientMap.prototype, "organizationId", void 0);
42
+ __decorate([
43
+ Property({ type: 'varchar', length: 32, fieldName: 'nip_used' }),
44
+ __metadata("design:type", String)
45
+ ], InvoiceLedgerClientMap.prototype, "nipUsed", void 0);
46
+ __decorate([
47
+ Property({ type: 'varchar', length: 64, fieldName: 'remote_client_id' }),
48
+ __metadata("design:type", String)
49
+ ], InvoiceLedgerClientMap.prototype, "remoteClientId", void 0);
50
+ __decorate([
51
+ Property({ type: 'uuid', fieldName: 'sales_channel_id', nullable: true }),
52
+ __metadata("design:type", Object)
53
+ ], InvoiceLedgerClientMap.prototype, "salesChannelId", void 0);
54
+ __decorate([
55
+ Property({ type: 'varchar', length: 128, fieldName: 'credential_code' }),
56
+ __metadata("design:type", String)
57
+ ], InvoiceLedgerClientMap.prototype, "credentialCode", void 0);
58
+ __decorate([
59
+ Property({ type: 'varchar', length: 16, fieldName: 'environment' }),
60
+ __metadata("design:type", String)
61
+ ], InvoiceLedgerClientMap.prototype, "environment", void 0);
62
+ __decorate([
63
+ Property({ type: 'timestamptz', fieldName: 'updated_at', onUpdate: () => new Date() }),
64
+ __metadata("design:type", Date)
65
+ ], InvoiceLedgerClientMap.prototype, "updatedAt", void 0);
66
+ InvoiceLedgerClientMap = __decorate([
67
+ OrgScoped(),
68
+ Entity({ tableName: 'invoice_ledger_client_maps' }),
69
+ Unique({ properties: ['adapterId', 'organizationId', 'environment', 'credentialCode'] })
70
+ ], InvoiceLedgerClientMap);
71
+ export { InvoiceLedgerClientMap };
72
+ //# sourceMappingURL=invoice-ledger-client-map.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-ledger-client-map.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/invoice-ledger-client-map.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE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AAG,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;;8DACjD;AAGxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;;2DAC7B;AAGvC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAC5E,IAAI;yDAAc;AA7BlB,sBAAsB;IAHlC,SAAS,EAAE;IACX,MAAM,CAAC,EAAE,SAAS,EAAE,4BAA4B,EAAE,CAAC;IACnD,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,WAAW,EAAE,gBAAgB,EAAE,aAAa,EAAE,gBAAgB,CAAC,EAAE,CAAC;GAC5E,sBAAsB,CA8BlC"}
@@ -0,0 +1,65 @@
1
+ import { OptionalProps } from '@mikro-orm/core';
2
+ import type { InvoiceLedgerDeliveryAttempt, InvoiceLedgerDeliveryKind, InvoiceLedgerDeliveryStatus, InvoiceLedgerKsefRouting, InvoiceLedgerNumberingMode } from '@endora-commerce/contracts';
3
+ /**
4
+ * Durable ledger work item. UUID invoice_id only; no FK to invoices.
5
+ * Frozen credential / environment / numbering / KSeF routing at enqueue —
6
+ * and the buyer organization with them.
7
+ *
8
+ * ## Why the organization is a column here and not a chain hop
9
+ *
10
+ * It was `@TransitivelyScoped('Invoice', 'invoiceId')`, copied from
11
+ * `KsefSubmission`, and the copy is where it went wrong: `ksef` declares
12
+ * `invoices` in its manifest `dependencies`, so its parent is in every
13
+ * composition `ksef` is in. `invoice_ledger` declares no such thing and
14
+ * **cannot** — it is `nonDeactivatable`, and `module-composition.md` §4a is
15
+ * explicit that a `dependencies` entry from a non-deactivatable module would
16
+ * make `invoices.enabled` a dead switch, which is why the four port edges into
17
+ * `invoices` are `nonBindingDependencies` instead.
18
+ *
19
+ * So a client's instance that installs the locked set and not `invoices` loads
20
+ * this class and no `Invoice`, and the tenancy reconciliation refuses the boot
21
+ * before a single migration runs — A3 of the instance acceptance criterion,
22
+ * measured on pipeline 13835 and on no instrument before it, because this
23
+ * repository composes every module and the parent is always there.
24
+ *
25
+ * The organization is frozen at enqueue exactly as the credential, the
26
+ * environment, the numbering mode and the KSeF routing already are, which is
27
+ * this row's own design rather than a new one; the FK is to `organizations`,
28
+ * the module's own declared dependency, and the table below is where the
29
+ * sibling `invoice_ledger_client_maps` already keeps it. There is still **no**
30
+ * foreign key to `invoices` (`specs/119-infakt-integration/data-model.md` §3).
31
+ */
32
+ export declare class InvoiceLedgerDelivery {
33
+ [OptionalProps]?: 'id' | 'salesChannelId' | 'asyncTaskId' | 'remoteDocumentId' | 'attemptCount' | 'attempts' | 'lastError' | 'remotePaidAt' | 'ksefDelegated' | 'createdAt' | 'updatedAt';
34
+ id: string;
35
+ adapterId: string;
36
+ invoiceId: string;
37
+ organizationId: string;
38
+ kind: InvoiceLedgerDeliveryKind;
39
+ salesChannelId?: string | null;
40
+ credentialCode: string;
41
+ environment: 'sandbox' | 'production';
42
+ numberingMode: InvoiceLedgerNumberingMode;
43
+ /**
44
+ * Who submits this invoice to KSeF: `native` (the platform's own submission
45
+ * path) or `vendor` (the accounting vendor this delivery goes to). **Stays in
46
+ * this free module** (`specs/134-paid-module-extraction/` T067): KSeF is
47
+ * Poland's statutory clearing system, not a vendor, and recording how an
48
+ * invoice reached it is ledger routing, not coupling to the `ksef` module.
49
+ * Do not remove it to "finish" that module's extraction;
50
+ * `packages/contracts/src/statutory-ksef-state.test.ts` is the guard.
51
+ */
52
+ ksefRouting: InvoiceLedgerKsefRouting;
53
+ status: InvoiceLedgerDeliveryStatus;
54
+ asyncTaskId?: string | null;
55
+ remoteDocumentId?: string | null;
56
+ idempotencyKey: string;
57
+ attemptCount: number;
58
+ attempts: InvoiceLedgerDeliveryAttempt[];
59
+ lastError?: string | null;
60
+ remotePaidAt?: Date | null;
61
+ ksefDelegated: boolean;
62
+ createdAt: Date;
63
+ updatedAt: Date;
64
+ }
65
+ //# sourceMappingURL=invoice-ledger-delivery.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-ledger-delivery.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/invoice-ledger-delivery.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAgC,MAAM,iBAAiB,CAAC;AAG7F,OAAO,KAAK,EACV,4BAA4B,EAC5B,yBAAyB,EACzB,2BAA2B,EAC3B,wBAAwB,EACxB,0BAA0B,EAC3B,MAAM,4BAA4B,CAAC;AAEpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,qBAIa,qBAAqB;IAChC,CAAC,aAAa,CAAC,CAAC,EACZ,IAAI,GACJ,gBAAgB,GAChB,aAAa,GACb,kBAAkB,GAClB,cAAc,GACd,UAAU,GACV,WAAW,GACX,cAAc,GACd,eAAe,GACf,WAAW,GACX,WAAW,CAAC;IAGhB,EAAE,EAAE,MAAM,CAAgB;IAG1B,SAAS,EAAG,MAAM,CAAC;IAGnB,SAAS,EAAG,MAAM,CAAC;IAInB,cAAc,EAAG,MAAM,CAAC;IAGxB,IAAI,EAAG,yBAAyB,CAAC;IAGjC,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG/B,cAAc,EAAG,MAAM,CAAC;IAGxB,WAAW,EAAG,SAAS,GAAG,YAAY,CAAC;IAGvC,aAAa,EAAG,0BAA0B,CAAC;IAE3C;;;;;;;;OAQG;IAEH,WAAW,EAAG,wBAAwB,CAAC;IAIvC,MAAM,EAAG,2BAA2B,CAAC;IAGrC,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG5B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGjC,cAAc,EAAG,MAAM,CAAC;IAGxB,YAAY,EAAE,MAAM,CAAK;IAGzB,QAAQ,EAAE,4BAA4B,EAAE,CAAM;IAG9C,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAG1B,YAAY,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAG3B,aAAa,EAAE,OAAO,CAAS;IAG/B,SAAS,EAAE,IAAI,CAAc;IAG7B,SAAS,EAAE,IAAI,CAAc;CAC9B"}
@@ -0,0 +1,168 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Entity, Index, OptionalProps, PrimaryKey, Property, Unique } from '@mikro-orm/core';
11
+ import { OrgScoped } from '@endora-commerce/platform/tenancy';
12
+ import { randomUUID } from 'crypto';
13
+ /**
14
+ * Durable ledger work item. UUID invoice_id only; no FK to invoices.
15
+ * Frozen credential / environment / numbering / KSeF routing at enqueue —
16
+ * and the buyer organization with them.
17
+ *
18
+ * ## Why the organization is a column here and not a chain hop
19
+ *
20
+ * It was `@TransitivelyScoped('Invoice', 'invoiceId')`, copied from
21
+ * `KsefSubmission`, and the copy is where it went wrong: `ksef` declares
22
+ * `invoices` in its manifest `dependencies`, so its parent is in every
23
+ * composition `ksef` is in. `invoice_ledger` declares no such thing and
24
+ * **cannot** — it is `nonDeactivatable`, and `module-composition.md` §4a is
25
+ * explicit that a `dependencies` entry from a non-deactivatable module would
26
+ * make `invoices.enabled` a dead switch, which is why the four port edges into
27
+ * `invoices` are `nonBindingDependencies` instead.
28
+ *
29
+ * So a client's instance that installs the locked set and not `invoices` loads
30
+ * this class and no `Invoice`, and the tenancy reconciliation refuses the boot
31
+ * before a single migration runs — A3 of the instance acceptance criterion,
32
+ * measured on pipeline 13835 and on no instrument before it, because this
33
+ * repository composes every module and the parent is always there.
34
+ *
35
+ * The organization is frozen at enqueue exactly as the credential, the
36
+ * environment, the numbering mode and the KSeF routing already are, which is
37
+ * this row's own design rather than a new one; the FK is to `organizations`,
38
+ * the module's own declared dependency, and the table below is where the
39
+ * sibling `invoice_ledger_client_maps` already keeps it. There is still **no**
40
+ * foreign key to `invoices` (`specs/119-infakt-integration/data-model.md` §3).
41
+ */
42
+ let InvoiceLedgerDelivery = class InvoiceLedgerDelivery {
43
+ [OptionalProps];
44
+ id = randomUUID();
45
+ adapterId;
46
+ invoiceId;
47
+ organizationId;
48
+ kind;
49
+ salesChannelId;
50
+ credentialCode;
51
+ environment;
52
+ numberingMode;
53
+ /**
54
+ * Who submits this invoice to KSeF: `native` (the platform's own submission
55
+ * path) or `vendor` (the accounting vendor this delivery goes to). **Stays in
56
+ * this free module** (`specs/134-paid-module-extraction/` T067): KSeF is
57
+ * Poland's statutory clearing system, not a vendor, and recording how an
58
+ * invoice reached it is ledger routing, not coupling to the `ksef` module.
59
+ * Do not remove it to "finish" that module's extraction;
60
+ * `packages/contracts/src/statutory-ksef-state.test.ts` is the guard.
61
+ */
62
+ ksefRouting;
63
+ status;
64
+ asyncTaskId;
65
+ remoteDocumentId;
66
+ idempotencyKey;
67
+ attemptCount = 0;
68
+ attempts = [];
69
+ lastError;
70
+ remotePaidAt;
71
+ ksefDelegated = false;
72
+ createdAt = new Date();
73
+ updatedAt = new Date();
74
+ };
75
+ __decorate([
76
+ PrimaryKey({ type: 'uuid' }),
77
+ __metadata("design:type", String)
78
+ ], InvoiceLedgerDelivery.prototype, "id", void 0);
79
+ __decorate([
80
+ Property({ type: 'varchar', length: 64, fieldName: 'adapter_id' }),
81
+ __metadata("design:type", String)
82
+ ], InvoiceLedgerDelivery.prototype, "adapterId", void 0);
83
+ __decorate([
84
+ Property({ type: 'uuid', fieldName: 'invoice_id' }),
85
+ __metadata("design:type", String)
86
+ ], InvoiceLedgerDelivery.prototype, "invoiceId", void 0);
87
+ __decorate([
88
+ Property({ type: 'uuid', fieldName: 'organization_id' }),
89
+ Index(),
90
+ __metadata("design:type", String)
91
+ ], InvoiceLedgerDelivery.prototype, "organizationId", void 0);
92
+ __decorate([
93
+ Property({ type: 'varchar', length: 16, fieldName: 'kind' }),
94
+ __metadata("design:type", String)
95
+ ], InvoiceLedgerDelivery.prototype, "kind", void 0);
96
+ __decorate([
97
+ Property({ type: 'uuid', fieldName: 'sales_channel_id', nullable: true }),
98
+ __metadata("design:type", Object)
99
+ ], InvoiceLedgerDelivery.prototype, "salesChannelId", void 0);
100
+ __decorate([
101
+ Property({ type: 'varchar', length: 128, fieldName: 'credential_code' }),
102
+ __metadata("design:type", String)
103
+ ], InvoiceLedgerDelivery.prototype, "credentialCode", void 0);
104
+ __decorate([
105
+ Property({ type: 'varchar', length: 16, fieldName: 'environment' }),
106
+ __metadata("design:type", String)
107
+ ], InvoiceLedgerDelivery.prototype, "environment", void 0);
108
+ __decorate([
109
+ Property({ type: 'varchar', length: 16, fieldName: 'numbering_mode' }),
110
+ __metadata("design:type", String)
111
+ ], InvoiceLedgerDelivery.prototype, "numberingMode", void 0);
112
+ __decorate([
113
+ Property({ type: 'varchar', length: 16, fieldName: 'ksef_routing' }),
114
+ __metadata("design:type", String)
115
+ ], InvoiceLedgerDelivery.prototype, "ksefRouting", void 0);
116
+ __decorate([
117
+ Property({ type: 'varchar', length: 24, fieldName: 'status' }),
118
+ Index(),
119
+ __metadata("design:type", String)
120
+ ], InvoiceLedgerDelivery.prototype, "status", void 0);
121
+ __decorate([
122
+ Property({ type: 'varchar', length: 128, fieldName: 'async_task_id', nullable: true }),
123
+ __metadata("design:type", Object)
124
+ ], InvoiceLedgerDelivery.prototype, "asyncTaskId", void 0);
125
+ __decorate([
126
+ Property({ type: 'varchar', length: 64, fieldName: 'remote_document_id', nullable: true }),
127
+ __metadata("design:type", Object)
128
+ ], InvoiceLedgerDelivery.prototype, "remoteDocumentId", void 0);
129
+ __decorate([
130
+ Property({ type: 'varchar', length: 128, fieldName: 'idempotency_key' }),
131
+ __metadata("design:type", String)
132
+ ], InvoiceLedgerDelivery.prototype, "idempotencyKey", void 0);
133
+ __decorate([
134
+ Property({ type: 'integer', fieldName: 'attempt_count' }),
135
+ __metadata("design:type", Number)
136
+ ], InvoiceLedgerDelivery.prototype, "attemptCount", void 0);
137
+ __decorate([
138
+ Property({ type: 'json', fieldName: 'attempts' }),
139
+ __metadata("design:type", Array)
140
+ ], InvoiceLedgerDelivery.prototype, "attempts", void 0);
141
+ __decorate([
142
+ Property({ type: 'text', fieldName: 'last_error', nullable: true }),
143
+ __metadata("design:type", Object)
144
+ ], InvoiceLedgerDelivery.prototype, "lastError", void 0);
145
+ __decorate([
146
+ Property({ type: 'timestamptz', fieldName: 'remote_paid_at', nullable: true }),
147
+ __metadata("design:type", Object)
148
+ ], InvoiceLedgerDelivery.prototype, "remotePaidAt", void 0);
149
+ __decorate([
150
+ Property({ type: 'boolean', fieldName: 'ksef_delegated' }),
151
+ __metadata("design:type", Boolean)
152
+ ], InvoiceLedgerDelivery.prototype, "ksefDelegated", void 0);
153
+ __decorate([
154
+ Property({ type: 'timestamptz', fieldName: 'created_at', onCreate: () => new Date() }),
155
+ __metadata("design:type", Date)
156
+ ], InvoiceLedgerDelivery.prototype, "createdAt", void 0);
157
+ __decorate([
158
+ Property({ type: 'timestamptz', fieldName: 'updated_at', onCreate: () => new Date(), onUpdate: () => new Date() }),
159
+ __metadata("design:type", Date)
160
+ ], InvoiceLedgerDelivery.prototype, "updatedAt", void 0);
161
+ InvoiceLedgerDelivery = __decorate([
162
+ OrgScoped(),
163
+ Entity({ tableName: 'invoice_ledger_deliveries' }),
164
+ Unique({ properties: ['adapterId', 'invoiceId'] }),
165
+ Unique({ properties: ['adapterId', 'idempotencyKey'] })
166
+ ], InvoiceLedgerDelivery);
167
+ export { InvoiceLedgerDelivery };
168
+ //# sourceMappingURL=invoice-ledger-delivery.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-ledger-delivery.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/invoice-ledger-delivery.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AASpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAKI,IAAM,qBAAqB,GAA3B,MAAM,qBAAqB;IAChC,CAAC,aAAa,CAAC,CAWC;IAGhB,EAAE,GAAW,UAAU,EAAE,CAAC;IAG1B,SAAS,CAAU;IAGnB,SAAS,CAAU;IAInB,cAAc,CAAU;IAGxB,IAAI,CAA6B;IAGjC,cAAc,CAAiB;IAG/B,cAAc,CAAU;IAGxB,WAAW,CAA4B;IAGvC,aAAa,CAA8B;IAE3C;;;;;;;;OAQG;IAEH,WAAW,CAA4B;IAIvC,MAAM,CAA+B;IAGrC,WAAW,CAAiB;IAG5B,gBAAgB,CAAiB;IAGjC,cAAc,CAAU;IAGxB,YAAY,GAAW,CAAC,CAAC;IAGzB,QAAQ,GAAmC,EAAE,CAAC;IAG9C,SAAS,CAAiB;IAG1B,YAAY,CAAe;IAG3B,aAAa,GAAY,KAAK,CAAC;IAG/B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;IAG7B,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;CAC9B,CAAA;AAxEC;IADC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;iDACH;AAG1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAA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;AAtFlB,qBAAqB;IAJjC,SAAS,EAAE;IACX,MAAM,CAAC,EAAE,SAAS,EAAE,2BAA2B,EAAE,CAAC;IAClD,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,CAAC;IAClD,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,WAAW,EAAE,gBAAgB,CAAC,EAAE,CAAC;GAC3C,qBAAqB,CAuFjC"}
@@ -0,0 +1,25 @@
1
+ import { OptionalProps } from '@mikro-orm/core';
2
+ /**
3
+ * Endora invoice → remote VAT/correction. UUID columns only; no FK to invoices.
4
+ * Unique `(adapter_id, invoice_id)`. Partial unique on remote id is migration-only.
5
+ *
6
+ * `@OrgScoped()` rather than a chain hop through `Invoice`, for the reason
7
+ * `invoice-ledger-delivery.entity.ts` gives at length: `invoice_ledger` is
8
+ * `nonDeactivatable` and cannot declare `invoices` in `dependencies`, so an
9
+ * instance may load this class with no `Invoice` registered at all. The
10
+ * organization is copied from the delivery row this map projects, which froze
11
+ * it at enqueue.
12
+ */
13
+ export declare class InvoiceLedgerDocumentMap {
14
+ [OptionalProps]?: 'id' | 'originalInvoiceId' | 'createdAt';
15
+ id: string;
16
+ adapterId: string;
17
+ invoiceId: string;
18
+ organizationId: string;
19
+ originalInvoiceId?: string | null;
20
+ remoteDocumentId?: string | null;
21
+ environment: 'sandbox' | 'production';
22
+ credentialCode: string;
23
+ createdAt: Date;
24
+ }
25
+ //# sourceMappingURL=invoice-ledger-document-map.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-ledger-document-map.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/invoice-ledger-document-map.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAgC,MAAM,iBAAiB,CAAC;AAI7F;;;;;;;;;;GAUG;AACH,qBAGa,wBAAwB;IACnC,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,GAAG,mBAAmB,GAAG,WAAW,CAAC;IAG3D,EAAE,EAAE,MAAM,CAAgB;IAG1B,SAAS,EAAG,MAAM,CAAC;IAGnB,SAAS,EAAG,MAAM,CAAC;IAInB,cAAc,EAAG,MAAM,CAAC;IAIxB,iBAAiB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGlC,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAGjC,WAAW,EAAG,SAAS,GAAG,YAAY,CAAC;IAGvC,cAAc,EAAG,MAAM,CAAC;IAGxB,SAAS,EAAE,IAAI,CAAc;CAC9B"}
@@ -0,0 +1,80 @@
1
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
2
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
4
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
5
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
6
+ };
7
+ var __metadata = (this && this.__metadata) || function (k, v) {
8
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
+ };
10
+ import { Entity, Index, OptionalProps, PrimaryKey, Property, Unique } from '@mikro-orm/core';
11
+ import { OrgScoped } from '@endora-commerce/platform/tenancy';
12
+ import { randomUUID } from 'crypto';
13
+ /**
14
+ * Endora invoice → remote VAT/correction. UUID columns only; no FK to invoices.
15
+ * Unique `(adapter_id, invoice_id)`. Partial unique on remote id is migration-only.
16
+ *
17
+ * `@OrgScoped()` rather than a chain hop through `Invoice`, for the reason
18
+ * `invoice-ledger-delivery.entity.ts` gives at length: `invoice_ledger` is
19
+ * `nonDeactivatable` and cannot declare `invoices` in `dependencies`, so an
20
+ * instance may load this class with no `Invoice` registered at all. The
21
+ * organization is copied from the delivery row this map projects, which froze
22
+ * it at enqueue.
23
+ */
24
+ let InvoiceLedgerDocumentMap = class InvoiceLedgerDocumentMap {
25
+ [OptionalProps];
26
+ id = randomUUID();
27
+ adapterId;
28
+ invoiceId;
29
+ organizationId;
30
+ originalInvoiceId;
31
+ remoteDocumentId;
32
+ environment;
33
+ credentialCode;
34
+ createdAt = new Date();
35
+ };
36
+ __decorate([
37
+ PrimaryKey({ type: 'uuid' }),
38
+ __metadata("design:type", String)
39
+ ], InvoiceLedgerDocumentMap.prototype, "id", void 0);
40
+ __decorate([
41
+ Property({ type: 'varchar', length: 64, fieldName: 'adapter_id' }),
42
+ __metadata("design:type", String)
43
+ ], InvoiceLedgerDocumentMap.prototype, "adapterId", void 0);
44
+ __decorate([
45
+ Property({ type: 'uuid', fieldName: 'invoice_id' }),
46
+ __metadata("design:type", String)
47
+ ], InvoiceLedgerDocumentMap.prototype, "invoiceId", void 0);
48
+ __decorate([
49
+ Property({ type: 'uuid', fieldName: 'organization_id' }),
50
+ Index(),
51
+ __metadata("design:type", String)
52
+ ], InvoiceLedgerDocumentMap.prototype, "organizationId", void 0);
53
+ __decorate([
54
+ Property({ type: 'uuid', fieldName: 'original_invoice_id', nullable: true }),
55
+ Index(),
56
+ __metadata("design:type", Object)
57
+ ], InvoiceLedgerDocumentMap.prototype, "originalInvoiceId", void 0);
58
+ __decorate([
59
+ Property({ type: 'varchar', length: 64, fieldName: 'remote_document_id', nullable: true }),
60
+ __metadata("design:type", Object)
61
+ ], InvoiceLedgerDocumentMap.prototype, "remoteDocumentId", void 0);
62
+ __decorate([
63
+ Property({ type: 'varchar', length: 16, fieldName: 'environment' }),
64
+ __metadata("design:type", String)
65
+ ], InvoiceLedgerDocumentMap.prototype, "environment", void 0);
66
+ __decorate([
67
+ Property({ type: 'varchar', length: 128, fieldName: 'credential_code' }),
68
+ __metadata("design:type", String)
69
+ ], InvoiceLedgerDocumentMap.prototype, "credentialCode", void 0);
70
+ __decorate([
71
+ Property({ type: 'timestamptz', fieldName: 'created_at', onCreate: () => new Date() }),
72
+ __metadata("design:type", Date)
73
+ ], InvoiceLedgerDocumentMap.prototype, "createdAt", void 0);
74
+ InvoiceLedgerDocumentMap = __decorate([
75
+ OrgScoped(),
76
+ Entity({ tableName: 'invoice_ledger_document_maps' }),
77
+ Unique({ properties: ['adapterId', 'invoiceId'] })
78
+ ], InvoiceLedgerDocumentMap);
79
+ export { InvoiceLedgerDocumentMap };
80
+ //# sourceMappingURL=invoice-ledger-document-map.entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-ledger-document-map.entity.js","sourceRoot":"","sources":["../../../src/backend/entities/invoice-ledger-document-map.entity.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAC7F,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AAEpC;;;;;;;;;;GAUG;AAII,IAAM,wBAAwB,GAA9B,MAAM,wBAAwB;IACnC,CAAC,aAAa,CAAC,CAA4C;IAG3D,EAAE,GAAW,UAAU,EAAE,CAAC;IAG1B,SAAS,CAAU;IAGnB,SAAS,CAAU;IAInB,cAAc,CAAU;IAIxB,iBAAiB,CAAiB;IAGlC,gBAAgB,CAAiB;IAGjC,WAAW,CAA4B;IAGvC,cAAc,CAAU;IAGxB,SAAS,GAAS,IAAI,IAAI,EAAE,CAAC;CAC9B,CAAA;AA3BC;IADC,UAAU,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;;oDACH;AAG1B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;;2DAChD;AAGnB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,YAAY,EAAE,CAAC;;2DACjC;AAInB;IAFC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;IACxD,KAAK,EAAE;;gEACgB;AAIxB;IAFC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC5E,KAAK,EAAE;;mEAC0B;AAGlC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,oBAAoB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;kEAC1D;AAGjC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,SAAS,EAAE,aAAa,EAAE,CAAC;;6DAC7B;AAGvC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,iBAAiB,EAAE,CAAC;;gEACjD;AAGxB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,aAAa,EAAE,SAAS,EAAE,YAAY,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,EAAE,CAAC;8BAC5E,IAAI;2DAAc;AA9BlB,wBAAwB;IAHpC,SAAS,EAAE;IACX,MAAM,CAAC,EAAE,SAAS,EAAE,8BAA8B,EAAE,CAAC;IACrD,MAAM,CAAC,EAAE,UAAU,EAAE,CAAC,WAAW,EAAE,WAAW,CAAC,EAAE,CAAC;GACtC,wBAAwB,CA+BpC"}
@@ -0,0 +1,18 @@
1
+ import { OptionalProps } from '@mikro-orm/core';
2
+ export type InvoiceLedgerWebhookReceiptState = 'received' | 'processed' | 'ignored' | 'failed';
3
+ /**
4
+ * Vendor event-id claim. Persist `received` before invoices-port side effects.
5
+ */
6
+ export declare class InvoiceLedgerWebhookReceipt {
7
+ [OptionalProps]?: 'id' | 'attempts' | 'appliedAt' | 'error' | 'receivedAt';
8
+ id: string;
9
+ adapterId: string;
10
+ eventId: string;
11
+ eventType: string;
12
+ state: InvoiceLedgerWebhookReceiptState;
13
+ attempts: number;
14
+ receivedAt: Date;
15
+ appliedAt?: Date | null;
16
+ error?: string | null;
17
+ }
18
+ //# sourceMappingURL=invoice-ledger-webhook-receipt.entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"invoice-ledger-webhook-receipt.entity.d.ts","sourceRoot":"","sources":["../../../src/backend/entities/invoice-ledger-webhook-receipt.entity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,aAAa,EAAgC,MAAM,iBAAiB,CAAC;AAI7F,MAAM,MAAM,gCAAgC,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE/F;;GAEG;AACH,qBAGa,2BAA2B;IACtC,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,GAAG,YAAY,CAAC;IAG3E,EAAE,EAAE,MAAM,CAAgB;IAG1B,SAAS,EAAG,MAAM,CAAC;IAGnB,OAAO,EAAG,MAAM,CAAC;IAGjB,SAAS,EAAG,MAAM,CAAC;IAInB,KAAK,EAAE,gCAAgC,CAAc;IAGrD,QAAQ,EAAE,MAAM,CAAK;IAGrB,UAAU,EAAE,IAAI,CAAc;IAG9B,SAAS,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAGxB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB"}