@atscript/db-mysql 0.1.39 → 0.1.40

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,93 @@
1
+ import { AnnotationSpec } from "@atscript/core";
2
+ //#region src/plugin/annotations.ts
3
+ /**
4
+ * MySQL-specific annotations.
5
+ *
6
+ * Merged into the global config under `{ db: { mysql: ... } }` so they
7
+ * live alongside core's `@db.table`, `@db.index.*`, etc.
8
+ *
9
+ * These annotations opt-in to MySQL-specific behavior. Files using only
10
+ * portable `@db.*` annotations remain adapter-agnostic.
11
+ */
12
+ const annotations = {
13
+ engine: new AnnotationSpec({
14
+ description: "Specifies the MySQL storage engine.\n\n**Default:** `\"InnoDB\"`\n\n```atscript\n@db.mysql.engine \"MyISAM\"\nexport interface Logs { ... }\n```",
15
+ nodeType: ["interface"],
16
+ multiple: false,
17
+ argument: {
18
+ name: "engine",
19
+ type: "string",
20
+ values: [
21
+ "InnoDB",
22
+ "MyISAM",
23
+ "MEMORY",
24
+ "CSV",
25
+ "ARCHIVE"
26
+ ],
27
+ description: "MySQL storage engine name."
28
+ }
29
+ }),
30
+ charset: new AnnotationSpec({
31
+ 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```",
32
+ nodeType: ["interface", "prop"],
33
+ multiple: false,
34
+ argument: {
35
+ name: "charset",
36
+ type: "string",
37
+ values: [
38
+ "utf8mb4",
39
+ "utf8",
40
+ "latin1",
41
+ "ascii",
42
+ "binary"
43
+ ],
44
+ description: "MySQL character set name."
45
+ }
46
+ }),
47
+ collate: new AnnotationSpec({
48
+ description: "Specifies a native MySQL collation (overrides portable `@db.column.collate`).\n\n```atscript\n@db.mysql.collate \"utf8mb4_turkish_ci\"\nname: string\n```",
49
+ nodeType: ["interface", "prop"],
50
+ multiple: false,
51
+ argument: {
52
+ name: "collation",
53
+ type: "string",
54
+ description: "Native MySQL collation name (e.g., \"utf8mb4_turkish_ci\")."
55
+ }
56
+ }),
57
+ unsigned: new AnnotationSpec({
58
+ description: "Adds the UNSIGNED modifier to an integer column.\n\n```atscript\n@db.mysql.unsigned\nage: number.int\n```",
59
+ nodeType: ["prop"],
60
+ multiple: false
61
+ }),
62
+ type: new AnnotationSpec({
63
+ description: "Overrides the native MySQL column type.\n\n```atscript\n@db.mysql.type \"MEDIUMTEXT\"\nbio: string\n```",
64
+ nodeType: ["prop"],
65
+ multiple: false,
66
+ argument: {
67
+ name: "type",
68
+ type: "string",
69
+ description: "Native MySQL column type (e.g., \"MEDIUMTEXT\", \"TINYTEXT\")."
70
+ }
71
+ }),
72
+ onUpdate: new AnnotationSpec({
73
+ description: "Sets the MySQL ON UPDATE clause for a column.\n\n```atscript\n@db.mysql.onUpdate \"CURRENT_TIMESTAMP\"\nupdatedAt: number.timestamp\n```",
74
+ nodeType: ["prop"],
75
+ multiple: false,
76
+ argument: {
77
+ name: "expression",
78
+ type: "string",
79
+ values: ["CURRENT_TIMESTAMP"],
80
+ description: "Expression to evaluate on row update."
81
+ }
82
+ })
83
+ };
84
+ //#endregion
85
+ //#region src/plugin/index.ts
86
+ const MysqlPlugin = () => ({
87
+ name: "mysql",
88
+ config() {
89
+ return { annotations: { db: { mysql: annotations } } };
90
+ }
91
+ });
92
+ //#endregion
93
+ export { MysqlPlugin as t };
@@ -0,0 +1,98 @@
1
+ let _atscript_core = require("@atscript/core");
2
+ //#region src/plugin/annotations.ts
3
+ /**
4
+ * MySQL-specific annotations.
5
+ *
6
+ * Merged into the global config under `{ db: { mysql: ... } }` so they
7
+ * live alongside core's `@db.table`, `@db.index.*`, etc.
8
+ *
9
+ * These annotations opt-in to MySQL-specific behavior. Files using only
10
+ * portable `@db.*` annotations remain adapter-agnostic.
11
+ */
12
+ const annotations = {
13
+ engine: new _atscript_core.AnnotationSpec({
14
+ description: "Specifies the MySQL storage engine.\n\n**Default:** `\"InnoDB\"`\n\n```atscript\n@db.mysql.engine \"MyISAM\"\nexport interface Logs { ... }\n```",
15
+ nodeType: ["interface"],
16
+ multiple: false,
17
+ argument: {
18
+ name: "engine",
19
+ type: "string",
20
+ values: [
21
+ "InnoDB",
22
+ "MyISAM",
23
+ "MEMORY",
24
+ "CSV",
25
+ "ARCHIVE"
26
+ ],
27
+ description: "MySQL storage engine name."
28
+ }
29
+ }),
30
+ charset: new _atscript_core.AnnotationSpec({
31
+ 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```",
32
+ nodeType: ["interface", "prop"],
33
+ multiple: false,
34
+ argument: {
35
+ name: "charset",
36
+ type: "string",
37
+ values: [
38
+ "utf8mb4",
39
+ "utf8",
40
+ "latin1",
41
+ "ascii",
42
+ "binary"
43
+ ],
44
+ description: "MySQL character set name."
45
+ }
46
+ }),
47
+ collate: new _atscript_core.AnnotationSpec({
48
+ description: "Specifies a native MySQL collation (overrides portable `@db.column.collate`).\n\n```atscript\n@db.mysql.collate \"utf8mb4_turkish_ci\"\nname: string\n```",
49
+ nodeType: ["interface", "prop"],
50
+ multiple: false,
51
+ argument: {
52
+ name: "collation",
53
+ type: "string",
54
+ description: "Native MySQL collation name (e.g., \"utf8mb4_turkish_ci\")."
55
+ }
56
+ }),
57
+ unsigned: new _atscript_core.AnnotationSpec({
58
+ description: "Adds the UNSIGNED modifier to an integer column.\n\n```atscript\n@db.mysql.unsigned\nage: number.int\n```",
59
+ nodeType: ["prop"],
60
+ multiple: false
61
+ }),
62
+ type: new _atscript_core.AnnotationSpec({
63
+ description: "Overrides the native MySQL column type.\n\n```atscript\n@db.mysql.type \"MEDIUMTEXT\"\nbio: string\n```",
64
+ nodeType: ["prop"],
65
+ multiple: false,
66
+ argument: {
67
+ name: "type",
68
+ type: "string",
69
+ description: "Native MySQL column type (e.g., \"MEDIUMTEXT\", \"TINYTEXT\")."
70
+ }
71
+ }),
72
+ onUpdate: new _atscript_core.AnnotationSpec({
73
+ description: "Sets the MySQL ON UPDATE clause for a column.\n\n```atscript\n@db.mysql.onUpdate \"CURRENT_TIMESTAMP\"\nupdatedAt: number.timestamp\n```",
74
+ nodeType: ["prop"],
75
+ multiple: false,
76
+ argument: {
77
+ name: "expression",
78
+ type: "string",
79
+ values: ["CURRENT_TIMESTAMP"],
80
+ description: "Expression to evaluate on row update."
81
+ }
82
+ })
83
+ };
84
+ //#endregion
85
+ //#region src/plugin/index.ts
86
+ const MysqlPlugin = () => ({
87
+ name: "mysql",
88
+ config() {
89
+ return { annotations: { db: { mysql: annotations } } };
90
+ }
91
+ });
92
+ //#endregion
93
+ Object.defineProperty(exports, "MysqlPlugin", {
94
+ enumerable: true,
95
+ get: function() {
96
+ return MysqlPlugin;
97
+ }
98
+ });
package/dist/plugin.cjs CHANGED
@@ -1,111 +1,3 @@
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
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ const require_plugin = require("./plugin-C53PKZHf.cjs");
3
+ exports.MysqlPlugin = require_plugin.MysqlPlugin;
@@ -0,0 +1,2 @@
1
+ import { t as MysqlPlugin } from "./index-O193LJVT.cjs";
2
+ export { MysqlPlugin };
@@ -0,0 +1,2 @@
1
+ import { t as MysqlPlugin } from "./index-B1N7X623.mjs";
2
+ export { MysqlPlugin };
package/dist/plugin.mjs CHANGED
@@ -1,87 +1,2 @@
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 };
1
+ import { t as MysqlPlugin } from "./plugin-3jLlPI4f.mjs";
2
+ export { MysqlPlugin };
package/package.json CHANGED
@@ -1,21 +1,21 @@
1
1
  {
2
2
  "name": "@atscript/db-mysql",
3
- "version": "0.1.39",
3
+ "version": "0.1.40",
4
4
  "description": "MySQL adapter for @atscript/db with mysql2 driver support.",
5
5
  "keywords": [
6
6
  "atscript",
7
7
  "database",
8
8
  "mysql"
9
9
  ],
10
- "homepage": "https://github.com/moostjs/atscript/tree/main/packages/db-mysql#readme",
10
+ "homepage": "https://github.com/moostjs/atscript-db/tree/main/packages/db-mysql#readme",
11
11
  "bugs": {
12
- "url": "https://github.com/moostjs/atscript/issues"
12
+ "url": "https://github.com/moostjs/atscript-db/issues"
13
13
  },
14
14
  "license": "MIT",
15
15
  "author": "Artem Maltsev",
16
16
  "repository": {
17
17
  "type": "git",
18
- "url": "git+https://github.com/moostjs/atscript.git",
18
+ "url": "git+https://github.com/moostjs/atscript-db.git",
19
19
  "directory": "packages/db-mysql"
20
20
  },
21
21
  "files": [
@@ -23,58 +23,48 @@
23
23
  ],
24
24
  "type": "module",
25
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
- },
26
+ "types": "dist/index.d.mts",
37
27
  "exports": {
38
28
  ".": {
39
- "types": "./dist/index.d.ts",
29
+ "types": "./dist/index.d.mts",
40
30
  "import": "./dist/index.mjs",
41
31
  "require": "./dist/index.cjs"
42
32
  },
43
33
  "./plugin": {
44
- "types": "./dist/plugin.d.ts",
34
+ "types": "./dist/plugin.d.mts",
45
35
  "import": "./dist/plugin.mjs",
46
36
  "require": "./dist/plugin.cjs"
47
37
  },
48
38
  "./package.json": "./package.json"
49
39
  },
