@lunora/hyperdrive 1.0.0-alpha.116 → 1.0.0-alpha.117

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.
package/dist/global.d.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DatabaseWriterLike } from '@lunora/shard-engine';
2
2
  import { SqlExec, SqlDialect, SqlCtxDbOptions } from '@lunora/sql-store';
3
- import { M as Mysql2Like, S as SqlClient } from "./packem_shared/types.d-DE1NYxyA.mjs";
3
+ import { M as Mysql2Like, S as SqlClient } from "./packem_shared/types.d-IgdRydpF.mjs";
4
4
  import { VectorMetric, VectorizeIndexLike } from '@lunora/platform';
5
5
  /**
6
6
  * Minimal row-returning client (e.g. `@lunora/hyperdrive`'s `fromPostgresJs`/`fromNodePg`
package/dist/global.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { DatabaseWriterLike } from '@lunora/shard-engine';
2
2
  import { SqlExec, SqlDialect, SqlCtxDbOptions } from '@lunora/sql-store';
3
- import { M as Mysql2Like, S as SqlClient } from "./packem_shared/types.d-DE1NYxyA.js";
3
+ import { M as Mysql2Like, S as SqlClient } from "./packem_shared/types.d-IgdRydpF.js";
4
4
  import { VectorMetric, VectorizeIndexLike } from '@lunora/platform';
5
5
  /**
6
6
  * Minimal row-returning client (e.g. `@lunora/hyperdrive`'s `fromPostgresJs`/`fromNodePg`
package/dist/index.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { H as HyperdriveLike, a as HyperdriveConnection, M as Mysql2Like, S as SqlClient, N as NodePgLike, P as PostgresJsLike } from "./packem_shared/types.d-DE1NYxyA.mjs";
1
+ import { H as HyperdriveLike, a as HyperdriveConnection, M as Mysql2Like, S as SqlClient, N as NodePgLike, P as PostgresJsLike } from "./packem_shared/types.d-IgdRydpF.mjs";
2
2
  /**
3
3
  * Surface a Cloudflare Hyperdrive binding as a connection ready to feed a
4
4
  * user-supplied SQL driver.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { H as HyperdriveLike, a as HyperdriveConnection, M as Mysql2Like, S as SqlClient, N as NodePgLike, P as PostgresJsLike } from "./packem_shared/types.d-DE1NYxyA.js";
1
+ import { H as HyperdriveLike, a as HyperdriveConnection, M as Mysql2Like, S as SqlClient, N as NodePgLike, P as PostgresJsLike } from "./packem_shared/types.d-IgdRydpF.js";
2
2
  /**
3
3
  * Surface a Cloudflare Hyperdrive binding as a connection ready to feed a
4
4
  * user-supplied SQL driver.
@@ -88,9 +88,11 @@ interface SqlClient {
88
88
  /**
89
89
  * Structural projection of a `pg` (node-postgres) `Client`/`Pool`. Only the
90
90
  * `query` method `fromNodePg` calls is required, kept structural for testing.
91
+ *
92
+ * Method syntax, not an arrow property — see {@link PostgresJsLike}.
91
93
  */
