- Fixes:
    - Fixing time based issue in `ConnectivityManager` (using the now synced time for checkups)
      - `dispatchers.ConnectivityManager.ConnectivityManager`: fixing `_checkDispatcherHealth`
    - Fixing `extractUniqueValues` now it is possible to use different pathes for the `key` and `value`
      - `lib\helpers\mapMethods.ts` has been adapted
    - `lib\pubSub\nopePubSubSystem.ts` contains the following fixes:
      - fixing typo of method `updateMatching`
  - Modified:
    - `lib\pubSub\nopePubSubSystem.ts`:
      - throws error if `register` method doest not contain a topic.
      - Adapted the behavior of `_patternbasedPullData`. If no default default value is present -> the function returns an empty array.
This commit is contained in:
Martin Karkowski 2022-10-08 07:15:33 +02:00
parent fa234b9a9b
commit 90783572b4
5 changed files with 42 additions and 14 deletions

View File

@ -266,3 +266,9 @@ Inital commit, which is working with the browser
- `dispatchers.ConnectivityManager.ConnectivityManager`: fixing `_checkDispatcherHealth`
- Fixing `extractUniqueValues` now it is possible to use different pathes for the `key` and `value`
- `lib\helpers\mapMethods.ts` has been adapted
- `lib\pubSub\nopePubSubSystem.ts` contains the following fixes:
- fixing typo of method `updateMatching`
- Modified:
- `lib\pubSub\nopePubSubSystem.ts`:
- throws error if `register` method doest not contain a topic.
- Adapted the behavior of `_patternbasedPullData`. If no default default value is present -> the function returns an empty array.

View File

@ -42,6 +42,8 @@ type TMatchting<O extends INopeTopic = INopeTopic> = {
dataQuery: Map<string, Set<O>>;
};
const DEFAULT_OBJ = {id:"default"};
export class PubSubSystemBase<
AD extends ITopicSetContentOptions & {
pubSubUpdate?: boolean;
@ -171,6 +173,11 @@ export class PubSubSystemBase<
// See interface description
public register(emitter: I, options: IEventOptions): O {
if (!this._emitters.has(emitter as unknown as O)) {
if (typeof(options.topic) !== "string" && typeof(options.topic) !== "object"){
throw Error("A Topic must be provided in the options.")
}
let pubTopic: string | false =
typeof options.topic === "string"
? options.topic
@ -393,7 +400,7 @@ export class PubSubSystemBase<
* @author M.Karkowski
* @memberof PubSubSystemBase
*/
public updateMatchting(): void {
public updateMatching(): void {
// Clears all defined Matches
this._matched.clear();
// Iterate through all Publishers and
@ -770,7 +777,7 @@ export class PubSubSystemBase<
*/
protected _patternbasedPullData<T = unknown, D = null>(
pattern: string,
_default: D = null
_default: D = undefined
): { path: string; data: T }[] {
// To extract the data based on a Pattern,
// we firstly, we check if the given pattern
@ -778,12 +785,26 @@ export class PubSubSystemBase<
if (!containsWildcards(pattern)) {
// Its not a pattern so we will speed up
// things.
const data:T = this._pullData(pattern, DEFAULT_OBJ);
if (data !== DEFAULT_OBJ) {
return [
{
path: pattern,
data: this._pullData(pattern, _default),
data,
},
];
} else if (_default !== undefined) {
return [
{
path: pattern,
data: _default as any as T,
},
];
}
return []
}
// Now we know, we have to work with the query,

View File

@ -198,7 +198,7 @@ export interface IPubSubSystem<
* @author M.Karkowski
* @memberof IPubSubSystem
*/
updateMatchting(): void;
updateMatching(): void;
/**
* An observable which holds the incremental data change.
@ -317,8 +317,8 @@ export interface IDataPubSubSystem<
* @author M.Karkowski
* @template T
* @template D
* @param {string} pattern
* @param {D} _default
* @param {string} pattern The pattern to pull the data from
* @param {D} _default a default value, o
* @return {*} {{ path: string, data: T }[]}
* @memberof IPubSubSystem
*/

View File

@ -3,4 +3,4 @@ cd "%DIR%"
cd ..
rm -rf temp
nope-py-prepare-code --input dist-py --output temp --type js
nope-py-prepare-code --input dist-py --output temp --type js --convert_snake_case

View File

@ -23,7 +23,8 @@ replacers = {
'"undefined"': "None",
'undefined': "None",
'self = self': "",
"__definition_of__": ""
"__definition_of__": "",
"@property()": "@property",
}
def post_process(code: str) -> str: