{"id":47677954,"url":"https://github.com/javrrr/data-360-sdk","last_synced_at":"2026-04-17T07:03:23.799Z","repository":{"id":342339402,"uuid":"1173352496","full_name":"javrrr/data-360-sdk","owner":"javrrr","description":"TypeScript SDK for the Salesforce Data 360 Connect REST API","archived":false,"fork":false,"pushed_at":"2026-03-30T17:29:55.000Z","size":785,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-04-03T01:41:14.580Z","etag":null,"topics":["api","cdp","data360","datacloud","openapi","salesforce","sdk","typescript"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/data-360-sdk","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/javrrr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-05T09:18:33.000Z","updated_at":"2026-03-30T17:29:58.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/javrrr/data-360-sdk","commit_stats":null,"previous_names":["javrrr/data-360-sdk"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/javrrr/data-360-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javrrr%2Fdata-360-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javrrr%2Fdata-360-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javrrr%2Fdata-360-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javrrr%2Fdata-360-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/javrrr","download_url":"https://codeload.github.com/javrrr/data-360-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/javrrr%2Fdata-360-sdk/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31918841,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-16T18:22:33.417Z","status":"online","status_checked_at":"2026-04-17T02:00:06.879Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","cdp","data360","datacloud","openapi","salesforce","sdk","typescript"],"created_at":"2026-04-02T13:38:31.919Z","updated_at":"2026-04-17T07:03:23.753Z","avatar_url":"https://github.com/javrrr.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# data-360-sdk\n\nTypeScript SDK for the Salesforce Data 360 Connect REST API. Provides type-safe, idiomatic access to all 27 API resource categories with full coverage of 220+ endpoints.\n\n## Features\n\n- **Full API coverage** — 27 service namespaces, 220+ methods, generated from the OpenAPI spec\n- **Type-safe** — Auto-generated types and services from the OpenAPI 3.0.0 spec (810 schemas + 262 enums + discriminated input unions + typed query parameters)\n- **Zero HTTP dependencies** — Uses native `fetch` (Node.js 18+, browsers, React Native)\n- **Dual format** — ESM + CJS output, tree-shakeable with `sideEffects: false`\n- **Retry \u0026 backoff** — Exponential backoff with jitter, Retry-After header support\n- **Pagination** — Built-in async iterators for offset-based and nextPageUrl-based pagination\n- **Multiple auth strategies** — Static token, refreshable token, OAuth2 client credentials\n\n## Installation\n\n```bash\nnpm install data-360-sdk\n```\n\n## Quick Start\n\n```typescript\nimport { Data360Client } from \"data-360-sdk\";\n\nconst client = new Data360Client({\n  instanceUrl: \"https://your-instance.my.salesforce.com/services/data/v66.0\",\n  auth: {\n    type: \"static\",\n    accessToken: \"your-access-token\",\n  },\n});\n\n// List connections (connectorType is required)\nconst connections = await client.connections.list({\n  connectorType: \"SalesforceDotCom\",\n  batchSize: 10,\n});\n\n// Get a specific segment\nconst segment = await client.segments.get(\"MySegment\");\n\n// Execute a SQL query\nconst result = await client.query.execute({\n  sql: \"SELECT Id, Name FROM Account__dlm LIMIT 10\",\n});\n```\n\n## Types\n\nAll schema, enum, and query parameter types are exported as named types, discoverable via autocomplete:\n\n```typescript\nimport type {\n  DataStreamInputRepresentation,\n  DataStreamCreateInput,\n  ConnectionCreateInput,\n  DataLakeObjectCategory,\n  RefreshConfigRefreshMode,\n  // Generated query param interfaces\n  DataStreamsDeleteParams,\n  ConnectionsListParams,\n} from \"data-360-sdk\";\n\n// Or from the types-only subpath (zero runtime cost)\nimport type { DataStreamInputRepresentation } from \"data-360-sdk/schemas\";\n\n// Schema\u003c\u003e helper also available\nimport type { Schema } from \"data-360-sdk\";\ntype Input = Schema\u003c\"DataStreamInputRepresentation\"\u003e;\n```\n\n### Prefer developer-facing input types\n\nUse normalized SDK input aliases when available; they provide clearer IntelliSense and stricter narrowing than raw OpenAPI shapes.\n\n```typescript\nimport type {\n  ConnectionCreateInput,\n  DataStreamCreateInput,\n} from \"data-360-sdk\";\n\nconst streamInput: DataStreamCreateInput = {\n  name: \"WebEventsStream\",\n  label: \"Web Events\",\n  datasource: \"DataConnector\",\n  datastreamType: \"CONNECTORSFRAMEWORK\",\n  connectorInfo: {\n    connectorType: \"IngestApi\",\n    connectorDetails: { name: \"ingest-api-connector\", events: [\"WebEvent\"] },\n  },\n  // Accepts either one DLO object or an array.\n  dataLakeObjectInfo: {\n    name: \"WebEvent__dll\",\n    label: \"Web Event\",\n    category: \"Engagement\",\n    fields: [],\n  },\n  mappings: [],\n  refreshConfig: { refreshMode: \"FullRefresh\" },\n};\n\nconst connectionInput: ConnectionCreateInput = {\n  connectorType: \"SalesforceDotCom\",\n  label: \"CRM Connection\",\n  organizationId: \"00Dxx0000000001\",\n};\n```\n\n## Authentication\n\n### Static Token\n\n```typescript\nconst client = new Data360Client({\n  instanceUrl: \"https://instance.my.salesforce.com/services/data/v66.0\",\n  auth: {\n    type: \"static\",\n    accessToken: \"your-token\",\n  },\n});\n```\n\n### Refreshable Token\n\n```typescript\nconst client = new Data360Client({\n  instanceUrl: \"https://instance.my.salesforce.com/services/data/v66.0\",\n  auth: {\n    type: \"refresh\",\n    accessToken: \"initial-token\",\n    refreshToken: \"refresh-token\",\n    refreshFn: async (refreshToken) =\u003e {\n      const response = await fetch(\"https://login.salesforce.com/services/oauth2/token\", {\n        method: \"POST\",\n        body: new URLSearchParams({\n          grant_type: \"refresh_token\",\n          client_id: \"your-client-id\",\n          client_secret: \"your-client-secret\",\n          refresh_token: refreshToken,\n        }),\n      });\n      const data = await response.json();\n      return {\n        accessToken: data.access_token,\n        refreshToken: data.refresh_token,\n        expiresIn: data.expires_in,\n      };\n    },\n  },\n});\n```\n\n### OAuth2 Client Credentials\n\n```typescript\nconst client = new Data360Client({\n  instanceUrl: \"https://instance.my.salesforce.com/services/data/v66.0\",\n  auth: {\n    type: \"oauth2\",\n    clientId: \"your-client-id\",\n    clientSecret: \"your-client-secret\",\n    tokenUrl: \"https://login.salesforce.com/services/oauth2/token\",\n  },\n});\n```\n\n## Pagination\n\n### Manual Pagination\n\n```typescript\nconst page = await client.segments.list({\n  batchSize: 20,\n  offset: 0,\n});\n```\n\n### Async Iterator\n\n```typescript\nfor await (const segment of client.segments.listAll({ batchSize: 50 })) {\n  console.log(segment);\n}\n```\n\n## Error Handling\n\n```typescript\nimport {\n  Data360Error,\n  BadRequestError,\n  AuthenticationError,\n  RateLimitError,\n  NotFoundError,\n} from \"data-360-sdk\";\n\ntry {\n  await client.connections.get(\"nonexistent\");\n} catch (err) {\n  if (err instanceof NotFoundError) {\n    console.log(\"Connection not found\");\n  } else if (err instanceof RateLimitError) {\n    console.log(`Rate limited, retry after ${err.retryAfter}s`);\n  } else if (err instanceof AuthenticationError) {\n    console.log(\"Token expired or invalid\");\n  } else if (err instanceof Data360Error) {\n    console.log(`API error: ${err.status} ${err.message}`, err.body);\n  }\n}\n```\n\n## Query Execution\n\n### Fire and Poll\n\n```typescript\n// Execute and automatically poll until complete\nconst result = await client.query.executeAndWait(\n  { sql: \"SELECT Id FROM Account__dlm\" },\n  { pollIntervalMs: 2000, timeoutMs: 300000 },\n);\n```\n\n### Manual Polling\n\n```typescript\nconst queryResult = await client.query.execute({\n  sql: \"SELECT Id FROM Account__dlm\",\n});\n\nconst queryId = queryResult.status?.queryId;\n\nif (queryId) {\n  // Poll status\n  let status = await client.query.getStatus(queryId);\n  while (status.completionStatus?.startsWith(\"Running\")) {\n    await new Promise((r) =\u003e setTimeout(r, 2000));\n    status = await client.query.getStatus(queryId);\n  }\n\n  // Fetch rows\n  const rows = await client.query.getRows(queryId, { batchSize: 200 });\n}\n```\n\n## Available Services\n\n220+ methods across 27 service namespaces. Service classes and typed query parameter interfaces are auto-generated from the [Data 360 Connect API OpenAPI Spec](https://developer.salesforce.com/docs/data/connectapi/references/spec).\n\n| Service | Namespace | Methods |\n|---------|-----------|---------|\n| Activation Targets | `client.activationTargets` | list, listAll, get, create, patch, update, listExternalPlatforms, listAllExternalPlatforms |\n| Activations | `client.activations` | list, listAll, get, getById, create, put, update, delete, listData, getData, listAllData |\n| Calculated Insights | `client.calculatedInsights` | list, listAll, get, create, delete, patch, run |\n| Connections | `client.connections` | list, listAll, get, create, update, patch, put, delete, test, testByPost, postTest, postActions, createActionsById, createDatabaseSchemas, createDatabases, getEndpoints, createObjects, createFields, createPreview, listSchema, putSchema, getSitemap, putSitemap, listAllSchema |\n| Connectors | `client.connectors` | list, listAll, get |\n| Data Action Targets | `client.dataActionTargets` | list, listAll, get, create, delete, getSigningKey, createSigningKey, resetSigningKey |\n| Data Actions | `client.dataActions` | list, listAll, create |\n| Data Clean Room | `client.dataCleanRoom` | listCollaborations, listAllCollaborations, createCollaborations, acceptInvitation, rejectInvitation, run, listCollaborationsJobs, listAllCollaborationsJobs, listProviders, listAllProviders, createProviders, getProviders, listProvidersTemplates, listAllProvidersTemplates, listSpecifications, listAllSpecifications, createSpecifications, listTemplates, listAllTemplates |\n| Data Graphs | `client.dataGraphs` | get, create, delete, refresh, getData, getDataByGet, getMetadata |\n| Data Kits | `client.dataKits` | list, create, delete, patch, createByPost, listDependencies, getDeploymentStatus, createUndeploy, listAvailableComponents, getDataKitManifest |\n| Data Lake Objects | `client.dataLakeObjects` | list, listAll, get, create, delete, patch |\n| Data Model Objects | `client.dataModelObjects` | list, listAll, get, create, delete, patch, listRelationships, listAllRelationships, createRelationships, deleteRelationships, listMappings, listAllMappings, getMappings, createMappings, deleteMappings, deleteMappingsFieldMappings, patchMappingsFieldMappings |\n| Data Spaces | `client.dataSpaces` | list, listAll, get, create, patch, listMembers, listAllMembers, putMembers, getMembers |\n| Data Streams | `client.dataStreams` | list, listAll, get, create, delete, patch, run |\n| Data Transforms | `client.dataTransforms` | list, listAll, get, create, put, delete, run, cancel, retry, refreshStatus, createValidation, listRunHistory, listAllRunHistory, getSchedule, putSchedule |\n| Document AI | `client.documentAi` | extractData, generateSchema, listConfigurations, listAllConfigurations, createConfigurations, deleteConfigurations, getConfigurations, patchConfigurations, run, getGlobalConfig |\n| Identity Resolutions | `client.identityResolutions` | list, listAll, get, create, delete, patch, runNow |\n| Insights | `client.insights` | getMetadata, getMetadataByGet, getCalculatedInsights |\n| Machine Learning | `client.machineLearning` | createAlerts, patchAlerts, listConfiguredModels, listAllConfiguredModels, getConfiguredModels, deleteConfiguredModels, patchConfiguredModels, listModelArtifacts, listAllModelArtifacts, getModelArtifacts, deleteModelArtifacts, patchModelArtifacts, createPredict, listModelSetupsSetupVersions, listAllModelSetupsSetupVersions, createModelSetupsSetupVersions, getModelSetupsSetupVersions, patchModelSetupsSetupVersions, listModelSetupsSetupVersionsByGet, listAllModelSetupsSetupVersionsByGet, getModelSetupsSetupVersionsByGet |\n| Metadata | `client.metadata` | list, getEntities |\n| Private Network Routes | `client.privateNetworkRoutes` | list, listAll, get, create, delete |\n| Profile | `client.profile` | get, getByGet, getGet, getCalculatedInsights, getMetadata, getMetadataByGet |\n| Query V1/V2 | `client.queryV1V2` | create, createV2, getV2, executeV1, executeV2, getNextBatch |\n| Query (SQL) | `client.query` | create, get, delete, getRows, execute, getStatus, executeAndWait |\n| Search Index | `client.searchIndex` | list, listAll, get, create, delete, patch, getConfig |\n| Segments | `client.segments` | list, listAll, get, create, delete, patch, count, countWithInput, deactivate, deactivateByPost, publish, getMembers, listMembers |\n| Universal ID Lookup | `client.universalIdLookup` | get, lookup |\n\n## Configuration Options\n\n```typescript\nconst client = new Data360Client({\n  instanceUrl: \"https://instance.my.salesforce.com/services/data/v66.0\",\n  auth: { type: \"static\", accessToken: \"token\" },\n  timeout: 30000,        // Request timeout in ms (default: 30000)\n  maxRetries: 3,         // Retries for 429/5xx (default: 3)\n  fetch: customFetch,    // Custom fetch implementation\n  requestInterceptors: [\n    ({ url, init }) =\u003e {\n      console.log(`→ ${init.method} ${url}`);\n      return { url, init };\n    },\n  ],\n  responseInterceptors: [\n    (response, request) =\u003e {\n      console.log(`← ${response.status} ${request.url}`);\n      return response;\n    },\n  ],\n});\n```\n\n## Architecture\n\n```\nsrc/\n  generated/\n    openapi.yaml          ← Fetched spec (committed for diffing)\n    openapi.d.ts          ← Raw types from openapi-typescript\n    services/             ← Generated base service classes\n      *.base.ts           ← One per API tag (27 files)\n      index.ts            ← Barrel export\n  schemas.ts              ← Named re-exports with overrides, enums, unions\n  resources/\n    base-resource.ts      ← Abstract base with pagination helpers\n    *.ts                  ← Final services (re-export or extend generated bases)\n  client.ts               ← Data360Client wiring all services\n  index.ts                ← Public API barrel export\n\nscripts/\n  generate-types.ts       ← Type generation (openapi.d.ts + schemas.ts)\n  generate-services.ts    ← Service generation (services/*.base.ts)\n```\n\nServices are generated from the OpenAPI spec, then optionally extended in `src/resources/` for custom types (e.g., `DataStreamCreateInput`) or convenience methods (e.g., `executeAndWait`).\n\n## Development\n\n```bash\nnpm run generate    # Regenerate types + services from OpenAPI spec\nnpm run typecheck   # Type check\nnpm test            # Run tests\nnpm run build       # Build ESM + CJS\n```\n\n### Updating the SDK\n\nWhen the API spec changes:\n\n1. Run `npm run generate` — fetches the latest spec and regenerates types + service base classes\n2. Run `npm run typecheck` — TypeScript will flag any breaking changes in hand-written extensions\n3. Fix any compilation errors in `src/resources/` (method signatures or types that changed)\n4. Run `npm test` — verify all tests pass\n5. Run `npm run build` — produce the distributable\n\n## Releasing\n\nAfter your PR is merged to `main`:\n\n```bash\ngit checkout main\ngit pull --ff-only\n```\n\nBump version (creates version commit + git tag):\n\n```bash\nnpm run release:version:patch\n# or: release:version:minor / release:version:major\n```\n\nRun checks, push `main` and tags, then create a GitHub release with auto-generated notes:\n\n```bash\nnpm run release:run\n```\n\nThe `Publish to npm` GitHub Action is triggered by `release.published`.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavrrr%2Fdata-360-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjavrrr%2Fdata-360-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjavrrr%2Fdata-360-sdk/lists"}