@automate.ax/integration-contracts 0.112.5 → 0.112.7

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.
@@ -25,8 +25,8 @@ export declare const ASANA_PROVIDER_PAGE_SCHEMA: z.ZodObject<{
25
25
  */
26
26
  export declare function toAsanaResource(value: z.output<typeof ASANA_PROVIDER_RESOURCE_SCHEMA>): {
27
27
  id: string;
28
- name: string | undefined;
29
- type: string | undefined;
28
+ name?: string | undefined;
29
+ type?: string | undefined;
30
30
  };
31
31
  /**
32
32
  * Converts provider pagination metadata to the public shape.
@@ -34,5 +34,11 @@ export declare function toAsanaResource(value: z.output<typeof ASANA_PROVIDER_RE
34
34
  * @param value - Provider page envelope.
35
35
  */
36
36
  export declare function toAsanaPageInfo(value: z.output<typeof ASANA_PROVIDER_PAGE_SCHEMA>): {
37
- nextOffset: string | undefined;
37
+ nextOffset?: string | undefined;
38
38
  };
39
+ /**
40
+ * Removes undefined properties from normalized Asana JSON values.
41
+ *
42
+ * @param value - Normalized value to clean recursively.
43
+ */
44
+ export declare function omitAsanaUndefined(value: unknown): unknown;
@@ -26,11 +26,11 @@ export const ASANA_PROVIDER_PAGE_SCHEMA = z.looseObject({
26
26
  * @param value - Provider resource identity.
27
27
  */
28
28
  export function toAsanaResource(value) {
29
- return {
29
+ return ASANA_RESOURCE_SCHEMA.parse(omitAsanaUndefined({
30
30
  id: value.gid,
31
31
  name: value.name,
32
32
  type: value.resource_type,
33
- };
33
+ }));
34
34
  }
35
35
  /**
36
36
  * Converts provider pagination metadata to the public shape.
@@ -38,5 +38,24 @@ export function toAsanaResource(value) {
38
38
  * @param value - Provider page envelope.
39
39
  */
40
40
  export function toAsanaPageInfo(value) {
41
- return { nextOffset: value.next_page?.offset };
41
+ return {
42
+ ...(value.next_page?.offset !== undefined && {
43
+ nextOffset: value.next_page.offset,
44
+ }),
45
+ };
46
+ }
47
+ /**
48
+ * Removes undefined properties from normalized Asana JSON values.
49
+ *
50
+ * @param value - Normalized value to clean recursively.
51
+ */
52
+ export function omitAsanaUndefined(value) {
53
+ if (Array.isArray(value)) {
54
+ return value.map(omitAsanaUndefined);
55
+ }
56
+ if (value === null || typeof value !== "object")
57
+ return value;
58
+ return Object.fromEntries(Object.entries(value)
59
+ .filter(([, entry]) => entry !== undefined)
60
+ .map(([key, entry]) => [key, omitAsanaUndefined(entry)]));
42
61
  }
@@ -331,20 +331,20 @@ export declare const ASANA_PROVIDER_JOB_SCHEMA: z.ZodObject<{
331
331
  * @param value - Provider attachment.
332
332
  */
333
333
  export declare function toAsanaAttachment(value: z.output<typeof ASANA_PROVIDER_ATTACHMENT_SCHEMA>): {
334
- createdAt: string | undefined;
335
- downloadUrl: string | undefined;
336
- host: string | undefined;
337
- parent: {
334
+ id: string;
335
+ name?: string | undefined;
336
+ type?: string | undefined;
337
+ createdAt?: string | undefined;
338
+ downloadUrl?: string | undefined;
339
+ host?: string | undefined;
340
+ parent?: {
338
341
  id: string;
339
- name: string | undefined;
340
- type: string | undefined;
342
+ name?: string | undefined;
343
+ type?: string | undefined;
341
344
  } | undefined;
342
- permanentUrl: string | undefined;
343
- size: number | undefined;
344
- viewUrl: string | undefined;
345
- id: string;
346
- name: string | undefined;
347
- type: string | undefined;
345
+ permanentUrl?: string | undefined;
346
+ size?: number | undefined;
347
+ viewUrl?: string | undefined;
348
348
  };
349
349
  /**
350
350
  * Converts a provider tag to the public shape.
@@ -352,22 +352,22 @@ export declare function toAsanaAttachment(value: z.output<typeof ASANA_PROVIDER_
352
352
  * @param value - Provider tag.
353
353
  */
354
354
  export declare function toAsanaTag(value: z.output<typeof ASANA_PROVIDER_TAG_SCHEMA>): {
355
- color: string | undefined;
356
- createdAt: string | undefined;
355
+ id: string;
357
356
  followers: {
358
357
  id: string;
359
- name: string | undefined;
360
- type: string | undefined;
358
+ name?: string | undefined;
359
+ type?: string | undefined;
361
360
  }[];
362
- notes: string | undefined;
363
- workspace: {
361
+ name?: string | undefined;
362
+ type?: string | undefined;
363
+ color?: string | undefined;
364
+ createdAt?: string | undefined;
365
+ notes?: string | undefined;
366
+ workspace?: {
364
367
  id: string;
365
- name: string | undefined;
366
- type: string | undefined;
368
+ name?: string | undefined;
369
+ type?: string | undefined;
367
370
  } | undefined;
368
- id: string;
369
- name: string | undefined;
370
- type: string | undefined;
371
371
  };
372
372
  /**
373
373
  * Converts a provider team to the public shape.
@@ -375,17 +375,17 @@ export declare function toAsanaTag(value: z.output<typeof ASANA_PROVIDER_TAG_SCH
375
375
  * @param value - Provider team.
376
376
  */
377
377
  export declare function toAsanaTeam(value: z.output<typeof ASANA_PROVIDER_TEAM_SCHEMA>): {
378
- description: string | undefined;
379
- htmlDescription: string | undefined;
380
- organization: {
378
+ id: string;
379
+ name?: string | undefined;
380
+ type?: string | undefined;
381
+ description?: string | undefined;
382
+ htmlDescription?: string | undefined;
383
+ organization?: {
381
384
  id: string;
382
- name: string | undefined;
383
- type: string | undefined;
385
+ name?: string | undefined;
386
+ type?: string | undefined;
384
387
  } | undefined;
385
- permalinkUrl: string | undefined;
386
- id: string;
387
- name: string | undefined;
388
- type: string | undefined;
388
+ permalinkUrl?: string | undefined;
389
389
  };
390
390
  /**
391
391
  * Converts a provider enum option to the public shape.
@@ -393,11 +393,11 @@ export declare function toAsanaTeam(value: z.output<typeof ASANA_PROVIDER_TEAM_S
393
393
  * @param value - Provider enum option.
394
394
  */
395
395
  export declare function toAsanaEnumOption(value: z.output<typeof ASANA_PROVIDER_ENUM_OPTION_SCHEMA>): {
396
- color: string | undefined;
397
- enabled: boolean;
398
396
  id: string;
399
- name: string | undefined;
400
- type: string | undefined;
397
+ enabled: boolean;
398
+ name?: string | undefined;
399
+ type?: string | undefined;
400
+ color?: string | undefined;
401
401
  };
402
402
  /**
403
403
  * Converts a provider custom field to the public shape.
@@ -405,22 +405,22 @@ export declare function toAsanaEnumOption(value: z.output<typeof ASANA_PROVIDER_
405
405
  * @param value - Provider custom field.
406
406
  */
407
407
  export declare function toAsanaCustomField(value: z.output<typeof ASANA_PROVIDER_CUSTOM_FIELD_SCHEMA>): {
408
- customLabel: string | undefined;
409
- currencyCode: string | undefined;
410
- description: string | undefined;
408
+ id: string;
411
409
  enumOptions: {
412
- color: string | undefined;
413
- enabled: boolean;
414
410
  id: string;
415
- name: string | undefined;
416
- type: string | undefined;
411
+ enabled: boolean;
412
+ name?: string | undefined;
413
+ type?: string | undefined;
414
+ color?: string | undefined;
417
415
  }[];
418
- format: string | undefined;
419
- precision: number | undefined;
420
416
  subtype: string;
421
- id: string;
422
- name: string | undefined;
423
- type: string | undefined;
417
+ name?: string | undefined;
418
+ type?: string | undefined;
419
+ customLabel?: string | undefined;
420
+ currencyCode?: string | undefined;
421
+ description?: string | undefined;
422
+ format?: string | undefined;
423
+ precision?: number | undefined;
424
424
  };
425
425
  /**
426
426
  * Converts a provider custom-field value to the public shape.
@@ -428,53 +428,53 @@ export declare function toAsanaCustomField(value: z.output<typeof ASANA_PROVIDER
428
428
  * @param value - Provider field value.
429
429
  */
430
430
  export declare function toAsanaCustomFieldValue(value: z.output<typeof ASANA_PROVIDER_CUSTOM_FIELD_VALUE_SCHEMA>): {
431
- dateValue: {
432
- date: string;
433
- dateTime: string | undefined;
434
- } | undefined;
435
- displayValue: string | undefined;
436
- enumValue: {
437
- color: string | undefined;
438
- enabled: boolean;
431
+ id: string;
432
+ enumOptions: {
439
433
  id: string;
440
- name: string | undefined;
441
- type: string | undefined;
442
- } | undefined;
443
- multiEnumValues: {
444
- color: string | undefined;
445
434
  enabled: boolean;
435
+ name?: string | undefined;
436
+ type?: string | undefined;
437
+ color?: string | undefined;
438
+ }[];
439
+ subtype: string;
440
+ multiEnumValues: {
446
441
  id: string;
447
- name: string | undefined;
448
- type: string | undefined;
442
+ enabled: boolean;
443
+ name?: string | undefined;
444
+ type?: string | undefined;
445
+ color?: string | undefined;
449
446
  }[];
450
- numberValue: number | undefined;
451
447
  peopleValue: {
452
448
  id: string;
453
- name: string | undefined;
454
- type: string | undefined;
449
+ name?: string | undefined;
450
+ type?: string | undefined;
455
451
  }[];
456
452
  referenceValue: {
457
453
  id: string;
458
- name: string | undefined;
459
- type: string | undefined;
454
+ name?: string | undefined;
455
+ type?: string | undefined;
460
456
  }[];
461
- textValue: string | undefined;
462
- customLabel: string | undefined;
463
- currencyCode: string | undefined;
464
- description: string | undefined;
465
- enumOptions: {
466
- color: string | undefined;
467
- enabled: boolean;
457
+ name?: string | undefined;
458
+ type?: string | undefined;
459
+ customLabel?: string | undefined;
460
+ currencyCode?: string | undefined;
461
+ description?: string | undefined;
462
+ format?: string | undefined;
463
+ precision?: number | undefined;
464
+ dateValue?: {
465
+ date: string;
466
+ dateTime?: string | undefined;
467
+ } | undefined;
468
+ displayValue?: string | undefined;
469
+ enumValue?: {
468
470
  id: string;
469
- name: string | undefined;
470
- type: string | undefined;
471
- }[];
472
- format: string | undefined;
473
- precision: number | undefined;
474
- subtype: string;
475
- id: string;
476
- name: string | undefined;
477
- type: string | undefined;
471
+ enabled: boolean;
472
+ name?: string | undefined;
473
+ type?: string | undefined;
474
+ color?: string | undefined;
475
+ } | undefined;
476
+ numberValue?: number | undefined;
477
+ textValue?: string | undefined;
478
478
  };
479
479
  /**
480
480
  * Converts provider project task counts to the public shape.
@@ -495,19 +495,19 @@ export declare function toAsanaProjectTaskCounts(value: z.output<typeof ASANA_PR
495
495
  * @param value - Provider job.
496
496
  */
497
497
  export declare function toAsanaJob(value: z.output<typeof ASANA_PROVIDER_JOB_SCHEMA>): {
498
- newProject: {
498
+ id: string;
499
+ status: "succeeded" | "failed" | "in_progress" | "not_started";
500
+ name?: string | undefined;
501
+ type?: string | undefined;
502
+ newProject?: {
499
503
  id: string;
500
- name: string | undefined;
501
- type: string | undefined;
504
+ name?: string | undefined;
505
+ type?: string | undefined;
502
506
  } | undefined;
503
- newTask: {
507
+ newTask?: {
504
508
  id: string;
505
- name: string | undefined;
506
- type: string | undefined;
509
+ name?: string | undefined;
510
+ type?: string | undefined;
507
511
  } | undefined;
508
- status: "succeeded" | "failed" | "in_progress" | "not_started";
509
- subtype: string | undefined;
510
- id: string;
511
- name: string | undefined;
512
- type: string | undefined;
512
+ subtype?: string | undefined;
513
513
  };
@@ -1,5 +1,5 @@
1
1
  import * as z from "zod";
2
- import { ASANA_PROVIDER_RESOURCE_SCHEMA, ASANA_RESOURCE_SCHEMA, toAsanaResource, } from "./base.js";
2
+ import { ASANA_PROVIDER_RESOURCE_SCHEMA, ASANA_RESOURCE_SCHEMA, omitAsanaUndefined, toAsanaResource, } from "./base.js";
3
3
  export const ASANA_ATTACHMENT_SCHEMA = ASANA_RESOURCE_SCHEMA.extend({
4
4
  /** RFC 3339 creation timestamp. */
5
5
  createdAt: z.string().optional(),
@@ -189,7 +189,7 @@ export const ASANA_PROVIDER_JOB_SCHEMA = ASANA_PROVIDER_RESOURCE_SCHEMA.extend({
189
189
  * @param value - Provider attachment.
190
190
  */
191
191
  export function toAsanaAttachment(value) {
192
- return {
192
+ return ASANA_ATTACHMENT_SCHEMA.parse(omitAsanaUndefined({
193
193
  ...toAsanaResource(value),
194
194
  createdAt: value.created_at,
195
195
  downloadUrl: value.download_url ?? undefined,
@@ -198,7 +198,7 @@ export function toAsanaAttachment(value) {
198
198
  permanentUrl: value.permanent_url ?? undefined,
199
199
  size: value.size ?? undefined,
200
200
  viewUrl: value.view_url ?? undefined,
201
- };
201
+ }));
202
202
  }
203
203
  /**
204
204
  * Converts a provider tag to the public shape.
@@ -206,14 +206,14 @@ export function toAsanaAttachment(value) {
206
206
  * @param value - Provider tag.
207
207
  */
208
208
  export function toAsanaTag(value) {
209
- return {
209
+ return ASANA_TAG_SCHEMA.parse(omitAsanaUndefined({
210
210
  ...toAsanaResource(value),
211
211
  color: value.color ?? undefined,
212
212
  createdAt: value.created_at,
213
213
  followers: (value.followers ?? []).map(toAsanaResource),
214
214
  notes: value.notes,
215
215
  workspace: value.workspace ? toAsanaResource(value.workspace) : undefined,
216
- };
216
+ }));
217
217
  }
218
218
  /**
219
219
  * Converts a provider team to the public shape.
@@ -221,7 +221,7 @@ export function toAsanaTag(value) {
221
221
  * @param value - Provider team.
222
222
  */
223
223
  export function toAsanaTeam(value) {
224
- return {
224
+ return ASANA_TEAM_SCHEMA.parse(omitAsanaUndefined({
225
225
  ...toAsanaResource(value),
226
226
  description: value.description,
227
227
  htmlDescription: value.html_description,
@@ -229,7 +229,7 @@ export function toAsanaTeam(value) {
229
229
  ? toAsanaResource(value.organization)
230
230
  : undefined,
231
231
  permalinkUrl: value.permalink_url,
232
- };
232
+ }));
233
233
  }
234
234
  /**
235
235
  * Converts a provider enum option to the public shape.
@@ -237,11 +237,11 @@ export function toAsanaTeam(value) {
237
237
  * @param value - Provider enum option.
238
238
  */
239
239
  export function toAsanaEnumOption(value) {
240
- return {
240
+ return ASANA_ENUM_OPTION_SCHEMA.parse(omitAsanaUndefined({
241
241
  ...toAsanaResource(value),
242
242
  color: value.color ?? undefined,
243
243
  enabled: value.enabled,
244
- };
244
+ }));
245
245
  }
246
246
  /**
247
247
  * Converts a provider custom field to the public shape.
@@ -249,7 +249,7 @@ export function toAsanaEnumOption(value) {
249
249
  * @param value - Provider custom field.
250
250
  */
251
251
  export function toAsanaCustomField(value) {
252
- return {
252
+ return ASANA_CUSTOM_FIELD_SCHEMA.parse(omitAsanaUndefined({
253
253
  ...toAsanaResource(value),
254
254
  customLabel: value.custom_label ?? undefined,
255
255
  currencyCode: value.currency_code ?? undefined,
@@ -258,7 +258,7 @@ export function toAsanaCustomField(value) {
258
258
  format: value.format ?? undefined,
259
259
  precision: value.precision ?? undefined,
260
260
  subtype: value.resource_subtype,
261
- };
261
+ }));
262
262
  }
263
263
  /**
264
264
  * Converts a provider custom-field value to the public shape.
@@ -266,7 +266,7 @@ export function toAsanaCustomField(value) {
266
266
  * @param value - Provider field value.
267
267
  */
268
268
  export function toAsanaCustomFieldValue(value) {
269
- return {
269
+ return ASANA_CUSTOM_FIELD_VALUE_SCHEMA.parse(omitAsanaUndefined({
270
270
  ...toAsanaCustomField(value),
271
271
  dateValue: value.date_value
272
272
  ? {
@@ -283,7 +283,7 @@ export function toAsanaCustomFieldValue(value) {
283
283
  peopleValue: (value.people_value ?? []).map(toAsanaResource),
284
284
  referenceValue: (value.reference_value ?? []).map(toAsanaResource),
285
285
  textValue: value.text_value ?? undefined,
286
- };
286
+ }));
287
287
  }
288
288
  /**
289
289
  * Converts provider project task counts to the public shape.
@@ -291,14 +291,14 @@ export function toAsanaCustomFieldValue(value) {
291
291
  * @param value - Provider counts.
292
292
  */
293
293
  export function toAsanaProjectTaskCounts(value) {
294
- return {
294
+ return ASANA_PROJECT_TASK_COUNTS_SCHEMA.parse(omitAsanaUndefined({
295
295
  numCompletedMilestones: value.num_completed_milestones,
296
296
  numCompletedTasks: value.num_completed_tasks,
297
297
  numIncompleteMilestones: value.num_incomplete_milestones,
298
298
  numIncompleteTasks: value.num_incomplete_tasks,
299
299
  numMilestones: value.num_milestones,
300
300
  numTasks: value.num_tasks,
301
- };
301
+ }));
302
302
  }
303
303
  /**
304
304
  * Converts a provider asynchronous job to the public shape.
@@ -306,7 +306,7 @@ export function toAsanaProjectTaskCounts(value) {
306
306
  * @param value - Provider job.
307
307
  */
308
308
  export function toAsanaJob(value) {
309
- return {
309
+ return ASANA_JOB_SCHEMA.parse(omitAsanaUndefined({
310
310
  ...toAsanaResource(value),
311
311
  newProject: value.new_project
312
312
  ? toAsanaResource(value.new_project)
@@ -314,5 +314,5 @@ export function toAsanaJob(value) {
314
314
  newTask: value.new_task ? toAsanaResource(value.new_task) : undefined,
315
315
  status: value.status,
316
316
  subtype: value.resource_subtype,
317
- };
317
+ }));
318
318
  }