ts-prorm-orm 2.0.0 → 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.
Files changed (83) hide show
  1. package/CHANGELOG.md +132 -0
  2. package/dist/compliance/data-classifier.d.ts +6 -0
  3. package/dist/compliance/data-classifier.js +6 -0
  4. package/dist/compliance/data-lineage.d.ts +4 -0
  5. package/dist/compliance/data-lineage.js +4 -0
  6. package/dist/compliance/data-masker.d.ts +4 -0
  7. package/dist/compliance/data-masker.js +4 -0
  8. package/dist/compliance/index.d.ts +2 -0
  9. package/dist/compliance/index.js +2 -0
  10. package/dist/compliance/pseudonymization.d.ts +4 -0
  11. package/dist/compliance/pseudonymization.js +4 -0
  12. package/dist/compliance/query-firewall.d.ts +9 -9
  13. package/dist/compliance/query-firewall.js +9 -9
  14. package/dist/compliance/rate-limiter.d.ts +4 -0
  15. package/dist/compliance/rate-limiter.js +4 -0
  16. package/dist/compliance/row-level-security.d.ts +2 -0
  17. package/dist/compliance/row-level-security.js +2 -0
  18. package/dist/compliance/security-decorator.d.ts +8 -0
  19. package/dist/compliance/security-decorator.js +8 -0
  20. package/dist/compliance/session-isolation.d.ts +4 -0
  21. package/dist/compliance/session-isolation.js +4 -0
  22. package/dist/compliance/worm-storage.d.ts +4 -0
  23. package/dist/compliance/worm-storage.js +4 -0
  24. package/dist/decorators/audit.d.ts +3 -1
  25. package/dist/decorators/audit.js +3 -1
  26. package/dist/decorators/check.d.ts +15 -15
  27. package/dist/decorators/check.js +15 -15
  28. package/dist/decorators/collate.d.ts +16 -0
  29. package/dist/decorators/collate.js +16 -0
  30. package/dist/decorators/comment.d.ts +3 -1
  31. package/dist/decorators/comment.js +3 -1
  32. package/dist/decorators/database-settings.d.ts +6 -0
  33. package/dist/decorators/database-settings.js +6 -0
  34. package/dist/decorators/default.d.ts +2 -0
  35. package/dist/decorators/default.js +2 -0
  36. package/dist/decorators/encryption.d.ts +7 -1
  37. package/dist/decorators/encryption.js +7 -1
  38. package/dist/decorators/engine.d.ts +4 -0
  39. package/dist/decorators/engine.js +4 -0
  40. package/dist/decorators/fk-constraints.d.ts +32 -32
  41. package/dist/decorators/fk-constraints.js +32 -32
  42. package/dist/decorators/foreign-table.d.ts +1 -1
  43. package/dist/decorators/generated.d.ts +8 -0
  44. package/dist/decorators/generated.js +8 -0
  45. package/dist/decorators/hstore.d.ts +6 -0
  46. package/dist/decorators/hstore.js +6 -0
  47. package/dist/decorators/json-column.d.ts +2 -0
  48. package/dist/decorators/json-column.js +2 -0
  49. package/dist/decorators/jsonb.d.ts +6 -0
  50. package/dist/decorators/jsonb.js +6 -0
  51. package/dist/decorators/permissions.d.ts +12 -0
  52. package/dist/decorators/permissions.js +12 -0
  53. package/dist/decorators/procedure.d.ts +4 -2
  54. package/dist/decorators/procedure.js +4 -2
  55. package/dist/decorators/query-options.d.ts +24 -0
  56. package/dist/decorators/query-options.js +24 -0
  57. package/dist/decorators/range.d.ts +8 -0
  58. package/dist/decorators/range.js +8 -0
  59. package/dist/decorators/set-column.d.ts +2 -0
  60. package/dist/decorators/set-column.js +2 -0
  61. package/dist/decorators/spatial.d.ts +2 -0
  62. package/dist/decorators/spatial.js +2 -0
  63. package/dist/decorators/storage.d.ts +24 -0
  64. package/dist/decorators/storage.js +24 -0
  65. package/dist/decorators/timezone.d.ts +7 -7
  66. package/dist/decorators/timezone.js +7 -7
  67. package/dist/decorators/trigger.d.ts +3 -1
  68. package/dist/decorators/trigger.js +3 -1
  69. package/dist/decorators/uuid.d.ts +6 -0
  70. package/dist/decorators/uuid.js +6 -0
  71. package/dist/decorators/view.d.ts +7 -1
  72. package/dist/decorators/view.js +7 -1
  73. package/dist/dialects/dialect.d.ts +112 -0
  74. package/dist/external-fields/decorator.d.ts +2 -0
  75. package/dist/external-fields/decorator.js +2 -0
  76. package/dist/models/associations.d.ts +38 -0
  77. package/dist/models/associations.js +16 -0
  78. package/dist/models/decorators.d.ts +16 -16
  79. package/dist/models/decorators.js +21 -19
  80. package/dist/schema-objects.d.ts +42 -0
  81. package/dist/schema-objects.js +28 -0
  82. package/dist/types/index.d.ts +334 -0
  83. package/package.json +8 -4
