@greensecurity/javascript-sdk 0.12.1 → 0.13.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/bin/mcp-server.js +196 -48
- package/bin/mcp-server.js.map +11 -10
- package/jsr.json +1 -1
- package/lib/config.d.ts +3 -3
- package/lib/config.js +3 -3
- package/mcp-server/mcp-server.js +1 -1
- package/mcp-server/server.js +1 -1
- package/models/components/company.d.ts +177 -0
- package/models/components/company.d.ts.map +1 -0
- package/models/components/company.js +270 -0
- package/models/components/company.js.map +1 -0
- package/models/components/facility.d.ts +15 -15
- package/models/components/facility.d.ts.map +1 -1
- package/models/components/facility.js +18 -18
- package/models/components/facility.js.map +1 -1
- package/models/components/index.d.ts +1 -0
- package/models/components/index.d.ts.map +1 -1
- package/models/components/index.js +1 -0
- package/models/components/index.js.map +1 -1
- package/models/components/user.d.ts +6 -0
- package/models/components/user.d.ts.map +1 -1
- package/models/components/user.js +3 -0
- package/models/components/user.js.map +1 -1
- package/package.json +1 -5
- package/src/lib/config.ts +3 -3
- package/src/mcp-server/mcp-server.ts +1 -1
- package/src/mcp-server/server.ts +1 -1
- package/src/models/components/company.ts +403 -0
- package/src/models/components/facility.ts +28 -24
- package/src/models/components/index.ts +1 -0
- package/src/models/components/user.ts +13 -0
- package/src/__tests__/assertions.ts +0 -13
- package/src/__tests__/files.ts +0 -56
- package/src/__tests__/organizations.test.ts +0 -244
- package/src/__tests__/testclient.ts +0 -48
- package/src/__tests__/user.test.ts +0 -200
- package/src/__tests__/vendors.test.ts +0 -65
|
@@ -0,0 +1,403 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { remap as remap$ } from "../../lib/primitives.js";
|
|
7
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { RFCDate } from "../../types/rfcdate.js";
|
|
10
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
|
|
12
|
+
export type Location = {
|
|
13
|
+
address: string | null;
|
|
14
|
+
phone?: string | null | undefined;
|
|
15
|
+
city?: string | null | undefined;
|
|
16
|
+
state?: string | null | undefined;
|
|
17
|
+
zip?: string | null | undefined;
|
|
18
|
+
country?: string | null | undefined;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export type CompanyContact = {
|
|
22
|
+
name: string | null;
|
|
23
|
+
email?: string | null | undefined;
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
export type Tax = {
|
|
27
|
+
taxId: string | null;
|
|
28
|
+
taxExempt?: boolean | null | undefined;
|
|
29
|
+
taxExemptCode?: string | null | undefined;
|
|
30
|
+
w9FileName?: string | null | undefined;
|
|
31
|
+
w9ContentType?: string | null | undefined;
|
|
32
|
+
w9FileSize?: string | null | undefined;
|
|
33
|
+
w9UpdatedAt?: RFCDate | null | undefined;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export type Stats = {
|
|
37
|
+
vendorInactiveCount?: number | null | undefined;
|
|
38
|
+
vendorActiveCount?: number | null | undefined;
|
|
39
|
+
facilityTargetedCount?: number | null | undefined;
|
|
40
|
+
facilityApprovedCount?: number | null | undefined;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A simplified representation of a Company, typically used in list views.
|
|
45
|
+
*/
|
|
46
|
+
export type Company = {
|
|
47
|
+
id: number;
|
|
48
|
+
name: string | null;
|
|
49
|
+
status?: string | null | undefined;
|
|
50
|
+
creditBalance?: string | null | undefined;
|
|
51
|
+
location?: Location | null | undefined;
|
|
52
|
+
contact?: CompanyContact | undefined;
|
|
53
|
+
tax?: Tax | undefined;
|
|
54
|
+
stats?: Stats | undefined;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/** @internal */
|
|
58
|
+
export const Location$inboundSchema: z.ZodType<
|
|
59
|
+
Location,
|
|
60
|
+
z.ZodTypeDef,
|
|
61
|
+
unknown
|
|
62
|
+
> = z.object({
|
|
63
|
+
address: z.nullable(z.string()),
|
|
64
|
+
phone: z.nullable(z.string()).optional(),
|
|
65
|
+
city: z.nullable(z.string()).optional(),
|
|
66
|
+
state: z.nullable(z.string()).optional(),
|
|
67
|
+
zip: z.nullable(z.string()).optional(),
|
|
68
|
+
country: z.nullable(z.string()).optional(),
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
/** @internal */
|
|
72
|
+
export type Location$Outbound = {
|
|
73
|
+
address: string | null;
|
|
74
|
+
phone?: string | null | undefined;
|
|
75
|
+
city?: string | null | undefined;
|
|
76
|
+
state?: string | null | undefined;
|
|
77
|
+
zip?: string | null | undefined;
|
|
78
|
+
country?: string | null | undefined;
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
/** @internal */
|
|
82
|
+
export const Location$outboundSchema: z.ZodType<
|
|
83
|
+
Location$Outbound,
|
|
84
|
+
z.ZodTypeDef,
|
|
85
|
+
Location
|
|
86
|
+
> = z.object({
|
|
87
|
+
address: z.nullable(z.string()),
|
|
88
|
+
phone: z.nullable(z.string()).optional(),
|
|
89
|
+
city: z.nullable(z.string()).optional(),
|
|
90
|
+
state: z.nullable(z.string()).optional(),
|
|
91
|
+
zip: z.nullable(z.string()).optional(),
|
|
92
|
+
country: z.nullable(z.string()).optional(),
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* @internal
|
|
97
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
98
|
+
*/
|
|
99
|
+
export namespace Location$ {
|
|
100
|
+
/** @deprecated use `Location$inboundSchema` instead. */
|
|
101
|
+
export const inboundSchema = Location$inboundSchema;
|
|
102
|
+
/** @deprecated use `Location$outboundSchema` instead. */
|
|
103
|
+
export const outboundSchema = Location$outboundSchema;
|
|
104
|
+
/** @deprecated use `Location$Outbound` instead. */
|
|
105
|
+
export type Outbound = Location$Outbound;
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export function locationToJSON(location: Location): string {
|
|
109
|
+
return JSON.stringify(Location$outboundSchema.parse(location));
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function locationFromJSON(
|
|
113
|
+
jsonString: string,
|
|
114
|
+
): SafeParseResult<Location, SDKValidationError> {
|
|
115
|
+
return safeParse(
|
|
116
|
+
jsonString,
|
|
117
|
+
(x) => Location$inboundSchema.parse(JSON.parse(x)),
|
|
118
|
+
`Failed to parse 'Location' from JSON`,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/** @internal */
|
|
123
|
+
export const CompanyContact$inboundSchema: z.ZodType<
|
|
124
|
+
CompanyContact,
|
|
125
|
+
z.ZodTypeDef,
|
|
126
|
+
unknown
|
|
127
|
+
> = z.object({
|
|
128
|
+
name: z.nullable(z.string()),
|
|
129
|
+
email: z.nullable(z.string()).optional(),
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
/** @internal */
|
|
133
|
+
export type CompanyContact$Outbound = {
|
|
134
|
+
name: string | null;
|
|
135
|
+
email?: string | null | undefined;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
/** @internal */
|
|
139
|
+
export const CompanyContact$outboundSchema: z.ZodType<
|
|
140
|
+
CompanyContact$Outbound,
|
|
141
|
+
z.ZodTypeDef,
|
|
142
|
+
CompanyContact
|
|
143
|
+
> = z.object({
|
|
144
|
+
name: z.nullable(z.string()),
|
|
145
|
+
email: z.nullable(z.string()).optional(),
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
/**
|
|
149
|
+
* @internal
|
|
150
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
151
|
+
*/
|
|
152
|
+
export namespace CompanyContact$ {
|
|
153
|
+
/** @deprecated use `CompanyContact$inboundSchema` instead. */
|
|
154
|
+
export const inboundSchema = CompanyContact$inboundSchema;
|
|
155
|
+
/** @deprecated use `CompanyContact$outboundSchema` instead. */
|
|
156
|
+
export const outboundSchema = CompanyContact$outboundSchema;
|
|
157
|
+
/** @deprecated use `CompanyContact$Outbound` instead. */
|
|
158
|
+
export type Outbound = CompanyContact$Outbound;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export function companyContactToJSON(companyContact: CompanyContact): string {
|
|
162
|
+
return JSON.stringify(CompanyContact$outboundSchema.parse(companyContact));
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
export function companyContactFromJSON(
|
|
166
|
+
jsonString: string,
|
|
167
|
+
): SafeParseResult<CompanyContact, SDKValidationError> {
|
|
168
|
+
return safeParse(
|
|
169
|
+
jsonString,
|
|
170
|
+
(x) => CompanyContact$inboundSchema.parse(JSON.parse(x)),
|
|
171
|
+
`Failed to parse 'CompanyContact' from JSON`,
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/** @internal */
|
|
176
|
+
export const Tax$inboundSchema: z.ZodType<Tax, z.ZodTypeDef, unknown> = z
|
|
177
|
+
.object({
|
|
178
|
+
tax_id: z.nullable(z.string()),
|
|
179
|
+
tax_exempt: z.nullable(z.boolean()).optional(),
|
|
180
|
+
tax_exempt_code: z.nullable(z.string()).optional(),
|
|
181
|
+
w9_file_name: z.nullable(z.string()).optional(),
|
|
182
|
+
w9_content_type: z.nullable(z.string()).optional(),
|
|
183
|
+
w9_file_size: z.nullable(z.string()).optional(),
|
|
184
|
+
w9_updated_at: z.nullable(z.string().transform(v => new RFCDate(v)))
|
|
185
|
+
.optional(),
|
|
186
|
+
}).transform((v) => {
|
|
187
|
+
return remap$(v, {
|
|
188
|
+
"tax_id": "taxId",
|
|
189
|
+
"tax_exempt": "taxExempt",
|
|
190
|
+
"tax_exempt_code": "taxExemptCode",
|
|
191
|
+
"w9_file_name": "w9FileName",
|
|
192
|
+
"w9_content_type": "w9ContentType",
|
|
193
|
+
"w9_file_size": "w9FileSize",
|
|
194
|
+
"w9_updated_at": "w9UpdatedAt",
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
/** @internal */
|
|
199
|
+
export type Tax$Outbound = {
|
|
200
|
+
tax_id: string | null;
|
|
201
|
+
tax_exempt?: boolean | null | undefined;
|
|
202
|
+
tax_exempt_code?: string | null | undefined;
|
|
203
|
+
w9_file_name?: string | null | undefined;
|
|
204
|
+
w9_content_type?: string | null | undefined;
|
|
205
|
+
w9_file_size?: string | null | undefined;
|
|
206
|
+
w9_updated_at?: string | null | undefined;
|
|
207
|
+
};
|
|
208
|
+
|
|
209
|
+
/** @internal */
|
|
210
|
+
export const Tax$outboundSchema: z.ZodType<Tax$Outbound, z.ZodTypeDef, Tax> = z
|
|
211
|
+
.object({
|
|
212
|
+
taxId: z.nullable(z.string()),
|
|
213
|
+
taxExempt: z.nullable(z.boolean()).optional(),
|
|
214
|
+
taxExemptCode: z.nullable(z.string()).optional(),
|
|
215
|
+
w9FileName: z.nullable(z.string()).optional(),
|
|
216
|
+
w9ContentType: z.nullable(z.string()).optional(),
|
|
217
|
+
w9FileSize: z.nullable(z.string()).optional(),
|
|
218
|
+
w9UpdatedAt: z.nullable(z.instanceof(RFCDate).transform(v => v.toString()))
|
|
219
|
+
.optional(),
|
|
220
|
+
}).transform((v) => {
|
|
221
|
+
return remap$(v, {
|
|
222
|
+
taxId: "tax_id",
|
|
223
|
+
taxExempt: "tax_exempt",
|
|
224
|
+
taxExemptCode: "tax_exempt_code",
|
|
225
|
+
w9FileName: "w9_file_name",
|
|
226
|
+
w9ContentType: "w9_content_type",
|
|
227
|
+
w9FileSize: "w9_file_size",
|
|
228
|
+
w9UpdatedAt: "w9_updated_at",
|
|
229
|
+
});
|
|
230
|
+
});
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* @internal
|
|
234
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
235
|
+
*/
|
|
236
|
+
export namespace Tax$ {
|
|
237
|
+
/** @deprecated use `Tax$inboundSchema` instead. */
|
|
238
|
+
export const inboundSchema = Tax$inboundSchema;
|
|
239
|
+
/** @deprecated use `Tax$outboundSchema` instead. */
|
|
240
|
+
export const outboundSchema = Tax$outboundSchema;
|
|
241
|
+
/** @deprecated use `Tax$Outbound` instead. */
|
|
242
|
+
export type Outbound = Tax$Outbound;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export function taxToJSON(tax: Tax): string {
|
|
246
|
+
return JSON.stringify(Tax$outboundSchema.parse(tax));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
export function taxFromJSON(
|
|
250
|
+
jsonString: string,
|
|
251
|
+
): SafeParseResult<Tax, SDKValidationError> {
|
|
252
|
+
return safeParse(
|
|
253
|
+
jsonString,
|
|
254
|
+
(x) => Tax$inboundSchema.parse(JSON.parse(x)),
|
|
255
|
+
`Failed to parse 'Tax' from JSON`,
|
|
256
|
+
);
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/** @internal */
|
|
260
|
+
export const Stats$inboundSchema: z.ZodType<Stats, z.ZodTypeDef, unknown> = z
|
|
261
|
+
.object({
|
|
262
|
+
vendor_inactive_count: z.nullable(z.number().int()).optional(),
|
|
263
|
+
vendor_active_count: z.nullable(z.number().int()).optional(),
|
|
264
|
+
facility_targeted_count: z.nullable(z.number().int()).optional(),
|
|
265
|
+
facility_approved_count: z.nullable(z.number().int()).optional(),
|
|
266
|
+
}).transform((v) => {
|
|
267
|
+
return remap$(v, {
|
|
268
|
+
"vendor_inactive_count": "vendorInactiveCount",
|
|
269
|
+
"vendor_active_count": "vendorActiveCount",
|
|
270
|
+
"facility_targeted_count": "facilityTargetedCount",
|
|
271
|
+
"facility_approved_count": "facilityApprovedCount",
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
|
|
275
|
+
/** @internal */
|
|
276
|
+
export type Stats$Outbound = {
|
|
277
|
+
vendor_inactive_count?: number | null | undefined;
|
|
278
|
+
vendor_active_count?: number | null | undefined;
|
|
279
|
+
facility_targeted_count?: number | null | undefined;
|
|
280
|
+
facility_approved_count?: number | null | undefined;
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
/** @internal */
|
|
284
|
+
export const Stats$outboundSchema: z.ZodType<
|
|
285
|
+
Stats$Outbound,
|
|
286
|
+
z.ZodTypeDef,
|
|
287
|
+
Stats
|
|
288
|
+
> = z.object({
|
|
289
|
+
vendorInactiveCount: z.nullable(z.number().int()).optional(),
|
|
290
|
+
vendorActiveCount: z.nullable(z.number().int()).optional(),
|
|
291
|
+
facilityTargetedCount: z.nullable(z.number().int()).optional(),
|
|
292
|
+
facilityApprovedCount: z.nullable(z.number().int()).optional(),
|
|
293
|
+
}).transform((v) => {
|
|
294
|
+
return remap$(v, {
|
|
295
|
+
vendorInactiveCount: "vendor_inactive_count",
|
|
296
|
+
vendorActiveCount: "vendor_active_count",
|
|
297
|
+
facilityTargetedCount: "facility_targeted_count",
|
|
298
|
+
facilityApprovedCount: "facility_approved_count",
|
|
299
|
+
});
|
|
300
|
+
});
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* @internal
|
|
304
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
305
|
+
*/
|
|
306
|
+
export namespace Stats$ {
|
|
307
|
+
/** @deprecated use `Stats$inboundSchema` instead. */
|
|
308
|
+
export const inboundSchema = Stats$inboundSchema;
|
|
309
|
+
/** @deprecated use `Stats$outboundSchema` instead. */
|
|
310
|
+
export const outboundSchema = Stats$outboundSchema;
|
|
311
|
+
/** @deprecated use `Stats$Outbound` instead. */
|
|
312
|
+
export type Outbound = Stats$Outbound;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
export function statsToJSON(stats: Stats): string {
|
|
316
|
+
return JSON.stringify(Stats$outboundSchema.parse(stats));
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
export function statsFromJSON(
|
|
320
|
+
jsonString: string,
|
|
321
|
+
): SafeParseResult<Stats, SDKValidationError> {
|
|
322
|
+
return safeParse(
|
|
323
|
+
jsonString,
|
|
324
|
+
(x) => Stats$inboundSchema.parse(JSON.parse(x)),
|
|
325
|
+
`Failed to parse 'Stats' from JSON`,
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
/** @internal */
|
|
330
|
+
export const Company$inboundSchema: z.ZodType<Company, z.ZodTypeDef, unknown> =
|
|
331
|
+
z.object({
|
|
332
|
+
id: z.number().int(),
|
|
333
|
+
name: z.nullable(z.string()),
|
|
334
|
+
status: z.nullable(z.string()).optional(),
|
|
335
|
+
credit_balance: z.nullable(z.string()).optional(),
|
|
336
|
+
location: z.nullable(z.lazy(() => Location$inboundSchema)).optional(),
|
|
337
|
+
contact: z.lazy(() => CompanyContact$inboundSchema).optional(),
|
|
338
|
+
tax: z.lazy(() => Tax$inboundSchema).optional(),
|
|
339
|
+
stats: z.lazy(() => Stats$inboundSchema).optional(),
|
|
340
|
+
}).transform((v) => {
|
|
341
|
+
return remap$(v, {
|
|
342
|
+
"credit_balance": "creditBalance",
|
|
343
|
+
});
|
|
344
|
+
});
|
|
345
|
+
|
|
346
|
+
/** @internal */
|
|
347
|
+
export type Company$Outbound = {
|
|
348
|
+
id: number;
|
|
349
|
+
name: string | null;
|
|
350
|
+
status?: string | null | undefined;
|
|
351
|
+
credit_balance?: string | null | undefined;
|
|
352
|
+
location?: Location$Outbound | null | undefined;
|
|
353
|
+
contact?: CompanyContact$Outbound | undefined;
|
|
354
|
+
tax?: Tax$Outbound | undefined;
|
|
355
|
+
stats?: Stats$Outbound | undefined;
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
/** @internal */
|
|
359
|
+
export const Company$outboundSchema: z.ZodType<
|
|
360
|
+
Company$Outbound,
|
|
361
|
+
z.ZodTypeDef,
|
|
362
|
+
Company
|
|
363
|
+
> = z.object({
|
|
364
|
+
id: z.number().int(),
|
|
365
|
+
name: z.nullable(z.string()),
|
|
366
|
+
status: z.nullable(z.string()).optional(),
|
|
367
|
+
creditBalance: z.nullable(z.string()).optional(),
|
|
368
|
+
location: z.nullable(z.lazy(() => Location$outboundSchema)).optional(),
|
|
369
|
+
contact: z.lazy(() => CompanyContact$outboundSchema).optional(),
|
|
370
|
+
tax: z.lazy(() => Tax$outboundSchema).optional(),
|
|
371
|
+
stats: z.lazy(() => Stats$outboundSchema).optional(),
|
|
372
|
+
}).transform((v) => {
|
|
373
|
+
return remap$(v, {
|
|
374
|
+
creditBalance: "credit_balance",
|
|
375
|
+
});
|
|
376
|
+
});
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* @internal
|
|
380
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
381
|
+
*/
|
|
382
|
+
export namespace Company$ {
|
|
383
|
+
/** @deprecated use `Company$inboundSchema` instead. */
|
|
384
|
+
export const inboundSchema = Company$inboundSchema;
|
|
385
|
+
/** @deprecated use `Company$outboundSchema` instead. */
|
|
386
|
+
export const outboundSchema = Company$outboundSchema;
|
|
387
|
+
/** @deprecated use `Company$Outbound` instead. */
|
|
388
|
+
export type Outbound = Company$Outbound;
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
export function companyToJSON(company: Company): string {
|
|
392
|
+
return JSON.stringify(Company$outboundSchema.parse(company));
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
export function companyFromJSON(
|
|
396
|
+
jsonString: string,
|
|
397
|
+
): SafeParseResult<Company, SDKValidationError> {
|
|
398
|
+
return safeParse(
|
|
399
|
+
jsonString,
|
|
400
|
+
(x) => Company$inboundSchema.parse(JSON.parse(x)),
|
|
401
|
+
`Failed to parse 'Company' from JSON`,
|
|
402
|
+
);
|
|
403
|
+
}
|
|
@@ -86,7 +86,7 @@ export type FluCredential = {
|
|
|
86
86
|
fluDateEnds?: RFCDate | null | undefined;
|
|
87
87
|
};
|
|
88
88
|
|
|
89
|
-
export type
|
|
89
|
+
export type FacilityLocation = {
|
|
90
90
|
streetAddress?: string | null | undefined;
|
|
91
91
|
city?: string | null | undefined;
|
|
92
92
|
state?: string | null | undefined;
|
|
@@ -171,7 +171,7 @@ export type Facility = {
|
|
|
171
171
|
* A set of images in different sizes
|
|
172
172
|
*/
|
|
173
173
|
imageUrls?: ImageSet | undefined;
|
|
174
|
-
location?:
|
|
174
|
+
location?: FacilityLocation | undefined;
|
|
175
175
|
name?: string | undefined;
|
|
176
176
|
scrubsPolicy?: ScrubsPolicy | null | undefined;
|
|
177
177
|
status?: string | undefined;
|
|
@@ -567,8 +567,8 @@ export function fluCredentialFromJSON(
|
|
|
567
567
|
}
|
|
568
568
|
|
|
569
569
|
/** @internal */
|
|
570
|
-
export const
|
|
571
|
-
|
|
570
|
+
export const FacilityLocation$inboundSchema: z.ZodType<
|
|
571
|
+
FacilityLocation,
|
|
572
572
|
z.ZodTypeDef,
|
|
573
573
|
unknown
|
|
574
574
|
> = z.object({
|
|
@@ -590,7 +590,7 @@ export const Location$inboundSchema: z.ZodType<
|
|
|
590
590
|
});
|
|
591
591
|
|
|
592
592
|
/** @internal */
|
|
593
|
-
export type
|
|
593
|
+
export type FacilityLocation$Outbound = {
|
|
594
594
|
street_address?: string | null | undefined;
|
|
595
595
|
city?: string | null | undefined;
|
|
596
596
|
state?: string | null | undefined;
|
|
@@ -604,10 +604,10 @@ export type Location$Outbound = {
|
|
|
604
604
|
};
|
|
605
605
|
|
|
606
606
|
/** @internal */
|
|
607
|
-
export const
|
|
608
|
-
|
|
607
|
+
export const FacilityLocation$outboundSchema: z.ZodType<
|
|
608
|
+
FacilityLocation$Outbound,
|
|
609
609
|
z.ZodTypeDef,
|
|
610
|
-
|
|
610
|
+
FacilityLocation
|
|
611
611
|
> = z.object({
|
|
612
612
|
streetAddress: z.nullable(z.string()).optional(),
|
|
613
613
|
city: z.nullable(z.string()).optional(),
|
|
@@ -630,26 +630,30 @@ export const Location$outboundSchema: z.ZodType<
|
|
|
630
630
|
* @internal
|
|
631
631
|
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
632
632
|
*/
|
|
633
|
-
export namespace
|
|
634
|
-
/** @deprecated use `
|
|
635
|
-
export const inboundSchema =
|
|
636
|
-
/** @deprecated use `
|
|
637
|
-
export const outboundSchema =
|
|
638
|
-
/** @deprecated use `
|
|
639
|
-
export type Outbound =
|
|
633
|
+
export namespace FacilityLocation$ {
|
|
634
|
+
/** @deprecated use `FacilityLocation$inboundSchema` instead. */
|
|
635
|
+
export const inboundSchema = FacilityLocation$inboundSchema;
|
|
636
|
+
/** @deprecated use `FacilityLocation$outboundSchema` instead. */
|
|
637
|
+
export const outboundSchema = FacilityLocation$outboundSchema;
|
|
638
|
+
/** @deprecated use `FacilityLocation$Outbound` instead. */
|
|
639
|
+
export type Outbound = FacilityLocation$Outbound;
|
|
640
640
|
}
|
|
641
641
|
|
|
642
|
-
export function
|
|
643
|
-
|
|
642
|
+
export function facilityLocationToJSON(
|
|
643
|
+
facilityLocation: FacilityLocation,
|
|
644
|
+
): string {
|
|
645
|
+
return JSON.stringify(
|
|
646
|
+
FacilityLocation$outboundSchema.parse(facilityLocation),
|
|
647
|
+
);
|
|
644
648
|
}
|
|
645
649
|
|
|
646
|
-
export function
|
|
650
|
+
export function facilityLocationFromJSON(
|
|
647
651
|
jsonString: string,
|
|
648
|
-
): SafeParseResult<
|
|
652
|
+
): SafeParseResult<FacilityLocation, SDKValidationError> {
|
|
649
653
|
return safeParse(
|
|
650
654
|
jsonString,
|
|
651
|
-
(x) =>
|
|
652
|
-
`Failed to parse '
|
|
655
|
+
(x) => FacilityLocation$inboundSchema.parse(JSON.parse(x)),
|
|
656
|
+
`Failed to parse 'FacilityLocation' from JSON`,
|
|
653
657
|
);
|
|
654
658
|
}
|
|
655
659
|
|
|
@@ -1195,7 +1199,7 @@ export const Facility$inboundSchema: z.ZodType<
|
|
|
1195
1199
|
flu_credential: z.lazy(() => FluCredential$inboundSchema).optional(),
|
|
1196
1200
|
id: z.number().int().optional(),
|
|
1197
1201
|
image_urls: ImageSet$inboundSchema.optional(),
|
|
1198
|
-
location: z.lazy(() =>
|
|
1202
|
+
location: z.lazy(() => FacilityLocation$inboundSchema).optional(),
|
|
1199
1203
|
name: z.string().optional(),
|
|
1200
1204
|
scrubs_policy: z.nullable(z.lazy(() => ScrubsPolicy$inboundSchema))
|
|
1201
1205
|
.optional(),
|
|
@@ -1237,7 +1241,7 @@ export type Facility$Outbound = {
|
|
|
1237
1241
|
flu_credential?: FluCredential$Outbound | undefined;
|
|
1238
1242
|
id?: number | undefined;
|
|
1239
1243
|
image_urls?: ImageSet$Outbound | undefined;
|
|
1240
|
-
location?:
|
|
1244
|
+
location?: FacilityLocation$Outbound | undefined;
|
|
1241
1245
|
name?: string | undefined;
|
|
1242
1246
|
scrubs_policy?: ScrubsPolicy$Outbound | null | undefined;
|
|
1243
1247
|
status?: string | undefined;
|
|
@@ -1266,7 +1270,7 @@ export const Facility$outboundSchema: z.ZodType<
|
|
|
1266
1270
|
fluCredential: z.lazy(() => FluCredential$outboundSchema).optional(),
|
|
1267
1271
|
id: z.number().int().optional(),
|
|
1268
1272
|
imageUrls: ImageSet$outboundSchema.optional(),
|
|
1269
|
-
location: z.lazy(() =>
|
|
1273
|
+
location: z.lazy(() => FacilityLocation$outboundSchema).optional(),
|
|
1270
1274
|
name: z.string().optional(),
|
|
1271
1275
|
scrubsPolicy: z.nullable(z.lazy(() => ScrubsPolicy$outboundSchema))
|
|
1272
1276
|
.optional(),
|
|
@@ -8,6 +8,12 @@ import { safeParse } from "../../lib/schemas.js";
|
|
|
8
8
|
import { ClosedEnum } from "../../types/enums.js";
|
|
9
9
|
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
10
10
|
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
11
|
+
import {
|
|
12
|
+
Company,
|
|
13
|
+
Company$inboundSchema,
|
|
14
|
+
Company$Outbound,
|
|
15
|
+
Company$outboundSchema,
|
|
16
|
+
} from "./company.js";
|
|
11
17
|
import {
|
|
12
18
|
Contact,
|
|
13
19
|
Contact$inboundSchema,
|
|
@@ -116,6 +122,10 @@ export type User = {
|
|
|
116
122
|
* This object represents a contact at the system or facility level. Use it to verify vendors, create appointments, or check in visitors.
|
|
117
123
|
*/
|
|
118
124
|
contact?: Contact | undefined;
|
|
125
|
+
/**
|
|
126
|
+
* A simplified representation of a Company, typically used in list views.
|
|
127
|
+
*/
|
|
128
|
+
company?: Company | undefined;
|
|
119
129
|
};
|
|
120
130
|
|
|
121
131
|
/** @internal */
|
|
@@ -401,6 +411,7 @@ export const User$inboundSchema: z.ZodType<User, z.ZodTypeDef, unknown> = z
|
|
|
401
411
|
vendor: z.lazy(() => Vendor$inboundSchema).optional(),
|
|
402
412
|
inventory_manager: z.lazy(() => InventoryManager$inboundSchema).optional(),
|
|
403
413
|
contact: Contact$inboundSchema.optional(),
|
|
414
|
+
company: Company$inboundSchema.optional(),
|
|
404
415
|
}).transform((v) => {
|
|
405
416
|
return remap$(v, {
|
|
406
417
|
"is_gatekeeper": "isGatekeeper",
|
|
@@ -418,6 +429,7 @@ export type User$Outbound = {
|
|
|
418
429
|
vendor?: Vendor$Outbound | undefined;
|
|
419
430
|
inventory_manager?: InventoryManager$Outbound | undefined;
|
|
420
431
|
contact?: Contact$Outbound | undefined;
|
|
432
|
+
company?: Company$Outbound | undefined;
|
|
421
433
|
};
|
|
422
434
|
|
|
423
435
|
/** @internal */
|
|
@@ -430,6 +442,7 @@ export const User$outboundSchema: z.ZodType<User$Outbound, z.ZodTypeDef, User> =
|
|
|
430
442
|
vendor: z.lazy(() => Vendor$outboundSchema).optional(),
|
|
431
443
|
inventoryManager: z.lazy(() => InventoryManager$outboundSchema).optional(),
|
|
432
444
|
contact: Contact$outboundSchema.optional(),
|
|
445
|
+
company: Company$outboundSchema.optional(),
|
|
433
446
|
}).transform((v) => {
|
|
434
447
|
return remap$(v, {
|
|
435
448
|
isGatekeeper: "is_gatekeeper",
|
package/src/__tests__/files.ts
DELETED
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
import { createReadStream } from "node:fs";
|
|
6
|
-
import { readFile } from "node:fs/promises";
|
|
7
|
-
import { Readable } from "node:stream";
|
|
8
|
-
|
|
9
|
-
export function filesToStream(filePath: string): ReadableStream<Uint8Array> {
|
|
10
|
-
return Readable.toWeb(
|
|
11
|
-
createReadStream(filePath),
|
|
12
|
-
) as unknown as ReadableStream<Uint8Array>;
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export async function filesToByteArray(filePath: string): Promise<Uint8Array> {
|
|
16
|
-
return new Uint8Array(await readFile(filePath));
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export async function filesToString(filePath: string): Promise<string> {
|
|
20
|
-
return readFile(filePath, "utf8");
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export async function streamToByteArray(
|
|
24
|
-
stream?: ReadableStream<Uint8Array>,
|
|
25
|
-
): Promise<Buffer> {
|
|
26
|
-
if (!stream) {
|
|
27
|
-
return Buffer.from("");
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
const chunks = [];
|
|
31
|
-
const reader = stream.getReader();
|
|
32
|
-
|
|
33
|
-
let done = false;
|
|
34
|
-
while (!done) {
|
|
35
|
-
const res = await reader.read();
|
|
36
|
-
done = res.done;
|
|
37
|
-
if (res.value) {
|
|
38
|
-
chunks.push(res.value);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return Buffer.concat(chunks);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
export function bytesToStream(bytes: Uint8Array): ReadableStream<Uint8Array> {
|
|
46
|
-
return new ReadableStream({
|
|
47
|
-
start(controller) {
|
|
48
|
-
controller.enqueue(bytes);
|
|
49
|
-
},
|
|
50
|
-
pull(controller) {
|
|
51
|
-
controller.close();
|
|
52
|
-
},
|
|
53
|
-
cancel() {
|
|
54
|
-
},
|
|
55
|
-
});
|
|
56
|
-
}
|