@osdk/generator 2.2.0-rc.25 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/CHANGELOG.md +71 -0
  2. package/build/browser/GenerateContext/EnhancedInterfaceType.js +1 -2
  3. package/build/browser/GenerateContext/EnhancedInterfaceType.js.map +1 -1
  4. package/build/browser/GenerateContext/EnhancedObjectType.js +1 -2
  5. package/build/browser/GenerateContext/EnhancedObjectType.js.map +1 -1
  6. package/build/browser/util/stringify.js +3 -1
  7. package/build/browser/util/stringify.js.map +1 -1
  8. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +1 -0
  9. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  10. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +13 -0
  11. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  12. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +1 -2
  13. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  14. package/build/cjs/index.cjs +11 -11
  15. package/build/cjs/index.cjs.map +1 -1
  16. package/build/esm/GenerateContext/EnhancedInterfaceType.js +1 -2
  17. package/build/esm/GenerateContext/EnhancedInterfaceType.js.map +1 -1
  18. package/build/esm/GenerateContext/EnhancedObjectType.js +1 -2
  19. package/build/esm/GenerateContext/EnhancedObjectType.js.map +1 -1
  20. package/build/esm/util/stringify.js +3 -1
  21. package/build/esm/util/stringify.js.map +1 -1
  22. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +1 -0
  23. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  24. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +13 -0
  25. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  26. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +1 -2
  27. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  28. package/build/types/GenerateContext/EnhancedInterfaceType.d.ts.map +1 -1
  29. package/build/types/GenerateContext/EnhancedObjectType.d.ts.map +1 -1
  30. package/build/types/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  31. package/package.json +5 -5
@@ -15,7 +15,6 @@
15
15
  */
16
16
 
17
17
  import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "@osdk/generator-converters";
18
- import { deleteUndefineds } from "../util/deleteUndefineds.js";
19
18
  import { EnhancedBase } from "./EnhancedBase.js";
20
19
  export class EnhancedInterfaceType extends EnhancedBase {
21
20
  constructor(common, raw) {
@@ -32,7 +31,7 @@ export class EnhancedInterfaceType extends EnhancedBase {
32
31
  return this.raw.properties;
33
32
  }
34
33
  getCleanedUpDefinition(v2) {
35
- return deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.raw, v2));
34
+ return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.raw, v2);
36
35
  }
37
36
  }
38
37
  //# sourceMappingURL=EnhancedInterfaceType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedInterfaceType.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","deleteUndefineds","EnhancedBase","EnhancedInterfaceType","constructor","common","raw","apiName","getDefinitionIdentifier","v2","shortApiName","getImportedDefinitionIdentifier","properties","getCleanedUpDefinition"],"sources":["EnhancedInterfaceType.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 type { InterfaceMetadata } from \"@osdk/api\";\nimport type { InterfaceType } from \"@osdk/foundry.ontologies\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedInterfaceType extends EnhancedBase<InterfaceType> {\n constructor(common: EnhanceCommon, public raw: InterfaceType) {\n super(common, raw, raw.apiName, \"./ontology/interfaces\");\n }\n\n getDefinitionIdentifier(v2: boolean): string {\n return v2 ? this.shortApiName : `${this.shortApiName}Def`;\n }\n\n getImportedDefinitionIdentifier(v2: boolean): string {\n return this.getDefinitionIdentifier(v2);\n }\n\n get properties(): InterfaceType[\"properties\"] {\n return this.raw.properties;\n }\n\n getCleanedUpDefinition(v2: boolean): InterfaceMetadata {\n return deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n this.raw,\n v2,\n ),\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,SAASC,gBAAgB,QAAQ,6BAA6B;AAE9D,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,qBAAqB,SAASD,YAAY,CAAgB;EACrEE,WAAWA,CAACC,MAAqB,EAASC,GAAkB,EAAE;IAC5D,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,OAAO,EAAE,uBAAuB,CAAC;IAAC,KADjBD,GAAkB,GAAlBA,GAAkB;EAE5D;EAEAE,uBAAuBA,CAACC,EAAW,EAAU;IAC3C,OAAOA,EAAE,GAAG,IAAI,CAACC,YAAY,GAAG,GAAG,IAAI,CAACA,YAAY,KAAK;EAC3D;EAEAC,+BAA+BA,CAACF,EAAW,EAAU;IACnD,OAAO,IAAI,CAACD,uBAAuB,CAACC,EAAE,CAAC;EACzC;EAEA,IAAIG,UAAUA,CAAA,EAAgC;IAC5C,OAAO,IAAI,CAACN,GAAG,CAACM,UAAU;EAC5B;EAEAC,sBAAsBA,CAACJ,EAAW,EAAqB;IACrD,OAAOR,gBAAgB,CACrBD,mDAAmD,CACjD,IAAI,CAACM,GAAG,EACRG,EACF,CACF,CAAC;EACH;AACF","ignoreList":[]}
