@osdk/generator-converters 2.1.0-beta.9 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (121) hide show
  1. package/CHANGELOG.md +318 -0
  2. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js +6 -4
  3. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map +1 -1
  4. package/build/browser/empty.test.js +1 -0
  5. package/build/browser/empty.test.js.map +1 -1
  6. package/build/browser/getEditedEntities.js +2 -0
  7. package/build/browser/getEditedEntities.js.map +1 -1
  8. package/build/browser/index.js +1 -0
  9. package/build/browser/index.js.map +1 -1
  10. package/build/browser/isNullableQueryDataType.js +1 -0
  11. package/build/browser/isNullableQueryDataType.js.map +1 -1
  12. package/build/browser/wireActionTypeV2ToSdkActionMetadata.js +19 -1
  13. package/build/browser/wireActionTypeV2ToSdkActionMetadata.js.map +1 -1
  14. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.js +4 -2
  15. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.js.map +1 -1
  16. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js +10 -3
  17. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map +1 -1
  18. package/build/browser/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js +4 -0
  19. package/build/browser/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js.map +1 -1
  20. package/build/browser/wirePropertyV2ToSdkPropertyDefinition.js +36 -12
  21. package/build/browser/wirePropertyV2ToSdkPropertyDefinition.js.map +1 -1
  22. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js +3 -0
  23. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -1
  24. package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.js +1 -0
  25. package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.js.map +1 -1
  26. package/build/cjs/index.cjs +478 -0
  27. package/build/cjs/index.cjs.map +1 -0
  28. package/build/cjs/index.d.cts +39 -0
  29. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js +6 -4
  30. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map +1 -1
  31. package/build/esm/empty.test.js +1 -0
  32. package/build/esm/empty.test.js.map +1 -1
  33. package/build/esm/getEditedEntities.js +2 -0
  34. package/build/esm/getEditedEntities.js.map +1 -1
  35. package/build/esm/index.js +1 -0
  36. package/build/esm/index.js.map +1 -1
  37. package/build/esm/isNullableQueryDataType.js +1 -0
  38. package/build/esm/isNullableQueryDataType.js.map +1 -1
  39. package/build/esm/wireActionTypeV2ToSdkActionMetadata.js +19 -1
  40. package/build/esm/wireActionTypeV2ToSdkActionMetadata.js.map +1 -1
  41. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.js +4 -2
  42. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.js.map +1 -1
  43. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js +10 -3
  44. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map +1 -1
  45. package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js +4 -0
  46. package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js.map +1 -1
  47. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.js +36 -12
  48. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.js.map +1 -1
  49. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js +3 -0
  50. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -1
  51. package/build/esm/wireQueryTypeV2ToSdkQueryMetadata.js +1 -0
  52. package/build/esm/wireQueryTypeV2ToSdkQueryMetadata.js.map +1 -1
  53. package/build/types/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts +5 -0
  54. package/build/types/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map +1 -0
  55. package/build/types/empty.test.d.ts +1 -0
  56. package/build/types/empty.test.d.ts.map +1 -0
  57. package/build/types/getEditedEntities.d.ts +6 -0
  58. package/build/types/getEditedEntities.d.ts.map +1 -0
  59. package/build/{browser → types}/index.d.ts +0 -1
  60. package/build/types/index.d.ts.map +1 -0
  61. package/build/types/isNullableQueryDataType.d.ts +2 -0
  62. package/build/types/isNullableQueryDataType.d.ts.map +1 -0
  63. package/build/{browser → types}/wireActionTypeV2ToSdkActionMetadata.d.ts +1 -2
  64. package/build/types/wireActionTypeV2ToSdkActionMetadata.d.ts.map +1 -0
  65. package/build/types/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts +11 -0
  66. package/build/types/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts.map +1 -0
  67. package/build/types/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts +1 -0
  68. package/build/types/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts.map +1 -0
  69. package/build/{browser → types}/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts +1 -2
  70. package/build/types/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts.map +1 -0
  71. package/build/types/wirePropertyV2ToSdkPropertyDefinition.d.ts +7 -0
  72. package/build/types/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +1 -0
  73. package/build/{browser → types}/wireQueryDataTypeToQueryDataTypeDefinition.d.ts +1 -2
  74. package/build/types/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +1 -0
  75. package/build/types/wireQueryTypeV2ToSdkQueryMetadata.d.ts +12 -0
  76. package/build/types/wireQueryTypeV2ToSdkQueryMetadata.d.ts.map +1 -0
  77. package/package.json +24 -11
  78. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts +0 -4
  79. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map +0 -1
  80. package/build/browser/empty.test.d.ts +0 -2
  81. package/build/browser/empty.test.d.ts.map +0 -1
  82. package/build/browser/getEditedEntities.d.ts +0 -7
  83. package/build/browser/getEditedEntities.d.ts.map +0 -1
  84. package/build/browser/index.d.ts.map +0 -1
  85. package/build/browser/isNullableQueryDataType.d.ts +0 -3
  86. package/build/browser/isNullableQueryDataType.d.ts.map +0 -1
  87. package/build/browser/wireActionTypeV2ToSdkActionMetadata.d.ts.map +0 -1
  88. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts +0 -10
  89. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts.map +0 -1
  90. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts +0 -2
  91. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts.map +0 -1
  92. package/build/browser/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts.map +0 -1
  93. package/build/browser/wirePropertyV2ToSdkPropertyDefinition.d.ts +0 -6
  94. package/build/browser/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +0 -1
  95. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +0 -1
  96. package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.d.ts +0 -13
  97. package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.d.ts.map +0 -1
  98. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts +0 -4
  99. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map +0 -1
  100. package/build/esm/empty.test.d.ts +0 -2
  101. package/build/esm/empty.test.d.ts.map +0 -1
  102. package/build/esm/getEditedEntities.d.ts +0 -7
  103. package/build/esm/getEditedEntities.d.ts.map +0 -1
  104. package/build/esm/index.d.ts +0 -9
  105. package/build/esm/index.d.ts.map +0 -1
  106. package/build/esm/isNullableQueryDataType.d.ts +0 -3
  107. package/build/esm/isNullableQueryDataType.d.ts.map +0 -1
  108. package/build/esm/wireActionTypeV2ToSdkActionMetadata.d.ts +0 -4
  109. package/build/esm/wireActionTypeV2ToSdkActionMetadata.d.ts.map +0 -1
  110. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts +0 -10
  111. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts.map +0 -1
  112. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts +0 -2
  113. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts.map +0 -1
  114. package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts +0 -4
  115. package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts.map +0 -1
  116. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.d.ts +0 -6
  117. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +0 -1
  118. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.d.ts +0 -4
  119. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +0 -1
  120. package/build/esm/wireQueryTypeV2ToSdkQueryMetadata.d.ts +0 -13
  121. package/build/esm/wireQueryTypeV2ToSdkQueryMetadata.d.ts.map +0 -1
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+
16
17
  import { describe, expect, it } from "vitest";
