{"_id":"@azure/ai-discovery","name":"@azure/ai-discovery","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@azure/ai-discovery","version":"1.0.0","description":"Azure AI Discovery client library for JavaScript, providing WorkspaceClient and BookshelfClient.","engines":{"node":">=22.0.0"},"sideEffects":false,"autoPublish":false,"type":"module","main":"./dist/commonjs/index.js","module":"./dist/esm/index.js","types":"./dist/commonjs/index.d.ts","browser":"./dist/browser/index.js","imports":{"#platform/*":{"browser":"./src/*-browser.mts","default":"./src/*.ts"}},"exports":{"./package.json":"./package.json",".":{"browser":{"types":"./dist/browser/index.d.ts","default":"./dist/browser/index.js"},"import":{"types":"./dist/esm/index.d.ts","default":"./dist/esm/index.js"},"require":{"types":"./dist/commonjs/index.d.ts","default":"./dist/commonjs/index.js"}},"./workspace":{"browser":{"types":"./dist/browser/workspace/index.d.ts","default":"./dist/browser/workspace/index.js"},"import":{"types":"./dist/esm/workspace/index.d.ts","default":"./dist/esm/workspace/index.js"},"require":{"types":"./dist/commonjs/workspace/index.d.ts","default":"./dist/commonjs/workspace/index.js"}},"./workspace/api":{"browser":{"types":"./dist/browser/workspace/api/index.d.ts","default":"./dist/browser/workspace/api/index.js"},"import":{"types":"./dist/esm/workspace/api/index.d.ts","default":"./dist/esm/workspace/api/index.js"},"require":{"types":"./dist/commonjs/workspace/api/index.d.ts","default":"./dist/commonjs/workspace/api/index.js"}},"./bookshelf":{"browser":{"types":"./dist/browser/bookshelf/index.d.ts","default":"./dist/browser/bookshelf/index.js"},"import":{"types":"./dist/esm/bookshelf/index.d.ts","default":"./dist/esm/bookshelf/index.js"},"require":{"types":"./dist/commonjs/bookshelf/index.d.ts","default":"./dist/commonjs/bookshelf/index.js"}},"./bookshelf/api":{"browser":{"types":"./dist/browser/bookshelf/api/index.d.ts","default":"./dist/browser/bookshelf/api/index.js"},"import":{"types":"./dist/esm/bookshelf/api/index.d.ts","default":"./dist/esm/bookshelf/api/index.js"},"require":{"types":"./dist/commonjs/bookshelf/api/index.d.ts","default":"./dist/commonjs/bookshelf/api/index.js"}},"./models":{"browser":{"types":"./dist/browser/models/index.d.ts","default":"./dist/browser/models/index.js"},"import":{"types":"./dist/esm/models/index.d.ts","default":"./dist/esm/models/index.js"},"require":{"types":"./dist/commonjs/models/index.d.ts","default":"./dist/commonjs/models/index.js"}},"./models/microsoft/discovery/bookshelf":{"browser":{"types":"./dist/browser/models/microsoft/discovery/bookshelf/index.d.ts","default":"./dist/browser/models/microsoft/discovery/bookshelf/index.js"},"import":{"types":"./dist/esm/models/microsoft/discovery/bookshelf/index.d.ts","default":"./dist/esm/models/microsoft/discovery/bookshelf/index.js"},"require":{"types":"./dist/commonjs/models/microsoft/discovery/bookshelf/index.d.ts","default":"./dist/commonjs/models/microsoft/discovery/bookshelf/index.js"}},"./models/microsoft/discovery/common":{"browser":{"types":"./dist/browser/models/microsoft/discovery/common/index.d.ts","default":"./dist/browser/models/microsoft/discovery/common/index.js"},"import":{"types":"./dist/esm/models/microsoft/discovery/common/index.d.ts","default":"./dist/esm/models/microsoft/discovery/common/index.js"},"require":{"types":"./dist/commonjs/models/microsoft/discovery/common/index.d.ts","default":"./dist/commonjs/models/microsoft/discovery/common/index.js"}},"./models/microsoft/discovery/workspace":{"browser":{"types":"./dist/browser/models/microsoft/discovery/workspace/index.d.ts","default":"./dist/browser/models/microsoft/discovery/workspace/index.js"},"import":{"types":"./dist/esm/models/microsoft/discovery/workspace/index.d.ts","default":"./dist/esm/models/microsoft/discovery/workspace/index.js"},"require":{"types":"./dist/commonjs/models/microsoft/discovery/workspace/index.d.ts","default":"./dist/commonjs/models/microsoft/discovery/workspace/index.js"}}},"keywords":["node","azure","cloud","typescript","browser","isomorphic"],"author":{"name":"Microsoft Corporation"},"license":"MIT","sdk-type":"client","repository":{"type":"git","url":"git+https://github.com/Azure/azure-sdk-for-js.git","directory":"sdk/discovery/ai-discovery"},"bugs":{"url":"https://github.com/Azure/azure-sdk-for-js/issues"},"homepage":"https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/discovery/ai-discovery/README.md","prettier":"@azure/eslint-plugin-azure-sdk/prettier.json","//metadata":{"constantPaths":[{"path":"src/workspace/api/workspaceContext.ts","prefix":"userAgentInfo"},{"path":"src/bookshelf/api/bookshelfContext.ts","prefix":"userAgentInfo"}]},"dependencies":{"@azure/core-util":"^1.12.0","@azure-rest/core-client":"^2.3.1","@azure/abort-controller":"^2.1.2","@azure/core-auth":"^1.9.0","@azure/core-lro":"^3.1.0","@azure/core-rest-pipeline":"^1.20.0","@azure/logger":"^1.2.0","tslib":"^2.8.1"},"devDependencies":{"@azure/identity":"4.13.0","@types/node":"^22.0.0","cross-env":"^10.1.0","eslint":"^10.8.0","prettier":"^3.9.1","rimraf":"^6.1.0","@vitest/browser-playwright":"^4.1.2","@vitest/coverage-istanbul":"^4.1.2","dotenv":"^16.6.1","playwright":"^1.60.0","typescript":"~6.0.2","vitest":"^4.1.2","@azure-tools/test-credential":"^2.1.2","@azure-tools/test-recorder":"^4.1.1","@azure/dev-tool":"^1.0.0","@azure/eslint-plugin-azure-sdk":"^3.0.0","@azure-tools/test-utils-vitest":"^2.0.1"},"//sampleConfiguration":{"productName":"Microsoft Discovery","productSlugs":["azure"],"disableDocsMs":true,"apiRefLink":"https://learn.microsoft.com/javascript/api/@azure/ai-discovery"},"scripts":{"clean":"rimraf --glob dist dist-browser dist-esm test-dist temp types *.tgz *.log","extract-api":"rimraf review && dev-tool run extract-api","pack":"pnpm pack 2>&1","lint":"eslint package.json src test","lint:fix":"eslint package.json src test --fix --fix-type [problem,suggestion]","build:samples":"tsc -p tsconfig.samples.json","check-format":"prettier --list-different --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ","execute:samples":"echo skipped","format":"prettier --write --config ../../../.prettierrc.json --ignore-path ../../../.prettierignore \"src/**/*.{ts,cts,mts}\" \"test/**/*.{ts,cts,mts}\" \"*.{js,cjs,mjs,json}\" ","generate:client":"echo skipped","test:browser":"echo skipped","build":"npm run clean && dev-tool run build-package && dev-tool run extract-api","test:node":"dev-tool run test:vitest","test":"tsc -b --noEmit && npm run test:node && npm run test:browser","update-snippets":"dev-tool run update-snippets"},"_id":"@azure/ai-discovery@1.0.0","_integrity":"sha512-0g1yp6ZU3QqH5J2ycGocC+GhfnFjW7s8tpN2w0S5dwE6oRA5v3lZdSSppy62UdbQK8ss/jkmS9xBjArfpdU0iA==","_resolved":"M:\\SvcFab\\_App\\MS.Ess.PackageManager.Publisher_App1\\temp\\929cf02f-07d1-439f-a57f-f4ce66f44c89\\azure-ai-discovery-1.0.0.tgz","_from":"file:M:\\SvcFab\\_App\\MS.Ess.PackageManager.Publisher_App1\\temp\\929cf02f-07d1-439f-a57f-f4ce66f44c89\\azure-ai-discovery-1.0.0.tgz","tag":"latest","_nodeVersion":"18.5.0","dist":{"integrity":"sha512-0g1yp6ZU3QqH5J2ycGocC+GhfnFjW7s8tpN2w0S5dwE6oRA5v3lZdSSppy62UdbQK8ss/jkmS9xBjArfpdU0iA==","shasum":"9489df58aaaa70a3211fe5af8b3c988df5d73204","tarball":"https://registry.npmjs.org/@azure/ai-discovery/-/ai-discovery-1.0.0.tgz","fileCount":413,"unpackedSize":1750111,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFYihAeuCSWg9qc0jdfUPJk8aST1YKj+gi8fK5BdbpzzAiEAwJ5OcvYmUOUMufYgL2YBfwZtzx/h/BcxOw8hdq8EqTM="}]},"_npmUser":{"name":"microsoft1es","email":"npmjs@microsoft.com"},"directories":{},"maintainers":[{"name":"azure-sdk","email":"azure-sdk-npmjs@microsoft.com"},{"name":"microsoft1es","email":"npmjs@microsoft.com"},{"name":"microsoft-oss-releases","email":"microsoft-oss-publishing@microsoft.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai-discovery_1.0.0_1785889285605_0.555615761506427"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-05T00:21:25.451Z","1.0.0":"2026-08-05T00:21:25.746Z","modified":"2026-08-05T00:21:26.064Z"},"maintainers":[{"name":"azure-sdk","email":"azure-sdk-npmjs@microsoft.com"},{"name":"microsoft1es","email":"npmjs@microsoft.com"},{"name":"microsoft-oss-releases","email":"microsoft-oss-publishing@microsoft.com"}],"description":"Azure AI Discovery client library for JavaScript, providing WorkspaceClient and BookshelfClient.","homepage":"https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/discovery/ai-discovery/README.md","keywords":["node","azure","cloud","typescript","browser","isomorphic"],"repository":{"type":"git","url":"git+https://github.com/Azure/azure-sdk-for-js.git","directory":"sdk/discovery/ai-discovery"},"author":{"name":"Microsoft Corporation"},"bugs":{"url":"https://github.com/Azure/azure-sdk-for-js/issues"},"license":"MIT","readme":"# Azure AI Discovery client library for JavaScript\n\nThis package contains an isomorphic SDK (runs both in Node.js and in browsers) for the Azure AI Discovery service.\n\nThe library exposes two clients:\n\n- `WorkspaceClient` — work with conversations, investigations, tasks, and tools in a Discovery workspace.\n- `BookshelfClient` — manage and query knowledge bases in a Discovery bookshelf.\n\nEach client targets its own service endpoint.\n\nKey links:\n\n- [Source code](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/discovery/ai-discovery)\n- [Package (NPM)](https://www.npmjs.com/package/@azure/ai-discovery)\n- [API reference documentation](https://learn.microsoft.com/javascript/api/@azure/ai-discovery)\n\n## Getting started\n\n### Currently supported environments\n\n- [LTS versions of Node.js](https://github.com/nodejs/release#release-schedule)\n- Latest versions of Safari, Chrome, Edge and Firefox.\n\nSee our [support policy](https://github.com/Azure/azure-sdk-for-js/blob/main/SUPPORT.md) for more details.\n\n### Prerequisites\n\n- An [Azure subscription][azure_sub].\n\n### Install the `@azure/ai-discovery` package\n\nInstall the Discovery client library for JavaScript with `npm`:\n\n```bash\nnpm install @azure/ai-discovery\n```\n\n### Create and authenticate the clients\n\nTo create a client object, you will need the service `endpoint` and a `credential`. The Azure AI Discovery clients use Microsoft Entra credentials to authenticate. `WorkspaceClient` and `BookshelfClient` each target their own endpoint, so create the client(s) you need with the corresponding endpoint. You can find the endpoints for your Discovery resources in the [Azure Portal][azure_portal].\n\nYou can authenticate with Microsoft Entra ID using a credential from the [@azure/identity][azure_identity] library or [an existing Microsoft Entra token](https://github.com/Azure/azure-sdk-for-js/blob/main/sdk/identity/identity/samples/AzureIdentityExamples.md#authenticating-with-a-pre-fetched-access-token).\n\nTo use the [DefaultAzureCredential][defaultazurecredential] provider shown below, or other credential providers provided with the Azure SDK, please install the `@azure/identity` package:\n\n```bash\nnpm install @azure/identity\n```\n\nYou will also need to **register a new Microsoft Entra application and grant access to Azure AI Discovery** by assigning a suitable role to your service principal (note: roles such as `\"Owner\"` will not grant the necessary permissions).\n\nFor more information about how to create a Microsoft Entra application check out [this guide](https://learn.microsoft.com/entra/identity-platform/howto-create-service-principal-portal).\n\nUsing Node.js and Node-like environments, you can use the `DefaultAzureCredential` class to authenticate the clients.\n\n```ts snippet:ReadmeSampleCreateClients_Node\nimport { DefaultAzureCredential } from \"@azure/identity\";\nimport { WorkspaceClient, BookshelfClient } from \"@azure/ai-discovery\";\n\nconst credential = new DefaultAzureCredential();\n// WorkspaceClient exposes conversations, investigations, tasks, and tools.\nconst workspaceClient = new WorkspaceClient(\"<workspace-endpoint>\", credential);\n// BookshelfClient exposes knowledge bases.\nconst bookshelfClient = new BookshelfClient(\"<bookshelf-endpoint>\", credential);\n```\n\nFor browser environments, use the `InteractiveBrowserCredential` from the `@azure/identity` package to authenticate.\n\n```ts snippet:ReadmeSampleCreateClients_Browser\nimport { InteractiveBrowserCredential } from \"@azure/identity\";\nimport { WorkspaceClient, BookshelfClient } from \"@azure/ai-discovery\";\n\nconst credential = new InteractiveBrowserCredential({\n  tenantId: \"<YOUR_TENANT_ID>\",\n  clientId: \"<YOUR_CLIENT_ID>\",\n});\nconst workspaceClient = new WorkspaceClient(\"<workspace-endpoint>\", credential);\nconst bookshelfClient = new BookshelfClient(\"<bookshelf-endpoint>\", credential);\n```\n\n\n### JavaScript Bundle\nTo use this client library in the browser, first you need to use a bundler. For details on how to do this, please refer to our [bundling documentation](https://aka.ms/AzureSDKBundling).\n\n## Key concepts\n\n### WorkspaceClient\n\n`WorkspaceClient` provides access to Discovery workspace features: conversations, investigations, tasks, and tools. Explore the methods on this client to work with resources in a Discovery workspace.\n\n### BookshelfClient\n\n`BookshelfClient` provides access to Discovery bookshelf features: managing and querying knowledge bases. Explore the methods on this client to work with knowledge bases in a Discovery bookshelf.\n\n## Examples\n\n### List knowledge bases\n\nList the knowledge bases in a Discovery Bookshelf resource with `BookshelfClient`.\n\n```ts snippet:ReadmeSampleListKnowledgeBases\nimport { BookshelfClient } from \"@azure/ai-discovery\";\nimport { DefaultAzureCredential } from \"@azure/identity\";\n\nconst client = new BookshelfClient(\"<bookshelf-endpoint>\", new DefaultAzureCredential());\nfor await (const knowledgeBase of client.knowledgeBases.list()) {\n  console.log(knowledgeBase.name);\n}\n```\n\n### List tasks in an investigation\n\nList the tasks that belong to an investigation with `WorkspaceClient`.\n\n```ts snippet:ReadmeSampleListTasks\nimport { WorkspaceClient } from \"@azure/ai-discovery\";\nimport { DefaultAzureCredential } from \"@azure/identity\";\n\nconst client = new WorkspaceClient(\"<workspace-endpoint>\", new DefaultAzureCredential());\nfor await (const task of client.tasks.list(\"<project-name>\", \"<investigation-name>\")) {\n  console.log(task.name);\n}\n```\n\n## Troubleshooting\n\n### Logging\n\nEnabling logging may help uncover useful information about failures. In order to see a log of HTTP requests and responses, set the `AZURE_LOG_LEVEL` environment variable to `info`. Alternatively, logging can be enabled at runtime by calling `setLogLevel` in the `@azure/logger`:\n\n```ts snippet:SetLogLevel\nimport { setLogLevel } from \"@azure/logger\";\n\nsetLogLevel(\"info\");\n```\n\nFor more detailed instructions on how to enable logs, you can look at the [@azure/logger package docs](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/core/logger).\n\n\n## Next steps\n\nHave a look at the [package samples](https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/discovery/ai-discovery/samples) folder, containing fully runnable code.\n\n## Contributing\n\nIf you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/blob/main/CONTRIBUTING.md) to learn more about how to build and test the code.\n\n## Related projects\n\n- [Microsoft Azure SDK for JavaScript](https://github.com/Azure/azure-sdk-for-js)\n\n[azure_sub]: https://azure.microsoft.com/free/\n[azure_portal]: https://portal.azure.com\n[azure_identity]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity\n[defaultazurecredential]: https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/identity/identity#defaultazurecredential\n","readmeFilename":"README.md","_rev":"1-81c729e1ea8f5422c6a0f6d7244eb66a"}