@osdk/generator 2.1.0-beta.2 → 2.1.0-beta.4

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 (24) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +2 -2
  3. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  4. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +9 -16
  5. package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  6. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +27 -51
  7. package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  8. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  9. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +6 -3
  10. package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  11. package/build/browser/validateWireOntologyAssumptions.js +2 -2
  12. package/build/browser/validateWireOntologyAssumptions.js.map +1 -1
  13. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +2 -2
  14. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
  15. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +9 -16
  16. package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
  17. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +27 -51
  18. package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
  19. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
  20. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +6 -3
  21. package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
  22. package/build/esm/validateWireOntologyAssumptions.js +2 -2
  23. package/build/esm/validateWireOntologyAssumptions.js.map +1 -1
  24. package/package.json +4 -4
package/CHANGELOG.md CHANGED
@@ -1,5 +1,33 @@
1
1
  # @osdk/generator
2
2
 
3
+ ## 2.1.0-beta.4
4
+
5
+ ### Minor Changes
6
+
7
+ - 0dc40b0: Remove experimental non null for now.
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [0dc40b0]
12
+ - Updated dependencies [1dc0228]
13
+ - Updated dependencies [d3b3f35]
14
+ - @osdk/api@2.1.0-beta.4
15
+ - @osdk/generator-converters@2.1.0-beta.4
16
+
17
+ ## 2.1.0-beta.3
18
+
19
+ ### Minor Changes
20
+
21
+ - 09eaf24: Update to latest platform sdks
22
+
23
+ ### Patch Changes
24
+
25
+ - Updated dependencies [05febf4]
26
+ - Updated dependencies [b79becf]
27
+ - Updated dependencies [09eaf24]
28
+ - @osdk/api@2.1.0-beta.3
29
+ - @osdk/generator-converters@2.1.0-beta.3
30
+
3
31
  ## 2.1.0-beta.2
4
32
 
5
33
  ### Patch Changes
@@ -43,9 +43,9 @@ export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ont
43
43
  }
44
44
  for (const apiName of Object.keys(parent.properties)) {
45
45
  if (definition.properties[apiName] != null) {
46
- !fastDeepEqual(definition.properties[apiName], parent.properties[apiName]) ? invariant(false, `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`) : void 0;
46
+ !fastDeepEqual(definition.properties[apiName], parent.properties[apiName]) ? process.env.NODE_ENV !== "production" ? invariant(false, `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`) : invariant(false) : void 0;
47
47
  } else if (mergedProperties[apiName] != null) {
48
- !fastDeepEqual(mergedProperties[apiName], parent.properties[apiName]) ? invariant(false, `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`) : void 0;
48
+ !fastDeepEqual(mergedProperties[apiName], parent.properties[apiName]) ? process.env.NODE_ENV !== "production" ? invariant(false, `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`) : invariant(false) : void 0;
49
49
  }
50
50
  mergedProperties[apiName] = parent.properties[apiName];
51
51
  }
