@basestream/cli 0.2.2 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +151 -3834
- package/package.json +1 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,42 +1,13 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var __create = Object.create;
|
|
3
2
|
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
3
|
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
4
|
var __esm = (fn, res) => function __init() {
|
|
15
5
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
16
6
|
};
|
|
17
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
18
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
19
|
-
};
|
|
20
7
|
var __export = (target, all) => {
|
|
21
8
|
for (var name in all)
|
|
22
9
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
23
10
|
};
|
|
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
11
|
|
|
41
12
|
// src/cli/config.ts
|
|
42
13
|
import fs from "node:fs";
|
|
@@ -99,649 +70,6 @@ var init_util = __esm({
|
|
|
99
70
|
}
|
|
100
71
|
});
|
|
101
72
|
|
|
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
73
|
// src/cli/commands/sync.ts
|
|
746
74
|
var sync_exports = {};
|
|
747
75
|
__export(sync_exports, {
|
|
@@ -891,3185 +219,179 @@ async function login() {
|
|
|
891
219
|
apiKey: key,
|
|
892
220
|
baseUrl,
|
|
893
221
|
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 CLAUDE_MD_PATH = path2.join(CLAUDE_DIR, "CLAUDE.md");
|
|
925
|
-
var CLAUDE_MD_MARKER = "<!-- basestream -->";
|
|
926
|
-
var CLAUDE_MD_RULE = `${CLAUDE_MD_MARKER}
|
|
927
|
-
- Before starting any non-trivial task, if the reason or context behind the work isn't already clear, ask: "What's the context for this?" Skip this for small tasks, typo fixes, or anything self-explanatory.
|
|
928
|
-
- After completing any meaningful work (fixing a bug, implementing a feature, making a significant change), invoke /bs-summarize to keep the session summary up to date. Include the "why" if it was provided.
|
|
929
|
-
<!-- /basestream -->`;
|
|
930
|
-
var HOOK_COMMAND = "npx @basestream/cli _hook-stop";
|
|
931
|
-
var HOOK_MARKER = "_hook-stop";
|
|
932
|
-
var SKILL_CONTENT = `---
|
|
933
|
-
name: bs-summarize
|
|
934
|
-
description: Update the Basestream session summary with what's been accomplished so far
|
|
935
|
-
---
|
|
936
|
-
|
|
937
|
-
First, read the existing summary file at \`~/.basestream/sessions/\${CLAUDE_SESSION_ID}-summary.md\` if it exists \u2014 this is the running record of work done so far this session.
|
|
938
|
-
|
|
939
|
-
Then write an updated summary that aggregates the previous summary with everything that has happened since. Focus on:
|
|
940
|
-
- Why the work was done (if context was provided \u2014 skip if not known)
|
|
941
|
-
- What was built, fixed, or changed (be specific about features/bugs)
|
|
942
|
-
- Which parts of the codebase were touched
|
|
943
|
-
- Any key decisions made
|
|
944
|
-
|
|
945
|
-
Do not just append \u2014 synthesize everything into a single cohesive summary. Merge related work together, avoid repeating the same point twice, and drop anything superseded by later changes. Be concise \u2014 let the scope of the work determine the length. A small fix deserves one sentence; a large multi-part session can be a short paragraph. Plain prose, no bullet points.
|
|
946
|
-
|
|
947
|
-
Write the result to \`~/.basestream/sessions/\${CLAUDE_SESSION_ID}-summary.md\`, overwriting the file.
|
|
948
|
-
`;
|
|
949
|
-
function injectClaudeMdRule() {
|
|
950
|
-
let existing = "";
|
|
951
|
-
if (fs2.existsSync(CLAUDE_MD_PATH)) {
|
|
952
|
-
existing = fs2.readFileSync(CLAUDE_MD_PATH, "utf-8");
|
|
953
|
-
}
|
|
954
|
-
let updated;
|
|
955
|
-
if (existing.includes(CLAUDE_MD_MARKER)) {
|
|
956
|
-
updated = existing.replace(/<!-- basestream -->[\s\S]*?<!-- \/basestream -->/, CLAUDE_MD_RULE);
|
|
957
|
-
fs2.writeFileSync(CLAUDE_MD_PATH, updated);
|
|
958
|
-
check("Updated Basestream rules in ~/.claude/CLAUDE.md");
|
|
959
|
-
} else {
|
|
960
|
-
updated = existing ? `${existing.trimEnd()}
|
|
961
|
-
|
|
962
|
-
${CLAUDE_MD_RULE}
|
|
963
|
-
` : `${CLAUDE_MD_RULE}
|
|
964
|
-
`;
|
|
965
|
-
fs2.mkdirSync(CLAUDE_DIR, { recursive: true });
|
|
966
|
-
fs2.writeFileSync(CLAUDE_MD_PATH, updated);
|
|
967
|
-
check("Injected Basestream rules into ~/.claude/CLAUDE.md");
|
|
968
|
-
}
|
|
969
|
-
}
|
|
970
|
-
function installSkill() {
|
|
971
|
-
const skillsDir = path2.dirname(CLAUDE_SKILLS_PATH);
|
|
972
|
-
fs2.mkdirSync(skillsDir, { recursive: true });
|
|
973
|
-
if (fs2.existsSync(CLAUDE_SKILLS_PATH)) {
|
|
974
|
-
fs2.writeFileSync(CLAUDE_SKILLS_PATH, SKILL_CONTENT);
|
|
975
|
-
check("Updated /bs-summarize skill");
|
|
976
|
-
return;
|
|
977
|
-
}
|
|
978
|
-
fs2.writeFileSync(CLAUDE_SKILLS_PATH, SKILL_CONTENT);
|
|
979
|
-
check("Installed /bs-summarize skill into ~/.claude/skills/");
|
|
980
|
-
}
|
|
981
|
-
function detectClaudeCode() {
|
|
982
|
-
try {
|
|
983
|
-
const version2 = execSync2("claude --version 2>/dev/null", {
|
|
984
|
-
encoding: "utf-8"
|
|
985
|
-
}).trim();
|
|
986
|
-
return version2 || null;
|
|
987
|
-
} catch {
|
|
988
|
-
return null;
|
|
989
|
-
}
|
|
990
|
-
}
|
|
991
|
-
function injectClaudeCodeHook() {
|
|
992
|
-
const settingsDir = path2.dirname(CLAUDE_SETTINGS_PATH);
|
|
993
|
-
fs2.mkdirSync(settingsDir, { recursive: true });
|
|
994
|
-
let settings = {};
|
|
995
|
-
if (fs2.existsSync(CLAUDE_SETTINGS_PATH)) {
|
|
996
|
-
try {
|
|
997
|
-
settings = JSON.parse(fs2.readFileSync(CLAUDE_SETTINGS_PATH, "utf-8"));
|
|
998
|
-
} catch {
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
if (!settings.hooks || typeof settings.hooks !== "object") {
|
|
1002
|
-
settings.hooks = {};
|
|
1003
|
-
}
|
|
1004
|
-
const hooks = settings.hooks;
|
|
1005
|
-
if (Array.isArray(hooks.Stop)) {
|
|
1006
|
-
const existing = hooks.Stop;
|
|
1007
|
-
const alreadyInstalled = existing.some(
|
|
1008
|
-
(entry) => entry.hooks?.some((h) => h.command?.includes(HOOK_MARKER))
|
|
1009
|
-
);
|
|
1010
|
-
if (alreadyInstalled) {
|
|
1011
|
-
check("Claude Code hook already installed");
|
|
1012
|
-
return;
|
|
1013
|
-
}
|
|
1014
|
-
}
|
|
1015
|
-
if (!Array.isArray(hooks.Stop)) {
|
|
1016
|
-
hooks.Stop = [];
|
|
1017
|
-
}
|
|
1018
|
-
hooks.Stop.push({
|
|
1019
|
-
matcher: "*",
|
|
1020
|
-
hooks: [
|
|
1021
|
-
{
|
|
1022
|
-
type: "command",
|
|
1023
|
-
command: HOOK_COMMAND,
|
|
1024
|
-
timeout: 30
|
|
1025
|
-
}
|
|
1026
|
-
]
|
|
1027
|
-
});
|
|
1028
|
-
fs2.writeFileSync(CLAUDE_SETTINGS_PATH, JSON.stringify(settings, null, 2));
|
|
1029
|
-
check("Injected tracking hook into ~/.claude/settings.json");
|
|
1030
|
-
}
|
|
1031
|
-
async function init() {
|
|
1032
|
-
console.log();
|
|
1033
|
-
const ccVersion = detectClaudeCode();
|
|
1034
|
-
if (ccVersion) {
|
|
1035
|
-
console.log(` ${c.dim(`Detected: Claude Code ${ccVersion}`)}`);
|
|
1036
|
-
} else {
|
|
1037
|
-
warn("Claude Code not detected \u2014 hook will activate when installed");
|
|
1038
|
-
}
|
|
1039
|
-
console.log();
|
|
1040
|
-
injectClaudeCodeHook();
|
|
1041
|
-
installSkill();
|
|
1042
|
-
injectClaudeMdRule();
|
|
1043
|
-
ensureDirs();
|
|
1044
|
-
check(`Created ~/.basestream/buffer/`);
|
|
1045
|
-
console.log();
|
|
1046
|
-
await login();
|
|
1047
|
-
console.log();
|
|
1048
|
-
console.log(
|
|
1049
|
-
` ${c.dim("That's it. Work normally \u2014 every session is now tracked.")}`
|
|
1050
|
-
);
|
|
1051
|
-
console.log();
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
// src/cli/commands/status.ts
|
|
1055
|
-
init_config();
|
|
1056
|
-
import fs3 from "node:fs";
|
|
1057
|
-
import path3 from "node:path";
|
|
1058
|
-
|
|
1059
|
-
// ../../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
|
|
1060
|
-
var entityKind = Symbol.for("drizzle:entityKind");
|
|
1061
|
-
var hasOwnEntityKind = Symbol.for("drizzle:hasOwnEntityKind");
|
|
1062
|
-
function is(value, type) {
|
|
1063
|
-
if (!value || typeof value !== "object") {
|
|
1064
|
-
return false;
|
|
1065
|
-
}
|
|
1066
|
-
if (value instanceof type) {
|
|
1067
|
-
return true;
|
|
1068
|
-
}
|
|
1069
|
-
if (!Object.prototype.hasOwnProperty.call(type, entityKind)) {
|
|
1070
|
-
throw new Error(
|
|
1071
|
-
`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.`
|
|
1072
|
-
);
|
|
1073
|
-
}
|
|
1074
|
-
let cls = Object.getPrototypeOf(value).constructor;
|
|
1075
|
-
if (cls) {
|
|
1076
|
-
while (cls) {
|
|
1077
|
-
if (entityKind in cls && cls[entityKind] === type[entityKind]) {
|
|
1078
|
-
return true;
|
|
1079
|
-
}
|
|
1080
|
-
cls = Object.getPrototypeOf(cls);
|
|
1081
|
-
}
|
|
1082
|
-
}
|
|
1083
|
-
return false;
|
|
1084
|
-
}
|
|
1085
|
-
|
|
1086
|
-
// ../../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
|
|
1087
|
-
var Column = class {
|
|
1088
|
-
constructor(table, config) {
|
|
1089
|
-
this.table = table;
|
|
1090
|
-
this.config = config;
|
|
1091
|
-
this.name = config.name;
|
|
1092
|
-
this.keyAsName = config.keyAsName;
|
|
1093
|
-
this.notNull = config.notNull;
|
|
1094
|
-
this.default = config.default;
|
|
1095
|
-
this.defaultFn = config.defaultFn;
|
|
1096
|
-
this.onUpdateFn = config.onUpdateFn;
|
|
1097
|
-
this.hasDefault = config.hasDefault;
|
|
1098
|
-
this.primary = config.primaryKey;
|
|
1099
|
-
this.isUnique = config.isUnique;
|
|
1100
|
-
this.uniqueName = config.uniqueName;
|
|
1101
|
-
this.uniqueType = config.uniqueType;
|
|
1102
|
-
this.dataType = config.dataType;
|
|
1103
|
-
this.columnType = config.columnType;
|
|
1104
|
-
this.generated = config.generated;
|
|
1105
|
-
this.generatedIdentity = config.generatedIdentity;
|
|
1106
|
-
}
|
|
1107
|
-
static [entityKind] = "Column";
|
|
1108
|
-
name;
|
|
1109
|
-
keyAsName;
|
|
1110
|
-
primary;
|
|
1111
|
-
notNull;
|
|
1112
|
-
default;
|
|
1113
|
-
defaultFn;
|
|
1114
|
-
onUpdateFn;
|
|
1115
|
-
hasDefault;
|
|
1116
|
-
isUnique;
|
|
1117
|
-
uniqueName;
|
|
1118
|
-
uniqueType;
|
|
1119
|
-
dataType;
|
|
1120
|
-
columnType;
|
|
1121
|
-
enumValues = void 0;
|
|
1122
|
-
generated = void 0;
|
|
1123
|
-
generatedIdentity = void 0;
|
|
1124
|
-
config;
|
|
1125
|
-
mapFromDriverValue(value) {
|
|
1126
|
-
return value;
|
|
1127
|
-
}
|
|
1128
|
-
mapToDriverValue(value) {
|
|
1129
|
-
return value;
|
|
1130
|
-
}
|
|
1131
|
-
// ** @internal */
|
|
1132
|
-
shouldDisableInsert() {
|
|
1133
|
-
return this.config.generated !== void 0 && this.config.generated.type !== "byDefault";
|
|
1134
|
-
}
|
|
1135
|
-
};
|
|
1136
|
-
|
|
1137
|
-
// ../../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
|
|
1138
|
-
var ColumnBuilder = class {
|
|
1139
|
-
static [entityKind] = "ColumnBuilder";
|
|
1140
|
-
config;
|
|
1141
|
-
constructor(name, dataType, columnType) {
|
|
1142
|
-
this.config = {
|
|
1143
|
-
name,
|
|
1144
|
-
keyAsName: name === "",
|
|
1145
|
-
notNull: false,
|
|
1146
|
-
default: void 0,
|
|
1147
|
-
hasDefault: false,
|
|
1148
|
-
primaryKey: false,
|
|
1149
|
-
isUnique: false,
|
|
1150
|
-
uniqueName: void 0,
|
|
1151
|
-
uniqueType: void 0,
|
|
1152
|
-
dataType,
|
|
1153
|
-
columnType,
|
|
1154
|
-
generated: void 0
|
|
1155
|
-
};
|
|
1156
|
-
}
|
|
1157
|
-
/**
|
|
1158
|
-
* Changes the data type of the column. Commonly used with `json` columns. Also, useful for branded types.
|
|
1159
|
-
*
|
|
1160
|
-
* @example
|
|
1161
|
-
* ```ts
|
|
1162
|
-
* const users = pgTable('users', {
|
|
1163
|
-
* id: integer('id').$type<UserId>().primaryKey(),
|
|
1164
|
-
* details: json('details').$type<UserDetails>().notNull(),
|
|
1165
|
-
* });
|
|
1166
|
-
* ```
|
|
1167
|
-
*/
|
|
1168
|
-
$type() {
|
|
1169
|
-
return this;
|
|
1170
|
-
}
|
|
1171
|
-
/**
|
|
1172
|
-
* Adds a `not null` clause to the column definition.
|
|
1173
|
-
*
|
|
1174
|
-
* Affects the `select` model of the table - columns *without* `not null` will be nullable on select.
|
|
1175
|
-
*/
|
|
1176
|
-
notNull() {
|
|
1177
|
-
this.config.notNull = true;
|
|
1178
|
-
return this;
|
|
1179
|
-
}
|
|
1180
|
-
/**
|
|
1181
|
-
* Adds a `default <value>` clause to the column definition.
|
|
1182
|
-
*
|
|
1183
|
-
* Affects the `insert` model of the table - columns *with* `default` are optional on insert.
|
|
1184
|
-
*
|
|
1185
|
-
* If you need to set a dynamic default value, use {@link $defaultFn} instead.
|
|
1186
|
-
*/
|
|
1187
|
-
default(value) {
|
|
1188
|
-
this.config.default = value;
|
|
1189
|
-
this.config.hasDefault = true;
|
|
1190
|
-
return this;
|
|
1191
|
-
}
|
|
1192
|
-
/**
|
|
1193
|
-
* Adds a dynamic default value to the column.
|
|
1194
|
-
* The function will be called when the row is inserted, and the returned value will be used as the column value.
|
|
1195
|
-
*
|
|
1196
|
-
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
|
|
1197
|
-
*/
|
|
1198
|
-
$defaultFn(fn) {
|
|
1199
|
-
this.config.defaultFn = fn;
|
|
1200
|
-
this.config.hasDefault = true;
|
|
1201
|
-
return this;
|
|
1202
|
-
}
|
|
1203
|
-
/**
|
|
1204
|
-
* Alias for {@link $defaultFn}.
|
|
1205
|
-
*/
|
|
1206
|
-
$default = this.$defaultFn;
|
|
1207
|
-
/**
|
|
1208
|
-
* Adds a dynamic update value to the column.
|
|
1209
|
-
* 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.
|
|
1210
|
-
* 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.
|
|
1211
|
-
*
|
|
1212
|
-
* **Note:** This value does not affect the `drizzle-kit` behavior, it is only used at runtime in `drizzle-orm`.
|
|
1213
|
-
*/
|
|
1214
|
-
$onUpdateFn(fn) {
|
|
1215
|
-
this.config.onUpdateFn = fn;
|
|
1216
|
-
this.config.hasDefault = true;
|
|
1217
|
-
return this;
|
|
1218
|
-
}
|
|
1219
|
-
/**
|
|
1220
|
-
* Alias for {@link $onUpdateFn}.
|
|
1221
|
-
*/
|
|
1222
|
-
$onUpdate = this.$onUpdateFn;
|
|
1223
|
-
/**
|
|
1224
|
-
* Adds a `primary key` clause to the column definition. This implicitly makes the column `not null`.
|
|
1225
|
-
*
|
|
1226
|
-
* In SQLite, `integer primary key` implicitly makes the column auto-incrementing.
|
|
1227
|
-
*/
|
|
1228
|
-
primaryKey() {
|
|
1229
|
-
this.config.primaryKey = true;
|
|
1230
|
-
this.config.notNull = true;
|
|
1231
|
-
return this;
|
|
1232
|
-
}
|
|
1233
|
-
/** @internal Sets the name of the column to the key within the table definition if a name was not given. */
|
|
1234
|
-
setName(name) {
|
|
1235
|
-
if (this.config.name !== "") return;
|
|
1236
|
-
this.config.name = name;
|
|
1237
|
-
}
|
|
1238
|
-
};
|
|
1239
|
-
|
|
1240
|
-
// ../../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
|
|
1241
|
-
var TableName = Symbol.for("drizzle:Name");
|
|
1242
|
-
|
|
1243
|
-
// ../../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
|
|
1244
|
-
var ForeignKeyBuilder = class {
|
|
1245
|
-
static [entityKind] = "PgForeignKeyBuilder";
|
|
1246
|
-
/** @internal */
|
|
1247
|
-
reference;
|
|
1248
|
-
/** @internal */
|
|
1249
|
-
_onUpdate = "no action";
|
|
1250
|
-
/** @internal */
|
|
1251
|
-
_onDelete = "no action";
|
|
1252
|
-
constructor(config, actions) {
|
|
1253
|
-
this.reference = () => {
|
|
1254
|
-
const { name, columns, foreignColumns } = config();
|
|
1255
|
-
return { name, columns, foreignTable: foreignColumns[0].table, foreignColumns };
|
|
1256
|
-
};
|
|
1257
|
-
if (actions) {
|
|
1258
|
-
this._onUpdate = actions.onUpdate;
|
|
1259
|
-
this._onDelete = actions.onDelete;
|
|
1260
|
-
}
|
|
1261
|
-
}
|
|
1262
|
-
onUpdate(action) {
|
|
1263
|
-
this._onUpdate = action === void 0 ? "no action" : action;
|
|
1264
|
-
return this;
|
|
1265
|
-
}
|
|
1266
|
-
onDelete(action) {
|
|
1267
|
-
this._onDelete = action === void 0 ? "no action" : action;
|
|
1268
|
-
return this;
|
|
1269
|
-
}
|
|
1270
|
-
/** @internal */
|
|
1271
|
-
build(table) {
|
|
1272
|
-
return new ForeignKey(table, this);
|
|
1273
|
-
}
|
|
1274
|
-
};
|
|
1275
|
-
var ForeignKey = class {
|
|
1276
|
-
constructor(table, builder) {
|
|
1277
|
-
this.table = table;
|
|
1278
|
-
this.reference = builder.reference;
|
|
1279
|
-
this.onUpdate = builder._onUpdate;
|
|
1280
|
-
this.onDelete = builder._onDelete;
|
|
1281
|
-
}
|
|
1282
|
-
static [entityKind] = "PgForeignKey";
|
|
1283
|
-
reference;
|
|
1284
|
-
onUpdate;
|
|
1285
|
-
onDelete;
|
|
1286
|
-
getName() {
|
|
1287
|
-
const { name, columns, foreignColumns } = this.reference();
|
|
1288
|
-
const columnNames = columns.map((column) => column.name);
|
|
1289
|
-
const foreignColumnNames = foreignColumns.map((column) => column.name);
|
|
1290
|
-
const chunks = [
|
|
1291
|
-
this.table[TableName],
|
|
1292
|
-
...columnNames,
|
|
1293
|
-
foreignColumns[0].table[TableName],
|
|
1294
|
-
...foreignColumnNames
|
|
1295
|
-
];
|
|
1296
|
-
return name ?? `${chunks.join("_")}_fk`;
|
|
1297
|
-
}
|
|
1298
|
-
};
|
|
1299
|
-
|
|
1300
|
-
// ../../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
|
|
1301
|
-
function iife(fn, ...args) {
|
|
1302
|
-
return fn(...args);
|
|
1303
|
-
}
|
|
1304
|
-
|
|
1305
|
-
// ../../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
|
|
1306
|
-
function uniqueKeyName(table, columns) {
|
|
1307
|
-
return `${table[TableName]}_${columns.join("_")}_unique`;
|
|
1308
|
-
}
|
|
1309
|
-
var UniqueConstraintBuilder = class {
|
|
1310
|
-
constructor(columns, name) {
|
|
1311
|
-
this.name = name;
|
|
1312
|
-
this.columns = columns;
|
|
1313
|
-
}
|
|
1314
|
-
static [entityKind] = "PgUniqueConstraintBuilder";
|
|
1315
|
-
/** @internal */
|
|
1316
|
-
columns;
|
|
1317
|
-
/** @internal */
|
|
1318
|
-
nullsNotDistinctConfig = false;
|
|
1319
|
-
nullsNotDistinct() {
|
|
1320
|
-
this.nullsNotDistinctConfig = true;
|
|
1321
|
-
return this;
|
|
1322
|
-
}
|
|
1323
|
-
/** @internal */
|
|
1324
|
-
build(table) {
|
|
1325
|
-
return new UniqueConstraint(table, this.columns, this.nullsNotDistinctConfig, this.name);
|
|
1326
|
-
}
|
|
1327
|
-
};
|
|
1328
|
-
var UniqueOnConstraintBuilder = class {
|
|
1329
|
-
static [entityKind] = "PgUniqueOnConstraintBuilder";
|
|
1330
|
-
/** @internal */
|
|
1331
|
-
name;
|
|
1332
|
-
constructor(name) {
|
|
1333
|
-
this.name = name;
|
|
1334
|
-
}
|
|
1335
|
-
on(...columns) {
|
|
1336
|
-
return new UniqueConstraintBuilder(columns, this.name);
|
|
1337
|
-
}
|
|
1338
|
-
};
|
|
1339
|
-
var UniqueConstraint = class {
|
|
1340
|
-
constructor(table, columns, nullsNotDistinct, name) {
|
|
1341
|
-
this.table = table;
|
|
1342
|
-
this.columns = columns;
|
|
1343
|
-
this.name = name ?? uniqueKeyName(this.table, this.columns.map((column) => column.name));
|
|
1344
|
-
this.nullsNotDistinct = nullsNotDistinct;
|
|
1345
|
-
}
|
|
1346
|
-
static [entityKind] = "PgUniqueConstraint";
|
|
1347
|
-
columns;
|
|
1348
|
-
name;
|
|
1349
|
-
nullsNotDistinct = false;
|
|
1350
|
-
getName() {
|
|
1351
|
-
return this.name;
|
|
1352
|
-
}
|
|
1353
|
-
};
|
|
1354
|
-
|
|
1355
|
-
// ../../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
|
|
1356
|
-
function parsePgArrayValue(arrayString, startFrom, inQuotes) {
|
|
1357
|
-
for (let i = startFrom; i < arrayString.length; i++) {
|
|
1358
|
-
const char2 = arrayString[i];
|
|
1359
|
-
if (char2 === "\\") {
|
|
1360
|
-
i++;
|
|
1361
|
-
continue;
|
|
1362
|
-
}
|
|
1363
|
-
if (char2 === '"') {
|
|
1364
|
-
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i + 1];
|
|
1365
|
-
}
|
|
1366
|
-
if (inQuotes) {
|
|
1367
|
-
continue;
|
|
1368
|
-
}
|
|
1369
|
-
if (char2 === "," || char2 === "}") {
|
|
1370
|
-
return [arrayString.slice(startFrom, i).replace(/\\/g, ""), i];
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
return [arrayString.slice(startFrom).replace(/\\/g, ""), arrayString.length];
|
|
1374
|
-
}
|
|
1375
|
-
function parsePgNestedArray(arrayString, startFrom = 0) {
|
|
1376
|
-
const result = [];
|
|
1377
|
-
let i = startFrom;
|
|
1378
|
-
let lastCharIsComma = false;
|
|
1379
|
-
while (i < arrayString.length) {
|
|
1380
|
-
const char2 = arrayString[i];
|
|
1381
|
-
if (char2 === ",") {
|
|
1382
|
-
if (lastCharIsComma || i === startFrom) {
|
|
1383
|
-
result.push("");
|
|
1384
|
-
}
|
|
1385
|
-
lastCharIsComma = true;
|
|
1386
|
-
i++;
|
|
1387
|
-
continue;
|
|
1388
|
-
}
|
|
1389
|
-
lastCharIsComma = false;
|
|
1390
|
-
if (char2 === "\\") {
|
|
1391
|
-
i += 2;
|
|
1392
|
-
continue;
|
|
1393
|
-
}
|
|
1394
|
-
if (char2 === '"') {
|
|
1395
|
-
const [value2, startFrom2] = parsePgArrayValue(arrayString, i + 1, true);
|
|
1396
|
-
result.push(value2);
|
|
1397
|
-
i = startFrom2;
|
|
1398
|
-
continue;
|
|
1399
|
-
}
|
|
1400
|
-
if (char2 === "}") {
|
|
1401
|
-
return [result, i + 1];
|
|
1402
|
-
}
|
|
1403
|
-
if (char2 === "{") {
|
|
1404
|
-
const [value2, startFrom2] = parsePgNestedArray(arrayString, i + 1);
|
|
1405
|
-
result.push(value2);
|
|
1406
|
-
i = startFrom2;
|
|
1407
|
-
continue;
|
|
1408
|
-
}
|
|
1409
|
-
const [value, newStartFrom] = parsePgArrayValue(arrayString, i, false);
|
|
1410
|
-
result.push(value);
|
|
1411
|
-
i = newStartFrom;
|
|
1412
|
-
}
|
|
1413
|
-
return [result, i];
|
|
1414
|
-
}
|
|
1415
|
-
function parsePgArray(arrayString) {
|
|
1416
|
-
const [result] = parsePgNestedArray(arrayString, 1);
|
|
1417
|
-
return result;
|
|
1418
|
-
}
|
|
1419
|
-
function makePgArray(array) {
|
|
1420
|
-
return `{${array.map((item) => {
|
|
1421
|
-
if (Array.isArray(item)) {
|
|
1422
|
-
return makePgArray(item);
|
|
1423
|
-
}
|
|
1424
|
-
if (typeof item === "string") {
|
|
1425
|
-
return `"${item.replace(/\\/g, "\\\\").replace(/"/g, '\\"')}"`;
|
|
1426
|
-
}
|
|
1427
|
-
return `${item}`;
|
|
1428
|
-
}).join(",")}}`;
|
|
1429
|
-
}
|
|
1430
|
-
|
|
1431
|
-
// ../../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
|
|
1432
|
-
var PgColumnBuilder = class extends ColumnBuilder {
|
|
1433
|
-
foreignKeyConfigs = [];
|
|
1434
|
-
static [entityKind] = "PgColumnBuilder";
|
|
1435
|
-
array(size) {
|
|
1436
|
-
return new PgArrayBuilder(this.config.name, this, size);
|
|
1437
|
-
}
|
|
1438
|
-
references(ref, actions = {}) {
|
|
1439
|
-
this.foreignKeyConfigs.push({ ref, actions });
|
|
1440
|
-
return this;
|
|
1441
|
-
}
|
|
1442
|
-
unique(name, config) {
|
|
1443
|
-
this.config.isUnique = true;
|
|
1444
|
-
this.config.uniqueName = name;
|
|
1445
|
-
this.config.uniqueType = config?.nulls;
|
|
1446
|
-
return this;
|
|
1447
|
-
}
|
|
1448
|
-
generatedAlwaysAs(as) {
|
|
1449
|
-
this.config.generated = {
|
|
1450
|
-
as,
|
|
1451
|
-
type: "always",
|
|
1452
|
-
mode: "stored"
|
|
1453
|
-
};
|
|
1454
|
-
return this;
|
|
1455
|
-
}
|
|
1456
|
-
/** @internal */
|
|
1457
|
-
buildForeignKeys(column, table) {
|
|
1458
|
-
return this.foreignKeyConfigs.map(({ ref, actions }) => {
|
|
1459
|
-
return iife(
|
|
1460
|
-
(ref2, actions2) => {
|
|
1461
|
-
const builder = new ForeignKeyBuilder(() => {
|
|
1462
|
-
const foreignColumn = ref2();
|
|
1463
|
-
return { columns: [column], foreignColumns: [foreignColumn] };
|
|
1464
|
-
});
|
|
1465
|
-
if (actions2.onUpdate) {
|
|
1466
|
-
builder.onUpdate(actions2.onUpdate);
|
|
1467
|
-
}
|
|
1468
|
-
if (actions2.onDelete) {
|
|
1469
|
-
builder.onDelete(actions2.onDelete);
|
|
1470
|
-
}
|
|
1471
|
-
return builder.build(table);
|
|
1472
|
-
},
|
|
1473
|
-
ref,
|
|
1474
|
-
actions
|
|
1475
|
-
);
|
|
1476
|
-
});
|
|
1477
|
-
}
|
|
1478
|
-
/** @internal */
|
|
1479
|
-
buildExtraConfigColumn(table) {
|
|
1480
|
-
return new ExtraConfigColumn(table, this.config);
|
|
1481
|
-
}
|
|
1482
|
-
};
|
|
1483
|
-
var PgColumn = class extends Column {
|
|
1484
|
-
constructor(table, config) {
|
|
1485
|
-
if (!config.uniqueName) {
|
|
1486
|
-
config.uniqueName = uniqueKeyName(table, [config.name]);
|
|
1487
|
-
}
|
|
1488
|
-
super(table, config);
|
|
1489
|
-
this.table = table;
|
|
1490
|
-
}
|
|
1491
|
-
static [entityKind] = "PgColumn";
|
|
1492
|
-
};
|
|
1493
|
-
var ExtraConfigColumn = class extends PgColumn {
|
|
1494
|
-
static [entityKind] = "ExtraConfigColumn";
|
|
1495
|
-
getSQLType() {
|
|
1496
|
-
return this.getSQLType();
|
|
1497
|
-
}
|
|
1498
|
-
indexConfig = {
|
|
1499
|
-
order: this.config.order ?? "asc",
|
|
1500
|
-
nulls: this.config.nulls ?? "last",
|
|
1501
|
-
opClass: this.config.opClass
|
|
1502
|
-
};
|
|
1503
|
-
defaultConfig = {
|
|
1504
|
-
order: "asc",
|
|
1505
|
-
nulls: "last",
|
|
1506
|
-
opClass: void 0
|
|
1507
|
-
};
|
|
1508
|
-
asc() {
|
|
1509
|
-
this.indexConfig.order = "asc";
|
|
1510
|
-
return this;
|
|
1511
|
-
}
|
|
1512
|
-
desc() {
|
|
1513
|
-
this.indexConfig.order = "desc";
|
|
1514
|
-
return this;
|
|
1515
|
-
}
|
|
1516
|
-
nullsFirst() {
|
|
1517
|
-
this.indexConfig.nulls = "first";
|
|
1518
|
-
return this;
|
|
1519
|
-
}
|
|
1520
|
-
nullsLast() {
|
|
1521
|
-
this.indexConfig.nulls = "last";
|
|
1522
|
-
return this;
|
|
1523
|
-
}
|
|
1524
|
-
/**
|
|
1525
|
-
* ### PostgreSQL documentation quote
|
|
1526
|
-
*
|
|
1527
|
-
* > An operator class with optional parameters can be specified for each column of an index.
|
|
1528
|
-
* The operator class identifies the operators to be used by the index for that column.
|
|
1529
|
-
* For example, a B-tree index on four-byte integers would use the int4_ops class;
|
|
1530
|
-
* this operator class includes comparison functions for four-byte integers.
|
|
1531
|
-
* In practice the default operator class for the column's data type is usually sufficient.
|
|
1532
|
-
* The main point of having operator classes is that for some data types, there could be more than one meaningful ordering.
|
|
1533
|
-
* For example, we might want to sort a complex-number data type either by absolute value or by real part.
|
|
1534
|
-
* We could do this by defining two operator classes for the data type and then selecting the proper class when creating an index.
|
|
1535
|
-
* More information about operator classes check:
|
|
1536
|
-
*
|
|
1537
|
-
* ### Useful links
|
|
1538
|
-
* https://www.postgresql.org/docs/current/sql-createindex.html
|
|
1539
|
-
*
|
|
1540
|
-
* https://www.postgresql.org/docs/current/indexes-opclass.html
|
|
1541
|
-
*
|
|
1542
|
-
* https://www.postgresql.org/docs/current/xindex.html
|
|
1543
|
-
*
|
|
1544
|
-
* ### Additional types
|
|
1545
|
-
* If you have the `pg_vector` extension installed in your database, you can use the
|
|
1546
|
-
* `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.
|
|
1547
|
-
*
|
|
1548
|
-
* **You can always specify any string you want in the operator class, in case Drizzle doesn't have it natively in its types**
|
|
1549
|
-
*
|
|
1550
|
-
* @param opClass
|
|
1551
|
-
* @returns
|
|
1552
|
-
*/
|
|
1553
|
-
op(opClass) {
|
|
1554
|
-
this.indexConfig.opClass = opClass;
|
|
1555
|
-
return this;
|
|
1556
|
-
}
|
|
1557
|
-
};
|
|
1558
|
-
var IndexedColumn = class {
|
|
1559
|
-
static [entityKind] = "IndexedColumn";
|
|
1560
|
-
constructor(name, keyAsName, type, indexConfig) {
|
|
1561
|
-
this.name = name;
|
|
1562
|
-
this.keyAsName = keyAsName;
|
|
1563
|
-
this.type = type;
|
|
1564
|
-
this.indexConfig = indexConfig;
|
|
1565
|
-
}
|
|
1566
|
-
name;
|
|
1567
|
-
keyAsName;
|
|
1568
|
-
type;
|
|
1569
|
-
indexConfig;
|
|
1570
|
-
};
|
|
1571
|
-
var PgArrayBuilder = class extends PgColumnBuilder {
|
|
1572
|
-
static [entityKind] = "PgArrayBuilder";
|
|
1573
|
-
constructor(name, baseBuilder, size) {
|
|
1574
|
-
super(name, "array", "PgArray");
|
|
1575
|
-
this.config.baseBuilder = baseBuilder;
|
|
1576
|
-
this.config.size = size;
|
|
1577
|
-
}
|
|
1578
|
-
/** @internal */
|
|
1579
|
-
build(table) {
|
|
1580
|
-
const baseColumn = this.config.baseBuilder.build(table);
|
|
1581
|
-
return new PgArray(
|
|
1582
|
-
table,
|
|
1583
|
-
this.config,
|
|
1584
|
-
baseColumn
|
|
1585
|
-
);
|
|
1586
|
-
}
|
|
1587
|
-
};
|
|
1588
|
-
var PgArray = class _PgArray extends PgColumn {
|
|
1589
|
-
constructor(table, config, baseColumn, range) {
|
|
1590
|
-
super(table, config);
|
|
1591
|
-
this.baseColumn = baseColumn;
|
|
1592
|
-
this.range = range;
|
|
1593
|
-
this.size = config.size;
|
|
1594
|
-
}
|
|
1595
|
-
size;
|
|
1596
|
-
static [entityKind] = "PgArray";
|
|
1597
|
-
getSQLType() {
|
|
1598
|
-
return `${this.baseColumn.getSQLType()}[${typeof this.size === "number" ? this.size : ""}]`;
|
|
1599
|
-
}
|
|
1600
|
-
mapFromDriverValue(value) {
|
|
1601
|
-
if (typeof value === "string") {
|
|
1602
|
-
value = parsePgArray(value);
|
|
1603
|
-
}
|
|
1604
|
-
return value.map((v) => this.baseColumn.mapFromDriverValue(v));
|
|
1605
|
-
}
|
|
1606
|
-
mapToDriverValue(value, isNestedArray = false) {
|
|
1607
|
-
const a = value.map(
|
|
1608
|
-
(v) => v === null ? null : is(this.baseColumn, _PgArray) ? this.baseColumn.mapToDriverValue(v, true) : this.baseColumn.mapToDriverValue(v)
|
|
1609
|
-
);
|
|
1610
|
-
if (isNestedArray) return a;
|
|
1611
|
-
return makePgArray(a);
|
|
1612
|
-
}
|
|
1613
|
-
};
|
|
1614
|
-
|
|
1615
|
-
// ../../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
|
|
1616
|
-
var PgEnumObjectColumnBuilder = class extends PgColumnBuilder {
|
|
1617
|
-
static [entityKind] = "PgEnumObjectColumnBuilder";
|
|
1618
|
-
constructor(name, enumInstance) {
|
|
1619
|
-
super(name, "string", "PgEnumObjectColumn");
|
|
1620
|
-
this.config.enum = enumInstance;
|
|
1621
|
-
}
|
|
1622
|
-
/** @internal */
|
|
1623
|
-
build(table) {
|
|
1624
|
-
return new PgEnumObjectColumn(
|
|
1625
|
-
table,
|
|
1626
|
-
this.config
|
|
1627
|
-
);
|
|
1628
|
-
}
|
|
1629
|
-
};
|
|
1630
|
-
var PgEnumObjectColumn = class extends PgColumn {
|
|
1631
|
-
static [entityKind] = "PgEnumObjectColumn";
|
|
1632
|
-
enum;
|
|
1633
|
-
enumValues = this.config.enum.enumValues;
|
|
1634
|
-
constructor(table, config) {
|
|
1635
|
-
super(table, config);
|
|
1636
|
-
this.enum = config.enum;
|
|
1637
|
-
}
|
|
1638
|
-
getSQLType() {
|
|
1639
|
-
return this.enum.enumName;
|
|
1640
|
-
}
|
|
1641
|
-
};
|
|
1642
|
-
var isPgEnumSym = Symbol.for("drizzle:isPgEnum");
|
|
1643
|
-
function isPgEnum(obj) {
|
|
1644
|
-
return !!obj && typeof obj === "function" && isPgEnumSym in obj && obj[isPgEnumSym] === true;
|
|
1645
|
-
}
|
|
1646
|
-
var PgEnumColumnBuilder = class extends PgColumnBuilder {
|
|
1647
|
-
static [entityKind] = "PgEnumColumnBuilder";
|
|
1648
|
-
constructor(name, enumInstance) {
|
|
1649
|
-
super(name, "string", "PgEnumColumn");
|
|
1650
|
-
this.config.enum = enumInstance;
|
|
1651
|
-
}
|
|
1652
|
-
/** @internal */
|
|
1653
|
-
build(table) {
|
|
1654
|
-
return new PgEnumColumn(
|
|
1655
|
-
table,
|
|
1656
|
-
this.config
|
|
1657
|
-
);
|
|
1658
|
-
}
|
|
1659
|
-
};
|
|
1660
|
-
var PgEnumColumn = class extends PgColumn {
|
|
1661
|
-
static [entityKind] = "PgEnumColumn";
|
|
1662
|
-
enum = this.config.enum;
|
|
1663
|
-
enumValues = this.config.enum.enumValues;
|
|
1664
|
-
constructor(table, config) {
|
|
1665
|
-
super(table, config);
|
|
1666
|
-
this.enum = config.enum;
|
|
1667
|
-
}
|
|
1668
|
-
getSQLType() {
|
|
1669
|
-
return this.enum.enumName;
|
|
1670
|
-
}
|
|
1671
|
-
};
|
|
1672
|
-
function pgEnum(enumName, input) {
|
|
1673
|
-
return Array.isArray(input) ? pgEnumWithSchema(enumName, [...input], void 0) : pgEnumObjectWithSchema(enumName, input, void 0);
|
|
1674
|
-
}
|
|
1675
|
-
function pgEnumWithSchema(enumName, values, schema) {
|
|
1676
|
-
const enumInstance = Object.assign(
|
|
1677
|
-
(name) => new PgEnumColumnBuilder(name ?? "", enumInstance),
|
|
1678
|
-
{
|
|
1679
|
-
enumName,
|
|
1680
|
-
enumValues: values,
|
|
1681
|
-
schema,
|
|
1682
|
-
[isPgEnumSym]: true
|
|
1683
|
-
}
|
|
1684
|
-
);
|
|
1685
|
-
return enumInstance;
|
|
1686
|
-
}
|
|
1687
|
-
function pgEnumObjectWithSchema(enumName, values, schema) {
|
|
1688
|
-
const enumInstance = Object.assign(
|
|
1689
|
-
(name) => new PgEnumObjectColumnBuilder(name ?? "", enumInstance),
|
|
1690
|
-
{
|
|
1691
|
-
enumName,
|
|
1692
|
-
enumValues: Object.values(values),
|
|
1693
|
-
schema,
|
|
1694
|
-
[isPgEnumSym]: true
|
|
1695
|
-
}
|
|
1696
|
-
);
|
|
1697
|
-
return enumInstance;
|
|
1698
|
-
}
|
|
1699
|
-
|
|
1700
|
-
// ../../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
|
|
1701
|
-
var Subquery = class {
|
|
1702
|
-
static [entityKind] = "Subquery";
|
|
1703
|
-
constructor(sql2, fields, alias, isWith = false, usedTables = []) {
|
|
1704
|
-
this._ = {
|
|
1705
|
-
brand: "Subquery",
|
|
1706
|
-
sql: sql2,
|
|
1707
|
-
selectedFields: fields,
|
|
1708
|
-
alias,
|
|
1709
|
-
isWith,
|
|
1710
|
-
usedTables
|
|
1711
|
-
};
|
|
1712
|
-
}
|
|
1713
|
-
// getSQL(): SQL<unknown> {
|
|
1714
|
-
// return new SQL([this]);
|
|
1715
|
-
// }
|
|
1716
|
-
};
|
|
1717
|
-
var WithSubquery = class extends Subquery {
|
|
1718
|
-
static [entityKind] = "WithSubquery";
|
|
1719
|
-
};
|
|
1720
|
-
|
|
1721
|
-
// ../../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
|
|
1722
|
-
var version = "0.45.2";
|
|
1723
|
-
|
|
1724
|
-
// ../../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
|
|
1725
|
-
var otel;
|
|
1726
|
-
var rawTracer;
|
|
1727
|
-
var tracer = {
|
|
1728
|
-
startActiveSpan(name, fn) {
|
|
1729
|
-
if (!otel) {
|
|
1730
|
-
return fn();
|
|
1731
|
-
}
|
|
1732
|
-
if (!rawTracer) {
|
|
1733
|
-
rawTracer = otel.trace.getTracer("drizzle-orm", version);
|
|
1734
|
-
}
|
|
1735
|
-
return iife(
|
|
1736
|
-
(otel2, rawTracer2) => rawTracer2.startActiveSpan(
|
|
1737
|
-
name,
|
|
1738
|
-
(span) => {
|
|
1739
|
-
try {
|
|
1740
|
-
return fn(span);
|
|
1741
|
-
} catch (e) {
|
|
1742
|
-
span.setStatus({
|
|
1743
|
-
code: otel2.SpanStatusCode.ERROR,
|
|
1744
|
-
message: e instanceof Error ? e.message : "Unknown error"
|
|
1745
|
-
// eslint-disable-line no-instanceof/no-instanceof
|
|
1746
|
-
});
|
|
1747
|
-
throw e;
|
|
1748
|
-
} finally {
|
|
1749
|
-
span.end();
|
|
1750
|
-
}
|
|
1751
|
-
}
|
|
1752
|
-
),
|
|
1753
|
-
otel,
|
|
1754
|
-
rawTracer
|
|
1755
|
-
);
|
|
1756
|
-
}
|
|
1757
|
-
};
|
|
1758
|
-
|
|
1759
|
-
// ../../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
|
|
1760
|
-
var ViewBaseConfig = Symbol.for("drizzle:ViewBaseConfig");
|
|
1761
|
-
|
|
1762
|
-
// ../../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
|
|
1763
|
-
var Schema = Symbol.for("drizzle:Schema");
|
|
1764
|
-
var Columns = Symbol.for("drizzle:Columns");
|
|
1765
|
-
var ExtraConfigColumns = Symbol.for("drizzle:ExtraConfigColumns");
|
|
1766
|
-
var OriginalName = Symbol.for("drizzle:OriginalName");
|
|
1767
|
-
var BaseName = Symbol.for("drizzle:BaseName");
|
|
1768
|
-
var IsAlias = Symbol.for("drizzle:IsAlias");
|
|
1769
|
-
var ExtraConfigBuilder = Symbol.for("drizzle:ExtraConfigBuilder");
|
|
1770
|
-
var IsDrizzleTable = Symbol.for("drizzle:IsDrizzleTable");
|
|
1771
|
-
var Table = class {
|
|
1772
|
-
static [entityKind] = "Table";
|
|
1773
|
-
/** @internal */
|
|
1774
|
-
static Symbol = {
|
|
1775
|
-
Name: TableName,
|
|
1776
|
-
Schema,
|
|
1777
|
-
OriginalName,
|
|
1778
|
-
Columns,
|
|
1779
|
-
ExtraConfigColumns,
|
|
1780
|
-
BaseName,
|
|
1781
|
-
IsAlias,
|
|
1782
|
-
ExtraConfigBuilder
|
|
1783
|
-
};
|
|
1784
|
-
/**
|
|
1785
|
-
* @internal
|
|
1786
|
-
* Can be changed if the table is aliased.
|
|
1787
|
-
*/
|
|
1788
|
-
[TableName];
|
|
1789
|
-
/**
|
|
1790
|
-
* @internal
|
|
1791
|
-
* Used to store the original name of the table, before any aliasing.
|
|
1792
|
-
*/
|
|
1793
|
-
[OriginalName];
|
|
1794
|
-
/** @internal */
|
|
1795
|
-
[Schema];
|
|
1796
|
-
/** @internal */
|
|
1797
|
-
[Columns];
|
|
1798
|
-
/** @internal */
|
|
1799
|
-
[ExtraConfigColumns];
|
|
1800
|
-
/**
|
|
1801
|
-
* @internal
|
|
1802
|
-
* Used to store the table name before the transformation via the `tableCreator` functions.
|
|
1803
|
-
*/
|
|
1804
|
-
[BaseName];
|
|
1805
|
-
/** @internal */
|
|
1806
|
-
[IsAlias] = false;
|
|
1807
|
-
/** @internal */
|
|
1808
|
-
[IsDrizzleTable] = true;
|
|
1809
|
-
/** @internal */
|
|
1810
|
-
[ExtraConfigBuilder] = void 0;
|
|
1811
|
-
constructor(name, schema, baseName) {
|
|
1812
|
-
this[TableName] = this[OriginalName] = name;
|
|
1813
|
-
this[Schema] = schema;
|
|
1814
|
-
this[BaseName] = baseName;
|
|
1815
|
-
}
|
|
1816
|
-
};
|
|
1817
|
-
|
|
1818
|
-
// ../../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
|
|
1819
|
-
var FakePrimitiveParam = class {
|
|
1820
|
-
static [entityKind] = "FakePrimitiveParam";
|
|
1821
|
-
};
|
|
1822
|
-
function isSQLWrapper(value) {
|
|
1823
|
-
return value !== null && value !== void 0 && typeof value.getSQL === "function";
|
|
1824
|
-
}
|
|
1825
|
-
function mergeQueries(queries) {
|
|
1826
|
-
const result = { sql: "", params: [] };
|
|
1827
|
-
for (const query of queries) {
|
|
1828
|
-
result.sql += query.sql;
|
|
1829
|
-
result.params.push(...query.params);
|
|
1830
|
-
if (query.typings?.length) {
|
|
1831
|
-
if (!result.typings) {
|
|
1832
|
-
result.typings = [];
|
|
1833
|
-
}
|
|
1834
|
-
result.typings.push(...query.typings);
|
|
1835
|
-
}
|
|
1836
|
-
}
|
|
1837
|
-
return result;
|
|
1838
|
-
}
|
|
1839
|
-
var StringChunk = class {
|
|
1840
|
-
static [entityKind] = "StringChunk";
|
|
1841
|
-
value;
|
|
1842
|
-
constructor(value) {
|
|
1843
|
-
this.value = Array.isArray(value) ? value : [value];
|
|
1844
|
-
}
|
|
1845
|
-
getSQL() {
|
|
1846
|
-
return new SQL([this]);
|
|
1847
|
-
}
|
|
1848
|
-
};
|
|
1849
|
-
var SQL = class _SQL {
|
|
1850
|
-
constructor(queryChunks) {
|
|
1851
|
-
this.queryChunks = queryChunks;
|
|
1852
|
-
for (const chunk of queryChunks) {
|
|
1853
|
-
if (is(chunk, Table)) {
|
|
1854
|
-
const schemaName = chunk[Table.Symbol.Schema];
|
|
1855
|
-
this.usedTables.push(
|
|
1856
|
-
schemaName === void 0 ? chunk[Table.Symbol.Name] : schemaName + "." + chunk[Table.Symbol.Name]
|
|
1857
|
-
);
|
|
1858
|
-
}
|
|
1859
|
-
}
|
|
1860
|
-
}
|
|
1861
|
-
static [entityKind] = "SQL";
|
|
1862
|
-
/** @internal */
|
|
1863
|
-
decoder = noopDecoder;
|
|
1864
|
-
shouldInlineParams = false;
|
|
1865
|
-
/** @internal */
|
|
1866
|
-
usedTables = [];
|
|
1867
|
-
append(query) {
|
|
1868
|
-
this.queryChunks.push(...query.queryChunks);
|
|
1869
|
-
return this;
|
|
1870
|
-
}
|
|
1871
|
-
toQuery(config) {
|
|
1872
|
-
return tracer.startActiveSpan("drizzle.buildSQL", (span) => {
|
|
1873
|
-
const query = this.buildQueryFromSourceParams(this.queryChunks, config);
|
|
1874
|
-
span?.setAttributes({
|
|
1875
|
-
"drizzle.query.text": query.sql,
|
|
1876
|
-
"drizzle.query.params": JSON.stringify(query.params)
|
|
1877
|
-
});
|
|
1878
|
-
return query;
|
|
1879
|
-
});
|
|
1880
|
-
}
|
|
1881
|
-
buildQueryFromSourceParams(chunks, _config) {
|
|
1882
|
-
const config = Object.assign({}, _config, {
|
|
1883
|
-
inlineParams: _config.inlineParams || this.shouldInlineParams,
|
|
1884
|
-
paramStartIndex: _config.paramStartIndex || { value: 0 }
|
|
1885
|
-
});
|
|
1886
|
-
const {
|
|
1887
|
-
casing,
|
|
1888
|
-
escapeName,
|
|
1889
|
-
escapeParam,
|
|
1890
|
-
prepareTyping,
|
|
1891
|
-
inlineParams,
|
|
1892
|
-
paramStartIndex
|
|
1893
|
-
} = config;
|
|
1894
|
-
return mergeQueries(chunks.map((chunk) => {
|
|
1895
|
-
if (is(chunk, StringChunk)) {
|
|
1896
|
-
return { sql: chunk.value.join(""), params: [] };
|
|
1897
|
-
}
|
|
1898
|
-
if (is(chunk, Name)) {
|
|
1899
|
-
return { sql: escapeName(chunk.value), params: [] };
|
|
1900
|
-
}
|
|
1901
|
-
if (chunk === void 0) {
|
|
1902
|
-
return { sql: "", params: [] };
|
|
1903
|
-
}
|
|
1904
|
-
if (Array.isArray(chunk)) {
|
|
1905
|
-
const result = [new StringChunk("(")];
|
|
1906
|
-
for (const [i, p] of chunk.entries()) {
|
|
1907
|
-
result.push(p);
|
|
1908
|
-
if (i < chunk.length - 1) {
|
|
1909
|
-
result.push(new StringChunk(", "));
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
result.push(new StringChunk(")"));
|
|
1913
|
-
return this.buildQueryFromSourceParams(result, config);
|
|
1914
|
-
}
|
|
1915
|
-
if (is(chunk, _SQL)) {
|
|
1916
|
-
return this.buildQueryFromSourceParams(chunk.queryChunks, {
|
|
1917
|
-
...config,
|
|
1918
|
-
inlineParams: inlineParams || chunk.shouldInlineParams
|
|
1919
|
-
});
|
|
1920
|
-
}
|
|
1921
|
-
if (is(chunk, Table)) {
|
|
1922
|
-
const schemaName = chunk[Table.Symbol.Schema];
|
|
1923
|
-
const tableName = chunk[Table.Symbol.Name];
|
|
1924
|
-
return {
|
|
1925
|
-
sql: schemaName === void 0 || chunk[IsAlias] ? escapeName(tableName) : escapeName(schemaName) + "." + escapeName(tableName),
|
|
1926
|
-
params: []
|
|
1927
|
-
};
|
|
1928
|
-
}
|
|
1929
|
-
if (is(chunk, Column)) {
|
|
1930
|
-
const columnName = casing.getColumnCasing(chunk);
|
|
1931
|
-
if (_config.invokeSource === "indexes") {
|
|
1932
|
-
return { sql: escapeName(columnName), params: [] };
|
|
1933
|
-
}
|
|
1934
|
-
const schemaName = chunk.table[Table.Symbol.Schema];
|
|
1935
|
-
return {
|
|
1936
|
-
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),
|
|
1937
|
-
params: []
|
|
1938
|
-
};
|
|
1939
|
-
}
|
|
1940
|
-
if (is(chunk, View)) {
|
|
1941
|
-
const schemaName = chunk[ViewBaseConfig].schema;
|
|
1942
|
-
const viewName = chunk[ViewBaseConfig].name;
|
|
1943
|
-
return {
|
|
1944
|
-
sql: schemaName === void 0 || chunk[ViewBaseConfig].isAlias ? escapeName(viewName) : escapeName(schemaName) + "." + escapeName(viewName),
|
|
1945
|
-
params: []
|
|
1946
|
-
};
|
|
1947
|
-
}
|
|
1948
|
-
if (is(chunk, Param)) {
|
|
1949
|
-
if (is(chunk.value, Placeholder)) {
|
|
1950
|
-
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
1951
|
-
}
|
|
1952
|
-
const mappedValue = chunk.value === null ? null : chunk.encoder.mapToDriverValue(chunk.value);
|
|
1953
|
-
if (is(mappedValue, _SQL)) {
|
|
1954
|
-
return this.buildQueryFromSourceParams([mappedValue], config);
|
|
1955
|
-
}
|
|
1956
|
-
if (inlineParams) {
|
|
1957
|
-
return { sql: this.mapInlineParam(mappedValue, config), params: [] };
|
|
1958
|
-
}
|
|
1959
|
-
let typings = ["none"];
|
|
1960
|
-
if (prepareTyping) {
|
|
1961
|
-
typings = [prepareTyping(chunk.encoder)];
|
|
1962
|
-
}
|
|
1963
|
-
return { sql: escapeParam(paramStartIndex.value++, mappedValue), params: [mappedValue], typings };
|
|
1964
|
-
}
|
|
1965
|
-
if (is(chunk, Placeholder)) {
|
|
1966
|
-
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
1967
|
-
}
|
|
1968
|
-
if (is(chunk, _SQL.Aliased) && chunk.fieldAlias !== void 0) {
|
|
1969
|
-
return { sql: escapeName(chunk.fieldAlias), params: [] };
|
|
1970
|
-
}
|
|
1971
|
-
if (is(chunk, Subquery)) {
|
|
1972
|
-
if (chunk._.isWith) {
|
|
1973
|
-
return { sql: escapeName(chunk._.alias), params: [] };
|
|
1974
|
-
}
|
|
1975
|
-
return this.buildQueryFromSourceParams([
|
|
1976
|
-
new StringChunk("("),
|
|
1977
|
-
chunk._.sql,
|
|
1978
|
-
new StringChunk(") "),
|
|
1979
|
-
new Name(chunk._.alias)
|
|
1980
|
-
], config);
|
|
1981
|
-
}
|
|
1982
|
-
if (isPgEnum(chunk)) {
|
|
1983
|
-
if (chunk.schema) {
|
|
1984
|
-
return { sql: escapeName(chunk.schema) + "." + escapeName(chunk.enumName), params: [] };
|
|
1985
|
-
}
|
|
1986
|
-
return { sql: escapeName(chunk.enumName), params: [] };
|
|
1987
|
-
}
|
|
1988
|
-
if (isSQLWrapper(chunk)) {
|
|
1989
|
-
if (chunk.shouldOmitSQLParens?.()) {
|
|
1990
|
-
return this.buildQueryFromSourceParams([chunk.getSQL()], config);
|
|
1991
|
-
}
|
|
1992
|
-
return this.buildQueryFromSourceParams([
|
|
1993
|
-
new StringChunk("("),
|
|
1994
|
-
chunk.getSQL(),
|
|
1995
|
-
new StringChunk(")")
|
|
1996
|
-
], config);
|
|
1997
|
-
}
|
|
1998
|
-
if (inlineParams) {
|
|
1999
|
-
return { sql: this.mapInlineParam(chunk, config), params: [] };
|
|
2000
|
-
}
|
|
2001
|
-
return { sql: escapeParam(paramStartIndex.value++, chunk), params: [chunk], typings: ["none"] };
|
|
2002
|
-
}));
|
|
2003
|
-
}
|
|
2004
|
-
mapInlineParam(chunk, { escapeString }) {
|
|
2005
|
-
if (chunk === null) {
|
|
2006
|
-
return "null";
|
|
2007
|
-
}
|
|
2008
|
-
if (typeof chunk === "number" || typeof chunk === "boolean") {
|
|
2009
|
-
return chunk.toString();
|
|
2010
|
-
}
|
|
2011
|
-
if (typeof chunk === "string") {
|
|
2012
|
-
return escapeString(chunk);
|
|
2013
|
-
}
|
|
2014
|
-
if (typeof chunk === "object") {
|
|
2015
|
-
const mappedValueAsString = chunk.toString();
|
|
2016
|
-
if (mappedValueAsString === "[object Object]") {
|
|
2017
|
-
return escapeString(JSON.stringify(chunk));
|
|
2018
|
-
}
|
|
2019
|
-
return escapeString(mappedValueAsString);
|
|
2020
|
-
}
|
|
2021
|
-
throw new Error("Unexpected param value: " + chunk);
|
|
2022
|
-
}
|
|
2023
|
-
getSQL() {
|
|
2024
|
-
return this;
|
|
2025
|
-
}
|
|
2026
|
-
as(alias) {
|
|
2027
|
-
if (alias === void 0) {
|
|
2028
|
-
return this;
|
|
2029
|
-
}
|
|
2030
|
-
return new _SQL.Aliased(this, alias);
|
|
2031
|
-
}
|
|
2032
|
-
mapWith(decoder) {
|
|
2033
|
-
this.decoder = typeof decoder === "function" ? { mapFromDriverValue: decoder } : decoder;
|
|
2034
|
-
return this;
|
|
2035
|
-
}
|
|
2036
|
-
inlineParams() {
|
|
2037
|
-
this.shouldInlineParams = true;
|
|
2038
|
-
return this;
|
|
2039
|
-
}
|
|
2040
|
-
/**
|
|
2041
|
-
* This method is used to conditionally include a part of the query.
|
|
2042
|
-
*
|
|
2043
|
-
* @param condition - Condition to check
|
|
2044
|
-
* @returns itself if the condition is `true`, otherwise `undefined`
|
|
2045
|
-
*/
|
|
2046
|
-
if(condition) {
|
|
2047
|
-
return condition ? this : void 0;
|
|
2048
|
-
}
|
|
2049
|
-
};
|
|
2050
|
-
var Name = class {
|
|
2051
|
-
constructor(value) {
|
|
2052
|
-
this.value = value;
|
|
2053
|
-
}
|
|
2054
|
-
static [entityKind] = "Name";
|
|
2055
|
-
brand;
|
|
2056
|
-
getSQL() {
|
|
2057
|
-
return new SQL([this]);
|
|
2058
|
-
}
|
|
2059
|
-
};
|
|
2060
|
-
var noopDecoder = {
|
|
2061
|
-
mapFromDriverValue: (value) => value
|
|
2062
|
-
};
|
|
2063
|
-
var noopEncoder = {
|
|
2064
|
-
mapToDriverValue: (value) => value
|
|
2065
|
-
};
|
|
2066
|
-
var noopMapper = {
|
|
2067
|
-
...noopDecoder,
|
|
2068
|
-
...noopEncoder
|
|
2069
|
-
};
|
|
2070
|
-
var Param = class {
|
|
2071
|
-
/**
|
|
2072
|
-
* @param value - Parameter value
|
|
2073
|
-
* @param encoder - Encoder to convert the value to a driver parameter
|
|
2074
|
-
*/
|
|
2075
|
-
constructor(value, encoder = noopEncoder) {
|
|
2076
|
-
this.value = value;
|
|
2077
|
-
this.encoder = encoder;
|
|
2078
|
-
}
|
|
2079
|
-
static [entityKind] = "Param";
|
|
2080
|
-
brand;
|
|
2081
|
-
getSQL() {
|
|
2082
|
-
return new SQL([this]);
|
|
2083
|
-
}
|
|
2084
|
-
};
|
|
2085
|
-
function sql(strings, ...params) {
|
|
2086
|
-
const queryChunks = [];
|
|
2087
|
-
if (params.length > 0 || strings.length > 0 && strings[0] !== "") {
|
|
2088
|
-
queryChunks.push(new StringChunk(strings[0]));
|
|
2089
|
-
}
|
|
2090
|
-
for (const [paramIndex, param2] of params.entries()) {
|
|
2091
|
-
queryChunks.push(param2, new StringChunk(strings[paramIndex + 1]));
|
|
2092
|
-
}
|
|
2093
|
-
return new SQL(queryChunks);
|
|
2094
|
-
}
|
|
2095
|
-
((sql2) => {
|
|
2096
|
-
function empty() {
|
|
2097
|
-
return new SQL([]);
|
|
2098
|
-
}
|
|
2099
|
-
sql2.empty = empty;
|
|
2100
|
-
function fromList(list) {
|
|
2101
|
-
return new SQL(list);
|
|
2102
|
-
}
|
|
2103
|
-
sql2.fromList = fromList;
|
|
2104
|
-
function raw(str) {
|
|
2105
|
-
return new SQL([new StringChunk(str)]);
|
|
2106
|
-
}
|
|
2107
|
-
sql2.raw = raw;
|
|
2108
|
-
function join(chunks, separator) {
|
|
2109
|
-
const result = [];
|
|
2110
|
-
for (const [i, chunk] of chunks.entries()) {
|
|
2111
|
-
if (i > 0 && separator !== void 0) {
|
|
2112
|
-
result.push(separator);
|
|
2113
|
-
}
|
|
2114
|
-
result.push(chunk);
|
|
2115
|
-
}
|
|
2116
|
-
return new SQL(result);
|
|
2117
|
-
}
|
|
2118
|
-
sql2.join = join;
|
|
2119
|
-
function identifier(value) {
|
|
2120
|
-
return new Name(value);
|
|
2121
|
-
}
|
|
2122
|
-
sql2.identifier = identifier;
|
|
2123
|
-
function placeholder2(name2) {
|
|
2124
|
-
return new Placeholder(name2);
|
|
2125
|
-
}
|
|
2126
|
-
sql2.placeholder = placeholder2;
|
|
2127
|
-
function param2(value, encoder) {
|
|
2128
|
-
return new Param(value, encoder);
|
|
2129
|
-
}
|
|
2130
|
-
sql2.param = param2;
|
|
2131
|
-
})(sql || (sql = {}));
|
|
2132
|
-
((SQL2) => {
|
|
2133
|
-
class Aliased {
|
|
2134
|
-
constructor(sql2, fieldAlias) {
|
|
2135
|
-
this.sql = sql2;
|
|
2136
|
-
this.fieldAlias = fieldAlias;
|
|
2137
|
-
}
|
|
2138
|
-
static [entityKind] = "SQL.Aliased";
|
|
2139
|
-
/** @internal */
|
|
2140
|
-
isSelectionField = false;
|
|
2141
|
-
getSQL() {
|
|
2142
|
-
return this.sql;
|
|
2143
|
-
}
|
|
2144
|
-
/** @internal */
|
|
2145
|
-
clone() {
|
|
2146
|
-
return new Aliased(this.sql, this.fieldAlias);
|
|
2147
|
-
}
|
|
2148
|
-
}
|
|
2149
|
-
SQL2.Aliased = Aliased;
|
|
2150
|
-
})(SQL || (SQL = {}));
|
|
2151
|
-
var Placeholder = class {
|
|
2152
|
-
constructor(name2) {
|
|
2153
|
-
this.name = name2;
|
|
2154
|
-
}
|
|
2155
|
-
static [entityKind] = "Placeholder";
|
|
2156
|
-
getSQL() {
|
|
2157
|
-
return new SQL([this]);
|
|
2158
|
-
}
|
|
2159
|
-
};
|
|
2160
|
-
var IsDrizzleView = Symbol.for("drizzle:IsDrizzleView");
|
|
2161
|
-
var View = class {
|
|
2162
|
-
static [entityKind] = "View";
|
|
2163
|
-
/** @internal */
|
|
2164
|
-
[ViewBaseConfig];
|
|
2165
|
-
/** @internal */
|
|
2166
|
-
[IsDrizzleView] = true;
|
|
2167
|
-
constructor({ name: name2, schema, selectedFields, query }) {
|
|
2168
|
-
this[ViewBaseConfig] = {
|
|
2169
|
-
name: name2,
|
|
2170
|
-
originalName: name2,
|
|
2171
|
-
schema,
|
|
2172
|
-
selectedFields,
|
|
2173
|
-
query,
|
|
2174
|
-
isExisting: !query,
|
|
2175
|
-
isAlias: false
|
|
2176
|
-
};
|
|
2177
|
-
}
|
|
2178
|
-
getSQL() {
|
|
2179
|
-
return new SQL([this]);
|
|
2180
|
-
}
|
|
2181
|
-
};
|
|
2182
|
-
Column.prototype.getSQL = function() {
|
|
2183
|
-
return new SQL([this]);
|
|
2184
|
-
};
|
|
2185
|
-
Table.prototype.getSQL = function() {
|
|
2186
|
-
return new SQL([this]);
|
|
2187
|
-
};
|
|
2188
|
-
Subquery.prototype.getSQL = function() {
|
|
2189
|
-
return new SQL([this]);
|
|
2190
|
-
};
|
|
2191
|
-
|
|
2192
|
-
// ../../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
|
|
2193
|
-
function getColumnNameAndConfig(a, b) {
|
|
2194
|
-
return {
|
|
2195
|
-
name: typeof a === "string" && a.length > 0 ? a : "",
|
|
2196
|
-
config: typeof a === "object" ? a : b
|
|
2197
|
-
};
|
|
2198
|
-
}
|
|
2199
|
-
var textDecoder = typeof TextDecoder === "undefined" ? null : new TextDecoder();
|
|
2200
|
-
|
|
2201
|
-
// ../../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
|
|
2202
|
-
var PgIntColumnBaseBuilder = class extends PgColumnBuilder {
|
|
2203
|
-
static [entityKind] = "PgIntColumnBaseBuilder";
|
|
2204
|
-
generatedAlwaysAsIdentity(sequence) {
|
|
2205
|
-
if (sequence) {
|
|
2206
|
-
const { name, ...options } = sequence;
|
|
2207
|
-
this.config.generatedIdentity = {
|
|
2208
|
-
type: "always",
|
|
2209
|
-
sequenceName: name,
|
|
2210
|
-
sequenceOptions: options
|
|
2211
|
-
};
|
|
2212
|
-
} else {
|
|
2213
|
-
this.config.generatedIdentity = {
|
|
2214
|
-
type: "always"
|
|
2215
|
-
};
|
|
2216
|
-
}
|
|
2217
|
-
this.config.hasDefault = true;
|
|
2218
|
-
this.config.notNull = true;
|
|
2219
|
-
return this;
|
|
2220
|
-
}
|
|
2221
|
-
generatedByDefaultAsIdentity(sequence) {
|
|
2222
|
-
if (sequence) {
|
|
2223
|
-
const { name, ...options } = sequence;
|
|
2224
|
-
this.config.generatedIdentity = {
|
|
2225
|
-
type: "byDefault",
|
|
2226
|
-
sequenceName: name,
|
|
2227
|
-
sequenceOptions: options
|
|
2228
|
-
};
|
|
2229
|
-
} else {
|
|
2230
|
-
this.config.generatedIdentity = {
|
|
2231
|
-
type: "byDefault"
|
|
2232
|
-
};
|
|
2233
|
-
}
|
|
2234
|
-
this.config.hasDefault = true;
|
|
2235
|
-
this.config.notNull = true;
|
|
2236
|
-
return this;
|
|
2237
|
-
}
|
|
2238
|
-
};
|
|
2239
|
-
|
|
2240
|
-
// ../../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
|
|
2241
|
-
var PgBigInt53Builder = class extends PgIntColumnBaseBuilder {
|
|
2242
|
-
static [entityKind] = "PgBigInt53Builder";
|
|
2243
|
-
constructor(name) {
|
|
2244
|
-
super(name, "number", "PgBigInt53");
|
|
2245
|
-
}
|
|
2246
|
-
/** @internal */
|
|
2247
|
-
build(table) {
|
|
2248
|
-
return new PgBigInt53(table, this.config);
|
|
2249
|
-
}
|
|
2250
|
-
};
|
|
2251
|
-
var PgBigInt53 = class extends PgColumn {
|
|
2252
|
-
static [entityKind] = "PgBigInt53";
|
|
2253
|
-
getSQLType() {
|
|
2254
|
-
return "bigint";
|
|
2255
|
-
}
|
|
2256
|
-
mapFromDriverValue(value) {
|
|
2257
|
-
if (typeof value === "number") {
|
|
2258
|
-
return value;
|
|
2259
|
-
}
|
|
2260
|
-
return Number(value);
|
|
2261
|
-
}
|
|
2262
|
-
};
|
|
2263
|
-
var PgBigInt64Builder = class extends PgIntColumnBaseBuilder {
|
|
2264
|
-
static [entityKind] = "PgBigInt64Builder";
|
|
2265
|
-
constructor(name) {
|
|
2266
|
-
super(name, "bigint", "PgBigInt64");
|
|
2267
|
-
}
|
|
2268
|
-
/** @internal */
|
|
2269
|
-
build(table) {
|
|
2270
|
-
return new PgBigInt64(
|
|
2271
|
-
table,
|
|
2272
|
-
this.config
|
|
2273
|
-
);
|
|
2274
|
-
}
|
|
2275
|
-
};
|
|
2276
|
-
var PgBigInt64 = class extends PgColumn {
|
|
2277
|
-
static [entityKind] = "PgBigInt64";
|
|
2278
|
-
getSQLType() {
|
|
2279
|
-
return "bigint";
|
|
2280
|
-
}
|
|
2281
|
-
// eslint-disable-next-line unicorn/prefer-native-coercion-functions
|
|
2282
|
-
mapFromDriverValue(value) {
|
|
2283
|
-
return BigInt(value);
|
|
2284
|
-
}
|
|
2285
|
-
};
|
|
2286
|
-
function bigint(a, b) {
|
|
2287
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2288
|
-
if (config.mode === "number") {
|
|
2289
|
-
return new PgBigInt53Builder(name);
|
|
2290
|
-
}
|
|
2291
|
-
return new PgBigInt64Builder(name);
|
|
2292
|
-
}
|
|
2293
|
-
|
|
2294
|
-
// ../../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
|
|
2295
|
-
var PgBigSerial53Builder = class extends PgColumnBuilder {
|
|
2296
|
-
static [entityKind] = "PgBigSerial53Builder";
|
|
2297
|
-
constructor(name) {
|
|
2298
|
-
super(name, "number", "PgBigSerial53");
|
|
2299
|
-
this.config.hasDefault = true;
|
|
2300
|
-
this.config.notNull = true;
|
|
2301
|
-
}
|
|
2302
|
-
/** @internal */
|
|
2303
|
-
build(table) {
|
|
2304
|
-
return new PgBigSerial53(
|
|
2305
|
-
table,
|
|
2306
|
-
this.config
|
|
2307
|
-
);
|
|
2308
|
-
}
|
|
2309
|
-
};
|
|
2310
|
-
var PgBigSerial53 = class extends PgColumn {
|
|
2311
|
-
static [entityKind] = "PgBigSerial53";
|
|
2312
|
-
getSQLType() {
|
|
2313
|
-
return "bigserial";
|
|
2314
|
-
}
|
|
2315
|
-
mapFromDriverValue(value) {
|
|
2316
|
-
if (typeof value === "number") {
|
|
2317
|
-
return value;
|
|
2318
|
-
}
|
|
2319
|
-
return Number(value);
|
|
2320
|
-
}
|
|
2321
|
-
};
|
|
2322
|
-
var PgBigSerial64Builder = class extends PgColumnBuilder {
|
|
2323
|
-
static [entityKind] = "PgBigSerial64Builder";
|
|
2324
|
-
constructor(name) {
|
|
2325
|
-
super(name, "bigint", "PgBigSerial64");
|
|
2326
|
-
this.config.hasDefault = true;
|
|
2327
|
-
}
|
|
2328
|
-
/** @internal */
|
|
2329
|
-
build(table) {
|
|
2330
|
-
return new PgBigSerial64(
|
|
2331
|
-
table,
|
|
2332
|
-
this.config
|
|
2333
|
-
);
|
|
2334
|
-
}
|
|
2335
|
-
};
|
|
2336
|
-
var PgBigSerial64 = class extends PgColumn {
|
|
2337
|
-
static [entityKind] = "PgBigSerial64";
|
|
2338
|
-
getSQLType() {
|
|
2339
|
-
return "bigserial";
|
|
2340
|
-
}
|
|
2341
|
-
// eslint-disable-next-line unicorn/prefer-native-coercion-functions
|
|
2342
|
-
mapFromDriverValue(value) {
|
|
2343
|
-
return BigInt(value);
|
|
2344
|
-
}
|
|
2345
|
-
};
|
|
2346
|
-
function bigserial(a, b) {
|
|
2347
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2348
|
-
if (config.mode === "number") {
|
|
2349
|
-
return new PgBigSerial53Builder(name);
|
|
2350
|
-
}
|
|
2351
|
-
return new PgBigSerial64Builder(name);
|
|
2352
|
-
}
|
|
2353
|
-
|
|
2354
|
-
// ../../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
|
|
2355
|
-
var PgBooleanBuilder = class extends PgColumnBuilder {
|
|
2356
|
-
static [entityKind] = "PgBooleanBuilder";
|
|
2357
|
-
constructor(name) {
|
|
2358
|
-
super(name, "boolean", "PgBoolean");
|
|
2359
|
-
}
|
|
2360
|
-
/** @internal */
|
|
2361
|
-
build(table) {
|
|
2362
|
-
return new PgBoolean(table, this.config);
|
|
2363
|
-
}
|
|
2364
|
-
};
|
|
2365
|
-
var PgBoolean = class extends PgColumn {
|
|
2366
|
-
static [entityKind] = "PgBoolean";
|
|
2367
|
-
getSQLType() {
|
|
2368
|
-
return "boolean";
|
|
2369
|
-
}
|
|
2370
|
-
};
|
|
2371
|
-
function boolean(name) {
|
|
2372
|
-
return new PgBooleanBuilder(name ?? "");
|
|
2373
|
-
}
|
|
2374
|
-
|
|
2375
|
-
// ../../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
|
|
2376
|
-
var PgCharBuilder = class extends PgColumnBuilder {
|
|
2377
|
-
static [entityKind] = "PgCharBuilder";
|
|
2378
|
-
constructor(name, config) {
|
|
2379
|
-
super(name, "string", "PgChar");
|
|
2380
|
-
this.config.length = config.length;
|
|
2381
|
-
this.config.enumValues = config.enum;
|
|
2382
|
-
}
|
|
2383
|
-
/** @internal */
|
|
2384
|
-
build(table) {
|
|
2385
|
-
return new PgChar(
|
|
2386
|
-
table,
|
|
2387
|
-
this.config
|
|
2388
|
-
);
|
|
2389
|
-
}
|
|
2390
|
-
};
|
|
2391
|
-
var PgChar = class extends PgColumn {
|
|
2392
|
-
static [entityKind] = "PgChar";
|
|
2393
|
-
length = this.config.length;
|
|
2394
|
-
enumValues = this.config.enumValues;
|
|
2395
|
-
getSQLType() {
|
|
2396
|
-
return this.length === void 0 ? `char` : `char(${this.length})`;
|
|
2397
|
-
}
|
|
2398
|
-
};
|
|
2399
|
-
function char(a, b = {}) {
|
|
2400
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2401
|
-
return new PgCharBuilder(name, config);
|
|
2402
|
-
}
|
|
2403
|
-
|
|
2404
|
-
// ../../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
|
|
2405
|
-
var PgCidrBuilder = class extends PgColumnBuilder {
|
|
2406
|
-
static [entityKind] = "PgCidrBuilder";
|
|
2407
|
-
constructor(name) {
|
|
2408
|
-
super(name, "string", "PgCidr");
|
|
2409
|
-
}
|
|
2410
|
-
/** @internal */
|
|
2411
|
-
build(table) {
|
|
2412
|
-
return new PgCidr(table, this.config);
|
|
2413
|
-
}
|
|
2414
|
-
};
|
|
2415
|
-
var PgCidr = class extends PgColumn {
|
|
2416
|
-
static [entityKind] = "PgCidr";
|
|
2417
|
-
getSQLType() {
|
|
2418
|
-
return "cidr";
|
|
2419
|
-
}
|
|
2420
|
-
};
|
|
2421
|
-
function cidr(name) {
|
|
2422
|
-
return new PgCidrBuilder(name ?? "");
|
|
2423
|
-
}
|
|
2424
|
-
|
|
2425
|
-
// ../../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
|
|
2426
|
-
var PgCustomColumnBuilder = class extends PgColumnBuilder {
|
|
2427
|
-
static [entityKind] = "PgCustomColumnBuilder";
|
|
2428
|
-
constructor(name, fieldConfig, customTypeParams) {
|
|
2429
|
-
super(name, "custom", "PgCustomColumn");
|
|
2430
|
-
this.config.fieldConfig = fieldConfig;
|
|
2431
|
-
this.config.customTypeParams = customTypeParams;
|
|
2432
|
-
}
|
|
2433
|
-
/** @internal */
|
|
2434
|
-
build(table) {
|
|
2435
|
-
return new PgCustomColumn(
|
|
2436
|
-
table,
|
|
2437
|
-
this.config
|
|
2438
|
-
);
|
|
2439
|
-
}
|
|
2440
|
-
};
|
|
2441
|
-
var PgCustomColumn = class extends PgColumn {
|
|
2442
|
-
static [entityKind] = "PgCustomColumn";
|
|
2443
|
-
sqlName;
|
|
2444
|
-
mapTo;
|
|
2445
|
-
mapFrom;
|
|
2446
|
-
constructor(table, config) {
|
|
2447
|
-
super(table, config);
|
|
2448
|
-
this.sqlName = config.customTypeParams.dataType(config.fieldConfig);
|
|
2449
|
-
this.mapTo = config.customTypeParams.toDriver;
|
|
2450
|
-
this.mapFrom = config.customTypeParams.fromDriver;
|
|
2451
|
-
}
|
|
2452
|
-
getSQLType() {
|
|
2453
|
-
return this.sqlName;
|
|
2454
|
-
}
|
|
2455
|
-
mapFromDriverValue(value) {
|
|
2456
|
-
return typeof this.mapFrom === "function" ? this.mapFrom(value) : value;
|
|
2457
|
-
}
|
|
2458
|
-
mapToDriverValue(value) {
|
|
2459
|
-
return typeof this.mapTo === "function" ? this.mapTo(value) : value;
|
|
2460
|
-
}
|
|
2461
|
-
};
|
|
2462
|
-
function customType(customTypeParams) {
|
|
2463
|
-
return (a, b) => {
|
|
2464
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2465
|
-
return new PgCustomColumnBuilder(name, config, customTypeParams);
|
|
2466
|
-
};
|
|
2467
|
-
}
|
|
2468
|
-
|
|
2469
|
-
// ../../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
|
|
2470
|
-
var PgDateColumnBaseBuilder = class extends PgColumnBuilder {
|
|
2471
|
-
static [entityKind] = "PgDateColumnBaseBuilder";
|
|
2472
|
-
defaultNow() {
|
|
2473
|
-
return this.default(sql`now()`);
|
|
2474
|
-
}
|
|
2475
|
-
};
|
|
2476
|
-
|
|
2477
|
-
// ../../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
|
|
2478
|
-
var PgDateBuilder = class extends PgDateColumnBaseBuilder {
|
|
2479
|
-
static [entityKind] = "PgDateBuilder";
|
|
2480
|
-
constructor(name) {
|
|
2481
|
-
super(name, "date", "PgDate");
|
|
2482
|
-
}
|
|
2483
|
-
/** @internal */
|
|
2484
|
-
build(table) {
|
|
2485
|
-
return new PgDate(table, this.config);
|
|
2486
|
-
}
|
|
2487
|
-
};
|
|
2488
|
-
var PgDate = class extends PgColumn {
|
|
2489
|
-
static [entityKind] = "PgDate";
|
|
2490
|
-
getSQLType() {
|
|
2491
|
-
return "date";
|
|
2492
|
-
}
|
|
2493
|
-
mapFromDriverValue(value) {
|
|
2494
|
-
if (typeof value === "string") return new Date(value);
|
|
2495
|
-
return value;
|
|
2496
|
-
}
|
|
2497
|
-
mapToDriverValue(value) {
|
|
2498
|
-
return value.toISOString();
|
|
2499
|
-
}
|
|
2500
|
-
};
|
|
2501
|
-
var PgDateStringBuilder = class extends PgDateColumnBaseBuilder {
|
|
2502
|
-
static [entityKind] = "PgDateStringBuilder";
|
|
2503
|
-
constructor(name) {
|
|
2504
|
-
super(name, "string", "PgDateString");
|
|
2505
|
-
}
|
|
2506
|
-
/** @internal */
|
|
2507
|
-
build(table) {
|
|
2508
|
-
return new PgDateString(
|
|
2509
|
-
table,
|
|
2510
|
-
this.config
|
|
2511
|
-
);
|
|
2512
|
-
}
|
|
2513
|
-
};
|
|
2514
|
-
var PgDateString = class extends PgColumn {
|
|
2515
|
-
static [entityKind] = "PgDateString";
|
|
2516
|
-
getSQLType() {
|
|
2517
|
-
return "date";
|
|
2518
|
-
}
|
|
2519
|
-
mapFromDriverValue(value) {
|
|
2520
|
-
if (typeof value === "string") return value;
|
|
2521
|
-
return value.toISOString().slice(0, -14);
|
|
2522
|
-
}
|
|
2523
|
-
};
|
|
2524
|
-
function date(a, b) {
|
|
2525
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2526
|
-
if (config?.mode === "date") {
|
|
2527
|
-
return new PgDateBuilder(name);
|
|
2528
|
-
}
|
|
2529
|
-
return new PgDateStringBuilder(name);
|
|
2530
|
-
}
|
|
2531
|
-
|
|
2532
|
-
// ../../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
|
|
2533
|
-
var PgDoublePrecisionBuilder = class extends PgColumnBuilder {
|
|
2534
|
-
static [entityKind] = "PgDoublePrecisionBuilder";
|
|
2535
|
-
constructor(name) {
|
|
2536
|
-
super(name, "number", "PgDoublePrecision");
|
|
2537
|
-
}
|
|
2538
|
-
/** @internal */
|
|
2539
|
-
build(table) {
|
|
2540
|
-
return new PgDoublePrecision(
|
|
2541
|
-
table,
|
|
2542
|
-
this.config
|
|
2543
|
-
);
|
|
2544
|
-
}
|
|
2545
|
-
};
|
|
2546
|
-
var PgDoublePrecision = class extends PgColumn {
|
|
2547
|
-
static [entityKind] = "PgDoublePrecision";
|
|
2548
|
-
getSQLType() {
|
|
2549
|
-
return "double precision";
|
|
2550
|
-
}
|
|
2551
|
-
mapFromDriverValue(value) {
|
|
2552
|
-
if (typeof value === "string") {
|
|
2553
|
-
return Number.parseFloat(value);
|
|
2554
|
-
}
|
|
2555
|
-
return value;
|
|
2556
|
-
}
|
|
2557
|
-
};
|
|
2558
|
-
function doublePrecision(name) {
|
|
2559
|
-
return new PgDoublePrecisionBuilder(name ?? "");
|
|
2560
|
-
}
|
|
2561
|
-
|
|
2562
|
-
// ../../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
|
|
2563
|
-
var PgInetBuilder = class extends PgColumnBuilder {
|
|
2564
|
-
static [entityKind] = "PgInetBuilder";
|
|
2565
|
-
constructor(name) {
|
|
2566
|
-
super(name, "string", "PgInet");
|
|
2567
|
-
}
|
|
2568
|
-
/** @internal */
|
|
2569
|
-
build(table) {
|
|
2570
|
-
return new PgInet(table, this.config);
|
|
2571
|
-
}
|
|
2572
|
-
};
|
|
2573
|
-
var PgInet = class extends PgColumn {
|
|
2574
|
-
static [entityKind] = "PgInet";
|
|
2575
|
-
getSQLType() {
|
|
2576
|
-
return "inet";
|
|
2577
|
-
}
|
|
2578
|
-
};
|
|
2579
|
-
function inet(name) {
|
|
2580
|
-
return new PgInetBuilder(name ?? "");
|
|
2581
|
-
}
|
|
2582
|
-
|
|
2583
|
-
// ../../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
|
|
2584
|
-
var PgIntegerBuilder = class extends PgIntColumnBaseBuilder {
|
|
2585
|
-
static [entityKind] = "PgIntegerBuilder";
|
|
2586
|
-
constructor(name) {
|
|
2587
|
-
super(name, "number", "PgInteger");
|
|
2588
|
-
}
|
|
2589
|
-
/** @internal */
|
|
2590
|
-
build(table) {
|
|
2591
|
-
return new PgInteger(table, this.config);
|
|
2592
|
-
}
|
|
2593
|
-
};
|
|
2594
|
-
var PgInteger = class extends PgColumn {
|
|
2595
|
-
static [entityKind] = "PgInteger";
|
|
2596
|
-
getSQLType() {
|
|
2597
|
-
return "integer";
|
|
2598
|
-
}
|
|
2599
|
-
mapFromDriverValue(value) {
|
|
2600
|
-
if (typeof value === "string") {
|
|
2601
|
-
return Number.parseInt(value);
|
|
2602
|
-
}
|
|
2603
|
-
return value;
|
|
2604
|
-
}
|
|
2605
|
-
};
|
|
2606
|
-
function integer(name) {
|
|
2607
|
-
return new PgIntegerBuilder(name ?? "");
|
|
2608
|
-
}
|
|
2609
|
-
|
|
2610
|
-
// ../../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
|
|
2611
|
-
var PgIntervalBuilder = class extends PgColumnBuilder {
|
|
2612
|
-
static [entityKind] = "PgIntervalBuilder";
|
|
2613
|
-
constructor(name, intervalConfig) {
|
|
2614
|
-
super(name, "string", "PgInterval");
|
|
2615
|
-
this.config.intervalConfig = intervalConfig;
|
|
2616
|
-
}
|
|
2617
|
-
/** @internal */
|
|
2618
|
-
build(table) {
|
|
2619
|
-
return new PgInterval(table, this.config);
|
|
2620
|
-
}
|
|
2621
|
-
};
|
|
2622
|
-
var PgInterval = class extends PgColumn {
|
|
2623
|
-
static [entityKind] = "PgInterval";
|
|
2624
|
-
fields = this.config.intervalConfig.fields;
|
|
2625
|
-
precision = this.config.intervalConfig.precision;
|
|
2626
|
-
getSQLType() {
|
|
2627
|
-
const fields = this.fields ? ` ${this.fields}` : "";
|
|
2628
|
-
const precision = this.precision ? `(${this.precision})` : "";
|
|
2629
|
-
return `interval${fields}${precision}`;
|
|
2630
|
-
}
|
|
2631
|
-
};
|
|
2632
|
-
function interval(a, b = {}) {
|
|
2633
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2634
|
-
return new PgIntervalBuilder(name, config);
|
|
2635
|
-
}
|
|
2636
|
-
|
|
2637
|
-
// ../../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
|
|
2638
|
-
var PgJsonBuilder = class extends PgColumnBuilder {
|
|
2639
|
-
static [entityKind] = "PgJsonBuilder";
|
|
2640
|
-
constructor(name) {
|
|
2641
|
-
super(name, "json", "PgJson");
|
|
2642
|
-
}
|
|
2643
|
-
/** @internal */
|
|
2644
|
-
build(table) {
|
|
2645
|
-
return new PgJson(table, this.config);
|
|
2646
|
-
}
|
|
2647
|
-
};
|
|
2648
|
-
var PgJson = class extends PgColumn {
|
|
2649
|
-
static [entityKind] = "PgJson";
|
|
2650
|
-
constructor(table, config) {
|
|
2651
|
-
super(table, config);
|
|
2652
|
-
}
|
|
2653
|
-
getSQLType() {
|
|
2654
|
-
return "json";
|
|
2655
|
-
}
|
|
2656
|
-
mapToDriverValue(value) {
|
|
2657
|
-
return JSON.stringify(value);
|
|
2658
|
-
}
|
|
2659
|
-
mapFromDriverValue(value) {
|
|
2660
|
-
if (typeof value === "string") {
|
|
2661
|
-
try {
|
|
2662
|
-
return JSON.parse(value);
|
|
2663
|
-
} catch {
|
|
2664
|
-
return value;
|
|
2665
|
-
}
|
|
2666
|
-
}
|
|
2667
|
-
return value;
|
|
2668
|
-
}
|
|
2669
|
-
};
|
|
2670
|
-
function json(name) {
|
|
2671
|
-
return new PgJsonBuilder(name ?? "");
|
|
2672
|
-
}
|
|
2673
|
-
|
|
2674
|
-
// ../../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
|
|
2675
|
-
var PgJsonbBuilder = class extends PgColumnBuilder {
|
|
2676
|
-
static [entityKind] = "PgJsonbBuilder";
|
|
2677
|
-
constructor(name) {
|
|
2678
|
-
super(name, "json", "PgJsonb");
|
|
2679
|
-
}
|
|
2680
|
-
/** @internal */
|
|
2681
|
-
build(table) {
|
|
2682
|
-
return new PgJsonb(table, this.config);
|
|
2683
|
-
}
|
|
2684
|
-
};
|
|
2685
|
-
var PgJsonb = class extends PgColumn {
|
|
2686
|
-
static [entityKind] = "PgJsonb";
|
|
2687
|
-
constructor(table, config) {
|
|
2688
|
-
super(table, config);
|
|
2689
|
-
}
|
|
2690
|
-
getSQLType() {
|
|
2691
|
-
return "jsonb";
|
|
2692
|
-
}
|
|
2693
|
-
mapToDriverValue(value) {
|
|
2694
|
-
return JSON.stringify(value);
|
|
2695
|
-
}
|
|
2696
|
-
mapFromDriverValue(value) {
|
|
2697
|
-
if (typeof value === "string") {
|
|
2698
|
-
try {
|
|
2699
|
-
return JSON.parse(value);
|
|
2700
|
-
} catch {
|
|
2701
|
-
return value;
|
|
2702
|
-
}
|
|
2703
|
-
}
|
|
2704
|
-
return value;
|
|
2705
|
-
}
|
|
2706
|
-
};
|
|
2707
|
-
function jsonb(name) {
|
|
2708
|
-
return new PgJsonbBuilder(name ?? "");
|
|
2709
|
-
}
|
|
2710
|
-
|
|
2711
|
-
// ../../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
|
|
2712
|
-
var PgLineBuilder = class extends PgColumnBuilder {
|
|
2713
|
-
static [entityKind] = "PgLineBuilder";
|
|
2714
|
-
constructor(name) {
|
|
2715
|
-
super(name, "array", "PgLine");
|
|
2716
|
-
}
|
|
2717
|
-
/** @internal */
|
|
2718
|
-
build(table) {
|
|
2719
|
-
return new PgLineTuple(
|
|
2720
|
-
table,
|
|
2721
|
-
this.config
|
|
2722
|
-
);
|
|
2723
|
-
}
|
|
2724
|
-
};
|
|
2725
|
-
var PgLineTuple = class extends PgColumn {
|
|
2726
|
-
static [entityKind] = "PgLine";
|
|
2727
|
-
getSQLType() {
|
|
2728
|
-
return "line";
|
|
2729
|
-
}
|
|
2730
|
-
mapFromDriverValue(value) {
|
|
2731
|
-
const [a, b, c2] = value.slice(1, -1).split(",");
|
|
2732
|
-
return [Number.parseFloat(a), Number.parseFloat(b), Number.parseFloat(c2)];
|
|
2733
|
-
}
|
|
2734
|
-
mapToDriverValue(value) {
|
|
2735
|
-
return `{${value[0]},${value[1]},${value[2]}}`;
|
|
2736
|
-
}
|
|
2737
|
-
};
|
|
2738
|
-
var PgLineABCBuilder = class extends PgColumnBuilder {
|
|
2739
|
-
static [entityKind] = "PgLineABCBuilder";
|
|
2740
|
-
constructor(name) {
|
|
2741
|
-
super(name, "json", "PgLineABC");
|
|
2742
|
-
}
|
|
2743
|
-
/** @internal */
|
|
2744
|
-
build(table) {
|
|
2745
|
-
return new PgLineABC(
|
|
2746
|
-
table,
|
|
2747
|
-
this.config
|
|
2748
|
-
);
|
|
2749
|
-
}
|
|
2750
|
-
};
|
|
2751
|
-
var PgLineABC = class extends PgColumn {
|
|
2752
|
-
static [entityKind] = "PgLineABC";
|
|
2753
|
-
getSQLType() {
|
|
2754
|
-
return "line";
|
|
2755
|
-
}
|
|
2756
|
-
mapFromDriverValue(value) {
|
|
2757
|
-
const [a, b, c2] = value.slice(1, -1).split(",");
|
|
2758
|
-
return { a: Number.parseFloat(a), b: Number.parseFloat(b), c: Number.parseFloat(c2) };
|
|
2759
|
-
}
|
|
2760
|
-
mapToDriverValue(value) {
|
|
2761
|
-
return `{${value.a},${value.b},${value.c}}`;
|
|
2762
|
-
}
|
|
2763
|
-
};
|
|
2764
|
-
function line(a, b) {
|
|
2765
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2766
|
-
if (!config?.mode || config.mode === "tuple") {
|
|
2767
|
-
return new PgLineBuilder(name);
|
|
2768
|
-
}
|
|
2769
|
-
return new PgLineABCBuilder(name);
|
|
2770
|
-
}
|
|
2771
|
-
|
|
2772
|
-
// ../../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
|
|
2773
|
-
var PgMacaddrBuilder = class extends PgColumnBuilder {
|
|
2774
|
-
static [entityKind] = "PgMacaddrBuilder";
|
|
2775
|
-
constructor(name) {
|
|
2776
|
-
super(name, "string", "PgMacaddr");
|
|
2777
|
-
}
|
|
2778
|
-
/** @internal */
|
|
2779
|
-
build(table) {
|
|
2780
|
-
return new PgMacaddr(table, this.config);
|
|
2781
|
-
}
|
|
2782
|
-
};
|
|
2783
|
-
var PgMacaddr = class extends PgColumn {
|
|
2784
|
-
static [entityKind] = "PgMacaddr";
|
|
2785
|
-
getSQLType() {
|
|
2786
|
-
return "macaddr";
|
|
2787
|
-
}
|
|
2788
|
-
};
|
|
2789
|
-
function macaddr(name) {
|
|
2790
|
-
return new PgMacaddrBuilder(name ?? "");
|
|
2791
|
-
}
|
|
2792
|
-
|
|
2793
|
-
// ../../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
|
|
2794
|
-
var PgMacaddr8Builder = class extends PgColumnBuilder {
|
|
2795
|
-
static [entityKind] = "PgMacaddr8Builder";
|
|
2796
|
-
constructor(name) {
|
|
2797
|
-
super(name, "string", "PgMacaddr8");
|
|
2798
|
-
}
|
|
2799
|
-
/** @internal */
|
|
2800
|
-
build(table) {
|
|
2801
|
-
return new PgMacaddr8(table, this.config);
|
|
2802
|
-
}
|
|
2803
|
-
};
|
|
2804
|
-
var PgMacaddr8 = class extends PgColumn {
|
|
2805
|
-
static [entityKind] = "PgMacaddr8";
|
|
2806
|
-
getSQLType() {
|
|
2807
|
-
return "macaddr8";
|
|
2808
|
-
}
|
|
2809
|
-
};
|
|
2810
|
-
function macaddr8(name) {
|
|
2811
|
-
return new PgMacaddr8Builder(name ?? "");
|
|
2812
|
-
}
|
|
2813
|
-
|
|
2814
|
-
// ../../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
|
|
2815
|
-
var PgNumericBuilder = class extends PgColumnBuilder {
|
|
2816
|
-
static [entityKind] = "PgNumericBuilder";
|
|
2817
|
-
constructor(name, precision, scale) {
|
|
2818
|
-
super(name, "string", "PgNumeric");
|
|
2819
|
-
this.config.precision = precision;
|
|
2820
|
-
this.config.scale = scale;
|
|
2821
|
-
}
|
|
2822
|
-
/** @internal */
|
|
2823
|
-
build(table) {
|
|
2824
|
-
return new PgNumeric(table, this.config);
|
|
2825
|
-
}
|
|
2826
|
-
};
|
|
2827
|
-
var PgNumeric = class extends PgColumn {
|
|
2828
|
-
static [entityKind] = "PgNumeric";
|
|
2829
|
-
precision;
|
|
2830
|
-
scale;
|
|
2831
|
-
constructor(table, config) {
|
|
2832
|
-
super(table, config);
|
|
2833
|
-
this.precision = config.precision;
|
|
2834
|
-
this.scale = config.scale;
|
|
2835
|
-
}
|
|
2836
|
-
mapFromDriverValue(value) {
|
|
2837
|
-
if (typeof value === "string") return value;
|
|
2838
|
-
return String(value);
|
|
2839
|
-
}
|
|
2840
|
-
getSQLType() {
|
|
2841
|
-
if (this.precision !== void 0 && this.scale !== void 0) {
|
|
2842
|
-
return `numeric(${this.precision}, ${this.scale})`;
|
|
2843
|
-
} else if (this.precision === void 0) {
|
|
2844
|
-
return "numeric";
|
|
2845
|
-
} else {
|
|
2846
|
-
return `numeric(${this.precision})`;
|
|
2847
|
-
}
|
|
2848
|
-
}
|
|
2849
|
-
};
|
|
2850
|
-
var PgNumericNumberBuilder = class extends PgColumnBuilder {
|
|
2851
|
-
static [entityKind] = "PgNumericNumberBuilder";
|
|
2852
|
-
constructor(name, precision, scale) {
|
|
2853
|
-
super(name, "number", "PgNumericNumber");
|
|
2854
|
-
this.config.precision = precision;
|
|
2855
|
-
this.config.scale = scale;
|
|
2856
|
-
}
|
|
2857
|
-
/** @internal */
|
|
2858
|
-
build(table) {
|
|
2859
|
-
return new PgNumericNumber(
|
|
2860
|
-
table,
|
|
2861
|
-
this.config
|
|
2862
|
-
);
|
|
2863
|
-
}
|
|
2864
|
-
};
|
|
2865
|
-
var PgNumericNumber = class extends PgColumn {
|
|
2866
|
-
static [entityKind] = "PgNumericNumber";
|
|
2867
|
-
precision;
|
|
2868
|
-
scale;
|
|
2869
|
-
constructor(table, config) {
|
|
2870
|
-
super(table, config);
|
|
2871
|
-
this.precision = config.precision;
|
|
2872
|
-
this.scale = config.scale;
|
|
2873
|
-
}
|
|
2874
|
-
mapFromDriverValue(value) {
|
|
2875
|
-
if (typeof value === "number") return value;
|
|
2876
|
-
return Number(value);
|
|
2877
|
-
}
|
|
2878
|
-
mapToDriverValue = String;
|
|
2879
|
-
getSQLType() {
|
|
2880
|
-
if (this.precision !== void 0 && this.scale !== void 0) {
|
|
2881
|
-
return `numeric(${this.precision}, ${this.scale})`;
|
|
2882
|
-
} else if (this.precision === void 0) {
|
|
2883
|
-
return "numeric";
|
|
2884
|
-
} else {
|
|
2885
|
-
return `numeric(${this.precision})`;
|
|
2886
|
-
}
|
|
2887
|
-
}
|
|
2888
|
-
};
|
|
2889
|
-
var PgNumericBigIntBuilder = class extends PgColumnBuilder {
|
|
2890
|
-
static [entityKind] = "PgNumericBigIntBuilder";
|
|
2891
|
-
constructor(name, precision, scale) {
|
|
2892
|
-
super(name, "bigint", "PgNumericBigInt");
|
|
2893
|
-
this.config.precision = precision;
|
|
2894
|
-
this.config.scale = scale;
|
|
2895
|
-
}
|
|
2896
|
-
/** @internal */
|
|
2897
|
-
build(table) {
|
|
2898
|
-
return new PgNumericBigInt(
|
|
2899
|
-
table,
|
|
2900
|
-
this.config
|
|
2901
|
-
);
|
|
2902
|
-
}
|
|
2903
|
-
};
|
|
2904
|
-
var PgNumericBigInt = class extends PgColumn {
|
|
2905
|
-
static [entityKind] = "PgNumericBigInt";
|
|
2906
|
-
precision;
|
|
2907
|
-
scale;
|
|
2908
|
-
constructor(table, config) {
|
|
2909
|
-
super(table, config);
|
|
2910
|
-
this.precision = config.precision;
|
|
2911
|
-
this.scale = config.scale;
|
|
2912
|
-
}
|
|
2913
|
-
mapFromDriverValue = BigInt;
|
|
2914
|
-
mapToDriverValue = String;
|
|
2915
|
-
getSQLType() {
|
|
2916
|
-
if (this.precision !== void 0 && this.scale !== void 0) {
|
|
2917
|
-
return `numeric(${this.precision}, ${this.scale})`;
|
|
2918
|
-
} else if (this.precision === void 0) {
|
|
2919
|
-
return "numeric";
|
|
2920
|
-
} else {
|
|
2921
|
-
return `numeric(${this.precision})`;
|
|
2922
|
-
}
|
|
2923
|
-
}
|
|
2924
|
-
};
|
|
2925
|
-
function numeric(a, b) {
|
|
2926
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2927
|
-
const mode = config?.mode;
|
|
2928
|
-
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);
|
|
2929
|
-
}
|
|
2930
|
-
|
|
2931
|
-
// ../../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
|
|
2932
|
-
var PgPointTupleBuilder = class extends PgColumnBuilder {
|
|
2933
|
-
static [entityKind] = "PgPointTupleBuilder";
|
|
2934
|
-
constructor(name) {
|
|
2935
|
-
super(name, "array", "PgPointTuple");
|
|
2936
|
-
}
|
|
2937
|
-
/** @internal */
|
|
2938
|
-
build(table) {
|
|
2939
|
-
return new PgPointTuple(
|
|
2940
|
-
table,
|
|
2941
|
-
this.config
|
|
2942
|
-
);
|
|
2943
|
-
}
|
|
2944
|
-
};
|
|
2945
|
-
var PgPointTuple = class extends PgColumn {
|
|
2946
|
-
static [entityKind] = "PgPointTuple";
|
|
2947
|
-
getSQLType() {
|
|
2948
|
-
return "point";
|
|
2949
|
-
}
|
|
2950
|
-
mapFromDriverValue(value) {
|
|
2951
|
-
if (typeof value === "string") {
|
|
2952
|
-
const [x, y] = value.slice(1, -1).split(",");
|
|
2953
|
-
return [Number.parseFloat(x), Number.parseFloat(y)];
|
|
2954
|
-
}
|
|
2955
|
-
return [value.x, value.y];
|
|
2956
|
-
}
|
|
2957
|
-
mapToDriverValue(value) {
|
|
2958
|
-
return `(${value[0]},${value[1]})`;
|
|
2959
|
-
}
|
|
2960
|
-
};
|
|
2961
|
-
var PgPointObjectBuilder = class extends PgColumnBuilder {
|
|
2962
|
-
static [entityKind] = "PgPointObjectBuilder";
|
|
2963
|
-
constructor(name) {
|
|
2964
|
-
super(name, "json", "PgPointObject");
|
|
2965
|
-
}
|
|
2966
|
-
/** @internal */
|
|
2967
|
-
build(table) {
|
|
2968
|
-
return new PgPointObject(
|
|
2969
|
-
table,
|
|
2970
|
-
this.config
|
|
2971
|
-
);
|
|
2972
|
-
}
|
|
2973
|
-
};
|
|
2974
|
-
var PgPointObject = class extends PgColumn {
|
|
2975
|
-
static [entityKind] = "PgPointObject";
|
|
2976
|
-
getSQLType() {
|
|
2977
|
-
return "point";
|
|
2978
|
-
}
|
|
2979
|
-
mapFromDriverValue(value) {
|
|
2980
|
-
if (typeof value === "string") {
|
|
2981
|
-
const [x, y] = value.slice(1, -1).split(",");
|
|
2982
|
-
return { x: Number.parseFloat(x), y: Number.parseFloat(y) };
|
|
2983
|
-
}
|
|
2984
|
-
return value;
|
|
2985
|
-
}
|
|
2986
|
-
mapToDriverValue(value) {
|
|
2987
|
-
return `(${value.x},${value.y})`;
|
|
2988
|
-
}
|
|
2989
|
-
};
|
|
2990
|
-
function point(a, b) {
|
|
2991
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
2992
|
-
if (!config?.mode || config.mode === "tuple") {
|
|
2993
|
-
return new PgPointTupleBuilder(name);
|
|
2994
|
-
}
|
|
2995
|
-
return new PgPointObjectBuilder(name);
|
|
2996
|
-
}
|
|
2997
|
-
|
|
2998
|
-
// ../../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
|
|
2999
|
-
function hexToBytes(hex) {
|
|
3000
|
-
const bytes = [];
|
|
3001
|
-
for (let c2 = 0; c2 < hex.length; c2 += 2) {
|
|
3002
|
-
bytes.push(Number.parseInt(hex.slice(c2, c2 + 2), 16));
|
|
3003
|
-
}
|
|
3004
|
-
return new Uint8Array(bytes);
|
|
3005
|
-
}
|
|
3006
|
-
function bytesToFloat64(bytes, offset) {
|
|
3007
|
-
const buffer = new ArrayBuffer(8);
|
|
3008
|
-
const view = new DataView(buffer);
|
|
3009
|
-
for (let i = 0; i < 8; i++) {
|
|
3010
|
-
view.setUint8(i, bytes[offset + i]);
|
|
3011
|
-
}
|
|
3012
|
-
return view.getFloat64(0, true);
|
|
3013
|
-
}
|
|
3014
|
-
function parseEWKB(hex) {
|
|
3015
|
-
const bytes = hexToBytes(hex);
|
|
3016
|
-
let offset = 0;
|
|
3017
|
-
const byteOrder = bytes[offset];
|
|
3018
|
-
offset += 1;
|
|
3019
|
-
const view = new DataView(bytes.buffer);
|
|
3020
|
-
const geomType = view.getUint32(offset, byteOrder === 1);
|
|
3021
|
-
offset += 4;
|
|
3022
|
-
let _srid;
|
|
3023
|
-
if (geomType & 536870912) {
|
|
3024
|
-
_srid = view.getUint32(offset, byteOrder === 1);
|
|
3025
|
-
offset += 4;
|
|
3026
|
-
}
|
|
3027
|
-
if ((geomType & 65535) === 1) {
|
|
3028
|
-
const x = bytesToFloat64(bytes, offset);
|
|
3029
|
-
offset += 8;
|
|
3030
|
-
const y = bytesToFloat64(bytes, offset);
|
|
3031
|
-
offset += 8;
|
|
3032
|
-
return [x, y];
|
|
3033
|
-
}
|
|
3034
|
-
throw new Error("Unsupported geometry type");
|
|
3035
|
-
}
|
|
3036
|
-
|
|
3037
|
-
// ../../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
|
|
3038
|
-
var PgGeometryBuilder = class extends PgColumnBuilder {
|
|
3039
|
-
static [entityKind] = "PgGeometryBuilder";
|
|
3040
|
-
constructor(name) {
|
|
3041
|
-
super(name, "array", "PgGeometry");
|
|
3042
|
-
}
|
|
3043
|
-
/** @internal */
|
|
3044
|
-
build(table) {
|
|
3045
|
-
return new PgGeometry(
|
|
3046
|
-
table,
|
|
3047
|
-
this.config
|
|
3048
|
-
);
|
|
3049
|
-
}
|
|
3050
|
-
};
|
|
3051
|
-
var PgGeometry = class extends PgColumn {
|
|
3052
|
-
static [entityKind] = "PgGeometry";
|
|
3053
|
-
getSQLType() {
|
|
3054
|
-
return "geometry(point)";
|
|
3055
|
-
}
|
|
3056
|
-
mapFromDriverValue(value) {
|
|
3057
|
-
return parseEWKB(value);
|
|
3058
|
-
}
|
|
3059
|
-
mapToDriverValue(value) {
|
|
3060
|
-
return `point(${value[0]} ${value[1]})`;
|
|
3061
|
-
}
|
|
3062
|
-
};
|
|
3063
|
-
var PgGeometryObjectBuilder = class extends PgColumnBuilder {
|
|
3064
|
-
static [entityKind] = "PgGeometryObjectBuilder";
|
|
3065
|
-
constructor(name) {
|
|
3066
|
-
super(name, "json", "PgGeometryObject");
|
|
3067
|
-
}
|
|
3068
|
-
/** @internal */
|
|
3069
|
-
build(table) {
|
|
3070
|
-
return new PgGeometryObject(
|
|
3071
|
-
table,
|
|
3072
|
-
this.config
|
|
3073
|
-
);
|
|
3074
|
-
}
|
|
3075
|
-
};
|
|
3076
|
-
var PgGeometryObject = class extends PgColumn {
|
|
3077
|
-
static [entityKind] = "PgGeometryObject";
|
|
3078
|
-
getSQLType() {
|
|
3079
|
-
return "geometry(point)";
|
|
3080
|
-
}
|
|
3081
|
-
mapFromDriverValue(value) {
|
|
3082
|
-
const parsed = parseEWKB(value);
|
|
3083
|
-
return { x: parsed[0], y: parsed[1] };
|
|
3084
|
-
}
|
|
3085
|
-
mapToDriverValue(value) {
|
|
3086
|
-
return `point(${value.x} ${value.y})`;
|
|
3087
|
-
}
|
|
3088
|
-
};
|
|
3089
|
-
function geometry(a, b) {
|
|
3090
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3091
|
-
if (!config?.mode || config.mode === "tuple") {
|
|
3092
|
-
return new PgGeometryBuilder(name);
|
|
3093
|
-
}
|
|
3094
|
-
return new PgGeometryObjectBuilder(name);
|
|
3095
|
-
}
|
|
3096
|
-
|
|
3097
|
-
// ../../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
|
|
3098
|
-
var PgRealBuilder = class extends PgColumnBuilder {
|
|
3099
|
-
static [entityKind] = "PgRealBuilder";
|
|
3100
|
-
constructor(name, length) {
|
|
3101
|
-
super(name, "number", "PgReal");
|
|
3102
|
-
this.config.length = length;
|
|
3103
|
-
}
|
|
3104
|
-
/** @internal */
|
|
3105
|
-
build(table) {
|
|
3106
|
-
return new PgReal(table, this.config);
|
|
3107
|
-
}
|
|
3108
|
-
};
|
|
3109
|
-
var PgReal = class extends PgColumn {
|
|
3110
|
-
static [entityKind] = "PgReal";
|
|
3111
|
-
constructor(table, config) {
|
|
3112
|
-
super(table, config);
|
|
3113
|
-
}
|
|
3114
|
-
getSQLType() {
|
|
3115
|
-
return "real";
|
|
3116
|
-
}
|
|
3117
|
-
mapFromDriverValue = (value) => {
|
|
3118
|
-
if (typeof value === "string") {
|
|
3119
|
-
return Number.parseFloat(value);
|
|
3120
|
-
}
|
|
3121
|
-
return value;
|
|
3122
|
-
};
|
|
3123
|
-
};
|
|
3124
|
-
function real(name) {
|
|
3125
|
-
return new PgRealBuilder(name ?? "");
|
|
3126
|
-
}
|
|
3127
|
-
|
|
3128
|
-
// ../../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
|
|
3129
|
-
var PgSerialBuilder = class extends PgColumnBuilder {
|
|
3130
|
-
static [entityKind] = "PgSerialBuilder";
|
|
3131
|
-
constructor(name) {
|
|
3132
|
-
super(name, "number", "PgSerial");
|
|
3133
|
-
this.config.hasDefault = true;
|
|
3134
|
-
this.config.notNull = true;
|
|
3135
|
-
}
|
|
3136
|
-
/** @internal */
|
|
3137
|
-
build(table) {
|
|
3138
|
-
return new PgSerial(table, this.config);
|
|
3139
|
-
}
|
|
3140
|
-
};
|
|
3141
|
-
var PgSerial = class extends PgColumn {
|
|
3142
|
-
static [entityKind] = "PgSerial";
|
|
3143
|
-
getSQLType() {
|
|
3144
|
-
return "serial";
|
|
3145
|
-
}
|
|
3146
|
-
};
|
|
3147
|
-
function serial(name) {
|
|
3148
|
-
return new PgSerialBuilder(name ?? "");
|
|
3149
|
-
}
|
|
3150
|
-
|
|
3151
|
-
// ../../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
|
|
3152
|
-
var PgSmallIntBuilder = class extends PgIntColumnBaseBuilder {
|
|
3153
|
-
static [entityKind] = "PgSmallIntBuilder";
|
|
3154
|
-
constructor(name) {
|
|
3155
|
-
super(name, "number", "PgSmallInt");
|
|
3156
|
-
}
|
|
3157
|
-
/** @internal */
|
|
3158
|
-
build(table) {
|
|
3159
|
-
return new PgSmallInt(table, this.config);
|
|
3160
|
-
}
|
|
3161
|
-
};
|
|
3162
|
-
var PgSmallInt = class extends PgColumn {
|
|
3163
|
-
static [entityKind] = "PgSmallInt";
|
|
3164
|
-
getSQLType() {
|
|
3165
|
-
return "smallint";
|
|
3166
|
-
}
|
|
3167
|
-
mapFromDriverValue = (value) => {
|
|
3168
|
-
if (typeof value === "string") {
|
|
3169
|
-
return Number(value);
|
|
3170
|
-
}
|
|
3171
|
-
return value;
|
|
3172
|
-
};
|
|
3173
|
-
};
|
|
3174
|
-
function smallint(name) {
|
|
3175
|
-
return new PgSmallIntBuilder(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/smallserial.js
|
|
3179
|
-
var PgSmallSerialBuilder = class extends PgColumnBuilder {
|
|
3180
|
-
static [entityKind] = "PgSmallSerialBuilder";
|
|
3181
|
-
constructor(name) {
|
|
3182
|
-
super(name, "number", "PgSmallSerial");
|
|
3183
|
-
this.config.hasDefault = true;
|
|
3184
|
-
this.config.notNull = true;
|
|
3185
|
-
}
|
|
3186
|
-
/** @internal */
|
|
3187
|
-
build(table) {
|
|
3188
|
-
return new PgSmallSerial(
|
|
3189
|
-
table,
|
|
3190
|
-
this.config
|
|
3191
|
-
);
|
|
3192
|
-
}
|
|
3193
|
-
};
|
|
3194
|
-
var PgSmallSerial = class extends PgColumn {
|
|
3195
|
-
static [entityKind] = "PgSmallSerial";
|
|
3196
|
-
getSQLType() {
|
|
3197
|
-
return "smallserial";
|
|
3198
|
-
}
|
|
3199
|
-
};
|
|
3200
|
-
function smallserial(name) {
|
|
3201
|
-
return new PgSmallSerialBuilder(name ?? "");
|
|
3202
|
-
}
|
|
3203
|
-
|
|
3204
|
-
// ../../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
|
|
3205
|
-
var PgTextBuilder = class extends PgColumnBuilder {
|
|
3206
|
-
static [entityKind] = "PgTextBuilder";
|
|
3207
|
-
constructor(name, config) {
|
|
3208
|
-
super(name, "string", "PgText");
|
|
3209
|
-
this.config.enumValues = config.enum;
|
|
3210
|
-
}
|
|
3211
|
-
/** @internal */
|
|
3212
|
-
build(table) {
|
|
3213
|
-
return new PgText(table, this.config);
|
|
3214
|
-
}
|
|
3215
|
-
};
|
|
3216
|
-
var PgText = class extends PgColumn {
|
|
3217
|
-
static [entityKind] = "PgText";
|
|
3218
|
-
enumValues = this.config.enumValues;
|
|
3219
|
-
getSQLType() {
|
|
3220
|
-
return "text";
|
|
3221
|
-
}
|
|
3222
|
-
};
|
|
3223
|
-
function text(a, b = {}) {
|
|
3224
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3225
|
-
return new PgTextBuilder(name, config);
|
|
222
|
+
});
|
|
223
|
+
resolve(key);
|
|
224
|
+
} else {
|
|
225
|
+
res.writeHead(400);
|
|
226
|
+
res.end("Missing key parameter");
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
server.listen(0, "127.0.0.1", () => {
|
|
230
|
+
const addr = server.address();
|
|
231
|
+
if (!addr || typeof addr === "string") {
|
|
232
|
+
reject(new Error("Failed to start callback server"));
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
const callbackPort = addr.port;
|
|
236
|
+
const authUrl = `${baseUrl}/api/auth/cli?callback=http://127.0.0.1:${callbackPort}`;
|
|
237
|
+
openBrowser(authUrl);
|
|
238
|
+
});
|
|
239
|
+
setTimeout(() => {
|
|
240
|
+
server.close();
|
|
241
|
+
reject(new Error("Authentication timed out"));
|
|
242
|
+
}, 12e4);
|
|
243
|
+
});
|
|
244
|
+
check("Authenticated with Basestream");
|
|
245
|
+
return apiKey;
|
|
3226
246
|
}
|
|
3227
247
|
|
|
3228
|
-
//
|
|
3229
|
-
var
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
static [entityKind] = "PgTime";
|
|
3245
|
-
withTimezone;
|
|
3246
|
-
precision;
|
|
3247
|
-
constructor(table, config) {
|
|
3248
|
-
super(table, config);
|
|
3249
|
-
this.withTimezone = config.withTimezone;
|
|
3250
|
-
this.precision = config.precision;
|
|
3251
|
-
}
|
|
3252
|
-
getSQLType() {
|
|
3253
|
-
const precision = this.precision === void 0 ? "" : `(${this.precision})`;
|
|
3254
|
-
return `time${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
3255
|
-
}
|
|
3256
|
-
};
|
|
3257
|
-
function time(a, b = {}) {
|
|
3258
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3259
|
-
return new PgTimeBuilder(name, config.withTimezone ?? false, config.precision);
|
|
3260
|
-
}
|
|
248
|
+
// src/cli/commands/init.ts
|
|
249
|
+
var CLAUDE_DIR = path2.join(os2.homedir(), ".claude");
|
|
250
|
+
var CLAUDE_SETTINGS_PATH = path2.join(CLAUDE_DIR, "settings.json");
|
|
251
|
+
var CLAUDE_SKILLS_PATH = path2.join(CLAUDE_DIR, "skills", "bs-summarize.md");
|
|
252
|
+
var CLAUDE_MD_PATH = path2.join(CLAUDE_DIR, "CLAUDE.md");
|
|
253
|
+
var HOOK_COMMAND = "npx @basestream/cli _hook-stop";
|
|
254
|
+
var HOOK_MARKER = "_hook-stop";
|
|
255
|
+
var CLAUDE_MD_MARKER = "<!-- basestream -->";
|
|
256
|
+
var CLAUDE_MD_RULE = `${CLAUDE_MD_MARKER}
|
|
257
|
+
- Before starting any non-trivial task, if the reason or context behind the work isn't already clear, ask: "What's the context for this?" Skip this for small tasks, typo fixes, or anything self-explanatory.
|
|
258
|
+
- After completing any meaningful work (fixing a bug, implementing a feature, making a significant change), invoke /bs-summarize to keep the session summary up to date. Include the "why" if it was provided.
|
|
259
|
+
<!-- /basestream -->`;
|
|
260
|
+
var SKILL_CONTENT = `---
|
|
261
|
+
name: bs-summarize
|
|
262
|
+
description: Update the Basestream session summary with what's been accomplished so far
|
|
263
|
+
---
|
|
3261
264
|
|
|
3262
|
-
|
|
3263
|
-
var PgTimestampBuilder = class extends PgDateColumnBaseBuilder {
|
|
3264
|
-
static [entityKind] = "PgTimestampBuilder";
|
|
3265
|
-
constructor(name, withTimezone, precision) {
|
|
3266
|
-
super(name, "date", "PgTimestamp");
|
|
3267
|
-
this.config.withTimezone = withTimezone;
|
|
3268
|
-
this.config.precision = precision;
|
|
3269
|
-
}
|
|
3270
|
-
/** @internal */
|
|
3271
|
-
build(table) {
|
|
3272
|
-
return new PgTimestamp(table, this.config);
|
|
3273
|
-
}
|
|
3274
|
-
};
|
|
3275
|
-
var PgTimestamp = class extends PgColumn {
|
|
3276
|
-
static [entityKind] = "PgTimestamp";
|
|
3277
|
-
withTimezone;
|
|
3278
|
-
precision;
|
|
3279
|
-
constructor(table, config) {
|
|
3280
|
-
super(table, config);
|
|
3281
|
-
this.withTimezone = config.withTimezone;
|
|
3282
|
-
this.precision = config.precision;
|
|
3283
|
-
}
|
|
3284
|
-
getSQLType() {
|
|
3285
|
-
const precision = this.precision === void 0 ? "" : ` (${this.precision})`;
|
|
3286
|
-
return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
3287
|
-
}
|
|
3288
|
-
mapFromDriverValue(value) {
|
|
3289
|
-
if (typeof value === "string") return new Date(this.withTimezone ? value : value + "+0000");
|
|
3290
|
-
return value;
|
|
3291
|
-
}
|
|
3292
|
-
mapToDriverValue = (value) => {
|
|
3293
|
-
return value.toISOString();
|
|
3294
|
-
};
|
|
3295
|
-
};
|
|
3296
|
-
var PgTimestampStringBuilder = class extends PgDateColumnBaseBuilder {
|
|
3297
|
-
static [entityKind] = "PgTimestampStringBuilder";
|
|
3298
|
-
constructor(name, withTimezone, precision) {
|
|
3299
|
-
super(name, "string", "PgTimestampString");
|
|
3300
|
-
this.config.withTimezone = withTimezone;
|
|
3301
|
-
this.config.precision = precision;
|
|
3302
|
-
}
|
|
3303
|
-
/** @internal */
|
|
3304
|
-
build(table) {
|
|
3305
|
-
return new PgTimestampString(
|
|
3306
|
-
table,
|
|
3307
|
-
this.config
|
|
3308
|
-
);
|
|
3309
|
-
}
|
|
3310
|
-
};
|
|
3311
|
-
var PgTimestampString = class extends PgColumn {
|
|
3312
|
-
static [entityKind] = "PgTimestampString";
|
|
3313
|
-
withTimezone;
|
|
3314
|
-
precision;
|
|
3315
|
-
constructor(table, config) {
|
|
3316
|
-
super(table, config);
|
|
3317
|
-
this.withTimezone = config.withTimezone;
|
|
3318
|
-
this.precision = config.precision;
|
|
3319
|
-
}
|
|
3320
|
-
getSQLType() {
|
|
3321
|
-
const precision = this.precision === void 0 ? "" : `(${this.precision})`;
|
|
3322
|
-
return `timestamp${precision}${this.withTimezone ? " with time zone" : ""}`;
|
|
3323
|
-
}
|
|
3324
|
-
mapFromDriverValue(value) {
|
|
3325
|
-
if (typeof value === "string") return value;
|
|
3326
|
-
const shortened = value.toISOString().slice(0, -1).replace("T", " ");
|
|
3327
|
-
if (this.withTimezone) {
|
|
3328
|
-
const offset = value.getTimezoneOffset();
|
|
3329
|
-
const sign = offset <= 0 ? "+" : "-";
|
|
3330
|
-
return `${shortened}${sign}${Math.floor(Math.abs(offset) / 60).toString().padStart(2, "0")}`;
|
|
3331
|
-
}
|
|
3332
|
-
return shortened;
|
|
3333
|
-
}
|
|
3334
|
-
};
|
|
3335
|
-
function timestamp(a, b = {}) {
|
|
3336
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3337
|
-
if (config?.mode === "string") {
|
|
3338
|
-
return new PgTimestampStringBuilder(name, config.withTimezone ?? false, config.precision);
|
|
3339
|
-
}
|
|
3340
|
-
return new PgTimestampBuilder(name, config?.withTimezone ?? false, config?.precision);
|
|
3341
|
-
}
|
|
265
|
+
First, read the existing summary file at \`~/.basestream/sessions/\${CLAUDE_SESSION_ID}-summary.md\` if it exists \u2014 this is the running record of work done so far this session.
|
|
3342
266
|
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
}
|
|
3349
|
-
/**
|
|
3350
|
-
* Adds `default gen_random_uuid()` to the column definition.
|
|
3351
|
-
*/
|
|
3352
|
-
defaultRandom() {
|
|
3353
|
-
return this.default(sql`gen_random_uuid()`);
|
|
3354
|
-
}
|
|
3355
|
-
/** @internal */
|
|
3356
|
-
build(table) {
|
|
3357
|
-
return new PgUUID(table, this.config);
|
|
3358
|
-
}
|
|
3359
|
-
};
|
|
3360
|
-
var PgUUID = class extends PgColumn {
|
|
3361
|
-
static [entityKind] = "PgUUID";
|
|
3362
|
-
getSQLType() {
|
|
3363
|
-
return "uuid";
|
|
3364
|
-
}
|
|
3365
|
-
};
|
|
3366
|
-
function uuid(name) {
|
|
3367
|
-
return new PgUUIDBuilder(name ?? "");
|
|
3368
|
-
}
|
|
267
|
+
Then write an updated summary that aggregates the previous summary with everything that has happened since. Focus on:
|
|
268
|
+
- Why the work was done (if context was provided \u2014 skip if not known)
|
|
269
|
+
- What was built, fixed, or changed (be specific about features/bugs)
|
|
270
|
+
- Which parts of the codebase were touched
|
|
271
|
+
- Any key decisions made
|
|
3369
272
|
|
|
3370
|
-
|
|
3371
|
-
var PgVarcharBuilder = class extends PgColumnBuilder {
|
|
3372
|
-
static [entityKind] = "PgVarcharBuilder";
|
|
3373
|
-
constructor(name, config) {
|
|
3374
|
-
super(name, "string", "PgVarchar");
|
|
3375
|
-
this.config.length = config.length;
|
|
3376
|
-
this.config.enumValues = config.enum;
|
|
3377
|
-
}
|
|
3378
|
-
/** @internal */
|
|
3379
|
-
build(table) {
|
|
3380
|
-
return new PgVarchar(
|
|
3381
|
-
table,
|
|
3382
|
-
this.config
|
|
3383
|
-
);
|
|
3384
|
-
}
|
|
3385
|
-
};
|
|
3386
|
-
var PgVarchar = class extends PgColumn {
|
|
3387
|
-
static [entityKind] = "PgVarchar";
|
|
3388
|
-
length = this.config.length;
|
|
3389
|
-
enumValues = this.config.enumValues;
|
|
3390
|
-
getSQLType() {
|
|
3391
|
-
return this.length === void 0 ? `varchar` : `varchar(${this.length})`;
|
|
3392
|
-
}
|
|
3393
|
-
};
|
|
3394
|
-
function varchar(a, b = {}) {
|
|
3395
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3396
|
-
return new PgVarcharBuilder(name, config);
|
|
3397
|
-
}
|
|
273
|
+
Do not just append \u2014 synthesize everything into a single cohesive summary. Merge related work together, avoid repeating the same point twice, and drop anything superseded by later changes. Be concise \u2014 let the scope of the work determine the length. A small fix deserves one sentence; a large multi-part session can be a short paragraph. Plain prose, no bullet points.
|
|
3398
274
|
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
}
|
|
3406
|
-
/** @internal */
|
|
3407
|
-
build(table) {
|
|
3408
|
-
return new PgBinaryVector(
|
|
3409
|
-
table,
|
|
3410
|
-
this.config
|
|
3411
|
-
);
|
|
3412
|
-
}
|
|
3413
|
-
};
|
|
3414
|
-
var PgBinaryVector = class extends PgColumn {
|
|
3415
|
-
static [entityKind] = "PgBinaryVector";
|
|
3416
|
-
dimensions = this.config.dimensions;
|
|
3417
|
-
getSQLType() {
|
|
3418
|
-
return `bit(${this.dimensions})`;
|
|
275
|
+
Write the result to \`~/.basestream/sessions/\${CLAUDE_SESSION_ID}-summary.md\`, overwriting the file.
|
|
276
|
+
`;
|
|
277
|
+
function injectClaudeMdRule() {
|
|
278
|
+
let existing = "";
|
|
279
|
+
if (fs2.existsSync(CLAUDE_MD_PATH)) {
|
|
280
|
+
existing = fs2.readFileSync(CLAUDE_MD_PATH, "utf-8");
|
|
3419
281
|
}
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
|
|
3424
|
-
|
|
282
|
+
let updated;
|
|
283
|
+
if (existing.includes(CLAUDE_MD_MARKER)) {
|
|
284
|
+
updated = existing.replace(/<!-- basestream -->[\s\S]*?<!-- \/basestream -->/, CLAUDE_MD_RULE);
|
|
285
|
+
fs2.writeFileSync(CLAUDE_MD_PATH, updated);
|
|
286
|
+
check("Updated Basestream rules in ~/.claude/CLAUDE.md");
|
|
287
|
+
} else {
|
|
288
|
+
updated = existing ? `${existing.trimEnd()}
|
|
3425
289
|
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
}
|
|
3433
|
-
/** @internal */
|
|
3434
|
-
build(table) {
|
|
3435
|
-
return new PgHalfVector(
|
|
3436
|
-
table,
|
|
3437
|
-
this.config
|
|
3438
|
-
);
|
|
3439
|
-
}
|
|
3440
|
-
};
|
|
3441
|
-
var PgHalfVector = class extends PgColumn {
|
|
3442
|
-
static [entityKind] = "PgHalfVector";
|
|
3443
|
-
dimensions = this.config.dimensions;
|
|
3444
|
-
getSQLType() {
|
|
3445
|
-
return `halfvec(${this.dimensions})`;
|
|
3446
|
-
}
|
|
3447
|
-
mapToDriverValue(value) {
|
|
3448
|
-
return JSON.stringify(value);
|
|
3449
|
-
}
|
|
3450
|
-
mapFromDriverValue(value) {
|
|
3451
|
-
return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
|
|
290
|
+
${CLAUDE_MD_RULE}
|
|
291
|
+
` : `${CLAUDE_MD_RULE}
|
|
292
|
+
`;
|
|
293
|
+
fs2.mkdirSync(CLAUDE_DIR, { recursive: true });
|
|
294
|
+
fs2.writeFileSync(CLAUDE_MD_PATH, updated);
|
|
295
|
+
check("Injected Basestream rules into ~/.claude/CLAUDE.md");
|
|
3452
296
|
}
|
|
3453
|
-
};
|
|
3454
|
-
function halfvec(a, b) {
|
|
3455
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3456
|
-
return new PgHalfVectorBuilder(name, config);
|
|
3457
297
|
}
|
|
3458
|
-
|
|
3459
|
-
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
|
|
3463
|
-
super(name, "string", "PgSparseVector");
|
|
3464
|
-
this.config.dimensions = config.dimensions;
|
|
3465
|
-
}
|
|
3466
|
-
/** @internal */
|
|
3467
|
-
build(table) {
|
|
3468
|
-
return new PgSparseVector(
|
|
3469
|
-
table,
|
|
3470
|
-
this.config
|
|
3471
|
-
);
|
|
3472
|
-
}
|
|
3473
|
-
};
|
|
3474
|
-
var PgSparseVector = class extends PgColumn {
|
|
3475
|
-
static [entityKind] = "PgSparseVector";
|
|
3476
|
-
dimensions = this.config.dimensions;
|
|
3477
|
-
getSQLType() {
|
|
3478
|
-
return `sparsevec(${this.dimensions})`;
|
|
3479
|
-
}
|
|
3480
|
-
};
|
|
3481
|
-
function sparsevec(a, b) {
|
|
3482
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3483
|
-
return new PgSparseVectorBuilder(name, config);
|
|
298
|
+
function installSkill() {
|
|
299
|
+
const skillsDir = path2.dirname(CLAUDE_SKILLS_PATH);
|
|
300
|
+
fs2.mkdirSync(skillsDir, { recursive: true });
|
|
301
|
+
fs2.writeFileSync(CLAUDE_SKILLS_PATH, SKILL_CONTENT);
|
|
302
|
+
check("Installed /bs-summarize skill into ~/.claude/skills/");
|
|
3484
303
|
}
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
/** @internal */
|
|
3494
|
-
build(table) {
|
|
3495
|
-
return new PgVector(
|
|
3496
|
-
table,
|
|
3497
|
-
this.config
|
|
3498
|
-
);
|
|
3499
|
-
}
|
|
3500
|
-
};
|
|
3501
|
-
var PgVector = class extends PgColumn {
|
|
3502
|
-
static [entityKind] = "PgVector";
|
|
3503
|
-
dimensions = this.config.dimensions;
|
|
3504
|
-
getSQLType() {
|
|
3505
|
-
return `vector(${this.dimensions})`;
|
|
3506
|
-
}
|
|
3507
|
-
mapToDriverValue(value) {
|
|
3508
|
-
return JSON.stringify(value);
|
|
3509
|
-
}
|
|
3510
|
-
mapFromDriverValue(value) {
|
|
3511
|
-
return value.slice(1, -1).split(",").map((v) => Number.parseFloat(v));
|
|
304
|
+
function detectClaudeCode() {
|
|
305
|
+
try {
|
|
306
|
+
const version = execSync2("claude --version 2>/dev/null", {
|
|
307
|
+
encoding: "utf-8"
|
|
308
|
+
}).trim();
|
|
309
|
+
return version || null;
|
|
310
|
+
} catch {
|
|
311
|
+
return null;
|
|
3512
312
|
}
|
|
3513
|
-
};
|
|
3514
|
-
function vector(a, b) {
|
|
3515
|
-
const { name, config } = getColumnNameAndConfig(a, b);
|
|
3516
|
-
return new PgVectorBuilder(name, config);
|
|
3517
|
-
}
|
|
3518
|
-
|
|
3519
|
-
// ../../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
|
|
3520
|
-
function getPgColumnBuilders() {
|
|
3521
|
-
return {
|
|
3522
|
-
bigint,
|
|
3523
|
-
bigserial,
|
|
3524
|
-
boolean,
|
|
3525
|
-
char,
|
|
3526
|
-
cidr,
|
|
3527
|
-
customType,
|
|
3528
|
-
date,
|
|
3529
|
-
doublePrecision,
|
|
3530
|
-
inet,
|
|
3531
|
-
integer,
|
|
3532
|
-
interval,
|
|
3533
|
-
json,
|
|
3534
|
-
jsonb,
|
|
3535
|
-
line,
|
|
3536
|
-
macaddr,
|
|
3537
|
-
macaddr8,
|
|
3538
|
-
numeric,
|
|
3539
|
-
point,
|
|
3540
|
-
geometry,
|
|
3541
|
-
real,
|
|
3542
|
-
serial,
|
|
3543
|
-
smallint,
|
|
3544
|
-
smallserial,
|
|
3545
|
-
text,
|
|
3546
|
-
time,
|
|
3547
|
-
timestamp,
|
|
3548
|
-
uuid,
|
|
3549
|
-
varchar,
|
|
3550
|
-
bit,
|
|
3551
|
-
halfvec,
|
|
3552
|
-
sparsevec,
|
|
3553
|
-
vector
|
|
3554
|
-
};
|
|
3555
313
|
}
|
|
3556
|
-
|
|
3557
|
-
|
|
3558
|
-
|
|
3559
|
-
|
|
3560
|
-
|
|
3561
|
-
|
|
3562
|
-
|
|
3563
|
-
|
|
3564
|
-
InlineForeignKeys,
|
|
3565
|
-
EnableRLS
|
|
3566
|
-
});
|
|
3567
|
-
/**@internal */
|
|
3568
|
-
[InlineForeignKeys] = [];
|
|
3569
|
-
/** @internal */
|
|
3570
|
-
[EnableRLS] = false;
|
|
3571
|
-
/** @internal */
|
|
3572
|
-
[Table.Symbol.ExtraConfigBuilder] = void 0;
|
|
3573
|
-
/** @internal */
|
|
3574
|
-
[Table.Symbol.ExtraConfigColumns] = {};
|
|
3575
|
-
};
|
|
3576
|
-
function pgTableWithSchema(name, columns, extraConfig, schema, baseName = name) {
|
|
3577
|
-
const rawTable = new PgTable(name, schema, baseName);
|
|
3578
|
-
const parsedColumns = typeof columns === "function" ? columns(getPgColumnBuilders()) : columns;
|
|
3579
|
-
const builtColumns = Object.fromEntries(
|
|
3580
|
-
Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
|
|
3581
|
-
const colBuilder = colBuilderBase;
|
|
3582
|
-
colBuilder.setName(name2);
|
|
3583
|
-
const column = colBuilder.build(rawTable);
|
|
3584
|
-
rawTable[InlineForeignKeys].push(...colBuilder.buildForeignKeys(column, rawTable));
|
|
3585
|
-
return [name2, column];
|
|
3586
|
-
})
|
|
3587
|
-
);
|
|
3588
|
-
const builtColumnsForExtraConfig = Object.fromEntries(
|
|
3589
|
-
Object.entries(parsedColumns).map(([name2, colBuilderBase]) => {
|
|
3590
|
-
const colBuilder = colBuilderBase;
|
|
3591
|
-
colBuilder.setName(name2);
|
|
3592
|
-
const column = colBuilder.buildExtraConfigColumn(rawTable);
|
|
3593
|
-
return [name2, column];
|
|
3594
|
-
})
|
|
3595
|
-
);
|
|
3596
|
-
const table = Object.assign(rawTable, builtColumns);
|
|
3597
|
-
table[Table.Symbol.Columns] = builtColumns;
|
|
3598
|
-
table[Table.Symbol.ExtraConfigColumns] = builtColumnsForExtraConfig;
|
|
3599
|
-
if (extraConfig) {
|
|
3600
|
-
table[PgTable.Symbol.ExtraConfigBuilder] = extraConfig;
|
|
3601
|
-
}
|
|
3602
|
-
return Object.assign(table, {
|
|
3603
|
-
enableRLS: () => {
|
|
3604
|
-
table[PgTable.Symbol.EnableRLS] = true;
|
|
3605
|
-
return table;
|
|
314
|
+
function injectClaudeCodeHook() {
|
|
315
|
+
const settingsDir = path2.dirname(CLAUDE_SETTINGS_PATH);
|
|
316
|
+
fs2.mkdirSync(settingsDir, { recursive: true });
|
|
317
|
+
let settings = {};
|
|
318
|
+
if (fs2.existsSync(CLAUDE_SETTINGS_PATH)) {
|
|
319
|
+
try {
|
|
320
|
+
settings = JSON.parse(fs2.readFileSync(CLAUDE_SETTINGS_PATH, "utf-8"));
|
|
321
|
+
} catch {
|
|
3606
322
|
}
|
|
3607
|
-
});
|
|
3608
|
-
}
|
|
3609
|
-
var pgTable = (name, columns, extraConfig) => {
|
|
3610
|
-
return pgTableWithSchema(name, columns, extraConfig, void 0);
|
|
3611
|
-
};
|
|
3612
|
-
|
|
3613
|
-
// ../../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
|
|
3614
|
-
var IndexBuilderOn = class {
|
|
3615
|
-
constructor(unique, name) {
|
|
3616
|
-
this.unique = unique;
|
|
3617
|
-
this.name = name;
|
|
3618
|
-
}
|
|
3619
|
-
static [entityKind] = "PgIndexBuilderOn";
|
|
3620
|
-
on(...columns) {
|
|
3621
|
-
return new IndexBuilder(
|
|
3622
|
-
columns.map((it) => {
|
|
3623
|
-
if (is(it, SQL)) {
|
|
3624
|
-
return it;
|
|
3625
|
-
}
|
|
3626
|
-
it = it;
|
|
3627
|
-
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
|
|
3628
|
-
it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
|
|
3629
|
-
return clonedIndexedColumn;
|
|
3630
|
-
}),
|
|
3631
|
-
this.unique,
|
|
3632
|
-
false,
|
|
3633
|
-
this.name
|
|
3634
|
-
);
|
|
3635
323
|
}
|
|
3636
|
-
|
|
3637
|
-
|
|
3638
|
-
columns.map((it) => {
|
|
3639
|
-
if (is(it, SQL)) {
|
|
3640
|
-
return it;
|
|
3641
|
-
}
|
|
3642
|
-
it = it;
|
|
3643
|
-
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
|
|
3644
|
-
it.indexConfig = it.defaultConfig;
|
|
3645
|
-
return clonedIndexedColumn;
|
|
3646
|
-
}),
|
|
3647
|
-
this.unique,
|
|
3648
|
-
true,
|
|
3649
|
-
this.name
|
|
3650
|
-
);
|
|
324
|
+
if (!settings.hooks || typeof settings.hooks !== "object") {
|
|
325
|
+
settings.hooks = {};
|
|
3651
326
|
}
|
|
3652
|
-
|
|
3653
|
-
|
|
3654
|
-
|
|
3655
|
-
|
|
3656
|
-
|
|
3657
|
-
* **You can always specify any string you want in the method, in case Drizzle doesn't have it natively in its types**
|
|
3658
|
-
*
|
|
3659
|
-
* @param method The name of the index method to be used
|
|
3660
|
-
* @param columns
|
|
3661
|
-
* @returns
|
|
3662
|
-
*/
|
|
3663
|
-
using(method, ...columns) {
|
|
3664
|
-
return new IndexBuilder(
|
|
3665
|
-
columns.map((it) => {
|
|
3666
|
-
if (is(it, SQL)) {
|
|
3667
|
-
return it;
|
|
3668
|
-
}
|
|
3669
|
-
it = it;
|
|
3670
|
-
const clonedIndexedColumn = new IndexedColumn(it.name, !!it.keyAsName, it.columnType, it.indexConfig);
|
|
3671
|
-
it.indexConfig = JSON.parse(JSON.stringify(it.defaultConfig));
|
|
3672
|
-
return clonedIndexedColumn;
|
|
3673
|
-
}),
|
|
3674
|
-
this.unique,
|
|
3675
|
-
true,
|
|
3676
|
-
this.name,
|
|
3677
|
-
method
|
|
327
|
+
const hooks = settings.hooks;
|
|
328
|
+
if (Array.isArray(hooks.Stop)) {
|
|
329
|
+
const existing = hooks.Stop;
|
|
330
|
+
const alreadyInstalled = existing.some(
|
|
331
|
+
(entry) => entry.hooks?.some((h) => h.command?.includes(HOOK_MARKER))
|
|
3678
332
|
);
|
|
333
|
+
if (alreadyInstalled) {
|
|
334
|
+
check("Claude Code hook already installed");
|
|
335
|
+
return;
|
|
336
|
+
}
|
|
3679
337
|
}
|
|
3680
|
-
|
|
3681
|
-
|
|
3682
|
-
static [entityKind] = "PgIndexBuilder";
|
|
3683
|
-
/** @internal */
|
|
3684
|
-
config;
|
|
3685
|
-
constructor(columns, unique, only, name, method = "btree") {
|
|
3686
|
-
this.config = {
|
|
3687
|
-
name,
|
|
3688
|
-
columns,
|
|
3689
|
-
unique,
|
|
3690
|
-
only,
|
|
3691
|
-
method
|
|
3692
|
-
};
|
|
3693
|
-
}
|
|
3694
|
-
concurrently() {
|
|
3695
|
-
this.config.concurrently = true;
|
|
3696
|
-
return this;
|
|
3697
|
-
}
|
|
3698
|
-
with(obj) {
|
|
3699
|
-
this.config.with = obj;
|
|
3700
|
-
return this;
|
|
3701
|
-
}
|
|
3702
|
-
where(condition) {
|
|
3703
|
-
this.config.where = condition;
|
|
3704
|
-
return this;
|
|
3705
|
-
}
|
|
3706
|
-
/** @internal */
|
|
3707
|
-
build(table) {
|
|
3708
|
-
return new Index(this.config, table);
|
|
3709
|
-
}
|
|
3710
|
-
};
|
|
3711
|
-
var Index = class {
|
|
3712
|
-
static [entityKind] = "PgIndex";
|
|
3713
|
-
config;
|
|
3714
|
-
constructor(config, table) {
|
|
3715
|
-
this.config = { ...config, table };
|
|
338
|
+
if (!Array.isArray(hooks.Stop)) {
|
|
339
|
+
hooks.Stop = [];
|
|
3716
340
|
}
|
|
3717
|
-
|
|
3718
|
-
|
|
3719
|
-
|
|
3720
|
-
|
|
3721
|
-
|
|
3722
|
-
|
|
341
|
+
hooks.Stop.push({
|
|
342
|
+
matcher: "*",
|
|
343
|
+
hooks: [
|
|
344
|
+
{
|
|
345
|
+
type: "command",
|
|
346
|
+
command: HOOK_COMMAND,
|
|
347
|
+
timeout: 30
|
|
348
|
+
}
|
|
349
|
+
]
|
|
350
|
+
});
|
|
351
|
+
fs2.writeFileSync(CLAUDE_SETTINGS_PATH, JSON.stringify(settings, null, 2));
|
|
352
|
+
check("Injected tracking hook into ~/.claude/settings.json");
|
|
3723
353
|
}
|
|
3724
|
-
|
|
3725
|
-
|
|
3726
|
-
|
|
3727
|
-
|
|
3728
|
-
|
|
3729
|
-
|
|
3730
|
-
|
|
3731
|
-
this.referencedTableName = referencedTable[Table.Symbol.Name];
|
|
3732
|
-
}
|
|
3733
|
-
static [entityKind] = "Relation";
|
|
3734
|
-
referencedTableName;
|
|
3735
|
-
fieldName;
|
|
3736
|
-
};
|
|
3737
|
-
var Relations = class {
|
|
3738
|
-
constructor(table, config) {
|
|
3739
|
-
this.table = table;
|
|
3740
|
-
this.config = config;
|
|
3741
|
-
}
|
|
3742
|
-
static [entityKind] = "Relations";
|
|
3743
|
-
};
|
|
3744
|
-
var One = class _One extends Relation {
|
|
3745
|
-
constructor(sourceTable, referencedTable, config, isNullable) {
|
|
3746
|
-
super(sourceTable, referencedTable, config?.relationName);
|
|
3747
|
-
this.config = config;
|
|
3748
|
-
this.isNullable = isNullable;
|
|
3749
|
-
}
|
|
3750
|
-
static [entityKind] = "One";
|
|
3751
|
-
withFieldName(fieldName) {
|
|
3752
|
-
const relation = new _One(
|
|
3753
|
-
this.sourceTable,
|
|
3754
|
-
this.referencedTable,
|
|
3755
|
-
this.config,
|
|
3756
|
-
this.isNullable
|
|
3757
|
-
);
|
|
3758
|
-
relation.fieldName = fieldName;
|
|
3759
|
-
return relation;
|
|
3760
|
-
}
|
|
3761
|
-
};
|
|
3762
|
-
var Many = class _Many extends Relation {
|
|
3763
|
-
constructor(sourceTable, referencedTable, config) {
|
|
3764
|
-
super(sourceTable, referencedTable, config?.relationName);
|
|
3765
|
-
this.config = config;
|
|
3766
|
-
}
|
|
3767
|
-
static [entityKind] = "Many";
|
|
3768
|
-
withFieldName(fieldName) {
|
|
3769
|
-
const relation = new _Many(
|
|
3770
|
-
this.sourceTable,
|
|
3771
|
-
this.referencedTable,
|
|
3772
|
-
this.config
|
|
3773
|
-
);
|
|
3774
|
-
relation.fieldName = fieldName;
|
|
3775
|
-
return relation;
|
|
354
|
+
async function init() {
|
|
355
|
+
console.log();
|
|
356
|
+
const ccVersion = detectClaudeCode();
|
|
357
|
+
if (ccVersion) {
|
|
358
|
+
console.log(` ${c.dim(`Detected: Claude Code ${ccVersion}`)}`);
|
|
359
|
+
} else {
|
|
360
|
+
warn("Claude Code not detected \u2014 hook will activate when installed");
|
|
3776
361
|
}
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
|
|
362
|
+
console.log();
|
|
363
|
+
injectClaudeCodeHook();
|
|
364
|
+
installSkill();
|
|
365
|
+
injectClaudeMdRule();
|
|
366
|
+
ensureDirs();
|
|
367
|
+
check(`Created ~/.basestream/buffer/`);
|
|
368
|
+
console.log();
|
|
369
|
+
await login();
|
|
370
|
+
console.log();
|
|
371
|
+
console.log(
|
|
372
|
+
` ${c.dim("That's it. Work normally \u2014 every session is now tracked.")}`
|
|
3787
373
|
);
|
|
374
|
+
console.log();
|
|
3788
375
|
}
|
|
3789
376
|
|
|
3790
|
-
// src/
|
|
377
|
+
// src/cli/commands/status.ts
|
|
378
|
+
init_config();
|
|
379
|
+
import fs3 from "node:fs";
|
|
380
|
+
import path3 from "node:path";
|
|
381
|
+
|
|
382
|
+
// src/db/models/enum-constants.ts
|
|
3791
383
|
function makeEnum(values) {
|
|
3792
384
|
return Object.fromEntries(values.map((v) => [v, v]));
|
|
3793
385
|
}
|
|
3794
|
-
var
|
|
3795
|
-
var
|
|
3796
|
-
var
|
|
3797
|
-
var
|
|
3798
|
-
var
|
|
3799
|
-
var OrgRole = makeEnum(
|
|
3800
|
-
var
|
|
3801
|
-
var
|
|
3802
|
-
var
|
|
3803
|
-
var artifactStatusValues = ["GENERATING", "READY", "FAILED"];
|
|
3804
|
-
var bsArtifactStatusEnum = pgEnum("bs_artifact_status", artifactStatusValues);
|
|
3805
|
-
var ArtifactStatus = makeEnum(artifactStatusValues);
|
|
3806
|
-
var workCategoryValues = ["FEATURE", "BUGFIX", "REFACTOR", "DOCS", "TESTING", "DEVOPS", "OTHER"];
|
|
3807
|
-
var bsWorkCategoryEnum = pgEnum("bs_work_category", workCategoryValues);
|
|
3808
|
-
var WorkCategory = makeEnum(workCategoryValues);
|
|
3809
|
-
var workOutcomeValues = ["COMPLETED", "IN_PROGRESS", "BLOCKED", "ABANDONED"];
|
|
3810
|
-
var bsWorkOutcomeEnum = pgEnum("bs_work_outcome", workOutcomeValues);
|
|
3811
|
-
var WorkOutcome = makeEnum(workOutcomeValues);
|
|
3812
|
-
var complexityValues = ["LOW", "MEDIUM", "HIGH"];
|
|
3813
|
-
var bsComplexityEnum = pgEnum("bs_complexity", complexityValues);
|
|
3814
|
-
var Complexity = makeEnum(complexityValues);
|
|
3815
|
-
var visibilityValues = ["PRIVATE", "TEAM", "PUBLIC"];
|
|
3816
|
-
var bsVisibilityEnum = pgEnum("bs_visibility", visibilityValues);
|
|
3817
|
-
var Visibility = makeEnum(visibilityValues);
|
|
3818
|
-
var integrationTypeValues = ["GITHUB", "HUBSPOT", "JIRA", "GOOGLE_CALENDAR", "FIREFLIES", "CLAUDE_CODE", "NOTION"];
|
|
3819
|
-
var bsIntegrationTypeEnum = pgEnum("bs_integration_type", integrationTypeValues);
|
|
3820
|
-
var IntegrationType = makeEnum(integrationTypeValues);
|
|
3821
|
-
|
|
3822
|
-
// src/db/models/auth.ts
|
|
3823
|
-
var import_cuid2 = __toESM(require_cuid2(), 1);
|
|
3824
|
-
var bsUsers = pgTable("bs_users", {
|
|
3825
|
-
id: text("id").$defaultFn(() => (0, import_cuid2.createId)()).primaryKey(),
|
|
3826
|
-
name: text("name"),
|
|
3827
|
-
email: text("email").notNull().unique(),
|
|
3828
|
-
emailVerified: boolean("email_verified").default(false).notNull(),
|
|
3829
|
-
image: text("image"),
|
|
3830
|
-
stripeCustomerId: text("stripe_customer_id").unique(),
|
|
3831
|
-
stripePriceId: text("stripe_price_id"),
|
|
3832
|
-
stripeSubscriptionId: text("stripe_subscription_id").unique(),
|
|
3833
|
-
stripeCurrentPeriodEnd: timestamp("stripe_current_period_end"),
|
|
3834
|
-
plan: bsPlanEnum("plan").default("FREE").notNull(),
|
|
3835
|
-
firefliesApiKey: text("fireflies_api_key"),
|
|
3836
|
-
firefliesWebhookSecret: text("fireflies_webhook_secret"),
|
|
3837
|
-
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3838
|
-
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3839
|
-
});
|
|
3840
|
-
var bsAccounts = pgTable("bs_accounts", {
|
|
3841
|
-
id: text("id").$defaultFn(() => (0, import_cuid2.createId)()).primaryKey(),
|
|
3842
|
-
userId: text("user_id").notNull(),
|
|
3843
|
-
accountId: text("account_id").notNull(),
|
|
3844
|
-
providerId: text("provider_id").notNull(),
|
|
3845
|
-
accessToken: text("access_token"),
|
|
3846
|
-
refreshToken: text("refresh_token"),
|
|
3847
|
-
accessTokenExpiresAt: timestamp("access_token_expires_at"),
|
|
3848
|
-
refreshTokenExpiresAt: timestamp("refresh_token_expires_at"),
|
|
3849
|
-
scope: text("scope"),
|
|
3850
|
-
idToken: text("id_token"),
|
|
3851
|
-
password: text("password"),
|
|
3852
|
-
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3853
|
-
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3854
|
-
}, (table) => [
|
|
3855
|
-
uniqueIndex("bs_accounts_provider_account_id_idx").on(table.providerId, table.accountId)
|
|
3856
|
-
]);
|
|
3857
|
-
var bsSessions = pgTable("bs_sessions", {
|
|
3858
|
-
id: text("id").$defaultFn(() => (0, import_cuid2.createId)()).primaryKey(),
|
|
3859
|
-
token: text("token").notNull().unique(),
|
|
3860
|
-
userId: text("user_id").notNull(),
|
|
3861
|
-
expiresAt: timestamp("expires_at").notNull(),
|
|
3862
|
-
ipAddress: text("ip_address"),
|
|
3863
|
-
userAgent: text("user_agent"),
|
|
3864
|
-
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3865
|
-
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3866
|
-
});
|
|
3867
|
-
var bsVerifications = pgTable("bs_verifications", {
|
|
3868
|
-
id: text("id").$defaultFn(() => (0, import_cuid2.createId)()).primaryKey(),
|
|
3869
|
-
identifier: text("identifier").notNull(),
|
|
3870
|
-
value: text("value").notNull(),
|
|
3871
|
-
expiresAt: timestamp("expires_at").notNull(),
|
|
3872
|
-
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3873
|
-
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3874
|
-
});
|
|
3875
|
-
|
|
3876
|
-
// src/db/models/org.ts
|
|
3877
|
-
var import_cuid22 = __toESM(require_cuid2(), 1);
|
|
3878
|
-
var bsOrgs = pgTable("bs_orgs", {
|
|
3879
|
-
id: text("id").$defaultFn(() => (0, import_cuid22.createId)()).primaryKey(),
|
|
3880
|
-
name: text("name").notNull(),
|
|
3881
|
-
slug: text("slug").notNull().unique(),
|
|
3882
|
-
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3883
|
-
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3884
|
-
});
|
|
3885
|
-
var bsOrgMembers = pgTable("bs_org_members", {
|
|
3886
|
-
id: text("id").$defaultFn(() => (0, import_cuid22.createId)()).primaryKey(),
|
|
3887
|
-
userId: text("user_id").notNull(),
|
|
3888
|
-
orgId: text("org_id").notNull(),
|
|
3889
|
-
role: bsOrgRoleEnum("role").default("USER").notNull(),
|
|
3890
|
-
teamId: text("team_id"),
|
|
3891
|
-
githubLogin: text("github_login")
|
|
3892
|
-
}, (table) => [
|
|
3893
|
-
uniqueIndex("bs_org_members_user_id_org_id_idx").on(table.userId, table.orgId),
|
|
3894
|
-
index("bs_org_members_team_id_idx").on(table.teamId)
|
|
3895
|
-
]);
|
|
3896
|
-
var bsTeams = pgTable("bs_teams", {
|
|
3897
|
-
id: text("id").$defaultFn(() => (0, import_cuid22.createId)()).primaryKey(),
|
|
3898
|
-
orgId: text("org_id").notNull(),
|
|
3899
|
-
name: text("name").notNull(),
|
|
3900
|
-
// Parent team for nested tree structure (null = top-level).
|
|
3901
|
-
parentTeamId: text("parent_team_id"),
|
|
3902
|
-
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3903
|
-
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3904
|
-
}, (table) => [
|
|
3905
|
-
index("bs_teams_org_id_idx").on(table.orgId),
|
|
3906
|
-
index("bs_teams_parent_team_id_idx").on(table.parentTeamId)
|
|
3907
|
-
]);
|
|
3908
|
-
var bsOrgInvites = pgTable("bs_org_invites", {
|
|
3909
|
-
id: text("id").$defaultFn(() => (0, import_cuid22.createId)()).primaryKey(),
|
|
3910
|
-
email: text("email").notNull(),
|
|
3911
|
-
orgId: text("org_id").notNull(),
|
|
3912
|
-
role: bsOrgRoleEnum("role").default("USER").notNull(),
|
|
3913
|
-
token: text("token").$defaultFn(() => (0, import_cuid22.createId)()).notNull().unique(),
|
|
3914
|
-
expiresAt: timestamp("expires_at").notNull(),
|
|
3915
|
-
createdAt: timestamp("created_at").defaultNow().notNull()
|
|
3916
|
-
});
|
|
3917
|
-
|
|
3918
|
-
// src/db/models/work.ts
|
|
3919
|
-
var import_cuid23 = __toESM(require_cuid2(), 1);
|
|
3920
|
-
var bsWorkEntries = pgTable("bs_work_entries", {
|
|
3921
|
-
id: text("id").$defaultFn(() => (0, import_cuid23.createId)()).primaryKey(),
|
|
3922
|
-
userId: text("user_id").notNull(),
|
|
3923
|
-
orgId: text("org_id"),
|
|
3924
|
-
tool: text("tool").notNull(),
|
|
3925
|
-
sessionId: text("session_id"),
|
|
3926
|
-
projectName: text("project_name"),
|
|
3927
|
-
repo: text("repo"),
|
|
3928
|
-
branch: text("branch"),
|
|
3929
|
-
summary: text("summary").notNull(),
|
|
3930
|
-
category: bsWorkCategoryEnum("category").default("OTHER").notNull(),
|
|
3931
|
-
why: text("why"),
|
|
3932
|
-
whatChanged: json("what_changed"),
|
|
3933
|
-
outcome: bsWorkOutcomeEnum("outcome").default("IN_PROGRESS").notNull(),
|
|
3934
|
-
filesTouched: integer("files_touched"),
|
|
3935
|
-
complexity: bsComplexityEnum("complexity"),
|
|
3936
|
-
toolVersion: text("tool_version"),
|
|
3937
|
-
model: text("model"),
|
|
3938
|
-
sessionDurationMin: integer("session_duration_min"),
|
|
3939
|
-
turns: integer("turns"),
|
|
3940
|
-
prUrl: text("pr_url"),
|
|
3941
|
-
ticketUrl: text("ticket_url"),
|
|
3942
|
-
commitShas: json("commit_shas"),
|
|
3943
|
-
visibility: bsVisibilityEnum("visibility").default("TEAM").notNull(),
|
|
3944
|
-
notionPageId: text("notion_page_id"),
|
|
3945
|
-
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3946
|
-
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3947
|
-
}, (table) => [
|
|
3948
|
-
index("bs_work_entries_user_id_idx").on(table.userId),
|
|
3949
|
-
index("bs_work_entries_org_id_idx").on(table.orgId),
|
|
3950
|
-
index("bs_work_entries_created_at_idx").on(table.createdAt),
|
|
3951
|
-
index("bs_work_entries_category_idx").on(table.category)
|
|
3952
|
-
]);
|
|
3953
|
-
var bsApiKeys = pgTable("bs_api_keys", {
|
|
3954
|
-
id: text("id").$defaultFn(() => (0, import_cuid23.createId)()).primaryKey(),
|
|
3955
|
-
userId: text("user_id").notNull(),
|
|
3956
|
-
name: text("name").notNull(),
|
|
3957
|
-
key: text("key").notNull().unique(),
|
|
3958
|
-
lastUsed: timestamp("last_used"),
|
|
3959
|
-
createdAt: timestamp("created_at").defaultNow().notNull()
|
|
3960
|
-
});
|
|
3961
|
-
|
|
3962
|
-
// src/db/models/integrations.ts
|
|
3963
|
-
var import_cuid24 = __toESM(require_cuid2(), 1);
|
|
3964
|
-
var bsIntegrations = pgTable("bs_integrations", {
|
|
3965
|
-
id: text("id").$defaultFn(() => (0, import_cuid24.createId)()).primaryKey(),
|
|
3966
|
-
orgId: text("org_id").notNull(),
|
|
3967
|
-
type: bsIntegrationTypeEnum("type").notNull(),
|
|
3968
|
-
config: json("config").notNull(),
|
|
3969
|
-
enabled: boolean("enabled").default(true).notNull(),
|
|
3970
|
-
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3971
|
-
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3972
|
-
}, (table) => [
|
|
3973
|
-
uniqueIndex("bs_integrations_org_id_type_idx").on(table.orgId, table.type)
|
|
3974
|
-
]);
|
|
3975
|
-
var bsMemberOauthCredentials = pgTable("bs_member_oauth_credentials", {
|
|
3976
|
-
id: text("id").$defaultFn(() => (0, import_cuid24.createId)()).primaryKey(),
|
|
3977
|
-
userId: text("user_id").notNull(),
|
|
3978
|
-
orgId: text("org_id").notNull(),
|
|
3979
|
-
provider: text("provider").notNull(),
|
|
3980
|
-
// e.g. 'google-calendar'
|
|
3981
|
-
accessToken: text("access_token").notNull(),
|
|
3982
|
-
refreshToken: text("refresh_token"),
|
|
3983
|
-
scope: text("scope"),
|
|
3984
|
-
email: text("email"),
|
|
3985
|
-
expiresAt: timestamp("expires_at"),
|
|
3986
|
-
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
3987
|
-
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
3988
|
-
}, (table) => [
|
|
3989
|
-
uniqueIndex("bs_member_oauth_user_org_provider_idx").on(table.userId, table.orgId, table.provider)
|
|
3990
|
-
]);
|
|
3991
|
-
|
|
3992
|
-
// src/db/models/artifacts.ts
|
|
3993
|
-
var import_cuid25 = __toESM(require_cuid2(), 1);
|
|
3994
|
-
var bsArtifacts = pgTable("bs_artifacts", {
|
|
3995
|
-
id: text("id").$defaultFn(() => (0, import_cuid25.createId)()).primaryKey(),
|
|
3996
|
-
orgId: text("org_id").notNull(),
|
|
3997
|
-
// null = team rollup, otherwise per-person
|
|
3998
|
-
subjectUserId: text("subject_user_id"),
|
|
3999
|
-
// reserved for future sub-team support; null in v1
|
|
4000
|
-
subjectTeamId: text("subject_team_id"),
|
|
4001
|
-
generatedBy: text("generated_by"),
|
|
4002
|
-
// userId of creator; null = system/cron
|
|
4003
|
-
periodType: bsArtifactPeriodEnum("period_type").notNull(),
|
|
4004
|
-
periodStart: timestamp("period_start").notNull(),
|
|
4005
|
-
periodEnd: timestamp("period_end").notNull(),
|
|
4006
|
-
title: text("title").notNull(),
|
|
4007
|
-
narrative: text("narrative"),
|
|
4008
|
-
// markdown, LLM-generated
|
|
4009
|
-
stats: json("stats"),
|
|
4010
|
-
// raw metrics
|
|
4011
|
-
status: bsArtifactStatusEnum("status").default("GENERATING").notNull(),
|
|
4012
|
-
errorMessage: text("error_message"),
|
|
4013
|
-
createdAt: timestamp("created_at").defaultNow().notNull(),
|
|
4014
|
-
updatedAt: timestamp("updated_at").defaultNow().notNull()
|
|
4015
|
-
}, (table) => [
|
|
4016
|
-
index("bs_artifacts_org_id_idx").on(table.orgId),
|
|
4017
|
-
index("bs_artifacts_subject_user_id_idx").on(table.subjectUserId),
|
|
4018
|
-
index("bs_artifacts_period_idx").on(table.periodStart, table.periodEnd)
|
|
4019
|
-
]);
|
|
4020
|
-
|
|
4021
|
-
// src/db/models/relations.ts
|
|
4022
|
-
var bsUsersRelations = relations(bsUsers, ({ many }) => ({
|
|
4023
|
-
accounts: many(bsAccounts),
|
|
4024
|
-
sessions: many(bsSessions),
|
|
4025
|
-
orgMemberships: many(bsOrgMembers),
|
|
4026
|
-
workEntries: many(bsWorkEntries),
|
|
4027
|
-
apiKeys: many(bsApiKeys)
|
|
4028
|
-
}));
|
|
4029
|
-
var bsAccountsRelations = relations(bsAccounts, ({ one }) => ({
|
|
4030
|
-
user: one(bsUsers, { fields: [bsAccounts.userId], references: [bsUsers.id] })
|
|
4031
|
-
}));
|
|
4032
|
-
var bsSessionsRelations = relations(bsSessions, ({ one }) => ({
|
|
4033
|
-
user: one(bsUsers, { fields: [bsSessions.userId], references: [bsUsers.id] })
|
|
4034
|
-
}));
|
|
4035
|
-
var bsVerificationsRelations = relations(bsVerifications, ({ one }) => ({
|
|
4036
|
-
user: one(bsUsers, { fields: [bsVerifications.identifier], references: [bsUsers.email] })
|
|
4037
|
-
}));
|
|
4038
|
-
var bsOrgsRelations = relations(bsOrgs, ({ many }) => ({
|
|
4039
|
-
members: many(bsOrgMembers),
|
|
4040
|
-
invites: many(bsOrgInvites),
|
|
4041
|
-
integrations: many(bsIntegrations)
|
|
4042
|
-
}));
|
|
4043
|
-
var bsOrgMembersRelations = relations(bsOrgMembers, ({ one }) => ({
|
|
4044
|
-
user: one(bsUsers, { fields: [bsOrgMembers.userId], references: [bsUsers.id] }),
|
|
4045
|
-
org: one(bsOrgs, { fields: [bsOrgMembers.orgId], references: [bsOrgs.id] }),
|
|
4046
|
-
team: one(bsTeams, { fields: [bsOrgMembers.teamId], references: [bsTeams.id] })
|
|
4047
|
-
}));
|
|
4048
|
-
var bsTeamsRelations = relations(bsTeams, ({ one, many }) => ({
|
|
4049
|
-
org: one(bsOrgs, { fields: [bsTeams.orgId], references: [bsOrgs.id] }),
|
|
4050
|
-
parent: one(bsTeams, { fields: [bsTeams.parentTeamId], references: [bsTeams.id], relationName: "parentTeam" }),
|
|
4051
|
-
members: many(bsOrgMembers)
|
|
4052
|
-
}));
|
|
4053
|
-
var bsOrgInvitesRelations = relations(bsOrgInvites, ({ one }) => ({
|
|
4054
|
-
org: one(bsOrgs, { fields: [bsOrgInvites.orgId], references: [bsOrgs.id] })
|
|
4055
|
-
}));
|
|
4056
|
-
var bsWorkEntriesRelations = relations(bsWorkEntries, ({ one }) => ({
|
|
4057
|
-
user: one(bsUsers, { fields: [bsWorkEntries.userId], references: [bsUsers.id] })
|
|
4058
|
-
}));
|
|
4059
|
-
var bsApiKeysRelations = relations(bsApiKeys, ({ one }) => ({
|
|
4060
|
-
user: one(bsUsers, { fields: [bsApiKeys.userId], references: [bsUsers.id] })
|
|
4061
|
-
}));
|
|
4062
|
-
var bsIntegrationsRelations = relations(bsIntegrations, ({ one }) => ({
|
|
4063
|
-
org: one(bsOrgs, { fields: [bsIntegrations.orgId], references: [bsOrgs.id] })
|
|
4064
|
-
}));
|
|
4065
|
-
var bsArtifactsRelations = relations(bsArtifacts, ({ one }) => ({
|
|
4066
|
-
org: one(bsOrgs, { fields: [bsArtifacts.orgId], references: [bsOrgs.id] }),
|
|
4067
|
-
subjectUser: one(bsUsers, { fields: [bsArtifacts.subjectUserId], references: [bsUsers.id] })
|
|
4068
|
-
}));
|
|
4069
|
-
var bsMemberOauthCredentialsRelations = relations(bsMemberOauthCredentials, ({ one }) => ({
|
|
4070
|
-
user: one(bsUsers, { fields: [bsMemberOauthCredentials.userId], references: [bsUsers.id] }),
|
|
4071
|
-
org: one(bsOrgs, { fields: [bsMemberOauthCredentials.orgId], references: [bsOrgs.id] })
|
|
4072
|
-
}));
|
|
386
|
+
var WorkCategory = makeEnum(["FEATURE", "BUGFIX", "REFACTOR", "DOCS", "TESTING", "DEVOPS", "OTHER"]);
|
|
387
|
+
var WorkOutcome = makeEnum(["COMPLETED", "IN_PROGRESS", "BLOCKED", "ABANDONED"]);
|
|
388
|
+
var Complexity = makeEnum(["LOW", "MEDIUM", "HIGH"]);
|
|
389
|
+
var Visibility = makeEnum(["PRIVATE", "TEAM", "PUBLIC"]);
|
|
390
|
+
var Plan = makeEnum(["FREE", "TEAM", "ENTERPRISE"]);
|
|
391
|
+
var OrgRole = makeEnum(["ADMIN", "MANAGER", "USER"]);
|
|
392
|
+
var ArtifactStatus = makeEnum(["GENERATING", "READY", "FAILED"]);
|
|
393
|
+
var ArtifactPeriod = makeEnum(["QUARTER", "HALF", "YEAR", "CUSTOM"]);
|
|
394
|
+
var IntegrationType = makeEnum(["GITHUB", "HUBSPOT", "JIRA", "GOOGLE_CALENDAR", "FIREFLIES", "CLAUDE_CODE", "NOTION"]);
|
|
4073
395
|
|
|
4074
396
|
// src/cli/commands/status.ts
|
|
4075
397
|
init_util();
|
|
@@ -4184,9 +506,9 @@ import fs5 from "node:fs";
|
|
|
4184
506
|
import path5 from "node:path";
|
|
4185
507
|
import os3 from "node:os";
|
|
4186
508
|
import { execSync as execSync3 } from "node:child_process";
|
|
4187
|
-
function parseTranscriptLine(
|
|
509
|
+
function parseTranscriptLine(line) {
|
|
4188
510
|
try {
|
|
4189
|
-
return JSON.parse(
|
|
511
|
+
return JSON.parse(line);
|
|
4190
512
|
} catch {
|
|
4191
513
|
return null;
|
|
4192
514
|
}
|
|
@@ -4237,8 +559,8 @@ function analyzeTranscript(transcriptPath, acc) {
|
|
|
4237
559
|
if (!fs5.existsSync(transcriptPath)) return acc;
|
|
4238
560
|
const content = fs5.readFileSync(transcriptPath, "utf-8");
|
|
4239
561
|
const lines = content.split("\n").filter(Boolean);
|
|
4240
|
-
for (const
|
|
4241
|
-
const entry = parseTranscriptLine(
|
|
562
|
+
for (const line of lines) {
|
|
563
|
+
const entry = parseTranscriptLine(line);
|
|
4242
564
|
if (!entry) continue;
|
|
4243
565
|
const message = entry.message;
|
|
4244
566
|
const contentBlocks = Array.isArray(message?.content) ? message.content : [];
|
|
@@ -4512,7 +834,7 @@ async function main() {
|
|
|
4512
834
|
process.exit(0);
|
|
4513
835
|
}
|
|
4514
836
|
if (command === "--version" || command === "-v") {
|
|
4515
|
-
console.log(true ? "0.2.
|
|
837
|
+
console.log(true ? "0.2.4" : "dev");
|
|
4516
838
|
process.exit(0);
|
|
4517
839
|
}
|
|
4518
840
|
switch (command || "init") {
|
|
@@ -4547,8 +869,3 @@ main().catch((err) => {
|
|
|
4547
869
|
console.error(err.message || err);
|
|
4548
870
|
process.exit(1);
|
|
4549
871
|
});
|
|
4550
|
-
/*! Bundled license information:
|
|
4551
|
-
|
|
4552
|
-
@noble/hashes/utils.js:
|
|
4553
|
-
(*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) *)
|
|
4554
|
-
*/
|