40
+ "publishConfig": {
41
+ "access": "public"
42
+ },
50
43
  "devDependencies": {
44
+ "@atscript/core": "^0.1.39",
45
+ "@atscript/typescript": "^0.1.39",
46
+ "@uniqu/core": "^0.1.2",
51
47
  "mysql2": "^3.11.0",
52
- "vitest": "3.2.4"
48
+ "unplugin-atscript": "^0.1.39"
53
49
  },
54
50
  "peerDependencies": {
55
- "@uniqu/core": "^0.1.2",
56
- "mysql2": ">=3.0.0",
57
51
  "@atscript/core": "^0.1.39",
58
52
  "@atscript/typescript": "^0.1.39",
59
- "@atscript/db-sql-tools": "^0.1.39",
60
- "@atscript/db": "^0.1.39"
53
+ "@uniqu/core": "^0.1.2",
54
+ "mysql2": ">=3.0.0",
55
+ "@atscript/db": "^0.1.40",
56
+ "@atscript/db-sql-tools": "^0.1.40"
61
57
  },
62
58
  "peerDependenciesMeta": {
63
59
  "mysql2": {
64
60
  "optional": true
65
61
  }
66
62
  },
67
- "build": [
68
- {},
69
- {
70
- "entries": [
71
- "src/plugin.ts"
72
- ],
73
- "dts": true
74
- }
75
- ],
76
63
  "scripts": {
77
- "pub": "pnpm publish --access public",
78
- "test": "vitest"
64
+ "postinstall": "asc -f dts",
65
+ "build": "vp pack",
66
+ "dev": "vp pack --watch",
67
+ "test": "vp test",
68
+ "check": "vp check"
79
69
  }
80
70
  }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025-present Artem Maltsev
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.