@osdk/maker 0.14.0-beta.14 → 0.14.0-beta.15

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 CHANGED
@@ -1,5 +1,19 @@
1
1
  # @osdk/maker
2
2
 
3
+ ## 0.14.0-beta.15
4
+
5
+ ### Minor Changes
6
+
7
+ - a26bfab: Remove import section from readme
8
+ - 88ac696: Remove apiName field from user object property definitions
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [823c756]
13
+ - Updated dependencies [0e863aa]
14
+ - @osdk/typescript-sdk-docs@0.5.0-beta.5
15
+ - @osdk/api@2.6.0-beta.11
16
+
3
17
  ## 0.14.0-beta.14
4
18
 
5
19
  ### Minor Changes
package/README.md CHANGED
@@ -14,7 +14,6 @@ The Maker package provides a type-safe, programmatic way to define ontologies, w
14
14
  - [Defining Links](#defining-links)
15
15
  - [Interface Link Constraints](#interface-link-constraints)
16
16
  - [Defining Actions](#defining-actions)
17
- - [Importing Ontology Entities](#importing-ontology-entities)
18
17
  - [Advanced](#advanced)
19
18
 
20
19
  ## Getting Started
@@ -85,7 +85,7 @@ export function defineObject(objectDef) {
85
85
  const allFailedValidations = validations.concat(nonExistentInterfaceProperties).filter(val => val.type === "invalid");
86
86
  !(allFailedValidations.length === 0) ? process.env.NODE_ENV !== "production" ? invariant(false, "\n" + allFailedValidations.map(formatValidationErrors).join("\n")) : invariant(false) : void 0;
87
87
  });
88
- const flattenedProperties = Object.entries(objectDef.properties ?? {}).map(([apiName, property]) => convertUserObjectPropertyType(property.apiName ?? apiName, property));
88
+ const flattenedProperties = Object.entries(objectDef.properties ?? {}).map(([apiName, property]) => convertUserObjectPropertyType(apiName, property));
89
89
  const finalObject = {
90
90
  ...objectDef,
91
91
  apiName: apiName,
@@ -129,7 +129,6 @@ export function convertToPluralDisplayName(s) {
129
129
  }
130
130
  function convertUserObjectPropertyType(apiName, property) {
131
131
  // fill in missing fields to be used by actions
132
- property.apiName = apiName;
133
132
  property.displayName = property.displayName ?? uppercaseFirstLetter(apiName);
134
133
  return {
135
134
  ...property,
@@ -1 +1 @@
1
- {"version":3,"file":"defineObject.js","names":["invariant","getObject","OntologyEntityTypeEnum","addNamespaceIfNone","importedTypes","namespace","ontologyDefinition","updateOntology","getFlattenedInterfaceProperties","isExotic","ISO_8601_DURATION","ISO_8601_DATETIME","API_NAME_PATTERN","defineObject","objectDef","apiName","propertyApiNames","properties","Object","keys","OBJECT_TYPE","undefined","Error","test","process","env","NODE_ENV","includes","titlePropertyApiName","primaryKeyPropertyApiName","editOnly","retentionPeriods","datasources","filter","ds","type","map","retentionPeriod","forEach","baseDatasources","length","join","derivedDatasources","validateDerivedDatasource","status","activeProperties","entries","property","push","deadline","implementsInterfaces","interfaceImpl","allInterfaceProperties","implements","nonExistentInterfaceProperties","propertyMapping","val","interfaceProperty","interfaceProp","reason","interfaceToObjectProperties","fromEntries","mapping","mapsTo","validateProperty","sharedPropertyType","validateInterfaceImplProperty","validations","allFailedValidations","concat","formatValidationErrors","flattenedProperties","convertUserObjectPropertyType","finalObject","__type","error","spt","mappedObjectProp","object","objProp","JSON","stringify","uppercaseFirstLetter","s","charAt","toUpperCase","slice","convertToPluralDisplayName","endsWith","displayName","datasource","linkDefinition","link","linkApiName","linkType","LINK_TYPE","prop","isLinkedProperties","values","validateLinkedProperties","validateAggregations","foreignProperties","at","toMany","find","p","props","propName","agg","isCollectible","limit","isNumeric","isPrimitive","foreignProperty","array","typeType"],"sources":["defineObject.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { getObject } from \"../conversion/toMarketplace/convertLink.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n addNamespaceIfNone,\n importedTypes,\n namespace,\n ontologyDefinition,\n updateOntology,\n} from \"./defineOntology.js\";\nimport { getFlattenedInterfaceProperties } from \"./interface/getFlattenedInterfaceProperties.js\";\nimport type { InterfacePropertyType } from \"./interface/InterfacePropertyType.js\";\nimport type { ObjectPropertyType } from \"./object/ObjectPropertyType.js\";\nimport type { ObjectPropertyTypeUserDefinition } from \"./object/ObjectPropertyTypeUserDefinition.js\";\nimport type { ObjectType } from \"./object/ObjectType.js\";\nimport type {\n DerivedPropertyAggregation,\n ObjectTypeDatasourceDefinition_derived,\n ObjectTypeDatasourceDefinition_stream,\n} from \"./object/ObjectTypeDatasourceDefinition.js\";\nimport type { ObjectTypeDefinition } from \"./object/ObjectTypeDefinition.js\";\nimport type { PropertyTypeType } from \"./properties/PropertyTypeType.js\";\nimport { isExotic } from \"./properties/PropertyTypeType.js\";\nimport type { SharedPropertyType } from \"./properties/SharedPropertyType.js\";\n\n// From https://stackoverflow.com/a/79288714\nconst ISO_8601_DURATION =\n /^P(?!$)(?:(?:((?:\\d+Y)|(?:\\d+(?:\\.|,)\\d+Y$))?((?:\\d+M)|(?:\\d+(?:\\.|,)\\d+M$))?((?:\\d+D)|(?:\\d+(?:\\.|,)\\d+D$))?(T((?:\\d+H)|(?:\\d+(?:\\.|,)\\d+H$))?((?:\\d+M)|(?:\\d+(?:\\.|,)\\d+M$))?((?:\\d+S)|(?:\\d+(?:\\.|,)\\d+S$))?)?)|(?:\\d+(?:(?:\\.|,)\\d+)?W))$/;\n\n// ISO 8601 date and time format (YYYY-MM-DDThh:mm:ss.sssZ)\nconst ISO_8601_DATETIME =\n /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})?)?$/;\n\nconst API_NAME_PATTERN = /^([a-zA-Z][a-zA-Z0-9\\\\-]*)$/;\n\nexport function defineObject(\n objectDef: ObjectTypeDefinition,\n): ObjectTypeDefinition {\n const apiName = namespace + objectDef.apiName;\n const propertyApiNames = objectDef.properties\n ? Object.keys(objectDef.properties)\n : [];\n if (\n ontologyDefinition[OntologyEntityTypeEnum.OBJECT_TYPE][apiName]\n !== undefined\n ) {\n throw new Error(\n `Object type with apiName ${objectDef.apiName} is already defined`,\n );\n }\n invariant(\n API_NAME_PATTERN.test(objectDef.apiName),\n `Invalid API name ${objectDef.apiName}. API names must match the regex ${API_NAME_PATTERN}.`,\n );\n invariant(\n propertyApiNames.includes(objectDef.titlePropertyApiName),\n `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`,\n );\n invariant(\n propertyApiNames.includes(objectDef.primaryKeyPropertyApiName),\n `Primary key property ${objectDef.primaryKeyPropertyApiName} does not exist on object ${objectDef.apiName}`,\n );\n\n invariant(\n !(objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.editOnly),\n `Primary key property ${objectDef.primaryKeyPropertyApiName} on object ${objectDef.apiName} cannot be edit-only`,\n );\n\n const retentionPeriods =\n ((objectDef.datasources ?? []).filter(ds =>\n ds.type === \"stream\"\n ) as ObjectTypeDatasourceDefinition_stream[]).map(ds => ds.retentionPeriod);\n retentionPeriods.forEach(retentionPeriod => {\n invariant(\n retentionPeriod === undefined || ISO_8601_DURATION.test(retentionPeriod),\n `Retention period \"${retentionPeriod}\" on object \"${objectDef.apiName}\" is not a valid ISO 8601 duration string`,\n );\n });\n\n const baseDatasources = (objectDef.datasources ?? []).filter(ds =>\n [\"dataset\", \"stream\", \"restrictedView\"].includes(ds.type)\n );\n invariant(\n baseDatasources.length <= 1,\n `Object ${objectDef.apiName} has more than one base datasource (got: [${\n baseDatasources.map(ds => ds.type).join(\", \")\n }])`,\n );\n const derivedDatasources = (objectDef.datasources ?? []).filter(ds =>\n ds.type === \"derived\"\n );\n if (derivedDatasources.length > 0) {\n derivedDatasources.forEach(ds => validateDerivedDatasource(objectDef, ds));\n }\n\n // Validate that if object status is experimental, no property can have a status of active\n if (objectDef.status === \"experimental\") {\n const activeProperties: string[] = [];\n Object.entries(objectDef.properties ?? {}).forEach(\n ([apiName, property]) => {\n if (property.status === \"active\") {\n activeProperties.push(apiName);\n }\n },\n );\n invariant(\n activeProperties.length === 0,\n `When object \"${objectDef.apiName}\" has experimental status, no properties can have \"active\" status, but found active properties: ${\n activeProperties.join(\", \")\n }`,\n );\n }\n\n // Validate deprecated status deadline is in ISO 8601 format\n if (\n objectDef.status && typeof objectDef.status === \"object\"\n && objectDef.status.type === \"deprecated\"\n ) {\n const deadline = objectDef.status.deadline;\n invariant(\n deadline !== undefined && ISO_8601_DATETIME.test(deadline),\n `Deprecated status deadline \"${deadline}\" on object \"${objectDef.apiName}\" is not a valid ISO 8601 datetime string`,\n );\n }\n invariant(\n !isExotic(objectDef.properties?.[objectDef.titlePropertyApiName]?.type),\n `Title property ${objectDef.titlePropertyApiName} must be a primitive type`,\n );\n invariant(\n !isExotic(\n objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.type,\n ),\n `Primary key property ${objectDef.primaryKeyPropertyApiName} can only be primitive types`,\n );\n\n objectDef.implementsInterfaces?.forEach(interfaceImpl => {\n const allInterfaceProperties = getFlattenedInterfaceProperties(\n interfaceImpl.implements,\n );\n const nonExistentInterfaceProperties: ValidationResult[] = interfaceImpl\n .propertyMapping.map(val => val.interfaceProperty).filter(\n interfaceProperty =>\n allInterfaceProperties[addNamespaceIfNone(interfaceProperty)]\n === undefined,\n ).map(interfaceProp => ({\n type: \"invalid\",\n reason:\n `Interface property ${interfaceProp} referenced in ${objectDef.apiName} object does not exist`,\n }));\n\n const interfaceToObjectProperties = Object.fromEntries(\n interfaceImpl.propertyMapping.map(\n mapping => [\n addNamespaceIfNone(mapping.interfaceProperty),\n mapping.mapsTo,\n ],\n ),\n );\n const validateProperty = (\n interfaceProp: [string, InterfacePropertyType],\n ): ValidationResult => {\n if (\n interfaceProp[1].sharedPropertyType.apiName\n in interfaceToObjectProperties\n ) {\n return validateInterfaceImplProperty(\n interfaceProp[1].sharedPropertyType,\n interfaceToObjectProperties[interfaceProp[0]],\n objectDef,\n );\n }\n return {\n type: \"invalid\",\n reason: `Interface property ${\n interfaceProp[1].sharedPropertyType.apiName\n } not implemented by ${objectDef.apiName} object definition`,\n };\n };\n const validations = Object.entries(\n getFlattenedInterfaceProperties(interfaceImpl.implements),\n ).map(validateProperty);\n const allFailedValidations = validations.concat(\n nonExistentInterfaceProperties,\n ).filter(val => val.type === \"invalid\");\n invariant(\n allFailedValidations.length === 0,\n \"\\n\" + allFailedValidations.map(formatValidationErrors).join(\"\\n\"),\n );\n });\n\n const flattenedProperties: Array<ObjectPropertyType> = Object.entries(\n objectDef.properties ?? {},\n ).map(([apiName, property]) =>\n convertUserObjectPropertyType(property.apiName ?? apiName, property)\n );\n\n const finalObject: ObjectType = {\n ...objectDef,\n apiName: apiName,\n __type: OntologyEntityTypeEnum.OBJECT_TYPE,\n properties: flattenedProperties,\n };\n updateOntology(finalObject);\n objectDef.apiName = apiName;\n return objectDef;\n}\n\ntype ValidationResult = { type: \"valid\" } | { type: \"invalid\"; reason: string };\n\nfunction formatValidationErrors(\n error: { type: \"invalid\"; reason: string },\n): string {\n return `Ontology Definition Error: ${error.reason}\\n`;\n}\n\n// Validate that the object and the interface property match up\nfunction validateInterfaceImplProperty(\n spt: SharedPropertyType,\n mappedObjectProp: string,\n object: ObjectTypeDefinition,\n): ValidationResult {\n const objProp = object.properties?.[mappedObjectProp];\n if (objProp === undefined) {\n return {\n type: \"invalid\",\n reason:\n `Object property mapped to interface does not exist. Object Property Mapped: ${mappedObjectProp}`,\n };\n }\n if (JSON.stringify(spt.type) !== JSON.stringify(objProp?.type)) {\n return {\n type: \"invalid\",\n reason:\n `Object property type does not match the interface property it is mapped to. Interface Property: ${spt.apiName}, objectProperty: ${mappedObjectProp}`,\n };\n }\n\n return { type: \"valid\" };\n}\n\nexport function uppercaseFirstLetter(s: string | undefined | null): string {\n return s === undefined || s == null\n ? \"\"\n : s.charAt(0).toUpperCase() + s.slice(1);\n}\n\n// TODO: edge cases\nexport function convertToPluralDisplayName(\n s: string | undefined | null,\n): string {\n return s === undefined || s == null\n ? \"\"\n : s.endsWith(\"s\")\n ? uppercaseFirstLetter(s)\n : uppercaseFirstLetter(s) + \"s\";\n}\n\nfunction convertUserObjectPropertyType(\n apiName: string,\n property: ObjectPropertyTypeUserDefinition,\n): ObjectPropertyType {\n // fill in missing fields to be used by actions\n property.apiName = apiName;\n property.displayName = property.displayName ?? uppercaseFirstLetter(apiName);\n return {\n ...property,\n apiName: apiName,\n displayName: property.displayName ?? uppercaseFirstLetter(apiName),\n type: property.type,\n };\n}\nfunction validateDerivedDatasource(\n objectDef: ObjectTypeDefinition,\n datasource: ObjectTypeDatasourceDefinition_derived,\n) {\n // there should be at least one link\n invariant(\n datasource.linkDefinition.length > 0,\n `Derived datasource for object '${objectDef.apiName}' must have at least one link.`,\n );\n\n // all of the links references should exist\n datasource.linkDefinition.forEach(link => {\n const linkApiName = link.linkType.apiName;\n invariant(\n ontologyDefinition[OntologyEntityTypeEnum.LINK_TYPE][linkApiName]\n !== undefined\n || importedTypes[OntologyEntityTypeEnum.LINK_TYPE][linkApiName]\n !== undefined,\n `Link type '${linkApiName}' used in derived datasource for object '${objectDef.apiName}' is not defined.`,\n );\n });\n\n // all of the properties references on the source object should exist\n Object.keys(datasource.propertyMapping).forEach(prop => {\n invariant(\n objectDef.properties?.[prop] !== undefined,\n `Property '${prop}' used in derived datasource for object '${objectDef.apiName}' is not defined.`,\n );\n });\n\n const isLinkedProperties =\n (typeof Object.values(datasource.propertyMapping)[0]) === \"string\";\n if (isLinkedProperties) {\n validateLinkedProperties(datasource, objectDef);\n } else {\n validateAggregations(datasource, objectDef);\n }\n}\n\nfunction validateLinkedProperties(\n datasource: ObjectTypeDatasourceDefinition_derived,\n objectDef: ObjectTypeDefinition,\n) {\n const foreignProperties = Object.values(\n datasource.propertyMapping,\n ) as string[];\n // the foreign property must exist in the final object in the link chain\n const finalObject =\n getObject(datasource.linkDefinition.at(-1)!.linkType.toMany.object).object;\n foreignProperties.forEach(prop => {\n invariant(\n finalObject.properties?.find(p => p.apiName === prop) !== undefined,\n `Property '${prop}' on object '${finalObject.apiName}' is not defined`,\n );\n });\n}\n\nfunction validateAggregations(\n datasource: ObjectTypeDatasourceDefinition_derived,\n objectDef: ObjectTypeDefinition,\n) {\n const props = datasource.propertyMapping as Record<\n string,\n DerivedPropertyAggregation\n >;\n\n Object.entries(props).forEach(([propName, agg]) => {\n // TODO(dpaquin): check that the property type matches the foreign property type,\n // for collectList/collectSet and maybe min/max too?\n const property = objectDef.properties![propName];\n switch (agg.type) {\n case \"collectList\":\n case \"collectSet\":\n // property's type is collectible\n invariant(\n isCollectible(property),\n `Property '${propName}' on object '${objectDef.apiName}' is not collectible`,\n );\n // limit <= 100\n invariant(\n agg.limit <= 100,\n `[Error] Limit for collection '${propName}' on object '${objectDef.apiName}' is greater than 100`,\n );\n break;\n case \"avg\":\n case \"sum\":\n // property's type is numeric\n invariant(\n isNumeric(property.type),\n `Property '${propName}' on object '${objectDef.apiName}' is not numeric`,\n );\n break;\n case \"min\":\n case \"max\":\n case \"approximateCardinality\":\n case \"exactCardinality\":\n // property's type is primitive\n invariant(\n isPrimitive(property.type),\n `Property '${propName}' on object '${objectDef.apiName}' is not primitive`,\n );\n break;\n default:\n break;\n }\n\n // if a foreign property is referenced, it must exist in the final object\n if (agg.type !== \"count\") {\n const foreignProperty = agg.property;\n const finalObject =\n getObject(datasource.linkDefinition.at(-1)!.linkType.toMany.object)\n .object;\n invariant(\n finalObject.properties?.find(p => p.apiName === foreignProperty)\n !== undefined,\n `Property '${foreignProperty}' on object '${finalObject.apiName}' is not defined`,\n );\n }\n });\n}\n\nfunction isCollectible(property: ObjectPropertyTypeUserDefinition): boolean {\n if (!(property.array ?? false)) {\n return false;\n }\n const typeType = typeof property.type === \"string\"\n ? property.type\n : property.type.type;\n return [\n \"boolean\",\n \"byte\",\n \"date\",\n \"double\",\n \"float\",\n \"geohash\",\n \"geoshape\",\n \"integer\",\n \"long\",\n \"mediareference\",\n \"short\",\n \"string\",\n \"struct\",\n \"timestamp\",\n ].includes(typeType);\n}\n\nfunction isNumeric(type: PropertyTypeType): boolean {\n const typeType = typeof type === \"string\" ? type : type.type;\n return [\n \"byte\",\n \"double\",\n \"float\",\n \"integer\",\n \"long\",\n \"short\",\n ].includes(typeType);\n}\n\nfunction isPrimitive(type: PropertyTypeType): boolean {\n const typeType = typeof type === \"string\" ? type : type.type;\n return [\n \"boolean\",\n \"byte\",\n \"date\",\n \"double\",\n \"float\",\n \"integer\",\n \"long\",\n \"short\",\n \"string\",\n \"timestamp\",\n ].includes(typeType);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,SAAS,QAAQ,4CAA4C;AACtE,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SACEC,kBAAkB,EAClBC,aAAa,EACbC,SAAS,EACTC,kBAAkB,EAClBC,cAAc,QACT,qBAAqB;AAC5B,SAASC,+BAA+B,QAAQ,gDAAgD;AAYhG,SAASC,QAAQ,QAAQ,kCAAkC;AAG3D;AACA,MAAMC,iBAAiB,GACrB,+OAA+O;;AAEjP;AACA,MAAMC,iBAAiB,GACrB,sEAAsE;AAExE,MAAMC,gBAAgB,GAAG,6BAA6B;AAEtD,OAAO,SAASC,YAAYA,CAC1BC,SAA+B,EACT;EACtB,MAAMC,OAAO,GAAGV,SAAS,GAAGS,SAAS,CAACC,OAAO;EAC7C,MAAMC,gBAAgB,GAAGF,SAAS,CAACG,UAAU,GACzCC,MAAM,CAACC,IAAI,CAACL,SAAS,CAACG,UAAU,CAAC,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CAACmE,KAAK,IAAI,KAAK,CAAC,EAAE;IAC9B,OAAO,KAAK;EACd;EACA,MAAMC,QAAQ,GAAG,OAAOpE,QAAQ,CAACZ,IAAI,KAAK,QAAQ,GAC9CY,QAAQ,CAACZ,IAAI,GACbY,QAAQ,CAACZ,IAAI,CAACA,IAAI;EACtB,OAAO,CACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,SAAS,EACT,UAAU,EACV,SAAS,EACT,MAAM,EACN,gBAAgB,EAChB,OAAO,EACP,QAAQ,EACR,QAAQ,EACR,WAAW,CACZ,CAACR,QAAQ,CAACwF,QAAQ,CAAC;AACtB;AAEA,SAASJ,SAASA,CAAC5E,IAAsB,EAAW;EAClD,MAAMgF,QAAQ,GAAG,OAAOhF,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGA,IAAI,CAACA,IAAI;EAC5D,OAAO,CACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,OAAO,CACR,CAACR,QAAQ,CAACwF,QAAQ,CAAC;AACtB;AAEA,SAASH,WAAWA,CAAC7E,IAAsB,EAAW;EACpD,MAAMgF,QAAQ,GAAG,OAAOhF,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGA,IAAI,CAACA,IAAI;EAC5D,OAAO,CACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,OAAO,EACP,QAAQ,EACR,WAAW,CACZ,CAACR,QAAQ,CAACwF,QAAQ,CAAC;AACtB","ignoreList":[]}
1
+ {"version":3,"file":"defineObject.js","names":["invariant","getObject","OntologyEntityTypeEnum","addNamespaceIfNone","importedTypes","namespace","ontologyDefinition","updateOntology","getFlattenedInterfaceProperties","isExotic","ISO_8601_DURATION","ISO_8601_DATETIME","API_NAME_PATTERN","defineObject","objectDef","apiName","propertyApiNames","properties","Object","keys","OBJECT_TYPE","undefined","Error","test","process","env","NODE_ENV","includes","titlePropertyApiName","primaryKeyPropertyApiName","editOnly","retentionPeriods","datasources","filter","ds","type","map","retentionPeriod","forEach","baseDatasources","length","join","derivedDatasources","validateDerivedDatasource","status","activeProperties","entries","property","push","deadline","implementsInterfaces","interfaceImpl","allInterfaceProperties","implements","nonExistentInterfaceProperties","propertyMapping","val","interfaceProperty","interfaceProp","reason","interfaceToObjectProperties","fromEntries","mapping","mapsTo","validateProperty","sharedPropertyType","validateInterfaceImplProperty","validations","allFailedValidations","concat","formatValidationErrors","flattenedProperties","convertUserObjectPropertyType","finalObject","__type","error","spt","mappedObjectProp","object","objProp","JSON","stringify","uppercaseFirstLetter","s","charAt","toUpperCase","slice","convertToPluralDisplayName","endsWith","displayName","datasource","linkDefinition","link","linkApiName","linkType","LINK_TYPE","prop","isLinkedProperties","values","validateLinkedProperties","validateAggregations","foreignProperties","at","toMany","find","p","props","propName","agg","isCollectible","limit","isNumeric","isPrimitive","foreignProperty","array","typeType"],"sources":["defineObject.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport invariant from \"tiny-invariant\";\nimport { getObject } from \"../conversion/toMarketplace/convertLink.js\";\nimport { OntologyEntityTypeEnum } from \"./common/OntologyEntityTypeEnum.js\";\nimport {\n addNamespaceIfNone,\n importedTypes,\n namespace,\n ontologyDefinition,\n updateOntology,\n} from \"./defineOntology.js\";\nimport { getFlattenedInterfaceProperties } from \"./interface/getFlattenedInterfaceProperties.js\";\nimport type { InterfacePropertyType } from \"./interface/InterfacePropertyType.js\";\nimport type { ObjectPropertyType } from \"./object/ObjectPropertyType.js\";\nimport type { ObjectPropertyTypeUserDefinition } from \"./object/ObjectPropertyTypeUserDefinition.js\";\nimport type { ObjectType } from \"./object/ObjectType.js\";\nimport type {\n DerivedPropertyAggregation,\n ObjectTypeDatasourceDefinition_derived,\n ObjectTypeDatasourceDefinition_stream,\n} from \"./object/ObjectTypeDatasourceDefinition.js\";\nimport type { ObjectTypeDefinition } from \"./object/ObjectTypeDefinition.js\";\nimport type { PropertyTypeType } from \"./properties/PropertyTypeType.js\";\nimport { isExotic } from \"./properties/PropertyTypeType.js\";\nimport type { SharedPropertyType } from \"./properties/SharedPropertyType.js\";\n\n// From https://stackoverflow.com/a/79288714\nconst ISO_8601_DURATION =\n /^P(?!$)(?:(?:((?:\\d+Y)|(?:\\d+(?:\\.|,)\\d+Y$))?((?:\\d+M)|(?:\\d+(?:\\.|,)\\d+M$))?((?:\\d+D)|(?:\\d+(?:\\.|,)\\d+D$))?(T((?:\\d+H)|(?:\\d+(?:\\.|,)\\d+H$))?((?:\\d+M)|(?:\\d+(?:\\.|,)\\d+M$))?((?:\\d+S)|(?:\\d+(?:\\.|,)\\d+S$))?)?)|(?:\\d+(?:(?:\\.|,)\\d+)?W))$/;\n\n// ISO 8601 date and time format (YYYY-MM-DDThh:mm:ss.sssZ)\nconst ISO_8601_DATETIME =\n /^\\d{4}-\\d{2}-\\d{2}(T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})?)?$/;\n\nconst API_NAME_PATTERN = /^([a-zA-Z][a-zA-Z0-9\\\\-]*)$/;\n\nexport function defineObject(\n objectDef: ObjectTypeDefinition,\n): ObjectTypeDefinition {\n const apiName = namespace + objectDef.apiName;\n const propertyApiNames = objectDef.properties\n ? Object.keys(objectDef.properties)\n : [];\n if (\n ontologyDefinition[OntologyEntityTypeEnum.OBJECT_TYPE][apiName]\n !== undefined\n ) {\n throw new Error(\n `Object type with apiName ${objectDef.apiName} is already defined`,\n );\n }\n invariant(\n API_NAME_PATTERN.test(objectDef.apiName),\n `Invalid API name ${objectDef.apiName}. API names must match the regex ${API_NAME_PATTERN}.`,\n );\n invariant(\n propertyApiNames.includes(objectDef.titlePropertyApiName),\n `Title property ${objectDef.titlePropertyApiName} is not defined on object ${objectDef.apiName}`,\n );\n invariant(\n propertyApiNames.includes(objectDef.primaryKeyPropertyApiName),\n `Primary key property ${objectDef.primaryKeyPropertyApiName} does not exist on object ${objectDef.apiName}`,\n );\n\n invariant(\n !(objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.editOnly),\n `Primary key property ${objectDef.primaryKeyPropertyApiName} on object ${objectDef.apiName} cannot be edit-only`,\n );\n\n const retentionPeriods =\n ((objectDef.datasources ?? []).filter(ds =>\n ds.type === \"stream\"\n ) as ObjectTypeDatasourceDefinition_stream[]).map(ds => ds.retentionPeriod);\n retentionPeriods.forEach(retentionPeriod => {\n invariant(\n retentionPeriod === undefined || ISO_8601_DURATION.test(retentionPeriod),\n `Retention period \"${retentionPeriod}\" on object \"${objectDef.apiName}\" is not a valid ISO 8601 duration string`,\n );\n });\n\n const baseDatasources = (objectDef.datasources ?? []).filter(ds =>\n [\"dataset\", \"stream\", \"restrictedView\"].includes(ds.type)\n );\n invariant(\n baseDatasources.length <= 1,\n `Object ${objectDef.apiName} has more than one base datasource (got: [${\n baseDatasources.map(ds => ds.type).join(\", \")\n }])`,\n );\n const derivedDatasources = (objectDef.datasources ?? []).filter(ds =>\n ds.type === \"derived\"\n );\n if (derivedDatasources.length > 0) {\n derivedDatasources.forEach(ds => validateDerivedDatasource(objectDef, ds));\n }\n\n // Validate that if object status is experimental, no property can have a status of active\n if (objectDef.status === \"experimental\") {\n const activeProperties: string[] = [];\n Object.entries(objectDef.properties ?? {}).forEach(\n ([apiName, property]) => {\n if (property.status === \"active\") {\n activeProperties.push(apiName);\n }\n },\n );\n invariant(\n activeProperties.length === 0,\n `When object \"${objectDef.apiName}\" has experimental status, no properties can have \"active\" status, but found active properties: ${\n activeProperties.join(\", \")\n }`,\n );\n }\n\n // Validate deprecated status deadline is in ISO 8601 format\n if (\n objectDef.status && typeof objectDef.status === \"object\"\n && objectDef.status.type === \"deprecated\"\n ) {\n const deadline = objectDef.status.deadline;\n invariant(\n deadline !== undefined && ISO_8601_DATETIME.test(deadline),\n `Deprecated status deadline \"${deadline}\" on object \"${objectDef.apiName}\" is not a valid ISO 8601 datetime string`,\n );\n }\n invariant(\n !isExotic(objectDef.properties?.[objectDef.titlePropertyApiName]?.type),\n `Title property ${objectDef.titlePropertyApiName} must be a primitive type`,\n );\n invariant(\n !isExotic(\n objectDef.properties?.[objectDef.primaryKeyPropertyApiName]?.type,\n ),\n `Primary key property ${objectDef.primaryKeyPropertyApiName} can only be primitive types`,\n );\n\n objectDef.implementsInterfaces?.forEach(interfaceImpl => {\n const allInterfaceProperties = getFlattenedInterfaceProperties(\n interfaceImpl.implements,\n );\n const nonExistentInterfaceProperties: ValidationResult[] = interfaceImpl\n .propertyMapping.map(val => val.interfaceProperty).filter(\n interfaceProperty =>\n allInterfaceProperties[addNamespaceIfNone(interfaceProperty)]\n === undefined,\n ).map(interfaceProp => ({\n type: \"invalid\",\n reason:\n `Interface property ${interfaceProp} referenced in ${objectDef.apiName} object does not exist`,\n }));\n\n const interfaceToObjectProperties = Object.fromEntries(\n interfaceImpl.propertyMapping.map(\n mapping => [\n addNamespaceIfNone(mapping.interfaceProperty),\n mapping.mapsTo,\n ],\n ),\n );\n const validateProperty = (\n interfaceProp: [string, InterfacePropertyType],\n ): ValidationResult => {\n if (\n interfaceProp[1].sharedPropertyType.apiName\n in interfaceToObjectProperties\n ) {\n return validateInterfaceImplProperty(\n interfaceProp[1].sharedPropertyType,\n interfaceToObjectProperties[interfaceProp[0]],\n objectDef,\n );\n }\n return {\n type: \"invalid\",\n reason: `Interface property ${\n interfaceProp[1].sharedPropertyType.apiName\n } not implemented by ${objectDef.apiName} object definition`,\n };\n };\n const validations = Object.entries(\n getFlattenedInterfaceProperties(interfaceImpl.implements),\n ).map(validateProperty);\n const allFailedValidations = validations.concat(\n nonExistentInterfaceProperties,\n ).filter(val => val.type === \"invalid\");\n invariant(\n allFailedValidations.length === 0,\n \"\\n\" + allFailedValidations.map(formatValidationErrors).join(\"\\n\"),\n );\n });\n\n const flattenedProperties: Array<ObjectPropertyType> = Object.entries(\n objectDef.properties ?? {},\n ).map(([apiName, property]) =>\n convertUserObjectPropertyType(apiName, property)\n );\n\n const finalObject: ObjectType = {\n ...objectDef,\n apiName: apiName,\n __type: OntologyEntityTypeEnum.OBJECT_TYPE,\n properties: flattenedProperties,\n };\n updateOntology(finalObject);\n objectDef.apiName = apiName;\n return objectDef;\n}\n\ntype ValidationResult = { type: \"valid\" } | { type: \"invalid\"; reason: string };\n\nfunction formatValidationErrors(\n error: { type: \"invalid\"; reason: string },\n): string {\n return `Ontology Definition Error: ${error.reason}\\n`;\n}\n\n// Validate that the object and the interface property match up\nfunction validateInterfaceImplProperty(\n spt: SharedPropertyType,\n mappedObjectProp: string,\n object: ObjectTypeDefinition,\n): ValidationResult {\n const objProp = object.properties?.[mappedObjectProp];\n if (objProp === undefined) {\n return {\n type: \"invalid\",\n reason:\n `Object property mapped to interface does not exist. Object Property Mapped: ${mappedObjectProp}`,\n };\n }\n if (JSON.stringify(spt.type) !== JSON.stringify(objProp?.type)) {\n return {\n type: \"invalid\",\n reason:\n `Object property type does not match the interface property it is mapped to. Interface Property: ${spt.apiName}, objectProperty: ${mappedObjectProp}`,\n };\n }\n\n return { type: \"valid\" };\n}\n\nexport function uppercaseFirstLetter(s: string | undefined | null): string {\n return s === undefined || s == null\n ? \"\"\n : s.charAt(0).toUpperCase() + s.slice(1);\n}\n\n// TODO: edge cases\nexport function convertToPluralDisplayName(\n s: string | undefined | null,\n): string {\n return s === undefined || s == null\n ? \"\"\n : s.endsWith(\"s\")\n ? uppercaseFirstLetter(s)\n : uppercaseFirstLetter(s) + \"s\";\n}\n\nfunction convertUserObjectPropertyType(\n apiName: string,\n property: ObjectPropertyTypeUserDefinition,\n): ObjectPropertyType {\n // fill in missing fields to be used by actions\n property.displayName = property.displayName ?? uppercaseFirstLetter(apiName);\n return {\n ...property,\n apiName: apiName,\n displayName: property.displayName ?? uppercaseFirstLetter(apiName),\n type: property.type,\n };\n}\nfunction validateDerivedDatasource(\n objectDef: ObjectTypeDefinition,\n datasource: ObjectTypeDatasourceDefinition_derived,\n) {\n // there should be at least one link\n invariant(\n datasource.linkDefinition.length > 0,\n `Derived datasource for object '${objectDef.apiName}' must have at least one link.`,\n );\n\n // all of the links references should exist\n datasource.linkDefinition.forEach(link => {\n const linkApiName = link.linkType.apiName;\n invariant(\n ontologyDefinition[OntologyEntityTypeEnum.LINK_TYPE][linkApiName]\n !== undefined\n || importedTypes[OntologyEntityTypeEnum.LINK_TYPE][linkApiName]\n !== undefined,\n `Link type '${linkApiName}' used in derived datasource for object '${objectDef.apiName}' is not defined.`,\n );\n });\n\n // all of the properties references on the source object should exist\n Object.keys(datasource.propertyMapping).forEach(prop => {\n invariant(\n objectDef.properties?.[prop] !== undefined,\n `Property '${prop}' used in derived datasource for object '${objectDef.apiName}' is not defined.`,\n );\n });\n\n const isLinkedProperties =\n (typeof Object.values(datasource.propertyMapping)[0]) === \"string\";\n if (isLinkedProperties) {\n validateLinkedProperties(datasource, objectDef);\n } else {\n validateAggregations(datasource, objectDef);\n }\n}\n\nfunction validateLinkedProperties(\n datasource: ObjectTypeDatasourceDefinition_derived,\n objectDef: ObjectTypeDefinition,\n) {\n const foreignProperties = Object.values(\n datasource.propertyMapping,\n ) as string[];\n // the foreign property must exist in the final object in the link chain\n const finalObject =\n getObject(datasource.linkDefinition.at(-1)!.linkType.toMany.object).object;\n foreignProperties.forEach(prop => {\n invariant(\n finalObject.properties?.find(p => p.apiName === prop) !== undefined,\n `Property '${prop}' on object '${finalObject.apiName}' is not defined`,\n );\n });\n}\n\nfunction validateAggregations(\n datasource: ObjectTypeDatasourceDefinition_derived,\n objectDef: ObjectTypeDefinition,\n) {\n const props = datasource.propertyMapping as Record<\n string,\n DerivedPropertyAggregation\n >;\n\n Object.entries(props).forEach(([propName, agg]) => {\n // TODO(dpaquin): check that the property type matches the foreign property type,\n // for collectList/collectSet and maybe min/max too?\n const property = objectDef.properties![propName];\n switch (agg.type) {\n case \"collectList\":\n case \"collectSet\":\n // property's type is collectible\n invariant(\n isCollectible(property),\n `Property '${propName}' on object '${objectDef.apiName}' is not collectible`,\n );\n // limit <= 100\n invariant(\n agg.limit <= 100,\n `[Error] Limit for collection '${propName}' on object '${objectDef.apiName}' is greater than 100`,\n );\n break;\n case \"avg\":\n case \"sum\":\n // property's type is numeric\n invariant(\n isNumeric(property.type),\n `Property '${propName}' on object '${objectDef.apiName}' is not numeric`,\n );\n break;\n case \"min\":\n case \"max\":\n case \"approximateCardinality\":\n case \"exactCardinality\":\n // property's type is primitive\n invariant(\n isPrimitive(property.type),\n `Property '${propName}' on object '${objectDef.apiName}' is not primitive`,\n );\n break;\n default:\n break;\n }\n\n // if a foreign property is referenced, it must exist in the final object\n if (agg.type !== \"count\") {\n const foreignProperty = agg.property;\n const finalObject =\n getObject(datasource.linkDefinition.at(-1)!.linkType.toMany.object)\n .object;\n invariant(\n finalObject.properties?.find(p => p.apiName === foreignProperty)\n !== undefined,\n `Property '${foreignProperty}' on object '${finalObject.apiName}' is not defined`,\n );\n }\n });\n}\n\nfunction isCollectible(property: ObjectPropertyTypeUserDefinition): boolean {\n if (!(property.array ?? false)) {\n return false;\n }\n const typeType = typeof property.type === \"string\"\n ? property.type\n : property.type.type;\n return [\n \"boolean\",\n \"byte\",\n \"date\",\n \"double\",\n \"float\",\n \"geohash\",\n \"geoshape\",\n \"integer\",\n \"long\",\n \"mediareference\",\n \"short\",\n \"string\",\n \"struct\",\n \"timestamp\",\n ].includes(typeType);\n}\n\nfunction isNumeric(type: PropertyTypeType): boolean {\n const typeType = typeof type === \"string\" ? type : type.type;\n return [\n \"byte\",\n \"double\",\n \"float\",\n \"integer\",\n \"long\",\n \"short\",\n ].includes(typeType);\n}\n\nfunction isPrimitive(type: PropertyTypeType): boolean {\n const typeType = typeof type === \"string\" ? type : type.type;\n return [\n \"boolean\",\n \"byte\",\n \"date\",\n \"double\",\n \"float\",\n \"integer\",\n \"long\",\n \"short\",\n \"string\",\n \"timestamp\",\n ].includes(typeType);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,SAAS,QAAQ,4CAA4C;AACtE,SAASC,sBAAsB,QAAQ,oCAAoC;AAC3E,SACEC,kBAAkB,EAClBC,aAAa,EACbC,SAAS,EACTC,kBAAkB,EAClBC,cAAc,QACT,qBAAqB;AAC5B,SAASC,+BAA+B,QAAQ,gDAAgD;AAYhG,SAASC,QAAQ,QAAQ,kCAAkC;AAG3D;AACA,MAAMC,iBAAiB,GACrB,+OAA+O;;AAEjP;AACA,MAAMC,iBAAiB,GACrB,sEAAsE;AAExE,MAAMC,gBAAgB,GAAG,6BAA6B;AAEtD,OAAO,SAASC,YAAYA,CAC1BC,SAA+B,EACT;EACtB,MAAMC,OAAO,GAAGV,SAAS,GAAGS,SAAS,CAACC,OAAO;EAC7C,MAAMC,gBAAgB,GAAGF,SAAS,CAACG,UAAU,GACzCC,MAAM,CAACC,IAAI,CAACL,SAAS,CAACG,UAAU,CAAC,GACjC,EAAE;EACN,IACEX,kBAAkB,CAACJ,sBAAsB,CAACkB,WAAW,CAAC,CAACL,OAAO,CAAC,KACzDM,SAAS,EACf;IACA,MAAM,IAAIC,KAAK,CACb,4BAA4BR,SAAS,CAACC,OAAO,qBAC/C,CAAC;EACH;EACA,CACEH,gBAAgB,CAACW,IAAI,CAACT,SAAS,CAACC,OAAO,CAAC,GAAAS,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAD1C1B,SAAS,QAEP,oBAAoBc,SAAS,CAACC,OAAO,oCAAoCH,gBAAgB,GAAG,IAF9F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,CAAC5E,IAAsB,EAAW;EAClD,MAAMgF,QAAQ,GAAG,OAAOhF,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGA,IAAI,CAACA,IAAI;EAC5D,OAAO,CACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,OAAO,CACR,CAACR,QAAQ,CAACwF,QAAQ,CAAC;AACtB;AAEA,SAASH,WAAWA,CAAC7E,IAAsB,EAAW;EACpD,MAAMgF,QAAQ,GAAG,OAAOhF,IAAI,KAAK,QAAQ,GAAGA,IAAI,GAAGA,IAAI,CAACA,IAAI;EAC5D,OAAO,CACL,SAAS,EACT,MAAM,EACN,MAAM,EACN,QAAQ,EACR,OAAO,EACP,SAAS,EACT,MAAM,EACN,OAAO,EACP,QAAQ,EACR,WAAW,CACZ,CAACR,QAAQ,CAACwF,QAAQ,CAAC;AACtB","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"ObjectPropertyTypeUserDefinition.js","names":[],"sources":["ObjectPropertyTypeUserDefinition.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { RequiredFields } from \"../../util/RequiredFields.js\";\nimport type { ObjectPropertyTypeInner } from \"./ObjectPropertyType.js\";\n\nexport type ObjectPropertyTypeUserDefinition = RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"type\"\n>;\n"],"mappings":"","ignoreList":[]}
1
+ {"version":3,"file":"ObjectPropertyTypeUserDefinition.js","names":[],"sources":["ObjectPropertyTypeUserDefinition.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { RequiredFields } from \"../../util/RequiredFields.js\";\nimport type { ObjectPropertyTypeInner } from \"./ObjectPropertyType.js\";\n\nexport type ObjectPropertyTypeUserDefinition = Omit<\n RequiredFields<\n Partial<ObjectPropertyTypeInner>,\n \"type\"\n >,\n \"apiName\"\n>;\n"],"mappings":"","ignoreList":[]}
@@ -393,8 +393,8 @@ describe("Miscellaneous Tests", () => {
393
393
  "properties": [
394
394
  {
395
395
  "type": "string",
396
- "apiName": "bar",
397
- "displayName": "Bar"
396
+ "displayName": "Bar",
397
+ "apiName": "bar"
398
398
  }
399
399
  ],
400
400
  "implementsInterfaces": [
@@ -1 +1 @@
1
- {"version":3,"file":"misc.test.js","names":["fs","path","fileURLToPath","beforeEach","describe","expect","it","addDependency","OntologyEntityTypeEnum","defineInterface","defineObject","defineOntology","dumpOntologyFullMetadata","defineSharedPropertyType","importOntologyEntity","importSharedPropertyType","id","apiName","packageName","typeHint","properties","toMatchInlineSnapshot","spt","nonNameSpacedApiName","type","__type","SHARED_PROPERTY_TYPE","generatedDir","resolve","join","__dirname","mySpt","myInterface","titlePropertyApiName","displayName","pluralDisplayName","primaryKeyPropertyApiName","implementsInterfaces","implements","propertyMapping","interfaceProperty","mapsTo","readFileSync","rmSync","recursive","force","parentInterface","property1","property2","extends","iProperty1","childInterface","iProperty2","import","meta","url","packageJson","JSON","parse","version","toBeDefined","toContain"],"sources":["misc.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"fs\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { beforeEach, describe, expect, it } from \"vitest\";\nimport { addDependency } from \"../addDependency.js\";\nimport { OntologyEntityTypeEnum } from \"../common/OntologyEntityTypeEnum.js\";\nimport { defineInterface } from \"../defineInterface.js\";\nimport { defineObject } from \"../defineObject.js\";\nimport { defineOntology, dumpOntologyFullMetadata } from \"../defineOntology.js\";\nimport { defineSharedPropertyType } from \"../defineSpt.js\";\nimport { importOntologyEntity } from \"../importOntologyEntity.js\";\nimport { importSharedPropertyType } from \"../importSharedPropertyType.js\";\nimport { type SharedPropertyType } from \"../properties/SharedPropertyType.js\";\n\ndescribe(\"Miscellaneous Tests\", () => {\n beforeEach(async () => {\n await defineOntology(\"com.palantir.\", () => {}, \"/tmp/\");\n });\n\n describe(\"Imports\", () => {\n it(\"Legacy importing works\", () => {\n const id = importSharedPropertyType({\n apiName: \"id\",\n packageName: \"com.palantir.core.ontology.types\",\n typeHint: \"string\",\n });\n const myInterface = defineInterface({\n apiName: \"myInterface\",\n properties: {\n id,\n },\n });\n expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`\n {\n \"importedOntology\": {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {\n \"com.palantir.core.ontology.types.id\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.core.ontology.types.id\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"com.palantir.core.ontology.types.id\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [],\n \"valueType\": undefined,\n },\n },\n },\n },\n \"importedValueTypes\": {\n \"valueTypes\": [],\n },\n \"ontology\": {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {\n \"com.palantir.myInterface\": {\n \"interfaceType\": {\n \"apiName\": \"com.palantir.myInterface\",\n \"displayMetadata\": {\n \"description\": \"myInterface\",\n \"displayName\": \"myInterface\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#4C90F0\",\n \"locator\": \"layout-hierarchy\",\n },\n \"type\": \"blueprint\",\n },\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"properties\": [],\n \"propertiesV2\": {\n \"com.palantir.core.ontology.types.id\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.core.ontology.types.id\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"com.palantir.core.ontology.types.id\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [],\n \"valueType\": undefined,\n },\n },\n },\n \"propertiesV3\": {},\n \"searchable\": true,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n },\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {},\n },\n \"randomnessKey\": undefined,\n \"valueTypes\": {\n \"valueTypes\": [],\n },\n }\n `);\n });\n it(\"Simple importing works\", () => {\n // does the same as \"import { spt } from '@other/package'\"\n const spt: SharedPropertyType = {\n apiName: \"com.other.package.spt\",\n nonNameSpacedApiName: \"spt\",\n type: \"string\",\n __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE,\n };\n importOntologyEntity(spt);\n\n const myInterface = defineInterface({\n apiName: \"myInterface\",\n properties: {\n spt,\n },\n });\n expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`\n {\n \"importedOntology\": {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {\n \"com.other.package.spt\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.other.package.spt\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"com.other.package.spt\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [],\n \"valueType\": undefined,\n },\n },\n },\n },\n \"importedValueTypes\": {\n \"valueTypes\": [],\n },\n \"ontology\": {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {\n \"com.palantir.myInterface\": {\n \"interfaceType\": {\n \"apiName\": \"com.palantir.myInterface\",\n \"displayMetadata\": {\n \"description\": \"myInterface\",\n \"displayName\": \"myInterface\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#4C90F0\",\n \"locator\": \"layout-hierarchy\",\n },\n \"type\": \"blueprint\",\n },\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"properties\": [],\n \"propertiesV2\": {\n \"com.other.package.spt\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.other.package.spt\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"com.other.package.spt\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [],\n \"valueType\": undefined,\n },\n },\n },\n \"propertiesV3\": {},\n \"searchable\": true,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n },\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {},\n },\n \"randomnessKey\": undefined,\n \"valueTypes\": {\n \"valueTypes\": [],\n },\n }\n `);\n });\n it(\"Export files are generated correctly\", async () => {\n const generatedDir = path.resolve(path.join(\n __dirname,\n \"..\",\n \"generatedNoCheck\",\n \"export_files_are_generated_correctly\",\n ));\n await defineOntology(\"com.my.package.\", () => {\n const mySpt = defineSharedPropertyType({\n apiName: \"mySpt\",\n type: \"string\",\n });\n const myInterface = defineInterface({\n apiName: \"myInterface\",\n properties: {\n mySpt,\n },\n });\n const myObject = defineObject({\n titlePropertyApiName: \"bar\",\n displayName: \"My Object\",\n pluralDisplayName: \"myObjects\",\n apiName: \"myObject\",\n primaryKeyPropertyApiName: \"bar\",\n properties: { \"bar\": { type: \"string\" } },\n implementsInterfaces: [{\n implements: myInterface,\n propertyMapping: [{\n interfaceProperty: \"com.my.package.mySpt\",\n mapsTo: \"bar\",\n }],\n }],\n });\n }, generatedDir);\n\n expect(\n fs.readFileSync(\n path.join(generatedDir, \"codegen/interface-types/myInterface.ts\"),\n \"utf8\",\n ),\n ).toMatchInlineSnapshot(`\n \"\n import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\n import type { InterfaceType } from '@osdk/maker';\n\n /** @type {import('@osdk/maker').InterfaceType} */\n const myInterface_base: InterfaceType = {\n \"apiName\": \"com.my.package.myInterface\",\n \"displayMetadata\": {\n \"displayName\": \"myInterface\",\n \"description\": \"myInterface\"\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"status\": {\n \"type\": \"active\",\n \"active\": {}\n },\n \"propertiesV2\": {\n \"com.my.package.mySpt\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"apiName\": \"com.my.package.mySpt\",\n \"type\": \"string\",\n \"nonNameSpacedApiName\": \"mySpt\",\n \"displayName\": \"mySpt\",\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\"\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\"\n }\n ],\n \"__type\": OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE\n }\n }\n },\n \"searchable\": true,\n \"__type\": OntologyEntityTypeEnum.INTERFACE_TYPE\n } as unknown as InterfaceType;\n \n export const myInterface: InterfaceType = wrapWithProxy(myInterface_base);\n \"\n `);\n\n expect(\n fs.readFileSync(\n path.join(generatedDir, \"codegen/object-types/myObject.ts\"),\n \"utf8\",\n ),\n ).toMatchInlineSnapshot(`\n \"\n import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\n import type { ObjectType } from '@osdk/maker';\n\n /** @type {import('@osdk/maker').ObjectType} */\n const myObject_base: ObjectType = {\n \"titlePropertyApiName\": \"bar\",\n \"displayName\": \"My Object\",\n \"pluralDisplayName\": \"myObjects\",\n \"apiName\": \"com.my.package.myObject\",\n \"primaryKeyPropertyApiName\": \"bar\",\n \"properties\": [\n {\n \"type\": \"string\",\n \"apiName\": \"bar\",\n \"displayName\": \"Bar\"\n }\n ],\n \"implementsInterfaces\": [\n {\n \"implements\": {\n \"apiName\": \"com.my.package.myInterface\",\n \"displayMetadata\": {\n \"displayName\": \"myInterface\",\n \"description\": \"myInterface\"\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"status\": {\n \"type\": \"active\",\n \"active\": {}\n },\n \"propertiesV2\": {\n \"com.my.package.mySpt\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"apiName\": \"com.my.package.mySpt\",\n \"type\": \"string\",\n \"nonNameSpacedApiName\": \"mySpt\",\n \"displayName\": \"mySpt\",\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\"\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\"\n }\n ],\n \"__type\": OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE\n }\n }\n },\n \"searchable\": true,\n \"__type\": OntologyEntityTypeEnum.INTERFACE_TYPE\n },\n \"propertyMapping\": [\n {\n \"interfaceProperty\": \"com.my.package.mySpt\",\n \"mapsTo\": \"bar\"\n }\n ]\n }\n ],\n \"__type\": OntologyEntityTypeEnum.OBJECT_TYPE\n } as unknown as ObjectType;\n \n export const myObject: ObjectType = wrapWithProxy(myObject_base);\n \"\n `);\n\n expect(\n fs.readFileSync(\n path.join(generatedDir, \"codegen/shared-property-types/mySpt.ts\"),\n \"utf8\",\n ),\n ).toMatchInlineSnapshot(`\n \"\n import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\n import type { SharedPropertyType } from '@osdk/maker';\n\n /** @type {import('@osdk/maker').SharedPropertyType} */\n const mySpt_base: SharedPropertyType = {\n \"apiName\": \"com.my.package.mySpt\",\n \"type\": \"string\",\n \"nonNameSpacedApiName\": \"mySpt\",\n \"displayName\": \"mySpt\",\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\"\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\"\n }\n ],\n \"__type\": OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE\n } as unknown as SharedPropertyType;\n \n export const mySpt: SharedPropertyType = wrapWithProxy(mySpt_base);\n \"\n `);\n fs.rmSync(path.resolve(path.join(generatedDir, \"..\")), {\n recursive: true,\n force: true,\n });\n });\n it(\"Extended interfaces are propagated to the static objects\", async () => {\n const generatedDir = path.resolve(path.join(\n __dirname,\n \"..\",\n \"generatedNoCheck\",\n \"extended_interfaces_are_propagated_to_the_static_objects\",\n ));\n await defineOntology(\"com.palantir.\", () => {\n const parentInterface = defineInterface({\n apiName: \"parentInterface\",\n properties: {\n property1: \"string\",\n },\n });\n const childInterface = defineInterface({\n apiName: \"childInterface\",\n properties: {\n property2: \"string\",\n },\n extends: [parentInterface],\n });\n }, generatedDir);\n\n expect(\n fs.readFileSync(\n path.join(generatedDir, \"codegen/interface-types/childInterface.ts\"),\n \"utf8\",\n ),\n ).toMatchInlineSnapshot(`\n \"\n import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\n import type { InterfaceType } from '@osdk/maker';\n\n /** @type {import('@osdk/maker').InterfaceType} */\n const childInterface_base: InterfaceType = {\n \"apiName\": \"com.palantir.childInterface\",\n \"displayMetadata\": {\n \"displayName\": \"childInterface\",\n \"description\": \"childInterface\"\n },\n \"extendsInterfaces\": [\n {\n \"apiName\": \"com.palantir.parentInterface\",\n \"displayMetadata\": {\n \"displayName\": \"parentInterface\",\n \"description\": \"parentInterface\"\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"status\": {\n \"type\": \"active\",\n \"active\": {}\n },\n \"propertiesV2\": {\n \"com.palantir.property1\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"apiName\": \"com.palantir.property1\",\n \"displayName\": \"property1\",\n \"type\": \"string\",\n \"array\": false,\n \"nonNameSpacedApiName\": \"property1\",\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\"\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\"\n }\n ],\n \"__type\": OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE\n }\n }\n },\n \"searchable\": true,\n \"__type\": OntologyEntityTypeEnum.INTERFACE_TYPE\n }\n ],\n \"links\": [],\n \"status\": {\n \"type\": \"active\",\n \"active\": {}\n },\n \"propertiesV2\": {\n \"com.palantir.property2\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"apiName\": \"com.palantir.property2\",\n \"displayName\": \"property2\",\n \"type\": \"string\",\n \"array\": false,\n \"nonNameSpacedApiName\": \"property2\",\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\"\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\"\n }\n ],\n \"__type\": OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE\n }\n }\n },\n \"searchable\": true,\n \"__type\": OntologyEntityTypeEnum.INTERFACE_TYPE\n } as unknown as InterfaceType;\n \n export const childInterface: InterfaceType = wrapWithProxy(childInterface_base);\n \"\n `);\n fs.rmSync(path.join(generatedDir, \"..\"), {\n recursive: true,\n force: true,\n });\n });\n it(\"Extended interface properties are checked in object type property mapping\", () => {\n const parentInterface = defineInterface({\n apiName: \"parentInterface\",\n properties: {\n iProperty1: \"string\",\n },\n });\n const childInterface = defineInterface({\n apiName: \"childInterface\",\n properties: {\n iProperty2: \"string\",\n },\n extends: [parentInterface],\n });\n const objectDef = defineObject({\n apiName: \"objectDef\",\n primaryKeyPropertyApiName: \"property1\",\n titlePropertyApiName: \"property1\",\n displayName: \"objectDef\",\n pluralDisplayName: \"objectDefs\",\n properties: {\n \"property1\": { type: \"string\", displayName: \"property1\" },\n \"property2\": { type: \"string\", displayName: \"property2\" },\n },\n implementsInterfaces: [\n {\n implements: childInterface,\n propertyMapping: [\n {\n interfaceProperty: \"com.palantir.iProperty1\",\n mapsTo: \"property1\",\n },\n {\n interfaceProperty: \"com.palantir.iProperty2\",\n mapsTo: \"property2\",\n },\n ],\n },\n ],\n });\n\n expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`\n {\n \"importedOntology\": {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {},\n },\n \"importedValueTypes\": {\n \"valueTypes\": [],\n },\n \"ontology\": {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {\n \"com.palantir.childInterface\": {\n \"interfaceType\": {\n \"apiName\": \"com.palantir.childInterface\",\n \"displayMetadata\": {\n \"description\": \"childInterface\",\n \"displayName\": \"childInterface\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#4C90F0\",\n \"locator\": \"layout-hierarchy\",\n },\n \"type\": \"blueprint\",\n },\n },\n \"extendsInterfaces\": [\n \"com.palantir.parentInterface\",\n ],\n \"links\": [],\n \"properties\": [],\n \"propertiesV2\": {\n \"com.palantir.iProperty2\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.iProperty2\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"iProperty2\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n \"propertiesV3\": {},\n \"searchable\": true,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n \"com.palantir.parentInterface\": {\n \"interfaceType\": {\n \"apiName\": \"com.palantir.parentInterface\",\n \"displayMetadata\": {\n \"description\": \"parentInterface\",\n \"displayName\": \"parentInterface\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#4C90F0\",\n \"locator\": \"layout-hierarchy\",\n },\n \"type\": \"blueprint\",\n },\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"properties\": [],\n \"propertiesV2\": {\n \"com.palantir.iProperty1\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.iProperty1\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"iProperty1\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n \"propertiesV3\": {},\n \"searchable\": true,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n },\n \"linkTypes\": {},\n \"objectTypes\": {\n \"com.palantir.objectDef\": {\n \"datasources\": [\n {\n \"datasource\": {\n \"datasetV2\": {\n \"datasetRid\": \"com.palantir.objectDef\",\n \"propertyMapping\": {\n \"property1\": {\n \"column\": \"property1\",\n \"type\": \"column\",\n },\n \"property2\": {\n \"column\": \"property2\",\n \"type\": \"column\",\n },\n },\n },\n \"type\": \"datasetV2\",\n },\n \"datasourceName\": \"com.palantir.objectDef\",\n \"editsConfiguration\": {\n \"onlyAllowPrivilegedEdits\": false,\n },\n \"redacted\": false,\n },\n ],\n \"entityMetadata\": {\n \"arePatchesEnabled\": false,\n },\n \"objectType\": {\n \"allImplementsInterfaces\": {},\n \"apiName\": \"com.palantir.objectDef\",\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"objectDef\",\n \"groupDisplayName\": undefined,\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#2D72D2\",\n \"locator\": \"cube\",\n },\n \"type\": \"blueprint\",\n },\n \"pluralDisplayName\": \"objectDefs\",\n \"visibility\": \"NORMAL\",\n },\n \"implementsInterfaces2\": [\n {\n \"interfaceTypeApiName\": \"com.palantir.childInterface\",\n \"linksV2\": {},\n \"properties\": {\n \"com.palantir.iProperty1\": {\n \"propertyTypeRid\": \"property1\",\n },\n \"com.palantir.iProperty2\": {\n \"propertyTypeRid\": \"property2\",\n },\n },\n \"propertiesV2\": {},\n },\n ],\n \"primaryKeys\": [\n \"property1\",\n ],\n \"propertyTypes\": {\n \"property1\": {\n \"apiName\": \"property1\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"property1\",\n \"visibility\": \"NORMAL\",\n },\n \"indexedForSearch\": true,\n \"inlineAction\": undefined,\n \"ruleSetBinding\": undefined,\n \"sharedPropertyTypeApiName\": undefined,\n \"sharedPropertyTypeRid\": undefined,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n \"property2\": {\n \"apiName\": \"property2\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"property2\",\n \"visibility\": \"NORMAL\",\n },\n \"indexedForSearch\": true,\n \"inlineAction\": undefined,\n \"ruleSetBinding\": undefined,\n \"sharedPropertyTypeApiName\": undefined,\n \"sharedPropertyTypeRid\": undefined,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n \"redacted\": false,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"titlePropertyTypeRid\": \"property1\",\n },\n },\n },\n \"sharedPropertyTypes\": {\n \"com.palantir.iProperty1\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.iProperty1\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"iProperty1\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n \"com.palantir.iProperty2\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.iProperty2\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"iProperty2\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n },\n \"randomnessKey\": undefined,\n \"valueTypes\": {\n \"valueTypes\": [],\n },\n }\n `);\n });\n });\n\n describe(\"Dependencies\", () => {\n it(\"Correctly adds dependencies\", async () => {\n const generatedDir = path.resolve(path.join(\n __dirname,\n \"..\",\n \"generatedNoCheck\",\n \"correctly_adds_dependencies\",\n ));\n await defineOntology(\n \"com.palantir.\",\n () => {\n addDependency(\"com.palantir\", fileURLToPath(import.meta.url));\n defineInterface({\n apiName: \"myInterface\",\n properties: {\n property1: \"string\",\n },\n });\n },\n generatedDir,\n path.join(generatedDir, \"dependencies.json\"),\n );\n\n const packageJson = JSON.parse(\n fs.readFileSync(\n path.join(__dirname, \"..\", \"..\", \"..\", \"package.json\"),\n \"utf8\",\n ),\n );\n expect(packageJson.version).toBeDefined();\n\n expect(\n fs.readFileSync(path.join(generatedDir, \"dependencies.json\"), \"utf8\"),\n ).toMatchInlineSnapshot(`\n \"{\n \"com.palantir\": \"${packageJson.version}\"\n }\"\n `);\n\n expect(\n fs.readFileSync(path.join(generatedDir, \"index.ts\"), \"utf8\"),\n )\n .toContain(\n `addDependency(\"com.palantir\", new URL(import.meta.url).pathname);`,\n );\n\n fs.rmSync(path.join(generatedDir, \"..\"), {\n recursive: true,\n force: true,\n });\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,EAAE,MAAM,IAAI;AACxB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AACnC,SAASC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AACzD,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,sBAAsB,QAAQ,qCAAqC;AAC5E,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,cAAc,EAAEC,wBAAwB,QAAQ,sBAAsB;AAC/E,SAASC,wBAAwB,QAAQ,iBAAiB;AAC1D,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,wBAAwB,QAAQ,gCAAgC;AAGzEX,QAAQ,CAAC,qBAAqB,EAAE,MAAM;EACpCD,UAAU,CAAC,YAAY;IACrB,MAAMQ,cAAc,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC;EAC1D,CAAC,CAAC;EAEFP,QAAQ,CAAC,SAAS,EAAE,MAAM;IACxBE,EAAE,CAAC,wBAAwB,EAAE,MAAM;MACjC,MAAMU,EAAE,GAAGD,wBAAwB,CAAC;QAClCE,OAAO,EAAE,IAAI;QACbC,WAAW,EAAE,kCAAkC;QAC/CC,QAAQ,EAAE;MACZ,CAAC,CAAC;MACkBV,eAAe,CAAC;QAClCQ,OAAO,EAAE,aAAa;QACtBG,UAAU,EAAE;UACVJ;QACF;MACF,CAAC,CAAC;MACFX,MAAM,CAACO,wBAAwB,CAAC,CAAC,CAAC,CAACS,qBAAqB,CAAC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IACJ,CAAC,CAAC;IACFf,EAAE,CAAC,wBAAwB,EAAE,MAAM;MACjC;MACA,MAAMgB,GAAuB,GAAG;QAC9BL,OAAO,EAAE,uBAAuB;QAChCM,oBAAoB,EAAE,KAAK;QAC3BC,IAAI,EAAE,QAAQ;QACdC,MAAM,EAAEjB,sBAAsB,CAACkB;MACjC,CAAC;MACDZ,oBAAoB,CAACQ,GAAG,CAAC;MAELb,eAAe,CAAC;QAClCQ,OAAO,EAAE,aAAa;QACtBG,UAAU,EAAE;UACVE;QACF;MACF,CAAC,CAAC;MACFjB,MAAM,CAACO,wBAAwB,CAAC,CAAC,CAAC,CAACS,qBAAqB,CAAC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IACJ,CAAC,CAAC;IACFf,EAAE,CAAC,sCAAsC,EAAE,YAAY;MACrD,MAAMqB,YAAY,GAAG1B,IAAI,CAAC2B,OAAO,CAAC3B,IAAI,CAAC4B,IAAI,CACzCC,SAAS,EACT,IAAI,EACJ,kBAAkB,EAClB,sCACF,CAAC,CAAC;MACF,MAAMnB,cAAc,CAAC,iBAAiB,EAAE,MAAM;QAC5C,MAAMoB,KAAK,GAAGlB,wBAAwB,CAAC;UACrCI,OAAO,EAAE,OAAO;UAChBO,IAAI,EAAE;QACR,CAAC,CAAC;QACF,MAAMQ,WAAW,GAAGvB,eAAe,CAAC;UAClCQ,OAAO,EAAE,aAAa;UACtBG,UAAU,EAAE;YACVW;UACF;QACF,CAAC,CAAC;QACerB,YAAY,CAAC;UAC5BuB,oBAAoB,EAAE,KAAK;UAC3BC,WAAW,EAAE,WAAW;UACxBC,iBAAiB,EAAE,WAAW;UAC9BlB,OAAO,EAAE,UAAU;UACnBmB,yBAAyB,EAAE,KAAK;UAChChB,UAAU,EAAE;YAAE,KAAK,EAAE;cAAEI,IAAI,EAAE;YAAS;UAAE,CAAC;UACzCa,oBAAoB,EAAE,CAAC;YACrBC,UAAU,EAAEN,WAAW;YACvBO,eAAe,EAAE,CAAC;cAChBC,iBAAiB,EAAE,sBAAsB;cACzCC,MAAM,EAAE;YACV,CAAC;UACH,CAAC;QACH,CAAC,CAAC;MACJ,CAAC,EAAEd,YAAY,CAAC;MAEhBtB,MAAM,CACJL,EAAE,CAAC0C,YAAY,CACbzC,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,wCAAwC,CAAC,EACjE,MACF,CACF,CAAC,CAACN,qBAAqB,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;MAEFhB,MAAM,CACJL,EAAE,CAAC0C,YAAY,CACbzC,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,kCAAkC,CAAC,EAC3D,MACF,CACF,CAAC,CAACN,qBAAqB,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;MAEFhB,MAAM,CACJL,EAAE,CAAC0C,YAAY,CACbzC,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,wCAAwC,CAAC,EACjE,MACF,CACF,CAAC,CAACN,qBAAqB,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;MACFrB,EAAE,CAAC2C,MAA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A;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFjB,QAAQ,CAAC,cAAc,EAAE,MAAM;IAC7BE,EAAE,CAAC,6BAA6B,EAAE,YAAY;MAC5C,MAAMqB,YAAY,GAAG1B,IAAI,CAAC2B,OAAO,CAAC3B,IAAI,CAAC4B,IAAI,CACzCC,SAAS,EACT,IAAI,EACJ,kBAAkB,EAClB,6BACF,CAAC,CAAC;MACF,MAAMnB,cAAc,CAClB,eAAe,EACf,MAAM;QACJJ,aAAa,CAAC,cAAc,EAAEL,aAAa,CAACmD,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;QAC7D9C,eAAe,CAAC;UACdQ,OAAO,EAAE,aAAa;UACtBG,UAAU,EAAE;YACV2B,SAAS,EAAE;UACb;QACF,CAAC,CAAC;MACJ,CAAC,EACDpB,YAAY,EACZ1B,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,mBAAmB,CAC7C,CAAC;MAED,MAAM6B,WAAW,GAAGC,IAAI,CAACC,KAAK,CAC5B1D,EAAE,CAAC0C,YAAY,CACbzC,IAAI,CAAC4B,IAAI,CAACC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EACtD,MACF,CACF,CAAC;MACDzB,MAAM,CAACmD,WAAW,CAACG,OAAO,CAAC,CAACC,WAAW,CAAC,CAAC;MAEzCvD,MAAM,CACJL,EAAE,CAAC0C,YAAY,CAACzC,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,mBAAmB,CAAC,EAAE,MAAM,CACtE,CAAC,CAACN,qBAAqB,CAAC;AAC9B;AACA,6BAA6BmC,WAAW,CAACG,OAAO;AAChD;AACA,OAAO,CAAC;MAEFtD,MAAM,CACJL,EAAE,CAAC0C,YAAY,CAACzC,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,UAAU,CAAC,EAAE,MAAM,CAC7D,CAAC,CACEkC,SAAS,CACR,mEACF,CAAC;MAEH7D,EAAE,CAAC2C,MAAM,CAAC1C,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,IAAI,CAAC,EAAE;QACvCiB,SAAS,EAAE,IAAI;QACfC,KAAK,EAAE;MACT,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"misc.test.js","names":["fs","path","fileURLToPath","beforeEach","describe","expect","it","addDependency","OntologyEntityTypeEnum","defineInterface","defineObject","defineOntology","dumpOntologyFullMetadata","defineSharedPropertyType","importOntologyEntity","importSharedPropertyType","id","apiName","packageName","typeHint","properties","toMatchInlineSnapshot","spt","nonNameSpacedApiName","type","__type","SHARED_PROPERTY_TYPE","generatedDir","resolve","join","__dirname","mySpt","myInterface","titlePropertyApiName","displayName","pluralDisplayName","primaryKeyPropertyApiName","implementsInterfaces","implements","propertyMapping","interfaceProperty","mapsTo","readFileSync","rmSync","recursive","force","parentInterface","property1","property2","extends","iProperty1","childInterface","iProperty2","import","meta","url","packageJson","JSON","parse","version","toBeDefined","toContain"],"sources":["misc.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport * as fs from \"fs\";\nimport path from \"path\";\nimport { fileURLToPath } from \"url\";\nimport { beforeEach, describe, expect, it } from \"vitest\";\nimport { addDependency } from \"../addDependency.js\";\nimport { OntologyEntityTypeEnum } from \"../common/OntologyEntityTypeEnum.js\";\nimport { defineInterface } from \"../defineInterface.js\";\nimport { defineObject } from \"../defineObject.js\";\nimport { defineOntology, dumpOntologyFullMetadata } from \"../defineOntology.js\";\nimport { defineSharedPropertyType } from \"../defineSpt.js\";\nimport { importOntologyEntity } from \"../importOntologyEntity.js\";\nimport { importSharedPropertyType } from \"../importSharedPropertyType.js\";\nimport { type SharedPropertyType } from \"../properties/SharedPropertyType.js\";\n\ndescribe(\"Miscellaneous Tests\", () => {\n beforeEach(async () => {\n await defineOntology(\"com.palantir.\", () => {}, \"/tmp/\");\n });\n\n describe(\"Imports\", () => {\n it(\"Legacy importing works\", () => {\n const id = importSharedPropertyType({\n apiName: \"id\",\n packageName: \"com.palantir.core.ontology.types\",\n typeHint: \"string\",\n });\n const myInterface = defineInterface({\n apiName: \"myInterface\",\n properties: {\n id,\n },\n });\n expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`\n {\n \"importedOntology\": {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {\n \"com.palantir.core.ontology.types.id\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.core.ontology.types.id\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"com.palantir.core.ontology.types.id\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [],\n \"valueType\": undefined,\n },\n },\n },\n },\n \"importedValueTypes\": {\n \"valueTypes\": [],\n },\n \"ontology\": {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {\n \"com.palantir.myInterface\": {\n \"interfaceType\": {\n \"apiName\": \"com.palantir.myInterface\",\n \"displayMetadata\": {\n \"description\": \"myInterface\",\n \"displayName\": \"myInterface\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#4C90F0\",\n \"locator\": \"layout-hierarchy\",\n },\n \"type\": \"blueprint\",\n },\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"properties\": [],\n \"propertiesV2\": {\n \"com.palantir.core.ontology.types.id\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.core.ontology.types.id\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"com.palantir.core.ontology.types.id\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [],\n \"valueType\": undefined,\n },\n },\n },\n \"propertiesV3\": {},\n \"searchable\": true,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n },\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {},\n },\n \"randomnessKey\": undefined,\n \"valueTypes\": {\n \"valueTypes\": [],\n },\n }\n `);\n });\n it(\"Simple importing works\", () => {\n // does the same as \"import { spt } from '@other/package'\"\n const spt: SharedPropertyType = {\n apiName: \"com.other.package.spt\",\n nonNameSpacedApiName: \"spt\",\n type: \"string\",\n __type: OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE,\n };\n importOntologyEntity(spt);\n\n const myInterface = defineInterface({\n apiName: \"myInterface\",\n properties: {\n spt,\n },\n });\n expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`\n {\n \"importedOntology\": {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {\n \"com.other.package.spt\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.other.package.spt\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"com.other.package.spt\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [],\n \"valueType\": undefined,\n },\n },\n },\n },\n \"importedValueTypes\": {\n \"valueTypes\": [],\n },\n \"ontology\": {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {\n \"com.palantir.myInterface\": {\n \"interfaceType\": {\n \"apiName\": \"com.palantir.myInterface\",\n \"displayMetadata\": {\n \"description\": \"myInterface\",\n \"displayName\": \"myInterface\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#4C90F0\",\n \"locator\": \"layout-hierarchy\",\n },\n \"type\": \"blueprint\",\n },\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"properties\": [],\n \"propertiesV2\": {\n \"com.other.package.spt\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.other.package.spt\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"com.other.package.spt\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [],\n \"valueType\": undefined,\n },\n },\n },\n \"propertiesV3\": {},\n \"searchable\": true,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n },\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {},\n },\n \"randomnessKey\": undefined,\n \"valueTypes\": {\n \"valueTypes\": [],\n },\n }\n `);\n });\n it(\"Export files are generated correctly\", async () => {\n const generatedDir = path.resolve(path.join(\n __dirname,\n \"..\",\n \"generatedNoCheck\",\n \"export_files_are_generated_correctly\",\n ));\n await defineOntology(\"com.my.package.\", () => {\n const mySpt = defineSharedPropertyType({\n apiName: \"mySpt\",\n type: \"string\",\n });\n const myInterface = defineInterface({\n apiName: \"myInterface\",\n properties: {\n mySpt,\n },\n });\n const myObject = defineObject({\n titlePropertyApiName: \"bar\",\n displayName: \"My Object\",\n pluralDisplayName: \"myObjects\",\n apiName: \"myObject\",\n primaryKeyPropertyApiName: \"bar\",\n properties: { \"bar\": { type: \"string\" } },\n implementsInterfaces: [{\n implements: myInterface,\n propertyMapping: [{\n interfaceProperty: \"com.my.package.mySpt\",\n mapsTo: \"bar\",\n }],\n }],\n });\n }, generatedDir);\n\n expect(\n fs.readFileSync(\n path.join(generatedDir, \"codegen/interface-types/myInterface.ts\"),\n \"utf8\",\n ),\n ).toMatchInlineSnapshot(`\n \"\n import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\n import type { InterfaceType } from '@osdk/maker';\n\n /** @type {import('@osdk/maker').InterfaceType} */\n const myInterface_base: InterfaceType = {\n \"apiName\": \"com.my.package.myInterface\",\n \"displayMetadata\": {\n \"displayName\": \"myInterface\",\n \"description\": \"myInterface\"\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"status\": {\n \"type\": \"active\",\n \"active\": {}\n },\n \"propertiesV2\": {\n \"com.my.package.mySpt\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"apiName\": \"com.my.package.mySpt\",\n \"type\": \"string\",\n \"nonNameSpacedApiName\": \"mySpt\",\n \"displayName\": \"mySpt\",\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\"\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\"\n }\n ],\n \"__type\": OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE\n }\n }\n },\n \"searchable\": true,\n \"__type\": OntologyEntityTypeEnum.INTERFACE_TYPE\n } as unknown as InterfaceType;\n \n export const myInterface: InterfaceType = wrapWithProxy(myInterface_base);\n \"\n `);\n\n expect(\n fs.readFileSync(\n path.join(generatedDir, \"codegen/object-types/myObject.ts\"),\n \"utf8\",\n ),\n ).toMatchInlineSnapshot(`\n \"\n import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\n import type { ObjectType } from '@osdk/maker';\n\n /** @type {import('@osdk/maker').ObjectType} */\n const myObject_base: ObjectType = {\n \"titlePropertyApiName\": \"bar\",\n \"displayName\": \"My Object\",\n \"pluralDisplayName\": \"myObjects\",\n \"apiName\": \"com.my.package.myObject\",\n \"primaryKeyPropertyApiName\": \"bar\",\n \"properties\": [\n {\n \"type\": \"string\",\n \"displayName\": \"Bar\",\n \"apiName\": \"bar\"\n }\n ],\n \"implementsInterfaces\": [\n {\n \"implements\": {\n \"apiName\": \"com.my.package.myInterface\",\n \"displayMetadata\": {\n \"displayName\": \"myInterface\",\n \"description\": \"myInterface\"\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"status\": {\n \"type\": \"active\",\n \"active\": {}\n },\n \"propertiesV2\": {\n \"com.my.package.mySpt\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"apiName\": \"com.my.package.mySpt\",\n \"type\": \"string\",\n \"nonNameSpacedApiName\": \"mySpt\",\n \"displayName\": \"mySpt\",\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\"\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\"\n }\n ],\n \"__type\": OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE\n }\n }\n },\n \"searchable\": true,\n \"__type\": OntologyEntityTypeEnum.INTERFACE_TYPE\n },\n \"propertyMapping\": [\n {\n \"interfaceProperty\": \"com.my.package.mySpt\",\n \"mapsTo\": \"bar\"\n }\n ]\n }\n ],\n \"__type\": OntologyEntityTypeEnum.OBJECT_TYPE\n } as unknown as ObjectType;\n \n export const myObject: ObjectType = wrapWithProxy(myObject_base);\n \"\n `);\n\n expect(\n fs.readFileSync(\n path.join(generatedDir, \"codegen/shared-property-types/mySpt.ts\"),\n \"utf8\",\n ),\n ).toMatchInlineSnapshot(`\n \"\n import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\n import type { SharedPropertyType } from '@osdk/maker';\n\n /** @type {import('@osdk/maker').SharedPropertyType} */\n const mySpt_base: SharedPropertyType = {\n \"apiName\": \"com.my.package.mySpt\",\n \"type\": \"string\",\n \"nonNameSpacedApiName\": \"mySpt\",\n \"displayName\": \"mySpt\",\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\"\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\"\n }\n ],\n \"__type\": OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE\n } as unknown as SharedPropertyType;\n \n export const mySpt: SharedPropertyType = wrapWithProxy(mySpt_base);\n \"\n `);\n fs.rmSync(path.resolve(path.join(generatedDir, \"..\")), {\n recursive: true,\n force: true,\n });\n });\n it(\"Extended interfaces are propagated to the static objects\", async () => {\n const generatedDir = path.resolve(path.join(\n __dirname,\n \"..\",\n \"generatedNoCheck\",\n \"extended_interfaces_are_propagated_to_the_static_objects\",\n ));\n await defineOntology(\"com.palantir.\", () => {\n const parentInterface = defineInterface({\n apiName: \"parentInterface\",\n properties: {\n property1: \"string\",\n },\n });\n const childInterface = defineInterface({\n apiName: \"childInterface\",\n properties: {\n property2: \"string\",\n },\n extends: [parentInterface],\n });\n }, generatedDir);\n\n expect(\n fs.readFileSync(\n path.join(generatedDir, \"codegen/interface-types/childInterface.ts\"),\n \"utf8\",\n ),\n ).toMatchInlineSnapshot(`\n \"\n import { wrapWithProxy, OntologyEntityTypeEnum } from '@osdk/maker';\n import type { InterfaceType } from '@osdk/maker';\n\n /** @type {import('@osdk/maker').InterfaceType} */\n const childInterface_base: InterfaceType = {\n \"apiName\": \"com.palantir.childInterface\",\n \"displayMetadata\": {\n \"displayName\": \"childInterface\",\n \"description\": \"childInterface\"\n },\n \"extendsInterfaces\": [\n {\n \"apiName\": \"com.palantir.parentInterface\",\n \"displayMetadata\": {\n \"displayName\": \"parentInterface\",\n \"description\": \"parentInterface\"\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"status\": {\n \"type\": \"active\",\n \"active\": {}\n },\n \"propertiesV2\": {\n \"com.palantir.property1\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"apiName\": \"com.palantir.property1\",\n \"displayName\": \"property1\",\n \"type\": \"string\",\n \"array\": false,\n \"nonNameSpacedApiName\": \"property1\",\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\"\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\"\n }\n ],\n \"__type\": OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE\n }\n }\n },\n \"searchable\": true,\n \"__type\": OntologyEntityTypeEnum.INTERFACE_TYPE\n }\n ],\n \"links\": [],\n \"status\": {\n \"type\": \"active\",\n \"active\": {}\n },\n \"propertiesV2\": {\n \"com.palantir.property2\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"apiName\": \"com.palantir.property2\",\n \"displayName\": \"property2\",\n \"type\": \"string\",\n \"array\": false,\n \"nonNameSpacedApiName\": \"property2\",\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\"\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\"\n }\n ],\n \"__type\": OntologyEntityTypeEnum.SHARED_PROPERTY_TYPE\n }\n }\n },\n \"searchable\": true,\n \"__type\": OntologyEntityTypeEnum.INTERFACE_TYPE\n } as unknown as InterfaceType;\n \n export const childInterface: InterfaceType = wrapWithProxy(childInterface_base);\n \"\n `);\n fs.rmSync(path.join(generatedDir, \"..\"), {\n recursive: true,\n force: true,\n });\n });\n it(\"Extended interface properties are checked in object type property mapping\", () => {\n const parentInterface = defineInterface({\n apiName: \"parentInterface\",\n properties: {\n iProperty1: \"string\",\n },\n });\n const childInterface = defineInterface({\n apiName: \"childInterface\",\n properties: {\n iProperty2: \"string\",\n },\n extends: [parentInterface],\n });\n const objectDef = defineObject({\n apiName: \"objectDef\",\n primaryKeyPropertyApiName: \"property1\",\n titlePropertyApiName: \"property1\",\n displayName: \"objectDef\",\n pluralDisplayName: \"objectDefs\",\n properties: {\n \"property1\": { type: \"string\", displayName: \"property1\" },\n \"property2\": { type: \"string\", displayName: \"property2\" },\n },\n implementsInterfaces: [\n {\n implements: childInterface,\n propertyMapping: [\n {\n interfaceProperty: \"com.palantir.iProperty1\",\n mapsTo: \"property1\",\n },\n {\n interfaceProperty: \"com.palantir.iProperty2\",\n mapsTo: \"property2\",\n },\n ],\n },\n ],\n });\n\n expect(dumpOntologyFullMetadata()).toMatchInlineSnapshot(`\n {\n \"importedOntology\": {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n \"sharedPropertyTypes\": {},\n },\n \"importedValueTypes\": {\n \"valueTypes\": [],\n },\n \"ontology\": {\n \"actionTypes\": {},\n \"blockPermissionInformation\": {\n \"actionTypes\": {},\n \"linkTypes\": {},\n \"objectTypes\": {},\n },\n \"interfaceTypes\": {\n \"com.palantir.childInterface\": {\n \"interfaceType\": {\n \"apiName\": \"com.palantir.childInterface\",\n \"displayMetadata\": {\n \"description\": \"childInterface\",\n \"displayName\": \"childInterface\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#4C90F0\",\n \"locator\": \"layout-hierarchy\",\n },\n \"type\": \"blueprint\",\n },\n },\n \"extendsInterfaces\": [\n \"com.palantir.parentInterface\",\n ],\n \"links\": [],\n \"properties\": [],\n \"propertiesV2\": {\n \"com.palantir.iProperty2\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.iProperty2\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"iProperty2\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n \"propertiesV3\": {},\n \"searchable\": true,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n \"com.palantir.parentInterface\": {\n \"interfaceType\": {\n \"apiName\": \"com.palantir.parentInterface\",\n \"displayMetadata\": {\n \"description\": \"parentInterface\",\n \"displayName\": \"parentInterface\",\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#4C90F0\",\n \"locator\": \"layout-hierarchy\",\n },\n \"type\": \"blueprint\",\n },\n },\n \"extendsInterfaces\": [],\n \"links\": [],\n \"properties\": [],\n \"propertiesV2\": {\n \"com.palantir.iProperty1\": {\n \"required\": true,\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.iProperty1\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"iProperty1\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n \"propertiesV3\": {},\n \"searchable\": true,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n },\n },\n },\n \"linkTypes\": {},\n \"objectTypes\": {\n \"com.palantir.objectDef\": {\n \"datasources\": [\n {\n \"datasource\": {\n \"datasetV2\": {\n \"datasetRid\": \"com.palantir.objectDef\",\n \"propertyMapping\": {\n \"property1\": {\n \"column\": \"property1\",\n \"type\": \"column\",\n },\n \"property2\": {\n \"column\": \"property2\",\n \"type\": \"column\",\n },\n },\n },\n \"type\": \"datasetV2\",\n },\n \"datasourceName\": \"com.palantir.objectDef\",\n \"editsConfiguration\": {\n \"onlyAllowPrivilegedEdits\": false,\n },\n \"redacted\": false,\n },\n ],\n \"entityMetadata\": {\n \"arePatchesEnabled\": false,\n },\n \"objectType\": {\n \"allImplementsInterfaces\": {},\n \"apiName\": \"com.palantir.objectDef\",\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"objectDef\",\n \"groupDisplayName\": undefined,\n \"icon\": {\n \"blueprint\": {\n \"color\": \"#2D72D2\",\n \"locator\": \"cube\",\n },\n \"type\": \"blueprint\",\n },\n \"pluralDisplayName\": \"objectDefs\",\n \"visibility\": \"NORMAL\",\n },\n \"implementsInterfaces2\": [\n {\n \"interfaceTypeApiName\": \"com.palantir.childInterface\",\n \"linksV2\": {},\n \"properties\": {\n \"com.palantir.iProperty1\": {\n \"propertyTypeRid\": \"property1\",\n },\n \"com.palantir.iProperty2\": {\n \"propertyTypeRid\": \"property2\",\n },\n },\n \"propertiesV2\": {},\n },\n ],\n \"primaryKeys\": [\n \"property1\",\n ],\n \"propertyTypes\": {\n \"property1\": {\n \"apiName\": \"property1\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"property1\",\n \"visibility\": \"NORMAL\",\n },\n \"indexedForSearch\": true,\n \"inlineAction\": undefined,\n \"ruleSetBinding\": undefined,\n \"sharedPropertyTypeApiName\": undefined,\n \"sharedPropertyTypeRid\": undefined,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n \"property2\": {\n \"apiName\": \"property2\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"property2\",\n \"visibility\": \"NORMAL\",\n },\n \"indexedForSearch\": true,\n \"inlineAction\": undefined,\n \"ruleSetBinding\": undefined,\n \"sharedPropertyTypeApiName\": undefined,\n \"sharedPropertyTypeRid\": undefined,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n \"redacted\": false,\n \"status\": {\n \"active\": {},\n \"type\": \"active\",\n },\n \"titlePropertyTypeRid\": \"property1\",\n },\n },\n },\n \"sharedPropertyTypes\": {\n \"com.palantir.iProperty1\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.iProperty1\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"iProperty1\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n \"com.palantir.iProperty2\": {\n \"sharedPropertyType\": {\n \"aliases\": [],\n \"apiName\": \"com.palantir.iProperty2\",\n \"baseFormatter\": undefined,\n \"dataConstraints\": undefined,\n \"displayMetadata\": {\n \"description\": undefined,\n \"displayName\": \"iProperty2\",\n \"visibility\": \"NORMAL\",\n },\n \"gothamMapping\": undefined,\n \"indexedForSearch\": true,\n \"type\": {\n \"string\": {\n \"analyzerOverride\": undefined,\n \"enableAsciiFolding\": undefined,\n \"isLongText\": false,\n \"supportsEfficientLeadingWildcard\": false,\n \"supportsExactMatching\": true,\n },\n \"type\": \"string\",\n },\n \"typeClasses\": [\n {\n \"kind\": \"render_hint\",\n \"name\": \"SELECTABLE\",\n },\n {\n \"kind\": \"render_hint\",\n \"name\": \"SORTABLE\",\n },\n ],\n \"valueType\": undefined,\n },\n },\n },\n },\n \"randomnessKey\": undefined,\n \"valueTypes\": {\n \"valueTypes\": [],\n },\n }\n `);\n });\n });\n\n describe(\"Dependencies\", () => {\n it(\"Correctly adds dependencies\", async () => {\n const generatedDir = path.resolve(path.join(\n __dirname,\n \"..\",\n \"generatedNoCheck\",\n \"correctly_adds_dependencies\",\n ));\n await defineOntology(\n \"com.palantir.\",\n () => {\n addDependency(\"com.palantir\", fileURLToPath(import.meta.url));\n defineInterface({\n apiName: \"myInterface\",\n properties: {\n property1: \"string\",\n },\n });\n },\n generatedDir,\n path.join(generatedDir, \"dependencies.json\"),\n );\n\n const packageJson = JSON.parse(\n fs.readFileSync(\n path.join(__dirname, \"..\", \"..\", \"..\", \"package.json\"),\n \"utf8\",\n ),\n );\n expect(packageJson.version).toBeDefined();\n\n expect(\n fs.readFileSync(path.join(generatedDir, \"dependencies.json\"), \"utf8\"),\n ).toMatchInlineSnapshot(`\n \"{\n \"com.palantir\": \"${packageJson.version}\"\n }\"\n `);\n\n expect(\n fs.readFileSync(path.join(generatedDir, \"index.ts\"), \"utf8\"),\n )\n .toContain(\n `addDependency(\"com.palantir\", new URL(import.meta.url).pathname);`,\n );\n\n fs.rmSync(path.join(generatedDir, \"..\"), {\n recursive: true,\n force: true,\n });\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,KAAKA,EAAE,MAAM,IAAI;AACxB,OAAOC,IAAI,MAAM,MAAM;AACvB,SAASC,aAAa,QAAQ,KAAK;AACnC,SAASC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AACzD,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,sBAAsB,QAAQ,qCAAqC;AAC5E,SAASC,eAAe,QAAQ,uBAAuB;AACvD,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,cAAc,EAAEC,wBAAwB,QAAQ,sBAAsB;AAC/E,SAASC,wBAAwB,QAAQ,iBAAiB;AAC1D,SAASC,oBAAoB,QAAQ,4BAA4B;AACjE,SAASC,wBAAwB,QAAQ,gCAAgC;AAGzEX,QAAQ,CAAC,qBAAqB,EAAE,MAAM;EACpCD,UAAU,CAAC,YAAY;IACrB,MAAMQ,cAAc,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC;EAC1D,CAAC,CAAC;EAEFP,QAAQ,CAAC,SAAS,EAAE,MAAM;IACxBE,EAAE,CAAC,wBAAwB,EAAE,MAAM;MACjC,MAAMU,EAAE,GAAGD,wBAAwB,CAAC;QAClCE,OAAO,EAAE,IAAI;QACbC,WAAW,EAAE,kCAAkC;QAC/CC,QAAQ,EAAE;MACZ,CAAC,CAAC;MACkBV,eAAe,CAAC;QAClCQ,OAAO,EAAE,aAAa;QACtBG,UAAU,EAAE;UACVJ;QACF;MACF,CAAC,CAAC;MACFX,MAAM,CAACO,wBAAwB,CAAC,CAAC,CAAC,CAACS,qBAAqB,CAAC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IACJ,CAAC,CAAC;IACFf,EAAE,CAAC,wBAAwB,EAAE,MAAM;MACjC;MACA,MAAMgB,GAAuB,GAAG;QAC9BL,OAAO,EAAE,uBAAuB;QAChCM,oBAAoB,EAAE,KAAK;QAC3BC,IAAI,EAAE,QAAQ;QACdC,MAAM,EAAEjB,sBAAsB,CAACkB;MACjC,CAAC;MACDZ,oBAAoB,CAACQ,GAAG,CAAC;MAELb,eAAe,CAAC;QAClCQ,OAAO,EAAE,aAAa;QACtBG,UAAU,EAAE;UACVE;QACF;MACF,CAAC,CAAC;MACFjB,MAAM,CAACO,wBAAwB,CAAC,CAAC,CAAC,CAACS,qBAAqB,CAAC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IACJ,CAAC,CAAC;IACFf,EAAE,CAAC,sCAAsC,EAAE,YAAY;MACrD,MAAMqB,YAAY,GAAG1B,IAAI,CAAC2B,OAAO,CAAC3B,IAAI,CAAC4B,IAAI,CACzCC,SAAS,EACT,IAAI,EACJ,kBAAkB,EAClB,sCACF,CAAC,CAAC;MACF,MAAMnB,cAAc,CAAC,iBAAiB,EAAE,MAAM;QAC5C,MAAMoB,KAAK,GAAGlB,wBAAwB,CAAC;UACrCI,OAAO,EAAE,OAAO;UAChBO,IAAI,EAAE;QACR,CAAC,CAAC;QACF,MAAMQ,WAAW,GAAGvB,eAAe,CAAC;UAClCQ,OAAO,EAAE,aAAa;UACtBG,UAAU,EAAE;YACVW;UACF;QACF,CAAC,CAAC;QACerB,YAAY,CAAC;UAC5BuB,oBAAoB,EAAE,KAAK;UAC3BC,WAAW,EAAE,WAAW;UACxBC,iBAAiB,EAAE,WAAW;UAC9BlB,OAAO,EAAE,UAAU;UACnBmB,yBAAyB,EAAE,KAAK;UAChChB,UAAU,EAAE;YAAE,KAAK,EAAE;cAAEI,IAAI,EAAE;YAAS;UAAE,CAAC;UACzCa,oBAAoB,EAAE,CAAC;YACrBC,UAAU,EAAEN,WAAW;YACvBO,eAAe,EAAE,CAAC;cAChBC,iBAAiB,EAAE,sBAAsB;cACzCC,MAAM,EAAE;YACV,CAAC;UACH,CAAC;QACH,CAAC,CAAC;MACJ,CAAC,EAAEd,YAAY,CAAC;MAEhBtB,MAAM,CACJL,EAAE,CAAC0C,YAAY,CACbzC,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,wCAAwC,CAAC,EACjE,MACF,CACF,CAAC,CAACN,qBAAqB,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;MAEFhB,MAAM,CACJL,EAAE,CAAC0C,YAAY,CACbzC,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,kCAAkC,CAAC,EAC3D,MACF,CACF,CAAC,CAACN,qBAAqB,CAAC;AAC9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;MAEFhB,MAAM,CACJL,EAAE,CAAC0C,YAAY,CACbzC,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,wCAAwC,CAAC,EACjE,MACF,CACF,CAAC,CAACN,qBAAqB,CAAC;AAC9B;AACA;AACA;AACA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,EAAE;UACV,CAAC;QAEL,CAAC;MAEL,CAAC,CAAC;MAEFpC,MAAM,CAACO,wBAAwB,CAAC,CAAC,CAAC,CAACS,qBAAqB,CAAC;AAC/D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFjB,QAAQ,CAAC,cAAc,EAAE,MAAM;IAC7BE,EAAE,CAAC,6BAA6B,EAAE,YAAY;MAC5C,MAAMqB,YAAY,GAAG1B,IAAI,CAAC2B,OAAO,CAAC3B,IAAI,CAAC4B,IAAI,CACzCC,SAAS,EACT,IAAI,EACJ,kBAAkB,EAClB,6BACF,CAAC,CAAC;MACF,MAAMnB,cAAc,CAClB,eAAe,EACf,MAAM;QACJJ,aAAa,CAAC,cAAc,EAAEL,aAAa,CAACmD,MAAM,CAACC,IAAI,CAACC,GAAG,CAAC,CAAC;QAC7D9C,eAAe,CAAC;UACdQ,OAAO,EAAE,aAAa;UACtBG,UAAU,EAAE;YACV2B,SAAS,EAAE;UACb;QACF,CAAC,CAAC;MACJ,CAAC,EACDpB,YAAY,EACZ1B,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,mBAAmB,CAC7C,CAAC;MAED,MAAM6B,WAAW,GAAGC,IAAI,CAACC,KAAK,CAC5B1D,EAAE,CAAC0C,YAAY,CACbzC,IAAI,CAAC4B,IAAI,CAACC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC,EACtD,MACF,CACF,CAAC;MACDzB,MAAM,CAACmD,WAAW,CAACG,OAAO,CAAC,CAACC,WAAW,CAAC,CAAC;MAEzCvD,MAAM,CACJL,EAAE,CAAC0C,YAAY,CAACzC,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,mBAAmB,CAAC,EAAE,MAAM,CACtE,CAAC,CAACN,qBAAqB,CAAC;AAC9B;AACA,6BAA6BmC,WAAW,CAACG,OAAO;AAChD;AACA,OAAO,CAAC;MAEFtD,MAAM,CACJL,EAAE,CAAC0C,YAAY,CAACzC,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,UAAU,CAAC,EAAE,MAAM,CAC7D,CAAC,CACEkC,SAAS,CACR,mEACF,CAAC;MAEH7D,EAAE,CAAC2C,MAAM,CAAC1C,IAAI,CAAC4B,IAAI,CAACF,YAAY,EAAE,IAAI,CAAC,EAAE;QACvCiB,SAAS,EAAE,IAAI;QACfC,KAAK,EAAE;MACT,CAAC,CAAC;IACJ,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -24,7 +24,7 @@ import { defineOntology } from "../api/defineOntology.js";
24
24
  const apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
25
25
  const uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
26
26
  export default async function main(args = process.argv) {
27
- const commandLineOpts = await yargs(hideBin(args)).version("0.14.0-beta.14" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
27
+ const commandLineOpts = await yargs(hideBin(args)).version("0.14.0-beta.15" ?? "").wrap(Math.min(150, yargs().terminalWidth())).strict().help().options({
28
28
  input: {
29
29
  alias: "i",
30
30
  describe: "Input file",
@@ -346,7 +346,7 @@ function defineObject(objectDef) {
346
346
  const allFailedValidations = validations.concat(nonExistentInterfaceProperties).filter((val) => val.type === "invalid");
347
347
  !(allFailedValidations.length === 0) ? process.env.NODE_ENV !== "production" ? invariant7__default.default(false, "\n" + allFailedValidations.map(formatValidationErrors).join("\n")) : invariant7__default.default(false) : void 0;
348
348
  });
349
- const flattenedProperties = Object.entries(objectDef.properties ?? {}).map(([apiName2, property]) => convertUserObjectPropertyType(property.apiName ?? apiName2, property));
349
+ const flattenedProperties = Object.entries(objectDef.properties ?? {}).map(([apiName2, property]) => convertUserObjectPropertyType(apiName2, property));
350
350
  const finalObject = {
351
351
  ...objectDef,
352
352
  apiName,
@@ -386,7 +386,6 @@ function convertToPluralDisplayName(s) {
386
386
  return s === void 0 || s == null ? "" : s.endsWith("s") ? uppercaseFirstLetter(s) : uppercaseFirstLetter(s) + "s";
387
387
  }
388
388
  function convertUserObjectPropertyType(apiName, property) {
389
- property.apiName = apiName;
390
389
  property.displayName = property.displayName ?? uppercaseFirstLetter(apiName);
391
390
  return {
392
391
  ...property,
@@ -2041,7 +2040,7 @@ function addNamespaceIfNone(apiName) {
2041
2040
  var apiNamespaceRegex = /^[a-z0-9-]+(\.[a-z0-9-]+)*\.$/;
2042
2041
  var uuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
2043
2042
  async function main(args = process.argv) {
2044
- const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.14.0-beta.14").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
2043
+ const commandLineOpts = await yargs__default.default(helpers.hideBin(args)).version("0.14.0-beta.15").wrap(Math.min(150, yargs__default.default().terminalWidth())).strict().help().options({
2045
2044
  input: {
2046
2045
  alias: "i",
2047
2046
  describe: "Input file",