@nongt/visql-core 0.0.0-stage → 0.3.1
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 +21 -0
- package/README.md +18 -2
- package/dist/calendarDate-CYlr9TvX.js +43 -0
- package/dist/core-api-BDCnbFHY.js +1056 -0
- package/dist/core.js +80 -0
- package/dist/fixtures.js +7 -0
- package/dist/issueLocation-Cw5sttQL.js +3183 -0
- package/dist/schema-z95dxLxu.js +839 -0
- package/dist/sql-import.js +1366 -0
- package/dist/types/core/ast.d.ts +154 -0
- package/dist/types/core/calendarDate.d.ts +21 -0
- package/dist/types/core/derivedTables.d.ts +98 -0
- package/dist/types/core/fanOut.d.ts +58 -0
- package/dist/types/core/functionRegistry.d.ts +117 -0
- package/dist/types/core/i18n/defaultMessages.d.ts +367 -0
- package/dist/types/core/i18n/relativeDateWords.d.ts +3 -0
- package/dist/types/core/issueLocation.d.ts +105 -0
- package/dist/types/core/limits.d.ts +17 -0
- package/dist/types/core/measures.d.ts +51 -0
- package/dist/types/core/params.d.ts +30 -0
- package/dist/types/core/pipelineFlow.d.ts +271 -0
- package/dist/types/core/queryAst.d.ts +201 -0
- package/dist/types/core/queryHelpers.d.ts +113 -0
- package/dist/types/core/queryValidation.d.ts +206 -0
- package/dist/types/core/relativeDates.d.ts +11 -0
- package/dist/types/core/resolveNames.d.ts +17 -0
- package/dist/types/core/schema.d.ts +119 -0
- package/dist/types/core/scopeQuery.d.ts +45 -0
- package/dist/types/core/sharedQueries.d.ts +66 -0
- package/dist/types/core/sqlGen.d.ts +102 -0
- package/dist/types/core/storedQuery.d.ts +43 -0
- package/dist/types/core/unionTables.d.ts +121 -0
- package/dist/types/core-api.d.ts +20 -0
- package/dist/types/fixtures.d.ts +44 -0
- package/dist/types/sql-import.d.ts +3 -0
- package/dist/types/sqlImport/context.d.ts +71 -0
- package/dist/types/sqlImport/importSql.d.ts +28 -0
- package/dist/types/sqlImport/syntax.d.ts +245 -0
- package/dist/types/sqlImport/tokenize.d.ts +26 -0
- package/package.json +41 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Chonnarong Hanyawongse
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,19 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @nongt/visql-core
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The query logic of [`@nongt/visql`](../../README.md), on its own, for a backend: no React, no DOM and **no dependencies**. Installing it brings nothing else.
|
|
4
|
+
|
|
5
|
+
| Import | What it is |
|
|
6
|
+
|---|---|
|
|
7
|
+
| `@nongt/visql-core` | The same as `@nongt/visql/core`: the query's types, `loadQuery` / `saveQuery`, `validateQuery`, `scopeQuery`, `queryParams`, `astToSql` / `astToParameterizedSql`, the code helpers. |
|
|
8
|
+
| `@nongt/visql-core/sql-import` | `importSql`: SQL someone wrote, read back into a query. |
|
|
9
|
+
| `@nongt/visql-core/fixtures` | The contract fixtures, to run in your CI. |
|
|
10
|
+
|
|
11
|
+
It's built from the same source as `@nongt/visql` and always released with the same version. Use the same version as the editor your users have, so the backend reads every query the editor writes (see the main README, *Storing a query*).
|
|
12
|
+
|
|
13
|
+
`@nongt/visql-core/core` is the same as the package itself. It exists so a backend can alias this package as `@nongt/visql` and keep `@nongt/visql/core` imports as they are:
|
|
14
|
+
|
|
15
|
+
```json
|
|
16
|
+
"dependencies": { "@nongt/visql": "npm:@nongt/visql-core@<version>" }
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
The guide for a backend is the main repository's `docs/backend-integration.md`.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
const n = (t, e = 2) => String(t).padStart(e, "0");
|
|
2
|
+
function a(t, e, s) {
|
|
3
|
+
return new Date(Date.UTC(t, e - 1, s));
|
|
4
|
+
}
|
|
5
|
+
function c(t) {
|
|
6
|
+
const [e, s, o] = [t.getUTCFullYear(), t.getUTCMonth() + 1, t.getUTCDate()];
|
|
7
|
+
return `${n(e, 4)}-${n(s)}-${n(o)}`;
|
|
8
|
+
}
|
|
9
|
+
function C(t) {
|
|
10
|
+
const e = /^(\d{4})-(\d{2})-(\d{2})$/.exec(t);
|
|
11
|
+
return e ? a(Number(e[1]), Number(e[2]), Number(e[3])) : void 0;
|
|
12
|
+
}
|
|
13
|
+
function $(t) {
|
|
14
|
+
return t.getUTCHours() === 0 && t.getUTCMinutes() === 0 && t.getUTCSeconds() === 0 && t.getUTCMilliseconds() === 0;
|
|
15
|
+
}
|
|
16
|
+
function U(t) {
|
|
17
|
+
if ($(t)) return c(t);
|
|
18
|
+
const [e, s, o] = [t.getUTCHours(), t.getUTCMinutes(), t.getUTCSeconds()], i = `${n(e)}:${n(s)}:${n(o)}`, r = t.getUTCMilliseconds();
|
|
19
|
+
return `${c(t)} ${i}${r ? `.${n(r, 3)}` : ""}`;
|
|
20
|
+
}
|
|
21
|
+
function f(t) {
|
|
22
|
+
return `${c(t)}T${n(t.getUTCHours())}:${n(t.getUTCMinutes())}`;
|
|
23
|
+
}
|
|
24
|
+
function g(t) {
|
|
25
|
+
const e = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(?::(\d{2}))?$/.exec(t);
|
|
26
|
+
if (!e) return;
|
|
27
|
+
const [s, o, i, r, u, m = 0] = e.slice(1).map((T) => Number(T ?? 0));
|
|
28
|
+
return new Date(Date.UTC(s, o - 1, i, r, u, m));
|
|
29
|
+
}
|
|
30
|
+
function D(t) {
|
|
31
|
+
const e = /^([01]\d|2[0-3]):([0-5]\d)(?::([0-5]\d))?$/.exec(t.trim());
|
|
32
|
+
return e ? `${e[1]}:${e[2]}:${e[3] ?? "00"}` : void 0;
|
|
33
|
+
}
|
|
34
|
+
export {
|
|
35
|
+
g as a,
|
|
36
|
+
$ as b,
|
|
37
|
+
a as c,
|
|
38
|
+
f as d,
|
|
39
|
+
C as f,
|
|
40
|
+
c as i,
|
|
41
|
+
U as s,
|
|
42
|
+
D as t
|
|
43
|
+
};
|