17
18
  import { wireObjectTypeFullMetadataToSdkObjectMetadata } from "./wireObjectTypeFullMetadataToSdkObjectMetadata.js";
18
19
  describe(wireObjectTypeFullMetadataToSdkObjectMetadata, () => {
@@ -36,18 +37,21 @@ describe(wireObjectTypeFullMetadataToSdkObjectMetadata, () => {
36
37
  primaryKey: {
37
38
  dataType: {
38
39
  type: "string"
39
- }
40
+ },
41
+ "rid": "rid"
40
42
  },
41
43
  otherKey: {
42
44
  nullable: false,
43
45
  dataType: {
44
46
  type: "string"
45
- }
47
+ },
48
+ rid: "rid"
46
49
  },
47
50
  defaulted: {
48
51
  dataType: {
49
52
  type: "string"
50
- }
53
+ },
54
+ rid: "rid"
51
55
  }
52
56
  },
53
57
  rid: "rid",
@@ -56,10 +60,13 @@ describe(wireObjectTypeFullMetadataToSdkObjectMetadata, () => {
56
60
  },
57
61
  sharedPropertyTypeMapping: {}
58
62
  }, true);
63
+
59
64
  // PK is never nullable
60
65
  expect(result.properties["primaryKey"].nullable).toBe(false);
