@atscript/db-mysql 0.1.38

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.
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ //#region rolldown:runtime
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __copyProps = (to, from, except, desc) => {
10
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
11
+ key = keys[i];
12
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
13
+ get: ((k) => from[k]).bind(null, key),
14
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
15
+ });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
20
+ value: mod,
21
+ enumerable: true
22
+ }) : target, mod));
23
+
24
+ //#endregion
25
+ const __atscript_core = __toESM(require("@atscript/core"));
26
+
27
+ //#region packages/db-mysql/src/plugin/annotations.ts
28
+ const annotations = {
29
+ engine: new __atscript_core.AnnotationSpec({
30
+ description: "Specifies the MySQL storage engine.\n\n**Default:** `\"InnoDB\"`\n\n```atscript\n@db.mysql.engine \"MyISAM\"\nexport interface Logs { ... }\n```",
31
+ nodeType: ["interface"],
32
+ multiple: false,
33
+ argument: {
34
+ name: "engine",
35
+ type: "string",
36
+ values: [
37
+ "InnoDB",
38
+ "MyISAM",
39
+ "MEMORY",
40
+ "CSV",
41
+ "ARCHIVE"
42
+ ],
43
+ description: "MySQL storage engine name."
44
+ }
45
+ }),
46
+ charset: new __atscript_core.AnnotationSpec({
47
+ description: "Specifies the character set for the table or column.\n\n**Default:** `\"utf8mb4\"`\n\n```atscript\n@db.mysql.charset \"latin1\"\nexport interface Legacy { ... }\n```",
48
+ nodeType: ["interface", "prop"],
49
+ multiple: false,
50
+ argument: {
51
+ name: "charset",
52
+ type: "string",
53
+ values: [
54
+ "utf8mb4",
55
+ "utf8",
56
+ "latin1",
57
+ "ascii",
58
+ "binary"
59
+ ],
60
+ description: "MySQL character set name."
61
+ }
62
+ }),
63
+ collate: new __atscript_core.AnnotationSpec({
64
+ description: "Specifies a native MySQL collation (overrides portable `@db.column.collate`).\n\n```atscript\n@db.mysql.collate \"utf8mb4_turkish_ci\"\nname: string\n```",
65
+ nodeType: ["interface", "prop"],
66
+ multiple: false,
67
+ argument: {
68
+ name: "collation",
69
+ type: "string",
70
+ description: "Native MySQL collation name (e.g., \"utf8mb4_turkish_ci\")."
71
+ }
72
+ }),
73
+ unsigned: new __atscript_core.AnnotationSpec({
74
+ description: "Adds the UNSIGNED modifier to an integer column.\n\n```atscript\n@db.mysql.unsigned\nage: number.int\n```",
75
+ nodeType: ["prop"],
76
+ multiple: false
77
+ }),
78
+ type: new __atscript_core.AnnotationSpec({
79
+ description: "Overrides the native MySQL column type.\n\n```atscript\n@db.mysql.type \"MEDIUMTEXT\"\nbio: string\n```",
80
+ nodeType: ["prop"],
81
+ multiple: false,
82
+ argument: {
83
+ name: "type",
84
+ type: "string",
85
+ description: "Native MySQL column type (e.g., \"MEDIUMTEXT\", \"TINYTEXT\")."
86
+ }
87
+ }),
88
+ onUpdate: new __atscript_core.AnnotationSpec({
89
+ description: "Sets the MySQL ON UPDATE clause for a column.\n\n```atscript\n@db.mysql.onUpdate \"CURRENT_TIMESTAMP\"\nupdatedAt: number.timestamp\n```",
90
+ nodeType: ["prop"],
91
+ multiple: false,
92
+ argument: {
93
+ name: "expression",
94
+ type: "string",
95
+ values: ["CURRENT_TIMESTAMP"],
96
+ description: "Expression to evaluate on row update."
97
+ }
98
+ })
99
+ };
100
+
101
+ //#endregion
102
+ //#region packages/db-mysql/src/plugin/index.ts
103
+ const MysqlPlugin = () => ({
104
+ name: "mysql",
105
+ config() {
106
+ return { annotations: { db: { mysql: annotations } } };
107
+ }
108
+ });
109
+
110
+ //#endregion
111
+ exports.MysqlPlugin = MysqlPlugin
@@ -0,0 +1,5 @@
1
+ import { TAtscriptPlugin } from '@atscript/core';
2
+
3
+ declare const MysqlPlugin: () => TAtscriptPlugin;
4
+
5
+ export { MysqlPlugin };
@@ -0,0 +1,87 @@
1
+ import { AnnotationSpec } from "@atscript/core";
2
+
3
+ //#region packages/db-mysql/src/plugin/annotations.ts
4
+ const annotations = {
5
+ engine: new AnnotationSpec({
6
+ description: "Specifies the MySQL storage engine.\n\n**Default:** `\"InnoDB\"`\n\n```atscript\n@db.mysql.engine \"MyISAM\"\nexport interface Logs { ... }\n```",
7
+ nodeType: ["interface"],
8
+ multiple: false,
9
+ argument: {
10
+ name: "engine",
11
+ type: "string",
12
+ values: [
13
+ "InnoDB",
14
+ "MyISAM",
15
+ "MEMORY",
16
+ "CSV",
17
+ "ARCHIVE"
18
+ ],
19
+ description: "MySQL storage engine name."
20
+ }
21
+ }),
22
+ charset: new AnnotationSpec({
23
+ description: "Specifies the character set for the table or column.\n\n**Default:** `\"utf8mb4\"`\n\n```atscript\n@db.mysql.charset \"latin1\"\nexport interface Legacy { ... }\n```",
24
+ nodeType: ["interface", "prop"],
25
+ multiple: false,
26
+ argument: {
27
+ name: "charset",
28
+ type: "string",
29
+ values: [
30
+ "utf8mb4",
31
+ "utf8",
32
+ "latin1",
33
+ "ascii",
34
+ "binary"
35
+ ],
36
+ description: "MySQL character set name."
37
+ }
38
+ }),
39
+ collate: new AnnotationSpec({
40
+ description: "Specifies a native MySQL collation (overrides portable `@db.column.collate`).\n\n```atscript\n@db.mysql.collate \"utf8mb4_turkish_ci\"\nname: string\n```",
41
+ nodeType: ["interface", "prop"],
42
+ multiple: false,
43
+ argument: {
44
+ name: "collation",
45
+ type: "string",
46
+ description: "Native MySQL collation name (e.g., \"utf8mb4_turkish_ci\")."
47
+ }
48
+ }),
49
+ unsigned: new AnnotationSpec({
50
+ description: "Adds the UNSIGNED modifier to an integer column.\n\n```atscript\n@db.mysql.unsigned\nage: number.int\n```",
51
+ nodeType: ["prop"],
52
+ multiple: false
53
+ }),
54
+ type: new AnnotationSpec({
55
+ description: "Overrides the native MySQL column type.\n\n```atscript\n@db.mysql.type \"MEDIUMTEXT\"\nbio: string\n```",
56
+ nodeType: ["prop"],
57
+ multiple: false,
58
+ argument: {
59
+ name: "type",
60
+ type: "string",
61
+ description: "Native MySQL column type (e.g., \"MEDIUMTEXT\", \"TINYTEXT\")."
62
+ }
63
+ }),
64
+ onUpdate: new AnnotationSpec({
65
+ description: "Sets the MySQL ON UPDATE clause for a column.\n\n```atscript\n@db.mysql.onUpdate \"CURRENT_TIMESTAMP\"\nupdatedAt: number.timestamp\n```",
66
+ nodeType: ["prop"],
67
+ multiple: false,
68
+ argument: {
69
+ name: "expression",
70
+ type: "string",
71
+ values: ["CURRENT_TIMESTAMP"],
72
+ description: "Expression to evaluate on row update."
73
+ }
74
+ })
75
+ };
76
+
77
+ //#endregion
78
+ //#region packages/db-mysql/src/plugin/index.ts
79
+ const MysqlPlugin = () => ({
80
+ name: "mysql",
81
+ config() {
82
+ return { annotations: { db: { mysql: annotations } } };
83
+ }
84
+ });
85
+
86
+ //#endregion
87
+ export { MysqlPlugin };
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@atscript/db-mysql",
3
+ "version": "0.1.38",
4
+ "description": "MySQL adapter for @atscript/db with mysql2 driver support.",
5
+ "keywords": [
6
+ "atscript",
7
+ "database",
8
+ "mysql"
9
+ ],
10
+ "homepage": "https://github.com/moostjs/atscript/tree/main/packages/db-mysql#readme",
11
+ "bugs": {
12
+ "url": "https://github.com/moostjs/atscript/issues"
13
+ },
14
+ "license": "MIT",
15
+ "author": "Artem Maltsev",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/moostjs/atscript.git",
19
+ "directory": "packages/db-mysql"
20
+ },
21
+ "files": [
22
+ "dist"
23
+ ],
24
+ "type": "module",
25
+ "main": "dist/index.mjs",
26
+ "types": "dist/index.d.ts",
27
+ "typesVersions": {
28
+ "*": {
29
+ "plugin": [
30
+ "dist/plugin.d.ts"
31
+ ],
32
+ "": [
33
+ "dist/index.d.ts"
34
+ ]
35
+ }
36
+ },
37
+ "exports": {
38
+ ".": {
39
+ "types": "./dist/index.d.ts",
40
+ "import": "./dist/index.mjs",
41
+ "require": "./dist/index.cjs"
42
+ },
43
+ "./plugin": {
44
+ "types": "./dist/plugin.d.ts",
45
+ "import": "./dist/plugin.mjs",
46
+ "require": "./dist/plugin.cjs"
47
+ },
48
+ "./package.json": "./package.json"
49
+ },
50
+ "devDependencies": {
51
+ "mysql2": "^3.11.0",
52
+ "vitest": "3.2.4"
53
+ },
54
+ "peerDependencies": {
55
+ "@uniqu/core": "^0.1.2",
56
+ "mysql2": ">=3.0.0",
57
+ "@atscript/core": "^0.1.38",
58
+ "@atscript/typescript": "^0.1.38",
59
+ "@atscript/db": "^0.1.38",
60
+ "@atscript/db-sql-tools": "^0.1.38"
61
+ },
62
+ "peerDependenciesMeta": {
63
+ "mysql2": {
64
+ "optional": true
65
+ }
66
+ },
67
+ "build": [
68
+ {},
69
+ {
70
+ "entries": [
71
+ "src/plugin.ts"
72
+ ],
73
+ "dts": true
74
+ }
75
+ ],
76
+ "scripts": {
77
+ "pub": "pnpm publish --access public",
78
+ "test": "vitest"
79
+ }
80
+ }