@brandingbrand/cargo-hold
Advanced tools
Comparing version 11.45.0 to 11.46.0
@@ -5,2 +5,11 @@ # Changelog | ||
# [11.46.0](https://github.com/brandingbrand/shipyard/compare/v11.45.0...v11.46.0) (2022-03-28) | ||
### Features | ||
* **cargo-hold:** add filterMetadata ([a172b01](https://github.com/brandingbrand/shipyard/commit/a172b01b18b31ea56d7fc296f9ed5f80c0517451)) | ||
# [11.45.0](https://github.com/brandingbrand/shipyard/compare/v11.44.0...v11.45.0) (2022-03-24) | ||
@@ -7,0 +16,0 @@ |
@@ -5,2 +5,3 @@ import { filter, scan, shareReplay, switchMap, withLatestFrom, map, mergeMap } from 'rxjs/operators'; | ||
import { ok, fail, isOk } from '@brandingbrand/standard-result'; | ||
import equal from 'fast-deep-equal'; | ||
@@ -11,2 +12,3 @@ const createActionCreator = (options)=>({ | ||
source: options.source, | ||
filterMetadata: options.metadata, | ||
create: (...params)=>({ | ||
@@ -16,2 +18,3 @@ type: options.actionKey, | ||
source: options.source, | ||
filterMetadata: options.metadata, | ||
payload: options.callback ? options.callback(...params) : {} | ||
@@ -54,3 +57,3 @@ }) | ||
* @returns `AsyncActionCreators` - init, load, succeed, fail, & revert. | ||
*/ const createAsyncActionCreators = (actionKey, source)=>({ | ||
*/ const createAsyncActionCreators = (actionKey, source, metadata)=>({ | ||
init: createActionCreator({ | ||
@@ -60,2 +63,3 @@ actionKey, | ||
source, | ||
metadata, | ||
callback: (payload)=>payload | ||
@@ -67,2 +71,3 @@ }), | ||
source, | ||
metadata, | ||
callback: (payload)=>payload | ||
@@ -74,2 +79,3 @@ }), | ||
source, | ||
metadata, | ||
callback: (payload)=>payload | ||
@@ -81,2 +87,3 @@ }), | ||
source, | ||
metadata, | ||
callback: (payload)=>payload | ||
@@ -88,2 +95,3 @@ }), | ||
source, | ||
metadata, | ||
callback: (failure)=>failure | ||
@@ -95,2 +103,3 @@ }), | ||
source, | ||
metadata, | ||
callback: (payload)=>payload | ||
@@ -125,4 +134,4 @@ }) | ||
; | ||
const matches = (action, extraSources)=>(inputAction)=>{ | ||
return action.type === inputAction.type && action.subtype === inputAction.subtype && (extraSources === undefined || requireSource(action.source, ...extraSources)(inputAction)); | ||
const matches = (specifier, extraSources)=>(inputAction)=>{ | ||
return specifier.type === inputAction.type && specifier.subtype === inputAction.subtype && (extraSources === undefined || requireSource(specifier.source, ...extraSources)(inputAction)) && equal(specifier.filterMetadata, inputAction.filterMetadata); | ||
} | ||
@@ -390,3 +399,3 @@ ; | ||
const structureLens = (_lens = options.lens) !== null && _lens !== void 0 ? _lens : createLens().fromPath(); | ||
const actionCreators = createAsyncActionCreators(options.actionKey, options.emitSource); | ||
const actionCreators = createAsyncActionCreators(options.actionKey, options.emitSource, options.metadata); | ||
const reducers = createReducers(); | ||
@@ -393,0 +402,0 @@ const lensedReducers = createLensedReducers(structureLens); |
21
index.js
@@ -9,3 +9,8 @@ 'use strict'; | ||
var standardResult = require('@brandingbrand/standard-result'); | ||
var equal = require('fast-deep-equal'); | ||
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } | ||
var equal__default = /*#__PURE__*/_interopDefaultLegacy(equal); | ||
const createActionCreator = (options)=>({ | ||
@@ -15,2 +20,3 @@ type: options.actionKey, | ||
source: options.source, | ||
filterMetadata: options.metadata, | ||
create: (...params)=>({ | ||
@@ -20,2 +26,3 @@ type: options.actionKey, | ||
source: options.source, | ||
filterMetadata: options.metadata, | ||
payload: options.callback ? options.callback(...params) : {} | ||
@@ -58,3 +65,3 @@ }) | ||
* @returns `AsyncActionCreators` - init, load, succeed, fail, & revert. | ||
*/ const createAsyncActionCreators = (actionKey, source)=>({ | ||
*/ const createAsyncActionCreators = (actionKey, source, metadata)=>({ | ||
init: createActionCreator({ | ||
@@ -64,2 +71,3 @@ actionKey, | ||
source, | ||
metadata, | ||
callback: (payload)=>payload | ||
@@ -71,2 +79,3 @@ }), | ||
source, | ||
metadata, | ||
callback: (payload)=>payload | ||
@@ -78,2 +87,3 @@ }), | ||
source, | ||
metadata, | ||
callback: (payload)=>payload | ||
@@ -85,2 +95,3 @@ }), | ||
source, | ||
metadata, | ||
callback: (payload)=>payload | ||
@@ -92,2 +103,3 @@ }), | ||
source, | ||
metadata, | ||
callback: (failure)=>failure | ||
@@ -99,2 +111,3 @@ }), | ||
source, | ||
metadata, | ||
callback: (payload)=>payload | ||
@@ -129,4 +142,4 @@ }) | ||
; | ||
const matches = (action, extraSources)=>(inputAction)=>{ | ||
return action.type === inputAction.type && action.subtype === inputAction.subtype && (extraSources === undefined || requireSource(action.source, ...extraSources)(inputAction)); | ||
const matches = (specifier, extraSources)=>(inputAction)=>{ | ||
return specifier.type === inputAction.type && specifier.subtype === inputAction.subtype && (extraSources === undefined || requireSource(specifier.source, ...extraSources)(inputAction)) && equal__default["default"](specifier.filterMetadata, inputAction.filterMetadata); | ||
} | ||
@@ -394,3 +407,3 @@ ; | ||
const structureLens = (_lens = options.lens) !== null && _lens !== void 0 ? _lens : standardLens.createLens().fromPath(); | ||
const actionCreators = createAsyncActionCreators(options.actionKey, options.emitSource); | ||
const actionCreators = createAsyncActionCreators(options.actionKey, options.emitSource, options.metadata); | ||
const reducers = createReducers(); | ||
@@ -397,0 +410,0 @@ const lensedReducers = createLensedReducers(structureLens); |
{ | ||
"name": "@brandingbrand/cargo-hold", | ||
"version": "11.45.0", | ||
"version": "11.46.0", | ||
"license": "MIT", | ||
@@ -10,9 +10,10 @@ "typings": "./src/index.d.ts", | ||
"rxjs": "^7.5.2", | ||
"@brandingbrand/standard-lens": "11.45.0", | ||
"@brandingbrand/standard-compose": "11.45.0", | ||
"@brandingbrand/standard-result": "11.45.0", | ||
"@brandingbrand/types-utility": "11.45.0", | ||
"@brandingbrand/standard-branded": "11.45.0" | ||
"@brandingbrand/standard-lens": "11.46.0", | ||
"@brandingbrand/standard-compose": "11.46.0", | ||
"@brandingbrand/standard-result": "11.46.0", | ||
"@brandingbrand/types-utility": "11.46.0", | ||
"@brandingbrand/standard-branded": "11.46.0", | ||
"fast-deep-equal": "^3.1.3" | ||
}, | ||
"peerDependencies": {} | ||
} |
@@ -22,2 +22,7 @@ import { PAYLOAD } from '../internal/tokens'; | ||
/** | ||
* `filterMetadata` is any optional data that should be filtered along with type when matching | ||
* against the action for reducers and effects. | ||
*/ | ||
filterMetadata?: Record<string, unknown>; | ||
/** | ||
* This key doesn't truly exist; it is only a placeholder in order to pass on the Payload type. | ||
@@ -24,0 +29,0 @@ */ |
@@ -9,2 +9,3 @@ import type { PAYLOAD } from '../internal/tokens'; | ||
source?: string | symbol; | ||
metadata?: Record<string, unknown>; | ||
callback?: (...params: Params) => Payload; | ||
@@ -11,0 +12,0 @@ }; |
@@ -27,2 +27,2 @@ import { ActionCreator } from '../action-bus'; | ||
*/ | ||
export declare const createAsyncActionCreators: <ActionKey extends string, Payload, FailPayload, EmptyPayload = Payload>(actionKey: ActionKey, source?: string | symbol | undefined) => AsyncActionCreators<ActionKey, Payload, FailPayload, EmptyPayload>; | ||
export declare const createAsyncActionCreators: <ActionKey extends string, Payload, FailPayload, EmptyPayload = Payload>(actionKey: ActionKey, source?: string | symbol | undefined, metadata?: Record<string, unknown> | undefined) => AsyncActionCreators<ActionKey, Payload, FailPayload, EmptyPayload>; |
@@ -8,4 +8,5 @@ import { ILens } from '@brandingbrand/standard-lens'; | ||
actionKey: ActionKey; | ||
metadata?: Record<string, unknown>; | ||
lens?: ILens<Structure, AsyncState<Payload, FailPayload, EmptyPayload>>; | ||
}; | ||
export declare const createAsyncAdaptor: <ActionKey extends string, Payload, FailPayload, Structure = AsyncState<Payload, FailPayload, Payload>, EmptyPayload = Payload>(options: AsyncAdaptorOptions<ActionKey, Payload, FailPayload, Structure, EmptyPayload>) => AsyncAdaptor<ActionKey, Payload, FailPayload, Structure, EmptyPayload>; |
@@ -10,5 +10,5 @@ import type { NonEmptyArray } from '../internal/util/functional/non-empty-array.types'; | ||
export declare const isSubtype: <ActionType extends AnyAction<unknown>>(...actionSubtypes: NonEmptyArray<ActionType["subtype"]>) => (action: AnyAction) => action is ActionType; | ||
export declare const matches: <DesiredActionSpecifier extends AnyActionSpecifier>(action: DesiredActionSpecifier, extraSources?: SourcesList | undefined) => TypeGuard<AnyActionSpecifier, DesiredActionSpecifier>; | ||
export declare const matches: <DesiredActionSpecifier extends AnyActionSpecifier>(specifier: DesiredActionSpecifier, extraSources?: SourcesList | undefined) => TypeGuard<AnyActionSpecifier, DesiredActionSpecifier>; | ||
export declare const and: <RefinedActionType extends ActionType, ActionType extends OuterActionType, OuterActionType extends AnyActionSpecifier = AnyActionSpecifier>(outerTypeguard: TypeGuard<OuterActionType, ActionType>, innerTypeguard: TypeGuard<ActionType, RefinedActionType>) => TypeGuard<OuterActionType, RefinedActionType>; | ||
export declare const or: <ActionTypeA extends OuterActionType, ActionTypeB extends OuterActionType, OuterActionType extends AnyActionSpecifier = AnyActionSpecifier>(typeguardA: TypeGuard<OuterActionType, ActionTypeA>, typeguardB: TypeGuard<OuterActionType, ActionTypeB>) => TypeGuard<OuterActionType, ActionTypeA | ActionTypeB>; | ||
export declare const composeStateReducers: <T>(outerReducer: StateReducer<T>) => (innerReducer: StateReducer<T>) => StateReducer<T>; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
92725
1847
7
+ Addedfast-deep-equal@^3.1.3
+ Added@brandingbrand/standard-branded@11.46.0(transitive)
+ Added@brandingbrand/standard-compose@11.46.0(transitive)
+ Added@brandingbrand/standard-lens@11.46.0(transitive)
+ Added@brandingbrand/standard-result@11.46.0(transitive)
+ Added@brandingbrand/types-utility@11.46.0(transitive)
+ Addedfast-deep-equal@3.1.3(transitive)
- Removed@brandingbrand/standard-branded@11.45.0(transitive)
- Removed@brandingbrand/standard-compose@11.45.0(transitive)
- Removed@brandingbrand/standard-lens@11.45.0(transitive)
- Removed@brandingbrand/standard-result@11.45.0(transitive)
- Removed@brandingbrand/types-utility@11.45.0(transitive)