@entifix/business 0.1.1 → 0.1.2

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.
@@ -3,9 +3,8 @@ import { Context, Effect, Layer } from 'effect';
3
3
  * The queue shapes a subscriber may ask for (ADR 0030).
4
4
  *
5
5
  * Duplicated from `SubscriptionMode` in `@entifix/transactions` rather than
6
- * imported: that package sits at `entifix:transactions`, **above** this one at
7
- * `entifix:contract`, so the edge would point upward and the boundary rule fails
8
- * the build on it. The same duplication exists in `tools/slices/src/types.ts`
6
+ * imported: that package is T2, **above** this one at T1, so the edge would
7
+ * point upward and the tier rule fails the build on it. The same duplication exists in `tools/slices/src/types.ts`
9
8
  * for the same reason, and both lists are pinned by a spec.
10
9
  */
11
10
  export declare const BOUND_SUBSCRIPTION_MODES: readonly ["work", "broadcast"];
@@ -1 +1 @@
1
- {"version":3,"file":"wiring-registry.d.ts","sourceRoot":"","sources":["../../src/wiring/wiring-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAO,MAAM,QAAQ,CAAC;AAErD;;;;;;;;GAQG;AACH,eAAO,MAAM,wBAAwB,gCAAiC,CAAC;AAEvE,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E;;;;;;;;GAQG;AACH,MAAM,WAAW,iBAAiB;IAChC,+EAA+E;IAC/E,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,qBAAqB,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,cAAc;IAC7B,+EAA+E;IAC/E,QAAQ,CAAC,kBAAkB,EAAE,CAC3B,KAAK,EAAE,iBAAiB,KACrB,MAAM,CAAC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AC;IACzB,uEAAuE;IACvE,QAAQ,CAAC,aAAa,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACnE,8DAA8D;IAC9D,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,iBAAiB,EAAE,CAAC,CAAC;IACpE,yEAAyE;IACzE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC,MAAM,CAAC,SAAS,MAAM,EAAE,CAAC,CAAC;CACtD;;AAED;;;;;;GAMG;AACH,qBAAa,iBAAkB,SAAQ,sBAGpC;CAAG;AASN;;;;;;;;;GASG;AACH,eAAO,MAAM,mBAAmB,EAAE,KAAK,CAAC,KAAK,CAAC,iBAAiB,CAuB9D,CAAC"}
@@ -3,9 +3,8 @@ import { Context, Effect, Layer, Ref } from 'effect';
3
3
  * The queue shapes a subscriber may ask for (ADR 0030).
4
4
  *
5
5
  * Duplicated from `SubscriptionMode` in `@entifix/transactions` rather than
6
- * imported: that package sits at `entifix:transactions`, **above** this one at
7
- * `entifix:contract`, so the edge would point upward and the boundary rule fails
8
- * the build on it. The same duplication exists in `tools/slices/src/types.ts`
6
+ * imported: that package is T2, **above** this one at T1, so the edge would
7
+ * point upward and the tier rule fails the build on it. The same duplication exists in `tools/slices/src/types.ts`
9
8
  * for the same reason, and both lists are pinned by a spec.
10
9
  */ export const BOUND_SUBSCRIPTION_MODES = [
11
10
  'work',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/wiring/wiring-registry.ts"],"sourcesContent":["import { Context, Effect, Layer, Ref } from 'effect';\n\n/**\n * The queue shapes a subscriber may ask for (ADR 0030).\n *\n * Duplicated from `SubscriptionMode` in `@entifix/transactions` rather than\n * imported: that package sits at `entifix:transactions`, **above** this one at\n * `entifix:contract`, so the edge would point upward and the boundary rule fails\n * the build on it. The same duplication exists in `tools/slices/src/types.ts`\n * for the same reason, and both lists are pinned by a spec.\n */\nexport const BOUND_SUBSCRIPTION_MODES = ['work', 'broadcast'] as const;\n\nexport type BoundSubscriptionMode = (typeof BOUND_SUBSCRIPTION_MODES)[number];\n\n/**\n * One subscription a running process **actually bound**, recorded by the bus\n * adapter as `subscribe` runs.\n *\n * Observed rather than declared, which is the whole point: a document generated\n * from `tools/slices/` would agree with `tools/slices/` by construction and\n * catch nothing (ADR 0031). `queue` is the broker's own name for it, so someone\n * looking at depth in the management UI can match the two up.\n */\nexport interface BoundSubscription {\n /** The **subscribing** slice — never the emitter. See `Subscription.slice`. */\n readonly slice: string;\n readonly pattern: string;\n readonly mode: BoundSubscriptionMode;\n readonly queue: string;\n}\n\n/**\n * What a process did with its bus, as opposed to what it can still reach.\n *\n * A sibling of `HealthRegistry` rather than part of it: a subscription is not a\n * readiness fact — a bound queue says nothing about whether the broker is\n * answering right now — and folding the two together would put entries in the\n * readiness response that no probe can check.\n *\n * Both halves are cumulative and never cleared. `published` is a set of event\n * **names** and nothing else: no payloads, no counts, no timestamps. Counts\n * would be per-replica and un-alertable, which is the telemetry path ADR 0001\n * already chose OTLP for.\n */\nexport interface WiringRegistry {\n /** Called by the bus adapter once per binding, including after a reconnect. */\n readonly recordSubscription: (\n bound: BoundSubscription,\n ) => Effect.Effect<void>;\n /** Called by the bus adapter on every publish. Idempotent per name. */\n readonly recordPublish: (eventName: string) => Effect.Effect<void>;\n /** Every distinct binding, in the order it was first made. */\n readonly subscriptions: Effect.Effect<readonly BoundSubscription[]>;\n /** Every distinct event name emitted since boot, in first-seen order. */\n readonly published: Effect.Effect<readonly string[]>;\n}\n\n/**\n * DI tag for the wiring registry.\n *\n * It lives here, in the contract layer, so `@entifix/amqp` can record\n * into it without depending on a shell — the same placement, and the same\n * reason, as {@link HealthRegistryTag}.\n */\nexport class WiringRegistryTag extends Context.Tag('WiringRegistryTag')<\n WiringRegistryTag,\n WiringRegistry\n>() {}\n\n/** Whether two bindings are the same binding. */\nconst same = (a: BoundSubscription, b: BoundSubscription): boolean =>\n a.slice === b.slice &&\n a.pattern === b.pattern &&\n a.mode === b.mode &&\n a.queue === b.queue;\n\n/**\n * Live registry over a `Ref`. Provide it **once** per service and share the\n * instance (`Layer.provideMerge`), or the bus records into a registry the\n * description route never reads.\n *\n * Both recorders deduplicate. A reconnect re-runs every consumer's setup\n * against the new channel (`AmqpConnector.addConsumer`), so without it a broker\n * restart would list the same binding twice; and a publisher emits the same\n * event name continuously, so without it the list would grow without bound.\n */\nexport const WiringRegistryLayer: Layer.Layer<WiringRegistryTag> = Layer.effect(\n WiringRegistryTag,\n Effect.gen(function* () {\n const subscriptions = yield* Ref.make<readonly BoundSubscription[]>([]);\n const published = yield* Ref.make<readonly string[]>([]);\n\n return {\n recordSubscription: bound =>\n Ref.update(subscriptions, current =>\n current.some(existing => same(existing, bound))\n ? current\n : [...current, bound],\n ),\n\n recordPublish: eventName =>\n Ref.update(published, current =>\n current.includes(eventName) ? current : [...current, eventName],\n ),\n\n subscriptions: Ref.get(subscriptions),\n published: Ref.get(published),\n };\n }),\n);\n"],"names":["Context","Effect","Layer","Ref","BOUND_SUBSCRIPTION_MODES","WiringRegistryTag","Tag","same","a","b","slice","pattern","mode","queue","WiringRegistryLayer","effect","gen","subscriptions","make","published","recordSubscription","bound","update","current","some","existing","recordPublish","eventName","includes","get"],"mappings":"AAAA,SAASA,OAAO,EAAEC,MAAM,EAAEC,KAAK,EAAEC,GAAG,QAAQ,SAAS;AAErD;;;;;;;;CAQC,GACD,OAAO,MAAMC,2BAA2B;IAAC;IAAQ;CAAY,CAAU;AA+CvE;;;;;;CAMC,GACD,OAAO,MAAMC,0BAA0BL,QAAQM,GAAG,CAAC;AAG9C;AAEL,+CAA+C,GAC/C,MAAMC,OAAO,CAACC,GAAsBC,IAClCD,EAAEE,KAAK,KAAKD,EAAEC,KAAK,IACnBF,EAAEG,OAAO,KAAKF,EAAEE,OAAO,IACvBH,EAAEI,IAAI,KAAKH,EAAEG,IAAI,IACjBJ,EAAEK,KAAK,KAAKJ,EAAEI,KAAK;AAErB;;;;;;;;;CASC,GACD,OAAO,MAAMC,sBAAsDZ,MAAMa,MAAM,CAC7EV,mBACAJ,OAAOe,GAAG,CAAC;IACT,MAAMC,gBAAgB,OAAOd,IAAIe,IAAI,CAA+B,EAAE;IACtE,MAAMC,YAAY,OAAOhB,IAAIe,IAAI,CAAoB,EAAE;IAEvD,OAAO;QACLE,oBAAoBC,CAAAA,QAClBlB,IAAImB,MAAM,CAACL,eAAeM,CAAAA,UACxBA,QAAQC,IAAI,CAACC,CAAAA,WAAYlB,KAAKkB,UAAUJ,UACpCE,UACA;uBAAIA;oBAASF;iBAAM;QAG3BK,eAAeC,CAAAA,YACbxB,IAAImB,MAAM,CAACH,WAAWI,CAAAA,UACpBA,QAAQK,QAAQ,CAACD,aAAaJ,UAAU;uBAAIA;oBAASI;iBAAU;QAGnEV,eAAed,IAAI0B,GAAG,CAACZ;QACvBE,WAAWhB,IAAI0B,GAAG,CAACV;IACrB;AACF,IACA"}
1
+ {"version":3,"sources":["../../src/wiring/wiring-registry.ts"],"sourcesContent":["import { Context, Effect, Layer, Ref } from 'effect';\n\n/**\n * The queue shapes a subscriber may ask for (ADR 0030).\n *\n * Duplicated from `SubscriptionMode` in `@entifix/transactions` rather than\n * imported: that package is T2, **above** this one at T1, so the edge would\n * point upward and the tier rule fails the build on it. The same duplication exists in `tools/slices/src/types.ts`\n * for the same reason, and both lists are pinned by a spec.\n */\nexport const BOUND_SUBSCRIPTION_MODES = ['work', 'broadcast'] as const;\n\nexport type BoundSubscriptionMode = (typeof BOUND_SUBSCRIPTION_MODES)[number];\n\n/**\n * One subscription a running process **actually bound**, recorded by the bus\n * adapter as `subscribe` runs.\n *\n * Observed rather than declared, which is the whole point: a document generated\n * from `tools/slices/` would agree with `tools/slices/` by construction and\n * catch nothing (ADR 0031). `queue` is the broker's own name for it, so someone\n * looking at depth in the management UI can match the two up.\n */\nexport interface BoundSubscription {\n /** The **subscribing** slice — never the emitter. See `Subscription.slice`. */\n readonly slice: string;\n readonly pattern: string;\n readonly mode: BoundSubscriptionMode;\n readonly queue: string;\n}\n\n/**\n * What a process did with its bus, as opposed to what it can still reach.\n *\n * A sibling of `HealthRegistry` rather than part of it: a subscription is not a\n * readiness fact — a bound queue says nothing about whether the broker is\n * answering right now — and folding the two together would put entries in the\n * readiness response that no probe can check.\n *\n * Both halves are cumulative and never cleared. `published` is a set of event\n * **names** and nothing else: no payloads, no counts, no timestamps. Counts\n * would be per-replica and un-alertable, which is the telemetry path ADR 0001\n * already chose OTLP for.\n */\nexport interface WiringRegistry {\n /** Called by the bus adapter once per binding, including after a reconnect. */\n readonly recordSubscription: (\n bound: BoundSubscription,\n ) => Effect.Effect<void>;\n /** Called by the bus adapter on every publish. Idempotent per name. */\n readonly recordPublish: (eventName: string) => Effect.Effect<void>;\n /** Every distinct binding, in the order it was first made. */\n readonly subscriptions: Effect.Effect<readonly BoundSubscription[]>;\n /** Every distinct event name emitted since boot, in first-seen order. */\n readonly published: Effect.Effect<readonly string[]>;\n}\n\n/**\n * DI tag for the wiring registry.\n *\n * It lives here, in the contract layer, so `@entifix/amqp` can record\n * into it without depending on a shell — the same placement, and the same\n * reason, as {@link HealthRegistryTag}.\n */\nexport class WiringRegistryTag extends Context.Tag('WiringRegistryTag')<\n WiringRegistryTag,\n WiringRegistry\n>() {}\n\n/** Whether two bindings are the same binding. */\nconst same = (a: BoundSubscription, b: BoundSubscription): boolean =>\n a.slice === b.slice &&\n a.pattern === b.pattern &&\n a.mode === b.mode &&\n a.queue === b.queue;\n\n/**\n * Live registry over a `Ref`. Provide it **once** per service and share the\n * instance (`Layer.provideMerge`), or the bus records into a registry the\n * description route never reads.\n *\n * Both recorders deduplicate. A reconnect re-runs every consumer's setup\n * against the new channel (`AmqpConnector.addConsumer`), so without it a broker\n * restart would list the same binding twice; and a publisher emits the same\n * event name continuously, so without it the list would grow without bound.\n */\nexport const WiringRegistryLayer: Layer.Layer<WiringRegistryTag> = Layer.effect(\n WiringRegistryTag,\n Effect.gen(function* () {\n const subscriptions = yield* Ref.make<readonly BoundSubscription[]>([]);\n const published = yield* Ref.make<readonly string[]>([]);\n\n return {\n recordSubscription: bound =>\n Ref.update(subscriptions, current =>\n current.some(existing => same(existing, bound))\n ? current\n : [...current, bound],\n ),\n\n recordPublish: eventName =>\n Ref.update(published, current =>\n current.includes(eventName) ? current : [...current, eventName],\n ),\n\n subscriptions: Ref.get(subscriptions),\n published: Ref.get(published),\n };\n }),\n);\n"],"names":["Context","Effect","Layer","Ref","BOUND_SUBSCRIPTION_MODES","WiringRegistryTag","Tag","same","a","b","slice","pattern","mode","queue","WiringRegistryLayer","effect","gen","subscriptions","make","published","recordSubscription","bound","update","current","some","existing","recordPublish","eventName","includes","get"],"mappings":"AAAA,SAASA,OAAO,EAAEC,MAAM,EAAEC,KAAK,EAAEC,GAAG,QAAQ,SAAS;AAErD;;;;;;;CAOC,GACD,OAAO,MAAMC,2BAA2B;IAAC;IAAQ;CAAY,CAAU;AA+CvE;;;;;;CAMC,GACD,OAAO,MAAMC,0BAA0BL,QAAQM,GAAG,CAAC;AAG9C;AAEL,+CAA+C,GAC/C,MAAMC,OAAO,CAACC,GAAsBC,IAClCD,EAAEE,KAAK,KAAKD,EAAEC,KAAK,IACnBF,EAAEG,OAAO,KAAKF,EAAEE,OAAO,IACvBH,EAAEI,IAAI,KAAKH,EAAEG,IAAI,IACjBJ,EAAEK,KAAK,KAAKJ,EAAEI,KAAK;AAErB;;;;;;;;;CASC,GACD,OAAO,MAAMC,sBAAsDZ,MAAMa,MAAM,CAC7EV,mBACAJ,OAAOe,GAAG,CAAC;IACT,MAAMC,gBAAgB,OAAOd,IAAIe,IAAI,CAA+B,EAAE;IACtE,MAAMC,YAAY,OAAOhB,IAAIe,IAAI,CAAoB,EAAE;IAEvD,OAAO;QACLE,oBAAoBC,CAAAA,QAClBlB,IAAImB,MAAM,CAACL,eAAeM,CAAAA,UACxBA,QAAQC,IAAI,CAACC,CAAAA,WAAYlB,KAAKkB,UAAUJ,UACpCE,UACA;uBAAIA;oBAASF;iBAAM;QAG3BK,eAAeC,CAAAA,YACbxB,IAAImB,MAAM,CAACH,WAAWI,CAAAA,UACpBA,QAAQK,QAAQ,CAACD,aAAaJ,UAAU;uBAAIA;oBAASI;iBAAU;QAGnEV,eAAed,IAAI0B,GAAG,CAACZ;QACvBE,WAAWhB,IAAI0B,GAAG,CAACV;IACrB;AACF,IACA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entifix/business",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
4
4
  "description": "The ports every adapter implements — repository, session, token, health — and the generic get, load, save and delete use-cases.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -31,9 +31,6 @@
31
31
  ],
32
32
  "nx": {
33
33
  "tags": [
34
- "layer:entifix",
35
- "scope:shared",
36
- "entifix:contract",
37
34
  "tier:1"
38
35
  ],
39
36
  "sourceRoot": "packages/ts/business/src",
@@ -55,7 +52,7 @@
55
52
  },
56
53
  "dependencies": {
57
54
  "@swc/helpers": "0.5.23",
58
- "@entifix/core": "0.1.1"
55
+ "@entifix/core": "0.1.2"
59
56
  },
60
57
  "peerDependencies": {
61
58
  "effect": ">=3.22 <4"