@osdk/client 2.1.0-beta.1 → 2.1.0-beta.10

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 (192) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/build/browser/Client.d.ts +8 -21
  3. package/build/browser/Client.d.ts.map +1 -1
  4. package/build/browser/Client.js +2 -1
  5. package/build/browser/Client.js.map +1 -1
  6. package/build/browser/MinimalClientContext.d.ts +1 -1
  7. package/build/browser/MinimalClientContext.d.ts.map +1 -1
  8. package/build/browser/__unstable/ConjureSupport.js +4 -4
  9. package/build/browser/__unstable/ConjureSupport.js.map +1 -1
  10. package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
  11. package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
  12. package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js +1 -1
  13. package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
  14. package/build/browser/actions/applyAction.js +1 -1
  15. package/build/browser/actions/applyAction.js.map +1 -1
  16. package/build/browser/createClient.d.ts +1 -1
  17. package/build/browser/createClient.d.ts.map +1 -1
  18. package/build/browser/createClient.js +43 -19
  19. package/build/browser/createClient.js.map +1 -1
  20. package/build/browser/createGeotimeSeriesProperty.d.ts +1 -1
  21. package/build/browser/createGeotimeSeriesProperty.d.ts.map +1 -1
  22. package/build/browser/createGeotimeSeriesProperty.js +4 -1
  23. package/build/browser/createGeotimeSeriesProperty.js.map +1 -1
  24. package/build/browser/createMinimalClient.js +3 -3
  25. package/build/browser/createMinimalClient.js.map +1 -1
  26. package/build/browser/createPlatformClient.d.ts +1 -1
  27. package/build/browser/createPlatformClient.d.ts.map +1 -1
  28. package/build/browser/index.d.ts +2 -2
  29. package/build/browser/index.d.ts.map +1 -1
  30. package/build/browser/index.js +1 -1
  31. package/build/browser/index.js.map +1 -1
  32. package/build/browser/intellisense.test.js +1 -1
  33. package/build/browser/intellisense.test.js.map +1 -1
  34. package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
  35. package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
  36. package/build/browser/internal/conversions/modernToLegacyWhereClause.js +3 -3
  37. package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  38. package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +88 -7
  39. package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
  40. package/build/browser/object/AttachmentUpload.d.ts.map +1 -1
  41. package/build/browser/object/AttachmentUpload.js +6 -0
  42. package/build/browser/object/AttachmentUpload.js.map +1 -1
  43. package/build/browser/object/aggregate.js +4 -5
  44. package/build/browser/object/aggregate.js.map +1 -1
  45. package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
  46. package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
  47. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
  48. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
  49. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +6 -0
  50. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
  51. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +56 -1
  52. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  53. package/build/browser/object/convertWireToOsdkObjects.js +42 -6
  54. package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
  55. package/build/browser/object/convertWireToOsdkObjects.test.js +197 -15
  56. package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
  57. package/build/browser/object/fetchPage.d.ts.map +1 -1
  58. package/build/browser/object/fetchPage.js +35 -25
  59. package/build/browser/object/fetchPage.js.map +1 -1
  60. package/build/browser/object/fetchPage.test.js +75 -1
  61. package/build/browser/object/fetchPage.test.js.map +1 -1
  62. package/build/browser/objectSet/InterfaceObjectSet.test.d.ts +2 -0
  63. package/build/browser/objectSet/InterfaceObjectSet.test.d.ts.map +1 -0
  64. package/build/browser/objectSet/InterfaceObjectSet.test.js +61 -0
  65. package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -0
  66. package/build/browser/objectSet/ObjectSet.test.js +64 -48
  67. package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
  68. package/build/browser/objectSet/ObjectSetListenerWebsocket.js +65 -57
  69. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  70. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +116 -26
  71. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  72. package/build/browser/objectSet/createObjectSet.js +10 -8
  73. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  74. package/build/browser/ontology/makeConjureContext.d.ts +1 -1
  75. package/build/browser/ontology/makeConjureContext.d.ts.map +1 -1
  76. package/build/browser/queries/applyQuery.js +1 -1
  77. package/build/browser/queries/applyQuery.js.map +1 -1
  78. package/build/browser/queries/queries.test.js +30 -2
  79. package/build/browser/queries/queries.test.js.map +1 -1
  80. package/build/browser/tsserver.js +1 -1
  81. package/build/browser/tsserver.js.map +1 -1
  82. package/build/browser/util/UserAgent.js +1 -1
  83. package/build/browser/util/UserAgent.js.map +1 -1
  84. package/build/browser/util/datetimeConverters.d.ts +22 -0
  85. package/build/browser/util/datetimeConverters.d.ts.map +1 -0
  86. package/build/browser/util/datetimeConverters.js +55 -0
  87. package/build/browser/util/datetimeConverters.js.map +1 -0
  88. package/build/browser/util/datetimeConverters.test.d.ts +2 -0
  89. package/build/browser/util/datetimeConverters.test.d.ts.map +1 -0
  90. package/build/browser/util/datetimeConverters.test.js +75 -0
  91. package/build/browser/util/datetimeConverters.test.js.map +1 -0
  92. package/build/browser/util/objectSetUtils.d.ts +4 -0
  93. package/build/browser/util/objectSetUtils.d.ts.map +1 -0
  94. package/build/browser/util/objectSetUtils.js +25 -0
  95. package/build/browser/util/objectSetUtils.js.map +1 -0
  96. package/build/browser/util/timeseriesUtils.d.ts.map +1 -1
  97. package/build/esm/Client.d.ts +8 -21
  98. package/build/esm/Client.d.ts.map +1 -1
  99. package/build/esm/Client.js +2 -1
  100. package/build/esm/Client.js.map +1 -1
  101. package/build/esm/MinimalClientContext.d.ts +1 -1
  102. package/build/esm/MinimalClientContext.d.ts.map +1 -1
  103. package/build/esm/__unstable/ConjureSupport.js +4 -4
  104. package/build/esm/__unstable/ConjureSupport.js.map +1 -1
  105. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
  106. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
  107. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js +1 -1
  108. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
  109. package/build/esm/actions/applyAction.js +1 -1
  110. package/build/esm/actions/applyAction.js.map +1 -1
  111. package/build/esm/createClient.d.ts +1 -1
  112. package/build/esm/createClient.d.ts.map +1 -1
  113. package/build/esm/createClient.js +43 -19
  114. package/build/esm/createClient.js.map +1 -1
  115. package/build/esm/createGeotimeSeriesProperty.d.ts +1 -1
  116. package/build/esm/createGeotimeSeriesProperty.d.ts.map +1 -1
  117. package/build/esm/createGeotimeSeriesProperty.js +4 -1
  118. package/build/esm/createGeotimeSeriesProperty.js.map +1 -1
  119. package/build/esm/createMinimalClient.js +3 -3
  120. package/build/esm/createMinimalClient.js.map +1 -1
  121. package/build/esm/createPlatformClient.d.ts +1 -1
  122. package/build/esm/createPlatformClient.d.ts.map +1 -1
  123. package/build/esm/index.d.ts +2 -2
  124. package/build/esm/index.d.ts.map +1 -1
  125. package/build/esm/index.js +1 -1
  126. package/build/esm/index.js.map +1 -1
  127. package/build/esm/intellisense.test.js +1 -1
  128. package/build/esm/intellisense.test.js.map +1 -1
  129. package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
  130. package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
  131. package/build/esm/internal/conversions/modernToLegacyWhereClause.js +3 -3
  132. package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  133. package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +88 -7
  134. package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
  135. package/build/esm/object/AttachmentUpload.d.ts.map +1 -1
  136. package/build/esm/object/AttachmentUpload.js +6 -0
  137. package/build/esm/object/AttachmentUpload.js.map +1 -1
  138. package/build/esm/object/aggregate.js +4 -5
  139. package/build/esm/object/aggregate.js.map +1 -1
  140. package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
  141. package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
  142. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
  143. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
  144. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +6 -0
  145. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
  146. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +56 -1
  147. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  148. package/build/esm/object/convertWireToOsdkObjects.js +42 -6
  149. package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
  150. package/build/esm/object/convertWireToOsdkObjects.test.js +197 -15
  151. package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
  152. package/build/esm/object/fetchPage.d.ts.map +1 -1
  153. package/build/esm/object/fetchPage.js +35 -25
  154. package/build/esm/object/fetchPage.js.map +1 -1
  155. package/build/esm/object/fetchPage.test.js +75 -1
  156. package/build/esm/object/fetchPage.test.js.map +1 -1
  157. package/build/esm/objectSet/InterfaceObjectSet.test.d.ts +2 -0
  158. package/build/esm/objectSet/InterfaceObjectSet.test.d.ts.map +1 -0
  159. package/build/esm/objectSet/InterfaceObjectSet.test.js +61 -0
  160. package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -0
  161. package/build/esm/objectSet/ObjectSet.test.js +64 -48
  162. package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
  163. package/build/esm/objectSet/ObjectSetListenerWebsocket.js +65 -57
  164. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  165. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +116 -26
  166. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  167. package/build/esm/objectSet/createObjectSet.js +10 -8
  168. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  169. package/build/esm/ontology/makeConjureContext.d.ts +1 -1
  170. package/build/esm/ontology/makeConjureContext.d.ts.map +1 -1
  171. package/build/esm/queries/applyQuery.js +1 -1
  172. package/build/esm/queries/applyQuery.js.map +1 -1
  173. package/build/esm/queries/queries.test.js +30 -2
  174. package/build/esm/queries/queries.test.js.map +1 -1
  175. package/build/esm/tsserver.js +1 -1
  176. package/build/esm/tsserver.js.map +1 -1
  177. package/build/esm/util/UserAgent.js +1 -1
  178. package/build/esm/util/UserAgent.js.map +1 -1
  179. package/build/esm/util/datetimeConverters.d.ts +22 -0
  180. package/build/esm/util/datetimeConverters.d.ts.map +1 -0
  181. package/build/esm/util/datetimeConverters.js +55 -0
  182. package/build/esm/util/datetimeConverters.js.map +1 -0
  183. package/build/esm/util/datetimeConverters.test.d.ts +2 -0
  184. package/build/esm/util/datetimeConverters.test.d.ts.map +1 -0
  185. package/build/esm/util/datetimeConverters.test.js +75 -0
  186. package/build/esm/util/datetimeConverters.test.js.map +1 -0
  187. package/build/esm/util/objectSetUtils.d.ts +4 -0
  188. package/build/esm/util/objectSetUtils.d.ts.map +1 -0
  189. package/build/esm/util/objectSetUtils.js +25 -0
  190. package/build/esm/util/objectSetUtils.js.map +1 -0
  191. package/build/esm/util/timeseriesUtils.d.ts.map +1 -1
  192. package/package.json +21 -17
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- import { $ontologyRid, $Queries, acceptsThreeDimensionalAggregationFunction, acceptsTwoDimensionalAggregationFunction, addOne, Employee, incrementPersonAge, queryAcceptsObject, queryAcceptsObjectSets, returnsDate, returnsTimestamp, threeDimensionalAggregationFunction, twoDimensionalAggregationFunction } from "@osdk/client.test.ontology";
16
+ import { $ontologyRid, $Queries, acceptsThreeDimensionalAggregationFunction, acceptsTwoDimensionalAggregationFunction, addOne, Employee, incrementPersonAge, incrementPersonAgeComplex, queryAcceptsObject, queryAcceptsObjectSets, returnsDate, returnsTimestamp, threeDimensionalAggregationFunction, twoDimensionalAggregationFunction } from "@osdk/client.test.ontology";
17
17
  import { apiServer } from "@osdk/shared.test";
