effect 4.0.0-beta.36 → 4.0.0-beta.38

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 (125) hide show
  1. package/dist/Cause.d.ts +31 -0
  2. package/dist/Cause.d.ts.map +1 -1
  3. package/dist/Cause.js +19 -0
  4. package/dist/Cause.js.map +1 -1
  5. package/dist/Channel.d.ts +2 -2
  6. package/dist/Channel.d.ts.map +1 -1
  7. package/dist/Effect.d.ts +1 -16
  8. package/dist/Effect.d.ts.map +1 -1
  9. package/dist/Effect.js.map +1 -1
  10. package/dist/Schedule.d.ts.map +1 -1
  11. package/dist/Schedule.js +19 -1
  12. package/dist/Schedule.js.map +1 -1
  13. package/dist/Schema.d.ts +20 -48
  14. package/dist/Schema.d.ts.map +1 -1
  15. package/dist/Schema.js +9 -13
  16. package/dist/Schema.js.map +1 -1
  17. package/dist/SchemaAST.d.ts +5 -0
  18. package/dist/SchemaAST.d.ts.map +1 -1
  19. package/dist/SchemaAST.js.map +1 -1
  20. package/dist/SchemaParser.d.ts +22 -66
  21. package/dist/SchemaParser.d.ts.map +1 -1
  22. package/dist/SchemaParser.js +7 -2
  23. package/dist/SchemaParser.js.map +1 -1
  24. package/dist/Sink.d.ts +5 -2
  25. package/dist/Sink.d.ts.map +1 -1
  26. package/dist/Sink.js.map +1 -1
  27. package/dist/Stream.d.ts +1 -1
  28. package/dist/Stream.d.ts.map +1 -1
  29. package/dist/internal/effect.js +15 -1
  30. package/dist/internal/effect.js.map +1 -1
  31. package/dist/unstable/cli/Prompt.js +16 -6
  32. package/dist/unstable/cli/Prompt.js.map +1 -1
  33. package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
  34. package/dist/unstable/cluster/EntityAddress.js +1 -1
  35. package/dist/unstable/cluster/EntityAddress.js.map +1 -1
  36. package/dist/unstable/cluster/Runner.d.ts.map +1 -1
  37. package/dist/unstable/cluster/Runner.js +1 -1
  38. package/dist/unstable/cluster/Runner.js.map +1 -1
  39. package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
  40. package/dist/unstable/cluster/RunnerAddress.js +1 -1
  41. package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
  42. package/dist/unstable/cluster/ShardId.js +3 -3
  43. package/dist/unstable/cluster/ShardId.js.map +1 -1
  44. package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
  45. package/dist/unstable/devtools/DevToolsClient.js +4 -3
  46. package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
  47. package/dist/unstable/devtools/DevToolsSchema.d.ts +2 -3
  48. package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
  49. package/dist/unstable/devtools/DevToolsSchema.js +11 -1
  50. package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
  51. package/dist/unstable/eventlog/EventJournal.js +2 -2
  52. package/dist/unstable/eventlog/EventJournal.js.map +1 -1
  53. package/dist/unstable/eventlog/EventLog.js +1 -1
  54. package/dist/unstable/eventlog/EventLog.js.map +1 -1
  55. package/dist/unstable/eventlog/SqlEventLogJournal.js +2 -2
  56. package/dist/unstable/eventlog/SqlEventLogJournal.js.map +1 -1
  57. package/dist/unstable/http/HttpClientRequest.d.ts +24 -2
  58. package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
  59. package/dist/unstable/http/HttpClientRequest.js +97 -0
  60. package/dist/unstable/http/HttpClientRequest.js.map +1 -1
  61. package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
  62. package/dist/unstable/http/HttpServerResponse.js +2 -1
  63. package/dist/unstable/http/HttpServerResponse.js.map +1 -1
  64. package/dist/unstable/httpapi/HttpApiBuilder.js +9 -8
  65. package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
  66. package/dist/unstable/httpapi/HttpApiClient.d.ts +36 -20
  67. package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
  68. package/dist/unstable/httpapi/HttpApiClient.js +49 -18
  69. package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
  70. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +186 -67
  71. package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
  72. package/dist/unstable/httpapi/HttpApiEndpoint.js +44 -29
  73. package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
  74. package/dist/unstable/httpapi/HttpApiSchema.d.ts +5 -0
  75. package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
  76. package/dist/unstable/httpapi/HttpApiSchema.js +20 -2
  77. package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
  78. package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
  79. package/dist/unstable/httpapi/OpenApi.js +2 -5
  80. package/dist/unstable/httpapi/OpenApi.js.map +1 -1
  81. package/dist/unstable/reactivity/AtomHttpApi.d.ts +11 -7
  82. package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
  83. package/dist/unstable/reactivity/AtomHttpApi.js +6 -6
  84. package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
  85. package/dist/unstable/schema/VariantSchema.d.ts +1 -1
  86. package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
  87. package/dist/unstable/sql/Migrator.d.ts.map +1 -1
  88. package/dist/unstable/sql/Migrator.js +2 -2
  89. package/dist/unstable/sql/Migrator.js.map +1 -1
  90. package/dist/unstable/sql/SqlError.d.ts +229 -9
  91. package/dist/unstable/sql/SqlError.d.ts.map +1 -1
  92. package/dist/unstable/sql/SqlError.js +256 -6
  93. package/dist/unstable/sql/SqlError.js.map +1 -1
  94. package/package.json +1 -1
  95. package/src/Cause.ts +35 -0
  96. package/src/Channel.ts +2 -2
  97. package/src/Effect.ts +1 -16
  98. package/src/Schedule.ts +20 -8
  99. package/src/Schema.ts +14 -22
  100. package/src/SchemaAST.ts +6 -0
  101. package/src/SchemaParser.ts +32 -31
  102. package/src/Sink.ts +5 -2
  103. package/src/Stream.ts +1 -1
  104. package/src/internal/effect.ts +27 -2
  105. package/src/unstable/cli/Prompt.ts +15 -6
  106. package/src/unstable/cluster/EntityAddress.ts +1 -1
  107. package/src/unstable/cluster/Runner.ts +1 -1
  108. package/src/unstable/cluster/RunnerAddress.ts +1 -1
  109. package/src/unstable/cluster/ShardId.ts +2 -2
  110. package/src/unstable/devtools/DevToolsClient.ts +23 -18
  111. package/src/unstable/devtools/DevToolsSchema.ts +13 -1
  112. package/src/unstable/eventlog/EventJournal.ts +2 -2
  113. package/src/unstable/eventlog/EventLog.ts +1 -1
  114. package/src/unstable/eventlog/SqlEventLogJournal.ts +2 -2
  115. package/src/unstable/http/HttpClientRequest.ts +104 -2
  116. package/src/unstable/http/HttpServerResponse.ts +8 -4
  117. package/src/unstable/httpapi/HttpApiBuilder.ts +15 -9
  118. package/src/unstable/httpapi/HttpApiClient.ts +118 -55
  119. package/src/unstable/httpapi/HttpApiEndpoint.ts +164 -36
  120. package/src/unstable/httpapi/HttpApiSchema.ts +20 -2
  121. package/src/unstable/httpapi/OpenApi.ts +2 -6
  122. package/src/unstable/reactivity/AtomHttpApi.ts +22 -17
  123. package/src/unstable/schema/VariantSchema.ts +1 -1
  124. package/src/unstable/sql/Migrator.ts +7 -5
  125. package/src/unstable/sql/SqlError.ts +360 -8
