@osdk/client 2.2.0-beta.9 → 2.3.0-beta.1
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 +370 -0
- package/build/browser/MinimalClientContext.js.map +1 -1
- package/build/browser/__unstable/ConjureSupport.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 +134 -89
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.js +5 -1
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createClient.test.js +14 -6
- package/build/browser/createClient.test.js.map +1 -1
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/createMinimalClientHelper.js +25 -0
- package/build/browser/createMinimalClientHelper.js.map +1 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +36 -13
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +133 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
- package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js +93 -0
- package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
- package/build/browser/fetchMetadata.js +1 -1
- package/build/browser/fetchMetadata.js.map +1 -1
- package/build/browser/fetchMetadata.test.js +11 -9
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/index.js +0 -1
- package/build/browser/index.js.map +1 -1
- package/build/{esm/util/isOsdkBaseObject.js → browser/intellisense.test.helpers/showsObjectPropertyJsdoc.js} +9 -4
- package/build/browser/intellisense.test.helpers/showsObjectPropertyJsdoc.js.map +1 -0
- package/build/browser/intellisense.test.js +17 -1
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/logger/BaseLogger.js +59 -0
- package/build/browser/logger/BaseLogger.js.map +1 -0
- package/build/browser/logger/BrowserLogger.js +67 -0
- package/build/browser/logger/BrowserLogger.js.map +1 -0
- package/build/browser/logger/MinimalLogger.js +39 -0
- package/build/browser/logger/MinimalLogger.js.map +1 -0
- package/build/browser/logger/MinimalLogger.test.js +60 -0
- package/build/browser/logger/MinimalLogger.test.js.map +1 -0
- package/build/browser/logger/TestLogger.js +56 -0
- package/build/browser/logger/TestLogger.js.map +1 -0
- package/build/browser/object/attachment.test.js +20 -7
- package/build/browser/object/attachment.test.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +4 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +44 -33
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +4 -14
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +39 -33
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.js +4 -3
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/object/geotimeseriesreference.test.js +56 -134
- package/build/browser/object/geotimeseriesreference.test.js.map +1 -1
- package/build/browser/object/media.test.js +19 -14
- package/build/browser/object/media.test.js.map +1 -1
- package/build/browser/object/object.test.js +96 -89
- package/build/browser/object/object.test.js.map +1 -1
- package/build/browser/object/timeseries.test.js +119 -85
- package/build/browser/object/timeseries.test.js.map +1 -1
- package/build/browser/objectSet/InterfaceObjectSet.test.js +24 -20
- package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +113 -19
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +2 -2
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +19 -12
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +2 -1
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/observable/internal/ActionApplication.js +4 -4
- package/build/browser/observable/internal/ActionApplication.js.map +1 -1
- package/build/browser/observable/internal/BulkObjectLoader.js +93 -0
- package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -0
- package/build/browser/observable/internal/BulkObjectLoader.test.js +112 -0
- package/build/browser/observable/internal/BulkObjectLoader.test.js.map +1 -0
- package/build/browser/observable/internal/ListQuery.js +4 -1
- package/build/browser/observable/internal/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/ObjectQuery.js +3 -6
- package/build/browser/observable/internal/ObjectQuery.js.map +1 -1
- package/build/browser/observable/internal/OptimisticJob.js +1 -1
- package/build/browser/observable/internal/OptimisticJob.js.map +1 -1
- package/build/browser/observable/internal/Query.js.map +1 -1
- package/build/browser/observable/internal/Store.js +2 -2
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/Store.test.js +215 -206
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/observable/internal/objectMatchesWhereClause.js +0 -2
- package/build/browser/observable/internal/objectMatchesWhereClause.js.map +1 -1
- package/build/browser/observable/internal/testUtils.js +4 -3
- package/build/browser/observable/internal/testUtils.js.map +1 -1
- package/build/browser/ontology/OntologyProvider.js.map +1 -1
- package/build/browser/ontology/StandardOntologyProvider.js +12 -5
- package/build/browser/ontology/StandardOntologyProvider.js.map +1 -1
- package/build/browser/ontology/StandardOntologyProvider.test.js +17 -16
- package/build/browser/ontology/StandardOntologyProvider.test.js.map +1 -1
- package/build/browser/ontology/loadFullObjectMetadata.js +0 -1
- package/build/browser/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/browser/ontology/loadQueryMetadata.js +5 -2
- package/build/browser/ontology/loadQueryMetadata.js.map +1 -1
- package/build/browser/public/internal.js +2 -0
- package/build/browser/public/internal.js.map +1 -1
- 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/osdkConfig.js +49 -0
- package/build/browser/public-utils/osdkConfig.js.map +1 -0
- package/build/browser/{object/createObjectSpecifierFromPrimaryKey.js → public-utils/vite-env.d.ts} +2 -3
- package/build/browser/queries/applyQuery.js +6 -4
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +93 -27
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/queries/types.js.map +1 -1
- package/build/browser/tsserver.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/extractRdpDefinition.js +140 -0
- package/build/browser/util/extractRdpDefinition.js.map +1 -0
- package/build/browser/util/extractRdpDefinition.test.js +233 -0
- package/build/browser/util/extractRdpDefinition.test.js.map +1 -0
- package/build/browser/util/{isOsdkBaseObject.js → isObjectSpecifiersObject.js} +2 -2
- package/build/browser/util/isObjectSpecifiersObject.js.map +1 -0
- package/build/browser/util/isPoint.js +20 -0
- package/build/browser/util/isPoint.js.map +1 -0
- package/build/browser/util/objectSpecifierUtils.js +48 -0
- package/build/browser/util/objectSpecifierUtils.js.map +1 -0
- package/build/browser/util/objectSpecifierUtils.test.js +42 -0
- package/build/browser/util/objectSpecifierUtils.test.js.map +1 -0
- package/build/browser/util/toDataValue.js +6 -2
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValue.test.js +37 -16
- package/build/browser/util/toDataValue.test.js.map +1 -1
- package/build/browser/util/toDataValueQueries.js +4 -6
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/cjs/{Client-DBTcM9gB.d.cts → Client-CgL2LKN9.d.cts} +6 -7
- package/build/cjs/{chunk-MCQVHD2F.cjs → chunk-FKI2LO2O.cjs} +232 -68
- package/build/cjs/chunk-FKI2LO2O.cjs.map +1 -0
- package/build/cjs/{chunk-EY52J5Z4.cjs → chunk-W5PFESFR.cjs} +163 -34
- package/build/cjs/chunk-W5PFESFR.cjs.map +1 -0
- package/build/cjs/index.cjs +188 -166
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +4 -24
- package/build/cjs/public/internal.cjs +61 -7
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/internal.d.cts +50 -3
- package/build/cjs/public/unstable-do-not-use.cjs +224 -103
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +12 -3
- package/build/esm/MinimalClientContext.js.map +1 -1
- package/build/esm/__unstable/ConjureSupport.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 +134 -89
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.js +5 -1
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createClient.test.js +14 -6
- package/build/esm/createClient.test.js.map +1 -1
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/createMinimalClientHelper.js +25 -0
- package/build/esm/createMinimalClientHelper.js.map +1 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +36 -13
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +133 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
- package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js +93 -0
- package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
- package/build/esm/fetchMetadata.js +1 -1
- package/build/esm/fetchMetadata.js.map +1 -1
- package/build/esm/fetchMetadata.test.js +11 -9
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/index.js +0 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/{util/isOsdkObject.js → intellisense.test.helpers/showsObjectPropertyJsdoc.js} +9 -4
- package/build/esm/intellisense.test.helpers/showsObjectPropertyJsdoc.js.map +1 -0
- package/build/esm/intellisense.test.js +17 -1
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/logger/BaseLogger.js +59 -0
- package/build/esm/logger/BaseLogger.js.map +1 -0
- package/build/esm/logger/BrowserLogger.js +67 -0
- package/build/esm/logger/BrowserLogger.js.map +1 -0
- package/build/esm/logger/MinimalLogger.js +39 -0
- package/build/esm/logger/MinimalLogger.js.map +1 -0
- package/build/esm/logger/MinimalLogger.test.js +60 -0
- package/build/esm/logger/MinimalLogger.test.js.map +1 -0
- package/build/esm/logger/TestLogger.js +56 -0
- package/build/esm/logger/TestLogger.js.map +1 -0
- package/build/esm/object/attachment.test.js +20 -7
- package/build/esm/object/attachment.test.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +4 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +44 -33
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +4 -14
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +39 -33
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.js +4 -3
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/object/geotimeseriesreference.test.js +56 -134
- package/build/esm/object/geotimeseriesreference.test.js.map +1 -1
- package/build/esm/object/media.test.js +19 -14
- package/build/esm/object/media.test.js.map +1 -1
- package/build/esm/object/object.test.js +96 -89
- package/build/esm/object/object.test.js.map +1 -1
- package/build/esm/object/timeseries.test.js +119 -85
- package/build/esm/object/timeseries.test.js.map +1 -1
- package/build/esm/objectSet/InterfaceObjectSet.test.js +24 -20
- package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +113 -19
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +2 -2
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +19 -12
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +2 -1
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/observable/internal/ActionApplication.js +4 -4
- package/build/esm/observable/internal/ActionApplication.js.map +1 -1
- package/build/esm/observable/internal/BulkObjectLoader.js +93 -0
- package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -0
- package/build/esm/observable/internal/BulkObjectLoader.test.js +112 -0
- package/build/esm/observable/internal/BulkObjectLoader.test.js.map +1 -0
- package/build/esm/observable/internal/ListQuery.js +4 -1
- package/build/esm/observable/internal/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/ObjectQuery.js +3 -6
- package/build/esm/observable/internal/ObjectQuery.js.map +1 -1
- package/build/esm/observable/internal/OptimisticJob.js +1 -1
- package/build/esm/observable/internal/OptimisticJob.js.map +1 -1
- package/build/esm/observable/internal/Query.js.map +1 -1
- package/build/esm/observable/internal/Store.js +2 -2
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/Store.test.js +215 -206
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/observable/internal/objectMatchesWhereClause.js +0 -2
- package/build/esm/observable/internal/objectMatchesWhereClause.js.map +1 -1
- package/build/esm/observable/internal/testUtils.js +4 -3
- package/build/esm/observable/internal/testUtils.js.map +1 -1
- package/build/esm/ontology/OntologyProvider.js.map +1 -1
- package/build/esm/ontology/StandardOntologyProvider.js +12 -5
- package/build/esm/ontology/StandardOntologyProvider.js.map +1 -1
- package/build/esm/ontology/StandardOntologyProvider.test.js +17 -16
- package/build/esm/ontology/StandardOntologyProvider.test.js.map +1 -1
- package/build/esm/ontology/loadFullObjectMetadata.js +0 -1
- package/build/esm/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/esm/ontology/loadQueryMetadata.js +5 -2
- package/build/esm/ontology/loadQueryMetadata.js.map +1 -1
- package/build/esm/public/internal.js +2 -0
- package/build/esm/public/internal.js.map +1 -1
- 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/osdkConfig.js +49 -0
- package/build/esm/public-utils/osdkConfig.js.map +1 -0
- package/build/esm/{object/createObjectSpecifierFromPrimaryKey.js → public-utils/vite-env.d.ts} +2 -3
- package/build/esm/queries/applyQuery.js +6 -4
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +93 -27
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/queries/types.js.map +1 -1
- package/build/esm/tsserver.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/extractRdpDefinition.js +140 -0
- package/build/esm/util/extractRdpDefinition.js.map +1 -0
- package/build/esm/util/extractRdpDefinition.test.js +233 -0
- package/build/esm/util/extractRdpDefinition.test.js.map +1 -0
- package/build/{browser/util/isOsdkObject.js → esm/util/isObjectSpecifiersObject.js} +2 -2
- package/build/esm/util/isObjectSpecifiersObject.js.map +1 -0
- package/build/esm/util/isPoint.js +20 -0
- package/build/esm/util/isPoint.js.map +1 -0
- package/build/esm/util/objectSpecifierUtils.js +48 -0
- package/build/esm/util/objectSpecifierUtils.js.map +1 -0
- package/build/esm/util/objectSpecifierUtils.test.js +42 -0
- package/build/esm/util/objectSpecifierUtils.test.js.map +1 -0
- package/build/esm/util/toDataValue.js +6 -2
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValue.test.js +37 -16
- package/build/esm/util/toDataValue.test.js.map +1 -1
- package/build/esm/util/toDataValueQueries.js +4 -6
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/build/types/MinimalClientContext.d.ts +1 -1
- package/build/types/MinimalClientContext.d.ts.map +1 -1
- package/build/types/__unstable/ConjureSupport.d.ts +2 -2
- package/build/types/actions/applyAction.d.ts +1 -2
- package/build/types/actions/applyAction.d.ts.map +1 -1
- package/build/types/createClient.d.ts +1 -1
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/createClient.test.d.ts +2 -1
- package/build/types/createClient.test.d.ts.map +1 -1
- package/build/types/createMinimalClientHelper.d.ts +1 -0
- package/build/types/createMinimalClientHelper.d.ts.map +1 -0
- package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts +1 -0
- package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts.map +1 -0
- package/build/types/index.d.ts +4 -6
- package/build/types/index.d.ts.map +1 -1
- package/build/types/intellisense.test.helpers/showsObjectPropertyJsdoc.d.ts +1 -0
- package/build/types/intellisense.test.helpers/showsObjectPropertyJsdoc.d.ts.map +1 -0
- package/build/types/logger/BaseLogger.d.ts +33 -0
- package/build/types/logger/BaseLogger.d.ts.map +1 -0
- package/build/types/logger/BrowserLogger.d.ts +9 -0
- package/build/types/logger/BrowserLogger.d.ts.map +1 -0
- package/build/types/logger/MinimalLogger.d.ts +9 -0
- package/build/types/logger/MinimalLogger.d.ts.map +1 -0
- package/build/types/logger/MinimalLogger.test.d.ts +1 -0
- package/build/types/logger/MinimalLogger.test.d.ts.map +1 -0
- package/build/types/logger/TestLogger.d.ts +14 -0
- package/build/types/logger/TestLogger.d.ts.map +1 -0
- package/build/types/object/convertWireToOsdkObjects.d.ts +4 -4
- package/build/types/object/convertWireToOsdkObjects.d.ts.map +1 -1
- package/build/types/object/fetchPage.d.ts.map +1 -1
- package/build/types/object/object.test.d.ts.map +1 -1
- package/build/types/objectSet/ObjectSet.test.d.ts.map +1 -1
- package/build/types/observable/internal/ActionApplication.d.ts +2 -2
- package/build/types/observable/internal/ActionApplication.d.ts.map +1 -1
- package/build/types/observable/internal/BulkObjectLoader.d.ts +8 -0
- package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -0
- package/build/types/observable/internal/BulkObjectLoader.test.d.ts +1 -0
- package/build/types/observable/internal/BulkObjectLoader.test.d.ts.map +1 -0
- package/build/types/observable/internal/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/ObjectQuery.d.ts.map +1 -1
- package/build/types/observable/internal/OptimisticJob.d.ts.map +1 -1
- package/build/types/observable/internal/Query.d.ts +2 -2
- package/build/types/observable/internal/Query.d.ts.map +1 -1
- package/build/types/observable/internal/Store.d.ts +2 -2
- package/build/types/observable/internal/Store.d.ts.map +1 -1
- package/build/types/observable/internal/testUtils.d.ts +1 -2
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/build/types/ontology/OntologyProvider.d.ts +1 -1
- package/build/types/ontology/OntologyProvider.d.ts.map +1 -1
- package/build/types/ontology/loadQueryMetadata.d.ts +1 -1
- package/build/types/ontology/loadQueryMetadata.d.ts.map +1 -1
- package/build/types/public/internal.d.ts +2 -0
- package/build/types/public/internal.d.ts.map +1 -1
- package/build/types/public/unstable-do-not-use.d.ts +4 -2
- package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
- package/build/types/public-utils/osdkConfig.d.ts +8 -0
- package/build/types/public-utils/osdkConfig.d.ts.map +1 -0
- package/build/types/public-utils/vite-env.d.d.ts +3 -0
- package/build/types/public-utils/vite-env.d.d.ts.map +1 -0
- package/build/types/queries/applyQuery.d.ts +2 -2
- package/build/types/queries/applyQuery.d.ts.map +1 -1
- package/build/types/queries/types.d.ts +1 -1
- package/build/types/queries/types.d.ts.map +1 -1
- package/build/types/tsserver.d.ts +1 -1
- package/build/types/tsserver.d.ts.map +1 -1
- package/build/types/util/extractRdpDefinition.d.ts +4 -0
- package/build/types/util/extractRdpDefinition.d.ts.map +1 -0
- package/build/types/util/extractRdpDefinition.test.d.ts +1 -0
- package/build/types/util/extractRdpDefinition.test.d.ts.map +1 -0
- package/build/types/util/isObjectSpecifiersObject.d.ts +5 -0
- package/build/types/util/isObjectSpecifiersObject.d.ts.map +1 -0
- package/build/types/util/isPoint.d.ts +1 -0
- package/build/types/util/isPoint.d.ts.map +1 -0
- package/build/types/util/objectSpecifierUtils.d.ts +24 -0
- package/build/types/util/objectSpecifierUtils.d.ts.map +1 -0
- package/build/types/util/objectSpecifierUtils.test.d.ts +1 -0
- package/build/types/util/objectSpecifierUtils.test.d.ts.map +1 -0
- package/package.json +19 -18
- package/build/browser/Logger.js +0 -2
- package/build/browser/Logger.js.map +0 -1
- package/build/browser/object/createObjectSpecifierFromPrimaryKey.js.map +0 -1
- package/build/browser/util/isOsdkBaseObject.js.map +0 -1
- package/build/browser/util/isOsdkObject.js.map +0 -1
- package/build/cjs/chunk-EY52J5Z4.cjs.map +0 -1
- package/build/cjs/chunk-MCQVHD2F.cjs.map +0 -1
- package/build/cjs/chunk-Q7SFCCGT.cjs +0 -11
- package/build/cjs/chunk-Q7SFCCGT.cjs.map +0 -1
- package/build/cjs/graphql-RGM5SRWV.cjs +0 -10532
- package/build/cjs/graphql-RGM5SRWV.cjs.map +0 -1
- package/build/esm/Logger.js +0 -2
- package/build/esm/Logger.js.map +0 -1
- package/build/esm/object/createObjectSpecifierFromPrimaryKey.js.map +0 -1
- package/build/esm/util/isOsdkBaseObject.js.map +0 -1
- package/build/esm/util/isOsdkObject.js.map +0 -1
- package/build/types/Logger.d.ts +0 -17
- package/build/types/Logger.d.ts.map +0 -1
- package/build/types/object/createObjectSpecifierFromPrimaryKey.d.ts +0 -2
- package/build/types/object/createObjectSpecifierFromPrimaryKey.d.ts.map +0 -1
- package/build/types/util/isOsdkBaseObject.d.ts +0 -2
- package/build/types/util/isOsdkBaseObject.d.ts.map +0 -1
- package/build/types/util/isOsdkObject.d.ts +0 -2
- package/build/types/util/isOsdkObject.d.ts.map +0 -1
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 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
|
+
|
|
17
|
+
import { describe, expect, it } from "vitest";
|
|
18
|
+
import { extractRdpDefinition } from "./extractRdpDefinition.js";
|
|
19
|
+
describe("extractRdpDefinition", () => {
|
|
20
|
+
const mockClientCtx = {
|
|
21
|
+
ontologyProvider: {
|
|
22
|
+
getObjectDefinition: objectType => {
|
|
23
|
+
if (objectType === "BaseType") {
|
|
24
|
+
return {
|
|
25
|
+
links: {
|
|
26
|
+
testLink1: {
|
|
27
|
+
targetType: "SecondType",
|
|
28
|
+
"multiplicity": "many"
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
} else if (objectType === "SecondType") {
|
|
33
|
+
return {
|
|
34
|
+
links: {
|
|
35
|
+
testLink2: {
|
|
36
|
+
targetType: "ThirdType",
|
|
37
|
+
"multiplicity": "many"
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
} else if (objectType === "ThirdType") {
|
|
42
|
+
return {
|
|
43
|
+
properties: {
|
|
44
|
+
testProperty: {
|
|
45
|
+
type: "attachment"
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
} else {
|
|
50
|
+
throw new Error(`Missing definition for '${objectType}'`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
const objectSetWithRdps = {
|
|
56
|
+
type: "withProperties",
|
|
57
|
+
objectSet: {
|
|
58
|
+
type: "searchAround",
|
|
59
|
+
objectSet: {
|
|
60
|
+
type: "base",
|
|
61
|
+
objectType: "BaseType"
|
|
62
|
+
},
|
|
63
|
+
link: "testLink1"
|
|
64
|
+
},
|
|
65
|
+
derivedProperties: {
|
|
66
|
+
myRdp: {
|
|
67
|
+
type: "selection",
|
|
68
|
+
objectSet: {
|
|
69
|
+
type: "searchAround",
|
|
70
|
+
objectSet: {
|
|
71
|
+
type: "methodInput"
|
|
72
|
+
},
|
|
73
|
+
link: "testLink2"
|
|
74
|
+
},
|
|
75
|
+
operation: {
|
|
76
|
+
type: "get",
|
|
77
|
+
selectedPropertyApiName: "testProperty"
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
it("handles 'withProperties' object set type", async () => {
|
|
83
|
+
const result = await extractRdpDefinition(mockClientCtx, objectSetWithRdps);
|
|
84
|
+
expect(result).toMatchInlineSnapshot(`
|
|
85
|
+
{
|
|
86
|
+
"myRdp": {
|
|
87
|
+
"type": "attachment",
|
|
88
|
+
},
|
|
89
|
+
}
|
|
90
|
+
`);
|
|
91
|
+
});
|
|
92
|
+
it("combines definitions from multiple derived properties", async () => {
|
|
93
|
+
const result = await extractRdpDefinition(mockClientCtx, {
|
|
94
|
+
type: "withProperties",
|
|
95
|
+
objectSet: objectSetWithRdps,
|
|
96
|
+
derivedProperties: {
|
|
97
|
+
rdp1: {
|
|
98
|
+
type: "selection",
|
|
99
|
+
objectSet: {
|
|
100
|
+
type: "searchAround",
|
|
101
|
+
objectSet: {
|
|
102
|
+
type: "methodInput"
|
|
103
|
+
},
|
|
104
|
+
link: "testLink2"
|
|
105
|
+
},
|
|
106
|
+
operation: {
|
|
107
|
+
type: "collectList",
|
|
108
|
+
selectedPropertyApiName: "testProperty",
|
|
109
|
+
limit: 100
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
rdp2: {
|
|
113
|
+
type: "selection",
|
|
114
|
+
objectSet: {
|
|
115
|
+
type: "searchAround",
|
|
116
|
+
objectSet: {
|
|
117
|
+
type: "methodInput"
|
|
118
|
+
},
|
|
119
|
+
link: "testLink2"
|
|
120
|
+
},
|
|
121
|
+
operation: {
|
|
122
|
+
type: "collectSet",
|
|
123
|
+
selectedPropertyApiName: "testProperty",
|
|
124
|
+
limit: 100
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
});
|
|
129
|
+
expect(result).toMatchInlineSnapshot(`
|
|
130
|
+
{
|
|
131
|
+
"myRdp": {
|
|
132
|
+
"type": "attachment",
|
|
133
|
+
},
|
|
134
|
+
"rdp1": {
|
|
135
|
+
"type": "attachment",
|
|
136
|
+
},
|
|
137
|
+
"rdp2": {
|
|
138
|
+
"type": "attachment",
|
|
139
|
+
},
|
|
140
|
+
}
|
|
141
|
+
`);
|
|
142
|
+
});
|
|
143
|
+
it("handles `intersection` object set type and nested static and reference object sets", async () => {
|
|
144
|
+
const result = await extractRdpDefinition(mockClientCtx, {
|
|
145
|
+
type: "withProperties",
|
|
146
|
+
objectSet: {
|
|
147
|
+
type: "intersect",
|
|
148
|
+
objectSets: [{
|
|
149
|
+
type: "searchAround",
|
|
150
|
+
objectSet: {
|
|
151
|
+
type: "base",
|
|
152
|
+
objectType: "BaseType"
|
|
153
|
+
},
|
|
154
|
+
link: "testLink1"
|
|
155
|
+
}, {
|
|
156
|
+
type: "static",
|
|
157
|
+
"objects": ["object1", "object2"]
|
|
158
|
+
}, {
|
|
159
|
+
type: "reference",
|
|
160
|
+
"reference": "rid.os.1234"
|
|
161
|
+
}]
|
|
162
|
+
},
|
|
163
|
+
derivedProperties: {
|
|
164
|
+
myRdp: {
|
|
165
|
+
type: "selection",
|
|
166
|
+
objectSet: {
|
|
167
|
+
type: "searchAround",
|
|
168
|
+
objectSet: {
|
|
169
|
+
type: "methodInput"
|
|
170
|
+
},
|
|
171
|
+
link: "testLink2"
|
|
172
|
+
},
|
|
173
|
+
operation: {
|
|
174
|
+
type: "get",
|
|
175
|
+
selectedPropertyApiName: "testProperty"
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
expect(result).toMatchInlineSnapshot(`
|
|
181
|
+
{
|
|
182
|
+
"myRdp": {
|
|
183
|
+
"type": "attachment",
|
|
184
|
+
},
|
|
185
|
+
}
|
|
186
|
+
`);
|
|
187
|
+
});
|
|
188
|
+
it("throws with intersect, subtract, or union having nested RDPs", async () => {
|
|
189
|
+
await expect(extractRdpDefinition(mockClientCtx, {
|
|
190
|
+
type: "intersect",
|
|
191
|
+
objectSets: [objectSetWithRdps, {
|
|
192
|
+
type: "base",
|
|
193
|
+
objectType: "ThirdType"
|
|
194
|
+
}]
|
|
195
|
+
})).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: Object sets combined using intersect, subtract, or union must not contain any derived property definitions]`);
|
|
196
|
+
});
|
|
197
|
+
it("throes with intersect, subtract, or union having different child object types", async () => {
|
|
198
|
+
await expect(extractRdpDefinition(mockClientCtx, {
|
|
199
|
+
type: "withProperties",
|
|
200
|
+
objectSet: {
|
|
201
|
+
type: "intersect",
|
|
202
|
+
objectSets: [{
|
|
203
|
+
type: "searchAround",
|
|
204
|
+
objectSet: {
|
|
205
|
+
type: "base",
|
|
206
|
+
objectType: "BaseType"
|
|
207
|
+
},
|
|
208
|
+
link: "testLink1"
|
|
209
|
+
}, {
|
|
210
|
+
type: "base",
|
|
211
|
+
objectType: "BaseType"
|
|
212
|
+
}]
|
|
213
|
+
},
|
|
214
|
+
derivedProperties: {
|
|
215
|
+
myRdp: {
|
|
216
|
+
type: "selection",
|
|
217
|
+
objectSet: {
|
|
218
|
+
type: "searchAround",
|
|
219
|
+
objectSet: {
|
|
220
|
+
type: "methodInput"
|
|
221
|
+
},
|
|
222
|
+
link: "testLink2"
|
|
223
|
+
},
|
|
224
|
+
operation: {
|
|
225
|
+
type: "get",
|
|
226
|
+
selectedPropertyApiName: "testProperty"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
})).rejects.toThrowErrorMatchingInlineSnapshot(`[Error: Invariant failed: All object sets in an intersect, subtract, or union must have the same child object type]`);
|
|
231
|
+
});
|
|
232
|
+
});
|
|
233
|
+
//# sourceMappingURL=extractRdpDefinition.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extractRdpDefinition.test.js","names":["describe","expect","it","extractRdpDefinition","mockClientCtx","ontologyProvider","getObjectDefinition","objectType","links","testLink1","targetType","testLink2","properties","testProperty","type","Error","objectSetWithRdps","objectSet","link","derivedProperties","myRdp","operation","selectedPropertyApiName","result","toMatchInlineSnapshot","rdp1","limit","rdp2","objectSets","rejects","toThrowErrorMatchingInlineSnapshot"],"sources":["extractRdpDefinition.test.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { ObjectMetadata } from \"@osdk/api\";\nimport type { ObjectSet } from \"@osdk/foundry.ontologies\";\nimport { describe, expect, it } from \"vitest\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { extractRdpDefinition } from \"./extractRdpDefinition.js\";\n\ndescribe(\"extractRdpDefinition\", () => {\n const mockClientCtx = {\n ontologyProvider: {\n getObjectDefinition: (objectType: string) => {\n if (objectType === \"BaseType\") {\n return {\n links: {\n testLink1: {\n targetType: \"SecondType\",\n \"multiplicity\": \"many\",\n } satisfies ObjectMetadata.Link<any, any>,\n },\n };\n } else if (objectType === \"SecondType\") {\n return {\n links: {\n testLink2: {\n targetType: \"ThirdType\",\n \"multiplicity\": \"many\",\n } satisfies ObjectMetadata.Link<any, any>,\n },\n };\n } else if (objectType === \"ThirdType\") {\n return {\n properties: {\n testProperty: {\n type: \"attachment\",\n } satisfies ObjectMetadata.Property,\n },\n };\n } else {\n throw new Error(`Missing definition for '${objectType}'`);\n }\n },\n } as any,\n } as MinimalClient;\n\n const objectSetWithRdps: ObjectSet = {\n type: \"withProperties\",\n objectSet: {\n type: \"searchAround\",\n objectSet: { type: \"base\", objectType: \"BaseType\" },\n link: \"testLink1\",\n },\n derivedProperties: {\n myRdp: {\n type: \"selection\",\n objectSet: {\n type: \"searchAround\",\n objectSet: { type: \"methodInput\" },\n link: \"testLink2\",\n },\n operation: { type: \"get\", selectedPropertyApiName: \"testProperty\" },\n },\n },\n };\n\n it(\"handles 'withProperties' object set type\", async () => {\n const result = await extractRdpDefinition(\n mockClientCtx,\n objectSetWithRdps,\n );\n\n expect(result).toMatchInlineSnapshot(\n `\n {\n \"myRdp\": {\n \"type\": \"attachment\",\n },\n }\n `,\n );\n });\n\n it(\"combines definitions from multiple derived properties\", async () => {\n const nestedObjectSet: ObjectSet = {\n type: \"withProperties\",\n objectSet: objectSetWithRdps,\n derivedProperties: {\n rdp1: {\n type: \"selection\",\n objectSet: {\n type: \"searchAround\",\n objectSet: { type: \"methodInput\" },\n link: \"testLink2\",\n },\n operation: {\n type: \"collectList\",\n selectedPropertyApiName: \"testProperty\",\n limit: 100,\n },\n },\n rdp2: {\n type: \"selection\",\n objectSet: {\n type: \"searchAround\",\n objectSet: { type: \"methodInput\" },\n link: \"testLink2\",\n },\n operation: {\n type: \"collectSet\",\n selectedPropertyApiName: \"testProperty\",\n limit: 100,\n },\n },\n },\n };\n\n const result = await extractRdpDefinition(\n mockClientCtx,\n nestedObjectSet,\n );\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"myRdp\": {\n \"type\": \"attachment\",\n },\n \"rdp1\": {\n \"type\": \"attachment\",\n },\n \"rdp2\": {\n \"type\": \"attachment\",\n },\n }\n `);\n });\n\n it(\"handles `intersection` object set type and nested static and reference object sets\", async () => {\n const intersectionObjectSet: ObjectSet = {\n type: \"intersect\",\n objectSets: [\n {\n type: \"searchAround\",\n objectSet: { type: \"base\", objectType: \"BaseType\" },\n link: \"testLink1\",\n },\n { type: \"static\", \"objects\": [\"object1\", \"object2\"] },\n { type: \"reference\", \"reference\": \"rid.os.1234\" },\n ],\n };\n\n const RdpWithIntersectionBaseObjectSet: ObjectSet = {\n type: \"withProperties\",\n objectSet: intersectionObjectSet,\n derivedProperties: {\n myRdp: {\n type: \"selection\",\n objectSet: {\n type: \"searchAround\",\n objectSet: { type: \"methodInput\" },\n link: \"testLink2\",\n },\n operation: {\n type: \"get\",\n selectedPropertyApiName: \"testProperty\",\n },\n },\n },\n };\n\n const result = await extractRdpDefinition(\n mockClientCtx,\n RdpWithIntersectionBaseObjectSet,\n );\n\n expect(result).toMatchInlineSnapshot(\n `\n {\n \"myRdp\": {\n \"type\": \"attachment\",\n },\n }\n `,\n );\n });\n\n it(\"throws with intersect, subtract, or union having nested RDPs\", async () => {\n const intersectionObjectSetWithNestedRdps: ObjectSet = {\n type: \"intersect\",\n objectSets: [objectSetWithRdps, {\n type: \"base\",\n objectType: \"ThirdType\",\n }],\n };\n\n await expect(\n extractRdpDefinition(mockClientCtx, intersectionObjectSetWithNestedRdps),\n ).rejects.toThrowErrorMatchingInlineSnapshot(\n `[Error: Invariant failed: Object sets combined using intersect, subtract, or union must not contain any derived property definitions]`,\n );\n });\n\n it(\"throes with intersect, subtract, or union having different child object types\", async () => {\n const intersectionObjectSet: ObjectSet = {\n type: \"intersect\",\n objectSets: [\n {\n type: \"searchAround\",\n objectSet: { type: \"base\", objectType: \"BaseType\" },\n link: \"testLink1\",\n },\n { type: \"base\", objectType: \"BaseType\" },\n ],\n };\n\n const RdpWithIntersectionBaseObjectSet: ObjectSet = {\n type: \"withProperties\",\n objectSet: intersectionObjectSet,\n derivedProperties: {\n myRdp: {\n type: \"selection\",\n objectSet: {\n type: \"searchAround\",\n objectSet: { type: \"methodInput\" },\n link: \"testLink2\",\n },\n operation: {\n type: \"get\",\n selectedPropertyApiName: \"testProperty\",\n },\n },\n },\n };\n\n await expect(\n extractRdpDefinition(mockClientCtx, RdpWithIntersectionBaseObjectSet),\n ).rejects.toThrowErrorMatchingInlineSnapshot(\n `[Error: Invariant failed: All object sets in an intersect, subtract, or union must have the same child object type]`,\n );\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAE7C,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhEH,QAAQ,CAAC,sBAAsB,EAAE,MAAM;EACrC,MAAMI,aAAa,GAAG;IACpBC,gBAAgB,EAAE;MAChBC,mBAAmB,EAAGC,UAAkB,IAAK;QAC3C,IAAIA,UAAU,KAAK,UAAU,EAAE;UAC7B,OAAO;YACLC,KAAK,EAAE;cACLC,SAAS,EAAE;gBACTC,UAAU,EAAE,YAAY;gBACxB,cAAc,EAAE;cAClB;YACF;UACF,CAAC;QACH,CAAC,MAAM,IAAIH,UAAU,KAAK,YAAY,EAAE;UACtC,OAAO;YACLC,KAAK,EAAE;cACLG,SAAS,EAAE;gBACTD,UAAU,EAAE,WAAW;gBACvB,cAAc,EAAE;cAClB;YACF;UACF,CAAC;QACH,CAAC,MAAM,IAAIH,UAAU,KAAK,WAAW,EAAE;UACrC,OAAO;YACLK,UAAU,EAAE;cACVC,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,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
export function
|
|
17
|
+
export function isObjectSpecifiersObject(o) {
|
|
18
18
|
return o && typeof o === "object" && typeof o.$apiName === "string" && o.$primaryKey != null;
|
|
19
19
|
}
|
|
20
|
-
//# sourceMappingURL=
|
|
20
|
+
//# sourceMappingURL=isObjectSpecifiersObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isObjectSpecifiersObject.js","names":["isObjectSpecifiersObject","o","$apiName","$primaryKey"],"sources":["isObjectSpecifiersObject.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 { PrimaryKeyTypes } from \"@osdk/api\";\n\nexport function isObjectSpecifiersObject(\n o: any,\n): o is { $apiName: string; $primaryKey: PrimaryKeyTypes } {\n return o && typeof o === \"object\" && typeof o.$apiName === \"string\"\n && o.$primaryKey != null;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,wBAAwBA,CACtCC,CAAM,EACmD;EACzD,OAAOA,CAAC,IAAI,OAAOA,CAAC,KAAK,QAAQ,IAAI,OAAOA,CAAC,CAACC,QAAQ,KAAK,QAAQ,IAC9DD,CAAC,CAACE,WAAW,IAAI,IAAI;AAC5B","ignoreList":[]}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 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
|
+
|
|
17
|
+
export function isPoint(o) {
|
|
18
|
+
return o && typeof o === "object" && "type" in o && o.type === "Point" && "coordinates" in o && o.coordinates.length === 2;
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=isPoint.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"isPoint.js","names":["isPoint","o","type","coordinates","length"],"sources":["isPoint.ts"],"sourcesContent":["/*\n * Copyright 2025 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\nexport function isPoint(o: any): o is GeoJSON.Point {\n return o && typeof o === \"object\" && \"type\" in o && o.type === \"Point\"\n && \"coordinates\" in o && o.coordinates.length === 2;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,SAASA,OAAOA,CAACC,CAAM,EAAsB;EAClD,OAAOA,CAAC,IAAI,OAAOA,CAAC,KAAK,QAAQ,IAAI,MAAM,IAAIA,CAAC,IAAIA,CAAC,CAACC,IAAI,KAAK,OAAO,IACjE,aAAa,IAAID,CAAC,IAAIA,CAAC,CAACE,WAAW,CAACC,MAAM,KAAK,CAAC;AACvD","ignoreList":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 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
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates an Object Specifier. An ObjectSpecifier is a string that uniquely identifies an object in the system,
|
|
19
|
+
* even when loading an interface object where primary key uniqueness is not guaranteed.
|
|
20
|
+
*
|
|
21
|
+
* @param objectDef - An Object Type Definition
|
|
22
|
+
* @param primaryKey - The value you want to use as the primary key
|
|
23
|
+
* @returns An Object Specifier
|
|
24
|
+
*/
|
|
25
|
+
export function createObjectSpecifierFromPrimaryKey(objectDef, primaryKey) {
|
|
26
|
+
return `${objectDef.apiName}:${primaryKey}`;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Extracts the primary key from an ObjectSpecifier on an OSDK object.
|
|
31
|
+
*
|
|
32
|
+
* @param ObjectSpecifier
|
|
33
|
+
* @returns A string representing the primary key
|
|
34
|
+
*/
|
|
35
|
+
export function extractPrimaryKeyFromObjectSpecifier(ObjectSpecifier) {
|
|
36
|
+
return ObjectSpecifier.split(":")[1];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Extracts the object type from an ObjectSpecifier on an OSDK object.
|
|
41
|
+
*
|
|
42
|
+
* @param ObjectSpecifier
|
|
43
|
+
* @returns The object type extracted from the ObjectSpecifier
|
|
44
|
+
*/
|
|
45
|
+
export function extractObjectTypeFromObjectSpecifier(ObjectSpecifier) {
|
|
46
|
+
return ObjectSpecifier.split(":")[0];
|
|
47
|
+
}
|
|
48
|
+
//# sourceMappingURL=objectSpecifierUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectSpecifierUtils.js","names":["createObjectSpecifierFromPrimaryKey","objectDef","primaryKey","apiName","extractPrimaryKeyFromObjectSpecifier","ObjectSpecifier","split","extractObjectTypeFromObjectSpecifier"],"sources":["objectSpecifierUtils.ts"],"sourcesContent":["/*\n * Copyright 2025 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 ObjectSpecifier,\n ObjectTypeDefinition,\n PrimaryKeyType,\n} from \"@osdk/api\";\n\n/**\n * Creates an Object Specifier. An ObjectSpecifier is a string that uniquely identifies an object in the system,\n * even when loading an interface object where primary key uniqueness is not guaranteed.\n *\n * @param objectDef - An Object Type Definition\n * @param primaryKey - The value you want to use as the primary key\n * @returns An Object Specifier\n */\nexport function createObjectSpecifierFromPrimaryKey<\n Q extends ObjectTypeDefinition,\n>(objectDef: Q, primaryKey: PrimaryKeyType<Q>): ObjectSpecifier<Q> {\n return `${objectDef.apiName}:${primaryKey}` as ObjectSpecifier<Q>;\n}\n\n/**\n * Extracts the primary key from an ObjectSpecifier on an OSDK object.\n *\n * @param ObjectSpecifier\n * @returns A string representing the primary key\n */\nexport function extractPrimaryKeyFromObjectSpecifier(\n ObjectSpecifier: ObjectSpecifier<any>,\n): string {\n return ObjectSpecifier.split(\":\")[1];\n}\n\n/**\n * Extracts the object type from an ObjectSpecifier on an OSDK object.\n *\n * @param ObjectSpecifier\n * @returns The object type extracted from the ObjectSpecifier\n */\nexport function extractObjectTypeFromObjectSpecifier(\n ObjectSpecifier: ObjectSpecifier<any>,\n): string {\n return ObjectSpecifier.split(\":\")[0];\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,mCAAmCA,CAEjDC,SAAY,EAAEC,UAA6B,EAAsB;EACjE,OAAO,GAAGD,SAAS,CAACE,OAAO,IAAID,UAAU,EAAE;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,oCAAoCA,CAClDC,eAAqC,EAC7B;EACR,OAAOA,eAAe,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACtC;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oCAAoCA,CAClDF,eAAqC,EAC7B;EACR,OAAOA,eAAe,CAACC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AACtC","ignoreList":[]}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 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
|
+
|
|
17
|
+
import { describe, expect, it } from "vitest";
|
|
18
|
+
import { createObjectSpecifierFromPrimaryKey, extractObjectTypeFromObjectSpecifier, extractPrimaryKeyFromObjectSpecifier } from "./objectSpecifierUtils.js";
|
|
19
|
+
describe("ObjectSpecifier Utilities", () => {
|
|
20
|
+
const mockObjectTypeDefinition = {
|
|
21
|
+
apiName: "myApi"
|
|
22
|
+
};
|
|
23
|
+
describe("createObjectSpecifierFromPrimaryKey", () => {
|
|
24
|
+
it("creates a specifier in the format 'apiName:primaryKey'", () => {
|
|
25
|
+
const specifier = createObjectSpecifierFromPrimaryKey(mockObjectTypeDefinition, "12345");
|
|
26
|
+
expect(specifier).toBe("myApi:12345");
|
|
27
|
+
});
|
|
28
|
+
});
|
|
29
|
+
describe("extractPrimaryKeyFromObjectSpecifier", () => {
|
|
30
|
+
it("extracts the primary key portion correctly", () => {
|
|
31
|
+
const primaryKey = extractPrimaryKeyFromObjectSpecifier("myApi:12345");
|
|
32
|
+
expect(primaryKey).toBe("12345");
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
describe("extractObjectTypeFromObjectSpecifier", () => {
|
|
36
|
+
it("extracts the object type portion correctly", () => {
|
|
37
|
+
const objectType = extractObjectTypeFromObjectSpecifier("myApi:12345");
|
|
38
|
+
expect(objectType).toBe("myApi");
|
|
39
|
+
});
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
//# sourceMappingURL=objectSpecifierUtils.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"objectSpecifierUtils.test.js","names":["describe","expect","it","createObjectSpecifierFromPrimaryKey","extractObjectTypeFromObjectSpecifier","extractPrimaryKeyFromObjectSpecifier","mockObjectTypeDefinition","apiName","specifier","toBe","primaryKey","objectType"],"sources":["objectSpecifierUtils.test.ts"],"sourcesContent":["/*\n * Copyright 2025 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 { ObjectSpecifier, ObjectTypeDefinition } from \"@osdk/api\";\nimport { describe, expect, it } from \"vitest\";\nimport {\n createObjectSpecifierFromPrimaryKey,\n extractObjectTypeFromObjectSpecifier,\n extractPrimaryKeyFromObjectSpecifier,\n} from \"./objectSpecifierUtils.js\";\n\ndescribe(\"ObjectSpecifier Utilities\", () => {\n const mockObjectTypeDefinition = {\n apiName: \"myApi\",\n } as ObjectTypeDefinition;\n\n describe(\"createObjectSpecifierFromPrimaryKey\", () => {\n it(\"creates a specifier in the format 'apiName:primaryKey'\", () => {\n const primaryKey = \"12345\";\n const specifier = createObjectSpecifierFromPrimaryKey(\n mockObjectTypeDefinition,\n primaryKey,\n );\n expect(specifier).toBe(\"myApi:12345\");\n });\n });\n\n describe(\"extractPrimaryKeyFromObjectSpecifier\", () => {\n it(\"extracts the primary key portion correctly\", () => {\n const specifier = \"myApi:12345\" as ObjectSpecifier<any>;\n const primaryKey = extractPrimaryKeyFromObjectSpecifier(specifier);\n expect(primaryKey).toBe(\"12345\");\n });\n });\n\n describe(\"extractObjectTypeFromObjectSpecifier\", () => {\n it(\"extracts the object type portion correctly\", () => {\n const specifier = \"myApi:12345\" as ObjectSpecifier<any>;\n const objectType = extractObjectTypeFromObjectSpecifier(specifier);\n expect(objectType).toBe(\"myApi\");\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SACEC,mCAAmC,EACnCC,oCAAoC,EACpCC,oCAAoC,QAC/B,2BAA2B;AAElCL,QAAQ,CAAC,2BAA2B,EAAE,MAAM;EAC1C,MAAMM,wBAAwB,GAAG;IAC/BC,OAAO,EAAE;EACX,CAAyB;EAEzBP,QAAQ,CAAC,qCAAqC,EAAE,MAAM;IACpDE,EAAE,CAAC,wDAAwD,EAAE,MAAM;MAEjE,MAAMM,SAAS,GAAGL,mCAAmC,CACnDG,wBAAwB,EAFP,OAInB,CAAC;MACDL,MAAM,CAACO,SAAS,CAAC,CAACC,IAAI,CAAC,aAAa,CAAC;IACvC,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFT,QAAQ,CAAC,sCAAsC,EAAE,MAAM;IACrDE,EAAE,CAAC,4CAA4C,EAAE,MAAM;MAErD,MAAMQ,UAAU,GAAGL,oCAAoC,CADrC,aAC+C,CAAC;MAClEJ,MAAM,CAACS,UAAU,CAAC,CAACD,IAAI,CAAC,OAAO,CAAC;IAClC,CAAC,CAAC;EACJ,CAAC,CAAC;EAEFT,QAAQ,CAAC,sCAAsC,EAAE,MAAM;IACrDE,EAAE,CAAC,4CAA4C,EAAE,MAAM;MAErD,MAAMS,UAAU,GAAGP,oCAAoC,CADrC,aAC+C,CAAC;MAClEH,MAAM,CAACU,UAAU,CAAC,CAACF,IAAI,CAAC,OAAO,CAAC;IAClC,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -19,8 +19,9 @@ import { isAttachmentFile, isAttachmentUpload } from "../object/AttachmentUpload
|
|
|
19
19
|
import { isMediaReference } from "../object/mediaUpload.js";
|
|
20
20
|
import { getWireObjectSet, isObjectSet } from "../objectSet/createObjectSet.js";
|
|
21
21
|
import { isInterfaceActionParam } from "./interfaceUtils.js";
|
|
22
|
+
import { isObjectSpecifiersObject } from "./isObjectSpecifiersObject.js";
|
|
22
23
|
import { isOntologyObjectV2 } from "./isOntologyObjectV2.js";
|
|
23
|
-
import {
|
|
24
|
+
import { isPoint } from "./isPoint.js";
|
|
24
25
|
import { isWireObjectSet } from "./WireObjectSet.js";
|
|
25
26
|
|
|
26
27
|
/**
|
|
@@ -67,9 +68,12 @@ export async function toDataValue(value, client) {
|
|
|
67
68
|
if (isOntologyObjectV2(value)) {
|
|
68
69
|
return await toDataValue(value.__primaryKey, client);
|
|
69
70
|
}
|
|
70
|
-
if (
|
|
71
|
+
if (isObjectSpecifiersObject(value)) {
|
|
71
72
|
return await toDataValue(value.$primaryKey, client);
|
|
72
73
|
}
|
|
74
|
+
if (isPoint(value)) {
|
|
75
|
+
return await toDataValue(value.coordinates.join(), client);
|
|
76
|
+
}
|
|
73
77
|
|
|
74
78
|
// object set (the rid as a string (passes through the last return), or the ObjectSet definition directly)
|
|
75
79
|
if (isWireObjectSet(value)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toDataValue.js","names":["OntologiesV2","isAttachmentFile","isAttachmentUpload","isMediaReference","getWireObjectSet","isObjectSet","isInterfaceActionParam","isOntologyObjectV2","
|
|
1
|
+
{"version":3,"file":"toDataValue.js","names":["OntologiesV2","isAttachmentFile","isAttachmentUpload","isMediaReference","getWireObjectSet","isObjectSet","isInterfaceActionParam","isObjectSpecifiersObject","isOntologyObjectV2","isPoint","isWireObjectSet","toDataValue","value","client","Array","isArray","Set","values","from","some","dataValue","converted","push","promiseArray","innerValue","Promise","all","attachment","Attachments","upload","data","filename","name","rid","__primaryKey","$primaryKey","coordinates","join","objectTypeApiName","$objectType","primaryKeyValue","Object","entries","reduce","promisedAcc","key","structValue","acc","resolve"],"sources":["toDataValue.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 DataValue } from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport {\n isAttachmentFile,\n isAttachmentUpload,\n} from \"../object/AttachmentUpload.js\";\nimport { isMediaReference } from \"../object/mediaUpload.js\";\nimport { getWireObjectSet, isObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { isInterfaceActionParam } from \"./interfaceUtils.js\";\nimport { isObjectSpecifiersObject } from \"./isObjectSpecifiersObject.js\";\nimport { isOntologyObjectV2 } from \"./isOntologyObjectV2.js\";\nimport { isPoint } from \"./isPoint.js\";\nimport { isWireObjectSet } from \"./WireObjectSet.js\";\n\n/**\n * Marshall user-facing data into the wire DataValue type\n *\n * @see DataValue for the expected payloads\n * @internal\n */\nexport async function toDataValue(\n value: unknown,\n client: MinimalClient,\n): Promise<DataValue> {\n if (value == null) {\n // typeof null is 'object' so do this first\n return value;\n }\n\n // arrays and sets are both sent over the wire as arrays\n if (Array.isArray(value) || value instanceof Set) {\n const values = Array.from(value);\n if (\n values.some((dataValue) =>\n isAttachmentUpload(dataValue) || isAttachmentFile(dataValue)\n )\n ) {\n const converted = [];\n for (const value of values) {\n converted.push(await toDataValue(value, client));\n }\n return converted;\n }\n const promiseArray = Array.from(\n value,\n async (innerValue) => await toDataValue(innerValue, client),\n );\n return Promise.all(promiseArray);\n }\n\n // For uploads, we need to upload ourselves first to get the RID of the attachment\n if (isAttachmentUpload(value)) {\n const attachment = await OntologiesV2.Attachments.upload(\n client,\n value.data,\n {\n filename: value.name,\n },\n );\n return await toDataValue(attachment.rid, client);\n }\n\n if (isAttachmentFile(value)) {\n const attachment = await OntologiesV2.Attachments.upload(\n client,\n value,\n {\n filename: value.name as string,\n },\n );\n return await toDataValue(attachment.rid, client);\n }\n\n // objects just send the JSON'd primaryKey\n if (isOntologyObjectV2(value)) {\n return await toDataValue(value.__primaryKey, client);\n }\n\n if (isObjectSpecifiersObject(value)) {\n return await toDataValue(value.$primaryKey, client);\n }\n\n if (isPoint(value)) {\n return await toDataValue(value.coordinates.join(), client);\n }\n\n // object set (the rid as a string (passes through the last return), or the ObjectSet definition directly)\n if (isWireObjectSet(value)) {\n return value;\n }\n if (isObjectSet(value)) {\n return getWireObjectSet(value);\n }\n\n if (isMediaReference(value)) {\n return value;\n }\n\n if (isInterfaceActionParam(value)) {\n return {\n objectTypeApiName: value.$objectType,\n primaryKeyValue: value.$primaryKey,\n };\n }\n\n // TODO (during queries implementation)\n // two dimensional aggregation\n // three dimensional aggregation\n\n // struct\n if (typeof value === \"object\") {\n return Object.entries(value).reduce(\n async (promisedAcc, [key, structValue]) => {\n const acc = await promisedAcc;\n acc[key] = await toDataValue(structValue, client);\n return acc;\n },\n Promise.resolve({} as { [key: string]: DataValue }),\n );\n }\n\n // expected to pass through - boolean, byte, date, decimal, float, double, integer, long, short, string, timestamp, object type reference\n return value;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AAExD,SACEC,gBAAgB,EAChBC,kBAAkB,QACb,+BAA+B;AACtC,SAASC,gBAAgB,QAAQ,0BAA0B;AAC3D,SAASC,gBAAgB,EAAEC,WAAW,QAAQ,iCAAiC;AAC/E,SAASC,sBAAsB,QAAQ,qBAAqB;AAC5D,SAASC,wBAAw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AW,CAAC,KAAK;MACzC,MAAMC,GAAG,GAAG,MAAMH,WAAW;MAC7BG,GAAG,CAACF,GAAG,CAAC,GAAG,MAAMlC,WAAW,CAACmC,WAAW,EAAEjC,MAAM,CAAC;MACjD,OAAOkC,GAAG;IACZ,CAAC,EACDtB,OAAO,CAACuB,OAAO,CAAC,CAAC,CAAiC,CACpD,CAAC;EACH;;EAEA;EACA,OAAOpC,KAAK;AACd","ignoreList":[]}
|
|
@@ -14,9 +14,9 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import {
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
17
|
+
import { Employee, Task } from "@osdk/client.test.ontology";
|
|
18
|
+
import { LegacyFauxFoundry, startNodeApiServer, stubData } from "@osdk/shared.test";
|
|
19
|
+
import { beforeAll, describe, expect, it, vi } from "vitest";
|
|
20
20
|
import { createClient } from "../createClient.js";
|
|
21
21
|
import { createMinimalClient } from "../createMinimalClient.js";
|
|
22
22
|
import { createAttachmentUpload } from "../object/AttachmentUpload.js";
|
|
@@ -26,13 +26,17 @@ describe(toDataValue, () => {
|
|
|
26
26
|
let client;
|
|
27
27
|
let clientCtx;
|
|
28
28
|
vi.fn();
|
|
29
|
-
beforeAll(
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
beforeAll(() => {
|
|
30
|
+
const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);
|
|
31
|
+
({
|
|
32
|
+
client
|
|
33
|
+
} = testSetup);
|
|
34
|
+
clientCtx = createMinimalClient({
|
|
35
|
+
ontologyRid: testSetup.fauxFoundry.defaultOntologyRid
|
|
36
|
+
}, testSetup.fauxFoundry.baseUrl, testSetup.auth, {});
|
|
37
|
+
return () => {
|
|
38
|
+
testSetup.apiServer.close();
|
|
39
|
+
};
|
|
36
40
|
});
|
|
37
41
|
it("converts passthrough values correctly", async () => {
|
|
38
42
|
// basic pass through types
|
|
@@ -109,22 +113,39 @@ describe(toDataValue, () => {
|
|
|
109
113
|
expect(definitionConversion).toMatchInlineSnapshot(expected);
|
|
110
114
|
});
|
|
111
115
|
it("converts blob attachment uploads correctly", async () => {
|
|
112
|
-
const blob =
|
|
116
|
+
const blob = new Blob([JSON.stringify({
|
|
117
|
+
"hi": "mom"
|
|
118
|
+
})]);
|
|
113
119
|
const attachmentUpload = createAttachmentUpload(blob, "file1.txt");
|
|
114
120
|
const converted = await toDataValue(attachmentUpload, clientCtx);
|
|
115
|
-
expect(converted).
|
|
121
|
+
expect(converted).toMatch(/ri\.attachments.main.attachment\.[a-z0-9\-]+/i);
|
|
116
122
|
});
|
|
117
123
|
it("converts file attachment uploads correctly", async () => {
|
|
118
124
|
// Mimics the Web file API (https://developer.mozilla.org/en-US/docs/Web/API/File). The File constructor is only available in Node 19.2.0 and above
|
|
119
|
-
const file = Object.assign(
|
|
125
|
+
const file = Object.assign(new Blob([JSON.stringify({
|
|
126
|
+
name: "Hello World"
|
|
127
|
+
}, null, 2)], {
|
|
128
|
+
type: "application/json"
|
|
129
|
+
}), {
|
|
120
130
|
name: "file1.txt"
|
|
121
131
|
});
|
|
122
132
|
const converted = await toDataValue(file, clientCtx);
|
|
123
|
-
expect(converted).
|
|
133
|
+
expect(converted).toMatch(/ri\.attachments.main.attachment\.[a-z0-9\-]+/i);
|
|
124
134
|
});
|
|
125
135
|
it("converts media reference correctly", async () => {
|
|
126
|
-
const
|
|
127
|
-
|
|
136
|
+
const mediaReference = {
|
|
137
|
+
mimeType: "application/json",
|
|
138
|
+
reference: {
|
|
139
|
+
type: "mediaSetViewItem",
|
|
140
|
+
mediaSetViewItem: {
|
|
141
|
+
mediaItemRid: "media-item-rid",
|
|
142
|
+
mediaSetRid: "media-set-rid",
|
|
143
|
+
mediaSetViewRid: "media-set-view-rid"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
const converted = await toDataValue(mediaReference, clientCtx);
|
|
148
|
+
expect(converted).toEqual(mediaReference);
|
|
128
149
|
});
|
|
129
150
|
});
|
|
130
151
|
//# sourceMappingURL=toDataValue.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"toDataValue.test.js","names":["$ontologyRid","Employee","Task","apiServer","MockOntology","stubData","afterAll","beforeAll","describe","expect","it","vi","createClient","createMinimalClient","createAttachmentUpload","getWireObjectSet","toDataValue","client","clientCtx","fn","listen","metadata","close","basic","null","undefined","boolean","date","integer","string","timestamp","convertedBasic","toEqual","attachment","attachmentArray","attachmentSet","Set","recursiveConversion","inner","employee","employee1","ontologyConversion","__primaryKey","task","fetchOne","$primaryKey","clientObjectSet","where","id","definition","expected","objectSetConversion","toMatchInlineSnapshot","definitionConversion","blob","attachmentUploadRequestBody","localAttachment1","filename","attachmentUpload","converted","file","Object","assign","name","mediaReference"],"sources":["toDataValue.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 { $ontologyRid, Employee, Task } from \"@osdk/client.test.ontology\";\nimport { apiServer, MockOntology, stubData } from \"@osdk/shared.test\";\nimport type { MockedFunction } from \"vitest\";\nimport { afterAll, beforeAll, describe, expect, it, vi } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createMinimalClient } from \"../createMinimalClient.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { createAttachmentUpload } from \"../object/AttachmentUpload.js\";\nimport { getWireObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { toDataValue } from \"./toDataValue.js\";\n\ndescribe(toDataValue, () => {\n let client: Client;\n let clientCtx: MinimalClient;\n\n const mockFetch: MockedFunction<typeof globalThis.fetch> = vi.fn();\n\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\n \"https://stack.palantir.com\",\n $ontologyRid,\n async () => \"myAccessToken\",\n );\n\n clientCtx = createMinimalClient(\n MockOntology.metadata,\n \"https://stack.palantir.com\",\n async () => \"myAccessToken\",\n {},\n );\n });\n\n afterAll(() => {\n apiServer.close();\n });\n\n it(\"converts passthrough values correctly\", async () => {\n // basic pass through types\n const basic = {\n null: undefined,\n boolean: false,\n date: \"2024-01-01\",\n integer: 0,\n string: \"string\",\n timestamp: \"2024-01-01T00:00:00Z\",\n };\n const convertedBasic = await toDataValue(basic, clientCtx);\n expect(convertedBasic).toEqual(basic);\n });\n\n it(\"recursively converts arrays and sets into array types\", async () => {\n const attachment = \"rid\";\n const attachmentArray = [attachment];\n const attachmentSet = new Set(attachmentArray);\n\n const recursiveConversion = await toDataValue({\n attachment,\n attachmentArray,\n attachmentSet,\n }, clientCtx);\n\n expect(recursiveConversion).toEqual({\n attachment: \"rid\",\n attachmentArray: [\"rid\"],\n attachmentSet: [\"rid\"],\n });\n });\n\n it(\"recursively handles structs\", async () => {\n const struct = {\n inner: {\n attachment: \"rid\",\n },\n };\n\n const recursiveConversion = await toDataValue(struct, clientCtx);\n\n expect(recursiveConversion).toEqual({\n inner: { attachment: \"rid\" },\n });\n });\n\n it(\"maps an ontology object into just its primary key\", async () => {\n const employee = stubData.employee1;\n const ontologyConversion = await toDataValue(employee, clientCtx);\n expect(ontologyConversion).toEqual(\n stubData.employee1.__primaryKey,\n );\n });\n\n it(\"maps an ontology object into just its primary key with osdk wrapper\", async () => {\n const task = await client(Employee).fetchOne(50030);\n const ontologyConversion = await toDataValue(task, clientCtx);\n expect(ontologyConversion).toEqual(\n task.$primaryKey,\n );\n });\n\n it(\"passes through object set definitions\", async () => {\n const clientObjectSet = client(Task).where({ id: 0 });\n const definition = getWireObjectSet(clientObjectSet);\n\n const expected = `\n {\n \"objectSet\": {\n \"objectType\": \"Task\",\n \"type\": \"base\",\n },\n \"type\": \"filter\",\n \"where\": {\n \"field\": \"id\",\n \"type\": \"eq\",\n \"value\": 0,\n },\n }\n `;\n const objectSetConversion = await toDataValue(clientObjectSet, clientCtx);\n expect(objectSetConversion).toMatchInlineSnapshot(\n expected,\n );\n\n const definitionConversion = await toDataValue(definition, clientCtx);\n expect(definitionConversion).toMatchInlineSnapshot(expected);\n });\n\n it(\"converts blob attachment uploads correctly\", async () => {\n const blob =\n stubData.attachmentUploadRequestBody[stubData.localAttachment1.filename];\n const attachmentUpload = createAttachmentUpload(blob, \"file1.txt\");\n const converted = await toDataValue(attachmentUpload, clientCtx);\n\n expect(converted).toEqual(\n \"ri.attachments.main.attachment.86016861-707f-4292-b258-6a7108915a75\",\n );\n });\n\n it(\"converts file attachment uploads correctly\", async () => {\n // Mimics the Web file API (https://developer.mozilla.org/en-US/docs/Web/API/File). The File constructor is only available in Node 19.2.0 and above\n const file = Object.assign(\n stubData.attachmentUploadRequestBody[stubData.localAttachment1.filename],\n { name: \"file1.txt\" },\n );\n\n const converted = await toDataValue(file, clientCtx);\n\n expect(converted).toEqual(\n \"ri.attachments.main.attachment.86016861-707f-4292-b258-6a7108915a75\",\n );\n });\n\n it(\"converts media reference correctly\", async () => {\n const converted = await toDataValue(stubData.mediaReference, clientCtx);\n expect(converted).toEqual(\n stubData.mediaReference,\n );\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,YAAY,EAAEC,QAAQ,EAAEC,IAAI,QAAQ,4BAA4B;AACzE,SAASC,SAAS,EAAEC,YAAY,EAAEC,QAAQ,QAAQ,mBAAmB;AAErE,SAASC,QAAQ,EAAEC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAA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,CAACkD,SAAS,CAAC,CAAC3B,OAAO,CACvB,qEACF,CAAC;EACH,CAAC,CAAC;EAEFtB,EAAE,CAAC,oCAAoC,EAAE,YAAY;IACnD,MAAMiD,SAAS,GAAG,MAAM3C,WAAW,CAACX,QAAQ,CAAC2D,cAAc,EAAE9C,SAAS,CAAC;IACvET,MAAM,CAACkD,SAAS,CAAC,CAAC3B,OAAO,CACvB3B,QAAQ,CAAC2D,cACX,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"toDataValue.test.js","names":["Employee","Task","LegacyFauxFoundry","startNodeApiServer","stubData","beforeAll","describe","expect","it","vi","createClient","createMinimalClient","createAttachmentUpload","getWireObjectSet","toDataValue","client","clientCtx","fn","testSetup","ontologyRid","fauxFoundry","defaultOntologyRid","baseUrl","auth","apiServer","close","basic","null","undefined","boolean","date","integer","string","timestamp","convertedBasic","toEqual","attachment","attachmentArray","attachmentSet","Set","recursiveConversion","inner","employee","employee1","ontologyConversion","__primaryKey","task","fetchOne","$primaryKey","clientObjectSet","where","id","definition","expected","objectSetConversion","toMatchInlineSnapshot","definitionConversion","blob","Blob","JSON","stringify","attachmentUpload","converted","toMatch","file","Object","assign","name","type","mediaReference","mimeType","reference","mediaSetViewItem","mediaItemRid","mediaSetRid","mediaSetViewRid"],"sources":["toDataValue.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 { Employee, Task } from \"@osdk/client.test.ontology\";\nimport type { MediaReference } from \"@osdk/foundry.core\";\nimport {\n LegacyFauxFoundry,\n startNodeApiServer,\n stubData,\n} from \"@osdk/shared.test\";\nimport type { MockedFunction } from \"vitest\";\nimport { beforeAll, describe, expect, it, vi } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createMinimalClient } from \"../createMinimalClient.js\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { createAttachmentUpload } from \"../object/AttachmentUpload.js\";\nimport { getWireObjectSet } from \"../objectSet/createObjectSet.js\";\nimport { toDataValue } from \"./toDataValue.js\";\n\ndescribe(toDataValue, () => {\n let client: Client;\n let clientCtx: MinimalClient;\n\n const mockFetch: MockedFunction<typeof globalThis.fetch> = vi.fn();\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n\n clientCtx = createMinimalClient(\n { ontologyRid: testSetup.fauxFoundry.defaultOntologyRid },\n testSetup.fauxFoundry.baseUrl,\n testSetup.auth,\n {},\n );\n\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"converts passthrough values correctly\", async () => {\n // basic pass through types\n const basic = {\n null: undefined,\n boolean: false,\n date: \"2024-01-01\",\n integer: 0,\n string: \"string\",\n timestamp: \"2024-01-01T00:00:00Z\",\n };\n const convertedBasic = await toDataValue(basic, clientCtx);\n expect(convertedBasic).toEqual(basic);\n });\n\n it(\"recursively converts arrays and sets into array types\", async () => {\n const attachment = \"rid\";\n const attachmentArray = [attachment];\n const attachmentSet = new Set(attachmentArray);\n\n const recursiveConversion = await toDataValue({\n attachment,\n attachmentArray,\n attachmentSet,\n }, clientCtx);\n\n expect(recursiveConversion).toEqual({\n attachment: \"rid\",\n attachmentArray: [\"rid\"],\n attachmentSet: [\"rid\"],\n });\n });\n\n it(\"recursively handles structs\", async () => {\n const struct = {\n inner: {\n attachment: \"rid\",\n },\n };\n\n const recursiveConversion = await toDataValue(struct, clientCtx);\n\n expect(recursiveConversion).toEqual({\n inner: { attachment: \"rid\" },\n });\n });\n\n it(\"maps an ontology object into just its primary key\", async () => {\n const employee = stubData.employee1;\n const ontologyConversion = await toDataValue(employee, clientCtx);\n expect(ontologyConversion).toEqual(\n stubData.employee1.__primaryKey,\n );\n });\n\n it(\"maps an ontology object into just its primary key with osdk wrapper\", async () => {\n const task = await client(Employee).fetchOne(50030);\n const ontologyConversion = await toDataValue(task, clientCtx);\n expect(ontologyConversion).toEqual(\n task.$primaryKey,\n );\n });\n\n it(\"passes through object set definitions\", async () => {\n const clientObjectSet = client(Task).where({ id: 0 });\n const definition = getWireObjectSet(clientObjectSet);\n\n const expected = `\n {\n \"objectSet\": {\n \"objectType\": \"Task\",\n \"type\": \"base\",\n },\n \"type\": \"filter\",\n \"where\": {\n \"field\": \"id\",\n \"type\": \"eq\",\n \"value\": 0,\n },\n }\n `;\n const objectSetConversion = await toDataValue(clientObjectSet, clientCtx);\n expect(objectSetConversion).toMatchInlineSnapshot(\n expected,\n );\n\n const definitionConversion = await toDataValue(definition, clientCtx);\n expect(definitionConversion).toMatchInlineSnapshot(expected);\n });\n\n it(\"converts blob attachment uploads correctly\", async () => {\n const blob = new Blob([JSON.stringify({ \"hi\": \"mom\" })]);\n const attachmentUpload = createAttachmentUpload(blob, \"file1.txt\");\n const converted = await toDataValue(attachmentUpload, clientCtx);\n\n expect(converted).toMatch(/ri\\.attachments.main.attachment\\.[a-z0-9\\-]+/i);\n });\n\n it(\"converts file attachment uploads correctly\", async () => {\n // Mimics the Web file API (https://developer.mozilla.org/en-US/docs/Web/API/File). The File constructor is only available in Node 19.2.0 and above\n const file = Object.assign(\n new Blob([\n JSON.stringify({ name: \"Hello World\" }, null, 2),\n ], {\n type: \"application/json\",\n }),\n { name: \"file1.txt\" },\n );\n\n const converted = await toDataValue(file, clientCtx);\n expect(converted).toMatch(/ri\\.attachments.main.attachment\\.[a-z0-9\\-]+/i);\n });\n\n it(\"converts media reference correctly\", async () => {\n const mediaReference: MediaReference = {\n mimeType: \"application/json\",\n reference: {\n type: \"mediaSetViewItem\",\n mediaSetViewItem: {\n mediaItemRid: \"media-item-rid\",\n mediaSetRid: \"media-set-rid\",\n mediaSetViewRid: \"media-set-view-rid\",\n },\n },\n };\n\n const converted = await toDataValue(mediaReference, clientCtx);\n expect(converted).toEqual(mediaReference);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,EAAEC,IAAI,QAAQ,4BAA4B;AAE3D,SACEC,iBAAiB,EACjBC,kBAAkB,EAClBC,QAAQ,QACH,mBAAmB;AAE1B,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAE5D,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,mBAAmB,QAAQ,2BAA2B;AAE/D,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,gBAAgB,QAAQ,iCAAiC;AAClE,SAASC,WAAW,QAAQ,kBAAkB;AAE9CR,QAAQ,CAACQ,WAAW,EAAE,MAAM;EAC1B,IAAIC,MAAc;EAClB,IAAIC,SAAwB;EAE+BP,EAAE,CAACQ,EAAE,CAAC,CAAC;EAElEZ,SAAS,CAAC,MAAM;IACd,MAAMa,SAAS,GAAGf,kBAAkB,CAAC,IAAID,iBAAiB,CAAC,CAAC,EAAEQ,YAAY,CAAC;IAC3E,CAAC;MAAEK;IAAO,CAAC,GAAGG,SAAS;IAEvBF,SAAS,GAAGL,mBAAmB,CAC7B;MAAEQ,WAAW,EAAED,SAAS,CAACE,WAAW,CAACC;IAAmB,CAAC,EACzDH,SAAS,CAACE,WAAW,CAACE,OAAO,EAC7BJ,SAAS,CAACK,IAAI,EACd,CAAC,CACH,CAAC;IAED,OAAO,MAAM;MACXL,SAAS,CAACM,SAAS,CAACC,KAAK,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,CAAC;EAEFjB,EAAE,CAA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