92
94
  interface NodePgLike {
93
- query: (text: string, params?: ReadonlyArray<unknown>) => Promise<{
95
+ query(this: void, text: string, params?: ReadonlyArray<unknown>): Promise<{
94
96
  rows: unknown[];
95
97
  }>;
96
98
  }
@@ -98,16 +100,38 @@ interface NodePgLike {
98
100
  * Structural projection of a `postgres` (postgres.js) tagged-template client.
99
101
  * The adapter uses the `.unsafe(text, params)` escape hatch so callers keep
100
102
  * full control of the parameter list.
103
+ *
104
+ * **`unsafe` is declared with METHOD syntax, and that is load-bearing.** Under
105
+ * `strictFunctionTypes` an arrow PROPERTY is checked contravariantly in its
106
+ * parameters, so a driver whose `unsafe` takes a MUTABLE array — which real
107
+ * postgres.js does (`parameters?: ParameterOrJSON<never>[]`) — is not assignable
108
+ * to one declared `params?: ReadonlyArray<unknown>`. As an arrow property this
109
+ * projection could therefore never accept the package it projects: every
110
+ * consumer got
111
+ * `TS2345: Argument of type 'Sql<{}>' is not assignable to parameter of type
112
+ * 'PostgresJsLike'`, and this repo's own test reached for
113
+ * `as unknown as PostgresJsLike` to get past it. Method syntax is checked
114
+ * bivariantly, which is what a structural projection of someone else's type
115
+ * needs — `readonly unknown[]` and postgres.js's mutable array relate in one
116
+ * direction, which is all bivariance asks for.
101
117
  */
102
118
  interface PostgresJsLike {
103
- unsafe: (text: string, params?: ReadonlyArray<unknown>) => Promise<unknown>;
119
+ unsafe(this: void, text: string, params?: ReadonlyArray<unknown>): Promise<unknown>;
104
120
  }
105
121
  /**
106
122
  * Structural projection of a `mysql2/promise` connection/pool. `mysql2`'s
107
123
  * `execute` resolves to a `[rows, fields]` tuple; the adapter takes the first
108
124
  * element as the rows.
125
+ *
126
+ * Method syntax, not an arrow property — see {@link PostgresJsLike} — but here
127
+ * that is necessary and NOT sufficient, so the live-driver test still casts.
128
+ * mysql2 types its second argument as a single `ExecuteValues`, a union of
129
+ * scalars, `ExecuteValues[]` and `{ [key: string]: ExecuteValues }`. Neither
130
+ * direction relates to `ReadonlyArray<unknown>`, so no variance rule can bridge
131
+ * it: closing this needs a deliberate widening of the parameter type here (and
132
+ * of what {@link SqlClient} promises), not a declaration-style change.
109
133
  */
110
134
  interface Mysql2Like {
111
- execute: (text: string, params?: ReadonlyArray<unknown>) => Promise<[unknown, unknown]>;
135
+ execute(this: void, text: string, params?: ReadonlyArray<unknown>): Promise<[unknown, unknown]>;
112
136
  }
113
137
  export { HyperdriveLike as H, Mysql2Like as M, NodePgLike as N, PostgresJsLike as P, SqlClient as S, HyperdriveConnection as a };
@@ -88,9 +88,11 @@ interface SqlClient {
88
88
  /**
89
89
  * Structural projection of a `pg` (node-postgres) `Client`/`Pool`. Only the
90
90
  * `query` method `fromNodePg` calls is required, kept structural for testing.
91
+ *
92
+ * Method syntax, not an arrow property — see {@link PostgresJsLike}.
91
93
  */
92
94
  interface NodePgLike {
93
- query: (text: string, params?: ReadonlyArray<unknown>) => Promise<{
95
+ query(this: void, text: string, params?: ReadonlyArray<unknown>): Promise<{
94
96
  rows: unknown[];
95
97
  }>;
96
98
  }
@@ -98,16 +100,38 @@ interface NodePgLike {
98
100
  * Structural projection of a `postgres` (postgres.js) tagged-template client.
99
101
  * The adapter uses the `.unsafe(text, params)` escape hatch so callers keep
100
102
  * full control of the parameter list.
103
+ *
104
+ * **`unsafe` is declared with METHOD syntax, and that is load-bearing.** Under
105
+ * `strictFunctionTypes` an arrow PROPERTY is checked contravariantly in its
106
+ * parameters, so a driver whose `unsafe` takes a MUTABLE array — which real
107
+ * postgres.js does (`parameters?: ParameterOrJSON<never>[]`) — is not assignable
108
+ * to one declared `params?: ReadonlyArray<unknown>`. As an arrow property this
109
+ * projection could therefore never accept the package it projects: every
110
+ * consumer got
111
+ * `TS2345: Argument of type 'Sql<{}>' is not assignable to parameter of type
112
+ * 'PostgresJsLike'`, and this repo's own test reached for
113
+ * `as unknown as PostgresJsLike` to get past it. Method syntax is checked
114
+ * bivariantly, which is what a structural projection of someone else's type
115
+ * needs — `readonly unknown[]` and postgres.js's mutable array relate in one
116
+ * direction, which is all bivariance asks for.
101
117
  */
102
118
  interface PostgresJsLike {
103
- unsafe: (text: string, params?: ReadonlyArray<unknown>) => Promise<unknown>;
119
+ unsafe(this: void, text: string, params?: ReadonlyArray<unknown>): Promise<unknown>;
104
120
  }
105
121
  /**
106
122
  * Structural projection of a `mysql2/promise` connection/pool. `mysql2`'s
107
123
  * `execute` resolves to a `[rows, fields]` tuple; the adapter takes the first
108
124
  * element as the rows.
125
+ *
126
+ * Method syntax, not an arrow property — see {@link PostgresJsLike} — but here
127
+ * that is necessary and NOT sufficient, so the live-driver test still casts.
128
+ * mysql2 types its second argument as a single `ExecuteValues`, a union of
129
+ * scalars, `ExecuteValues[]` and `{ [key: string]: ExecuteValues }`. Neither
130
+ * direction relates to `ReadonlyArray<unknown>`, so no variance rule can bridge
131
+ * it: closing this needs a deliberate widening of the parameter type here (and
132
+ * of what {@link SqlClient} promises), not a declaration-style change.
109
133
  */
110
134
  interface Mysql2Like {
111
- execute: (text: string, params?: ReadonlyArray<unknown>) => Promise<[unknown, unknown]>;
135
+ execute(this: void, text: string, params?: ReadonlyArray<unknown>): Promise<[unknown, unknown]>;
112
136
  }
113
137
  export { HyperdriveLike as H, Mysql2Like as M, NodePgLike as N, PostgresJsLike as P, SqlClient as S, HyperdriveConnection as a };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lunora/hyperdrive",
3
- "version": "1.0.0-alpha.116",
3
+ "version": "1.0.0-alpha.117",
4
4
  "description": "Bring-your-own Postgres/MySQL for Lunora via Cloudflare Hyperdrive: a driver-agnostic, action-only ctx.sql",
5
5
  "keywords": [
6
6
  "cloudflare",
@@ -51,9 +51,9 @@
51
51
  },
52
52
  "dependencies": {
53
53
  "@lunora/errors": "1.0.0-alpha.36",
54
- "@lunora/platform": "1.0.0-alpha.31",
55
- "@lunora/shard-engine": "1.0.0-alpha.66",
56
- "@lunora/sql-store": "1.0.0-alpha.118",
54
+ "@lunora/platform": "1.0.0-alpha.32",
55
+ "@lunora/shard-engine": "1.0.0-alpha.69",
56
+ "@lunora/sql-store": "1.0.0-alpha.120",
57
57
  "drizzle-orm": "^0.45.2"
58
58
  },
59
59
  "peerDependencies": {