@@ -5,6 +5,7 @@
5
5
  * based on a list of security frameworks. Works with the 12 compliance classes.
6
6
  *
7
7
  * Usage:
8
+ * ```ts
8
9
  * @Security({
9
10
  * frameworks: ['GDPR', 'HIPAA', 'PCI_DSS'],
10
11
  * audit: true,
@@ -19,6 +20,7 @@
19
20
  * immutable: true,
20
21
  * })
21
22
  * class FinancialRecord extends Model { ... }
23
+ * ```
22
24
  */
23
25
  import { RetentionDuration } from './data-retention';
24
26
  /**
@@ -260,6 +262,7 @@ export interface SecurityOptions {
260
262
  * @param options - Security configuration
261
263
  *
262
264
  * @example
265
+ * ```ts
263
266
  * @Security({
264
267
  * frameworks: ['GDPR', 'HIPAA', 'PCI_DSS'],
265
268
  * audit: true,
@@ -269,6 +272,7 @@ export interface SecurityOptions {
269
272
  * autoClassify: true,
270
273
  * })
271
274
  * class Patient extends Model { ... }
275
+ * ```
272
276
  */
273
277
  export declare function Security(options: SecurityOptions): (target: any) => void;
274
278
  /**
@@ -313,12 +317,14 @@ export interface TableSecurityOptions {
313
317
  * Apply table-level security metadata.
314
318
  *
315
319
  * @example
320
+ * ```ts
316
321
  * @Table({
317
322
  * schema: 'financial',
318
323
  * classification: 'CONFIDENTIAL',
319
324
  * rlsEnabled: true,
320
325
  * })
321
326
  * class Transaction extends Model { ... }
327
+ * ```
322
328
  */
323
329
  export declare function Table(options?: TableSecurityOptions): (target: any) => void;
