{"_id":"@adobedjangir/abdb","_rev":"2-47244c16a9c86ce2a87ce2e95305ebe1","name":"@adobedjangir/abdb","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.1":{"name":"@adobedjangir/abdb","version":"1.0.1","keywords":["adobe-io","aio","app-builder","abdb","database","aio-lib-db","mongodb"],"author":{"name":"Adobe Inc."},"license":"Apache-2.0","_id":"@adobedjangir/abdb@1.0.1","maintainers":[{"name":"deepakjangid04","email":"djangir@adobe.com"}],"dist":{"shasum":"c61f87cb39bce5356c4899a2f5c4f9af2087232a","tarball":"https://registry.npmjs.org/@adobedjangir/abdb/-/abdb-1.0.1.tgz","fileCount":8,"integrity":"sha512-U/FA7S0oSkVNVBalvSwC9PxAKkZ2SiMg1Q3JbyXwJNtnFlfdmEhmJYIImhi0j7CwNEJxB7VkBdk5cOcS1O47Tw==","signatures":[{"sig":"MEUCIFqp+Va+Dtnj1jNb2ENPhlcUxnNFNBOFRMql3xy+Y2wYAiEAqK2bFLFOY+B3iFsnj5tizcadgv0IXTyxZ0WqSiXJ+jY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30196},"main":"./src/index.js","types":"./src/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./src/index.d.ts","default":"./src/index.js"},"./client":{"types":"./src/client.d.ts","default":"./src/client.js"},"./collection":{"types":"./src/collection.d.ts","default":"./src/collection.js"}},"scripts":{"build":"tsc -p tsconfig.json","prepare":"npm run build"},"_npmUser":{"name":"deepakjangid04","email":"djangir@adobe.com"},"_npmVersion":"11.4.1","description":"Simple utility wrapper for Adobe App Builder Database (ABDB): connect + MongoDB-style CRUD in one import.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"@adobe/aio-lib-db":"^1.0.1","@adobe/aio-lib-ims":"^8.0.0","@adobe/aio-lib-core-auth":"^1.1.0"},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.5.4","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/abdb_1.0.1_1784633159836_0.24561423562121676","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@adobedjangir/abdb","version":"1.0.2","description":"Simple utility wrapper for Adobe App Builder Database (ABDB): connect + MongoDB-style CRUD in one import.","license":"Apache-2.0","author":{"name":"Adobe Inc."},"keywords":["adobe-io","aio","app-builder","abdb","database","aio-lib-db","mongodb"],"main":"./src/index.js","types":"./src/index.d.ts","exports":{".":{"types":"./src/index.d.ts","default":"./src/index.js"},"./client":{"types":"./src/client.d.ts","default":"./src/client.js"},"./collection":{"types":"./src/collection.d.ts","default":"./src/collection.js"}},"scripts":{"build":"tsc -p tsconfig.json","prepare":"npm run build"},"engines":{"node":">=18"},"dependencies":{"@adobe/aio-lib-core-auth":"^1.1.0","@adobe/aio-lib-db":"^1.0.1","@adobe/aio-lib-ims":"^8.0.0"},"devDependencies":{"typescript":"^5.5.4","@types/node":"^20.0.0"},"_id":"@adobedjangir/abdb@1.0.2","gitHead":"82569d443dafd4778669ce69a386091297ec2eaa","_nodeVersion":"24.15.0","_npmVersion":"11.4.1","dist":{"integrity":"sha512-/0IFK57qTumqNnZ/C8INNke+0V9JhSAqNpw4xIOIIOuP0hKvPGsfpHWS71lkpZvn+H7qW+npGUGFMupBUcn0mQ==","shasum":"bca435a261e3cd4fb3a7ed785d2ab20cbba79a3a","tarball":"https://registry.npmjs.org/@adobedjangir/abdb/-/abdb-1.0.2.tgz","fileCount":8,"unpackedSize":30196,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAeRgkiheO61/hulGJH78dxcc80lnbtEeJO1J6UiN4GeAiEA3XNFptzp+98U1E2ra0FIk6lvsxd2i4neMYVOI7XEW+Q="}]},"_npmUser":{"name":"deepakjangid04","email":"djangir@adobe.com"},"directories":{},"maintainers":[{"name":"deepakjangid04","email":"djangir@adobe.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/abdb_1.0.2_1784636267872_0.831340795928998"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-21T11:25:59.675Z","modified":"2026-07-21T12:17:48.222Z","1.0.1":"2026-07-21T11:25:59.983Z","1.0.2":"2026-07-21T12:17:48.017Z"},"author":{"name":"Adobe Inc."},"license":"Apache-2.0","keywords":["adobe-io","aio","app-builder","abdb","database","aio-lib-db","mongodb"],"description":"Simple utility wrapper for Adobe App Builder Database (ABDB): connect + MongoDB-style CRUD in one import.","maintainers":[{"name":"deepakjangid04","email":"djangir@adobe.com"}],"readme":"# @adobedjangir/abdb\n\nA tiny, dependency-light utility wrapper for **Adobe App Builder Database\n(ABDB)**. One import gives you connection handling (with warm-container reuse)\nplus every common MongoDB-style operation as a flat, easy function — no\ncollection-handle juggling.\n\n```bash\nnpm install @adobedjangir/abdb\n```\n\n## Quick start\n\nInside an App Builder runtime action (run with `include-ims-credentials: true`\nso `params` carries the OAuth creds):\n\n```js\nconst abdb = require('@adobedjangir/abdb')\n\nasync function main (params) {\n  // Cached, reused across warm invocations. close() is a safe no-op.\n  const { client } = await abdb.getClient(params)\n\n  await abdb.insertOne(client, 'orders', { _id: 'o1', total: 42 })\n  const one = await abdb.findOneOrNull(client, 'orders', { _id: 'o1' })\n  const all = await abdb.findToArray(client, 'orders', { total: { $gte: 10 } })\n  await abdb.updateOne(client, 'orders', { _id: 'o1' }, { $set: { total: 50 } })\n\n  return { statusCode: 200, body: { one, count: all.length } }\n}\nexports.main = main\n```\n\nOne-shot connection with automatic close:\n\n```js\nconst rows = await abdb.withClient(params, (client) =>\n  abdb.findToArray(client, 'orders', {})\n)\n```\n\n## Connecting\n\n| Function | Use |\n|---|---|\n| `getClient(params, options?)` | **Recommended in actions.** Cached client reused across warm invocations; refreshes after 10 min. `close()` is a no-op. Uses `generateAccessToken(params)`. |\n| `connect(params, options?)` | One fresh connection → `{ db, client, close }`. Call `close()` yourself. Flexible token (see below). |\n| `withClient(params, fn, options?)` | Runs `fn(client)` on a fresh connection and always closes it. |\n| `resetClientCache()` | Force the next `getClient()` to reconnect (call after a connection error). |\n\n**Region** (first non-empty wins): `options.region` → `params.AIO_DB_REGION` →\n`process.env.AIO_DB_REGION`. **Token** for `connect`/`withClient` (in order):\n`options.token` → `params.access_token` → `AIO_DB_IMS_TOKEN` → OAuth\nclient-credentials (`OAUTH_CLIENT_ID`/`OAUTH_CLIENT_SECRET`/`OAUTH_ORG_ID`\n[+`OAUTH_SCOPES`]) → `@adobe/aio-lib-core-auth`.\n\n## Operations\n\nAll take `(client, collectionName, …)`:\n\n- **Write** — `insertOne`, `insertMany`, `updateOne`, `updateMany`, `replaceOne`,\n  `deleteOne`, `deleteMany`, `bulkWrite`, `findOneAndUpdate`,\n  `findOneAndReplace`, `findOneAndDelete`\n- **Read** — `findOne`, `findOneOrNull` (null instead of ABDB's not-found error),\n  `find` (cursor), `findArray`, `findToArray` (cursor auto-closed),\n  `countDocuments`, `estimatedDocumentCount`, `distinct`\n- **Aggregate** — `aggregate` (cursor), `aggregateToArray`\n- **Indexes / admin** — `getIndexes`, `createIndex`, `dropIndex`,\n  `collectionStats`, `dropCollection`, `renameCollection`\n- **Database-level** — `dbStats`, `orgStats`, `listCollections`,\n  `createCollection`, `getCollection` / `getCollectionByName`\n\nSubpath imports are available too: `@adobedjangir/abdb/client` and\n`@adobedjangir/abdb/collection`.\n\n## License\n\nApache-2.0 © Adobe Inc.\n","readmeFilename":"README.md"}