-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(external-connection): Handle external port connectivity both ways.
- Standardize contributor actions to only accept a `contributorId` as a payload. - Introduce `connection` actions to handle port connections. - Introduce `sender` and `receive` meta and use standard `MessageSender` API
- Loading branch information
Showing
58 changed files
with
976 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,95 @@ | ||
import { Contributor, ContributorId } from 'app/lmem/contributor'; | ||
import { ActionMeta, BaseAction } from '.'; | ||
import { ContributorId } from 'app/lmem/contributor'; | ||
import { ActionMeta, BaseAction, ErrorAction } from '.'; | ||
import { Level } from 'app/utils/Logger'; | ||
|
||
export interface ContributorAction extends BaseAction { | ||
payload: { contributor: Contributor | ContributorId }; | ||
payload: ContributorId; | ||
} | ||
|
||
export const SUBSCRIBE = 'SUBSCRIBE'; | ||
export interface SubscribeAction extends ContributorAction { | ||
type: typeof SUBSCRIBE; | ||
} | ||
export const subscribe = ( | ||
contributor: Contributor | ContributorId, | ||
contributorId: ContributorId, | ||
meta?: ActionMeta | ||
): SubscribeAction => ({ | ||
type: SUBSCRIBE, | ||
payload: { contributor }, | ||
payload: contributorId, | ||
meta | ||
}); | ||
|
||
export const SUBSCRIBED = 'SUBSCRIBED'; | ||
export interface SubscribedAction extends ContributorAction { | ||
type: typeof SUBSCRIBED; | ||
payload: ContributorId; | ||
} | ||
export const subscribed = ( | ||
contributorId: ContributorId, | ||
meta?: ActionMeta | ||
): SubscribedAction => ({ | ||
type: SUBSCRIBED, | ||
payload: contributorId, | ||
meta | ||
}); | ||
|
||
export const SUBSCRIBE_FAILED = 'SUBSCRIBE_FAILED'; | ||
export interface SubscribeFailedAction extends ErrorAction { | ||
type: typeof SUBSCRIBE_FAILED; | ||
} | ||
export const subscribeFailed = ( | ||
error: Error, | ||
meta?: ActionMeta | ||
): SubscribeFailedAction => ({ | ||
type: SUBSCRIBE_FAILED, | ||
payload: error, | ||
error: true, | ||
meta: { | ||
...meta, | ||
severity: Level.ERROR | ||
} | ||
}); | ||
|
||
export const UNSUBSCRIBE = 'UNSUBSCRIBE'; | ||
export interface UnsubscribeAction extends ContributorAction { | ||
type: typeof UNSUBSCRIBE; | ||
} | ||
export const unsubscribe = ( | ||
contributor: Contributor | ContributorId, | ||
contributorId: ContributorId, | ||
meta?: ActionMeta | ||
): UnsubscribeAction => ({ | ||
type: UNSUBSCRIBE, | ||
payload: { contributor }, | ||
payload: contributorId, | ||
meta | ||
}); | ||
|
||
export const UNSUBSCRIBED = 'UNSUBSCRIBED'; | ||
export interface UnsubscribedAction extends ContributorAction { | ||
type: typeof UNSUBSCRIBED; | ||
payload: ContributorId; | ||
} | ||
export const unsubscribed = ( | ||
contributorId: ContributorId, | ||
meta?: ActionMeta | ||
): UnsubscribedAction => ({ | ||
type: UNSUBSCRIBED, | ||
payload: contributorId, | ||
meta | ||
}); | ||
|
||
export const UNSUBSCRIBED_FAILED = 'UNSUBSCRIBED_FAILED'; | ||
export interface UnsubscribedFailedAction extends ErrorAction { | ||
type: typeof UNSUBSCRIBED_FAILED; | ||
} | ||
export const unsubscribedFailed = ( | ||
error: Error, | ||
meta?: ActionMeta | ||
): UnsubscribedFailedAction => ({ | ||
type: UNSUBSCRIBED_FAILED, | ||
payload: error, | ||
error: true, | ||
meta: { | ||
...meta, | ||
severity: Level.ERROR | ||
} | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import { ActionMeta, BaseAction, ErrorAction } from 'app/actions'; | ||
import { Subscriptions } from 'app/lmem/subscription'; | ||
import { Level } from 'app/utils/Logger'; | ||
|
||
export const FETCH_SUBSCRIPTIONS = 'FETCH_SUBSCRIPTIONS'; | ||
export interface FetchSubscriptionsAction extends BaseAction { | ||
type: typeof FETCH_SUBSCRIPTIONS; | ||
} | ||
export const fetchSubscriptions = ( | ||
meta: ActionMeta | ||
): FetchSubscriptionsAction => ({ | ||
type: FETCH_SUBSCRIPTIONS, | ||
meta | ||
}); | ||
|
||
export const FETCH_SUBSCRIPTIONS_SUCCESS = 'FETCH_SUBSCRIPTIONS_SUCCESS'; | ||
export interface FetchSubscriptionsSuccessAction extends BaseAction { | ||
type: typeof FETCH_SUBSCRIPTIONS_SUCCESS; | ||
payload: Subscriptions; | ||
} | ||
export const fetchSubscriptionsSuccess = ( | ||
subscriptions: Subscriptions, | ||
meta?: ActionMeta | ||
): FetchSubscriptionsSuccessAction => ({ | ||
type: FETCH_SUBSCRIPTIONS_SUCCESS, | ||
payload: subscriptions, | ||
meta | ||
}); | ||
|
||
export const FETCH_SUBSCRIPTIONS_FAILURE = 'FETCH_SUBSCRIPTIONS_FAILURE'; | ||
export interface FetchSubscriptionsFailureAction extends ErrorAction { | ||
type: typeof FETCH_SUBSCRIPTIONS_FAILURE; | ||
} | ||
export const fetchSubscriptionsFailure = ( | ||
error: Error, | ||
meta?: ActionMeta | ||
): FetchSubscriptionsFailureAction => ({ | ||
type: FETCH_SUBSCRIPTIONS_FAILURE, | ||
payload: error, | ||
error: true, | ||
meta: { | ||
...meta, | ||
severity: Level.ERROR | ||
} | ||
}); | ||
|
||
export type SubscriptionsAction = | ||
| FetchSubscriptionsAction | ||
| FetchSubscriptionsSuccessAction | ||
| FetchSubscriptionsFailureAction; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.