apps 0.0.1-beta.34 → 0.0.1-beta.36
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/framework-reference.json +1 -1
- package/js/{chunk-OX233L7N.js → chunk-4U2VUDET.js} +2 -2
- package/js/{chunk-HW3DPBZR.js → chunk-556EWA6P.js} +3 -2
- package/js/{chunk-UMCMZFXW.js → chunk-73AV3JVU.js} +1 -1
- package/js/{chunk-QKVZGWGZ.js → chunk-A2NN45C7.js} +7 -7
- package/js/{chunk-6ZJ2H6P4.js → chunk-A4O72Z3A.js} +298 -190
- package/js/{chunk-FBBXFFFJ.js → chunk-BI45HZWM.js} +2 -2
- package/js/{chunk-DXGWKNTQ.js → chunk-BI6R577B.js} +2 -2
- package/js/{chunk-QUEPZ67T.js → chunk-BKJDZYK7.js} +3 -3
- package/js/{chunk-QZD2RZ4S.js → chunk-CZLCA2O4.js} +8 -8
- package/js/{chunk-IU6OK5G2.js → chunk-ENJCQWVF.js} +3 -3
- package/js/{chunk-DASNNAP4.js → chunk-HDAQBRT5.js} +391 -14
- package/js/{chunk-EXGKN554.js → chunk-IJQ5LE74.js} +9805 -9254
- package/js/{chunk-5JVNM3CQ.js → chunk-IU7CCCUC.js} +12 -12
- package/js/{chunk-Q7Q5JTRW.js → chunk-JU7F4PRK.js} +2 -2
- package/js/{chunk-CJY5X26R.js → chunk-KOOJUMLR.js} +86 -50
- package/js/{chunk-ETLILMHY.js → chunk-KZFV3WCJ.js} +21 -19
- package/js/{chunk-ZOY7PDMI.js → chunk-NHCFIWN5.js} +1 -1
- package/js/chunk-NHUHTWAF.js +0 -0
- package/js/{chunk-QYM4STZW.js → chunk-PHO7HXTC.js} +149 -353
- package/js/{chunk-O3OAFU7Q.js → chunk-POOIHRPF.js} +2 -2
- package/js/{chunk-AUFVX4KM.js → chunk-RSNZDT4L.js} +2 -2
- package/js/{chunk-EPUWF4ZG.js → chunk-SRB2WDU7.js} +3 -3
- package/js/{chunk-MFHUR5SB.js → chunk-TADLIUEU.js} +4 -4
- package/js/{chunk-5OM6HBNU.js → chunk-UBAKWXAJ.js} +20 -29
- package/js/chunk-V5DWGYRK.js +268 -0
- package/js/{chunk-MYH3QZ4L.js → chunk-WAGGHNWH.js} +23 -15
- package/js/{chunk-GZ4UHXRT.js → chunk-WDBUOIWV.js} +3 -3
- package/js/{chunk-PUBNIORL.js → chunk-WMVTBHGK.js} +2 -2
- package/js/{chunk-DSUKW6KJ.js → chunk-XEXUHXC3.js} +296 -174
- package/js/{chunk-6KG4DZD7.js → chunk-Y3XN4X4Q.js} +1 -1
- package/js/{chunk-UKMIHP2G.js → chunk-YW333DH3.js} +4 -4
- package/js/{chunk-O4QOPXQT.js → chunk-ZQWDOHEO.js} +31 -24
- package/js/client.js +12 -11
- package/js/contracts.js +14 -11
- package/js/effect.js +23 -21
- package/js/graphql.js +25 -23
- package/js/host.js +23 -21
- package/js/index.js +16 -14
- package/js/mcp/effect.js +25 -23
- package/js/mcp/stdio.js +25 -23
- package/js/mcp.js +27 -25
- package/js/openapi.js +22 -21
- package/js/react.js +3 -3
- package/js/skills/effect.js +6 -5
- package/js/skills.js +60 -45
- package/js/storage/facet.js +19 -345
- package/js/ui/auth/contracts.js +2 -2
- package/js/ui/auth.js +5 -5
- package/js/ui/contracts.js +6 -5
- package/js/ui/serving.js +10 -9
- package/package.json +3 -3
- package/runtime.json +1 -1
- package/types/app-data/src/implementation/sqlite.d.ts +1 -1
- package/types/apps/src/contracts/elicitation.d.ts +6 -6
- package/types/apps/src/contracts/host.d.ts +10 -6
- package/types/apps/src/contracts/mcp.d.ts +6 -1
- package/types/apps/src/contracts/openapi.d.ts +1 -1
- package/types/apps/src/contracts/protocol-version.d.ts +2 -2
- package/types/apps/src/contracts/protocols/1.d.ts +12 -5
- package/types/apps/src/contracts/protocols/2.d.ts +5 -5
- package/types/apps/src/contracts/protocols/3.d.ts +5 -6
- package/types/apps/src/contracts/protocols/4.d.ts +5 -6
- package/types/apps/src/contracts/protocols/5.d.ts +7 -7
- package/types/apps/src/contracts/protocols/6.d.ts +7 -7
- package/types/apps/src/contracts/protocols/7.d.ts +7 -7
- package/types/apps/src/contracts/protocols/8.d.ts +17 -6
- package/types/apps/src/contracts/protocols/9.d.ts +1106 -0
- package/types/apps/src/contracts/skills.d.ts +5 -0
- package/types/apps/src/contracts/ui.d.ts +1 -1
- package/types/apps/src/implementation/failure-detail.d.ts +4 -3
- package/types/apps/src/implementation/live.d.ts +2 -2
- package/types/apps/src/implementation/mcp-client.d.ts +1 -1
- package/types/apps/src/implementation/mcp.d.ts +1 -1
- package/types/apps/src/implementation/network.d.ts +1 -1
- package/types/apps/src/implementation/openapi-compile.d.ts +1 -1
- package/types/apps/src/implementation/optimistic.d.ts +1 -1
- package/types/apps/src/implementation/query-commit.d.ts +1 -1
- package/types/apps/src/implementation/router-catalog.d.ts +2 -3
- package/types/apps/src/implementation/skills.d.ts +8 -8
- package/types/apps/src/implementation/ui-auth.d.ts +1 -1
- package/types/apps/src/implementation/ui-client.d.ts +1 -1
- package/types/apps/src/implementation/ui-serving.d.ts +1 -1
- package/types/apps/src/react.d.ts +1 -1
- package/types/apps/src/skills.d.ts +2 -1
- package/types/telemetry/src/browser-operations.d.ts +1 -1
- package/types/telemetry/src/browser.d.ts +2 -2
- package/types/telemetry/src/layer.d.ts +2 -2
- package/types/telemetry/src/relay.d.ts +2 -2
- package/types/telemetry/src/transport.d.ts +1 -1
- package/types/utils/src/api-error.d.ts +1 -1
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Schema_exports
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IJQ5LE74.js";
|
|
4
4
|
|
|
5
5
|
// src/contracts/schema.ts
|
|
6
6
|
var JsonValue = Schema_exports.Json;
|
|
7
7
|
var JsonObject = Schema_exports.Record(Schema_exports.String, JsonValue);
|
|
8
8
|
var AccountId = Schema_exports.String.pipe(
|
|
9
|
-
Schema_exports.check(Schema_exports.
|
|
9
|
+
Schema_exports.check(Schema_exports.isStartingWith("acc_"), Schema_exports.isMinLength(5)),
|
|
10
10
|
Schema_exports.brand("acc")
|
|
11
11
|
);
|
|
12
12
|
var HttpUrl = Schema_exports.String.check(
|
|
@@ -3,15 +3,15 @@ import {
|
|
|
3
3
|
RouterKey,
|
|
4
4
|
RouterMeta,
|
|
5
5
|
reservedRouterKeys
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XEXUHXC3.js";
|
|
7
7
|
import {
|
|
8
8
|
decoderOf,
|
|
9
9
|
schemaArgument
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-POOIHRPF.js";
|
|
11
11
|
import {
|
|
12
12
|
Effect_exports,
|
|
13
13
|
Schema_exports
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-IJQ5LE74.js";
|
|
15
15
|
|
|
16
16
|
// src/implementation/authoring.ts
|
|
17
17
|
var NativeCallback = /* @__PURE__ */ Symbol("apps.NativeCallback");
|
|
@@ -1,34 +1,34 @@
|
|
|
1
1
|
import {
|
|
2
2
|
promiseTable
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-IU7CCCUC.js";
|
|
4
4
|
import {
|
|
5
5
|
declaredOperations,
|
|
6
6
|
fromPromise,
|
|
7
7
|
nativeOperation,
|
|
8
8
|
nativeRouter
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-BKJDZYK7.js";
|
|
10
10
|
import {
|
|
11
11
|
ScheduleTiming
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-XEXUHXC3.js";
|
|
13
13
|
import {
|
|
14
14
|
DatabaseSchema
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-73AV3JVU.js";
|
|
16
16
|
import {
|
|
17
17
|
decoderOf,
|
|
18
18
|
isSchema,
|
|
19
19
|
schemaArgument,
|
|
20
20
|
storageFieldOf
|
|
21
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-POOIHRPF.js";
|
|
22
22
|
import {
|
|
23
23
|
AppStorageUnavailable
|
|
24
|
-
} from "./chunk-
|
|
24
|
+
} from "./chunk-Y3XN4X4Q.js";
|
|
25
25
|
import {
|
|
26
26
|
JsonValue
|
|
27
|
-
} from "./chunk-
|
|
27
|
+
} from "./chunk-BI45HZWM.js";
|
|
28
28
|
import {
|
|
29
29
|
Effect_exports,
|
|
30
30
|
Schema_exports
|
|
31
|
-
} from "./chunk-
|
|
31
|
+
} from "./chunk-IJQ5LE74.js";
|
|
32
32
|
|
|
33
33
|
// src/contracts/http.ts
|
|
34
34
|
var ResponseStatusError = class extends Schema_exports.TaggedError()(
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ProviderError,
|
|
3
3
|
maxUpstreamMessageLength
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-BI6R577B.js";
|
|
5
5
|
import {
|
|
6
6
|
AccountId
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-BI45HZWM.js";
|
|
8
8
|
import {
|
|
9
9
|
Option_exports,
|
|
10
10
|
Schema_exports
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-IJQ5LE74.js";
|
|
12
12
|
|
|
13
13
|
// src/implementation/upstream-error.ts
|
|
14
14
|
var ErrorToken = Schema_exports.String.check(Schema_exports.isPattern(/^[A-Za-z0-9._-]{1,128}$/));
|
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Clock,
|
|
3
|
+
Defect,
|
|
3
4
|
ParentSpan,
|
|
4
5
|
Prototype,
|
|
5
6
|
Reference,
|
|
6
7
|
Scope,
|
|
7
8
|
Service,
|
|
9
|
+
String as String2,
|
|
10
|
+
TaggedError2 as TaggedError,
|
|
8
11
|
TracerTimingEnabled,
|
|
12
|
+
Union,
|
|
9
13
|
add,
|
|
10
14
|
addFinalizer,
|
|
15
|
+
andThen,
|
|
11
16
|
assignProperty,
|
|
12
17
|
close,
|
|
13
18
|
constUndefined,
|
|
@@ -16,6 +21,7 @@ import {
|
|
|
16
21
|
dual,
|
|
17
22
|
effect,
|
|
18
23
|
endSpan,
|
|
24
|
+
failCause,
|
|
19
25
|
failCauseUnsafe,
|
|
20
26
|
flatMap2 as flatMap,
|
|
21
27
|
flow,
|
|
@@ -31,15 +37,17 @@ import {
|
|
|
31
37
|
identity,
|
|
32
38
|
isSuccess2 as isSuccess,
|
|
33
39
|
make3 as make,
|
|
34
|
-
|
|
40
|
+
make5 as make2,
|
|
35
41
|
makeSpanScoped,
|
|
36
42
|
makeSpanUnsafe,
|
|
37
43
|
makeUnsafe3 as makeUnsafe,
|
|
38
44
|
map3 as map,
|
|
39
45
|
match,
|
|
40
46
|
offerUnsafe,
|
|
47
|
+
onError,
|
|
41
48
|
onExit,
|
|
42
49
|
onExitPrimitive,
|
|
50
|
+
optional,
|
|
43
51
|
orDie,
|
|
44
52
|
provide,
|
|
45
53
|
provideContext,
|
|
@@ -58,9 +66,9 @@ import {
|
|
|
58
66
|
useSpan,
|
|
59
67
|
void_2 as void_,
|
|
60
68
|
withFiber
|
|
61
|
-
} from "./chunk-
|
|
69
|
+
} from "./chunk-IJQ5LE74.js";
|
|
62
70
|
|
|
63
|
-
// ../../node_modules/.bun/effect@
|
|
71
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/reactivity/Reactivity.js
|
|
64
72
|
var TypeId = "~effect/reactivity/Reactivity";
|
|
65
73
|
var Reactivity = /* @__PURE__ */ Service("effect/reactivity/Reactivity");
|
|
66
74
|
var make3 = /* @__PURE__ */ sync(() => {
|
|
@@ -108,9 +116,9 @@ var make3 = /* @__PURE__ */ sync(() => {
|
|
|
108
116
|
};
|
|
109
117
|
const query = (keys, effect2) => gen(function* () {
|
|
110
118
|
const services = yield* context();
|
|
111
|
-
const
|
|
119
|
+
const scope2 = get(services, Scope);
|
|
112
120
|
const results = yield* make2();
|
|
113
|
-
const runFork = flow(runForkWith(services), runIn(
|
|
121
|
+
const runFork = flow(runForkWith(services), runIn(scope2));
|
|
114
122
|
let running = false;
|
|
115
123
|
let pending = false;
|
|
116
124
|
const handleExit = (exit) => {
|
|
@@ -135,7 +143,7 @@ var make3 = /* @__PURE__ */ sync(() => {
|
|
|
135
143
|
runFork(effect2).addObserver(handleExit);
|
|
136
144
|
}
|
|
137
145
|
const cancel = registerUnsafe(keys, run);
|
|
138
|
-
yield* addFinalizer(
|
|
146
|
+
yield* addFinalizer(scope2, sync(cancel));
|
|
139
147
|
run();
|
|
140
148
|
return results;
|
|
141
149
|
});
|
|
@@ -193,7 +201,363 @@ var keysToHashes = (keys, f) => {
|
|
|
193
201
|
}
|
|
194
202
|
};
|
|
195
203
|
|
|
196
|
-
// ../../node_modules/.bun/effect@
|
|
204
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/sql/SqlError.js
|
|
205
|
+
var TypeId2 = "~effect/sql/SqlError";
|
|
206
|
+
var ReasonTypeId = "~effect/sql/SqlError/Reason";
|
|
207
|
+
var ReasonFields = {
|
|
208
|
+
cause: /* @__PURE__ */ Defect(),
|
|
209
|
+
message: /* @__PURE__ */ optional(String2),
|
|
210
|
+
operation: /* @__PURE__ */ optional(String2)
|
|
211
|
+
};
|
|
212
|
+
var ConnectionError = class extends (/* @__PURE__ */ TaggedError("effect/sql/SqlError/ConnectionError")("ConnectionError", ReasonFields)) {
|
|
213
|
+
/**
|
|
214
|
+
* Marks this value as a structured SQL error reason for runtime guards.
|
|
215
|
+
*
|
|
216
|
+
* @stability unstable
|
|
217
|
+
* @since 4.0.0
|
|
218
|
+
*/
|
|
219
|
+
[ReasonTypeId] = ReasonTypeId;
|
|
220
|
+
/**
|
|
221
|
+
* Indicates whether retrying the failed SQL operation may succeed.
|
|
222
|
+
*
|
|
223
|
+
* @stability unstable
|
|
224
|
+
* @since 4.0.0
|
|
225
|
+
*/
|
|
226
|
+
get isRetryable() {
|
|
227
|
+
return true;
|
|
228
|
+
}
|
|
229
|
+
};
|
|
230
|
+
var AuthenticationError = class extends (/* @__PURE__ */ TaggedError("effect/sql/SqlError/AuthenticationError")("AuthenticationError", ReasonFields)) {
|
|
231
|
+
/**
|
|
232
|
+
* Marks this value as a structured SQL error reason for runtime guards.
|
|
233
|
+
*
|
|
234
|
+
* @stability unstable
|
|
235
|
+
* @since 4.0.0
|
|
236
|
+
*/
|
|
237
|
+
[ReasonTypeId] = ReasonTypeId;
|
|
238
|
+
/**
|
|
239
|
+
* Indicates whether retrying the failed SQL operation may succeed.
|
|
240
|
+
*
|
|
241
|
+
* @stability unstable
|
|
242
|
+
* @since 4.0.0
|
|
243
|
+
*/
|
|
244
|
+
get isRetryable() {
|
|
245
|
+
return false;
|
|
246
|
+
}
|
|
247
|
+
};
|
|
248
|
+
var AuthorizationError = class extends (/* @__PURE__ */ TaggedError("effect/sql/SqlError/AuthorizationError")("AuthorizationError", ReasonFields)) {
|
|
249
|
+
/**
|
|
250
|
+
* Marks this value as a structured SQL error reason for runtime guards.
|
|
251
|
+
*
|
|
252
|
+
* @stability unstable
|
|
253
|
+
* @since 4.0.0
|
|
254
|
+
*/
|
|
255
|
+
[ReasonTypeId] = ReasonTypeId;
|
|
256
|
+
/**
|
|
257
|
+
* Indicates whether retrying the failed SQL operation may succeed.
|
|
258
|
+
*
|
|
259
|
+
* @stability unstable
|
|
260
|
+
* @since 4.0.0
|
|
261
|
+
*/
|
|
262
|
+
get isRetryable() {
|
|
263
|
+
return false;
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
var SqlSyntaxError = class extends (/* @__PURE__ */ TaggedError("effect/sql/SqlError/SqlSyntaxError")("SqlSyntaxError", ReasonFields)) {
|
|
267
|
+
/**
|
|
268
|
+
* Marks this value as a structured SQL error reason for runtime guards.
|
|
269
|
+
*
|
|
270
|
+
* @stability unstable
|
|
271
|
+
* @since 4.0.0
|
|
272
|
+
*/
|
|
273
|
+
[ReasonTypeId] = ReasonTypeId;
|
|
274
|
+
/**
|
|
275
|
+
* Indicates whether retrying the failed SQL operation may succeed.
|
|
276
|
+
*
|
|
277
|
+
* @stability unstable
|
|
278
|
+
* @since 4.0.0
|
|
279
|
+
*/
|
|
280
|
+
get isRetryable() {
|
|
281
|
+
return false;
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
var UniqueViolationFields = {
|
|
285
|
+
...ReasonFields,
|
|
286
|
+
constraint: String2
|
|
287
|
+
};
|
|
288
|
+
var UniqueViolation = class extends (/* @__PURE__ */ TaggedError("effect/sql/SqlError/UniqueViolation")("UniqueViolation", UniqueViolationFields)) {
|
|
289
|
+
/**
|
|
290
|
+
* Marks this value as a structured SQL error reason for runtime guards.
|
|
291
|
+
*
|
|
292
|
+
* @stability unstable
|
|
293
|
+
* @since 4.0.0
|
|
294
|
+
*/
|
|
295
|
+
[ReasonTypeId] = ReasonTypeId;
|
|
296
|
+
/**
|
|
297
|
+
* Indicates whether retrying the failed SQL operation may succeed.
|
|
298
|
+
*
|
|
299
|
+
* @stability unstable
|
|
300
|
+
* @since 4.0.0
|
|
301
|
+
*/
|
|
302
|
+
get isRetryable() {
|
|
303
|
+
return false;
|
|
304
|
+
}
|
|
305
|
+
};
|
|
306
|
+
var ConstraintError = class extends (/* @__PURE__ */ TaggedError("effect/sql/SqlError/ConstraintError")("ConstraintError", ReasonFields)) {
|
|
307
|
+
/**
|
|
308
|
+
* Marks this value as a structured SQL error reason for runtime guards.
|
|
309
|
+
*
|
|
310
|
+
* @stability unstable
|
|
311
|
+
* @since 4.0.0
|
|
312
|
+
*/
|
|
313
|
+
[ReasonTypeId] = ReasonTypeId;
|
|
314
|
+
/**
|
|
315
|
+
* Indicates whether retrying the failed SQL operation may succeed.
|
|
316
|
+
*
|
|
317
|
+
* @stability unstable
|
|
318
|
+
* @since 4.0.0
|
|
319
|
+
*/
|
|
320
|
+
get isRetryable() {
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
var DeadlockError = class extends (/* @__PURE__ */ TaggedError("effect/sql/SqlError/DeadlockError")("DeadlockError", ReasonFields)) {
|
|
325
|
+
/**
|
|
326
|
+
* Marks this value as a structured SQL error reason for runtime guards.
|
|
327
|
+
*
|
|
328
|
+
* @stability unstable
|
|
329
|
+
* @since 4.0.0
|
|
330
|
+
*/
|
|
331
|
+
[ReasonTypeId] = ReasonTypeId;
|
|
332
|
+
/**
|
|
333
|
+
* Indicates whether retrying the failed SQL operation may succeed.
|
|
334
|
+
*
|
|
335
|
+
* @stability unstable
|
|
336
|
+
* @since 4.0.0
|
|
337
|
+
*/
|
|
338
|
+
get isRetryable() {
|
|
339
|
+
return true;
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
var SerializationError = class extends (/* @__PURE__ */ TaggedError("effect/sql/SqlError/SerializationError")("SerializationError", ReasonFields)) {
|
|
343
|
+
/**
|
|
344
|
+
* Marks this value as a structured SQL error reason for runtime guards.
|
|
345
|
+
*
|
|
346
|
+
* @stability unstable
|
|
347
|
+
* @since 4.0.0
|
|
348
|
+
*/
|
|
349
|
+
[ReasonTypeId] = ReasonTypeId;
|
|
350
|
+
/**
|
|
351
|
+
* Indicates whether retrying the failed SQL operation may succeed.
|
|
352
|
+
*
|
|
353
|
+
* @stability unstable
|
|
354
|
+
* @since 4.0.0
|
|
355
|
+
*/
|
|
356
|
+
get isRetryable() {
|
|
357
|
+
return true;
|
|
358
|
+
}
|
|
359
|
+
};
|
|
360
|
+
var LockTimeoutError = class extends (/* @__PURE__ */ TaggedError("effect/sql/SqlError/LockTimeoutError")("LockTimeoutError", ReasonFields)) {
|
|
361
|
+
/**
|
|
362
|
+
* Marks this value as a structured SQL error reason for runtime guards.
|
|
363
|
+
*
|
|
364
|
+
* @stability unstable
|
|
365
|
+
* @since 4.0.0
|
|
366
|
+
*/
|
|
367
|
+
[ReasonTypeId] = ReasonTypeId;
|
|
368
|
+
/**
|
|
369
|
+
* Indicates whether retrying the failed SQL operation may succeed.
|
|
370
|
+
*
|
|
371
|
+
* @stability unstable
|
|
372
|
+
* @since 4.0.0
|
|
373
|
+
*/
|
|
374
|
+
get isRetryable() {
|
|
375
|
+
return true;
|
|
376
|
+
}
|
|
377
|
+
};
|
|
378
|
+
var StatementTimeoutError = class extends (/* @__PURE__ */ TaggedError("effect/sql/SqlError/StatementTimeoutError")("StatementTimeoutError", ReasonFields)) {
|
|
379
|
+
/**
|
|
380
|
+
* Marks this value as a structured SQL error reason for runtime guards.
|
|
381
|
+
*
|
|
382
|
+
* @stability unstable
|
|
383
|
+
* @since 4.0.0
|
|
384
|
+
*/
|
|
385
|
+
[ReasonTypeId] = ReasonTypeId;
|
|
386
|
+
/**
|
|
387
|
+
* Indicates whether retrying the failed SQL operation may succeed.
|
|
388
|
+
*
|
|
389
|
+
* @stability unstable
|
|
390
|
+
* @since 4.0.0
|
|
391
|
+
*/
|
|
392
|
+
get isRetryable() {
|
|
393
|
+
return true;
|
|
394
|
+
}
|
|
395
|
+
};
|
|
396
|
+
var UnknownError = class extends (/* @__PURE__ */ TaggedError("effect/sql/SqlError/UnknownError")("UnknownError", ReasonFields)) {
|
|
397
|
+
/**
|
|
398
|
+
* Marks this value as a structured SQL error reason for runtime guards.
|
|
399
|
+
*
|
|
400
|
+
* @stability unstable
|
|
401
|
+
* @since 4.0.0
|
|
402
|
+
*/
|
|
403
|
+
[ReasonTypeId] = ReasonTypeId;
|
|
404
|
+
/**
|
|
405
|
+
* Indicates whether retrying the failed SQL operation may succeed.
|
|
406
|
+
*
|
|
407
|
+
* @stability unstable
|
|
408
|
+
* @since 4.0.0
|
|
409
|
+
*/
|
|
410
|
+
get isRetryable() {
|
|
411
|
+
return false;
|
|
412
|
+
}
|
|
413
|
+
};
|
|
414
|
+
var SqlErrorReason = /* @__PURE__ */ Union([ConnectionError, AuthenticationError, AuthorizationError, SqlSyntaxError, UniqueViolation, ConstraintError, DeadlockError, SerializationError, LockTimeoutError, StatementTimeoutError, UnknownError]);
|
|
415
|
+
var SqlError = class extends (/* @__PURE__ */ TaggedError("effect/sql/SqlError")("SqlError", {
|
|
416
|
+
reason: SqlErrorReason
|
|
417
|
+
})) {
|
|
418
|
+
/**
|
|
419
|
+
* Marks this value as the top-level SQL error wrapper for runtime guards.
|
|
420
|
+
*
|
|
421
|
+
* @stability unstable
|
|
422
|
+
* @since 4.0.0
|
|
423
|
+
*/
|
|
424
|
+
[TypeId2] = TypeId2;
|
|
425
|
+
/**
|
|
426
|
+
* Exposes the structured SQL reason as the JavaScript error cause.
|
|
427
|
+
*
|
|
428
|
+
* @stability unstable
|
|
429
|
+
* @since 4.0.0
|
|
430
|
+
*/
|
|
431
|
+
cause = this.reason;
|
|
432
|
+
/**
|
|
433
|
+
* Uses the reason message when present, otherwise falls back to the reason tag.
|
|
434
|
+
*
|
|
435
|
+
* @stability unstable
|
|
436
|
+
* @since 4.0.0
|
|
437
|
+
*/
|
|
438
|
+
get message() {
|
|
439
|
+
return this.reason.message || this.reason._tag;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Delegates retryability to the underlying SQL error reason.
|
|
443
|
+
*
|
|
444
|
+
* @stability unstable
|
|
445
|
+
* @since 4.0.0
|
|
446
|
+
*/
|
|
447
|
+
get isRetryable() {
|
|
448
|
+
return this.reason.isRetryable;
|
|
449
|
+
}
|
|
450
|
+
};
|
|
451
|
+
var sqliteCodeFromCause = (cause) => {
|
|
452
|
+
if (!hasProperty(cause, "code")) {
|
|
453
|
+
return void 0;
|
|
454
|
+
}
|
|
455
|
+
const code = cause.code;
|
|
456
|
+
return typeof code === "string" || typeof code === "number" ? code : void 0;
|
|
457
|
+
};
|
|
458
|
+
var sqliteNumericCodeFromCause = (cause) => {
|
|
459
|
+
const code = sqliteCodeFromCause(cause);
|
|
460
|
+
if (typeof code === "number") {
|
|
461
|
+
return code;
|
|
462
|
+
}
|
|
463
|
+
if (!hasProperty(cause, "errno")) {
|
|
464
|
+
return void 0;
|
|
465
|
+
}
|
|
466
|
+
const errno = cause.errno;
|
|
467
|
+
return typeof errno === "number" ? errno : void 0;
|
|
468
|
+
};
|
|
469
|
+
var matchesSqliteNumericCode = (cause, expected) => {
|
|
470
|
+
const code = sqliteCodeFromCause(cause);
|
|
471
|
+
if (code === expected) {
|
|
472
|
+
return true;
|
|
473
|
+
}
|
|
474
|
+
if (!hasProperty(cause, "errno")) {
|
|
475
|
+
return false;
|
|
476
|
+
}
|
|
477
|
+
return cause.errno === expected;
|
|
478
|
+
};
|
|
479
|
+
var matchesSqliteCode = (code, expected) => code === expected || code.startsWith(expected + "_");
|
|
480
|
+
var UNKNOWN_CONSTRAINT = "unknown";
|
|
481
|
+
var SQLITE_CONSTRAINT_UNIQUE = "SQLITE_CONSTRAINT_UNIQUE";
|
|
482
|
+
var SQLITE_CONSTRAINT_UNIQUE_CODE = 2067;
|
|
483
|
+
var normalizeConstraintIdentifier = (identifier2) => {
|
|
484
|
+
if (typeof identifier2 !== "string") {
|
|
485
|
+
return UNKNOWN_CONSTRAINT;
|
|
486
|
+
}
|
|
487
|
+
const trimmed = identifier2.trim();
|
|
488
|
+
return trimmed.length === 0 ? UNKNOWN_CONSTRAINT : trimmed;
|
|
489
|
+
};
|
|
490
|
+
var sqliteUniqueConstraintFromCause = (cause) => {
|
|
491
|
+
if (hasProperty(cause, "constraint")) {
|
|
492
|
+
return normalizeConstraintIdentifier(cause.constraint);
|
|
493
|
+
}
|
|
494
|
+
if (!hasProperty(cause, "message")) {
|
|
495
|
+
return UNKNOWN_CONSTRAINT;
|
|
496
|
+
}
|
|
497
|
+
const message = cause.message;
|
|
498
|
+
if (typeof message !== "string") {
|
|
499
|
+
return UNKNOWN_CONSTRAINT;
|
|
500
|
+
}
|
|
501
|
+
const prefix = "UNIQUE constraint failed:";
|
|
502
|
+
const index = message.indexOf(prefix);
|
|
503
|
+
return index === -1 ? UNKNOWN_CONSTRAINT : normalizeConstraintIdentifier(message.slice(index + prefix.length));
|
|
504
|
+
};
|
|
505
|
+
var classifySqliteError = (cause, {
|
|
506
|
+
message,
|
|
507
|
+
operation
|
|
508
|
+
} = {}) => {
|
|
509
|
+
const props = {
|
|
510
|
+
cause,
|
|
511
|
+
message,
|
|
512
|
+
operation
|
|
513
|
+
};
|
|
514
|
+
const code = sqliteCodeFromCause(cause);
|
|
515
|
+
const numericCode = sqliteNumericCodeFromCause(cause);
|
|
516
|
+
if (code === SQLITE_CONSTRAINT_UNIQUE || matchesSqliteNumericCode(cause, SQLITE_CONSTRAINT_UNIQUE_CODE)) {
|
|
517
|
+
return new UniqueViolation({
|
|
518
|
+
...props,
|
|
519
|
+
constraint: sqliteUniqueConstraintFromCause(cause)
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
if (typeof code === "string") {
|
|
523
|
+
if (matchesSqliteCode(code, "SQLITE_AUTH")) {
|
|
524
|
+
return new AuthenticationError(props);
|
|
525
|
+
}
|
|
526
|
+
if (matchesSqliteCode(code, "SQLITE_PERM")) {
|
|
527
|
+
return new AuthorizationError(props);
|
|
528
|
+
}
|
|
529
|
+
if (matchesSqliteCode(code, "SQLITE_CONSTRAINT")) {
|
|
530
|
+
return new ConstraintError(props);
|
|
531
|
+
}
|
|
532
|
+
if (matchesSqliteCode(code, "SQLITE_BUSY") || matchesSqliteCode(code, "SQLITE_LOCKED")) {
|
|
533
|
+
return new LockTimeoutError(props);
|
|
534
|
+
}
|
|
535
|
+
if (matchesSqliteCode(code, "SQLITE_CANTOPEN")) {
|
|
536
|
+
return new ConnectionError(props);
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (typeof numericCode === "number") {
|
|
540
|
+
const code2 = numericCode & 255;
|
|
541
|
+
switch (code2) {
|
|
542
|
+
case 23:
|
|
543
|
+
return new AuthenticationError(props);
|
|
544
|
+
case 3:
|
|
545
|
+
return new AuthorizationError(props);
|
|
546
|
+
case 19:
|
|
547
|
+
return new ConstraintError(props);
|
|
548
|
+
case 5:
|
|
549
|
+
case 6:
|
|
550
|
+
return new LockTimeoutError(props);
|
|
551
|
+
case 14:
|
|
552
|
+
return new ConnectionError(props);
|
|
553
|
+
default:
|
|
554
|
+
return new UnknownError(props);
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
return new UnknownError(props);
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/sql/Statement.js
|
|
197
561
|
var FragmentTypeId = "~effect/sql/Statement/Fragment";
|
|
198
562
|
var fragment = (segments) => ({
|
|
199
563
|
[FragmentTypeId]: FragmentTypeId,
|
|
@@ -773,8 +1137,8 @@ function in_() {
|
|
|
773
1137
|
}
|
|
774
1138
|
var neverFragment = /* @__PURE__ */ fragment([/* @__PURE__ */ literal("1=0")]);
|
|
775
1139
|
|
|
776
|
-
// ../../node_modules/.bun/effect@
|
|
777
|
-
var
|
|
1140
|
+
// ../../node_modules/.bun/effect@4.0.1/node_modules/effect/dist/sql/SqlClient.js
|
|
1141
|
+
var TypeId3 = "~effect/sql/SqlClient";
|
|
778
1142
|
var SqlClient = /* @__PURE__ */ Service("effect/sql/SqlClient");
|
|
779
1143
|
var clientIdCounter = 0;
|
|
780
1144
|
var transactionSemaphoreIdCounter = 0;
|
|
@@ -787,6 +1151,7 @@ var make5 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
787
1151
|
const beginTransaction = options.beginTransaction ?? "BEGIN";
|
|
788
1152
|
const commit = options.commit ?? "COMMIT";
|
|
789
1153
|
const savepoint = options.savepoint ?? ((name) => `SAVEPOINT ${name}`);
|
|
1154
|
+
const releaseSavepoint = options.releaseSavepoint;
|
|
790
1155
|
const rollback = options.rollback ?? "ROLLBACK";
|
|
791
1156
|
const rollbackSavepoint = options.rollbackSavepoint ?? ((name) => `ROLLBACK TO SAVEPOINT ${name}`);
|
|
792
1157
|
const transactionAcquirer = options.transactionAcquirer ?? options.acquirer;
|
|
@@ -794,10 +1159,12 @@ var make5 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
794
1159
|
const withTransaction = makeWithTransaction({
|
|
795
1160
|
transactionService,
|
|
796
1161
|
spanAttributes: options.spanAttributes,
|
|
797
|
-
acquireConnection: flatMap(make(), (
|
|
1162
|
+
acquireConnection: flatMap(make(), (scope2) => provide(transactionAcquirer, scope2).pipe(onError((cause) => close(scope2, failCause(cause))), map((conn) => [scope2, conn]))),
|
|
798
1163
|
begin: (conn) => control(conn, beginTransaction),
|
|
799
1164
|
savepoint: (conn, id) => control(conn, savepoint(`effect_sql_${id}`)),
|
|
800
|
-
|
|
1165
|
+
releaseSavepoint: releaseSavepoint ? (conn, id) => control(conn, releaseSavepoint(`effect_sql_${id}`)) : void 0,
|
|
1166
|
+
commit: typeof commit === "string" ? (conn) => control(conn, commit) : commit,
|
|
1167
|
+
onCommitFailure: options.onCommitFailure,
|
|
801
1168
|
rollback: (conn) => control(conn, rollback),
|
|
802
1169
|
rollbackSavepoint: (conn, id) => control(conn, rollbackSavepoint(`effect_sql_${id}`))
|
|
803
1170
|
});
|
|
@@ -807,7 +1174,7 @@ var make5 = /* @__PURE__ */ fnUntraced(function* (options) {
|
|
|
807
1174
|
onSome: ([conn]) => f(conn)
|
|
808
1175
|
}));
|
|
809
1176
|
const client = Object.assign(make4(getConnection, options.compiler, options.spanAttributes, options.transformRows, borrower), {
|
|
810
|
-
[
|
|
1177
|
+
[TypeId3]: TypeId3,
|
|
811
1178
|
safe: void 0,
|
|
812
1179
|
withTransaction,
|
|
813
1180
|
transactionService,
|
|
@@ -844,12 +1211,16 @@ var makeWithTransaction = (options) => {
|
|
|
844
1211
|
const connOption = getOption(services, options.transactionService);
|
|
845
1212
|
const conn = connOption._tag === "Some" ? succeed([void 0, connOption.value[0]]) : options.acquireConnection;
|
|
846
1213
|
const id = connOption._tag === "Some" ? connOption.value[1] + 1 : 0;
|
|
847
|
-
const transaction = flatMap(conn, ([
|
|
1214
|
+
const transaction = flatMap(conn, ([scope2, conn2]) => (id === 0 ? options.begin(conn2) : options.savepoint(conn2, id)).pipe(flatMap(() => onExitPrimitive(provideContext(restore(effect2), services.pipe(add(options.transactionService, [conn2, id]), add(transactionSemaphore, makeUnsafe(1)), add(ParentSpan, span))), (exit) => {
|
|
848
1215
|
let effect3;
|
|
849
1216
|
if (isSuccess(exit)) {
|
|
850
1217
|
if (id === 0) {
|
|
851
1218
|
span.event("db.transaction.commit", clock.currentTimeNanosUnsafe());
|
|
1219
|
+
const onCommitFailure = options.onCommitFailure;
|
|
852
1220
|
effect3 = orDie(options.commit(conn2));
|
|
1221
|
+
if (onCommitFailure) {
|
|
1222
|
+
effect3 = onError(effect3, () => orDie(onCommitFailure(conn2)));
|
|
1223
|
+
}
|
|
853
1224
|
} else {
|
|
854
1225
|
span.event("db.transaction.savepoint", clock.currentTimeNanosUnsafe());
|
|
855
1226
|
effect3 = void_;
|
|
@@ -858,8 +1229,11 @@ var makeWithTransaction = (options) => {
|
|
|
858
1229
|
span.event("db.transaction.rollback", clock.currentTimeNanosUnsafe());
|
|
859
1230
|
effect3 = orDie(id > 0 ? options.rollbackSavepoint(conn2, id) : options.rollback(conn2));
|
|
860
1231
|
}
|
|
1232
|
+
if (id > 0 && options.releaseSavepoint) {
|
|
1233
|
+
effect3 = andThen(effect3, orDie(options.releaseSavepoint(conn2, id)));
|
|
1234
|
+
}
|
|
861
1235
|
return flatMap(effect3, () => exit);
|
|
862
|
-
}, true)),
|
|
1236
|
+
}, true)), scope2 ? (eff) => onExitPrimitive(eff, (exit) => close(scope2, exit), true) : identity));
|
|
863
1237
|
return id === 0 ? transaction : getUnsafe(services, transactionSemaphore).withPermit(transaction);
|
|
864
1238
|
})));
|
|
865
1239
|
};
|
|
@@ -870,6 +1244,9 @@ export {
|
|
|
870
1244
|
mutation,
|
|
871
1245
|
invalidate,
|
|
872
1246
|
layer,
|
|
1247
|
+
UnknownError,
|
|
1248
|
+
SqlError,
|
|
1249
|
+
classifySqliteError,
|
|
873
1250
|
makeCompilerSqlite,
|
|
874
1251
|
defaultTransforms,
|
|
875
1252
|
SqlClient,
|