{"_id":"@amag-ch/cds-objectstore","_rev":"6-50f6ddbf5f26e6044bb0ac98bfe46977","name":"@amag-ch/cds-objectstore","dist-tags":{"latest":"2.8.1"},"versions":{"2.5.0":{"name":"@amag-ch/cds-objectstore","version":"2.5.0","author":{"name":"AMAG Corporate Services AG"},"license":"MIT","_id":"@amag-ch/cds-objectstore@2.5.0","maintainers":[{"name":"thju-amag-ch","email":"thomas.jurk@amag.ch"},{"name":"integration-amag-ch","email":"integration@amag.ch"}],"homepage":"https://gitlab.com/amag_web/sap/cap/common/cds-objectstore#readme","bugs":{"url":"https://gitlab.com/amag_web/sap/cap/common/cds-objectstore/issues"},"cds":{"requires":{"objectstore":{"impl":"@amag-ch/cds-objectstore","kind":"local-objectstore","[production]":{"kind":"objectstore"}}}},"dist":{"shasum":"4d6ddf4786585149157b8fff2adbaa69fa2c0857","tarball":"https://registry.npmjs.org/@amag-ch/cds-objectstore/-/cds-objectstore-2.5.0.tgz","fileCount":17,"integrity":"sha512-GOpjAHcHlQrmGK0jW3pwQ83HF9fuXvanF6NxCmZR5OrhIuSpilsq7tyAqD9N49XiqBWKR0rxiG0bJQZlcdmORQ==","signatures":[{"sig":"MEUCIQD27d59zwPCGP/IGWHB6L06G13aPjEjl7qXl5D7Px0L3AIgN+n2ccHv3dnjp6sg2U7Q6pjPS++hW1m++J0AGtrowos=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29762},"main":"index.js","gitHead":"16a8e5f24fb5aa56ca377c47473d415a345a00a7","private":false,"_npmUser":{"name":"integration-amag-ch","email":"integration@amag.ch"},"repository":{"url":"git+https://gitlab.com/amag_web/sap/cap/common/cds-objectstore.git","type":"git"},"_npmVersion":"10.9.2","description":"NodeJS library to communicate with an objectstore","directories":{},"_nodeVersion":"22.14.0","dependencies":{"@amag-ch/cds-jobs":">=3","@aws-sdk/client-s3":"^3","@cap-js/db-service":"^1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@sap/cds":">=7"},"peerDependencies":{"@sap/cds":">=7"},"_npmOperationalInternal":{"tmp":"tmp/cds-objectstore_2.5.0_1742833592194_0.8413942099096514","host":"s3://npm-registry-packages-npm-production"}},"2.6.0":{"name":"@amag-ch/cds-objectstore","version":"2.6.0","author":{"name":"AMAG Corporate Services AG"},"license":"MIT","_id":"@amag-ch/cds-objectstore@2.6.0","maintainers":[{"name":"thju-amag-ch","email":"thomas.jurk@amag.ch"},{"name":"integration-amag-ch","email":"integration@amag.ch"}],"homepage":"https://gitlab.com/amag_web/sap/cap/common/cds-objectstore#readme","bugs":{"url":"https://gitlab.com/amag_web/sap/cap/common/cds-objectstore/issues"},"cds":{"requires":{"objectstore":{"impl":"@amag-ch/cds-objectstore","kind":"local-objectstore","[production]":{"kind":"objectstore"}}}},"dist":{"shasum":"71fe06750cfea21119fcb6cc242491fb991dd4f9","tarball":"https://registry.npmjs.org/@amag-ch/cds-objectstore/-/cds-objectstore-2.6.0.tgz","fileCount":17,"integrity":"sha512-CTH8YK/a+JtGQaDGV1jOd1BOcIWhMSMobfvbFA3n8vxnm9gUzmXKs2ANv+lLPFb9uvnv+UVdDfE8AZHRzajwcA==","signatures":[{"sig":"MEUCIEdriMMcA6Evv/ngFnWbT8RHD9GHhkD5Phf1Sv+rtYHsAiEAqttojS90bLWF6YIDRGe74wXF7RypYMot7kawQcVVj5Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29768},"main":"index.js","gitHead":"020d5fcbed33447491c4cd12bbbac5113b7a4c58","private":false,"_npmUser":{"name":"integration-amag-ch","email":"integration@amag.ch"},"repository":{"url":"git+https://gitlab.com/amag_web/sap/cap/common/cds-objectstore.git","type":"git"},"_npmVersion":"11.6.2","description":"NodeJS library to communicate with an objectstore","directories":{},"_nodeVersion":"24.11.1","dependencies":{"@amag-ch/cds-jobs":">=3","@aws-sdk/client-s3":"^3","@cap-js/db-service":"^1 || ^2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@sap/cds":">=7"},"peerDependencies":{"@sap/cds":">=7"},"_npmOperationalInternal":{"tmp":"tmp/cds-objectstore_2.6.0_1764948651070_0.27232365185224805","host":"s3://npm-registry-packages-npm-production"}},"2.7.0":{"name":"@amag-ch/cds-objectstore","version":"2.7.0","author":{"name":"AMAG Corporate Services AG"},"license":"MIT","_id":"@amag-ch/cds-objectstore@2.7.0","maintainers":[{"name":"thju-amag-ch","email":"thomas.jurk@amag.ch"},{"name":"integration-amag-ch","email":"integration@amag.ch"}],"homepage":"https://gitlab.com/amag_web/sap/common/npm/cds-objectstore#readme","bugs":{"url":"https://gitlab.com/amag_web/sap/common/npm/cds-objectstore/issues"},"cds":{"requires":{"objectstore":{"impl":"@amag-ch/cds-objectstore","kind":"local-objectstore","[production]":{"kind":"objectstore"}}}},"dist":{"shasum":"78e6dbec8273208c0e079517312b56a046c9f250","tarball":"https://registry.npmjs.org/@amag-ch/cds-objectstore/-/cds-objectstore-2.7.0.tgz","fileCount":17,"integrity":"sha512-H/85vDTyW0oVqI/v0vFE8R1OHNIHq347QObtUgVnHz95qj5tXjJ3SmQjAJ/peKFLYX1nuuWT7RivInTelWSL3A==","signatures":[{"sig":"MEUCIFYL7zLVC9bsDCnRgov3yP9EyfPZ5cX52/GMNMaplnsGAiEA7VGvx1MzAdRVLE/tw5OUY9pRFaeFOcOgHZ2ELs9DGRo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":29796},"main":"index.js","type":"commonjs","gitHead":"6134737f76fba27e49e22e03a21ebc4171a9b63a","private":false,"_npmUser":{"name":"GitLab CI/CD","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"gitlab","oidcConfigId":"oidc:555a7af8-fd33-4041-81c5-04245000d2e4"}},"repository":{"url":"git+https://gitlab.com/amag_web/sap/common/npm/cds-objectstore.git","type":"git"},"_npmVersion":"11.6.2","description":"NodeJS library to communicate with an objectstore","directories":{},"_nodeVersion":"24.13.0","dependencies":{"@amag-ch/cds-jobs":">=3","@aws-sdk/client-s3":"^3","@cap-js/db-service":"^1 || ^2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@sap/cds":">=7"},"peerDependencies":{"@sap/cds":">=7"},"_npmOperationalInternal":{"tmp":"tmp/cds-objectstore_2.7.0_1769538074901_0.3059492388371339","host":"s3://npm-registry-packages-npm-production"}},"2.8.0":{"name":"@amag-ch/cds-objectstore","version":"2.8.0","author":{"name":"AMAG Corporate Services AG"},"license":"MIT","_id":"@amag-ch/cds-objectstore@2.8.0","maintainers":[{"name":"thju-amag-ch","email":"thomas.jurk@amag.ch"},{"name":"integration-amag-ch","email":"integration@amag.ch"}],"homepage":"https://gitlab.com/amag_web/sap/common/npm/cds-objectstore#readme","bugs":{"url":"https://gitlab.com/amag_web/sap/common/npm/cds-objectstore/issues"},"cds":{"requires":{"objectstore":{"impl":"@amag-ch/cds-objectstore","kind":"local-objectstore","[production]":{"kind":"objectstore"}}}},"dist":{"shasum":"3da4521d2f3d05f737a915bbac8967e54b23ae6e","tarball":"https://registry.npmjs.org/@amag-ch/cds-objectstore/-/cds-objectstore-2.8.0.tgz","fileCount":17,"integrity":"sha512-cqvE8YrXoWQ3geUgaiZdLL0mMXUtctw4o9rckIp1QfKZ01hB6n9/qVxl/AyqDkKvSOmEsT4oKg0+0mlz8KzDew==","signatures":[{"sig":"MEYCIQDpmu745EZRdy3Y6dqVQRZ2AIyoIOlRzUDOKEAFlah3fwIhANY0RW/2P3EtsJV1rnemqHgnZX/OnyVv0hfBs1KJPMZi","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":31703},"main":"index.js","type":"commonjs","gitHead":"f21bc5e8e49e9b6a40b89444709d1d40b773e9b1","private":false,"_npmUser":{"name":"GitLab CI/CD","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"gitlab","oidcConfigId":"oidc:555a7af8-fd33-4041-81c5-04245000d2e4"}},"repository":{"url":"git+https://gitlab.com/amag_web/sap/common/npm/cds-objectstore.git","type":"git"},"_npmVersion":"11.9.0","description":"NodeJS library to communicate with an objectstore","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@amag-ch/cds-jobs":">=3","@aws-sdk/client-s3":"^3","@cap-js/db-service":"^1 || ^2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@sap/cds":">=7"},"peerDependencies":{"@sap/cds":">=7"},"_npmOperationalInternal":{"tmp":"tmp/cds-objectstore_2.8.0_1774282681492_0.8602898826299685","host":"s3://npm-registry-packages-npm-production"}},"2.8.1":{"name":"@amag-ch/cds-objectstore","version":"2.8.1","author":{"name":"AMAG Corporate Services AG"},"license":"MIT","_id":"@amag-ch/cds-objectstore@2.8.1","maintainers":[{"name":"thju-amag-ch","email":"thomas.jurk@amag.ch"},{"name":"integration-amag-ch","email":"integration@amag.ch"}],"homepage":"https://gitlab.com/amag_web/sap/common/npm/cds-objectstore#readme","bugs":{"url":"https://gitlab.com/amag_web/sap/common/npm/cds-objectstore/issues"},"cds":{"requires":{"objectstore":{"impl":"@amag-ch/cds-objectstore","kind":"local-objectstore","[production]":{"kind":"objectstore"}}}},"dist":{"shasum":"a7e19e1e1ea523752abe777cec7ea41a19f4a4c5","tarball":"https://registry.npmjs.org/@amag-ch/cds-objectstore/-/cds-objectstore-2.8.1.tgz","fileCount":17,"integrity":"sha512-Wy/ETp2a5/oNRlZybnc/dacuNnSD6UCT2+KukOVL9j59xnmZa+p7nl/8iVheia6ZgYLhAv5FtijEAM6TYCPdnA==","signatures":[{"sig":"MEQCIFJrDiub/bEDw+dtexiqQFs1MVCdzlA4PX7vmhejf9DfAiBFJAfYEKESsSscey8bi+ausWuRPtVNxh0Tmb4cLplK/A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":32188},"main":"index.js","type":"commonjs","gitHead":"674bc9c4ee42d47e8e91814f0ac1d1226a40833f","private":false,"_npmUser":{"name":"GitLab CI/CD","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"gitlab","oidcConfigId":"oidc:555a7af8-fd33-4041-81c5-04245000d2e4"}},"repository":{"url":"git+https://gitlab.com/amag_web/sap/common/npm/cds-objectstore.git","type":"git"},"_npmVersion":"11.9.0","description":"NodeJS library to communicate with an objectstore","directories":{},"_nodeVersion":"24.14.0","dependencies":{"@amag-ch/cds-jobs":">=3","@aws-sdk/client-s3":"^3","@cap-js/db-service":"^1 || ^2"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"@sap/cds":">=7"},"peerDependencies":{"@sap/cds":">=7"},"_npmOperationalInternal":{"tmp":"tmp/cds-objectstore_2.8.1_1774465671959_0.3391319451290653","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2025-03-24T16:26:32.130Z","modified":"2026-06-10T21:30:11.220Z","2.5.0":"2025-03-24T16:26:32.365Z","2.6.0":"2025-12-05T15:30:51.233Z","2.7.0":"2026-01-27T18:21:15.047Z","2.8.0":"2026-03-23T16:18:01.643Z","2.8.1":"2026-03-25T19:07:52.124Z"},"bugs":{"url":"https://gitlab.com/amag_web/sap/common/npm/cds-objectstore/issues"},"author":{"name":"AMAG Corporate Services AG"},"license":"MIT","homepage":"https://gitlab.com/amag_web/sap/common/npm/cds-objectstore#readme","repository":{"url":"git+https://gitlab.com/amag_web/sap/common/npm/cds-objectstore.git","type":"git"},"description":"NodeJS library to communicate with an objectstore","maintainers":[{"email":"integration@amag.ch","name":"integration-amag-ch"}],"readme":"[![npm version](https://img.shields.io/npm/v/@amag-ch/cds-objectstore?style=flat-square)](https://www.npmjs.com/package/@amag-ch/cds-objectstore)\n[![npm downloads](https://img.shields.io/npm/dm/@amag-ch/cds-objectstore.svg?style=flat-square)](https://npm-stat.com/charts.html?package=@amag-ch/cds-objectstore)\n\nNodeJS library to communicate with an objectstore\n\n## Table of Contents\n\n- [Features](#features)\n- [ETag Support](#etag-support)\n- [Installing](#installing)\n- [Configuration](#configuration)\n- [Implementation](#implementation)\n- [License](#license)\n\n## Features\n\n- Fully integrated in CAP as a Service\n- Support S3 objectstore and local objectstore for development testings\n- Autodeletion if corresponding entity entry is been deleted (Entity which uses File)\n- Autohandling streaming, if content is requested\n- Testfiles possible\n- Lazy deletion of objects and only executed, if transaction is successfull\n- Auto configuration with cds plugin feature\n- Automatic ETag from S3 for file integrity validation\n\n## ETag Support\n\nFiles entity includes an `eTag` field for file integrity validation.\n\n### Features:\n- `eTag` field (MD5 hash from S3, nullable for legacy files)\n- S3Client and LocalClient automatically return ETag after upload\n- ETag is stored in database for integrity validation\n\n### Usage:\n```js\n// API unchanged - works exactly as before\nawait objectstore.create(content, { filename: 'test.txt' })\n\n// Now with automatic ETag storage\nconst file = await objectstore.read(ID)\nconsole.log(file.eTag)  // MD5 hash from S3\n```\n\n**Notes:**\n- Existing files will have NULL eTag (handled gracefully)\n- New uploads automatically get MD5 hash from S3 (single-part uploads)\n- No migration required\n\n## Installing\n\nUsing npm:\n\n```bash\n$ npm install @amag-ch/cds-objectstore\n```\n\nUsing yarn:\n\n```bash\n$ yarn add @amag-ch/cds-objectstore\n```\n\n## Configuration\n\n```json\n{\n    \"cds\": {\n        \"requires\": {\n            \"objectstore\": {\n                \"impl\": \"@amag-ch/cds-objectstore\",\n                \"kind\": \"objectstore\"\n            }\n        }\n    }\n}\n```\n\nThe name and kind must be named `objectstore`, otherwise CAP cannot inject the credentials from environment\n\nVariant with local objectstore for development testings\n```json\n{\n    \"cds\": {\n        \"requires\": {\n            \"objectstore\": {\n                \"impl\": \"@amag-ch/cds-objectstore\",\n                \"kind\": \"local-objectstore\",\n                \"[production]\": {\n                    \"kind\": \"objectstore\",\n                }\n            }\n        }\n    }\n}\n```\n\nThe local objectstore is saved in folder `~/.cds-objectstore`\n\n### Standard configuration (cds-plugin)\n```json\n{\n    \"cds\": {\n        \"requires\": {\n            \"objectstore\": {\n                \"impl\": \"@amag-ch/cds-objectstore\",\n                \"kind\": \"local-objectstore\",\n                \"[production]\": {\n                    \"kind\": \"objectstore\"\n                }\n            }\n        }\n    }\n}\n```\n\n## Implementation\n\n### Database Schema\n```cds\nusing {amag.common.objectstore.File as File} from '@amag-ch/cds-objectstore';\n\nentity MyEntity {\n    key ID      : UUID;\n        file    : File\n}\n\n```\nFile is definied as Composition. Means if entry of MyEntity is been deleted, also the connected File would be deleted.\nFile is per default defined as attachment (`@Core.ContentDisposition.Type: 'attachment'`), but could be overwriten with own annotations\n\n### Service for add or read files\n\n```js\nconst objectstore = await cds.connect.to('objectstore')\n\n// Create file - ETag automatically obtained from S3\nconst ID = await objectstore.create('Any File Content', {\n    filename: 'Testfile.txt',\n    contentType: 'text/plain'\n})\n\nconst file = await objectstore.read(ID)\nconsole.log(file.modifiedAt)\nconsole.log(file.eTag)  // MD5 hash from S3\n\nconst stream = await objectstore.readContent(ID)\n```\n\n\n### Testing\n\nCreate a folder (e.g. `test/objectstore`) with all needed files named by ID, which is also used in `test/data/amag.common.objectstore-Files.csv`.\n\nWith `cds-plugin` mode this folder is automatically registered.\n\nOtherwise add file `test/init.js` with following code snippet to register your folder.\n```js\nmodule.exports = async () => {\n    require('@amag-ch/cds-objectstore').testing.register(`${__dirname}/objectstore`)\n}\n```\n\n## License\n\n[MIT](LICENSE)","readmeFilename":"README.md"}