@greensecurity/javascript-sdk 0.31.1 → 0.31.3

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.
Files changed (107) hide show
  1. package/bin/mcp-server.js +29 -87
  2. package/bin/mcp-server.js.map +10 -10
  3. package/dist/commonjs/__tests__/vendors.test.js +3 -6
  4. package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
  5. package/dist/commonjs/__tests__/webhooks.test.js +1 -1
  6. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  7. package/dist/commonjs/__tests__/zones.test.js +59 -3
  8. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  9. package/dist/commonjs/admin-funcs/doAdmin.d.ts +21 -0
  10. package/dist/commonjs/admin-funcs/doAdmin.d.ts.map +1 -0
  11. package/dist/commonjs/admin-funcs/doAdmin.js +118 -0
  12. package/dist/commonjs/admin-funcs/doAdmin.js.map +1 -0
  13. package/dist/commonjs/admin-funcs/facilitiesGetInvoice.d.ts +14 -0
  14. package/dist/commonjs/admin-funcs/facilitiesGetInvoice.d.ts.map +1 -0
  15. package/dist/commonjs/admin-funcs/facilitiesGetInvoice.js +15 -0
  16. package/dist/commonjs/admin-funcs/facilitiesGetInvoice.js.map +1 -0
  17. package/dist/commonjs/index.d.ts +1 -0
  18. package/dist/commonjs/index.d.ts.map +1 -1
  19. package/dist/commonjs/index.extras.d.ts +5 -0
  20. package/dist/commonjs/index.extras.d.ts.map +1 -0
  21. package/dist/commonjs/index.extras.js +9 -0
  22. package/dist/commonjs/index.extras.js.map +1 -0
  23. package/dist/commonjs/index.js +1 -0
  24. package/dist/commonjs/index.js.map +1 -1
  25. package/dist/commonjs/lib/config.d.ts +2 -2
  26. package/dist/commonjs/lib/config.js +2 -2
  27. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  28. package/dist/commonjs/mcp-server/server.js +1 -1
  29. package/dist/commonjs/models/components/facility.d.ts +2 -2
  30. package/dist/commonjs/models/components/facility.d.ts.map +1 -1
  31. package/dist/commonjs/models/components/facility.js +2 -2
  32. package/dist/commonjs/models/components/facility.js.map +1 -1
  33. package/dist/commonjs/models/components/vendor.d.ts +5 -31
  34. package/dist/commonjs/models/components/vendor.d.ts.map +1 -1
  35. package/dist/commonjs/models/components/vendor.js +7 -34
  36. package/dist/commonjs/models/components/vendor.js.map +1 -1
  37. package/dist/commonjs/models/components/vendorcredentialsummary.d.ts +2 -2
  38. package/dist/commonjs/models/components/vendorcredentialsummary.js +2 -2
  39. package/dist/commonjs/models/components/vendortype.d.ts +4 -42
  40. package/dist/commonjs/models/components/vendortype.d.ts.map +1 -1
  41. package/dist/commonjs/models/components/vendortype.js +5 -69
  42. package/dist/commonjs/models/components/vendortype.js.map +1 -1
  43. package/dist/commonjs/models/components/zoneconfig.d.ts +15 -15
  44. package/dist/commonjs/models/components/zoneconfig.d.ts.map +1 -1
  45. package/dist/commonjs/models/components/zoneconfig.js +18 -18
  46. package/dist/commonjs/models/components/zoneconfig.js.map +1 -1
  47. package/dist/esm/__tests__/vendors.test.js +3 -6
  48. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  49. package/dist/esm/__tests__/webhooks.test.js +1 -1
  50. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  51. package/dist/esm/__tests__/zones.test.js +59 -3
  52. package/dist/esm/__tests__/zones.test.js.map +1 -1
  53. package/dist/esm/admin-funcs/doAdmin.d.ts +21 -0
  54. package/dist/esm/admin-funcs/doAdmin.d.ts.map +1 -0
  55. package/dist/esm/admin-funcs/doAdmin.js +82 -0
  56. package/dist/esm/admin-funcs/doAdmin.js.map +1 -0
  57. package/dist/esm/admin-funcs/facilitiesGetInvoice.d.ts +14 -0
  58. package/dist/esm/admin-funcs/facilitiesGetInvoice.d.ts.map +1 -0
  59. package/dist/esm/admin-funcs/facilitiesGetInvoice.js +12 -0
  60. package/dist/esm/admin-funcs/facilitiesGetInvoice.js.map +1 -0
  61. package/dist/esm/index.d.ts +1 -0
  62. package/dist/esm/index.d.ts.map +1 -1
  63. package/dist/esm/index.extras.d.ts +5 -0
  64. package/dist/esm/index.extras.d.ts.map +1 -0
  65. package/dist/esm/index.extras.js +6 -0
  66. package/dist/esm/index.extras.js.map +1 -0
  67. package/dist/esm/index.js +1 -0
  68. package/dist/esm/index.js.map +1 -1
  69. package/dist/esm/lib/config.d.ts +2 -2
  70. package/dist/esm/lib/config.js +2 -2
  71. package/dist/esm/mcp-server/mcp-server.js +1 -1
  72. package/dist/esm/mcp-server/server.js +1 -1
  73. package/dist/esm/models/components/facility.d.ts +2 -2
  74. package/dist/esm/models/components/facility.d.ts.map +1 -1
  75. package/dist/esm/models/components/facility.js +2 -2
  76. package/dist/esm/models/components/facility.js.map +1 -1
  77. package/dist/esm/models/components/vendor.d.ts +5 -31
  78. package/dist/esm/models/components/vendor.d.ts.map +1 -1
  79. package/dist/esm/models/components/vendor.js +6 -31
  80. package/dist/esm/models/components/vendor.js.map +1 -1
  81. package/dist/esm/models/components/vendorcredentialsummary.d.ts +2 -2
  82. package/dist/esm/models/components/vendorcredentialsummary.js +2 -2
  83. package/dist/esm/models/components/vendortype.d.ts +4 -42
  84. package/dist/esm/models/components/vendortype.d.ts.map +1 -1
  85. package/dist/esm/models/components/vendortype.js +4 -66
  86. package/dist/esm/models/components/vendortype.js.map +1 -1
  87. package/dist/esm/models/components/zoneconfig.d.ts +15 -15
  88. package/dist/esm/models/components/zoneconfig.d.ts.map +1 -1
  89. package/dist/esm/models/components/zoneconfig.js +15 -15
  90. package/dist/esm/models/components/zoneconfig.js.map +1 -1
  91. package/jsr.json +1 -1
  92. package/package.json +1 -1
  93. package/src/__tests__/vendors.test.ts +3 -6
  94. package/src/__tests__/webhooks.test.ts +1 -1
  95. package/src/__tests__/zones.test.ts +59 -3
  96. package/src/admin-funcs/doAdmin.ts +164 -0
  97. package/src/admin-funcs/facilitiesGetInvoice.ts +28 -0
  98. package/src/index.extras.ts +8 -0
  99. package/src/index.ts +2 -0
  100. package/src/lib/config.ts +2 -2
  101. package/src/mcp-server/mcp-server.ts +1 -1
  102. package/src/mcp-server/server.ts +1 -1
  103. package/src/models/components/facility.ts +4 -4
  104. package/src/models/components/vendor.ts +15 -68
  105. package/src/models/components/vendorcredentialsummary.ts +4 -4
  106. package/src/models/components/vendortype.ts +8 -112
  107. package/src/models/components/zoneconfig.ts +24 -28
