@osdk/generator 2.4.0-beta.12 → 2.4.0-beta.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +10 -10
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +4 -0
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +3 -0
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/browser/v2.0/generatePerInterfaceDataFiles.js +2 -1
- package/build/browser/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +4 -2
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/cjs/index.cjs +15 -10
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +10 -10
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +4 -0
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +3 -0
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/esm/v2.0/generatePerInterfaceDataFiles.js +2 -1
- package/build/esm/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +4 -2
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/types/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @osdk/generator
|
|
2
2
|
|
|
3
|
+
## 2.4.0-beta.14
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @osdk/api@2.4.0-beta.14
|
|
8
|
+
- @osdk/generator-converters@2.4.0-beta.14
|
|
9
|
+
|
|
10
|
+
## 2.4.0-beta.13
|
|
11
|
+
|
|
12
|
+
### Minor Changes
|
|
13
|
+
|
|
14
|
+
- 4bc848b: Add interface link support.
|
|
15
|
+
|
|
16
|
+
### Patch Changes
|
|
17
|
+
|
|
18
|
+
- Updated dependencies [4bc848b]
|
|
19
|
+
- @osdk/generator-converters@2.4.0-beta.13
|
|
20
|
+
- @osdk/api@2.4.0-beta.13
|
|
21
|
+
|
|
3
22
|
## 2.4.0-beta.12
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
|
@@ -20,13 +20,15 @@ import fastDeepEqual from "fast-deep-equal";
|
|
|
20
20
|
import invariant from "tiny-invariant";
|
|
21
21
|
import { extractNamespace } from "../GenerateContext/EnhancedBase.js";
|
|
22
22
|
import { EnhancedInterfaceType } from "../GenerateContext/EnhancedInterfaceType.js";
|
|
23
|
+
import { getObjectImports } from "../shared/getObjectImports.js";
|
|
23
24
|
import { deleteUndefineds } from "../util/deleteUndefineds.js";
|
|
24
25
|
import { stringify } from "../util/stringify.js";
|
|
25
26
|
import { createDefinition, createObjectSet, createOsdkObject, createPropertyKeys, createProps } from "./wireObjectTypeV2ToSdkObjectConstV2.js";
|
|
26
27
|
|
|
27
28
|
/** @internal */
|
|
28
|
-
export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false, forInternalUse = false) {
|
|
29
|
+
export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ontology, v2 = false, forInternalUse = false, currentFilePath = "") {
|
|
29
30
|
const definition = deleteUndefineds(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceDef.raw, v2));
|
|
31
|
+
const uniqueLinkTargetTypes = new Set(definition.links ? Object.values(definition.links).map(a => a.targetType === "object" ? ontology.requireObjectType(a.targetTypeApiName) : ontology.requireInterfaceType(a.targetTypeApiName)) : []);
|
|
30
32
|
const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);
|
|
31
33
|
const parents = definition.implements?.map(p => {
|
|
32
34
|
const parent = ontology.requireInterfaceType(p, true);
|
|
@@ -76,30 +78,28 @@ export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(interfaceDef, ont
|
|
|
76
78
|
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(", ")}`);
|
|
77
79
|
}
|
|
78
80
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
// if we want links to work
|
|
82
|
-
|
|
83
|
-
return `${[].join("\n")}
|
|
81
|
+
const imports = getObjectImports(uniqueLinkTargetTypes, definition.apiName, currentFilePath, true);
|
|
82
|
+
return `${imports}
|
|
84
83
|
${v2 ? function (forInternalUse = false) {
|
|
85
84
|
return `import type {
|
|
86
85
|
InterfaceDefinition as $InterfaceDefinition,
|
|
86
|
+
InterfaceMetadata as $InterfaceMetadata,
|
|
87
87
|
ObjectSet as $ObjectSet,
|
|
88
88
|
Osdk as $Osdk,
|
|
89
89
|
PropertyValueWireToClient as $PropType,
|
|
90
90
|
} from "${forInternalUse ? "@osdk/api" : "@osdk/client"}";
|
|
91
91
|
|
|
92
|
-
${Object.keys(definition.links).length
|
|
92
|
+
${definition.links ? Object.keys(definition.links).length > 0 ? `
|
|
93
93
|
export interface ${osdkObjectLinksIdentifier} {
|
|
94
94
|
${stringify(definition.links, {
|
|
95
95
|
"*": definition => {
|
|
96
|
-
const linkTarget = ontology.requireObjectType(definition.
|
|
97
|
-
return `${definition.multiplicity ? `${linkTarget}
|
|
96
|
+
const linkTarget = definition.targetType === "object" ? ontology.requireObjectType(definition.targetTypeApiName).getImportedDefinitionIdentifier(v2) : ontology.requireInterfaceType(definition.targetTypeApiName).getImportedDefinitionIdentifier(v2);
|
|
97
|
+
return `${definition.multiplicity ? `${linkTarget}.ObjectSet` : `${linkTarget}.ObjectSet`}
|
|
98
98
|
`;
|
|
99
99
|
}
|
|
100
100
|
})}
|
|
101
101
|
}
|
|
102
|
-
`}
|
|
102
|
+
` : `export type ${osdkObjectLinksIdentifier} = {};` : `export type ${osdkObjectLinksIdentifier} = {};`}
|
|
103
103
|
|
|
104
104
|
export namespace ${interfaceDef.shortApiName} {
|
|
105
105
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","consola","fastDeepEqual","invariant","extractNamespace","EnhancedInterfaceType","deleteUndefineds","stringify","createDefinition","createObjectSet","createOsdkObject","createPropertyKeys","createProps","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","interfaceDef","ontology","v2","forInternalUse","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.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\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport consola from \"consola\";\nimport fastDeepEqual from \"fast-deep-equal\";\nimport invariant from \"tiny-invariant\";\nimport { extractNamespace } from \"../GenerateContext/EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport type { EnhancedOntologyDefinition } from \"../GenerateContext/EnhancedOntologyDefinition.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport type { Identifiers } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\nimport {\n createDefinition,\n createObjectSet,\n createOsdkObject,\n createPropertyKeys,\n createProps,\n} from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n interfaceDef: EnhancedInterfaceType,\n ontology: EnhancedOntologyDefinition,\n v2: boolean = false,\n forInternalUse: boolean = false,\n) {\n const definition = deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n interfaceDef.raw,\n v2,\n ),\n );\n\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n\n const parents = definition.implements?.map(p => {\n const parent = ontology.requireInterfaceType(p, true);\n if (parent instanceof EnhancedInterfaceType) {\n const it = deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n parent.raw,\n v2,\n consola,\n ),\n );\n return it;\n }\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(\n fastDeepEqual(\n definition.properties[apiName],\n parent.properties[apiName],\n ),\n `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(\n fastDeepEqual(\n mergedProperties[apiName],\n parent.properties[apiName],\n ),\n `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`,\n );\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n\n definition.properties = mergedProperties;\n\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 =\n `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n\n const ids: Identifiers = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n\n if (interfaceDef.apiNamespace) {\n const badProperties = Object.keys(definition.properties).filter(apiName =>\n extractNamespace(apiName)[0] == null\n );\n if (badProperties.length > 0) {\n throw new Error(\n `Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${\n badProperties.join(\", \")\n }`,\n );\n }\n }\n\n function getV2Types(forInternalUse: boolean = false) {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\n \n ${\n Object.keys(definition.links).length === 0\n ? `export type ${osdkObjectLinksIdentifier} = {};`\n : `\n export interface ${osdkObjectLinksIdentifier} {\n${\n stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = ontology.requireObjectType(\n definition.targetType,\n )\n .getImportedDefinitionIdentifier(v2);\n\n return `${\n definition.multiplicity\n ? `${linkTarget}[\"objectSet\"]`\n : `SingleLinkAccessor<${linkTarget}>`\n }\n `;\n },\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\n // FIXME: We need to fill in the imports\n // if we want links to work\n const imports: string[] = [];\n definition;\n return `${imports.join(\"\\n\")}\n ${v2 ? getV2Types(forInternalUse) : \"\"}\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;;AAEA,SAASA,mDAAmD,QAAQ,4BAA4B;AAChG,OAAOC,OAAO,MAAM,SAAS;AAC7B,OAAOC,aAAa,MAAM,iBAAiB;AAC3C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,qBAAqB,QAAQ,6CAA6C;AAEnF,SAASC,gBAAgB,QAAQ,6BAA6B;AAC9D,SA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,EAAE8B,GAAG,CAAC;AAC1C;AACA,QAAQlC,gBAAgB,CAACI,YAAY,EAAE,cAAc,EAAE8B,GAAG,CAAC;AAC3D;AACA;AACA;AACA,MAAMpC,gBAAgB,CAACM,YAAY,EAAEC,QAAQ,EAAED,YAAY,CAACwB,YAAY,EAAEM,GAAG,CAAC;AAC9E;AACA,CAAC;EACC,CAAC,CAOmB3B,cAAc,CAAC,GAAG,EAAE;AAC1C;AACA,mBAAmBH,YAAY,CAACwB,YAAY,KAAKxB,YAAY,CAACwB,YAAY;AAC1E;AACA,kBAAkBxB,YAAY,CAACoC,WAAW;AAC1C;AACA,UAAU;AACV","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","consola","fastDeepEqual","invariant","extractNamespace","EnhancedInterfaceType","getObjectImports","deleteUndefineds","stringify","createDefinition","createObjectSet","createOsdkObject","createPropertyKeys","createProps","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","interfaceDef","ontology","v2","forInternalUse","currentFilePath","definition","raw","uniqueLinkTargetTypes","Set","links","Object","values","map","a","targetType","requireObjectType","targetTypeApiName","requireInterfaceType","objectDefIdentifier","getDefinitionIdentifier","parents","implements","p","parent","it","mergedProperties","properties","apiName","keys","process","env","NODE_ENV","objectSetIdentifier","shortApiName","propertyKeysIdentifier","osdkObjectPropsIdentifier","osdkObjectStrictPropsIdentifier","osdkObjectLinksIdentifier","osdkObjectIdentifier","ids","apiNamespace","badProperties","filter","length","Error","fullApiName","join","imports","linkTarget","getImportedDefinitionIdentifier","multiplicity"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.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\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport consola from \"consola\";\nimport fastDeepEqual from \"fast-deep-equal\";\nimport invariant from \"tiny-invariant\";\nimport { extractNamespace } from \"../GenerateContext/EnhancedBase.js\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport type { EnhancedOntologyDefinition } from \"../GenerateContext/EnhancedOntologyDefinition.js\";\nimport { getObjectImports } from \"../shared/getObjectImports.js\";\nimport { deleteUndefineds } from \"../util/deleteUndefineds.js\";\nimport { stringify } from \"../util/stringify.js\";\nimport type { Identifiers } from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\nimport {\n createDefinition,\n createObjectSet,\n createOsdkObject,\n createPropertyKeys,\n createProps,\n} from \"./wireObjectTypeV2ToSdkObjectConstV2.js\";\n\n/** @internal */\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n interfaceDef: EnhancedInterfaceType,\n ontology: EnhancedOntologyDefinition,\n v2: boolean = false,\n forInternalUse: boolean = false,\n currentFilePath: string = \"\",\n) {\n const definition = deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n interfaceDef.raw,\n v2,\n ),\n );\n const uniqueLinkTargetTypes = new Set(\n definition.links\n ? Object.values(definition.links).map(a =>\n a.targetType === \"object\"\n ? ontology.requireObjectType(\n a.targetTypeApiName,\n )\n : ontology.requireInterfaceType(\n a.targetTypeApiName,\n )\n )\n : [],\n );\n\n const objectDefIdentifier = interfaceDef.getDefinitionIdentifier(v2);\n\n const parents = definition.implements?.map(p => {\n const parent = ontology.requireInterfaceType(p, true);\n if (parent instanceof EnhancedInterfaceType) {\n const it = deleteUndefineds(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n parent.raw,\n v2,\n consola,\n ),\n );\n return it;\n }\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(\n fastDeepEqual(\n definition.properties[apiName],\n parent.properties[apiName],\n ),\n `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(\n fastDeepEqual(\n mergedProperties[apiName],\n parent.properties[apiName],\n ),\n `Some interface defines a conflicting property '${apiName}' that does not match property from parent '${parent.apiName}'`,\n );\n }\n mergedProperties[apiName] = parent.properties[apiName];\n }\n }\n\n definition.properties = mergedProperties;\n\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 =\n `${interfaceDef.shortApiName}.StrictProps`;\n const osdkObjectLinksIdentifier = `OsdkObjectLinks$${objectDefIdentifier}`;\n const osdkObjectIdentifier = `${interfaceDef.shortApiName}.OsdkObject`;\n\n const ids: Identifiers = {\n objectDefIdentifier: interfaceDef.shortApiName,\n osdkObjectLinksIdentifier,\n osdkObjectPropsIdentifier,\n osdkObjectStrictPropsIdentifier,\n objectSetIdentifier,\n osdkObjectIdentifier,\n propertyKeysIdentifier,\n };\n\n if (interfaceDef.apiNamespace) {\n const badProperties = Object.keys(definition.properties).filter(apiName =>\n extractNamespace(apiName)[0] == null\n );\n if (badProperties.length > 0) {\n throw new Error(\n `Interfaces with fully qualified api names MUST NOT have any properties with an unqualified api name. Interface: ${interfaceDef.fullApiName}, properties: ${\n badProperties.join(\", \")\n }`,\n );\n }\n }\n\n function getV2Types(forInternalUse: boolean = false) {\n return `import type {\n InterfaceDefinition as $InterfaceDefinition,\n InterfaceMetadata as $InterfaceMetadata,\n ObjectSet as $ObjectSet, \n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"${forInternalUse ? \"@osdk/api\" : \"@osdk/client\"}\";\n \n ${\n definition.links\n ? Object.keys(definition.links).length > 0\n ? `\n export interface ${osdkObjectLinksIdentifier} {\n${\n stringify(definition.links, {\n \"*\": (definition) => {\n const linkTarget = definition.targetType === \"object\"\n ? ontology.requireObjectType(\n definition.targetTypeApiName,\n )\n .getImportedDefinitionIdentifier(v2)\n : ontology.requireInterfaceType(\n definition.targetTypeApiName,\n )\n .getImportedDefinitionIdentifier(v2);\n\n return `${\n definition.multiplicity\n ? `${linkTarget}.ObjectSet`\n : `${linkTarget}.ObjectSet`\n }\n `;\n },\n })\n }\n }\n `\n : `export type ${osdkObjectLinksIdentifier} = {};`\n : `export type ${osdkObjectLinksIdentifier} = {};`\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\n const imports: string = getObjectImports(\n uniqueLinkTargetTypes,\n definition.apiName,\n currentFilePath,\n true,\n );\n definition;\n return `${imports}\n ${v2 ? getV2Types(forInternalUse) : \"\"}\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;AAC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,GAAG,EAAE;AAC1C;AACA,mBAAmBH,YAAY,CAACiC,YAAY,KAAKjC,YAAY,CAACiC,YAAY;AAC1E;AACA,kBAAkBjC,YAAY,CAAC6C,WAAW;AAC1C;AACA,UAAU;AACV","ignoreList":[]}
|
|
@@ -86,6 +86,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
86
86
|
expect(formattedCode).toMatchInlineSnapshot(`
|
|
87
87
|
"import type {
|
|
88
88
|
InterfaceDefinition as $InterfaceDefinition,
|
|
89
|
+
InterfaceMetadata as $InterfaceMetadata,
|
|
89
90
|
ObjectSet as $ObjectSet,
|
|
90
91
|
Osdk as $Osdk,
|
|
91
92
|
PropertyValueWireToClient as $PropType,
|
|
@@ -165,6 +166,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
165
166
|
expect(formattedCode).toMatchInlineSnapshot(`
|
|
166
167
|
"import type {
|
|
167
168
|
InterfaceDefinition as $InterfaceDefinition,
|
|
169
|
+
InterfaceMetadata as $InterfaceMetadata,
|
|
168
170
|
ObjectSet as $ObjectSet,
|
|
169
171
|
Osdk as $Osdk,
|
|
170
172
|
PropertyValueWireToClient as $PropType,
|
|
@@ -248,6 +250,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
248
250
|
expect(formattedCode).toMatchInlineSnapshot(`
|
|
249
251
|
"import type {
|
|
250
252
|
InterfaceDefinition as $InterfaceDefinition,
|
|
253
|
+
InterfaceMetadata as $InterfaceMetadata,
|
|
251
254
|
ObjectSet as $ObjectSet,
|
|
252
255
|
Osdk as $Osdk,
|
|
253
256
|
PropertyValueWireToClient as $PropType,
|
|
@@ -343,6 +346,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
343
346
|
expect(formattedCode).toMatchInlineSnapshot(`
|
|
344
347
|
"import type {
|
|
345
348
|
InterfaceDefinition as $InterfaceDefinition,
|
|
349
|
+
InterfaceMetadata as $InterfaceMetadata,
|
|
346
350
|
ObjectSet as $ObjectSet,
|
|
347
351
|
Osdk as $Osdk,
|
|
348
352
|
PropertyValueWireToClient as $PropType,
|
|
@@ -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","Child","implementsMatch","match","not","toBeNull","implementsStr","toContain"],"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 *\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 *\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 *\n * description: bar property desc\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n /**\n * display name: 'foo property dn',\n *\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 *\n * description: bar property desc\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n /**\n * display name: 'foo property dn',\n *\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 *\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 *\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(\"sorts the implements array for stable output\", async () => {\n // Test with multiple parent interfaces in non-alphabetical order\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Child\", [simpleSpt(\"child\")], [\n \"ParentZ\",\n \"ParentA\",\n \"ParentC\",\n ]),\n simpleInterface(\"ParentZ\", [simpleSpt(\"z\")], []),\n simpleInterface(\"ParentA\", [simpleSpt(\"a\")], []),\n simpleInterface(\"ParentC\", [simpleSpt(\"c\")], []),\n ]),\n importExt: \"\",\n });\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Child as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n\n // Extract the implements array from the generated code\n const implementsMatch = formattedCode.match(/implements:\\s*\\[([^\\]]+)\\]/s);\n expect(implementsMatch).not.toBeNull();\n\n if (implementsMatch) {\n const implementsStr = implementsMatch[1];\n // Check that the array is sorted alphabetically\n expect(implementsStr).toContain(\"\\\"ParentA\\\", \\\"ParentC\\\", \\\"ParentZ\\\"\");\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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EAAE,CAACT,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC,CACjD,CAAC;MACFoC,SAAS,EAAE;IACb,CAAC,CAAC;IAEF,MAAMI,aAAa,GAAG,MAAMhD,MAAM,CAChCO,8CAA8C,CAC5CkC,QAAQ,CAACP,cAAc,CAACqB,KAAK,EAC7Bd,QAAQ,EACR,IAAI,EACJ,IACF,CAAC,EACD;MACEQ,MAAM,EAAE;IACV,CACF,CAAC;;IAED;IACA,MAAMO,eAAe,GAAGR,aAAa,CAACS,KAAK,CAAC,6BAA6B,CAAC;IAC1EvD,MAAM,CAACsD,eAAe,CAAC,CAACE,GAAG,CAACC,QAAQ,CAAC,CAAC;IAEtC,IAAIH,eAAe,EAAE;MACnB,MAAMI,aAAa,GAAGJ,eAAe,CAAC,CAAC,CAAC;MACxC;MACAtD,MAAM,CAAC0D,aAAa,CAAC,CAACC,SAAS,CAAC,uCAAuC,CAAC;IAC1E;EACF,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","Child","implementsMatch","match","not","toBeNull","implementsStr","toContain"],"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 InterfaceMetadata as $InterfaceMetadata,\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 InterfaceMetadata as $InterfaceMetadata,\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 *\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 *\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 InterfaceMetadata as $InterfaceMetadata,\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 *\n * description: bar property desc\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n /**\n * display name: 'foo property dn',\n *\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 *\n * description: bar property desc\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n /**\n * display name: 'foo property dn',\n *\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 InterfaceMetadata as $InterfaceMetadata,\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 *\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 *\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(\"sorts the implements array for stable output\", async () => {\n // Test with multiple parent interfaces in non-alphabetical order\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Child\", [simpleSpt(\"child\")], [\n \"ParentZ\",\n \"ParentA\",\n \"ParentC\",\n ]),\n simpleInterface(\"ParentZ\", [simpleSpt(\"z\")], []),\n simpleInterface(\"ParentA\", [simpleSpt(\"a\")], []),\n simpleInterface(\"ParentC\", [simpleSpt(\"c\")], []),\n ]),\n importExt: \"\",\n });\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Child as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n\n // Extract the implements array from the generated code\n const implementsMatch = formattedCode.match(/implements:\\s*\\[([^\\]]+)\\]/s);\n expect(implementsMatch).not.toBeNull();\n\n if (implementsMatch) {\n const implementsStr = implementsMatch[1];\n // Check that the array is sorted alphabetically\n expect(implementsStr).toContain(\"\\\"ParentA\\\", \\\"ParentC\\\", \\\"ParentZ\\\"\");\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,EAAE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AM,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;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFhD,EAAE,CAAC,kCAAkC,EAAE,YAAY;IACjD,MAAMiD,MAAM,GAAG5C,SAAS,CAAC,KAAK,CAAC;IAC/B,MAAM6C,MAAM,GAAG7C,SAAS,CAAC,KAAK,CAAC;IAE/B,MAAMiC,QAAQ,GAAGpC,eAAe,CAC9B;MACEsC,SAAS,EAAEX,cAAc,CAAC,UAAU,EAAE,CACpCf,eAAe,CAAC,KAAK,EAAE,CAACmC,MAAM,EAAEC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,EACpDpC,eAAe,CAAC,QAAQ,EAAE,CAACoC,MAAM,CAAC,EAAE,EAAE,CAAC,CACxC,CAAC;MACFT,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EACFhD,EAAE,CAAC,iCAAiC,EAAE,YAAY;IAChD,MAAMiD,MAAM,GAAG5C,SAAS,CAAC,KAAK,CAAC;IAC/B,MAAM6C,MAAM,GAAG7C,SAAS,CAAC,KAAK,CAAC;IAE/B,MAAMiC,QAAQ,GAAGpC,eAAe,CAC9B;MACEsC,SAAS,EAAEX,cAAc,CAAC,UAAU,EAAE,CACpCf,eAAe,CAAC,KAAK,EAAE,CAACmC,MAAM,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC,gBAAgB,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;A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CAAC","ignoreList":[]}
|
|
@@ -601,6 +601,7 @@ describe("generator", () => {
|
|
|
601
601
|
|
|
602
602
|
import type {
|
|
603
603
|
InterfaceDefinition as $InterfaceDefinition,
|
|
604
|
+
InterfaceMetadata as $InterfaceMetadata,
|
|
604
605
|
ObjectSet as $ObjectSet,
|
|
605
606
|
Osdk as $Osdk,
|
|
606
607
|
PropertyValueWireToClient as $PropType,
|
|
@@ -1211,6 +1212,7 @@ describe("generator", () => {
|
|
|
1211
1212
|
|
|
1212
1213
|
import type {
|
|
1213
1214
|
InterfaceDefinition as $InterfaceDefinition,
|
|
1215
|
+
InterfaceMetadata as $InterfaceMetadata,
|
|
1214
1216
|
ObjectSet as $ObjectSet,
|
|
1215
1217
|
Osdk as $Osdk,
|
|
1216
1218
|
PropertyValueWireToClient as $PropType,
|
|
@@ -2325,6 +2327,7 @@ describe("generator", () => {
|
|
|
2325
2327
|
|
|
2326
2328
|
import type {
|
|
2327
2329
|
InterfaceDefinition as $InterfaceDefinition,
|
|
2330
|
+
InterfaceMetadata as $InterfaceMetadata,
|
|
2328
2331
|
ObjectSet as $ObjectSet,
|
|
2329
2332
|
Osdk as $Osdk,
|
|
2330
2333
|
PropertyValueWireToClient as $PropType,
|