66
+
61
67
  // was specified above
62
68
  expect(result.properties["otherKey"].nullable).toBe(false);
69
+
63
70
  // was unspecified, so should be nullable
64
71
  expect(result.properties["defaulted"].nullable).toBe(true);
65
72
  });
@@ -1 +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
+ {"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","rid","defaulted","status","titleProperty","sharedPropertyTypeMapping","toBe"],"sources":["wireObjectTypeFullMetadataToSdkObjectMetadata.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 { describe, expect, it } from \"vitest\";\nimport { wireObjectTypeFullMetadataToSdkObjectMetadata } from \"./wireObjectTypeFullMetadataToSdkObjectMetadata.js\";\n\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\" }, \"rid\": \"rid\" },\n otherKey: {\n nullable: false,\n dataType: { type: \"string\" },\n rid: \"rid\",\n },\n defaulted: { dataType: { type: \"string\" }, rid: \"rid\" },\n },\n rid: \"rid\",\n status: \"ACTIVE\",\n titleProperty: \"otherKey\",\n },\n sharedPropertyTypeMapping: {},\n }, true);\n\n // PK is never nullable\n expect(result.properties[\"primaryKey\"].nullable).toBe(false);\n\n // was specified above\n expect(result.properties[\"otherKey\"].nullable).toBe(false);\n\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;;AAEA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,6CAA6C,QAAQ,oDAAoD;AAElHH,QAAQ,CAACG,6CAA6C,EAAE,MAAM;EAC5DD,EAAE,CAAC,mCAAmC,EAAE,MAAM;IAC5C,MAAME,MAAM,GAAGD,6CAA6C,CAAC;MAC3DE,oBAAoB,EAAE,EAAE;MACxBC,qBAAqB,EAAE,CAAC,CAAC;MACzBC,SAAS,EAAE,EAAE;MACbC,UAAU,EAAE;QACVC,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;UACVD,UAAU,EAAE;YAAEE,QAAQ,EAAE;cAAEL,IAAI,EAAE;YAAS,CAAC;YAAE,KAAK,EAAE;UAAM,CAAC;UAC1DM,QAAQ,EAAE;YACRC,QAAQ,EAAE,KAAK;YACfF,QAAQ,EAAE;cAAEL,IAAI,EAAE;YAAS,CAAC;YAC5BQ,GAAG,EAAE;UACP,CAAC;UACDC,SAAS,EAAE;YAAEJ,QAAQ,EAAE;cAAEL,IAAI,EAAE;YAAS,CAAC;YAAEQ,GAAG,EAAE;UAAM;QACxD,CAAC;QACDA,GAAG,EAAE,KAAK;QACVE,MAAM,EAAE,QAAQ;QAChBC,aAAa,EAAE;MACjB,CAAC;MACDC,yBAAyB,EAAE,CAAC;IAC9B,CAAC,EAAE,IAAI,CAAC;;IAER;IACAzB,MAAM,CAACG,MAAM,CAACc,UAAU,CAAC,YAAY,CAAC,CAACG,QAAQ,CAAC,CAACM,IAAI,CAAC,KAAK,CAAC;;IAE5D;IACA1B,MAAM,CAACG,MAAM,CAACc,UAAU,CAAC,UAAU,CAAC,CAACG,QAAQ,CAAC,CAACM,IAAI,CAAC,KAAK,CAAC;;IAE1D;IACA1B,MAAM,CAACG,MAAM,CAACc,UAAU,CAAC,WAAW,CAAC,CAACG,QAAQ,CAAC,CAACM,IAAI,CAAC,IAAI,CAAC;EAC5D,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+
16
17
  export function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
17
18
  switch (input.dataType.type) {
18
19
  case "integer":
@@ -43,6 +44,9 @@ export function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
43
44
  case "float":
44
45
  case "geotimeSeriesReference":
45
46
  case "mediaReference":
47
+ case "struct":
48
+ case "cipherText":
49
+ case "vector":
46
50
  throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);
47
51
  default:
48
52
  input.dataType;
@@ -1 +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 case \"mediaReference\":\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;IAC7B,KAAK,gBAAgB;MACjB,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
+ {"version":3,"file":"wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js","names":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition","input","dataType","type","Error"],"sources":["wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { PrimaryKeyTypes } from \"@osdk/api\";\nimport type { PropertyV2 } from \"@osdk/foundry.ontologies\";\n\nexport function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(\n input: PropertyV2,\n): PrimaryKeyTypes {\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 case \"mediaReference\":\n case \"struct\":\n case \"cipherText\":\n case \"vector\":\n throw new Error(\n `Type not supported for primaryKey: ${input.dataType.type}`,\n );\n default:\n const _: never = input.dataType;\n throw new Error(\n `Unknown type encountered for primaryKey: ${input.dataType}`,\n );\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAKA,OAAO,SAASA,2CAA2CA,CACzDC,KAAiB,EACA;EACjB,QAAQA,KAAK,CAACC,QAAQ,CAACC,IAAI;IACzB,KAAK,SAAS;IACd,KAAK,QAAQ;IACb,KAAK,QAAQ;IACb,KAAK,SAAS;IACd,KAAK,MAAM;IACX,KAAK,MAAM;IACX,KAAK,OAAO;MAAE;QACZ,OAAOF,KAAK,CAACC,QAAQ,CAACC,IAAI;MAC5B;IACA,KAAK,MAAM;MAAE;QACX,OAAO,UAAU;MACnB;IACA,KAAK,WAAW;MAAE;QAChB,OAAO,WAAW;MACpB;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;IAC7B,KAAK,gBAAgB;IACrB,KAAK,QAAQ;IACb,KAAK,YAAY;IACjB,KAAK,QAAQ;MACX,MAAM,IAAIC,KAAK,CACb,sCAAsCH,KAAK,CAACC,QAAQ,CAACC,IAAI,EAC3D,CAAC;IACH;MACmBF,KAAK,CAACC,QAAQ;MAC/B,MAAM,IAAIE,KAAK,CACb,4CAA4CH,KAAK,CAACC,QAAQ,EAC5D,CAAC;EACL;AACF","ignoreList":[]}
@@ -13,7 +13,12 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {
16
+
17
+ export function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true, log) {
18
+ const sdkPropDefinition = objectPropertyTypeToSdkPropertyDefinition(input.dataType, log);
19
+ if (sdkPropDefinition == null) {
20
+ return undefined;
21
+ }
17
22
  switch (input.dataType.type) {
18
23
  case "integer":
19
24
  case "string":
@@ -26,17 +31,19 @@ export function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true)
26
31
  case "boolean":
27
32
  case "date":
28
33
  case "attachment":
34
+ case "mediaReference":
29
35
  case "geopoint":
30
36
  case "geoshape":
31
37
  case "timestamp":
32
38
  case "timeseries":
33
39
  case "marking":
34
40
  case "geotimeSeriesReference":
41
+ case "struct":
35
42
  return {
36
43
  displayName: input.displayName,
37
44
  multiplicity: false,
38
45
  description: input.description,
39
- type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
46
+ type: sdkPropDefinition,
40
47
  nullable: input.nullable == null ? isNullable : input.nullable
41
48
  };
42
49
  case "array":
@@ -45,20 +52,23 @@ export function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true)
45
52
  displayName: input.displayName,
46
53
  multiplicity: true,
47
54
  description: input.description,
48
- type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
55
+ type: sdkPropDefinition,
49
56
  nullable: true
50
57
  };
