@osdk/maker 0.15.0-beta.5 → 0.15.0-beta.7

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.
Files changed (154) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/build/browser/api/action/ActionParameter.js.map +1 -1
  3. package/build/browser/api/action/ActionParameterConfiguration.js.map +1 -1
  4. package/build/browser/api/defineAction.js +65 -22
  5. package/build/browser/api/defineAction.js.map +1 -1
  6. package/build/browser/api/defineCreateInterfaceObjectAction.js +28 -8
  7. package/build/browser/api/defineCreateInterfaceObjectAction.js.map +1 -1
  8. package/build/browser/api/defineInterface.js +40 -34
  9. package/build/browser/api/defineInterface.js.map +1 -1
  10. package/build/browser/api/defineModifyInterfaceObjectAction.js +31 -8
  11. package/build/browser/api/defineModifyInterfaceObjectAction.js.map +1 -1
  12. package/build/browser/api/defineObject.js +53 -14
  13. package/build/browser/api/defineObject.js.map +1 -1
  14. package/build/browser/api/defineSpt.js.map +1 -1
  15. package/build/browser/api/interface/InterfacePropertyType.js +22 -1
  16. package/build/browser/api/interface/InterfacePropertyType.js.map +1 -1
  17. package/build/browser/api/interface/InterfaceType.js.map +1 -1
  18. package/build/browser/api/interface/getFlattenedInterfaceProperties.js +9 -3
  19. package/build/browser/api/interface/getFlattenedInterfaceProperties.js.map +1 -1
  20. package/build/browser/api/object/ObjectType.js.map +1 -1
  21. package/build/browser/api/object/ObjectTypeDefinition.js.map +1 -1
  22. package/build/browser/api/properties/PropertyTypeType.js +1 -1
  23. package/build/browser/api/properties/PropertyTypeType.js.map +1 -1
  24. package/build/browser/api/properties/SharedPropertyType.js.map +1 -1
  25. package/build/browser/api/test/actions.test.js +6105 -5850
  26. package/build/browser/api/test/actions.test.js.map +1 -1
  27. package/build/browser/api/test/interfaces.test.js +723 -470
  28. package/build/browser/api/test/interfaces.test.js.map +1 -1
  29. package/build/browser/api/test/links.test.js +1334 -1325
  30. package/build/browser/api/test/links.test.js.map +1 -1
  31. package/build/browser/api/test/misc.test.js +262 -11
  32. package/build/browser/api/test/misc.test.js.map +1 -1
  33. package/build/browser/api/test/objects.test.js +1872 -1412
  34. package/build/browser/api/test/objects.test.js.map +1 -1
  35. package/build/browser/api/test/spt.test.js +250 -103
  36. package/build/browser/api/test/spt.test.js.map +1 -1
  37. package/build/browser/cli/main.js +1 -1
  38. package/build/browser/conversion/toMarketplace/convertActionValidation.js +1 -1
  39. package/build/browser/conversion/toMarketplace/convertActionValidation.js.map +1 -1
  40. package/build/browser/conversion/toMarketplace/convertInterface.js +2 -2
  41. package/build/browser/conversion/toMarketplace/convertInterface.js.map +1 -1
  42. package/build/browser/conversion/toMarketplace/convertInterfacePropertyType.js +66 -0
  43. package/build/browser/conversion/toMarketplace/convertInterfacePropertyType.js.map +1 -0
  44. package/build/browser/conversion/toMarketplace/convertMappingValue.js +35 -0
  45. package/build/browser/conversion/toMarketplace/convertMappingValue.js.map +1 -1
  46. package/build/browser/conversion/toMarketplace/convertObject.js +4 -2
  47. package/build/browser/conversion/toMarketplace/convertObject.js.map +1 -1
  48. package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js +2 -1
  49. package/build/browser/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -1
  50. package/build/browser/conversion/toMarketplace/convertSpt.js +4 -2
  51. package/build/browser/conversion/toMarketplace/convertSpt.js.map +1 -1
  52. package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrInterfaceType.js +143 -0
  53. package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrInterfaceType.js.map +1 -0
  54. package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +4 -0
  55. package/build/browser/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
  56. package/build/browser/index.js.map +1 -1
  57. package/build/cjs/index.cjs +417 -114
  58. package/build/cjs/index.cjs.map +1 -1
  59. package/build/cjs/index.d.cts +28 -13
  60. package/build/esm/api/action/ActionParameter.js.map +1 -1
  61. package/build/esm/api/action/ActionParameterConfiguration.js.map +1 -1
  62. package/build/esm/api/defineAction.js +65 -22
  63. package/build/esm/api/defineAction.js.map +1 -1
  64. package/build/esm/api/defineCreateInterfaceObjectAction.js +28 -8
  65. package/build/esm/api/defineCreateInterfaceObjectAction.js.map +1 -1
  66. package/build/esm/api/defineInterface.js +40 -34
  67. package/build/esm/api/defineInterface.js.map +1 -1
  68. package/build/esm/api/defineModifyInterfaceObjectAction.js +31 -8
  69. package/build/esm/api/defineModifyInterfaceObjectAction.js.map +1 -1
  70. package/build/esm/api/defineObject.js +53 -14
  71. package/build/esm/api/defineObject.js.map +1 -1
  72. package/build/esm/api/defineSpt.js.map +1 -1
  73. package/build/esm/api/interface/InterfacePropertyType.js +22 -1
  74. package/build/esm/api/interface/InterfacePropertyType.js.map +1 -1
  75. package/build/esm/api/interface/InterfaceType.js.map +1 -1
  76. package/build/esm/api/interface/getFlattenedInterfaceProperties.js +9 -3
  77. package/build/esm/api/interface/getFlattenedInterfaceProperties.js.map +1 -1
  78. package/build/esm/api/object/ObjectType.js.map +1 -1
  79. package/build/esm/api/object/ObjectTypeDefinition.js.map +1 -1
  80. package/build/esm/api/properties/PropertyTypeType.js +1 -1
  81. package/build/esm/api/properties/PropertyTypeType.js.map +1 -1
  82. package/build/esm/api/properties/SharedPropertyType.js.map +1 -1
  83. package/build/esm/api/test/actions.test.js +6105 -5850
  84. package/build/esm/api/test/actions.test.js.map +1 -1
  85. package/build/esm/api/test/interfaces.test.js +723 -470
  86. package/build/esm/api/test/interfaces.test.js.map +1 -1
  87. package/build/esm/api/test/links.test.js +1334 -1325
  88. package/build/esm/api/test/links.test.js.map +1 -1
  89. package/build/esm/api/test/misc.test.js +262 -11
  90. package/build/esm/api/test/misc.test.js.map +1 -1
  91. package/build/esm/api/test/objects.test.js +1872 -1412
  92. package/build/esm/api/test/objects.test.js.map +1 -1
  93. package/build/esm/api/test/spt.test.js +250 -103
  94. package/build/esm/api/test/spt.test.js.map +1 -1
  95. package/build/esm/cli/main.js +1 -1
  96. package/build/esm/conversion/toMarketplace/convertActionValidation.js +1 -1
  97. package/build/esm/conversion/toMarketplace/convertActionValidation.js.map +1 -1
  98. package/build/esm/conversion/toMarketplace/convertInterface.js +2 -2
  99. package/build/esm/conversion/toMarketplace/convertInterface.js.map +1 -1
  100. package/build/esm/conversion/toMarketplace/convertInterfacePropertyType.js +66 -0
  101. package/build/esm/conversion/toMarketplace/convertInterfacePropertyType.js.map +1 -0
  102. package/build/esm/conversion/toMarketplace/convertMappingValue.js +35 -0
  103. package/build/esm/conversion/toMarketplace/convertMappingValue.js.map +1 -1
  104. package/build/esm/conversion/toMarketplace/convertObject.js +4 -2
  105. package/build/esm/conversion/toMarketplace/convertObject.js.map +1 -1
  106. package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js +2 -1
  107. package/build/esm/conversion/toMarketplace/convertObjectPropertyType.js.map +1 -1
  108. package/build/esm/conversion/toMarketplace/convertSpt.js +4 -2
  109. package/build/esm/conversion/toMarketplace/convertSpt.js.map +1 -1
  110. package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrInterfaceType.js +143 -0
  111. package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrInterfaceType.js.map +1 -0
  112. package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js +4 -0
  113. package/build/esm/conversion/toMarketplace/propertyTypeTypeToOntologyIrType.js.map +1 -1
  114. package/build/esm/index.js.map +1 -1
  115. package/build/types/api/action/ActionParameter.d.ts +2 -1
  116. package/build/types/api/action/ActionParameter.d.ts.map +1 -1
  117. package/build/types/api/action/ActionParameterConfiguration.d.ts +2 -1
  118. package/build/types/api/action/ActionParameterConfiguration.d.ts.map +1 -1
  119. package/build/types/api/defineAction.d.ts +4 -3
  120. package/build/types/api/defineAction.d.ts.map +1 -1
  121. package/build/types/api/defineCreateInterfaceObjectAction.d.ts.map +1 -1
  122. package/build/types/api/defineInterface.d.ts +5 -5
  123. package/build/types/api/defineInterface.d.ts.map +1 -1
  124. package/build/types/api/defineModifyInterfaceObjectAction.d.ts.map +1 -1
  125. package/build/types/api/defineObject.d.ts.map +1 -1
  126. package/build/types/api/defineSpt.d.ts +3 -0
  127. package/build/types/api/defineSpt.d.ts.map +1 -1
  128. package/build/types/api/interface/InterfacePropertyType.d.ts +12 -2
  129. package/build/types/api/interface/InterfacePropertyType.d.ts.map +1 -1
  130. package/build/types/api/interface/InterfaceType.d.ts +3 -2
  131. package/build/types/api/interface/InterfaceType.d.ts.map +1 -1
  132. package/build/types/api/interface/getFlattenedInterfaceProperties.d.ts +1 -1
  133. package/build/types/api/interface/getFlattenedInterfaceProperties.d.ts.map +1 -1
  134. package/build/types/api/object/ObjectType.d.ts +1 -0
  135. package/build/types/api/object/ObjectType.d.ts.map +1 -1
  136. package/build/types/api/object/ObjectTypeDefinition.d.ts +1 -0
  137. package/build/types/api/object/ObjectTypeDefinition.d.ts.map +1 -1
  138. package/build/types/api/properties/PropertyTypeType.d.ts +1 -0
  139. package/build/types/api/properties/PropertyTypeType.d.ts.map +1 -1
  140. package/build/types/api/properties/SharedPropertyType.d.ts +1 -0
  141. package/build/types/api/properties/SharedPropertyType.d.ts.map +1 -1
  142. package/build/types/conversion/toMarketplace/convertInterface.d.ts.map +1 -1
  143. package/build/types/conversion/toMarketplace/convertInterfacePropertyType.d.ts +3 -0
  144. package/build/types/conversion/toMarketplace/convertInterfacePropertyType.d.ts.map +1 -0
  145. package/build/types/conversion/toMarketplace/convertMappingValue.d.ts +2 -1
  146. package/build/types/conversion/toMarketplace/convertMappingValue.d.ts.map +1 -1
  147. package/build/types/conversion/toMarketplace/convertObject.d.ts.map +1 -1
  148. package/build/types/conversion/toMarketplace/convertSpt.d.ts +1 -1
  149. package/build/types/conversion/toMarketplace/convertSpt.d.ts.map +1 -1
  150. package/build/types/conversion/toMarketplace/propertyTypeTypeToOntologyIrInterfaceType.d.ts +3 -0
  151. package/build/types/conversion/toMarketplace/propertyTypeTypeToOntologyIrInterfaceType.d.ts.map +1 -0
  152. package/build/types/index.d.ts +1 -0
  153. package/build/types/index.d.ts.map +1 -1
  154. package/package.json +4 -4
