@basestream/cli 0.1.2 → 0.2.0
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.
Potentially problematic release.
This version of @basestream/cli might be problematic. Click here for more details.
- package/dist/cli.mjs +4463 -0
- package/package.json +6 -3
- package/dist/cli/commands/hook-stop.d.ts +0 -1
- package/dist/cli/commands/hook-stop.js +0 -261
- package/dist/cli/commands/init.d.ts +0 -1
- package/dist/cli/commands/init.js +0 -92
- package/dist/cli/commands/login.d.ts +0 -1
- package/dist/cli/commands/login.js +0 -90
- package/dist/cli/commands/status.d.ts +0 -1
- package/dist/cli/commands/status.js +0 -97
- package/dist/cli/commands/sync.d.ts +0 -7
- package/dist/cli/commands/sync.js +0 -77
- package/dist/cli/config.d.ts +0 -12
- package/dist/cli/config.js +0 -31
- package/dist/cli/index.d.ts +0 -1
- package/dist/cli/index.js +0 -60
- package/dist/cli/util.d.ts +0 -11
- package/dist/cli/util.js +0 -18
package/dist/cli.mjs
ADDED
|
@@ -0,0 +1,4463 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
9
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
10
|
+
}) : x)(function(x) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
13
|
+
});
|
|
14
|
+
var __esm = (fn, res) => function __init() {
|
|
15
|
+
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
16
|
+
};
|
|
17
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
18
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
19
|
+
};
|
|
20
|
+
var __export = (target, all) => {
|
|
21
|
+
for (var name in all)
|
|
22
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
|
+
};
|
|
24
|
+
var __copyProps = (to, from, except, desc) => {
|
|
25
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
26
|
+
for (let key of __getOwnPropNames(from))
|
|
27
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
28
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
29
|
+
}
|
|
30
|
+
return to;
|
|
31
|
+
};
|
|
32
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
33
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
34
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
35
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
36
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
37
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
38
|
+
mod
|
|
39
|
+
));
|
|
40
|
+
|
|
41
|
+
// src/cli/config.ts
|
|
42
|
+
import fs from "node:fs";
|
|
43
|
+
import path from "node:path";
|
|
44
|
+
import os from "node:os";
|
|
45
|
+
function ensureDirs() {
|
|
46
|
+
for (const dir of [BASESTREAM_DIR, BUFFER_DIR, SESSION_DIR]) {
|
|
47
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function readConfig() {
|
|
51
|
+
if (!fs.existsSync(CONFIG_FILE)) return null;
|
|
52
|
+
try {
|
|
53
|
+
const config = JSON.parse(fs.readFileSync(CONFIG_FILE, "utf-8"));
|
|
54
|
+
if (process.env.BASESTREAM_URL) {
|
|
55
|
+
config.baseUrl = process.env.BASESTREAM_URL;
|
|
56
|
+
}
|
|
57
|
+
return config;
|
|
58
|
+
} catch {
|
|
59
|
+
return null;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function writeConfig(config) {
|
|
63
|
+
ensureDirs();
|
|
64
|
+
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2));
|
|
65
|
+
}
|
|
66
|
+
var BASESTREAM_DIR, BUFFER_DIR, CONFIG_FILE, SESSION_DIR;
|
|
67
|
+
var init_config = __esm({
|
|
68
|
+
"src/cli/config.ts"() {
|
|
69
|
+
"use strict";
|
|
70
|
+
BASESTREAM_DIR = path.join(os.homedir(), ".basestream");
|
|
71
|
+
BUFFER_DIR = path.join(BASESTREAM_DIR, "buffer");
|
|
72
|
+
CONFIG_FILE = path.join(BASESTREAM_DIR, "config.json");
|
|
73
|
+
SESSION_DIR = path.join(BASESTREAM_DIR, "sessions");
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
// src/cli/util.ts
|
|
78
|
+
function check(msg) {
|
|
79
|
+
console.log(` ${c.green("\u2713")} ${c.green(msg)}`);
|
|
80
|
+
}
|
|
81
|
+
function warn(msg) {
|
|
82
|
+
console.log(` ${c.yellow("!")} ${c.yellow(msg)}`);
|
|
83
|
+
}
|
|
84
|
+
function fail(msg) {
|
|
85
|
+
console.log(` ${c.red("\u2717")} ${c.red(msg)}`);
|
|
86
|
+
}
|
|
87
|
+
var c;
|
|
88
|
+
var init_util = __esm({
|
|
89
|
+
"src/cli/util.ts"() {
|
|
90
|
+
"use strict";
|
|
91
|
+
c = {
|
|
92
|
+
green: (s) => `\x1B[32m${s}\x1B[0m`,
|
|
93
|
+
yellow: (s) => `\x1B[33m${s}\x1B[0m`,
|
|
94
|
+
red: (s) => `\x1B[31m${s}\x1B[0m`,
|
|
95
|
+
cyan: (s) => `\x1B[36m${s}\x1B[0m`,
|
|
96
|
+
dim: (s) => `\x1B[2m${s}\x1B[0m`,
|
|
97
|
+
bold: (s) => `\x1B[1m${s}\x1B[0m`
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/_u64.js
|
|
103
|
+
var require_u64 = __commonJS({
|
|
104
|
+
"../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/_u64.js"(exports) {
|
|
105
|
+
"use strict";
|
|
106
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
107
|
+
exports.toBig = exports.shrSL = exports.shrSH = exports.rotrSL = exports.rotrSH = exports.rotrBL = exports.rotrBH = exports.rotr32L = exports.rotr32H = exports.rotlSL = exports.rotlSH = exports.rotlBL = exports.rotlBH = exports.add5L = exports.add5H = exports.add4L = exports.add4H = exports.add3L = exports.add3H = void 0;
|
|
108
|
+
exports.add = add;
|
|
109
|
+
exports.fromBig = fromBig;
|
|
110
|
+
exports.split = split;
|
|
111
|
+
var U32_MASK64 = /* @__PURE__ */ BigInt(2 ** 32 - 1);
|
|
112
|
+
var _32n = /* @__PURE__ */ BigInt(32);
|
|
113
|
+
function fromBig(n, le = false) {
|
|
114
|
+
if (le)
|
|
115
|
+
return { h: Number(n & U32_MASK64), l: Number(n >> _32n & U32_MASK64) };
|
|
116
|
+
return { h: Number(n >> _32n & U32_MASK64) | 0, l: Number(n & U32_MASK64) | 0 };
|
|
117
|
+
}
|
|
118
|
+
function split(lst, le = false) {
|
|
119
|
+
const len = lst.length;
|
|
120
|
+
let Ah = new Uint32Array(len);
|
|
121
|
+
let Al = new Uint32Array(len);
|
|
122
|
+
for (let i = 0; i < len; i++) {
|
|
123
|
+
const { h, l } = fromBig(lst[i], le);
|
|
124
|
+
[Ah[i], Al[i]] = [h, l];
|
|
125
|
+
}
|
|
126
|
+
return [Ah, Al];
|
|
127
|
+
}
|
|
128
|
+
var toBig = (h, l) => BigInt(h >>> 0) << _32n | BigInt(l >>> 0);
|
|
129
|
+
exports.toBig = toBig;
|
|
130
|
+
var shrSH = (h, _l, s) => h >>> s;
|
|
131
|
+
exports.shrSH = shrSH;
|
|
132
|
+
var shrSL = (h, l, s) => h << 32 - s | l >>> s;
|
|
133
|
+
exports.shrSL = shrSL;
|
|
134
|
+
var rotrSH = (h, l, s) => h >>> s | l << 32 - s;
|
|
135
|
+
exports.rotrSH = rotrSH;
|
|
136
|
+
var rotrSL = (h, l, s) => h << 32 - s | l >>> s;
|
|
137
|
+
exports.rotrSL = rotrSL;
|
|
138
|
+
var rotrBH = (h, l, s) => h << 64 - s | l >>> s - 32;
|
|
139
|
+
exports.rotrBH = rotrBH;
|
|
140
|
+
var rotrBL = (h, l, s) => h >>> s - 32 | l << 64 - s;
|
|
141
|
+
exports.rotrBL = rotrBL;
|
|
142
|
+
var rotr32H = (_h, l) => l;
|
|
143
|
+
exports.rotr32H = rotr32H;
|
|
144
|
+
var rotr32L = (h, _l) => h;
|
|
145
|
+
exports.rotr32L = rotr32L;
|
|
146
|
+
var rotlSH = (h, l, s) => h << s | l >>> 32 - s;
|
|
147
|
+
exports.rotlSH = rotlSH;
|
|
148
|
+
var rotlSL = (h, l, s) => l << s | h >>> 32 - s;
|
|
149
|
+
exports.rotlSL = rotlSL;
|
|
150
|
+
var rotlBH = (h, l, s) => l << s - 32 | h >>> 64 - s;
|
|
151
|
+
exports.rotlBH = rotlBH;
|
|
152
|
+
var rotlBL = (h, l, s) => h << s - 32 | l >>> 64 - s;
|
|
153
|
+
exports.rotlBL = rotlBL;
|
|
154
|
+
function add(Ah, Al, Bh, Bl) {
|
|
155
|
+
const l = (Al >>> 0) + (Bl >>> 0);
|
|
156
|
+
return { h: Ah + Bh + (l / 2 ** 32 | 0) | 0, l: l | 0 };
|
|
157
|
+
}
|
|
158
|
+
var add3L = (Al, Bl, Cl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0);
|
|
159
|
+
exports.add3L = add3L;
|
|
160
|
+
var add3H = (low, Ah, Bh, Ch) => Ah + Bh + Ch + (low / 2 ** 32 | 0) | 0;
|
|
161
|
+
exports.add3H = add3H;
|
|
162
|
+
var add4L = (Al, Bl, Cl, Dl) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0);
|
|
163
|
+
exports.add4L = add4L;
|
|
164
|
+
var add4H = (low, Ah, Bh, Ch, Dh) => Ah + Bh + Ch + Dh + (low / 2 ** 32 | 0) | 0;
|
|
165
|
+
exports.add4H = add4H;
|
|
166
|
+
var add5L = (Al, Bl, Cl, Dl, El) => (Al >>> 0) + (Bl >>> 0) + (Cl >>> 0) + (Dl >>> 0) + (El >>> 0);
|
|
167
|
+
exports.add5L = add5L;
|
|
168
|
+
var add5H = (low, Ah, Bh, Ch, Dh, Eh) => Ah + Bh + Ch + Dh + Eh + (low / 2 ** 32 | 0) | 0;
|
|
169
|
+
exports.add5H = add5H;
|
|
170
|
+
var u64 = {
|
|
171
|
+
fromBig,
|
|
172
|
+
split,
|
|
173
|
+
toBig,
|
|
174
|
+
shrSH,
|
|
175
|
+
shrSL,
|
|
176
|
+
rotrSH,
|
|
177
|
+
rotrSL,
|
|
178
|
+
rotrBH,
|
|
179
|
+
rotrBL,
|
|
180
|
+
rotr32H,
|
|
181
|
+
rotr32L,
|
|
182
|
+
rotlSH,
|
|
183
|
+
rotlSL,
|
|
184
|
+
rotlBH,
|
|
185
|
+
rotlBL,
|
|
186
|
+
add,
|
|
187
|
+
add3L,
|
|
188
|
+
add3H,
|
|
189
|
+
add4L,
|
|
190
|
+
add4H,
|
|
191
|
+
add5H,
|
|
192
|
+
add5L
|
|
193
|
+
};
|
|
194
|
+
exports.default = u64;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/cryptoNode.js
|
|
199
|
+
var require_cryptoNode = __commonJS({
|
|
200
|
+
"../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/cryptoNode.js"(exports) {
|
|
201
|
+
"use strict";
|
|
202
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
203
|
+
exports.crypto = void 0;
|
|
204
|
+
var nc = __require("node:crypto");
|
|
205
|
+
exports.crypto = nc && typeof nc === "object" && "webcrypto" in nc ? nc.webcrypto : nc && typeof nc === "object" && "randomBytes" in nc ? nc : void 0;
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
|
|
209
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/utils.js
|
|
210
|
+
var require_utils = __commonJS({
|
|
211
|
+
"../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/utils.js"(exports) {
|
|
212
|
+
"use strict";
|
|
213
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
214
|
+
exports.wrapXOFConstructorWithOpts = exports.wrapConstructorWithOpts = exports.wrapConstructor = exports.Hash = exports.nextTick = exports.swap32IfBE = exports.byteSwapIfBE = exports.swap8IfBE = exports.isLE = void 0;
|
|
215
|
+
exports.isBytes = isBytes;
|
|
216
|
+
exports.anumber = anumber;
|
|
217
|
+
exports.abytes = abytes;
|
|
218
|
+
exports.ahash = ahash;
|
|
219
|
+
exports.aexists = aexists;
|
|
220
|
+
exports.aoutput = aoutput;
|
|
221
|
+
exports.u8 = u8;
|
|
222
|
+
exports.u32 = u32;
|
|
223
|
+
exports.clean = clean;
|
|
224
|
+
exports.createView = createView;
|
|
225
|
+
exports.rotr = rotr;
|
|
226
|
+
exports.rotl = rotl;
|
|
227
|
+
exports.byteSwap = byteSwap;
|
|
228
|
+
exports.byteSwap32 = byteSwap32;
|
|
229
|
+
exports.bytesToHex = bytesToHex;
|
|
230
|
+
exports.hexToBytes = hexToBytes2;
|
|
231
|
+
exports.asyncLoop = asyncLoop;
|
|
232
|
+
exports.utf8ToBytes = utf8ToBytes;
|
|
233
|
+
exports.bytesToUtf8 = bytesToUtf8;
|
|
234
|
+
exports.toBytes = toBytes;
|
|
235
|
+
exports.kdfInputToBytes = kdfInputToBytes;
|
|
236
|
+
exports.concatBytes = concatBytes;
|
|
237
|
+
exports.checkOpts = checkOpts;
|
|
238
|
+
exports.createHasher = createHasher;
|
|
239
|
+
exports.createOptHasher = createOptHasher;
|
|
240
|
+
exports.createXOFer = createXOFer;
|
|
241
|
+
exports.randomBytes = randomBytes;
|
|
242
|
+
var crypto_1 = require_cryptoNode();
|
|
243
|
+
function isBytes(a) {
|
|
244
|
+
return a instanceof Uint8Array || ArrayBuffer.isView(a) && a.constructor.name === "Uint8Array";
|
|
245
|
+
}
|
|
246
|
+
function anumber(n) {
|
|
247
|
+
if (!Number.isSafeInteger(n) || n < 0)
|
|
248
|
+
throw new Error("positive integer expected, got " + n);
|
|
249
|
+
}
|
|
250
|
+
function abytes(b, ...lengths) {
|
|
251
|
+
if (!isBytes(b))
|
|
252
|
+
throw new Error("Uint8Array expected");
|
|
253
|
+
if (lengths.length > 0 && !lengths.includes(b.length))
|
|
254
|
+
throw new Error("Uint8Array expected of length " + lengths + ", got length=" + b.length);
|
|
255
|
+
}
|
|
256
|
+
function ahash(h) {
|
|
257
|
+
if (typeof h !== "function" || typeof h.create !== "function")
|
|
258
|
+
throw new Error("Hash should be wrapped by utils.createHasher");
|
|
259
|
+
anumber(h.outputLen);
|
|
260
|
+
anumber(h.blockLen);
|
|
261
|
+
}
|
|
262
|
+
function aexists(instance, checkFinished = true) {
|
|
263
|
+
if (instance.destroyed)
|
|
264
|
+
throw new Error("Hash instance has been destroyed");
|
|
265
|
+
if (checkFinished && instance.finished)
|
|
266
|
+
throw new Error("Hash#digest() has already been called");
|
|
267
|
+
}
|
|
268
|
+
function aoutput(out, instance) {
|
|
269
|
+
abytes(out);
|
|
270
|
+
const min = instance.outputLen;
|
|
271
|
+
if (out.length < min) {
|
|
272
|
+
throw new Error("digestInto() expects output buffer of length at least " + min);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
function u8(arr) {
|
|
276
|
+
return new Uint8Array(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
277
|
+
}
|
|
278
|
+
function u32(arr) {
|
|
279
|
+
return new Uint32Array(arr.buffer, arr.byteOffset, Math.floor(arr.byteLength / 4));
|
|
280
|
+
}
|
|
281
|
+
function clean(...arrays) {
|
|
282
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
283
|
+
arrays[i].fill(0);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
function createView(arr) {
|
|
287
|
+
return new DataView(arr.buffer, arr.byteOffset, arr.byteLength);
|
|
288
|
+
}
|
|
289
|
+
function rotr(word, shift) {
|
|
290
|
+
return word << 32 - shift | word >>> shift;
|
|
291
|
+
}
|
|
292
|
+
function rotl(word, shift) {
|
|
293
|
+
return word << shift | word >>> 32 - shift >>> 0;
|
|
294
|
+
}
|
|
295
|
+
exports.isLE = (() => new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68)();
|
|
296
|
+
function byteSwap(word) {
|
|
297
|
+
return word << 24 & 4278190080 | word << 8 & 16711680 | word >>> 8 & 65280 | word >>> 24 & 255;
|
|
298
|
+
}
|
|
299
|
+
exports.swap8IfBE = exports.isLE ? (n) => n : (n) => byteSwap(n);
|
|
300
|
+
exports.byteSwapIfBE = exports.swap8IfBE;
|
|
301
|
+
function byteSwap32(arr) {
|
|
302
|
+
for (let i = 0; i < arr.length; i++) {
|
|
303
|
+
arr[i] = byteSwap(arr[i]);
|
|
304
|
+
}
|
|
305
|
+
return arr;
|
|
306
|
+
}
|
|
307
|
+
exports.swap32IfBE = exports.isLE ? (u) => u : byteSwap32;
|
|
308
|
+
var hasHexBuiltin = /* @__PURE__ */ (() => (
|
|
309
|
+
// @ts-ignore
|
|
310
|
+
typeof Uint8Array.from([]).toHex === "function" && typeof Uint8Array.fromHex === "function"
|
|
311
|
+
))();
|
|
312
|
+
var hexes = /* @__PURE__ */ Array.from({ length: 256 }, (_, i) => i.toString(16).padStart(2, "0"));
|
|
313
|
+
function bytesToHex(bytes) {
|
|
314
|
+
abytes(bytes);
|
|
315
|
+
if (hasHexBuiltin)
|
|
316
|
+
return bytes.toHex();
|
|
317
|
+
let hex = "";
|
|
318
|
+
for (let i = 0; i < bytes.length; i++) {
|
|
319
|
+
hex += hexes[bytes[i]];
|
|
320
|
+
}
|
|
321
|
+
return hex;
|
|
322
|
+
}
|
|
323
|
+
var asciis = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
324
|
+
function asciiToBase16(ch) {
|
|
325
|
+
if (ch >= asciis._0 && ch <= asciis._9)
|
|
326
|
+
return ch - asciis._0;
|
|
327
|
+
if (ch >= asciis.A && ch <= asciis.F)
|
|
328
|
+
return ch - (asciis.A - 10);
|
|
329
|
+
if (ch >= asciis.a && ch <= asciis.f)
|
|
330
|
+
return ch - (asciis.a - 10);
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
function hexToBytes2(hex) {
|
|
334
|
+
if (typeof hex !== "string")
|
|
335
|
+
throw new Error("hex string expected, got " + typeof hex);
|
|
336
|
+
if (hasHexBuiltin)
|
|
337
|
+
return Uint8Array.fromHex(hex);
|
|
338
|
+
const hl = hex.length;
|
|
339
|
+
const al = hl / 2;
|
|
340
|
+
if (hl % 2)
|
|
341
|
+
throw new Error("hex string expected, got unpadded hex of length " + hl);
|
|
342
|
+
const array = new Uint8Array(al);
|
|
343
|
+
for (let ai = 0, hi = 0; ai < al; ai++, hi += 2) {
|
|
344
|
+
const n1 = asciiToBase16(hex.charCodeAt(hi));
|
|
345
|
+
const n2 = asciiToBase16(hex.charCodeAt(hi + 1));
|
|
346
|
+
if (n1 === void 0 || n2 === void 0) {
|
|
347
|
+
const char2 = hex[hi] + hex[hi + 1];
|
|
348
|
+
throw new Error('hex string expected, got non-hex character "' + char2 + '" at index ' + hi);
|
|
349
|
+
}
|
|
350
|
+
array[ai] = n1 * 16 + n2;
|
|
351
|
+
}
|
|
352
|
+
return array;
|
|
353
|
+
}
|
|
354
|
+
var nextTick = async () => {
|
|
355
|
+
};
|
|
356
|
+
exports.nextTick = nextTick;
|
|
357
|
+
async function asyncLoop(iters, tick, cb) {
|
|
358
|
+
let ts = Date.now();
|
|
359
|
+
for (let i = 0; i < iters; i++) {
|
|
360
|
+
cb(i);
|
|
361
|
+
const diff = Date.now() - ts;
|
|
362
|
+
if (diff >= 0 && diff < tick)
|
|
363
|
+
continue;
|
|
364
|
+
await (0, exports.nextTick)();
|
|
365
|
+
ts += diff;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
function utf8ToBytes(str) {
|
|
369
|
+
if (typeof str !== "string")
|
|
370
|
+
throw new Error("string expected");
|
|
371
|
+
return new Uint8Array(new TextEncoder().encode(str));
|
|
372
|
+
}
|
|
373
|
+
function bytesToUtf8(bytes) {
|
|
374
|
+
return new TextDecoder().decode(bytes);
|
|
375
|
+
}
|
|
376
|
+
function toBytes(data) {
|
|
377
|
+
if (typeof data === "string")
|
|
378
|
+
data = utf8ToBytes(data);
|
|
379
|
+
abytes(data);
|
|
380
|
+
return data;
|
|
381
|
+
}
|
|
382
|
+
function kdfInputToBytes(data) {
|
|
383
|
+
if (typeof data === "string")
|
|
384
|
+
data = utf8ToBytes(data);
|
|
385
|
+
abytes(data);
|
|
386
|
+
return data;
|
|
387
|
+
}
|
|
388
|
+
function concatBytes(...arrays) {
|
|
389
|
+
let sum = 0;
|
|
390
|
+
for (let i = 0; i < arrays.length; i++) {
|
|
391
|
+
const a = arrays[i];
|
|
392
|
+
abytes(a);
|
|
393
|
+
sum += a.length;
|
|
394
|
+
}
|
|
395
|
+
const res = new Uint8Array(sum);
|
|
396
|
+
for (let i = 0, pad = 0; i < arrays.length; i++) {
|
|
397
|
+
const a = arrays[i];
|
|
398
|
+
res.set(a, pad);
|
|
399
|
+
pad += a.length;
|
|
400
|
+
}
|
|
401
|
+
return res;
|
|
402
|
+
}
|
|
403
|
+
function checkOpts(defaults, opts) {
|
|
404
|
+
if (opts !== void 0 && {}.toString.call(opts) !== "[object Object]")
|
|
405
|
+
throw new Error("options should be object or undefined");
|
|
406
|
+
const merged = Object.assign(defaults, opts);
|
|
407
|
+
return merged;
|
|
408
|
+
}
|
|
409
|
+
var Hash = class {
|
|
410
|
+
};
|
|
411
|
+
exports.Hash = Hash;
|
|
412
|
+
function createHasher(hashCons) {
|
|
413
|
+
const hashC = (msg) => hashCons().update(toBytes(msg)).digest();
|
|
414
|
+
const tmp = hashCons();
|
|
415
|
+
hashC.outputLen = tmp.outputLen;
|
|
416
|
+
hashC.blockLen = tmp.blockLen;
|
|
417
|
+
hashC.create = () => hashCons();
|
|
418
|
+
return hashC;
|
|
419
|
+
}
|
|
420
|
+
function createOptHasher(hashCons) {
|
|
421
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
422
|
+
const tmp = hashCons({});
|
|
423
|
+
hashC.outputLen = tmp.outputLen;
|
|
424
|
+
hashC.blockLen = tmp.blockLen;
|
|
425
|
+
hashC.create = (opts) => hashCons(opts);
|
|
426
|
+
return hashC;
|
|
427
|
+
}
|
|
428
|
+
function createXOFer(hashCons) {
|
|
429
|
+
const hashC = (msg, opts) => hashCons(opts).update(toBytes(msg)).digest();
|
|
430
|
+
const tmp = hashCons({});
|
|
431
|
+
hashC.outputLen = tmp.outputLen;
|
|
432
|
+
hashC.blockLen = tmp.blockLen;
|
|
433
|
+
hashC.create = (opts) => hashCons(opts);
|
|
434
|
+
return hashC;
|
|
435
|
+
}
|
|
436
|
+
exports.wrapConstructor = createHasher;
|
|
437
|
+
exports.wrapConstructorWithOpts = createOptHasher;
|
|
438
|
+
exports.wrapXOFConstructorWithOpts = createXOFer;
|
|
439
|
+
function randomBytes(bytesLength = 32) {
|
|
440
|
+
if (crypto_1.crypto && typeof crypto_1.crypto.getRandomValues === "function") {
|
|
441
|
+
return crypto_1.crypto.getRandomValues(new Uint8Array(bytesLength));
|
|
442
|
+
}
|
|
443
|
+
if (crypto_1.crypto && typeof crypto_1.crypto.randomBytes === "function") {
|
|
444
|
+
return Uint8Array.from(crypto_1.crypto.randomBytes(bytesLength));
|
|
445
|
+
}
|
|
446
|
+
throw new Error("crypto.getRandomValues must be defined");
|
|
447
|
+
}
|
|
448
|
+
}
|
|
449
|
+
});
|
|
450
|
+
|
|
451
|
+
// ../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/sha3.js
|
|
452
|
+
var require_sha3 = __commonJS({
|
|
453
|
+
"../../node_modules/.pnpm/@noble+hashes@1.8.0/node_modules/@noble/hashes/sha3.js"(exports) {
|
|
454
|
+
"use strict";
|
|
455
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
456
|
+
exports.shake256 = exports.shake128 = exports.keccak_512 = exports.keccak_384 = exports.keccak_256 = exports.keccak_224 = exports.sha3_512 = exports.sha3_384 = exports.sha3_256 = exports.sha3_224 = exports.Keccak = void 0;
|
|
457
|
+
exports.keccakP = keccakP;
|
|
458
|
+
var _u64_ts_1 = require_u64();
|
|
459
|
+
var utils_ts_1 = require_utils();
|
|
460
|
+
var _0n = BigInt(0);
|
|
461
|
+
var _1n = BigInt(1);
|
|
462
|
+
var _2n = BigInt(2);
|
|
463
|
+
var _7n = BigInt(7);
|
|
464
|
+
var _256n = BigInt(256);
|
|
465
|
+
var _0x71n = BigInt(113);
|
|
466
|
+
var SHA3_PI = [];
|
|
467
|
+
var SHA3_ROTL = [];
|
|
468
|
+
var _SHA3_IOTA = [];
|
|
469
|
+
for (let round = 0, R = _1n, x = 1, y = 0; round < 24; round++) {
|
|
470
|
+
[x, y] = [y, (2 * x + 3 * y) % 5];
|
|
471
|
+
SHA3_PI.push(2 * (5 * y + x));
|
|
472
|
+
SHA3_ROTL.push((round + 1) * (round + 2) / 2 % 64);
|
|
473
|
+
let t = _0n;
|
|
474
|
+
for (let j = 0; j < 7; j++) {
|
|
475
|
+
R = (R << _1n ^ (R >> _7n) * _0x71n) % _256n;
|
|
476
|
+
if (R & _2n)
|
|
477
|
+
t ^= _1n << (_1n << /* @__PURE__ */ BigInt(j)) - _1n;
|
|
478
|
+
}
|
|
479
|
+
_SHA3_IOTA.push(t);
|
|
480
|
+
}
|
|
481
|
+
var IOTAS = (0, _u64_ts_1.split)(_SHA3_IOTA, true);
|
|
482
|
+
var SHA3_IOTA_H = IOTAS[0];
|
|
483
|
+
var SHA3_IOTA_L = IOTAS[1];
|
|
484
|
+
var rotlH = (h, l, s) => s > 32 ? (0, _u64_ts_1.rotlBH)(h, l, s) : (0, _u64_ts_1.rotlSH)(h, l, s);
|
|
485
|
+
var rotlL = (h, l, s) => s > 32 ? (0, _u64_ts_1.rotlBL)(h, l, s) : (0, _u64_ts_1.rotlSL)(h, l, s);
|
|
486
|
+
function keccakP(s, rounds = 24) {
|
|
487
|
+
const B = new Uint32Array(5 * 2);
|
|
488
|
+
for (let round = 24 - rounds; round < 24; round++) {
|
|
489
|
+
for (let x = 0; x < 10; x++)
|
|
490
|
+
B[x] = s[x] ^ s[x + 10] ^ s[x + 20] ^ s[x + 30] ^ s[x + 40];
|
|
491
|
+
for (let x = 0; x < 10; x += 2) {
|
|
492
|
+
const idx1 = (x + 8) % 10;
|
|
493
|
+
const idx0 = (x + 2) % 10;
|
|
494
|
+
const B0 = B[idx0];
|
|
495
|
+
const B1 = B[idx0 + 1];
|
|
496
|
+
const Th = rotlH(B0, B1, 1) ^ B[idx1];
|
|
497
|
+
const Tl = rotlL(B0, B1, 1) ^ B[idx1 + 1];
|
|
498
|
+
for (let y = 0; y < 50; y += 10) {
|
|
499
|
+
s[x + y] ^= Th;
|
|
500
|
+
s[x + y + 1] ^= Tl;
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
let curH = s[2];
|
|
504
|
+
let curL = s[3];
|
|
505
|
+
for (let t = 0; t < 24; t++) {
|
|
506
|
+
const shift = SHA3_ROTL[t];
|
|
507
|
+
const Th = rotlH(curH, curL, shift);
|
|
508
|
+
const Tl = rotlL(curH, curL, shift);
|
|
509
|
+
const PI = SHA3_PI[t];
|
|
510
|
+
curH = s[PI];
|
|
511
|
+
curL = s[PI + 1];
|
|
512
|
+
s[PI] = Th;
|
|
513
|
+
s[PI + 1] = Tl;
|
|
514
|
+
}
|
|
515
|
+
for (let y = 0; y < 50; y += 10) {
|
|
516
|
+
for (let x = 0; x < 10; x++)
|
|
517
|
+
B[x] = s[y + x];
|
|
518
|
+
for (let x = 0; x < 10; x++)
|
|
519
|
+
s[y + x] ^= ~B[(x + 2) % 10] & B[(x + 4) % 10];
|
|
520
|
+
}
|
|
521
|
+
s[0] ^= SHA3_IOTA_H[round];
|
|
522
|
+
s[1] ^= SHA3_IOTA_L[round];
|
|
523
|
+
}
|
|
524
|
+
(0, utils_ts_1.clean)(B);
|
|
525
|
+
}
|
|
526
|
+
var Keccak = class _Keccak extends utils_ts_1.Hash {
|
|
527
|
+
// NOTE: we accept arguments in bytes instead of bits here.
|
|
528
|
+
constructor(blockLen, suffix, outputLen, enableXOF = false, rounds = 24) {
|
|
529
|
+
super();
|
|
530
|
+
this.pos = 0;
|
|
531
|
+
this.posOut = 0;
|
|
532
|
+
this.finished = false;
|
|
533
|
+
this.destroyed = false;
|
|
534
|
+
this.enableXOF = false;
|
|
535
|
+
this.blockLen = blockLen;
|
|
536
|
+
this.suffix = suffix;
|
|
537
|
+
this.outputLen = outputLen;
|
|
538
|
+
this.enableXOF = enableXOF;
|
|
539
|
+
this.rounds = rounds;
|
|
540
|
+
(0, utils_ts_1.anumber)(outputLen);
|
|
541
|
+
if (!(0 < blockLen && blockLen < 200))
|
|
542
|
+
throw new Error("only keccak-f1600 function is supported");
|
|
543
|
+
this.state = new Uint8Array(200);
|
|
544
|
+
this.state32 = (0, utils_ts_1.u32)(this.state);
|
|
545
|
+
}
|
|
546
|
+
clone() {
|
|
547
|
+
return this._cloneInto();
|
|
548
|
+
}
|
|
549
|
+
keccak() {
|
|
550
|
+
(0, utils_ts_1.swap32IfBE)(this.state32);
|
|
551
|
+
keccakP(this.state32, this.rounds);
|
|
552
|
+
(0, utils_ts_1.swap32IfBE)(this.state32);
|
|
553
|
+
this.posOut = 0;
|
|
554
|
+
this.pos = 0;
|
|
555
|
+
}
|
|
556
|
+
update(data) {
|
|
557
|
+
(0, utils_ts_1.aexists)(this);
|
|
558
|
+
data = (0, utils_ts_1.toBytes)(data);
|
|
559
|
+
(0, utils_ts_1.abytes)(data);
|
|
560
|
+
const { blockLen, state } = this;
|
|
561
|
+
const len = data.length;
|
|
562
|
+
for (let pos = 0; pos < len; ) {
|
|
563
|
+
const take = Math.min(blockLen - this.pos, len - pos);
|
|
564
|
+
for (let i = 0; i < take; i++)
|
|
565
|
+
state[this.pos++] ^= data[pos++];
|
|
566
|
+
if (this.pos === blockLen)
|
|
567
|
+
this.keccak();
|
|
568
|
+
}
|
|
569
|
+
return this;
|
|
570
|
+
}
|
|
571
|
+
finish() {
|
|
572
|
+
if (this.finished)
|
|
573
|
+
return;
|
|
574
|
+
this.finished = true;
|
|
575
|
+
const { state, suffix, pos, blockLen } = this;
|
|
576
|
+
state[pos] ^= suffix;
|
|
577
|
+
if ((suffix & 128) !== 0 && pos === blockLen - 1)
|
|
578
|
+
this.keccak();
|
|
579
|
+
state[blockLen - 1] ^= 128;
|
|
580
|
+
this.keccak();
|
|
581
|
+
}
|
|
582
|
+
writeInto(out) {
|
|
583
|
+
(0, utils_ts_1.aexists)(this, false);
|
|
584
|
+
(0, utils_ts_1.abytes)(out);
|
|
585
|
+
this.finish();
|
|
586
|
+
const bufferOut = this.state;
|
|
587
|
+
const { blockLen } = this;
|
|
588
|
+
for (let pos = 0, len = out.length; pos < len; ) {
|
|
589
|
+
if (this.posOut >= blockLen)
|
|
590
|
+
this.keccak();
|
|
591
|
+
const take = Math.min(blockLen - this.posOut, len - pos);
|
|
592
|
+
out.set(bufferOut.subarray(this.posOut, this.posOut + take), pos);
|
|
593
|
+
this.posOut += take;
|
|
594
|
+
pos += take;
|
|
595
|
+
}
|
|
596
|
+
return out;
|
|
597
|
+
}
|
|
598
|
+
xofInto(out) {
|
|
599
|
+
if (!this.enableXOF)
|
|
600
|
+
throw new Error("XOF is not possible for this instance");
|
|
601
|
+
return this.writeInto(out);
|
|
602
|
+
}
|
|
603
|
+
xof(bytes) {
|
|
604
|
+
(0, utils_ts_1.anumber)(bytes);
|
|
605
|
+
return this.xofInto(new Uint8Array(bytes));
|
|
606
|
+
}
|
|
607
|
+
digestInto(out) {
|
|
608
|
+
(0, utils_ts_1.aoutput)(out, this);
|
|
609
|
+
if (this.finished)
|
|
610
|
+
throw new Error("digest() was already called");
|
|
611
|
+
this.writeInto(out);
|
|
612
|
+
this.destroy();
|
|
613
|
+
return out;
|
|
614
|
+
}
|
|
615
|
+
digest() {
|
|
616
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
617
|
+
}
|
|
618
|
+
destroy() {
|
|
619
|
+
this.destroyed = true;
|
|
620
|
+
(0, utils_ts_1.clean)(this.state);
|
|
621
|
+
}
|
|
622
|
+
_cloneInto(to) {
|
|
623
|
+
const { blockLen, suffix, outputLen, rounds, enableXOF } = this;
|
|
624
|
+
to || (to = new _Keccak(blockLen, suffix, outputLen, enableXOF, rounds));
|
|
625
|
+
to.state32.set(this.state32);
|
|
626
|
+
to.pos = this.pos;
|
|
627
|
+
to.posOut = this.posOut;
|
|
628
|
+
to.finished = this.finished;
|
|
629
|
+
to.rounds = rounds;
|
|
630
|
+
to.suffix = suffix;
|
|
631
|
+
to.outputLen = outputLen;
|
|
632
|
+
to.enableXOF = enableXOF;
|
|
633
|
+
to.destroyed = this.destroyed;
|
|
634
|
+
return to;
|
|
635
|
+
}
|
|
636
|
+
};
|
|
637
|
+
exports.Keccak = Keccak;
|
|
638
|
+
var gen = (suffix, blockLen, outputLen) => (0, utils_ts_1.createHasher)(() => new Keccak(blockLen, suffix, outputLen));
|
|
639
|
+
exports.sha3_224 = (() => gen(6, 144, 224 / 8))();
|
|
640
|
+
exports.sha3_256 = (() => gen(6, 136, 256 / 8))();
|
|
641
|
+
exports.sha3_384 = (() => gen(6, 104, 384 / 8))();
|
|
642
|
+
exports.sha3_512 = (() => gen(6, 72, 512 / 8))();
|
|
643
|
+
exports.keccak_224 = (() => gen(1, 144, 224 / 8))();
|
|
644
|
+
exports.keccak_256 = (() => gen(1, 136, 256 / 8))();
|
|
645
|
+
exports.keccak_384 = (() => gen(1, 104, 384 / 8))();
|
|
646
|
+
exports.keccak_512 = (() => gen(1, 72, 512 / 8))();
|
|
647
|
+
var genShake = (suffix, blockLen, outputLen) => (0, utils_ts_1.createXOFer)((opts = {}) => new Keccak(blockLen, suffix, opts.dkLen === void 0 ? outputLen : opts.dkLen, true));
|
|
648
|
+
exports.shake128 = (() => genShake(31, 168, 128 / 8))();
|
|
649
|
+
exports.shake256 = (() => genShake(31, 136, 256 / 8))();
|
|
650
|
+
}
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
// ../../node_modules/.pnpm/@paralleldrive+cuid2@2.3.1/node_modules/@paralleldrive/cuid2/src/index.js
|
|
654
|
+
var require_src = __commonJS({
|
|
655
|
+
"../../node_modules/.pnpm/@paralleldrive+cuid2@2.3.1/node_modules/@paralleldrive/cuid2/src/index.js"(exports, module) {
|
|
656
|
+
var { sha3_512: sha3 } = require_sha3();
|
|
657
|
+
var defaultLength = 24;
|
|
658
|
+
var bigLength = 32;
|
|
659
|
+
var createEntropy = (length = 4, random = Math.random) => {
|
|
660
|
+
let entropy = "";
|
|
661
|
+
while (entropy.length < length) {
|
|
662
|
+
entropy = entropy + Math.floor(random() * 36).toString(36);
|
|
663
|
+
}
|
|
664
|
+
return entropy;
|
|
665
|
+
};
|
|
666
|
+
function bufToBigInt(buf) {
|
|
667
|
+
let bits = 8n;
|
|
668
|
+
let value = 0n;
|
|
669
|
+
for (const i of buf.values()) {
|
|
670
|
+
const bi = BigInt(i);
|
|
671
|
+
value = (value << bits) + bi;
|
|
672
|
+
}
|
|
673
|
+
return value;
|
|
674
|
+
}
|
|
675
|
+
var hash = (input = "") => {
|
|
676
|
+
return bufToBigInt(sha3(input)).toString(36).slice(1);
|
|
677
|
+
};
|
|
678
|
+
var alphabet = Array.from(
|
|
679
|
+
{ length: 26 },
|
|
680
|
+
(x, i) => String.fromCharCode(i + 97)
|
|
681
|
+
);
|
|
682
|
+
var randomLetter = (random) => alphabet[Math.floor(random() * alphabet.length)];
|
|
683
|
+
var createFingerprint = ({
|
|
684
|
+
globalObj = typeof global !== "undefined" ? global : typeof window !== "undefined" ? window : {},
|
|
685
|
+
random = Math.random
|
|
686
|
+
} = {}) => {
|
|
687
|
+
const globals = Object.keys(globalObj).toString();
|
|
688
|
+
const sourceString = globals.length ? globals + createEntropy(bigLength, random) : createEntropy(bigLength, random);
|
|
689
|
+
return hash(sourceString).substring(0, bigLength);
|
|
690
|
+
};
|
|
691
|
+
var createCounter = (count) => () => {
|
|
692
|
+
return count++;
|
|
693
|
+
};
|
|
694
|
+
var initialCountMax = 476782367;
|
|
695
|
+
var init2 = ({
|
|
696
|
+
// Fallback if the user does not pass in a CSPRNG. This should be OK
|
|
697
|
+
// because we don't rely solely on the random number generator for entropy.
|
|
698
|
+
// We also use the host fingerprint, current time, and a session counter.
|
|
699
|
+
random = Math.random,
|
|
700
|
+
counter = createCounter(Math.floor(random() * initialCountMax)),
|
|
701
|
+
length = defaultLength,
|
|
702
|
+
fingerprint = createFingerprint({ random })
|
|
703
|
+
} = {}) => {
|
|
704
|
+
return function cuid2() {
|
|
705
|
+
const firstLetter = randomLetter(random);
|
|
706
|
+
const time2 = Date.now().toString(36);
|
|
707
|
+
const count = counter().toString(36);
|
|
708
|
+
const salt = createEntropy(length, random);
|
|
709
|
+
const hashInput = `${time2 + salt + count + fingerprint}`;
|
|
710
|
+
return `${firstLetter + hash(hashInput).substring(1, length)}`;
|
|
711
|
+
};
|
|
712
|
+
};
|
|
713
|
+
var createId6 = init2();
|
|
714
|
+
var isCuid = (id, { minLength = 2, maxLength = bigLength } = {}) => {
|
|
715
|
+
const length = id.length;
|
|
716
|
+
const regex = /^[0-9a-z]+$/;
|
|
717
|
+
try {
|
|
718
|
+
if (typeof id === "string" && length >= minLength && length <= maxLength && regex.test(id))
|
|
719
|
+
return true;
|
|
720
|
+
} finally {
|
|
721
|
+
}
|
|
722
|
+
return false;
|
|
723
|
+
};
|
|
724
|
+
module.exports.getConstants = () => ({ defaultLength, bigLength });
|
|
725
|
+
module.exports.init = init2;
|
|
726
|
+
module.exports.createId = createId6;
|
|
727
|
+
module.exports.bufToBigInt = bufToBigInt;
|
|
728
|
+
module.exports.createCounter = createCounter;
|
|
729
|
+
module.exports.createFingerprint = createFingerprint;
|
|
730
|
+
module.exports.isCuid = isCuid;
|
|
731
|
+
}
|
|
732
|
+
});
|
|
733
|
+
|
|
734
|
+
// ../../node_modules/.pnpm/@paralleldrive+cuid2@2.3.1/node_modules/@paralleldrive/cuid2/index.js
|
|
735
|
+
var require_cuid2 = __commonJS({
|
|
736
|
+
"../../node_modules/.pnpm/@paralleldrive+cuid2@2.3.1/node_modules/@paralleldrive/cuid2/index.js"(exports, module) {
|
|
737
|
+
var { createId: createId6, init: init2, getConstants, isCuid } = require_src();
|
|
738
|
+
module.exports.createId = createId6;
|
|
739
|
+
module.exports.init = init2;
|
|
740
|
+
module.exports.getConstants = getConstants;
|
|
741
|
+
module.exports.isCuid = isCuid;
|
|
742
|
+
}
|
|
743
|
+
});
|
|
744
|
+
|
|
745
|
+
// src/cli/commands/sync.ts
|
|
746
|
+
var sync_exports = {};
|
|
747
|
+
__export(sync_exports, {
|
|
748
|
+
sync: () => sync,
|
|
749
|
+
syncEntries: () => syncEntries
|
|
750
|
+
});
|
|
751
|
+
import fs4 from "node:fs";
|
|
752
|
+
import path4 from "node:path";
|
|
753
|
+
async function syncEntries(config) {
|
|
754
|
+
const cfg = config || readConfig();
|
|
755
|
+
if (!cfg?.apiKey) {
|
|
756
|
+
fail("Not authenticated. Run: basestream login");
|
|
757
|
+
process.exit(1);
|
|
758
|
+
}
|
|
759
|
+
ensureDirs();
|
|
760
|
+
const files = fs4.readdirSync(BUFFER_DIR).filter((f) => f.endsWith(".json")).sort();
|
|
761
|
+
if (files.length === 0) return;
|
|
762
|
+
const entries = [];
|
|
763
|
+
const successFiles = [];
|
|
764
|
+
for (const file of files) {
|
|
765
|
+
try {
|
|
766
|
+
const raw = fs4.readFileSync(path4.join(BUFFER_DIR, file), "utf-8");
|
|
767
|
+
const entry = JSON.parse(raw);
|
|
768
|
+
entries.push(entry);
|
|
769
|
+
successFiles.push(file);
|
|
770
|
+
} catch {
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
if (entries.length === 0) return;
|
|
774
|
+
const res = await fetch(`${cfg.baseUrl}/api/sync`, {
|
|
775
|
+
method: "POST",
|
|
776
|
+
headers: {
|
|
777
|
+
"Content-Type": "application/json",
|
|
778
|
+
Authorization: `Bearer ${cfg.apiKey}`
|
|
779
|
+
},
|
|
780
|
+
body: JSON.stringify({ entries })
|
|
781
|
+
});
|
|
782
|
+
if (!res.ok) {
|
|
783
|
+
const body = await res.text().catch(() => "");
|
|
784
|
+
throw new Error(`Sync failed (${res.status}): ${body}`);
|
|
785
|
+
}
|
|
786
|
+
const result = await res.json();
|
|
787
|
+
for (const file of successFiles) {
|
|
788
|
+
fs4.unlinkSync(path4.join(BUFFER_DIR, file));
|
|
789
|
+
}
|
|
790
|
+
return result;
|
|
791
|
+
}
|
|
792
|
+
async function sync() {
|
|
793
|
+
const cfg = readConfig();
|
|
794
|
+
if (!cfg?.apiKey) {
|
|
795
|
+
fail("Not authenticated. Run: basestream login");
|
|
796
|
+
process.exit(1);
|
|
797
|
+
}
|
|
798
|
+
ensureDirs();
|
|
799
|
+
const files = fs4.readdirSync(BUFFER_DIR).filter((f) => f.endsWith(".json"));
|
|
800
|
+
if (files.length === 0) {
|
|
801
|
+
console.log(` ${c.dim("No entries to sync.")}`);
|
|
802
|
+
return;
|
|
803
|
+
}
|
|
804
|
+
console.log(` ${c.dim(`Syncing ${files.length} entries...`)}`);
|
|
805
|
+
try {
|
|
806
|
+
const result = await syncEntries(cfg);
|
|
807
|
+
if (result) {
|
|
808
|
+
check(
|
|
809
|
+
`Synced ${result.synced} entries (${result.created} new, ${result.updated} updated)`
|
|
810
|
+
);
|
|
811
|
+
}
|
|
812
|
+
} catch (err) {
|
|
813
|
+
fail(
|
|
814
|
+
`Sync failed: ${err instanceof Error ? err.message : String(err)}`
|
|
815
|
+
);
|
|
816
|
+
process.exit(1);
|
|
817
|
+
}
|
|
818
|
+
}
|
|
819
|
+
var init_sync = __esm({
|
|
820
|
+
"src/cli/commands/sync.ts"() {
|
|
821
|
+
"use strict";
|
|
822
|
+
init_config();
|
|
823
|
+
init_util();
|
|
824
|
+
}
|
|
825
|
+
});
|
|
826
|
+
|
|
827
|
+
// src/cli/commands/init.ts
|
|
828
|
+
init_config();
|
|
829
|
+
init_util();
|
|
830
|
+
import fs2 from "node:fs";
|
|
831
|
+
import path2 from "node:path";
|
|
832
|
+
import os2 from "node:os";
|
|
833
|
+
import { execSync as execSync2 } from "node:child_process";
|
|
834
|
+
|
|
835
|
+
// src/cli/commands/login.ts
|
|
836
|
+
init_config();
|
|
837
|
+
init_util();
|
|
838
|
+
import http from "node:http";
|
|
839
|
+
import { execSync } from "node:child_process";
|
|
840
|
+
var DEFAULT_BASE_URL = "https://www.basestream.ai";
|
|
841
|
+
function openBrowser(url) {
|
|
842
|
+
try {
|
|
843
|
+
const platform = process.platform;
|
|
844
|
+
if (platform === "darwin") execSync(`open "${url}"`);
|
|
845
|
+
else if (platform === "win32") execSync(`start "${url}"`);
|
|
846
|
+
else execSync(`xdg-open "${url}"`);
|
|
847
|
+
} catch {
|
|
848
|
+
console.log(` ${c.dim(`Open this URL in your browser: ${url}`)}`);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
async function login() {
|
|
852
|
+
const existing = readConfig();
|
|
853
|
+
const baseUrl = existing?.baseUrl || process.env.BASESTREAM_URL || DEFAULT_BASE_URL;
|
|
854
|
+
console.log(
|
|
855
|
+
` ${c.dim("Opening browser for authentication...")}`
|
|
856
|
+
);
|
|
857
|
+
const apiKey = await new Promise((resolve, reject) => {
|
|
858
|
+
const server = http.createServer((req, res) => {
|
|
859
|
+
const url = new URL(req.url || "/", `http://localhost`);
|
|
860
|
+
const key = url.searchParams.get("key");
|
|
861
|
+
const orgId = url.searchParams.get("orgId");
|
|
862
|
+
if (key) {
|
|
863
|
+
res.writeHead(200, { "Content-Type": "text/html" });
|
|
864
|
+
res.end(`<!DOCTYPE html>
|
|
865
|
+
<html lang="en">
|
|
866
|
+
<head>
|
|
867
|
+
<meta charset="utf-8">
|
|
868
|
+
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
869
|
+
<title>Basestream CLI \u2014 Authenticated</title>
|
|
870
|
+
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
871
|
+
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
872
|
+
<link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=Newsreader:wght@500;600&display=swap" rel="stylesheet">
|
|
873
|
+
</head>
|
|
874
|
+
<body style="font-family: 'DM Sans', -apple-system, system-ui, sans-serif; display: flex; align-items: center; justify-content: center; height: 100vh; margin: 0; background: #faf8f4; color: #1a1714;">
|
|
875
|
+
<div style="text-align: center;">
|
|
876
|
+
<div style="display: flex; align-items: center; justify-content: center; gap: 0.625rem; margin-bottom: 2rem;">
|
|
877
|
+
<div style="display: flex; align-items: center; justify-content: center; width: 2rem; height: 2rem; background: #1a1714; border-radius: 8px;">
|
|
878
|
+
<svg width="16" height="16" viewBox="0 0 22 22" fill="none"><path d="M7.39855 11.2475C10.1937 11.2476 12.4598 13.5124 12.4598 16.3052C12.4596 19.0979 10.1936 21.3616 7.39855 21.3618H0V16.3052C0 15.7395 0.094025 15.1955 0.265523 14.6876C0.304389 14.5726 0.345701 14.4588 0.392462 14.3476C0.602402 13.8482 0.890874 13.39 1.24144 12.9873C1.25986 12.9662 1.27857 12.9453 1.29734 12.9245C1.39051 12.821 1.48832 12.7218 1.58965 12.6263C1.60303 12.6137 1.61572 12.6004 1.62924 12.5879C1.73452 12.4908 1.8444 12.3987 1.95765 12.3107C1.97096 12.3004 1.98383 12.2895 1.99725 12.2793C2.1117 12.1922 2.23063 12.1108 2.35244 12.0336C2.36662 12.0246 2.3801 12.0145 2.39437 12.0056C2.44032 11.9771 2.48719 11.95 2.53412 11.9229C2.56226 11.9067 2.59065 11.8909 2.61913 11.8752C2.64893 11.8587 2.67864 11.8421 2.7088 11.8263C2.75348 11.8028 2.79844 11.7797 2.84389 11.7576C2.88103 11.7394 2.91922 11.7235 2.95686 11.7063C2.98716 11.6925 3.01707 11.6777 3.04769 11.6644C3.09301 11.6447 3.13912 11.6269 3.18511 11.6085C3.21662 11.5959 3.24764 11.582 3.27945 11.5701C3.32936 11.5513 3.38019 11.5349 3.43084 11.5177C3.45418 11.5097 3.47722 11.5008 3.50071 11.4932C3.55658 11.4751 3.61289 11.4581 3.66958 11.442C3.69166 11.4357 3.71376 11.4293 3.73596 11.4233C3.79907 11.4063 3.86289 11.3914 3.92695 11.3767C3.94209 11.3733 3.95718 11.3696 3.97237 11.3663C4.11504 11.335 4.25985 11.3095 4.40675 11.2906C4.43232 11.2873 4.45794 11.2842 4.48362 11.2812C4.54425 11.2744 4.60519 11.2685 4.66645 11.2638C4.67847 11.2629 4.69052 11.2623 4.70256 11.2614L4.80038 11.2545C4.88671 11.2501 4.97383 11.2475 5.06125 11.2475H7.39855ZM16.9388 11.2475C19.734 11.2476 22 13.5124 22 16.3052C21.9998 19.0979 19.7338 21.3616 16.9388 21.3618H13.2832C14.4337 20.2108 15.1709 18.4482 15.1709 16.4718C15.1709 14.2926 14.2749 12.3735 12.9163 11.2475H16.9388ZM7.39855 0.00116458C10.1937 0.0013425 12.4598 2.26497 12.4598 5.05775C12.4597 7.85045 10.1937 10.1142 7.39855 10.1143H0V5.05775C0 4.89236 0.00775963 4.7288 0.0232915 4.56747C0.0274579 4.52418 0.0331791 4.48116 0.038431 4.4382C0.0524815 4.32328 0.0692046 4.20938 0.0908369 4.09698L0.102483 4.03875C0.106227 4.02046 0.110188 4.00223 0.114128 3.98401C0.127164 3.92376 0.142054 3.8641 0.157218 3.80467C0.164069 3.77781 0.1709 3.75099 0.17818 3.72431C0.188513 3.68644 0.199603 3.64886 0.210788 3.61135C0.225482 3.56207 0.241227 3.51324 0.257371 3.46461C0.269763 3.42728 0.281404 3.38975 0.294638 3.35281C0.30559 3.32224 0.318053 3.29227 0.329575 3.26198C0.343044 3.22656 0.356098 3.19103 0.370335 3.156C0.387188 3.11454 0.404827 3.07346 0.422741 3.03256C0.44039 2.99225 0.458814 2.95235 0.477476 2.9126C0.491731 2.88224 0.505727 2.85179 0.520565 2.82177C0.537576 2.78734 0.555205 2.75326 0.572971 2.71928C0.592296 2.68233 0.610995 2.64506 0.6312 2.60865C0.657644 2.56099 0.68596 2.51444 0.713885 2.46774C0.725232 2.44876 0.736069 2.42949 0.747658 2.41067C0.773311 2.36902 0.800032 2.32807 0.826849 2.28723C0.843934 2.26121 0.860541 2.23488 0.87809 2.2092C0.953313 2.0991 1.03336 1.99256 1.11683 1.88894C1.18114 1.80912 1.24702 1.73059 1.31597 1.65486C1.47484 1.48036 1.64557 1.31664 1.82722 1.16574C1.85016 1.14669 1.87382 1.12849 1.89709 1.10984C1.99837 1.02867 2.10292 0.951415 2.21036 0.87809C2.23606 0.86056 2.26236 0.843915 2.28839 0.826849C2.32925 0.800052 2.37017 0.773292 2.41184 0.747658C2.43349 0.734341 2.45518 0.721061 2.47705 0.708062C2.52886 0.677257 2.58129 0.647377 2.63427 0.61839C2.64707 0.61139 2.65984 0.604319 2.6727 0.597427C2.72986 0.566794 2.78777 0.537396 2.84622 0.50892C2.86043 0.502002 2.87503 0.49591 2.88931 0.489122C2.94744 0.461478 3.00584 0.434234 3.06516 0.408766C3.0837 0.400809 3.10241 0.393216 3.12106 0.385475C3.17763 0.361989 3.23467 0.3394 3.29226 0.317929C3.30779 0.31214 3.32324 0.306101 3.33884 0.300461C3.39807 0.279043 3.45795 0.25915 3.51818 0.239903C3.54179 0.232361 3.56547 0.224979 3.58922 0.217776C3.63126 0.205025 3.67367 0.193353 3.71616 0.181674C3.7556 0.170838 3.79513 0.16013 3.83495 0.15023C3.9786 0.114503 4.12462 0.0848882 4.27283 0.0617225C4.28096 0.0604516 4.28914 0.059461 4.29728 0.0582288C4.36902 0.047376 4.44121 0.038089 4.5139 0.030279C4.5248 0.0291076 4.53558 0.0267227 4.5465 0.0256207C4.55542 0.0247215 4.56436 0.0241444 4.57329 0.0232915L4.57096 0.0244561C4.73223 0.00896687 4.89591 0.00117115 5.06125 0.00116458H7.39855ZM16.9388 0C19.734 0.000177881 22 2.26497 22 5.05775C21.9999 7.85045 19.7339 10.1142 16.9388 10.1143H12.9175C14.2754 8.98827 15.1708 7.06961 15.1709 4.89122C15.1709 2.91428 14.433 1.15104 13.282 0H16.9388Z" fill="#FAF8F4"/></svg>
|
|
879
|
+
</div>
|
|
880
|
+
<span style="font-size: 1rem; font-weight: 600;">basestream</span>
|
|
881
|
+
</div>
|
|
882
|
+
<div style="background: #fffdf9; border: 1px solid #e8e4de; border-radius: 16px; padding: 2rem; display: inline-block;">
|
|
883
|
+
<h1 style="font-family: 'Newsreader', Georgia, serif; font-size: 1.25rem; color: #6b7e6b; margin-bottom: 0.5rem;">✓ Authenticated</h1>
|
|
884
|
+
<p style="color: #8a8379; font-size: 0.875rem;">You can close this tab and return to your terminal.</p>
|
|
885
|
+
</div>
|
|
886
|
+
</div>
|
|
887
|
+
</body>
|
|
888
|
+
</html>`);
|
|
889
|
+
server.close();
|
|
890
|
+
writeConfig({
|
|
891
|
+
apiKey: key,
|
|
892
|
+
baseUrl,
|
|
893
|
+
orgId: orgId || void 0
|
|
894
|
+
});
|
|
895
|
+
resolve(key);
|
|
896
|
+
} else {
|
|
897
|
+
res.writeHead(400);
|
|
898
|
+
res.end("Missing key parameter");
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
server.listen(0, "127.0.0.1", () => {
|
|
902
|
+
const addr = server.address();
|
|
903
|
+
if (!addr || typeof addr === "string") {
|
|
904
|
+
reject(new Error("Failed to start callback server"));
|
|
905
|
+
return;
|
|
906
|
+
}
|
|
907
|
+
const callbackPort = addr.port;
|
|
908
|
+
const authUrl = `${baseUrl}/api/auth/cli?callback=http://127.0.0.1:${callbackPort}`;
|
|
909
|
+
openBrowser(authUrl);
|
|
910
|
+
});
|
|
911
|
+
setTimeout(() => {
|
|
912
|
+
server.close();
|
|
913
|
+
reject(new Error("Authentication timed out"));
|
|
914
|
+
}, 12e4);
|
|
915
|
+
});
|
|
916
|
+
check("Authenticated with Basestream");
|
|
917
|
+
return apiKey;
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
// src/cli/commands/init.ts
|
|
921
|
+
var CLAUDE_DIR = path2.join(os2.homedir(), ".claude");
|
|
922
|
+
var CLAUDE_SETTINGS_PATH = path2.join(CLAUDE_DIR, "settings.json");
|
|
923
|
+
var CLAUDE_SKILLS_PATH = path2.join(CLAUDE_DIR, "skills", "bs-summarize.md");
|
|
924
|
+
var HOOK_COMMAND = "npx @basestream/cli _hook-stop";
|
|
925
|
+
var HOOK_MARKER = "_hook-stop";
|
|
926
|
+
var SKILL_CONTENT = `---
|
|
927
|
+
name: bs-summarize
|
|
928
|
+
description: Update the Basestream session summary with what's been accomplished so far
|
|
929
|
+
---
|
|
930
|
+
|
|
931
|
+
Write a concise summary of what has been accomplished in this coding session so far. Focus on:
|
|
932
|
+
- What was built, fixed, or changed (be specific about features/bugs)
|
|
933
|
+
- Which parts of the codebase were touched
|
|
934
|
+
- Any key decisions made
|
|
935
|
+
|
|
936
|
+
Keep it to 2-4 sentences, plain prose, no bullet points.
|
|
937
|
+
|
|
938
|
+
Write the summary to the file \`~/.basestream/sessions/\${CLAUDE_SESSION_ID}-summary.md\` \u2014 overwrite if it exists.
|
|
939
|
+
`;
|
|
940
|
+
function installSkill() {
|
|
941
|
+
const skillsDir = path2.dirname(CLAUDE_SKILLS_PATH);
|
|
942
|
+
fs2.mkdirSync(skillsDir, { recursive: true });
|
|
943
|
+
if (fs2.existsSync(CLAUDE_SKILLS_PATH)) {
|
|
944
|
+
fs2.writeFileSync(CLAUDE_SKILLS_PATH, SKILL_CONTENT);
|
|
945
|
+
check("Updated /bs-summarize skill");
|
|
946
|
+
return;
|
|
947
|
+
}
|
|
948
|
+
fs2.writeFileSync(CLAUDE_SKILLS_PATH, SKILL_CONTENT);
|
|
949
|
+
check("Installed /bs-summarize skill into ~/.claude/skills/");
|
|
950
|
+
}
|
|
951
|
+
function detectClaudeCode() {
|
|
952
|
+
try {
|
|
953
|
+
const version2 = execSync2("claude --version 2>/dev/null", {
|
|
954
|
+
encoding: "utf-8"
|
|
955
|
+
}).trim();
|
|
956
|
+
return version2 || null;
|
|
957
|
+
} catch {
|
|
958
|
+
return null;
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
function injectClaudeCodeHook() {
|
|
962
|
+
const settingsDir = path2.dirname(CLAUDE_SETTINGS_PATH);
|
|
963
|
+
fs2.mkdirSync(settingsDir, { recursive: true });
|
|
964
|
+
let settings = {};
|
|
965
|
+
if (fs2.existsSync(CLAUDE_SETTINGS_PATH)) {
|
|
966
|
+
try {
|
|
967
|
+
settings = JSON.parse(fs2.readFileSync(CLAUDE_SETTINGS_PATH, "utf-8"));
|
|
968
|
+
} catch {
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
if (!settings.hooks || typeof settings.hooks !== "object") {
|
|
972
|
+
settings.hooks = {};
|
|
973
|
+
}
|
|
974
|
+
const hooks = settings.hooks;
|
|
975
|
+
if (Array.isArray(hooks.Stop)) {
|
|
976
|
+
const existing = hooks.Stop;
|
|
977
|
+
const alreadyInstalled = existing.some(
|
|
978
|
+
(entry) => entry.hooks?.some((h) => h.command?.includes(HOOK_MARKER))
|
|
979
|
+
);
|
|
980
|
+
if (alreadyInstalled) {
|
|
981
|
+
check("Claude Code hook already installed");
|
|
982
|
+
return;
|
|
983
|
+
}
|
|
984
|
+
}
|
|
985
|
+
if (!Array.isArray(hooks.Stop)) {
|
|
986
|
+
hooks.Stop = [];
|
|
987
|
+
}
|
|
988
|
+
hooks.Stop.push({
|
|
989
|
+
matcher: "*",
|
|
990
|
+
hooks: [
|
|
991
|
+
{
|
|
992
|
+
type: "command",
|
|
993
|
+
command: HOOK_COMMAND,
|
|
994
|
+
timeout: 30
|
|
995
|
+
}
|
|
996
|
+
]
|
|
997
|
+
});
|
|
998
|
+
fs2.writeFileSync(CLAUDE_SETTINGS_PATH, JSON.stringify(settings, null, 2));
|
|
999
|
+
check("Injected tracking hook into ~/.claude/settings.json");
|
|
1000
|
+
}
|
|
1001
|
+
async function init() {
|
|
1002
|
+
console.log();
|
|
1003
|
+
const ccVersion = detectClaudeCode();
|
|
1004
|
+
if (ccVersion) {
|
|
1005
|
+
console.log(` ${c.dim(`Detected: Claude Code ${ccVersion}`)}`);
|
|
1006
|
+
} else {
|
|
1007
|
+
warn("Claude Code not detected \u2014 hook will activate when installed");
|
|
1008
|
+
}
|
|
1009
|
+
console.log();
|
|
1010
|
+
injectClaudeCodeHook();
|
|
1011
|
+
installSkill();
|
|
1012
|
+
ensureDirs();
|
|
1013
|
+
check(`Created ~/.basestream/buffer/`);
|
|
1014
|
+
const existing = readConfig();
|
|
1015
|
+
if (existing?.apiKey) {
|
|
1016
|
+
check("Already authenticated");
|
|
1017
|
+
} else {
|
|
1018
|
+
console.log();
|
|
1019
|
+
await login();
|
|
1020
|
+
}
|
|
1021
|
+
console.log();
|
|
1022
|
+
console.log(
|
|
1023
|
+
` ${c.dim("That's it. Work normally \u2014 every session is now tracked.")}`
|
|
1024
|
+
);
|
|
1025
|
+
console.log();
|
|
1026
|
+
}
|
|
1027
|
+
|
|
1028
|
+
// src/cli/commands/status.ts
|
|
1029
|
+
init_config();
|
|
1030
|
+
import fs3 from "node:fs";
|
|
1031
|
+
import path3 from "node:path";
|
|
1032
|
+
|
|
1033
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/entity.js
|
|
1034
|
+
var entityKind = Symbol.for("drizzle:entityKind");
|
|
1035
|
+
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
1036
|
+
function is(value, type) {
|
|
1037
|
+
if (!value || typeof value !== "object") {
|
|
1038
|
+
return false;
|
|
1039
|
+
}
|
|
1040
|
+
if (value instanceof type) {
|
|
1041
|
+
return true;
|
|
1042
|
+
}
|
|
1043
|
+
if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
|
|
1044
|
+
throw new Error(
|
|
1045
|
+
`Class "${type.name ?? "<unknown>"}" doesn't look like a Drizzle entity. If this is incorrect and the class is provided by Drizzle, please report this as a bug.`
|
|
1046
|
+
);
|
|
1047
|
+
}
|
|
1048
|
+
let cls = Object.getPrototypeOf(value).constructor;
|
|
1049
|
+
if (cls) {
|
|
1050
|
+
while (cls) {
|
|
1051
|
+
if (entityKind in cls && cls[entityKind] === type[entityKind]) {
|
|
1052
|
+
return true;
|
|
1053
|
+
}
|
|
1054
|
+
cls = Object.getPrototypeOf(cls);
|
|
1055
|
+
}
|
|
1056
|
+
}
|
|
1057
|
+
return false;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/column.js
|
|
1061
|
+
var Column = class {
|
|
1062
|
+
constructor(table, config) {
|
|
1063
|
+
this.table = table;
|
|
1064
|
+
this.config = config;
|
|
1065
|
+
this.name = config.name;
|
|
1066
|
+
this.keyAsName = config.keyAsName;
|
|
1067
|
+
this.notNull = config.notNull;
|
|
1068
|
+
this.default = config.default;
|
|
1069
|
+
this.defaultFn = config.defaultFn;
|
|
1070
|
+
this.onUpdateFn = config.onUpdateFn;
|
|
1071
|
+
this.hasDefault = config.hasDefault;
|
|
1072
|
+
this.primary = config.primaryKey;
|
|
1073
|
+
this.isUnique = config.isUnique;
|
|
1074
|
+
this.uniqueName = config.uniqueName;
|
|
1075
|
+
this.uniqueType = config.uniqueType;
|
|
1076
|
+
this.dataType = config.dataType;
|
|
1077
|
+
this.columnType = config.columnType;
|
|
1078
|
+
this.generated = config.generated;
|
|
1079
|
+
this.generatedIdentity = config.generatedIdentity;
|
|
1080
|
+
}
|
|
1081
|
+
static [entityKind] = "Column";
|
|
1082
|
+
name;
|
|
1083
|
+
keyAsName;
|
|
1084
|
+
primary;
|
|
1085
|
+
notNull;
|
|
1086
|
+
default;
|
|
1087
|
+
defaultFn;
|
|
1088
|
+
onUpdateFn;
|
|
1089
|
+
hasDefault;
|
|
1090
|
+
isUnique;
|
|
1091
|
+
uniqueName;
|
|
1092
|
+
uniqueType;
|
|
1093
|
+
dataType;
|
|
1094
|
+
columnType;
|
|
1095
|
+
enumValues = void 0;
|
|
1096
|
+
generated = void 0;
|
|
1097
|
+
generatedIdentity = void 0;
|
|
1098
|
+
config;
|
|
1099
|
+
mapFromDriverValue(value) {
|
|
1100
|
+
return value;
|
|
1101
|
+
}
|
|
1102
|
+
mapToDriverValue(value) {
|
|
1103
|
+
return value;
|
|
1104
|
+
}
|
|
1105
|
+
// ** @internal */
|
|
1106
|
+
shouldDisableInsert() {
|
|
1107
|
+
return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
|
|
1108
|
+
}
|
|
1109
|
+
};
|
|
1110
|
+
|
|
1111
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/column-builder.js
|
|
1112
|
+
var ColumnBuilder = class {
|
|
1113
|
+
static [entityKind] = "ColumnBuilder";
|
|
1114
|
+
config;
|
|
1115
|
+
constructor(name, dataType, columnType) {
|
|
1116
|
+
this.config = {
|
|
1117
|
+
name,
|
|
1118
|
+
keyAsName: name === "",
|
|
1119
|
+
notNull: false,
|
|
1120
|
+
default: void 0,
|
|
1121
|
+
hasDefault: false,
|
|
1122
|
+
primaryKey: false,
|
|
1123
|
+
isUnique: false,
|
|
1124
|
+
uniqueName: void 0,
|
|
1125
|
+
uniqueType: void 0,
|
|
1126
|
+
dataType,
|
|
1127
|
+
columnType,
|
|
1128
|
+
generated: void 0
|
|
1129
|
+
};
|
|
1130
|
+
}
|
|
1131
|
+
/**
|
|
1132
|
+
* Changes the data type of the column. Commonly used with `json` columns. Also, useful for branded types.
|
|
1133
|
+
*
|
|
1134
|
+
* @example
|
|
1135
|
+
* ```ts
|
|
1136
|
+
* const users = pgTable('users', {
|
|
1137
|
+
* id: integer('id').$type<UserId>().primaryKey(),
|
|
1138
|
+
* details: json('details').$type<UserDetails>().notNull(),
|
|
1139
|
+
* });
|
|
1140
|
+
* ```
|
|
1141
|
+
*/
|
|
1142
|
+
$type() {
|
|
1143
|
+
return this;
|
|
1144
|
+
}
|
|
1145
|
+
/**
|
|
1146
|
+
* Adds a `not null` clause to the column definition.
|
|
1147
|
+
*
|
|
1148
|
+
* Affects the `select` model of the table - columns *without* `not null` will be nullable on select.
|
|
1149
|
+
*/
|
|
1150
|
+
notNull() {
|
|
1151
|
+
this.config.notNull = true;
|
|
1152
|
+
return this;
|
|
1153
|
+
}
|
|
1154
|
+
/**
|
|
1155
|
+
* Adds a `default <value>` clause to the column definition.
|
|
1156
|
+
*
|
|
1157
|
+
* Affects the `insert` model of the table - columns *with* `default` are optional on insert.
|
|
1158
|
+
*
|
|
1159
|
+
* If you need to set a dynamic default value, use {@link $defaultFn} instead.
|
|
1160
|
+
*/
|
|
1161
|
+
default(value) {
|
|
1162
|
+
this.config.default = value;
|
|
1163
|
+
this.config.hasDefault = true;
|
|
1164
|
+
return this;
|
|
1165
|
+
}
|
|
1166
|
+
/**
|
|
1167
|
+
* Adds a dynamic default value to the column.
|
|
1168
|
+
* The function will be called when the row is inserted, and the returned value will be used as the column value.
|
|
1169
|
+
*
|
|
1170
|
+
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
|
|
1171
|
+
*/
|
|
1172
|
+
$defaultFn(fn) {
|
|
1173
|
+
this.config.defaultFn = fn;
|
|
1174
|
+
this.config.hasDefault = true;
|
|
1175
|
+
return this;
|
|
1176
|
+
}
|
|
1177
|
+
/**
|
|
1178
|
+
* Alias for {@link $defaultFn}.
|
|
1179
|
+
*/
|
|
1180
|
+
$default = this.$defaultFn;
|
|
1181
|
+
/**
|
|
1182
|
+
* Adds a dynamic update value to the column.
|
|
1183
|
+
* The function will be called when the row is updated, and the returned value will be used as the column value if none is provided.
|
|
1184
|
+
* If no `default` (or `$defaultFn`) value is provided, the function will be called when the row is inserted as well, and the returned value will be used as the column value.
|
|
1185
|
+
*
|
|
1186
|
+
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
|
|
1187
|
+
*/
|
|
1188
|
+
$onUpdateFn(fn) {
|
|
1189
|
+
this.config.onUpdateFn = fn;
|
|
1190
|
+
this.config.hasDefault = true;
|
|
1191
|
+
return this;
|
|
1192
|
+
}
|
|
1193
|
+
/**
|
|
1194
|
+
* Alias for {@link $onUpdateFn}.
|
|
1195
|
+
*/
|
|
1196
|
+
$onUpdate = this.$onUpdateFn;
|
|
1197
|
+
/**
|
|
1198
|
+
* Adds a `primary key` clause to the column definition. This implicitly makes the column `not null`.
|
|
1199
|
+
*
|
|
1200
|
+
* In SQLite, `integer primary key` implicitly makes the column auto-incrementing.
|
|
1201
|
+
*/
|
|
1202
|
+
primaryKey() {
|
|
1203
|
+
this.config.primaryKey = true;
|
|
1204
|
+
this.config.notNull = true;
|
|
1205
|
+
return this;
|
|
1206
|
+
}
|
|
1207
|
+
/** @internal Sets the name of the column to the key within the table definition if a name was not given. */
|
|
1208
|
+
setName(name) {
|
|
1209
|
+
if (this.config.name !== "") return;
|
|
1210
|
+
this.config.name = name;
|
|
1211
|
+
}
|
|
1212
|
+
};
|
|
1213
|
+
|
|
1214
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/table.utils.js
|
|
1215
|
+
var TableName = Symbol.for("drizzle:Name");
|
|
1216
|
+
|
|
1217
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/foreign-keys.js
|
|
1218
|
+
var ForeignKeyBuilder = class {
|
|
1219
|
+
static [entityKind] = "PgForeignKeyBuilder";
|
|
1220
|
+
/** @internal */
|
|
1221
|
+
reference;
|
|
1222
|
+
/** @internal */
|
|
1223
|
+
_onUpdate = "no action";
|
|
1224
|
+
/** @internal */
|
|
1225
|
+
_onDelete = "no action";
|
|
1226
|
+
constructor(config, actions) {
|
|
1227
|
+
this.reference = () => {
|
|
1228
|
+
const { name, columns, foreignColumns } = config();
|
|
1229
|
+
return { name, columns, foreignTable: foreignColumns[0].table, foreignColumns };
|
|
1230
|
+
};
|
|
1231
|
+
if (actions) {
|
|
1232
|
+
this._onUpdate = actions.onUpdate;
|
|
1233
|
+
this._onDelete = actions.onDelete;
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
onUpdate(action) {
|
|
1237
|
+
this._onUpdate = action === void 0 ? "no action" : action;
|
|
1238
|
+
return this;
|
|
1239
|
+
}
|
|
1240
|
+
onDelete(action) {
|
|
1241
|
+
this._onDelete = action === void 0 ? "no action" : action;
|
|
1242
|
+
return this;
|
|
1243
|
+
}
|
|
1244
|
+
/** @internal */
|
|
1245
|
+
build(table) {
|
|
1246
|
+
return new ForeignKey(table, this);
|
|
1247
|
+
}
|
|
1248
|
+
};
|
|
1249
|
+
var ForeignKey = class {
|
|
1250
|
+
constructor(table, builder) {
|
|
1251
|
+
this.table = table;
|
|
1252
|
+
this.reference = builder.reference;
|
|
1253
|
+
this.onUpdate = builder._onUpdate;
|
|
1254
|
+
this.onDelete = builder._onDelete;
|
|
1255
|
+
}
|
|
1256
|
+
static [entityKind] = "PgForeignKey";
|
|
1257
|
+
reference;
|
|
1258
|
+
onUpdate;
|
|
1259
|
+
onDelete;
|
|
1260
|
+
getName() {
|
|
1261
|
+
const { name, columns, foreignColumns } = this.reference();
|
|
1262
|
+
const columnNames = columns.map((column) => column.name);
|
|
1263
|
+
const foreignColumnNames = foreignColumns.map((column) => column.name);
|
|
1264
|
+
const chunks = [
|
|
1265
|
+
this.table[TableName],
|
|
1266
|
+
...columnNames,
|
|
1267
|
+
foreignColumns[0].table[TableName],
|
|
1268
|
+
...foreignColumnNames
|
|
1269
|
+
];
|
|
1270
|
+
return name ?? `${chunks.join("_")}_fk`;
|
|
1271
|
+
}
|
|
1272
|
+
};
|
|
1273
|
+
|
|
1274
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/tracing-utils.js
|
|
1275
|
+
function iife(fn, ...args) {
|
|
1276
|
+
return fn(...args);
|
|
1277
|
+
}
|
|
1278
|
+
|
|
1279
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/unique-constraint.js
|
|
1280
|
+
function uniqueKeyName(table, columns) {
|
|
1281
|
+
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
1282
|
+
}
|
|
1283
|
+
var UniqueConstraintBuilder = class {
|
|
1284
|
+
constructor(columns, name) {
|
|
1285
|
+
this.name = name;
|
|
1286
|
+
this.columns = columns;
|
|
1287
|
+
}
|
|
1288
|
+
static [entityKind] = "PgUniqueConstraintBuilder";
|
|
1289
|
+
/** @internal */
|
|
1290
|
+
columns;
|
|
1291
|
+
/** @internal */
|
|
1292
|
+
nullsNotDistinctConfig = false;
|
|
1293
|
+
nullsNotDistinct() {
|
|
1294
|
+
this.nullsNotDistinctConfig = true;
|
|
1295
|
+
return this;
|
|
1296
|
+
}
|
|
1297
|
+
/** @internal */
|
|
1298
|
+
build(table) {
|
|
1299
|
+
return new UniqueConstraint(table, this.columns, this.nullsNotDistinctConfig, this.name);
|
|
1300
|
+
}
|
|
1301
|
+
};
|
|
1302
|
+
var UniqueOnConstraintBuilder = class {
|
|
1303
|
+
static [entityKind] = "PgUniqueOnConstraintBuilder";
|
|
1304
|
+
/** @internal */
|
|
1305
|
+
name;
|
|
1306
|
+
constructor(name) {
|
|
1307
|
+
this.name = name;
|
|
1308
|
+
}
|
|
1309
|
+
on(...columns) {
|
|
1310
|
+
return new UniqueConstraintBuilder(columns, this.name);
|
|
1311
|
+
}
|
|
1312
|
+
};
|
|
1313
|
+
var UniqueConstraint = class {
|
|
1314
|
+
constructor(table, columns, nullsNotDistinct, name) {
|
|
1315
|
+
this.table = table;
|
|
1316
|
+
this.columns = columns;
|
|
1317
|
+
this.name = name ?? uniqueKeyName(this.table, this.columns.map((column) => column.name));
|
|
1318
|
+
this.nullsNotDistinct = nullsNotDistinct;
|
|
1319
|
+
}
|
|
1320
|
+
static [entityKind] = "PgUniqueConstraint";
|
|
1321
|
+
columns;
|
|
1322
|
+
name;
|
|
1323
|
+
nullsNotDistinct = false;
|
|
1324
|
+
getName() {
|
|
1325
|
+
return this.name;
|
|
1326
|
+
}
|
|
1327
|
+
};
|
|
1328
|
+
|
|
1329
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/utils/array.js
|
|
1330
|
+
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
1331
|
+
for (let i = startFrom; i < arrayString.length; i++) {
|
|
1332
|
+
const char2 = arrayString[i];
|
|
1333
|
+
if (char2 === "\\") {
|
|
1334
|
+
i++;
|
|
1335
|
+
continue;
|
|
1336
|
+
}
|
|
1337
|
+
if (char2 === '"') {
|
|
1338
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
1339
|
+
}
|
|
1340
|
+
if (inQuotes) {
|
|
1341
|
+
continue;
|
|
1342
|
+
}
|
|
1343
|
+
if (char2 === "," || char2 === "}") {
|
|
1344
|
+
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
1345
|
+
}
|
|
1346
|
+
}
|
|
1347
|
+
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
1348
|
+
}
|
|
1349
|
+
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
1350
|
+
const result = [];
|
|
1351
|
+
let i = startFrom;
|
|
1352
|
+
let lastCharIsComma = false;
|
|
1353
|
+
while (i < arrayString.length) {
|
|
1354
|
+
const char2 = arrayString[i];
|
|
1355
|
+
if (char2 === ",") {
|
|
1356
|
+
if (lastCharIsComma || i === startFrom) {
|
|
1357
|
+
result.push("");
|
|
1358
|
+
}
|
|
1359
|
+
lastCharIsComma = true;
|
|
1360
|
+
i++;
|
|
1361
|
+
continue;
|
|
1362
|
+
}
|
|
1363
|
+
lastCharIsComma = false;
|
|
1364
|
+
if (char2 === "\\") {
|
|
1365
|
+
i += 2;
|
|
1366
|
+
continue;
|
|
1367
|
+
}
|
|
1368
|
+
if (char2 === '"') {
|
|
1369
|
+
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
1370
|
+
result.push(value2);
|
|
1371
|
+
i = startFrom2;
|
|
1372
|
+
continue;
|
|
1373
|
+
}
|
|
1374
|
+
if (char2 === "}") {
|
|
1375
|
+
return [result, i + 1];
|
|
1376
|
+
}
|
|
1377
|
+
if (char2 === "{") {
|
|
1378
|
+
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
1379
|
+
result.push(value2);
|
|
1380
|
+
i = startFrom2;
|
|
1381
|
+
continue;
|
|
1382
|
+
}
|
|
1383
|
+
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
1384
|
+
result.push(value);
|
|
1385
|
+
i = newStartFrom;
|
|
1386
|
+
}
|
|
1387
|
+
return [result, i];
|
|
1388
|
+
}
|
|
1389
|
+
function parsePgArray(arrayString) {
|
|
1390
|
+
const [result] = parsePgNestedArray(arrayString, 1);
|
|
1391
|
+
return result;
|
|
1392
|
+
}
|
|
1393
|
+
function makePgArray(array) {
|
|
1394
|
+
return `{${array.map((item) => {
|
|
1395
|
+
if (Array.isArray(item)) {
|
|
1396
|
+
return makePgArray(item);
|
|
1397
|
+
}
|
|
1398
|
+
if (typeof item === "string") {
|
|
1399
|
+
return `"${item.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
1400
|
+
}
|
|
1401
|
+
return `${item}`;
|
|
1402
|
+
}).join(",")}}`;
|
|
1403
|
+
}
|
|
1404
|
+
|
|
1405
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/common.js
|
|
1406
|
+
var PgColumnBuilder = class extends ColumnBuilder {
|
|
1407
|
+
foreignKeyConfigs = [];
|
|
1408
|
+
static [entityKind] = "PgColumnBuilder";
|
|
1409
|
+
array(size) {
|
|
1410
|
+
return new PgArrayBuilder(this.config.name, this, size);
|
|
1411
|
+
}
|
|
1412
|
+
references(ref, actions = {}) {
|
|
1413
|
+
this.foreignKeyConfigs.push({ ref, actions });
|
|
1414
|
+
return this;
|
|
1415
|
+
}
|
|
1416
|
+
unique(name, config) {
|
|
1417
|
+
this.config.isUnique = true;
|
|
1418
|
+
this.config.uniqueName = name;
|
|
1419
|
+
this.config.uniqueType = config?.nulls;
|
|
1420
|
+
return this;
|
|
1421
|
+
}
|
|
1422
|
+
generatedAlwaysAs(as) {
|
|
1423
|
+
this.config.generated = {
|
|
1424
|
+
as,
|
|
1425
|
+
type: "always",
|
|
1426
|
+
mode: "stored"
|
|
1427
|
+
};
|
|
1428
|
+
return this;
|
|
1429
|
+
}
|
|
1430
|
+
/** @internal */
|
|
1431
|
+
buildForeignKeys(column, table) {
|
|
1432
|
+
return this.foreignKeyConfigs.map(({ ref, actions }) => {
|
|
1433
|
+
return iife(
|
|
1434
|
+
(ref2, actions2) => {
|
|
1435
|
+
const builder = new ForeignKeyBuilder(() => {
|
|
1436
|
+
const foreignColumn = ref2();
|
|
1437
|
+
return { columns: [column], foreignColumns: [foreignColumn] };
|
|
1438
|
+
});
|
|
1439
|
+
if (actions2.onUpdate) {
|
|
1440
|
+
builder.onUpdate(actions2.onUpdate);
|
|
1441
|
+
}
|
|
1442
|
+
if (actions2.onDelete) {
|
|
1443
|
+
builder.onDelete(actions2.onDelete);
|
|
1444
|
+
}
|
|
1445
|
+
return builder.build(table);
|
|
1446
|
+
},
|
|
1447
|
+
ref,
|
|
1448
|
+
actions
|
|
1449
|
+
);
|
|
1450
|
+
});
|
|
1451
|
+
}
|
|
1452
|
+
/** @internal */
|
|
1453
|
+
buildExtraConfigColumn(table) {
|
|
1454
|
+
return new ExtraConfigColumn(table, this.config);
|
|
1455
|
+
}
|
|
1456
|
+
};
|
|
1457
|
+
var PgColumn = class extends Column {
|
|
1458
|
+
constructor(table, config) {
|
|
1459
|
+
if (!config.uniqueName) {
|
|
1460
|
+
config.uniqueName = uniqueKeyName(table, [config.name]);
|
|
1461
|
+
}
|
|
1462
|
+
super(table, config);
|
|
1463
|
+
this.table = table;
|
|
1464
|
+
}
|
|
1465
|
+
static [entityKind] = "PgColumn";
|
|
1466
|
+
};
|
|
1467
|
+
var ExtraConfigColumn = class extends PgColumn {
|
|
1468
|
+
static [entityKind] = "ExtraConfigColumn";
|
|
1469
|
+
getSQLType() {
|
|
1470
|
+
return this.getSQLType();
|
|
1471
|
+
}
|
|
1472
|
+
indexConfig = {
|
|
1473
|
+
order: this.config.order ?? "asc",
|
|
1474
|
+
nulls: this.config.nulls ?? "last",
|
|
1475
|
+
opClass: this.config.opClass
|
|
1476
|
+
};
|
|
1477
|
+
defaultConfig = {
|
|
1478
|
+
order: "asc",
|
|
1479
|
+
nulls: "last",
|
|
1480
|
+
opClass: void 0
|
|
1481
|
+
};
|
|
1482
|
+
asc() {
|
|
1483
|
+
this.indexConfig.order = "asc";
|
|
1484
|
+
return this;
|
|
1485
|
+
}
|
|
1486
|
+
desc() {
|
|
1487
|
+
this.indexConfig.order = "desc";
|
|
1488
|
+
return this;
|
|
1489
|
+
}
|
|
1490
|
+
nullsFirst() {
|
|
1491
|
+
this.indexConfig.nulls = "first";
|
|
1492
|
+
return this;
|
|
1493
|
+
}
|
|
1494
|
+
nullsLast() {
|
|
1495
|
+
this.indexConfig.nulls = "last";
|
|
1496
|
+
return this;
|
|
1497
|
+
}
|
|
1498
|
+
/**
|
|
1499
|
+
* ### PostgreSQL documentation quote
|
|
1500
|
+
*
|
|
1501
|
+
* > An operator class with optional parameters can be specified for each column of an index.
|
|
1502
|
+
* The operator class identifies the operators to be used by the index for that column.
|
|
1503
|
+
* For example, a B-tree index on four-byte integers would use the int4_ops class;
|
|
1504
|
+
* this operator class includes comparison functions for four-byte integers.
|
|
1505
|
+
* In practice the default operator class for the column's data type is usually sufficient.
|
|
1506
|
+
* The main point of having operator classes is that for some data types, there could be more than one meaningful ordering.
|
|
1507
|
+
* For example, we might want to sort a complex-number data type either by absolute value or by real part.
|
|
1508
|
+
* We could do this by defining two operator classes for the data type and then selecting the proper class when creating an index.
|
|
1509
|
+
* More information about operator classes check:
|
|
1510
|
+
*
|
|
1511
|
+
* ### Useful links
|
|
1512
|
+
* https://www.postgresql.org/docs/current/sql-createindex.html
|
|
1513
|
+
*
|
|
1514
|
+
* https://www.postgresql.org/docs/current/indexes-opclass.html
|
|
1515
|
+
*
|
|
1516
|
+
* https://www.postgresql.org/docs/current/xindex.html
|
|
1517
|
+
*
|
|
1518
|
+
* ### Additional types
|
|
1519
|
+
* If you have the `pg_vector` extension installed in your database, you can use the
|
|
1520
|
+
* `vector_l2_ops`, `vector_ip_ops`, `vector_cosine_ops`, `vector_l1_ops`, `bit_hamming_ops`, `bit_jaccard_ops`, `halfvec_l2_ops`, `sparsevec_l2_ops` options, which are predefined types.
|
|
1521
|
+
*
|
|
1522
|
+
* **You can always specify any string you want in the operator class, in case Drizzle doesn't have it natively in its types**
|
|
1523
|
+
*
|
|
1524
|
+
* @param opClass
|
|
1525
|
+
* @returns
|
|
1526
|
+
*/
|
|
1527
|
+
op(opClass) {
|
|
1528
|
+
this.indexConfig.opClass = opClass;
|
|
1529
|
+
return this;
|
|
1530
|
+
}
|
|
1531
|
+
};
|
|
1532
|
+
var IndexedColumn = class {
|
|
1533
|
+
static [entityKind] = "IndexedColumn";
|
|
1534
|
+
constructor(name, keyAsName, type, indexConfig) {
|
|
1535
|
+
this.name = name;
|
|
1536
|
+
this.keyAsName = keyAsName;
|
|
1537
|
+
this.type = type;
|
|
1538
|
+
this.indexConfig = indexConfig;
|
|
1539
|
+
}
|
|
1540
|
+
name;
|
|
1541
|
+
keyAsName;
|
|
1542
|
+
type;
|
|
1543
|
+
indexConfig;
|
|
1544
|
+
};
|
|
1545
|
+
var PgArrayBuilder = class extends PgColumnBuilder {
|
|
1546
|
+
static [entityKind] = "PgArrayBuilder";
|
|
1547
|
+
constructor(name, baseBuilder, size) {
|
|
1548
|
+
super(name, "array", "PgArray");
|
|
1549
|
+
this.config.baseBuilder = baseBuilder;
|
|
1550
|
+
this.config.size = size;
|
|
1551
|
+
}
|
|
1552
|
+
/** @internal */
|
|
1553
|
+
build(table) {
|
|
1554
|
+
const baseColumn = this.config.baseBuilder.build(table);
|
|
1555
|
+
return new PgArray(
|
|
1556
|
+
table,
|
|
1557
|
+
this.config,
|
|
1558
|
+
baseColumn
|
|
1559
|
+
);
|
|
1560
|
+
}
|
|
1561
|
+
};
|
|
1562
|
+
var PgArray = class _PgArray extends PgColumn {
|
|
1563
|
+
constructor(table, config, baseColumn, range) {
|
|
1564
|
+
super(table, config);
|
|
1565
|
+
this.baseColumn = baseColumn;
|
|
1566
|
+
this.range = range;
|
|
1567
|
+
this.size = config.size;
|
|
1568
|
+
}
|
|
1569
|
+
size;
|
|
1570
|
+
static [entityKind] = "PgArray";
|
|
1571
|
+
getSQLType() {
|
|
1572
|
+
return `${this.baseColumn.getSQLType()}[${typeof this.size === "number" ? this.size : ""}]`;
|
|
1573
|
+
}
|
|
1574
|
+
mapFromDriverValue(value) {
|
|
1575
|
+
if (typeof value === "string") {
|
|
1576
|
+
value = parsePgArray(value);
|
|
1577
|
+
}
|
|
1578
|
+
return value.map((v) => this.baseColumn.mapFromDriverValue(v));
|
|
1579
|
+
}
|
|
1580
|
+
mapToDriverValue(value, isNestedArray = false) {
|
|
1581
|
+
const a = value.map(
|
|
1582
|
+
(v) => v === null ? null : is(this.baseColumn, _PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v)
|
|
1583
|
+
);
|
|
1584
|
+
if (isNestedArray) return a;
|
|
1585
|
+
return makePgArray(a);
|
|
1586
|
+
}
|
|
1587
|
+
};
|
|
1588
|
+
|
|
1589
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/enum.js
|
|
1590
|
+
var PgEnumObjectColumnBuilder = class extends PgColumnBuilder {
|
|
1591
|
+
static [entityKind] = "PgEnumObjectColumnBuilder";
|
|
1592
|
+
constructor(name, enumInstance) {
|
|
1593
|
+
super(name, "string", "PgEnumObjectColumn");
|
|
1594
|
+
this.config.enum = enumInstance;
|
|
1595
|
+
}
|
|
1596
|
+
/** @internal */
|
|
1597
|
+
build(table) {
|
|
1598
|
+
return new PgEnumObjectColumn(
|
|
1599
|
+
table,
|
|
1600
|
+
this.config
|
|
1601
|
+
);
|
|
1602
|
+
}
|
|
1603
|
+
};
|
|
1604
|
+
var PgEnumObjectColumn = class extends PgColumn {
|
|
1605
|
+
static [entityKind] = "PgEnumObjectColumn";
|
|
1606
|
+
enum;
|
|
1607
|
+
enumValues = this.config.enum.enumValues;
|
|
1608
|
+
constructor(table, config) {
|
|
1609
|
+
super(table, config);
|
|
1610
|
+
this.enum = config.enum;
|
|
1611
|
+
}
|
|
1612
|
+
getSQLType() {
|
|
1613
|
+
return this.enum.enumName;
|
|
1614
|
+
}
|
|
1615
|
+
};
|
|
1616
|
+
var isPgEnumSym = Symbol.for("drizzle:isPgEnum");
|
|
1617
|
+
function isPgEnum(obj) {
|
|
1618
|
+
return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
|
|
1619
|
+
}
|
|
1620
|
+
var PgEnumColumnBuilder = class extends PgColumnBuilder {
|
|
1621
|
+
static [entityKind] = "PgEnumColumnBuilder";
|
|
1622
|
+
constructor(name, enumInstance) {
|
|
1623
|
+
super(name, "string", "PgEnumColumn");
|
|
1624
|
+
this.config.enum = enumInstance;
|
|
1625
|
+
}
|
|
1626
|
+
/** @internal */
|
|
1627
|
+
build(table) {
|
|
1628
|
+
return new PgEnumColumn(
|
|
1629
|
+
table,
|
|
1630
|
+
this.config
|
|
1631
|
+
);
|
|
1632
|
+
}
|
|
1633
|
+
};
|
|
1634
|
+
var PgEnumColumn = class extends PgColumn {
|
|
1635
|
+
static [entityKind] = "PgEnumColumn";
|
|
1636
|
+
enum = this.config.enum;
|
|
1637
|
+
enumValues = this.config.enum.enumValues;
|
|
1638
|
+
constructor(table, config) {
|
|
1639
|
+
super(table, config);
|
|
1640
|
+
this.enum = config.enum;
|
|
1641
|
+
}
|
|
1642
|
+
getSQLType() {
|
|
1643
|
+
return this.enum.enumName;
|
|
1644
|
+
}
|
|
1645
|
+
};
|
|
1646
|
+
function pgEnum(enumName, input) {
|
|
1647
|
+
return Array.isArray(input) ? pgEnumWithSchema(enumName, [...input], void 0) : pgEnumObjectWithSchema(enumName, input, void 0);
|
|
1648
|
+
}
|
|
1649
|
+
function pgEnumWithSchema(enumName, values, schema) {
|
|
1650
|
+
const enumInstance = Object.assign(
|
|
1651
|
+
(name) => new PgEnumColumnBuilder(name ?? "", enumInstance),
|
|
1652
|
+
{
|
|
1653
|
+
enumName,
|
|
1654
|
+
enumValues: values,
|
|
1655
|
+
schema,
|
|
1656
|
+
[isPgEnumSym]: true
|
|
1657
|
+
}
|
|
1658
|
+
);
|
|
1659
|
+
return enumInstance;
|
|
1660
|
+
}
|
|
1661
|
+
function pgEnumObjectWithSchema(enumName, values, schema) {
|
|
1662
|
+
const enumInstance = Object.assign(
|
|
1663
|
+
(name) => new PgEnumObjectColumnBuilder(name ?? "", enumInstance),
|
|
1664
|
+
{
|
|
1665
|
+
enumName,
|
|
1666
|
+
enumValues: Object.values(values),
|
|
1667
|
+
schema,
|
|
1668
|
+
[isPgEnumSym]: true
|
|
1669
|
+
}
|
|
1670
|
+
);
|
|
1671
|
+
return enumInstance;
|
|
1672
|
+
}
|
|
1673
|
+
|
|
1674
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/subquery.js
|
|
1675
|
+
var Subquery = class {
|
|
1676
|
+
static [entityKind] = "Subquery";
|
|
1677
|
+
constructor(sql2, fields, alias, isWith = false, usedTables = []) {
|
|
1678
|
+
this._ = {
|
|
1679
|
+
brand: "Subquery",
|
|
1680
|
+
sql: sql2,
|
|
1681
|
+
selectedFields: fields,
|
|
1682
|
+
alias,
|
|
1683
|
+
isWith,
|
|
1684
|
+
usedTables
|
|
1685
|
+
};
|
|
1686
|
+
}
|
|
1687
|
+
// getSQL(): SQL<unknown> {
|
|
1688
|
+
// return new SQL([this]);
|
|
1689
|
+
// }
|
|
1690
|
+
};
|
|
1691
|
+
var WithSubquery = class extends Subquery {
|
|
1692
|
+
static [entityKind] = "WithSubquery";
|
|
1693
|
+
};
|
|
1694
|
+
|
|
1695
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/version.js
|
|
1696
|
+
var version = "0.45.2";
|
|
1697
|
+
|
|
1698
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/tracing.js
|
|
1699
|
+
var otel;
|
|
1700
|
+
var rawTracer;
|
|
1701
|
+
var tracer = {
|
|
1702
|
+
startActiveSpan(name, fn) {
|
|
1703
|
+
if (!otel) {
|
|
1704
|
+
return fn();
|
|
1705
|
+
}
|
|
1706
|
+
if (!rawTracer) {
|
|
1707
|
+
rawTracer = otel.trace.getTracer("drizzle-orm", version);
|
|
1708
|
+
}
|
|
1709
|
+
return iife(
|
|
1710
|
+
(otel2, rawTracer2) => rawTracer2.startActiveSpan(
|
|
1711
|
+
name,
|
|
1712
|
+
(span) => {
|
|
1713
|
+
try {
|
|
1714
|
+
return fn(span);
|
|
1715
|
+
} catch (e) {
|
|
1716
|
+
span.setStatus({
|
|
1717
|
+
code: otel2.SpanStatusCode.ERROR,
|
|
1718
|
+
message: e instanceof Error ? e.message : "Unknown error"
|
|
1719
|
+
// eslint-disable-line no-instanceof/no-instanceof
|
|
1720
|
+
});
|
|
1721
|
+
throw e;
|
|
1722
|
+
} finally {
|
|
1723
|
+
span.end();
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
),
|
|
1727
|
+
otel,
|
|
1728
|
+
rawTracer
|
|
1729
|
+
);
|
|
1730
|
+
}
|
|
1731
|
+
};
|
|
1732
|
+
|
|
1733
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/view-common.js
|
|
1734
|
+
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
1735
|
+
|
|
1736
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/table.js
|
|
1737
|
+
var Schema = Symbol.for("drizzle:Schema");
|
|
1738
|
+
var Columns = Symbol.for("drizzle:Columns");
|
|
1739
|
+
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
1740
|
+
var OriginalName = Symbol.for("drizzle:OriginalName");
|
|
1741
|
+
var BaseName = Symbol.for("drizzle:BaseName");
|
|
1742
|
+
var IsAlias = Symbol.for("drizzle:IsAlias");
|
|
1743
|
+
var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
|
|
1744
|
+
var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
|
|
1745
|
+
var Table = class {
|
|
1746
|
+
static [entityKind] = "Table";
|
|
1747
|
+
/** @internal */
|
|
1748
|
+
static Symbol = {
|
|
1749
|
+
Name: TableName,
|
|
1750
|
+
Schema,
|
|
1751
|
+
OriginalName,
|
|
1752
|
+
Columns,
|
|
1753
|
+
ExtraConfigColumns,
|
|
1754
|
+
BaseName,
|
|
1755
|
+
IsAlias,
|
|
1756
|
+
ExtraConfigBuilder
|
|
1757
|
+
};
|
|
1758
|
+
/**
|
|
1759
|
+
* @internal
|
|
1760
|
+
* Can be changed if the table is aliased.
|
|
1761
|
+
*/
|
|
1762
|
+
[TableName];
|
|
1763
|
+
/**
|
|
1764
|
+
* @internal
|
|
1765
|
+
* Used to store the original name of the table, before any aliasing.
|
|
1766
|
+
*/
|
|
1767
|
+
[OriginalName];
|
|
1768
|
+
/** @internal */
|
|
1769
|
+
[Schema];
|
|
1770
|
+
/** @internal */
|
|
1771
|
+
[Columns];
|
|
1772
|
+
/** @internal */
|
|
1773
|
+
[ExtraConfigColumns];
|
|
1774
|
+
/**
|
|
1775
|
+
* @internal
|
|
1776
|
+
* Used to store the table name before the transformation via the `tableCreator` functions.
|
|
1777
|
+
*/
|
|
1778
|
+
[BaseName];
|
|
1779
|
+
/** @internal */
|
|
1780
|
+
[IsAlias] = false;
|
|
1781
|
+
/** @internal */
|
|
1782
|
+
[IsDrizzleTable] = true;
|
|
1783
|
+
/** @internal */
|
|
1784
|
+
[ExtraConfigBuilder] = void 0;
|
|
1785
|
+
constructor(name, schema, baseName) {
|
|
1786
|
+
this[TableName] = this[OriginalName] = name;
|
|
1787
|
+
this[Schema] = schema;
|
|
1788
|
+
this[BaseName] = baseName;
|
|
1789
|
+
}
|
|
1790
|
+
};
|
|
1791
|
+
|
|
1792
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/sql/sql.js
|
|
1793
|
+
var FakePrimitiveParam = class {
|
|
1794
|
+
static [entityKind] = "FakePrimitiveParam";
|
|
1795
|
+
};
|
|
1796
|
+
function isSQLWrapper(value) {
|
|
1797
|
+
return value !== null && value !== void 0 && typeof value.getSQL === "function";
|
|
1798
|
+
}
|
|
1799
|
+
function mergeQueries(queries) {
|
|
1800
|
+
const result = { sql: "", params: [] };
|
|
1801
|
+
for (const query of queries) {
|
|
1802
|
+
result.sql += query.sql;
|
|
1803
|
+
result.params.push(...query.params);
|
|
1804
|
+
if (query.typings?.length) {
|
|
1805
|
+
if (!result.typings) {
|
|
1806
|
+
result.typings = [];
|
|
1807
|
+
}
|
|
1808
|
+
result.typings.push(...query.typings);
|
|
1809
|
+
}
|
|
1810
|
+
}
|
|
1811
|
+
return result;
|
|
1812
|
+
}
|
|
1813
|
+
var StringChunk = class {
|
|
1814
|
+
static [entityKind] = "StringChunk";
|
|
1815
|
+
value;
|
|
1816
|
+
constructor(value) {
|
|
1817
|
+
this.value = Array.isArray(value) ? value : [value];
|
|
1818
|
+
}
|
|
1819
|
+
getSQL() {
|
|
1820
|
+
return new SQL([this]);
|
|
1821
|
+
}
|
|
1822
|
+
};
|
|
1823
|
+
var SQL = class _SQL {
|
|
1824
|
+
constructor(queryChunks) {
|
|
1825
|
+
this.queryChunks = queryChunks;
|
|
1826
|
+
for (const chunk of queryChunks) {
|
|
1827
|
+
if (is(chunk, Table)) {
|
|
1828
|
+
const schemaName = chunk[Table.Symbol.Schema];
|
|
1829
|
+
this.usedTables.push(
|
|
1830
|
+
schemaName === void 0 ? chunk[Table.Symbol.Name] : schemaName + "." + chunk[Table.Symbol.Name]
|
|
1831
|
+
);
|
|
1832
|
+
}
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
static [entityKind] = "SQL";
|
|
1836
|
+
/** @internal */
|
|
1837
|
+
decoder = noopDecoder;
|
|
1838
|
+
shouldInlineParams = false;
|
|
1839
|
+
/** @internal */
|
|
1840
|
+
usedTables = [];
|
|
1841
|
+
append(query) {
|
|
1842
|
+
this.queryChunks.push(...query.queryChunks);
|
|
1843
|
+
return this;
|
|
1844
|
+
}
|
|
1845
|
+
toQuery(config) {
|
|
1846
|
+
return tracer.startActiveSpan("drizzle.buildSQL", (span) => {
|
|
1847
|
+
const query = this.buildQueryFromSourceParams(this.queryChunks, config);
|
|
1848
|
+
span?.setAttributes({
|
|
1849
|
+
"drizzle.query.text": query.sql,
|
|
1850
|
+
"drizzle.query.params": JSON.stringify(query.params)
|
|
1851
|
+
});
|
|
1852
|
+
return query;
|
|
1853
|
+
});
|
|
1854
|
+
}
|
|
1855
|
+
buildQueryFromSourceParams(chunks, _config) {
|
|
1856
|
+
const config = Object.assign({}, _config, {
|
|
1857
|
+
inlineParams: _config.inlineParams || this.shouldInlineParams,
|
|
1858
|
+
paramStartIndex: _config.paramStartIndex || { value: 0 }
|
|
1859
|
+
});
|
|
1860
|
+
const {
|
|
1861
|
+
casing,
|
|
1862
|
+
escapeName,
|
|
1863
|
+
escapeParam,
|
|
1864
|
+
prepareTyping,
|
|
1865
|
+
inlineParams,
|
|
1866
|
+
paramStartIndex
|
|
1867
|
+
} = config;
|
|
1868
|
+
return mergeQueries(chunks.map((chunk) => {
|
|
1869
|
+
if (is(chunk, StringChunk)) {
|
|
1870
|
+
return { sql: chunk.value.join(""), params: [] };
|
|
1871
|
+
}
|
|
1872
|
+
if (is(chunk, Name)) {
|
|
1873
|
+
return { sql: escapeName(chunk.value), params: [] };
|
|
1874
|
+
}
|
|
1875
|
+
if (chunk === void 0) {
|
|
1876
|
+
return { sql: "", params: [] };
|
|
1877
|
+
}
|
|
1878
|
+
if (Array.isArray(chunk)) {
|
|
1879
|
+
const result = [new StringChunk("(")];
|
|
1880
|
+
for (const [i, p] of chunk.entries()) {
|
|
1881
|
+
result.push(p);
|
|
1882
|
+
if (i < chunk.length - 1) {
|
|
1883
|
+
result.push(new StringChunk(", "));
|
|
1884
|
+
}
|
|
1885
|
+
}
|
|
1886
|
+
result.push(new StringChunk(")"));
|
|
1887
|
+
return this.buildQueryFromSourceParams(result, config);
|
|
1888
|
+
}
|
|
1889
|
+
if (is(chunk, _SQL)) {
|
|
1890
|
+
return this.buildQueryFromSourceParams(chunk.queryChunks, {
|
|
1891
|
+
...config,
|
|
1892
|
+
inlineParams: inlineParams || chunk.shouldInlineParams
|
|
1893
|
+
});
|
|
1894
|
+
}
|
|
1895
|
+
if (is(chunk, Table)) {
|
|
1896
|
+
const schemaName = chunk[Table.Symbol.Schema];
|
|
1897
|
+
const tableName = chunk[Table.Symbol.Name];
|
|
1898
|
+
return {
|
|
1899
|
+
sql: schemaName === void 0 || chunk[IsAlias] ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
|
1900
|
+
params: []
|
|
1901
|
+
};
|
|
1902
|
+
}
|
|
1903
|
+
if (is(chunk, Column)) {
|
|
1904
|
+
const columnName = casing.getColumnCasing(chunk);
|
|
1905
|
+
if (_config.invokeSource === "indexes") {
|
|
1906
|
+
return { sql: escapeName(columnName), params: [] };
|
|
1907
|
+
}
|
|
1908
|
+
const schemaName = chunk.table[Table.Symbol.Schema];
|
|
1909
|
+
return {
|
|
1910
|
+
sql: chunk.table[IsAlias] || schemaName === void 0 ? escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName) : escapeName(schemaName) + "." + escapeName(chunk.table[Table.Symbol.Name]) + "." + escapeName(columnName),
|
|
1911
|
+
params: []
|
|
1912
|
+
};
|
|
1913
|
+
}
|
|
1914
|
+
if (is(chunk, View)) {
|
|
1915
|
+
const schemaName = chunk[ViewBaseConfig].schema;
|
|
1916
|
+
const viewName = chunk[ViewBaseConfig].name;
|
|
1917
|
+
return {
|
|
1918
|
+
sql: schemaName === void 0 || chunk[ViewBaseConfig].isAlias ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
|
|
1919
|
+
params: []
|
|
1920
|
+
};
|
|
1921
|
+
}
|
|
1922
|
+
if (is(chunk, Param)) {
|
|
1923
|
+
if (is(chunk.value, Placeholder)) {
|
|
1924
|
+
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
1925
|
+
}
|
|
1926
|
+
const mappedValue = chunk.value === null ? null : chunk.encoder.mapToDriverValue(chunk.value);
|
|
1927
|
+
if (is(mappedValue, _SQL)) {
|
|
1928
|
+
return this.buildQueryFromSourceParams([mappedValue], config);
|
|
1929
|
+
}
|
|
1930
|
+
if (inlineParams) {
|
|
1931
|
+
return { sql: this.mapInlineParam(mappedValue, config), params: [] };
|
|
1932
|
+
}
|
|
1933
|
+
let typings = ["none"];
|
|
1934
|
+
if (prepareTyping) {
|
|
1935
|
+
typings = [prepareTyping(chunk.encoder)];
|
|
1936
|
+
}
|
|
1937
|
+
return { sql: escapeParam(paramStartIndex.value++, mappedValue), params: [mappedValue], typings };
|
|
1938
|
+
}
|
|
1939
|
+
if (is(chunk, Placeholder)) {
|
|
1940
|
+
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
1941
|
+
}
|
|
1942
|
+
if (is(chunk, _SQL.Aliased) && chunk.fieldAlias !== void 0) {
|
|
1943
|
+
return { sql: escapeName(chunk.fieldAlias), params: [] };
|
|
1944
|
+
}
|
|
1945
|
+
if (is(chunk, Subquery)) {
|
|
1946
|
+
if (chunk._.isWith) {
|
|
1947
|
+
return { sql: escapeName(chunk._.alias), params: [] };
|
|
1948
|
+
}
|
|
1949
|
+
return this.buildQueryFromSourceParams([
|
|
1950
|
+
new StringChunk("("),
|
|
1951
|
+
chunk._.sql,
|
|
1952
|
+
new StringChunk(") "),
|
|
1953
|
+
new Name(chunk._.alias)
|
|
1954
|
+
], config);
|
|
1955
|
+
}
|
|
1956
|
+
if (isPgEnum(chunk)) {
|
|
1957
|
+
if (chunk.schema) {
|
|
1958
|
+
return { sql: escapeName(chunk.schema) + "." + escapeName(chunk.enumName), params: [] };
|
|
1959
|
+
}
|
|
1960
|
+
return { sql: escapeName(chunk.enumName), params: [] };
|
|
1961
|
+
}
|
|
1962
|
+
if (isSQLWrapper(chunk)) {
|
|
1963
|
+
if (chunk.shouldOmitSQLParens?.()) {
|
|
1964
|
+
return this.buildQueryFromSourceParams([chunk.getSQL()], config);
|
|
1965
|
+
}
|
|
1966
|
+
return this.buildQueryFromSourceParams([
|
|
1967
|
+
new StringChunk("("),
|
|
1968
|
+
chunk.getSQL(),
|
|
1969
|
+
new StringChunk(")")
|
|
1970
|
+
], config);
|
|
1971
|
+
}
|
|
1972
|
+
if (inlineParams) {
|
|
1973
|
+
return { sql: this.mapInlineParam(chunk, config), params: [] };
|
|
1974
|
+
}
|
|
1975
|
+
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
1976
|
+
}));
|
|
1977
|
+
}
|
|
1978
|
+
mapInlineParam(chunk, { escapeString }) {
|
|
1979
|
+
if (chunk === null) {
|
|
1980
|
+
return "null";
|
|
1981
|
+
}
|
|
1982
|
+
if (typeof chunk === "number" || typeof chunk === "boolean") {
|
|
1983
|
+
return chunk.toString();
|
|
1984
|
+
}
|
|
1985
|
+
if (typeof chunk === "string") {
|
|
1986
|
+
return escapeString(chunk);
|
|
1987
|
+
}
|
|
1988
|
+
if (typeof chunk === "object") {
|
|
1989
|
+
const mappedValueAsString = chunk.toString();
|
|
1990
|
+
if (mappedValueAsString === "[object Object]") {
|
|
1991
|
+
return escapeString(JSON.stringify(chunk));
|
|
1992
|
+
}
|
|
1993
|
+
return escapeString(mappedValueAsString);
|
|
1994
|
+
}
|
|
1995
|
+
throw new Error("Unexpected param value: " + chunk);
|
|
1996
|
+
}
|
|
1997
|
+
getSQL() {
|
|
1998
|
+
return this;
|
|
1999
|
+
}
|
|
2000
|
+
as(alias) {
|
|
2001
|
+
if (alias === void 0) {
|
|
2002
|
+
return this;
|
|
2003
|
+
}
|
|
2004
|
+
return new _SQL.Aliased(this, alias);
|
|
2005
|
+
}
|
|
2006
|
+
mapWith(decoder) {
|
|
2007
|
+
this.decoder = typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder;
|
|
2008
|
+
return this;
|
|
2009
|
+
}
|
|
2010
|
+
inlineParams() {
|
|
2011
|
+
this.shouldInlineParams = true;
|
|
2012
|
+
return this;
|
|
2013
|
+
}
|
|
2014
|
+
/**
|
|
2015
|
+
* This method is used to conditionally include a part of the query.
|
|
2016
|
+
*
|
|
2017
|
+
* @param condition - Condition to check
|
|
2018
|
+
* @returns itself if the condition is `true`, otherwise `undefined`
|
|
2019
|
+
*/
|
|
2020
|
+
if(condition) {
|
|
2021
|
+
return condition ? this : void 0;
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2024
|
+
var Name = class {
|
|
2025
|
+
constructor(value) {
|
|
2026
|
+
this.value = value;
|
|
2027
|
+
}
|
|
2028
|
+
static [entityKind] = "Name";
|
|
2029
|
+
brand;
|
|
2030
|
+
getSQL() {
|
|
2031
|
+
return new SQL([this]);
|
|
2032
|
+
}
|
|
2033
|
+
};
|
|
2034
|
+
var noopDecoder = {
|
|
2035
|
+
mapFromDriverValue: (value) => value
|
|
2036
|
+
};
|
|
2037
|
+
var noopEncoder = {
|
|
2038
|
+
mapToDriverValue: (value) => value
|
|
2039
|
+
};
|
|
2040
|
+
var noopMapper = {
|
|
2041
|
+
...noopDecoder,
|
|
2042
|
+
...noopEncoder
|
|
2043
|
+
};
|
|
2044
|
+
var Param = class {
|
|
2045
|
+
/**
|
|
2046
|
+
* @param value - Parameter value
|
|
2047
|
+
* @param encoder - Encoder to convert the value to a driver parameter
|
|
2048
|
+
*/
|
|
2049
|
+
constructor(value, encoder = noopEncoder) {
|
|
2050
|
+
this.value = value;
|
|
2051
|
+
this.encoder = encoder;
|
|
2052
|
+
}
|
|
2053
|
+
static [entityKind] = "Param";
|
|
2054
|
+
brand;
|
|
2055
|
+
getSQL() {
|
|
2056
|
+
return new SQL([this]);
|
|
2057
|
+
}
|
|
2058
|
+
};
|
|
2059
|
+
function sql(strings, ...params) {
|
|
2060
|
+
const queryChunks = [];
|
|
2061
|
+
if (params.length > 0 || strings.length > 0 && strings[0] !== "") {
|
|
2062
|
+
queryChunks.push(new StringChunk(strings[0]));
|
|
2063
|
+
}
|
|
2064
|
+
for (const [paramIndex, param2] of params.entries()) {
|
|
2065
|
+
queryChunks.push(param2, new StringChunk(strings[paramIndex + 1]));
|
|
2066
|
+
}
|
|
2067
|
+
return new SQL(queryChunks);
|
|
2068
|
+
}
|
|
2069
|
+
((sql2) => {
|
|
2070
|
+
function empty() {
|
|
2071
|
+
return new SQL([]);
|
|
2072
|
+
}
|
|
2073
|
+
sql2.empty = empty;
|
|
2074
|
+
function fromList(list) {
|
|
2075
|
+
return new SQL(list);
|
|
2076
|
+
}
|
|
2077
|
+
sql2.fromList = fromList;
|
|
2078
|
+
function raw(str) {
|
|
2079
|
+
return new SQL([new StringChunk(str)]);
|
|
2080
|
+
}
|
|
2081
|
+
sql2.raw = raw;
|
|
2082
|
+
function join(chunks, separator) {
|
|
2083
|
+
const result = [];
|
|
2084
|
+
for (const [i, chunk] of chunks.entries()) {
|
|
2085
|
+
if (i > 0 && separator !== void 0) {
|
|
2086
|
+
result.push(separator);
|
|
2087
|
+
}
|
|
2088
|
+
result.push(chunk);
|
|
2089
|
+
}
|
|
2090
|
+
return new SQL(result);
|
|
2091
|
+
}
|
|
2092
|
+
sql2.join = join;
|
|
2093
|
+
function identifier(value) {
|
|
2094
|
+
return new Name(value);
|
|
2095
|
+
}
|
|
2096
|
+
sql2.identifier = identifier;
|
|
2097
|
+
function placeholder2(name2) {
|
|
2098
|
+
return new Placeholder(name2);
|
|
2099
|
+
}
|
|
2100
|
+
sql2.placeholder = placeholder2;
|
|
2101
|
+
function param2(value, encoder) {
|
|
2102
|
+
return new Param(value, encoder);
|
|
2103
|
+
}
|
|
2104
|
+
sql2.param = param2;
|
|
2105
|
+
})(sql || (sql = {}));
|
|
2106
|
+
((SQL2) => {
|
|
2107
|
+
class Aliased {
|
|
2108
|
+
constructor(sql2, fieldAlias) {
|
|
2109
|
+
this.sql = sql2;
|
|
2110
|
+
this.fieldAlias = fieldAlias;
|
|
2111
|
+
}
|
|
2112
|
+
static [entityKind] = "SQL.Aliased";
|
|
2113
|
+
/** @internal */
|
|
2114
|
+
isSelectionField = false;
|
|
2115
|
+
getSQL() {
|
|
2116
|
+
return this.sql;
|
|
2117
|
+
}
|
|
2118
|
+
/** @internal */
|
|
2119
|
+
clone() {
|
|
2120
|
+
return new Aliased(this.sql, this.fieldAlias);
|
|
2121
|
+
}
|
|
2122
|
+
}
|
|
2123
|
+
SQL2.Aliased = Aliased;
|
|
2124
|
+
})(SQL || (SQL = {}));
|
|
2125
|
+
var Placeholder = class {
|
|
2126
|
+
constructor(name2) {
|
|
2127
|
+
this.name = name2;
|
|
2128
|
+
}
|
|
2129
|
+
static [entityKind] = "Placeholder";
|
|
2130
|
+
getSQL() {
|
|
2131
|
+
return new SQL([this]);
|
|
2132
|
+
}
|
|
2133
|
+
};
|
|
2134
|
+
var IsDrizzleView = Symbol.for("drizzle:IsDrizzleView");
|
|
2135
|
+
var View = class {
|
|
2136
|
+
static [entityKind] = "View";
|
|
2137
|
+
/** @internal */
|
|
2138
|
+
[ViewBaseConfig];
|
|
2139
|
+
/** @internal */
|
|
2140
|
+
[IsDrizzleView] = true;
|
|
2141
|
+
constructor({ name: name2, schema, selectedFields, query }) {
|
|
2142
|
+
this[ViewBaseConfig] = {
|
|
2143
|
+
name: name2,
|
|
2144
|
+
originalName: name2,
|
|
2145
|
+
schema,
|
|
2146
|
+
selectedFields,
|
|
2147
|
+
query,
|
|
2148
|
+
isExisting: !query,
|
|
2149
|
+
isAlias: false
|
|
2150
|
+
};
|
|
2151
|
+
}
|
|
2152
|
+
getSQL() {
|
|
2153
|
+
return new SQL([this]);
|
|
2154
|
+
}
|
|
2155
|
+
};
|
|
2156
|
+
Column.prototype.getSQL = function() {
|
|
2157
|
+
return new SQL([this]);
|
|
2158
|
+
};
|
|
2159
|
+
Table.prototype.getSQL = function() {
|
|
2160
|
+
return new SQL([this]);
|
|
2161
|
+
};
|
|
2162
|
+
Subquery.prototype.getSQL = function() {
|
|
2163
|
+
return new SQL([this]);
|
|
2164
|
+
};
|
|
2165
|
+
|
|
2166
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/utils.js
|
|
2167
|
+
function getColumnNameAndConfig(a, b) {
|
|
2168
|
+
return {
|
|
2169
|
+
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
2170
|
+
config: typeof a === "object" ? a : b
|
|
2171
|
+
};
|
|
2172
|
+
}
|
|
2173
|
+
var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder();
|
|
2174
|
+
|
|
2175
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/int.common.js
|
|
2176
|
+
var PgIntColumnBaseBuilder = class extends PgColumnBuilder {
|
|
2177
|
+
static [entityKind] = "PgIntColumnBaseBuilder";
|
|
2178
|
+
generatedAlwaysAsIdentity(sequence) {
|
|
2179
|
+
if (sequence) {
|
|
2180
|
+
const { name, ...options } = sequence;
|
|
2181
|
+
this.config.generatedIdentity = {
|
|
2182
|
+
type: "always",
|
|
2183
|
+
sequenceName: name,
|
|
2184
|
+
sequenceOptions: options
|
|
2185
|
+
};
|
|
2186
|
+
} else {
|
|
2187
|
+
this.config.generatedIdentity = {
|
|
2188
|
+
type: "always"
|
|
2189
|
+
};
|
|
2190
|
+
}
|
|
2191
|
+
this.config.hasDefault = true;
|
|
2192
|
+
this.config.notNull = true;
|
|
2193
|
+
return this;
|
|
2194
|
+
}
|
|
2195
|
+
generatedByDefaultAsIdentity(sequence) {
|
|
2196
|
+
if (sequence) {
|
|
2197
|
+
const { name, ...options } = sequence;
|
|
2198
|
+
this.config.generatedIdentity = {
|
|
2199
|
+
type: "byDefault",
|
|
2200
|
+
sequenceName: name,
|
|
2201
|
+
sequenceOptions: options
|
|
2202
|
+
};
|
|
2203
|
+
} else {
|
|
2204
|
+
this.config.generatedIdentity = {
|
|
2205
|
+
type: "byDefault"
|
|
2206
|
+
};
|
|
2207
|
+
}
|
|
2208
|
+
this.config.hasDefault = true;
|
|
2209
|
+
this.config.notNull = true;
|
|
2210
|
+
return this;
|
|
2211
|
+
}
|
|
2212
|
+
};
|
|
2213
|
+
|
|
2214
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/bigint.js
|
|
2215
|
+
var PgBigInt53Builder = class extends PgIntColumnBaseBuilder {
|
|
2216
|
+
static [entityKind] = "PgBigInt53Builder";
|
|
2217
|
+
constructor(name) {
|
|
2218
|
+
super(name, "number", "PgBigInt53");
|
|
2219
|
+
}
|
|
2220
|
+
/** @internal */
|
|
2221
|
+
build(table) {
|
|
2222
|
+
return new PgBigInt53(table, this.config);
|
|
2223
|
+
}
|
|
2224
|
+
};
|
|
2225
|
+
var PgBigInt53 = class extends PgColumn {
|
|
2226
|
+
static [entityKind] = "PgBigInt53";
|
|
2227
|
+
getSQLType() {
|
|
2228
|
+
return "bigint";
|
|
2229
|
+
}
|
|
2230
|
+
mapFromDriverValue(value) {
|
|
2231
|
+
if (typeof value === "number") {
|
|
2232
|
+
return value;
|
|
2233
|
+
}
|
|
2234
|
+
return Number(value);
|
|
2235
|
+
}
|
|
2236
|
+
};
|
|
2237
|
+
var PgBigInt64Builder = class extends PgIntColumnBaseBuilder {
|
|
2238
|
+
static [entityKind] = "PgBigInt64Builder";
|
|
2239
|
+
constructor(name) {
|
|
2240
|
+
super(name, "bigint", "PgBigInt64");
|
|
2241
|
+
}
|
|
2242
|
+
/** @internal */
|
|
2243
|
+
build(table) {
|
|
2244
|
+
return new PgBigInt64(
|
|
2245
|
+
table,
|
|
2246
|
+
this.config
|
|
2247
|
+
);
|
|
2248
|
+
}
|
|
2249
|
+
};
|
|
2250
|
+
var PgBigInt64 = class extends PgColumn {
|
|
2251
|
+
static [entityKind] = "PgBigInt64";
|
|
2252
|
+
getSQLType() {
|
|
2253
|
+
return "bigint";
|
|
2254
|
+
}
|
|
2255
|
+
// eslint-disable-next-line unicorn/prefer-native-coercion-functions
|
|
2256
|
+
mapFromDriverValue(value) {
|
|
2257
|
+
return BigInt(value);
|
|
2258
|
+
}
|
|
2259
|
+
};
|
|
2260
|
+
function bigint(a, b) {
|
|
2261
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2262
|
+
if (config.mode === "number") {
|
|
2263
|
+
return new PgBigInt53Builder(name);
|
|
2264
|
+
}
|
|
2265
|
+
return new PgBigInt64Builder(name);
|
|
2266
|
+
}
|
|
2267
|
+
|
|
2268
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/bigserial.js
|
|
2269
|
+
var PgBigSerial53Builder = class extends PgColumnBuilder {
|
|
2270
|
+
static [entityKind] = "PgBigSerial53Builder";
|
|
2271
|
+
constructor(name) {
|
|
2272
|
+
super(name, "number", "PgBigSerial53");
|
|
2273
|
+
this.config.hasDefault = true;
|
|
2274
|
+
this.config.notNull = true;
|
|
2275
|
+
}
|
|
2276
|
+
/** @internal */
|
|
2277
|
+
build(table) {
|
|
2278
|
+
return new PgBigSerial53(
|
|
2279
|
+
table,
|
|
2280
|
+
this.config
|
|
2281
|
+
);
|
|
2282
|
+
}
|
|
2283
|
+
};
|
|
2284
|
+
var PgBigSerial53 = class extends PgColumn {
|
|
2285
|
+
static [entityKind] = "PgBigSerial53";
|
|
2286
|
+
getSQLType() {
|
|
2287
|
+
return "bigserial";
|
|
2288
|
+
}
|
|
2289
|
+
mapFromDriverValue(value) {
|
|
2290
|
+
if (typeof value === "number") {
|
|
2291
|
+
return value;
|
|
2292
|
+
}
|
|
2293
|
+
return Number(value);
|
|
2294
|
+
}
|
|
2295
|
+
};
|
|
2296
|
+
var PgBigSerial64Builder = class extends PgColumnBuilder {
|
|
2297
|
+
static [entityKind] = "PgBigSerial64Builder";
|
|
2298
|
+
constructor(name) {
|
|
2299
|
+
super(name, "bigint", "PgBigSerial64");
|
|
2300
|
+
this.config.hasDefault = true;
|
|
2301
|
+
}
|
|
2302
|
+
/** @internal */
|
|
2303
|
+
build(table) {
|
|
2304
|
+
return new PgBigSerial64(
|
|
2305
|
+
table,
|
|
2306
|
+
this.config
|
|
2307
|
+
);
|
|
2308
|
+
}
|
|
2309
|
+
};
|
|
2310
|
+
var PgBigSerial64 = class extends PgColumn {
|
|
2311
|
+
static [entityKind] = "PgBigSerial64";
|
|
2312
|
+
getSQLType() {
|
|
2313
|
+
return "bigserial";
|
|
2314
|
+
}
|
|
2315
|
+
// eslint-disable-next-line unicorn/prefer-native-coercion-functions
|
|
2316
|
+
mapFromDriverValue(value) {
|
|
2317
|
+
return BigInt(value);
|
|
2318
|
+
}
|
|
2319
|
+
};
|
|
2320
|
+
function bigserial(a, b) {
|
|
2321
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2322
|
+
if (config.mode === "number") {
|
|
2323
|
+
return new PgBigSerial53Builder(name);
|
|
2324
|
+
}
|
|
2325
|
+
return new PgBigSerial64Builder(name);
|
|
2326
|
+
}
|
|
2327
|
+
|
|
2328
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/boolean.js
|
|
2329
|
+
var PgBooleanBuilder = class extends PgColumnBuilder {
|
|
2330
|
+
static [entityKind] = "PgBooleanBuilder";
|
|
2331
|
+
constructor(name) {
|
|
2332
|
+
super(name, "boolean", "PgBoolean");
|
|
2333
|
+
}
|
|
2334
|
+
/** @internal */
|
|
2335
|
+
build(table) {
|
|
2336
|
+
return new PgBoolean(table, this.config);
|
|
2337
|
+
}
|
|
2338
|
+
};
|
|
2339
|
+
var PgBoolean = class extends PgColumn {
|
|
2340
|
+
static [entityKind] = "PgBoolean";
|
|
2341
|
+
getSQLType() {
|
|
2342
|
+
return "boolean";
|
|
2343
|
+
}
|
|
2344
|
+
};
|
|
2345
|
+
function boolean(name) {
|
|
2346
|
+
return new PgBooleanBuilder(name ?? "");
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/char.js
|
|
2350
|
+
var PgCharBuilder = class extends PgColumnBuilder {
|
|
2351
|
+
static [entityKind] = "PgCharBuilder";
|
|
2352
|
+
constructor(name, config) {
|
|
2353
|
+
super(name, "string", "PgChar");
|
|
2354
|
+
this.config.length = config.length;
|
|
2355
|
+
this.config.enumValues = config.enum;
|
|
2356
|
+
}
|
|
2357
|
+
/** @internal */
|
|
2358
|
+
build(table) {
|
|
2359
|
+
return new PgChar(
|
|
2360
|
+
table,
|
|
2361
|
+
this.config
|
|
2362
|
+
);
|
|
2363
|
+
}
|
|
2364
|
+
};
|
|
2365
|
+
var PgChar = class extends PgColumn {
|
|
2366
|
+
static [entityKind] = "PgChar";
|
|
2367
|
+
length = this.config.length;
|
|
2368
|
+
enumValues = this.config.enumValues;
|
|
2369
|
+
getSQLType() {
|
|
2370
|
+
return this.length === void 0 ? `char` : `char(${this.length})`;
|
|
2371
|
+
}
|
|
2372
|
+
};
|
|
2373
|
+
function char(a, b = {}) {
|
|
2374
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2375
|
+
return new PgCharBuilder(name, config);
|
|
2376
|
+
}
|
|
2377
|
+
|
|
2378
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/cidr.js
|
|
2379
|
+
var PgCidrBuilder = class extends PgColumnBuilder {
|
|
2380
|
+
static [entityKind] = "PgCidrBuilder";
|
|
2381
|
+
constructor(name) {
|
|
2382
|
+
super(name, "string", "PgCidr");
|
|
2383
|
+
}
|
|
2384
|
+
/** @internal */
|
|
2385
|
+
build(table) {
|
|
2386
|
+
return new PgCidr(table, this.config);
|
|
2387
|
+
}
|
|
2388
|
+
};
|
|
2389
|
+
var PgCidr = class extends PgColumn {
|
|
2390
|
+
static [entityKind] = "PgCidr";
|
|
2391
|
+
getSQLType() {
|
|
2392
|
+
return "cidr";
|
|
2393
|
+
}
|
|
2394
|
+
};
|
|
2395
|
+
function cidr(name) {
|
|
2396
|
+
return new PgCidrBuilder(name ?? "");
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/custom.js
|
|
2400
|
+
var PgCustomColumnBuilder = class extends PgColumnBuilder {
|
|
2401
|
+
static [entityKind] = "PgCustomColumnBuilder";
|
|
2402
|
+
constructor(name, fieldConfig, customTypeParams) {
|
|
2403
|
+
super(name, "custom", "PgCustomColumn");
|
|
2404
|
+
this.config.fieldConfig = fieldConfig;
|
|
2405
|
+
this.config.customTypeParams = customTypeParams;
|
|
2406
|
+
}
|
|
2407
|
+
/** @internal */
|
|
2408
|
+
build(table) {
|
|
2409
|
+
return new PgCustomColumn(
|
|
2410
|
+
table,
|
|
2411
|
+
this.config
|
|
2412
|
+
);
|
|
2413
|
+
}
|
|
2414
|
+
};
|
|
2415
|
+
var PgCustomColumn = class extends PgColumn {
|
|
2416
|
+
static [entityKind] = "PgCustomColumn";
|
|
2417
|
+
sqlName;
|
|
2418
|
+
mapTo;
|
|
2419
|
+
mapFrom;
|
|
2420
|
+
constructor(table, config) {
|
|
2421
|
+
super(table, config);
|
|
2422
|
+
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
|
|
2423
|
+
this.mapTo = config.customTypeParams.toDriver;
|
|
2424
|
+
this.mapFrom = config.customTypeParams.fromDriver;
|
|
2425
|
+
}
|
|
2426
|
+
getSQLType() {
|
|
2427
|
+
return this.sqlName;
|
|
2428
|
+
}
|
|
2429
|
+
mapFromDriverValue(value) {
|
|
2430
|
+
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
|
|
2431
|
+
}
|
|
2432
|
+
mapToDriverValue(value) {
|
|
2433
|
+
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
|
|
2434
|
+
}
|
|
2435
|
+
};
|
|
2436
|
+
function customType(customTypeParams) {
|
|
2437
|
+
return (a, b) => {
|
|
2438
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2439
|
+
return new PgCustomColumnBuilder(name, config, customTypeParams);
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
|
|
2443
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/date.common.js
|
|
2444
|
+
var PgDateColumnBaseBuilder = class extends PgColumnBuilder {
|
|
2445
|
+
static [entityKind] = "PgDateColumnBaseBuilder";
|
|
2446
|
+
defaultNow() {
|
|
2447
|
+
return this.default(sql`now()`);
|
|
2448
|
+
}
|
|
2449
|
+
};
|
|
2450
|
+
|
|
2451
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/date.js
|
|
2452
|
+
var PgDateBuilder = class extends PgDateColumnBaseBuilder {
|
|
2453
|
+
static [entityKind] = "PgDateBuilder";
|
|
2454
|
+
constructor(name) {
|
|
2455
|
+
super(name, "date", "PgDate");
|
|
2456
|
+
}
|
|
2457
|
+
/** @internal */
|
|
2458
|
+
build(table) {
|
|
2459
|
+
return new PgDate(table, this.config);
|
|
2460
|
+
}
|
|
2461
|
+
};
|
|
2462
|
+
var PgDate = class extends PgColumn {
|
|
2463
|
+
static [entityKind] = "PgDate";
|
|
2464
|
+
getSQLType() {
|
|
2465
|
+
return "date";
|
|
2466
|
+
}
|
|
2467
|
+
mapFromDriverValue(value) {
|
|
2468
|
+
if (typeof value === "string") return new Date(value);
|
|
2469
|
+
return value;
|
|
2470
|
+
}
|
|
2471
|
+
mapToDriverValue(value) {
|
|
2472
|
+
return value.toISOString();
|
|
2473
|
+
}
|
|
2474
|
+
};
|
|
2475
|
+
var PgDateStringBuilder = class extends PgDateColumnBaseBuilder {
|
|
2476
|
+
static [entityKind] = "PgDateStringBuilder";
|
|
2477
|
+
constructor(name) {
|
|
2478
|
+
super(name, "string", "PgDateString");
|
|
2479
|
+
}
|
|
2480
|
+
/** @internal */
|
|
2481
|
+
build(table) {
|
|
2482
|
+
return new PgDateString(
|
|
2483
|
+
table,
|
|
2484
|
+
this.config
|
|
2485
|
+
);
|
|
2486
|
+
}
|
|
2487
|
+
};
|
|
2488
|
+
var PgDateString = class extends PgColumn {
|
|
2489
|
+
static [entityKind] = "PgDateString";
|
|
2490
|
+
getSQLType() {
|
|
2491
|
+
return "date";
|
|
2492
|
+
}
|
|
2493
|
+
mapFromDriverValue(value) {
|
|
2494
|
+
if (typeof value === "string") return value;
|
|
2495
|
+
return value.toISOString().slice(0, -14);
|
|
2496
|
+
}
|
|
2497
|
+
};
|
|
2498
|
+
function date(a, b) {
|
|
2499
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2500
|
+
if (config?.mode === "date") {
|
|
2501
|
+
return new PgDateBuilder(name);
|
|
2502
|
+
}
|
|
2503
|
+
return new PgDateStringBuilder(name);
|
|
2504
|
+
}
|
|
2505
|
+
|
|
2506
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/double-precision.js
|
|
2507
|
+
var PgDoublePrecisionBuilder = class extends PgColumnBuilder {
|
|
2508
|
+
static [entityKind] = "PgDoublePrecisionBuilder";
|
|
2509
|
+
constructor(name) {
|
|
2510
|
+
super(name, "number", "PgDoublePrecision");
|
|
2511
|
+
}
|
|
2512
|
+
/** @internal */
|
|
2513
|
+
build(table) {
|
|
2514
|
+
return new PgDoublePrecision(
|
|
2515
|
+
table,
|
|
2516
|
+
this.config
|
|
2517
|
+
);
|
|
2518
|
+
}
|
|
2519
|
+
};
|
|
2520
|
+
var PgDoublePrecision = class extends PgColumn {
|
|
2521
|
+
static [entityKind] = "PgDoublePrecision";
|
|
2522
|
+
getSQLType() {
|
|
2523
|
+
return "double precision";
|
|
2524
|
+
}
|
|
2525
|
+
mapFromDriverValue(value) {
|
|
2526
|
+
if (typeof value === "string") {
|
|
2527
|
+
return Number.parseFloat(value);
|
|
2528
|
+
}
|
|
2529
|
+
return value;
|
|
2530
|
+
}
|
|
2531
|
+
};
|
|
2532
|
+
function doublePrecision(name) {
|
|
2533
|
+
return new PgDoublePrecisionBuilder(name ?? "");
|
|
2534
|
+
}
|
|
2535
|
+
|
|
2536
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/inet.js
|
|
2537
|
+
var PgInetBuilder = class extends PgColumnBuilder {
|
|
2538
|
+
static [entityKind] = "PgInetBuilder";
|
|
2539
|
+
constructor(name) {
|
|
2540
|
+
super(name, "string", "PgInet");
|
|
2541
|
+
}
|
|
2542
|
+
/** @internal */
|
|
2543
|
+
build(table) {
|
|
2544
|
+
return new PgInet(table, this.config);
|
|
2545
|
+
}
|
|
2546
|
+
};
|
|
2547
|
+
var PgInet = class extends PgColumn {
|
|
2548
|
+
static [entityKind] = "PgInet";
|
|
2549
|
+
getSQLType() {
|
|
2550
|
+
return "inet";
|
|
2551
|
+
}
|
|
2552
|
+
};
|
|
2553
|
+
function inet(name) {
|
|
2554
|
+
return new PgInetBuilder(name ?? "");
|
|
2555
|
+
}
|
|
2556
|
+
|
|
2557
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/integer.js
|
|
2558
|
+
var PgIntegerBuilder = class extends PgIntColumnBaseBuilder {
|
|
2559
|
+
static [entityKind] = "PgIntegerBuilder";
|
|
2560
|
+
constructor(name) {
|
|
2561
|
+
super(name, "number", "PgInteger");
|
|
2562
|
+
}
|
|
2563
|
+
/** @internal */
|
|
2564
|
+
build(table) {
|
|
2565
|
+
return new PgInteger(table, this.config);
|
|
2566
|
+
}
|
|
2567
|
+
};
|
|
2568
|
+
var PgInteger = class extends PgColumn {
|
|
2569
|
+
static [entityKind] = "PgInteger";
|
|
2570
|
+
getSQLType() {
|
|
2571
|
+
return "integer";
|
|
2572
|
+
}
|
|
2573
|
+
mapFromDriverValue(value) {
|
|
2574
|
+
if (typeof value === "string") {
|
|
2575
|
+
return Number.parseInt(value);
|
|
2576
|
+
}
|
|
2577
|
+
return value;
|
|
2578
|
+
}
|
|
2579
|
+
};
|
|
2580
|
+
function integer(name) {
|
|
2581
|
+
return new PgIntegerBuilder(name ?? "");
|
|
2582
|
+
}
|
|
2583
|
+
|
|
2584
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/interval.js
|
|
2585
|
+
var PgIntervalBuilder = class extends PgColumnBuilder {
|
|
2586
|
+
static [entityKind] = "PgIntervalBuilder";
|
|
2587
|
+
constructor(name, intervalConfig) {
|
|
2588
|
+
super(name, "string", "PgInterval");
|
|
2589
|
+
this.config.intervalConfig = intervalConfig;
|
|
2590
|
+
}
|
|
2591
|
+
/** @internal */
|
|
2592
|
+
build(table) {
|
|
2593
|
+
return new PgInterval(table, this.config);
|
|
2594
|
+
}
|
|
2595
|
+
};
|
|
2596
|
+
var PgInterval = class extends PgColumn {
|
|
2597
|
+
static [entityKind] = "PgInterval";
|
|
2598
|
+
fields = this.config.intervalConfig.fields;
|
|
2599
|
+
precision = this.config.intervalConfig.precision;
|
|
2600
|
+
getSQLType() {
|
|
2601
|
+
const fields = this.fields ? ` ${this.fields}` : "";
|
|
2602
|
+
const precision = this.precision ? `(${this.precision})` : "";
|
|
2603
|
+
return `interval${fields}${precision}`;
|
|
2604
|
+
}
|
|
2605
|
+
};
|
|
2606
|
+
function interval(a, b = {}) {
|
|
2607
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2608
|
+
return new PgIntervalBuilder(name, config);
|
|
2609
|
+
}
|
|
2610
|
+
|
|
2611
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/json.js
|
|
2612
|
+
var PgJsonBuilder = class extends PgColumnBuilder {
|
|
2613
|
+
static [entityKind] = "PgJsonBuilder";
|
|
2614
|
+
constructor(name) {
|
|
2615
|
+
super(name, "json", "PgJson");
|
|
2616
|
+
}
|
|
2617
|
+
/** @internal */
|
|
2618
|
+
build(table) {
|
|
2619
|
+
return new PgJson(table, this.config);
|
|
2620
|
+
}
|
|
2621
|
+
};
|
|
2622
|
+
var PgJson = class extends PgColumn {
|
|
2623
|
+
static [entityKind] = "PgJson";
|
|
2624
|
+
constructor(table, config) {
|
|
2625
|
+
super(table, config);
|
|
2626
|
+
}
|
|
2627
|
+
getSQLType() {
|
|
2628
|
+
return "json";
|
|
2629
|
+
}
|
|
2630
|
+
mapToDriverValue(value) {
|
|
2631
|
+
return JSON.stringify(value);
|
|
2632
|
+
}
|
|
2633
|
+
mapFromDriverValue(value) {
|
|
2634
|
+
if (typeof value === "string") {
|
|
2635
|
+
try {
|
|
2636
|
+
return JSON.parse(value);
|
|
2637
|
+
} catch {
|
|
2638
|
+
return value;
|
|
2639
|
+
}
|
|
2640
|
+
}
|
|
2641
|
+
return value;
|
|
2642
|
+
}
|
|
2643
|
+
};
|
|
2644
|
+
function json(name) {
|
|
2645
|
+
return new PgJsonBuilder(name ?? "");
|
|
2646
|
+
}
|
|
2647
|
+
|
|
2648
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/jsonb.js
|
|
2649
|
+
var PgJsonbBuilder = class extends PgColumnBuilder {
|
|
2650
|
+
static [entityKind] = "PgJsonbBuilder";
|
|
2651
|
+
constructor(name) {
|
|
2652
|
+
super(name, "json", "PgJsonb");
|
|
2653
|
+
}
|
|
2654
|
+
/** @internal */
|
|
2655
|
+
build(table) {
|
|
2656
|
+
return new PgJsonb(table, this.config);
|
|
2657
|
+
}
|
|
2658
|
+
};
|
|
2659
|
+
var PgJsonb = class extends PgColumn {
|
|
2660
|
+
static [entityKind] = "PgJsonb";
|
|
2661
|
+
constructor(table, config) {
|
|
2662
|
+
super(table, config);
|
|
2663
|
+
}
|
|
2664
|
+
getSQLType() {
|
|
2665
|
+
return "jsonb";
|
|
2666
|
+
}
|
|
2667
|
+
mapToDriverValue(value) {
|
|
2668
|
+
return JSON.stringify(value);
|
|
2669
|
+
}
|
|
2670
|
+
mapFromDriverValue(value) {
|
|
2671
|
+
if (typeof value === "string") {
|
|
2672
|
+
try {
|
|
2673
|
+
return JSON.parse(value);
|
|
2674
|
+
} catch {
|
|
2675
|
+
return value;
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
return value;
|
|
2679
|
+
}
|
|
2680
|
+
};
|
|
2681
|
+
function jsonb(name) {
|
|
2682
|
+
return new PgJsonbBuilder(name ?? "");
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2685
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/line.js
|
|
2686
|
+
var PgLineBuilder = class extends PgColumnBuilder {
|
|
2687
|
+
static [entityKind] = "PgLineBuilder";
|
|
2688
|
+
constructor(name) {
|
|
2689
|
+
super(name, "array", "PgLine");
|
|
2690
|
+
}
|
|
2691
|
+
/** @internal */
|
|
2692
|
+
build(table) {
|
|
2693
|
+
return new PgLineTuple(
|
|
2694
|
+
table,
|
|
2695
|
+
this.config
|
|
2696
|
+
);
|
|
2697
|
+
}
|
|
2698
|
+
};
|
|
2699
|
+
var PgLineTuple = class extends PgColumn {
|
|
2700
|
+
static [entityKind] = "PgLine";
|
|
2701
|
+
getSQLType() {
|
|
2702
|
+
return "line";
|
|
2703
|
+
}
|
|
2704
|
+
mapFromDriverValue(value) {
|
|
2705
|
+
const [a, b, c2] = value.slice(1, -1).split(",");
|
|
2706
|
+
return [Number.parseFloat(a), Number.parseFloat(b), Number.parseFloat(c2)];
|
|
2707
|
+
}
|
|
2708
|
+
mapToDriverValue(value) {
|
|
2709
|
+
return `{${value[0]},${value[1]},${value[2]}}`;
|
|
2710
|
+
}
|
|
2711
|
+
};
|
|
2712
|
+
var PgLineABCBuilder = class extends PgColumnBuilder {
|
|
2713
|
+
static [entityKind] = "PgLineABCBuilder";
|
|
2714
|
+
constructor(name) {
|
|
2715
|
+
super(name, "json", "PgLineABC");
|
|
2716
|
+
}
|
|
2717
|
+
/** @internal */
|
|
2718
|
+
build(table) {
|
|
2719
|
+
return new PgLineABC(
|
|
2720
|
+
table,
|
|
2721
|
+
this.config
|
|
2722
|
+
);
|
|
2723
|
+
}
|
|
2724
|
+
};
|
|
2725
|
+
var PgLineABC = class extends PgColumn {
|
|
2726
|
+
static [entityKind] = "PgLineABC";
|
|
2727
|
+
getSQLType() {
|
|
2728
|
+
return "line";
|
|
2729
|
+
}
|
|
2730
|
+
mapFromDriverValue(value) {
|
|
2731
|
+
const [a, b, c2] = value.slice(1, -1).split(",");
|
|
2732
|
+
return { a: Number.parseFloat(a), b: Number.parseFloat(b), c: Number.parseFloat(c2) };
|
|
2733
|
+
}
|
|
2734
|
+
mapToDriverValue(value) {
|
|
2735
|
+
return `{${value.a},${value.b},${value.c}}`;
|
|
2736
|
+
}
|
|
2737
|
+
};
|
|
2738
|
+
function line(a, b) {
|
|
2739
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2740
|
+
if (!config?.mode || config.mode === "tuple") {
|
|
2741
|
+
return new PgLineBuilder(name);
|
|
2742
|
+
}
|
|
2743
|
+
return new PgLineABCBuilder(name);
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/macaddr.js
|
|
2747
|
+
var PgMacaddrBuilder = class extends PgColumnBuilder {
|
|
2748
|
+
static [entityKind] = "PgMacaddrBuilder";
|
|
2749
|
+
constructor(name) {
|
|
2750
|
+
super(name, "string", "PgMacaddr");
|
|
2751
|
+
}
|
|
2752
|
+
/** @internal */
|
|
2753
|
+
build(table) {
|
|
2754
|
+
return new PgMacaddr(table, this.config);
|
|
2755
|
+
}
|
|
2756
|
+
};
|
|
2757
|
+
var PgMacaddr = class extends PgColumn {
|
|
2758
|
+
static [entityKind] = "PgMacaddr";
|
|
2759
|
+
getSQLType() {
|
|
2760
|
+
return "macaddr";
|
|
2761
|
+
}
|
|
2762
|
+
};
|
|
2763
|
+
function macaddr(name) {
|
|
2764
|
+
return new PgMacaddrBuilder(name ?? "");
|
|
2765
|
+
}
|
|
2766
|
+
|
|
2767
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/macaddr8.js
|
|
2768
|
+
var PgMacaddr8Builder = class extends PgColumnBuilder {
|
|
2769
|
+
static [entityKind] = "PgMacaddr8Builder";
|
|
2770
|
+
constructor(name) {
|
|
2771
|
+
super(name, "string", "PgMacaddr8");
|
|
2772
|
+
}
|
|
2773
|
+
/** @internal */
|
|
2774
|
+
build(table) {
|
|
2775
|
+
return new PgMacaddr8(table, this.config);
|
|
2776
|
+
}
|
|
2777
|
+
};
|
|
2778
|
+
var PgMacaddr8 = class extends PgColumn {
|
|
2779
|
+
static [entityKind] = "PgMacaddr8";
|
|
2780
|
+
getSQLType() {
|
|
2781
|
+
return "macaddr8";
|
|
2782
|
+
}
|
|
2783
|
+
};
|
|
2784
|
+
function macaddr8(name) {
|
|
2785
|
+
return new PgMacaddr8Builder(name ?? "");
|
|
2786
|
+
}
|
|
2787
|
+
|
|
2788
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/numeric.js
|
|
2789
|
+
var PgNumericBuilder = class extends PgColumnBuilder {
|
|
2790
|
+
static [entityKind] = "PgNumericBuilder";
|
|
2791
|
+
constructor(name, precision, scale) {
|
|
2792
|
+
super(name, "string", "PgNumeric");
|
|
2793
|
+
this.config.precision = precision;
|
|
2794
|
+
this.config.scale = scale;
|
|
2795
|
+
}
|
|
2796
|
+
/** @internal */
|
|
2797
|
+
build(table) {
|
|
2798
|
+
return new PgNumeric(table, this.config);
|
|
2799
|
+
}
|
|
2800
|
+
};
|
|
2801
|
+
var PgNumeric = class extends PgColumn {
|
|
2802
|
+
static [entityKind] = "PgNumeric";
|
|
2803
|
+
precision;
|
|
2804
|
+
scale;
|
|
2805
|
+
constructor(table, config) {
|
|
2806
|
+
super(table, config);
|
|
2807
|
+
this.precision = config.precision;
|
|
2808
|
+
this.scale = config.scale;
|
|
2809
|
+
}
|
|
2810
|
+
mapFromDriverValue(value) {
|
|
2811
|
+
if (typeof value === "string") return value;
|
|
2812
|
+
return String(value);
|
|
2813
|
+
}
|
|
2814
|
+
getSQLType() {
|
|
2815
|
+
if (this.precision !== void 0 && this.scale !== void 0) {
|
|
2816
|
+
return `numeric(${this.precision}, ${this.scale})`;
|
|
2817
|
+
} else if (this.precision === void 0) {
|
|
2818
|
+
return "numeric";
|
|
2819
|
+
} else {
|
|
2820
|
+
return `numeric(${this.precision})`;
|
|
2821
|
+
}
|
|
2822
|
+
}
|
|
2823
|
+
};
|
|
2824
|
+
var PgNumericNumberBuilder = class extends PgColumnBuilder {
|
|
2825
|
+
static [entityKind] = "PgNumericNumberBuilder";
|
|
2826
|
+
constructor(name, precision, scale) {
|
|
2827
|
+
super(name, "number", "PgNumericNumber");
|
|
2828
|
+
this.config.precision = precision;
|
|
2829
|
+
this.config.scale = scale;
|
|
2830
|
+
}
|
|
2831
|
+
/** @internal */
|
|
2832
|
+
build(table) {
|
|
2833
|
+
return new PgNumericNumber(
|
|
2834
|
+
table,
|
|
2835
|
+
this.config
|
|
2836
|
+
);
|
|
2837
|
+
}
|
|
2838
|
+
};
|
|
2839
|
+
var PgNumericNumber = class extends PgColumn {
|
|
2840
|
+
static [entityKind] = "PgNumericNumber";
|
|
2841
|
+
precision;
|
|
2842
|
+
scale;
|
|
2843
|
+
constructor(table, config) {
|
|
2844
|
+
super(table, config);
|
|
2845
|
+
this.precision = config.precision;
|
|
2846
|
+
this.scale = config.scale;
|
|
2847
|
+
}
|
|
2848
|
+
mapFromDriverValue(value) {
|
|
2849
|
+
if (typeof value === "number") return value;
|
|
2850
|
+
return Number(value);
|
|
2851
|
+
}
|
|
2852
|
+
mapToDriverValue = String;
|
|
2853
|
+
getSQLType() {
|
|
2854
|
+
if (this.precision !== void 0 && this.scale !== void 0) {
|
|
2855
|
+
return `numeric(${this.precision}, ${this.scale})`;
|
|
2856
|
+
} else if (this.precision === void 0) {
|
|
2857
|
+
return "numeric";
|
|
2858
|
+
} else {
|
|
2859
|
+
return `numeric(${this.precision})`;
|
|
2860
|
+
}
|
|
2861
|
+
}
|
|
2862
|
+
};
|
|
2863
|
+
var PgNumericBigIntBuilder = class extends PgColumnBuilder {
|
|
2864
|
+
static [entityKind] = "PgNumericBigIntBuilder";
|
|
2865
|
+
constructor(name, precision, scale) {
|
|
2866
|
+
super(name, "bigint", "PgNumericBigInt");
|
|
2867
|
+
this.config.precision = precision;
|
|
2868
|
+
this.config.scale = scale;
|
|
2869
|
+
}
|
|
2870
|
+
/** @internal */
|
|
2871
|
+
build(table) {
|
|
2872
|
+
return new PgNumericBigInt(
|
|
2873
|
+
table,
|
|
2874
|
+
this.config
|
|
2875
|
+
);
|
|
2876
|
+
}
|
|
2877
|
+
};
|
|
2878
|
+
var PgNumericBigInt = class extends PgColumn {
|
|
2879
|
+
static [entityKind] = "PgNumericBigInt";
|
|
2880
|
+
precision;
|
|
2881
|
+
scale;
|
|
2882
|
+
constructor(table, config) {
|
|
2883
|
+
super(table, config);
|
|
2884
|
+
this.precision = config.precision;
|
|
2885
|
+
this.scale = config.scale;
|
|
2886
|
+
}
|
|
2887
|
+
mapFromDriverValue = BigInt;
|
|
2888
|
+
mapToDriverValue = String;
|
|
2889
|
+
getSQLType() {
|
|
2890
|
+
if (this.precision !== void 0 && this.scale !== void 0) {
|
|
2891
|
+
return `numeric(${this.precision}, ${this.scale})`;
|
|
2892
|
+
} else if (this.precision === void 0) {
|
|
2893
|
+
return "numeric";
|
|
2894
|
+
} else {
|
|
2895
|
+
return `numeric(${this.precision})`;
|
|
2896
|
+
}
|
|
2897
|
+
}
|
|
2898
|
+
};
|
|
2899
|
+
function numeric(a, b) {
|
|
2900
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2901
|
+
const mode = config?.mode;
|
|
2902
|
+
return mode === "number" ? new PgNumericNumberBuilder(name, config?.precision, config?.scale) : mode === "bigint" ? new PgNumericBigIntBuilder(name, config?.precision, config?.scale) : new PgNumericBuilder(name, config?.precision, config?.scale);
|
|
2903
|
+
}
|
|
2904
|
+
|
|
2905
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/point.js
|
|
2906
|
+
var PgPointTupleBuilder = class extends PgColumnBuilder {
|
|
2907
|
+
static [entityKind] = "PgPointTupleBuilder";
|
|
2908
|
+
constructor(name) {
|
|
2909
|
+
super(name, "array", "PgPointTuple");
|
|
2910
|
+
}
|
|
2911
|
+
/** @internal */
|
|
2912
|
+
build(table) {
|
|
2913
|
+
return new PgPointTuple(
|
|
2914
|
+
table,
|
|
2915
|
+
this.config
|
|
2916
|
+
);
|
|
2917
|
+
}
|
|
2918
|
+
};
|
|
2919
|
+
var PgPointTuple = class extends PgColumn {
|
|
2920
|
+
static [entityKind] = "PgPointTuple";
|
|
2921
|
+
getSQLType() {
|
|
2922
|
+
return "point";
|
|
2923
|
+
}
|
|
2924
|
+
mapFromDriverValue(value) {
|
|
2925
|
+
if (typeof value === "string") {
|
|
2926
|
+
const [x, y] = value.slice(1, -1).split(",");
|
|
2927
|
+
return [Number.parseFloat(x), Number.parseFloat(y)];
|
|
2928
|
+
}
|
|
2929
|
+
return [value.x, value.y];
|
|
2930
|
+
}
|
|
2931
|
+
mapToDriverValue(value) {
|
|
2932
|
+
return `(${value[0]},${value[1]})`;
|
|
2933
|
+
}
|
|
2934
|
+
};
|
|
2935
|
+
var PgPointObjectBuilder = class extends PgColumnBuilder {
|
|
2936
|
+
static [entityKind] = "PgPointObjectBuilder";
|
|
2937
|
+
constructor(name) {
|
|
2938
|
+
super(name, "json", "PgPointObject");
|
|
2939
|
+
}
|
|
2940
|
+
/** @internal */
|
|
2941
|
+
build(table) {
|
|
2942
|
+
return new PgPointObject(
|
|
2943
|
+
table,
|
|
2944
|
+
this.config
|
|
2945
|
+
);
|
|
2946
|
+
}
|
|
2947
|
+
};
|
|
2948
|
+
var PgPointObject = class extends PgColumn {
|
|
2949
|
+
static [entityKind] = "PgPointObject";
|
|
2950
|
+
getSQLType() {
|
|
2951
|
+
return "point";
|
|
2952
|
+
}
|
|
2953
|
+
mapFromDriverValue(value) {
|
|
2954
|
+
if (typeof value === "string") {
|
|
2955
|
+
const [x, y] = value.slice(1, -1).split(",");
|
|
2956
|
+
return { x: Number.parseFloat(x), y: Number.parseFloat(y) };
|
|
2957
|
+
}
|
|
2958
|
+
return value;
|
|
2959
|
+
}
|
|
2960
|
+
mapToDriverValue(value) {
|
|
2961
|
+
return `(${value.x},${value.y})`;
|
|
2962
|
+
}
|
|
2963
|
+
};
|
|
2964
|
+
function point(a, b) {
|
|
2965
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2966
|
+
if (!config?.mode || config.mode === "tuple") {
|
|
2967
|
+
return new PgPointTupleBuilder(name);
|
|
2968
|
+
}
|
|
2969
|
+
return new PgPointObjectBuilder(name);
|
|
2970
|
+
}
|
|
2971
|
+
|
|
2972
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/postgis_extension/utils.js
|
|
2973
|
+
function hexToBytes(hex) {
|
|
2974
|
+
const bytes = [];
|
|
2975
|
+
for (let c2 = 0; c2 < hex.length; c2 += 2) {
|
|
2976
|
+
bytes.push(Number.parseInt(hex.slice(c2, c2 + 2), 16));
|
|
2977
|
+
}
|
|
2978
|
+
return new Uint8Array(bytes);
|
|
2979
|
+
}
|
|
2980
|
+
function bytesToFloat64(bytes, offset) {
|
|
2981
|
+
const buffer = new ArrayBuffer(8);
|
|
2982
|
+
const view = new DataView(buffer);
|
|
2983
|
+
for (let i = 0; i < 8; i++) {
|
|
2984
|
+
view.setUint8(i, bytes[offset + i]);
|
|
2985
|
+
}
|
|
2986
|
+
return view.getFloat64(0, true);
|
|
2987
|
+
}
|
|
2988
|
+
function parseEWKB(hex) {
|
|
2989
|
+
const bytes = hexToBytes(hex);
|
|
2990
|
+
let offset = 0;
|
|
2991
|
+
const byteOrder = bytes[offset];
|
|
2992
|
+
offset += 1;
|
|
2993
|
+
const view = new DataView(bytes.buffer);
|
|
2994
|
+
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
2995
|
+
offset += 4;
|
|
2996
|
+
let _srid;
|
|
2997
|
+
if (geomType & 536870912) {
|
|
2998
|
+
_srid = view.getUint32(offset, byteOrder === 1);
|
|
2999
|
+
offset += 4;
|
|
3000
|
+
}
|
|
3001
|
+
if ((geomType & 65535) === 1) {
|
|
3002
|
+
const x = bytesToFloat64(bytes, offset);
|
|
3003
|
+
offset += 8;
|
|
3004
|
+
const y = bytesToFloat64(bytes, offset);
|
|
3005
|
+
offset += 8;
|
|
3006
|
+
return [x, y];
|
|
3007
|
+
}
|
|
3008
|
+
throw new Error("Unsupported geometry type");
|
|
3009
|
+
}
|
|
3010
|
+
|
|
3011
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/postgis_extension/geometry.js
|
|
3012
|
+
var PgGeometryBuilder = class extends PgColumnBuilder {
|
|
3013
|
+
static [entityKind] = "PgGeometryBuilder";
|
|
3014
|
+
constructor(name) {
|
|
3015
|
+
super(name, "array", "PgGeometry");
|
|
3016
|
+
}
|
|
3017
|
+
/** @internal */
|
|
3018
|
+
build(table) {
|
|
3019
|
+
return new PgGeometry(
|
|
3020
|
+
table,
|
|
3021
|
+
this.config
|
|
3022
|
+
);
|
|
3023
|
+
}
|
|
3024
|
+
};
|
|
3025
|
+
var PgGeometry = class extends PgColumn {
|
|
3026
|
+
static [entityKind] = "PgGeometry";
|
|
3027
|
+
getSQLType() {
|
|
3028
|
+
return "geometry(point)";
|
|
3029
|
+
}
|
|
3030
|
+
mapFromDriverValue(value) {
|
|
3031
|
+
return parseEWKB(value);
|
|
3032
|
+
}
|
|
3033
|
+
mapToDriverValue(value) {
|
|
3034
|
+
return `point(${value[0]} ${value[1]})`;
|
|
3035
|
+
}
|
|
3036
|
+
};
|
|
3037
|
+
var PgGeometryObjectBuilder = class extends PgColumnBuilder {
|
|
3038
|
+
static [entityKind] = "PgGeometryObjectBuilder";
|
|
3039
|
+
constructor(name) {
|
|
3040
|
+
super(name, "json", "PgGeometryObject");
|
|
3041
|
+
}
|
|
3042
|
+
/** @internal */
|
|
3043
|
+
build(table) {
|
|
3044
|
+
return new PgGeometryObject(
|
|
3045
|
+
table,
|
|
3046
|
+
this.config
|
|
3047
|
+
);
|
|
3048
|
+
}
|
|
3049
|
+
};
|
|
3050
|
+
var PgGeometryObject = class extends PgColumn {
|
|
3051
|
+
static [entityKind] = "PgGeometryObject";
|
|
3052
|
+
getSQLType() {
|
|
3053
|
+
return "geometry(point)";
|
|
3054
|
+
}
|
|
3055
|
+
mapFromDriverValue(value) {
|
|
3056
|
+
const parsed = parseEWKB(value);
|
|
3057
|
+
return { x: parsed[0], y: parsed[1] };
|
|
3058
|
+
}
|
|
3059
|
+
mapToDriverValue(value) {
|
|
3060
|
+
return `point(${value.x} ${value.y})`;
|
|
3061
|
+
}
|
|
3062
|
+
};
|
|
3063
|
+
function geometry(a, b) {
|
|
3064
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3065
|
+
if (!config?.mode || config.mode === "tuple") {
|
|
3066
|
+
return new PgGeometryBuilder(name);
|
|
3067
|
+
}
|
|
3068
|
+
return new PgGeometryObjectBuilder(name);
|
|
3069
|
+
}
|
|
3070
|
+
|
|
3071
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/real.js
|
|
3072
|
+
var PgRealBuilder = class extends PgColumnBuilder {
|
|
3073
|
+
static [entityKind] = "PgRealBuilder";
|
|
3074
|
+
constructor(name, length) {
|
|
3075
|
+
super(name, "number", "PgReal");
|
|
3076
|
+
this.config.length = length;
|
|
3077
|
+
}
|
|
3078
|
+
/** @internal */
|
|
3079
|
+
build(table) {
|
|
3080
|
+
return new PgReal(table, this.config);
|
|
3081
|
+
}
|
|
3082
|
+
};
|
|
3083
|
+
var PgReal = class extends PgColumn {
|
|
3084
|
+
static [entityKind] = "PgReal";
|
|
3085
|
+
constructor(table, config) {
|
|
3086
|
+
super(table, config);
|
|
3087
|
+
}
|
|
3088
|
+
getSQLType() {
|
|
3089
|
+
return "real";
|
|
3090
|
+
}
|
|
3091
|
+
mapFromDriverValue = (value) => {
|
|
3092
|
+
if (typeof value === "string") {
|
|
3093
|
+
return Number.parseFloat(value);
|
|
3094
|
+
}
|
|
3095
|
+
return value;
|
|
3096
|
+
};
|
|
3097
|
+
};
|
|
3098
|
+
function real(name) {
|
|
3099
|
+
return new PgRealBuilder(name ?? "");
|
|
3100
|
+
}
|
|
3101
|
+
|
|
3102
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/serial.js
|
|
3103
|
+
var PgSerialBuilder = class extends PgColumnBuilder {
|
|
3104
|
+
static [entityKind] = "PgSerialBuilder";
|
|
3105
|
+
constructor(name) {
|
|
3106
|
+
super(name, "number", "PgSerial");
|
|
3107
|
+
this.config.hasDefault = true;
|
|
3108
|
+
this.config.notNull = true;
|
|
3109
|
+
}
|
|
3110
|
+
/** @internal */
|
|
3111
|
+
build(table) {
|
|
3112
|
+
return new PgSerial(table, this.config);
|
|
3113
|
+
}
|
|
3114
|
+
};
|
|
3115
|
+
var PgSerial = class extends PgColumn {
|
|
3116
|
+
static [entityKind] = "PgSerial";
|
|
3117
|
+
getSQLType() {
|
|
3118
|
+
return "serial";
|
|
3119
|
+
}
|
|
3120
|
+
};
|
|
3121
|
+
function serial(name) {
|
|
3122
|
+
return new PgSerialBuilder(name ?? "");
|
|
3123
|
+
}
|
|
3124
|
+
|
|
3125
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/smallint.js
|
|
3126
|
+
var PgSmallIntBuilder = class extends PgIntColumnBaseBuilder {
|
|
3127
|
+
static [entityKind] = "PgSmallIntBuilder";
|
|
3128
|
+
constructor(name) {
|
|
3129
|
+
super(name, "number", "PgSmallInt");
|
|
3130
|
+
}
|
|
3131
|
+
/** @internal */
|
|
3132
|
+
build(table) {
|
|
3133
|
+
return new PgSmallInt(table, this.config);
|
|
3134
|
+
}
|
|
3135
|
+
};
|
|
3136
|
+
var PgSmallInt = class extends PgColumn {
|
|
3137
|
+
static [entityKind] = "PgSmallInt";
|
|
3138
|
+
getSQLType() {
|
|
3139
|
+
return "smallint";
|
|
3140
|
+
}
|
|
3141
|
+
mapFromDriverValue = (value) => {
|
|
3142
|
+
if (typeof value === "string") {
|
|
3143
|
+
return Number(value);
|
|
3144
|
+
}
|
|
3145
|
+
return value;
|
|
3146
|
+
};
|
|
3147
|
+
};
|
|
3148
|
+
function smallint(name) {
|
|
3149
|
+
return new PgSmallIntBuilder(name ?? "");
|
|
3150
|
+
}
|
|
3151
|
+
|
|
3152
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/smallserial.js
|
|
3153
|
+
var PgSmallSerialBuilder = class extends PgColumnBuilder {
|
|
3154
|
+
static [entityKind] = "PgSmallSerialBuilder";
|
|
3155
|
+
constructor(name) {
|
|
3156
|
+
super(name, "number", "PgSmallSerial");
|
|
3157
|
+
this.config.hasDefault = true;
|
|
3158
|
+
this.config.notNull = true;
|
|
3159
|
+
}
|
|
3160
|
+
/** @internal */
|
|
3161
|
+
build(table) {
|
|
3162
|
+
return new PgSmallSerial(
|
|
3163
|
+
table,
|
|
3164
|
+
this.config
|
|
3165
|
+
);
|
|
3166
|
+
}
|
|
3167
|
+
};
|
|
3168
|
+
var PgSmallSerial = class extends PgColumn {
|
|
3169
|
+
static [entityKind] = "PgSmallSerial";
|
|
3170
|
+
getSQLType() {
|
|
3171
|
+
return "smallserial";
|
|
3172
|
+
}
|
|
3173
|
+
};
|
|
3174
|
+
function smallserial(name) {
|
|
3175
|
+
return new PgSmallSerialBuilder(name ?? "");
|
|
3176
|
+
}
|
|
3177
|
+
|
|
3178
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/text.js
|
|
3179
|
+
var PgTextBuilder = class extends PgColumnBuilder {
|
|
3180
|
+
static [entityKind] = "PgTextBuilder";
|
|
3181
|
+
constructor(name, config) {
|
|
3182
|
+
super(name, "string", "PgText");
|
|
3183
|
+
this.config.enumValues = config.enum;
|
|
3184
|
+
}
|
|
3185
|
+
/** @internal */
|
|
3186
|
+
build(table) {
|
|
3187
|
+
return new PgText(table, this.config);
|
|
3188
|
+
}
|
|
3189
|
+
};
|
|
3190
|
+
var PgText = class extends PgColumn {
|
|
3191
|
+
static [entityKind] = "PgText";
|
|
3192
|
+
enumValues = this.config.enumValues;
|
|
3193
|
+
getSQLType() {
|
|
3194
|
+
return "text";
|
|
3195
|
+
}
|
|
3196
|
+
};
|
|
3197
|
+
function text(a, b = {}) {
|
|
3198
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3199
|
+
return new PgTextBuilder(name, config);
|
|
3200
|
+
}
|
|
3201
|
+
|
|
3202
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/time.js
|
|
3203
|
+
var PgTimeBuilder = class extends PgDateColumnBaseBuilder {
|
|
3204
|
+
constructor(name, withTimezone, precision) {
|
|
3205
|
+
super(name, "string", "PgTime");
|
|
3206
|
+
this.withTimezone = withTimezone;
|
|
3207
|
+
this.precision = precision;
|
|
3208
|
+
this.config.withTimezone = withTimezone;
|
|
3209
|
+
this.config.precision = precision;
|
|
3210
|
+
}
|
|
3211
|
+
static [entityKind] = "PgTimeBuilder";
|
|
3212
|
+
/** @internal */
|
|
3213
|
+
build(table) {
|
|
3214
|
+
return new PgTime(table, this.config);
|
|
3215
|
+
}
|
|
3216
|
+
};
|
|
3217
|
+
var PgTime = class extends PgColumn {
|
|
3218
|
+
static [entityKind] = "PgTime";
|
|
3219
|
+
withTimezone;
|
|
3220
|
+
precision;
|
|
3221
|
+
constructor(table, config) {
|
|
3222
|
+
super(table, config);
|
|
3223
|
+
this.withTimezone = config.withTimezone;
|
|
3224
|
+
this.precision = config.precision;
|
|
3225
|
+
}
|
|
3226
|
+
getSQLType() {
|
|
3227
|
+
const precision = this.precision === void 0 ? "" : `(${this.precision})`;
|
|
3228
|
+
return `time${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
3229
|
+
}
|
|
3230
|
+
};
|
|
3231
|
+
function time(a, b = {}) {
|
|
3232
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3233
|
+
return new PgTimeBuilder(name, config.withTimezone ?? false, config.precision);
|
|
3234
|
+
}
|
|
3235
|
+
|
|
3236
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/timestamp.js
|
|
3237
|
+
var PgTimestampBuilder = class extends PgDateColumnBaseBuilder {
|
|
3238
|
+
static [entityKind] = "PgTimestampBuilder";
|
|
3239
|
+
constructor(name, withTimezone, precision) {
|
|
3240
|
+
super(name, "date", "PgTimestamp");
|
|
3241
|
+
this.config.withTimezone = withTimezone;
|
|
3242
|
+
this.config.precision = precision;
|
|
3243
|
+
}
|
|
3244
|
+
/** @internal */
|
|
3245
|
+
build(table) {
|
|
3246
|
+
return new PgTimestamp(table, this.config);
|
|
3247
|
+
}
|
|
3248
|
+
};
|
|
3249
|
+
var PgTimestamp = class extends PgColumn {
|
|
3250
|
+
static [entityKind] = "PgTimestamp";
|
|
3251
|
+
withTimezone;
|
|
3252
|
+
precision;
|
|
3253
|
+
constructor(table, config) {
|
|
3254
|
+
super(table, config);
|
|
3255
|
+
this.withTimezone = config.withTimezone;
|
|
3256
|
+
this.precision = config.precision;
|
|
3257
|
+
}
|
|
3258
|
+
getSQLType() {
|
|
3259
|
+
const precision = this.precision === void 0 ? "" : ` (${this.precision})`;
|
|
3260
|
+
return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
3261
|
+
}
|
|
3262
|
+
mapFromDriverValue(value) {
|
|
3263
|
+
if (typeof value === "string") return new Date(this.withTimezone ? value : value + "+0000");
|
|
3264
|
+
return value;
|
|
3265
|
+
}
|
|
3266
|
+
mapToDriverValue = (value) => {
|
|
3267
|
+
return value.toISOString();
|
|
3268
|
+
};
|
|
3269
|
+
};
|
|
3270
|
+
var PgTimestampStringBuilder = class extends PgDateColumnBaseBuilder {
|
|
3271
|
+
static [entityKind] = "PgTimestampStringBuilder";
|
|
3272
|
+
constructor(name, withTimezone, precision) {
|
|
3273
|
+
super(name, "string", "PgTimestampString");
|
|
3274
|
+
this.config.withTimezone = withTimezone;
|
|
3275
|
+
this.config.precision = precision;
|
|
3276
|
+
}
|
|
3277
|
+
/** @internal */
|
|
3278
|
+
build(table) {
|
|
3279
|
+
return new PgTimestampString(
|
|
3280
|
+
table,
|
|
3281
|
+
this.config
|
|
3282
|
+
);
|
|
3283
|
+
}
|
|
3284
|
+
};
|
|
3285
|
+
var PgTimestampString = class extends PgColumn {
|
|
3286
|
+
static [entityKind] = "PgTimestampString";
|
|
3287
|
+
withTimezone;
|
|
3288
|
+
precision;
|
|
3289
|
+
constructor(table, config) {
|
|
3290
|
+
super(table, config);
|
|
3291
|
+
this.withTimezone = config.withTimezone;
|
|
3292
|
+
this.precision = config.precision;
|
|
3293
|
+
}
|
|
3294
|
+
getSQLType() {
|
|
3295
|
+
const precision = this.precision === void 0 ? "" : `(${this.precision})`;
|
|
3296
|
+
return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
3297
|
+
}
|
|
3298
|
+
mapFromDriverValue(value) {
|
|
3299
|
+
if (typeof value === "string") return value;
|
|
3300
|
+
const shortened = value.toISOString().slice(0, -1).replace("T", " ");
|
|
3301
|
+
if (this.withTimezone) {
|
|
3302
|
+
const offset = value.getTimezoneOffset();
|
|
3303
|
+
const sign = offset <= 0 ? "+" : "-";
|
|
3304
|
+
return `${shortened}${sign}${Math.floor(Math.abs(offset) / 60).toString().padStart(2, "0")}`;
|
|
3305
|
+
}
|
|
3306
|
+
return shortened;
|
|
3307
|
+
}
|
|
3308
|
+
};
|
|
3309
|
+
function timestamp(a, b = {}) {
|
|
3310
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3311
|
+
if (config?.mode === "string") {
|
|
3312
|
+
return new PgTimestampStringBuilder(name, config.withTimezone ?? false, config.precision);
|
|
3313
|
+
}
|
|
3314
|
+
return new PgTimestampBuilder(name, config?.withTimezone ?? false, config?.precision);
|
|
3315
|
+
}
|
|
3316
|
+
|
|
3317
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/uuid.js
|
|
3318
|
+
var PgUUIDBuilder = class extends PgColumnBuilder {
|
|
3319
|
+
static [entityKind] = "PgUUIDBuilder";
|
|
3320
|
+
constructor(name) {
|
|
3321
|
+
super(name, "string", "PgUUID");
|
|
3322
|
+
}
|
|
3323
|
+
/**
|
|
3324
|
+
* Adds `default gen_random_uuid()` to the column definition.
|
|
3325
|
+
*/
|
|
3326
|
+
defaultRandom() {
|
|
3327
|
+
return this.default(sql`gen_random_uuid()`);
|
|
3328
|
+
}
|
|
3329
|
+
/** @internal */
|
|
3330
|
+
build(table) {
|
|
3331
|
+
return new PgUUID(table, this.config);
|
|
3332
|
+
}
|
|
3333
|
+
};
|
|
3334
|
+
var PgUUID = class extends PgColumn {
|
|
3335
|
+
static [entityKind] = "PgUUID";
|
|
3336
|
+
getSQLType() {
|
|
3337
|
+
return "uuid";
|
|
3338
|
+
}
|
|
3339
|
+
};
|
|
3340
|
+
function uuid(name) {
|
|
3341
|
+
return new PgUUIDBuilder(name ?? "");
|
|
3342
|
+
}
|
|
3343
|
+
|
|
3344
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/varchar.js
|
|
3345
|
+
var PgVarcharBuilder = class extends PgColumnBuilder {
|
|
3346
|
+
static [entityKind] = "PgVarcharBuilder";
|
|
3347
|
+
constructor(name, config) {
|
|
3348
|
+
super(name, "string", "PgVarchar");
|
|
3349
|
+
this.config.length = config.length;
|
|
3350
|
+
this.config.enumValues = config.enum;
|
|
3351
|
+
}
|
|
3352
|
+
/** @internal */
|
|
3353
|
+
build(table) {
|
|
3354
|
+
return new PgVarchar(
|
|
3355
|
+
table,
|
|
3356
|
+
this.config
|
|
3357
|
+
);
|
|
3358
|
+
}
|
|
3359
|
+
};
|
|
3360
|
+
var PgVarchar = class extends PgColumn {
|
|
3361
|
+
static [entityKind] = "PgVarchar";
|
|
3362
|
+
length = this.config.length;
|
|
3363
|
+
enumValues = this.config.enumValues;
|
|
3364
|
+
getSQLType() {
|
|
3365
|
+
return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
|
|
3366
|
+
}
|
|
3367
|
+
};
|
|
3368
|
+
function varchar(a, b = {}) {
|
|
3369
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3370
|
+
return new PgVarcharBuilder(name, config);
|
|
3371
|
+
}
|
|
3372
|
+
|
|
3373
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/vector_extension/bit.js
|
|
3374
|
+
var PgBinaryVectorBuilder = class extends PgColumnBuilder {
|
|
3375
|
+
static [entityKind] = "PgBinaryVectorBuilder";
|
|
3376
|
+
constructor(name, config) {
|
|
3377
|
+
super(name, "string", "PgBinaryVector");
|
|
3378
|
+
this.config.dimensions = config.dimensions;
|
|
3379
|
+
}
|
|
3380
|
+
/** @internal */
|
|
3381
|
+
build(table) {
|
|
3382
|
+
return new PgBinaryVector(
|
|
3383
|
+
table,
|
|
3384
|
+
this.config
|
|
3385
|
+
);
|
|
3386
|
+
}
|
|
3387
|
+
};
|
|
3388
|
+
var PgBinaryVector = class extends PgColumn {
|
|
3389
|
+
static [entityKind] = "PgBinaryVector";
|
|
3390
|
+
dimensions = this.config.dimensions;
|
|
3391
|
+
getSQLType() {
|
|
3392
|
+
return `bit(${this.dimensions})`;
|
|
3393
|
+
}
|
|
3394
|
+
};
|
|
3395
|
+
function bit(a, b) {
|
|
3396
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3397
|
+
return new PgBinaryVectorBuilder(name, config);
|
|
3398
|
+
}
|
|
3399
|
+
|
|
3400
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/vector_extension/halfvec.js
|
|
3401
|
+
var PgHalfVectorBuilder = class extends PgColumnBuilder {
|
|
3402
|
+
static [entityKind] = "PgHalfVectorBuilder";
|
|
3403
|
+
constructor(name, config) {
|
|
3404
|
+
super(name, "array", "PgHalfVector");
|
|
3405
|
+
this.config.dimensions = config.dimensions;
|
|
3406
|
+
}
|
|
3407
|
+
/** @internal */
|
|
3408
|
+
build(table) {
|
|
3409
|
+
return new PgHalfVector(
|
|
3410
|
+
table,
|
|
3411
|
+
this.config
|
|
3412
|
+
);
|
|
3413
|
+
}
|
|
3414
|
+
};
|
|
3415
|
+
var PgHalfVector = class extends PgColumn {
|
|
3416
|
+
static [entityKind] = "PgHalfVector";
|
|
3417
|
+
dimensions = this.config.dimensions;
|
|
3418
|
+
getSQLType() {
|
|
3419
|
+
return `halfvec(${this.dimensions})`;
|
|
3420
|
+
}
|
|
3421
|
+
mapToDriverValue(value) {
|
|
3422
|
+
return JSON.stringify(value);
|
|
3423
|
+
}
|
|
3424
|
+
mapFromDriverValue(value) {
|
|
3425
|
+
return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
|
|
3426
|
+
}
|
|
3427
|
+
};
|
|
3428
|
+
function halfvec(a, b) {
|
|
3429
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3430
|
+
return new PgHalfVectorBuilder(name, config);
|
|
3431
|
+
}
|
|
3432
|
+
|
|
3433
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/vector_extension/sparsevec.js
|
|
3434
|
+
var PgSparseVectorBuilder = class extends PgColumnBuilder {
|
|
3435
|
+
static [entityKind] = "PgSparseVectorBuilder";
|
|
3436
|
+
constructor(name, config) {
|
|
3437
|
+
super(name, "string", "PgSparseVector");
|
|
3438
|
+
this.config.dimensions = config.dimensions;
|
|
3439
|
+
}
|
|
3440
|
+
/** @internal */
|
|
3441
|
+
build(table) {
|
|
3442
|
+
return new PgSparseVector(
|
|
3443
|
+
table,
|
|
3444
|
+
this.config
|
|
3445
|
+
);
|
|
3446
|
+
}
|
|
3447
|
+
};
|
|
3448
|
+
var PgSparseVector = class extends PgColumn {
|
|
3449
|
+
static [entityKind] = "PgSparseVector";
|
|
3450
|
+
dimensions = this.config.dimensions;
|
|
3451
|
+
getSQLType() {
|
|
3452
|
+
return `sparsevec(${this.dimensions})`;
|
|
3453
|
+
}
|
|
3454
|
+
};
|
|
3455
|
+
function sparsevec(a, b) {
|
|
3456
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3457
|
+
return new PgSparseVectorBuilder(name, config);
|
|
3458
|
+
}
|
|
3459
|
+
|
|
3460
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/vector_extension/vector.js
|
|
3461
|
+
var PgVectorBuilder = class extends PgColumnBuilder {
|
|
3462
|
+
static [entityKind] = "PgVectorBuilder";
|
|
3463
|
+
constructor(name, config) {
|
|
3464
|
+
super(name, "array", "PgVector");
|
|
3465
|
+
this.config.dimensions = config.dimensions;
|
|
3466
|
+
}
|
|
3467
|
+
/** @internal */
|
|
3468
|
+
build(table) {
|
|
3469
|
+
return new PgVector(
|
|
3470
|
+
table,
|
|
3471
|
+
this.config
|
|
3472
|
+
);
|
|
3473
|
+
}
|
|
3474
|
+
};
|
|
3475
|
+
var PgVector = class extends PgColumn {
|
|
3476
|
+
static [entityKind] = "PgVector";
|
|
3477
|
+
dimensions = this.config.dimensions;
|
|
3478
|
+
getSQLType() {
|
|
3479
|
+
return `vector(${this.dimensions})`;
|
|
3480
|
+
}
|
|
3481
|
+
mapToDriverValue(value) {
|
|
3482
|
+
return JSON.stringify(value);
|
|
3483
|
+
}
|
|
3484
|
+
mapFromDriverValue(value) {
|
|
3485
|
+
return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
|
|
3486
|
+
}
|
|
3487
|
+
};
|
|
3488
|
+
function vector(a, b) {
|
|
3489
|
+
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3490
|
+
return new PgVectorBuilder(name, config);
|
|
3491
|
+
}
|
|
3492
|
+
|
|
3493
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/columns/all.js
|
|
3494
|
+
function getPgColumnBuilders() {
|
|
3495
|
+
return {
|
|
3496
|
+
bigint,
|
|
3497
|
+
bigserial,
|
|
3498
|
+
boolean,
|
|
3499
|
+
char,
|
|
3500
|
+
cidr,
|
|
3501
|
+
customType,
|
|
3502
|
+
date,
|
|
3503
|
+
doublePrecision,
|
|
3504
|
+
inet,
|
|
3505
|
+
integer,
|
|
3506
|
+
interval,
|
|
3507
|
+
json,
|
|
3508
|
+
jsonb,
|
|
3509
|
+
line,
|
|
3510
|
+
macaddr,
|
|
3511
|
+
macaddr8,
|
|
3512
|
+
numeric,
|
|
3513
|
+
point,
|
|
3514
|
+
geometry,
|
|
3515
|
+
real,
|
|
3516
|
+
serial,
|
|
3517
|
+
smallint,
|
|
3518
|
+
smallserial,
|
|
3519
|
+
text,
|
|
3520
|
+
time,
|
|
3521
|
+
timestamp,
|
|
3522
|
+
uuid,
|
|
3523
|
+
varchar,
|
|
3524
|
+
bit,
|
|
3525
|
+
halfvec,
|
|
3526
|
+
sparsevec,
|
|
3527
|
+
vector
|
|
3528
|
+
};
|
|
3529
|
+
}
|
|
3530
|
+
|
|
3531
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/table.js
|
|
3532
|
+
var InlineForeignKeys = Symbol.for("drizzle:PgInlineForeignKeys");
|
|
3533
|
+
var EnableRLS = Symbol.for("drizzle:EnableRLS");
|
|
3534
|
+
var PgTable = class extends Table {
|
|
3535
|
+
static [entityKind] = "PgTable";
|
|
3536
|
+
/** @internal */
|
|
3537
|
+
static Symbol = Object.assign({}, Table.Symbol, {
|
|
3538
|
+
InlineForeignKeys,
|
|
3539
|
+
EnableRLS
|
|
3540
|
+
});
|
|
3541
|
+
/**@internal */
|
|
3542
|
+
[InlineForeignKeys] = [];
|
|
3543
|
+
/** @internal */
|
|
3544
|
+
[EnableRLS] = false;
|
|
3545
|
+
/** @internal */
|
|
3546
|
+
[Table.Symbol.ExtraConfigBuilder] = void 0;
|
|
3547
|
+
/** @internal */
|
|
3548
|
+
[Table.Symbol.ExtraConfigColumns] = {};
|
|
3549
|
+
};
|
|
3550
|
+
function pgTableWithSchema(name, columns, extraConfig, schema, baseName = name) {
|
|
3551
|
+
const rawTable = new PgTable(name, schema, baseName);
|
|
3552
|
+
const parsedColumns = typeof columns === "function" ? columns(getPgColumnBuilders()) : columns;
|
|
3553
|
+
const builtColumns = Object.fromEntries(
|
|
3554
|
+
Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
|
|
3555
|
+
const colBuilder = colBuilderBase;
|
|
3556
|
+
colBuilder.setName(name2);
|
|
3557
|
+
const column = colBuilder.build(rawTable);
|
|
3558
|
+
rawTable[InlineForeignKeys].push(...colBuilder.buildForeignKeys(column, rawTable));
|
|
3559
|
+
return [name2, column];
|
|
3560
|
+
})
|
|
3561
|
+
);
|
|
3562
|
+
const builtColumnsForExtraConfig = Object.fromEntries(
|
|
3563
|
+
Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
|
|
3564
|
+
const colBuilder = colBuilderBase;
|
|
3565
|
+
colBuilder.setName(name2);
|
|
3566
|
+
const column = colBuilder.buildExtraConfigColumn(rawTable);
|
|
3567
|
+
return [name2, column];
|
|
3568
|
+
})
|
|
3569
|
+
);
|
|
3570
|
+
const table = Object.assign(rawTable, builtColumns);
|
|
3571
|
+
table[Table.Symbol.Columns] = builtColumns;
|
|
3572
|
+
table[Table.Symbol.ExtraConfigColumns] = builtColumnsForExtraConfig;
|
|
3573
|
+
if (extraConfig) {
|
|
3574
|
+
table[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
|
3575
|
+
}
|
|
3576
|
+
return Object.assign(table, {
|
|
3577
|
+
enableRLS: () => {
|
|
3578
|
+
table[PgTable.Symbol.EnableRLS] = true;
|
|
3579
|
+
return table;
|
|
3580
|
+
}
|
|
3581
|
+
});
|
|
3582
|
+
}
|
|
3583
|
+
var pgTable = (name, columns, extraConfig) => {
|
|
3584
|
+
return pgTableWithSchema(name, columns, extraConfig, void 0);
|
|
3585
|
+
};
|
|
3586
|
+
|
|
3587
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/pg-core/indexes.js
|
|
3588
|
+
var IndexBuilderOn = class {
|
|
3589
|
+
constructor(unique, name) {
|
|
3590
|
+
this.unique = unique;
|
|
3591
|
+
this.name = name;
|
|
3592
|
+
}
|
|
3593
|
+
static [entityKind] = "PgIndexBuilderOn";
|
|
3594
|
+
on(...columns) {
|
|
3595
|
+
return new IndexBuilder(
|
|
3596
|
+
columns.map((it) => {
|
|
3597
|
+
if (is(it, SQL)) {
|
|
3598
|
+
return it;
|
|
3599
|
+
}
|
|
3600
|
+
it = it;
|
|
3601
|
+
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
|
|
3602
|
+
it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
|
|
3603
|
+
return clonedIndexedColumn;
|
|
3604
|
+
}),
|
|
3605
|
+
this.unique,
|
|
3606
|
+
false,
|
|
3607
|
+
this.name
|
|
3608
|
+
);
|
|
3609
|
+
}
|
|
3610
|
+
onOnly(...columns) {
|
|
3611
|
+
return new IndexBuilder(
|
|
3612
|
+
columns.map((it) => {
|
|
3613
|
+
if (is(it, SQL)) {
|
|
3614
|
+
return it;
|
|
3615
|
+
}
|
|
3616
|
+
it = it;
|
|
3617
|
+
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
|
|
3618
|
+
it.indexConfig = it.defaultConfig;
|
|
3619
|
+
return clonedIndexedColumn;
|
|
3620
|
+
}),
|
|
3621
|
+
this.unique,
|
|
3622
|
+
true,
|
|
3623
|
+
this.name
|
|
3624
|
+
);
|
|
3625
|
+
}
|
|
3626
|
+
/**
|
|
3627
|
+
* Specify what index method to use. Choices are `btree`, `hash`, `gist`, `spgist`, `gin`, `brin`, or user-installed access methods like `bloom`. The default method is `btree.
|
|
3628
|
+
*
|
|
3629
|
+
* If you have the `pg_vector` extension installed in your database, you can use the `hnsw` and `ivfflat` options, which are predefined types.
|
|
3630
|
+
*
|
|
3631
|
+
* **You can always specify any string you want in the method, in case Drizzle doesn't have it natively in its types**
|
|
3632
|
+
*
|
|
3633
|
+
* @param method The name of the index method to be used
|
|
3634
|
+
* @param columns
|
|
3635
|
+
* @returns
|
|
3636
|
+
*/
|
|
3637
|
+
using(method, ...columns) {
|
|
3638
|
+
return new IndexBuilder(
|
|
3639
|
+
columns.map((it) => {
|
|
3640
|
+
if (is(it, SQL)) {
|
|
3641
|
+
return it;
|
|
3642
|
+
}
|
|
3643
|
+
it = it;
|
|
3644
|
+
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
|
|
3645
|
+
it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
|
|
3646
|
+
return clonedIndexedColumn;
|
|
3647
|
+
}),
|
|
3648
|
+
this.unique,
|
|
3649
|
+
true,
|
|
3650
|
+
this.name,
|
|
3651
|
+
method
|
|
3652
|
+
);
|
|
3653
|
+
}
|
|
3654
|
+
};
|
|
3655
|
+
var IndexBuilder = class {
|
|
3656
|
+
static [entityKind] = "PgIndexBuilder";
|
|
3657
|
+
/** @internal */
|
|
3658
|
+
config;
|
|
3659
|
+
constructor(columns, unique, only, name, method = "btree") {
|
|
3660
|
+
this.config = {
|
|
3661
|
+
name,
|
|
3662
|
+
columns,
|
|
3663
|
+
unique,
|
|
3664
|
+
only,
|
|
3665
|
+
method
|
|
3666
|
+
};
|
|
3667
|
+
}
|
|
3668
|
+
concurrently() {
|
|
3669
|
+
this.config.concurrently = true;
|
|
3670
|
+
return this;
|
|
3671
|
+
}
|
|
3672
|
+
with(obj) {
|
|
3673
|
+
this.config.with = obj;
|
|
3674
|
+
return this;
|
|
3675
|
+
}
|
|
3676
|
+
where(condition) {
|
|
3677
|
+
this.config.where = condition;
|
|
3678
|
+
return this;
|
|
3679
|
+
}
|
|
3680
|
+
/** @internal */
|
|
3681
|
+
build(table) {
|
|
3682
|
+
return new Index(this.config, table);
|
|
3683
|
+
}
|
|
3684
|
+
};
|
|
3685
|
+
var Index = class {
|
|
3686
|
+
static [entityKind] = "PgIndex";
|
|
3687
|
+
config;
|
|
3688
|
+
constructor(config, table) {
|
|
3689
|
+
this.config = { ...config, table };
|
|
3690
|
+
}
|
|
3691
|
+
};
|
|
3692
|
+
function index(name) {
|
|
3693
|
+
return new IndexBuilderOn(false, name);
|
|
3694
|
+
}
|
|
3695
|
+
function uniqueIndex(name) {
|
|
3696
|
+
return new IndexBuilderOn(true, name);
|
|
3697
|
+
}
|
|
3698
|
+
|
|
3699
|
+
// ../../node_modules/.pnpm/drizzle-orm@0.45.2_@cloudflare+workers-types@4.20260113.0_@neondatabase+serverless@1.0._9595fca13b02117f1a82e47fffcab042/node_modules/drizzle-orm/relations.js
|
|
3700
|
+
var Relation = class {
|
|
3701
|
+
constructor(sourceTable, referencedTable, relationName) {
|
|
3702
|
+
this.sourceTable = sourceTable;
|
|
3703
|
+
this.referencedTable = referencedTable;
|
|
3704
|
+
this.relationName = relationName;
|
|
3705
|
+
this.referencedTableName = referencedTable[Table.Symbol.Name];
|
|
3706
|
+
}
|
|
3707
|
+
static [entityKind] = "Relation";
|
|
3708
|
+
referencedTableName;
|
|
3709
|
+
fieldName;
|
|
3710
|
+
};
|
|
3711
|
+
var Relations = class {
|
|
3712
|
+
constructor(table, config) {
|
|
3713
|
+
this.table = table;
|
|
3714
|
+
this.config = config;
|
|
3715
|
+
}
|
|
3716
|
+
static [entityKind] = "Relations";
|
|
3717
|
+
};
|
|
3718
|
+
var One = class _One extends Relation {
|
|
3719
|
+
constructor(sourceTable, referencedTable, config, isNullable) {
|
|
3720
|
+
super(sourceTable, referencedTable, config?.relationName);
|
|
3721
|
+
this.config = config;
|
|
3722
|
+
this.isNullable = isNullable;
|
|
3723
|
+
}
|
|
3724
|
+
static [entityKind] = "One";
|
|
3725
|
+
withFieldName(fieldName) {
|
|
3726
|
+
const relation = new _One(
|
|
3727
|
+
this.sourceTable,
|
|
3728
|
+
this.referencedTable,
|
|
3729
|
+
this.config,
|
|
3730
|
+
this.isNullable
|
|
3731
|
+
);
|
|
3732
|
+
relation.fieldName = fieldName;
|
|
3733
|
+
return relation;
|
|
3734
|
+
}
|
|
3735
|
+
};
|
|
3736
|
+
var Many = class _Many extends Relation {
|
|
3737
|
+
constructor(sourceTable, referencedTable, config) {
|
|
3738
|
+
super(sourceTable, referencedTable, config?.relationName);
|
|
3739
|
+
this.config = config;
|
|
3740
|
+
}
|
|
3741
|
+
static [entityKind] = "Many";
|
|
3742
|
+
withFieldName(fieldName) {
|
|
3743
|
+
const relation = new _Many(
|
|
3744
|
+
this.sourceTable,
|
|
3745
|
+
this.referencedTable,
|
|
3746
|
+
this.config
|
|
3747
|
+
);
|
|
3748
|
+
relation.fieldName = fieldName;
|
|
3749
|
+
return relation;
|
|
3750
|
+
}
|
|
3751
|
+
};
|
|
3752
|
+
function relations(table, relations2) {
|
|
3753
|
+
return new Relations(
|
|
3754
|
+
table,
|
|
3755
|
+
(helpers) => Object.fromEntries(
|
|
3756
|
+
Object.entries(relations2(helpers)).map(([key, value]) => [
|
|
3757
|
+
key,
|
|
3758
|
+
value.withFieldName(key)
|
|
3759
|
+
])
|
|
3760
|
+
)
|
|
3761
|
+
);
|
|
3762
|
+
}
|
|
3763
|
+
|
|
3764
|
+
// src/db/models/enums.ts
|
|
3765
|
+
function makeEnum(values) {
|
|
3766
|
+
return Object.fromEntries(values.map((v) => [v, v]));
|
|
3767
|
+
}
|
|
3768
|
+
var planValues = ["FREE", "TEAM", "ENTERPRISE"];
|
|
3769
|
+
var bsPlanEnum = pgEnum("bs_plan", planValues);
|
|
3770
|
+
var Plan = makeEnum(planValues);
|
|
3771
|
+
var orgRoleValues = ["ADMIN", "MANAGER", "USER"];
|
|
3772
|
+
var bsOrgRoleEnum = pgEnum("bs_org_role", orgRoleValues);
|
|
3773
|
+
var OrgRole = makeEnum(orgRoleValues);
|
|
3774
|
+
var artifactPeriodValues = ["QUARTER", "HALF", "YEAR", "CUSTOM"];
|
|
3775
|
+
var bsArtifactPeriodEnum = pgEnum("bs_artifact_period", artifactPeriodValues);
|
|
3776
|
+
var ArtifactPeriod = makeEnum(artifactPeriodValues);
|
|
3777
|
+
var artifactStatusValues = ["GENERATING", "READY", "FAILED"];
|
|
3778
|
+
var bsArtifactStatusEnum = pgEnum("bs_artifact_status", artifactStatusValues);
|
|
3779
|
+
var ArtifactStatus = makeEnum(artifactStatusValues);
|
|
3780
|
+
var workCategoryValues = ["FEATURE", "BUGFIX", "REFACTOR", "DOCS", "TESTING", "DEVOPS", "OTHER"];
|
|
3781
|
+
var bsWorkCategoryEnum = pgEnum("bs_work_category", workCategoryValues);
|
|
3782
|
+
var WorkCategory = makeEnum(workCategoryValues);
|
|
3783
|
+
var workOutcomeValues = ["COMPLETED", "IN_PROGRESS", "BLOCKED", "ABANDONED"];
|
|
3784
|
+
var bsWorkOutcomeEnum = pgEnum("bs_work_outcome", workOutcomeValues);
|
|
3785
|
+
var WorkOutcome = makeEnum(workOutcomeValues);
|
|
3786
|
+
var complexityValues = ["LOW", "MEDIUM", "HIGH"];
|
|
3787
|
+
var bsComplexityEnum = pgEnum("bs_complexity", complexityValues);
|
|
3788
|
+
var Complexity = makeEnum(complexityValues);
|
|
3789
|
+
var visibilityValues = ["PRIVATE", "TEAM", "PUBLIC"];
|
|
3790
|
+
var bsVisibilityEnum = pgEnum("bs_visibility", visibilityValues);
|
|
3791
|
+
var Visibility = makeEnum(visibilityValues);
|
|
3792
|
+
var integrationTypeValues = ["GITHUB", "HUBSPOT", "JIRA", "GOOGLE_CALENDAR", "FIREFLIES", "CLAUDE_CODE", "NOTION"];
|
|
3793
|
+
var bsIntegrationTypeEnum = pgEnum("bs_integration_type", integrationTypeValues);
|
|
3794
|
+
var IntegrationType = makeEnum(integrationTypeValues);
|
|
3795
|
+
|
|
3796
|
+
// src/db/models/auth.ts
|
|
3797
|
+
var import_cuid2 = __toESM(require_cuid2(), 1);
|
|
3798
|
+
var bsUsers = pgTable("bs_users", {
|
|
3799
|
+
id: text("id").$defaultFn(() => (0, import_cuid2.createId)()).primaryKey(),
|
|
3800
|
+
name: text("name"),
|
|
3801
|
+
email: text("email").notNull().unique(),
|
|
3802
|
+
emailVerified: boolean("email_verified").default(false).notNull(),
|
|
3803
|
+
image: text("image"),
|
|
3804
|
+
stripeCustomerId: text("stripe_customer_id").unique(),
|
|
3805
|
+
stripePriceId: text("stripe_price_id"),
|
|
3806
|
+
stripeSubscriptionId: text("stripe_subscription_id").unique(),
|
|
3807
|
+
stripeCurrentPeriodEnd: timestamp("stripe_current_period_end"),
|
|
3808
|
+
plan: bsPlanEnum("plan").default("FREE").notNull(),
|
|
3809
|
+
firefliesApiKey: text("fireflies_api_key"),
|
|
3810
|
+
firefliesWebhookSecret: text("fireflies_webhook_secret"),
|
|
3811
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3812
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3813
|
+
});
|
|
3814
|
+
var bsAccounts = pgTable("bs_accounts", {
|
|
3815
|
+
id: text("id").$defaultFn(() => (0, import_cuid2.createId)()).primaryKey(),
|
|
3816
|
+
userId: text("user_id").notNull(),
|
|
3817
|
+
accountId: text("account_id").notNull(),
|
|
3818
|
+
providerId: text("provider_id").notNull(),
|
|
3819
|
+
accessToken: text("access_token"),
|
|
3820
|
+
refreshToken: text("refresh_token"),
|
|
3821
|
+
accessTokenExpiresAt: timestamp("access_token_expires_at"),
|
|
3822
|
+
refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
|
|
3823
|
+
scope: text("scope"),
|
|
3824
|
+
idToken: text("id_token"),
|
|
3825
|
+
password: text("password"),
|
|
3826
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3827
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3828
|
+
}, (table) => [
|
|
3829
|
+
uniqueIndex("bs_accounts_provider_account_id_idx").on(table.providerId, table.accountId)
|
|
3830
|
+
]);
|
|
3831
|
+
var bsSessions = pgTable("bs_sessions", {
|
|
3832
|
+
id: text("id").$defaultFn(() => (0, import_cuid2.createId)()).primaryKey(),
|
|
3833
|
+
token: text("token").notNull().unique(),
|
|
3834
|
+
userId: text("user_id").notNull(),
|
|
3835
|
+
expiresAt: timestamp("expires_at").notNull(),
|
|
3836
|
+
ipAddress: text("ip_address"),
|
|
3837
|
+
userAgent: text("user_agent"),
|
|
3838
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3839
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3840
|
+
});
|
|
3841
|
+
var bsVerifications = pgTable("bs_verifications", {
|
|
3842
|
+
id: text("id").$defaultFn(() => (0, import_cuid2.createId)()).primaryKey(),
|
|
3843
|
+
identifier: text("identifier").notNull(),
|
|
3844
|
+
value: text("value").notNull(),
|
|
3845
|
+
expiresAt: timestamp("expires_at").notNull(),
|
|
3846
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3847
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3848
|
+
});
|
|
3849
|
+
|
|
3850
|
+
// src/db/models/org.ts
|
|
3851
|
+
var import_cuid22 = __toESM(require_cuid2(), 1);
|
|
3852
|
+
var bsOrgs = pgTable("bs_orgs", {
|
|
3853
|
+
id: text("id").$defaultFn(() => (0, import_cuid22.createId)()).primaryKey(),
|
|
3854
|
+
name: text("name").notNull(),
|
|
3855
|
+
slug: text("slug").notNull().unique(),
|
|
3856
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3857
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3858
|
+
});
|
|
3859
|
+
var bsOrgMembers = pgTable("bs_org_members", {
|
|
3860
|
+
id: text("id").$defaultFn(() => (0, import_cuid22.createId)()).primaryKey(),
|
|
3861
|
+
userId: text("user_id").notNull(),
|
|
3862
|
+
orgId: text("org_id").notNull(),
|
|
3863
|
+
role: bsOrgRoleEnum("role").default("USER").notNull(),
|
|
3864
|
+
teamId: text("team_id"),
|
|
3865
|
+
githubLogin: text("github_login")
|
|
3866
|
+
}, (table) => [
|
|
3867
|
+
uniqueIndex("bs_org_members_user_id_org_id_idx").on(table.userId, table.orgId),
|
|
3868
|
+
index("bs_org_members_team_id_idx").on(table.teamId)
|
|
3869
|
+
]);
|
|
3870
|
+
var bsTeams = pgTable("bs_teams", {
|
|
3871
|
+
id: text("id").$defaultFn(() => (0, import_cuid22.createId)()).primaryKey(),
|
|
3872
|
+
orgId: text("org_id").notNull(),
|
|
3873
|
+
name: text("name").notNull(),
|
|
3874
|
+
// Parent team for nested tree structure (null = top-level).
|
|
3875
|
+
parentTeamId: text("parent_team_id"),
|
|
3876
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3877
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3878
|
+
}, (table) => [
|
|
3879
|
+
index("bs_teams_org_id_idx").on(table.orgId),
|
|
3880
|
+
index("bs_teams_parent_team_id_idx").on(table.parentTeamId)
|
|
3881
|
+
]);
|
|
3882
|
+
var bsOrgInvites = pgTable("bs_org_invites", {
|
|
3883
|
+
id: text("id").$defaultFn(() => (0, import_cuid22.createId)()).primaryKey(),
|
|
3884
|
+
email: text("email").notNull(),
|
|
3885
|
+
orgId: text("org_id").notNull(),
|
|
3886
|
+
role: bsOrgRoleEnum("role").default("USER").notNull(),
|
|
3887
|
+
token: text("token").$defaultFn(() => (0, import_cuid22.createId)()).notNull().unique(),
|
|
3888
|
+
expiresAt: timestamp("expires_at").notNull(),
|
|
3889
|
+
createdAt: timestamp("created_at").defaultNow().notNull()
|
|
3890
|
+
});
|
|
3891
|
+
|
|
3892
|
+
// src/db/models/work.ts
|
|
3893
|
+
var import_cuid23 = __toESM(require_cuid2(), 1);
|
|
3894
|
+
var bsWorkEntries = pgTable("bs_work_entries", {
|
|
3895
|
+
id: text("id").$defaultFn(() => (0, import_cuid23.createId)()).primaryKey(),
|
|
3896
|
+
userId: text("user_id").notNull(),
|
|
3897
|
+
orgId: text("org_id"),
|
|
3898
|
+
tool: text("tool").notNull(),
|
|
3899
|
+
sessionId: text("session_id"),
|
|
3900
|
+
projectName: text("project_name"),
|
|
3901
|
+
repo: text("repo"),
|
|
3902
|
+
branch: text("branch"),
|
|
3903
|
+
summary: text("summary").notNull(),
|
|
3904
|
+
category: bsWorkCategoryEnum("category").default("OTHER").notNull(),
|
|
3905
|
+
why: text("why"),
|
|
3906
|
+
whatChanged: json("what_changed"),
|
|
3907
|
+
outcome: bsWorkOutcomeEnum("outcome").default("IN_PROGRESS").notNull(),
|
|
3908
|
+
filesTouched: integer("files_touched"),
|
|
3909
|
+
complexity: bsComplexityEnum("complexity"),
|
|
3910
|
+
toolVersion: text("tool_version"),
|
|
3911
|
+
model: text("model"),
|
|
3912
|
+
sessionDurationMin: integer("session_duration_min"),
|
|
3913
|
+
turns: integer("turns"),
|
|
3914
|
+
prUrl: text("pr_url"),
|
|
3915
|
+
ticketUrl: text("ticket_url"),
|
|
3916
|
+
commitShas: json("commit_shas"),
|
|
3917
|
+
visibility: bsVisibilityEnum("visibility").default("TEAM").notNull(),
|
|
3918
|
+
notionPageId: text("notion_page_id"),
|
|
3919
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3920
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3921
|
+
}, (table) => [
|
|
3922
|
+
index("bs_work_entries_user_id_idx").on(table.userId),
|
|
3923
|
+
index("bs_work_entries_org_id_idx").on(table.orgId),
|
|
3924
|
+
index("bs_work_entries_created_at_idx").on(table.createdAt),
|
|
3925
|
+
index("bs_work_entries_category_idx").on(table.category)
|
|
3926
|
+
]);
|
|
3927
|
+
var bsApiKeys = pgTable("bs_api_keys", {
|
|
3928
|
+
id: text("id").$defaultFn(() => (0, import_cuid23.createId)()).primaryKey(),
|
|
3929
|
+
userId: text("user_id").notNull(),
|
|
3930
|
+
name: text("name").notNull(),
|
|
3931
|
+
key: text("key").notNull().unique(),
|
|
3932
|
+
lastUsed: timestamp("last_used"),
|
|
3933
|
+
createdAt: timestamp("created_at").defaultNow().notNull()
|
|
3934
|
+
});
|
|
3935
|
+
|
|
3936
|
+
// src/db/models/integrations.ts
|
|
3937
|
+
var import_cuid24 = __toESM(require_cuid2(), 1);
|
|
3938
|
+
var bsIntegrations = pgTable("bs_integrations", {
|
|
3939
|
+
id: text("id").$defaultFn(() => (0, import_cuid24.createId)()).primaryKey(),
|
|
3940
|
+
orgId: text("org_id").notNull(),
|
|
3941
|
+
type: bsIntegrationTypeEnum("type").notNull(),
|
|
3942
|
+
config: json("config").notNull(),
|
|
3943
|
+
enabled: boolean("enabled").default(true).notNull(),
|
|
3944
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3945
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3946
|
+
}, (table) => [
|
|
3947
|
+
uniqueIndex("bs_integrations_org_id_type_idx").on(table.orgId, table.type)
|
|
3948
|
+
]);
|
|
3949
|
+
var bsMemberOauthCredentials = pgTable("bs_member_oauth_credentials", {
|
|
3950
|
+
id: text("id").$defaultFn(() => (0, import_cuid24.createId)()).primaryKey(),
|
|
3951
|
+
userId: text("user_id").notNull(),
|
|
3952
|
+
orgId: text("org_id").notNull(),
|
|
3953
|
+
provider: text("provider").notNull(),
|
|
3954
|
+
// e.g. 'google-calendar'
|
|
3955
|
+
accessToken: text("access_token").notNull(),
|
|
3956
|
+
refreshToken: text("refresh_token"),
|
|
3957
|
+
scope: text("scope"),
|
|
3958
|
+
email: text("email"),
|
|
3959
|
+
expiresAt: timestamp("expires_at"),
|
|
3960
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3961
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3962
|
+
}, (table) => [
|
|
3963
|
+
uniqueIndex("bs_member_oauth_user_org_provider_idx").on(table.userId, table.orgId, table.provider)
|
|
3964
|
+
]);
|
|
3965
|
+
|
|
3966
|
+
// src/db/models/artifacts.ts
|
|
3967
|
+
var import_cuid25 = __toESM(require_cuid2(), 1);
|
|
3968
|
+
var bsArtifacts = pgTable("bs_artifacts", {
|
|
3969
|
+
id: text("id").$defaultFn(() => (0, import_cuid25.createId)()).primaryKey(),
|
|
3970
|
+
orgId: text("org_id").notNull(),
|
|
3971
|
+
// null = team rollup, otherwise per-person
|
|
3972
|
+
subjectUserId: text("subject_user_id"),
|
|
3973
|
+
// reserved for future sub-team support; null in v1
|
|
3974
|
+
subjectTeamId: text("subject_team_id"),
|
|
3975
|
+
generatedBy: text("generated_by"),
|
|
3976
|
+
// userId of creator; null = system/cron
|
|
3977
|
+
periodType: bsArtifactPeriodEnum("period_type").notNull(),
|
|
3978
|
+
periodStart: timestamp("period_start").notNull(),
|
|
3979
|
+
periodEnd: timestamp("period_end").notNull(),
|
|
3980
|
+
title: text("title").notNull(),
|
|
3981
|
+
narrative: text("narrative"),
|
|
3982
|
+
// markdown, LLM-generated
|
|
3983
|
+
stats: json("stats"),
|
|
3984
|
+
// raw metrics
|
|
3985
|
+
status: bsArtifactStatusEnum("status").default("GENERATING").notNull(),
|
|
3986
|
+
errorMessage: text("error_message"),
|
|
3987
|
+
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3988
|
+
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3989
|
+
}, (table) => [
|
|
3990
|
+
index("bs_artifacts_org_id_idx").on(table.orgId),
|
|
3991
|
+
index("bs_artifacts_subject_user_id_idx").on(table.subjectUserId),
|
|
3992
|
+
index("bs_artifacts_period_idx").on(table.periodStart, table.periodEnd)
|
|
3993
|
+
]);
|
|
3994
|
+
|
|
3995
|
+
// src/db/models/relations.ts
|
|
3996
|
+
var bsUsersRelations = relations(bsUsers, ({ many }) => ({
|
|
3997
|
+
accounts: many(bsAccounts),
|
|
3998
|
+
sessions: many(bsSessions),
|
|
3999
|
+
orgMemberships: many(bsOrgMembers),
|
|
4000
|
+
workEntries: many(bsWorkEntries),
|
|
4001
|
+
apiKeys: many(bsApiKeys)
|
|
4002
|
+
}));
|
|
4003
|
+
var bsAccountsRelations = relations(bsAccounts, ({ one }) => ({
|
|
4004
|
+
user: one(bsUsers, { fields: [bsAccounts.userId], references: [bsUsers.id] })
|
|
4005
|
+
}));
|
|
4006
|
+
var bsSessionsRelations = relations(bsSessions, ({ one }) => ({
|
|
4007
|
+
user: one(bsUsers, { fields: [bsSessions.userId], references: [bsUsers.id] })
|
|
4008
|
+
}));
|
|
4009
|
+
var bsVerificationsRelations = relations(bsVerifications, ({ one }) => ({
|
|
4010
|
+
user: one(bsUsers, { fields: [bsVerifications.identifier], references: [bsUsers.email] })
|
|
4011
|
+
}));
|
|
4012
|
+
var bsOrgsRelations = relations(bsOrgs, ({ many }) => ({
|
|
4013
|
+
members: many(bsOrgMembers),
|
|
4014
|
+
invites: many(bsOrgInvites),
|
|
4015
|
+
integrations: many(bsIntegrations)
|
|
4016
|
+
}));
|
|
4017
|
+
var bsOrgMembersRelations = relations(bsOrgMembers, ({ one }) => ({
|
|
4018
|
+
user: one(bsUsers, { fields: [bsOrgMembers.userId], references: [bsUsers.id] }),
|
|
4019
|
+
org: one(bsOrgs, { fields: [bsOrgMembers.orgId], references: [bsOrgs.id] }),
|
|
4020
|
+
team: one(bsTeams, { fields: [bsOrgMembers.teamId], references: [bsTeams.id] })
|
|
4021
|
+
}));
|
|
4022
|
+
var bsTeamsRelations = relations(bsTeams, ({ one, many }) => ({
|
|
4023
|
+
org: one(bsOrgs, { fields: [bsTeams.orgId], references: [bsOrgs.id] }),
|
|
4024
|
+
parent: one(bsTeams, { fields: [bsTeams.parentTeamId], references: [bsTeams.id], relationName: "parentTeam" }),
|
|
4025
|
+
members: many(bsOrgMembers)
|
|
4026
|
+
}));
|
|
4027
|
+
var bsOrgInvitesRelations = relations(bsOrgInvites, ({ one }) => ({
|
|
4028
|
+
org: one(bsOrgs, { fields: [bsOrgInvites.orgId], references: [bsOrgs.id] })
|
|
4029
|
+
}));
|
|
4030
|
+
var bsWorkEntriesRelations = relations(bsWorkEntries, ({ one }) => ({
|
|
4031
|
+
user: one(bsUsers, { fields: [bsWorkEntries.userId], references: [bsUsers.id] })
|
|
4032
|
+
}));
|
|
4033
|
+
var bsApiKeysRelations = relations(bsApiKeys, ({ one }) => ({
|
|
4034
|
+
user: one(bsUsers, { fields: [bsApiKeys.userId], references: [bsUsers.id] })
|
|
4035
|
+
}));
|
|
4036
|
+
var bsIntegrationsRelations = relations(bsIntegrations, ({ one }) => ({
|
|
4037
|
+
org: one(bsOrgs, { fields: [bsIntegrations.orgId], references: [bsOrgs.id] })
|
|
4038
|
+
}));
|
|
4039
|
+
var bsArtifactsRelations = relations(bsArtifacts, ({ one }) => ({
|
|
4040
|
+
org: one(bsOrgs, { fields: [bsArtifacts.orgId], references: [bsOrgs.id] }),
|
|
4041
|
+
subjectUser: one(bsUsers, { fields: [bsArtifacts.subjectUserId], references: [bsUsers.id] })
|
|
4042
|
+
}));
|
|
4043
|
+
var bsMemberOauthCredentialsRelations = relations(bsMemberOauthCredentials, ({ one }) => ({
|
|
4044
|
+
user: one(bsUsers, { fields: [bsMemberOauthCredentials.userId], references: [bsUsers.id] }),
|
|
4045
|
+
org: one(bsOrgs, { fields: [bsMemberOauthCredentials.orgId], references: [bsOrgs.id] })
|
|
4046
|
+
}));
|
|
4047
|
+
|
|
4048
|
+
// src/cli/commands/status.ts
|
|
4049
|
+
init_util();
|
|
4050
|
+
function groupBy(arr, fn) {
|
|
4051
|
+
const result = {};
|
|
4052
|
+
for (const item of arr) {
|
|
4053
|
+
const key = fn(item);
|
|
4054
|
+
(result[key] ??= []).push(item);
|
|
4055
|
+
}
|
|
4056
|
+
return result;
|
|
4057
|
+
}
|
|
4058
|
+
function formatOutcome(outcome) {
|
|
4059
|
+
switch (outcome) {
|
|
4060
|
+
case WorkOutcome.COMPLETED:
|
|
4061
|
+
return c.green("completed");
|
|
4062
|
+
case WorkOutcome.IN_PROGRESS:
|
|
4063
|
+
return c.yellow("in progress");
|
|
4064
|
+
case WorkOutcome.BLOCKED:
|
|
4065
|
+
return c.red("blocked");
|
|
4066
|
+
default:
|
|
4067
|
+
return c.dim(outcome.toLowerCase());
|
|
4068
|
+
}
|
|
4069
|
+
}
|
|
4070
|
+
async function fetchRemoteEntries(config) {
|
|
4071
|
+
try {
|
|
4072
|
+
const res = await fetch(
|
|
4073
|
+
`${config.baseUrl}/api/entries?period=week&limit=100`,
|
|
4074
|
+
{
|
|
4075
|
+
headers: { Authorization: `Bearer ${config.apiKey}` }
|
|
4076
|
+
}
|
|
4077
|
+
);
|
|
4078
|
+
if (!res.ok) return [];
|
|
4079
|
+
const data = await res.json();
|
|
4080
|
+
return data.entries || [];
|
|
4081
|
+
} catch {
|
|
4082
|
+
return [];
|
|
4083
|
+
}
|
|
4084
|
+
}
|
|
4085
|
+
function readLocalEntries() {
|
|
4086
|
+
ensureDirs();
|
|
4087
|
+
const files = fs3.readdirSync(BUFFER_DIR).filter((f) => f.endsWith(".json"));
|
|
4088
|
+
const entries = [];
|
|
4089
|
+
for (const file of files) {
|
|
4090
|
+
try {
|
|
4091
|
+
entries.push(
|
|
4092
|
+
JSON.parse(fs3.readFileSync(path3.join(BUFFER_DIR, file), "utf-8"))
|
|
4093
|
+
);
|
|
4094
|
+
} catch {
|
|
4095
|
+
}
|
|
4096
|
+
}
|
|
4097
|
+
return entries;
|
|
4098
|
+
}
|
|
4099
|
+
async function status() {
|
|
4100
|
+
const config = readConfig();
|
|
4101
|
+
const entries = readLocalEntries();
|
|
4102
|
+
if (config?.apiKey) {
|
|
4103
|
+
const remote = await fetchRemoteEntries(config);
|
|
4104
|
+
const seen = new Set(entries.map((e) => e.sessionId).filter(Boolean));
|
|
4105
|
+
for (const re of remote) {
|
|
4106
|
+
if (!re.sessionId || !seen.has(re.sessionId)) {
|
|
4107
|
+
entries.push(re);
|
|
4108
|
+
}
|
|
4109
|
+
}
|
|
4110
|
+
}
|
|
4111
|
+
if (entries.length === 0) {
|
|
4112
|
+
console.log();
|
|
4113
|
+
console.log(` ${c.dim("No sessions logged this week.")}`);
|
|
4114
|
+
console.log(
|
|
4115
|
+
` ${c.dim("Start using Claude Code \u2014 entries will appear here.")}`
|
|
4116
|
+
);
|
|
4117
|
+
console.log();
|
|
4118
|
+
return;
|
|
4119
|
+
}
|
|
4120
|
+
console.log();
|
|
4121
|
+
console.log(
|
|
4122
|
+
` ${c.yellow(`This week \u2014 ${entries.length} sessions logged`)}`
|
|
4123
|
+
);
|
|
4124
|
+
console.log();
|
|
4125
|
+
const byProject = groupBy(entries, (e) => e.projectName || "unknown");
|
|
4126
|
+
for (const [project, projectEntries] of Object.entries(byProject)) {
|
|
4127
|
+
const commits = projectEntries.reduce(
|
|
4128
|
+
(sum, e) => sum + (e.commitShas?.length || 0),
|
|
4129
|
+
0
|
|
4130
|
+
);
|
|
4131
|
+
const latestOutcome = projectEntries[0]?.outcome || WorkOutcome.IN_PROGRESS;
|
|
4132
|
+
const outcomeStr = formatOutcome(latestOutcome);
|
|
4133
|
+
const parts = [`${projectEntries.length} sessions`];
|
|
4134
|
+
if (commits > 0) {
|
|
4135
|
+
parts.push(`${commits} commit${commits !== 1 ? "s" : ""}`);
|
|
4136
|
+
}
|
|
4137
|
+
parts.push(outcomeStr);
|
|
4138
|
+
console.log(
|
|
4139
|
+
` ${c.bold(project)} ${c.dim(parts.join(" \xB7 "))}`
|
|
4140
|
+
);
|
|
4141
|
+
}
|
|
4142
|
+
const localOnly = readLocalEntries();
|
|
4143
|
+
if (localOnly.length > 0) {
|
|
4144
|
+
console.log();
|
|
4145
|
+
console.log(
|
|
4146
|
+
` ${c.dim(`${localOnly.length} entries pending sync`)}`
|
|
4147
|
+
);
|
|
4148
|
+
}
|
|
4149
|
+
console.log();
|
|
4150
|
+
}
|
|
4151
|
+
|
|
4152
|
+
// src/cli/index.ts
|
|
4153
|
+
init_sync();
|
|
4154
|
+
|
|
4155
|
+
// src/cli/commands/hook-stop.ts
|
|
4156
|
+
init_config();
|
|
4157
|
+
import fs5 from "node:fs";
|
|
4158
|
+
import path5 from "node:path";
|
|
4159
|
+
import os3 from "node:os";
|
|
4160
|
+
import { execSync as execSync3 } from "node:child_process";
|
|
4161
|
+
function parseTranscriptLine(line2) {
|
|
4162
|
+
try {
|
|
4163
|
+
return JSON.parse(line2);
|
|
4164
|
+
} catch {
|
|
4165
|
+
return null;
|
|
4166
|
+
}
|
|
4167
|
+
}
|
|
4168
|
+
function extractGitInfo(cwd) {
|
|
4169
|
+
const result = {};
|
|
4170
|
+
try {
|
|
4171
|
+
result.branch = execSync3("git rev-parse --abbrev-ref HEAD", {
|
|
4172
|
+
cwd,
|
|
4173
|
+
encoding: "utf-8",
|
|
4174
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
4175
|
+
}).trim();
|
|
4176
|
+
} catch {
|
|
4177
|
+
}
|
|
4178
|
+
try {
|
|
4179
|
+
result.repo = execSync3("git remote get-url origin", {
|
|
4180
|
+
cwd,
|
|
4181
|
+
encoding: "utf-8",
|
|
4182
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
4183
|
+
}).trim();
|
|
4184
|
+
} catch {
|
|
4185
|
+
}
|
|
4186
|
+
result.projectName = path5.basename(cwd);
|
|
4187
|
+
return result;
|
|
4188
|
+
}
|
|
4189
|
+
function readSessionAccumulator(sessionId) {
|
|
4190
|
+
const sessionFile = path5.join(SESSION_DIR, `${sessionId}.json`);
|
|
4191
|
+
if (!fs5.existsSync(sessionFile)) return null;
|
|
4192
|
+
try {
|
|
4193
|
+
const raw = JSON.parse(fs5.readFileSync(sessionFile, "utf-8"));
|
|
4194
|
+
raw.filesWritten = new Set(raw.filesWritten || []);
|
|
4195
|
+
raw.commitShas = new Set(raw.commitShas || []);
|
|
4196
|
+
return raw;
|
|
4197
|
+
} catch {
|
|
4198
|
+
return null;
|
|
4199
|
+
}
|
|
4200
|
+
}
|
|
4201
|
+
function writeSessionAccumulator(acc) {
|
|
4202
|
+
const sessionFile = path5.join(SESSION_DIR, `${acc.sessionId}.json`);
|
|
4203
|
+
const serializable = {
|
|
4204
|
+
...acc,
|
|
4205
|
+
filesWritten: Array.from(acc.filesWritten),
|
|
4206
|
+
commitShas: Array.from(acc.commitShas)
|
|
4207
|
+
};
|
|
4208
|
+
fs5.writeFileSync(sessionFile, JSON.stringify(serializable, null, 2));
|
|
4209
|
+
}
|
|
4210
|
+
function analyzeTranscript(transcriptPath, acc) {
|
|
4211
|
+
if (!fs5.existsSync(transcriptPath)) return acc;
|
|
4212
|
+
const content = fs5.readFileSync(transcriptPath, "utf-8");
|
|
4213
|
+
const lines = content.split("\n").filter(Boolean);
|
|
4214
|
+
for (const line2 of lines) {
|
|
4215
|
+
const entry = parseTranscriptLine(line2);
|
|
4216
|
+
if (!entry) continue;
|
|
4217
|
+
const message = entry.message;
|
|
4218
|
+
const contentBlocks = Array.isArray(message?.content) ? message.content : [];
|
|
4219
|
+
if (entry.type === "assistant" && contentBlocks.length > 0) {
|
|
4220
|
+
const hasText = contentBlocks.some(
|
|
4221
|
+
(b) => b.type === "text" || b.type === "thinking"
|
|
4222
|
+
);
|
|
4223
|
+
if (hasText) acc.turns++;
|
|
4224
|
+
}
|
|
4225
|
+
if (entry.type === "assistant") {
|
|
4226
|
+
for (const block of contentBlocks) {
|
|
4227
|
+
if (block.type === "tool_use") {
|
|
4228
|
+
const toolName = block.name || "unknown";
|
|
4229
|
+
acc.toolCalls.push({
|
|
4230
|
+
tool: toolName,
|
|
4231
|
+
timestamp: entry.timestamp
|
|
4232
|
+
});
|
|
4233
|
+
if (toolName === "Write" || toolName === "Edit" || toolName === "NotebookEdit") {
|
|
4234
|
+
const input = block.input;
|
|
4235
|
+
const filePath = input?.file_path || input?.path;
|
|
4236
|
+
if (filePath) acc.filesWritten.add(filePath);
|
|
4237
|
+
}
|
|
4238
|
+
}
|
|
4239
|
+
}
|
|
4240
|
+
}
|
|
4241
|
+
if (entry.type === "user") {
|
|
4242
|
+
for (const block of contentBlocks) {
|
|
4243
|
+
if (block.type === "tool_result") {
|
|
4244
|
+
const resultContent = typeof block.content === "string" ? block.content : Array.isArray(block.content) ? block.content.map((c2) => c2.text || "").join("\n") : "";
|
|
4245
|
+
const shaMatch = resultContent.match(/\[([a-f0-9]{7,12})\]\s/);
|
|
4246
|
+
if (shaMatch) {
|
|
4247
|
+
acc.commitShas.add(shaMatch[1]);
|
|
4248
|
+
}
|
|
4249
|
+
}
|
|
4250
|
+
}
|
|
4251
|
+
}
|
|
4252
|
+
}
|
|
4253
|
+
return acc;
|
|
4254
|
+
}
|
|
4255
|
+
function categorizeWork(acc) {
|
|
4256
|
+
const files = Array.from(acc.filesWritten);
|
|
4257
|
+
const fileCount = files.length;
|
|
4258
|
+
let category = WorkCategory.OTHER;
|
|
4259
|
+
const testFiles = files.filter(
|
|
4260
|
+
(f) => f.includes(".test.") || f.includes(".spec.") || f.includes("__tests__")
|
|
4261
|
+
);
|
|
4262
|
+
const docFiles = files.filter(
|
|
4263
|
+
(f) => f.endsWith(".md") || f.includes("/docs/")
|
|
4264
|
+
);
|
|
4265
|
+
const configFiles = files.filter(
|
|
4266
|
+
(f) => f.includes("Dockerfile") || f.includes(".yml") || f.includes(".yaml") || f.includes("ci")
|
|
4267
|
+
);
|
|
4268
|
+
if (testFiles.length > fileCount / 2) category = WorkCategory.TESTING;
|
|
4269
|
+
else if (docFiles.length > fileCount / 2) category = WorkCategory.DOCS;
|
|
4270
|
+
else if (configFiles.length > fileCount / 2) category = WorkCategory.DEVOPS;
|
|
4271
|
+
else if (fileCount > 0) category = WorkCategory.FEATURE;
|
|
4272
|
+
let complexity = Complexity.LOW;
|
|
4273
|
+
if (fileCount === 0) complexity = Complexity.LOW;
|
|
4274
|
+
else if (fileCount <= 2) complexity = Complexity.LOW;
|
|
4275
|
+
else if (fileCount <= 6) complexity = Complexity.MEDIUM;
|
|
4276
|
+
else complexity = Complexity.HIGH;
|
|
4277
|
+
return { category, complexity };
|
|
4278
|
+
}
|
|
4279
|
+
function readSkillSummary(sessionId) {
|
|
4280
|
+
const summaryFile = path5.join(
|
|
4281
|
+
os3.homedir(),
|
|
4282
|
+
".basestream",
|
|
4283
|
+
"sessions",
|
|
4284
|
+
`${sessionId}-summary.md`
|
|
4285
|
+
);
|
|
4286
|
+
if (!fs5.existsSync(summaryFile)) return null;
|
|
4287
|
+
try {
|
|
4288
|
+
return fs5.readFileSync(summaryFile, "utf-8").trim() || null;
|
|
4289
|
+
} catch {
|
|
4290
|
+
return null;
|
|
4291
|
+
}
|
|
4292
|
+
}
|
|
4293
|
+
function flushToBuffer(acc) {
|
|
4294
|
+
const { category, complexity } = categorizeWork(acc);
|
|
4295
|
+
const now = /* @__PURE__ */ new Date();
|
|
4296
|
+
const startTime = new Date(acc.startedAt);
|
|
4297
|
+
const durationMin = Math.round(
|
|
4298
|
+
(now.getTime() - startTime.getTime()) / 6e4
|
|
4299
|
+
);
|
|
4300
|
+
const entry = {
|
|
4301
|
+
sessionId: acc.sessionId,
|
|
4302
|
+
tool: "claude-code",
|
|
4303
|
+
projectName: acc.projectName || path5.basename(acc.cwd),
|
|
4304
|
+
repo: acc.gitRepo || null,
|
|
4305
|
+
branch: acc.gitBranch || null,
|
|
4306
|
+
summary: readSkillSummary(acc.sessionId) ?? buildSummary(acc, category),
|
|
4307
|
+
category,
|
|
4308
|
+
why: null,
|
|
4309
|
+
// Hook-based: no "why" available (CLAUDE.md rules would provide this)
|
|
4310
|
+
whatChanged: Array.from(acc.filesWritten).map(
|
|
4311
|
+
(f) => path5.relative(acc.cwd, f) || f
|
|
4312
|
+
),
|
|
4313
|
+
outcome: WorkOutcome.IN_PROGRESS,
|
|
4314
|
+
filesTouched: acc.filesWritten.size,
|
|
4315
|
+
complexity,
|
|
4316
|
+
toolVersion: null,
|
|
4317
|
+
model: null,
|
|
4318
|
+
sessionDurationMin: durationMin > 0 ? durationMin : 1,
|
|
4319
|
+
turns: acc.turns,
|
|
4320
|
+
prUrl: null,
|
|
4321
|
+
ticketUrl: null,
|
|
4322
|
+
commitShas: Array.from(acc.commitShas),
|
|
4323
|
+
visibility: Visibility.TEAM,
|
|
4324
|
+
bufferedAt: now.toISOString()
|
|
4325
|
+
};
|
|
4326
|
+
ensureDirs();
|
|
4327
|
+
const filename = `${Date.now()}-${acc.sessionId.slice(0, 8)}.json`;
|
|
4328
|
+
fs5.writeFileSync(
|
|
4329
|
+
path5.join(BUFFER_DIR, filename),
|
|
4330
|
+
JSON.stringify(entry, null, 2)
|
|
4331
|
+
);
|
|
4332
|
+
}
|
|
4333
|
+
function buildSummary(acc, category) {
|
|
4334
|
+
const fileCount = acc.filesWritten.size;
|
|
4335
|
+
const commitCount = acc.commitShas.size;
|
|
4336
|
+
const parts = [];
|
|
4337
|
+
if (category !== WorkCategory.OTHER) {
|
|
4338
|
+
parts.push(category.toLowerCase());
|
|
4339
|
+
}
|
|
4340
|
+
if (fileCount > 0) {
|
|
4341
|
+
parts.push(
|
|
4342
|
+
`${fileCount} file${fileCount !== 1 ? "s" : ""} modified`
|
|
4343
|
+
);
|
|
4344
|
+
}
|
|
4345
|
+
if (commitCount > 0) {
|
|
4346
|
+
parts.push(
|
|
4347
|
+
`${commitCount} commit${commitCount !== 1 ? "s" : ""}`
|
|
4348
|
+
);
|
|
4349
|
+
}
|
|
4350
|
+
if (acc.projectName) {
|
|
4351
|
+
parts.push(`in ${acc.projectName}`);
|
|
4352
|
+
}
|
|
4353
|
+
return parts.length > 0 ? parts.join(", ") : `Claude Code session in ${acc.projectName || "unknown project"}`;
|
|
4354
|
+
}
|
|
4355
|
+
async function hookStop() {
|
|
4356
|
+
let payload;
|
|
4357
|
+
try {
|
|
4358
|
+
const chunks = [];
|
|
4359
|
+
for await (const chunk of process.stdin) {
|
|
4360
|
+
chunks.push(chunk);
|
|
4361
|
+
}
|
|
4362
|
+
payload = JSON.parse(Buffer.concat(chunks).toString("utf-8"));
|
|
4363
|
+
} catch {
|
|
4364
|
+
process.exit(0);
|
|
4365
|
+
}
|
|
4366
|
+
const { session_id, transcript_path, cwd } = payload;
|
|
4367
|
+
if (!session_id) process.exit(0);
|
|
4368
|
+
ensureDirs();
|
|
4369
|
+
let acc = readSessionAccumulator(session_id);
|
|
4370
|
+
if (!acc) {
|
|
4371
|
+
const gitInfo = extractGitInfo(cwd);
|
|
4372
|
+
acc = {
|
|
4373
|
+
sessionId: session_id,
|
|
4374
|
+
cwd,
|
|
4375
|
+
startedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4376
|
+
lastUpdatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
4377
|
+
turns: 0,
|
|
4378
|
+
toolCalls: [],
|
|
4379
|
+
filesWritten: /* @__PURE__ */ new Set(),
|
|
4380
|
+
commitShas: /* @__PURE__ */ new Set(),
|
|
4381
|
+
gitBranch: gitInfo.branch,
|
|
4382
|
+
gitRepo: gitInfo.repo,
|
|
4383
|
+
projectName: gitInfo.projectName
|
|
4384
|
+
};
|
|
4385
|
+
}
|
|
4386
|
+
if (transcript_path) {
|
|
4387
|
+
acc = analyzeTranscript(transcript_path, acc);
|
|
4388
|
+
}
|
|
4389
|
+
acc.lastUpdatedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
4390
|
+
writeSessionAccumulator(acc);
|
|
4391
|
+
if (acc.filesWritten.size > 0 || acc.commitShas.size > 0 || acc.turns >= 3) {
|
|
4392
|
+
flushToBuffer(acc);
|
|
4393
|
+
const config = readConfig();
|
|
4394
|
+
if (config?.apiKey) {
|
|
4395
|
+
try {
|
|
4396
|
+
const { syncEntries: syncEntries2 } = await Promise.resolve().then(() => (init_sync(), sync_exports));
|
|
4397
|
+
await syncEntries2(config);
|
|
4398
|
+
} catch {
|
|
4399
|
+
}
|
|
4400
|
+
}
|
|
4401
|
+
}
|
|
4402
|
+
}
|
|
4403
|
+
|
|
4404
|
+
// src/cli/index.ts
|
|
4405
|
+
var HELP = `
|
|
4406
|
+
basestream \u2014 AI work intelligence for teams
|
|
4407
|
+
|
|
4408
|
+
Usage:
|
|
4409
|
+
npx @basestream/cli init Set up everything (hooks, auth, buffer)
|
|
4410
|
+
|
|
4411
|
+
Commands:
|
|
4412
|
+
basestream init Detect AI tools, inject hooks, authenticate
|
|
4413
|
+
basestream login Authenticate with your Basestream account
|
|
4414
|
+
basestream status Show this week's logged sessions
|
|
4415
|
+
basestream sync Manually sync buffered entries to Basestream
|
|
4416
|
+
|
|
4417
|
+
Options:
|
|
4418
|
+
--help, -h Show this help message
|
|
4419
|
+
--version, -v Show version
|
|
4420
|
+
`;
|
|
4421
|
+
async function main() {
|
|
4422
|
+
const command = process.argv[2];
|
|
4423
|
+
if (command === "--help" || command === "-h") {
|
|
4424
|
+
console.log(HELP.trim());
|
|
4425
|
+
process.exit(0);
|
|
4426
|
+
}
|
|
4427
|
+
if (command === "--version" || command === "-v") {
|
|
4428
|
+
console.log(true ? "0.2.0" : "dev");
|
|
4429
|
+
process.exit(0);
|
|
4430
|
+
}
|
|
4431
|
+
switch (command || "init") {
|
|
4432
|
+
case "init":
|
|
4433
|
+
await init();
|
|
4434
|
+
process.exit(0);
|
|
4435
|
+
break;
|
|
4436
|
+
case "login":
|
|
4437
|
+
await login();
|
|
4438
|
+
process.exit(0);
|
|
4439
|
+
break;
|
|
4440
|
+
case "status":
|
|
4441
|
+
await status();
|
|
4442
|
+
break;
|
|
4443
|
+
case "sync":
|
|
4444
|
+
await sync();
|
|
4445
|
+
break;
|
|
4446
|
+
case "_hook-stop":
|
|
4447
|
+
await hookStop();
|
|
4448
|
+
break;
|
|
4449
|
+
default:
|
|
4450
|
+
console.error(`Unknown command: ${command}`);
|
|
4451
|
+
console.log(HELP.trim());
|
|
4452
|
+
process.exit(1);
|
|
4453
|
+
}
|
|
4454
|
+
}
|
|
4455
|
+
main().catch((err) => {
|
|
4456
|
+
console.error(err.message || err);
|
|
4457
|
+
process.exit(1);
|
|
4458
|
+
});
|
|
4459
|
+
/*! Bundled license information:
|
|
4460
|
+
|
|
4461
|
+
@noble/hashes/utils.js:
|
|
4462
|
+
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
4463
|
+
*/
|