@osdk/generator-converters 2.0.0-beta.13 → 2.0.0-beta.15

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 (82) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts +4 -0
  3. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map +1 -0
  4. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js +31 -0
  5. package/build/browser/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map +1 -0
  6. package/build/browser/empty.test.d.ts +2 -0
  7. package/build/browser/empty.test.d.ts.map +1 -0
  8. package/build/browser/empty.test.js +22 -0
  9. package/build/browser/empty.test.js.map +1 -0
  10. package/build/browser/getEditedEntities.d.ts +7 -0
  11. package/build/browser/getEditedEntities.d.ts.map +1 -0
  12. package/build/browser/getEditedEntities.js +41 -0
  13. package/build/browser/getEditedEntities.js.map +1 -0
  14. package/build/browser/index.d.ts +9 -0
  15. package/build/browser/index.d.ts.map +1 -0
  16. package/build/browser/index.js +23 -416
  17. package/build/browser/index.js.map +1 -1
  18. package/build/browser/isNullableQueryDataType.d.ts +3 -0
  19. package/build/browser/isNullableQueryDataType.d.ts.map +1 -0
  20. package/build/browser/isNullableQueryDataType.js +25 -0
  21. package/build/browser/isNullableQueryDataType.js.map +1 -0
  22. package/build/browser/wireActionTypeV2ToSdkActionMetadata.d.ts +4 -0
  23. package/build/browser/wireActionTypeV2ToSdkActionMetadata.d.ts.map +1 -0
  24. package/build/browser/wireActionTypeV2ToSdkActionMetadata.js +85 -0
  25. package/build/browser/wireActionTypeV2ToSdkActionMetadata.js.map +1 -0
  26. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts +10 -0
  27. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts.map +1 -0
  28. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.js +56 -0
  29. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.js.map +1 -0
  30. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts +2 -0
  31. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.d.ts.map +1 -0
  32. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js +67 -0
  33. package/build/browser/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map +1 -0
  34. package/build/browser/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts +4 -0
  35. package/build/browser/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts.map +1 -0
  36. package/build/browser/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js +51 -0
  37. package/build/browser/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js.map +1 -0
  38. package/build/browser/wirePropertyV2ToSdkPropertyDefinition.d.ts +6 -0
  39. package/build/browser/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +1 -0
  40. package/build/browser/wirePropertyV2ToSdkPropertyDefinition.js +90 -0
  41. package/build/browser/wirePropertyV2ToSdkPropertyDefinition.js.map +1 -0
  42. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.d.ts +4 -0
  43. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.d.ts.map +1 -0
  44. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js +143 -0
  45. package/build/browser/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -0
  46. package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.d.ts +13 -0
  47. package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.d.ts.map +1 -0
  48. package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.js +45 -0
  49. package/build/browser/wireQueryTypeV2ToSdkQueryMetadata.js.map +1 -0
  50. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts +1 -1
  51. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map +1 -1
  52. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js +31 -0
  53. package/build/esm/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map +1 -0
  54. package/build/esm/empty.test.js +22 -0
  55. package/build/esm/empty.test.js.map +1 -0
  56. package/build/esm/getEditedEntities.js +41 -0
  57. package/build/esm/getEditedEntities.js.map +1 -0
  58. package/build/esm/index.js +23 -416
  59. package/build/esm/index.js.map +1 -1
  60. package/build/esm/isNullableQueryDataType.js +25 -0
  61. package/build/esm/isNullableQueryDataType.js.map +1 -0
  62. package/build/esm/wireActionTypeV2ToSdkActionMetadata.d.ts +1 -1
  63. package/build/esm/wireActionTypeV2ToSdkActionMetadata.d.ts.map +1 -1
  64. package/build/esm/wireActionTypeV2ToSdkActionMetadata.js +85 -0
  65. package/build/esm/wireActionTypeV2ToSdkActionMetadata.js.map +1 -0
  66. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts +1 -1
  67. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.d.ts.map +1 -1
  68. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.js +56 -0
  69. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.js.map +1 -0
  70. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js +67 -0
  71. package/build/esm/wireObjectTypeFullMetadataToSdkObjectMetadata.test.js.map +1 -0
  72. package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.d.ts.map +1 -1
  73. package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js +51 -0
  74. package/build/esm/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.js.map +1 -0
  75. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.d.ts.map +1 -1
  76. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.js +90 -0
  77. package/build/esm/wirePropertyV2ToSdkPropertyDefinition.js.map +1 -0
  78. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js +143 -0
  79. package/build/esm/wireQueryDataTypeToQueryDataTypeDefinition.js.map +1 -0
  80. package/build/esm/wireQueryTypeV2ToSdkQueryMetadata.js +45 -0
  81. package/build/esm/wireQueryTypeV2ToSdkQueryMetadata.js.map +1 -0
  82. package/package.json +6 -8
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @osdk/generator-converters
2
2
 
