{"_id":"@digigov-oss/govcrm-rest-client","_rev":"5-7670bd31214c45381717336fe2e6efac","name":"@digigov-oss/govcrm-rest-client","dist-tags":{"latest":"0.96.1"},"versions":{"1.0.0":{"name":"@digigov-oss/govcrm-rest-client","version":"1.0.0","keywords":["GovCRM"],"author":{"name":"Dimitrios Massaad","email":"dmassaad@admin.grnet.gr"},"_id":"@digigov-oss/govcrm-rest-client@1.0.0","maintainers":[{"name":"pskarvelis","email":"pskarvelis@admin.grnet.gr"},{"name":"dmichail","email":"dimitrios.michail@gmail.com"},{"name":"dmassaad-grnet","email":"dmassaad@admin.grnet.gr"}],"homepage":"https://gitlab.grnet.gr/digigov-oss/govcrm-rest-client/-/blob/main/README.md","bugs":{"url":"https://gitlab.grnet.gr/digigov-oss/govcrm-rest-client/-/issues"},"dist":{"shasum":"8875d070987aaa592ec8c01f496f633472d6aa41","tarball":"https://registry.npmjs.org/@digigov-oss/govcrm-rest-client/-/govcrm-rest-client-1.0.0.tgz","fileCount":46,"integrity":"sha512-dHyYTjD5EMd47ZC3gr5vqZMIpQFzaPf86094YWE0F2TawTEQUrPXRiew2xNigCLfPRdzqbRRZK+xQaQwdROoPA==","signatures":[{"sig":"MEYCIQCebLtYU5ferGHzkw3qigN3z3Qok/TLX50IHZGNwxitOAIhAO/8faNXKvkAUSiYvtLAAIwUJBE0WX00KIFfwtXPVbWW","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":131160},"main":"dist/cjs/index.js","type":"module","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","engines":{"node":">=16.13.1"},"exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"9e6bb81e12f7f01545bef8abcf9b2b66fde44649","scripts":{"lint":"eslint ./src && eslint ./test","test":"jest --config jest.config.js --detectOpenHandles --silent=false","build":"rm -fr dist/* && tsc -p tsconfig.json && tsc -p tsconfig.commonjs.json && ./setType.sh","format":"prettier --write ./src && prettier --write ./test","prettier":"prettier --write ./src"},"_npmUser":{"name":"dmassaad-grnet","email":"dmassaad@admin.grnet.gr"},"licenses":[{"url":"https://en.wikipedia.org/wiki/MIT_License","type":"MIT"}],"repository":{"url":"git+https://gitlab.grnet.gr/digigov-oss/govcrm-rest-client.git","type":"git"},"_npmVersion":"10.2.4","description":"GovCRM REST API Client for Greek Ministry of Digital Governance","directories":{"src":"src","test":"test"},"_nodeVersion":"20.11.1","dependencies":{"bottleneck":"^2.19.5","@digigov-oss/gsis-audit-record-db":"^1.3.1"},"eslintConfig":{"rules":{"max-len":["error",{"code":100}],"no-console":1,"no-extra-boolean-cast":0,"@typescript-eslint/no-explicit-any":0,"@typescript-eslint/no-floating-promises":0,"@typescript-eslint/no-unsafe-assignment":0,"@typescript-eslint/restrict-plus-operands":0,"@typescript-eslint/no-unsafe-member-access":0,"@typescript-eslint/explicit-module-boundary-types":0},"parser":"@typescript-eslint/parser","extends":["eslint:recommended","plugin:@typescript-eslint/recommended","plugin:@typescript-eslint/recommended-requiring-type-checking"],"plugins":["@typescript-eslint"],"parserOptions":{"project":"./tsconfig.json"}},"eslintIgnore":[],"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","axios":"^1.8.1","eslint":"^8.54.0","ts-jest":"^29.1.1","ts-node":"^10.4.0","prettier":"^3.1.0","typescript":"5.2","@types/jest":"^29.5.10","@types/node":"^16.9.0","axios-retry":"^4.0.0","object-inspect":"^1.13.1","@types/object-inspect":"^1.8.4","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.1","@typescript-eslint/eslint-plugin":"^6.12.0"},"_npmOperationalInternal":{"tmp":"tmp/govcrm-rest-client_1.0.0_1774272334585_0.6187207624726074","host":"s3://npm-registry-packages-npm-production"},"deprecated":"this version has been deprecated, use 0.96.1 and later"},"0.96.1":{"name":"@digigov-oss/govcrm-rest-client","version":"0.96.1","keywords":["GovCRM"],"author":{"name":"Dimitrios Massaad","email":"dmassaad@admin.grnet.gr"},"_id":"@digigov-oss/govcrm-rest-client@0.96.1","maintainers":[{"name":"pskarvelis","email":"pskarvelis@admin.grnet.gr"},{"name":"dmichail","email":"dimitrios.michail@gmail.com"},{"name":"dmassaad-grnet","email":"dmassaad@admin.grnet.gr"}],"homepage":"https://gitlab.grnet.gr/digigov-oss/govcrm-rest-client/-/blob/main/README.md","bugs":{"url":"https://gitlab.grnet.gr/digigov-oss/govcrm-rest-client/-/issues"},"dist":{"shasum":"936180d242fb0a63f9a3f8122a0c77767f3ff64c","tarball":"https://registry.npmjs.org/@digigov-oss/govcrm-rest-client/-/govcrm-rest-client-0.96.1.tgz","fileCount":48,"integrity":"sha512-xe7qiQIKM+BJgBxI0AAXO0kxg5tExqWThwWH5Qfc6+e4L8ZgXlpyhneqYsewWudjw9dccqFBG9KkMcvZxDc2nw==","signatures":[{"sig":"MEUCIQCrWwUOK+Fs7hEgL5GMQugxMZGBtO5yVEG8NFfCLSVvPQIgELrJSXE/Zezp+sWtwX9VSmbR0je6s6vWXZjCSrl8/hE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIGeXZg9RuVdkrBzQKiLboBISPWX7Gt4HaMgXSTkay/BOAiEAzfT4H3Umh1w/s5+TnPsLEpRbC79pFiPbwRbZLW7qVMo=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":452436},"main":"dist/cjs/index.js","type":"module","types":"./dist/cjs/index.d.ts","module":"dist/esm/index.js","engines":{"node":">=16.13.1"},"exports":{".":{"import":"./dist/esm/index.js","require":"./dist/cjs/index.js"}},"gitHead":"c019d1c721683f420f56291803f0a983ce2eb271","scripts":{"lint":"eslint ./src && eslint ./test","test":"jest --config jest.config.js --detectOpenHandles --silent=false","build":"rm -fr dist/* && tsc -p tsconfig.json && tsc -p tsconfig.commonjs.json && ./setType.sh","format":"prettier --write ./src && prettier --write ./test","prettier":"prettier --write ./src"},"_npmUser":{"name":"dmassaad-grnet","email":"dmassaad@admin.grnet.gr"},"licenses":[{"url":"https://en.wikipedia.org/wiki/MIT_License","type":"MIT"}],"repository":{"url":"git+https://gitlab.grnet.gr/digigov-oss/govcrm-rest-client.git","type":"git"},"_npmVersion":"10.2.4","description":"GovCRM REST API Client for Greek Ministry of Digital Governance","directories":{"src":"src","test":"test"},"_nodeVersion":"20.11.1","dependencies":{"bottleneck":"^2.19.5","@digigov-oss/gsis-audit-record-db":"^1.3.1"},"eslintConfig":{"rules":{"max-len":["error",{"code":100}],"no-console":1,"no-extra-boolean-cast":0,"@typescript-eslint/no-explicit-any":0,"@typescript-eslint/no-floating-promises":0,"@typescript-eslint/no-unsafe-assignment":0,"@typescript-eslint/restrict-plus-operands":0,"@typescript-eslint/no-unsafe-member-access":0,"@typescript-eslint/explicit-module-boundary-types":0},"parser":"@typescript-eslint/parser","extends":["eslint:recommended","plugin:@typescript-eslint/recommended","plugin:@typescript-eslint/recommended-requiring-type-checking"],"plugins":["@typescript-eslint"],"parserOptions":{"project":"./tsconfig.json"}},"eslintIgnore":[],"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"jest":"^29.7.0","axios":"^1.8.1","eslint":"^8.54.0","ts-jest":"^29.1.1","ts-node":"^10.4.0","prettier":"^3.1.0","typescript":"5.2","@types/jest":"^29.5.10","@types/node":"^16.9.0","axios-retry":"^4.0.0","object-inspect":"^1.13.1","@types/object-inspect":"^1.8.4","eslint-config-prettier":"^9.0.0","eslint-plugin-prettier":"^5.0.1","@typescript-eslint/eslint-plugin":"^6.12.0"},"_npmOperationalInternal":{"tmp":"tmp/govcrm-rest-client_0.96.1_1790262156362_0.8685366611453387","host":"s3://npm-registry-packages-npm-production"}}},"time":{"created":"2026-03-23T13:25:34.454Z","modified":"2026-09-24T15:09:51.053Z","1.0.0":"2026-03-23T13:25:34.737Z","1.0.96":"2026-09-24T10:58:05.961Z","0.96.1":"2026-09-24T15:02:36.459Z"},"bugs":{"url":"https://gitlab.grnet.gr/digigov-oss/govcrm-rest-client/-/issues"},"author":{"name":"Dimitrios Massaad","email":"dmassaad@admin.grnet.gr"},"homepage":"https://gitlab.grnet.gr/digigov-oss/govcrm-rest-client/-/blob/main/README.md","keywords":["GovCRM"],"repository":{"url":"git+https://gitlab.grnet.gr/digigov-oss/govcrm-rest-client.git","type":"git"},"description":"GovCRM REST API Client for Greek Ministry of Digital Governance","maintainers":[{"name":"dmassaad-grnet","email":"dmassaad@admin.grnet.gr"},{"name":"dmichail","email":"dimitrios.michail@gmail.com"},{"name":"pskarvelis","email":"pskarvelis@admin.grnet.gr"}],"readme":"# GovCRM REST API Client\n\nTypeScript/JavaScript client library for accessing the Greek Government CRM (GovCRM) REST API through the Ministry of Digital Governance Interoperability Center (KED).\n\n## Overview\n\nThis package provides a client for interacting with the GovCRM REST API, which manages citizen service cases and government procedures in Greece. The API is provided by the Interoperability Center of the Greek Ministry of Digital Governance.\n\n## Features\n\n- **TypeScript Support**: Full type definitions for all API operations\n- **Rate Limiting**: Built-in request rate limiting using Bottleneck\n- **Authentication**: Basic Authentication support\n- **Error Handling**: Comprehensive error handling with Greek and English error messages\n- **Environment Support**: Separate pilot and production environment URLs\n- **Helper Methods**: Utility functions for audit records, date formatting, and validation\n\n## Installation\n\n```bash\nnpm install @digigov-oss/govcrm-rest-client\n```\n\n## Quick Start\n\n```typescript\nimport {\n    HttpGovCrmClient,\n    StatusCode,\n    ExternalSystemType,\n    CustomerKeyType,\n} from '@digigov-oss/govcrm-rest-client';\nimport axios from 'axios';\n\n// Create HTTP reader using axios\nconst axiosReader = {\n    get: async (url, config) => axios.get(url, config).then((r) => r.data),\n    post: async (url, config) =>\n        axios.post(url, config?.data, { headers: config?.headers }).then((r) => r.data),\n};\n\n// Initialize client\nconst client = new HttpGovCrmClient(axiosReader, {\n    apiUrl: 'https://test.gsis.gr/esbpilot/govcrmRestService', // Pilot environment\n    username: 'your-username',\n    password: 'your-password',\n});\n\n// Update a case\nconst updateResponse = await client.updateCase({\n    auditRecord: HttpGovCrmClient.createAuditRecordSync('1', 'MyOrg', 'PROT001'),\n    govcrmCaseUpdateInputRecord: {\n        govcrmSectorcode: '66797',\n        govcrmExternalsystem: ExternalSystemType.EKEP,\n        govcrmExternalticketnumber: 'CASE-123',\n        govcrmStatusdetails: 'Case completed successfully',\n        statuscode: StatusCode.SUCCESSFUL_COMPLETION,\n        govcrmResponsereceivedon: HttpGovCrmClient.formatDate(new Date()),\n        govcrmCustomerkey: CustomerKeyType.CITIZEN_CODE,\n        govcrmCustomercode: '1234567',\n    },\n});\n\n// Create a new case\nconst createResponse = await client.createCase({\n    auditRecord: HttpGovCrmClient.createAuditRecordSync('2', 'MyOrg', 'PROT002'),\n    govcrmCaseCreateInputRecord: {\n        govcrmSectorcode: '93742',\n        govcrmKepcode: '123',\n        govcrmKeptype: KepType.EDYTE,\n        govcrmExternalsystem: ExternalSystemType.EKEP,\n        govcrmExternalticketnumber: 'INTEGRATION-TEST-CREATE',\n        govcrmCasetype: '746646', // EMD code\n        govcrmCasename: 'Integration Test Case Creation',\n        govcrmStatus: CaseStatus.INITIAL_CREATION,\n        govcrmStatusdetails: 'Integration test case creation',\n        govcrmAgentcomments: 'No comments',\n        govcrmCustomerkey: CustomerKeyType.AFM,\n        govcrmCustomercode: '154683952',\n    },\n});\n```\n\n## API Methods\n\n### Case Update (`updateCase`)\n\nUpdates the status of an existing case in the CRM system.\n\n**Parameters:**\n\n- `govcrmSectorcode`: Organization code (required)\n- `govcrmExternalticketnumber`: External ticket number to update (required)\n- `statuscode`: Completion status code (required)\n- `govcrmStatusdetails`: Status description\n- `govcrmResponsereceivedon`: Completion date\n- `govcrmCustomerkey/govcrmCustomercode`: Citizen identification\n\n**Response:**\n\n- Success: `responseMessage` with confirmation\n- Error: `code` and `message` with error details\n\n### Case Create (`createCase`)\n\nCreates a new case in the CRM system for existing procedures.\n\n**Parameters:**\n\n- `govcrmSectorcode`: Organization VAT (required)\n- `govcrmCasetype`: Procedure identifier (MITOS code)\n- `govcrmCasename`: Case title\n- `govcrmStatus`: Request status\n- `govcrmCustomerkey/govcrmCustomercode`: Citizen identification\n- `govcrmMetadata`: Optional JSON metadata\n- `govcrmChannel`: Case creation channel (in-person, online, phone)\n\n**Response:**\n\n- Success: `responseMessage` with \"204\"\n- Error: `code` and `message` with error details\n\n## Enums and Types\n\n### Status Codes\n\n```typescript\nenum StatusCode {\n    SUCCESSFUL_COMPLETION = 1,\n    MANUAL_CANCELLATION = 2,\n    REQUEST_REJECTION = 3,\n    TECHNICAL_PROBLEM = 4,\n    REQUEST_SUBMISSION = 5,\n}\n```\n\n### Customer Key Types\n\n```typescript\nenum CustomerKeyType {\n    AFM = 'AFM', // Tax Registration Number\n    AMKA = 'AMKA', // Social Security Number\n    PA = 'PA', // Personal Number\n    CITIZEN_CODE = 'CITIZEN_CODE',\n    ID = 'ID', // Identity Card Number\n    HASH_PA = 'HASH_PA', // Anonymized Personal Number\n}\n```\n\n### External Systems\n\n```typescript\nenum ExternalSystemType {\n    GOV_GR = 'gov.gr',\n    EKEP = 'eKEP',\n}\n```\n\n### Channel Types\n\n```typescript\nenum ChannelType {\n    IN_PERSON = 1,\n    ONLINE = 2,\n    PHONE = 3,\n}\n```\n\n## Helper Methods\n\n### Create Audit Record\n\nThe client integrates with the official `@digigov-oss/gsis-audit-record-db` package for audit record management:\n\n```typescript\n// Using the official audit record package (recommended)\nconst auditRecord = await HttpGovCrmClient.createAuditRecord({\n    auditTransactionId: 'TRANS001',\n    auditUnit: 'MyOrganization',\n    auditProtocol: 'PROT123',\n    auditUserId: 'user1',\n    auditUserIp: '192.168.1.1',\n});\n\n// Or use the synchronous helper for backward compatibility\nconst auditRecord = HttpGovCrmClient.createAuditRecordSync(\n    'TRANS001', // Transaction ID\n    'MyOrganization', // Unit name\n    'PROT123', // Protocol number\n    'user1', // Optional: User ID\n    '192.168.1.1', // Optional: User IP\n);\n```\n\n### Date Formatting\n\n```typescript\nconst formattedDate = HttpGovCrmClient.formatDate(new Date()); // Returns YYYY-MM-DD\nconst isValid = HttpGovCrmClient.isValidDateFormat('2024-12-16'); // Returns boolean\n```\n\n### Environment URLs\n\n```typescript\nconst pilotUrl = HttpGovCrmClient.getPilotUrl(); // Test environment\nconst prodUrl = HttpGovCrmClient.getProductionUrl(); // Production environment\n```\n\n## Error Handling\n\nThe client provides comprehensive error handling with specific error codes:\n\n```typescript\ntry {\n    const response = await client.updateCase(request);\n\n    if (response.govcrmCaseUpdateOutputRecord.responseMessage) {\n        // Success\n        console.log('Case updated successfully');\n    } else {\n        // Business logic error\n        console.error('Error:', response.govcrmCaseUpdateOutputRecord.message);\n    }\n} catch (error) {\n    // Network or authentication error\n    console.error('API Error:', error);\n}\n```\n\n## Authentication\n\nThe client uses Basic Authentication. Credentials are automatically encoded and included in request headers:\n\n```typescript\nconst client = new HttpGovCrmClient(httpReader, {\n    username: 'your-username',\n    password: 'your-password',\n    // Other options...\n});\n```\n\n## Development\n\n```bash\n# Install dependencies\nnpm install\n\n# Build the project\nnpm run build\n\n\n# Format code\nnpm run format\n\n# Lint code\nnpm run lint\n```\n","readmeFilename":"README.md"}