@entifix/sql 0.5.0 → 0.6.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.
@@ -18,7 +18,7 @@ export declare const SQL_PROBE_NAME = "postgres";
18
18
  *
19
19
  * `stores` names the Stores this connection backs, by their register name in
20
20
  * `tools/slices/`. See {@link MongoHealthProbeLayer} for why it is the
21
- * composition root's to supply and why it is a list (ADR 0031).
21
+ * composition root's to supply and why it is a list.
22
22
  */
23
23
  export declare const SqlHealthProbeLayer: (stores: readonly string[]) => Layer.Layer<never, never, SqlClient.SqlClient | HealthRegistryTag>;
24
24
  //# sourceMappingURL=sql-health-probe.d.ts.map
@@ -17,7 +17,7 @@ import { SqlClient } from 'effect/sql';
17
17
  *
18
18
  * `stores` names the Stores this connection backs, by their register name in
19
19
  * `tools/slices/`. See {@link MongoHealthProbeLayer} for why it is the
20
- * composition root's to supply and why it is a list (ADR 0031).
20
+ * composition root's to supply and why it is a list.
21
21
  */ export const SqlHealthProbeLayer = (stores)=>Layer.effectDiscard(Effect.gen(function*() {
22
22
  const sql = yield* SqlClient.SqlClient;
23
23
  const registry = yield* HealthRegistryTag;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/sql-database/sql-health-probe.ts"],"sourcesContent":["import { HealthRegistryTag } from '@entifix/business';\nimport { Effect, Layer } from 'effect';\nimport { SqlClient } from 'effect/sql';\n\n/** Probe name reported by `/api/health/ready` when the database is unreachable. */\nexport const SQL_PROBE_NAME = 'postgres';\n\n/**\n * Registers a readiness probe for the connected SQL database.\n *\n * `SELECT 1` rather than \"is the pool object there\": a connection pool survives\n * a database that has gone away, so only a query that crosses the wire can tell\n * the two apart. For config-service in particular, being reachable while unable\n * to read its table is precisely the state the rest of the fleet needs to hear\n * about — every service resolves its settings from there.\n *\n * Merge it beside the client layer in a service's `AppLayer` and readiness starts\n * reporting the database, with nothing in the service describing the probe — so\n * it cannot drift from the dependency it describes.\n *\n * `stores` names the Stores this connection backs, by their register name in\n * `tools/slices/`. See {@link MongoHealthProbeLayer} for why it is the\n * composition root's to supply and why it is a list (ADR 0031).\n */\nexport const SqlHealthProbeLayer = (\n stores: readonly string[],\n): Layer.Layer<never, never, SqlClient.SqlClient | HealthRegistryTag> =>\n Layer.effectDiscard(\n Effect.gen(function* () {\n const sql = yield* SqlClient.SqlClient;\n const registry = yield* HealthRegistryTag;\n\n yield* registry.register({\n name: SQL_PROBE_NAME,\n kind: 'datastore',\n targets: stores,\n check: sql`SELECT 1`.pipe(\n Effect.as(true),\n // Unreachable is a `false`, never a failed endpoint.\n Effect.catch(() => Effect.succeed(false)),\n ),\n });\n }),\n );\n"],"names":["HealthRegistryTag","Effect","Layer","SqlClient","SQL_PROBE_NAME","SqlHealthProbeLayer","stores","effectDiscard","gen","sql","registry","register","name","kind","targets","check","pipe","as","catch","succeed"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,MAAM,EAAEC,KAAK,QAAQ,SAAS;AACvC,SAASC,SAAS,QAAQ,aAAa;AAEvC,iFAAiF,GACjF,OAAO,MAAMC,iBAAiB,WAAW;AAEzC;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMC,sBAAsB,CACjCC,SAEAJ,MAAMK,aAAa,CACjBN,OAAOO,GAAG,CAAC;QACT,MAAMC,MAAM,OAAON,UAAUA,SAAS;QACtC,MAAMO,WAAW,OAAOV;QAExB,OAAOU,SAASC,QAAQ,CAAC;YACvBC,MAAMR;YACNS,MAAM;YACNC,SAASR;YACTS,OAAON,GAAG,CAAC,QAAQ,CAAC,CAACO,IAAI,CACvBf,OAAOgB,EAAE,CAAC,OACV,qDAAqD;YACrDhB,OAAOiB,KAAK,CAAC,IAAMjB,OAAOkB,OAAO,CAAC;QAEtC;IACF,IACA"}
1
+ {"version":3,"sources":["../../src/sql-database/sql-health-probe.ts"],"sourcesContent":["import { HealthRegistryTag } from '@entifix/business';\nimport { Effect, Layer } from 'effect';\nimport { SqlClient } from 'effect/sql';\n\n/** Probe name reported by `/api/health/ready` when the database is unreachable. */\nexport const SQL_PROBE_NAME = 'postgres';\n\n/**\n * Registers a readiness probe for the connected SQL database.\n *\n * `SELECT 1` rather than \"is the pool object there\": a connection pool survives\n * a database that has gone away, so only a query that crosses the wire can tell\n * the two apart. For config-service in particular, being reachable while unable\n * to read its table is precisely the state the rest of the fleet needs to hear\n * about — every service resolves its settings from there.\n *\n * Merge it beside the client layer in a service's `AppLayer` and readiness starts\n * reporting the database, with nothing in the service describing the probe — so\n * it cannot drift from the dependency it describes.\n *\n * `stores` names the Stores this connection backs, by their register name in\n * `tools/slices/`. See {@link MongoHealthProbeLayer} for why it is the\n * composition root's to supply and why it is a list.\n */\nexport const SqlHealthProbeLayer = (\n stores: readonly string[],\n): Layer.Layer<never, never, SqlClient.SqlClient | HealthRegistryTag> =>\n Layer.effectDiscard(\n Effect.gen(function* () {\n const sql = yield* SqlClient.SqlClient;\n const registry = yield* HealthRegistryTag;\n\n yield* registry.register({\n name: SQL_PROBE_NAME,\n kind: 'datastore',\n targets: stores,\n check: sql`SELECT 1`.pipe(\n Effect.as(true),\n // Unreachable is a `false`, never a failed endpoint.\n Effect.catch(() => Effect.succeed(false)),\n ),\n });\n }),\n );\n"],"names":["HealthRegistryTag","Effect","Layer","SqlClient","SQL_PROBE_NAME","SqlHealthProbeLayer","stores","effectDiscard","gen","sql","registry","register","name","kind","targets","check","pipe","as","catch","succeed"],"mappings":"AAAA,SAASA,iBAAiB,QAAQ,oBAAoB;AACtD,SAASC,MAAM,EAAEC,KAAK,QAAQ,SAAS;AACvC,SAASC,SAAS,QAAQ,aAAa;AAEvC,iFAAiF,GACjF,OAAO,MAAMC,iBAAiB,WAAW;AAEzC;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMC,sBAAsB,CACjCC,SAEAJ,MAAMK,aAAa,CACjBN,OAAOO,GAAG,CAAC;QACT,MAAMC,MAAM,OAAON,UAAUA,SAAS;QACtC,MAAMO,WAAW,OAAOV;QAExB,OAAOU,SAASC,QAAQ,CAAC;YACvBC,MAAMR;YACNS,MAAM;YACNC,SAASR;YACTS,OAAON,GAAG,CAAC,QAAQ,CAAC,CAACO,IAAI,CACvBf,OAAOgB,EAAE,CAAC,OACV,qDAAqD;YACrDhB,OAAOiB,KAAK,CAAC,IAAMjB,OAAOkB,OAAO,CAAC;QAEtC;IACF,IACA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@entifix/sql",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "SQL adapter over @effect/sql: an entity repository with RSQL filter and sort translation, and a health probe.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -51,12 +51,12 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@swc/helpers": "0.5.23",
54
- "@entifix/business": "0.5.0",
55
- "@entifix/core": "0.5.0"
54
+ "@entifix/core": "0.6.0",
55
+ "@entifix/business": "0.6.0"
56
56
  },
57
57
  "devDependencies": {
58
58
  "effect": "4.0.5",
59
- "@entifix/testing-unit": "0.5.0"
59
+ "@entifix/testing-unit": "0.6.0"
60
60
  },
61
61
  "peerDependencies": {
62
62
  "effect": "^4.0.5"