@osdk/maker 0.12.0-beta.8 → 0.12.0-rc.23
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/CHANGELOG.md +138 -0
- package/README.md +88 -62
- package/build/browser/api/defineAction.js +403 -106
- package/build/browser/api/defineAction.js.map +1 -1
- package/build/browser/api/defineLink.js +2 -2
- package/build/browser/api/defineLink.js.map +1 -1
- package/build/browser/api/defineObject.js +6 -2
- package/build/browser/api/defineObject.js.map +1 -1
- package/build/browser/api/defineOntology.js +80 -35
- package/build/browser/api/defineOntology.js.map +1 -1
- package/build/browser/api/defineSpt.js.map +1 -1
- package/build/browser/api/ontologyUtils.js +80 -0
- package/build/browser/api/ontologyUtils.js.map +1 -1
- package/build/browser/api/overall.test.js +4741 -2358
- package/build/browser/api/overall.test.js.map +1 -1
- package/build/browser/api/types.js +2 -0
- package/build/browser/api/types.js.map +1 -1
- package/build/browser/cli/main.js +2 -10
- package/build/browser/cli/main.js.map +1 -1
- package/build/browser/index.js +5 -4
- package/build/browser/index.js.map +1 -1
- package/build/cjs/index.cjs +575 -153
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +98 -20
- package/build/esm/api/defineAction.js +403 -106
- package/build/esm/api/defineAction.js.map +1 -1
- package/build/esm/api/defineLink.js +2 -2
- package/build/esm/api/defineLink.js.map +1 -1
- package/build/esm/api/defineObject.js +6 -2
- package/build/esm/api/defineObject.js.map +1 -1
- package/build/esm/api/defineOntology.js +80 -35
- package/build/esm/api/defineOntology.js.map +1 -1
- package/build/esm/api/defineSpt.js.map +1 -1
- package/build/esm/api/ontologyUtils.js +80 -0
- package/build/esm/api/ontologyUtils.js.map +1 -1
- package/build/esm/api/overall.test.js +4741 -2358
- package/build/esm/api/overall.test.js.map +1 -1
- package/build/esm/api/types.js +2 -0
- package/build/esm/api/types.js.map +1 -1
- package/build/esm/cli/main.js +2 -10
- package/build/esm/cli/main.js.map +1 -1
- package/build/esm/index.js +5 -4
- package/build/esm/index.js.map +1 -1
- package/build/types/api/defineAction.d.ts +7 -6
- package/build/types/api/defineAction.d.ts.map +1 -1
- package/build/types/api/defineObject.d.ts +2 -2
- package/build/types/api/defineObject.d.ts.map +1 -1
- package/build/types/api/defineOntology.d.ts +3 -2
- package/build/types/api/defineOntology.d.ts.map +1 -1
- package/build/types/api/defineSpt.d.ts +2 -2
- package/build/types/api/defineSpt.d.ts.map +1 -1
- package/build/types/api/ontologyUtils.d.ts +5 -2
- package/build/types/api/ontologyUtils.d.ts.map +1 -1
- package/build/types/api/types.d.ts +83 -12
- package/build/types/api/types.d.ts.map +1 -1
- package/build/types/cli/main.d.ts.map +1 -1
- package/build/types/index.d.ts +6 -5
- package/build/types/index.d.ts.map +1 -1
- package/package.json +4 -4
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
import * as fs from "fs";
|
|
18
18
|
import * as path from "path";
|
|
19
19
|
import invariant from "tiny-invariant";
|
|
20
|
-
import { isExotic } from "./defineObject.js";
|
|
21
|
-
import { convertActionParameterConditionalOverride, convertActionVisibility } from "./ontologyUtils.js";
|
|
20
|
+
import { convertToDisplayName, isExotic } from "./defineObject.js";
|
|
21
|
+
import { convertActionParameterConditionalOverride, convertActionVisibility, convertSectionConditionalOverride, getFormContentOrdering } from "./ontologyUtils.js";
|
|
22
22
|
import { convertNullabilityToDataConstraint, convertType, convertValueType, convertValueTypeDataConstraints, defaultTypeClasses, getPropertyTypeName, hasRenderHints, shouldNotHaveRenderHints } from "./propertyConversionUtils.js";
|
|
23
23
|
import { OntologyEntityTypeEnum } from "./types.js";
|
|
24
24
|
|
|
@@ -176,7 +176,11 @@ function convertToWireImportedTypes(importedTypes) {
|
|
|
176
176
|
apiName: spt.sharedPropertyType.apiName,
|
|
177
177
|
displayName: spt.sharedPropertyType.displayMetadata.displayName,
|
|
178
178
|
description: spt.sharedPropertyType.displayMetadata.description,
|
|
179
|
-
type: spt.sharedPropertyType.type
|
|
179
|
+
type: spt.sharedPropertyType.type,
|
|
180
|
+
valueType: spt.sharedPropertyType.valueType === undefined ? undefined : {
|
|
181
|
+
apiName: spt.sharedPropertyType.valueType.apiName,
|
|
182
|
+
version: spt.sharedPropertyType.valueType.version
|
|
183
|
+
}
|
|
180
184
|
})),
|
|
181
185
|
objectTypes: Object.values(asBlockData.objectTypes).map(ot => ({
|
|
182
186
|
apiName: ot.objectType.apiName,
|
|
@@ -569,7 +573,7 @@ function convertLink(linkType) {
|
|
|
569
573
|
apiName: linkType.toMany.object.primaryKeyPropertyApiName,
|
|
570
574
|
object: linkType.toMany.object.apiName
|
|
571
575
|
},
|
|
572
|
-
column: linkType.
|
|
576
|
+
column: linkType.toMany.object.primaryKeyPropertyApiName
|
|
573
577
|
}]
|
|
574
578
|
}
|
|
575
579
|
},
|
|
@@ -666,7 +670,10 @@ function convertSpt({
|
|
|
666
670
|
gothamMapping: gothamMapping,
|
|
667
671
|
indexedForSearch: true,
|
|
668
672
|
typeClasses: typeClasses ?? [],
|
|
669
|
-
valueType: valueType
|
|
673
|
+
valueType: valueType === undefined ? undefined : {
|
|
674
|
+
apiName: valueType.apiName,
|
|
675
|
+
version: valueType.version
|
|
676
|
+
}
|
|
670
677
|
};
|
|
671
678
|
}
|
|
672
679
|
function convertObjectStatus(status) {
|
|
@@ -704,6 +711,7 @@ function convertAction(action) {
|
|
|
704
711
|
const actionValidation = convertActionValidation(action);
|
|
705
712
|
const actionParameters = convertActionParameters(action);
|
|
706
713
|
const actionSections = convertActionSections(action);
|
|
714
|
+
const parameterOrdering = action.parameterOrdering ?? (action.parameters ?? []).map(p => p.id);
|
|
707
715
|
return {
|
|
708
716
|
actionType: {
|
|
709
717
|
actionTypeLogic: {
|
|
@@ -716,8 +724,8 @@ function convertAction(action) {
|
|
|
716
724
|
apiName: action.apiName,
|
|
717
725
|
displayMetadata: {
|
|
718
726
|
configuration: {
|
|
719
|
-
defaultLayout: "FORM",
|
|
720
|
-
displayAndFormat: {
|
|
727
|
+
defaultLayout: action.defaultFormat ?? "FORM",
|
|
728
|
+
displayAndFormat: action.displayAndFormat ?? {
|
|
721
729
|
table: {
|
|
722
730
|
columnWidthByParameterRid: {},
|
|
723
731
|
enableFileImport: true,
|
|
@@ -726,7 +734,7 @@ function convertAction(action) {
|
|
|
726
734
|
rowHeightInLines: 1
|
|
727
735
|
}
|
|
728
736
|
},
|
|
729
|
-
enableLayoutUserSwitch: false
|
|
737
|
+
enableLayoutUserSwitch: action.enableLayoutSwitch ?? false
|
|
730
738
|
},
|
|
731
739
|
description: action.description ?? "",
|
|
732
740
|
displayName: action.displayName,
|
|
@@ -737,11 +745,20 @@ function convertAction(action) {
|
|
|
737
745
|
color: "#000000"
|
|
738
746
|
}
|
|
739
747
|
},
|
|
740
|
-
successMessage: [
|
|
741
|
-
|
|
748
|
+
successMessage: action.submissionMetadata?.successMessage ? [{
|
|
749
|
+
type: "message",
|
|
750
|
+
message: action.submissionMetadata.successMessage
|
|
751
|
+
}] : [],
|
|
752
|
+
typeClasses: action.typeClasses ?? [],
|
|
753
|
+
...(action.submissionMetadata?.submitButtonDisplayMetadata && {
|
|
754
|
+
submitButtonDisplayMetadata: action.submissionMetadata.submitButtonDisplayMetadata
|
|
755
|
+
}),
|
|
756
|
+
...(action.submissionMetadata?.undoButtonConfiguration && {
|
|
757
|
+
undoButtonConfiguration: action.submissionMetadata.undoButtonConfiguration
|
|
758
|
+
})
|
|
742
759
|
},
|
|
743
|
-
|
|
744
|
-
|
|
760
|
+
parameterOrdering: parameterOrdering,
|
|
761
|
+
formContentOrdering: getFormContentOrdering(action, parameterOrdering),
|
|
745
762
|
parameters: actionParameters,
|
|
746
763
|
sections: actionSections,
|
|
747
764
|
status: typeof action.status === "string" ? {
|
|
@@ -772,16 +789,35 @@ function convertActionValidation(action) {
|
|
|
772
789
|
defaultValidation: {
|
|
773
790
|
display: {
|
|
774
791
|
renderHint: renderHintFromBaseType(p),
|
|
775
|
-
visibility: convertActionVisibility(p.validation.defaultVisibility)
|
|
792
|
+
visibility: convertActionVisibility(p.validation.defaultVisibility),
|
|
793
|
+
...(p.defaultValue && {
|
|
794
|
+
prefill: p.defaultValue
|
|
795
|
+
})
|
|
776
796
|
},
|
|
777
797
|
validation: {
|
|
778
|
-
allowedValues: extractAllowedValues(p),
|
|
798
|
+
allowedValues: extractAllowedValues(p.validation.allowedValues),
|
|
779
799
|
required: convertParameterRequirementConstraint(p.validation.required)
|
|
780
800
|
}
|
|
781
801
|
},
|
|
782
802
|
conditionalOverrides: p.validation.conditionalOverrides?.map(override => convertActionParameterConditionalOverride(override, p.validation)) ?? []
|
|
783
803
|
}];
|
|
784
|
-
}))
|
|
804
|
+
})),
|
|
805
|
+
sectionValidations: {
|
|
806
|
+
...Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [section.id, {
|
|
807
|
+
defaultDisplayMetadata: section.defaultVisibility === "hidden" ? {
|
|
808
|
+
visibility: {
|
|
809
|
+
type: "hidden",
|
|
810
|
+
hidden: {}
|
|
811
|
+
}
|
|
812
|
+
} : {
|
|
813
|
+
visibility: {
|
|
814
|
+
type: "visible",
|
|
815
|
+
visible: {}
|
|
816
|
+
}
|
|
817
|
+
},
|
|
818
|
+
conditionalOverrides: section.conditionalOverrides?.map(override => convertSectionConditionalOverride(override, section.defaultVisibility ?? "visible")) ?? []
|
|
819
|
+
}]))
|
|
820
|
+
}
|
|
785
821
|
};
|
|
786
822
|
}
|
|
787
823
|
function convertActionParameters(action) {
|
|
@@ -799,32 +835,41 @@ function convertActionParameters(action) {
|
|
|
799
835
|
}]));
|
|
800
836
|
}
|
|
801
837
|
function convertActionSections(action) {
|
|
802
|
-
return Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId,
|
|
838
|
+
return Object.fromEntries(Object.entries(action.sections ?? {}).map(([sectionId, section]) => [sectionId, {
|
|
803
839
|
id: sectionId,
|
|
804
|
-
content:
|
|
840
|
+
content: section.parameters.map(p => ({
|
|
805
841
|
type: "parameterId",
|
|
806
842
|
parameterId: p
|
|
807
843
|
})),
|
|
808
844
|
displayMetadata: {
|
|
809
|
-
collapsedByDefault: false,
|
|
810
|
-
columnCount: 1,
|
|
811
|
-
description: "",
|
|
812
|
-
displayName: sectionId,
|
|
813
|
-
showTitleBar: true
|
|
845
|
+
collapsedByDefault: section.collapsedByDefault ?? false,
|
|
846
|
+
columnCount: section.columnCount ?? 1,
|
|
847
|
+
description: section.description ?? "",
|
|
848
|
+
displayName: section.displayName ?? convertToDisplayName(sectionId),
|
|
849
|
+
showTitleBar: section.showTitleBar ?? true,
|
|
850
|
+
...(section.style && {
|
|
851
|
+
style: section.style === "box" ? {
|
|
852
|
+
type: "box",
|
|
853
|
+
box: {}
|
|
854
|
+
} : {
|
|
855
|
+
type: "minimal",
|
|
856
|
+
minimal: {}
|
|
857
|
+
}
|
|
858
|
+
})
|
|
814
859
|
}
|
|
815
860
|
}]));
|
|
816
861
|
}
|
|
817
|
-
function extractAllowedValues(
|
|
818
|
-
switch (
|
|
862
|
+
export function extractAllowedValues(allowedValues) {
|
|
863
|
+
switch (allowedValues.type) {
|
|
819
864
|
case "oneOf":
|
|
820
865
|
return {
|
|
821
866
|
type: "oneOf",
|
|
822
867
|
oneOf: {
|
|
823
868
|
type: "oneOf",
|
|
824
869
|
oneOf: {
|
|
825
|
-
labelledValues:
|
|
870
|
+
labelledValues: allowedValues.oneOf,
|
|
826
871
|
otherValueAllowed: {
|
|
827
|
-
allowed: false
|
|
872
|
+
allowed: allowedValues.otherValueAllowed ?? false
|
|
828
873
|
}
|
|
829
874
|
}
|
|
830
875
|
}
|
|
@@ -833,7 +878,7 @@ function extractAllowedValues(parameter) {
|
|
|
833
878
|
const {
|
|
834
879
|
min,
|
|
835
880
|
max
|
|
836
|
-
} =
|
|
881
|
+
} = allowedValues;
|
|
837
882
|
return {
|
|
838
883
|
type: "range",
|
|
839
884
|
range: {
|
|
@@ -859,17 +904,17 @@ function extractAllowedValues(parameter) {
|
|
|
859
904
|
minLength,
|
|
860
905
|
maxLength,
|
|
861
906
|
regex
|
|
862
|
-
} =
|
|
907
|
+
} = allowedValues;
|
|
863
908
|
return {
|
|
864
909
|
type: "text",
|
|
865
910
|
text: {
|
|
866
911
|
type: "text",
|
|
867
912
|
text: {
|
|
868
913
|
...(minLength === undefined ? {} : {
|
|
869
|
-
|
|
914
|
+
minLength: minLength
|
|
870
915
|
}),
|
|
871
916
|
...(maxLength === undefined ? {} : {
|
|
872
|
-
|
|
917
|
+
maxLength: maxLength
|
|
873
918
|
}),
|
|
874
919
|
...(regex === undefined ? {} : {
|
|
875
920
|
regex: {
|
|
@@ -884,7 +929,7 @@ function extractAllowedValues(parameter) {
|
|
|
884
929
|
const {
|
|
885
930
|
minimum,
|
|
886
931
|
maximum
|
|
887
|
-
} =
|
|
932
|
+
} = allowedValues;
|
|
888
933
|
return {
|
|
889
934
|
type: "datetime",
|
|
890
935
|
datetime: {
|
|
@@ -901,7 +946,7 @@ function extractAllowedValues(parameter) {
|
|
|
901
946
|
objectTypeReference: {
|
|
902
947
|
type: "objectTypeReference",
|
|
903
948
|
objectTypeReference: {
|
|
904
|
-
interfaceTypeRids:
|
|
949
|
+
interfaceTypeRids: allowedValues.interfaceTypes
|
|
905
950
|
}
|
|
906
951
|
}
|
|
907
952
|
};
|
|
@@ -919,7 +964,7 @@ function extractAllowedValues(parameter) {
|
|
|
919
964
|
}
|
|
920
965
|
};
|
|
921
966
|
default:
|
|
922
|
-
const k =
|
|
967
|
+
const k = allowedValues.type;
|
|
923
968
|
return {
|
|
924
969
|
type: k,
|
|
925
970
|
[k]: {
|
|
@@ -979,12 +1024,12 @@ function renderHintFromBaseType(parameter) {
|
|
|
979
1024
|
};
|
|
980
1025
|
case "marking":
|
|
981
1026
|
case "markingList":
|
|
982
|
-
if (parameter.validation.allowedValues
|
|
1027
|
+
if (parameter.validation.allowedValues?.type === "mandatoryMarking") {
|
|
983
1028
|
return {
|
|
984
1029
|
type: "mandatoryMarkingPicker",
|
|
985
1030
|
mandatoryMarkingPicker: {}
|
|
986
1031
|
};
|
|
987
|
-
} else if (parameter.validation.allowedValues
|
|
1032
|
+
} else if (parameter.validation.allowedValues?.type === "cbacMarking") {
|
|
988
1033
|
return {
|
|
989
1034
|
type: "cbacMarkingPicker",
|
|
990
1035
|
cbacMarkingPicker: {}
|