1
+ {"version":3,"file":"EnhancedInterfaceType.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","EnhancedBase","EnhancedInterfaceType","constructor","common","raw","apiName","getDefinitionIdentifier","v2","shortApiName","getImportedDefinitionIdentifier","properties","getCleanedUpDefinition"],"sources":["EnhancedInterfaceType.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 type { InterfaceMetadata } from \"@osdk/api\";\nimport type { InterfaceType } from \"@osdk/foundry.ontologies\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedInterfaceType extends EnhancedBase<InterfaceType> {\n constructor(common: EnhanceCommon, public raw: InterfaceType) {\n super(common, raw, raw.apiName, \"./ontology/interfaces\");\n }\n\n getDefinitionIdentifier(v2: boolean): string {\n return v2 ? this.shortApiName : `${this.shortApiName}Def`;\n }\n\n getImportedDefinitionIdentifier(v2: boolean): string {\n return this.getDefinitionIdentifier(v2);\n }\n\n get properties(): InterfaceType[\"properties\"] {\n return this.raw.properties;\n }\n\n getCleanedUpDefinition(v2: boolean): InterfaceMetadata {\n return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n this.raw,\n v2,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,mDAAmD,QAAQ,4BAA4B;AAEhG,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,qBAAqB,SAASD,YAAY,CAAgB;EACrEE,WAAWA,CAACC,MAAqB,EAASC,GAAkB,EAAE;IAC5D,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,OAAO,EAAE,uBAAuB,CAAC;IAAC,KADjBD,GAAkB,GAAlBA,GAAkB;EAE5D;EAEAE,uBAAuBA,CAACC,EAAW,EAAU;IAC3C,OAAOA,EAAE,GAAG,IAAI,CAACC,YAAY,GAAG,GAAG,IAAI,CAACA,YAAY,KAAK;EAC3D;EAEAC,+BAA+BA,CAACF,EAAW,EAAU;IACnD,OAAO,IAAI,CAACD,uBAAuB,CAACC,EAAE,CAAC;EACzC;EAEA,IAAIG,UAAUA,CAAA,EAAgC;IAC5C,OAAO,IAAI,CAACN,GAAG,CAACM,UAAU;EAC5B;EAEAC,sBAAsBA,CAACJ,EAAW,EAAqB;IACrD,OAAOR,mDAAmD,CACxD,IAAI,CAACK,GAAG,EACRG,EACF,CAAC;EACH;AACF","ignoreList":[]}
@@ -15,7 +15,6 @@
15
15
  */
16
16
 
17
17
  import { wireObjectTypeFullMetadataToSdkObjectMetadata } from "@osdk/generator-converters";
18
- import { deleteUndefineds } from "../util/deleteUndefineds.js";
19
18
  import { EnhancedBase } from "./EnhancedBase.js";
