@osdk/generator 2.3.0-beta.3 → 2.3.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.
- package/CHANGELOG.md +15 -0
- package/build/browser/GenerateContext/EnhancedInterfaceType.js +1 -2
- package/build/browser/GenerateContext/EnhancedInterfaceType.js.map +1 -1
- package/build/browser/GenerateContext/EnhancedObjectType.js +1 -2
- package/build/browser/GenerateContext/EnhancedObjectType.js.map +1 -1
- package/build/browser/shared/propertyJsdoc.js +26 -9
- package/build/browser/shared/propertyJsdoc.js.map +1 -1
- package/build/browser/util/stringify.js +3 -1
- package/build/browser/util/stringify.js.map +1 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +9 -0
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +23 -0
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +5 -4
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/cjs/index.cjs +52 -27
- package/build/cjs/index.cjs.map +1 -1
- package/build/esm/GenerateContext/EnhancedInterfaceType.js +1 -2
- package/build/esm/GenerateContext/EnhancedInterfaceType.js.map +1 -1
- package/build/esm/GenerateContext/EnhancedObjectType.js +1 -2
- package/build/esm/GenerateContext/EnhancedObjectType.js.map +1 -1
- package/build/esm/shared/propertyJsdoc.js +26 -9
- package/build/esm/shared/propertyJsdoc.js.map +1 -1
- package/build/esm/util/stringify.js +3 -1
- package/build/esm/util/stringify.js.map +1 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +9 -0
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +23 -0
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +5 -4
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/types/GenerateContext/EnhancedInterfaceType.d.ts.map +1 -1
- package/build/types/GenerateContext/EnhancedObjectType.d.ts.map +1 -1
- package/build/types/shared/propertyJsdoc.d.ts +2 -1
- package/build/types/shared/propertyJsdoc.d.ts.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,20 @@
|
|
|
1
1
|
# @osdk/generator
|
|
2
2
|
|
|
3
|
+
## 2.3.0-beta.4
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- fe00f84: Generate deprecation warnings for object properties
|
|
8
|
+
- ef46ed6: Add protection for dropping unsupported enums instead of throwing"
|
|
9
|
+
|
|
10
|
+
### Patch Changes
|
|
11
|
+
|
|
12
|
+
- Updated dependencies [43c5547]
|
|
13
|
+
- Updated dependencies [ef46ed6]
|
|
14
|
+
- Updated dependencies [3b5ccaa]
|
|
15
|
+
- @osdk/api@2.3.0-beta.4
|
|
16
|
+
- @osdk/generator-converters@2.3.0-beta.4
|
|
17
|
+
|
|
3
18
|
## 2.3.0-beta.3
|
|
4
19
|
|
|
5
20
|
### Patch Changes
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "@osdk/generator-converters";
|
|
18
|
-
import { deleteUndefineds } from "../util/deleteUndefineds.js";
|
|
19
18
|
import { EnhancedBase } from "./EnhancedBase.js";
|
|
20
19
|
export class EnhancedInterfaceType extends EnhancedBase {
|
|
21
20
|
constructor(common, raw) {
|
|
@@ -32,7 +31,7 @@ export class EnhancedInterfaceType extends EnhancedBase {
|
|
|
32
31
|
return this.raw.properties;
|
|
33
32
|
}
|
|
34
33
|
getCleanedUpDefinition(v2) {
|
|
35
|
-
return
|
|
34
|
+
return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(this.raw, v2);
|
|
36
35
|
}
|
|
37
36
|
}
|
|
38
37
|
//# sourceMappingURL=EnhancedInterfaceType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnhancedInterfaceType.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","
|
|
1
|
+
{"version":3,"file":"EnhancedInterfaceType.js","names":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","EnhancedBase","EnhancedInterfaceType","constructor","common","raw","apiName","getDefinitionIdentifier","v2","shortApiName","getImportedDefinitionIdentifier","properties","getCleanedUpDefinition"],"sources":["EnhancedInterfaceType.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { InterfaceMetadata } from \"@osdk/api\";\nimport type { InterfaceType } from \"@osdk/foundry.ontologies\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from \"@osdk/generator-converters\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedInterfaceType extends EnhancedBase<InterfaceType> {\n constructor(common: EnhanceCommon, public raw: InterfaceType) {\n super(common, raw, raw.apiName, \"./ontology/interfaces\");\n }\n\n getDefinitionIdentifier(v2: boolean): string {\n return v2 ? this.shortApiName : `${this.shortApiName}Def`;\n }\n\n getImportedDefinitionIdentifier(v2: boolean): string {\n return this.getDefinitionIdentifier(v2);\n }\n\n get properties(): InterfaceType[\"properties\"] {\n return this.raw.properties;\n }\n\n getCleanedUpDefinition(v2: boolean): InterfaceMetadata {\n return __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(\n this.raw,\n v2,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,mDAAmD,QAAQ,4BAA4B;AAEhG,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,qBAAqB,SAASD,YAAY,CAAgB;EACrEE,WAAWA,CAACC,MAAqB,EAASC,GAAkB,EAAE;IAC5D,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,OAAO,EAAE,uBAAuB,CAAC;IAAC,KADjBD,GAAkB,GAAlBA,GAAkB;EAE5D;EAEAE,uBAAuBA,CAACC,EAAW,EAAU;IAC3C,OAAOA,EAAE,GAAG,IAAI,CAACC,YAAY,GAAG,GAAG,IAAI,CAACA,YAAY,KAAK;EAC3D;EAEAC,+BAA+BA,CAACF,EAAW,EAAU;IACnD,OAAO,IAAI,CAACD,uBAAuB,CAACC,EAAE,CAAC;EACzC;EAEA,IAAIG,UAAUA,CAAA,EAAgC;IAC5C,OAAO,IAAI,CAACN,GAAG,CAACM,UAAU;EAC5B;EAEAC,sBAAsBA,CAACJ,EAAW,EAAqB;IACrD,OAAOR,mDAAmD,CACxD,IAAI,CAACK,GAAG,EACRG,EACF,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -15,7 +15,6 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { wireObjectTypeFullMetadataToSdkObjectMetadata } from "@osdk/generator-converters";
|
|
18
|
-
import { deleteUndefineds } from "../util/deleteUndefineds.js";
|
|
19
18
|
import { EnhancedBase } from "./EnhancedBase.js";
|
|
20
19
|
export class EnhancedObjectType extends EnhancedBase {
|
|
21
20
|
constructor(common, raw) {
|
|
@@ -29,7 +28,7 @@ export class EnhancedObjectType extends EnhancedBase {
|
|
|
29
28
|
return this.getDefinitionIdentifier(v2);
|
|
30
29
|
}
|
|
31
30
|
getCleanedUpDefinition(v2) {
|
|
32
|
-
return
|
|
31
|
+
return wireObjectTypeFullMetadataToSdkObjectMetadata(this.raw, v2);
|
|
33
32
|
}
|
|
34
33
|
}
|
|
35
34
|
//# sourceMappingURL=EnhancedObjectType.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnhancedObjectType.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","
|
|
1
|
+
{"version":3,"file":"EnhancedObjectType.js","names":["wireObjectTypeFullMetadataToSdkObjectMetadata","EnhancedBase","EnhancedObjectType","constructor","common","raw","objectType","apiName","getDefinitionIdentifier","v2","shortApiName","getImportedDefinitionIdentifier","getCleanedUpDefinition"],"sources":["EnhancedObjectType.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectMetadata } from \"@osdk/api\";\nimport type { ObjectTypeFullMetadata } from \"@osdk/foundry.ontologies\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"@osdk/generator-converters\";\nimport type { EnhanceCommon } from \"./EnhanceCommon.js\";\nimport { EnhancedBase } from \"./EnhancedBase.js\";\n\nexport class EnhancedObjectType extends EnhancedBase<ObjectTypeFullMetadata> {\n constructor(common: EnhanceCommon, public raw: ObjectTypeFullMetadata) {\n super(common, raw, raw.objectType.apiName, \"./ontology/objects\");\n }\n\n getDefinitionIdentifier(v2: boolean): string {\n return v2 ? this.shortApiName : `${this.shortApiName}Def`;\n }\n\n getImportedDefinitionIdentifier(v2: boolean): string {\n return this.getDefinitionIdentifier(v2);\n }\n\n getCleanedUpDefinition(v2: boolean): ObjectMetadata {\n return wireObjectTypeFullMetadataToSdkObjectMetadata(\n this.raw,\n v2,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,6CAA6C,QAAQ,4BAA4B;AAE1F,SAASC,YAAY,QAAQ,mBAAmB;AAEhD,OAAO,MAAMC,kBAAkB,SAASD,YAAY,CAAyB;EAC3EE,WAAWA,CAACC,MAAqB,EAASC,GAA2B,EAAE;IACrE,KAAK,CAACD,MAAM,EAAEC,GAAG,EAAEA,GAAG,CAACC,UAAU,CAACC,OAAO,EAAE,oBAAoB,CAAC;IAAC,KADzBF,GAA2B,GAA3BA,GAA2B;EAErE;EAEAG,uBAAuBA,CAACC,EAAW,EAAU;IAC3C,OAAOA,EAAE,GAAG,IAAI,CAACC,YAAY,GAAG,GAAG,IAAI,CAACA,YAAY,KAAK;EAC3D;EAEAC,+BAA+BA,CAACF,EAAW,EAAU;IACnD,OAAO,IAAI,CAACD,uBAAuB,CAACC,EAAE,CAAC;EACzC;EAEAG,sBAAsBA,CAACH,EAAW,EAAkB;IAClD,OAAOT,6CAA6C,CAClD,IAAI,CAACK,GAAG,EACRI,EACF,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -14,26 +14,43 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
export function propertyJsdoc(property, {
|
|
17
|
+
export function propertyJsdoc(property, rawPropertyMetadata, {
|
|
18
18
|
isInherited,
|
|
19
19
|
apiName
|
|
20
20
|
}) {
|
|
21
|
-
|
|
21
|
+
const ret = [];
|
|
22
22
|
const renderDisplayName = property.displayName && property.displayName !== apiName;
|
|
23
|
-
|
|
23
|
+
const status = rawPropertyMetadata?.status;
|
|
24
|
+
if (isInherited || renderDisplayName || property.description || status) {
|
|
25
|
+
if (status) {
|
|
26
|
+
let deprecationStatus = "";
|
|
27
|
+
if (status.type === "deprecated") {
|
|
28
|
+
deprecationStatus += ` * @deprecated\n`;
|
|
29
|
+
deprecationStatus += ` * - ${status.message}\n`;
|
|
30
|
+
if (status.deadline) {
|
|
31
|
+
deprecationStatus += ` * - deadline: ${status.deadline}\n`;
|
|
32
|
+
}
|
|
33
|
+
if (status.replacedBy) {
|
|
34
|
+
deprecationStatus += ` * - replaced by: ${status.replacedBy}\n`;
|
|
35
|
+
}
|
|
36
|
+
ret.push(deprecationStatus);
|
|
37
|
+
} else if (status.type === "experimental") {
|
|
38
|
+
ret.push(` * @${status.type}\n`);
|
|
39
|
+
}
|
|
40
|
+
ret.push(` * property status: ${status.type}\n`);
|
|
41
|
+
}
|
|
24
42
|
if (isInherited) {
|
|
25
|
-
ret
|
|
43
|
+
ret.push(` * (inherited from parent)\n`);
|
|
26
44
|
}
|
|
27
45
|
if (renderDisplayName) {
|
|
28
|
-
ret
|
|
46
|
+
ret.push(` * display name: '${property.displayName}'${property.description ? "," : ""}\n`);
|
|
29
47
|
}
|
|
30
48
|
if (property.description) {
|
|
31
|
-
ret
|
|
49
|
+
ret.push(` * description: ${property.description}\n`);
|
|
32
50
|
}
|
|
33
51
|
} else {
|
|
34
|
-
ret
|
|
52
|
+
ret.push(` * (no ontology metadata)\n`);
|
|
35
53
|
}
|
|
36
|
-
ret
|
|
37
|
-
return ret;
|
|
54
|
+
return `/**\n` + ret.join("*\n") + ` */\n`;
|
|
38
55
|
}
|
|
39
56
|
//# sourceMappingURL=propertyJsdoc.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"propertyJsdoc.js","names":["propertyJsdoc","property","isInherited","apiName","ret","renderDisplayName","displayName","description"],"sources":["propertyJsdoc.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectMetadata } from \"@osdk/api\";\n\nexport function propertyJsdoc(\n property: ObjectMetadata.Property,\n { isInherited, apiName }: { isInherited?: boolean; apiName: string },\n): string {\n
|
|
1
|
+
{"version":3,"file":"propertyJsdoc.js","names":["propertyJsdoc","property","rawPropertyMetadata","isInherited","apiName","ret","renderDisplayName","displayName","status","description","deprecationStatus","type","message","deadline","replacedBy","push","join"],"sources":["propertyJsdoc.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectMetadata } from \"@osdk/api\";\nimport type { PropertyV2 } from \"@osdk/foundry.ontologies\";\n\nexport function propertyJsdoc(\n property: ObjectMetadata.Property,\n rawPropertyMetadata: PropertyV2 | undefined,\n { isInherited, apiName }: { isInherited?: boolean; apiName: string },\n): string {\n const ret = [];\n const renderDisplayName = property.displayName\n && property.displayName !== apiName;\n const status = rawPropertyMetadata?.status;\n if (isInherited || renderDisplayName || property.description || status) {\n if (status) {\n let deprecationStatus = \"\";\n if (status.type === \"deprecated\") {\n deprecationStatus += ` * @deprecated\\n`;\n deprecationStatus += ` * - ${status.message}\\n`;\n if (status.deadline) {\n deprecationStatus += ` * - deadline: ${status.deadline}\\n`;\n }\n if (status.replacedBy) {\n deprecationStatus += ` * - replaced by: ${status.replacedBy}\\n`;\n }\n ret.push(deprecationStatus);\n } else if (status.type === \"experimental\") {\n ret.push(` * @${status.type}\\n`);\n }\n ret.push(` * property status: ${status.type}\\n`);\n }\n if (isInherited) {\n ret.push(` * (inherited from parent)\\n`);\n }\n\n if (renderDisplayName) {\n ret.push(\n ` * display name: '${property.displayName}'${\n property.description ? \",\" : \"\"\n }\\n`,\n );\n }\n\n if (property.description) {\n ret.push(` * description: ${property.description}\\n`);\n }\n } else {\n ret.push(` * (no ontology metadata)\\n`);\n }\n return `/**\\n` + ret.join(\"*\\n\") + ` */\\n`;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASA,aAAaA,CAC3BC,QAAiC,EACjCC,mBAA2C,EAC3C;EAAEC,WAAW;EAAEC;AAAoD,CAAC,EAC5D;EACR,MAAMC,GAAG,GAAG,EAAE;EACd,MAAMC,iBAAiB,GAAGL,QAAQ,CAACM,WAAW,IACzCN,QAAQ,CAACM,WAAW,KAAKH,OAAO;EACrC,MAAMI,MAAM,GAAGN,mBAAmB,EAAEM,MAAM;EAC1C,IAAIL,WAAW,IAAIG,iBAAiB,IAAIL,QAAQ,CAACQ,WAAW,IAAID,MAAM,EAAE;IACtE,IAAIA,MAAM,EAAE;MACV,IAAIE,iBAAiB,GAAG,EAAE;MAC1B,IAAIF,MAAM,CAACG,IAAI,KAAK,YAAY,EAAE;QAChCD,iBAAiB,IAAI,oBAAoB;QACzCA,iBAAiB,IAAI,UAAUF,MAAM,CAACI,OAAO,IAAI;QACjD,IAAIJ,MAAM,CAACK,QAAQ,EAAE;UACnBH,iBAAiB,IAAI,oBAAoBF,MAAM,CAACK,QAAQ,IAAI;QAC9D;QACA,IAAIL,MAAM,CAACM,UAAU,EAAE;UACrBJ,iBAAiB,IAAI,uBAAuBF,MAAM,CAACM,UAAU,IAAI;QACnE;QACAT,GAAG,CAACU,IAAI,CAACL,iBAAiB,CAAC;MAC7B,CAAC,MAAM,IAAIF,MAAM,CAACG,IAAI,KAAK,cAAc,EAAE;QACzCN,GAAG,CAACU,IAAI,CAAC,OAAOP,MAAM,CAACG,IAAI,IAAI,CAAC;MAClC;MACAN,GAAG,CAACU,IAAI,CAAC,yBAAyBP,MAAM,CAACG,IAAI,IAAI,CAAC;IACpD;IACA,IAAIR,WAAW,EAAE;MACfE,GAAG,CAACU,IAAI,CAAC,8BAA8B,CAAC;IAC1C;IAEA,IAAIT,iBAAiB,EAAE;MACrBD,GAAG,CAACU,IAAI,CACN,uBAAuBd,QAAQ,CAACM,WAAW,IACzCN,QAAQ,CAACQ,WAAW,GAAG,GAAG,GAAG,EAAE,IAEnC,CAAC;IACH;IAEA,IAAIR,QAAQ,CAACQ,WAAW,EAAE;MACxBJ,GAAG,CAACU,IAAI,CAAC,qBAAqBd,QAAQ,CAACQ,WAAW,IAAI,CAAC;IACzD;EACF,CAAC,MAAM;IACLJ,GAAG,CAACU,IAAI,CAAC,6BAA6B,CAAC;EACzC;EACA,OAAO,OAAO,GAAGV,GAAG,CAACW,IAAI,CAAC,KAAK,CAAC,GAAG,OAAO;AAC5C","ignoreList":[]}
|
|
@@ -33,7 +33,7 @@ const defaultCustomizer = (value, defaultValueFormatter, key, defaultKeyFormatte
|
|
|
33
33
|
return [defaultKeyFormatter(key), defaultValueFormatter(value)];
|
|
34
34
|
};
|
|
35
35
|
export function stringify(obj, customizer = {}, separator = ",\n") {
|
|
36
|
-
const defaultKeyFormatter = key =>
|
|
36
|
+
const defaultKeyFormatter = key => JSON.stringify(key);
|
|
37
37
|
const entries = [];
|
|
38
38
|
const sortedKeys = Object.keys(obj).sort((a, b) => a.localeCompare(b));
|
|
39
39
|
for (const key of sortedKeys) {
|
|
@@ -45,6 +45,8 @@ export function stringify(obj, customizer = {}, separator = ",\n") {
|
|
|
45
45
|
} else {
|
|
46
46
|
entries.push(`${res[0]}: ${res[1]}`);
|
|
47
47
|
}
|
|
48
|
+
} else if (value === undefined) {
|
|
49
|
+
entries.push(`${defaultKeyFormatter(key)}: undefined`);
|
|
48
50
|
}
|
|
49
51
|
}
|
|
50
52
|
return entries.join(separator);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stringify.js","names":["defaultCustomizer","value","defaultValueFormatter","key","defaultKeyFormatter","stringify","obj","customizer","separator","JSON","entries","sortedKeys","Object","keys","sort","a","b","localeCompare","res","push","join"],"sources":["stringify.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A function for changing the stringified key/value pairs of an object.\n *\n * @param value The value of the key/value pair.\n * @param defaultValueFormatter The function that would be called if this customizer wasn't used\n * @param key The key of the key/value pair.\n * @param defaultKeyFormatter The function that would be called if this customizer wasn't used\n *\n * @returns A string, a tuple of strings, or undefined.\n * If a string is returned, it will be used as the value of the key/value pair.\n * If a tuple of strings is returned, the first string will be used as the key of the key/value pair\n * and the second string will be used as the value of the key/value pair.\n * If undefined is returned, the pair will be removed\n */\ntype Customizer<K extends string | symbol | number, V extends {}> = (\n value: V,\n defaultValueFormatter: (value: any) => string,\n key: K extends \"*\" ? string : K,\n defaultKeyFormatter: (key: string) => string,\n) => [string, string] | string | undefined;\nconst defaultCustomizer: Customizer<string, any> = (\n value,\n defaultValueFormatter,\n key,\n defaultKeyFormatter,\n) => {\n return [defaultKeyFormatter(key), defaultValueFormatter(value)];\n};\n\nexport function stringify<T extends Record<string, any>>(\n obj: T,\n customizer: {\n [K in keyof T | \"*\"]?: Customizer<K, T[K]>;\n } = {},\n separator = \",\\n\",\n): string {\n const defaultKeyFormatter = (key: string) =>
|
|
1
|
+
{"version":3,"file":"stringify.js","names":["defaultCustomizer","value","defaultValueFormatter","key","defaultKeyFormatter","stringify","obj","customizer","separator","JSON","entries","sortedKeys","Object","keys","sort","a","b","localeCompare","res","push","undefined","join"],"sources":["stringify.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * A function for changing the stringified key/value pairs of an object.\n *\n * @param value The value of the key/value pair.\n * @param defaultValueFormatter The function that would be called if this customizer wasn't used\n * @param key The key of the key/value pair.\n * @param defaultKeyFormatter The function that would be called if this customizer wasn't used\n *\n * @returns A string, a tuple of strings, or undefined.\n * If a string is returned, it will be used as the value of the key/value pair.\n * If a tuple of strings is returned, the first string will be used as the key of the key/value pair\n * and the second string will be used as the value of the key/value pair.\n * If undefined is returned, the pair will be removed\n */\ntype Customizer<K extends string | symbol | number, V extends {}> = (\n value: V,\n defaultValueFormatter: (value: any) => string,\n key: K extends \"*\" ? string : K,\n defaultKeyFormatter: (key: string) => string,\n) => [string, string] | string | undefined;\nconst defaultCustomizer: Customizer<string, any> = (\n value,\n defaultValueFormatter,\n key,\n defaultKeyFormatter,\n) => {\n return [defaultKeyFormatter(key), defaultValueFormatter(value)];\n};\n\nexport function stringify<T extends Record<string, any>>(\n obj: T,\n customizer: {\n [K in keyof T | \"*\"]?: Customizer<K, T[K]>;\n } = {},\n separator = \",\\n\",\n): string {\n const defaultKeyFormatter = (key: string) => JSON.stringify(key);\n const entries: Array<string> = [];\n\n const sortedKeys = Object.keys(obj).sort((a, b) => a.localeCompare(b));\n\n for (const key of sortedKeys) {\n const value = obj[key];\n const res =\n (customizer[key as keyof T] ?? customizer[\"*\"] ?? defaultCustomizer)(\n value,\n (value) => JSON.stringify(value, null, 2),\n key as any,\n defaultKeyFormatter,\n );\n\n if (res) {\n if (typeof res === \"string\") {\n entries.push(`${defaultKeyFormatter(key)}: ${res}`);\n } else {\n entries.push(`${res[0]}: ${res[1]}`);\n }\n } else if (value === undefined) {\n entries.push(`${defaultKeyFormatter(key)}: undefined`);\n }\n }\n return entries.join(separator);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,MAAMA,iBAA0C,GAAGA,CACjDC,KAAK,EACLC,qBAAqB,EACrBC,GAAG,EACHC,mBAAmB,KAChB;EACH,OAAO,CAACA,mBAAmB,CAACD,GAAG,CAAC,EAAED,qBAAqB,CAACD,KAAK,CAAC,CAAC;AACjE,CAAC;AAED,OAAO,SAASI,SAASA,CACvBC,GAAM,EACNC,UAEC,GAAG,CAAC,CAAC,EACNC,SAAS,GAAG,KAAK,EACT;EACR,MAAMJ,mBAAmB,GAAID,GAAW,IAAKM,IAAI,CAACJ,SAAS,CAACF,GAAG,CAAC;EAChE,MAAMO,OAAsB,GAAG,EAAE;EAEjC,MAAMC,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACP,GAAG,CAAC,CAACQ,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACE,aAAa,CAACD,CAAC,CAAC,CAAC;EAEtE,KAAK,MAAMb,GAAG,IAAIQ,UAAU,EAAE;IAC5B,MAAMV,KAAK,GAAGK,GAAG,CAACH,GAAG,CAAC;IACtB,MAAMe,GAAG,GACP,CAACX,UAAU,CAACJ,GAAG,CAAY,IAAII,UAAU,CAAC,GAAG,CAAC,IAAIP,iBAAiB,EACjEC,KAAK,EACJA,KAAK,IAAKQ,IAAI,CAACJ,SAAS,CAACJ,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC,EACzCE,GAAG,EACHC,mBACF,CAAC;IAEH,IAAIc,GAAG,EAAE;MACP,IAAI,OAAOA,GAAG,KAAK,QAAQ,EAAE;QAC3BR,OAAO,CAACS,IAAI,CAAC,GAAGf,mBAAmB,CAACD,GAAG,CAAC,KAAKe,GAAG,EAAE,CAAC;MACrD,CAAC,MAAM;QACLR,OAAO,CAACS,IAAI,CAAC,GAAGD,GAAG,CAAC,CAAC,CAAC,KAAKA,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC;MACtC;IACF,CAAC,MAAM,IAAIjB,KAAK,KAAKmB,SAAS,EAAE;MAC9BV,OAAO,CAACS,IAAI,CAAC,GAAGf,mBAAmB,CAACD,GAAG,CAAC,aAAa,CAAC;IACxD;EACF;EACA,OAAOO,OAAO,CAACW,IAAI,CAACb,SAAS,CAAC;AAChC","ignoreList":[]}
|
|
@@ -128,6 +128,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
128
128
|
linksType: OsdkObjectLinks$Bar;
|
|
129
129
|
strictProps: Bar.StrictProps;
|
|
130
130
|
apiName: "Bar";
|
|
131
|
+
description: undefined;
|
|
131
132
|
displayName: "Bar";
|
|
132
133
|
implementedBy: [];
|
|
133
134
|
implements: [];
|
|
@@ -177,6 +178,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
177
178
|
export interface Props {
|
|
178
179
|
/**
|
|
179
180
|
* display name: 'foo property dn',
|
|
181
|
+
*
|
|
180
182
|
* description: foo property desc
|
|
181
183
|
*/
|
|
182
184
|
readonly foo: $PropType["integer"] | undefined;
|
|
@@ -215,6 +217,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
215
217
|
properties: {
|
|
216
218
|
/**
|
|
217
219
|
* display name: 'foo property dn',
|
|
220
|
+
*
|
|
218
221
|
* description: foo property desc
|
|
219
222
|
*/
|
|
220
223
|
foo: $PropertyDef<"integer", "nullable", "single">;
|
|
@@ -258,11 +261,13 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
258
261
|
export interface Props {
|
|
259
262
|
/**
|
|
260
263
|
* display name: 'bar property dn',
|
|
264
|
+
*
|
|
261
265
|
* description: bar property desc
|
|
262
266
|
*/
|
|
263
267
|
readonly bar: $PropType["integer"] | undefined;
|
|
264
268
|
/**
|
|
265
269
|
* display name: 'foo property dn',
|
|
270
|
+
*
|
|
266
271
|
* description: foo property desc
|
|
267
272
|
*/
|
|
268
273
|
readonly foo: $PropType["integer"] | undefined;
|
|
@@ -301,11 +306,13 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
301
306
|
properties: {
|
|
302
307
|
/**
|
|
303
308
|
* display name: 'bar property dn',
|
|
309
|
+
*
|
|
304
310
|
* description: bar property desc
|
|
305
311
|
*/
|
|
306
312
|
bar: $PropertyDef<"integer", "nullable", "single">;
|
|
307
313
|
/**
|
|
308
314
|
* display name: 'foo property dn',
|
|
315
|
+
*
|
|
309
316
|
* description: foo property desc
|
|
310
317
|
*/
|
|
311
318
|
foo: $PropertyDef<"integer", "nullable", "single">;
|
|
@@ -349,6 +356,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
349
356
|
export interface Props {
|
|
350
357
|
/**
|
|
351
358
|
* display name: 'foo property dn',
|
|
359
|
+
*
|
|
352
360
|
* description: foo property desc
|
|
353
361
|
*/
|
|
354
362
|
readonly foo: $PropType["integer"] | undefined;
|
|
@@ -387,6 +395,7 @@ describe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {
|
|
|
387
395
|
properties: {
|
|
388
396
|
/**
|
|
389
397
|
* display name: 'foo property dn',
|
|
398
|
+
*
|
|
390
399
|
* description: foo property desc
|
|
391
400
|
*/
|
|
392
401
|
foo: $PropertyDef<"integer", "nullable", "single">;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js","names":["format","describe","expect","it","EnhancedInterfaceType","enhanceOntology","ForeignType","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","simpleSpt","apiName","metadataLevel","dataType","type","rid","displayName","description","undefined","simpleInterface","spts","parents","implementedByObjectTypes","properties","Object","fromEntries","map","spt","required","extendsInterfaces","links","allExtendsInterfaces","allLinks","allProperties","simpleOntology","interfaces","interfaceTypes","i","sharedPropertyTypes","flatMap","entries","actionTypes","objectTypes","ontology","queryTypes","sanitized","importExt","Bar","toBe","Error","formattedCode","parser","printWidth","toMatchInlineSnapshot","fooSpt","barSpt","Foo"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n InterfaceType,\n SharedPropertyType,\n} from \"@osdk/foundry.ontologies\";\nimport { format } from \"prettier\";\nimport { describe, expect, it } from \"vitest\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport type { WireOntologyDefinition } from \"../WireOntologyDefinition.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\n\nfunction simpleSpt<T extends string>(apiName: T, metadataLevel: 0 | 1 | 2 = 2) {\n return {\n apiName,\n dataType: {\n type: \"integer\",\n },\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} property dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} property desc` : undefined,\n } as const satisfies SharedPropertyType;\n}\n\nfunction simpleInterface<T extends string, Q extends SharedPropertyType>(\n apiName: T,\n spts: Q[],\n parents: string[],\n metadataLevel: 0 | 1 | 2 = 2,\n implementedByObjectTypes: string[] = [],\n) {\n const properties = Object.fromEntries(\n spts.map(spt => [spt.apiName, { ...spt, required: true }]),\n );\n\n return {\n apiName,\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} interface dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} interface desc` : undefined,\n extendsInterfaces: parents,\n links: {},\n properties,\n implementedByObjectTypes,\n allExtendsInterfaces: parents,\n allLinks: {},\n allProperties: properties,\n } as const satisfies InterfaceType;\n}\n\nfunction simpleOntology<I extends InterfaceType>(\n apiName: string,\n interfaces: I[],\n) {\n const interfaceTypes: Record<I[\"apiName\"], I> = Object\n .fromEntries(\n interfaces.map(i => [i.apiName, i]),\n ) as Record<string, I>;\n\n const sharedPropertyTypes: Record<string, I[\"properties\"][string]> = Object\n .fromEntries(\n interfaces.flatMap(i => Object.entries(i.properties)),\n ) as Record<string, I[\"properties\"][string]>;\n\n return {\n actionTypes: {},\n interfaceTypes,\n objectTypes: {},\n ontology: {\n apiName,\n description: `${apiName} ontology desc`,\n displayName: `${apiName} ontology dn`,\n rid: `${apiName} ontology rid`,\n },\n queryTypes: {},\n sharedPropertyTypes,\n } as const satisfies WireOntologyDefinition;\n}\n\ndescribe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {\n it(\"Does not say (inherited) on properties locally defined\", async () => {\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Bar\", [simpleSpt(\"bar\", 0)], [], 0),\n ]),\n importExt: \"\",\n });\n\n expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(\n true,\n );\n\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Bar,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n printWidth: 100,\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Bar = {};\n\n export namespace Bar {\n export type PropertyKeys = \"bar\";\n\n export interface Props {\n /**\n * (no ontology metadata)\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = $Osdk.Instance<Bar, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Bar extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Bar\";\n __DefinitionMetadata?: {\n objectSet: Bar.ObjectSet;\n props: Bar.Props;\n linksType: OsdkObjectLinks$Bar;\n strictProps: Bar.StrictProps;\n apiName: \"Bar\";\n displayName: \"Bar\";\n implementedBy: [];\n implements: [];\n links: {};\n properties: {\n /**\n * (no ontology metadata)\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"BarRid\";\n type: \"interface\";\n };\n }\n\n export const Bar: Bar = {\n type: \"interface\",\n apiName: \"Bar\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"allows for SPT reuse if the same\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt, barSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\" | \"bar\";\n\n export interface Props {\n /**\n * display name: 'bar property dn',\n * description: bar property desc\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'bar property dn',\n * description: bar property desc\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n it(\"Generates map for implementedBy\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"], 2, [\"childrenObject\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n readonly foo: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Foo, Foo.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = $Osdk.Instance<Foo, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Foo.Props = keyof Foo.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Foo extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Foo\";\n __DefinitionMetadata?: {\n objectSet: Foo.ObjectSet;\n props: Foo.Props;\n linksType: OsdkObjectLinks$Foo;\n strictProps: Foo.StrictProps;\n apiName: \"Foo\";\n description: \"Foo interface desc\";\n displayName: \"Foo interface dn\";\n implementedBy: [\"childrenObject\"];\n implements: [\"Parent\"];\n links: {};\n properties: {\n /**\n * display name: 'foo property dn',\n * description: foo property desc\n */\n foo: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"FooRid\";\n type: \"interface\";\n };\n }\n\n export const Foo: Foo = {\n type: \"interface\",\n apiName: \"Foo\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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ACD;MACEQ,MAAM,EAAE;IACV,CACF,CAAC;IACD/C,MAAM,CAAC8C,aAAa,CAAC,CAACG,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;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,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js","names":["format","describe","expect","it","EnhancedInterfaceType","enhanceOntology","ForeignType","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst","simpleSpt","apiName","metadataLevel","dataType","type","rid","displayName","description","undefined","simpleInterface","spts","parents","implementedByObjectTypes","properties","Object","fromEntries","map","spt","required","extendsInterfaces","links","allExtendsInterfaces","allLinks","allProperties","simpleOntology","interfaces","interfaceTypes","i","sharedPropertyTypes","flatMap","entries","actionTypes","objectTypes","ontology","queryTypes","sanitized","importExt","Bar","toBe","Error","formattedCode","parser","printWidth","toMatchInlineSnapshot","fooSpt","barSpt","Foo"],"sources":["UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n InterfaceType,\n SharedPropertyType,\n} from \"@osdk/foundry.ontologies\";\nimport { format } from \"prettier\";\nimport { describe, expect, it } from \"vitest\";\nimport { EnhancedInterfaceType } from \"../GenerateContext/EnhancedInterfaceType.js\";\nimport { enhanceOntology } from \"../GenerateContext/enhanceOntology.js\";\nimport { ForeignType } from \"../GenerateContext/ForeignType.js\";\nimport type { WireOntologyDefinition } from \"../WireOntologyDefinition.js\";\nimport { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst } from \"./UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js\";\n\nfunction simpleSpt<T extends string>(apiName: T, metadataLevel: 0 | 1 | 2 = 2) {\n return {\n apiName,\n dataType: {\n type: \"integer\",\n },\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} property dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} property desc` : undefined,\n } as const satisfies SharedPropertyType;\n}\n\nfunction simpleInterface<T extends string, Q extends SharedPropertyType>(\n apiName: T,\n spts: Q[],\n parents: string[],\n metadataLevel: 0 | 1 | 2 = 2,\n implementedByObjectTypes: string[] = [],\n) {\n const properties = Object.fromEntries(\n spts.map(spt => [spt.apiName, { ...spt, required: true }]),\n );\n\n return {\n apiName,\n rid: `${apiName}Rid`,\n displayName: metadataLevel >= 1 ? `${apiName} interface dn` : apiName,\n description: metadataLevel >= 2 ? `${apiName} interface desc` : undefined,\n extendsInterfaces: parents,\n links: {},\n properties,\n implementedByObjectTypes,\n allExtendsInterfaces: parents,\n allLinks: {},\n allProperties: properties,\n } as const satisfies InterfaceType;\n}\n\nfunction simpleOntology<I extends InterfaceType>(\n apiName: string,\n interfaces: I[],\n) {\n const interfaceTypes: Record<I[\"apiName\"], I> = Object\n .fromEntries(\n interfaces.map(i => [i.apiName, i]),\n ) as Record<string, I>;\n\n const sharedPropertyTypes: Record<string, I[\"properties\"][string]> = Object\n .fromEntries(\n interfaces.flatMap(i => Object.entries(i.properties)),\n ) as Record<string, I[\"properties\"][string]>;\n\n return {\n actionTypes: {},\n interfaceTypes,\n objectTypes: {},\n ontology: {\n apiName,\n description: `${apiName} ontology desc`,\n displayName: `${apiName} ontology dn`,\n rid: `${apiName} ontology rid`,\n },\n queryTypes: {},\n sharedPropertyTypes,\n } as const satisfies WireOntologyDefinition;\n}\n\ndescribe(__UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst, () => {\n it(\"Does not say (inherited) on properties locally defined\", async () => {\n const ontology = enhanceOntology({\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Bar\", [simpleSpt(\"bar\", 0)], [], 0),\n ]),\n importExt: \"\",\n });\n\n expect(ontology.interfaceTypes.Bar instanceof EnhancedInterfaceType).toBe(\n true,\n );\n\n // type guard for below\n if (ontology.interfaceTypes.Bar instanceof ForeignType) {\n throw new Error(\"Expected Bar to be an EnhancedInterfaceType\");\n }\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Bar,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n printWidth: 100,\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Bar = {};\n\n export namespace Bar {\n export type PropertyKeys = \"bar\";\n\n export interface Props {\n /**\n * (no ontology metadata)\n */\n readonly bar: $PropType[\"integer\"] | undefined;\n }\n export type StrictProps = Props;\n\n export interface ObjectSet extends $ObjectSet<Bar, Bar.ObjectSet> {}\n\n export type OsdkInstance<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = $Osdk.Instance<Bar, OPTIONS, K>;\n\n /** @deprecated use OsdkInstance */\n export type OsdkObject<\n OPTIONS extends never | \"$rid\" = never,\n K extends keyof Bar.Props = keyof Bar.Props,\n > = OsdkInstance<OPTIONS, K>;\n }\n\n export interface Bar extends $InterfaceDefinition {\n osdkMetadata: typeof $osdkMetadata;\n type: \"interface\";\n apiName: \"Bar\";\n __DefinitionMetadata?: {\n objectSet: Bar.ObjectSet;\n props: Bar.Props;\n linksType: OsdkObjectLinks$Bar;\n strictProps: Bar.StrictProps;\n apiName: \"Bar\";\n description: undefined;\n displayName: \"Bar\";\n implementedBy: [];\n implements: [];\n links: {};\n properties: {\n /**\n * (no ontology metadata)\n */\n bar: $PropertyDef<\"integer\", \"nullable\", \"single\">;\n };\n rid: \"BarRid\";\n type: \"interface\";\n };\n }\n\n export const Bar: Bar = {\n type: \"interface\",\n apiName: \"Bar\",\n osdkMetadata: $osdkMetadata,\n };\n \"\n `);\n });\n\n it(\"Generates properties for inherited SPTs\", async () => {\n const fooSpt = simpleSpt(\"foo\");\n const barSpt = simpleSpt(\"bar\");\n\n const ontology = enhanceOntology(\n {\n sanitized: simpleOntology(\"ontology\", [\n simpleInterface(\"Foo\", [fooSpt], [\"Parent\"]),\n simpleInterface(\"Parent\", [barSpt], []),\n ]),\n\n importExt: \"\",\n },\n );\n\n const formattedCode = await format(\n __UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst(\n ontology.interfaceTypes.Foo as EnhancedInterfaceType,\n ontology,\n true,\n true,\n ),\n {\n parser: \"typescript\",\n },\n );\n expect(formattedCode).toMatchInlineSnapshot(`\n \"import type {\n InterfaceDefinition as $InterfaceDefinition,\n ObjectSet as $ObjectSet,\n Osdk as $Osdk,\n PropertyValueWireToClient as $PropType,\n } from \"@osdk/api\";\n\n export type OsdkObjectLinks$Foo = {};\n\n export namespace Foo {\n export type PropertyKeys = \"foo\";\n\n export interface Props {\n /**\n * display name: 'foo property dn',\n *\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"],"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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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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,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;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -614,6 +614,7 @@ describe("generator", () => {
|
|
|
614
614
|
export interface Props {
|
|
615
615
|
/**
|
|
616
616
|
* display name: 'Sum Property',
|
|
617
|
+
*
|
|
617
618
|
* description: Some property
|
|
618
619
|
*/
|
|
619
620
|
readonly SomeProperty: $PropType['string'] | undefined;
|
|
@@ -652,6 +653,7 @@ describe("generator", () => {
|
|
|
652
653
|
properties: {
|
|
653
654
|
/**
|
|
654
655
|
* display name: 'Sum Property',
|
|
656
|
+
*
|
|
655
657
|
* description: Some property
|
|
656
658
|
*/
|
|
657
659
|
SomeProperty: $PropertyDef<'string', 'nullable', 'single'>;
|
|
@@ -752,6 +754,7 @@ describe("generator", () => {
|
|
|
752
754
|
status: 'ACTIVE';
|
|
753
755
|
titleProperty: 'email';
|
|
754
756
|
type: 'object';
|
|
757
|
+
visibility: undefined;
|
|
755
758
|
};
|
|
756
759
|
}
|
|
757
760
|
|
|
@@ -788,6 +791,7 @@ describe("generator", () => {
|
|
|
788
791
|
export interface Props {
|
|
789
792
|
/**
|
|
790
793
|
* display name: 'Body',
|
|
794
|
+
*
|
|
791
795
|
* description: The text of the todo
|
|
792
796
|
*/
|
|
793
797
|
readonly body: $PropType['string'] | undefined;
|
|
@@ -853,6 +857,7 @@ describe("generator", () => {
|
|
|
853
857
|
properties: {
|
|
854
858
|
/**
|
|
855
859
|
* display name: 'Body',
|
|
860
|
+
*
|
|
856
861
|
* description: The text of the todo
|
|
857
862
|
*/
|
|
858
863
|
body: $PropertyDef<'string', 'nullable', 'single'>;
|
|
@@ -869,6 +874,7 @@ describe("generator", () => {
|
|
|
869
874
|
status: 'ACTIVE';
|
|
870
875
|
titleProperty: 'body';
|
|
871
876
|
type: 'object';
|
|
877
|
+
visibility: undefined;
|
|
872
878
|
};
|
|
873
879
|
}
|
|
874
880
|
|
|
@@ -1218,6 +1224,7 @@ describe("generator", () => {
|
|
|
1218
1224
|
export interface Props {
|
|
1219
1225
|
/**
|
|
1220
1226
|
* display name: 'Sum Property',
|
|
1227
|
+
*
|
|
1221
1228
|
* description: Some property
|
|
1222
1229
|
*/
|
|
1223
1230
|
readonly SomeProperty: $PropType['string'] | undefined;
|
|
@@ -1256,6 +1263,7 @@ describe("generator", () => {
|
|
|
1256
1263
|
properties: {
|
|
1257
1264
|
/**
|
|
1258
1265
|
* display name: 'Sum Property',
|
|
1266
|
+
*
|
|
1259
1267
|
* description: Some property
|
|
1260
1268
|
*/
|
|
1261
1269
|
SomeProperty: $PropertyDef<'string', 'nullable', 'single'>;
|
|
@@ -1356,6 +1364,7 @@ describe("generator", () => {
|
|
|
1356
1364
|
status: 'ACTIVE';
|
|
1357
1365
|
titleProperty: 'email';
|
|
1358
1366
|
type: 'object';
|
|
1367
|
+
visibility: undefined;
|
|
1359
1368
|
};
|
|
1360
1369
|
}
|
|
1361
1370
|
|
|
@@ -1392,6 +1401,7 @@ describe("generator", () => {
|
|
|
1392
1401
|
export interface Props {
|
|
1393
1402
|
/**
|
|
1394
1403
|
* display name: 'Body',
|
|
1404
|
+
*
|
|
1395
1405
|
* description: The text of the todo
|
|
1396
1406
|
*/
|
|
1397
1407
|
readonly body: $PropType['string'] | undefined;
|
|
@@ -1457,6 +1467,7 @@ describe("generator", () => {
|
|
|
1457
1467
|
properties: {
|
|
1458
1468
|
/**
|
|
1459
1469
|
* display name: 'Body',
|
|
1470
|
+
*
|
|
1460
1471
|
* description: The text of the todo
|
|
1461
1472
|
*/
|
|
1462
1473
|
body: $PropertyDef<'string', 'nullable', 'single'>;
|
|
@@ -1473,6 +1484,7 @@ describe("generator", () => {
|
|
|
1473
1484
|
status: 'ACTIVE';
|
|
1474
1485
|
titleProperty: 'body';
|
|
1475
1486
|
type: 'object';
|
|
1487
|
+
visibility: undefined;
|
|
1476
1488
|
};
|
|
1477
1489
|
}
|
|
1478
1490
|
|
|
@@ -1777,6 +1789,7 @@ describe("generator", () => {
|
|
|
1777
1789
|
linksType: UsesForeignSpt.Links;
|
|
1778
1790
|
strictProps: UsesForeignSpt.StrictProps;
|
|
1779
1791
|
apiName: 'UsesForeignSpt';
|
|
1792
|
+
description: undefined;
|
|
1780
1793
|
displayName: 'Uses Foreign Spt';
|
|
1781
1794
|
icon: {
|
|
1782
1795
|
type: 'blueprint';
|
|
@@ -1804,6 +1817,7 @@ describe("generator", () => {
|
|
|
1804
1817
|
status: 'ACTIVE';
|
|
1805
1818
|
titleProperty: 'id';
|
|
1806
1819
|
type: 'object';
|
|
1820
|
+
visibility: undefined;
|
|
1807
1821
|
};
|
|
1808
1822
|
}
|
|
1809
1823
|
|
|
@@ -1835,11 +1849,13 @@ describe("generator", () => {
|
|
|
1835
1849
|
// Represents the definition of the parameters for the action
|
|
1836
1850
|
export type ParamsDefinition = {
|
|
1837
1851
|
body: {
|
|
1852
|
+
description: undefined;
|
|
1838
1853
|
multiplicity: false;
|
|
1839
1854
|
nullable: false;
|
|
1840
1855
|
type: 'string';
|
|
1841
1856
|
};
|
|
1842
1857
|
task: {
|
|
1858
|
+
description: undefined;
|
|
1843
1859
|
multiplicity: false;
|
|
1844
1860
|
nullable: false;
|
|
1845
1861
|
type: ActionMetadata.DataType.Object<$Imported$com$example$dep$Task>;
|
|
@@ -2025,6 +2041,7 @@ describe("generator", () => {
|
|
|
2025
2041
|
status: 'ACTIVE';
|
|
2026
2042
|
titleProperty: 'email';
|
|
2027
2043
|
type: 'object';
|
|
2044
|
+
visibility: undefined;
|
|
2028
2045
|
};
|
|
2029
2046
|
}
|
|
2030
2047
|
|
|
@@ -2061,6 +2078,7 @@ describe("generator", () => {
|
|
|
2061
2078
|
export interface Props {
|
|
2062
2079
|
/**
|
|
2063
2080
|
* display name: 'Body',
|
|
2081
|
+
*
|
|
2064
2082
|
* description: The text of the todo
|
|
2065
2083
|
*/
|
|
2066
2084
|
readonly body: $PropType['string'] | undefined;
|
|
@@ -2126,6 +2144,7 @@ describe("generator", () => {
|
|
|
2126
2144
|
properties: {
|
|
2127
2145
|
/**
|
|
2128
2146
|
* display name: 'Body',
|
|
2147
|
+
*
|
|
2129
2148
|
* description: The text of the todo
|
|
2130
2149
|
*/
|
|
2131
2150
|
body: $PropertyDef<'string', 'nullable', 'single'>;
|
|
@@ -2142,6 +2161,7 @@ describe("generator", () => {
|
|
|
2142
2161
|
status: 'ACTIVE';
|
|
2143
2162
|
titleProperty: 'body';
|
|
2144
2163
|
type: 'object';
|
|
2164
|
+
visibility: undefined;
|
|
2145
2165
|
};
|
|
2146
2166
|
}
|
|
2147
2167
|
|
|
@@ -2351,6 +2371,7 @@ describe("generator", () => {
|
|
|
2351
2371
|
linksType: OsdkObjectLinks$SomeInterface;
|
|
2352
2372
|
strictProps: SomeInterface.StrictProps;
|
|
2353
2373
|
apiName: 'com.example.dep.SomeInterface';
|
|
2374
|
+
description: undefined;
|
|
2354
2375
|
displayName: 'Sum Interface';
|
|
2355
2376
|
implementedBy: [];
|
|
2356
2377
|
implements: [];
|
|
@@ -2435,6 +2456,7 @@ describe("generator", () => {
|
|
|
2435
2456
|
linksType: Task.Links;
|
|
2436
2457
|
strictProps: Task.StrictProps;
|
|
2437
2458
|
apiName: 'com.example.dep.Task';
|
|
2459
|
+
description: undefined;
|
|
2438
2460
|
displayName: 'Task';
|
|
2439
2461
|
icon: {
|
|
2440
2462
|
type: 'blueprint';
|
|
@@ -2462,6 +2484,7 @@ describe("generator", () => {
|
|
|
2462
2484
|
status: 'ACTIVE';
|
|
2463
2485
|
titleProperty: 'taskId';
|
|
2464
2486
|
type: 'object';
|
|
2487
|
+
visibility: undefined;
|
|
2465
2488
|
};
|
|
2466
2489
|
}
|
|
2467
2490
|
|