@@ -3,125 +3,29 @@
3
3
  */
4
4
 
5
5
  import * as z from "zod";
6
- import { remap as remap$ } from "../../lib/primitives.js";
7
6
  import { safeParse } from "../../lib/schemas.js";
8
7
  import { Result as SafeParseResult } from "../../types/fp.js";
9
8
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
9
 
11
- export type AppliesTo = {
12
- companyId?: number | undefined;
13
- companyGroupId?: number | undefined;
14
- vendorGroupId?: number | undefined;
15
- everyoneElse: boolean;
16
- };
17
-
18
- /**
19
- * An object which represents a specific `level` or type of vendor. These can be customized by `Company`, `VendorGroup`, or `CompanyGroup`.
20
- */
21
10
  export type VendorType = {
22
- name: string;
23
- shortName: string;
24
- sortOrder: number;
25
- appliesTo: AppliesTo;
26
- };
27
-
28
- /** @internal */
29
- export const AppliesTo$inboundSchema: z.ZodType<
30
- AppliesTo,
31
- z.ZodTypeDef,
32
- unknown
33
- > = z.object({
34
- company_id: z.number().int().optional(),
35
- company_group_id: z.number().int().optional(),
36
- vendor_group_id: z.number().int().optional(),
37
- everyone_else: z.boolean(),
38
- }).transform((v) => {
39
- return remap$(v, {
40
- "company_id": "companyId",
41
- "company_group_id": "companyGroupId",
42
- "vendor_group_id": "vendorGroupId",
43
- "everyone_else": "everyoneElse",
44
- });
45
- });
46
-
47
- /** @internal */
48
- export type AppliesTo$Outbound = {
49
- company_id?: number | undefined;
50
- company_group_id?: number | undefined;
51
- vendor_group_id?: number | undefined;
52
- everyone_else: boolean;
11
+ id?: number | undefined;
12
+ name?: string | undefined;
53
13
  };
