@ms-cloudpack/data-bus 0.1.1 → 0.2.1

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.
Files changed (55) hide show
  1. package/lib/addProvider.d.ts +3 -1
  2. package/lib/addProvider.d.ts.map +1 -0
  3. package/lib/addProvider.js.map +1 -1
  4. package/lib/createDataBus.d.ts +2 -1
  5. package/lib/createDataBus.d.ts.map +1 -0
  6. package/lib/createDataBus.js.map +1 -1
  7. package/lib/createNode.d.ts +2 -1
  8. package/lib/createNode.d.ts.map +1 -0
  9. package/lib/createNode.js.map +1 -1
  10. package/lib/getData.d.ts +2 -1
  11. package/lib/getData.d.ts.map +1 -0
  12. package/lib/getData.js.map +1 -1
  13. package/lib/getNode.d.ts +3 -1
  14. package/lib/getNode.d.ts.map +1 -0
  15. package/lib/getNode.js.map +1 -1
  16. package/lib/index.d.ts +7 -1
  17. package/lib/index.d.ts.map +1 -0
  18. package/lib/index.js.map +1 -1
  19. package/lib/publish.d.ts +3 -1
  20. package/lib/publish.d.ts.map +1 -0
  21. package/lib/publish.js.map +1 -1
  22. package/lib/subscribe.d.ts +5 -1
  23. package/lib/subscribe.d.ts.map +1 -0
  24. package/lib/subscribe.js.map +1 -1
  25. package/lib/tsdoc-metadata.json +11 -11
  26. package/lib/types/DataBus.d.ts +10 -0
  27. package/lib/types/DataBus.d.ts.map +1 -0
  28. package/lib/types/DataBus.js +2 -0
  29. package/lib/types/DataBus.js.map +1 -0
  30. package/lib/types/DataBusChangeFunction.d.ts +2 -0
  31. package/lib/types/DataBusChangeFunction.d.ts.map +1 -0
  32. package/lib/types/DataBusChangeFunction.js +2 -0
  33. package/lib/types/DataBusChangeFunction.js.map +1 -0
  34. package/lib/types/DataBusNode.d.ts +14 -0
  35. package/lib/types/DataBusNode.d.ts.map +1 -0
  36. package/lib/types/DataBusNode.js +2 -0
  37. package/lib/types/DataBusNode.js.map +1 -0
  38. package/lib/types/DataBusProvider.d.ts +19 -0
  39. package/lib/types/DataBusProvider.d.ts.map +1 -0
  40. package/lib/types/DataBusProvider.js +2 -0
  41. package/lib/types/DataBusProvider.js.map +1 -0
  42. package/lib/types/DataBusState.d.ts +5 -0
  43. package/lib/types/DataBusState.d.ts.map +1 -0
  44. package/lib/types/DataBusState.js +2 -0
  45. package/lib/types/DataBusState.js.map +1 -0
  46. package/lib/types/DisposeFunction.d.ts +2 -0
  47. package/lib/types/DisposeFunction.d.ts.map +1 -0
  48. package/lib/types/DisposeFunction.js +2 -0
  49. package/lib/types/DisposeFunction.js.map +1 -0
  50. package/package.json +3 -4
  51. package/CHANGELOG.json +0 -125
  52. package/CHANGELOG.md +0 -29
  53. package/lib/types.d.ts +0 -39
  54. package/lib/types.js +0 -2
  55. package/lib/types.js.map +0 -1
@@ -1,5 +1,7 @@
1
- import type { DataBusState, DataBusProvider } from './types.js';
1
+ import type { DataBusProvider } from './types/DataBusProvider.js';
2
+ import type { DataBusState } from './types/DataBusState.js';
2
3
  /**
3
4
  * Adds a provider.
4
5
  */
5
6
  export declare function addProvider(state: DataBusState, provider: DataBusProvider): void;
7
+ //# sourceMappingURL=addProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"addProvider.d.ts","sourceRoot":"","sources":["../src/addProvider.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAE5D;;GAEG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,eAAe,QAKzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"addProvider.js","sourceRoot":"","sources":["../src/addProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAmB,EAAE,QAAyB;IACxE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAErD,IAAI,CAAC,SAAS,KAAd,IAAI,CAAC,SAAS,GAAK,EAAE,EAAC;IACtB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC"}
1
+ {"version":3,"file":"addProvider.js","sourceRoot":"","sources":["../src/addProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAIvC;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,KAAmB,EAAE,QAAyB;IACxE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAErD,IAAI,CAAC,SAAS,KAAd,IAAI,CAAC,SAAS,GAAK,EAAE,EAAC;IACtB,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import { getNode } from './getNode.js';\nimport type { DataBusProvider } from './types/DataBusProvider.js';\nimport type { DataBusState } from './types/DataBusState.js';\n\n/**\n * Adds a provider.\n */\nexport function addProvider(state: DataBusState, provider: DataBusProvider) {\n const { node } = getNode(state, provider.path, true);\n\n node.providers ??= [];\n node.providers.push(provider);\n}\n"]}
@@ -1,5 +1,6 @@
1
- import type { DataBus } from './types.js';
1
+ import type { DataBus } from './types/DataBus.js';
2
2
  /**
3
3
  * Creates a new data bus instance.
4
4
  */
