@greensecurity/javascript-sdk 0.45.0-beta.15 → 0.45.0-beta.16

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 (128) hide show
  1. package/dist/commonjs/__tests__/vendors.test.js +1 -1
  2. package/dist/commonjs/__tests__/webhooks.test.js +4 -5
  3. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  4. package/dist/commonjs/__tests__/zones.test.js +4 -22
  5. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  6. package/dist/commonjs/funcs/reportsGetFullReport.d.ts +3 -3
  7. package/dist/commonjs/funcs/reportsGetFullReport.js +3 -3
  8. package/dist/commonjs/funcs/validateWebhook.d.ts +1 -1
  9. package/dist/commonjs/funcs/validateWebhook.d.ts.map +1 -1
  10. package/dist/commonjs/funcs/validateWebhook.js +3 -0
  11. package/dist/commonjs/funcs/validateWebhook.js.map +1 -1
  12. package/dist/commonjs/funcs/vendorsSendDownloadCode.js +1 -1
  13. package/dist/commonjs/funcs/vendorsSendDownloadCode.js.map +1 -1
  14. package/dist/commonjs/lib/config.d.ts +2 -2
  15. package/dist/commonjs/lib/config.js +2 -2
  16. package/dist/commonjs/models/components/fullreport.d.ts +107 -0
  17. package/dist/commonjs/models/components/fullreport.d.ts.map +1 -0
  18. package/dist/commonjs/models/components/fullreport.js +125 -0
  19. package/dist/commonjs/models/components/fullreport.js.map +1 -0
  20. package/dist/commonjs/models/components/index.d.ts +1 -0
  21. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  22. package/dist/commonjs/models/components/index.js +1 -0
  23. package/dist/commonjs/models/components/index.js.map +1 -1
  24. package/dist/commonjs/models/components/webhooksubscription.d.ts +3 -0
  25. package/dist/commonjs/models/components/webhooksubscription.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/webhooksubscription.js +3 -0
  27. package/dist/commonjs/models/components/webhooksubscription.js.map +1 -1
  28. package/dist/commonjs/models/components/webhooksubscriptiondetail.d.ts +1 -0
  29. package/dist/commonjs/models/components/webhooksubscriptiondetail.d.ts.map +1 -1
  30. package/dist/commonjs/models/components/webhooksubscriptiondetail.js +1 -0
  31. package/dist/commonjs/models/components/webhooksubscriptiondetail.js.map +1 -1
  32. package/dist/commonjs/models/webhooks/index.d.ts +3 -0
  33. package/dist/commonjs/models/webhooks/index.d.ts.map +1 -1
  34. package/dist/commonjs/models/webhooks/index.js +3 -0
  35. package/dist/commonjs/models/webhooks/index.js.map +1 -1
  36. package/dist/commonjs/models/webhooks/sendfullreportcreated.d.ts +42 -0
  37. package/dist/commonjs/models/webhooks/sendfullreportcreated.d.ts.map +1 -0
  38. package/dist/commonjs/models/webhooks/sendfullreportcreated.js +85 -0
  39. package/dist/commonjs/models/webhooks/sendfullreportcreated.js.map +1 -0
  40. package/dist/commonjs/models/webhooks/sendfullreportdestroyed.d.ts +42 -0
  41. package/dist/commonjs/models/webhooks/sendfullreportdestroyed.d.ts.map +1 -0
  42. package/dist/commonjs/models/webhooks/sendfullreportdestroyed.js +85 -0
  43. package/dist/commonjs/models/webhooks/sendfullreportdestroyed.js.map +1 -0
  44. package/dist/commonjs/models/webhooks/sendfullreportupdated.d.ts +42 -0
  45. package/dist/commonjs/models/webhooks/sendfullreportupdated.d.ts.map +1 -0
  46. package/dist/commonjs/models/webhooks/sendfullreportupdated.js +85 -0
  47. package/dist/commonjs/models/webhooks/sendfullreportupdated.js.map +1 -0
  48. package/dist/commonjs/react-query/reportsGetFullReport.d.ts +6 -6
  49. package/dist/commonjs/react-query/reportsGetFullReport.js +6 -6
  50. package/dist/commonjs/sdk/reports.d.ts +3 -3
  51. package/dist/commonjs/sdk/reports.js +3 -3
  52. package/dist/commonjs/sdk/sdk.d.ts +1 -1
  53. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  54. package/dist/commonjs/sdk/sdk.js.map +1 -1
  55. package/dist/esm/__tests__/vendors.test.js +1 -1
  56. package/dist/esm/__tests__/webhooks.test.js +4 -5
  57. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  58. package/dist/esm/__tests__/zones.test.js +4 -22
  59. package/dist/esm/__tests__/zones.test.js.map +1 -1
  60. package/dist/esm/funcs/reportsGetFullReport.d.ts +3 -3
  61. package/dist/esm/funcs/reportsGetFullReport.js +3 -3
  62. package/dist/esm/funcs/validateWebhook.d.ts +1 -1
  63. package/dist/esm/funcs/validateWebhook.d.ts.map +1 -1
  64. package/dist/esm/funcs/validateWebhook.js +3 -0
  65. package/dist/esm/funcs/validateWebhook.js.map +1 -1
  66. package/dist/esm/funcs/vendorsSendDownloadCode.js +1 -1
  67. package/dist/esm/funcs/vendorsSendDownloadCode.js.map +1 -1
  68. package/dist/esm/lib/config.d.ts +2 -2
  69. package/dist/esm/lib/config.js +2 -2
  70. package/dist/esm/models/components/fullreport.d.ts +107 -0
  71. package/dist/esm/models/components/fullreport.d.ts.map +1 -0
  72. package/dist/esm/models/components/fullreport.js +87 -0
  73. package/dist/esm/models/components/fullreport.js.map +1 -0
  74. package/dist/esm/models/components/index.d.ts +1 -0
  75. package/dist/esm/models/components/index.d.ts.map +1 -1
  76. package/dist/esm/models/components/index.js +1 -0
  77. package/dist/esm/models/components/index.js.map +1 -1
  78. package/dist/esm/models/components/webhooksubscription.d.ts +3 -0
  79. package/dist/esm/models/components/webhooksubscription.d.ts.map +1 -1
  80. package/dist/esm/models/components/webhooksubscription.js +3 -0
  81. package/dist/esm/models/components/webhooksubscription.js.map +1 -1
  82. package/dist/esm/models/components/webhooksubscriptiondetail.d.ts +1 -0
  83. package/dist/esm/models/components/webhooksubscriptiondetail.d.ts.map +1 -1
  84. package/dist/esm/models/components/webhooksubscriptiondetail.js +1 -0
  85. package/dist/esm/models/components/webhooksubscriptiondetail.js.map +1 -1
  86. package/dist/esm/models/webhooks/index.d.ts +3 -0
  87. package/dist/esm/models/webhooks/index.d.ts.map +1 -1
  88. package/dist/esm/models/webhooks/index.js +3 -0
  89. package/dist/esm/models/webhooks/index.js.map +1 -1
  90. package/dist/esm/models/webhooks/sendfullreportcreated.d.ts +42 -0
  91. package/dist/esm/models/webhooks/sendfullreportcreated.d.ts.map +1 -0
  92. package/dist/esm/models/webhooks/sendfullreportcreated.js +47 -0
  93. package/dist/esm/models/webhooks/sendfullreportcreated.js.map +1 -0
  94. package/dist/esm/models/webhooks/sendfullreportdestroyed.d.ts +42 -0
  95. package/dist/esm/models/webhooks/sendfullreportdestroyed.d.ts.map +1 -0
  96. package/dist/esm/models/webhooks/sendfullreportdestroyed.js +47 -0
  97. package/dist/esm/models/webhooks/sendfullreportdestroyed.js.map +1 -0
  98. package/dist/esm/models/webhooks/sendfullreportupdated.d.ts +42 -0
  99. package/dist/esm/models/webhooks/sendfullreportupdated.d.ts.map +1 -0
  100. package/dist/esm/models/webhooks/sendfullreportupdated.js +47 -0
  101. package/dist/esm/models/webhooks/sendfullreportupdated.js.map +1 -0
  102. package/dist/esm/react-query/reportsGetFullReport.d.ts +6 -6
  103. package/dist/esm/react-query/reportsGetFullReport.js +6 -6
  104. package/dist/esm/sdk/reports.d.ts +3 -3
  105. package/dist/esm/sdk/reports.js +3 -3
  106. package/dist/esm/sdk/sdk.d.ts +1 -1
  107. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  108. package/dist/esm/sdk/sdk.js.map +1 -1
  109. package/jsr.json +1 -1
  110. package/package.json +1 -1
  111. package/src/__tests__/vendors.test.ts +1 -1
  112. package/src/__tests__/webhooks.test.ts +4 -5
  113. package/src/__tests__/zones.test.ts +4 -22
  114. package/src/funcs/reportsGetFullReport.ts +3 -3
  115. package/src/funcs/validateWebhook.ts +6 -0
  116. package/src/funcs/vendorsSendDownloadCode.ts +1 -0
  117. package/src/lib/config.ts +2 -2
  118. package/src/models/components/fullreport.ts +193 -0
  119. package/src/models/components/index.ts +1 -0
  120. package/src/models/components/webhooksubscription.ts +3 -0
  121. package/src/models/components/webhooksubscriptiondetail.ts +1 -0
  122. package/src/models/webhooks/index.ts +3 -0
  123. package/src/models/webhooks/sendfullreportcreated.ts +104 -0
  124. package/src/models/webhooks/sendfullreportdestroyed.ts +104 -0
  125. package/src/models/webhooks/sendfullreportupdated.ts +104 -0
  126. package/src/react-query/reportsGetFullReport.ts +6 -6
  127. package/src/sdk/reports.ts +3 -3
  128. package/src/sdk/sdk.ts +3 -0
