nucleus-core-ts 0.10.12 → 0.10.13
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/.build-ok +1 -1
- package/dist/index.js +14 -14
- package/dist/server.js +14 -14
- package/dist/src/Nucleus/routes/entity/searchCondition.d.ts +52 -0
- package/package.json +124 -124
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { type SQL } from 'drizzle-orm';
|
|
2
|
+
/**
|
|
3
|
+
* What a list search actually asks the database.
|
|
4
|
+
*
|
|
5
|
+
* The whole search term used to be handed to every searchable column at once:
|
|
6
|
+
*
|
|
7
|
+
* first_name ILIKE '%Ayşe Yılmaz%' OR last_name ILIKE '%Ayşe Yılmaz%' OR …
|
|
8
|
+
*
|
|
9
|
+
* No single column holds a first name and a last name together, so typing a
|
|
10
|
+
* person's full name — the most ordinary thing anyone does in a staff directory
|
|
11
|
+
* — matched nobody. Each half found her on its own; the space is what emptied
|
|
12
|
+
* the screen. Measured on a real installation: "Ayşe" 1 row, "Yılmaz" 1 row,
|
|
13
|
+
* "Ayşe Yılmaz" 0 rows.
|
|
14
|
+
*
|
|
15
|
+
* So the term is split, and the shape is inverted where it matters:
|
|
16
|
+
*
|
|
17
|
+
* AND over words( OR over columns( column contains word ) )
|
|
18
|
+
*
|
|
19
|
+
* Every word must appear SOMEWHERE, not all in the same column. That also makes
|
|
20
|
+
* word order irrelevant, which is right: nobody should have to know whether the
|
|
21
|
+
* directory stores "Ayşe Yılmaz" or "Yılmaz, Ayşe".
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* A ceiling on how many words one search may ask about.
|
|
25
|
+
*
|
|
26
|
+
* Each word costs one comparison per searchable column, so a pasted paragraph
|
|
27
|
+
* would turn a single request into hundreds of full-column scans. Ten is far
|
|
28
|
+
* past any real name or title and cheap to serve; the rest of the term is
|
|
29
|
+
* ignored rather than refused, because a search box that answers nothing at all
|
|
30
|
+
* is worse than one that answers the first ten words.
|
|
31
|
+
*/
|
|
32
|
+
export declare const MAX_SEARCH_TOKENS = 10;
|
|
33
|
+
/** The words a search term is asking about, in order, capped. */
|
|
34
|
+
export declare function searchTokens(term: string): string[];
|
|
35
|
+
/**
|
|
36
|
+
* The same fold the SQL applies, in TypeScript, so both sides of the comparison
|
|
37
|
+
* are normalised identically.
|
|
38
|
+
*
|
|
39
|
+
* The Turkish letters are replaced BEFORE lowering because JavaScript lowers
|
|
40
|
+
* `İ` to `i` followed by a combining dot — two code points that then match
|
|
41
|
+
* nothing.
|
|
42
|
+
*/
|
|
43
|
+
export declare function foldForSearch(value: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* The WHERE fragment for `?search=…&searchFields=…`, or null when there is
|
|
46
|
+
* nothing to ask.
|
|
47
|
+
*
|
|
48
|
+
* Null rather than a condition that matches everything: the caller pushes onto a
|
|
49
|
+
* list of conditions, and a term of nothing but spaces must not narrow the list
|
|
50
|
+
* NOR silently drop other conditions.
|
|
51
|
+
*/
|
|
52
|
+
export declare function buildSearchCondition(columns: SQL[], term: string): SQL | null;
|
package/package.json
CHANGED
|
@@ -1,126 +1,126 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
2
|
+
"name": "nucleus-core-ts",
|
|
3
|
+
"version": "0.10.13",
|
|
4
|
+
"description": "Production-ready, enterprise-grade TypeScript framework for building multi-tenant APIs",
|
|
5
|
+
"author": "Hidayet Can Özcan <hidayetcan@gmail.com>",
|
|
6
|
+
"license": "SEE LICENSE IN LICENSE",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"backend",
|
|
9
|
+
"framework",
|
|
10
|
+
"drizzle",
|
|
11
|
+
"typescript"
|
|
12
|
+
],
|
|
13
|
+
"files": [
|
|
14
|
+
"bin",
|
|
15
|
+
"dist",
|
|
16
|
+
"schemas",
|
|
17
|
+
"scripts",
|
|
18
|
+
"infra/templates",
|
|
19
|
+
"infra/scripts/generate-project.ts",
|
|
20
|
+
"src/system.tables.json",
|
|
21
|
+
"src/Services/SchemaTables/resolveEntities.ts",
|
|
22
|
+
"src/Services/Logger/auditTaxonomy.ts",
|
|
23
|
+
"public",
|
|
24
|
+
"LICENSE"
|
|
25
|
+
],
|
|
26
|
+
"module": "dist/index.js",
|
|
27
|
+
"type": "module",
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
29
|
+
"exports": {
|
|
30
|
+
".": {
|
|
31
|
+
"types": "./dist/index.d.ts",
|
|
32
|
+
"import": "./dist/index.js"
|
|
33
|
+
},
|
|
34
|
+
"./server": {
|
|
35
|
+
"types": "./dist/server.d.ts",
|
|
36
|
+
"import": "./dist/server.js"
|
|
37
|
+
},
|
|
38
|
+
"./client": {
|
|
39
|
+
"types": "./dist/client.d.ts",
|
|
40
|
+
"import": "./dist/client.js"
|
|
41
|
+
},
|
|
42
|
+
"./fe": {
|
|
43
|
+
"types": "./dist/fe/index.d.ts",
|
|
44
|
+
"import": "./dist/fe/index.js"
|
|
45
|
+
},
|
|
46
|
+
"./fe/auth": {
|
|
47
|
+
"types": "./dist/fe/components/AuthGuard/index.d.ts",
|
|
48
|
+
"import": "./dist/fe/components/AuthGuard/index.js"
|
|
49
|
+
},
|
|
50
|
+
"./proxy": {
|
|
51
|
+
"types": "./dist/src/Client/Proxy/index.d.ts",
|
|
52
|
+
"import": "./dist/src/Client/Proxy/index.js"
|
|
53
|
+
}
|
|
54
|
+
},
|
|
55
|
+
"scripts": {
|
|
56
|
+
"test": "bun test src scripts fe",
|
|
57
|
+
"build": "bun run scripts/build.ts",
|
|
58
|
+
"build:quick": "bun run build:js && bun run build:types",
|
|
59
|
+
"build:js": "bun build ./index.ts ./server.ts ./client.ts ./fe/index.ts ./src/Client/Proxy/index.ts --outdir=dist --target=bun --format=esm --splitting --minify --external react --external react-dom --external gsap --external @gsap/react --external h-state --external drizzle-orm --external drizzle-kit --external ioredis --external googleapis --external @dapr/dapr --external pg --external @xyflow/react --external @xyflow/system --external @azure/communication-email --external nodemailer --external @azure/identity --external stripe --external sharp",
|
|
60
|
+
"build:types": "tsc --declaration --emitDeclarationOnly --outDir dist --skipLibCheck",
|
|
61
|
+
"version:patch": "bun run scripts/version.ts patch",
|
|
62
|
+
"version:minor": "bun run scripts/version.ts minor",
|
|
63
|
+
"version:major": "bun run scripts/version.ts major",
|
|
64
|
+
"publish:npm": "bun run scripts/publish.ts",
|
|
65
|
+
"publish:dry": "bun run scripts/publish.ts --dry-run",
|
|
66
|
+
"release": "bun run version:patch && bun run publish:npm",
|
|
67
|
+
"release:minor": "bun run version:minor && bun run publish:npm",
|
|
68
|
+
"release:major": "bun run version:major && bun run publish:npm",
|
|
69
|
+
"generate:schemas": "bun run scripts/generate-types-schema.ts",
|
|
70
|
+
"lint": "biome check . --write",
|
|
71
|
+
"lint:fix": "biome check --config-path ./biome.json --write",
|
|
72
|
+
"prepublishOnly": "bun run scripts/verify-publishable.ts"
|
|
73
|
+
},
|
|
74
|
+
"bin": {
|
|
75
|
+
"nucleus-core-ts": "./bin/cli.ts",
|
|
76
|
+
"nucleus": "./bin/cli.ts",
|
|
77
|
+
"nucleus-generate": "./bin/cli.ts"
|
|
78
|
+
},
|
|
79
|
+
"devDependencies": {
|
|
80
|
+
"@biomejs/biome": "2.5.10",
|
|
81
|
+
"googleapis": "^171.4.0",
|
|
82
|
+
"@types/bun": "latest",
|
|
83
|
+
"@types/pg": "latest",
|
|
84
|
+
"@types/react": "latest",
|
|
85
|
+
"@happy-dom/global-registrator": "^20.11.2",
|
|
86
|
+
"@types/react-dom": "latest",
|
|
87
|
+
"bun-plugin-tailwind": "latest",
|
|
88
|
+
"drizzle-kit": "latest",
|
|
89
|
+
"javascript-obfuscator": "latest",
|
|
90
|
+
"lucide-react": "latest",
|
|
91
|
+
"nodemailer": "^9.0.3"
|
|
92
|
+
},
|
|
93
|
+
"peerDependencies": {
|
|
94
|
+
"typescript": "latest",
|
|
95
|
+
"@dapr/dapr": "latest",
|
|
96
|
+
"react": "latest",
|
|
97
|
+
"react-dom": "latest",
|
|
98
|
+
"pg": "latest",
|
|
99
|
+
"tailwindcss": "latest",
|
|
100
|
+
"tailwind-merge": "latest",
|
|
101
|
+
"clsx": "latest",
|
|
102
|
+
"googleapis": "*"
|
|
103
|
+
},
|
|
104
|
+
"dependencies": {
|
|
105
|
+
"@sinclair/typebox": "0.34.47",
|
|
106
|
+
"@gsap/react": "latest",
|
|
107
|
+
"@simplewebauthn/server": "^13.3.0",
|
|
108
|
+
"@xyflow/react": "latest",
|
|
109
|
+
"drizzle-orm": "latest",
|
|
110
|
+
"gsap": "latest",
|
|
111
|
+
"h-state": "latest",
|
|
112
|
+
"ioredis": "latest",
|
|
113
|
+
"reflect-metadata": "^0.2.2"
|
|
114
|
+
},
|
|
115
|
+
"optionalDependencies": {
|
|
116
|
+
"@azure/communication-email": "latest",
|
|
117
|
+
"@marsaud/smb2": "^0.18.0",
|
|
118
|
+
"sharp": "^0.33.0",
|
|
119
|
+
"stripe": "latest"
|
|
120
|
+
},
|
|
121
|
+
"peerDependenciesMeta": {
|
|
122
|
+
"googleapis": {
|
|
123
|
+
"optional": true
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
126
|
}
|