postgrelize 0.0.0-stage → 1.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 (319) hide show
  1. package/CHANGELOG.md +289 -0
  2. package/LICENSE +21 -0
  3. package/README.md +131 -2
  4. package/dist/associations/alias-minifier.d.ts +43 -0
  5. package/dist/associations/association-accessors.d.ts +21 -0
  6. package/dist/associations/association-key-types.d.ts +44 -0
  7. package/dist/associations/association-keys.d.ts +98 -0
  8. package/dist/associations/association-lookup.d.ts +26 -0
  9. package/dist/associations/association-shape.d.ts +25 -0
  10. package/dist/associations/association.d.ts +95 -0
  11. package/dist/associations/belongs-to-many.d.ts +86 -0
  12. package/dist/associations/belongs-to.d.ts +45 -0
  13. package/dist/associations/has-many.d.ts +79 -0
  14. package/dist/associations/has-one.d.ts +44 -0
  15. package/dist/associations/include-assembler.d.ts +21 -0
  16. package/dist/associations/include-columns.d.ts +24 -0
  17. package/dist/associations/include-joins.d.ts +17 -0
  18. package/dist/associations/include-loader.d.ts +48 -0
  19. package/dist/associations/include-order.d.ts +22 -0
  20. package/dist/associations/include-query-builder.d.ts +54 -0
  21. package/dist/associations/include-resolver.d.ts +29 -0
  22. package/dist/associations/include-rows.d.ts +47 -0
  23. package/dist/associations/include-sub-query.d.ts +35 -0
  24. package/dist/associations/include.d.ts +112 -0
  25. package/dist/associations/junction-keys.d.ts +23 -0
  26. package/dist/associations/nested-creator.d.ts +44 -0
  27. package/dist/associations/nested-saver.d.ts +30 -0
  28. package/dist/associations/owner-keys.d.ts +34 -0
  29. package/dist/associations/separate-include-loader.d.ts +24 -0
  30. package/dist/associations/types.d.ts +139 -0
  31. package/dist/connection/after-connect-hook.d.ts +24 -0
  32. package/dist/connection/connect-hooks.d.ts +26 -0
  33. package/dist/connection/connection-config.d.ts +33 -0
  34. package/dist/connection/connection-manager.d.ts +65 -0
  35. package/dist/connection/connection-types.d.ts +21 -0
  36. package/dist/connection/copy-from-stdin.d.ts +52 -0
  37. package/dist/connection/copy-runner.d.ts +30 -0
  38. package/dist/connection/copy-to-stdout.d.ts +49 -0
  39. package/dist/connection/copy.d.ts +22 -0
  40. package/dist/connection/notifications.d.ts +28 -0
  41. package/dist/connection/options.d.ts +165 -0
  42. package/dist/connection/query-logger.d.ts +41 -0
  43. package/dist/connection/replica-router.d.ts +20 -0
  44. package/dist/connection/statement-cache.d.ts +36 -0
  45. package/dist/connection/statement-timeout.d.ts +22 -0
  46. package/dist/data-types/abstract-data-type.d.ts +58 -0
  47. package/dist/data-types/array-literal-parser.d.ts +17 -0
  48. package/dist/data-types/array-type.d.ts +18 -0
  49. package/dist/data-types/bit-type.d.ts +14 -0
  50. package/dist/data-types/blob-type.d.ts +12 -0
  51. package/dist/data-types/char-type.d.ts +12 -0
  52. package/dist/data-types/composite-fields.d.ts +26 -0
  53. package/dist/data-types/composite-type.d.ts +32 -0
  54. package/dist/data-types/data-types.d.ts +176 -0
  55. package/dist/data-types/date-type.d.ts +14 -0
  56. package/dist/data-types/decimal-type.d.ts +13 -0
  57. package/dist/data-types/default-value-generator.d.ts +15 -0
  58. package/dist/data-types/enum-type.d.ts +19 -0
  59. package/dist/data-types/ewkb-reader.d.ts +18 -0
  60. package/dist/data-types/ewkb-writer.d.ts +17 -0
  61. package/dist/data-types/float-type.d.ts +12 -0
  62. package/dist/data-types/geometric-text.d.ts +65 -0
  63. package/dist/data-types/geometric-type.d.ts +46 -0
  64. package/dist/data-types/hstore-type.d.ts +16 -0
  65. package/dist/data-types/integer-type.d.ts +24 -0
  66. package/dist/data-types/json-type.d.ts +16 -0
  67. package/dist/data-types/multirange-type.d.ts +19 -0
  68. package/dist/data-types/range-type.d.ts +28 -0
  69. package/dist/data-types/record-text.d.ts +29 -0
  70. package/dist/data-types/scalar-type.d.ts +13 -0
  71. package/dist/data-types/spatial-type.d.ts +20 -0
  72. package/dist/data-types/string-type.d.ts +12 -0
  73. package/dist/data-types/text-type.d.ts +12 -0
  74. package/dist/data-types/timestamp-type.d.ts +15 -0
  75. package/dist/data-types/virtual-type.d.ts +15 -0
  76. package/dist/data-types/wall-clock.d.ts +14 -0
  77. package/dist/ddl/column-ddl.d.ts +73 -0
  78. package/dist/ddl/constraint-ddl.d.ts +30 -0
  79. package/dist/ddl/ddl-generator.d.ts +181 -0
  80. package/dist/ddl/ddl-guards.d.ts +60 -0
  81. package/dist/ddl/ddl-types.d.ts +204 -0
  82. package/dist/ddl/enum-ddl.d.ts +42 -0
  83. package/dist/ddl/extension-ddl.d.ts +57 -0
  84. package/dist/ddl/function-ddl.d.ts +98 -0
  85. package/dist/ddl/index-ddl.d.ts +29 -0
  86. package/dist/ddl/index-element-ddl.d.ts +19 -0
  87. package/dist/ddl/partition-ddl.d.ts +88 -0
  88. package/dist/ddl/partition-types.d.ts +94 -0
  89. package/dist/ddl/policy-ddl.d.ts +137 -0
  90. package/dist/ddl/routine-guards.d.ts +63 -0
  91. package/dist/ddl/sequence-ddl.d.ts +103 -0
  92. package/dist/ddl/sql-literal.d.ts +61 -0
  93. package/dist/ddl/table-ddl.d.ts +35 -0
  94. package/dist/ddl/trigger-ddl.d.ts +81 -0
  95. package/dist/ddl/view-ddl.d.ts +122 -0
  96. package/dist/decorators/association-applier.d.ts +18 -0
  97. package/dist/decorators/association-decorators.d.ts +72 -0
  98. package/dist/decorators/column-decorators.d.ts +147 -0
  99. package/dist/decorators/decorator-factory.d.ts +45 -0
  100. package/dist/decorators/decorator-signature.d.ts +26 -0
  101. package/dist/decorators/decorator-types.d.ts +24 -0
  102. package/dist/decorators/foreign-key-decorator.d.ts +21 -0
  103. package/dist/decorators/hook-decorators.d.ts +393 -0
  104. package/dist/decorators/init-arguments.d.ts +29 -0
  105. package/dist/decorators/model-decorators.d.ts +18 -0
  106. package/dist/decorators/model-metadata.d.ts +70 -0
  107. package/dist/decorators/table-decorators.d.ts +43 -0
  108. package/dist/decorators/timestamp-decorators.d.ts +38 -0
  109. package/dist/errors/base-error.d.ts +40 -0
  110. package/dist/errors/connection-errors.d.ts +152 -0
  111. package/dist/errors/database-errors.d.ts +186 -0
  112. package/dist/errors/errors.d.ts +5 -0
  113. package/dist/errors/map-pg-error.d.ts +27 -0
  114. package/dist/errors/misc-errors.d.ts +232 -0
  115. package/dist/errors/validation-errors.d.ts +141 -0
  116. package/dist/exports-associations.d.ts +6 -0
  117. package/dist/exports-core.d.ts +95 -0
  118. package/dist/exports-decorators.d.ts +8 -0
  119. package/dist/exports-errors.d.ts +2 -0
  120. package/dist/exports-model.d.ts +21 -0
  121. package/dist/exports-schema.d.ts +19 -0
  122. package/dist/expressions/call-expressions.d.ts +54 -0
  123. package/dist/expressions/condition-expressions.d.ts +51 -0
  124. package/dist/expressions/expression.d.ts +52 -0
  125. package/dist/expressions/jsonpath-helpers.d.ts +37 -0
  126. package/dist/expressions/logic.d.ts +25 -0
  127. package/dist/expressions/methods.d.ts +188 -0
  128. package/dist/expressions/op.d.ts +182 -0
  129. package/dist/expressions/query-expressions.d.ts +110 -0
  130. package/dist/expressions/row-expressions.d.ts +35 -0
  131. package/dist/expressions/search-helpers.d.ts +138 -0
  132. package/dist/expressions/trigram-helpers.d.ts +40 -0
  133. package/dist/hooks/hooks.d.ts +125 -0
  134. package/dist/index.cjs +21864 -0
  135. package/dist/index.cjs.map +1 -0
  136. package/dist/index.d.ts +6 -0
  137. package/dist/index.js +21688 -0
  138. package/dist/index.js.map +1 -0
  139. package/dist/model/attribute-columns.d.ts +85 -0
  140. package/dist/model/attribute-normalizer.d.ts +42 -0
  141. package/dist/model/attribute-options.d.ts +121 -0
  142. package/dist/model/bulk-insert-builder.d.ts +24 -0
  143. package/dist/model/bulk-options.d.ts +173 -0
  144. package/dist/model/copy-options.d.ts +51 -0
  145. package/dist/model/cte-builder.d.ts +134 -0
  146. package/dist/model/definition-normalizer.d.ts +26 -0
  147. package/dist/model/delete-query-builder.d.ts +42 -0
  148. package/dist/model/find-options.d.ts +144 -0
  149. package/dist/model/find-query-builder.d.ts +38 -0
  150. package/dist/model/inflector.d.ts +28 -0
  151. package/dist/model/insert-query-builder.d.ts +41 -0
  152. package/dist/model/instance-destroyer.d.ts +44 -0
  153. package/dist/model/instance-lifecycle-services.d.ts +61 -0
  154. package/dist/model/instance-lifecycle.d.ts +128 -0
  155. package/dist/model/instance-saver.d.ts +25 -0
  156. package/dist/model/instance-state.d.ts +48 -0
  157. package/dist/model/instance-validation.d.ts +35 -0
  158. package/dist/model/instance-values.d.ts +88 -0
  159. package/dist/model/instance-writer.d.ts +59 -0
  160. package/dist/model/join-source-builder.d.ts +25 -0
  161. package/dist/model/lateral-keys-builder.d.ts +25 -0
  162. package/dist/model/merge-action-builder.d.ts +31 -0
  163. package/dist/model/merge-options.d.ts +72 -0
  164. package/dist/model/merge-query-builder.d.ts +29 -0
  165. package/dist/model/merge-source-builder.d.ts +22 -0
  166. package/dist/model/mixins/model-aggregates.d.ts +69 -0
  167. package/dist/model/mixins/model-associations.d.ts +113 -0
  168. package/dist/model/mixins/model-constructor.d.ts +7 -0
  169. package/dist/model/mixins/model-finders.d.ts +140 -0
  170. package/dist/model/mixins/model-hooks.d.ts +142 -0
  171. package/dist/model/mixins/model-postgres.d.ts +198 -0
  172. package/dist/model/mixins/model-schema-binding.d.ts +36 -0
  173. package/dist/model/mixins/model-schema.d.ts +100 -0
  174. package/dist/model/mixins/model-scopes.d.ts +57 -0
  175. package/dist/model/mixins/model-writers.d.ts +175 -0
  176. package/dist/model/mixins/named-hooks.d.ts +28 -0
  177. package/dist/model/model-accessors.d.ts +22 -0
  178. package/dist/model/model-base.d.ts +83 -0
  179. package/dist/model/model-definition.d.ts +130 -0
  180. package/dist/model/model-instance-persistence.d.ts +132 -0
  181. package/dist/model/model-instance-values.d.ts +197 -0
  182. package/dist/model/model-operations.d.ts +22 -0
  183. package/dist/model/model-registry.d.ts +152 -0
  184. package/dist/model/model-services.d.ts +46 -0
  185. package/dist/model/model-state.d.ts +68 -0
  186. package/dist/model/model-values.d.ts +86 -0
  187. package/dist/model/model.d.ts +629 -0
  188. package/dist/model/on-conflict-builder.d.ts +111 -0
  189. package/dist/model/operations/bulk-create-operation.d.ts +40 -0
  190. package/dist/model/operations/copy-from-source.d.ts +51 -0
  191. package/dist/model/operations/copy-operation.d.ts +54 -0
  192. package/dist/model/operations/count-operation.d.ts +52 -0
  193. package/dist/model/operations/create-operation.d.ts +31 -0
  194. package/dist/model/operations/destroy-operation.d.ts +65 -0
  195. package/dist/model/operations/find-cursor.d.ts +23 -0
  196. package/dist/model/operations/find-lookups.d.ts +99 -0
  197. package/dist/model/operations/find-operation.d.ts +47 -0
  198. package/dist/model/operations/increment-operation.d.ts +40 -0
  199. package/dist/model/operations/insert-operation.d.ts +71 -0
  200. package/dist/model/operations/merge-operation.d.ts +56 -0
  201. package/dist/model/operations/model-operation.d.ts +33 -0
  202. package/dist/model/operations/update-operation.d.ts +45 -0
  203. package/dist/model/operations/upsert-operation.d.ts +39 -0
  204. package/dist/model/options.d.ts +103 -0
  205. package/dist/model/returning-old.d.ts +52 -0
  206. package/dist/model/row-mapper.d.ts +78 -0
  207. package/dist/model/row-plan.d.ts +31 -0
  208. package/dist/model/runtime.d.ts +56 -0
  209. package/dist/model/scope-registry.d.ts +81 -0
  210. package/dist/model/select-aggregates.d.ts +37 -0
  211. package/dist/model/select-lock.d.ts +13 -0
  212. package/dist/model/select-options.d.ts +92 -0
  213. package/dist/model/select-query-builder.d.ts +73 -0
  214. package/dist/model/select-targets.d.ts +77 -0
  215. package/dist/model/source-option-builder.d.ts +23 -0
  216. package/dist/model/source-options.d.ts +108 -0
  217. package/dist/model/statement-builder.d.ts +77 -0
  218. package/dist/model/statement-services.d.ts +2 -0
  219. package/dist/model/sync-hooks.d.ts +18 -0
  220. package/dist/model/table-sample-builder.d.ts +13 -0
  221. package/dist/model/types.d.ts +85 -0
  222. package/dist/model/unnest-insert-builder.d.ts +24 -0
  223. package/dist/model/update-query-builder.d.ts +39 -0
  224. package/dist/model/v6-conflict-builder.d.ts +37 -0
  225. package/dist/model/value-cloner.d.ts +17 -0
  226. package/dist/model/values-writer.d.ts +12 -0
  227. package/dist/model/where-options.d.ts +164 -0
  228. package/dist/model/write-options.d.ts +160 -0
  229. package/dist/model/written-rows.d.ts +56 -0
  230. package/dist/package-version.d.ts +8 -0
  231. package/dist/query/query-result-shaper.d.ts +93 -0
  232. package/dist/query/raw-query.d.ts +27 -0
  233. package/dist/query-interface/alter-planner.d.ts +40 -0
  234. package/dist/query-interface/bulk-data.d.ts +44 -0
  235. package/dist/query-interface/column-commands.d.ts +52 -0
  236. package/dist/query-interface/column-describer.d.ts +17 -0
  237. package/dist/query-interface/enum-commands.d.ts +36 -0
  238. package/dist/query-interface/index-commands.d.ts +57 -0
  239. package/dist/query-interface/model-tables.d.ts +58 -0
  240. package/dist/query-interface/object-commands.d.ts +71 -0
  241. package/dist/query-interface/partition-commands.d.ts +43 -0
  242. package/dist/query-interface/policy-commands.d.ts +54 -0
  243. package/dist/query-interface/query-interface-catalog.d.ts +180 -0
  244. package/dist/query-interface/query-interface-objects.d.ts +108 -0
  245. package/dist/query-interface/query-interface-partitions.d.ts +66 -0
  246. package/dist/query-interface/query-interface-policies.d.ts +86 -0
  247. package/dist/query-interface/query-interface-routines.d.ts +120 -0
  248. package/dist/query-interface/query-interface-tables.d.ts +179 -0
  249. package/dist/query-interface/query-interface-types.d.ts +62 -0
  250. package/dist/query-interface/query-interface-views.d.ts +84 -0
  251. package/dist/query-interface/query-interface.d.ts +256 -0
  252. package/dist/query-interface/routine-commands.d.ts +71 -0
  253. package/dist/query-interface/schema-synchronizer.d.ts +110 -0
  254. package/dist/query-interface/statement-runner.d.ts +40 -0
  255. package/dist/query-interface/sync-planner.d.ts +26 -0
  256. package/dist/query-interface/table-commands.d.ts +63 -0
  257. package/dist/query-interface/table-introspector.d.ts +58 -0
  258. package/dist/query-interface/view-commands.d.ts +47 -0
  259. package/dist/sequelize/instance-hook-adders.d.ts +72 -0
  260. package/dist/sequelize/sequelize-base.d.ts +196 -0
  261. package/dist/sequelize/sequelize-constructor.d.ts +7 -0
  262. package/dist/sequelize/sequelize-helpers.d.ts +133 -0
  263. package/dist/sequelize/sequelize-hooks.d.ts +99 -0
  264. package/dist/sequelize/sequelize-internals.d.ts +87 -0
  265. package/dist/sequelize/sequelize-notifications.d.ts +66 -0
  266. package/dist/sequelize/sequelize-schema.d.ts +125 -0
  267. package/dist/sequelize/sequelize-transactions.d.ts +96 -0
  268. package/dist/sequelize.d.ts +1175 -0
  269. package/dist/sql/ast-clauses.d.ts +137 -0
  270. package/dist/sql/ast-expressions.d.ts +88 -0
  271. package/dist/sql/ast-statements.d.ts +80 -0
  272. package/dist/sql/ast.d.ts +21 -0
  273. package/dist/sql/compile.d.ts +21 -0
  274. package/dist/sql/dml-compiler.d.ts +54 -0
  275. package/dist/sql/expression-compiler.d.ts +56 -0
  276. package/dist/sql/from-compiler.d.ts +39 -0
  277. package/dist/sql/identifier-quoter.d.ts +15 -0
  278. package/dist/sql/merge-compiler.d.ts +20 -0
  279. package/dist/sql/order.d.ts +15 -0
  280. package/dist/sql/query-compiler.d.ts +45 -0
  281. package/dist/sql/sql-chunks.d.ts +50 -0
  282. package/dist/sql/with-compiler.d.ts +19 -0
  283. package/dist/transaction/advisory-locks.d.ts +28 -0
  284. package/dist/transaction/cls-namespace.d.ts +44 -0
  285. package/dist/transaction/transaction-constants.d.ts +35 -0
  286. package/dist/transaction/transaction-runner.d.ts +78 -0
  287. package/dist/transaction/transaction-starter.d.ts +25 -0
  288. package/dist/transaction/transaction-statements.d.ts +29 -0
  289. package/dist/transaction/transaction.d.ts +201 -0
  290. package/dist/validation/attribute-validators.d.ts +23 -0
  291. package/dist/validation/builtin-attribute-validator.d.ts +19 -0
  292. package/dist/validation/builtin-validators.d.ts +16 -0
  293. package/dist/validation/core-validator.d.ts +16 -0
  294. package/dist/validation/custom-validators.d.ts +13 -0
  295. package/dist/validation/instance-validator.d.ts +25 -0
  296. package/dist/validation/schema-items.d.ts +22 -0
  297. package/dist/validation/standard-schema-validator.d.ts +30 -0
  298. package/dist/validation/standard-schema.d.ts +39 -0
  299. package/dist/validation/types.d.ts +36 -0
  300. package/dist/validation/validation-target.d.ts +13 -0
  301. package/dist/where/comparison-compiler.d.ts +27 -0
  302. package/dist/where/condition-compiler.d.ts +18 -0
  303. package/dist/where/operand-resolver.d.ts +10 -0
  304. package/dist/where/operator-allowlist.d.ts +14 -0
  305. package/dist/where/where-support.d.ts +52 -0
  306. package/dist/where/where.d.ts +46 -0
  307. package/dist/where/window-compiler.d.ts +14 -0
  308. package/llm/USAGE.md +423 -0
  309. package/package.json +103 -4
  310. package/skills/postgrelize/SKILL.md +57 -0
  311. package/skills/postgrelize/reference/associations.md +108 -0
  312. package/skills/postgrelize/reference/errors.md +37 -0
  313. package/skills/postgrelize/reference/migrating-from-sequelize.md +15 -0
  314. package/skills/postgrelize/reference/postgresql-features.md +157 -0
  315. package/skills/postgrelize/reference/querying.md +111 -0
  316. package/skills/postgrelize/reference/schema.md +135 -0
  317. package/skills/postgrelize/reference/security.md +34 -0
  318. package/skills/postgrelize/reference/transactions-and-sessions.md +122 -0
  319. package/skills/postgrelize/reference/writing.md +198 -0