324
330
  export interface DatabaseSecurityOptions {
@@ -355,6 +361,7 @@ export interface DatabaseSecurityOptions {
355
361
  * Apply database-level security metadata.
356
362
  *
357
363
  * @example
364
+ * ```ts
358
365
  * @Database({
359
366
  * name: 'healthcare_db',
360
367
  * region: 'us-east-1',
@@ -364,6 +371,7 @@ export interface DatabaseSecurityOptions {
364
371
  * allowedCountries: ['US'],
365
372
  * })
366
373
  * class HealthcareDB extends Model { ... }
374
+ * ```
367
375
  */
368
376
  export declare function Database(options: DatabaseSecurityOptions): (target: any) => void;
369
377
  /**
@@ -6,6 +6,7 @@
6
6
  * based on a list of security frameworks. Works with the 12 compliance classes.
7
7
  *
8
8
  * Usage:
9
+ * ```ts
9
10
  * @Security({
10
11
  * frameworks: ['GDPR', 'HIPAA', 'PCI_DSS'],
11
12
  * audit: true,
@@ -20,6 +21,7 @@
20
21
  * immutable: true,
21
22
  * })
22
23
  * class FinancialRecord extends Model { ... }
24
+ * ```
23
25
  */
24
26
  Object.defineProperty(exports, "__esModule", { value: true });
25
27
  exports.FrameworkRequirements = exports.FrameworkCount = exports.FrameworkCategories = exports.AllFrameworks = exports.SecurityFramework = void 0;
@@ -324,6 +326,7 @@ exports.FrameworkRequirements = {
324
326
  * @param options - Security configuration
325
327
  *
326
328
  * @example
329
+ * ```ts
327
330
  * @Security({
328
331
  * frameworks: ['GDPR', 'HIPAA', 'PCI_DSS'],
329
332
  * audit: true,
@@ -333,6 +336,7 @@ exports.FrameworkRequirements = {
333
336
  * autoClassify: true,
334
337
  * })
335
338
  * class Patient extends Model { ... }
339
+ * ```
336
340
  */
337
341
  function Security(options) {
338
342
  return function (target) {
@@ -510,12 +514,14 @@ function setupAllSecurity(prorm) {
510
514
  * Apply table-level security metadata.
511
515
  *
512
516
  * @example
517
+ * ```ts
513
518
  * @Table({
514
519
  * schema: 'financial',
515
520
  * classification: 'CONFIDENTIAL',
516
521
  * rlsEnabled: true,
517
522
  * })
518
523
  * class Transaction extends Model { ... }
524
+ * ```
519
525
  */
520
526
  function Table(options = {}) {
521
527
  return function (target) {
@@ -526,6 +532,7 @@ function Table(options = {}) {
526
532
  * Apply database-level security metadata.
527
533
  *
528
534
  * @example
535
+ * ```ts
529
536
  * @Database({
530
537
  * name: 'healthcare_db',
531
538
  * region: 'us-east-1',
@@ -535,6 +542,7 @@ function Table(options = {}) {
535
542
  * allowedCountries: ['US'],
536
543
  * })
537
544
  * class HealthcareDB extends Model { ... }
545
+ * ```
538
546
  */
539
547
  function Database(options) {
540
548
  return function (target) {
@@ -28,9 +28,11 @@
28
28
  * return db.User.findAll();
29
29
  * });
30
30
  *
31
+ * ```ts
31
32
  * // Use the decorator on models:
32
33
  * @TenantIsolation({ tenantId: 'tenantId', auditEnabled: true })
33
34
  * class Document extends Model { ... }
35
+ * ```
34
36
  */
35
37
  export interface TenantContext {
36
38
  /** The tenant identifier */
@@ -234,11 +236,13 @@ export declare class SessionIsolation {
234
236
  /**
235
237
  * Decorator to apply tenant isolation to a model.
236
238
  *
239
+ * ```ts
237
240
  * @TenantIsolation({ tenantId: 'tenantId', auditEnabled: true })
238
241
  * class Document extends Model {
239
242
  * tenantId: string;
240
243
  * title: string;
241
244
  * }
245
+ * ```
242
246
  *
243
247
  * @param options - Tenant isolation options
244
248
  */
@@ -29,9 +29,11 @@
29
29
  * return db.User.findAll();
30
30
  * });
31
31
  *
32
+ * ```ts
32
33
  * // Use the decorator on models:
33
34
  * @TenantIsolation({ tenantId: 'tenantId', auditEnabled: true })
34
35
  * class Document extends Model { ... }
36
+ * ```
35
37
  */
36
38
  Object.defineProperty(exports, "__esModule", { value: true });
37
39
  exports.TenantIsolationManager = exports.SessionIsolation = void 0;
@@ -347,11 +349,13 @@ exports.SessionIsolation = SessionIsolation;
347
349
  /**
348
350
  * Decorator to apply tenant isolation to a model.
349
351
  *
352
+ * ```ts
350
353
  * @TenantIsolation({ tenantId: 'tenantId', auditEnabled: true })
351
354
  * class Document extends Model {
352
355
  * tenantId: string;
353
356
  * title: string;
354
357
  * }
358
+ * ```
355
359
  *
356
360
  * @param options - Tenant isolation options
357
361
  */
@@ -30,9 +30,11 @@
30
30
  * // Enforce retention policy:
31
31
  * await WORMStorage.enforceRetention(FinancialRecord, prorm);
32
32
  *
33
+ * ```ts
33
34
  * // Using the decorator:
34
35
  * @WORM({ retentionPeriod: { years: 7 }, tamperEvident: true })
35
36
  * class FinancialRecord extends Model { ... }
37
+ * ```
36
38
  */
37
39
  import { ModelStatic, Prorm } from '../prorm';
38
40
  import { RetentionDuration } from './data-retention';
@@ -91,8 +93,10 @@ interface WORMConfig {
91
93
  /**
92
94
  * Decorator to mark a model for WORM storage.
93
95
  *
96
+ * ```ts
94
97
  * @WORM({ retentionPeriod: { years: 7 }, tamperEvident: true })
95
98
  * class FinancialRecord extends Model { ... }
99
+ * ```
96
100
  */
97
101
  export declare function WORM(options: WORMOptions): (target: Function) => void;
98
102
  /**
@@ -31,9 +31,11 @@
31
31
  * // Enforce retention policy:
32
32
  * await WORMStorage.enforceRetention(FinancialRecord, prorm);
33
33
  *
34
+ * ```ts
34
35
  * // Using the decorator:
35
36
  * @WORM({ retentionPeriod: { years: 7 }, tamperEvident: true })
36
37
  * class FinancialRecord extends Model { ... }
38
+ * ```
37
39
  */
38
40
  Object.defineProperty(exports, "__esModule", { value: true });
39
41
  exports.WORMStorage = void 0;
@@ -173,8 +175,10 @@ function createWORMTamperLogModel(prorm, tableName) {
173
175
  /**
174
176
  * Decorator to mark a model for WORM storage.
175
177
  *
178
+ * ```ts
176
179
  * @WORM({ retentionPeriod: { years: 7 }, tamperEvident: true })
177
180
  * class FinancialRecord extends Model { ... }
181
+ * ```
178
182
  */
179
183
  function WORM(options) {
180
184
  return function (target) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @Audit class decorator — automatically record model lifecycle events to an
2
+ * `@Audit` class decorator — automatically record model lifecycle events to an
3
3
  * in-memory audit log.
4
4
  *
5
5
  * When applied to a model class the decorator registers beforeCreate,
@@ -8,12 +8,14 @@
8
8
  *
9
9
  * Example:
10
10
  *
11
+ * ```ts
11
12
  * @Audit({ tableName: 'audit_log', trackFields: ['name', 'email'] })
12
13
  * class User extends Model { ... }
13
14
  *
14
15
  * // After create/update/destroy hooks fire:
15
16
  * const log = getAuditLog(User);
16
17
  * clearAuditLog(User);
18
+ * ```
17
19
  */
18
20
  export interface AuditOptions {
19
21
  /** Name of the conceptual audit table (used as label in entries). Default: 'audit_log'. */
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * @Audit class decorator — automatically record model lifecycle events to an
3
+ * `@Audit` class decorator — automatically record model lifecycle events to an
4
4
  * in-memory audit log.
5
5
  *
6
6
  * When applied to a model class the decorator registers beforeCreate,
@@ -9,12 +9,14 @@
9
9
  *
10
10
  * Example:
11
11
  *
12
+ * ```ts
12
13
  * @Audit({ tableName: 'audit_log', trackFields: ['name', 'email'] })
13
14
  * class User extends Model { ... }
14
15
  *
15
16
  * // After create/update/destroy hooks fire:
16
17
  * const log = getAuditLog(User);
17
18
  * clearAuditLog(User);
19
+ * ```
18
20
  */
19
21
  Object.defineProperty(exports, "__esModule", { value: true });
20
22
  exports.getAuditLog = getAuditLog;
@@ -1,34 +1,34 @@
1
1
  /**
2
- * @Check decorator for the ORM — generates CHECK constraints without writing raw SQL.
2
+ * `@Check` decorator for the ORM — generates CHECK constraints without writing raw SQL.
3
3
  *
4
4
  * Supports ORM-native operator syntax that gets converted to SQL CHECK expressions.
5
5
  *
6
6
  * Usage Examples:
7
7
  *
8
8
  * // Column-level check with ORM operators
9
- * @Check({ age: { $gte: 18 } })
9
+ * `@Check`({ age: { $gte: 18 } })
10
10
  * age: number;
11
11
  *
12
12
  * // Multiple column checks
13
- * @Check({
13
+ * `@Check`({
14
14
  * status: { $in: ['active', 'pending', 'draft'] },
15
15
  * email: { $regex: '^[^@]+@[^@]+$' }
16
16
  * })
17
17
  * email: string;
18
18
  *
19
19
  * // Custom condition with message
20
- * @Check({
20
+ * `@Check`({
21
21
  * condition: (row) => row.startDate < row.endDate,
22
22
  * message: 'Start date must be before end date'
23
23
  * })
24
24
  * startDate: Date;
25
25
  *
26
26
  * // Column-level check (explicit column)
27
- * @CheckColumn('price', { $gte: 0 }, 'Price must be positive')
28
- * @CheckColumn('quantity', { $gt: 0 }, 'Quantity must be greater than zero')
27
+ * `@CheckColumn`('price', { $gte: 0 }, 'Price must be positive')
28
+ * `@CheckColumn`('quantity', { $gt: 0 }, 'Quantity must be greater than zero')
29
29
  *
30
30
  * // Table-level check (multiple columns)
31
- * @CheckTable({
31
+ * `@CheckTable`({
32
32
  * condition: (row) => row.quantity * row.price >= row.minimumOrder,
33
33
  * message: 'Total must meet minimum order amount'
34
34
  * })
@@ -155,21 +155,21 @@ export type CheckDialect = 'mysql' | 'mariadb' | 'postgres' | 'mssql' | 'oracle'
155
155
  */
156
156
  export declare function operatorToSQL(fieldName: string, operator: CheckOperator, dialect?: CheckDialect): string;
157
157
  /**
158
- * @Check decorator — attach CHECK constraints to a column or multiple columns.
158
+ * `@Check` decorator — attach CHECK constraints to a column or multiple columns.
159
159
  *
160
160
  * For column-level use (on class property):
161
- * @Check({ age: { $gte: 18 } })
161
+ * `@Check`({ age: { $gte: 18 } })
162
162
  * age: number;
163
163
  *
164
164
  * For multiple checks:
165
- * @Check({
165
+ * `@Check`({
166
166
  * status: { $in: ['active', 'pending'] },
167
167
  * email: { $regex: '^[^@]+@[^@]+$' }
168
168
  * })
169
169
  * email: string;
170
170
  *
171
171
  * For row-level condition:
172
- * @Check({
172
+ * `@Check`({
173
173
  * condition: (row) => row.startDate < row.endDate,
174
174
  * message: 'Start date must be before end date'
175
175
  * })
@@ -177,16 +177,16 @@ export declare function operatorToSQL(fieldName: string, operator: CheckOperator
177
177
  */
178
178
  export declare function Check(options: CheckConstraintOptions): PropertyDecorator;
179
179
  /**
180
- * @CheckColumn decorator — explicit column-level CHECK constraint.
180
+ * `@CheckColumn` decorator — explicit column-level CHECK constraint.
181
181
  *
182
- * @CheckColumn('price', { $gte: 0 }, 'Price must be positive')
182
+ * `@CheckColumn`('price', { $gte: 0 }, 'Price must be positive')
183
183
  * price: number;
184
184
  */
185
185
  export declare function CheckColumn(column: string, operator: CheckOperator, message?: string): PropertyDecorator;
186
186
  /**
187
- * @CheckTable decorator — table-level CHECK constraint with multi-column conditions.
187
+ * `@CheckTable` decorator — table-level CHECK constraint with multi-column conditions.
188
188
  *
189
- * @CheckTable({
189
+ * `@CheckTable`({
190
190
  * condition: (row) => row.quantity * row.price >= row.minimumOrder,
191
191
  * message: 'Total must meet minimum order amount'
192
192
  * })
@@ -1,35 +1,35 @@
1
1
  "use strict";
2
2
  /**
3
- * @Check decorator for the ORM — generates CHECK constraints without writing raw SQL.
3
+ * `@Check` decorator for the ORM — generates CHECK constraints without writing raw SQL.
4
4
  *
5
5
  * Supports ORM-native operator syntax that gets converted to SQL CHECK expressions.
6
6
  *
7
7
  * Usage Examples:
8
8
  *
9
9
  * // Column-level check with ORM operators
10
- * @Check({ age: { $gte: 18 } })
10
+ * `@Check`({ age: { $gte: 18 } })
11
11
  * age: number;
12
12
  *
13
13
  * // Multiple column checks
14
- * @Check({
14
+ * `@Check`({
15
15
  * status: { $in: ['active', 'pending', 'draft'] },
16
16
  * email: { $regex: '^[^@]+@[^@]+$' }
17
17
  * })
18
18
  * email: string;
19
19
  *
20
20
  * // Custom condition with message
21
- * @Check({
21
+ * `@Check`({
22
22
  * condition: (row) => row.startDate < row.endDate,
23
23
  * message: 'Start date must be before end date'
24
24
  * })
25
25
  * startDate: Date;
26
26
  *
27
27
  * // Column-level check (explicit column)
28
- * @CheckColumn('price', { $gte: 0 }, 'Price must be positive')
29
- * @CheckColumn('quantity', { $gt: 0 }, 'Quantity must be greater than zero')
28
+ * `@CheckColumn`('price', { $gte: 0 }, 'Price must be positive')
29
+ * `@CheckColumn`('quantity', { $gt: 0 }, 'Quantity must be greater than zero')
30
30
  *
31
31
  * // Table-level check (multiple columns)
32
- * @CheckTable({
32
+ * `@CheckTable`({
33
33
  * condition: (row) => row.quantity * row.price >= row.minimumOrder,
34
34
  * message: 'Total must meet minimum order amount'
35
35
  * })
@@ -270,21 +270,21 @@ function conditionToSQL(condition, paramNames) {
270
270
  }
271
271
  // ==================== Decorators ====================
272
272
  /**
273
- * @Check decorator — attach CHECK constraints to a column or multiple columns.
273
+ * `@Check` decorator — attach CHECK constraints to a column or multiple columns.
274
274
  *
275
275
  * For column-level use (on class property):
276
- * @Check({ age: { $gte: 18 } })
276
+ * `@Check`({ age: { $gte: 18 } })
277
277
  * age: number;
278
278
  *
279
279
  * For multiple checks:
280
- * @Check({
280
+ * `@Check`({
281
281
  * status: { $in: ['active', 'pending'] },
282
282
  * email: { $regex: '^[^@]+@[^@]+$' }
283
283
  * })
284
284
  * email: string;
285
285
  *
286
286
  * For row-level condition:
287
- * @Check({
287
+ * `@Check`({
288
288
  * condition: (row) => row.startDate < row.endDate,
289
289
  * message: 'Start date must be before end date'
290
290
  * })
@@ -328,9 +328,9 @@ function Check(options) {
328
328
  };
329
329
  }
330
330
  /**
331
- * @CheckColumn decorator — explicit column-level CHECK constraint.
331
+ * `@CheckColumn` decorator — explicit column-level CHECK constraint.
332
332
  *
333
- * @CheckColumn('price', { $gte: 0 }, 'Price must be positive')
333
+ * `@CheckColumn`('price', { $gte: 0 }, 'Price must be positive')
334
334
  * price: number;
335
335
  */
336
336
  function CheckColumn(column, operator, message) {
@@ -348,9 +348,9 @@ function CheckColumn(column, operator, message) {
348
348
  };
349
349
  }
350
350
  /**
351
- * @CheckTable decorator — table-level CHECK constraint with multi-column conditions.
351
+ * `@CheckTable` decorator — table-level CHECK constraint with multi-column conditions.
352
352
  *
353
- * @CheckTable({
353
+ * `@CheckTable`({
354
354
  * condition: (row) => row.quantity * row.price >= row.minimumOrder,
355
355
  * message: 'Total must meet minimum order amount'
356
356
  * })
@@ -6,6 +6,7 @@
6
6
  *
7
7
  * Usage:
8
8
  *
9
+ * ```ts
9
10
  * // Column-level collation
10
11
  * class User extends Model {
11
12
  * @SetCollate(CollateEnum.UTF8MB4_UNICODE_CI)
@@ -38,6 +39,7 @@
38
39
  * lcCtype: 'es_ES.UTF-8',
39
40
  * template: 'template0',
40
41
  * });
42
+ * ```
41
43
  */
42
44
  /**
43
45
  * MySQL/MariaDB collation constants
@@ -255,33 +257,42 @@ export interface OrderByOptions {
255
257
  * Decorator to set column-level collation
256
258
  *
257
259
  * Usage:
260
+ * ```ts
258
261
  * @Collate(Collate.UTF8MB4_UNICODE_CI)
259
262
  * @Column
260
263
  * name: string;
264
+ * ```
261
265
  *
262
266
  * Or with options:
267
+ * ```ts
263
268
  * @Collate({ collate: Collate.UTF8MB4_BIN, unique: true })
264
269
  * @Column
265
270
  * email: string;
271
+ * ```
266
272
  */
267
273
  /**
268
274
  * Decorator to set column-level collation
269
275
  *
270
276
  * Usage:
277
+ * ```ts
271
278
  * @SetCollate(CollateEnum.UTF8MB4_UNICODE_CI)
272
279
  * @Column
273
280
  * name: string;
281
+ * ```
274
282
  *
275
283
  * Or with options:
284
+ * ```ts
276
285
  * @SetCollate({ collate: CollateEnum.UTF8MB4_BIN, unique: true })
277
286
  * @Column
278
287
  * email: string;
288
+ * ```
279
289
  */
280
290
  export declare function SetCollate(collation: string | CollateOptions): ClassDecorator & PropertyDecorator;
281
291
  /**
282
292
  * Decorator to set database-level options
283
293
  *
284
294
  * Usage:
295
+ * ```ts
285
296
  * @Database({
286
297
  * name: 'miapp',
287
298
  * encoding: 'UTF8',
@@ -290,22 +301,27 @@ export declare function SetCollate(collation: string | CollateOptions): ClassDec
290
301
  * connectionLimit: 25,
291
302
  * })
292
303
  * class Config extends Model {}
304
+ * ```
293
305
  */
294
306
  export declare function Database(options: DatabaseOptions): ClassDecorator;
295
307
  /**
296
308
  * Decorator to set table-level collation and options
297
309
  *
298
310
  * Usage:
311
+ * ```ts
299
312
  * @TableCollate({ collate: 'utf8mb4_spanish_ci', engine: 'InnoDB' })
300
313
  * class User extends Model {}
314
+ * ```
301
315
  */
302
316
  export declare function TableCollate(options: TableCollateOptions): ClassDecorator;
303
317
  /**
304
318
  * Decorator to specify order by with collation
305
319
  *
306
320
  * Usage:
321
+ * ```ts
307
322
  * @OrderBy('name', 'ASC', Collate.UTF8MB4_SPANISH_CI)
308
323
  * class User extends Model {}
324
+ * ```
309
325
  */
310
326
  export declare function OrderBy(column: string, direction?: 'ASC' | 'DESC', collate?: string): ClassDecorator;
311
327
  /**
@@ -7,6 +7,7 @@
7
7
  *
8
8
  * Usage:
9
9
  *
10
+ * ```ts
10
11
  * // Column-level collation
11
12
  * class User extends Model {
12
13
  * @SetCollate(CollateEnum.UTF8MB4_UNICODE_CI)
@@ -39,6 +40,7 @@
39
40
  * lcCtype: 'es_ES.UTF-8',
40
41
  * template: 'template0',
41
42
  * });
43
+ * ```
42
44
  */
43
45
  Object.defineProperty(exports, "__esModule", { value: true });
44
46
  exports.Locale = exports.LocaleEnum = exports.Collate = exports.CollateEnum = void 0;
@@ -158,27 +160,35 @@ const orderByMetadata = new Map();
158
160
  * Decorator to set column-level collation
159
161
  *
160
162
  * Usage:
163
+ * ```ts
161
164
  * @Collate(Collate.UTF8MB4_UNICODE_CI)
162
165
  * @Column
163
166
  * name: string;
167
+ * ```
164
168
  *
165
169
  * Or with options:
170
+ * ```ts
166
171
  * @Collate({ collate: Collate.UTF8MB4_BIN, unique: true })
167
172
  * @Column
168
173
  * email: string;
174
+ * ```
169
175
  */
170
176
  /**
171
177
  * Decorator to set column-level collation
172
178
  *
173
179
  * Usage:
180
+ * ```ts
174
181
  * @SetCollate(CollateEnum.UTF8MB4_UNICODE_CI)
175
182
  * @Column
176
183
  * name: string;
184
+ * ```
177
185
  *
178
186
  * Or with options:
187
+ * ```ts
179
188
  * @SetCollate({ collate: CollateEnum.UTF8MB4_BIN, unique: true })
180
189
  * @Column
181
190
  * email: string;
191
+ * ```
182
192
  */
183
193
  function SetCollate(collation) {
184
194
  return function (target, propertyKey) {
@@ -202,6 +212,7 @@ function SetCollate(collation) {
202
212
  * Decorator to set database-level options
203
213
  *
204
214
  * Usage:
215
+ * ```ts
205
216
  * @Database({
206
217
  * name: 'miapp',
207
218
  * encoding: 'UTF8',
@@ -210,6 +221,7 @@ function SetCollate(collation) {
210
221
  * connectionLimit: 25,
211
222
  * })
212
223
  * class Config extends Model {}
224
+ * ```
213
225
  */
214
226
  function Database(options) {
215
227
  return function (target) {
@@ -220,8 +232,10 @@ function Database(options) {
220
232
  * Decorator to set table-level collation and options
221
233
  *
222
234
  * Usage:
235
+ * ```ts
223
236
  * @TableCollate({ collate: 'utf8mb4_spanish_ci', engine: 'InnoDB' })
224
237
  * class User extends Model {}
238
+ * ```
225
239
  */
226
240
  function TableCollate(options) {
227
241
  return function (target) {
@@ -232,8 +246,10 @@ function TableCollate(options) {
232
246
  * Decorator to specify order by with collation
233
247
  *
234
248
  * Usage:
249
+ * ```ts
235
250
  * @OrderBy('name', 'ASC', Collate.UTF8MB4_SPANISH_CI)
236
251
  * class User extends Model {}
252
+ * ```
237
253
  */
238
254
  function OrderBy(column, direction = 'ASC', collate) {
239
255
  return function (target) {
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @Comment decorator for database schema annotations
2
+ * `@Comment` decorator for database schema annotations
3
3
  *
4
4
  * Provides the ability to add comments to various database objects:
5
5
  * - Table-level comments (on model classes)
@@ -9,6 +9,7 @@
9
9
  *
10
10
  * Usage:
11
11
  *
12
+ * ```ts
12
13
  * @Comment('This table stores user information')
13
14
  * class User extends Model { ... }
14
15
  *
@@ -19,6 +20,7 @@
19
20
  * @Column
20
21
  * @Comment('User email address')
21
22
  * email: string;
23
+ * ```
22
24
  */
23
25
  export interface CommentOptions {
24
26
  value: string;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  /**
3
- * @Comment decorator for database schema annotations
3
+ * `@Comment` decorator for database schema annotations
4
4
  *
5
5
  * Provides the ability to add comments to various database objects:
6
6
  * - Table-level comments (on model classes)
@@ -10,6 +10,7 @@
10
10
  *
11
11
  * Usage:
12
12
  *
13
+ * ```ts
13
14
  * @Comment('This table stores user information')
14
15
  * class User extends Model { ... }
15
16
  *
@@ -20,6 +21,7 @@
20
21
  * @Column
21
22
  * @Comment('User email address')
22
23
  * email: string;
24
+ * ```
23
25
  */
24
26
  Object.defineProperty(exports, "__esModule", { value: true });
25
27
  exports.CommentRegistry = void 0;