@greensecurity/javascript-sdk 0.30.37 → 0.30.39

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 (117) hide show
  1. package/README.md +3 -0
  2. package/bin/mcp-server.js +2096 -1887
  3. package/bin/mcp-server.js.map +14 -10
  4. package/dist/commonjs/__tests__/vendormanagedbycompanies.test.js +1 -1
  5. package/dist/commonjs/__tests__/vendors.test.js +2 -2
  6. package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
  7. package/dist/commonjs/__tests__/webhooks.test.js +1 -1
  8. package/dist/commonjs/__tests__/zones.test.js +19 -0
  9. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  10. package/dist/commonjs/funcs/zonesSecurityZoneCheckin.d.ts +18 -0
  11. package/dist/commonjs/funcs/zonesSecurityZoneCheckin.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/zonesSecurityZoneCheckin.js +116 -0
  13. package/dist/commonjs/funcs/zonesSecurityZoneCheckin.js.map +1 -0
  14. package/dist/commonjs/lib/config.d.ts +3 -3
  15. package/dist/commonjs/lib/config.js +3 -3
  16. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  17. package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
  18. package/dist/commonjs/mcp-server/server.js +3 -1
  19. package/dist/commonjs/mcp-server/server.js.map +1 -1
  20. package/dist/commonjs/mcp-server/tools/zonesSecurityZoneCheckin.d.ts +8 -0
  21. package/dist/commonjs/mcp-server/tools/zonesSecurityZoneCheckin.d.ts.map +1 -0
  22. package/dist/commonjs/mcp-server/tools/zonesSecurityZoneCheckin.js +64 -0
  23. package/dist/commonjs/mcp-server/tools/zonesSecurityZoneCheckin.js.map +1 -0
  24. package/dist/commonjs/models/components/handoff.d.ts +50 -0
  25. package/dist/commonjs/models/components/handoff.d.ts.map +1 -0
  26. package/dist/commonjs/models/components/handoff.js +101 -0
  27. package/dist/commonjs/models/components/handoff.js.map +1 -0
  28. package/dist/commonjs/models/components/index.d.ts +1 -0
  29. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/index.js +1 -0
  31. package/dist/commonjs/models/components/index.js.map +1 -1
  32. package/dist/commonjs/models/operations/index.d.ts +1 -0
  33. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  34. package/dist/commonjs/models/operations/index.js +1 -0
  35. package/dist/commonjs/models/operations/index.js.map +1 -1
  36. package/dist/commonjs/models/operations/securityzonecheckin.d.ts +85 -0
  37. package/dist/commonjs/models/operations/securityzonecheckin.d.ts.map +1 -0
  38. package/dist/commonjs/models/operations/securityzonecheckin.js +147 -0
  39. package/dist/commonjs/models/operations/securityzonecheckin.js.map +1 -0
  40. package/dist/commonjs/react-query/index.d.ts +1 -0
  41. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  42. package/dist/commonjs/react-query/index.js +1 -0
  43. package/dist/commonjs/react-query/index.js.map +1 -1
  44. package/dist/commonjs/react-query/zonesSecurityZoneCheckin.d.ts +24 -0
  45. package/dist/commonjs/react-query/zonesSecurityZoneCheckin.d.ts.map +1 -0
  46. package/dist/commonjs/react-query/zonesSecurityZoneCheckin.js +47 -0
  47. package/dist/commonjs/react-query/zonesSecurityZoneCheckin.js.map +1 -0
  48. package/dist/commonjs/sdk/zones.d.ts +8 -0
  49. package/dist/commonjs/sdk/zones.d.ts.map +1 -1
  50. package/dist/commonjs/sdk/zones.js +11 -0
  51. package/dist/commonjs/sdk/zones.js.map +1 -1
  52. package/dist/esm/__tests__/vendormanagedbycompanies.test.js +1 -1
  53. package/dist/esm/__tests__/vendors.test.js +2 -2
  54. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  55. package/dist/esm/__tests__/webhooks.test.js +1 -1
  56. package/dist/esm/__tests__/zones.test.js +19 -0
  57. package/dist/esm/__tests__/zones.test.js.map +1 -1
  58. package/dist/esm/funcs/zonesSecurityZoneCheckin.d.ts +18 -0
  59. package/dist/esm/funcs/zonesSecurityZoneCheckin.d.ts.map +1 -0
  60. package/dist/esm/funcs/zonesSecurityZoneCheckin.js +80 -0
  61. package/dist/esm/funcs/zonesSecurityZoneCheckin.js.map +1 -0
  62. package/dist/esm/lib/config.d.ts +3 -3
  63. package/dist/esm/lib/config.js +3 -3
  64. package/dist/esm/mcp-server/mcp-server.js +1 -1
  65. package/dist/esm/mcp-server/server.d.ts.map +1 -1
  66. package/dist/esm/mcp-server/server.js +3 -1
  67. package/dist/esm/mcp-server/server.js.map +1 -1
  68. package/dist/esm/mcp-server/tools/zonesSecurityZoneCheckin.d.ts +8 -0
  69. package/dist/esm/mcp-server/tools/zonesSecurityZoneCheckin.d.ts.map +1 -0
  70. package/dist/esm/mcp-server/tools/zonesSecurityZoneCheckin.js +28 -0
  71. package/dist/esm/mcp-server/tools/zonesSecurityZoneCheckin.js.map +1 -0
  72. package/dist/esm/models/components/handoff.d.ts +50 -0
  73. package/dist/esm/models/components/handoff.d.ts.map +1 -0
  74. package/dist/esm/models/components/handoff.js +63 -0
  75. package/dist/esm/models/components/handoff.js.map +1 -0
  76. package/dist/esm/models/components/index.d.ts +1 -0
  77. package/dist/esm/models/components/index.d.ts.map +1 -1
  78. package/dist/esm/models/components/index.js +1 -0
  79. package/dist/esm/models/components/index.js.map +1 -1
  80. package/dist/esm/models/operations/index.d.ts +1 -0
  81. package/dist/esm/models/operations/index.d.ts.map +1 -1
  82. package/dist/esm/models/operations/index.js +1 -0
  83. package/dist/esm/models/operations/index.js.map +1 -1
  84. package/dist/esm/models/operations/securityzonecheckin.d.ts +85 -0
  85. package/dist/esm/models/operations/securityzonecheckin.d.ts.map +1 -0
  86. package/dist/esm/models/operations/securityzonecheckin.js +105 -0
  87. package/dist/esm/models/operations/securityzonecheckin.js.map +1 -0
  88. package/dist/esm/react-query/index.d.ts +1 -0
  89. package/dist/esm/react-query/index.d.ts.map +1 -1
  90. package/dist/esm/react-query/index.js +1 -0
  91. package/dist/esm/react-query/index.js.map +1 -1
  92. package/dist/esm/react-query/zonesSecurityZoneCheckin.d.ts +24 -0
  93. package/dist/esm/react-query/zonesSecurityZoneCheckin.d.ts.map +1 -0
  94. package/dist/esm/react-query/zonesSecurityZoneCheckin.js +42 -0
  95. package/dist/esm/react-query/zonesSecurityZoneCheckin.js.map +1 -0
  96. package/dist/esm/sdk/zones.d.ts +8 -0
  97. package/dist/esm/sdk/zones.d.ts.map +1 -1
  98. package/dist/esm/sdk/zones.js +11 -0
  99. package/dist/esm/sdk/zones.js.map +1 -1
  100. package/jsr.json +1 -1
  101. package/package.json +1 -1
  102. package/src/__tests__/vendormanagedbycompanies.test.ts +1 -1
  103. package/src/__tests__/vendors.test.ts +2 -2
  104. package/src/__tests__/webhooks.test.ts +1 -1
  105. package/src/__tests__/zones.test.ts +22 -0
  106. package/src/funcs/zonesSecurityZoneCheckin.ts +168 -0
  107. package/src/lib/config.ts +3 -3
  108. package/src/mcp-server/mcp-server.ts +1 -1
  109. package/src/mcp-server/server.ts +3 -1
  110. package/src/mcp-server/tools/zonesSecurityZoneCheckin.ts +37 -0
  111. package/src/models/components/handoff.ts +116 -0
  112. package/src/models/components/index.ts +1 -0
  113. package/src/models/operations/index.ts +1 -0
  114. package/src/models/operations/securityzonecheckin.ts +192 -0
  115. package/src/react-query/index.ts +1 -0
  116. package/src/react-query/zonesSecurityZoneCheckin.ts +89 -0
  117. package/src/sdk/zones.ts +20 -0