54
14
 
55
- /** @internal */
56
- export const AppliesTo$outboundSchema: z.ZodType<
57
- AppliesTo$Outbound,
58
- z.ZodTypeDef,
59
- AppliesTo
60
- > = z.object({
61
- companyId: z.number().int().optional(),
62
- companyGroupId: z.number().int().optional(),
63
- vendorGroupId: z.number().int().optional(),
64
- everyoneElse: z.boolean(),
65
- }).transform((v) => {
66
- return remap$(v, {
67
- companyId: "company_id",
68
- companyGroupId: "company_group_id",
69
- vendorGroupId: "vendor_group_id",
70
- everyoneElse: "everyone_else",
71
- });
72
- });
73
-
74
- /**
75
- * @internal
76
- * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
77
- */
78
- export namespace AppliesTo$ {
79
- /** @deprecated use `AppliesTo$inboundSchema` instead. */
80
- export const inboundSchema = AppliesTo$inboundSchema;
81
- /** @deprecated use `AppliesTo$outboundSchema` instead. */
82
- export const outboundSchema = AppliesTo$outboundSchema;
83
- /** @deprecated use `AppliesTo$Outbound` instead. */
84
- export type Outbound = AppliesTo$Outbound;
85
- }
86
-
87
- export function appliesToToJSON(appliesTo: AppliesTo): string {
88
- return JSON.stringify(AppliesTo$outboundSchema.parse(appliesTo));
89
- }
90
-
91
- export function appliesToFromJSON(
92
- jsonString: string,
93
- ): SafeParseResult<AppliesTo, SDKValidationError> {
94
- return safeParse(
95
- jsonString,
96
- (x) => AppliesTo$inboundSchema.parse(JSON.parse(x)),
97
- `Failed to parse 'AppliesTo' from JSON`,
98
- );
99
- }
100
-
101
15
  /** @internal */
102
16
  export const VendorType$inboundSchema: z.ZodType<
103
17
  VendorType,
104
18
  z.ZodTypeDef,
105
19
  unknown
106
20
  > = z.object({
107
- name: z.string(),
108
- short_name: z.string(),
109
- sort_order: z.number().int(),
110
- applies_to: z.lazy(() => AppliesTo$inboundSchema),
111
- }).transform((v) => {
112
- return remap$(v, {
113
- "short_name": "shortName",
114
- "sort_order": "sortOrder",
115
- "applies_to": "appliesTo",
116
- });
21
+ id: z.number().int().optional(),
22
+ name: z.string().optional(),
117
23
  });
118
24
 
119
25
  /** @internal */
120
26
  export type VendorType$Outbound = {
121
- name: string;
122
- short_name: string;
123
- sort_order: number;
124
- applies_to: AppliesTo$Outbound;
27
+ id?: number | undefined;
28
+ name?: string | undefined;
125
29
  };