@@ -1 +1 @@
1
- {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","fastDeepEqual","invariant","extractNamespace","EnhancedInterfaceType","deleteUndefineds","stringify","createDefinition","createObjectSet","createOsdkObject","createPropertyKeys","createProps","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","interfaceDef","ontology","v2","definition","raw","objectDefIdentifier","getDefinitionIdentifier","parents","implements","map","p","parent","requireInterfaceType","it","mergedProperties","properties","apiName","Object","keys","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","ids","apiNamespace","badProperties","filter","length","Error","fullApiName","join","links","linkTarget","requireObjectType","targetType","getImportedDefinitionIdentifier","multiplicity"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js"],"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 */\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport fastDeepEqual from \"fast-deep-equal\";\nimport invariant from \"tiny-invariant\";\nimport { extractNamespace } from \"../GenerateContext/EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport { createDefinition, createObjectSet, createOsdkObject, createPropertyKeys, createProps, } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {\n const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n const parents = definition.implements?.map(p => {\n const parent = ontology.requireInterfaceType(p, true);\n if (parent instanceof EnhancedInterfaceType) {\n const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(parent.raw, v2));\n return it;\n }\n }) ?? [];\n const mergedProperties = { ...definition.properties };\n for (const parent of parents) {\n if (parent == null) {\n // came from a foreign type and we cannot merge properties yet\n // so if they weren't listed on the interface its over\n continue;\n }\n for (const apiName of Object.keys(parent.properties)) {\n if (definition.properties[apiName] != null) {\n invariant(fastDeepEqual(definition.properties[apiName], parent.properties[apiName]), `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`);\n }\n else if (mergedProperties[apiName] != null) {\n invariant(fastDeepEqual(mergedProperties[apiName], parent.properties[apiName]), `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`);\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n definition.properties = mergedProperties;\n const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n const ids = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n if (interfaceDef.apiNamespace) {\n const badProperties = Object.keys(definition.properties).filter(apiName => extractNamespace(apiName)[0] == null);\n if (badProperties.length > 0) {\n throw new Error(`Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${badProperties.join(\", \")}`);\n }\n }\n function getV2Types() {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n \n ${Object.keys(definition.links).length === 0\n ? `export type ${osdkObjectLinksIdentifier} = {};`\n : `\n export interface ${osdkObjectLinksIdentifier} {\n${stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(v2);\n return `${definition.multiplicity\n ? `${linkTarget}[\"objectSet\"]`\n : `SingleLinkAccessor<${linkTarget}>`}\n `;\n },\n })}\n }\n `}\n\n export namespace ${interfaceDef.shortApiName} {\n\n ${createPropertyKeys(interfaceDef)}\n\n\n ${createProps(interfaceDef, \"Props\", false)}\n ${createProps(interfaceDef, \"StrictProps\", true)}\n\n\n ${createObjectSet(interfaceDef, ids)}\n\n ${createOsdkObject(interfaceDef, \"OsdkInstance\", ids)}\n \n } \n\n ${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}\n\n`;\n }\n // FIXME: We need to fill in the imports\n // if we want links to work\n const imports = [];\n definition;\n return `${imports.join(\"\\n\")}\n ${v2 ? getV2Types() : \"\"}\n\n export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {\n type: \"interface\",\n apiName: \"${interfaceDef.fullApiName}\",\n osdkMetadata: $osdkMetadata,\n };`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,qBAAqB,QAAQ,6CAA6C;AACnF,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,gBAAgB,EAAEC,eAAe,EAAEC,gBAAgB,EAAEC,kBAAkB,EAAEC,WAAW,QAAS,yCAAyC;AAC/I;AACA,OAAO,SAASC,8CAA8CA,CAACC,YAAY,EAAEC,QAAQ,EAAEC,EAAE,GAAG,KAAK,EAAE;EAC/F,MAAMC,UAAU,GAAGX,gBAAgB,CAACL,mDAAmD,CAACa,YAAY,CAACI,GAAG,EAAEF,EAAE,CAAC,CAAC;EAC9G,MAAMG,mBAAmB,GAAGL,YAAY,CAACM,uBAAuB,CAACJ,EAAE,CAAC;EACpE,MAAMK,OAAO,GAAGJ,UAAU,CAACK,UAAU,EAAEC,GAAG,CAACC,CAAC,IAAI;IAC5C,MAAMC,MAAM,GAAGV,QAAQ,CAACW,oBAAoB,CAACF,CAAC,EAAE,IAAI,CAAC;IACrD,IAAIC,MAAM,YAAYpB,qBAAqB,EAAE;MACzC,MAAMsB,EAAE,GAAGrB,gBAAgB,CAACL,mDAAmD,CAACwB,MAAM,CAACP,GAAG,EAAEF,EAAE,CAAC,CAAC;MAChG,OAAOW,EAAE;IACb;EACJ,CAAC,CAAC,IAAI,EAAE;EACR,MAAMC,gB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C;AACd;AACA,KAAK;AACL;AACA,uBAAuBnC,YAAY,CAACoB,YAAY;AAChD;AACA,QAAQvB,kBAAkB,CAACG,YAAY,CAAC;AACxC;AACA;AACA,QAAQF,WAAW,CAACE,YAAY,EAAE,OAAO,EAAE,KAAK,CAAC;AACjD,QAAQF,WAAW,CAACE,YAAY,EAAE,aAAa,EAAE,IAAI,CAAC;AACtD;AACA;AACA,QAAQL,eAAe,CAACK,YAAY,EAAE0B,GAAG,CAAC;AAC1C;AACA,QAAQ9B,gBAAgB,CAACI,YAAY,EAAE,cAAc,EAAE0B,GAAG,CAAC;AAC3D;AACA;AACA;AACA,MAAMhC,gBAAgB,CAACM,YAAY,EAAEC,QAAQ,EAAED,YAAY,CAACoB,YAAY,EAAEM,GAAG,CAAC;AAC9E;AACA,CAAC;EACG,CAAC,CAMiB,CAAC,GAAG,EAAE;AAC5B;AACA,mBAAmB1B,YAAY,CAACoB,YAAY,KAAKpB,YAAY,CAACoB,YAAY;AAC1E;AACA,kBAAkBpB,YAAY,CAACgC,WAAW;AAC1C;AACA,UAAU;AACV","ignoreList":[]}
1
+ {"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","fastDeepEqual","invariant","extractNamespace","EnhancedInterfaceType","deleteUndefineds","stringify","createDefinition","createObjectSet","createOsdkObject","createPropertyKeys","createProps","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","interfaceDef","ontology","v2","definition","raw","objectDefIdentifier","getDefinitionIdentifier","parents","implements","map","p","parent","requireInterfaceType","it","mergedProperties","properties","apiName","Object","keys","process","env","NODE_ENV","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","ids","apiNamespace","badProperties","filter","length","Error","fullApiName","join","links","linkTarget","requireObjectType","targetType","getImportedDefinitionIdentifier","multiplicity"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js"],"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 */\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport fastDeepEqual from \"fast-deep-equal\";\nimport invariant from \"tiny-invariant\";\nimport { extractNamespace } from \"../GenerateContext/EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport { createDefinition, createObjectSet, createOsdkObject, createPropertyKeys, createProps, } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false) {\n const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n const parents = definition.implements?.map(p => {\n const parent = ontology.requireInterfaceType(p, true);\n if (parent instanceof EnhancedInterfaceType) {\n const it = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(parent.raw, v2));\n return it;\n }\n }) ?? [];\n const mergedProperties = { ...definition.properties };\n for (const parent of parents) {\n if (parent == null) {\n // came from a foreign type and we cannot merge properties yet\n // so if they weren't listed on the interface its over\n continue;\n }\n for (const apiName of Object.keys(parent.properties)) {\n if (definition.properties[apiName] != null) {\n invariant(fastDeepEqual(definition.properties[apiName], parent.properties[apiName]), `Interface ${definition.apiName} redefines property '${apiName}' from parent '${parent.apiName}' but the properties do not match`);\n }\n else if (mergedProperties[apiName] != null) {\n invariant(fastDeepEqual(mergedProperties[apiName], parent.properties[apiName]), `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`);\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n definition.properties = mergedProperties;\n const objectSetIdentifier = `${interfaceDef.shortApiName}.ObjectSet`;\n const propertyKeysIdentifier = `${interfaceDef.shortApiName}.PropertyKeys`;\n // const osdkObjectPropsIdentifier = `OsdkObjectProps$${objectDefIdentifier}`;\n const osdkObjectPropsIdentifier = `${interfaceDef.shortApiName}.Props`;\n const osdkObjectStrictPropsIdentifier = `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n const ids = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n if (interfaceDef.apiNamespace) {\n const badProperties = Object.keys(definition.properties).filter(apiName => extractNamespace(apiName)[0] == null);\n if (badProperties.length > 0) {\n throw new Error(`Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${badProperties.join(\", \")}`);\n }\n }\n function getV2Types() {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n \n ${Object.keys(definition.links).length === 0\n ? `export type ${osdkObjectLinksIdentifier} = {};`\n : `\n export interface ${osdkObjectLinksIdentifier} {\n${stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = ontology.requireObjectType(definition.targetType)\n .getImportedDefinitionIdentifier(v2);\n return `${definition.multiplicity\n ? `${linkTarget}[\"objectSet\"]`\n : `SingleLinkAccessor<${linkTarget}>`}\n `;\n },\n })}\n }\n `}\n\n export namespace ${interfaceDef.shortApiName} {\n\n ${createPropertyKeys(interfaceDef)}\n\n\n ${createProps(interfaceDef, \"Props\", false)}\n ${createProps(interfaceDef, \"StrictProps\", true)}\n\n\n ${createObjectSet(interfaceDef, ids)}\n\n ${createOsdkObject(interfaceDef, \"OsdkInstance\", ids)}\n \n } \n\n ${createDefinition(interfaceDef, ontology, interfaceDef.shortApiName, ids)}\n\n`;\n }\n // FIXME: We need to fill in the imports\n // if we want links to work\n const imports = [];\n definition;\n return `${imports.join(\"\\n\")}\n ${v2 ? getV2Types() : \"\"}\n\n export const ${interfaceDef.shortApiName}: ${interfaceDef.shortApiName} = {\n type: \"interface\",\n apiName: \"${interfaceDef.fullApiName}\",\n osdkMetadata: $osdkMetadata,\n };`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,qBAAqB,QAAQ,6CAA6C;AACnF,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SAASC,SAAS,QAAQ,sBAAsB;AAChD,SAASC,gBAAgB,EAAEC,eAAe,EAAEC,gBAAgB,EAAEC,kBAAkB,EAAEC,WAAW,QAAS,yCAAyC;AAC/I;AACA,OAAO,SAASC,8CAA8CA,CAACC,YAAY,EAAEC,QAAQ,EAAEC,EAAE,GAAG,KAAK,EAAE;EAC/F,MAAMC,UAAU,GAAGX,gBAAgB,CAACL,mDAAmD,CAACa,YAAY,CAACI,GAAG,EAAEF,EAAE,CAAC,CAAC;EAC9G,MA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+90,18 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
90
90
  export interface Props {
91
91
  readonly bar: $PropType["integer"] | undefined;
92
92
  }
93
- export interface StrictProps {
94
- readonly bar: $PropType["integer"] | undefined;
95
- }
93
+ export type StrictProps = Props;
96
94
 
97
95
  export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}
