@automate.ax/integration-contracts 0.112.6 → 0.112.8
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.
- package/dist/asana/base.d.ts +8 -2
- package/dist/asana/base.js +17 -2
- package/dist/asana/index.d.ts +2 -2
- package/dist/asana/resources.d.ts +95 -95
- package/dist/asana/resources.js +17 -17
- package/dist/asana/schemas.d.ts +141 -141
- package/dist/asana/schemas.js +25 -21
- package/package.json +2 -2
- package/src/asana/base.ts +24 -5
- package/src/asana/resources.ts +94 -77
- package/src/asana/schemas.ts +118 -99
package/dist/asana/schemas.d.ts
CHANGED
|
@@ -197,8 +197,8 @@ export declare const ASANA_STORY_SCHEMA: z.ZodObject<{
|
|
|
197
197
|
type: z.ZodOptional<z.ZodString>;
|
|
198
198
|
}, z.core.$strip>>;
|
|
199
199
|
htmlText: z.ZodOptional<z.ZodString>;
|
|
200
|
-
isEdited: z.ZodBoolean
|
|
201
|
-
isPinned: z.ZodBoolean
|
|
200
|
+
isEdited: z.ZodOptional<z.ZodBoolean>;
|
|
201
|
+
isPinned: z.ZodOptional<z.ZodBoolean>;
|
|
202
202
|
subtype: z.ZodOptional<z.ZodString>;
|
|
203
203
|
text: z.ZodString;
|
|
204
204
|
}, z.core.$strip>;
|
|
@@ -569,8 +569,8 @@ export declare const ASANA_COMMENT_ADDED_EVENT_SCHEMA: z.ZodObject<{
|
|
|
569
569
|
type: z.ZodOptional<z.ZodString>;
|
|
570
570
|
}, z.core.$strip>>;
|
|
571
571
|
htmlText: z.ZodOptional<z.ZodString>;
|
|
572
|
-
isEdited: z.ZodBoolean
|
|
573
|
-
isPinned: z.ZodBoolean
|
|
572
|
+
isEdited: z.ZodOptional<z.ZodBoolean>;
|
|
573
|
+
isPinned: z.ZodOptional<z.ZodBoolean>;
|
|
574
574
|
text: z.ZodString;
|
|
575
575
|
event: z.ZodObject<{
|
|
576
576
|
change: z.ZodOptional<z.ZodObject<{
|
|
@@ -820,8 +820,8 @@ export declare const ASANA_PROVIDER_STORY_SCHEMA: z.ZodObject<{
|
|
|
820
820
|
resource_type: z.ZodOptional<z.ZodString>;
|
|
821
821
|
}, z.core.$loose>>>;
|
|
822
822
|
html_text: z.ZodOptional<z.ZodString>;
|
|
823
|
-
is_edited: z.ZodBoolean
|
|
824
|
-
is_pinned: z.ZodBoolean
|
|
823
|
+
is_edited: z.ZodOptional<z.ZodBoolean>;
|
|
824
|
+
is_pinned: z.ZodOptional<z.ZodBoolean>;
|
|
825
825
|
resource_subtype: z.ZodOptional<z.ZodString>;
|
|
826
826
|
text: z.ZodString;
|
|
827
827
|
}, z.core.$loose>;
|
|
@@ -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
|
|
878
|
-
type
|
|
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
|
-
|
|
887
|
-
photoUrl: string | undefined;
|
|
886
|
+
id: string;
|
|
888
887
|
workspaces: {
|
|
889
888
|
id: string;
|
|
890
|
-
name
|
|
891
|
-
type
|
|
889
|
+
name?: string | undefined;
|
|
890
|
+
type?: string | undefined;
|
|
892
891
|
}[];
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
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
|
-
|
|
914
|
-
|
|
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
|
|
917
|
-
type
|
|
919
|
+
name?: string | undefined;
|
|
920
|
+
type?: string | undefined;
|
|
918
921
|
} | undefined;
|
|
919
|
-
workspace
|
|
922
|
+
workspace?: {
|
|
920
923
|
id: string;
|
|
921
|
-
name
|
|
922
|
-
type
|
|
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
|
-
|
|
935
|
-
|
|
934
|
+
id: string;
|
|
935
|
+
name?: string | undefined;
|
|
936
|
+
type?: string | undefined;
|
|
937
|
+
createdAt?: string | undefined;
|
|
938
|
+
project?: {
|
|
936
939
|
id: string;
|
|
937
|
-
name
|
|
938
|
-
type
|
|
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
|
-
|
|
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
|
-
|
|
971
|
-
|
|
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
|
-
|
|
987
|
-
|
|
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
|
|
993
|
-
type
|
|
971
|
+
name?: string | undefined;
|
|
972
|
+
type?: string | undefined;
|
|
994
973
|
}[];
|
|
995
974
|
referenceValue: {
|
|
996
975
|
id: string;
|
|
997
|
-
name
|
|
998
|
-
type
|
|
976
|
+
name?: string | undefined;
|
|
977
|
+
type?: string | undefined;
|
|
999
978
|
}[];
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
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
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
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
|
|
1023
|
-
type
|
|
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
|
|
1030
|
-
type
|
|
1009
|
+
name?: string | undefined;
|
|
1010
|
+
type?: string | undefined;
|
|
1031
1011
|
};
|
|
1032
|
-
section
|
|
1012
|
+
section?: {
|
|
1033
1013
|
id: string;
|
|
1034
|
-
name
|
|
1035
|
-
type
|
|
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
|
|
1049
|
-
type
|
|
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
|
|
1057
|
-
type
|
|
1025
|
+
name?: string | undefined;
|
|
1026
|
+
type?: string | undefined;
|
|
1058
1027
|
}[];
|
|
1059
|
-
|
|
1028
|
+
name?: string | undefined;
|
|
1029
|
+
type?: string | undefined;
|
|
1030
|
+
assignee?: {
|
|
1060
1031
|
id: string;
|
|
1061
|
-
name
|
|
1062
|
-
type
|
|
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
|
-
|
|
1075
|
-
|
|
1074
|
+
id: string;
|
|
1075
|
+
text: string;
|
|
1076
|
+
name?: string | undefined;
|
|
1077
|
+
type?: string | undefined;
|
|
1078
|
+
createdAt?: string | undefined;
|
|
1079
|
+
createdBy?: {
|
|
1076
1080
|
id: string;
|
|
1077
|
-
name
|
|
1078
|
-
type
|
|
1081
|
+
name?: string | undefined;
|
|
1082
|
+
type?: string | undefined;
|
|
1079
1083
|
} | undefined;
|
|
1080
|
-
htmlText
|
|
1081
|
-
isEdited
|
|
1082
|
-
isPinned
|
|
1083
|
-
subtype
|
|
1084
|
-
text: string;
|
|
1085
|
-
id: string;
|
|
1086
|
-
name: string | undefined;
|
|
1087
|
-
type: string | undefined;
|
|
1084
|
+
htmlText?: string | undefined;
|
|
1085
|
+
isEdited?: boolean | undefined;
|
|
1086
|
+
isPinned?: boolean | undefined;
|
|
1087
|
+
subtype?: string | undefined;
|
|
1088
1088
|
};
|
|
1089
1089
|
/**
|
|
1090
1090
|
* Converts one compact webhook event to the public Asana event shape.
|
|
@@ -1128,8 +1128,6 @@ export declare function normalizeAsanaEvent(value: unknown, watchedResourceId: s
|
|
|
1128
1128
|
*/
|
|
1129
1129
|
export declare function normalizeAsanaStory(value: unknown): {
|
|
1130
1130
|
id: string;
|
|
1131
|
-
isEdited: boolean;
|
|
1132
|
-
isPinned: boolean;
|
|
1133
1131
|
text: string;
|
|
1134
1132
|
name?: string | undefined;
|
|
1135
1133
|
type?: string | undefined;
|
|
@@ -1140,6 +1138,8 @@ export declare function normalizeAsanaStory(value: unknown): {
|
|
|
1140
1138
|
type?: string | undefined;
|
|
1141
1139
|
} | undefined;
|
|
1142
1140
|
htmlText?: string | undefined;
|
|
1141
|
+
isEdited?: boolean | undefined;
|
|
1142
|
+
isPinned?: boolean | undefined;
|
|
1143
1143
|
subtype?: string | undefined;
|
|
1144
1144
|
};
|
|
1145
1145
|
/**
|
package/dist/asana/schemas.js
CHANGED
|
@@ -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. */
|
|
@@ -111,9 +111,9 @@ export const ASANA_STORY_SCHEMA = ASANA_RESOURCE_SCHEMA.extend({
|
|
|
111
111
|
/** Rich-text comment content. */
|
|
112
112
|
htmlText: z.string().optional(),
|
|
113
113
|
/** Whether the comment was edited. */
|
|
114
|
-
isEdited: z.boolean(),
|
|
114
|
+
isEdited: z.boolean().optional(),
|
|
115
115
|
/** Whether the story is pinned. */
|
|
116
|
-
isPinned: z.boolean(),
|
|
116
|
+
isPinned: z.boolean().optional(),
|
|
117
117
|
/** Story subtype, such as `comment_added`. */
|
|
118
118
|
subtype: z.string().optional(),
|
|
119
119
|
/** Plain-text story or comment content. */
|
|
@@ -286,8 +286,8 @@ export const ASANA_PROVIDER_STORY_SCHEMA = ASANA_PROVIDER_RESOURCE_SCHEMA.extend
|
|
|
286
286
|
created_at: z.string().optional(),
|
|
287
287
|
created_by: ASANA_PROVIDER_RESOURCE_SCHEMA.nullish(),
|
|
288
288
|
html_text: z.string().optional(),
|
|
289
|
-
is_edited: z.boolean(),
|
|
290
|
-
is_pinned: z.boolean(),
|
|
289
|
+
is_edited: z.boolean().optional(),
|
|
290
|
+
is_pinned: z.boolean().optional(),
|
|
291
291
|
resource_subtype: z.string().optional(),
|
|
292
292
|
text: z.string(),
|
|
293
293
|
});
|
|
@@ -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
|
|
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
|
|
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.
|
|
3
|
+
"version": "0.112.8",
|
|
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.
|
|
53
|
+
"@automate.ax/codec": "0.112.8",
|
|
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
|
-
|
|
40
|
-
|
|
41
|
-
|
|
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
|
+
}
|