clanka 0.7.3 → 0.7.5
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/dist/Acp.d.ts +10 -0
- package/dist/Acp.d.ts.map +1 -1
- package/dist/Acp.js +1 -2
- package/dist/Acp.js.map +1 -1
- package/dist/AgentTools.d.ts.map +1 -1
- package/dist/AgentTools.js +1 -2
- package/dist/AgentTools.js.map +1 -1
- package/dist/GlobalWebSocket.d.ts +15 -0
- package/dist/GlobalWebSocket.d.ts.map +1 -0
- package/dist/GlobalWebSocket.js +26 -0
- package/dist/GlobalWebSocket.js.map +1 -0
- package/dist/WebToMarkdown.d.ts.map +1 -1
- package/dist/WebToMarkdown.js +8 -4
- package/dist/WebToMarkdown.js.map +1 -1
- package/dist/bin/Effect-DdkIoNCD.mjs +5058 -0
- package/dist/bin/Effect-DdkIoNCD.mjs.map +1 -0
- package/dist/bin/{McpClient-D6vFD-wP.mjs → McpClient-CJ0Vugoi.mjs} +582 -2896
- package/dist/bin/{McpClient-D6vFD-wP.mjs.map → McpClient-CJ0Vugoi.mjs.map} +1 -1
- package/dist/bin/OutputFormatter-DN8OGwuK.mjs +575 -0
- package/dist/bin/OutputFormatter-DN8OGwuK.mjs.map +1 -0
- package/dist/bin/Schema-BALIXGp7.mjs +5475 -0
- package/dist/bin/Schema-BALIXGp7.mjs.map +1 -0
- package/dist/bin/{SemanticSearch-D9iZ_Mi9.mjs → SemanticSearch-O6PZBRfd.mjs} +147 -1160
- package/dist/bin/{SemanticSearch-D9iZ_Mi9.mjs.map → SemanticSearch-O6PZBRfd.mjs.map} +1 -1
- package/dist/bin/Stream-B5ebASRi.mjs +2090 -0
- package/dist/bin/Stream-B5ebASRi.mjs.map +1 -0
- package/dist/bin/cli.mjs +9629 -41431
- package/dist/bin/cli.mjs.map +1 -1
- package/dist/bin/index.min-CI3qqohw.mjs +3300 -0
- package/dist/bin/index.min-CI3qqohw.mjs.map +1 -0
- package/dist/bin/turndown.cjs-usmCKZ4b.mjs +15195 -0
- package/dist/bin/turndown.cjs-usmCKZ4b.mjs.map +1 -0
- package/dist/cli.d.ts +1 -1
- package/dist/cli.js +10 -6
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +2 -4
- package/src/Acp.ts +1 -2
- package/src/AgentTools.ts +3 -2
- package/src/GlobalWebSocket.ts +40 -0
- package/src/WebToMarkdown.ts +17 -7
- package/src/cli.ts +15 -6
- package/src/index.ts +5 -0
- package/dist/bin/Schema-D6y3R-At.mjs +0 -28728
- package/dist/bin/Schema-D6y3R-At.mjs.map +0 -1
- package/dist/bin/Undici-ChB4UBDa.mjs +0 -28
- package/dist/bin/Undici-ChB4UBDa.mjs.map +0 -1
|
@@ -1,50 +1,18 @@
|
|
|
1
|
-
import { $
|
|
2
|
-
import {
|
|
1
|
+
import { $ as isEffect, $n as effect, $t as uninterruptibleMask, Aa as Reference, As as identity, B as fnUntraced, Bn as hasInterruptsOnly, Br as void_$3, C as catch_, Ca as minutes, Cr as TracerTimingEnabled, D as delay, Da as toMillis, Di as void_$2, E as contextWith, Ea as seconds, Ei as updateContext, Er as doneUnsafe, Et as provideService, F as filterOrFail, Fa as getOption, Fs as pipeArguments, Gi as flatMapNullishOr, Gt as tap, H as forEach, I as flatMap, Ia as getOrUndefined, Ii as TaggedError, In as filterInterruptors, It as scope, Ji as isArrayNonEmpty, Jo as symbol, K as forkScoped, Ki as fromIterable, Ko as byReferenceUnsafe, Lr as isFailure, Lt as scoped, M as fail$1, Ma as add, Mo as assignProperty, Mt as runFork, Nr as fail, Ns as pipe, Nt as runForkWith, O as die, Or as into, Os as dual, Pa as get$1, Pr as failCause, Ra as getUnsafe, Rr as isSuccess, S as catchTags, Sa as millis, So as Prototype, St as orElseSucceed, T as context, To as PipeInspectableProto, Tr as done, Ts as constUndefined, Tt as provideContext, U as forever, Ut as suspend, Va as merge, Vi as empty, Vr as ClockRef, Vt as succeed, Wa as filter, Wt as sync, X as ignore, Xr as endSpan, Xt as try_, Y as gen, Ya as fromNullishOr, Yt as tryPromise, Z as interrupt, Zo as hash, Zr as exitHasInterrupts, _a as fromInputUnsafe, _i as onExit$1, _t as onExit, ao as match, at as makeSpanScoped, ba as isFinite, br as provide, c as as, cr as provide$1, ea as map$2, eo as isNone, er as effectContext, et as logDebug, fn as Class$1, ft as matchCauseEager, gr as close, h as catchDefect, hi as makeSpanUnsafe, i as all, ia as sort, io as map$1, ja as Service, jo as withFiber$1, jr as makeUnsafe$2, ki as ParentSpan, kn as NoSuchElementError, ks as flow, kt as request$1, li as forkUnsafe, ln as withSpan, lo as some, lr as provideMerge, ls as isNotNull, lt as mapError, m as catchCause, mr as addFinalizer, n as acquireUseRelease, ni as fiberInterrupt, nn as useSpan, no as isSome, ns as hasProperty, o as annotateCurrentSpan, oi as fiberJoin, on as withFiber, oo as none, ot as map, po as Number$1, pr as Scope, qa as flatten, qo as equals, qr as contextWith$1, rn as void_$1, rt as logInfo, s as annotateLogs, sn as withLogSpan, t as acquireRelease, tr as effectDiscard, ts as symbol$1, u as asVoid, va as infinity, vo as make$10, vr as make$8, vt as onExitPrimitive, x as catchTag, xa as isZero, xi as succeed$1, xt as orDie, y as catchNoSuchElement, z as fn, za as make$9, zr as succeed$2, zt as serviceOption } from "./Effect-DdkIoNCD.mjs";
|
|
2
|
+
import { Ft as runIn, H as runDrain, Nt as interruptAs, Pt as join$1, Q as tap$1, V as runCollect, _ as fromArray, c as die$1, ct as makeUnsafe$3, et as unwrap, h as flatMap$1, ht as make$11, kt as getCurrent, mt as failCauseUnsafe, st as make$12, v as fromArrayEffect, w as fromQueue, yt as offerUnsafe, z as provideService$1 } from "./Stream-B5ebASRi.mjs";
|
|
3
|
+
import { A as Option, At as optionalKey, B as TaggedError$1, Ct as isSchema, D as NullOr, Dn as dateTimeUtcFromInput, En as transformOptional, Hn as Clock, I as String$1, In as now, It as toType, Kt as evolve, L as Struct$2, Ln as removeTime, Lt as withConstructorDefault, O as Number$2, Ot as mutable, Pn as formatIsoDate, Q as brand, S as Natural, Y as Union$2, c as DateTimeUtcFromDate, d as Defect, dt as instanceOf, i as BooleanFromBit, it as decodeUnknownEffect, j as OptionFromNullOr, kn as transform, kt as optional, l as DateTimeUtcFromMillis, n as ArraySchema, o as Class$2, r as Boolean, rt as decodeTo, s as DateTimeUtc, st as encodeEffect, u as DateTimeUtcFromString, wn as transform$1 } from "./Schema-BALIXGp7.mjs";
|
|
4
|
+
import { C as set, D as toPredicate, E as has, S as remove, T as compose, _ as empty$1, a as makeGrouped, b as isEmpty, c as SemanticSearch, d as map$3, f as make$14, g as FileSystem, h as Path, i as batchN, l as maybeRemoveFile, m as Console, n as EmbeddingModel, o as setDelay, p as ChildProcessSpawner, r as EmbeddingRequest, s as withSpan$1, t as Dimensions, u as maybeUpdateFile, v as forEach$1, w as size, x as make$13, y as get$2 } from "./cli.mjs";
|
|
3
5
|
import { createHash } from "node:crypto";
|
|
6
|
+
import { DatabaseSync, backup } from "node:sqlite";
|
|
4
7
|
import TreeSitter from "tree-sitter";
|
|
5
8
|
import TreeSitterJavaScript from "tree-sitter-javascript";
|
|
6
9
|
import TreeSitterTypeScript from "tree-sitter-typescript";
|
|
7
|
-
import { DatabaseSync, backup } from "node:sqlite";
|
|
8
10
|
import { getLoadablePath } from "sqlite-vec";
|
|
9
11
|
//#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/reactivity/Reactivity.js
|
|
10
|
-
/**
|
|
11
|
-
* Process-local invalidation for connecting writes to dependent reads.
|
|
12
|
-
*
|
|
13
|
-
* This module does not cache values itself. It lets callers register handlers
|
|
14
|
-
* for keys, invalidate those keys, wrap successful mutations so they invalidate
|
|
15
|
-
* keys, and expose effects as queues or streams that rerun when matching keys
|
|
16
|
-
* change. The service can also batch invalidations so handlers run after the
|
|
17
|
-
* batch completes.
|
|
18
|
-
*
|
|
19
|
-
* @since 4.0.0
|
|
20
|
-
*/
|
|
21
|
-
/**
|
|
22
|
-
* Brand for `Reactivity` implementations.
|
|
23
|
-
*
|
|
24
|
-
* @category type IDs
|
|
25
|
-
* @since 4.0.0
|
|
26
|
-
*/
|
|
27
12
|
const TypeId$6 = "~effect/reactivity/Reactivity";
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
* @category services
|
|
32
|
-
* @since 4.0.0
|
|
33
|
-
*/
|
|
34
|
-
const Reactivity = /*#__PURE__*/ Service("effect/reactivity/Reactivity");
|
|
35
|
-
/**
|
|
36
|
-
* Creates an in-memory `Reactivity` service.
|
|
37
|
-
*
|
|
38
|
-
* **Details**
|
|
39
|
-
*
|
|
40
|
-
* The service tracks handlers by hashed keys and runs the registered handlers when
|
|
41
|
-
* matching keys are invalidated.
|
|
42
|
-
*
|
|
43
|
-
* @category constructors
|
|
44
|
-
* @since 4.0.0
|
|
45
|
-
*/
|
|
46
|
-
const make$7 = /*#__PURE__*/ sync(() => {
|
|
47
|
-
const handlers = /* @__PURE__ */ new Map();
|
|
13
|
+
const Reactivity = Service("effect/reactivity/Reactivity");
|
|
14
|
+
const make$7 = sync(() => {
|
|
15
|
+
const handlers = new Map();
|
|
48
16
|
const invalidateUnsafe = (keys) => {
|
|
49
17
|
keysToHashes(keys, (hash) => {
|
|
50
18
|
const set = handlers.get(hash);
|
|
@@ -67,7 +35,7 @@ const make$7 = /*#__PURE__*/ sync(() => {
|
|
|
67
35
|
resolvedKeys.push(hash);
|
|
68
36
|
let set = handlers.get(hash);
|
|
69
37
|
if (set === void 0) {
|
|
70
|
-
set =
|
|
38
|
+
set = new Set();
|
|
71
39
|
handlers.set(hash, set);
|
|
72
40
|
}
|
|
73
41
|
set.add(handler);
|
|
@@ -111,7 +79,7 @@ const make$7 = /*#__PURE__*/ sync(() => {
|
|
|
111
79
|
});
|
|
112
80
|
const stream = (tables, effect) => query(tables, effect).pipe(map(fromQueue), unwrap);
|
|
113
81
|
const withBatch = (effect) => suspend(() => {
|
|
114
|
-
const pending =
|
|
82
|
+
const pending = new Set();
|
|
115
83
|
return effect.pipe(provideService(PendingInvalidation, pending), onExit((_) => sync(() => {
|
|
116
84
|
pending.forEach((hash) => {
|
|
117
85
|
const set = handlers.get(hash);
|
|
@@ -131,14 +99,8 @@ const make$7 = /*#__PURE__*/ sync(() => {
|
|
|
131
99
|
withBatch
|
|
132
100
|
});
|
|
133
101
|
});
|
|
134
|
-
var PendingInvalidation = class extends
|
|
135
|
-
|
|
136
|
-
* The default layer that provides an in-memory `Reactivity` service.
|
|
137
|
-
*
|
|
138
|
-
* @category layers
|
|
139
|
-
* @since 4.0.0
|
|
140
|
-
*/
|
|
141
|
-
const layer$5 = /*#__PURE__*/ effect(Reactivity)(make$7);
|
|
102
|
+
var PendingInvalidation = class extends Service()("effect/reactivity/Reactivity/PendingInvalidation") {};
|
|
103
|
+
const layer$5 = effect(Reactivity)(make$7);
|
|
142
104
|
function stringOrHash(u) {
|
|
143
105
|
switch (typeof u) {
|
|
144
106
|
case "string":
|
|
@@ -161,91 +123,27 @@ const keysToHashes = (keys, f) => {
|
|
|
161
123
|
};
|
|
162
124
|
//#endregion
|
|
163
125
|
//#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/sql/Statement.js
|
|
164
|
-
/**
|
|
165
|
-
* Low-level SQL statement and fragment primitives.
|
|
166
|
-
*
|
|
167
|
-
* `SqlClient` uses this module to build executable, parameterized SQL from
|
|
168
|
-
* reusable fragments. A statement can be executed, streamed, run without row
|
|
169
|
-
* transformation, or compiled to SQL text and parameters for a specific
|
|
170
|
-
* dialect. The module also contains helpers for identifiers, parameters,
|
|
171
|
-
* inserts, updates, custom dialect fragments, statement compilation, and row
|
|
172
|
-
* transformation.
|
|
173
|
-
*
|
|
174
|
-
* @since 4.0.0
|
|
175
|
-
*/
|
|
176
126
|
const FragmentTypeId = "~effect/sql/Statement/Fragment";
|
|
177
|
-
/**
|
|
178
|
-
* Constructs a SQL `Fragment` from low-level statement segments.
|
|
179
|
-
*
|
|
180
|
-
* @category constructors
|
|
181
|
-
* @since 4.0.0
|
|
182
|
-
*/
|
|
183
127
|
const fragment = (segments) => ({
|
|
184
128
|
[FragmentTypeId]: FragmentTypeId,
|
|
185
129
|
segments
|
|
186
130
|
});
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
* before statement execution.
|
|
190
|
-
*
|
|
191
|
-
* @category services
|
|
192
|
-
* @since 4.0.0
|
|
193
|
-
*/
|
|
194
|
-
const CurrentTransformer = /*#__PURE__*/ Reference("effect/sql/CurrentTransformer", { defaultValue: constUndefined });
|
|
195
|
-
/**
|
|
196
|
-
* Parents driver spans under `sql.execute` for every client in the current scope,
|
|
197
|
-
* including acquisition and stream pulls. Defaults to `false`; ignored when tracing is disabled.
|
|
198
|
-
*
|
|
199
|
-
* @category services
|
|
200
|
-
* @since 4.0.0
|
|
201
|
-
*/
|
|
202
|
-
const SpanPropagationEnabled = /*#__PURE__*/ Reference("effect/sql/SpanPropagationEnabled", { defaultValue: () => false });
|
|
203
|
-
/**
|
|
204
|
-
* Returns `true` when a value is a SQL `Fragment`.
|
|
205
|
-
*
|
|
206
|
-
* @category guards
|
|
207
|
-
* @since 4.0.0
|
|
208
|
-
*/
|
|
131
|
+
const CurrentTransformer = Reference("effect/sql/CurrentTransformer", { defaultValue: constUndefined });
|
|
132
|
+
const SpanPropagationEnabled = Reference("effect/sql/SpanPropagationEnabled", { defaultValue: () => false });
|
|
209
133
|
const isFragment = (u) => hasProperty(u, FragmentTypeId);
|
|
210
|
-
/**
|
|
211
|
-
* Constructs a raw SQL literal segment. The literal text is not escaped, so use
|
|
212
|
-
* bound parameters for untrusted values.
|
|
213
|
-
*
|
|
214
|
-
* @category constructors
|
|
215
|
-
* @since 4.0.0
|
|
216
|
-
*/
|
|
217
134
|
const literal = (value, params) => ({
|
|
218
135
|
_tag: "Literal",
|
|
219
136
|
value,
|
|
220
137
|
params
|
|
221
138
|
});
|
|
222
|
-
/**
|
|
223
|
-
* Constructs a SQL identifier segment that will be escaped by the active
|
|
224
|
-
* compiler.
|
|
225
|
-
*
|
|
226
|
-
* @category constructors
|
|
227
|
-
* @since 4.0.0
|
|
228
|
-
*/
|
|
229
139
|
const identifier = (value) => ({
|
|
230
140
|
_tag: "Identifier",
|
|
231
141
|
value
|
|
232
142
|
});
|
|
233
|
-
/**
|
|
234
|
-
* Constructs a bound parameter segment for a statement value.
|
|
235
|
-
*
|
|
236
|
-
* @category constructors
|
|
237
|
-
* @since 4.0.0
|
|
238
|
-
*/
|
|
239
143
|
const parameter = (value) => ({
|
|
240
144
|
_tag: "Parameter",
|
|
241
145
|
value
|
|
242
146
|
});
|
|
243
|
-
/**
|
|
244
|
-
* Constructs an `ArrayHelper` segment for an array of values or fragments.
|
|
245
|
-
*
|
|
246
|
-
* @category constructors
|
|
247
|
-
* @since 4.0.0
|
|
248
|
-
*/
|
|
249
147
|
const arrayHelper = (value) => ({
|
|
250
148
|
_tag: "ArrayHelper",
|
|
251
149
|
value
|
|
@@ -258,12 +156,6 @@ const RecordInsertHelperProto = {
|
|
|
258
156
|
return self;
|
|
259
157
|
}
|
|
260
158
|
};
|
|
261
|
-
/**
|
|
262
|
-
* Constructs a `RecordInsertHelper` from one or more row objects.
|
|
263
|
-
*
|
|
264
|
-
* @category constructors
|
|
265
|
-
* @since 4.0.0
|
|
266
|
-
*/
|
|
267
159
|
const recordInsertHelper = (value) => Object.assign(Object.create(RecordInsertHelperProto), {
|
|
268
160
|
value,
|
|
269
161
|
returningIdentifier: void 0
|
|
@@ -272,13 +164,6 @@ const RecordUpdateHelperProto = {
|
|
|
272
164
|
...RecordInsertHelperProto,
|
|
273
165
|
_tag: "RecordUpdateHelper"
|
|
274
166
|
};
|
|
275
|
-
/**
|
|
276
|
-
* Constructs a `RecordUpdateHelper` for multi-row update compilation using the
|
|
277
|
-
* provided alias.
|
|
278
|
-
*
|
|
279
|
-
* @category constructors
|
|
280
|
-
* @since 4.0.0
|
|
281
|
-
*/
|
|
282
167
|
const recordUpdateHelper = (value, alias) => Object.assign(Object.create(RecordUpdateHelperProto), {
|
|
283
168
|
value,
|
|
284
169
|
alias,
|
|
@@ -288,25 +173,11 @@ const RecordUpdateHelperSingleProto = {
|
|
|
288
173
|
...RecordInsertHelperProto,
|
|
289
174
|
_tag: "RecordUpdateHelperSingle"
|
|
290
175
|
};
|
|
291
|
-
/**
|
|
292
|
-
* Constructs a `RecordUpdateHelperSingle` from a record and a list of columns
|
|
293
|
-
* to omit from the update.
|
|
294
|
-
*
|
|
295
|
-
* @category constructors
|
|
296
|
-
* @since 4.0.0
|
|
297
|
-
*/
|
|
298
176
|
const recordUpdateHelperSingle = (value, omit) => Object.assign(Object.create(RecordUpdateHelperSingleProto), {
|
|
299
177
|
value,
|
|
300
178
|
omit,
|
|
301
179
|
returningIdentifier: void 0
|
|
302
180
|
});
|
|
303
|
-
/**
|
|
304
|
-
* Creates a cached SQL statement constructor from a connection acquirer,
|
|
305
|
-
* compiler, tracing attributes, and optional row transformation function.
|
|
306
|
-
*
|
|
307
|
-
* @category constructors
|
|
308
|
-
* @since 4.0.0
|
|
309
|
-
*/
|
|
310
181
|
const make$6 = (acquirer, compiler, spanAttributes, transformRows, borrower) => {
|
|
311
182
|
const cache = transformRows === void 0 ? constructorCache.noTransforms : constructorCache.transforms;
|
|
312
183
|
if (cache.has(acquirer)) return cache.get(acquirer);
|
|
@@ -346,17 +217,9 @@ const make$6 = (acquirer, compiler, spanAttributes, transformRows, borrower) =>
|
|
|
346
217
|
return self;
|
|
347
218
|
};
|
|
348
219
|
const constructorCache = {
|
|
349
|
-
transforms:
|
|
350
|
-
noTransforms:
|
|
351
|
-
};
|
|
352
|
-
/**
|
|
353
|
-
* Builds a `Statement` from template strings and arguments, preserving
|
|
354
|
-
* fragments and helper segments while converting ordinary interpolated values
|
|
355
|
-
* into bound parameters.
|
|
356
|
-
*
|
|
357
|
-
* @category constructors
|
|
358
|
-
* @since 4.0.0
|
|
359
|
-
*/
|
|
220
|
+
transforms: new WeakMap(),
|
|
221
|
+
noTransforms: new WeakMap()
|
|
222
|
+
};
|
|
360
223
|
const statement = (acquirer, compiler, strings, args, spanAttributes, transformRows, borrower) => {
|
|
361
224
|
const segments = strings[0].length > 0 ? [literal(strings[0])] : [];
|
|
362
225
|
for (let i = 0; i < args.length; i++) {
|
|
@@ -368,14 +231,6 @@ const statement = (acquirer, compiler, strings, args, spanAttributes, transformR
|
|
|
368
231
|
}
|
|
369
232
|
return makeUnsafe$1(segments, acquirer, compiler, spanAttributes, transformRows, borrower);
|
|
370
233
|
};
|
|
371
|
-
/**
|
|
372
|
-
* Creates a helper that joins SQL clauses with a literal separator, optionally
|
|
373
|
-
* wrapping multiple clauses in parentheses and using a fallback for an empty
|
|
374
|
-
* list.
|
|
375
|
-
*
|
|
376
|
-
* @category constructors
|
|
377
|
-
* @since 4.0.0
|
|
378
|
-
*/
|
|
379
234
|
function join(lit, addParens = true, fallback = "") {
|
|
380
235
|
const literalStatement = literal(lit);
|
|
381
236
|
const fallbackFragment = fragment([literal(fallback)]);
|
|
@@ -393,49 +248,22 @@ function join(lit, addParens = true, fallback = "") {
|
|
|
393
248
|
return fragment(segments);
|
|
394
249
|
};
|
|
395
250
|
}
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
* `1=1` when the list is empty.
|
|
399
|
-
*
|
|
400
|
-
* @category constructors
|
|
401
|
-
* @since 4.0.0
|
|
402
|
-
*/
|
|
403
|
-
const and = /*#__PURE__*/ join(" AND ", true, "1=1");
|
|
404
|
-
/**
|
|
405
|
-
* Combines clauses with `OR`, parenthesizing multiple clauses and returning
|
|
406
|
-
* `1=1` when the list is empty.
|
|
407
|
-
*
|
|
408
|
-
* @category constructors
|
|
409
|
-
* @since 4.0.0
|
|
410
|
-
*/
|
|
411
|
-
const or = /*#__PURE__*/ join(" OR ", true, "1=1");
|
|
412
|
-
/**
|
|
413
|
-
* Creates a comma-separated SQL fragment from values, optionally adding a
|
|
414
|
-
* prefix, and returns an empty fragment when no values are provided.
|
|
415
|
-
*
|
|
416
|
-
* @category constructors
|
|
417
|
-
* @since 4.0.0
|
|
418
|
-
*/
|
|
251
|
+
const and = join(" AND ", true, "1=1");
|
|
252
|
+
const or = join(" OR ", true, "1=1");
|
|
419
253
|
const csv = function(...args) {
|
|
420
254
|
if (args[args.length - 1].length === 0) return emptyFragment;
|
|
421
255
|
if (args.length === 1) return csvRaw(args[0]);
|
|
422
256
|
return fragment([literal(`${args[0]} `), ...csvRaw(args[1]).segments]);
|
|
423
257
|
};
|
|
424
|
-
const csvRaw =
|
|
425
|
-
const emptyFragment =
|
|
426
|
-
/**
|
|
427
|
-
* Creates a dialect-specific SQL `Compiler` from rendering callbacks.
|
|
428
|
-
*
|
|
429
|
-
* @category constructors
|
|
430
|
-
* @since 4.0.0
|
|
431
|
-
*/
|
|
258
|
+
const csvRaw = join(",", false);
|
|
259
|
+
const emptyFragment = fragment([literal("")]);
|
|
432
260
|
const makeCompiler = (options) => {
|
|
433
261
|
const self = Object.create(CompilerProto);
|
|
434
262
|
self.options = options;
|
|
435
263
|
self.dialect = options.dialect;
|
|
436
264
|
self.disableTransforms = false;
|
|
437
|
-
self.statementCache =
|
|
438
|
-
self.statementCacheNoTransform =
|
|
265
|
+
self.statementCache = new WeakMap();
|
|
266
|
+
self.statementCacheNoTransform = new WeakMap();
|
|
439
267
|
return self;
|
|
440
268
|
};
|
|
441
269
|
const CompilerProto = {
|
|
@@ -581,13 +409,6 @@ const CompilerProto = {
|
|
|
581
409
|
return self;
|
|
582
410
|
}
|
|
583
411
|
};
|
|
584
|
-
/**
|
|
585
|
-
* Creates a SQLite compiler that uses `?` placeholders and quoted identifiers,
|
|
586
|
-
* optionally transforming identifier names before escaping.
|
|
587
|
-
*
|
|
588
|
-
* @category constructors
|
|
589
|
-
* @since 4.0.0
|
|
590
|
-
*/
|
|
591
412
|
const makeCompilerSqlite = (transform) => makeCompiler({
|
|
592
413
|
dialect: "sqlite",
|
|
593
414
|
placeholder(_) {
|
|
@@ -603,14 +424,6 @@ const makeCompilerSqlite = (transform) => makeCompiler({
|
|
|
603
424
|
return ["", []];
|
|
604
425
|
}
|
|
605
426
|
});
|
|
606
|
-
/**
|
|
607
|
-
* Creates an identifier escaping function that wraps names in the given
|
|
608
|
-
* delimiter, doubles delimiter characters, and escapes dots between identifier
|
|
609
|
-
* parts.
|
|
610
|
-
*
|
|
611
|
-
* @category constructors
|
|
612
|
-
* @since 4.0.0
|
|
613
|
-
*/
|
|
614
427
|
function defaultEscape(c) {
|
|
615
428
|
const re = new RegExp(c, "g");
|
|
616
429
|
const double = c + c;
|
|
@@ -619,13 +432,6 @@ function defaultEscape(c) {
|
|
|
619
432
|
return c + str.replace(re, double).replace(/\./g, dot) + c;
|
|
620
433
|
};
|
|
621
434
|
}
|
|
622
|
-
/**
|
|
623
|
-
* Builds value, object, and row-array transformers that rename object keys with
|
|
624
|
-
* the supplied function and optionally recurse into nested object arrays.
|
|
625
|
-
*
|
|
626
|
-
* @category transforming
|
|
627
|
-
* @since 4.0.0
|
|
628
|
-
*/
|
|
629
435
|
const defaultTransforms = (transformer, nested = true) => {
|
|
630
436
|
const transformValue = (value) => {
|
|
631
437
|
if (Array.isArray(value)) {
|
|
@@ -726,7 +532,7 @@ const StatementProto = {
|
|
|
726
532
|
const self = this;
|
|
727
533
|
return self.withConnection("executeUnprepared", (connection, sql, params) => connection.executeUnprepared(sql, params, self.transformRows));
|
|
728
534
|
},
|
|
729
|
-
|
|
535
|
+
...Prototype({
|
|
730
536
|
label: "Statement",
|
|
731
537
|
evaluate(fiber) {
|
|
732
538
|
const span = makeSpanUnsafe(fiber, "sql.execute", { kind: "client" });
|
|
@@ -793,7 +599,7 @@ const extractPrimitive = (value, onCustom, placeholder, withoutTransform) => {
|
|
|
793
599
|
}
|
|
794
600
|
return value;
|
|
795
601
|
};
|
|
796
|
-
const escapeSqlite =
|
|
602
|
+
const escapeSqlite = defaultEscape("\"");
|
|
797
603
|
function in_() {
|
|
798
604
|
if (arguments.length === 1) return arrayHelper(arguments[0]);
|
|
799
605
|
const column = arguments[0];
|
|
@@ -804,43 +610,14 @@ function in_() {
|
|
|
804
610
|
arrayHelper(values)
|
|
805
611
|
]);
|
|
806
612
|
}
|
|
807
|
-
const neverFragment =
|
|
613
|
+
const neverFragment = fragment([literal("1=0")]);
|
|
808
614
|
//#endregion
|
|
809
615
|
//#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/sql/SqlClient.js
|
|
810
|
-
/**
|
|
811
|
-
* Main SQL client service for tagged-template queries.
|
|
812
|
-
*
|
|
813
|
-
* `SqlClient` combines the tagged-template statement constructor with
|
|
814
|
-
* connection acquisition, dialect compilation, transactions, row transforms,
|
|
815
|
-
* tracing, and reactive query helpers. Driver integrations build this service
|
|
816
|
-
* from their connection and compiler pieces.
|
|
817
|
-
*
|
|
818
|
-
* @since 4.0.0
|
|
819
|
-
*/
|
|
820
616
|
const TypeId$5 = "~effect/sql/SqlClient";
|
|
821
|
-
|
|
822
|
-
* Service tag for the active SQL client service.
|
|
823
|
-
*
|
|
824
|
-
* **When to use**
|
|
825
|
-
*
|
|
826
|
-
* Use to access or provide the SQL client used to build statements, stream
|
|
827
|
-
* rows, reserve connections, and run transactions.
|
|
828
|
-
*
|
|
829
|
-
* @category services
|
|
830
|
-
* @since 4.0.0
|
|
831
|
-
*/
|
|
832
|
-
const SqlClient = /*#__PURE__*/ Service("effect/sql/SqlClient");
|
|
617
|
+
const SqlClient = Service("effect/sql/SqlClient");
|
|
833
618
|
let clientIdCounter = 0;
|
|
834
619
|
let transactionSemaphoreIdCounter = 0;
|
|
835
|
-
|
|
836
|
-
* Constructs a `SqlClient` from connection acquirers, a compiler, transaction
|
|
837
|
-
* commands, tracing attributes, optional row transforms, and reactive query
|
|
838
|
-
* integration.
|
|
839
|
-
*
|
|
840
|
-
* @category constructors
|
|
841
|
-
* @since 4.0.0
|
|
842
|
-
*/
|
|
843
|
-
const make$5 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
620
|
+
const make$5 = fnUntraced(function* (options) {
|
|
844
621
|
const transactionService = options.transactionService ?? TransactionConnection(clientIdCounter++);
|
|
845
622
|
const getConnection = flatMap(serviceOption(transactionService), match({
|
|
846
623
|
onNone: () => options.acquirer,
|
|
@@ -891,14 +668,6 @@ const make$5 = /*#__PURE__*/ fnUntraced(function* (options) {
|
|
|
891
668
|
client.safe = client;
|
|
892
669
|
return client;
|
|
893
670
|
});
|
|
894
|
-
/**
|
|
895
|
-
* Builds a transaction wrapper that begins top-level transactions, uses
|
|
896
|
-
* savepoints for nested transactions, commits on success, and rolls back on
|
|
897
|
-
* failure or interruption.
|
|
898
|
-
*
|
|
899
|
-
* @category transactions
|
|
900
|
-
* @since 4.0.0
|
|
901
|
-
*/
|
|
902
671
|
const makeWithTransaction = (options) => {
|
|
903
672
|
const transactionSemaphore = Service(`effect/sql/SqlClient/TransactionSemaphore/${transactionSemaphoreIdCounter++}`);
|
|
904
673
|
return (effect) => uninterruptibleMask((restore) => useSpan("sql.transaction", { kind: "client" }, (span) => withFiber((fiber) => {
|
|
@@ -927,156 +696,19 @@ const makeWithTransaction = (options) => {
|
|
|
927
696
|
return id === 0 ? transaction : getUnsafe(services, transactionSemaphore).withPermit(transaction);
|
|
928
697
|
})));
|
|
929
698
|
};
|
|
930
|
-
/**
|
|
931
|
-
* Creates a unique context service tag for the active transaction connection of
|
|
932
|
-
* a specific SQL client.
|
|
933
|
-
*
|
|
934
|
-
* @category services
|
|
935
|
-
* @since 4.0.0
|
|
936
|
-
*/
|
|
937
699
|
const TransactionConnection = (clientId) => Service(`effect/sql/SqlClient/TransactionConnection/${clientId}`);
|
|
938
|
-
|
|
939
|
-
* Context reference used by SQL integrations to opt in to safe integer
|
|
940
|
-
* handling; defaults to `false`.
|
|
941
|
-
*
|
|
942
|
-
* @category services
|
|
943
|
-
* @since 4.0.0
|
|
944
|
-
*/
|
|
945
|
-
const SafeIntegers = /*#__PURE__*/ Reference("effect/sql/SqlClient/SafeIntegers", { defaultValue: () => false });
|
|
700
|
+
const SafeIntegers = Reference("effect/sql/SqlClient/SafeIntegers", { defaultValue: () => false });
|
|
946
701
|
//#endregion
|
|
947
702
|
//#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/Cache.js
|
|
948
|
-
/**
|
|
949
|
-
* Caches values loaded by an Effect lookup function.
|
|
950
|
-
*
|
|
951
|
-
* A cache stores successful and failed lookup results, shares an in-progress
|
|
952
|
-
* lookup when multiple callers request the same missing key, and limits entries
|
|
953
|
-
* by capacity and optional time-to-live rules. This module includes helpers for
|
|
954
|
-
* reading, setting, refreshing, invalidating, and inspecting cache contents.
|
|
955
|
-
*
|
|
956
|
-
* @since 4.0.0
|
|
957
|
-
*/
|
|
958
703
|
const TypeId$4 = "~effect/Cache";
|
|
959
|
-
/**
|
|
960
|
-
* Creates a cache with dynamic time-to-live based on the result and key.
|
|
961
|
-
*
|
|
962
|
-
* **When to use**
|
|
963
|
-
*
|
|
964
|
-
* Use when you need different cache entry lifetimes based on the lookup result
|
|
965
|
-
* or key characteristics.
|
|
966
|
-
*
|
|
967
|
-
* **Details**
|
|
968
|
-
*
|
|
969
|
-
* The timeToLive function receives both the exit result and the key, allowing
|
|
970
|
-
* for flexible TTL policies based on success/failure state and key characteristics.
|
|
971
|
-
*
|
|
972
|
-
* **Example** (Configuring dynamic time to live)
|
|
973
|
-
*
|
|
974
|
-
* ```ts import.meta.vitest
|
|
975
|
-
* import { Cache, Effect, Exit } from "effect"
|
|
976
|
-
*
|
|
977
|
-
* // Cache with TTL based on computed value
|
|
978
|
-
* const program = Effect.gen(function*() {
|
|
979
|
-
* const cache = yield* Cache.makeWith(
|
|
980
|
-
* (id: number) => Effect.succeed({ id, active: id % 2 === 0 }),
|
|
981
|
-
* {
|
|
982
|
-
* capacity: 1000,
|
|
983
|
-
* timeToLive(exit) {
|
|
984
|
-
* if (Exit.isSuccess(exit)) {
|
|
985
|
-
* const user = exit.value
|
|
986
|
-
* return user.active ? "1 hour" : "5 minutes"
|
|
987
|
-
* }
|
|
988
|
-
* return "30 seconds"
|
|
989
|
-
* }
|
|
990
|
-
* }
|
|
991
|
-
* )
|
|
992
|
-
*
|
|
993
|
-
* return cache.capacity
|
|
994
|
-
* })
|
|
995
|
-
*
|
|
996
|
-
* const actual = await Effect.runPromise(program)
|
|
997
|
-
* actual // => 1000
|
|
998
|
-
* ```
|
|
999
|
-
*
|
|
1000
|
-
* @see {@link make} for a simpler cache constructor with a fixed time-to-live for all entries
|
|
1001
|
-
* @category constructors
|
|
1002
|
-
* @since 2.0.0
|
|
1003
|
-
*/
|
|
1004
704
|
const makeWith = (lookup, options) => contextWith$1((context) => {
|
|
1005
705
|
const self = Object.create(Proto$1);
|
|
1006
706
|
self.lookup = (key) => updateContext(lookup(key), (input) => merge(context, input));
|
|
1007
|
-
self.map = make$
|
|
707
|
+
self.map = make$13();
|
|
1008
708
|
self.capacity = options.capacity;
|
|
1009
709
|
self.timeToLive = options.timeToLive ? (exit, key) => fromInputUnsafe(options.timeToLive(exit, key)) : defaultTimeToLive;
|
|
1010
710
|
return succeed$1(self);
|
|
1011
711
|
});
|
|
1012
|
-
/**
|
|
1013
|
-
* Creates a cache with a fixed time-to-live for all entries.
|
|
1014
|
-
*
|
|
1015
|
-
* **Details**
|
|
1016
|
-
*
|
|
1017
|
-
* This is the basic cache constructor where all entries share the same TTL.
|
|
1018
|
-
* The lookup function will be called when a key is not found or has expired.
|
|
1019
|
-
*
|
|
1020
|
-
* **Example** (Creating a basic cache)
|
|
1021
|
-
*
|
|
1022
|
-
* ```ts import.meta.vitest
|
|
1023
|
-
* import { Cache, Effect } from "effect"
|
|
1024
|
-
*
|
|
1025
|
-
* // Basic cache with string keys
|
|
1026
|
-
* const program = Effect.gen(function*() {
|
|
1027
|
-
* const cache = yield* Cache.make<string, number>({
|
|
1028
|
-
* capacity: 100,
|
|
1029
|
-
* lookup: (key) => Effect.succeed(key.length)
|
|
1030
|
-
* })
|
|
1031
|
-
*
|
|
1032
|
-
* const result1 = yield* Cache.get(cache, "hello")
|
|
1033
|
-
* const result2 = yield* Cache.get(cache, "world")
|
|
1034
|
-
* return { result1, result2 }
|
|
1035
|
-
* })
|
|
1036
|
-
*
|
|
1037
|
-
* const actual = await Effect.runPromise(program)
|
|
1038
|
-
* actual // => { result1: 5, result2: 5 }
|
|
1039
|
-
* ```
|
|
1040
|
-
*
|
|
1041
|
-
* **Example** (Creating a cache with TTL)
|
|
1042
|
-
*
|
|
1043
|
-
* ```ts import.meta.vitest
|
|
1044
|
-
* import { Cache, Effect } from "effect"
|
|
1045
|
-
*
|
|
1046
|
-
* const program = Effect.gen(function*() {
|
|
1047
|
-
* const users = new Map([
|
|
1048
|
-
* [123, { name: "Ada", email: "ada@example.com" }],
|
|
1049
|
-
* [456, { name: "Grace", email: "grace@example.com" }]
|
|
1050
|
-
* ])
|
|
1051
|
-
*
|
|
1052
|
-
* const cache = yield* Cache.make<
|
|
1053
|
-
* number,
|
|
1054
|
-
* { name: string; email: string },
|
|
1055
|
-
* string
|
|
1056
|
-
* >({
|
|
1057
|
-
* capacity: 500,
|
|
1058
|
-
* lookup: (userId) =>
|
|
1059
|
-
* Effect.suspend(() => {
|
|
1060
|
-
* const user = users.get(userId)
|
|
1061
|
-
* return user === undefined
|
|
1062
|
-
* ? Effect.fail(`User ${userId} not found`)
|
|
1063
|
-
* : Effect.succeed(user)
|
|
1064
|
-
* }),
|
|
1065
|
-
* timeToLive: "15 minutes"
|
|
1066
|
-
* })
|
|
1067
|
-
*
|
|
1068
|
-
* const user1 = yield* Cache.get(cache, 123)
|
|
1069
|
-
* const user2 = yield* Cache.get(cache, 123)
|
|
1070
|
-
* return [user1, user2, user1 === user2] as const
|
|
1071
|
-
* })
|
|
1072
|
-
*
|
|
1073
|
-
* const actual = await Effect.runPromise(program)
|
|
1074
|
-
* actual // => [{ name: "Ada", email: "ada@example.com" }, { name: "Ada", email: "ada@example.com" }, true]
|
|
1075
|
-
* ```
|
|
1076
|
-
*
|
|
1077
|
-
* @category constructors
|
|
1078
|
-
* @since 2.0.0
|
|
1079
|
-
*/
|
|
1080
712
|
const make$4 = (options) => makeWith(options.lookup, {
|
|
1081
713
|
...options,
|
|
1082
714
|
timeToLive: options.timeToLive !== void 0 ? () => options.timeToLive : defaultTimeToLive
|
|
@@ -1093,102 +725,7 @@ const Proto$1 = {
|
|
|
1093
725
|
}
|
|
1094
726
|
};
|
|
1095
727
|
const defaultTimeToLive = (_, _key) => infinity;
|
|
1096
|
-
|
|
1097
|
-
* Retrieves the value for a key, invoking the lookup function on a cache miss
|
|
1098
|
-
* or expired entry.
|
|
1099
|
-
*
|
|
1100
|
-
* **Details**
|
|
1101
|
-
*
|
|
1102
|
-
* Concurrent `get` calls for the same missing key share the same pending
|
|
1103
|
-
* lookup. The cache stores the lookup `Exit`, so failed lookups are cached and
|
|
1104
|
-
* will fail again until the entry expires, is invalidated, or is refreshed.
|
|
1105
|
-
*
|
|
1106
|
-
* **Example** (Getting cached values)
|
|
1107
|
-
*
|
|
1108
|
-
* ```ts import.meta.vitest
|
|
1109
|
-
* import { Cache, Effect } from "effect"
|
|
1110
|
-
*
|
|
1111
|
-
* const program = Effect.gen(function*() {
|
|
1112
|
-
* const cache = yield* Cache.make({
|
|
1113
|
-
* capacity: 10,
|
|
1114
|
-
* lookup: (key: string) => Effect.succeed(key.length)
|
|
1115
|
-
* })
|
|
1116
|
-
*
|
|
1117
|
-
* // Cache miss - triggers lookup function
|
|
1118
|
-
* const result1 = yield* Cache.get(cache, "hello")
|
|
1119
|
-
*
|
|
1120
|
-
* // Cache hit - returns cached value without lookup
|
|
1121
|
-
* const result2 = yield* Cache.get(cache, "hello")
|
|
1122
|
-
*
|
|
1123
|
-
* return { result1, result2 }
|
|
1124
|
-
* })
|
|
1125
|
-
*
|
|
1126
|
-
* const actual = await Effect.runPromise(program)
|
|
1127
|
-
* actual // => { result1: 5, result2: 5 }
|
|
1128
|
-
* ```
|
|
1129
|
-
*
|
|
1130
|
-
* **Example** (Handling lookup failures)
|
|
1131
|
-
*
|
|
1132
|
-
* ```ts import.meta.vitest
|
|
1133
|
-
* import { Cache, Effect, Exit } from "effect"
|
|
1134
|
-
*
|
|
1135
|
-
* // Error handling when lookup fails
|
|
1136
|
-
* const program = Effect.gen(function*() {
|
|
1137
|
-
* const cache = yield* Cache.make<string, number, string>({
|
|
1138
|
-
* capacity: 10,
|
|
1139
|
-
* lookup: (key: string) =>
|
|
1140
|
-
* key === "error"
|
|
1141
|
-
* ? Effect.fail("Lookup failed")
|
|
1142
|
-
* : Effect.succeed(key.length)
|
|
1143
|
-
* })
|
|
1144
|
-
*
|
|
1145
|
-
* // Successful lookup
|
|
1146
|
-
* const success = yield* Cache.get(cache, "hello")
|
|
1147
|
-
*
|
|
1148
|
-
* // Failed lookup - returns error
|
|
1149
|
-
* const failure = yield* Effect.exit(Cache.get(cache, "error"))
|
|
1150
|
-
* return [success, failure] as const
|
|
1151
|
-
* })
|
|
1152
|
-
*
|
|
1153
|
-
* const actual = await Effect.runPromise(program)
|
|
1154
|
-
* actual // => [5, Exit.fail("Lookup failed")]
|
|
1155
|
-
* ```
|
|
1156
|
-
*
|
|
1157
|
-
* **Example** (Sharing concurrent lookups)
|
|
1158
|
-
*
|
|
1159
|
-
* ```ts import.meta.vitest
|
|
1160
|
-
* import { Cache, Effect } from "effect"
|
|
1161
|
-
*
|
|
1162
|
-
* // Concurrent access - multiple gets of same key only invoke lookup once
|
|
1163
|
-
* const program = Effect.gen(function*() {
|
|
1164
|
-
* let lookupCount = 0
|
|
1165
|
-
* const cache = yield* Cache.make({
|
|
1166
|
-
* capacity: 10,
|
|
1167
|
-
* lookup: (key: string) =>
|
|
1168
|
-
* Effect.sync(() => {
|
|
1169
|
-
* lookupCount++
|
|
1170
|
-
* return key.length
|
|
1171
|
-
* })
|
|
1172
|
-
* })
|
|
1173
|
-
*
|
|
1174
|
-
* // Multiple concurrent gets
|
|
1175
|
-
* const results = yield* Effect.all([
|
|
1176
|
-
* Cache.get(cache, "hello"),
|
|
1177
|
-
* Cache.get(cache, "hello"),
|
|
1178
|
-
* Cache.get(cache, "hello")
|
|
1179
|
-
* ], { concurrency: "unbounded" })
|
|
1180
|
-
*
|
|
1181
|
-
* return { results, lookupCount }
|
|
1182
|
-
* })
|
|
1183
|
-
*
|
|
1184
|
-
* const actual = await Effect.runPromise(program)
|
|
1185
|
-
* actual // => { results: [5, 5, 5], lookupCount: 1 }
|
|
1186
|
-
* ```
|
|
1187
|
-
*
|
|
1188
|
-
* @category combinators
|
|
1189
|
-
* @since 4.0.0
|
|
1190
|
-
*/
|
|
1191
|
-
const get = /*#__PURE__*/ dual(2, (self, key) => withFiber$1((fiber) => {
|
|
728
|
+
const get = dual(2, (self, key) => withFiber$1((fiber) => {
|
|
1192
729
|
const oentry = get$2(self.map, key);
|
|
1193
730
|
if (isSome(oentry) && !hasExpired(oentry.value, fiber)) {
|
|
1194
731
|
remove(self.map, key);
|
|
@@ -1246,31 +783,13 @@ const checkCapacity = (self) => {
|
|
|
1246
783
|
};
|
|
1247
784
|
//#endregion
|
|
1248
785
|
//#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/schema/VariantSchema.js
|
|
1249
|
-
/**
|
|
1250
|
-
* Runtime type identifier attached to variant schema structs.
|
|
1251
|
-
*
|
|
1252
|
-
* @category type IDs
|
|
1253
|
-
* @since 4.0.0
|
|
1254
|
-
*/
|
|
1255
786
|
const TypeId$3 = "~effect/schema/VariantSchema";
|
|
1256
|
-
const cacheSymbol =
|
|
1257
|
-
const defaultCacheSymbol =
|
|
1258
|
-
/**
|
|
1259
|
-
* Returns `true` when a value is a variant schema struct.
|
|
1260
|
-
*
|
|
1261
|
-
* @category guards
|
|
1262
|
-
* @since 4.0.0
|
|
1263
|
-
*/
|
|
787
|
+
const cacheSymbol = Symbol.for(`${TypeId$3}/cache`);
|
|
788
|
+
const defaultCacheSymbol = Symbol.for(`${TypeId$3}/defaultCache`);
|
|
1264
789
|
const isStruct = (u) => hasProperty(u, TypeId$3);
|
|
1265
790
|
const FieldTypeId = "~effect/schema/VariantSchema/Field";
|
|
1266
|
-
/**
|
|
1267
|
-
* Returns `true` when a value is a variant schema field.
|
|
1268
|
-
*
|
|
1269
|
-
* @category guards
|
|
1270
|
-
* @since 4.0.0
|
|
1271
|
-
*/
|
|
1272
791
|
const isField = (u) => hasProperty(u, FieldTypeId);
|
|
1273
|
-
const extract$1 =
|
|
792
|
+
const extract$1 = dual((args) => isStruct(args[0]), (self, variant, options) => {
|
|
1274
793
|
if (options?.isDefault === true && isSchema(self)) return self;
|
|
1275
794
|
const cache = options?.isDefault === true ? self[defaultCacheSymbol] ?? (self[defaultCacheSymbol] = Object.create(null)) : self[cacheSymbol] ?? (self[cacheSymbol] = Object.create(null));
|
|
1276
795
|
if (Object.hasOwn(cache, variant)) return cache[variant];
|
|
@@ -1292,19 +811,12 @@ const extract$1 = /*#__PURE__*/ dual((args) => isStruct(args[0]), (self, variant
|
|
|
1292
811
|
cache[variant] = schema;
|
|
1293
812
|
return schema;
|
|
1294
813
|
});
|
|
1295
|
-
/**
|
|
1296
|
-
* Creates a variant schema toolkit for a fixed set of variant names and a default
|
|
1297
|
-
* variant.
|
|
1298
|
-
*
|
|
1299
|
-
* @category constructors
|
|
1300
|
-
* @since 4.0.0
|
|
1301
|
-
*/
|
|
1302
814
|
const make$3 = (options) => {
|
|
1303
815
|
function Class(identifier) {
|
|
1304
816
|
return function(fields, annotations) {
|
|
1305
817
|
const variantStruct = Struct$1(fields);
|
|
1306
818
|
const schema = extract$1(variantStruct, options.defaultVariant, { isDefault: true });
|
|
1307
|
-
const SClass = Class$
|
|
819
|
+
const SClass = Class$2;
|
|
1308
820
|
class Base extends SClass(identifier)(schema.fields, annotations) {
|
|
1309
821
|
static [TypeId$3] = fields;
|
|
1310
822
|
}
|
|
@@ -1348,6 +860,8 @@ const make$3 = (options) => {
|
|
|
1348
860
|
extract: extractVariants
|
|
1349
861
|
};
|
|
1350
862
|
};
|
|
863
|
+
const Override = (value) => value;
|
|
864
|
+
const Overrideable = (schema, options) => schema.pipe(decodeTo(brand("Override")(toType(schema))), withConstructorDefault(map(options.defaultValue, Override)));
|
|
1351
865
|
const StructProto = { pipe() {
|
|
1352
866
|
return pipeArguments(this, arguments);
|
|
1353
867
|
} };
|
|
@@ -1374,7 +888,7 @@ const Union$1 = (members, defaultVariant, variants) => {
|
|
|
1374
888
|
};
|
|
1375
889
|
//#endregion
|
|
1376
890
|
//#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/schema/Model.js
|
|
1377
|
-
const { Class, Field, FieldExcept, FieldOnly, Struct, Union, extract, fieldEvolve } =
|
|
891
|
+
const { Class, Field, FieldExcept, FieldOnly, Struct, Union, extract, fieldEvolve } = make$3({
|
|
1378
892
|
variants: [
|
|
1379
893
|
"select",
|
|
1380
894
|
"insert",
|
|
@@ -1385,113 +899,96 @@ const { Class, Field, FieldExcept, FieldOnly, Struct, Union, extract, fieldEvolv
|
|
|
1385
899
|
],
|
|
1386
900
|
defaultVariant: "select"
|
|
1387
901
|
});
|
|
902
|
+
const optionalOption = (schema) => optionalKey(NullOr(schema)).pipe(decodeTo(Option(toType(schema)), transformOptional({
|
|
903
|
+
decode: (oe) => oe.pipe(filter(isNotNull), some),
|
|
904
|
+
encode: flatten
|
|
905
|
+
})));
|
|
906
|
+
const FieldOption = fieldEvolve({
|
|
907
|
+
select: map$3(OptionFromNullOr),
|
|
908
|
+
insert: map$3(OptionFromNullOr),
|
|
909
|
+
update: map$3(OptionFromNullOr),
|
|
910
|
+
json: map$3(optionalOption),
|
|
911
|
+
jsonCreate: map$3(optionalOption),
|
|
912
|
+
jsonUpdate: map$3(optionalOption)
|
|
913
|
+
});
|
|
914
|
+
const BooleanSqlite = Field({
|
|
915
|
+
select: BooleanFromBit,
|
|
916
|
+
insert: BooleanFromBit,
|
|
917
|
+
update: BooleanFromBit,
|
|
918
|
+
json: Boolean,
|
|
919
|
+
jsonCreate: Boolean,
|
|
920
|
+
jsonUpdate: Boolean
|
|
921
|
+
});
|
|
922
|
+
const Date$1 = String$1.pipe(decodeTo(DateTimeUtc, {
|
|
923
|
+
decode: dateTimeUtcFromInput().map(removeTime),
|
|
924
|
+
encode: transform(formatIsoDate)
|
|
925
|
+
}));
|
|
926
|
+
const DateWithNow = Overrideable(Date$1, { defaultValue: map(now, removeTime) });
|
|
927
|
+
const DateTimeWithNow = Overrideable(DateTimeUtcFromString, { defaultValue: now });
|
|
928
|
+
const DateTimeFromDateWithNow = Overrideable(DateTimeUtcFromDate, { defaultValue: now });
|
|
929
|
+
const DateTimeFromNumberWithNow = Overrideable(DateTimeUtcFromMillis, { defaultValue: now });
|
|
930
|
+
const DateTimeInsert = Field({
|
|
931
|
+
select: DateTimeUtcFromString,
|
|
932
|
+
insert: DateTimeWithNow,
|
|
933
|
+
json: DateTimeUtcFromString
|
|
934
|
+
});
|
|
935
|
+
const DateTimeInsertFromDate = Field({
|
|
936
|
+
select: DateTimeUtcFromDate,
|
|
937
|
+
insert: DateTimeFromDateWithNow,
|
|
938
|
+
json: DateTimeUtcFromString
|
|
939
|
+
});
|
|
940
|
+
const DateTimeInsertFromNumber = Field({
|
|
941
|
+
select: DateTimeUtcFromMillis,
|
|
942
|
+
insert: DateTimeFromNumberWithNow,
|
|
943
|
+
json: DateTimeUtcFromMillis
|
|
944
|
+
});
|
|
945
|
+
const DateTimeUpdate = Field({
|
|
946
|
+
select: DateTimeUtcFromString,
|
|
947
|
+
insert: DateTimeWithNow,
|
|
948
|
+
update: DateTimeWithNow,
|
|
949
|
+
json: DateTimeUtcFromString
|
|
950
|
+
});
|
|
951
|
+
const DateTimeUpdateFromDate = Field({
|
|
952
|
+
select: DateTimeUtcFromDate,
|
|
953
|
+
insert: DateTimeFromDateWithNow,
|
|
954
|
+
update: DateTimeFromDateWithNow,
|
|
955
|
+
json: DateTimeUtcFromString
|
|
956
|
+
});
|
|
957
|
+
const DateTimeUpdateFromNumber = Field({
|
|
958
|
+
select: DateTimeUtcFromMillis,
|
|
959
|
+
insert: DateTimeFromNumberWithNow,
|
|
960
|
+
update: DateTimeFromNumberWithNow,
|
|
961
|
+
json: DateTimeUtcFromMillis
|
|
962
|
+
});
|
|
1388
963
|
//#endregion
|
|
1389
964
|
//#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/sql/SqlError.js
|
|
1390
|
-
/**
|
|
1391
|
-
* Defines structured failures for SQL clients and driver integrations.
|
|
1392
|
-
*
|
|
1393
|
-
* `SqlError` wraps the different reasons a SQL operation can fail, such as
|
|
1394
|
-
* connection, authentication, authorization, syntax, constraint, or transaction
|
|
1395
|
-
* problems. Each reason keeps the original cause, optional message and
|
|
1396
|
-
* operation metadata, and whether retrying may succeed. This module also
|
|
1397
|
-
* includes schemas, guards, a SQLite error classifier, and the
|
|
1398
|
-
* `ResultLengthMismatch` error used by ordered batched SQL resolvers.
|
|
1399
|
-
*
|
|
1400
|
-
* @since 4.0.0
|
|
1401
|
-
*/
|
|
1402
965
|
const TypeId$2 = "~effect/sql/SqlError";
|
|
1403
966
|
const ReasonTypeId = "~effect/sql/SqlError/Reason";
|
|
1404
967
|
const ReasonFields = {
|
|
1405
|
-
cause:
|
|
1406
|
-
message:
|
|
1407
|
-
operation:
|
|
1408
|
-
};
|
|
1409
|
-
|
|
1410
|
-
* SQL error reason for connection or open failures; marked retryable.
|
|
1411
|
-
*
|
|
1412
|
-
* @category errors
|
|
1413
|
-
* @since 4.0.0
|
|
1414
|
-
*/
|
|
1415
|
-
var ConnectionError = class extends (/*#__PURE__*/ TaggedError("effect/sql/SqlError/ConnectionError")("ConnectionError", ReasonFields)) {
|
|
1416
|
-
/**
|
|
1417
|
-
* Marks this value as a structured SQL error reason for runtime guards.
|
|
1418
|
-
*
|
|
1419
|
-
* @since 4.0.0
|
|
1420
|
-
*/
|
|
968
|
+
cause: Defect(),
|
|
969
|
+
message: optional(String$1),
|
|
970
|
+
operation: optional(String$1)
|
|
971
|
+
};
|
|
972
|
+
var ConnectionError = class extends TaggedError$1("effect/sql/SqlError/ConnectionError")("ConnectionError", ReasonFields) {
|
|
1421
973
|
[ReasonTypeId] = ReasonTypeId;
|
|
1422
|
-
/**
|
|
1423
|
-
* Indicates whether retrying the failed SQL operation may succeed.
|
|
1424
|
-
*
|
|
1425
|
-
* @since 4.0.0
|
|
1426
|
-
*/
|
|
1427
974
|
get isRetryable() {
|
|
1428
975
|
return true;
|
|
1429
976
|
}
|
|
1430
977
|
};
|
|
1431
|
-
|
|
1432
|
-
* SQL error reason for authentication failures such as invalid credentials; not
|
|
1433
|
-
* marked retryable.
|
|
1434
|
-
*
|
|
1435
|
-
* @category errors
|
|
1436
|
-
* @since 4.0.0
|
|
1437
|
-
*/
|
|
1438
|
-
var AuthenticationError = class extends (/*#__PURE__*/ TaggedError("effect/sql/SqlError/AuthenticationError")("AuthenticationError", ReasonFields)) {
|
|
1439
|
-
/**
|
|
1440
|
-
* Marks this value as a structured SQL error reason for runtime guards.
|
|
1441
|
-
*
|
|
1442
|
-
* @since 4.0.0
|
|
1443
|
-
*/
|
|
978
|
+
var AuthenticationError = class extends TaggedError$1("effect/sql/SqlError/AuthenticationError")("AuthenticationError", ReasonFields) {
|
|
1444
979
|
[ReasonTypeId] = ReasonTypeId;
|
|
1445
|
-
/**
|
|
1446
|
-
* Indicates whether retrying the failed SQL operation may succeed.
|
|
1447
|
-
*
|
|
1448
|
-
* @since 4.0.0
|
|
1449
|
-
*/
|
|
1450
980
|
get isRetryable() {
|
|
1451
981
|
return false;
|
|
1452
982
|
}
|
|
1453
983
|
};
|
|
1454
|
-
|
|
1455
|
-
* SQL error reason for authorization or permission failures; not marked
|
|
1456
|
-
* retryable.
|
|
1457
|
-
*
|
|
1458
|
-
* @category errors
|
|
1459
|
-
* @since 4.0.0
|
|
1460
|
-
*/
|
|
1461
|
-
var AuthorizationError = class extends (/*#__PURE__*/ TaggedError("effect/sql/SqlError/AuthorizationError")("AuthorizationError", ReasonFields)) {
|
|
1462
|
-
/**
|
|
1463
|
-
* Marks this value as a structured SQL error reason for runtime guards.
|
|
1464
|
-
*
|
|
1465
|
-
* @since 4.0.0
|
|
1466
|
-
*/
|
|
984
|
+
var AuthorizationError = class extends TaggedError$1("effect/sql/SqlError/AuthorizationError")("AuthorizationError", ReasonFields) {
|
|
1467
985
|
[ReasonTypeId] = ReasonTypeId;
|
|
1468
|
-
/**
|
|
1469
|
-
* Indicates whether retrying the failed SQL operation may succeed.
|
|
1470
|
-
*
|
|
1471
|
-
* @since 4.0.0
|
|
1472
|
-
*/
|
|
1473
986
|
get isRetryable() {
|
|
1474
987
|
return false;
|
|
1475
988
|
}
|
|
1476
989
|
};
|
|
1477
|
-
|
|
1478
|
-
* SQL error reason for invalid SQL syntax; not marked retryable.
|
|
1479
|
-
*
|
|
1480
|
-
* @category errors
|
|
1481
|
-
* @since 4.0.0
|
|
1482
|
-
*/
|
|
1483
|
-
var SqlSyntaxError = class extends (/*#__PURE__*/ TaggedError("effect/sql/SqlError/SqlSyntaxError")("SqlSyntaxError", ReasonFields)) {
|
|
1484
|
-
/**
|
|
1485
|
-
* Marks this value as a structured SQL error reason for runtime guards.
|
|
1486
|
-
*
|
|
1487
|
-
* @since 4.0.0
|
|
1488
|
-
*/
|
|
990
|
+
var SqlSyntaxError = class extends TaggedError$1("effect/sql/SqlError/SqlSyntaxError")("SqlSyntaxError", ReasonFields) {
|
|
1489
991
|
[ReasonTypeId] = ReasonTypeId;
|
|
1490
|
-
/**
|
|
1491
|
-
* Indicates whether retrying the failed SQL operation may succeed.
|
|
1492
|
-
*
|
|
1493
|
-
* @since 4.0.0
|
|
1494
|
-
*/
|
|
1495
992
|
get isRetryable() {
|
|
1496
993
|
return false;
|
|
1497
994
|
}
|
|
@@ -1500,170 +997,49 @@ const UniqueViolationFields = {
|
|
|
1500
997
|
...ReasonFields,
|
|
1501
998
|
constraint: String$1
|
|
1502
999
|
};
|
|
1503
|
-
|
|
1504
|
-
* SQL error reason for a unique constraint violation, including the violated
|
|
1505
|
-
* constraint identifier; not marked retryable.
|
|
1506
|
-
*
|
|
1507
|
-
* @category errors
|
|
1508
|
-
* @since 4.0.0
|
|
1509
|
-
*/
|
|
1510
|
-
var UniqueViolation = class extends (/*#__PURE__*/ TaggedError("effect/sql/SqlError/UniqueViolation")("UniqueViolation", UniqueViolationFields)) {
|
|
1511
|
-
/**
|
|
1512
|
-
* Marks this value as a structured SQL error reason for runtime guards.
|
|
1513
|
-
*
|
|
1514
|
-
* @since 4.0.0
|
|
1515
|
-
*/
|
|
1000
|
+
var UniqueViolation = class extends TaggedError$1("effect/sql/SqlError/UniqueViolation")("UniqueViolation", UniqueViolationFields) {
|
|
1516
1001
|
[ReasonTypeId] = ReasonTypeId;
|
|
1517
|
-
/**
|
|
1518
|
-
* Indicates whether retrying the failed SQL operation may succeed.
|
|
1519
|
-
*
|
|
1520
|
-
* @since 4.0.0
|
|
1521
|
-
*/
|
|
1522
1002
|
get isRetryable() {
|
|
1523
1003
|
return false;
|
|
1524
1004
|
}
|
|
1525
1005
|
};
|
|
1526
|
-
|
|
1527
|
-
* SQL error reason for a non-unique constraint violation; not marked retryable.
|
|
1528
|
-
*
|
|
1529
|
-
* @category errors
|
|
1530
|
-
* @since 4.0.0
|
|
1531
|
-
*/
|
|
1532
|
-
var ConstraintError = class extends (/*#__PURE__*/ TaggedError("effect/sql/SqlError/ConstraintError")("ConstraintError", ReasonFields)) {
|
|
1533
|
-
/**
|
|
1534
|
-
* Marks this value as a structured SQL error reason for runtime guards.
|
|
1535
|
-
*
|
|
1536
|
-
* @since 4.0.0
|
|
1537
|
-
*/
|
|
1006
|
+
var ConstraintError = class extends TaggedError$1("effect/sql/SqlError/ConstraintError")("ConstraintError", ReasonFields) {
|
|
1538
1007
|
[ReasonTypeId] = ReasonTypeId;
|
|
1539
|
-
/**
|
|
1540
|
-
* Indicates whether retrying the failed SQL operation may succeed.
|
|
1541
|
-
*
|
|
1542
|
-
* @since 4.0.0
|
|
1543
|
-
*/
|
|
1544
1008
|
get isRetryable() {
|
|
1545
1009
|
return false;
|
|
1546
1010
|
}
|
|
1547
1011
|
};
|
|
1548
|
-
|
|
1549
|
-
* SQL error reason for a database deadlock; marked retryable.
|
|
1550
|
-
*
|
|
1551
|
-
* @category errors
|
|
1552
|
-
* @since 4.0.0
|
|
1553
|
-
*/
|
|
1554
|
-
var DeadlockError = class extends (/*#__PURE__*/ TaggedError("effect/sql/SqlError/DeadlockError")("DeadlockError", ReasonFields)) {
|
|
1555
|
-
/**
|
|
1556
|
-
* Marks this value as a structured SQL error reason for runtime guards.
|
|
1557
|
-
*
|
|
1558
|
-
* @since 4.0.0
|
|
1559
|
-
*/
|
|
1012
|
+
var DeadlockError = class extends TaggedError$1("effect/sql/SqlError/DeadlockError")("DeadlockError", ReasonFields) {
|
|
1560
1013
|
[ReasonTypeId] = ReasonTypeId;
|
|
1561
|
-
/**
|
|
1562
|
-
* Indicates whether retrying the failed SQL operation may succeed.
|
|
1563
|
-
*
|
|
1564
|
-
* @since 4.0.0
|
|
1565
|
-
*/
|
|
1566
1014
|
get isRetryable() {
|
|
1567
1015
|
return true;
|
|
1568
1016
|
}
|
|
1569
1017
|
};
|
|
1570
|
-
|
|
1571
|
-
* SQL error reason for a transaction serialization or isolation conflict;
|
|
1572
|
-
* marked retryable.
|
|
1573
|
-
*
|
|
1574
|
-
* @category errors
|
|
1575
|
-
* @since 4.0.0
|
|
1576
|
-
*/
|
|
1577
|
-
var SerializationError = class extends (/*#__PURE__*/ TaggedError("effect/sql/SqlError/SerializationError")("SerializationError", ReasonFields)) {
|
|
1578
|
-
/**
|
|
1579
|
-
* Marks this value as a structured SQL error reason for runtime guards.
|
|
1580
|
-
*
|
|
1581
|
-
* @since 4.0.0
|
|
1582
|
-
*/
|
|
1018
|
+
var SerializationError = class extends TaggedError$1("effect/sql/SqlError/SerializationError")("SerializationError", ReasonFields) {
|
|
1583
1019
|
[ReasonTypeId] = ReasonTypeId;
|
|
1584
|
-
/**
|
|
1585
|
-
* Indicates whether retrying the failed SQL operation may succeed.
|
|
1586
|
-
*
|
|
1587
|
-
* @since 4.0.0
|
|
1588
|
-
*/
|
|
1589
1020
|
get isRetryable() {
|
|
1590
1021
|
return true;
|
|
1591
1022
|
}
|
|
1592
1023
|
};
|
|
1593
|
-
|
|
1594
|
-
* SQL error reason for timing out while waiting on a database lock; marked
|
|
1595
|
-
* retryable.
|
|
1596
|
-
*
|
|
1597
|
-
* @category errors
|
|
1598
|
-
* @since 4.0.0
|
|
1599
|
-
*/
|
|
1600
|
-
var LockTimeoutError = class extends (/*#__PURE__*/ TaggedError("effect/sql/SqlError/LockTimeoutError")("LockTimeoutError", ReasonFields)) {
|
|
1601
|
-
/**
|
|
1602
|
-
* Marks this value as a structured SQL error reason for runtime guards.
|
|
1603
|
-
*
|
|
1604
|
-
* @since 4.0.0
|
|
1605
|
-
*/
|
|
1024
|
+
var LockTimeoutError = class extends TaggedError$1("effect/sql/SqlError/LockTimeoutError")("LockTimeoutError", ReasonFields) {
|
|
1606
1025
|
[ReasonTypeId] = ReasonTypeId;
|
|
1607
|
-
/**
|
|
1608
|
-
* Indicates whether retrying the failed SQL operation may succeed.
|
|
1609
|
-
*
|
|
1610
|
-
* @since 4.0.0
|
|
1611
|
-
*/
|
|
1612
1026
|
get isRetryable() {
|
|
1613
1027
|
return true;
|
|
1614
1028
|
}
|
|
1615
1029
|
};
|
|
1616
|
-
|
|
1617
|
-
* SQL error reason for a statement or query timeout; marked retryable.
|
|
1618
|
-
*
|
|
1619
|
-
* @category errors
|
|
1620
|
-
* @since 4.0.0
|
|
1621
|
-
*/
|
|
1622
|
-
var StatementTimeoutError = class extends (/*#__PURE__*/ TaggedError("effect/sql/SqlError/StatementTimeoutError")("StatementTimeoutError", ReasonFields)) {
|
|
1623
|
-
/**
|
|
1624
|
-
* Marks this value as a structured SQL error reason for runtime guards.
|
|
1625
|
-
*
|
|
1626
|
-
* @since 4.0.0
|
|
1627
|
-
*/
|
|
1030
|
+
var StatementTimeoutError = class extends TaggedError$1("effect/sql/SqlError/StatementTimeoutError")("StatementTimeoutError", ReasonFields) {
|
|
1628
1031
|
[ReasonTypeId] = ReasonTypeId;
|
|
1629
|
-
/**
|
|
1630
|
-
* Indicates whether retrying the failed SQL operation may succeed.
|
|
1631
|
-
*
|
|
1632
|
-
* @since 4.0.0
|
|
1633
|
-
*/
|
|
1634
1032
|
get isRetryable() {
|
|
1635
1033
|
return true;
|
|
1636
1034
|
}
|
|
1637
1035
|
};
|
|
1638
|
-
|
|
1639
|
-
* SQL error reason for an unclassified database failure; not marked retryable.
|
|
1640
|
-
*
|
|
1641
|
-
* @category errors
|
|
1642
|
-
* @since 4.0.0
|
|
1643
|
-
*/
|
|
1644
|
-
var UnknownError = class extends (/*#__PURE__*/ TaggedError("effect/sql/SqlError/UnknownError")("UnknownError", ReasonFields)) {
|
|
1645
|
-
/**
|
|
1646
|
-
* Marks this value as a structured SQL error reason for runtime guards.
|
|
1647
|
-
*
|
|
1648
|
-
* @since 4.0.0
|
|
1649
|
-
*/
|
|
1036
|
+
var UnknownError = class extends TaggedError$1("effect/sql/SqlError/UnknownError")("UnknownError", ReasonFields) {
|
|
1650
1037
|
[ReasonTypeId] = ReasonTypeId;
|
|
1651
|
-
/**
|
|
1652
|
-
* Indicates whether retrying the failed SQL operation may succeed.
|
|
1653
|
-
*
|
|
1654
|
-
* @since 4.0.0
|
|
1655
|
-
*/
|
|
1656
1038
|
get isRetryable() {
|
|
1657
1039
|
return false;
|
|
1658
1040
|
}
|
|
1659
1041
|
};
|
|
1660
|
-
|
|
1661
|
-
* Schema for encoding and decoding SQL error reasons.
|
|
1662
|
-
*
|
|
1663
|
-
* @category schemas
|
|
1664
|
-
* @since 4.0.0
|
|
1665
|
-
*/
|
|
1666
|
-
const SqlErrorReason = /*#__PURE__*/ Union$2([
|
|
1042
|
+
const SqlErrorReason = Union$2([
|
|
1667
1043
|
ConnectionError,
|
|
1668
1044
|
AuthenticationError,
|
|
1669
1045
|
AuthorizationError,
|
|
@@ -1676,39 +1052,12 @@ const SqlErrorReason = /*#__PURE__*/ Union$2([
|
|
|
1676
1052
|
StatementTimeoutError,
|
|
1677
1053
|
UnknownError
|
|
1678
1054
|
]);
|
|
1679
|
-
|
|
1680
|
-
* Error wrapper for SQL failures whose `message`, `cause`, and `isRetryable`
|
|
1681
|
-
* values are derived from its `SqlErrorReason`.
|
|
1682
|
-
*
|
|
1683
|
-
* @category errors
|
|
1684
|
-
* @since 4.0.0
|
|
1685
|
-
*/
|
|
1686
|
-
var SqlError = class extends (/*#__PURE__*/ TaggedError("effect/sql/SqlError")("SqlError", { reason: SqlErrorReason })) {
|
|
1687
|
-
/**
|
|
1688
|
-
* Marks this value as the top-level SQL error wrapper for runtime guards.
|
|
1689
|
-
*
|
|
1690
|
-
* @since 4.0.0
|
|
1691
|
-
*/
|
|
1055
|
+
var SqlError = class extends TaggedError$1("effect/sql/SqlError")("SqlError", { reason: SqlErrorReason }) {
|
|
1692
1056
|
[TypeId$2] = TypeId$2;
|
|
1693
|
-
/**
|
|
1694
|
-
* Exposes the structured SQL reason as the JavaScript error cause.
|
|
1695
|
-
*
|
|
1696
|
-
* @since 4.0.0
|
|
1697
|
-
*/
|
|
1698
1057
|
cause = this.reason;
|
|
1699
|
-
/**
|
|
1700
|
-
* Uses the reason message when present, otherwise falls back to the reason tag.
|
|
1701
|
-
*
|
|
1702
|
-
* @since 4.0.0
|
|
1703
|
-
*/
|
|
1704
1058
|
get message() {
|
|
1705
1059
|
return this.reason.message || this.reason._tag;
|
|
1706
1060
|
}
|
|
1707
|
-
/**
|
|
1708
|
-
* Delegates retryability to the underlying SQL error reason.
|
|
1709
|
-
*
|
|
1710
|
-
* @since 4.0.0
|
|
1711
|
-
*/
|
|
1712
1061
|
get isRetryable() {
|
|
1713
1062
|
return this.reason.isRetryable;
|
|
1714
1063
|
}
|
|
@@ -1747,13 +1096,6 @@ const sqliteUniqueConstraintFromCause = (cause) => {
|
|
|
1747
1096
|
const index = message.indexOf("UNIQUE constraint failed:");
|
|
1748
1097
|
return index === -1 ? UNKNOWN_CONSTRAINT : normalizeConstraintIdentifier(message.slice(index + 25));
|
|
1749
1098
|
};
|
|
1750
|
-
/**
|
|
1751
|
-
* Classifies a native SQLite error cause into a `SqlErrorReason` using its
|
|
1752
|
-
* `code` or `errno`, with optional message and operation metadata.
|
|
1753
|
-
*
|
|
1754
|
-
* @category converting
|
|
1755
|
-
* @since 4.0.0
|
|
1756
|
-
*/
|
|
1757
1099
|
const classifySqliteError = (cause, { message, operation } = {}) => {
|
|
1758
1100
|
const props = {
|
|
1759
1101
|
cause,
|
|
@@ -1784,42 +1126,18 @@ const classifySqliteError = (cause, { message, operation } = {}) => {
|
|
|
1784
1126
|
}
|
|
1785
1127
|
return new UnknownError(props);
|
|
1786
1128
|
};
|
|
1787
|
-
|
|
1788
|
-
* Error raised when an ordered batched SQL resolver receives a different number
|
|
1789
|
-
* of result rows than requests.
|
|
1790
|
-
*
|
|
1791
|
-
* @category errors
|
|
1792
|
-
* @since 4.0.0
|
|
1793
|
-
*/
|
|
1794
|
-
var ResultLengthMismatch = class extends (/*#__PURE__*/ TaggedError("effect/sql/ResultLengthMismatch")("ResultLengthMismatch", {
|
|
1129
|
+
var ResultLengthMismatch = class extends TaggedError$1("effect/sql/ResultLengthMismatch")("ResultLengthMismatch", {
|
|
1795
1130
|
expected: Natural,
|
|
1796
1131
|
actual: Natural
|
|
1797
|
-
})
|
|
1798
|
-
/**
|
|
1799
|
-
* Explains the mismatch between expected and actual batched SQL result counts.
|
|
1800
|
-
*
|
|
1801
|
-
* @since 4.0.0
|
|
1802
|
-
*/
|
|
1132
|
+
}) {
|
|
1803
1133
|
get message() {
|
|
1804
1134
|
return `Expected ${this.expected} results but got ${this.actual}`;
|
|
1805
1135
|
}
|
|
1806
1136
|
};
|
|
1807
1137
|
//#endregion
|
|
1808
1138
|
//#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/sql/SqlResolver.js
|
|
1809
|
-
/**
|
|
1810
|
-
* Schema-aware `RequestResolver` helpers for SQL-backed data loading.
|
|
1811
|
-
*
|
|
1812
|
-
* This module represents each lookup or mutation as a `SqlRequest` and batches
|
|
1813
|
-
* concurrent requests into SQL operations. Request payloads are encoded with the
|
|
1814
|
-
* request schema before `execute` is called, and returned rows are decoded with
|
|
1815
|
-
* the result schema before requests are completed. It provides ordered,
|
|
1816
|
-
* grouped, id-based, and side-effect-only resolver constructors, and keeps
|
|
1817
|
-
* batches separated by the active SQL transaction connection.
|
|
1818
|
-
*
|
|
1819
|
-
* @since 4.0.0
|
|
1820
|
-
*/
|
|
1821
1139
|
const SqlRequestProto = {
|
|
1822
|
-
...Class$
|
|
1140
|
+
...Class$1.prototype,
|
|
1823
1141
|
[symbol](that) {
|
|
1824
1142
|
return equals(this.payload, that.payload);
|
|
1825
1143
|
},
|
|
@@ -1827,13 +1145,6 @@ const SqlRequestProto = {
|
|
|
1827
1145
|
return hash(this.payload);
|
|
1828
1146
|
}
|
|
1829
1147
|
};
|
|
1830
|
-
/**
|
|
1831
|
-
* Runs a payload as a `SqlRequest` through a request resolver, either directly
|
|
1832
|
-
* with a payload and resolver or curried by resolver.
|
|
1833
|
-
*
|
|
1834
|
-
* @category running
|
|
1835
|
-
* @since 4.0.0
|
|
1836
|
-
*/
|
|
1837
1148
|
const request = function() {
|
|
1838
1149
|
if (arguments.length === 1) {
|
|
1839
1150
|
const resolver = arguments[0];
|
|
@@ -1841,31 +1152,11 @@ const request = function() {
|
|
|
1841
1152
|
}
|
|
1842
1153
|
return request$1(SqlRequest(arguments[0]), arguments[1]);
|
|
1843
1154
|
};
|
|
1844
|
-
/**
|
|
1845
|
-
* Constructs a `SqlRequest` from a payload. Equality and hashing are based on
|
|
1846
|
-
* the payload so equal requests can be batched and deduplicated.
|
|
1847
|
-
*
|
|
1848
|
-
* @category constructors
|
|
1849
|
-
* @since 4.0.0
|
|
1850
|
-
*/
|
|
1851
1155
|
const SqlRequest = (payload) => {
|
|
1852
1156
|
const self = Object.create(SqlRequestProto);
|
|
1853
1157
|
self.payload = payload;
|
|
1854
1158
|
return self;
|
|
1855
1159
|
};
|
|
1856
|
-
/**
|
|
1857
|
-
* Creates a resolver for a SQL query with a request schema and a result schema.
|
|
1858
|
-
*
|
|
1859
|
-
* **Details**
|
|
1860
|
-
*
|
|
1861
|
-
* The request schema is used to validate the input of the query, and the result
|
|
1862
|
-
* schema is used to validate the output of the query. Results are mapped to the
|
|
1863
|
-
* requests in order, so the length of the results must match the length of the
|
|
1864
|
-
* requests.
|
|
1865
|
-
*
|
|
1866
|
-
* @category resolvers
|
|
1867
|
-
* @since 4.0.0
|
|
1868
|
-
*/
|
|
1869
1160
|
const ordered = (options) => {
|
|
1870
1161
|
const decodeArray = decodeUnknownEffect(ArraySchema(options.Result));
|
|
1871
1162
|
return makeGrouped({
|
|
@@ -1883,14 +1174,6 @@ const ordered = (options) => {
|
|
|
1883
1174
|
})
|
|
1884
1175
|
});
|
|
1885
1176
|
};
|
|
1886
|
-
/**
|
|
1887
|
-
* Creates a batched resolver that fetches rows for encoded ids, decodes
|
|
1888
|
-
* results, completes each matching request using `ResultId`, and fails missing
|
|
1889
|
-
* ids with `NoSuchElementError`.
|
|
1890
|
-
*
|
|
1891
|
-
* @category resolvers
|
|
1892
|
-
* @since 4.0.0
|
|
1893
|
-
*/
|
|
1894
1177
|
const findById = (options) => {
|
|
1895
1178
|
const decodeResults = decodeUnknownEffect(ArraySchema(options.Result));
|
|
1896
1179
|
return makeGrouped({
|
|
@@ -1924,7 +1207,7 @@ const void_ = (options) => makeGrouped({
|
|
|
1924
1207
|
for (let i = 0; i < entries.length; i++) entries[i].completeUnsafe(void_$3);
|
|
1925
1208
|
})
|
|
1926
1209
|
});
|
|
1927
|
-
const constNoSuchElement =
|
|
1210
|
+
const constNoSuchElement = fail(new NoSuchElementError());
|
|
1928
1211
|
const partitionRequests = function* (requests, schema) {
|
|
1929
1212
|
const len = requests.length;
|
|
1930
1213
|
const inputs = empty();
|
|
@@ -1984,20 +1267,6 @@ function transactionKey(entry) {
|
|
|
1984
1267
|
}
|
|
1985
1268
|
//#endregion
|
|
1986
1269
|
//#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/sql/SqlSchema.js
|
|
1987
|
-
/**
|
|
1988
|
-
* Builds a query function that encodes the request and decodes all result rows,
|
|
1989
|
-
* allowing an empty result set.
|
|
1990
|
-
*
|
|
1991
|
-
* **When to use**
|
|
1992
|
-
*
|
|
1993
|
-
* Use when you need to run a query that may return zero or more rows and
|
|
1994
|
-
* represent an empty result as an empty array.
|
|
1995
|
-
*
|
|
1996
|
-
* @see {@link findNonEmpty} for queries where an empty result is a failure
|
|
1997
|
-
*
|
|
1998
|
-
* @category constructors
|
|
1999
|
-
* @since 4.0.0
|
|
2000
|
-
*/
|
|
2001
1270
|
const findAll = (options) => {
|
|
2002
1271
|
const encodeRequest = encodeEffect(options.Request);
|
|
2003
1272
|
const decode = decodeUnknownEffect(mutable(ArraySchema(options.Result)));
|
|
@@ -2005,13 +1274,6 @@ const findAll = (options) => {
|
|
|
2005
1274
|
};
|
|
2006
1275
|
//#endregion
|
|
2007
1276
|
//#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/sql/SqlModel.js
|
|
2008
|
-
/**
|
|
2009
|
-
* Creates batched request resolvers for a schema model's insert, insert-void,
|
|
2010
|
-
* find-by-id, and delete operations, honoring the optional soft-delete column.
|
|
2011
|
-
*
|
|
2012
|
-
* @category constructors
|
|
2013
|
-
* @since 4.0.0
|
|
2014
|
-
*/
|
|
2015
1277
|
const makeResolvers = (Model, options) => gen(function* () {
|
|
2016
1278
|
const sql = yield* SqlClient;
|
|
2017
1279
|
const idSchema = Model.fields[options.idColumn];
|
|
@@ -2049,44 +1311,19 @@ select * from ${sql(options.tableName)} where ${withSoftDeleteFilter(sql`${sql(i
|
|
|
2049
1311
|
});
|
|
2050
1312
|
//#endregion
|
|
2051
1313
|
//#region src/ChunkRepo.ts
|
|
2052
|
-
|
|
2053
|
-
/**
|
|
2054
|
-
* @since 1.0.0
|
|
2055
|
-
* @category Models
|
|
2056
|
-
*/
|
|
2057
|
-
const ChunkId = Number$1.pipe(brand("ChunkRepo/ChunkId"));
|
|
2058
|
-
/**
|
|
2059
|
-
* @since 1.0.0
|
|
2060
|
-
* @category Models
|
|
2061
|
-
*/
|
|
1314
|
+
const ChunkId = Number$2.pipe(brand("ChunkRepo/ChunkId"));
|
|
2062
1315
|
const SyncId = String$1.pipe(brand("ChunkRepo/SyncId"));
|
|
2063
|
-
/**
|
|
2064
|
-
* @since 1.0.0
|
|
2065
|
-
* @category Models
|
|
2066
|
-
*/
|
|
2067
1316
|
const Float32ArraySchema = instanceOf(Float32Array);
|
|
2068
|
-
|
|
2069
|
-
* @since 1.0.0
|
|
2070
|
-
* @category Models
|
|
2071
|
-
*/
|
|
2072
|
-
const Float32ArrayFromArray = ArraySchema(Number$1).pipe(decodeTo(Float32ArraySchema, transform$1({
|
|
1317
|
+
const Float32ArrayFromArray = ArraySchema(Number$2).pipe(decodeTo(Float32ArraySchema, transform$1({
|
|
2073
1318
|
decode: (arr) => new Float32Array(arr),
|
|
2074
1319
|
encode: (array) => Array.from(array)
|
|
2075
1320
|
})));
|
|
2076
|
-
/**
|
|
2077
|
-
* @since 1.0.0
|
|
2078
|
-
* @category Models
|
|
2079
|
-
*/
|
|
2080
1321
|
const Float32ArrayField = Field({
|
|
2081
1322
|
insert: Float32ArraySchema,
|
|
2082
1323
|
update: Float32ArraySchema,
|
|
2083
1324
|
jsonCreate: Float32ArrayFromArray,
|
|
2084
1325
|
jsonUpdate: Float32ArrayFromArray
|
|
2085
1326
|
});
|
|
2086
|
-
/**
|
|
2087
|
-
* @since 1.0.0
|
|
2088
|
-
* @category Models
|
|
2089
|
-
*/
|
|
2090
1327
|
var Chunk = class extends Class("Chunk")({
|
|
2091
1328
|
id: ChunkId.pipe(FieldExcept(["insert", "jsonCreate"])),
|
|
2092
1329
|
path: String$1,
|
|
@@ -2095,23 +1332,11 @@ var Chunk = class extends Class("Chunk")({
|
|
|
2095
1332
|
vector: Float32ArrayField,
|
|
2096
1333
|
syncId: SyncId
|
|
2097
1334
|
}) {};
|
|
2098
|
-
/**
|
|
2099
|
-
* @since 1.0.0
|
|
2100
|
-
* @category Services
|
|
2101
|
-
*/
|
|
2102
1335
|
var ChunkRepo = class extends Service()("clanka/ChunkRepo") {};
|
|
2103
|
-
|
|
2104
|
-
* @since 1.0.0
|
|
2105
|
-
* @category Errors
|
|
2106
|
-
*/
|
|
2107
|
-
var ChunkRepoError = class extends TaggedError()("ChunkRepoError", { reason: Union$2([SqlError]) }) {
|
|
1336
|
+
var ChunkRepoError = class extends TaggedError$1()("ChunkRepoError", { reason: Union$2([SqlError]) }) {
|
|
2108
1337
|
cause = this.reason;
|
|
2109
1338
|
message = this.reason.message;
|
|
2110
1339
|
};
|
|
2111
|
-
/**
|
|
2112
|
-
* @since 1.0.0
|
|
2113
|
-
* @category Layers
|
|
2114
|
-
*/
|
|
2115
1340
|
const layer$4 = effect(ChunkRepo, gen(function* () {
|
|
2116
1341
|
const sql = yield* SqlClient;
|
|
2117
1342
|
const dimensions = yield* Dimensions;
|
|
@@ -2149,7 +1374,7 @@ const layer$4 = effect(ChunkRepo, gen(function* () {
|
|
|
2149
1374
|
const search = findAll({
|
|
2150
1375
|
Request: Struct$2({
|
|
2151
1376
|
vector: Float32ArraySchema,
|
|
2152
|
-
limit: Number$
|
|
1377
|
+
limit: Number$2
|
|
2153
1378
|
}),
|
|
2154
1379
|
Result: Chunk,
|
|
2155
1380
|
execute: ({ vector, limit }) => sql`
|
|
@@ -2201,15 +1426,8 @@ const layer$4 = effect(ChunkRepo, gen(function* () {
|
|
|
2201
1426
|
}));
|
|
2202
1427
|
//#endregion
|
|
2203
1428
|
//#region src/CodeChunker.ts
|
|
2204
|
-
/**
|
|
2205
|
-
* @since 1.0.0
|
|
2206
|
-
*/
|
|
2207
|
-
/**
|
|
2208
|
-
* @since 1.0.0
|
|
2209
|
-
* @category Services
|
|
2210
|
-
*/
|
|
2211
1429
|
var CodeChunker = class extends Service()("clanka/CodeChunker") {};
|
|
2212
|
-
const sourceExtensions =
|
|
1430
|
+
const sourceExtensions = new Set([
|
|
2213
1431
|
"c",
|
|
2214
1432
|
"cc",
|
|
2215
1433
|
"cpp",
|
|
@@ -2250,7 +1468,7 @@ const sourceExtensions = /* @__PURE__ */ new Set([
|
|
|
2250
1468
|
"xml",
|
|
2251
1469
|
"zsh"
|
|
2252
1470
|
]);
|
|
2253
|
-
const documentationExtensions =
|
|
1471
|
+
const documentationExtensions = new Set([
|
|
2254
1472
|
"adoc",
|
|
2255
1473
|
"asciidoc",
|
|
2256
1474
|
"md",
|
|
@@ -2258,7 +1476,7 @@ const documentationExtensions = /* @__PURE__ */ new Set([
|
|
|
2258
1476
|
"rst",
|
|
2259
1477
|
"txt"
|
|
2260
1478
|
]);
|
|
2261
|
-
const ignoredDirectories =
|
|
1479
|
+
const ignoredDirectories = new Set([
|
|
2262
1480
|
".git",
|
|
2263
1481
|
".next",
|
|
2264
1482
|
".nuxt",
|
|
@@ -2274,16 +1492,12 @@ const normalizePath$1 = (path) => path.replace(/\\/g, "/");
|
|
|
2274
1492
|
const normalizeText = (content) => content.replace(/\r\n/g, "\n").replace(/\r/g, "\n");
|
|
2275
1493
|
const meaningfulLinePattern = /[^\s\p{P}]/u;
|
|
2276
1494
|
const isMeaningfulLine = (line) => meaningfulLinePattern.test(line);
|
|
2277
|
-
const languageByExtension =
|
|
1495
|
+
const languageByExtension = new Map([
|
|
2278
1496
|
["js", TreeSitterJavaScript],
|
|
2279
1497
|
["jsx", TreeSitterJavaScript],
|
|
2280
1498
|
["ts", TreeSitterTypeScript.typescript],
|
|
2281
1499
|
["tsx", TreeSitterTypeScript.tsx]
|
|
2282
1500
|
]);
|
|
2283
|
-
/**
|
|
2284
|
-
* @since 1.0.0
|
|
2285
|
-
* @category Predicates
|
|
2286
|
-
*/
|
|
2287
1501
|
const isProbablyMinified = (content) => {
|
|
2288
1502
|
const normalized = normalizeText(content);
|
|
2289
1503
|
if (normalized.length < 2e3) return false;
|
|
@@ -2293,10 +1507,6 @@ const isProbablyMinified = (content) => {
|
|
|
2293
1507
|
for (const line of lines) if (line.length >= 300) longLines++;
|
|
2294
1508
|
return lines.length <= 20 && longLines / lines.length >= .8;
|
|
2295
1509
|
};
|
|
2296
|
-
/**
|
|
2297
|
-
* @since 1.0.0
|
|
2298
|
-
* @category Predicates
|
|
2299
|
-
*/
|
|
2300
1510
|
const isMeaningfulFile = (path) => {
|
|
2301
1511
|
const parts = normalizePath$1(path).toLowerCase().split("/");
|
|
2302
1512
|
const fileName = parts.at(-1);
|
|
@@ -2538,7 +1748,7 @@ const chunksFromRanges = (path, lines, ranges, settings) => {
|
|
|
2538
1748
|
return ranges.some((range) => range.type === "method" && range.parent === parent && range.startLine >= classRange.startLine && range.endLine <= classRange.endLine);
|
|
2539
1749
|
};
|
|
2540
1750
|
const out = [];
|
|
2541
|
-
const seen =
|
|
1751
|
+
const seen = new Set();
|
|
2542
1752
|
const prefixSums = lineLengthPrefixSums(lines);
|
|
2543
1753
|
for (const range of ranges) {
|
|
2544
1754
|
const normalizedRange = normalizeLineRange(range, lines.length);
|
|
@@ -2607,10 +1817,6 @@ const splitOversizedChunks = (chunks, maxCharacters) => chunks.flatMap((chunk) =
|
|
|
2607
1817
|
});
|
|
2608
1818
|
return pieces;
|
|
2609
1819
|
});
|
|
2610
|
-
/**
|
|
2611
|
-
* @since 1.0.0
|
|
2612
|
-
* @category Constructors
|
|
2613
|
-
*/
|
|
2614
1820
|
const chunkFileContent = (path, content, options) => {
|
|
2615
1821
|
if (content.trim().length === 0 || isProbablyMinified(content)) return [];
|
|
2616
1822
|
const normalizedPath = normalizePath$1(path);
|
|
@@ -2626,10 +1832,6 @@ const chunkFileContent = (path, content, options) => {
|
|
|
2626
1832
|
}
|
|
2627
1833
|
return splitOversizedChunks(chunkWithLineWindows(normalizedPath, lines, settings), settings.chunkMaxCharacters);
|
|
2628
1834
|
};
|
|
2629
|
-
/**
|
|
2630
|
-
* @since 1.0.0
|
|
2631
|
-
* @category Layers
|
|
2632
|
-
*/
|
|
2633
1835
|
const layer$3 = effect(CodeChunker, gen(function* () {
|
|
2634
1836
|
const spawner = yield* ChildProcessSpawner;
|
|
2635
1837
|
const fs = yield* FileSystem;
|
|
@@ -2637,7 +1839,7 @@ const layer$3 = effect(CodeChunker, gen(function* () {
|
|
|
2637
1839
|
const listFiles = fn("CodeChunker.listFiles")(function* (options) {
|
|
2638
1840
|
const root = pathService.resolve(options.root);
|
|
2639
1841
|
const maxFileSize = options.maxFileSize ?? "1M";
|
|
2640
|
-
return yield* pipe(spawner.streamLines(make$
|
|
1842
|
+
return yield* pipe(spawner.streamLines(make$14("rg", [
|
|
2641
1843
|
"--files",
|
|
2642
1844
|
"--hidden",
|
|
2643
1845
|
"--max-filesize",
|
|
@@ -2686,41 +1888,7 @@ const layer$3 = effect(CodeChunker, gen(function* () {
|
|
|
2686
1888
|
}));
|
|
2687
1889
|
//#endregion
|
|
2688
1890
|
//#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/FiberHandle.js
|
|
2689
|
-
/**
|
|
2690
|
-
* Manages at most one fiber inside a scope.
|
|
2691
|
-
*
|
|
2692
|
-
* A `FiberHandle<A, E>` can hold one `Fiber<A, E>`. Installing a new fiber
|
|
2693
|
-
* interrupts the previous one unless the operation is configured with
|
|
2694
|
-
* `onlyIfMissing`, and closing the owning scope interrupts the current fiber.
|
|
2695
|
-
* This module includes constructors for handles and scoped runtimes, helpers
|
|
2696
|
-
* for setting, reading, clearing, and running fibers, and operations for joining
|
|
2697
|
-
* the current fiber or waiting until the handle is empty.
|
|
2698
|
-
*
|
|
2699
|
-
* @since 2.0.0
|
|
2700
|
-
*/
|
|
2701
1891
|
const TypeId$1 = "~effect/FiberHandle";
|
|
2702
|
-
/**
|
|
2703
|
-
* Returns `true` if a value is a `FiberHandle` by checking for the
|
|
2704
|
-
* `FiberHandle` runtime marker.
|
|
2705
|
-
*
|
|
2706
|
-
* **Example** (Checking fiber handles)
|
|
2707
|
-
*
|
|
2708
|
-
* ```ts import.meta.vitest
|
|
2709
|
-
* import { Effect, FiberHandle } from "effect"
|
|
2710
|
-
*
|
|
2711
|
-
* const program = Effect.gen(function*() {
|
|
2712
|
-
* const handle = yield* FiberHandle.make()
|
|
2713
|
-
*
|
|
2714
|
-
* return [FiberHandle.isFiberHandle(handle), FiberHandle.isFiberHandle("not a handle")]
|
|
2715
|
-
* })
|
|
2716
|
-
*
|
|
2717
|
-
* const actual = await Effect.runPromise(Effect.scoped(program))
|
|
2718
|
-
* actual // => [true, false]
|
|
2719
|
-
* ```
|
|
2720
|
-
*
|
|
2721
|
-
* @category guards
|
|
2722
|
-
* @since 2.0.0
|
|
2723
|
-
*/
|
|
2724
1892
|
const isFiberHandle = (u) => hasProperty(u, TypeId$1);
|
|
2725
1893
|
const Proto = {
|
|
2726
1894
|
[TypeId$1]: TypeId$1,
|
|
@@ -2741,42 +1909,6 @@ const makeUnsafe = () => {
|
|
|
2741
1909
|
self.deferred = makeUnsafe$2();
|
|
2742
1910
|
return self;
|
|
2743
1911
|
};
|
|
2744
|
-
/**
|
|
2745
|
-
* Creates a scoped `FiberHandle` that can store a single fiber.
|
|
2746
|
-
*
|
|
2747
|
-
* **Details**
|
|
2748
|
-
*
|
|
2749
|
-
* When the associated `Scope` is closed, the contained fiber will be
|
|
2750
|
-
* interrupted. You can add a fiber to the handle using `FiberHandle.run`, and
|
|
2751
|
-
* the fiber will be automatically removed from the `FiberHandle` when it
|
|
2752
|
-
* completes.
|
|
2753
|
-
*
|
|
2754
|
-
* **Example** (Creating a scoped fiber handle)
|
|
2755
|
-
*
|
|
2756
|
-
* ```ts import.meta.vitest
|
|
2757
|
-
* import { Effect, FiberHandle } from "effect"
|
|
2758
|
-
*
|
|
2759
|
-
* const program = Effect.gen(function*() {
|
|
2760
|
-
* const handle = yield* FiberHandle.make()
|
|
2761
|
-
*
|
|
2762
|
-
* // run some effects
|
|
2763
|
-
* yield* FiberHandle.run(handle, Effect.never)
|
|
2764
|
-
* // this will interrupt the previous fiber
|
|
2765
|
-
* yield* FiberHandle.run(handle, Effect.never)
|
|
2766
|
-
*
|
|
2767
|
-
* yield* Effect.yieldNow
|
|
2768
|
-
* return handle.state._tag === "Open" && handle.state.fiber !== undefined
|
|
2769
|
-
* }).pipe(
|
|
2770
|
-
* Effect.scoped // The fiber will be interrupted when the scope is closed
|
|
2771
|
-
* )
|
|
2772
|
-
*
|
|
2773
|
-
* const actual = await Effect.runPromise(program)
|
|
2774
|
-
* actual // => true
|
|
2775
|
-
* ```
|
|
2776
|
-
*
|
|
2777
|
-
* @category constructors
|
|
2778
|
-
* @since 2.0.0
|
|
2779
|
-
*/
|
|
2780
1912
|
const make$2 = () => acquireRelease(sync(() => makeUnsafe()), (handle) => {
|
|
2781
1913
|
const state = handle.state;
|
|
2782
1914
|
if (state._tag === "Closed") return void_$1;
|
|
@@ -2784,40 +1916,8 @@ const make$2 = () => acquireRelease(sync(() => makeUnsafe()), (handle) => {
|
|
|
2784
1916
|
return state.fiber ? into(asVoid(interruptAs(state.fiber, internalFiberId)), handle.deferred) : done(handle.deferred, void_$3);
|
|
2785
1917
|
});
|
|
2786
1918
|
const internalFiberId = -1;
|
|
2787
|
-
const isInternalInterruption =
|
|
2788
|
-
|
|
2789
|
-
* Sets the fiber in a FiberHandle. When the fiber completes, it will be removed from the FiberHandle.
|
|
2790
|
-
* If a fiber is already running, it will be interrupted unless `options.onlyIfMissing` is set.
|
|
2791
|
-
*
|
|
2792
|
-
* **When to use**
|
|
2793
|
-
*
|
|
2794
|
-
* Use when an existing forked fiber must be installed synchronously into a
|
|
2795
|
-
* handle and immediate interruption of replaced or closed fibers is acceptable.
|
|
2796
|
-
*
|
|
2797
|
-
* **Example** (Setting a fiber unsafely)
|
|
2798
|
-
*
|
|
2799
|
-
* ```ts import.meta.vitest
|
|
2800
|
-
* import { Effect, Fiber, FiberHandle } from "effect"
|
|
2801
|
-
*
|
|
2802
|
-
* const program = Effect.gen(function*() {
|
|
2803
|
-
* const handle = yield* FiberHandle.make()
|
|
2804
|
-
* const fiber = Effect.runFork(Effect.succeed("hello"))
|
|
2805
|
-
*
|
|
2806
|
-
* // Set the fiber directly (unsafe)
|
|
2807
|
-
* FiberHandle.setUnsafe(handle, fiber)
|
|
2808
|
-
*
|
|
2809
|
-
* // The fiber is now managed by the handle
|
|
2810
|
-
* return yield* Fiber.join(fiber)
|
|
2811
|
-
* })
|
|
2812
|
-
*
|
|
2813
|
-
* const actual = await Effect.runPromise(Effect.scoped(program))
|
|
2814
|
-
* actual // => "hello"
|
|
2815
|
-
* ```
|
|
2816
|
-
*
|
|
2817
|
-
* @category combinators
|
|
2818
|
-
* @since 4.0.0
|
|
2819
|
-
*/
|
|
2820
|
-
const setUnsafe = /*#__PURE__*/ dual((args) => isFiberHandle(args[0]), (self, fiber, options) => {
|
|
1919
|
+
const isInternalInterruption = toPredicate(compose(filterInterruptors, has(internalFiberId)));
|
|
1920
|
+
const setUnsafe = dual((args) => isFiberHandle(args[0]), (self, fiber, options) => {
|
|
2821
1921
|
if (self.state._tag === "Closed") {
|
|
2822
1922
|
fiber.interruptUnsafe(internalFiberId);
|
|
2823
1923
|
return;
|
|
@@ -2836,47 +1936,13 @@ const setUnsafe = /*#__PURE__*/ dual((args) => isFiberHandle(args[0]), (self, fi
|
|
|
2836
1936
|
if (isFailure(exit) && (options?.propagateInterruption === true ? !isInternalInterruption(exit.cause) : !hasInterruptsOnly(exit.cause))) doneUnsafe(self.deferred, exit);
|
|
2837
1937
|
});
|
|
2838
1938
|
});
|
|
2839
|
-
const constInterruptedFiber =
|
|
1939
|
+
const constInterruptedFiber = function() {
|
|
2840
1940
|
let fiber = void 0;
|
|
2841
1941
|
return () => {
|
|
2842
1942
|
if (fiber === void 0) fiber = runFork(interrupt);
|
|
2843
1943
|
return fiber;
|
|
2844
1944
|
};
|
|
2845
1945
|
}();
|
|
2846
|
-
/**
|
|
2847
|
-
* Forks an Effect and stores the resulting fiber in the `FiberHandle`.
|
|
2848
|
-
*
|
|
2849
|
-
* **Details**
|
|
2850
|
-
*
|
|
2851
|
-
* The handle manages only one fiber: running a new effect interrupts the
|
|
2852
|
-
* previous fiber unless `onlyIfMissing` is set. When the managed fiber
|
|
2853
|
-
* completes, it is removed from the handle.
|
|
2854
|
-
*
|
|
2855
|
-
* **Example** (Running an effect in a fiber handle)
|
|
2856
|
-
*
|
|
2857
|
-
* ```ts import.meta.vitest
|
|
2858
|
-
* import { Effect, Fiber, FiberHandle } from "effect"
|
|
2859
|
-
*
|
|
2860
|
-
* const program = Effect.gen(function*() {
|
|
2861
|
-
* const handle = yield* FiberHandle.make()
|
|
2862
|
-
*
|
|
2863
|
-
* // Run an effect and get the fiber
|
|
2864
|
-
* const fiber = yield* FiberHandle.run(handle, Effect.succeed("hello"))
|
|
2865
|
-
* const result = yield* Fiber.join(fiber)
|
|
2866
|
-
*
|
|
2867
|
-
* // Running another effect will interrupt the previous one
|
|
2868
|
-
* const fiber2 = yield* FiberHandle.run(handle, Effect.succeed("world"))
|
|
2869
|
-
* const result2 = yield* Fiber.join(fiber2)
|
|
2870
|
-
* return [result, result2]
|
|
2871
|
-
* })
|
|
2872
|
-
*
|
|
2873
|
-
* const actual = await Effect.runPromise(Effect.scoped(program))
|
|
2874
|
-
* actual // => ["hello", "world"]
|
|
2875
|
-
* ```
|
|
2876
|
-
*
|
|
2877
|
-
* @category combinators
|
|
2878
|
-
* @since 2.0.0
|
|
2879
|
-
*/
|
|
2880
1946
|
const run$1 = function() {
|
|
2881
1947
|
const self = arguments[0];
|
|
2882
1948
|
if (isEffect(arguments[1])) return runImpl(self, arguments[1], arguments[2]);
|
|
@@ -2892,44 +1958,10 @@ const runImpl = (self, effect, options) => withFiber((parent) => {
|
|
|
2892
1958
|
});
|
|
2893
1959
|
//#endregion
|
|
2894
1960
|
//#region node_modules/.pnpm/@effect+sql-sqlite-node@4.0.0-rc.115_effect@4.0.0-rc.115/node_modules/@effect/sql-sqlite-node/dist/SqliteClient.js
|
|
2895
|
-
/**
|
|
2896
|
-
* Connects Effect SQL to SQLite on Node.js using `node:sqlite`.
|
|
2897
|
-
*
|
|
2898
|
-
* This module opens a SQLite database and exposes it as both `SqliteClient` and
|
|
2899
|
-
* the generic Effect SQL client. It serializes access through one connection,
|
|
2900
|
-
* caches prepared statements, enables WAL mode unless disabled, and waits up
|
|
2901
|
-
* to five seconds for busy databases by default. Explicit transactions on
|
|
2902
|
-
* writable connections use `BEGIN IMMEDIATE` to avoid read-to-write lock
|
|
2903
|
-
* upgrades, which serializes them behind other writers even when they only
|
|
2904
|
-
* read. Clients opened with `readonly: true` are unaffected. Busy waits block
|
|
2905
|
-
* the Node.js event loop because `node:sqlite` is synchronous. Database backup
|
|
2906
|
-
* and extension loading are supported; streaming queries and `updateValues`
|
|
2907
|
-
* are not.
|
|
2908
|
-
*
|
|
2909
|
-
* @since 4.0.0
|
|
2910
|
-
*/
|
|
2911
1961
|
const ATTR_DB_SYSTEM_NAME = "db.system.name";
|
|
2912
1962
|
const MAX_BUSY_TIMEOUT = 2147483647;
|
|
2913
|
-
/**
|
|
2914
|
-
* Runtime type identifier used to mark Node `SqliteClient` values.
|
|
2915
|
-
*
|
|
2916
|
-
* @category type IDs
|
|
2917
|
-
* @since 4.0.0
|
|
2918
|
-
*/
|
|
2919
1963
|
const TypeId = "~@effect/sql-sqlite-node/SqliteClient";
|
|
2920
|
-
|
|
2921
|
-
* Service tag for the node SQLite client implementation.
|
|
2922
|
-
*
|
|
2923
|
-
* @category services
|
|
2924
|
-
* @since 4.0.0
|
|
2925
|
-
*/
|
|
2926
|
-
const SqliteClient = /*#__PURE__*/ Service("@effect/sql-sqlite-node/SqliteClient");
|
|
2927
|
-
/**
|
|
2928
|
-
* Creates a scoped node SQLite client from the supplied configuration, using a single serialized connection with WAL and a 5-second busy timeout enabled by default. Explicit transactions on writable connections take the write lock for their duration, even when they only read; clients opened with `readonly: true` are unaffected.
|
|
2929
|
-
*
|
|
2930
|
-
* @category constructors
|
|
2931
|
-
* @since 4.0.0
|
|
2932
|
-
*/
|
|
1964
|
+
const SqliteClient = Service("@effect/sql-sqlite-node/SqliteClient");
|
|
2933
1965
|
const make$1 = (options) => gen(function* () {
|
|
2934
1966
|
const compiler = makeCompilerSqlite(options.transformQueryNames);
|
|
2935
1967
|
const transformRows = options.transformResultNames ? defaultTransforms(options.transformResultNames).array : void 0;
|
|
@@ -3041,7 +2073,7 @@ const make$1 = (options) => gen(function* () {
|
|
|
3041
2073
|
}
|
|
3042
2074
|
});
|
|
3043
2075
|
});
|
|
3044
|
-
const semaphore = yield* make$
|
|
2076
|
+
const semaphore = yield* make$12(1);
|
|
3045
2077
|
const connection = yield* makeConnection;
|
|
3046
2078
|
const acquirer = semaphore.withPermits(1)(succeed(connection));
|
|
3047
2079
|
const transactionAcquirer = uninterruptibleMask((restore) => {
|
|
@@ -3063,12 +2095,6 @@ const make$1 = (options) => gen(function* () {
|
|
|
3063
2095
|
loadExtension: (path) => flatMap(acquirer, (_) => _.loadExtension(path))
|
|
3064
2096
|
});
|
|
3065
2097
|
});
|
|
3066
|
-
/**
|
|
3067
|
-
* Builds a layer from a node SQLite client configuration, providing both `SqliteClient` and the generic `SqlClient` service.
|
|
3068
|
-
*
|
|
3069
|
-
* @category layers
|
|
3070
|
-
* @since 4.0.0
|
|
3071
|
-
*/
|
|
3072
2098
|
const layer$2 = (config) => effectContext(map(make$1(config), (client) => make$9(SqliteClient, client).pipe(add(SqlClient, client)))).pipe(provide$1(layer$5));
|
|
3073
2099
|
const classifyError = (cause, message, operation) => classifySqliteError(sqliteCauseWithErrno(cause), {
|
|
3074
2100
|
message,
|
|
@@ -3080,21 +2106,15 @@ const sqliteCauseWithErrno = (cause) => {
|
|
|
3080
2106
|
if (typeof errcode !== "number") return cause;
|
|
3081
2107
|
return Object.assign(cause, { errno: errcode });
|
|
3082
2108
|
};
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3088
|
-
|
|
3089
|
-
|
|
3090
|
-
|
|
3091
|
-
|
|
3092
|
-
* migrations in a transaction, and optionally dumps the schema after successful
|
|
3093
|
-
* migrations.
|
|
3094
|
-
*
|
|
3095
|
-
* @category constructors
|
|
3096
|
-
* @since 4.0.0
|
|
3097
|
-
*/
|
|
2109
|
+
//#endregion
|
|
2110
|
+
//#region node_modules/.pnpm/effect@4.0.0-rc.115/node_modules/effect/dist/unstable/sql/Migrator.js
|
|
2111
|
+
var __rewriteRelativeImportExtension = void 0 && (void 0).__rewriteRelativeImportExtension || function(path, preserveJsx) {
|
|
2112
|
+
if (typeof path === "string" && /^\.\.?\//.test(path)) return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function(m, tsx, d, ext, cm) {
|
|
2113
|
+
return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : d + ext + "." + cm.toLowerCase() + "js";
|
|
2114
|
+
});
|
|
2115
|
+
return path;
|
|
2116
|
+
};
|
|
2117
|
+
var MigrationError = class extends TaggedError("MigrationError") {};
|
|
3098
2118
|
const make = ({ dumpSchema = () => void_$1 }) => ({ loader, schemaDirectory, table = "effect_sql_migrations" }) => gen(function* () {
|
|
3099
2119
|
const sql = yield* SqlClient;
|
|
3100
2120
|
const ensureMigrationsTable = sql.onDialectOrElse({
|
|
@@ -3184,15 +2204,8 @@ const make = ({ dumpSchema = () => void_$1 }) => ({ loader, schemaDirectory, tab
|
|
|
3184
2204
|
if (schemaDirectory && completed.length > 0) yield* dumpSchema(`${schemaDirectory}/_schema.sql`, table).pipe(catchCause((cause) => logInfo("Could not dump schema", cause)));
|
|
3185
2205
|
return completed;
|
|
3186
2206
|
});
|
|
3187
|
-
const migrationOrder =
|
|
2207
|
+
const migrationOrder = make$10(([a], [b]) => Number$1(a, b));
|
|
3188
2208
|
const isConstraintConflict = (error) => error.reason._tag === "ConstraintError" || error.reason._tag === "UniqueViolation";
|
|
3189
|
-
/**
|
|
3190
|
-
* Creates a migration loader from a record of migration effects keyed by
|
|
3191
|
-
* `<id>_<name>`, sorted by migration id.
|
|
3192
|
-
*
|
|
3193
|
-
* @category loaders
|
|
3194
|
-
* @since 4.0.0
|
|
3195
|
-
*/
|
|
3196
2209
|
const fromRecord = (migrations) => pipe(Object.keys(migrations), flatMapNullishOr((_) => _.match(/^(\d+)_(.+)$/)), map$2(([key, id, name]) => [
|
|
3197
2210
|
Number(id),
|
|
3198
2211
|
name,
|
|
@@ -3200,29 +2213,10 @@ const fromRecord = (migrations) => pipe(Object.keys(migrations), flatMapNullishO
|
|
|
3200
2213
|
]), sort(migrationOrder), succeed);
|
|
3201
2214
|
//#endregion
|
|
3202
2215
|
//#region node_modules/.pnpm/@effect+sql-sqlite-node@4.0.0-rc.115_effect@4.0.0-rc.115/node_modules/@effect/sql-sqlite-node/dist/SqliteMigrator.js
|
|
3203
|
-
|
|
3204
|
-
* Runs SQL migrations for a SQLite database using the shared `Migrator` implementation and the current `SqlClient`.
|
|
3205
|
-
*
|
|
3206
|
-
* @category running
|
|
3207
|
-
* @since 4.0.0
|
|
3208
|
-
*/
|
|
3209
|
-
const run = /*#__PURE__*/ make({});
|
|
3210
|
-
/**
|
|
3211
|
-
* Creates a layer that runs the configured SQLite migrations during layer construction and provides no services.
|
|
3212
|
-
*
|
|
3213
|
-
* @category layers
|
|
3214
|
-
* @since 4.0.0
|
|
3215
|
-
*/
|
|
2216
|
+
const run = make({});
|
|
3216
2217
|
const layer$1 = (options) => effectDiscard(run(options));
|
|
3217
2218
|
//#endregion
|
|
3218
2219
|
//#region src/Sqlite.ts
|
|
3219
|
-
/**
|
|
3220
|
-
* @since 1.0.0
|
|
3221
|
-
*/
|
|
3222
|
-
/**
|
|
3223
|
-
* @since 1.0.0
|
|
3224
|
-
* @category Layers
|
|
3225
|
-
*/
|
|
3226
2220
|
const SqliteLayer = (database) => layer$1({ loader: fromRecord({ "0001_create_chunks": gen(function* () {
|
|
3227
2221
|
const sql = yield* SqlClient;
|
|
3228
2222
|
yield* sql`CREATE TABLE IF NOT EXISTS chunks (
|
|
@@ -3244,9 +2238,6 @@ const SqliteLayer = (database) => layer$1({ loader: fromRecord({ "0001_create_ch
|
|
|
3244
2238
|
}))));
|
|
3245
2239
|
//#endregion
|
|
3246
2240
|
//#region src/SemanticSearch.ts
|
|
3247
|
-
/**
|
|
3248
|
-
* @since 1.0.0
|
|
3249
|
-
*/
|
|
3250
2241
|
const normalizePath = (path) => path.replace(/\\/g, "/");
|
|
3251
2242
|
const resolveChunkConfig = (options) => ({
|
|
3252
2243
|
chunkSize: 30,
|
|
@@ -3269,10 +2260,6 @@ const chunkEmbeddingInput = (chunk) => {
|
|
|
3269
2260
|
return headerLines.join("\n") + "\n\n" + contentWithLines;
|
|
3270
2261
|
};
|
|
3271
2262
|
const hashChunkInput = (input) => createHash("sha256").update(input).digest("hex");
|
|
3272
|
-
/**
|
|
3273
|
-
* @since 1.0.0
|
|
3274
|
-
* @category Layers
|
|
3275
|
-
*/
|
|
3276
2263
|
const layer = (options) => effect(SemanticSearch, gen(function* () {
|
|
3277
2264
|
const chunker = yield* CodeChunker;
|
|
3278
2265
|
const repo = yield* ChunkRepo;
|
|
@@ -3369,4 +2356,4 @@ const layer = (options) => effect(SemanticSearch, gen(function* () {
|
|
|
3369
2356
|
//#endregion
|
|
3370
2357
|
export { SemanticSearch, chunkEmbeddingInput, layer, makeEmbeddingResolver, maybeRemoveFile, maybeUpdateFile };
|
|
3371
2358
|
|
|
3372
|
-
//# sourceMappingURL=SemanticSearch-
|
|
2359
|
+
//# sourceMappingURL=SemanticSearch-O6PZBRfd.mjs.map
|