@@ -0,0 +1,193 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import * as types from "../../types/primitives.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ /**
14
+ * Where the run ended up. A delivery of `FullReport.created` only ever carries a
15
+ *
16
+ * @remarks
17
+ * terminal value; the others are states a run passes through.
18
+ */
19
+ export const FullReportStatus = {
20
+ Pending: "pending",
21
+ Processing: "processing",
22
+ Completed: "completed",
23
+ Canceled: "canceled",
24
+ Failed: "failed",
25
+ } as const;
26
+ /**
27
+ * Where the run ended up. A delivery of `FullReport.created` only ever carries a
28
+ *
29
+ * @remarks
30
+ * terminal value; the others are states a run passes through.
31
+ */
32
+ export type FullReportStatus = ClosedEnum<typeof FullReportStatus>;
33
+
34
+ /**
35
+ * One run of a report, generated on request or by a schedule. Carries the run's own state
36
+ *
37
+ * @remarks
38
+ * plus which report it was and a short-lived signed link to the file it produced.
39
+ */
40
+ export type FullReport = {
41
+ id: number;
42
+ /**
43
+ * Where the run ended up. A delivery of `FullReport.created` only ever carries a
44
+ *
45
+ * @remarks
46
+ * terminal value; the others are states a run passes through.
47
+ */
48
+ status: FullReportStatus;
49
+ /**
50
+ * The report that was run, e.g. `Reports::SqlQueryReport`.
51
+ */
52
+ reportClass: string;
53
+ /**
54
+ * The subject line of the schedule that produced this run. Null for a run that was
55
+ *
56
+ * @remarks
57
+ * generated on request rather than by a schedule.
58
+ */
59
+ name?: string | null | undefined;
60
+ /**
61
+ * Signed download link, valid for 2 hours from the moment the delivery was built and
62
+ *
63
+ * @remarks
64
+ * minted fresh for each delivery. Null when the run produced no file, which is every
65
+ * non-`completed` status.
66
+ */
67
+ reportUrl?: string | null | undefined;
68
+ dateSubmitted?: Date | null | undefined;
69
+ /**
70
+ * When the run started generating.
71
+ */
72
+ dateCreated?: Date | null | undefined;
73
+ /**
74
+ * When the run reached a terminal state. Stamping this is what delivers `created`.
75
+ */
76
+ dateCompleted?: Date | null | undefined;
77
+ /**
78
+ * Milliseconds spent generating.
79
+ */
80
+ durationMs?: number | null | undefined;
81
+ rowCount?: number | null | undefined;
82
+ /**
83
+ * Size of the generated file in bytes.
84
+ */
85
+ fileSize?: number | null | undefined;
86
+ /**
87
+ * Why a `failed` run failed. Null on every other status.
88
+ */
89
+ errorMessage?: string | null | undefined;
90
+ };
91
+
92
+ /** @internal */
93
+ export const FullReportStatus$inboundSchema: z.ZodNativeEnum<
94
+ typeof FullReportStatus
95
+ > = z.nativeEnum(FullReportStatus);
96
+ /** @internal */
97
+ export const FullReportStatus$outboundSchema: z.ZodNativeEnum<
98
+ typeof FullReportStatus
99
+ > = FullReportStatus$inboundSchema;
100
+
101
+ /** @internal */
102
+ export const FullReport$inboundSchema: z.ZodType<
103
+ FullReport,
104
+ z.ZodTypeDef,
105
+ unknown
106
+ > = z.object({
107
+ id: types.number(),
108
+ status: FullReportStatus$inboundSchema,
109
+ report_class: types.string(),
110
+ name: z.nullable(types.string()).optional(),
111
+ report_url: z.nullable(types.string()).optional(),
112
+ date_submitted: z.nullable(types.date()).optional(),
113
+ date_created: z.nullable(types.date()).optional(),
114
+ date_completed: z.nullable(types.date()).optional(),
115
+ duration_ms: z.nullable(types.number()).optional(),
116
+ row_count: z.nullable(types.number()).optional(),
117
+ file_size: z.nullable(types.number()).optional(),
118
+ error_message: z.nullable(types.string()).optional(),
119
+ }).transform((v) => {
120
+ return remap$(v, {
121
+ "report_class": "reportClass",
122
+ "report_url": "reportUrl",
123
+ "date_submitted": "dateSubmitted",
124
+ "date_created": "dateCreated",
125
+ "date_completed": "dateCompleted",
126
+ "duration_ms": "durationMs",
127
+ "row_count": "rowCount",
128
+ "file_size": "fileSize",
129
+ "error_message": "errorMessage",
130
+ });
131
+ });
132
+ /** @internal */
133
+ export type FullReport$Outbound = {
134
+ id: number;
135
+ status: string;
136
+ report_class: string;
137
+ name?: string | null | undefined;
138
+ report_url?: string | null | undefined;
139
+ date_submitted?: string | null | undefined;
140
+ date_created?: string | null | undefined;
141
+ date_completed?: string | null | undefined;
142
+ duration_ms?: number | null | undefined;
143
+ row_count?: number | null | undefined;
144
+ file_size?: number | null | undefined;
145
+ error_message?: string | null | undefined;
146
+ };
147
+
148
+ /** @internal */
149
+ export const FullReport$outboundSchema: z.ZodType<
150
+ FullReport$Outbound,
151
+ z.ZodTypeDef,
152
+ FullReport
153
+ > = z.object({
154
+ id: z.number().int(),
155
+ status: FullReportStatus$outboundSchema,
156
+ reportClass: z.string(),
157
+ name: z.nullable(z.string()).optional(),
158
+ reportUrl: z.nullable(z.string()).optional(),
159
+ dateSubmitted: z.nullable(z.date().transform(v => v.toISOString()))
160
+ .optional(),
161
+ dateCreated: z.nullable(z.date().transform(v => v.toISOString())).optional(),
162
+ dateCompleted: z.nullable(z.date().transform(v => v.toISOString()))
163
+ .optional(),
164
+ durationMs: z.nullable(z.number().int()).optional(),
165
+ rowCount: z.nullable(z.number().int()).optional(),
166
+ fileSize: z.nullable(z.number().int()).optional(),
167
+ errorMessage: z.nullable(z.string()).optional(),
168
+ }).transform((v) => {
169
+ return remap$(v, {
170
+ reportClass: "report_class",
171
+ reportUrl: "report_url",
172
+ dateSubmitted: "date_submitted",
173
+ dateCreated: "date_created",
174
+ dateCompleted: "date_completed",
175
+ durationMs: "duration_ms",
176
+ rowCount: "row_count",
177
+ fileSize: "file_size",
178
+ errorMessage: "error_message",
179
+ });
180
+ });
181
+
182
+ export function fullReportToJSON(fullReport: FullReport): string {
183
+ return JSON.stringify(FullReport$outboundSchema.parse(fullReport));
184
+ }
185
+ export function fullReportFromJSON(
186
+ jsonString: string,
187
+ ): SafeParseResult<FullReport, SDKValidationError> {
188
+ return safeParse(
189
+ jsonString,
190
+ (x) => FullReport$inboundSchema.parse(JSON.parse(x)),
191
+ `Failed to parse 'FullReport' from JSON`,
192
+ );
193
+ }
@@ -45,6 +45,7 @@ export * from "./fhirconfigcreate.js";
45
45
  export * from "./fhirconfigpartialupdate.js";