@@ -256,13 +256,26 @@ function getObject(object) {
256
256
  };
257
257
  }
258
258
 
259
+ // src/api/interface/InterfacePropertyType.ts
260
+ function isInterfaceSharedPropertyType(interfacePropertyType) {
261
+ return "sharedPropertyType" in interfacePropertyType;
262
+ }
263
+ function getInterfacePropertyTypeType(interfacePropertyType) {
264
+ return isInterfaceSharedPropertyType(interfacePropertyType) ? interfacePropertyType.sharedPropertyType.type : interfacePropertyType.type;
265
+ }
266
+
259
267
  // src/api/interface/getFlattenedInterfaceProperties.ts
260
268
  function getFlattenedInterfaceProperties(interfaceType) {
261
- let properties = interfaceType.propertiesV2;
269
+ let properties = Object.fromEntries(Object.entries(interfaceType.propertiesV3).map(([key, value]) => [isInterfaceSharedPropertyType(value) ? value.sharedPropertyType.apiName : key, value]));
270
+ Object.entries(interfaceType.propertiesV2).forEach(([apiName, spt]) => {
271
+ if (!(apiName in properties)) {
272
+ properties[apiName] = spt;
273
+ }
274
+ });
262
275
  interfaceType.extendsInterfaces.forEach((ext) => {
263
276
  properties = {
264
- ...properties,
265
- ...getFlattenedInterfaceProperties(ext)
277
+ ...getFlattenedInterfaceProperties(ext),
278
+ ...properties
266
279
  };
267
280
  });
268
281
  return properties;
@@ -279,7 +292,7 @@ function isExotic(type) {
279
292
  if (typeof type === "string") {
280
293
  return ["geopoint", "geoshape", "mediaReference", "geotimeSeries"].includes(type);
281
294
  } else if (typeof type === "object" && type != null) {
282
- return type.type === "marking" || type.type === "struct";
295
+ return type.type === "marking" || type.type === "struct" || type.type === "string" || type.type === "decimal";
283
296
  }
284
297
  return false;
285
298
  }
@@ -328,18 +341,19 @@ function defineObject(objectDef) {
328
341
  !!isExotic(objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.type) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Primary key property ${objectDef.primaryKeyPropertyApiName} can only be primitive types`) : invariant7__default.default(false) : void 0;
329
342
  objectDef.implementsInterfaces?.forEach((interfaceImpl) => {
330
343
  const allInterfaceProperties = getFlattenedInterfaceProperties(interfaceImpl.implements);
331
- const nonExistentInterfaceProperties = interfaceImpl.propertyMapping.map((val) => val.interfaceProperty).filter((interfaceProperty) => allInterfaceProperties[addNamespaceIfNone(interfaceProperty)] === void 0).map((interfaceProp) => ({
344
+ const nonExistentInterfaceProperties = interfaceImpl.propertyMapping.map((val) => val.interfaceProperty).filter((interfaceProperty) => allInterfaceProperties[addNamespaceIfNone(interfaceProperty)] === void 0 && allInterfaceProperties[withoutNamespace(interfaceProperty)] === void 0).map((interfaceProp) => ({
332
345
  type: "invalid",
333
346
  reason: `Interface property ${interfaceProp} referenced in ${objectDef.apiName} object does not exist`
334
347
  }));
335
- const interfaceToObjectProperties = Object.fromEntries(interfaceImpl.propertyMapping.map((mapping) => [addNamespaceIfNone(mapping.interfaceProperty), mapping.mapsTo]));
348
+ const interfaceToObjectProperties = Object.fromEntries(interfaceImpl.propertyMapping.map((mapping) => [mapping.interfaceProperty, mapping.mapsTo]));
336
349
  const validateProperty = (interfaceProp) => {
337
- if (interfaceProp[1].sharedPropertyType.apiName in interfaceToObjectProperties) {
338
- return validateInterfaceImplProperty(interfaceProp[1].sharedPropertyType, interfaceToObjectProperties[interfaceProp[0]], objectDef);
350
+ const apiName2 = isInterfaceSharedPropertyType(interfaceProp[1]) ? interfaceProp[1].sharedPropertyType.apiName : interfaceProp[0];
351
+ if (apiName2 in interfaceToObjectProperties) {
352
+ return validateInterfaceImplProperty(interfaceProp[1], apiName2, interfaceToObjectProperties[interfaceProp[0]], objectDef);
339
353
  }
340
354
  return {
341
355
  type: "invalid",
342
- reason: `Interface property ${interfaceProp[1].sharedPropertyType.apiName} not implemented by ${objectDef.apiName} object definition`
356
+ reason: `Interface spt ${apiName2} not implemented by ${objectDef.apiName} object definition`
343
357
  };
344
358
  };
345
359
  const validations = Object.entries(getFlattenedInterfaceProperties(interfaceImpl.implements)).map(validateProperty);
@@ -361,7 +375,7 @@ function formatValidationErrors(error) {
361
375
  return `Ontology Definition Error: ${error.reason}
362
376
  `;
363
377
  }
364
- function validateInterfaceImplProperty(spt, mappedObjectProp, object) {
378
+ function validateInterfaceImplProperty(type, apiName, mappedObjectProp, object) {
365
379
  const objProp = object.properties?.[mappedObjectProp];
366
380
  if (objProp === void 0) {
367
381
  return {
@@ -369,10 +383,11 @@ function validateInterfaceImplProperty(spt, mappedObjectProp, object) {
369
383
  reason: `Object property mapped to interface does not exist. Object Property Mapped: ${mappedObjectProp}`
370
384
  };
371
385
  }
372
- if (JSON.stringify(spt.type) !== JSON.stringify(objProp?.type)) {
386
+ const propertyType = getInterfacePropertyTypeType(type);
387
+ if (JSON.stringify(propertyType) !== JSON.stringify(objProp?.type)) {
373
388
  return {
374
389
  type: "invalid",
375
- reason: `Object property type does not match the interface property it is mapped to. Interface Property: ${spt.apiName}, objectProperty: ${mappedObjectProp}`
390
+ reason: `Object property type does not match the interface property it is mapped to. Interface Property: ${apiName}, objectProperty: ${mappedObjectProp}`
376
391
  };
377
392
  }
378
393
  return {
@@ -405,16 +420,38 @@ function validateDerivedDatasource(objectDef, datasource) {
405
420
  });
406
421
  const isLinkedProperties = typeof Object.values(datasource.propertyMapping)[0] === "string";
407
422
  if (isLinkedProperties) {
408
- validateLinkedProperties(datasource);
423
+ validateLinkedProperties(datasource, objectDef);
409
424
  } else {
410
425
  validateAggregations(datasource, objectDef);
411
426
  }
412
427
  }
428
+ function getPropertiesForValidation(linkObject, objectDef) {
429
+ const targetApiName = typeof linkObject === "string" ? linkObject : linkObject.apiName;
430
+ const selfApiName = namespace + objectDef.apiName;
431
+ if (targetApiName === selfApiName) {
432
+ return {
433
+ apiName: selfApiName,
434
+ hasProperty: (propName) => objectDef.properties?.[propName] !== void 0
435
+ };
436
+ }
437
+ const {
438
+ apiName,
439
+ object
440
+ } = getObject(linkObject);
441
+ return {
442
+ apiName,
443
+ hasProperty: (propName) => object.properties?.find((p) => p.apiName === propName) !== void 0
444
+ };
445
+ }
413
446
  function validateLinkedProperties(datasource, objectDef) {
414
447
  const foreignProperties = Object.values(datasource.propertyMapping);
415
- const finalObject = getObject(datasource.linkDefinition.at(-1).linkType.toMany.object).object;
448
+ const targetObject = datasource.linkDefinition.at(-1).linkType.toMany.object;
449
+ const {
450
+ apiName,
451
+ hasProperty
452
+ } = getPropertiesForValidation(targetObject, objectDef);
416
453
  foreignProperties.forEach((prop) => {
417
- !(finalObject.properties?.find((p) => p.apiName === prop) !== void 0) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Property '${prop}' on object '${finalObject.apiName}' is not defined`) : invariant7__default.default(false) : void 0;
454
+ !hasProperty(prop) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Property '${prop}' on object '${apiName}' is not defined`) : invariant7__default.default(false) : void 0;
418
455
  });
419
456
  }
420
457
  function validateAggregations(datasource, objectDef) {
@@ -440,8 +477,12 @@ function validateAggregations(datasource, objectDef) {
440
477
  }
441
478
  if (agg.type !== "count") {
442
479
  const foreignProperty = agg.property;
443
- const finalObject = getObject(datasource.linkDefinition.at(-1).linkType.toMany.object).object;
444
- !(finalObject.properties?.find((p) => p.apiName === foreignProperty) !== void 0) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Property '${foreignProperty}' on object '${finalObject.apiName}' is not defined`) : invariant7__default.default(false) : void 0;
480
+ const targetObject = datasource.linkDefinition.at(-1).linkType.toMany.object;
481
+ const {
482
+ apiName,
483
+ hasProperty
484
+ } = getPropertiesForValidation(targetObject, objectDef);
485
+ !hasProperty(foreignProperty) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Property '${foreignProperty}' on object '${apiName}' is not defined`) : invariant7__default.default(false) : void 0;
445
486
  }
446
487
  });
447
488
  }
@@ -693,7 +734,7 @@ function convertActionValidation(action) {
693
734
  return [p.id, {
694
735
  defaultValidation: {
695
736
  display: {
696
- renderHint: renderHintFromBaseType(p, p.validation),
737
+ renderHint: p.renderHint ?? renderHintFromBaseType(p, p.validation),
697
738
  visibility: convertActionVisibility(p.validation.defaultVisibility),
698
739
  ...p.defaultValue && {
699
740
  prefill: p.defaultValue
@@ -813,6 +854,10 @@ function propertyTypeTypeToOntologyIrType(type) {
813
854
  ...fieldTypeDefinition,
814
855
  apiName: key,
815
856
  fieldType: propertyTypeTypeToOntologyIrType(fieldTypeDefinition.fieldType),
857
+ displayMetadata: fieldTypeDefinition.displayMetadata ?? {
858
+ displayName: key,
859
+ description: void 0
860
+ },
816
861
  typeClasses: fieldTypeDefinition.typeClasses ?? [],
817
862
  aliases: fieldTypeDefinition.aliases ?? []
818
863
  };
@@ -909,6 +954,7 @@ function convertSpt({
909
954
  visibility,
910
955
  gothamMapping,
911
956
  typeClasses,
957
+ aliases,
912
958
  valueType,
913
959
  nullability,
914
960
  baseFormatter
@@ -927,10 +973,11 @@ function convertSpt({
927
973
  type: array ? {
928
974
  type: "array",
929
975
  array: {
930
- subtype: propertyTypeTypeToOntologyIrType(type)
976
+ subtype: propertyTypeTypeToOntologyIrType(type),
977
+ reducers: []
931
978
  }
932
979
  } : propertyTypeTypeToOntologyIrType(type),
933
- aliases: [],
980
+ aliases: aliases ?? [],
934
981
  baseFormatter,
935
982
  dataConstraints: dataConstraint,
936
983
  gothamMapping,
@@ -945,6 +992,178 @@ function convertSpt({
945
992
  };
946
993
  }
947
994
 
995
+ // src/conversion/toMarketplace/propertyTypeTypeToOntologyIrInterfaceType.ts
996
+ function propertyTypeTypeToOntologyIrInterfaceType(type) {
997
+ switch (true) {
998
+ case (typeof type === "object" && type.type === "marking"):
999
+ return {
1000
+ "type": "marking",
1001
+ marking: {
1002
+ markingType: type.markingType
1003
+ }
1004
+ };
1005
+ case (typeof type === "object" && type.type === "struct"):
1006
+ const structFields = new Array();
1007
+ for (const key in type.structDefinition) {
1008
+ const fieldTypeDefinition = type.structDefinition[key];
1009
+ let field;
1010
+ if (typeof fieldTypeDefinition === "string") {
1011
+ field = {
1012
+ apiName: key,
1013
+ displayMetadata: {
1014
+ displayName: key,
1015
+ description: void 0
1016
+ },
1017
+ typeClasses: [],
1018
+ aliases: [],
1019
+ fieldType: propertyTypeTypeToOntologyIrInterfaceType(fieldTypeDefinition),
1020
+ requireImplementation: true
1021
+ };
1022
+ } else {
1023
+ if (typeof fieldTypeDefinition === "object" && "fieldType" in fieldTypeDefinition) {
1024
+ field = {
1025
+ ...fieldTypeDefinition,
1026
+ apiName: key,
1027
+ fieldType: propertyTypeTypeToOntologyIrInterfaceType(fieldTypeDefinition.fieldType),
1028
+ displayMetadata: fieldTypeDefinition.displayMetadata ?? {
1029
+ displayName: key,
1030
+ description: void 0
1031
+ },
1032
+ typeClasses: fieldTypeDefinition.typeClasses ?? [],
1033
+ aliases: fieldTypeDefinition.aliases ?? [],
1034
+ requireImplementation: fieldTypeDefinition.requireImplementation ?? true
1035
+ };
1036
+ } else {
1037
+ field = {
1038
+ apiName: key,
1039
+ displayMetadata: {
1040
+ displayName: key,
1041
+ description: void 0
1042
+ },
1043
+ typeClasses: [],
1044
+ aliases: [],
1045
+ fieldType: propertyTypeTypeToOntologyIrInterfaceType(fieldTypeDefinition),
1046
+ requireImplementation: true
1047
+ };
1048
+ }
1049
+ }
1050
+ structFields.push(field);
1051
+ }
1052
+ return {
1053
+ type: "struct",
1054
+ struct: {
1055
+ structFields
1056
+ }
1057
+ };
1058
+ case (typeof type === "object" && type.type === "string"):
1059
+ return {
1060
+ "type": "string",
1061
+ "string": {
1062
+ analyzerOverride: void 0,
1063
+ enableAsciiFolding: type.enableAsciiFolding,
1064
+ isLongText: type.isLongText ?? false,
1065
+ supportsEfficientLeadingWildcard: type.supportsEfficientLeadingWildcard ?? false,
1066
+ supportsExactMatching: type.supportsExactMatching ?? true,
1067
+ supportsFullTextRegex: type.supportsFullTextRegex
1068
+ }
1069
+ };
1070
+ case (typeof type === "object" && type.type === "decimal"):
1071
+ return {
1072
+ "type": "decimal",
1073
+ "decimal": {
1074
+ precision: type.precision,
1075
+ scale: type.scale
1076
+ }
1077
+ };
1078
+ case type === "geopoint":
1079
+ return {
1080
+ type: "geohash",
1081
+ geohash: {}
1082
+ };
1083
+ case type === "decimal":
1084
+ return {
1085
+ type,
1086
+ [type]: {
1087
+ precision: void 0,
1088
+ scale: void 0
1089
+ }
1090
+ };
1091
+ case type === "string":
1092
+ return {
1093
+ type,
1094
+ [type]: {
1095
+ analyzerOverride: void 0,
1096
+ enableAsciiFolding: void 0,
1097
+ isLongText: false,
1098
+ supportsEfficientLeadingWildcard: false,
1099
+ supportsExactMatching: true
1100
+ }
1101
+ };
1102
+ case type === "mediaReference":
1103
+ return {
1104
+ type,
1105
+ mediaReference: {}
1106
+ };
1107
+ case type === "geotimeSeries":
1108
+ return {
1109
+ type: "geotimeSeriesReference",
1110
+ geotimeSeriesReference: {}
1111
+ };
1112
+ default:
1113
+ if (typeof type === "object") {
1114
+ throw new Error(`Unhandled exotic type: ${JSON.stringify(type)}`);
1115
+ }
1116
+ return distributeTypeHelper(type);
1117
+ }
1118
+ }
1119
+
1120
+ // src/conversion/toMarketplace/convertInterfacePropertyType.ts
1121
+ function convertInterfaceProperty(prop, apiName) {
1122
+ if (isInterfaceSharedPropertyType(prop)) {
1123
+ return [prop.sharedPropertyType.apiName, {
1124
+ type: "sharedPropertyBasedPropertyType",
1125
+ sharedPropertyBasedPropertyType: {
1126
+ requireImplementation: prop.required,
1127
+ sharedPropertyType: convertSpt(prop.sharedPropertyType)
1128
+ }
1129
+ }];
1130
+ } else {
1131
+ return [apiName, {
1132
+ type: "interfaceDefinedPropertyType",
1133
+ interfaceDefinedPropertyType: {
1134
+ apiName,
1135
+ displayMetadata: {
1136
+ displayName: prop.displayName ?? apiName,
1137
+ visibility: prop.visibility ?? "NORMAL",
1138
+ description: prop.description
1139
+ },
1140
+ type: prop.array ? {
1141
+ type: "array",
1142
+ array: {
1143
+ subtype: propertyTypeTypeToOntologyIrInterfaceType(prop.type)
1144
+ }
1145
+ } : propertyTypeTypeToOntologyIrInterfaceType(prop.type),
1146
+ constraints: {
1147
+ primaryKeyConstraint: prop.primaryKeyConstraint ?? "NO_RESTRICTION",
1148
+ requireImplementation: prop.required ?? true,
1149
+ indexedForSearch: true,
1150
+ typeClasses: prop.typeClasses ?? [],
1151
+ dataConstraints: convertNullabilityToDataConstraint({
1152
+ type: prop.type,
1153
+ nullability: prop.nullability
1154
+ }),
1155
+ valueType: prop.valueType ? {
1156
+ apiName: prop.valueType.apiName,
1157
+ version: prop.valueType.version,
1158
+ packageNamespace: prop.valueType.packageNamespace,
1159
+ displayMetadata: prop.valueType.displayMetadata
1160
+ } : void 0
1161
+ }
1162
+ }
1163
+ }];
1164
+ }
1165
+ }
1166
+
948
1167
  // src/conversion/toMarketplace/convertInterface.ts
949
1168
  function convertInterface(interfaceType) {
950
1169
  const {
@@ -971,8 +1190,7 @@ function convertInterface(interfaceType) {
971
1190
  extendsInterfaces: interfaceType.extendsInterfaces.map((i) => i.apiName),
972
1191
  // these are omitted from our internal types but we need to re-add them for the final json
973
1192
  properties: [],
974
- // TODO(mwalther): Support propertiesV3
975
- propertiesV3: {}
1193
+ propertiesV3: Object.fromEntries(Object.entries(interfaceType.propertiesV3).map(([apiName, prop]) => convertInterfaceProperty(prop, apiName)))
976
1194
  };
977
1195
  }
978
1196
 
@@ -1185,7 +1403,8 @@ function convertObjectPropertyType(property) {
1185
1403
  type: property.array ? {
1186
1404
  type: "array",
1187
1405
  array: {
1188
- subtype: propertyTypeTypeToOntologyIrType(property.type)
1406
+ subtype: propertyTypeTypeToOntologyIrType(property.type),
1407
+ reducers: []
1189
1408
  }
1190
1409
  } : propertyTypeTypeToOntologyIrType(property.type),
1191
1410
  typeClasses: property.typeClasses ?? (shouldNotHaveRenderHints(property.type) ? [] : defaultTypeClasses),
@@ -1245,7 +1464,8 @@ function convertObject(objectType) {
1245
1464
  },
1246
1465
  datasources: [...propertyDatasources, ...derivedDatasources, objectDatasource],
1247
1466
  entityMetadata: {
1248
- arePatchesEnabled: objectType.editsEnabled ?? false
1467
+ arePatchesEnabled: objectType.editsEnabled ?? false,
1468
+ aliases: objectType.aliases ?? []
1249
1469
  }
1250
1470
  };
1251
1471
  }
@@ -1278,7 +1498,8 @@ function extractPropertyDatasource(property, objectTypeApiName) {
1278
1498
  mediaSetView: {
1279
1499
  assumedMarkings: [],
1280
1500
  mediaSetViewLocator: identifier,
1281
- properties: [property.apiName]
1501
+ properties: [property.apiName],
1502
+ uploadProperties: []
1282
1503
  }
1283
1504
  };
1284
1505
  return [buildDatasource(property.apiName, mediaSetDefinition)];
@@ -2081,7 +2302,7 @@ function addNamespaceIfNone(apiName) {
2081
2302
  var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
2082
2303
  var uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
2083
2304
  async function main(args = process.argv) {
2084
- const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.15.0-beta.5").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
2305
+ const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.15.0-beta.7").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
2085
2306
  input: {
2086
2307
  alias: "i",
2087
2308
  describe: "Input file",
@@ -2259,29 +2480,39 @@ function defineAction(actionDef) {
2259
2480
  return fullAction;
2260
2481
  }
2261
2482
  function isPropertyParameter(def, name, type) {
2262
- return !Object.keys(def.nonParameterMappings ?? {}).includes(name) && !isStruct(type) && !def.excludedProperties?.includes(name);
2483
+ if ("interfaceType" in def) {
2484
+ return Object.keys(getFlattenedInterfaceProperties(def.interfaceType)).includes(name) && !Object.keys(def.nonParameterMappings ?? {}).includes(name) && !isStruct(type) && !def.excludedProperties?.includes(name);
2485
+ }
2486
+ return Object.keys(def.objectType.properties ?? {}).includes(name) && !Object.keys(def.nonParameterMappings ?? {}).includes(name) && !isStruct(type) && !def.excludedProperties?.includes(name);
2263
2487
  }
2264
2488
  function createParameters(def, propertyMap, parameterSet, requiredMap) {
2265
2489
  const targetParams = getTargetParameters(def, parameterSet);
2266
- return [...targetParams, ...Array.from(parameterSet).map((id) => ({
2267
- id,
2268
- displayName: def.parameterConfiguration?.[id]?.displayName ?? propertyMap[id]?.displayName ?? uppercaseFirstLetter(id),
2269
- type: def.parameterConfiguration?.[id]?.customParameterType ?? extractActionParameterType(propertyMap[id]),
2270
- validation: def.parameterConfiguration?.[id] !== void 0 ? {
2271
- ...def.parameterConfiguration?.[id],
2272
- allowedValues: def.parameterConfiguration?.[id].allowedValues ?? (def.parameterConfiguration?.[id].customParameterType ? extractAllowedValuesFromActionParameterType(def.parameterConfiguration?.[id].customParameterType) : extractAllowedValuesFromPropertyType(propertyMap[id]?.type)),
2273
- required: def.parameterConfiguration?.[id].required ?? propertyMap[id]?.nullability?.noNulls ?? false
2274
- } : {
2275
- required: propertyMap[id]?.array ?? false ? {
2276
- listLength: propertyMap[id]?.nullability?.noEmptyCollections ? {
2277
- min: 1
2278
- } : {}
2279
- } : requiredMap?.[id] ?? propertyMap[id]?.nullability?.noNulls ?? false,
2280
- allowedValues: extractAllowedValuesFromPropertyType(propertyMap[id]?.type)
2281
- },
2282
- defaultValue: def.parameterConfiguration?.[id]?.defaultValue,
2283
- description: def.parameterConfiguration?.[id]?.description
2284
- }))];
2490
+ return [...targetParams, ...Array.from(parameterSet).map((id) => {
2491
+ let propertyMetadata = void 0;
2492
+ if (id in propertyMap) {
2493
+ propertyMetadata = "sharedPropertyType" in propertyMap[id] ? propertyMap[id].sharedPropertyType : propertyMap[id];
2494
+ }
2495
+ return {
2496
+ id,
2497
+ displayName: def.parameterConfiguration?.[id]?.displayName ?? propertyMetadata?.displayName ?? uppercaseFirstLetter(id),
2498
+ type: def.parameterConfiguration?.[id]?.customParameterType ?? extractActionParameterType(propertyMetadata),
2499
+ validation: def.parameterConfiguration?.[id] !== void 0 ? {
2500
+ ...def.parameterConfiguration?.[id],
2501
+ allowedValues: def.parameterConfiguration?.[id].allowedValues ?? (def.parameterConfiguration?.[id].customParameterType ? extractAllowedValuesFromActionParameterType(def.parameterConfiguration?.[id].customParameterType) : extractAllowedValuesFromPropertyType(propertyMetadata.type)),
2502
+ required: def.parameterConfiguration?.[id].required ?? propertyMetadata?.nullability?.noNulls ?? false
2503
+ } : {
2504
+ required: propertyMetadata.array ?? false ? {
2505
+ listLength: propertyMetadata.nullability?.noEmptyCollections ? {
2506
+ min: 1
2507
+ } : {}
2508
+ } : requiredMap?.[id] ?? propertyMetadata?.nullability?.noNulls ?? false,
2509
+ allowedValues: extractAllowedValuesFromPropertyType(propertyMetadata?.type)
2510
+ },
2511
+ defaultValue: def.parameterConfiguration?.[id]?.defaultValue,
2512
+ description: def.parameterConfiguration?.[id]?.description,
2513
+ renderHint: def.parameterConfiguration?.[id]?.renderHint
2514
+ };
2515
+ })];
2285
2516
  }
2286
2517
  function getTargetParameters(def, parameterSet) {
2287
2518
  const targetParams = [];
@@ -2835,7 +3066,7 @@ function validateActionParameters(def, properties, name) {
2835
3066
  !(properties.includes(id) || properties.includes(addNamespaceIfNone(id)) || def.parameterConfiguration?.[id].customParameterType !== void 0 || isTargetParameter(id)) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Parameter ${id} does not exist as a property on ${name} and its type is not explicitly defined`) : invariant7__default.default(false) : void 0;