@@ -0,0 +1,103 @@
1
+ import { TableName } from './sql-literal.ts';
2
+ /** Whole number accepted in sequence options. */
3
+ export type SequenceNumber = number | bigint;
4
+ /** Column that owns a sequence (the sequence is dropped with the column). */
5
+ export type SequenceOwner = Readonly<{
6
+ /** Owning table. */
7
+ table: TableName;
8
+ /** Owning column. */
9
+ column: string;
10
+ }>;
11
+ /**
12
+ * Options of `createSequence`.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const options: CreateSequenceOptions = { dataType: 'bigint', start: 1000, cache: 10 };
17
+ * await queryInterface.createSequence('invoice_number', options);
18
+ * ```
19
+ */
20
+ export type CreateSequenceOptions = Readonly<{
21
+ /** `AS smallint | integer | bigint`. */
22
+ dataType?: 'smallint' | 'integer' | 'bigint';
23
+ /** `START WITH`. */
24
+ start?: SequenceNumber;
25
+ /** `INCREMENT BY`. */
26
+ increment?: SequenceNumber;
27
+ /** `MINVALUE`; `false` renders `NO MINVALUE`. */
28
+ minValue?: SequenceNumber | false;
29
+ /** `MAXVALUE`; `false` renders `NO MAXVALUE`. */
30
+ maxValue?: SequenceNumber | false;
31
+ /** `CACHE`. */
32
+ cache?: SequenceNumber;
33
+ /** `CYCLE` / `NO CYCLE`. */
34
+ cycle?: boolean;
35
+ /** `OWNED BY table.column`; `null` renders `OWNED BY NONE`. */
36
+ ownedBy?: SequenceOwner | null;
37
+ /** Adds `IF NOT EXISTS`. */
38
+ ifNotExists?: boolean;
39
+ }>;
40
+ /**
41
+ * Options of `alterSequence`.
42
+ *
43
+ * @example
44
+ * ```ts
45
+ * const options: AlterSequenceOptions = { restartWith: 1, cycle: true };
46
+ * await queryInterface.alterSequence('invoice_number', options);
47
+ * ```
48
+ */
49
+ export type AlterSequenceOptions = Omit<CreateSequenceOptions, 'dataType' | 'start' | 'ifNotExists'> & Readonly<{
50
+ /** `RESTART WITH n`; `true` renders a bare `RESTART` (back to the start value). */
51
+ restartWith?: SequenceNumber | true;
52
+ /** Adds `IF EXISTS`. */
53
+ ifExists?: boolean;
54
+ }>;
55
+ /**
56
+ * Options of `dropSequence`.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const options: DropSequenceOptions = { ifExists: true };
61
+ * await queryInterface.dropSequence('invoice_number', options);
62
+ * ```
63
+ */
64
+ export type DropSequenceOptions = Readonly<{
65
+ /** Adds `IF EXISTS`. */
66
+ ifExists?: boolean;
67
+ /** Also drops objects that depend on the sequence. */
68
+ cascade?: boolean;
69
+ }>;
70
+ /**
71
+ * `CREATE`, `ALTER` and `DROP SEQUENCE` statements. Numbers must be whole; names are quoted.
72
+ *
73
+ * @internal
74
+ */
75
+ export declare class SequenceDdl {
76
+ #private;
77
+ /**
78
+ * `CREATE SEQUENCE` statement.
79
+ *
80
+ * @param name - Sequence name.
81
+ * @param options - Sequence options.
82
+ * @returns Statement.
83
+ * @throws Error for an unknown data type or a non-integer number.
84
+ */
85
+ createSql(name: TableName, options: CreateSequenceOptions): string;
86
+ /**
87
+ * `ALTER SEQUENCE` statement.
88
+ *
89
+ * @param name - Sequence name.
90
+ * @param options - Properties to change.
91
+ * @returns Statement.
92
+ * @throws Error without any property or with a non-integer number.
93
+ */
94
+ alterSql(name: TableName, options: AlterSequenceOptions): string;
95
+ /**
96
+ * `DROP SEQUENCE` statement.
97
+ *
98
+ * @param name - Sequence name.
99
+ * @param options - Statement options.
100
+ * @returns Statement.
101
+ */
102
+ dropSql(name: TableName, options: DropSequenceOptions): string;
103
+ }
@@ -0,0 +1,61 @@
1
+ import { CompiledQuery } from '../sql/compile.ts';
2
+ import { ExprNode } from '../sql/ast.ts';
3
+ /** Table reference accepted by QueryInterface: a name or `{ tableName, schema }`. */
4
+ export type TableName = string | QualifiedTable;
5
+ /** Schema-qualified table reference. */
6
+ export type QualifiedTable = Readonly<{
7
+ /** Table name. */
8
+ tableName: string;
9
+ /** Schema name. */
10
+ schema?: string;
11
+ }>;
12
+ /**
13
+ * Renders values as PostgreSQL literals and table references as quoted names, for DDL where bind
14
+ * parameters are not allowed (ADR-010).
15
+ *
16
+ * @internal
17
+ */
18
+ export declare class SqlLiteral {
19
+ #private;
20
+ /**
21
+ * Renders a value as a PostgreSQL literal. Strings with backslashes use the `E'...'` form.
22
+ *
23
+ * @param value - Value to render.
24
+ * @returns SQL literal.
25
+ * @throws Error for non-finite numbers and strings with NUL characters.
26
+ */
27
+ escape(value: unknown): string;
28
+ /**
29
+ * Replaces `$n` placeholders of a compiled query with escaped literals.
30
+ *
31
+ * @param query - Compiled query.
32
+ * @returns SQL text without placeholders.
33
+ */
34
+ inlineValues(query: CompiledQuery): string;
35
+ /**
36
+ * Compiles an expression node and inlines its values (for DDL).
37
+ *
38
+ * @param node - Expression node.
39
+ * @returns SQL text without placeholders.
40
+ */
41
+ inlineExpr(node: ExprNode): string;
42
+ /**
43
+ * Splits a table reference into name and schema.
44
+ *
45
+ * @param table - Table name or `{ tableName, schema }`.
46
+ * @param defaultSchema - Schema used when the reference has none.
47
+ * @returns Table name and schema.
48
+ */
49
+ tableParts(table: TableName, defaultSchema?: string): Readonly<{
50
+ name: string;
51
+ schema: string | undefined;
52
+ }>;
53
+ /**
54
+ * Quoted, schema-qualified table name.
55
+ *
56
+ * @param table - Table name or `{ tableName, schema }`.
57
+ * @param defaultSchema - Schema used when the reference has none.
58
+ * @returns Quoted table name.
59
+ */
60
+ quoteTable(table: TableName, defaultSchema?: string): string;
61
+ }
@@ -0,0 +1,35 @@
1
+ import { ColumnDdl } from './column-ddl.ts';
2
+ import { ColumnDefinition, CreateTableOptions } from './ddl-types.ts';
3
+ import { EnumDdl } from './enum-ddl.ts';
4
+ import { TableName } from './sql-literal.ts';
5
+ /**
6
+ * `CREATE TABLE` (with enum types, keys and comments) and `ALTER COLUMN` statements.
7
+ *
8
+ * @internal
9
+ */
10
+ export declare class TableDdl {
11
+ #private;
12
+ /**
13
+ * @param columns - Column parts.
14
+ * @param enums - Enum types.
15
+ */
16
+ constructor(columns: ColumnDdl, enums: EnumDdl);
17
+ /**
18
+ * Statements creating a table: enum types, `CREATE TABLE IF NOT EXISTS`, comments.
19
+ *
20
+ * @param table - Table name or `{ tableName, schema }`.
21
+ * @param columns - Column definitions.
22
+ * @param options - Table comment, default schema and `ifNotExists` (default true).
23
+ * @returns Statements in execution order.
24
+ */
25
+ createTableSql(table: TableName, columns: readonly ColumnDefinition[], options?: CreateTableOptions): readonly string[];
26
+ /**
27
+ * `ALTER TABLE ... ALTER COLUMN` statements bringing a column to its definition (v6 changeColumn).
28
+ *
29
+ * @param table - Table name or `{ tableName, schema }`.
30
+ * @param column - Column definition.
31
+ * @param defaultSchema - Schema used when the table reference has none.
32
+ * @returns Statements in execution order.
33
+ */
34
+ changeColumnSql(table: TableName, column: ColumnDefinition, defaultSchema?: string): readonly string[];
35
+ }
@@ -0,0 +1,81 @@
1
+ import { FunctionName } from './function-ddl.ts';
2
+ import { TableName } from './sql-literal.ts';
3
+ /** When a trigger fires relative to the event (Sequelize v6 values). */
4
+ export type TriggerTiming = 'before' | 'after' | 'instead_of' | 'after_constraint';
5
+ /** Table event that fires a trigger. */
6
+ export type TriggerEvent = 'insert' | 'update' | 'delete' | 'truncate';
7
+ /** Argument passed to the trigger function, rendered as a literal. */
8
+ export type TriggerArgument = string | number | boolean | bigint;
9
+ /**
10
+ * Options of `createTrigger`.
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const options: CreateTriggerOptions = { replace: true };
15
+ * await queryInterface.createTrigger('Posts', 'posts_touch', 'before', ['update'], 'touch', [], [], options);
16
+ * ```
17
+ */
18
+ export type CreateTriggerOptions = Readonly<{
19
+ /** `CREATE OR REPLACE TRIGGER` (PostgreSQL 14+). */
20
+ replace?: boolean;
21
+ }>;
22
+ /**
23
+ * Options of `dropTrigger`.
24
+ *
25
+ * @example
26
+ * ```ts
27
+ * const options: DropTriggerOptions = { ifExists: true };
28
+ * await queryInterface.dropTrigger('Posts', 'posts_touch', options);
29
+ * ```
30
+ */
31
+ export type DropTriggerOptions = Readonly<{
32
+ /** Adds `IF EXISTS`. */
33
+ ifExists?: boolean;
34
+ /** `CASCADE` instead of the default `RESTRICT`. */
35
+ cascade?: boolean;
36
+ }>;
37
+ /** Definition of a trigger (the arguments of `createTrigger` before the options). @internal */
38
+ export type TriggerSpec = Readonly<{
39
+ table: TableName;
40
+ name: string;
41
+ timing: TriggerTiming;
42
+ events: readonly TriggerEvent[];
43
+ functionName: FunctionName;
44
+ functionArgs: readonly TriggerArgument[];
45
+ optionsArray: readonly string[];
46
+ }>;
47
+ /**
48
+ * `CREATE`, `DROP` and `ALTER ... RENAME` statements for triggers (Sequelize v6 shapes).
49
+ *
50
+ * @internal
51
+ */
52
+ export declare class TriggerDdl {
53
+ #private;
54
+ /**
55
+ * `CREATE [CONSTRAINT] TRIGGER` statement.
56
+ *
57
+ * @param spec - Trigger definition.
58
+ * @param options - Statement options.
59
+ * @returns Statement.
60
+ * @throws Error for an unknown timing, event or clause.
61
+ */
62
+ createSql(spec: TriggerSpec, options: CreateTriggerOptions): string;
63
+ /**
64
+ * `DROP TRIGGER` statement (`RESTRICT` unless `cascade`).
65
+ *
66
+ * @param table - Table name or `{ tableName, schema }`.
67
+ * @param name - Trigger name.
68
+ * @param options - Statement options.
69
+ * @returns Statement.
70
+ */
71
+ dropSql(table: TableName, name: string, options: DropTriggerOptions): string;
72
+ /**
73
+ * `ALTER TRIGGER ... RENAME TO` statement.
74
+ *
75
+ * @param table - Table name or `{ tableName, schema }`.
76
+ * @param name - Current trigger name.
77
+ * @param newName - New trigger name.
78
+ * @returns Statement.
79
+ */
80
+ renameSql(table: TableName, name: string, newName: string): string;
81
+ }
@@ -0,0 +1,122 @@
1
+ import { TableName } from './sql-literal.ts';
2
+ /**
3
+ * Options of `createView`.
4
+ *
5
+ * @example
6
+ * ```ts
7
+ * const options: CreateViewOptions = { replace: true, columns: ['id', 'title'], checkOption: 'local' };
8
+ * await queryInterface.createView('published_posts', 'SELECT id, title FROM "Posts" WHERE published', options);
9
+ * ```
10
+ */
11
+ export type CreateViewOptions = Readonly<{
12
+ /** `CREATE OR REPLACE VIEW`. */
13
+ replace?: boolean;
14
+ /** `CREATE TEMPORARY VIEW`: lives as long as the database session (pooled connection). */
15
+ temporary?: boolean;
16
+ /** `CREATE RECURSIVE VIEW`; needs `columns`. */
17
+ recursive?: boolean;
18
+ /** Output column names. */
19
+ columns?: readonly string[];
20
+ /** `WITH LOCAL | CASCADED CHECK OPTION` for updatable views. */
21
+ checkOption?: 'local' | 'cascaded';
22
+ /** `security_barrier` view option. */
23
+ securityBarrier?: boolean;
24
+ /** `security_invoker` view option (queries run with the privileges of the caller). */
25
+ securityInvoker?: boolean;
26
+ }>;
27
+ /**
28
+ * Options of `createMaterializedView`.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const options: CreateMaterializedViewOptions = { ifNotExists: true, withData: false };
33
+ * await queryInterface.createMaterializedView('post_stats', 'SELECT count(*) AS n FROM "Posts"', options);
34
+ * ```
35
+ */
36
+ export type CreateMaterializedViewOptions = Readonly<{
37
+ /** Adds `IF NOT EXISTS`. */
38
+ ifNotExists?: boolean;
39
+ /** Output column names. */
40
+ columns?: readonly string[];
41
+ /** Table access method (`USING heap`). */
42
+ using?: string;
43
+ /** `false` renders `WITH NO DATA`: the view is created empty and unreadable until refreshed. */
44
+ withData?: boolean;
45
+ }>;
46
+ /**
47
+ * Options of `refreshMaterializedView`.
48
+ *
49
+ * @example
50
+ * ```ts
51
+ * const options: RefreshMaterializedViewOptions = { concurrently: true };
52
+ * await queryInterface.refreshMaterializedView('post_stats', options);
53
+ * ```
54
+ */
55
+ export type RefreshMaterializedViewOptions = Readonly<{
56
+ /** `REFRESH ... CONCURRENTLY`: readers are not blocked; needs a unique index and cannot be combined with `withData: false`. */
57
+ concurrently?: boolean;
58
+ /** `false` renders `WITH NO DATA` (empties the view). */
59
+ withData?: boolean;
60
+ }>;
61
+ /**
62
+ * Options of `dropView` and `dropMaterializedView`.
63
+ *
64
+ * @example
65
+ * ```ts
66
+ * const options: DropViewOptions = { ifExists: true, cascade: true };
67
+ * await queryInterface.dropView('published_posts', options);
68
+ * ```
69
+ */
70
+ export type DropViewOptions = Readonly<{
71
+ /** Adds `IF EXISTS`. */
72
+ ifExists?: boolean;
73
+ /** Also drops objects that depend on the view. */
74
+ cascade?: boolean;
75
+ }>;
76
+ /**
77
+ * `CREATE`, `REFRESH` and `DROP` statements for views and materialized views. The query text is
78
+ * trusted SQL (ADR-025); names and column lists are quoted.
79
+ *
80
+ * @internal
81
+ */
82
+ export declare class ViewDdl {
83
+ #private;
84
+ /**
85
+ * `CREATE [OR REPLACE] [TEMPORARY] [RECURSIVE] VIEW` statement.
86
+ *
87
+ * @param name - View name.
88
+ * @param query - Trusted `SELECT` text.
89
+ * @param options - View options.
90
+ * @returns Statement.
91
+ * @throws Error for an empty query, a recursive view without columns or an unknown check option.
92
+ */
93
+ createSql(name: TableName, query: string, options: CreateViewOptions): string;
94
+ /**
95
+ * `CREATE MATERIALIZED VIEW` statement.
96
+ *
97
+ * @param name - View name.
98
+ * @param query - Trusted `SELECT` text.
99
+ * @param options - View options.
100
+ * @returns Statement.
101
+ * @throws Error for an empty query or an invalid access method.
102
+ */
103
+ createMaterializedSql(name: TableName, query: string, options: CreateMaterializedViewOptions): string;
104
+ /**
105
+ * `REFRESH MATERIALIZED VIEW` statement.
106
+ *
107
+ * @param name - View name.
108
+ * @param options - Refresh options.
109
+ * @returns Statement.
110
+ * @throws Error when `concurrently` is combined with `withData: false`.
111
+ */
112
+ refreshSql(name: TableName, options: RefreshMaterializedViewOptions): string;
113
+ /**
114
+ * `DROP VIEW` or `DROP MATERIALIZED VIEW` statement.
115
+ *
116
+ * @param name - View name.
117
+ * @param materialized - Drops a materialized view.
118
+ * @param options - Drop options.
119
+ * @returns Statement.
120
+ */
121
+ dropSql(name: TableName, materialized: boolean, options: DropViewOptions): string;
122
+ }
@@ -0,0 +1,18 @@
1
+ import { AnyModel, ModelStatic } from '../model/options.ts';
2
+ import { AssociationSpec } from './model-metadata.ts';
3
+ type Model = ModelStatic<AnyModel>;
4
+ /**
5
+ * Applies the associations collected by decorators with the same `hasOne` / `hasMany` /
6
+ * `belongsTo` / `belongsToMany` calls an application would write by hand.
7
+ *
8
+ * @internal
9
+ */
10
+ export declare class AssociationApplier {
11
+ #private;
12
+ /**
13
+ * @param model - Model that owns the property the association was declared on.
14
+ * @param spec - Collected association.
15
+ */
16
+ apply(model: Model, spec: AssociationSpec): void;
17
+ }
18
+ export {};
@@ -0,0 +1,72 @@
1
+ import { AssociationOptions, BelongsToManyOptions } from '../associations/types.ts';
2
+ import { ModelPropertyDecorator } from './decorator-types.ts';
3
+ import { AssociationSpec, ModelGetter } from './model-metadata.ts';
4
+ /**
5
+ * Adds a `hasOne` association; the foreign key is on the target. The property name is the alias (`as`).
6
+ * The foreign key is the attribute of the target marked with `@ForeignKey` for this model, unless
7
+ * `options.foreignKey` is given.
8
+ *
9
+ * @param target - Function returning the associated model.
10
+ * @param options - Association options (`foreignKey`, `onDelete`, …).
11
+ * @returns An attribute decorator.
12
+ * @example
13
+ * ```ts
14
+ * class User extends Model {
15
+ * @HasOne(() => Profile)
16
+ * profile!: Profile;
17
+ * }
18
+ * ```
19
+ */
20
+ export declare const HasOne: (target: ModelGetter, options?: AssociationOptions) => ModelPropertyDecorator;
21
+ /**
22
+ * Adds a `hasMany` association; the foreign key is on the target. The property name is the alias (`as`).
23
+ *
24
+ * @param target - Function returning the associated model.
25
+ * @param options - Association options (`foreignKey`, `onDelete`, …).
26
+ * @returns An attribute decorator.
27
+ * @example
28
+ * ```ts
29
+ * class User extends Model {
30
+ * @HasMany(() => Post)
31
+ * posts!: Post[];
32
+ * }
33
+ * ```
34
+ */
35
+ export declare const HasMany: (target: ModelGetter, options?: AssociationOptions) => ModelPropertyDecorator;
36
+ /**
37
+ * Adds a `belongsTo` association; the foreign key is on this model, marked with `@ForeignKey`
38
+ * for the target unless `options.foreignKey` is given. The property name is the alias (`as`).
39
+ *
40
+ * @param target - Function returning the associated model.
41
+ * @param options - Association options (`foreignKey`, `targetKey`, `onDelete`, …).
42
+ * @returns An attribute decorator.
43
+ * @example
44
+ * ```ts
45
+ * class Post extends Model {
46
+ * @ForeignKey(() => User)
47
+ * @Column(DataTypes.INTEGER)
48
+ * userId!: number;
49
+ *
50
+ * @BelongsTo(() => User)
51
+ * user!: User;
52
+ * }
53
+ * ```
54
+ */
55
+ export declare const BelongsTo: (target: ModelGetter, options?: AssociationOptions) => ModelPropertyDecorator;
56
+ /**
57
+ * Adds a `belongsToMany` association through a junction model. The junction model's `@ForeignKey`
58
+ * attributes give `foreignKey` (to this model) and `otherKey` (to the target) unless `options` sets them.
59
+ *
60
+ * @param target - Function returning the associated model.
61
+ * @param through - Junction table name, function returning the junction model, or `{ model, scope }`.
62
+ * @param options - Association options (`foreignKey`, `otherKey`, …).
63
+ * @returns An attribute decorator.
64
+ * @example
65
+ * ```ts
66
+ * class Post extends Model {
67
+ * @BelongsToMany(() => Tag, 'post_tags')
68
+ * tags!: Tag[];
69
+ * }
70
+ * ```
71
+ */
72
+ export declare const BelongsToMany: (target: ModelGetter, through: NonNullable<AssociationSpec["through"]>, options?: Omit<BelongsToManyOptions, "through">) => ModelPropertyDecorator;
@@ -0,0 +1,147 @@
1
+ import { AttributeOptions } from '../model/attribute-options.ts';
2
+ import { DataTypeInput } from '../data-types/data-types.ts';
3
+ import { ModelPropertyDecorator } from './decorator-types.ts';
4
+ /** Argument of `@Column`: a data type or column options. */
5
+ export type ColumnInput = DataTypeInput | AttributeOptions;
6
+ /**
7
+ * Declares a class field as a model attribute (a column).
8
+ *
9
+ * The type is not inferred from the TypeScript type (there is no `reflect-metadata`): pass a
10
+ * `DataTypes` value or an options object with `type`. Combine with the shortcut decorators.
11
+ *
12
+ * @param input - A data type (`DataTypes.STRING(64)`) or column options (`{ type, allowNull, … }`).
13
+ * @returns An attribute decorator.
14
+ * Accepts the TC39 and the legacy `experimentalDecorators` call signature.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * class User extends Model {
19
+ * @Column({ type: DataTypes.STRING, allowNull: false })
20
+ * name!: string;
21
+ * }
22
+ * ```
23
+ */
24
+ export declare const Column: (input: ColumnInput) => ModelPropertyDecorator;
25
+ /**
26
+ * Makes the attribute part of the primary key (`primaryKey: true`).
27
+ *
28
+ * @example
29
+ * ```ts
30
+ * class User extends Model {
31
+ * @PrimaryKey
32
+ * @Column(DataTypes.INTEGER)
33
+ * id!: number;
34
+ * }
35
+ * ```
36
+ */
37
+ export declare const PrimaryKey: ModelPropertyDecorator;
38
+ /**
39
+ * Generates the attribute from a sequence (`autoIncrement: true`).
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * class User extends Model {
44
+ * @PrimaryKey
45
+ * @AutoIncrement
46
+ * @Column(DataTypes.INTEGER)
47
+ * id!: number;
48
+ * }
49
+ * ```
50
+ */
51
+ export declare const AutoIncrement: ModelPropertyDecorator;
52
+ /**
53
+ * Sets `allowNull`. Usable bare (`@AllowNull`, meaning `true`) or called.
54
+ *
55
+ * @param allowNull - Whether `NULL` is allowed.
56
+ * @defaultValue true
57
+ * @returns An attribute decorator.
58
+ * @example
59
+ * ```ts
60
+ * class User extends Model {
61
+ * @AllowNull(false)
62
+ * @Column(DataTypes.TEXT)
63
+ * name!: string;
64
+ * }
65
+ * ```
66
+ */
67
+ export declare const AllowNull: ModelPropertyDecorator & ((argument?: boolean | undefined) => ModelPropertyDecorator);
68
+ /**
69
+ * Sets the default value of the attribute (`defaultValue`).
70
+ *
71
+ * @param value - A value, an expression, or `DataTypes.NOW` / `DataTypes.UUIDV4`.
72
+ * @returns An attribute decorator.
73
+ * @example
74
+ * ```ts
75
+ * class User extends Model {
76
+ * @Default(false)
77
+ * @Column(DataTypes.BOOLEAN)
78
+ * active!: boolean;
79
+ * }
80
+ * ```
81
+ */
82
+ export declare const Default: (value: unknown) => ModelPropertyDecorator;
83
+ /**
84
+ * Adds a unique constraint (`unique`). Usable bare or with a constraint name or options.
85
+ *
86
+ * @param unique - Constraint name or `{ name, msg, nullsNotDistinct }`. Attributes sharing a name form a composite key.
87
+ * @returns An attribute decorator.
88
+ * @example
89
+ * ```ts
90
+ * class User extends Model {
91
+ * @Unique
92
+ * @Column(DataTypes.STRING)
93
+ * email!: string;
94
+ * }
95
+ * ```
96
+ */
97
+ export declare const Unique: ModelPropertyDecorator & ((argument?: string | Readonly<{
98
+ name?: string;
99
+ msg?: string;
100
+ nullsNotDistinct?: boolean;
101
+ }> | undefined) => ModelPropertyDecorator);
102
+ /**
103
+ * Sets the column comment (`comment`).
104
+ *
105
+ * @param text - Comment text.
106
+ * @returns An attribute decorator.
107
+ * @example
108
+ * ```ts
109
+ * class User extends Model {
110
+ * @Comment('Login name')
111
+ * @Column(DataTypes.STRING)
112
+ * login!: string;
113
+ * }
114
+ * ```
115
+ */
116
+ export declare const Comment: (text: string) => ModelPropertyDecorator;
117
+ /**
118
+ * Adds the attribute to an index of the table (`indexes`). Usable bare, with an index name or
119
+ * with index options; attributes sharing a name form one composite index.
120
+ *
121
+ * Hidden from the generated API reference on purpose: VitePress treats a page named `Index.md` as a
122
+ * directory index (case-insensitive), so it is documented in the Decorators guide instead.
123
+ *
124
+ * @param index - Index name or index options (without `fields`).
125
+ * @returns An attribute decorator.
126
+ * @hidden
127
+ * @example
128
+ * ```ts
129
+ * class User extends Model {
130
+ * @Index({ name: 'users_name_idx', using: 'btree' })
131
+ * @Column(DataTypes.STRING)
132
+ * name!: string;
133
+ * }
134
+ * ```
135
+ */
136
+ export declare const Index: ModelPropertyDecorator & ((argument?: string | Omit<Readonly<{
137
+ fields?: readonly import('../exports-schema.ts').IndexField[];
138
+ name?: string;
139
+ unique?: boolean;
140
+ nullsNotDistinct?: boolean;
141
+ using?: string;
142
+ operator?: string;
143
+ where?: unknown;
144
+ concurrently?: boolean;
145
+ include?: readonly string[];
146
+ ifNotExists?: boolean;
147
+ }>, "fields"> | undefined) => ModelPropertyDecorator);
@@ -0,0 +1,45 @@
1
+ import { HookType } from '../hooks/hooks.ts';
2
+ import { AttributeOptions } from '../model/attribute-options.ts';
3
+ import { ModelClassDecorator, ModelPropertyDecorator, ModelStaticMethodDecorator } from './decorator-types.ts';
4
+ import { ModelMetadata } from './model-metadata.ts';
5
+ /**
6
+ * Builds decorators that work with both calling conventions from a function that records
7
+ * something in the metadata of the decorated class.
8
+ *
9
+ * @internal
10
+ */
11
+ export declare class DecoratorFactory {
12
+ #private;
13
+ /**
14
+ * @param record - Records into the metadata of the class.
15
+ * @returns A class decorator.
16
+ */
17
+ forClass(record: (meta: ModelMetadata) => void): ModelClassDecorator;
18
+ /**
19
+ * @param record - Records into the metadata of the class, given the attribute name.
20
+ * @returns An attribute decorator.
21
+ */
22
+ forProperty(record: (meta: ModelMetadata, key: string) => void): ModelPropertyDecorator;
23
+ /**
24
+ * @param partial - Column options to merge into the attribute.
25
+ * @returns An attribute decorator.
26
+ */
27
+ column(partial: Partial<AttributeOptions>): ModelPropertyDecorator;
28
+ /**
29
+ * @param build - Creates the decorator from the optional argument of the factory call.
30
+ * @returns A decorator usable bare (`@Unique`) and called (`@Unique('name')`).
31
+ */
32
+ optionalProperty<A, D extends ModelPropertyDecorator>(build: (argument?: A) => D): D & ((argument?: A) => D);
33
+ /**
34
+ * @param build - Creates the decorator from the optional argument of the factory call.
35
+ * @returns A class decorator usable bare (`@Table`) and called (`@Table({ ... })`).
36
+ */
37
+ optionalClass<A>(build: (argument?: A) => ModelClassDecorator): ModelClassDecorator & ((argument?: A) => ModelClassDecorator);
38
+ /**
39
+ * @param type - Hook type to register the decorated static method for.
40
+ * @returns A static method decorator.
41
+ */
42
+ forHook(type: HookType): ModelStaticMethodDecorator;
43
+ }
44
+ /** @internal Shared decorator factory. */
45
+ export declare const decorate: DecoratorFactory;