126
30
 
127
31
  /** @internal */
@@ -130,16 +34,8 @@ export const VendorType$outboundSchema: z.ZodType<
130
34
  z.ZodTypeDef,
131
35
  VendorType
132
36
  > = z.object({
133
- name: z.string(),
134
- shortName: z.string(),
135
- sortOrder: z.number().int(),
136
- appliesTo: z.lazy(() => AppliesTo$outboundSchema),
137
- }).transform((v) => {
138
- return remap$(v, {
139
- shortName: "short_name",
140
- sortOrder: "sort_order",
141
- appliesTo: "applies_to",
142
- });
37
+ id: z.number().int().optional(),
38
+ name: z.string().optional(),
143
39
  });
144
40
 
145
41
  /**
@@ -26,7 +26,7 @@ export type CompanyGroupId1 = {
26
26
 
27
27
  export type CompanyGroupId = CompanyGroupId1 | number;
28
28
 
29
- export type ZoneConfigAppliesTo = {
29
+ export type AppliesTo = {
30
30
  vendorGroupId?: VendorGroupId1 | number | null | undefined;
31
31
  companyGroupId?: CompanyGroupId1 | number | null | undefined;
32
32
  visitorType?: string | null | undefined;
@@ -76,7 +76,7 @@ export type ZoneConfig = {
76
76
  id?: number | undefined;
77
77
  zoneId?: number | undefined;
78
78
  sortOrder?: number | null | undefined;
79
- appliesTo?: ZoneConfigAppliesTo | undefined;
79
+ appliesTo?: AppliesTo | undefined;
80
80
  vendorPolicy?: ZoneConfigVendorPolicy | undefined;
81
81
  visitorCheckinPolicy?: VisitorCheckinPolicy | undefined;
82
82
  visitRequestPolicy?: VisitRequestPolicy | undefined;
@@ -291,8 +291,8 @@ export function companyGroupIdFromJSON(
291
291
  }
292
292
 
293
293
  /** @internal */
294
- export const ZoneConfigAppliesTo$inboundSchema: z.ZodType<
295
- ZoneConfigAppliesTo,
294
+ export const AppliesTo$inboundSchema: z.ZodType<
295
+ AppliesTo,
296
296
  z.ZodTypeDef,
297
297
  unknown
298
298
  > = z.object({
@@ -314,7 +314,7 @@ export const ZoneConfigAppliesTo$inboundSchema: z.ZodType<
314
314
  });
315
315
 
316
316
  /** @internal */
