@atscript/db-postgres 0.1.103 → 0.1.105

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/index.cjs CHANGED
@@ -1,5 +1,4 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_plugin = require("./plugin-D8KAYro7.cjs");
3
2
  let _atscript_db = require("@atscript/db");
4
3
  let _atscript_db_sql_tools = require("@atscript/db-sql-tools");
5
4
  //#region src/sql-builder.ts
@@ -832,6 +831,7 @@ var PostgresAdapter = class PostgresAdapter extends _atscript_db.BaseDbAdapter {
832
831
  await this._exec().exec(ddl);
833
832
  }
834
833
  typeMapper(field) {
834
+ if (field.encrypted) return "TEXT";
835
835
  if (this._vectorFields.has(field.path)) {
836
836
  const vec = this._vectorFields.get(field.path);
837
837
  return this._supportsVector ? `vector(${vec.dimensions})` : "JSONB";
@@ -862,6 +862,10 @@ var PostgresAdapter = class PostgresAdapter extends _atscript_db.BaseDbAdapter {
862
862
  const sql = `DROP INDEX IF EXISTS ${schema ? `${qi(schema)}.` : ""}${qi(name)}`;
863
863
  this._log(sql);
864
864
  await this._exec().exec(sql);
865
+ },
866
+ warnUnsupportedTypes: {
867
+ adapter: "postgres",
868
+ types: ["geo"]
865
869
  }
866
870
  });
