@happyvertical/smrt-ledgers 0.55.0 → 0.55.8

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.
@@ -3,12 +3,12 @@
3
3
  "sensitiveFieldsExcluded": true,
4
4
  "generatedAt": "1970-01-01T00:00:00.000Z",
5
5
  "packageName": "@happyvertical/smrt-ledgers",
6
- "packageVersion": "0.55.0",
6
+ "packageVersion": "0.55.8",
7
7
  "sourceManifestPath": "dist/manifest.json",
8
8
  "agentDocPath": "AGENTS.md",
9
9
  "sourceHashes": {
10
- "manifest": "824c6509025a2cfcebefada7bb429e077be31fab41522525c2b2cf6b67475fc0",
11
- "packageJson": "1d828bc1a2ab13e8b5c0ca4d145fe082fd64b326f46e76f40e0fb480fa602865",
10
+ "manifest": "660c83ae95d30bb0252900e129830141afdc6381f1c16bfc9c4e61a82002ad18",
11
+ "packageJson": "1b3763f851c561127bfdbd7645f4fbcb709156662af0c7f53b51d21fe8e7c888",
12
12
  "agents": "ae2190496d153852ff73d18f871a829303927e1c65053b5325b02c0d9f470bfe"
13
13
  },
14
14
  "exports": [
@@ -1136,6 +1136,7 @@
1136
1136
  {
1137
1137
  "name": "Account",
1138
1138
  "qualifiedName": "@happyvertical/smrt-ledgers:Account",
1139
+ "displayLabelField": "name",
1139
1140
  "collection": "accounts",
1140
1141
  "tableName": "ledger_accounts",
1141
1142
  "packageName": "@happyvertical/smrt-ledgers",
@@ -1159,35 +1160,40 @@
1159
1160
  "type": "text",
1160
1161
  "required": false,
1161
1162
  "columnType": "TEXT",
1162
- "default": ""
1163
+ "default": "",
1164
+ "description": "The account number in your chart of accounts."
1163
1165
  },
1164
1166
  {
1165
1167
  "name": "name",
1166
1168
  "type": "text",
1167
1169
  "required": false,
1168
1170
  "columnType": "TEXT",
1169
- "default": ""
1171
+ "default": "",
1172
+ "description": "What the account is called."
1170
1173
  },
1171
1174
  {
1172
1175
  "name": "description",
1173
1176
  "type": "text",
1174
1177
  "required": false,
1175
1178
  "columnType": "TEXT",
1176
- "default": ""
1179
+ "default": "",
1180
+ "description": "What the account is used for."
1177
1181
  },
1178
1182
  {
1179
1183
  "name": "type",
1180
1184
  "type": "text",
1181
1185
  "required": false,
1182
1186
  "columnType": "TEXT",
1183
- "default": "asset"
1187
+ "default": "asset",
1188
+ "description": "asset, liability, equity, revenue or expense."
1184
1189
  },
1185
1190
  {
1186
1191
  "name": "active",
1187
1192
  "type": "boolean",
1188
1193
  "required": false,
1189
1194
  "columnType": "BOOLEAN",
1190
- "default": true
1195
+ "default": true,
1196
+ "description": "Whether the account is in use; deactivate it instead of deleting it."
1191
1197
  },
1192
1198
  {
1193
1199
  "name": "metadata",
@@ -1592,20 +1598,23 @@
1592
1598
  "type": "text",
1593
1599
  "required": false,
1594
1600
  "columnType": "TEXT",
1595
- "default": ""
1601
+ "default": "",
1602
+ "description": "The journal's reference number."
1596
1603
  },
1597
1604
  {
1598
1605
  "name": "date",
1599
1606
  "type": "datetime",
1600
1607
  "required": false,
1601
- "columnType": "TIMESTAMP"
1608
+ "columnType": "TIMESTAMP",
1609
+ "description": "The date of the transaction."
1602
1610
  },
1603
1611
  {
1604
1612
  "name": "description",
1605
1613
  "type": "text",
1606
1614
  "required": false,
1607
1615
  "columnType": "TEXT",
1608
- "default": ""
1616
+ "default": "",
1617
+ "description": "What the transaction was."
1609
1618
  },
1610
1619
  {
1611
1620
  "name": "sourceModule",
@@ -1625,13 +1634,15 @@
1625
1634
  "type": "text",
1626
1635
  "required": false,
1627
1636
  "columnType": "TEXT",
1628
- "default": "draft"
1637
+ "default": "draft",
1638
+ "description": "draft until final, then posted, or voided."
1629
1639
  },
1630
1640
  {
1631
1641
  "name": "postedAt",
1632
1642
  "type": "datetime",
1633
1643
  "required": false,
1634
- "columnType": "TIMESTAMP"
1644
+ "columnType": "TIMESTAMP",
1645
+ "description": "When it was posted."
1635
1646
  },
1636
1647
  {
1637
1648
  "name": "voidedAt",
@@ -1999,35 +2010,40 @@
1999
2010
  "type": "foreignKey",
2000
2011
  "required": false,
2001
2012
  "related": "Journal",
2002
- "columnType": "UUID"
2013
+ "columnType": "UUID",
2014
+ "description": "The journal this entry belongs to."
2003
2015
  },
2004
2016
  {
2005
2017
  "name": "accountId",
2006
2018
  "type": "foreignKey",
2007
2019
  "required": false,
2008
2020
  "related": "Account",
2009
- "columnType": "UUID"
2021
+ "columnType": "UUID",
2022
+ "description": "The account this entry changes."
2010
2023
  },
2011
2024
  {
2012
2025
  "name": "debit",
2013
2026
  "type": "decimal",
2014
2027
  "required": false,
2015
2028
  "columnType": "REAL",
2016
- "default": 0
2029
+ "default": 0,
2030
+ "description": "The amount debited. Zero on a credit entry."
2017
2031
  },
2018
2032
  {
2019
2033
  "name": "credit",
2020
2034
  "type": "decimal",
2021
2035
  "required": false,
2022
2036
  "columnType": "REAL",
2023
- "default": 0
2037
+ "default": 0,
2038
+ "description": "The amount credited. Zero on a debit entry."
2024
2039
  },
2025
2040
  {
2026
2041
  "name": "currency",
2027
2042
  "type": "text",
2028
2043
  "required": false,
2029
2044
  "columnType": "TEXT",
2030
- "default": "USD"
2045
+ "default": "USD",
2046
+ "description": "The currency of the amounts."
2031
2047
  },
2032
2048
  {
2033
2049
  "name": "exchangeRate",
@@ -2041,7 +2057,8 @@
2041
2057
  "type": "text",
2042
2058
  "required": false,
2043
2059
  "columnType": "TEXT",
2044
- "default": ""
2060
+ "default": "",
2061
+ "description": "A note on this entry."
2045
2062
  },
2046
2063
  {
2047
2064
  "name": "metadata",
@@ -3425,5 +3442,116 @@
3425
3442
  "polymorphicAssociations": 0,
3426
3443
  "uuidColumns": 18
3427
3444
  },
3428
- "agentDoc": "# @happyvertical/smrt-ledgers\n\nDouble-entry accounting with chart of accounts, journal lifecycle, and balance enforcement.\n\n## Models\n\n- **Account**: 5 types (asset/liability/equity/revenue/expense). Hierarchical via `parentId`. Debit-normal (asset, expense) vs credit-normal (liability, equity, revenue). Methods: `getAncestors()`, `getFullPath()`, `toTreeNode()`, `getBalance(asOfDate?)`. Stored in `ledger_accounts` (explicit `tableName`), never the derived `accounts`: smrt-messages declares an unrelated `Account` on that table (#3098). `src/migrations/ledger-accounts-table.ts` (`smrt db:migrate-ledger-accounts`) moves pre-#3098 rows; the README has the operator sequence.\n- **Journal**: lifecycle `draft → posted → voided`. **Immutable after posting** (can only void, not edit). `sourceModule`/`sourceRef` for cross-package attribution. Auto-numbered (e.g., \"JNL-0001\"). `summarize()` is AI-powered via the smrt-prompts registry (see Prompt Registry below).\n- **JournalEntry**: debit XOR credit (not both, validated on save). Multi-currency via `exchangeRate`. Non-negative amounts required.\n\n## Key Methods\n\n- **`Journal.summarize()`**: Generates a natural-language summary via the registered `smrtLedgers.journal.summarize` prompt, resolved through `@happyvertical/smrt-prompts`. Tenants can override the template, model, temperature, or other params via `_smrt_prompt_overrides` without code changes. Only non-PII fields (number, date, description, status, aggregate total, entry count, balanced flag) reach the AI provider.\n\n## Prompt Registry\n\nRegistered at module-load time via `definePrompt()` in `src/prompts.ts`. Side-effect imported from `src/index.ts` so consumers automatically see the prompts after importing any export from this package.\n\n| Key | Method | Variables |\n|-----|--------|-----------|\n| `smrtLedgers.journal.summarize` | `Journal.summarize()` | `journalNumber`, `journalDate`, `journalDescription`, `journalStatus`, `journalTotal`, `entryCount`, `journalBalanced` |\n\nPII-conscious variable selection: `tenantId`, `sourceRef` (may reference customer/vendor identifiers), per-entry `accountId`/`id`, and the extensible `metadata` blob are intentionally NOT exposed as prompt variables. Tenants who need richer context should override the template via `PromptOverride` and supply their own variables through a custom call site.\n\n## Balance Enforcement\n\n`journal.post()` validates `Math.abs(totalDebits - totalCredits) < BALANCE_EPSILON` where `BALANCE_EPSILON = 0.01` (float rounding tolerance). Unbalanced journals cannot be posted.\n\n**This package is unit-agnostic** — `debit` / `credit` are plain DECIMAL numbers and the balance check only compares the two sides, so it holds for whatever unit the posting module uses. As of #2401, journals posted from `@happyvertical/smrt-commerce` (`Payment.recordPayment()`, `Invoice.recognizeRevenue()`) carry **integer minor units**, which balance exactly rather than merely within the epsilon. A consumer mixing modules that post in different units will get arithmetically balanced but semantically meaningless journals; pick one unit per ledger.\n\n## Gotchas\n\n- **Float tolerance**: 0.01 epsilon for balance check — not exact equality\n- **Entry requires journalId**: save Journal first, then add entries\n- **Posted journals cannot be modified**: only voided (`voidReason`, `voidedAt`)\n- **Account types inherited by children**: child cannot differ from parent type\n- **getBalance() is async**: requires JournalEntryCollection query (not stored on Account)\n- **Optional tenancy** on all models\n- **Same-named `Account`**: reference the ledger model by constructor (`@foreignKey(Account)`) or qualified name (`@happyvertical/smrt-ledgers:Account`), never the bare string. The PostgreSQL lanes are `pnpm test:postgres` here (ledgers alone) and in smrt-messages (both packages loaded)\n"
3445
+ "agentDoc": "# @happyvertical/smrt-ledgers\n\nDouble-entry accounting with chart of accounts, journal lifecycle, and balance enforcement.\n\n## Models\n\n- **Account**: 5 types (asset/liability/equity/revenue/expense). Hierarchical via `parentId`. Debit-normal (asset, expense) vs credit-normal (liability, equity, revenue). Methods: `getAncestors()`, `getFullPath()`, `toTreeNode()`, `getBalance(asOfDate?)`. Stored in `ledger_accounts` (explicit `tableName`), never the derived `accounts`: smrt-messages declares an unrelated `Account` on that table (#3098). `src/migrations/ledger-accounts-table.ts` (`smrt db:migrate-ledger-accounts`) moves pre-#3098 rows; the README has the operator sequence.\n- **Journal**: lifecycle `draft → posted → voided`. **Immutable after posting** (can only void, not edit). `sourceModule`/`sourceRef` for cross-package attribution. Auto-numbered (e.g., \"JNL-0001\"). `summarize()` is AI-powered via the smrt-prompts registry (see Prompt Registry below).\n- **JournalEntry**: debit XOR credit (not both, validated on save). Multi-currency via `exchangeRate`. Non-negative amounts required.\n\n## Key Methods\n\n- **`Journal.summarize()`**: Generates a natural-language summary via the registered `smrtLedgers.journal.summarize` prompt, resolved through `@happyvertical/smrt-prompts`. Tenants can override the template, model, temperature, or other params via `_smrt_prompt_overrides` without code changes. Only non-PII fields (number, date, description, status, aggregate total, entry count, balanced flag) reach the AI provider.\n\n## Prompt Registry\n\nRegistered at module-load time via `definePrompt()` in `src/prompts.ts`. Side-effect imported from `src/index.ts` so consumers automatically see the prompts after importing any export from this package.\n\n| Key | Method | Variables |\n|-----|--------|-----------|\n| `smrtLedgers.journal.summarize` | `Journal.summarize()` | `journalNumber`, `journalDate`, `journalDescription`, `journalStatus`, `journalTotal`, `entryCount`, `journalBalanced` |\n\nPII-conscious variable selection: `tenantId`, `sourceRef` (may reference customer/vendor identifiers), per-entry `accountId`/`id`, and the extensible `metadata` blob are intentionally NOT exposed as prompt variables. Tenants who need richer context should override the template via `PromptOverride` and supply their own variables through a custom call site.\n\n## Balance Enforcement\n\n`journal.post()` validates `Math.abs(totalDebits - totalCredits) < BALANCE_EPSILON` where `BALANCE_EPSILON = 0.01` (float rounding tolerance). Unbalanced journals cannot be posted.\n\n**This package is unit-agnostic** — `debit` / `credit` are plain DECIMAL numbers and the balance check only compares the two sides, so it holds for whatever unit the posting module uses. As of #2401, journals posted from `@happyvertical/smrt-commerce` (`Payment.recordPayment()`, `Invoice.recognizeRevenue()`) carry **integer minor units**, which balance exactly rather than merely within the epsilon. A consumer mixing modules that post in different units will get arithmetically balanced but semantically meaningless journals; pick one unit per ledger.\n\n## Gotchas\n\n- **Float tolerance**: 0.01 epsilon for balance check — not exact equality\n- **Entry requires journalId**: save Journal first, then add entries\n- **Posted journals cannot be modified**: only voided (`voidReason`, `voidedAt`)\n- **Account types inherited by children**: child cannot differ from parent type\n- **getBalance() is async**: requires JournalEntryCollection query (not stored on Account)\n- **Optional tenancy** on all models\n- **Same-named `Account`**: reference the ledger model by constructor (`@foreignKey(Account)`) or qualified name (`@happyvertical/smrt-ledgers:Account`), never the bare string. The PostgreSQL lanes are `pnpm test:postgres` here (ledgers alone) and in smrt-messages (both packages loaded)\n",
3446
+ "recipes": [
3447
+ {
3448
+ "id": "ledgers.bookkeeping",
3449
+ "className": "BookkeepingRecipe",
3450
+ "label": "Bookkeeping",
3451
+ "summary": "Keep your books: a chart of accounts and double-entry journals.",
3452
+ "synonyms": [
3453
+ "accounting",
3454
+ "ledger",
3455
+ "general ledger",
3456
+ "journals",
3457
+ "chart of accounts"
3458
+ ],
3459
+ "models": [
3460
+ "@happyvertical/smrt-ledgers:Account",
3461
+ "@happyvertical/smrt-ledgers:Journal",
3462
+ "@happyvertical/smrt-ledgers:JournalEntry"
3463
+ ],
3464
+ "nav": [
3465
+ {
3466
+ "label": "Accounts",
3467
+ "model": "@happyvertical/smrt-ledgers:Account",
3468
+ "icon": "bank",
3469
+ "description": "The accounts your books are kept in, like sales, rent and bank."
3470
+ },
3471
+ {
3472
+ "label": "Journals",
3473
+ "model": "@happyvertical/smrt-ledgers:Journal",
3474
+ "icon": "book",
3475
+ "description": "The entries behind your accounts, so every dollar has a trail."
3476
+ }
3477
+ ],
3478
+ "requires": [],
3479
+ "section": {
3480
+ "id": "accounting",
3481
+ "label": "Accounting",
3482
+ "icon": "bank",
3483
+ "description": "Your books: accounts, journals and balances."
3484
+ },
3485
+ "options": {
3486
+ "@happyvertical/smrt-ledgers:Account": {
3487
+ "fields": {
3488
+ "metadata": {
3489
+ "visibility": "hidden"
3490
+ },
3491
+ "parentId": {
3492
+ "visibility": "hidden"
3493
+ }
3494
+ }
3495
+ },
3496
+ "@happyvertical/smrt-ledgers:Journal": {
3497
+ "fields": {
3498
+ "sourceModule": {
3499
+ "visibility": "hidden"
3500
+ },
3501
+ "sourceRef": {
3502
+ "visibility": "hidden"
3503
+ },
3504
+ "voidedAt": {
3505
+ "visibility": "hidden"
3506
+ },
3507
+ "voidReason": {
3508
+ "visibility": "hidden"
3509
+ },
3510
+ "metadata": {
3511
+ "visibility": "hidden"
3512
+ }
3513
+ }
3514
+ },
3515
+ "@happyvertical/smrt-ledgers:JournalEntry": {
3516
+ "fields": {
3517
+ "exchangeRate": {
3518
+ "visibility": "hidden"
3519
+ },
3520
+ "metadata": {
3521
+ "visibility": "hidden"
3522
+ }
3523
+ }
3524
+ }
3525
+ },
3526
+ "help": {
3527
+ "markdown": "## Overview\n\nBookkeeping keeps your accounts. You list the accounts you use (your chart of\naccounts) and record each transaction as a journal whose entries debit and\ncredit those accounts.\n\n## Tasks\n\n### Set up your accounts\n\n1. Create a new account.\n2. Give it a **{field:number}** and a **{field:name}**.\n3. Choose its **{field:type}**: asset, liability, equity, revenue or expense.\n\n### Record a transaction\n\n1. Create a new journal and add a **{field:description}**.\n2. Add entries: pick the account on each and enter a **{field:debit}** or a\n **{field:credit}**. They must add up to the same total.\n3. Set the journal's **{field:status}** to posted when it is final. A posted\n journal is voided, not edited.\n",
3528
+ "fieldRefs": [
3529
+ "credit",
3530
+ "debit",
3531
+ "description",
3532
+ "name",
3533
+ "number",
3534
+ "status",
3535
+ "type"
3536
+ ]
3537
+ },
3538
+ "demo": {
3539
+ "mode": "server",
3540
+ "reasons": [
3541
+ "Needs a server because its package does not build for a browser: core migrations (node:os, node:crypto); and its package depends on @happyvertical/smrt-tenancy, which do not build for a browser (#3624, #3626)."
3542
+ ]
3543
+ }
3544
+ }
3545
+ ],
3546
+ "browser": {
3547
+ "status": "server-only",
3548
+ "issues": [
3549
+ "#3624",
3550
+ "#3626"
3551
+ ],
3552
+ "reason": "core migrations (node:os, node:crypto)",
3553
+ "via": [
3554
+ "@happyvertical/smrt-tenancy"
3555
+ ]
3556
+ }
3429
3557
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@happyvertical/smrt-ledgers",
3
- "version": "0.55.0",
3
+ "version": "0.55.8",
4
4
  "description": "Double-entry accounting ledger for the SMRT framework",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -38,12 +38,12 @@
38
38
  "access": "public"
39
39
  },
