@osdk/client 2.2.0-beta.2 → 2.2.0-beta.20
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 +269 -0
- package/build/browser/Client.js.map +1 -1
- 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 +226 -87
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/actions/applyAction.js +28 -16
- package/build/browser/actions/applyAction.js.map +1 -1
- package/build/browser/createClient.js +19 -8
- 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 +2 -2
- 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 +94 -0
- package/build/browser/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
- package/build/browser/fetchMetadata.test.js +11 -9
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/index.js +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/intellisense.test.helpers/showsObjectPropertyJsdoc.js +25 -0
- 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/internal/conversions/modernToLegacyGroupByClause.js +7 -0
- package/build/browser/internal/conversions/modernToLegacyGroupByClause.js.map +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.js +1 -1
- package/build/browser/internal/conversions/modernToLegacyWhereClause.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/AttachmentUpload.js +3 -0
- package/build/browser/object/AttachmentUpload.js.map +1 -1
- package/build/browser/object/SimpleOsdkProperties.js +2 -0
- package/build/browser/object/SimpleOsdkProperties.js.map +1 -0
- package/build/browser/object/aggregate.test.js +12 -2
- package/build/browser/object/aggregate.test.js.map +1 -1
- 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 +2 -0
- package/build/browser/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -0
- package/build/browser/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/ObjectHolder.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js +29 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +53 -35
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.js +10 -11
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +46 -36
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/browser/object/fetchPage.js +17 -4
- package/build/browser/object/fetchPage.js.map +1 -1
- package/build/browser/object/fetchPage.test.js +56 -2
- package/build/browser/object/fetchPage.test.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 +182 -66
- 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 +37 -17
- package/build/browser/objectSet/InterfaceObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSet.test.js +212 -114
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +20 -16
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +21 -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/ListPayload.js.map +1 -1
- package/build/browser/observable/ObjectPayload.js.map +1 -1
- package/build/browser/observable/ObservableClient.js.map +1 -1
- package/build/browser/observable/OptimisticBuilder.js.map +1 -1
- package/build/browser/observable/internal/ActionApplication.js +102 -0
- package/build/browser/observable/internal/ActionApplication.js.map +1 -0
- 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/CacheKey.js +38 -1
- package/build/browser/observable/internal/CacheKey.js.map +1 -1
- package/build/browser/observable/internal/CacheKeys.js +4 -4
- package/build/browser/observable/internal/CacheKeys.js.map +1 -1
- package/build/browser/observable/internal/Changes.js +58 -0
- package/build/browser/observable/internal/Changes.js.map +1 -0
- package/build/browser/observable/internal/Layer.js +6 -3
- package/build/browser/observable/internal/Layer.js.map +1 -1
- package/build/browser/observable/internal/ListQuery.js +495 -129
- package/build/browser/observable/internal/ListQuery.js.map +1 -1
- package/build/browser/observable/internal/ObjectQuery.js +40 -14
- package/build/browser/observable/internal/ObjectQuery.js.map +1 -1
- package/build/browser/observable/internal/ObservableClientImpl.js +4 -12
- package/build/browser/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/browser/observable/internal/OptimisticJob.js +30 -29
- package/build/browser/observable/internal/OptimisticJob.js.map +1 -1
- package/build/browser/observable/internal/OrderByCanonicalizer.js +73 -0
- package/build/browser/observable/internal/OrderByCanonicalizer.js.map +1 -0
- package/build/browser/observable/internal/OrderByCanonicalizer.test.js +78 -0
- package/build/browser/observable/internal/OrderByCanonicalizer.test.js.map +1 -0
- package/build/browser/observable/internal/Query.js +79 -6
- package/build/browser/observable/internal/Query.js.map +1 -1
- package/build/browser/observable/internal/RefCounts.js +7 -2
- package/build/browser/observable/internal/RefCounts.js.map +1 -1
- package/build/browser/observable/internal/SimpleWhereClause.js +2 -0
- package/build/browser/observable/internal/SimpleWhereClause.js.map +1 -0
- package/build/browser/observable/internal/Store.js +140 -190
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/Store.test.js +666 -300
- package/build/browser/observable/internal/Store.test.js.map +1 -1
- package/build/browser/observable/internal/WhereClauseCanonicalizer.js +11 -3
- package/build/browser/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
- package/build/browser/observable/internal/objectMatchesWhereClause.js +0 -4
- package/build/browser/observable/internal/objectMatchesWhereClause.js.map +1 -1
- package/build/browser/observable/internal/objectMatchesWhereClause.test.js.map +1 -1
- package/build/browser/observable/internal/testUtils.js +222 -19
- package/build/browser/observable/internal/testUtils.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/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/{esm/observable/internal/ChangedObjects.js → browser/public-utils/vite-env.d.ts} +2 -7
- package/build/browser/queries/applyQuery.js +34 -2
- package/build/browser/queries/applyQuery.js.map +1 -1
- package/build/browser/queries/queries.test.js +36 -13
- 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/UserAgent.js.map +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/{observable/internal/ChangedObjects.js → util/isPoint.js} +3 -7
- 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 +14 -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 +25 -2
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/cjs/{Client-C8K3E1vH.d.cts → Client-CgL2LKN9.d.cts} +7 -8
- package/build/cjs/{chunk-T5UE6BI7.cjs → chunk-33GHS3X4.cjs} +256 -80
- package/build/cjs/chunk-33GHS3X4.cjs.map +1 -0
- package/build/cjs/{chunk-X7WGNFZ4.cjs → chunk-37QC7LR3.cjs} +173 -34
- package/build/cjs/chunk-37QC7LR3.cjs.map +1 -0
- package/build/cjs/chunk-T4NIFYZS.cjs +14 -0
- package/build/cjs/chunk-T4NIFYZS.cjs.map +1 -0
- package/build/cjs/index.cjs +298 -177
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +14 -22
- 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 +1181 -527
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +44 -25
- package/build/esm/Client.js.map +1 -1
- 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 +226 -87
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/actions/applyAction.js +28 -16
- package/build/esm/actions/applyAction.js.map +1 -1
- package/build/esm/createClient.js +19 -8
- 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 +2 -2
- 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 +94 -0
- package/build/esm/derivedProperties/derivedPropertyDefinitionFactory.js.map +1 -0
- package/build/esm/fetchMetadata.test.js +11 -9
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/intellisense.test.helpers/showsObjectPropertyJsdoc.js +25 -0
- 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/internal/conversions/modernToLegacyGroupByClause.js +7 -0
- package/build/esm/internal/conversions/modernToLegacyGroupByClause.js.map +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.js +1 -1
- package/build/esm/internal/conversions/modernToLegacyWhereClause.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/AttachmentUpload.js +3 -0
- package/build/esm/object/AttachmentUpload.js.map +1 -1
- package/build/esm/object/SimpleOsdkProperties.js +2 -0
- package/build/esm/object/SimpleOsdkProperties.js.map +1 -0
- package/build/esm/object/aggregate.test.js +12 -2
- package/build/esm/object/aggregate.test.js.map +1 -1
- 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 +2 -0
- package/build/esm/object/convertWireToOsdkObjects/BaseHolder.js.map +1 -0
- package/build/esm/object/convertWireToOsdkObjects/InterfaceHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/ObjectHolder.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js +29 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +53 -35
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarAs.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/getDollarLink.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.js +10 -11
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +46 -36
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/esm/object/fetchPage.js +17 -4
- package/build/esm/object/fetchPage.js.map +1 -1
- package/build/esm/object/fetchPage.test.js +56 -2
- package/build/esm/object/fetchPage.test.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 +182 -66
- 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 +37 -17
- package/build/esm/objectSet/InterfaceObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSet.test.js +212 -114
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +20 -16
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +21 -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/ListPayload.js.map +1 -1
- package/build/esm/observable/ObjectPayload.js.map +1 -1
- package/build/esm/observable/ObservableClient.js.map +1 -1
- package/build/esm/observable/OptimisticBuilder.js.map +1 -1
- package/build/esm/observable/internal/ActionApplication.js +102 -0
- package/build/esm/observable/internal/ActionApplication.js.map +1 -0
- 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/CacheKey.js +38 -1
- package/build/esm/observable/internal/CacheKey.js.map +1 -1
- package/build/esm/observable/internal/CacheKeys.js +4 -4
- package/build/esm/observable/internal/CacheKeys.js.map +1 -1
- package/build/esm/observable/internal/Changes.js +58 -0
- package/build/esm/observable/internal/Changes.js.map +1 -0
- package/build/esm/observable/internal/Layer.js +6 -3
- package/build/esm/observable/internal/Layer.js.map +1 -1
- package/build/esm/observable/internal/ListQuery.js +495 -129
- package/build/esm/observable/internal/ListQuery.js.map +1 -1
- package/build/esm/observable/internal/ObjectQuery.js +40 -14
- package/build/esm/observable/internal/ObjectQuery.js.map +1 -1
- package/build/esm/observable/internal/ObservableClientImpl.js +4 -12
- package/build/esm/observable/internal/ObservableClientImpl.js.map +1 -1
- package/build/esm/observable/internal/OptimisticJob.js +30 -29
- package/build/esm/observable/internal/OptimisticJob.js.map +1 -1
- package/build/esm/observable/internal/OrderByCanonicalizer.js +73 -0
- package/build/esm/observable/internal/OrderByCanonicalizer.js.map +1 -0
- package/build/esm/observable/internal/OrderByCanonicalizer.test.js +78 -0
- package/build/esm/observable/internal/OrderByCanonicalizer.test.js.map +1 -0
- package/build/esm/observable/internal/Query.js +79 -6
- package/build/esm/observable/internal/Query.js.map +1 -1
- package/build/esm/observable/internal/RefCounts.js +7 -2
- package/build/esm/observable/internal/RefCounts.js.map +1 -1
- package/build/esm/observable/internal/SimpleWhereClause.js +2 -0
- package/build/esm/observable/internal/SimpleWhereClause.js.map +1 -0
- package/build/esm/observable/internal/Store.js +140 -190
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/Store.test.js +666 -300
- package/build/esm/observable/internal/Store.test.js.map +1 -1
- package/build/esm/observable/internal/WhereClauseCanonicalizer.js +11 -3
- package/build/esm/observable/internal/WhereClauseCanonicalizer.js.map +1 -1
- package/build/esm/observable/internal/objectMatchesWhereClause.js +0 -4
- package/build/esm/observable/internal/objectMatchesWhereClause.js.map +1 -1
- package/build/esm/observable/internal/objectMatchesWhereClause.test.js.map +1 -1
- package/build/esm/observable/internal/testUtils.js +222 -19
- package/build/esm/observable/internal/testUtils.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/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/public-utils/vite-env.d.ts +19 -0
- package/build/esm/queries/applyQuery.js +34 -2
- package/build/esm/queries/applyQuery.js.map +1 -1
- package/build/esm/queries/queries.test.js +36 -13
- 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/UserAgent.js.map +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/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 +14 -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 +25 -2
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/build/types/Client.d.ts +1 -1
- package/build/types/Client.d.ts.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 +5 -5
- 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/AttachmentUpload.d.ts +3 -0
- package/build/types/object/AttachmentUpload.d.ts.map +1 -1
- package/build/types/object/SimpleOsdkProperties.d.ts +1 -0
- package/build/types/object/SimpleOsdkProperties.d.ts.map +1 -0
- package/build/types/object/convertWireToOsdkObjects/BaseHolder.d.ts +1 -0
- package/build/types/object/convertWireToOsdkObjects/BaseHolder.d.ts.map +1 -0
- package/build/types/object/convertWireToOsdkObjects.d.ts +8 -1
- 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/ListPayload.d.ts +5 -9
- package/build/types/observable/ListPayload.d.ts.map +1 -1
- package/build/types/observable/ObjectPayload.d.ts +4 -7
- package/build/types/observable/ObjectPayload.d.ts.map +1 -1
- package/build/types/observable/ObservableClient.d.ts +33 -10
- package/build/types/observable/ObservableClient.d.ts.map +1 -1
- package/build/types/observable/OptimisticBuilder.d.ts +1 -1
- package/build/types/observable/OptimisticBuilder.d.ts.map +1 -1
- package/build/types/observable/internal/ActionApplication.d.ts +9 -0
- package/build/types/observable/internal/ActionApplication.d.ts.map +1 -0
- 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/CacheKeys.d.ts +2 -1
- package/build/types/observable/internal/CacheKeys.d.ts.map +1 -1
- package/build/types/observable/internal/Changes.d.ts +15 -0
- package/build/types/observable/internal/Changes.d.ts.map +1 -0
- package/build/types/observable/internal/Layer.d.ts +2 -1
- package/build/types/observable/internal/Layer.d.ts.map +1 -1
- package/build/types/observable/internal/ListQuery.d.ts +69 -23
- package/build/types/observable/internal/ListQuery.d.ts.map +1 -1
- package/build/types/observable/internal/ObjectQuery.d.ts +8 -9
- package/build/types/observable/internal/ObjectQuery.d.ts.map +1 -1
- package/build/types/observable/internal/OptimisticJob.d.ts +2 -2
- package/build/types/observable/internal/OptimisticJob.d.ts.map +1 -1
- package/build/types/observable/internal/OrderByCanonicalizer.d.ts +12 -0
- package/build/types/observable/internal/OrderByCanonicalizer.d.ts.map +1 -0
- package/build/types/observable/internal/OrderByCanonicalizer.test.d.ts +1 -0
- package/build/types/observable/internal/OrderByCanonicalizer.test.d.ts.map +1 -0
- package/build/types/observable/internal/Query.d.ts +45 -9
- package/build/types/observable/internal/Query.d.ts.map +1 -1
- package/build/types/observable/internal/RefCounts.d.ts.map +1 -1
- package/build/types/observable/internal/SimpleWhereClause.d.ts +2 -0
- package/build/types/observable/internal/SimpleWhereClause.d.ts.map +1 -0
- package/build/types/observable/internal/Store.d.ts +34 -30
- package/build/types/observable/internal/Store.d.ts.map +1 -1
- package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts +2 -1
- package/build/types/observable/internal/WhereClauseCanonicalizer.d.ts.map +1 -1
- package/build/types/observable/internal/objectMatchesWhereClause.d.ts +4 -2
- package/build/types/observable/internal/objectMatchesWhereClause.d.ts.map +1 -1
- package/build/types/observable/internal/testUtils.d.ts +48 -9
- package/build/types/observable/internal/testUtils.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 -5
- 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 +4 -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/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 +20 -16
- package/build/browser/Logger.js +0 -2
- package/build/browser/Logger.js.map +0 -1
- package/build/browser/observable/internal/ChangedObjects.js.map +0 -1
- package/build/cjs/chunk-Q7SFCCGT.cjs +0 -11
- package/build/cjs/chunk-Q7SFCCGT.cjs.map +0 -1
- package/build/cjs/chunk-T5UE6BI7.cjs.map +0 -1
- package/build/cjs/chunk-X7WGNFZ4.cjs.map +0 -1
- package/build/cjs/graphql-JJX5MZPQ.cjs +0 -10491
- package/build/cjs/graphql-JJX5MZPQ.cjs.map +0 -1
- package/build/esm/Logger.js +0 -2
- package/build/esm/Logger.js.map +0 -1
- package/build/esm/observable/internal/ChangedObjects.js.map +0 -1
- package/build/types/Logger.d.ts +0 -18
- package/build/types/Logger.d.ts.map +0 -1
- package/build/types/observable/internal/ChangedObjects.d.ts +0 -7
- package/build/types/observable/internal/ChangedObjects.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modernToLegacyGroupByClause.js","names":["DurationMapping","modernToLegacyGroupByClause","groupByClause","Object","entries","flatMap","field","type","maxGroupCount","$exactWithLimit","fixedWidth","$fixedWidth","ranges","$ranges","map","range","convertRange","value","$duration","unit","startValue","endValue"],"sources":["modernToLegacyGroupByClause.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 { AllGroupByValues, GroupByClause, GroupByRange } from \"@osdk/api\";\nimport { DurationMapping } from \"@osdk/api\";\nimport type {\n AggregationGroupByV2,\n AggregationRangeV2,\n} from \"@osdk/foundry.ontologies\";\n\n/** @internal */\nexport function modernToLegacyGroupByClause(\n groupByClause: GroupByClause<any> | undefined,\n) {\n if (!groupByClause) return [];\n\n return Object.entries(\n groupByClause as Record<string, AllGroupByValues>,\n ).flatMap<AggregationGroupByV2>(([field, type]) => {\n if (type === \"exact\") {\n return [{ type, field }];\n } else if (\"$exactWithLimit\" in type) {\n {\n return [\n {\n type: \"exact\",\n field,\n maxGroupCount: type.$exactWithLimit,\n },\n ];\n }\n } else if (\"$fixedWidth\" in type) {\n return [{\n type: \"fixedWidth\",\n field,\n fixedWidth: type.$fixedWidth,\n }];\n } else if (\"$ranges\" in type) {\n return [{\n type: \"ranges\",\n field,\n ranges: type.$ranges.map(range => convertRange(range)),\n }];\n } else if (\"$duration\" in type) {\n return [{\n type: \"duration\",\n field,\n value: type.$duration[0],\n unit: DurationMapping[type.$duration[1]],\n }];\n } else return [];\n });\n}\n\nfunction convertRange(\n range: GroupByRange<number | string>,\n): AggregationRangeV2 {\n return { startValue: range[0], endValue: range[1] };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,WAAW;AAM3C;AACA,OAAO,SAASC,2BAA2BA,CACzCC,aAA6C,EAC7C;EACA,IAAI,CAACA,aAAa,EAAE,OAAO,EAAE;EAE7B,OAAOC,MAAM,CAACC,OAAO,CACnBF,aACF,CAAC,CAACG,OAAO,CAAuB,CAAC,CAACC,KAAK,EAAEC,IAAI,CAAC,KAAK;IACjD,IAAIA,IAAI,KAAK,OAAO,EAAE;MACpB,OAAO,CAAC;QAAEA,IAAI;QAAED;MAAM,CAAC,CAAC;IAC1B,CAAC,MAAM,IAAI,iBAAiB,IAAIC,IAAI,EAAE;MACpC;QACE,OAAO,CACL;UACEA,IAAI,EAAE,OAAO;UACbD,KAAK;UACLE,aAAa,EAAED,IAAI,CAACE;QACtB,CAAC,CACF;MACH;IACF,CAAC,MAAM,IAAI,aAAa,IAAIF,IAAI,EAAE;MAChC,OAAO,CAAC;QACNA,IAAI,EAAE,YAAY;QAClBD,KAAK;
|
|
1
|
+
{"version":3,"file":"modernToLegacyGroupByClause.js","names":["DurationMapping","modernToLegacyGroupByClause","groupByClause","Object","entries","flatMap","field","type","maxGroupCount","$exactWithLimit","$exact","$limit","undefined","defaultValue","$defaultValue","fixedWidth","$fixedWidth","ranges","$ranges","map","range","convertRange","value","$duration","unit","startValue","endValue"],"sources":["modernToLegacyGroupByClause.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 { AllGroupByValues, GroupByClause, GroupByRange } from \"@osdk/api\";\nimport { DurationMapping } from \"@osdk/api\";\nimport type {\n AggregationGroupByV2,\n AggregationRangeV2,\n} from \"@osdk/foundry.ontologies\";\n\n/** @internal */\nexport function modernToLegacyGroupByClause(\n groupByClause: GroupByClause<any> | undefined,\n) {\n if (!groupByClause) return [];\n\n return Object.entries(\n groupByClause as Record<string, AllGroupByValues>,\n ).flatMap<AggregationGroupByV2>(([field, type]) => {\n if (type === \"exact\") {\n return [{ type, field }];\n } else if (\"$exactWithLimit\" in type) {\n {\n return [\n {\n type: \"exact\",\n field,\n maxGroupCount: type.$exactWithLimit,\n },\n ];\n }\n } else if (\"$exact\" in type) {\n return [\n {\n type: \"exact\",\n field,\n maxGroupCount: type.$exact?.$limit ?? undefined,\n defaultValue: type.$exact.$defaultValue ?? undefined,\n },\n ];\n } else if (\"$fixedWidth\" in type) {\n return [{\n type: \"fixedWidth\",\n field,\n fixedWidth: type.$fixedWidth,\n }];\n } else if (\"$ranges\" in type) {\n return [{\n type: \"ranges\",\n field,\n ranges: type.$ranges.map(range => convertRange(range)),\n }];\n } else if (\"$duration\" in type) {\n return [{\n type: \"duration\",\n field,\n value: type.$duration[0],\n unit: DurationMapping[type.$duration[1]],\n }];\n } else return [];\n });\n}\n\nfunction convertRange(\n range: GroupByRange<number | string>,\n): AggregationRangeV2 {\n return { startValue: range[0], endValue: range[1] };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,eAAe,QAAQ,WAAW;AAM3C;AACA,OAAO,SAASC,2BAA2BA,CACzCC,aAA6C,EAC7C;EACA,IAAI,CAACA,aAAa,EAAE,OAAO,EAAE;EAE7B,OAAOC,MAAM,CAACC,OAAO,CACnBF,aACF,CAAC,CAACG,OAAO,CAAuB,CAAC,CAACC,KAAK,EAAEC,IAAI,CAAC,KAAK;IACjD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EAAEL,KAAK,CAAC,CAAC,CAAC;IAAEM,QAAQ,EAAEN,KAAK,CAAC,CAAC;EAAE,CAAC;AACrD","ignoreList":[]}
|
|
@@ -109,7 +109,7 @@ function handleWherePair([fieldName, filter], objectOrInterface, structFieldSele
|
|
|
109
109
|
// If any of the keys start with `$` then they must be the only one.
|
|
110
110
|
// e.g. `where({ name: { $eq: "foo", $ne: "bar" } })` is invalid currently
|
|
111
111
|
const hasDollarSign = keysOfFilter.some(key => key.startsWith("$"));
|
|
112
|
-
!(!hasDollarSign || keysOfFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "WhereClause Filter with multiple clauses
|
|
112
|
+
!(!hasDollarSign || keysOfFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "A WhereClause Filter with multiple clauses/fields is not allowed. Instead, use an 'or'/'and' clause to combine multiple filters.") : invariant(false) : void 0;
|
|
113
113
|
if (!hasDollarSign) {
|
|
114
114
|
const structFilter = Object.entries(filter);
|
|
115
115
|
!(structFilter.length === 1) ? process.env.NODE_ENV !== "production" ? invariant(false, "Cannot filter on more than one struct field in the same clause, need to use an and clause") : invariant(false) : void 0;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modernToLegacyWhereClause.js","names":["DistanceUnitMapping","invariant","extractNamespace","fqApiName","last","lastIndexOf","undefined","slice","modernToLegacyWhereClause","whereClause","objectOrInterface","type","value","$and","map","clause","$or","$not","parts","Object","entries","length","handleWherePair","v","makeGeoFilterBbox","bbox","filterType","propertyIdentifier","field","topLeft","coordinates","bottomRight","makeGeoFilterPolygon","fieldName","filter","structFieldSelector","process","env","NODE_ENV","propertyApiName","fullyQualifyPropName","keysOfFilter","keys","hasDollarSign","some","key","startsWith","structFilter","structFieldApiName","firstKey","withinBody","Array","isArray","$bbox","$distance","$of","center","distance","unit","$polygon","intersectsBody","substring","fuzzy","objApiNamespace","apiName","fieldApiNamespace","fieldShortName"],"sources":["modernToLegacyWhereClause.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 GeoFilterOptions,\n ObjectOrInterfaceDefinition,\n PossibleWhereClauseFilters,\n WhereClause,\n} from \"@osdk/api\";\nimport { DistanceUnitMapping } from \"@osdk/api\";\n\nimport type {\n PropertyIdentifier,\n SearchJsonQueryV2,\n} from \"@osdk/foundry.ontologies\";\nimport type { BBox, Position } from \"geojson\";\nimport invariant from \"tiny-invariant\";\n\nexport function extractNamespace(\n fqApiName: string,\n): [string | undefined, string] {\n const last = fqApiName.lastIndexOf(\".\");\n if (last === -1) return [undefined, fqApiName];\n return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];\n}\n\n/** @internal */\nexport function modernToLegacyWhereClause<\n T extends ObjectOrInterfaceDefinition,\n>(\n whereClause: WhereClause<T>,\n objectOrInterface: T,\n): SearchJsonQueryV2 {\n if (\"$and\" in whereClause) {\n return {\n type: \"and\",\n value: (whereClause.$and as WhereClause<T>[]).map(\n (clause) => modernToLegacyWhereClause(clause, objectOrInterface),\n ),\n };\n } else if (\"$or\" in whereClause) {\n return {\n type: \"or\",\n value: (whereClause.$or as WhereClause<T>[]).map(\n (clause) => modernToLegacyWhereClause(clause, objectOrInterface),\n ),\n };\n } else if (\"$not\" in whereClause) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(\n whereClause.$not as WhereClause<T>,\n objectOrInterface,\n ),\n };\n }\n\n const parts = Object.entries(whereClause);\n\n if (parts.length === 1) {\n return handleWherePair(parts[0], objectOrInterface);\n }\n\n return {\n type: \"and\",\n value: parts.map<SearchJsonQueryV2>(\n v => handleWherePair(v, objectOrInterface),\n ),\n };\n}\n\nfunction makeGeoFilterBbox(\n bbox: BBox,\n filterType: \"$within\" | \"$intersects\",\n propertyIdentifier?: PropertyIdentifier,\n field?: string,\n): SearchJsonQueryV2 {\n return {\n type: filterType === \"$within\"\n ? \"withinBoundingBox\"\n : \"intersectsBoundingBox\",\n /**\n * This is a bit ugly, but did this so that propertyIdentifier only shows up in the return object if its defined,\n * this makes it so we don't need to go update our entire test bed either to include a field which may change in near future.\n * Once we solidify that this is the way forward, I can remove field and clean this up\n */\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: {\n topLeft: {\n type: \"Point\",\n coordinates: [bbox[0], bbox[3]],\n },\n bottomRight: {\n type: \"Point\",\n coordinates: [bbox[2], bbox[1]],\n },\n },\n };\n}\n\nfunction makeGeoFilterPolygon(\n coordinates: Position[][],\n filterType: \"intersectsPolygon\" | \"withinPolygon\",\n propertyIdentifier?: PropertyIdentifier,\n field?: string,\n): SearchJsonQueryV2 {\n return {\n type: filterType,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: {\n type: \"Polygon\",\n coordinates,\n },\n };\n}\n\nfunction handleWherePair(\n [fieldName, filter]: [string, any],\n objectOrInterface: ObjectOrInterfaceDefinition,\n structFieldSelector?: { propertyApiName: string; structFieldApiName: string },\n): SearchJsonQueryV2 {\n invariant(\n filter != null,\n \"Defined key values are only allowed when they are not undefined.\",\n );\n\n const propertyIdentifier: PropertyIdentifier | undefined =\n structFieldSelector != null\n ? {\n type: \"structField\",\n ...structFieldSelector,\n propertyApiName: fullyQualifyPropName(\n structFieldSelector.propertyApiName,\n objectOrInterface,\n ),\n }\n : undefined;\n const field = structFieldSelector == null\n ? fullyQualifyPropName(fieldName, objectOrInterface)\n : undefined;\n\n if (\n typeof filter === \"string\" || typeof filter === \"number\"\n || typeof filter === \"boolean\"\n ) {\n propertyIdentifier;\n return {\n type: \"eq\",\n ...(propertyIdentifier != null\n && { propertyIdentifier }),\n field,\n value: filter,\n };\n }\n\n const keysOfFilter = Object.keys(filter);\n\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some((key) => key.startsWith(\"$\"));\n invariant(\n !hasDollarSign\n || keysOfFilter.length === 1,\n \"WhereClause Filter with multiple clauses isn't allowed\",\n );\n\n if (!hasDollarSign) {\n const structFilter = Object.entries(filter);\n invariant(\n structFilter.length === 1,\n \"Cannot filter on more than one struct field in the same clause, need to use an and clause\",\n );\n const structFieldApiName = keysOfFilter[0];\n return handleWherePair(Object.entries(filter)[0], objectOrInterface, {\n propertyApiName: fieldName,\n structFieldApiName,\n });\n }\n\n const firstKey = keysOfFilter[0] as PossibleWhereClauseFilters;\n invariant(filter[firstKey] != null);\n\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: filter[firstKey],\n },\n };\n }\n\n if (firstKey === \"$within\") {\n const withinBody = filter[firstKey] as GeoFilterOptions[\"$within\"];\n\n if (Array.isArray(withinBody)) {\n return makeGeoFilterBbox(withinBody, firstKey, propertyIdentifier, field);\n } else if (\"$bbox\" in withinBody && withinBody.$bbox != null) {\n return makeGeoFilterBbox(\n withinBody.$bbox,\n firstKey,\n propertyIdentifier,\n field,\n );\n } else if (\n (\"$distance\" in withinBody && \"$of\" in withinBody)\n && withinBody.$distance != null\n && withinBody.$of != null\n ) {\n return {\n type: \"withinDistanceOf\",\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: {\n center: Array.isArray(withinBody.$of)\n ? {\n type: \"Point\",\n coordinates: withinBody.$of,\n }\n : withinBody.$of,\n distance: {\n value: withinBody.$distance[0],\n unit: DistanceUnitMapping[withinBody.$distance[1]],\n },\n },\n };\n } else {\n const coordinates = (\"$polygon\" in withinBody)\n ? withinBody.$polygon\n : withinBody.coordinates;\n return makeGeoFilterPolygon(\n coordinates,\n \"withinPolygon\",\n propertyIdentifier,\n fieldName,\n );\n }\n }\n if (firstKey === \"$intersects\") {\n const intersectsBody = filter[firstKey] as GeoFilterOptions[\"$intersects\"];\n if (Array.isArray(intersectsBody)) {\n return makeGeoFilterBbox(\n intersectsBody,\n firstKey,\n propertyIdentifier,\n field,\n );\n } else if (\"$bbox\" in intersectsBody && intersectsBody.$bbox != null) {\n return makeGeoFilterBbox(\n intersectsBody.$bbox,\n firstKey,\n propertyIdentifier,\n field,\n );\n } else {\n const coordinates = (\"$polygon\" in intersectsBody)\n ? intersectsBody.$polygon\n : intersectsBody.coordinates;\n return makeGeoFilterPolygon(\n coordinates,\n \"intersectsPolygon\",\n propertyIdentifier,\n field,\n );\n }\n }\n\n if (firstKey === \"$containsAllTerms\" || firstKey === \"$containsAnyTerm\") {\n return {\n type: firstKey.substring(1) as DropDollarSign<typeof firstKey>,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: typeof filter[firstKey] === \"string\"\n ? filter[firstKey]\n : filter[firstKey][\"term\"],\n fuzzy: typeof filter[firstKey] === \"string\"\n ? false\n : filter[firstKey][\"fuzzySearch\"] ?? false,\n };\n }\n\n return {\n type: firstKey.substring(1) as DropDollarSign<typeof firstKey>,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: filter[firstKey] as any,\n };\n}\n\ntype DropDollarSign<T extends `$${string}`> = T extends `$${infer U}` ? U\n : never;\n\nfunction fullyQualifyPropName(\n fieldName: string,\n objectOrInterface: ObjectOrInterfaceDefinition,\n) {\n if (objectOrInterface.type === \"interface\") {\n const [objApiNamespace] = extractNamespace(objectOrInterface.apiName);\n const [fieldApiNamespace, fieldShortName] = extractNamespace(fieldName);\n return (fieldApiNamespace == null && objApiNamespace != null)\n ? `${objApiNamespace}.${fieldShortName}`\n : fieldName;\n }\n return fieldName;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A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amespace","fqApiName","last","lastIndexOf","undefined","slice","modernToLegacyWhereClause","whereClause","objectOrInterface","type","value","$and","map","clause","$or","$not","parts","Object","entries","length","handleWherePair","v","makeGeoFilterBbox","bbox","filterType","propertyIdentifier","field","topLeft","coordinates","bottomRight","makeGeoFilterPolygon","fieldName","filter","structFieldSelector","process","env","NODE_ENV","propertyApiName","fullyQualifyPropName","keysOfFilter","keys","hasDollarSign","some","key","startsWith","structFilter","structFieldApiName","firstKey","withinBody","Array","isArray","$bbox","$distance","$of","center","distance","unit","$polygon","intersectsBody","substring","fuzzy","objApiNamespace","apiName","fieldApiNamespace","fieldShortName"],"sources":["modernToLegacyWhereClause.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 GeoFilterOptions,\n ObjectOrInterfaceDefinition,\n PossibleWhereClauseFilters,\n WhereClause,\n} from \"@osdk/api\";\nimport { DistanceUnitMapping } from \"@osdk/api\";\n\nimport type {\n PropertyIdentifier,\n SearchJsonQueryV2,\n} from \"@osdk/foundry.ontologies\";\nimport type { BBox, Position } from \"geojson\";\nimport invariant from \"tiny-invariant\";\n\nexport function extractNamespace(\n fqApiName: string,\n): [string | undefined, string] {\n const last = fqApiName.lastIndexOf(\".\");\n if (last === -1) return [undefined, fqApiName];\n return [fqApiName.slice(0, last), fqApiName.slice(last + 1)];\n}\n\n/** @internal */\nexport function modernToLegacyWhereClause<\n T extends ObjectOrInterfaceDefinition,\n>(\n whereClause: WhereClause<T>,\n objectOrInterface: T,\n): SearchJsonQueryV2 {\n if (\"$and\" in whereClause) {\n return {\n type: \"and\",\n value: (whereClause.$and as WhereClause<T>[]).map(\n (clause) => modernToLegacyWhereClause(clause, objectOrInterface),\n ),\n };\n } else if (\"$or\" in whereClause) {\n return {\n type: \"or\",\n value: (whereClause.$or as WhereClause<T>[]).map(\n (clause) => modernToLegacyWhereClause(clause, objectOrInterface),\n ),\n };\n } else if (\"$not\" in whereClause) {\n return {\n type: \"not\",\n value: modernToLegacyWhereClause(\n whereClause.$not as WhereClause<T>,\n objectOrInterface,\n ),\n };\n }\n\n const parts = Object.entries(whereClause);\n\n if (parts.length === 1) {\n return handleWherePair(parts[0], objectOrInterface);\n }\n\n return {\n type: \"and\",\n value: parts.map<SearchJsonQueryV2>(\n v => handleWherePair(v, objectOrInterface),\n ),\n };\n}\n\nfunction makeGeoFilterBbox(\n bbox: BBox,\n filterType: \"$within\" | \"$intersects\",\n propertyIdentifier?: PropertyIdentifier,\n field?: string,\n): SearchJsonQueryV2 {\n return {\n type: filterType === \"$within\"\n ? \"withinBoundingBox\"\n : \"intersectsBoundingBox\",\n /**\n * This is a bit ugly, but did this so that propertyIdentifier only shows up in the return object if its defined,\n * this makes it so we don't need to go update our entire test bed either to include a field which may change in near future.\n * Once we solidify that this is the way forward, I can remove field and clean this up\n */\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: {\n topLeft: {\n type: \"Point\",\n coordinates: [bbox[0], bbox[3]],\n },\n bottomRight: {\n type: \"Point\",\n coordinates: [bbox[2], bbox[1]],\n },\n },\n };\n}\n\nfunction makeGeoFilterPolygon(\n coordinates: Position[][],\n filterType: \"intersectsPolygon\" | \"withinPolygon\",\n propertyIdentifier?: PropertyIdentifier,\n field?: string,\n): SearchJsonQueryV2 {\n return {\n type: filterType,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: {\n type: \"Polygon\",\n coordinates,\n },\n };\n}\n\nfunction handleWherePair(\n [fieldName, filter]: [string, any],\n objectOrInterface: ObjectOrInterfaceDefinition,\n structFieldSelector?: { propertyApiName: string; structFieldApiName: string },\n): SearchJsonQueryV2 {\n invariant(\n filter != null,\n \"Defined key values are only allowed when they are not undefined.\",\n );\n\n const propertyIdentifier: PropertyIdentifier | undefined =\n structFieldSelector != null\n ? {\n type: \"structField\",\n ...structFieldSelector,\n propertyApiName: fullyQualifyPropName(\n structFieldSelector.propertyApiName,\n objectOrInterface,\n ),\n }\n : undefined;\n const field = structFieldSelector == null\n ? fullyQualifyPropName(fieldName, objectOrInterface)\n : undefined;\n\n if (\n typeof filter === \"string\" || typeof filter === \"number\"\n || typeof filter === \"boolean\"\n ) {\n propertyIdentifier;\n return {\n type: \"eq\",\n ...(propertyIdentifier != null\n && { propertyIdentifier }),\n field,\n value: filter,\n };\n }\n\n const keysOfFilter = Object.keys(filter);\n\n // If any of the keys start with `$` then they must be the only one.\n // e.g. `where({ name: { $eq: \"foo\", $ne: \"bar\" } })` is invalid currently\n const hasDollarSign = keysOfFilter.some((key) => key.startsWith(\"$\"));\n invariant(\n !hasDollarSign\n || keysOfFilter.length === 1,\n \"A WhereClause Filter with multiple clauses/fields is not allowed. Instead, use an 'or'/'and' clause to combine multiple filters.\",\n );\n\n if (!hasDollarSign) {\n const structFilter = Object.entries(filter);\n invariant(\n structFilter.length === 1,\n \"Cannot filter on more than one struct field in the same clause, need to use an and clause\",\n );\n const structFieldApiName = keysOfFilter[0];\n return handleWherePair(Object.entries(filter)[0], objectOrInterface, {\n propertyApiName: fieldName,\n structFieldApiName,\n });\n }\n\n const firstKey = keysOfFilter[0] as PossibleWhereClauseFilters;\n invariant(filter[firstKey] != null);\n\n if (firstKey === \"$ne\") {\n return {\n type: \"not\",\n value: {\n type: \"eq\",\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: filter[firstKey],\n },\n };\n }\n\n if (firstKey === \"$within\") {\n const withinBody = filter[firstKey] as GeoFilterOptions[\"$within\"];\n\n if (Array.isArray(withinBody)) {\n return makeGeoFilterBbox(withinBody, firstKey, propertyIdentifier, field);\n } else if (\"$bbox\" in withinBody && withinBody.$bbox != null) {\n return makeGeoFilterBbox(\n withinBody.$bbox,\n firstKey,\n propertyIdentifier,\n field,\n );\n } else if (\n (\"$distance\" in withinBody && \"$of\" in withinBody)\n && withinBody.$distance != null\n && withinBody.$of != null\n ) {\n return {\n type: \"withinDistanceOf\",\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: {\n center: Array.isArray(withinBody.$of)\n ? {\n type: \"Point\",\n coordinates: withinBody.$of,\n }\n : withinBody.$of,\n distance: {\n value: withinBody.$distance[0],\n unit: DistanceUnitMapping[withinBody.$distance[1]],\n },\n },\n };\n } else {\n const coordinates = (\"$polygon\" in withinBody)\n ? withinBody.$polygon\n : withinBody.coordinates;\n return makeGeoFilterPolygon(\n coordinates,\n \"withinPolygon\",\n propertyIdentifier,\n fieldName,\n );\n }\n }\n if (firstKey === \"$intersects\") {\n const intersectsBody = filter[firstKey] as GeoFilterOptions[\"$intersects\"];\n if (Array.isArray(intersectsBody)) {\n return makeGeoFilterBbox(\n intersectsBody,\n firstKey,\n propertyIdentifier,\n field,\n );\n } else if (\"$bbox\" in intersectsBody && intersectsBody.$bbox != null) {\n return makeGeoFilterBbox(\n intersectsBody.$bbox,\n firstKey,\n propertyIdentifier,\n field,\n );\n } else {\n const coordinates = (\"$polygon\" in intersectsBody)\n ? intersectsBody.$polygon\n : intersectsBody.coordinates;\n return makeGeoFilterPolygon(\n coordinates,\n \"intersectsPolygon\",\n propertyIdentifier,\n field,\n );\n }\n }\n\n if (firstKey === \"$containsAllTerms\" || firstKey === \"$containsAnyTerm\") {\n return {\n type: firstKey.substring(1) as DropDollarSign<typeof firstKey>,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: typeof filter[firstKey] === \"string\"\n ? filter[firstKey]\n : filter[firstKey][\"term\"],\n fuzzy: typeof filter[firstKey] === \"string\"\n ? false\n : filter[firstKey][\"fuzzySearch\"] ?? false,\n };\n }\n\n return {\n type: firstKey.substring(1) as DropDollarSign<typeof firstKey>,\n ...(propertyIdentifier != null && { propertyIdentifier }),\n field,\n value: filter[firstKey] as any,\n };\n}\n\ntype DropDollarSign<T extends `$${string}`> = T extends `$${infer U}` ? U\n : never;\n\nfunction fullyQualifyPropName(\n fieldName: string,\n objectOrInterface: ObjectOrInterfaceDefinition,\n) {\n if (objectOrInterface.type === \"interface\") {\n const [objApiNamespace] = extractNamespace(objectOrInterface.apiName);\n const [fieldApiNamespace, fieldShortName] = extractNamespace(fieldName);\n return (fieldApiNamespace == null && objApiNamespace != null)\n ? `${objApiNamespace}.${fieldShortName}`\n : fieldName;\n }\n return fieldName;\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SAASA,mBAAmB,QAAQ,WAAW;AAO/C,OAAOC,SAAS,MAAM,gBAAgB;AAEtC,OAAO,SAASC,gBAAgBA,CAC9BC,SAAiB,EACa;EAC9B,MAAMC,IAAI,GAAGD,SAAS,CAACE,WAAW,CAAC,GAAG,CAAC;EACvC,IAAID,IAAI,KAAK,CAAC,CAAC,EAAE,OAAO,CAACE,SAAS,EAAEH,SAAS,CAAC;EAC9C,OAAO,CAACA,SAAS,CAACI,KAAK,CAAC,CAAC,EAAEH,IAAI,CAAC,EAAED,SAAS,CAACI,KAAK,CAACH,IAAI,GAAG,CAAC,CAAC,CAAC;AAC9D;;AAEA;AACA,OAAO,SAASI,yBAAyBA,CAGvCC,WAA2B,EAC3BC,iBAAoB,EACD;EACnB,IAAI,MAAM,IAAID,WAAW,EAAE;IACzB,OAAO;MACLE,IAAI,EAAE,KAAK;MACXC,KAAK,EAAGH,WAAW,CAACI,IAAI,CAAsBC,GAAG,CAC9CC,MAAM,IAAKP,yBAAyB,CAACO,MAAM,EAAEL,iBAAiB,CACjE;IACF,CAAC;EACH,CAAC,MAAM,IAAI,KAAK,IAAID,WAAW,EAAE;IAC/B,OAAO;MACLE,IAAI,EAAE,IAAI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vB,iBAA8C,EAC9C;EACA,IAAIA,iBAAiB,CAACC,IAAI,KAAK,WAAW,EAAE;IAC1C,MAAM,CAACoD,eAAe,CAAC,GAAG7D,gBAAgB,CAACQ,iBAAiB,CAACsD,OAAO,CAAC;IACrE,MAAM,CAACC,iBAAiB,EAAEC,cAAc,CAAC,GAAGhE,gBAAgB,CAAC+B,SAAS,CAAC;IACvE,OAAQgC,iBAAiB,IAAI,IAAI,IAAIF,eAAe,IAAI,IAAI,GACxD,GAAGA,eAAe,IAAIG,cAAc,EAAE,GACtCjC,SAAS;EACf;EACA,OAAOA,SAAS;AAClB","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,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C,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;EAA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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]}
|
|
@@ -0,0 +1,60 @@
|
|
|
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 { beforeEach, describe, expect, it, vi } from "vitest";
|
|
18
|
+
import { MinimalLogger } from "./MinimalLogger.js";
|
|
19
|
+
const orderedLevels = ["trace", "debug", "info", "warn", "error", "fatal"];
|
|
20
|
+
describe(MinimalLogger, () => {
|
|
21
|
+
const consoleMocks = Object.fromEntries(["log", "error", "warn", "trace"].map(name => [name, vi.spyOn(console, name)]));
|
|
22
|
+
beforeEach(() => {
|
|
23
|
+
for (const consoleMock of Object.values(consoleMocks)) {
|
|
24
|
+
consoleMock.mockClear();
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
it("does not debug log by default", () => {
|
|
28
|
+
const logger = new MinimalLogger();
|
|
29
|
+
logger.debug("hi");
|
|
30
|
+
for (const consoleMock of Object.values(consoleMocks)) {
|
|
31
|
+
expect(consoleMock).not.toHaveBeenCalled();
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
it("can log", () => {
|
|
35
|
+
new MinimalLogger({}, {});
|
|
36
|
+
});
|
|
37
|
+
describe.for(orderedLevels)("For level %s", level => {
|
|
38
|
+
const idx = orderedLevels.findIndex(a => a === level);
|
|
39
|
+
expect(idx).toBeGreaterThan(-1);
|
|
40
|
+
const shouldNotOutput = orderedLevels.slice(0, idx);
|
|
41
|
+
const shouldOutput = orderedLevels.slice(idx);
|
|
42
|
+
const x = [...shouldNotOutput.map(x => [x, false]), ...shouldOutput.map(x => [x, true])];
|
|
43
|
+
it.for(x)("It should log for %s? %s", ([levelToCheck, shouldLog]) => {
|
|
44
|
+
const logger = new MinimalLogger({}, {
|
|
45
|
+
level
|
|
46
|
+
});
|
|
47
|
+
logger[levelToCheck]("logging");
|
|
48
|
+
let calls = 0;
|
|
49
|
+
for (const consoleMock of Object.values(consoleMocks)) {
|
|
50
|
+
calls += consoleMock.mock.calls.length;
|
|
51
|
+
}
|
|
52
|
+
if (shouldLog) {
|
|
53
|
+
expect(calls === 1, `Should log one time but got ${calls}`);
|
|
54
|
+
} else {
|
|
55
|
+
expect(calls === 0, "should not call console.thing");
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
//# sourceMappingURL=MinimalLogger.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MinimalLogger.test.js","names":["beforeEach","describe","expect","it","vi","MinimalLogger","orderedLevels","consoleMocks","Object","fromEntries","map","name","spyOn","console","consoleMock","values","mockClear","logger","debug","not","toHaveBeenCalled","for","level","idx","findIndex","a","toBeGreaterThan","shouldNotOutput","slice","shouldOutput","x","levelToCheck","shouldLog","calls","mock","length"],"sources":["MinimalLogger.test.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { MockInstance } from \"vitest\";\nimport { beforeEach, describe, expect, it, vi } from \"vitest\";\nimport { MinimalLogger } from \"./MinimalLogger.js\";\n\nconst orderedLevels = [\n \"trace\",\n \"debug\",\n \"info\",\n \"warn\",\n \"error\",\n \"fatal\",\n] as const;\n\ndescribe(MinimalLogger, () => {\n const consoleTypes = [\"log\", \"error\", \"warn\", \"trace\"] as const;\n type consoleTypes = typeof consoleTypes[number];\n\n const consoleMocks = Object.fromEntries(\n consoleTypes.map(name =>\n [name, vi.spyOn(console, name)] as [consoleTypes, MockInstance<any>]\n ),\n ) as Record<\n typeof consoleTypes[number],\n MockInstance<any>\n >;\n\n beforeEach(() => {\n for (const consoleMock of Object.values(consoleMocks)) {\n consoleMock.mockClear();\n }\n });\n\n it(\"does not debug log by default\", () => {\n const logger = new MinimalLogger();\n logger.debug(\"hi\");\n\n for (const consoleMock of Object.values(consoleMocks)) {\n expect(consoleMock).not.toHaveBeenCalled();\n }\n });\n\n it(\"can log\", () => {\n new MinimalLogger({}, {});\n });\n\n describe.for(orderedLevels)(\"For level %s\", (level) => {\n const idx = orderedLevels.findIndex(a => a === level);\n expect(idx).toBeGreaterThan(-1);\n\n const shouldNotOutput = orderedLevels.slice(0, idx);\n const shouldOutput = orderedLevels.slice(idx);\n\n const x = [\n ...shouldNotOutput.map(x => [x, false] as const),\n ...shouldOutput.map(x => [x, true] as const),\n ];\n\n it.for(x)(\"It should log for %s? %s\", ([levelToCheck, shouldLog]) => {\n const logger = new MinimalLogger({}, { level });\n\n logger[levelToCheck](\"logging\");\n\n let calls = 0;\n\n for (const consoleMock of Object.values(consoleMocks)) {\n calls += consoleMock.mock.calls.length;\n }\n\n if (shouldLog) {\n expect(calls === 1, `Should log one time but got ${calls}`);\n } else {\n expect(calls === 0, \"should not call console.thing\");\n }\n });\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAC7D,SAASC,aAAa,QAAQ,oBAAoB;AAElD,MAAMC,aAAa,GAAG,CACpB,OAAO,EACP,OAAO,EACP,MAAM,EACN,MAAM,EACN,OAAO,EACP,OAAO,CACC;AAEVL,QAAQ,CAACI,aAAa,EAAE,MAAM;EAI5B,MAAME,YAAY,GAAGC,MAAM,CAACC,WAAW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CAAC,EAAE,KAAK,CAAU,CAAC,EAChD,GAAGD,YAAY,CAACnB,GAAG,CAACoB,CAAC,IAAI,CAACA,CAAC,EAAE,IAAI,CAAU,CAAC,CAC7C;IAED3B,EAAE,CAACkB,GAAG,CAACS,CAAC,CAAC,CAAC,0BAA0B,EAAE,CAAC,CAACC,YAAY,EAAEC,SAAS,CAAC,KAAK;MACnE,MAAMf,MAAM,GAAG,IAAIZ,aAAa,CAAC,CAAC,CAAC,EAAE;QAAEiB;MAAM,CAAC,CAAC;MAE/CL,MAAM,CAACc,YAAY,CAAC,CAAC,SAAS,CAAC;MAE/B,IAAIE,KAAK,GAAG,CAAC;MAEb,KAAK,MAAMnB,WAAW,IAAIN,MAAM,CAACO,MAAM,CAACR,YAAY,CAAC,EAAE;QACrD0B,KAAK,IAAInB,WAAW,CAACoB,IAAI,CAACD,KAAK,CAACE,MAAM;MACxC;MAEA,IAAIH,SAAS,EAAE;QACb9B,MAAM,CAAC+B,KAAK,KAAK,CAAC,EAAE,+BAA+BA,KAAK,EAAE,CAAC;MAC7D,CAAC,MAAM;QACL/B,MAAM,CAAC+B,KAAK,KAAK,CAAC,EAAE,+BAA+B,CAAC;MACtD;IACF,CAAC,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 { Chalk } from "chalk";
|
|
18
|
+
import { vi } from "vitest";
|
|
19
|
+
import { BaseLogger } from "./BaseLogger.js";
|
|
20
|
+
const chalk = new Chalk(); // new Chalk({ level: 3 });
|
|
21
|
+
|
|
22
|
+
const colors = {
|
|
23
|
+
debug: [chalk.cyan, chalk.bgCyan],
|
|
24
|
+
info: [chalk.green, chalk.bgGreen],
|
|
25
|
+
trace: [chalk.gray, chalk.bgGray],
|
|
26
|
+
error: [chalk.red, chalk.bgRed],
|
|
27
|
+
warn: [chalk.yellow, chalk.bgYellow],
|
|
28
|
+
fatal: [chalk.redBright, chalk.bgRedBright]
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* A logger suitable for using in unit tests.
|
|
33
|
+
* - It uses chalk for colors (Node and browser console.log supports)
|
|
34
|
+
* - Does not rely on async behavior of `pino`.
|
|
35
|
+
*/
|
|
36
|
+
export class TestLogger extends BaseLogger {
|
|
37
|
+
constructor(bindings = {}, options = {}) {
|
|
38
|
+
super(bindings, {
|
|
39
|
+
...options,
|
|
40
|
+
level: options.level ?? "error"
|
|
41
|
+
}, TestLogger);
|
|
42
|
+
}
|
|
43
|
+
createLogMethod(name, bindings) {
|
|
44
|
+
const msgs = [colors[name][1](name)];
|
|
45
|
+
if (this.options?.msgPrefix) {
|
|
46
|
+
msgs.push(colors[name][0](this.options.msgPrefix));
|
|
47
|
+
}
|
|
48
|
+
if (typeof bindings === "object" && "methodName" in bindings) {
|
|
49
|
+
msgs.push(chalk.magenta(`.${bindings.methodName}()`));
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// eslint-disable-next-line no-console
|
|
53
|
+
return vi.fn(console[name === "fatal" ? "error" : name].bind(console, msgs.join(" ")));
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=TestLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TestLogger.js","names":["Chalk","vi","BaseLogger","chalk","colors","debug","cyan","bgCyan","info","green","bgGreen","trace","gray","bgGray","error","red","bgRed","warn","yellow","bgYellow","fatal","redBright","bgRedBright","TestLogger","constructor","bindings","options","level","createLogMethod","name","msgs","msgPrefix","push","magenta","methodName","fn","console","bind","join"],"sources":["TestLogger.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 { Chalk } from \"chalk\";\nimport { vi } from \"vitest\";\nimport { BaseLogger } from \"./BaseLogger.js\";\n\nconst chalk = new Chalk(); // new Chalk({ level: 3 });\n\nconst colors = {\n debug: [chalk.cyan, chalk.bgCyan],\n info: [chalk.green, chalk.bgGreen],\n trace: [chalk.gray, chalk.bgGray],\n error: [chalk.red, chalk.bgRed],\n warn: [chalk.yellow, chalk.bgYellow],\n fatal: [chalk.redBright, chalk.bgRedBright],\n} as const;\n\n/**\n * A logger suitable for using in unit tests.\n * - It uses chalk for colors (Node and browser console.log supports)\n * - Does not rely on async behavior of `pino`.\n */\nexport class TestLogger 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 TestLogger,\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[] = [colors[name][1](name)];\n\n if (this.options?.msgPrefix) {\n msgs.push(colors[name][0](this.options.msgPrefix));\n }\n\n if (typeof bindings === \"object\" && \"methodName\" in bindings) {\n msgs.push(chalk.magenta(`.${bindings.methodName}()`));\n }\n\n // eslint-disable-next-line no-console\n return vi.fn<Logger.LogFn>(console[name === \"fatal\" ? \"error\" : name].bind(\n console,\n msgs.join(\" \"),\n )) as Logger.LogFn;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,KAAK,QAAQ,OAAO;AAC7B,SAASC,EAAE,QAAQ,QAAQ;AAC3B,SAASC,UAAU,QAAQ,iBAAiB;AAE5C,MAAMC,KAAK,GAAG,IAAIH,KAAK,CAAC,CAAC,CAAC,CAAC;;AAE3B,MAAMI,MAAM,GAAG;EACbC,KAAK,EAAE,CAACF,KAAK,CAACG,IAAI,EAAEH,KAAK,CAACI,MAAM,CAAC;EACjCC,IAAI,EAAE,CAACL,KAAK,CAACM,KAAK,EAAEN,KAAK,CAACO,OAAO,CAAC;EAClCC,KAAK,EAAE,CAACR,KAAK,CAACS,IAAI,EAAET,KAAK,CAACU,MAAM,CAAC;EACjCC,KAAK,EAAE,CAACX,KAAK,CAACY,GAAG,EAAEZ,KAAK,CAACa,KAAK,CAAC;EAC/BC,IAAI,EAAE,CAACd,KAAK,CAACe,MAAM,EAAEf,KAAK,CAACgB,QAAQ,CAAC;EACpCC,KAAK,EAAE,CAACjB,KAAK,CAACkB,SAAS,EAAElB,KAAK,CAACmB,WAAW;AAC5C,CAAU;;AAEV;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAAU,SAASrB,UAAU,CAAmB;EAC3DsB,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,UACF,CAAC;EACH;EAEUK,eAAeA,CACvBC,IAA6D,EAC7DJ,QAA6B,EACf;IACd,MAAMK,IAAc,GAAG,CAAC1B,MAAM,CAACyB,IAAI,CAAC,CAAC,CAAC,CAAC,CAACA,IAAI,CAAC,CAAC;IAE9C,IAAI,IAAI,CAACH,OAAO,EAAEK,SAAS,EAAE;MAC3BD,IAAI,CAACE,IAAI,CAAC5B,MAAM,CAACyB,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAACH,OAAO,CAACK,SAAS,CAAC,CAAC;IACpD;IAEA,IAAI,OAAON,QAAQ,KAAK,QAAQ,IAAI,YAAY,IAAIA,QAAQ,EAAE;MAC5DK,IAAI,CAACE,IAAI,CAAC7B,KAAK,CAAC8B,OAAO,CAAC,IAAIR,QAAQ,CAACS,UAAU,IAAI,CAAC,CAAC;IACvD;;IAEA;IACA,OAAOjC,EAAE,CAACkC,EAAE,CAAeC,OAAO,CAACP,IAAI,KAAK,OAAO,GAAG,OAAO,GAAGA,IAAI,CAAC,CAACQ,IAAI,CACxED,OAAO,EACPN,IAAI,CAACQ,IAAI,CAAC,GAAG,CACf,CAAC,CAAC;EACJ;AACF","ignoreList":[]}
|
|
@@ -17,6 +17,9 @@
|
|
|
17
17
|
export function isAttachmentUpload(o) {
|
|
18
18
|
return typeof o === `object` && "name" in o && "data" in o && o.data instanceof Blob;
|
|
19
19
|
}
|
|
20
|
+
export function isAttachmentFile(o) {
|
|
21
|
+
return typeof o === "object" && o instanceof Blob && "name" in o;
|
|
22
|
+
}
|
|
20
23
|
export function createAttachmentUpload(data, name) {
|
|
21
24
|
return {
|
|
22
25
|
data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AttachmentUpload.js","names":["isAttachmentUpload","o","data","Blob","createAttachmentUpload","name"],"sources":["AttachmentUpload.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 { AttachmentUpload } from \"@osdk/api\";\n\nexport function isAttachmentUpload(o: any): o is AttachmentUpload {\n return typeof o === `object` && \"name\" in o && \"data\" in o\n && o.data instanceof Blob;\n}\n\nexport function createAttachmentUpload(\n data: Blob,\n name: string,\n): AttachmentUpload {\n return { data, name };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,kBAAkBA,CAACC,CAAM,EAAyB;EAChE,OAAO,OAAOA,CAAC,KAAK,QAAQ,IAAI,MAAM,IAAIA,CAAC,IAAI,MAAM,IAAIA,CAAC,IACrDA,CAAC,CAACC,IAAI,YAAYC,IAAI;AAC7B;AAEA,OAAO,SAASC,sBAAsBA,
|
|
1
|
+
{"version":3,"file":"AttachmentUpload.js","names":["isAttachmentUpload","o","data","Blob","isAttachmentFile","createAttachmentUpload","name"],"sources":["AttachmentUpload.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 { AttachmentUpload } from \"@osdk/api\";\n\nexport function isAttachmentUpload(o: any): o is AttachmentUpload {\n return typeof o === `object` && \"name\" in o && \"data\" in o\n && o.data instanceof Blob;\n}\n\nexport function isAttachmentFile(\n o: any,\n): o is Blob & { readonly name: string } {\n return typeof o === \"object\" && o instanceof Blob && \"name\" in o;\n}\n\nexport function createAttachmentUpload(\n data: Blob,\n name: string,\n): AttachmentUpload {\n return { data, name };\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,OAAO,SAASA,kBAAkBA,CAACC,CAAM,EAAyB;EAChE,OAAO,OAAOA,CAAC,KAAK,QAAQ,IAAI,MAAM,IAAIA,CAAC,IAAI,MAAM,IAAIA,CAAC,IACrDA,CAAC,CAACC,IAAI,YAAYC,IAAI;AAC7B;AAEA,OAAO,SAASC,gBAAgBA,CAC9BH,CAAM,EACiC;EACvC,OAAO,OAAOA,CAAC,KAAK,QAAQ,IAAIA,CAAC,YAAYE,IAAI,IAAI,MAAM,IAAIF,CAAC;AAClE;AAEA,OAAO,SAASI,sBAAsBA,CACpCH,IAAU,EACVI,IAAY,EACM;EAClB,OAAO;IAAEJ,IAAI;IAAEI;EAAK,CAAC;AACvB","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleOsdkProperties.js","names":[],"sources":["SimpleOsdkProperties.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\n/**\n * Represents a \"pure\" object from the wire that has its special properties with\n * $ prefix and is ready to be converted to an Osdk object.\n *\n * This object intentionally does not have any generics attached to keep it simple\n * to use.\n *\n * @internal\n */\nexport interface SimpleOsdkProperties {\n $apiName: string;\n $objectType: string;\n $primaryKey: string | number | boolean;\n $title: string | undefined;\n\n [key: string]:\n | string\n | Array<string>\n | number\n | Array<number>\n | boolean\n | Array<boolean>\n | undefined;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -140,7 +140,13 @@ describe("aggregate", () => {
|
|
|
140
140
|
date: {
|
|
141
141
|
$ranges: [["2024-01-02", "2024-01-09"]]
|
|
142
142
|
},
|
|
143
|
-
boolean: "exact"
|
|
143
|
+
boolean: "exact",
|
|
144
|
+
double: {
|
|
145
|
+
"$exact": {
|
|
146
|
+
$defaultValue: "default",
|
|
147
|
+
$limit: 300
|
|
148
|
+
}
|
|
149
|
+
}
|
|
144
150
|
}
|
|
145
151
|
});
|
|
146
152
|
expectType(grouped);
|
|
@@ -155,6 +161,7 @@ describe("aggregate", () => {
|
|
|
155
161
|
expectType(grouped[0].$group.dateTime);
|
|
156
162
|
expectType(grouped[0].$group.date);
|
|
157
163
|
expectType(grouped[0].$group.boolean);
|
|
164
|
+
expectType(grouped[0].$group.double);
|
|
158
165
|
expectType({
|
|
159
166
|
$select: {
|
|
160
167
|
"id:approximateDistinct": "unordered",
|
|
@@ -188,7 +195,10 @@ describe("aggregate", () => {
|
|
|
188
195
|
wrongKey: "don't work",
|
|
189
196
|
string: "exact",
|
|
190
197
|
id: {
|
|
191
|
-
$
|
|
198
|
+
$exact: {
|
|
199
|
+
$limit: 10,
|
|
200
|
+
$defaultValue: "default"
|
|
201
|
+
}
|
|
192
202
|
},
|
|
193
203
|
integer: {
|
|
194
204
|
$ranges: [[1, 2]]
|