@osdk/client 2.1.0-beta.3 → 2.1.0-beta.31
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 +441 -0
- package/build/browser/Client.js +7 -0
- package/build/browser/Client.js.map +1 -1
- package/build/browser/Definitions.test.js +1 -0
- package/build/browser/Definitions.test.js.map +1 -1
- package/build/browser/Logger.js +0 -15
- package/build/browser/Logger.js.map +1 -1
- package/build/browser/MinimalClientContext.js +0 -15
- package/build/browser/MinimalClientContext.js.map +1 -1
- package/build/browser/ResultOrError.js +1 -0
- package/build/browser/ResultOrError.js.map +1 -1
- package/build/browser/SatisfiesSemver.js +0 -15
- package/build/browser/SatisfiesSemver.js.map +1 -1
- package/build/browser/SatisfiesSemver.test.js +1 -0
- package/build/browser/SatisfiesSemver.test.js.map +1 -1
- package/build/browser/__unstable/ConjureSupport.js +12 -6
- package/build/browser/__unstable/ConjureSupport.js.map +1 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js +6 -2
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
- package/build/browser/actions/ActionValidationError.js +1 -1
- package/build/browser/actions/ActionValidationError.js.map +1 -1
- package/build/browser/actions/actions.test.js +85 -4
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/actions/applyAction.js +3 -2
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.js +50 -23
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createClient.test.js +25 -0
- package/build/browser/createClient.test.js.map +1 -1
- package/build/browser/createGeotimeSeriesProperty.js +5 -3
- package/build/browser/createGeotimeSeriesProperty.js.map +1 -1
- package/build/browser/createMediaReferenceProperty.js +47 -0
- package/build/browser/createMediaReferenceProperty.js.map +1 -0
- package/build/browser/createMinimalClient.js +9 -2
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/createPlatformClient.js +1 -0
- package/build/browser/createPlatformClient.js.map +1 -1
- package/build/browser/createTimeseriesProperty.js +2 -1
- package/build/browser/createTimeseriesProperty.js.map +1 -1
- package/build/browser/definitions/LinkDefinitions.test.js +4 -0
- package/build/browser/definitions/LinkDefinitions.test.js.map +1 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +106 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +100 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -0
- package/build/browser/fetchMetadata.js +2 -0
- package/build/browser/fetchMetadata.js.map +1 -1
- package/build/browser/fetchMetadata.test.js +19 -0
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/index.js +2 -1
- package/build/browser/index.js.map +1 -1
- package/build/browser/intellisense.test.helpers/callsQueryAcceptsObject.js +3 -1
- package/build/browser/intellisense.test.helpers/callsQueryAcceptsObject.js.map +1 -1
- package/build/browser/intellisense.test.js +5 -2
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js +3 -1
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyAggregationClause.js +2 -0
- package/build/browser/internal/conversions/modernToLegacyAggregationClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.js +1 -0
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +70 -21
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +402 -14
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/browser/object/AttachmentUpload.js +6 -7
- package/build/browser/object/AttachmentUpload.js.map +1 -1
- package/build/browser/object/Cache.js +27 -0
- package/build/browser/object/Cache.js.map +1 -1
- package/build/browser/object/Cache.test.js +10 -3
- package/build/browser/object/Cache.test.js.map +1 -1
- package/build/browser/object/SimpleCache.js +20 -0
- package/build/browser/object/SimpleCache.js.map +1 -1
- package/build/browser/object/aggregate.js +8 -10
- package/build/browser/object/aggregate.js.map +1 -1
- package/build/browser/object/aggregate.test.js +11 -9
- package/build/browser/object/aggregate.test.js.map +1 -1
- package/build/browser/object/attachment.test.js +1 -0
- package/build/browser/object/attachment.test.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.js +0 -15
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +8 -3
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/ObjectHolder.js +0 -15
- package/build/browser/object/convertWireToOsdkObjects/ObjectHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.js +4 -1
- package/build/browser/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/PropertyDescriptorRecord.js +0 -15
- package/build/browser/object/convertWireToOsdkObjects/PropertyDescriptorRecord.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +42 -85
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.test.js +1 -6
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.test.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +88 -88
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js +9 -3
- package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js +15 -38
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +53 -6
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +197 -44
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.js +42 -24
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/object/fetchPage.test.js +80 -1
- package/build/browser/object/fetchPage.test.js.map +1 -1
- package/build/browser/object/fetchSingle.js +3 -0
- package/build/browser/object/fetchSingle.js.map +1 -1
- package/build/browser/object/geotimeseriesreference.test.js +2 -0
- package/build/browser/object/geotimeseriesreference.test.js.map +1 -1
- package/build/browser/object/media.test.js +55 -0
- package/build/browser/object/media.test.js.map +1 -0
- package/build/browser/object/mediaUpload.js +20 -0
- package/build/browser/object/mediaUpload.js.map +1 -0
- package/build/browser/object/object.test.js +203 -10
- package/build/browser/object/object.test.js.map +1 -1
- package/build/browser/object/timeseries.test.js +11 -0
- package/build/browser/object/timeseries.test.js.map +1 -1
- package/build/browser/objectSet/InterfaceObjectSet.test.js +65 -0
- package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -0
- package/build/browser/objectSet/ObjectSet.test.js +400 -46
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetFactory.js +0 -15
- package/build/browser/objectSet/ObjectSetFactory.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +137 -80
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +59 -29
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/conjureUnionType.js +1 -0
- package/build/browser/objectSet/conjureUnionType.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +31 -8
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/ontology/OntologyProvider.js +1 -0
- package/build/browser/ontology/OntologyProvider.js.map +1 -1
- package/build/browser/ontology/StandardOntologyProvider.js +2 -0
- package/build/browser/ontology/StandardOntologyProvider.js.map +1 -1
- package/build/browser/ontology/StandardOntologyProvider.test.js +2 -0
- package/build/browser/ontology/StandardOntologyProvider.test.js.map +1 -1
- package/build/browser/ontology/loadActionMetadata.js +2 -1
- package/build/browser/ontology/loadActionMetadata.js.map +1 -1
- package/build/browser/ontology/loadFullObjectMetadata.js +2 -1
- package/build/browser/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/browser/ontology/loadInterfaceMetadata.js +2 -1
- package/build/browser/ontology/loadInterfaceMetadata.js.map +1 -1
- package/build/browser/ontology/loadQueryMetadata.js +2 -1
- package/build/browser/ontology/loadQueryMetadata.js.map +1 -1
- package/build/browser/ontology/makeConjureContext.js +1 -0
- package/build/browser/ontology/makeConjureContext.js.map +1 -1
- package/build/browser/pageRequestAsAsyncIter.js +1 -0
- package/build/browser/pageRequestAsAsyncIter.js.map +1 -1
- package/build/browser/public/internal.js +20 -0
- package/build/browser/public/internal.js.map +1 -0
- package/build/browser/public/unstable-do-not-use.js +1 -0
- package/build/browser/public/unstable-do-not-use.js.map +1 -1
- package/build/browser/public-utils/createAndFetchTempObjectSetRid.js +34 -0
- package/build/browser/public-utils/createAndFetchTempObjectSetRid.js.map +1 -0
- package/build/{esm/createAttachmentFromRid.js → browser/public-utils/hydrateAttachmentFromRid.js} +13 -6
- package/build/browser/public-utils/hydrateAttachmentFromRid.js.map +1 -0
- package/build/browser/public-utils/hydrateObjectSetFromRid.js +39 -0
- package/build/browser/public-utils/hydrateObjectSetFromRid.js.map +1 -0
- package/build/browser/queries/applyQuery.js +5 -5
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +9 -0
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/queries/types.js +0 -15
- package/build/browser/queries/types.js.map +1 -1
- package/build/browser/tsserver.js +2 -1
- package/build/browser/tsserver.js.map +1 -1
- package/build/browser/util/ArrayElement.js +0 -15
- package/build/browser/util/ArrayElement.js.map +1 -1
- package/build/browser/util/NOOP.js +0 -15
- package/build/browser/util/NOOP.js.map +1 -1
- package/build/browser/util/NullableProps.js +0 -15
- package/build/browser/util/NullableProps.js.map +1 -1
- package/build/browser/util/UserAgent.js +2 -1
- package/build/browser/util/UserAgent.js.map +1 -1
- package/build/browser/util/WireObjectSet.js +2 -0
- package/build/browser/util/WireObjectSet.js.map +1 -1
- package/build/browser/util/addUserAgentAndRequestContextHeaders.js +1 -0
- package/build/browser/util/addUserAgentAndRequestContextHeaders.js.map +1 -1
- package/build/browser/util/augmentRequestContext.js +1 -0
- package/build/browser/util/augmentRequestContext.js.map +1 -1
- package/build/browser/util/datetimeConverters.js +60 -0
- package/build/browser/util/datetimeConverters.js.map +1 -0
- package/build/browser/util/datetimeConverters.test.js +76 -0
- package/build/browser/util/datetimeConverters.test.js.map +1 -0
- package/build/browser/util/interfaceUtils.js +21 -0
- package/build/browser/util/interfaceUtils.js.map +1 -0
- package/build/browser/util/isOntologyObjectV2.js +1 -0
- package/build/browser/util/isOntologyObjectV2.js.map +1 -1
- package/build/browser/util/isOsdkBaseObject.js +1 -0
- package/build/browser/util/isOsdkBaseObject.js.map +1 -1
- package/build/browser/util/isOsdkObject.js +1 -0
- package/build/browser/util/isOsdkObject.js.map +1 -1
- package/build/browser/util/objectSetUtils.js +26 -0
- package/build/browser/util/objectSetUtils.js.map +1 -0
- package/build/browser/util/partialBy.js +0 -15
- package/build/browser/util/partialBy.js.map +1 -1
- package/build/browser/util/streamutils.js +7 -0
- package/build/browser/util/streamutils.js.map +1 -1
- package/build/browser/util/timeseriesUtils.js +2 -1
- package/build/browser/util/timeseriesUtils.js.map +1 -1
- package/build/browser/util/toDataValue.js +28 -2
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValue.test.js +14 -1
- package/build/browser/util/toDataValue.test.js.map +1 -1
- package/build/browser/util/toDataValueQueries.js +10 -1
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/cjs/Client-BZcoRu7n.d.cts +67 -0
- package/build/cjs/chunk-L454XQQ7.cjs +1028 -0
- package/build/cjs/chunk-L454XQQ7.cjs.map +1 -0
- package/build/cjs/chunk-RDXQTUTR.cjs +466 -0
- package/build/cjs/chunk-RDXQTUTR.cjs.map +1 -0
- package/build/cjs/index.cjs +1664 -0
- package/build/cjs/index.cjs.map +1 -0
- package/build/cjs/index.d.cts +85 -0
- package/build/cjs/public/internal.cjs +35 -0
- package/build/cjs/public/internal.cjs.map +1 -0
- package/build/cjs/public/internal.d.cts +33 -0
- package/build/cjs/public/unstable-do-not-use.cjs +12 -0
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -0
- package/build/cjs/public/unstable-do-not-use.d.cts +5 -0
- package/build/esm/Client.js +7 -0
- package/build/esm/Client.js.map +1 -1
- package/build/esm/Definitions.test.js +1 -0
- package/build/esm/Definitions.test.js.map +1 -1
- package/build/esm/Logger.js +0 -15
- package/build/esm/Logger.js.map +1 -1
- package/build/esm/MinimalClientContext.js +0 -15
- package/build/esm/MinimalClientContext.js.map +1 -1
- package/build/esm/ResultOrError.js +1 -0
- package/build/esm/ResultOrError.js.map +1 -1
- package/build/esm/SatisfiesSemver.js +0 -15
- package/build/esm/SatisfiesSemver.js.map +1 -1
- package/build/esm/SatisfiesSemver.test.js +1 -0
- package/build/esm/SatisfiesSemver.test.js.map +1 -1
- package/build/esm/__unstable/ConjureSupport.js +12 -6
- package/build/esm/__unstable/ConjureSupport.js.map +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js +6 -2
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -1
- package/build/esm/actions/ActionValidationError.js +1 -1
- package/build/esm/actions/ActionValidationError.js.map +1 -1
- package/build/esm/actions/actions.test.js +85 -4
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/actions/applyAction.js +3 -2
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.js +50 -23
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createClient.test.js +25 -0
- package/build/esm/createClient.test.js.map +1 -1
- package/build/esm/createGeotimeSeriesProperty.js +5 -3
- package/build/esm/createGeotimeSeriesProperty.js.map +1 -1
- package/build/esm/createMediaReferenceProperty.js +47 -0
- package/build/esm/createMediaReferenceProperty.js.map +1 -0
- package/build/esm/createMinimalClient.js +9 -2
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/createPlatformClient.js +1 -0
- package/build/esm/createPlatformClient.js.map +1 -1
- package/build/esm/createTimeseriesProperty.js +2 -1
- package/build/esm/createTimeseriesProperty.js.map +1 -1
- package/build/esm/definitions/LinkDefinitions.test.js +4 -0
- package/build/esm/definitions/LinkDefinitions.test.js.map +1 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +106 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +100 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -0
- package/build/esm/fetchMetadata.js +2 -0
- package/build/esm/fetchMetadata.js.map +1 -1
- package/build/esm/fetchMetadata.test.js +19 -0
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/index.js +2 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/intellisense.test.helpers/callsQueryAcceptsObject.js +3 -1
- package/build/esm/intellisense.test.helpers/callsQueryAcceptsObject.js.map +1 -1
- package/build/esm/intellisense.test.js +5 -2
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js +3 -1
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyAggregationClause.js +2 -0
- package/build/esm/internal/conversions/modernToLegacyAggregationClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyGroupByClause.js +1 -0
- package/build/esm/internal/conversions/modernToLegacyGroupByClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +70 -21
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +402 -14
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -1
- package/build/esm/object/AttachmentUpload.js +6 -7
- package/build/esm/object/AttachmentUpload.js.map +1 -1
- package/build/esm/object/Cache.js +27 -0
- package/build/esm/object/Cache.js.map +1 -1
- package/build/esm/object/Cache.test.js +10 -3
- package/build/esm/object/Cache.test.js.map +1 -1
- package/build/esm/object/SimpleCache.js +20 -0
- package/build/esm/object/SimpleCache.js.map +1 -1
- package/build/esm/object/aggregate.js +8 -10
- package/build/esm/object/aggregate.js.map +1 -1
- package/build/esm/object/aggregate.test.js +11 -9
- package/build/esm/object/aggregate.test.js.map +1 -1
- package/build/esm/object/attachment.test.js +1 -0
- package/build/esm/object/attachment.test.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.js +0 -15
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +8 -3
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.js +0 -15
- package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.js +4 -1
- package/build/esm/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/PropertyDescriptorRecord.js +0 -15
- package/build/esm/object/convertWireToOsdkObjects/PropertyDescriptorRecord.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +42 -85
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.test.js +1 -6
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.test.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +88 -88
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js +9 -3
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js +15 -38
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +53 -6
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +197 -44
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.js +42 -24
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/object/fetchPage.test.js +80 -1
- package/build/esm/object/fetchPage.test.js.map +1 -1
- package/build/esm/object/fetchSingle.js +3 -0
- package/build/esm/object/fetchSingle.js.map +1 -1
- package/build/esm/object/geotimeseriesreference.test.js +2 -0
- package/build/esm/object/geotimeseriesreference.test.js.map +1 -1
- package/build/esm/object/media.test.js +55 -0
- package/build/esm/object/media.test.js.map +1 -0
- package/build/esm/object/mediaUpload.js +20 -0
- package/build/esm/object/mediaUpload.js.map +1 -0
- package/build/esm/object/object.test.js +203 -10
- package/build/esm/object/object.test.js.map +1 -1
- package/build/esm/object/timeseries.test.js +11 -0
- package/build/esm/object/timeseries.test.js.map +1 -1
- package/build/esm/objectSet/InterfaceObjectSet.test.js +65 -0
- package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -0
- package/build/esm/objectSet/ObjectSet.test.js +400 -46
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetFactory.js +0 -15
- package/build/esm/objectSet/ObjectSetFactory.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +137 -83
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +59 -29
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/conjureUnionType.js +1 -0
- package/build/esm/objectSet/conjureUnionType.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +31 -8
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/ontology/OntologyProvider.js +1 -0
- package/build/esm/ontology/OntologyProvider.js.map +1 -1
- package/build/esm/ontology/StandardOntologyProvider.js +2 -0
- package/build/esm/ontology/StandardOntologyProvider.js.map +1 -1
- package/build/esm/ontology/StandardOntologyProvider.test.js +2 -0
- package/build/esm/ontology/StandardOntologyProvider.test.js.map +1 -1
- package/build/esm/ontology/loadActionMetadata.js +2 -1
- package/build/esm/ontology/loadActionMetadata.js.map +1 -1
- package/build/esm/ontology/loadFullObjectMetadata.js +2 -1
- package/build/esm/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/esm/ontology/loadInterfaceMetadata.js +2 -1
- package/build/esm/ontology/loadInterfaceMetadata.js.map +1 -1
- package/build/esm/ontology/loadQueryMetadata.js +2 -1
- package/build/esm/ontology/loadQueryMetadata.js.map +1 -1
- package/build/esm/ontology/makeConjureContext.js +1 -0
- package/build/esm/ontology/makeConjureContext.js.map +1 -1
- package/build/esm/pageRequestAsAsyncIter.js +1 -0
- package/build/esm/pageRequestAsAsyncIter.js.map +1 -1
- package/build/esm/public/internal.js +20 -0
- package/build/esm/public/internal.js.map +1 -0
- package/build/esm/public/unstable-do-not-use.js +1 -0
- package/build/esm/public/unstable-do-not-use.js.map +1 -1
- package/build/esm/public-utils/createAndFetchTempObjectSetRid.js +34 -0
- package/build/esm/public-utils/createAndFetchTempObjectSetRid.js.map +1 -0
- package/build/{browser/createAttachmentFromRid.js → esm/public-utils/hydrateAttachmentFromRid.js} +13 -6
- package/build/esm/public-utils/hydrateAttachmentFromRid.js.map +1 -0
- package/build/esm/public-utils/hydrateObjectSetFromRid.js +39 -0
- package/build/esm/public-utils/hydrateObjectSetFromRid.js.map +1 -0
- package/build/esm/queries/applyQuery.js +5 -5
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +9 -0
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/queries/types.js +0 -15
- package/build/esm/queries/types.js.map +1 -1
- package/build/esm/tsserver.js +2 -1
- package/build/esm/tsserver.js.map +1 -1
- package/build/esm/util/ArrayElement.js +0 -15
- package/build/esm/util/ArrayElement.js.map +1 -1
- package/build/esm/util/NOOP.js +0 -15
- package/build/esm/util/NOOP.js.map +1 -1
- package/build/esm/util/NullableProps.js +0 -15
- package/build/esm/util/NullableProps.js.map +1 -1
- package/build/esm/util/UserAgent.js +2 -1
- package/build/esm/util/UserAgent.js.map +1 -1
- package/build/esm/util/WireObjectSet.js +2 -0
- package/build/esm/util/WireObjectSet.js.map +1 -1
- package/build/esm/util/addUserAgentAndRequestContextHeaders.js +1 -0
- package/build/esm/util/addUserAgentAndRequestContextHeaders.js.map +1 -1
- package/build/esm/util/augmentRequestContext.js +1 -0
- package/build/esm/util/augmentRequestContext.js.map +1 -1
- package/build/esm/util/datetimeConverters.js +60 -0
- package/build/esm/util/datetimeConverters.js.map +1 -0
- package/build/esm/util/datetimeConverters.test.js +76 -0
- package/build/esm/util/datetimeConverters.test.js.map +1 -0
- package/build/esm/util/interfaceUtils.js +21 -0
- package/build/esm/util/interfaceUtils.js.map +1 -0
- package/build/esm/util/isOntologyObjectV2.js +1 -0
- package/build/esm/util/isOntologyObjectV2.js.map +1 -1
- package/build/esm/util/isOsdkBaseObject.js +1 -0
- package/build/esm/util/isOsdkBaseObject.js.map +1 -1
- package/build/esm/util/isOsdkObject.js +1 -0
- package/build/esm/util/isOsdkObject.js.map +1 -1
- package/build/esm/util/objectSetUtils.js +26 -0
- package/build/esm/util/objectSetUtils.js.map +1 -0
- package/build/esm/util/partialBy.js +0 -15
- package/build/esm/util/partialBy.js.map +1 -1
- package/build/esm/util/streamutils.js +7 -0
- package/build/esm/util/streamutils.js.map +1 -1
- package/build/esm/util/timeseriesUtils.js +2 -1
- package/build/esm/util/timeseriesUtils.js.map +1 -1
- package/build/esm/util/toDataValue.js +28 -2
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValue.test.js +14 -1
- package/build/esm/util/toDataValue.test.js.map +1 -1
- package/build/esm/util/toDataValueQueries.js +10 -1
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/build/types/Client.d.ts +20 -0
- package/build/types/Definitions.test.d.ts +1 -0
- package/build/types/Logger.d.ts +18 -0
- package/build/types/MinimalClientContext.d.ts +21 -0
- package/build/types/ResultOrError.d.ts +9 -0
- package/build/types/SatisfiesSemver.d.ts +10 -0
- package/build/types/SatisfiesSemver.test.d.ts +1 -0
- package/build/types/__unstable/ConjureSupport.d.ts +37 -0
- package/build/{browser → types}/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -7
- package/build/types/actions/ActionValidationError.d.ts +5 -0
- package/build/types/actions/actions.test.d.ts +1 -0
- package/build/{esm → types}/actions/applyAction.d.ts +18 -17
- package/build/{browser → types}/createClient.d.ts +1 -4
- package/build/types/createClient.test.d.ts +1 -0
- package/build/types/createGeotimeSeriesProperty.d.ts +13 -0
- package/build/types/createMediaReferenceProperty.d.ts +13 -0
- package/build/types/createMinimalClient.d.ts +1 -0
- package/build/types/createPlatformClient.d.ts +15 -0
- package/build/types/createTimeseriesProperty.d.ts +13 -0
- package/build/types/definitions/LinkDefinitions.test.d.ts +1 -0
- package/build/types/derivedProperties/createWithPropertiesObjectSet.d.ts +1 -0
- package/build/types/derivedProperties/createWithPropertiesObjectSet.test.d.ts +1 -0
- package/build/types/fetchMetadata.d.ts +1 -0
- package/build/types/fetchMetadata.test.d.ts +1 -0
- package/build/types/index.d.ts +12 -0
- package/build/types/intellisense.test.d.ts +1 -0
- package/build/types/intellisense.test.helpers/callsQueryAcceptsObject.d.ts +1 -0
- package/build/types/internal/conversions/legacyToModernSingleAggregationResult.d.ts +1 -0
- package/build/types/internal/conversions/modernToLegacyAggregationClause.d.ts +1 -0
- package/build/types/internal/conversions/modernToLegacyGroupByClause.d.ts +1 -0
- package/build/{browser → types}/internal/conversions/modernToLegacyWhereClause.d.ts +0 -1
- package/build/types/internal/conversions/modernToLegacyWhereClause.test.d.ts +1 -0
- package/build/{browser → types}/object/AttachmentUpload.d.ts +0 -1
- package/build/types/object/Cache.d.ts +17 -0
- package/build/types/object/Cache.test.d.ts +1 -0
- package/build/types/object/SimpleCache.d.ts +52 -0
- package/build/types/object/aggregate.d.ts +1 -0
- package/build/types/object/aggregate.test.d.ts +1 -0
- package/build/types/object/attachment.test.d.ts +1 -0
- package/build/types/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +1 -0
- package/build/types/object/convertWireToOsdkObjects/InternalSymbols.d.ts +6 -0
- package/build/types/object/convertWireToOsdkObjects/ObjectHolder.d.ts +1 -0
- package/build/types/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.d.ts +15 -0
- package/build/types/object/convertWireToOsdkObjects/PropertyDescriptorRecord.d.ts +5 -0
- package/build/types/object/convertWireToOsdkObjects/createOsdkInterface.d.ts +1 -0
- package/build/types/object/convertWireToOsdkObjects/createOsdkInterface.test.d.ts +1 -0
- package/build/types/object/convertWireToOsdkObjects/createOsdkObject.d.ts +1 -0
- package/build/{browser → types}/object/convertWireToOsdkObjects/getDollarAs.d.ts +0 -1
- package/build/types/object/convertWireToOsdkObjects/getDollarLink.d.ts +1 -0
- package/build/types/object/convertWireToOsdkObjects.d.ts +1 -0
- package/build/types/object/convertWireToOsdkObjects.test.d.ts +1 -0
- package/build/types/object/fetchPage.d.ts +5 -0
- package/build/types/object/fetchPage.test.d.ts +1 -0
- package/build/types/object/fetchSingle.d.ts +1 -0
- package/build/types/object/geotimeseriesreference.test.d.ts +1 -0
- package/build/types/object/media.test.d.ts +1 -0
- package/build/types/object/mediaUpload.d.ts +2 -0
- package/build/{esm → types}/object/object.test.d.ts +1 -2
- package/build/types/object/timeseries.test.d.ts +1 -0
- package/build/types/objectSet/InterfaceObjectSet.test.d.ts +1 -0
- package/build/types/objectSet/ObjectSet.test.d.ts +7 -0
- package/build/types/objectSet/ObjectSetFactory.d.ts +1 -0
- package/build/types/objectSet/ObjectSetListenerWebsocket.d.ts +1 -0
- package/build/types/objectSet/ObjectSetListenerWebsocket.test.d.ts +1 -0
- package/build/types/objectSet/conjureUnionType.d.ts +11 -0
- package/build/types/objectSet/createObjectSet.d.ts +1 -0
- package/build/types/ontology/OntologyProvider.d.ts +27 -0
- package/build/{browser → types}/ontology/StandardOntologyProvider.d.ts +1 -3
- package/build/types/ontology/StandardOntologyProvider.test.d.ts +1 -0
- package/build/{browser → types}/ontology/loadActionMetadata.d.ts +0 -1
- package/build/{esm → types}/ontology/loadFullObjectMetadata.d.ts +1 -4
- package/build/{esm → types}/ontology/loadInterfaceMetadata.d.ts +0 -1
- package/build/{esm → types}/ontology/loadQueryMetadata.d.ts +0 -1
- package/build/{browser → types}/ontology/makeConjureContext.d.ts +0 -1
- package/build/types/pageRequestAsAsyncIter.d.ts +10 -0
- package/build/types/public/internal.d.ts +3 -0
- package/build/{browser → types}/public/unstable-do-not-use.d.ts +0 -1
- package/build/types/public-utils/createAndFetchTempObjectSetRid.d.ts +10 -0
- package/build/types/public-utils/hydrateAttachmentFromRid.d.ts +9 -0
- package/build/types/public-utils/hydrateObjectSetFromRid.d.ts +10 -0
- package/build/{esm → types}/queries/applyQuery.d.ts +4 -2
- package/build/types/queries/queries.test.d.ts +1 -0
- package/build/{esm → types}/queries/types.d.ts +3 -12
- package/build/{esm → types}/tsserver.d.ts +19 -21
- package/build/{browser → types}/util/ArrayElement.d.ts +0 -1
- package/build/types/util/NOOP.d.ts +1 -0
- package/build/types/util/NullableProps.d.ts +1 -0
- package/build/{browser → types}/util/UserAgent.d.ts +0 -1
- package/build/types/util/WireObjectSet.d.ts +1 -0
- package/build/{esm → types}/util/addUserAgentAndRequestContextHeaders.d.ts +0 -1
- package/build/{browser → types}/util/augmentRequestContext.d.ts +6 -7
- package/build/types/util/datetimeConverters.d.ts +21 -0
- package/build/types/util/datetimeConverters.test.d.ts +1 -0
- package/build/types/util/interfaceUtils.d.ts +1 -0
- package/build/types/util/isOntologyObjectV2.d.ts +1 -0
- package/build/{esm/util/isOsdkObject.d.ts → types/util/isOsdkBaseObject.d.ts} +0 -1
- package/build/{browser → types}/util/isOsdkObject.d.ts +0 -1
- package/build/types/util/objectSetUtils.d.ts +3 -0
- package/build/types/util/partialBy.d.ts +8 -0
- package/build/{browser → types}/util/streamutils.d.ts +0 -1
- package/build/{browser → types}/util/timeseriesUtils.d.ts +4 -5
- package/build/types/util/toDataValue.d.ts +1 -0
- package/build/types/util/toDataValue.test.d.ts +1 -0
- package/build/types/util/toDataValueQueries.d.ts +1 -0
- package/index.d.ts +17 -0
- package/internal.d.ts +17 -0
- package/package.json +59 -26
- package/unstable-do-not-use.d.ts +1 -1
- package/build/browser/Client.d.ts +0 -42
- package/build/browser/Client.d.ts.map +0 -1
- package/build/browser/Definitions.test.d.ts +0 -2
- package/build/browser/Definitions.test.d.ts.map +0 -1
- package/build/browser/Logger.d.ts +0 -19
- package/build/browser/Logger.d.ts.map +0 -1
- package/build/browser/MinimalClientContext.d.ts +0 -26
- package/build/browser/MinimalClientContext.d.ts.map +0 -1
- package/build/browser/ResultOrError.d.ts +0 -12
- package/build/browser/ResultOrError.d.ts.map +0 -1
- package/build/browser/SatisfiesSemver.d.ts +0 -4
- package/build/browser/SatisfiesSemver.d.ts.map +0 -1
- package/build/browser/SatisfiesSemver.test.d.ts +0 -2
- package/build/browser/SatisfiesSemver.test.d.ts.map +0 -1
- package/build/browser/__unstable/ConjureSupport.d.ts +0 -55
- package/build/browser/__unstable/ConjureSupport.d.ts.map +0 -1
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +0 -1
- package/build/browser/actions/ActionValidationError.d.ts +0 -6
- package/build/browser/actions/ActionValidationError.d.ts.map +0 -1
- package/build/browser/actions/actions.test.d.ts +0 -2
- package/build/browser/actions/actions.test.d.ts.map +0 -1
- package/build/browser/actions/applyAction.d.ts +0 -30
- package/build/browser/actions/applyAction.d.ts.map +0 -1
- 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/browser/createClient.d.ts.map +0 -1
- package/build/browser/createClient.test.d.ts +0 -2
- package/build/browser/createClient.test.d.ts.map +0 -1
- package/build/browser/createGeotimeSeriesProperty.d.ts +0 -14
- package/build/browser/createGeotimeSeriesProperty.d.ts.map +0 -1
- package/build/browser/createMinimalClient.d.ts +0 -2
- package/build/browser/createMinimalClient.d.ts.map +0 -1
- package/build/browser/createPlatformClient.d.ts +0 -17
- package/build/browser/createPlatformClient.d.ts.map +0 -1
- package/build/browser/createTimeseriesProperty.d.ts +0 -14
- package/build/browser/createTimeseriesProperty.d.ts.map +0 -1
- package/build/browser/definitions/LinkDefinitions.test.d.ts +0 -2
- package/build/browser/definitions/LinkDefinitions.test.d.ts.map +0 -1
- package/build/browser/fetchMetadata.d.ts +0 -2
- package/build/browser/fetchMetadata.d.ts.map +0 -1
- package/build/browser/fetchMetadata.test.d.ts +0 -2
- package/build/browser/fetchMetadata.test.d.ts.map +0 -1
- package/build/browser/index.d.ts +0 -13
- package/build/browser/index.d.ts.map +0 -1
- package/build/browser/intellisense.test.d.ts +0 -2
- package/build/browser/intellisense.test.d.ts.map +0 -1
- package/build/browser/intellisense.test.helpers/callsQueryAcceptsObject.d.ts +0 -2
- package/build/browser/intellisense.test.helpers/callsQueryAcceptsObject.d.ts.map +0 -1
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.d.ts +0 -2
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.d.ts.map +0 -1
- package/build/browser/internal/conversions/modernToLegacyAggregationClause.d.ts +0 -2
- package/build/browser/internal/conversions/modernToLegacyAggregationClause.d.ts.map +0 -1
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.d.ts +0 -2
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.d.ts.map +0 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.d.ts.map +0 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.d.ts +0 -2
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.d.ts.map +0 -1
- package/build/browser/object/AttachmentUpload.d.ts.map +0 -1
- package/build/browser/object/Cache.d.ts +0 -2
- package/build/browser/object/Cache.d.ts.map +0 -1
- package/build/browser/object/Cache.test.d.ts +0 -11
- package/build/browser/object/Cache.test.d.ts.map +0 -1
- package/build/browser/object/SimpleCache.d.ts +0 -38
- package/build/browser/object/SimpleCache.d.ts.map +0 -1
- package/build/browser/object/aggregate.d.ts +0 -2
- package/build/browser/object/aggregate.d.ts.map +0 -1
- package/build/browser/object/aggregate.test.d.ts +0 -2
- package/build/browser/object/aggregate.test.d.ts.map +0 -1
- package/build/browser/object/attachment.test.d.ts +0 -2
- package/build/browser/object/attachment.test.d.ts.map +0 -1
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +0 -11
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +0 -1
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -14
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +0 -1
- package/build/browser/object/convertWireToOsdkObjects/ObjectHolder.d.ts +0 -2
- package/build/browser/object/convertWireToOsdkObjects/ObjectHolder.d.ts.map +0 -1
- package/build/browser/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.d.ts +0 -2
- package/build/browser/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.d.ts.map +0 -1
- package/build/browser/object/convertWireToOsdkObjects/PropertyDescriptorRecord.d.ts +0 -8
- package/build/browser/object/convertWireToOsdkObjects/PropertyDescriptorRecord.d.ts.map +0 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.d.ts +0 -2
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.d.ts.map +0 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.test.d.ts +0 -2
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.test.d.ts.map +0 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.d.ts +0 -2
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.d.ts.map +0 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarAs.d.ts.map +0 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.d.ts +0 -2
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.d.ts.map +0 -1
- package/build/browser/object/convertWireToOsdkObjects.d.ts +0 -2
- package/build/browser/object/convertWireToOsdkObjects.d.ts.map +0 -1
- package/build/browser/object/convertWireToOsdkObjects.test.d.ts +0 -2
- package/build/browser/object/convertWireToOsdkObjects.test.d.ts.map +0 -1
- package/build/browser/object/fetchPage.d.ts +0 -3
- package/build/browser/object/fetchPage.d.ts.map +0 -1
- package/build/browser/object/fetchPage.test.d.ts +0 -2
- package/build/browser/object/fetchPage.test.d.ts.map +0 -1
- package/build/browser/object/fetchSingle.d.ts +0 -2
- package/build/browser/object/fetchSingle.d.ts.map +0 -1
- package/build/browser/object/geotimeseriesreference.test.d.ts +0 -2
- package/build/browser/object/geotimeseriesreference.test.d.ts.map +0 -1
- package/build/browser/object/object.test.d.ts +0 -12
- package/build/browser/object/object.test.d.ts.map +0 -1
- package/build/browser/object/timeseries.test.d.ts +0 -2
- package/build/browser/object/timeseries.test.d.ts.map +0 -1
- package/build/browser/objectSet/ObjectSet.test.d.ts +0 -2
- package/build/browser/objectSet/ObjectSet.test.d.ts.map +0 -1
- package/build/browser/objectSet/ObjectSetFactory.d.ts +0 -2
- package/build/browser/objectSet/ObjectSetFactory.d.ts.map +0 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.d.ts +0 -2
- package/build/browser/objectSet/ObjectSetListenerWebsocket.d.ts.map +0 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.d.ts +0 -2
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.d.ts.map +0 -1
- package/build/browser/objectSet/conjureUnionType.d.ts +0 -13
- package/build/browser/objectSet/conjureUnionType.d.ts.map +0 -1
- package/build/browser/objectSet/createObjectSet.d.ts +0 -2
- package/build/browser/objectSet/createObjectSet.d.ts.map +0 -1
- package/build/browser/objectSet/toConjureObjectSet.d.ts +0 -2
- package/build/browser/objectSet/toConjureObjectSet.d.ts.map +0 -1
- package/build/browser/objectSet/toConjureObjectSet.js +0 -165
- package/build/browser/objectSet/toConjureObjectSet.js.map +0 -1
- package/build/browser/ontology/OntologyProvider.d.ts +0 -32
- package/build/browser/ontology/OntologyProvider.d.ts.map +0 -1
- package/build/browser/ontology/StandardOntologyProvider.d.ts.map +0 -1
- package/build/browser/ontology/StandardOntologyProvider.test.d.ts +0 -2
- package/build/browser/ontology/StandardOntologyProvider.test.d.ts.map +0 -1
- package/build/browser/ontology/loadActionMetadata.d.ts.map +0 -1
- package/build/browser/ontology/loadFullObjectMetadata.d.ts +0 -6
- package/build/browser/ontology/loadFullObjectMetadata.d.ts.map +0 -1
- package/build/browser/ontology/loadInterfaceMetadata.d.ts +0 -4
- package/build/browser/ontology/loadInterfaceMetadata.d.ts.map +0 -1
- package/build/browser/ontology/loadQueryMetadata.d.ts +0 -4
- package/build/browser/ontology/loadQueryMetadata.d.ts.map +0 -1
- package/build/browser/ontology/makeConjureContext.d.ts.map +0 -1
- package/build/browser/pageRequestAsAsyncIter.d.ts +0 -10
- package/build/browser/pageRequestAsAsyncIter.d.ts.map +0 -1
- package/build/browser/public/unstable-do-not-use.d.ts.map +0 -1
- package/build/browser/queries/applyQuery.d.ts +0 -6
- package/build/browser/queries/applyQuery.d.ts.map +0 -1
- package/build/browser/queries/queries.test.d.ts +0 -2
- package/build/browser/queries/queries.test.d.ts.map +0 -1
- package/build/browser/queries/types.d.ts +0 -20
- package/build/browser/queries/types.d.ts.map +0 -1
- package/build/browser/tsserver.d.ts +0 -34
- package/build/browser/tsserver.d.ts.map +0 -1
- package/build/browser/util/ArrayElement.d.ts.map +0 -1
- package/build/browser/util/NOOP.d.ts +0 -4
- package/build/browser/util/NOOP.d.ts.map +0 -1
- package/build/browser/util/NullableProps.d.ts +0 -6
- package/build/browser/util/NullableProps.d.ts.map +0 -1
- package/build/browser/util/UserAgent.d.ts.map +0 -1
- package/build/browser/util/WireObjectSet.d.ts +0 -2
- package/build/browser/util/WireObjectSet.d.ts.map +0 -1
- package/build/browser/util/addUserAgentAndRequestContextHeaders.d.ts +0 -4
- package/build/browser/util/addUserAgentAndRequestContextHeaders.d.ts.map +0 -1
- package/build/browser/util/augmentRequestContext.d.ts.map +0 -1
- package/build/browser/util/isOntologyObjectV2.d.ts +0 -2
- package/build/browser/util/isOntologyObjectV2.d.ts.map +0 -1
- package/build/browser/util/isOsdkBaseObject.d.ts +0 -3
- package/build/browser/util/isOsdkBaseObject.d.ts.map +0 -1
- package/build/browser/util/isOsdkObject.d.ts.map +0 -1
- package/build/browser/util/partialBy.d.ts +0 -3
- package/build/browser/util/partialBy.d.ts.map +0 -1
- package/build/browser/util/streamutils.d.ts.map +0 -1
- package/build/browser/util/timeseriesUtils.d.ts.map +0 -1
- package/build/browser/util/toDataValue.d.ts +0 -2
- package/build/browser/util/toDataValue.d.ts.map +0 -1
- package/build/browser/util/toDataValue.test.d.ts +0 -2
- package/build/browser/util/toDataValue.test.d.ts.map +0 -1
- package/build/browser/util/toDataValueQueries.d.ts +0 -2
- package/build/browser/util/toDataValueQueries.d.ts.map +0 -1
- package/build/esm/Client.d.ts +0 -42
- package/build/esm/Client.d.ts.map +0 -1
- package/build/esm/Definitions.test.d.ts +0 -2
- package/build/esm/Definitions.test.d.ts.map +0 -1
- package/build/esm/Logger.d.ts +0 -19
- package/build/esm/Logger.d.ts.map +0 -1
- package/build/esm/MinimalClientContext.d.ts +0 -26
- package/build/esm/MinimalClientContext.d.ts.map +0 -1
- package/build/esm/ResultOrError.d.ts +0 -12
- package/build/esm/ResultOrError.d.ts.map +0 -1
- package/build/esm/SatisfiesSemver.d.ts +0 -4
- package/build/esm/SatisfiesSemver.d.ts.map +0 -1
- package/build/esm/SatisfiesSemver.test.d.ts +0 -2
- package/build/esm/SatisfiesSemver.test.d.ts.map +0 -1
- package/build/esm/__unstable/ConjureSupport.d.ts +0 -55
- package/build/esm/__unstable/ConjureSupport.d.ts.map +0 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts +0 -10
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +0 -1
- package/build/esm/actions/ActionValidationError.d.ts +0 -6
- package/build/esm/actions/ActionValidationError.d.ts.map +0 -1
- package/build/esm/actions/actions.test.d.ts +0 -2
- package/build/esm/actions/actions.test.d.ts.map +0 -1
- package/build/esm/actions/applyAction.d.ts.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
- package/build/esm/createClient.d.ts +0 -6
- package/build/esm/createClient.d.ts.map +0 -1
- package/build/esm/createClient.test.d.ts +0 -2
- package/build/esm/createClient.test.d.ts.map +0 -1
- package/build/esm/createGeotimeSeriesProperty.d.ts +0 -14
- package/build/esm/createGeotimeSeriesProperty.d.ts.map +0 -1
- package/build/esm/createMinimalClient.d.ts +0 -2
- package/build/esm/createMinimalClient.d.ts.map +0 -1
- package/build/esm/createPlatformClient.d.ts +0 -17
- package/build/esm/createPlatformClient.d.ts.map +0 -1
- package/build/esm/createTimeseriesProperty.d.ts +0 -14
- package/build/esm/createTimeseriesProperty.d.ts.map +0 -1
- package/build/esm/definitions/LinkDefinitions.test.d.ts +0 -2
- package/build/esm/definitions/LinkDefinitions.test.d.ts.map +0 -1
- package/build/esm/fetchMetadata.d.ts +0 -2
- package/build/esm/fetchMetadata.d.ts.map +0 -1
- package/build/esm/fetchMetadata.test.d.ts +0 -2
- package/build/esm/fetchMetadata.test.d.ts.map +0 -1
- package/build/esm/index.d.ts +0 -13
- package/build/esm/index.d.ts.map +0 -1
- package/build/esm/intellisense.test.d.ts +0 -2
- package/build/esm/intellisense.test.d.ts.map +0 -1
- package/build/esm/intellisense.test.helpers/callsQueryAcceptsObject.d.ts +0 -2
- package/build/esm/intellisense.test.helpers/callsQueryAcceptsObject.d.ts.map +0 -1
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.d.ts +0 -2
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.d.ts.map +0 -1
- package/build/esm/internal/conversions/modernToLegacyAggregationClause.d.ts +0 -2
- package/build/esm/internal/conversions/modernToLegacyAggregationClause.d.ts.map +0 -1
- package/build/esm/internal/conversions/modernToLegacyGroupByClause.d.ts +0 -2
- package/build/esm/internal/conversions/modernToLegacyGroupByClause.d.ts.map +0 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.d.ts +0 -2
- package/build/esm/internal/conversions/modernToLegacyWhereClause.d.ts.map +0 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.d.ts +0 -2
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.d.ts.map +0 -1
- package/build/esm/object/AttachmentUpload.d.ts +0 -4
- package/build/esm/object/AttachmentUpload.d.ts.map +0 -1
- package/build/esm/object/Cache.d.ts +0 -2
- package/build/esm/object/Cache.d.ts.map +0 -1
- package/build/esm/object/Cache.test.d.ts +0 -11
- package/build/esm/object/Cache.test.d.ts.map +0 -1
- package/build/esm/object/SimpleCache.d.ts +0 -38
- package/build/esm/object/SimpleCache.d.ts.map +0 -1
- package/build/esm/object/aggregate.d.ts +0 -2
- package/build/esm/object/aggregate.d.ts.map +0 -1
- package/build/esm/object/aggregate.test.d.ts +0 -2
- package/build/esm/object/aggregate.test.d.ts.map +0 -1
- package/build/esm/object/attachment.test.d.ts +0 -2
- package/build/esm/object/attachment.test.d.ts.map +0 -1
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +0 -11
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +0 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts +0 -14
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +0 -1
- package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.d.ts +0 -2
- package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.d.ts.map +0 -1
- package/build/esm/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.d.ts +0 -2
- package/build/esm/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.d.ts.map +0 -1
- package/build/esm/object/convertWireToOsdkObjects/PropertyDescriptorRecord.d.ts +0 -8
- package/build/esm/object/convertWireToOsdkObjects/PropertyDescriptorRecord.d.ts.map +0 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.d.ts +0 -2
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.d.ts.map +0 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.test.d.ts +0 -2
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.test.d.ts.map +0 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.d.ts +0 -2
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.d.ts.map +0 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.d.ts +0 -3
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.d.ts.map +0 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.d.ts +0 -2
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.d.ts.map +0 -1
- package/build/esm/object/convertWireToOsdkObjects.d.ts +0 -2
- package/build/esm/object/convertWireToOsdkObjects.d.ts.map +0 -1
- package/build/esm/object/convertWireToOsdkObjects.test.d.ts +0 -2
- package/build/esm/object/convertWireToOsdkObjects.test.d.ts.map +0 -1
- package/build/esm/object/fetchPage.d.ts +0 -3
- package/build/esm/object/fetchPage.d.ts.map +0 -1
- package/build/esm/object/fetchPage.test.d.ts +0 -2
- package/build/esm/object/fetchPage.test.d.ts.map +0 -1
- package/build/esm/object/fetchSingle.d.ts +0 -2
- package/build/esm/object/fetchSingle.d.ts.map +0 -1
- package/build/esm/object/geotimeseriesreference.test.d.ts +0 -2
- package/build/esm/object/geotimeseriesreference.test.d.ts.map +0 -1
- package/build/esm/object/object.test.d.ts.map +0 -1
- package/build/esm/object/timeseries.test.d.ts +0 -2
- package/build/esm/object/timeseries.test.d.ts.map +0 -1
- package/build/esm/objectSet/ObjectSet.test.d.ts +0 -2
- package/build/esm/objectSet/ObjectSet.test.d.ts.map +0 -1
- package/build/esm/objectSet/ObjectSetFactory.d.ts +0 -2
- package/build/esm/objectSet/ObjectSetFactory.d.ts.map +0 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.d.ts +0 -2
- package/build/esm/objectSet/ObjectSetListenerWebsocket.d.ts.map +0 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.d.ts +0 -2
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.d.ts.map +0 -1
- package/build/esm/objectSet/conjureUnionType.d.ts +0 -13
- package/build/esm/objectSet/conjureUnionType.d.ts.map +0 -1
- package/build/esm/objectSet/createObjectSet.d.ts +0 -2
- package/build/esm/objectSet/createObjectSet.d.ts.map +0 -1
- package/build/esm/objectSet/toConjureObjectSet.d.ts +0 -2
- package/build/esm/objectSet/toConjureObjectSet.d.ts.map +0 -1
- package/build/esm/objectSet/toConjureObjectSet.js +0 -165
- package/build/esm/objectSet/toConjureObjectSet.js.map +0 -1
- package/build/esm/ontology/OntologyProvider.d.ts +0 -32
- package/build/esm/ontology/OntologyProvider.d.ts.map +0 -1
- package/build/esm/ontology/StandardOntologyProvider.d.ts +0 -5
- package/build/esm/ontology/StandardOntologyProvider.d.ts.map +0 -1
- package/build/esm/ontology/StandardOntologyProvider.test.d.ts +0 -2
- package/build/esm/ontology/StandardOntologyProvider.test.d.ts.map +0 -1
- package/build/esm/ontology/loadActionMetadata.d.ts +0 -4
- package/build/esm/ontology/loadActionMetadata.d.ts.map +0 -1
- package/build/esm/ontology/loadFullObjectMetadata.d.ts.map +0 -1
- package/build/esm/ontology/loadInterfaceMetadata.d.ts.map +0 -1
- package/build/esm/ontology/loadQueryMetadata.d.ts.map +0 -1
- package/build/esm/ontology/makeConjureContext.d.ts +0 -4
- package/build/esm/ontology/makeConjureContext.d.ts.map +0 -1
- package/build/esm/pageRequestAsAsyncIter.d.ts +0 -10
- package/build/esm/pageRequestAsAsyncIter.d.ts.map +0 -1
- package/build/esm/public/unstable-do-not-use.d.ts +0 -2
- package/build/esm/public/unstable-do-not-use.d.ts.map +0 -1
- package/build/esm/queries/applyQuery.d.ts.map +0 -1
- package/build/esm/queries/queries.test.d.ts +0 -2
- package/build/esm/queries/queries.test.d.ts.map +0 -1
- package/build/esm/queries/types.d.ts.map +0 -1
- package/build/esm/tsserver.d.ts.map +0 -1
- package/build/esm/util/ArrayElement.d.ts +0 -2
- package/build/esm/util/ArrayElement.d.ts.map +0 -1
- package/build/esm/util/NOOP.d.ts +0 -4
- package/build/esm/util/NOOP.d.ts.map +0 -1
- package/build/esm/util/NullableProps.d.ts +0 -6
- package/build/esm/util/NullableProps.d.ts.map +0 -1
- package/build/esm/util/UserAgent.d.ts +0 -2
- package/build/esm/util/UserAgent.d.ts.map +0 -1
- package/build/esm/util/WireObjectSet.d.ts +0 -2
- package/build/esm/util/WireObjectSet.d.ts.map +0 -1
- package/build/esm/util/addUserAgentAndRequestContextHeaders.d.ts.map +0 -1
- package/build/esm/util/augmentRequestContext.d.ts +0 -32
- package/build/esm/util/augmentRequestContext.d.ts.map +0 -1
- package/build/esm/util/isOntologyObjectV2.d.ts +0 -2
- package/build/esm/util/isOntologyObjectV2.d.ts.map +0 -1
- package/build/esm/util/isOsdkBaseObject.d.ts +0 -3
- package/build/esm/util/isOsdkBaseObject.d.ts.map +0 -1
- package/build/esm/util/isOsdkObject.d.ts.map +0 -1
- package/build/esm/util/partialBy.d.ts +0 -3
- package/build/esm/util/partialBy.d.ts.map +0 -1
- package/build/esm/util/streamutils.d.ts +0 -3
- package/build/esm/util/streamutils.d.ts.map +0 -1
- package/build/esm/util/timeseriesUtils.d.ts +0 -8
- package/build/esm/util/timeseriesUtils.d.ts.map +0 -1
- package/build/esm/util/toDataValue.d.ts +0 -2
- package/build/esm/util/toDataValue.d.ts.map +0 -1
- package/build/esm/util/toDataValue.test.d.ts +0 -2
- package/build/esm/util/toDataValue.test.d.ts.map +0 -1
- package/build/esm/util/toDataValueQueries.d.ts +0 -2
- package/build/esm/util/toDataValueQueries.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyAction.js","names":["OntologiesV2","invariant","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValue","ActionValidationError","applyAction","client","action","parameters","options","clientWithHeaders","finalMethodCall","Array","isArray","response","Actions","applyBatch","ontologyRid","apiName","requests","remapBatchActionParams","returnEdits","$returnEdits","edits","type","remapActionResponse","undefined","apply","remapActionParams","mode","$validateOnly","validation","result","params","parameterMap","key","value","Object","entries","remappedParams","Promise","all","map","param","editResponses","remappedActionResponse","deletedLinksCount","deletedObjectsCount","addedLinks","addedObjects","modifiedObjects","editedObjectTypes","editedObjectTypesSet","Set","edit","push","linkTypeApiNameAtoB","linkTypeApiNameBtoA","aSideObject","bSideObject","add","objectType","primaryKey"],"sources":["applyAction.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 { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\nexport async function applyAction(client, action, parameters, options = {}) {\n const clientWithHeaders = addUserAgentAndRequestContextHeaders(augmentRequestContext(client, _ => ({ finalMethodCall: \"applyAction\" })), action);\n if (Array.isArray(parameters)) {\n const response = await OntologiesV2.Actions.applyBatch(clientWithHeaders, await client.ontologyRid, action.apiName, {\n requests: parameters\n ? await remapBatchActionParams(parameters, client)\n : [],\n options: {\n returnEdits: options?.$returnEdits ? \"ALL\" : \"NONE\",\n },\n });\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined);\n }\n else {\n const response = await OntologiesV2.Actions.apply(clientWithHeaders, await client.ontologyRid, action.apiName, {\n parameters: await remapActionParams(parameters, client),\n options: {\n mode: options?.$validateOnly\n ? \"VALIDATE_ONLY\"\n : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options\n ?.$returnEdits\n ? \"ALL\"\n : \"NONE\",\n },\n });\n if (options?.$validateOnly) {\n return response.validation;\n }\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined);\n }\n}\nasync function remapActionParams(params, client) {\n if (params == null) {\n return {};\n }\n const parameterMap = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValue(value, client);\n }\n return parameterMap;\n}\nasync function remapBatchActionParams(params, client) {\n const remappedParams = await Promise.all(params.map(async (param) => {\n return { parameters: await remapActionParams(param, client) };\n }));\n return remappedParams;\n}\nexport function remapActionResponse(response) {\n const editResponses = response?.edits;\n if (editResponses?.type === \"edits\") {\n const remappedActionResponse = {\n type: editResponses.type,\n deletedLinksCount: editResponses.deletedLinksCount,\n deletedObjectsCount: editResponses.deletedObjectsCount,\n addedLinks: [],\n addedObjects: [],\n modifiedObjects: [],\n editedObjectTypes: [],\n };\n const editedObjectTypesSet = new Set();\n for (const edit of editResponses.edits) {\n if (edit.type === \"addLink\") {\n remappedActionResponse.addedLinks.push({\n linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,\n linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,\n aSideObject: edit.aSideObject,\n bSideObject: edit.bSideObject,\n });\n editedObjectTypesSet.add(edit.aSideObject.objectType);\n editedObjectTypesSet.add(edit.bSideObject.objectType);\n }\n else if (edit.type === \"addObject\") {\n remappedActionResponse.addedObjects.push({\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n });\n editedObjectTypesSet.add(edit.objectType);\n }\n else if (edit.type === \"modifyObject\") {\n remappedActionResponse.modifiedObjects.push({\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n });\n editedObjectTypesSet.add(edit.objectType);\n }\n else {\n invariant(false, \"Unknown edit type\");\n }\n }\n remappedActionResponse.editedObjectTypes = [...editedObjectTypesSet];\n return remappedActionResponse;\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,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,qBAAqB,QAAQ,kCAAkC;AACxE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,OAAO,eAAeC,WAAWA,C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AI,CAACO,UAAU,CAAC;MAC7C,CAAC,MACI;QACD7D,SAAS,QAAQ,mBAAmB;MACxC;IACJ;IACA6C,sBAAsB,CAACM,iBAAiB,GAAG,CAAC,GAAGC,oBAAoB,CAAC;IACpE,OAAOP,sBAAsB;EACjC;AACJ","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"applyAction.js","names":["OntologiesV2","invariant","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValue","ActionValidationError","applyAction","client","action","parameters","options","clientWithHeaders","finalMethodCall","Array","isArray","response","Actions","applyBatch","ontologyRid","apiName","requests","remapBatchActionParams","returnEdits","$returnEdits","edits","type","remapActionResponse","undefined","apply","remapActionParams","mode","$validateOnly","validation","result","params","parameterMap","key","value","Object","entries","remappedParams","Promise","all","map","param","editResponses","remappedActionResponse","deletedLinksCount","deletedObjectsCount","addedLinks","addedObjects","modifiedObjects","editedObjectTypes","editedObjectTypesSet","Set","edit","push","linkTypeApiNameAtoB","linkTypeApiNameBtoA","aSideObject","bSideObject","add","objectType","primaryKey","process","env","NODE_ENV"],"sources":["applyAction.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n DataValueClientToWire,\n} from \"@osdk/api\";\nimport type {\n BatchApplyActionResponseV2,\n DataValue,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport type { NOOP } from \"../util/NOOP.js\";\nimport type { NullableProps } from \"../util/NullableProps.js\";\nimport type { PartialBy } from \"../util/partialBy.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\ntype BaseType<APD extends Pick<ActionMetadata.Parameter<any>, \"type\">> =\n APD[\"type\"] extends ActionMetadata.DataType.Object<infer TTargetType>\n ? ActionParam.ObjectType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.ObjectSet<infer TTargetType>\n ? ActionParam.ObjectSetType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.Struct<infer TStructType>\n ? ActionParam.StructType<TStructType>\n : APD[\"type\"] extends keyof DataValueClientToWire\n ? ActionParam.PrimitiveType<APD[\"type\"]>\n : never;\n\ntype MaybeArrayType<APD extends ActionMetadata.Parameter<any>> =\n APD[\"multiplicity\"] extends true ? Array<BaseType<APD>>\n : BaseType<APD>;\n\ntype NotOptionalParams<X extends ActionParametersDefinition> = {\n [P in keyof X]: MaybeArrayType<X[P]>;\n};\n\nexport type OsdkActionParameters<\n X extends ActionParametersDefinition,\n> = NullableProps<X> extends never ? NotOptionalParams<X>\n : PartialBy<NotOptionalParams<X>, NullableProps<X>>;\n\nexport type CompileTimeActionMetadata<\n T extends ActionDefinition<any>,\n> = NonNullable<T[\"__DefinitionMetadata\"]>;\n\nexport type ActionSignatureFromDef<\n T extends ActionDefinition<any>,\n> = {\n applyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"]] extends [never]\n ? ActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"];\n\n batchApplyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"]] extends\n [never] ? BatchActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"];\n};\n\ntype ActionParametersDefinition = Record<\n any,\n ActionMetadata.Parameter<any>\n>;\n\nexport type ActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>,\n OP extends ApplyActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport type BatchActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>[],\n OP extends ApplyBatchActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport async function applyAction<\n AD extends ActionDefinition<any>,\n P extends\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n Op extends P extends OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >[] ? ApplyBatchActionOptions\n : ApplyActionOptions,\n>(\n client: MinimalClient,\n action: AD,\n parameters?: P,\n options: Op = {} as Op,\n): Promise<\n ActionReturnTypeForOptions<Op>\n> {\n const clientWithHeaders = addUserAgentAndRequestContextHeaders(\n augmentRequestContext(client, _ => ({ finalMethodCall: \"applyAction\" })),\n action,\n );\n if (Array.isArray(parameters)) {\n const response = await OntologiesV2.Actions.applyBatch(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n requests: parameters\n ? await remapBatchActionParams(parameters, client)\n : [],\n options: {\n returnEdits: options?.$returnEdits ? \"ALL\" : \"NONE\",\n },\n },\n );\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n } else {\n const response = await OntologiesV2.Actions.apply(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n parameters: await remapActionParams(\n parameters as OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >,\n client,\n ),\n options: {\n mode: (options as ApplyActionOptions)?.$validateOnly\n ? \"VALIDATE_ONLY\"\n : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options\n ?.$returnEdits\n ? \"ALL\"\n : \"NONE\",\n },\n },\n );\n\n if ((options as ApplyActionOptions)?.$validateOnly) {\n return response.validation as ActionReturnTypeForOptions<Op>;\n }\n\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n }\n}\n\nasync function remapActionParams<AD extends ActionDefinition<any>>(\n params:\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | undefined,\n client: MinimalClient,\n): Promise<Record<string, DataValue>> {\n if (params == null) {\n return {};\n }\n\n const parameterMap: { [parameterName: string]: unknown } = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValue(value, client);\n }\n\n return parameterMap;\n}\n\nasync function remapBatchActionParams<\n AD extends ActionDefinition<any>,\n>(\n params: OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n client: MinimalClient,\n) {\n const remappedParams = await Promise.all(params.map(\n async param => {\n return { parameters: await remapActionParams<AD>(param, client) };\n },\n ));\n\n return remappedParams;\n}\n\nexport function remapActionResponse(\n response: SyncApplyActionResponseV2 | BatchApplyActionResponseV2,\n): ActionEditResponse | undefined {\n const editResponses = response?.edits;\n if (editResponses?.type === \"edits\") {\n const remappedActionResponse: ActionEditResponse = {\n type: editResponses.type,\n deletedLinksCount: editResponses.deletedLinksCount,\n deletedObjectsCount: editResponses.deletedObjectsCount,\n addedLinks: [],\n addedObjects: [],\n modifiedObjects: [],\n editedObjectTypes: [],\n };\n\n const editedObjectTypesSet = new Set<string>();\n for (const edit of editResponses.edits) {\n if (edit.type === \"addLink\") {\n remappedActionResponse.addedLinks.push(\n {\n linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,\n linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,\n aSideObject: edit.aSideObject,\n bSideObject: edit.bSideObject,\n },\n );\n editedObjectTypesSet.add(edit.aSideObject.objectType);\n editedObjectTypesSet.add(edit.bSideObject.objectType);\n } else if (edit.type === \"addObject\") {\n remappedActionResponse.addedObjects.push(\n {\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n },\n );\n editedObjectTypesSet.add(edit.objectType);\n } else if (edit.type === \"modifyObject\") {\n remappedActionResponse.modifiedObjects.push({\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n });\n editedObjectTypesSet.add(edit.objectType);\n } else {\n invariant(false, \"Unknown edit type\");\n }\n }\n remappedActionResponse.editedObjectTypes = [...editedObjectTypesSet];\n return remappedActionResponse;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AACxD,OAAOC,SAAS,MAAM,gBAAgB;AAEtC,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,qBAAqB,QAAQ,kCAAkC;AAIxE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,qBAAqB,QAAQ,4BAA4B;AAyElE,OAAO,eAAeC,WAAWA,CAU/BC,MAAqB,EACrBC,MAAU,EACVC,UAAc,EACdC,OAAW,GAAG,CAAC,CAAO,EAGtB;EACA,MAAMC,iBAAiB,GAAGT,oCAAoC,CAC5DC,qBAAqB,CAACI,MAAM,EAAE,OAAM;IAAEK,eAAe,EAAE;EAAc,CAAC,CAAC,CAAC,EACxEJ,MACF,CAAC;EACD,IAAIK,KAAK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AACF","ignoreList":[]}
|
|
@@ -13,16 +13,25 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
import { __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference, __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid, __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks } from "@osdk/api/unstable";
|
|
18
|
+
import * as OntologiesV2 from "@osdk/foundry.ontologies";
|
|
17
19
|
import { symbolClientContext as oldSymbolClientContext } from "@osdk/shared.client";
|
|
18
|
-
import { symbolClientContext } from "@osdk/shared.client2";
|
|
19
20
|
import { createBulkLinksAsyncIterFactory } from "./__unstable/createBulkLinksAsyncIterFactory.js";
|
|
20
21
|
import { applyAction } from "./actions/applyAction.js";
|
|
21
22
|
import { additionalContext } from "./Client.js";
|
|
22
23
|
import { createMinimalClient } from "./createMinimalClient.js";
|
|
23
24
|
import { fetchMetadataInternal } from "./fetchMetadata.js";
|
|
25
|
+
import { fetchSingle } from "./object/fetchSingle.js";
|
|
24
26
|
import { createObjectSet } from "./objectSet/createObjectSet.js";
|
|
25
27
|
import { applyQuery } from "./queries/applyQuery.js";
|
|
28
|
+
|
|
29
|
+
// We import it this way to keep compatible with CJS. If we referenced the
|
|
30
|
+
// value of `symbolClientContext` directly, then we would have to a dynamic import
|
|
31
|
+
// in `createClientInternal` which would make it async and a break.
|
|
32
|
+
// Since this is just a string in `@osdk/shared.client2` instead of a symbol,
|
|
33
|
+
// we can safely perform this trick.
|
|
34
|
+
|
|
26
35
|
class ActionInvoker {
|
|
27
36
|
constructor(clientCtx, actionDef) {
|
|
28
37
|
// We type the property as a generic function as binding `applyAction`
|
|
@@ -32,15 +41,13 @@ class ActionInvoker {
|
|
|
32
41
|
this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);
|
|
33
42
|
this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);
|
|
34
43
|
}
|
|
35
|
-
applyAction;
|
|
36
|
-
batchApplyAction;
|
|
37
44
|
}
|
|
38
45
|
class QueryInvoker {
|
|
39
46
|
constructor(clientCtx, queryDef) {
|
|
40
47
|
this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);
|
|
41
48
|
}
|
|
42
|
-
executeFunction;
|
|
43
49
|
}
|
|
50
|
+
|
|
44
51
|
/** @internal */
|
|
45
52
|
export function createClientInternal(objectSetFactory,
|
|
46
53
|
// first so i can bind
|
|
@@ -50,8 +57,10 @@ baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
|
50
57
|
throw new Error("Invalid ontology RID");
|
|
51
58
|
}
|
|
52
59
|
} else {
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
53
61
|
ontologyRid.then(ontologyRid => {
|
|
54
62
|
if (!ontologyRid.startsWith("ri.")) {
|
|
63
|
+
// FIXME this promise is not await so this just shows up as an unhandled promise rejection
|
|
55
64
|
throw new Error("Invalid ontology RID");
|
|
56
65
|
}
|
|
57
66
|
});
|
|
@@ -67,6 +76,35 @@ baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
|
67
76
|
return new ActionInvoker(clientCtx, o); // then as any for dealing with the conditional return value
|
|
68
77
|
} else if (o.type === "query") {
|
|
69
78
|
return new QueryInvoker(clientCtx, o);
|
|
79
|
+
} else if (o.type === "experiment") {
|
|
80
|
+
switch (o.name) {
|
|
81
|
+
case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:
|
|
82
|
+
return {
|
|
83
|
+
getBulkLinks: createBulkLinksAsyncIterFactory(clientCtx)
|
|
84
|
+
};
|
|
85
|
+
case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:
|
|
86
|
+
return {
|
|
87
|
+
fetchOneByRid: async (objectType, rid, options) => {
|
|
88
|
+
return await fetchSingle(clientCtx, objectType, options, createWithRid(rid));
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
case __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:
|
|
92
|
+
return {
|
|
93
|
+
createMediaReference: async args => {
|
|
94
|
+
const {
|
|
95
|
+
data,
|
|
96
|
+
fileName,
|
|
97
|
+
objectTypeApi,
|
|
98
|
+
propertyTypeApi
|
|
99
|
+
} = args;
|
|
100
|
+
return await OntologiesV2.MediaReferenceProperties.upload(clientCtx, await clientCtx.ontologyRid, objectTypeApi, propertyTypeApi, data, {
|
|
101
|
+
mediaItemPath: fileName,
|
|
102
|
+
preview: true
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
throw new Error("not implemented");
|
|
70
108
|
} else {
|
|
71
109
|
throw new Error("not implemented");
|
|
72
110
|
}
|
|
@@ -74,29 +112,12 @@ baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
|
74
112
|
[oldSymbolClientContext]: {
|
|
75
113
|
value: clientCtx
|
|
76
114
|
},
|
|
77
|
-
[
|
|
115
|
+
["__osdkClientContext"]: {
|
|
78
116
|
value: clientCtx
|
|
79
117
|
},
|
|
80
118
|
[additionalContext]: {
|
|
81
119
|
value: clientCtx
|
|
82
120
|
},
|
|
83
|
-
[__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks]: {
|
|
84
|
-
get: () => createBulkLinksAsyncIterFactory(clientCtx)
|
|
85
|
-
},
|
|
86
|
-
[__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet]: {
|
|
87
|
-
get: () => (definition, rid) => {
|
|
88
|
-
return createObjectSet(definition, client[additionalContext], {
|
|
89
|
-
type: "intersect",
|
|
90
|
-
objectSets: [{
|
|
91
|
-
type: "base",
|
|
92
|
-
objectType: definition.apiName
|
|
93
|
-
}, {
|
|
94
|
-
type: "reference",
|
|
95
|
-
reference: rid
|
|
96
|
-
}]
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
},
|
|
100
121
|
fetchMetadata: {
|
|
101
122
|
value: fetchMetadata
|
|
102
123
|
}
|
|
@@ -104,4 +125,10 @@ baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
|
104
125
|
return client;
|
|
105
126
|
}
|
|
106
127
|
export const createClient = createClientInternal.bind(undefined, createObjectSet);
|
|
128
|
+
function createWithRid(rid) {
|
|
129
|
+
return {
|
|
130
|
+
type: "static",
|
|
131
|
+
"objects": [rid]
|
|
132
|
+
};
|
|
133
|
+
}
|
|
107
134
|
//# sourceMappingURL=createClient.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.js","names":["__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","fetchMetadata","client","Object","defineProperties","o","type","value","get","definition","rid","objectSets","objectType","apiName","reference","createClient"],"sources":["createClient.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 { __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks, __EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet, } from \"@osdk/api/unstable\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { symbolClientContext } from \"@osdk/shared.client2\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nclass ActionInvoker {\n constructor(clientCtx, actionDef) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n applyAction;\n batchApplyAction;\n}\nclass QueryInvoker {\n constructor(clientCtx, queryDef) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n executeFunction;\n}\n/** @internal */\nexport function createClientInternal(objectSetFactory, // first so i can bind\nbaseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n }\n else {\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n const clientCtx = createMinimalClient({ ontologyRid }, baseUrl, tokenProvider, options, fetchFn, objectSetFactory);\n function clientFn(o) {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx);\n }\n else if (o.type === \"action\") {\n return new ActionInvoker(clientCtx, o); // then as any for dealing with the conditional return value\n }\n else if (o.type === \"query\") {\n return new QueryInvoker(clientCtx, o);\n }\n else {\n throw new Error(\"not implemented\");\n }\n }\n const fetchMetadata = fetchMetadataInternal.bind(undefined, clientCtx);\n const client = Object.defineProperties(clientFn, {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n [__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks]: {\n get: () => createBulkLinksAsyncIterFactory(clientCtx),\n },\n [__EXPERIMENTAL__NOT_SUPPORTED_YET__preexistingObjectSet]: {\n get: () => (definition, rid) => {\n return createObjectSet(definition, client[additionalContext], {\n type: \"intersect\",\n objectSets: [\n {\n type: \"base\",\n objectType: definition.apiName,\n },\n {\n type: \"reference\",\n reference: rid,\n },\n ],\n });\n },\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n });\n return client;\n}\nexport const createClient = createClientInternal.bind(undefined, createObjectSet);\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,+CAA+C,EAAEC,uDAAuD,QAAS,oBAAoB;AAC9I,SAASC,mBAAmB,IAAIC,sBAAsB,QAAQ,qBAAqB;AACnF,SAASD,mBAAmB,QAAQ,sBAAsB;AAC1D,SAASE,+BAA+B,QAAQ,iDAAiD;AACjG,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,qBAAqB,QAAQ,oBAAoB;AAC1D,SAASC,eAAe,QAAQ,gCAAgC;AAChE,SAASC,UAAU,QAAQ,yBAAyB;AACpD,MAAMC,aAAa,CAAC;EAChBC,WAAWA,CAACC,SAAS,EAAEC,SAAS,EAAE;IAC9B;IACA;IACA;IACA;IACA,IAAI,CAACT,WAAW,GAAGA,WAAW,CAACU,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEC,SAAS,CAAC;IACpE,IAAI,CAACG,gBAAgB,GAAGZ,WAAW,CAACU,IAAI,CAAC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aReference","__EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid","__EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks","OntologiesV2","symbolClientContext","oldSymbolClientContext","createBulkLinksAsyncIterFactory","applyAction","additionalContext","createMinimalClient","fetchMetadataInternal","fetchSingle","createObjectSet","applyQuery","ActionInvoker","constructor","clientCtx","actionDef","bind","undefined","batchApplyAction","QueryInvoker","queryDef","executeFunction","createClientInternal","objectSetFactory","baseUrl","ontologyRid","tokenProvider","options","fetchFn","fetch","startsWith","Error","then","fetchMetadata","client","Object","defineProperties","o","type","name","getBulkLinks","fetchOneByRid","objectType","rid","createWithRid","createMediaReference","args","data","fileName","objectTypeApi","propertyTypeApi","MediaReferenceProperties","upload","mediaItemPath","preview","value","createClient"],"sources":["createClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n InterfaceDefinition,\n NullabilityAdherence,\n ObjectOrInterfaceDefinition,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n PropertyKeys,\n QueryDefinition,\n SelectArg,\n} from \"@osdk/api\";\nimport type {\n Experiment,\n ExperimentFns,\n MinimalObjectSet,\n} from \"@osdk/api/unstable\";\nimport {\n __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid,\n __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks,\n} from \"@osdk/api/unstable\";\nimport type { ObjectSet as WireObjectSet } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport { symbolClientContext as oldSymbolClientContext } from \"@osdk/shared.client\";\nimport { createBulkLinksAsyncIterFactory } from \"./__unstable/createBulkLinksAsyncIterFactory.js\";\nimport type { ActionSignatureFromDef } from \"./actions/applyAction.js\";\nimport { applyAction } from \"./actions/applyAction.js\";\nimport { additionalContext, type Client } from \"./Client.js\";\nimport { createMinimalClient } from \"./createMinimalClient.js\";\nimport { fetchMetadataInternal } from \"./fetchMetadata.js\";\nimport type { Logger } from \"./Logger.js\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { fetchSingle } from \"./object/fetchSingle.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport { applyQuery } from \"./queries/applyQuery.js\";\nimport type { QuerySignatureFromDef } from \"./queries/types.js\";\n\n// We import it this way to keep compatible with CJS. If we referenced the\n// value of `symbolClientContext` directly, then we would have to a dynamic import\n// in `createClientInternal` which would make it async and a break.\n// Since this is just a string in `@osdk/shared.client2` instead of a symbol,\n// we can safely perform this trick.\ntype newSymbolClientContext =\n // eslint-disable-next-line @typescript-eslint/consistent-type-imports\n typeof import(\"@osdk/shared.client2\").symbolClientContext;\n\nclass ActionInvoker<Q extends ActionDefinition<any>>\n implements ActionSignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n actionDef: ActionDefinition<any>,\n ) {\n // We type the property as a generic function as binding `applyAction`\n // doesn't return a type thats all that useful anyway\n // The implements covers us for the most part here as this exact type doesn't\n // escape this file\n this.applyAction = applyAction.bind(undefined, clientCtx, actionDef);\n this.batchApplyAction = applyAction.bind(undefined, clientCtx, actionDef);\n }\n\n applyAction: (...args: any[]) => any;\n batchApplyAction: (...args: any[]) => any;\n}\n\nclass QueryInvoker<Q extends QueryDefinition<any>>\n implements QuerySignatureFromDef<Q>\n{\n constructor(\n clientCtx: MinimalClient,\n queryDef: QueryDefinition<any>,\n ) {\n this.executeFunction = applyQuery.bind(undefined, clientCtx, queryDef);\n }\n\n executeFunction: (...args: any[]) => any;\n}\n\n/** @internal */\nexport function createClientInternal(\n objectSetFactory: ObjectSetFactory<any, any>, // first so i can bind\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options: { logger?: Logger } | undefined = undefined,\n fetchFn: typeof globalThis.fetch = fetch,\n): Client {\n if (typeof ontologyRid === \"string\") {\n if (!ontologyRid.startsWith(\"ri.\")) {\n throw new Error(\"Invalid ontology RID\");\n }\n } else {\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n ontologyRid.then((ontologyRid) => {\n if (!ontologyRid.startsWith(\"ri.\")) {\n // FIXME this promise is not await so this just shows up as an unhandled promise rejection\n throw new Error(\"Invalid ontology RID\");\n }\n });\n }\n\n const clientCtx: MinimalClient = createMinimalClient(\n { ontologyRid },\n baseUrl,\n tokenProvider,\n options,\n fetchFn,\n objectSetFactory,\n );\n\n function clientFn<\n T extends\n | ObjectOrInterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n | Experiment<\"2.0.8\">\n | Experiment<\"2.1.0\">,\n >(o: T): T extends ObjectTypeDefinition ? ObjectSet<T>\n : T extends InterfaceDefinition ? MinimalObjectSet<T>\n : T extends ActionDefinition<any> ? ActionSignatureFromDef<T>\n : T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : T extends Experiment<\"2.0.8\"> | Experiment<\"2.1.0\">\n ? { invoke: ExperimentFns<T> }\n : never\n {\n if (o.type === \"object\" || o.type === \"interface\") {\n return objectSetFactory(o, clientCtx) as any;\n } else if (o.type === \"action\") {\n return new ActionInvoker(\n clientCtx,\n o,\n ) as (T extends ActionDefinition<any>\n // first `as` to the action definition for our \"real\" typecheck\n ? ActionSignatureFromDef<T>\n : never) as any; // then as any for dealing with the conditional return value\n } else if (o.type === \"query\") {\n return new QueryInvoker(\n clientCtx,\n o,\n ) as (T extends QueryDefinition<any> ? QuerySignatureFromDef<T>\n : never) as any;\n } else if (o.type === \"experiment\") {\n switch (o.name) {\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__getBulkLinks.name:\n return {\n getBulkLinks: createBulkLinksAsyncIterFactory(\n clientCtx,\n ),\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__fetchOneByRid.name:\n return {\n fetchOneByRid: async <\n Q extends ObjectTypeDefinition,\n const L extends PropertyKeys<Q>,\n const R extends boolean,\n const S extends false | \"throw\" = NullabilityAdherence.Default,\n >(\n objectType: Q,\n rid: string,\n options: SelectArg<Q, L, R, S>,\n ) => {\n return await fetchSingle(\n clientCtx,\n objectType,\n options,\n createWithRid(\n rid,\n ),\n ) as Osdk<Q>;\n },\n } as any;\n case __EXPERIMENTAL__NOT_SUPPORTED_YET__createMediaReference.name:\n return {\n createMediaReference: async (args: {\n data: Blob;\n fileName: string;\n objectTypeApi: string;\n propertyTypeApi: string;\n }) => {\n const { data, fileName, objectTypeApi, propertyTypeApi } = args;\n return await OntologiesV2.MediaReferenceProperties.upload(\n clientCtx,\n await clientCtx.ontologyRid,\n objectTypeApi,\n propertyTypeApi,\n data,\n {\n mediaItemPath: fileName,\n preview: true,\n },\n );\n },\n } as any;\n }\n\n throw new Error(\"not implemented\");\n } else {\n throw new Error(\"not implemented\");\n }\n }\n\n const fetchMetadata = fetchMetadataInternal.bind(\n undefined,\n clientCtx,\n );\n\n const symbolClientContext: newSymbolClientContext = \"__osdkClientContext\";\n\n const client: Client = Object.defineProperties<Client>(\n clientFn as Client,\n {\n [oldSymbolClientContext]: {\n value: clientCtx,\n },\n [symbolClientContext]: {\n value: clientCtx,\n },\n [additionalContext]: {\n value: clientCtx,\n },\n fetchMetadata: {\n value: fetchMetadata,\n },\n } satisfies Record<keyof Client, PropertyDescriptor>,\n );\n\n return client;\n}\n\nexport const createClient: (\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n options?: {\n logger?: Logger;\n } | undefined,\n fetchFn?: typeof fetch | undefined,\n) => Client = createClientInternal.bind(\n undefined,\n createObjectSet,\n);\n\nfunction createWithRid(\n rid: string,\n) {\n const withRid: WireObjectSet = {\n type: \"static\",\n \"objects\": [rid],\n };\n\n return withRid;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA,SACEA,uDAAuD,EACvDC,gDAAgD,EAChDC,+CAA+C,QAC1C,oBAAoB;AAE3B,OAAO,KAAKC,YAAY,MAAM,0BAA0B;AACxD,SAASC,mBAAmB,IAAIC,sBAAsB,QAAQ,qBAAqB;AACnF,SAASC,+BAA+B,QAAQ,iDAAiD;AAEjG,SAASC,WAAW,QAAQ,0BAA0B;AACtD,SAASC,iBAAiB,QAAqB,aAAa;AAC5D,SAASC,mBAAmB,QAAQ,0BAA0B;AAC9D,SAASC,qBAAqB,QAAQ,oBAAoB;AAG1D,SAASC,WAAW,QAAQ,yBAAyB;AACrD,SAASC,eAAe,QAAQ,gCAAgC;AAEhE,SAASC,UAAU,QAAQ,yBAAyB;;AAGpD;AACA;AACA;AACA;AACA;;AAKA,MAAMC,aAAa,CAEnB;EACEC,WAAWA,CACTC,SAAwB,EACxBC,SAAgC,EAChC;IACA;IACA;IACA;IACA;IACA,IAAI,CAACV,WAAW,GAAGA,WAAW,CAACW,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEC,SAAS,CAAC;IACpE,IAAI,CAACG,gBAAgB,GAAGb,WAAW,CAACW,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEC,SAAS,CAAC;EAC3E;AAIF;AAEA,MAAMI,YAAY,CAElB;EACEN,WAAWA,CACTC,SAAwB,EACxBM,QAA8B,EAC9B;IACA,IAAI,CAACC,eAAe,GAAGV,UAAU,CAACK,IAAI,CAACC,SAAS,EAAEH,SAAS,EAAEM,QAAQ,CAAC;EACxE;AAGF;;AAEA;AACA,OAAO,SAASE,oBAAoBA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SAAS,EACTP,eACF,CAAC;AAED,SAASkC,aAAaA,CACpBD,GAAW,EACX;EAMA,OAL+B;IAC7BL,IAAI,EAAE,QAAQ;IACd,SAAS,EAAE,CAACK,GAAG;EACjB,CAAC;AAGH","ignoreList":[]}
|
|
@@ -13,10 +13,14 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
|
|
16
17
|
import { Task } from "@osdk/client.test.ontology";
|
|
18
|
+
import * as SharedClientContext from "@osdk/shared.client.impl";
|
|
17
19
|
import { mockFetchResponse, MockOntology } from "@osdk/shared.test";
|
|
18
20
|
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
21
|
+
import { metadataCacheClient } from "./__unstable/ConjureSupport.js";
|
|
19
22
|
import { createClient } from "./createClient.js";
|
|
23
|
+
import * as MakeConjureContext from "./ontology/makeConjureContext.js";
|
|
20
24
|
import { USER_AGENT } from "./util/UserAgent.js";
|
|
21
25
|
describe(createClient, () => {
|
|
22
26
|
let fetchFunction;
|
|
@@ -41,5 +45,26 @@ describe(createClient, () => {
|
|
|
41
45
|
expect(parts).toEqual([...Task.osdkMetadata.extraUserAgent.split(" "), USER_AGENT]);
|
|
42
46
|
});
|
|
43
47
|
});
|
|
48
|
+
describe("check url formatting", () => {
|
|
49
|
+
it("urls are correctly formatted", async () => {
|
|
50
|
+
const spy = vi.spyOn(SharedClientContext, "createSharedClientContext");
|
|
51
|
+
const client = createClient("https://mock.com", MockOntology.metadata.ontologyRid, async () => "Token", undefined, fetchFunction);
|
|
52
|
+
expect(spy.mock.calls[0][0]).toBe("https://mock.com/");
|
|
53
|
+
createClient("https://mock1.com/", MockOntology.metadata.ontologyRid, async () => "Token", undefined, fetchFunction);
|
|
54
|
+
expect(spy.mock.calls[1][0]).toBe("https://mock1.com/");
|
|
55
|
+
createClient("https://mock2.com/stuff/first/foo", MockOntology.metadata.ontologyRid, async () => "Token", undefined, fetchFunction);
|
|
56
|
+
expect(spy.mock.calls[2][0]).toBe("https://mock2.com/stuff/first/foo/");
|
|
57
|
+
createClient("https://mock3.com/stuff/first/foo/", MockOntology.metadata.ontologyRid, async () => "Token", undefined, fetchFunction);
|
|
58
|
+
expect(spy.mock.calls[3][0]).toBe("https://mock3.com/stuff/first/foo/");
|
|
59
|
+
const conjureContextSpy = vi.spyOn(MakeConjureContext, "makeConjureContext");
|
|
60
|
+
void metadataCacheClient({
|
|
61
|
+
baseUrl: "https://mock4.com/",
|
|
62
|
+
ontologyProvider: {
|
|
63
|
+
getObjectDefinition: async () => ({})
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
expect(conjureContextSpy.mock.results[0].value["baseUrl"] + conjureContextSpy.mock.results[0].value["servicePath"]).toBe("https://mock4.com/ontology-metadata/api");
|
|
67
|
+
});
|
|
68
|
+
});
|
|
44
69
|
});
|
|
45
70
|
//# sourceMappingURL=createClient.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.test.js","names":["Task","mockFetchResponse","MockOntology","beforeEach","describe","expect","it","vi","createClient","USER_AGENT","fetchFunction","client","fn","metadata","ontologyRid","undefined","data","getUserAgentPartsFromMockedFetch","userAgent","mock","calls","headers","get","parts","split","fetchPage","toHaveBeenCalledTimes","toEqual","osdkMetadata","extraUserAgent"],"sources":["createClient.test.
|
|
1
|
+
{"version":3,"file":"createClient.test.js","names":["Task","SharedClientContext","mockFetchResponse","MockOntology","beforeEach","describe","expect","it","vi","metadataCacheClient","createClient","MakeConjureContext","USER_AGENT","fetchFunction","client","fn","metadata","ontologyRid","undefined","data","getUserAgentPartsFromMockedFetch","userAgent","mock","calls","headers","get","parts","split","fetchPage","toHaveBeenCalledTimes","toEqual","osdkMetadata","extraUserAgent","spy","spyOn","toBe","conjureContextSpy","baseUrl","ontologyProvider","getObjectDefinition","results","value"],"sources":["createClient.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { Task } from \"@osdk/client.test.ontology\";\nimport * as SharedClientContext from \"@osdk/shared.client.impl\";\nimport { mockFetchResponse, MockOntology } from \"@osdk/shared.test\";\nimport type { MockedFunction } from \"vitest\";\nimport { beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { metadataCacheClient } from \"./__unstable/ConjureSupport.js\";\nimport type { Client } from \"./Client.js\";\nimport { createClient } from \"./createClient.js\";\nimport * as MakeConjureContext from \"./ontology/makeConjureContext.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n\ndescribe(createClient, () => {\n const validOlderVersion = \"0.13.0\" as const;\n const validCurrentVersion = \"0.14.0\" as const;\n const invalidFutureVersion = \"100.100.100\" as const;\n\n let fetchFunction: MockedFunction<typeof globalThis.fetch>;\n let client: Client;\n\n beforeEach(() => {\n fetchFunction = vi.fn();\n\n client = createClient(\n \"https://mock.com\",\n MockOntology.metadata.ontologyRid,\n async () => \"Token\",\n undefined,\n fetchFunction,\n );\n\n mockFetchResponse(fetchFunction, { data: [] });\n });\n\n describe(\"user agent passing\", () => {\n function getUserAgentPartsFromMockedFetch() {\n const userAgent = (fetchFunction.mock.calls[0][1]?.headers as Headers)\n .get(\n \"Fetch-User-Agent\",\n );\n const parts = userAgent?.split(\" \") ?? [];\n return parts;\n }\n\n it(\"works for objects\", async () => {\n await client(Task).fetchPage();\n expect(fetchFunction).toHaveBeenCalledTimes(1);\n\n const parts = getUserAgentPartsFromMockedFetch();\n expect(parts).toEqual([\n ...Task.osdkMetadata!\n .extraUserAgent\n .split(\" \"),\n USER_AGENT,\n ]);\n });\n });\n\n describe(\"check url formatting\", () => {\n it(\"urls are correctly formatted\", async () => {\n const spy = vi.spyOn(SharedClientContext, \"createSharedClientContext\");\n const client = createClient(\n \"https://mock.com\",\n MockOntology.metadata.ontologyRid,\n async () => \"Token\",\n undefined,\n fetchFunction,\n );\n expect(spy.mock.calls[0][0]).toBe(\"https://mock.com/\");\n\n createClient(\n \"https://mock1.com/\",\n MockOntology.metadata.ontologyRid,\n async () => \"Token\",\n undefined,\n fetchFunction,\n );\n expect(spy.mock.calls[1][0]).toBe(\"https://mock1.com/\");\n\n createClient(\n \"https://mock2.com/stuff/first/foo\",\n MockOntology.metadata.ontologyRid,\n async () => \"Token\",\n undefined,\n fetchFunction,\n );\n expect(spy.mock.calls[2][0]).toBe(\"https://mock2.com/stuff/first/foo/\");\n\n createClient(\n \"https://mock3.com/stuff/first/foo/\",\n MockOntology.metadata.ontologyRid,\n async () => \"Token\",\n undefined,\n fetchFunction,\n );\n expect(spy.mock.calls[3][0]).toBe(\"https://mock3.com/stuff/first/foo/\");\n\n const conjureContextSpy = vi.spyOn(\n MakeConjureContext,\n \"makeConjureContext\",\n );\n\n void metadataCacheClient(\n {\n baseUrl: \"https://mock4.com/\",\n ontologyProvider: { getObjectDefinition: async () => ({}) },\n } as any,\n );\n\n expect(\n conjureContextSpy.mock.results[0].value[\"baseUrl\"]\n + conjureContextSpy.mock.results[0].value[\"servicePath\"],\n ).toBe(\"https://mock4.com/ontology-metadata/api\");\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,4BAA4B;AACjD,OAAO,KAAKC,mBAAmB,MAAM,0BAA0B;AAC/D,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,mBAAmB;AAEnE,SAASC,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAC7D,SAASC,mBAAmB,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,KAAKF,mBAAmB,CACtB;QACE4B,OAAO,EAAE,oBAAoB;QAC7BC,gBAAgB,EAAE;UAAEC,mBAAmB,EAAE,MAAAA,CAAA,MAAa,CAAC,CAAC;QAAE;MAC5D,CACF,CAAC;MAEDjC,MAAM,CACJ8B,iBAAiB,CAACd,IAAI,CAACkB,OAAO,CAAC,CAAC,CAAC,CAACC,KAAK,CAAC,SAAS,CAAC,GAC9CL,iBAAiB,CAACd,IAAI,CAACkB,OAAO,CAAC,CAAC,CAAC,CAACC,KAAK,CAAC,aAAa,CAC3D,CAAC,CAACN,IAAI,CAAC,yCAAyC,CAAC;IACnD,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
import * as OntologiesV2 from "@osdk/foundry.ontologies";
|
|
17
18
|
import { asyncIterPointsHelper, getTimeRange } from "./util/timeseriesUtils.js";
|
|
18
19
|
export class GeotimeSeriesPropertyImpl {
|
|
19
20
|
#triplet;
|
|
20
21
|
#client;
|
|
21
|
-
lastFetchedValue;
|
|
22
22
|
constructor(client, objectApiName, primaryKey, propertyName, initialValue) {
|
|
23
23
|
this.#client = client;
|
|
24
24
|
this.#triplet = [objectApiName, primaryKey, propertyName];
|
|
@@ -28,7 +28,9 @@ export class GeotimeSeriesPropertyImpl {
|
|
|
28
28
|
}
|
|
29
29
|
async getLatestValue() {
|
|
30
30
|
const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties.getLatestValue(this.#client, await this.#client.ontologyRid, ...this.#triplet);
|
|
31
|
-
latestPointPromise.then(latestPoint => this.lastFetchedValue = latestPoint
|
|
31
|
+
latestPointPromise.then(latestPoint => this.lastFetchedValue = latestPoint,
|
|
32
|
+
// eslint-disable-next-line no-console
|
|
33
|
+
err => void console.error(err));
|
|
32
34
|
return latestPointPromise;
|
|
33
35
|
}
|
|
34
36
|
async getAllValues(query) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createGeotimeSeriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","GeotimeSeriesPropertyImpl","triplet","client","
|
|
1
|
+
{"version":3,"file":"createGeotimeSeriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","GeotimeSeriesPropertyImpl","triplet","client","constructor","objectApiName","primaryKey","propertyName","initialValue","lastFetchedValue","getLatestValue","latestPointPromise","TimeSeriesValueBankProperties","ontologyRid","then","latestPoint","err","console","error","getAllValues","query","allPoints","point","asyncIterValues","push","streamPointsIterator","streamValues","range","timeseriesPoint"],"sources":["createGeotimeSeriesProperty.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n GeotimeSeriesProperty,\n TimeSeriesPoint,\n TimeSeriesQuery,\n} from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { asyncIterPointsHelper, getTimeRange } from \"./util/timeseriesUtils.js\";\n\nexport class GeotimeSeriesPropertyImpl<T extends GeoJSON.Point>\n implements GeotimeSeriesProperty<T>\n{\n #triplet: [string, any, string];\n #client: MinimalClient;\n lastFetchedValue: TimeSeriesPoint<T> | undefined;\n\n constructor(\n client: MinimalClient,\n objectApiName: string,\n primaryKey: any,\n propertyName: string,\n initialValue?: TimeSeriesPoint<T>,\n ) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n if (initialValue != null) {\n this.lastFetchedValue = initialValue;\n }\n }\n\n public async getLatestValue(): Promise<TimeSeriesPoint<T> | undefined> {\n const latestPointPromise = OntologiesV2.TimeSeriesValueBankProperties\n .getLatestValue(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n );\n latestPointPromise.then(\n latestPoint => this.lastFetchedValue = latestPoint,\n // eslint-disable-next-line no-console\n err => void console.error(err),\n );\n return latestPointPromise;\n }\n\n public async getAllValues(\n query?: TimeSeriesQuery,\n ): Promise<TimeSeriesPoint<T>[]> {\n const allPoints: Array<TimeSeriesPoint<T>> = [];\n\n for await (const point of this.asyncIterValues(query)) {\n allPoints.push(point);\n }\n return allPoints;\n }\n\n public async *asyncIterValues(\n query?: TimeSeriesQuery,\n ): AsyncGenerator<\n {\n time: any;\n value: T;\n },\n void,\n unknown\n > {\n const streamPointsIterator = await OntologiesV2\n .TimeSeriesValueBankProperties.streamValues(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n query ? { range: getTimeRange(query) } : {},\n );\n\n for await (\n const timeseriesPoint of asyncIterPointsHelper<T>(streamPointsIterator)\n ) {\n yield timeseriesPoint;\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAOA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AAExD,SAASC,qBAAqB,EAAEC,YAAY,QAAQ,2BAA2B;AAE/E,OAAO,MAAMC,yBAAyB,CAEtC;EACE,CAACC,OAAO;EACR,CAACC,MAAM;EAGPC,WAAWA,CACTD,MAAqB,EACrBE,aAAqB,EACrBC,UAAe,EACfC,YAAoB,EACpBC,YAAiC,EACjC;IACA,IAAI,CAAC,CAACL,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACD,OAAO,GAAG,CAACG,aAAa,EAAEC,UAAU,EAAEC,YAAY,CAAC;IACzD,IAA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ved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import * as OntologiesV2 from "@osdk/foundry.ontologies";
|
|
18
|
+
export class MediaReferencePropertyImpl {
|
|
19
|
+
#triplet;
|
|
20
|
+
#client;
|
|
21
|
+
constructor(args) {
|
|
22
|
+
const {
|
|
23
|
+
client,
|
|
24
|
+
objectApiName,
|
|
25
|
+
primaryKey,
|
|
26
|
+
propertyName
|
|
27
|
+
} = args;
|
|
28
|
+
this.#client = client;
|
|
29
|
+
this.#triplet = [objectApiName, primaryKey, propertyName];
|
|
30
|
+
}
|
|
31
|
+
async fetchContents() {
|
|
32
|
+
return OntologiesV2.MediaReferenceProperties.getMediaContent(this.#client, await this.#client.ontologyRid, ...this.#triplet, {
|
|
33
|
+
preview: true // TODO: Can turn this back off when backend is no longer in beta.
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
async fetchMetadata() {
|
|
37
|
+
const r = await OntologiesV2.MediaReferenceProperties.getMediaMetadata(this.#client, await this.#client.ontologyRid, ...this.#triplet, {
|
|
38
|
+
preview: true // TODO: Can turn this back off when backend is no longer in beta.
|
|
39
|
+
});
|
|
40
|
+
return {
|
|
41
|
+
path: r.path,
|
|
42
|
+
sizeBytes: Number(r.sizeBytes),
|
|
43
|
+
mediaType: r.mediaType
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=createMediaReferenceProperty.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMediaReferenceProperty.js","names":["OntologiesV2","MediaReferencePropertyImpl","triplet","client","constructor","args","objectApiName","primaryKey","propertyName","fetchContents","MediaReferenceProperties","getMediaContent","ontologyRid","preview","fetchMetadata","r","getMediaMetadata","path","sizeBytes","Number","mediaType"],"sources":["createMediaReferenceProperty.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Media, MediaMetadata } from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\n\nexport class MediaReferencePropertyImpl implements Media {\n #triplet: [string, any, string];\n #client: MinimalClient;\n\n constructor(args: {\n client: MinimalClient;\n objectApiName: string;\n primaryKey: any;\n propertyName: string;\n }) {\n const { client, objectApiName, primaryKey, propertyName } = args;\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n }\n\n public async fetchContents(): Promise<Response> {\n return OntologiesV2.MediaReferenceProperties.getMediaContent(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n {\n preview: true, // TODO: Can turn this back off when backend is no longer in beta.\n },\n );\n }\n\n public async fetchMetadata(): Promise<MediaMetadata> {\n const r = await OntologiesV2.MediaReferenceProperties.getMediaMetadata(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n {\n preview: true, // TODO: Can turn this back off when backend is no longer in beta.\n },\n );\n return {\n path: r.path as string,\n sizeBytes: Number(r.sizeBytes),\n mediaType: r.mediaType,\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AAGxD,OAAO,MAAMC,0BAA0B,CAAkB;EACvD,CAACC,OAAO;EACR,CAACC,MAAM;EAEPC,WAAWA,CAACC,IAKX,EAAE;IACD,MAAM;MAAEF,MAAM;MAAEG,aAAa;MAAEC,UAAU;MAAEC;IAAa,CAAC,GAAGH,IAAI;IAChE,IAAI,CAAC,CAACF,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACD,OAAO,GAAG,CAACI,aAAa,EAAEC,UAAU,EAAEC,YAAY,CAAC;EAC3D;EAEA,MAAaC,aAAaA,CAAA,EAAsB;IAC9C,OAAOT,YAAY,CAACU,wBAAwB,CAACC,eAAe,CAC1D,IAAI,CAAC,CAACR,MAAM,EACZ,MAAM,IAAI,CAAC,CAACA,MAAM,CAACS,WAAW,EAC9B,GAAG,IAAI,CAAC,CAACV,OAAO,EAChB;MACEW,OAAO,EAAE,IAAI,CAAE;IACjB,CACF,CAAC;EACH;EAEA,MAAaC,aAAaA,CAAA,EAA2B;IACnD,MAAMC,CAAC,GAAG,MAAMf,YAAY,CAACU,wBAAwB,CAACM,gBAAgB,CACpE,IAAI,CAAC,CAACb,MAAM,EACZ,MAAM,IAAI,CAAC,CAACA,MAAM,CAACS,WAAW,EAC9B,GAAG,IAAI,CAAC,CAACV,OAAO,EAChB;MACEW,OAAO,EAAE,IAAI,CAAE;IACjB,CACF,CAAC;IACD,OAAO;MACLI,IAAI,EAAEF,CAAC,CAACE,IAAc;MACtBC,SAAS,EAAEC,MAAM,CAACJ,CAAC,CAACG,SAAS,CAAC;MAC9BE,SAAS,EAAEL,CAAC,CAACK;IACf,CAAC;EACH;AACF","ignoreList":[]}
|
|
@@ -13,13 +13,16 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
|
|
16
17
|
import { createSharedClientContext } from "@osdk/shared.client.impl";
|
|
18
|
+
import { convertWireToOsdkObjects, convertWireToOsdkObjects2 } from "./object/convertWireToOsdkObjects.js";
|
|
17
19
|
import { createObjectSet } from "./objectSet/createObjectSet.js";
|
|
18
20
|
import { createStandardOntologyProviderFactory } from "./ontology/StandardOntologyProvider.js";
|
|
19
21
|
import { USER_AGENT } from "./util/UserAgent.js";
|
|
22
|
+
|
|
20
23
|
/** @internal */
|
|
21
24
|
export function createMinimalClient(metadata, baseUrl, tokenProvider, options = {}, fetchFn = global.fetch, objectSetFactory = createObjectSet) {
|
|
22
|
-
if (process
|
|
25
|
+
if (process.env.NODE_ENV !== "production") {
|
|
23
26
|
try {
|
|
24
27
|
new URL(baseUrl);
|
|
25
28
|
} catch (e) {
|
|
@@ -27,9 +30,13 @@ export function createMinimalClient(metadata, baseUrl, tokenProvider, options =
|
|
|
27
30
|
throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);
|
|
28
31
|
}
|
|
29
32
|
}
|
|
33
|
+
const processedBaseUrl = new URL(baseUrl);
|
|
34
|
+
processedBaseUrl.pathname += processedBaseUrl.pathname.endsWith("/") ? "" : "/";
|
|
30
35
|
const minimalClient = {
|
|
31
|
-
...createSharedClientContext(
|
|
36
|
+
...createSharedClientContext(processedBaseUrl.toString(), tokenProvider, USER_AGENT, fetchFn),
|
|
32
37
|
objectSetFactory,
|
|
38
|
+
objectFactory: convertWireToOsdkObjects,
|
|
39
|
+
objectFactory2: convertWireToOsdkObjects2,
|
|
33
40
|
ontologyRid: metadata.ontologyRid,
|
|
34
41
|
logger: options.logger,
|
|
35
42
|
clientCacheKey: {},
|
|
@@ -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","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.
|
|
1
|
+
{"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","convertWireToOsdkObjects","convertWireToOsdkObjects2","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","processedBaseUrl","pathname","endsWith","minimalClient","toString","objectFactory","objectFactory2","ontologyRid","logger","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport type { Logger } from \"./Logger.js\";\nimport type {\n ClientCacheKey,\n MinimalClient,\n MinimalClientParams,\n} from \"./MinimalClientContext.js\";\nimport {\n convertWireToOsdkObjects,\n convertWireToOsdkObjects2,\n} from \"./object/convertWireToOsdkObjects.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport {\n createStandardOntologyProviderFactory,\n type OntologyCachingOptions,\n} from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n\n/** @internal */\nexport function createMinimalClient(\n metadata: MinimalClientParams[\"metadata\"],\n baseUrl: string,\n tokenProvider: () => Promise<string>,\n options: OntologyCachingOptions & { logger?: Logger } = {},\n fetchFn: (\n input: Request | URL | string,\n init?: RequestInit | undefined,\n ) => Promise<Response> = global.fetch,\n objectSetFactory: ObjectSetFactory<any, any> = createObjectSet,\n) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n } catch (e) {\n const hint =\n !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 processedBaseUrl = new URL(baseUrl);\n processedBaseUrl.pathname += processedBaseUrl.pathname.endsWith(\"/\")\n ? \"\"\n : \"/\";\n const minimalClient: MinimalClient = {\n ...createSharedClientContext(\n processedBaseUrl.toString(),\n tokenProvider,\n USER_AGENT,\n fetchFn,\n ),\n objectSetFactory,\n objectFactory: convertWireToOsdkObjects,\n objectFactory2: convertWireToOsdkObjects2,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {} as ClientCacheKey,\n requestContext: {},\n } satisfies Omit<\n MinimalClient,\n \"ontologyProvider\"\n > as any;\n\n return Object.freeze(Object.assign(minimalClient, {\n ontologyProvider: createStandardOntologyProviderFactory(\n options,\n )(minimalClient),\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,yBAAyB,QAAQ,0BAA0B;AAOpE,SACEC,wBAAwB,EACxBC,yBAAyB,QACpB,sCAAsC;AAC7C,SAASC,eAAe,QAAQ,gCAAgC;AAEhE,SACEC,qCAAqC,QAEhC,wCAAwC;AAC/C,SAASC,UAAU,QAAQ,qBAAqB;;AAEhD;AACA,OAAO,SAASC,mBAAmBA,CACjCC,QAAyC,EACzCC,OAAe,EACfC,aAAoC,EACpCC,OAAqD,GAAG,CAAC,CAAC,EAC1DC,OAGsB,GAAGC,MAAM,CAACC,KAAK,EACrCC,gBAA4C,GAAGX,eAAe,EAC9D;EACA,IAAIY,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,IAAI;MACF,IAAIC,GAAG,CAACV,OAAO,CAAC;IAClB,CAAC,CAAC,OAAOW,CAAC,EAAE;MACV,MAAMC,IAAI,GACR,CAACZ,OAAO,CAACa,UAAU,CAAC,SAAS,CAAC,IAAI,CAACb,OAAO,CAACa,UAAU,CAAC,UAAU,CAAC,GAC7D,kDAAkD,GAClD,EAAE;MACR,MAAM,IAAIC,KAAK,CAAC,sBAAsBd,OAAO,GAAGY,IAAI,EAAE,CAAC;IACzD;EACF;EACA,MAAMG,gBAAgB,GAAG,IAAIL,GAAG,CAACV,OAAO,CAAC;EACzCe,gBAAgB,CAACC,QAAQ,IAAID,gBAAgB,CAACC,QAAQ,CAACC,QAAQ,CAAC,GAAG,CAAC,GAChE,EAAE,GACF,GAAG;EACP,MAAMC,aAA4B,GAAG;IACnC,GAAG1B,yBAAyB,CAC1BuB,gBAAgB,CAACI,QAAQ,CAAC,CAAC,EAC3BlB,aAAa,EACbJ,UAAU,EACVM,OACF,CAAC;IACDG,gBAAgB;IAChBc,aAAa,EAAE3B,wBAAwB;IACvC4B,cAAc,EAAE3B,yBAAyB;IACzC4B,WAAW,EAAEvB,QAAQ,CAACuB,WAAW;IACjCC,MAAM,EAAErB,OAAO,CAACqB,MAAM;IACtBC,cAAc,EAAE,CAAC,CAAmB;IACpCC,cAAc,EAAE,CAAC;EACnB,CAGQ;EAER,OAAOC,MAAM,CAACC,MAAM,CAACD,MAAM,CAACE,MAAM,CAACV,aAAa,EAAE;IAChDW,gBAAgB,EAAEjC,qCAAqC,CACrDM,OACF,CAAC,CAACgB,aAAa;EACjB,CAAC,CAAC,CAAC;AACL","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createPlatformClient.js","names":["createSharedClientContext","USER_AGENT","createPlatformClient","baseUrl","tokenProvider","options","undefined","fetchFn","fetch"],"sources":["createPlatformClient.
|
|
1
|
+
{"version":3,"file":"createPlatformClient.js","names":["createSharedClientContext","USER_AGENT","createPlatformClient","baseUrl","tokenProvider","options","undefined","fetchFn","fetch"],"sources":["createPlatformClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport type { SharedClientContext } from \"@osdk/shared.client2\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n\nexport interface PlatformClient extends SharedClientContext {}\n\n/**\n * Creates a client that can only be used with Platform APIs.\n *\n * If you already have an OSDK Client (from `createClient`), you do not need to\n * create one of these - those clients can be used with Platform APIs as well.\n *\n * @param baseUrl\n * @param tokenProvider\n * @param options Currently unused, reserved for future use.\n * @param fetchFn\n * @returns\n */\nexport function createPlatformClient(\n baseUrl: string,\n tokenProvider: () => Promise<string>,\n options: undefined = undefined,\n fetchFn: typeof globalThis.fetch = fetch,\n): PlatformClient {\n return createSharedClientContext(\n baseUrl,\n tokenProvider,\n USER_AGENT,\n fetchFn,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,yBAAyB,QAAQ,0BAA0B;AAEpE,SAASC,UAAU,QAAQ,qBAAqB;AAIhD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,OAAe,EACfC,aAAoC,EACpCC,OAAkB,GAAGC,SAAS,EAC9BC,OAAgC,GAAGC,KAAK,EACxB;EAChB,OAAOR,yBAAyB,CAC9BG,OAAO,EACPC,aAAa,EACbH,UAAU,EACVM,OACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
-
|
|
16
|
+
|
|
17
|
+
import * as OntologiesV2 from "@osdk/foundry.ontologies";
|
|
17
18
|
import { asyncIterPointsHelper, getTimeRange } from "./util/timeseriesUtils.js";
|
|
18
19
|
export class TimeSeriesPropertyImpl {
|
|
19
20
|
#triplet;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTimeseriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","TimeSeriesPropertyImpl","triplet","client","constructor","objectApiName","primaryKey","propertyName","getFirstPoint","TimeSeriesPropertiesV2","ontologyRid","getLastPoint","getAllPoints","query","allPoints","point","asyncIterPoints","push","streamPointsIterator","streamPoints","range","timeseriesPoint"],"sources":["createTimeseriesProperty.
|
|
1
|
+
{"version":3,"file":"createTimeseriesProperty.js","names":["OntologiesV2","asyncIterPointsHelper","getTimeRange","TimeSeriesPropertyImpl","triplet","client","constructor","objectApiName","primaryKey","propertyName","getFirstPoint","TimeSeriesPropertiesV2","ontologyRid","getLastPoint","getAllPoints","query","allPoints","point","asyncIterPoints","push","streamPointsIterator","streamPoints","range","timeseriesPoint"],"sources":["createTimeseriesProperty.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n TimeSeriesPoint,\n TimeSeriesProperty,\n TimeSeriesQuery,\n} from \"@osdk/api\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { asyncIterPointsHelper, getTimeRange } from \"./util/timeseriesUtils.js\";\n\nexport class TimeSeriesPropertyImpl<T extends number | string>\n implements TimeSeriesProperty<T>\n{\n #triplet: [string, any, string];\n #client: MinimalClient;\n\n constructor(\n client: MinimalClient,\n objectApiName: string,\n primaryKey: any,\n propertyName: string,\n ) {\n this.#client = client;\n this.#triplet = [objectApiName, primaryKey, propertyName];\n }\n\n public async getFirstPoint(): Promise<TimeSeriesPoint<T>> {\n return OntologiesV2.TimeSeriesPropertiesV2.getFirstPoint(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n ) as Promise<TimeSeriesPoint<T>>;\n }\n\n public async getLastPoint(): Promise<TimeSeriesPoint<T>> {\n return OntologiesV2.TimeSeriesPropertiesV2.getLastPoint(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n ) as Promise<TimeSeriesPoint<T>>;\n }\n\n public async getAllPoints(\n query?: TimeSeriesQuery,\n ): Promise<TimeSeriesPoint<T>[]> {\n const allPoints: Array<TimeSeriesPoint<T>> = [];\n\n for await (const point of this.asyncIterPoints(query)) {\n allPoints.push(point);\n }\n return allPoints;\n }\n\n public async *asyncIterPoints(\n query?: TimeSeriesQuery,\n ): AsyncGenerator<\n {\n time: any;\n value: T;\n },\n void,\n unknown\n > {\n const streamPointsIterator = await OntologiesV2.TimeSeriesPropertiesV2\n .streamPoints(\n this.#client,\n await this.#client.ontologyRid,\n ...this.#triplet,\n query ? { range: getTimeRange(query) } : {},\n );\n\n for await (\n const timeseriesPoint of asyncIterPointsHelper<T>(streamPointsIterator)\n ) {\n yield timeseriesPoint;\n }\n }\n}\n"],"mappings":"AAA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,CAACA,MAAM,CAACO,WAAW,EAC9B,GAAG,IAAI,CAAC,CAACR,OAAO,EAChBW,KAAK,GAAG;MAAEO,KAAK,EAAEpB,YAAY,CAACa,KAAK;IAAE,CAAC,GAAG,CAAC,CAC5C,CAAC;IAEH,WACE,MAAMQ,eAAe,IAAItB,qBAAqB,CAAImB,oBAAoB,CAAC,EACvE;MACA,MAAMG,eAAe;IACvB;EACF;AACF","ignoreList":[]}
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
|
|
16
17
|
import { describe, expectTypeOf, it } from "vitest";
|
|
17
18
|
describe("LinkDefinitions", () => {
|
|
18
19
|
describe("OsdkObjectLinkObject", () => {
|
|
@@ -28,10 +29,13 @@ describe("LinkDefinitions", () => {
|
|
|
28
29
|
|
|
29
30
|
// // e.g. .lead.fetchOne({});
|
|
30
31
|
expectTypeOf().branded.toEqualTypeOf();
|
|
32
|
+
|
|
31
33
|
// e.g. .lead.fetchOne();
|
|
32
34
|
expectTypeOf().branded.toEqualTypeOf();
|
|
35
|
+
|
|
33
36
|
// e.g. .lead.fetchOne({ select: [] });
|
|
34
37
|
expectTypeOf().branded.toEqualTypeOf();
|
|
38
|
+
|
|
35
39
|
// e.g. .lead.fetchOne({ select: ["name"] });
|
|
36
40
|
expectTypeOf().toEqualTypeOf();
|
|
37
41
|
});
|