@encore.dev/sdk 2.0.0-beta.15 → 2.0.0-beta.16

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 (235) hide show
  1. package/README.md +111 -101
  2. package/app_meta.ts +56 -54
  3. package/config/config.ts +60 -57
  4. package/config/secrets.ts +45 -52
  5. package/config/value.ts +23 -26
  6. package/cron/mod.ts +28 -29
  7. package/dist/app_meta.d.ts +52 -50
  8. package/dist/app_meta.d.ts.map +1 -1
  9. package/dist/app_meta.js +2 -2
  10. package/dist/app_meta.js.map +1 -1
  11. package/dist/config/config.d.ts +58 -55
  12. package/dist/config/config.d.ts.map +1 -1
  13. package/dist/config/config.js +8 -9
  14. package/dist/config/config.js.map +1 -1
  15. package/dist/config/secrets.d.ts +45 -52
  16. package/dist/config/secrets.d.ts.map +1 -1
  17. package/dist/config/secrets.js +8 -9
  18. package/dist/config/secrets.js.map +1 -1
  19. package/dist/config/value.d.ts +20 -23
  20. package/dist/config/value.d.ts.map +1 -1
  21. package/dist/config/value.js +20 -23
  22. package/dist/config/value.js.map +1 -1
  23. package/dist/cron/mod.d.ts +26 -27
  24. package/dist/cron/mod.d.ts.map +1 -1
  25. package/dist/cron/mod.js +13 -14
  26. package/dist/cron/mod.js.map +1 -1
  27. package/dist/frontends/mod.d.ts +20 -19
  28. package/dist/frontends/mod.d.ts.map +1 -1
  29. package/dist/frontends/mod.js +20 -19
  30. package/dist/frontends/mod.js.map +1 -1
  31. package/dist/gateway/errors.d.ts +28 -30
  32. package/dist/gateway/errors.d.ts.map +1 -1
  33. package/dist/gateway/errors.js +29 -31
  34. package/dist/gateway/errors.js.map +1 -1
  35. package/dist/gateway/match.d.ts +54 -54
  36. package/dist/gateway/match.d.ts.map +1 -1
  37. package/dist/gateway/match.js +56 -56
  38. package/dist/gateway/match.js.map +1 -1
  39. package/dist/gateway/middleware.d.ts +62 -64
  40. package/dist/gateway/middleware.d.ts.map +1 -1
  41. package/dist/gateway/middleware.js +1 -1
  42. package/dist/gateway/middleware.js.map +1 -1
  43. package/dist/gateway/mod.d.ts +64 -67
  44. package/dist/gateway/mod.d.ts.map +1 -1
  45. package/dist/gateway/mod.js +72 -76
  46. package/dist/gateway/mod.js.map +1 -1
  47. package/dist/gateway/request.d.ts +138 -134
  48. package/dist/gateway/request.d.ts.map +1 -1
  49. package/dist/gateway/request.js +117 -108
  50. package/dist/gateway/request.js.map +1 -1
  51. package/dist/gateway/serve.d.ts +29 -34
  52. package/dist/gateway/serve.d.ts.map +1 -1
  53. package/dist/gateway/serve.js +51 -56
  54. package/dist/gateway/serve.js.map +1 -1
  55. package/dist/gateways/mod.d.ts +23 -21
  56. package/dist/gateways/mod.d.ts.map +1 -1
  57. package/dist/gateways/mod.js +25 -23
  58. package/dist/gateways/mod.js.map +1 -1
  59. package/dist/internal/runtime/napi/napi.cjs +1 -1
  60. package/dist/internal/runtime/napi/napi.d.cts +10 -3
  61. package/dist/internal/runtime/shutdown.d.ts +75 -57
  62. package/dist/internal/runtime/shutdown.d.ts.map +1 -1
  63. package/dist/internal/runtime/shutdown.js +88 -84
  64. package/dist/internal/runtime/shutdown.js.map +1 -1
  65. package/dist/log/logger.d.ts +43 -37
  66. package/dist/log/logger.d.ts.map +1 -1
  67. package/dist/log/logger.js +26 -25
  68. package/dist/log/logger.js.map +1 -1
  69. package/dist/metrics/mod.d.ts +133 -114
  70. package/dist/metrics/mod.d.ts.map +1 -1
  71. package/dist/metrics/mod.js +109 -101
  72. package/dist/metrics/mod.js.map +1 -1
  73. package/dist/otel.d.ts +6 -3
  74. package/dist/otel.d.ts.map +1 -1
  75. package/dist/otel.js +6 -3
  76. package/dist/otel.js.map +1 -1
  77. package/dist/pubsub/subscription.d.ts +88 -116
  78. package/dist/pubsub/subscription.d.ts.map +1 -1
  79. package/dist/pubsub/subscription.js +14 -17
  80. package/dist/pubsub/subscription.js.map +1 -1
  81. package/dist/pubsub/topic.d.ts +86 -113
  82. package/dist/pubsub/topic.d.ts.map +1 -1
  83. package/dist/pubsub/topic.js +68 -82
  84. package/dist/pubsub/topic.js.map +1 -1
  85. package/dist/reqctx/mod.d.ts +83 -86
  86. package/dist/reqctx/mod.d.ts.map +1 -1
  87. package/dist/reqctx/mod.js +39 -41
  88. package/dist/reqctx/mod.js.map +1 -1
  89. package/dist/services/index.d.ts +76 -75
  90. package/dist/services/index.d.ts.map +1 -1
  91. package/dist/services/index.js +73 -71
  92. package/dist/services/index.js.map +1 -1
  93. package/dist/shutdown/mod.d.ts +26 -25
  94. package/dist/shutdown/mod.d.ts.map +1 -1
  95. package/dist/shutdown/mod.js +26 -25
  96. package/dist/shutdown/mod.js.map +1 -1
  97. package/dist/storage/clickhouse/database.d.ts +113 -115
  98. package/dist/storage/clickhouse/database.d.ts.map +1 -1
  99. package/dist/storage/clickhouse/database.js +65 -79
  100. package/dist/storage/clickhouse/database.js.map +1 -1
  101. package/dist/storage/clickhouse/errors.d.ts +25 -26
  102. package/dist/storage/clickhouse/errors.d.ts.map +1 -1
  103. package/dist/storage/clickhouse/errors.js +15 -17
  104. package/dist/storage/clickhouse/errors.js.map +1 -1
  105. package/dist/storage/clickhouse/mod.d.ts +10 -10
  106. package/dist/storage/clickhouse/mod.js +10 -10
  107. package/dist/storage/objects/bucket.d.ts +196 -225
  108. package/dist/storage/objects/bucket.d.ts.map +1 -1
  109. package/dist/storage/objects/bucket.js +71 -84
  110. package/dist/storage/objects/bucket.js.map +1 -1
  111. package/dist/storage/objects/error.d.ts +4 -4
  112. package/dist/storage/objects/error.js +4 -4
  113. package/dist/storage/postgres/database.d.ts +124 -149
  114. package/dist/storage/postgres/database.d.ts.map +1 -1
  115. package/dist/storage/postgres/database.js +98 -135
  116. package/dist/storage/postgres/database.js.map +1 -1
  117. package/dist/storage/postgres/errors.d.ts +42 -48
  118. package/dist/storage/postgres/errors.d.ts.map +1 -1
  119. package/dist/storage/postgres/errors.js +44 -51
  120. package/dist/storage/postgres/errors.js.map +1 -1
  121. package/dist/storage/postgres/interval.d.ts +19 -19
  122. package/dist/storage/postgres/interval.d.ts.map +1 -1
  123. package/dist/storage/postgres/interval.js +21 -21
  124. package/dist/storage/postgres/interval.js.map +1 -1
  125. package/dist/storage/redis/bitfield.d.ts +48 -23
  126. package/dist/storage/redis/bitfield.d.ts.map +1 -1
  127. package/dist/storage/redis/bitfield.js +38 -19
  128. package/dist/storage/redis/bitfield.js.map +1 -1
  129. package/dist/storage/redis/command.d.ts +16 -12
  130. package/dist/storage/redis/command.d.ts.map +1 -1
  131. package/dist/storage/redis/command.js +16 -12
  132. package/dist/storage/redis/command.js.map +1 -1
  133. package/dist/storage/redis/commands.d.ts +99 -100
  134. package/dist/storage/redis/commands.d.ts.map +1 -1
  135. package/dist/storage/redis/commands.js +84 -85
  136. package/dist/storage/redis/commands.js.map +1 -1
  137. package/dist/storage/redis/database.d.ts +138 -122
  138. package/dist/storage/redis/database.d.ts.map +1 -1
  139. package/dist/storage/redis/database.js +120 -101
  140. package/dist/storage/redis/database.js.map +1 -1
  141. package/dist/storage/redis/mod.d.ts +52 -48
  142. package/dist/storage/redis/mod.d.ts.map +1 -1
  143. package/dist/storage/redis/mod.js +52 -48
  144. package/dist/storage/redis/mod.js.map +1 -1
  145. package/dist/storage/redis/options.d.ts +26 -24
  146. package/dist/storage/redis/options.d.ts.map +1 -1
  147. package/dist/storage/redis/options.js.map +1 -1
  148. package/dist/storage/redis/pubsub.d.ts +16 -16
  149. package/dist/storage/redis/pubsub.d.ts.map +1 -1
  150. package/dist/storage/redis/pubsub.js +14 -14
  151. package/dist/storage/redis/pubsub.js.map +1 -1
  152. package/dist/storage/redis/reply.d.ts +80 -72
  153. package/dist/storage/redis/reply.d.ts.map +1 -1
  154. package/dist/storage/redis/reply.js +53 -46
  155. package/dist/storage/redis/reply.js.map +1 -1
  156. package/dist/storage/redis/scan.d.ts +4 -4
  157. package/dist/storage/redis/scan.d.ts.map +1 -1
  158. package/dist/storage/redis/scan.js +6 -6
  159. package/dist/storage/redis/scan.js.map +1 -1
  160. package/dist/storage/redis/script.d.ts +28 -21
  161. package/dist/storage/redis/script.d.ts.map +1 -1
  162. package/dist/storage/redis/script.js +29 -22
  163. package/dist/storage/redis/script.js.map +1 -1
  164. package/dist/storage/redis/target.d.ts +17 -1
  165. package/dist/storage/redis/target.d.ts.map +1 -1
  166. package/dist/storage/redis/target.js +30 -1
  167. package/dist/storage/redis/target.js.map +1 -1
  168. package/dist/storage/redis/wire.d.ts +6 -6
  169. package/dist/storage/redis/wire.d.ts.map +1 -1
  170. package/dist/storage/redis/wire.js +6 -6
  171. package/dist/storage/redis/wire.js.map +1 -1
  172. package/dist/testing/mod.d.ts +83 -88
  173. package/dist/testing/mod.d.ts.map +1 -1
  174. package/dist/testing/mod.js +75 -81
  175. package/dist/testing/mod.js.map +1 -1
  176. package/dist/testing/playwright.d.ts +28 -32
  177. package/dist/testing/playwright.d.ts.map +1 -1
  178. package/dist/testing/playwright.js +22 -27
  179. package/dist/testing/playwright.js.map +1 -1
  180. package/dist/testing/puppeteer.d.ts +11 -12
  181. package/dist/testing/puppeteer.d.ts.map +1 -1
  182. package/dist/testing/puppeteer.js +17 -18
  183. package/dist/testing/puppeteer.js.map +1 -1
  184. package/dist/testing/system.d.ts +72 -90
  185. package/dist/testing/system.d.ts.map +1 -1
  186. package/dist/testing/system.js +90 -107
  187. package/dist/testing/system.js.map +1 -1
  188. package/dist/tsconfig.build.tsbuildinfo +1 -1
  189. package/frontends/mod.test.ts +6 -2
  190. package/frontends/mod.ts +20 -19
  191. package/gateway/errors.ts +30 -32
  192. package/gateway/match.ts +61 -57
  193. package/gateway/middleware.ts +62 -64
  194. package/gateway/mod.ts +73 -76
  195. package/gateway/request.ts +143 -140
  196. package/gateway/serve.ts +58 -63
  197. package/gateways/mod.ts +25 -23
  198. package/internal/runtime/napi/napi.cjs +1 -1
  199. package/internal/runtime/napi/napi.d.cts +10 -3
  200. package/internal/runtime/shutdown.ts +113 -101
  201. package/log/logger.test.ts +8 -0
  202. package/log/logger.ts +48 -45
  203. package/metrics/mod.ts +138 -122
  204. package/otel.ts +6 -3
  205. package/package.json +1 -1
  206. package/pubsub/subscription.ts +93 -123
  207. package/pubsub/topic.ts +96 -130
  208. package/reqctx/mod.ts +83 -86
  209. package/services/index.ts +78 -78
  210. package/shutdown/mod.ts +26 -25
  211. package/storage/clickhouse/database.ts +115 -129
  212. package/storage/clickhouse/errors.ts +27 -29
  213. package/storage/clickhouse/mod.ts +10 -10
  214. package/storage/objects/bucket.ts +209 -239
  215. package/storage/objects/error.ts +4 -4
  216. package/storage/postgres/database.ts +131 -164
  217. package/storage/postgres/errors.ts +45 -52
  218. package/storage/postgres/interval.ts +21 -21
  219. package/storage/redis/bitfield.ts +51 -26
  220. package/storage/redis/command.ts +16 -12
  221. package/storage/redis/commands.ts +99 -100
  222. package/storage/redis/database.ts +145 -123
  223. package/storage/redis/mod.ts +52 -48
  224. package/storage/redis/options.ts +26 -24
  225. package/storage/redis/pubsub.ts +14 -14
  226. package/storage/redis/redis.test.ts +17 -2
  227. package/storage/redis/reply.ts +85 -77
  228. package/storage/redis/scan.ts +6 -6
  229. package/storage/redis/script.ts +29 -22
  230. package/storage/redis/target.ts +34 -1
  231. package/storage/redis/wire.ts +8 -8
  232. package/testing/mod.ts +99 -105
  233. package/testing/playwright.ts +32 -37
  234. package/testing/puppeteer.ts +22 -23
  235. package/testing/system.ts +117 -133
