@fincuratech/stedi-sdk-js 1.5.0 → 1.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -19,6 +19,7 @@ TypeScript SDK for [Stedi's EDI Platform and Healthcare APIs](https://www.stedi.
19
19
 
20
20
  - [Installation](#installation)
21
21
  - [Quick Start](#quick-start)
22
+ - [In-Memory Client (Testing & Local Dev)](#in-memory-client-testing--local-dev)
22
23
  - [API Reference](#api-reference)
23
24
  - [Eligibility](#eligibility)
24
25
  - [Payers](#payers)
@@ -85,6 +86,41 @@ const eligibilityResult = await stedi.eligibility.check({
85
86
  console.log(eligibilityResult.benefitsInformation);
86
87
  ```
87
88
 
89
+ ## In-Memory Client (Testing & Local Dev)
90
+
91
+ `createInMemoryStediClient(options?)` returns a client that satisfies the exact
92
+ same `StediClient` contract as `createStediClient`, but never touches the network:
93
+ writes (`provider.create`, `enrollment.create`, …) land in an in-memory store and
94
+ reads come back from it. Use it to exercise provider/enrollment flows in tests and
95
+ local/dev runs without creating real records in Stedi.
96
+
97
+ ```typescript
98
+ import {
99
+ createInMemoryStediClient,
100
+ createInMemoryStediStore,
101
+ } from '@fincuratech/stedi-sdk-js';
102
+
103
+ // A shared store gives several clients read-after-write consistency
104
+ const store = createInMemoryStediStore();
105
+ const stedi = createInMemoryStediClient({ store });
106
+
107
+ const provider = await stedi.provider.create({
108
+ name: 'Main Street Medical Clinic',
109
+ npi: '1234567890',
110
+ taxId: '123456789',
111
+ taxIdType: 'EIN',
112
+ contacts: [],
113
+ });
114
+
115
+ await stedi.provider.get(provider.id); // resolves from memory
116
+ ```
117
+
118
+ Everything consumer-specific is injected through `options` (`store`, `seedPayers`,
119
+ `buildEligibilityResponse`, `buildTransactionPage`, `now`); the SDK ships only
120
+ generic, environment-agnostic defaults. **Deciding when to use the real client vs.
121
+ the in-memory one, and providing realistic business fixtures, remains entirely the
122
+ consumer's responsibility** — the SDK has no notion of your environment or payers.
123
+
88
124
  ## API Reference
89
125
 
90
126
  ### Eligibility
@@ -0,0 +1,228 @@
1
+ import { StediApiError } from './lib/errors.js';
2
+ const PLACEHOLDER_EDI = 'ISA*00* *00* *ZZ*INMEMORY *ZZ*INMEMORY *250101*0000*^*00501*000000001*0*T*:~' +
3
+ 'GS*HB*INMEMORY*INMEMORY*20250101*0000*1*X*005010X279A1~' +
4
+ 'ST*271*0001~SE*1*0001~GE*1*1~IEA*1*000000001~';
5
+ const DEFAULT_SEED_PAYERS = [
6
+ {
7
+ aliases: ['INMEMORY', 'IMHP'],
8
+ coverageTypes: ['medical'],
9
+ displayName: 'In-Memory Health Plan',
10
+ names: ['In-Memory Health Plan'],
11
+ primaryPayerId: '00001',
12
+ stediId: 'INMEMORY001',
13
+ transactionSupport: {
14
+ claimPayment: 'SUPPORTED',
15
+ claimStatus: 'SUPPORTED',
16
+ claimSubmission: 'SUPPORTED',
17
+ coordinationOfBenefits: 'SUPPORTED',
18
+ eligibilityCheck: 'SUPPORTED',
19
+ institutionalClaimSubmission: 'SUPPORTED',
20
+ professionalClaimSubmission: 'SUPPORTED',
21
+ },
22
+ },
23
+ {
24
+ aliases: ['EXAMPLE', 'EIC'],
25
+ coverageTypes: ['medical'],
26
+ displayName: 'Example Insurance Company',
27
+ names: ['Example Insurance Company'],
28
+ primaryPayerId: '00002',
29
+ stediId: 'INMEMORY002',
30
+ transactionSupport: {
31
+ claimPayment: 'SUPPORTED',
32
+ claimStatus: 'SUPPORTED',
33
+ claimSubmission: 'SUPPORTED',
34
+ coordinationOfBenefits: 'SUPPORTED',
35
+ eligibilityCheck: 'SUPPORTED',
36
+ institutionalClaimSubmission: 'SUPPORTED',
37
+ professionalClaimSubmission: 'SUPPORTED',
38
+ },
39
+ },
40
+ ];
41
+ const defaultBuildEligibilityResponse = (input) => ({
42
+ benefitsInformation: [],
43
+ controlNumber: input.controlNumber,
44
+ eligibilitySearchId: `in-memory-eligibility-${input.controlNumber}`,
45
+ errors: [],
46
+ meta: {
47
+ applicationMode: 'inmemory',
48
+ outboundTraceId: `in-memory-${input.controlNumber}`,
49
+ senderId: 'in-memory',
50
+ submitterId: 'in-memory',
51
+ traceId: `in-memory-${input.controlNumber}`,
52
+ },
53
+ payer: {},
54
+ planDateInformation: {},
55
+ planInformation: {},
56
+ provider: {
57
+ entityIdentifier: '',
58
+ entityType: '',
59
+ npi: input.provider.npi,
60
+ providerName: input.provider.organizationName,
61
+ },
62
+ reassociationKey: `in-memory-${input.controlNumber}`,
63
+ subscriber: {},
64
+ tradingPartnerServiceId: input.tradingPartnerServiceId,
65
+ });
66
+ const defaultBuildTransactionPage = () => ({
67
+ items: [],
68
+ });
69
+ export const createInMemoryStediStore = () => ({
70
+ enrollments: new Map(),
71
+ providers: new Map(),
72
+ });
73
+ export const clearInMemoryStediStore = (store) => {
74
+ store.enrollments.clear();
75
+ store.providers.clear();
76
+ };
77
+ export const createInMemoryStediClient = (options) => {
78
+ const store = options?.store ?? createInMemoryStediStore();
79
+ const seedPayers = options?.seedPayers ?? DEFAULT_SEED_PAYERS;
80
+ const buildEligibilityResponse = options?.buildEligibilityResponse ?? defaultBuildEligibilityResponse;
81
+ const buildTransactionPage = options?.buildTransactionPage ?? defaultBuildTransactionPage;
82
+ const now = options?.now ?? (() => new Date().toISOString());
83
+ return {
84
+ downloadFile: async () => PLACEHOLDER_EDI,
85
+ eligibility: {
86
+ check: async (input) => buildEligibilityResponse(input),
87
+ },
88
+ enrollment: {
89
+ create: async (input) => {
90
+ const id = `in-memory-enrollment-${input.provider.id}-${input.payer.idOrAlias}`;
91
+ const linkedProvider = store.providers.get(input.provider.id);
92
+ const existing = store.enrollments.get(id);
93
+ const timestamp = now();
94
+ const created = {
95
+ createdAt: existing?.createdAt ?? timestamp,
96
+ id,
97
+ payer: {
98
+ stediPayerId: input.payer.idOrAlias,
99
+ submittedPayerIdOrAlias: input.payer.idOrAlias,
100
+ },
101
+ primaryContact: input.primaryContact,
102
+ provider: {
103
+ id: input.provider.id,
104
+ name: linkedProvider?.name,
105
+ npi: linkedProvider?.npi,
106
+ taxId: linkedProvider?.taxId,
107
+ taxIdType: linkedProvider?.taxIdType,
108
+ },
109
+ source: input.source,
110
+ status: input.status,
111
+ transactions: input.transactions,
112
+ updatedAt: timestamp,
113
+ userEmail: input.userEmail,
114
+ };
115
+ store.enrollments.set(id, created);
116
+ return created;
117
+ },
118
+ get: async (enrollmentId) => {
119
+ const found = store.enrollments.get(enrollmentId);
120
+ if (!found) {
121
+ throw new StediApiError('Not found', 404, undefined);
122
+ }
123
+ return found;
124
+ },
125
+ list: async (params = {}) => {
126
+ const { payerIds, providerTaxIds, status } = params;
127
+ const items = [...store.enrollments.values()].filter((enrollment) => {
128
+ if (providerTaxIds &&
129
+ (enrollment.provider.taxId === undefined ||
130
+ !providerTaxIds.includes(enrollment.provider.taxId))) {
131
+ return false;
132
+ }
133
+ if (payerIds && !payerIds.includes(enrollment.payer.stediPayerId)) {
134
+ return false;
135
+ }
136
+ if (status && !status.includes(enrollment.status)) {
137
+ return false;
138
+ }
139
+ return true;
140
+ });
141
+ return { items, totalCount: items.length };
142
+ },
143
+ },
144
+ payers: {
145
+ get: async () => [...seedPayers],
146
+ search: async (queryParameters) => {
147
+ const query = typeof queryParameters.query === 'string'
148
+ ? queryParameters.query.toLowerCase()
149
+ : undefined;
150
+ const eligibilityCheck = typeof queryParameters.eligibilityCheck === 'string'
151
+ ? queryParameters.eligibilityCheck
152
+ : undefined;
153
+ return seedPayers.filter((payer) => {
154
+ if (query !== undefined) {
155
+ const haystack = [
156
+ payer.displayName,
157
+ payer.primaryPayerId,
158
+ payer.stediId,
159
+ ...payer.names,
160
+ ...payer.aliases,
161
+ ]
162
+ .join(' ')
163
+ .toLowerCase();
164
+ if (!haystack.includes(query)) {
165
+ return false;
166
+ }
167
+ }
168
+ if (eligibilityCheck !== undefined &&
169
+ payer.transactionSupport.eligibilityCheck !== eligibilityCheck) {
170
+ return false;
171
+ }
172
+ return true;
173
+ });
174
+ },
175
+ },
176
+ provider: {
177
+ create: async (input) => {
178
+ const id = `in-memory-provider-${input.npi}`;
179
+ const existing = store.providers.get(id);
180
+ if (existing) {
181
+ return existing;
182
+ }
183
+ const timestamp = now();
184
+ const created = {
185
+ contacts: input.contacts,
186
+ createdAt: timestamp,
187
+ id,
188
+ name: input.name,
189
+ npi: input.npi,
190
+ taxId: input.taxId,
191
+ taxIdType: input.taxIdType,
192
+ updatedAt: timestamp,
193
+ };
194
+ store.providers.set(id, created);
195
+ return created;
196
+ },
197
+ get: async (providerId) => {
198
+ const found = store.providers.get(providerId);
199
+ if (!found) {
200
+ throw new StediApiError('Not found', 404, undefined);
201
+ }
202
+ return found;
203
+ },
204
+ list: async (params = {}) => {
205
+ const { providerNpis, providerTaxIds } = params;
206
+ const items = [...store.providers.values()]
207
+ .filter((provider) => !providerNpis || providerNpis.includes(provider.npi))
208
+ .filter((provider) => !providerTaxIds || providerTaxIds.includes(provider.taxId))
209
+ .map((provider) => ({
210
+ id: provider.id,
211
+ name: provider.name,
212
+ npi: provider.npi,
213
+ taxId: provider.taxId,
214
+ taxIdType: provider.taxIdType,
215
+ }));
216
+ return { items };
217
+ },
218
+ },
219
+ transactions: {
220
+ get: async () => {
221
+ throw new StediApiError('Not found', 404, undefined);
222
+ },
223
+ list: async () => buildTransactionPage(),
224
+ search: async () => buildTransactionPage(),
225
+ },
226
+ };
227
+ };
228
+ //# sourceMappingURL=in-memory.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory.js","sourceRoot":"","sources":["../src/in-memory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AA6DhD,MAAM,eAAe,GACnB,8GAA8G;IAC9G,yDAAyD;IACzD,+CAA+C,CAAC;AAKlD,MAAM,mBAAmB,GAAqB;IAC5C;QACE,OAAO,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC;QAC7B,aAAa,EAAE,CAAC,SAAS,CAAC;QAC1B,WAAW,E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,QAAQ,CAAC,KAAK,CAAC,CAC7D;qBACA,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;oBAClB,EAAE,EAAE,QAAQ,CAAC,EAAE;oBACf,IAAI,EAAE,QAAQ,CAAC,IAAI;oBACnB,GAAG,EAAE,QAAQ,CAAC,GAAG;oBACjB,KAAK,EAAE,QAAQ,CAAC,KAAK;oBACrB,SAAS,EAAE,QAAQ,CAAC,SAAS;iBAC9B,CAAC,CAAC,CAAC;gBAEN,OAAO,EAAE,KAAK,EAAE,CAAC;YACnB,CAAC;SACF;QAED,YAAY,EAAE;YACZ,GAAG,EAAE,KAAK,IAA0C,EAAE;gBACpD,MAAM,IAAI,aAAa,CAAC,WAAW,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;YACvD,CAAC;YAED,IAAI,EAAE,KAAK,IAA2C,EAAE,CACtD,oBAAoB,EAAE;YAExB,MAAM,EAAE,KAAK,IAA2C,EAAE,CACxD,oBAAoB,EAAE;SACzB;KACF,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import { type StediClient } from './index.js';\nimport { StediApiError } from './lib/errors.js';\nimport {\n type StediEligibilityInput,\n type StediEligibilityResponse,\n type StediEnrollmentInput,\n type StediEnrollmentResponse,\n type StediListEnrollmentsParams,\n type StediListEnrollmentsResponse,\n type StediListProvidersParams,\n type StediPayerItem,\n type StediPayerResponse,\n type StediProviderInput,\n type StediProviderListResponse,\n type StediProviderResponse,\n type StediTransactionGetResponse,\n type StediTransactionListResponse,\n} from './lib/types.js';\n\n/**\n * In-memory storage backing a fake Stedi client.\n *\n * The store is the unit of read-after-write consistency: pass the same store to\n * several `createInMemoryStediClient` calls and they all observe the same data;\n * give each a fresh store (the default) and they stay isolated.\n *\n * @property enrollments - Created enrollments, keyed by their deterministic in-memory id.\n * @property providers - Created providers, keyed by their deterministic in-memory id.\n */\nexport type InMemoryStediStore = {\n enrollments: Map<string, StediEnrollmentResponse>;\n providers: Map<string, StediProviderResponse>;\n};\n\n/**\n * Options for {@link createInMemoryStediClient}. Everything specific to a\n * consumer (payers, fixtures, clock) is injected here; the SDK ships only\n * generic, environment-agnostic defaults.\n *\n * @property buildEligibilityResponse - Builds the response returned by `eligibility.check`. Defaults to a deterministic, schema-valid minimal response.\n * @property buildTransactionPage - Builds the page returned by `transactions.list` / `transactions.search`. Defaults to an empty page (`{ items: [] }`).\n * @property now - Clock used for deterministic `createdAt` / `updatedAt` timestamps. Defaults to `() => new Date().toISOString()`.\n * @property seedPayers - Payers returned by `payers.get` and filtered by `payers.search`. Defaults to a couple of generic, plausible payers.\n * @property store - Shared store enabling read-after-write consistency across clients. Defaults to a fresh, isolated store per call.\n */\nexport type InMemoryStediClientOptions = {\n buildEligibilityResponse?: (\n input: StediEligibilityInput,\n ) => StediEligibilityResponse;\n\n buildTransactionPage?: () => StediTransactionListResponse;\n\n now?: () => string;\n\n seedPayers?: StediPayerItem[];\n\n store?: InMemoryStediStore;\n};\n\n/**\n * Placeholder EDI payload returned by the in-memory `downloadFile`.\n */\nconst PLACEHOLDER_EDI =\n 'ISA*00* *00* *ZZ*INMEMORY *ZZ*INMEMORY *250101*0000*^*00501*000000001*0*T*:~' +\n 'GS*HB*INMEMORY*INMEMORY*20250101*0000*1*X*005010X279A1~' +\n 'ST*271*0001~SE*1*0001~GE*1*1~IEA*1*000000001~';\n\n/**\n * Generic, plausible payers used when no `seedPayers` are provided.\n */\nconst DEFAULT_SEED_PAYERS: StediPayerItem[] = [\n {\n aliases: ['INMEMORY', 'IMHP'],\n coverageTypes: ['medical'],\n displayName: 'In-Memory Health Plan',\n names: ['In-Memory Health Plan'],\n primaryPayerId: '00001',\n stediId: 'INMEMORY001',\n transactionSupport: {\n claimPayment: 'SUPPORTED',\n claimStatus: 'SUPPORTED',\n claimSubmission: 'SUPPORTED',\n coordinationOfBenefits: 'SUPPORTED',\n eligibilityCheck: 'SUPPORTED',\n institutionalClaimSubmission: 'SUPPORTED',\n professionalClaimSubmission: 'SUPPORTED',\n },\n },\n {\n aliases: ['EXAMPLE', 'EIC'],\n coverageTypes: ['medical'],\n displayName: 'Example Insurance Company',\n names: ['Example Insurance Company'],\n primaryPayerId: '00002',\n stediId: 'INMEMORY002',\n transactionSupport: {\n claimPayment: 'SUPPORTED',\n claimStatus: 'SUPPORTED',\n claimSubmission: 'SUPPORTED',\n coordinationOfBenefits: 'SUPPORTED',\n eligibilityCheck: 'SUPPORTED',\n institutionalClaimSubmission: 'SUPPORTED',\n professionalClaimSubmission: 'SUPPORTED',\n },\n },\n];\n\n/**\n * Deterministic, schema-valid minimal eligibility response derived from the input.\n *\n * @param input - The eligibility check parameters.\n * @returns A minimal {@link StediEligibilityResponse}.\n */\nconst defaultBuildEligibilityResponse = (\n input: StediEligibilityInput,\n): StediEligibilityResponse => ({\n benefitsInformation: [],\n controlNumber: input.controlNumber,\n eligibilitySearchId: `in-memory-eligibility-${input.controlNumber}`,\n errors: [],\n meta: {\n applicationMode: 'inmemory',\n outboundTraceId: `in-memory-${input.controlNumber}`,\n senderId: 'in-memory',\n submitterId: 'in-memory',\n traceId: `in-memory-${input.controlNumber}`,\n },\n payer: {},\n planDateInformation: {},\n planInformation: {},\n provider: {\n entityIdentifier: '',\n entityType: '',\n npi: input.provider.npi,\n providerName: input.provider.organizationName,\n },\n reassociationKey: `in-memory-${input.controlNumber}`,\n subscriber: {},\n tradingPartnerServiceId: input.tradingPartnerServiceId,\n});\n\n/**\n * Empty transaction page used when no `buildTransactionPage` is provided.\n *\n * @returns An empty {@link StediTransactionListResponse}.\n */\nconst defaultBuildTransactionPage = (): StediTransactionListResponse => ({\n items: [],\n});\n\n/**\n * Create an empty, isolated in-memory store.\n *\n * @returns A fresh {@link InMemoryStediStore}.\n */\nexport const createInMemoryStediStore = (): InMemoryStediStore => ({\n enrollments: new Map(),\n providers: new Map(),\n});\n\n/**\n * Clear every entity from a store in place.\n *\n * Optional convenience for reusing a single shared store across test cases.\n * Creating a fresh store with {@link createInMemoryStediStore} is the primary\n * way to isolate state.\n *\n * @param store - The store to clear.\n */\nexport const clearInMemoryStediStore = (store: InMemoryStediStore): void => {\n store.enrollments.clear();\n store.providers.clear();\n};\n\n/**\n * Create an in-memory double of the Stedi client.\n *\n * The returned client satisfies the exact {@link StediClient} contract but never\n * performs any network or filesystem I/O: writes land in the injected (or\n * default) {@link InMemoryStediStore} and reads come back from it. It carries no\n * notion of environment, production, or any consumer-specific data — the\n * real-vs-fake decision and business fixtures remain the consumer's\n * responsibility.\n *\n * @param [options] - Store, seed payers, response builders and clock overrides.\n * @returns A {@link StediClient} backed entirely by memory.\n */\nexport const createInMemoryStediClient = (\n options?: InMemoryStediClientOptions,\n): StediClient => {\n const store = options?.store ?? createInMemoryStediStore();\n const seedPayers = options?.seedPayers ?? DEFAULT_SEED_PAYERS;\n const buildEligibilityResponse =\n options?.buildEligibilityResponse ?? defaultBuildEligibilityResponse;\n const buildTransactionPage =\n options?.buildTransactionPage ?? defaultBuildTransactionPage;\n const now = options?.now ?? (() => new Date().toISOString());\n\n return {\n downloadFile: async (): Promise<string> => PLACEHOLDER_EDI,\n\n eligibility: {\n check: async (\n input: StediEligibilityInput,\n ): Promise<StediEligibilityResponse> => buildEligibilityResponse(input),\n },\n\n enrollment: {\n create: async (\n input: StediEnrollmentInput,\n ): Promise<StediEnrollmentResponse> => {\n const id = `in-memory-enrollment-${input.provider.id}-${input.payer.idOrAlias}`;\n const linkedProvider = store.providers.get(input.provider.id);\n const existing = store.enrollments.get(id);\n const timestamp = now();\n\n const created: StediEnrollmentResponse = {\n createdAt: existing?.createdAt ?? timestamp,\n id,\n payer: {\n stediPayerId: input.payer.idOrAlias,\n submittedPayerIdOrAlias: input.payer.idOrAlias,\n },\n primaryContact: input.primaryContact,\n provider: {\n id: input.provider.id,\n name: linkedProvider?.name,\n npi: linkedProvider?.npi,\n taxId: linkedProvider?.taxId,\n taxIdType: linkedProvider?.taxIdType,\n },\n source: input.source,\n status: input.status,\n transactions: input.transactions,\n updatedAt: timestamp,\n userEmail: input.userEmail,\n };\n\n store.enrollments.set(id, created);\n\n return created;\n },\n\n get: async (enrollmentId: string): Promise<StediEnrollmentResponse> => {\n const found = store.enrollments.get(enrollmentId);\n\n if (!found) {\n throw new StediApiError('Not found', 404, undefined);\n }\n\n return found;\n },\n\n list: async (\n params: StediListEnrollmentsParams = {},\n ): Promise<StediListEnrollmentsResponse> => {\n const { payerIds, providerTaxIds, status } = params;\n\n const items = [...store.enrollments.values()].filter((enrollment) => {\n if (\n providerTaxIds &&\n (enrollment.provider.taxId === undefined ||\n !providerTaxIds.includes(enrollment.provider.taxId))\n ) {\n return false;\n }\n\n if (payerIds && !payerIds.includes(enrollment.payer.stediPayerId)) {\n return false;\n }\n\n if (status && !status.includes(enrollment.status)) {\n return false;\n }\n\n return true;\n });\n\n return { items, totalCount: items.length };\n },\n },\n\n payers: {\n get: async (): Promise<StediPayerResponse['items']> => [...seedPayers],\n\n search: async (\n queryParameters: Record<string, string[] | number | string>,\n ): Promise<StediPayerResponse['items']> => {\n const query =\n typeof queryParameters.query === 'string'\n ? queryParameters.query.toLowerCase()\n : undefined;\n const eligibilityCheck =\n typeof queryParameters.eligibilityCheck === 'string'\n ? queryParameters.eligibilityCheck\n : undefined;\n\n return seedPayers.filter((payer) => {\n if (query !== undefined) {\n const haystack = [\n payer.displayName,\n payer.primaryPayerId,\n payer.stediId,\n ...payer.names,\n ...payer.aliases,\n ]\n .join(' ')\n .toLowerCase();\n\n if (!haystack.includes(query)) {\n return false;\n }\n }\n\n if (\n eligibilityCheck !== undefined &&\n payer.transactionSupport.eligibilityCheck !== eligibilityCheck\n ) {\n return false;\n }\n\n return true;\n });\n },\n },\n\n provider: {\n create: async (\n input: StediProviderInput,\n ): Promise<StediProviderResponse> => {\n const id = `in-memory-provider-${input.npi}`;\n const existing = store.providers.get(id);\n\n // Idempotent on duplicate NPI: same id, no double entry. Mirrors\n // Stedi's 409-on-duplicate semantics by returning the existing record.\n if (existing) {\n return existing;\n }\n\n const timestamp = now();\n const created: StediProviderResponse = {\n contacts: input.contacts,\n createdAt: timestamp,\n id,\n name: input.name,\n npi: input.npi,\n taxId: input.taxId,\n taxIdType: input.taxIdType,\n updatedAt: timestamp,\n };\n\n store.providers.set(id, created);\n\n return created;\n },\n\n get: async (providerId: string): Promise<StediProviderResponse> => {\n const found = store.providers.get(providerId);\n\n if (!found) {\n throw new StediApiError('Not found', 404, undefined);\n }\n\n return found;\n },\n\n list: async (\n params: StediListProvidersParams = {},\n ): Promise<StediProviderListResponse> => {\n const { providerNpis, providerTaxIds } = params;\n\n const items = [...store.providers.values()]\n .filter(\n (provider) => !providerNpis || providerNpis.includes(provider.npi),\n )\n .filter(\n (provider) =>\n !providerTaxIds || providerTaxIds.includes(provider.taxId),\n )\n .map((provider) => ({\n id: provider.id,\n name: provider.name,\n npi: provider.npi,\n taxId: provider.taxId,\n taxIdType: provider.taxIdType,\n }));\n\n return { items };\n },\n },\n\n transactions: {\n get: async (): Promise<StediTransactionGetResponse> => {\n throw new StediApiError('Not found', 404, undefined);\n },\n\n list: async (): Promise<StediTransactionListResponse> =>\n buildTransactionPage(),\n\n search: async (): Promise<StediTransactionListResponse> =>\n buildTransactionPage(),\n },\n };\n};\n"]}
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@ import { payers } from './endpoints/payers.js';
4
4
  import { provider } from './endpoints/provider.js';
5
5
  import { transactions } from './endpoints/transactions.js';
6
6
  import { stediClient } from './lib/client.js';
7
+ export { clearInMemoryStediStore, createInMemoryStediClient, createInMemoryStediStore, } from './in-memory.js';
7
8
  export { StediApiError } from './lib/errors.js';
8
9
  export { createConsoleLogger, createNoOpLogger, setLogger, } from './lib/logger.js';
9
10
  export * from './lib/types.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EAAE,aAAa,EAAuB,MAAM,iBAAiB,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAEhB,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAE/B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,EAAE;IAClD,MAAM,WAAW,GAAG,sCAAsC,CAAC;IAC3D,MAAM,iBAAiB,GAAG,4CAA4C,CAAC;IACvE,MAAM,kBAAkB,GAAG,6CAA6C,CAAC;IAEzE,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,OAAO;QACL,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC;QACnD,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,kBAAkB,CAAC;QAClD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC;QACzC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;QAC9C,YAAY,EAAE,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC;KAChD,CAAC;AACJ,CAAC,CAAC;AAIF,eAAe,iBAAiB,CAAC","sourcesContent":["import { eligibility } from './endpoints/eligibility.js';\nimport { enrollment } from './endpoints/enrollment.js';\nimport { payers } from './endpoints/payers.js';\nimport { provider } from './endpoints/provider.js';\nimport { transactions } from './endpoints/transactions.js';\nimport { stediClient } from './lib/client.js';\n\nexport { StediApiError, type StediErrorBody } from './lib/errors.js';\nexport {\n createConsoleLogger,\n createNoOpLogger,\n type Logger,\n setLogger,\n} from './lib/logger.js';\nexport * from './lib/types.js';\n\nexport const createStediClient = (apiKey: string) => {\n const coreBaseUrl = 'https://core.us.stedi.com/2023-08-01';\n const healthcareBaseUrl = 'https://healthcare.us.stedi.com/2024-04-01';\n const enrollmentsBaseUrl = 'https://enrollments.us.stedi.com/2024-09-01';\n\n const client = stediClient(apiKey);\n return {\n downloadFile: client.downloadFile,\n eligibility: eligibility(client, healthcareBaseUrl),\n enrollment: enrollment(client, enrollmentsBaseUrl),\n payers: payers(client, healthcareBaseUrl),\n provider: provider(client, enrollmentsBaseUrl),\n transactions: transactions(client, coreBaseUrl),\n };\n};\n\nexport type StediClient = ReturnType<typeof createStediClient>;\n\nexport default createStediClient;\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,GAGzB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAuB,MAAM,iBAAiB,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAEhB,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAE/B,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAAc,EAAE,EAAE;IAClD,MAAM,WAAW,GAAG,sCAAsC,CAAC;IAC3D,MAAM,iBAAiB,GAAG,4CAA4C,CAAC;IACvE,MAAM,kBAAkB,GAAG,6CAA6C,CAAC;IAEzE,MAAM,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACnC,OAAO;QACL,YAAY,EAAE,MAAM,CAAC,YAAY;QACjC,WAAW,EAAE,WAAW,CAAC,MAAM,EAAE,iBAAiB,CAAC;QACnD,UAAU,EAAE,UAAU,CAAC,MAAM,EAAE,kBAAkB,CAAC;QAClD,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC;QACzC,QAAQ,EAAE,QAAQ,CAAC,MAAM,EAAE,kBAAkB,CAAC;QAC9C,YAAY,EAAE,YAAY,CAAC,MAAM,EAAE,WAAW,CAAC;KAChD,CAAC;AACJ,CAAC,CAAC;AAIF,eAAe,iBAAiB,CAAC","sourcesContent":["import { eligibility } from './endpoints/eligibility.js';\nimport { enrollment } from './endpoints/enrollment.js';\nimport { payers } from './endpoints/payers.js';\nimport { provider } from './endpoints/provider.js';\nimport { transactions } from './endpoints/transactions.js';\nimport { stediClient } from './lib/client.js';\n\nexport {\n clearInMemoryStediStore,\n createInMemoryStediClient,\n createInMemoryStediStore,\n type InMemoryStediClientOptions,\n type InMemoryStediStore,\n} from './in-memory.js';\nexport { StediApiError, type StediErrorBody } from './lib/errors.js';\nexport {\n createConsoleLogger,\n createNoOpLogger,\n type Logger,\n setLogger,\n} from './lib/logger.js';\nexport * from './lib/types.js';\n\nexport const createStediClient = (apiKey: string) => {\n const coreBaseUrl = 'https://core.us.stedi.com/2023-08-01';\n const healthcareBaseUrl = 'https://healthcare.us.stedi.com/2024-04-01';\n const enrollmentsBaseUrl = 'https://enrollments.us.stedi.com/2024-09-01';\n\n const client = stediClient(apiKey);\n return {\n downloadFile: client.downloadFile,\n eligibility: eligibility(client, healthcareBaseUrl),\n enrollment: enrollment(client, enrollmentsBaseUrl),\n payers: payers(client, healthcareBaseUrl),\n provider: provider(client, enrollmentsBaseUrl),\n transactions: transactions(client, coreBaseUrl),\n };\n};\n\nexport type StediClient = ReturnType<typeof createStediClient>;\n\nexport default createStediClient;\n"]}
@@ -0,0 +1,17 @@
1
+ import { type StediClient } from './index.js';
2
+ import { type StediEligibilityInput, type StediEligibilityResponse, type StediEnrollmentResponse, type StediPayerItem, type StediProviderResponse, type StediTransactionListResponse } from './lib/types.js';
3
+ export type InMemoryStediStore = {
4
+ enrollments: Map<string, StediEnrollmentResponse>;
5
+ providers: Map<string, StediProviderResponse>;
6
+ };
7
+ export type InMemoryStediClientOptions = {
8
+ buildEligibilityResponse?: (input: StediEligibilityInput) => StediEligibilityResponse;
9
+ buildTransactionPage?: () => StediTransactionListResponse;
10
+ now?: () => string;
11
+ seedPayers?: StediPayerItem[];
12
+ store?: InMemoryStediStore;
13
+ };
14
+ export declare const createInMemoryStediStore: () => InMemoryStediStore;
15
+ export declare const clearInMemoryStediStore: (store: InMemoryStediStore) => void;
16
+ export declare const createInMemoryStediClient: (options?: InMemoryStediClientOptions) => StediClient;
17
+ //# sourceMappingURL=in-memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"in-memory.d.ts","sourceRoot":"","sources":["../../src/in-memory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAE7B,KAAK,uBAAuB,EAI5B,KAAK,cAAc,EAInB,KAAK,qBAAqB,EAE1B,KAAK,4BAA4B,EAClC,MAAM,gBAAgB,CAAC;AAYxB,MAAM,MAAM,kBAAkB,GAAG;IAC/B,WAAW,EAAE,GAAG,CAAC,MAAM,EAAE,uBAAuB,CAAC,CAAC;IAClD,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,CAAC;CAC/C,CAAC;AAaF,MAAM,MAAM,0BAA0B,GAAG;IACvC,wBAAwB,CAAC,EAAE,CACzB,KAAK,EAAE,qBAAqB,KACzB,wBAAwB,CAAC;IAE9B,oBAAoB,CAAC,EAAE,MAAM,4BAA4B,CAAC;IAE1D,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IAEnB,UAAU,CAAC,EAAE,cAAc,EAAE,CAAC;IAE9B,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B,CAAC;AAkGF,eAAO,MAAM,wBAAwB,QAAO,kBAG1C,CAAC;AAWH,eAAO,MAAM,uBAAuB,GAAI,OAAO,kBAAkB,KAAG,IAGnE,CAAC;AAeF,eAAO,MAAM,yBAAyB,GACpC,UAAU,0BAA0B,KACnC,WAsNF,CAAC"}
@@ -1,3 +1,4 @@
1
+ export { clearInMemoryStediStore, createInMemoryStediClient, createInMemoryStediStore, type InMemoryStediClientOptions, type InMemoryStediStore, } from './in-memory.js';
1
2
  export { StediApiError, type StediErrorBody } from './lib/errors.js';
2
3
  export { createConsoleLogger, createNoOpLogger, type Logger, setLogger, } from './lib/logger.js';
3
4
  export * from './lib/types.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,MAAM,EACX,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAE/B,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM;;;;;;;;;;;;;;;;;;;;;;oBAW3B,CAAC;qBAA2B,CAAC;;;8BAQwW,CAAC;;;CAL1Z,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE/D,eAAe,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAOA,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,KAAK,0BAA0B,EAC/B,KAAK,kBAAkB,GACxB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACrE,OAAO,EACL,mBAAmB,EACnB,gBAAgB,EAChB,KAAK,MAAM,EACX,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,cAAc,gBAAgB,CAAC;AAE/B,eAAO,MAAM,iBAAiB,GAAI,QAAQ,MAAM;;;;;;;;;;;;;;;;;;;;;;oBAQ5C,CAAF;qBAA2B,CAAC;;;8BAWwM,CAAC;;;CALtO,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE/D,eAAe,iBAAiB,CAAC"}
package/package.json CHANGED
@@ -43,5 +43,5 @@
43
43
  },
44
44
  "type": "module",
45
45
  "types": "dist/types/index.d.ts",
46
- "version": "1.5.0"
46
+ "version": "1.6.0"
47
47
  }