@automate.ax/integration-contracts 0.112.6 → 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.
@@ -871,11 +871,11 @@ export declare const ASANA_PROVIDER_EVENT_SCHEMA: z.ZodObject<{
871
871
  * @param value - Provider-native workspace.
872
872
  */
873
873
  export declare function toAsanaWorkspace(value: z.output<typeof ASANA_PROVIDER_WORKSPACE_SCHEMA>): {
874
- isOrganization?: boolean | undefined;
875
- emailDomains?: string[] | undefined;
876
874
  id: string;
877
- name: string | undefined;
878
- type: string | undefined;
875
+ name?: string | undefined;
876
+ type?: string | undefined;
877
+ emailDomains?: string[] | undefined;
878
+ isOrganization?: boolean | undefined;
879
879
  };
880
880
  /**
881
881
  * Converts an Asana user to the public camel-cased shape.
@@ -883,16 +883,16 @@ export declare function toAsanaWorkspace(value: z.output<typeof ASANA_PROVIDER_W
883
883
  * @param value - Provider-native user.
884
884
  */
885
885
  export declare function toAsanaUser(value: z.output<typeof ASANA_PROVIDER_USER_SCHEMA>): {
886
- email: string | undefined;
887
- photoUrl: string | undefined;
886
+ id: string;
888
887
  workspaces: {
889
888
  id: string;
890
- name: string | undefined;
891
- type: string | undefined;
889
+ name?: string | undefined;
890
+ type?: string | undefined;
892
891
  }[];
893
- id: string;
894
- name: string | undefined;
895
- type: string | undefined;
892
+ name?: string | undefined;
893
+ type?: string | undefined;
894
+ email?: string | undefined;
895
+ photoUrl?: string | undefined;
896
896
  };
897
897
  /**
898
898
  * Converts an Asana project to the public camel-cased shape.
@@ -900,30 +900,30 @@ export declare function toAsanaUser(value: z.output<typeof ASANA_PROVIDER_USER_S
900
900
  * @param value - Provider-native project.
901
901
  */
902
902
  export declare function toAsanaProject(value: z.output<typeof ASANA_PROVIDER_PROJECT_SCHEMA>): {
903
+ id: string;
903
904
  archived: boolean;
904
- color: string | undefined;
905
- createdAt: string | undefined;
906
- defaultView: string | undefined;
907
- dueOn: string | undefined;
908
- htmlNotes: string | undefined;
909
- modifiedAt: string | undefined;
910
- notes: string | undefined;
911
- permalinkUrl: string | undefined;
912
905
  public: boolean;
913
- startOn: string | undefined;
914
- team: {
906
+ name?: string | undefined;
907
+ type?: string | undefined;
908
+ color?: string | undefined;
909
+ createdAt?: string | undefined;
910
+ defaultView?: string | undefined;
911
+ dueOn?: string | undefined;
912
+ htmlNotes?: string | undefined;
913
+ modifiedAt?: string | undefined;
914
+ notes?: string | undefined;
915
+ permalinkUrl?: string | undefined;
916
+ startOn?: string | undefined;
917
+ team?: {
915
918
  id: string;
916
- name: string | undefined;
917
- type: string | undefined;
919
+ name?: string | undefined;
920
+ type?: string | undefined;
918
921
  } | undefined;
919
- workspace: {
922
+ workspace?: {
920
923
  id: string;
921
- name: string | undefined;
922
- type: string | undefined;
924
+ name?: string | undefined;
925
+ type?: string | undefined;
923
926
  } | undefined;
924
- id: string;
925
- name: string | undefined;
926
- type: string | undefined;
927
927
  };
928
928
  /**
929
929
  * Converts an Asana section to the public camel-cased shape.
@@ -931,15 +931,15 @@ export declare function toAsanaProject(value: z.output<typeof ASANA_PROVIDER_PRO
931
931
  * @param value - Provider-native section.
932
932
  */
933
933
  export declare function toAsanaSection(value: z.output<typeof ASANA_PROVIDER_SECTION_SCHEMA>): {
934
- createdAt: string | undefined;
935
- project: {
934
+ id: string;
935
+ name?: string | undefined;
936
+ type?: string | undefined;
937
+ createdAt?: string | undefined;
938
+ project?: {
936
939
  id: string;
937
- name: string | undefined;
938
- type: string | undefined;
940
+ name?: string | undefined;
941
+ type?: string | undefined;
939
942
  } | undefined;
940
- id: string;
941
- name: string | undefined;
942
- type: string | undefined;
943
943
  };
944
944
  /**
945
945
  * Converts an Asana task to the public camel-cased shape.
@@ -947,123 +947,123 @@ export declare function toAsanaSection(value: z.output<typeof ASANA_PROVIDER_SEC
947
947
  * @param value - Provider-native task.
948
948
  */
949
949
  export declare function toAsanaTask(value: z.output<typeof ASANA_PROVIDER_TASK_SCHEMA>): {
950
- assignee: {
951
- id: string;
952
- name: string | undefined;
953
- type: string | undefined;
954
- } | undefined;
955
- assigneeStatus: string | undefined;
950
+ id: string;
956
951
  completed: boolean;
957
- completedAt: string | undefined;
958
- completedBy: {
959
- id: string;
960
- name: string | undefined;
961
- type: string | undefined;
962
- } | undefined;
963
- createdAt: string | undefined;
964
- createdBy: {
965
- id: string;
966
- name: string | undefined;
967
- type: string | undefined;
968
- } | undefined;
969
952
  customFields: {
970
- dateValue: {
971
- date: string;
972
- dateTime: string | undefined;
973
- } | undefined;
974
- displayValue: string | undefined;
975
- enumValue: {
976
- color: string | undefined;
977
- enabled: boolean;
953
+ id: string;
954
+ enumOptions: {
978
955
  id: string;
979
- name: string | undefined;
980
- type: string | undefined;
981
- } | undefined;
982
- multiEnumValues: {
983
- color: string | undefined;
984
956
  enabled: boolean;
957
+ name?: string | undefined;
958
+ type?: string | undefined;
959
+ color?: string | undefined;
960
+ }[];
961
+ subtype: string;
962
+ multiEnumValues: {
985
963
  id: string;
986
- name: string | undefined;
987
- type: string | undefined;
964
+ enabled: boolean;
965
+ name?: string | undefined;
966
+ type?: string | undefined;
967
+ color?: string | undefined;
988
968
  }[];
989
- numberValue: number | undefined;
990
969
  peopleValue: {
991
970
  id: string;
992
- name: string | undefined;
993
- type: string | undefined;
971
+ name?: string | undefined;
972
+ type?: string | undefined;
994
973
  }[];
995
974
  referenceValue: {
996
975
  id: string;
997
- name: string | undefined;
998
- type: string | undefined;
976
+ name?: string | undefined;
977
+ type?: string | undefined;
999
978
  }[];
1000
- textValue: string | undefined;
1001
- customLabel: string | undefined;
1002
- currencyCode: string | undefined;
1003
- description: string | undefined;
1004
- enumOptions: {
1005
- color: string | undefined;
1006
- enabled: boolean;
979
+ name?: string | undefined;
980
+ type?: string | undefined;
981
+ customLabel?: string | undefined;
982
+ currencyCode?: string | undefined;
983
+ description?: string | undefined;
984
+ format?: string | undefined;
985
+ precision?: number | undefined;
986
+ dateValue?: {
987
+ date: string;
988
+ dateTime?: string | undefined;
989
+ } | undefined;
990
+ displayValue?: string | undefined;
991
+ enumValue?: {
1007
992
  id: string;
1008
- name: string | undefined;
1009
- type: string | undefined;
1010
- }[];
1011
- format: string | undefined;
1012
- precision: number | undefined;
1013
- subtype: string;
1014
- id: string;
1015
- name: string | undefined;
1016
- type: string | undefined;
993
+ enabled: boolean;
994
+ name?: string | undefined;
995
+ type?: string | undefined;
996
+ color?: string | undefined;
997
+ } | undefined;
998
+ numberValue?: number | undefined;
999
+ textValue?: string | undefined;
1017
1000
  }[];
1018
- dueAt: string | undefined;
1019
- dueOn: string | undefined;
1020
1001
  followers: {
1021
1002
  id: string;
1022
- name: string | undefined;
1023
- type: string | undefined;
1003
+ name?: string | undefined;
1004
+ type?: string | undefined;
1024
1005
  }[];
1025
- htmlNotes: string | undefined;
1026
1006
  memberships: {
1027
1007
  project: {
1028
1008
  id: string;
1029
- name: string | undefined;
1030
- type: string | undefined;
1009
+ name?: string | undefined;
1010
+ type?: string | undefined;
1031
1011
  };
1032
- section: {
1012
+ section?: {
1033
1013
  id: string;
1034
- name: string | undefined;
1035
- type: string | undefined;
1014
+ name?: string | undefined;
1015
+ type?: string | undefined;
1036
1016
  } | undefined;
1037
1017
  }[];
1038
- modifiedAt: string | undefined;
1039
- notes: string | undefined;
1040
- parent: {
1041
- id: string;
1042
- name: string | undefined;
1043
- type: string | undefined;
1044
- } | undefined;
1045
- permalinkUrl: string | undefined;
1046
1018
  projects: {
1047
1019
  id: string;
1048
- name: string | undefined;
1049
- type: string | undefined;
1020
+ name?: string | undefined;
1021
+ type?: string | undefined;
1050
1022
  }[];
1051
- startAt: string | undefined;
1052
- startOn: string | undefined;
1053
- subtype: string | undefined;
1054
1023
  tags: {
1055
1024
  id: string;
1056
- name: string | undefined;
1057
- type: string | undefined;
1025
+ name?: string | undefined;
1026
+ type?: string | undefined;
1058
1027
  }[];
1059
- workspace: {
1028
+ name?: string | undefined;
1029
+ type?: string | undefined;
1030
+ assignee?: {
1060
1031
  id: string;
1061
- name: string | undefined;
1062
- type: string | undefined;
1032
+ name?: string | undefined;
1033
+ type?: string | undefined;
1034
+ } | undefined;
1035
+ assigneeStatus?: string | undefined;
1036
+ completedAt?: string | undefined;
1037
+ completedBy?: {
1038
+ id: string;
1039
+ name?: string | undefined;
1040
+ type?: string | undefined;
1041
+ } | undefined;
1042
+ createdAt?: string | undefined;
1043
+ createdBy?: {
1044
+ id: string;
1045
+ name?: string | undefined;
1046
+ type?: string | undefined;
1047
+ } | undefined;
1048
+ dueAt?: string | undefined;
1049
+ dueOn?: string | undefined;
1050
+ htmlNotes?: string | undefined;
1051
+ modifiedAt?: string | undefined;
1052
+ notes?: string | undefined;
1053
+ parent?: {
1054
+ id: string;
1055
+ name?: string | undefined;
1056
+ type?: string | undefined;
1057
+ } | undefined;
1058
+ permalinkUrl?: string | undefined;
1059
+ subtype?: string | undefined;
1060
+ startAt?: string | undefined;
1061
+ startOn?: string | undefined;
1062
+ workspace?: {
1063
+ id: string;
1064
+ name?: string | undefined;
1065
+ type?: string | undefined;
1063
1066
  } | undefined;
1064
- id: string;
1065
- name: string | undefined;
1066
- type: string | undefined;
1067
1067
  };
1068
1068
  /**
1069
1069
  * Converts an Asana story to the public camel-cased shape.
@@ -1071,20 +1071,20 @@ export declare function toAsanaTask(value: z.output<typeof ASANA_PROVIDER_TASK_S
1071
1071
  * @param value - Provider-native story.
1072
1072
  */
1073
1073
  export declare function toAsanaStory(value: z.output<typeof ASANA_PROVIDER_STORY_SCHEMA>): {
1074
- createdAt: string | undefined;
1075
- createdBy: {
1076
- id: string;
1077
- name: string | undefined;
1078
- type: string | undefined;
1079
- } | undefined;
1080
- htmlText: string | undefined;
1074
+ id: string;
1081
1075
  isEdited: boolean;
1082
1076
  isPinned: boolean;
1083
- subtype: string | undefined;
1084
1077
  text: string;
1085
- id: string;
1086
- name: string | undefined;
1087
- type: string | undefined;
1078
+ name?: string | undefined;
1079
+ type?: string | undefined;
1080
+ createdAt?: string | undefined;
1081
+ createdBy?: {
1082
+ id: string;
1083
+ name?: string | undefined;
1084
+ type?: string | undefined;
1085
+ } | undefined;
1086
+ htmlText?: string | undefined;
1087
+ subtype?: string | undefined;
1088
1088
  };
1089
1089
  /**
1090
1090
  * Converts one compact webhook event to the public Asana event shape.
@@ -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
  import { ASANA_CUSTOM_FIELD_VALUE_SCHEMA, ASANA_PROVIDER_CUSTOM_FIELD_VALUE_SCHEMA, toAsanaCustomFieldValue, } from "./resources.js";
4
4
  export const ASANA_WORKSPACE_SCHEMA = ASANA_RESOURCE_SCHEMA.extend({
5
5
  /** Domains associated with this workspace. */
@@ -313,7 +313,7 @@ export const ASANA_PROVIDER_EVENT_SCHEMA = z.looseObject({
313
313
  * @param value - Provider-native workspace.
314
314
  */
315
315
  export function toAsanaWorkspace(value) {
316
- return {
316
+ return ASANA_WORKSPACE_SCHEMA.parse(omitAsanaUndefined({
317
317
  ...toAsanaResource(value),
318
318
  ...(value.email_domains !== undefined && {
319
319
  emailDomains: value.email_domains,
@@ -321,7 +321,7 @@ export function toAsanaWorkspace(value) {
321
321
  ...(value.is_organization !== undefined && {
322
322
  isOrganization: value.is_organization,
323
323
  }),
324
- };
324
+ }));
325
325
  }
326
326
  /**
327
327
  * Converts an Asana user to the public camel-cased shape.
@@ -329,12 +329,12 @@ export function toAsanaWorkspace(value) {
329
329
  * @param value - Provider-native user.
330
330
  */
331
331
  export function toAsanaUser(value) {
332
- return {
332
+ return ASANA_USER_SCHEMA.parse(omitAsanaUndefined({
333
333
  ...toAsanaResource(value),
334
334
  email: value.email,
335
335
  photoUrl: value.photo?.image_128x128,
336
336
  workspaces: value.workspaces.map(toAsanaResource),
337
- };
337
+ }));
338
338
  }
339
339
  /**
340
340
  * Converts an Asana project to the public camel-cased shape.
@@ -342,7 +342,7 @@ export function toAsanaUser(value) {
342
342
  * @param value - Provider-native project.
343
343
  */
344
344
  export function toAsanaProject(value) {
345
- return {
345
+ return ASANA_PROJECT_SCHEMA.parse(omitAsanaUndefined({
346
346
  ...toAsanaResource(value),
347
347
  archived: value.archived,
348
348
  color: value.color ?? undefined,
@@ -357,7 +357,7 @@ export function toAsanaProject(value) {
357
357
  startOn: value.start_on ?? undefined,
358
358
  team: value.team ? toAsanaResource(value.team) : undefined,
359
359
  workspace: value.workspace ? toAsanaResource(value.workspace) : undefined,
360
- };
360
+ }));
361
361
  }
362
362
  /**
363
363
  * Converts an Asana section to the public camel-cased shape.
@@ -365,11 +365,11 @@ export function toAsanaProject(value) {
365
365
  * @param value - Provider-native section.
366
366
  */
367
367
  export function toAsanaSection(value) {
368
- return {
368
+ return ASANA_SECTION_SCHEMA.parse(omitAsanaUndefined({
369
369
  ...toAsanaResource(value),
370
370
  createdAt: value.created_at,
371
371
  project: value.project ? toAsanaResource(value.project) : undefined,
372
- };
372
+ }));
373
373
  }
374
374
  /**
375
375
  * Converts an Asana task to the public camel-cased shape.
@@ -377,7 +377,7 @@ export function toAsanaSection(value) {
377
377
  * @param value - Provider-native task.
378
378
  */
379
379
  export function toAsanaTask(value) {
380
- return {
380
+ return ASANA_TASK_SCHEMA.parse(omitAsanaUndefined({
381
381
  ...toAsanaResource(value),
382
382
  assignee: value.assignee ? toAsanaResource(value.assignee) : undefined,
383
383
  assigneeStatus: value.assignee_status,
@@ -387,7 +387,9 @@ export function toAsanaTask(value) {
387
387
  ? toAsanaResource(value.completed_by)
388
388
  : undefined,
389
389
  createdAt: value.created_at,
390
- createdBy: value.created_by ? toAsanaResource(value.created_by) : undefined,
390
+ createdBy: value.created_by
391
+ ? toAsanaResource(value.created_by)
392
+ : undefined,
391
393
  customFields: (value.custom_fields ?? []).map(toAsanaCustomFieldValue),
392
394
  dueAt: value.due_at ?? undefined,
393
395
  dueOn: value.due_on ?? undefined,
@@ -407,7 +409,7 @@ export function toAsanaTask(value) {
407
409
  subtype: value.resource_subtype,
408
410
  tags: value.tags.map(toAsanaResource),
409
411
  workspace: value.workspace ? toAsanaResource(value.workspace) : undefined,
410
- };
412
+ }));
411
413
  }
412
414
  /**
413
415
  * Converts an Asana story to the public camel-cased shape.
@@ -415,16 +417,18 @@ export function toAsanaTask(value) {
415
417
  * @param value - Provider-native story.
416
418
  */
417
419
  export function toAsanaStory(value) {
418
- return {
420
+ return ASANA_STORY_SCHEMA.parse(omitAsanaUndefined({
419
421
  ...toAsanaResource(value),
420
422
  createdAt: value.created_at,
421
- createdBy: value.created_by ? toAsanaResource(value.created_by) : undefined,
423
+ createdBy: value.created_by
424
+ ? toAsanaResource(value.created_by)
425
+ : undefined,
422
426
  htmlText: value.html_text,
423
427
  isEdited: value.is_edited,
424
428
  isPinned: value.is_pinned,
425
429
  subtype: value.resource_subtype,
426
430
  text: value.text,
427
- };
431
+ }));
428
432
  }
429
433
  /**
430
434
  * Converts one compact webhook event to the public Asana event shape.
@@ -434,7 +438,7 @@ export function toAsanaStory(value) {
434
438
  */
435
439
  export function normalizeAsanaEvent(value, watchedResourceId) {
436
440
  const event = ASANA_PROVIDER_EVENT_SCHEMA.parse(value);
437
- return ASANA_EVENT_SCHEMA.parse({
441
+ return ASANA_EVENT_SCHEMA.parse(omitAsanaUndefined({
438
442
  action: event.action,
439
443
  change: event.change
440
444
  ? {
@@ -452,7 +456,7 @@ export function normalizeAsanaEvent(value, watchedResourceId) {
452
456
  resourceType: event.resource.resource_type ?? event.type,
453
457
  user: event.user ? toAsanaResource(event.user) : undefined,
454
458
  watchedResourceId,
455
- });
459
+ }));
456
460
  }
457
461
  /**
458
462
  * Converts one provider-native story to the public Asana story shape.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automate.ax/integration-contracts",
3
- "version": "0.112.6",
3
+ "version": "0.112.7",
4
4
  "description": "Shared integration payload contracts and provider primitives for Automate.ax.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -50,7 +50,7 @@
50
50
  }
51
51
  },
52
52
  "dependencies": {
53
- "@automate.ax/codec": "0.112.6",
53
+ "@automate.ax/codec": "0.112.7",
54
54
  "@cfworker/json-schema": "^4.1.1",
55
55
  "@googleapis/calendar": "^15.0.0",
56
56
  "@googleapis/forms": "^6.0.1",
package/src/asana/base.ts CHANGED
@@ -35,11 +35,13 @@ export const ASANA_PROVIDER_PAGE_SCHEMA = z.looseObject({
35
35
  export function toAsanaResource(
36
36
  value: z.output<typeof ASANA_PROVIDER_RESOURCE_SCHEMA>,
37
37
  ) {
38
- return {
39
- id: value.gid,
40
- name: value.name,
41
- type: value.resource_type,
42
- }
38
+ return ASANA_RESOURCE_SCHEMA.parse(
39
+ omitAsanaUndefined({
40
+ id: value.gid,
41
+ name: value.name,
42
+ type: value.resource_type,
43
+ }),
44
+ )
43
45
  }
44
46
 
45
47
  /**
@@ -56,3 +58,20 @@ export function toAsanaPageInfo(
56
58
  }),
57
59
  }
58
60
  }
61
+
62
+ /**
63
+ * Removes undefined properties from normalized Asana JSON values.
64
+ *
65
+ * @param value - Normalized value to clean recursively.
66
+ */
67
+ export function omitAsanaUndefined(value: unknown): unknown {
68
+ if (Array.isArray(value)) {
69
+ return value.map(omitAsanaUndefined)
70
+ }
71
+ if (value === null || typeof value !== "object") return value
72
+ return Object.fromEntries(
73
+ Object.entries(value)
74
+ .filter(([, entry]) => entry !== undefined)
75
+ .map(([key, entry]) => [key, omitAsanaUndefined(entry)]),
76
+ )
77
+ }