@@ -0,0 +1,192 @@
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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type Two = {
12
+ /**
13
+ * QR code representing an existing handoff
14
+ */
15
+ qrCode: string;
16
+ };
17
+
18
+ export type One = {
19
+ /**
20
+ * The ID of the zone
21
+ */
22
+ zoneId: number;
23
+ longitude?: any | undefined;
24
+ latitude?: any | undefined;
25
+ };
26
+
27
+ export type SecurityZoneCheckinRequestBody = Two | One;
28
+
29
+ /** @internal */
30
+ export const Two$inboundSchema: z.ZodType<Two, z.ZodTypeDef, unknown> = z
31
+ .object({
32
+ qr_code: z.string(),
33
+ }).transform((v) => {
34
+ return remap$(v, {
35
+ "qr_code": "qrCode",
36
+ });
37
+ });
38
+
39
+ /** @internal */
40
+ export type Two$Outbound = {
41
+ qr_code: string;
42
+ };
43
+
44
+ /** @internal */
45
+ export const Two$outboundSchema: z.ZodType<Two$Outbound, z.ZodTypeDef, Two> = z
46
+ .object({
47
+ qrCode: z.string(),
48
+ }).transform((v) => {
49
+ return remap$(v, {
50
+ qrCode: "qr_code",
51
+ });
52
+ });
53
+
54
+ /**
55
+ * @internal
56
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
57
+ */
58
+ export namespace Two$ {
59
+ /** @deprecated use `Two$inboundSchema` instead. */
60
+ export const inboundSchema = Two$inboundSchema;
61
+ /** @deprecated use `Two$outboundSchema` instead. */
62
+ export const outboundSchema = Two$outboundSchema;
63
+ /** @deprecated use `Two$Outbound` instead. */
64
+ export type Outbound = Two$Outbound;
65
+ }
66
+
67
+ export function twoToJSON(two: Two): string {
68
+ return JSON.stringify(Two$outboundSchema.parse(two));
69
+ }
70
+
71
+ export function twoFromJSON(
72
+ jsonString: string,
73
+ ): SafeParseResult<Two, SDKValidationError> {
74
+ return safeParse(
75
+ jsonString,
76
+ (x) => Two$inboundSchema.parse(JSON.parse(x)),
77
+ `Failed to parse 'Two' from JSON`,
78
+ );
79
+ }
80
+
81
+ /** @internal */
82
+ export const One$inboundSchema: z.ZodType<One, z.ZodTypeDef, unknown> = z
83
+ .object({
84
+ zone_id: z.number().int(),
85
+ longitude: z.any().optional(),
86
+ latitude: z.any().optional(),
87
+ }).transform((v) => {
88
+ return remap$(v, {
89
+ "zone_id": "zoneId",
90
+ });
91
+ });
92
+
93
+ /** @internal */
94
+ export type One$Outbound = {
95
+ zone_id: number;
96
+ longitude?: any | undefined;
97
+ latitude?: any | undefined;
98
+ };
99
+
100
+ /** @internal */
101
+ export const One$outboundSchema: z.ZodType<One$Outbound, z.ZodTypeDef, One> = z
102
+ .object({
103
+ zoneId: z.number().int(),
104
+ longitude: z.any().optional(),
105
+ latitude: z.any().optional(),
106
+ }).transform((v) => {
107
+ return remap$(v, {
108
+ zoneId: "zone_id",
109
+ });
110
+ });
111
+
112
+ /**
113
+ * @internal
114
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
115
+ */
116
+ export namespace One$ {
117
+ /** @deprecated use `One$inboundSchema` instead. */
118
+ export const inboundSchema = One$inboundSchema;
119
+ /** @deprecated use `One$outboundSchema` instead. */
120
+ export const outboundSchema = One$outboundSchema;
121
+ /** @deprecated use `One$Outbound` instead. */
122
+ export type Outbound = One$Outbound;
123
+ }
124
+
125
+ export function oneToJSON(one: One): string {
126
+ return JSON.stringify(One$outboundSchema.parse(one));
127
+ }
128
+
129
+ export function oneFromJSON(
130
+ jsonString: string,
131
+ ): SafeParseResult<One, SDKValidationError> {
132
+ return safeParse(
133
+ jsonString,
134
+ (x) => One$inboundSchema.parse(JSON.parse(x)),
135
+ `Failed to parse 'One' from JSON`,
136
+ );
137
+ }
138
+
139
+ /** @internal */
140
+ export const SecurityZoneCheckinRequestBody$inboundSchema: z.ZodType<
141
+ SecurityZoneCheckinRequestBody,
142
+ z.ZodTypeDef,
143
+ unknown
144
+ > = z.union([z.lazy(() => Two$inboundSchema), z.lazy(() => One$inboundSchema)]);
145
+
146
+ /** @internal */
147
+ export type SecurityZoneCheckinRequestBody$Outbound =
148
+ | Two$Outbound
149
+ | One$Outbound;
150
+
151
+ /** @internal */
152
+ export const SecurityZoneCheckinRequestBody$outboundSchema: z.ZodType<
153
+ SecurityZoneCheckinRequestBody$Outbound,
154
+ z.ZodTypeDef,
155
+ SecurityZoneCheckinRequestBody
156
+ > = z.union([
157
+ z.lazy(() => Two$outboundSchema),
158
+ z.lazy(() => One$outboundSchema),
159
+ ]);
160
+
161
+ /**
162
+ * @internal
163
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
164
+ */
165
+ export namespace SecurityZoneCheckinRequestBody$ {
166
+ /** @deprecated use `SecurityZoneCheckinRequestBody$inboundSchema` instead. */
167
+ export const inboundSchema = SecurityZoneCheckinRequestBody$inboundSchema;
168
+ /** @deprecated use `SecurityZoneCheckinRequestBody$outboundSchema` instead. */
169
+ export const outboundSchema = SecurityZoneCheckinRequestBody$outboundSchema;
170
+ /** @deprecated use `SecurityZoneCheckinRequestBody$Outbound` instead. */
171
+ export type Outbound = SecurityZoneCheckinRequestBody$Outbound;
172
+ }
173
+
174
+ export function securityZoneCheckinRequestBodyToJSON(
175
+ securityZoneCheckinRequestBody: SecurityZoneCheckinRequestBody,
176
+ ): string {
177
+ return JSON.stringify(
178
+ SecurityZoneCheckinRequestBody$outboundSchema.parse(
179
+ securityZoneCheckinRequestBody,
180
+ ),
181
+ );
182
+ }
183
+
184
+ export function securityZoneCheckinRequestBodyFromJSON(
185
+ jsonString: string,
186
+ ): SafeParseResult<SecurityZoneCheckinRequestBody, SDKValidationError> {
187
+ return safeParse(
188
+ jsonString,
189
+ (x) => SecurityZoneCheckinRequestBody$inboundSchema.parse(JSON.parse(x)),
190
+ `Failed to parse 'SecurityZoneCheckinRequestBody' from JSON`,
191
+ );
192
+ }
@@ -42,3 +42,4 @@ export * from "./vendorsUpdateVendorScrubDetails.js";
42
42
  export * from "./webhooksGetWebhookEndpoint.js";