40
40
  "dependencies": {
41
- "@happyvertical/smrt-core": "0.55.0",
42
- "@happyvertical/smrt-prompts": "0.55.0",
43
- "@happyvertical/smrt-tenancy": "0.55.0"
41
+ "@happyvertical/smrt-core": "0.55.8",
42
+ "@happyvertical/smrt-prompts": "0.55.8",
43
+ "@happyvertical/smrt-tenancy": "0.55.8"
44
44
  },
45
45
  "devDependencies": {
46
- "@happyvertical/smrt-vitest": "0.55.0",
46
+ "@happyvertical/smrt-vitest": "0.55.8",
47
47
  "@types/node": "24.13.6",
48
48
  "fast-glob": "^3.3.3",
49
49
  "typescript": "6.0.3",
@@ -1 +0,0 @@
1
- {"version":3,"file":"Account-CkLJrn_J.js","names":[],"sources":["../../src/models/Account.ts"],"sourcesContent":["/**\n * Account model - Chart of accounts entry\n *\n * Represents a single account in the chart of accounts.\n * The 5 core types: Asset, Liability, Equity, Revenue, Expense\n */\n\nimport { SmrtHierarchical, smrt } from '@happyvertical/smrt-core';\nimport { TenantScoped, tenantId } from '@happyvertical/smrt-tenancy';\nimport type { AccountOptions, AccountTreeNode, AccountType } from '../types';\n\n@TenantScoped({ mode: 'optional' })\n@smrt({\n // Own table, never the derived `accounts`: smrt-messages declares an\n // unrelated `Account` on that table (#3098). Existing `accounts`-hosted\n // ledgers move with `smrt db:migrate-ledger-accounts`.\n tableName: 'ledger_accounts',\n api: { include: ['list', 'get', 'create', 'update', 'delete'] },\n mcp: { include: ['list', 'get', 'create'] },\n cli: { skipApiCheck: true },\n})\nexport class Account extends SmrtHierarchical { static __smrtPackage__ = \"@happyvertical/smrt-ledgers\";\n /**\n * Tenant ID for multi-tenancy support (nullable for global accounts)\n */\n @tenantId({ nullable: true })\n tenantId: string | null = null;\n\n /**\n * Account number (e.g., \"1000\", \"5030\")\n */\n number: string = '';\n\n /**\n * Account name (e.g., \"Cash\", \"Coffee Expense\")\n */\n name: string = '';\n\n /**\n * Account description\n */\n description: string = '';\n\n /**\n * Account type - one of the 5 core types\n */\n type: AccountType = 'asset';\n\n // parentId inherited from SmrtHierarchical (null = top-level)\n\n /**\n * Whether the account is active\n */\n active: boolean = true;\n\n /**\n * Extensible metadata\n */\n metadata: Record<string, unknown> = {};\n\n constructor(options: AccountOptions = {}) {\n super(options);\n if (options.number !== undefined) this.number = options.number;\n if (options.name !== undefined) this.name = options.name;\n if (options.description !== undefined)\n this.description = options.description;\n if (options.type !== undefined) this.type = options.type;\n if (options.parentId !== undefined) this.parentId = options.parentId;\n if (options.active !== undefined) this.active = options.active;\n if (options.metadata !== undefined) this.metadata = options.metadata;\n }\n\n /**\n * Check if this is a top-level account (no parent)\n */\n isTopLevel(): boolean {\n return this.parentId === null;\n }\n\n /**\n * Check if this is a debit-normal account (Asset, Expense)\n * Debit-normal accounts increase with debits\n */\n isDebitNormal(): boolean {\n return this.type === 'asset' || this.type === 'expense';\n }\n\n /**\n * Check if this is a credit-normal account (Liability, Equity, Revenue)\n * Credit-normal accounts increase with credits\n */\n isCreditNormal(): boolean {\n return (\n this.type === 'liability' ||\n this.type === 'equity' ||\n this.type === 'revenue'\n );\n }\n\n // Hierarchy traversal (getParent / getChildren / getAncestors /\n // getDescendants / getHierarchy / moveTo) provided by SmrtHierarchical.\n // Account-specific helpers (getFullPath / getBalance / createChild /\n // toTreeNode) remain below.\n\n /**\n * Get full account path (e.g., \"Assets > Current > Cash\")\n */\n async getFullPath(): Promise<string> {\n const ancestors = await this.getAncestors();\n const names = [...ancestors.map((a) => a.name), this.name];\n return names.join(' > ');\n }\n\n /**\n * Build tree node for this account and its children\n */\n async toTreeNode(): Promise<AccountTreeNode> {\n const children = await this.getChildren();\n const childNodes = await Promise.all(children.map((c) => c.toTreeNode()));\n return {\n account: this,\n children: childNodes,\n };\n }\n\n /**\n * Get the current balance of this account\n */\n async getBalance(asOfDate?: Date): Promise<number> {\n if (!this.id) return 0;\n const { JournalEntryCollection } = await import(\n '../collections/JournalEntries'\n );\n const collection = await JournalEntryCollection.create(this.options);\n return await collection.getAccountBalance(this.id, asOfDate);\n }\n\n /**\n * Create a sub-account under this account\n */\n async createChild(\n options: Omit<AccountOptions, 'parentId' | 'type'>,\n ): Promise<Account> {\n if (!this.id) {\n throw new Error('Account must be saved before creating children');\n }\n const { AccountCollection } = await import('../collections/Accounts');\n const collection = await AccountCollection.create(this.options);\n const account = await collection.create({\n ...options,\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