@osdk/client 2.1.0-beta.2 → 2.1.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/CHANGELOG.md +39 -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 +41 -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 +0 -1
  29. package/build/browser/index.d.ts.map +1 -1
  30. package/build/browser/index.js +0 -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/object/aggregate.js +1 -1
  39. package/build/browser/object/aggregate.js.map +1 -1
  40. package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
  41. package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
  42. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
  43. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
  44. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +6 -0
  45. package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
  46. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +7 -1
  47. package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  48. package/build/browser/object/convertWireToOsdkObjects.js +2 -2
  49. package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
  50. package/build/browser/object/convertWireToOsdkObjects.test.js +10 -10
  51. package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
  52. package/build/browser/object/fetchPage.js +1 -1
  53. package/build/browser/object/fetchPage.js.map +1 -1
  54. package/build/browser/objectSet/ObjectSet.test.js +43 -47
  55. package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
  56. package/build/browser/objectSet/ObjectSetListenerWebsocket.js +62 -57
  57. package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  58. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +109 -21
  59. package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  60. package/build/browser/objectSet/createObjectSet.js +2 -5
  61. package/build/browser/objectSet/createObjectSet.js.map +1 -1
  62. package/build/browser/ontology/makeConjureContext.d.ts +1 -1
  63. package/build/browser/ontology/makeConjureContext.d.ts.map +1 -1
  64. package/build/browser/queries/applyQuery.js +1 -1
  65. package/build/browser/queries/applyQuery.js.map +1 -1
  66. package/build/browser/queries/queries.test.js +30 -2
  67. package/build/browser/queries/queries.test.js.map +1 -1
  68. package/build/browser/tsserver.js +1 -1
  69. package/build/browser/tsserver.js.map +1 -1
  70. package/build/browser/util/UserAgent.js +1 -1
  71. package/build/esm/Client.d.ts +8 -21
  72. package/build/esm/Client.d.ts.map +1 -1
  73. package/build/esm/Client.js +2 -1
  74. package/build/esm/Client.js.map +1 -1
  75. package/build/esm/MinimalClientContext.d.ts +1 -1
  76. package/build/esm/MinimalClientContext.d.ts.map +1 -1
  77. package/build/esm/__unstable/ConjureSupport.js +4 -4
  78. package/build/esm/__unstable/ConjureSupport.js.map +1 -1
  79. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
  80. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
  81. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js +1 -1
  82. package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
  83. package/build/esm/actions/applyAction.js +1 -1
  84. package/build/esm/actions/applyAction.js.map +1 -1
  85. package/build/esm/createClient.d.ts +1 -1
  86. package/build/esm/createClient.d.ts.map +1 -1
  87. package/build/esm/createClient.js +41 -19
  88. package/build/esm/createClient.js.map +1 -1
  89. package/build/esm/createGeotimeSeriesProperty.d.ts +1 -1
  90. package/build/esm/createGeotimeSeriesProperty.d.ts.map +1 -1
  91. package/build/esm/createGeotimeSeriesProperty.js +4 -1
  92. package/build/esm/createGeotimeSeriesProperty.js.map +1 -1
  93. package/build/esm/createMinimalClient.js +3 -3
  94. package/build/esm/createMinimalClient.js.map +1 -1
  95. package/build/esm/createPlatformClient.d.ts +1 -1
  96. package/build/esm/createPlatformClient.d.ts.map +1 -1
  97. package/build/esm/index.d.ts +0 -1
  98. package/build/esm/index.d.ts.map +1 -1
  99. package/build/esm/index.js +0 -1
  100. package/build/esm/index.js.map +1 -1
  101. package/build/esm/intellisense.test.js +1 -1
  102. package/build/esm/intellisense.test.js.map +1 -1
  103. package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
  104. package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
  105. package/build/esm/internal/conversions/modernToLegacyWhereClause.js +3 -3
  106. package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
  107. package/build/esm/object/aggregate.js +1 -1
  108. package/build/esm/object/aggregate.js.map +1 -1
  109. package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
  110. package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
  111. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
  112. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
  113. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +6 -0
  114. package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
  115. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +7 -1
  116. package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
  117. package/build/esm/object/convertWireToOsdkObjects.js +2 -2
  118. package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
  119. package/build/esm/object/convertWireToOsdkObjects.test.js +10 -10
  120. package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
  121. package/build/esm/object/fetchPage.js +1 -1
  122. package/build/esm/object/fetchPage.js.map +1 -1
  123. package/build/esm/objectSet/ObjectSet.test.js +43 -47
  124. package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
  125. package/build/esm/objectSet/ObjectSetListenerWebsocket.js +62 -57
  126. package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
  127. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +109 -21
  128. package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
  129. package/build/esm/objectSet/createObjectSet.js +2 -5
  130. package/build/esm/objectSet/createObjectSet.js.map +1 -1
  131. package/build/esm/ontology/makeConjureContext.d.ts +1 -1
  132. package/build/esm/ontology/makeConjureContext.d.ts.map +1 -1
  133. package/build/esm/queries/applyQuery.js +1 -1
  134. package/build/esm/queries/applyQuery.js.map +1 -1
  135. package/build/esm/queries/queries.test.js +30 -2
  136. package/build/esm/queries/queries.test.js.map +1 -1
  137. package/build/esm/tsserver.js +1 -1
  138. package/build/esm/tsserver.js.map +1 -1
  139. package/build/esm/util/UserAgent.js +1 -1
  140. package/package.json +14 -13
@@ -1 +1 @@
1
- {"version":3,"file":"createGeotimeSeriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","GeotimeSeriesPropertyImpl","triplet","client","lastFetchedValue","constructor","objectApiName","primaryKey","propertyName","getLatestValue","latestPointPromise","TimeSeriesValueBankProperties","ontologyRid","then","latestPoint","getAllValues","query","allPoints","point","asyncIterValues","push","streamPointsIterator","streamValues","range","timeseriesPoint"],"sources":["createGeotimeSeriesProperty.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 * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { asyncIterPointsHelper, getTimeRange } from \"./util/timeseriesUtils.js\";\nexport class GeotimeSeriesPropertyImpl {\n #triplet;\n #client;\n lastFetchedValue;\n constructor(client, objectApiName, primaryKey, propertyName) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n }\n async getLatestValue() {\n const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties\n .getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);\n latestPointPromise.then(latestPoint => this.lastFetchedValue = latestPoint);\n return latestPointPromise;\n }\n async getAllValues(query) {\n const allPoints = [];\n for await (const point of this.asyncIterValues(query)) {\n allPoints.push(point);\n }\n return allPoints;\n }\n async *asyncIterValues(query) {\n const streamPointsIterator = await OntologiesV2\n .TimeSeriesValueBankProperties.streamValues(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? { range: getTimeRange(query) } : {});\n for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {\n yield timeseriesPoint;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,SAASC,qBAAqB,EAAEC,YAAY,QAAQ,2BAA2B;AAC/E,OAAO,MAAMC,yBAAyB,CAAC;EACnC,CAACC,OAAO;EACR,CAACC,MAAM;EACPC,gBAAgB;EAChBC,WAAWA,CAACF,MAAM,EAAEG,aAAa,EAAEC,UAAU,EAAEC,YAAY,EAAE;IACzD,IAAI,CAAC,CAACL,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACD,OAAO,GAAG,CAACI,aAAa,EAAEC,UAAU,EAAEC,YAAY,CAAC;EAC7D;EACA,MAAMC,cAAcA,CAAA,EAAG;IACnB,MAAMC,kBAAkB,GAAGZ,YAAY,CAACa,6BAA6B,CAChEF,cAAc,CAAC,IAAI,CAAC,CAACN,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACS,WAAW,EAAE,GAAG,IAAI,CAAC,CAACV,OAAO,CAAC;IACnFQ,kBAAkB,CAACG,IAAI,CAACC,WAAW,IAAI,IAAI,CAACV,gBAAgB,GAAGU,WAAW,CAAC;IAC3E,OAAOJ,kBAAkB;EAC7B;EACA,MAAMK,YAAYA,CAACC,KAAK,EAAE;IACtB,MAAMC,SAAS,GAAG,EAAE;IACpB,WAAW,MAAMC,KAAK,IAAI,IAAI,CAACC,eAAe,CAACH,KAAK,CAAC,EAAE;MACnDC,SAAS,CAACG,IAAI,CAACF,KAAK,CAAC;IACzB;IACA,OAAOD,SAAS;EACpB;EACA,OAAOE,eAAeA,CAACH,KAAK,EAAE;IAC1B,MAAMK,oBAAoB,GAAG,MAAMvB,YAAY,CAC1Ca,6BAA6B,CAACW,YAAY,CAAC,IAAI,CAAC,CAACnB,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACS,WAAW,EAAE,GAAG,IAAI,CAAC,CAACV,OAAO,EAAEc,KAAK,GAAG;MAAEO,KAAK,EAAEvB,YAAY,CAACgB,KAAK;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5J,WAAW,MAAMQ,eAAe,IAAIzB,qBAAqB,CAACsB,oBAAoB,CAAC,EAAE;MAC7E,MAAMG,eAAe;IACzB;EACJ;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"createGeotimeSeriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","GeotimeSeriesPropertyImpl","triplet","client","lastFetchedValue","constructor","objectApiName","primaryKey","propertyName","initialValue","getLatestValue","latestPointPromise","TimeSeriesValueBankProperties","ontologyRid","then","latestPoint","getAllValues","query","allPoints","point","asyncIterValues","push","streamPointsIterator","streamValues","range","timeseriesPoint"],"sources":["createGeotimeSeriesProperty.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 * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport { asyncIterPointsHelper, getTimeRange } from \"./util/timeseriesUtils.js\";\nexport class GeotimeSeriesPropertyImpl {\n #triplet;\n #client;\n lastFetchedValue;\n constructor(client, objectApiName, primaryKey, propertyName, initialValue) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n if (initialValue != null) {\n this.lastFetchedValue = initialValue;\n }\n }\n async getLatestValue() {\n const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties\n .getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);\n latestPointPromise.then(latestPoint => this.lastFetchedValue = latestPoint);\n return latestPointPromise;\n }\n async getAllValues(query) {\n const allPoints = [];\n for await (const point of this.asyncIterValues(query)) {\n allPoints.push(point);\n }\n return allPoints;\n }\n async *asyncIterValues(query) {\n const streamPointsIterator = await OntologiesV2\n .TimeSeriesValueBankProperties.streamValues(this.#client, await this.#client.ontologyRid, ...this.#triplet, query ? { range: getTimeRange(query) } : {});\n for await (const timeseriesPoint of asyncIterPointsHelper(streamPointsIterator)) {\n yield timeseriesPoint;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,SAASC,qBAAqB,EAAEC,YAAY,QAAQ,2BAA2B;AAC/E,OAAO,MAAMC,yBAAyB,CAAC;EACnC,CAACC,OAAO;EACR,CAACC,MAAM;EACPC,gBAAgB;EAChBC,WAAWA,CAACF,MAAM,EAAEG,aAAa,EAAEC,UAAU,EAAEC,YAAY,EAAEC,YAAY,EAAE;IACvE,IAAI,CAAC,CAACN,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACD,OAAO,GAAG,CAACI,aAAa,EAAEC,UAAU,EAAEC,YAAY,CAAC;IACzD,IAAIC,YAAY,IAAI,IAAI,EAAE;MACtB,IAAI,CAACL,gBAAgB,GAAGK,YAAY;IACxC;EACJ;EACA,MAAMC,cAAcA,CAAA,EAAG;IACnB,MAAMC,kBAAkB,GAAGb,YAAY,CAACc,6BAA6B,CAChEF,cAAc,CAAC,IAAI,CAAC,CAACP,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACU,WAAW,EAAE,GAAG,IAAI,CAAC,CAACX,OAAO,CAAC;IACnFS,kBAAkB,CAACG,IAAI,CAACC,WAAW,IAAI,IAAI,CAACX,gBAAgB,GAAGW,WAAW,CAAC;IAC3E,OAAOJ,kBAAkB;EAC7B;EACA,MAAMK,YAAYA,CAACC,KAAK,EAAE;IACtB,MAAMC,SAAS,GAAG,EAAE;IACpB,WAAW,MAAMC,KAAK,IAAI,IAAI,CAACC,eAAe,CAACH,KAAK,CAAC,EAAE;MACnDC,SAAS,CAACG,IAAI,CAACF,KAAK,CAAC;IACzB;IACA,OAAOD,SAAS;EACpB;EACA,OAAOE,eAAeA,CAACH,KAAK,EAAE;IAC1B,MAAMK,oBAAoB,GAAG,MAAMxB,YAAY,CAC1Cc,6BAA6B,CAACW,YAAY,CAAC,IAAI,CAAC,CAACpB,MAAM,EAAE,MAAM,IAAI,CAAC,CAACA,MAAM,CAACU,WAAW,EAAE,GAAG,IAAI,CAAC,CAACX,OAAO,EAAEe,KAAK,GAAG;MAAEO,KAAK,EAAExB,YAAY,CAACiB,KAAK;IAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5J,WAAW,MAAMQ,eAAe,IAAI1B,qBAAqB,CAACuB,oBAAoB,CAAC,EAAE;MAC7E,MAAMG,eAAe;IACzB;EACJ;AACJ","ignoreList":[]}
@@ -19,7 +19,7 @@ import { createStandardOntologyProviderFactory } from "./ontology/StandardOntolo
19
19
  import { USER_AGENT } from "./util/UserAgent.js";
