@osdk/generator-converters 2.0.0-beta.8 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +167 -0
- package/build/{cjs/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.cts → browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts} +2 -2
- package/build/{cjs → browser}/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map +1 -1
- package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js +31 -0
- package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map +1 -0
- package/build/browser/empty.test.js +22 -0
- package/build/browser/empty.test.js.map +1 -0
- package/build/browser/getEditedEntities.d.ts +7 -0
- package/build/browser/getEditedEntities.d.ts.map +1 -0
- package/build/browser/getEditedEntities.js +41 -0
- package/build/browser/getEditedEntities.js.map +1 -0
- package/build/browser/index.d.ts +9 -0
- package/build/browser/index.d.ts.map +1 -0
- package/build/browser/index.js +23 -154
- package/build/browser/index.js.map +1 -1
- package/build/browser/isNullableQueryDataType.d.ts +3 -0
- package/build/browser/isNullableQueryDataType.d.ts.map +1 -0
- package/build/browser/isNullableQueryDataType.js +25 -0
- package/build/browser/isNullableQueryDataType.js.map +1 -0
- package/build/browser/wireActionTypeV2ToSdkActionMetadata.d.ts +4 -0
- package/build/browser/wireActionTypeV2ToSdkActionMetadata.d.ts.map +1 -0
- package/build/browser/wireActionTypeV2ToSdkActionMetadata.js +85 -0
- package/build/browser/wireActionTypeV2ToSdkActionMetadata.js.map +1 -0
- package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts +10 -0
- package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts.map +1 -0
- package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.js +56 -0
- package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.js.map +1 -0
- package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts +2 -0
- package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts.map +1 -0
- package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js +67 -0
- package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map +1 -0
- package/build/{cjs → browser}/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts.map +1 -1
- package/build/browser/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js +51 -0
- package/build/browser/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js.map +1 -0
- package/build/{cjs/wirePropertyV2ToSdkPropertyDefinition.d.cts → browser/wirePropertyV2ToSdkPropertyDefinition.d.ts} +2 -2
- package/build/browser/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +1 -0
- package/build/browser/wirePropertyV2ToSdkPropertyDefinition.js +90 -0
- package/build/browser/wirePropertyV2ToSdkPropertyDefinition.js.map +1 -0
- package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.d.ts +4 -0
- package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +1 -0
- package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js +143 -0
- package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -0
- package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.d.ts +13 -0
- package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.d.ts.map +1 -0
- package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.js +45 -0
- package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.js.map +1 -0
- package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts +2 -2
- package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map +1 -1
- package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js +31 -0
- package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map +1 -0
- package/build/esm/empty.test.js +22 -0
- package/build/esm/empty.test.js.map +1 -0
- package/build/esm/getEditedEntities.d.ts +7 -0
- package/build/esm/getEditedEntities.d.ts.map +1 -0
- package/build/esm/getEditedEntities.js +41 -0
- package/build/esm/getEditedEntities.js.map +1 -0
- package/build/esm/index.d.ts +6 -1
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +23 -154
- package/build/esm/index.js.map +1 -1
- package/build/esm/isNullableQueryDataType.d.ts +3 -0
- package/build/esm/isNullableQueryDataType.d.ts.map +1 -0
- package/build/esm/isNullableQueryDataType.js +25 -0
- package/build/esm/isNullableQueryDataType.js.map +1 -0
- package/build/esm/wireActionTypeV2ToSdkActionMetadata.d.ts +4 -0
- package/build/esm/wireActionTypeV2ToSdkActionMetadata.d.ts.map +1 -0
- package/build/esm/wireActionTypeV2ToSdkActionMetadata.js +85 -0
- package/build/esm/wireActionTypeV2ToSdkActionMetadata.js.map +1 -0
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts +10 -0
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts.map +1 -0
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.js +56 -0
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.js.map +1 -0
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts +2 -0
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts.map +1 -0
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js +67 -0
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map +1 -0
- package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts.map +1 -1
- package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js +51 -0
- package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js.map +1 -0
- package/build/esm/wirePropertyV2ToSdkPropertyDefinition.d.ts +2 -2
- package/build/esm/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +1 -1
- package/build/esm/wirePropertyV2ToSdkPropertyDefinition.js +90 -0
- package/build/esm/wirePropertyV2ToSdkPropertyDefinition.js.map +1 -0
- package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.d.ts +4 -0
- package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +1 -0
- package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js +143 -0
- package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -0
- package/build/esm/wireQueryTypeV2ToSdkQueryMetadata.d.ts +13 -0
- package/build/esm/wireQueryTypeV2ToSdkQueryMetadata.d.ts.map +1 -0
- package/build/esm/wireQueryTypeV2ToSdkQueryMetadata.js +45 -0
- package/build/esm/wireQueryTypeV2ToSdkQueryMetadata.js.map +1 -0
- package/package.json +7 -12
- package/build/cjs/index.cjs +0 -159
- package/build/cjs/index.cjs.map +0 -1
- package/build/cjs/index.d.cts +0 -4
- package/build/cjs/index.d.ts.map +0 -1
- package/build/cjs/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.cts +0 -10
- package/build/cjs/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts.map +0 -1
- package/build/cjs/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.cts +0 -2
- package/build/cjs/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.ts.map +0 -1
- package/build/cjs/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +0 -1
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts +0 -10
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.d.ts.map +0 -1
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.ts +0 -2
- package/build/esm/wireObjectTypeFullMetadataToSdkObjectTypeDefinition.test.d.ts.map +0 -1
- /package/build/{cjs/empty.test.d.cts → browser/empty.test.d.ts} +0 -0
- /package/build/{cjs → browser}/empty.test.d.ts.map +0 -0
- /package/build/{cjs/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.cts → browser/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts} +0 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from "./wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js";
|
|
17
|
+
import { wirePropertyV2ToSdkPropertyDefinition } from "./wirePropertyV2ToSdkPropertyDefinition.js";
|
|
18
|
+
export function wireObjectTypeFullMetadataToSdkObjectMetadata(objectTypeWithLink, v2) {
|
|
19
|
+
if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === undefined) {
|
|
20
|
+
throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);
|
|
21
|
+
}
|
|
22
|
+
// saved ontology.json files may not have this implementsInterfaces2 so we need to handle
|
|
23
|
+
if (objectTypeWithLink.implementsInterfaces2 == null && objectTypeWithLink.implementsInterfaces != null) {
|
|
24
|
+
throw new Error("Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.");
|
|
25
|
+
}
|
|
26
|
+
const interfaceMap = objectTypeWithLink.implementsInterfaces2 ? Object.fromEntries(Object.entries(objectTypeWithLink.implementsInterfaces2).map(([interfaceApiName, impl]) => [interfaceApiName, impl.properties])) : {};
|
|
27
|
+
return {
|
|
28
|
+
type: "object",
|
|
29
|
+
apiName: objectTypeWithLink.objectType.apiName,
|
|
30
|
+
description: objectTypeWithLink.objectType.description,
|
|
31
|
+
primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,
|
|
32
|
+
primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey]),
|
|
33
|
+
links: Object.fromEntries(objectTypeWithLink.linkTypes.map(linkType => {
|
|
34
|
+
return [linkType.apiName, {
|
|
35
|
+
multiplicity: linkType.cardinality === "MANY",
|
|
36
|
+
targetType: linkType.objectTypeApiName
|
|
37
|
+
}];
|
|
38
|
+
})),
|
|
39
|
+
properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))])),
|
|
40
|
+
implements: objectTypeWithLink.implementsInterfaces,
|
|
41
|
+
interfaceMap,
|
|
42
|
+
inverseInterfaceMap: Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)])),
|
|
43
|
+
icon: supportedIconTypes.includes(objectTypeWithLink.objectType.icon.type) ? objectTypeWithLink.objectType.icon : undefined,
|
|
44
|
+
titleProperty: objectTypeWithLink.objectType.titleProperty,
|
|
45
|
+
displayName: objectTypeWithLink.objectType.displayName,
|
|
46
|
+
pluralDisplayName: objectTypeWithLink.objectType.pluralDisplayName,
|
|
47
|
+
status: objectTypeWithLink.objectType.status,
|
|
48
|
+
rid: objectTypeWithLink.objectType.rid,
|
|
49
|
+
visibility: objectTypeWithLink.objectType.visibility
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function invertProps(a) {
|
|
53
|
+
return a ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k])) : undefined;
|
|
54
|
+
}
|
|
55
|
+
const supportedIconTypes = ["blueprint"];
|
|
56
|
+
//# sourceMappingURL=wireObjectTypeFullMetadataToSdkObjectMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectMetadata.js","names":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition","wirePropertyV2ToSdkPropertyDefinition","wireObjectTypeFullMetadataToSdkObjectMetadata","objectTypeWithLink","v2","objectType","properties","primaryKey","undefined","Error","apiName","implementsInterfaces2","implementsInterfaces","interfaceMap","Object","fromEntries","entries","map","interfaceApiName","impl","type","description","primaryKeyApiName","primaryKeyType","links","linkTypes","linkType","multiplicity","cardinality","targetType","objectTypeApiName","key","value","implements","inverseInterfaceMap","props","invertProps","icon","supportedIconTypes","includes","titleProperty","displayName","pluralDisplayName","status","rid","visibility","a","k","v"],"sources":["wireObjectTypeFullMetadataToSdkObjectMetadata.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { wirePropertyV2ToSdkPrimaryKeyTypeDefinition } from \"./wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js\";\nimport { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\nexport function wireObjectTypeFullMetadataToSdkObjectMetadata(objectTypeWithLink, v2) {\n if (objectTypeWithLink.objectType\n .properties[objectTypeWithLink.objectType.primaryKey] === undefined) {\n throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);\n }\n // saved ontology.json files may not have this implementsInterfaces2 so we need to handle\n if (objectTypeWithLink.implementsInterfaces2 == null\n && objectTypeWithLink.implementsInterfaces != null) {\n throw new Error(\"Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.\");\n }\n const interfaceMap = objectTypeWithLink.implementsInterfaces2\n ? Object.fromEntries(Object.entries(objectTypeWithLink.implementsInterfaces2).map(([interfaceApiName, impl]) => [interfaceApiName, impl.properties]))\n : {};\n return {\n type: \"object\",\n apiName: objectTypeWithLink.objectType.apiName,\n description: objectTypeWithLink.objectType.description,\n primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,\n primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(objectTypeWithLink.objectType\n .properties[objectTypeWithLink.objectType.primaryKey]),\n links: Object.fromEntries(objectTypeWithLink.linkTypes.map(linkType => {\n return [linkType.apiName, {\n multiplicity: linkType.cardinality === \"MANY\",\n targetType: linkType.objectTypeApiName,\n }];\n })),\n properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [\n key,\n wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key)),\n ])),\n implements: objectTypeWithLink.implementsInterfaces,\n interfaceMap,\n inverseInterfaceMap: Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)])),\n icon: supportedIconTypes.includes(objectTypeWithLink.objectType.icon.type)\n ? objectTypeWithLink.objectType.icon\n : undefined,\n titleProperty: objectTypeWithLink.objectType.titleProperty,\n displayName: objectTypeWithLink.objectType.displayName,\n pluralDisplayName: objectTypeWithLink.objectType.pluralDisplayName,\n status: objectTypeWithLink.objectType.status,\n rid: objectTypeWithLink.objectType.rid,\n visibility: objectTypeWithLink.objectType.visibility,\n };\n}\nfunction invertProps(a) {\n return (a\n ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k]))\n : undefined);\n}\nconst supportedIconTypes = [\"blueprint\"];\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,2CAA2C,QAAQ,kDAAkD;AAC9G,SAASC,qCAAqC,QAAQ,4CAA4C;AAClG,OAAO,SAASC,6CAA6CA,CAACC,kBAAkB,EAAEC,EAAE,EAAE;EAClF,IAAID,kBAAkB,CAACE,UAAU,CAC5BC,UAAU,CAACH,kBAAkB,CAACE,UAAU,CAACE,UAAU,CAAC,KAAKC,SAAS,EAAE;IACrE,MAAM,IAAIC,KAAK,CAAC,eAAeN,kBAAkB,CAACE,UAAU,CAACE,UAAU,iBAAiBJ,kBAAkB,CAACE,UAAU,CAACK,OAAO,EAAE,CAAC;EACpI;EACA;EACA,IAAIP,kBAAkB,CAACQ,qBAAqB,IAAI,IAAI,IAC7CR,kBAAkB,CAACS,oBAAoB,IAAI,IAAI,EAAE;IACpD,MAAM,IAAIH,KAAK,CAAC,2FAA2F,CAAC;EAChH;EACA,MAAMI,YAAY,GAAGV,kBAAkB,CAACQ,qBAAqB,GACvDG,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACb,kBAAkB,CAACQ,qBAAqB,CAAC,CAACM,GAAG,CAAC,CAAC,CAACC,gBAAgB,EAAEC,IAAI,CAAC,KAAK,CAACD,gBAAgB,EAAEC,IAAI,CAACb,UAAU,CAAC,CAAC,CAAC,GACnJ,CAAC,CAAC;EACR,OAAO;IACHc,IAAI,EAAE,QAAQ;IACdV,OAAO,EAAEP,kBAAkB,CAACE,UAAU,CAACK,OAAO;IAC9CW,WAAW,EAAElB,kBAAkB,CAACE,UAAU,CAACgB,WAAW;IACtDC,iBAAiB,EAAEnB,kBAAkB,CAACE,UAAU,CAACE,UAAU;IAC3DgB,cAAc,EA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WAAW;IACtDC,iBAAiB,EAAEvC,kBAAkB,CAACE,UAAU,CAACqC,iBAAiB;IAClEC,MAAM,EAAExC,kBAAkB,CAACE,UAAU,CAACsC,MAAM;IAC5CC,GAAG,EAAEzC,kBAAkB,CAACE,UAAU,CAACuC,GAAG;IACtCC,UAAU,EAAE1C,kBAAkB,CAACE,UAAU,CAACwC;EAC9C,CAAC;AACL;AACA,SAAST,WAAWA,CAACU,CAAC,EAAE;EACpB,OAAQA,CAAC,GACHhC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAAC8B,CAAC,CAAC,CAAC7B,GAAG,CAAC,CAAC,CAAC8B,CAAC,EAAEC,CAAC,CAAC,KAAK,CAACA,CAAC,EAAED,CAAC,CAAC,CAAC,CAAC,GAC7DvC,SAAS;AACnB;AACA,MAAM8B,kBAAkB,GAAG,CAAC,WAAW,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts","sourceRoot":"","sources":["../../src/wireObjectTypeFullMetadataToSdkObjectMetadata.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { describe, expect, it } from "vitest";
|
|
17
|
+
import { wireObjectTypeFullMetadataToSdkObjectMetadata } from "./wireObjectTypeFullMetadataToSdkObjectMetadata.js";
|
|
18
|
+
describe(wireObjectTypeFullMetadataToSdkObjectMetadata, () => {
|
|
19
|
+
it("handles magic nullable properties", () => {
|
|
20
|
+
const result = wireObjectTypeFullMetadataToSdkObjectMetadata({
|
|
21
|
+
implementsInterfaces: [],
|
|
22
|
+
implementsInterfaces2: {},
|
|
23
|
+
linkTypes: [],
|
|
24
|
+
objectType: {
|
|
25
|
+
apiName: "apiName",
|
|
26
|
+
description: "description",
|
|
27
|
+
displayName: "displayName",
|
|
28
|
+
pluralDisplayName: "displayNames",
|
|
29
|
+
icon: {
|
|
30
|
+
type: "blueprint",
|
|
31
|
+
name: "blueprint",
|
|
32
|
+
color: "blue"
|
|
33
|
+
},
|
|
34
|
+
primaryKey: "primaryKey",
|
|
35
|
+
properties: {
|
|
36
|
+
primaryKey: {
|
|
37
|
+
dataType: {
|
|
38
|
+
type: "string"
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
otherKey: {
|
|
42
|
+
nullable: false,
|
|
43
|
+
dataType: {
|
|
44
|
+
type: "string"
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
defaulted: {
|
|
48
|
+
dataType: {
|
|
49
|
+
type: "string"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
rid: "rid",
|
|
54
|
+
status: "ACTIVE",
|
|
55
|
+
titleProperty: "otherKey"
|
|
56
|
+
},
|
|
57
|
+
sharedPropertyTypeMapping: {}
|
|
58
|
+
}, true);
|
|
59
|
+
// PK is never nullable
|
|
60
|
+
expect(result.properties["primaryKey"].nullable).toBe(false);
|
|
61
|
+
// was specified above
|
|
62
|
+
expect(result.properties["otherKey"].nullable).toBe(false);
|
|
63
|
+
// was unspecified, so should be nullable
|
|
64
|
+
expect(result.properties["defaulted"].nullable).toBe(true);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
//# sourceMappingURL=wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wireObjectTypeFullMetadataToSdkObjectMetadata.test.js","names":["describe","expect","it","wireObjectTypeFullMetadataToSdkObjectMetadata","result","implementsInterfaces","implementsInterfaces2","linkTypes","objectType","apiName","description","displayName","pluralDisplayName","icon","type","name","color","primaryKey","properties","dataType","otherKey","nullable","defaulted","rid","status","titleProperty","sharedPropertyTypeMapping","toBe"],"sources":["wireObjectTypeFullMetadataToSdkObjectMetadata.test.js"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { describe, expect, it } from \"vitest\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"./wireObjectTypeFullMetadataToSdkObjectMetadata.js\";\ndescribe(wireObjectTypeFullMetadataToSdkObjectMetadata, () => {\n it(\"handles magic nullable properties\", () => {\n const result = wireObjectTypeFullMetadataToSdkObjectMetadata({\n implementsInterfaces: [],\n implementsInterfaces2: {},\n linkTypes: [],\n objectType: {\n apiName: \"apiName\",\n description: \"description\",\n displayName: \"displayName\",\n pluralDisplayName: \"displayNames\",\n icon: { type: \"blueprint\", name: \"blueprint\", color: \"blue\" },\n primaryKey: \"primaryKey\",\n properties: {\n primaryKey: { dataType: { type: \"string\" } },\n otherKey: { nullable: false, dataType: { type: \"string\" } },\n defaulted: { dataType: { type: \"string\" } },\n },\n rid: \"rid\",\n status: \"ACTIVE\",\n titleProperty: \"otherKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n // PK is never nullable\n expect(result.properties[\"primaryKey\"].nullable).toBe(false);\n // was specified above\n expect(result.properties[\"otherKey\"].nullable).toBe(false);\n // was unspecified, so should be nullable\n expect(result.properties[\"defaulted\"].nullable).toBe(true);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,6CAA6C,QAAQ,oDAAoD;AAClHH,QAAQ,CAACG,6CAA6C,EAAE,MAAM;EAC1DD,EAAE,CAAC,mCAAmC,EAAE,MAAM;IAC1C,MAAME,MAAM,GAAGD,6CAA6C,CAAC;MACzDE,oBAAoB,EAAE,EAAE;MACxBC,qBAAqB,EAAE,CAAC,CAAC;MACzBC,SAAS,EAAE,EAAE;MACbC,UAAU,EAAE;QACRC,OAAO,EAAE,SAAS;QAClBC,WAAW,EAAE,aAAa;QAC1BC,WAAW,EAAE,aAAa;QAC1BC,iBAAiB,EAAE,cAAc;QACjCC,IAAI,EAAE;UAAEC,IAAI,EAAE,WAAW;UAAEC,IAAI,EAAE,WAAW;UAAEC,KAAK,EAAE;QAAO,CAAC;QAC7DC,UAAU,EAAE,YAAY;QACxBC,UAAU,EAAE;UACRD,UAAU,EAAE;YAAEE,QAAQ,EAAE;cAAEL,IAAI,EAAE;YAAS;UAAE,CAAC;UAC5CM,QAAQ,EAAE;YAAEC,QAAQ,EAAE,KAAK;YAAEF,QAAQ,EAAE;cAAEL,IAAI,EAAE;YAAS;UAAE,CAAC;UAC3DQ,SAAS,EAAE;YAAEH,QAAQ,EAAE;cAAEL,IAAI,EAAE;YAAS;UAAE;QAC9C,CAAC;QACDS,GAAG,EAAE,KAAK;QACVC,MAAM,EAAE,QAAQ;QAChBC,aAAa,EAAE;MACnB,CAAC;MACDC,yBAAyB,EAAE,CAAC;IAChC,CAAC,EAAE,IAAI,CAAC;IACR;IACAzB,MAAM,CAACG,MAAM,CAACc,UAAU,CAAC,YAAY,CAAC,CAACG,QAAQ,CAAC,CAACM,IAAI,CAAC,KAAK,CAAC;IAC5D;IACA1B,MAAM,CAACG,MAAM,CAACc,UAAU,CAAC,UAAU,CAAC,CAACG,QAAQ,CAAC,CAACM,IAAI,CAAC,KAAK,CAAC;IAC1D;IACA1B,MAAM,CAACG,MAAM,CAACc,UAAU,CAAC,WAAW,CAAC,CAACG,QAAQ,CAAC,CAACM,IAAI,CAAC,IAAI,CAAC;EAC9D,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts","sourceRoot":"","sources":["../../src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,wBAAgB,2CAA2C,CACzD,KAAK,EAAE,UAAU,GAChB,eAAe,
|
|
1
|
+
{"version":3,"file":"wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts","sourceRoot":"","sources":["../../src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,wBAAgB,2CAA2C,CACzD,KAAK,EAAE,UAAU,GAChB,eAAe,CAmCjB"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
|
|
17
|
+
switch (input.dataType.type) {
|
|
18
|
+
case "integer":
|
|
19
|
+
case "double":
|
|
20
|
+
case "string":
|
|
21
|
+
case "boolean":
|
|
22
|
+
case "byte":
|
|
23
|
+
case "long":
|
|
24
|
+
case "short":
|
|
25
|
+
{
|
|
26
|
+
return input.dataType.type;
|
|
27
|
+
}
|
|
28
|
+
case "date":
|
|
29
|
+
{
|
|
30
|
+
return "datetime";
|
|
31
|
+
}
|
|
32
|
+
case "timestamp":
|
|
33
|
+
{
|
|
34
|
+
return "timestamp";
|
|
35
|
+
}
|
|
36
|
+
case "geopoint":
|
|
37
|
+
case "geoshape":
|
|
38
|
+
case "decimal":
|
|
39
|
+
case "attachment":
|
|
40
|
+
case "timeseries":
|
|
41
|
+
case "array":
|
|
42
|
+
case "marking":
|
|
43
|
+
case "float":
|
|
44
|
+
case "geotimeSeriesReference":
|
|
45
|
+
throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);
|
|
46
|
+
default:
|
|
47
|
+
input.dataType;
|
|
48
|
+
throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js","names":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition","input","dataType","type","Error"],"sources":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"double\":\n case \"string\":\n case \"boolean\":\n case \"byte\":\n case \"long\":\n case \"short\": {\n return input.dataType.type;\n }\n case \"date\": {\n return \"datetime\";\n }\n case \"timestamp\": {\n return \"timestamp\";\n }\n case \"geopoint\":\n case \"geoshape\":\n case \"decimal\":\n case \"attachment\":\n case \"timeseries\":\n case \"array\":\n case \"marking\":\n case \"float\":\n case \"geotimeSeriesReference\":\n throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);\n default:\n const _ = input.dataType;\n throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,2CAA2CA,CAACC,KAAK,EAAE;EAC/D,QAAQA,KAAK,CAACC,QAAQ,CAACC,IAAI;IACvB,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,QAAQ;IACb,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,MAAM;IACX,KAAK,OAAO;MAAE;QACV,OAAOF,KAAK,CAACC,QAAQ,CAACC,IAAI;MAC9B;IACA,KAAK,MAAM;MAAE;QACT,OAAO,UAAU;MACrB;IACA,KAAK,WAAW;MAAE;QACd,OAAO,WAAW;MACtB;IACA,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,SAAS;IACd,KAAK,YAAY;IACjB,KAAK,YAAY;IACjB,KAAK,OAAO;IACZ,KAAK,SAAS;IACd,KAAK,OAAO;IACZ,KAAK,wBAAwB;MACzB,MAAM,IAAIC,KAAK,CAAC,sCAAsCH,KAAK,CAACC,QAAQ,CAACC,IAAI,EAAE,CAAC;IAChF;MACcF,KAAK,CAACC,QAAQ;MACxB,MAAM,IAAIE,KAAK,CAAC,4CAA4CH,KAAK,CAACC,QAAQ,EAAE,CAAC;EACrF;AACJ","ignoreList":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ObjectMetadata } from "@osdk/api";
|
|
2
2
|
import type { PropertyV2, SharedPropertyType } from "@osdk/internal.foundry.core";
|
|
3
3
|
export declare function wirePropertyV2ToSdkPropertyDefinition(input: (PropertyV2 | SharedPropertyType) & {
|
|
4
4
|
nullable?: boolean;
|
|
5
|
-
}, isNullable?: boolean):
|
|
5
|
+
}, isNullable?: boolean): ObjectMetadata.Property;
|
|
6
6
|
//# sourceMappingURL=wirePropertyV2ToSdkPropertyDefinition.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wirePropertyV2ToSdkPropertyDefinition.d.ts","sourceRoot":"","sources":["../../src/wirePropertyV2ToSdkPropertyDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"wirePropertyV2ToSdkPropertyDefinition.d.ts","sourceRoot":"","sources":["../../src/wirePropertyV2ToSdkPropertyDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,cAAc,EAAqB,MAAM,WAAW,CAAC;AACnE,OAAO,KAAK,EAEV,UAAU,EACV,kBAAkB,EACnB,MAAM,6BAA6B,CAAC;AAErC,wBAAgB,qCAAqC,CACnD,KAAK,EAAE,CAAC,UAAU,GAAG,kBAAkB,CAAC,GAAG;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,EACjE,UAAU,GAAE,OAAc,GACzB,cAAc,CAAC,QAAQ,CA6CzB"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
export function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {
|
|
17
|
+
switch (input.dataType.type) {
|
|
18
|
+
case "integer":
|
|
19
|
+
case "string":
|
|
20
|
+
case "byte":
|
|
21
|
+
case "decimal":
|
|
22
|
+
case "double":
|
|
23
|
+
case "float":
|
|
24
|
+
case "long":
|
|
25
|
+
case "short":
|
|
26
|
+
case "boolean":
|
|
27
|
+
case "date":
|
|
28
|
+
case "attachment":
|
|
29
|
+
case "geopoint":
|
|
30
|
+
case "geoshape":
|
|
31
|
+
case "timestamp":
|
|
32
|
+
case "timeseries":
|
|
33
|
+
case "marking":
|
|
34
|
+
return {
|
|
35
|
+
displayName: input.displayName,
|
|
36
|
+
multiplicity: false,
|
|
37
|
+
description: input.description,
|
|
38
|
+
type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
|
|
39
|
+
nullable: input.nullable == null ? isNullable : input.nullable
|
|
40
|
+
};
|
|
41
|
+
case "array":
|
|
42
|
+
{
|
|
43
|
+
return {
|
|
44
|
+
displayName: input.displayName,
|
|
45
|
+
multiplicity: true,
|
|
46
|
+
description: input.description,
|
|
47
|
+
type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
|
|
48
|
+
nullable: true
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
case "geotimeSeriesReference":
|
|
52
|
+
throw new Error(`Unsupported data type ${JSON.stringify(input.dataType)}`);
|
|
53
|
+
default:
|
|
54
|
+
input.dataType;
|
|
55
|
+
throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function objectPropertyTypeToSdkPropertyDefinition(propertyType) {
|
|
59
|
+
switch (propertyType.type) {
|
|
60
|
+
case "integer":
|
|
61
|
+
case "string":
|
|
62
|
+
case "byte":
|
|
63
|
+
case "decimal":
|
|
64
|
+
case "double":
|
|
65
|
+
case "float":
|
|
66
|
+
case "long":
|
|
67
|
+
case "short":
|
|
68
|
+
case "boolean":
|
|
69
|
+
case "attachment":
|
|
70
|
+
case "geopoint":
|
|
71
|
+
case "geoshape":
|
|
72
|
+
case "timestamp":
|
|
73
|
+
case "marking":
|
|
74
|
+
return propertyType.type;
|
|
75
|
+
case "date":
|
|
76
|
+
return "datetime";
|
|
77
|
+
case "array":
|
|
78
|
+
return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);
|
|
79
|
+
case "timeseries":
|
|
80
|
+
if (propertyType.itemType.type === "string") {
|
|
81
|
+
return "stringTimeseries";
|
|
82
|
+
}
|
|
83
|
+
return "numericTimeseries";
|
|
84
|
+
case "geotimeSeriesReference":
|
|
85
|
+
throw new Error(`Unsupported data type ${JSON.stringify(propertyType)}`);
|
|
86
|
+
default:
|
|
87
|
+
throw new Error(`Unexpected data type ${JSON.stringify(propertyType)}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=wirePropertyV2ToSdkPropertyDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wirePropertyV2ToSdkPropertyDefinition.js","names":["wirePropertyV2ToSdkPropertyDefinition","input","isNullable","dataType","type","displayName","multiplicity","description","objectPropertyTypeToSdkPropertyDefinition","nullable","Error","JSON","stringify","propertyType","subType","itemType"],"sources":["wirePropertyV2ToSdkPropertyDefinition.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nexport function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {\n switch (input.dataType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"date\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n case \"marking\":\n return {\n displayName: input.displayName,\n multiplicity: false,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: input.nullable == null ? isNullable : input.nullable,\n };\n case \"array\": {\n return {\n displayName: input.displayName,\n multiplicity: true,\n description: input.description,\n type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),\n nullable: true,\n };\n }\n case \"geotimeSeriesReference\":\n throw new Error(`Unsupported data type ${JSON.stringify(input.dataType)}`);\n default:\n const _ = input.dataType;\n throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);\n }\n}\nfunction objectPropertyTypeToSdkPropertyDefinition(propertyType) {\n switch (propertyType.type) {\n case \"integer\":\n case \"string\":\n case \"byte\":\n case \"decimal\":\n case \"double\":\n case \"float\":\n case \"long\":\n case \"short\":\n case \"boolean\":\n case \"attachment\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"marking\":\n return propertyType.type;\n case \"date\":\n return \"datetime\";\n case \"array\":\n return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);\n case \"timeseries\":\n if (propertyType.itemType.type === \"string\") {\n return \"stringTimeseries\";\n }\n return \"numericTimeseries\";\n case \"geotimeSeriesReference\":\n throw new Error(`Unsupported data type ${JSON.stringify(propertyType)}`);\n default:\n const _ = propertyType;\n throw new Error(`Unexpected data type ${JSON.stringify(propertyType)}`);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,qCAAqCA,CAACC,KAAK,EAAEC,UAAU,GAAG,IAAI,EAAE;EAC5E,QAAQD,KAAK,CAACE,QAAQ,CAACC,IAAI;IACvB,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,MAAM;IACX,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,OAAO;IACZ,KAAK,MAAM;IACX,KAAK,OAAO;IACZ,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,YAAY;IACjB,KAAK,UAAU;IACf,KAAK,UAAU;IACf,KAAK,WAAW;IAChB,KAAK,YAAY;IACjB,KAAK,SAAS;MACV,OAAO;QACHC,WAAW,EAAEJ,KAAK,CAACI,WAAW;QAC9BC,YAAY,EAAE,KAAK;QACnBC,WAAW,EAAEN,KAAK,CAACM,WAAW;QAC9BH,IAAI,EAAEI,yCAAyC,CAACP,KAAK,CAACE,QAAQ,CAAC;QAC/DM,QAAQ,EAAER,KAAK,CAACQ,QAAQ,IAAI,IAAI,GAAGP,UAAU,GAAGD,KAAK,CAACQ;MAC1D,CAAC;IACL,KAAK,OAAO;MAAE;QACV,OAAO;UACHJ,WAAW,EAAEJ,KAAK,CAACI,WAAW;UAC9BC,YAAY,EAAE,IAAI;U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4 @@
|
|
|
1
|
+
import type { QueryDataTypeDefinition } from "@osdk/api";
|
|
2
|
+
import type { QueryDataType } from "@osdk/internal.foundry.core";
|
|
3
|
+
export declare function wireQueryDataTypeToQueryDataTypeDefinition<K extends string>(input: QueryDataType): QueryDataTypeDefinition;
|
|
4
|
+
//# sourceMappingURL=wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wireQueryDataTypeToQueryDataTypeDefinition.d.ts","sourceRoot":"","sources":["../../src/wireQueryDataTypeToQueryDataTypeDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,uBAAuB,EAGxB,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EAEV,aAAa,EAGd,MAAM,6BAA6B,CAAC;AAGrC,wBAAgB,0CAA0C,CACxD,CAAC,SAAS,MAAM,EAEhB,KAAK,EAAE,aAAa,GACnB,uBAAuB,CAuGzB"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { isNullableQueryDataType } from "./isNullableQueryDataType.js";
|
|
17
|
+
export function wireQueryDataTypeToQueryDataTypeDefinition(input) {
|
|
18
|
+
switch (input.type) {
|
|
19
|
+
case "double":
|
|
20
|
+
case "float":
|
|
21
|
+
case "integer":
|
|
22
|
+
case "long":
|
|
23
|
+
case "attachment":
|
|
24
|
+
case "boolean":
|
|
25
|
+
case "date":
|
|
26
|
+
case "string":
|
|
27
|
+
case "timestamp":
|
|
28
|
+
return {
|
|
29
|
+
type: input.type,
|
|
30
|
+
nullable: false
|
|
31
|
+
};
|
|
32
|
+
case "object":
|
|
33
|
+
return {
|
|
34
|
+
type: "object",
|
|
35
|
+
object: input.objectTypeApiName,
|
|
36
|
+
nullable: false
|
|
37
|
+
};
|
|
38
|
+
case "objectSet":
|
|
39
|
+
return {
|
|
40
|
+
type: "objectSet",
|
|
41
|
+
objectSet: input.objectTypeApiName,
|
|
42
|
+
nullable: false
|
|
43
|
+
};
|
|
44
|
+
case "array":
|
|
45
|
+
return {
|
|
46
|
+
...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),
|
|
47
|
+
multiplicity: true
|
|
48
|
+
};
|
|
49
|
+
case "set":
|
|
50
|
+
return {
|
|
51
|
+
type: "set",
|
|
52
|
+
set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType),
|
|
53
|
+
nullable: false
|
|
54
|
+
};
|
|
55
|
+
case "union":
|
|
56
|
+
const allowNulls = isNullableQueryDataType(input);
|
|
57
|
+
// special case for a union where one half is nullable to skip the union step and just allow nulls directly
|
|
58
|
+
if (allowNulls && input.unionTypes.length === 2) {
|
|
59
|
+
const nonNull = input.unionTypes.find(t => t.type != null);
|
|
60
|
+
if (nonNull) {
|
|
61
|
+
return {
|
|
62
|
+
...wireQueryDataTypeToQueryDataTypeDefinition(nonNull),
|
|
63
|
+
nullable: true
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return {
|
|
68
|
+
type: "union",
|
|
69
|
+
union: input.unionTypes.reduce((acc, t) => {
|
|
70
|
+
if (t.type === "null") {
|
|
71
|
+
return acc;
|
|
72
|
+
}
|
|
73
|
+
acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));
|
|
74
|
+
return acc;
|
|
75
|
+
}, []),
|
|
76
|
+
nullable: allowNulls
|
|
77
|
+
};
|
|
78
|
+
case "struct":
|
|
79
|
+
return {
|
|
80
|
+
type: "struct",
|
|
81
|
+
struct: Object.fromEntries(input.fields.map(f => [f.name, wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType)])),
|
|
82
|
+
nullable: false
|
|
83
|
+
};
|
|
84
|
+
case "twoDimensionalAggregation":
|
|
85
|
+
return {
|
|
86
|
+
type: "twoDimensionalAggregation",
|
|
87
|
+
twoDimensionalAggregation: get2DQueryAggregationProps(input),
|
|
88
|
+
nullable: false
|
|
89
|
+
};
|
|
90
|
+
case "threeDimensionalAggregation":
|
|
91
|
+
return {
|
|
92
|
+
type: "threeDimensionalAggregation",
|
|
93
|
+
threeDimensionalAggregation: get3DQueryAggregationProps(input),
|
|
94
|
+
nullable: false
|
|
95
|
+
};
|
|
96
|
+
case "null":
|
|
97
|
+
case "unsupported":
|
|
98
|
+
throw new Error(`Accidentally tried to handle QueryDataType.type ${input.type}`);
|
|
99
|
+
default:
|
|
100
|
+
throw new Error(`Unsupported QueryDataType.type ${input.type}`);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function get2DQueryAggregationProps(input) {
|
|
104
|
+
if (input.keyType.type === "range") {
|
|
105
|
+
return {
|
|
106
|
+
keyType: input.keyType.type,
|
|
107
|
+
keySubtype: input.keyType.subType.type,
|
|
108
|
+
valueType: input.valueType.type
|
|
109
|
+
};
|
|
110
|
+
} else {
|
|
111
|
+
if (guardInvalidKeyTypes(input.keyType)) {
|
|
112
|
+
return {
|
|
113
|
+
keyType: input.keyType.type,
|
|
114
|
+
valueType: input.valueType.type
|
|
115
|
+
};
|
|
116
|
+
}
|
|
117
|
+
throw new Error(`Cannot create 2D aggregation with ${input.keyType.type} as its type`);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
function get3DQueryAggregationProps(input) {
|
|
121
|
+
if (input.keyType.type === "range") {
|
|
122
|
+
return {
|
|
123
|
+
keyType: input.keyType.type,
|
|
124
|
+
keySubtype: input.keyType.subType.type,
|
|
125
|
+
valueType: get2DQueryAggregationProps(input.valueType)
|
|
126
|
+
};
|
|
127
|
+
} else {
|
|
128
|
+
if (guardInvalidKeyTypes(input.keyType)) {
|
|
129
|
+
return {
|
|
130
|
+
keyType: input.keyType.type,
|
|
131
|
+
valueType: get2DQueryAggregationProps(input.valueType)
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
throw new Error(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Guard against aggregation key types that are allowed by the backend types but are illegal to actually use
|
|
139
|
+
*/
|
|
140
|
+
function guardInvalidKeyTypes(key) {
|
|
141
|
+
return key.type === "string" || key.type === "boolean";
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=wireQueryDataTypeToQueryDataTypeDefinition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wireQueryDataTypeToQueryDataTypeDefinition.js","names":["isNullableQueryDataType","wireQueryDataTypeToQueryDataTypeDefinition","input","type","nullable","object","objectTypeApiName","objectSet","subType","multiplicity","set","allowNulls","unionTypes","length","nonNull","find","t","union","reduce","acc","push","struct","Object","fromEntries","fields","map","f","name","fieldType","twoDimensionalAggregation","get2DQueryAggregationProps","threeDimensionalAggregation","get3DQueryAggregationProps","Error","keyType","keySubtype","valueType","guardInvalidKeyTypes","key"],"sources":["wireQueryDataTypeToQueryDataTypeDefinition.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { isNullableQueryDataType } from \"./isNullableQueryDataType.js\";\nexport function wireQueryDataTypeToQueryDataTypeDefinition(input) {\n switch (input.type) {\n case \"double\":\n case \"float\":\n case \"integer\":\n case \"long\":\n case \"attachment\":\n case \"boolean\":\n case \"date\":\n case \"string\":\n case \"timestamp\":\n return {\n type: input.type,\n nullable: false,\n };\n case \"object\":\n return {\n type: \"object\",\n object: input.objectTypeApiName,\n nullable: false,\n };\n case \"objectSet\":\n return {\n type: \"objectSet\",\n objectSet: input.objectTypeApiName,\n nullable: false,\n };\n case \"array\":\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n multiplicity: true,\n };\n case \"set\":\n return {\n type: \"set\",\n set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n nullable: false,\n };\n case \"union\":\n const allowNulls = isNullableQueryDataType(input);\n // special case for a union where one half is nullable to skip the union step and just allow nulls directly\n if (allowNulls && input.unionTypes.length === 2) {\n const nonNull = input.unionTypes.find(t => t.type != null);\n if (nonNull) {\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(nonNull),\n nullable: true,\n };\n }\n }\n return {\n type: \"union\",\n union: input.unionTypes.reduce((acc, t) => {\n if (t.type === \"null\") {\n return acc;\n }\n acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));\n return acc;\n }, []),\n nullable: allowNulls,\n };\n case \"struct\":\n return {\n type: \"struct\",\n struct: Object.fromEntries(input.fields.map(f => [\n f.name,\n wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType),\n ])),\n nullable: false,\n };\n case \"twoDimensionalAggregation\":\n return {\n type: \"twoDimensionalAggregation\",\n twoDimensionalAggregation: get2DQueryAggregationProps(input),\n nullable: false,\n };\n case \"threeDimensionalAggregation\":\n return {\n type: \"threeDimensionalAggregation\",\n threeDimensionalAggregation: get3DQueryAggregationProps(input),\n nullable: false,\n };\n case \"null\":\n case \"unsupported\":\n throw new Error(`Accidentally tried to handle QueryDataType.type ${input.type}`);\n default:\n const _ = input;\n throw new Error(`Unsupported QueryDataType.type ${input.type}`);\n }\n}\nfunction get2DQueryAggregationProps(input) {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: input.valueType.type,\n };\n }\n else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: input.valueType.type,\n };\n }\n throw new Error(`Cannot create 2D aggregation with ${input.keyType.type} as its type`);\n }\n}\nfunction get3DQueryAggregationProps(input) {\n if (input.keyType.type === \"range\") {\n return {\n keyType: input.keyType.type,\n keySubtype: input.keyType.subType.type,\n valueType: get2DQueryAggregationProps(input.valueType),\n };\n }\n else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: get2DQueryAggregationProps(input.valueType),\n };\n }\n throw new Error(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);\n }\n}\n/**\n * Guard against aggregation key types that are allowed by the backend types but are illegal to actually use\n */\nfunction guardInvalidKeyTypes(key) {\n return key.type === \"string\" || key.type === \"boolean\";\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,uBAAuB,QAAQ,8BAA8B;AACtE,OAAO,SAASC,0CAA0CA,CAACC,KAAK,EAAE;EAC9D,QAAQA,KAAK,CAACC,IAAI;IACd,KAAK,QAAQ;IACb,KAAK,OAAO;IACZ,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,YAAY;IACjB,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,QAAQ;IACb,KAAK,WAAW;MACZ,OAAO;QACHA,IAAI,EAAED,KAAK,CAACC,IAAI;QAChBC,QAAQ,EAAE;MACd,CAAC;IACL,KAAK,QAAQ;MACT,OAAO;QACHD,IAAI,EAAE,QAAQ;QACdE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,CAAC,qCAAqC/B,KAAK,CAACgC,OAAO,CAAC/B,IAAI,cAAc,CAAC;EAC1F;AACJ;AACA,SAAS6B,0BAA0BA,CAAC9B,KAAK,EAAE;EACvC,IAAIA,KAAK,CAACgC,OAAO,CAAC/B,IAAI,KAAK,OAAO,EAAE;IAChC,OAAO;MACH+B,OAAO,EAAEhC,KAAK,CAACgC,OAAO,CAAC/B,IAAI;MAC3BgC,UAAU,EAAEjC,KAAK,CAACgC,OAAO,CAAC1B,OAAO,CAACL,IAAI;MACtCiC,SAAS,EAAEN,0BAA0B,CAAC5B,KAAK,CAACkC,SAAS;IACzD,CAAC;EACL,CAAC,MACI;IACD,IAAIC,oBAAoB,CAACnC,KAAK,CAACgC,OAAO,CAAC,EAAE;MACrC,OAAO;QACHA,OAAO,EAAEhC,KAAK,CAACgC,OAAO,CAAC/B,IAAI;QAC3BiC,SAAS,EAAEN,0BAA0B,CAAC5B,KAAK,CAACkC,SAAS;MACzD,CAAC;IACL;IACA,MAAM,IAAIH,KAAK,CAAC,qCAAqC/B,KAAK,CAACgC,OAAO,CAAC/B,IAAI,cAAc,CAAC;EAC1F;AACJ;AACA;AACA;AACA;AACA,SAASkC,oBAAoBA,CAACC,GAAG,EAAE;EAC/B,OAAOA,GAAG,CAACnC,IAAI,KAAK,QAAQ,IAAImC,GAAG,CAACnC,IAAI,KAAK,SAAS;AAC1D","ignoreList":[]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { QueryMetadata, QueryParameterDefinition } from "@osdk/api";
|
|
2
|
+
import type { QueryParameterV2, QueryTypeV2 } from "@osdk/internal.foundry.core";
|
|
3
|
+
export declare function wireQueryTypeV2ToSdkQueryMetadata(input: QueryTypeV2): QueryMetadata;
|
|
4
|
+
export declare function wireQueryTypeV2ToSdkQueryDefinitionNoParams(input: QueryTypeV2): {
|
|
5
|
+
type: string;
|
|
6
|
+
apiName: import("@osdk/internal.foundry.core").QueryApiName;
|
|
7
|
+
description: string | undefined;
|
|
8
|
+
displayName: import("@osdk/internal.foundry.core").DisplayName | undefined;
|
|
9
|
+
version: import("@osdk/internal.foundry.core").FunctionVersion;
|
|
10
|
+
rid: import("@osdk/internal.foundry.core").FunctionRid;
|
|
11
|
+
};
|
|
12
|
+
export declare function wireQueryParameterV2ToQueryParameterDefinition(parameter: QueryParameterV2): QueryParameterDefinition<any>;
|
|
13
|
+
//# sourceMappingURL=wireQueryTypeV2ToSdkQueryMetadata.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wireQueryTypeV2ToSdkQueryMetadata.d.ts","sourceRoot":"","sources":["../../src/wireQueryTypeV2ToSdkQueryMetadata.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,aAAa,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACzE,OAAO,KAAK,EACV,gBAAgB,EAChB,WAAW,EACZ,MAAM,6BAA6B,CAAC;AAKrC,wBAAgB,iCAAiC,CAC/C,KAAK,EAAE,WAAW,GACjB,aAAa,CAef;AAED,wBAAgB,2CAA2C,CACzD,KAAK,EAAE,WAAW;;;;;;;EAUnB;AAED,wBAAgB,8CAA8C,CAC5D,SAAS,EAAE,gBAAgB,GAC1B,wBAAwB,CAAC,GAAG,CAAC,CAK/B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { wireQueryDataTypeToQueryDataTypeDefinition } from "./wireQueryDataTypeToQueryDataTypeDefinition.js";
|
|
17
|
+
export function wireQueryTypeV2ToSdkQueryMetadata(input) {
|
|
18
|
+
return {
|
|
19
|
+
type: "query",
|
|
20
|
+
apiName: input.apiName,
|
|
21
|
+
description: input.description,
|
|
22
|
+
displayName: input.displayName,
|
|
23
|
+
version: input.version,
|
|
24
|
+
parameters: Object.fromEntries(Object.entries(input.parameters).map(([name, parameter]) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)])),
|
|
25
|
+
output: wireQueryDataTypeToQueryDataTypeDefinition(input.output),
|
|
26
|
+
rid: input.rid
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function wireQueryTypeV2ToSdkQueryDefinitionNoParams(input) {
|
|
30
|
+
return {
|
|
31
|
+
type: "query",
|
|
32
|
+
apiName: input.apiName,
|
|
33
|
+
description: input.description,
|
|
34
|
+
displayName: input.displayName,
|
|
35
|
+
version: input.version,
|
|
36
|
+
rid: input.rid
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export function wireQueryParameterV2ToQueryParameterDefinition(parameter) {
|
|
40
|
+
return {
|
|
41
|
+
description: parameter.description,
|
|
42
|
+
...wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType)
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=wireQueryTypeV2ToSdkQueryMetadata.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wireQueryTypeV2ToSdkQueryMetadata.js","names":["wireQueryDataTypeToQueryDataTypeDefinition","wireQueryTypeV2ToSdkQueryMetadata","input","type","apiName","description","displayName","version","parameters","Object","fromEntries","entries","map","name","parameter","wireQueryParameterV2ToQueryParameterDefinition","output","rid","wireQueryTypeV2ToSdkQueryDefinitionNoParams","dataType"],"sources":["wireQueryTypeV2ToSdkQueryMetadata.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { wireQueryDataTypeToQueryDataTypeDefinition, } from \"./wireQueryDataTypeToQueryDataTypeDefinition.js\";\nexport function wireQueryTypeV2ToSdkQueryMetadata(input) {\n return {\n type: \"query\",\n apiName: input.apiName,\n description: input.description,\n displayName: input.displayName,\n version: input.version,\n parameters: Object.fromEntries(Object.entries(input.parameters).map(([name, parameter]) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)])),\n output: wireQueryDataTypeToQueryDataTypeDefinition(input.output),\n rid: input.rid,\n };\n}\nexport function wireQueryTypeV2ToSdkQueryDefinitionNoParams(input) {\n return {\n type: \"query\",\n apiName: input.apiName,\n description: input.description,\n displayName: input.displayName,\n version: input.version,\n rid: input.rid,\n };\n}\nexport function wireQueryParameterV2ToQueryParameterDefinition(parameter) {\n return {\n description: parameter.description,\n ...wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType),\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,0CAA0C,QAAS,iDAAiD;AAC7G,OAAO,SAASC,iCAAiCA,CAACC,KAAK,EAAE;EACrD,OAAO;IACHC,IAAI,EAAE,OAAO;IACbC,OAAO,EAAEF,KAAK,CAACE,OAAO;IACtBC,WAAW,EAAEH,KAAK,CAACG,WAAW;IAC9BC,WAAW,EAAEJ,KAAK,CAACI,WAAW;IAC9BC,OAAO,EAAEL,KAAK,CAACK,OAAO;IACtBC,UAAU,EAAEC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACT,KAAK,CAACM,UAAU,CAAC,CAACI,GAAG,CAAC,CAAC,CAACC,IAAI,EAAEC,SAAS,CAAC,KAAK,CAACD,IAAI,EAAEE,8CAA8C,CAACD,SAAS,CAAC,CAAC,CAAC,CAAC;IAC9JE,MAAM,EAAEhB,0CAA0C,CAACE,KAAK,CAACc,MAAM,CAAC;IAChEC,GAAG,EAAEf,KAAK,CAACe;EACf,CAAC;AACL;AACA,OAAO,SAASC,2CAA2CA,CAAChB,KAAK,EAAE;EAC/D,OAAO;IACHC,IAAI,EAAE,OAAO;IACbC,OAAO,EAAEF,KAAK,CAACE,OAAO;IACtBC,WAAW,EAAEH,KAAK,CAACG,WAAW;IAC9BC,WAAW,EAAEJ,KAAK,CAACI,WAAW;IAC9BC,OAAO,EAAEL,KAAK,CAACK,OAAO;IACtBU,GAAG,EAAEf,KAAK,CAACe;EACf,CAAC;AACL;AACA,OAAO,SAASF,8CAA8CA,CAACD,SAAS,EAAE;EACtE,OAAO;IACHT,WAAW,EAAES,SAAS,CAACT,WAAW;IAClC,GAAGL,0CAA0C,CAACc,SAAS,CAACK,QAAQ;EACpE,CAAC;AACL","ignoreList":[]}
|