20
19
  export class EnhancedObjectType extends EnhancedBase {
21
20
  constructor(common, raw) {
@@ -29,7 +28,7 @@ export class EnhancedObjectType extends EnhancedBase {
29
28
  return this.getDefinitionIdentifier(v2);
30
29
  }
31
30
  getCleanedUpDefinition(v2) {
32
- return deleteUndefineds(wireObjectTypeFullMetadataToSdkObjectMetadata(this.raw, v2));
31
+ return wireObjectTypeFullMetadataToSdkObjectMetadata(this.raw, v2);
33
32
  }
34
33
  }
35
34
  //# sourceMappingURL=EnhancedObjectType.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnhancedObjectType.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","deleteUndefineds","EnhancedBase","EnhancedObjectType","constructor","common","raw","objectType","apiName","getDefinitionIdentifier","v2","shortApiName","getImportedDefinitionIdentifier","getCleanedUpDefinition"],"sources":["EnhancedObjectType.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 type { ObjectMetadata } from \"@osdk/api\";\nimport type { ObjectTypeFullMetadata } from \"@osdk/foundry.ontologies\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedObjectType extends EnhancedBase<ObjectTypeFullMetadata> {\n constructor(common: EnhanceCommon, public raw: ObjectTypeFullMetadata) {\n super(common, raw, raw.objectType.apiName, \"./ontology/objects\");\n }\n\n getDefinitionIdentifier(v2: boolean): string {\n return v2 ? this.shortApiName : `${this.shortApiName}Def`;\n }\n\n getImportedDefinitionIdentifier(v2: boolean): string {\n return this.getDefinitionIdentifier(v2);\n }\n\n getCleanedUpDefinition(v2: boolean): ObjectMetadata {\n return deleteUndefineds(\n wireObjectTypeFullMetadataToSdkObjectMetadata(\n this.raw,\n v2,\n ),\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,6CAA6C,QAAQ,4BAA4B;AAC1F,SAASC,gBAAgB,QAAQ,6BAA6B;AAE9D,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,kBAAkB,SAASD,YAAY,CAAyB;EAC3EE,WAAWA,CAACC,MAAqB,EAASC,GAA2B,EAAE;IACrE,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,UAAU,CAACC,OAAO,EAAE,oBAAoB,CAAC;IAAC,KADzBF,GAA2B,GAA3BA,GAA2B;EAErE;EAEAG,uBAAuBA,CAACC,EAAW,EAAU;IAC3C,OAAOA,EAAE,GAAG,IAAI,CAACC,YAAY,GAAG,GAAG,IAAI,CAACA,YAAY,KAAK;EAC3D;EAEAC,+BAA+BA,CAACF,EAAW,EAAU;IACnD,OAAO,IAAI,CAACD,uBAAuB,CAACC,EAAE,CAAC;EACzC;EAEAG,sBAAsBA,CAACH,EAAW,EAAkB;IAClD,OAAOT,gBAAgB,CACrBD,6CAA6C,CAC3C,IAAI,CAACM,GAAG,EACRI,EACF,CACF,CAAC;EACH;AACF","ignoreList":[]}
1
+ {"version":3,"file":"EnhancedObjectType.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","EnhancedBase","EnhancedObjectType","constructor","common","raw","objectType","apiName","getDefinitionIdentifier","v2","shortApiName","getImportedDefinitionIdentifier","getCleanedUpDefinition"],"sources":["EnhancedObjectType.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 type { ObjectMetadata } from \"@osdk/api\";\nimport type { ObjectTypeFullMetadata } from \"@osdk/foundry.ontologies\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedObjectType extends EnhancedBase<ObjectTypeFullMetadata> {\n constructor(common: EnhanceCommon, public raw: ObjectTypeFullMetadata) {\n super(common, raw, raw.objectType.apiName, \"./ontology/objects\");\n }\n\n getDefinitionIdentifier(v2: boolean): string {\n return v2 ? this.shortApiName : `${this.shortApiName}Def`;\n }\n\n getImportedDefinitionIdentifier(v2: boolean): string {\n return this.getDefinitionIdentifier(v2);\n }\n\n getCleanedUpDefinition(v2: boolean): ObjectMetadata {\n return wireObjectTypeFullMetadataToSdkObjectMetadata(\n this.raw,\n v2,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,6CAA6C,QAAQ,4BAA4B;AAE1F,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,kBAAkB,SAASD,YAAY,CAAyB;EAC3EE,WAAWA,CAACC,MAAqB,EAASC,GAA2B,EAAE;IACrE,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,UAAU,CAACC,OAAO,EAAE,oBAAoB,CAAC;IAAC,KADzBF,GAA2B,GAA3BA,GAA2B;EAErE;EAEAG,uBAAuBA,CAACC,EAAW,EAAU;IAC3C,OAAOA,EAAE,GAAG,IAAI,CAACC,YAAY,GAAG,GAAG,IAAI,CAACA,YAAY,KAAK;EAC3D;EAEAC,+BAA+BA,CAACF,EAAW,EAAU;IACnD,OAAO,IAAI,CAACD,uBAAuB,CAACC,EAAE,CAAC;EACzC;EAEAG,sBAAsBA,CAACH,EAAW,EAAkB;IAClD,OAAOT,6CAA6C,CAClD,IAAI,CAACK,GAAG,EACRI,EACF,CAAC;EACH;AACF","ignoreList":[]}
@@ -33,7 +33,7 @@ const defaultCustomizer = (value, defaultValueFormatter, key, defaultKeyFormatte
33
33
  return [defaultKeyFormatter(key), defaultValueFormatter(value)];
34
34
  };
35
35
  export function stringify(obj, customizer = {}, separator = ",\n") {
36
- const defaultKeyFormatter = key => `${JSON.stringify(key)}`;
36
+ const defaultKeyFormatter = key => JSON.stringify(key);
37
37
  const entries = [];
38
38
  const sortedKeys = Object.keys(obj).sort((a, b) => a.localeCompare(b));
39
39
  for (const key of sortedKeys) {
@@ -45,6 +45,8 @@ export function stringify(obj, customizer = {}, separator = ",\n") {
45
45
  } else {
46
46
  entries.push(`${res[0]}: ${res[1]}`);
47
47
  }
48
+ } else if (value === undefined) {
49
+ entries.push(`${defaultKeyFormatter(key)}: undefined`);
48
50
  }
49
51
  }
50
52
  return entries.join(separator);
@@ -1 +1 @@
1
- {"version":3,"file":"stringify.js","names":["defaultCustomizer","value","defaultValueFormatter","key","defaultKeyFormatter","stringify","obj","customizer","separator","JSON","entries","sortedKeys","Object","keys","sort","a","b","localeCompare","res","push","join"],"sources":["stringify.ts"],"sourcesContent":["/*\n * Copyright 2023 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\n/**\n * A function for changing the stringified key/value pairs of an object.\n *\n * @param value The value of the key/value pair.\n * @param defaultValueFormatter The function that would be called if this customizer wasn't used\n * @param key The key of the key/value pair.\n * @param defaultKeyFormatter The function that would be called if this customizer wasn't used\n *\n * @returns A string, a tuple of strings, or undefined.\n * If a string is returned, it will be used as the value of the key/value pair.\n * If a tuple of strings is returned, the first string will be used as the key of the key/value pair\n * and the second string will be used as the value of the key/value pair.\n * If undefined is returned, the pair will be removed\n */\ntype Customizer<K extends string | symbol | number, V extends {}> = (\n value: V,\n defaultValueFormatter: (value: any) => string,\n key: K extends \"*\" ? string : K,\n defaultKeyFormatter: (key: string) => string,\n) => [string, string] | string | undefined;\nconst defaultCustomizer: Customizer<string, any> = (\n value,\n defaultValueFormatter,\n key,\n defaultKeyFormatter,\n) => {\n return [defaultKeyFormatter(key), defaultValueFormatter(value)];\n};\n\nexport function stringify<T extends Record<string, any>>(\n obj: T,\n customizer: {\n [K in keyof T | \"*\"]?: Customizer<K, T[K]>;\n } = {},\n separator = \",\\n\",\n): string {\n const defaultKeyFormatter = (key: string) => `${JSON.stringify(key)}`;\n const entries: Array<string> = [];\n\n const sortedKeys = Object.keys(obj).sort((a, b) => a.localeCompare(b));\n\n for (const key of sortedKeys) {\n const value = obj[key];\n const res =\n (customizer[key as keyof T] ?? customizer[\"*\"] ?? defaultCustomizer)(\n value,\n (value) => JSON.stringify(value, null, 2),\n key as any,\n defaultKeyFormatter,\n );\n\n if (res) {\n if (typeof res === \"string\") {\n entries.push(`${defaultKeyFormatter(key)}: ${res}`);\n } else {\n entries.push(`${res[0]}: ${res[1]}`);\n }\n }\n }\n return entries.join(separator);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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AC,CAAC,CAAC,EAAE,CAAC;MACtC;IACF;EACF;EACA,OAAOR,OAAO,CAACU,IAAI,CAACZ,SAAS,CAAC;AAChC","ignoreList":[]}
1
+ {"version":3,"file":"stringify.js","names":["defaultCustomizer","value","defaultValueFormatter","key","defaultKeyFormatter","stringify","obj","customizer","separator","JSON","entries","sortedKeys","Object","keys","sort","a","b","localeCompare","res","push","undefined","join"],"sources":["stringify.ts"],"sourcesContent":["/*\n * Copyright 2023 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\n/**\n * A function for changing the stringified key/value pairs of an object.\n *\n * @param value The value of the key/value pair.\n * @param defaultValueFormatter The function that would be called if this customizer wasn't used\n * @param key The key of the key/value pair.\n * @param defaultKeyFormatter The function that would be called if this customizer wasn't used\n *\n * @returns A string, a tuple of strings, or undefined.\n * If a string is returned, it will be used as the value of the key/value pair.\n * If a tuple of strings is returned, the first string will be used as the key of the key/value pair\n * and the second string will be used as the value of the key/value pair.\n * If undefined is returned, the pair will be removed\n */\ntype Customizer<K extends string | symbol | number, V extends {}> = (\n value: V,\n defaultValueFormatter: (value: any) => string,\n key: K extends \"*\" ? string : K,\n defaultKeyFormatter: (key: string) => string,\n) => [string, string] | string | undefined;\nconst defaultCustomizer: Customizer<string, any> = (\n value,\n defaultValueFormatter,\n key,\n defaultKeyFormatter,\n) => {\n return [defaultKeyFormatter(key), defaultValueFormatter(value)];\n};\n\nexport function stringify<T extends Record<string, any>>(\n obj: T,\n customizer: {\n [K in keyof T | \"*\"]?: Customizer<K, T[K]>;\n } = {},\n separator = \",\\n\",\n): string {\n const defaultKeyFormatter = (key: string) => JSON.stringify(key);\n const entries: Array<string> = [];\n\n const sortedKeys = Object.keys(obj).sort((a, b) => a.localeCompare(b));\n\n for (const key of sortedKeys) {\n const value = obj[key];\n const res =\n (customizer[key as keyof T] ?? customizer[\"*\"] ?? defaultCustomizer)(\n value,\n (value) => JSON.stringify(value, null, 2),\n key as any,\n defaultKeyFormatter,\n );\n\n if (res) {\n if (typeof res === \"string\") {\n entries.push(`${defaultKeyFormatter(key)}: ${res}`);\n } else {\n entries.push(`${res[0]}: ${res[1]}`);\n }\n } else if (value === undefined) {\n entries.push(`${defaultKeyFormatter(key)}: undefined`);\n }\n }\n return entries.join(separator);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,MAAMA,iBAA0C,GAAGA,CACjDC,KAAK,EACLC,qBAAqB,EACrBC,GAAG,EACHC,mBAAmB,KAChB;EACH,OAAO,CAACA,mBAAmB,CAACD,GAAG,CAAC,EAAED,qBAAqB,CAACD,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,OAAO,SAASI,SAASA,CACvBC,GAAM,EACNC,UAEC,GAAG,CAAC,CAAC,EACNC,SAAS,GAAG,KAAK,EACT;EACR,MAAMJ,mBAAmB,GAAID,GAAW,IAAKM,IAAI,CAACJ,SAAS,CAACF,GAAG,CAAC;EAChE,MAAMO,OAAsB,GAAG,EAAE;EAEjC,MAAMC,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACP,GAAG,CAAC,CAACQ,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,CAAC;EAEtE,KAAK,MAAMb,GAAG,IAAIQ,UAAU,EAAE;IAC5B,MAAMV,KAAK,GAAGK,GAAG,CAACH,GAAG,CAAC;IACtB,MAAMe,GAAG,GACP,CAACX,UAAU,CAACJ,GAAG,CAAY,IAAII,UAAU,CAAC,GAAG,CAAC,IAAIP,iBAAiB,EACjEC,KAAK,EACJA,KAAK,IAAKQ,IAAI,CAACJ,SAAS,CAACJ,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EACzCE,GAAG,EACHC,mBACF,CAAC;IAEH,IAAIc,GAAG,EAAE;MACP,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;QAC3BR,OAAO,CAACS,IAAI,CAAC,GAAGf,mBAAmB,CAACD,GAAG,CAAC,KAAKe,GAAG,EAAE,CAAC;MACrD,CAAC,MAAM;QACLR,OAAO,CAACS,IAAI,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,KAAKA,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;MACtC;IACF,CAAC,MAAM,IAAIjB,KAAK,KAAKmB,SAAS,EAAE;MAC9BV,OAAO,CAACS,IAAI,CAAC,GAAGf,mBAAmB,CAACD,GAAG,CAAC,aAAa,CAAC;IACxD;EACF;EACA,OAAOO,OAAO,CAACW,IAAI,CAACb,SAAS,CAAC;AAChC","ignoreList":[]}
@@ -128,6 +128,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
128
128
  linksType: OsdkObjectLinks$Bar;
129
129
  strictProps: Bar.StrictProps;
130
130
  apiName: "Bar";
131
+ description: undefined;
131
132
  displayName: "Bar";
132
133
  implementedBy: [];
133
134
  implements: [];
@@ -1 +1 @@
1
- {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js","names":["format","describe","expect","it","EnhancedInterfaceType","enhanceOntology","ForeignType","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","simpleSpt","apiName","metadataLevel","dataType","type","rid","displayName","description","undefined","simpleInterface","spts","parents","implementedByObjectTypes","properties","Object","fromEntries","map","spt","required","extendsInterfaces","links","allExtendsInterfaces","allLinks","allProperties","simpleOntology","interfaces","interfaceTypes","i","sharedPropertyTypes","flatMap","entries","actionTypes","objectTypes","ontology","queryTypes","sanitized","importExt","Bar","toBe","Error","formattedCode","parser","printWidth","toMatchInlineSnapshot","fooSpt","barSpt","Foo"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.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 type {\n InterfaceType,\n SharedPropertyType,\n} from \"@osdk/foundry.ontologies\";\nimport { format } from \"prettier\";\nimport { describe, expect, it } from \"vitest\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport type { WireOntologyDefinition } from \"../WireOntologyDefinition.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\n\nfunction simpleSpt<T extends string>(apiName: T, metadataLevel: 0 | 1 | 2 = 2) {\n return {\n apiName,\n dataType: {\n type: \"integer\",\n },\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} property dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} property desc` : undefined,\n } as const satisfies SharedPropertyType;\n}\n\nfunction simpleInterface<T extends string, Q extends SharedPropertyType>(\n apiName: T,\n spts: Q[],\n parents: string[],\n metadataLevel: 0 | 1 | 2 = 2,\n implementedByObjectTypes: string[] = [],\n) {\n const properties = Object.fromEntries(\n spts.map(spt => [spt.apiName, { ...spt, required: true }]),\n );\n\n return {\n apiName,\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} interface dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} interface desc` : undefined,\n extendsInterfaces: parents,\n links: {},\n properties,\n implementedByObjectTypes,\n allExtendsInterfaces: parents,\n allLinks: {},\n allProperties: properties,\n } as const satisfies InterfaceType;\n}\n\nfunction simpleOntology<I extends InterfaceType>(\n apiName: string,\n interfaces: I[],\n) {\n const interfaceTypes: Record<I[\"apiName\"], I> = Object\n .fromEntries(\n interfaces.map(i => [i.apiName, i]),\n ) as Record<string, I>;\n\n const sharedPropertyTypes: Record<string, I[\"properties\"][string]> = Object\n .fromEntries(\n interfaces.flatMap(i => Object.entries(i.properties)),\n ) as Record<string, I[\"properties\"][string]>;\n\n return {\n actionTypes: {},\n interfaceTypes,\n objectTypes: {},\n ontology: {\n apiName,\n description: `${apiName} ontology desc`,\n displayName: `${apiName} ontology dn`,\n rid: `${apiName} ontology rid`,\n },\n queryTypes: {},\n sharedPropertyTypes,\n } as const satisfies WireOntologyDefinition;\n}\n\ndescribe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {\n it(\"Does not say (inherited) on properties locally defined\", async () => {\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Bar\", [simpleSpt(\"bar\", 0)], [], 0),\n ]),\n importExt: \"\",\n });\n\n expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(\n true,\n );\n\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Bar,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n printWidth: 100,\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Bar = {};\n\n export namespace Bar {\n export type PropertyKeys = \"bar\";\n\n export interface Props {\n /**\n * (no ontology metadata)\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = $Osdk.Instance<Bar, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Bar extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Bar\";\n __DefinitionMetadata?: {\n objectSet: Bar.ObjectSet;\n props: Bar.Props;\n linksType: OsdkObjectLinks$Bar;\n strictProps: Bar.StrictProps;\n apiName: \"Bar\";\n displayName: \"Bar\";\n implementedBy: [];\n implements: [];\n links: {};\n properties: {\n /**\n * (no ontology metadata)\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"BarRid\";\n type: \"interface\";\n };\n }\n\n export const Bar: Bar = {\n type: \"interface\",\n apiName: \"Bar\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\" | \"bar\";\n\n export interface Props {\n /**\n * display name: 'bar property dn',\n * description: bar property desc\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'bar property dn',\n * description: bar property desc\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n it(\"Generates map for implementedBy\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"], 2, [\"childrenObject\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [\"childrenObject\"];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,qBAAqB,QAAQ,6CAA6C;AACnF,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,WAAW,QAAQ,mCAAmC;AAE/D,SAASC,8CAA8C,QAAQ,mDAAmD;AAElH,SAASC,SAASA,CAAmBC,OAAU,EAAEC,aAAwB,GAAG,CAAC,EAAE;EAC7E,OAAO;IACLD,OAAO;IACPE,QAAQ,EAAE;MACRC,IAAI,EAAE;IACR,CAAC;IACDC,GAAG,EAAE,GAAGJ,OAAO,KAAK;IACpBK,WAAW,EAAEJ,aAAa,IAAI,CAAC,GAAG,GAAGD,OAAO,cAAc,GAAGA,OAAO;IACpEM,WAAW,EAAEL,aAAa,IAAI,CAAC,GAAG,GAAGD,OAAO,gBAAgB,GAAGO;EACjE,CAAC;AACH;AAEA,SAASC,eAAeA,CACtBR,OAAU,EACVS,IAAS,EACTC,OAAiB,EACjBT,aAAwB,GAA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AAgB,CAAC,CAAC,EACnEnC,eAAe,CAAC,QAAQ,EAAE,CAACoC,MAAM,CAAC,EAAE,EAAE,CAAC,CACxC,CAAC;MAEFT,SAAS,EAAE;IACb,CACF,CAAC;IAED,MAAMI,aAAa,GAAG,MAAMhD,MAAM,CAChCO,8CAA8C,CAC5CkC,QAAQ,CAACP,cAAc,CAACoB,GAAG,EAC3Bb,QAAQ,EACR,IAAI,EACJ,IACF,CAAC,EACD;MACEQ,MAAM,EAAE;IACV,CACF,CAAC;IACD/C,MAAM,CAAC8C,aAAa,CAAC,CAACG,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js","names":["format","describe","expect","it","EnhancedInterfaceType","enhanceOntology","ForeignType","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","simpleSpt","apiName","metadataLevel","dataType","type","rid","displayName","description","undefined","simpleInterface","spts","parents","implementedByObjectTypes","properties","Object","fromEntries","map","spt","required","extendsInterfaces","links","allExtendsInterfaces","allLinks","allProperties","simpleOntology","interfaces","interfaceTypes","i","sharedPropertyTypes","flatMap","entries","actionTypes","objectTypes","ontology","queryTypes","sanitized","importExt","Bar","toBe","Error","formattedCode","parser","printWidth","toMatchInlineSnapshot","fooSpt","barSpt","Foo"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.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 type {\n InterfaceType,\n SharedPropertyType,\n} from \"@osdk/foundry.ontologies\";\nimport { format } from \"prettier\";\nimport { describe, expect, it } from \"vitest\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport type { WireOntologyDefinition } from \"../WireOntologyDefinition.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\n\nfunction simpleSpt<T extends string>(apiName: T, metadataLevel: 0 | 1 | 2 = 2) {\n return {\n apiName,\n dataType: {\n type: \"integer\",\n },\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} property dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} property desc` : undefined,\n } as const satisfies SharedPropertyType;\n}\n\nfunction simpleInterface<T extends string, Q extends SharedPropertyType>(\n apiName: T,\n spts: Q[],\n parents: string[],\n metadataLevel: 0 | 1 | 2 = 2,\n implementedByObjectTypes: string[] = [],\n) {\n const properties = Object.fromEntries(\n spts.map(spt => [spt.apiName, { ...spt, required: true }]),\n );\n\n return {\n apiName,\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} interface dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} interface desc` : undefined,\n extendsInterfaces: parents,\n links: {},\n properties,\n implementedByObjectTypes,\n allExtendsInterfaces: parents,\n allLinks: {},\n allProperties: properties,\n } as const satisfies InterfaceType;\n}\n\nfunction simpleOntology<I extends InterfaceType>(\n apiName: string,\n interfaces: I[],\n) {\n const interfaceTypes: Record<I[\"apiName\"], I> = Object\n .fromEntries(\n interfaces.map(i => [i.apiName, i]),\n ) as Record<string, I>;\n\n const sharedPropertyTypes: Record<string, I[\"properties\"][string]> = Object\n .fromEntries(\n interfaces.flatMap(i => Object.entries(i.properties)),\n ) as Record<string, I[\"properties\"][string]>;\n\n return {\n actionTypes: {},\n interfaceTypes,\n objectTypes: {},\n ontology: {\n apiName,\n description: `${apiName} ontology desc`,\n displayName: `${apiName} ontology dn`,\n rid: `${apiName} ontology rid`,\n },\n queryTypes: {},\n sharedPropertyTypes,\n } as const satisfies WireOntologyDefinition;\n}\n\ndescribe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {\n it(\"Does not say (inherited) on properties locally defined\", async () => {\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Bar\", [simpleSpt(\"bar\", 0)], [], 0),\n ]),\n importExt: \"\",\n });\n\n expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(\n true,\n );\n\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Bar,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n printWidth: 100,\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Bar = {};\n\n export namespace Bar {\n export type PropertyKeys = \"bar\";\n\n export interface Props {\n /**\n * (no ontology metadata)\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = $Osdk.Instance<Bar, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Bar extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Bar\";\n __DefinitionMetadata?: {\n objectSet: Bar.ObjectSet;\n props: Bar.Props;\n linksType: OsdkObjectLinks$Bar;\n strictProps: Bar.StrictProps;\n apiName: \"Bar\";\n description: undefined;\n displayName: \"Bar\";\n implementedBy: [];\n implements: [];\n links: {};\n properties: {\n /**\n * (no ontology metadata)\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"BarRid\";\n type: \"interface\";\n };\n }\n\n export const Bar: Bar = {\n type: \"interface\",\n apiName: \"Bar\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\" | \"bar\";\n\n export interface Props {\n /**\n * display name: 'bar property dn',\n * description: bar property desc\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'bar property dn',\n * description: bar property desc\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n it(\"Generates map for implementedBy\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"], 2, [\"childrenObject\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [\"childrenObject\"];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAMA,SAASA,MAAM,QAAQ,UAAU;AACjC,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,qBAAqB,QAAQ,6CAA6C;AACnF,SAASC,eAAe,QAAQ,uCAAuC;AACvE,SAASC,WAAW,QAAQ,mCAAmC;AAE/D,SAASC,8CAA8C,QAAQ,mDAAmD;AAElH,SAASC,SAASA,CAAmBC,OAAU,EAAEC,aAAwB,GAAG,CAAC,EAAE;EAC7E,OAAO;IACLD,OAAO;IACPE,QAAQ,EAAE;MACRC,IAAI,EAAE;IACR,CAAC;IACDC,GAAG,EAAE,GAAGJ,OAAO,KAAK;IACpBK,WAAW,EAAEJ,aAAa,IAAI,CAAC,GAAG,GAAGD,OAAO,cAAc,GAAGA,OAAO;IACpEM,WAAW,EAAEL,aAAa,IAAI,CAAC,GAAG,GAAGD,OAAO,gBAAgB,GAAGO;EACjE,CAAC;AACH;AAEA,SAASC,eAAeA,CACtBR,OAAU,EACVS,IAAS,EACTC,OAAiB,EACjBT,aAAwB,GAAG,CAAC,EAC5BU,wBAAkC,GAAG,EAAE,EACvC;EACA,MAAMC,UAAU,GAAGC,MAAM,CAACC,WAAW,CACnCL,IAAI,CAACM,GAAG,CAACC,GAAG,IAAI,CAACA,GAAG,CAAChB,O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I,aAAa,GAAG,MAAMhD,MAAM,CAChCO,8CAA8C,CAC5CkC,QAAQ,CAACP,cAAc,CAACoB,GAAG,EAC3Bb,QAAQ,EACR,IAAI,EACJ,IACF,CAAC,EACD;MACEQ,MAAM,EAAE;IACV,CACF,CAAC;IACD/C,MAAM,CAAC8C,aAAa,CAAC,CAACG,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -752,6 +752,7 @@ describe("generator", () => {
752
752
  status: 'ACTIVE';
753
753
  titleProperty: 'email';
754
754
  type: 'object';
755
+ visibility: undefined;
755
756
  };
756
757
  }
757
758
 
@@ -869,6 +870,7 @@ describe("generator", () => {
869
870
  status: 'ACTIVE';
870
871
  titleProperty: 'body';
871
872
  type: 'object';
873
+ visibility: undefined;
872
874
  };
873
875
  }
874
876
 
@@ -1356,6 +1358,7 @@ describe("generator", () => {
1356
1358
  status: 'ACTIVE';
1357
1359
  titleProperty: 'email';
1358
1360
  type: 'object';
1361
+ visibility: undefined;
1359
1362
  };
1360
1363
  }
1361
1364
 
@@ -1473,6 +1476,7 @@ describe("generator", () => {
1473
1476
  status: 'ACTIVE';
1474
1477
  titleProperty: 'body';
1475
1478
  type: 'object';
1479
+ visibility: undefined;
1476
1480
  };
1477
1481
  }
1478
1482
 
@@ -1777,6 +1781,7 @@ describe("generator", () => {
1777
1781
  linksType: UsesForeignSpt.Links;
1778
1782
  strictProps: UsesForeignSpt.StrictProps;
1779
1783
  apiName: 'UsesForeignSpt';
1784
+ description: undefined;
1780
1785
  displayName: 'Uses Foreign Spt';
1781
1786
  icon: {
1782
1787
  type: 'blueprint';
@@ -1804,6 +1809,7 @@ describe("generator", () => {
1804
1809
  status: 'ACTIVE';
1805
1810
  titleProperty: 'id';
1806
1811
  type: 'object';
1812
+ visibility: undefined;
1807
1813
  };
1808
1814
  }
1809
1815
 
@@ -1835,11 +1841,13 @@ describe("generator", () => {
1835
1841
  // Represents the definition of the parameters for the action
1836
1842
  export type ParamsDefinition = {
1837
1843
  body: {
1844
+ description: undefined;
1838
1845
  multiplicity: false;
1839
1846
  nullable: false;
1840
1847
  type: 'string';
1841
1848
  };
1842
1849
  task: {
1850
+ description: undefined;
1843
1851
  multiplicity: false;
1844
1852
  nullable: false;
1845
1853
  type: ActionMetadata.DataType.Object<$Imported$com$example$dep$Task>;
@@ -2025,6 +2033,7 @@ describe("generator", () => {
2025
2033
  status: 'ACTIVE';
2026
2034
  titleProperty: 'email';
2027
2035
  type: 'object';
2036
+ visibility: undefined;
2028
2037
  };
2029
2038
  }
2030
2039
 
@@ -2142,6 +2151,7 @@ describe("generator", () => {
2142
2151
  status: 'ACTIVE';
2143
2152
  titleProperty: 'body';
2144
2153
  type: 'object';
2154
+ visibility: undefined;
2145
2155
  };
2146
2156
  }
2147
2157
 
@@ -2351,6 +2361,7 @@ describe("generator", () => {
2351
2361
  linksType: OsdkObjectLinks$SomeInterface;
2352
2362
  strictProps: SomeInterface.StrictProps;
2353
2363
  apiName: 'com.example.dep.SomeInterface';
2364
+ description: undefined;
2354
2365
  displayName: 'Sum Interface';
2355
2366
  implementedBy: [];
2356
2367
  implements: [];
@@ -2435,6 +2446,7 @@ describe("generator", () => {
2435
2446
  linksType: Task.Links;
2436
2447
  strictProps: Task.StrictProps;
2437
2448
  apiName: 'com.example.dep.Task';
2449
+ description: undefined;
2438
2450
  displayName: 'Task';
2439
2451
  icon: {
2440
2452
  type: 'blueprint';
@@ -2462,6 +2474,7 @@ describe("generator", () => {
2462
2474
  status: 'ACTIVE';
2463
2475
  titleProperty: 'taskId';
2464
2476
  type: 'object';
2477
+ visibility: undefined;
2465
2478
  };
2466
2479
  }
2467
2480