5
5
  export declare function createDataBus(): DataBus;
6
+ //# sourceMappingURL=createDataBus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createDataBus.d.ts","sourceRoot":"","sources":["../src/createDataBus.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAkBvC"}
@@ -1 +1 @@
1
- {"version":3,"file":"createDataBus.js","sourceRoot":"","sources":["../src/createDataBus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAG3C;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,KAAK,GAAiB;QAC1B,IAAI,EAAE,UAAU,EAAE;KACnB,CAAC;IAEF,MAAM,GAAG,GAAG;QACV,8DAA8D;QAC9D,OAAO,EAAE,CAAC,IAAc,EAAE,KAAU,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC;QAEzE,8DAA8D;QAC9D,OAAO,EAAE,CAAc,IAAc,EAAE,EAAE,CAAC,OAAO,CAAQ,KAAK,EAAE,IAAI,CAAC;QAErE,SAAS,EAAE,CAAC,IAAc,EAAE,MAA6B,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC;QAEjG,WAAW,EAAE,CAAC,QAAyB,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;KACzE,CAAC;IAEF,OAAO,GAAG,CAAC;AACb,CAAC"}
1
+ {"version":3,"file":"createDataBus.js","sourceRoot":"","sources":["../src/createDataBus.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAM3C;;GAEG;AACH,MAAM,UAAU,aAAa;IAC3B,MAAM,KAAK,GAAiB;QAC1B,IAAI,EAAE,UAAU,EAAE;KACnB,CAAC;IAEF,MAAM,GAAG,GAAG;QACV,8DAA8D;QAC9D,OAAO,EAAE,CAAC,IAAc,EAAE,KAAU,EAAE,EAAE,CAAC,OAAO,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,KAAK,CAAC;QAEzE,8DAA8D;QAC9D,OAAO,EAAE,CAAc,IAAc,EAAE,EAAE,CAAC,OAAO,CAAQ,KAAK,EAAE,IAAI,CAAC;QAErE,SAAS,EAAE,CAAC,IAAc,EAAE,MAA6B,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,CAAC;QAEjG,WAAW,EAAE,CAAC,QAAyB,EAAE,EAAE,CAAC,WAAW,CAAC,KAAK,EAAE,QAAQ,CAAC;KACzE,CAAC;IAEF,OAAO,GAAG,CAAC;AACb,CAAC","sourcesContent":["import { addProvider } from './addProvider.js';\nimport { createNode } from './createNode.js';\nimport { getData } from './getData.js';\nimport { publish } from './publish.js';\nimport { subscribe } from './subscribe.js';\nimport type { DataBusChangeFunction } from './types/DataBusChangeFunction.js';\nimport type { DataBusProvider } from './types/DataBusProvider.js';\nimport type { DataBusState } from './types/DataBusState.js';\nimport type { DataBus } from './types/DataBus.js';\n\n/**\n * Creates a new data bus instance.\n */\nexport function createDataBus(): DataBus {\n const state: DataBusState = {\n root: createNode(),\n };\n\n const bus = {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n publish: (path: string[], value: any) => publish(state, bus, path, value),\n\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getData: <TData = any>(path: string[]) => getData<TData>(state, path),\n\n subscribe: (path: string[], change: DataBusChangeFunction) => subscribe(state, bus, path, change),\n\n addProvider: (provider: DataBusProvider) => addProvider(state, provider),\n };\n\n return bus;\n}\n"]}
@@ -1,2 +1,3 @@
1
- import type { DataBusNode } from './types.js';
1
+ import type { DataBusNode } from './types/DataBusNode.js';
2
2
  export declare function createNode(name?: string): DataBusNode;
3
+ //# sourceMappingURL=createNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createNode.d.ts","sourceRoot":"","sources":["../src/createNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAE1D,wBAAgB,UAAU,CAAC,IAAI,SAAK,GAAG,WAAW,CAIjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"createNode.js","sourceRoot":"","sources":["../src/createNode.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,UAAU,CAAC,IAAI,GAAG,EAAE;IAClC,OAAO;QACL,IAAI;KACL,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"createNode.js","sourceRoot":"","sources":["../src/createNode.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,UAAU,CAAC,IAAI,GAAG,EAAE;IAClC,OAAO;QACL,IAAI;KACL,CAAC;AACJ,CAAC","sourcesContent":["import type { DataBusNode } from './types/DataBusNode.js';\n\nexport function createNode(name = ''): DataBusNode {\n return {\n name,\n };\n}\n"]}
package/lib/getData.d.ts CHANGED
@@ -1,5 +1,6 @@
1
- import type { DataBusState } from './types.js';
1
+ import type { DataBusState } from './types/DataBusState.js';
2
2
  /**
3
3
  * Gets data containing the corresponding props.
4
4
  */
5
5
  export declare function getData<TData>(state: DataBusState, path: string[]): TData | undefined;
6
+ //# sourceMappingURL=getData.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getData.d.ts","sourceRoot":"","sources":["../src/getData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAG5D;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,GAAG,SAAS,CAIrF"}
@@ -1 +1 @@
1
- {"version":3,"file":"getData.js","sourceRoot":"","sources":["../src/getData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;GAEG;AACH,MAAM,UAAU,OAAO,CAAQ,KAAmB,EAAE,IAAc;IAChE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEtC,OAAO,IAAI,EAAE,KAA0B,CAAC;AAC1C,CAAC"}
1
+ {"version":3,"file":"getData.js","sourceRoot":"","sources":["../src/getData.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;GAEG;AACH,MAAM,UAAU,OAAO,CAAQ,KAAmB,EAAE,IAAc;IAChE,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;IAEtC,OAAO,IAAI,EAAE,KAA0B,CAAC;AAC1C,CAAC","sourcesContent":["import type { DataBusState } from './types/DataBusState.js';\nimport { getNode } from './getNode.js';\n\n/**\n * Gets data containing the corresponding props.\n */\nexport function getData<TData>(state: DataBusState, path: string[]): TData | undefined {\n const { node } = getNode(state, path);\n\n return node?.value as TData | undefined;\n}\n"]}
package/lib/getNode.d.ts CHANGED
@@ -1,4 +1,5 @@
1
- import type { DataBusNode, DataBusState } from './types.js';
1
+ import type { DataBusNode } from './types/DataBusNode.js';
2
+ import type { DataBusState } from './types/DataBusState.js';
2
3
  export declare function getNode(state: DataBusState, path: string[]): {
3
4
  node: DataBusNode;
4
5
  nodePath: DataBusNode[];
@@ -7,3 +8,4 @@ export declare function getNode(state: DataBusState, path: string[], createPath:
7
8
  node: DataBusNode;
8
9
  nodePath: DataBusNode[];
9
10
  };
11
+ //# sourceMappingURL=getNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNode.d.ts","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AAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;QACjC,QAAQ,CAAC,IAAI,CAAC,IAAmB,CAAC,CAAC;KACpC;IAED,OAAO;QACL,IAAI;QACJ,QAAQ;KACT,CAAC;AACJ,CAAC"}
1
+ {"version":3,"file":"getNode.js","sourceRoot":"","sources":["../src/getNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAqB7C,MAAM,UAAU,OAAO,CACrB,KAAmB,EACnB,IAAc,EACd,UAAoB;IAKpB,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,IAAI,IAAI,GAA4B,KAAK,CAAC,IAAI,CAAC;IAC/C,MAAM,QAAQ,GAAkB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAE7C,OAAO,IAAI,IAAI,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE;QAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAE/B,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,IAAI,UAAU,EAAE;YAC5C,IAAI,CAAC,QAAQ,KAAb,IAAI,CAAC,QAAQ,GAAK,EAAE,EAAC;YACrB,IAAI,CAAC,QAAQ,CAAC,QAAQ,CAAC,GAAG,UAAU,CAAC,QAAQ,CAAC,CAAC;SAChD;QAED,IAAI,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,CAAC;QACjC,QAAQ,CAAC,IAAI,CAAC,IAAmB,CAAC,CAAC;KACpC;IAED,OAAO;QACL,IAAI;QACJ,QAAQ;KACT,CAAC;AACJ,CAAC","sourcesContent":["import { createNode } from './createNode.js';\nimport type { DataBusNode } from './types/DataBusNode.js';\nimport type { DataBusState } from './types/DataBusState.js';\n\nexport function getNode(\n state: DataBusState,\n path: string[],\n): {\n node: DataBusNode;\n nodePath: DataBusNode[];\n};\n\nexport function getNode(\n state: DataBusState,\n path: string[],\n createPath: true,\n): {\n node: DataBusNode;\n nodePath: DataBusNode[];\n};\n\nexport function getNode(\n state: DataBusState,\n path: string[],\n createPath?: boolean,\n): {\n node: DataBusNode | undefined;\n nodePath: DataBusNode[];\n} {\n let index = 0;\n let node: DataBusNode | undefined = state.root;\n const nodePath: DataBusNode[] = [state.root];\n\n while (node && index < path.length) {\n const pathName = path[index++];\n\n if (!node.children?.[pathName] && createPath) {\n node.children ??= {};\n node.children[pathName] = createNode(pathName);\n }\n\n node = node.children?.[pathName];\n nodePath.push(node as DataBusNode);\n }\n\n return {\n node,\n nodePath,\n };\n}\n"]}
package/lib/index.d.ts CHANGED
@@ -1,2 +1,8 @@
1
1
  export { createDataBus } from './createDataBus.js';
2
- export type { DataBus, DataBusChangeFunction, DataBusNode, DataBusProvider, DataBusState, DisposeFunction, } from './types.js';
2
+ export type { DataBus } from './types/DataBus.js';
3
+ export type { DataBusChangeFunction } from './types/DataBusChangeFunction.js';
4
+ export type { DataBusNode } from './types/DataBusNode.js';
5
+ export type { DataBusProvider } from './types/DataBusProvider.js';
6
+ export type { DataBusState } from './types/DataBusState.js';
7
+ export type { DisposeFunction } from './types/DisposeFunction.js';
8
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,YAAY,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,YAAY,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC9E,YAAY,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,YAAY,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC"}
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC","sourcesContent":["export { createDataBus } from './createDataBus.js';\nexport type { DataBus } from './types/DataBus.js';\nexport type { DataBusChangeFunction } from './types/DataBusChangeFunction.js';\nexport type { DataBusNode } from './types/DataBusNode.js';\nexport type { DataBusProvider } from './types/DataBusProvider.js';\nexport type { DataBusState } from './types/DataBusState.js';\nexport type { DisposeFunction } from './types/DisposeFunction.js';\n"]}
package/lib/publish.d.ts CHANGED
@@ -1,5 +1,7 @@
1
- import type { DataBus, DataBusState } from './types.js';
1
+ import type { DataBusState } from './types/DataBusState.js';
2
+ import type { DataBus } from './types/DataBus.js';
2
3
  /**
3
4
  * Publishes data to a given dataPath/Id.
4
5
  */
5
6
  export declare function publish<TData>(state: DataBusState, bus: DataBus, path: string[], value: TData): void;
7
+ //# sourceMappingURL=publish.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"publish.d.ts","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAGlD;;GAEG;AACH,wBAAgB,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAqBpG"}
@@ -1 +1 @@
1
- {"version":3,"file":"publish.js","sourceRoot":"","sources":["../src/publish.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC;;GAEG;AACH,MAAM,UA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AQ,EAAE,GAAG,OAAO,CAAC,KAAK,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;IACtD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAc,CAAC;IAErC,qGAAqG;IACrG,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QAC7C,QAAQ,CAAC,CAAC,CAAC,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,QAAQ,EAAE,EAAE;YAC1C,MAAM,QAAQ,GAAG,QAAQ,CAAC,SAAS,EAAE,CAAC,EAAE,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAsB,CAAC;YAE3F,IAAI,QAAQ,KAAK,SAAS,EAAE;gBAC1B,KAAK,GAAG,QAAQ,CAAC;aAClB;QACH,CAAC,CAAC,CAAC;KACJ;IAED,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IAEnB,qBAAqB;IACrB,KAAK,IAAI,CAAC,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE;QAC7C,QAAQ,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,UAAU,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC,CAAC;KACrF;AACH,CAAC","sourcesContent":["import type { DataBusState } from './types/DataBusState.js';\nimport type { DataBus } from './types/DataBus.js';\nimport { getNode } from './getNode.js';\n\n/**\n * Publishes data to a given dataPath/Id.\n */\nexport function publish<TData>(state: DataBusState, bus: DataBus, path: string[], value: TData): void {\n const { node, nodePath } = getNode(state, path, true);\n const oldValue = node.value as TData;\n\n // Notify pre-publishing providers and allow them to apply transforms or publish additional metadata.\n for (let i = nodePath.length - 1; i >= 0; i--) {\n nodePath[i].providers?.forEach((provider) => {\n const newValue = provider.onPublish?.({ bus, value, oldValue, path }) as TData | undefined;\n\n if (newValue !== undefined) {\n value = newValue;\n }\n });\n }\n\n node.value = value;\n\n // Notify subscribers\n for (let i = nodePath.length - 1; i >= 0; i--) {\n nodePath[i].subscribers?.forEach((subscriber) => subscriber(value, oldValue, path));\n }\n}\n"]}
@@ -1,2 +1,6 @@
1
- import type { DataBusState, DataBusChangeFunction, DisposeFunction, DataBus } from './types.js';
1
+ import type { DataBusChangeFunction } from './types/DataBusChangeFunction.js';
2
+ import type { DisposeFunction } from './types/DisposeFunction.js';
3
+ import type { DataBusState } from './types/DataBusState.js';
4
+ import type { DataBus } from './types/DataBus.js';
2
5
  export declare function subscribe(state: DataBusState, bus: DataBus, path: string[], change: DataBusChangeFunction): DisposeFunction;
6
+ //# sourceMappingURL=subscribe.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"subscribe.d.ts","sourceRoot":"","sources":["../src/subscribe.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAC9E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAElD,wBAAgB,SAAS,CACvB,KAAK,EAAE,YAAY,EACnB,GAAG,EAAE,OAAO,EACZ,IAAI,EAAE,MAAM,EAAE,EACd,MAAM,EAAE,qBAAqB,GAC5B,eAAe,CAsDjB"}
@@ -1 +1 @@
1
- {"version":3,"file":"subscribe.js","sourceRoot":"","sources":["../src/subscribe.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAGvC,MAAM,UAAU,SAAS,CACvB,KAAmB,EACnB,GAAY,EACZ,IAAc,EACd,MAA6B;IAE7B,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,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;gBAE/D,IAAI,YAAY,EAAE;oBAChB,YAAY,CAAC,KAAK,EAAE,CAAC;oBAErB,IAAI,CAAC,YAAY,CAAC,KAAK,EAAE;wBACvB,YAAY,EAAE,QAAQ,CAAC,YAAY,EAAE,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC;wBACrD,OAAO,WAAW,CAAC,eAAe,EAAE,CAAC,UAAU,CAAC,CAAC;qBAClD;iBACF;aACF;SACF;IACH,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { getNode } from './getNode.js';\nimport type { DataBusChangeFunction } from './types/DataBusChangeFunction.js';\nimport type { DisposeFunction } from './types/DisposeFunction.js';\nimport type { DataBusState } from './types/DataBusState.js';\nimport type { DataBus } from './types/DataBus.js';\n\nexport function subscribe(\n state: DataBusState,\n bus: DataBus,\n path: string[],\n change: DataBusChangeFunction,\n): DisposeFunction {\n const { node, nodePath } = getNode(state, path, true);\n // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n const { value } = node;\n const pathString = path.join('/');\n\n node.subscribers ??= new Set<DataBusChangeFunction>();\n node.subscribers.add(change);\n\n // Fire the initial change with the value.\n if (value !== undefined) {\n change(value, value, path);\n }\n\n // Activate any deactivated providers available for this path.\n for (let index = nodePath.length - 1; index >= 0; index--) {\n const currentNode = nodePath[index];\n\n if (currentNode.providers?.length) {\n const activeProviders = (currentNode.activeProviders ??= {});\n\n currentNode.providers.forEach((provider) => {\n activeProviders[pathString] ??= { provider, count: 0 };\n\n if (activeProviders[pathString].count === 0) {\n provider.onActivate?.({ path, bus });\n }\n\n activeProviders[pathString].count++;\n });\n }\n }\n\n return () => {\n node.subscribers?.delete(change);\n\n // Deactivate providers.\n for (let index = nodePath.length - 1; index >= 0; index--) {\n const currentNode = nodePath[index];\n\n if (currentNode.providers?.length) {\n const activeRecord = currentNode.activeProviders?.[pathString];\n\n if (activeRecord) {\n activeRecord.count--;\n\n if (!activeRecord.count) {\n activeRecord?.provider.onDeactivate?.({ path, bus });\n delete currentNode.activeProviders?.[pathString];\n }\n }\n }\n }\n };\n}\n"]}
@@ -1,11 +1,11 @@
1
- // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
- // It should be published with your NPM package. It should not be tracked by Git.
3
- {
4
- "tsdocVersion": "0.12",
5
- "toolPackages": [
6
- {
7
- "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.34.0"
9
- }
10
- ]
11
- }
1
+ // This file is read by tools that parse documentation comments conforming to the TSDoc standard.
2
+ // It should be published with your NPM package. It should not be tracked by Git.
3
+ {
4
+ "tsdocVersion": "0.12",
5
+ "toolPackages": [
6
+ {
7
+ "packageName": "@microsoft/api-extractor",
8
+ "packageVersion": "7.34.8"
9
+ }
10
+ ]
11
+ }
@@ -0,0 +1,10 @@
1
+ import type { DataBusChangeFunction } from './DataBusChangeFunction.js';
2
+ import type { DisposeFunction } from './DisposeFunction.js';
3
+ import type { DataBusProvider } from './DataBusProvider.js';
4
+ export interface DataBus {
5
+ publish: <TData = any>(path: string[], value: TData) => void;
6
+ subscribe: <TData = any>(path: string[], callback: DataBusChangeFunction<TData>) => DisposeFunction;
7
+ getData: <TData = any>(path: string[]) => TData | undefined;
8
+ addProvider: (provider: DataBusProvider) => void;
9
+ }
10
+ //# sourceMappingURL=DataBus.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataBus.d.ts","sourceRoot":"","sources":["../../src/types/DataBus.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,OAAO;IAEtB,OAAO,EAAE,CAAC,KAAK,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAE7D,SAAS,EAAE,CAAC,KAAK,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,qBAAqB,CAAC,KAAK,CAAC,KAAK,eAAe,CAAC;IAEpG,OAAO,EAAE,CAAC,KAAK,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,KAAK,GAAG,SAAS,CAAC;IAC5D,WAAW,EAAE,CAAC,QAAQ,EAAE,eAAe,KAAK,IAAI,CAAC;CAClD"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DataBus.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataBus.js","sourceRoot":"","sources":["../../src/types/DataBus.ts"],"names":[],"mappings":"","sourcesContent":["import type { DataBusChangeFunction } from './DataBusChangeFunction.js';\nimport type { DisposeFunction } from './DisposeFunction.js';\nimport type { DataBusProvider } from './DataBusProvider.js';\n\nexport interface DataBus {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n publish: <TData = any>(path: string[], value: TData) => void;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n subscribe: <TData = any>(path: string[], callback: DataBusChangeFunction<TData>) => DisposeFunction;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n getData: <TData = any>(path: string[]) => TData | undefined;\n addProvider: (provider: DataBusProvider) => void;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export type DataBusChangeFunction<TData = any> = (value: TData, oldValue: TData, path: string[]) => void;
2
+ //# sourceMappingURL=DataBusChangeFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataBusChangeFunction.d.ts","sourceRoot":"","sources":["../../src/types/DataBusChangeFunction.ts"],"names":[],"mappings":"AACA,MAAM,MAAM,qBAAqB,CAAC,KAAK,GAAG,GAAG,IAAI,CAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DataBusChangeFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataBusChangeFunction.js","sourceRoot":"","sources":["../../src/types/DataBusChangeFunction.ts"],"names":[],"mappings":"","sourcesContent":["// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport type DataBusChangeFunction<TData = any> = (value: TData, oldValue: TData, path: string[]) => void;\n"]}
@@ -0,0 +1,14 @@
1
+ import type { DataBusChangeFunction } from './DataBusChangeFunction.js';
2
+ import type { DataBusProvider } from './DataBusProvider.js';
3
+ export interface DataBusNode {
4
+ name?: string;
5
+ value?: any;
6
+ providers?: DataBusProvider[];
7
+ activeProviders?: Record<string, {
8
+ provider: DataBusProvider;
9
+ count: number;
10
+ }>;
11
+ subscribers?: Set<DataBusChangeFunction>;
12
+ children?: Record<string, DataBusNode>;
13
+ }
14
+ //# sourceMappingURL=DataBusNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataBusNode.d.ts","sourceRoot":"","sources":["../../src/types/DataBusNode.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAE5D,MAAM,WAAW,WAAW;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,SAAS,CAAC,EAAE,eAAe,EAAE,CAAC;IAC9B,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,eAAe,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC/E,WAAW,CAAC,EAAE,GAAG,CAAC,qBAAqB,CAAC,CAAC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;CACxC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DataBusNode.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataBusNode.js","sourceRoot":"","sources":["../../src/types/DataBusNode.ts"],"names":[],"mappings":"","sourcesContent":["import type { DataBusChangeFunction } from './DataBusChangeFunction.js';\nimport type { DataBusProvider } from './DataBusProvider.js';\n\nexport interface DataBusNode {\n name?: string;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n value?: any;\n providers?: DataBusProvider[];\n activeProviders?: Record<string, { provider: DataBusProvider; count: number }>;\n subscribers?: Set<DataBusChangeFunction>;\n children?: Record<string, DataBusNode>;\n}\n"]}
@@ -0,0 +1,19 @@
1
+ import type { DataBus } from './DataBus.js';
2
+ export interface DataBusProvider<TData = any> {
3
+ path: string[];
4
+ onActivate?: (options: {
5
+ path: string[];
6
+ bus: DataBus;
7
+ }) => void;
8
+ onDeactivate?: (options: {
9
+ path: string[];
10
+ bus: DataBus;
11
+ }) => void;
12
+ onPublish?: (options: {
13
+ value: TData;
14
+ oldValue: TData;
15
+ path: string[];
16
+ bus: DataBus;
17
+ }) => TData | undefined;
18
+ }
19
+ //# sourceMappingURL=DataBusProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataBusProvider.d.ts","sourceRoot":"","sources":["../../src/types/DataBusProvider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAG5C,MAAM,WAAW,eAAe,CAAC,KAAK,GAAG,GAAG;IAC1C,IAAI,EAAE,MAAM,EAAE,CAAC;IAEf,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,GAAG,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IACjE,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,GAAG,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI,CAAC;IACnE,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,KAAK,CAAC;QAAC,QAAQ,EAAE,KAAK,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,CAAC;QAAC,GAAG,EAAE,OAAO,CAAA;KAAE,KAAK,KAAK,GAAG,SAAS,CAAC;CAC7G"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DataBusProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataBusProvider.js","sourceRoot":"","sources":["../../src/types/DataBusProvider.ts"],"names":[],"mappings":"","sourcesContent":["import type { DataBus } from './DataBus.js';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport interface DataBusProvider<TData = any> {\n path: string[];\n\n onActivate?: (options: { path: string[]; bus: DataBus }) => void;\n onDeactivate?: (options: { path: string[]; bus: DataBus }) => void;\n onPublish?: (options: { value: TData; oldValue: TData; path: string[]; bus: DataBus }) => TData | undefined;\n}\n"]}
@@ -0,0 +1,5 @@
1
+ import type { DataBusNode } from './DataBusNode.js';
2
+ export interface DataBusState {
3
+ root: DataBusNode;
4
+ }
5
+ //# sourceMappingURL=DataBusState.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataBusState.d.ts","sourceRoot":"","sources":["../../src/types/DataBusState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAEpD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,WAAW,CAAC;CACnB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DataBusState.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataBusState.js","sourceRoot":"","sources":["../../src/types/DataBusState.ts"],"names":[],"mappings":"","sourcesContent":["import type { DataBusNode } from './DataBusNode.js';\n\nexport interface DataBusState {\n root: DataBusNode;\n}\n"]}
@@ -0,0 +1,2 @@
1
+ export type DisposeFunction = () => void;
2
+ //# sourceMappingURL=DisposeFunction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DisposeFunction.d.ts","sourceRoot":"","sources":["../../src/types/DisposeFunction.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,MAAM,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=DisposeFunction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DisposeFunction.js","sourceRoot":"","sources":["../../src/types/DisposeFunction.ts"],"names":[],"mappings":"","sourcesContent":["export type DisposeFunction = () => void;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/data-bus",
3
- "version": "0.1.1",
3
+ "version": "0.2.1",
4
4
  "description": "A data bus implementation.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -13,7 +13,6 @@
13
13
  }
14
14
  },
15
15
  "scripts": {
16
- "api:update": "cloudpack-scripts api-update",
17
16
  "api": "cloudpack-scripts api",
18
17
  "build:watch": "cloudpack-scripts build-watch",
19
18
  "build": "cloudpack-scripts build",
@@ -24,8 +23,8 @@
24
23
  "test": "cloudpack-scripts test"
25
24
  },
26
25
  "devDependencies": {
27
- "@ms-cloudpack/scripts": "*",
28
- "@ms-cloudpack/eslint-config-base": "*"
26
+ "@ms-cloudpack/eslint-plugin-internal": "*",
27
+ "@ms-cloudpack/scripts": "*"
29
28
  },
30
29
  "files": [
31
30
  "lib/**/!(*.test.*)"
package/CHANGELOG.json DELETED
@@ -1,125 +0,0 @@
1
- {
2
- "name": "@ms-cloudpack/data-bus",
3
- "entries": [
4
- {
5
- "date": "Tue, 31 Jan 2023 08:08:54 GMT",
6
- "tag": "@ms-cloudpack/data-bus_v0.1.1",
7
- "version": "0.1.1",
8
- "comments": {
9
- "patch": [
10
- {
11
- "author": "elcraig@microsoft.com",
12
- "package": "@ms-cloudpack/data-bus",
13
- "commit": "243bfddf2ccffa5d6aa479105156b8a5de0e66c2",
14
- "comment": "Don't publish test files"
15
- }
16
- ]
17
- }
18
- },
19
- {
20
- "date": "Mon, 23 Jan 2023 21:06:01 GMT",
21
- "tag": "@ms-cloudpack/data-bus_v0.1.0",
22
- "version": "0.1.0",
23
- "comments": {
24
- "none": [
25
- {
26
- "author": "elcraig@microsoft.com",
27
- "package": "@ms-cloudpack/data-bus",
28
- "commit": "d092bb42a995e8bab968a0fdc1f35144680b73c3",
29
- "comment": "Move beachball disallowedChangeTypes setting to repo config"
30
- }
31
- ]
32
- }
33
- },
34
- {
35
- "date": "Sat, 03 Dec 2022 08:10:45 GMT",
36
- "tag": "@ms-cloudpack/data-bus_v0.1.0",
37
- "version": "0.1.0",
38
- "comments": {
39
- "none": [
40
- {
41
- "author": "dake.3601@gmail.com",
42
- "package": "@ms-cloudpack/data-bus",
43
- "commit": "9fae6cbdb788baac8236abc9eb44eb1d3296b7e0",
44
- "comment": "Updated beachball config to disallow major bumps"
45
- }
46
- ]
47
- }
48
- },
49
- {
50
- "date": "Wed, 28 Sep 2022 08:15:16 GMT",
51
- "tag": "@ms-cloudpack/data-bus_v0.1.0",
52
- "version": "0.1.0",
53
- "comments": {
54
- "none": [
55
- {
56
- "author": "elcraig@microsoft.com",
57
- "package": "@ms-cloudpack/data-bus",
58
- "commit": "084168500b6320d6861a4c7e8f363fea9e4f831e",
59
- "comment": "Fix lint issues with types"
60
- }
61
- ]
62
- }
63
- },
64
- {
65
- "date": "Fri, 12 Aug 2022 08:12:39 GMT",
66
- "tag": "@ms-cloudpack/data-bus_v0.1.0",
67
- "version": "0.1.0",
68
- "comments": {
69
- "minor": [
70
- {
71
- "author": "dzearing@microsoft.com",
72
- "package": "@ms-cloudpack/data-bus",
73
- "commit": "e733241cb555d1ae14cdfd8fe211d1d05b471e29",
74
- "comment": "Providers can now be added to the root of the data tree."
75
- }
76
- ]
77
- }
78
- },
79
- {
80
- "date": "Fri, 20 May 2022 04:26:15 GMT",
81
- "tag": "@ms-cloudpack/data-bus_v0.0.2",
82
- "version": "0.0.2",
83
- "comments": {
84
- "none": [
85
- {
86
- "author": "dzearing@microsoft.com",
87
- "package": "@ms-cloudpack/data-bus",
88
- "commit": "b39bb143fc53e622c39f9e9fd349f71c9ebadd77",
89
- "comment": "Adding api:update script."
90
- }
91
- ]
92
- }
93
- },
94
- {
95
- "date": "Sat, 14 May 2022 04:36:11 GMT",
96
- "tag": "@ms-cloudpack/data-bus_v0.0.2",
97
- "version": "0.0.2",
98
- "comments": {
99
- "none": [
100
- {
101
- "author": "dzearing@microsoft.com",
102
- "package": "@ms-cloudpack/data-bus",
103
- "commit": "cc0844a7d18790d69e59b16dbd6eef8fab5bc4e0",
104
- "comment": "Updating package details."
105
- }
106
- ]
107
- }
108
- },
109
- {
110
- "date": "Mon, 09 May 2022 18:54:56 GMT",
111
- "tag": "@ms-cloudpack/data-bus_v0.0.2",
112
- "version": "0.0.2",
113
- "comments": {
114
- "patch": [
115
- {
116
- "author": "dzearing@microsoft.com",
117
- "package": "@ms-cloudpack/data-bus",
118
- "commit": "13c322180c016e6c653d4694b9f3380adeb8ad6f",
119
- "comment": "Initial publish."
120
- }
121
- ]
122
- }
123
- }
124
- ]
125
- }
package/CHANGELOG.md DELETED
@@ -1,29 +0,0 @@
1
- # Change Log - @ms-cloudpack/data-bus
2
-
3
- This log was last generated on Tue, 31 Jan 2023 08:08:54 GMT and should not be manually modified.
4
-
5
- <!-- Start content -->
6
-
7
- ## 0.1.1
8
-
9
- Tue, 31 Jan 2023 08:08:54 GMT
10
-
11
- ### Patches
12
-
13
- - Don't publish test files (elcraig@microsoft.com)
14
-
15
- ## 0.1.0
16
-
17
- Fri, 12 Aug 2022 08:12:39 GMT
18
-
19
- ### Minor changes
20
-
21
- - Providers can now be added to the root of the data tree. (dzearing@microsoft.com)
22
-
23
- ## 0.0.2
24
-
25
- Mon, 09 May 2022 18:54:56 GMT
26
-
27
- ### Patches
28
-
29
- - Initial publish. (dzearing@microsoft.com)
package/lib/types.d.ts DELETED
@@ -1,39 +0,0 @@
1
- export type DataBusChangeFunction = <TData>(value: TData, oldValue: TData, path: string[]) => void;
2
- export type DisposeFunction = () => void;
3
- export interface DataBusProvider<TData = any> {
4
- path: string[];
5
- onActivate?: (options: {
6
- path: string[];
7
- bus: DataBus;
8
- }) => void;
9
- onDeactivate?: (options: {
10
- path: string[];
11
- bus: DataBus;
12
- }) => void;
13
- onPublish?: (options: {
14
- value: TData;
15
- oldValue: TData;
16
- path: string[];
17
- bus: DataBus;
18
- }) => TData | undefined;
19
- }
20
- export interface DataBusNode {
21
- name?: string;
22
- value?: any;
23
- providers?: DataBusProvider[];
24
- activeProviders?: Record<string, {
25
- provider: DataBusProvider;
26
- count: number;
27
- }>;
28
- subscribers?: Set<DataBusChangeFunction>;
29
- children?: Record<string, DataBusNode>;
30
- }
31
- export interface DataBusState {
32
- root: DataBusNode;
33
- }
34
- export interface DataBus {
35
- publish: (path: string[], value: any) => void;
36
- subscribe: (path: string[], callback: DataBusChangeFunction) => DisposeFunction;
37
- getData: (path: string[]) => any;
38
- addProvider: (provider: DataBusProvider) => void;
39
- }
package/lib/types.js DELETED
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=types.js.map
package/lib/types.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}