{"_id":"@affordance/pg","_rev":"4-18dfbdd023831fa4166779e0a40002d0","name":"@affordance/pg","dist-tags":{"latest":"0.5.0"},"versions":{"0.2.0":{"name":"@affordance/pg","version":"0.2.0","keywords":["affordance","case-management","typescript","postgres"],"author":{"url":"https://mochicode.com","name":"Mochicode LLC"},"license":"MIT","_id":"@affordance/pg@0.2.0","maintainers":[{"name":"affordance","email":"jin@mochicode.com"}],"homepage":"https://github.com/mochicodecom/affordance#readme","bugs":{"url":"https://github.com/mochicodecom/affordance/issues"},"dist":{"shasum":"751d90e0f801e965dc321b1c652c1fab2cd587d3","tarball":"https://registry.npmjs.org/@affordance/pg/-/pg-0.2.0.tgz","fileCount":45,"integrity":"sha512-GqDN44iBxkyo8n1Kc53IJXuHLXlmwTITLg6/nzGtqmf2PsL/fPK3hafk3yd7fOvK0TWdp3oRT8l0Db3BbIaSJg==","signatures":[{"sig":"MEYCIQCadA5ODJ8EAdSDhmXx48AZiKM1dh0ttYiqQadJoqTczAIhAP/56/CEMMyLBqvUhLFlEYYk0OhjsXMkZ0WLVC3np1f5","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":139773},"main":"./dist/index.js","type":"module","_from":"file:dist/npm/affordance-pg-0.2.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.12"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"node ../../scripts/build-package.mjs","typecheck":"tsc --noEmit"},"_npmUser":{"name":"affordance","email":"jin@mochicode.com"},"_resolved":"/Users/jwshin/mochicode/affordance/dist/npm/affordance-pg-0.2.0.tgz","_integrity":"sha512-GqDN44iBxkyo8n1Kc53IJXuHLXlmwTITLg6/nzGtqmf2PsL/fPK3hafk3yd7fOvK0TWdp3oRT8l0Db3BbIaSJg==","repository":{"url":"git+https://github.com/mochicodecom/affordance.git","type":"git","directory":"packages/pg"},"_npmVersion":"11.19.0","description":"Postgres storage and transactional execution for Affordance.","directories":{},"_nodeVersion":"26.8.1","dependencies":{"@types/pg":"^8.11.10","@affordance/core":"0.2.0","@standard-schema/spec":"^1.1.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.13.1","zod":"^4.4.3","vitest":"^3.2.0","typescript":"^5.7.2","@types/node":"^24.0.0","@affordance/testkit":"0.0.0"},"_npmOperationalInternal":{"tmp":"tmp/pg_0.2.0_1788927229902_0.7608634722815812","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@affordance/pg","version":"0.3.0","keywords":["affordance","case-management","typescript","postgres"],"author":{"url":"https://mochicode.com","name":"Mochicode LLC"},"license":"MIT","_id":"@affordance/pg@0.3.0","maintainers":[{"name":"affordance","email":"jin@mochicode.com"}],"homepage":"https://github.com/mochicodecom/affordance#readme","bugs":{"url":"https://github.com/mochicodecom/affordance/issues"},"dist":{"shasum":"548213b443b0c4c3edd974610a38a50410358df1","tarball":"https://registry.npmjs.org/@affordance/pg/-/pg-0.3.0.tgz","fileCount":45,"integrity":"sha512-bMqwVU69a6nQPlGTnh4gMBI4rHGH71gCq/Rya87dCaNQzaf8asB5btmNgvsvoBrlQEHfNfc3u8yFXjhyhIqC5g==","signatures":[{"sig":"MEQCIHwSoqJKesjS6Zd8SorIPiC7fQBK/us/XcJVVV95SibqAiA7exxwf/0mRmPje/6xj7IsWvpw5oqqVrJrEC7PsbEYQw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":142761},"main":"./dist/index.js","type":"module","_from":"file:dist/npm/affordance-pg-0.3.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.12"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"node ../../scripts/build-package.mjs","typecheck":"tsc --noEmit"},"_npmUser":{"name":"affordance","email":"jin@mochicode.com"},"_resolved":"/Users/jwshin/mochicode/affordance/dist/npm/affordance-pg-0.3.0.tgz","_integrity":"sha512-bMqwVU69a6nQPlGTnh4gMBI4rHGH71gCq/Rya87dCaNQzaf8asB5btmNgvsvoBrlQEHfNfc3u8yFXjhyhIqC5g==","repository":{"url":"git+https://github.com/mochicodecom/affordance.git","type":"git","directory":"packages/pg"},"_npmVersion":"11.19.0","description":"Postgres storage and transactional execution for Affordance.","directories":{},"_nodeVersion":"26.8.1","dependencies":{"@types/pg":"^8.11.10","@affordance/core":"0.3.0","@standard-schema/spec":"^1.1.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.13.1","zod":"^4.4.3","vitest":"^3.2.0","typescript":"^5.7.2","@types/node":"^24.0.0","@affordance/testkit":"0.0.0"},"_npmOperationalInternal":{"tmp":"tmp/pg_0.3.0_1789175022215_0.3285902571115018","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@affordance/pg","version":"0.4.0","keywords":["affordance","case-management","typescript","postgres"],"author":{"url":"https://mochicode.com","name":"Mochicode LLC"},"license":"MIT","_id":"@affordance/pg@0.4.0","maintainers":[{"name":"affordance","email":"jin@mochicode.com"}],"homepage":"https://github.com/mochicodecom/affordance#readme","bugs":{"url":"https://github.com/mochicodecom/affordance/issues"},"dist":{"shasum":"3df68b8dcfffddcb6e8ba069fb8cd22931509ebb","tarball":"https://registry.npmjs.org/@affordance/pg/-/pg-0.4.0.tgz","fileCount":39,"integrity":"sha512-t7izH83+iaWndPcyvYpZQvSxt9WEpwvyZtjNWB2jQX8cQX89cTO527ZiBKj6zDZ7UjIJJK68LCWADgxAhdU2/w==","signatures":[{"sig":"MEUCICxwGDrrMbjShum24Sft/I5Ew+VAuVnOL1XFyRdsmHpIAiEAwtCyrFMZ6hLjZNzct0o6H+aHyv6fBDciG7WAlxA2D9E=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@affordance%2fpg@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":111401},"main":"./dist/index.js","type":"module","_from":"file:/home/runner/work/affordance/affordance/dist/npm/affordance-pg-0.4.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.12"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"test":"vitest run","build":"node ../../scripts/build-package.mjs","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:3dfe8baa-3a95-4480-ae07-b0f69b838dfd"}},"_resolved":"/home/runner/work/affordance/affordance/dist/npm/affordance-pg-0.4.0.tgz","_integrity":"sha512-t7izH83+iaWndPcyvYpZQvSxt9WEpwvyZtjNWB2jQX8cQX89cTO527ZiBKj6zDZ7UjIJJK68LCWADgxAhdU2/w==","repository":{"url":"git+https://github.com/mochicodecom/affordance.git","type":"git","directory":"packages/pg"},"_npmVersion":"11.19.1","description":"Postgres storage and transactional execution for Affordance.","directories":{},"_nodeVersion":"24.20.0","dependencies":{"@types/pg":"^8.11.10","@affordance/core":"0.4.0","@standard-schema/spec":"^1.1.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.13.1","zod":"^4.4.3","vitest":"^3.2.0","typescript":"^5.7.2","@types/node":"^24.0.0","@affordance/testkit":"0.0.0"},"_npmOperationalInternal":{"tmp":"tmp/pg_0.4.0_1789337856069_0.457059305526869","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@affordance/pg","version":"0.5.0","author":{"name":"Mochicode LLC","url":"https://mochicode.com"},"license":"MIT","type":"module","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"dependencies":{"@standard-schema/spec":"^1.1.0","@types/pg":"^8.11.10","@affordance/core":"0.5.0"},"devDependencies":{"@types/node":"^24.0.0","typescript":"^5.7.2","vitest":"^3.2.0","pg":"^8.13.1","zod":"^4.4.3","@affordance/testkit":"0.0.0"},"description":"Postgres storage and transactional execution for Affordance.","main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=22.12"},"repository":{"type":"git","url":"git+https://github.com/mochicodecom/affordance.git","directory":"packages/pg"},"homepage":"https://github.com/mochicodecom/affordance#readme","bugs":{"url":"https://github.com/mochicodecom/affordance/issues"},"keywords":["affordance","case-management","typescript","postgres"],"publishConfig":{"access":"public","registry":"https://registry.npmjs.org"},"scripts":{"typecheck":"tsc --noEmit","test":"vitest run","build":"node ../../scripts/build-package.mjs"},"_id":"@affordance/pg@0.5.0","_integrity":"sha512-cIx1nXn5q5y2dOqoFYyEH5oqsOXbXVbnOad5wmCukKR/1m7w4ajcv94uteMzPRRyrPEaBciOZNjCJrvb+RE9ow==","_resolved":"/home/runner/work/affordance/affordance/dist/npm/affordance-pg-0.5.0.tgz","_from":"file:/home/runner/work/affordance/affordance/dist/npm/affordance-pg-0.5.0.tgz","_nodeVersion":"24.20.0","_npmVersion":"11.19.1","dist":{"integrity":"sha512-cIx1nXn5q5y2dOqoFYyEH5oqsOXbXVbnOad5wmCukKR/1m7w4ajcv94uteMzPRRyrPEaBciOZNjCJrvb+RE9ow==","shasum":"e107b32484c403dbaf11861c2e8e1a646cc03861","tarball":"https://registry.npmjs.org/@affordance/pg/-/pg-0.5.0.tgz","fileCount":39,"unpackedSize":111401,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@affordance%2fpg@0.5.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC/x4CHkgQrDFK44+Jn7OVN/GOj+6k6o+GMN7GOX4vbIwIgHFvorbPxwAr92ovM8ve9SALq3EZ6VQpdCU+0DXzQk58="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:3dfe8baa-3a95-4480-ae07-b0f69b838dfd"}},"directories":{},"maintainers":[{"name":"affordance","email":"jin@mochicode.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pg_0.5.0_1789620697189_0.8462702800469517"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-09T04:13:49.716Z","modified":"2026-09-17T04:51:37.700Z","0.2.0":"2026-09-09T04:13:50.045Z","0.3.0":"2026-09-12T01:03:42.377Z","0.4.0":"2026-09-13T22:17:36.202Z","0.5.0":"2026-09-17T04:51:37.327Z"},"bugs":{"url":"https://github.com/mochicodecom/affordance/issues"},"author":{"name":"Mochicode LLC","url":"https://mochicode.com"},"license":"MIT","homepage":"https://github.com/mochicodecom/affordance#readme","keywords":["affordance","case-management","typescript","postgres"],"repository":{"type":"git","url":"git+https://github.com/mochicodecom/affordance.git","directory":"packages/pg"},"description":"Postgres storage and transactional execution for Affordance.","maintainers":[{"name":"affordance","email":"jin@mochicode.com"}],"readme":"# @affordance/pg\n\nPostgres implementation of Affordance's domain storage and atomic execution\ninterfaces. The application owns business tables; this package stores case\nreferences, metadata, journal evidence, correlations, and delivery bookkeeping.\n\n```ts\nimport { createEngine } from '@affordance/core'\nimport { bootstrap, createPgStorage } from '@affordance/pg'\n\nawait bootstrap(pool)\nconst storage = createPgStorage({ db: { pool } })\nconst bound = storage.bindCase(purchase, {\n  load: (q, id) => purchases(q).loadCaseState(id),\n  protect: (tx, id) => purchases(tx).lock(id),\n  repositories: (tx, id) => purchaseRepositories(tx, id),\n})\nconst engine = createEngine({ storage, caseTypes: [bound] })\nconst current = await engine.attachCase('house-purchase', { reference: purchaseId })\n```\n\n`bindCase` checks repository types against the definition. Its loader runs inside\na consistent read transaction or the active execution transaction. Every domain\nwriter must follow the same protection rule, including writes to related rows.\nCase executions serialize across scope keys and commit all writes and evidence\natomically. Network work belongs outside handlers.\n\nThe app owns connection lifetime. Supply `{ pool }` or a dedicated `{ client }`.\n`withTransaction` binds application writes to one connection and rejects use of\nthe transaction after its callback. To create and attach together, call\n`storage.attachCase(tx, bound, reference)` inside that callback.\n\nA lost commit acknowledgment raises `ExecutionIndeterminateError` during execution.\n`storage.reconcileExecution(caseId, executionId)` fences against an unfinished\noperation and returns `completed` or `not-committed`; database outages still throw.\nApplication-owned `withTransaction` calls expose `CommitOutcomeUnknownError`.\n\nSchema bootstrap is explicit and rejects incompatible old framework tables. It\ndoes not reset databases or convert old JSONB cases. `deleteCase` deletes framework\nrecords only; domain data remains owned by the application.\n\nSee [storage adapters](https://github.com/mochicodecom/affordance/blob/main/docs/storage.md)\nfor interfaces, atomicity, journal serialization, and domain evolution.\n","readmeFilename":"README.md"}