bigal 16.0.0-beta.2 → 16.0.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/.devcontainer/devcontainer.json +1 -1
- package/.vite-hooks/pre-commit +1 -0
- package/CHANGELOG.md +28 -8
- package/CLAUDE.md +4 -4
- package/README.md +29 -43
- package/dist/index.cjs +3275 -4259
- package/dist/index.d.cts +1511 -1424
- package/dist/index.d.mts +1511 -1424
- package/dist/index.mjs +3265 -4225
- package/docs/.vitepress/config.ts +0 -1
- package/docs/advanced/bigal-vs-raw-sql.md +23 -23
- package/docs/advanced/known-issues.md +26 -21
- package/docs/getting-started.md +35 -29
- package/docs/guide/crud-operations.md +42 -61
- package/docs/guide/models.md +97 -396
- package/docs/guide/querying.md +82 -83
- package/docs/guide/relationships.md +125 -90
- package/docs/guide/subqueries-and-joins.md +39 -32
- package/docs/guide/views.md +51 -79
- package/docs/index.md +31 -27
- package/docs/package.json +3 -2
- package/docs/pnpm-lock.yaml +2338 -0
- package/docs/pnpm-workspace.yaml +3 -0
- package/docs/reference/api.md +86 -384
- package/docs/reference/configuration.md +26 -113
- package/package.json +59 -73
- package/pnpm-workspace.yaml +14 -0
- package/release.config.mjs +1 -1
- package/skills/using-bigal/SKILL.md +213 -276
- package/vite.config.ts +83 -0
- package/.husky/pre-commit +0 -4
- package/.oxfmtrc.json +0 -38
- package/.oxlintrc.json +0 -219
- package/dist/index.d.ts +0 -1526
- package/docs/guide/migration-v16.md +0 -594
- package/docs/package-lock.json +0 -3753
- package/scripts/migrate-v16.ts +0 -497
- package/skills/upgrade-v16/SKILL.md +0 -244
package/vite.config.ts
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { oxlintConfig } from 'eslint-config-decent/oxlint';
|
|
2
|
+
import { type UserConfig } from 'vite';
|
|
3
|
+
import { defineConfig } from 'vite-plus';
|
|
4
|
+
|
|
5
|
+
type LintConfig = ReturnType<typeof oxlintConfig>;
|
|
6
|
+
type LintRules = NonNullable<LintConfig['rules']>;
|
|
7
|
+
|
|
8
|
+
const baseLintConfig: LintConfig = oxlintConfig({ enableReact: false, enableTestingLibrary: false, enableVitest: true });
|
|
9
|
+
|
|
10
|
+
// These compat plugins import @typescript-eslint/typescript-estree, which cannot
|
|
11
|
+
// load alongside typescript 7 (it supports typescript <6.1 only). Drop them and
|
|
12
|
+
// their rules (member-ordering, explicit-member-accessibility, and a few vitest
|
|
13
|
+
// padding/style rules) until typescript-eslint supports typescript 7.
|
|
14
|
+
const estreeDependentPlugins = new Set(['@typescript-eslint/eslint-plugin', '@vitest/eslint-plugin']);
|
|
15
|
+
const estreeDependentRulePrefixes = ['typescript-compat/', 'vitest-compat/'];
|
|
16
|
+
|
|
17
|
+
function withoutEstreeDependentRules(rules: LintRules | undefined): LintRules {
|
|
18
|
+
return Object.fromEntries(Object.entries(rules ?? {}).filter(([ruleName]) => !estreeDependentRulePrefixes.some((prefix) => ruleName.startsWith(prefix))));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const config: UserConfig = defineConfig({
|
|
22
|
+
fmt: {
|
|
23
|
+
printWidth: 200,
|
|
24
|
+
singleQuote: true,
|
|
25
|
+
},
|
|
26
|
+
lint: {
|
|
27
|
+
...baseLintConfig,
|
|
28
|
+
jsPlugins: (baseLintConfig.jsPlugins ?? []).filter((plugin) => !estreeDependentPlugins.has(typeof plugin === 'string' ? plugin : plugin.specifier)),
|
|
29
|
+
rules: {
|
|
30
|
+
...withoutEstreeDependentRules(baseLintConfig.rules),
|
|
31
|
+
// The base exceptions plus uppercase letters: single-letter generic type
|
|
32
|
+
// parameters (T, K, P, U, ...) are house style for the query builder API.
|
|
33
|
+
'eslint/id-length': [
|
|
34
|
+
'error',
|
|
35
|
+
{
|
|
36
|
+
exceptions: ['_', '$', 'e', 'i', 'j', 'k', 'q', 't', 'x', 'y', 'A', 'D', 'K', 'P', 'T', 'U'],
|
|
37
|
+
},
|
|
38
|
+
],
|
|
39
|
+
// Helper functions are commonly declared below their first use.
|
|
40
|
+
'eslint/no-use-before-define': ['error', { functions: false, classes: true, variables: true }],
|
|
41
|
+
// Repositories return custom thenables so query chains can be awaited
|
|
42
|
+
// directly; `void` appears deliberately in their resolve unions and in
|
|
43
|
+
// the NotEntityBrand marker type.
|
|
44
|
+
'unicorn/no-thenable': 'off',
|
|
45
|
+
'typescript/no-invalid-void-type': 'off',
|
|
46
|
+
// Every switch in this codebase handles the remaining union members in a
|
|
47
|
+
// default clause; treat that as exhaustive.
|
|
48
|
+
'typescript/switch-exhaustiveness-check': ['error', { considerDefaultExhaustiveForUnions: true }],
|
|
49
|
+
},
|
|
50
|
+
overrides: [
|
|
51
|
+
...(baseLintConfig.overrides ?? [])
|
|
52
|
+
.map((override) => ({
|
|
53
|
+
...override,
|
|
54
|
+
rules: withoutEstreeDependentRules(override.rules),
|
|
55
|
+
}))
|
|
56
|
+
.filter((override) => Object.keys(override.rules).length > 0 || override.jsPlugins),
|
|
57
|
+
{
|
|
58
|
+
// Type-level assertion helpers need single-use generic parameters, and
|
|
59
|
+
// Promise.all() over a single query deliberately exercises the
|
|
60
|
+
// PromiseLike query implementation.
|
|
61
|
+
files: ['**/*.test.ts'],
|
|
62
|
+
rules: {
|
|
63
|
+
'eslint/id-length': 'off',
|
|
64
|
+
'typescript/no-unnecessary-type-parameters': 'off',
|
|
65
|
+
'unicorn/no-single-promise-in-promise-methods': 'off',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
],
|
|
69
|
+
ignorePatterns: [...(baseLintConfig.ignorePatterns ?? []), '.agents/**', '.claude/skills/**', 'docs/**'],
|
|
70
|
+
},
|
|
71
|
+
pack: {
|
|
72
|
+
entry: ['src/index.ts'],
|
|
73
|
+
format: ['esm', 'cjs'],
|
|
74
|
+
dts: { oxc: true },
|
|
75
|
+
},
|
|
76
|
+
staged: {
|
|
77
|
+
'*.md': ['vp fmt', 'markdownlint --config=.github/linters/.markdown-lint.yml --fix'],
|
|
78
|
+
'*.{js,cjs,mjs,ts}': ['vp fmt', 'vp lint --fix'],
|
|
79
|
+
'*.{json5,yml}': ['vp fmt'],
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export default config;
|
package/.husky/pre-commit
DELETED
package/.oxfmtrc.json
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/nicolo-ribaudo/oxc/oxfmt-config-schema/npm/oxfmt/configuration_schema.json",
|
|
3
|
-
"printWidth": 200,
|
|
4
|
-
"semi": true,
|
|
5
|
-
"singleQuote": true,
|
|
6
|
-
"bracketSpacing": true,
|
|
7
|
-
"arrowParens": "always",
|
|
8
|
-
"quoteProps": "as-needed",
|
|
9
|
-
"trailingComma": "all",
|
|
10
|
-
"useTabs": false,
|
|
11
|
-
"tabWidth": 2,
|
|
12
|
-
"endOfLine": "lf",
|
|
13
|
-
"arrayWrap": { "minElementsToWrap": 3 },
|
|
14
|
-
"sortImports": {
|
|
15
|
-
"newlinesBetween": true,
|
|
16
|
-
"customGroups": [
|
|
17
|
-
{
|
|
18
|
-
"groupName": "path-alias",
|
|
19
|
-
"elementNamePattern": ["@/**"]
|
|
20
|
-
}
|
|
21
|
-
],
|
|
22
|
-
"groups": [
|
|
23
|
-
["value-builtin", "type-builtin"],
|
|
24
|
-
{ "newlinesBetween": true },
|
|
25
|
-
["value-external", "type-external"],
|
|
26
|
-
{ "newlinesBetween": true },
|
|
27
|
-
["value-internal", "type-internal"],
|
|
28
|
-
{ "newlinesBetween": true },
|
|
29
|
-
["value-parent", "type-parent"],
|
|
30
|
-
{ "newlinesBetween": true },
|
|
31
|
-
["value-sibling", "type-sibling", "value-index", "type-index"],
|
|
32
|
-
{ "newlinesBetween": true },
|
|
33
|
-
"path-alias"
|
|
34
|
-
]
|
|
35
|
-
},
|
|
36
|
-
"sortPackageJson": false,
|
|
37
|
-
"ignorePatterns": ["**/node_modules/**", "**/dist/**"]
|
|
38
|
-
}
|
package/.oxlintrc.json
DELETED
|
@@ -1,219 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://raw.githubusercontent.com/nicolo-ribaudo/oxc-project.github.io/compiled-schema/oxlint.schema.json",
|
|
3
|
-
"options": {
|
|
4
|
-
"typeAware": true
|
|
5
|
-
},
|
|
6
|
-
"plugins": ["node", "jsx-a11y", "jsdoc", "vitest", "import", "promise"],
|
|
7
|
-
"jsPlugins": [{ "name": "vitest-js", "specifier": "eslint-plugin-vitest" }],
|
|
8
|
-
"categories": {
|
|
9
|
-
"correctness": "error",
|
|
10
|
-
"suspicious": "error",
|
|
11
|
-
"pedantic": "off",
|
|
12
|
-
"style": "off",
|
|
13
|
-
"restriction": "off",
|
|
14
|
-
"nursery": "off"
|
|
15
|
-
},
|
|
16
|
-
"rules": {
|
|
17
|
-
"eqeqeq": ["error", "smart"],
|
|
18
|
-
"no-console": "error",
|
|
19
|
-
"no-nested-ternary": "error",
|
|
20
|
-
"no-await-in-loop": "error",
|
|
21
|
-
"id-length": ["error", { "min": 2, "exceptions": ["e", "i", "j", "q", "x", "y", "_", "A", "D", "K", "P", "T", "U"] }],
|
|
22
|
-
"no-void": "off",
|
|
23
|
-
"no-bitwise": "off",
|
|
24
|
-
|
|
25
|
-
"curly": ["error", "all"],
|
|
26
|
-
"no-var": "error",
|
|
27
|
-
"prefer-const": ["error", { "destructuring": "any", "ignoreReadBeforeAssign": true }],
|
|
28
|
-
"prefer-template": "error",
|
|
29
|
-
"no-else-return": ["error", { "allowElseIf": false }],
|
|
30
|
-
"no-return-assign": ["error", "always"],
|
|
31
|
-
"yoda": "error",
|
|
32
|
-
"no-lonely-if": "error",
|
|
33
|
-
"no-negated-condition": "error",
|
|
34
|
-
"no-self-compare": "error",
|
|
35
|
-
"no-useless-return": "error",
|
|
36
|
-
"no-promise-executor-return": "error",
|
|
37
|
-
"no-constructor-return": "error",
|
|
38
|
-
"no-new-wrappers": "error",
|
|
39
|
-
"no-template-curly-in-string": "error",
|
|
40
|
-
"no-useless-computed-key": "error",
|
|
41
|
-
"no-sequences": "error",
|
|
42
|
-
"no-proto": "error",
|
|
43
|
-
"no-multi-assign": "error",
|
|
44
|
-
"no-multi-str": "error",
|
|
45
|
-
"no-lone-blocks": "error",
|
|
46
|
-
"no-labels": ["error", { "allowLoop": false, "allowSwitch": false }],
|
|
47
|
-
"no-label-var": "error",
|
|
48
|
-
"no-extra-label": "error",
|
|
49
|
-
"no-new-func": "error",
|
|
50
|
-
"no-script-url": "error",
|
|
51
|
-
"max-classes-per-file": ["error", 1],
|
|
52
|
-
"array-callback-return": ["error", { "allowImplicit": true }],
|
|
53
|
-
"symbol-description": "error",
|
|
54
|
-
"default-case": ["error", { "commentPattern": "^no default$" }],
|
|
55
|
-
"default-case-last": "error",
|
|
56
|
-
"operator-assignment": ["error", "always"],
|
|
57
|
-
"prefer-numeric-literals": "error",
|
|
58
|
-
"prefer-object-spread": "error",
|
|
59
|
-
"prefer-promise-reject-errors": ["error", { "allowEmptyReject": true }],
|
|
60
|
-
"vars-on-top": "error",
|
|
61
|
-
"func-names": "error",
|
|
62
|
-
"func-style": ["error", "declaration"],
|
|
63
|
-
"grouped-accessor-pairs": "error",
|
|
64
|
-
"guard-for-in": "error",
|
|
65
|
-
"sort-imports": "off",
|
|
66
|
-
"no-array-constructor": "error",
|
|
67
|
-
"no-restricted-globals": ["error", { "name": "isFinite", "message": "Use Number.isFinite instead" }, { "name": "isNaN", "message": "Use Number.isNaN instead" }],
|
|
68
|
-
"no-use-before-define": ["error", { "functions": false, "classes": true, "variables": true }],
|
|
69
|
-
"no-empty-function": ["error", { "allow": ["arrowFunctions", "functions", "methods"] }],
|
|
70
|
-
"no-case-declarations": "error",
|
|
71
|
-
"no-empty": "error",
|
|
72
|
-
"no-fallthrough": "error",
|
|
73
|
-
"no-prototype-builtins": "error",
|
|
74
|
-
"no-redeclare": "error",
|
|
75
|
-
"no-regex-spaces": "error",
|
|
76
|
-
"no-unreachable": "error",
|
|
77
|
-
"prefer-rest-params": "error",
|
|
78
|
-
"prefer-spread": "error",
|
|
79
|
-
"getter-return": ["error", { "allowImplicit": true }],
|
|
80
|
-
"no-undef": "off",
|
|
81
|
-
|
|
82
|
-
"no-unneeded-ternary": ["error", { "defaultAssignment": false }],
|
|
83
|
-
|
|
84
|
-
"typescript/no-unused-vars": ["error", { "argsIgnorePattern": "^_" }],
|
|
85
|
-
"typescript/consistent-type-imports": ["error", { "prefer": "type-imports" }],
|
|
86
|
-
"typescript/array-type": ["error", { "default": "array" }],
|
|
87
|
-
"typescript/explicit-function-return-type": "off",
|
|
88
|
-
"typescript/prefer-nullish-coalescing": "off",
|
|
89
|
-
"typescript/no-unsafe-argument": "off",
|
|
90
|
-
"typescript/no-unsafe-assignment": "off",
|
|
91
|
-
"typescript/no-unsafe-call": "off",
|
|
92
|
-
"typescript/no-unsafe-member-access": "off",
|
|
93
|
-
"typescript/no-unsafe-return": "off",
|
|
94
|
-
"typescript/no-misused-promises": "off",
|
|
95
|
-
"typescript/ban-ts-comment": ["error", { "minimumDescriptionLength": 10 }],
|
|
96
|
-
"typescript/only-throw-error": "error",
|
|
97
|
-
"typescript/return-await": "error",
|
|
98
|
-
"typescript/no-empty-interface": "error",
|
|
99
|
-
"typescript/parameter-properties": ["error", { "allow": ["readonly"] }],
|
|
100
|
-
"typescript/no-deprecated": "off",
|
|
101
|
-
"typescript/no-dynamic-delete": "error",
|
|
102
|
-
"typescript/no-empty-object-type": "error",
|
|
103
|
-
"typescript/no-extraneous-class": "error",
|
|
104
|
-
"typescript/no-invalid-void-type": "error",
|
|
105
|
-
"typescript/no-mixed-enums": "error",
|
|
106
|
-
"typescript/no-namespace": "error",
|
|
107
|
-
"typescript/no-non-null-asserted-nullish-coalescing": "error",
|
|
108
|
-
"typescript/no-require-imports": "error",
|
|
109
|
-
"typescript/no-unnecessary-condition": "error",
|
|
110
|
-
"typescript/no-unnecessary-template-expression": "error",
|
|
111
|
-
"typescript/no-unnecessary-type-arguments": "error",
|
|
112
|
-
"typescript/no-unnecessary-type-assertion": "error",
|
|
113
|
-
"typescript/no-unnecessary-type-constraint": "error",
|
|
114
|
-
"typescript/no-unnecessary-type-parameters": "error",
|
|
115
|
-
"typescript/no-unsafe-enum-comparison": "error",
|
|
116
|
-
"typescript/no-unsafe-function-type": "error",
|
|
117
|
-
"typescript/no-useless-default-assignment": "error",
|
|
118
|
-
"typescript/prefer-literal-enum-member": "error",
|
|
119
|
-
"typescript/prefer-promise-reject-errors": "error",
|
|
120
|
-
"typescript/prefer-reduce-type-parameter": "error",
|
|
121
|
-
"typescript/prefer-return-this-type": "error",
|
|
122
|
-
"typescript/related-getter-setter-pairs": "error",
|
|
123
|
-
"typescript/require-await": "error",
|
|
124
|
-
"typescript/restrict-plus-operands": "error",
|
|
125
|
-
"typescript/unified-signatures": "error",
|
|
126
|
-
"typescript/adjacent-overload-signatures": "error",
|
|
127
|
-
"typescript/ban-tslint-comment": "error",
|
|
128
|
-
"typescript/class-literal-property-style": "error",
|
|
129
|
-
"typescript/consistent-generic-constructors": "error",
|
|
130
|
-
"typescript/consistent-indexed-object-style": "error",
|
|
131
|
-
"typescript/consistent-type-assertions": "error",
|
|
132
|
-
"typescript/consistent-type-definitions": "error",
|
|
133
|
-
"typescript/no-confusing-non-null-assertion": "error",
|
|
134
|
-
"typescript/no-inferrable-types": "error",
|
|
135
|
-
"typescript/non-nullable-type-assertion-style": "error",
|
|
136
|
-
"typescript/prefer-find": "error",
|
|
137
|
-
"typescript/prefer-for-of": "error",
|
|
138
|
-
"typescript/prefer-function-type": "error",
|
|
139
|
-
"typescript/prefer-includes": "error",
|
|
140
|
-
"typescript/prefer-optional-chain": "error",
|
|
141
|
-
"typescript/prefer-regexp-exec": "error",
|
|
142
|
-
"typescript/prefer-string-starts-ends-with": "error",
|
|
143
|
-
"typescript/dot-notation": "error",
|
|
144
|
-
"typescript/no-unnecessary-boolean-literal-compare": "error",
|
|
145
|
-
|
|
146
|
-
"react/react-in-jsx-scope": "off",
|
|
147
|
-
"react/exhaustive-deps": "error",
|
|
148
|
-
"react/rules-of-hooks": "error",
|
|
149
|
-
"react/display-name": ["error", { "ignoreTranspilerName": false }],
|
|
150
|
-
"react/jsx-no-target-blank": "error",
|
|
151
|
-
"react/jsx-no-useless-fragment": "error",
|
|
152
|
-
"react/jsx-fragments": "error",
|
|
153
|
-
"react/jsx-pascal-case": ["error", { "allowAllCaps": true }],
|
|
154
|
-
"react/no-redundant-should-component-update": "error",
|
|
155
|
-
"react/self-closing-comp": "error",
|
|
156
|
-
"react/require-render-return": "error",
|
|
157
|
-
"react/jsx-no-script-url": "error",
|
|
158
|
-
"react/no-namespace": "error",
|
|
159
|
-
"react/style-prop-object": "error",
|
|
160
|
-
"react/iframe-missing-sandbox": "error",
|
|
161
|
-
|
|
162
|
-
"import/no-named-as-default": "off",
|
|
163
|
-
"import/no-named-as-default-member": "off",
|
|
164
|
-
"import/no-unassigned-import": "off",
|
|
165
|
-
"import/consistent-type-specifier-style": "off",
|
|
166
|
-
"import/first": "error",
|
|
167
|
-
"import/no-duplicates": "error",
|
|
168
|
-
|
|
169
|
-
"jsx-a11y/prefer-tag-over-role": "off",
|
|
170
|
-
"jsx-a11y/no-static-element-interactions": "off",
|
|
171
|
-
|
|
172
|
-
"unicorn/no-array-method-this-argument": "off",
|
|
173
|
-
"unicorn/prefer-array-find": "error",
|
|
174
|
-
"unicorn/prefer-set-has": "error",
|
|
175
|
-
"unicorn/prefer-node-protocol": "error",
|
|
176
|
-
"unicorn/prefer-object-from-entries": "error",
|
|
177
|
-
|
|
178
|
-
"promise/catch-or-return": ["error", { "allowThen": true }],
|
|
179
|
-
"promise/param-names": "error",
|
|
180
|
-
"promise/always-return": "error",
|
|
181
|
-
|
|
182
|
-
"node/no-new-require": "error",
|
|
183
|
-
"node/no-path-concat": "error",
|
|
184
|
-
"node/global-require": "error",
|
|
185
|
-
|
|
186
|
-
"jsdoc/require-param": ["error", { "ignoreWhenAllParamsMissing": true }],
|
|
187
|
-
"jsdoc/require-param-name": "error",
|
|
188
|
-
"jsdoc/require-param-type": "error",
|
|
189
|
-
|
|
190
|
-
"vitest/warn-todo": "off",
|
|
191
|
-
"vitest/no-import-node-test": "error",
|
|
192
|
-
"vitest/no-conditional-tests": "error",
|
|
193
|
-
"vitest/prefer-called-once": "error",
|
|
194
|
-
"vitest/prefer-expect-type-of": "error",
|
|
195
|
-
"vitest/prefer-to-be-object": "error",
|
|
196
|
-
"vitest-js/consistent-test-it": ["error", { "fn": "it" }],
|
|
197
|
-
"vitest-js/no-duplicate-hooks": "error",
|
|
198
|
-
"vitest-js/no-identical-title": "error",
|
|
199
|
-
"vitest-js/no-test-prefixes": "error",
|
|
200
|
-
"vitest-js/prefer-comparison-matcher": "error",
|
|
201
|
-
"vitest-js/prefer-equality-matcher": "error",
|
|
202
|
-
"vitest-js/prefer-hooks-in-order": "error",
|
|
203
|
-
"vitest-js/prefer-hooks-on-top": "error",
|
|
204
|
-
"vitest-js/prefer-lowercase-title": ["error", { "ignore": ["describe"] }],
|
|
205
|
-
"vitest-js/prefer-mock-promise-shorthand": "error",
|
|
206
|
-
"vitest-js/prefer-spy-on": "error",
|
|
207
|
-
"vitest-js/prefer-strict-equal": "error",
|
|
208
|
-
"vitest-js/require-top-level-describe": "error"
|
|
209
|
-
},
|
|
210
|
-
"overrides": [
|
|
211
|
-
{
|
|
212
|
-
"files": ["**/*.test.ts", "**/*.test.tsx"],
|
|
213
|
-
"rules": {
|
|
214
|
-
"id-length": "off"
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
],
|
|
218
|
-
"ignorePatterns": ["dist/**", "node_modules/**", ".agents/**", ".claude/skills/**"]
|
|
219
|
-
}
|