98
96
 
99
97
  export type OsdkInstance<
100
- OPTIONS extends never | "$notStrict" | "$rid" = never,
98
+ OPTIONS extends never | "$rid" = never,
101
99
  K extends keyof Bar.Props = keyof Bar.Props,
102
100
  > = $Osdk.Instance<Bar, OPTIONS, K>;
103
101
 
104
102
  /** @deprecated use OsdkInstance */
105
103
  export type OsdkObject<
106
- OPTIONS extends never | "$notStrict" | "$rid" = never,
104
+ OPTIONS extends never | "$rid" = never,
107
105
  K extends keyof Bar.Props = keyof Bar.Props,
108
106
  > = OsdkInstance<OPTIONS, K>;
109
107
  }
@@ -166,20 +164,18 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
166
164
  export interface Props {
167
165
  readonly foo: $PropType["integer"] | undefined;
168
166
  }
169
- export interface StrictProps {
170
- readonly foo: $PropType["integer"] | undefined;
171
- }
167
+ export type StrictProps = Props;
172
168
 
173
169
  export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}
174
170
 
175
171
  export type OsdkInstance<
176
- OPTIONS extends never | "$notStrict" | "$rid" = never,
172
+ OPTIONS extends never | "$rid" = never,
177
173
  K extends keyof Foo.Props = keyof Foo.Props,