46
46
  export * from "./fhirextraentities.js";
47
47
  export * from "./financialstatus.js";
48
+ export * from "./fullreport.js";
48
49
  export * from "./handoff.js";
49
50
  export * from "./imageset.js";
50
51
  export * from "./invitee.js";
@@ -12,6 +12,9 @@ import { ClosedEnum } from "../../types/enums.js";
12
12
  * and `destroyed` lifecycle of every entity that supports webhooks.
13
13
  */
14
14
  export const WebhookSubscription = {
15
+ FullReportCreated: "FullReport.created",
16
+ FullReportUpdated: "FullReport.updated",
17
+ FullReportDestroyed: "FullReport.destroyed",
15
18
  TargetFacilityStatusChangeCreated: "TargetFacilityStatusChange.created",
16
19
  TargetFacilityStatusChangeUpdated: "TargetFacilityStatusChange.updated",
17
20
  TargetFacilityStatusChangeDestroyed: "TargetFacilityStatusChange.destroyed",
@@ -14,6 +14,7 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
14
14
  * The entity the event is about.
15
15
  */
16
16
  export const Model = {
17
+ FullReport: "FullReport",
17
18
  TargetFacilityStatusChange: "TargetFacilityStatusChange",
18
19
  Vendor: "Vendor",
19
20
  VendorScan: "VendorScan",
@@ -2,6 +2,9 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ export * from "./sendfullreportcreated.js";
6
+ export * from "./sendfullreportdestroyed.js";
7
+ export * from "./sendfullreportupdated.js";
5
8
  export * from "./sendtargetfacilitystatuschangecreated.js";
6
9
  export * from "./sendtargetfacilitystatuschangedestroyed.js";
7
10
  export * from "./sendtargetfacilitystatuschangeupdated.js";
@@ -0,0 +1,104 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
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 * as types from "../../types/primitives.js";
10
+ import * as components from "../components/index.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type SendFullReportCreatedRequest = {
14
+ /**
15
+ * `t=<unix seconds>,v1=<hex hmac>`, one `v1` per active secret. Each is
16
+ *
17
+ * @remarks
18
+ * `HMAC-SHA256(secret, "<t>.<raw body>")`. Compare with a constant-time function and
19
+ * reject a timestamp that is not recent.
20
+ */
21
+ greenSecuritySignature: string;
22
+ /**
23
+ * The event this delivery belongs to. Route on it when one URL serves several events.
24
+ */
25
+ greenSecurityEvent: string;
26
+ /**
27
+ * Stable per delivery, including across retries. Key your de-duplication on it.
28
+ */
29
+ greenSecurityIdempotencyKey: string;
30
+ /**
31
+ * The entity in the body.
32
+ */
33
+ greenWebhookId: string;
34
+ fullReport: components.FullReport;
35
+ };
36
+
37
+ /** @internal */
38
+ export const SendFullReportCreatedRequest$inboundSchema: z.ZodType<
39
+ SendFullReportCreatedRequest,
40
+ z.ZodTypeDef,
41
+ unknown
42
+ > = z.object({
43
+ "Green-Security-Signature": types.string(),
44
+ "Green-Security-Event": types.string(),
45
+ "Green-Security-Idempotency-Key": types.string(),
46
+ "Green-Webhook-Id": types.string(),
47
+ FullReport: components.FullReport$inboundSchema,
48
+ }).transform((v) => {
49
+ return remap$(v, {
50
+ "Green-Security-Signature": "greenSecuritySignature",
51
+ "Green-Security-Event": "greenSecurityEvent",
52
+ "Green-Security-Idempotency-Key": "greenSecurityIdempotencyKey",
53
+ "Green-Webhook-Id": "greenWebhookId",
54
+ "FullReport": "fullReport",
55
+ });
56
+ });
57
+ /** @internal */
58
+ export type SendFullReportCreatedRequest$Outbound = {
59
+ "Green-Security-Signature": string;
60
+ "Green-Security-Event": string;
61
+ "Green-Security-Idempotency-Key": string;
62
+ "Green-Webhook-Id": string;
63
+ FullReport: components.FullReport$Outbound;
64
+ };
65
+
66
+ /** @internal */
67
+ export const SendFullReportCreatedRequest$outboundSchema: z.ZodType<
68
+ SendFullReportCreatedRequest$Outbound,
69
+ z.ZodTypeDef,
70
+ SendFullReportCreatedRequest
71
+ > = z.object({
72
+ greenSecuritySignature: z.string(),
73
+ greenSecurityEvent: z.string(),
74
+ greenSecurityIdempotencyKey: z.string(),
75
+ greenWebhookId: z.string(),
76
+ fullReport: components.FullReport$outboundSchema,
77
+ }).transform((v) => {
78
+ return remap$(v, {
79
+ greenSecuritySignature: "Green-Security-Signature",
80
+ greenSecurityEvent: "Green-Security-Event",
81
+ greenSecurityIdempotencyKey: "Green-Security-Idempotency-Key",
82
+ greenWebhookId: "Green-Webhook-Id",
83
+ fullReport: "FullReport",
84
+ });
85
+ });
86
+
87
+ export function sendFullReportCreatedRequestToJSON(
88
+ sendFullReportCreatedRequest: SendFullReportCreatedRequest,
89
+ ): string {
90
+ return JSON.stringify(
91
+ SendFullReportCreatedRequest$outboundSchema.parse(
92
+ sendFullReportCreatedRequest,
93
+ ),
94
+ );
95
+ }
96
+ export function sendFullReportCreatedRequestFromJSON(
97
+ jsonString: string,
98
+ ): SafeParseResult<SendFullReportCreatedRequest, SDKValidationError> {
99
+ return safeParse(
100
+ jsonString,
101
+ (x) => SendFullReportCreatedRequest$inboundSchema.parse(JSON.parse(x)),
102
+ `Failed to parse 'SendFullReportCreatedRequest' from JSON`,
103
+ );
104
+ }
@@ -0,0 +1,104 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
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 * as types from "../../types/primitives.js";
10
+ import * as components from "../components/index.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type SendFullReportDestroyedRequest = {
14
+ /**
15
+ * `t=<unix seconds>,v1=<hex hmac>`, one `v1` per active secret. Each is
16
+ *
17
+ * @remarks
18
+ * `HMAC-SHA256(secret, "<t>.<raw body>")`. Compare with a constant-time function and
19
+ * reject a timestamp that is not recent.
20
+ */
21
+ greenSecuritySignature: string;
22
+ /**
23
+ * The event this delivery belongs to. Route on it when one URL serves several events.
24
+ */
25
+ greenSecurityEvent: string;
26
+ /**
27
+ * Stable per delivery, including across retries. Key your de-duplication on it.
28
+ */
29
+ greenSecurityIdempotencyKey: string;
30
+ /**
31
+ * The entity in the body.
32
+ */
33
+ greenWebhookId: string;
34
+ fullReport: components.FullReport;
35
+ };
36
+
37
+ /** @internal */
38
+ export const SendFullReportDestroyedRequest$inboundSchema: z.ZodType<
39
+ SendFullReportDestroyedRequest,
40
+ z.ZodTypeDef,
41
+ unknown
42
+ > = z.object({
43
+ "Green-Security-Signature": types.string(),
44
+ "Green-Security-Event": types.string(),
45
+ "Green-Security-Idempotency-Key": types.string(),
46
+ "Green-Webhook-Id": types.string(),
47
+ FullReport: components.FullReport$inboundSchema,
48
+ }).transform((v) => {
49
+ return remap$(v, {
50
+ "Green-Security-Signature": "greenSecuritySignature",
51
+ "Green-Security-Event": "greenSecurityEvent",
52
+ "Green-Security-Idempotency-Key": "greenSecurityIdempotencyKey",
53
+ "Green-Webhook-Id": "greenWebhookId",
54
+ "FullReport": "fullReport",
55
+ });
56
+ });
57
+ /** @internal */
58
+ export type SendFullReportDestroyedRequest$Outbound = {
59
+ "Green-Security-Signature": string;
60
+ "Green-Security-Event": string;
61
+ "Green-Security-Idempotency-Key": string;
62
+ "Green-Webhook-Id": string;
63
+ FullReport: components.FullReport$Outbound;
64
+ };
65
+
66
+ /** @internal */
67
+ export const SendFullReportDestroyedRequest$outboundSchema: z.ZodType<
68
+ SendFullReportDestroyedRequest$Outbound,
69
+ z.ZodTypeDef,
70
+ SendFullReportDestroyedRequest
71
+ > = z.object({
72
+ greenSecuritySignature: z.string(),
73
+ greenSecurityEvent: z.string(),
74
+ greenSecurityIdempotencyKey: z.string(),
75
+ greenWebhookId: z.string(),
76
+ fullReport: components.FullReport$outboundSchema,
77
+ }).transform((v) => {
78
+ return remap$(v, {
79
+ greenSecuritySignature: "Green-Security-Signature",
80
+ greenSecurityEvent: "Green-Security-Event",
81
+ greenSecurityIdempotencyKey: "Green-Security-Idempotency-Key",
82
+ greenWebhookId: "Green-Webhook-Id",
83
+ fullReport: "FullReport",
84
+ });
85
+ });
86
+
87
+ export function sendFullReportDestroyedRequestToJSON(
88
+ sendFullReportDestroyedRequest: SendFullReportDestroyedRequest,
89
+ ): string {
90
+ return JSON.stringify(
91
+ SendFullReportDestroyedRequest$outboundSchema.parse(
92
+ sendFullReportDestroyedRequest,
93
+ ),
94
+ );
95
+ }
96
+ export function sendFullReportDestroyedRequestFromJSON(
97
+ jsonString: string,
98
+ ): SafeParseResult<SendFullReportDestroyedRequest, SDKValidationError> {
99
+ return safeParse(
100
+ jsonString,
101
+ (x) => SendFullReportDestroyedRequest$inboundSchema.parse(JSON.parse(x)),
102
+ `Failed to parse 'SendFullReportDestroyedRequest' from JSON`,
103
+ );
104
+ }
@@ -0,0 +1,104 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
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 * as types from "../../types/primitives.js";
10
+ import * as components from "../components/index.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type SendFullReportUpdatedRequest = {
14
+ /**
15
+ * `t=<unix seconds>,v1=<hex hmac>`, one `v1` per active secret. Each is
16
+ *
17
+ * @remarks
18
+ * `HMAC-SHA256(secret, "<t>.<raw body>")`. Compare with a constant-time function and
19
+ * reject a timestamp that is not recent.
20
+ */
21
+ greenSecuritySignature: string;
22
+ /**
23
+ * The event this delivery belongs to. Route on it when one URL serves several events.
24
+ */
25
+ greenSecurityEvent: string;
26
+ /**
27
+ * Stable per delivery, including across retries. Key your de-duplication on it.
28
+ */
29
+ greenSecurityIdempotencyKey: string;
30
+ /**
31
+ * The entity in the body.
32
+ */
33
+ greenWebhookId: string;
34
+ fullReport: components.FullReport;
35
+ };
36
+
37
+ /** @internal */
38
+ export const SendFullReportUpdatedRequest$inboundSchema: z.ZodType<
39
+ SendFullReportUpdatedRequest,
40
+ z.ZodTypeDef,
41
+ unknown
42
+ > = z.object({
43
+ "Green-Security-Signature": types.string(),
44
+ "Green-Security-Event": types.string(),
45
+ "Green-Security-Idempotency-Key": types.string(),
46
+ "Green-Webhook-Id": types.string(),
47
+ FullReport: components.FullReport$inboundSchema,
48
+ }).transform((v) => {
49
+ return remap$(v, {
50
+ "Green-Security-Signature": "greenSecuritySignature",
51
+ "Green-Security-Event": "greenSecurityEvent",
52
+ "Green-Security-Idempotency-Key": "greenSecurityIdempotencyKey",
53
+ "Green-Webhook-Id": "greenWebhookId",
54
+ "FullReport": "fullReport",
55
+ });
56
+ });
57
+ /** @internal */
58
+ export type SendFullReportUpdatedRequest$Outbound = {
59
+ "Green-Security-Signature": string;
60
+ "Green-Security-Event": string;
61
+ "Green-Security-Idempotency-Key": string;
62
+ "Green-Webhook-Id": string;
63
+ FullReport: components.FullReport$Outbound;
64
+ };
65
+
66
+ /** @internal */
67
+ export const SendFullReportUpdatedRequest$outboundSchema: z.ZodType<
68
+ SendFullReportUpdatedRequest$Outbound,
69
+ z.ZodTypeDef,
70
+ SendFullReportUpdatedRequest
71
+ > = z.object({
72
+ greenSecuritySignature: z.string(),
73
+ greenSecurityEvent: z.string(),
74
+ greenSecurityIdempotencyKey: z.string(),
75
+ greenWebhookId: z.string(),
76
+ fullReport: components.FullReport$outboundSchema,
77
+ }).transform((v) => {
78
+ return remap$(v, {
79
+ greenSecuritySignature: "Green-Security-Signature",
80
+ greenSecurityEvent: "Green-Security-Event",
81
+ greenSecurityIdempotencyKey: "Green-Security-Idempotency-Key",
82
+ greenWebhookId: "Green-Webhook-Id",
83
+ fullReport: "FullReport",
84
+ });
85
+ });
86
+
87
+ export function sendFullReportUpdatedRequestToJSON(
88
+ sendFullReportUpdatedRequest: SendFullReportUpdatedRequest,
89
+ ): string {
90
+ return JSON.stringify(
91
+ SendFullReportUpdatedRequest$outboundSchema.parse(
92
+ sendFullReportUpdatedRequest,
93
+ ),
94
+ );
95
+ }
96
+ export function sendFullReportUpdatedRequestFromJSON(
97
+ jsonString: string,
98
+ ): SafeParseResult<SendFullReportUpdatedRequest, SDKValidationError> {
99
+ return safeParse(
100
+ jsonString,
101
+ (x) => SendFullReportUpdatedRequest$inboundSchema.parse(JSON.parse(x)),
102
+ `Failed to parse 'SendFullReportUpdatedRequest' from JSON`,
103
+ );
104
+ }
@@ -72,9 +72,9 @@ export type ReportsGetFullReportQueryError =
72
72
  * | `404` | No such run, or it is outside your access scope. | Stop. |
