@atscript/db-postgres 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.
- package/LICENSE +21 -0
- package/dist/index.cjs +1354 -0
- package/dist/index.d.ts +278 -0
- package/dist/index.mjs +1326 -0
- package/dist/plugin.cjs +73 -0
- package/dist/plugin.d.ts +5 -0
- package/dist/plugin.mjs +47 -0
- package/package.json +83 -0
package/dist/plugin.cjs
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
3
|
+
//#region rolldown:runtime
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
|
+
value: mod,
|
|
22
|
+
enumerable: true
|
|
23
|
+
}) : target, mod));
|
|
24
|
+
|
|
25
|
+
//#endregion
|
|
26
|
+
const __atscript_core = __toESM(require("@atscript/core"));
|
|
27
|
+
|
|
28
|
+
//#region packages/db-postgres/src/plugin/annotations.ts
|
|
29
|
+
const annotations = {
|
|
30
|
+
type: new __atscript_core.AnnotationSpec({
|
|
31
|
+
description: "Overrides the native PostgreSQL column type.\n\n```atscript\n@db.pg.type \"CITEXT\"\nname: string\n```",
|
|
32
|
+
nodeType: ["prop"],
|
|
33
|
+
multiple: false,
|
|
34
|
+
argument: {
|
|
35
|
+
name: "type",
|
|
36
|
+
type: "string",
|
|
37
|
+
description: "Native PostgreSQL column type (e.g., \"CITEXT\", \"INET\", \"MACADDR\")."
|
|
38
|
+
}
|
|
39
|
+
}),
|
|
40
|
+
schema: new __atscript_core.AnnotationSpec({
|
|
41
|
+
description: "Specifies the PostgreSQL schema for the table.\n\n**Default:** `\"public\"`\n\n```atscript\n@db.pg.schema \"analytics\"\nexport interface Events { ... }\n```",
|
|
42
|
+
nodeType: ["interface"],
|
|
43
|
+
multiple: false,
|
|
44
|
+
argument: {
|
|
45
|
+
name: "schema",
|
|
46
|
+
type: "string",
|
|
47
|
+
description: "PostgreSQL schema name (e.g., \"public\", \"analytics\")."
|
|
48
|
+
}
|
|
49
|
+
}),
|
|
50
|
+
collate: new __atscript_core.AnnotationSpec({
|
|
51
|
+
description: "Specifies a native PostgreSQL collation (overrides portable `@db.column.collate`).\n\n```atscript\n@db.pg.collate \"tr-x-icu\"\nname: string\n```",
|
|
52
|
+
nodeType: ["interface", "prop"],
|
|
53
|
+
multiple: false,
|
|
54
|
+
argument: {
|
|
55
|
+
name: "collation",
|
|
56
|
+
type: "string",
|
|
57
|
+
description: "Native PostgreSQL collation name (e.g., \"tr-x-icu\", \"C\", \"und-x-icu\")."
|
|
58
|
+
}
|
|
59
|
+
})
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
//#region packages/db-postgres/src/plugin/index.ts
|
|
64
|
+
const PostgresPlugin = () => ({
|
|
65
|
+
name: "postgres",
|
|
66
|
+
config() {
|
|
67
|
+
return { annotations: { db: { pg: annotations } } };
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
//#endregion
|
|
72
|
+
exports.PostgresPlugin = PostgresPlugin
|
|
73
|
+
exports.default = PostgresPlugin
|
package/dist/plugin.d.ts
ADDED
package/dist/plugin.mjs
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { AnnotationSpec } from "@atscript/core";
|
|
2
|
+
|
|
3
|
+
//#region packages/db-postgres/src/plugin/annotations.ts
|
|
4
|
+
const annotations = {
|
|
5
|
+
type: new AnnotationSpec({
|
|
6
|
+
description: "Overrides the native PostgreSQL column type.\n\n```atscript\n@db.pg.type \"CITEXT\"\nname: string\n```",
|
|
7
|
+
nodeType: ["prop"],
|
|
8
|
+
multiple: false,
|
|
9
|
+
argument: {
|
|
10
|
+
name: "type",
|
|
11
|
+
type: "string",
|
|
12
|
+
description: "Native PostgreSQL column type (e.g., \"CITEXT\", \"INET\", \"MACADDR\")."
|
|
13
|
+
}
|
|
14
|
+
}),
|
|
15
|
+
schema: new AnnotationSpec({
|
|
16
|
+
description: "Specifies the PostgreSQL schema for the table.\n\n**Default:** `\"public\"`\n\n```atscript\n@db.pg.schema \"analytics\"\nexport interface Events { ... }\n```",
|
|
17
|
+
nodeType: ["interface"],
|
|
18
|
+
multiple: false,
|
|
19
|
+
argument: {
|
|
20
|
+
name: "schema",
|
|
21
|
+
type: "string",
|
|
22
|
+
description: "PostgreSQL schema name (e.g., \"public\", \"analytics\")."
|
|
23
|
+
}
|
|
24
|
+
}),
|
|
25
|
+
collate: new AnnotationSpec({
|
|
26
|
+
description: "Specifies a native PostgreSQL collation (overrides portable `@db.column.collate`).\n\n```atscript\n@db.pg.collate \"tr-x-icu\"\nname: string\n```",
|
|
27
|
+
nodeType: ["interface", "prop"],
|
|
28
|
+
multiple: false,
|
|
29
|
+
argument: {
|
|
30
|
+
name: "collation",
|
|
31
|
+
type: "string",
|
|
32
|
+
description: "Native PostgreSQL collation name (e.g., \"tr-x-icu\", \"C\", \"und-x-icu\")."
|
|
33
|
+
}
|
|
34
|
+
})
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
//#endregion
|
|
38
|
+
//#region packages/db-postgres/src/plugin/index.ts
|
|
39
|
+
const PostgresPlugin = () => ({
|
|
40
|
+
name: "postgres",
|
|
41
|
+
config() {
|
|
42
|
+
return { annotations: { db: { pg: annotations } } };
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
//#endregion
|
|
47
|
+
export { PostgresPlugin, PostgresPlugin as default };
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@atscript/db-postgres",
|
|
3
|
+
"version": "0.1.38",
|
|
4
|
+
"description": "PostgreSQL adapter for @atscript/db with pg (node-postgres) driver support.",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"atscript",
|
|
7
|
+
"database",
|
|
8
|
+
"postgresql",
|
|
9
|
+
"postgres",
|
|
10
|
+
"pgvector"
|
|
11
|
+
],
|
|
12
|
+
"homepage": "https://github.com/moostjs/atscript/tree/main/packages/db-postgres#readme",
|
|
13
|
+
"bugs": {
|
|
14
|
+
"url": "https://github.com/moostjs/atscript/issues"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "Artem Maltsev",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/moostjs/atscript.git",
|
|
21
|
+
"directory": "packages/db-postgres"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"main": "dist/index.mjs",
|
|
28
|
+
"types": "dist/index.d.ts",
|
|
29
|
+
"typesVersions": {
|
|
30
|
+
"*": {
|
|
31
|
+
"plugin": [
|
|
32
|
+
"dist/plugin.d.ts"
|
|
33
|
+
],
|
|
34
|
+
"": [
|
|
35
|
+
"dist/index.d.ts"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"exports": {
|
|
40
|
+
".": {
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
42
|
+
"import": "./dist/index.mjs",
|
|
43
|
+
"require": "./dist/index.cjs"
|
|
44
|
+
},
|
|
45
|
+
"./plugin": {
|
|
46
|
+
"types": "./dist/plugin.d.ts",
|
|
47
|
+
"import": "./dist/plugin.mjs",
|
|
48
|
+
"require": "./dist/plugin.cjs"
|
|
49
|
+
},
|
|
50
|
+
"./package.json": "./package.json"
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"pg": "^8.13.0",
|
|
54
|
+
"@types/pg": "^8.11.0",
|
|
55
|
+
"vitest": "3.2.4"
|
|
56
|
+
},
|
|
57
|
+
"peerDependencies": {
|
|
58
|
+
"@uniqu/core": "^0.1.2",
|
|
59
|
+
"pg": ">=8.0.0",
|
|
60
|
+
"@atscript/db": "^0.1.38",
|
|
61
|
+
"@atscript/typescript": "^0.1.38",
|
|
62
|
+
"@atscript/core": "^0.1.38",
|
|
63
|
+
"@atscript/db-sql-tools": "^0.1.38"
|
|
64
|
+
},
|
|
65
|
+
"peerDependenciesMeta": {
|
|
66
|
+
"pg": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"build": [
|
|
71
|
+
{},
|
|
72
|
+
{
|
|
73
|
+
"entries": [
|
|
74
|
+
"src/plugin.ts"
|
|
75
|
+
],
|
|
76
|
+
"dts": true
|
|
77
|
+
}
|
|
78
|
+
],
|
|
79
|
+
"scripts": {
|
|
80
|
+
"pub": "pnpm publish --access public",
|
|
81
|
+
"test": "vitest"
|
|
82
|
+
}
|
|
83
|
+
}
|