@lunora/sql-store 1.0.0-alpha.2 → 1.0.0-alpha.200
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/LICENSE.md +6 -0
- package/README.md +90 -9
- package/__assets__/package-og.svg +1 -1
- package/dist/dialect.d.mts +165 -42
- package/dist/dialect.d.ts +165 -42
- package/dist/dialect.mjs +0 -1
- package/dist/index.d.mts +371 -129
- package/dist/index.d.ts +371 -129
- package/dist/index.mjs +1 -2
- package/dist/packem_shared/SEARCH_STATE_TABLE-B6lyHKeq.mjs +1 -0
- package/dist/packem_shared/backfillSqlSearchIndexes-7INfXpdK.mjs +1 -0
- package/dist/packem_shared/createSqlCtxDb-Be29nU7z.mjs +7 -0
- package/dist/packem_shared/ctx-db-search-DB_ejfgj.mjs +1 -0
- package/dist/packem_shared/ctx-db-search-state-DRiojLLm.mjs +1 -0
- package/dist/packem_shared/decodeBigint-prUTsk6p.mjs +1 -0
- package/dist/packem_shared/decodeGlobalRow-DfK8mSDo.mjs +1 -0
- package/dist/packem_shared/runSqlAggregateMigrations-BqfzHcG8.mjs +1 -0
- package/dist/packem_shared/runSqlGlobalTableMigrations-qVa5Q8BM.mjs +1 -0
- package/dist/packem_shared/sql-exec-UH-aJj2C.mjs +1 -0
- package/dist/packem_shared/value-codec-CiS1h_97.mjs +1 -0
- package/package.json +6 -4
- package/dist/packem_shared/createSqlCtxDb-CQFYyQLP.mjs +0 -1700
- package/dist/packem_shared/sqliteEncode-Dedu92k4.mjs +0 -69
package/LICENSE.md
CHANGED
|
@@ -103,3 +103,9 @@ Unless required by applicable law or agreed to in writing, software distributed
|
|
|
103
103
|
under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR
|
|
104
104
|
CONDITIONS OF ANY KIND, either express or implied. See the License for the
|
|
105
105
|
specific language governing permissions and limitations under the License.
|
|
106
|
+
|
|
107
|
+
<!-- DEPENDENCIES -->
|
|
108
|
+
<!-- /DEPENDENCIES -->
|
|
109
|
+
|
|
110
|
+
<!-- TYPE_DEPENDENCIES -->
|
|
111
|
+
<!-- /TYPE_DEPENDENCIES -->
|
package/README.md
CHANGED
|
@@ -1,4 +1,38 @@
|
|
|
1
|
-
|
|
1
|
+
<!-- START_PACKAGE_OG_IMAGE_PLACEHOLDER -->
|
|
2
|
+
|
|
3
|
+
<a href="https://www.anolilab.com/open-source" align="center">
|
|
4
|
+
|
|
5
|
+
<img src="__assets__/package-og.svg" alt="sql-store" />
|
|
6
|
+
|
|
7
|
+
</a>
|
|
8
|
+
|
|
9
|
+
<h3 align="center">Internal dialect-parameterized SQL store core for Lunora .global() backends (D1, PlanetScale)</h3>
|
|
10
|
+
|
|
11
|
+
<!-- END_PACKAGE_OG_IMAGE_PLACEHOLDER -->
|
|
12
|
+
|
|
13
|
+
<br />
|
|
14
|
+
|
|
15
|
+
<div align="center">
|
|
16
|
+
|
|
17
|
+
[![typescript-image][typescript-badge]][typescript-url]
|
|
18
|
+
[![FSL-1.1-Apache-2.0 licence][license-badge]][license]
|
|
19
|
+
[![npm version][npm-version-badge]][npm-version]
|
|
20
|
+
[![npm downloads][npm-downloads-badge]][npm-downloads]
|
|
21
|
+
[![PRs Welcome][prs-welcome-badge]][prs-welcome]
|
|
22
|
+
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
<div align="center">
|
|
28
|
+
<p>
|
|
29
|
+
<sup>
|
|
30
|
+
Daniel Bannert's open source work is supported by the community on <a href="https://github.com/sponsors/prisis">GitHub Sponsors</a>
|
|
31
|
+
</sup>
|
|
32
|
+
</p>
|
|
33
|
+
</div>
|
|
34
|
+
|
|
35
|
+
---
|
|
2
36
|
|
|
3
37
|
**Internal.** The dialect-parameterized SQL store core shared by Lunora's
|
|
4
38
|
`.global()` table backends. One ORM implementation (`createSqlCtxDb`) drives any
|
|
@@ -11,6 +45,8 @@ SQL engine:
|
|
|
11
45
|
You do not depend on this package directly. Depend on `@lunora/d1` or
|
|
12
46
|
`@lunora/hyperdrive`, which supply the concrete dialect and wrap the core.
|
|
13
47
|
|
|
48
|
+
Part of the [Lunora](https://github.com/anolilab/lunora) framework — a type-safe, real-time backend on Cloudflare Workers + Durable Objects with a Vite-first DX.
|
|
49
|
+
|
|
14
50
|
## How it works
|
|
15
51
|
|
|
16
52
|
The core builds every statement as a composable **drizzle `SQL`** and renders it
|
|
@@ -21,12 +57,13 @@ hand-rolled rewriting.
|
|
|
21
57
|
|
|
22
58
|
The small per-engine `SqlDialect` value object carries only what drizzle can't
|
|
23
59
|
infer from a dynamic, column-per-field schema: the framework columns every
|
|
24
|
-
global table carries, column and companion-table types,
|
|
25
|
-
(
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
60
|
+
global table carries, column and companion-table types, `RETURNING` availability
|
|
61
|
+
(with an affected-rows fallback for MySQL), unique-violation detection, the MySQL index
|
|
62
|
+
key-prefix, and the system-catalog (`tableExists`) probe. The value codec is
|
|
63
|
+
**not** a dialect member — every engine stores SQLite-shaped values through the
|
|
64
|
+
core's own `sqliteEncode`/`sqliteDecode`. Full-text search is declared, not
|
|
65
|
+
probed: the dialect carries `supportsFts5`, and the core picks the FTS5 or
|
|
66
|
+
portable inverted-index layout from it.
|
|
30
67
|
|
|
31
68
|
Reactivity is engine-independent: the writer is injected as `globalDb` into
|
|
32
69
|
`createShardCtxDb`, whose `broadcast` hook drives live queries no matter which
|
|
@@ -47,8 +84,9 @@ seam from the root); consumers import everything from the root `@lunora/sql-stor
|
|
|
47
84
|
- Migration runners (each takes `(exec, schema, dialect)`, or `(exec, dialect)`
|
|
48
85
|
for CDC): `runSqlGlobalTableMigrations`, `runSqlAggregateMigrations`,
|
|
49
86
|
`runSqlRankMigrations`, `runSqlSearchMigrations`, `runSqlCdcMigration`.
|
|
50
|
-
- CDC log helpers: `readSqlCdcChanges`, `
|
|
51
|
-
|
|
87
|
+
- CDC log helpers: `readSqlCdcChanges`, `readSqlCdcChangedTables`,
|
|
88
|
+
`readSqlCdcFloor`, `sweepSqlCdcRetention`.
|
|
89
|
+
- Value codec building blocks (the core runs these on every engine):
|
|
52
90
|
`sqliteEncode`, `sqliteDecode`, `decodeBigint`, `tryJsonParse`,
|
|
53
91
|
`effectiveColumnKind`.
|
|
54
92
|
- Types: `SqlCtxDbOptions`, `SqlCtxExec`, `SqlDialect`, `SqlExec`,
|
|
@@ -57,3 +95,46 @@ seam from the root); consumers import everything from the root `@lunora/sql-stor
|
|
|
57
95
|
Writing a new engine adapter means supplying a `SqlDialect` value (see
|
|
58
96
|
[`@lunora/d1`](../d1)'s `sqliteDialect` for the reference) and an `exec` that
|
|
59
97
|
satisfies `SqlExec`/`SqlCtxExec`, then calling `createSqlCtxDb`.
|
|
98
|
+
|
|
99
|
+
## Related
|
|
100
|
+
|
|
101
|
+
- [`@lunora/d1`](https://www.npmjs.com/package/@lunora/d1) — SQLite/D1 dialect and `exec` wrapping this core.
|
|
102
|
+
- [`@lunora/hyperdrive`](https://www.npmjs.com/package/@lunora/hyperdrive) — Postgres/MySQL dialect over Cloudflare Hyperdrive.
|
|
103
|
+
- [`@lunora/do`](https://www.npmjs.com/package/@lunora/do) — the shard store whose `broadcast` hook drives live queries.
|
|
104
|
+
|
|
105
|
+
## Supported Node.js Versions
|
|
106
|
+
|
|
107
|
+
Libraries in this ecosystem make the best effort to track [Node.js' release schedule](https://github.com/nodejs/release#release-schedule).
|
|
108
|
+
Here's [a post on why we think this is important](https://medium.com/the-node-js-collection/maintainers-should-consider-following-node-js-release-schedule-ab08ed4de71a).
|
|
109
|
+
|
|
110
|
+
## Contributing
|
|
111
|
+
|
|
112
|
+
If you would like to help take a look at the [list of issues](https://github.com/anolilab/lunora/issues) and check our [Contributing](https://github.com/anolilab/lunora/blob/alpha/.github/CONTRIBUTING.md) guidelines.
|
|
113
|
+
|
|
114
|
+
> **Note:** please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.
|
|
115
|
+
|
|
116
|
+
## Credits
|
|
117
|
+
|
|
118
|
+
- [Daniel Bannert](https://github.com/prisis)
|
|
119
|
+
- [All Contributors](https://github.com/anolilab/lunora/graphs/contributors)
|
|
120
|
+
|
|
121
|
+
## Made with ❤️ at Anolilab
|
|
122
|
+
|
|
123
|
+
This is an open source project and will always remain free to use. If you think it's cool, please star it 🌟. [Anolilab](https://www.anolilab.com/open-source) is a Development and AI Studio. Contact us at [hello@anolilab.com](mailto:hello@anolilab.com) if you need any help with these technologies or just want to say hi!
|
|
124
|
+
|
|
125
|
+
## License
|
|
126
|
+
|
|
127
|
+
The Lunora sql-store package is open-sourced software licensed under the [FSL-1.1-Apache-2.0][license].
|
|
128
|
+
|
|
129
|
+
<!-- badges -->
|
|
130
|
+
|
|
131
|
+
[license-badge]: https://img.shields.io/badge/license-FSL--1.1--Apache--2.0-blue.svg?style=for-the-badge
|
|
132
|
+
[license]: https://github.com/anolilab/lunora/blob/alpha/LICENSE.md
|
|
133
|
+
[npm-version-badge]: https://img.shields.io/npm/v/@lunora/sql-store?style=for-the-badge
|
|
134
|
+
[npm-version]: https://www.npmjs.com/package/@lunora/sql-store
|
|
135
|
+
[npm-downloads-badge]: https://img.shields.io/npm/dm/@lunora/sql-store?style=for-the-badge
|
|
136
|
+
[npm-downloads]: https://www.npmjs.com/package/@lunora/sql-store
|
|
137
|
+
[prs-welcome-badge]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=for-the-badge
|
|
138
|
+
[prs-welcome]: https://github.com/anolilab/lunora/blob/alpha/.github/CONTRIBUTING.md
|
|
139
|
+
[typescript-badge]: https://img.shields.io/badge/Typescript-294E80.svg?style=for-the-badge&logo=typescript
|
|
140
|
+
[typescript-url]: https://www.typescriptlang.org/
|