43
43
  export * from "./webhooksListAllWebhookEndpoints.js";
44
44
  export * from "./zonesListOrSearchSecurityZones.js";
45
+ export * from "./zonesSecurityZoneCheckin.js";
@@ -0,0 +1,89 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ MutationKey,
7
+ useMutation,
8
+ UseMutationResult,
9
+ } from "@tanstack/react-query";
10
+ import { GreenSecurityCore } from "../core.js";
11
+ import { zonesSecurityZoneCheckin } from "../funcs/zonesSecurityZoneCheckin.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import * as components from "../models/components/index.js";
15
+ import * as operations from "../models/operations/index.js";
16
+ import { unwrapAsync } from "../types/fp.js";
17
+ import { useGreenSecurityContext } from "./_context.js";
18
+ import { MutationHookOptions } from "./_types.js";
19
+
20
+ export type ZonesSecurityZoneCheckinMutationVariables = {
21
+ request: operations.SecurityZoneCheckinRequestBody;
22
+ options?: RequestOptions;
23
+ };
24
+
25
+ export type ZonesSecurityZoneCheckinMutationData = components.Handoff;
26
+
27
+ /**
28
+ * Security zone checkin request
29
+ *
30
+ * @remarks
31
+ * It will create a handoff record in the db for security zone check in request
32
+ */
33
+ export function useZonesSecurityZoneCheckinMutation(
34
+ options?: MutationHookOptions<
35
+ ZonesSecurityZoneCheckinMutationData,
36
+ Error,
37
+ ZonesSecurityZoneCheckinMutationVariables
38
+ >,
39
+ ): UseMutationResult<
40
+ ZonesSecurityZoneCheckinMutationData,
41
+ Error,
42
+ ZonesSecurityZoneCheckinMutationVariables
43
+ > {
44
+ const client = useGreenSecurityContext();
45
+ return useMutation({
46
+ ...buildZonesSecurityZoneCheckinMutation(client, options),
47
+ ...options,
48
+ });
49
+ }
50
+
51
+ export function mutationKeyZonesSecurityZoneCheckin(): MutationKey {
52
+ return ["@greensecurity/javascript-sdk", "zones", "securityZoneCheckin"];
53
+ }
54
+
55
+ export function buildZonesSecurityZoneCheckinMutation(
56
+ client$: GreenSecurityCore,
57
+ hookOptions?: RequestOptions,
58
+ ): {
59
+ mutationKey: MutationKey;
60
+ mutationFn: (
61
+ variables: ZonesSecurityZoneCheckinMutationVariables,
62
+ ) => Promise<ZonesSecurityZoneCheckinMutationData>;
63
+ } {
64
+ return {
65
+ mutationKey: mutationKeyZonesSecurityZoneCheckin(),
66
+ mutationFn: function zonesSecurityZoneCheckinMutationFn({
67
+ request,
68
+ options,
69
+ }): Promise<ZonesSecurityZoneCheckinMutationData> {
70
+ const mergedOptions = {
71
+ ...hookOptions,
72
+ ...options,
73
+ fetchOptions: {
74
+ ...hookOptions?.fetchOptions,
75
+ ...options?.fetchOptions,
76
+ signal: combineSignals(
77
+ hookOptions?.fetchOptions?.signal,
78
+ options?.fetchOptions?.signal,
79
+ ),
80
+ },
81
+ };
82
+ return unwrapAsync(zonesSecurityZoneCheckin(
83
+ client$,
84
+ request,
85
+ mergedOptions,
86
+ ));
87
+ },
88
+ };
89
+ }
package/src/sdk/zones.ts CHANGED
@@ -3,8 +3,11 @@
3
3
  */
4
4
 
5
5
  import { zonesListOrSearchSecurityZones } from "../funcs/zonesListOrSearchSecurityZones.js";
6
+ import { zonesSecurityZoneCheckin } from "../funcs/zonesSecurityZoneCheckin.js";
6
7
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
8
+ import * as components from "../models/components/index.js";
7
9
  import * as operations from "../models/operations/index.js";
10
+ import { unwrapAsync } from "../types/fp.js";
8
11
  import { PageIterator, unwrapResultIterator } from "../types/operations.js";
9
12
 
10
13
  export class Zones extends ClientSDK {
@@ -26,4 +29,21 @@ export class Zones extends ClientSDK {
26
29
  options,
27
30
  ));
28
31
  }
32
+
33
+ /**
34
+ * Security zone checkin request
35
+ *
36
+ * @remarks
37
+ * It will create a handoff record in the db for security zone check in request
38
+ */
39
+ async securityZoneCheckin(
40
+ request: operations.SecurityZoneCheckinRequestBody,
41
+ options?: RequestOptions,
42
+ ): Promise<components.Handoff> {
43
+ return unwrapAsync(zonesSecurityZoneCheckin(
44
+ this,
45
+ request,
46
+ options,
47
+ ));
48
+ }
29
49
  }