@athrio/loom 0.0.9 → 0.0.10
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/Cache-Dv3Qogvb.js +1048 -0
- package/dist/Cache-Dv3Qogvb.js.map +1 -0
- package/dist/{LoomServer-BZL6KQOM.js → LoomServer-JbCtLtxV.js} +4 -2
- package/dist/{LoomServer-BZL6KQOM.js.map → LoomServer-JbCtLtxV.js.map} +1 -1
- package/dist/LoomStore-BGlpRj6W.js +8857 -0
- package/dist/LoomStore-BGlpRj6W.js.map +1 -0
- package/dist/NodeServices-CtEw3D6F.js +1564 -0
- package/dist/NodeServices-CtEw3D6F.js.map +1 -0
- package/dist/{LoomStore-BBRhdzet.js → SqlClient-BHo_uVyk.js} +10062 -46501
- package/dist/SqlClient-BHo_uVyk.js.map +1 -0
- package/dist/SqlError-BwVJTsti.js +408 -0
- package/dist/SqlError-BwVJTsti.js.map +1 -0
- package/dist/design-S_129JVC.js +18524 -0
- package/dist/design-S_129JVC.js.map +1 -0
- package/dist/dist-3ptbWhlX.js +202 -0
- package/dist/dist-3ptbWhlX.js.map +1 -0
- package/dist/dist-CKhPOkpR.js +27469 -0
- package/dist/dist-CKhPOkpR.js.map +1 -0
- package/dist/dist-kscTHM4c.js +151 -0
- package/dist/dist-kscTHM4c.js.map +1 -0
- package/dist/identity-DvFsrt2d.js +95 -0
- package/dist/identity-DvFsrt2d.js.map +1 -0
- package/dist/main.js +260 -1535
- package/dist/main.js.map +1 -1
- package/dist/overlay.js +80 -0
- package/dist/store-CtvrwAS8.js +3 -0
- package/dist/store-DgMmJ7v9.js +229 -0
- package/dist/store-DgMmJ7v9.js.map +1 -0
- package/dist/ui.html +103 -0
- package/dist/ui.js +79 -0
- package/package.json +3 -1
- package/dist/LoomStore-BBRhdzet.js.map +0 -1
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { r as __exportAll } from "./rolldown-runtime-YU9U6SYh.js";
|
|
3
|
+
import { A as die, Ah as identity, Bs as gen, Cf as getUnsafe, Gc as tap, Hl as provide, Ic as scope, Ll as effectContext, Os as flatMap, Qs as map, Ta as make$1, Uc as suspend, Vc as succeed, Wc as sync, Xc as tryPromise, Yl as addFinalizer, Zc as try_, _f as Service, a as makeCompilerSqlite, bf as get, d as unwrap, df as minutes, i as defaultTransforms, n as SqlClient, nl as uninterruptibleMask, ns as acquireUseRelease, o as layer$1, ql as Scope, r as make$2, sl as withFiber, ss as as, t as SafeIntegers, to as getCurrent, vf as add, wf as make$3 } from "./SqlClient-BHo_uVyk.js";
|
|
4
|
+
import { n as get$1, r as make$4 } from "./Cache-Dv3Qogvb.js";
|
|
5
|
+
import { n as classifySqliteError, t as SqlError } from "./SqlError-BwVJTsti.js";
|
|
6
|
+
import { DatabaseSync, backup } from "node:sqlite";
|
|
7
|
+
//#region ../../node_modules/@effect/sql-sqlite-node/dist/SqliteClient.js
|
|
8
|
+
/**
|
|
9
|
+
* Connects Effect SQL to SQLite on Node.js using `node:sqlite`.
|
|
10
|
+
*
|
|
11
|
+
* This module opens a SQLite database and exposes it as both `SqliteClient` and
|
|
12
|
+
* the generic Effect SQL client. It serializes access through one connection,
|
|
13
|
+
* caches prepared statements, enables WAL mode unless disabled, and supports
|
|
14
|
+
* database backup, and extension loading. Streaming queries and
|
|
15
|
+
* `updateValues` are not supported by this driver.
|
|
16
|
+
*
|
|
17
|
+
* @since 4.0.0
|
|
18
|
+
*/
|
|
19
|
+
var SqliteClient_exports = /* @__PURE__ */ __exportAll({
|
|
20
|
+
SqliteClient: () => SqliteClient,
|
|
21
|
+
TypeId: () => TypeId,
|
|
22
|
+
layer: () => layer,
|
|
23
|
+
layerConfig: () => layerConfig,
|
|
24
|
+
make: () => make
|
|
25
|
+
});
|
|
26
|
+
var ATTR_DB_SYSTEM_NAME = "db.system.name";
|
|
27
|
+
/**
|
|
28
|
+
* Runtime type identifier used to mark Node `SqliteClient` values.
|
|
29
|
+
*
|
|
30
|
+
* @category type IDs
|
|
31
|
+
* @since 4.0.0
|
|
32
|
+
*/
|
|
33
|
+
var TypeId = "~@effect/sql-sqlite-node/SqliteClient";
|
|
34
|
+
/**
|
|
35
|
+
* Service tag for the node SQLite client implementation.
|
|
36
|
+
*
|
|
37
|
+
* @category services
|
|
38
|
+
* @since 4.0.0
|
|
39
|
+
*/
|
|
40
|
+
var SqliteClient = /*#__PURE__*/ Service("@effect/sql-sqlite-node/SqliteClient");
|
|
41
|
+
/**
|
|
42
|
+
* Creates a scoped node SQLite client from the supplied configuration, using a single serialized connection with WAL enabled by default and exposing SQLite-specific `export`, `backup`, and `loadExtension` operations.
|
|
43
|
+
*
|
|
44
|
+
* @category constructors
|
|
45
|
+
* @since 4.0.0
|
|
46
|
+
*/
|
|
47
|
+
var make = (options) => gen(function* () {
|
|
48
|
+
const compiler = makeCompilerSqlite(options.transformQueryNames);
|
|
49
|
+
const transformRows = options.transformResultNames ? defaultTransforms(options.transformResultNames).array : void 0;
|
|
50
|
+
const makeConnection = gen(function* () {
|
|
51
|
+
const scope$1 = yield* scope;
|
|
52
|
+
const db = new DatabaseSync(options.filename, {
|
|
53
|
+
readOnly: options.readonly ?? false,
|
|
54
|
+
allowExtension: true
|
|
55
|
+
});
|
|
56
|
+
yield* addFinalizer(scope$1, sync(() => db.close()));
|
|
57
|
+
db.enableLoadExtension(false);
|
|
58
|
+
if (options.disableWAL !== true) db.exec("PRAGMA journal_mode = WAL");
|
|
59
|
+
const prepareCache = yield* make$4({
|
|
60
|
+
capacity: options.prepareCacheSize ?? 200,
|
|
61
|
+
timeToLive: options.prepareCacheTTL ?? minutes(10),
|
|
62
|
+
lookup: (sql) => try_({
|
|
63
|
+
try: () => db.prepare(sql),
|
|
64
|
+
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to prepare statement", "prepare") })
|
|
65
|
+
})
|
|
66
|
+
});
|
|
67
|
+
const runStatement = (statement, params, raw) => withFiber((fiber) => {
|
|
68
|
+
const useSafeIntegers = get(fiber.context, SafeIntegers);
|
|
69
|
+
return try_({
|
|
70
|
+
try: () => {
|
|
71
|
+
statement.setReadBigInts(useSafeIntegers);
|
|
72
|
+
if (statement.columns().length > 0) return statement.all(...params);
|
|
73
|
+
const result = statement.run(...params);
|
|
74
|
+
return raw ? {
|
|
75
|
+
changes: result.changes,
|
|
76
|
+
lastInsertRowid: result.lastInsertRowid
|
|
77
|
+
} : [];
|
|
78
|
+
},
|
|
79
|
+
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "execute") })
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
const runStatementValues = (statement, params) => withFiber((fiber) => {
|
|
83
|
+
const useSafeIntegers = get(fiber.context, SafeIntegers);
|
|
84
|
+
return try_({
|
|
85
|
+
try: () => {
|
|
86
|
+
statement.setReadBigInts(useSafeIntegers);
|
|
87
|
+
if (statement.columns().length > 0) return statement.all(...params);
|
|
88
|
+
statement.run(...params);
|
|
89
|
+
return [];
|
|
90
|
+
},
|
|
91
|
+
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "execute") })
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
const runStatementValuesUnprepared = (statement, params) => withFiber((fiber) => {
|
|
95
|
+
const useSafeIntegers = get(fiber.context, SafeIntegers);
|
|
96
|
+
return try_({
|
|
97
|
+
try: () => {
|
|
98
|
+
statement.setReadBigInts(useSafeIntegers);
|
|
99
|
+
statement.setReturnArrays(true);
|
|
100
|
+
if (statement.columns().length > 0) return statement.all(...params);
|
|
101
|
+
statement.run(...params);
|
|
102
|
+
return [];
|
|
103
|
+
},
|
|
104
|
+
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to execute statement", "execute") })
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
const run = (sql, params, raw = false) => flatMap(get$1(prepareCache, sql), (s) => runStatement(s, params, raw));
|
|
108
|
+
const runValues = (sql, params) => acquireUseRelease(get$1(prepareCache, sql), (statement) => {
|
|
109
|
+
statement.setReturnArrays(true);
|
|
110
|
+
return runStatementValues(statement, params);
|
|
111
|
+
}, (statement) => sync(() => statement.setReturnArrays(false)));
|
|
112
|
+
const runValuesUnprepared = (sql, params) => runStatementValuesUnprepared(db.prepare(sql), params);
|
|
113
|
+
return identity({
|
|
114
|
+
execute(sql, params, transformRows) {
|
|
115
|
+
return transformRows ? map(run(sql, params), transformRows) : run(sql, params);
|
|
116
|
+
},
|
|
117
|
+
executeRaw(sql, params) {
|
|
118
|
+
return run(sql, params, true);
|
|
119
|
+
},
|
|
120
|
+
executeValues(sql, params) {
|
|
121
|
+
return runValues(sql, params);
|
|
122
|
+
},
|
|
123
|
+
executeValuesUnprepared(sql, params) {
|
|
124
|
+
return runValuesUnprepared(sql, params);
|
|
125
|
+
},
|
|
126
|
+
executeUnprepared(sql, params, transformRows) {
|
|
127
|
+
const effect = runStatement(db.prepare(sql), params ?? [], false);
|
|
128
|
+
return transformRows ? map(effect, transformRows) : effect;
|
|
129
|
+
},
|
|
130
|
+
executeStream(_sql, _params) {
|
|
131
|
+
return die("executeStream not implemented");
|
|
132
|
+
},
|
|
133
|
+
backup(destination) {
|
|
134
|
+
return suspend(() => {
|
|
135
|
+
let totalPages = 0;
|
|
136
|
+
return tryPromise({
|
|
137
|
+
try: () => backup(db, destination, { progress: (progress) => {
|
|
138
|
+
totalPages = progress.totalPages;
|
|
139
|
+
} }).then((pages) => ({
|
|
140
|
+
totalPages: totalPages || pages,
|
|
141
|
+
remainingPages: 0
|
|
142
|
+
})),
|
|
143
|
+
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to backup database", "backup") })
|
|
144
|
+
});
|
|
145
|
+
});
|
|
146
|
+
},
|
|
147
|
+
loadExtension(path) {
|
|
148
|
+
return acquireUseRelease(sync(() => db.enableLoadExtension(true)), () => try_({
|
|
149
|
+
try: () => db.loadExtension(path),
|
|
150
|
+
catch: (cause) => new SqlError({ reason: classifyError(cause, "Failed to load extension", "loadExtension") })
|
|
151
|
+
}), () => sync(() => db.enableLoadExtension(false)));
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
});
|
|
155
|
+
const semaphore = yield* make$1(1);
|
|
156
|
+
const connection = yield* makeConnection;
|
|
157
|
+
const acquirer = semaphore.withPermits(1)(succeed(connection));
|
|
158
|
+
const transactionAcquirer = uninterruptibleMask((restore) => {
|
|
159
|
+
const scope = getUnsafe(getCurrent().context, Scope);
|
|
160
|
+
return as(tap(restore(semaphore.take(1)), () => addFinalizer(scope, semaphore.release(1))), connection);
|
|
161
|
+
});
|
|
162
|
+
return Object.assign(yield* make$2({
|
|
163
|
+
acquirer,
|
|
164
|
+
compiler,
|
|
165
|
+
transactionAcquirer,
|
|
166
|
+
spanAttributes: [...options.spanAttributes ? Object.entries(options.spanAttributes) : [], [ATTR_DB_SYSTEM_NAME, "sqlite"]],
|
|
167
|
+
transformRows
|
|
168
|
+
}), {
|
|
169
|
+
[TypeId]: TypeId,
|
|
170
|
+
config: options,
|
|
171
|
+
backup: (destination) => flatMap(acquirer, (_) => _.backup(destination)),
|
|
172
|
+
loadExtension: (path) => flatMap(acquirer, (_) => _.loadExtension(path))
|
|
173
|
+
});
|
|
174
|
+
});
|
|
175
|
+
/**
|
|
176
|
+
* Builds a layer from an Effect `Config` value, providing both the node `SqliteClient` service and the generic `SqlClient` service.
|
|
177
|
+
*
|
|
178
|
+
* @category layers
|
|
179
|
+
* @since 4.0.0
|
|
180
|
+
*/
|
|
181
|
+
var layerConfig = (config) => effectContext(unwrap(config).pipe(flatMap(make), map((client) => make$3(SqliteClient, client).pipe(add(SqlClient, client))))).pipe(provide(layer$1));
|
|
182
|
+
/**
|
|
183
|
+
* Builds a layer from a node SQLite client configuration, providing both `SqliteClient` and the generic `SqlClient` service.
|
|
184
|
+
*
|
|
185
|
+
* @category layers
|
|
186
|
+
* @since 4.0.0
|
|
187
|
+
*/
|
|
188
|
+
var layer = (config) => effectContext(map(make(config), (client) => make$3(SqliteClient, client).pipe(add(SqlClient, client)))).pipe(provide(layer$1));
|
|
189
|
+
var classifyError = (cause, message, operation) => classifySqliteError(sqliteCauseWithErrno(cause), {
|
|
190
|
+
message,
|
|
191
|
+
operation
|
|
192
|
+
});
|
|
193
|
+
var sqliteCauseWithErrno = (cause) => {
|
|
194
|
+
if (typeof cause !== "object" || cause === null || !("errcode" in cause) || "errno" in cause) return cause;
|
|
195
|
+
const errcode = cause.errcode;
|
|
196
|
+
if (typeof errcode !== "number") return cause;
|
|
197
|
+
return Object.assign(cause, { errno: errcode });
|
|
198
|
+
};
|
|
199
|
+
//#endregion
|
|
200
|
+
export { SqliteClient_exports as SqliteClient };
|
|
201
|
+
|
|
202
|
+
//# sourceMappingURL=dist-3ptbWhlX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dist-3ptbWhlX.js","names":["Effect.gen","Statement.makeCompilerSqlite","Statement.defaultTransforms","scope","Effect.scope","Scope.addFinalizer","Effect.sync","Cache.make","Duration.minutes","Effect.try","Effect.withFiber","Context.get","Client.SafeIntegers","Effect.flatMap","Cache.get","Effect.acquireUseRelease","Effect.map","Stream.die","Effect.suspend","Effect.tryPromise","backupDatabase","Semaphore.make","Effect.succeed","Effect.uninterruptibleMask","Fiber.getCurrent","Context.getUnsafe","Scope.Scope","Effect.as","Effect.tap","Client.make","Layer.effectContext","Config.unwrap","Context.make","Context.add","Client.SqlClient","Layer.provide","Reactivity.layer"],"sources":["../../../node_modules/@effect/sql-sqlite-node/dist/SqliteClient.js"],"sourcesContent":["/**\n * Connects Effect SQL to SQLite on Node.js using `node:sqlite`.\n *\n * This module opens a SQLite database and exposes it as both `SqliteClient` and\n * the generic Effect SQL client. It serializes access through one connection,\n * caches prepared statements, enables WAL mode unless disabled, and supports\n * database backup, and extension loading. Streaming queries and\n * `updateValues` are not supported by this driver.\n *\n * @since 4.0.0\n */\nimport * as Cache from \"effect/Cache\";\nimport * as Config from \"effect/Config\";\nimport * as Context from \"effect/Context\";\nimport * as Duration from \"effect/Duration\";\nimport * as Effect from \"effect/Effect\";\nimport * as Fiber from \"effect/Fiber\";\nimport { identity } from \"effect/Function\";\nimport * as Layer from \"effect/Layer\";\nimport * as Scope from \"effect/Scope\";\nimport * as Semaphore from \"effect/Semaphore\";\nimport * as Stream from \"effect/Stream\";\nimport * as Reactivity from \"effect/unstable/reactivity/Reactivity\";\nimport * as Client from \"effect/unstable/sql/SqlClient\";\nimport { classifySqliteError, SqlError } from \"effect/unstable/sql/SqlError\";\nimport * as Statement from \"effect/unstable/sql/Statement\";\nimport { backup as backupDatabase, DatabaseSync } from \"node:sqlite\";\nconst ATTR_DB_SYSTEM_NAME = \"db.system.name\";\n/**\n * Runtime type identifier used to mark Node `SqliteClient` values.\n *\n * @category type IDs\n * @since 4.0.0\n */\nexport const TypeId = \"~@effect/sql-sqlite-node/SqliteClient\";\n/**\n * Service tag for the node SQLite client implementation.\n *\n * @category services\n * @since 4.0.0\n */\nexport const SqliteClient = /*#__PURE__*/Context.Service(\"@effect/sql-sqlite-node/SqliteClient\");\n/**\n * Creates a scoped node SQLite client from the supplied configuration, using a single serialized connection with WAL enabled by default and exposing SQLite-specific `export`, `backup`, and `loadExtension` operations.\n *\n * @category constructors\n * @since 4.0.0\n */\nexport const make = options => Effect.gen(function* () {\n const compiler = Statement.makeCompilerSqlite(options.transformQueryNames);\n const transformRows = options.transformResultNames ? Statement.defaultTransforms(options.transformResultNames).array : undefined;\n const makeConnection = Effect.gen(function* () {\n const scope = yield* Effect.scope;\n const db = new DatabaseSync(options.filename, {\n readOnly: options.readonly ?? false,\n allowExtension: true\n });\n yield* Scope.addFinalizer(scope, Effect.sync(() => db.close()));\n db.enableLoadExtension(false);\n if (options.disableWAL !== true) {\n db.exec(\"PRAGMA journal_mode = WAL\");\n }\n const prepareCache = yield* Cache.make({\n capacity: options.prepareCacheSize ?? 200,\n timeToLive: options.prepareCacheTTL ?? Duration.minutes(10),\n lookup: sql => Effect.try({\n try: () => db.prepare(sql),\n catch: cause => new SqlError({\n reason: classifyError(cause, \"Failed to prepare statement\", \"prepare\")\n })\n })\n });\n const runStatement = (statement, params, raw) => Effect.withFiber(fiber => {\n const useSafeIntegers = Context.get(fiber.context, Client.SafeIntegers);\n return Effect.try({\n try: () => {\n statement.setReadBigInts(useSafeIntegers);\n if (statement.columns().length > 0) {\n return statement.all(...params);\n }\n const result = statement.run(...params);\n return raw ? {\n changes: result.changes,\n lastInsertRowid: result.lastInsertRowid\n } : [];\n },\n catch: cause => new SqlError({\n reason: classifyError(cause, \"Failed to execute statement\", \"execute\")\n })\n });\n });\n const runStatementValues = (statement, params) => Effect.withFiber(fiber => {\n const useSafeIntegers = Context.get(fiber.context, Client.SafeIntegers);\n return Effect.try({\n try: () => {\n statement.setReadBigInts(useSafeIntegers);\n if (statement.columns().length > 0) {\n return statement.all(...params);\n }\n statement.run(...params);\n return [];\n },\n catch: cause => new SqlError({\n reason: classifyError(cause, \"Failed to execute statement\", \"execute\")\n })\n });\n });\n const runStatementValuesUnprepared = (statement, params) => Effect.withFiber(fiber => {\n const useSafeIntegers = Context.get(fiber.context, Client.SafeIntegers);\n return Effect.try({\n try: () => {\n statement.setReadBigInts(useSafeIntegers);\n statement.setReturnArrays(true);\n if (statement.columns().length > 0) {\n return statement.all(...params);\n }\n statement.run(...params);\n return [];\n },\n catch: cause => new SqlError({\n reason: classifyError(cause, \"Failed to execute statement\", \"execute\")\n })\n });\n });\n const run = (sql, params, raw = false) => Effect.flatMap(Cache.get(prepareCache, sql), s => runStatement(s, params, raw));\n const runValues = (sql, params) => Effect.acquireUseRelease(Cache.get(prepareCache, sql), statement => {\n statement.setReturnArrays(true);\n return runStatementValues(statement, params);\n }, statement => Effect.sync(() => statement.setReturnArrays(false)));\n const runValuesUnprepared = (sql, params) => runStatementValuesUnprepared(db.prepare(sql), params);\n return identity({\n execute(sql, params, transformRows) {\n return transformRows ? Effect.map(run(sql, params), transformRows) : run(sql, params);\n },\n executeRaw(sql, params) {\n return run(sql, params, true);\n },\n executeValues(sql, params) {\n return runValues(sql, params);\n },\n executeValuesUnprepared(sql, params) {\n return runValuesUnprepared(sql, params);\n },\n executeUnprepared(sql, params, transformRows) {\n const effect = runStatement(db.prepare(sql), params ?? [], false);\n return transformRows ? Effect.map(effect, transformRows) : effect;\n },\n executeStream(_sql, _params) {\n return Stream.die(\"executeStream not implemented\");\n },\n backup(destination) {\n return Effect.suspend(() => {\n let totalPages = 0;\n return Effect.tryPromise({\n try: () => backupDatabase(db, destination, {\n progress: progress => {\n totalPages = progress.totalPages;\n }\n }).then(pages => ({\n totalPages: totalPages || pages,\n remainingPages: 0\n })),\n catch: cause => new SqlError({\n reason: classifyError(cause, \"Failed to backup database\", \"backup\")\n })\n });\n });\n },\n loadExtension(path) {\n return Effect.acquireUseRelease(Effect.sync(() => db.enableLoadExtension(true)), () => Effect.try({\n try: () => db.loadExtension(path),\n catch: cause => new SqlError({\n reason: classifyError(cause, \"Failed to load extension\", \"loadExtension\")\n })\n }), () => Effect.sync(() => db.enableLoadExtension(false)));\n }\n });\n });\n const semaphore = yield* Semaphore.make(1);\n const connection = yield* makeConnection;\n const acquirer = semaphore.withPermits(1)(Effect.succeed(connection));\n const transactionAcquirer = Effect.uninterruptibleMask(restore => {\n const fiber = Fiber.getCurrent();\n const scope = Context.getUnsafe(fiber.context, Scope.Scope);\n return Effect.as(Effect.tap(restore(semaphore.take(1)), () => Scope.addFinalizer(scope, semaphore.release(1))), connection);\n });\n return Object.assign(yield* Client.make({\n acquirer,\n compiler,\n transactionAcquirer,\n spanAttributes: [...(options.spanAttributes ? Object.entries(options.spanAttributes) : []), [ATTR_DB_SYSTEM_NAME, \"sqlite\"]],\n transformRows\n }), {\n [TypeId]: TypeId,\n config: options,\n backup: destination => Effect.flatMap(acquirer, _ => _.backup(destination)),\n loadExtension: path => Effect.flatMap(acquirer, _ => _.loadExtension(path))\n });\n});\n/**\n * Builds a layer from an Effect `Config` value, providing both the node `SqliteClient` service and the generic `SqlClient` service.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layerConfig = config => Layer.effectContext(Config.unwrap(config).pipe(Effect.flatMap(make), Effect.map(client => Context.make(SqliteClient, client).pipe(Context.add(Client.SqlClient, client))))).pipe(Layer.provide(Reactivity.layer));\n/**\n * Builds a layer from a node SQLite client configuration, providing both `SqliteClient` and the generic `SqlClient` service.\n *\n * @category layers\n * @since 4.0.0\n */\nexport const layer = config => Layer.effectContext(Effect.map(make(config), client => Context.make(SqliteClient, client).pipe(Context.add(Client.SqlClient, client)))).pipe(Layer.provide(Reactivity.layer));\n// internal\nconst classifyError = (cause, message, operation) => classifySqliteError(sqliteCauseWithErrno(cause), {\n message,\n operation\n});\nconst sqliteCauseWithErrno = cause => {\n if (typeof cause !== \"object\" || cause === null || !(\"errcode\" in cause) || \"errno\" in cause) {\n return cause;\n }\n const errcode = cause.errcode;\n if (typeof errcode !== \"number\") {\n return cause;\n }\n return Object.assign(cause, {\n errno: errcode\n });\n};\n//# sourceMappingURL=SqliteClient.js.map"],"x_google_ignoreList":[0],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA2BA,IAAM,sBAAsB;;;;;;;AAO5B,IAAa,SAAS;;;;;;;AAOtB,IAAa,eAA4B,sBAAgB,sCAAsC;;;;;;;AAO/F,IAAa,QAAO,YAAWA,IAAW,aAAa;CACrD,MAAM,WAAWC,mBAA6B,QAAQ,mBAAmB;CACzE,MAAM,gBAAgB,QAAQ,uBAAuBC,kBAA4B,QAAQ,oBAAoB,CAAC,CAAC,QAAQ,KAAA;CACvH,MAAM,iBAAiBF,IAAW,aAAa;EAC7C,MAAMG,UAAQ,OAAOC;EACrB,MAAM,KAAK,IAAI,aAAa,QAAQ,UAAU;GAC5C,UAAU,QAAQ,YAAY;GAC9B,gBAAgB;EAClB,CAAC;EACD,OAAOC,aAAmBF,SAAOG,WAAkB,GAAG,MAAM,CAAC,CAAC;EAC9D,GAAG,oBAAoB,KAAK;EAC5B,IAAI,QAAQ,eAAe,MACzB,GAAG,K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