@@ -1,6 +1,7 @@
1
1
  /**
2
- * What kind of error a database reported, by its SQLSTATE: the cases an app
3
- * most often handles. `other` is any other; the SQLSTATE says what.
2
+ * Normalized PostgreSQL error categories mapped from SQLSTATE codes for common
3
+ * application error handling. Unmapped SQLSTATEs use `other` (inspect
4
+ * {@link DatabaseError.sqlState} for the exact code).
4
5
  *
5
6
  * @example
6
7
  * try {
@@ -13,85 +14,78 @@
13
14
  * }
14
15
  */
15
16
  export declare const ErrorCode: {
16
- /** None of the others; the SQLSTATE says what. */
17
+ /** Any other SQLSTATE; see `DatabaseError.sqlState` for details. */
17
18
  readonly Other: "other";
18
- /** A `NOT NULL` constraint would be violated (23502). */
19
+ /** A `NOT NULL` constraint was violated (SQLSTATE 23502). */
19
20
  readonly NotNullViolation: "not_null_violation";
20
- /** A foreign key constraint would be violated (23503). */
21
+ /** A foreign key constraint was violated (SQLSTATE 23503). */
21
22
  readonly ForeignKeyViolation: "foreign_key_violation";
22
- /** A unique constraint would be violated (23505). */
23
+ /** A unique constraint was violated (SQLSTATE 23505). */
23
24
  readonly UniqueViolation: "unique_violation";
24
- /** A check constraint would be violated (23514). */
25
+ /** A check constraint was violated (SQLSTATE 23514). */
25
26
  readonly CheckViolation: "check_violation";
26
- /** An exclusion constraint would be violated (23P01). */
27
+ /** An exclusion constraint was violated (SQLSTATE 23P01). */
27
28
  readonly ExcludeViolation: "exclude_violation";
28
- /** A statement ran in a transaction an earlier statement failed (25P02). */
29
+ /** A statement ran in a transaction aborted by an earlier error (SQLSTATE 25P02). */
29
30
  readonly TransactionFailed: "transaction_failed";
30
- /** A deadlock was detected (40P01). */
31
+ /** A deadlock was detected (SQLSTATE 40P01). */
31
32
  readonly DeadlockDetected: "deadlock_detected";
32
- /** The server refused a connection: it has as many as it allows (53300). */
33
+ /** The server rejected the connection due to its connection limit (SQLSTATE 53300). */
33
34
  readonly TooManyConnections: "too_many_connections";
34
35
  /**
35
- * A serializable or repeatable read transaction could not be serialized
36
- * with a concurrent one (40001); retrying it may succeed.
36
+ * A serializable or repeatable-read transaction conflicted with a concurrent
37
+ * transaction (SQLSTATE 40001); retrying the transaction may succeed.
37
38
  */
38
39
  readonly SerializationFailure: "serialization_failure";
39
- /** A write in a read-only transaction (25006), such as one through a read handle. */
40
+ /** A write was attempted in a read-only transaction (SQLSTATE 25006), such as via a read handle. */
40
41
  readonly ReadOnlyTransaction: "read_only_transaction";
41
42
  /**
42
- * A lock could not be taken without waiting (55P03), as with
43
- * `FOR UPDATE NOWAIT` or `lock_timeout`.
43
+ * A lock could not be acquired without waiting (SQLSTATE 55P03), such as
44
+ * with `FOR UPDATE NOWAIT` or `lock_timeout`.
44
45
  */
45
46
  readonly LockNotAvailable: "lock_not_available";
46
- /** The statement was canceled (57014): by a timeout, or on request. */
47
+ /** The statement was canceled by timeout or explicit request (SQLSTATE 57014). */
47
48
  readonly QueryCanceled: "query_canceled";
48
- /** The database could not be reached, or the connection to it was lost (class 08). */
49
+ /** The database could not be reached or the connection was lost (SQLSTATE class 08). */
49
50
  readonly ConnectionFailure: "connection_failure";
50
51
  };
