@osdk/client 2.0.0-beta.13 → 2.0.0-beta.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +40 -0
- package/build/browser/Client.d.ts +39 -0
- package/build/browser/Client.d.ts.map +1 -0
- package/build/browser/Client.js +20 -0
- package/build/browser/Client.js.map +1 -0
- package/build/browser/Definitions.test.d.ts +2 -0
- package/build/browser/Definitions.test.d.ts.map +1 -0
- package/build/browser/Definitions.test.js +35 -0
- package/build/browser/Definitions.test.js.map +1 -0
- package/build/browser/Logger.d.ts +19 -0
- package/build/browser/Logger.d.ts.map +1 -0
- package/build/browser/Logger.js +17 -0
- package/build/browser/Logger.js.map +1 -0
- package/build/browser/MinimalClientContext.d.ts +26 -0
- package/build/browser/MinimalClientContext.d.ts.map +1 -0
- package/build/browser/MinimalClientContext.js +17 -0
- package/build/browser/MinimalClientContext.js.map +1 -0
- package/build/browser/ResultOrError.d.ts +12 -0
- package/build/browser/ResultOrError.d.ts.map +1 -0
- package/build/browser/ResultOrError.js +19 -0
- package/build/browser/ResultOrError.js.map +1 -0
- package/build/browser/SatisfiesSemver.d.ts +4 -0
- package/build/browser/SatisfiesSemver.d.ts.map +1 -0
- package/build/browser/SatisfiesSemver.js +17 -0
- package/build/browser/SatisfiesSemver.js.map +1 -0
- package/build/browser/SatisfiesSemver.test.d.ts +2 -0
- package/build/browser/SatisfiesSemver.test.d.ts.map +1 -0
- package/build/browser/SatisfiesSemver.test.js +69 -0
- package/build/browser/SatisfiesSemver.test.js.map +1 -0
- package/build/browser/__unstable/ConjureSupport.d.ts +55 -0
- package/build/browser/__unstable/ConjureSupport.d.ts.map +1 -0
- package/build/browser/__unstable/ConjureSupport.js +174 -0
- package/build/browser/__unstable/ConjureSupport.js.map +1 -0
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts +10 -0
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -0
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js +114 -0
- package/build/browser/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -0
- package/build/browser/actions/ActionValidationError.d.ts +6 -0
- package/build/browser/actions/ActionValidationError.d.ts.map +1 -0
- package/build/browser/actions/ActionValidationError.js +23 -0
- package/build/browser/actions/ActionValidationError.js.map +1 -0
- package/build/browser/actions/actions.test.d.ts +2 -0
- package/build/browser/actions/actions.test.d.ts.map +1 -0
- package/build/browser/actions/actions.test.js +323 -0
- package/build/browser/actions/actions.test.js.map +1 -0
- package/build/browser/actions/applyAction.d.ts +30 -0
- package/build/browser/actions/applyAction.d.ts.map +1 -0
- package/build/browser/actions/applyAction.js +114 -0
- package/build/browser/actions/applyAction.js.map +1 -0
- package/build/browser/createAttachmentFromRid.d.ts +10 -0
- package/build/browser/createAttachmentFromRid.d.ts.map +1 -0
- package/build/browser/createAttachmentFromRid.js +38 -0
- package/build/browser/createAttachmentFromRid.js.map +1 -0
- package/build/browser/createClient.d.ts +6 -0
- package/build/browser/createClient.d.ts.map +1 -0
- package/build/browser/createClient.js +88 -0
- package/build/browser/createClient.js.map +1 -0
- package/build/browser/createClient.test.d.ts +2 -0
- package/build/browser/createClient.test.d.ts.map +1 -0
- package/build/browser/createClient.test.js +45 -0
- package/build/browser/createClient.test.js.map +1 -0
- package/build/browser/createMinimalClient.d.ts +2 -0
- package/build/browser/createMinimalClient.d.ts.map +1 -0
- package/build/browser/createMinimalClient.js +42 -0
- package/build/browser/createMinimalClient.js.map +1 -0
- package/build/browser/createPlatformClient.d.ts +17 -0
- package/build/browser/createPlatformClient.d.ts.map +1 -0
- package/build/browser/createPlatformClient.js +33 -0
- package/build/browser/createPlatformClient.js.map +1 -0
- package/build/browser/createTimeseriesProperty.d.ts +14 -0
- package/build/browser/createTimeseriesProperty.d.ts.map +1 -0
- package/build/browser/createTimeseriesProperty.js +79 -0
- package/build/browser/createTimeseriesProperty.js.map +1 -0
- package/build/browser/definitions/LinkDefinitions.test.d.ts +2 -0
- package/build/browser/definitions/LinkDefinitions.test.d.ts.map +1 -0
- package/build/browser/definitions/LinkDefinitions.test.js +41 -0
- package/build/browser/definitions/LinkDefinitions.test.js.map +1 -0
- package/build/browser/fetchMetadata.d.ts +2 -0
- package/build/browser/fetchMetadata.d.ts.map +1 -0
- package/build/browser/fetchMetadata.js +35 -0
- package/build/browser/fetchMetadata.js.map +1 -0
- package/build/browser/fetchMetadata.test.d.ts +2 -0
- package/build/browser/fetchMetadata.test.d.ts.map +1 -0
- package/build/browser/fetchMetadata.test.js +218 -0
- package/build/browser/fetchMetadata.test.js.map +1 -0
- package/build/browser/index.d.ts +13 -0
- package/build/browser/index.d.ts.map +1 -0
- package/build/browser/index.js +22 -725
- package/build/browser/index.js.map +1 -1
- package/build/browser/intellisense.test.d.ts +2 -0
- package/build/browser/intellisense.test.d.ts.map +1 -0
- package/build/browser/intellisense.test.helpers/callsQueryAcceptsObject.d.ts +2 -0
- package/build/browser/intellisense.test.helpers/callsQueryAcceptsObject.d.ts.map +1 -0
- package/build/browser/intellisense.test.helpers/callsQueryAcceptsObject.js +25 -0
- package/build/browser/intellisense.test.helpers/callsQueryAcceptsObject.js.map +1 -0
- package/build/browser/intellisense.test.js +86 -0
- package/build/browser/intellisense.test.js.map +1 -0
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.d.ts +2 -0
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.d.ts.map +1 -0
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js +34 -0
- package/build/browser/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -0
- package/build/browser/internal/conversions/modernToLegacyAggregationClause.d.ts +2 -0
- package/build/browser/internal/conversions/modernToLegacyAggregationClause.d.ts.map +1 -0
- package/build/browser/internal/conversions/modernToLegacyAggregationClause.js +38 -0
- package/build/browser/internal/conversions/modernToLegacyAggregationClause.js.map +1 -0
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.d.ts +2 -0
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.d.ts.map +1 -0
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.js +62 -0
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.js.map +1 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.d.ts +2 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.d.ts.map +1 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +144 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js.map +1 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.d.ts +2 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.d.ts.map +1 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js +486 -0
- package/build/browser/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -0
- package/build/browser/object/AttachmentUpload.d.ts +4 -0
- package/build/browser/object/AttachmentUpload.d.ts.map +1 -0
- package/build/browser/object/AttachmentUpload.js +27 -0
- package/build/browser/object/AttachmentUpload.js.map +1 -0
- package/build/browser/object/Cache.d.ts +2 -0
- package/build/browser/object/Cache.d.ts.map +1 -0
- package/build/browser/object/Cache.js +76 -0
- package/build/browser/object/Cache.js.map +1 -0
- package/build/browser/object/Cache.test.d.ts +11 -0
- package/build/browser/object/Cache.test.d.ts.map +1 -0
- package/build/browser/object/Cache.test.js +283 -0
- package/build/browser/object/Cache.test.js.map +1 -0
- package/build/browser/object/SimpleCache.d.ts +38 -0
- package/build/browser/object/SimpleCache.d.ts.map +1 -0
- package/build/browser/object/SimpleCache.js +67 -0
- package/build/browser/object/SimpleCache.js.map +1 -0
- package/build/browser/object/aggregate.d.ts +2 -0
- package/build/browser/object/aggregate.d.ts.map +1 -0
- package/build/browser/object/aggregate.js +69 -0
- package/build/browser/object/aggregate.js.map +1 -0
- package/build/browser/object/aggregate.test.d.ts +2 -0
- package/build/browser/object/aggregate.test.d.ts.map +1 -0
- package/build/browser/object/aggregate.test.js +398 -0
- package/build/browser/object/aggregate.test.js.map +1 -0
- package/build/browser/object/attachment.test.d.ts +2 -0
- package/build/browser/object/attachment.test.d.ts.map +1 -0
- package/build/browser/object/attachment.test.js +55 -0
- package/build/browser/object/attachment.test.js.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +11 -0
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.js +17 -0
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts +13 -0
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js +22 -0
- package/build/browser/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/ObjectHolder.d.ts +2 -0
- package/build/browser/object/convertWireToOsdkObjects/ObjectHolder.d.ts.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/ObjectHolder.js +17 -0
- package/build/browser/object/convertWireToOsdkObjects/ObjectHolder.js.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.d.ts +2 -0
- package/build/browser/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.d.ts.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.js +48 -0
- package/build/browser/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.js.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/PropertyDescriptorRecord.d.ts +8 -0
- package/build/browser/object/convertWireToOsdkObjects/PropertyDescriptorRecord.d.ts.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/PropertyDescriptorRecord.js +17 -0
- package/build/browser/object/convertWireToOsdkObjects/PropertyDescriptorRecord.js.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.d.ts +2 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.d.ts.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +82 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.d.ts +2 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.d.ts.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +114 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/getDollarAs.d.ts +3 -0
- package/build/browser/object/convertWireToOsdkObjects/getDollarAs.d.ts.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js +55 -0
- package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.d.ts +2 -0
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.d.ts.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js +60 -0
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects.d.ts +2 -0
- package/build/browser/object/convertWireToOsdkObjects.d.ts.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects.js +150 -0
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects.test.d.ts +2 -0
- package/build/browser/object/convertWireToOsdkObjects.test.d.ts.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects.test.js +254 -0
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -0
- package/build/browser/object/fetchPage.d.ts +3 -0
- package/build/browser/object/fetchPage.d.ts.map +1 -0
- package/build/browser/object/fetchPage.js +135 -0
- package/build/browser/object/fetchPage.js.map +1 -0
- package/build/browser/object/fetchPage.test.d.ts +2 -0
- package/build/browser/object/fetchPage.test.d.ts.map +1 -0
- package/build/browser/object/fetchPage.test.js +106 -0
- package/build/browser/object/fetchPage.test.js.map +1 -0
- package/build/browser/object/fetchSingle.d.ts +2 -0
- package/build/browser/object/fetchSingle.d.ts.map +1 -0
- package/build/browser/object/fetchSingle.js +47 -0
- package/build/browser/object/fetchSingle.js.map +1 -0
- package/build/browser/object/object.test.d.ts +12 -0
- package/build/browser/object/object.test.d.ts.map +1 -0
- package/build/browser/object/object.test.js +179 -0
- package/build/browser/object/object.test.js.map +1 -0
- package/build/browser/object/timeseries.test.d.ts +2 -0
- package/build/browser/object/timeseries.test.d.ts.map +1 -0
- package/build/browser/object/timeseries.test.js +163 -0
- package/build/browser/object/timeseries.test.js.map +1 -0
- package/build/browser/objectSet/ObjectSet.test.d.ts +2 -0
- package/build/browser/objectSet/ObjectSet.test.d.ts.map +1 -0
- package/build/browser/objectSet/ObjectSet.test.js +313 -0
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -0
- package/build/browser/objectSet/ObjectSetFactory.d.ts +2 -0
- package/build/browser/objectSet/ObjectSetFactory.d.ts.map +1 -0
- package/build/browser/objectSet/ObjectSetFactory.js +17 -0
- package/build/browser/objectSet/ObjectSetFactory.js.map +1 -0
- package/build/browser/objectSet/ObjectSetListenerWebsocket.d.ts +7 -0
- package/build/browser/objectSet/ObjectSetListenerWebsocket.d.ts.map +1 -0
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +533 -0
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -0
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.d.ts +2 -0
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.d.ts.map +1 -0
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +338 -0
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -0
- package/build/browser/objectSet/conjureUnionType.d.ts +13 -0
- package/build/browser/objectSet/conjureUnionType.d.ts.map +1 -0
- package/build/browser/objectSet/conjureUnionType.js +27 -0
- package/build/browser/objectSet/conjureUnionType.js.map +1 -0
- package/build/browser/objectSet/createObjectSet.d.ts +2 -0
- package/build/browser/objectSet/createObjectSet.d.ts.map +1 -0
- package/build/browser/objectSet/createObjectSet.js +136 -0
- package/build/browser/objectSet/createObjectSet.js.map +1 -0
- package/build/browser/objectSet/toConjureObjectSet.d.ts +2 -0
- package/build/browser/objectSet/toConjureObjectSet.d.ts.map +1 -0
- package/build/browser/objectSet/toConjureObjectSet.js +158 -0
- package/build/browser/objectSet/toConjureObjectSet.js.map +1 -0
- package/build/browser/ontology/OntologyProvider.d.ts +32 -0
- package/build/browser/ontology/OntologyProvider.d.ts.map +1 -0
- package/build/browser/ontology/OntologyProvider.js +17 -0
- package/build/browser/ontology/OntologyProvider.js.map +1 -0
- package/build/browser/ontology/StandardOntologyProvider.d.ts +5 -0
- package/build/browser/ontology/StandardOntologyProvider.d.ts.map +1 -0
- package/build/browser/ontology/StandardOntologyProvider.js +59 -0
- package/build/browser/ontology/StandardOntologyProvider.js.map +1 -0
- package/build/browser/ontology/StandardOntologyProvider.test.d.ts +2 -0
- package/build/browser/ontology/StandardOntologyProvider.test.d.ts.map +1 -0
- package/build/browser/ontology/StandardOntologyProvider.test.js +48 -0
- package/build/browser/ontology/StandardOntologyProvider.test.js.map +1 -0
- package/build/browser/ontology/loadActionMetadata.d.ts +4 -0
- package/build/browser/ontology/loadActionMetadata.d.ts.map +1 -0
- package/build/browser/ontology/loadActionMetadata.js +22 -0
- package/build/browser/ontology/loadActionMetadata.js.map +1 -0
- package/build/browser/ontology/loadFullObjectMetadata.d.ts +6 -0
- package/build/browser/ontology/loadFullObjectMetadata.d.ts.map +1 -0
- package/build/browser/ontology/loadFullObjectMetadata.js +28 -0
- package/build/browser/ontology/loadFullObjectMetadata.js.map +1 -0
- package/build/browser/ontology/loadInterfaceMetadata.d.ts +4 -0
- package/build/browser/ontology/loadInterfaceMetadata.d.ts.map +1 -0
- package/build/browser/ontology/loadInterfaceMetadata.js +24 -0
- package/build/browser/ontology/loadInterfaceMetadata.js.map +1 -0
- package/build/browser/ontology/loadQueryMetadata.d.ts +4 -0
- package/build/browser/ontology/loadQueryMetadata.d.ts.map +1 -0
- package/build/browser/ontology/loadQueryMetadata.js +22 -0
- package/build/browser/ontology/loadQueryMetadata.js.map +1 -0
- package/build/browser/ontology/makeConjureContext.d.ts +4 -0
- package/build/browser/ontology/makeConjureContext.d.ts.map +1 -0
- package/build/browser/ontology/makeConjureContext.js +28 -0
- package/build/browser/ontology/makeConjureContext.js.map +1 -0
- package/build/browser/pageRequestAsAsyncIter.d.ts +10 -0
- package/build/browser/pageRequestAsAsyncIter.d.ts.map +1 -0
- package/build/browser/pageRequestAsAsyncIter.js +37 -0
- package/build/browser/pageRequestAsAsyncIter.js.map +1 -0
- package/build/browser/public/unstable-do-not-use.d.ts +2 -0
- package/build/browser/public/unstable-do-not-use.d.ts.map +1 -0
- package/build/browser/public/unstable-do-not-use.js +16 -2
- package/build/browser/public/unstable-do-not-use.js.map +1 -1
- package/build/browser/queries/applyQuery.d.ts +6 -0
- package/build/browser/queries/applyQuery.d.ts.map +1 -0
- package/build/browser/queries/applyQuery.js +234 -0
- package/build/browser/queries/applyQuery.js.map +1 -0
- package/build/browser/queries/queries.test.d.ts +2 -0
- package/build/browser/queries/queries.test.d.ts.map +1 -0
- package/build/browser/queries/queries.test.js +171 -0
- package/build/browser/queries/queries.test.js.map +1 -0
- package/build/browser/queries/types.d.ts +20 -0
- package/build/browser/queries/types.d.ts.map +1 -0
- package/build/browser/queries/types.js +17 -0
- package/build/browser/queries/types.js.map +1 -0
- package/build/browser/tsserver.d.ts +34 -0
- package/build/browser/tsserver.d.ts.map +1 -0
- package/build/browser/tsserver.js +133 -0
- package/build/browser/tsserver.js.map +1 -0
- package/build/browser/util/ArrayElement.d.ts +2 -0
- package/build/browser/util/ArrayElement.d.ts.map +1 -0
- package/build/browser/util/ArrayElement.js +17 -0
- package/build/browser/util/ArrayElement.js.map +1 -0
- package/build/browser/util/NOOP.d.ts +4 -0
- package/build/browser/util/NOOP.d.ts.map +1 -0
- package/build/browser/util/NOOP.js +17 -0
- package/build/browser/util/NOOP.js.map +1 -0
- package/build/browser/util/NullableProps.d.ts +6 -0
- package/build/browser/util/NullableProps.d.ts.map +1 -0
- package/build/browser/util/NullableProps.js +17 -0
- package/build/browser/util/NullableProps.js.map +1 -0
- package/build/browser/util/UserAgent.d.ts +2 -0
- package/build/browser/util/UserAgent.d.ts.map +1 -0
- package/build/browser/util/UserAgent.js +17 -0
- package/build/browser/util/UserAgent.js.map +1 -0
- package/build/browser/util/WireObjectSet.d.ts +2 -0
- package/build/browser/util/WireObjectSet.d.ts.map +1 -0
- package/build/browser/util/WireObjectSet.js +21 -0
- package/build/browser/util/WireObjectSet.js.map +1 -0
- package/build/browser/util/addUserAgentAndRequestContextHeaders.d.ts +4 -0
- package/build/browser/util/addUserAgentAndRequestContextHeaders.d.ts.map +1 -0
- package/build/browser/util/addUserAgentAndRequestContextHeaders.js +27 -0
- package/build/browser/util/addUserAgentAndRequestContextHeaders.js.map +1 -0
- package/build/browser/util/augmentRequestContext.d.ts +32 -0
- package/build/browser/util/augmentRequestContext.d.ts.map +1 -0
- package/build/browser/util/augmentRequestContext.js +52 -0
- package/build/browser/util/augmentRequestContext.js.map +1 -0
- package/build/browser/util/isOntologyObjectV2.d.ts +2 -0
- package/build/browser/util/isOntologyObjectV2.d.ts.map +1 -0
- package/build/browser/util/isOntologyObjectV2.js +20 -0
- package/build/browser/util/isOntologyObjectV2.js.map +1 -0
- package/build/browser/util/isOsdkBaseObject.d.ts +3 -0
- package/build/browser/util/isOsdkBaseObject.d.ts.map +1 -0
- package/build/browser/util/isOsdkBaseObject.js +19 -0
- package/build/browser/util/isOsdkBaseObject.js.map +1 -0
- package/build/browser/util/isOsdkObject.d.ts +3 -0
- package/build/browser/util/isOsdkObject.d.ts.map +1 -0
- package/build/browser/util/isOsdkObject.js +19 -0
- package/build/browser/util/isOsdkObject.js.map +1 -0
- package/build/browser/util/partialBy.d.ts +3 -0
- package/build/browser/util/partialBy.d.ts.map +1 -0
- package/build/browser/util/partialBy.js +17 -0
- package/build/browser/util/partialBy.js.map +1 -0
- package/build/browser/util/streamutils.d.ts +3 -0
- package/build/browser/util/streamutils.d.ts.map +1 -0
- package/build/browser/util/streamutils.js +95 -0
- package/build/browser/util/streamutils.js.map +1 -0
- package/build/browser/util/toDataValue.d.ts +2 -0
- package/build/browser/util/toDataValue.d.ts.map +1 -0
- package/build/browser/util/toDataValue.js +73 -0
- package/build/browser/util/toDataValue.js.map +1 -0
- package/build/browser/util/toDataValue.test.d.ts +2 -0
- package/build/browser/util/toDataValue.test.d.ts.map +1 -0
- package/build/browser/util/toDataValue.test.js +117 -0
- package/build/browser/util/toDataValue.test.js.map +1 -0
- package/build/browser/util/toDataValueQueries.d.ts +2 -0
- package/build/browser/util/toDataValueQueries.d.ts.map +1 -0
- package/build/browser/util/toDataValueQueries.js +107 -0
- package/build/browser/util/toDataValueQueries.js.map +1 -0
- package/build/esm/Client.d.ts +6 -7
- package/build/esm/Client.d.ts.map +1 -1
- package/build/esm/Client.js +20 -0
- package/build/esm/Client.js.map +1 -0
- package/build/esm/Definitions.test.js +35 -0
- package/build/esm/Definitions.test.js.map +1 -0
- package/build/esm/Logger.js +17 -0
- package/build/esm/Logger.js.map +1 -0
- package/build/esm/MinimalClientContext.js +17 -0
- package/build/esm/MinimalClientContext.js.map +1 -0
- package/build/esm/ResultOrError.js +19 -0
- package/build/esm/ResultOrError.js.map +1 -0
- package/build/esm/SatisfiesSemver.js +17 -0
- package/build/esm/SatisfiesSemver.js.map +1 -0
- package/build/esm/SatisfiesSemver.test.js +69 -0
- package/build/esm/SatisfiesSemver.test.js.map +1 -0
- package/build/esm/__unstable/ConjureSupport.js +174 -0
- package/build/esm/__unstable/ConjureSupport.js.map +1 -0
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.d.ts.map +1 -1
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js +114 -0
- package/build/esm/__unstable/createBulkLinksAsyncIterFactory.js.map +1 -0
- package/build/esm/actions/ActionValidationError.d.ts +1 -1
- package/build/esm/actions/ActionValidationError.d.ts.map +1 -1
- package/build/esm/actions/ActionValidationError.js +23 -0
- package/build/esm/actions/ActionValidationError.js.map +1 -0
- package/build/esm/actions/actions.test.js +323 -0
- package/build/esm/actions/actions.test.js.map +1 -0
- package/build/esm/actions/applyAction.d.ts +9 -10
- package/build/esm/actions/applyAction.d.ts.map +1 -1
- package/build/esm/actions/applyAction.js +114 -0
- package/build/esm/actions/applyAction.js.map +1 -0
- package/build/esm/createAttachmentFromRid.d.ts +1 -1
- package/build/esm/createAttachmentFromRid.d.ts.map +1 -1
- package/build/esm/createAttachmentFromRid.js +38 -0
- package/build/esm/createAttachmentFromRid.js.map +1 -0
- package/build/esm/createClient.d.ts.map +1 -1
- package/build/esm/createClient.js +88 -0
- package/build/esm/createClient.js.map +1 -0
- package/build/esm/createClient.test.js +45 -0
- package/build/esm/createClient.test.js.map +1 -0
- package/build/esm/createMinimalClient.js +42 -0
- package/build/esm/createMinimalClient.js.map +1 -0
- package/build/esm/createPlatformClient.js +33 -0
- package/build/esm/createPlatformClient.js.map +1 -0
- package/build/esm/createTimeseriesProperty.d.ts +12 -2
- package/build/esm/createTimeseriesProperty.d.ts.map +1 -1
- package/build/esm/createTimeseriesProperty.js +79 -0
- package/build/esm/createTimeseriesProperty.js.map +1 -0
- package/build/esm/definitions/LinkDefinitions.test.js +41 -0
- package/build/esm/definitions/LinkDefinitions.test.js.map +1 -0
- package/build/esm/fetchMetadata.js +35 -0
- package/build/esm/fetchMetadata.js.map +1 -0
- package/build/esm/fetchMetadata.test.js +218 -0
- package/build/esm/fetchMetadata.test.js.map +1 -0
- package/build/esm/index.d.ts +2 -2
- package/build/esm/index.d.ts.map +1 -1
- package/build/esm/index.js +22 -725
- package/build/esm/index.js.map +1 -1
- package/build/esm/intellisense.test.helpers/callsQueryAcceptsObject.js +25 -0
- package/build/esm/intellisense.test.helpers/callsQueryAcceptsObject.js.map +1 -0
- package/build/esm/intellisense.test.js +86 -0
- package/build/esm/intellisense.test.js.map +1 -0
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js +34 -0
- package/build/esm/internal/conversions/legacyToModernSingleAggregationResult.js.map +1 -0
- package/build/esm/internal/conversions/modernToLegacyAggregationClause.js +38 -0
- package/build/esm/internal/conversions/modernToLegacyAggregationClause.js.map +1 -0
- package/build/esm/internal/conversions/modernToLegacyGroupByClause.js +62 -0
- package/build/esm/internal/conversions/modernToLegacyGroupByClause.js.map +1 -0
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +144 -0
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js.map +1 -0
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js +486 -0
- package/build/esm/internal/conversions/modernToLegacyWhereClause.test.js.map +1 -0
- package/build/esm/object/AttachmentUpload.d.ts +1 -1
- package/build/esm/object/AttachmentUpload.d.ts.map +1 -1
- package/build/esm/object/AttachmentUpload.js +27 -0
- package/build/esm/object/AttachmentUpload.js.map +1 -0
- package/build/esm/object/Cache.js +76 -0
- package/build/esm/object/Cache.js.map +1 -0
- package/build/esm/object/Cache.test.js +283 -0
- package/build/esm/object/Cache.test.js.map +1 -0
- package/build/esm/object/SimpleCache.js +67 -0
- package/build/esm/object/SimpleCache.js.map +1 -0
- package/build/esm/object/aggregate.js +69 -0
- package/build/esm/object/aggregate.js.map +1 -0
- package/build/esm/object/aggregate.test.js +398 -0
- package/build/esm/object/aggregate.test.js.map +1 -0
- package/build/esm/object/attachment.test.js +55 -0
- package/build/esm/object/attachment.test.js.map +1 -0
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts +4 -5
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.js +17 -0
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -0
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts +2 -3
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js +22 -0
- package/build/esm/object/convertWireToOsdkObjects/InternalSymbols.js.map +1 -0
- package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.js +17 -0
- package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.js.map +1 -0
- package/build/esm/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.js +48 -0
- package/build/esm/object/convertWireToOsdkObjects/OsdkCustomInspectPrototype.js.map +1 -0
- package/build/esm/object/convertWireToOsdkObjects/PropertyDescriptorRecord.js +17 -0
- package/build/esm/object/convertWireToOsdkObjects/PropertyDescriptorRecord.js.map +1 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +82 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +114 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -0
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.d.ts +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.d.ts.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js +55 -0
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -0
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js +60 -0
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -0
- package/build/esm/object/convertWireToOsdkObjects.js +150 -0
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -0
- package/build/esm/object/convertWireToOsdkObjects.test.js +254 -0
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -0
- package/build/esm/object/fetchPage.d.ts +2 -3
- package/build/esm/object/fetchPage.d.ts.map +1 -1
- package/build/esm/object/fetchPage.js +135 -0
- package/build/esm/object/fetchPage.js.map +1 -0
- package/build/esm/object/fetchPage.test.js +106 -0
- package/build/esm/object/fetchPage.test.js.map +1 -0
- package/build/esm/object/fetchSingle.js +47 -0
- package/build/esm/object/fetchSingle.js.map +1 -0
- package/build/esm/object/object.test.d.ts +1 -1
- package/build/esm/object/object.test.d.ts.map +1 -1
- package/build/esm/object/object.test.js +179 -0
- package/build/esm/object/object.test.js.map +1 -0
- package/build/esm/object/timeseries.test.js +163 -0
- package/build/esm/object/timeseries.test.js.map +1 -0
- package/build/esm/objectSet/ObjectSet.test.js +313 -0
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -0
- package/build/esm/objectSet/ObjectSetFactory.js +17 -0
- package/build/esm/objectSet/ObjectSetFactory.js.map +1 -0
- package/build/esm/objectSet/ObjectSetListenerWebsocket.d.ts.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +536 -0
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -0
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +338 -0
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -0
- package/build/esm/objectSet/conjureUnionType.js +27 -0
- package/build/esm/objectSet/conjureUnionType.js.map +1 -0
- package/build/esm/objectSet/createObjectSet.js +136 -0
- package/build/esm/objectSet/createObjectSet.js.map +1 -0
- package/build/esm/objectSet/toConjureObjectSet.js +158 -0
- package/build/esm/objectSet/toConjureObjectSet.js.map +1 -0
- package/build/esm/ontology/OntologyProvider.d.ts +5 -5
- package/build/esm/ontology/OntologyProvider.d.ts.map +1 -1
- package/build/esm/ontology/OntologyProvider.js +17 -0
- package/build/esm/ontology/OntologyProvider.js.map +1 -0
- package/build/esm/ontology/StandardOntologyProvider.js +59 -0
- package/build/esm/ontology/StandardOntologyProvider.js.map +1 -0
- package/build/esm/ontology/StandardOntologyProvider.test.js +48 -0
- package/build/esm/ontology/StandardOntologyProvider.test.js.map +1 -0
- package/build/esm/ontology/loadActionMetadata.d.ts +1 -1
- package/build/esm/ontology/loadActionMetadata.d.ts.map +1 -1
- package/build/esm/ontology/loadActionMetadata.js +22 -0
- package/build/esm/ontology/loadActionMetadata.js.map +1 -0
- package/build/esm/ontology/loadFullObjectMetadata.d.ts +1 -1
- package/build/esm/ontology/loadFullObjectMetadata.d.ts.map +1 -1
- package/build/esm/ontology/loadFullObjectMetadata.js +28 -0
- package/build/esm/ontology/loadFullObjectMetadata.js.map +1 -0
- package/build/esm/ontology/loadInterfaceMetadata.d.ts +1 -1
- package/build/esm/ontology/loadInterfaceMetadata.d.ts.map +1 -1
- package/build/esm/ontology/loadInterfaceMetadata.js +24 -0
- package/build/esm/ontology/loadInterfaceMetadata.js.map +1 -0
- package/build/esm/ontology/loadQueryMetadata.js +22 -0
- package/build/esm/ontology/loadQueryMetadata.js.map +1 -0
- package/build/esm/ontology/makeConjureContext.js +28 -0
- package/build/esm/ontology/makeConjureContext.js.map +1 -0
- package/build/esm/pageRequestAsAsyncIter.js +37 -0
- package/build/esm/pageRequestAsAsyncIter.js.map +1 -0
- package/build/esm/public/unstable-do-not-use.js +16 -2
- package/build/esm/public/unstable-do-not-use.js.map +1 -1
- package/build/esm/queries/applyQuery.d.ts +1 -2
- package/build/esm/queries/applyQuery.d.ts.map +1 -1
- package/build/esm/queries/applyQuery.js +234 -0
- package/build/esm/queries/applyQuery.js.map +1 -0
- package/build/esm/queries/queries.test.js +171 -0
- package/build/esm/queries/queries.test.js.map +1 -0
- package/build/esm/queries/types.d.ts +1 -2
- package/build/esm/queries/types.d.ts.map +1 -1
- package/build/esm/queries/types.js +17 -0
- package/build/esm/queries/types.js.map +1 -0
- package/build/esm/tsserver.js +133 -0
- package/build/esm/tsserver.js.map +1 -0
- package/build/esm/util/ArrayElement.js +17 -0
- package/build/esm/util/ArrayElement.js.map +1 -0
- package/build/esm/util/NOOP.js +17 -0
- package/build/esm/util/NOOP.js.map +1 -0
- package/build/esm/util/NullableProps.js +17 -0
- package/build/esm/util/NullableProps.js.map +1 -0
- package/build/esm/util/UserAgent.js +17 -0
- package/build/esm/util/UserAgent.js.map +1 -0
- package/build/esm/util/WireObjectSet.js +21 -0
- package/build/esm/util/WireObjectSet.js.map +1 -0
- package/build/esm/util/addUserAgentAndRequestContextHeaders.js +27 -0
- package/build/esm/util/addUserAgentAndRequestContextHeaders.js.map +1 -0
- package/build/esm/util/augmentRequestContext.js +52 -0
- package/build/esm/util/augmentRequestContext.js.map +1 -0
- package/build/esm/util/isOntologyObjectV2.js +20 -0
- package/build/esm/util/isOntologyObjectV2.js.map +1 -0
- package/build/esm/util/isOsdkBaseObject.d.ts +1 -1
- package/build/esm/util/isOsdkBaseObject.d.ts.map +1 -1
- package/build/esm/util/isOsdkBaseObject.js +19 -0
- package/build/esm/util/isOsdkBaseObject.js.map +1 -0
- package/build/esm/util/isOsdkObject.d.ts +1 -1
- package/build/esm/util/isOsdkObject.d.ts.map +1 -1
- package/build/esm/util/isOsdkObject.js +19 -0
- package/build/esm/util/isOsdkObject.js.map +1 -0
- package/build/esm/util/partialBy.js +17 -0
- package/build/esm/util/partialBy.js.map +1 -0
- package/build/esm/util/streamutils.js +95 -0
- package/build/esm/util/streamutils.js.map +1 -0
- package/build/esm/util/toDataValue.js +73 -0
- package/build/esm/util/toDataValue.js.map +1 -0
- package/build/esm/util/toDataValue.test.js +117 -0
- package/build/esm/util/toDataValue.test.js.map +1 -0
- package/build/esm/util/toDataValueQueries.js +107 -0
- package/build/esm/util/toDataValueQueries.js.map +1 -0
- package/package.json +14 -18
- package/build/browser/chunk-CG25K4WC.js +0 -2502
- package/build/browser/chunk-CG25K4WC.js.map +0 -1
- package/build/esm/chunk-MQTCPUPF.js +0 -2505
- package/build/esm/chunk-MQTCPUPF.js.map +0 -1
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { $ontologyRid, Employee, FooInterface, objectTypeWithAllPropertyTypes } from "@osdk/client.test.ontology";
|
|
17
|
+
import { symbolClientContext } from "@osdk/shared.client";
|
|
18
|
+
import { createSharedClientContext } from "@osdk/shared.client.impl";
|
|
19
|
+
import { apiServer } from "@osdk/shared.test";
|
|
20
|
+
import { afterAll, beforeAll, describe, expect, expectTypeOf, it } from "vitest";
|
|
21
|
+
import { createClient } from "../createClient.js";
|
|
22
|
+
import { createMinimalClient } from "../createMinimalClient.js";
|
|
23
|
+
import { convertWireToOsdkObjects } from "./convertWireToOsdkObjects.js";
|
|
24
|
+
describe("convertWireToOsdkObjects", () => {
|
|
25
|
+
let client;
|
|
26
|
+
beforeAll(async () => {
|
|
27
|
+
apiServer.listen();
|
|
28
|
+
client = createClient("https://stack.palantir.com", $ontologyRid, async () => "myAccessToken");
|
|
29
|
+
});
|
|
30
|
+
afterAll(() => {
|
|
31
|
+
apiServer.close();
|
|
32
|
+
});
|
|
33
|
+
it("configures properties correctly", async () => {
|
|
34
|
+
const {
|
|
35
|
+
data: [employee]
|
|
36
|
+
} = await client(Employee).fetchPage();
|
|
37
|
+
expect(Object.keys(employee).sort()).toEqual(["employeeId", "fullName", "office", "class", "startDate", "employeeStatus", "$apiName", "$objectType", "$primaryKey", "$title"].sort());
|
|
38
|
+
expect(Object.keys(employee.$as)).toEqual([]);
|
|
39
|
+
expect(Object.keys(employee.$link)).toEqual(["peeps", "lead", "officeLink"]);
|
|
40
|
+
});
|
|
41
|
+
it("reuses the object prototype across objects", async () => {
|
|
42
|
+
const employees = await client(Employee).fetchPage();
|
|
43
|
+
expect(employees.data.length).toBeGreaterThanOrEqual(2);
|
|
44
|
+
const [a, b] = employees.data;
|
|
45
|
+
expect(Object.getPrototypeOf(Object.getPrototypeOf(a))).toBe(Object.getPrototypeOf(Object.getPrototypeOf(b)));
|
|
46
|
+
});
|
|
47
|
+
it("converts attachments as expected", async () => {
|
|
48
|
+
const withValues = await client(objectTypeWithAllPropertyTypes).where({
|
|
49
|
+
id: 1
|
|
50
|
+
}).fetchPage();
|
|
51
|
+
expect(withValues.data.length).toBeGreaterThanOrEqual(1);
|
|
52
|
+
const {
|
|
53
|
+
attachment,
|
|
54
|
+
attachmentArray
|
|
55
|
+
} = withValues.data[0];
|
|
56
|
+
expectTypeOf(attachment).toMatchTypeOf;
|
|
57
|
+
expect(attachment?.rid).toEqual("ri.attachments.main.attachment.86016861-707f-4292-b258-6a7108915a75");
|
|
58
|
+
expect(Array.isArray(attachmentArray)).toBeTruthy();
|
|
59
|
+
expectTypeOf(attachmentArray[0]).toMatchTypeOf;
|
|
60
|
+
const withoutValues = await client(objectTypeWithAllPropertyTypes).where({
|
|
61
|
+
id: 2
|
|
62
|
+
}).fetchPage();
|
|
63
|
+
const {
|
|
64
|
+
attachment: emptyAttachment,
|
|
65
|
+
attachmentArray: emptyAttachmentArray
|
|
66
|
+
} = withoutValues.data[0];
|
|
67
|
+
expect(emptyAttachment).toBeUndefined();
|
|
68
|
+
expect(emptyAttachmentArray).toBeUndefined();
|
|
69
|
+
});
|
|
70
|
+
it("works even with unknown apiNames", async () => {
|
|
71
|
+
const clientCtx = createMinimalClient({
|
|
72
|
+
ontologyRid: $ontologyRid
|
|
73
|
+
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
74
|
+
createSharedClientContext("https://stack.palantir.com", async () => "myAccessToken", "userAgent");
|
|
75
|
+
let object = {
|
|
76
|
+
__apiName: Employee.apiName,
|
|
77
|
+
__primaryKey: 0
|
|
78
|
+
};
|
|
79
|
+
const prototypeBefore = Object.getPrototypeOf(object);
|
|
80
|
+
let object2 = await convertWireToOsdkObjects(clientCtx, [object], undefined, undefined, undefined, false);
|
|
81
|
+
const prototypeAfter = Object.getPrototypeOf(object2);
|
|
82
|
+
expect(prototypeBefore).not.toBe(prototypeAfter);
|
|
83
|
+
});
|
|
84
|
+
it("updates interface when underlying changes", async () => {
|
|
85
|
+
const clientCtx = createMinimalClient({
|
|
86
|
+
ontologyRid: $ontologyRid
|
|
87
|
+
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
88
|
+
const [obj] = await convertWireToOsdkObjects(clientCtx, [{
|
|
89
|
+
__apiName: "Employee",
|
|
90
|
+
__primaryKey: 0,
|
|
91
|
+
__title: "Steve",
|
|
92
|
+
fullName: "Steve",
|
|
93
|
+
employeeId: "5"
|
|
94
|
+
}], undefined);
|
|
95
|
+
expect(obj.fullName).toEqual("Steve");
|
|
96
|
+
expect(Object.keys(obj).sort()).toEqual(["$apiName", "$objectType", "$primaryKey", "$title", "employeeId", "fullName"].sort());
|
|
97
|
+
const objAsFoo = obj.$as(FooInterface);
|
|
98
|
+
expect(objAsFoo).toMatchObject({
|
|
99
|
+
fooSpt: obj.fullName,
|
|
100
|
+
$apiName: FooInterface.apiName,
|
|
101
|
+
$primaryKey: obj.$primaryKey,
|
|
102
|
+
$objectType: obj.$objectType,
|
|
103
|
+
$title: obj.$title
|
|
104
|
+
});
|
|
105
|
+
console.log(obj);
|
|
106
|
+
console.log(objAsFoo);
|
|
107
|
+
obj.$updateInternalValues({
|
|
108
|
+
fullName: "Bob"
|
|
109
|
+
});
|
|
110
|
+
expect(obj.fullName).toEqual("Bob");
|
|
111
|
+
expect(objAsFoo.fooSpt).toEqual(obj.fullName);
|
|
112
|
+
expect(Object.keys(objAsFoo).sort()).toEqual(["$apiName", "$objectType", "$primaryKey", "$title", "fooSpt"].sort());
|
|
113
|
+
expect(obj).toBe(objAsFoo.$as(Employee));
|
|
114
|
+
expect(objAsFoo).toBe(obj.$as(FooInterface));
|
|
115
|
+
});
|
|
116
|
+
it("reconstitutes interfaces properly without rid", async () => {
|
|
117
|
+
const clientCtx = createMinimalClient({
|
|
118
|
+
ontologyRid: $ontologyRid
|
|
119
|
+
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
120
|
+
const [objAsFoo] = await convertWireToOsdkObjects(clientCtx, [{
|
|
121
|
+
__apiName: "Employee",
|
|
122
|
+
__primaryKey: 0,
|
|
123
|
+
__title: "Steve",
|
|
124
|
+
fooSpt: "Steve"
|
|
125
|
+
}], FooInterface.apiName);
|
|
126
|
+
expect(objAsFoo).toMatchInlineSnapshot(`
|
|
127
|
+
{
|
|
128
|
+
"$apiName": "FooInterface",
|
|
129
|
+
"$objectType": "Employee",
|
|
130
|
+
"$primaryKey": 0,
|
|
131
|
+
"$title": "Steve",
|
|
132
|
+
"fooSpt": "Steve",
|
|
133
|
+
}
|
|
134
|
+
`);
|
|
135
|
+
const obj = objAsFoo.$as(Employee);
|
|
136
|
+
expect(obj.fullName).toEqual("Steve");
|
|
137
|
+
expect(obj).toMatchInlineSnapshot(`
|
|
138
|
+
{
|
|
139
|
+
"$apiName": "Employee",
|
|
140
|
+
"$objectType": "Employee",
|
|
141
|
+
"$primaryKey": 0,
|
|
142
|
+
"$title": "Steve",
|
|
143
|
+
"employeeId": 0,
|
|
144
|
+
"fullName": "Steve",
|
|
145
|
+
}
|
|
146
|
+
`);
|
|
147
|
+
});
|
|
148
|
+
it("reconstitutes interfaces properly with rid", async () => {
|
|
149
|
+
const clientCtx = createMinimalClient({
|
|
150
|
+
ontologyRid: $ontologyRid
|
|
151
|
+
}, "https://stack.palantir.com", async () => "myAccessToken");
|
|
152
|
+
const [objAsFoo] = await convertWireToOsdkObjects(clientCtx, [{
|
|
153
|
+
__apiName: "Employee",
|
|
154
|
+
__primaryKey: 0,
|
|
155
|
+
__title: "Steve",
|
|
156
|
+
__rid: "hiMom",
|
|
157
|
+
fooSpt: "Steve"
|
|
158
|
+
}], FooInterface.apiName);
|
|
159
|
+
expect(objAsFoo).toMatchInlineSnapshot(`
|
|
160
|
+
{
|
|
161
|
+
"$apiName": "FooInterface",
|
|
162
|
+
"$objectType": "Employee",
|
|
163
|
+
"$primaryKey": 0,
|
|
164
|
+
"$rid": "hiMom",
|
|
165
|
+
"$title": "Steve",
|
|
166
|
+
"fooSpt": "Steve",
|
|
167
|
+
}
|
|
168
|
+
`);
|
|
169
|
+
expect(objAsFoo.$rid).toEqual("hiMom");
|
|
170
|
+
const obj = objAsFoo.$as(Employee);
|
|
171
|
+
expect(obj.fullName).toEqual("Steve");
|
|
172
|
+
expect(obj).toMatchInlineSnapshot(`
|
|
173
|
+
{
|
|
174
|
+
"$apiName": "Employee",
|
|
175
|
+
"$objectType": "Employee",
|
|
176
|
+
"$primaryKey": 0,
|
|
177
|
+
"$rid": "hiMom",
|
|
178
|
+
"$title": "Steve",
|
|
179
|
+
"employeeId": 0,
|
|
180
|
+
"fullName": "Steve",
|
|
181
|
+
}
|
|
182
|
+
`);
|
|
183
|
+
expect(obj.$rid).toEqual("hiMom");
|
|
184
|
+
});
|
|
185
|
+
describe("selection keys", () => {
|
|
186
|
+
it("throws when required is missing", async () => {
|
|
187
|
+
let object = {
|
|
188
|
+
__apiName: "Employee",
|
|
189
|
+
__primaryKey: 0
|
|
190
|
+
};
|
|
191
|
+
await expect(() => convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, ["employeeId"], "throw")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);
|
|
192
|
+
});
|
|
193
|
+
it("does not throw when optional is missing", async () => {
|
|
194
|
+
await expect(convertWireToOsdkObjects(client[symbolClientContext], [{
|
|
195
|
+
__apiName: "Employee",
|
|
196
|
+
__primaryKey: 0
|
|
197
|
+
}], undefined, undefined, ["fullName"], "throw")).resolves.to.not.toBeUndefined();
|
|
198
|
+
});
|
|
199
|
+
it("filters when it should", async () => {
|
|
200
|
+
const result = await convertWireToOsdkObjects(client[symbolClientContext], [{
|
|
201
|
+
__apiName: "Employee",
|
|
202
|
+
__primaryKey: 0
|
|
203
|
+
}], undefined, undefined, ["employeeId"], "drop");
|
|
204
|
+
expect(result.length).toBe(0);
|
|
205
|
+
});
|
|
206
|
+
it("does not filter when it shouldn't", async () => {
|
|
207
|
+
const result = await convertWireToOsdkObjects(client[symbolClientContext], [{
|
|
208
|
+
__apiName: "Employee",
|
|
209
|
+
__primaryKey: 0
|
|
210
|
+
}], undefined, undefined, ["fullName"], "drop");
|
|
211
|
+
expect(result.length).toBe(1);
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
describe("without selection keys", () => {
|
|
215
|
+
it("throws when required is missing", async () => {
|
|
216
|
+
let object = {
|
|
217
|
+
__apiName: "Employee",
|
|
218
|
+
__primaryKey: 0
|
|
219
|
+
};
|
|
220
|
+
await expect(() => convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, undefined, "throw")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);
|
|
221
|
+
});
|
|
222
|
+
it("does not throw when required is present", async () => {
|
|
223
|
+
await expect(convertWireToOsdkObjects(client[symbolClientContext], [{
|
|
224
|
+
__apiName: "Employee",
|
|
225
|
+
__primaryKey: 0,
|
|
226
|
+
"employeeId": 0
|
|
227
|
+
}], undefined, undefined, undefined, "throw")).resolves.to.not.toBeUndefined();
|
|
228
|
+
});
|
|
229
|
+
it("filters when it should", async () => {
|
|
230
|
+
const result = await convertWireToOsdkObjects(client[symbolClientContext], [{
|
|
231
|
+
__apiName: "Employee",
|
|
232
|
+
__primaryKey: 0
|
|
233
|
+
}], undefined, undefined, undefined, "drop");
|
|
234
|
+
expect(result.length).toBe(0);
|
|
235
|
+
});
|
|
236
|
+
it("does not filter when it shouldn't", async () => {
|
|
237
|
+
const result = await convertWireToOsdkObjects(client[symbolClientContext], [{
|
|
238
|
+
__apiName: "Employee",
|
|
239
|
+
__primaryKey: 0,
|
|
240
|
+
"employeeId": 0
|
|
241
|
+
}], undefined, undefined, undefined, "drop");
|
|
242
|
+
expect(result.length).toBe(1);
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
it("behaves correctly when converting", async () => {
|
|
246
|
+
const result = await convertWireToOsdkObjects(client[symbolClientContext], [{
|
|
247
|
+
__apiName: "Employee",
|
|
248
|
+
__primaryKey: 0,
|
|
249
|
+
fooSpt: "hi"
|
|
250
|
+
}], "FooInterface", undefined, ["fooSpt"], "drop");
|
|
251
|
+
expect(result.length).toBe(1);
|
|
252
|
+
});
|
|
253
|
+
});
|
|
254
|
+
//# sourceMappingURL=convertWireToOsdkObjects.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convertWireToOsdkObjects.test.js","names":["$ontologyRid","Employee","FooInterface","objectTypeWithAllPropertyTypes","symbolClientContext","createSharedClientContext","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","createMinimalClient","convertWireToOsdkObjects","client","listen","close","data","employee","fetchPage","Object","keys","sort","toEqual","$as","$link","employees","length","toBeGreaterThanOrEqual","a","b","getPrototypeOf","toBe","withValues","where","id","attachment","attachmentArray","toMatchTypeOf","rid","Array","isArray","toBeTruthy","withoutValues","emptyAttachment","emptyAttachmentArray","toBeUndefined","clientCtx","ontologyRid","object","__apiName","apiName","__primaryKey","prototypeBefore","object2","undefined","prototypeAfter","not","obj","__title","fullName","employeeId","objAsFoo","toMatchObject","fooSpt","$apiName","$primaryKey","$objectType","$title","console","log","$updateInternalValues","toMatchInlineSnapshot","__rid","$rid","rejects","toThrowErrorMatchingInlineSnapshot","resolves","to","result"],"sources":["convertWireToOsdkObjects.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { $ontologyRid, Employee, FooInterface, objectTypeWithAllPropertyTypes, } from \"@osdk/client.test.ontology\";\nimport { symbolClientContext } from \"@osdk/shared.client\";\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport { afterAll, beforeAll, describe, expect, expectTypeOf, it, } from \"vitest\";\nimport { createClient } from \"../createClient.js\";\nimport { createMinimalClient } from \"../createMinimalClient.js\";\nimport { convertWireToOsdkObjects } from \"./convertWireToOsdkObjects.js\";\ndescribe(\"convertWireToOsdkObjects\", () => {\n let client;\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\"https://stack.palantir.com\", $ontologyRid, async () => \"myAccessToken\");\n });\n afterAll(() => {\n apiServer.close();\n });\n it(\"configures properties correctly\", async () => {\n const { data: [employee] } = await client(Employee).fetchPage();\n expect(Object.keys(employee).sort()).toEqual([\n \"employeeId\",\n \"fullName\",\n \"office\",\n \"class\",\n \"startDate\",\n \"employeeStatus\",\n \"$apiName\",\n \"$objectType\",\n \"$primaryKey\",\n \"$title\",\n ].sort());\n expect(Object.keys(employee.$as)).toEqual([]);\n expect(Object.keys(employee.$link)).toEqual([\n \"peeps\",\n \"lead\",\n \"officeLink\",\n ]);\n });\n it(\"reuses the object prototype across objects\", async () => {\n const employees = await client(Employee).fetchPage();\n expect(employees.data.length).toBeGreaterThanOrEqual(2);\n const [a, b] = employees.data;\n expect(Object.getPrototypeOf(Object.getPrototypeOf(a))).toBe(Object.getPrototypeOf(Object.getPrototypeOf(b)));\n });\n it(\"converts attachments as expected\", async () => {\n const withValues = await client(objectTypeWithAllPropertyTypes)\n .where({ id: 1 })\n .fetchPage();\n expect(withValues.data.length).toBeGreaterThanOrEqual(1);\n const { attachment, attachmentArray } = withValues.data[0];\n expectTypeOf(attachment).toMatchTypeOf;\n expect(attachment?.rid).toEqual(\"ri.attachments.main.attachment.86016861-707f-4292-b258-6a7108915a75\");\n expect(Array.isArray(attachmentArray)).toBeTruthy();\n expectTypeOf(attachmentArray[0]).toMatchTypeOf;\n const withoutValues = await client(objectTypeWithAllPropertyTypes).where({ id: 2 }).fetchPage();\n const { attachment: emptyAttachment, attachmentArray: emptyAttachmentArray, } = withoutValues.data[0];\n expect(emptyAttachment).toBeUndefined();\n expect(emptyAttachmentArray).toBeUndefined();\n });\n it(\"works even with unknown apiNames\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n createSharedClientContext(\"https://stack.palantir.com\", async () => \"myAccessToken\", \"userAgent\");\n let object = {\n __apiName: Employee.apiName,\n __primaryKey: 0,\n };\n const prototypeBefore = Object.getPrototypeOf(object);\n let object2 = await convertWireToOsdkObjects(clientCtx, [object], undefined, undefined, undefined, false);\n const prototypeAfter = Object.getPrototypeOf(object2);\n expect(prototypeBefore).not.toBe(prototypeAfter);\n });\n it(\"updates interface when underlying changes\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n let objectFromWire = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n __title: \"Steve\",\n fullName: \"Steve\",\n employeeId: \"5\",\n };\n const [obj] = (await convertWireToOsdkObjects(clientCtx, [objectFromWire], undefined));\n expect(obj.fullName).toEqual(\"Steve\");\n expect(Object.keys(obj).sort()).toEqual([\n \"$apiName\",\n \"$objectType\",\n \"$primaryKey\",\n \"$title\",\n \"employeeId\",\n \"fullName\",\n ].sort());\n const objAsFoo = obj.$as(FooInterface);\n expect(objAsFoo).toMatchObject({\n fooSpt: obj.fullName,\n $apiName: FooInterface.apiName,\n $primaryKey: obj.$primaryKey,\n $objectType: obj.$objectType,\n $title: obj.$title,\n });\n console.log(obj);\n console.log(objAsFoo);\n obj.$updateInternalValues({\n fullName: \"Bob\",\n });\n expect(obj.fullName).toEqual(\"Bob\");\n expect(objAsFoo.fooSpt).toEqual(obj.fullName);\n expect(Object.keys(objAsFoo).sort()).toEqual([\n \"$apiName\",\n \"$objectType\",\n \"$primaryKey\",\n \"$title\",\n \"fooSpt\",\n ].sort());\n expect(obj).toBe(objAsFoo.$as(Employee));\n expect(objAsFoo).toBe(obj.$as(FooInterface));\n });\n it(\"reconstitutes interfaces properly without rid\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n let objectFromWire = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n __title: \"Steve\",\n fooSpt: \"Steve\",\n };\n const [objAsFoo] = (await convertWireToOsdkObjects(clientCtx, [objectFromWire], FooInterface.apiName));\n expect(objAsFoo).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"FooInterface\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$title\": \"Steve\",\n \"fooSpt\": \"Steve\",\n }\n `);\n const obj = objAsFoo.$as(Employee);\n expect(obj.fullName).toEqual(\"Steve\");\n expect(obj).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"Employee\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$title\": \"Steve\",\n \"employeeId\": 0,\n \"fullName\": \"Steve\",\n }\n `);\n });\n it(\"reconstitutes interfaces properly with rid\", async () => {\n const clientCtx = createMinimalClient({ ontologyRid: $ontologyRid }, \"https://stack.palantir.com\", async () => \"myAccessToken\");\n let objectFromWire = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n __title: \"Steve\",\n __rid: \"hiMom\",\n fooSpt: \"Steve\",\n };\n const [objAsFoo] = (await convertWireToOsdkObjects(clientCtx, [objectFromWire], FooInterface.apiName));\n expect(objAsFoo).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"FooInterface\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$rid\": \"hiMom\",\n \"$title\": \"Steve\",\n \"fooSpt\": \"Steve\",\n }\n `);\n expect(objAsFoo.$rid).toEqual(\"hiMom\");\n const obj = objAsFoo.$as(Employee);\n expect(obj.fullName).toEqual(\"Steve\");\n expect(obj).toMatchInlineSnapshot(`\n {\n \"$apiName\": \"Employee\",\n \"$objectType\": \"Employee\",\n \"$primaryKey\": 0,\n \"$rid\": \"hiMom\",\n \"$title\": \"Steve\",\n \"employeeId\": 0,\n \"fullName\": \"Steve\",\n }\n `);\n expect(obj.$rid).toEqual(\"hiMom\");\n });\n describe(\"selection keys\", () => {\n it(\"throws when required is missing\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n await expect(() => convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, [\"employeeId\"], \"throw\")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);\n });\n it(\"does not throw when optional is missing\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n await expect(convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, [\"fullName\"], \"throw\")).resolves.to.not.toBeUndefined();\n });\n it(\"filters when it should\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n const result = await convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, [\"employeeId\"], \"drop\");\n expect(result.length).toBe(0);\n });\n it(\"does not filter when it shouldn't\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n const result = await convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, [\"fullName\"], \"drop\");\n expect(result.length).toBe(1);\n });\n });\n describe(\"without selection keys\", () => {\n it(\"throws when required is missing\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n await expect(() => convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, undefined, \"throw\")).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Unable to safely convert objects as some non nullable properties are null]`);\n });\n it(\"does not throw when required is present\", async () => {\n let object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n \"employeeId\": 0,\n };\n await expect(convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, undefined, \"throw\")).resolves.to.not.toBeUndefined();\n });\n it(\"filters when it should\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n };\n const result = await convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, undefined, \"drop\");\n expect(result.length).toBe(0);\n });\n it(\"does not filter when it shouldn't\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n \"employeeId\": 0,\n };\n const result = await convertWireToOsdkObjects(client[symbolClientContext], [object], undefined, undefined, undefined, \"drop\");\n expect(result.length).toBe(1);\n });\n });\n it(\"behaves correctly when converting\", async () => {\n const object = {\n __apiName: \"Employee\",\n __primaryKey: 0,\n fooSpt: \"hi\",\n };\n const result = await convertWireToOsdkObjects(client[symbolClientContext], [object], \"FooInterface\", undefined, [\"fooSpt\"], \"drop\");\n expect(result.length).toBe(1);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,YAAY,EAAEC,QAAQ,EAAEC,YAAY,EAAEC,8BAA8B,QAAS,4BAA4B;AAClH,SAASC,mBAAmB,QAAQ,qBAAqB;AACzD,SAASC,yBAAyB,QAAQ,0BAA0B;AACpE,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAS,QAAQ;AACjF,SAASC,YAAY,QAAQ,oBA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AAE,CAL5D;MACXgD,SAAS,EAAE,UAAU;MACrBE,YAAY,EAAE,CAAC;MACfY,MAAM,EAAE;IACZ,CAAC,CACkF,EAAE,cAAc,EAAET,SAAS,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IACnI/C,MAAM,CAACuE,MAAM,CAACpD,MAAM,CAAC,CAACK,IAAI,CAAC,CAAC,CAAC;EACjC,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
export declare function augment<Q extends ObjectOrInterfaceDefinition, T extends keyof CompileTimeMetadata<Q>["properties"] & string>(type: Q, ...properties: T[]): Augment<Q, T>;
|
|
1
|
+
import type { Augment, ObjectOrInterfaceDefinition, PropertyKeys } from "@osdk/api";
|
|
2
|
+
export declare function augment<Q extends ObjectOrInterfaceDefinition, T extends PropertyKeys<Q>>(type: Q, ...properties: T[]): Augment<Q, T>;
|
|
4
3
|
//# sourceMappingURL=fetchPage.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchPage.d.ts","sourceRoot":"","sources":["../../../src/object/fetchPage.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"fetchPage.d.ts","sourceRoot":"","sources":["../../../src/object/fetchPage.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EACV,OAAO,EAOP,2BAA2B,EAE3B,YAAY,EAEb,MAAM,WAAW,CAAC;AAgBnB,wBAAgB,OAAO,CACrB,CAAC,SAAS,2BAA2B,EACrC,CAAC,SAAS,YAAY,CAAC,CAAC,CAAC,EAEzB,IAAI,EAAE,CAAC,EACP,GAAG,UAAU,EAAE,CAAC,EAAE,GACjB,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAEf"}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import * as OntologiesV2 from "@osdk/internal.foundry.ontologiesv2";
|
|
17
|
+
import { addUserAgentAndRequestContextHeaders } from "../util/addUserAgentAndRequestContextHeaders.js";
|
|
18
|
+
import { convertWireToOsdkObjects } from "./convertWireToOsdkObjects.js";
|
|
19
|
+
export function augment(type, ...properties) {
|
|
20
|
+
return {
|
|
21
|
+
[type.apiName]: properties
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
/** @internal */
|
|
25
|
+
export function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = undefined) {
|
|
26
|
+
if (objectSet.type === "base") {
|
|
27
|
+
if (objectSet.objectType !== expectedApiName) {
|
|
28
|
+
throw new Error(`Expected objectSet.objectType to be ${expectedApiName}, but got ${objectSet.objectType}`);
|
|
29
|
+
}
|
|
30
|
+
return existingWhere;
|
|
31
|
+
}
|
|
32
|
+
if (objectSet.type === "filter") {
|
|
33
|
+
return objectSetToSearchJsonV2(objectSet.objectSet, expectedApiName, existingWhere == null ? objectSet.where : {
|
|
34
|
+
type: "and",
|
|
35
|
+
value: [existingWhere, objectSet.where]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
throw new Error(`Unsupported objectSet type: ${objectSet.type}`);
|
|
39
|
+
}
|
|
40
|
+
async function fetchInterfacePage(client, interfaceType, args, objectSet) {
|
|
41
|
+
const result = await OntologiesV2.OntologyInterfaces.searchObjectsForInterface(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {
|
|
42
|
+
augmentedProperties: args.$augment ?? {},
|
|
43
|
+
augmentedSharedPropertyTypes: {},
|
|
44
|
+
otherInterfaceTypes: [],
|
|
45
|
+
selectedObjectTypes: args.$__EXPERIMENTAL_selectedObjectTypes ?? [],
|
|
46
|
+
selectedSharedPropertyTypes: args.$select ?? [],
|
|
47
|
+
where: objectSetToSearchJsonV2(objectSet, interfaceType.apiName)
|
|
48
|
+
}), {
|
|
49
|
+
preview: true
|
|
50
|
+
});
|
|
51
|
+
result.data = await convertWireToOsdkObjects(client, result.data,
|
|
52
|
+
// drop readonly
|
|
53
|
+
interfaceType.apiName, !args.$includeRid);
|
|
54
|
+
return result;
|
|
55
|
+
}
|
|
56
|
+
/** @internal */
|
|
57
|
+
export async function fetchPageInternal(client, objectType, objectSet, args = {}) {
|
|
58
|
+
if (objectType.type === "interface") {
|
|
59
|
+
return await fetchInterfacePage(client, objectType, args, objectSet); // fixme
|
|
60
|
+
} else {
|
|
61
|
+
return await fetchObjectPage(client, objectType, args, objectSet); // fixme
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** @internal */
|
|
65
|
+
export async function fetchPageWithErrorsInternal(client, objectType, objectSet, args = {}) {
|
|
66
|
+
try {
|
|
67
|
+
const result = await fetchPageInternal(client, objectType, objectSet, args);
|
|
68
|
+
return {
|
|
69
|
+
value: result
|
|
70
|
+
};
|
|
71
|
+
} catch (e) {
|
|
72
|
+
if (e instanceof Error) {
|
|
73
|
+
return {
|
|
74
|
+
error: e
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
return {
|
|
78
|
+
error: e
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* @param client
|
|
84
|
+
* @param objectType
|
|
85
|
+
* @param args
|
|
86
|
+
* @param objectSet
|
|
87
|
+
* @returns
|
|
88
|
+
* @internal
|
|
89
|
+
*/
|
|
90
|
+
export async function fetchPage(client, objectType, args, objectSet = {
|
|
91
|
+
type: "base",
|
|
92
|
+
objectType: objectType["apiName"]
|
|
93
|
+
}) {
|
|
94
|
+
return fetchPageInternal(client, objectType, objectSet, args);
|
|
95
|
+
}
|
|
96
|
+
/** @internal */
|
|
97
|
+
export async function fetchPageWithErrors(client, objectType, args, objectSet = {
|
|
98
|
+
type: "base",
|
|
99
|
+
objectType: objectType["apiName"]
|
|
100
|
+
}) {
|
|
101
|
+
return fetchPageWithErrorsInternal(client, objectType, objectSet, args);
|
|
102
|
+
}
|
|
103
|
+
function applyFetchArgs(args, body) {
|
|
104
|
+
if (args?.$nextPageToken) {
|
|
105
|
+
body.pageToken = args.$nextPageToken;
|
|
106
|
+
}
|
|
107
|
+
if (args?.$pageSize != null) {
|
|
108
|
+
body.pageSize = args.$pageSize;
|
|
109
|
+
}
|
|
110
|
+
if (args?.$orderBy != null) {
|
|
111
|
+
body.orderBy = {
|
|
112
|
+
fields: Object.entries(args.$orderBy).map(([field, direction]) => ({
|
|
113
|
+
field,
|
|
114
|
+
direction
|
|
115
|
+
}))
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return body;
|
|
119
|
+
}
|
|
120
|
+
/** @internal */
|
|
121
|
+
export async function fetchObjectPage(client, objectType, args, objectSet) {
|
|
122
|
+
const r = await OntologiesV2.OntologyObjectSets.loadObjectSetV2(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {
|
|
123
|
+
objectSet,
|
|
124
|
+
// We have to do the following case because LoadObjectSetRequestV2 isn't readonly
|
|
125
|
+
select: args?.$select ?? [],
|
|
126
|
+
// FIXME?
|
|
127
|
+
excludeRid: !args?.$includeRid
|
|
128
|
+
}));
|
|
129
|
+
return Promise.resolve({
|
|
130
|
+
data: await convertWireToOsdkObjects(client, r.data, undefined, undefined, args.$select, args.$__EXPERIMENTAL_strictNonNull),
|
|
131
|
+
nextPageToken: r.nextPageToken,
|
|
132
|
+
totalCount: r.totalCount
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=fetchPage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchPage.js","names":["OntologiesV2","addUserAgentAndRequestContextHeaders","convertWireToOsdkObjects","augment","type","properties","apiName","objectSetToSearchJsonV2","objectSet","expectedApiName","existingWhere","undefined","objectType","Error","where","value","fetchInterfacePage","client","interfaceType","args","result","OntologyInterfaces","searchObjectsForInterface","ontologyRid","applyFetchArgs","augmentedProperties","$augment","augmentedSharedPropertyTypes","otherInterfaceTypes","selectedObjectTypes","$__EXPERIMENTAL_selectedObjectTypes","selectedSharedPropertyTypes","$select","preview","data","$includeRid","fetchPageInternal","fetchObjectPage","fetchPageWithErrorsInternal","e","error","fetchPage","fetchPageWithErrors","body","$nextPageToken","pageToken","$pageSize","pageSize","$orderBy","orderBy","fields","Object","entries","map","field","direction","r","OntologyObjectSets","loadObjectSetV2","select","excludeRid","Promise","resolve","$__EXPERIMENTAL_strictNonNull","nextPageToken","totalCount"],"sources":["fetchPage.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 { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { convertWireToOsdkObjects } from \"./convertWireToOsdkObjects.js\";\nexport function augment(type, ...properties) {\n return { [type.apiName]: properties };\n}\n/** @internal */\nexport function objectSetToSearchJsonV2(objectSet, expectedApiName, existingWhere = undefined) {\n if (objectSet.type === \"base\") {\n if (objectSet.objectType !== expectedApiName) {\n throw new Error(`Expected objectSet.objectType to be ${expectedApiName}, but got ${objectSet.objectType}`);\n }\n return existingWhere;\n }\n if (objectSet.type === \"filter\") {\n return objectSetToSearchJsonV2(objectSet.objectSet, expectedApiName, existingWhere == null ? objectSet.where : {\n type: \"and\",\n value: [existingWhere, objectSet.where],\n });\n }\n throw new Error(`Unsupported objectSet type: ${objectSet.type}`);\n}\nasync function fetchInterfacePage(client, interfaceType, args, objectSet) {\n const result = await OntologiesV2.OntologyInterfaces\n .searchObjectsForInterface(addUserAgentAndRequestContextHeaders(client, interfaceType), await client.ontologyRid, interfaceType.apiName, applyFetchArgs(args, {\n augmentedProperties: args.$augment ?? {},\n augmentedSharedPropertyTypes: {},\n otherInterfaceTypes: [],\n selectedObjectTypes: args.$__EXPERIMENTAL_selectedObjectTypes ?? [],\n selectedSharedPropertyTypes: args.$select ?? [],\n where: objectSetToSearchJsonV2(objectSet, interfaceType.apiName),\n }), { preview: true });\n result.data = await convertWireToOsdkObjects(client, result.data, // drop readonly\n interfaceType.apiName, !args.$includeRid);\n return result;\n}\n/** @internal */\nexport async function fetchPageInternal(client, objectType, objectSet, args = {}) {\n if (objectType.type === \"interface\") {\n return await fetchInterfacePage(client, objectType, args, objectSet); // fixme\n }\n else {\n return await fetchObjectPage(client, objectType, args, objectSet); // fixme\n }\n}\n/** @internal */\nexport async function fetchPageWithErrorsInternal(client, objectType, objectSet, args = {}) {\n try {\n const result = await fetchPageInternal(client, objectType, objectSet, args);\n return { value: result };\n }\n catch (e) {\n if (e instanceof Error) {\n return { error: e };\n }\n return { error: e };\n }\n}\n/**\n * @param client\n * @param objectType\n * @param args\n * @param objectSet\n * @returns\n * @internal\n */\nexport async function fetchPage(client, objectType, args, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}) {\n return fetchPageInternal(client, objectType, objectSet, args);\n}\n/** @internal */\nexport async function fetchPageWithErrors(client, objectType, args, objectSet = {\n type: \"base\",\n objectType: objectType[\"apiName\"],\n}) {\n return fetchPageWithErrorsInternal(client, objectType, objectSet, args);\n}\nfunction applyFetchArgs(args, body) {\n if (args?.$nextPageToken) {\n body.pageToken = args.$nextPageToken;\n }\n if (args?.$pageSize != null) {\n body.pageSize = args.$pageSize;\n }\n if (args?.$orderBy != null) {\n body.orderBy = {\n fields: Object.entries(args.$orderBy).map(([field, direction]) => ({\n field,\n direction,\n })),\n };\n }\n return body;\n}\n/** @internal */\nexport async function fetchObjectPage(client, objectType, args, objectSet) {\n const r = await OntologiesV2.OntologyObjectSets.loadObjectSetV2(addUserAgentAndRequestContextHeaders(client, objectType), await client.ontologyRid, applyFetchArgs(args, {\n objectSet,\n // We have to do the following case because LoadObjectSetRequestV2 isn't readonly\n select: (args?.$select ?? []), // FIXME?\n excludeRid: !args?.$includeRid,\n }));\n return Promise.resolve({\n data: await convertWireToOsdkObjects(client, r.data, undefined, undefined, args.$select, args.$__EXPERIMENTAL_strictNonNull),\n nextPageToken: r.nextPageToken,\n totalCount: r.totalCount,\n });\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,KAAKA,YAAY,MAAM,qCAAqC;AACnE,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,wBAAwB,QAAQ,+BAA+B;AACxE,OAAO,SAASC,OAAOA,CAACC,IAAI,EAAE,GAAGC,UAAU,EAAE;EACzC,OAAO;IAAE,CAACD,IAAI,CAACE,OAAO,GAAGD;EAAW,CAAC;AACzC;AACA;AACA,OAAO,SAASE,uBAAuBA,CAACC,SAAS,EAAEC,eAAe,EAAEC,aAAa,GAAGC,SAAS,EAAE;EAC3F,IAAIH,SAAS,CAACJ,IAAI,KAAK,MAAM,EAAE;IAC3B,IAAII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,CAAC,CAAC;EACH,OAAO0B,OAAO,CAACC,OAAO,CAAC;IACnB5B,IAAI,EAAE,MAAMhC,wBAAwB,CAACe,MAAM,EAAEuC,CAAC,CAACtB,IAAI,EAAEvB,SAAS,EAAEA,SAAS,EAAEQ,IAAI,CAACa,OAAO,EAAEb,IAAI,CAAC4C,6BAA6B,CAAC;IAC5HC,aAAa,EAAER,CAAC,CAACQ,aAAa;IAC9BC,UAAU,EAAET,CAAC,CAACS;EAClB,CAAC,CAAC;AACN","ignoreList":[]}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2023 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { Todo } from "@osdk/client.test.ontology";
|
|
17
|
+
import { describe, expect, expectTypeOf, it } from "vitest";
|
|
18
|
+
import { createMinimalClient } from "../createMinimalClient.js";
|
|
19
|
+
import { fetchPage, objectSetToSearchJsonV2 } from "../object/fetchPage.js";
|
|
20
|
+
import { createObjectSet, getWireObjectSet } from "../objectSet/createObjectSet.js";
|
|
21
|
+
const metadata = {
|
|
22
|
+
ontologyRid: "asdf"
|
|
23
|
+
};
|
|
24
|
+
describe(fetchPage, () => {
|
|
25
|
+
it("infers select properly", () => {
|
|
26
|
+
// this helper lets us get return types of functions that are generic
|
|
27
|
+
|
|
28
|
+
expectTypeOf().branded.toEqualTypeOf();
|
|
29
|
+
// e.g. fetchPage({ select: [] });
|
|
30
|
+
expectTypeOf().branded.toEqualTypeOf();
|
|
31
|
+
// e.g. fetchPage()
|
|
32
|
+
expectTypeOf().branded.toEqualTypeOf();
|
|
33
|
+
// e.g. fetchPage({ $select: ["text"]}
|
|
34
|
+
expectTypeOf().branded.toEqualTypeOf();
|
|
35
|
+
});
|
|
36
|
+
it("converts interface objectsets to search properly", () => {
|
|
37
|
+
expect(objectSetToSearchJsonV2({
|
|
38
|
+
type: "filter",
|
|
39
|
+
objectSet: {
|
|
40
|
+
type: "filter",
|
|
41
|
+
objectSet: {
|
|
42
|
+
type: "base",
|
|
43
|
+
objectType: "Todo"
|
|
44
|
+
},
|
|
45
|
+
where: {
|
|
46
|
+
type: "eq",
|
|
47
|
+
field: "text",
|
|
48
|
+
value: "hello"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
where: {
|
|
52
|
+
type: "gt",
|
|
53
|
+
field: "id",
|
|
54
|
+
value: 2
|
|
55
|
+
}
|
|
56
|
+
}, "Todo", undefined)).toEqual({
|
|
57
|
+
type: "and",
|
|
58
|
+
value: [{
|
|
59
|
+
type: "gt",
|
|
60
|
+
field: "id",
|
|
61
|
+
value: 2
|
|
62
|
+
}, {
|
|
63
|
+
type: "eq",
|
|
64
|
+
field: "text",
|
|
65
|
+
value: "hello"
|
|
66
|
+
}]
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
it("converts interface objectsets to search properly part 2", () => {
|
|
70
|
+
const client = createMinimalClient(metadata, "https://foo", async () => "");
|
|
71
|
+
const objectSet = createObjectSet(Todo, client).where({
|
|
72
|
+
text: "hello"
|
|
73
|
+
}).where({
|
|
74
|
+
id: {
|
|
75
|
+
$gt: 2
|
|
76
|
+
}
|
|
77
|
+
});
|
|
78
|
+
const wireObjectSet = getWireObjectSet(objectSet);
|
|
79
|
+
expect(objectSetToSearchJsonV2(wireObjectSet, "Todo", undefined)).toEqual({
|
|
80
|
+
type: "and",
|
|
81
|
+
value: [{
|
|
82
|
+
type: "gt",
|
|
83
|
+
field: "id",
|
|
84
|
+
value: 2
|
|
85
|
+
}, {
|
|
86
|
+
type: "eq",
|
|
87
|
+
field: "text",
|
|
88
|
+
value: "hello"
|
|
89
|
+
}]
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
describe("includeRid", () => {
|
|
93
|
+
it("properly returns the correct string for includeRid", () => {
|
|
94
|
+
expectTypeOf().toEqualTypeOf();
|
|
95
|
+
expectTypeOf().branded.toEqualTypeOf();
|
|
96
|
+
});
|
|
97
|
+
it("works with $all", () => {
|
|
98
|
+
expectTypeOf().branded.toEqualTypeOf();
|
|
99
|
+
expectTypeOf().branded.toEqualTypeOf();
|
|
100
|
+
expectTypeOf().branded.toEqualTypeOf();
|
|
101
|
+
expectTypeOf().branded.toEqualTypeOf();
|
|
102
|
+
expectTypeOf().branded.toEqualTypeOf();
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=fetchPage.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchPage.test.js","names":["Todo","describe","expect","expectTypeOf","it","createMinimalClient","fetchPage","objectSetToSearchJsonV2","createObjectSet","getWireObjectSet","metadata","ontologyRid","branded","toEqualTypeOf","type","objectSet","objectType","where","field","value","undefined","toEqual","client","text","id","$gt","wireObjectSet"],"sources":["fetchPage.test.js"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { Todo } from \"@osdk/client.test.ontology\";\nimport { describe, expect, expectTypeOf, it } from \"vitest\";\nimport { createMinimalClient } from \"../createMinimalClient.js\";\nimport { fetchPage, objectSetToSearchJsonV2 } from \"../object/fetchPage.js\";\nimport { createObjectSet, getWireObjectSet, } from \"../objectSet/createObjectSet.js\";\nconst metadata = {\n ontologyRid: \"asdf\",\n};\ndescribe(fetchPage, () => {\n it(\"infers select properly\", () => {\n // this helper lets us get return types of functions that are generic\n class Helper {\n fetchPage() {\n return fetchPage({}, {}, {});\n }\n }\n expectTypeOf()\n .branded\n .toEqualTypeOf();\n // e.g. fetchPage({ select: [] });\n expectTypeOf()\n .branded\n .toEqualTypeOf();\n // e.g. fetchPage()\n expectTypeOf()\n .branded\n .toEqualTypeOf();\n // e.g. fetchPage({ $select: [\"text\"]}\n expectTypeOf()\n .branded\n .toEqualTypeOf();\n });\n it(\"converts interface objectsets to search properly\", () => {\n expect(objectSetToSearchJsonV2({\n type: \"filter\",\n objectSet: {\n type: \"filter\",\n objectSet: {\n type: \"base\",\n objectType: \"Todo\",\n },\n where: {\n type: \"eq\",\n field: \"text\",\n value: \"hello\",\n },\n },\n where: {\n type: \"gt\",\n field: \"id\",\n value: 2,\n },\n }, \"Todo\", undefined)).toEqual({\n type: \"and\",\n value: [\n {\n type: \"gt\",\n field: \"id\",\n value: 2,\n },\n {\n type: \"eq\",\n field: \"text\",\n value: \"hello\",\n },\n ],\n });\n });\n it(\"converts interface objectsets to search properly part 2\", () => {\n const client = createMinimalClient(metadata, \"https://foo\", async () => \"\");\n const objectSet = createObjectSet(Todo, client).where({\n text: \"hello\",\n }).where({\n id: { $gt: 2 },\n });\n const wireObjectSet = getWireObjectSet(objectSet);\n expect(objectSetToSearchJsonV2(wireObjectSet, \"Todo\", undefined)).toEqual({\n type: \"and\",\n value: [\n {\n type: \"gt\",\n field: \"id\",\n value: 2,\n },\n {\n type: \"eq\",\n field: \"text\",\n value: \"hello\",\n },\n ],\n });\n });\n describe(\"includeRid\", () => {\n it(\"properly returns the correct string for includeRid\", () => {\n expectTypeOf()\n .toEqualTypeOf();\n expectTypeOf()\n .branded\n .toEqualTypeOf();\n });\n it(\"works with $all\", () => {\n expectTypeOf().branded\n .toEqualTypeOf();\n expectTypeOf()\n .branded\n .toEqualTypeOf();\n expectTypeOf()\n .branded\n .toEqualTypeOf();\n expectTypeOf()\n .branded\n .toEqualTypeOf();\n expectTypeOf()\n .branded\n .toEqualTypeOf();\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,IAAI,QAAQ,4BAA4B;AACjD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAC3D,SAASC,mBAAmB,QAAQ,2BAA2B;AAC/D,SAASC,SAAS,EAAEC,uBAAuB,QAAQ,wBAAwB;AAC3E,SAASC,eAAe,EAAEC,gBAAgB,QAAS,iCAAiC;AACpF,MAAMC,QAAQ,GAAG;EACbC,WAAW,EAAE;AACjB,CAAC;AACDV,QAAQ,CAACK,SAAS,EAAE,MAAM;EACtBF,EAAE,CAAC,wBAAwB,EAAE,MAAM;IAC/B;;IAMAD,YAAY,CAAC,CAAC,CACTS,OAAO,CACPC,aAAa,CAAC,CAAC;IACpB;IACAV,YAAY,CAAC,CAAC,CACTS,OAAO,CACPC,aAAa,CAAC,CAAC;IACpB;IACAV,YAAY,CAAC,CAAC,CACTS,OAAO,CACPC,aAAa,CAAC,CAAC;IACpB;IACAV,YAAY,CAAC,CAAC,CACTS,OAAO,CACPC,aAAa,CAAC,CAAC;EACxB,CAAC,CAAC;EACFT,EAAE,CAAC,kDAAkD,EAAE,MAAM;IACzDF,MAAM,CAACK,uBAAuB,CAAC;MAC3BO,IAAI,EAAE,QAAQ;MACdC,SAAS,EAAE;QACPD,IAAI,EAAE,QAAQ;QACdC,SAAS,EAAE;UACPD,IAAI,EAAE,MAAM;UACZE,UAAU,EAAE;QACh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AQ,CAAC,YAAY,EAAE,MAAM;IACzBG,EAAE,CAAC,oDAAoD,EAAE,MAAM;MAC3DD,YAAY,CAAC,CAAC,CACTU,aAAa,CAAC,CAAC;MACpBV,YAAY,CAAC,CAAC,CACTS,OAAO,CACPC,aAAa,CAAC,CAAC;IACxB,CAAC,CAAC;IACFT,EAAE,CAAC,iBAAiB,EAAE,MAAM;MACxBD,YAAY,CAAC,CAAC,CAACS,OAAO,CACjBC,aAAa,CAAC,CAAC;MACpBV,YAAY,CAAC,CAAC,CACTS,OAAO,CACPC,aAAa,CAAC,CAAC;MACpBV,YAAY,CAAC,CAAC,CACTS,OAAO,CACPC,aAAa,CAAC,CAAC;MACpBV,YAAY,CAAC,CAAC,CACTS,OAAO,CACPC,aAAa,CAAC,CAAC;MACpBV,YAAY,CAAC,CAAC,CACTS,OAAO,CACPC,aAAa,CAAC,CAAC;IACxB,CAAC,CAAC;EACN,CAAC,CAAC;AACN,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2024 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
import { PalantirApiError } from "@osdk/shared.net.errors";
|
|
17
|
+
import { fetchPage } from "./fetchPage.js";
|
|
18
|
+
/** @internal */
|
|
19
|
+
export async function fetchSingle(client, objectType, args, objectSet) {
|
|
20
|
+
const result = await fetchPage(client, objectType, {
|
|
21
|
+
...args,
|
|
22
|
+
pageSize: 1
|
|
23
|
+
}, objectSet);
|
|
24
|
+
if (result.data.length !== 1 || result.nextPageToken != null) {
|
|
25
|
+
throw new PalantirApiError(`Expected a single result but got ${result.data.length} instead${result.nextPageToken != null ? " with nextPageToken set" : ""}`);
|
|
26
|
+
}
|
|
27
|
+
return result.data[0];
|
|
28
|
+
}
|
|
29
|
+
/** @internal */
|
|
30
|
+
export async function fetchSingleWithErrors(client, objectType, args, objectSet) {
|
|
31
|
+
try {
|
|
32
|
+
const result = await fetchSingle(client, objectType, args, objectSet);
|
|
33
|
+
return {
|
|
34
|
+
value: result
|
|
35
|
+
};
|
|
36
|
+
} catch (e) {
|
|
37
|
+
if (e instanceof Error) {
|
|
38
|
+
return {
|
|
39
|
+
error: e
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
return {
|
|
43
|
+
error: e
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=fetchSingle.js.map
|