20
20
  /** @internal */
21
21
  export function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
22
- if (process?.env?.NODE_ENV !== "production") {
22
+ if (process.env.NODE_ENV !== "production") {
23
23
  try {
24
24
  new URL(baseUrl);
25
25
  } catch (e) {
@@ -35,8 +35,8 @@ export function createMinimalClient(metadata, baseUrl, tokenProvider, options =
35
35
  clientCacheKey: {},
36
36
  requestContext: {}
37
37
  };
38
- return Object.assign(minimalClient, {
38
+ return Object.freeze(Object.assign(minimalClient, {
39
39
  ontologyProvider: createStandardOntologyProviderFactory(options)(minimalClient)
40
- });
40
+ }));
41
41
  }
42
42
  //# sourceMappingURL=createMinimalClient.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","minimalClient","ontologyRid","logger","clientCacheKey","requestContext","Object","assign","ontologyProvider"],"sources":["createMinimalClient.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 { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createStandardOntologyProviderFactory, } from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n/** @internal */\nexport function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {\n if (process?.env?.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n }\n catch (e) {\n const hint = !baseUrl.startsWith(\"http://\") || !baseUrl.startsWith(\"https://\")\n ? \". Did you forget to add 'http://' or 'https://'?\"\n : \"\";\n throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);\n }\n }\n const minimalClient = {\n ...createSharedClientContext(baseUrl, tokenProvider, USER_AGENT, fetchFn),\n objectSetFactory,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {},\n requestContext: {},\n };\n return Object.assign(minimalClient, {\n ontologyProvider: createStandardOntologyProviderFactory(options)(minimalClient),\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAyB,QAAQ,0BAA0B;AACpE,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,qCAAqC,QAAS,wCAAwC;AAC/F,SAASC,UAAU,QAAQ,qBAAqB;AAChD;AACA,OAAO,SAASC,mBAAmBA,CAACC,QAAQ,EAAEC,OAAO,EAAEC,aAAa,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAEC,OAAO,GAAGC,MAAM,CAACC,KAAK,EAAEC,gBAAgB,GAAGX,eAAe,EAAE;EAC5I,IAAIY,OAAO,EAAEC,GAAG,EAAEC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAI;MACA,IAAIC,GAAG,CAACV,OAAO,CAAC;IACpB,CAAC,CACD,OAAOW,CAAC,EAAE;MACN,MAAMC,IAAI,GAAG,CAACZ,OAAO,CAACa,UAAU,CAAC,SAAS,CAAC,IAAI,CAACb,OAAO,CAACa,UAAU,CAAC,UAAU,CAAC,GACxE,kDAAkD,GAClD,EAAE;MACR,MAAM,IAAIC,KAAK,CAAC,sBAAsBd,OAAO,GAAGY,IAAI,EAAE,CAAC;IAC3D;EACJ;EACA,MAAMG,aAAa,GAAG;IAClB,GAAGrB,yBAAyB,CAACM,OAAO,EAAEC,aAAa,EAAEJ,UAAU,EAAEM,OAAO,CAAC;IACzEG,gBAAgB;IAChBU,WAAW,EAAEjB,QAAQ,CAACiB,WAAW;IACjCC,MAAM,EAAEf,OAAO,CAACe,MAAM;IACtBC,cAAc,EAAE,CAAC,CAAC;IAClBC,cAAc,EAAE,CAAC;EACrB,CAAC;EACD,OAAOC,MAAM,CAACC,MAAM,CAACN,aAAa,EAAE;IAChCO,gBAAgB,EAAE1B,qCAAqC,CAACM,OAAO,CAAC,CAACa,aAAa;EAClF,CAAC,CAAC;AACN","ignoreList":[]}
1
+ {"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","minimalClient","ontologyRid","logger","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.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 { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { createStandardOntologyProviderFactory, } from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n/** @internal */\nexport function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n }\n catch (e) {\n const hint = !baseUrl.startsWith(\"http://\") || !baseUrl.startsWith(\"https://\")\n ? \". Did you forget to add 'http://' or 'https://'?\"\n : \"\";\n throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);\n }\n }\n const minimalClient = {\n ...createSharedClientContext(baseUrl, tokenProvider, USER_AGENT, fetchFn),\n objectSetFactory,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {},\n requestContext: {},\n };\n return Object.freeze(Object.assign(minimalClient, {\n ontologyProvider: createStandardOntologyProviderFactory(options)(minimalClient),\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,yBAAyB,QAAQ,0BAA0B;AACpE,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,qCAAqC,QAAS,wCAAwC;AAC/F,SAASC,UAAU,QAAQ,qBAAqB;AAChD;AACA,OAAO,SAASC,mBAAmBA,CAACC,QAAQ,EAAEC,OAAO,EAAEC,aAAa,EAAEC,OAAO,GAAG,CAAC,CAAC,EAAEC,OAAO,GAAGC,MAAM,CAACC,KAAK,EAAEC,gBAAgB,GAAGX,eAAe,EAAE;EAC5I,IAAIY,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACvC,IAAI;MACA,IAAIC,GAAG,CAACV,OAAO,CAAC;IACpB,CAAC,CACD,OAAOW,CAAC,EAAE;MACN,MAAMC,IAAI,GAAG,CAACZ,OAAO,CAACa,UAAU,CAAC,SAAS,CAAC,IAAI,CAACb,OAAO,CAACa,UAAU,CAAC,UAAU,CAAC,GACxE,kDAAkD,GAClD,EAAE;MACR,MAAM,IAAIC,KAAK,CAAC,sBAAsBd,OAAO,GAAGY,IAAI,EAAE,CAAC;IAC3D;EACJ;EACA,MAAMG,aAAa,GAAG;IAClB,GAAGrB,yBAAyB,CAACM,OAAO,EAAEC,aAAa,EAAEJ,UAAU,EAAEM,OAAO,CAAC;IACzEG,gBAAgB;IAChBU,WAAW,EAAEjB,QAAQ,CAACiB,WAAW;IACjCC,MAAM,EAAEf,OAAO,CAACe,MAAM;IACtBC,cAAc,EAAE,CAAC,CAAC;IAClBC,cAAc,EAAE,CAAC;EACrB,CAAC;EACD,OAAOC,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,MAAM,CAACP,aAAa,EAAE;IAC9CQ,gBAAgB,EAAE3B,qCAAqC,CAACM,OAAO,CAAC,CAACa,aAAa;EAClF,CAAC,CAAC,CAAC;AACP","ignoreList":[]}
@@ -1,4 +1,4 @@
1
- import type { SharedClientContext } from "@osdk/shared.client";
1
+ import type { SharedClientContext } from "@osdk/shared.client2";
2
2
  export interface PlatformClient extends SharedClientContext {
3
3
  }
4
4
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"createPlatformClient.d.ts","sourceRoot":"","sources":["../../src/createPlatformClient.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAI/D,MAAM,WAAW,cAAe,SAAQ,mBAAmB;CAAG;AAE9D;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACpC,OAAO,GAAE,SAAqB,EAC9B,OAAO,GAAE,OAAO,UAAU,CAAC,KAAa,GACvC,cAAc,CAOhB"}
1
+ {"version":3,"file":"createPlatformClient.d.ts","sourceRoot":"","sources":["../../src/createPlatformClient.ts"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAGhE,MAAM,WAAW,cAAe,SAAQ,mBAAmB;CAAG;AAE9D;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,MAAM,EACf,aAAa,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,EACpC,OAAO,GAAE,SAAqB,EAC9B,OAAO,GAAE,OAAO,UAAU,CAAC,KAAa,GACvC,cAAc,CAOhB"}
@@ -3,7 +3,6 @@ export { isOk } from "@osdk/api";
3
3
  export { PalantirApiError } from "@osdk/shared.net.errors";
4
4
  export { ActionValidationError } from "./actions/ActionValidationError.js";
5
5
  export type { Client } from "./Client.js";
6
- export { createAttachmentFromRid } from "./createAttachmentFromRid.js";
7
6
  export { createClient } from "./createClient.js";
8
7
  export { createPlatformClient } from "./createPlatformClient.js";
9
8
  export type { PlatformClient } from "./createPlatformClient.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,YAAY,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,SAAS,EACT,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAgBA,YAAY,EACV,kBAAkB,EAClB,0BAA0B,EAC1B,wBAAwB,EACxB,kBAAkB,EAClB,uBAAuB,EACvB,SAAS,EACT,IAAI,EACJ,UAAU,EACV,UAAU,EACV,MAAM,EACN,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AACjE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAC;AACtE,YAAY,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
@@ -16,7 +16,6 @@
16
16
  export { isOk } from "@osdk/api";
17
17
  export { PalantirApiError } from "@osdk/shared.net.errors";
18
18
  export { ActionValidationError } from "./actions/ActionValidationError.js";
19
- export { createAttachmentFromRid } from "./createAttachmentFromRid.js";
20
19
  export { createClient } from "./createClient.js";
21
20
  export { createPlatformClient } from "./createPlatformClient.js";
22
21
  export { createAttachmentUpload } from "./object/AttachmentUpload.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createAttachmentFromRid","createClient","createPlatformClient","createAttachmentUpload"],"sources":["index.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 { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport { createAttachmentFromRid } from \"./createAttachmentFromRid.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,WAAW;AAChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAC1E,SAASC,uBAAuB,QAAQ,8BAA8B;AACtE,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,sBAAsB,QAAQ,8BAA8B","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload"],"sources":["index.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 { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,WAAW;AAChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAC1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAC1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,sBAAsB,QAAQ,8BAA8B","ignoreList":[]}
@@ -52,7 +52,7 @@ describe("intellisense", () => {
52
52
  const clientsPackageJson = findUpSync("package.json", {
53
53
  cwd: import.meta.url
54
54
  });
55
- !(clientsPackageJson != null) ? invariant(false) : void 0;
55
+ !(clientsPackageJson != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
56
56
  packagesDir = path.join(path.dirname(clientsPackageJson), "..");
57
57
  clientPackagePath = path.join(packagesDir, "client");
58
58
  });
@@ -1 +1 @@
1
- {"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","url","join","dirname","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot"],"sources":["intellisense.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 { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport { afterEach, beforeAll, beforeEach, describe, expect, it, vi, } from \"vitest\";\nimport { startTsServer } from \"./tsserver.js\";\n// it needs to be hoisted because its referenced from our mocked WebSocket\n// which must be hoisted to work\nconst rootLogger = await vi.hoisted(async () => {\n const pino = (await import(\"pino\")).pino;\n const pinoPretty = await import(\"pino-pretty\");\n const { EventEmitter } = await import(\"node:events\");\n class PinoConsoleLogDestination extends EventEmitter {\n write(a) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\")\n a = a.slice(0, -1);\n // This lets the test framework aggregate the logs per test, whereas direct to stdout does not\n console.log(a);\n }\n }\n return Promise.resolve(pino({ level: \"info\" }, (pinoPretty.build)({\n sync: true,\n timestampKey: undefined,\n errorLikeObjectKeys: [\"error\", \"err\", \"exception\"],\n errorProps: \"stack,cause,properties\",\n ignore: \"time,hostname,pid\",\n destination: new PinoConsoleLogDestination(),\n })));\n});\ndescribe(\"intellisense\", () => {\n let packagesDir;\n let clientPackagePath;\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.url,\n });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(path.dirname(clientsPackageJson), \"..\");\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n let tsServer;\n let intellisenseFilePath;\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(clientPackagePath, \"src\", \"intellisense.test.helpers\", `${a.task.name}.ts`);\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined;\n });\n it(\"callsQueryAcceptsObject\", { timeout: 20_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(`\"(no ontology metadata)\"`);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,UAAU,QAAQ,SAAS;AACpC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,KAAKC,EAAE,MAAM,YAAY;AAChC,SAASC,SAAS,EAAEC,SAAS,EAAEC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAS,QAAQ;AACpF,SAASC,aAAa,QAAQ,eAAe;AAC7C;AACA;AACA,MAAMC,UAAU,GAAG,MAAMF,EAAE,CAACG,OAAO,CAAC,YAAY;EAC5C,MAAMC,IAAI,GAAG,CAAC,MAAM,MAAM,CAAC,MAAM,CAAC,EAAEA,IAAI;EACxC,MAAMC,UAAU,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAC9C,MAAM;IAAEC;EAAa,CAAC,GAAG,MAAM,MAAM,CAAC,aAAa,CAAC;EAUpD,OAAOC,OAAO,CAACC,OAAO,CAACJ,IAAI,CAAC;IAAEK,KAAK,EAAE;EAAO,CAAC,EAAGJ,UAAU,CAACK,KAAK,CAAE;IAC9DC,IAAI,EAAE,IAAI;IACVC,YAAY,EAAEC,SAAS;IACvBC,mBAAmB,EAAE,CAAC,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC;IAClDC,UAAU,EAAE,wBAAwB;IACpCC,MAAM,EAAE,mBAAmB;IAC3BC,WAAW,EAAE,IAfjB,cAAwCX,YAAY,CAAC;MACjDY,KAAKA,CAACC,CAAC,EAAE;QACL;QACA,IAAIA,CAAC,CAACC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI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AAGpB,SAAS;EACxB,CAAC,CAAC;EACFd,EAAE,CAAC,yBAAyB,EAAE;IAAE4C,OAAO,EAAE;EAAO,CAAC,EAAE,YAAY;IAC3D,MAAM;MAAEC;IAAK,CAAC,GAAG,MAAMX,QAAQ,CAACY,oBAAoB,CAAC;MACjDJ,IAAI,EAAEP,oBAAoB;MAC1BY,IAAI,EAAE,EAAE;MACRC,MAAM,EAAE;IACZ,CAAC,CAAC;IACFjD,MAAM,CAAC8C,IAAI,CAACI,IAAI,EAAEC,aAAa,CAAC,CAACC,qBAAqB,CAAC,0BAA0B,CAAC;EACtF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","url","process","env","NODE_ENV","join","dirname","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot"],"sources":["intellisense.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 { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport { afterEach, beforeAll, beforeEach, describe, expect, it, vi, } from \"vitest\";\nimport { startTsServer } from \"./tsserver.js\";\n// it needs to be hoisted because its referenced from our mocked WebSocket\n// which must be hoisted to work\nconst rootLogger = await vi.hoisted(async () => {\n const pino = (await import(\"pino\")).pino;\n const pinoPretty = await import(\"pino-pretty\");\n const { EventEmitter } = await import(\"node:events\");\n class PinoConsoleLogDestination extends EventEmitter {\n write(a) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\")\n a = a.slice(0, -1);\n // This lets the test framework aggregate the logs per test, whereas direct to stdout does not\n console.log(a);\n }\n }\n return Promise.resolve(pino({ level: \"info\" }, (pinoPretty.build)({\n sync: true,\n timestampKey: undefined,\n errorLikeObjectKeys: [\"error\", \"err\", \"exception\"],\n errorProps: \"stack,cause,properties\",\n ignore: \"time,hostname,pid\",\n destination: new PinoConsoleLogDestination(),\n })));\n});\ndescribe(\"intellisense\", () => {\n let packagesDir;\n let clientPackagePath;\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.url,\n });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(path.dirname(clientsPackageJson), \"..\");\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n let tsServer;\n let intellisenseFilePath;\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(clientPackagePath, \"src\", \"intellisense.test.helpers\", `${a.task.name}.ts`);\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined;\n });\n it(\"callsQueryAcceptsObject\", { timeout: 20_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(`\"(no ontology metadata)\"`);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA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ACY,oBAAoB,CAAC;MACjDJ,IAAI,EAAEP,oBAAoB;MAC1BY,IAAI,EAAE,EAAE;MACRC,MAAM,EAAE;IACZ,CAAC,CAAC;IACFpD,MAAM,CAACiD,IAAI,CAACI,IAAI,EAAEC,aAAa,CAAC,CAACC,qBAAqB,CAAC,0BAA0B,CAAC;EACtF,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
@@ -21,7 +21,7 @@ export function legacyToModernSingleAggregationResult(entry) {
21
21
  if (parts[0] === "count") {
22
22
  return accumulator;
23
23
  }
24
- !(parts.length === 2) ? invariant(false, "assumed we were getting a `${key}.${type}`") : void 0;
24
+ !(parts.length === 2) ? process.env.NODE_ENV !== "production" ? invariant(false, "assumed we were getting a `${key}.${type}`") : invariant(false) : void 0;
25
25
  const property = parts[0];
26
26
  const metricType = parts[1];
27
27
  if (!(property in accumulator)) {
@@ -1 +1 @@
1
- {"version":3,"file":"legacyToModernSingleAggregationResult.js","names":["invariant","legacyToModernSingleAggregationResult","entry","metrics","reduce","accumulator","curValue","parts","name","split","length","property","metricType","value"],"sources":["legacyToModernSingleAggregationResult.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 invariant from \"tiny-invariant\";\n/** @internal */\nexport function legacyToModernSingleAggregationResult(entry) {\n return entry.metrics.reduce((accumulator, curValue) => {\n const parts = curValue.name.split(\".\");\n if (parts[0] === \"count\") {\n return accumulator;\n }\n invariant(parts.length === 2, \"assumed we were getting a `${key}.${type}`\");\n const property = parts[0];\n const metricType = parts[1];\n if (!(property in accumulator)) {\n accumulator[property] = {}; // fixme?\n }\n accumulator[property][metricType] = curValue.value; // fixme?\n return accumulator;\n }, {});\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC;AACA,OAAO,SAASC,qCAAqCA,CAACC,KAAK,EAAE;EACzD,OAAOA,KAAK,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,WAAW,EAAEC,QAAQ,KAAK;IACnD,MAAMC,KAAK,GAAGD,QAAQ,CAACE,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC;IACtC,IAAIF,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOF,WAAW;IACtB;IACA,EAAUE,KAAK,CAACG,MAAM,KAAK,CAAC,IAA5BV,SAAS,QAAqB,4CAA4C;IAC1E,MAAMW,QAAQ,GAAGJ,KAAK,CAAC,CAAC,CAAC;IACzB,MAAMK,UAAU,GAAGL,KAAK,CAAC,CAAC,CAAC;IAC3B,IAAI,EAAEI,QAAQ,IAAIN,WAAW,CAAC,EAAE;MAC5BA,WAAW,CAACM,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChC;IACAN,WAAW,CAACM,QAAQ,CAAC,CAACC,UAAU,CAAC,GAAGN,QAAQ,CAACO,KAAK,CAAC,CAAC;IACpD,OAAOR,WAAW;EACtB,CAAC,EAAE,CAAC,CAAC,CAAC;AACV","ignoreList":[]}
1
+ {"version":3,"file":"legacyToModernSingleAggregationResult.js","names":["invariant","legacyToModernSingleAggregationResult","entry","metrics","reduce","accumulator","curValue","parts","name","split","length","process","env","NODE_ENV","property","metricType","value"],"sources":["legacyToModernSingleAggregationResult.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 invariant from \"tiny-invariant\";\n/** @internal */\nexport function legacyToModernSingleAggregationResult(entry) {\n return entry.metrics.reduce((accumulator, curValue) => {\n const parts = curValue.name.split(\".\");\n if (parts[0] === \"count\") {\n return accumulator;\n }\n invariant(parts.length === 2, \"assumed we were getting a `${key}.${type}`\");\n const property = parts[0];\n const metricType = parts[1];\n if (!(property in accumulator)) {\n accumulator[property] = {}; // fixme?\n }\n accumulator[property][metricType] = curValue.value; // fixme?\n return accumulator;\n }, {});\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC;AACA,OAAO,SAASC,qCAAqCA,CAACC,KAAK,EAAE;EACzD,OAAOA,KAAK,CAACC,OAAO,CAACC,MAAM,CAAC,CAACC,WAAW,EAAEC,QAAQ,KAAK;IACnD,MAAMC,KAAK,GAAGD,QAAQ,CAACE,IAAI,CAACC,KAAK,CAAC,GAAG,CAAC;IACtC,IAAIF,KAAK,CAAC,CAAC,CAAC,KAAK,OAAO,EAAE;MACtB,OAAOF,WAAW;IACtB;IACA,EAAUE,KAAK,CAACG,MAAM,KAAK,CAAC,IAAAC,OAAA,CAAAC,GAAA,CAAAC,QAAA,oBAA5Bb,SAAS,QAAqB,4CAA4C,IAA1EA,SAAS;IACT,MAAMc,QAAQ,GAAGP,KAAK,CAAC,CAAC,CAAC;IACzB,MAAMQ,UAAU,GAAGR,KAAK,CAAC,CAAC,CAAC;IAC3B,IAAI,EAAEO,QAAQ,IAAIT,WAAW,CAAC,EAAE;MAC5BA,WAAW,CAACS,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IAChC;IACAT,WAAW,CAACS,QAAQ,CAAC,CAACC,UAAU,CAAC,GAAGT,QAAQ,CAACU,KAAK,CAAC,CAAC;IACpD,OAAOX,WAAW;EACtB,CAAC,EAAE,CAAC,CAAC,CAAC;AACV","ignoreList":[]}
@@ -74,7 +74,7 @@ function makeGeoFilterPolygon(field, coordinates, filterType) {
74
74
  };
75
75
  }
76
76
  function handleWherePair([field, filter], objectOrInterface) {
77
- !(filter != null) ? invariant(false, "Defined key values are only allowed when they are not undefined.") : void 0;
77
+ !(filter != null) ? process.env.NODE_ENV !== "production" ? invariant(false, "Defined key values are only allowed when they are not undefined.") : invariant(false) : void 0;
78
78
  if (typeof filter === "string" || typeof filter === "number" || typeof filter === "boolean") {
79
79
  if (objectOrInterface.type === "interface") {
80
80
  const [objApiNamespace] = extractNamespace(objectOrInterface.apiName);
@@ -93,13 +93,13 @@ function handleWherePair([field, filter], objectOrInterface) {
93
93
  // If any of the keys start with `$` then they must be the only one.
94
94
  // e.g. `where({ name: { $eq: "foo", $ne: "bar" } })` is invalid currently
95
95
  const hasDollarSign = keysOfFilter.some(key => key.startsWith("$"));
96
- !(!hasDollarSign || keysOfFilter.length === 1) ? invariant(false, "WhereClause Filter with multiple clauses isn't allowed") : void 0;
96
+ !(!hasDollarSign || keysOfFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "WhereClause Filter with multiple clauses isn't allowed") : invariant(false) : void 0;
97
97
  if (!hasDollarSign) {
98
98
  // Future case for structs
99
99
  throw new Error(`Unsupported filter. Did you forget to use a $-prefixed filter? (${JSON.stringify(filter)})`);
100
100
  }
101
101
  const firstKey = keysOfFilter[0];
102
- !(filter[firstKey] != null) ? invariant(false) : void 0;
102
+ !(filter[firstKey] != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
103
103
  if (firstKey === "$ne") {
104
104
  return {
105
105
  type: "not",
@@ -1 +1 @@
1
- {"version":3,"file":"modernToLegacyWhereClause.js","names":["DistanceUnitMapping","invariant","extractNamespace","fqApiName","last","lastIndexOf","undefined","slice","modernToLegacyWhereClause","whereClause","objectOrInterface","type","value","$and","map","clause","$or","$not","parts","Object","entries","length","handleWherePair","v","makeGeoFilterBbox","field","bbox","filterType","topLeft","coordinates","bottomRight","makeGeoFilterPolygon","filter","objApiNamespace","apiName","fieldApiNamespace","fieldShortName","keysOfFilter","keys","hasDollarSign","some","key","startsWith","Error","JSON","stringify","firstKey","withinBody","Array","isArray","$bbox","$distance","$of","center","distance","unit","$polygon","intersectsBody","substring"],"sources":["modernToLegacyWhereClause.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 { DistanceUnitMapping } from \"@osdk/api\";\nimport invariant from \"tiny-invariant\";\nexport function extractNamespace(fqApiName) {\n const last = fqApiName.lastIndexOf(\".\");\n if (last === -1)\n return [undefined, fqApiName];\n return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];\n}\n/** @internal */\nexport function modernToLegacyWhereClause(whereClause, objectOrInterface) {\n if (\"$and\" in whereClause) {\n return {\n type: \"and\",\n value: whereClause.$and.map((clause) => modernToLegacyWhereClause(clause, objectOrInterface)),\n };\n }\n else if (\"$or\" in whereClause) {\n return {\n type: \"or\",\n value: whereClause.$or.map((clause) => modernToLegacyWhereClause(clause, objectOrInterface)),\n };\n }\n else if (\"$not\" in whereClause) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(whereClause.$not, objectOrInterface),\n };\n }\n const parts = Object.entries(whereClause);\n if (parts.length === 1) {\n return handleWherePair(parts[0], objectOrInterface);\n }\n return {\n type: \"and\",\n value: parts.map(v => handleWherePair(v, objectOrInterface)),\n };\n}\nfunction makeGeoFilterBbox(field, bbox, filterType) {\n return {\n type: filterType === \"$within\"\n ? \"withinBoundingBox\"\n : \"intersectsBoundingBox\",\n field,\n value: {\n topLeft: {\n type: \"Point\",\n coordinates: [bbox[0], bbox[3]],\n },\n bottomRight: {\n type: \"Point\",\n coordinates: [bbox[2], bbox[1]],\n },\n },\n };\n}\nfunction makeGeoFilterPolygon(field, coordinates, filterType) {\n return {\n type: filterType,\n field,\n value: {\n type: \"Polygon\",\n coordinates,\n },\n };\n}\nfunction handleWherePair([field, filter], objectOrInterface) {\n invariant(filter != null, \"Defined key values are only allowed when they are not undefined.\");\n if (typeof filter === \"string\" || typeof filter === \"number\"\n || typeof filter === \"boolean\") {\n if (objectOrInterface.type === \"interface\") {\n const [objApiNamespace] = extractNamespace(objectOrInterface.apiName);\n const [fieldApiNamespace, fieldShortName] = extractNamespace(field);\n if (fieldApiNamespace == null && objApiNamespace != null) {\n field = `${objApiNamespace}.${fieldShortName}`;\n }\n }\n return {\n type: \"eq\",\n field,\n value: filter,\n };\n }\n const keysOfFilter = Object.keys(filter);\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some((key) => key.startsWith(\"$\"));\n invariant(!hasDollarSign\n || keysOfFilter.length === 1, \"WhereClause Filter with multiple clauses isn't allowed\");\n if (!hasDollarSign) {\n // Future case for structs\n throw new Error(`Unsupported filter. Did you forget to use a $-prefixed filter? (${JSON.stringify(filter)})`);\n }\n const firstKey = keysOfFilter[0];\n invariant(filter[firstKey] != null);\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n field,\n value: filter[firstKey],\n },\n };\n }\n if (firstKey === \"$within\") {\n const withinBody = filter[firstKey];\n if (Array.isArray(withinBody)) {\n return makeGeoFilterBbox(field, withinBody, firstKey);\n }\n else if (\"$bbox\" in withinBody && withinBody.$bbox != null) {\n return makeGeoFilterBbox(field, withinBody.$bbox, firstKey);\n }\n else if ((\"$distance\" in withinBody && \"$of\" in withinBody)\n && withinBody.$distance != null\n && withinBody.$of != null) {\n return {\n type: \"withinDistanceOf\",\n field,\n value: {\n center: Array.isArray(withinBody.$of)\n ? {\n type: \"Point\",\n coordinates: withinBody.$of,\n }\n : withinBody.$of,\n distance: {\n value: withinBody.$distance[0],\n unit: DistanceUnitMapping[withinBody.$distance[1]],\n },\n },\n };\n }\n else {\n const coordinates = (\"$polygon\" in withinBody)\n ? withinBody.$polygon\n : withinBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"withinPolygon\");\n }\n }\n if (firstKey === \"$intersects\") {\n const intersectsBody = filter[firstKey];\n if (Array.isArray(intersectsBody)) {\n return makeGeoFilterBbox(field, intersectsBody, firstKey);\n }\n else if (\"$bbox\" in intersectsBody && intersectsBody.$bbox != null) {\n return makeGeoFilterBbox(field, intersectsBody.$bbox, firstKey);\n }\n else {\n const coordinates = (\"$polygon\" in intersectsBody)\n ? intersectsBody.$polygon\n : intersectsBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"intersectsPolygon\");\n }\n }\n return {\n type: firstKey.substring(1),\n field,\n value: filter[firstKey],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAmB,QAAQ,WAAW;AAC/C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,SAASC,gBAAgBA,CAACC,SAAS,EAAE;EACxC,MAAMC,IAAI,GAAGD,SAAS,CAACE,WAAW,CAAC,GAAG,CAAC;EACvC,IAAID,IAAI,KAAK,CAAC,CAAC,EACX,OAAO,CAACE,SAAS,EAAEH,SAAS,CAAC;EACjC,OAAO,CAACA,SAAS,CAACI,KAAK,CAAC,CAAC,EAAEH,IAAI,CAAC,EAAED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EAAEoB,MAAM,CAACc,QAAQ;EAC1B,CAAC;AACL","ignoreList":[]}
1
+ {"version":3,"file":"modernToLegacyWhereClause.js","names":["DistanceUnitMapping","invariant","extractNamespace","fqApiName","last","lastIndexOf","undefined","slice","modernToLegacyWhereClause","whereClause","objectOrInterface","type","value","$and","map","clause","$or","$not","parts","Object","entries","length","handleWherePair","v","makeGeoFilterBbox","field","bbox","filterType","topLeft","coordinates","bottomRight","makeGeoFilterPolygon","filter","process","env","NODE_ENV","objApiNamespace","apiName","fieldApiNamespace","fieldShortName","keysOfFilter","keys","hasDollarSign","some","key","startsWith","Error","JSON","stringify","firstKey","withinBody","Array","isArray","$bbox","$distance","$of","center","distance","unit","$polygon","intersectsBody","substring"],"sources":["modernToLegacyWhereClause.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 { DistanceUnitMapping } from \"@osdk/api\";\nimport invariant from \"tiny-invariant\";\nexport function extractNamespace(fqApiName) {\n const last = fqApiName.lastIndexOf(\".\");\n if (last === -1)\n return [undefined, fqApiName];\n return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];\n}\n/** @internal */\nexport function modernToLegacyWhereClause(whereClause, objectOrInterface) {\n if (\"$and\" in whereClause) {\n return {\n type: \"and\",\n value: whereClause.$and.map((clause) => modernToLegacyWhereClause(clause, objectOrInterface)),\n };\n }\n else if (\"$or\" in whereClause) {\n return {\n type: \"or\",\n value: whereClause.$or.map((clause) => modernToLegacyWhereClause(clause, objectOrInterface)),\n };\n }\n else if (\"$not\" in whereClause) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(whereClause.$not, objectOrInterface),\n };\n }\n const parts = Object.entries(whereClause);\n if (parts.length === 1) {\n return handleWherePair(parts[0], objectOrInterface);\n }\n return {\n type: \"and\",\n value: parts.map(v => handleWherePair(v, objectOrInterface)),\n };\n}\nfunction makeGeoFilterBbox(field, bbox, filterType) {\n return {\n type: filterType === \"$within\"\n ? \"withinBoundingBox\"\n : \"intersectsBoundingBox\",\n field,\n value: {\n topLeft: {\n type: \"Point\",\n coordinates: [bbox[0], bbox[3]],\n },\n bottomRight: {\n type: \"Point\",\n coordinates: [bbox[2], bbox[1]],\n },\n },\n };\n}\nfunction makeGeoFilterPolygon(field, coordinates, filterType) {\n return {\n type: filterType,\n field,\n value: {\n type: \"Polygon\",\n coordinates,\n },\n };\n}\nfunction handleWherePair([field, filter], objectOrInterface) {\n invariant(filter != null, \"Defined key values are only allowed when they are not undefined.\");\n if (typeof filter === \"string\" || typeof filter === \"number\"\n || typeof filter === \"boolean\") {\n if (objectOrInterface.type === \"interface\") {\n const [objApiNamespace] = extractNamespace(objectOrInterface.apiName);\n const [fieldApiNamespace, fieldShortName] = extractNamespace(field);\n if (fieldApiNamespace == null && objApiNamespace != null) {\n field = `${objApiNamespace}.${fieldShortName}`;\n }\n }\n return {\n type: \"eq\",\n field,\n value: filter,\n };\n }\n const keysOfFilter = Object.keys(filter);\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some((key) => key.startsWith(\"$\"));\n invariant(!hasDollarSign\n || keysOfFilter.length === 1, \"WhereClause Filter with multiple clauses isn't allowed\");\n if (!hasDollarSign) {\n // Future case for structs\n throw new Error(`Unsupported filter. Did you forget to use a $-prefixed filter? (${JSON.stringify(filter)})`);\n }\n const firstKey = keysOfFilter[0];\n invariant(filter[firstKey] != null);\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n field,\n value: filter[firstKey],\n },\n };\n }\n if (firstKey === \"$within\") {\n const withinBody = filter[firstKey];\n if (Array.isArray(withinBody)) {\n return makeGeoFilterBbox(field, withinBody, firstKey);\n }\n else if (\"$bbox\" in withinBody && withinBody.$bbox != null) {\n return makeGeoFilterBbox(field, withinBody.$bbox, firstKey);\n }\n else if ((\"$distance\" in withinBody && \"$of\" in withinBody)\n && withinBody.$distance != null\n && withinBody.$of != null) {\n return {\n type: \"withinDistanceOf\",\n field,\n value: {\n center: Array.isArray(withinBody.$of)\n ? {\n type: \"Point\",\n coordinates: withinBody.$of,\n }\n : withinBody.$of,\n distance: {\n value: withinBody.$distance[0],\n unit: DistanceUnitMapping[withinBody.$distance[1]],\n },\n },\n };\n }\n else {\n const coordinates = (\"$polygon\" in withinBody)\n ? withinBody.$polygon\n : withinBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"withinPolygon\");\n }\n }\n if (firstKey === \"$intersects\") {\n const intersectsBody = filter[firstKey];\n if (Array.isArray(intersectsBody)) {\n return makeGeoFilterBbox(field, intersectsBody, firstKey);\n }\n else if (\"$bbox\" in intersectsBody && intersectsBody.$bbox != null) {\n return makeGeoFilterBbox(field, intersectsBody.$bbox, firstKey);\n }\n else {\n const coordinates = (\"$polygon\" in intersectsBody)\n ? intersectsBody.$polygon\n : intersectsBody.coordinates;\n return makeGeoFilterPolygon(field, coordinates, \"intersectsPolygon\");\n }\n }\n return {\n type: firstKey.substring(1),\n field,\n value: filter[firstKey],\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,mBAAmB,QAAQ,WAAW;AAC/C,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,SAASC,gBAAgBA,CAACC,SAAS,EAAE;EACxC,MAAMC,IAAI,GAAGD,SAAS,CAACE,WAAW,CAAC,GAAG,CAAC;EACvC,IAAID,IAAI,KAAK,CAAC,CAAC,EACX,OA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MAAMpB,WAAW,GAAI,UAAU,IAAI+B,cAAc,GAC3CA,cAAc,CAACD,QAAQ,GACvBC,cAAc,CAAC/B,WAAW;MAChC,OAAOE,oBAAoB,CAACN,KAAK,EAAEI,WAAW,EAAE,mBAAmB,CAAC;IACxE;EACJ;EACA,OAAO;IACHlB,IAAI,EAAEsC,QAAQ,CAACY,SAAS,CAAC,CAAC,CAAC;IAC3BpC,KAAK;IACLb,KAAK,EAAEoB,MAAM,CAACiB,QAAQ;EAC1B,CAAC;AACL","ignoreList":[]}
@@ -42,7 +42,7 @@ export async function aggregate(clientCtx, objectType, objectSet = {
42
42
  aggregation: body.aggregation
43
43
  });
44
44
  if (!req.$groupBy) {
45
- !(result.data.length === 1) ? invariant(false, "no group by clause should mean only one data result") : void 0;
45
+ !(result.data.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "no group by clause should mean only one data result") : invariant(false) : void 0;
46
46
  return {
47
47
  ...aggregationToCountResult(result.data[0]),
48
48
  ...legacyToModernSingleAggregationResult(result.data[0])
@@ -1 +1 @@
1
- {"version":3,"file":"aggregate.js","names":["OntologiesV2","invariant","legacyToModernSingleAggregationResult","modernToLegacyAggregationClause","modernToLegacyGroupByClause","modernToLegacyWhereClause","addUserAgentAndRequestContextHeaders","aggregate","clientCtx","objectType","objectSet","type","req","body","aggregation","$select","groupBy","where","undefined","$groupBy","$where","result","OntologyObjectSets","ontologyRid","data","length","aggregationToCountResult","ret","map","entry","$group","group","aggregateResult","metrics","name","$count","value"],"sources":["aggregate.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 * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport invariant from \"tiny-invariant\";\nimport { legacyToModernSingleAggregationResult } from \"../internal/conversions/legacyToModernSingleAggregationResult.js\";\nimport { modernToLegacyAggregationClause } from \"../internal/conversions/modernToLegacyAggregationClause.js\";\nimport { modernToLegacyGroupByClause } from \"../internal/conversions/modernToLegacyGroupByClause.js\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\n/** @internal */\nexport async function aggregate(clientCtx, objectType, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}, req) {\n const body = {\n aggregation: modernToLegacyAggregationClause(req.$select),\n groupBy: [],\n where: undefined,\n };\n if (req.$groupBy) {\n body.groupBy = modernToLegacyGroupByClause(req.$groupBy);\n }\n if (req.$where) {\n body.where = modernToLegacyWhereClause(req.$where, objectType);\n }\n const result = await OntologiesV2.OntologyObjectSets.aggregate(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {\n objectSet,\n groupBy: body.groupBy,\n aggregation: body.aggregation,\n });\n if (!req.$groupBy) {\n invariant(result.data.length === 1, \"no group by clause should mean only one data result\");\n return {\n ...aggregationToCountResult(result.data[0]),\n ...legacyToModernSingleAggregationResult(result.data[0]),\n };\n }\n const ret = result.data\n .map((entry) => {\n return {\n $group: entry.group,\n ...aggregationToCountResult(entry),\n ...legacyToModernSingleAggregationResult(entry),\n };\n }); // fixme\n return ret; // FIXME\n}\nfunction aggregationToCountResult(entry) {\n for (const aggregateResult of entry.metrics) {\n if (aggregateResult.name === \"count\") {\n return { $count: aggregateResult.value };\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AAC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,GAAGtB,qCAAqC,CAACmB,MAAM,CAACG,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;EACL;EACA,MAAMG,GAAG,GAAGN,MAAM,CAACG,IAAI,CAClBI,GAAG,CAAEC,KAAK,IAAK;IAChB,OAAO;MACHC,MAAM,EAAED,KAAK,CAACE,KAAK;MACnB,GAAGL,wBAAwB,CAACG,KAAK,CAAC;MAClC,GAAG3B,qCAAqC,CAAC2B,KAAK;IAClD,CAAC;EACL,CAAC,CAAC,CAAC,CAAC;EACJ,OAAOF,GAAG,CAAC,CAAC;AAChB;AACA,SAASD,wBAAwBA,CAACG,KAAK,EAAE;EACrC,KAAK,MAAMG,eAAe,IAAIH,KAAK,CAACI,OAAO,EAAE;IACzC,IAAID,eAAe,CAACE,IAAI,KAAK,OAAO,EAAE;MAClC,OAAO;QAAEC,MAAM,EAAEH,eAAe,CAACI;MAAM,CAAC;IAC5C;EACJ;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"aggregate.js","names":["OntologiesV2","invariant","legacyToModernSingleAggregationResult","modernToLegacyAggregationClause","modernToLegacyGroupByClause","modernToLegacyWhereClause","addUserAgentAndRequestContextHeaders","aggregate","clientCtx","objectType","objectSet","type","req","body","aggregation","$select","groupBy","where","undefined","$groupBy","$where","result","OntologyObjectSets","ontologyRid","data","length","process","env","NODE_ENV","aggregationToCountResult","ret","map","entry","$group","group","aggregateResult","metrics","name","$count","value"],"sources":["aggregate.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 * as OntologiesV2 from \"@osdk/internal.foundry.ontologiesv2\";\nimport invariant from \"tiny-invariant\";\nimport { legacyToModernSingleAggregationResult } from \"../internal/conversions/legacyToModernSingleAggregationResult.js\";\nimport { modernToLegacyAggregationClause } from \"../internal/conversions/modernToLegacyAggregationClause.js\";\nimport { modernToLegacyGroupByClause } from \"../internal/conversions/modernToLegacyGroupByClause.js\";\nimport { modernToLegacyWhereClause } from \"../internal/conversions/modernToLegacyWhereClause.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\n/** @internal */\nexport async function aggregate(clientCtx, objectType, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}, req) {\n const body = {\n aggregation: modernToLegacyAggregationClause(req.$select),\n groupBy: [],\n where: undefined,\n };\n if (req.$groupBy) {\n body.groupBy = modernToLegacyGroupByClause(req.$groupBy);\n }\n if (req.$where) {\n body.where = modernToLegacyWhereClause(req.$where, objectType);\n }\n const result = await OntologiesV2.OntologyObjectSets.aggregate(addUserAgentAndRequestContextHeaders(clientCtx, objectType), await clientCtx.ontologyRid, {\n objectSet,\n groupBy: body.groupBy,\n aggregation: body.aggregation,\n });\n if (!req.$groupBy) {\n invariant(result.data.length === 1, \"no group by clause should mean only one data result\");\n return {\n ...aggregationToCountResult(result.data[0]),\n ...legacyToModernSingleAggregationResult(result.data[0]),\n };\n }\n const ret = result.data\n .map((entry) => {\n return {\n $group: entry.group,\n ...aggregationToCountResult(entry),\n ...legacyToModernSingleAggregationResult(entry),\n };\n }); // fixme\n return ret; // FIXME\n}\nfunction aggregationToCountResult(entry) {\n for (const aggregateResult of entry.metrics) {\n if (aggregateResult.name === \"count\") {\n return { $count: aggregateResult.value };\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,OAAOC,SAAS,MAAM,gBAAgB;AACtC,SAASC,qCAAq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AC3C,GAAGtB,qCAAqC,CAACmB,MAAM,CAACG,IAAI,CAAC,CAAC,CAAC;IAC3D,CAAC;EACL;EACA,MAAMM,GAAG,GAAGT,MAAM,CAACG,IAAI,CAClBO,GAAG,CAAEC,KAAK,IAAK;IAChB,OAAO;MACHC,MAAM,EAAED,KAAK,CAACE,KAAK;MACnB,GAAGL,wBAAwB,CAACG,KAAK,CAAC;MAClC,GAAG9B,qCAAqC,CAAC8B,KAAK;IAClD,CAAC;EACL,CAAC,CAAC,CAAC,CAAC;EACJ,OAAOF,GAAG,CAAC,CAAC;AAChB;AACA,SAASD,wBAAwBA,CAACG,KAAK,EAAE;EACrC,KAAK,MAAMG,eAAe,IAAIH,KAAK,CAACI,OAAO,EAAE;IACzC,IAAID,eAAe,CAACE,IAAI,KAAK,OAAO,EAAE;MAClC,OAAO;QAAEC,MAAM,EAAEH,eAAe,CAACI;MAAM,CAAC;IAC5C;EACJ;AACJ","ignoreList":[]}
@@ -1,11 +1,2 @@
1
- import type { InterfaceMetadata, Osdk } from "@osdk/api";
2
- import type { FetchedObjectTypeDefinition } from "../../ontology/OntologyProvider.js";
3
- import type { InterfaceDefRef, UnderlyingOsdkObject } from "./InternalSymbols.js";
4
- import type { ObjectHolder } from "./ObjectHolder.js";
5
- export interface InterfaceHolderOwnProps<Q extends FetchedObjectTypeDefinition> {
6
- [UnderlyingOsdkObject]: Osdk<Q> & ObjectHolder<Q>;
7
- [InterfaceDefRef]: InterfaceMetadata;
8
- }
9
- export interface InterfaceHolder<Q extends FetchedObjectTypeDefinition> extends InterfaceHolderOwnProps<Q> {
10
- }
1
+ export {};
11
2
  //# sourceMappingURL=InterfaceHolder.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"InterfaceHolder.d.ts","sourceRoot":"","sources":["../../../../src/object/convertWireToOsdkObjects/InterfaceHolder.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,iBAAiB,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACzD,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,oCAAoC,CAAC;AACtF,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,WAAW,uBAAuB,CACtC,CAAC,SAAS,2BAA2B;IAErC,CAAC,oBAAoB,CAAC,EAAE,IAAI,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,CAAC,CAAC,CAAC;IAClD,CAAC,eAAe,CAAC,EAAE,iBAAiB,CAAC;CACtC;AAED,MAAM,WAAW,eAAe,CAC9B,CAAC,SAAS,2BAA2B,CACrC,SAAQ,uBAAuB,CAAC,CAAC,CAAC;CACnC"}
1
+ {"version":3,"file":"InterfaceHolder.d.ts","sourceRoot":"","sources":["../../../../src/object/convertWireToOsdkObjects/InterfaceHolder.ts"],"names":[],"mappings":""}
@@ -1,11 +1,4 @@
1
1
  import type { ObjectOrInterfaceDefinition, OsdkBase } from "@osdk/api";
2
- export declare const UnderlyingOsdkObject: unique symbol;
3
- export declare const ObjectDefRef: unique symbol;
4
- export declare const InterfaceDefRef: unique symbol;
5
- /** A symbol for getting the raw data object off of the holder an osdk object proxy points to */
6
- export declare const RawObject: unique symbol;
7
- export declare const ClientRef: unique symbol;
8
- export declare const CachedPropertiesRef: unique symbol;
9
2
  export interface HolderBase<T extends ObjectOrInterfaceDefinition> {
10
3
  [UnderlyingOsdkObject]: OsdkBase<any>;
11
4
  [ObjectDefRef]?: T;
@@ -1 +1 @@
1
- {"version":3,"file":"InternalSymbols.d.ts","sourceRoot":"","sources":["../../../../src/object/convertWireToOsdkObjects/InternalSymbols.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAEvE,eAAO,MAAM,oBAAoB,eAEhC,CAAC;AAEF,eAAO,MAAM,YAAY,eAExB,CAAC;AAEF,eAAO,MAAM,eAAe,eAE3B,CAAC;AAEF,gGAAgG;AAChG,eAAO,MAAM,SAAS,eAErB,CAAC;AAEF,eAAO,MAAM,SAAS,eAErB,CAAC;AAEF,eAAO,MAAM,mBAAmB,eAE/B,CAAC;AAEF,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,2BAA2B;IAC/D,CAAC,oBAAoB,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;CACvB"}
1
+ {"version":3,"file":"InternalSymbols.d.ts","sourceRoot":"","sources":["../../../../src/object/convertWireToOsdkObjects/InternalSymbols.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,2BAA2B,EAAE,QAAQ,EAAE,MAAM,WAAW,CAAC;AAiCvE,MAAM,WAAW,UAAU,CAAC,CAAC,SAAS,2BAA2B;IAC/D,CAAC,oBAAoB,CAAC,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtC,CAAC,YAAY,CAAC,CAAC,EAAE,CAAC,CAAC;IACnB,CAAC,eAAe,CAAC,CAAC,EAAE,CAAC,CAAC;CACvB"}
@@ -13,11 +13,17 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ /** @internal */
16
17
  export const UnderlyingOsdkObject = Symbol("Underlying Object");
18
+ /** @internal */
17
19
  export const ObjectDefRef = Symbol("ObjectDefinition");
20
+ /** @internal */
18
21
  export const InterfaceDefRef = Symbol("InterfaceDefinition");
19
22
  /** A symbol for getting the raw data object off of the holder an osdk object proxy points to */
23
+ /** @internal */
20
24
  export const RawObject = Symbol("RawObject");
25
+ /** @internal */
21
26
  export const ClientRef = Symbol("ClientRef");
27
+ /** @internal */
22
28
  export const CachedPropertiesRef = Symbol("CachedProperties");
23
29
  //# sourceMappingURL=InternalSymbols.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"InternalSymbols.js","names":["UnderlyingOsdkObject","Symbol","ObjectDefRef","InterfaceDefRef","RawObject","ClientRef","CachedPropertiesRef"],"sources":["InternalSymbols.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 const UnderlyingOsdkObject = Symbol(process.env.MODE !== \"production\" ? \"Underlying Object\" : undefined);\nexport const ObjectDefRef = Symbol(process.env.MODE !== \"production\" ? \"ObjectDefinition\" : undefined);\nexport const InterfaceDefRef = Symbol(process.env.MODE !== \"production\" ? \"InterfaceDefinition\" : undefined);\n/** A symbol for getting the raw data object off of the holder an osdk object proxy points to */\nexport const RawObject = Symbol(process.env.MODE !== \"production\" ? \"RawObject\" : undefined);\nexport const ClientRef = Symbol(process.env.MODE !== \"production\" ? \"ClientRef\" : undefined);\nexport const CachedPropertiesRef = Symbol(process.env.MODE !== \"production\" ? \"CachedProperties\" : undefined);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,GAAGC,MAAM,CAAqC,mBAA+B,CAAC;AAC/G,OAAO,MAAMC,YAAY,GAAGD,MAAM,CAAqC,kBAA8B,CAAC;AACtG,OAAO,MAAME,eAAe,GAAGF,MAAM,CAAqC,qBAAiC,CAAC;AAC5G;AACA,OAAO,MAAMG,SAAS,GAAGH,MAAM,CAAqC,WAAuB,CAAC;AAC5F,OAAO,MAAMI,SAAS,GAAGJ,MAAM,CAAqC,WAAuB,CAAC;AAC5F,OAAO,MAAMK,mBAAmB,GAAGL,MAAM,CAAqC,kBAA8B,CAAC","ignoreList":[]}
1
+ {"version":3,"file":"InternalSymbols.js","names":["UnderlyingOsdkObject","Symbol","ObjectDefRef","InterfaceDefRef","RawObject","ClientRef","CachedPropertiesRef"],"sources":["InternalSymbols.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 */\n/** @internal */\nexport const UnderlyingOsdkObject = Symbol(process.env.MODE !== \"production\" ? \"Underlying Object\" : undefined);\n/** @internal */\nexport const ObjectDefRef = Symbol(process.env.MODE !== \"production\" ? \"ObjectDefinition\" : undefined);\n/** @internal */\nexport const InterfaceDefRef = Symbol(process.env.MODE !== \"production\" ? \"InterfaceDefinition\" : undefined);\n/** A symbol for getting the raw data object off of the holder an osdk object proxy points to */\n/** @internal */\nexport const RawObject = Symbol(process.env.MODE !== \"production\" ? \"RawObject\" : undefined);\n/** @internal */\nexport const ClientRef = Symbol(process.env.MODE !== \"production\" ? \"ClientRef\" : undefined);\n/** @internal */\nexport const CachedPropertiesRef = Symbol(process.env.MODE !== \"production\" ? \"CachedProperties\" : undefined);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMA,oBAAoB,GAAGC,MAAM,CAAqC,mBAA+B,CAAC;AAC/G;AACA,OAAO,MAAMC,YAAY,GAAGD,MAAM,CAAqC,kBAA8B,CAAC;AACtG;AACA,OAAO,MAAME,eAAe,GAAGF,MAAM,CAAqC,qBAAiC,CAAC;AAC5G;AACA;AACA,OAAO,MAAMG,SAAS,GAAGH,MAAM,CAAqC,WAAuB,CAAC;AAC5F;AACA,OAAO,MAAMI,SAAS,GAAGJ,MAAM,CAAqC,WAAuB,CAAC;AAC5F;AACA,OAAO,MAAMK,mBAAmB,GAAGL,MAAM,CAAqC,kBAA8B,CAAC","ignoreList":[]}
@@ -90,7 +90,13 @@ export function createOsdkObject(client, objectDef, rawObj) {
90
90
  if (instance != null) {
91
91
  return instance;
92
92
  }
93
- const geotimeProp = new GeotimeSeriesPropertyImpl(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);
93
+ const geotimeProp = new GeotimeSeriesPropertyImpl(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p, rawValue.type === "geotimeSeriesValue" ? {
94
+ time: rawValue.timestamp,
95
+ value: {
96
+ type: "Point",
97
+ coordinates: rawValue.position
98
+ }
99
+ } : undefined);
94
100
  target[CachedPropertiesRef].set(p, geotimeProp);
95
101
  return geotimeProp;
96
102
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createOsdkObject.js","names":["createAttachmentFromRid","GeotimeSeriesPropertyImpl","TimeSeriesPropertyImpl","createClientCache","get$as","get$link","CachedPropertiesRef","ClientRef","ObjectDefRef","RawObject","UnderlyingOsdkObject","objectPrototypeCache","client","objectDef","Object","create","value","get","newValues","assign","createOsdkObject","rawObj","objectHolderPrototype","writable","Map","holder","osdkObject","Proxy","ownKeys","target","Reflect","p","receiver","rawValue","propDef","properties","type","Array","isArray","map","a","rid","apiName","primaryKeyApiName","instance","geotimeProp","set","newValue","getOwnPropertyDescriptor","configurable","enumerable","undefined"],"sources":["createOsdkObject.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 { createAttachmentFromRid } from \"../../createAttachmentFromRid.js\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport { createClientCache } from \"../Cache.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport { CachedPropertiesRef, ClientRef, ObjectDefRef, RawObject, UnderlyingOsdkObject, } from \"./InternalSymbols.js\";\nconst objectPrototypeCache = createClientCache(function (client, objectDef) {\n return Object.create(null, {\n [ObjectDefRef]: { value: objectDef },\n [ClientRef]: { value: client },\n \"$as\": { value: get$as(objectDef) },\n \"$link\": {\n get: function () {\n return get$link(this);\n },\n },\n \"$updateInternalValues\": {\n value: function (newValues) {\n this[RawObject] = Object.assign({}, this[RawObject], newValues);\n },\n },\n });\n});\n/** @internal */\nexport function createOsdkObject(client, objectDef, rawObj) {\n // We use multiple layers of prototypes to maximize reuse and also to keep\n // [RawObject] out of `ownKeys`. This keeps the code in the proxy below simpler.\n const objectHolderPrototype = Object.create(objectPrototypeCache.get(client, objectDef), {\n [RawObject]: {\n value: rawObj,\n writable: true, // so we can allow updates\n },\n [CachedPropertiesRef]: {\n value: new Map(),\n writable: true,\n },\n });\n // we separate the holder out so we can update\n // the underlying data without having to return a new object\n // we also need the holder so we can customize the console.log output\n const holder = Object.create(objectHolderPrototype);\n const osdkObject = new Proxy(holder, {\n ownKeys(target) {\n return Reflect.ownKeys(target[RawObject]);\n },\n get(target, p, receiver) {\n switch (p) {\n case UnderlyingOsdkObject:\n // effectively point back to the proxy\n return receiver;\n }\n if (p in target)\n return target[p];\n if (p in rawObj) {\n const rawValue = target[RawObject][p];\n const propDef = objectDef.properties[p];\n if (propDef) {\n if (propDef.type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n return rawValue.map(a => createAttachmentFromRid(client, a.rid));\n }\n return createAttachmentFromRid(client, rawValue.rid);\n }\n if (propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\") {\n return new TimeSeriesPropertyImpl(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);\n }\n if (propDef.type === \"geotimeSeriesReference\") {\n const instance = target[CachedPropertiesRef].get(p);\n if (instance != null) {\n return instance;\n }\n const geotimeProp = new GeotimeSeriesPropertyImpl(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);\n target[CachedPropertiesRef].set(p, geotimeProp);\n return geotimeProp;\n }\n }\n return rawValue;\n }\n // we do not do any fall through to avoid unexpected behavior\n },\n set(target, p, newValue) {\n // allow the prototype to update this value\n if (p === RawObject) {\n // symbol only exists internally so no one else can hit this\n target[p] = newValue;\n return true;\n }\n return false;\n },\n getOwnPropertyDescriptor(target, p) {\n if (p === RawObject) {\n return Reflect.getOwnPropertyDescriptor(target, p);\n }\n if (target[RawObject][p] != null) {\n return { configurable: true, enumerable: true };\n }\n return undefined;\n },\n });\n return osdkObject;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,uBAAuB,QAAQ,kCAAkC;AAC1E,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,sBAAsB,QAAQ,mCAAmC;AAC1E,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,mBAAmB,EAAEC,SAAS,EAAEC,YAAY,EAAEC,SAAS,EAAEC,oBAAoB,QAAS,sBAAsB;AACrH,MAAMC,oBAAoB,GAAGR,iBAAiB,CAAC,UAAUS,MAAM,EAAEC,SAAS,EAAE;EACxE,OAAOC,MAAM,CAACC,MAAM,CAAC,IAAI,EAAE;IACvB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AAC8B,iBAAiB,CAAC,EAAEZ,CAAC,CAAC;YAC/HF,MAAM,CAACvB,mBAAmB,CAAC,CAACwC,GAAG,CAACf,CAAC,EAAEc,WAAW,CAAC;YAC/C,OAAOA,WAAW;UACtB;QACJ;QACA,OAAOZ,QAAQ;MACnB;MACA;IACJ,CAAC;IACDa,GAAGA,CAACjB,MAAM,EAAEE,CAAC,EAAEgB,QAAQ,EAAE;MACrB;MACA,IAAIhB,CAAC,KAAKtB,SAAS,EAAE;QACjB;QACAoB,MAAM,CAACE,CAAC,CAAC,GAAGgB,QAAQ;QACpB,OAAO,IAAI;MACf;MACA,OAAO,KAAK;IAChB,CAAC;IACDC,wBAAwBA,CAACnB,MAAM,EAAEE,CAAC,EAAE;MAChC,IAAIA,CAAC,KAAKtB,SAAS,EAAE;QACjB,OAAOqB,OAAO,CAACkB,wBAAwB,CAACnB,MAAM,EAAEE,CAAC,CAAC;MACtD;MACA,IAAIF,MAAM,CAACpB,SAAS,CAAC,CAACsB,CAAC,CAAC,IAAI,IAAI,EAAE;QAC9B,OAAO;UAAEkB,YAAY,EAAE,IAAI;UAAEC,UAAU,EAAE;QAAK,CAAC;MACnD;MACA,OAAOC,SAAS;IACpB;EACJ,CAAC,CAAC;EACF,OAAOzB,UAAU;AACrB","ignoreList":[]}
1
+ {"version":3,"file":"createOsdkObject.js","names":["createAttachmentFromRid","GeotimeSeriesPropertyImpl","TimeSeriesPropertyImpl","createClientCache","get$as","get$link","CachedPropertiesRef","ClientRef","ObjectDefRef","RawObject","UnderlyingOsdkObject","objectPrototypeCache","client","objectDef","Object","create","value","get","newValues","assign","createOsdkObject","rawObj","objectHolderPrototype","writable","Map","holder","osdkObject","Proxy","ownKeys","target","Reflect","p","receiver","rawValue","propDef","properties","type","Array","isArray","map","a","rid","apiName","primaryKeyApiName","instance","geotimeProp","time","timestamp","coordinates","position","undefined","set","newValue","getOwnPropertyDescriptor","configurable","enumerable"],"sources":["createOsdkObject.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 { createAttachmentFromRid } from \"../../createAttachmentFromRid.js\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport { createClientCache } from \"../Cache.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport { CachedPropertiesRef, ClientRef, ObjectDefRef, RawObject, UnderlyingOsdkObject, } from \"./InternalSymbols.js\";\nconst objectPrototypeCache = createClientCache(function (client, objectDef) {\n return Object.create(null, {\n [ObjectDefRef]: { value: objectDef },\n [ClientRef]: { value: client },\n \"$as\": { value: get$as(objectDef) },\n \"$link\": {\n get: function () {\n return get$link(this);\n },\n },\n \"$updateInternalValues\": {\n value: function (newValues) {\n this[RawObject] = Object.assign({}, this[RawObject], newValues);\n },\n },\n });\n});\n/** @internal */\nexport function createOsdkObject(client, objectDef, rawObj) {\n // We use multiple layers of prototypes to maximize reuse and also to keep\n // [RawObject] out of `ownKeys`. This keeps the code in the proxy below simpler.\n const objectHolderPrototype = Object.create(objectPrototypeCache.get(client, objectDef), {\n [RawObject]: {\n value: rawObj,\n writable: true, // so we can allow updates\n },\n [CachedPropertiesRef]: {\n value: new Map(),\n writable: true,\n },\n });\n // we separate the holder out so we can update\n // the underlying data without having to return a new object\n // we also need the holder so we can customize the console.log output\n const holder = Object.create(objectHolderPrototype);\n const osdkObject = new Proxy(holder, {\n ownKeys(target) {\n return Reflect.ownKeys(target[RawObject]);\n },\n get(target, p, receiver) {\n switch (p) {\n case UnderlyingOsdkObject:\n // effectively point back to the proxy\n return receiver;\n }\n if (p in target)\n return target[p];\n if (p in rawObj) {\n const rawValue = target[RawObject][p];\n const propDef = objectDef.properties[p];\n if (propDef) {\n if (propDef.type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n return rawValue.map(a => createAttachmentFromRid(client, a.rid));\n }\n return createAttachmentFromRid(client, rawValue.rid);\n }\n if (propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\") {\n return new TimeSeriesPropertyImpl(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p);\n }\n if (propDef.type === \"geotimeSeriesReference\") {\n const instance = target[CachedPropertiesRef].get(p);\n if (instance != null) {\n return instance;\n }\n const geotimeProp = new GeotimeSeriesPropertyImpl(client, objectDef.apiName, target[RawObject][objectDef.primaryKeyApiName], p, rawValue.type === \"geotimeSeriesValue\"\n ? {\n time: rawValue.timestamp,\n value: {\n type: \"Point\",\n coordinates: rawValue.position,\n },\n }\n : undefined);\n target[CachedPropertiesRef].set(p, geotimeProp);\n return geotimeProp;\n }\n }\n return rawValue;\n }\n // we do not do any fall through to avoid unexpected behavior\n },\n set(target, p, newValue) {\n // allow the prototype to update this value\n if (p === RawObject) {\n // symbol only exists internally so no one else can hit this\n target[p] = newValue;\n return true;\n }\n return false;\n },\n getOwnPropertyDescriptor(target, p) {\n if (p === RawObject) {\n return Reflect.getOwnPropertyDescriptor(target, p);\n }\n if (target[RawObject][p] != null) {\n return { configurable: true, enumerable: true };\n }\n return undefined;\n },\n });\n return osdkObject;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,uBAAuB,QAAQ,kCAAkC;AAC1E,SAASC,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,sBAAsB,QAAQ,mCAAmC;AAC1E,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,MAAM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AC,CAAC;EACF,OAAOxB,UAAU;AACrB","ignoreList":[]}
@@ -39,7 +39,7 @@ export async function convertWireToOsdkObjects(client, objects, interfaceApiName
39
39
  const ret = [];
40
40
  for (const rawObj of objects) {
41
41
  const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
42
- !objectDef ? invariant(false, `Missing definition for '${rawObj.$apiName}'`) : void 0;
42
+ !objectDef ? process.env.NODE_ENV !== "production" ? invariant(false, `Missing definition for '${rawObj.$apiName}'`) : invariant(false) : void 0;
43
43
  // default value for when we are checking an object
44
44
  let objProps;
45
45
  let conforming = true;
@@ -99,7 +99,7 @@ function reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {
99
99
  function isConforming(client, def, obj, propsToCheck) {
100
100
  for (const propName of propsToCheck) {
101
101
  if (def.properties[propName].nullable === false && obj[propName] == null) {
102
- if (process?.env?.NODE_ENV !== "production") {
102
+ if (process.env.NODE_ENV !== "production") {
103
103
  client.logger?.debug({
104
104
  obj: {
105
105
  $objectType: obj["$objectType"],
@@ -1 +1 @@
1
- {"version":3,"file":"convertWireToOsdkObjects.js","names":["invariant","createOsdkObject","convertWireToOsdkObjects","client","objects","interfaceApiName","forceRemoveRid","selectedProps","strictNonNull","logger","debug","fixObjectPropertiesInPlace","ifaceDef","ontologyProvider","getInterfaceDefinition","undefined","ifaceSelected","Object","keys","properties","ret","rawObj","objectDef","getObjectDefinition","$apiName","objProps","conforming","invariantInterfacesAsViews","apiName","isConforming","reframeAsObjectInPlace","convertInterfacePropNamesToObjectPropNames","Error","osdkObject","$as","push","ifacePropsToMap","map","ifaceProp","interfaceMap","newProps","sptProp","regularProp","entries","value","assign","primaryKeyApiName","$primaryKey","def","obj","propsToCheck","propName","nullable","process","env","NODE_ENV","$objectType","warning","warn","console","error","objs","__rid","$rid","__apiName","__primaryKey","$title","__title"],"sources":["convertWireToOsdkObjects.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 invariant from \"tiny-invariant\";\nimport { createOsdkObject } from \"./convertWireToOsdkObjects/createOsdkObject.js\";\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false) {\n client.logger?.debug(`START convertWireToOsdkObjects()`);\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n const ifaceDef = interfaceApiName\n ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName)\n : undefined;\n const ifaceSelected = ifaceDef\n ? (selectedProps ?? Object.keys(ifaceDef.properties))\n : undefined;\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n // default value for when we are checking an object\n let objProps;\n let conforming = true;\n if (ifaceDef && ifaceSelected) {\n // API returns interface spt names but we cache by real values\n invariantInterfacesAsViews(objectDef, ifaceDef.apiName, client);\n conforming &&= isConforming(client, ifaceDef, rawObj, ifaceSelected);\n reframeAsObjectInPlace(objectDef, ifaceDef.apiName, rawObj);\n objProps = convertInterfacePropNamesToObjectPropNames(objectDef, ifaceDef.apiName, ifaceSelected);\n }\n else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\"Unable to safely convert objects as some non nullable properties are null\");\n }\n else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n let osdkObject = createOsdkObject(client, objectDef, rawObj);\n if (interfaceApiName)\n osdkObject = osdkObject.$as(interfaceApiName);\n ret.push(osdkObject);\n }\n client.logger?.debug(`END convertWireToOsdkObjects()`);\n return ret;\n}\n/**\n * Utility function that lets us take down selected property names from an interface\n * and convert them to an array of property names on an object.\n */\nfunction convertInterfacePropNamesToObjectPropNames(objectDef, interfaceApiName, ifacePropsToMap) {\n return ifacePropsToMap.map((ifaceProp) => objectDef.interfaceMap[interfaceApiName][ifaceProp]);\n}\n/**\n * Takes a raw object from the wire (contextually as an interface) and\n * updates the fields to reflect the underlying objectDef instead\n * @param objectDef\n * @param interfaceApiName\n * @param client\n * @param rawObj\n */\nfunction reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {\n const newProps = {};\n for (const [sptProp, regularProp] of Object.entries(objectDef.interfaceMap[interfaceApiName])) {\n if (sptProp in rawObj) {\n const value = rawObj[sptProp];\n delete rawObj[sptProp];\n if (value !== undefined) {\n newProps[regularProp] = value;\n }\n }\n }\n Object.assign(rawObj, newProps);\n if (!(objectDef.primaryKeyApiName in rawObj)) {\n rawObj[objectDef.primaryKeyApiName] = rawObj.$primaryKey;\n }\n}\nfunction isConforming(client, def, obj, propsToCheck) {\n for (const propName of propsToCheck) {\n if (def.properties[propName].nullable === false && obj[propName] == null) {\n if (process?.env?.NODE_ENV !== \"production\") {\n client.logger?.debug({\n obj: {\n $objectType: obj[\"$objectType\"],\n $primaryKey: obj[\"$primaryKey\"],\n },\n }, `Found object that does not conform to its definition. Expected ${def.apiName}'s ${propName} to not be null.`);\n }\n return false;\n }\n }\n return true;\n}\nfunction invariantInterfacesAsViews(objectDef, interfaceApiName, client) {\n if (objectDef.interfaceMap?.[interfaceApiName] == null) {\n const warning = \"Interfaces are only supported 'as views' but your metadata object is missing the correct information. This suggests your interfaces have not been migrated to the newer version yet and you cannot use this version of the SDK.\";\n if (client.logger) {\n client.logger.warn(warning);\n }\n else {\n // eslint-disable-next-line no-console\n console.error(`WARNING! ${warning}`);\n }\n throw new Error(warning);\n }\n}\nfunction fixObjectPropertiesInPlace(objs, forceRemoveRid) {\n for (const obj of objs) {\n if (forceRemoveRid) {\n delete obj.__rid;\n }\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName = obj.__apiName;\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.__apiName;\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey = obj.__primaryKey;\n obj.$title = obj.__title;\n // we don't want people to use these\n delete obj.__apiName;\n delete obj.__primaryKey;\n delete obj.__title;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,QAAQ,gDAAgD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAACC,MAAM,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,cAAc,GAAG,KAAK,EAAEC,aAAa,EAAEC,aAAa,GAAG,KAAK,EAAE;EAC5IL,MAAM,CAACM,MAAM,EAAEC,KAAK,CAAC,kCAAkC,CAAC;EACxDC,0BAA0B,CAACP,OAAO,EAAEE,cAAc,CAAC;EACnD,MAAMM,QAAQ,GAAGP,gBAAgB,GAC3B,MAAMF,MAAM,CAACU,gBAAgB,CAACC,sBAAsB,CAACT,gBAAgB,CAAC,GACtEU,SAAS;EACf,MAAMC,aAAa,GAAGJ,QAAQ,GACvBL,aAAa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AAK;IACpB;IACA;IACAb,GAAG,CAACzB,QAAQ,GAAGyB,GAAG,CAACe,SAAS;IAC5B;IACA;IACAf,GAAG,CAACO,WAAW,GAAGP,GAAG,CAACe,SAAS;IAC/B;IACAf,GAAG,CAACF,WAAW,GAAGE,GAAG,CAACgB,YAAY;IAClChB,GAAG,CAACiB,MAAM,GAAGjB,GAAG,CAACkB,OAAO;IACxB;IACA,OAAOlB,GAAG,CAACe,SAAS;IACpB,OAAOf,GAAG,CAACgB,YAAY;IACvB,OAAOhB,GAAG,CAACkB,OAAO;EACtB;AACJ","ignoreList":[]}
1
+ {"version":3,"file":"convertWireToOsdkObjects.js","names":["invariant","createOsdkObject","convertWireToOsdkObjects","client","objects","interfaceApiName","forceRemoveRid","selectedProps","strictNonNull","logger","debug","fixObjectPropertiesInPlace","ifaceDef","ontologyProvider","getInterfaceDefinition","undefined","ifaceSelected","Object","keys","properties","ret","rawObj","objectDef","getObjectDefinition","$apiName","process","env","NODE_ENV","objProps","conforming","invariantInterfacesAsViews","apiName","isConforming","reframeAsObjectInPlace","convertInterfacePropNamesToObjectPropNames","Error","osdkObject","$as","push","ifacePropsToMap","map","ifaceProp","interfaceMap","newProps","sptProp","regularProp","entries","value","assign","primaryKeyApiName","$primaryKey","def","obj","propsToCheck","propName","nullable","$objectType","warning","warn","console","error","objs","__rid","$rid","__apiName","__primaryKey","$title","__title"],"sources":["convertWireToOsdkObjects.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 invariant from \"tiny-invariant\";\nimport { createOsdkObject } from \"./convertWireToOsdkObjects/createOsdkObject.js\";\n/**\n * If interfaceApiName is not undefined, converts the instances of the\n * interface into their respective\n * underlying concrete types and then returns the $as() representation\n * for the consumers.\n *\n * Otherwise just does the conversion\n *\n * May mutate in place for performance reasons. If you need a clean copy,\n * keep it first.\n *\n * However, you must use the returned value, which will be whatever is correct.\n *\n * @internal\n * @param interfaceApiName - if undefined\n */\nexport async function convertWireToOsdkObjects(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false) {\n client.logger?.debug(`START convertWireToOsdkObjects()`);\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\n const ifaceDef = interfaceApiName\n ? await client.ontologyProvider.getInterfaceDefinition(interfaceApiName)\n : undefined;\n const ifaceSelected = ifaceDef\n ? (selectedProps ?? Object.keys(ifaceDef.properties))\n : undefined;\n const ret = [];\n for (const rawObj of objects) {\n const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);\n invariant(objectDef, `Missing definition for '${rawObj.$apiName}'`);\n // default value for when we are checking an object\n let objProps;\n let conforming = true;\n if (ifaceDef && ifaceSelected) {\n // API returns interface spt names but we cache by real values\n invariantInterfacesAsViews(objectDef, ifaceDef.apiName, client);\n conforming &&= isConforming(client, ifaceDef, rawObj, ifaceSelected);\n reframeAsObjectInPlace(objectDef, ifaceDef.apiName, rawObj);\n objProps = convertInterfacePropNamesToObjectPropNames(objectDef, ifaceDef.apiName, ifaceSelected);\n }\n else {\n objProps = selectedProps ?? Object.keys(objectDef.properties);\n }\n conforming &&= isConforming(client, objectDef, rawObj, objProps);\n if (strictNonNull === \"throw\" && !conforming) {\n throw new Error(\"Unable to safely convert objects as some non nullable properties are null\");\n }\n else if (strictNonNull === \"drop\" && !conforming) {\n continue;\n }\n let osdkObject = createOsdkObject(client, objectDef, rawObj);\n if (interfaceApiName)\n osdkObject = osdkObject.$as(interfaceApiName);\n ret.push(osdkObject);\n }\n client.logger?.debug(`END convertWireToOsdkObjects()`);\n return ret;\n}\n/**\n * Utility function that lets us take down selected property names from an interface\n * and convert them to an array of property names on an object.\n */\nfunction convertInterfacePropNamesToObjectPropNames(objectDef, interfaceApiName, ifacePropsToMap) {\n return ifacePropsToMap.map((ifaceProp) => objectDef.interfaceMap[interfaceApiName][ifaceProp]);\n}\n/**\n * Takes a raw object from the wire (contextually as an interface) and\n * updates the fields to reflect the underlying objectDef instead\n * @param objectDef\n * @param interfaceApiName\n * @param client\n * @param rawObj\n */\nfunction reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {\n const newProps = {};\n for (const [sptProp, regularProp] of Object.entries(objectDef.interfaceMap[interfaceApiName])) {\n if (sptProp in rawObj) {\n const value = rawObj[sptProp];\n delete rawObj[sptProp];\n if (value !== undefined) {\n newProps[regularProp] = value;\n }\n }\n }\n Object.assign(rawObj, newProps);\n if (!(objectDef.primaryKeyApiName in rawObj)) {\n rawObj[objectDef.primaryKeyApiName] = rawObj.$primaryKey;\n }\n}\nfunction isConforming(client, def, obj, propsToCheck) {\n for (const propName of propsToCheck) {\n if (def.properties[propName].nullable === false && obj[propName] == null) {\n if (process.env.NODE_ENV !== \"production\") {\n client.logger?.debug({\n obj: {\n $objectType: obj[\"$objectType\"],\n $primaryKey: obj[\"$primaryKey\"],\n },\n }, `Found object that does not conform to its definition. Expected ${def.apiName}'s ${propName} to not be null.`);\n }\n return false;\n }\n }\n return true;\n}\nfunction invariantInterfacesAsViews(objectDef, interfaceApiName, client) {\n if (objectDef.interfaceMap?.[interfaceApiName] == null) {\n const warning = \"Interfaces are only supported 'as views' but your metadata object is missing the correct information. This suggests your interfaces have not been migrated to the newer version yet and you cannot use this version of the SDK.\";\n if (client.logger) {\n client.logger.warn(warning);\n }\n else {\n // eslint-disable-next-line no-console\n console.error(`WARNING! ${warning}`);\n }\n throw new Error(warning);\n }\n}\nfunction fixObjectPropertiesInPlace(objs, forceRemoveRid) {\n for (const obj of objs) {\n if (forceRemoveRid) {\n delete obj.__rid;\n }\n if (obj.__rid) {\n obj.$rid = obj.__rid;\n delete obj.__rid;\n }\n // Backend returns as __apiName but we want to stick to $ structure\n obj.$apiName = obj.__apiName;\n // for now these are the same but when we start doing interface projections the $objectType will always be underlying and\n // the $apiName will be for the current view (in current designs)\n obj.$objectType = obj.__apiName;\n // copying over for now as its always returned. In the future, this should just be inferred from underlying\n obj.$primaryKey = obj.__primaryKey;\n obj.$title = obj.__title;\n // we don't want people to use these\n delete obj.__apiName;\n delete obj.__primaryKey;\n delete obj.__title;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAOA,SAAS,MAAM,gBAAgB;AACtC,SAASC,gBAAgB,QAAQ,gDAAgD;AACjF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,eAAeC,wBAAwBA,CAACC,MAAM,EAAEC,OAAO,EAAEC,gBAAgB,EAAEC,cAAc,GAAG,KAAK,EAAEC,aAAa,EAAEC,aAAa,GAAG,KAAK,EAAE;EAC5IL,MAAM,CAACM,MAAM,EAAEC,KAAK,CAAC,kCAAkC,CAAC;EACxDC,0BAA0B,CAACP,OAAO,EAAEE,cAAc,CAAC;EACnD,MAAMM,QAAQ,GAAGP,gBAAgB,GAC3B,MAAMF,MAAM,CAACU,gBAAgB,CAACC,sBAAsB,CAACT,gBAAgB,CAAC,GACtEU,SAAS;EACf,MAAMC,aAAa,GAAGJ,QAAQ,GACvBL,aAAa,IAAIU,MAAM,CAACC,IAAI,CAACN,QAAQ,CAACO,UAAU,CAAC,GAClDJ,SAAS;EACf,MAAMK,GAAG,GAAG,EAAE;EACd,KAAK,MAAMC,MAAM,IAAIjB,OAAO,EAAE;IAC1B,MAAMkB,SAAS,GAAG,MAAMnB,MAAM,CAACU,gBAAgB,CAACU,mBAAmB,CAACF,MAAM,CAACG,QAAQ,CAAC;IACpF,CAAUF,SAAS,GAAAG,OAAA,CAAAC,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