@@ -1,11 +1,207 @@
1
+ import * as Schema from "../../Schema.ts";
2
+ declare const TypeId: "~effect/sql/SqlError";
3
+ declare const ReasonTypeId: "~effect/sql/SqlError/Reason";
4
+ declare const ConnectionError_base: Schema.ErrorClass<ConnectionError, Schema.TaggedStruct<"ConnectionError", {
5
+ cause: Schema.Defect;
6
+ message: Schema.optional<Schema.String>;
7
+ operation: Schema.optional<Schema.String>;
8
+ }>, import("../../Cause.ts").YieldableError>;
1
9
  /**
2
10
  * @since 4.0.0
3
11
  */
4
- import * as Schema from "../../Schema.ts";
5
- declare const TypeId = "~effect/sql/SqlError";
12
+ export declare class ConnectionError extends ConnectionError_base {
13
+ /**
14
+ * @since 4.0.0
15
+ */
16
+ readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
17
+ /**
18
+ * @since 4.0.0
19
+ */
20
+ get isRetryable(): boolean;
21
+ }
22
+ declare const AuthenticationError_base: Schema.ErrorClass<AuthenticationError, Schema.TaggedStruct<"AuthenticationError", {
23
+ cause: Schema.Defect;
24
+ message: Schema.optional<Schema.String>;
25
+ operation: Schema.optional<Schema.String>;
26
+ }>, import("../../Cause.ts").YieldableError>;
27
+ /**
28
+ * @since 4.0.0
29
+ */
30
+ export declare class AuthenticationError extends AuthenticationError_base {
31
+ /**
32
+ * @since 4.0.0
33
+ */
34
+ readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
35
+ /**
36
+ * @since 4.0.0
37
+ */
38
+ get isRetryable(): boolean;
39
+ }
40
+ declare const AuthorizationError_base: Schema.ErrorClass<AuthorizationError, Schema.TaggedStruct<"AuthorizationError", {
41
+ cause: Schema.Defect;
42
+ message: Schema.optional<Schema.String>;
43
+ operation: Schema.optional<Schema.String>;
44
+ }>, import("../../Cause.ts").YieldableError>;
45
+ /**
46
+ * @since 4.0.0
47
+ */
48
+ export declare class AuthorizationError extends AuthorizationError_base {
49
+ /**
50
+ * @since 4.0.0
51
+ */
52
+ readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
53
+ /**
54
+ * @since 4.0.0
55
+ */
56
+ get isRetryable(): boolean;
57
+ }
58
+ declare const SqlSyntaxError_base: Schema.ErrorClass<SqlSyntaxError, Schema.TaggedStruct<"SqlSyntaxError", {
59
+ cause: Schema.Defect;
60
+ message: Schema.optional<Schema.String>;
61
+ operation: Schema.optional<Schema.String>;
62
+ }>, import("../../Cause.ts").YieldableError>;
63
+ /**
64
+ * @since 4.0.0
65
+ */
66
+ export declare class SqlSyntaxError extends SqlSyntaxError_base {
67
+ /**
68
+ * @since 4.0.0
69
+ */
70
+ readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
71
+ /**
72
+ * @since 4.0.0
73
+ */
74
+ get isRetryable(): boolean;
75
+ }
76
+ declare const ConstraintError_base: Schema.ErrorClass<ConstraintError, Schema.TaggedStruct<"ConstraintError", {
77
+ cause: Schema.Defect;
78
+ message: Schema.optional<Schema.String>;
79
+ operation: Schema.optional<Schema.String>;
80
+ }>, import("../../Cause.ts").YieldableError>;
81
+ /**
82
+ * @since 4.0.0
83
+ */
84
+ export declare class ConstraintError extends ConstraintError_base {
85
+ /**
86
+ * @since 4.0.0
87
+ */
88
+ readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
89
+ /**
90
+ * @since 4.0.0
91
+ */
92
+ get isRetryable(): boolean;
93
+ }
94
+ declare const DeadlockError_base: Schema.ErrorClass<DeadlockError, Schema.TaggedStruct<"DeadlockError", {
95
+ cause: Schema.Defect;
96
+ message: Schema.optional<Schema.String>;
97
+ operation: Schema.optional<Schema.String>;
98
+ }>, import("../../Cause.ts").YieldableError>;
99
+ /**
100
+ * @since 4.0.0
101
+ */
102
+ export declare class DeadlockError extends DeadlockError_base {
103
+ /**
104
+ * @since 4.0.0
105
+ */
106
+ readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
107
+ /**
108
+ * @since 4.0.0
109
+ */
110
+ get isRetryable(): boolean;
111
+ }
112
+ declare const SerializationError_base: Schema.ErrorClass<SerializationError, Schema.TaggedStruct<"SerializationError", {
113
+ cause: Schema.Defect;
114
+ message: Schema.optional<Schema.String>;
115
+ operation: Schema.optional<Schema.String>;
116
+ }>, import("../../Cause.ts").YieldableError>;
117
+ /**
118
+ * @since 4.0.0
119
+ */
120
+ export declare class SerializationError extends SerializationError_base {
121
+ /**
122
+ * @since 4.0.0
123
+ */
124
+ readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
125
+ /**
126
+ * @since 4.0.0
127
+ */
128
+ get isRetryable(): boolean;
129
+ }
130
+ declare const LockTimeoutError_base: Schema.ErrorClass<LockTimeoutError, Schema.TaggedStruct<"LockTimeoutError", {
131
+ cause: Schema.Defect;
132
+ message: Schema.optional<Schema.String>;
133
+ operation: Schema.optional<Schema.String>;
134
+ }>, import("../../Cause.ts").YieldableError>;
135
+ /**
136
+ * @since 4.0.0
137
+ */
138
+ export declare class LockTimeoutError extends LockTimeoutError_base {
139
+ /**
140
+ * @since 4.0.0
141
+ */
142
+ readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
143
+ /**
144
+ * @since 4.0.0
145
+ */
146
+ get isRetryable(): boolean;
147
+ }
148
+ declare const StatementTimeoutError_base: Schema.ErrorClass<StatementTimeoutError, Schema.TaggedStruct<"StatementTimeoutError", {
149
+ cause: Schema.Defect;
150
+ message: Schema.optional<Schema.String>;
151
+ operation: Schema.optional<Schema.String>;
152
+ }>, import("../../Cause.ts").YieldableError>;
153
+ /**
154
+ * @since 4.0.0
155
+ */
156
+ export declare class StatementTimeoutError extends StatementTimeoutError_base {
157
+ /**
158
+ * @since 4.0.0
159
+ */
160
+ readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
161
+ /**
162
+ * @since 4.0.0
163
+ */
164
+ get isRetryable(): boolean;
165
+ }
166
+ declare const UnknownError_base: Schema.ErrorClass<UnknownError, Schema.TaggedStruct<"UnknownError", {
167
+ cause: Schema.Defect;
168
+ message: Schema.optional<Schema.String>;
169
+ operation: Schema.optional<Schema.String>;
170
+ }>, import("../../Cause.ts").YieldableError>;
171
+ /**
172
+ * @since 4.0.0
173
+ */
174
+ export declare class UnknownError extends UnknownError_base {
175
+ /**
176
+ * @since 4.0.0
177
+ */
178
+ readonly [ReasonTypeId]: "~effect/sql/SqlError/Reason";
179
+ /**
180
+ * @since 4.0.0
181
+ */
182
+ get isRetryable(): boolean;
183
+ }
184
+ /**
185
+ * @since 4.0.0
186
+ */
187
+ export type SqlErrorReason = ConnectionError | AuthenticationError | AuthorizationError | SqlSyntaxError | ConstraintError | DeadlockError | SerializationError | LockTimeoutError | StatementTimeoutError | UnknownError;
188
+ /**
189
+ * @since 4.0.0
190
+ */
191
+ export declare const SqlErrorReason: Schema.Union<[
192
+ typeof ConnectionError,
193
+ typeof AuthenticationError,
194
+ typeof AuthorizationError,
195
+ typeof SqlSyntaxError,
196
+ typeof ConstraintError,
197
+ typeof DeadlockError,
198
+ typeof SerializationError,
199
+ typeof LockTimeoutError,
200
+ typeof StatementTimeoutError,
201
+ typeof UnknownError
202
+ ]>;
6
203
  declare const SqlError_base: Schema.ErrorClass<SqlError, Schema.TaggedStruct<"SqlError", {
7
- readonly cause: Schema.Defect;
8
- readonly message: Schema.optional<Schema.String>;
204
+ readonly reason: Schema.Union<[typeof ConnectionError, typeof AuthenticationError, typeof AuthorizationError, typeof SqlSyntaxError, typeof ConstraintError, typeof DeadlockError, typeof SerializationError, typeof LockTimeoutError, typeof StatementTimeoutError, typeof UnknownError]>;
9
205
  }>, import("../../Cause.ts").YieldableError>;