3
+ ## 2.0.0-beta.15
4
+
5
+ ### Minor Changes
6
+
7
+ - dc25fb4: Simplified types
8
+
9
+ ### Patch Changes
10
+
11
+ - Updated dependencies [dc25fb4]
12
+ - @osdk/api@2.0.0-beta.15
13
+
14
+ ## 2.0.0-beta.14
15
+
16
+ ### Minor Changes
17
+
18
+ - d4d6605: Audited and cleaned up deps
19
+
20
+ ### Patch Changes
21
+
22
+ - Updated dependencies [5d6d5ab]
23
+ - Updated dependencies [a2c7b37]
24
+ - Updated dependencies [fe9547e]
25
+ - Updated dependencies [1f633f7]
26
+ - Updated dependencies [d4d6605]
27
+ - @osdk/internal.foundry.core@0.2.0-beta.9
28
+ - @osdk/api@2.0.0-beta.14
29
+
3
30
  ## 2.0.0-beta.13
4
31
 
5
32
  ### Minor Changes
@@ -0,0 +1,4 @@
1
+ import type { InterfaceMetadata } from "@osdk/api";
2
+ import type { InterfaceType } from "@osdk/internal.foundry.core";
3
+ export declare function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType: InterfaceType, v2: boolean): InterfaceMetadata;
4
+ //# sourceMappingURL=__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.d.ts","sourceRoot":"","sources":["../../src/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAGjE,wBAAgB,mDAAmD,CACjE,aAAa,EAAE,aAAa,EAC5B,EAAE,EAAE,OAAO,GACV,iBAAiB,CAuBnB"}
@@ -0,0 +1,31 @@
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 { wirePropertyV2ToSdkPropertyDefinition } from "./wirePropertyV2ToSdkPropertyDefinition.js";
17
+ export function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType) {
18
+ return {
19
+ type: "interface",
20
+ rid: interfaceType.rid,
21
+ apiName: interfaceType.apiName,
22
+ displayName: interfaceType.displayName,
23
+ description: interfaceType.description,
24
+ implements: interfaceType.extendsInterfaces,
25
+ properties: Object.fromEntries(Object.entries(interfaceType.properties).map(([key, value]) => {
26
+ return [key, wirePropertyV2ToSdkPropertyDefinition(value, true)];
27
+ })),
28
+ links: {}
29
+ };
30
+ }
31
+ //# sourceMappingURL=__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js","names":["wirePropertyV2ToSdkPropertyDefinition","__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition","interfaceType","type","rid","apiName","displayName","description","implements","extendsInterfaces","properties","Object","fromEntries","entries","map","key","value","links"],"sources":["__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.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 { wirePropertyV2ToSdkPropertyDefinition } from \"./wirePropertyV2ToSdkPropertyDefinition.js\";\nexport function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2) {\n return {\n type: \"interface\",\n rid: interfaceType.rid,\n apiName: interfaceType.apiName,\n displayName: interfaceType.displayName,\n description: interfaceType.description,\n implements: interfaceType.extendsInterfaces,\n properties: Object.fromEntries(Object.entries(interfaceType.properties).map(([key, value]) => {\n return [\n key,\n wirePropertyV2ToSdkPropertyDefinition(value, true),\n ];\n })),\n links: {},\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,qCAAqC,QAAQ,4CAA4C;AAClG,OAAO,SAASC,mDAAmDA,CAACC,aAAa,EAAM;EACnF,OAAO;IACHC,IAAI,EAAE,WAAW;IACjBC,GAAG,EAAEF,aAAa,CAACE,GAAG;IACtBC,OAAO,EAAEH,aAAa,CAACG,OAAO;IAC9BC,WAAW,EAAEJ,aAAa,CAACI,WAAW;IACtCC,WAAW,EAAEL,aAAa,CAACK,WAAW;IACtCC,UAAU,EAAEN,aAAa,CAACO,iBAAiB;IAC3CC,UAAU,EAAEC,MAAM,CAACC,WAAW,CAACD,MAAM,CAACE,OAAO,CAACX,aAAa,CAACQ,UAAU,CAAC,CAACI,GAAG,CAAC,CAAC,CAACC,GAAG,EAAEC,KAAK,CAAC,KAAK;MAC1F,OAAO,CACHD,GAAG,EACHf,qCAAqC,CAACgB,KAAK,EAAE,IAAI,CAAC,CACrD;IACL,CAAC,CAAC,CAAC;IACHC,KAAK,EAAE,CAAC;EACZ,CAAC;AACL","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=empty.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty.test.d.ts","sourceRoot":"","sources":["../../src/empty.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,22 @@
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, it } from "vitest";
17
+ describe("nothing", () => {
18
+ it("does nothing", () => {
19
+ return true;
20
+ });
21
+ });
22
+ //# sourceMappingURL=empty.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"empty.test.js","names":["describe","it"],"sources":["empty.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, it } from \"vitest\";\ndescribe(\"nothing\", () => {\n it(\"does nothing\", () => {\n return true;\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,EAAE,QAAQ,QAAQ;AACrCD,QAAQ,CAAC,SAAS,EAAE,MAAM;EACtBC,EAAE,CAAC,cAAc,EAAE,MAAM;IACrB,OAAO,IAAI;EACf,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,7 @@
1
+ import type { ActionTypeV2 } from "@osdk/internal.foundry.core";
2
+ export type ModifiedEntityTypes = {
3
+ addedObjects: Set<string>;
4
+ modifiedObjects: Set<string>;
5
+ };
6
+ export declare function getModifiedEntityTypes(action: ActionTypeV2): ModifiedEntityTypes;
7
+ //# sourceMappingURL=getEditedEntities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getEditedEntities.d.ts","sourceRoot":"","sources":["../../src/getEditedEntities.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAEhE,MAAM,MAAM,mBAAmB,GAAG;IAChC,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAC9B,CAAC;AAEF,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,YAAY,GACnB,mBAAmB,CAsBrB"}
@@ -0,0 +1,41 @@
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 getModifiedEntityTypes(action) {
17
+ const addedObjects = new Set();
18
+ const modifiedObjects = new Set();
19
+ for (const operation of action.operations) {
20
+ switch (operation.type) {
21
+ case "createObject":
22
+ addedObjects.add(operation.objectTypeApiName);
23
+ break;
24
+ case "modifyObject":
25
+ modifiedObjects.add(operation.objectTypeApiName);
26
+ break;
27
+ case "deleteObject":
28
+ case "createLink":
29
+ case "deleteLink":
30
+ case "createInterfaceObject":
31
+ case "modifyInterfaceObject":
32
+ break;
33
+ default:
34
+ }
35
+ }
36
+ return {
37
+ addedObjects,
38
+ modifiedObjects
39
+ };
40
+ }
41
+ //# sourceMappingURL=getEditedEntities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getEditedEntities.js","names":["getModifiedEntityTypes","action","addedObjects","Set","modifiedObjects","operation","operations","type","add","objectTypeApiName"],"sources":["getEditedEntities.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 getModifiedEntityTypes(action) {\n const addedObjects = new Set();\n const modifiedObjects = new Set();\n for (const operation of action.operations) {\n switch (operation.type) {\n case \"createObject\":\n addedObjects.add(operation.objectTypeApiName);\n break;\n case \"modifyObject\":\n modifiedObjects.add(operation.objectTypeApiName);\n break;\n case \"deleteObject\":\n case \"createLink\":\n case \"deleteLink\":\n case \"createInterfaceObject\":\n case \"modifyInterfaceObject\":\n break;\n default:\n const _ = operation;\n }\n }\n return { addedObjects, modifiedObjects };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,sBAAsBA,CAACC,MAAM,EAAE;EAC3C,MAAMC,YAAY,GAAG,IAAIC,GAAG,CAAC,CAAC;EAC9B,MAAMC,eAAe,GAAG,IAAID,GAAG,CAAC,CAAC;EACjC,KAAK,MAAME,SAAS,IAAIJ,MAAM,CAACK,UAAU,EAAE;IACvC,QAAQD,SAAS,CAACE,IAAI;MAClB,KAAK,cAAc;QACfL,YAAY,CAACM,GAAG,CAACH,SAAS,CAACI,iBAAiB,CAAC;QAC7C;MACJ,KAAK,cAAc;QACfL,eAAe,CAACI,GAAG,CAACH,SAAS,CAACI,iBAAiB,CAAC;QAChD;MACJ,KAAK,cAAc;MACnB,KAAK,YAAY;MACjB,KAAK,YAAY;MACjB,KAAK,uBAAuB;MAC5B,KAAK,uBAAuB;QACxB;MACJ;IAEJ;EACJ;EACA,OAAO;IAAEP,YAAY;IAAEE;EAAgB,CAAC;AAC5C","ignoreList":[]}
@@ -0,0 +1,9 @@
1
+ export { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "./__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js";
2
+ export { wireActionTypeV2ToSdkActionMetadata } from "./wireActionTypeV2ToSdkActionMetadata.js";
3
+ export { wireObjectTypeFullMetadataToSdkObjectMetadata } from "./wireObjectTypeFullMetadataToSdkObjectMetadata.js";
4
+ export { wirePropertyV2ToSdkPropertyDefinition } from "./wirePropertyV2ToSdkPropertyDefinition.js";
5
+ export { wireQueryDataTypeToQueryDataTypeDefinition } from "./wireQueryDataTypeToQueryDataTypeDefinition.js";
6
+ export { wireQueryTypeV2ToSdkQueryMetadata } from "./wireQueryTypeV2ToSdkQueryMetadata.js";
7
+ export { wireQueryParameterV2ToQueryParameterDefinition } from "./wireQueryTypeV2ToSdkQueryMetadata.js";
8
+ export { wireQueryTypeV2ToSdkQueryDefinitionNoParams } from "./wireQueryTypeV2ToSdkQueryMetadata.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,OAAO,EAAE,mDAAmD,EAAE,MAAM,0DAA0D,CAAC;AAC/H,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAC;AAC/F,OAAO,EAAE,6CAA6C,EAAE,MAAM,oDAAoD,CAAC;AACnH,OAAO,EAAE,qCAAqC,EAAE,MAAM,4CAA4C,CAAC;AACnG,OAAO,EAAE,0CAA0C,EAAE,MAAM,iDAAiD,CAAC;AAC7G,OAAO,EAAE,iCAAiC,EAAE,MAAM,wCAAwC,CAAC;AAC3F,OAAO,EAAE,8CAA8C,EAAE,MAAM,wCAAwC,CAAC;AACxG,OAAO,EAAE,2CAA2C,EAAE,MAAM,wCAAwC,CAAC"}
@@ -1,417 +1,24 @@
1
- // src/wirePropertyV2ToSdkPropertyDefinition.ts
2
- function wirePropertyV2ToSdkPropertyDefinition(input, isNullable = true) {
3
- switch (input.dataType.type) {
4
- case "integer":
5
- case "string":
6
- case "byte":
7
- case "decimal":
8
- case "double":
9
- case "float":
10
- case "long":
11
- case "short":
12
- case "boolean":
13
- case "date":
14
- case "attachment":
15
- case "geopoint":
16
- case "geoshape":
17
- case "timestamp":
18
- case "timeseries":
19
- case "marking":
20
- return {
21
- displayName: input.displayName,
22
- multiplicity: false,
23
- description: input.description,
24
- type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
25
- nullable: input.nullable == null ? isNullable : input.nullable
26
- };
27
- case "array": {
28
- return {
29
- displayName: input.displayName,
30
- multiplicity: true,
31
- description: input.description,
32
- type: objectPropertyTypeToSdkPropertyDefinition(input.dataType),
33
- nullable: true
34
- };
35
- }
36
- default:
37
- input.dataType;
38
- throw new Error(`Unexpected data type ${JSON.stringify(input.dataType)}`);
39
- }
40
- }
41
- function objectPropertyTypeToSdkPropertyDefinition(propertyType) {
42
- switch (propertyType.type) {
43
- case "integer":
44
- case "string":
45
- case "byte":
46
- case "decimal":
47
- case "double":
48
- case "float":
49
- case "long":
50
- case "short":
51
- case "boolean":
52
- case "attachment":
53
- case "geopoint":
54
- case "geoshape":
55
- case "timestamp":
56
- case "marking":
57
- return propertyType.type;
58
- case "date":
59
- return "datetime";
60
- case "array":
61
- return objectPropertyTypeToSdkPropertyDefinition(propertyType.subType);
62
- case "timeseries":
63
- if (propertyType.itemType.type === "string") {
64
- return "stringTimeseries";
65
- }
66
- return "numericTimeseries";
67
- default:
68
- throw new Error(`Unexpected data type ${JSON.stringify(propertyType)}`);
69
- }
70
- }
71
-
72
- // src/__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.ts
73
- function __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition(interfaceType, v2) {
74
- return {
75
- type: "interface",
76
- rid: interfaceType.rid,
77
- apiName: interfaceType.apiName,
78
- displayName: interfaceType.displayName,
79
- description: interfaceType.description,
80
- implements: interfaceType.extendsInterfaces,
81
- properties: Object.fromEntries(Object.entries(interfaceType.properties).map(([key, value]) => {
82
- return [key, wirePropertyV2ToSdkPropertyDefinition(value, true)];
83
- })),
84
- links: {}
85
- };
86
- }
87
-
88
- // src/getEditedEntities.ts
89
- function getModifiedEntityTypes(action) {
90
- const addedObjects = /* @__PURE__ */ new Set();
91
- const modifiedObjects = /* @__PURE__ */ new Set();
92
- for (const operation of action.operations) {
93
- switch (operation.type) {
94
- case "createObject":
95
- addedObjects.add(operation.objectTypeApiName);
96
- break;
97
- case "modifyObject":
98
- modifiedObjects.add(operation.objectTypeApiName);
99
- break;
100
- }
101
- }
102
- return {
103
- addedObjects,
104
- modifiedObjects
105
- };
106
- }
107
-
108
- // src/wireActionTypeV2ToSdkActionMetadata.ts
109
- function wireActionTypeV2ToSdkActionMetadata(input) {
110
- const modifiedEntityTypes = getModifiedEntityTypes(input);
111
- return {
112
- type: "action",
113
- apiName: input.apiName,
114
- parameters: Object.fromEntries(Object.entries(input.parameters).map(([key, value]) => [key, wireActionParameterV2ToSdkParameterDefinition(value)])),
115
- displayName: input.displayName,
116
- description: input.description,
117
- modifiedEntities: createModifiedEntities(modifiedEntityTypes.addedObjects, modifiedEntityTypes.modifiedObjects),
118
- rid: input.rid,
119
- status: input.status
120
- };
121
- }
122
- function wireActionParameterV2ToSdkParameterDefinition(value) {
123
- return {
124
- multiplicity: value.dataType.type === "array",
125
- type: actionPropertyToSdkPropertyDefinition(value.dataType.type === "array" ? value.dataType.subType : value.dataType),
126
- nullable: !value.required,
127
- description: value.description
128
- };
129
- }
130
- function actionPropertyToSdkPropertyDefinition(parameterType) {
131
- switch (parameterType.type) {
132
- case "string":
133
- case "boolean":
134
- case "attachment":
135
- case "double":
136
- case "integer":
137
- case "long":
138
- case "timestamp":
139
- case "marking":
140
- return parameterType.type;
141
- case "date":
142
- return "datetime";
143
- case "objectSet":
144
- return {
145
- type: "objectSet",
146
- objectSet: parameterType.objectTypeApiName
147
- };
148
- case "object":
149
- return {
150
- type: "object",
151
- object: parameterType.objectTypeApiName
152
- };
153
- case "array":
154
- return actionPropertyToSdkPropertyDefinition(parameterType.subType);
155
- }
156
- }
157
- function createModifiedEntities(addedObjects, modifiedObjects) {
158
- let entities = {};
159
- for (const key of addedObjects) {
160
- entities[key] = {
161
- created: true,
162
- modified: false
163
- };
164
- }
165
- for (const key of modifiedObjects) {
166
- if (entities[key]) {
167
- entities[key].modified = true;
168
- } else {
169
- entities[key] = {
170
- created: false,
171
- modified: true
172
- };
173
- }
174
- }
175
- return entities;
176
- }
177
-
178
- // src/wirePropertyV2ToSdkPrimaryKeyTypeDefinition.ts
179
- function wirePropertyV2ToSdkPrimaryKeyTypeDefinition(input) {
180
- switch (input.dataType.type) {
181
- case "integer":
182
- case "double":
183
- case "string":
184
- case "boolean":
185
- case "byte":
186
- case "long":
187
- case "short": {
188
- return input.dataType.type;
189
- }
190
- case "date": {
191
- return "datetime";
192
- }
193
- case "timestamp": {
194
- return "timestamp";
195
- }
196
- case "geopoint":
197
- case "geoshape":
198
- case "decimal":
199
- case "attachment":
200
- case "timeseries":
201
- case "array":
202
- case "marking":
203
- case "float":
204
- throw new Error(`Type not supported for primaryKey: ${input.dataType.type}`);
205
- default:
206
- input.dataType;
207
- throw new Error(`Unknown type encountered for primaryKey: ${input.dataType}`);
208
- }
209
- }
210
-
211
- // src/wireObjectTypeFullMetadataToSdkObjectMetadata.ts
212
- function wireObjectTypeFullMetadataToSdkObjectMetadata(objectTypeWithLink, v2) {
213
- if (objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey] === void 0) {
214
- throw new Error(`Primary key ${objectTypeWithLink.objectType.primaryKey} not found in ${objectTypeWithLink.objectType.apiName}`);
215
- }
216
- if (objectTypeWithLink.implementsInterfaces2 == null && objectTypeWithLink.implementsInterfaces != null) {
217
- throw new Error("Your ontology.json file is missing the implementsInterfaces2 field. Please regenerate it.");
218
- }
219
- const interfaceMap = objectTypeWithLink.implementsInterfaces2 ? Object.fromEntries(Object.entries(objectTypeWithLink.implementsInterfaces2).map(([interfaceApiName, impl]) => [interfaceApiName, impl.properties])) : {};
220
- return {
221
- type: "object",
222
- apiName: objectTypeWithLink.objectType.apiName,
223
- description: objectTypeWithLink.objectType.description,
224
- primaryKeyApiName: objectTypeWithLink.objectType.primaryKey,
225
- primaryKeyType: wirePropertyV2ToSdkPrimaryKeyTypeDefinition(objectTypeWithLink.objectType.properties[objectTypeWithLink.objectType.primaryKey]),
226
- links: Object.fromEntries(objectTypeWithLink.linkTypes.map((linkType) => {
227
- return [linkType.apiName, {
228
- multiplicity: linkType.cardinality === "MANY",
229
- targetType: linkType.objectTypeApiName
230
- }];
231
- })),
232
- properties: Object.fromEntries(Object.entries(objectTypeWithLink.objectType.properties).map(([key, value]) => [key, wirePropertyV2ToSdkPropertyDefinition(value, !(v2 && objectTypeWithLink.objectType.primaryKey === key))])),
233
- implements: objectTypeWithLink.implementsInterfaces,
234
- interfaceMap,
235
- inverseInterfaceMap: Object.fromEntries(Object.entries(interfaceMap).map(([interfaceApiName, props]) => [interfaceApiName, invertProps(props)])),
236
- icon: supportedIconTypes.includes(objectTypeWithLink.objectType.icon.type) ? objectTypeWithLink.objectType.icon : void 0,
237
- titleProperty: objectTypeWithLink.objectType.titleProperty,
238
- displayName: objectTypeWithLink.objectType.displayName,
239
- pluralDisplayName: objectTypeWithLink.objectType.pluralDisplayName,
240
- status: objectTypeWithLink.objectType.status,
241
- rid: objectTypeWithLink.objectType.rid,
242
- visibility: objectTypeWithLink.objectType.visibility
243
- };
244
- }
245
- function invertProps(a) {
246
- return a ? Object.fromEntries(Object.entries(a).map(([k, v]) => [v, k])) : void 0;
247
- }
248
- var supportedIconTypes = ["blueprint"];
249
-
250
- // src/isNullableQueryDataType.ts
251
- function isNullableQueryDataType(input) {
252
- if (input.type === "null") {
253
- return true;
254
- }
255
- if (input.type === "union") {
256
- return input.unionTypes.some((t) => isNullableQueryDataType(t));
257
- }
258
- return false;
259
- }
260
-
261
- // src/wireQueryDataTypeToQueryDataTypeDefinition.ts
262
- function wireQueryDataTypeToQueryDataTypeDefinition(input) {
263
- switch (input.type) {
264
- case "double":
265
- case "float":
266
- case "integer":
267
- case "long":
268
- case "attachment":
269
- case "boolean":
270
- case "date":
271
- case "string":
272
- case "timestamp":
273
- return {
274
- type: input.type,
275
- nullable: false
276
- };
277
- case "object":
278
- return {
279
- type: "object",
280
- object: input.objectTypeApiName,
281
- nullable: false
282
- };
283
- case "objectSet":
284
- return {
285
- type: "objectSet",
286
- objectSet: input.objectTypeApiName,
287
- nullable: false
288
- };
289
- case "array":
290
- return {
291
- ...wireQueryDataTypeToQueryDataTypeDefinition(input.subType),
292
- multiplicity: true
293
- };
294
- case "set":
295
- return {
296
- type: "set",
297
- set: wireQueryDataTypeToQueryDataTypeDefinition(input.subType),
298
- nullable: false
299
- };
300
- case "union":
301
- const allowNulls = isNullableQueryDataType(input);
302
- if (allowNulls && input.unionTypes.length === 2) {
303
- const nonNull = input.unionTypes.find((t) => t.type != null);
304
- if (nonNull) {
305
- return {
306
- ...wireQueryDataTypeToQueryDataTypeDefinition(nonNull),
307
- nullable: true
308
- };
309
- }
310
- }
311
- return {
312
- type: "union",
313
- union: input.unionTypes.reduce((acc, t) => {
314
- if (t.type === "null") {
315
- return acc;
316
- }
317
- acc.push(wireQueryDataTypeToQueryDataTypeDefinition(t));
318
- return acc;
319
- }, []),
320
- nullable: allowNulls
321
- };
322
- case "struct":
323
- return {
324
- type: "struct",
325
- struct: Object.fromEntries(input.fields.map((f) => [f.name, wireQueryDataTypeToQueryDataTypeDefinition(f.fieldType)])),
326
- nullable: false
327
- };
328
- case "twoDimensionalAggregation":
329
- return {
330
- type: "twoDimensionalAggregation",
331
- twoDimensionalAggregation: get2DQueryAggregationProps(input),
332
- nullable: false
333
- };
334
- case "threeDimensionalAggregation":
335
- return {
336
- type: "threeDimensionalAggregation",
337
- threeDimensionalAggregation: get3DQueryAggregationProps(input),
338
- nullable: false
339
- };
340
- case "null":
341
- case "unsupported":
342
- throw new Error(`Accidentally tried to handle QueryDataType.type ${input.type}`);
343
- default:
344
- throw new Error(`Unsupported QueryDataType.type ${input.type}`);
345
- }
346
- }
347
- function get2DQueryAggregationProps(input) {
348
- if (input.keyType.type === "range") {
349
- return {
350
- keyType: input.keyType.type,
351
- keySubtype: input.keyType.subType.type,
352
- valueType: input.valueType.type
353
- };
354
- } else {
355
- if (guardInvalidKeyTypes(input.keyType)) {
356
- return {
357
- keyType: input.keyType.type,
358
- valueType: input.valueType.type
359
- };
360
- }
361
- throw new Error(`Cannot create 2D aggregation with ${input.keyType.type} as its type`);
362
- }
363
- }
364
- function get3DQueryAggregationProps(input) {
365
- if (input.keyType.type === "range") {
366
- return {
367
- keyType: input.keyType.type,
368
- keySubtype: input.keyType.subType.type,
369
- valueType: get2DQueryAggregationProps(input.valueType)
370
- };
371
- } else {
372
- if (guardInvalidKeyTypes(input.keyType)) {
373
- return {
374
- keyType: input.keyType.type,
375
- valueType: get2DQueryAggregationProps(input.valueType)
376
- };
377
- }
378
- throw new Error(`Cannot create 3D aggregation with ${input.keyType.type} as its type`);
379
- }
380
- }
381
- function guardInvalidKeyTypes(key) {
382
- return key.type === "string" || key.type === "boolean";
383
- }
384
-
385
- // src/wireQueryTypeV2ToSdkQueryMetadata.ts
386
- function wireQueryTypeV2ToSdkQueryMetadata(input) {
387
- return {
388
- type: "query",
389
- apiName: input.apiName,
390
- description: input.description,
391
- displayName: input.displayName,
392
- version: input.version,
393
- parameters: Object.fromEntries(Object.entries(input.parameters).map(([name, parameter]) => [name, wireQueryParameterV2ToQueryParameterDefinition(parameter)])),
394
- output: wireQueryDataTypeToQueryDataTypeDefinition(input.output),
395
- rid: input.rid
396
- };
397
- }
398
- function wireQueryTypeV2ToSdkQueryDefinitionNoParams(input) {
399
- return {
400
- type: "query",
401
- apiName: input.apiName,
402
- description: input.description,
403
- displayName: input.displayName,
404
- version: input.version,
405
- rid: input.rid
406
- };
407
- }
408
- function wireQueryParameterV2ToQueryParameterDefinition(parameter) {
409
- return {
410
- description: parameter.description,
411
- ...wireQueryDataTypeToQueryDataTypeDefinition(parameter.dataType)
412
- };
413
- }
414
-
415
- export { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition, wireActionTypeV2ToSdkActionMetadata, wireObjectTypeFullMetadataToSdkObjectMetadata, wirePropertyV2ToSdkPropertyDefinition, wireQueryDataTypeToQueryDataTypeDefinition, wireQueryParameterV2ToQueryParameterDefinition, wireQueryTypeV2ToSdkQueryDefinitionNoParams, wireQueryTypeV2ToSdkQueryMetadata };
416
- //# sourceMappingURL=index.js.map
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
+ export { __UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition } from "./__UNSTABLE_wireInterfaceTypeV2ToSdkObjectDefinition.js";
17
+ export { wireActionTypeV2ToSdkActionMetadata } from "./wireActionTypeV2ToSdkActionMetadata.js";
18
+ export { wireObjectTypeFullMetadataToSdkObjectMetadata } from "./wireObjectTypeFullMetadataToSdkObjectMetadata.js";
19
+ export { wirePropertyV2ToSdkPropertyDefinition } from "./wirePropertyV2ToSdkPropertyDefinition.js";
20
+ export { wireQueryDataTypeToQueryDataTypeDefinition } from "./wireQueryDataTypeToQueryDataTypeDefinition.js";
21
+ export { wireQueryTypeV2ToSdkQueryMetadata } from "./wireQueryTypeV2ToSdkQueryMetadata.js";
22
+ export { wireQueryParameterV2ToQueryParameterDefinition } from "./wireQueryTypeV2ToSdkQueryMetadata.js";
23
+ export { wireQueryTypeV2ToSdkQueryDefinitionNoParams } from "./wireQueryTypeV2ToSdkQueryMetadata.js";
417
24
  //# sourceMappingURL=index.js.map