51
- /** One of the {@link ErrorCode} values: `'unique_violation'`. */
52
+ /** Union of {@link ErrorCode} string values (e.g. `'unique_violation'`). */
52
53
  export type ErrorCode = (typeof ErrorCode)[keyof typeof ErrorCode];
53
54
  /**
54
- * An error a database reported, or a failure to reach it.
55
+ * Error reported by PostgreSQL or caused by a connection failure.
55
56
  *
56
- * A failure to reach the database, which the server can't report, has
57
- * `sqlState` `"08001"`, `code` `connection_failure`, the client's message
58
- * and none of the optional fields. The caller's own mistakes, such as a
59
- * parameter of the wrong type, and using a busy or closed handle, are plain
60
- * errors instead.
57
+ * Connection failures (which do not originate from the server) have `sqlState`
58
+ * `"08001"`, `code` `"connection_failure"`, the client error message, and no
59
+ * optional fields. Caller mistakes (such as invalid parameter types or using a
60
+ * closed handle) throw standard `Error`/`TypeError` instances instead.
61
61
  *
62
- * The optional fields are sent only for some errors (see
63
- * https://www.postgresql.org/docs/current/protocol-error-fields.html); one
64
- * being there says nothing about the others.
62
+ * Optional diagnostic fields are populated only when sent by PostgreSQL (see
63
+ * https://www.postgresql.org/docs/current/protocol-error-fields.html).
65
64
  *
66
- * Its `message` reads `ERROR: duplicate key value violates unique constraint
67
- * "users_pkey" (Code unique_violation: SQLSTATE 23505)`. A subscription
68
- * handler that throws one fails with the API error code of its SQLSTATE:
69
- * `already_exists` for a unique violation.
65
+ * `message` is formatted like `ERROR: duplicate key value violates unique
66
+ * constraint "users_pkey" (Code unique_violation: SQLSTATE 23505)`.
70
67
  */