178
174
  > = $Osdk.Instance<Foo, OPTIONS, K>;
179
175
 
180
176
  /** @deprecated use OsdkInstance */
181
177
  export type OsdkObject<
182
- OPTIONS extends never | "$notStrict" | "$rid" = never,
178
+ OPTIONS extends never | "$rid" = never,
183
179
  K extends keyof Foo.Props = keyof Foo.Props,
184
180
  > = OsdkInstance<OPTIONS, K>;
185
181
  }
@@ -245,21 +241,18 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
245
241
  readonly bar: $PropType["integer"] | undefined;
246
242
  readonly foo: $PropType["integer"] | undefined;
247
243
  }
248
- export interface StrictProps {
249
- readonly bar: $PropType["integer"] | undefined;
250
- readonly foo: $PropType["integer"] | undefined;
251
- }
244
+ export type StrictProps = Props;
252
245
 
253
246
  export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}
254
247
 
255
248
  export type OsdkInstance<
256
- OPTIONS extends never | "$notStrict" | "$rid" = never,
249
+ OPTIONS extends never | "$rid" = never,
257
250
  K extends keyof Foo.Props = keyof Foo.Props,
258
251
  > = $Osdk.Instance<Foo, OPTIONS, K>;
259
252
 
260
253
  /** @deprecated use OsdkInstance */
261
254
  export type OsdkObject<
