{"id":39189888,"url":"https://github.com/chalk-ai/chalk-ts","last_synced_at":"2026-03-09T20:14:26.512Z","repository":{"id":63107421,"uuid":"564035283","full_name":"chalk-ai/chalk-ts","owner":"chalk-ai","description":"Typescript client for working with Chalk","archived":false,"fork":false,"pushed_at":"2025-12-15T22:56:31.000Z","size":1397,"stargazers_count":9,"open_issues_count":6,"forks_count":1,"subscribers_count":6,"default_branch":"main","last_synced_at":"2025-12-19T06:21:14.385Z","etag":null,"topics":["chalk","data","feature-engineering","pipelines","typescript"],"latest_commit_sha":null,"homepage":"https://docs.chalk.ai","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/chalk-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2022-11-09T21:17:46.000Z","updated_at":"2025-12-15T22:54:20.000Z","dependencies_parsed_at":"2023-12-21T20:29:48.011Z","dependency_job_id":"d7b032c6-463a-4b40-bd71-a67a139be366","html_url":"https://github.com/chalk-ai/chalk-ts","commit_stats":{"total_commits":17,"total_committers":3,"mean_commits":5.666666666666667,"dds":"0.17647058823529416","last_synced_commit":"657e2507228c7e97a2df6ca67c7cdebf60e2bdc9"},"previous_names":[],"tags_count":48,"template":false,"template_full_name":null,"purl":"pkg:github/chalk-ai/chalk-ts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chalk-ai%2Fchalk-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chalk-ai%2Fchalk-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chalk-ai%2Fchalk-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chalk-ai%2Fchalk-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/chalk-ai","download_url":"https://codeload.github.com/chalk-ai/chalk-ts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/chalk-ai%2Fchalk-ts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28521165,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T22:11:28.393Z","status":"ssl_error","status_checked_at":"2026-01-17T22:11:27.841Z","response_time":85,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["chalk","data","feature-engineering","pipelines","typescript"],"created_at":"2026-01-17T22:42:08.020Z","updated_at":"2026-01-17T22:42:08.066Z","avatar_url":"https://github.com/chalk-ai.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# @chalk-ai/client\n\n[![npm version](https://img.shields.io/npm/v/@chalk-ai/client?label=%40chalk-ai%2Fclient\u0026logo=npm)](https://www.npmjs.com/package/@chalk-ai/client)\n![CI](https://img.shields.io/github/actions/workflow/status/chalk-ai/chalk-ts/check.yml?branch=main)\n\nTypeScript client for Chalk.\n\n## Installation\n\n```sh\n$ yarn add @chalk-ai/client\n```\n\n## Generate Types\n\nStarting in your Chalk project directory, run:\n\n```sh\n$ chalk codegen typescript --out=generated_types.ts\n```\n\n## Usage\n\n### Modern JavaScript ES6\n\n```ts\nimport { ChalkGRPCClient } from \"@chalk-ai/client\"\n// import { ChalkClient } from \"@chalk-ai/client\";\n\n// Import your generated types (recommended)\nimport { FeaturesType } from \"local/generated_types\";\n\n// Alternatively, define features you want to pull using the client\n// as an interface with the feature type and feature name.\ninterface FeaturesType {\n  \"user.id\": string;\n  \"user.fraud_score\": number;\n}\n\nconst client = new ChalkGRPCClient\u003cFeaturesType\u003e();\n\nconst result = await client.query({\n  inputs: {\n    \"user.id\": \"1\",\n  },\n  outputs: [\"user.fraud_score\"],\n});\n\n// The property `.data` has auto-complete based on the\n// list provided in `output` above. So if you try to pull\n// a feature that wasn't requested, you will see an error\n// in type checking.\nconsole.log(result.data[\"user.fraud_score\"].value);\n```\n\n### CommonJS\n\n```ts\nvar ChalkGRPCClient = require(\"@chalk-ai/client\").ChalkGRPCClient;\n// var ChalkClient = require(\"@chalk-ai/client\").ChalkClient; \n\ninterface FeaturesType {\n  \"user.id\": string;\n  \"user.fraud_score\": number;\n}\n\nvar client = new ChalkGRPCClient\u003cFeaturesType\u003e();\n\nclient\n  .query({\n    inputs: {\n      \"user.id\": \"1\",\n    },\n    outputs: [\"user.fraud_score\"],\n  })\n  .then((result) =\u003e {\n    console.log(result.data[\"user.fraud_score\"].value);\n  });\n```\n\n## Constructor options (gRPC)\n\nSee [the HTTP Options](#constructor-options-legacy) if you are using the HTTP Client, but we encourage\nreading the [migration guide](#migrating-to-the-grpc-client).\n\n```ts\nimport { ChalkGRPCClient } from \"@chalk-ai/client\"\n\nconst options: ChalkGRPCClientOpts = {/* ... */ };\nconst chalkClient = new ChalkGRPCClient(options);\n\nexport interface ChalkGRPCClientOpts {\n  /**\n   * Your Chalk Client ID. This value will be read from the _CHALK_CLIENT_ID environment variable if not set explicitly.\n   *\n   * If not specified and unset by your environment, an error will be thrown on client creation\n   */\n  clientId?: string;\n\n  /**\n   * Your Chalk Client Secret. This value will be read from the _CHALK_CLIENT_SECRET environment variable if not set explicitly.\n   *\n   * If not specified and unset by your environment, an error will be thrown on client creation\n   */\n  clientSecret?: string;\n\n  /**\n   * The URL of your chalk API server. Defaults to https://api.chalk.ai\n   */\n  apiServer?: string;\n\n  /**\n   * The environment that your client will run against. This value will be read from the _CHALK_ACTIVE_ENVIRONMENT environment variable if not set explicitly.\n   *\n   * If not specified and unset by your environment, an error will be thrown on client creation\n   */\n  activeEnvironment?: string;\n\n  /**\n   * A custom fetch client that will replace the fetch polyfill used by default. Used by both the HTTP and gRPC\n   * clients - the HTTP client for all calls, and the gRPC client for fetching credentials from the API server.\n   *\n   * If not provided, the client will use the default fetch polyfill (native fetch with node-fetch as a fallback).\n   */\n  fetch?: CustomFetchClient;\n\n  /**\n   * A custom fetch headers object that will replace the fetch Headers polyfill used by default. This is primarily for use\n   * with a custom fetch client, and is not the preferred way to add additional headers to requests.\n   *\n   * If not provided, the client will use the default fetch Headers polyfill (native fetch with node-fetch as a fallback).\n   */\n  fetchHeaders?: typeof Headers;\n\n  /**\n   * The format to use for date-type data.\n   *\n   * Defaults to \"ISO_8601\" (in UTC), also supports \"EPOCH_MILLIS\" as number of milliseconds since epoch\n   */\n  timestampFormat?: TimestampFormat.ISO_8601 | TimestampFormat.EPOCH_MILLIS;\n\n  /**\n   * By default, the client will try to directly connect to the query client using the metadata provided during\n   * credentials exchange, which returns a mapping between environment and query server. If this option is\n   * truthy, the client will skip this step.\n   *\n   * The queryServer option will take precedence over this option (i.e. this option is essentially useless).\n   * *\n   * Defaults to false.\n   */\n  skipQueryServerFromCredentialExchange?: boolean;\n\n  /**\n   * Passed to the internal grpc client upon initialization. Under the hood, Chalk uses the @grpc/grpc-js library\n   * and this allows users finer control of their gRPC usage.\n   *\n   * See https://grpc.github.io/grpc/node/grpc.Client.html for more information on what is supported here.\n   */\n  grpcClientOptions?: Partial\u003cClientOptions\u003e;\n}\n```\n\n## Migrating to the gRPC Client\n\nWhile Chalk supports both an HTTP Client and a gRPC Client for interfacing with Chalk, we heavily encourage users to use \nthe gRPC Client for better performance, as this targets a more performant gRPC Query Server. After setting up a gRPC \nQuery Server in your Chalk Environment, changing to the gRPC Client can be done in a few steps:\n\n- Use the import `ChalkGRPCClient` instead of `ChalkClient`\n- Check to see if any of the following initialization options need to be changed:\n  - The option `useQueryServerFromCredentialExchange` has been changed to `skipQueryServerFromCredentialExchange` \n    and *negated* to better reflect the default behavior for the gRPC Query Server.\n  - Check your Chalk Environment for any custom routing rules. If you are not sure, reach out to Chalk support for help here.\n    - If your previous SDK client explicitly sets the `engine-type: engine` header on requests, this will need to be changed \n      to `engine-grpc` (or omitted, the gRPC client will automatically set this header but respects all overrides).\n    - It is most likely not necessary to change a provided `QueryServer` as most routing is done via SDK-set headers, but \n      depending on your setup this may need to be directly specified if using a non-standard port - the gRPC query server listens\n      on port `443` by default.\n  - It is **not** necessary to remove the `fetch` or `fetchHeaders` as these are still used during some HTTP routines\n    such as fetching credentials.\n\nAfter these initialization changes are made, no changes to actual calls should be necessary - the gRPC Client uses the\nsame function signatures.\n\nAt this moment, only `query()`, `queryBulk()`, and `multiQuery()` are supported - if your usage requires one of the other \nfunctions (`whoami()`, `triggerResolverRun()`, `uploadSingle()`, `getRunStatus()`), the legacy `ChalkClient` should be used\n(but ideally only for these four calls - we still strongly recommend partially migrating the query calls to the gRPC Client).\n\n\n\n### Supported environment variables\n\n| Variable                                | Kind         | Description                                                                                                                                      |\n| --------------------------------------- | ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------ |\n| `process.env._CHALK_CLIENT_ID`          | **Required** | Your Chalk client ID. You must specify this environment variable or pass an explicit `clientId` value when constructing your ChalkClient         |\n| `process.env._CHALK_CLIENT_SECRET`      | **Required** | Your Chalk client secret. You must specify this environment variable or pass an explicit `clientSecret` value when constructing your ChalkClient |\n| `process.env._CHALK_ACTIVE_ENVIRONMENT` | Optional     | The environment that your client should connect to. If not specified, the client will query your project's default environment                   |\n| `process.env._CHALK_API_SERVER`         | Optional     | The API server that the client will communicate with. This defaults to https://api.chalk.ai which should be sufficient for most consumers        |\n\nYou can find relevant variables to use with your Chalk Client by\nrunning `chalk config` with the Chalk command line tool.\n\n```sh\n$ chalk config\n\nPath:          ~~~\nName:          Organization Token\nClient Id:     \u003cclient-id\u003e\nClient Secret: \u003cclient-secret\u003e\nEnvironment:   \u003cactive-environment\u003e\nAPI Server:    https://api.chalk.ai\nValid Until:   2023-11-10T06:11:17.516000\n```\n\n## Constructor options (Legacy)\n\n```ts\nimport { ChalkCLient } from \"@chalk-ai/client\"\n\nconst options: ChalkClientOpts = {/* ... */};\nconst chalkClient = new ChalkClient(opts);\n\nexport interface ChalkClientOpts {\n  /**\n   * Your Chalk Client ID. This value will be read from the _CHALK_CLIENT_ID environment variable if not set explicitly.\n   *\n   * If not specified and unset by your environment, an error will be thrown on client creation\n   */\n  clientId?: string;\n\n  /**\n   * Your Chalk Client Secret. This value will be read from the _CHALK_CLIENT_SECRET environment variable if not set explicitly.\n   *\n   * If not specified and unset by your environment, an error will be thrown on client creation\n   */\n  clientSecret?: string;\n\n  /**\n   * The URL of your chalk API server. Defaults to https://api.chalk.ai\n   */\n  apiServer?: string;\n\n  /**\n   * The environment that your client will run against. This value will be read from the _CHALK_ACTIVE_ENVIRONMENT environment variable if not set explicitly.\n   *\n   * If not specified and unset by your environment, an error will be thrown on client creation\n   */\n  activeEnvironment?: string;\n\n  /**\n   * A custom fetch client that will replace the fetch polyfill used by default.\n   *\n   * If not provided, the client will use the default fetch polyfill (native fetch with node-fetch as a fallback).\n   */\n  fetch?: CustomFetchClient;\n\n  /**\n   * A custom fetch headers object that will replace the fetch Headers polyfill used by default.\n   *\n   * If not provided, the client will use the default fetch Headers polyfill (native fetch with node-fetch as a fallback).\n   */\n  fetchHeaders?: typeof Headers;\n\n  /**\n   * The format to use for date-type data.\n   *\n   * Defaults to \"ISO_8601\" (in UTC), also supports \"EPOCH_MILLIS\" as number of milliseconds since epoch\n   */\n  timestampFormat?: TimestampFormat.ISO_8601 | TimestampFormat.EPOCH_MILLIS;\n\n  /**\n   * If true, will try to directly connect to the query client using the metadata provided during\n   * credentials exchange, which returns a mapping between environment and query server.\n   *\n   * The queryServer option will take precedence over this option (i.e. this option is essentially useless).\n   *\n   * Defaults to false, the legacy behavior of this client. This will change at the next major release.\n   */\n  useQueryServerFromCredentialExchange?: boolean;\n}\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchalk-ai%2Fchalk-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchalk-ai%2Fchalk-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchalk-ai%2Fchalk-ts/lists"}