@osdk/client 2.1.0-beta.2 → 2.1.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +297 -0
- package/build/browser/Client.d.ts +6 -22
- package/build/browser/Client.d.ts.map +1 -1
- package/build/browser/Client.js +3 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/MinimalClientContext.d.ts +1 -1
- package/build/browser/MinimalClientContext.d.ts.map +1 -1
- package/build/browser/__unstable/ConjureSupport.js +5 -5
- package/build/browser/__unstable/ConjureSupport.js.map +1 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js +2 -2
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
- package/build/browser/actions/actions.test.js +28 -0
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/actions/applyAction.js +1 -1
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.d.ts +1 -1
- package/build/browser/createClient.d.ts.map +1 -1
- package/build/browser/createClient.js +41 -19
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createClient.test.js +24 -0
- package/build/browser/createClient.test.js.map +1 -1
- package/build/browser/createGeotimeSeriesProperty.d.ts +1 -1
- package/build/browser/createGeotimeSeriesProperty.d.ts.map +1 -1
- package/build/browser/createGeotimeSeriesProperty.js +4 -1
- package/build/browser/createGeotimeSeriesProperty.js.map +1 -1
- package/build/browser/createMinimalClient.js +9 -4
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/createPlatformClient.d.ts +1 -1
- package/build/browser/createPlatformClient.d.ts.map +1 -1
- package/build/browser/createTimeseriesProperty.d.ts.map +1 -1
- package/build/browser/fetchMetadata.test.js +14 -0
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/index.d.ts +2 -2
- package/build/browser/index.d.ts.map +1 -1
- package/build/browser/index.js +1 -1
- package/build/browser/index.js.map +1 -1
- package/build/browser/intellisense.test.js +1 -1
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +11 -3
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +208 -7
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/browser/object/AttachmentUpload.d.ts.map +1 -1
- package/build/browser/object/AttachmentUpload.js +5 -7
- package/build/browser/object/AttachmentUpload.js.map +1 -1
- package/build/browser/object/aggregate.js +4 -5
- package/build/browser/object/aggregate.js.map +1 -1
- package/build/browser/object/aggregate.test.js +6 -9
- package/build/browser/object/aggregate.test.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +4 -3
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +41 -85
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.test.js +0 -6
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.test.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +60 -89
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js +2 -2
- package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js +14 -38
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +42 -6
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +177 -45
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.d.ts.map +1 -1
- package/build/browser/object/fetchPage.js +34 -23
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/object/fetchPage.test.js +75 -1
- package/build/browser/object/fetchPage.test.js.map +1 -1
- package/build/browser/object/object.test.d.ts.map +1 -1
- package/build/browser/object/object.test.js +25 -1
- package/build/browser/object/object.test.js.map +1 -1
- package/build/browser/object/timeseries.test.js +10 -0
- package/build/browser/object/timeseries.test.js.map +1 -1
- package/build/browser/objectSet/InterfaceObjectSet.test.d.ts +2 -0
- package/build/browser/objectSet/InterfaceObjectSet.test.d.ts.map +1 -0
- package/build/browser/objectSet/InterfaceObjectSet.test.js +61 -0
- package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -0
- package/build/browser/objectSet/ObjectSet.test.js +162 -48
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +136 -74
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +150 -42
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +10 -8
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/objectSet/toConjureObjectSet.js +2 -0
- package/build/browser/objectSet/toConjureObjectSet.js.map +1 -1
- package/build/browser/ontology/makeConjureContext.d.ts +1 -1
- package/build/browser/ontology/makeConjureContext.d.ts.map +1 -1
- package/build/browser/public/internal.d.ts +4 -0
- package/build/browser/public/internal.d.ts.map +1 -0
- package/build/browser/public/internal.js +19 -0
- package/build/browser/public/internal.js.map +1 -0
- package/build/browser/public-utils/createAndFetchTempObjectSetRid.d.ts +11 -0
- package/build/browser/public-utils/createAndFetchTempObjectSetRid.d.ts.map +1 -0
- package/build/browser/public-utils/createAndFetchTempObjectSetRid.js +32 -0
- package/build/browser/public-utils/createAndFetchTempObjectSetRid.js.map +1 -0
- package/build/browser/public-utils/hydrateAttachmentFromRid.d.ts +10 -0
- package/build/browser/public-utils/hydrateAttachmentFromRid.d.ts.map +1 -0
- package/build/{esm/createAttachmentFromRid.js → browser/public-utils/hydrateAttachmentFromRid.js} +9 -4
- package/build/browser/public-utils/hydrateAttachmentFromRid.js.map +1 -0
- package/build/browser/public-utils/hydrateObjectSetFromRid.d.ts +11 -0
- package/build/browser/public-utils/hydrateObjectSetFromRid.d.ts.map +1 -0
- package/build/browser/public-utils/hydrateObjectSetFromRid.js +37 -0
- package/build/browser/public-utils/hydrateObjectSetFromRid.js.map +1 -0
- package/build/browser/queries/applyQuery.d.ts.map +1 -1
- package/build/browser/queries/applyQuery.js +3 -4
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +30 -2
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/tsserver.js +1 -1
- package/build/browser/tsserver.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/browser/util/datetimeConverters.d.ts +22 -0
- package/build/browser/util/datetimeConverters.d.ts.map +1 -0
- package/build/browser/util/datetimeConverters.js +55 -0
- package/build/browser/util/datetimeConverters.js.map +1 -0
- package/build/browser/util/datetimeConverters.test.d.ts +2 -0
- package/build/browser/util/datetimeConverters.test.d.ts.map +1 -0
- package/build/browser/util/datetimeConverters.test.js +75 -0
- package/build/browser/util/datetimeConverters.test.js.map +1 -0
- package/build/browser/util/objectSetUtils.d.ts +4 -0
- package/build/browser/util/objectSetUtils.d.ts.map +1 -0
- package/build/browser/util/objectSetUtils.js +25 -0
- package/build/browser/util/objectSetUtils.js.map +1 -0
- package/build/browser/util/timeseriesUtils.d.ts +1 -1
- package/build/browser/util/timeseriesUtils.d.ts.map +1 -1
- package/build/browser/util/timeseriesUtils.js +1 -1
- package/build/browser/util/timeseriesUtils.js.map +1 -1
- package/build/browser/util/toDataValue.js +6 -0
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValue.test.js +9 -1
- package/build/browser/util/toDataValue.test.js.map +1 -1
- package/build/browser/util/toDataValueQueries.js +6 -0
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/esm/Client.d.ts +6 -22
- package/build/esm/Client.d.ts.map +1 -1
- package/build/esm/Client.js +3 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/MinimalClientContext.d.ts +1 -1
- package/build/esm/MinimalClientContext.d.ts.map +1 -1
- package/build/esm/__unstable/ConjureSupport.js +5 -5
- package/build/esm/__unstable/ConjureSupport.js.map +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -6
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js +2 -2
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
- package/build/esm/actions/actions.test.js +28 -0
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/actions/applyAction.js +1 -1
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.d.ts +1 -1
- package/build/esm/createClient.d.ts.map +1 -1
- package/build/esm/createClient.js +41 -19
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createClient.test.js +24 -0
- package/build/esm/createClient.test.js.map +1 -1
- package/build/esm/createGeotimeSeriesProperty.d.ts +1 -1
- package/build/esm/createGeotimeSeriesProperty.d.ts.map +1 -1
- package/build/esm/createGeotimeSeriesProperty.js +4 -1
- package/build/esm/createGeotimeSeriesProperty.js.map +1 -1
- package/build/esm/createMinimalClient.js +9 -4
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/createPlatformClient.d.ts +1 -1
- package/build/esm/createPlatformClient.d.ts.map +1 -1
- package/build/esm/createTimeseriesProperty.d.ts.map +1 -1
- package/build/esm/fetchMetadata.test.js +14 -0
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/index.d.ts +2 -2
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +1 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/intellisense.test.js +1 -1
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js +1 -1
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +11 -3
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +208 -7
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/esm/object/AttachmentUpload.d.ts.map +1 -1
- package/build/esm/object/AttachmentUpload.js +5 -7
- package/build/esm/object/AttachmentUpload.js.map +1 -1
- package/build/esm/object/aggregate.js +4 -5
- package/build/esm/object/aggregate.js.map +1 -1
- package/build/esm/object/aggregate.test.js +6 -9
- package/build/esm/object/aggregate.test.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -10
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -7
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +4 -3
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +41 -85
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.test.js +0 -6
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.test.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +60 -89
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js +2 -2
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js +14 -38
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +42 -6
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +177 -45
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.d.ts.map +1 -1
- package/build/esm/object/fetchPage.js +34 -23
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/object/fetchPage.test.js +75 -1
- package/build/esm/object/fetchPage.test.js.map +1 -1
- package/build/esm/object/object.test.d.ts.map +1 -1
- package/build/esm/object/object.test.js +25 -1
- package/build/esm/object/object.test.js.map +1 -1
- package/build/esm/object/timeseries.test.js +10 -0
- package/build/esm/object/timeseries.test.js.map +1 -1
- package/build/esm/objectSet/InterfaceObjectSet.test.d.ts +2 -0
- package/build/esm/objectSet/InterfaceObjectSet.test.d.ts.map +1 -0
- package/build/esm/objectSet/InterfaceObjectSet.test.js +61 -0
- package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -0
- package/build/esm/objectSet/ObjectSet.test.js +162 -48
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +136 -77
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +150 -42
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +10 -8
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/objectSet/toConjureObjectSet.js +2 -0
- package/build/esm/objectSet/toConjureObjectSet.js.map +1 -1
- package/build/esm/ontology/makeConjureContext.d.ts +1 -1
- package/build/esm/ontology/makeConjureContext.d.ts.map +1 -1
- package/build/esm/public/internal.d.ts +4 -0
- package/build/esm/public/internal.d.ts.map +1 -0
- package/build/esm/public/internal.js +19 -0
- package/build/esm/public/internal.js.map +1 -0
- package/build/esm/public-utils/createAndFetchTempObjectSetRid.d.ts +11 -0
- package/build/esm/public-utils/createAndFetchTempObjectSetRid.d.ts.map +1 -0
- package/build/esm/public-utils/createAndFetchTempObjectSetRid.js +32 -0
- package/build/esm/public-utils/createAndFetchTempObjectSetRid.js.map +1 -0
- package/build/esm/public-utils/hydrateAttachmentFromRid.d.ts +10 -0
- package/build/esm/public-utils/hydrateAttachmentFromRid.d.ts.map +1 -0
- package/build/{browser/createAttachmentFromRid.js → esm/public-utils/hydrateAttachmentFromRid.js} +9 -4
- package/build/esm/public-utils/hydrateAttachmentFromRid.js.map +1 -0
- package/build/esm/public-utils/hydrateObjectSetFromRid.d.ts +11 -0
- package/build/esm/public-utils/hydrateObjectSetFromRid.d.ts.map +1 -0
- package/build/esm/public-utils/hydrateObjectSetFromRid.js +37 -0
- package/build/esm/public-utils/hydrateObjectSetFromRid.js.map +1 -0
- package/build/esm/queries/applyQuery.d.ts.map +1 -1
- package/build/esm/queries/applyQuery.js +3 -4
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +30 -2
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/tsserver.js +1 -1
- package/build/esm/tsserver.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/esm/util/datetimeConverters.d.ts +22 -0
- package/build/esm/util/datetimeConverters.d.ts.map +1 -0
- package/build/esm/util/datetimeConverters.js +55 -0
- package/build/esm/util/datetimeConverters.js.map +1 -0
- package/build/esm/util/datetimeConverters.test.d.ts +2 -0
- package/build/esm/util/datetimeConverters.test.d.ts.map +1 -0
- package/build/esm/util/datetimeConverters.test.js +75 -0
- package/build/esm/util/datetimeConverters.test.js.map +1 -0
- package/build/esm/util/objectSetUtils.d.ts +4 -0
- package/build/esm/util/objectSetUtils.d.ts.map +1 -0
- package/build/esm/util/objectSetUtils.js +25 -0
- package/build/esm/util/objectSetUtils.js.map +1 -0
- package/build/esm/util/timeseriesUtils.d.ts +1 -1
- package/build/esm/util/timeseriesUtils.d.ts.map +1 -1
- package/build/esm/util/timeseriesUtils.js +1 -1
- package/build/esm/util/timeseriesUtils.js.map +1 -1
- package/build/esm/util/toDataValue.js +6 -0
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValue.test.js +9 -1
- package/build/esm/util/toDataValue.test.js.map +1 -1
- package/build/esm/util/toDataValueQueries.js +6 -0
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/package.json +23 -19
- package/build/browser/createAttachmentFromRid.d.ts +0 -10
- package/build/browser/createAttachmentFromRid.d.ts.map +0 -1
- package/build/browser/createAttachmentFromRid.js.map +0 -1
- package/build/esm/createAttachmentFromRid.d.ts +0 -10
- package/build/esm/createAttachmentFromRid.d.ts.map +0 -1
- package/build/esm/createAttachmentFromRid.js.map +0 -1
|
@@ -13,114 +13,85 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
import
|
|
16
|
+
import invariant from "tiny-invariant";
|
|
17
17
|
import { GeotimeSeriesPropertyImpl } from "../../createGeotimeSeriesProperty.js";
|
|
18
18
|
import { TimeSeriesPropertyImpl } from "../../createTimeseriesProperty.js";
|
|
19
|
-
import {
|
|
19
|
+
import { hydrateAttachmentFromRidInternal } from "../../public-utils/hydrateAttachmentFromRid.js";
|
|
20
20
|
import { get$as } from "./getDollarAs.js";
|
|
21
21
|
import { get$link } from "./getDollarLink.js";
|
|
22
|
-
import {
|
|
23
|
-
const
|
|
24
|
-
|
|
22
|
+
import { ClientRef, ObjectDefRef, UnderlyingOsdkObject } from "./InternalSymbols.js";
|
|
23
|
+
const specialPropertyTypes = new Set(["attachment", "geotimeSeriesReference", "numericTimeseries", "stringTimeseries", "sensorTimeseries"]);
|
|
24
|
+
// kept separate so we are not redefining these functions
|
|
25
|
+
// every time an object is created.
|
|
26
|
+
const basePropDefs = {
|
|
27
|
+
"$as": {
|
|
28
|
+
get: function () {
|
|
29
|
+
return get$as(this[ObjectDefRef]);
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"$link": {
|
|
33
|
+
get: function () {
|
|
34
|
+
return get$link(this);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
/** @internal */
|
|
39
|
+
export function createOsdkObject(client, objectDef, rawObj) {
|
|
40
|
+
// updates the object's "hidden class/map".
|
|
41
|
+
Object.defineProperties(rawObj, {
|
|
42
|
+
[UnderlyingOsdkObject]: {
|
|
43
|
+
enumerable: false,
|
|
44
|
+
value: rawObj
|
|
45
|
+
},
|
|
25
46
|
[ObjectDefRef]: {
|
|
26
|
-
value: objectDef
|
|
47
|
+
value: objectDef,
|
|
48
|
+
enumerable: false
|
|
27
49
|
},
|
|
28
50
|
[ClientRef]: {
|
|
29
|
-
value: client
|
|
30
|
-
|
|
31
|
-
"$as": {
|
|
32
|
-
value: get$as(objectDef)
|
|
51
|
+
value: client,
|
|
52
|
+
enumerable: false
|
|
33
53
|
},
|
|
34
|
-
|
|
35
|
-
get: function () {
|
|
36
|
-
return get$link(this);
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"$updateInternalValues": {
|
|
40
|
-
value: function (newValues) {
|
|
41
|
-
this[RawObject] = Object.assign({}, this[RawObject], newValues);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
54
|
+
...basePropDefs
|
|
44
55
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
// [RawObject] out of `ownKeys`. This keeps the code in the proxy below simpler.
|
|
50
|
-
const objectHolderPrototype = Object.create(objectPrototypeCache.get(client, objectDef), {
|
|
51
|
-
[RawObject]: {
|
|
52
|
-
value: rawObj,
|
|
53
|
-
writable: true // so we can allow updates
|
|
54
|
-
},
|
|
55
|
-
[CachedPropertiesRef]: {
|
|
56
|
-
value: new Map(),
|
|
57
|
-
writable: true
|
|
56
|
+
// Assign the special values
|
|
57
|
+
for (const propKey of Object.keys(rawObj)) {
|
|
58
|
+
if (propKey in objectDef.properties && typeof objectDef.properties[propKey].type === "string" && specialPropertyTypes.has(objectDef.properties[propKey].type)) {
|
|
59
|
+
rawObj[propKey] = createSpecialProperty(client, objectDef, rawObj, propKey);
|
|
58
60
|
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
const
|
|
64
|
-
const
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
return receiver;
|
|
73
|
-
}
|
|
74
|
-
if (p in target) return target[p];
|
|
75
|
-
if (p in rawObj) {
|
|
76
|
-
const rawValue = target[RawObject][p];
|
|
77
|
-
const propDef = objectDef.properties[p];
|
|
78
|
-
if (propDef) {
|
|
61
|
+
}
|
|
62
|
+
return Object.freeze(rawObj);
|
|
63
|
+
}
|
|
64
|
+
function createSpecialProperty(client, objectDef, rawObject, p) {
|
|
65
|
+
const rawValue = rawObject[p];
|
|
66
|
+
const propDef = objectDef.properties[p];
|
|
67
|
+
if (process.env.NODE_ENV !== "production") {
|
|
68
|
+
!(propDef != null && typeof propDef.type === "string" && specialPropertyTypes.has(propDef.type)) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
69
|
+
}
|
|
70
|
+
{
|
|
71
|
+
{
|
|
72
|
+
{
|
|
73
|
+
{
|
|
79
74
|
if (propDef.type === "attachment") {
|
|
80
75
|
if (Array.isArray(rawValue)) {
|
|
81
|
-
return rawValue.map(a =>
|
|
76
|
+
return rawValue.map(a => hydrateAttachmentFromRidInternal(client, a.rid));
|
|
82
77
|
}
|
|
83
|
-
return
|
|
78
|
+
return hydrateAttachmentFromRidInternal(client, rawValue.rid);
|
|
84
79
|
}
|
|
85
|
-
if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries") {
|
|
86
|
-
return new TimeSeriesPropertyImpl(client, objectDef.apiName,
|
|
80
|
+
if (propDef.type === "numericTimeseries" || propDef.type === "stringTimeseries" || propDef.type === "sensorTimeseries") {
|
|
81
|
+
return new TimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p);
|
|
87
82
|
}
|
|
88
83
|
if (propDef.type === "geotimeSeriesReference") {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
return new GeotimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p, rawValue.type === "geotimeSeriesValue" ? {
|
|
85
|
+
time: rawValue.timestamp,
|
|
86
|
+
value: {
|
|
87
|
+
type: "Point",
|
|
88
|
+
coordinates: rawValue.position
|
|
89
|
+
}
|
|
90
|
+
} : undefined);
|
|
96
91
|
}
|
|
97
92
|
}
|
|
98
|
-
return rawValue;
|
|
99
93
|
}
|
|
100
|
-
// we do not do any fall through to avoid unexpected behavior
|
|
101
|
-
},
|
|
102
|
-
set(target, p, newValue) {
|
|
103
|
-
// allow the prototype to update this value
|
|
104
|
-
if (p === RawObject) {
|
|
105
|
-
// symbol only exists internally so no one else can hit this
|
|
106
|
-
target[p] = newValue;
|
|
107
|
-
return true;
|
|
108
|
-
}
|
|
109
|
-
return false;
|
|
110
|
-
},
|
|
111
|
-
getOwnPropertyDescriptor(target, p) {
|
|
112
|
-
if (p === RawObject) {
|
|
113
|
-
return Reflect.getOwnPropertyDescriptor(target, p);
|
|
114
|
-
}
|
|
115
|
-
if (target[RawObject][p] != null) {
|
|
116
|
-
return {
|
|
117
|
-
configurable: true,
|
|
118
|
-
enumerable: true
|
|
119
|
-
};
|
|
120
|
-
}
|
|
121
|
-
return undefined;
|
|
122
94
|
}
|
|
123
|
-
}
|
|
124
|
-
return osdkObject;
|
|
95
|
+
}
|
|
125
96
|
}
|
|
126
97
|
//# sourceMappingURL=createOsdkObject.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createOsdkObject.js","names":["
|
|
1
|
+
{"version":3,"file":"createOsdkObject.js","names":["invariant","GeotimeSeriesPropertyImpl","TimeSeriesPropertyImpl","hydrateAttachmentFromRidInternal","get$as","get$link","ClientRef","ObjectDefRef","UnderlyingOsdkObject","specialPropertyTypes","Set","basePropDefs","get","createOsdkObject","client","objectDef","rawObj","Object","defineProperties","enumerable","value","propKey","keys","properties","type","has","createSpecialProperty","freeze","rawObject","p","rawValue","propDef","process","env","NODE_ENV","Array","isArray","map","a","rid","apiName","primaryKeyApiName","time","timestamp","coordinates","position","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 invariant from \"tiny-invariant\";\nimport { GeotimeSeriesPropertyImpl } from \"../../createGeotimeSeriesProperty.js\";\nimport { TimeSeriesPropertyImpl } from \"../../createTimeseriesProperty.js\";\nimport { hydrateAttachmentFromRidInternal } from \"../../public-utils/hydrateAttachmentFromRid.js\";\nimport { get$as } from \"./getDollarAs.js\";\nimport { get$link } from \"./getDollarLink.js\";\nimport { ClientRef, ObjectDefRef, UnderlyingOsdkObject, } from \"./InternalSymbols.js\";\nconst specialPropertyTypes = new Set([\n \"attachment\",\n \"geotimeSeriesReference\",\n \"numericTimeseries\",\n \"stringTimeseries\",\n \"sensorTimeseries\",\n]);\n// kept separate so we are not redefining these functions\n// every time an object is created.\nconst basePropDefs = {\n \"$as\": {\n get: function () {\n return get$as(this[ObjectDefRef]);\n },\n },\n \"$link\": {\n get: function () {\n return get$link(this);\n },\n },\n};\n/** @internal */\nexport function createOsdkObject(client, objectDef, rawObj) {\n // updates the object's \"hidden class/map\".\n Object.defineProperties(rawObj, {\n [UnderlyingOsdkObject]: {\n enumerable: false,\n value: rawObj,\n },\n [ObjectDefRef]: { value: objectDef, enumerable: false },\n [ClientRef]: { value: client, enumerable: false },\n ...basePropDefs,\n });\n // Assign the special values\n for (const propKey of Object.keys(rawObj)) {\n if (propKey in objectDef.properties\n && typeof (objectDef.properties[propKey].type) === \"string\"\n && specialPropertyTypes.has(objectDef.properties[propKey].type)) {\n rawObj[propKey] = createSpecialProperty(client, objectDef, rawObj, propKey);\n }\n }\n return Object.freeze(rawObj);\n}\nfunction createSpecialProperty(client, objectDef, rawObject, p) {\n const rawValue = rawObject[p];\n const propDef = objectDef.properties[p];\n if (process.env.NODE_ENV !== \"production\") {\n invariant(propDef != null && typeof propDef.type === \"string\"\n && specialPropertyTypes.has(propDef.type));\n }\n {\n {\n {\n {\n if (propDef.type === \"attachment\") {\n if (Array.isArray(rawValue)) {\n return rawValue.map(a => hydrateAttachmentFromRidInternal(client, a.rid));\n }\n return hydrateAttachmentFromRidInternal(client, rawValue.rid);\n }\n if (propDef.type === \"numericTimeseries\"\n || propDef.type === \"stringTimeseries\"\n || propDef.type === \"sensorTimeseries\") {\n return new TimeSeriesPropertyImpl(client, objectDef.apiName, rawObject[objectDef.primaryKeyApiName], p);\n }\n if (propDef.type === \"geotimeSeriesReference\") {\n return new GeotimeSeriesPropertyImpl(client, objectDef.apiName, 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 }\n }\n }\n }\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,yBAAyB,QAAQ,sCAAsC;AAChF,SAASC,sBAAsB,QAAQ,mCAAmC;AAC1E,SAASC,gCAAgC,QAAQ,gDAAgD;AACjG,SAASC,MAAM,QAAQ,kBAAkB;AACzC,SAASC,QAAQ,QAAQ,oBAAoB;AAC7C,SAASC,SAAS,EAAEC,YAAY,EAAEC,oBAAoB,QAAS,sBAAsB;AACrF,MAAMC,oBAAoB,GAAG,IAAIC,GAAG,CAAC,CACjC,YAAY,EACZ,wBAAwB,EACxB,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,CACrB,CAAC;AACF;AACA;AACA,MAAMC,YAAY,GAAG;EACjB,KAAK,EAAE;IACHC,GAAG,EAAE,SAAAA,CAAA,EAAY;MACb,OAAOR,MAAM,CAAC,IAAI,CAACG,YAAY,CAAC,CAAC;IACrC;EACJ,CAAC;EACD,OAAO,EAAE;IACLK,GAAG,EAAE,SAAAA,CAAA,EAAY;MACb,OAAOP,QAAQ,CAAC,IAAI,CAAC;IACzB;EACJ;AACJ,CAAC;AACD;AACA,OAAO,SAASQ,gBAAgBA,CAACC,MAAM,EAAEC,SAAS,EAAEC,MAAM,EAAE;EACxD;EACAC,MAAM,CAACC,gBAAgB,CAACF,MAAM,EAAE;IAC5B,CAACR,oBAAoB,GAAG;MACpBW,UAAU,EAAE,KAAK;M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E;YAC/B,IAAIW,KAAK,CAACC,OAAO,CAACN,QAAQ,CAAC,EAAE;cACzB,OAAOA,QAAQ,CAACO,GAAG,CAACC,CAAC,IAAInC,gCAAgC,CAACW,MAAM,EAAEwB,CAAC,CAACC,GAAG,CAAC,CAAC;YAC7E;YACA,OAAOpC,gCAAgC,CAACW,MAAM,EAAEgB,QAAQ,CAACS,GAAG,CAAC;UACjE;UACA,IAAIR,OAAO,CAACP,IAAI,KAAK,mBAAmB,IACjCO,OAAO,CAACP,IAAI,KAAK,kBAAkB,IACnCO,OAAO,CAACP,IAAI,KAAK,kBAAkB,EAAE;YACxC,OAAO,IAAItB,sBAAsB,CAACY,MAAM,EAAEC,SAAS,CAACyB,OAAO,EAAEZ,SAAS,CAACb,SAAS,CAAC0B,iBAAiB,CAAC,EAAEZ,CAAC,CAAC;UAC3G;UACA,IAAIE,OAAO,CAACP,IAAI,KAAK,wBAAwB,EAAE;YAC3C,OAAO,IAAIvB,yBAAyB,CAACa,MAAM,EAAEC,SAAS,CAACyB,OAAO,EAAEZ,SAAS,CAACb,SAAS,CAAC0B,iBAAiB,CAAC,EAAEZ,CAAC,EAAEC,QAAQ,CAACN,IAAI,KAAK,oBAAoB,GAC3I;cACEkB,IAAI,EAAEZ,QAAQ,CAACa,SAAS;cACxBvB,KAAK,EAAE;gBACHI,IAAI,EAAE,OAAO;gBACboB,WAAW,EAAEd,QAAQ,CAACe;cAC1B;YACJ,CAAC,GACCC,SAAS,CAAC;UACpB;QACJ;MACJ;IACJ;EACJ;AACJ","ignoreList":[]}
|
|
@@ -45,10 +45,10 @@ function $asFactory(objDef) {
|
|
|
45
45
|
throw new Error(`Object does not implement interface '${targetMinDef}'.`);
|
|
46
46
|
}
|
|
47
47
|
const underlying = this[UnderlyingOsdkObject];
|
|
48
|
-
const existing = osdkObjectToInterfaceView.get(underlying).get(targetInterfaceApiName);
|
|
48
|
+
const existing = osdkObjectToInterfaceView.get(underlying).get(targetInterfaceApiName)?.deref();
|
|
49
49
|
if (existing) return existing;
|
|
50
50
|
const osdkInterface = createOsdkInterface(underlying, def.def);
|
|
51
|
-
osdkObjectToInterfaceView.get(underlying).set(targetInterfaceApiName, osdkInterface);
|
|
51
|
+
osdkObjectToInterfaceView.get(underlying).set(targetInterfaceApiName, new WeakRef(osdkInterface));
|
|
52
52
|
return osdkInterface;
|
|
53
53
|
};
|
|
54
54
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDollarAs.js","names":["InterfaceDefinitions","createSimpleCache","createOsdkInterface","UnderlyingOsdkObject","get$as","WeakMap","$asFactory","get","osdkObjectToInterfaceView","Map","objDef","targetMinDef","targetInterfaceApiName","apiName","interfaceMap","Error","type","def","underlying","existing","osdkInterface","set"],"sources":["getDollarAs.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 { InterfaceDefinitions, } from \"../../ontology/OntologyProvider.js\";\nimport { createSimpleCache } from \"../SimpleCache.js\";\nimport { createOsdkInterface } from \"./createOsdkInterface.js\";\nimport { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nexport const get$as = createSimpleCache(new WeakMap(), $asFactory).get;\nconst osdkObjectToInterfaceView = createSimpleCache(new WeakMap(), () => new Map());\nfunction $asFactory(objDef) {\n // We use the exact same logic for both the interface rep and the underlying rep\n return function $as(targetMinDef) {\n let targetInterfaceApiName;\n if (typeof targetMinDef === \"string\") {\n if (targetMinDef === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n }\n // this is sufficient to determine if we implement the interface\n if (objDef.interfaceMap?.[targetMinDef] == null) {\n throw new Error(`Object does not implement interface '${targetMinDef}'.`);\n }\n targetInterfaceApiName = targetMinDef;\n }\n else if (targetMinDef.apiName === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n }\n else {\n if (targetMinDef.type === \"object\") {\n throw new Error(`'${targetMinDef.apiName}' is not an interface nor is it '${objDef.apiName}', which is the object type.`);\n }\n targetInterfaceApiName = targetMinDef.apiName;\n }\n const def = objDef[InterfaceDefinitions][targetInterfaceApiName];\n if (!def) {\n throw new Error(`Object does not implement interface '${targetMinDef}'.`);\n }\n const underlying = this[UnderlyingOsdkObject];\n const existing = osdkObjectToInterfaceView\n .get(underlying)\n .get(targetInterfaceApiName);\n if (existing)\n return existing;\n const osdkInterface = createOsdkInterface(underlying, def.def);\n osdkObjectToInterfaceView.get(underlying).set(targetInterfaceApiName, osdkInterface);\n return osdkInterface;\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,oBAAoB,QAAS,oCAAoC;AAC1E,SAASC,iBAAiB,QAAQ,mBAAmB;AACrD,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,oBAAoB,QAAQ,sBAAsB;AAC3D,OAAO,MAAMC,MAAM,GAAGH,iBAAiB,CAAC,IAAII,OAAO,CAAC,CAAC,EAAEC,UAAU,CAAC,CAACC,GAAG;AACtE,MAAMC,yBAAyB,GAAGP,iBAAiB,CAAC,IAAII,OAAO,CAAC,CAAC,EAAE,MAAM,IAAII,GAAG,CAAC,CAAC,CAAC;AACnF,SAASH,UAAUA,CAACI,MAAM,EAAE;EACxB;EACA,OAAO,UAAaC,YAAY,EAAE;IAC9B,IAAIC,sBAAsB;IAC1B,IAAI,OAAOD,YAAY,KAAK,QAAQ,EAAE;MAClC,IAAIA,YAAY,KAAKD,MAAM,CAACG,OAAO,EAAE;QACjC,OAAO,IAAI,CAACV,oBAAoB,CAAC;MACrC;MACA;MACA,IAAIO,MAAM,CAACI,YAAY,GAAGH,YAAY,CAAC,IAAI,IAAI,EAAE;QAC7C,MAAM,IAAII,KAAK,CAAC,wCAAwCJ,YAAY,IAAI,CAAC;MAC7E;MACAC,sBAAsB,GAAGD,YAAY;IACzC,CAAC,MACI,IAAIA,YAAY,CAACE,OAAO,KAAKH,MAAM,CAACG,OAAO,EAAE;MAC9C,OAAO,IAAI,CAACV,oBAAoB,CAAC;IACrC,CAAC,MACI;MACD,IAAIQ,YAAY,CAACK,IAAI,KAAK,QAAQ,EAAE;QAChC,MAAM,IAAID,KAAK,CAAC,IAAIJ,YAAY,CAACE,OAAO,oCAAoCH,MAAM,CAACG,OAAO,8BAA8B,CAAC;MAC7H;MACAD,sBAAsB,GAAGD,YAAY,CAACE,OAAO;IACjD;IACA,MAAMI,GAAG,GAAGP,MAAM,CAACV,oBAAoB,CAAC,CAACY,sBAAsB,CAAC;IAChE,IAAI,CAACK,GAAG,EAAE;MACN,MAAM,IAAIF,KAAK,CAAC,wCAAwCJ,YAAY,IAAI,CAAC;IAC7E;IACA,MAAMO,UAAU,GAAG,IAAI,CAACf,oBAAoB,CAAC;IAC7C,MAAMgB,QAAQ,GAAGX,yBAAyB,CACrCD,GAAG,CAACW,UAAU,CAAC,CACfX,GAAG,CAACK,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"getDollarAs.js","names":["InterfaceDefinitions","createSimpleCache","createOsdkInterface","UnderlyingOsdkObject","get$as","WeakMap","$asFactory","get","osdkObjectToInterfaceView","Map","objDef","targetMinDef","targetInterfaceApiName","apiName","interfaceMap","Error","type","def","underlying","existing","deref","osdkInterface","set","WeakRef"],"sources":["getDollarAs.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 { InterfaceDefinitions, } from \"../../ontology/OntologyProvider.js\";\nimport { createSimpleCache } from \"../SimpleCache.js\";\nimport { createOsdkInterface } from \"./createOsdkInterface.js\";\nimport { UnderlyingOsdkObject } from \"./InternalSymbols.js\";\nexport const get$as = createSimpleCache(new WeakMap(), $asFactory).get;\nconst osdkObjectToInterfaceView = createSimpleCache(new WeakMap(), () => new Map());\nfunction $asFactory(objDef) {\n // We use the exact same logic for both the interface rep and the underlying rep\n return function $as(targetMinDef) {\n let targetInterfaceApiName;\n if (typeof targetMinDef === \"string\") {\n if (targetMinDef === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n }\n // this is sufficient to determine if we implement the interface\n if (objDef.interfaceMap?.[targetMinDef] == null) {\n throw new Error(`Object does not implement interface '${targetMinDef}'.`);\n }\n targetInterfaceApiName = targetMinDef;\n }\n else if (targetMinDef.apiName === objDef.apiName) {\n return this[UnderlyingOsdkObject];\n }\n else {\n if (targetMinDef.type === \"object\") {\n throw new Error(`'${targetMinDef.apiName}' is not an interface nor is it '${objDef.apiName}', which is the object type.`);\n }\n targetInterfaceApiName = targetMinDef.apiName;\n }\n const def = objDef[InterfaceDefinitions][targetInterfaceApiName];\n if (!def) {\n throw new Error(`Object does not implement interface '${targetMinDef}'.`);\n }\n const underlying = this[UnderlyingOsdkObject];\n const existing = osdkObjectToInterfaceView\n .get(underlying)\n .get(targetInterfaceApiName)?.deref();\n if (existing)\n return existing;\n const osdkInterface = createOsdkInterface(underlying, def.def);\n osdkObjectToInterfaceView.get(underlying).set(targetInterfaceApiName, new WeakRef(osdkInterface));\n return osdkInterface;\n };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,oBAAoB,QAAS,oC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E;IACA,MAAMO,UAAU,GAAG,IAAI,CAACf,oBAAoB,CAAC;IAC7C,MAAMgB,QAAQ,GAAGX,yBAAyB,CACrCD,GAAG,CAACW,UAAU,CAAC,CACfX,GAAG,CAACK,sBAAsB,CAAC,EAAEQ,KAAK,CAAC,CAAC;IACzC,IAAID,QAAQ,EACR,OAAOA,QAAQ;IACnB,MAAME,aAAa,GAAGnB,mBAAmB,CAACgB,UAAU,EAAED,GAAG,CAACA,GAAG,CAAC;IAC9DT,yBAAyB,CAACD,GAAG,CAACW,UAAU,CAAC,CAACI,GAAG,CAACV,sBAAsB,EAAE,IAAIW,OAAO,CAACF,aAAa,CAAC,CAAC;IACjG,OAAOA,aAAa;EACxB,CAAC;AACL","ignoreList":[]}
|
|
@@ -15,46 +15,22 @@
|
|
|
15
15
|
*/
|
|
16
16
|
import { getWireObjectSet } from "../../objectSet/createObjectSet.js";
|
|
17
17
|
import { fetchSingle, fetchSingleWithErrors } from "../fetchSingle.js";
|
|
18
|
-
import { ClientRef, ObjectDefRef,
|
|
18
|
+
import { ClientRef, ObjectDefRef, UnderlyingOsdkObject } from "./InternalSymbols.js";
|
|
19
19
|
/** @internal */
|
|
20
20
|
export function get$link(holder) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
const
|
|
26
|
-
[ObjectDefRef]: objDef,
|
|
27
|
-
[ClientRef]: client,
|
|
28
|
-
[RawObject]: rawObj
|
|
29
|
-
} = target;
|
|
30
|
-
const linkDef = objDef.links[p];
|
|
31
|
-
if (linkDef == null) {
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
21
|
+
const client = holder[ClientRef];
|
|
22
|
+
const objDef = holder[ObjectDefRef];
|
|
23
|
+
const rawObj = holder[UnderlyingOsdkObject];
|
|
24
|
+
return Object.freeze(Object.fromEntries(Object.keys(objDef.links).map(linkName => {
|
|
25
|
+
const linkDef = objDef.links[linkName];
|
|
34
26
|
const objectSet = client.objectSetFactory(objDef, client).where({
|
|
35
27
|
[objDef.primaryKeyApiName]: rawObj.$primaryKey
|
|
36
|
-
}).pivotTo(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
ownKeys(target) {
|
|
47
|
-
return [...Object.keys(target[ObjectDefRef].links)];
|
|
48
|
-
},
|
|
49
|
-
getOwnPropertyDescriptor(target, p) {
|
|
50
|
-
if (target[ObjectDefRef].links[p]) {
|
|
51
|
-
return {
|
|
52
|
-
enumerable: true,
|
|
53
|
-
configurable: true,
|
|
54
|
-
// fixme
|
|
55
|
-
writable: false
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
28
|
+
}).pivotTo(linkName);
|
|
29
|
+
const value = !linkDef.multiplicity ? {
|
|
30
|
+
fetchOne: options => fetchSingle(client, objDef, options ?? {}, getWireObjectSet(objectSet)),
|
|
31
|
+
fetchOneWithErrors: options => fetchSingleWithErrors(client, objDef, options ?? {}, getWireObjectSet(objectSet))
|
|
32
|
+
} : objectSet;
|
|
33
|
+
return [linkName, value];
|
|
34
|
+
})));
|
|
35
|
+
}
|
|
60
36
|
//# sourceMappingURL=getDollarLink.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDollarLink.js","names":["getWireObjectSet","fetchSingle","fetchSingleWithErrors","ClientRef","ObjectDefRef","
|
|
1
|
+
{"version":3,"file":"getDollarLink.js","names":["getWireObjectSet","fetchSingle","fetchSingleWithErrors","ClientRef","ObjectDefRef","UnderlyingOsdkObject","get$link","holder","client","objDef","rawObj","Object","freeze","fromEntries","keys","links","map","linkName","linkDef","objectSet","objectSetFactory","where","primaryKeyApiName","$primaryKey","pivotTo","value","multiplicity","fetchOne","options","fetchOneWithErrors"],"sources":["getDollarLink.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 { getWireObjectSet } from \"../../objectSet/createObjectSet.js\";\nimport { fetchSingle, fetchSingleWithErrors } from \"../fetchSingle.js\";\nimport { ClientRef, ObjectDefRef, UnderlyingOsdkObject, } from \"./InternalSymbols.js\";\n/** @internal */\nexport function get$link(holder) {\n const client = holder[ClientRef];\n const objDef = holder[ObjectDefRef];\n const rawObj = holder[UnderlyingOsdkObject];\n return Object.freeze(Object.fromEntries(Object.keys(objDef.links).map((linkName) => {\n const linkDef = objDef.links[linkName];\n const objectSet = client.objectSetFactory(objDef, client)\n .where({\n [objDef.primaryKeyApiName]: rawObj.$primaryKey,\n })\n .pivotTo(linkName);\n const value = !linkDef.multiplicity\n ? {\n fetchOne: (options) => fetchSingle(client, objDef, options ?? {}, getWireObjectSet(objectSet)),\n fetchOneWithErrors: (options) => fetchSingleWithErrors(client, objDef, options ?? {}, getWireObjectSet(objectSet)),\n }\n : objectSet;\n return [linkName, value];\n })));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,oCAAoC;AACrE,SAASC,WAAW,EAAEC,qBAAqB,QAAQ,mBAAmB;AACtE,SAASC,SAAS,EAAEC,YAAY,EAAEC,oBAAoB,QAAS,sBAAsB;AACrF;AACA,OAAO,SAASC,QAAQA,CAACC,MAAM,EAAE;EAC7B,MAAMC,MAAM,GAAGD,MAAM,CAACJ,SAAS,CAAC;EAChC,MAAMM,MAAM,GAAGF,MAAM,CAACH,YAAY,CAAC;EACnC,MAAMM,MAAM,GAAGH,MAAM,CAACF,oBAAoB,CAAC;EAC3C,OAAOM,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,WAAW,CAACF,MAAM,CAACG,IAAI,CAACL,MAAM,CAACM,KAAK,CAAC,CAACC,GAAG,CAAEC,QAAQ,IAAK;IAChF,MAAMC,OAAO,GAAGT,MAAM,CAACM,KAAK,CAACE,QAAQ,CAAC;IACtC,MAAME,SAAS,GAAGX,MAAM,CAACY,gBAAgB,CAACX,MAAM,EAAED,MAAM,CAAC,CACpDa,KAAK,CAAC;MACP,CAACZ,MAAM,CAACa,iBAAiB,GAAGZ,MAAM,CAACa;IACvC,CAAC,CAAC,CACGC,OAAO,CAACP,QAAQ,CAAC;IACtB,MAAMQ,KAAK,GAAG,CAACP,OAAO,CAACQ,YAAY,GAC7B;MACEC,QAAQ,EAAGC,OAAO,IAAK3B,WAAW,CAACO,MAAM,EAAEC,MAAM,EAAEmB,OAAO,IAAI,CAAC,CAAC,EAAE5B,gBAAgB,CAACmB,SAAS,CAAC,CAAC;MAC9FU,kBAAkB,EAAGD,OAAO,IAAK1B,qBAAqB,CAACM,MAAM,EAAEC,MAAM,EAAEmB,OAAO,IAAI,CAAC,CAAC,EAAE5B,gBAAgB,CAACmB,SAAS,CAAC;IACrH,CAAC,GACCA,SAAS;IACf,OAAO,CAACF,QAAQ,EAAEQ,KAAK,CAAC;EAC5B,CAAC,CAAC,CAAC,CAAC;AACR","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;
|
|
@@ -65,6 +65,42 @@ export async function convertWireToOsdkObjects(client, objects, interfaceApiName
|
|
|
65
65
|
client.logger?.debug(`END convertWireToOsdkObjects()`);
|
|
66
66
|
return ret;
|
|
67
67
|
}
|
|
68
|
+
/**
|
|
69
|
+
* @internal
|
|
70
|
+
*/
|
|
71
|
+
export async function convertWireToOsdkObjects2(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false, interfaceToObjectTypeMappings = {}) {
|
|
72
|
+
client.logger?.debug(`START convertWireToOsdkObjects2()`);
|
|
73
|
+
fixObjectPropertiesInPlace(objects, forceRemoveRid);
|
|
74
|
+
const ret = [];
|
|
75
|
+
for (const rawObj of objects) {
|
|
76
|
+
const objectDef = await client.ontologyProvider.getObjectDefinition(rawObj.$apiName);
|
|
77
|
+
!objectDef ? process.env.NODE_ENV !== "production" ? invariant(false, `Missing definition for '${rawObj.$apiName}'`) : invariant(false) : void 0;
|
|
78
|
+
const interfaceToObjMapping = interfaceApiName ? interfaceToObjectTypeMappings[interfaceApiName][rawObj.$apiName] : undefined;
|
|
79
|
+
const ifaceSelected = interfaceApiName && interfaceToObjMapping ? selectedProps ? Object.keys(interfaceToObjMapping).filter(val => {
|
|
80
|
+
selectedProps?.includes(interfaceToObjMapping[val]);
|
|
81
|
+
}) : [...Object.values(interfaceToObjMapping), objectDef.primaryKeyApiName] : undefined;
|
|
82
|
+
// default value for when we are checking an object
|
|
83
|
+
let objProps;
|
|
84
|
+
let conforming = true;
|
|
85
|
+
if (interfaceApiName && ifaceSelected) {
|
|
86
|
+
invariantInterfacesAsViews(objectDef, interfaceApiName, client);
|
|
87
|
+
objProps = ifaceSelected;
|
|
88
|
+
} else {
|
|
89
|
+
objProps = selectedProps ?? Object.keys(objectDef.properties);
|
|
90
|
+
}
|
|
91
|
+
conforming &&= isConforming(client, objectDef, rawObj, objProps);
|
|
92
|
+
if (strictNonNull === "throw" && !conforming) {
|
|
93
|
+
throw new Error("Unable to safely convert objects as some non nullable properties are null");
|
|
94
|
+
} else if (strictNonNull === "drop" && !conforming) {
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
let osdkObject = createOsdkObject(client, objectDef, rawObj);
|
|
98
|
+
if (interfaceApiName) osdkObject = osdkObject.$as(interfaceApiName);
|
|
99
|
+
ret.push(osdkObject);
|
|
100
|
+
}
|
|
101
|
+
client.logger?.debug(`END convertWireToOsdkObjects2()`);
|
|
102
|
+
return ret;
|
|
103
|
+
}
|
|
68
104
|
/**
|
|
69
105
|
* Utility function that lets us take down selected property names from an interface
|
|
70
106
|
* and convert them to an array of property names on an object.
|
|
@@ -99,7 +135,7 @@ function reframeAsObjectInPlace(objectDef, interfaceApiName, rawObj) {
|
|
|
99
135
|
function isConforming(client, def, obj, propsToCheck) {
|
|
100
136
|
for (const propName of propsToCheck) {
|
|
101
137
|
if (def.properties[propName].nullable === false && obj[propName] == null) {
|
|
102
|
-
if (process
|
|
138
|
+
if (process.env.NODE_ENV !== "production") {
|
|
103
139
|
client.logger?.debug({
|
|
104
140
|
obj: {
|
|
105
141
|
$objectType: obj["$objectType"],
|
|
@@ -134,13 +170,13 @@ function fixObjectPropertiesInPlace(objs, forceRemoveRid) {
|
|
|
134
170
|
delete obj.__rid;
|
|
135
171
|
}
|
|
136
172
|
// Backend returns as __apiName but we want to stick to $ structure
|
|
137
|
-
obj.$apiName
|
|
173
|
+
obj.$apiName ??= obj.__apiName;
|
|
138
174
|
// for now these are the same but when we start doing interface projections the $objectType will always be underlying and
|
|
139
175
|
// the $apiName will be for the current view (in current designs)
|
|
140
|
-
obj.$objectType = obj
|
|
176
|
+
obj.$objectType = obj.$apiName;
|
|
141
177
|
// copying over for now as its always returned. In the future, this should just be inferred from underlying
|
|
142
|
-
obj.$primaryKey
|
|
143
|
-
obj.$title
|
|
178
|
+
obj.$primaryKey ??= obj.__primaryKey;
|
|
179
|
+
obj.$title ??= obj.__title;
|
|
144
180
|
// we don't want people to use these
|
|
145
181
|
delete obj.__apiName;
|
|
146
182
|
delete obj.__primaryKey;
|
|
@@ -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.__api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,0BAA0BA,CAACL,SAAS,EAAEjB,gBAAgB,EAAEF,MAAM,EAAE;EACrE,IAAImB,SAAS,CAACiB,YAAY,GAAGlC,gBAAgB,CAAC,IAAI,IAAI,EAAE;IACpD,MAAMoD,OAAO,GAAG,iOAAiO;IACjP,IAAItD,MAAM,CAACM,MAAM,EAAE;MACfN,MAAM,CAACM,MAAM,CAACiD,IAAI,CAACD,OAAO,CAAC;IAC/B,CAAC,MACI;MACD;MACAE,OAAO,CAACC,KAAK,CAAC,YAAYH,OAAO,EAAE,CAAC;IACxC;IACA,MAAM,IAAIzB,KAAK,CAACyB,OAAO,CAAC;EAC5B;AACJ;AACA,SAAS9C,0BAA0BA,CAACkD,IAAI,EAAEvD,cAAc,EAAE;EACtD,KAAK,MAAM2C,GAAG,IAAIY,IAAI,EAAE;IACpB,IAAIvD,cAAc,EAAE;MAChB,OAAO2C,GAAG,CAACa,KAAK;IACpB;IACA,IAAIb,GAAG,CAACa,KAAK,EAAE;MACXb,GAAG,CAACc,IAAI,GAAGd,GAAG,CAACa,KAAK;MACpB,OAAOb,GAAG,CAACa,KAAK;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","convertWireToOsdkObjects2","interfaceToObjectTypeMappings","interfaceToObjMapping","filter","val","includes","values","primaryKeyApiName","ifacePropsToMap","map","ifaceProp","interfaceMap","newProps","sptProp","regularProp","entries","value","assign","$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 * @internal\n */\nexport async function convertWireToOsdkObjects2(client, objects, interfaceApiName, forceRemoveRid = false, selectedProps, strictNonNull = false, interfaceToObjectTypeMappings = {}) {\n client.logger?.debug(`START convertWireToOsdkObjects2()`);\n fixObjectPropertiesInPlace(objects, forceRemoveRid);\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 const interfaceToObjMapping = interfaceApiName\n ? interfaceToObjectTypeMappings[interfaceApiName][rawObj.$apiName]\n : undefined;\n const ifaceSelected = interfaceApiName && interfaceToObjMapping\n ? (selectedProps\n ? Object.keys(interfaceToObjMapping).filter(val => {\n selectedProps?.includes(interfaceToObjMapping[val]);\n })\n : [\n ...Object.values(interfaceToObjMapping),\n objectDef.primaryKeyApiName,\n ])\n : undefined;\n // default value for when we are checking an object\n let objProps;\n let conforming = true;\n if (interfaceApiName && ifaceSelected) {\n invariantInterfacesAsViews(objectDef, interfaceApiName, client);\n objProps = 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 convertWireToOsdkObjects2()`);\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,CA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