2836
3067
  });
2837
3068
  [...Object.keys(def.nonParameterMappings ?? {}), ...def.excludedProperties ?? []].forEach((id) => {
2838
- !(properties.includes(id) || properties.includes(addNamespaceIfNone(id))) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Property ${id} does not exist as a property on ${name}`) : invariant7__default.default(false) : void 0;
3069
+ !(properties.includes(id) || properties.includes(addNamespaceIfNone(id)) || properties.includes(withoutNamespace(id))) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Property ${id} does not exist as a property on ${name}`) : invariant7__default.default(false) : void 0;
2839
3070
  });
2840
3071
  }
2841
3072
  function createDefaultParameterOrdering(def, properties, parameters, priorityId) {
@@ -2850,15 +3081,6 @@ function validateParameterOrdering(parameterOrdering, parameterSet, actionApiNam
2850
3081
  function isTargetParameter(parameterId) {
2851
3082
  return parameterId === MODIFY_OBJECT_PARAMETER || parameterId === CREATE_OR_MODIFY_OBJECT_PARAMETER || parameterId === CREATE_INTERFACE_OBJECT_PARAMETER || parameterId === MODIFY_INTERFACE_OBJECT_PARAMETER;
2852
3083
  }
2853
- function addNamespaceToActionDefinition(def) {
2854
- def.parameterConfiguration = Object.fromEntries(Object.entries(def.parameterConfiguration ?? {}).map(([id, config]) => [getInterfaceParameterName(def, id), config]));
2855
- def.nonParameterMappings = Object.fromEntries(Object.entries(def.nonParameterMappings ?? {}).map(([id, value]) => [addNamespaceIfNone(id), value]));
2856
- def.excludedProperties = (def.excludedProperties ?? []).map((id) => addNamespaceIfNone(id));
2857
- def.sections = def.sections?.map((section) => ({
2858
- ...section,
2859
- parameters: section.parameters.map((p) => getInterfaceParameterName(def, p))
2860
- }));
2861
- }
2862
3084
  function getInterfaceParameterName(def, parameter) {
2863
3085
  if (def.useNonNamespacedParameters) {
2864
3086
  return getNonNamespacedParameterName(def, parameter);
@@ -2868,6 +3090,41 @@ function getInterfaceParameterName(def, parameter) {
2868
3090
  function getNonNamespacedParameterName(def, parameter) {
2869
3091
  return def.conflictingParameterOverrides?.[parameter] ?? (parameter.split(".").pop() || parameter);
2870
3092
  }
3093
+ function convertInterfacePropertyMappingValue(value) {
3094
+ switch (value.type) {
3095
+ case "uuid":
3096
+ return {
3097
+ type: "logicRuleValue",
3098
+ logicRuleValue: {
3099
+ type: "uniqueIdentifier",
3100
+ uniqueIdentifier: {
3101
+ linkId: value.linkId ?? crypto.randomUUID()
3102
+ }
3103
+ }
3104
+ };
3105
+ case "currentTime":
3106
+ return {
3107
+ type: "logicRuleValue",
3108
+ logicRuleValue: {
3109
+ type: "currentTime",
3110
+ currentTime: {}
3111
+ }
3112
+ };
3113
+ case "currentUser":
3114
+ return {
3115
+ type: "logicRuleValue",
3116
+ logicRuleValue: {
3117
+ type: "currentUser",
3118
+ currentUser: {}
3119
+ }
3120
+ };
3121
+ default:
3122
+ return {
3123
+ type: "logicRuleValue",
3124
+ logicRuleValue: value
3125
+ };
3126
+ }
3127
+ }
2871
3128
  function convertMappingValue(value) {
2872
3129
  switch (value.type) {
2873
3130
  case "uuid":
@@ -2894,12 +3151,12 @@ function convertMappingValue(value) {
2894
3151
 
2895
3152
  // src/api/defineCreateInterfaceObjectAction.ts
2896
3153
  function defineCreateInterfaceObjectAction(def) {
2897
- addNamespaceToActionDefinition(def);
2898
3154
  const allProperties = getFlattenedInterfaceProperties(def.interfaceType);
2899
3155
  validateActionParameters(def, Object.keys(allProperties), def.interfaceType.apiName);
2900
- const sptNames = Object.keys(allProperties).filter((apiName) => isPropertyParameter(def, apiName, allProperties[apiName].sharedPropertyType.type));
2901
- const parameterNames = new Set(sptNames.map((apiName) => getInterfaceParameterName(def, apiName)));
2902
- const propertyMap = Object.fromEntries(Object.entries(allProperties).map(([id, prop]) => [getInterfaceParameterName(def, id), prop.sharedPropertyType]));
3156
+ const actionInterfaceProperties = Object.entries(allProperties).filter(([apiName, type]) => isPropertyParameter(def, apiName, getInterfacePropertyTypeType(type)));
3157
+ const sptNames = actionInterfaceProperties.filter(([_apiName, type]) => isInterfaceSharedPropertyType(type)).map(([apiName]) => apiName);
3158
+ const parameterNames = new Set(actionInterfaceProperties.map(([apiName, _type]) => getInterfaceParameterName(def, apiName)));
3159
+ const propertyMap = Object.fromEntries(Object.entries(allProperties).map(([id, prop]) => [getInterfaceParameterName(def, id), prop]));
2903
3160
  Object.keys(def.parameterConfiguration ?? {}).forEach((param) => parameterNames.add(getInterfaceParameterName(def, param)));
2904
3161
  parameterNames.add(CREATE_INTERFACE_OBJECT_PARAMETER);
2905
3162
  const actionApiName = def.apiName ?? `create-${kebab(def.interfaceType.apiName.split(".").pop() ?? def.interfaceType.apiName)}${def.objectType === void 0 ? "" : `-${kebab(def.objectType.apiName.split(".").pop() ?? def.objectType.apiName)}`}`;
@@ -2909,8 +3166,17 @@ function defineCreateInterfaceObjectAction(def) {
2909
3166
  }
2910
3167
  validateParameterOrdering(def.parameterOrdering, parameterNames, actionApiName);
2911
3168
  }
2912
- const parameters = createParameters(def, propertyMap, parameterNames, Object.fromEntries(Object.entries(allProperties).map(([id, prop]) => [id, prop.required])));
2913
- const mappings = Object.fromEntries(Object.entries(def.nonParameterMappings ?? {}).map(([id, value]) => [id, convertMappingValue(value)]));
3169
+ const parameters = createParameters(def, propertyMap, parameterNames, Object.fromEntries(Object.entries(allProperties).map(([id, prop]) => [id, prop.required ?? true])));
3170
+ let sptMappings = {};
3171
+ const mappings = Object.fromEntries(Object.entries(def.nonParameterMappings ?? {}).map(([id, value]) => {
3172
+ if (sptNames.includes(id)) {
3173
+ sptMappings = {
3174
+ ...sptMappings,
3175
+ [id]: convertMappingValue(value)
3176
+ };
3177
+ }
3178
+ return [id, convertInterfacePropertyMappingValue(value)];
3179
+ }));
2914
3180
  return defineAction({
2915
3181
  apiName: actionApiName,
2916
3182
  displayName: def.displayName ?? `Create ${def.interfaceType.displayMetadata.displayName}`,
@@ -2932,6 +3198,16 @@ function defineCreateInterfaceObjectAction(def) {
2932
3198
  type: "parameterId",
2933
3199
  parameterId: def.useNonNamespacedParameters ? getNonNamespacedParameterName(def, id) : id
2934
3200
  }])),
3201
+ ...sptMappings
3202
+ },
3203
+ interfacePropertyValues: {
3204
+ ...Object.fromEntries(actionInterfaceProperties.map(([id, _type]) => [id, {
3205
+ type: "logicRuleValue",
3206
+ logicRuleValue: {
3207
+ type: "parameterId",
3208
+ parameterId: def.useNonNamespacedParameters ? getNonNamespacedParameterName(def, id) : id
3209
+ }
3210
+ }])),
2935
3211
  ...mappings
2936
3212
  }
2937
3213
  }
@@ -3175,22 +3451,6 @@ function defineDeleteObjectAction(def) {
3175
3451
  }
3176
3452
  });
3177
3453
  }
3178
- function defineSharedPropertyType(sptDef) {
3179
- const apiName = namespace + sptDef.apiName;
3180
- !(ontologyDefinition[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Shared property type ${apiName} already exists`) : invariant7__default.default(false) : void 0;
3181
- !(!shouldNotHaveRenderHints(sptDef.type) || !hasRenderHints(sptDef.typeClasses)) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Shared property type ${apiName} of type '${getPropertyTypeName(sptDef.type)}' should not have render hints`) : invariant7__default.default(false) : void 0;
3182
- const fullSpt = {
3183
- ...sptDef,
3184
- apiName,
3185
- nonNameSpacedApiName: sptDef.apiName,
3186
- displayName: sptDef.displayName ?? sptDef.apiName,
3187
- // This way the non-namespaced api name is the display name (maybe not ideal)
3188
- typeClasses: sptDef.typeClasses ?? (shouldNotHaveRenderHints(sptDef.type) ? [] : defaultTypeClasses),
3189
- __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE
3190
- };
3191
- updateOntology(fullSpt);
3192
- return fullSpt;
3193
- }
3194
3454
 
3195
3455
  // src/api/interface/mapSimplifiedStatusToInterfaceTypeStatus.ts
3196
3456
  function mapSimplifiedStatusToInterfaceTypeStatus(status) {
@@ -3228,19 +3488,33 @@ function combineApiNamespaceIfMissing(namespace2, apiName) {
3228
3488
  function defineInterface(interfaceDef) {
3229
3489
  const apiName = namespace + interfaceDef.apiName;
3230
3490
  !(ontologyDefinition[OntologyEntityTypeEnum.INTERFACE_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Interface ${apiName} already exists`) : invariant7__default.default(false) : void 0;
3231
- const properties = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([unNamespacedPropApiName, type]) => {
3232
- if (typeof type === "object" && "propertyDefinition" in type) {
3233
- const apiName3 = combineApiNamespaceIfMissing(namespace, typeof type.propertyDefinition === "object" && "apiName" in type.propertyDefinition ? type.propertyDefinition.apiName : unNamespacedPropApiName);
3234
- return [apiName3, {
3235
- required: type.required,
3236
- sharedPropertyType: unifyBasePropertyDefinition(namespace, unNamespacedPropApiName, type.propertyDefinition)
3491
+ const spts = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).filter(([_name, prop]) => {
3492
+ return isInterfaceSharedPropertyType(prop) || "apiName" in prop;
3493
+ }).map(([s, spt]) => {
3494
+ const required = isInterfaceSharedPropertyType(spt) ? spt.required : true;
3495
+ return [s, {
3496
+ sharedPropertyType: isInterfaceSharedPropertyType(spt) ? spt.sharedPropertyType : spt,
3497
+ required
3498
+ }];
3499
+ }));
3500
+ const propertiesV2 = Object.fromEntries(Object.entries(spts).map(([propName, type]) => {
3501
+ const sptApiName = combineApiNamespaceIfMissing(namespace, type.sharedPropertyType.apiName);
3502
+ return [sptApiName, {
3503
+ required: type.required,
3504
+ sharedPropertyType: verifyBasePropertyDefinition(namespace, propName, type.sharedPropertyType)
3505
+ }];
3506
+ }));
3507
+ const propertiesV3 = Object.fromEntries(Object.entries(interfaceDef.properties ?? {}).map(([apiName2, prop]) => {
3508
+ const required = typeof prop === "object" && isInterfaceSharedPropertyType(prop) ? prop.required : true;
3509
+ const propertyBase = typeof prop === "object" && isInterfaceSharedPropertyType(prop) ? prop.sharedPropertyType : prop;
3510
+ if (typeof propertyBase === "object" && "nonNameSpacedApiName" in propertyBase) {
3511
+ return [apiName2, {
3512
+ required,
3513
+ sharedPropertyType: propertyBase
3237
3514
  }];
3515
+ } else {
3516
+ return [apiName2, propertyBase];
3238
3517
  }
3239
- const apiName2 = combineApiNamespaceIfMissing(namespace, typeof type === "object" && "apiName" in type ? type.apiName : unNamespacedPropApiName);
3240
- return [apiName2, {
3241
- required: true,
3242
- sharedPropertyType: unifyBasePropertyDefinition(namespace, unNamespacedPropApiName, type)
3243
- }];
3244
3518
  }));
3245
3519
  const extendsInterfaces = interfaceDef.extends ? Array.isArray(interfaceDef.extends) ? interfaceDef.extends : [interfaceDef.extends] : [];
3246
3520
  const status = mapSimplifiedStatusToInterfaceTypeStatus(interfaceDef.status ?? {
@@ -3263,31 +3537,22 @@ function defineInterface(interfaceDef) {
3263
3537
  extendsInterfaces,
3264
3538
  links: [],
3265
3539
  status,
3266
- propertiesV2: properties,
3540
+ propertiesV2,
3541
+ propertiesV3,
3267
3542
  searchable: interfaceDef.searchable ?? true,
3268
3543
  __type: OntologyEntityTypeEnum.INTERFACE_TYPE
3269
3544
  };
3270
3545
  updateOntology(fullInterface);
3271
3546
  return fullInterface;
3272
3547
  }
3273
- function unifyBasePropertyDefinition(namespace2, apiName, type) {
3274
- if (typeof type === "string" || typeof type === "object" && !("apiName" in type)) {
3275
- !isPropertyTypeType(type) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Invalid data type ${JSON.stringify(type)} for property ${apiName} on InterfaceType ${apiName}`) : invariant7__default.default(false) : void 0;
3276
- const spt = defineSharedPropertyType({
3277
- apiName,
3278
- displayName: apiName,
3279
- type,
3280
- array: false
3281
- });
3282
- return spt;
3283
- } else {
3284
- const unNamespacedTypeApiName = withoutNamespace(type.apiName);
3285
- !(namespace2 + apiName === type.apiName || apiName === unNamespacedTypeApiName) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `property key and it's apiName must be identical. ${JSON.stringify({
3286
- key: apiName,
3287
- apiName: type.apiName
3288
- })}`) : invariant7__default.default(false) : void 0;
3289
- return type;
3290
- }
3548
+ function verifyBasePropertyDefinition(namespace2, apiName, type) {
3549
+ const unNamespacedTypeApiName = withoutNamespace(type.apiName);
3550
+ !(isPropertyTypeType(type.type) || isExotic(type.type)) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Invalid data type ${JSON.stringify(type)} for property ${apiName} on InterfaceType ${apiName}`) : invariant7__default.default(false) : void 0;
3551
+ !(namespace2 + apiName === type.apiName || apiName === unNamespacedTypeApiName) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `property key and it's apiName must be identical. ${JSON.stringify({
3552
+ key: apiName,
3553
+ apiName: type.apiName
3554
+ })}`) : invariant7__default.default(false) : void 0;
3555
+ return type;
3291
3556
  }
3292
3557
  function defineInterfaceLinkConstraint(linkDef) {
3293
3558
  const fromLinkMeta = getLinkMeta(linkDef);
@@ -3384,12 +3649,14 @@ function convertLinkTypeMetadata(metadata) {
3384
3649
 
3385
3650
  // src/api/defineModifyInterfaceObjectAction.ts
3386
3651
  function defineModifyInterfaceObjectAction(def) {
3387
- addNamespaceToActionDefinition(def);
3388
3652
  const allProperties = getFlattenedInterfaceProperties(def.interfaceType);
3389
3653
  validateActionParameters(def, Object.keys(allProperties), def.interfaceType.apiName);
3390
- const sptNames = Object.keys(allProperties).filter((apiName) => isPropertyParameter(def, apiName, allProperties[apiName].sharedPropertyType.type));
3391
- const parameterNames = new Set(sptNames.map((apiName) => getInterfaceParameterName(def, apiName)));
3392
- const propertyMap = Object.fromEntries(Object.entries(allProperties).map(([id, prop]) => [getInterfaceParameterName(def, id), prop.sharedPropertyType]));
3654
+ const actionInterfaceProperties = Object.entries(allProperties).filter(([apiName, type]) => {
3655
+ return isPropertyParameter(def, apiName, getInterfacePropertyTypeType(type));
3656
+ });
3657
+ const sptNames = actionInterfaceProperties.filter(([_apiName, type]) => isInterfaceSharedPropertyType(type)).map(([apiName]) => apiName);
3658
+ const parameterNames = new Set(actionInterfaceProperties.map(([apiName, _type]) => getInterfaceParameterName(def, apiName)));
3659
+ const propertyMap = Object.fromEntries(Object.entries(allProperties).map(([id, prop]) => [getInterfaceParameterName(def, id), prop]));
3393
3660
  Object.keys(def.parameterConfiguration ?? {}).forEach((param) => parameterNames.add(getInterfaceParameterName(def, param)));
3394
3661
  parameterNames.add(MODIFY_INTERFACE_OBJECT_PARAMETER);
3395
3662
  const actionApiName = def.apiName ?? `modify-${kebab(def.interfaceType.apiName.split(".").pop() ?? def.interfaceType.apiName)}${def.objectType === void 0 ? "" : `-${kebab(def.objectType.apiName.split(".").pop() ?? def.objectType.apiName)}`}`;
@@ -3399,8 +3666,17 @@ function defineModifyInterfaceObjectAction(def) {
3399
3666
  }
3400
3667
  validateParameterOrdering(def.parameterOrdering, parameterNames, actionApiName);
3401
3668
  }
3402
- const parameters = createParameters(def, propertyMap, parameterNames, Object.fromEntries(Object.entries(allProperties).map(([id, prop]) => [id, prop.required])));
3403
- const mappings = Object.fromEntries(Object.entries(def.nonParameterMappings ?? {}).map(([id, value]) => [id, convertMappingValue(value)]));
3669
+ const parameters = createParameters(def, propertyMap, parameterNames, Object.fromEntries(Object.entries(allProperties).map(([id, prop]) => [id, prop.required ?? true])));
3670
+ let sptMappings = {};
3671
+ const mappings = Object.fromEntries(Object.entries(def.nonParameterMappings ?? {}).map(([id, value]) => {
3672
+ if (sptNames.includes(id)) {
3673
+ sptMappings = {
3674
+ ...sptMappings,
3675
+ [id]: convertMappingValue(value)
3676
+ };
3677
+ }
3678
+ return [id, convertInterfacePropertyMappingValue(value)];
3679
+ }));
3404
3680
  return defineAction({
3405
3681
  apiName: actionApiName,
3406
3682
  displayName: def.displayName ?? `Modify ${def.interfaceType.displayMetadata.displayName}`,
@@ -3415,12 +3691,23 @@ function defineModifyInterfaceObjectAction(def) {
3415
3691
  rules: [{
3416
3692
  type: "modifyInterfaceRule",
3417
3693
  modifyInterfaceRule: {
3694
+ interfaceApiName: def.interfaceType.apiName,
3418
3695
  interfaceObjectToModifyParameter: "interfaceObjectToModifyParameter",
3419
3696
  sharedPropertyValues: {
3420
3697
  ...Object.fromEntries(sptNames.map((id) => [id, {
3421
3698
  type: "parameterId",
3422
3699
  parameterId: def.useNonNamespacedParameters ? getNonNamespacedParameterName(def, id) : id
3423
3700
  }])),
3701
+ ...sptMappings
3702
+ },
3703
+ interfacePropertyValues: {
3704
+ ...Object.fromEntries(actionInterfaceProperties.map(([id, _type]) => [id, {
3705
+ type: "logicRuleValue",
3706
+ logicRuleValue: {
3707
+ type: "parameterId",
3708
+ parameterId: def.useNonNamespacedParameters ? getNonNamespacedParameterName(def, id) : id
3709
+ }
3710
+ }])),
3424
3711
  ...mappings
3425
3712
  }
3426
3713
  }
@@ -3530,6 +3817,22 @@ function defineModifyObjectAction(def) {
3530
3817
  }
3531
3818
  });
3532
3819
  }
3820
+ function defineSharedPropertyType(sptDef) {
3821
+ const apiName = namespace + sptDef.apiName;
3822
+ !(ontologyDefinition[OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE][apiName] === void 0) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Shared property type ${apiName} already exists`) : invariant7__default.default(false) : void 0;
3823
+ !(!shouldNotHaveRenderHints(sptDef.type) || !hasRenderHints(sptDef.typeClasses)) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, `Shared property type ${apiName} of type '${getPropertyTypeName(sptDef.type)}' should not have render hints`) : invariant7__default.default(false) : void 0;
3824
+ const fullSpt = {
3825
+ ...sptDef,
3826
+ apiName,
3827
+ nonNameSpacedApiName: sptDef.apiName,
3828
+ displayName: sptDef.displayName ?? sptDef.apiName,
3829
+ // This way the non-namespaced api name is the display name (maybe not ideal)
3830
+ typeClasses: sptDef.typeClasses ?? (shouldNotHaveRenderHints(sptDef.type) ? [] : defaultTypeClasses),
3831
+ __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE
3832
+ };
3833
+ updateOntology(fullSpt);
3834
+ return fullSpt;
3835
+ }
3533
3836
  function convertValueTypeTypeToBaseType(valueType) {
3534
3837
  switch (true) {
3535
3838
  case (typeof valueType === "object" && valueType.type === "array"):