anbaric-state-machine 1.25.0 → 1.26.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.
@@ -1,6 +1,5 @@
1
1
  import { Notifier } from "anbaric-tsapi";
2
2
  declare const NotifierFactory: {
3
- use(notifier: Notifier | undefined): void;
4
3
  instance(): Notifier | undefined;
5
4
  };
6
5
  export { NotifierFactory };
@@ -1 +1 @@
1
- {"version":3,"file":"NotifierFactory.d.ts","sourceRoot":"","sources":["../../src/notifications/NotifierFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAUvC,QAAA,MAAM,eAAe;IAEjB,GAAG,WAAY,QAAQ,GAAG,SAAS,GAAI,IAAI;IAI3C,QAAQ,IAAK,QAAQ,GAAG,SAAS;CAIpC,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"NotifierFactory.d.ts","sourceRoot":"","sources":["../../src/notifications/NotifierFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,eAAe,CAAC;AAQvC,QAAA,MAAM,eAAe;IAEjB,QAAQ,IAAK,QAAQ,GAAG,SAAS;CASpC,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,15 +1,17 @@
1
- /* Unlike the other factories there is no local implementation to fall back on:
2
- nothing sensible can be delivered from a laptop, so running outside a
3
- platform yields undefined and a state machine simply doesn't notify. A host
4
- that can deliver registers one during start-up, before any state machine is
5
- constructed, and every machine built afterwards picks it up. */
6
- let registered;
1
+ import { CloudNotifier } from "anbaric-impl-cloud";
2
+ /* Like the other services, the notifier is chosen by environment. There is no
3
+ local implementation - nothing can be delivered from a laptop - so with no
4
+ env a machine simply doesn't notify. Deployed, the platform sets
5
+ ANBARIC_NOTIFIER_TYPE=cloud and the app posts to the platform, which owns
6
+ delivery. */
7
7
  const NotifierFactory = {
8
- use(notifier) {
9
- registered = notifier;
10
- },
11
8
  instance() {
12
- return registered;
9
+ switch (process.env.ANBARIC_NOTIFIER_TYPE) {
10
+ case "cloud":
11
+ return new CloudNotifier();
12
+ default:
13
+ return undefined;
14
+ }
13
15
  },
14
16
  };
15
17
  export { NotifierFactory };
@@ -1 +1 @@
1
- {"version":3,"file":"NotifierFactory.js","sourceRoot":"","sources":["../../src/notifications/NotifierFactory.ts"],"names":[],"mappings":"AAEA;;;;kEAIkE;AAElE,IAAI,UAAiC,CAAC;AAEtC,MAAM,eAAe,GAAG;IAEpB,GAAG,CAAC,QAA+B;QAC/B,UAAU,GAAG,QAAQ,CAAC;IAC1B,CAAC;IAED,QAAQ;QACJ,OAAO,UAAU,CAAC;IACtB,CAAC;CAEJ,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"NotifierFactory.js","sourceRoot":"","sources":["../../src/notifications/NotifierFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,aAAa,EAAC,MAAM,oBAAoB,CAAC;AAEjD;;;;eAIe;AACf,MAAM,eAAe,GAAG;IAEpB,QAAQ;QACJ,QAAQ,OAAO,CAAC,GAAG,CAAC,qBAAqB,EAAE,CAAC;YACxC,KAAK,OAAO;gBACR,OAAO,IAAI,aAAa,EAAE,CAAC;YAC/B;gBACI,OAAO,SAAS,CAAC;QACzB,CAAC;IACL,CAAC;CAEJ,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "anbaric-state-machine",
3
- "version": "1.25.0",
3
+ "version": "1.26.0",
4
4
  "description": "This is the state machine library that one can use to add state management to an application. It will, by default, be locally runnable but can deployed to the Anbaric Cloud via the CLI",
5
5
  "license": "MIT",
6
6
  "author": "chris@anbaric.ai",
@@ -24,8 +24,8 @@
24
24
  "typescript": "^7.0.2"
25
25
  },
26
26
  "dependencies": {
27
- "anbaric-impl-cloud": "^1.25.0",
28
- "anbaric-tsapi": "^1.25.0"
27
+ "anbaric-impl-cloud": "^1.26.0",
28
+ "anbaric-tsapi": "^1.26.0"
29
29
  },
30
30
  "files": [
31
31
  "dist"