@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
|
@@ -14,23 +14,25 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { $Actions,
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
17
|
+
import { $Actions, actionTakesAttachment, actionTakesMedia, addGeoshape, createFooInterface, createOffice, createStructPerson, deleteBarInterface, deleteFooInterface, Employee, moveOffice } from "@osdk/client.test.ontology";
|
|
18
|
+
import { LegacyFauxFoundry, MockOntologiesV2, startNodeApiServer, stubData } from "@osdk/shared.test";
|
|
19
|
+
import { beforeAll, describe, expect, expectTypeOf, it, vi } from "vitest";
|
|
20
20
|
import { createClient } from "../createClient.js";
|
|
21
21
|
import { createAttachmentUpload } from "../object/AttachmentUpload.js";
|
|
22
22
|
import { ActionValidationError } from "./ActionValidationError.js";
|
|
23
23
|
import { remapActionResponse } from "./applyAction.js";
|
|
24
|
-
describe("
|
|
24
|
+
describe.each(["https://stack.palantir.com", "https://stack.palantirCustom.com/foo/first/someStuff"])("actions for %s", baseUrl => {
|
|
25
25
|
let client;
|
|
26
|
-
let
|
|
27
|
-
beforeAll(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
26
|
+
let apiServer;
|
|
27
|
+
beforeAll(() => {
|
|
28
|
+
const testSetup = startNodeApiServer(new LegacyFauxFoundry(baseUrl), createClient);
|
|
29
|
+
({
|
|
30
|
+
client,
|
|
31
|
+
apiServer
|
|
32
|
+
} = testSetup);
|
|
33
|
+
return () => {
|
|
34
|
+
apiServer.close();
|
|
35
|
+
};
|
|
34
36
|
});
|
|
35
37
|
it("conditionally returns the edits", async () => {
|
|
36
38
|
const result = await client(createOffice).applyAction({
|
|
@@ -41,26 +43,20 @@ describe("actions", () => {
|
|
|
41
43
|
$returnEdits: true
|
|
42
44
|
});
|
|
43
45
|
expectTypeOf().toEqualTypeOf();
|
|
44
|
-
expect(result).
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"Office",
|
|
59
|
-
],
|
|
60
|
-
"modifiedObjects": [],
|
|
61
|
-
"type": "edits",
|
|
62
|
-
}
|
|
63
|
-
`);
|
|
46
|
+
expect(result).toMatchObject({
|
|
47
|
+
"addedLinks": [],
|
|
48
|
+
"addedObjects": [{
|
|
49
|
+
"objectType": "Office",
|
|
50
|
+
"primaryKey": "NYC"
|
|
51
|
+
}],
|
|
52
|
+
"deletedLinks": [],
|
|
53
|
+
"deletedLinksCount": 0,
|
|
54
|
+
"deletedObjects": [],
|
|
55
|
+
"deletedObjectsCount": 0,
|
|
56
|
+
"editedObjectTypes": ["Office"],
|
|
57
|
+
"modifiedObjects": [],
|
|
58
|
+
"type": "edits"
|
|
59
|
+
});
|
|
64
60
|
|
|
65
61
|
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
66
62
|
const undefinedResult = await client(createOffice).applyAction({
|
|
@@ -84,55 +80,70 @@ describe("actions", () => {
|
|
|
84
80
|
const result = await client(moveOffice).applyAction({
|
|
85
81
|
officeId: "SEA",
|
|
86
82
|
newAddress: "456 Pike Place",
|
|
87
|
-
|
|
83
|
+
// intentionally using a string to trigger validation errors
|
|
84
|
+
newCapacity: "40"
|
|
88
85
|
}, {
|
|
89
86
|
$validateOnly: true
|
|
90
87
|
});
|
|
91
88
|
expectTypeOf().toEqualTypeOf();
|
|
92
|
-
expect(result).
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
"
|
|
96
|
-
"
|
|
89
|
+
expect(result).toMatchObject({
|
|
90
|
+
"parameters": {
|
|
91
|
+
"newCapacity": {
|
|
92
|
+
"evaluatedConstraints": [],
|
|
93
|
+
"required": false,
|
|
94
|
+
"result": "INVALID"
|
|
97
95
|
}
|
|
98
|
-
|
|
96
|
+
},
|
|
97
|
+
"result": "INVALID",
|
|
98
|
+
"submissionCriteria": []
|
|
99
|
+
});
|
|
99
100
|
});
|
|
100
101
|
it("returns validation directly on validateOnly mode, with custom entry point in URL", async () => {
|
|
101
|
-
const result = await
|
|
102
|
+
const result = await client(moveOffice).applyAction({
|
|
102
103
|
officeId: "SEA",
|
|
103
104
|
newAddress: "456 Pike Place",
|
|
104
|
-
|
|
105
|
+
// intentionally using a string to trigger validation failure
|
|
106
|
+
newCapacity: "40"
|
|
105
107
|
}, {
|
|
106
108
|
$validateOnly: true
|
|
107
109
|
});
|
|
108
110
|
expectTypeOf().toEqualTypeOf();
|
|
109
|
-
expect(result).
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
"
|
|
113
|
-
"
|
|
111
|
+
expect(result).toMatchObject({
|
|
112
|
+
"parameters": {
|
|
113
|
+
"newCapacity": {
|
|
114
|
+
"evaluatedConstraints": [],
|
|
115
|
+
"required": false,
|
|
116
|
+
"result": "INVALID"
|
|
114
117
|
}
|
|
115
|
-
|
|
118
|
+
},
|
|
119
|
+
"result": "INVALID",
|
|
120
|
+
"submissionCriteria": []
|
|
121
|
+
});
|
|
116
122
|
});
|
|
117
123
|
it("throws on validation errors", async () => {
|
|
118
124
|
try {
|
|
119
125
|
await client(moveOffice).applyAction({
|
|
120
126
|
officeId: "SEA",
|
|
121
127
|
newAddress: "456 Pike Place",
|
|
122
|
-
|
|
128
|
+
// intentionally using a string to trigger validation failure
|
|
129
|
+
newCapacity: "40"
|
|
123
130
|
}, {
|
|
124
131
|
$returnEdits: true
|
|
125
132
|
});
|
|
126
133
|
expect.fail("Should not reach here");
|
|
127
134
|
} catch (e) {
|
|
128
135
|
expect(e).toBeInstanceOf(ActionValidationError);
|
|
129
|
-
expect(e.validation).
|
|
130
|
-
{
|
|
131
|
-
"
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
+
expect(e.validation).toMatchObject({
|
|
137
|
+
"parameters": {
|
|
138
|
+
"newCapacity": {
|
|
139
|
+
"evaluatedConstraints": [],
|
|
140
|
+
"required": false,
|
|
141
|
+
"result": "INVALID"
|
|
142
|
+
}
|
|
143
|
+
},
|
|
144
|
+
"result": "INVALID",
|
|
145
|
+
"submissionCriteria": []
|
|
146
|
+
});
|
|
136
147
|
}
|
|
137
148
|
});
|
|
138
149
|
it("Accepts structs", async () => {
|
|
@@ -154,27 +165,46 @@ describe("actions", () => {
|
|
|
154
165
|
expectTypeOf().toMatchTypeOf();
|
|
155
166
|
client(actionTakesAttachment).batchApplyAction;
|
|
156
167
|
expectTypeOf().toMatchTypeOf();
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
168
|
+
await apiServer.boundary(async () => {
|
|
169
|
+
apiServer.use(MockOntologiesV2.Actions.apply(baseUrl, () => {
|
|
170
|
+
return {
|
|
171
|
+
validation: {
|
|
172
|
+
result: "VALID",
|
|
173
|
+
submissionCriteria: [],
|
|
174
|
+
parameters: {}
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
}));
|
|
178
|
+
|
|
179
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
180
|
+
const result = await client(actionTakesAttachment).applyAction({
|
|
181
|
+
attachment: "ri.some.rid"
|
|
182
|
+
});
|
|
183
|
+
expectTypeOf().toEqualTypeOf();
|
|
184
|
+
expect(result).toBeUndefined();
|
|
185
|
+
})();
|
|
162
186
|
});
|
|
163
187
|
it("Accepts attachment uploads", async () => {
|
|
164
188
|
client(actionTakesAttachment).applyAction;
|
|
165
189
|
client(actionTakesAttachment).batchApplyAction;
|
|
166
190
|
expectTypeOf().toMatchTypeOf();
|
|
167
191
|
expectTypeOf().toMatchTypeOf();
|
|
168
|
-
const blob =
|
|
192
|
+
const blob = new Blob([JSON.stringify({
|
|
193
|
+
name: "Hello World"
|
|
194
|
+
}, null, 2)]);
|
|
169
195
|
const attachment = createAttachmentUpload(blob, "file1.txt");
|
|
170
196
|
|
|
171
197
|
// 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
|
|
172
198
|
const fileAttachment = Object.assign(blob, {
|
|
173
199
|
name: "file1.txt"
|
|
174
200
|
});
|
|
201
|
+
|
|
202
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
175
203
|
const result = await client(actionTakesAttachment).applyAction({
|
|
176
204
|
attachment
|
|
177
205
|
});
|
|
206
|
+
|
|
207
|
+
// eslint-disable-next-line @typescript-eslint/no-confusing-void-expression
|
|
178
208
|
const result2 = await client(actionTakesAttachment).applyAction({
|
|
179
209
|
attachment: fileAttachment
|
|
180
210
|
});
|
|
@@ -187,7 +217,23 @@ describe("actions", () => {
|
|
|
187
217
|
client(actionTakesMedia).applyAction;
|
|
188
218
|
expectTypeOf().toMatchTypeOf();
|
|
189
219
|
const result = await client(actionTakesMedia).applyAction({
|
|
190
|
-
media_reference: stubData.
|
|
220
|
+
media_reference: stubData.actionRequestMediaUpload.parameters.media_reference
|
|
221
|
+
});
|
|
222
|
+
expectTypeOf().toEqualTypeOf();
|
|
223
|
+
expect(result).toBeUndefined();
|
|
224
|
+
});
|
|
225
|
+
it("Accepts geoshapes", async () => {
|
|
226
|
+
client(addGeoshape).applyAction;
|
|
227
|
+
expectTypeOf().toMatchTypeOf();
|
|
228
|
+
const result = await client(addGeoshape).applyAction({
|
|
229
|
+
geoshapeParam: {
|
|
230
|
+
type: "Polygon",
|
|
231
|
+
coordinates: [[[-97.86567863752134, 38.418052586871624], [-97.86567863752134, 35.410223767370525], [-91.98573135442845, 35.410223767370525], [-91.98573135442845, 38.418052586871624], [-97.86567863752134, 38.418052586871624]]]
|
|
232
|
+
},
|
|
233
|
+
geohashParam: {
|
|
234
|
+
type: "Point",
|
|
235
|
+
coordinates: [-79.4382042508868, 40.917859676842255]
|
|
236
|
+
}
|
|
191
237
|
});
|
|
192
238
|
expectTypeOf().toEqualTypeOf();
|
|
193
239
|
expect(result).toBeUndefined();
|
|
@@ -200,7 +246,7 @@ describe("actions", () => {
|
|
|
200
246
|
const result = await client(deleteFooInterface).applyAction({
|
|
201
247
|
deletedInterface: {
|
|
202
248
|
$objectType: "Employee",
|
|
203
|
-
$primaryKey:
|
|
249
|
+
$primaryKey: 50030
|
|
204
250
|
}
|
|
205
251
|
});
|
|
206
252
|
expectTypeOf().toEqualTypeOf();
|
|
@@ -218,7 +264,7 @@ describe("actions", () => {
|
|
|
218
264
|
client(createFooInterface).batchApplyAction;
|
|
219
265
|
expectTypeOf().toMatchTypeOf();
|
|
220
266
|
const result = await client(createFooInterface).applyAction({
|
|
221
|
-
createdInterface:
|
|
267
|
+
createdInterface: Employee.apiName
|
|
222
268
|
});
|
|
223
269
|
expectTypeOf().toEqualTypeOf();
|
|
224
270
|
expect(result).toBeUndefined();
|
|
@@ -235,30 +281,23 @@ describe("actions", () => {
|
|
|
235
281
|
}], {
|
|
236
282
|
$returnEdits: true
|
|
237
283
|
});
|
|
238
|
-
expect(result).
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
"objectType": "Office",
|
|
256
|
-
"primaryKey": "NYC",
|
|
257
|
-
},
|
|
258
|
-
],
|
|
259
|
-
"type": "edits",
|
|
260
|
-
}
|
|
261
|
-
`);
|
|
284
|
+
expect(result).toMatchObject({
|
|
285
|
+
"addedLinks": [],
|
|
286
|
+
"addedObjects": [],
|
|
287
|
+
"deletedLinks": [],
|
|
288
|
+
"deletedLinksCount": 0,
|
|
289
|
+
"deletedObjects": [],
|
|
290
|
+
"deletedObjectsCount": 0,
|
|
291
|
+
"editedObjectTypes": ["Office"],
|
|
292
|
+
"modifiedObjects": [{
|
|
293
|
+
"objectType": "Office",
|
|
294
|
+
"primaryKey": "SEA"
|
|
295
|
+
}, {
|
|
296
|
+
"objectType": "Office",
|
|
297
|
+
"primaryKey": "NYC"
|
|
298
|
+
}],
|
|
299
|
+
"type": "edits"
|
|
300
|
+
});
|
|
262
301
|
});
|
|
263
302
|
});
|
|
264
303
|
describe("ActionResponse remapping", () => {
|
|
@@ -446,7 +485,13 @@ describe("ActionResponse remapping", () => {
|
|
|
446
485
|
});
|
|
447
486
|
it("actions are enumerable", async () => {
|
|
448
487
|
const actions = Object.keys($Actions);
|
|
449
|
-
expect(actions).toStrictEqual(["actionTakesAttachment", "actionTakesMedia", "actionTakesObjectSet", "createFooInterface", "createOffice", "createOfficeAndEmployee", "createStructPerson", "deleteBarInterface", "deleteFooInterface", "moveOffice", "promoteEmployee", "promoteEmployeeObject"]);
|
|
488
|
+
expect(actions).toStrictEqual(["actionTakesAttachment", "actionTakesMedia", "actionTakesObjectSet", "addGeoshape", "createFooInterface", "createOffice", "createOfficeAndEmployee", "createStructPerson", "deleteBarInterface", "deleteFooInterface", "editTodo", "moveOffice", "promoteEmployee", "promoteEmployeeObject"]);
|
|
450
489
|
});
|
|
451
490
|
});
|
|
491
|
+
function wrapper(fn) {
|
|
492
|
+
return () => fn();
|
|
493
|
+
}
|
|
494
|
+
async function example() {
|
|
495
|
+
await wrapper(async () => Promise.resolve("hi"))();
|
|
496
|
+
}
|
|
452
497
|
//# sourceMappingURL=actions.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.test.js","names":["$Actions","$ontologyRid","actionTakesAttachment","actionTakesMedia","createFooInterface","createOffice","createStructPerson","deleteBarInterface","deleteFooInterface","moveOffice","apiServer","stubData","afterAll","beforeAll","describe","expect","expectTypeOf","it","vi","createClient","createAttachmentUpload","ActionValidationError","remapActionResponse","client","customEntryPointClient","listen","close","result","applyAction","officeId","address","capacity","$returnEdits","toEqualTypeOf","toMatchInlineSnapshot","undefinedResult","toBeUndefined","batchApplyAction","clientCreateOfficeMock","fn","newAddress","newCapacity","$validateOnly","fail","e","toBeInstanceOf","validation","toMatchTypeOf","name","city","state","zipcode","attachment","blob","attachmentUploadRequestBody","localAttachment1","filename","fileAttachment","Object","assign","result2","media_reference","mediaReference","deletedInterface","$objectType","$primaryKey","createdInterface","actionResponse","edits","type","deletedLinksCount","deletedObjectsCount","addedObjectCount","modifiedObjectsCount","addedLinksCount","batchActionResponse","remappedActionResponse","remappedBatchActionResponse","actions","keys","toStrictEqual"],"sources":["actions.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 type {\n ActionEditResponse,\n ActionValidationResponse,\n AttachmentUpload,\n MediaReference,\n} from \"@osdk/api\";\nimport {\n $Actions,\n $ontologyRid,\n actionTakesAttachment,\n actionTakesMedia,\n createFooInterface,\n createOffice,\n createStructPerson,\n deleteBarInterface,\n deleteFooInterface,\n moveOffice,\n} from \"@osdk/client.test.ontology\";\nimport type {\n BatchApplyActionResponseV2,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport { apiServer, stubData } from \"@osdk/shared.test\";\nimport {\n afterAll,\n beforeAll,\n describe,\n expect,\n expectTypeOf,\n it,\n vi,\n} from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createAttachmentUpload } from \"../object/AttachmentUpload.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\nimport { remapActionResponse } from \"./applyAction.js\";\n\ndescribe(\"actions\", () => {\n let client: Client;\n let customEntryPointClient: Client;\n\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\n \"https://stack.palantir.com\",\n $ontologyRid,\n async () => \"myAccessToken\",\n );\n customEntryPointClient = createClient(\n \"https://stack.palantirCustom.com/foo/first/someStuff\",\n $ontologyRid,\n async () => \"myAccessToken\",\n );\n });\n\n afterAll(() => {\n apiServer.close();\n });\n\n it(\"conditionally returns the edits\", async () => {\n const result = await client(createOffice).applyAction({\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n }, { $returnEdits: true });\n\n expectTypeOf<typeof result>().toEqualTypeOf<ActionEditResponse>();\n expect(result).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [],\n \"addedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"deletedLinks\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [],\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Office\",\n ],\n \"modifiedObjects\": [],\n \"type\": \"edits\",\n }\n `);\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const undefinedResult = await client(createOffice).applyAction({\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n });\n\n expectTypeOf<typeof undefinedResult>().toEqualTypeOf<undefined>();\n expect(undefinedResult).toBeUndefined();\n\n const clientCreateOffice = client(createOffice).batchApplyAction;\n const clientCreateOfficeMock: typeof clientCreateOffice = vi.fn();\n void clientCreateOfficeMock([{\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n }], { $returnEdits: true });\n });\n\n it(\"returns validation directly on validateOnly mode\", async () => {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n newCapacity: 40,\n }, {\n $validateOnly: true,\n });\n expectTypeOf<typeof result>().toEqualTypeOf<ActionValidationResponse>();\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n }\n `);\n });\n\n it(\"returns validation directly on validateOnly mode, with custom entry point in URL\", async () => {\n const result = await customEntryPointClient(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n newCapacity: 40,\n }, {\n $validateOnly: true,\n });\n expectTypeOf<typeof result>().toEqualTypeOf<ActionValidationResponse>();\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n }\n `);\n });\n\n it(\"throws on validation errors\", async () => {\n try {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n newCapacity: 40,\n }, {\n $returnEdits: true,\n });\n expect.fail(\"Should not reach here\");\n } catch (e) {\n expect(e).toBeInstanceOf(ActionValidationError);\n expect((e as ActionValidationError).validation).toMatchInlineSnapshot(`\n {\n \"parameters\": {},\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n }\n `);\n }\n });\n\n it(\"Accepts structs\", async () => {\n const clientBoundActionTakesStruct = client(createStructPerson).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesStruct\n >[0];\n expectTypeOf<\n {\n name: string;\n address: { city: string; state: string; zipcode: number };\n }\n >()\n .toMatchTypeOf<\n InferredParamType\n >();\n\n const result = await client(createStructPerson).applyAction({\n name: \"testMan\",\n address: { city: \"NYC\", state: \"NY\", zipcode: 12345 },\n });\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n\n it(\"Accepts attachments\", async () => {\n const clientBoundActionTakesAttachment = client(\n actionTakesAttachment,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesAttachment\n >[0];\n\n expectTypeOf<{ attachment: string | AttachmentUpload }>().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesAttachment = client(\n actionTakesAttachment,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesAttachment\n >[0];\n\n expectTypeOf<{\n attachment: string | AttachmentUpload;\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n\n const result = await client(actionTakesAttachment).applyAction({\n attachment: \"attachment.rid\",\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n\n it(\"Accepts attachment uploads\", async () => {\n const clientBoundActionTakesAttachment = client(\n actionTakesAttachment,\n ).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesAttachment\n >[0];\n const clientBoundBatchActionTakesAttachment = client(\n actionTakesAttachment,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesAttachment\n >[0];\n\n expectTypeOf<\n {\n attachment:\n | string\n | AttachmentUpload\n | Blob & { readonly name: string };\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n expectTypeOf<\n {\n attachment:\n | string\n | AttachmentUpload\n | Blob & { readonly name: string };\n }[]\n >().toMatchTypeOf<\n InferredBatchParamType\n >();\n\n const blob =\n stubData.attachmentUploadRequestBody[stubData.localAttachment1.filename];\n\n const attachment = createAttachmentUpload(blob, \"file1.txt\");\n\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 fileAttachment = Object.assign(blob, { name: \"file1.txt\" });\n\n const result = await client(actionTakesAttachment).applyAction({\n attachment,\n });\n\n const result2 = await client(actionTakesAttachment).applyAction({\n attachment: fileAttachment,\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n\n expectTypeOf<typeof result2>().toEqualTypeOf<undefined>();\n expect(result2).toBeUndefined();\n });\n\n it(\"Accepts media reference\", async () => {\n const clientBoundActionTakesMedia = client(\n actionTakesMedia,\n ).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesMedia\n >[0];\n\n expectTypeOf<\n {\n media_reference: MediaReference;\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const result = await client(actionTakesMedia).applyAction({\n media_reference: stubData.mediaReference,\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n\n it(\"Accepts interfaces\", async () => {\n const clientBoundTakesInterface = client(\n deleteFooInterface,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundTakesInterface\n >[0];\n\n expectTypeOf<\n {\n deletedInterface: {\n $objectType: \"Employee\" | \"Person\";\n $primaryKey: string | number;\n };\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesInterface = client(\n deleteFooInterface,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesInterface\n >[0];\n\n expectTypeOf<{\n deletedInterface: {\n $objectType: \"Employee\" | \"Person\";\n $primaryKey: string | number;\n };\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n\n const result = await client(deleteFooInterface).applyAction({\n deletedInterface: {\n $objectType: \"Employee\",\n $primaryKey: 1,\n },\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n it(\"Accepts interfaces if implementing object types unknown\", async () => {\n const clientBoundTakesInterface = client(\n deleteBarInterface,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundTakesInterface\n >[0];\n\n expectTypeOf<\n {\n deletedInterface: {\n $objectType: string;\n $primaryKey: string | number;\n };\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesInterface = client(\n deleteBarInterface,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesInterface\n >[0];\n\n expectTypeOf<{\n deletedInterface: {\n $objectType: string;\n $primaryKey: string | number;\n };\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n });\n it(\"Accepts object type refs\", async () => {\n const clientBoundTakesObjectType = client(\n createFooInterface,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundTakesObjectType\n >[0];\n\n expectTypeOf<\n {\n createdInterface: string;\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesObjectType = client(\n createFooInterface,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesObjectType\n >[0];\n\n expectTypeOf<{\n createdInterface: string;\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n\n const result = await client(createFooInterface).applyAction({\n createdInterface: \"UnderlyingObject\",\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n it(\"conditionally returns edits in batch mode\", async () => {\n const result = await client(moveOffice).batchApplyAction([\n {\n officeId: \"SEA\",\n newAddress: \"456 Good Place\",\n newCapacity: 40,\n },\n {\n officeId: \"NYC\",\n newAddress: \"123 Main Street\",\n newCapacity: 80,\n },\n ], { $returnEdits: true });\n\n expect(result).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [],\n \"addedObjects\": [],\n \"deletedLinks\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [],\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Office\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"SEA\",\n },\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n });\n});\n\ndescribe(\"ActionResponse remapping\", () => {\n const actionResponse: SyncApplyActionResponseV2 = {\n edits: {\n type: \"edits\",\n edits: [{\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"addObject\",\n }, {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n \"type\": \"modifyObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"addLink\",\n }, {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"deleteObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"deleteLink\",\n }],\n deletedLinksCount: 0,\n deletedObjectsCount: 1,\n addedObjectCount: 1,\n modifiedObjectsCount: 1,\n addedLinksCount: 1,\n },\n };\n\n const batchActionResponse: BatchApplyActionResponseV2 = {\n edits: {\n type: \"edits\",\n edits: [{\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"addObject\",\n }, {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n \"type\": \"modifyObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"addLink\",\n }],\n deletedLinksCount: 0,\n deletedObjectsCount: 0,\n addedObjectCount: 1,\n modifiedObjectsCount: 1,\n addedLinksCount: 1,\n },\n };\n\n it(\"Correctly unpacks edits and editedObjectTypes\", () => {\n const remappedActionResponse = remapActionResponse(actionResponse);\n const remappedBatchActionResponse = remapActionResponse(\n batchActionResponse,\n );\n expect(remappedActionResponse).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"addedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedObjectsCount\": 1,\n \"editedObjectTypes\": [\n \"Developer\",\n \"Contractor\",\n \"Office\",\n \"Employee\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n expect(remappedBatchActionResponse).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"addedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedLinks\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [],\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Developer\",\n \"Contractor\",\n \"Office\",\n \"Employee\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n });\n it(\"actions are enumerable\", async () => {\n const actions = Object.keys($Actions);\n expect(actions).toStrictEqual([\n \"actionTakesAttachment\",\n \"actionTakesMedia\",\n \"actionTakesObjectSet\",\n \"createFooInterface\",\n \"createOffice\",\n \"createOfficeAndEmployee\",\n \"createStructPerson\",\n \"deleteBarInterface\",\n \"deleteFooInterface\",\n \"moveOffice\",\n \"promoteEmployee\",\n \"promoteEmployeeObject\",\n ]);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,YAAY,EACZC,qBAAqB,EACrBC,gBAAgB,EAChBC,kBAAkB,EAClBC,YAAY,EACZC,kBAAkB,EAClBC,kBAAkB,EAClBC,kBAAkB,EAClBC,UAAU,QACL,4BAA4B;AAKnC,SAASC,SAAS,EAAEC,QAAQ,QAAQ,mBAAmB;AACvD,SACEC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNC,YAAY,EACZC,EAAE,EACFC,EAAE,QACG,QAAQ;AAEf,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,SAASC,mBAAmB,QAAQ,kBAAkB;AAEtDR,QAAQ,CAAC,SAAS,EAAE,MAAM;EACxB,IAAIS,MAAc;EAClB,IAAIC,sBAA8B;EAElCX,SAAS,CAAC,YAAY;IACpBH,SAAS,CAACe,MAAM,CAAC,CAAC;IAClBF,MAAM,GAAGJ,YAAY,CACnB,4BAA4B,EAC5BlB,YAAY,EACZ,YAAY,eACd,CAAC;IACDuB,sBAAsB,GAAGL,YAAY,CACnC,sDAAsD,EACtDlB,YAAY,EACZ,YAAY,eACd,CAAC;EACH,CAAC,CAAC;EAEFW,QAAQ,CAAC,MAAM;IACbF,SAAS,CAACgB,KAAK,CAAC,CAAC;EACnB,CAAC,CAAC;EAEFT,EAAE,CAAC,iCAAiC,EAAE,YAAY;IAChD,MAAMU,MAAM,GAAG,MAAMJ,MAAM,CAAClB,YAAY,CAAC,CAACuB,WAAW,CA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ACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;IACFnB,MAAM,CAAC8D,2BAA2B,CAAC,CAAC3C,qBAAqB,CAAC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EACFjB,EAAE,CAAC,wBAAwB,EAAE,YAAY;IACvC,MAAM6D,OAAO,GAAGpB,MAAM,CAACqB,IAAI,CAAC/E,QAAQ,CAAC;IACrCe,MAAM,CAAC+D,OAAO,CAAC,CAACE,aAAa,CAAC,CAC5B,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,oBAAoB,EACpB,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,CACxB,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"actions.test.js","names":["$Actions","actionTakesAttachment","actionTakesMedia","addGeoshape","createFooInterface","createOffice","createStructPerson","deleteBarInterface","deleteFooInterface","Employee","moveOffice","LegacyFauxFoundry","MockOntologiesV2","startNodeApiServer","stubData","beforeAll","describe","expect","expectTypeOf","it","vi","createClient","createAttachmentUpload","ActionValidationError","remapActionResponse","each","baseUrl","client","apiServer","testSetup","close","result","applyAction","officeId","address","capacity","$returnEdits","toEqualTypeOf","toMatchObject","undefinedResult","toBeUndefined","batchApplyAction","clientCreateOfficeMock","fn","newAddress","newCapacity","$validateOnly","fail","e","toBeInstanceOf","validation","toMatchTypeOf","name","city","state","zipcode","boundary","use","Actions","apply","submissionCriteria","parameters","attachment","blob","Blob","JSON","stringify","fileAttachment","Object","assign","result2","media_reference","actionRequestMediaUpload","geoshapeParam","type","coordinates","geohashParam","deletedInterface","$objectType","$primaryKey","createdInterface","apiName","actionResponse","edits","deletedLinksCount","deletedObjectsCount","addedObjectCount","modifiedObjectsCount","addedLinksCount","batchActionResponse","remappedActionResponse","remappedBatchActionResponse","toMatchInlineSnapshot","actions","keys","toStrictEqual","wrapper","example","Promise","resolve"],"sources":["actions.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 type {\n ActionEditResponse,\n ActionValidationResponse,\n AttachmentUpload,\n MediaReference,\n} from \"@osdk/api\";\nimport {\n $Actions,\n actionTakesAttachment,\n actionTakesMedia,\n addGeoshape,\n createFooInterface,\n createOffice,\n createStructPerson,\n deleteBarInterface,\n deleteFooInterface,\n Employee,\n moveOffice,\n} from \"@osdk/client.test.ontology\";\nimport type {\n BatchApplyActionResponseV2,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport type { SetupServer } from \"@osdk/shared.test\";\nimport {\n LegacyFauxFoundry,\n MockOntologiesV2,\n startNodeApiServer,\n stubData,\n} from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, expectTypeOf, it, vi } from \"vitest\";\nimport type { Client } from \"../Client.js\";\nimport { createClient } from \"../createClient.js\";\nimport { createAttachmentUpload } from \"../object/AttachmentUpload.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\nimport { remapActionResponse } from \"./applyAction.js\";\n\ndescribe.each([\n \"https://stack.palantir.com\",\n \"https://stack.palantirCustom.com/foo/first/someStuff\",\n])(\"actions for %s\", (baseUrl) => {\n let client: Client;\n let apiServer: SetupServer;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(\n new LegacyFauxFoundry(baseUrl),\n createClient,\n );\n ({ client, apiServer } = testSetup);\n\n return () => {\n apiServer.close();\n };\n });\n\n it(\"conditionally returns the edits\", async () => {\n const result = await client(createOffice).applyAction({\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n }, { $returnEdits: true });\n\n expectTypeOf<typeof result>().toEqualTypeOf<ActionEditResponse>();\n expect(result).toMatchObject(\n {\n \"addedLinks\": [],\n \"addedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"deletedLinks\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [],\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Office\",\n ],\n \"modifiedObjects\": [],\n \"type\": \"edits\",\n },\n );\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const undefinedResult = await client(createOffice).applyAction({\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n });\n\n expectTypeOf<typeof undefinedResult>().toEqualTypeOf<undefined>();\n expect(undefinedResult).toBeUndefined();\n\n const clientCreateOffice = client(createOffice).batchApplyAction;\n const clientCreateOfficeMock: typeof clientCreateOffice = vi.fn();\n void clientCreateOfficeMock([{\n officeId: \"NYC\",\n address: \"123 Main Street\",\n capacity: 100,\n }], { $returnEdits: true });\n });\n\n it(\"returns validation directly on validateOnly mode\", async () => {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n // intentionally using a string to trigger validation errors\n newCapacity: \"40\" as unknown as number,\n }, {\n $validateOnly: true,\n });\n expectTypeOf<typeof result>().toEqualTypeOf<ActionValidationResponse>();\n\n expect(result).toMatchObject(\n {\n \"parameters\": {\n \"newCapacity\": {\n \"evaluatedConstraints\": [],\n \"required\": false,\n \"result\": \"INVALID\",\n },\n },\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n },\n );\n });\n\n it(\"returns validation directly on validateOnly mode, with custom entry point in URL\", async () => {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n // intentionally using a string to trigger validation failure\n newCapacity: \"40\" as unknown as number,\n }, {\n $validateOnly: true,\n });\n expectTypeOf<typeof result>().toEqualTypeOf<ActionValidationResponse>();\n\n expect(result).toMatchObject(\n {\n \"parameters\": {\n \"newCapacity\": {\n \"evaluatedConstraints\": [],\n \"required\": false,\n \"result\": \"INVALID\",\n },\n },\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n },\n );\n });\n\n it(\"throws on validation errors\", async () => {\n try {\n const result = await client(moveOffice).applyAction({\n officeId: \"SEA\",\n newAddress: \"456 Pike Place\",\n // intentionally using a string to trigger validation failure\n newCapacity: \"40\" as unknown as number,\n }, {\n $returnEdits: true,\n });\n expect.fail(\"Should not reach here\");\n } catch (e) {\n expect(e).toBeInstanceOf(ActionValidationError);\n expect((e as ActionValidationError).validation).toMatchObject(\n {\n \"parameters\": {\n \"newCapacity\": {\n \"evaluatedConstraints\": [],\n \"required\": false,\n \"result\": \"INVALID\",\n },\n },\n \"result\": \"INVALID\",\n \"submissionCriteria\": [],\n },\n );\n }\n });\n\n it(\"Accepts structs\", async () => {\n const clientBoundActionTakesStruct = client(createStructPerson).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesStruct\n >[0];\n expectTypeOf<\n {\n name: string;\n address: { city: string; state: string; zipcode: number };\n }\n >()\n .toMatchTypeOf<\n InferredParamType\n >();\n\n const result = await client(createStructPerson).applyAction({\n name: \"testMan\",\n address: { city: \"NYC\", state: \"NY\", zipcode: 12345 },\n });\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n\n it(\"Accepts attachments\", async () => {\n const clientBoundActionTakesAttachment = client(\n actionTakesAttachment,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesAttachment\n >[0];\n\n expectTypeOf<{ attachment: string | AttachmentUpload }>().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesAttachment = client(\n actionTakesAttachment,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesAttachment\n >[0];\n\n expectTypeOf<{\n attachment: string | AttachmentUpload;\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n\n await apiServer.boundary(async () => {\n apiServer.use(MockOntologiesV2.Actions.apply(baseUrl, (info) => {\n return {\n validation: {\n result: \"VALID\",\n submissionCriteria: [],\n parameters: {},\n },\n };\n }));\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const result = await client(actionTakesAttachment).applyAction({\n attachment: \"ri.some.rid\",\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n })();\n });\n\n it(\"Accepts attachment uploads\", async () => {\n const clientBoundActionTakesAttachment = client(\n actionTakesAttachment,\n ).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesAttachment\n >[0];\n const clientBoundBatchActionTakesAttachment = client(\n actionTakesAttachment,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesAttachment\n >[0];\n\n expectTypeOf<\n {\n attachment:\n | string\n | AttachmentUpload\n | Blob & { readonly name: string };\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n expectTypeOf<\n {\n attachment:\n | string\n | AttachmentUpload\n | Blob & { readonly name: string };\n }[]\n >().toMatchTypeOf<\n InferredBatchParamType\n >();\n\n const blob = new Blob([JSON.stringify({ name: \"Hello World\" }, null, 2)]);\n\n const attachment = createAttachmentUpload(blob, \"file1.txt\");\n\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 fileAttachment = Object.assign(blob, { name: \"file1.txt\" });\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const result = await client(actionTakesAttachment).applyAction({\n attachment,\n });\n\n // eslint-disable-next-line @typescript-eslint/no-confusing-void-expression\n const result2 = await client(actionTakesAttachment).applyAction({\n attachment: fileAttachment,\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n\n expectTypeOf<typeof result2>().toEqualTypeOf<undefined>();\n expect(result2).toBeUndefined();\n });\n\n it(\"Accepts media reference\", async () => {\n const clientBoundActionTakesMedia = client(\n actionTakesMedia,\n ).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesMedia\n >[0];\n\n expectTypeOf<\n {\n media_reference: MediaReference;\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const result = await client(actionTakesMedia).applyAction({\n media_reference:\n stubData.actionRequestMediaUpload.parameters.media_reference,\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n\n it(\"Accepts geoshapes\", async () => {\n const clientBoundActionTakesMedia = client(\n addGeoshape,\n ).applyAction;\n type InferredParamType = Parameters<\n typeof clientBoundActionTakesMedia\n >[0];\n\n expectTypeOf<\n {\n geoshapeParam: GeoJSON.GeoJSON;\n geohashParam: GeoJSON.Point;\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const result = await client(addGeoshape).applyAction({\n geoshapeParam: {\n type: \"Polygon\",\n coordinates: [\n [\n [\n -97.86567863752134,\n 38.418052586871624,\n ],\n [\n -97.86567863752134,\n 35.410223767370525,\n ],\n [\n -91.98573135442845,\n 35.410223767370525,\n ],\n [\n -91.98573135442845,\n 38.418052586871624,\n ],\n [\n -97.86567863752134,\n 38.418052586871624,\n ],\n ],\n ],\n },\n geohashParam: {\n type: \"Point\",\n coordinates: [-79.4382042508868, 40.917859676842255],\n },\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n\n it(\"Accepts interfaces\", async () => {\n const clientBoundTakesInterface = client(\n deleteFooInterface,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundTakesInterface\n >[0];\n\n expectTypeOf<\n {\n deletedInterface: {\n $objectType: \"Employee\" | \"Person\";\n $primaryKey: string | number;\n };\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesInterface = client(\n deleteFooInterface,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesInterface\n >[0];\n\n expectTypeOf<{\n deletedInterface: {\n $objectType: \"Employee\" | \"Person\";\n $primaryKey: string | number;\n };\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n\n const result = await client(deleteFooInterface).applyAction({\n deletedInterface: {\n $objectType: \"Employee\",\n $primaryKey: 50030,\n },\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n it(\"Accepts interfaces if implementing object types unknown\", async () => {\n const clientBoundTakesInterface = client(\n deleteBarInterface,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundTakesInterface\n >[0];\n\n expectTypeOf<\n {\n deletedInterface: {\n $objectType: string;\n $primaryKey: string | number;\n };\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesInterface = client(\n deleteBarInterface,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesInterface\n >[0];\n\n expectTypeOf<{\n deletedInterface: {\n $objectType: string;\n $primaryKey: string | number;\n };\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n });\n it(\"Accepts object type refs\", async () => {\n const clientBoundTakesObjectType = client(\n createFooInterface,\n ).applyAction;\n\n type InferredParamType = Parameters<\n typeof clientBoundTakesObjectType\n >[0];\n\n expectTypeOf<\n {\n createdInterface: string;\n }\n >().toMatchTypeOf<\n InferredParamType\n >();\n\n const clientBoundBatchActionTakesObjectType = client(\n createFooInterface,\n ).batchApplyAction;\n type InferredBatchParamType = Parameters<\n typeof clientBoundBatchActionTakesObjectType\n >[0];\n\n expectTypeOf<{\n createdInterface: string;\n }[]>().toMatchTypeOf<InferredBatchParamType>();\n\n const result = await client(createFooInterface).applyAction({\n createdInterface: Employee.apiName,\n });\n\n expectTypeOf<typeof result>().toEqualTypeOf<undefined>();\n expect(result).toBeUndefined();\n });\n it(\"conditionally returns edits in batch mode\", async () => {\n const result = await client(moveOffice).batchApplyAction([\n {\n officeId: \"SEA\",\n newAddress: \"456 Good Place\",\n newCapacity: 40,\n },\n {\n officeId: \"NYC\",\n newAddress: \"123 Main Street\",\n newCapacity: 80,\n },\n ], { $returnEdits: true });\n\n expect(result).toMatchObject(\n {\n \"addedLinks\": [],\n \"addedObjects\": [],\n \"deletedLinks\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [],\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Office\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"SEA\",\n },\n {\n \"objectType\": \"Office\",\n \"primaryKey\": \"NYC\",\n },\n ],\n \"type\": \"edits\",\n },\n );\n });\n});\n\ndescribe(\"ActionResponse remapping\", () => {\n const actionResponse: SyncApplyActionResponseV2 = {\n edits: {\n type: \"edits\",\n edits: [{\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"addObject\",\n }, {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n \"type\": \"modifyObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"addLink\",\n }, {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"deleteObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"deleteLink\",\n }],\n deletedLinksCount: 0,\n deletedObjectsCount: 1,\n addedObjectCount: 1,\n modifiedObjectsCount: 1,\n addedLinksCount: 1,\n },\n };\n\n const batchActionResponse: BatchApplyActionResponseV2 = {\n edits: {\n type: \"edits\",\n edits: [{\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n \"type\": \"addObject\",\n }, {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n \"type\": \"modifyObject\",\n }, {\n \"aSideObject\": { \"primaryKey\": \"key1\", \"objectType\": \"Office\" },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n \"bSideObject\": { \"primaryKey\": \"key2\", \"objectType\": \"Employee\" },\n \"type\": \"addLink\",\n }],\n deletedLinksCount: 0,\n deletedObjectsCount: 0,\n addedObjectCount: 1,\n modifiedObjectsCount: 1,\n addedLinksCount: 1,\n },\n };\n\n it(\"Correctly unpacks edits and editedObjectTypes\", () => {\n const remappedActionResponse = remapActionResponse(actionResponse);\n const remappedBatchActionResponse = remapActionResponse(\n batchActionResponse,\n );\n expect(remappedActionResponse).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"addedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedObjectsCount\": 1,\n \"editedObjectTypes\": [\n \"Developer\",\n \"Contractor\",\n \"Office\",\n \"Employee\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n expect(remappedBatchActionResponse).toMatchInlineSnapshot(`\n {\n \"addedLinks\": [\n {\n \"aSideObject\": {\n \"objectType\": \"Office\",\n \"primaryKey\": \"key1\",\n },\n \"bSideObject\": {\n \"objectType\": \"Employee\",\n \"primaryKey\": \"key2\",\n },\n \"linkTypeApiNameAtoB\": \"test\",\n \"linkTypeApiNameBtoA\": \"test\",\n },\n ],\n \"addedObjects\": [\n {\n \"objectType\": \"Developer\",\n \"primaryKey\": \"PalantirDev\",\n },\n ],\n \"deletedLinks\": [],\n \"deletedLinksCount\": 0,\n \"deletedObjects\": [],\n \"deletedObjectsCount\": 0,\n \"editedObjectTypes\": [\n \"Developer\",\n \"Contractor\",\n \"Office\",\n \"Employee\",\n ],\n \"modifiedObjects\": [\n {\n \"objectType\": \"Contractor\",\n \"primaryKey\": \"Contractor1\",\n },\n ],\n \"type\": \"edits\",\n }\n `);\n });\n it(\"actions are enumerable\", async () => {\n const actions = Object.keys($Actions);\n expect(actions).toStrictEqual([\n \"actionTakesAttachment\",\n \"actionTakesMedia\",\n \"actionTakesObjectSet\",\n \"addGeoshape\",\n \"createFooInterface\",\n \"createOffice\",\n \"createOfficeAndEmployee\",\n \"createStructPerson\",\n \"deleteBarInterface\",\n \"deleteFooInterface\",\n \"editTodo\",\n \"moveOffice\",\n \"promoteEmployee\",\n \"promoteEmployeeObject\",\n ]);\n });\n});\n\nfunction wrapper<R>(fn: () => R): typeof fn {\n return () => fn();\n}\n\nasync function example() {\n await wrapper(async () => Promise.resolve(\"hi\"))();\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,qBAAqB,EACrBC,gBAAgB,EAChBC,WAAW,EACXC,kBAAkB,EAClBC,YAAY,EACZC,kBAAkB,EAClBC,kBAAkB,EAClBC,kBAAkB,EAClBC,QAAQ,EACRC,UAAU,QACL,4BAA4B;AAMnC,SACEC,iBAAiB,EACjBC,gBAAgB,EAChBC,kBAAkB,EAClBC,QAAQ,QACH,mBAAmB;AAC1B,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAE1E,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,sBAAsB,QAAQ,+BAA+B;AACtE,SAASC,qBAAqB,QAAQ,4BAA4B;AAClE,SAASC,mBAAmB,QAAQ,kBAAkB;AAEtDR,QAAQ,CAACS,IAAI,CAAC,CACZ,4BAA4B,EAC5B,sDAAsD,CACvD,CAAC,CAAC,gBAAgB,EAAGC,OAAO,IAAK;EAChC,IAAIC,MAAc;EAClB,IAAIC,SAAsB;EAE1Bb,SAAS,CAAC,MAAM;IACd,MAAMc,SAAS,GAAGhB,kBAAkB,CAClC,IAAIF,iBAAiB,CAACe,OAAO,CAAC,EAC9BL,YACF,CAAC;IACD,CAAC;MAAEM,MAAM;MAAEC;IAAU,CAAC,GAAGC,SAAS;IAElC,OAAO,MAAM;MACXD,SAAS,CAACE,KAAK,CAAC,CAAC;IACnB,CAAC;EACH,CAAC,CAAC;EAEFX,EAAE,CAAC,iCAAiC,EAAE,YAAY;IAChD,MAAMY,MAAM,GAAG,MAAMJ,MAAM,CAACtB,YAAY,CAAC,CAAC2B,WAAW,CAAC;MACpDC,QAAQ,EAAE,KAAK;MACfC,OAAO,EA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E;UAAE,YAAY,EAAE,MAAM;UAAE,YAAY,EAAE;QAAS,CAAC;QAC/D,qBAAqB,EAAE,MAAM;QAC7B,qBAAqB,EAAE,MAAM;QAC7B,aAAa,EAAE;UAAE,YAAY,EAAE,MAAM;UAAE,YAAY,EAAE;QAAW,CAAC;QACjE,MAAM,EAAE;MACV,CAAC,CAAC;MACFC,iBAAiB,EAAE,CAAC;MACpBC,mBAAmB,EAAE,CAAC;MACtBC,gBAAgB,EAAE,CAAC;MACnBC,oBAAoB,EAAE,CAAC;MACvBC,eAAe,EAAE;IACnB;EACF,CAAC;EAEDrE,EAAE,CAAC,+CAA+C,EAAE,MAAM;IACxD,MAAMuE,sBAAsB,GAAGlE,mBAAmB,CAAC0D,cAAc,CAAC;IAClE,MAAMS,2BAA2B,GAAGnE,mBAAmB,CACrDiE,mBACF,CAAC;IACDxE,MAAM,CAACyE,sBAAsB,CAAC,CAACE,qBAAqB,CAAC;AACzD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;IACF3E,MAAM,CAAC0E,2BAA2B,CAAC,CAACC,qBAAqB,CAAC;AAC9D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EACFzE,EAAE,CAAC,wBAAwB,EAAE,YAAY;IACvC,MAAM0E,OAAO,GAAGzB,MAAM,CAAC0B,IAAI,CAAC9F,QAAQ,CAAC;IACrCiB,MAAM,CAAC4E,OAAO,CAAC,CAACE,aAAa,CAAC,CAC5B,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,aAAa,EACb,oBAAoB,EACpB,cAAc,EACd,yBAAyB,EACzB,oBAAoB,EACpB,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,YAAY,EACZ,iBAAiB,EACjB,uBAAuB,CACxB,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,SAASC,OAAOA,CAAIrD,EAAW,EAAa;EAC1C,OAAO,MAAMA,EAAE,CAAC,CAAC;AACnB;AAEA,eAAesD,OAAOA,CAAA,EAAG;EACvB,MAAMD,OAAO,CAAC,YAAYE,OAAO,CAACC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpD","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"applyAction.js","names":["OntologiesV2","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValue","ActionValidationError","applyAction","client","action","parameters","options","clientWithHeaders","finalMethodCall","Array","isArray","response","Actions","applyBatch","ontologyRid","apiName","requests","remapBatchActionParams","returnEdits","$returnEdits","edits","type","remapActionResponse","undefined","apply","remapActionParams","mode","$validateOnly","validation","result","params","parameterMap","key","value","Object","entries","remappedParams","Promise","all","map","param","editResponses","remappedActionResponse","deletedLinksCount","deletedObjectsCount","addedLinks","deletedLinks","addedObjects","deletedObjects","modifiedObjects","editedObjectTypes","editedObjectTypesSet","Set","edit","osdkEdit","linkTypeApiNameAtoB","linkTypeApiNameBtoA","aSideObject","bSideObject","push","add","objectType","primaryKey","process","env","NODE_ENV","console","warn","JSON","stringify"],"sources":["applyAction.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n DataValueClientToWire,\n} from \"@osdk/api\";\nimport type {\n BatchApplyActionResponseV2,\n DataValue,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport type { NOOP } from \"../util/NOOP.js\";\nimport type { NullableProps } from \"../util/NullableProps.js\";\nimport type { PartialBy } from \"../util/partialBy.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\ntype BaseType<APD extends Pick<ActionMetadata.Parameter<any>, \"type\">> =\n APD[\"type\"] extends ActionMetadata.DataType.Object<infer TTargetType>\n ? ActionParam.ObjectType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.ObjectSet<infer TTargetType>\n ? ActionParam.ObjectSetType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.Struct<infer TStructType>\n ? ActionParam.StructType<TStructType>\n : APD[\"type\"] extends keyof DataValueClientToWire\n ? ActionParam.PrimitiveType<APD[\"type\"]>\n : never;\n\ntype MaybeArrayType<APD extends ActionMetadata.Parameter<any>> =\n APD[\"multiplicity\"] extends true ? Array<BaseType<APD>>\n : BaseType<APD>;\n\ntype NotOptionalParams<X extends ActionParametersDefinition> = {\n [P in keyof X]: MaybeArrayType<X[P]>;\n};\n\nexport type OsdkActionParameters<\n X extends ActionParametersDefinition,\n> = NullableProps<X> extends never ? NotOptionalParams<X>\n : PartialBy<NotOptionalParams<X>, NullableProps<X>>;\n\nexport type CompileTimeActionMetadata<\n T extends ActionDefinition<any>,\n> = NonNullable<T[\"__DefinitionMetadata\"]>;\n\nexport type ActionSignatureFromDef<\n T extends ActionDefinition<any>,\n> = {\n applyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"]] extends [never]\n ? ActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"];\n\n batchApplyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"]] extends\n [never] ? BatchActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"];\n};\n\ntype ActionParametersDefinition = Record<\n any,\n ActionMetadata.Parameter<any>\n>;\n\nexport type ActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>,\n OP extends ApplyActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport type BatchActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>[],\n OP extends ApplyBatchActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport async function applyAction<\n AD extends ActionDefinition<any>,\n P extends\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n Op extends P extends OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >[] ? ApplyBatchActionOptions\n : ApplyActionOptions,\n>(\n client: MinimalClient,\n action: AD,\n parameters?: P,\n options: Op = {} as Op,\n): Promise<\n ActionReturnTypeForOptions<Op>\n> {\n const clientWithHeaders = addUserAgentAndRequestContextHeaders(\n augmentRequestContext(client, _ => ({ finalMethodCall: \"applyAction\" })),\n action,\n );\n if (Array.isArray(parameters)) {\n const response = await OntologiesV2.Actions.applyBatch(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n requests: parameters\n ? await remapBatchActionParams(parameters, client)\n : [],\n options: {\n returnEdits: options?.$returnEdits ? \"ALL\" : \"NONE\",\n },\n },\n );\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n } else {\n const response = await OntologiesV2.Actions.apply(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n parameters: await remapActionParams(\n parameters as OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >,\n client,\n ),\n options: {\n mode: (options as ApplyActionOptions)?.$validateOnly\n ? \"VALIDATE_ONLY\"\n : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options\n ?.$returnEdits\n ? \"ALL_V2_WITH_DELETIONS\"\n : \"NONE\",\n },\n },\n );\n\n if ((options as ApplyActionOptions)?.$validateOnly) {\n return response.validation as ActionReturnTypeForOptions<Op>;\n }\n\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n }\n}\n\nasync function remapActionParams<AD extends ActionDefinition<any>>(\n params:\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | undefined,\n client: MinimalClient,\n): Promise<Record<string, DataValue>> {\n if (params == null) {\n return {};\n }\n\n const parameterMap: { [parameterName: string]: unknown } = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValue(value, client);\n }\n\n return parameterMap;\n}\n\nasync function remapBatchActionParams<\n AD extends ActionDefinition<any>,\n>(\n params: OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n client: MinimalClient,\n) {\n const remappedParams = await Promise.all(params.map(\n async param => {\n return { parameters: await remapActionParams<AD>(param, client) };\n },\n ));\n\n return remappedParams;\n}\n\nexport function remapActionResponse(\n response: SyncApplyActionResponseV2 | BatchApplyActionResponseV2,\n): ActionEditResponse | undefined {\n const editResponses = response?.edits;\n if (editResponses?.type === \"edits\") {\n const remappedActionResponse: ActionEditResponse = {\n type: editResponses.type,\n deletedLinksCount: editResponses.deletedLinksCount,\n deletedObjectsCount: editResponses.deletedObjectsCount,\n addedLinks: [],\n deletedLinks: [],\n addedObjects: [],\n deletedObjects: [],\n modifiedObjects: [],\n editedObjectTypes: [],\n };\n\n const editedObjectTypesSet = new Set<string>();\n for (const edit of editResponses.edits) {\n if (edit.type === \"addLink\" || edit.type === \"deleteLink\") {\n const osdkEdit = {\n linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,\n linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,\n aSideObject: edit.aSideObject,\n bSideObject: edit.bSideObject,\n };\n edit.type === \"addLink\"\n ? remappedActionResponse.addedLinks.push(\n osdkEdit,\n )\n : remappedActionResponse.deletedLinks?.push(osdkEdit);\n editedObjectTypesSet.add(edit.aSideObject.objectType);\n editedObjectTypesSet.add(edit.bSideObject.objectType);\n } else if (\n edit.type === \"addObject\" || edit.type === \"deleteObject\"\n || edit.type === \"modifyObject\"\n ) {\n const osdkEdit = {\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n };\n if (edit.type === \"addObject\") {\n remappedActionResponse.addedObjects.push(osdkEdit);\n } else if (edit.type === \"deleteObject\") {\n remappedActionResponse.deletedObjects?.push(osdkEdit);\n } else if (edit.type === \"modifyObject\") {\n remappedActionResponse.modifiedObjects.push(osdkEdit);\n }\n editedObjectTypesSet.add(edit.objectType);\n } else {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n `Unexpected edit type: ${JSON.stringify(edit)}`,\n );\n }\n }\n }\n remappedActionResponse.editedObjectTypes = [...editedObjectTypesSet];\n return remappedActionResponse;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAiBA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AAExD,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,qBAAqB,QAAQ,kCAAkC;AAIxE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,qBAAqB,QAAQ,4BAA4B;AAyElE,OAAO,eAAeC,WAAWA,CAU/BC,MAAqB,EACrBC,MAAU,EACVC,UAAc,EACdC,OAAW,GAAG,CAAC,CAAO,EAGtB;EACA,MAAMC,iBAAiB,GAAGT,oCAAoC,CAC5DC,qBAAqB,CAACI,MAAM,EAAE,OAAM;IAAEK,eAAe,EAAE;EAAc,CAAC,CAAC,CAAC,EACxEJ,MACF,CAAC;EACD,IAAIK,KAAK,CAACC,OAAO,CAACL,UAAU,CAAC,EAAE;IAC7B,MAAMM,QAAQ,GAAG,MAAMd,YAAY,CAACe,OAAO,CAACC,UAAU,CACpDN,iBAAiB,EACjB,MAAMJ,MAAM,CAACW,WAAW,EACxBV,MAAM,CAACW,OAAO,EACd;MACEC,QAAQ,EAAEX,UAAU,GAChB,MAAMY,sBAAsB,CAACZ,UAAU,EAAEF,MAAM,CAAC,GAChD,EAAE;MACNG,OAAO,EAAE;QACPY,WAAW,EAAEZ,OAAO,EAAEa,YAAY,GAAG,KAAK,GAAG;MAC/C;IACF,CACF,CAAC;IAED,MAAMC,KAAK,GAAGT,QAAQ,CAACS,KAAK;IAC5B,OAAQd,OAAO,EAAEa,YAAY,GACzBC,KAAK,EAAEC,IAAI,KAAK,OAAO,GAAGC,mBAAmB,CAACX,QAAQ,CAAC,GAAGS,KAAK,GAC/DG,SAAS;EACf,CAAC,MAAM;IACL,MAAMZ,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AQ,CAAC;QACvDH,oBAAoB,CAACS,GAAG,CAACP,IAAI,CAACI,WAAW,CAACI,UAAU,CAAC;QACrDV,oBAAoB,CAACS,GAAG,CAACP,IAAI,CAACK,WAAW,CAACG,UAAU,CAAC;MACvD,CAAC,MAAM,IACLR,IAAI,CAAChC,IAAI,KAAK,WAAW,IAAIgC,IAAI,CAAChC,IAAI,KAAK,cAAc,IACtDgC,IAAI,CAAChC,IAAI,KAAK,cAAc,EAC/B;QACA,MAAMiC,QAAQ,GAAG;UACfO,UAAU,EAAER,IAAI,CAACQ,UAAU;UAC3BC,UAAU,EAAET,IAAI,CAACS;QACnB,CAAC;QACD,IAAIT,IAAI,CAAChC,IAAI,KAAK,WAAW,EAAE;UAC7BqB,sBAAsB,CAACK,YAAY,CAACY,IAAI,CAACL,QAAQ,CAAC;QACpD,CAAC,MAAM,IAAID,IAAI,CAAChC,IAAI,KAAK,cAAc,EAAE;UACvCqB,sBAAsB,CAACM,cAAc,EAAEW,IAAI,CAACL,QAAQ,CAAC;QACvD,CAAC,MAAM,IAAID,IAAI,CAAChC,IAAI,KAAK,cAAc,EAAE;UACvCqB,sBAAsB,CAACO,eAAe,CAACU,IAAI,CAACL,QAAQ,CAAC;QACvD;QACAH,oBAAoB,CAACS,GAAG,CAACP,IAAI,CAACQ,UAAU,CAAC;MAC3C,CAAC,MAAM;QACL,IAAIE,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;UACzC;UACAC,OAAO,CAACC,IAAI,CACV,yBAAyBC,IAAI,CAACC,SAAS,CAAChB,IAAI,CAAC,EAC/C,CAAC;QACH;MACF;IACF;IACAX,sBAAsB,CAACQ,iBAAiB,GAAG,CAAC,GAAGC,oBAAoB,CAAC;IACpE,OAAOT,sBAAsB;EAC/B;AACF","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"applyAction.js","names":["OntologiesV2","addUserAgentAndRequestContextHeaders","augmentRequestContext","toDataValue","ActionValidationError","applyAction","client","action","parameters","options","clientWithHeaders","finalMethodCall","Array","isArray","response","Actions","applyBatch","ontologyRid","apiName","requests","remapBatchActionParams","returnEdits","$returnEdits","edits","type","remapActionResponse","undefined","apply","remapActionParams","mode","$validateOnly","validation","result","params","parameterMap","key","value","Object","entries","remappedParams","Promise","all","map","param","editResponses","remappedActionResponse","deletedLinksCount","deletedObjectsCount","addedLinks","deletedLinks","addedObjects","deletedObjects","modifiedObjects","editedObjectTypes","editedObjectTypesSet","Set","edit","osdkEdit","linkTypeApiNameAtoB","linkTypeApiNameBtoA","aSideObject","bSideObject","push","add","objectType","primaryKey","process","env","NODE_ENV","console","warn","JSON","stringify"],"sources":["applyAction.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n CompileTimeMetadata as CompileTimeActionMetadata,\n DataValueClientToWire,\n} from \"@osdk/api\";\nimport type {\n BatchApplyActionResponseV2,\n DataValue,\n SyncApplyActionResponseV2,\n} from \"@osdk/foundry.ontologies\";\nimport * as OntologiesV2 from \"@osdk/foundry.ontologies\";\nimport type { MinimalClient } from \"../MinimalClientContext.js\";\nimport { addUserAgentAndRequestContextHeaders } from \"../util/addUserAgentAndRequestContextHeaders.js\";\nimport { augmentRequestContext } from \"../util/augmentRequestContext.js\";\nimport type { NOOP } from \"../util/NOOP.js\";\nimport type { NullableProps } from \"../util/NullableProps.js\";\nimport type { PartialBy } from \"../util/partialBy.js\";\nimport { toDataValue } from \"../util/toDataValue.js\";\nimport { ActionValidationError } from \"./ActionValidationError.js\";\n\ntype BaseType<APD extends Pick<ActionMetadata.Parameter<any>, \"type\">> =\n APD[\"type\"] extends ActionMetadata.DataType.Object<infer TTargetType>\n ? ActionParam.ObjectType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.ObjectSet<infer TTargetType>\n ? ActionParam.ObjectSetType<TTargetType>\n : APD[\"type\"] extends ActionMetadata.DataType.Struct<infer TStructType>\n ? ActionParam.StructType<TStructType>\n : APD[\"type\"] extends keyof DataValueClientToWire\n ? ActionParam.PrimitiveType<APD[\"type\"]>\n : never;\n\ntype MaybeArrayType<APD extends ActionMetadata.Parameter<any>> =\n APD[\"multiplicity\"] extends true ? Array<BaseType<APD>>\n : BaseType<APD>;\n\ntype NotOptionalParams<X extends ActionParametersDefinition> = {\n [P in keyof X]: MaybeArrayType<X[P]>;\n};\n\nexport type OsdkActionParameters<\n X extends ActionParametersDefinition,\n> = NullableProps<X> extends never ? NotOptionalParams<X>\n : PartialBy<NotOptionalParams<X>, NullableProps<X>>;\n\nexport type ActionSignatureFromDef<\n T extends ActionDefinition<any>,\n> = {\n applyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"]] extends [never]\n ? ActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"applyAction\"];\n\n batchApplyAction:\n [CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"]] extends\n [never] ? BatchActionSignature<CompileTimeActionMetadata<T>[\"parameters\"]>\n : CompileTimeActionMetadata<T>[\"signatures\"][\"batchApplyAction\"];\n};\n\ntype ActionParametersDefinition = Record<\n any,\n ActionMetadata.Parameter<any>\n>;\n\nexport type ActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>,\n OP extends ApplyActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport type BatchActionSignature<\n X extends Record<any, ActionMetadata.Parameter<any>>,\n> = <\n A extends NOOP<OsdkActionParameters<X>>[],\n OP extends ApplyBatchActionOptions,\n>(\n args: A,\n options?: OP,\n) => Promise<\n ActionReturnTypeForOptions<OP>\n>;\n\nexport async function applyAction<\n AD extends ActionDefinition<any>,\n P extends\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n Op extends P extends OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >[] ? ApplyBatchActionOptions\n : ApplyActionOptions,\n>(\n client: MinimalClient,\n action: AD,\n parameters?: P,\n options: Op = {} as Op,\n): Promise<\n ActionReturnTypeForOptions<Op>\n> {\n const clientWithHeaders = addUserAgentAndRequestContextHeaders(\n augmentRequestContext(client, _ => ({ finalMethodCall: \"applyAction\" })),\n action,\n );\n if (Array.isArray(parameters)) {\n const response = await OntologiesV2.Actions.applyBatch(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n requests: parameters\n ? await remapBatchActionParams(parameters, client)\n : [],\n options: {\n returnEdits: options?.$returnEdits ? \"ALL\" : \"NONE\",\n },\n },\n );\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n } else {\n const response = await OntologiesV2.Actions.apply(\n clientWithHeaders,\n await client.ontologyRid,\n action.apiName,\n {\n parameters: await remapActionParams(\n parameters as OsdkActionParameters<\n CompileTimeActionMetadata<AD>[\"parameters\"]\n >,\n client,\n ),\n options: {\n mode: (options as ApplyActionOptions)?.$validateOnly\n ? \"VALIDATE_ONLY\"\n : \"VALIDATE_AND_EXECUTE\",\n returnEdits: options\n ?.$returnEdits\n ? \"ALL_V2_WITH_DELETIONS\"\n : \"NONE\",\n },\n },\n );\n\n if ((options as ApplyActionOptions)?.$validateOnly) {\n return response.validation as ActionReturnTypeForOptions<Op>;\n }\n\n if (response.validation?.result === \"INVALID\") {\n throw new ActionValidationError(response.validation);\n }\n\n const edits = response.edits;\n return (options?.$returnEdits\n ? edits?.type === \"edits\" ? remapActionResponse(response) : edits\n : undefined) as ActionReturnTypeForOptions<Op>;\n }\n}\n\nasync function remapActionParams<AD extends ActionDefinition<any>>(\n params:\n | OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>\n | undefined,\n client: MinimalClient,\n): Promise<Record<string, DataValue>> {\n if (params == null) {\n return {};\n }\n\n const parameterMap: { [parameterName: string]: unknown } = {};\n for (const [key, value] of Object.entries(params)) {\n parameterMap[key] = await toDataValue(value, client);\n }\n\n return parameterMap;\n}\n\nasync function remapBatchActionParams<\n AD extends ActionDefinition<any>,\n>(\n params: OsdkActionParameters<CompileTimeActionMetadata<AD>[\"parameters\"]>[],\n client: MinimalClient,\n) {\n const remappedParams = await Promise.all(params.map(\n async param => {\n return { parameters: await remapActionParams<AD>(param, client) };\n },\n ));\n\n return remappedParams;\n}\n\nexport function remapActionResponse(\n response: SyncApplyActionResponseV2 | BatchApplyActionResponseV2,\n): ActionEditResponse | undefined {\n const editResponses = response?.edits;\n if (editResponses?.type === \"edits\") {\n const remappedActionResponse: ActionEditResponse = {\n type: editResponses.type,\n deletedLinksCount: editResponses.deletedLinksCount,\n deletedObjectsCount: editResponses.deletedObjectsCount,\n addedLinks: [],\n deletedLinks: [],\n addedObjects: [],\n deletedObjects: [],\n modifiedObjects: [],\n editedObjectTypes: [],\n };\n\n const editedObjectTypesSet = new Set<string>();\n for (const edit of editResponses.edits) {\n if (edit.type === \"addLink\" || edit.type === \"deleteLink\") {\n const osdkEdit = {\n linkTypeApiNameAtoB: edit.linkTypeApiNameAtoB,\n linkTypeApiNameBtoA: edit.linkTypeApiNameBtoA,\n aSideObject: edit.aSideObject,\n bSideObject: edit.bSideObject,\n };\n edit.type === \"addLink\"\n ? remappedActionResponse.addedLinks.push(\n osdkEdit,\n )\n : remappedActionResponse.deletedLinks?.push(osdkEdit);\n editedObjectTypesSet.add(edit.aSideObject.objectType);\n editedObjectTypesSet.add(edit.bSideObject.objectType);\n } else if (\n edit.type === \"addObject\" || edit.type === \"deleteObject\"\n || edit.type === \"modifyObject\"\n ) {\n const osdkEdit = {\n objectType: edit.objectType,\n primaryKey: edit.primaryKey,\n };\n if (edit.type === \"addObject\") {\n remappedActionResponse.addedObjects.push(osdkEdit);\n } else if (edit.type === \"deleteObject\") {\n remappedActionResponse.deletedObjects?.push(osdkEdit);\n } else if (edit.type === \"modifyObject\") {\n remappedActionResponse.modifiedObjects.push(osdkEdit);\n }\n editedObjectTypesSet.add(edit.objectType);\n } else {\n if (process.env.NODE_ENV !== \"production\") {\n // eslint-disable-next-line no-console\n console.warn(\n `Unexpected edit type: ${JSON.stringify(edit)}`,\n );\n }\n }\n }\n remappedActionResponse.editedObjectTypes = [...editedObjectTypesSet];\n return remappedActionResponse;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAkBA,OAAO,KAAKA,YAAY,MAAM,0BAA0B;AAExD,SAASC,oCAAoC,QAAQ,iDAAiD;AACtG,SAASC,qBAAqB,QAAQ,kCAAkC;AAIxE,SAASC,WAAW,QAAQ,wBAAwB;AACpD,SAASC,qBAAqB,QAAQ,4BAA4B;AAqElE,OAAO,eAAeC,WAAWA,CAU/BC,MAAqB,EACrBC,MAAU,EACVC,UAAc,EACdC,OAAW,GAAG,CAAC,CAAO,EAGtB;EACA,MAAMC,iBAAiB,GAAGT,oCAAoC,CAC5DC,qBAAqB,CAACI,MAAM,EAAE,OAAM;IAAEK,eAAe,EAAE;EAAc,CAAC,CAAC,CAAC,EACxEJ,MACF,CAAC;EACD,IAAIK,KAAK,CAACC,OAAO,CAACL,UAAU,CAAC,EAAE;IAC7B,MAAMM,QAAQ,GAAG,MAAMd,YAAY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U,IAAI,CAACL,QAAQ,CAAC;QACvD;QACAH,oBAAoB,CAACS,GAAG,CAACP,IAAI,CAACQ,UAAU,CAAC;MAC3C,CAAC,MAAM;QACL,IAAIE,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;UACzC;UACAC,OAAO,CAACC,IAAI,CACV,yBAAyBC,IAAI,CAACC,SAAS,CAAChB,IAAI,CAAC,EAC/C,CAAC;QACH;MACF;IACF;IACAX,sBAAsB,CAACQ,iBAAiB,GAAG,CAAC,GAAGC,oBAAoB,CAAC;IACpE,OAAOT,sBAAsB;EAC/B;AACF","ignoreList":[]}
|
|
@@ -22,6 +22,7 @@ import { applyAction } from "./actions/applyAction.js";
|
|
|
22
22
|
import { additionalContext } from "./Client.js";
|
|
23
23
|
import { createMinimalClient } from "./createMinimalClient.js";
|
|
24
24
|
import { fetchMetadataInternal } from "./fetchMetadata.js";
|
|
25
|
+
import { MinimalLogger } from "./logger/MinimalLogger.js";
|
|
25
26
|
import { fetchPage } from "./object/fetchPage.js";
|
|
26
27
|
import { fetchSingle } from "./object/fetchSingle.js";
|
|
27
28
|
import { createObjectSet } from "./objectSet/createObjectSet.js";
|
|
@@ -68,7 +69,10 @@ baseUrl, ontologyRid, tokenProvider, options = undefined, fetchFn = fetch) {
|
|
|
68
69
|
}
|
|
69
70
|
const clientCtx = createMinimalClient({
|
|
70
71
|
ontologyRid
|
|
71
|
-
}, baseUrl, tokenProvider,
|
|
72
|
+
}, baseUrl, tokenProvider, {
|
|
73
|
+
...options,
|
|
74
|
+
logger: options?.logger ?? new MinimalLogger()
|
|
75
|
+
}, fetchFn, objectSetFactory);
|
|
72
76
|
const fetchMetadata = fetchMetadataInternal.bind(undefined, clientCtx);
|
|
73
77
|
const client = Object.defineProperties(function (o) {
|
|
74
78
|
if (o.type === "object" || o.type === "interface") {
|