@uniformdev/mesh-edgehancer-sdk 19.79.1-alpha.13

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.
@@ -0,0 +1,823 @@
1
+ import * as zod from 'zod';
2
+ import { z } from 'zod';
3
+ import { DataType, DataSource } from '@uniformdev/canvas';
4
+
5
+ /**
6
+ * The context we are fetching the data resource in:
7
+ *
8
+ * - testing: when a data type is being tested in the UI using an ephemeral data resource
9
+ * - editing: the data resource is being fetched as part of editing a draft of a composition or entry
10
+ * - normal: the data resource is being fetched as part of rendering a composition or entry
11
+ *
12
+ * NOTE: using the getDataResource() function from integration UI will have the same fetch context as the parent composition/entry data, i.e. 'editing'
13
+ * NOTE: this is subject to additive change
14
+ */
15
+ type DataResourceFetchContext = 'testing' | 'editing' | 'normal';
16
+ declare const customEdgehancerDefinitionSchema: z.ZodObject<{
17
+ preRequest: z.ZodOptional<z.ZodString>;
18
+ request: z.ZodOptional<z.ZodString>;
19
+ }, "strip", z.ZodTypeAny, {
20
+ preRequest?: string | undefined;
21
+ request?: string | undefined;
22
+ }, {
23
+ preRequest?: string | undefined;
24
+ request?: string | undefined;
25
+ }>;
26
+ declare const mergedDataTypeSchema: z.ZodObject<{
27
+ id: z.ZodString;
28
+ displayName: z.ZodString;
29
+ archetype: z.ZodOptional<z.ZodString>;
30
+ allowedOnComponents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
31
+ badgeIconUrl: z.ZodOptional<z.ZodString>;
32
+ connectorType: z.ZodString;
33
+ url: z.ZodString;
34
+ headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
35
+ key: z.ZodString;
36
+ value: z.ZodString;
37
+ omitIfEmpty: z.ZodOptional<z.ZodBoolean>;
38
+ }, "strip", z.ZodTypeAny, {
39
+ key: string;
40
+ value: string;
41
+ omitIfEmpty?: boolean | undefined;
42
+ }, {
43
+ key: string;
44
+ value: string;
45
+ omitIfEmpty?: boolean | undefined;
46
+ }>, "many">>;
47
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
48
+ key: z.ZodString;
49
+ value: z.ZodString;
50
+ omitIfEmpty: z.ZodOptional<z.ZodBoolean>;
51
+ }, "strip", z.ZodTypeAny, {
52
+ key: string;
53
+ value: string;
54
+ omitIfEmpty?: boolean | undefined;
55
+ }, {
56
+ key: string;
57
+ value: string;
58
+ omitIfEmpty?: boolean | undefined;
59
+ }>, "many">>;
60
+ body: z.ZodOptional<z.ZodString>;
61
+ method: z.ZodEnum<["GET", "POST", "HEAD"]>;
62
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
63
+ displayName: z.ZodOptional<z.ZodString>;
64
+ type: z.ZodOptional<z.ZodString>;
65
+ default: z.ZodString;
66
+ helpText: z.ZodOptional<z.ZodString>;
67
+ order: z.ZodOptional<z.ZodNumber>;
68
+ source: z.ZodOptional<z.ZodString>;
69
+ }, "strip", z.ZodTypeAny, {
70
+ default: string;
71
+ displayName?: string | undefined;
72
+ type?: string | undefined;
73
+ helpText?: string | undefined;
74
+ order?: number | undefined;
75
+ source?: string | undefined;
76
+ }, {
77
+ default: string;
78
+ displayName?: string | undefined;
79
+ type?: string | undefined;
80
+ helpText?: string | undefined;
81
+ order?: number | undefined;
82
+ source?: string | undefined;
83
+ }>>>;
84
+ custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
85
+ ttl: z.ZodOptional<z.ZodNumber>;
86
+ purgeKey: z.ZodOptional<z.ZodString>;
87
+ localeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
88
+ edgehancer: z.ZodOptional<z.ZodObject<{
89
+ preRequest: z.ZodOptional<z.ZodString>;
90
+ request: z.ZodOptional<z.ZodString>;
91
+ }, "strip", z.ZodTypeAny, {
92
+ preRequest?: string | undefined;
93
+ request?: string | undefined;
94
+ }, {
95
+ preRequest?: string | undefined;
96
+ request?: string | undefined;
97
+ }>>;
98
+ uiBadgeText: z.ZodOptional<z.ZodString>;
99
+ }, "strip", z.ZodTypeAny, {
100
+ displayName: string;
101
+ id: string;
102
+ connectorType: string;
103
+ url: string;
104
+ method: "GET" | "POST" | "HEAD";
105
+ archetype?: string | undefined;
106
+ allowedOnComponents?: string[] | undefined;
107
+ badgeIconUrl?: string | undefined;
108
+ headers?: {
109
+ key: string;
110
+ value: string;
111
+ omitIfEmpty?: boolean | undefined;
112
+ }[] | undefined;
113
+ parameters?: {
114
+ key: string;
115
+ value: string;
116
+ omitIfEmpty?: boolean | undefined;
117
+ }[] | undefined;
118
+ body?: string | undefined;
119
+ variables?: Record<string, {
120
+ default: string;
121
+ displayName?: string | undefined;
122
+ type?: string | undefined;
123
+ helpText?: string | undefined;
124
+ order?: number | undefined;
125
+ source?: string | undefined;
126
+ }> | undefined;
127
+ custom?: Record<string, unknown> | undefined;
128
+ ttl?: number | undefined;
129
+ purgeKey?: string | undefined;
130
+ localeMapping?: Record<string, string> | undefined;
131
+ edgehancer?: {
132
+ preRequest?: string | undefined;
133
+ request?: string | undefined;
134
+ } | undefined;
135
+ uiBadgeText?: string | undefined;
136
+ }, {
137
+ displayName: string;
138
+ id: string;
139
+ connectorType: string;
140
+ url: string;
141
+ method: "GET" | "POST" | "HEAD";
142
+ archetype?: string | undefined;
143
+ allowedOnComponents?: string[] | undefined;
144
+ badgeIconUrl?: string | undefined;
145
+ headers?: {
146
+ key: string;
147
+ value: string;
148
+ omitIfEmpty?: boolean | undefined;
149
+ }[] | undefined;
150
+ parameters?: {
151
+ key: string;
152
+ value: string;
153
+ omitIfEmpty?: boolean | undefined;
154
+ }[] | undefined;
155
+ body?: string | undefined;
156
+ variables?: Record<string, {
157
+ default: string;
158
+ displayName?: string | undefined;
159
+ type?: string | undefined;
160
+ helpText?: string | undefined;
161
+ order?: number | undefined;
162
+ source?: string | undefined;
163
+ }> | undefined;
164
+ custom?: Record<string, unknown> | undefined;
165
+ ttl?: number | undefined;
166
+ purgeKey?: string | undefined;
167
+ localeMapping?: Record<string, string> | undefined;
168
+ edgehancer?: {
169
+ preRequest?: string | undefined;
170
+ request?: string | undefined;
171
+ } | undefined;
172
+ uiBadgeText?: string | undefined;
173
+ }>;
174
+ /** Declaration of custom edgehancer hooks on a merged data type */
175
+ type CustomEdgehancerDefinition = z.infer<typeof customEdgehancerDefinitionSchema>;
176
+ /**
177
+ * The result of merging a data source with a data type into a single request object
178
+ */
179
+ type MergedDataType = Omit<DataType, 'path' | 'dataSourceId'> & Pick<DataSource, 'connectorType' | 'localeMapping'> & {
180
+ /** Merged base URL from the data source with the relative URL from the data type */
181
+ url: string;
182
+ /**
183
+ * Edgehancer worker ID for the data type (if any), defined by the integration
184
+ * When set, overrides default fetch behaviour to use custom code
185
+ */
186
+ edgehancer?: CustomEdgehancerDefinition;
187
+ /**
188
+ * Text shown in the UI when this data resource is rendered.
189
+ * Can be set by custom edgehancers.
190
+ * Max length 12
191
+ */
192
+ uiBadgeText?: string;
193
+ };
194
+ declare const dataResourceSchema: z.ZodUnion<[z.ZodString, z.ZodObject<{}, "strip", z.ZodUnknown, z.objectOutputType<{}, z.ZodUnknown, "strip">, z.objectInputType<{}, z.ZodUnknown, "strip">>, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnknown, "many">, z.ZodUndefined]>;
195
+ /** A data resource of JSON data retrieved from a data type/data source */
196
+ type DataResource = z.infer<typeof dataResourceSchema>;
197
+
198
+ type RequestEdgehancerDataResourceContext = {
199
+ /**
200
+ * The data resource to fetch.
201
+ */
202
+ dataResource: MergedDataType;
203
+ };
204
+ type RequestEdgehancerContext = {
205
+ fetchContext: DataResourceFetchContext;
206
+ /**
207
+ * The data resources to fetch. All will be of the archetype and connector
208
+ * that the handler is registered for.
209
+ */
210
+ dataResources: readonly RequestEdgehancerDataResourceContext[];
211
+ };
212
+ declare const requestEdgehancerDataResourceResolutionResultSchema: z.ZodObject<{
213
+ errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
214
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
215
+ surrogateKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
216
+ result: z.ZodUnion<[z.ZodString, z.ZodObject<{}, "strip", z.ZodUnknown, z.objectOutputType<{}, z.ZodUnknown, "strip">, z.objectInputType<{}, z.ZodUnknown, "strip">>, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnknown, "many">, z.ZodUndefined]>;
217
+ }, "strict", z.ZodTypeAny, {
218
+ errors?: string[] | undefined;
219
+ warnings?: string[] | undefined;
220
+ surrogateKeys?: string[] | undefined;
221
+ result?: string | number | boolean | unknown[] | z.objectOutputType<{}, z.ZodUnknown, "strip"> | undefined;
222
+ }, {
223
+ errors?: string[] | undefined;
224
+ warnings?: string[] | undefined;
225
+ surrogateKeys?: string[] | undefined;
226
+ result?: string | number | boolean | unknown[] | z.objectInputType<{}, z.ZodUnknown, "strip"> | undefined;
227
+ }>;
228
+ declare const requestEdgehancerResultSchema: z.ZodObject<{
229
+ results: z.ZodArray<z.ZodObject<{
230
+ errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
231
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
232
+ surrogateKeys: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
233
+ result: z.ZodUnion<[z.ZodString, z.ZodObject<{}, "strip", z.ZodUnknown, z.objectOutputType<{}, z.ZodUnknown, "strip">, z.objectInputType<{}, z.ZodUnknown, "strip">>, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodUnknown, "many">, z.ZodUndefined]>;
234
+ }, "strict", z.ZodTypeAny, {
235
+ errors?: string[] | undefined;
236
+ warnings?: string[] | undefined;
237
+ surrogateKeys?: string[] | undefined;
238
+ result?: string | number | boolean | unknown[] | z.objectOutputType<{}, z.ZodUnknown, "strip"> | undefined;
239
+ }, {
240
+ errors?: string[] | undefined;
241
+ warnings?: string[] | undefined;
242
+ surrogateKeys?: string[] | undefined;
243
+ result?: string | number | boolean | unknown[] | z.objectInputType<{}, z.ZodUnknown, "strip"> | undefined;
244
+ }>, "many">;
245
+ }, "strict", z.ZodTypeAny, {
246
+ results: {
247
+ errors?: string[] | undefined;
248
+ warnings?: string[] | undefined;
249
+ surrogateKeys?: string[] | undefined;
250
+ result?: string | number | boolean | unknown[] | z.objectOutputType<{}, z.ZodUnknown, "strip"> | undefined;
251
+ }[];
252
+ }, {
253
+ results: {
254
+ errors?: string[] | undefined;
255
+ warnings?: string[] | undefined;
256
+ surrogateKeys?: string[] | undefined;
257
+ result?: string | number | boolean | unknown[] | z.objectInputType<{}, z.ZodUnknown, "strip"> | undefined;
258
+ }[];
259
+ }>;
260
+ type RequestEdgehancerResult = z.infer<typeof requestEdgehancerResultSchema>;
261
+ type RequestEdgehancerDataResourceResolutionResult = z.infer<typeof requestEdgehancerDataResourceResolutionResultSchema>;
262
+ type RequestHookFn = (context: RequestEdgehancerContext) => Promise<RequestEdgehancerResult>;
263
+
264
+ type ConvertBatchResultsToEdgehancerResultOptions<TID, TResultItem extends DataResource> = {
265
+ batch: readonly RequestEdgehancerDataResourceContext[];
266
+ batchFetchIds: ResolveBatchIdsResult<TID>;
267
+ batchResults: Array<TResultItem>;
268
+ resolveIdFromBatchResultFn: (batchResult: TResultItem) => TID;
269
+ knownInvalidErrorMessage?: string;
270
+ missingBatchResultErrorMessage?: (dataResource: RequestEdgehancerDataResourceContext) => string;
271
+ };
272
+ /**
273
+ * Given a batch of data resources and their batch-fetch results, convert them into a result that can be returned from a request hook.
274
+ */
275
+ declare function convertBatchResultsToEdgehancerResult<TID, TResultItem extends DataResource>({ batch, batchFetchIds: { invalidBatchIndices, validIdToOriginalIndexMap }, batchResults, resolveIdFromBatchResultFn, knownInvalidErrorMessage, missingBatchResultErrorMessage, }: ConvertBatchResultsToEdgehancerResultOptions<TID, TResultItem>): {
276
+ errors?: string[] | undefined;
277
+ warnings?: string[] | undefined;
278
+ surrogateKeys?: string[] | undefined;
279
+ result?: string | number | boolean | unknown[] | zod.objectOutputType<{}, zod.ZodUnknown, "strip"> | undefined;
280
+ }[];
281
+ type ResolveBatchIdsResult<TID> = {
282
+ /** The IDs that are valid that should be fetched */
283
+ validIds: Array<TID>;
284
+ /** A map of valid IDs to their original index in the batch */
285
+ validIdToOriginalIndexMap: Map<TID, number>;
286
+ /** The indices in the batch where no ID could be resolved for them, and an error should be returned for them, or they should be fetched without batching at the developer's will. */
287
+ invalidBatchIndices: Set<number>;
288
+ };
289
+ /**
290
+ * Given a batch of data resources to fetch, and a function to extract a batch-fetch ID from each resource,
291
+ * returns the valid IDs to fetch in a batch.
292
+ */
293
+ declare function resolveBatchFetchIds<TID>(batch: readonly RequestEdgehancerDataResourceContext[], resolveBatchItemIdFn: (dataResource: RequestEdgehancerDataResourceContext) => TID | undefined): ResolveBatchIdsResult<TID>;
294
+
295
+ declare const edgehancerMergedDataTypeSchema: z.ZodObject<Omit<{
296
+ id: z.ZodString;
297
+ displayName: z.ZodString;
298
+ archetype: z.ZodOptional<z.ZodString>;
299
+ allowedOnComponents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
300
+ badgeIconUrl: z.ZodOptional<z.ZodString>;
301
+ connectorType: z.ZodString;
302
+ url: z.ZodString;
303
+ headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
304
+ key: z.ZodString;
305
+ value: z.ZodString;
306
+ omitIfEmpty: z.ZodOptional<z.ZodBoolean>;
307
+ }, "strip", z.ZodTypeAny, {
308
+ key: string;
309
+ value: string;
310
+ omitIfEmpty?: boolean | undefined;
311
+ }, {
312
+ key: string;
313
+ value: string;
314
+ omitIfEmpty?: boolean | undefined;
315
+ }>, "many">>;
316
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
317
+ key: z.ZodString;
318
+ value: z.ZodString;
319
+ omitIfEmpty: z.ZodOptional<z.ZodBoolean>;
320
+ }, "strip", z.ZodTypeAny, {
321
+ key: string;
322
+ value: string;
323
+ omitIfEmpty?: boolean | undefined;
324
+ }, {
325
+ key: string;
326
+ value: string;
327
+ omitIfEmpty?: boolean | undefined;
328
+ }>, "many">>;
329
+ body: z.ZodOptional<z.ZodString>;
330
+ method: z.ZodEnum<["GET", "POST", "HEAD"]>;
331
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
332
+ displayName: z.ZodOptional<z.ZodString>;
333
+ type: z.ZodOptional<z.ZodString>;
334
+ default: z.ZodString;
335
+ helpText: z.ZodOptional<z.ZodString>;
336
+ order: z.ZodOptional<z.ZodNumber>;
337
+ source: z.ZodOptional<z.ZodString>;
338
+ }, "strip", z.ZodTypeAny, {
339
+ default: string;
340
+ displayName?: string | undefined;
341
+ type?: string | undefined;
342
+ helpText?: string | undefined;
343
+ order?: number | undefined;
344
+ source?: string | undefined;
345
+ }, {
346
+ default: string;
347
+ displayName?: string | undefined;
348
+ type?: string | undefined;
349
+ helpText?: string | undefined;
350
+ order?: number | undefined;
351
+ source?: string | undefined;
352
+ }>>>;
353
+ custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
354
+ ttl: z.ZodOptional<z.ZodNumber>;
355
+ purgeKey: z.ZodOptional<z.ZodString>;
356
+ localeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
357
+ edgehancer: z.ZodOptional<z.ZodObject<{
358
+ preRequest: z.ZodOptional<z.ZodString>;
359
+ request: z.ZodOptional<z.ZodString>;
360
+ }, "strip", z.ZodTypeAny, {
361
+ preRequest?: string | undefined;
362
+ request?: string | undefined;
363
+ }, {
364
+ preRequest?: string | undefined;
365
+ request?: string | undefined;
366
+ }>>;
367
+ uiBadgeText: z.ZodOptional<z.ZodString>;
368
+ }, "displayName" | "id" | "allowedOnComponents" | "badgeIconUrl" | "variables" | "purgeKey" | "edgehancer">, "strip", z.ZodTypeAny, {
369
+ connectorType: string;
370
+ url: string;
371
+ method: "GET" | "POST" | "HEAD";
372
+ archetype?: string | undefined;
373
+ headers?: {
374
+ key: string;
375
+ value: string;
376
+ omitIfEmpty?: boolean | undefined;
377
+ }[] | undefined;
378
+ parameters?: {
379
+ key: string;
380
+ value: string;
381
+ omitIfEmpty?: boolean | undefined;
382
+ }[] | undefined;
383
+ body?: string | undefined;
384
+ custom?: Record<string, unknown> | undefined;
385
+ ttl?: number | undefined;
386
+ localeMapping?: Record<string, string> | undefined;
387
+ uiBadgeText?: string | undefined;
388
+ }, {
389
+ connectorType: string;
390
+ url: string;
391
+ method: "GET" | "POST" | "HEAD";
392
+ archetype?: string | undefined;
393
+ headers?: {
394
+ key: string;
395
+ value: string;
396
+ omitIfEmpty?: boolean | undefined;
397
+ }[] | undefined;
398
+ parameters?: {
399
+ key: string;
400
+ value: string;
401
+ omitIfEmpty?: boolean | undefined;
402
+ }[] | undefined;
403
+ body?: string | undefined;
404
+ custom?: Record<string, unknown> | undefined;
405
+ ttl?: number | undefined;
406
+ localeMapping?: Record<string, string> | undefined;
407
+ uiBadgeText?: string | undefined;
408
+ }>;
409
+ type EdgehancerMergedDataType = z.infer<typeof edgehancerMergedDataTypeSchema>;
410
+ type PreRequestEdgehancerDataResourceContext = {
411
+ /**
412
+ * The data resource definition that will be requested.
413
+ */
414
+ dataResource: EdgehancerMergedDataType;
415
+ };
416
+ type PreRequestEdgehancerContext = {
417
+ fetchContext: DataResourceFetchContext;
418
+ /**
419
+ * The data resources to fetch. All will be of the archetype and connector
420
+ * that the hook is registered for.
421
+ */
422
+ dataResources: readonly PreRequestEdgehancerDataResourceContext[];
423
+ };
424
+ declare const preRequestEdgehancerDataResourceResultSchema: z.ZodObject<{
425
+ errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
426
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
427
+ dataResource: z.ZodObject<Omit<{
428
+ id: z.ZodString;
429
+ displayName: z.ZodString;
430
+ archetype: z.ZodOptional<z.ZodString>;
431
+ allowedOnComponents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
432
+ badgeIconUrl: z.ZodOptional<z.ZodString>;
433
+ connectorType: z.ZodString;
434
+ url: z.ZodString;
435
+ headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
436
+ key: z.ZodString;
437
+ value: z.ZodString;
438
+ omitIfEmpty: z.ZodOptional<z.ZodBoolean>;
439
+ }, "strip", z.ZodTypeAny, {
440
+ key: string;
441
+ value: string;
442
+ omitIfEmpty?: boolean | undefined;
443
+ }, {
444
+ key: string;
445
+ value: string;
446
+ omitIfEmpty?: boolean | undefined;
447
+ }>, "many">>;
448
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
449
+ key: z.ZodString;
450
+ value: z.ZodString;
451
+ omitIfEmpty: z.ZodOptional<z.ZodBoolean>;
452
+ }, "strip", z.ZodTypeAny, {
453
+ key: string;
454
+ value: string;
455
+ omitIfEmpty?: boolean | undefined;
456
+ }, {
457
+ key: string;
458
+ value: string;
459
+ omitIfEmpty?: boolean | undefined;
460
+ }>, "many">>;
461
+ body: z.ZodOptional<z.ZodString>;
462
+ method: z.ZodEnum<["GET", "POST", "HEAD"]>;
463
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
464
+ displayName: z.ZodOptional<z.ZodString>;
465
+ type: z.ZodOptional<z.ZodString>;
466
+ default: z.ZodString;
467
+ helpText: z.ZodOptional<z.ZodString>;
468
+ order: z.ZodOptional<z.ZodNumber>;
469
+ source: z.ZodOptional<z.ZodString>;
470
+ }, "strip", z.ZodTypeAny, {
471
+ default: string;
472
+ displayName?: string | undefined;
473
+ type?: string | undefined;
474
+ helpText?: string | undefined;
475
+ order?: number | undefined;
476
+ source?: string | undefined;
477
+ }, {
478
+ default: string;
479
+ displayName?: string | undefined;
480
+ type?: string | undefined;
481
+ helpText?: string | undefined;
482
+ order?: number | undefined;
483
+ source?: string | undefined;
484
+ }>>>;
485
+ custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
486
+ ttl: z.ZodOptional<z.ZodNumber>;
487
+ purgeKey: z.ZodOptional<z.ZodString>;
488
+ localeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
489
+ edgehancer: z.ZodOptional<z.ZodObject<{
490
+ preRequest: z.ZodOptional<z.ZodString>;
491
+ request: z.ZodOptional<z.ZodString>;
492
+ }, "strip", z.ZodTypeAny, {
493
+ preRequest?: string | undefined;
494
+ request?: string | undefined;
495
+ }, {
496
+ preRequest?: string | undefined;
497
+ request?: string | undefined;
498
+ }>>;
499
+ uiBadgeText: z.ZodOptional<z.ZodString>;
500
+ }, "displayName" | "id" | "allowedOnComponents" | "badgeIconUrl" | "variables" | "purgeKey" | "edgehancer">, "strip", z.ZodTypeAny, {
501
+ connectorType: string;
502
+ url: string;
503
+ method: "GET" | "POST" | "HEAD";
504
+ archetype?: string | undefined;
505
+ headers?: {
506
+ key: string;
507
+ value: string;
508
+ omitIfEmpty?: boolean | undefined;
509
+ }[] | undefined;
510
+ parameters?: {
511
+ key: string;
512
+ value: string;
513
+ omitIfEmpty?: boolean | undefined;
514
+ }[] | undefined;
515
+ body?: string | undefined;
516
+ custom?: Record<string, unknown> | undefined;
517
+ ttl?: number | undefined;
518
+ localeMapping?: Record<string, string> | undefined;
519
+ uiBadgeText?: string | undefined;
520
+ }, {
521
+ connectorType: string;
522
+ url: string;
523
+ method: "GET" | "POST" | "HEAD";
524
+ archetype?: string | undefined;
525
+ headers?: {
526
+ key: string;
527
+ value: string;
528
+ omitIfEmpty?: boolean | undefined;
529
+ }[] | undefined;
530
+ parameters?: {
531
+ key: string;
532
+ value: string;
533
+ omitIfEmpty?: boolean | undefined;
534
+ }[] | undefined;
535
+ body?: string | undefined;
536
+ custom?: Record<string, unknown> | undefined;
537
+ ttl?: number | undefined;
538
+ localeMapping?: Record<string, string> | undefined;
539
+ uiBadgeText?: string | undefined;
540
+ }>;
541
+ }, "strict", z.ZodTypeAny, {
542
+ dataResource: {
543
+ connectorType: string;
544
+ url: string;
545
+ method: "GET" | "POST" | "HEAD";
546
+ archetype?: string | undefined;
547
+ headers?: {
548
+ key: string;
549
+ value: string;
550
+ omitIfEmpty?: boolean | undefined;
551
+ }[] | undefined;
552
+ parameters?: {
553
+ key: string;
554
+ value: string;
555
+ omitIfEmpty?: boolean | undefined;
556
+ }[] | undefined;
557
+ body?: string | undefined;
558
+ custom?: Record<string, unknown> | undefined;
559
+ ttl?: number | undefined;
560
+ localeMapping?: Record<string, string> | undefined;
561
+ uiBadgeText?: string | undefined;
562
+ };
563
+ errors?: string[] | undefined;
564
+ warnings?: string[] | undefined;
565
+ }, {
566
+ dataResource: {
567
+ connectorType: string;
568
+ url: string;
569
+ method: "GET" | "POST" | "HEAD";
570
+ archetype?: string | undefined;
571
+ headers?: {
572
+ key: string;
573
+ value: string;
574
+ omitIfEmpty?: boolean | undefined;
575
+ }[] | undefined;
576
+ parameters?: {
577
+ key: string;
578
+ value: string;
579
+ omitIfEmpty?: boolean | undefined;
580
+ }[] | undefined;
581
+ body?: string | undefined;
582
+ custom?: Record<string, unknown> | undefined;
583
+ ttl?: number | undefined;
584
+ localeMapping?: Record<string, string> | undefined;
585
+ uiBadgeText?: string | undefined;
586
+ };
587
+ errors?: string[] | undefined;
588
+ warnings?: string[] | undefined;
589
+ }>;
590
+ declare const preRequestEdgehancerResultSchema: z.ZodObject<{
591
+ dataResources: z.ZodArray<z.ZodObject<{
592
+ errors: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
593
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
594
+ dataResource: z.ZodObject<Omit<{
595
+ id: z.ZodString;
596
+ displayName: z.ZodString;
597
+ archetype: z.ZodOptional<z.ZodString>;
598
+ allowedOnComponents: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
599
+ badgeIconUrl: z.ZodOptional<z.ZodString>;
600
+ connectorType: z.ZodString;
601
+ url: z.ZodString;
602
+ headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
603
+ key: z.ZodString;
604
+ value: z.ZodString;
605
+ omitIfEmpty: z.ZodOptional<z.ZodBoolean>;
606
+ }, "strip", z.ZodTypeAny, {
607
+ key: string;
608
+ value: string;
609
+ omitIfEmpty?: boolean | undefined;
610
+ }, {
611
+ key: string;
612
+ value: string;
613
+ omitIfEmpty?: boolean | undefined;
614
+ }>, "many">>;
615
+ parameters: z.ZodOptional<z.ZodArray<z.ZodObject<{
616
+ key: z.ZodString;
617
+ value: z.ZodString;
618
+ omitIfEmpty: z.ZodOptional<z.ZodBoolean>;
619
+ }, "strip", z.ZodTypeAny, {
620
+ key: string;
621
+ value: string;
622
+ omitIfEmpty?: boolean | undefined;
623
+ }, {
624
+ key: string;
625
+ value: string;
626
+ omitIfEmpty?: boolean | undefined;
627
+ }>, "many">>;
628
+ body: z.ZodOptional<z.ZodString>;
629
+ method: z.ZodEnum<["GET", "POST", "HEAD"]>;
630
+ variables: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
631
+ displayName: z.ZodOptional<z.ZodString>;
632
+ type: z.ZodOptional<z.ZodString>;
633
+ default: z.ZodString;
634
+ helpText: z.ZodOptional<z.ZodString>;
635
+ order: z.ZodOptional<z.ZodNumber>;
636
+ source: z.ZodOptional<z.ZodString>;
637
+ }, "strip", z.ZodTypeAny, {
638
+ default: string;
639
+ displayName?: string | undefined;
640
+ type?: string | undefined;
641
+ helpText?: string | undefined;
642
+ order?: number | undefined;
643
+ source?: string | undefined;
644
+ }, {
645
+ default: string;
646
+ displayName?: string | undefined;
647
+ type?: string | undefined;
648
+ helpText?: string | undefined;
649
+ order?: number | undefined;
650
+ source?: string | undefined;
651
+ }>>>;
652
+ custom: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
653
+ ttl: z.ZodOptional<z.ZodNumber>;
654
+ purgeKey: z.ZodOptional<z.ZodString>;
655
+ localeMapping: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
656
+ edgehancer: z.ZodOptional<z.ZodObject<{
657
+ preRequest: z.ZodOptional<z.ZodString>;
658
+ request: z.ZodOptional<z.ZodString>;
659
+ }, "strip", z.ZodTypeAny, {
660
+ preRequest?: string | undefined;
661
+ request?: string | undefined;
662
+ }, {
663
+ preRequest?: string | undefined;
664
+ request?: string | undefined;
665
+ }>>;
666
+ uiBadgeText: z.ZodOptional<z.ZodString>;
667
+ }, "displayName" | "id" | "allowedOnComponents" | "badgeIconUrl" | "variables" | "purgeKey" | "edgehancer">, "strip", z.ZodTypeAny, {
668
+ connectorType: string;
669
+ url: string;
670
+ method: "GET" | "POST" | "HEAD";
671
+ archetype?: string | undefined;
672
+ headers?: {
673
+ key: string;
674
+ value: string;
675
+ omitIfEmpty?: boolean | undefined;
676
+ }[] | undefined;
677
+ parameters?: {
678
+ key: string;
679
+ value: string;
680
+ omitIfEmpty?: boolean | undefined;
681
+ }[] | undefined;
682
+ body?: string | undefined;
683
+ custom?: Record<string, unknown> | undefined;
684
+ ttl?: number | undefined;
685
+ localeMapping?: Record<string, string> | undefined;
686
+ uiBadgeText?: string | undefined;
687
+ }, {
688
+ connectorType: string;
689
+ url: string;
690
+ method: "GET" | "POST" | "HEAD";
691
+ archetype?: string | undefined;
692
+ headers?: {
693
+ key: string;
694
+ value: string;
695
+ omitIfEmpty?: boolean | undefined;
696
+ }[] | undefined;
697
+ parameters?: {
698
+ key: string;
699
+ value: string;
700
+ omitIfEmpty?: boolean | undefined;
701
+ }[] | undefined;
702
+ body?: string | undefined;
703
+ custom?: Record<string, unknown> | undefined;
704
+ ttl?: number | undefined;
705
+ localeMapping?: Record<string, string> | undefined;
706
+ uiBadgeText?: string | undefined;
707
+ }>;
708
+ }, "strict", z.ZodTypeAny, {
709
+ dataResource: {
710
+ connectorType: string;
711
+ url: string;
712
+ method: "GET" | "POST" | "HEAD";
713
+ archetype?: string | undefined;
714
+ headers?: {
715
+ key: string;
716
+ value: string;
717
+ omitIfEmpty?: boolean | undefined;
718
+ }[] | undefined;
719
+ parameters?: {
720
+ key: string;
721
+ value: string;
722
+ omitIfEmpty?: boolean | undefined;
723
+ }[] | undefined;
724
+ body?: string | undefined;
725
+ custom?: Record<string, unknown> | undefined;
726
+ ttl?: number | undefined;
727
+ localeMapping?: Record<string, string> | undefined;
728
+ uiBadgeText?: string | undefined;
729
+ };
730
+ errors?: string[] | undefined;
731
+ warnings?: string[] | undefined;
732
+ }, {
733
+ dataResource: {
734
+ connectorType: string;
735
+ url: string;
736
+ method: "GET" | "POST" | "HEAD";
737
+ archetype?: string | undefined;
738
+ headers?: {
739
+ key: string;
740
+ value: string;
741
+ omitIfEmpty?: boolean | undefined;
742
+ }[] | undefined;
743
+ parameters?: {
744
+ key: string;
745
+ value: string;
746
+ omitIfEmpty?: boolean | undefined;
747
+ }[] | undefined;
748
+ body?: string | undefined;
749
+ custom?: Record<string, unknown> | undefined;
750
+ ttl?: number | undefined;
751
+ localeMapping?: Record<string, string> | undefined;
752
+ uiBadgeText?: string | undefined;
753
+ };
754
+ errors?: string[] | undefined;
755
+ warnings?: string[] | undefined;
756
+ }>, "many">;
757
+ }, "strict", z.ZodTypeAny, {
758
+ dataResources: {
759
+ dataResource: {
760
+ connectorType: string;
761
+ url: string;
762
+ method: "GET" | "POST" | "HEAD";
763
+ archetype?: string | undefined;
764
+ headers?: {
765
+ key: string;
766
+ value: string;
767
+ omitIfEmpty?: boolean | undefined;
768
+ }[] | undefined;
769
+ parameters?: {
770
+ key: string;
771
+ value: string;
772
+ omitIfEmpty?: boolean | undefined;
773
+ }[] | undefined;
774
+ body?: string | undefined;
775
+ custom?: Record<string, unknown> | undefined;
776
+ ttl?: number | undefined;
777
+ localeMapping?: Record<string, string> | undefined;
778
+ uiBadgeText?: string | undefined;
779
+ };
780
+ errors?: string[] | undefined;
781
+ warnings?: string[] | undefined;
782
+ }[];
783
+ }, {
784
+ dataResources: {
785
+ dataResource: {
786
+ connectorType: string;
787
+ url: string;
788
+ method: "GET" | "POST" | "HEAD";
789
+ archetype?: string | undefined;
790
+ headers?: {
791
+ key: string;
792
+ value: string;
793
+ omitIfEmpty?: boolean | undefined;
794
+ }[] | undefined;
795
+ parameters?: {
796
+ key: string;
797
+ value: string;
798
+ omitIfEmpty?: boolean | undefined;
799
+ }[] | undefined;
800
+ body?: string | undefined;
801
+ custom?: Record<string, unknown> | undefined;
802
+ ttl?: number | undefined;
803
+ localeMapping?: Record<string, string> | undefined;
804
+ uiBadgeText?: string | undefined;
805
+ };
806
+ errors?: string[] | undefined;
807
+ warnings?: string[] | undefined;
808
+ }[];
809
+ }>;
810
+ type PreRequestEdgehancerResult = z.infer<typeof preRequestEdgehancerResultSchema>;
811
+ type PreRequestEdgehancerDataResourceResult = z.infer<typeof preRequestEdgehancerDataResourceResultSchema>;
812
+ type PreRequestHookFn = (context: PreRequestEdgehancerContext) => Promise<PreRequestEdgehancerResult>;
813
+
814
+ /** Converts a data resource to a Request object suitable to pass to fetch() */
815
+ declare function getDataResourceAsRequest(data: EdgehancerMergedDataType): Request;
816
+ /** Gets the request URL for a data resource, including the url and any query parameters */
817
+ declare function getDataResourceUrl(dataResource: EdgehancerMergedDataType): string;
818
+ /** Gets the query string for a data resource, returns a properly URL-encoded string */
819
+ declare function getDataResourceQueryString({ parameters, url }: EdgehancerMergedDataType): string;
820
+ /** Gets the HTTP headers for a data resource */
821
+ declare function getDataResourceHeaders({ headers }: EdgehancerMergedDataType): Headers;
822
+
823
+ export { type ConvertBatchResultsToEdgehancerResultOptions, type CustomEdgehancerDefinition, type DataResource, type DataResourceFetchContext, type EdgehancerMergedDataType, type MergedDataType, type PreRequestEdgehancerContext, type PreRequestEdgehancerDataResourceContext, type PreRequestEdgehancerDataResourceResult, type PreRequestEdgehancerResult, type PreRequestHookFn, type RequestEdgehancerContext, type RequestEdgehancerDataResourceContext, type RequestEdgehancerDataResourceResolutionResult, type RequestEdgehancerResult, type RequestHookFn, type ResolveBatchIdsResult, convertBatchResultsToEdgehancerResult, dataResourceSchema, edgehancerMergedDataTypeSchema, getDataResourceAsRequest, getDataResourceHeaders, getDataResourceQueryString, getDataResourceUrl, mergedDataTypeSchema, preRequestEdgehancerDataResourceResultSchema, preRequestEdgehancerResultSchema, requestEdgehancerDataResourceResolutionResultSchema, requestEdgehancerResultSchema, resolveBatchFetchIds };