@osdk/client 2.1.1 → 2.2.0-beta.10
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 +129 -181
- 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.js +106 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.js.map +1 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js +100 -0
- package/build/browser/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -0
- package/build/browser/fetchMetadata.test.js +11 -9
- package/build/browser/fetchMetadata.test.js.map +1 -1
- package/build/browser/index.js +1 -0
- package/build/browser/index.js.map +1 -1
- package/build/browser/intellisense.test.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 +313 -79
- 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 +16 -0
- 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-FWVJ2AKD.cjs → chunk-EY52J5Z4.cjs} +25 -15
- package/build/cjs/chunk-EY52J5Z4.cjs.map +1 -0
- package/build/cjs/{chunk-DLSRNRTA.cjs → chunk-MCQVHD2F.cjs} +155 -42
- 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.js +106 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.js.map +1 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js +100 -0
- package/build/esm/derivedProperties/createWithPropertiesObjectSet.test.js.map +1 -0
- package/build/esm/fetchMetadata.test.js +11 -9
- package/build/esm/fetchMetadata.test.js.map +1 -1
- package/build/esm/index.js +1 -0
- package/build/esm/index.js.map +1 -1
- package/build/esm/intellisense.test.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 +313 -79
- 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 +16 -0
- 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/derivedProperties/createWithPropertiesObjectSet.d.ts +1 -0
- package/build/types/derivedProperties/createWithPropertiesObjectSet.d.ts.map +1 -0
- package/build/types/derivedProperties/createWithPropertiesObjectSet.test.d.ts +1 -0
- package/build/types/derivedProperties/createWithPropertiesObjectSet.test.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-DLSRNRTA.cjs.map +0 -1
- package/build/cjs/chunk-FWVJ2AKD.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
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { beforeEach, describe, expect, it, vi } from "vitest";
|
|
18
|
+
import { BulkObjectLoader } from "./BulkObjectLoader.js";
|
|
19
|
+
import { createClientMockHelper } from "./testUtils.js";
|
|
20
|
+
describe(BulkObjectLoader, () => {
|
|
21
|
+
let client;
|
|
22
|
+
let mockClient;
|
|
23
|
+
beforeEach(async () => {
|
|
24
|
+
mockClient = createClientMockHelper();
|
|
25
|
+
client = mockClient.client;
|
|
26
|
+
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/unbound-method
|
|
28
|
+
vi.mocked(client.fetchMetadata).mockReturnValue(Promise.resolve({
|
|
29
|
+
primaryKeyApiName: "id"
|
|
30
|
+
}));
|
|
31
|
+
});
|
|
32
|
+
const employees = [{
|
|
33
|
+
$apiName: "Employee",
|
|
34
|
+
$objectType: "Employee",
|
|
35
|
+
$primaryKey: 0
|
|
36
|
+
}, {
|
|
37
|
+
$apiName: "Employee",
|
|
38
|
+
$objectType: "Employee",
|
|
39
|
+
$primaryKey: 1
|
|
40
|
+
}, {
|
|
41
|
+
$apiName: "Employee",
|
|
42
|
+
$objectType: "Employee",
|
|
43
|
+
$primaryKey: 2
|
|
44
|
+
}];
|
|
45
|
+
it("splits up work by count", async () => {
|
|
46
|
+
const loader = new BulkObjectLoader(client, 25, /*ms*/2 /*entries*/);
|
|
47
|
+
const firstRequest = mockClient.mockFetchPageOnce();
|
|
48
|
+
const secondRequest = mockClient.mockFetchPageOnce();
|
|
49
|
+
const load0 = loader.fetch("Employee", 0);
|
|
50
|
+
const load1 = loader.fetch("Employee", 1);
|
|
51
|
+
const load2 = loader.fetch("Employee", 2);
|
|
52
|
+
firstRequest.resolve({
|
|
53
|
+
data: [employees[0], employees[1]],
|
|
54
|
+
nextPageToken: undefined,
|
|
55
|
+
totalCount: "2"
|
|
56
|
+
});
|
|
57
|
+
await expect(load0).resolves.toMatchObject({
|
|
58
|
+
$primaryKey: 0
|
|
59
|
+
});
|
|
60
|
+
await expect(load1).resolves.toMatchObject({
|
|
61
|
+
$primaryKey: 1
|
|
62
|
+
});
|
|
63
|
+
const mock = vi.fn();
|
|
64
|
+
void load2.then(mock);
|
|
65
|
+
expect(mock).not.toHaveBeenCalled();
|
|
66
|
+
secondRequest.resolve({
|
|
67
|
+
data: [employees[2]],
|
|
68
|
+
nextPageToken: undefined,
|
|
69
|
+
totalCount: "1"
|
|
70
|
+
});
|
|
71
|
+
await expect(load2).resolves.toMatchObject({
|
|
72
|
+
$primaryKey: 2
|
|
73
|
+
});
|
|
74
|
+
expect(mock).toHaveBeenCalled();
|
|
75
|
+
});
|
|
76
|
+
it("splits up work by time", async () => {
|
|
77
|
+
const loader = new BulkObjectLoader(client, /*ms*/25, /*entries*/100);
|
|
78
|
+
const firstRequest = mockClient.mockFetchPageOnce();
|
|
79
|
+
const secondRequest = mockClient.mockFetchPageOnce();
|
|
80
|
+
vi.useFakeTimers();
|
|
81
|
+
const load0 = loader.fetch("Employee", 0);
|
|
82
|
+
vi.advanceTimersByTime(26);
|
|
83
|
+
const load1 = loader.fetch("Employee", 1);
|
|
84
|
+
const load2 = loader.fetch("Employee", 2);
|
|
85
|
+
firstRequest.resolve({
|
|
86
|
+
data: [employees[0]],
|
|
87
|
+
nextPageToken: undefined,
|
|
88
|
+
totalCount: "1"
|
|
89
|
+
});
|
|
90
|
+
vi.runOnlyPendingTimers();
|
|
91
|
+
await expect(load0).resolves.toMatchObject({
|
|
92
|
+
$primaryKey: 0
|
|
93
|
+
});
|
|
94
|
+
const mockThen = vi.fn();
|
|
95
|
+
void load2.then(mockThen);
|
|
96
|
+
expect(mockThen).not.toHaveBeenCalled();
|
|
97
|
+
secondRequest.resolve({
|
|
98
|
+
data: [employees[1], employees[2]],
|
|
99
|
+
nextPageToken: undefined,
|
|
100
|
+
totalCount: "2"
|
|
101
|
+
});
|
|
102
|
+
await expect(load1).resolves.toMatchObject({
|
|
103
|
+
$primaryKey: 1
|
|
104
|
+
});
|
|
105
|
+
await expect(load2).resolves.toMatchObject({
|
|
106
|
+
$primaryKey: 2
|
|
107
|
+
});
|
|
108
|
+
expect(mockThen).toHaveBeenCalled();
|
|
109
|
+
vi.useRealTimers();
|
|
110
|
+
});
|
|
111
|
+
});
|
|
112
|
+
//# sourceMappingURL=BulkObjectLoader.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"BulkObjectLoader.test.js","names":["beforeEach","describe","expect","it","vi","BulkObjectLoader","createClientMockHelper","client","mockClient","mocked","fetchMetadata","mockReturnValue","Promise","resolve","primaryKeyApiName","employees","$apiName","$objectType","$primaryKey","loader","firstRequest","mockFetchPageOnce","secondRequest","load0","fetch","load1","load2","data","nextPageToken","undefined","totalCount","resolves","toMatchObject","mock","fn","then","not","toHaveBeenCalled","useFakeTimers","advanceTimersByTime","runOnlyPendingTimers","mockThen","useRealTimers"],"sources":["BulkObjectLoader.test.ts"],"sourcesContent":["/*\n * Copyright 2025 Palantir Technologies, Inc. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport type { ObjectMetadata } from \"@osdk/api\";\nimport type { Mock } from \"vitest\";\nimport { beforeEach, describe, expect, it, vi } from \"vitest\";\nimport type { Client } from \"../../Client.js\";\nimport { BulkObjectLoader } from \"./BulkObjectLoader.js\";\nimport { createClientMockHelper, type MockClientHelper } from \"./testUtils.js\";\n\ndescribe(BulkObjectLoader, () => {\n let client: Mock<Client> & Client;\n let mockClient: MockClientHelper;\n\n beforeEach(async () => {\n mockClient = createClientMockHelper();\n client = mockClient.client;\n\n // eslint-disable-next-line @typescript-eslint/unbound-method\n vi.mocked(client.fetchMetadata).mockReturnValue(\n Promise.resolve(\n {\n primaryKeyApiName: \"id\",\n } satisfies Pick<ObjectMetadata, \"primaryKeyApiName\"> as ObjectMetadata,\n ),\n );\n });\n\n const employees = [\n {\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 0,\n },\n {\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 1,\n },\n {\n $apiName: \"Employee\",\n $objectType: \"Employee\",\n $primaryKey: 2,\n },\n ];\n\n it(\"splits up work by count\", async () => {\n const loader = new BulkObjectLoader(client, 25, /*ms*/ 2 /*entries*/);\n\n const firstRequest = mockClient.mockFetchPageOnce();\n const secondRequest = mockClient.mockFetchPageOnce();\n\n const load0 = loader.fetch(\"Employee\", 0);\n const load1 = loader.fetch(\"Employee\", 1);\n const load2 = loader.fetch(\"Employee\", 2);\n\n firstRequest.resolve({\n data: [employees[0], employees[1]],\n nextPageToken: undefined,\n totalCount: \"2\",\n });\n\n await expect(load0).resolves.toMatchObject({\n $primaryKey: 0,\n });\n\n await expect(load1).resolves.toMatchObject({\n $primaryKey: 1,\n });\n\n const mock = vi.fn();\n void load2.then(mock);\n expect(mock).not.toHaveBeenCalled();\n\n secondRequest.resolve({\n data: [employees[2]],\n nextPageToken: undefined,\n totalCount: \"1\",\n });\n\n await expect(load2).resolves.toMatchObject({\n $primaryKey: 2,\n });\n\n expect(mock).toHaveBeenCalled();\n });\n\n it(\"splits up work by time\", async () => {\n const loader = new BulkObjectLoader(client, /*ms*/ 25, /*entries*/ 100);\n\n const firstRequest = mockClient.mockFetchPageOnce();\n const secondRequest = mockClient.mockFetchPageOnce();\n\n vi.useFakeTimers();\n\n const load0 = loader.fetch(\"Employee\", 0);\n\n vi.advanceTimersByTime(26);\n\n const load1 = loader.fetch(\"Employee\", 1);\n const load2 = loader.fetch(\"Employee\", 2);\n\n firstRequest.resolve({\n data: [employees[0]],\n nextPageToken: undefined,\n totalCount: \"1\",\n });\n\n vi.runOnlyPendingTimers();\n\n await expect(load0).resolves.toMatchObject({\n $primaryKey: 0,\n });\n\n const mockThen = vi.fn();\n void load2.then(mockThen);\n\n expect(mockThen).not.toHaveBeenCalled();\n\n secondRequest.resolve({\n data: [\n employees[1],\n employees[2],\n ],\n nextPageToken: undefined,\n totalCount: \"2\",\n });\n\n await expect(load1).resolves.toMatchObject({\n $primaryKey: 1,\n });\n\n await expect(load2).resolves.toMatchObject({\n $primaryKey: 2,\n });\n\n expect(mockThen).toHaveBeenCalled();\n\n vi.useRealTimers();\n });\n});\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA,SAASA,UAAU,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,EAAE,EAAEC,EAAE,QAAQ,QAAQ;AAE7D,SAASC,gBAAgB,QAAQ,uBAAuB;AACxD,SAASC,sBAAsB,QAA+B,gBAAgB;AAE9EL,QAAQ,CAACI,gBAAgB,EAAE,MAAM;EAC/B,IAAIE,MAA6B;EACjC,IAAIC,UAA4B;EAEhCR,UAAU,CAAC,YAAY;IACrBQ,UAAU,GAAGF,sBAAsB,CAAC,CAAC;IACrCC,MAAM,GAAGC,UAAU,CAACD,MAAM;;IAE1B;IACAH,EAAE,CAACK,MAAM,CAACF,MAAM,CAACG,aAAa,CAAC,CAACC,eAAe,CAC7CC,OAAO,CAACC,OAAO,CACb;MACEC,iBAAiB,EAAE;IACrB,CACF,CACF,CAAC;EACH,CAAC,CAAC;EAEF,MAAMC,SAAS,GAAG,CAChB;IACEC,QAAQ,EAAE,UAAU;IACpBC,WAAW,EAAE,UAAU;IACvBC,WAAW,EAAE;EACf,CAAC,EACD;IACEF,Q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,GAAGrC,EAAE,CAAC8B,EAAE,CAAC,CAAC;IACxB,KAAKR,KAAK,CAACS,IAAI,CAACM,QAAQ,CAAC;IAEzBvC,MAAM,CAACuC,QAAQ,CAAC,CAACL,GAAG,CAACC,gBAAgB,CAAC,CAAC;IAEvCf,aAAa,CAACT,OAAO,CAAC;MACpBc,IAAI,EAAE,CACJZ,SAAS,CAAC,CAAC,CAAC,EACZA,SAAS,CAAC,CAAC,CAAC,CACb;MACDa,aAAa,EAAEC,SAAS;MACxBC,UAAU,EAAE;IACd,CAAC,CAAC;IAEF,MAAM5B,MAAM,CAACuB,KAAK,CAAC,CAACM,QAAQ,CAACC,aAAa,CAAC;MACzCd,WAAW,EAAE;IACf,CAAC,CAAC;IAEF,MAAMhB,MAAM,CAACwB,KAAK,CAAC,CAACK,QAAQ,CAACC,aAAa,CAAC;MACzCd,WAAW,EAAE;IACf,CAAC,CAAC;IAEFhB,MAAM,CAACuC,QAAQ,CAAC,CAACJ,gBAAgB,CAAC,CAAC;IAEnCjC,EAAE,CAACsC,aAAa,CAAC,CAAC;EACpB,CAAC,CAAC;AACJ,CAAC,CAAC","ignoreList":[]}
|
|
@@ -1,2 +1,39 @@
|
|
|
1
|
-
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2025 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* This isn't performant and should only be used for debug logging!
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export function DEBUG_ONLY__cacheKeyToString(x) {
|
|
22
|
+
if (process.env.NODE_ENV !== "production") {
|
|
23
|
+
return `${x.type}CacheKey<${x.otherKeys.map(xx => JSON.stringify(xx)).join(", ")}>`.replaceAll("\"", "'");
|
|
24
|
+
} else {
|
|
25
|
+
throw new Error("not implemented");
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* This isn't performant and should only be used for debug logging!
|
|
30
|
+
* @internal
|
|
31
|
+
*/
|
|
32
|
+
export function DEBUG_ONLY__cacheKeysToString(x) {
|
|
33
|
+
if (process.env.NODE_ENV !== "production") {
|
|
34
|
+
return "\n - " + x.map(DEBUG_ONLY__cacheKeyToString).join("\n - ");
|
|
35
|
+
} else {
|
|
36
|
+
throw new Error("not implemented");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
2
39
|
//# sourceMappingURL=CacheKey.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CacheKey.js","names":[],"sources":["CacheKey.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 { Query } from \"./Query.js\";\n\nexport type CacheKey<\n X extends string = string,\n T_StoreValue = unknown,\n T_Query extends Query<any, any, any> = Query<any, any, any>,\n T_KeyFactoryArgs extends any[] = any[],\n> = {\n type: X;\n otherKeys: T_KeyFactoryArgs;\n __cacheKey: {\n value: T_StoreValue;\n query: T_Query;\n args: T_KeyFactoryArgs;\n };\n};\n"],"mappings":"","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"CacheKey.js","names":["DEBUG_ONLY__cacheKeyToString","x","process","env","NODE_ENV","type","otherKeys","map","xx","JSON","stringify","join","replaceAll","Error","DEBUG_ONLY__cacheKeysToString"],"sources":["CacheKey.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 { Query } from \"./Query.js\";\n\nexport type CacheKey<\n X extends string = string,\n T_StoreValue = unknown,\n T_Query extends Query<any, any, any> = Query<any, any, any>,\n T_KeyFactoryArgs extends any[] = any[],\n> = {\n type: X;\n otherKeys: T_KeyFactoryArgs;\n __cacheKey: {\n value: T_StoreValue;\n query: T_Query;\n args: T_KeyFactoryArgs;\n };\n};\n\n/**\n * This isn't performant and should only be used for debug logging!\n * @internal\n */\nexport function DEBUG_ONLY__cacheKeyToString(x: CacheKey) {\n if (process.env.NODE_ENV !== \"production\") {\n return `${x.type}CacheKey<${\n x.otherKeys.map(xx => JSON.stringify(xx)).join(\", \")\n }>`.replaceAll(\"\\\"\", \"'\");\n } else {\n throw new Error(\"not implemented\");\n }\n}\n/**\n * This isn't performant and should only be used for debug logging!\n * @internal\n */\nexport function DEBUG_ONLY__cacheKeysToString(x: CacheKey[]) {\n if (process.env.NODE_ENV !== \"production\") {\n return \"\\n - \" + x.map(DEBUG_ONLY__cacheKeyToString).join(\"\\n - \");\n } else {\n throw new Error(\"not implemented\");\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAmBA;AACA;AACA;AACA;AACA,OAAO,SAASA,4BAA4BA,CAACC,CAAW,EAAE;EACxD,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,OAAO,GAAGH,CAAC,CAACI,IAAI,YACdJ,CAAC,CAACK,SAAS,CAACC,GAAG,CAACC,EAAE,IAAIC,IAAI,CAACC,SAAS,CAACF,EAAE,CAAC,CAAC,CAACG,IAAI,CAAC,IAAI,CAAC,GACnD,CAACC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC;EAC3B,CAAC,MAAM;IACL,MAAM,IAAIC,KAAK,CAAC,iBAAiB,CAAC;EACpC;AACF;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,6BAA6BA,CAACb,CAAa,EAAE;EAC3D,IAAIC,OAAO,CAACC,GAAG,CAACC,QAAQ,KAAK,YAAY,EAAE;IACzC,OAAO,QAAQ,GAAGH,CAAC,CAACM,GAAG,CAACP,4BAA4B,CAAC,CAACW,IAAI,CAAC,QAAQ,CAAC;EACtE,CAAC,MAAM;IACL,MAAM,IAAIE,KAAK,CAAC,iBAAiB,CAAC;EACpC;AACF","ignoreList":[]}
|
|
@@ -28,7 +28,7 @@ export class CacheKeys {
|
|
|
28
28
|
});
|
|
29
29
|
#cacheKeyFactories = new Map();
|
|
30
30
|
#onCreate;
|
|
31
|
-
constructor(whereCanonicalizer, onCreate) {
|
|
31
|
+
constructor(whereCanonicalizer, orderByCanonicalizer, onCreate) {
|
|
32
32
|
this.#onCreate = onCreate;
|
|
33
33
|
this.#registerCacheKeyFactory("object", (apiName, pk) => {
|
|
34
34
|
if (process.env.NODE_ENV !== "production" && DEBUG_CACHE_KEYS) {
|
|
@@ -37,12 +37,12 @@ export class CacheKeys {
|
|
|
37
37
|
}
|
|
38
38
|
return this.#cacheKeys.lookupArray(["object", apiName, pk]);
|
|
39
39
|
});
|
|
40
|
-
this.#registerCacheKeyFactory("list", (apiName, where) => {
|
|
40
|
+
this.#registerCacheKeyFactory("list", (type, apiName, where, orderBy) => {
|
|
41
41
|
if (process.env.NODE_ENV !== "production" && DEBUG_CACHE_KEYS) {
|
|
42
42
|
// eslint-disable-next-line no-console
|
|
43
|
-
console.debug(`CacheKeys.get([list, ${apiName}, ${JSON.stringify(where)}]) -- already exists? `, this.#cacheKeys.peekArray(["list", apiName, whereCanonicalizer.canonicalize(where)]) != null);
|
|
43
|
+
console.debug(`CacheKeys.get([list, ${apiName}, ${JSON.stringify(where)}, ${JSON.stringify(orderBy)}]) -- already exists? `, this.#cacheKeys.peekArray(["list", apiName, whereCanonicalizer.canonicalize(where), orderByCanonicalizer.canonicalize(orderBy)]) != null);
|
|
44
44
|
}
|
|
45
|
-
return this.#cacheKeys.lookupArray(["list", apiName, whereCanonicalizer.canonicalize(where)]);
|
|
45
|
+
return this.#cacheKeys.lookupArray(["list", type, apiName, whereCanonicalizer.canonicalize(where), orderByCanonicalizer.canonicalize(orderBy)]);
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
#registerCacheKeyFactory(type, factory) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CacheKeys.js","names":["Trie","invariant","DEBUG_CACHE_KEYS","CacheKeys","cacheKeys","keys","ret","type","otherKeys","slice","onCreate","cacheKeyFactories","Map","constructor","whereCanonicalizer","registerCacheKeyFactory","apiName","pk","process","env","NODE_ENV","console","debug","peekArray","lookupArray","where","JSON","stringify","canonicalize","#registerCacheKeyFactory","factory","set","get","args","remove","cacheKey"],"sources":["CacheKeys.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 { Trie } from \"@wry/trie\";\nimport invariant from \"tiny-invariant\";\nimport { DEBUG_CACHE_KEYS } from \"../DebugFlags.js\";\nimport type { CacheKey } from \"./CacheKey.js\";\nimport type { ListCacheKey } from \"./ListQuery.js\";\nimport type { ObjectCacheKey } from \"./ObjectQuery.js\";\nimport type { WhereClauseCanonicalizer } from \"./WhereClauseCanonicalizer.js\";\n\nexport class CacheKeys {\n #cacheKeys = new Trie<CacheKey<string, any, any>>(false, (keys) => {\n const ret = {\n type: keys[0],\n otherKeys: keys.slice(1),\n } as unknown as CacheKey<\n string,\n any,\n any\n >;\n this.#onCreate(ret);\n return ret;\n });\n #cacheKeyFactories = new Map<string, (...args: any[]) => CacheKey>();\n #onCreate: (cacheKey: CacheKey) => void;\n\n constructor(\n whereCanonicalizer: WhereClauseCanonicalizer,\n onCreate: (cacheKey: CacheKey) => void,\n ) {\n this.#onCreate = onCreate;\n this.#registerCacheKeyFactory<ObjectCacheKey>(\n \"object\",\n (apiName, pk) => {\n if (process.env.NODE_ENV !== \"production\" && DEBUG_CACHE_KEYS) {\n // eslint-disable-next-line no-console\n console.debug(\n `CacheKeys.get([object, ${apiName}, ${pk}]) -- already exists? `,\n this.#cacheKeys.peekArray([\n \"object\",\n apiName,\n pk,\n ]) != null,\n );\n }\n return this.#cacheKeys.lookupArray([\n \"object\",\n apiName,\n pk,\n ]) as ObjectCacheKey;\n },\n );\n this.#registerCacheKeyFactory<ListCacheKey>(\n \"list\",\n (apiName, where) => {\n if (process.env.NODE_ENV !== \"production\" && DEBUG_CACHE_KEYS) {\n // eslint-disable-next-line no-console\n console.debug(\n `CacheKeys.get([list, ${apiName}, ${\n JSON.stringify(
|
|
1
|
+
{"version":3,"file":"CacheKeys.js","names":["Trie","invariant","DEBUG_CACHE_KEYS","CacheKeys","cacheKeys","keys","ret","type","otherKeys","slice","onCreate","cacheKeyFactories","Map","constructor","whereCanonicalizer","orderByCanonicalizer","registerCacheKeyFactory","apiName","pk","process","env","NODE_ENV","console","debug","peekArray","lookupArray","where","orderBy","JSON","stringify","canonicalize","#registerCacheKeyFactory","factory","set","get","args","remove","cacheKey"],"sources":["CacheKeys.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 { Trie } from \"@wry/trie\";\nimport invariant from \"tiny-invariant\";\nimport { DEBUG_CACHE_KEYS } from \"../DebugFlags.js\";\nimport type { CacheKey } from \"./CacheKey.js\";\nimport type { ListCacheKey } from \"./ListQuery.js\";\nimport type { ObjectCacheKey } from \"./ObjectQuery.js\";\nimport type { OrderByCanonicalizer } from \"./OrderByCanonicalizer.js\";\nimport type { WhereClauseCanonicalizer } from \"./WhereClauseCanonicalizer.js\";\n\ntype CacheKeyArgs<K extends CacheKey> = [K[\"type\"], ...K[\"otherKeys\"]];\n\nexport class CacheKeys {\n #cacheKeys = new Trie<CacheKey<string, any, any>>(false, (keys) => {\n const ret = {\n type: keys[0],\n otherKeys: keys.slice(1),\n } as unknown as CacheKey<\n string,\n any,\n any\n >;\n this.#onCreate(ret);\n return ret;\n });\n #cacheKeyFactories = new Map<string, (...args: any[]) => CacheKey>();\n #onCreate: (cacheKey: CacheKey) => void;\n\n constructor(\n whereCanonicalizer: WhereClauseCanonicalizer,\n orderByCanonicalizer: OrderByCanonicalizer,\n onCreate: (cacheKey: CacheKey) => void,\n ) {\n this.#onCreate = onCreate;\n this.#registerCacheKeyFactory<ObjectCacheKey>(\n \"object\",\n (apiName, pk) => {\n if (process.env.NODE_ENV !== \"production\" && DEBUG_CACHE_KEYS) {\n // eslint-disable-next-line no-console\n console.debug(\n `CacheKeys.get([object, ${apiName}, ${pk}]) -- already exists? `,\n this.#cacheKeys.peekArray([\n \"object\",\n apiName,\n pk,\n ]) != null,\n );\n }\n return this.#cacheKeys.lookupArray([\n \"object\",\n apiName,\n pk,\n ]) as ObjectCacheKey;\n },\n );\n this.#registerCacheKeyFactory<ListCacheKey>(\n \"list\",\n (type, apiName, where, orderBy) => {\n if (process.env.NODE_ENV !== \"production\" && DEBUG_CACHE_KEYS) {\n // eslint-disable-next-line no-console\n console.debug(\n `CacheKeys.get([list, ${apiName}, ${JSON.stringify(where)}, ${\n JSON.stringify(orderBy)\n }]) -- already exists? `,\n this.#cacheKeys.peekArray([\n \"list\",\n apiName,\n whereCanonicalizer.canonicalize(where),\n orderByCanonicalizer.canonicalize(orderBy),\n ]) != null,\n );\n }\n return this.#cacheKeys.lookupArray<\n CacheKeyArgs<ListCacheKey>\n >([\n \"list\",\n type,\n apiName,\n whereCanonicalizer.canonicalize(where),\n orderByCanonicalizer.canonicalize(orderBy),\n ]) as ListCacheKey;\n },\n );\n }\n\n #registerCacheKeyFactory<K extends CacheKey>(\n type: K[\"type\"],\n factory: (...args: K[\"__cacheKey\"][\"args\"]) => K,\n ): void {\n this.#cacheKeyFactories.set(type, factory);\n }\n\n get<K extends CacheKey<string, any, any>>(\n type: K[\"type\"],\n ...args: K[\"__cacheKey\"][\"args\"]\n ): K {\n const factory = this.#cacheKeyFactories.get(type);\n invariant(factory, `no cache key factory for type \"${type}\"`);\n return factory(...args) as K;\n }\n\n remove<K extends CacheKey<string, any, any>>(\n cacheKey: K,\n ): void {\n this.#cacheKeys.remove(cacheKey.type, ...cacheKey.otherKeys);\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,IAAI,QAAQ,WAAW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
|
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 { MultiMap } from "mnemonist";
|
|
18
|
+
import { DEBUG_ONLY__cacheKeyToString } from "./CacheKey.js";
|
|
19
|
+
export class Changes {
|
|
20
|
+
modifiedObjects = new MultiMap();
|
|
21
|
+
addedObjects = new MultiMap();
|
|
22
|
+
added = new Set();
|
|
23
|
+
modified = new Set();
|
|
24
|
+
registerObject = (cacheKey, data, isNew) => {
|
|
25
|
+
this[isNew ? "addedObjects" : "modifiedObjects"].set(data.$apiName, data);
|
|
26
|
+
this[isNew ? "added" : "modified"].add(cacheKey);
|
|
27
|
+
};
|
|
28
|
+
registerList = key => {
|
|
29
|
+
this.modified.add(key);
|
|
30
|
+
};
|
|
31
|
+
isEmpty() {
|
|
32
|
+
return this.modifiedObjects.size === 0 && this.addedObjects.size === 0 && this.added.size === 0 && this.modified.size === 0;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export function createChangedObjects() {
|
|
36
|
+
return new Changes();
|
|
37
|
+
}
|
|
38
|
+
export function DEBUG_ONLY__changesToString(changes) {
|
|
39
|
+
if (process.env.NODE_ENV !== "production") {
|
|
40
|
+
return JSON.stringify({
|
|
41
|
+
modifiedObjects: multimapHelper(changes.modifiedObjects),
|
|
42
|
+
addedObjects: multimapHelper(changes.addedObjects),
|
|
43
|
+
added: listHelper(changes.added),
|
|
44
|
+
modified: listHelper(changes.modified)
|
|
45
|
+
}, null, 2);
|
|
46
|
+
} else {
|
|
47
|
+
throw new Error("not implemented");
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function listHelper(set) {
|
|
51
|
+
return Array.from(set).map(DEBUG_ONLY__cacheKeyToString);
|
|
52
|
+
}
|
|
53
|
+
function multimapHelper(multimap) {
|
|
54
|
+
return Object.fromEntries(Array.from(multimap.associations()).map(([type, objects]) => {
|
|
55
|
+
return [type, objects.map(o => o.$primaryKey)];
|
|
56
|
+
}));
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=Changes.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Changes.js","names":["MultiMap","DEBUG_ONLY__cacheKeyToString","Changes","modifiedObjects","addedObjects","added","Set","modified","registerObject","cacheKey","data","isNew","set","$apiName","add","registerList","key","isEmpty","size","createChangedObjects","DEBUG_ONLY__changesToString","changes","process","env","NODE_ENV","JSON","stringify","multimapHelper","listHelper","Error","Array","from","map","multimap","Object","fromEntries","associations","type","objects","o","$primaryKey"],"sources":["Changes.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 { MultiMap } from \"mnemonist\";\nimport type { ObjectHolder } from \"../../object/convertWireToOsdkObjects/ObjectHolder.js\";\nimport type { CacheKey } from \"./CacheKey.js\";\nimport { DEBUG_ONLY__cacheKeyToString } from \"./CacheKey.js\";\nimport type { ListCacheKey } from \"./ListQuery.js\";\nimport type { ObjectCacheKey } from \"./ObjectQuery.js\";\n\nexport class Changes {\n modifiedObjects: MultiMap<string, ObjectHolder> = new MultiMap();\n addedObjects: MultiMap<string, ObjectHolder> = new MultiMap();\n\n added: Set<ListCacheKey | ObjectCacheKey> = new Set();\n modified: Set<ListCacheKey | ObjectCacheKey> = new Set();\n\n registerObject = (\n cacheKey: ObjectCacheKey,\n data: ObjectHolder,\n isNew: boolean,\n ): void => {\n this[isNew ? \"addedObjects\" : \"modifiedObjects\"].set(data.$apiName, data);\n this[isNew ? \"added\" : \"modified\"].add(cacheKey);\n };\n\n registerList = (key: ListCacheKey): void => {\n this.modified.add(key);\n };\n\n isEmpty(): boolean {\n return (\n this.modifiedObjects.size === 0\n && this.addedObjects.size === 0\n && this.added.size === 0\n && this.modified.size === 0\n );\n }\n}\n\nexport function createChangedObjects(): Changes {\n return new Changes();\n}\n\nexport function DEBUG_ONLY__changesToString(changes: Changes): string {\n if (process.env.NODE_ENV !== \"production\") {\n return JSON.stringify(\n {\n modifiedObjects: multimapHelper(changes.modifiedObjects),\n addedObjects: multimapHelper(changes.addedObjects),\n added: listHelper(changes.added),\n modified: listHelper(changes.modified),\n },\n null,\n 2,\n );\n } else {\n throw new Error(\"not implemented\");\n }\n}\n\nfunction listHelper(set: Set<CacheKey>) {\n return Array.from(set).map(DEBUG_ONLY__cacheKeyToString);\n}\n\nfunction multimapHelper(\n multimap: MultiMap<string, ObjectHolder>,\n) {\n return Object.fromEntries(\n Array.from(multimap.associations()).map(\n ([type, objects]) => {\n return [type, objects.map(o => o.$primaryKey)];\n },\n ),\n );\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,SAASA,QAAQ,QAAQ,WAAW;AAGpC,SAASC,4BAA4B,QAAQ,eAAe;AAI5D,OAAO,MAAMC,OAAO,CAAC;EACnBC,eAAe,GAAmC,IAAIH,QAAQ,CAAC,CAA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AAC,EACD,IAAI,EACJ,CACF,CAAC;EACH,CAAC,MAAM;IACL,MAAM,IAAIsB,KAAK,CAAC,iBAAiB,CAAC;EACpC;AACF;AAEA,SAASD,UAAUA,CAAChB,GAAkB,EAAE;EACtC,OAAOkB,KAAK,CAACC,IAAI,CAACnB,GAAG,CAAC,CAACoB,GAAG,CAAC/B,4BAA4B,CAAC;AAC1D;AAEA,SAAS0B,cAAcA,CACrBM,QAAwC,EACxC;EACA,OAAOC,MAAM,CAACC,WAAW,CACvBL,KAAK,CAACC,IAAI,CAACE,QAAQ,CAACG,YAAY,CAAC,CAAC,CAAC,CAACJ,GAAG,CACrC,CAAC,CAACK,IAAI,EAAEC,OAAO,CAAC,KAAK;IACnB,OAAO,CAACD,IAAI,EAAEC,OAAO,CAACN,GAAG,CAACO,CAAC,IAAIA,CAAC,CAACC,WAAW,CAAC,CAAC;EAChD,CACF,CACF,CAAC;AACH","ignoreList":[]}
|
|
@@ -53,11 +53,14 @@ export class Layer {
|
|
|
53
53
|
this.#parent = this.#parent.removeLayer(layerId);
|
|
54
54
|
return this;
|
|
55
55
|
}
|
|
56
|
-
return this.#parent
|
|
56
|
+
return this.#parent.removeLayer(layerId);
|
|
57
57
|
}
|
|
58
58
|
entries() {
|
|
59
59
|
return this.#cache.entries();
|
|
60
60
|
}
|
|
61
|
+
keys() {
|
|
62
|
+
return this.#cache.keys();
|
|
63
|
+
}
|
|
61
64
|
get(cacheKey) {
|
|
62
65
|
return this.#cache.get(cacheKey) ?? this.#parent?.get(cacheKey);
|
|
63
66
|
}
|
|
@@ -66,11 +69,11 @@ export class Layer {
|
|
|
66
69
|
}
|
|
67
70
|
}
|
|
68
71
|
export class Entry {
|
|
69
|
-
constructor(cacheKey, value, lastUpdated) {
|
|
72
|
+
constructor(cacheKey, value, lastUpdated, status = "init") {
|
|
70
73
|
this.cacheKey = cacheKey;
|
|
71
74
|
this.value = value;
|
|
72
75
|
this.lastUpdated = lastUpdated;
|
|
73
|
-
this.status =
|
|
76
|
+
this.status = status;
|
|
74
77
|
}
|
|
75
78
|
}
|
|
76
79
|
//# sourceMappingURL=Layer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Layer.js","names":["WeakMapWithEntries","Layer","parent","cache","layerId","constructor","parentLayer","addLayer","removeLayer","entries","get","cacheKey","set","value","Entry","lastUpdated","status"],"sources":["Layer.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 { CacheKey } from \"./CacheKey.js\";\nimport { WeakMapWithEntries } from \"./WeakMapWithEntries.js\";\n\n/*\n Image some layers\n\n [\n { cache: { obj1: { a: 1 } }, layerId: undefined },\n { cache: { obj1: { a: 1, b: 2 } }, layerId: \"layer1\" },\n { cache: { obj1: { a: undefined, b: 2 } }, layerId: \"layer2\" },\n { cache: { obj1: { a: 1, b: 2 } }, layerId: \"layer3\" },\n ]\n*/\n\nexport class Layer {\n #parent: Layer | undefined;\n #cache = new WeakMapWithEntries<CacheKey<string, any, any>, Entry<any>>();\n #layerId: unknown;\n\n constructor(parent: Layer | undefined, layerId: unknown) {\n this.#parent = parent;\n this.#layerId = layerId;\n }\n\n get parentLayer(): Layer | undefined {\n return this.#parent;\n }\n\n get layerId(): unknown {\n return this.#layerId;\n }\n\n addLayer(layerId: unknown): Layer {\n return new Layer(this, layerId);\n }\n\n removeLayer(layerId: unknown): Layer {\n if (layerId == null || this.#parent == null) {\n // we are the root, so we can't remove anything\n return this;\n }\n if (this.#layerId !== layerId) {\n this.#parent = this.#parent.removeLayer(layerId);\n return this;\n }\n\n return this.#parent
|
|
1
|
+
{"version":3,"file":"Layer.js","names":["WeakMapWithEntries","Layer","parent","cache","layerId","constructor","parentLayer","addLayer","removeLayer","entries","keys","get","cacheKey","set","value","Entry","lastUpdated","status"],"sources":["Layer.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 { CacheKey } from \"./CacheKey.js\";\nimport { WeakMapWithEntries } from \"./WeakMapWithEntries.js\";\n\n/*\n Image some layers\n\n [\n { cache: { obj1: { a: 1 } }, layerId: undefined },\n { cache: { obj1: { a: 1, b: 2 } }, layerId: \"layer1\" },\n { cache: { obj1: { a: undefined, b: 2 } }, layerId: \"layer2\" },\n { cache: { obj1: { a: 1, b: 2 } }, layerId: \"layer3\" },\n ]\n*/\n\nexport class Layer {\n #parent: Layer | undefined;\n #cache = new WeakMapWithEntries<CacheKey<string, any, any>, Entry<any>>();\n #layerId: unknown;\n\n constructor(parent: Layer | undefined, layerId: unknown) {\n this.#parent = parent;\n this.#layerId = layerId;\n }\n\n get parentLayer(): Layer | undefined {\n return this.#parent;\n }\n\n get layerId(): unknown {\n return this.#layerId;\n }\n\n addLayer(layerId: unknown): Layer {\n return new Layer(this, layerId);\n }\n\n removeLayer(layerId: unknown): Layer {\n if (layerId == null || this.#parent == null) {\n // we are the root, so we can't remove anything\n return this;\n }\n\n if (this.#layerId !== layerId) {\n this.#parent = this.#parent.removeLayer(layerId);\n return this;\n }\n\n return this.#parent.removeLayer(layerId);\n }\n\n entries(): IterableIterator<[CacheKey<string, any, any>, Entry<any>]> {\n return this.#cache.entries();\n }\n\n keys(): IterableIterator<CacheKey<string, any, any>> {\n return this.#cache.keys();\n }\n\n public get<K extends CacheKey<string, unknown, any>>(\n cacheKey: K,\n ): Entry<K> | undefined {\n return this.#cache.get(cacheKey) as Entry<K> | undefined\n ?? this.#parent?.get(cacheKey) as Entry<K> | undefined;\n }\n\n public set<K extends CacheKey<string, unknown, any>>(\n cacheKey: K,\n value: Entry<K>,\n ): void {\n this.#cache.set(cacheKey, value);\n }\n}\n\nexport class Entry<K extends CacheKey<any, any, any>> {\n readonly cacheKey: K;\n value: K[\"__cacheKey\"][\"value\"] | undefined;\n lastUpdated: number;\n status: \"init\" | \"loading\" | \"loaded\" | \"error\";\n\n constructor(\n cacheKey: K,\n value: K[\"__cacheKey\"][\"value\"],\n lastUpdated: number,\n status: \"init\" | \"loading\" | \"loaded\" | \"error\" = \"init\",\n ) {\n this.cacheKey = cacheKey;\n this.value = value;\n this.lastUpdated = lastUpdated;\n this.status = status;\n }\n}\n"],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAGA,SAASA,kBAAkB,QAAQ,yBAAyB;;AAE5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA,OAAO,MAAMC,KAAK,CAAC;EACjB,CAACC,MAAM;EACP,CAACC,KAAK,GAAG,IAAIH,kBAAkB,CAAyC,CAAC;EACzE,CAACI,OAAO;EAERC,WAAWA,CAACH,MAAyB,EAAEE,OAAgB,EAAE;IACvD,IAAI,CAAC,CAACF,MAAM,GAAGA,MAAM;IACrB,IAAI,CAAC,CAACE,OAAO,GAAGA,OAAO;EACzB;EAEA,IAAIE,WAAWA,CAAA,EAAsB;IACnC,OAAO,IAAI,CAAC,CAACJ,MAAM;EACrB;EAEA,IAAIE,OAAOA,CAAA,EAAY;IACrB,OAAO,IAAI,CAAC,CAACA,OAAO;EACtB;EAEAG,QAAQA,CAACH,OAAgB,EAAS;I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