@daffodil/core 0.66.1 → 0.67.0
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/constructable/constructable.d.ts +1 -1
- package/{esm2020 → esm2022}/base64/browser/browser.service.mjs +6 -6
- package/{esm2020 → esm2022}/base64/server/server.service.mjs +6 -6
- package/{esm2020 → esm2022}/graphql/apollo/queued-apollo/queued-apollo.service.mjs +5 -5
- package/{esm2020 → esm2022}/routing/uri/normalizer.service.mjs +5 -5
- package/{esm2020 → esm2022}/state/states/state.enum.mjs +1 -1
- package/{esm2020 → esm2022}/state/testing/mock-collection-facade.mjs +4 -4
- package/{esm2020 → esm2022}/state/testing/mock-operation-facade.mjs +4 -4
- package/esm2022/storage/error/error.service.mjs +33 -0
- package/{esm2020 → esm2022}/storage/localstorage/localstorage.service.mjs +6 -6
- package/{esm2020 → esm2022}/storage/noopstorage/noopstorage.service.mjs +4 -4
- package/esm2022/storage/server-error/server-error.service.mjs +36 -0
- package/{esm2020 → esm2022}/testing/angular/mocks/pipes/currency.mjs +4 -4
- package/{esm2020 → esm2022}/testing/factories/address.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/collection/metadata.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/collection/numerically-paginable.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/collection/request.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/collection/sort-option.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/collection/sort-options.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/collection/sortable.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/filter.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/request.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/toggle-request.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/type/equal/option.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/type/equal/request.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/type/equal/toggle-request.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/type/equal.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/type/range-numeric/option.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/type/range-numeric/pair.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/type/range-numeric/request-option.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/type/range-numeric/request.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/type/range-numeric/toggle-request.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/filters/type/range-numeric.mjs +5 -5
- package/{esm2020 → esm2022}/testing/factories/identifiable.factory.mjs +5 -5
- package/{esm2020 → esm2022}/testing/testing.module.mjs +5 -5
- package/esm2022/utils/range.mjs +13 -0
- package/{fesm2020 → fesm2022}/daffodil-core-graphql.mjs +4 -4
- package/{fesm2020 → fesm2022}/daffodil-core-graphql.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-core-routing.mjs +4 -4
- package/{fesm2020 → fesm2022}/daffodil-core-routing.mjs.map +1 -1
- package/{fesm2015 → fesm2022}/daffodil-core-state-testing.mjs +6 -6
- package/{fesm2020 → fesm2022}/daffodil-core-state-testing.mjs.map +1 -1
- package/{fesm2020 → fesm2022}/daffodil-core-testing.mjs +91 -91
- package/fesm2022/daffodil-core-testing.mjs.map +1 -0
- package/{fesm2020 → fesm2022}/daffodil-core.mjs +27 -27
- package/fesm2022/daffodil-core.mjs.map +1 -0
- package/filterable/filter-option.d.ts +1 -1
- package/filterable/filter-request.d.ts +1 -1
- package/filterable/filter-toggle-request.d.ts +1 -1
- package/filterable/filter.d.ts +1 -1
- package/filterable/filters.type.d.ts +1 -1
- package/package.json +1 -1
- package/routing/query-param-filter/request-builder/type.d.ts +1 -1
- package/state/collection/actions.d.ts +1 -1
- package/state/errors/transform-error-to-state-error.d.ts +1 -1
- package/state/operation/entity/state.type.d.ts +1 -1
- package/state/operation/entity/type.d.ts +1 -1
- package/state/operators/substream.pipe.d.ts +3 -3
- package/state/states/loading.d.ts +1 -1
- package/state/states/mutable-loading.d.ts +1 -1
- package/types/id.type.d.ts +1 -1
- package/utils/array-to-dict.d.ts +1 -1
- package/esm2020/storage/error/error.service.mjs +0 -33
- package/esm2020/storage/server-error/server-error.service.mjs +0 -36
- package/esm2020/utils/range.mjs +0 -13
- package/fesm2015/daffodil-core-graphql.mjs +0 -108
- package/fesm2015/daffodil-core-graphql.mjs.map +0 -1
- package/fesm2015/daffodil-core-routing.mjs +0 -122
- package/fesm2015/daffodil-core-routing.mjs.map +0 -1
- package/fesm2015/daffodil-core-state-testing.mjs.map +0 -1
- package/fesm2015/daffodil-core-state.mjs +0 -342
- package/fesm2015/daffodil-core-state.mjs.map +0 -1
- package/fesm2015/daffodil-core-testing.mjs +0 -659
- package/fesm2015/daffodil-core-testing.mjs.map +0 -1
- package/fesm2015/daffodil-core.mjs +0 -1064
- package/fesm2015/daffodil-core.mjs.map +0 -1
- package/fesm2020/daffodil-core-state-testing.mjs +0 -63
- package/fesm2020/daffodil-core-testing.mjs.map +0 -1
- package/fesm2020/daffodil-core.mjs.map +0 -1
- /package/{esm2020 → esm2022}/address/address.mjs +0 -0
- /package/{esm2020 → esm2022}/base64/base64.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/base64/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/base64/server/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/canonically-locateable/canonically-locateable.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/collection/build-metadata.mjs +0 -0
- /package/{esm2020 → esm2022}/collection/build-request.mjs +0 -0
- /package/{esm2020 → esm2022}/collection/collection.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/collection/countable.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/collection/error-map.mjs +0 -0
- /package/{esm2020 → esm2022}/collection/metadata.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/collection/page-out-of-bounds.error.mjs +0 -0
- /package/{esm2020 → esm2022}/collection/paginable.mjs +0 -0
- /package/{esm2020 → esm2022}/collection/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/collection/request.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/collection/sortable.mjs +0 -0
- /package/{esm2020 → esm2022}/constructable/constructable.mjs +0 -0
- /package/{esm2020 → esm2022}/daffodil-core.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/error-map.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/error.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/inheritable-error.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/is-error.mjs +0 -0
- /package/{esm2020 → esm2022}/errors/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/filter-base.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/filter-option-base.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/filter-option.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/filter-request.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/filter-toggle-request.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/filter.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/filterable.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/filters.type.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/equal/filter.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/equal/option.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/equal/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/equal/request.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/equal/toggle-request.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/filter-type.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/range/filter-base.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/range/option.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/range/pair.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/range/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/range/request-base.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/range/request-option.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/range/separator.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/range-numeric/filter.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/range-numeric/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/range-numeric/request.mjs +0 -0
- /package/{esm2020 → esm2022}/filterable/type/range-numeric/toggle-request.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/array-to-dict/array-to-dict.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/apply/apply-filter.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/apply/apply-request-to-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/apply/apply-requests-to-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/apply/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/clear/clear-filter.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/clear/clear-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/clear/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/remove/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/remove/remove-filter.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/remove/remove-request-from-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/remove/remove-requests-from-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/toggle/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/toggle/toggle-request-on-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/behaviors/toggle/toggle.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/compute-applied-filters/compute-applied-filters.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/errors/codes.enum.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/errors/filter-not-found.error.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/errors/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/errors/request-name-mismatch.error.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/errors/request-type-mismatch.error.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/errors/unknown-filter-type.error.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/find-applied/find-applied-options.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/find-applied/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/is-applied/is-filter-applied.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/is-applied/is-toggle-request-applied-to-filter.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/is-applied/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/to-request/filter-to-request.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/to-request/filters-to-requests.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/to-request/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/equal/array-to-dict/option.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/equal/behaviors/apply/apply.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/equal/behaviors/clear/clear.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/equal/behaviors/remove/remove.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/equal/behaviors/toggle/toggle.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/equal/is-applied/is-applied.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/equal/is-applied/is-toggle-request-applied-to-filter.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/equal/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/equal/to-request/filter-to-request.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/range/array-to-dict/pair.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/range/behaviors/apply/apply.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/range/behaviors/clear/clear.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/range/behaviors/remove/remove.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/range/behaviors/toggle/toggle.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/range/compute-pair-label.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/range/is-applied/is-applied.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/range/is-applied/is-toggle-request-applied-to-filter.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/range/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/range/to-request/filter-to-request.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/type/range-numeric/to-request/filter-to-request.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/validators/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/validators/request-name-match.mjs +0 -0
- /package/{esm2020 → esm2022}/filters/validators/request-type-match.mjs +0 -0
- /package/{esm2020 → esm2022}/graphql/apollo/cacheable-operations/cacheable-operations-link.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/graphql/apollo/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/graphql/daffodil-core-graphql.mjs +0 -0
- /package/{esm2020 → esm2022}/graphql/fragments/build-fragment-definition.mjs +0 -0
- /package/{esm2020 → esm2022}/graphql/fragments/build-fragment-name-spread.mjs +0 -0
- /package/{esm2020 → esm2022}/graphql/fragments/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/graphql/index.mjs +0 -0
- /package/{esm2020 → esm2022}/graphql/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/identifiable/array-to-dict.mjs +0 -0
- /package/{esm2020 → esm2022}/identifiable/identifiable.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/identifiable/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/index.mjs +0 -0
- /package/{esm2020 → esm2022}/kindable/kindable.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/kindable/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/locateable/locateable.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/operators/all-of.pipe.mjs +0 -0
- /package/{esm2020 → esm2022}/operators/any-of.pipe.mjs +0 -0
- /package/{esm2020 → esm2022}/operators/backoff.pipe.mjs +0 -0
- /package/{esm2020 → esm2022}/operators/catch-and-arrayify-errors.pipe.mjs +0 -0
- /package/{esm2020 → esm2022}/operators/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/orderable/orderable.mjs +0 -0
- /package/{esm2020 → esm2022}/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/daffodil-core-routing.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/query-param-filter/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/query-param-filter/request-builder/equal.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/query-param-filter/request-builder/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/query-param-filter/request-builder/type.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/query-param-filter/type.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/reducers/clear-errors/navigated-entity-reducer-factory.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/reducers/clear-errors/navigated.reducer.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/reducers/clear-errors/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/reducers/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/uri/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/uri/truncation/file-extension.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/uri/truncation/leading-path-segments.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/uri/truncation/leading-slash.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/uri/truncation/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/routing/uri/truncation/query-fragment.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/failure.type.mjs +0 -0
- /package/{esm2020 → esm2022}/state/actions/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/collection/actions.mjs +0 -0
- /package/{esm2020 → esm2022}/state/collection/adapter.class.mjs +0 -0
- /package/{esm2020 → esm2022}/state/collection/facade.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/state/collection/facade.mjs +0 -0
- /package/{esm2020 → esm2022}/state/collection/initial-state.mjs +0 -0
- /package/{esm2020 → esm2022}/state/collection/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/collection/selector-factory.mjs +0 -0
- /package/{esm2020 → esm2022}/state/daffodil-core-state.mjs +0 -0
- /package/{esm2020 → esm2022}/state/errors/errorable.type.mjs +0 -0
- /package/{esm2020 → esm2022}/state/errors/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/errors/state-error.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/state/errors/transform-error-to-state-error.mjs +0 -0
- /package/{esm2020 → esm2022}/state/index.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operation/adapter.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operation/entity/adapter.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operation/entity/helpers.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operation/entity/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operation/entity/selectors.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operation/entity/state.type.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operation/entity/type.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operation/facade.type.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operation/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operation/selectors.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operation/state.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operators/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/operators/substream.pipe.mjs +0 -0
- /package/{esm2020 → esm2022}/state/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/create-meta.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/identity.mjs +0 -0
- /package/{esm2020 → esm2022}/state/reducers/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/states/loading.mjs +0 -0
- /package/{esm2020 → esm2022}/state/states/mutable-loading.mjs +0 -0
- /package/{esm2020 → esm2022}/state/states/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/state/states/stateable.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/state/store/facade.mjs +0 -0
- /package/{esm2020 → esm2022}/state/testing/daffodil-core-state-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/state/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/state/testing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/storage/error/error.mjs +0 -0
- /package/{esm2020 → esm2022}/storage/error/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/storage/persistence-server-safe.token.mjs +0 -0
- /package/{esm2020 → esm2022}/storage/persistence.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/storage/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/storage/server-error/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/storage/server-error/server-error.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/angular/interfaces/in-memory-data-service.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/daffodil-core-testing.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/factories/collection/mock-collection.class.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/factories/collection/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/factories/factory.interface.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/factories/factory.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/factories/filters/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/factories/filters/type/equal/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/factories/filters/type/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/factories/filters/type/range-numeric/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/factories/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/index.mjs +0 -0
- /package/{esm2020 → esm2022}/testing/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/types/id.type.mjs +0 -0
- /package/{esm2020 → esm2022}/types/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/array-to-dict.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/collect.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/long-arithmetic.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/public_api.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/random-slice.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/random-subset.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/sample.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/shallow-compare.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/shuffle.mjs +0 -0
- /package/{esm2020 → esm2022}/utils/unique.mjs +0 -0
- /package/{fesm2020 → fesm2022}/daffodil-core-state.mjs +0 -0
- /package/{fesm2020 → fesm2022}/daffodil-core-state.mjs.map +0 -0
|
@@ -1,1064 +0,0 @@
|
|
|
1
|
-
import * as i0 from '@angular/core';
|
|
2
|
-
import { Injectable, PLATFORM_ID, Inject, InjectionToken, inject } from '@angular/core';
|
|
3
|
-
import { isPlatformBrowser } from '@angular/common';
|
|
4
|
-
import { pipe, throwError, timer, combineLatest, map, catchError } from 'rxjs';
|
|
5
|
-
import { retryWhen, mergeMap } from 'rxjs/operators';
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Recurses through a tree, collecting each element in that tree and returning it in an array.
|
|
9
|
-
* The value of getKey should be a field that contains a list of the same type of object.
|
|
10
|
-
* Accepts an optional depth argument which will limit the traversal. This should be used for trees with circular references.
|
|
11
|
-
*/
|
|
12
|
-
const collect = (obj, getChildren, depth) => !depth || depth > 0
|
|
13
|
-
? [obj].concat(...getChildren(obj).map((child) => collect(child, getChildren, depth - 1)))
|
|
14
|
-
: [obj];
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* A helper function to compute a power of 10 required to convert a decimal number to an integer
|
|
18
|
-
* This function will fail if the given number has more than 16 significant figures or
|
|
19
|
-
* the value of the number is greater than 10^11
|
|
20
|
-
*
|
|
21
|
-
* @param number
|
|
22
|
-
*/
|
|
23
|
-
function daffPrecision(number) {
|
|
24
|
-
let p = 1;
|
|
25
|
-
if (number === undefined ||
|
|
26
|
-
number === null ||
|
|
27
|
-
Number.isNaN(number) ||
|
|
28
|
-
number === Infinity ||
|
|
29
|
-
number === -Infinity) {
|
|
30
|
-
return p;
|
|
31
|
-
}
|
|
32
|
-
while (Math.round(number * p) / p !== number) {
|
|
33
|
-
p *= 10;
|
|
34
|
-
if (p >= 1e11) {
|
|
35
|
-
break;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return p;
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* A function to add long numbers accurately with conversions and integer math.
|
|
42
|
-
* This function only guarantees correct answers when the numbers given and the result are less than
|
|
43
|
-
* 16 significant figures and less than 10^11
|
|
44
|
-
*
|
|
45
|
-
* @param numbers
|
|
46
|
-
*/
|
|
47
|
-
function daffAdd(...numbers) {
|
|
48
|
-
if (numbers.length === 0) {
|
|
49
|
-
return undefined;
|
|
50
|
-
}
|
|
51
|
-
if (numbers.length === 1) {
|
|
52
|
-
return numbers[0];
|
|
53
|
-
}
|
|
54
|
-
const precision = Math.max(...numbers.map(daffPrecision));
|
|
55
|
-
return numbers.slice(1).reduce((acc, number) => acc + Math.round(number * precision), Math.round(numbers[0] * precision)) / precision;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* A function to subtract long numbers accurately with conversions and integer math.
|
|
59
|
-
* This function only guarantees correct answers when the numbers given and the result are each less than
|
|
60
|
-
* 16 significant figures and less than 10^11
|
|
61
|
-
*
|
|
62
|
-
* @param numbers
|
|
63
|
-
*/
|
|
64
|
-
function daffSubtract(...numbers) {
|
|
65
|
-
if (numbers.length === 0) {
|
|
66
|
-
return undefined;
|
|
67
|
-
}
|
|
68
|
-
if (numbers.length === 1) {
|
|
69
|
-
return numbers[0];
|
|
70
|
-
}
|
|
71
|
-
const precision = Math.max(...numbers.map(daffPrecision));
|
|
72
|
-
return numbers.slice(1).reduce((acc, number) => acc - Math.round(number * precision), Math.round(numbers[0] * precision)) / precision;
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* A function to multiply long numbers accurately with conversions and integer math.
|
|
76
|
-
* This function only guarantees correct answers when the numbers given and the result are each less than 16 significant figures
|
|
77
|
-
* and less than 10^11
|
|
78
|
-
*
|
|
79
|
-
* @param numbers
|
|
80
|
-
*/
|
|
81
|
-
function daffMultiply(...numbers) {
|
|
82
|
-
if (numbers.length === 0) {
|
|
83
|
-
return undefined;
|
|
84
|
-
}
|
|
85
|
-
if (numbers.length === 1) {
|
|
86
|
-
return numbers[0];
|
|
87
|
-
}
|
|
88
|
-
const precision = Math.max(...numbers.map(daffPrecision));
|
|
89
|
-
return numbers.reduce((acc, number) => acc * Math.round(number * precision), 1) / Math.pow(precision, numbers.length);
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* A function to divide long numbers accurately with conversions and integer math.
|
|
93
|
-
* This function only guarantees correct answers when the numbers given and the result are each less than 16 significant figures
|
|
94
|
-
* and less than 10^11
|
|
95
|
-
*
|
|
96
|
-
* Returns NaN when attempting to use NaN as an input.
|
|
97
|
-
* Returns NaN when attempting to divide by 0 or null.
|
|
98
|
-
*
|
|
99
|
-
* @param numbers
|
|
100
|
-
*/
|
|
101
|
-
function daffDivide(...numbers) {
|
|
102
|
-
if (numbers.length === 0) {
|
|
103
|
-
return undefined;
|
|
104
|
-
}
|
|
105
|
-
if (numbers.length === 1) {
|
|
106
|
-
return numbers[0];
|
|
107
|
-
}
|
|
108
|
-
const precision = Math.max(...numbers.map(daffPrecision));
|
|
109
|
-
return numbers.slice(1).reduce((acc, number) => acc / Math.round(number * precision), Math.round(numbers[0] * precision)) * Math.pow(precision, numbers.length - 2);
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Converts an array into a dictionary.
|
|
114
|
-
* Dictionary values are keyed by the return of the specified `getKey`.
|
|
115
|
-
*/
|
|
116
|
-
const daffArrayToDict = (array, getKey) => array.reduce((dict, val) => {
|
|
117
|
-
dict[getKey(val)] = val;
|
|
118
|
-
return dict;
|
|
119
|
-
}, {});
|
|
120
|
-
|
|
121
|
-
/**
|
|
122
|
-
* Returns a random slice of an array.
|
|
123
|
-
* An optional length may be specified.
|
|
124
|
-
*
|
|
125
|
-
* @param array
|
|
126
|
-
*/
|
|
127
|
-
const randomSlice = (array, length) => {
|
|
128
|
-
if (array.length === 0) {
|
|
129
|
-
return [];
|
|
130
|
-
}
|
|
131
|
-
;
|
|
132
|
-
if (length > array.length) {
|
|
133
|
-
throw new Error('Requested length is longer than array length.');
|
|
134
|
-
}
|
|
135
|
-
const arrayLength = length || Math.floor(Math.random() * array.length);
|
|
136
|
-
const start = Math.floor(Math.random() * (array.length - arrayLength + 1));
|
|
137
|
-
const end = start + arrayLength;
|
|
138
|
-
return array.slice(start, end);
|
|
139
|
-
};
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* Immutable Fisher-Yates Shuffle
|
|
143
|
-
* https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle
|
|
144
|
-
*/
|
|
145
|
-
const shuffle = (array) => {
|
|
146
|
-
const result = [];
|
|
147
|
-
array.forEach((el, i) => {
|
|
148
|
-
const s = Math.floor(Math.random() * i);
|
|
149
|
-
if (s !== i) {
|
|
150
|
-
result[i] = result[s];
|
|
151
|
-
}
|
|
152
|
-
result[s] = el;
|
|
153
|
-
});
|
|
154
|
-
return result;
|
|
155
|
-
};
|
|
156
|
-
|
|
157
|
-
/**
|
|
158
|
-
* Returns a random subset of an array in a random order.
|
|
159
|
-
*
|
|
160
|
-
* @param array
|
|
161
|
-
* @param length
|
|
162
|
-
*/
|
|
163
|
-
const randomSubset = (array, length) => {
|
|
164
|
-
if (length > array.length) {
|
|
165
|
-
throw new Error('Requested length is longer than array length.');
|
|
166
|
-
}
|
|
167
|
-
length = length ? length : Math.floor(Math.random() * array.length);
|
|
168
|
-
return shuffle(array).slice(0, length);
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Range
|
|
173
|
-
*
|
|
174
|
-
* Range accepts two inputs, a `start` and an `end`
|
|
175
|
-
* and returns an array filled with numbers from
|
|
176
|
-
* `start` to `end`.
|
|
177
|
-
*
|
|
178
|
-
* @param start
|
|
179
|
-
* @param end
|
|
180
|
-
* @returns number
|
|
181
|
-
*/
|
|
182
|
-
const range = (start, end) => Array.apply(null, Array(end - start + 1)).map((val, index) => index + start);
|
|
183
|
-
|
|
184
|
-
/**
|
|
185
|
-
* Returns a random element of an array.
|
|
186
|
-
*/
|
|
187
|
-
const sample = (array) => randomSlice(array, 1)[0];
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Shallow compares two objects using a list of provided property keys to enumerate the values.
|
|
191
|
-
* `null` and `undefined` are considered equal for the purposes of the comparison.
|
|
192
|
-
* A strict equality comparison is used for truthy property values.
|
|
193
|
-
*/
|
|
194
|
-
function shallowCompare(obj1, obj2, props) {
|
|
195
|
-
return !!(obj1 && obj2 && props.reduce((acc, prop) => {
|
|
196
|
-
const p1 = obj1[prop];
|
|
197
|
-
const p2 = obj2[prop];
|
|
198
|
-
return acc && (
|
|
199
|
-
// undefined and null are treated as equal
|
|
200
|
-
(p1 === undefined || p1 === null) && (p2 === undefined || p2 === null)
|
|
201
|
-
|| p1 === p2);
|
|
202
|
-
}, true));
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
/**
|
|
206
|
-
* Filters an array of elements, removing duplicates.
|
|
207
|
-
* Does not guarantee order of filtered elements.
|
|
208
|
-
*
|
|
209
|
-
* An optional comparator function may be passed for arbitrary comparison behavior.
|
|
210
|
-
* The default is a strict equality comparison: `a === b`.
|
|
211
|
-
*/
|
|
212
|
-
const unique = (array, comparator = (a, b) => a === b) => array.filter((a, index) => array.slice(index + 1).filter(b => comparator(a, b)).length === 0);
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* A class which allows you to appropriately check the inheritance of an error.
|
|
216
|
-
*
|
|
217
|
-
* In typescript, when you try to extend an error with a specialized error class,
|
|
218
|
-
* if you try to call something like:
|
|
219
|
-
*
|
|
220
|
-
* ```ts
|
|
221
|
-
* class MyError extends Error {}
|
|
222
|
-
*
|
|
223
|
-
* let myError = new MyError();
|
|
224
|
-
*
|
|
225
|
-
* myError instanceof MyError; // returns false
|
|
226
|
-
* ```
|
|
227
|
-
*
|
|
228
|
-
* You will see unexpected things. This class fixes that issue as described here
|
|
229
|
-
* https://github.com/microsoft/TypeScript/issues/13965
|
|
230
|
-
*/
|
|
231
|
-
class DaffInheritableError extends Error {
|
|
232
|
-
constructor(message) {
|
|
233
|
-
super(message);
|
|
234
|
-
this.recoverable = false;
|
|
235
|
-
const trueProto = new.target.prototype;
|
|
236
|
-
Object.setPrototypeOf(this, trueProto);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Checks if the passed object is a {@link DaffError}
|
|
242
|
-
*/
|
|
243
|
-
const daffIsError = (error) => error instanceof DaffInheritableError || !!error.code;
|
|
244
|
-
|
|
245
|
-
const DAFF_STORAGE_SERVICE_ERROR_CODE = 'DAFF_STORAGE_FAILURE';
|
|
246
|
-
class DaffStorageServiceError extends DaffInheritableError {
|
|
247
|
-
constructor(message) {
|
|
248
|
-
super(message);
|
|
249
|
-
this.message = message;
|
|
250
|
-
this.code = DAFF_STORAGE_SERVICE_ERROR_CODE;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
/**
|
|
255
|
-
* @inheritdoc
|
|
256
|
-
*/
|
|
257
|
-
class DaffErrorStorageService {
|
|
258
|
-
setItem(key, value) {
|
|
259
|
-
this.throwError();
|
|
260
|
-
}
|
|
261
|
-
getItem(key) {
|
|
262
|
-
this.throwError();
|
|
263
|
-
}
|
|
264
|
-
removeItem(key) {
|
|
265
|
-
this.throwError();
|
|
266
|
-
}
|
|
267
|
-
clear() {
|
|
268
|
-
this.throwError();
|
|
269
|
-
}
|
|
270
|
-
throwError() {
|
|
271
|
-
throw new DaffStorageServiceError(DaffErrorStorageService.ERROR_MESSAGE);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
DaffErrorStorageService.ERROR_MESSAGE = 'The DaffErrorStorageService always throws an error.';
|
|
275
|
-
/** @nocollapse */ DaffErrorStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffErrorStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
276
|
-
/** @nocollapse */ DaffErrorStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffErrorStorageService, providedIn: 'root' });
|
|
277
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffErrorStorageService, decorators: [{
|
|
278
|
-
type: Injectable,
|
|
279
|
-
args: [{
|
|
280
|
-
providedIn: 'root',
|
|
281
|
-
}]
|
|
282
|
-
}] });
|
|
283
|
-
|
|
284
|
-
const DAFF_SERVER_STORAGE_SERVICE_ERROR_CODE = 'DAFF_SERVER_STORAGE_FAILURE';
|
|
285
|
-
/**
|
|
286
|
-
* An error thrown when there is an attempt to access storage on the server and none is available.
|
|
287
|
-
*/
|
|
288
|
-
class DaffServerSideStorageError extends DaffStorageServiceError {
|
|
289
|
-
constructor(message) {
|
|
290
|
-
super(message);
|
|
291
|
-
this.message = message;
|
|
292
|
-
this.code = DAFF_SERVER_STORAGE_SERVICE_ERROR_CODE;
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
|
|
296
|
-
/**
|
|
297
|
-
* A storage service meant to be loaded into SSR contexts.
|
|
298
|
-
* It will always throw the {@link DaffServerSideStorageError}.
|
|
299
|
-
*
|
|
300
|
-
* @inheritdoc
|
|
301
|
-
*/
|
|
302
|
-
class DaffServerErrorStorageService {
|
|
303
|
-
setItem(key, value) {
|
|
304
|
-
this.throwError();
|
|
305
|
-
}
|
|
306
|
-
getItem(key) {
|
|
307
|
-
this.throwError();
|
|
308
|
-
}
|
|
309
|
-
removeItem(key) {
|
|
310
|
-
this.throwError();
|
|
311
|
-
}
|
|
312
|
-
clear() {
|
|
313
|
-
this.throwError();
|
|
314
|
-
}
|
|
315
|
-
throwError() {
|
|
316
|
-
throw new DaffServerSideStorageError(DaffServerErrorStorageService.ERROR_MESSAGE);
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
DaffServerErrorStorageService.ERROR_MESSAGE = 'The DaffServerErrorStorageService always throws an error.';
|
|
320
|
-
/** @nocollapse */ DaffServerErrorStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffServerErrorStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
321
|
-
/** @nocollapse */ DaffServerErrorStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffServerErrorStorageService, providedIn: 'root' });
|
|
322
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffServerErrorStorageService, decorators: [{
|
|
323
|
-
type: Injectable,
|
|
324
|
-
args: [{
|
|
325
|
-
providedIn: 'root',
|
|
326
|
-
}]
|
|
327
|
-
}] });
|
|
328
|
-
|
|
329
|
-
/**
|
|
330
|
-
* @inheritdoc
|
|
331
|
-
*/
|
|
332
|
-
class DaffLocalStorageService {
|
|
333
|
-
constructor(platformId) {
|
|
334
|
-
if (!isPlatformBrowser(platformId)) {
|
|
335
|
-
throw new Error('The DaffLocalStorageService can only be instantiated in the browser.');
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
/**
|
|
339
|
-
* Persist the given item into local storage.
|
|
340
|
-
*/
|
|
341
|
-
setItem(key, value) {
|
|
342
|
-
localStorage.setItem(key, value);
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* Retrieve the given item from localstorage.
|
|
346
|
-
*/
|
|
347
|
-
getItem(key) {
|
|
348
|
-
return localStorage.getItem(key);
|
|
349
|
-
}
|
|
350
|
-
/**
|
|
351
|
-
* Remove a given item from localstorage
|
|
352
|
-
*/
|
|
353
|
-
removeItem(key) {
|
|
354
|
-
localStorage.removeItem(key);
|
|
355
|
-
}
|
|
356
|
-
clear() {
|
|
357
|
-
localStorage.clear();
|
|
358
|
-
}
|
|
359
|
-
}
|
|
360
|
-
/** @nocollapse */ DaffLocalStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffLocalStorageService, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
361
|
-
/** @nocollapse */ DaffLocalStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffLocalStorageService, providedIn: 'root' });
|
|
362
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffLocalStorageService, decorators: [{
|
|
363
|
-
type: Injectable,
|
|
364
|
-
args: [{
|
|
365
|
-
providedIn: 'root',
|
|
366
|
-
}]
|
|
367
|
-
}], ctorParameters: function () {
|
|
368
|
-
return [{ type: undefined, decorators: [{
|
|
369
|
-
type: Inject,
|
|
370
|
-
args: [PLATFORM_ID]
|
|
371
|
-
}] }];
|
|
372
|
-
} });
|
|
373
|
-
|
|
374
|
-
/**
|
|
375
|
-
* @inheritdoc
|
|
376
|
-
*/
|
|
377
|
-
class DaffNoopStorageService {
|
|
378
|
-
setItem(key, value) { }
|
|
379
|
-
;
|
|
380
|
-
getItem(key) { }
|
|
381
|
-
;
|
|
382
|
-
clear() { }
|
|
383
|
-
;
|
|
384
|
-
removeItem(key) { }
|
|
385
|
-
;
|
|
386
|
-
}
|
|
387
|
-
/** @nocollapse */ DaffNoopStorageService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffNoopStorageService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
388
|
-
/** @nocollapse */ DaffNoopStorageService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffNoopStorageService, providedIn: 'root' });
|
|
389
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffNoopStorageService, decorators: [{
|
|
390
|
-
type: Injectable,
|
|
391
|
-
args: [{
|
|
392
|
-
providedIn: 'root',
|
|
393
|
-
}]
|
|
394
|
-
}] });
|
|
395
|
-
|
|
396
|
-
const DaffPersistenceServiceToken = new InjectionToken('DaffPersistenceService', {
|
|
397
|
-
providedIn: 'root',
|
|
398
|
-
factory: () => isPlatformBrowser(inject(PLATFORM_ID))
|
|
399
|
-
? new DaffLocalStorageService(inject(PLATFORM_ID))
|
|
400
|
-
: new DaffServerErrorStorageService(),
|
|
401
|
-
});
|
|
402
|
-
|
|
403
|
-
/**
|
|
404
|
-
* Provides noop for the persistence service on the server.
|
|
405
|
-
*/
|
|
406
|
-
const DaffServerSafePersistenceServiceToken = new InjectionToken('DaffServerSafePersistenceService', {
|
|
407
|
-
providedIn: 'root',
|
|
408
|
-
factory: () => isPlatformBrowser(inject(PLATFORM_ID))
|
|
409
|
-
? inject(DaffPersistenceServiceToken)
|
|
410
|
-
: inject(DaffNoopStorageService),
|
|
411
|
-
});
|
|
412
|
-
|
|
413
|
-
/**
|
|
414
|
-
* Retries failed Observables
|
|
415
|
-
*
|
|
416
|
-
* @param maxTries The maximum number of tries the observable will be tried
|
|
417
|
-
* @param ms The initial amount of time
|
|
418
|
-
*/
|
|
419
|
-
function backoff(maxTries, ms) {
|
|
420
|
-
return pipe(retryWhen(attempt => attempt.pipe(mergeMap((shadowedAttempt, i) => {
|
|
421
|
-
if (i >= maxTries) {
|
|
422
|
-
return throwError(shadowedAttempt);
|
|
423
|
-
}
|
|
424
|
-
return timer(ms * Math.pow(2, i));
|
|
425
|
-
}))));
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
/**
|
|
429
|
-
* Accepts a list of input observables and emits true when any of the inputs emit a truthy value.
|
|
430
|
-
* Does not emit until all of the input streams have emitted at least once.
|
|
431
|
-
*/
|
|
432
|
-
const anyOf = (items) => combineLatest(items).pipe(map((els) => els.reduce((agg, el) => agg || el, false)));
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Accepts a list of input observables and emits true when all of the inputs emit a truthy value.
|
|
436
|
-
* Does not emit until all of the input streams have emitted at least once.
|
|
437
|
-
*/
|
|
438
|
-
const allOf = (items) => combineLatest(items).pipe(map((els) => els.reduce((agg, el) => agg && el, true)));
|
|
439
|
-
|
|
440
|
-
/**
|
|
441
|
-
* Catches errors and invokes the callback with an array of errors.
|
|
442
|
-
*/
|
|
443
|
-
const catchAndArrayifyErrors = (transformError) => pipe(catchError((err) => transformError(Array.isArray(err) ? err : [err])));
|
|
444
|
-
|
|
445
|
-
/**
|
|
446
|
-
* A base64 service meant to be loaded into SSR contexts.
|
|
447
|
-
*
|
|
448
|
-
* @inheritdoc
|
|
449
|
-
*/
|
|
450
|
-
class DaffServerBase64Service {
|
|
451
|
-
constructor(platformId) {
|
|
452
|
-
if (isPlatformBrowser(platformId)) {
|
|
453
|
-
throw new Error('The DaffBrowserBase64Service can only be instantiated on the server.');
|
|
454
|
-
}
|
|
455
|
-
}
|
|
456
|
-
encode(str) {
|
|
457
|
-
return Buffer.from(str).toString('base64');
|
|
458
|
-
}
|
|
459
|
-
decode(str) {
|
|
460
|
-
return Buffer.from(str, 'base64').toString('ascii');
|
|
461
|
-
}
|
|
462
|
-
}
|
|
463
|
-
/** @nocollapse */ DaffServerBase64Service.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffServerBase64Service, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
464
|
-
/** @nocollapse */ DaffServerBase64Service.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffServerBase64Service, providedIn: 'root' });
|
|
465
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffServerBase64Service, decorators: [{
|
|
466
|
-
type: Injectable,
|
|
467
|
-
args: [{
|
|
468
|
-
providedIn: 'root',
|
|
469
|
-
}]
|
|
470
|
-
}], ctorParameters: function () {
|
|
471
|
-
return [{ type: undefined, decorators: [{
|
|
472
|
-
type: Inject,
|
|
473
|
-
args: [PLATFORM_ID]
|
|
474
|
-
}] }];
|
|
475
|
-
} });
|
|
476
|
-
|
|
477
|
-
/**
|
|
478
|
-
* @inheritdoc
|
|
479
|
-
*/
|
|
480
|
-
class DaffBrowserBase64Service {
|
|
481
|
-
constructor(platformId) {
|
|
482
|
-
if (!isPlatformBrowser(platformId)) {
|
|
483
|
-
throw new Error('The DaffBrowserBase64Service can only be instantiated in the browser.');
|
|
484
|
-
}
|
|
485
|
-
}
|
|
486
|
-
encode(str) {
|
|
487
|
-
return btoa(str);
|
|
488
|
-
}
|
|
489
|
-
decode(str) {
|
|
490
|
-
return atob(str);
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
/** @nocollapse */ DaffBrowserBase64Service.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffBrowserBase64Service, deps: [{ token: PLATFORM_ID }], target: i0.ɵɵFactoryTarget.Injectable });
|
|
494
|
-
/** @nocollapse */ DaffBrowserBase64Service.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffBrowserBase64Service, providedIn: 'root' });
|
|
495
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: DaffBrowserBase64Service, decorators: [{
|
|
496
|
-
type: Injectable,
|
|
497
|
-
args: [{
|
|
498
|
-
providedIn: 'root',
|
|
499
|
-
}]
|
|
500
|
-
}], ctorParameters: function () {
|
|
501
|
-
return [{ type: undefined, decorators: [{
|
|
502
|
-
type: Inject,
|
|
503
|
-
args: [PLATFORM_ID]
|
|
504
|
-
}] }];
|
|
505
|
-
} });
|
|
506
|
-
|
|
507
|
-
/**
|
|
508
|
-
* A token which creates a base64 service appropriate for the current environment, i.e., browser vs. server.
|
|
509
|
-
*/
|
|
510
|
-
const DaffBase64ServiceToken = new InjectionToken('DaffBase64Service', {
|
|
511
|
-
providedIn: 'root',
|
|
512
|
-
factory: () => isPlatformBrowser(inject(PLATFORM_ID))
|
|
513
|
-
? new DaffBrowserBase64Service(inject(PLATFORM_ID))
|
|
514
|
-
: new DaffServerBase64Service(inject(PLATFORM_ID)),
|
|
515
|
-
});
|
|
516
|
-
|
|
517
|
-
/**
|
|
518
|
-
* The direction in which to sort a list of elements, e.g. if the list was
|
|
519
|
-
* sorted alphabetically, "Ascending" would be from "A-Z",
|
|
520
|
-
* and "Descending" would be from "Z-A".
|
|
521
|
-
*/
|
|
522
|
-
var DaffSortDirectionEnum;
|
|
523
|
-
(function (DaffSortDirectionEnum) {
|
|
524
|
-
DaffSortDirectionEnum["Ascending"] = "ASC";
|
|
525
|
-
DaffSortDirectionEnum["Descending"] = "DSC";
|
|
526
|
-
})(DaffSortDirectionEnum || (DaffSortDirectionEnum = {}));
|
|
527
|
-
|
|
528
|
-
const DAFF_COLLECTION_PAGE_OUT_OF_BOUNDS_ERROR_CODE = 'DAFF_COLLECTION_PAGE_OUT_OF_BOUNDS';
|
|
529
|
-
/**
|
|
530
|
-
* An error thrown when the requested page is greater than the number of available pages.
|
|
531
|
-
*/
|
|
532
|
-
class DaffCollectionPageOutOfBoundsError extends DaffInheritableError {
|
|
533
|
-
constructor(message) {
|
|
534
|
-
super(message);
|
|
535
|
-
this.code = DAFF_COLLECTION_PAGE_OUT_OF_BOUNDS_ERROR_CODE;
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
|
|
539
|
-
const daffCollectionErrorMap = {
|
|
540
|
-
[DAFF_COLLECTION_PAGE_OUT_OF_BOUNDS_ERROR_CODE]: DaffCollectionPageOutOfBoundsError,
|
|
541
|
-
};
|
|
542
|
-
|
|
543
|
-
const allowedMetadataKeys = [
|
|
544
|
-
'appliedSortOption',
|
|
545
|
-
'appliedSortDirection',
|
|
546
|
-
'currentPage',
|
|
547
|
-
'pageSize',
|
|
548
|
-
];
|
|
549
|
-
/**
|
|
550
|
-
* Extracts the part of the {@link DaffCollectionRequest} that can be directly set in {@link DaffCollectionMetadata}.
|
|
551
|
-
*/
|
|
552
|
-
const daffCollectionBuildMetadataFromRequest = (request) => allowedMetadataKeys.reduce((acc, key) => {
|
|
553
|
-
if (request[key]) {
|
|
554
|
-
acc[key] = request[key];
|
|
555
|
-
}
|
|
556
|
-
return acc;
|
|
557
|
-
}, {});
|
|
558
|
-
|
|
559
|
-
/**
|
|
560
|
-
* The known types of filters.
|
|
561
|
-
*/
|
|
562
|
-
var DaffFilterType;
|
|
563
|
-
(function (DaffFilterType) {
|
|
564
|
-
DaffFilterType["Equal"] = "equal";
|
|
565
|
-
DaffFilterType["RangeNumeric"] = "rangeNumeric";
|
|
566
|
-
})(DaffFilterType || (DaffFilterType = {}));
|
|
567
|
-
|
|
568
|
-
/**
|
|
569
|
-
* The separator between a range type filter's values
|
|
570
|
-
* e.g. "price": "30-40".
|
|
571
|
-
*/
|
|
572
|
-
const DaffFilterFromToFilterSeparator = '-';
|
|
573
|
-
|
|
574
|
-
/**
|
|
575
|
-
* The error codes applicable to the filter behaviors of `@daffodil/core`.
|
|
576
|
-
*/
|
|
577
|
-
var DaffFilterErrorCodes;
|
|
578
|
-
(function (DaffFilterErrorCodes) {
|
|
579
|
-
DaffFilterErrorCodes["FILTER_REQUEST_TYPE_MISMATCH"] = "DAFF_FILTER_REQUEST_TYPE_MISMATCH";
|
|
580
|
-
DaffFilterErrorCodes["FILTER_REQUEST_NAME_MISMATCH"] = "DAFF_FILTER_REQUEST_NAME_MISMATCH";
|
|
581
|
-
DaffFilterErrorCodes["FILTER_NOT_FOUND"] = "DAFF_FILTER_NOT_FOUND";
|
|
582
|
-
DaffFilterErrorCodes["UNKNOWN_FILTER_TYPE"] = "DAFF_FILTER_UNKNOWN_TYPE";
|
|
583
|
-
})(DaffFilterErrorCodes || (DaffFilterErrorCodes = {}));
|
|
584
|
-
|
|
585
|
-
/**
|
|
586
|
-
* An error thrown when an operation targeting a filter matches a type unknown
|
|
587
|
-
* to Daffodil.
|
|
588
|
-
*/
|
|
589
|
-
class DaffFilterUnknownType extends DaffInheritableError {
|
|
590
|
-
constructor(message) {
|
|
591
|
-
super(message);
|
|
592
|
-
this.code = DaffFilterErrorCodes.UNKNOWN_FILTER_TYPE;
|
|
593
|
-
}
|
|
594
|
-
}
|
|
595
|
-
|
|
596
|
-
/**
|
|
597
|
-
* Applies a {@link DaffFilterEqualRequest} to a {@link DaffFilterEqual}
|
|
598
|
-
*
|
|
599
|
-
* @idempotent {filter}
|
|
600
|
-
* @docs-private
|
|
601
|
-
*/
|
|
602
|
-
const daffApplyFilterEqual = (request, filter) => (Object.assign(Object.assign({}, filter), { options: request.value.reduce((acc, value) => {
|
|
603
|
-
const option = filter.options[value];
|
|
604
|
-
if (option) {
|
|
605
|
-
acc[value] = Object.assign(Object.assign({}, option), { applied: true });
|
|
606
|
-
}
|
|
607
|
-
return acc;
|
|
608
|
-
}, Object.assign({}, filter.options)) }));
|
|
609
|
-
|
|
610
|
-
const daffFilterComputeRangePairLabel = (min, max) => `${min}${DaffFilterFromToFilterSeparator}${max}`;
|
|
611
|
-
|
|
612
|
-
/**
|
|
613
|
-
* Applies a {@link DaffFilterRangeRequestBase} to a {@link DaffFilterRangeBase}
|
|
614
|
-
*
|
|
615
|
-
* @idempotent {filter}
|
|
616
|
-
* @docs-private
|
|
617
|
-
*/
|
|
618
|
-
const daffApplyFilterRange = (request, filter) => (Object.assign(Object.assign({}, filter), { options: {
|
|
619
|
-
[daffFilterComputeRangePairLabel(request.value.min, request.value.max)]: {
|
|
620
|
-
min: {
|
|
621
|
-
value: request.value.min,
|
|
622
|
-
label: String(request.value.min),
|
|
623
|
-
},
|
|
624
|
-
max: {
|
|
625
|
-
value: request.value.max,
|
|
626
|
-
label: String(request.value.max),
|
|
627
|
-
},
|
|
628
|
-
applied: true,
|
|
629
|
-
},
|
|
630
|
-
} }));
|
|
631
|
-
|
|
632
|
-
/**
|
|
633
|
-
* An error thrown when a lookup for a filter.
|
|
634
|
-
*/
|
|
635
|
-
class DaffFilterNotFound extends DaffInheritableError {
|
|
636
|
-
constructor(message) {
|
|
637
|
-
super(message);
|
|
638
|
-
this.code = DaffFilterErrorCodes.FILTER_NOT_FOUND;
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
|
|
642
|
-
/**
|
|
643
|
-
* An error thrown when an operation targeting a filter matching one name
|
|
644
|
-
* matches a filter of another name.
|
|
645
|
-
*/
|
|
646
|
-
class DaffFilterRequestNameMismatch extends DaffInheritableError {
|
|
647
|
-
constructor(message) {
|
|
648
|
-
super(message);
|
|
649
|
-
this.code = DaffFilterErrorCodes.FILTER_REQUEST_NAME_MISMATCH;
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
/**
|
|
654
|
-
* Ensures that the names of the filter and the filter request match.
|
|
655
|
-
*
|
|
656
|
-
* @throws {@link DaffFilterNotFound} if the names do not match.
|
|
657
|
-
*/
|
|
658
|
-
const daffFilterValidateRequestNameMatch = (request, filter) => {
|
|
659
|
-
if (!filter) {
|
|
660
|
-
throw new DaffFilterNotFound('Filter does not exist');
|
|
661
|
-
}
|
|
662
|
-
if (request.name !== filter.name) {
|
|
663
|
-
throw new DaffFilterRequestNameMismatch('Filter name does not match request name');
|
|
664
|
-
}
|
|
665
|
-
};
|
|
666
|
-
|
|
667
|
-
/**
|
|
668
|
-
* An error thrown when an operation targeting a filter matching one type
|
|
669
|
-
* matches a filter of another type.
|
|
670
|
-
*/
|
|
671
|
-
class DaffFilterRequestTypeMismatch extends DaffInheritableError {
|
|
672
|
-
constructor(message) {
|
|
673
|
-
super(message);
|
|
674
|
-
this.code = DaffFilterErrorCodes.FILTER_REQUEST_TYPE_MISMATCH;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
/**
|
|
679
|
-
* Ensures that the types of the filter and the filter request match.
|
|
680
|
-
*
|
|
681
|
-
* @throws {@link DaffFilterRequestTypeMismatch} if the types do not match.
|
|
682
|
-
*/
|
|
683
|
-
const daffFilterValidateRequestTypeMatch = (request, filter) => {
|
|
684
|
-
if (request.type !== filter.type) {
|
|
685
|
-
throw new DaffFilterRequestTypeMismatch('Filter types don\'t match');
|
|
686
|
-
}
|
|
687
|
-
};
|
|
688
|
-
|
|
689
|
-
/**
|
|
690
|
-
* Applies a filter request to the matching filter.
|
|
691
|
-
*
|
|
692
|
-
* @idempotent {filter}
|
|
693
|
-
* @throws {@link DaffFilterUnknownType}
|
|
694
|
-
*/
|
|
695
|
-
const daffApplyFilter = (request, filter) => {
|
|
696
|
-
daffFilterValidateRequestNameMatch(request, filter);
|
|
697
|
-
daffFilterValidateRequestTypeMatch(request, filter);
|
|
698
|
-
switch (request.type) {
|
|
699
|
-
case DaffFilterType.Equal:
|
|
700
|
-
return daffApplyFilterEqual(request, filter);
|
|
701
|
-
case (DaffFilterType.RangeNumeric):
|
|
702
|
-
return daffApplyFilterRange(request, filter);
|
|
703
|
-
default:
|
|
704
|
-
throw new DaffFilterUnknownType('Unknown filter type');
|
|
705
|
-
}
|
|
706
|
-
};
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
* Applies a {@link DaffFilterRequest} to a dictionary of {@link DaffFilter}
|
|
710
|
-
* returning the updated dictionary.
|
|
711
|
-
*
|
|
712
|
-
* @idempotent {filters}
|
|
713
|
-
*/
|
|
714
|
-
const daffApplyRequestToFilters = (request, filters) => (Object.assign(Object.assign({}, filters), { [request.name]: daffApplyFilter(request, filters[request.name]) }));
|
|
715
|
-
|
|
716
|
-
/**
|
|
717
|
-
* Applies filters from a {@link DaffFilterRequest} to a dictionary
|
|
718
|
-
* of {@link DaffFilter}.
|
|
719
|
-
*
|
|
720
|
-
* @idempotent {filters}
|
|
721
|
-
*/
|
|
722
|
-
const daffApplyRequestsToFilters = (filtersRequests, filters) => filtersRequests.reduce((acc, request) => {
|
|
723
|
-
acc[request.name] = daffApplyFilter(request, filters[request.name]);
|
|
724
|
-
return acc;
|
|
725
|
-
}, Object.assign({}, filters));
|
|
726
|
-
|
|
727
|
-
/**
|
|
728
|
-
* Unapplies the applied filter options of a {@link DaffFilterEqual}
|
|
729
|
-
*
|
|
730
|
-
* @idempotent {filter}
|
|
731
|
-
* @docs-private
|
|
732
|
-
*/
|
|
733
|
-
const daffClearFilterEqual = (filter) => (Object.assign(Object.assign({}, filter), { options: Object.keys(filter.options).map((key) => filter.options[key]).reduce((acc, option) => {
|
|
734
|
-
acc[option.value] = Object.assign(Object.assign({}, option), { applied: false });
|
|
735
|
-
return acc;
|
|
736
|
-
}, Object.assign({}, filter.options)) }));
|
|
737
|
-
|
|
738
|
-
/**
|
|
739
|
-
* Unapplies the applied filter options of a {@link DaffFilterRangeBase}
|
|
740
|
-
*
|
|
741
|
-
* @idempotent {filter}
|
|
742
|
-
* @docs-private
|
|
743
|
-
*/
|
|
744
|
-
const daffClearFilterRange = (filter) => (Object.assign(Object.assign({}, filter), { options: {} }));
|
|
745
|
-
|
|
746
|
-
/**
|
|
747
|
-
* Undoes the applied state of all applied filter options of a {@link DaffFilter}
|
|
748
|
-
* returning the filter.
|
|
749
|
-
*
|
|
750
|
-
* @idempotent {filter}
|
|
751
|
-
*/
|
|
752
|
-
const daffClearFilter = (filter) => {
|
|
753
|
-
switch (filter.type) {
|
|
754
|
-
case DaffFilterType.RangeNumeric:
|
|
755
|
-
return daffClearFilterRange(filter);
|
|
756
|
-
case DaffFilterType.Equal:
|
|
757
|
-
return daffClearFilterEqual(filter);
|
|
758
|
-
default:
|
|
759
|
-
throw new DaffFilterUnknownType('Unknown filter type');
|
|
760
|
-
}
|
|
761
|
-
};
|
|
762
|
-
|
|
763
|
-
/**
|
|
764
|
-
* Undoes the applied state of all applied filter options of a dictionary of {@link DaffFilter}
|
|
765
|
-
* returning updated dictionary.
|
|
766
|
-
*
|
|
767
|
-
* @idempotent {filters}
|
|
768
|
-
*/
|
|
769
|
-
const daffClearFilters = (filters) => Object.keys(filters).map((key) => filters[key]).reduce((acc, filter) => {
|
|
770
|
-
acc[filter.name] = daffClearFilter(filter);
|
|
771
|
-
return acc;
|
|
772
|
-
}, {});
|
|
773
|
-
|
|
774
|
-
/**
|
|
775
|
-
* Removes the matching filter options of a {@link DaffFilterEqual}
|
|
776
|
-
* that match the {@link DaffFilterEqualRequest}
|
|
777
|
-
*
|
|
778
|
-
* If there are no matching options, returns the original {@link DaffFilterEqual}
|
|
779
|
-
*
|
|
780
|
-
* @idempotent {filter}
|
|
781
|
-
* @docs-private
|
|
782
|
-
*/
|
|
783
|
-
const daffRemoveFilterEqual = (request, filter) => (Object.assign(Object.assign({}, filter), { options: request.value.reduce((acc, value) => {
|
|
784
|
-
const option = filter.options[value];
|
|
785
|
-
if (option) {
|
|
786
|
-
acc[value] = Object.assign(Object.assign({}, option), { applied: false });
|
|
787
|
-
}
|
|
788
|
-
return acc;
|
|
789
|
-
}, Object.assign({}, filter.options)) }));
|
|
790
|
-
|
|
791
|
-
/**
|
|
792
|
-
* Removes the matching filter options of a {@link DaffFilterRangeBase}
|
|
793
|
-
* that match the {@link DaffFilterRangeRequestBase}
|
|
794
|
-
*
|
|
795
|
-
* If there are no matching options, returns the original {@link DaffFilterRangeBase}
|
|
796
|
-
*
|
|
797
|
-
* @idempotent {filter}
|
|
798
|
-
* @docs-private
|
|
799
|
-
*/
|
|
800
|
-
const daffRemoveFilterRange = (request, filter) => filter.options[daffFilterComputeRangePairLabel(request.value.min, request.value.max)]
|
|
801
|
-
? (Object.assign(Object.assign({}, filter), { options: {} }))
|
|
802
|
-
: filter;
|
|
803
|
-
|
|
804
|
-
/**
|
|
805
|
-
* Undoes any applied options of a {@link DaffFilter} that match the
|
|
806
|
-
* {@link DaffFilterRequest}, returning the {@link DaffFilter}.
|
|
807
|
-
*
|
|
808
|
-
* @idempotent {filter}
|
|
809
|
-
* @pure
|
|
810
|
-
*/
|
|
811
|
-
const daffRemoveFilter = (request, filter) => {
|
|
812
|
-
daffFilterValidateRequestNameMatch(request, filter);
|
|
813
|
-
daffFilterValidateRequestTypeMatch(request, filter);
|
|
814
|
-
switch (request.type) {
|
|
815
|
-
case DaffFilterType.Equal:
|
|
816
|
-
return daffRemoveFilterEqual(request, filter);
|
|
817
|
-
case (DaffFilterType.RangeNumeric):
|
|
818
|
-
return daffRemoveFilterRange(request, filter);
|
|
819
|
-
default:
|
|
820
|
-
throw new DaffFilterUnknownType('Unknown filter type');
|
|
821
|
-
}
|
|
822
|
-
};
|
|
823
|
-
|
|
824
|
-
/**
|
|
825
|
-
* Undoes any applied options of a particular filter of a dictionary of {@link DaffFilter}
|
|
826
|
-
* that match the {@link DaffFilterRequest}, returning the dictionary of {@link DaffFilter}.
|
|
827
|
-
*
|
|
828
|
-
* @idempotent {filters}
|
|
829
|
-
*/
|
|
830
|
-
const daffRemoveRequestFromFilters = (request, filters) => (Object.assign(Object.assign({}, filters), { [request.name]: daffRemoveFilter(request, filters[request.name]) }));
|
|
831
|
-
|
|
832
|
-
/**
|
|
833
|
-
* Undoes all applied options of a dictionary of {@link DaffFilter}
|
|
834
|
-
* that match any of the {@link DaffFilterRequest},
|
|
835
|
-
* returning the updated dictionary of {@link DaffFilter}.
|
|
836
|
-
*
|
|
837
|
-
* @idempotent {filters}
|
|
838
|
-
*/
|
|
839
|
-
const daffRemoveRequestsFromFilters = (requests, filters) => requests.reduce((acc, request) => {
|
|
840
|
-
acc[request.name] = daffRemoveFilter(request, filters[request.name]);
|
|
841
|
-
return acc;
|
|
842
|
-
}, Object.assign({}, filters));
|
|
843
|
-
|
|
844
|
-
/**
|
|
845
|
-
* Oscillates the applied state of the matching filter options of a {@link DaffFilterEqual}
|
|
846
|
-
* that match the {@link DaffFilterEqualRequest}
|
|
847
|
-
*
|
|
848
|
-
* If there are no matching options, returns the original {@link DaffFilterEqual}
|
|
849
|
-
*
|
|
850
|
-
* @docs-private
|
|
851
|
-
*/
|
|
852
|
-
const daffToggleFilterEqual = (request, filter) => {
|
|
853
|
-
const option = filter.options[request.value];
|
|
854
|
-
return option
|
|
855
|
-
? Object.assign(Object.assign({}, filter), { options: Object.assign(Object.assign({}, filter.options), { [option.value]: Object.assign(Object.assign({}, option), { applied: !option.applied }) }) }) : filter;
|
|
856
|
-
};
|
|
857
|
-
|
|
858
|
-
/**
|
|
859
|
-
* Oscillates the applied state of the matching filter options of a {@link DaffFilterRangeBase}
|
|
860
|
-
* that match the {@link DaffFilterRangeRequestBase}
|
|
861
|
-
*
|
|
862
|
-
* If there are no matching options, returns the original {@link DaffFilterRangeBase}
|
|
863
|
-
*
|
|
864
|
-
* @docs-private
|
|
865
|
-
*/
|
|
866
|
-
const daffToggleFilterRange = (request, filter) => filter.options[daffFilterComputeRangePairLabel(request.value.min, request.value.max)]
|
|
867
|
-
? daffRemoveFilterRange(request, filter)
|
|
868
|
-
: daffApplyFilterRange(request, filter);
|
|
869
|
-
|
|
870
|
-
/**
|
|
871
|
-
* Toggles the state of the filters (and their options) in the {@link DaffFilter}
|
|
872
|
-
* that match the {@link DaffFilterToggleRequest} .
|
|
873
|
-
*/
|
|
874
|
-
function daffToggleFilter(request, filter) {
|
|
875
|
-
daffFilterValidateRequestNameMatch(request, filter);
|
|
876
|
-
daffFilterValidateRequestTypeMatch(request, filter);
|
|
877
|
-
switch (request.type) {
|
|
878
|
-
case DaffFilterType.Equal:
|
|
879
|
-
return daffToggleFilterEqual(request, filter);
|
|
880
|
-
case (DaffFilterType.RangeNumeric):
|
|
881
|
-
return daffToggleFilterRange(request, filter);
|
|
882
|
-
default:
|
|
883
|
-
throw new DaffFilterUnknownType('Unknown filter type');
|
|
884
|
-
}
|
|
885
|
-
}
|
|
886
|
-
|
|
887
|
-
/**
|
|
888
|
-
* Toggles the state of a filter option in the {@link DaffFilters}
|
|
889
|
-
* that matches the {@link DaffFilterToggleRequest}.
|
|
890
|
-
*/
|
|
891
|
-
const daffToggleRequestOnFilters = (request, filters) => (Object.assign(Object.assign({}, filters), { [request.name]: daffToggleFilter(request, filters[request.name]) }));
|
|
892
|
-
|
|
893
|
-
/**
|
|
894
|
-
* Determines whether or not the {@link DaffFilterEqual} has any applied options.
|
|
895
|
-
*/
|
|
896
|
-
const daffIsFilterEqualApplied = (filter) => Object.keys(filter.options).map((key) => filter.options[key]).findIndex(option => option.applied) > -1;
|
|
897
|
-
|
|
898
|
-
/**
|
|
899
|
-
* Determines whether or not a {@link DaffFilterRangeBase} has any applied options.
|
|
900
|
-
*/
|
|
901
|
-
const daffIsFilterRangeApplied = (filter) => Object.keys(filter.options).length > 0;
|
|
902
|
-
|
|
903
|
-
/**
|
|
904
|
-
* Determines whether or not a filter has any currently applied options.
|
|
905
|
-
*/
|
|
906
|
-
const daffIsFilterApplied = (filter) => {
|
|
907
|
-
switch (filter.type) {
|
|
908
|
-
case DaffFilterType.RangeNumeric:
|
|
909
|
-
return daffIsFilterRangeApplied(filter);
|
|
910
|
-
case DaffFilterType.Equal:
|
|
911
|
-
return daffIsFilterEqualApplied(filter);
|
|
912
|
-
default:
|
|
913
|
-
throw new DaffFilterUnknownType('Unknown filter type');
|
|
914
|
-
}
|
|
915
|
-
};
|
|
916
|
-
|
|
917
|
-
/**
|
|
918
|
-
* Determines whether or not any {@link DaffFilterEqual} options matching {@link DaffFilterEqualToggleRequest} are applied.
|
|
919
|
-
*/
|
|
920
|
-
const daffIsEqualToggleRequestAppliedToFilter = (request, filter) => { var _a; return !!((_a = filter.options[request.value]) === null || _a === void 0 ? void 0 : _a.applied); };
|
|
921
|
-
|
|
922
|
-
/**
|
|
923
|
-
* Determines whether or not any {@link DaffFilterRangeBase} options matching {@link DaffFilterRangeRequestBase} are applied.
|
|
924
|
-
*/
|
|
925
|
-
const daffIsRangeToggleRequestAppliedToFilter = (request, filter) => daffFilterComputeRangePairLabel(request.value.min, request.value.max) in filter.options;
|
|
926
|
-
|
|
927
|
-
/**
|
|
928
|
-
* Determines whether or not a {@link DaffFilterToggleRequest} is already applied to a {@link DaffFilter}.
|
|
929
|
-
*/
|
|
930
|
-
const daffIsToggleRequestAppliedToFilter = (request, filter) => {
|
|
931
|
-
switch (filter.type) {
|
|
932
|
-
case DaffFilterType.RangeNumeric:
|
|
933
|
-
return daffIsRangeToggleRequestAppliedToFilter(request, filter);
|
|
934
|
-
case DaffFilterType.Equal:
|
|
935
|
-
return daffIsEqualToggleRequestAppliedToFilter(request, filter);
|
|
936
|
-
default:
|
|
937
|
-
throw new DaffFilterUnknownType('Unknown filter type');
|
|
938
|
-
}
|
|
939
|
-
};
|
|
940
|
-
|
|
941
|
-
/**
|
|
942
|
-
* Finds the applied options in the filter.
|
|
943
|
-
*/
|
|
944
|
-
const daffFilterFindAppliedOptions = (filter) => Object.keys(filter.options).map((key) => filter.options[key]).filter((option) => option.applied);
|
|
945
|
-
|
|
946
|
-
/**
|
|
947
|
-
* Builds an {@link DaffFilterEqualRequest} from the passed filter and options.
|
|
948
|
-
*/
|
|
949
|
-
const daffFilterEqualToRequest = (filter) => {
|
|
950
|
-
const options = daffFilterFindAppliedOptions(filter);
|
|
951
|
-
if (!options.length) {
|
|
952
|
-
return null;
|
|
953
|
-
}
|
|
954
|
-
return {
|
|
955
|
-
type: DaffFilterType.Equal,
|
|
956
|
-
name: filter.name,
|
|
957
|
-
value: options.map(option => option.value),
|
|
958
|
-
};
|
|
959
|
-
};
|
|
960
|
-
|
|
961
|
-
/**
|
|
962
|
-
* Builds a {@link DaffFilterRangeRequestBase} from the passed {@link DaffFilterRangeBase} and options.
|
|
963
|
-
*/
|
|
964
|
-
const daffFilterRangeToRequest = (filter) => {
|
|
965
|
-
const options = daffFilterFindAppliedOptions(filter);
|
|
966
|
-
if (!options.length) {
|
|
967
|
-
return null;
|
|
968
|
-
}
|
|
969
|
-
return {
|
|
970
|
-
type: filter.type,
|
|
971
|
-
name: filter.name,
|
|
972
|
-
value: {
|
|
973
|
-
min: options[0].min.value,
|
|
974
|
-
max: options[0].max.value,
|
|
975
|
-
},
|
|
976
|
-
};
|
|
977
|
-
};
|
|
978
|
-
|
|
979
|
-
/**
|
|
980
|
-
* Transforms a {@link DaffFilterRangeNumeric} into a {@link DaffFilterRangeNumericRequest}
|
|
981
|
-
*/
|
|
982
|
-
const daffFilterRangeNumericToRequest = (filter) => daffFilterRangeToRequest(filter);
|
|
983
|
-
|
|
984
|
-
/**
|
|
985
|
-
* Builds a filter request from a filter.
|
|
986
|
-
* Returns null if the filter does not have at least one applied option.
|
|
987
|
-
*/
|
|
988
|
-
function daffFilterToRequest(filter) {
|
|
989
|
-
switch (filter.type) {
|
|
990
|
-
case DaffFilterType.RangeNumeric:
|
|
991
|
-
return daffFilterRangeNumericToRequest(filter);
|
|
992
|
-
case DaffFilterType.Equal:
|
|
993
|
-
return daffFilterEqualToRequest(filter);
|
|
994
|
-
default:
|
|
995
|
-
throw new DaffFilterUnknownType('Unknown filter type');
|
|
996
|
-
}
|
|
997
|
-
}
|
|
998
|
-
;
|
|
999
|
-
|
|
1000
|
-
/**
|
|
1001
|
-
* Builds a list of filter requests from a list of filters.
|
|
1002
|
-
* Requests are only built for the filters that have at least one applied option.
|
|
1003
|
-
*/
|
|
1004
|
-
function daffFiltersToRequests(filters) {
|
|
1005
|
-
return Object.keys(filters).map((key) => filters[key]).reduce((acc, filter) => {
|
|
1006
|
-
const request = daffFilterToRequest(filter);
|
|
1007
|
-
if (request) {
|
|
1008
|
-
acc.push(request);
|
|
1009
|
-
}
|
|
1010
|
-
return acc;
|
|
1011
|
-
}, []);
|
|
1012
|
-
}
|
|
1013
|
-
|
|
1014
|
-
/**
|
|
1015
|
-
* Transforms an {@link DaffFilterRangePair[]} to a dictionary.
|
|
1016
|
-
*/
|
|
1017
|
-
const daffFilterRangePairArrayToDict = (pairs) => daffArrayToDict(pairs, pair => daffFilterComputeRangePairLabel(pair.min.value, pair.max.value));
|
|
1018
|
-
|
|
1019
|
-
/**
|
|
1020
|
-
* Converts a list of equal filter options to a dict of options keyed by option value.
|
|
1021
|
-
*/
|
|
1022
|
-
const daffFilterEqualOptionArrayToDict = (options) => daffArrayToDict(options, option => option.value);
|
|
1023
|
-
|
|
1024
|
-
/**
|
|
1025
|
-
* Converts a list of filters into a dictionary of filters keyed by filter name.
|
|
1026
|
-
*/
|
|
1027
|
-
const daffFilterArrayToDict = (filters) => daffArrayToDict(filters, filter => filter.name);
|
|
1028
|
-
|
|
1029
|
-
/**
|
|
1030
|
-
* Returns a {@link DaffFilters} and only their applied options.
|
|
1031
|
-
* {@link DaffFilter} that have no applied options will be omitted.
|
|
1032
|
-
*/
|
|
1033
|
-
const daffComputeAppliedFilters = (filters) => Object.keys(filters).map(key => filters[key]).reduce((acc, filter) => {
|
|
1034
|
-
const appliedOptions = daffFilterFindAppliedOptions(filter);
|
|
1035
|
-
if (appliedOptions.length > 0) {
|
|
1036
|
-
acc[filter.name] = Object.assign(Object.assign({}, filter), { options: filter.type === DaffFilterType.Equal
|
|
1037
|
-
? daffFilterEqualOptionArrayToDict(appliedOptions)
|
|
1038
|
-
: daffFilterRangePairArrayToDict(appliedOptions) });
|
|
1039
|
-
}
|
|
1040
|
-
return acc;
|
|
1041
|
-
}, {});
|
|
1042
|
-
|
|
1043
|
-
/**
|
|
1044
|
-
* Builds a {@link DaffCollectionRequest} from {@link DaffCollectionMetadata}.
|
|
1045
|
-
*/
|
|
1046
|
-
const daffCollectionBuildRequestFromMetadata = (metadata) => ({
|
|
1047
|
-
appliedSortOption: metadata.appliedSortOption,
|
|
1048
|
-
appliedSortDirection: metadata.appliedSortDirection,
|
|
1049
|
-
currentPage: metadata.currentPage,
|
|
1050
|
-
pageSize: metadata.pageSize,
|
|
1051
|
-
filterRequests: daffFiltersToRequests(metadata.filters),
|
|
1052
|
-
});
|
|
1053
|
-
|
|
1054
|
-
/**
|
|
1055
|
-
* Transforms an array of {@link DaffIdentifiable} objects to a dictionary of those objects keyed by ID.
|
|
1056
|
-
*/
|
|
1057
|
-
const daffIdentifiableArrayToDict = (ary) => daffArrayToDict(ary, ({ id }) => id);
|
|
1058
|
-
|
|
1059
|
-
/**
|
|
1060
|
-
* Generated bundle index. Do not edit.
|
|
1061
|
-
*/
|
|
1062
|
-
|
|
1063
|
-
export { DAFF_COLLECTION_PAGE_OUT_OF_BOUNDS_ERROR_CODE, DAFF_SERVER_STORAGE_SERVICE_ERROR_CODE, DAFF_STORAGE_SERVICE_ERROR_CODE, DaffBase64ServiceToken, DaffBrowserBase64Service, DaffCollectionPageOutOfBoundsError, DaffErrorStorageService, DaffFilterFromToFilterSeparator, DaffFilterNotFound, DaffFilterRequestNameMismatch, DaffFilterRequestTypeMismatch, DaffFilterType, DaffFilterUnknownType, DaffInheritableError, DaffLocalStorageService, DaffNoopStorageService, DaffPersistenceServiceToken, DaffServerBase64Service, DaffServerErrorStorageService, DaffServerSafePersistenceServiceToken, DaffServerSideStorageError, DaffSortDirectionEnum, DaffStorageServiceError, allOf, anyOf, backoff, catchAndArrayifyErrors, collect, daffAdd, daffApplyFilter, daffApplyRequestToFilters, daffApplyRequestsToFilters, daffArrayToDict, daffClearFilter, daffClearFilters, daffCollectionBuildMetadataFromRequest, daffCollectionBuildRequestFromMetadata, daffCollectionErrorMap, daffComputeAppliedFilters, daffDivide, daffFilterArrayToDict, daffFilterComputeRangePairLabel, daffFilterEqualOptionArrayToDict, daffFilterFindAppliedOptions, daffFilterRangePairArrayToDict, daffFilterToRequest, daffFilterValidateRequestNameMatch, daffFilterValidateRequestTypeMatch, daffFiltersToRequests, daffIdentifiableArrayToDict, daffIsError, daffIsFilterApplied, daffIsToggleRequestAppliedToFilter, daffMultiply, daffPrecision, daffRemoveFilter, daffRemoveRequestFromFilters, daffRemoveRequestsFromFilters, daffSubtract, daffToggleFilter, daffToggleRequestOnFilters, randomSlice, randomSubset, range, sample, shallowCompare, shuffle, unique };
|
|
1064
|
-
//# sourceMappingURL=daffodil-core.mjs.map
|