{"id":40769,"library":"crm-orm","title":"crm-orm","description":"Typed Node ORM for CRMs (Salesforce, HubSpot) with Zod schemas, a $‑operator where DSL, and SOQL rendering. Current version 0.0.2 is pre‑1.0; v0.1 focused on typed read queries and Salesforce/SOQL support. Requires Node >=20, TypeScript 5+, and Zod. Key differentiators: type‑safe query building, provider‑agnostic design (Ampersand transport), Zod model schemas for runtime validation.","status":"active","version":"0.0.2","language":"javascript","source_language":"en","source_url":"https://github.com/mileszim/crm-orm","tags":["javascript","crm","orm","salesforce","hubspot","typescript","ampersand"],"install":[{"cmd":"npm install crm-orm","lang":"bash","label":"npm"},{"cmd":"yarn add crm-orm","lang":"bash","label":"yarn"},{"cmd":"pnpm add crm-orm","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency for defining model schemas","package":"zod","optional":false}],"imports":[{"note":"The package is ESM-only. CommonJS require will fail.","wrong":"const { createORM } = require('crm-orm')","symbol":"createORM","correct":"import { createORM } from 'crm-orm'"},{"note":"sf is a namespace export (not a class) containing helpers like sf.model.","wrong":"import { Salesforce } from 'crm-orm'","symbol":"sf","correct":"import { sf } from 'crm-orm'"},{"note":"Adapter class to wrap an Ampersand transport client.","wrong":null,"symbol":"AmpersandAdapter","correct":"import { AmpersandAdapter } from 'crm-orm'"}],"quickstart":{"code":"import { createORM, sf, AmpersandAdapter } from 'crm-orm';\nimport type { AmpersandTransportRequest, AmpersandTransportResponse } from 'crm-orm';\nimport { z } from 'zod';\n\nclass AmpersandPassthroughAPI {\n  async request<T = unknown>(req: AmpersandTransportRequest): Promise<AmpersandTransportResponse<T>> {\n    // delegate to your Ampersand instance\n    throw new Error('wire me to Ampersand');\n  }\n}\n\nconst transport = new AmpersandAdapter(new AmpersandPassthroughAPI());\n\nconst orm = createORM({\n  transport,\n  salesforce: { version: '59.0', providerName: 'salesforce' },\n});\n\nconst Opportunity = sf.model({\n  name: 'Opportunity',\n  object: 'Opportunity',\n  schema: z.object({\n    id: z.string(),\n    name: z.string(),\n    amount: z.number().nullable(),\n    createdDate: z.string(),\n  }),\n  fields: {\n    id: { path: 'Id' },\n    name: { path: 'Name' },\n    amount: { path: 'Amount' },\n    createdDate: { path: 'CreatedDate' },\n  },\n});\n\nconst opps = await orm\n  .from(Opportunity)\n  .select({ id: true, name: true, amount: true, createdDate: true })\n  .where({ name: { $like: 'Acme%' }, amount: { $gte: 25000 } })\n  .orderBy({ createdDate: 'desc' })\n  .limit(100)\n  .getMany();","lang":"typescript","description":"Sets up a CRM ORM instance, defines a Salesforce Opportunity model with Zod, and runs a typed query with filtering, sorting, and limiting."},"warnings":[{"fix":"Use Node 20+; or if on 18, try installing with --ignore-engines (not supported).","message":"Node >=20 required (engine field in package.json). Will not install on Node 18.","severity":"breaking","affected_versions":"0.0.x"},{"fix":"Use import syntax or dynamic import().","message":"ESM-only package: require() fails with ERR_REQUIRE_ESM.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use Salesforce provider. HubSpot will come in a later version.","message":"HubSpot support is stubs only; only Salesforce dialect works in v0.1.","severity":"gotcha","affected_versions":"0.0.x"},{"fix":"Use raw queries or alternative ORM for mutation operations.","message":"No CRUD methods (only read queries). Insert/update/delete planned for future versions.","severity":"breaking","affected_versions":"0.0.x"},{"fix":"Double-check field API names in Salesforce object. Use $raw for custom SOQL if needed.","message":"Model fields must exactly match Salesforce field API names in fields.path. Incorrect paths cause SOQL errors.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.0.2':23 '1.0':26 '20':38 '5':40 'agnost':50 'ampersand':52,66 'build':48 'crm':2,61 'crm-orm':1 'crms':8 'current':21 'design':51 'differenti':44 'dsl':17 'focus':28 'hubspot':10,64 'javascript':60 'key':43 'model':55 'node':5,37 'oper':15 'orm':3,6,62 'pre':25 'provid':49 'queri':32,47 'read':31 'render':20 'requir':36 'runtim':58 'safe':46 'salesforc':9,63 'salesforce/soql':34 'schema':13,56 'soql':19 'support':35 'transport':53 'type':4,30,45 'typescript':39,65 'v0.1':27 'valid':59 'version':22 'zod':12,42,54","created_at":"2026-06-04T18:49:09.909733+00:00","updated_at":"2026-06-04T18:49:09.909733+00:00","problems":[{"fix":"Change to use import syntax: import { createORM } from 'crm-orm';","cause":"Using require() on an ESM-only module.","error":"ERR_REQUIRE_ESM"},{"fix":"Run: npm install zod","cause":"Zod is a peer dependency not automatically installed.","error":"Error: Cannot find module 'zod'"},{"fix":"Use: import { createORM } from 'crm-orm';","cause":"Incorrect import (e.g., default import instead of named).","error":"TypeError: createORM is not a function"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/mileszim/crm-orm#readme","github":"https://github.com/mileszim/crm-orm","docs":null,"changelog":null,"pypi":null,"npm":"crm-orm","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database","crm"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}