@pdg/drizzle-mysql 0.0.0-stage → 1.0.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/README.md +373 -2
- package/dist/@types/MySqlConditions.d.cts +20 -0
- package/dist/@types/MySqlConditions.d.ts +20 -0
- package/dist/@types/MySqlInsertValues.d.cts +16 -0
- package/dist/@types/MySqlInsertValues.d.ts +16 -0
- package/dist/@types/MySqlUpdateValues.d.cts +23 -0
- package/dist/@types/MySqlUpdateValues.d.ts +23 -0
- package/dist/@types/common.d.cts +16 -0
- package/dist/@types/common.d.ts +16 -0
- package/dist/@types/index.d.cts +4 -0
- package/dist/@types/index.d.ts +4 -0
- package/dist/MySqlQuery.d.cts +236 -0
- package/dist/MySqlQuery.d.ts +236 -0
- package/dist/alias.d.cts +6 -0
- package/dist/alias.d.ts +6 -0
- package/dist/columns.d.cts +89 -0
- package/dist/columns.d.ts +89 -0
- package/dist/conditions.d.cts +106 -0
- package/dist/conditions.d.ts +106 -0
- package/dist/drizzleMySql.d.cts +162 -0
- package/dist/drizzleMySql.d.ts +162 -0
- package/dist/index.cjs +684 -0
- package/dist/index.d.cts +10 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.esm.js +684 -0
- package/dist/mysqlTable.d.cts +60 -0
- package/dist/mysqlTable.d.ts +60 -0
- package/package.json +88 -4
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ColumnBuilderBase } from 'drizzle-orm/column-builder';
|
|
2
|
+
import { type MySqlTable, type MySqlTableWithColumns } from 'drizzle-orm/mysql-core';
|
|
3
|
+
import type { BuildColumns } from 'drizzle-orm/column-builder';
|
|
4
|
+
import type { MySqlColumnBuilders } from 'drizzle-orm/mysql-core/columns/all';
|
|
5
|
+
import type { MySqlTableExtraConfig, MySqlTableExtraConfigValue } from 'drizzle-orm/mysql-core/table';
|
|
6
|
+
export type ColumnPolicy = {
|
|
7
|
+
insert?: 'blocked' | 'allowed';
|
|
8
|
+
update?: 'blocked' | 'allowed' | 'required';
|
|
9
|
+
timestamp?: 'created' | 'updated';
|
|
10
|
+
};
|
|
11
|
+
declare const policyType: unique symbol;
|
|
12
|
+
declare const tablePolicyType: unique symbol;
|
|
13
|
+
type Mark<T, P extends ColumnPolicy> = T & {
|
|
14
|
+
readonly [policyType]: P;
|
|
15
|
+
};
|
|
16
|
+
declare module 'drizzle-orm/column-builder' {
|
|
17
|
+
interface ColumnBuilder<T, TRuntimeConfig, TExtraConfig> {
|
|
18
|
+
insertBlocked(): Mark<this, {
|
|
19
|
+
insert: 'blocked';
|
|
20
|
+
}>;
|
|
21
|
+
insertAllowed(): Mark<this, {
|
|
22
|
+
insert: 'allowed';
|
|
23
|
+
}>;
|
|
24
|
+
updateBlocked(): Mark<this, {
|
|
25
|
+
update: 'blocked';
|
|
26
|
+
}>;
|
|
27
|
+
updateAllowed(): Mark<this, {
|
|
28
|
+
update: 'allowed';
|
|
29
|
+
}>;
|
|
30
|
+
updateRequired(): Mark<this, {
|
|
31
|
+
update: 'required';
|
|
32
|
+
}>;
|
|
33
|
+
createdAt(): Mark<this, {
|
|
34
|
+
timestamp: 'created';
|
|
35
|
+
}>;
|
|
36
|
+
updatedAt(): Mark<this, {
|
|
37
|
+
timestamp: 'updated';
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
type Policies<C> = {
|
|
42
|
+
[K in keyof C]: C[K] extends {
|
|
43
|
+
readonly [policyType]: infer P;
|
|
44
|
+
} ? P : {};
|
|
45
|
+
};
|
|
46
|
+
export type TablePolicies<T> = T extends {
|
|
47
|
+
readonly [tablePolicyType]: infer P;
|
|
48
|
+
} ? P : {};
|
|
49
|
+
type TableResult<N extends string, C extends Record<string, ColumnBuilderBase>> = MySqlTableWithColumns<{
|
|
50
|
+
name: N;
|
|
51
|
+
schema: undefined;
|
|
52
|
+
columns: BuildColumns<N, C, 'mysql'>;
|
|
53
|
+
dialect: 'mysql';
|
|
54
|
+
isAlias: false;
|
|
55
|
+
}> & {
|
|
56
|
+
readonly [tablePolicyType]: Policies<C>;
|
|
57
|
+
};
|
|
58
|
+
export declare function getColumnPolicies(table: MySqlTable): Record<string, ColumnPolicy>;
|
|
59
|
+
export declare function mysqlTable<N extends string, C extends Record<string, ColumnBuilderBase>>(name: N, columns: C | ((types: MySqlColumnBuilders) => C), extraConfig?: (self: BuildColumns<N, C, 'mysql'>) => MySqlTableExtraConfig | (MySqlTableExtraConfigValue | MySqlTableExtraConfigValue[])[]): TableResult<N, C>;
|
|
60
|
+
export {};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { type ColumnBuilderBase } from 'drizzle-orm/column-builder';
|
|
2
|
+
import { type MySqlTable, type MySqlTableWithColumns } from 'drizzle-orm/mysql-core';
|
|
3
|
+
import type { BuildColumns } from 'drizzle-orm/column-builder';
|
|
4
|
+
import type { MySqlColumnBuilders } from 'drizzle-orm/mysql-core/columns/all';
|
|
5
|
+
import type { MySqlTableExtraConfig, MySqlTableExtraConfigValue } from 'drizzle-orm/mysql-core/table';
|
|
6
|
+
export type ColumnPolicy = {
|
|
7
|
+
insert?: 'blocked' | 'allowed';
|
|
8
|
+
update?: 'blocked' | 'allowed' | 'required';
|
|
9
|
+
timestamp?: 'created' | 'updated';
|
|
10
|
+
};
|
|
11
|
+
declare const policyType: unique symbol;
|
|
12
|
+
declare const tablePolicyType: unique symbol;
|
|
13
|
+
type Mark<T, P extends ColumnPolicy> = T & {
|
|
14
|
+
readonly [policyType]: P;
|
|
15
|
+
};
|
|
16
|
+
declare module 'drizzle-orm/column-builder' {
|
|
17
|
+
interface ColumnBuilder<T, TRuntimeConfig, TExtraConfig> {
|
|
18
|
+
insertBlocked(): Mark<this, {
|
|
19
|
+
insert: 'blocked';
|
|
20
|
+
}>;
|
|
21
|
+
insertAllowed(): Mark<this, {
|
|
22
|
+
insert: 'allowed';
|
|
23
|
+
}>;
|
|
24
|
+
updateBlocked(): Mark<this, {
|
|
25
|
+
update: 'blocked';
|
|
26
|
+
}>;
|
|
27
|
+
updateAllowed(): Mark<this, {
|
|
28
|
+
update: 'allowed';
|
|
29
|
+
}>;
|
|
30
|
+
updateRequired(): Mark<this, {
|
|
31
|
+
update: 'required';
|
|
32
|
+
}>;
|
|
33
|
+
createdAt(): Mark<this, {
|
|
34
|
+
timestamp: 'created';
|
|
35
|
+
}>;
|
|
36
|
+
updatedAt(): Mark<this, {
|
|
37
|
+
timestamp: 'updated';
|
|
38
|
+
}>;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
type Policies<C> = {
|
|
42
|
+
[K in keyof C]: C[K] extends {
|
|
43
|
+
readonly [policyType]: infer P;
|
|
44
|
+
} ? P : {};
|
|
45
|
+
};
|
|
46
|
+
export type TablePolicies<T> = T extends {
|
|
47
|
+
readonly [tablePolicyType]: infer P;
|
|
48
|
+
} ? P : {};
|
|
49
|
+
type TableResult<N extends string, C extends Record<string, ColumnBuilderBase>> = MySqlTableWithColumns<{
|
|
50
|
+
name: N;
|
|
51
|
+
schema: undefined;
|
|
52
|
+
columns: BuildColumns<N, C, 'mysql'>;
|
|
53
|
+
dialect: 'mysql';
|
|
54
|
+
isAlias: false;
|
|
55
|
+
}> & {
|
|
56
|
+
readonly [tablePolicyType]: Policies<C>;
|
|
57
|
+
};
|
|
58
|
+
export declare function getColumnPolicies(table: MySqlTable): Record<string, ColumnPolicy>;
|
|
59
|
+
export declare function mysqlTable<N extends string, C extends Record<string, ColumnBuilderBase>>(name: N, columns: C | ((types: MySqlColumnBuilders) => C), extraConfig?: (self: BuildColumns<N, C, 'mysql'>) => MySqlTableExtraConfig | (MySqlTableExtraConfigValue | MySqlTableExtraConfigValue[])[]): TableResult<N, C>;
|
|
60
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,90 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pdg/drizzle-mysql",
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"title": "Drizzle for MySql",
|
|
4
|
+
"description": "Drizzle for MySql",
|
|
5
|
+
"version": "1.0.1",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.esm.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"import": {
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"default": "./dist/index.esm.js"
|
|
15
|
+
},
|
|
16
|
+
"require": {
|
|
17
|
+
"types": "./dist/index.d.cts",
|
|
18
|
+
"default": "./dist/index.cjs"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"repository": {
|
|
23
|
+
"type": "git",
|
|
24
|
+
"url": "git+https://github.com/parkdigy/drizzle-mysql.git",
|
|
25
|
+
"baseUrl": "https://github.com/parkdigy/drizzle-mysql"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/parkdigy/drizzle-mysql/issues"
|
|
29
|
+
},
|
|
30
|
+
"homepage": "https://github.com/parkdigy/drizzle-mysql#readme",
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md"
|
|
34
|
+
],
|
|
35
|
+
"scripts": {
|
|
36
|
+
"dev": "cd examples && npm run dev",
|
|
37
|
+
"watchman:del": "watchman watch-del \"${PWD}\" ; watchman watch-project \"${PWD}\"",
|
|
38
|
+
"build": "npm run watchman:del && npm run test && rollup -c --bundleConfigAsCjs",
|
|
39
|
+
"git:commit": "node .git-commit.cjs",
|
|
40
|
+
"git:push": "git push",
|
|
41
|
+
"git:commit:push": "npm run git:commit && npm run git:push",
|
|
42
|
+
"git:merge:mirror": "node .git-merge.cjs mirror main",
|
|
43
|
+
"reset:gitignore": "git rm -r --cached . && git add .",
|
|
44
|
+
"pub": "npm i && npm run build && npm publish --access=public && [ -f ./.git/hooks/pre-commit ] && rm ./.git/hooks/pre-commit || true",
|
|
45
|
+
"lint": "eslint './src/**/*.ts'",
|
|
46
|
+
"tsc": "tsc --noEmit",
|
|
47
|
+
"reinstall": "npm run reinstall:module",
|
|
48
|
+
"reinstall:module": "rm -rf node_modules && rm -f package-lock.json && npm i",
|
|
49
|
+
"test": "jest"
|
|
50
|
+
},
|
|
51
|
+
"author": "YOUNG CHUL PARK",
|
|
52
|
+
"license": "MIT",
|
|
53
|
+
"readmeFilename": "README.md",
|
|
54
|
+
"keywords": [
|
|
55
|
+
"util",
|
|
56
|
+
"typescript",
|
|
57
|
+
"javascript"
|
|
58
|
+
],
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"drizzle-orm": "1.0.0-rc.5",
|
|
61
|
+
"mysql2": "^3.24.6"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@eslint/js": "9.39.5",
|
|
65
|
+
"@rollup/plugin-commonjs": "29.0.3",
|
|
66
|
+
"@rollup/plugin-eslint": "9.2.0",
|
|
67
|
+
"@rollup/plugin-node-resolve": "16.0.3",
|
|
68
|
+
"@types/jest": "30.0.0",
|
|
69
|
+
"@types/node": "24.19.2",
|
|
70
|
+
"@typescript-eslint/parser": "8.72.1",
|
|
71
|
+
"eslint": "9.39.5",
|
|
72
|
+
"eslint-config-prettier": "10.1.8",
|
|
73
|
+
"eslint-plugin-prettier": "5.5.7",
|
|
74
|
+
"jest": "30.5.2",
|
|
75
|
+
"prettier": "3.9.10",
|
|
76
|
+
"rollup": "4.67.4",
|
|
77
|
+
"rollup-plugin-delete": "3.0.2",
|
|
78
|
+
"rollup-plugin-peer-deps-external": "2.2.4",
|
|
79
|
+
"rollup-plugin-typescript2": "0.37.0",
|
|
80
|
+
"ts-jest": "29.4.15",
|
|
81
|
+
"ts-node": "10.9.2",
|
|
82
|
+
"typescript": "6.0.3",
|
|
83
|
+
"typescript-eslint": "8.72.1"
|
|
84
|
+
},
|
|
85
|
+
"allowScripts": {
|
|
86
|
+
"@parcel/watcher": true,
|
|
87
|
+
"fsevents": true,
|
|
88
|
+
"esbuild": true
|
|
89
|
+
}
|
|
90
|
+
}
|