@minnowdb/core 0.6.8 → 0.7.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.
- package/README.md +3 -2
- package/dist/date-value.d.ts +5 -0
- package/dist/date-value.js +41 -0
- package/dist/engine/database.js +1085 -81
- package/dist/engine/optimizer.js +446 -18
- package/dist/engine/point-read.d.ts +4 -2
- package/dist/engine/point-read.js +16 -6
- package/dist/engine/query.d.ts +53 -1
- package/dist/engine/query.js +1160 -239
- package/dist/engine/sql-domains.d.ts +7 -1
- package/dist/engine/sql-domains.js +38 -1
- package/dist/engine/sql-functions.d.ts +11 -0
- package/dist/engine/sql-functions.js +1186 -0
- package/dist/engine/sql-semantics.d.ts +25 -4
- package/dist/engine/sql-semantics.js +134 -1
- package/dist/engine/vector.d.ts +7 -1
- package/dist/engine/vector.js +718 -124
- package/dist/plan/model.d.ts +21 -1
- package/dist/storage/types.js +44 -18
- package/package.json +1 -1
- package/postgres-feature-profile.json +15 -5
- package/sql-feature-matrix.json +277 -6
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ npm install @minnowdb/core
|
|
|
17
17
|
- A ready-made worker client with the same everyday database API.
|
|
18
18
|
- TypeScript schema declarations and metadata-only migrations, including SQL domains,
|
|
19
19
|
composite primary/foreign keys, and informational relationships.
|
|
20
|
-
-
|
|
20
|
+
- Batch and upsert write APIs, typed catalog errors, and per-column result type metadata.
|
|
21
21
|
- Pull-driven query cursors, live queries, snapshots, compaction, and configurable query memory.
|
|
22
22
|
|
|
23
23
|
Use [the PostgreSQL compatibility page](https://minnowdb.com/docs/sql/feature-matrix/) for the
|
|
@@ -27,7 +27,8 @@ workers, transactions, and API details.
|
|
|
27
27
|
The optional [Kysely dialect](https://minnowdb.com/docs/adapters/kysely/) connects Kysely's
|
|
28
28
|
PostgreSQL compiler to the engine and derives its `DB` types from the same schema declaration.
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
Minnow is 0.x: breaking changes land in minor releases, so pin exact versions and upgrade
|
|
31
|
+
`@minnowdb` packages together. See
|
|
31
32
|
[Versioning](https://minnowdb.com/docs/reference/versioning/).
|
|
32
33
|
|
|
33
34
|
## License
|
package/dist/date-value.d.ts
CHANGED
|
@@ -13,3 +13,8 @@ export declare function dateUtcMinutes(value: Date): number;
|
|
|
13
13
|
export declare function dateUtcSeconds(value: Date): number;
|
|
14
14
|
export declare function setDateUtcDate(value: Date, day: number): number;
|
|
15
15
|
export declare function setDateUtcMonth(value: Date, month: number): number;
|
|
16
|
+
/** Whole days since 1970-01-01 for an epoch-millisecond value (floored, so negatives work). */
|
|
17
|
+
export declare function epochDays(milliseconds: number): number;
|
|
18
|
+
export declare function civilFromDays(days: number): readonly [number, number, number];
|
|
19
|
+
/** Days since 1970-01-01 for a civil date; month is 0-11 as in Date.UTC. */
|
|
20
|
+
export declare function daysFromCivil(year: number, month: number, day: number): number;
|
package/dist/date-value.js
CHANGED
|
@@ -62,3 +62,44 @@ export function setDateUtcDate(value, day) {
|
|
|
62
62
|
export function setDateUtcMonth(value, month) {
|
|
63
63
|
return intrinsicDateSetUtcMonth.call(value, month);
|
|
64
64
|
}
|
|
65
|
+
const MS_PER_DAY = 86_400_000;
|
|
66
|
+
/** Whole days since 1970-01-01 for an epoch-millisecond value (floored, so negatives work). */
|
|
67
|
+
export function epochDays(milliseconds) {
|
|
68
|
+
return Math.floor(milliseconds / MS_PER_DAY);
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Proleptic Gregorian civil date for a day count since 1970-01-01, without a Date allocation
|
|
72
|
+
* (Howard Hinnant's days-to-civil algorithm). Returns [year, month (0-11), day (1-31)] in a
|
|
73
|
+
* shared scratch array: callers read it before the next call.
|
|
74
|
+
*/
|
|
75
|
+
const civilScratch = [0, 0, 0];
|
|
76
|
+
export function civilFromDays(days) {
|
|
77
|
+
const z = days + 719_468;
|
|
78
|
+
const era = Math.floor(z / 146_097);
|
|
79
|
+
const dayOfEra = z - era * 146_097;
|
|
80
|
+
const yearOfEra = (dayOfEra -
|
|
81
|
+
Math.floor(dayOfEra / 1460) +
|
|
82
|
+
Math.floor(dayOfEra / 36_524) -
|
|
83
|
+
Math.floor(dayOfEra / 146_096)) /
|
|
84
|
+
365;
|
|
85
|
+
const yoe = Math.floor(yearOfEra);
|
|
86
|
+
const dayOfYear = dayOfEra - (365 * yoe + Math.floor(yoe / 4) - Math.floor(yoe / 100));
|
|
87
|
+
const mp = Math.floor((5 * dayOfYear + 2) / 153);
|
|
88
|
+
const day = dayOfYear - Math.floor((153 * mp + 2) / 5) + 1;
|
|
89
|
+
const month = mp < 10 ? mp + 2 : mp - 10;
|
|
90
|
+
const year = yoe + era * 400 + (month <= 1 ? 1 : 0);
|
|
91
|
+
civilScratch[0] = year;
|
|
92
|
+
civilScratch[1] = month;
|
|
93
|
+
civilScratch[2] = day;
|
|
94
|
+
return civilScratch;
|
|
95
|
+
}
|
|
96
|
+
/** Days since 1970-01-01 for a civil date; month is 0-11 as in Date.UTC. */
|
|
97
|
+
export function daysFromCivil(year, month, day) {
|
|
98
|
+
const y = month <= 1 ? year - 1 : year;
|
|
99
|
+
const era = Math.floor(y / 400);
|
|
100
|
+
const yoe = y - era * 400;
|
|
101
|
+
const mp = month > 1 ? month - 2 : month + 10;
|
|
102
|
+
const dayOfYear = Math.floor((153 * mp + 2) / 5) + day - 1;
|
|
103
|
+
const dayOfEra = yoe * 365 + Math.floor(yoe / 4) - Math.floor(yoe / 100) + dayOfYear;
|
|
104
|
+
return era * 146_097 + dayOfEra - 719_468;
|
|
105
|
+
}
|