{"id":16584866,"url":"https://github.com/mikaelvesavuori/triplecheck-repository-cosmosdb-sql","last_synced_at":"2026-07-04T01:03:56.365Z","repository":{"id":41875337,"uuid":"362119717","full_name":"mikaelvesavuori/triplecheck-repository-cosmosdb-sql","owner":"mikaelvesavuori","description":"Database utility for using CosmosDB (SQL) with TripleCheck broker.","archived":false,"fork":false,"pushed_at":"2023-04-22T14:51:51.000Z","size":1408,"stargazers_count":0,"open_issues_count":8,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-30T04:00:48.862Z","etag":null,"topics":["consumer-contracts","consumer-driven-contracts","contract-testing","cosmosdb","pacts","sql","triplecheck"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mikaelvesavuori.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-27T13:20:10.000Z","updated_at":"2022-04-25T08:27:31.000Z","dependencies_parsed_at":"2025-01-16T16:14:24.241Z","dependency_job_id":"4996132b-18df-40bc-8f05-a2b037ed0288","html_url":"https://github.com/mikaelvesavuori/triplecheck-repository-cosmosdb-sql","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/mikaelvesavuori/triplecheck-repository-cosmosdb-sql","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikaelvesavuori%2Ftriplecheck-repository-cosmosdb-sql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikaelvesavuori%2Ftriplecheck-repository-cosmosdb-sql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikaelvesavuori%2Ftriplecheck-repository-cosmosdb-sql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikaelvesavuori%2Ftriplecheck-repository-cosmosdb-sql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mikaelvesavuori","download_url":"https://codeload.github.com/mikaelvesavuori/triplecheck-repository-cosmosdb-sql/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mikaelvesavuori%2Ftriplecheck-repository-cosmosdb-sql/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":281047794,"owners_count":26435124,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-25T02:00:06.499Z","response_time":81,"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":["consumer-contracts","consumer-driven-contracts","contract-testing","cosmosdb","pacts","sql","triplecheck"],"created_at":"2024-10-11T22:46:04.495Z","updated_at":"2025-10-26T01:39:01.415Z","avatar_url":"https://github.com/mikaelvesavuori.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# triplecheck-repository-cosmosdb-sql\n\n![TripleCheck database repository](readme/triplecheck-repository.png)\n\n## TripleCheck: Azure CosmosDB (SQL) database repository\n\nDatabase utility for using CosmosDB (SQL) with TripleCheck broker.\n\n## Instructions\n\nYou'll need to have a CosmosDB account up, a container (SQL) and set the Partition Key to `/id`. Also, I'd recommend maybe setting the consistency to \"Strong\". Consider using the serverless option for CosmosDB, since that will be a lot cheaper for smaller workloads.\n\n## Basic implementation\n\nIn your `triplecheck-broker` implementation, do a regular import for `triplecheck-repository-cosmosdbsql` and pass the repository to the broker. In an Azure Functions context, an implementation could look like:\n\n```TypeScript\nimport { TripleCheckBroker } from 'triplecheck-broker';\nimport { CosmosSqlRepository } from 'triplecheck-repository-cosmosdb-sql';\n\nexport const config = {\n  endpoint: '\u003cyour_endpoint_uri\u003e',\n  key: '\u003cprimary_key\u003e',\n  databaseId: 'triplecheck', // \u003c--- example\n  containerId: 'broker_sql'  // \u003c--- example\n};\n\n/**\n * @description The handler.\n */\nexport async function handler(context: any, req: any) {\n  const [request, payload] = await getRequestData(req);\n\n  const repository = CosmosSqlRepository(config);\n  const { responseData, status, headers } = await TripleCheckBroker(request, payload, repository);\n\n  return {\n    status,\n    body: responseData\n  };\n}\n\n/**\n * @description Utility function to get the data we need to run the TripleCheck broker. Expects the full Azure Functions request object.\n */\nasync function getRequestData(req: any) {\n  const { body, method, url } = req;\n\n  let [pathname, search] = url.split('?');\n  if (!pathname) pathname = url;\n\n  const payload = typeof body === 'string' ? JSON.parse(body) : body;\n\n  return [\n    {\n      method,\n      pathname,\n      search\n    },\n    payload\n  ];\n}\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikaelvesavuori%2Ftriplecheck-repository-cosmosdb-sql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmikaelvesavuori%2Ftriplecheck-repository-cosmosdb-sql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmikaelvesavuori%2Ftriplecheck-repository-cosmosdb-sql/lists"}