@osdk/client 2.2.0-beta.9 → 2.3.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +370 -0
- package/build/browser/MinimalClientContext.js.map +1 -1
- package/build/browser/__unstable/ConjureSupport.js.map +1 -1
- package/build/browser/actions/ActionValidationError.js +1 -1
- package/build/browser/actions/ActionValidationError.js.map +1 -1
- package/build/browser/actions/actions.test.js +134 -89
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.js +5 -1
- package/build/browser/createClient.js.map +1 -1
- package/build/browser/createClient.test.js +14 -6
- package/build/browser/createClient.test.js.map +1 -1
- package/build/browser/createMinimalClient.js.map +1 -1
- package/build/browser/createMinimalClientHelper.js +25 -0
- package/build/browser/createMinimalClientHelper.js.map +1 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js +36 -13
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +133 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
- package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js +93 -0
- package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
- package/build/browser/fetchMetadata.js +1 -1
- package/build/browser/fetchMetadata.js.map +1 -1
- package/build/browser/fetchMetadata.test.js +11 -9
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/index.js +0 -1
- package/build/browser/index.js.map +1 -1
- package/build/{esm/util/isOsdkBaseObject.js → browser/intellisense.test.helpers/showsObjectPropertyJsdoc.js} +9 -4
- package/build/browser/intellisense.test.helpers/showsObjectPropertyJsdoc.js.map +1 -0
- package/build/browser/intellisense.test.js +17 -1
- package/build/browser/intellisense.test.js.map +1 -1
- package/build/browser/logger/BaseLogger.js +59 -0
- package/build/browser/logger/BaseLogger.js.map +1 -0
- package/build/browser/logger/BrowserLogger.js +67 -0
- package/build/browser/logger/BrowserLogger.js.map +1 -0
- package/build/browser/logger/MinimalLogger.js +39 -0
- package/build/browser/logger/MinimalLogger.js.map +1 -0
- package/build/browser/logger/MinimalLogger.test.js +60 -0
- package/build/browser/logger/MinimalLogger.test.js.map +1 -0
- package/build/browser/logger/TestLogger.js +56 -0
- package/build/browser/logger/TestLogger.js.map +1 -0
- package/build/browser/object/attachment.test.js +20 -7
- package/build/browser/object/attachment.test.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +4 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +44 -33
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +4 -14
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +39 -33
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.js +4 -3
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/object/geotimeseriesreference.test.js +56 -134
- package/build/browser/object/geotimeseriesreference.test.js.map +1 -1
- package/build/browser/object/media.test.js +19 -14
- package/build/browser/object/media.test.js.map +1 -1
- package/build/browser/object/object.test.js +96 -89
- package/build/browser/object/object.test.js.map +1 -1
- package/build/browser/object/timeseries.test.js +119 -85
- package/build/browser/object/timeseries.test.js.map +1 -1
- package/build/browser/objectSet/InterfaceObjectSet.test.js +24 -20
- package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +113 -19
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +2 -2
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +19 -12
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/browser/objectSet/createObjectSet.js +2 -1
- package/build/browser/objectSet/createObjectSet.js.map +1 -1
- package/build/browser/observable/internal/ActionApplication.js +4 -4
- package/build/browser/observable/internal/ActionApplication.js.map +1 -1
- package/build/browser/observable/internal/BulkObjectLoader.js +93 -0
- package/build/browser/observable/internal/BulkObjectLoader.js.map +1 -0
- package/build/browser/observable/internal/BulkObjectLoader.test.js +112 -0
- package/build/browser/observable/internal/BulkObjectLoader.test.js.map +1 -0
- package/build/browser/observable/internal/ListQuery.js +4 -1
- package/build/browser/observable/internal/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/ObjectQuery.js +3 -6
- package/build/browser/observable/internal/ObjectQuery.js.map +1 -1
- package/build/browser/observable/internal/OptimisticJob.js +1 -1
- package/build/browser/observable/internal/OptimisticJob.js.map +1 -1
- package/build/browser/observable/internal/Query.js.map +1 -1
- package/build/browser/observable/internal/Store.js +2 -2
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/Store.test.js +215 -206
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/observable/internal/objectMatchesWhereClause.js +0 -2
- package/build/browser/observable/internal/objectMatchesWhereClause.js.map +1 -1
- package/build/browser/observable/internal/testUtils.js +4 -3
- package/build/browser/observable/internal/testUtils.js.map +1 -1
- package/build/browser/ontology/OntologyProvider.js.map +1 -1
- package/build/browser/ontology/StandardOntologyProvider.js +12 -5
- package/build/browser/ontology/StandardOntologyProvider.js.map +1 -1
- package/build/browser/ontology/StandardOntologyProvider.test.js +17 -16
- package/build/browser/ontology/StandardOntologyProvider.test.js.map +1 -1
- package/build/browser/ontology/loadFullObjectMetadata.js +0 -1
- package/build/browser/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/browser/ontology/loadQueryMetadata.js +5 -2
- package/build/browser/ontology/loadQueryMetadata.js.map +1 -1
- package/build/browser/public/internal.js +2 -0
- package/build/browser/public/internal.js.map +1 -1
- package/build/browser/public/unstable-do-not-use.js +1 -0
- package/build/browser/public/unstable-do-not-use.js.map +1 -1
- package/build/browser/public-utils/osdkConfig.js +49 -0
- package/build/browser/public-utils/osdkConfig.js.map +1 -0
- package/build/browser/{object/createObjectSpecifierFromPrimaryKey.js → public-utils/vite-env.d.ts} +2 -3
- package/build/browser/queries/applyQuery.js +6 -4
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +93 -27
- package/build/browser/queries/queries.test.js.map +1 -1
- package/build/browser/queries/types.js.map +1 -1
- package/build/browser/tsserver.js.map +1 -1
- package/build/browser/util/UserAgent.js +1 -1
- package/build/browser/util/extractRdpDefinition.js +140 -0
- package/build/browser/util/extractRdpDefinition.js.map +1 -0
- package/build/browser/util/extractRdpDefinition.test.js +233 -0
- package/build/browser/util/extractRdpDefinition.test.js.map +1 -0
- package/build/browser/util/{isOsdkBaseObject.js → isObjectSpecifiersObject.js} +2 -2
- package/build/browser/util/isObjectSpecifiersObject.js.map +1 -0
- package/build/browser/util/isPoint.js +20 -0
- package/build/browser/util/isPoint.js.map +1 -0
- package/build/browser/util/objectSpecifierUtils.js +48 -0
- package/build/browser/util/objectSpecifierUtils.js.map +1 -0
- package/build/browser/util/objectSpecifierUtils.test.js +42 -0
- package/build/browser/util/objectSpecifierUtils.test.js.map +1 -0
- package/build/browser/util/toDataValue.js +6 -2
- package/build/browser/util/toDataValue.js.map +1 -1
- package/build/browser/util/toDataValue.test.js +37 -16
- package/build/browser/util/toDataValue.test.js.map +1 -1
- package/build/browser/util/toDataValueQueries.js +4 -6
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/cjs/{Client-DBTcM9gB.d.cts → Client-CgL2LKN9.d.cts} +6 -7
- package/build/cjs/{chunk-MCQVHD2F.cjs → chunk-FKI2LO2O.cjs} +232 -68
- package/build/cjs/chunk-FKI2LO2O.cjs.map +1 -0
- package/build/cjs/{chunk-EY52J5Z4.cjs → chunk-W5PFESFR.cjs} +163 -34
- package/build/cjs/chunk-W5PFESFR.cjs.map +1 -0
- package/build/cjs/index.cjs +188 -166
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +4 -24
- package/build/cjs/public/internal.cjs +61 -7
- package/build/cjs/public/internal.cjs.map +1 -1
- package/build/cjs/public/internal.d.cts +50 -3
- package/build/cjs/public/unstable-do-not-use.cjs +224 -103
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +12 -3
- package/build/esm/MinimalClientContext.js.map +1 -1
- package/build/esm/__unstable/ConjureSupport.js.map +1 -1
- package/build/esm/actions/ActionValidationError.js +1 -1
- package/build/esm/actions/ActionValidationError.js.map +1 -1
- package/build/esm/actions/actions.test.js +134 -89
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.js +5 -1
- package/build/esm/createClient.js.map +1 -1
- package/build/esm/createClient.test.js +14 -6
- package/build/esm/createClient.test.js.map +1 -1
- package/build/esm/createMinimalClient.js.map +1 -1
- package/build/esm/createMinimalClientHelper.js +25 -0
- package/build/esm/createMinimalClientHelper.js.map +1 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js +36 -13
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -1
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +133 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
- package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js +93 -0
- package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
- package/build/esm/fetchMetadata.js +1 -1
- package/build/esm/fetchMetadata.js.map +1 -1
- package/build/esm/fetchMetadata.test.js +11 -9
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/index.js +0 -1
- package/build/esm/index.js.map +1 -1
- package/build/esm/{util/isOsdkObject.js → intellisense.test.helpers/showsObjectPropertyJsdoc.js} +9 -4
- package/build/esm/intellisense.test.helpers/showsObjectPropertyJsdoc.js.map +1 -0
- package/build/esm/intellisense.test.js +17 -1
- package/build/esm/intellisense.test.js.map +1 -1
- package/build/esm/logger/BaseLogger.js +59 -0
- package/build/esm/logger/BaseLogger.js.map +1 -0
- package/build/esm/logger/BrowserLogger.js +67 -0
- package/build/esm/logger/BrowserLogger.js.map +1 -0
- package/build/esm/logger/MinimalLogger.js +39 -0
- package/build/esm/logger/MinimalLogger.js.map +1 -0
- package/build/esm/logger/MinimalLogger.test.js +60 -0
- package/build/esm/logger/MinimalLogger.test.js.map +1 -0
- package/build/esm/logger/TestLogger.js +56 -0
- package/build/esm/logger/TestLogger.js.map +1 -0
- package/build/esm/object/attachment.test.js +20 -7
- package/build/esm/object/attachment.test.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +4 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +44 -33
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +4 -14
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +39 -33
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.js +4 -3
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/object/geotimeseriesreference.test.js +56 -134
- package/build/esm/object/geotimeseriesreference.test.js.map +1 -1
- package/build/esm/object/media.test.js +19 -14
- package/build/esm/object/media.test.js.map +1 -1
- package/build/esm/object/object.test.js +96 -89
- package/build/esm/object/object.test.js.map +1 -1
- package/build/esm/object/timeseries.test.js +119 -85
- package/build/esm/object/timeseries.test.js.map +1 -1
- package/build/esm/objectSet/InterfaceObjectSet.test.js +24 -20
- package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +113 -19
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +2 -2
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +19 -12
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -1
- package/build/esm/objectSet/createObjectSet.js +2 -1
- package/build/esm/objectSet/createObjectSet.js.map +1 -1
- package/build/esm/observable/internal/ActionApplication.js +4 -4
- package/build/esm/observable/internal/ActionApplication.js.map +1 -1
- package/build/esm/observable/internal/BulkObjectLoader.js +93 -0
- package/build/esm/observable/internal/BulkObjectLoader.js.map +1 -0
- package/build/esm/observable/internal/BulkObjectLoader.test.js +112 -0
- package/build/esm/observable/internal/BulkObjectLoader.test.js.map +1 -0
- package/build/esm/observable/internal/ListQuery.js +4 -1
- package/build/esm/observable/internal/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/ObjectQuery.js +3 -6
- package/build/esm/observable/internal/ObjectQuery.js.map +1 -1
- package/build/esm/observable/internal/OptimisticJob.js +1 -1
- package/build/esm/observable/internal/OptimisticJob.js.map +1 -1
- package/build/esm/observable/internal/Query.js.map +1 -1
- package/build/esm/observable/internal/Store.js +2 -2
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/Store.test.js +215 -206
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/observable/internal/objectMatchesWhereClause.js +0 -2
- package/build/esm/observable/internal/objectMatchesWhereClause.js.map +1 -1
- package/build/esm/observable/internal/testUtils.js +4 -3
- package/build/esm/observable/internal/testUtils.js.map +1 -1
- package/build/esm/ontology/OntologyProvider.js.map +1 -1
- package/build/esm/ontology/StandardOntologyProvider.js +12 -5
- package/build/esm/ontology/StandardOntologyProvider.js.map +1 -1
- package/build/esm/ontology/StandardOntologyProvider.test.js +17 -16
- package/build/esm/ontology/StandardOntologyProvider.test.js.map +1 -1
- package/build/esm/ontology/loadFullObjectMetadata.js +0 -1
- package/build/esm/ontology/loadFullObjectMetadata.js.map +1 -1
- package/build/esm/ontology/loadQueryMetadata.js +5 -2
- package/build/esm/ontology/loadQueryMetadata.js.map +1 -1
- package/build/esm/public/internal.js +2 -0
- package/build/esm/public/internal.js.map +1 -1
- package/build/esm/public/unstable-do-not-use.js +1 -0
- package/build/esm/public/unstable-do-not-use.js.map +1 -1
- package/build/esm/public-utils/osdkConfig.js +49 -0
- package/build/esm/public-utils/osdkConfig.js.map +1 -0
- package/build/esm/{object/createObjectSpecifierFromPrimaryKey.js → public-utils/vite-env.d.ts} +2 -3
- package/build/esm/queries/applyQuery.js +6 -4
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +93 -27
- package/build/esm/queries/queries.test.js.map +1 -1
- package/build/esm/queries/types.js.map +1 -1
- package/build/esm/tsserver.js.map +1 -1
- package/build/esm/util/UserAgent.js +1 -1
- package/build/esm/util/extractRdpDefinition.js +140 -0
- package/build/esm/util/extractRdpDefinition.js.map +1 -0
- package/build/esm/util/extractRdpDefinition.test.js +233 -0
- package/build/esm/util/extractRdpDefinition.test.js.map +1 -0
- package/build/{browser/util/isOsdkObject.js → esm/util/isObjectSpecifiersObject.js} +2 -2
- package/build/esm/util/isObjectSpecifiersObject.js.map +1 -0
- package/build/esm/util/isPoint.js +20 -0
- package/build/esm/util/isPoint.js.map +1 -0
- package/build/esm/util/objectSpecifierUtils.js +48 -0
- package/build/esm/util/objectSpecifierUtils.js.map +1 -0
- package/build/esm/util/objectSpecifierUtils.test.js +42 -0
- package/build/esm/util/objectSpecifierUtils.test.js.map +1 -0
- package/build/esm/util/toDataValue.js +6 -2
- package/build/esm/util/toDataValue.js.map +1 -1
- package/build/esm/util/toDataValue.test.js +37 -16
- package/build/esm/util/toDataValue.test.js.map +1 -1
- package/build/esm/util/toDataValueQueries.js +4 -6
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/build/types/MinimalClientContext.d.ts +1 -1
- package/build/types/MinimalClientContext.d.ts.map +1 -1
- package/build/types/__unstable/ConjureSupport.d.ts +2 -2
- package/build/types/actions/applyAction.d.ts +1 -2
- package/build/types/actions/applyAction.d.ts.map +1 -1
- package/build/types/createClient.d.ts +1 -1
- package/build/types/createClient.d.ts.map +1 -1
- package/build/types/createClient.test.d.ts +2 -1
- package/build/types/createClient.test.d.ts.map +1 -1
- package/build/types/createMinimalClientHelper.d.ts +1 -0
- package/build/types/createMinimalClientHelper.d.ts.map +1 -0
- package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts +1 -0
- package/build/types/derivedProperties/derivedPropertyDefinitionFactory.d.ts.map +1 -0
- package/build/types/index.d.ts +4 -6
- package/build/types/index.d.ts.map +1 -1
- package/build/types/intellisense.test.helpers/showsObjectPropertyJsdoc.d.ts +1 -0
- package/build/types/intellisense.test.helpers/showsObjectPropertyJsdoc.d.ts.map +1 -0
- package/build/types/logger/BaseLogger.d.ts +33 -0
- package/build/types/logger/BaseLogger.d.ts.map +1 -0
- package/build/types/logger/BrowserLogger.d.ts +9 -0
- package/build/types/logger/BrowserLogger.d.ts.map +1 -0
- package/build/types/logger/MinimalLogger.d.ts +9 -0
- package/build/types/logger/MinimalLogger.d.ts.map +1 -0
- package/build/types/logger/MinimalLogger.test.d.ts +1 -0
- package/build/types/logger/MinimalLogger.test.d.ts.map +1 -0
- package/build/types/logger/TestLogger.d.ts +14 -0
- package/build/types/logger/TestLogger.d.ts.map +1 -0
- package/build/types/object/convertWireToOsdkObjects.d.ts +4 -4
- package/build/types/object/convertWireToOsdkObjects.d.ts.map +1 -1
- package/build/types/object/fetchPage.d.ts.map +1 -1
- package/build/types/object/object.test.d.ts.map +1 -1
- package/build/types/objectSet/ObjectSet.test.d.ts.map +1 -1
- package/build/types/observable/internal/ActionApplication.d.ts +2 -2
- package/build/types/observable/internal/ActionApplication.d.ts.map +1 -1
- package/build/types/observable/internal/BulkObjectLoader.d.ts +8 -0
- package/build/types/observable/internal/BulkObjectLoader.d.ts.map +1 -0
- package/build/types/observable/internal/BulkObjectLoader.test.d.ts +1 -0
- package/build/types/observable/internal/BulkObjectLoader.test.d.ts.map +1 -0
- package/build/types/observable/internal/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/ObjectQuery.d.ts.map +1 -1
- package/build/types/observable/internal/OptimisticJob.d.ts.map +1 -1
- package/build/types/observable/internal/Query.d.ts +2 -2
- package/build/types/observable/internal/Query.d.ts.map +1 -1
- package/build/types/observable/internal/Store.d.ts +2 -2
- package/build/types/observable/internal/Store.d.ts.map +1 -1
- package/build/types/observable/internal/testUtils.d.ts +1 -2
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/build/types/ontology/OntologyProvider.d.ts +1 -1
- package/build/types/ontology/OntologyProvider.d.ts.map +1 -1
- package/build/types/ontology/loadQueryMetadata.d.ts +1 -1
- package/build/types/ontology/loadQueryMetadata.d.ts.map +1 -1
- package/build/types/public/internal.d.ts +2 -0
- package/build/types/public/internal.d.ts.map +1 -1
- package/build/types/public/unstable-do-not-use.d.ts +4 -2
- package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
- package/build/types/public-utils/osdkConfig.d.ts +8 -0
- package/build/types/public-utils/osdkConfig.d.ts.map +1 -0
- package/build/types/public-utils/vite-env.d.d.ts +3 -0
- package/build/types/public-utils/vite-env.d.d.ts.map +1 -0
- package/build/types/queries/applyQuery.d.ts +2 -2
- package/build/types/queries/applyQuery.d.ts.map +1 -1
- package/build/types/queries/types.d.ts +1 -1
- package/build/types/queries/types.d.ts.map +1 -1
- package/build/types/tsserver.d.ts +1 -1
- package/build/types/tsserver.d.ts.map +1 -1
- package/build/types/util/extractRdpDefinition.d.ts +4 -0
- package/build/types/util/extractRdpDefinition.d.ts.map +1 -0
- package/build/types/util/extractRdpDefinition.test.d.ts +1 -0
- package/build/types/util/extractRdpDefinition.test.d.ts.map +1 -0
- package/build/types/util/isObjectSpecifiersObject.d.ts +5 -0
- package/build/types/util/isObjectSpecifiersObject.d.ts.map +1 -0
- package/build/types/util/isPoint.d.ts +1 -0
- package/build/types/util/isPoint.d.ts.map +1 -0
- package/build/types/util/objectSpecifierUtils.d.ts +24 -0
- package/build/types/util/objectSpecifierUtils.d.ts.map +1 -0
- package/build/types/util/objectSpecifierUtils.test.d.ts +1 -0
- package/build/types/util/objectSpecifierUtils.test.d.ts.map +1 -0
- package/package.json +19 -18
- package/build/browser/Logger.js +0 -2
- package/build/browser/Logger.js.map +0 -1
- package/build/browser/object/createObjectSpecifierFromPrimaryKey.js.map +0 -1
- package/build/browser/util/isOsdkBaseObject.js.map +0 -1
- package/build/browser/util/isOsdkObject.js.map +0 -1
- package/build/cjs/chunk-EY52J5Z4.cjs.map +0 -1
- package/build/cjs/chunk-MCQVHD2F.cjs.map +0 -1
- package/build/cjs/chunk-Q7SFCCGT.cjs +0 -11
- package/build/cjs/chunk-Q7SFCCGT.cjs.map +0 -1
- package/build/cjs/graphql-RGM5SRWV.cjs +0 -10532
- package/build/cjs/graphql-RGM5SRWV.cjs.map +0 -1
- package/build/esm/Logger.js +0 -2
- package/build/esm/Logger.js.map +0 -1
- package/build/esm/object/createObjectSpecifierFromPrimaryKey.js.map +0 -1
- package/build/esm/util/isOsdkBaseObject.js.map +0 -1
- package/build/esm/util/isOsdkObject.js.map +0 -1
- package/build/types/Logger.d.ts +0 -17
- package/build/types/Logger.d.ts.map +0 -1
- package/build/types/object/createObjectSpecifierFromPrimaryKey.d.ts +0 -2
- package/build/types/object/createObjectSpecifierFromPrimaryKey.d.ts.map +0 -1
- package/build/types/util/isOsdkBaseObject.d.ts +0 -2
- package/build/types/util/isOsdkBaseObject.d.ts.map +0 -1
- package/build/types/util/isOsdkObject.d.ts +0 -2
- package/build/types/util/isOsdkObject.d.ts.map +0 -1
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import invariant from "tiny-invariant";
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export function derivedPropertyDefinitionFactory(wireDefinition, definitionMap) {
|
|
21
|
+
const definition = {
|
|
22
|
+
abs() {
|
|
23
|
+
return derivedPropertyDefinitionFactory({
|
|
24
|
+
type: "absoluteValue",
|
|
25
|
+
property: wireDefinition
|
|
26
|
+
}, definitionMap);
|
|
27
|
+
},
|
|
28
|
+
negate() {
|
|
29
|
+
return derivedPropertyDefinitionFactory({
|
|
30
|
+
type: "negate",
|
|
31
|
+
property: wireDefinition
|
|
32
|
+
}, definitionMap);
|
|
33
|
+
},
|
|
34
|
+
max(value) {
|
|
35
|
+
return derivedPropertyDefinitionFactory({
|
|
36
|
+
type: "greatest",
|
|
37
|
+
properties: [wireDefinition, getDefinitionFromMap(value, definitionMap)]
|
|
38
|
+
}, definitionMap);
|
|
39
|
+
},
|
|
40
|
+
min(value) {
|
|
41
|
+
return derivedPropertyDefinitionFactory({
|
|
42
|
+
type: "least",
|
|
43
|
+
properties: [wireDefinition, getDefinitionFromMap(value, definitionMap)]
|
|
44
|
+
}, definitionMap);
|
|
45
|
+
},
|
|
46
|
+
add(value) {
|
|
47
|
+
return derivedPropertyDefinitionFactory({
|
|
48
|
+
type: "add",
|
|
49
|
+
properties: [wireDefinition, getDefinitionFromMap(value, definitionMap)]
|
|
50
|
+
}, definitionMap);
|
|
51
|
+
},
|
|
52
|
+
subtract(value) {
|
|
53
|
+
return derivedPropertyDefinitionFactory({
|
|
54
|
+
"type": "subtract",
|
|
55
|
+
"left": wireDefinition,
|
|
56
|
+
"right": getDefinitionFromMap(value, definitionMap)
|
|
57
|
+
}, definitionMap);
|
|
58
|
+
},
|
|
59
|
+
multiply(value) {
|
|
60
|
+
return derivedPropertyDefinitionFactory({
|
|
61
|
+
type: "multiply",
|
|
62
|
+
properties: [wireDefinition, getDefinitionFromMap(value, definitionMap)]
|
|
63
|
+
}, definitionMap);
|
|
64
|
+
},
|
|
65
|
+
divide(value) {
|
|
66
|
+
return derivedPropertyDefinitionFactory({
|
|
67
|
+
"type": "subtract",
|
|
68
|
+
"left": wireDefinition,
|
|
69
|
+
"right": getDefinitionFromMap(value, definitionMap)
|
|
70
|
+
}, definitionMap);
|
|
71
|
+
},
|
|
72
|
+
extractPart: part => {
|
|
73
|
+
return derivedPropertyDefinitionFactory({
|
|
74
|
+
type: "extract",
|
|
75
|
+
part,
|
|
76
|
+
property: wireDefinition
|
|
77
|
+
}, definitionMap);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
definitionMap.set(definition, wireDefinition);
|
|
81
|
+
return definition;
|
|
82
|
+
}
|
|
83
|
+
const getDefinitionFromMap = (arg, definitionMap) => {
|
|
84
|
+
if (typeof arg === "object") {
|
|
85
|
+
const definition = definitionMap.get(arg);
|
|
86
|
+
!definition ? process.env.NODE_ENV !== "production" ? invariant(false, "Derived Property is not defined") : invariant(false) : void 0;
|
|
87
|
+
return definition;
|
|
88
|
+
} else if (typeof arg === "number") {
|
|
89
|
+
process.env.NODE_ENV !== "production" ? invariant(false, "Literals for derived properties are not yet supported") : invariant(false);
|
|
90
|
+
}
|
|
91
|
+
process.env.NODE_ENV !== "production" ? invariant(false, "Invalid argument type for a derived property") : invariant(false);
|
|
92
|
+
};
|
|
93
|
+
//# sourceMappingURL=derivedPropertyDefinitionFactory.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"derivedPropertyDefinitionFactory.js","names":["invariant","derivedPropertyDefinitionFactory","wireDefinition","definitionMap","definition","abs","type","property","negate","max","value","properties","getDefinitionFromMap","min","add","subtract","multiply","divide","extractPart","part","set","arg","get","process","env","NODE_ENV"],"sources":["derivedPropertyDefinitionFactory.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { DerivedProperty } from \"@osdk/api\";\nimport type { DerivedPropertyDefinition } from \"@osdk/foundry.ontologies\";\nimport invariant from \"tiny-invariant\";\n\n/** @internal */\nexport function derivedPropertyDefinitionFactory(\n wireDefinition: DerivedPropertyDefinition,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n): DerivedProperty.NumericPropertyDefinition<any, any> & {\n extractPart: DerivedProperty.DatetimePropertyDefinition<\n any,\n any\n >[\"extractPart\"];\n} {\n type RemoveSymbolKeys<T> = {\n [K in keyof T as K extends symbol ? never : K]: T[K];\n };\n\n const definition:\n & RemoveSymbolKeys<DerivedProperty.NumericPropertyDefinition<any, any>>\n & {\n extractPart: DerivedProperty.DatetimePropertyDefinition<\n any,\n any\n >[\"extractPart\"];\n } = {\n abs() {\n return derivedPropertyDefinitionFactory({\n type: \"absoluteValue\",\n property: wireDefinition,\n }, definitionMap);\n },\n negate() {\n return derivedPropertyDefinitionFactory({\n type: \"negate\",\n property: wireDefinition,\n }, definitionMap);\n },\n max(value) {\n return derivedPropertyDefinitionFactory({\n type: \"greatest\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n min(value) {\n return derivedPropertyDefinitionFactory({\n type: \"least\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n add(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n type: \"add\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n subtract(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n \"type\": \"subtract\",\n \"left\": wireDefinition,\n \"right\": getDefinitionFromMap(value, definitionMap),\n }, definitionMap);\n },\n multiply(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n type: \"multiply\",\n properties: [\n wireDefinition,\n getDefinitionFromMap(value, definitionMap),\n ],\n }, definitionMap);\n },\n divide(\n value,\n ) {\n return derivedPropertyDefinitionFactory({\n \"type\": \"subtract\",\n \"left\": wireDefinition,\n \"right\": getDefinitionFromMap(value, definitionMap),\n }, definitionMap);\n },\n extractPart: (part) => {\n return derivedPropertyDefinitionFactory({\n type: \"extract\",\n part,\n property: wireDefinition,\n }, definitionMap);\n },\n };\n\n definitionMap.set(definition, wireDefinition);\n return definition as any;\n}\n\nconst getDefinitionFromMap = (\n arg: string | number | DerivedProperty.Definition<any, any>,\n definitionMap: Map<any, DerivedPropertyDefinition>,\n): DerivedPropertyDefinition => {\n if (typeof arg === \"object\") {\n const definition = definitionMap.get(arg);\n invariant(definition, \"Derived Property is not defined\");\n return definition;\n } else if (typeof arg === \"number\") {\n invariant(false, \"Literals for derived properties are not yet supported\");\n }\n invariant(false, \"Invalid argument type for a derived property\");\n};\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -29,7 +29,7 @@ export const fetchMetadataInternal = async (client, definition) => {
|
|
|
29
29
|
} else if (definition.type === "action") {
|
|
30
30
|
return client.ontologyProvider.getActionDefinition(definition.apiName);
|
|
31
31
|
} else if (definition.type === "query") {
|
|
32
|
-
return client.ontologyProvider.getQueryDefinition(definition.apiName);
|
|
32
|
+
return client.ontologyProvider.getQueryDefinition(definition.apiName, definition.isFixedVersion ? definition.version : undefined);
|
|
33
33
|
} else {
|
|
34
34
|
throw new Error("Not implemented for given definition");
|
|
35
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchMetadata.js","names":["InterfaceDefinitions","fetchMetadataInternal","client","definition","type","interfaceDefs","objectTypeDef","ontologyProvider","getObjectDefinition","apiName","getInterfaceDefinition","getActionDefinition","getQueryDefinition","Error"],"sources":["fetchMetadata.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n} from \"@osdk/api\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { InterfaceDefinitions } from \"./ontology/OntologyProvider.js\";\n\n/** @internal */\nexport const fetchMetadataInternal = async <\n Q extends (\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n ),\n>(\n client: MinimalClient,\n definition: Q,\n): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? QueryMetadata\n : never\n> => {\n if (definition.type === \"object\") {\n const { [InterfaceDefinitions]: interfaceDefs, ...objectTypeDef } =\n await client.ontologyProvider\n .getObjectDefinition(definition.apiName);\n return objectTypeDef as any;\n } else if (definition.type === \"interface\") {\n return client.ontologyProvider.getInterfaceDefinition(\n definition.apiName,\n ) as any;\n } else if (definition.type === \"action\") {\n return client.ontologyProvider.getActionDefinition(\n definition.apiName,\n ) as any;\n } else if (definition.type === \"query\") {\n return client.ontologyProvider.getQueryDefinition(\n definition.apiName,\n ) as any;\n } else {\n throw new Error(\"Not implemented for given definition\");\n }\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,SAASA,oBAAoB,QAAQ,gCAAgC;;AAErE;AACA,OAAO,MAAMC,qBAAqB,GAAG,MAAAA,CAQnCC,MAAqB,EACrBC,UAAa,KAOV;EACH,IAAIA,UAAU,CAACC,IAAI,KAAK,QAAQ,EAAE;IAChC,MAAM;MAAE,CAACJ,oBAAoB,GAAGK,aAAa;MAAE,GAAGC;IAAc,CAAC,GAC/D,MAAMJ,MAAM,CAACK,gBAAgB,CAC1BC,mBAAmB,CAACL,UAAU,CAACM,OAAO,CAAC;IAC5C,OAAOH,aAAa;EACtB,CAAC,MAAM,IAAIH,UAAU,CAACC,IAAI,KAAK,WAAW,EAAE;IAC1C,OAAOF,MAAM,CAACK,gBAAgB,CAACG,sBAAsB,CACnDP,UAAU,CAACM,OACb,CAAC;EACH,CAAC,MAAM,IAAIN,UAAU,CAACC,IAAI,KAAK,QAAQ,EAAE;IACvC,OAAOF,MAAM,CAACK,gBAAgB,CAACI,mBAAmB,CAChDR,UAAU,CAACM,OACb,CAAC;EACH,CAAC,MAAM,IAAIN,UAAU,CAACC,IAAI,KAAK,OAAO,EAAE;IACtC,OAAOF,MAAM,CAACK,gBAAgB,CAACK,kBAAkB,CAC/CT,UAAU,CAACM,
|
|
1
|
+
{"version":3,"file":"fetchMetadata.js","names":["InterfaceDefinitions","fetchMetadataInternal","client","definition","type","interfaceDefs","objectTypeDef","ontologyProvider","getObjectDefinition","apiName","getInterfaceDefinition","getActionDefinition","getQueryDefinition","isFixedVersion","version","undefined","Error"],"sources":["fetchMetadata.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionDefinition,\n ActionMetadata,\n InterfaceDefinition,\n InterfaceMetadata,\n ObjectMetadata,\n ObjectTypeDefinition,\n QueryDefinition,\n QueryMetadata,\n} from \"@osdk/api\";\nimport type { MinimalClient } from \"./MinimalClientContext.js\";\nimport { InterfaceDefinitions } from \"./ontology/OntologyProvider.js\";\n\n/** @internal */\nexport const fetchMetadataInternal = async <\n Q extends (\n | ObjectTypeDefinition\n | InterfaceDefinition\n | ActionDefinition<any>\n | QueryDefinition<any>\n ),\n>(\n client: MinimalClient,\n definition: Q,\n): Promise<\n Q extends ObjectTypeDefinition ? ObjectMetadata\n : Q extends InterfaceDefinition ? InterfaceMetadata\n : Q extends ActionDefinition<any> ? ActionMetadata\n : Q extends QueryDefinition<any> ? QueryMetadata\n : never\n> => {\n if (definition.type === \"object\") {\n const { [InterfaceDefinitions]: interfaceDefs, ...objectTypeDef } =\n await client.ontologyProvider\n .getObjectDefinition(definition.apiName);\n return objectTypeDef as any;\n } else if (definition.type === \"interface\") {\n return client.ontologyProvider.getInterfaceDefinition(\n definition.apiName,\n ) as any;\n } else if (definition.type === \"action\") {\n return client.ontologyProvider.getActionDefinition(\n definition.apiName,\n ) as any;\n } else if (definition.type === \"query\") {\n return client.ontologyProvider.getQueryDefinition(\n definition.apiName,\n definition.isFixedVersion ? definition.version : undefined,\n ) as any;\n } else {\n throw new Error(\"Not implemented for given definition\");\n }\n};\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAaA,SAASA,oBAAoB,QAAQ,gCAAgC;;AAErE;AACA,OAAO,MAAMC,qBAAqB,GAAG,MAAAA,CAQnCC,MAAqB,EACrBC,UAAa,KAOV;EACH,IAAIA,UAAU,CAACC,IAAI,KAAK,QAAQ,EAAE;IAChC,MAAM;MAAE,CAACJ,oBAAoB,GAAGK,aAAa;MAAE,GAAGC;IAAc,CAAC,GAC/D,MAAMJ,MAAM,CAACK,gBAAgB,CAC1BC,mBAAmB,CAACL,UAAU,CAACM,OAAO,CAAC;IAC5C,OAAOH,aAAa;EACtB,CAAC,MAAM,IAAIH,UAAU,CAACC,IAAI,KAAK,WAAW,EAAE;IAC1C,OAAOF,MAAM,CAACK,gBAAgB,CAACG,sBAAsB,CACnDP,UAAU,CAACM,OACb,CAAC;EACH,CAAC,MAAM,IAAIN,UAAU,CAACC,IAAI,KAAK,QAAQ,EAAE;IACvC,OAAOF,MAAM,CAACK,gBAAgB,CAACI,mBAAmB,CAChDR,UAAU,CAACM,OACb,CAAC;EACH,CAAC,MAAM,IAAIN,UAAU,CAACC,IAAI,KAAK,OAAO,EAAE;IACtC,OAAOF,MAAM,CAACK,gBAAgB,CAACK,kBAAkB,CAC/CT,UAAU,CAACM,OAAO,EAClBN,UAAU,CAACU,cAAc,GAAGV,UAAU,CAACW,OAAO,GAAGC,SACnD,CAAC;EACH,CAAC,MAAM;IACL,MAAM,IAAIC,KAAK,CAAC,sCAAsC,CAAC;EACzD;AACF,CAAC","ignoreList":[]}
|
|
@@ -14,18 +14,20 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { $Actions, $Interfaces, $Objects, $
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
17
|
+
import { $Actions, $Interfaces, $Objects, $Queries } from "@osdk/client.test.ontology";
|
|
18
|
+
import { LegacyFauxFoundry, startNodeApiServer } from "@osdk/shared.test";
|
|
19
|
+
import { beforeAll, describe, expect, expectTypeOf, it } from "vitest";
|
|
20
20
|
import { createClient } from "./createClient.js";
|
|
21
21
|
describe("FetchMetadata", () => {
|
|
22
22
|
let client;
|
|
23
|
-
beforeAll(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
beforeAll(() => {
|
|
24
|
+
const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);
|
|
25
|
+
({
|
|
26
|
+
client
|
|
27
|
+
} = testSetup);
|
|
28
|
+
return () => {
|
|
29
|
+
testSetup.apiServer.close();
|
|
30
|
+
};
|
|
29
31
|
});
|
|
30
32
|
it("fetches object metadata correctly", async () => {
|
|
31
33
|
const objectMetadata = await client.fetchMetadata($Objects.Employee);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$ontologyRid","$Queries","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","client","listen","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionMetadata,\n InterfaceMetadata,\n ObjectMetadata,\n QueryMetadata,\n} from \"@osdk/api\";\nimport {\n $Actions,\n $Interfaces,\n $Objects,\n $ontologyRid,\n $Queries,\n} from \"@osdk/client.test.ontology\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport {\n afterAll,\n beforeAll,\n describe,\n expect,\n expectTypeOf,\n it,\n} from \"vitest\";\nimport type { Client } from \"./Client.js\";\nimport { createClient } from \"./createClient.js\";\n\ndescribe(\"FetchMetadata\", () => {\n let client: Client;\n\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\n \"https://stack.palantir.com\",\n $ontologyRid,\n async () => \"myAccessToken\",\n );\n });\n\n afterAll(() => {\n apiServer.close();\n });\n\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n\n expectTypeOf(objectMetadata).toEqualTypeOf<\n ObjectMetadata\n >();\n\n expect(objectMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"Employee\",\n \"description\": \"A full-time or part-time \n\n employee of our firm\",\n \"displayName\": \"Employee\",\n \"icon\": {\n \"color\": \"blue\",\n \"name\": \"person\",\n \"type\": \"blueprint\",\n },\n \"implements\": [\n \"FooInterface\",\n ],\n \"interfaceMap\": {\n \"FooInterface\": {\n \"fooSpt\": \"fullName\",\n },\n },\n \"inverseInterfaceMap\": {\n \"FooInterface\": {\n \"fullName\": \"fooSpt\",\n },\n },\n \"links\": {\n \"lead\": {\n \"multiplicity\": false,\n \"targetType\": \"Employee\",\n },\n \"officeLink\": {\n \"multiplicity\": false,\n \"targetType\": \"Office\",\n },\n \"peeps\": {\n \"multiplicity\": true,\n \"targetType\": \"Employee\",\n },\n },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"class\": {\n \"description\": \"\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\n },\n \"employeeLocation\": {\n \"description\": \"Geotime series reference of the location of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"geotimeSeriesReference\",\n },\n \"employeeSensor\": {\n \"description\": \"TimeSeries sensor of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"sensorTimeseries\",\n },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"office\": {\n \"description\": \"The unique \"ID\" of the employee's \\\\\"primary\\\\\" assigned office.\n This is some more text.\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"startDate\": {\n \"description\": \"The date the employee was hired (most recently, if they were re-hired)\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"datetime\",\n },\n },\n \"rid\": \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\",\n \"status\": \"ACTIVE\",\n \"titleProperty\": \"fullName\",\n \"type\": \"object\",\n \"visibility\": \"NORMAL\",\n }\n `);\n });\n\n it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata(\n $Interfaces.FooInterface,\n );\n\n expectTypeOf(interfaceMetadata).toEqualTypeOf<\n InterfaceMetadata\n >();\n\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implementedBy\": [\n \"Employee\",\n \"Person\",\n ],\n \"implements\": [],\n \"links\": {},\n \"properties\": {\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata(\n $Actions.moveOffice,\n );\n\n expectTypeOf(actionMetadata).toEqualTypeOf<ActionMetadata>();\n\n expect(actionMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"moveOffice\",\n \"description\": \"Update an office's physical location\",\n \"displayName\": \"move-office\",\n \"modifiedEntities\": {\n \"Office\": {\n \"created\": false,\n \"modified\": true,\n },\n },\n \"parameters\": {\n \"newAddress\": {\n \"description\": \"The office's new physical address (not necessarily shipping address)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"newCapacity\": {\n \"description\": \"The maximum seated-at-desk capacity of the new office (maximum fire-safe capacity may be higher)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n \"officeId\": {\n \"description\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"string\",\n },\n \"officeNames\": {\n \"description\": \"A list of all office names\",\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n },\n \"rid\": \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n \"status\": \"ACTIVE\",\n \"type\": \"action\",\n }\n `);\n });\n\n it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata(\n $Queries.queryAcceptsObject,\n );\n\n expectTypeOf(queryMetadata).toEqualTypeOf<QueryMetadata>();\n\n expect(queryMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"queryAcceptsObject\",\n \"description\": \"description of the query that takes object types\",\n \"displayName\": \"QueryAcceptsObject\",\n \"output\": {\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n \"parameters\": {\n \"object\": {\n \"description\": undefined,\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n },\n \"rid\": \"ri.function-registry.main.function.9b55870a-63c7-4d48-8f06-9627c0805968\",\n \"type\": \"query\",\n \"version\": \"0.11.0\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,WAAW,EACXC,QAAQ,EACRC,YAAY,EACZC,QAAQ,QACH,4BAA4B;AACnC,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SACEC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNC,YAAY,EACZC,EAAE,QACG,QAAQ;AAEf,SAASC,YAAY,QAAQ,mBAAmB;AAEhDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9B,IAAIK,MAAc;EAElBN,SAAS,CAAC,YAAY;IACpBF,SAAS,CAACS,MAAM,CAAC,CAAC;IAClBD,MAAM,GAAGD,YAAY,CACnB,4BAA4B,EAC5BT,YAAY,EACZ,YAAY,eACd,CAAC;EACH,CAAC,CAAC;EAEFG,QAAQ,CAAC,MAAM;IACbD,SAAS,CAACU,KAAK,CAAC,CAAC;EACnB,CAAC,CAAC;EAEFJ,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMK,cAAc,GAAG,MAAMH,MAAM,CAACI,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IAEpER,YAAY,CAACM,cAAc,CAAC,CAACG,aAAa,CAExC,CAAC;IAEHV,MAAM,CAACO,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACjD;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;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;EACJ,CAAC,CAAC;EAEFT,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACrD,MAAMU,iBAAiB,GAAG,MAAMR,MAAM,CAACI,aAAa,CAClDhB,WAAW,CAACqB,YACd,CAAC;IAEDZ,YAAY,CAACW,iBAAiB,CAAC,CAACF,aAAa,CAE3C,CAAC;IAEHV,MAAM,CAACY,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACpD;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;EAEFT,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMY,cAAc,GAAG,MAAMV,MAAM,CAACI,aAAa,CAC/CjB,QAAQ,CAACwB,UACX,CAAC;IAEDd,YAAY,CAACa,cAAc,CAAC,CAACJ,aAAa,CAAiB,CAAC;IAE5DV,MAAM,CAACc,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACjD;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;EACJ,CAAC,CAAC;EAEFT,EAAE,CAAC,kCAAkC,EAAE,YAAY;IACjD,MAAMc,aAAa,GAAG,MAAMZ,MAAM,CAACI,aAAa,CAC9Cb,QAAQ,CAACsB,kBACX,CAAC;IAEDhB,YAAY,CAACe,aAAa,CAAC,CAACN,aAAa,CAAgB,CAAC;IAE1DV,MAAM,CAACgB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AAChD;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;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$Queries","LegacyFauxFoundry","startNodeApiServer","beforeAll","describe","expect","expectTypeOf","it","createClient","client","testSetup","apiServer","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionMetadata,\n InterfaceMetadata,\n ObjectMetadata,\n QueryMetadata,\n} from \"@osdk/api\";\nimport {\n $Actions,\n $Interfaces,\n $Objects,\n $Queries,\n} from \"@osdk/client.test.ontology\";\nimport { LegacyFauxFoundry, startNodeApiServer } from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, expectTypeOf, it } from \"vitest\";\nimport type { Client } from \"./Client.js\";\nimport { createClient } from \"./createClient.js\";\n\ndescribe(\"FetchMetadata\", () => {\n let client: Client;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n\n expectTypeOf(objectMetadata).toEqualTypeOf<\n ObjectMetadata\n >();\n\n expect(objectMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"Employee\",\n \"description\": \"A full-time or part-time \n\n employee of our firm\",\n \"displayName\": \"Employee\",\n \"icon\": {\n \"color\": \"blue\",\n \"name\": \"person\",\n \"type\": \"blueprint\",\n },\n \"implements\": [\n \"FooInterface\",\n ],\n \"interfaceMap\": {\n \"FooInterface\": {\n \"fooSpt\": \"fullName\",\n },\n },\n \"inverseInterfaceMap\": {\n \"FooInterface\": {\n \"fullName\": \"fooSpt\",\n },\n },\n \"links\": {\n \"lead\": {\n \"multiplicity\": false,\n \"targetType\": \"Employee\",\n },\n \"officeLink\": {\n \"multiplicity\": false,\n \"targetType\": \"Office\",\n },\n \"peeps\": {\n \"multiplicity\": true,\n \"targetType\": \"Employee\",\n },\n },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"class\": {\n \"description\": \"\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\n },\n \"employeeLocation\": {\n \"description\": \"Geotime series reference of the location of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"geotimeSeriesReference\",\n },\n \"employeeSensor\": {\n \"description\": \"TimeSeries sensor of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"sensorTimeseries\",\n },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"office\": {\n \"description\": \"The unique \"ID\" of the employee's \\\\\"primary\\\\\" assigned office.\n This is some more text.\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"startDate\": {\n \"description\": \"The date the employee was hired (most recently, if they were re-hired)\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"datetime\",\n },\n },\n \"rid\": \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\",\n \"status\": \"ACTIVE\",\n \"titleProperty\": \"fullName\",\n \"type\": \"object\",\n \"visibility\": \"NORMAL\",\n }\n `);\n });\n\n it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata(\n $Interfaces.FooInterface,\n );\n\n expectTypeOf(interfaceMetadata).toEqualTypeOf<\n InterfaceMetadata\n >();\n\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implementedBy\": [\n \"Employee\",\n \"Person\",\n ],\n \"implements\": [],\n \"links\": {},\n \"properties\": {\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata(\n $Actions.moveOffice,\n );\n\n expectTypeOf(actionMetadata).toEqualTypeOf<ActionMetadata>();\n\n expect(actionMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"moveOffice\",\n \"description\": \"Update an office's physical location\",\n \"displayName\": \"move-office\",\n \"modifiedEntities\": {\n \"Office\": {\n \"created\": false,\n \"modified\": true,\n },\n },\n \"parameters\": {\n \"newAddress\": {\n \"description\": \"The office's new physical address (not necessarily shipping address)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"newCapacity\": {\n \"description\": \"The maximum seated-at-desk capacity of the new office (maximum fire-safe capacity may be higher)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n \"officeId\": {\n \"description\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"string\",\n },\n \"officeNames\": {\n \"description\": \"A list of all office names\",\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n },\n \"rid\": \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n \"status\": \"ACTIVE\",\n \"type\": \"action\",\n }\n `);\n });\n\n it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata(\n $Queries.queryAcceptsObject,\n );\n\n expectTypeOf(queryMetadata).toEqualTypeOf<QueryMetadata>();\n\n expect(queryMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"queryAcceptsObject\",\n \"description\": \"description of the query that takes object types\",\n \"displayName\": \"QueryAcceptsObject\",\n \"output\": {\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n \"parameters\": {\n \"object\": {\n \"description\": undefined,\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n },\n \"rid\": \"ri.function-registry.main.function.9b55870a-63c7-4d48-8f06-9627c0805968\",\n \"type\": \"query\",\n \"version\": \"0.11.0\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,WAAW,EACXC,QAAQ,EACRC,QAAQ,QACH,4BAA4B;AACnC,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,mBAAmB;AACzE,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAEtE,SAASC,YAAY,QAAQ,mBAAmB;AAEhDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9B,IAAIK,MAAc;EAElBN,SAAS,CAAC,MAAM;IACd,MAAMO,SAAS,GAAGR,kBAAkB,CAAC,IAAID,iBAAiB,CAAC,CAAC,EAAEO,YAAY,CAAC;IAC3E,CAAC;MAAEC;IAAO,CAAC,GAAGC,SAAS;IACvB,OAAO,MAAM;MACXA,SAAS,CAACC,SAAS,CAACC,KAAK,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,CAAC;EAEFL,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMM,cAAc,GAAG,MAAMJ,MAAM,CAACK,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IAEpET,YAAY,CAACO,cAAc,CAAC,CAACG,aAAa,CAExC,CAAC;IAEHX,MAAM,CAACQ,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACjD;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;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;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACrD,MAAMW,iBAAiB,GAAG,MAAMT,MAAM,CAACK,aAAa,CAClDhB,WAAW,CAACqB,YACd,CAAC;IAEDb,YAAY,CAACY,iBAAiB,CAAC,CAACF,aAAa,CAE3C,CAAC;IAEHX,MAAM,CAACa,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACpD;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;EAEFV,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMa,cAAc,GAAG,MAAMX,MAAM,CAACK,aAAa,CAC/CjB,QAAQ,CAACwB,UACX,CAAC;IAEDf,YAAY,CAACc,cAAc,CAAC,CAACJ,aAAa,CAAiB,CAAC;IAE5DX,MAAM,CAACe,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACjD;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;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,kCAAkC,EAAE,YAAY;IACjD,MAAMe,aAAa,GAAG,MAAMb,MAAM,CAACK,aAAa,CAC9Cd,QAAQ,CAACuB,kBACX,CAAC;IAEDjB,YAAY,CAACgB,aAAa,CAAC,CAACN,aAAa,CAAgB,CAAC;IAE1DX,MAAM,CAACiB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AAChD;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;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/build/browser/index.js
CHANGED
|
@@ -20,6 +20,5 @@ export { ActionValidationError } from "./actions/ActionValidationError.js";
|
|
|
20
20
|
export { createClient } from "./createClient.js";
|
|
21
21
|
export { createPlatformClient } from "./createPlatformClient.js";
|
|
22
22
|
export { createAttachmentUpload } from "./object/AttachmentUpload.js";
|
|
23
|
-
export { createObjectSpecifierFromPrimaryKey } from "./object/createObjectSpecifierFromPrimaryKey.js";
|
|
24
23
|
export { extractDate, extractDateInLocalTime, extractDateInUTC } from "./util/datetimeConverters.js";
|
|
25
24
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","
|
|
1
|
+
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","extractDate","extractDateInLocalTime","extractDateInUTC"],"sources":["index.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\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n Attachment,\n CompileTimeMetadata,\n InterfaceDefinition,\n Logger,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n OsdkObjectPropertyType,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Range,\n Result,\n SingleLinkAccessor,\n ThreeDimensionalAggregation,\n TwoDimensionalAggregation,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAqCA,SAASA,IAAI,QAAQ,WAAW;AAChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAEhE,SAASC,sBAAsB,QAAQ,8BAA8B;AAGrE,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B","ignoreList":[]}
|
|
@@ -14,7 +14,12 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
// WARNING!
|
|
18
|
+
// WARNING!
|
|
19
|
+
// This file is used for tests that check intellisense. Editing this file by hand will likely
|
|
20
|
+
// break tests that have hard coded line numbers and line offsets.
|
|
21
|
+
|
|
22
|
+
const employee = {};
|
|
23
|
+
employee.employeeLocation;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=showsObjectPropertyJsdoc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"showsObjectPropertyJsdoc.js","names":["employee","employeeLocation"],"sources":["showsObjectPropertyJsdoc.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n// WARNING!\n// WARNING!\n// This file is used for tests that check intellisense. Editing this file by hand will likely\n// break tests that have hard coded line numbers and line offsets.\n\nimport type { Osdk } from \"@osdk/api\";\nimport type { Employee } from \"@osdk/client.test.ontology\";\n\nconst employee: Osdk.Instance<Employee> = {} as any;\nemployee.employeeLocation;\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;;AAKA,MAAMA,QAAiC,GAAG,CAAC,CAAQ;AACnDA,QAAQ,CAACC,gBAAgB;AAAC","ignoreList":[]}
|
|
@@ -53,7 +53,10 @@ describe("intellisense", () => {
|
|
|
53
53
|
let clientPackagePath;
|
|
54
54
|
beforeAll(() => {
|
|
55
55
|
const clientsPackageJson = findUpSync("package.json", {
|
|
56
|
-
cwd: import.meta.
|
|
56
|
+
cwd: import.meta.dirname
|
|
57
|
+
});
|
|
58
|
+
console.log({
|
|
59
|
+
clientsPackageJson
|
|
57
60
|
});
|
|
58
61
|
!(clientsPackageJson != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
59
62
|
packagesDir = path.join(path.dirname(clientsPackageJson), "..");
|
|
@@ -63,6 +66,7 @@ describe("intellisense", () => {
|
|
|
63
66
|
let intellisenseFilePath;
|
|
64
67
|
beforeEach(async a => {
|
|
65
68
|
intellisenseFilePath = path.join(clientPackagePath, "src", "intellisense.test.helpers", `${a.task.name}.ts`);
|
|
69
|
+
console.log(intellisenseFilePath);
|
|
66
70
|
expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();
|
|
67
71
|
tsServer = await startTsServer(rootLogger);
|
|
68
72
|
await tsServer.sendOpenRequest({
|
|
@@ -85,5 +89,17 @@ describe("intellisense", () => {
|
|
|
85
89
|
});
|
|
86
90
|
expect(resp.body?.documentation).toMatchInlineSnapshot(`"(no ontology metadata)"`);
|
|
87
91
|
});
|
|
92
|
+
it("showsObjectPropertyJsdoc", {
|
|
93
|
+
timeout: 40_000
|
|
94
|
+
}, async () => {
|
|
95
|
+
const {
|
|
96
|
+
resp
|
|
97
|
+
} = await tsServer.sendQuickInfoRequest({
|
|
98
|
+
file: intellisenseFilePath,
|
|
99
|
+
line: 26,
|
|
100
|
+
offset: 13
|
|
101
|
+
});
|
|
102
|
+
expect(resp.body?.documentation).toMatchInlineSnapshot(`"description: Geotime series reference of the location of the employee"`);
|
|
103
|
+
});
|
|
88
104
|
});
|
|
89
105
|
//# sourceMappingURL=intellisense.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","
|
|
1
|
+
{"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","dirname","process","env","NODE_ENV","join","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot"],"sources":["intellisense.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 { Logger } from \"@osdk/api\";\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport {\n afterEach,\n beforeAll,\n beforeEach,\n describe,\n expect,\n it,\n vi,\n} from \"vitest\";\nimport type { TsServer } from \"./tsserver.js\";\nimport { startTsServer } from \"./tsserver.js\";\n\n// it needs to be hoisted because its referenced from our mocked WebSocket\n// which must be hoisted to work\nconst rootLogger = await vi.hoisted(async (): Promise<Logger> => {\n const pino = (await import(\"pino\")).pino;\n const pinoPretty = await import(\"pino-pretty\");\n const { EventEmitter } = await import(\"node:events\");\n class PinoConsoleLogDestination extends EventEmitter {\n write(a: string) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\") a = a.slice(0, -1);\n\n // This lets the test framework aggregate the logs per test, whereas direct to stdout does not\n console.log(a);\n }\n }\n return Promise.resolve(pino(\n { level: \"info\" },\n (pinoPretty.build)({\n sync: true,\n timestampKey: undefined,\n errorLikeObjectKeys: [\"error\", \"err\", \"exception\"],\n errorProps: \"stack,cause,properties\",\n ignore: \"time,hostname,pid\",\n destination: new PinoConsoleLogDestination(),\n }),\n ));\n});\n\ndescribe(\"intellisense\", () => {\n let packagesDir: string;\n let clientPackagePath: string;\n\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.dirname,\n });\n console.log({ clientsPackageJson });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(\n path.dirname(clientsPackageJson),\n \"..\",\n );\n\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n\n let tsServer: TsServer;\n let intellisenseFilePath: string;\n\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(\n clientPackagePath,\n \"src\",\n \"intellisense.test.helpers\",\n `${a.task.name}.ts`,\n );\n\n console.log(intellisenseFilePath);\n\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined as any;\n });\n\n it(\"callsQueryAcceptsObject\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"(no ontology metadata)\"`,\n );\n });\n\n it(\"showsObjectPropertyJsdoc\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 26,\n offset: 13,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"description: Geotime series reference of the location of the employee\"`,\n );\n });\n});\n"],"mappings":"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","ignoreList":[]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export function noop() {}
|
|
18
|
+
const levels = {
|
|
19
|
+
trace: 10,
|
|
20
|
+
debug: 20,
|
|
21
|
+
info: 30,
|
|
22
|
+
warn: 40,
|
|
23
|
+
error: 50,
|
|
24
|
+
fatal: 60
|
|
25
|
+
};
|
|
26
|
+
export class BaseLogger {
|
|
27
|
+
#factory;
|
|
28
|
+
constructor(bindings, options = {}, factory) {
|
|
29
|
+
this.bindings = bindings;
|
|
30
|
+
this.options = options;
|
|
31
|
+
this.#factory = factory;
|
|
32
|
+
for (const k of ["trace", "debug", "info", "warn", "error", "fatal"]) {
|
|
33
|
+
if (this.options?.level && !this.isLevelEnabled(k)) {
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
this[k] = this.createLogMethod(k, bindings);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
trace = noop;
|
|
40
|
+
debug = noop;
|
|
41
|
+
warn = noop;
|
|
42
|
+
info = noop;
|
|
43
|
+
error = noop;
|
|
44
|
+
fatal = noop;
|
|
45
|
+
child(bindings, options) {
|
|
46
|
+
return new this.#factory({
|
|
47
|
+
...this.bindings,
|
|
48
|
+
...bindings
|
|
49
|
+
}, {
|
|
50
|
+
level: (options ?? this.options)?.level,
|
|
51
|
+
msgPrefix: [this.options?.msgPrefix, options?.msgPrefix].filter(x => x).join(" ")
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
isLevelEnabled(level) {
|
|
55
|
+
const ourLevel = this.options?.level ?? "info";
|
|
56
|
+
return level in levels && ourLevel in levels && levels[level] >= levels[ourLevel];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=BaseLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BaseLogger.js","names":["noop","levels","trace","debug","info","warn","error","fatal","BaseLogger","factory","constructor","bindings","options","k","level","isLevelEnabled","createLogMethod","child","msgPrefix","filter","x","join","ourLevel"],"sources":["BaseLogger.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\n\nexport function noop(): any {\n}\n\ninterface LoggerConstructor {\n new(\n bindings: Record<string, any>,\n options?: { level?: string; msgPrefix?: string },\n ): Logger;\n}\n\nconst levels = {\n trace: 10,\n debug: 20,\n info: 30,\n warn: 40,\n error: 50,\n fatal: 60,\n};\n\nexport abstract class BaseLogger implements Logger {\n protected bindings: Record<string, any>;\n protected options: { level?: string; msgPrefix?: string } | undefined;\n #factory: LoggerConstructor;\n\n constructor(\n bindings: Record<string, any>,\n options: { level?: string; msgPrefix?: string } = {},\n factory: LoggerConstructor,\n ) {\n this.bindings = bindings;\n this.options = options;\n this.#factory = factory;\n\n for (\n const k of [\"trace\", \"debug\", \"info\", \"warn\", \"error\", \"fatal\"] as const\n ) {\n if (this.options?.level && !this.isLevelEnabled(k)) {\n continue;\n }\n this[k] = this.createLogMethod(k, bindings);\n }\n }\n\n protected abstract createLogMethod(\n name: \"trace\" | \"debug\" | \"info\" | \"warn\" | \"error\" | \"fatal\",\n bindings: Record<string, any>,\n ): Logger.LogFn;\n\n trace: Logger.LogFn = noop;\n debug: Logger.LogFn = noop;\n warn: Logger.LogFn = noop;\n info: Logger.LogFn = noop;\n error: Logger.LogFn = noop;\n fatal: Logger.LogFn = noop;\n\n child(\n bindings: Record<string, any>,\n options?: { level?: string; msgPrefix?: string },\n ): Logger {\n return new this.#factory({\n ...this.bindings,\n ...bindings,\n }, {\n level: (options ?? this.options)?.level,\n msgPrefix: [this.options?.msgPrefix, options?.msgPrefix].filter(x => x)\n .join(\" \"),\n });\n }\n\n isLevelEnabled(level: string): boolean {\n const ourLevel = (this.options?.level ?? \"info\") as keyof typeof levels;\n\n return level in levels && ourLevel in levels\n && levels[level as keyof typeof levels] >= levels[ourLevel];\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,IAAIA,CAAA,EAAQ,CAC5B;AASA,MAAMC,MAAM,GAAG;EACbC,KAAK,EAAE,EAAE;EACTC,KAAK,EAAE,EAAE;EACTC,IAAI,EAAE,EAAE;EACRC,IAAI,EAAE,EAAE;EACRC,KAAK,EAAE,EAAE;EACTC,KAAK,EAAE;AACT,CAAC;AAED,OAAO,MAAeC,UAAU,CAAmB;EAGjD,CAACC,OAAO;EAERC,WAAWA,CACTC,QAA6B,EAC7BC,OAA+C,GAAG,CAAC,CAAC,EACpDH,OAA0B,EAC1B;IACA,IAAI,CAACE,QAAQ,GAAGA,QAAQ;IACxB,IAAI,CAACC,OAAO,GAAGA,OAAO;IACtB,IAAI,CAAC,CAACH,OAAO,GAAGA,OAAO;IAEvB,KACE,MAAMI,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAC/D;MACA,IAAI,IAAI,CAACD,OAAO,EAAEE,KAAK,IAAI,CAAC,IAAI,CAACC,cAAc,CAACF,CAAC,CAAC,EAAE;QAClD;MACF;MACA,IAAI,CAACA,CAAC,CAAC,GAAG,IAAI,CAACG,eAAe,CAACH,CAAC,EAAEF,QAAQ,CAAC;IAC7C;EACF;EAOAT,KAAK,GAAiBF,IAAI;EAC1BG,KAAK,GAAiBH,IAAI;EAC1BK,IAAI,GAAiBL,IAAI;EACzBI,IAAI,GAAiBJ,IAAI;EACzBM,KAAK,GAAiBN,IAAI;EAC1BO,KAAK,GAAiBP,IAAI;EAE1BiB,KAAKA,CACHN,QAA6B,EAC7BC,OAAgD,EACxC;IACR,OAAO,IAAI,IAAI,CAAC,CAACH,OAAO,CAAC;MACvB,GAAG,IAAI,CAACE,QAAQ;MAChB,GAAGA;IACL,CAAC,EAAE;MACDG,KAAK,EAAE,CAACF,OAAO,IAAI,IAAI,CAACA,OAAO,GAAGE,KAAK;MACvCI,SAAS,EAAE,CAAC,IAAI,CAACN,OAAO,EAAEM,SAAS,EAAEN,OAAO,EAAEM,SAAS,CAAC,CAACC,MAAM,CAACC,CAAC,IAAIA,CAAC,CAAC,CACpEC,IAAI,CAAC,GAAG;IACb,CAAC,CAAC;EACJ;EAEAN,cAAcA,CAACD,KAAa,EAAW;IACrC,MAAMQ,QAAQ,GAAI,IAAI,CAACV,OAAO,EAAEE,KAAK,IAAI,MAA8B;IAEvE,OAAOA,KAAK,IAAIb,MAAM,IAAIqB,QAAQ,IAAIrB,MAAM,IACvCA,MAAM,CAACa,KAAK,CAAwB,IAAIb,MAAM,CAACqB,QAAQ,CAAC;EAC/D;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { BaseLogger } from "./BaseLogger.js";
|
|
18
|
+
function createStyle({
|
|
19
|
+
color
|
|
20
|
+
}) {
|
|
21
|
+
return `color: ${color}; border: 1px solid ${color}; padding: 2px; border-radius: 3px;`;
|
|
22
|
+
}
|
|
23
|
+
const levelStyles = {
|
|
24
|
+
debug: createStyle({
|
|
25
|
+
color: "LightBlue"
|
|
26
|
+
}),
|
|
27
|
+
error: createStyle({
|
|
28
|
+
color: "red"
|
|
29
|
+
}),
|
|
30
|
+
fatal: createStyle({
|
|
31
|
+
color: "red"
|
|
32
|
+
}),
|
|
33
|
+
info: createStyle({
|
|
34
|
+
color: "green"
|
|
35
|
+
}),
|
|
36
|
+
trace: createStyle({
|
|
37
|
+
color: "gray"
|
|
38
|
+
}),
|
|
39
|
+
warn: createStyle({
|
|
40
|
+
color: "orange"
|
|
41
|
+
})
|
|
42
|
+
};
|
|
43
|
+
export class BrowserLogger extends BaseLogger {
|
|
44
|
+
constructor(bindings = {}, options = {}) {
|
|
45
|
+
super(bindings, {
|
|
46
|
+
...options,
|
|
47
|
+
level: options.level ?? "error"
|
|
48
|
+
}, BrowserLogger);
|
|
49
|
+
}
|
|
50
|
+
createLogMethod(name, bindings) {
|
|
51
|
+
const msgs = [`%c${name}%c`];
|
|
52
|
+
const styles = [levelStyles[name], ""];
|
|
53
|
+
if (this.options?.msgPrefix) {
|
|
54
|
+
msgs.push(`%c${this.options.msgPrefix}%c`);
|
|
55
|
+
styles.push("font-style: italic; color: gray", "");
|
|
56
|
+
}
|
|
57
|
+
if (typeof bindings === "object" && "methodName" in bindings) {
|
|
58
|
+
msgs.push(`%c.${bindings.methodName}()%c`);
|
|
59
|
+
styles.push("font-style: italic;color: orchid", "");
|
|
60
|
+
}
|
|
61
|
+
return (...args) => {
|
|
62
|
+
// eslint-disable-next-line no-console
|
|
63
|
+
console[name === "fatal" ? "error" : name](msgs.join(" "), ...styles, ...args);
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=BrowserLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BrowserLogger.js","names":["BaseLogger","createStyle","color","levelStyles","debug","error","fatal","info","trace","warn","BrowserLogger","constructor","bindings","options","level","createLogMethod","name","msgs","styles","msgPrefix","push","methodName","args","console","join"],"sources":["BrowserLogger.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\nimport { BaseLogger } from \"./BaseLogger.js\";\nfunction createStyle({ color }: { color: string }) {\n return `color: ${color}; border: 1px solid ${color}; padding: 2px; border-radius: 3px;`;\n}\n\nconst levelStyles = {\n debug: createStyle({\n color: \"LightBlue\",\n }),\n error: createStyle({\n color: \"red\",\n }),\n fatal: createStyle({\n color: \"red\",\n }),\n info: createStyle({\n color: \"green\",\n }),\n trace: createStyle({\n color: \"gray\",\n }),\n warn: createStyle({\n color: \"orange\",\n }),\n};\n\nexport class BrowserLogger extends BaseLogger implements Logger {\n constructor(\n bindings: Record<string, any> = {},\n options: { level?: string; msgPrefix?: string } = {},\n ) {\n super(\n bindings,\n { ...options, level: options.level ?? \"error\" },\n BrowserLogger,\n );\n }\n\n protected createLogMethod(\n name: \"trace\" | \"debug\" | \"info\" | \"warn\" | \"error\" | \"fatal\",\n bindings: Record<string, any>,\n ): Logger.LogFn {\n const msgs: string[] = [`%c${name}%c`];\n const styles: string[] = [levelStyles[name], \"\"];\n\n if (this.options?.msgPrefix) {\n msgs.push(`%c${this.options.msgPrefix}%c`);\n styles.push(\n \"font-style: italic; color: gray\",\n \"\",\n );\n }\n\n if (typeof bindings === \"object\" && \"methodName\" in bindings) {\n msgs.push(`%c.${bindings.methodName}()%c`);\n styles.push(\n \"font-style: italic;color: orchid\",\n \"\",\n );\n }\n\n return (...args: any[]): any => {\n // eslint-disable-next-line no-console\n console[name === \"fatal\" ? \"error\" : name](\n msgs.join(\" \"),\n ...styles,\n ...args,\n );\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,iBAAiB;AAC5C,SAASC,WAAWA,CAAC;EAAEC;AAAyB,CAAC,EAAE;EACjD,OAAO,UAAUA,KAAK,uBAAuBA,KAAK,qCAAqC;AACzF;AAEA,MAAMC,WAAW,GAAG;EAClBC,KAAK,EAAEH,WAAW,CAAC;IACjBC,KAAK,EAAE;EACT,CAAC,CAAC;EACFG,KAAK,EAAEJ,WAAW,CAAC;IACjBC,KAAK,EAAE;EACT,CAAC,CAAC;EACFI,KAAK,EAAEL,WAAW,CAAC;IACjBC,KAAK,EAAE;EACT,CAAC,CAAC;EACFK,IAAI,EAAEN,WAAW,CAAC;IAChBC,KAAK,EAAE;EACT,CAAC,CAAC;EACFM,KAAK,EAAEP,WAAW,CAAC;IACjBC,KAAK,EAAE;EACT,CAAC,CAAC;EACFO,IAAI,EAAER,WAAW,CAAC;IAChBC,KAAK,EAAE;EACT,CAAC;AACH,CAAC;AAED,OAAO,MAAMQ,aAAa,SAASV,UAAU,CAAmB;EAC9DW,WAAWA,CACTC,QAA6B,GAAG,CAAC,CAAC,EAClCC,OAA+C,GAAG,CAAC,CAAC,EACpD;IACA,KAAK,CACHD,QAAQ,EACR;MAAE,GAAGC,OAAO;MAAEC,KAAK,EAAED,OAAO,CAACC,KAAK,IAAI;IAAQ,CAAC,EAC/CJ,aACF,CAAC;EACH;EAEUK,eAAeA,CACvBC,IAA6D,EAC7DJ,QAA6B,EACf;IACd,MAAMK,IAAc,GAAG,CAAC,KAAKD,IAAI,IAAI,CAAC;IACtC,MAAME,MAAgB,GAAG,CAACf,WAAW,CAACa,IAAI,CAAC,EAAE,EAAE,CAAC;IAEhD,IAAI,IAAI,CAACH,OAAO,EAAEM,SAAS,EAAE;MAC3BF,IAAI,CAACG,IAAI,CAAC,KAAK,IAAI,CAACP,OAAO,CAACM,SAAS,IAAI,CAAC;MAC1CD,MAAM,CAACE,IAAI,CACT,iCAAiC,EACjC,EACF,CAAC;IACH;IAEA,IAAI,OAAOR,QAAQ,KAAK,QAAQ,IAAI,YAAY,IAAIA,QAAQ,EAAE;MAC5DK,IAAI,CAACG,IAAI,CAAC,MAAMR,QAAQ,CAACS,UAAU,MAAM,CAAC;MAC1CH,MAAM,CAACE,IAAI,CACT,kCAAkC,EAClC,EACF,CAAC;IACH;IAEA,OAAO,CAAC,GAAGE,IAAW,KAAU;MAC9B;MACAC,OAAO,CAACP,IAAI,KAAK,OAAO,GAAG,OAAO,GAAGA,IAAI,CAAC,CACxCC,IAAI,CAACO,IAAI,CAAC,GAAG,CAAC,EACd,GAAGN,MAAM,EACT,GAAGI,IACL,CAAC;IACH,CAAC;EACH;AACF","ignoreList":[0]}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { BaseLogger } from "./BaseLogger.js";
|
|
18
|
+
export class MinimalLogger extends BaseLogger {
|
|
19
|
+
constructor(bindings = {}, options = {}) {
|
|
20
|
+
super(bindings, {
|
|
21
|
+
...options,
|
|
22
|
+
level: options.level ?? "error"
|
|
23
|
+
}, MinimalLogger);
|
|
24
|
+
}
|
|
25
|
+
createLogMethod(name, bindings) {
|
|
26
|
+
const msgs = [name];
|
|
27
|
+
if (this.options?.msgPrefix) {
|
|
28
|
+
msgs.push(this.options.msgPrefix);
|
|
29
|
+
}
|
|
30
|
+
if (typeof bindings === "object" && "methodName" in bindings) {
|
|
31
|
+
msgs.push(`.${bindings.methodName}()`);
|
|
32
|
+
}
|
|
33
|
+
return (...args) => {
|
|
34
|
+
// eslint-disable-next-line no-console
|
|
35
|
+
console[name === "fatal" ? "error" : name](msgs.join(" "), ...args);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//# sourceMappingURL=MinimalLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MinimalLogger.js","names":["BaseLogger","MinimalLogger","constructor","bindings","options","level","createLogMethod","name","msgs","msgPrefix","push","methodName","args","console","join"],"sources":["MinimalLogger.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { Logger } from \"@osdk/api\";\nimport { BaseLogger } from \"./BaseLogger.js\";\n\nexport class MinimalLogger extends BaseLogger implements Logger {\n constructor(\n bindings: Record<string, any> = {},\n options: { level?: string; msgPrefix?: string } = {},\n ) {\n super(\n bindings,\n { ...options, level: options.level ?? \"error\" },\n MinimalLogger,\n );\n }\n\n createLogMethod(\n name: \"trace\" | \"debug\" | \"info\" | \"warn\" | \"error\" | \"fatal\",\n bindings: Record<string, any>,\n ): Logger.LogFn {\n const msgs: string[] = [name];\n\n if (this.options?.msgPrefix) {\n msgs.push(this.options.msgPrefix);\n }\n\n if (typeof bindings === \"object\" && \"methodName\" in bindings) {\n msgs.push(`.${bindings.methodName}()`);\n }\n\n return (...args: any[]) => {\n // eslint-disable-next-line no-console\n console[name === \"fatal\" ? \"error\" : name](msgs.join(\" \"), ...args);\n };\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,QAAQ,iBAAiB;AAE5C,OAAO,MAAMC,aAAa,SAASD,UAAU,CAAmB;EAC9DE,WAAWA,CACTC,QAA6B,GAAG,CAAC,CAAC,EAClCC,OAA+C,GAAG,CAAC,CAAC,EACpD;IACA,KAAK,CACHD,QAAQ,EACR;MAAE,GAAGC,OAAO;MAAEC,KAAK,EAAED,OAAO,CAACC,KAAK,IAAI;IAAQ,CAAC,EAC/CJ,aACF,CAAC;EACH;EAEAK,eAAeA,CACbC,IAA6D,EAC7DJ,QAA6B,EACf;IACd,MAAMK,IAAc,GAAG,CAACD,IAAI,CAAC;IAE7B,IAAI,IAAI,CAACH,OAAO,EAAEK,SAAS,EAAE;MAC3BD,IAAI,CAACE,IAAI,CAAC,IAAI,CAACN,OAAO,CAACK,SAAS,CAAC;IACnC;IAEA,IAAI,OAAON,QAAQ,KAAK,QAAQ,IAAI,YAAY,IAAIA,QAAQ,EAAE;MAC5DK,IAAI,CAACE,IAAI,CAAC,IAAIP,QAAQ,CAACQ,UAAU,IAAI,CAAC;IACxC;IAEA,OAAO,CAAC,GAAGC,IAAW,KAAK;MACzB;MACAC,OAAO,CAACN,IAAI,KAAK,OAAO,GAAG,OAAO,GAAGA,IAAI,CAAC,CAACC,IAAI,CAACM,IAAI,CAAC,GAAG,CAAC,EAAE,GAAGF,IAAI,CAAC;IACrE,CAAC;EACH;AACF","ignoreList":[0]}
|