18
18
  import { afterAll, beforeAll, describe, expect, expectTypeOf, it } from "vitest";
19
19
  import { createClient } from "../createClient.js";
@@ -79,6 +79,27 @@ describe("queries", () => {
79
79
  age: 43
80
80
  });
81
81
  });
82
+ it("returns and accepts complex structs property", async () => {
83
+ const employee = await client(Employee).fetchOne(50030);
84
+ const result = await client(incrementPersonAgeComplex).executeFunction({
85
+ person: {
86
+ firstName: "John",
87
+ lastName: "Doe",
88
+ age: 42,
89
+ object: employee
90
+ }
91
+ });
92
+ expect(result).toEqual({
93
+ firstName: "John",
94
+ lastName: "Doe",
95
+ age: 43,
96
+ object: {
97
+ $apiName: "Employee",
98
+ $objectType: "Employee",
99
+ $primaryKey: 50031
100
+ }
101
+ });
102
+ });
82
103
  it("two dimensional aggregation response works", async () => {
83
104
  const result = await client(twoDimensionalAggregationFunction).executeFunction();
84
105
  expect(result).toEqual([{
@@ -163,9 +184,16 @@ describe("queries", () => {
163
184
  groups: []
164
185
  }]);
165
186
  });
187
+ it("accepts and returns objects", async () => {
188
+ const employeeObjectSet = client(Employee);
189
+ await client(queryAcceptsObjectSets).executeFunction({
190
+ objectSet: employeeObjectSet
191
+ });
192
+ expectTypeOf().toMatchTypeOf();
193
+ });
166
194
  it("queries are enumerable", async () => {
167
195
  const queries = Object.keys($Queries);
168
- expect(queries).toStrictEqual(["acceptsThreeDimensionalAggregationFunction", "acceptsTwoDimensionalAggregationFunction", "addOne", "incrementPersonAge", "queryAcceptsObject", "queryAcceptsObjectSets", "queryTypeReturnsArray", "returnsDate", "returnsObject", "returnsTimestamp", "threeDimensionalAggregationFunction", "twoDimensionalAggregationFunction"]);
196
+ expect(queries).toStrictEqual(["acceptsThreeDimensionalAggregationFunction", "acceptsTwoDimensionalAggregationFunction", "addOne", "incrementPersonAge", "incrementPersonAgeComplex", "queryAcceptsObject", "queryAcceptsObjectSets", "queryTypeReturnsArray", "returnsDate", "returnsObject", "returnsTimestamp", "threeDimensionalAggregationFunction", "twoDimensionalAggregationFunction"]);
169
197
  });
170
198
  it("queries work with arrays", async () => {
171
199
  const result = await client($Queries.queryTypeReturnsArray).executeFunction({
@@ -1 +1 @@
1
- {"version":3,"file":"queries.test.js","names":["$ontologyRid","$Queries","acceptsThreeDimensionalAggregationFunction","acceptsTwoDimensionalAggregationFunction","addOne","Employee","incrementPersonAge","queryAcceptsObject","queryAcceptsObjectSets","returnsDate","returnsTimestamp","threeDimensionalAggregationFunction","twoDimensionalAggregationFunction","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","client","listen","close","result","executeFunction","n","toBe","employee","fetchOne","object","toEqual","$apiName","$objectType","$primaryKey","result2","employeeObjectSet","objectSet","toMatchTypeOf","resultWithTimestamp","resultWithDate","person","firstName","lastName","age","key","value","aggFunction","groups","startValue","endValue","fail","e","message","toMatch","queries","Object","keys","toStrictEqual","queryTypeReturnsArray","people"],"sources":["queries.test.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 { $ontologyRid, $Queries, acceptsThreeDimensionalAggregationFunction, acceptsTwoDimensionalAggregationFunction, addOne, Employee, incrementPersonAge, queryAcceptsObject, queryAcceptsObjectSets, returnsDate, returnsTimestamp, threeDimensionalAggregationFunction, twoDimensionalAggregationFunction, } from \"@osdk/client.test.ontology\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { createClient } from \"../createClient.js\";\ndescribe(\"queries\", () => {\n let client;\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"simple query works\", async () => {\n const result = await client(addOne).executeFunction({ n: 2 });\n expect(result).toBe(3);\n });\n it(\"accepts objects\", async () => {\n const employee = await client(Employee).fetchOne(50030);\n const result = await client(queryAcceptsObject).executeFunction({\n object: employee,\n });\n expect(result).toEqual({\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 50031,\n });\n // Should also accept primary keys\n const result2 = await client(queryAcceptsObject).executeFunction({\n object: 50030,\n });\n expect(result2).toEqual({\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 50031,\n });\n });\n it(\"accepts objectSets\", async () => {\n const employeeObjectSet = client(Employee);\n const result = await client(queryAcceptsObjectSets).executeFunction({\n objectSet: employeeObjectSet,\n });\n expectTypeOf().toMatchTypeOf();\n });\n it(\"no params work\", async () => {\n const resultWithTimestamp = await client(returnsTimestamp)\n .executeFunction();\n expect(resultWithTimestamp).toBe(\"2019-01-01T00:00:00.000Z\");\n const resultWithDate = await client(returnsDate).executeFunction();\n expect(resultWithDate).toBe(\"2019-01-01\");\n });\n it(\"returns and accepts structs property\", async () => {\n const result = await client(incrementPersonAge).executeFunction({\n person: { firstName: \"John\", lastName: \"Doe\", age: 42 },\n });\n expect(result).toEqual({\n firstName: \"John\",\n lastName: \"Doe\",\n age: 43,\n });\n });\n it(\"two dimensional aggregation response works\", async () => {\n const result = await client(twoDimensionalAggregationFunction)\n .executeFunction();\n expect(result).toEqual([{ key: \"Q-AFN\", value: 1 }, {\n key: \"Q-AFO\",\n value: 2,\n }]);\n });\n it(\"two dimensional aggregation request/response works\", async () => {\n const result = await client(acceptsTwoDimensionalAggregationFunction)\n .executeFunction({\n aggFunction: [\n {\n key: \"testKey1\",\n value: 1,\n },\n {\n key: \"testKey2\",\n value: 2,\n },\n ],\n });\n expect(result).toEqual([{ key: \"responseKey1\", value: 3 }, {\n key: \"responseKey2\",\n value: 4,\n }]);\n });\n it(\"three dimensional aggregation response works\", async () => {\n const result = await client(threeDimensionalAggregationFunction)\n .executeFunction();\n expect(result).toEqual([{\n key: \"Q-AFN\",\n groups: [{\n key: {\n startValue: \"2010-10-01T00:00:00Z\",\n endValue: \"2010-10-02T00:00:00Z\",\n },\n value: 65.0,\n }],\n }, { key: \"Q-AFO\", groups: [] }]);\n });\n it(\"throws when response is null and response is non-nullable\", async () => {\n try {\n const result = await client(addOne).executeFunction({ n: 3 });\n expect.fail(\"Should not reach here\");\n }\n catch (e) {\n expect(e.message).toMatch(`Got null response when nullable was not allowed`);\n }\n });\n it(\"three dimensional aggregation request/response works\", async () => {\n const result = await client(acceptsThreeDimensionalAggregationFunction)\n .executeFunction({\n aggFunction: [\n {\n key: \"testKey1\",\n groups: [\n {\n key: {\n startValue: \"2010-10-01T00:00:00Z\",\n endValue: \"2010-10-02T00:00:00Z\",\n },\n value: 65.0,\n },\n ],\n },\n {\n key: \"testKey2\",\n groups: [],\n },\n ],\n });\n expect(result).toEqual([\n {\n key: \"Q-AFN\",\n groups: [\n {\n key: {\n startValue: \"2010-10-01T00:00:00Z\",\n endValue: \"2010-10-02T00:00:00Z\",\n },\n value: 65.0,\n },\n ],\n },\n {\n key: \"Q-AFO\",\n groups: [],\n },\n ]);\n });\n it(\"queries are enumerable\", async () => {\n const queries = Object.keys($Queries);\n expect(queries).toStrictEqual([\n \"acceptsThreeDimensionalAggregationFunction\",\n \"acceptsTwoDimensionalAggregationFunction\",\n \"addOne\",\n \"incrementPersonAge\",\n \"queryAcceptsObject\",\n \"queryAcceptsObjectSets\",\n \"queryTypeReturnsArray\",\n \"returnsDate\",\n \"returnsObject\",\n \"returnsTimestamp\",\n \"threeDimensionalAggregationFunction\",\n \"twoDimensionalAggregationFunction\",\n ]);\n });\n it(\"queries work with arrays\", async () => {\n const result = await client($Queries.queryTypeReturnsArray).executeFunction({ people: [\"Brad\", \"George\", \"Ryan\"] });\n expect(result).toEqual([\"Pitt\", \"Clooney\", \"Reynolds\"]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,QAAQ,EAAEC,0CAA0C,EAAEC,wCAAwC,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,kBAAkB,EAAEC,kBAAkB,EAAEC,sBAAsB,EAAEC,WAAW,EAAEC,gBAAgB,EAAEC,mCAAmC,EAAEC,iCAAiC,QAAS,4BAA4B;AACnV,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAS,QAAQ;AACjF,SAASC,YAAY,QAAQ,oBAAoB;AACjDJ,QAAQ,CAAC,SAAS,EAAE,MAAM;EACtB,IAAIK,MAAM;EACVN,SAAS,CAAC,YAAY;IAClBF,SAAS,CAACS,MAAM,CAAC,CAAC;IAClBD,MAAM,GAAGD,YAAY,CAAC,4BAA4B,EAAEpB,YAAY,EAAE,YAAY,eAAe,CAAC;EAClG,CAAC,CAAC;EACFc,QAAQ,CAAC,MAAM;IACXD,SAAS,CAACU,KAAK,CAA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queries.test.js","names":["$ontologyRid","$Queries","acceptsThreeDimensionalAggregationFunction","acceptsTwoDimensionalAggregationFunction","addOne","Employee","incrementPersonAge","incrementPersonAgeComplex","queryAcceptsObject","queryAcceptsObjectSets","returnsDate","returnsTimestamp","threeDimensionalAggregationFunction","twoDimensionalAggregationFunction","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","client","listen","close","result","executeFunction","n","toBe","employee","fetchOne","object","toEqual","$apiName","$objectType","$primaryKey","result2","employeeObjectSet","objectSet","toMatchTypeOf","resultWithTimestamp","resultWithDate","person","firstName","lastName","age","key","value","aggFunction","groups","startValue","endValue","fail","e","message","toMatch","queries","Object","keys","toStrictEqual","queryTypeReturnsArray","people"],"sources":["queries.test.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 { $ontologyRid, $Queries, acceptsThreeDimensionalAggregationFunction, acceptsTwoDimensionalAggregationFunction, addOne, Employee, incrementPersonAge, incrementPersonAgeComplex, queryAcceptsObject, queryAcceptsObjectSets, returnsDate, returnsTimestamp, threeDimensionalAggregationFunction, twoDimensionalAggregationFunction, } from \"@osdk/client.test.ontology\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { createClient } from \"../createClient.js\";\ndescribe(\"queries\", () => {\n let client;\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"simple query works\", async () => {\n const result = await client(addOne).executeFunction({ n: 2 });\n expect(result).toBe(3);\n });\n it(\"accepts objects\", async () => {\n const employee = await client(Employee).fetchOne(50030);\n const result = await client(queryAcceptsObject).executeFunction({\n object: employee,\n });\n expect(result).toEqual({\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 50031,\n });\n // Should also accept primary keys\n const result2 = await client(queryAcceptsObject).executeFunction({\n object: 50030,\n });\n expect(result2).toEqual({\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 50031,\n });\n });\n it(\"accepts objectSets\", async () => {\n const employeeObjectSet = client(Employee);\n const result = await client(queryAcceptsObjectSets).executeFunction({\n objectSet: employeeObjectSet,\n });\n expectTypeOf().toMatchTypeOf();\n });\n it(\"no params work\", async () => {\n const resultWithTimestamp = await client(returnsTimestamp)\n .executeFunction();\n expect(resultWithTimestamp).toBe(\"2019-01-01T00:00:00.000Z\");\n const resultWithDate = await client(returnsDate).executeFunction();\n expect(resultWithDate).toBe(\"2019-01-01\");\n });\n it(\"returns and accepts structs property\", async () => {\n const result = await client(incrementPersonAge).executeFunction({\n person: { firstName: \"John\", lastName: \"Doe\", age: 42 },\n });\n expect(result).toEqual({\n firstName: \"John\",\n lastName: \"Doe\",\n age: 43,\n });\n });\n it(\"returns and accepts complex structs property\", async () => {\n const employee = await client(Employee).fetchOne(50030);\n const result = await client(incrementPersonAgeComplex).executeFunction({\n person: { firstName: \"John\", lastName: \"Doe\", age: 42, object: employee },\n });\n expect(result).toEqual({\n firstName: \"John\",\n lastName: \"Doe\",\n age: 43,\n object: {\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 50031,\n },\n });\n });\n it(\"two dimensional aggregation response works\", async () => {\n const result = await client(twoDimensionalAggregationFunction)\n .executeFunction();\n expect(result).toEqual([{ key: \"Q-AFN\", value: 1 }, {\n key: \"Q-AFO\",\n value: 2,\n }]);\n });\n it(\"two dimensional aggregation request/response works\", async () => {\n const result = await client(acceptsTwoDimensionalAggregationFunction)\n .executeFunction({\n aggFunction: [\n {\n key: \"testKey1\",\n value: 1,\n },\n {\n key: \"testKey2\",\n value: 2,\n },\n ],\n });\n expect(result).toEqual([{ key: \"responseKey1\", value: 3 }, {\n key: \"responseKey2\",\n value: 4,\n }]);\n });\n it(\"three dimensional aggregation response works\", async () => {\n const result = await client(threeDimensionalAggregationFunction)\n .executeFunction();\n expect(result).toEqual([{\n key: \"Q-AFN\",\n groups: [{\n key: {\n startValue: \"2010-10-01T00:00:00Z\",\n endValue: \"2010-10-02T00:00:00Z\",\n },\n value: 65.0,\n }],\n }, { key: \"Q-AFO\", groups: [] }]);\n });\n it(\"throws when response is null and response is non-nullable\", async () => {\n try {\n const result = await client(addOne).executeFunction({ n: 3 });\n expect.fail(\"Should not reach here\");\n }\n catch (e) {\n expect(e.message).toMatch(`Got null response when nullable was not allowed`);\n }\n });\n it(\"three dimensional aggregation request/response works\", async () => {\n const result = await client(acceptsThreeDimensionalAggregationFunction)\n .executeFunction({\n aggFunction: [\n {\n key: \"testKey1\",\n groups: [\n {\n key: {\n startValue: \"2010-10-01T00:00:00Z\",\n endValue: \"2010-10-02T00:00:00Z\",\n },\n value: 65.0,\n },\n ],\n },\n {\n key: \"testKey2\",\n groups: [],\n },\n ],\n });\n expect(result).toEqual([\n {\n key: \"Q-AFN\",\n groups: [\n {\n key: {\n startValue: \"2010-10-01T00:00:00Z\",\n endValue: \"2010-10-02T00:00:00Z\",\n },\n value: 65.0,\n },\n ],\n },\n {\n key: \"Q-AFO\",\n groups: [],\n },\n ]);\n });\n it(\"accepts and returns objects\", async () => {\n const employeeObjectSet = client(Employee);\n const result = await client(queryAcceptsObjectSets).executeFunction({\n objectSet: employeeObjectSet,\n });\n expectTypeOf().toMatchTypeOf();\n });\n it(\"queries are enumerable\", async () => {\n const queries = Object.keys($Queries);\n expect(queries).toStrictEqual([\n \"acceptsThreeDimensionalAggregationFunction\",\n \"acceptsTwoDimensionalAggregationFunction\",\n \"addOne\",\n \"incrementPersonAge\",\n \"incrementPersonAgeComplex\",\n \"queryAcceptsObject\",\n \"queryAcceptsObjectSets\",\n \"queryTypeReturnsArray\",\n \"returnsDate\",\n \"returnsObject\",\n \"returnsTimestamp\",\n \"threeDimensionalAggregationFunction\",\n \"twoDimensionalAggregationFunction\",\n ]);\n });\n it(\"queries work with arrays\", async () => {\n const result = await client($Queries.queryTypeReturnsArray).executeFunction({ people: [\"Brad\", \"George\", \"Ryan\"] });\n expect(result).toEqual([\"Pitt\", \"Clooney\", \"Reynolds\"]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,QAAQ,EAAEC,0CAA0C,EAAEC,wCAAwC,EAAEC,MAAM,EAAEC,QAAQ,EAAEC,kBAAkB,EAAEC,yBAAyB,EAAEC,kBAAkB,EAAEC,sBAAsB,EAAEC,WAAW,EAAEC,gBAAgB,EAAEC,mCAAmC,EAAEC,iCAAiC,QAAS,4BAA4B;AAC9W,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAS,QAAQ;AACjF,SAASC,YAAY,QAAQ,oBAAoB;AACjDJ,QAAQ,CAAC,SAAS,EAAE,MAAM;EACtB,IAAIK,MAAM;EACVN,SAAS,CAAC,YAAY;IAClBF,SAAS,CAACS,MAAM,CAAC,CAAC;IAClBD,MAAM,GAAGD,YAAY,CAAC,4BAA4B,EAAErB,YAAY,EAAE,YAAY,eAAe,CAAC;EAClG,CAAC,CAAC;EACFe,QAAQ,CAAC,MAAM;IACXD,SAAS,CAACU,KAAK,CAAC,CAAC;EACrB,CAAC,CAAC;EACFJ,EAAE,CAAC,oBAAoB,EAAE,YAAY;IACjC,MAAMK,MAAM,GAAG,MAAMH,MAAM,CAAClB,MAAM,CAAC,CAACsB,eAAe,C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AC;EACFnB,EAAE,CAAC,wBAAwB,EAAE,YAAY;IACrC,MAAMoC,OAAO,GAAGC,MAAM,CAACC,IAAI,CAACzD,QAAQ,CAAC;IACrCiB,MAAM,CAACsC,OAAO,CAAC,CAACG,aAAa,CAAC,CAC1B,4CAA4C,EAC5C,0CAA0C,EAC1C,QAAQ,EACR,oBAAoB,EACpB,2BAA2B,EAC3B,oBAAoB,EACpB,wBAAwB,EACxB,uBAAuB,EACvB,aAAa,EACb,eAAe,EACf,kBAAkB,EAClB,qCAAqC,EACrC,mCAAmC,CACtC,CAAC;EACN,CAAC,CAAC;EACFvC,EAAE,CAAC,0BAA0B,EAAE,YAAY;IACvC,MAAMK,MAAM,GAAG,MAAMH,MAAM,CAACrB,QAAQ,CAAC2D,qBAAqB,CAAC,CAAClC,eAAe,CAAC;MAAEmC,MAAM,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,MAAM;IAAE,CAAC,CAAC;IACnH3C,MAAM,CAACO,MAAM,CAAC,CAACO,OAAO,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC;EAC3D,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -96,7 +96,7 @@ class TsServerImpl extends EventEmitter {
96
96
  }
97
97
  export async function startTsServer(logger) {
98
98
  const tsServerPath = await getTsServerPath();
99
- !(tsServerPath != null) ? invariant(false) : void 0;
99
+ !(tsServerPath != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
100
100
  return new TsServerImpl(tsServerPath, logger).start();
101
101
  }
102
102
  async function getTsServerPath() {
@@ -1 +1 @@
1
- {"version":3,"file":"tsserver.js","names":["execaNode","findUpMultiple","EventEmitter","fs","path","pLocate","pMap","invariant","server","s","TsServerImpl","tsServerPath","nextSeq","subprocess","logger","constructor","start","ipc","serialization","isLevelEnabled","on","req","trace","info","emit","stop","connected","disconnect","getOneMessage","filter","requestFactory","#requestFactory","command","isResponse","args","makeRequest","sendOpenRequest","protocol","CommandTypes","Open","sendQuickInfoRequest","Quickinfo","isQuickInfoResponse","#makeRequest","seq","type","arguments","sendMessage","resp","undefined","startTsServer","getTsServerPath","nodeModuleDirs","cwd","import","meta","url","possibleTsServerPaths","dir","join","c","stat","isFile","e","isEvent","m","isProjectLoadingStart","event","isProjectLoadingEnd","requestSeq","request_seq"],"sources":["tsserver.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 { execaNode } from \"execa\";\nimport { findUpMultiple } from \"find-up\";\nimport { EventEmitter } from \"node:events\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport pLocate from \"p-locate\";\nimport pMap from \"p-map\";\nimport invariant from \"tiny-invariant\";\nimport { server as s } from \"typescript\";\nclass TsServerImpl extends EventEmitter {\n #tsServerPath;\n #nextSeq = 1;\n #subprocess;\n #logger;\n constructor(tsServerPath, logger) {\n super();\n this.#tsServerPath = tsServerPath;\n this.#logger = logger;\n }\n get subprocess() {\n return this.#subprocess;\n }\n async start() {\n this.#subprocess = execaNode({\n ipc: true,\n serialization: \"json\",\n }) `${this.#tsServerPath} --useNodeIpc`;\n if (this.#logger.isLevelEnabled(\"trace\")) {\n this.#subprocess.on(\"message\", (req) => {\n this.#logger.trace({ req }, \"message received\");\n });\n }\n this.#subprocess.on(\"exit\", () => {\n this.#logger.info(\"tsserver exited\");\n this.emit(\"exit\");\n });\n return this;\n }\n stop() {\n if (this.#subprocess?.connected) {\n this.#subprocess?.disconnect();\n }\n }\n async getOneMessage(filter) {\n return await this.subprocess.getOneMessage({ filter });\n }\n #requestFactory = (command, isResponse) => async (args) => {\n return await this.#makeRequest(command, args, isResponse);\n };\n sendOpenRequest = this.#requestFactory(s.protocol.CommandTypes.Open);\n sendQuickInfoRequest = this.#requestFactory(s.protocol.CommandTypes.Quickinfo, isQuickInfoResponse);\n async #makeRequest(command, args, isResponse) {\n const seq = this.#nextSeq++;\n const req = {\n type: \"request\",\n command,\n arguments: args,\n seq,\n };\n this.#logger.trace({ req }, \"requesting\");\n await this.#subprocess?.sendMessage(req);\n if (isResponse) {\n return {\n req,\n resp: await this.#subprocess?.getOneMessage({\n filter: isResponse,\n }),\n };\n }\n return { req, resp: undefined };\n }\n}\nexport async function startTsServer(logger) {\n const tsServerPath = await getTsServerPath();\n invariant(tsServerPath != null);\n return new TsServerImpl(tsServerPath, logger).start();\n}\nasync function getTsServerPath() {\n const nodeModuleDirs = await findUpMultiple(\"node_modules\", {\n cwd: import.meta.url,\n type: \"directory\",\n });\n const possibleTsServerPaths = await pMap(nodeModuleDirs, (dir) => path.join(dir, \"typescript\", \"lib\", \"tsserver.js\"));\n const tsServerPath = await pLocate([\"no\", ...possibleTsServerPaths], async (dir) => {\n try {\n const c = await fs.stat(dir);\n return c.isFile();\n }\n catch (e) {\n return false;\n }\n });\n return tsServerPath;\n}\nexport function isEvent(m) {\n return !!(m && typeof m === \"object\" && \"type\" in m\n && m.type === \"event\");\n}\nexport function isResponse(m) {\n return !!(m && typeof m === \"object\" && \"type\" in m\n && m.type === \"response\");\n}\nexport function isProjectLoadingStart(m) {\n return isEvent(m) && m.event === \"projectLoadingStart\";\n}\nexport function isProjectLoadingEnd(m) {\n return isEvent(m) && m.event === \"projectLoadingFinish\";\n}\nexport function isQuickInfoResponse(m, requestSeq) {\n return isResponse(m) && m.command === s.protocol.CommandTypes.Quickinfo\n && (requestSeq == null || m.request_seq === requestSeq);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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AAC9B;AACA,OAAO,SAASZ,UAAUA,CAACgC,CAAC,EAAE;EAC1B,OAAO,CAAC,EAAEA,CAAC,IAAI,OAAOA,CAAC,KAAK,QAAQ,IAAI,MAAM,IAAIA,CAAC,IAC5CA,CAAC,CAACpB,IAAI,KAAK,UAAU,CAAC;AACjC;AACA,OAAO,SAASqB,qBAAqBA,CAACD,CAAC,EAAE;EACrC,OAAOD,OAAO,CAACC,CAAC,CAAC,IAAIA,CAAC,CAACE,KAAK,KAAK,qBAAqB;AAC1D;AACA,OAAO,SAASC,mBAAmBA,CAACH,CAAC,EAAE;EACnC,OAAOD,OAAO,CAACC,CAAC,CAAC,IAAIA,CAAC,CAACE,KAAK,KAAK,sBAAsB;AAC3D;AACA,OAAO,SAASzB,mBAAmBA,CAACuB,CAAC,EAAEI,UAAU,EAAE;EAC/C,OAAOpC,UAAU,CAACgC,CAAC,CAAC,IAAIA,CAAC,CAACjC,OAAO,KAAKvB,CAAC,CAAC4B,QAAQ,CAACC,YAAY,CAACG,SAAS,KAC/D4B,UAAU,IAAI,IAAI,IAAIJ,CAAC,CAACK,WAAW,KAAKD,UAAU,CAAC;AAC/D","ignoreList":[]}
1
+ {"version":3,"file":"tsserver.js","names":["execaNode","findUpMultiple","EventEmitter","fs","path","pLocate","pMap","invariant","server","s","TsServerImpl","tsServerPath","nextSeq","subprocess","logger","constructor","start","ipc","serialization","isLevelEnabled","on","req","trace","info","emit","stop","connected","disconnect","getOneMessage","filter","requestFactory","#requestFactory","command","isResponse","args","makeRequest","sendOpenRequest","protocol","CommandTypes","Open","sendQuickInfoRequest","Quickinfo","isQuickInfoResponse","#makeRequest","seq","type","arguments","sendMessage","resp","undefined","startTsServer","getTsServerPath","process","env","NODE_ENV","nodeModuleDirs","cwd","import","meta","url","possibleTsServerPaths","dir","join","c","stat","isFile","e","isEvent","m","isProjectLoadingStart","event","isProjectLoadingEnd","requestSeq","request_seq"],"sources":["tsserver.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 { execaNode } from \"execa\";\nimport { findUpMultiple } from \"find-up\";\nimport { EventEmitter } from \"node:events\";\nimport * as fs from \"node:fs/promises\";\nimport * as path from \"node:path\";\nimport pLocate from \"p-locate\";\nimport pMap from \"p-map\";\nimport invariant from \"tiny-invariant\";\nimport { server as s } from \"typescript\";\nclass TsServerImpl extends EventEmitter {\n #tsServerPath;\n #nextSeq = 1;\n #subprocess;\n #logger;\n constructor(tsServerPath, logger) {\n super();\n this.#tsServerPath = tsServerPath;\n this.#logger = logger;\n }\n get subprocess() {\n return this.#subprocess;\n }\n async start() {\n this.#subprocess = execaNode({\n ipc: true,\n serialization: \"json\",\n }) `${this.#tsServerPath} --useNodeIpc`;\n if (this.#logger.isLevelEnabled(\"trace\")) {\n this.#subprocess.on(\"message\", (req) => {\n this.#logger.trace({ req }, \"message received\");\n });\n }\n this.#subprocess.on(\"exit\", () => {\n this.#logger.info(\"tsserver exited\");\n this.emit(\"exit\");\n });\n return this;\n }\n stop() {\n if (this.#subprocess?.connected) {\n this.#subprocess?.disconnect();\n }\n }\n async getOneMessage(filter) {\n return await this.subprocess.getOneMessage({ filter });\n }\n #requestFactory = (command, isResponse) => async (args) => {\n return await this.#makeRequest(command, args, isResponse);\n };\n sendOpenRequest = this.#requestFactory(s.protocol.CommandTypes.Open);\n sendQuickInfoRequest = this.#requestFactory(s.protocol.CommandTypes.Quickinfo, isQuickInfoResponse);\n async #makeRequest(command, args, isResponse) {\n const seq = this.#nextSeq++;\n const req = {\n type: \"request\",\n command,\n arguments: args,\n seq,\n };\n this.#logger.trace({ req }, \"requesting\");\n await this.#subprocess?.sendMessage(req);\n if (isResponse) {\n return {\n req,\n resp: await this.#subprocess?.getOneMessage({\n filter: isResponse,\n }),\n };\n }\n return { req, resp: undefined };\n }\n}\nexport async function startTsServer(logger) {\n const tsServerPath = await getTsServerPath();\n invariant(tsServerPath != null);\n return new TsServerImpl(tsServerPath, logger).start();\n}\nasync function getTsServerPath() {\n const nodeModuleDirs = await findUpMultiple(\"node_modules\", {\n cwd: import.meta.url,\n type: \"directory\",\n });\n const possibleTsServerPaths = await pMap(nodeModuleDirs, (dir) => path.join(dir, \"typescript\", \"lib\", \"tsserver.js\"));\n const tsServerPath = await pLocate([\"no\", ...possibleTsServerPaths], async (dir) => {\n try {\n const c = await fs.stat(dir);\n return c.isFile();\n }\n catch (e) {\n return false;\n }\n });\n return tsServerPath;\n}\nexport function isEvent(m) {\n return !!(m && typeof m === \"object\" && \"type\" in m\n && m.type === \"event\");\n}\nexport function isResponse(m) {\n return !!(m && typeof m === \"object\" && \"type\" in m\n && m.type === \"response\");\n}\nexport function isProjectLoadingStart(m) {\n return isEvent(m) && m.event === \"projectLoadingStart\";\n}\nexport function isProjectLoadingEnd(m) {\n return isEvent(m) && m.event === \"projectLoadingFinish\";\n}\nexport function isQuickInfoResponse(m, requestSeq) {\n return isResponse(m) && m.command === s.protocol.CommandTypes.Quickinfo\n && (requestSeq == null || m.request_seq === requestSeq);\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,SAAS,QAAQ,OAAO;AACjC,SAASC,cAAc,QAAQ,SAAS;AACxC,SAASC,YAAY,QAAQ,aAAa;AAC1C,OAAO,KAAKC,EAAE,MAAM,kBAAkB;AACtC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,OAAO,MAAM,UAAU;AAC9B,OAAOC,IAAI,MAAM,OAAO;AACxB,OAAOC,SAAS,MAAM,gBAA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B,qBAAqBA,CAACD,CAAC,EAAE;EACrC,OAAOD,OAAO,CAACC,CAAC,CAAC,IAAIA,CAAC,CAACE,KAAK,KAAK,qBAAqB;AAC1D;AACA,OAAO,SAASC,mBAAmBA,CAACH,CAAC,EAAE;EACnC,OAAOD,OAAO,CAACC,CAAC,CAAC,IAAIA,CAAC,CAACE,KAAK,KAAK,sBAAsB;AAC3D;AACA,OAAO,SAAS5B,mBAAmBA,CAAC0B,CAAC,EAAEI,UAAU,EAAE;EAC/C,OAAOvC,UAAU,CAACmC,CAAC,CAAC,IAAIA,CAAC,CAACpC,OAAO,KAAKvB,CAAC,CAAC4B,QAAQ,CAACC,YAAY,CAACG,SAAS,KAC/D+B,UAAU,IAAI,IAAI,IAAIJ,CAAC,CAACK,WAAW,KAAKD,UAAU,CAAC;AAC/D","ignoreList":[]}
@@ -13,5 +13,5 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export const USER_AGENT = `osdk-client/${"2.1.0-beta.1"}`;
16
+ export const USER_AGENT = `osdk-client/${"2.1.0-beta.10"}`;
17
17
  //# sourceMappingURL=UserAgent.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UserAgent.js","names":["USER_AGENT"],"sources":["UserAgent.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 const USER_AGENT = `osdk-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,UAAU,GAAG,+BAA4C","ignoreList":[]}
1
+ {"version":3,"file":"UserAgent.js","names":["USER_AGENT"],"sources":["UserAgent.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 const USER_AGENT = `osdk-client/${process.env.PACKAGE_VERSION}`;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,UAAU,GAAG,gCAA4C","ignoreList":[]}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Extracts the date from a ISO 8601 formatted date time string. Throws if the input is not in the correct format.
3
+ *
4
+ * @param dateTime An ISO 8601 formatted date time string
5
+ * @returns The date part of the input string
6
+ */
7
+ export declare const extractDate: (dateTime: string) => string;
8
+ /**
9
+ * Generates a string representation of the input date (YYYY-MM-DD). The resulting date string reflects the given date in UTC time.
10
+ *
11
+ * @param date
12
+ * @returns The date part of a ISO 8601 formatted date time string
13
+ */
14
+ export declare const extractDateInUTC: (date: Date) => string;
15
+ /**
16
+ * Generates a string representation of the input date (YYYY-MM-DD). The resulting date string reflects the given date in the local time zone.
17
+ *
18
+ * @param date
19
+ * @returns The date part of a ISO 8601 formatted date time string
20
+ */
21
+ export declare const extractDateInLocalTime: (date: Date) => string;
22
+ //# sourceMappingURL=datetimeConverters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datetimeConverters.d.ts","sourceRoot":"","sources":["../../../src/util/datetimeConverters.ts"],"names":[],"mappings":"AAqBA;;;;;GAKG;AACH,eAAO,MAAM,WAAW,aAAc,MAAM,WAU3C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,SAAU,IAAI,WAE1C,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,SAAU,IAAI,WAEhD,CAAC"}
@@ -0,0 +1,55 @@
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 invariant from "tiny-invariant";
17
+ const isoRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|[+-]\d{2}:\d{2})?$/;
18
+ /**
19
+ * Extracts the date from a ISO 8601 formatted date time string. Throws if the input is not in the correct format.
20
+ *
21
+ * @param dateTime An ISO 8601 formatted date time string
22
+ * @returns The date part of the input string
23
+ */
24
+ export const extractDate = dateTime => {
25
+ !(dateTime.length < 33) ? process.env.NODE_ENV !== "production" ? invariant(false, "Invalid date format. Provided input is too long.") : invariant(false) : void 0;
26
+ !isoRegex.test(dateTime) ? process.env.NODE_ENV !== "production" ? invariant(false, `Invalid date format. Expected ISO 8601 format, but received ${dateTime}`) : invariant(false) : void 0;
27
+ return extractDateFromIsoString(dateTime);
28
+ };
29
+ /**
30
+ * Generates a string representation of the input date (YYYY-MM-DD). The resulting date string reflects the given date in UTC time.
31
+ *
32
+ * @param date
33
+ * @returns The date part of a ISO 8601 formatted date time string
34
+ */
35
+ export const extractDateInUTC = date => {
36
+ return extractDateFromIsoString(date.toISOString());
37
+ };
38
+ /**
39
+ * Generates a string representation of the input date (YYYY-MM-DD). The resulting date string reflects the given date in the local time zone.
40
+ *
41
+ * @param date
42
+ * @returns The date part of a ISO 8601 formatted date time string
43
+ */
44
+ export const extractDateInLocalTime = date => {
45
+ return extractDateFromIsoString(generateOffsetUtcString(date));
46
+ };
47
+ /** @internal */
48
+ export const generateOffsetUtcString = date => {
49
+ const offsetMs = date.getTimezoneOffset() * 60 * 1000;
50
+ return new Date(date.getTime() - offsetMs).toISOString();
51
+ };
52
+ const extractDateFromIsoString = dateTime => {
53
+ return dateTime.split("T")[0];
54
+ };
55
+ //# sourceMappingURL=datetimeConverters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datetimeConverters.js","names":["invariant","isoRegex","extractDate","dateTime","length","process","env","NODE_ENV","test","extractDateFromIsoString","extractDateInUTC","date","toISOString","extractDateInLocalTime","generateOffsetUtcString","offsetMs","getTimezoneOffset","Date","getTime","split"],"sources":["datetimeConverters.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 invariant from \"tiny-invariant\";\nconst isoRegex = /^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(?:\\.\\d+)?(?:Z|[+-]\\d{2}:\\d{2})?$/;\n/**\n * Extracts the date from a ISO 8601 formatted date time string. Throws if the input is not in the correct format.\n *\n * @param dateTime An ISO 8601 formatted date time string\n * @returns The date part of the input string\n */\nexport const extractDate = (dateTime) => {\n invariant(dateTime.length < 33, \"Invalid date format. Provided input is too long.\");\n invariant(isoRegex.test(dateTime), `Invalid date format. Expected ISO 8601 format, but received ${dateTime}`);\n return extractDateFromIsoString(dateTime);\n};\n/**\n * Generates a string representation of the input date (YYYY-MM-DD). The resulting date string reflects the given date in UTC time.\n *\n * @param date\n * @returns The date part of a ISO 8601 formatted date time string\n */\nexport const extractDateInUTC = (date) => {\n return extractDateFromIsoString(date.toISOString());\n};\n/**\n * Generates a string representation of the input date (YYYY-MM-DD). The resulting date string reflects the given date in the local time zone.\n *\n * @param date\n * @returns The date part of a ISO 8601 formatted date time string\n */\nexport const extractDateInLocalTime = (date) => {\n return extractDateFromIsoString(generateOffsetUtcString(date));\n};\n/** @internal */\nexport const generateOffsetUtcString = (date) => {\n const offsetMs = date.getTimezoneOffset() * 60 * 1000;\n return new Date(date.getTime() - offsetMs).toISOString();\n};\nconst extractDateFromIsoString = (dateTime) => {\n return dateTime.split(\"T\")[0];\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,MAAMC,QAAQ,GAAG,uEAAuE;AACxF;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,WAAW,GAAIC,QAAQ,IAAK;EACrC,EAAUA,QAAQ,CAACC,MAAM,GAAG,EAAE,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAA9BP,SAAS,QAAuB,kDAAkD,IAAlFA,SAAS;EACT,CAAUC,QAAQ,CAACO,IAAI,CAACL,QAAQ,CAAC,GAAAE,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAAjCP,SAAS,QAA0B,+DAA+DG,QAAQ,EAAE,IAA5GH,SAAS;EACT,OAAOS,wBAAwB,CAACN,QAAQ,CAAC;AAC7C,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMO,gBAAgB,GAAIC,IAAI,IAAK;EACtC,OAAOF,wBAAwB,CAACE,IAAI,CAACC,WAAW,CAAC,CAAC,CAAC;AACvD,CAAC;AACD;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,sBAAsB,GAAIF,IAAI,IAAK;EAC5C,OAAOF,wBAAwB,CAACK,uBAAuB,CAACH,IAAI,CAAC,CAAC;AAClE,CAAC;AACD;AACA,OAAO,MAAMG,uBAAuB,GAAIH,IAAI,IAAK;EAC7C,MAAMI,QAAQ,GAAGJ,IAAI,CAACK,iBAAiB,CAAC,CAAC,GAAG,EAAE,GAAG,IAAI;EACrD,OAAO,IAAIC,IAAI,CAACN,IAAI,CAACO,OAAO,CAAC,CAAC,GAAGH,QAAQ,CAAC,CAACH,WAAW,CAAC,CAAC;AAC5D,CAAC;AACD,MAAMH,wBAAwB,GAAIN,QAAQ,IAAK;EAC3C,OAAOA,QAAQ,CAACgB,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACjC,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=datetimeConverters.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datetimeConverters.test.d.ts","sourceRoot":"","sources":["../../../src/util/datetimeConverters.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,75 @@
1
+ /*
2
+ * Copyright 2023 Palantir Technologies, Inc. All rights reserved.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import { register, unregister } from "timezone-mock";
17
+ import { afterAll, beforeAll, describe, expect, it } from "vitest";
18
+ import { extractDate, extractDateInLocalTime, extractDateInUTC, generateOffsetUtcString } from "./datetimeConverters.js";
19
+ describe("test datetime converters", () => {
20
+ beforeAll(() => {
21
+ register("Etc/GMT+5");
22
+ });
23
+ afterAll(() => {
24
+ unregister();
25
+ });
26
+ describe("test extractDate", () => {
27
+ it("should error if the date is not in UTC format", () => {
28
+ expect(() => extractDate("2021-01-01")).toThrowError("Invariant failed: Invalid date format. Expected ISO 8601 format, but received 2021-01-01");
29
+ expect(() => extractDate("2021-01-01T00:0000.000Z")).toThrowError("Invariant failed: Invalid date format. Expected ISO 8601 format, but received 2021-01-01");
30
+ });
31
+ it("should return the date part of the input string", () => {
32
+ const result = extractDate("2021-01-01T00:00:00.000Z");
33
+ expect(result).toBe("2021-01-01");
34
+ });
35
+ });
36
+ describe("test extractDateInUTC", () => {
37
+ it("should return the date in UTC given Date constructed with UTC time", () => {
38
+ const date = new Date("2021-01-01T00:00:00.000Z");
39
+ expect(date.getDate()).toBe(31);
40
+ expect(date.getUTCDate()).toBe(1);
41
+ const result = extractDateInUTC(date);
42
+ expect(result).toBe("2021-01-01");
43
+ });
44
+ it("should return the date in UTC given Date constructed with a local time", () => {
45
+ const date = new Date("2020-12-31T23:00:00.000");
46
+ expect(date.getDate()).toBe(31);
47
+ expect(date.getUTCDate()).toBe(1);
48
+ const result = extractDateInUTC(date);
49
+ expect(result).toBe("2021-01-01");
50
+ });
51
+ });
52
+ describe("test extractDateInLocalTime", () => {
53
+ it("should return the date in local time given Date constructed with local time", () => {
54
+ const date = new Date("2020-12-31T23:00:00.000");
55
+ expect(date.getDate()).toBe(31);
56
+ const result = extractDateInLocalTime(date);
57
+ expect(result).toBe("2020-12-31");
58
+ });
59
+ describe("test generating ISO String", () => {
60
+ it("should return a correct ISO 8601 string that is offset correctly", () => {
61
+ const date = new Date("2021-01-01T00:00:00.000Z");
62
+ expect(date.getDate()).toBe(31);
63
+ const result = generateOffsetUtcString(date);
64
+ expect(result).toBe("2020-12-31T19:00:00.000Z");
65
+ });
66
+ });
67
+ it("should return the date in local time given Date constructed with UTC time", () => {
68
+ const date = new Date("2021-01-01T00:00:00.000Z");
69
+ expect(date.getDate()).toBe(31);
70
+ const result = extractDateInLocalTime(date);
71
+ expect(result).toBe("2020-12-31");
72
+ });
73
+ });
74
+ });
75
+ //# sourceMappingURL=datetimeConverters.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"datetimeConverters.test.js","names":["register","unregister","afterAll","beforeAll","describe","expect","it","extractDate","extractDateInLocalTime","extractDateInUTC","generateOffsetUtcString","toThrowError","result","toBe","date","Date","getDate","getUTCDate"],"sources":["datetimeConverters.test.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 { register, unregister } from \"timezone-mock\";\nimport { afterAll, beforeAll, describe, expect, it, } from \"vitest\";\nimport { extractDate, extractDateInLocalTime, extractDateInUTC, generateOffsetUtcString, } from \"./datetimeConverters.js\";\ndescribe(\"test datetime converters\", () => {\n beforeAll(() => {\n register(\"Etc/GMT+5\");\n });\n afterAll(() => {\n unregister();\n });\n describe(\"test extractDate\", () => {\n it(\"should error if the date is not in UTC format\", () => {\n expect(() => extractDate(\"2021-01-01\")).toThrowError(\"Invariant failed: Invalid date format. Expected ISO 8601 format, but received 2021-01-01\");\n expect(() => extractDate(\"2021-01-01T00:0000.000Z\")).toThrowError(\"Invariant failed: Invalid date format. Expected ISO 8601 format, but received 2021-01-01\");\n });\n it(\"should return the date part of the input string\", () => {\n const result = extractDate(\"2021-01-01T00:00:00.000Z\");\n expect(result).toBe(\"2021-01-01\");\n });\n });\n describe(\"test extractDateInUTC\", () => {\n it(\"should return the date in UTC given Date constructed with UTC time\", () => {\n const date = new Date(\"2021-01-01T00:00:00.000Z\");\n expect(date.getDate()).toBe(31);\n expect(date.getUTCDate()).toBe(1);\n const result = extractDateInUTC(date);\n expect(result).toBe(\"2021-01-01\");\n });\n it(\"should return the date in UTC given Date constructed with a local time\", () => {\n const date = new Date(\"2020-12-31T23:00:00.000\");\n expect(date.getDate()).toBe(31);\n expect(date.getUTCDate()).toBe(1);\n const result = extractDateInUTC(date);\n expect(result).toBe(\"2021-01-01\");\n });\n });\n describe(\"test extractDateInLocalTime\", () => {\n it(\"should return the date in local time given Date constructed with local time\", () => {\n const date = new Date(\"2020-12-31T23:00:00.000\");\n expect(date.getDate()).toBe(31);\n const result = extractDateInLocalTime(date);\n expect(result).toBe(\"2020-12-31\");\n });\n describe(\"test generating ISO String\", () => {\n it(\"should return a correct ISO 8601 string that is offset correctly\", () => {\n const date = new Date(\"2021-01-01T00:00:00.000Z\");\n expect(date.getDate()).toBe(31);\n const result = generateOffsetUtcString(date);\n expect(result).toBe(\"2020-12-31T19:00:00.000Z\");\n });\n });\n it(\"should return the date in local time given Date constructed with UTC time\", () => {\n const date = new Date(\"2021-01-01T00:00:00.000Z\");\n expect(date.getDate()).toBe(31);\n const result = extractDateInLocalTime(date);\n expect(result).toBe(\"2020-12-31\");\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,QAAQ,EAAEC,UAAU,QAAQ,eAAe;AACpD,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAS,QAAQ;AACnE,SAASC,WAAW,EAAEC,sBAAsB,EAAEC,gBAAgB,EAAEC,uBAAuB,QAAS,yBAAyB;AACzHN,QAAQ,CAAC,0BAA0B,EAAE,MAAM;EACvCD,SAAS,CAAC,MAAM;IACZH,QAAQ,CAAC,WAAW,CAAC;EACzB,CAAC,CAAC;EACFE,Q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,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ import type { ObjectOrInterfaceDefinition } from "@osdk/api";
2
+ import type { ObjectSet as WireObjectSet } from "@osdk/internal.foundry.core";
3
+ export declare function resolveBaseObjectSetType(objectType: ObjectOrInterfaceDefinition): WireObjectSet;
4
+ //# sourceMappingURL=objectSetUtils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectSetUtils.d.ts","sourceRoot":"","sources":["../../../src/util/objectSetUtils.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,WAAW,CAAC;AAC7D,OAAO,KAAK,EAAE,SAAS,IAAI,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE9E,wBAAgB,wBAAwB,CACtC,UAAU,EAAE,2BAA2B,GACtC,aAAa,CAUf"}
@@ -0,0 +1,25 @@
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 function resolveBaseObjectSetType(objectType) {
17
+ return objectType.type === "interface" ? {
18
+ type: "interfaceBase",
19
+ interfaceType: objectType["apiName"]
20
+ } : {
21
+ type: "base",
22
+ objectType: objectType["apiName"]
23
+ };
24
+ }
25
+ //# sourceMappingURL=objectSetUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"objectSetUtils.js","names":["resolveBaseObjectSetType","objectType","type","interfaceType"],"sources":["objectSetUtils.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 */\nexport function resolveBaseObjectSetType(objectType) {\n return objectType.type === \"interface\"\n ? {\n type: \"interfaceBase\",\n interfaceType: objectType[\"apiName\"],\n }\n : {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,wBAAwBA,CAACC,UAAU,EAAE;EACjD,OAAOA,UAAU,CAACC,IAAI,KAAK,WAAW,GAChC;IACEA,IAAI,EAAE,eAAe;IACrBC,aAAa,EAAEF,UAAU,CAAC,SAAS;EACvC,CAAC,GACC;IACEC,IAAI,EAAE,MAAM;IACZD,UAAU,EAAEA,UAAU,CAAC,SAAS;EACpC,CAAC;AACT","ignoreList":[]}
@@ -1 +1 @@
1
- {"version":3,"file":"timeseriesUtils.d.ts","sourceRoot":"","sources":["../../../src/util/timeseriesUtils.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAI7D,wBAAgB,YAAY,CAAC,IAAI,EAAE,eAAe,GAAG,SAAS,CAyB7D;AAED,wBAAuB,qBAAqB,CAC1C,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,KAAK,EAEzC,QAAQ,EAAE,IAAI;;WAQY,CAAC;kBAG5B"}
1
+ {"version":3,"file":"timeseriesUtils.d.ts","sourceRoot":"","sources":["../../../src/util/timeseriesUtils.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,WAAW,CAAC;AAEjD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAG7D,wBAAgB,YAAY,CAAC,IAAI,EAAE,eAAe,GAAG,SAAS,CAyB7D;AAED,wBAAuB,qBAAqB,CAC1C,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,KAAK,EAEzC,QAAQ,EAAE,IAAI;;WAQY,CAAC;kBAG5B"}
@@ -1,7 +1,7 @@
1
- import type { ActionDefinition, ActionMetadata, CompileTimeMetadata, InterfaceDefinition, InterfaceMetadata, ObjectMetadata, ObjectOrInterfaceDefinition, ObjectSet, ObjectTypeDefinition, Osdk, QueryDefinition, QueryMetadata, VersionBound } from "@osdk/api";
2
- import type { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet, MinimalObjectSet } from "@osdk/api/unstable";
3
- import type { SharedClient } from "@osdk/shared.client";
4
- import type { BulkLinkResult } from "./__unstable/createBulkLinksAsyncIterFactory.js";
1
+ import type { ActionDefinition, ActionMetadata, CompileTimeMetadata, InterfaceDefinition, InterfaceMetadata, ObjectMetadata, ObjectSet, ObjectTypeDefinition, QueryDefinition, QueryMetadata, VersionBound } from "@osdk/api";
2
+ import type { Experiment, ExperimentFns, MinimalObjectSet } from "@osdk/api/unstable";
3
+ import type { SharedClient as OldSharedClient } from "@osdk/shared.client";
4
+ import type { SharedClient } from "@osdk/shared.client2";
5
5
  import type { ActionSignatureFromDef } from "./actions/applyAction.js";
6
6
  import type { MinimalClient } from "./MinimalClientContext.js";
7
7
  import type { QuerySignatureFromDef } from "./queries/types.js";
@@ -9,29 +9,16 @@ import type { SatisfiesSemver } from "./SatisfiesSemver.js";
9
9
  export type CheckVersionBound<Q> = Q extends VersionBound<infer V> ? (SatisfiesSemver<V, MaxOsdkVersion> extends true ? Q : Q & {
10
10
  [ErrorMessage]: `Your SDK requires a semver compatible version with ${V}. You have ${MaxOsdkVersion}. Update your package.json`;
11
11
  }) : Q;
12
- export interface Client extends SharedClient<MinimalClient> {
12
+ export interface Client extends SharedClient, OldSharedClient {
13
13
  <Q extends ObjectTypeDefinition>(o: Q): unknown extends CompileTimeMetadata<Q>["objectSet"] ? ObjectSet<Q> : CompileTimeMetadata<Q>["objectSet"];
14
14
  <Q extends (InterfaceDefinition)>(o: Q): unknown extends CompileTimeMetadata<Q>["objectSet"] ? MinimalObjectSet<Q> : CompileTimeMetadata<Q>["objectSet"];
15
15
  <Q extends ActionDefinition<any>>(o: Q): ActionSignatureFromDef<Q>;
16
16
  <Q extends QueryDefinition<any>>(o: Q): QuerySignatureFromDef<Q>;
17
+ <Q extends Experiment<"2.0.8"> | Experiment<"2.1.0">>(experiment: Q): ExperimentFns<Q>;
17
18
  fetchMetadata<Q extends (ObjectTypeDefinition | InterfaceDefinition | ActionDefinition<any> | QueryDefinition<any>)>(o: Q): Promise<Q extends ObjectTypeDefinition ? ObjectMetadata : Q extends InterfaceDefinition ? InterfaceMetadata : Q extends ActionDefinition<any> ? ActionMetadata : Q extends QueryDefinition<any> ? QueryMetadata : never>;
18
- /**
19
- * WARNING. THIS METHOD IS EXPERIMENTAL AND NOT SUPPORTED YET.
20
- *
21
- * It may change at any time and does not follow semantic versioning. Use at your own risk.
22
- *
23
- * @alpha
24
- */
25
- readonly [__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet]: <T extends ObjectOrInterfaceDefinition>(type: T, rid: string) => ObjectSet<T>;
26
- /**
27
- * WARNING. THIS METHOD IS EXPERIMENTAL AND NOT SUPPORTED YET.
28
- *
29
- * It may change at any time and does not follow semantic versioning. Use at your own risk.
30
- *
31
- * @alpha
32
- */
33
- readonly [__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks]: <T extends ObjectOrInterfaceDefinition>(objs: Osdk<T>[], links: string[]) => AsyncGenerator<BulkLinkResult, void, undefined>;
19
+ [additionalContext]: MinimalClient;
34
20
  }
21
+ export declare const additionalContext: unique symbol;
35
22
  declare const MaxOsdkVersion = "2.1.0";
36
23
  export type MaxOsdkVersion = typeof MaxOsdkVersion;
37
24
  declare const ErrorMessage: unique symbol;
@@ -1 +1 @@
1
- {"version":3,"file":"Client.d.ts","sourceRoot":"","sources":["../../src/Client.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,EACjB,cAAc,EACd,2BAA2B,EAC3B,SAAS,EACT,oBAAoB,EACpB,IAAI,EACJ,eAAe,EACf,aAAa,EACb,YAAY,EACb,MAAM,WAAW,CAAC;AACnB,OAAO,KAAK,EACV,+CAA+C,EAC/C,uDAAuD,EACvD,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AACtF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,MAAM,iBAAiB,CAAC,CAAC,IAAI,CAAC,SAAS,YAAY,CAAC,MAAM,CAAC,CAAC,GAAG,CACjE,eAAe,CAAC,CAAC,EAAE,cAAc,CAAC,SAAS,IAAI,GAAG,CAAC,GAC/C,CAAC,GAAG;IACJ,CAAC,YAAY,CAAC,EACZ,sDAAsD,CAAC,cAAc,cAAc,4BAA4B,CAAC;CACnH,CACJ,GACC,CAAC,CAAC;AAEN,MAAM,WAAW,MAAO,SAAQ,YAAY,CAAC,aAAa,C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AAG,CAAC,GAAG,aAAa,GAC9C,KAAK,CACV,CAAC;IAEF,CAAC,iBAAiB,CAAC,EAAE,aAAa,CAAC;CACpC;AAGD,eAAO,MAAM,iBAAiB,eAA8B,CAAC;AAG7D,QAAA,MAAM,cAAc,UAAU,CAAC;AAE/B,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC;AACnD,QAAA,MAAM,YAAY,eAAyB,CAAC"}
@@ -13,8 +13,9 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ // DO NOT EXPORT FROM PACKAGE
17
+ export const additionalContext = Symbol("additionalContext");
16
18
  // BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.
17
19
  const MaxOsdkVersion = "2.1.0";
18
20
  const ErrorMessage = Symbol("ErrorMessage");
19
- export {};
20
21
  //# sourceMappingURL=Client.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Client.js","names":["MaxOsdkVersion","ErrorMessage","Symbol"],"sources":["Client.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 */\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.1.0\";\nconst ErrorMessage = Symbol(\"ErrorMessage\");\nexport {};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAMA,cAAc,GAAG,OAAO;AAC9B,MAAMC,YAAY,GAAGC,MAAM,CAAC,cAAc,CAAC;AAC3C","ignoreList":[]}
1
+ {"version":3,"file":"Client.js","names":["additionalContext","Symbol","MaxOsdkVersion","ErrorMessage"],"sources":["Client.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 */\n// DO NOT EXPORT FROM PACKAGE\nexport const additionalContext = Symbol(\"additionalContext\");\n// BEGIN: THIS IS GENERATED CODE. DO NOT EDIT.\nconst MaxOsdkVersion = \"2.1.0\";\nconst ErrorMessage = Symbol(\"ErrorMessage\");\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,iBAAiB,GAAGC,MAAM,CAAC,mBAAmB,CAAC;AAC5D;AACA,MAAMC,cAAc,GAAG,OAAO;AAC9B,MAAMC,YAAY,GAAGF,MAAM,CAAC,cAAc,CAAC","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { SharedClientContext } from "@osdk/shared.client";
1
+ import type { SharedClientContext } from "@osdk/shared.client2";
2
2
  import type { Logger } from "./Logger.js";
3
3
  import type { OntologyProvider } from "./ontology/OntologyProvider.js";
4
4
  declare const tag: unique symbol;
@@ -1 +1 @@
1
- {"version":3,"file":"MinimalClientContext.d.ts","sourceRoot":"","sources":["../../src/MinimalClientContext.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gCAA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,SAAQ,mBAAmB;IACxD,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACtC,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,cAAc,EAAE,cAAc,CAAC;IAC/B,cAAc,EAAE,cAAc,CAAC;CAChC;AAED,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,EAAE,qBAAqB,CAAC;IAChC,QAAQ,EAAE,gBAAgB,CAAC;CAC5B,CAAC;AAEF,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACvC"}
@@ -20,7 +20,7 @@ import { makeConjureContext } from "../ontology/makeConjureContext.js";
20
20
  let cachedAllOntologies;
21
21
  async function getOntologyVersionForRid(ctx, ontologyRid) {
22
22
  cachedAllOntologies ??= await loadAllOntologies(ctx, {});
23
- !cachedAllOntologies.ontologies[ontologyRid] ? invariant(false, "ontology should be loaded") : void 0;
23
+ !cachedAllOntologies.ontologies[ontologyRid] ? process.env.NODE_ENV !== "production" ? invariant(false, "ontology should be loaded") : invariant(false) : void 0;
24
24
  return cachedAllOntologies.ontologies[ontologyRid].currentOntologyVersion;
25
25
  }
26
26
  const strongMemoSync = fn => createSimpleCache(new Map(), fn).get;
@@ -64,7 +64,7 @@ export class MetadataClient {
64
64
  [objectTypeRid]: await this.ontologyVersion("")
65
65
  }
66
66
  });
67
- !linkTypes.linkTypes[objectTypeRid] ? invariant(false, "link type should be loaded") : void 0;
67
+ !linkTypes.linkTypes[objectTypeRid] ? process.env.NODE_ENV !== "production" ? invariant(false, "link type should be loaded") : invariant(false) : void 0;
68
68
  // apiName to content
69
69
  const ret = {};
70
70
  for (const l of linkTypes.linkTypes[objectTypeRid]) {
@@ -140,14 +140,14 @@ export class MetadataClient {
140
140
  includeEntityMetadata: undefined
141
141
  };
142
142
  const entities = await bulkLoadOntologyEntities(this.#ctx, undefined, body);
143
- !entities.objectTypes[0]?.objectType ? invariant(false, "object type should be loaded") : void 0;
143
+ !entities.objectTypes[0]?.objectType ? process.env.NODE_ENV !== "production" ? invariant(false, "object type should be loaded") : invariant(false) : void 0;
144
144
  return entities.objectTypes[0].objectType;
145
145
  });
146
146
  ontologyVersion = strongMemoAsync(async () => getOntologyVersionForRid(this.#ctx, await this.#client.ontologyRid));
147
147
  }
148
148
  export const metadataCacheClient = weakMemoAsync(client => Promise.resolve(new MetadataClient(client)));
149
149
  function createObjectPropertyMapping(conjureOT) {
150
- !(conjureOT.primaryKeys.length === 1) ? invariant(false, `only one primary key supported, got ${conjureOT.primaryKeys.length}`) : void 0;
150
+ !(conjureOT.primaryKeys.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, `only one primary key supported, got ${conjureOT.primaryKeys.length}`) : invariant(false) : void 0;
151
151
  const pkRid = conjureOT.primaryKeys[0];
152
152
  const pkProperty = Object.values(conjureOT.propertyTypes).find(a => a.rid === pkRid);
153
153
  if (!pkProperty) {