867
871
  if (this._supportsVector) for (const [field, vec] of this._vectorFields) {
@@ -1360,6 +1364,5 @@ function createAdapter(uri, options) {
1360
1364
  //#endregion
1361
1365
  exports.PgDriver = PgDriver;
1362
1366
  exports.PostgresAdapter = PostgresAdapter;
1363
- exports.PostgresPlugin = require_plugin.PostgresPlugin;
1364
1367
  exports.buildWhere = buildWhere;
1365
1368
  exports.createAdapter = createAdapter;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,3 @@
1
- import { t as PostgresPlugin } from "./index-Cky7JZNO.cjs";
2
1
  import { BaseDbAdapter, DbQuery, DbSpace, FilterExpr, TColumnDiff, TDbDefaultFn, TDbDeleteResult, TDbFieldMeta, TDbInsertManyResult, TDbInsertResult, TDbUpdateResult, TExistingColumn, TFieldOps, TSearchIndexInfo, TSyncColumnResult, TValueFormatterPair } from "@atscript/db";
3
2
  import { TMetadataMap } from "@atscript/typescript/utils";
4
3
  import { TSqlFragment } from "@atscript/db-sql-tools";
@@ -275,4 +274,4 @@ declare function buildWhere(filter: FilterExpr): TSqlFragment;
275
274
  */
276
275
  declare function createAdapter(uri: string, options?: Record<string, unknown>): DbSpace;
277
276
  //#endregion
278
- export { PgDriver, PostgresAdapter, PostgresPlugin, type TPgConnection, type TPgDriver, type TPgRunResult, type TSqlFragment, buildWhere, createAdapter };
277
+ export { PgDriver, PostgresAdapter, type TPgConnection, type TPgDriver, type TPgRunResult, type TSqlFragment, buildWhere, createAdapter };
package/dist/index.d.mts CHANGED
@@ -1,4 +1,3 @@
1
- import { t as PostgresPlugin } from "./index-Cky7JZNO.mjs";
2
1
  import { BaseDbAdapter, DbQuery, DbSpace, FilterExpr, TColumnDiff, TDbDefaultFn, TDbDeleteResult, TDbFieldMeta, TDbInsertManyResult, TDbInsertResult, TDbUpdateResult, TExistingColumn, TFieldOps, TSearchIndexInfo, TSyncColumnResult, TValueFormatterPair } from "@atscript/db";
3
2
  import { TSqlFragment } from "@atscript/db-sql-tools";
4
3
  import { TMetadataMap } from "@atscript/typescript/utils";
@@ -275,4 +274,4 @@ declare function buildWhere(filter: FilterExpr): TSqlFragment;
275
274
  */
276
275
  declare function createAdapter(uri: string, options?: Record<string, unknown>): DbSpace;
277
276
  //#endregion
278
- export { PgDriver, PostgresAdapter, PostgresPlugin, type TPgConnection, type TPgDriver, type TPgRunResult, type TSqlFragment, buildWhere, createAdapter };
277
+ export { PgDriver, PostgresAdapter, type TPgConnection, type TPgDriver, type TPgRunResult, type TSqlFragment, buildWhere, createAdapter };
package/dist/index.mjs CHANGED
@@ -1,4 +1,3 @@
1
- import { t as PostgresPlugin } from "./plugin-CAuSb5sS.mjs";
2
1
  import { AtscriptDbView, BaseDbAdapter, DbError, DbSpace } from "@atscript/db";
3
2
  import { buildAggregateCount, buildAggregateSelect, buildCreateView, buildDelete, buildInsert, buildSelect, buildUpdate, buildWhere as buildWhere$1, defaultValueForType, defaultValueToSqlLiteral, finalizeParams, parseRegexString, refActionToSql } from "@atscript/db-sql-tools";
4
3
  //#region src/sql-builder.ts
@@ -831,6 +830,7 @@ var PostgresAdapter = class PostgresAdapter extends BaseDbAdapter {
831
830
  await this._exec().exec(ddl);
832
831
  }
833
832
  typeMapper(field) {
833
+ if (field.encrypted) return "TEXT";
834
834
  if (this._vectorFields.has(field.path)) {
835
835
  const vec = this._vectorFields.get(field.path);
836
836
  return this._supportsVector ? `vector(${vec.dimensions})` : "JSONB";
@@ -861,6 +861,10 @@ var PostgresAdapter = class PostgresAdapter extends BaseDbAdapter {
861
861
  const sql = `DROP INDEX IF EXISTS ${schema ? `${qi(schema)}.` : ""}${qi(name)}`;
862
862
  this._log(sql);
863
863
  await this._exec().exec(sql);
864
+ },
865
+ warnUnsupportedTypes: {
866
+ adapter: "postgres",
867
+ types: ["geo"]
864
868
  }
865
869
  });
866
870
  if (this._supportsVector) for (const [field, vec] of this._vectorFields) {
@@ -1357,4 +1361,4 @@ function createAdapter(uri, options) {
1357
1361
  return new DbSpace(() => new PostgresAdapter(driver));
1358
1362
  }
1359
1363
  //#endregion
1360
- export { PgDriver, PostgresAdapter, PostgresPlugin, buildWhere, createAdapter };
1364
+ export { PgDriver, PostgresAdapter, buildWhere, createAdapter };
package/dist/plugin.cjs CHANGED
@@ -2,6 +2,57 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_plugin = require("./plugin-D8KAYro7.cjs");
6
- exports.PostgresPlugin = require_plugin.PostgresPlugin;
7
- exports.default = require_plugin.PostgresPlugin;
5
+ let _atscript_core = require("@atscript/core");
6
+ //#region src/plugin/annotations.ts
7
+ /**
8
+ * PostgreSQL-specific annotations.
9
+ *
10
+ * Merged into the global config under `{ db: { pg: ... } }` so they
11
+ * live alongside core's `@db.table`, `@db.index.*`, etc.
12
+ *
13
+ * These annotations opt-in to PostgreSQL-specific behavior. Files using only
14
+ * portable `@db.*` annotations remain adapter-agnostic.
15
+ */
16
+ const annotations = {
17
+ type: new _atscript_core.AnnotationSpec({
18
+ description: "Overrides the native PostgreSQL column type.\n\n```atscript\n@db.pg.type \"CITEXT\"\nname: string\n```",
19
+ nodeType: ["prop"],
20
+ multiple: false,
21
+ argument: {
22
+ name: "type",
23
+ type: "string",
24
+ description: "Native PostgreSQL column type (e.g., \"CITEXT\", \"INET\", \"MACADDR\")."
25
+ }
26
+ }),
27
+ schema: new _atscript_core.AnnotationSpec({
28
+ description: "Specifies the PostgreSQL schema for the table.\n\n**Default:** `\"public\"`\n\n```atscript\n@db.pg.schema \"analytics\"\nexport interface Events { ... }\n```",
29
+ nodeType: ["interface"],
30
+ multiple: false,
31
+ argument: {
32
+ name: "schema",
33
+ type: "string",
34
+ description: "PostgreSQL schema name (e.g., \"public\", \"analytics\")."
35
+ }
36
+ }),
37
+ collate: new _atscript_core.AnnotationSpec({
38
+ description: "Specifies a native PostgreSQL collation (overrides portable `@db.column.collate`).\n\n```atscript\n@db.pg.collate \"tr-x-icu\"\nname: string\n```",
39
+ nodeType: ["interface", "prop"],
40
+ multiple: false,
41
+ argument: {
42
+ name: "collation",
43
+ type: "string",
44
+ description: "Native PostgreSQL collation name (e.g., \"tr-x-icu\", \"C\", \"und-x-icu\")."
45
+ }
46
+ })
47
+ };
48
+ //#endregion
49
+ //#region src/plugin/index.ts
50
+ const PostgresPlugin = () => ({
51
+ name: "postgres",
52
+ config() {
53
+ return { annotations: { db: { pg: annotations } } };
54
+ }
55
+ });
56
+ //#endregion
57
+ exports.PostgresPlugin = PostgresPlugin;
58
+ exports.default = PostgresPlugin;
package/dist/plugin.d.cts CHANGED
@@ -1,2 +1,6 @@
1
- import { t as PostgresPlugin } from "./index-Cky7JZNO.cjs";
1
+ import { TAtscriptPlugin } from "@atscript/core";
2
+
3
+ //#region src/plugin/index.d.ts
4
+ declare const PostgresPlugin: () => TAtscriptPlugin;
5
+ //#endregion
2
6
  export { PostgresPlugin, PostgresPlugin as default };
package/dist/plugin.d.mts CHANGED
@@ -1,2 +1,6 @@
1
- import { t as PostgresPlugin } from "./index-Cky7JZNO.mjs";
1
+ import { TAtscriptPlugin } from "@atscript/core";
2
+
3
+ //#region src/plugin/index.d.ts
4
+ declare const PostgresPlugin: () => TAtscriptPlugin;
5
+ //#endregion
2
6
  export { PostgresPlugin, PostgresPlugin as default };
package/dist/plugin.mjs CHANGED
@@ -1,2 +1,53 @@
1
- import { t as PostgresPlugin } from "./plugin-CAuSb5sS.mjs";
1
+ import { AnnotationSpec } from "@atscript/core";
2
+ //#region src/plugin/annotations.ts
3
+ /**
4
+ * PostgreSQL-specific annotations.
5
+ *
6
+ * Merged into the global config under `{ db: { pg: ... } }` so they
7
+ * live alongside core's `@db.table`, `@db.index.*`, etc.
8
+ *
9
+ * These annotations opt-in to PostgreSQL-specific behavior. Files using only
10
+ * portable `@db.*` annotations remain adapter-agnostic.
11
+ */
12
+ const annotations = {
13
+ type: new AnnotationSpec({
14
+ description: "Overrides the native PostgreSQL column type.\n\n```atscript\n@db.pg.type \"CITEXT\"\nname: string\n```",
15
+ nodeType: ["prop"],
16
+ multiple: false,
17
+ argument: {
18
+ name: "type",
19
+ type: "string",
20
+ description: "Native PostgreSQL column type (e.g., \"CITEXT\", \"INET\", \"MACADDR\")."
21
+ }
22
+ }),
23
+ schema: new AnnotationSpec({
24
+ description: "Specifies the PostgreSQL schema for the table.\n\n**Default:** `\"public\"`\n\n```atscript\n@db.pg.schema \"analytics\"\nexport interface Events { ... }\n```",
25
+ nodeType: ["interface"],
26
+ multiple: false,
27
+ argument: {
28
+ name: "schema",
29
+ type: "string",
30
+ description: "PostgreSQL schema name (e.g., \"public\", \"analytics\")."
31
+ }
32
+ }),
33
+ collate: new AnnotationSpec({
34
+ description: "Specifies a native PostgreSQL collation (overrides portable `@db.column.collate`).\n\n```atscript\n@db.pg.collate \"tr-x-icu\"\nname: string\n```",
35
+ nodeType: ["interface", "prop"],
36
+ multiple: false,
37
+ argument: {
38
+ name: "collation",
39
+ type: "string",
40
+ description: "Native PostgreSQL collation name (e.g., \"tr-x-icu\", \"C\", \"und-x-icu\")."
41
+ }
42
+ })
43
+ };
44
+ //#endregion
45
+ //#region src/plugin/index.ts
46
+ const PostgresPlugin = () => ({
47
+ name: "postgres",
48
+ config() {
49
+ return { annotations: { db: { pg: annotations } } };
50
+ }
51
+ });
52
+ //#endregion
2
53
  export { PostgresPlugin, PostgresPlugin as default };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atscript/db-postgres",
3
- "version": "0.1.103",
3
+ "version": "0.1.105",
4
4
  "description": "PostgreSQL adapter for @atscript/db with pg (node-postgres) driver support.",
5
5
  "keywords": [
6
6
  "atscript",
@@ -43,20 +43,20 @@
43
43
  "access": "public"
44
44
  },
45
45
  "devDependencies": {
46
- "@atscript/core": "^0.1.75",
47
- "@atscript/typescript": "^0.1.75",
46
+ "@atscript/core": "^0.1.76",
47
+ "@atscript/typescript": "^0.1.76",
48
48
  "@types/pg": "^8.11.0",
49
49
  "@uniqu/core": "^0.1.6",
50
50
  "pg": "^8.13.0",
51
- "unplugin-atscript": "^0.1.75"
51
+ "unplugin-atscript": "^0.1.76"
52
52
  },
53
53
  "peerDependencies": {
54
- "@atscript/core": "^0.1.75",
55
- "@atscript/typescript": "^0.1.75",
54
+ "@atscript/core": "^0.1.76",
55
+ "@atscript/typescript": "^0.1.76",
56
56
  "@uniqu/core": "^0.1.6",
57
57
  "pg": ">=8.0.0",
58
- "@atscript/db": "^0.1.103",
59
- "@atscript/db-sql-tools": "^0.1.103"
58
+ "@atscript/db": "^0.1.105",
59
+ "@atscript/db-sql-tools": "^0.1.105"
60
60
  },
61
61
  "peerDependenciesMeta": {
62
62
  "pg": {
@@ -1,6 +0,0 @@
1
- import { TAtscriptPlugin } from "@atscript/core";
2
-
3
- //#region src/plugin/index.d.ts
4
- declare const PostgresPlugin: () => TAtscriptPlugin;
5
- //#endregion
6
- export { PostgresPlugin as t };
@@ -1,6 +0,0 @@
1
- import { TAtscriptPlugin } from "@atscript/core";
2
-
3
- //#region src/plugin/index.d.ts
4
- declare const PostgresPlugin: () => TAtscriptPlugin;
5
- //#endregion
6
- export { PostgresPlugin as t };
@@ -1,53 +0,0 @@
1
- import { AnnotationSpec } from "@atscript/core";
2
- //#region src/plugin/annotations.ts
3
- /**
4
- * PostgreSQL-specific annotations.
5
- *
6
- * Merged into the global config under `{ db: { pg: ... } }` so they
7
- * live alongside core's `@db.table`, `@db.index.*`, etc.
8
- *
9
- * These annotations opt-in to PostgreSQL-specific behavior. Files using only
10
- * portable `@db.*` annotations remain adapter-agnostic.
11
- */
12
- const annotations = {
13
- type: new AnnotationSpec({
14
- description: "Overrides the native PostgreSQL column type.\n\n```atscript\n@db.pg.type \"CITEXT\"\nname: string\n```",
15
- nodeType: ["prop"],
16
- multiple: false,
17
- argument: {
18
- name: "type",
19
- type: "string",
20
- description: "Native PostgreSQL column type (e.g., \"CITEXT\", \"INET\", \"MACADDR\")."
21
- }
22
- }),
23
- schema: new AnnotationSpec({
24
- description: "Specifies the PostgreSQL schema for the table.\n\n**Default:** `\"public\"`\n\n```atscript\n@db.pg.schema \"analytics\"\nexport interface Events { ... }\n```",
25
- nodeType: ["interface"],
26
- multiple: false,
27
- argument: {
28
- name: "schema",
29
- type: "string",
30
- description: "PostgreSQL schema name (e.g., \"public\", \"analytics\")."
31
- }
32
- }),
33
- collate: new AnnotationSpec({
34
- description: "Specifies a native PostgreSQL collation (overrides portable `@db.column.collate`).\n\n```atscript\n@db.pg.collate \"tr-x-icu\"\nname: string\n```",
35
- nodeType: ["interface", "prop"],
36
- multiple: false,
37
- argument: {
38
- name: "collation",
39
- type: "string",
40
- description: "Native PostgreSQL collation name (e.g., \"tr-x-icu\", \"C\", \"und-x-icu\")."
41
- }
42
- })
43
- };
44
- //#endregion
45
- //#region src/plugin/index.ts
46
- const PostgresPlugin = () => ({
47
- name: "postgres",
48
- config() {
49
- return { annotations: { db: { pg: annotations } } };
50
- }
51
- });
52
- //#endregion
53
- export { PostgresPlugin as t };
@@ -1,58 +0,0 @@
1
- let _atscript_core = require("@atscript/core");
2
- //#region src/plugin/annotations.ts
3
- /**
4
- * PostgreSQL-specific annotations.
5
- *
6
- * Merged into the global config under `{ db: { pg: ... } }` so they
7
- * live alongside core's `@db.table`, `@db.index.*`, etc.
8
- *
9
- * These annotations opt-in to PostgreSQL-specific behavior. Files using only
10
- * portable `@db.*` annotations remain adapter-agnostic.
11
- */
12
- const annotations = {
13
- type: new _atscript_core.AnnotationSpec({
14
- description: "Overrides the native PostgreSQL column type.\n\n```atscript\n@db.pg.type \"CITEXT\"\nname: string\n```",
15
- nodeType: ["prop"],
16
- multiple: false,
17
- argument: {
18
- name: "type",
19
- type: "string",
20
- description: "Native PostgreSQL column type (e.g., \"CITEXT\", \"INET\", \"MACADDR\")."
21
- }
22
- }),
23
- schema: new _atscript_core.AnnotationSpec({
24
- description: "Specifies the PostgreSQL schema for the table.\n\n**Default:** `\"public\"`\n\n```atscript\n@db.pg.schema \"analytics\"\nexport interface Events { ... }\n```",
25
- nodeType: ["interface"],
26
- multiple: false,
27
- argument: {
28
- name: "schema",
29
- type: "string",
30
- description: "PostgreSQL schema name (e.g., \"public\", \"analytics\")."
31
- }
32
- }),
33
- collate: new _atscript_core.AnnotationSpec({
34
- description: "Specifies a native PostgreSQL collation (overrides portable `@db.column.collate`).\n\n```atscript\n@db.pg.collate \"tr-x-icu\"\nname: string\n```",
35
- nodeType: ["interface", "prop"],
36
- multiple: false,
37
- argument: {
38
- name: "collation",
39
- type: "string",
40
- description: "Native PostgreSQL collation name (e.g., \"tr-x-icu\", \"C\", \"und-x-icu\")."
41
- }
42
- })
43
- };
44
- //#endregion
45
- //#region src/plugin/index.ts
46
- const PostgresPlugin = () => ({
47
- name: "postgres",
48
- config() {
49
- return { annotations: { db: { pg: annotations } } };
50
- }
51
- });
52
- //#endregion
53
- Object.defineProperty(exports, "PostgresPlugin", {
54
- enumerable: true,
55
- get: function() {
56
- return PostgresPlugin;
57
- }
58
- });