51
58
  }
52
- case "mediaReference":
59
+ case "cipherText":
60
+ case "vector":
53
61
  {
54
- throw new Error(`Media references not supported yet`);
62
+ log?.info(`${JSON.stringify(input.dataType.type)} is not a supported dataType`);
63
+ return undefined;
55
64
  }
56
65
  default:
57
66
  input.dataType;
58
- throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);
67
+ log?.info(`${JSON.stringify(input.dataType)} is not a supported dataType`);
68
+ return undefined;
59
69
  }
60
70
  }
61
- function objectPropertyTypeToSdkPropertyDefinition(propertyType) {
71
+ function objectPropertyTypeToSdkPropertyDefinition(propertyType, log) {
62
72
  switch (propertyType.type) {
63
73
  case "integer":
64
74
  case "string":
@@ -75,22 +85,36 @@ function objectPropertyTypeToSdkPropertyDefinition(propertyType) {
75
85
  case "timestamp":
76
86
  case "marking":
77
87
  case "geotimeSeriesReference":
88
+ case "mediaReference":
78
89
  return propertyType.type;
79
90
  case "date":
80
91
  return "datetime";
81
92
  case "array":
82
93
  return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);
83
94
  case "timeseries":
84
- if (propertyType.itemType.type === "string") {
95
+ if (propertyType.itemType?.type === "string") {
85
96
  return "stringTimeseries";
97
+ } else if (propertyType.itemType?.type === "double") {
98
+ return "numericTimeseries";
99
+ } else return "sensorTimeseries";
100
+ case "struct":
101
+ {
102
+ return propertyType.structFieldTypes.reduce((structMap, structField) => {
103
+ structMap[structField.apiName] = objectPropertyTypeToSdkPropertyDefinition(structField.dataType);
104
+ return structMap;
105
+ }, {});
86
106
  }
87
- return "numericTimeseries";
88
- case "mediaReference":
107
+ case "cipherText":
108
+ case "vector":
89
109
  {
90
- throw new Error(`Media references not supported yet`);
110
+ log?.info(`${JSON.stringify(propertyType.type)} is not a supported propertyType`);
111
+ return undefined;
91
112
  }
92
113
  default:
93
- throw new Error(`Unexpected data type ${JSON.stringify(propertyType)}`);
114
+ {
115
+ log?.info(`${JSON.stringify(propertyType)} is not a supported propertyType`);
116
+ return undefined;
117
+ }
94
118
  }
95
119
  }
96
120
  //# sourceMappingURL=wirePropertyV2ToSdkPropertyDefinition.js.map
@@ -1 +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 case \"geotimeSeriesReference\":\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 \"mediaReference\": {\n throw new Error(`Media references not supported yet`);\n }\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 case \"geotimeSeriesReference\":\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 \"mediaReference\": {\n throw new Error(`Media references not supported yet`);\n }\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;IACd,KAAK,wBAAwB;MACzB,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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","ignoreList":[]}
1
+ {"version":3,"file":"wirePropertyV2ToSdkPropertyDefinition.js","names":["wirePropertyV2ToSdkPropertyDefinition","input","isNullable","log","sdkPropDefinition","objectPropertyTypeToSdkPropertyDefinition","dataType","undefined","type","displayName","multiplicity","description","nullable","info","JSON","stringify","propertyType","subType","itemType","structFieldTypes","reduce","structMap","structField","apiName"],"sources":["wirePropertyV2ToSdkPropertyDefinition.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n BaseWirePropertyTypes,\n ObjectMetadata,\n WirePropertyTypes,\n} from \"@osdk/api\";\nimport type {\n ObjectPropertyType,\n PropertyV2,\n SharedPropertyType,\n} from \"@osdk/foundry.ontologies\";\n\nexport function wirePropertyV2ToSdkPropertyDefinition(\n input: (PropertyV2 | SharedPropertyType) & { nullable?: boolean },\n isNullable: boolean = true,\n log?: { info: (msg: string) => void },\n): ObjectMetadata.Property | undefined {\n const sdkPropDefinition = objectPropertyTypeToSdkPropertyDefinition(\n input.dataType,\n log,\n );\n if (sdkPropDefinition == null) {\n return undefined;\n }\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 \"mediaReference\":\n case \"geopoint\":\n case \"geoshape\":\n case \"timestamp\":\n case \"timeseries\":\n case \"marking\":\n case \"geotimeSeriesReference\":\n case \"struct\":\n return {\n displayName: input.displayName,\n multiplicity: false,\n description: input.description,\n type: sdkPropDefinition,\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: sdkPropDefinition,\n nullable: true,\n };\n }\n case \"cipherText\":\n case \"vector\": {\n log?.info(\n `${JSON.stringify(input.dataType.type)} is not a supported dataType`,\n );\n\n return undefined;\n }\n default:\n const _: never = input.dataType;\n log?.info(\n `${JSON.stringify(input.dataType)} is not a supported dataType`,\n );\n\n return undefined;\n }\n}\n\nfunction objectPropertyTypeToSdkPropertyDefinition(\n propertyType: ObjectPropertyType,\n log?: { info: (msg: string) => void },\n): WirePropertyTypes | undefined {\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 case \"geotimeSeriesReference\":\n case \"mediaReference\":\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 } else if (propertyType.itemType?.type === \"double\") {\n return \"numericTimeseries\";\n } else return \"sensorTimeseries\";\n case \"struct\": {\n return propertyType.structFieldTypes.reduce(\n (structMap: Record<string, BaseWirePropertyTypes>, structField) => {\n structMap[structField.apiName] =\n objectPropertyTypeToSdkPropertyDefinition(\n structField.dataType,\n ) as BaseWirePropertyTypes;\n return structMap;\n },\n {},\n );\n }\n case \"cipherText\":\n case \"vector\": {\n log?.info(\n `${JSON.stringify(propertyType.type)} is not a supported propertyType`,\n );\n\n return undefined;\n }\n default: {\n const _: never = propertyType;\n log?.info(\n `${JSON.stringify(propertyType)} is not a supported propertyType`,\n );\n\n return undefined;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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K,QAAQ;MAAE;QACblB,GAAG,EAAEU,IAAI,CACP,GAAGC,IAAI,CAACC,SAAS,CAACC,YAAY,CAACR,IAAI,CAAC,kCACtC,CAAC;QAED,OAAOD,SAAS;MAClB;IACA;MAAS;QAEPJ,GAAG,EAAEU,IAAI,CACP,GAAGC,IAAI,CAACC,SAAS,CAACC,YAAY,CAAC,kCACjC,CAAC;QAED,OAAOT,SAAS;MAClB;EACF;AACF","ignoreList":[]}
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+
16
17
  import { isNullableQueryDataType } from "./isNullableQueryDataType.js";
17
18
  export function wireQueryDataTypeToQueryDataTypeDefinition(input) {
18
19
  switch (input.type) {
@@ -54,6 +55,7 @@ export function wireQueryDataTypeToQueryDataTypeDefinition(input) {
54
55
  };
55
56
  case "union":
56
57
  const allowNulls = isNullableQueryDataType(input);
58
+
57
59
  // special case for a union where one half is nullable to skip the union step and just allow nulls directly
58
60
  if (allowNulls && input.unionTypes.length === 2) {
59
61
  const nonNull = input.unionTypes.find(t => t.type != null);
@@ -134,6 +136,7 @@ function get3DQueryAggregationProps(input) {
134
136
  throw new Error(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);
135
137
  }
136
138
  }
139
+
137
140
  /**
138
141
  * Guard against aggregation key types that are allowed by the backend types but are illegal to actually use
139
142
  */
@@ -1 +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(`Unable to process query because the server indicated an unsupported QueryDataType.type: ${input.type}. Please check that your query is using supported types.`);\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,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S,CAACjC;IAC/B,CAAC;EACL,CAAC,MACI;IACD,IAAIkC,oBAAoB,CAACnC,KAAK,CAACgC,OAAO,CAAC,EAAE;MACrC,OAAO;QACHA,OAAO,EAAEhC,KAAK,CAACgC,OAAO,CAAC/B,IAAI;QAC3BiC,SAAS,EAAElC,KAAK,CAACkC,SAAS,CAACjC;MAC/B,CAAC;IACL;IACA,MAAM,IAAI8B,KAAK,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":[]}
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.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n QueryDataTypeDefinition,\n ThreeDimensionalQueryAggregationDefinition,\n TwoDimensionalQueryAggregationDefinition,\n} from \"@osdk/api\";\nimport type {\n QueryAggregationKeyType,\n QueryDataType,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n} from \"@osdk/foundry.ontologies\";\nimport { isNullableQueryDataType } from \"./isNullableQueryDataType.js\";\n\nexport function wireQueryDataTypeToQueryDataTypeDefinition<\n K extends string,\n>(\n input: QueryDataType,\n): QueryDataTypeDefinition {\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\n case \"object\":\n return {\n type: \"object\",\n object: input.objectTypeApiName as K,\n nullable: false,\n };\n\n case \"objectSet\":\n return {\n type: \"objectSet\",\n objectSet: input.objectTypeApiName as K,\n nullable: false,\n };\n\n case \"array\":\n return {\n ...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n multiplicity: true,\n };\n\n case \"set\":\n return {\n type: \"set\",\n set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType),\n nullable: false,\n };\n\n case \"union\":\n const allowNulls = isNullableQueryDataType(input);\n\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\n return {\n type: \"union\",\n union: input.unionTypes.reduce<QueryDataTypeDefinition[]>((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\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\n case \"twoDimensionalAggregation\":\n return {\n type: \"twoDimensionalAggregation\",\n twoDimensionalAggregation: get2DQueryAggregationProps(input),\n nullable: false,\n };\n\n case \"threeDimensionalAggregation\":\n return {\n type: \"threeDimensionalAggregation\",\n threeDimensionalAggregation: get3DQueryAggregationProps(input),\n nullable: false,\n };\n\n case \"null\":\n case \"unsupported\":\n throw new Error(\n `Unable to process query because the server indicated an unsupported QueryDataType.type: ${input.type}. Please check that your query is using supported types.`,\n );\n\n default:\n const _: never = input;\n throw new Error(`Unsupported QueryDataType.type ${(input as any).type}`);\n }\n}\n\nfunction get2DQueryAggregationProps(\n input: TwoDimensionalAggregation,\n): TwoDimensionalQueryAggregationDefinition {\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 } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: input.valueType.type,\n };\n }\n throw new Error(\n `Cannot create 2D aggregation with ${input.keyType.type} as its type`,\n );\n }\n}\n\nfunction get3DQueryAggregationProps(\n input: ThreeDimensionalAggregation,\n): ThreeDimensionalQueryAggregationDefinition {\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 } else {\n if (guardInvalidKeyTypes(input.keyType)) {\n return {\n keyType: input.keyType.type,\n valueType: get2DQueryAggregationProps(input.valueType),\n };\n }\n throw new Error(\n `Cannot create 3D aggregation with ${input.keyType.type} as its type`,\n );\n }\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(\n key: QueryAggregationKeyType,\n): key is QueryAggregationKeyType & ({ type: \"string\" | \"boolean\" }) {\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;;AAaA,SAASA,uBAAuB,QAAQ,8BAA8B;AAEtE,OAAO,SAASC,0CAA0CA,CAGxDC,KAAoB,EACK;EACzB,QAAQA,KAAK,CAACC,IAAI;IAChB,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;MACd,OAAO;QACLA,IAAI,EAAED,KAAK,CAACC,IAAI;QAChBC,QAAQ,EAAE;MACZ,CAAC;IAEH,KAAK,QAAQ;MACX,OAAO;QACLD,IAAI,EAAE,QAAQ;QACdE,MAAM,EAAEH,KAAK,CAACI,iBAAsB;QACpCF,QAAQ,EAAE;MACZ,CAAC;IAEH,KAAK,WAAW;MACd,OAAO;QACLD,IAAI,EAAE,WAAW;QACjBI,SAAS,EAAEL,KAAK,CAACI,iBAAsB;QACvCF,QAAQ,EAAE;MACZ,CAAC;IAEH,KAAK,OAAO;MACV,OAAO;QACL,GAAGH,0CAA0C,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AAK,CAACgC,OAAO,CAAC/B,IAAI;MAC3BgC,UAAU,EAAEjC,KAAK,CAACgC,OAAO,CAAC1B,OAAO,CAACL,IAAI;MACtCiC,SAAS,EAAEN,0BAA0B,CAAC5B,KAAK,CAACkC,SAAS;IACvD,CAAC;EACH,CAAC,MAAM;IACL,IAAIC,oBAAoB,CAACnC,KAAK,CAACgC,OAAO,CAAC,EAAE;MACvC,OAAO;QACLA,OAAO,EAAEhC,KAAK,CAACgC,OAAO,CAAC/B,IAAI;QAC3BiC,SAAS,EAAEN,0BAA0B,CAAC5B,KAAK,CAACkC,SAAS;MACvD,CAAC;IACH;IACA,MAAM,IAAIH,KAAK,CACb,qCAAqC/B,KAAK,CAACgC,OAAO,CAAC/B,IAAI,cACzD,CAAC;EACH;AACF;;AAEA;AACA;AACA;AACA,SAASkC,oBAAoBA,CAC3BC,GAA4B,EACuC;EACnE,OAAOA,GAAG,CAACnC,IAAI,KAAK,QAAQ,IAAImC,GAAG,CAACnC,IAAI,KAAK,SAAS;AACxD","ignoreList":[]}
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+
16
17
  import { wireQueryDataTypeToQueryDataTypeDefinition } from "./wireQueryDataTypeToQueryDataTypeDefinition.js";
17
18
  export function wireQueryTypeV2ToSdkQueryMetadata(input) {
18
19
  return {
@@ -1 +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":[]}
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.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { QueryMetadata, QueryParameterDefinition } from \"@osdk/api\";\nimport type { QueryParameterV2, QueryTypeV2 } from \"@osdk/foundry.ontologies\";\nimport {\n wireQueryDataTypeToQueryDataTypeDefinition,\n} from \"./wireQueryDataTypeToQueryDataTypeDefinition.js\";\n\nexport function wireQueryTypeV2ToSdkQueryMetadata(\n input: QueryTypeV2,\n): QueryMetadata {\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(\n Object.entries(input.parameters).map((\n [name, parameter],\n ) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)]),\n ),\n output: wireQueryDataTypeToQueryDataTypeDefinition(input.output),\n rid: input.rid,\n };\n}\n\nexport function wireQueryTypeV2ToSdkQueryDefinitionNoParams(\n input: QueryTypeV2,\n): {\n type: string;\n apiName: string;\n description: string | undefined;\n displayName: string | undefined;\n version: string;\n rid: string;\n} {\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}\n\nexport function wireQueryParameterV2ToQueryParameterDefinition(\n parameter: QueryParameterV2,\n): QueryParameterDefinition<any> {\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;;AAIA,SACEA,0CAA0C,QACrC,iDAAiD;AAExD,OAAO,SAASC,iCAAiCA,CAC/CC,KAAkB,EACH;EACf,OAAO;IACLC,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,CAC5BD,MAAM,CAACE,OAAO,CAACT,KAAK,CAACM,UAAU,CAAC,CAACI,GAAG,CAAC,CACnC,CAACC,IAAI,EAAEC,SAAS,CAAC,KACd,CAACD,IAAI,EAAEE,8CAA8C,CAACD,SAAS,CAAC,CAAC,CACxE,CAAC;IACDE,MAAM,EAAEhB,0CAA0C,CAACE,KAAK,CAACc,MAAM,CAAC;IAChEC,GAAG,EAAEf,KAAK,CAACe;EACb,CAAC;AACH;AAEA,OAAO,SAASC,2CAA2CA,CACzDhB,KAAkB,EAQlB;EACA,OAAO;IACLC,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;EACb,CAAC;AACH;AAEA,OAAO,SAASF,8CAA8CA,CAC5DD,SAA2B,EACI;EAC/B,OAAO;IACLT,WAAW,EAAES,SAAS,CAACT,WAAW;IAClC,GAAGL,0CAA0C,CAACc,SAAS,CAACK,QAAQ;EAClE,CAAC;AACH","ignoreList":[]}