ts-prorm-orm 1.2.3 → 2.1.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.
- package/CHANGELOG.md +331 -1
- package/README.md +32 -24
- package/dist/compliance/data-classifier.d.ts +6 -0
- package/dist/compliance/data-classifier.js +6 -0
- package/dist/compliance/data-lineage.d.ts +4 -0
- package/dist/compliance/data-lineage.js +4 -0
- package/dist/compliance/data-masker.d.ts +4 -0
- package/dist/compliance/data-masker.js +4 -0
- package/dist/compliance/index.d.ts +4 -0
- package/dist/compliance/index.js +15 -1
- package/dist/compliance/pseudonymization.d.ts +4 -0
- package/dist/compliance/pseudonymization.js +4 -0
- package/dist/compliance/query-firewall.d.ts +9 -9
- package/dist/compliance/query-firewall.js +9 -9
- package/dist/compliance/rate-limiter.d.ts +4 -0
- package/dist/compliance/rate-limiter.js +4 -0
- package/dist/compliance/row-level-security.d.ts +2 -0
- package/dist/compliance/row-level-security.js +2 -0
- package/dist/compliance/security-decorator.d.ts +8 -0
- package/dist/compliance/security-decorator.js +8 -0
- package/dist/compliance/session-isolation.d.ts +4 -0
- package/dist/compliance/session-isolation.js +4 -0
- package/dist/compliance/worm-storage.d.ts +4 -0
- package/dist/compliance/worm-storage.js +4 -0
- package/dist/connection-manager.js +13 -1
- package/dist/core/expressions.d.ts +58 -0
- package/dist/core/expressions.js +83 -0
- package/dist/core/hooks-manager.d.ts +179 -0
- package/dist/core/hooks-manager.js +291 -0
- package/dist/core/types.d.ts +235 -0
- package/dist/core/types.js +9 -0
- package/dist/decorators/audit.d.ts +3 -1
- package/dist/decorators/audit.js +3 -1
- package/dist/decorators/check.d.ts +15 -15
- package/dist/decorators/check.js +15 -15
- package/dist/decorators/collate.d.ts +16 -0
- package/dist/decorators/collate.js +16 -0
- package/dist/decorators/comment.d.ts +3 -1
- package/dist/decorators/comment.js +3 -1
- package/dist/decorators/database-settings.d.ts +6 -0
- package/dist/decorators/database-settings.js +6 -0
- package/dist/decorators/default.d.ts +2 -0
- package/dist/decorators/default.js +2 -0
- package/dist/decorators/encryption.d.ts +7 -1
- package/dist/decorators/encryption.js +7 -1
- package/dist/decorators/engine.d.ts +4 -0
- package/dist/decorators/engine.js +4 -0
- package/dist/decorators/fk-constraints.d.ts +32 -32
- package/dist/decorators/fk-constraints.js +32 -32
- package/dist/decorators/foreign-table.d.ts +1 -1
- package/dist/decorators/generated.d.ts +8 -0
- package/dist/decorators/generated.js +8 -0
- package/dist/decorators/hstore.d.ts +6 -0
- package/dist/decorators/hstore.js +6 -0
- package/dist/decorators/index.d.ts +2 -0
- package/dist/decorators/index.js +11 -1
- package/dist/decorators/json-column.d.ts +2 -0
- package/dist/decorators/json-column.js +2 -0
- package/dist/decorators/jsonb.d.ts +6 -0
- package/dist/decorators/jsonb.js +6 -0
- package/dist/decorators/permissions.d.ts +12 -0
- package/dist/decorators/permissions.js +12 -0
- package/dist/decorators/procedure.d.ts +4 -2
- package/dist/decorators/procedure.js +4 -2
- package/dist/decorators/query-options.d.ts +24 -0
- package/dist/decorators/query-options.js +24 -0
- package/dist/decorators/range.d.ts +8 -0
- package/dist/decorators/range.js +8 -0
- package/dist/decorators/set-column.d.ts +2 -0
- package/dist/decorators/set-column.js +2 -0
- package/dist/decorators/spatial.d.ts +2 -0
- package/dist/decorators/spatial.js +2 -0
- package/dist/decorators/storage.d.ts +24 -0
- package/dist/decorators/storage.js +24 -0
- package/dist/decorators/timezone.d.ts +7 -7
- package/dist/decorators/timezone.js +7 -7
- package/dist/decorators/trigger.d.ts +3 -1
- package/dist/decorators/trigger.js +3 -1
- package/dist/decorators/uuid.d.ts +6 -0
- package/dist/decorators/uuid.js +6 -0
- package/dist/decorators/view.d.ts +7 -1
- package/dist/decorators/view.js +7 -1
- package/dist/diagrams/chen-diagram.d.ts +15 -12
- package/dist/diagrams/chen-diagram.js +76 -85
- package/dist/diagrams/class-diagram.d.ts +9 -8
- package/dist/diagrams/class-diagram.js +60 -82
- package/dist/diagrams/core/index.d.ts +13 -0
- package/dist/diagrams/core/index.js +33 -0
- package/dist/diagrams/core/layout.d.ts +104 -0
- package/dist/diagrams/core/layout.js +223 -0
- package/dist/diagrams/{svg-dom.d.ts → core/svg.d.ts} +8 -20
- package/dist/diagrams/{svg-dom.js → core/svg.js} +21 -29
- package/dist/diagrams/core/theme.d.ts +84 -0
- package/dist/diagrams/core/theme.js +62 -0
- package/dist/diagrams/dependency-diagram.d.ts +15 -14
- package/dist/diagrams/dependency-diagram.js +71 -105
- package/dist/diagrams/er-diagram.d.ts +13 -26
- package/dist/diagrams/er-diagram.js +180 -259
- package/dist/diagrams/flow-diagram.d.ts +16 -11
- package/dist/diagrams/flow-diagram.js +96 -91
- package/dist/diagrams/gantt-diagram.d.ts +10 -5
- package/dist/diagrams/gantt-diagram.js +77 -103
- package/dist/diagrams/index-diagram.d.ts +10 -10
- package/dist/diagrams/index-diagram.js +106 -116
- package/dist/diagrams/index.d.ts +6 -9
- package/dist/diagrams/index.js +9 -24
- package/dist/diagrams/migration-diagram.d.ts +8 -4
- package/dist/diagrams/migration-diagram.js +189 -161
- package/dist/diagrams/model-diagram.d.ts +34 -34
- package/dist/diagrams/model-diagram.js +106 -485
- package/dist/diagrams/package-diagram.d.ts +9 -6
- package/dist/diagrams/package-diagram.js +64 -101
- package/dist/diagrams/relational-diagram.d.ts +12 -10
- package/dist/diagrams/relational-diagram.js +87 -114
- package/dist/diagrams/schemadoc-diagram.d.ts +8 -8
- package/dist/diagrams/schemadoc-diagram.js +71 -93
- package/dist/diagrams/sequence-diagram.d.ts +10 -10
- package/dist/diagrams/sequence-diagram.js +64 -89
- package/dist/diagrams/state-diagram.d.ts +10 -9
- package/dist/diagrams/state-diagram.js +69 -92
- package/dist/diagrams/tree-diagram.d.ts +11 -5
- package/dist/diagrams/tree-diagram.js +41 -65
- package/dist/dialects/clickhouse/index.js +15 -0
- package/dist/dialects/cockroachdb/index.d.ts +1 -1
- package/dist/dialects/cockroachdb/index.js +32 -63
- package/dist/dialects/db2/index.js +23 -8
- package/dist/dialects/dialect.d.ts +141 -5
- package/dist/dialects/duckdb/index.js +9 -2
- package/dist/dialects/hana/index.js +22 -5
- package/dist/dialects/lock-clause-helper.d.ts +167 -0
- package/dist/dialects/lock-clause-helper.js +316 -0
- package/dist/dialects/mariadb/index.d.ts +7 -4
- package/dist/dialects/mariadb/index.js +36 -60
- package/dist/dialects/mssql/index.js +34 -3
- package/dist/dialects/mysql/index.d.ts +1 -1
- package/dist/dialects/mysql/index.js +17 -45
- package/dist/dialects/oracle/index.d.ts +14 -3
- package/dist/dialects/oracle/index.js +66 -36
- package/dist/dialects/order-expression-helper.d.ts +72 -0
- package/dist/dialects/order-expression-helper.js +154 -0
- package/dist/dialects/partial-index.d.ts +52 -0
- package/dist/dialects/partial-index.js +251 -0
- package/dist/dialects/postgres/index.d.ts +1 -1
- package/dist/dialects/postgres/index.js +43 -68
- package/dist/dialects/redshift/index.js +9 -2
- package/dist/dialects/snowflake/index.js +17 -0
- package/dist/dialects/spanner/index.js +7 -2
- package/dist/dialects/sqlite/driver.d.ts +55 -0
- package/dist/dialects/sqlite/driver.js +102 -0
- package/dist/dialects/sqlite/index.d.ts +1 -1
- package/dist/dialects/sqlite/index.js +49 -27
- package/dist/external-fields/decorator.d.ts +2 -0
- package/dist/external-fields/decorator.js +2 -0
- package/dist/graph/base-graph-dialect.d.ts +24 -3
- package/dist/graph/base-graph-dialect.js +43 -2
- package/dist/graph/dgraph/index.js +6 -0
- package/dist/graph/gremlin/index.d.ts +6 -0
- package/dist/graph/gremlin/index.js +12 -1
- package/dist/graph/index.d.ts +1 -1
- package/dist/graph/neo4j/index.d.ts +2 -0
- package/dist/graph/neo4j/index.js +6 -1
- package/dist/graph/types.d.ts +12 -1
- package/dist/index.d.ts +12 -3
- package/dist/index.js +53 -7
- package/dist/logging/index.d.ts +10 -0
- package/dist/logging/index.js +23 -0
- package/dist/logging/query-logging.d.ts +82 -0
- package/dist/logging/query-logging.js +102 -0
- package/dist/models/associations.d.ts +38 -0
- package/dist/models/associations.js +16 -0
- package/dist/models/decorators.d.ts +55 -19
- package/dist/models/decorators.js +95 -19
- package/dist/models/eager-load.d.ts +99 -0
- package/dist/models/eager-load.js +348 -5
- package/dist/models/indexes.d.ts +3 -2
- package/dist/models/indexes.js +7 -1
- package/dist/models/model.js +69 -43
- package/dist/prorm.d.ts +175 -409
- package/dist/prorm.js +1132 -553
- package/dist/query-builders/order-limit-builder.js +12 -10
- package/dist/query-builders/sql-compiler.d.ts +10 -3
- package/dist/query-builders/sql-compiler.js +14 -43
- package/dist/query-interface.d.ts +2 -1
- package/dist/schema-objects.d.ts +42 -0
- package/dist/schema-objects.js +28 -0
- package/dist/sql-constants.d.ts +44 -0
- package/dist/sql-constants.js +138 -1
- package/dist/types/index.d.ts +387 -17
- package/dist/types/index.js +10 -15
- package/dist/types/query-types.d.ts +26 -0
- package/dist/types/query-types.js +30 -0
- package/package.json +39 -8
- package/dist/decorators/belongs-to-many.js +0 -115
- package/dist/decorators/belongs-to.js +0 -115
- package/dist/decorators/has-many.js +0 -127
- package/dist/decorators/has-one.js +0 -116
- package/dist/diagrams/palette.d.ts +0 -138
- package/dist/diagrams/palette.js +0 -194
- package/dist/hooks/hooks-manager.d.ts +0 -189
- package/dist/hooks/hooks-manager.js +0 -350
- package/dist/hooks/index.d.ts +0 -8
- package/dist/hooks/index.js +0 -37
- /package/dist/{logging.d.ts → logging/logger.d.ts} +0 -0
- /package/dist/{logging.js → logging/logger.js} +0 -0
|
@@ -1,138 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared accent-color and theme resolution for the diagram generators.
|
|
3
|
-
*
|
|
4
|
-
* `--color <name>` (or a custom hex string) picks an accent palette used for
|
|
5
|
-
* header bars / banners / entity colors.
|
|
6
|
-
* `--theme light|dark` picks a background/text theme.
|
|
7
|
-
*
|
|
8
|
-
* Both are genuinely applied by ModelDiagram, ERDiagram, RelationalDiagram,
|
|
9
|
-
* SchemaDocDiagram, ChenDiagram (and MigrationDiagram) — changing either flag
|
|
10
|
-
* changes real fill/stroke values in the generated SVG.
|
|
11
|
-
*
|
|
12
|
-
* ─── Industry design system ────────────────────────────────────────────────
|
|
13
|
-
* The DEFAULT look is the "Industry" blueprint design: a #f2f2f3 ground, white
|
|
14
|
-
* cards, hairline dividers, square corners, a solid #5980a6 accent header bar,
|
|
15
|
-
* and Barlow / Barlow Condensed / JetBrains Mono typography. The old vibrant
|
|
16
|
-
* multi-stop gradient palettes are retained as explicit `--color` overrides,
|
|
17
|
-
* but `industry` is now `ACCENT_PALETTES[0]` (the fallback of `resolveAccent`).
|
|
18
|
-
*
|
|
19
|
-
* The exported API is intentionally stable — `AccentPalette` / `ThemeColors`
|
|
20
|
-
* keep their existing fields (new fields are additive & optional), and
|
|
21
|
-
* `resolveAccent` / `resolveTheme` / `rotatedPalettes` keep their signatures —
|
|
22
|
-
* so sibling generators and other callers that import them keep working.
|
|
23
|
-
*/
|
|
24
|
-
export interface AccentPalette {
|
|
25
|
-
name: string;
|
|
26
|
-
/** Darkest gradient stop / primary header color (also used as a solid fill) */
|
|
27
|
-
from: string;
|
|
28
|
-
/** Mid gradient stop — the canonical solid accent fill in the Industry look */
|
|
29
|
-
mid: string;
|
|
30
|
-
/** Lightest gradient stop (used for 3-stop gradients / light accents) */
|
|
31
|
-
to: string;
|
|
32
|
-
/** Light background tint (badges, footers) */
|
|
33
|
-
light: string;
|
|
34
|
-
/** Readable text color on `light` background */
|
|
35
|
-
text: string;
|
|
36
|
-
/** Secondary accent (blueprint two-tone; FK marks, alt entities) */
|
|
37
|
-
accent2?: string;
|
|
38
|
-
/** Light tint of the secondary accent */
|
|
39
|
-
accent2Light?: string;
|
|
40
|
-
/** Readable text on `accent2Light` */
|
|
41
|
-
accent2Text?: string;
|
|
42
|
-
}
|
|
43
|
-
export declare const INDUSTRY: {
|
|
44
|
-
readonly ground: "#f2f2f3";
|
|
45
|
-
readonly surface: "#e9e9ea";
|
|
46
|
-
readonly card: "#ffffff";
|
|
47
|
-
readonly text: "#1d1f20";
|
|
48
|
-
readonly muted: "#7a7a7d";
|
|
49
|
-
readonly accent: "#5980a6";
|
|
50
|
-
readonly accent2: "#728fab";
|
|
51
|
-
readonly accentLight: "#eef6ff";
|
|
52
|
-
readonly accentText: "#2c455d";
|
|
53
|
-
readonly accent2Light: "#d6ebff";
|
|
54
|
-
readonly accent2Text: "#314457";
|
|
55
|
-
/** Hairline divider — rgba(29,31,32,0.16) */
|
|
56
|
-
readonly divider: "rgba(29,31,32,0.16)";
|
|
57
|
-
readonly neutral: {
|
|
58
|
-
readonly 100: "#f5f5f8";
|
|
59
|
-
readonly 200: "#e7e7ea";
|
|
60
|
-
readonly 300: "#d4d4d7";
|
|
61
|
-
readonly 400: "#b7b7ba";
|
|
62
|
-
readonly 500: "#98989b";
|
|
63
|
-
readonly 600: "#7a7a7d";
|
|
64
|
-
readonly 700: "#5d5d60";
|
|
65
|
-
readonly 800: "#424244";
|
|
66
|
-
readonly 900: "#2b2b2d";
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
export declare const FONTS: {
|
|
70
|
-
/** headings & labels */
|
|
71
|
-
readonly heading: "\"Barlow Condensed\", system-ui, sans-serif";
|
|
72
|
-
/** body copy */
|
|
73
|
-
readonly body: "\"Barlow\", system-ui, sans-serif";
|
|
74
|
-
/** code / types / mono */
|
|
75
|
-
readonly mono: "ui-monospace, \"JetBrains Mono\", \"SF Mono\", Menlo, monospace";
|
|
76
|
-
};
|
|
77
|
-
/**
|
|
78
|
-
* A Google-Fonts @import so browser-rendered SVGs pick up Barlow / Barlow
|
|
79
|
-
* Condensed / JetBrains Mono. Non-browser renderers fall back to the system
|
|
80
|
-
* fonts declared alongside each family in `FONTS`.
|
|
81
|
-
*/
|
|
82
|
-
export declare const FONT_IMPORT = "@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Barlow+Condensed:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');";
|
|
83
|
-
/** Constraint / cardinality badge tints in the Industry system. */
|
|
84
|
-
export declare const BADGE_TINTS: {
|
|
85
|
-
/** PK / UQ — accent tint */
|
|
86
|
-
readonly accent: {
|
|
87
|
-
readonly bg: "#eef6ff";
|
|
88
|
-
readonly fg: "#2c455d";
|
|
89
|
-
};
|
|
90
|
-
/** FK — accent-2 tint */
|
|
91
|
-
readonly accent2: {
|
|
92
|
-
readonly bg: "#d6ebff";
|
|
93
|
-
readonly fg: "#314457";
|
|
94
|
-
};
|
|
95
|
-
/** NN / AI / TS — neutral tint */
|
|
96
|
-
readonly neutral: {
|
|
97
|
-
readonly bg: "#f5f5f8";
|
|
98
|
-
readonly fg: "#424244";
|
|
99
|
-
};
|
|
100
|
-
};
|
|
101
|
-
export declare const ACCENT_PALETTES: AccentPalette[];
|
|
102
|
-
/**
|
|
103
|
-
* Resolve a `--color` flag value to a concrete palette.
|
|
104
|
-
* Accepts a named palette (case-insensitive) or a hex color string.
|
|
105
|
-
* Falls back to the default Industry palette.
|
|
106
|
-
*/
|
|
107
|
-
export declare function resolveAccent(color?: string): AccentPalette;
|
|
108
|
-
/** The secondary accent for a resolved palette, with an Industry fallback. */
|
|
109
|
-
export declare function accent2Of(p: AccentPalette): {
|
|
110
|
-
color: string;
|
|
111
|
-
light: string;
|
|
112
|
-
text: string;
|
|
113
|
-
};
|
|
114
|
-
/**
|
|
115
|
-
* Rotate the palette list so it starts at the resolved accent (used by
|
|
116
|
-
* ERDiagram / RelationalDiagram to color multiple entities while still honoring
|
|
117
|
-
* --color for the first/primary entity).
|
|
118
|
-
*/
|
|
119
|
-
export declare function rotatedPalettes(color?: string): AccentPalette[];
|
|
120
|
-
export interface ThemeColors {
|
|
121
|
-
/** Outer page/canvas background */
|
|
122
|
-
canvasBg: string;
|
|
123
|
-
/** Card / entity-box background */
|
|
124
|
-
cardBg: string;
|
|
125
|
-
/** Alternating row background (even rows use cardBg) */
|
|
126
|
-
rowAlt: string;
|
|
127
|
-
/** Column-header strip background */
|
|
128
|
-
colHeaderBg: string;
|
|
129
|
-
/** Primary body text color */
|
|
130
|
-
textPrimary: string;
|
|
131
|
-
/** Secondary/muted text color */
|
|
132
|
-
textSecondary: string;
|
|
133
|
-
/** Hairline border/divider color */
|
|
134
|
-
border: string;
|
|
135
|
-
/** Footer bar background */
|
|
136
|
-
footerBg: string;
|
|
137
|
-
}
|
|
138
|
-
export declare function resolveTheme(theme?: 'light' | 'dark'): ThemeColors;
|
package/dist/diagrams/palette.js
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Shared accent-color and theme resolution for the diagram generators.
|
|
4
|
-
*
|
|
5
|
-
* `--color <name>` (or a custom hex string) picks an accent palette used for
|
|
6
|
-
* header bars / banners / entity colors.
|
|
7
|
-
* `--theme light|dark` picks a background/text theme.
|
|
8
|
-
*
|
|
9
|
-
* Both are genuinely applied by ModelDiagram, ERDiagram, RelationalDiagram,
|
|
10
|
-
* SchemaDocDiagram, ChenDiagram (and MigrationDiagram) — changing either flag
|
|
11
|
-
* changes real fill/stroke values in the generated SVG.
|
|
12
|
-
*
|
|
13
|
-
* ─── Industry design system ────────────────────────────────────────────────
|
|
14
|
-
* The DEFAULT look is the "Industry" blueprint design: a #f2f2f3 ground, white
|
|
15
|
-
* cards, hairline dividers, square corners, a solid #5980a6 accent header bar,
|
|
16
|
-
* and Barlow / Barlow Condensed / JetBrains Mono typography. The old vibrant
|
|
17
|
-
* multi-stop gradient palettes are retained as explicit `--color` overrides,
|
|
18
|
-
* but `industry` is now `ACCENT_PALETTES[0]` (the fallback of `resolveAccent`).
|
|
19
|
-
*
|
|
20
|
-
* The exported API is intentionally stable — `AccentPalette` / `ThemeColors`
|
|
21
|
-
* keep their existing fields (new fields are additive & optional), and
|
|
22
|
-
* `resolveAccent` / `resolveTheme` / `rotatedPalettes` keep their signatures —
|
|
23
|
-
* so sibling generators and other callers that import them keep working.
|
|
24
|
-
*/
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.ACCENT_PALETTES = exports.BADGE_TINTS = exports.FONT_IMPORT = exports.FONTS = exports.INDUSTRY = void 0;
|
|
27
|
-
exports.resolveAccent = resolveAccent;
|
|
28
|
-
exports.accent2Of = accent2Of;
|
|
29
|
-
exports.rotatedPalettes = rotatedPalettes;
|
|
30
|
-
exports.resolveTheme = resolveTheme;
|
|
31
|
-
// ─── Industry design tokens (shared by every generator) ─────────────────────
|
|
32
|
-
exports.INDUSTRY = {
|
|
33
|
-
ground: '#f2f2f3',
|
|
34
|
-
surface: '#e9e9ea',
|
|
35
|
-
card: '#ffffff',
|
|
36
|
-
text: '#1d1f20',
|
|
37
|
-
muted: '#7a7a7d',
|
|
38
|
-
accent: '#5980a6',
|
|
39
|
-
accent2: '#728fab',
|
|
40
|
-
accentLight: '#eef6ff',
|
|
41
|
-
accentText: '#2c455d',
|
|
42
|
-
accent2Light: '#d6ebff',
|
|
43
|
-
accent2Text: '#314457',
|
|
44
|
-
/** Hairline divider — rgba(29,31,32,0.16) */
|
|
45
|
-
divider: 'rgba(29,31,32,0.16)',
|
|
46
|
-
neutral: {
|
|
47
|
-
100: '#f5f5f8',
|
|
48
|
-
200: '#e7e7ea',
|
|
49
|
-
300: '#d4d4d7',
|
|
50
|
-
400: '#b7b7ba',
|
|
51
|
-
500: '#98989b',
|
|
52
|
-
600: '#7a7a7d',
|
|
53
|
-
700: '#5d5d60',
|
|
54
|
-
800: '#424244',
|
|
55
|
-
900: '#2b2b2d',
|
|
56
|
-
},
|
|
57
|
-
};
|
|
58
|
-
// ─── Typography (Barlow / Barlow Condensed / JetBrains Mono) ─────────────────
|
|
59
|
-
exports.FONTS = {
|
|
60
|
-
/** headings & labels */
|
|
61
|
-
heading: '"Barlow Condensed", system-ui, sans-serif',
|
|
62
|
-
/** body copy */
|
|
63
|
-
body: '"Barlow", system-ui, sans-serif',
|
|
64
|
-
/** code / types / mono */
|
|
65
|
-
mono: 'ui-monospace, "JetBrains Mono", "SF Mono", Menlo, monospace',
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* A Google-Fonts @import so browser-rendered SVGs pick up Barlow / Barlow
|
|
69
|
-
* Condensed / JetBrains Mono. Non-browser renderers fall back to the system
|
|
70
|
-
* fonts declared alongside each family in `FONTS`.
|
|
71
|
-
*/
|
|
72
|
-
exports.FONT_IMPORT = "@import url('https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Barlow+Condensed:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap');";
|
|
73
|
-
/** Constraint / cardinality badge tints in the Industry system. */
|
|
74
|
-
exports.BADGE_TINTS = {
|
|
75
|
-
/** PK / UQ — accent tint */
|
|
76
|
-
accent: { bg: exports.INDUSTRY.accentLight, fg: exports.INDUSTRY.accentText },
|
|
77
|
-
/** FK — accent-2 tint */
|
|
78
|
-
accent2: { bg: exports.INDUSTRY.accent2Light, fg: exports.INDUSTRY.accent2Text },
|
|
79
|
-
/** NN / AI / TS — neutral tint */
|
|
80
|
-
neutral: { bg: exports.INDUSTRY.neutral[100], fg: exports.INDUSTRY.neutral[800] },
|
|
81
|
-
};
|
|
82
|
-
// Named palette entries. Order matters: it is also the default cycling order
|
|
83
|
-
// used by ERDiagram / RelationalDiagram when no explicit --color is given, so
|
|
84
|
-
// the two Industry entries lead — a schema with no `--color` renders as a
|
|
85
|
-
// blueprint two-tone (accent → accent-2) rather than a rainbow.
|
|
86
|
-
exports.ACCENT_PALETTES = [
|
|
87
|
-
{
|
|
88
|
-
name: 'industry',
|
|
89
|
-
from: exports.INDUSTRY.accent,
|
|
90
|
-
mid: exports.INDUSTRY.accent,
|
|
91
|
-
to: exports.INDUSTRY.accent,
|
|
92
|
-
light: exports.INDUSTRY.accentLight,
|
|
93
|
-
text: exports.INDUSTRY.accentText,
|
|
94
|
-
accent2: exports.INDUSTRY.accent2,
|
|
95
|
-
accent2Light: exports.INDUSTRY.accent2Light,
|
|
96
|
-
accent2Text: exports.INDUSTRY.accent2Text,
|
|
97
|
-
},
|
|
98
|
-
{
|
|
99
|
-
name: 'industry-2',
|
|
100
|
-
from: exports.INDUSTRY.accent2,
|
|
101
|
-
mid: exports.INDUSTRY.accent2,
|
|
102
|
-
to: exports.INDUSTRY.accent2,
|
|
103
|
-
light: exports.INDUSTRY.accent2Light,
|
|
104
|
-
text: exports.INDUSTRY.accent2Text,
|
|
105
|
-
accent2: exports.INDUSTRY.accent,
|
|
106
|
-
accent2Light: exports.INDUSTRY.accentLight,
|
|
107
|
-
accent2Text: exports.INDUSTRY.accentText,
|
|
108
|
-
},
|
|
109
|
-
{ name: 'blue', from: '#1E3A8A', mid: '#2563EB', to: '#60A5FA', light: '#DBEAFE', text: '#1E3A8A' },
|
|
110
|
-
{ name: 'violet', from: '#5B21B6', mid: '#7C3AED', to: '#A78BFA', light: '#EDE9FE', text: '#5B21B6' },
|
|
111
|
-
{ name: 'emerald', from: '#065F46', mid: '#059669', to: '#34D399', light: '#D1FAE5', text: '#065F46' },
|
|
112
|
-
{ name: 'amber', from: '#92400E', mid: '#D97706', to: '#FBBF24', light: '#FEF3C7', text: '#92400E' },
|
|
113
|
-
{ name: 'pink', from: '#831843', mid: '#DB2777', to: '#F472B6', light: '#FCE7F3', text: '#831843' },
|
|
114
|
-
{ name: 'sky', from: '#0C4A6E', mid: '#0284C7', to: '#38BDF8', light: '#E0F2FE', text: '#0C4A6E' },
|
|
115
|
-
{ name: 'indigo', from: '#1E1B4B', mid: '#4338CA', to: '#818CF8', light: '#E0E7FF', text: '#1E1B4B' },
|
|
116
|
-
{ name: 'purple', from: '#4A1942', mid: '#9333EA', to: '#C084FC', light: '#F3E8FF', text: '#4A1942' },
|
|
117
|
-
{ name: 'red', from: '#7F1D1D', mid: '#DC2626', to: '#F87171', light: '#FEE2E2', text: '#7F1D1D' },
|
|
118
|
-
{ name: 'teal', from: '#134E4A', mid: '#0D9488', to: '#2DD4BF', light: '#CCFBF1', text: '#134E4A' },
|
|
119
|
-
{ name: 'green', from: '#14532D', mid: '#16A34A', to: '#4ADE80', light: '#DCFCE7', text: '#14532D' },
|
|
120
|
-
{ name: 'stone', from: '#1C1917', mid: '#44403C', to: '#A8A29E', light: '#F5F5F4', text: '#1C1917' },
|
|
121
|
-
];
|
|
122
|
-
const HEX_RE = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i;
|
|
123
|
-
/**
|
|
124
|
-
* Resolve a `--color` flag value to a concrete palette.
|
|
125
|
-
* Accepts a named palette (case-insensitive) or a hex color string.
|
|
126
|
-
* Falls back to the default Industry palette.
|
|
127
|
-
*/
|
|
128
|
-
function resolveAccent(color) {
|
|
129
|
-
if (color) {
|
|
130
|
-
const named = exports.ACCENT_PALETTES.find((p) => p.name === color.toLowerCase());
|
|
131
|
-
if (named)
|
|
132
|
-
return named;
|
|
133
|
-
if (HEX_RE.test(color)) {
|
|
134
|
-
return {
|
|
135
|
-
name: color,
|
|
136
|
-
from: color,
|
|
137
|
-
mid: color,
|
|
138
|
-
to: color,
|
|
139
|
-
light: `${color}22`,
|
|
140
|
-
text: color,
|
|
141
|
-
accent2: exports.INDUSTRY.accent2,
|
|
142
|
-
accent2Light: exports.INDUSTRY.accent2Light,
|
|
143
|
-
accent2Text: exports.INDUSTRY.accent2Text,
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
return exports.ACCENT_PALETTES[0];
|
|
148
|
-
}
|
|
149
|
-
/** The secondary accent for a resolved palette, with an Industry fallback. */
|
|
150
|
-
function accent2Of(p) {
|
|
151
|
-
return {
|
|
152
|
-
color: p.accent2 ?? exports.INDUSTRY.accent2,
|
|
153
|
-
light: p.accent2Light ?? exports.INDUSTRY.accent2Light,
|
|
154
|
-
text: p.accent2Text ?? exports.INDUSTRY.accent2Text,
|
|
155
|
-
};
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Rotate the palette list so it starts at the resolved accent (used by
|
|
159
|
-
* ERDiagram / RelationalDiagram to color multiple entities while still honoring
|
|
160
|
-
* --color for the first/primary entity).
|
|
161
|
-
*/
|
|
162
|
-
function rotatedPalettes(color) {
|
|
163
|
-
if (!color)
|
|
164
|
-
return exports.ACCENT_PALETTES;
|
|
165
|
-
const idx = exports.ACCENT_PALETTES.findIndex((p) => p.name === color.toLowerCase());
|
|
166
|
-
if (idx <= 0)
|
|
167
|
-
return exports.ACCENT_PALETTES;
|
|
168
|
-
return [...exports.ACCENT_PALETTES.slice(idx), ...exports.ACCENT_PALETTES.slice(0, idx)];
|
|
169
|
-
}
|
|
170
|
-
// Industry light theme — the ground/surface/card/hairline blueprint.
|
|
171
|
-
const LIGHT_THEME = {
|
|
172
|
-
canvasBg: exports.INDUSTRY.ground,
|
|
173
|
-
cardBg: exports.INDUSTRY.card,
|
|
174
|
-
rowAlt: exports.INDUSTRY.neutral[100],
|
|
175
|
-
colHeaderBg: exports.INDUSTRY.surface,
|
|
176
|
-
textPrimary: exports.INDUSTRY.text,
|
|
177
|
-
textSecondary: exports.INDUSTRY.muted,
|
|
178
|
-
border: exports.INDUSTRY.divider,
|
|
179
|
-
footerBg: exports.INDUSTRY.surface,
|
|
180
|
-
};
|
|
181
|
-
// Industry dark theme — same blueprint reasoning, inverted onto neutral-900.
|
|
182
|
-
const DARK_THEME = {
|
|
183
|
-
canvasBg: '#1d1f20',
|
|
184
|
-
cardBg: '#2b2b2d',
|
|
185
|
-
rowAlt: '#242426',
|
|
186
|
-
colHeaderBg: '#242426',
|
|
187
|
-
textPrimary: '#f5f5f8',
|
|
188
|
-
textSecondary: '#b7b7ba',
|
|
189
|
-
border: 'rgba(245,245,248,0.18)',
|
|
190
|
-
footerBg: '#242426',
|
|
191
|
-
};
|
|
192
|
-
function resolveTheme(theme) {
|
|
193
|
-
return theme === 'dark' ? DARK_THEME : LIGHT_THEME;
|
|
194
|
-
}
|
|
@@ -1,189 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Hooks Manager for the TypeScript ORM
|
|
3
|
-
* Provides a centralized system for managing Prorm-style model hooks
|
|
4
|
-
*/
|
|
5
|
-
import { HookOptions, HookHandler, BulkHookHandler } from '../types';
|
|
6
|
-
export type HookName = 'beforeValidate' | 'afterValidate' | 'beforeCreate' | 'afterCreate' | 'beforeUpdate' | 'afterUpdate' | 'beforeDestroy' | 'afterDestroy' | 'beforeSave' | 'afterSave' | 'beforeBulkCreate' | 'afterBulkCreate' | 'beforeBulkUpdate' | 'afterBulkUpdate' | 'beforeBulkDestroy' | 'afterBulkDestroy' | 'beforeFind' | 'afterFind';
|
|
7
|
-
export type HookCallback = HookHandler | BulkHookHandler | FindHookHandler;
|
|
8
|
-
export interface FindHookHandler {
|
|
9
|
-
(options: FindHookOptions): Promise<void> | void;
|
|
10
|
-
}
|
|
11
|
-
export interface FindHookOptions extends HookOptions {
|
|
12
|
-
where?: Record<string, any>;
|
|
13
|
-
attributes?: string[];
|
|
14
|
-
include?: any[];
|
|
15
|
-
order?: any;
|
|
16
|
-
limit?: number | string;
|
|
17
|
-
offset?: number | string;
|
|
18
|
-
model?: any;
|
|
19
|
-
}
|
|
20
|
-
export type HooksMap = Map<HookName, Set<HookCallback>>;
|
|
21
|
-
/**
|
|
22
|
-
* HooksManager - Manages all lifecycle hooks for a model
|
|
23
|
-
*/
|
|
24
|
-
export declare class HooksManager {
|
|
25
|
-
private hooks;
|
|
26
|
-
private modelName;
|
|
27
|
-
constructor(modelName?: string);
|
|
28
|
-
/**
|
|
29
|
-
* Initialize all hook types as empty Sets
|
|
30
|
-
*/
|
|
31
|
-
private initializeHooks;
|
|
32
|
-
/**
|
|
33
|
-
* Get all hooks
|
|
34
|
-
*/
|
|
35
|
-
getHooks(): HooksMap;
|
|
36
|
-
/**
|
|
37
|
-
* Get hooks for a specific hook name
|
|
38
|
-
*/
|
|
39
|
-
getHook(hookName: HookName): Set<HookCallback>;
|
|
40
|
-
/**
|
|
41
|
-
* Add a hook callback
|
|
42
|
-
*/
|
|
43
|
-
addHook(hookName: string, callback: HookCallback): this;
|
|
44
|
-
/**
|
|
45
|
-
* Remove a hook callback
|
|
46
|
-
*/
|
|
47
|
-
removeHook(hookName: string, callback: HookCallback): this;
|
|
48
|
-
/**
|
|
49
|
-
* Run all callbacks for a specific hook
|
|
50
|
-
*/
|
|
51
|
-
runHook(hookName: string, ...args: any[]): Promise<void>;
|
|
52
|
-
/**
|
|
53
|
-
* Check if a hook has registered callbacks
|
|
54
|
-
*/
|
|
55
|
-
hasHook(hookName: string): boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Get the count of hooks for a specific hook name
|
|
58
|
-
*/
|
|
59
|
-
getHookCount(hookName: string): number;
|
|
60
|
-
/**
|
|
61
|
-
* Clear all hooks
|
|
62
|
-
*/
|
|
63
|
-
clearHooks(): this;
|
|
64
|
-
/**
|
|
65
|
-
* Clear hooks for a specific hook name
|
|
66
|
-
*/
|
|
67
|
-
clearHook(hookName: string): this;
|
|
68
|
-
/**
|
|
69
|
-
* Normalize hook name to camelCase
|
|
70
|
-
*/
|
|
71
|
-
private normalizeHookName;
|
|
72
|
-
}
|
|
73
|
-
/**
|
|
74
|
-
* Create a hooks object compatible with Model options
|
|
75
|
-
*/
|
|
76
|
-
export declare function createHooksObject(hooksManager: HooksManager): Record<string, HookCallback>;
|
|
77
|
-
/**
|
|
78
|
-
* Mixin function to add hook methods to a Model class
|
|
79
|
-
*/
|
|
80
|
-
export declare function addHookMethods<T extends HooksManager>(target: any, hooksManager: T): void;
|
|
81
|
-
/**
|
|
82
|
-
* Create a beforeValidate hook wrapper
|
|
83
|
-
*/
|
|
84
|
-
export declare function beforeValidate(callback: HookHandler): {
|
|
85
|
-
beforeValidate: HookHandler;
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* Create an afterValidate hook wrapper
|
|
89
|
-
*/
|
|
90
|
-
export declare function afterValidate(callback: HookHandler): {
|
|
91
|
-
afterValidate: HookHandler;
|
|
92
|
-
};
|
|
93
|
-
/**
|
|
94
|
-
* Create a beforeCreate hook wrapper
|
|
95
|
-
*/
|
|
96
|
-
export declare function beforeCreate(callback: HookHandler): {
|
|
97
|
-
beforeCreate: HookHandler;
|
|
98
|
-
};
|
|
99
|
-
/**
|
|
100
|
-
* Create an afterCreate hook wrapper
|
|
101
|
-
*/
|
|
102
|
-
export declare function afterCreate(callback: HookHandler): {
|
|
103
|
-
afterCreate: HookHandler;
|
|
104
|
-
};
|
|
105
|
-
/**
|
|
106
|
-
* Create a beforeUpdate hook wrapper
|
|
107
|
-
*/
|
|
108
|
-
export declare function beforeUpdate(callback: HookHandler): {
|
|
109
|
-
beforeUpdate: HookHandler;
|
|
110
|
-
};
|
|
111
|
-
/**
|
|
112
|
-
* Create an afterUpdate hook wrapper
|
|
113
|
-
*/
|
|
114
|
-
export declare function afterUpdate(callback: HookHandler): {
|
|
115
|
-
afterUpdate: HookHandler;
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Create a beforeDestroy hook wrapper
|
|
119
|
-
*/
|
|
120
|
-
export declare function beforeDestroy(callback: HookHandler): {
|
|
121
|
-
beforeDestroy: HookHandler;
|
|
122
|
-
};
|
|
123
|
-
/**
|
|
124
|
-
* Create an afterDestroy hook wrapper
|
|
125
|
-
*/
|
|
126
|
-
export declare function afterDestroy(callback: HookHandler): {
|
|
127
|
-
afterDestroy: HookHandler;
|
|
128
|
-
};
|
|
129
|
-
/**
|
|
130
|
-
* Create a beforeSave hook wrapper
|
|
131
|
-
*/
|
|
132
|
-
export declare function beforeSave(callback: HookHandler): {
|
|
133
|
-
beforeSave: HookHandler;
|
|
134
|
-
};
|
|
135
|
-
/**
|
|
136
|
-
* Create an afterSave hook wrapper
|
|
137
|
-
*/
|
|
138
|
-
export declare function afterSave(callback: HookHandler): {
|
|
139
|
-
afterSave: HookHandler;
|
|
140
|
-
};
|
|
141
|
-
/**
|
|
142
|
-
* Create a beforeBulkCreate hook wrapper
|
|
143
|
-
*/
|
|
144
|
-
export declare function beforeBulkCreate(callback: BulkHookHandler): {
|
|
145
|
-
beforeBulkCreate: BulkHookHandler;
|
|
146
|
-
};
|
|
147
|
-
/**
|
|
148
|
-
* Create an afterBulkCreate hook wrapper
|
|
149
|
-
*/
|
|
150
|
-
export declare function afterBulkCreate(callback: BulkHookHandler): {
|
|
151
|
-
afterBulkCreate: BulkHookHandler;
|
|
152
|
-
};
|
|
153
|
-
/**
|
|
154
|
-
* Create a beforeBulkUpdate hook wrapper
|
|
155
|
-
*/
|
|
156
|
-
export declare function beforeBulkUpdate(callback: BulkHookHandler): {
|
|
157
|
-
beforeBulkUpdate: BulkHookHandler;
|
|
158
|
-
};
|
|
159
|
-
/**
|
|
160
|
-
* Create an afterBulkUpdate hook wrapper
|
|
161
|
-
*/
|
|
162
|
-
export declare function afterBulkUpdate(callback: BulkHookHandler): {
|
|
163
|
-
afterBulkUpdate: BulkHookHandler;
|
|
164
|
-
};
|
|
165
|
-
/**
|
|
166
|
-
* Create a beforeBulkDestroy hook wrapper
|
|
167
|
-
*/
|
|
168
|
-
export declare function beforeBulkDestroy(callback: BulkHookHandler): {
|
|
169
|
-
beforeBulkDestroy: BulkHookHandler;
|
|
170
|
-
};
|
|
171
|
-
/**
|
|
172
|
-
* Create an afterBulkDestroy hook wrapper
|
|
173
|
-
*/
|
|
174
|
-
export declare function afterBulkDestroy(callback: BulkHookHandler): {
|
|
175
|
-
afterBulkDestroy: BulkHookHandler;
|
|
176
|
-
};
|
|
177
|
-
/**
|
|
178
|
-
* Create a beforeFind hook wrapper
|
|
179
|
-
*/
|
|
180
|
-
export declare function beforeFind(callback: FindHookHandler): {
|
|
181
|
-
beforeFind: FindHookHandler;
|
|
182
|
-
};
|
|
183
|
-
/**
|
|
184
|
-
* Create an afterFind hook wrapper
|
|
185
|
-
*/
|
|
186
|
-
export declare function afterFind(callback: FindHookHandler): {
|
|
187
|
-
afterFind: FindHookHandler;
|
|
188
|
-
};
|
|
189
|
-
export default HooksManager;
|