Registry / database / ivy-orm

ivy-orm

JSON →
library0.0.25jsnpmunverified

Ivy ORM is a TypeScript-based ORM for Azure AI Search (formerly Cognitive Search) that provides a schema-driven approach to defining search indexes, indexers, and data sources. It maps AI Search resources to strongly-typed JavaScript objects, enabling type-safe CRUD operations and search queries with built-in validation and auto-completion. Version 0.0.25 is in early alpha with frequent releases; key differentiators include first-class TypeScript support, schema-first design, and seamless integration with the Azure AI Search SDK unlike generic ORMs that lack AI Search-specific abstractions.

npm install ivy-orm
INSTALL
IMPORT
SIG · IVY-ORM
I
ivy-orm
databasejavascriptv0.0.25
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Schema
import { Schema } from 'ivy-orm'
const Schema = require('ivy-orm').Schema
ESM-only; CommonJS require works for named exports but TypeScript prefers import statement.
SearchService
import { SearchService } from 'ivy-orm'
import SearchService from 'ivy-orm'
Named export, not default. ESM since v0.0.1.
defineIndex
import { defineIndex } from 'ivy-orm'
const { defineIndex } = require('ivy-orm')
Both ESM and CJS work, but ESM is recommended for tree-shaking.

Creates an Azure AI Search index, uploads documents, and performs a search using Ivy ORM schema and Azure SDK.

import { Schema, SearchService } from 'ivy-orm'; import { SearchClient } from '@azure/search-documents'; // Define schema const productSchema = new Schema('products', { fields: { id: { type: 'Edm.String', key: true }, name: { type: 'Edm.String', searchable: true }, price: { type: 'Edm.Double', filterable: true }, }, }); // Initialize service (requires AZURE_SEARCH_ENDPOINT and AZURE_SEARCH_KEY env vars) const service = new SearchService({ endpoint: process.env.AZURE_SEARCH_ENDPOINT ?? '', credential: process.env.AZURE_SEARCH_KEY ?? '', }); async function main() { await service.createIndex(productSchema); const client = new SearchClient(service.endpoint, 'products', service.credential); await client.uploadDocuments([ { id: '1', name: 'Laptop', price: 999.99 }, { id: '2', name: 'Mouse', price: 29.99 }, ]); const results = await client.search('laptop'); console.log(results.results); } main().catch(console.error);
Debug
Known issues
breakingSchema constructor changed from positional arguments to options object in v0.0.20
fix
Use new Schema('name', { fields: {...} }) instead of new Schema('name', {...})
affects: <0.0.20
deprecatedSearchService.initialize() is deprecated; use constructor directly
fix
Use new SearchService({ endpoint, credential }) instead of service.initialize()
affects: >=0.0.15 <0.0.25
gotchaFields without 'key: true' must have a corresponding index definition; otherwise search fails
fix
Always define a key field for each index schema
affects: >=0.0.1
gotchaAzure AI Search credentials must be provided with key or token; anonymous access not supported
fix
Set AZURE_SEARCH_ENDPOINT and AZURE_SEARCH_KEY environment variables
affects: >=0.0.1
Errors
Common errors & fixes
TypeError: Class extends value undefined is not a constructor or null
Missing '@azure/search-documents' dependency or incorrect import
fix
Run 'npm install @azure/search-documents' and ensure the import is correct
Error: [azure-search] The request is invalid. Details: The field 'id' has type 'Edm.String' but no key attribute.
Schema missing key field definitions
fix
Add 'key: true' to the primary key field in the schema
TypeError: Cannot read properties of undefined (reading 'endpoint')
Environment variables not set or service not initialized properly
fix
Set AZURE_SEARCH_ENDPOINT and AZURE_SEARCH_KEY, or pass explicitly to SearchService constructor
Upgrade
Version history
0.0.25latest on npm
Audit
Dependencies
@azure/search-documentsrequiredOfficial Azure SDK for AI Search operations
Agent activity
7 hits · last 30 days
node
6
Amazon
1
Resources
ivy-orm — npm install ivy-orm · libregistry