262
- OPTIONS extends never | "$notStrict" | "$rid" = never,
255
+ OPTIONS extends never | "$rid" = never,
263
256
  K extends keyof Foo.Props = keyof Foo.Props,
264
257
  > = OsdkInstance<OPTIONS, K>;
265
258
  }
@@ -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","properties","Object","fromEntries","map","spt","extendsInterfaces","links","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.js"],"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 */\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 { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\nfunction simpleSpt(apiName, metadataLevel = 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 };\n}\nfunction simpleInterface(apiName, spts, parents, metadataLevel = 2) {\n const properties = Object.fromEntries(spts.map(spt => [spt.apiName, spt]));\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 };\n}\nfunction simpleOntology(apiName, interfaces) {\n const interfaceTypes = Object\n .fromEntries(interfaces.map(i => [i.apiName, i]));\n const sharedPropertyTypes = Object\n .fromEntries(interfaces.flatMap(i => Object.entries(i.properties)));\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 };\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 expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(true);\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Bar, ontology, true), {\n parser: \"typescript\",\n printWidth: 100,\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 readonly bar: $PropType[\"integer\"] | undefined;\n }\n export interface StrictProps {\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$notStrict\" | \"$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 | \"$notStrict\" | \"$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 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 it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n });\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {\n parser: \"typescript\",\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 readonly foo: $PropType[\"integer\"] | undefined;\n }\n export interface StrictProps {\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$notStrict\" | \"$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 | \"$notStrict\" | \"$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 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 it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n });\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {\n parser: \"typescript\",\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 readonly bar: $PropType[\"integer\"] | undefined;\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export interface StrictProps {\n readonly bar: $PropType[\"integer\"] | undefined;\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$notStrict\" | \"$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 | \"$notStrict\" | \"$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 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});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,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;AAC/D,SAASC,8CAA8C,QAAQ,mDAAmD;AAClH,SAASC,SAASA,CAACC,OAAO,EAAEC,aAAa,GAAG,CAAC,EAAE;EAC3C,OAAO;IACHD,OAAO;IACPE,QAAQ,EAAE;MACNC,IAAI,EAAE;IACV,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;EACnE,CAAC;AACL;AACA,SAASC,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,CAAC+B,MAAM,CAAC,EAAE,EAAE,CAAC,CAC1C,CAAC;MACFT,SAAS,EAAE;IACf,CAAC,CAAC;IACF,MAAMI,aAAa,GAAG,MAAM3C,MAAM,CAACO,8CAA8C,CAAC6B,QAAQ,CAACP,cAAc,CAACoB,GAAG,EAAEb,QAAQ,EAAE,IAAI,CAAC,EAAE;MAC5HQ,MAAM,EAAE;IACZ,CAAC,CAAC;IACF1C,MAAM,CAACyC,aAAa,CAAC,CAACG,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;EACF,CAAC,CAAC;AACN,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","properties","Object","fromEntries","map","spt","extendsInterfaces","links","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.js"],"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 */\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 { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\nfunction simpleSpt(apiName, metadataLevel = 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 };\n}\nfunction simpleInterface(apiName, spts, parents, metadataLevel = 2) {\n const properties = Object.fromEntries(spts.map(spt => [spt.apiName, spt]));\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 };\n}\nfunction simpleOntology(apiName, interfaces) {\n const interfaceTypes = Object\n .fromEntries(interfaces.map(i => [i.apiName, i]));\n const sharedPropertyTypes = Object\n .fromEntries(interfaces.flatMap(i => Object.entries(i.properties)));\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 };\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 expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(true);\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Bar, ontology, true), {\n parser: \"typescript\",\n printWidth: 100,\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 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 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 it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n });\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {\n parser: \"typescript\",\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 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 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 it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n });\n const formattedCode = await format(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(ontology.interfaceTypes.Foo, ontology, true), {\n parser: \"typescript\",\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 readonly bar: $PropType[\"integer\"] | undefined;\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 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});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,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;AAC/D,SAASC,8CAA8C,QAAQ,mDAAmD;AAClH,SAASC,SAASA,CAACC,OAAO,EAAEC,aAAa,GAAG,CAAC,EAAE;EAC3C,OAAO;IACHD,OAAO;IACPE,QAAQ,EAAE;MACNC,IAAI,EAAE;IACV,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;EACnE,CAAC;AACL;AACA,SAASC,eAAeA,CAACR,OAAO,EAAES,IAAI,EAAEC,OAAO,EAAET,aAAa,GAAG,CAAC,EAAE;EAChE,MAAMU,UAAU,G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AM3C,MAAM,CAACO,8CAA8C,CAAC6B,QAAQ,CAACP,cAAc,CAACoB,GAAG,EAAEb,QAAQ,EAAE,IAAI,CAAC,EAAE;MAC5HQ,MAAM,EAAE;IACZ,CAAC,CAAC;IACF1C,MAAM,CAACyC,aAAa,CAAC,CAACG,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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;EACF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -566,20 +566,18 @@ describe("generator", () => {
566
566
  export interface Props {
567
567
  readonly SomeProperty: $PropType['string'] | undefined;
568
568
  }
