@osdk/maker 0.15.0-beta.7 → 0.15.0-beta.9
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 +19 -0
- package/README.md +26 -22
- package/build/browser/api/action/ActionParameterConditionalOverride.js.map +1 -1
- package/build/browser/api/defineInterface.js.map +1 -1
- package/build/browser/api/defineOntology.js +6 -0
- package/build/browser/api/defineOntology.js.map +1 -1
- package/build/browser/api/defineValueType.js +25 -7
- package/build/browser/api/defineValueType.js.map +1 -1
- package/build/browser/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js +5 -0
- package/build/browser/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js.map +1 -1
- package/build/browser/api/links/LinkType.js.map +1 -1
- package/build/browser/api/object/ObjectTypeStatus.js.map +1 -1
- package/build/browser/api/test/actions.test.js +8 -5
- package/build/browser/api/test/actions.test.js.map +1 -1
- package/build/browser/api/test/interfaces.test.js +12 -0
- package/build/browser/api/test/interfaces.test.js.map +1 -1
- package/build/browser/api/test/misc.test.js +4 -2
- package/build/browser/api/test/misc.test.js.map +1 -1
- package/build/browser/api/test/objects.test.js +3 -2
- package/build/browser/api/test/objects.test.js.map +1 -1
- package/build/browser/api/test/valueTypes.test.js +151 -0
- package/build/browser/api/test/valueTypes.test.js.map +1 -1
- package/build/browser/cli/main.js +1 -1
- package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js +15 -7
- package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -1
- package/build/browser/conversion/toMarketplace/convertLink.js +30 -4
- package/build/browser/conversion/toMarketplace/convertLink.js.map +1 -1
- package/build/browser/conversion/toMarketplace/convertObject.js +6 -5
- package/build/browser/conversion/toMarketplace/convertObject.js.map +1 -1
- package/build/cjs/index.cjs +86 -22
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +29 -5
- package/build/esm/api/action/ActionParameterConditionalOverride.js.map +1 -1
- package/build/esm/api/defineInterface.js.map +1 -1
- package/build/esm/api/defineOntology.js +6 -0
- package/build/esm/api/defineOntology.js.map +1 -1
- package/build/esm/api/defineValueType.js +25 -7
- package/build/esm/api/defineValueType.js.map +1 -1
- package/build/esm/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js +5 -0
- package/build/esm/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.js.map +1 -1
- package/build/esm/api/links/LinkType.js.map +1 -1
- package/build/esm/api/object/ObjectTypeStatus.js.map +1 -1
- package/build/esm/api/test/actions.test.js +8 -5
- package/build/esm/api/test/actions.test.js.map +1 -1
- package/build/esm/api/test/interfaces.test.js +12 -0
- package/build/esm/api/test/interfaces.test.js.map +1 -1
- package/build/esm/api/test/misc.test.js +4 -2
- package/build/esm/api/test/misc.test.js.map +1 -1
- package/build/esm/api/test/objects.test.js +3 -2
- package/build/esm/api/test/objects.test.js.map +1 -1
- package/build/esm/api/test/valueTypes.test.js +151 -0
- package/build/esm/api/test/valueTypes.test.js.map +1 -1
- package/build/esm/cli/main.js +1 -1
- package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js +15 -7
- package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -1
- package/build/esm/conversion/toMarketplace/convertLink.js +30 -4
- package/build/esm/conversion/toMarketplace/convertLink.js.map +1 -1
- package/build/esm/conversion/toMarketplace/convertObject.js +6 -5
- package/build/esm/conversion/toMarketplace/convertObject.js.map +1 -1
- package/build/types/api/action/ActionParameterConditionalOverride.d.ts +2 -0
- package/build/types/api/action/ActionParameterConditionalOverride.d.ts.map +1 -1
- package/build/types/api/defineInterface.d.ts +2 -0
- package/build/types/api/defineInterface.d.ts.map +1 -1
- package/build/types/api/defineOntology.d.ts.map +1 -1
- package/build/types/api/defineValueType.d.ts +10 -0
- package/build/types/api/defineValueType.d.ts.map +1 -1
- package/build/types/api/links/LinkType.d.ts +16 -4
- package/build/types/api/links/LinkType.d.ts.map +1 -1
- package/build/types/api/object/ObjectTypeStatus.d.ts +1 -1
- package/build/types/api/object/ObjectTypeStatus.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertLink.d.ts +3 -2
- package/build/types/conversion/toMarketplace/convertLink.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertObject.d.ts.map +1 -1
- package/package.json +4 -4
package/build/cjs/index.cjs
CHANGED
|
@@ -198,10 +198,7 @@ function convertLink(linkType) {
|
|
|
198
198
|
linkType: {
|
|
199
199
|
definition,
|
|
200
200
|
id: cleanAndValidateLinkTypeId(linkType.apiName),
|
|
201
|
-
status: linkType.status
|
|
202
|
-
type: "active",
|
|
203
|
-
active: {}
|
|
204
|
-
},
|
|
201
|
+
status: convertLinkStatus(linkType.status),
|
|
205
202
|
redacted: linkType.redacted ?? false
|
|
206
203
|
},
|
|
207
204
|
datasources: datasource !== void 0 ? [datasource] : [],
|
|
@@ -255,6 +252,35 @@ function getObject(object) {
|
|
|
255
252
|
object: fullObject
|
|
256
253
|
};
|
|
257
254
|
}
|
|
255
|
+
function convertLinkStatus(status) {
|
|
256
|
+
if (typeof status === "object" && "type" in status && status.type === "deprecated") {
|
|
257
|
+
return {
|
|
258
|
+
type: "deprecated",
|
|
259
|
+
deprecated: {
|
|
260
|
+
message: status.message,
|
|
261
|
+
deadline: status.deadline
|
|
262
|
+
}
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
switch (status) {
|
|
266
|
+
case "experimental":
|
|
267
|
+
return {
|
|
268
|
+
type: "experimental",
|
|
269
|
+
experimental: {}
|
|
270
|
+
};
|
|
271
|
+
case "example":
|
|
272
|
+
return {
|
|
273
|
+
type: "example",
|
|
274
|
+
example: {}
|
|
275
|
+
};
|
|
276
|
+
case "active":
|
|
277
|
+
default:
|
|
278
|
+
return {
|
|
279
|
+
type: "active",
|
|
280
|
+
active: {}
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
}
|
|
258
284
|
|
|
259
285
|
// src/api/interface/InterfacePropertyType.ts
|
|
260
286
|
function isInterfaceSharedPropertyType(interfacePropertyType) {
|
|
@@ -618,29 +644,37 @@ function convertActionParameterConditionalOverride(override, validation, actionP
|
|
|
618
644
|
};
|
|
619
645
|
break;
|
|
620
646
|
case "visibility":
|
|
647
|
+
let overrideType = override.then ?? (validation.defaultVisibility === "editable" ? "hidden" : "editable");
|
|
621
648
|
parameterBlockOverride = {
|
|
622
649
|
type: "visibility",
|
|
623
650
|
visibility: {
|
|
624
|
-
visibility:
|
|
651
|
+
visibility: overrideType === "editable" ? {
|
|
652
|
+
type: "editable",
|
|
653
|
+
editable: {}
|
|
654
|
+
} : overrideType === "hidden" ? {
|
|
625
655
|
type: "hidden",
|
|
626
656
|
hidden: {}
|
|
627
657
|
} : {
|
|
628
|
-
type: "
|
|
629
|
-
|
|
658
|
+
type: "disabled",
|
|
659
|
+
disabled: {}
|
|
630
660
|
}
|
|
631
661
|
}
|
|
632
662
|
};
|
|
633
663
|
break;
|
|
634
664
|
case "disabled":
|
|
665
|
+
overrideType = override.then ?? (validation.defaultVisibility === "editable" ? "disabled" : "editable");
|
|
635
666
|
parameterBlockOverride = {
|
|
636
667
|
type: "visibility",
|
|
637
668
|
visibility: {
|
|
638
|
-
visibility:
|
|
639
|
-
type: "disabled",
|
|
640
|
-
disabled: {}
|
|
641
|
-
} : {
|
|
669
|
+
visibility: overrideType === "editable" ? {
|
|
642
670
|
type: "editable",
|
|
643
671
|
editable: {}
|
|
672
|
+
} : overrideType === "hidden" ? {
|
|
673
|
+
type: "hidden",
|
|
674
|
+
hidden: {}
|
|
675
|
+
} : {
|
|
676
|
+
type: "disabled",
|
|
677
|
+
disabled: {}
|
|
644
678
|
}
|
|
645
679
|
}
|
|
646
680
|
};
|
|
@@ -1455,10 +1489,11 @@ function convertObject(objectType) {
|
|
|
1455
1489
|
implementsInterfaces2: implementations.map((impl) => ({
|
|
1456
1490
|
interfaceTypeApiName: impl.implements.apiName,
|
|
1457
1491
|
linksV2: {},
|
|
1458
|
-
propertiesV2: {
|
|
1459
|
-
|
|
1460
|
-
propertyTypeRid:
|
|
1461
|
-
}]))
|
|
1492
|
+
propertiesV2: Object.fromEntries(impl.propertyMapping.map((mappings) => [mappings.interfaceProperty, {
|
|
1493
|
+
type: "propertyTypeRid",
|
|
1494
|
+
propertyTypeRid: mappings.mapsTo
|
|
1495
|
+
}])),
|
|
1496
|
+
properties: {}
|
|
1462
1497
|
})),
|
|
1463
1498
|
allImplementsInterfaces: {}
|
|
1464
1499
|
},
|
|
@@ -1947,6 +1982,12 @@ function convertObjectStatus(status) {
|
|
|
1947
1982
|
experimental: {}
|
|
1948
1983
|
};
|
|
1949
1984
|
}
|
|
1985
|
+
if (status === "example") {
|
|
1986
|
+
return {
|
|
1987
|
+
type: "example",
|
|
1988
|
+
example: {}
|
|
1989
|
+
};
|
|
1990
|
+
}
|
|
1950
1991
|
if (typeof status === "object" && status.type === "deprecated") {
|
|
1951
1992
|
return {
|
|
1952
1993
|
type: "deprecated",
|
|
@@ -2302,7 +2343,7 @@ function addNamespaceIfNone(apiName) {
|
|
|
2302
2343
|
var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
|
|
2303
2344
|
var uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
2304
2345
|
async function main(args = process.argv) {
|
|
2305
|
-
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.15.0-beta.
|
|
2346
|
+
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.15.0-beta.9").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
|
|
2306
2347
|
input: {
|
|
2307
2348
|
alias: "i",
|
|
2308
2349
|
describe: "Input file",
|
|
@@ -3474,6 +3515,11 @@ function mapSimplifiedStatusToInterfaceTypeStatus(status) {
|
|
|
3474
3515
|
type: "experimental",
|
|
3475
3516
|
experimental: {}
|
|
3476
3517
|
};
|
|
3518
|
+
case "example":
|
|
3519
|
+
return {
|
|
3520
|
+
type: "example",
|
|
3521
|
+
example: {}
|
|
3522
|
+
};
|
|
3477
3523
|
default:
|
|
3478
3524
|
throw new Error(`Invalid status type: ${status.type}`);
|
|
3479
3525
|
}
|
|
@@ -3878,14 +3924,19 @@ function convertValueTypeTypeToBaseType(valueType) {
|
|
|
3878
3924
|
}
|
|
3879
3925
|
function defineValueType(valueTypeDef) {
|
|
3880
3926
|
const {
|
|
3881
|
-
apiName,
|
|
3927
|
+
apiName: inputApiName,
|
|
3882
3928
|
displayName,
|
|
3883
3929
|
description,
|
|
3884
3930
|
type,
|
|
3885
|
-
version
|
|
3931
|
+
version,
|
|
3932
|
+
namespacePrefix
|
|
3886
3933
|
} = valueTypeDef;
|
|
3934
|
+
const apiName = namespacePrefix ? namespace + inputApiName : inputApiName;
|
|
3887
3935
|
const semverValidation = /^((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)$/;
|
|
3888
3936
|
!semverValidation.test(version) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, "Version is not a valid semver") : invariant7__default.default(false) : void 0;
|
|
3937
|
+
const existingVersions = ontologyDefinition[OntologyEntityTypeEnum.VALUE_TYPE][apiName] ?? [];
|
|
3938
|
+
const duplicateVersion = existingVersions.find((vt2) => vt2.version === version);
|
|
3939
|
+
!(duplicateVersion === void 0) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Value type with apiName ${apiName} and version ${version} is already defined`) : invariant7__default.default(false) : void 0;
|
|
3889
3940
|
const typeName = typeof type.type === "string" ? type.type : type.type.type === "struct" ? "structV2" : type.type.type;
|
|
3890
3941
|
const constraints = type.constraints ? type.constraints.map((constraint) => {
|
|
3891
3942
|
const output = {
|
|
@@ -3907,10 +3958,7 @@ function defineValueType(valueTypeDef) {
|
|
|
3907
3958
|
displayName,
|
|
3908
3959
|
description: description ?? ""
|
|
3909
3960
|
},
|
|
3910
|
-
status:
|
|
3911
|
-
type: "active",
|
|
3912
|
-
active: {}
|
|
3913
|
-
},
|
|
3961
|
+
status: convertUserValueTypeStatusToValueTypeStatus(valueTypeDef.status),
|
|
3914
3962
|
version,
|
|
3915
3963
|
baseType,
|
|
3916
3964
|
constraints,
|
|
@@ -3920,6 +3968,22 @@ function defineValueType(valueTypeDef) {
|
|
|
3920
3968
|
updateOntology(vt);
|
|
3921
3969
|
return vt;
|
|
3922
3970
|
}
|
|
3971
|
+
function convertUserValueTypeStatusToValueTypeStatus(status) {
|
|
3972
|
+
if (typeof status === "object" && status.type === "deprecated") {
|
|
3973
|
+
return {
|
|
3974
|
+
type: "deprecated",
|
|
3975
|
+
deprecated: {
|
|
3976
|
+
message: status.message,
|
|
3977
|
+
deadline: status.deadline,
|
|
3978
|
+
replacedBy: status.replacedBy
|
|
3979
|
+
}
|
|
3980
|
+
};
|
|
3981
|
+
}
|
|
3982
|
+
return {
|
|
3983
|
+
type: "active",
|
|
3984
|
+
active: {}
|
|
3985
|
+
};
|
|
3986
|
+
}
|
|
3923
3987
|
|
|
3924
3988
|
// src/api/importOntologyEntity.ts
|
|
3925
3989
|
function importOntologyEntity(e) {
|