@osdk/client 2.2.0-beta.1 → 2.2.0-beta.11
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 +154 -0
- package/build/browser/Client.js +1 -1
- package/build/browser/Client.js.map +1 -1
- package/build/browser/MinimalClientContext.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 +164 -87
- package/build/browser/actions/actions.test.js.map +1 -1
- package/build/browser/actions/applyAction.js +21 -15
- 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.test.js +2 -2
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
- package/build/browser/fetchMetadata.test.js +11 -9
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/index.js +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/intellisense.test.js +5 -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 +53 -0
- package/build/browser/logger/BaseLogger.js.map +1 -0
- package/build/{esm → browser/logger}/Logger.js.map +1 -1
- package/build/browser/logger/MinimalLogger.js +41 -0
- package/build/browser/logger/MinimalLogger.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 +25 -0
- package/build/browser/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects/createOsdkObject.js +10 -3
- 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 +13 -4
- package/build/browser/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/browser/object/convertWireToOsdkObjects.test.js +17 -11
- package/build/browser/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/{esm/observable/internal/ChangedObjects.js → browser/object/createObjectSpecifierFromPrimaryKey.js} +3 -7
- package/build/browser/object/createObjectSpecifierFromPrimaryKey.js.map +1 -0
- package/build/browser/object/fetchPage.js +13 -1
- 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 +166 -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 +117 -109
- package/build/browser/objectSet/ObjectSet.test.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js +18 -14
- package/build/browser/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js +16 -9
- package/build/browser/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -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 +138 -188
- package/build/browser/observable/internal/Store.js.map +1 -1
- package/build/browser/observable/internal/Store.test.js +664 -255
- 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/public/unstable-do-not-use.js.map +1 -1
- package/build/browser/queries/applyQuery.js +33 -1
- 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/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/toDataValue.js +10 -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 +27 -2
- package/build/browser/util/toDataValueQueries.js.map +1 -1
- package/build/cjs/{Client-C8K3E1vH.d.cts → Client-DBTcM9gB.d.cts} +1 -1
- package/build/cjs/{chunk-FEUFIE6T.cjs → chunk-EY52J5Z4.cjs} +25 -15
- package/build/cjs/chunk-EY52J5Z4.cjs.map +1 -0
- package/build/cjs/{chunk-ACX536BS.cjs → chunk-MCQVHD2F.cjs} +40 -29
- package/build/cjs/chunk-MCQVHD2F.cjs.map +1 -0
- package/build/cjs/chunk-T4NIFYZS.cjs +14 -0
- package/build/cjs/chunk-T4NIFYZS.cjs.map +1 -0
- package/build/cjs/{graphql-JJX5MZPQ.cjs → graphql-RGM5SRWV.cjs} +43 -2
- package/build/cjs/graphql-RGM5SRWV.cjs.map +1 -0
- package/build/cjs/index.cjs +265 -94
- package/build/cjs/index.cjs.map +1 -1
- package/build/cjs/index.d.cts +6 -4
- package/build/cjs/public/internal.cjs +6 -6
- package/build/cjs/public/internal.d.cts +1 -1
- package/build/cjs/public/unstable-do-not-use.cjs +1087 -470
- package/build/cjs/public/unstable-do-not-use.cjs.map +1 -1
- package/build/cjs/public/unstable-do-not-use.d.cts +37 -27
- package/build/esm/Client.js +1 -1
- package/build/esm/Client.js.map +1 -1
- package/build/esm/MinimalClientContext.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 +164 -87
- package/build/esm/actions/actions.test.js.map +1 -1
- package/build/esm/actions/applyAction.js +21 -15
- 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.test.js +2 -2
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -1
- package/build/esm/fetchMetadata.test.js +11 -9
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/intellisense.test.js +5 -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 +53 -0
- package/build/esm/logger/BaseLogger.js.map +1 -0
- package/build/{browser → esm/logger}/Logger.js.map +1 -1
- package/build/esm/logger/MinimalLogger.js +41 -0
- package/build/esm/logger/MinimalLogger.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 +25 -0
- package/build/esm/object/convertWireToOsdkObjects/createOsdkInterface.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects/createOsdkObject.js +10 -3
- 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 +13 -4
- package/build/esm/object/convertWireToOsdkObjects.js.map +1 -1
- package/build/esm/object/convertWireToOsdkObjects.test.js +17 -11
- package/build/esm/object/convertWireToOsdkObjects.test.js.map +1 -1
- package/build/{browser/observable/internal/ChangedObjects.js → esm/object/createObjectSpecifierFromPrimaryKey.js} +3 -7
- package/build/esm/object/createObjectSpecifierFromPrimaryKey.js.map +1 -0
- package/build/esm/object/fetchPage.js +13 -1
- 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 +166 -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 +117 -109
- package/build/esm/objectSet/ObjectSet.test.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js +18 -14
- package/build/esm/objectSet/ObjectSetListenerWebsocket.js.map +1 -1
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js +16 -9
- package/build/esm/objectSet/ObjectSetListenerWebsocket.test.js.map +1 -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 +138 -188
- package/build/esm/observable/internal/Store.js.map +1 -1
- package/build/esm/observable/internal/Store.test.js +664 -255
- 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/public/unstable-do-not-use.js.map +1 -1
- package/build/esm/queries/applyQuery.js +33 -1
- 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/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/toDataValue.js +10 -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 +27 -2
- package/build/esm/util/toDataValueQueries.js.map +1 -1
- package/build/types/Client.d.ts +2 -2
- 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/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/index.d.ts +3 -2
- package/build/types/index.d.ts.map +1 -1
- package/build/types/logger/BaseLogger.d.ts +31 -0
- package/build/types/logger/BaseLogger.d.ts.map +1 -0
- package/build/types/{Logger.d.ts → logger/Logger.d.ts} +1 -2
- package/build/types/logger/Logger.d.ts.map +1 -0
- package/build/types/logger/MinimalLogger.d.ts +8 -0
- package/build/types/logger/MinimalLogger.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/createObjectSpecifierFromPrimaryKey.d.ts +2 -0
- package/build/types/object/createObjectSpecifierFromPrimaryKey.d.ts.map +1 -0
- 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 +33 -29
- 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 +49 -9
- package/build/types/observable/internal/testUtils.d.ts.map +1 -1
- package/build/types/public/unstable-do-not-use.d.ts +1 -4
- package/build/types/public/unstable-do-not-use.d.ts.map +1 -1
- package/build/types/queries/applyQuery.d.ts.map +1 -1
- package/build/types/tsserver.d.ts +1 -1
- package/build/types/tsserver.d.ts.map +1 -1
- package/package.json +18 -14
- package/build/browser/observable/internal/ChangedObjects.js.map +0 -1
- package/build/cjs/chunk-ACX536BS.cjs.map +0 -1
- package/build/cjs/chunk-FEUFIE6T.cjs.map +0 -1
- package/build/cjs/graphql-JJX5MZPQ.cjs.map +0 -1
- package/build/esm/observable/internal/ChangedObjects.js.map +0 -1
- 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
- /package/build/browser/{Logger.js → logger/Logger.js} +0 -0
- /package/build/esm/{Logger.js → logger/Logger.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","convertWireToOsdkObjects","convertWireToOsdkObjects2","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","processedBaseUrl","pathname","endsWith","minimalClient","toString","objectFactory","objectFactory2","ontologyRid","logger","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport type { Logger } from \"./Logger.js\";\nimport type {\n ClientCacheKey,\n MinimalClient,\n MinimalClientParams,\n} from \"./MinimalClientContext.js\";\nimport {\n convertWireToOsdkObjects,\n convertWireToOsdkObjects2,\n} from \"./object/convertWireToOsdkObjects.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport {\n createStandardOntologyProviderFactory,\n type OntologyCachingOptions,\n} from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n\n/** @internal */\nexport function createMinimalClient(\n metadata: MinimalClientParams[\"metadata\"],\n baseUrl: string,\n tokenProvider: () => Promise<string>,\n options: OntologyCachingOptions & { logger?: Logger } = {},\n fetchFn: (\n input: Request | URL | string,\n init?: RequestInit | undefined,\n ) => Promise<Response> = global.fetch,\n objectSetFactory: ObjectSetFactory<any, any> = createObjectSet,\n) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n } catch (e) {\n const hint =\n !baseUrl.startsWith(\"http://\") || !baseUrl.startsWith(\"https://\")\n ? \". Did you forget to add 'http://' or 'https://'?\"\n : \"\";\n throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);\n }\n }\n const processedBaseUrl = new URL(baseUrl);\n processedBaseUrl.pathname += processedBaseUrl.pathname.endsWith(\"/\")\n ? \"\"\n : \"/\";\n const minimalClient: MinimalClient = {\n ...createSharedClientContext(\n processedBaseUrl.toString(),\n tokenProvider,\n USER_AGENT,\n fetchFn,\n ),\n objectSetFactory,\n objectFactory: convertWireToOsdkObjects,\n objectFactory2: convertWireToOsdkObjects2,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {} as ClientCacheKey,\n requestContext: {},\n } satisfies Omit<\n MinimalClient,\n \"ontologyProvider\"\n > as any;\n\n return Object.freeze(Object.assign(minimalClient, {\n ontologyProvider:
|
|
1
|
+
{"version":3,"file":"createMinimalClient.js","names":["createSharedClientContext","convertWireToOsdkObjects","convertWireToOsdkObjects2","createObjectSet","createStandardOntologyProviderFactory","USER_AGENT","createMinimalClient","metadata","baseUrl","tokenProvider","options","fetchFn","global","fetch","objectSetFactory","createOntologyProviderFactory","process","env","NODE_ENV","URL","e","hint","startsWith","Error","processedBaseUrl","pathname","endsWith","minimalClient","toString","objectFactory","objectFactory2","ontologyRid","logger","clientCacheKey","requestContext","Object","freeze","assign","ontologyProvider"],"sources":["createMinimalClient.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { createSharedClientContext } from \"@osdk/shared.client.impl\";\nimport type { Logger } from \"./logger/Logger.js\";\nimport type {\n ClientCacheKey,\n MinimalClient,\n MinimalClientParams,\n} from \"./MinimalClientContext.js\";\nimport {\n convertWireToOsdkObjects,\n convertWireToOsdkObjects2,\n} from \"./object/convertWireToOsdkObjects.js\";\nimport { createObjectSet } from \"./objectSet/createObjectSet.js\";\nimport type { ObjectSetFactory } from \"./objectSet/ObjectSetFactory.js\";\nimport type { OntologyProvider } from \"./ontology/OntologyProvider.js\";\nimport {\n createStandardOntologyProviderFactory,\n type OntologyCachingOptions,\n} from \"./ontology/StandardOntologyProvider.js\";\nimport { USER_AGENT } from \"./util/UserAgent.js\";\n\n/** @internal */\nexport function createMinimalClient(\n metadata: MinimalClientParams[\"metadata\"],\n baseUrl: string,\n tokenProvider: () => Promise<string>,\n options: OntologyCachingOptions & { logger?: Logger } = {},\n fetchFn: (\n input: Request | URL | string,\n init?: RequestInit | undefined,\n ) => Promise<Response> = global.fetch,\n objectSetFactory: ObjectSetFactory<any, any> = createObjectSet,\n createOntologyProviderFactory: (\n a: OntologyCachingOptions & { logger?: Logger },\n ) => (minimalClient: MinimalClient) => OntologyProvider =\n createStandardOntologyProviderFactory,\n) {\n if (process.env.NODE_ENV !== \"production\") {\n try {\n new URL(baseUrl);\n } catch (e) {\n const hint =\n !baseUrl.startsWith(\"http://\") || !baseUrl.startsWith(\"https://\")\n ? \". Did you forget to add 'http://' or 'https://'?\"\n : \"\";\n throw new Error(`Invalid stack URL: ${baseUrl}${hint}`);\n }\n }\n const processedBaseUrl = new URL(baseUrl);\n processedBaseUrl.pathname += processedBaseUrl.pathname.endsWith(\"/\")\n ? \"\"\n : \"/\";\n const minimalClient: MinimalClient = {\n ...createSharedClientContext(\n processedBaseUrl.toString(),\n tokenProvider,\n USER_AGENT,\n fetchFn,\n ),\n objectSetFactory,\n objectFactory: convertWireToOsdkObjects,\n objectFactory2: convertWireToOsdkObjects2,\n ontologyRid: metadata.ontologyRid,\n logger: options.logger,\n clientCacheKey: {} as ClientCacheKey,\n requestContext: {},\n } satisfies Omit<\n MinimalClient,\n \"ontologyProvider\"\n > as any;\n\n return Object.freeze(Object.assign(minimalClient, {\n ontologyProvider: createOntologyProviderFactory(\n options,\n )(minimalClient),\n }));\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,yBAAyB,QAAQ,0BAA0B;AAOpE,SACEC,wBAAwB,EACxBC,yBAAyB,QACpB,sCAAsC;AAC7C,SAASC,eAAe,QAAQ,gCAAgC;AAGhE,SACEC,qCAAqC,QAEhC,wCAAwC;AAC/C,SAASC,UAAU,QAAQ,qBAAqB;;AAEhD;AACA,OAAO,SAASC,mBAAmBA,CACjCC,QAAyC,EACzCC,OAAe,EACfC,aAAoC,EACpCC,OAAqD,GAAG,CAAC,CAAC,EAC1DC,OAGsB,GAAGC,MAAM,CAACC,KAAK,EACrCC,gBAA4C,GAAGX,eAAe,EAC9DY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* 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 { createMinimalClient } from "./createMinimalClient.js";
|
|
18
|
+
/** @internal */
|
|
19
|
+
|
|
20
|
+
export function createMinimalClientHelper(baseUrl, ontologyRid, tokenProvider, ...args) {
|
|
21
|
+
return createMinimalClient({
|
|
22
|
+
ontologyRid
|
|
23
|
+
}, baseUrl, tokenProvider, ...args);
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=createMinimalClientHelper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createMinimalClientHelper.js","names":["createMinimalClient","createMinimalClientHelper","baseUrl","ontologyRid","tokenProvider","args"],"sources":["createMinimalClientHelper.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 { createMinimalClient } from \"./createMinimalClient.js\";\nimport type { MinimalClientParams } from \"./MinimalClientContext.js\";\n\n/** @internal */\n\nexport function createMinimalClientHelper(\n baseUrl: string,\n ontologyRid: string | Promise<string>,\n tokenProvider: () => Promise<string>,\n ...args: typeof createMinimalClient extends (\n metadata: MinimalClientParams[\"metadata\"],\n baseUrl: string,\n tokenProvider: () => Promise<string>,\n ...args: infer A\n ) => any ? A\n : never\n): ReturnType<typeof createMinimalClient> {\n return createMinimalClient(\n { ontologyRid },\n baseUrl,\n tokenProvider,\n ...args,\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,mBAAmB,QAAQ,0BAA0B;AAG9D;;AAEA,OAAO,SAASC,yBAAyBA,CACvCC,OAAe,EACfC,WAAqC,EACrCC,aAAoC,EACpC,GAAGC,IAMM,EAC+B;EACxC,OAAOL,mBAAmB,CACxB;IAAEG;EAAY,CAAC,EACfD,OAAO,EACPE,aAAa,EACb,GAAGC,IACL,CAAC;AACH","ignoreList":[]}
|
|
@@ -50,7 +50,7 @@ describe(createWithPropertiesObjectSet, () => {
|
|
|
50
50
|
type: "methodInput"
|
|
51
51
|
}, map);
|
|
52
52
|
const clause = {
|
|
53
|
-
"derivedPropertyName": base => base.pivotTo("lead").aggregate("
|
|
53
|
+
"derivedPropertyName": base => base.pivotTo("lead").aggregate("employeeId:approximatePercentile", {
|
|
54
54
|
percentile: 0.5
|
|
55
55
|
}),
|
|
56
56
|
"secondaryDerivedPropertyName": base => base.pivotTo("lead").aggregate("fullName:collectSet", {
|
|
@@ -72,7 +72,7 @@ describe(createWithPropertiesObjectSet, () => {
|
|
|
72
72
|
},
|
|
73
73
|
"operation": {
|
|
74
74
|
"approximatePercentile": 0.5,
|
|
75
|
-
"selectedPropertyApiName": "
|
|
75
|
+
"selectedPropertyApiName": "employeeId",
|
|
76
76
|
"type": "approximatePercentile",
|
|
77
77
|
},
|
|
78
78
|
"type": "selection",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createWithPropertiesObjectSet.test.js","names":["Employee","describe","expect","it","createWithPropertiesObjectSet","map","Map","deriveObjectSet","type","result","base","pivotTo","selectProperty","definition","get","toMatchInlineSnapshot","clause","aggregate","percentile","limit","secondResult","secondDefinition"],"sources":["createWithPropertiesObjectSet.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 { DerivedProperty } from \"@osdk/api\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport type { DerivedPropertyDefinition } from \"@osdk/foundry.ontologies\";\nimport { describe, expect, it } from \"vitest\";\nimport { createWithPropertiesObjectSet } from \"./createWithPropertiesObjectSet.js\";\n\ndescribe(createWithPropertiesObjectSet, () => {\n it(\"correctly creates basic object set with derived properties\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n } satisfies DerivedProperty.Clause<Employee>;\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n\n it(\"correctly handles multiple definitions in one clause\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"
|
|
1
|
+
{"version":3,"file":"createWithPropertiesObjectSet.test.js","names":["Employee","describe","expect","it","createWithPropertiesObjectSet","map","Map","deriveObjectSet","type","result","base","pivotTo","selectProperty","definition","get","toMatchInlineSnapshot","clause","aggregate","percentile","limit","secondResult","secondDefinition"],"sources":["createWithPropertiesObjectSet.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 { DerivedProperty } from \"@osdk/api\";\nimport { Employee } from \"@osdk/client.test.ontology\";\nimport type { DerivedPropertyDefinition } from \"@osdk/foundry.ontologies\";\nimport { describe, expect, it } from \"vitest\";\nimport { createWithPropertiesObjectSet } from \"./createWithPropertiesObjectSet.js\";\n\ndescribe(createWithPropertiesObjectSet, () => {\n it(\"correctly creates basic object set with derived properties\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").selectProperty(\"employeeId\"),\n } satisfies DerivedProperty.Clause<Employee>;\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"get\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n\n it(\"correctly handles multiple definitions in one clause\", () => {\n const map = new Map<any, DerivedPropertyDefinition>();\n const deriveObjectSet = createWithPropertiesObjectSet(Employee, {\n type: \"methodInput\",\n }, map);\n\n const clause: DerivedProperty.Clause<Employee> = {\n \"derivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"employeeId:approximatePercentile\", {\n percentile: 0.5,\n }),\n\n \"secondaryDerivedPropertyName\": (base) =>\n base.pivotTo(\"lead\").aggregate(\"fullName:collectSet\", {\n limit: 10,\n }),\n };\n\n const result = clause[\"derivedPropertyName\"](deriveObjectSet);\n const definition = map.get(result);\n\n const secondResult = clause[\"secondaryDerivedPropertyName\"](\n deriveObjectSet,\n );\n const secondDefinition = map.get(secondResult);\n\n expect(definition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"approximatePercentile\": 0.5,\n \"selectedPropertyApiName\": \"employeeId\",\n \"type\": \"approximatePercentile\",\n },\n \"type\": \"selection\",\n }\n `);\n\n expect(secondDefinition).toMatchInlineSnapshot(`\n {\n \"objectSet\": {\n \"link\": \"lead\",\n \"objectSet\": {\n \"type\": \"methodInput\",\n },\n \"type\": \"searchAround\",\n },\n \"operation\": {\n \"limit\": 10,\n \"selectedPropertyApiName\": \"fullName\",\n \"type\": \"collectSet\",\n },\n \"type\": \"selection\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,QAAQ,QAAQ,4BAA4B;AAErD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,QAAQ,QAAQ;AAC7C,SAASC,6BAA6B,QAAQ,oCAAoC;AAElFH,QAAQ,CAACG,6BAA6B,E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L,MAAM,CAAC;IAElC,MAAMW,YAAY,GAAGJ,MAAM,CAAC,8BAA8B,CAAC,CACzDT,eACF,CAAC;IACD,MAAMc,gBAAgB,GAAGhB,GAAG,CAACS,GAAG,CAACM,YAAY,CAAC;IAE9ClB,MAAM,CAACW,UAAU,CAAC,CAACE,qBAAqB,CAAC;AAC7C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;IAEJb,MAAM,CAACmB,gBAAgB,CAAC,CAACN,qBAAqB,CAAC;AACnD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,CAAC;EACN,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -14,18 +14,20 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
import { $Actions, $Interfaces, $Objects, $
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
17
|
+
import { $Actions, $Interfaces, $Objects, $Queries } from "@osdk/client.test.ontology";
|
|
18
|
+
import { LegacyFauxFoundry, startNodeApiServer } from "@osdk/shared.test";
|
|
19
|
+
import { beforeAll, describe, expect, expectTypeOf, it } from "vitest";
|
|
20
20
|
import { createClient } from "./createClient.js";
|
|
21
21
|
describe("FetchMetadata", () => {
|
|
22
22
|
let client;
|
|
23
|
-
beforeAll(
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
beforeAll(() => {
|
|
24
|
+
const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);
|
|
25
|
+
({
|
|
26
|
+
client
|
|
27
|
+
} = testSetup);
|
|
28
|
+
return () => {
|
|
29
|
+
testSetup.apiServer.close();
|
|
30
|
+
};
|
|
29
31
|
});
|
|
30
32
|
it("fetches object metadata correctly", async () => {
|
|
31
33
|
const objectMetadata = await client.fetchMetadata($Objects.Employee);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$ontologyRid","$Queries","apiServer","afterAll","beforeAll","describe","expect","expectTypeOf","it","createClient","client","listen","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionMetadata,\n InterfaceMetadata,\n ObjectMetadata,\n QueryMetadata,\n} from \"@osdk/api\";\nimport {\n $Actions,\n $Interfaces,\n $Objects,\n $ontologyRid,\n $Queries,\n} from \"@osdk/client.test.ontology\";\nimport { apiServer } from \"@osdk/shared.test\";\nimport {\n afterAll,\n beforeAll,\n describe,\n expect,\n expectTypeOf,\n it,\n} from \"vitest\";\nimport type { Client } from \"./Client.js\";\nimport { createClient } from \"./createClient.js\";\n\ndescribe(\"FetchMetadata\", () => {\n let client: Client;\n\n beforeAll(async () => {\n apiServer.listen();\n client = createClient(\n \"https://stack.palantir.com\",\n $ontologyRid,\n async () => \"myAccessToken\",\n );\n });\n\n afterAll(() => {\n apiServer.close();\n });\n\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n\n expectTypeOf(objectMetadata).toEqualTypeOf<\n ObjectMetadata\n >();\n\n expect(objectMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"Employee\",\n \"description\": \"A full-time or part-time \n\n employee of our firm\",\n \"displayName\": \"Employee\",\n \"icon\": {\n \"color\": \"blue\",\n \"name\": \"person\",\n \"type\": \"blueprint\",\n },\n \"implements\": [\n \"FooInterface\",\n ],\n \"interfaceMap\": {\n \"FooInterface\": {\n \"fooSpt\": \"fullName\",\n },\n },\n \"inverseInterfaceMap\": {\n \"FooInterface\": {\n \"fullName\": \"fooSpt\",\n },\n },\n \"links\": {\n \"lead\": {\n \"multiplicity\": false,\n \"targetType\": \"Employee\",\n },\n \"officeLink\": {\n \"multiplicity\": false,\n \"targetType\": \"Office\",\n },\n \"peeps\": {\n \"multiplicity\": true,\n \"targetType\": \"Employee\",\n },\n },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"class\": {\n \"description\": \"\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\n },\n \"employeeLocation\": {\n \"description\": \"Geotime series reference of the location of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"geotimeSeriesReference\",\n },\n \"employeeSensor\": {\n \"description\": \"TimeSeries sensor of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"sensorTimeseries\",\n },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"office\": {\n \"description\": \"The unique \"ID\" of the employee's \\\\\"primary\\\\\" assigned office.\n This is some more text.\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"startDate\": {\n \"description\": \"The date the employee was hired (most recently, if they were re-hired)\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"datetime\",\n },\n },\n \"rid\": \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\",\n \"status\": \"ACTIVE\",\n \"titleProperty\": \"fullName\",\n \"type\": \"object\",\n \"visibility\": \"NORMAL\",\n }\n `);\n });\n\n it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata(\n $Interfaces.FooInterface,\n );\n\n expectTypeOf(interfaceMetadata).toEqualTypeOf<\n InterfaceMetadata\n >();\n\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implementedBy\": [\n \"Employee\",\n \"Person\",\n ],\n \"implements\": [],\n \"links\": {},\n \"properties\": {\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata(\n $Actions.moveOffice,\n );\n\n expectTypeOf(actionMetadata).toEqualTypeOf<ActionMetadata>();\n\n expect(actionMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"moveOffice\",\n \"description\": \"Update an office's physical location\",\n \"displayName\": \"move-office\",\n \"modifiedEntities\": {\n \"Office\": {\n \"created\": false,\n \"modified\": true,\n },\n },\n \"parameters\": {\n \"newAddress\": {\n \"description\": \"The office's new physical address (not necessarily shipping address)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"newCapacity\": {\n \"description\": \"The maximum seated-at-desk capacity of the new office (maximum fire-safe capacity may be higher)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n \"officeId\": {\n \"description\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"string\",\n },\n \"officeNames\": {\n \"description\": \"A list of all office names\",\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n },\n \"rid\": \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n \"status\": \"ACTIVE\",\n \"type\": \"action\",\n }\n `);\n });\n\n it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata(\n $Queries.queryAcceptsObject,\n );\n\n expectTypeOf(queryMetadata).toEqualTypeOf<QueryMetadata>();\n\n expect(queryMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"queryAcceptsObject\",\n \"description\": \"description of the query that takes object types\",\n \"displayName\": \"QueryAcceptsObject\",\n \"output\": {\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n \"parameters\": {\n \"object\": {\n \"description\": undefined,\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n },\n \"rid\": \"ri.function-registry.main.function.9b55870a-63c7-4d48-8f06-9627c0805968\",\n \"type\": \"query\",\n \"version\": \"0.11.0\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,WAAW,EACXC,QAAQ,EACRC,YAAY,EACZC,QAAQ,QACH,4BAA4B;AACnC,SAASC,SAAS,QAAQ,mBAAmB;AAC7C,SACEC,QAAQ,EACRC,SAAS,EACTC,QAAQ,EACRC,MAAM,EACNC,YAAY,EACZC,EAAE,QACG,QAAQ;AAEf,SAASC,YAAY,QAAQ,mBAAmB;AAEhDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9B,IAAIK,MAAc;EAElBN,SAAS,CAAC,YAAY;IACpBF,SAAS,CAACS,MAAM,CAAC,CAAC;IAClBD,MAAM,GAAGD,YAAY,CACnB,4BAA4B,EAC5BT,YAAY,EACZ,YAAY,eACd,CAAC;EACH,CAAC,CAAC;EAEFG,QAAQ,CAAC,MAAM;IACbD,SAAS,CAACU,KAAK,CAAC,CAAC;EACnB,CAAC,CAAC;EAEFJ,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMK,cAAc,GAAG,MAAMH,MAAM,CAACI,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IAEpER,YAAY,CAACM,cAAc,CAAC,CAACG,aAAa,CAExC,CAAC;IAEHV,MAAM,CAACO,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFT,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACrD,MAAMU,iBAAiB,GAAG,MAAMR,MAAM,CAACI,aAAa,CAClDhB,WAAW,CAACqB,YACd,CAAC;IAEDZ,YAAY,CAACW,iBAAiB,CAAC,CAACF,aAAa,CAE3C,CAAC;IAEHV,MAAM,CAACY,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFT,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMY,cAAc,GAAG,MAAMV,MAAM,CAACI,aAAa,CAC/CjB,QAAQ,CAACwB,UACX,CAAC;IAEDd,YAAY,CAACa,cAAc,CAAC,CAACJ,aAAa,CAAiB,CAAC;IAE5DV,MAAM,CAACc,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFT,EAAE,CAAC,kCAAkC,EAAE,YAAY;IACjD,MAAMc,aAAa,GAAG,MAAMZ,MAAM,CAACI,aAAa,CAC9Cb,QAAQ,CAACsB,kBACX,CAAC;IAEDhB,YAAY,CAACe,aAAa,CAAC,CAACN,aAAa,CAAgB,CAAC;IAE1DV,MAAM,CAACgB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"fetchMetadata.test.js","names":["$Actions","$Interfaces","$Objects","$Queries","LegacyFauxFoundry","startNodeApiServer","beforeAll","describe","expect","expectTypeOf","it","createClient","client","testSetup","apiServer","close","objectMetadata","fetchMetadata","Employee","toEqualTypeOf","toMatchInlineSnapshot","interfaceMetadata","FooInterface","actionMetadata","moveOffice","queryMetadata","queryAcceptsObject"],"sources":["fetchMetadata.test.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type {\n ActionMetadata,\n InterfaceMetadata,\n ObjectMetadata,\n QueryMetadata,\n} from \"@osdk/api\";\nimport {\n $Actions,\n $Interfaces,\n $Objects,\n $Queries,\n} from \"@osdk/client.test.ontology\";\nimport { LegacyFauxFoundry, startNodeApiServer } from \"@osdk/shared.test\";\nimport { beforeAll, describe, expect, expectTypeOf, it } from \"vitest\";\nimport type { Client } from \"./Client.js\";\nimport { createClient } from \"./createClient.js\";\n\ndescribe(\"FetchMetadata\", () => {\n let client: Client;\n\n beforeAll(() => {\n const testSetup = startNodeApiServer(new LegacyFauxFoundry(), createClient);\n ({ client } = testSetup);\n return () => {\n testSetup.apiServer.close();\n };\n });\n\n it(\"fetches object metadata correctly\", async () => {\n const objectMetadata = await client.fetchMetadata($Objects.Employee);\n\n expectTypeOf(objectMetadata).toEqualTypeOf<\n ObjectMetadata\n >();\n\n expect(objectMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"Employee\",\n \"description\": \"A full-time or part-time \n\n employee of our firm\",\n \"displayName\": \"Employee\",\n \"icon\": {\n \"color\": \"blue\",\n \"name\": \"person\",\n \"type\": \"blueprint\",\n },\n \"implements\": [\n \"FooInterface\",\n ],\n \"interfaceMap\": {\n \"FooInterface\": {\n \"fooSpt\": \"fullName\",\n },\n },\n \"inverseInterfaceMap\": {\n \"FooInterface\": {\n \"fullName\": \"fooSpt\",\n },\n },\n \"links\": {\n \"lead\": {\n \"multiplicity\": false,\n \"targetType\": \"Employee\",\n },\n \"officeLink\": {\n \"multiplicity\": false,\n \"targetType\": \"Office\",\n },\n \"peeps\": {\n \"multiplicity\": true,\n \"targetType\": \"Employee\",\n },\n },\n \"pluralDisplayName\": \"Employees\",\n \"primaryKeyApiName\": \"employeeId\",\n \"primaryKeyType\": \"integer\",\n \"properties\": {\n \"class\": {\n \"description\": \"\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"employeeId\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"integer\",\n },\n \"employeeLocation\": {\n \"description\": \"Geotime series reference of the location of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"geotimeSeriesReference\",\n },\n \"employeeSensor\": {\n \"description\": \"TimeSeries sensor of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"sensorTimeseries\",\n },\n \"employeeStatus\": {\n \"description\": \"TimeSeries of the status of the employee\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"stringTimeseries\",\n },\n \"fullName\": {\n \"description\": undefined,\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"office\": {\n \"description\": \"The unique \"ID\" of the employee's \\\\\"primary\\\\\" assigned office.\n This is some more text.\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"startDate\": {\n \"description\": \"The date the employee was hired (most recently, if they were re-hired)\",\n \"displayName\": undefined,\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"datetime\",\n },\n },\n \"rid\": \"ri.ontology.main.object-type.401ac022-89eb-4591-8b7e-0a912b9efb44\",\n \"status\": \"ACTIVE\",\n \"titleProperty\": \"fullName\",\n \"type\": \"object\",\n \"visibility\": \"NORMAL\",\n }\n `);\n });\n\n it(\"fetches interface metadata correctly\", async () => {\n const interfaceMetadata = await client.fetchMetadata(\n $Interfaces.FooInterface,\n );\n\n expectTypeOf(interfaceMetadata).toEqualTypeOf<\n InterfaceMetadata\n >();\n\n expect(interfaceMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"FooInterface\",\n \"description\": \"Interface for Foo\",\n \"displayName\": \"Foo Interface\",\n \"implementedBy\": [\n \"Employee\",\n \"Person\",\n ],\n \"implements\": [],\n \"links\": {},\n \"properties\": {\n \"fooSpt\": {\n \"description\": \"A foo\",\n \"displayName\": \"Foo\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n },\n \"rid\": \"ri.interface.main.interface.1\",\n \"type\": \"interface\",\n }\n `);\n });\n\n it(\"fetches action metadata correctly\", async () => {\n const actionMetadata = await client.fetchMetadata(\n $Actions.moveOffice,\n );\n\n expectTypeOf(actionMetadata).toEqualTypeOf<ActionMetadata>();\n\n expect(actionMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"moveOffice\",\n \"description\": \"Update an office's physical location\",\n \"displayName\": \"move-office\",\n \"modifiedEntities\": {\n \"Office\": {\n \"created\": false,\n \"modified\": true,\n },\n },\n \"parameters\": {\n \"newAddress\": {\n \"description\": \"The office's new physical address (not necessarily shipping address)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"string\",\n },\n \"newCapacity\": {\n \"description\": \"The maximum seated-at-desk capacity of the new office (maximum fire-safe capacity may be higher)\",\n \"multiplicity\": false,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n \"officeId\": {\n \"description\": undefined,\n \"multiplicity\": false,\n \"nullable\": false,\n \"type\": \"string\",\n },\n \"officeNames\": {\n \"description\": \"A list of all office names\",\n \"multiplicity\": true,\n \"nullable\": true,\n \"type\": \"integer\",\n },\n },\n \"rid\": \"ri.ontology.main.action-type.9f84017d-cf17-4fa8-84c3-8e01e5d594f2\",\n \"status\": \"ACTIVE\",\n \"type\": \"action\",\n }\n `);\n });\n\n it(\"fetches query metadata correctly\", async () => {\n const queryMetadata = await client.fetchMetadata(\n $Queries.queryAcceptsObject,\n );\n\n expectTypeOf(queryMetadata).toEqualTypeOf<QueryMetadata>();\n\n expect(queryMetadata).toMatchInlineSnapshot(`\n {\n \"apiName\": \"queryAcceptsObject\",\n \"description\": \"description of the query that takes object types\",\n \"displayName\": \"QueryAcceptsObject\",\n \"output\": {\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n \"parameters\": {\n \"object\": {\n \"description\": undefined,\n \"nullable\": false,\n \"object\": \"Employee\",\n \"type\": \"object\",\n },\n },\n \"rid\": \"ri.function-registry.main.function.9b55870a-63c7-4d48-8f06-9627c0805968\",\n \"type\": \"query\",\n \"version\": \"0.11.0\",\n }\n `);\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAQA,SACEA,QAAQ,EACRC,WAAW,EACXC,QAAQ,EACRC,QAAQ,QACH,4BAA4B;AACnC,SAASC,iBAAiB,EAAEC,kBAAkB,QAAQ,mBAAmB;AACzE,SAASC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,YAAY,EAAEC,EAAE,QAAQ,QAAQ;AAEtE,SAASC,YAAY,QAAQ,mBAAmB;AAEhDJ,QAAQ,CAAC,eAAe,EAAE,MAAM;EAC9B,IAAIK,MAAc;EAElBN,SAAS,CAAC,MAAM;IACd,MAAMO,SAAS,GAAGR,kBAAkB,CAAC,IAAID,iBAAiB,CAAC,CAAC,EAAEO,YAAY,CAAC;IAC3E,CAAC;MAAEC;IAAO,CAAC,GAAGC,SAAS;IACvB,OAAO,MAAM;MACXA,SAAS,CAACC,SAAS,CAACC,KAAK,CAAC,CAAC;IAC7B,CAAC;EACH,CAAC,CAAC;EAEFL,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMM,cAAc,GAAG,MAAMJ,MAAM,CAACK,aAAa,CAACf,QAAQ,CAACgB,QAAQ,CAAC;IAEpET,YAAY,CAACO,cAAc,CAAC,CAACG,aAAa,CAExC,CAAC;IAEHX,MAAM,CAACQ,cAAc,CAAC,CAACI,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,sCAAsC,EAAE,YAAY;IACrD,MAAMW,iBAAiB,GAAG,MAAMT,MAAM,CAACK,aAAa,CAClDhB,WAAW,CAACqB,YACd,CAAC;IAEDb,YAAY,CAACY,iBAAiB,CAAC,CAACF,aAAa,CAE3C,CAAC;IAEHX,MAAM,CAACa,iBAAiB,CAAC,CAACD,qBAAqB,CAAC;AACpD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,mCAAmC,EAAE,YAAY;IAClD,MAAMa,cAAc,GAAG,MAAMX,MAAM,CAACK,aAAa,CAC/CjB,QAAQ,CAACwB,UACX,CAAC;IAEDf,YAAY,CAACc,cAAc,CAAC,CAACJ,aAAa,CAAiB,CAAC;IAE5DX,MAAM,CAACe,cAAc,CAAC,CAACH,qBAAqB,CAAC;AACjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;EAEFV,EAAE,CAAC,kCAAkC,EAAE,YAAY;IACjD,MAAMe,aAAa,GAAG,MAAMb,MAAM,CAACK,aAAa,CAC9Cd,QAAQ,CAACuB,kBACX,CAAC;IAEDjB,YAAY,CAACgB,aAAa,CAAC,CAACN,aAAa,CAAgB,CAAC;IAE1DX,MAAM,CAACiB,aAAa,CAAC,CAACL,qBAAqB,CAAC;AAChD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK,CAAC;EACJ,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
package/build/browser/index.js
CHANGED
|
@@ -20,5 +20,6 @@ export { ActionValidationError } from "./actions/ActionValidationError.js";
|
|
|
20
20
|
export { createClient } from "./createClient.js";
|
|
21
21
|
export { createPlatformClient } from "./createPlatformClient.js";
|
|
22
22
|
export { createAttachmentUpload } from "./object/AttachmentUpload.js";
|
|
23
|
+
export { createObjectSpecifierFromPrimaryKey } from "./object/createObjectSpecifierFromPrimaryKey.js";
|
|
23
24
|
export { extractDate, extractDateInLocalTime, extractDateInUTC } from "./util/datetimeConverters.js";
|
|
24
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","extractDate","extractDateInLocalTime","extractDateInUTC"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n InterfaceDefinition,\n ObjectMetadata,\n ObjectSet,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Result,\n SingleLinkAccessor,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport type { Logger } from \"./Logger.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;
|
|
1
|
+
{"version":3,"file":"index.js","names":["isOk","PalantirApiError","ActionValidationError","createClient","createPlatformClient","createAttachmentUpload","createObjectSpecifierFromPrimaryKey","extractDate","extractDateInLocalTime","extractDateInUTC"],"sources":["index.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport type {\n ActionDefinition,\n ActionEditResponse,\n ActionMetadata,\n ActionParam,\n ActionReturnTypeForOptions,\n ActionValidationResponse,\n ApplyActionOptions,\n ApplyBatchActionOptions,\n InterfaceDefinition,\n ObjectMetadata,\n ObjectSet,\n ObjectSpecifier,\n ObjectTypeDefinition,\n Osdk,\n OsdkObject,\n PageResult,\n PropertyDef,\n PropertyKeys,\n PropertyValueWireToClient,\n QueryDefinition,\n QueryParam,\n QueryResult,\n Result,\n SingleLinkAccessor,\n VersionBound,\n WhereClause,\n} from \"@osdk/api\";\nexport { isOk } from \"@osdk/api\";\nexport { PalantirApiError } from \"@osdk/shared.net.errors\";\n\nexport { ActionValidationError } from \"./actions/ActionValidationError.js\";\nexport type { Client } from \"./Client.js\";\nexport { createClient } from \"./createClient.js\";\nexport { createPlatformClient } from \"./createPlatformClient.js\";\nexport type { PlatformClient } from \"./createPlatformClient.js\";\nexport type { Logger } from \"./logger/Logger.js\";\nexport { createAttachmentUpload } from \"./object/AttachmentUpload.js\";\nexport { createObjectSpecifierFromPrimaryKey } from \"./object/createObjectSpecifierFromPrimaryKey.js\";\nexport type { ResultOrError } from \"./ResultOrError.js\";\n\nexport {\n extractDate,\n extractDateInLocalTime,\n extractDateInUTC,\n} from \"./util/datetimeConverters.js\";\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AA8BA,SAASA,IAAI,QAAQ,WAAW;AAChC,SAASC,gBAAgB,QAAQ,yBAAyB;AAE1D,SAASC,qBAAqB,QAAQ,oCAAoC;AAE1E,SAASC,YAAY,QAAQ,mBAAmB;AAChD,SAASC,oBAAoB,QAAQ,2BAA2B;AAGhE,SAASC,sBAAsB,QAAQ,8BAA8B;AACrE,SAASC,mCAAmC,QAAQ,iDAAiD;AAGrG,SACEC,WAAW,EACXC,sBAAsB,EACtBC,gBAAgB,QACX,8BAA8B","ignoreList":[]}
|
|
@@ -53,7 +53,10 @@ describe("intellisense", () => {
|
|
|
53
53
|
let clientPackagePath;
|
|
54
54
|
beforeAll(() => {
|
|
55
55
|
const clientsPackageJson = findUpSync("package.json", {
|
|
56
|
-
cwd: import.meta.
|
|
56
|
+
cwd: import.meta.dirname
|
|
57
|
+
});
|
|
58
|
+
console.log({
|
|
59
|
+
clientsPackageJson
|
|
57
60
|
});
|
|
58
61
|
!(clientsPackageJson != null) ? process.env.NODE_ENV !== "production" ? invariant(false) : invariant(false) : void 0;
|
|
59
62
|
packagesDir = path.join(path.dirname(clientsPackageJson), "..");
|
|
@@ -63,6 +66,7 @@ describe("intellisense", () => {
|
|
|
63
66
|
let intellisenseFilePath;
|
|
64
67
|
beforeEach(async a => {
|
|
65
68
|
intellisenseFilePath = path.join(clientPackagePath, "src", "intellisense.test.helpers", `${a.task.name}.ts`);
|
|
69
|
+
console.log(intellisenseFilePath);
|
|
66
70
|
expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();
|
|
67
71
|
tsServer = await startTsServer(rootLogger);
|
|
68
72
|
await tsServer.sendOpenRequest({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","
|
|
1
|
+
{"version":3,"file":"intellisense.test.js","names":["findUpSync","path","invariant","ts","afterEach","beforeAll","beforeEach","describe","expect","it","vi","startTsServer","rootLogger","hoisted","pino","pinoPretty","EventEmitter","Promise","resolve","level","build","sync","timestampKey","undefined","errorLikeObjectKeys","errorProps","ignore","destination","write","a","at","slice","console","log","packagesDir","clientPackagePath","clientsPackageJson","cwd","import","meta","dirname","process","env","NODE_ENV","join","tsServer","intellisenseFilePath","task","name","sys","fileExists","toBeTruthy","sendOpenRequest","file","stop","timeout","resp","sendQuickInfoRequest","line","offset","body","documentation","toMatchInlineSnapshot"],"sources":["intellisense.test.ts"],"sourcesContent":["/*\n * Copyright 2023 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { findUpSync } from \"find-up\";\nimport * as path from \"node:path\";\nimport invariant from \"tiny-invariant\";\nimport * as ts from \"typescript\";\nimport {\n afterEach,\n beforeAll,\n beforeEach,\n describe,\n expect,\n it,\n vi,\n} from \"vitest\";\nimport type { Logger } from \"./logger/Logger.js\";\nimport type { TsServer } from \"./tsserver.js\";\nimport { startTsServer } from \"./tsserver.js\";\n\n// it needs to be hoisted because its referenced from our mocked WebSocket\n// which must be hoisted to work\nconst rootLogger = await vi.hoisted(async (): Promise<Logger> => {\n const pino = (await import(\"pino\")).pino;\n const pinoPretty = await import(\"pino-pretty\");\n const { EventEmitter } = await import(\"node:events\");\n class PinoConsoleLogDestination extends EventEmitter {\n write(a: string) {\n // remove trailing newline since console.log adds one\n if (a.at(-1) === \"\\n\") a = a.slice(0, -1);\n\n // This lets the test framework aggregate the logs per test, whereas direct to stdout does not\n console.log(a);\n }\n }\n return Promise.resolve(pino(\n { level: \"info\" },\n (pinoPretty.build)({\n sync: true,\n timestampKey: undefined,\n errorLikeObjectKeys: [\"error\", \"err\", \"exception\"],\n errorProps: \"stack,cause,properties\",\n ignore: \"time,hostname,pid\",\n destination: new PinoConsoleLogDestination(),\n }),\n ));\n});\n\ndescribe(\"intellisense\", () => {\n let packagesDir: string;\n let clientPackagePath: string;\n\n beforeAll(() => {\n const clientsPackageJson = findUpSync(\"package.json\", {\n cwd: import.meta.dirname,\n });\n console.log({ clientsPackageJson });\n invariant(clientsPackageJson != null);\n packagesDir = path.join(\n path.dirname(clientsPackageJson),\n \"..\",\n );\n\n clientPackagePath = path.join(packagesDir, \"client\");\n });\n\n let tsServer: TsServer;\n let intellisenseFilePath: string;\n\n beforeEach(async (a) => {\n intellisenseFilePath = path.join(\n clientPackagePath,\n \"src\",\n \"intellisense.test.helpers\",\n `${a.task.name}.ts`,\n );\n\n console.log(intellisenseFilePath);\n\n expect(ts.sys.fileExists(intellisenseFilePath)).toBeTruthy();\n\n tsServer = await startTsServer(rootLogger);\n await tsServer.sendOpenRequest({ file: intellisenseFilePath });\n });\n\n afterEach(async () => {\n tsServer.stop();\n tsServer = undefined as any;\n });\n\n it(\"callsQueryAcceptsObject\", { timeout: 40_000 }, async () => {\n const { resp } = await tsServer.sendQuickInfoRequest({\n file: intellisenseFilePath,\n line: 27,\n offset: 6,\n });\n expect(resp.body?.documentation).toMatchInlineSnapshot(\n `\"(no ontology metadata)\"`,\n );\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,QAAQ,SAAS;AACpC,OAAO,KAAKC,IAAI,MAAM,WAAW;AACjC,OAAOC,SAAS,MAAM,gBAAgB;AACtC,OAAO,KAAKC,EAAE,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AEP,oBAAoB;MAC1BY,IAAI,EAAE,EAAE;MACRC,MAAM,EAAE;IACV,CAAC,CAAC;IACFnD,MAAM,CAACgD,IAAI,CAACI,IAAI,EAAEC,aAAa,CAAC,CAACC,qBAAqB,CACpD,0BACF,CAAC;EACH,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -32,6 +32,13 @@ export function modernToLegacyGroupByClause(groupByClause) {
|
|
|
32
32
|
maxGroupCount: type.$exactWithLimit
|
|
33
33
|
}];
|
|
34
34
|
}
|
|
35
|
+
} else if ("$exact" in type) {
|
|
36
|
+
return [{
|
|
37
|
+
type: "exact",
|
|
38
|
+
field,
|
|
39
|
+
maxGroupCount: type.$exact?.$limit ?? undefined,
|
|
40
|
+
defaultValue: type.$exact.$defaultValue ?? undefined
|
|
41
|
+
}];
|
|
35
42
|
} else if ("$fixedWidth" in type) {
|
|
36
43
|
return [{
|
|
37
44
|
type: "fixedWidth",
|
|
@@ -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,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,QAAQ,IAAIF,IAAI,EAAE;MAC3B,OAAO,CACL;QACEA,IAAI,EAAE,OAAO;QACbD,KAAK;QACLE,aAAa,EAAED,IAAI,CAACG,MAAM,EAAEC,MAAM,IAAIC,SAAS;QAC/CC,YAAY,EAAEN,IAAI,CAACG,MAAM,CAACI,aAAa,IAAIF;MAC7C,CAAC,CACF;IACH,CAAC,MAAM,IAAI,aAAa,IAAIL,IAAI,EAAE;MAChC,OAAO,CAAC;QACNA,IAAI,EAAE,YAAY;QAClBD,KAAK;QACLS,UAAU,EAAER,IAAI,CAACS;MACnB,CAAC,CAAC;IACJ,CAAC,MAAM,IAAI,SAAS,IAAIT,IAAI,EAAE;MAC5B,OAAO,CAAC;QACNA,IAAI,EAAE,QAAQ;QACdD,KAAK;QACLW,MAAM,EAAEV,IAAI,CAACW,OAAO,CAACC,GAAG,CAACC,KAAK,IAAIC,YAAY,CAACD,KAAK,CAAC;MACvD,CAAC,CAAC;IACJ,CAAC,MAAM,IAAI,WAAW,IAAIb,IAAI,EAAE;MAC9B,OAAO,CAAC;QACNA,IAAI,EAAE,UAAU;QAChBD,KAAK;QACLgB,KAAK,EAAEf,IAAI,CAACgB,SAAS,CAAC,CAAC,CAAC;QACxBC,IAAI,EAAExB,eAAe,CAACO,IAAI,CAACgB,SAAS,CAAC,CAAC,CAAC;MACzC,CAAC,CAAC;IACJ,CAAC,MAAM,OAAO,EAAE;EAClB,CAAC,CAAC;AACJ;AAEA,SAASF,YAAYA,CACnBD,KAAoC,EAChB;EACpB,OAAO;IAAEK,UAAU,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;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,W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CAAoC;IAC9D,IAAIlC,kBAAkB,IAAI,IAAI,IAAI;MAAEA;IAAmB,CAAC,CAAC;IACzDC,KAAK;IACLhB,KAAK,EAAEsB,MAAM,CAACe,QAAQ;EACxB,CAAC;AACH;AAKA,SAAST,oBAAoBA,CAC3BP,SAAiB,EACjBvB,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":[]}
|
|
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 \"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,CAC9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C,CAAoC;MAC9D,IAAIlC,kBAAkB,IAAI,IAAI,IAAI;QAAEA;MAAmB,CAAC,CAAC;MACzDC,KAAK;MACLhB,KAAK,EAAE,OAAOsB,MAAM,CAACe,QAAQ,CAAC,KAAK,QAAQ,GACvCf,MAAM,CAACe,QAAQ,CAAC,GAChBf,MAAM,CAACe,QAAQ,CAAC,CAAC,MAAM,CAAC;MAC5Ba,KAAK,EAAE,OAAO5B,MAAM,CAACe,QAAQ,CAAC,KAAK,QAAQ,GACvC,KAAK,GACLf,MAAM,CAACe,QAAQ,CAAC,CAAC,aAAa,CAAC,IAAI;IACzC,CAAC;EACH;EAEA,OAAO;IACLtC,IAAI,EAAEsC,QAAQ,CAACY,SAAS,CAAC,CAAC,CAAoC;IAC9D,IAAIlC,kBAAkB,IAAI,IAAI,IAAI;MAAEA;IAAmB,CAAC,CAAC;IACzDC,KAAK;IACLhB,KAAK,EAAEsB,MAAM,CAACe,QAAQ;EACxB,CAAC;AACH;AAKA,SAAST,oBAAoBA,CAC3BP,SAAiB,EACjBvB,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,53 @@
|
|
|
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
|
+
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
|
+
}
|
|
33
|
+
trace = noop;
|
|
34
|
+
debug = noop;
|
|
35
|
+
warn = noop;
|
|
36
|
+
info = noop;
|
|
37
|
+
error = noop;
|
|
38
|
+
fatal = noop;
|
|
39
|
+
child(bindings, options) {
|
|
40
|
+
return new this.#factory({
|
|
41
|
+
...this.bindings,
|
|
42
|
+
...bindings
|
|
43
|
+
}, {
|
|
44
|
+
level: (options ?? this.options)?.level,
|
|
45
|
+
msgPrefix: [this.options?.msgPrefix, options?.msgPrefix].filter(x => x).join(" ")
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
isLevelEnabled(level) {
|
|
49
|
+
const ourLevel = this.options?.level ?? "info";
|
|
50
|
+
return level in levels && ourLevel in levels && levels[level] >= levels[ourLevel];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
//# 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","child","level","msgPrefix","filter","x","join","isLevelEnabled","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 { LogFn, Logger } from \"./Logger.js\";\n\nfunction noop() {\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\n trace: LogFn = noop;\n debug: LogFn = noop;\n warn: LogFn = noop;\n info: LogFn = noop;\n error: LogFn = noop;\n fatal: 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[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MAA8B;IAEvE,OAAOA,KAAK,IAAIb,MAAM,IAAImB,QAAQ,IAAInB,MAAM,IACvCA,MAAM,CAACa,KAAK,CAAwB,IAAIb,MAAM,CAACmB,QAAQ,CAAC;EAC/D;AACF","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Logger.js","names":[],"sources":["Logger.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface Logger {\n trace: LogFn;\n debug: LogFn;\n fatal: LogFn;\n error: LogFn;\n warn: LogFn;\n info: LogFn;\n\n isLevelEnabled(level: string): boolean;\n\n child(\n bindings: Record<string, any>,\n options?: { level?: string; msgPrefix?: string },\n ): Logger;\n}\n\
|
|
1
|
+
{"version":3,"file":"Logger.js","names":[],"sources":["Logger.ts"],"sourcesContent":["/*\n * Copyright 2024 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexport interface Logger {\n trace: LogFn;\n debug: LogFn;\n fatal: LogFn;\n error: LogFn;\n warn: LogFn;\n info: LogFn;\n\n isLevelEnabled(level: string): boolean;\n\n child(\n bindings: Record<string, any>,\n options?: { level?: string; msgPrefix?: string },\n ): Logger;\n}\n\nexport interface LogFn {\n (obj: unknown, msg?: string, ...args: any[]): void;\n (msg: string, ...args: any[]): void;\n}\n"],"mappings":"","ignoreList":[]}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 createLogMethod(name, bindings, options) {
|
|
19
|
+
const msgs = [name];
|
|
20
|
+
if (options?.msgPrefix) {
|
|
21
|
+
msgs.push(options.msgPrefix);
|
|
22
|
+
}
|
|
23
|
+
if (typeof bindings === "object" && "methodName" in bindings) {
|
|
24
|
+
msgs.push(`.${bindings.methodName}()`);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line no-console
|
|
28
|
+
return console[name === "fatal" ? "error" : name].bind(console, msgs.join(" "));
|
|
29
|
+
}
|
|
30
|
+
export class MinimalLogger extends BaseLogger {
|
|
31
|
+
constructor(bindings = {}, options = {}) {
|
|
32
|
+
super(bindings, {
|
|
33
|
+
...options,
|
|
34
|
+
level: options.level ?? "error"
|
|
35
|
+
}, MinimalLogger);
|
|
36
|
+
for (const k of ["trace", "debug", "info", "warn", "error", "fatal"]) {
|
|
37
|
+
this[k] = createLogMethod(k, bindings, options);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=MinimalLogger.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MinimalLogger.js","names":["BaseLogger","createLogMethod","name","bindings","options","msgs","msgPrefix","push","methodName","console","bind","join","MinimalLogger","constructor","level","k"],"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 { BaseLogger } from \"./BaseLogger.js\";\nimport type { LogFn, Logger } from \"./Logger.js\";\n\nfunction createLogMethod(\n name: \"trace\" | \"debug\" | \"info\" | \"warn\" | \"error\" | \"fatal\",\n bindings: Record<string, any>,\n options: { level?: string; msgPrefix?: string },\n): LogFn {\n const msgs: string[] = [name];\n\n if (options?.msgPrefix) {\n msgs.push(options.msgPrefix);\n }\n\n if (typeof bindings === \"object\" && \"methodName\" in bindings) {\n msgs.push(`.${bindings.methodName}()`);\n }\n\n // eslint-disable-next-line no-console\n return console[name === \"fatal\" ? \"error\" : name].bind(\n console,\n msgs.join(\" \"),\n );\n}\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 for (\n const k of [\"trace\", \"debug\", \"info\", \"warn\", \"error\", \"fatal\"] as const\n ) {\n this[k] = createLogMethod(k, bindings, options);\n }\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,UAAU,QAAQ,iBAAiB;AAG5C,SAASC,eAAeA,CACtBC,IAA6D,EAC7DC,QAA6B,EAC7BC,OAA+C,EACxC;EACP,MAAMC,IAAc,GAAG,CAACH,IAAI,CAAC;EAE7B,IAAIE,OAAO,EAAEE,SAAS,EAAE;IACtBD,IAAI,CAACE,IAAI,CAACH,OAAO,CAACE,SAAS,CAAC;EAC9B;EAEA,IAAI,OAAOH,QAAQ,KAAK,QAAQ,IAAI,YAAY,IAAIA,QAAQ,EAAE;IAC5DE,IAAI,CAACE,IAAI,CAAC,IAAIJ,QAAQ,CAACK,UAAU,IAAI,CAAC;EACxC;;EAEA;EACA,OAAOC,OAAO,CAACP,IAAI,KAAK,OAAO,GAAG,OAAO,GAAGA,IAAI,CAAC,CAACQ,IAAI,CACpDD,OAAO,EACPJ,IAAI,CAACM,IAAI,CAAC,GAAG,CACf,CAAC;AACH;AAEA,OAAO,MAAMC,aAAa,SAASZ,UAAU,CAAmB;EAC9Da,WAAWA,CACTV,QAA6B,GAAG,CAAC,CAAC,EAClCC,OAA+C,GAAG,CAAC,CAAC,EACpD;IACA,KAAK,CACHD,QAAQ,EACR;MAAE,GAAGC,OAAO;MAAEU,KAAK,EAAEV,OAAO,CAACU,KAAK,IAAI;IAAQ,CAAC,EAC/CF,aACF,CAAC;IAED,KACE,MAAMG,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,EAC/D;MACA,IAAI,CAACA,CAAC,CAAC,GAAGd,eAAe,CAACc,CAAC,EAAEZ,QAAQ,EAAEC,OAAO,CAAC;IACjD;EACF;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":[]}
|