10
206
  /**
11
207
  * @since 4.0.0
@@ -14,8 +210,36 @@ export declare class SqlError extends SqlError_base {
14
210
  /**
15
211
  * @since 4.0.0
16
212
  */
17
- readonly [TypeId] = "~effect/sql/SqlError";
213
+ readonly [TypeId]: "~effect/sql/SqlError";
214
+ /**
215
+ * @since 4.0.0
216
+ */
217
+ readonly cause: ConnectionError | AuthenticationError | AuthorizationError | SqlSyntaxError | ConstraintError | DeadlockError | SerializationError | LockTimeoutError | StatementTimeoutError | UnknownError;
218
+ /**
219
+ * @since 4.0.0
220
+ */
221
+ get message(): string;
222
+ /**
223
+ * @since 4.0.0
224
+ */
225
+ get isRetryable(): boolean;
18
226
  }
227
+ /**
228
+ * @since 4.0.0
229
+ */
230
+ export declare const isSqlError: (u: unknown) => u is SqlError;
231
+ /**
232
+ * @since 4.0.0
233
+ */
234
+ export declare const isSqlErrorReason: (u: unknown) => u is SqlErrorReason;
235
+ type SqliteClassifyOptions = {
236
+ readonly message?: string | undefined;
237
+ readonly operation?: string | undefined;
238
+ };
239
+ /**
240
+ * @since 4.0.0
241
+ */
242
+ export declare const classifySqliteError: (cause: unknown, { message, operation }?: SqliteClassifyOptions) => SqlErrorReason;
19
243
  declare const ResultLengthMismatch_base: Schema.ErrorClass<ResultLengthMismatch, Schema.TaggedStruct<"ResultLengthMismatch", {
20
244
  readonly expected: Schema.Number;
21
245
  readonly actual: Schema.Number;
@@ -24,10 +248,6 @@ declare const ResultLengthMismatch_base: Schema.ErrorClass<ResultLengthMismatch,
24
248
  * @since 4.0.0
25
249
  */
26
250
  export declare class ResultLengthMismatch extends ResultLengthMismatch_base {
27
- /**
28
- * @since 4.0.0
29
- */
30
- readonly [TypeId] = "~effect/sql/SqlError";
31
251
  /**
32
252
  * @since 4.0.0
33
253
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SqlError.d.ts","sourceRoot":"","sources":["../../../src/unstable/sql/SqlError.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AAEzC,QAAA,MAAM,MAAM,yBAAyB,CAAA;;;;;AAErC;;GAEG;AACH,qBAAa,QAAS,SAAQ,aAG5B;IACA;;OAEG;IACH,QAAQ,CAAC,CAAC,MAAM,CAAC,0BAAS;CAC3B;;;;;AAED;;GAEG;AACH,qBAAa,oBACX,SAAQ,yBAGN;IAEF;;OAEG;IACH,QAAQ,CAAC,CAAC,MAAM,CAAC,0BAAS;IAE1B;;OAEG;IACH,IAAa,OAAO,WAEnB;CACF"}
1
+ {"version":3,"file":"SqlError.d.ts","sourceRoot":"","sources":["../../../src/unstable/sql/SqlError.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAA;AAEzC,QAAA,MAAM,MAAM,EAAG,sBAA+B,CAAA;AAC9C,QAAA,MAAM,YAAY,EAAG,6BAAsC,CAAA;;;;;;AAQ3D;;GAEG;AACH,qBAAa,eAAgB,SAAQ,oBAGpC;IACC;;OAEG;IACH,QAAQ,CAAC,CAAC,YAAY,CAAC,gCAAe;IAEtC;;OAEG;IACH,IAAI,WAAW,IAAI,OAAO,CAEzB;CACF;;;;;;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,wBAEH;IACp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;AACH,eAAO,MAAM,mBAAmB,GAC9B,OAAO,OAAO,EACd,yBAAwB,qBAA0B,KACjD,cA+CF,CAAA;;;;;AAED;;GAEG;AACH,qBAAa,oBACX,SAAQ,yBAGN;IAEF;;OAEG;IACH,IAAa,OAAO,WAEnB;CACF"}
@@ -1,20 +1,274 @@
1
1
  /**
2
2
  * @since 4.0.0
3
3
  */
4
+ import * as Predicate from "../../Predicate.js";
4
5
  import * as Schema from "../../Schema.js";
5
6
  const TypeId = "~effect/sql/SqlError";
7
+ const ReasonTypeId = "~effect/sql/SqlError/Reason";
8
+ const ReasonFields = {
9
+ cause: Schema.Defect,
10
+ message: /*#__PURE__*/Schema.optional(Schema.String),
11
+ operation: /*#__PURE__*/Schema.optional(Schema.String)
12
+ };
13
+ /**
14
+ * @since 4.0.0
15
+ */
16
+ export class ConnectionError extends /*#__PURE__*/Schema.TaggedErrorClass("effect/sql/SqlError/ConnectionError")("ConnectionError", ReasonFields) {
17
+ /**
18
+ * @since 4.0.0
19
+ */
20
+ [ReasonTypeId] = ReasonTypeId;
21
+ /**
22
+ * @since 4.0.0
23
+ */
24
+ get isRetryable() {
25
+ return true;
26
+ }
27
+ }
28
+ /**
29
+ * @since 4.0.0
30
+ */
31
+ export class AuthenticationError extends /*#__PURE__*/Schema.TaggedErrorClass("effect/sql/SqlError/AuthenticationError")("AuthenticationError", ReasonFields) {
32
+ /**
33
+ * @since 4.0.0
34
+ */
35
+ [ReasonTypeId] = ReasonTypeId;
36
+ /**
37
+ * @since 4.0.0
38
+ */
39
+ get isRetryable() {
40
+ return false;
41
+ }
42
+ }
43
+ /**
44
+ * @since 4.0.0
45
+ */
46
+ export class AuthorizationError extends /*#__PURE__*/Schema.TaggedErrorClass("effect/sql/SqlError/AuthorizationError")("AuthorizationError", ReasonFields) {
47
+ /**
48
+ * @since 4.0.0
49
+ */
50
+ [ReasonTypeId] = ReasonTypeId;
51
+ /**
52
+ * @since 4.0.0
53
+ */
54
+ get isRetryable() {
55
+ return false;
56
+ }
57
+ }
58
+ /**
59
+ * @since 4.0.0
60
+ */
61
+ export class SqlSyntaxError extends /*#__PURE__*/Schema.TaggedErrorClass("effect/sql/SqlError/SqlSyntaxError")("SqlSyntaxError", ReasonFields) {
62
+ /**
63
+ * @since 4.0.0
64
+ */
65
+ [ReasonTypeId] = ReasonTypeId;
66
+ /**
67
+ * @since 4.0.0
68
+ */
69
+ get isRetryable() {
70
+ return false;
71
+ }
72
+ }
73
+ /**
74
+ * @since 4.0.0
75
+ */
76
+ export class ConstraintError extends /*#__PURE__*/Schema.TaggedErrorClass("effect/sql/SqlError/ConstraintError")("ConstraintError", ReasonFields) {
77
+ /**
78
+ * @since 4.0.0
79
+ */
80
+ [ReasonTypeId] = ReasonTypeId;
81
+ /**
82
+ * @since 4.0.0
83
+ */
84
+ get isRetryable() {
85
+ return false;
86
+ }
87
+ }
88
+ /**
89
+ * @since 4.0.0
90
+ */
91
+ export class DeadlockError extends /*#__PURE__*/Schema.TaggedErrorClass("effect/sql/SqlError/DeadlockError")("DeadlockError", ReasonFields) {
92
+ /**
93
+ * @since 4.0.0
94
+ */
95
+ [ReasonTypeId] = ReasonTypeId;
96
+ /**
97
+ * @since 4.0.0
98
+ */
99
+ get isRetryable() {
100
+ return true;
101
+ }
102
+ }
103
+ /**
104
+ * @since 4.0.0
105
+ */
106
+ export class SerializationError extends /*#__PURE__*/Schema.TaggedErrorClass("effect/sql/SqlError/SerializationError")("SerializationError", ReasonFields) {
107
+ /**
108
+ * @since 4.0.0
109
+ */
110
+ [ReasonTypeId] = ReasonTypeId;
111
+ /**
112
+ * @since 4.0.0
113
+ */
114
+ get isRetryable() {
115
+ return true;
116
+ }
117
+ }
118
+ /**
119
+ * @since 4.0.0
120
+ */
121
+ export class LockTimeoutError extends /*#__PURE__*/Schema.TaggedErrorClass("effect/sql/SqlError/LockTimeoutError")("LockTimeoutError", ReasonFields) {
122
+ /**
123
+ * @since 4.0.0
124
+ */
125
+ [ReasonTypeId] = ReasonTypeId;
126
+ /**
127
+ * @since 4.0.0
128
+ */
129
+ get isRetryable() {
130
+ return true;
131
+ }
132
+ }
133
+ /**
134
+ * @since 4.0.0
135
+ */
136
+ export class StatementTimeoutError extends /*#__PURE__*/Schema.TaggedErrorClass("effect/sql/SqlError/StatementTimeoutError")("StatementTimeoutError", ReasonFields) {
137
+ /**
138
+ * @since 4.0.0
139
+ */
140
+ [ReasonTypeId] = ReasonTypeId;
141
+ /**
142
+ * @since 4.0.0
143
+ */
144
+ get isRetryable() {
145
+ return true;
146
+ }
147
+ }
148
+ /**
149
+ * @since 4.0.0
150
+ */
151
+ export class UnknownError extends /*#__PURE__*/Schema.TaggedErrorClass("effect/sql/SqlError/UnknownError")("UnknownError", ReasonFields) {
152
+ /**
153
+ * @since 4.0.0
154
+ */
155
+ [ReasonTypeId] = ReasonTypeId;
156
+ /**
157
+ * @since 4.0.0
158
+ */
159
+ get isRetryable() {
160
+ return false;
161
+ }
162
+ }
163
+ /**
164
+ * @since 4.0.0
165
+ */
166
+ export const SqlErrorReason = /*#__PURE__*/Schema.Union([ConnectionError, AuthenticationError, AuthorizationError, SqlSyntaxError, ConstraintError, DeadlockError, SerializationError, LockTimeoutError, StatementTimeoutError, UnknownError]);
6
167
  /**
7
168
  * @since 4.0.0
8
169
  */
9
170
  export class SqlError extends /*#__PURE__*/Schema.TaggedErrorClass("effect/sql/SqlError")("SqlError", {
10
- cause: Schema.Defect,
11
- message: /*#__PURE__*/Schema.optional(Schema.String)
171
+ reason: SqlErrorReason
12
172
  }) {
13
173
  /**
14
174
  * @since 4.0.0
15
175
  */
16
176
  [TypeId] = TypeId;
177
+ /**
178
+ * @since 4.0.0
179
+ */
180
+ cause = this.reason;
181
+ /**
182
+ * @since 4.0.0
183
+ */
184
+ get message() {
185
+ return this.reason.message || this.reason._tag;
186
+ }
187
+ /**
188
+ * @since 4.0.0
189
+ */
190
+ get isRetryable() {
191
+ return this.reason.isRetryable;
192
+ }
17
193
  }
194
+ /**
195
+ * @since 4.0.0
196
+ */
197
+ export const isSqlError = u => Predicate.hasProperty(u, TypeId);
198
+ /**
199
+ * @since 4.0.0
200
+ */
201
+ export const isSqlErrorReason = u => Predicate.hasProperty(u, ReasonTypeId);
202
+ const sqliteCodeFromCause = cause => {
203
+ if (!Predicate.hasProperty(cause, "code")) {
204
+ return undefined;
205
+ }
206
+ const code = cause.code;
207
+ return typeof code === "string" || typeof code === "number" ? code : undefined;
208
+ };
209
+ const sqliteNumericCodeFromCause = cause => {
210
+ const code = sqliteCodeFromCause(cause);
211
+ if (typeof code === "number") {
212
+ return code;
213
+ }
214
+ if (!Predicate.hasProperty(cause, "errno")) {
215
+ return undefined;
216
+ }
217
+ const errno = cause.errno;
218
+ return typeof errno === "number" ? errno : undefined;
219
+ };
220
+ const matchesSqliteCode = (code, expected) => code === expected || code.startsWith(expected + "_");
221
+ /**
222
+ * @since 4.0.0
223
+ */
224
+ export const classifySqliteError = (cause, {
225
+ message,
226
+ operation
227
+ } = {}) => {
228
+ const props = {
229
+ cause,
230
+ message,
231
+ operation
232
+ };
233
+ const code = sqliteCodeFromCause(cause);
234
+ if (typeof code === "string") {
235
+ if (matchesSqliteCode(code, "SQLITE_AUTH")) {
236
+ return new AuthenticationError(props);
237
+ }
238
+ if (matchesSqliteCode(code, "SQLITE_PERM")) {
239
+ return new AuthorizationError(props);
240
+ }
241
+ if (matchesSqliteCode(code, "SQLITE_CONSTRAINT")) {
242
+ return new ConstraintError(props);
243
+ }
244
+ if (matchesSqliteCode(code, "SQLITE_BUSY") || matchesSqliteCode(code, "SQLITE_LOCKED")) {
245
+ return new LockTimeoutError(props);
246
+ }
247
+ if (matchesSqliteCode(code, "SQLITE_CANTOPEN")) {
248
+ return new ConnectionError(props);
249
+ }
250
+ }
251
+ const numericCode = sqliteNumericCodeFromCause(cause);
252
+ if (typeof numericCode === "number") {
253
+ const code = numericCode & 0xff;
254
+ switch (code) {
255
+ case 23:
256
+ return new AuthenticationError(props);
257
+ case 3:
258
+ return new AuthorizationError(props);
259
+ case 19:
260
+ return new ConstraintError(props);
261
+ case 5:
262
+ case 6:
263
+ return new LockTimeoutError(props);
264
+ case 14:
265
+ return new ConnectionError(props);
266
+ default:
267
+ return new UnknownError(props);
268
+ }
269
+ }
270
+ return new UnknownError(props);
271
+ };
18
272
  /**
19
273
  * @since 4.0.0
20
274
  */
@@ -22,10 +276,6 @@ export class ResultLengthMismatch extends /*#__PURE__*/Schema.TaggedErrorClass("
22
276
  expected: Schema.Number,
23
277
  actual: Schema.Number
24
278
  }) {
25
- /**
26
- * @since 4.0.0
27
- */
28
- [TypeId] = TypeId;
29
279
  /**
30
280
  * @since 4.0.0
31
281
  */
@@ -1 +1 @@
1
- {"version":3,"file":"SqlError.js","names":["Schema","TypeId","SqlError","TaggedErrorClass","cause","Defect","message","optional","String","ResultLengthMismatch","expected","Number","actual"],"sources":["../../../src/unstable/sql/SqlError.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,MAAM,MAAM,iBAAiB;AAEzC,MAAMC,MAAM,GAAG,sBAAsB;AAErC;;;AAGA,OAAM,MAAOC,QAAS,sBAAQF,MAAM,CAACG,gBAAgB,CAAW,qBAAqB,CAAC,CAAC,UAAU,EAAE;EACjGC,KAAK,EAAEJ,MAAM,CAACK,MAAM;EACpBC,OAAO,eAAEN,MAAM,CAACO,QAAQ,CAACP,MAAM,CAACQ,MAAM;CACvC,CAAC;EACA;;;EAGS,CAACP,MAAM,IAAIA,MAAM;;AAG5B;;;AAGA,OAAM,MAAOQ,oBACX,sBAAQT,MAAM,CAACG,gBAAgB,CAAuB,iCAAiC,CAAC,CAAC,sBAAsB,EAAE;EAC/GO,QAAQ,EAAEV,MAAM,CAACW,MAAM;EACvBC,MAAM,EAAEZ,MAAM,CAACW;CAChB,CAAC;EAEF;;;EAGS,CAACV,MAAM,IAAIA,MAAM;EAE1B;;;EAGA,IAAaK,OAAOA,CAAA;IAClB,OAAO,YAAY,IAAI,CAACI,QAAQ,oBAAoB,IAAI,CAACE,MAAM,EAAE;EACnE","ignoreList":[]}
1
+ {"version":3,"file":"SqlError.js","names":["Predicate","Schema","TypeId","ReasonTypeId","ReasonFields","cause","Defect","message","optional","String","operation","ConnectionError","TaggedErrorClass","isRetryable","AuthenticationError","AuthorizationError","SqlSyntaxError","ConstraintError","DeadlockError","SerializationError","LockTimeoutError","StatementTimeoutError","UnknownError","SqlErrorReason","Union","SqlError","reason","_tag","isSqlError","u","hasProperty","isSqlErrorReason","sqliteCodeFromCause","undefined","code","sqliteNumericCodeFromCause","errno","matchesSqliteCode","expected","startsWith","classifySqliteError","props","numericCode","ResultLengthMismatch","Number","actual"],"sources":["../../../src/unstable/sql/SqlError.ts"],"sourcesContent":[null],"mappings":"AAAA;;;AAGA,OAAO,KAAKA,SAAS,MAAM,oBAAoB;AAC/C,OAAO,KAAKC,MAAM,MAAM,iBAAiB;AAEzC,MAAMC,MAAM,GAAG,sBAA+B;AAC9C,MAAMC,YAAY,GAAG,6BAAsC;AAE3D,MAAMC,YAAY,GAAG;EACnBC,KAAK,EAAEJ,MAAM,CAACK,MAAM;EACpBC,OAAO,eAAEN,MAAM,CAACO,QAAQ,CAACP,MAAM,CAACQ,MAAM,CAAC;EACvCC,SAAS,eAAET,MAAM,CAACO,QAAQ,CAACP,MAAM,CAACQ,MAAM;CACzC;AAED;;;AAGA,OAAM,MAAOE,eAAgB,sBAAQV,MAAM,CAACW,gBAAgB,CAAkB,qCAAqC,CAAC,CAClH,iBAAiB,EACjBR,YAAY,CACb;EACC;;;EAGS,CAACD,YAAY,IAAIA,YAAY;EAEtC;;;EAGA,IAAIU,WAAWA,CAAA;IACb,OAAO,IAAI;EACb;;AAGF;;;AAGA,OAAM,MAAOC,mBAAoB,sBAAQb,MAAM,CAACW,gBAAgB,CAC9D,yCAAyC,CAC1C,CAAC,qBAAqB,EAAER,YAAY,CAAC;EACpC;;;EAGS,CAACD,YAAY,IAAIA,YAAY;EAEtC;;;EAGA,IAAIU,WAAWA,CAAA;IACb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AAO,IAAInB,YAAY,CAACmB,KAAK,CAAC;AAChC,CAAC;AAED;;;AAGA,OAAM,MAAOE,oBACX,sBAAQ1C,MAAM,CAACW,gBAAgB,CAAuB,iCAAiC,CAAC,CAAC,sBAAsB,EAAE;EAC/G0B,QAAQ,EAAErC,MAAM,CAAC2C,MAAM;EACvBC,MAAM,EAAE5C,MAAM,CAAC2C;CAChB,CAAC;EAEF;;;EAGA,IAAarC,OAAOA,CAAA;IAClB,OAAO,YAAY,IAAI,CAAC+B,QAAQ,oBAAoB,IAAI,CAACO,MAAM,EAAE;EACnE","ignoreList":[]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "effect",
3
3
  "type": "module",
4
- "version": "4.0.0-beta.36",
4
+ "version": "4.0.0-beta.38",
5
5
  "license": "MIT",
6
6
  "description": "The missing standard library for TypeScript, for writing production-grade software.",
7
7
  "homepage": "https://effect.website",
package/src/Cause.ts CHANGED
@@ -79,6 +79,7 @@
79
79
  */
80
80
  import type * as Effect from "./Effect.ts"
81
81
  import type { Equal } from "./Equal.ts"
82
+ import type { Fiber } from "./Fiber.ts"
82
83
  import type { Inspectable } from "./Inspectable.ts"
83
84
  import * as core from "./internal/core.ts"
84
85
  import * as effect from "./internal/effect.ts"
@@ -1565,6 +1566,40 @@ export interface ExceededCapacityError extends YieldableError {
1565
1566
  */
1566
1567
  export const ExceededCapacityError: new(message?: string) => ExceededCapacityError = effect.ExceededCapacityError
1567
1568
 
1569
+ /**
1570
+ * Unique brand for {@link AsyncFiberError}.
1571
+ *
1572
+ * @since 4.0.0
1573
+ * @category symbols
1574
+ */
1575
+ export const AsyncFiberErrorTypeId: "~effect/Cause/AsyncFiberError" = effect.AsyncFiberErrorTypeId
1576
+
1577
+ /**
1578
+ * @category guards
1579
+ * @since 4.0.0
1580
+ */
1581
+ export const isAsyncFiberError: (u: unknown) => u is AsyncFiberError = effect.isAsyncFiberError
1582
+
1583
+ /**
1584
+ * An error that occurs when trying to run an async fiber with Effect.runSync.
1585
+ *
1586
+ * @since 4.0.0
1587
+ * @category errors
1588
+ */
1589
+ export interface AsyncFiberError extends YieldableError {
1590
+ readonly [AsyncFiberErrorTypeId]: typeof AsyncFiberErrorTypeId
1591
+ readonly _tag: "AsyncFiberError"
1592
+ readonly fiber: Fiber<unknown, unknown>
1593
+ }
1594
+
1595
+ /**
1596
+ * An error that occurs when trying to run an async fiber with Effect.runSync.
1597
+ *
1598
+ * @category constructors
1599
+ * @since 4.0.0
1600
+ */
1601
+ export const AsyncFiberError: new(fiber: Fiber<unknown, unknown>) => AsyncFiberError = effect.AsyncFiberError
1602
+
1568
1603
  /**
1569
1604
  * Unique brand for {@link UnknownError}.
1570
1605
  *
package/src/Channel.ts CHANGED
@@ -200,8 +200,8 @@ export interface ChannelUnify<A extends { [Unify.typeSymbol]?: any }> extends Ef
200
200
  * @category models
201
201
  * @since 2.0.0
202
202
  */
203
- export interface ChannelUnifyIgnore extends Effect.EffectUnifyIgnore {
204
- Channel?: true
203
+ export interface ChannelUnifyIgnore {
204
+ Effect?: true
205
205
  }
206
206
 
207
207
  type TagsWithReason<E> = {
package/src/Effect.ts CHANGED
@@ -173,7 +173,7 @@ export interface Effect<out A, out E = never, out R = never> extends Pipeable, Y
173
173
  readonly [TypeId]: Variance<A, E, R>
174
174
  [Unify.typeSymbol]?: unknown
175
175
  [Unify.unifySymbol]?: EffectUnify<this>
176
- [Unify.ignoreSymbol]?: EffectUnifyIgnore
176
+ [Unify.ignoreSymbol]?: {}
177
177
  }
178
178
 
179
179
  /**
@@ -242,21 +242,6 @@ export interface EffectUnify<A extends { [Unify.typeSymbol]?: any }> {
242
242
  : never
243
243
  }
244
244
 
245
- /**
246
- * @category Models
247
- * @since 2.0.0
248
- * @example
249
- * ```ts
250
- * import type { Effect } from "effect"
251
- *
252
- * // EffectUnifyIgnore is used internally to control type unification
253
- * // It prevents certain types from being unified with Effect types
254
- * declare const ignored: Effect.EffectUnifyIgnore
255
- * ```
256
- */
257
- export interface EffectUnifyIgnore {
258
- Effect?: true
259
- }
260
245
  /**
261
246
  * @category Type Lambdas
262
247
  * @since 2.0.0