73
73
  * | `403` | Your account is locked, or lacks the `scheduled_reports` view permission. | Stop. |
74
74
  *
75
- * **Bound your polling.** A `409` is not a promise that the run will finish. Report
76
- * generation has no terminal failure state today, so a run whose generation crashed part way
77
- * through stays in `processing` and keeps answering `409` indefinitely. Apply your own
75
+ * **Bound your polling.** A `409` is not a promise that the run will finish. A run that fails
76
+ * while generating is now recorded as `failed` and answers `422`, but a run whose worker died
77
+ * outright still stays in `processing` and keeps answering `409` indefinitely. Apply your own
78
78
  * timeout or maximum attempt count and treat exhaustion as a failure; do not retry forever.
79
79
  *
80
80
  * Access control: the URL's `full_report_id` must be in the caller's read scope for
@@ -122,9 +122,9 @@ export function useReportsGetFullReport(
122
122
  * | `404` | No such run, or it is outside your access scope. | Stop. |
123
123
  * | `403` | Your account is locked, or lacks the `scheduled_reports` view permission. | Stop. |
124
124
  *
125
- * **Bound your polling.** A `409` is not a promise that the run will finish. Report
126
- * generation has no terminal failure state today, so a run whose generation crashed part way
127
- * through stays in `processing` and keeps answering `409` indefinitely. Apply your own
125
+ * **Bound your polling.** A `409` is not a promise that the run will finish. A run that fails
126
+ * while generating is now recorded as `failed` and answers `422`, but a run whose worker died
127
+ * outright still stays in `processing` and keeps answering `409` indefinitely. Apply your own
128
128
  * timeout or maximum attempt count and treat exhaustion as a failure; do not retry forever.
129
129
  *
130
130
  * Access control: the URL's `full_report_id` must be in the caller's read scope for
@@ -62,9 +62,9 @@ export class Reports extends ClientSDK {
62
62
  * | `404` | No such run, or it is outside your access scope. | Stop. |
63
63
  * | `403` | Your account is locked, or lacks the `scheduled_reports` view permission. | Stop. |
64
64
  *
65
- * **Bound your polling.** A `409` is not a promise that the run will finish. Report
66
- * generation has no terminal failure state today, so a run whose generation crashed part way
67
- * through stays in `processing` and keeps answering `409` indefinitely. Apply your own
65
+ * **Bound your polling.** A `409` is not a promise that the run will finish. A run that fails
66
+ * while generating is now recorded as `failed` and answers `422`, but a run whose worker died
67
+ * outright still stays in `processing` and keeps answering `409` indefinitely. Apply your own
68
68
  * timeout or maximum attempt count and treat exhaustion as a failure; do not retry forever.
69
69
  *
70
70
  * Access control: the URL's `full_report_id` must be in the caller's read scope for
package/src/sdk/sdk.ts CHANGED
@@ -140,6 +140,9 @@ export class GreenSecurity extends ClientSDK {
140
140
  } | Request;
141
141
  secret: string;
142
142
  }): Promise<
143
+ | webhooks.SendFullReportCreatedRequest
144
+ | webhooks.SendFullReportUpdatedRequest
145
+ | webhooks.SendFullReportDestroyedRequest
143
146
  | webhooks.SendVendorCreatedRequest
144
147
  | webhooks.SendVendorUpdatedRequest
145
148
  | webhooks.SendVendorDestroyedRequest