@osdk/maker 0.13.0-beta.16 → 0.13.0-beta.17
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 +6 -0
- package/build/browser/api/defineAction.js +6 -6
- package/build/browser/api/defineAction.js.map +1 -1
- package/build/browser/api/overall.test.js +1 -1
- package/build/browser/api/overall.test.js.map +1 -1
- package/build/browser/cli/main.js +1 -1
- package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js +2 -2
- package/build/browser/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -1
- package/build/browser/conversion/toMarketplace/convertActionValidation.js +16 -2
- package/build/browser/conversion/toMarketplace/convertActionValidation.js.map +1 -1
- package/build/browser/conversion/toMarketplace/convertConditionDefinition.js +5 -3
- package/build/browser/conversion/toMarketplace/convertConditionDefinition.js.map +1 -1
- package/build/browser/conversion/toMarketplace/convertSectionConditionalOverride.js +2 -2
- package/build/browser/conversion/toMarketplace/convertSectionConditionalOverride.js.map +1 -1
- package/build/cjs/index.cjs +85 -72
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/api/defineAction.js +6 -6
- package/build/esm/api/defineAction.js.map +1 -1
- package/build/esm/api/overall.test.js +1 -1
- package/build/esm/api/overall.test.js.map +1 -1
- package/build/esm/cli/main.js +1 -1
- package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js +2 -2
- package/build/esm/conversion/toMarketplace/convertActionParameterConditionalOverride.js.map +1 -1
- package/build/esm/conversion/toMarketplace/convertActionValidation.js +16 -2
- package/build/esm/conversion/toMarketplace/convertActionValidation.js.map +1 -1
- package/build/esm/conversion/toMarketplace/convertConditionDefinition.js +5 -3
- package/build/esm/conversion/toMarketplace/convertConditionDefinition.js.map +1 -1
- package/build/esm/conversion/toMarketplace/convertSectionConditionalOverride.js +2 -2
- package/build/esm/conversion/toMarketplace/convertSectionConditionalOverride.js.map +1 -1
- package/build/types/api/defineAction.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertActionParameterConditionalOverride.d.ts +1 -1
- package/build/types/conversion/toMarketplace/convertActionParameterConditionalOverride.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertActionValidation.d.ts +1 -0
- package/build/types/conversion/toMarketplace/convertActionValidation.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertConditionDefinition.d.ts +1 -1
- package/build/types/conversion/toMarketplace/convertConditionDefinition.d.ts.map +1 -1
- package/build/types/conversion/toMarketplace/convertSectionConditionalOverride.d.ts +1 -1
- package/build/types/conversion/toMarketplace/convertSectionConditionalOverride.d.ts.map +1 -1
- package/package.json +2 -2
package/build/cjs/index.cjs
CHANGED
|
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var consola = require('consola');
|
|
6
6
|
var fs2 = require('fs/promises');
|
|
7
7
|
var path2 = require('path');
|
|
8
|
-
var
|
|
8
|
+
var invariant6 = require('tiny-invariant');
|
|
9
9
|
var uuid = require('uuid');
|
|
10
10
|
var yargs = require('yargs');
|
|
11
11
|
var helpers = require('yargs/helpers');
|
|
@@ -34,7 +34,7 @@ function _interopNamespace(e) {
|
|
|
34
34
|
|
|
35
35
|
var fs2__namespace = /*#__PURE__*/_interopNamespace(fs2);
|
|
36
36
|
var path2__namespace = /*#__PURE__*/_interopNamespace(path2);
|
|
37
|
-
var
|
|
37
|
+
var invariant6__default = /*#__PURE__*/_interopDefault(invariant6);
|
|
38
38
|
var yargs__default = /*#__PURE__*/_interopDefault(yargs);
|
|
39
39
|
var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
|
|
40
40
|
|
|
@@ -108,12 +108,12 @@ function defineObject(objectDef) {
|
|
|
108
108
|
if (ontologyDefinition[OntologyEntityTypeEnum.OBJECT_TYPE][apiName] !== void 0) {
|
|
109
109
|
throw new Error(`Object type with apiName ${objectDef.apiName} is already defined`);
|
|
110
110
|
}
|
|
111
|
-
!API_NAME_PATTERN.test(objectDef.apiName) ? process.env.NODE_ENV !== "production" ?
|
|
112
|
-
!propertyApiNames.includes(objectDef.titlePropertyApiName) ? process.env.NODE_ENV !== "production" ?
|
|
113
|
-
!propertyApiNames.includes(objectDef.primaryKeyPropertyApiName) ? process.env.NODE_ENV !== "production" ?
|
|
114
|
-
!!objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.editOnly ? process.env.NODE_ENV !== "production" ?
|
|
111
|
+
!API_NAME_PATTERN.test(objectDef.apiName) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Invalid API name ${objectDef.apiName}. API names must match the regex ${API_NAME_PATTERN}.`) : invariant6__default.default(false) : void 0;
|
|
112
|
+
!propertyApiNames.includes(objectDef.titlePropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`) : invariant6__default.default(false) : void 0;
|
|
113
|
+
!propertyApiNames.includes(objectDef.primaryKeyPropertyApiName) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} does not exist on object ${objectDef.apiName}`) : invariant6__default.default(false) : void 0;
|
|
114
|
+
!!objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.editOnly ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} on object ${objectDef.apiName} cannot be edit-only`) : invariant6__default.default(false) : void 0;
|
|
115
115
|
const retentionPeriod = objectDef.datasource?.retentionPeriod;
|
|
116
|
-
!(retentionPeriod === void 0 || ISO_8601_DURATION.test(retentionPeriod)) ? process.env.NODE_ENV !== "production" ?
|
|
116
|
+
!(retentionPeriod === void 0 || ISO_8601_DURATION.test(retentionPeriod)) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Retention period "${retentionPeriod}" on object "${objectDef.apiName}" is not a valid ISO 8601 duration string`) : invariant6__default.default(false) : void 0;
|
|
117
117
|
if (objectDef.status === "experimental") {
|
|
118
118
|
const activeProperties = [];
|
|
119
119
|
Object.entries(objectDef.properties ?? {}).forEach(([apiName2, property]) => {
|
|
@@ -121,14 +121,14 @@ function defineObject(objectDef) {
|
|
|
121
121
|
activeProperties.push(apiName2);
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
-
!(activeProperties.length === 0) ? process.env.NODE_ENV !== "production" ?
|
|
124
|
+
!(activeProperties.length === 0) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `When object "${objectDef.apiName}" has experimental status, no properties can have "active" status, but found active properties: ${activeProperties.join(", ")}`) : invariant6__default.default(false) : void 0;
|
|
125
125
|
}
|
|
126
126
|
if (objectDef.status && typeof objectDef.status === "object" && objectDef.status.type === "deprecated") {
|
|
127
127
|
const deadline = objectDef.status.deadline;
|
|
128
|
-
!(deadline !== void 0 && ISO_8601_DATETIME.test(deadline)) ? process.env.NODE_ENV !== "production" ?
|
|
128
|
+
!(deadline !== void 0 && ISO_8601_DATETIME.test(deadline)) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Deprecated status deadline "${deadline}" on object "${objectDef.apiName}" is not a valid ISO 8601 datetime string`) : invariant6__default.default(false) : void 0;
|
|
129
129
|
}
|
|
130
|
-
!!isExotic(objectDef.properties?.[objectDef.titlePropertyApiName]?.type) ? process.env.NODE_ENV !== "production" ?
|
|
131
|
-
!!isExotic(objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.type) ? process.env.NODE_ENV !== "production" ?
|
|
130
|
+
!!isExotic(objectDef.properties?.[objectDef.titlePropertyApiName]?.type) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Title property ${objectDef.titlePropertyApiName} must be a primitive type`) : invariant6__default.default(false) : void 0;
|
|
131
|
+
!!isExotic(objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.type) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} can only be primitive types`) : invariant6__default.default(false) : void 0;
|
|
132
132
|
objectDef.implementsInterfaces?.forEach((interfaceImpl) => {
|
|
133
133
|
const allInterfaceProperties = getFlattenedInterfaceProperties(interfaceImpl.implements);
|
|
134
134
|
const nonExistentInterfaceProperties = interfaceImpl.propertyMapping.map((val) => val.interfaceProperty).filter((interfaceProperty) => allInterfaceProperties[addNamespaceIfNone(interfaceProperty)] === void 0).map((interfaceProp) => ({
|
|
@@ -147,7 +147,7 @@ function defineObject(objectDef) {
|
|
|
147
147
|
};
|
|
148
148
|
const validations = Object.entries(getFlattenedInterfaceProperties(interfaceImpl.implements)).map(validateProperty);
|
|
149
149
|
const allFailedValidations = validations.concat(nonExistentInterfaceProperties).filter((val) => val.type === "invalid");
|
|
150
|
-
!(allFailedValidations.length === 0) ? process.env.NODE_ENV !== "production" ?
|
|
150
|
+
!(allFailedValidations.length === 0) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, "\n" + allFailedValidations.map(formatValidationErrors).join("\n")) : invariant6__default.default(false) : void 0;
|
|
151
151
|
});
|
|
152
152
|
const flattenedProperties = Object.entries(objectDef.properties ?? {}).map(([apiName2, property]) => convertUserObjectPropertyType(property.apiName ?? apiName2, property));
|
|
153
153
|
const finalObject = {
|
|
@@ -225,16 +225,14 @@ function convertActionSections(action) {
|
|
|
225
225
|
}
|
|
226
226
|
}]));
|
|
227
227
|
}
|
|
228
|
-
|
|
229
|
-
// src/conversion/toMarketplace/convertConditionDefinition.ts
|
|
230
|
-
function convertConditionDefinition(condition) {
|
|
228
|
+
function convertConditionDefinition(condition, objectProperties) {
|
|
231
229
|
switch (condition.type) {
|
|
232
230
|
case "and":
|
|
233
231
|
if ("conditions" in condition) {
|
|
234
232
|
return {
|
|
235
233
|
type: "and",
|
|
236
234
|
and: {
|
|
237
|
-
conditions: condition.conditions.map((c) => convertConditionDefinition(c))
|
|
235
|
+
conditions: condition.conditions.map((c) => convertConditionDefinition(c, objectProperties))
|
|
238
236
|
}
|
|
239
237
|
};
|
|
240
238
|
} else {
|
|
@@ -245,7 +243,7 @@ function convertConditionDefinition(condition) {
|
|
|
245
243
|
return {
|
|
246
244
|
type: "or",
|
|
247
245
|
or: {
|
|
248
|
-
conditions: condition.conditions.map((c) => convertConditionDefinition(c))
|
|
246
|
+
conditions: condition.conditions.map((c) => convertConditionDefinition(c, objectProperties))
|
|
249
247
|
}
|
|
250
248
|
};
|
|
251
249
|
} else {
|
|
@@ -281,6 +279,7 @@ function convertConditionDefinition(condition) {
|
|
|
281
279
|
}
|
|
282
280
|
};
|
|
283
281
|
case "parameter":
|
|
282
|
+
!objectProperties?.includes(condition.parameterId) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Action parameter condition references unknown parameter ${condition.parameterId}`) : invariant6__default.default(false) : void 0;
|
|
284
283
|
return {
|
|
285
284
|
type: "comparison",
|
|
286
285
|
comparison: {
|
|
@@ -298,7 +297,7 @@ function convertConditionDefinition(condition) {
|
|
|
298
297
|
}
|
|
299
298
|
|
|
300
299
|
// src/conversion/toMarketplace/convertActionParameterConditionalOverride.ts
|
|
301
|
-
function convertActionParameterConditionalOverride(override, validation) {
|
|
300
|
+
function convertActionParameterConditionalOverride(override, validation, objectProperties) {
|
|
302
301
|
let parameterBlockOverride;
|
|
303
302
|
switch (override.type) {
|
|
304
303
|
case "required":
|
|
@@ -363,7 +362,7 @@ function convertActionParameterConditionalOverride(override, validation) {
|
|
|
363
362
|
throw new Error(`Unknown parameter override type`);
|
|
364
363
|
}
|
|
365
364
|
return {
|
|
366
|
-
condition: convertConditionDefinition(override.condition),
|
|
365
|
+
condition: convertConditionDefinition(override.condition, objectProperties),
|
|
367
366
|
parameterBlockOverrides: [parameterBlockOverride]
|
|
368
367
|
};
|
|
369
368
|
}
|
|
@@ -395,9 +394,9 @@ function convertActionVisibility(visibility) {
|
|
|
395
394
|
}
|
|
396
395
|
|
|
397
396
|
// src/conversion/toMarketplace/convertSectionConditionalOverride.ts
|
|
398
|
-
function convertSectionConditionalOverride(override, defaultVisibility) {
|
|
397
|
+
function convertSectionConditionalOverride(override, defaultVisibility, objectProperties) {
|
|
399
398
|
return {
|
|
400
|
-
condition: convertConditionDefinition(override.condition),
|
|
399
|
+
condition: convertConditionDefinition(override.condition, objectProperties),
|
|
401
400
|
sectionBlockOverrides: [{
|
|
402
401
|
type: "visibility",
|
|
403
402
|
visibility: {
|
|
@@ -443,7 +442,7 @@ function convertActionValidation(action) {
|
|
|
443
442
|
required: convertParameterRequirementConstraint(p.validation.required)
|
|
444
443
|
}
|
|
445
444
|
},
|
|
446
|
-
conditionalOverrides: p.validation.conditionalOverrides?.map((override) => convertActionParameterConditionalOverride(override, p.validation)) ?? []
|
|
445
|
+
conditionalOverrides: p.validation.conditionalOverrides?.map((override) => convertActionParameterConditionalOverride(override, p.validation, getActionTypeObjectParameters(action))) ?? []
|
|
447
446
|
}];
|
|
448
447
|
})),
|
|
449
448
|
sectionValidations: {
|
|
@@ -459,7 +458,7 @@ function convertActionValidation(action) {
|
|
|
459
458
|
visible: {}
|
|
460
459
|
}
|
|
461
460
|
},
|
|
462
|
-
conditionalOverrides: section.conditionalOverrides?.map((override) => convertSectionConditionalOverride(override, section.defaultVisibility ?? "visible")) ?? []
|
|
461
|
+
conditionalOverrides: section.conditionalOverrides?.map((override) => convertSectionConditionalOverride(override, section.defaultVisibility ?? "visible", getActionTypeObjectParameters(action))) ?? []
|
|
463
462
|
}]))
|
|
464
463
|
}
|
|
465
464
|
};
|
|
@@ -486,6 +485,20 @@ function convertParameterRequirementConstraint(required) {
|
|
|
486
485
|
}
|
|
487
486
|
};
|
|
488
487
|
}
|
|
488
|
+
function getActionTypeObjectParameters(actionType) {
|
|
489
|
+
switch (actionType.rules[0].type) {
|
|
490
|
+
case "addObjectRule":
|
|
491
|
+
return Object.keys(actionType.rules[0].addObjectRule.propertyValues);
|
|
492
|
+
case "modifyObjectRule":
|
|
493
|
+
return Object.keys(actionType.rules[0].modifyObjectRule.propertyValues);
|
|
494
|
+
case "addOrModifyObjectRuleV2":
|
|
495
|
+
return Object.keys(actionType.rules[0].addOrModifyObjectRuleV2.propertyValues);
|
|
496
|
+
case "deleteObjectRule":
|
|
497
|
+
return [];
|
|
498
|
+
default:
|
|
499
|
+
return void 0;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
489
502
|
function convertNullabilityToDataConstraint(prop) {
|
|
490
503
|
if (typeof prop.type === "object" && prop.type.type === "marking") {
|
|
491
504
|
if (prop.nullability === void 0) {
|
|
@@ -498,7 +511,7 @@ function convertNullabilityToDataConstraint(prop) {
|
|
|
498
511
|
}
|
|
499
512
|
};
|
|
500
513
|
}
|
|
501
|
-
!prop.nullability?.noNulls ? process.env.NODE_ENV !== "production" ?
|
|
514
|
+
!prop.nullability?.noNulls ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, "Marking property type has noNulls set to false, marking properties must not be nullable") : invariant6__default.default(false) : void 0;
|
|
502
515
|
return {
|
|
503
516
|
propertyTypeConstraints: [],
|
|
504
517
|
nullability: void 0,
|
|
@@ -1018,7 +1031,7 @@ function convertValueTypeDataConstraints(dataConstraints) {
|
|
|
1018
1031
|
// src/conversion/toMarketplace/convertObjectPropertyType.ts
|
|
1019
1032
|
function convertObjectPropertyType(property) {
|
|
1020
1033
|
const apiName = namespace + property.apiName;
|
|
1021
|
-
!(!shouldNotHaveRenderHints(property.type) || !hasRenderHints(property.typeClasses)) ? process.env.NODE_ENV !== "production" ?
|
|
1034
|
+
!(!shouldNotHaveRenderHints(property.type) || !hasRenderHints(property.typeClasses)) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Property type ${apiName} of type '${getPropertyTypeName(property.type)}' should not have render hints`) : invariant6__default.default(false) : void 0;
|
|
1022
1035
|
const output = {
|
|
1023
1036
|
apiName: property.apiName,
|
|
1024
1037
|
sharedPropertyTypeApiName: property.sharedPropertyType?.apiName,
|
|
@@ -1705,7 +1718,7 @@ function addNamespaceIfNone(apiName) {
|
|
|
1705
1718
|
// src/cli/main.ts
|
|
1706
1719
|
var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
|
|
1707
1720
|
async function main(args = process.argv) {
|
|
1708
|
-
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.
|
|
1721
|
+
const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.13.0-beta.17").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
|
|
1709
1722
|
input: {
|
|
1710
1723
|
alias: "i",
|
|
1711
1724
|
describe: "Input file",
|
|
@@ -1758,12 +1771,12 @@ async function main(args = process.argv) {
|
|
|
1758
1771
|
let apiNamespace = "";
|
|
1759
1772
|
if (commandLineOpts.apiNamespace.length !== 0) {
|
|
1760
1773
|
apiNamespace = commandLineOpts.apiNamespace.slice(-1) !== "." ? commandLineOpts.apiNamespace + "." : commandLineOpts.apiNamespace;
|
|
1761
|
-
!(apiNamespace.length < 1024) ? process.env.NODE_ENV !== "production" ?
|
|
1762
|
-
!apiNamespaceRegex.test(apiNamespace) ? process.env.NODE_ENV !== "production" ?
|
|
1774
|
+
!(apiNamespace.length < 1024) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, "API namespace is too long.") : invariant6__default.default(false) : void 0;
|
|
1775
|
+
!apiNamespaceRegex.test(apiNamespace) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, "API namespace is invalid! It is expected to conform to ^[a-z0-9-]+(.[a-z0-9-]+)*.$") : invariant6__default.default(false) : void 0;
|
|
1763
1776
|
}
|
|
1764
1777
|
consola.consola.info(`Loading ontology from ${commandLineOpts.input}`);
|
|
1765
1778
|
if (commandLineOpts.randomnessKey !== void 0) {
|
|
1766
|
-
!uuid.validate(commandLineOpts.randomnessKey) ? process.env.NODE_ENV !== "production" ?
|
|
1779
|
+
!uuid.validate(commandLineOpts.randomnessKey) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, "Supplied randomness key is not a uuid and shouldn't be used as a uniqueness guarantee") : invariant6__default.default(false) : void 0;
|
|
1767
1780
|
}
|
|
1768
1781
|
const ontologyIr = await loadOntology(commandLineOpts.input, apiNamespace, commandLineOpts.outputDir, commandLineOpts.dependencies, commandLineOpts.randomnessKey);
|
|
1769
1782
|
consola.consola.info(`Saving ontology to ${commandLineOpts.output}`);
|
|
@@ -1936,7 +1949,7 @@ function defineCreateObjectAction(def) {
|
|
|
1936
1949
|
}],
|
|
1937
1950
|
parameterOrdering: def.parameterOrdering ?? createDefaultParameterOrdering(def, parameters),
|
|
1938
1951
|
...def.actionLevelValidation ? {
|
|
1939
|
-
validation: convertValidationRule(def.actionLevelValidation)
|
|
1952
|
+
validation: convertValidationRule(def.actionLevelValidation, Object.keys(def.objectType.properties ?? {}))
|
|
1940
1953
|
} : {},
|
|
1941
1954
|
...def.defaultFormat && {
|
|
1942
1955
|
defaultFormat: def.defaultFormat
|
|
@@ -2076,7 +2089,7 @@ function defineModifyObjectAction(def) {
|
|
|
2076
2089
|
},
|
|
2077
2090
|
parameterOrdering: def.parameterOrdering ?? createDefaultParameterOrdering(def, parameters, MODIFY_OBJECT_PARAMETER),
|
|
2078
2091
|
...def.actionLevelValidation ? {
|
|
2079
|
-
validation: convertValidationRule(def.actionLevelValidation)
|
|
2092
|
+
validation: convertValidationRule(def.actionLevelValidation, Object.keys(def.objectType.properties ?? {}))
|
|
2080
2093
|
} : {},
|
|
2081
2094
|
...def.defaultFormat && {
|
|
2082
2095
|
defaultFormat: def.defaultFormat
|
|
@@ -2129,7 +2142,7 @@ function defineDeleteObjectAction(def) {
|
|
|
2129
2142
|
typeGroups: []
|
|
2130
2143
|
},
|
|
2131
2144
|
...def.actionLevelValidation ? {
|
|
2132
|
-
validation: convertValidationRule(def.actionLevelValidation)
|
|
2145
|
+
validation: convertValidationRule(def.actionLevelValidation, Object.keys(def.objectType.properties ?? {}))
|
|
2133
2146
|
} : {}
|
|
2134
2147
|
});
|
|
2135
2148
|
}
|
|
@@ -2186,7 +2199,7 @@ function defineCreateOrModifyObjectAction(def) {
|
|
|
2186
2199
|
},
|
|
2187
2200
|
parameterOrdering: def.parameterOrdering ?? createDefaultParameterOrdering(def, parameters, CREATE_OR_MODIFY_OBJECT_PARAMETER),
|
|
2188
2201
|
...def.actionLevelValidation ? {
|
|
2189
|
-
validation: convertValidationRule(def.actionLevelValidation)
|
|
2202
|
+
validation: convertValidationRule(def.actionLevelValidation, Object.keys(def.objectType.properties ?? {}))
|
|
2190
2203
|
} : {},
|
|
2191
2204
|
...def.defaultFormat && {
|
|
2192
2205
|
defaultFormat: def.defaultFormat
|
|
@@ -2211,37 +2224,37 @@ function defineAction(actionDef) {
|
|
|
2211
2224
|
if (ontologyDefinition[OntologyEntityTypeEnum.ACTION_TYPE][apiName] !== void 0) {
|
|
2212
2225
|
throw new Error(`Action type with apiName ${actionDef.apiName} is already defined`);
|
|
2213
2226
|
}
|
|
2214
|
-
!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(actionDef.apiName) ? process.env.NODE_ENV !== "production" ?
|
|
2227
|
+
!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(actionDef.apiName) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Action type apiName "${actionDef.apiName}" must be alphanumeric, lowercase, and kebab-case`) : invariant6__default.default(false) : void 0;
|
|
2215
2228
|
const parameterIdsSet = new Set(parameterIds);
|
|
2216
|
-
!(parameterIdsSet.size === parameterIds.length) ? process.env.NODE_ENV !== "production" ?
|
|
2229
|
+
!(parameterIdsSet.size === parameterIds.length) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Parameter ids must be unique`) : invariant6__default.default(false) : void 0;
|
|
2217
2230
|
const parameterIdsNotFound = Array.from(referencedParameterIds(actionDef)).filter((p) => !parameterIdsSet.has(p));
|
|
2218
|
-
!(parameterIdsNotFound.length === 0) ? process.env.NODE_ENV !== "production" ?
|
|
2231
|
+
!(parameterIdsNotFound.length === 0) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Parameters ${JSON.stringify(parameterIdsNotFound)} were referenced but not defined`) : invariant6__default.default(false) : void 0;
|
|
2219
2232
|
const definedSectionIds = new Set(Object.keys(actionDef.sections ?? []));
|
|
2220
2233
|
const undefinedSectionsInOrdering = (actionDef.formContentOrdering ?? []).flatMap((s) => s.type === "parameterId" ? [] : [s.sectionId]).filter((sId) => !definedSectionIds.has(sId));
|
|
2221
|
-
!(undefinedSectionsInOrdering.length === 0) ? process.env.NODE_ENV !== "production" ?
|
|
2222
|
-
!(actionDef.rules.length > 0) ? process.env.NODE_ENV !== "production" ?
|
|
2234
|
+
!(undefinedSectionsInOrdering.length === 0) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Sections [${undefinedSectionsInOrdering}] were referenced in content ordering but not defined`) : invariant6__default.default(false) : void 0;
|
|
2235
|
+
!(actionDef.rules.length > 0) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Action type ${actionDef.apiName} must have at least one logic rule`) : invariant6__default.default(false) : void 0;
|
|
2223
2236
|
actionDef.rules.forEach((rule) => {
|
|
2224
2237
|
if (rule.type === "modifyObjectRule") {
|
|
2225
|
-
!parameterIds.some((id) => id === rule.modifyObjectRule.objectToModify) ? process.env.NODE_ENV !== "production" ?
|
|
2238
|
+
!parameterIds.some((id) => id === rule.modifyObjectRule.objectToModify) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Object to modify parameter must be defined in parameters`) : invariant6__default.default(false) : void 0;
|
|
2226
2239
|
}
|
|
2227
2240
|
if (rule.type === "deleteObjectRule") {
|
|
2228
|
-
!parameterIds.some((id) => id === rule.deleteObjectRule.objectToDelete) ? process.env.NODE_ENV !== "production" ?
|
|
2241
|
+
!parameterIds.some((id) => id === rule.deleteObjectRule.objectToDelete) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Object to delete parameter must be defined in parameters`) : invariant6__default.default(false) : void 0;
|
|
2229
2242
|
}
|
|
2230
2243
|
if (rule.type === "modifyInterfaceRule") {
|
|
2231
2244
|
const interfaceParam = actionDef.parameters.find((p) => p.id === rule.modifyInterfaceRule.interfaceObjectToModifyParameter);
|
|
2232
|
-
!(interfaceParam !== void 0 && typeof interfaceParam.type === "object" && (interfaceParam.type.type === "interfaceReference" || interfaceParam.type.type === "interfaceReferenceList")) ? process.env.NODE_ENV !== "production" ?
|
|
2245
|
+
!(interfaceParam !== void 0 && typeof interfaceParam.type === "object" && (interfaceParam.type.type === "interfaceReference" || interfaceParam.type.type === "interfaceReferenceList")) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Interface object to modify parameter must be an interface reference`) : invariant6__default.default(false) : void 0;
|
|
2233
2246
|
const interfaceReference = interfaceParam.type.type === "interfaceReference" ? interfaceParam.type.interfaceReference.interfaceTypeRid : interfaceParam.type.interfaceReferenceList.interfaceTypeRid;
|
|
2234
|
-
!(ontologyDefinition.INTERFACE_TYPE[interfaceReference] !== void 0 || importedTypes.INTERFACE_TYPE[interfaceReference] !== void 0) ? process.env.NODE_ENV !== "production" ?
|
|
2247
|
+
!(ontologyDefinition.INTERFACE_TYPE[interfaceReference] !== void 0 || importedTypes.INTERFACE_TYPE[interfaceReference] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Interface type ${interfaceReference} does not exist`) : invariant6__default.default(false) : void 0;
|
|
2235
2248
|
const interfaceType = ontologyDefinition.INTERFACE_TYPE[interfaceReference];
|
|
2236
2249
|
Object.keys(rule.modifyInterfaceRule.sharedPropertyValues).forEach((spt) => {
|
|
2237
|
-
!Object.keys(getFlattenedInterfaceProperties(interfaceType)).includes(spt) ? process.env.NODE_ENV !== "production" ?
|
|
2250
|
+
!Object.keys(getFlattenedInterfaceProperties(interfaceType)).includes(spt) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Shared property type ${spt} does not exist in interface type ${interfaceReference}`) : invariant6__default.default(false) : void 0;
|
|
2238
2251
|
});
|
|
2239
2252
|
}
|
|
2240
2253
|
if (rule.type === "addInterfaceRule") {
|
|
2241
2254
|
const interfaceType = ontologyDefinition.INTERFACE_TYPE[rule.addInterfaceRule.interfaceApiName] ?? importedTypes.INTERFACE_TYPE[rule.addInterfaceRule.interfaceApiName];
|
|
2242
|
-
!(interfaceType !== void 0) ? process.env.NODE_ENV !== "production" ?
|
|
2255
|
+
!(interfaceType !== void 0) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Interface type ${rule.addInterfaceRule.interfaceApiName} does not exist`) : invariant6__default.default(false) : void 0;
|
|
2243
2256
|
Object.keys(rule.addInterfaceRule.sharedPropertyValues).forEach((spt) => {
|
|
2244
|
-
!Object.keys(getFlattenedInterfaceProperties(interfaceType)).includes(spt) ? process.env.NODE_ENV !== "production" ?
|
|
2257
|
+
!Object.keys(getFlattenedInterfaceProperties(interfaceType)).includes(spt) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Shared property type ${spt} does not exist in interface type ${interfaceType.apiName}`) : invariant6__default.default(false) : void 0;
|
|
2245
2258
|
});
|
|
2246
2259
|
}
|
|
2247
2260
|
});
|
|
@@ -2598,10 +2611,10 @@ function kebab(s) {
|
|
|
2598
2611
|
function sanitize(s) {
|
|
2599
2612
|
return s.includes(".") ? s : namespace + s;
|
|
2600
2613
|
}
|
|
2601
|
-
function convertValidationRule(actionValidation) {
|
|
2614
|
+
function convertValidationRule(actionValidation, objectProperties) {
|
|
2602
2615
|
return actionValidation.map((rule) => {
|
|
2603
2616
|
return {
|
|
2604
|
-
condition: convertConditionDefinition(rule.condition),
|
|
2617
|
+
condition: convertConditionDefinition(rule.condition, objectProperties),
|
|
2605
2618
|
displayMetadata: rule.displayMetadata ?? {
|
|
2606
2619
|
failureMessage: "Did not satisfy validation",
|
|
2607
2620
|
typeClasses: []
|
|
@@ -2628,9 +2641,9 @@ function validateParameterCondition(condition, currentParameterId, seenParameter
|
|
|
2628
2641
|
switch (condition.type) {
|
|
2629
2642
|
case "parameter":
|
|
2630
2643
|
const overrideParamId = condition.parameterId;
|
|
2631
|
-
!parameters?.some((p) => p.id === overrideParamId) ? process.env.NODE_ENV !== "production" ?
|
|
2632
|
-
!(overrideParamId !== currentParameterId) ? process.env.NODE_ENV !== "production" ?
|
|
2633
|
-
!seenParameterIds.has(overrideParamId) ? process.env.NODE_ENV !== "production" ?
|
|
2644
|
+
!parameters?.some((p) => p.id === overrideParamId) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Parameter condition on ${currentParameterId} is referencing unknown parameter ${overrideParamId}`) : invariant6__default.default(false) : void 0;
|
|
2645
|
+
!(overrideParamId !== currentParameterId) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Parameter condition on ${currentParameterId} is referencing itself`) : invariant6__default.default(false) : void 0;
|
|
2646
|
+
!seenParameterIds.has(overrideParamId) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Parameter condition on ${currentParameterId} is referencing later parameter ${overrideParamId}`) : invariant6__default.default(false) : void 0;
|
|
2634
2647
|
break;
|
|
2635
2648
|
case "and":
|
|
2636
2649
|
if ("conditions" in condition) {
|
|
@@ -2658,11 +2671,11 @@ function validateParameterPrefill(currentParameterId, seenParameterIds, paramete
|
|
|
2658
2671
|
if (!defaultValue) return;
|
|
2659
2672
|
switch (defaultValue.type) {
|
|
2660
2673
|
case "objectParameterPropertyValue":
|
|
2661
|
-
!parameters?.some((p) => p.id === defaultValue.objectParameterPropertyValue.parameterId) ? process.env.NODE_ENV !== "production" ?
|
|
2662
|
-
!seenParameterIds.has(defaultValue.objectParameterPropertyValue.parameterId) ? process.env.NODE_ENV !== "production" ?
|
|
2674
|
+
!parameters?.some((p) => p.id === defaultValue.objectParameterPropertyValue.parameterId) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Default value for parameter ${currentParameterId} is referencing unknown parameter ${defaultValue.objectParameterPropertyValue.parameterId}`) : invariant6__default.default(false) : void 0;
|
|
2675
|
+
!seenParameterIds.has(defaultValue.objectParameterPropertyValue.parameterId) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Default value for parameter ${currentParameterId} is referencing later parameter ${defaultValue.objectParameterPropertyValue.parameterId}`) : invariant6__default.default(false) : void 0;
|
|
2663
2676
|
break;
|
|
2664
2677
|
case "staticValue":
|
|
2665
|
-
!(defaultValue.staticValue.type === parameters?.find((p) => p.id === currentParameterId)?.type) ? process.env.NODE_ENV !== "production" ?
|
|
2678
|
+
!(defaultValue.staticValue.type === parameters?.find((p) => p.id === currentParameterId)?.type) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Default static value for parameter ${currentParameterId} does not match type`) : invariant6__default.default(false) : void 0;
|
|
2666
2679
|
break;
|
|
2667
2680
|
case "staticObject":
|
|
2668
2681
|
case "interfaceParameterPropertyValue":
|
|
@@ -2677,10 +2690,10 @@ function validateParameterPrefill(currentParameterId, seenParameterIds, paramete
|
|
|
2677
2690
|
}
|
|
2678
2691
|
function validateActionParameters(def) {
|
|
2679
2692
|
[...Object.keys(def.parameterConfiguration ?? {})].forEach((id) => {
|
|
2680
|
-
!(def.objectType.properties?.[id] !== void 0 || def.parameterConfiguration?.[id].customParameterType !== void 0 || id === MODIFY_OBJECT_PARAMETER || id === CREATE_OR_MODIFY_OBJECT_PARAMETER) ? process.env.NODE_ENV !== "production" ?
|
|
2693
|
+
!(def.objectType.properties?.[id] !== void 0 || def.parameterConfiguration?.[id].customParameterType !== void 0 || id === MODIFY_OBJECT_PARAMETER || id === CREATE_OR_MODIFY_OBJECT_PARAMETER) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Parameter ${id} does not exist as a property on ${def.objectType.apiName} and its type is not explicitly defined`) : invariant6__default.default(false) : void 0;
|
|
2681
2694
|
});
|
|
2682
2695
|
[...Object.keys(def.nonParameterMappings ?? {}), ...def.excludedProperties ?? []].forEach((id) => {
|
|
2683
|
-
!(def.objectType.properties?.[id] !== void 0) ? process.env.NODE_ENV !== "production" ?
|
|
2696
|
+
!(def.objectType.properties?.[id] !== void 0) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Property ${id} does not exist as a property on ${def.objectType.apiName}`) : invariant6__default.default(false) : void 0;
|
|
2684
2697
|
});
|
|
2685
2698
|
}
|
|
2686
2699
|
function createDefaultParameterOrdering(def, parameters, priorityId) {
|
|
@@ -2690,12 +2703,12 @@ function validateParameterOrdering(parameterOrdering, parameterSet, actionApiNam
|
|
|
2690
2703
|
const orderingSet = new Set(parameterOrdering);
|
|
2691
2704
|
const missingParameters = [...parameterSet].filter((param) => !orderingSet.has(param));
|
|
2692
2705
|
const extraneousParameters = parameterOrdering.filter((param) => !parameterSet.has(param));
|
|
2693
|
-
!(extraneousParameters.length === 0 && missingParameters.length === 0) ? process.env.NODE_ENV !== "production" ?
|
|
2706
|
+
!(extraneousParameters.length === 0 && missingParameters.length === 0) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Action parameter ordering for ${actionApiName} does not match expected parameters. Extraneous parameters in ordering: {${extraneousParameters}}, Missing parameters in ordering: {${missingParameters}}`) : invariant6__default.default(false) : void 0;
|
|
2694
2707
|
}
|
|
2695
2708
|
function defineSharedPropertyType(sptDef) {
|
|
2696
2709
|
const apiName = namespace + sptDef.apiName;
|
|
2697
|
-
!(ontologyDefinition[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ?
|
|
2698
|
-
!(!shouldNotHaveRenderHints(sptDef.type) || !hasRenderHints(sptDef.typeClasses)) ? process.env.NODE_ENV !== "production" ?
|
|
2710
|
+
!(ontologyDefinition[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Shared property type ${apiName} already exists`) : invariant6__default.default(false) : void 0;
|
|
2711
|
+
!(!shouldNotHaveRenderHints(sptDef.type) || !hasRenderHints(sptDef.typeClasses)) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Shared property type ${apiName} of type '${getPropertyTypeName(sptDef.type)}' should not have render hints`) : invariant6__default.default(false) : void 0;
|
|
2699
2712
|
const fullSpt = {
|
|
2700
2713
|
...sptDef,
|
|
2701
2714
|
apiName,
|
|
@@ -2744,7 +2757,7 @@ function combineApiNamespaceIfMissing(namespace2, apiName) {
|
|
|
2744
2757
|
// src/api/defineInterface.ts
|
|
2745
2758
|
function defineInterface(interfaceDef) {
|
|
2746
2759
|
const apiName = namespace + interfaceDef.apiName;
|
|
2747
|
-
!(ontologyDefinition[OntologyEntityTypeEnum.INTERFACE_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ?
|
|
2760
|
+
!(ontologyDefinition[OntologyEntityTypeEnum.INTERFACE_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Interface ${apiName} already exists`) : invariant6__default.default(false) : void 0;
|
|
2748
2761
|
const properties = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([unNamespacedPropApiName, type]) => {
|
|
2749
2762
|
if (typeof type === "object" && "propertyDefinition" in type) {
|
|
2750
2763
|
const apiName3 = combineApiNamespaceIfMissing(namespace, typeof type.propertyDefinition === "object" && "apiName" in type.propertyDefinition ? type.propertyDefinition.apiName : unNamespacedPropApiName);
|
|
@@ -2763,7 +2776,7 @@ function defineInterface(interfaceDef) {
|
|
|
2763
2776
|
const status = mapSimplifiedStatusToInterfaceTypeStatus(interfaceDef.status ?? {
|
|
2764
2777
|
type: "active"
|
|
2765
2778
|
});
|
|
2766
|
-
!(status.type !== "deprecated" || status.deprecated.message && status.deprecated.deadline) ? process.env.NODE_ENV !== "production" ?
|
|
2779
|
+
!(status.type !== "deprecated" || status.deprecated.message && status.deprecated.deadline) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Deprecated status must include message and deadline properties.`) : invariant6__default.default(false) : void 0;
|
|
2767
2780
|
const fullInterface = {
|
|
2768
2781
|
apiName,
|
|
2769
2782
|
displayMetadata: {
|
|
@@ -2789,7 +2802,7 @@ function defineInterface(interfaceDef) {
|
|
|
2789
2802
|
}
|
|
2790
2803
|
function unifyBasePropertyDefinition(namespace2, apiName, type) {
|
|
2791
2804
|
if (typeof type === "string" || typeof type === "object" && !("apiName" in type)) {
|
|
2792
|
-
!isPropertyTypeType(type) ? process.env.NODE_ENV !== "production" ?
|
|
2805
|
+
!isPropertyTypeType(type) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Invalid data type ${JSON.stringify(type)} for property ${apiName} on InterfaceType ${apiName}`) : invariant6__default.default(false) : void 0;
|
|
2793
2806
|
const spt = defineSharedPropertyType({
|
|
2794
2807
|
apiName,
|
|
2795
2808
|
displayName: apiName,
|
|
@@ -2799,16 +2812,16 @@ function unifyBasePropertyDefinition(namespace2, apiName, type) {
|
|
|
2799
2812
|
return spt;
|
|
2800
2813
|
} else {
|
|
2801
2814
|
const unNamespacedTypeApiName = withoutNamespace(type.apiName);
|
|
2802
|
-
!(namespace2 + apiName === type.apiName || apiName === unNamespacedTypeApiName) ? process.env.NODE_ENV !== "production" ?
|
|
2815
|
+
!(namespace2 + apiName === type.apiName || apiName === unNamespacedTypeApiName) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `property key and it's apiName must be identical. ${JSON.stringify({
|
|
2803
2816
|
key: apiName,
|
|
2804
2817
|
apiName: type.apiName
|
|
2805
|
-
})}`) :
|
|
2818
|
+
})}`) : invariant6__default.default(false) : void 0;
|
|
2806
2819
|
return type;
|
|
2807
2820
|
}
|
|
2808
2821
|
}
|
|
2809
2822
|
function defineInterfaceLinkConstraint(linkDef) {
|
|
2810
2823
|
const fromLinkMeta = getLinkMeta(linkDef);
|
|
2811
|
-
!(linkDef.from.links.find((a) => a.metadata.apiName === fromLinkMeta.apiName) == null) ? process.env.NODE_ENV !== "production" ?
|
|
2824
|
+
!(linkDef.from.links.find((a) => a.metadata.apiName === fromLinkMeta.apiName) == null) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Link with apiName ${fromLinkMeta.apiName} already exists on ${linkDef.apiName}`) : invariant6__default.default(false) : void 0;
|
|
2812
2825
|
linkDef.from.links.push({
|
|
2813
2826
|
cardinality: linkDef.toMany ? "MANY" : "SINGLE",
|
|
2814
2827
|
linkedEntityTypeId: getLinkedType(linkDef.toMany ?? linkDef.toOne),
|
|
@@ -2840,14 +2853,14 @@ var typeIdPattern = /([a-z][a-z0-9\\-]*)/;
|
|
|
2840
2853
|
function defineLink(linkDefinition) {
|
|
2841
2854
|
if ("one" in linkDefinition) {
|
|
2842
2855
|
const foreignKey = linkDefinition.toMany.object.properties?.[linkDefinition.manyForeignKeyProperty];
|
|
2843
|
-
!(foreignKey !== void 0) ? process.env.NODE_ENV !== "production" ?
|
|
2844
|
-
!typeIdPattern.test(linkDefinition.apiName) ? process.env.NODE_ENV !== "production" ?
|
|
2856
|
+
!(foreignKey !== void 0) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Foreign key ${linkDefinition.manyForeignKeyProperty} on link ${linkDefinition.apiName} does not exist on object ${linkDefinition.toMany.object.apiName}}`) : invariant6__default.default(false) : void 0;
|
|
2857
|
+
!typeIdPattern.test(linkDefinition.apiName) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Top level link api names are expected to match the regex pattern ([a-z][a-z0-9\\-]*) ${linkDefinition.apiName} does not match`) : invariant6__default.default(false) : void 0;
|
|
2845
2858
|
const typesMatch = foreignKey.type === linkDefinition.one.object.properties?.[linkDefinition.one.object.primaryKeyPropertyApiName].type;
|
|
2846
|
-
!typesMatch ? process.env.NODE_ENV !== "production" ?
|
|
2859
|
+
!typesMatch ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `Link ${linkDefinition.apiName} has type mismatch between the one side's primary key and the foreign key on the many side`) : invariant6__default.default(false) : void 0;
|
|
2847
2860
|
}
|
|
2848
2861
|
if ("intermediaryObjectType" in linkDefinition) {
|
|
2849
|
-
!("one" in linkDefinition.many.linkToIntermediary && linkDefinition.many.linkToIntermediary.one.object.apiName === linkDefinition.many.object.apiName && linkDefinition.many.linkToIntermediary.toMany.object.apiName === linkDefinition.intermediaryObjectType.apiName) ? process.env.NODE_ENV !== "production" ?
|
|
2850
|
-
!("one" in linkDefinition.toMany.linkToIntermediary && linkDefinition.toMany.linkToIntermediary.one.object.apiName === linkDefinition.toMany.object.apiName && linkDefinition.toMany.linkToIntermediary.toMany.object.apiName === linkDefinition.intermediaryObjectType.apiName) ? process.env.NODE_ENV !== "production" ?
|
|
2862
|
+
!("one" in linkDefinition.many.linkToIntermediary && linkDefinition.many.linkToIntermediary.one.object.apiName === linkDefinition.many.object.apiName && linkDefinition.many.linkToIntermediary.toMany.object.apiName === linkDefinition.intermediaryObjectType.apiName) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `LinkTypeA ${linkDefinition.many.linkToIntermediary.apiName} must be a many to one link from intermediary object ${linkDefinition.intermediaryObjectType.apiName} to objectA ${linkDefinition.many.object.apiName}`) : invariant6__default.default(false) : void 0;
|
|
2863
|
+
!("one" in linkDefinition.toMany.linkToIntermediary && linkDefinition.toMany.linkToIntermediary.one.object.apiName === linkDefinition.toMany.object.apiName && linkDefinition.toMany.linkToIntermediary.toMany.object.apiName === linkDefinition.intermediaryObjectType.apiName) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, `LinkTypeB ${linkDefinition.toMany.linkToIntermediary.apiName} must be a many to one link from intermediary object ${linkDefinition.intermediaryObjectType.apiName} to objectB ${linkDefinition.toMany.object.apiName}`) : invariant6__default.default(false) : void 0;
|
|
2851
2864
|
}
|
|
2852
2865
|
let fullLinkDefinition;
|
|
2853
2866
|
if ("one" in linkDefinition) {
|
|
@@ -2959,7 +2972,7 @@ function defineValueType(valueTypeDef) {
|
|
|
2959
2972
|
version
|
|
2960
2973
|
} = valueTypeDef;
|
|
2961
2974
|
const semverValidation = /^((([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?)$/;
|
|
2962
|
-
!semverValidation.test(version) ? process.env.NODE_ENV !== "production" ?
|
|
2975
|
+
!semverValidation.test(version) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, "Version is not a valid semver") : invariant6__default.default(false) : void 0;
|
|
2963
2976
|
const typeName = typeof type.type === "string" ? type.type : type.type.type === "struct" ? "structV2" : type.type.type;
|
|
2964
2977
|
const constraints = type.constraints ? type.constraints.map((constraint) => {
|
|
2965
2978
|
const output = {
|
|
@@ -3015,8 +3028,8 @@ function importSharedPropertyType(opts) {
|
|
|
3015
3028
|
} = opts;
|
|
3016
3029
|
const fullApiName = packageName === void 0 ? apiName : `${packageName}.${apiName}`;
|
|
3017
3030
|
if (packageName !== void 0) {
|
|
3018
|
-
!!packageName.endsWith(".") ? process.env.NODE_ENV !== "production" ?
|
|
3019
|
-
!(packageName.match("[A-Z]") == null) ? process.env.NODE_ENV !== "production" ?
|
|
3031
|
+
!!packageName.endsWith(".") ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, "Package name format invalid ends with period") : invariant6__default.default(false) : void 0;
|
|
3032
|
+
!(packageName.match("[A-Z]") == null) ? process.env.NODE_ENV !== "production" ? invariant6__default.default(false, "Package name includes upper case characters") : invariant6__default.default(false) : void 0;
|
|
3020
3033
|
}
|
|
3021
3034
|
const spt = {
|
|
3022
3035
|
apiName: fullApiName,
|