569
- export interface StrictProps {
570
- readonly SomeProperty: $PropType['string'] | undefined;
571
- }
569
+ export type StrictProps = Props;
572
570
 
573
571
  export interface ObjectSet extends $ObjectSet<SomeInterface, SomeInterface.ObjectSet> {}
574
572
 
575
573
  export type OsdkInstance<
576
- OPTIONS extends never | '$notStrict' | '$rid' = never,
574
+ OPTIONS extends never | '$rid' = never,
577
575
  K extends keyof SomeInterface.Props = keyof SomeInterface.Props,
578
576
  > = $Osdk.Instance<SomeInterface, OPTIONS, K>;
579
577
 
580
578
  /** @deprecated use OsdkInstance */
581
579
  export type OsdkObject<
582
- OPTIONS extends never | '$notStrict' | '$rid' = never,
580
+ OPTIONS extends never | '$rid' = never,
583
581
  K extends keyof SomeInterface.Props = keyof SomeInterface.Props,
584
582
  > = OsdkInstance<OPTIONS, K>;
585
583
  }
@@ -644,22 +642,20 @@ describe("generator", () => {
644
642
  }
645
643
 
646
644
  export interface Props {
647
- readonly email: $PropType['string'] | undefined;
648
- }
649
- export interface StrictProps {
650
645
  readonly email: $PropType['string'];
651
646
  }
647
+ export type StrictProps = Props;
652
648
 
653
649
  export interface ObjectSet extends $ObjectSet<Person, Person.ObjectSet> {}
654
650
 
655
651
  export type OsdkInstance<
656
- OPTIONS extends never | '$notStrict' | '$rid' = never,
652
+ OPTIONS extends never | '$rid' = never,
657
653
  K extends keyof Person.Props = keyof Person.Props,
658
654
  > = $Osdk.Instance<Person, OPTIONS, K>;
659
655
 
660
656
  /** @deprecated use OsdkInstance */
661
657
  export type OsdkObject<
662
- OPTIONS extends never | '$notStrict' | '$rid' = never,
658
+ OPTIONS extends never | '$rid' = never,
663
659
  K extends keyof Person.Props = keyof Person.Props,
664
660
  > = OsdkInstance<OPTIONS, K>;
665
661
  }
@@ -734,26 +730,22 @@ describe("generator", () => {
734
730
  }
735
731
 
736
732
  export interface Props {
737
- readonly body: $PropType['string'] | undefined;
738
- readonly complete: $PropType['boolean'] | undefined;
739
- readonly id: $PropType['integer'] | undefined;
740
- }
741
- export interface StrictProps {
742
733
  readonly body: $PropType['string'] | undefined;
743
734
  readonly complete: $PropType['boolean'] | undefined;
744
735
  readonly id: $PropType['integer'];
745
736
  }
737
+ export type StrictProps = Props;
746
738
 
747
739
  export interface ObjectSet extends $ObjectSet<Todo, Todo.ObjectSet> {}
748
740
 
749
741
  export type OsdkInstance<
750
- OPTIONS extends never | '$notStrict' | '$rid' = never,
742
+ OPTIONS extends never | '$rid' = never,
751
743
  K extends keyof Todo.Props = keyof Todo.Props,
752
744
  > = $Osdk.Instance<Todo, OPTIONS, K>;
753
745
 
754
746
  /** @deprecated use OsdkInstance */
755
747
  export type OsdkObject<
756
- OPTIONS extends never | '$notStrict' | '$rid' = never,
748
+ OPTIONS extends never | '$rid' = never,
757
749
  K extends keyof Todo.Props = keyof Todo.Props,
758
750
  > = OsdkInstance<OPTIONS, K>;
759
751
  }