317
- export type ZoneConfigAppliesTo$Outbound = {
317
+ export type AppliesTo$Outbound = {
318
318
  vendor_group_id?: VendorGroupId1$Outbound | number | null | undefined;
319
319
  company_group_id?: CompanyGroupId1$Outbound | number | null | undefined;
320
320
  visitor_type?: string | null | undefined;
@@ -322,10 +322,10 @@ export type ZoneConfigAppliesTo$Outbound = {
322
322
  };
323
323
 
324
324
  /** @internal */
325
- export const ZoneConfigAppliesTo$outboundSchema: z.ZodType<
326
- ZoneConfigAppliesTo$Outbound,
325
+ export const AppliesTo$outboundSchema: z.ZodType<
326
+ AppliesTo$Outbound,
327
327
  z.ZodTypeDef,
328
- ZoneConfigAppliesTo
328
+ AppliesTo
329
329
  > = z.object({
330
330
  vendorGroupId: z.nullable(
331
331
  z.union([z.lazy(() => VendorGroupId1$outboundSchema), z.number().int()]),
@@ -348,30 +348,26 @@ export const ZoneConfigAppliesTo$outboundSchema: z.ZodType<
348
348
  * @internal
349
349
  * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
350
350
  */
351
- export namespace ZoneConfigAppliesTo$ {
352
- /** @deprecated use `ZoneConfigAppliesTo$inboundSchema` instead. */
353
- export const inboundSchema = ZoneConfigAppliesTo$inboundSchema;
354
- /** @deprecated use `ZoneConfigAppliesTo$outboundSchema` instead. */
355
- export const outboundSchema = ZoneConfigAppliesTo$outboundSchema;
356
- /** @deprecated use `ZoneConfigAppliesTo$Outbound` instead. */
357
- export type Outbound = ZoneConfigAppliesTo$Outbound;
351
+ export namespace AppliesTo$ {
352
+ /** @deprecated use `AppliesTo$inboundSchema` instead. */
353
+ export const inboundSchema = AppliesTo$inboundSchema;
354
+ /** @deprecated use `AppliesTo$outboundSchema` instead. */
355
+ export const outboundSchema = AppliesTo$outboundSchema;
356
+ /** @deprecated use `AppliesTo$Outbound` instead. */
357
+ export type Outbound = AppliesTo$Outbound;
358
358
  }
359
359
 
360
- export function zoneConfigAppliesToToJSON(
361
- zoneConfigAppliesTo: ZoneConfigAppliesTo,
362
- ): string {
363
- return JSON.stringify(
364
- ZoneConfigAppliesTo$outboundSchema.parse(zoneConfigAppliesTo),
365
- );
360
+ export function appliesToToJSON(appliesTo: AppliesTo): string {
361
+ return JSON.stringify(AppliesTo$outboundSchema.parse(appliesTo));
366
362
  }
367
363
 
368
- export function zoneConfigAppliesToFromJSON(
364
+ export function appliesToFromJSON(
369
365
  jsonString: string,
370
- ): SafeParseResult<ZoneConfigAppliesTo, SDKValidationError> {
366
+ ): SafeParseResult<AppliesTo, SDKValidationError> {
371
367
  return safeParse(
372
368
  jsonString,
373
- (x) => ZoneConfigAppliesTo$inboundSchema.parse(JSON.parse(x)),
374
- `Failed to parse 'ZoneConfigAppliesTo' from JSON`,
369
+ (x) => AppliesTo$inboundSchema.parse(JSON.parse(x)),
370
+ `Failed to parse 'AppliesTo' from JSON`,
375
371
  );
376
372
  }
377
373
 
@@ -691,7 +687,7 @@ export const ZoneConfig$inboundSchema: z.ZodType<
691
687
  id: z.number().int().optional(),
692
688
  zone_id: z.number().int().optional(),
693
689
  sort_order: z.nullable(z.number().int()).optional(),
694
- applies_to: z.lazy(() => ZoneConfigAppliesTo$inboundSchema).optional(),
690
+ applies_to: z.lazy(() => AppliesTo$inboundSchema).optional(),
695
691
  vendor_policy: z.lazy(() => ZoneConfigVendorPolicy$inboundSchema).optional(),
696
692
  visitor_checkin_policy: z.lazy(() => VisitorCheckinPolicy$inboundSchema)
697
693
  .optional(),
@@ -713,7 +709,7 @@ export type ZoneConfig$Outbound = {
713
709
  id?: number | undefined;
714
710
  zone_id?: number | undefined;
715
711
  sort_order?: number | null | undefined;
716
- applies_to?: ZoneConfigAppliesTo$Outbound | undefined;
712
+ applies_to?: AppliesTo$Outbound | undefined;
717
713
  vendor_policy?: ZoneConfigVendorPolicy$Outbound | undefined;
718
714
  visitor_checkin_policy?: VisitorCheckinPolicy$Outbound | undefined;
719
715
  visit_request_policy?: VisitRequestPolicy$Outbound | undefined;
@@ -728,7 +724,7 @@ export const ZoneConfig$outboundSchema: z.ZodType<
728
724
  id: z.number().int().optional(),
729
725
  zoneId: z.number().int().optional(),
730
726
  sortOrder: z.nullable(z.number().int()).optional(),
731
- appliesTo: z.lazy(() => ZoneConfigAppliesTo$outboundSchema).optional(),
727
+ appliesTo: z.lazy(() => AppliesTo$outboundSchema).optional(),
732
728
  vendorPolicy: z.lazy(() => ZoneConfigVendorPolicy$outboundSchema).optional(),
733
729
  visitorCheckinPolicy: z.lazy(() => VisitorCheckinPolicy$outboundSchema)
734
730
  .optional(),