71
68
  export declare class DatabaseError extends Error {
72
69
  readonly name: 'DatabaseError';
73
- /** What kind of error it is, by its SQLSTATE. */
70
+ /** Normalized error category derived from `sqlState`. */
74
71
  readonly code: ErrorCode;
75
- /** The SQLSTATE: `"23505"`. */
72
+ /** Five-character PostgreSQL SQLSTATE code (e.g. `"23505"`). */
76
73
  readonly sqlState: string;
77
- /** `ERROR`, `FATAL` or `PANIC`. */
74
+ /** PostgreSQL severity (`ERROR`, `FATAL`, or `PANIC`). */
78
75
  readonly severity: string;
79
- /**
80
- * A secondary message with more detail, such as the key a unique
81
- * violation conflicted on.
82
- */
76
+ /** Optional secondary detail message (e.g. the conflicting key in a unique violation). */
83
77
  readonly detail?: string;
84
- /** A suggestion what to do about it. */
78
+ /** Optional PostgreSQL hint suggesting how to resolve the error. */
85
79
  readonly hint?: string;
86
- /** The schema of the object the error is about. */
80
+ /** Schema name associated with the error, if provided. */
87
81
  readonly schemaName?: string;
88
- /** The table the error is about. */
82
+ /** Table name associated with the error, if provided. */
89
83
  readonly tableName?: string;
90
- /** The column the error is about. */
84
+ /** Column name associated with the error, if provided. */
91
85
  readonly columnName?: string;
92
- /** The data type the error is about. */
86
+ /** Data type name associated with the error, if provided. */
93
87
  readonly dataTypeName?: string;
94
- /** The constraint the error is about; an index counts as one. */
88
+ /** Constraint or index name associated with the error, if provided. */
95
89
  readonly constraintName?: string;
96
90
  constructor(fields: {
97
91
  message: string;
@@ -107,14 +101,14 @@ export declare class DatabaseError extends Error {
107
101
  constraintName?: string;
108
102
  });
109
103
  }
110
- /** Thrown by `queryRow` and `rawQueryRow` for a query that returns more than one row. */
104
+ /** Thrown by `queryRow` and `rawQueryRow` when a query returns more than one row. */
111
105
  export declare class TooManyRowsError extends Error {
112
106
  readonly name: 'TooManyRowsError';
113
107
  constructor();
114
108
  }
115
109
  /**
116
- * Awaits a native database call, throwing the error it rejects with as a
117
- * `DatabaseError` if it is one.
110
+ * Awaits a native database call and converts encoded native errors into
111
+ * {@link DatabaseError}.
118
112
  */
119
113
  export declare function native<T>(call: Promise<T>): Promise<T>;
120
114
  //# sourceMappingURL=errors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../storage/postgres/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,SAAS;IACpB,kDAAkD;;IAElD,yDAAyD;;IAEzD,0DAA0D;;IAE1D,qDAAqD;;IAErD,oDAAoD;;IAEpD,yDAAyD;;IAEzD,4EAA4E;;IAE5E,uCAAuC;;IAEvC,4EAA4E;;IAE5E;;;OAGG;;IAEH,qFAAqF;;IAErF;;;OAGG;;IAEH,uEAAuE;;IAEvE,sFAAsF;;CAE9E,CAAC;AAEX,iEAAiE;AACjE,MAAM,MAAM,SAAS,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC;AAEnE;;;;;;;;;;;;;;;;;GAiBG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,SAAiB,IAAI,EAAE,eAAe,CAAC;IACvC,iDAAiD;IACjD,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,+BAA+B;IAC/B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,mCAAmC;IACnC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,wCAAwC;IACxC,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,mDAAmD;IACnD,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,oCAAoC;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAC5B,qCAAqC;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,wCAAwC;IACxC,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,iEAAiE;IACjE,QAAQ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GAAG,OAAO,CAAC,CAAC,CAAC,CAM5D"}
@@ -1,6 +1,7 @@
1
1
  /**
2
- * What kind of error a database reported, by its SQLSTATE: the cases an app
3
- * most often handles. `other` is any other; the SQLSTATE says what.
2
+ * Normalized PostgreSQL error categories mapped from SQLSTATE codes for common
3
+ * application error handling. Unmapped SQLSTATEs use `other` (inspect
4
+ * {@link DatabaseError.sqlState} for the exact code).
4
5
  *
5
6
  * @example
6
7
  * try {
@@ -13,82 +14,75 @@
13
14
  * }
14
15
  */
15
16
  export const ErrorCode = {
16
- /** None of the others; the SQLSTATE says what. */
17
+ /** Any other SQLSTATE; see `DatabaseError.sqlState` for details. */
17
18
  Other: 'other',
18
- /** A `NOT NULL` constraint would be violated (23502). */
19
+ /** A `NOT NULL` constraint was violated (SQLSTATE 23502). */
19
20
  NotNullViolation: 'not_null_violation',
20
- /** A foreign key constraint would be violated (23503). */
21
+ /** A foreign key constraint was violated (SQLSTATE 23503). */
21
22
  ForeignKeyViolation: 'foreign_key_violation',
22
- /** A unique constraint would be violated (23505). */
23
+ /** A unique constraint was violated (SQLSTATE 23505). */
23
24
  UniqueViolation: 'unique_violation',
24
- /** A check constraint would be violated (23514). */
25
+ /** A check constraint was violated (SQLSTATE 23514). */
25
26
  CheckViolation: 'check_violation',
26
- /** An exclusion constraint would be violated (23P01). */
27
+ /** An exclusion constraint was violated (SQLSTATE 23P01). */
27
28
  ExcludeViolation: 'exclude_violation',
28
- /** A statement ran in a transaction an earlier statement failed (25P02). */
29
+ /** A statement ran in a transaction aborted by an earlier error (SQLSTATE 25P02). */
29
30
  TransactionFailed: 'transaction_failed',
30
- /** A deadlock was detected (40P01). */
31
+ /** A deadlock was detected (SQLSTATE 40P01). */
31
32
  DeadlockDetected: 'deadlock_detected',
32
- /** The server refused a connection: it has as many as it allows (53300). */
33
+ /** The server rejected the connection due to its connection limit (SQLSTATE 53300). */
33
34
  TooManyConnections: 'too_many_connections',
34
35
  /**
35
- * A serializable or repeatable read transaction could not be serialized
36
- * with a concurrent one (40001); retrying it may succeed.
36
+ * A serializable or repeatable-read transaction conflicted with a concurrent
37
+ * transaction (SQLSTATE 40001); retrying the transaction may succeed.
37
38
  */
38
39
  SerializationFailure: 'serialization_failure',
39
- /** A write in a read-only transaction (25006), such as one through a read handle. */
40
+ /** A write was attempted in a read-only transaction (SQLSTATE 25006), such as via a read handle. */
40
41
  ReadOnlyTransaction: 'read_only_transaction',
41
42
  /**
42
- * A lock could not be taken without waiting (55P03), as with
43
- * `FOR UPDATE NOWAIT` or `lock_timeout`.
43
+ * A lock could not be acquired without waiting (SQLSTATE 55P03), such as
44
+ * with `FOR UPDATE NOWAIT` or `lock_timeout`.
44
45
  */
45
46
  LockNotAvailable: 'lock_not_available',
46
- /** The statement was canceled (57014): by a timeout, or on request. */
47
+ /** The statement was canceled by timeout or explicit request (SQLSTATE 57014). */
47
48
  QueryCanceled: 'query_canceled',
48
- /** The database could not be reached, or the connection to it was lost (class 08). */
49
+ /** The database could not be reached or the connection was lost (SQLSTATE class 08). */
49
50
  ConnectionFailure: 'connection_failure',
50
51
  };
51
52
  /**
52
- * An error a database reported, or a failure to reach it.
53
+ * Error reported by PostgreSQL or caused by a connection failure.
53
54
  *
54
- * A failure to reach the database, which the server can't report, has
55
- * `sqlState` `"08001"`, `code` `connection_failure`, the client's message
56
- * and none of the optional fields. The caller's own mistakes, such as a
57
- * parameter of the wrong type, and using a busy or closed handle, are plain
58
- * errors instead.
55
+ * Connection failures (which do not originate from the server) have `sqlState`
56
+ * `"08001"`, `code` `"connection_failure"`, the client error message, and no
57
+ * optional fields. Caller mistakes (such as invalid parameter types or using a
58
+ * closed handle) throw standard `Error`/`TypeError` instances instead.
59
59
  *
60
- * The optional fields are sent only for some errors (see
61
- * https://www.postgresql.org/docs/current/protocol-error-fields.html); one
62
- * being there says nothing about the others.
60
+ * Optional diagnostic fields are populated only when sent by PostgreSQL (see
61
+ * https://www.postgresql.org/docs/current/protocol-error-fields.html).
63
62
  *
64
- * Its `message` reads `ERROR: duplicate key value violates unique constraint
65
- * "users_pkey" (Code unique_violation: SQLSTATE 23505)`. A subscription
66
- * handler that throws one fails with the API error code of its SQLSTATE:
67
- * `already_exists` for a unique violation.
63
+ * `message` is formatted like `ERROR: duplicate key value violates unique
64
+ * constraint "users_pkey" (Code unique_violation: SQLSTATE 23505)`.
68
65
  */
69
66
  export class DatabaseError extends Error {
70
- /** What kind of error it is, by its SQLSTATE. */
67
+ /** Normalized error category derived from `sqlState`. */
71
68
  code;
72
- /** The SQLSTATE: `"23505"`. */
69
+ /** Five-character PostgreSQL SQLSTATE code (e.g. `"23505"`). */
73
70
  sqlState;
74
- /** `ERROR`, `FATAL` or `PANIC`. */
71
+ /** PostgreSQL severity (`ERROR`, `FATAL`, or `PANIC`). */
75
72
  severity;
76
- /**
77
- * A secondary message with more detail, such as the key a unique
78
- * violation conflicted on.
79
- */
73
+ /** Optional secondary detail message (e.g. the conflicting key in a unique violation). */
80
74
  detail;
81
- /** A suggestion what to do about it. */
75
+ /** Optional PostgreSQL hint suggesting how to resolve the error. */
82
76
  hint;
83
- /** The schema of the object the error is about. */
77
+ /** Schema name associated with the error, if provided. */
84
78
  schemaName;
85
- /** The table the error is about. */
79
+ /** Table name associated with the error, if provided. */
86
80
  tableName;
87
- /** The column the error is about. */
81
+ /** Column name associated with the error, if provided. */
88
82
  columnName;
89
- /** The data type the error is about. */
83
+ /** Data type name associated with the error, if provided. */
90
84
  dataTypeName;
91
- /** The constraint the error is about; an index counts as one. */
85
+ /** Constraint or index name associated with the error, if provided. */
92
86
  constraintName;
93
87
  constructor(fields) {
94
88
  super(fields.message);
@@ -109,7 +103,7 @@ export class DatabaseError extends Error {
109
103
  this.constraintName = fields.constraintName;
110
104
  }
111
105
  }
112
- /** Thrown by `queryRow` and `rawQueryRow` for a query that returns more than one row. */
106
+ /** Thrown by `queryRow` and `rawQueryRow` when a query returns more than one row. */
113
107
  export class TooManyRowsError extends Error {
114
108
  constructor() {
115
109
  super('query returned more than one row');
@@ -121,14 +115,13 @@ export class TooManyRowsError extends Error {
121
115
  }
122
116
  }
123
117
  /**
124
- * Begins the message of an error the native module rejects with for a
125
- * `DatabaseError`, which the rest of the message holds as JSON. The same as
126
- * `DATABASE_ERROR_PREFIX` in `sdk/ts/src/postgres.rs`.
118
+ * Prefix for JSON-encoded `DatabaseError` messages from the native module.
119
+ * Must match `DATABASE_ERROR_PREFIX` in `sdk/ts/src/postgres.rs`.
127
120
  */
128
121
  const DATABASE_ERROR_PREFIX = 'encore:postgres.DatabaseError:';
129
122
  /**
130
- * Awaits a native database call, throwing the error it rejects with as a
131
- * `DatabaseError` if it is one.
123
+ * Awaits a native database call and converts encoded native errors into
124
+ * {@link DatabaseError}.
132
125
  */
133
126
  export async function native(call) {
134
127
  try {
@@ -138,7 +131,7 @@ export async function native(call) {
138
131
  throw fromNative(err);
139
132
  }
140
133
  }
141
- /** `err`, a native database call's, as a `DatabaseError` if it is one. */
134
+ /** Converts an encoded native error into a {@link DatabaseError}, passing other errors through. */
142
135
  function fromNative(err) {
143
136
  if (!(err instanceof Error) ||
144
137
  !err.message.startsWith(DATABASE_ERROR_PREFIX)) {
@@ -1 +1 @@
1
- {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../../storage/postgres/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,kDAAkD;IAClD,KAAK,EAAE,OAAO;IACd,yDAAyD;IACzD,gBAAgB,EAAE,oBAAoB;IACtC,0DAA0D;IAC1D,mBAAmB,EAAE,uBAAuB;IAC5C,qDAAqD;IACrD,eAAe,EAAE,kBAAkB;IACnC,oDAAoD;IACpD,cAAc,EAAE,iBAAiB;IACjC,yDAAyD;IACzD,gBAAgB,EAAE,mBAAmB;IACrC,4EAA4E;IAC5E,iBAAiB,EAAE,oBAAoB;IACvC,uCAAuC;IACvC,gBAAgB,EAAE,mBAAmB;IACrC,4EAA4E;IAC5E,kBAAkB,EAAE,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 -1,13 +1,14 @@
1
1
  /**
2
- * A Postgres `interval`, exactly as Postgres holds it: months, days and
3
- * microseconds apart, since a month has no fixed number of days, nor a day
4
- * (across a change of daylight saving time) of microseconds.
2
+ * Represents a PostgreSQL `interval` with its three independent components —
3
+ * `months`, `days`, and `microseconds` — matching PostgreSQL's internal model
4
+ * (months do not have a fixed number of days, and days do not have a fixed
5
+ * number of microseconds across daylight-saving transitions).
5
6
  *
6
- * An `interval` column comes back as a string in ISO 8601's form, as
7
- * Postgres writes one (`'P1Y2M3DT4H5M6.5S'`, and `'P1M-2D'` where the parts'
8
- * signs differ), which {@link Interval.parse} reads. A parameter of type
9
- * `interval` takes an `Interval`, a `Temporal.Duration`, or a string in any
10
- * form Postgres parses (`'1 day 02:00:00'`, `'P1DT2H'`, `'90 minutes'`).
7
+ * `interval` columns are returned as ISO 8601 strings (e.g.
8
+ * `'P1Y2M3DT4H5M6.5S'` or `'P1M-2D'`), which can be parsed with
9
+ * {@link Interval.parse}. Query parameters for `interval` columns accept an
10
+ * `Interval`, a `Temporal.Duration`, or any string PostgreSQL parses (e.g.
11
+ * `'1 day 02:00:00'`, `'P1DT2H'`, `'90 minutes'`).
11
12
  *
12
13
  * @example
13
14
  * const row = await db.queryRow`SELECT ${new Interval(1, 0, 0)} + now() AS due`;
@@ -19,24 +20,23 @@ export declare class Interval {
19
20
  readonly days: number;
20
21
  readonly microseconds: number;
21
22
  /**
22
- * @param months - Whole months, within a Postgres `int4`.
23
- * @param days - Whole days, within a Postgres `int4`.
24
- * @param microseconds - Whole microseconds, a safe integer.
23
+ * @param months - Whole months (signed 32-bit integer).
24
+ * @param days - Whole days (signed 32-bit integer).
25
+ * @param microseconds - Whole microseconds (safe integer).
25
26
  */
26
27
  constructor(months: number, days: number, microseconds: number);
27
28
  /**
28
- * Parses an interval in ISO 8601's form (`P1Y2M3DT4H5M6.5S`, `P2W`), as
29
- * an `interval` column comes back, or in the form Postgres writes one by
30
- * default (`1 year 2 mons 3 days 04:05:06.5`, `-1 days +02:00:00`).
31
- * Postgres's infinite intervals (`infinity`, `-infinity`) have no exact
32
- * form, and throw. Each part but the seconds is a whole
33
- * number. To have Postgres parse other forms, pass the string as a query
29
+ * Parses an interval string in ISO 8601 format (`P1Y2M3DT4H5M6.5S`, `P2W`)
30
+ * or PostgreSQL's default format (`1 year 2 mons 3 days 04:05:06.5`,
31
+ * `-1 days +02:00:00`). All components except seconds must be whole numbers;
32
+ * infinite intervals (`infinity`, `-infinity`) throw. To parse other
33
+ * PostgreSQL interval syntaxes, pass the string directly as a query
34
34
  * parameter instead.
35
35
  *
36
- * @throws {TypeError} if `s` is in neither form.
36
+ * @throws {TypeError} If `s` is not in a supported format.
37
37
  */
38
38
  static parse(s: string): Interval;
39
- /** The interval in ISO 8601's form, as Postgres writes it: `P1Y2M3DT4H5M6.5S`, `PT0S`. */
39
+ /** Formats the interval as an ISO 8601 duration string (e.g. `P1Y2M3DT4H5M6.5S`, `PT0S`). */
40
40
  toString(): string;
41
41
  toJSON(): string;
42
42
  private get __encore_interval();
@@ -1 +1 @@
1
- {"version":3,"file":"interval.d.ts","sourceRoot":"","sources":["../../../storage/postgres/interval.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;GAeG;AACH,qBAAa,QAAQ;IAOjB,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,YAAY,EAAE,MAAM;IAR/B;;;;OAIG;gBAEQ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM;IAO/B;;;;;;;;;;OAUG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ;IAUjC,0FAA0F;IAC1F,QAAQ,IAAI,MAAM;IAqBlB,MAAM,IAAI,MAAM;IAIhB,OAAO,KAAK,iBAAiB,GAE5B;CACF"}
1
+ {"version":3,"file":"interval.d.ts","sourceRoot":"","sources":["../../../storage/postgres/interval.ts"],"names":[],"mappings":"AAKA;;;;;;;;;;;;;;;;GAgBG;AACH,qBAAa,QAAQ;IAOjB,QAAQ,CAAC,MAAM,EAAE,MAAM;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM;IACrB,QAAQ,CAAC,YAAY,EAAE,MAAM;IAR/B;;;;OAIG;gBAEQ,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,YAAY,EAAE,MAAM;IAO/B;;;;;;;;;OASG;IACH,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,GAAG,QAAQ;IAUjC,6FAA6F;IAC7F,QAAQ,IAAI,MAAM;IAqBlB,MAAM,IAAI,MAAM;IAIhB,OAAO,KAAK,iBAAiB,GAE5B;CACF"}
@@ -3,15 +3,16 @@ const MICROS_PER_MINUTE = 60 * MICROS_PER_SECOND;
3
3
  const MICROS_PER_HOUR = 60 * MICROS_PER_MINUTE;
4
4
  const INT32_MAX = 2 ** 31 - 1;
5
5
  /**
6
- * A Postgres `interval`, exactly as Postgres holds it: months, days and
7
- * microseconds apart, since a month has no fixed number of days, nor a day
8
- * (across a change of daylight saving time) of microseconds.
6
+ * Represents a PostgreSQL `interval` with its three independent components —
7
+ * `months`, `days`, and `microseconds` — matching PostgreSQL's internal model
8
+ * (months do not have a fixed number of days, and days do not have a fixed
9
+ * number of microseconds across daylight-saving transitions).
9
10
  *
10
- * An `interval` column comes back as a string in ISO 8601's form, as
11
- * Postgres writes one (`'P1Y2M3DT4H5M6.5S'`, and `'P1M-2D'` where the parts'
12
- * signs differ), which {@link Interval.parse} reads. A parameter of type
13
- * `interval` takes an `Interval`, a `Temporal.Duration`, or a string in any
14
- * form Postgres parses (`'1 day 02:00:00'`, `'P1DT2H'`, `'90 minutes'`).
11
+ * `interval` columns are returned as ISO 8601 strings (e.g.
12
+ * `'P1Y2M3DT4H5M6.5S'` or `'P1M-2D'`), which can be parsed with
13
+ * {@link Interval.parse}. Query parameters for `interval` columns accept an
14
+ * `Interval`, a `Temporal.Duration`, or any string PostgreSQL parses (e.g.
15
+ * `'1 day 02:00:00'`, `'P1DT2H'`, `'90 minutes'`).
15
16
  *
16
17
  * @example
17
18
  * const row = await db.queryRow`SELECT ${new Interval(1, 0, 0)} + now() AS due`;
@@ -23,9 +24,9 @@ export class Interval {
23
24
  days;
24
25
  microseconds;
25
26
  /**
26
- * @param months - Whole months, within a Postgres `int4`.
27
- * @param days - Whole days, within a Postgres `int4`.
28
- * @param microseconds - Whole microseconds, a safe integer.
27
+ * @param months - Whole months (signed 32-bit integer).
28
+ * @param days - Whole days (signed 32-bit integer).
29
+ * @param microseconds - Whole microseconds (safe integer).
29
30
  */
30
31
  constructor(months, days, microseconds) {
31
32
  this.months = months;
@@ -36,15 +37,14 @@ export class Interval {
36
37
  check('microseconds', microseconds, Number.MAX_SAFE_INTEGER);
37
38
  }
38
39
  /**
39
- * Parses an interval in ISO 8601's form (`P1Y2M3DT4H5M6.5S`, `P2W`), as
40
- * an `interval` column comes back, or in the form Postgres writes one by
41
- * default (`1 year 2 mons 3 days 04:05:06.5`, `-1 days +02:00:00`).
42
- * Postgres's infinite intervals (`infinity`, `-infinity`) have no exact
43
- * form, and throw. Each part but the seconds is a whole
44
- * number. To have Postgres parse other forms, pass the string as a query
40
+ * Parses an interval string in ISO 8601 format (`P1Y2M3DT4H5M6.5S`, `P2W`)
41
+ * or PostgreSQL's default format (`1 year 2 mons 3 days 04:05:06.5`,
42
+ * `-1 days +02:00:00`). All components except seconds must be whole numbers;
43
+ * infinite intervals (`infinity`, `-infinity`) throw. To parse other
44
+ * PostgreSQL interval syntaxes, pass the string directly as a query
45
45
  * parameter instead.
46
46
  *
47
- * @throws {TypeError} if `s` is in neither form.
47
+ * @throws {TypeError} If `s` is not in a supported format.
48
48
  */
49
49
  static parse(s) {
50
50
  const parsed = parseISO(s) ?? parsePostgres(s);
@@ -53,7 +53,7 @@ export class Interval {
53
53
  }
54
54
  return new Interval(parsed.months, parsed.days, parsed.microseconds);
55
55
  }
56
- /** The interval in ISO 8601's form, as Postgres writes it: `P1Y2M3DT4H5M6.5S`, `PT0S`. */
56
+ /** Formats the interval as an ISO 8601 duration string (e.g. `P1Y2M3DT4H5M6.5S`, `PT0S`). */
57
57
  toString() {
58
58
  const years = Math.trunc(this.months / 12);
59
59
  const months = this.months % 12;
@@ -84,7 +84,7 @@ export class Interval {
84
84
  }
85
85
  function check(name, value, max) {
86
86
  if (!Number.isInteger(value) || Math.abs(value) > max) {
87
- throw new RangeError(`an Interval's ${name} must be an integer of at most ${max} in magnitude, not ${value}`);
87
+ throw new RangeError(`Interval ${name} must be an integer with magnitude at most ${max}, got ${value}`);
88
88
  }
89
89
  }
90
90
  function part(n, unit) {
@@ -143,7 +143,7 @@ function parsePostgres(s) {
143
143
  }
144
144
  return any ? parts : null;
145
145
  }
146
- /** `s`, a number of seconds with up to six decimals, in microseconds. */
146
+ /** Converts a decimal seconds string (up to 6 decimal places) into microseconds. */
147
147
  function seconds(s) {
148
148
  const negative = s.startsWith('-');
149
149
  const [whole, fraction = ''] = s.replace(/^[+-]/, '').split('.');
@@ -1 +1 @@
1
- {"version":3,"file":"interval.js","sourceRoot":"","sources":["../../../storage/postgres/interval.ts"],"names":[],"mappings":"AAAA,MAAM,iBAAiB,GAAG,OAAS,CAAC;AACpC,MAAM,iBAAiB,GAAG,EAAE,GAAG,iBAAiB,CAAC;AACjD,MAAM,eAAe,GAAG,EAAE,GAAG,iBAAiB,CAAC;AAC/C,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAE9B;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,QAAQ;IAOR;IACA;IACA;IARX;;;;OAIG;IACH,YACW,MAAc,EACd,IAAY,EACZ,YAAoB;QAFpB,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAQ;QACZ,iBAAY,GAAZ,YAAY,CAAQ;QAE7B,KAAK,CAAC,QAAQ,EAAE,MAAM,EAAE,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