@@ -1156,20 +1148,18 @@ describe("generator", () => {
1156
1148
  export interface Props {
1157
1149
  readonly SomeProperty: $PropType['string'] | undefined;
1158
1150
  }
1159
- export interface StrictProps {
1160
- readonly SomeProperty: $PropType['string'] | undefined;
1161
- }
1151
+ export type StrictProps = Props;
1162
1152
 
1163
1153
  export interface ObjectSet extends $ObjectSet<SomeInterface, SomeInterface.ObjectSet> {}
1164
1154
 
1165
1155
  export type OsdkInstance<
1166
- OPTIONS extends never | '$notStrict' | '$rid' = never,
1156
+ OPTIONS extends never | '$rid' = never,
1167
1157
  K extends keyof SomeInterface.Props = keyof SomeInterface.Props,
1168
1158
  > = $Osdk.Instance<SomeInterface, OPTIONS, K>;
1169
1159
 
1170
1160
  /** @deprecated use OsdkInstance */
1171
1161
  export type OsdkObject<
1172
- OPTIONS extends never | '$notStrict' | '$rid' = never,
1162
+ OPTIONS extends never | '$rid' = never,
1173
1163
  K extends keyof SomeInterface.Props = keyof SomeInterface.Props,
1174
1164
  > = OsdkInstance<OPTIONS, K>;
1175
1165
  }
@@ -1234,22 +1224,20 @@ describe("generator", () => {
1234
1224
  }
1235
1225
 
1236
1226
  export interface Props {
1237
- readonly email: $PropType['string'] | undefined;
1238
- }
1239
- export interface StrictProps {
1240
1227
  readonly email: $PropType['string'];
1241
1228
  }
1229
+ export type StrictProps = Props;
1242
1230
 
1243
1231
  export interface ObjectSet extends $ObjectSet<Person, Person.ObjectSet> {}
1244
1232
 
1245
1233
  export type OsdkInstance<
1246
- OPTIONS extends never | '$notStrict' | '$rid' = never,
1234
+ OPTIONS extends never | '$rid' = never,
1247
1235
  K extends keyof Person.Props = keyof Person.Props,
1248
1236
  > = $Osdk.Instance<Person, OPTIONS, K>;
1249
1237
 
1250
1238
  /** @deprecated use OsdkInstance */
1251
1239
  export type OsdkObject<
1252
- OPTIONS extends never | '$notStrict' | '$rid' = never,
1240
+ OPTIONS extends never | '$rid' = never,
1253
1241
  K extends keyof Person.Props = keyof Person.Props,
1254
1242
  > = OsdkInstance<OPTIONS, K>;
1255
1243
  }
@@ -1324,26 +1312,22 @@ describe("generator", () => {
1324
1312
  }
1325
1313
 
1326
1314
  export interface Props {
1327
- readonly body: $PropType['string'] | undefined;
1328
- readonly complete: $PropType['boolean'] | undefined;
1329
- readonly id: $PropType['integer'] | undefined;
1330
- }
1331
- export interface StrictProps {
1332
1315
  readonly body: $PropType['string'] | undefined;
1333
1316
  readonly complete: $PropType['boolean'] | undefined;
1334
1317
  readonly id: $PropType['integer'];
1335
1318
  }
1319
+ export type StrictProps = Props;
1336
1320
 
1337
1321
  export interface ObjectSet extends $ObjectSet<Todo, Todo.ObjectSet> {}
1338
1322
 
1339
1323
  export type OsdkInstance<
1340
- OPTIONS extends never | '$notStrict' | '$rid' = never,
1324
+ OPTIONS extends never | '$rid' = never,
1341
1325
  K extends keyof Todo.Props = keyof Todo.Props,
1342
1326
  > = $Osdk.Instance<Todo, OPTIONS, K>;
1343
1327
 
1344
1328
  /** @deprecated use OsdkInstance */
1345
1329
  export type OsdkObject<
1346
- OPTIONS extends never | '$notStrict' | '$rid' = never,
1330
+ OPTIONS extends never | '$rid' = never,
1347
1331
  K extends keyof Todo.Props = keyof Todo.Props,
1348
1332
  > = OsdkInstance<OPTIONS, K>;
1349
1333
  }
@@ -1666,24 +1650,21 @@ describe("generator", () => {
1666
1650
  export type Links = {};
1667
1651
 
1668
1652
  export interface Props {
1669
- readonly body: $PropType['string'] | undefined;
1670
- readonly id: $PropType['integer'] | undefined;
1671
- }
1672
- export interface StrictProps {
1673
1653
  readonly body: $PropType['string'] | undefined;
1674
1654
  readonly id: $PropType['integer'];
1675
1655
  }
1656
+ export type StrictProps = Props;
1676
1657
 
1677
1658
  export interface ObjectSet extends $ObjectSet<UsesForeignSpt, UsesForeignSpt.ObjectSet> {}
1678
1659
 
1679
1660
  export type OsdkInstance<
1680
- OPTIONS extends never | '$notStrict' | '$rid' = never,
1661
+ OPTIONS extends never | '$rid' = never,
1681
1662
  K extends keyof UsesForeignSpt.Props = keyof UsesForeignSpt.Props,
1682
1663
  > = $Osdk.Instance<UsesForeignSpt, OPTIONS, K>;
1683
1664
 
1684
1665
  /** @deprecated use OsdkInstance */
1685
1666
  export type OsdkObject<
1686
- OPTIONS extends never | '$notStrict' | '$rid' = never,
1667
+ OPTIONS extends never | '$rid' = never,
1687
1668
  K extends keyof UsesForeignSpt.Props = keyof UsesForeignSpt.Props,
1688
1669
  > = OsdkInstance<OPTIONS, K>;
1689
1670
  }
@@ -1862,20 +1843,18 @@ describe("generator", () => {
1862
1843
  export interface Props {
1863
1844
  readonly spt: $PropType['string'] | undefined;
1864
1845
  }
1865
- export interface StrictProps {
1866
- readonly spt: $PropType['string'] | undefined;
1867
- }
1846
+ export type StrictProps = Props;
1868
1847
 
1869
1848
  export interface ObjectSet extends $ObjectSet<SomeInterface, SomeInterface.ObjectSet> {}
1870
1849
 
1871
1850
  export type OsdkInstance<
1872
- OPTIONS extends never | '$notStrict' | '$rid' = never,
1851
+ OPTIONS extends never | '$rid' = never,
1873
1852
  K extends keyof SomeInterface.Props = keyof SomeInterface.Props,
1874
1853
  > = $Osdk.Instance<SomeInterface, OPTIONS, K>;
1875
1854
 
1876
1855
  /** @deprecated use OsdkInstance */
1877
1856
  export type OsdkObject<
1878
- OPTIONS extends never | '$notStrict' | '$rid' = never,
1857
+ OPTIONS extends never | '$rid' = never,
1879
1858
  K extends keyof SomeInterface.Props = keyof SomeInterface.Props,
1880
1859
  > = OsdkInstance<OPTIONS, K>;
1881
1860
  }
@@ -1934,24 +1913,21 @@ describe("generator", () => {
1934
1913
  export type Links = {};
1935
1914
 
1936
1915
  export interface Props {
1937
- readonly body: $PropType['string'] | undefined;
1938
- readonly taskId: $PropType['string'] | undefined;
1939
- }
1940
- export interface StrictProps {
1941
1916
  readonly body: $PropType['string'] | undefined;
1942
1917
  readonly taskId: $PropType['string'];
1943
1918
  }
1919
+ export type StrictProps = Props;
1944
1920
 
1945
1921
  export interface ObjectSet extends $ObjectSet<Task, Task.ObjectSet> {}
1946
1922
 
1947
1923
  export type OsdkInstance<
1948
- OPTIONS extends never | '$notStrict' | '$rid' = never,
1924
+ OPTIONS extends never | '$rid' = never,
1949
1925
  K extends keyof Task.Props = keyof Task.Props,
1950
1926
  > = $Osdk.Instance<Task, OPTIONS, K>;
1951
1927
 
1952
1928
  /** @deprecated use OsdkInstance */
1953
1929
  export type OsdkObject<
1954
- OPTIONS extends never | '$notStrict' | '$rid' = never,
1930
+ OPTIONS extends never | '$rid' = never,
1955
1931
  K extends keyof Task.Props = keyof Task.Props,
1956
1932
  > = OsdkInstance<OPTIONS, K>;
1957
1933
  }