Skip to content

Commit

Permalink
applying patch
Browse files Browse the repository at this point in the history
  • Loading branch information
PatrickAtlassian committed Aug 15, 2023
1 parent 4884b0c commit 1c2da7c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"typescript": "~4.5.5"
},
"dependencies": {
"@atlassian/forge-graphql": "13.0.6",
"@atlassian/forge-graphql": "13.3.0",
"@forge/api": "^2.8.1",
"@forge/bridge": "^2.3.0",
"@forge/events": "^0.5.3",
Expand Down
23 changes: 23 additions & 0 deletions src/utils/format-custom-fields-to-yaml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import {
CompassCustomNumberField,
CompassCustomTextField,
CompassCustomUserField,
CompassCustomSingleSelectField,
CompassCustomMultiSelectField,
CustomField,
CustomFieldFromYAML,
CustomFieldType,
Expand All @@ -20,6 +22,15 @@ export const isCompassCustomBooleanField = (customField: CustomField): customFie
export const isCompassCustomUserField = (customField: CustomField): customField is CompassCustomUserField =>
(customField as CompassCustomUserField).userIdValue !== undefined;

export const isCompassCustomSingleSelectField = (
customField: CustomField,
): customField is CompassCustomSingleSelectField =>
(customField as CompassCustomSingleSelectField).option !== undefined;

export const isCompassCustomMultiSelectField = (
customField: CustomField,
): customField is CompassCustomMultiSelectField => (customField as CompassCustomMultiSelectField).options !== undefined;

export const formatCustomFieldsToYamlFormat = (
customFieldsInComponent: CustomField[],
): CustomFieldFromYAML[] | null => {
Expand Down Expand Up @@ -58,6 +69,18 @@ export const formatCustomFieldsToYamlFormat = (
return [mappedCustomFieldToYamlFormat];
}

if (isCompassCustomSingleSelectField(customField)) {
mappedCustomFieldToYamlFormat.type = CustomFieldType.SINGLE_SELECT;
mappedCustomFieldToYamlFormat.value = customField?.option?.id || null;
return [mappedCustomFieldToYamlFormat];
}

if (isCompassCustomMultiSelectField(customField)) {
mappedCustomFieldToYamlFormat.type = CustomFieldType.MULTI_SELECT;
mappedCustomFieldToYamlFormat.value = customField?.options?.map((option) => option.id) || null;
return [mappedCustomFieldToYamlFormat];
}

// Future types added here will return an empty array which the flatmap
// will remove resulting in no code being shown in the yaml file and no
// errors being thrown
Expand Down
9 changes: 5 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@
call-me-maybe "^1.0.1"
js-yaml "^4.1.0"

"@atlassian/forge-graphql@13.0.6":
version "13.0.6"
resolved "https://packages.atlassian.com/api/npm/atlassian-npm/@atlassian/forge-graphql/-/forge-graphql-13.0.6.tgz#0f0d69dfaf513f8451558362223d6f00985e57f9"
integrity sha512-yZjEdOY0DTXuXx/XwM64SEvZLiVdqhQTprWUFYMwksmn4L/xPFoclggoxo5o3n3xkJtfzVogxqxITUMt0kDtPw==
"@atlassian/forge-graphql@13.3.0":
version "13.3.0"
resolved "https://packages.atlassian.com/api/npm/atlassian-npm/@atlassian/forge-graphql/-/forge-graphql-13.3.0.tgz#4711ec64e86739eb31ddb6b7472fb9a3dc449b41"
integrity sha512-Z9ZFD/PAfCexEfSYEMAM+Z9X0kocp5sgHcvvcrKcxf7uCMXwFPzagWcWt0q0PF2xoqprq/PQ2TIPSI0oDugXbA==
dependencies:
"@forge/api" "^2.3.0"
axios "^0.21.1"
fs "^0.0.1-security"
js-yaml "^4.1.0"
lodash "^4.17.21"
path "^0.12.7"
url-parse "^1.5.10"

Expand Down

0 comments on commit 1c2da7c

Please sign in to comment.