joist-codegen 1.37.10 → 1.38.0

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.
@@ -10,7 +10,7 @@ export interface DbMetadata {
10
10
  pgEnums: PgEnumMetadata;
11
11
  }
12
12
  /** Codegen-time metadata about a given domain entity. */
13
- export declare type Entity = {
13
+ export type Entity = {
14
14
  name: string;
15
15
  /** The symbol pointing to the entity itself. */
16
16
  type: Import;
@@ -26,7 +26,7 @@ export declare type Entity = {
26
26
  configConst: Import;
27
27
  optsType: Import;
28
28
  };
29
- export declare type DatabaseColumnType = "boolean" | "int" | "uuid" | "numeric" | "smallint" | "integer" | "bigint" | "decimal" | "real" | "smallserial" | "serial" | "bigserial" | "double precision" | "text" | "citext" | "character varying" | "varchar" | "timestamp with time zone" | "timestamp without time zone" | "date" | "jsonb";
29
+ export type DatabaseColumnType = "boolean" | "int" | "uuid" | "numeric" | "smallint" | "integer" | "bigint" | "decimal" | "real" | "smallserial" | "serial" | "bigserial" | "double precision" | "text" | "citext" | "character varying" | "varchar" | "timestamp with time zone" | "timestamp without time zone" | "date" | "jsonb";
30
30
  /**
31
31
  * A logical entity field.
32
32
  *
@@ -36,8 +36,8 @@ interface Field {
36
36
  fieldName: string;
37
37
  ignore?: boolean;
38
38
  }
39
- export declare type PrimitiveTypescriptType = "boolean" | "string" | "number" | "Date" | "Object";
40
- export declare type PrimitiveField = Field & {
39
+ export type PrimitiveTypescriptType = "boolean" | "string" | "number" | "Date" | "Object";
40
+ export type PrimitiveField = Field & {
41
41
  kind: "primitive";
42
42
  columnName: string;
43
43
  columnType: DatabaseColumnType;
@@ -49,7 +49,7 @@ export declare type PrimitiveField = Field & {
49
49
  protected: boolean;
50
50
  superstruct: Import | undefined;
51
51
  };
52
- export declare type EnumField = Field & {
52
+ export type EnumField = Field & {
53
53
  kind: "enum";
54
54
  columnName: string;
55
55
  columnDefault: number | boolean | string | null;
@@ -61,7 +61,7 @@ export declare type EnumField = Field & {
61
61
  notNull: boolean;
62
62
  isArray: boolean;
63
63
  };
64
- export declare type PgEnumField = Field & {
64
+ export type PgEnumField = Field & {
65
65
  kind: "pg-enum";
66
66
  columnName: string;
67
67
  columnDefault: number | boolean | string | null;
@@ -71,7 +71,7 @@ export declare type PgEnumField = Field & {
71
71
  notNull: boolean;
72
72
  };
73
73
  /** I.e. a `Book.author` reference pointing to an `Author`. */
74
- export declare type ManyToOneField = Field & {
74
+ export type ManyToOneField = Field & {
75
75
  kind: "m2o";
76
76
  columnName: string;
77
77
  dbType: string;
@@ -80,7 +80,7 @@ export declare type ManyToOneField = Field & {
80
80
  notNull: boolean;
81
81
  };
82
82
  /** I.e. a `Author.books` collection. */
83
- export declare type OneToManyField = Field & {
83
+ export type OneToManyField = Field & {
84
84
  kind: "o2m";
85
85
  singularName: string;
86
86
  otherEntity: Entity;
@@ -90,14 +90,14 @@ export declare type OneToManyField = Field & {
90
90
  isLargeCollection: boolean;
91
91
  };
92
92
  /** I.e. a `Author.image` reference when `image.author_id` is unique. */
93
- export declare type OneToOneField = Field & {
93
+ export type OneToOneField = Field & {
94
94
  kind: "o2o";
95
95
  otherEntity: Entity;
96
96
  otherFieldName: string;
97
97
  otherColumnName: string;
98
98
  otherColumnNotNull: boolean;
99
99
  };
100
- export declare type ManyToManyField = Field & {
100
+ export type ManyToManyField = Field & {
101
101
  kind: "m2m";
102
102
  joinTableName: string;
103
103
  singularName: string;
@@ -108,12 +108,12 @@ export declare type ManyToManyField = Field & {
108
108
  isLargeCollection: boolean;
109
109
  };
110
110
  /** I.e. a `Comment.parent` reference that groups `comments.parent_book_id` and `comments.parent_book_review_id`. */
111
- export declare type PolymorphicField = Field & {
111
+ export type PolymorphicField = Field & {
112
112
  fieldType: string;
113
113
  notNull: boolean;
114
114
  components: PolymorphicFieldComponent[];
115
115
  };
116
- export declare type PolymorphicFieldComponent = {
116
+ export type PolymorphicFieldComponent = {
117
117
  columnName: string;
118
118
  otherFieldName: string;
119
119
  otherEntity: Entity;
@@ -1,5 +1,5 @@
1
1
  import { CodegenFile } from "ts-poet";
2
2
  import { Config, DbMetadata } from "./index";
3
- export declare type DPrintOptions = Record<string, unknown>;
3
+ export type DPrintOptions = Record<string, unknown>;
4
4
  /** Generates our `${Entity}` and `${Entity}Codegen` files based on the `db` schema. */
5
5
  export declare function generateFiles(config: Config, dbMeta: DbMetadata): Promise<CodegenFile[]>;
@@ -2,19 +2,19 @@ import { Client } from "pg";
2
2
  import { Db, Table } from "pg-structure";
3
3
  import { Config, PrimitiveField } from "./index";
4
4
  /** A map from Enum table name to the rows currently in the table. */
5
- export declare type EnumTableData = {
5
+ export type EnumTableData = {
6
6
  table: Table;
7
7
  name: string;
8
8
  rows: EnumRow[];
9
9
  extraPrimitives: PrimitiveField[];
10
10
  };
11
- export declare type PgEnumData = {
11
+ export type PgEnumData = {
12
12
  name: string;
13
13
  values: string[];
14
14
  };
15
- export declare type EnumMetadata = Record<string, EnumTableData>;
16
- export declare type PgEnumMetadata = Record<string, PgEnumData>;
17
- export declare type EnumRow = {
15
+ export type EnumMetadata = Record<string, EnumTableData>;
16
+ export type PgEnumMetadata = Record<string, PgEnumData>;
17
+ export type EnumRow = {
18
18
  id: number;
19
19
  code: string;
20
20
  name: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "joist-codegen",
3
- "version": "1.37.10",
3
+ "version": "1.38.0",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -21,7 +21,7 @@
21
21
  "@types/pluralize": "0.0.29",
22
22
  "change-case": "^4.1.2",
23
23
  "is-plain-object": "^5.0.0",
24
- "joist-utils": "1.37.10",
24
+ "joist-utils": "1.38.0",
25
25
  "knex": "^2.1.0",
26
26
  "pg": "^8.7.3",
27
27
  "pg-structure": "^7.13.0",
@@ -37,6 +37,6 @@
37
37
  "prettier-plugin-organize-imports": "^3.1.1",
38
38
  "ts-node-dev": "^2.0.0",
39
39
  "tsconfig-paths": "^4.0.0",
40
- "typescript": "^4.8.4"
40
+ "typescript": "^4.9.3"
41
41
  }
42
42
  }