Initial commit

This commit is contained in:
Ammaar Reshi
2025-01-04 14:06:53 +00:00
parent 7082408604
commit d6025af146
23760 changed files with 3299690 additions and 0 deletions

69
node_modules/drizzle-orm/sql/functions/aggregate.cjs generated vendored Normal file
View File

@ -0,0 +1,69 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var aggregate_exports = {};
__export(aggregate_exports, {
avg: () => avg,
avgDistinct: () => avgDistinct,
count: () => count,
countDistinct: () => countDistinct,
max: () => max,
min: () => min,
sum: () => sum,
sumDistinct: () => sumDistinct
});
module.exports = __toCommonJS(aggregate_exports);
var import_column = require("../../column.cjs");
var import_entity = require("../../entity.cjs");
var import_sql = require("../sql.cjs");
function count(expression) {
return import_sql.sql`count(${expression || import_sql.sql.raw("*")})`.mapWith(Number);
}
function countDistinct(expression) {
return import_sql.sql`count(distinct ${expression})`.mapWith(Number);
}
function avg(expression) {
return import_sql.sql`avg(${expression})`.mapWith(String);
}
function avgDistinct(expression) {
return import_sql.sql`avg(distinct ${expression})`.mapWith(String);
}
function sum(expression) {
return import_sql.sql`sum(${expression})`.mapWith(String);
}
function sumDistinct(expression) {
return import_sql.sql`sum(distinct ${expression})`.mapWith(String);
}
function max(expression) {
return import_sql.sql`max(${expression})`.mapWith((0, import_entity.is)(expression, import_column.Column) ? expression : String);
}
function min(expression) {
return import_sql.sql`min(${expression})`.mapWith((0, import_entity.is)(expression, import_column.Column) ? expression : String);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
avg,
avgDistinct,
count,
countDistinct,
max,
min,
sum,
sumDistinct
});
//# sourceMappingURL=aggregate.cjs.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/sql/functions/aggregate.ts"],"sourcesContent":["import { type AnyColumn, Column } from '~/column.ts';\nimport { is } from '~/entity.ts';\nimport { type SQL, sql, type SQLWrapper } from '../sql.ts';\n\n/**\n * Returns the number of values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Number employees with null values\n * db.select({ value: count() }).from(employees)\n * // Number of employees where `name` is not null\n * db.select({ value: count(employees.name) }).from(employees)\n * ```\n *\n * @see countDistinct to get the number of non-duplicate values in `expression`\n */\nexport function count(expression?: SQLWrapper): SQL<number> {\n\treturn sql`count(${expression || sql.raw('*')})`.mapWith(Number);\n}\n\n/**\n * Returns the number of non-duplicate values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Number of employees where `name` is distinct\n * db.select({ value: countDistinct(employees.name) }).from(employees)\n * ```\n *\n * @see count to get the number of values in `expression`, including duplicates\n */\nexport function countDistinct(expression: SQLWrapper): SQL<number> {\n\treturn sql`count(distinct ${expression})`.mapWith(Number);\n}\n\n/**\n * Returns the average (arithmetic mean) of all non-null values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Average salary of an employee\n * db.select({ value: avg(employees.salary) }).from(employees)\n * ```\n *\n * @see avgDistinct to get the average of all non-null and non-duplicate values in `expression`\n */\nexport function avg(expression: SQLWrapper): SQL<string | null> {\n\treturn sql`avg(${expression})`.mapWith(String);\n}\n\n/**\n * Returns the average (arithmetic mean) of all non-null and non-duplicate values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Average salary of an employee where `salary` is distinct\n * db.select({ value: avgDistinct(employees.salary) }).from(employees)\n * ```\n *\n * @see avg to get the average of all non-null values in `expression`, including duplicates\n */\nexport function avgDistinct(expression: SQLWrapper): SQL<string | null> {\n\treturn sql`avg(distinct ${expression})`.mapWith(String);\n}\n\n/**\n * Returns the sum of all non-null values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Sum of every employee's salary\n * db.select({ value: sum(employees.salary) }).from(employees)\n * ```\n *\n * @see sumDistinct to get the sum of all non-null and non-duplicate values in `expression`\n */\nexport function sum(expression: SQLWrapper): SQL<string | null> {\n\treturn sql`sum(${expression})`.mapWith(String);\n}\n\n/**\n * Returns the sum of all non-null and non-duplicate values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Sum of every employee's salary where `salary` is distinct (no duplicates)\n * db.select({ value: sumDistinct(employees.salary) }).from(employees)\n * ```\n *\n * @see sum to get the sum of all non-null values in `expression`, including duplicates\n */\nexport function sumDistinct(expression: SQLWrapper): SQL<string | null> {\n\treturn sql`sum(distinct ${expression})`.mapWith(String);\n}\n\n/**\n * Returns the maximum value in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // The employee with the highest salary\n * db.select({ value: max(employees.salary) }).from(employees)\n * ```\n */\nexport function max<T extends SQLWrapper>(expression: T): SQL<(T extends AnyColumn ? T['_']['data'] : string) | null> {\n\treturn sql`max(${expression})`.mapWith(is(expression, Column) ? expression : String) as any;\n}\n\n/**\n * Returns the minimum value in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // The employee with the lowest salary\n * db.select({ value: min(employees.salary) }).from(employees)\n * ```\n */\nexport function min<T extends SQLWrapper>(expression: T): SQL<(T extends AnyColumn ? T['_']['data'] : string) | null> {\n\treturn sql`min(${expression})`.mapWith(is(expression, Column) ? expression : String) as any;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAuC;AACvC,oBAAmB;AACnB,iBAA+C;AAgBxC,SAAS,MAAM,YAAsC;AAC3D,SAAO,uBAAY,cAAc,eAAI,IAAI,GAAG,CAAC,IAAI,QAAQ,MAAM;AAChE;AAcO,SAAS,cAAc,YAAqC;AAClE,SAAO,gCAAqB,UAAU,IAAI,QAAQ,MAAM;AACzD;AAcO,SAAS,IAAI,YAA4C;AAC/D,SAAO,qBAAU,UAAU,IAAI,QAAQ,MAAM;AAC9C;AAcO,SAAS,YAAY,YAA4C;AACvE,SAAO,8BAAmB,UAAU,IAAI,QAAQ,MAAM;AACvD;AAcO,SAAS,IAAI,YAA4C;AAC/D,SAAO,qBAAU,UAAU,IAAI,QAAQ,MAAM;AAC9C;AAcO,SAAS,YAAY,YAA4C;AACvE,SAAO,8BAAmB,UAAU,IAAI,QAAQ,MAAM;AACvD;AAYO,SAAS,IAA0B,YAA4E;AACrH,SAAO,qBAAU,UAAU,IAAI,YAAQ,kBAAG,YAAY,oBAAM,IAAI,aAAa,MAAM;AACpF;AAYO,SAAS,IAA0B,YAA4E;AACrH,SAAO,qBAAU,UAAU,IAAI,YAAQ,kBAAG,YAAY,oBAAM,IAAI,aAAa,MAAM;AACpF;","names":[]}

104
node_modules/drizzle-orm/sql/functions/aggregate.d.cts generated vendored Normal file
View File

@ -0,0 +1,104 @@
import { type AnyColumn } from "../../column.cjs";
import { type SQL, type SQLWrapper } from "../sql.cjs";
/**
* Returns the number of values in `expression`.
*
* ## Examples
*
* ```ts
* // Number employees with null values
* db.select({ value: count() }).from(employees)
* // Number of employees where `name` is not null
* db.select({ value: count(employees.name) }).from(employees)
* ```
*
* @see countDistinct to get the number of non-duplicate values in `expression`
*/
export declare function count(expression?: SQLWrapper): SQL<number>;
/**
* Returns the number of non-duplicate values in `expression`.
*
* ## Examples
*
* ```ts
* // Number of employees where `name` is distinct
* db.select({ value: countDistinct(employees.name) }).from(employees)
* ```
*
* @see count to get the number of values in `expression`, including duplicates
*/
export declare function countDistinct(expression: SQLWrapper): SQL<number>;
/**
* Returns the average (arithmetic mean) of all non-null values in `expression`.
*
* ## Examples
*
* ```ts
* // Average salary of an employee
* db.select({ value: avg(employees.salary) }).from(employees)
* ```
*
* @see avgDistinct to get the average of all non-null and non-duplicate values in `expression`
*/
export declare function avg(expression: SQLWrapper): SQL<string | null>;
/**
* Returns the average (arithmetic mean) of all non-null and non-duplicate values in `expression`.
*
* ## Examples
*
* ```ts
* // Average salary of an employee where `salary` is distinct
* db.select({ value: avgDistinct(employees.salary) }).from(employees)
* ```
*
* @see avg to get the average of all non-null values in `expression`, including duplicates
*/
export declare function avgDistinct(expression: SQLWrapper): SQL<string | null>;
/**
* Returns the sum of all non-null values in `expression`.
*
* ## Examples
*
* ```ts
* // Sum of every employee's salary
* db.select({ value: sum(employees.salary) }).from(employees)
* ```
*
* @see sumDistinct to get the sum of all non-null and non-duplicate values in `expression`
*/
export declare function sum(expression: SQLWrapper): SQL<string | null>;
/**
* Returns the sum of all non-null and non-duplicate values in `expression`.
*
* ## Examples
*
* ```ts
* // Sum of every employee's salary where `salary` is distinct (no duplicates)
* db.select({ value: sumDistinct(employees.salary) }).from(employees)
* ```
*
* @see sum to get the sum of all non-null values in `expression`, including duplicates
*/
export declare function sumDistinct(expression: SQLWrapper): SQL<string | null>;
/**
* Returns the maximum value in `expression`.
*
* ## Examples
*
* ```ts
* // The employee with the highest salary
* db.select({ value: max(employees.salary) }).from(employees)
* ```
*/
export declare function max<T extends SQLWrapper>(expression: T): SQL<(T extends AnyColumn ? T['_']['data'] : string) | null>;
/**
* Returns the minimum value in `expression`.
*
* ## Examples
*
* ```ts
* // The employee with the lowest salary
* db.select({ value: min(employees.salary) }).from(employees)
* ```
*/
export declare function min<T extends SQLWrapper>(expression: T): SQL<(T extends AnyColumn ? T['_']['data'] : string) | null>;

104
node_modules/drizzle-orm/sql/functions/aggregate.d.ts generated vendored Normal file
View File

@ -0,0 +1,104 @@
import { type AnyColumn } from "../../column.js";
import { type SQL, type SQLWrapper } from "../sql.js";
/**
* Returns the number of values in `expression`.
*
* ## Examples
*
* ```ts
* // Number employees with null values
* db.select({ value: count() }).from(employees)
* // Number of employees where `name` is not null
* db.select({ value: count(employees.name) }).from(employees)
* ```
*
* @see countDistinct to get the number of non-duplicate values in `expression`
*/
export declare function count(expression?: SQLWrapper): SQL<number>;
/**
* Returns the number of non-duplicate values in `expression`.
*
* ## Examples
*
* ```ts
* // Number of employees where `name` is distinct
* db.select({ value: countDistinct(employees.name) }).from(employees)
* ```
*
* @see count to get the number of values in `expression`, including duplicates
*/
export declare function countDistinct(expression: SQLWrapper): SQL<number>;
/**
* Returns the average (arithmetic mean) of all non-null values in `expression`.
*
* ## Examples
*
* ```ts
* // Average salary of an employee
* db.select({ value: avg(employees.salary) }).from(employees)
* ```
*
* @see avgDistinct to get the average of all non-null and non-duplicate values in `expression`
*/
export declare function avg(expression: SQLWrapper): SQL<string | null>;
/**
* Returns the average (arithmetic mean) of all non-null and non-duplicate values in `expression`.
*
* ## Examples
*
* ```ts
* // Average salary of an employee where `salary` is distinct
* db.select({ value: avgDistinct(employees.salary) }).from(employees)
* ```
*
* @see avg to get the average of all non-null values in `expression`, including duplicates
*/
export declare function avgDistinct(expression: SQLWrapper): SQL<string | null>;
/**
* Returns the sum of all non-null values in `expression`.
*
* ## Examples
*
* ```ts
* // Sum of every employee's salary
* db.select({ value: sum(employees.salary) }).from(employees)
* ```
*
* @see sumDistinct to get the sum of all non-null and non-duplicate values in `expression`
*/
export declare function sum(expression: SQLWrapper): SQL<string | null>;
/**
* Returns the sum of all non-null and non-duplicate values in `expression`.
*
* ## Examples
*
* ```ts
* // Sum of every employee's salary where `salary` is distinct (no duplicates)
* db.select({ value: sumDistinct(employees.salary) }).from(employees)
* ```
*
* @see sum to get the sum of all non-null values in `expression`, including duplicates
*/
export declare function sumDistinct(expression: SQLWrapper): SQL<string | null>;
/**
* Returns the maximum value in `expression`.
*
* ## Examples
*
* ```ts
* // The employee with the highest salary
* db.select({ value: max(employees.salary) }).from(employees)
* ```
*/
export declare function max<T extends SQLWrapper>(expression: T): SQL<(T extends AnyColumn ? T['_']['data'] : string) | null>;
/**
* Returns the minimum value in `expression`.
*
* ## Examples
*
* ```ts
* // The employee with the lowest salary
* db.select({ value: min(employees.salary) }).from(employees)
* ```
*/
export declare function min<T extends SQLWrapper>(expression: T): SQL<(T extends AnyColumn ? T['_']['data'] : string) | null>;

38
node_modules/drizzle-orm/sql/functions/aggregate.js generated vendored Normal file
View File

@ -0,0 +1,38 @@
import { Column } from "../../column.js";
import { is } from "../../entity.js";
import { sql } from "../sql.js";
function count(expression) {
return sql`count(${expression || sql.raw("*")})`.mapWith(Number);
}
function countDistinct(expression) {
return sql`count(distinct ${expression})`.mapWith(Number);
}
function avg(expression) {
return sql`avg(${expression})`.mapWith(String);
}
function avgDistinct(expression) {
return sql`avg(distinct ${expression})`.mapWith(String);
}
function sum(expression) {
return sql`sum(${expression})`.mapWith(String);
}
function sumDistinct(expression) {
return sql`sum(distinct ${expression})`.mapWith(String);
}
function max(expression) {
return sql`max(${expression})`.mapWith(is(expression, Column) ? expression : String);
}
function min(expression) {
return sql`min(${expression})`.mapWith(is(expression, Column) ? expression : String);
}
export {
avg,
avgDistinct,
count,
countDistinct,
max,
min,
sum,
sumDistinct
};
//# sourceMappingURL=aggregate.js.map

View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/sql/functions/aggregate.ts"],"sourcesContent":["import { type AnyColumn, Column } from '~/column.ts';\nimport { is } from '~/entity.ts';\nimport { type SQL, sql, type SQLWrapper } from '../sql.ts';\n\n/**\n * Returns the number of values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Number employees with null values\n * db.select({ value: count() }).from(employees)\n * // Number of employees where `name` is not null\n * db.select({ value: count(employees.name) }).from(employees)\n * ```\n *\n * @see countDistinct to get the number of non-duplicate values in `expression`\n */\nexport function count(expression?: SQLWrapper): SQL<number> {\n\treturn sql`count(${expression || sql.raw('*')})`.mapWith(Number);\n}\n\n/**\n * Returns the number of non-duplicate values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Number of employees where `name` is distinct\n * db.select({ value: countDistinct(employees.name) }).from(employees)\n * ```\n *\n * @see count to get the number of values in `expression`, including duplicates\n */\nexport function countDistinct(expression: SQLWrapper): SQL<number> {\n\treturn sql`count(distinct ${expression})`.mapWith(Number);\n}\n\n/**\n * Returns the average (arithmetic mean) of all non-null values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Average salary of an employee\n * db.select({ value: avg(employees.salary) }).from(employees)\n * ```\n *\n * @see avgDistinct to get the average of all non-null and non-duplicate values in `expression`\n */\nexport function avg(expression: SQLWrapper): SQL<string | null> {\n\treturn sql`avg(${expression})`.mapWith(String);\n}\n\n/**\n * Returns the average (arithmetic mean) of all non-null and non-duplicate values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Average salary of an employee where `salary` is distinct\n * db.select({ value: avgDistinct(employees.salary) }).from(employees)\n * ```\n *\n * @see avg to get the average of all non-null values in `expression`, including duplicates\n */\nexport function avgDistinct(expression: SQLWrapper): SQL<string | null> {\n\treturn sql`avg(distinct ${expression})`.mapWith(String);\n}\n\n/**\n * Returns the sum of all non-null values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Sum of every employee's salary\n * db.select({ value: sum(employees.salary) }).from(employees)\n * ```\n *\n * @see sumDistinct to get the sum of all non-null and non-duplicate values in `expression`\n */\nexport function sum(expression: SQLWrapper): SQL<string | null> {\n\treturn sql`sum(${expression})`.mapWith(String);\n}\n\n/**\n * Returns the sum of all non-null and non-duplicate values in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // Sum of every employee's salary where `salary` is distinct (no duplicates)\n * db.select({ value: sumDistinct(employees.salary) }).from(employees)\n * ```\n *\n * @see sum to get the sum of all non-null values in `expression`, including duplicates\n */\nexport function sumDistinct(expression: SQLWrapper): SQL<string | null> {\n\treturn sql`sum(distinct ${expression})`.mapWith(String);\n}\n\n/**\n * Returns the maximum value in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // The employee with the highest salary\n * db.select({ value: max(employees.salary) }).from(employees)\n * ```\n */\nexport function max<T extends SQLWrapper>(expression: T): SQL<(T extends AnyColumn ? T['_']['data'] : string) | null> {\n\treturn sql`max(${expression})`.mapWith(is(expression, Column) ? expression : String) as any;\n}\n\n/**\n * Returns the minimum value in `expression`.\n *\n * ## Examples\n *\n * ```ts\n * // The employee with the lowest salary\n * db.select({ value: min(employees.salary) }).from(employees)\n * ```\n */\nexport function min<T extends SQLWrapper>(expression: T): SQL<(T extends AnyColumn ? T['_']['data'] : string) | null> {\n\treturn sql`min(${expression})`.mapWith(is(expression, Column) ? expression : String) as any;\n}\n"],"mappings":"AAAA,SAAyB,cAAc;AACvC,SAAS,UAAU;AACnB,SAAmB,WAA4B;AAgBxC,SAAS,MAAM,YAAsC;AAC3D,SAAO,YAAY,cAAc,IAAI,IAAI,GAAG,CAAC,IAAI,QAAQ,MAAM;AAChE;AAcO,SAAS,cAAc,YAAqC;AAClE,SAAO,qBAAqB,UAAU,IAAI,QAAQ,MAAM;AACzD;AAcO,SAAS,IAAI,YAA4C;AAC/D,SAAO,UAAU,UAAU,IAAI,QAAQ,MAAM;AAC9C;AAcO,SAAS,YAAY,YAA4C;AACvE,SAAO,mBAAmB,UAAU,IAAI,QAAQ,MAAM;AACvD;AAcO,SAAS,IAAI,YAA4C;AAC/D,SAAO,UAAU,UAAU,IAAI,QAAQ,MAAM;AAC9C;AAcO,SAAS,YAAY,YAA4C;AACvE,SAAO,mBAAmB,UAAU,IAAI,QAAQ,MAAM;AACvD;AAYO,SAAS,IAA0B,YAA4E;AACrH,SAAO,UAAU,UAAU,IAAI,QAAQ,GAAG,YAAY,MAAM,IAAI,aAAa,MAAM;AACpF;AAYO,SAAS,IAA0B,YAA4E;AACrH,SAAO,UAAU,UAAU,IAAI,QAAQ,GAAG,YAAY,MAAM,IAAI,aAAa,MAAM;AACpF;","names":[]}

25
node_modules/drizzle-orm/sql/functions/index.cjs generated vendored Normal file
View File

@ -0,0 +1,25 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var functions_exports = {};
module.exports = __toCommonJS(functions_exports);
__reExport(functions_exports, require("./aggregate.cjs"), module.exports);
__reExport(functions_exports, require("./vector.cjs"), module.exports);
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
...require("./aggregate.cjs"),
...require("./vector.cjs")
});
//# sourceMappingURL=index.cjs.map

1
node_modules/drizzle-orm/sql/functions/index.cjs.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/sql/functions/index.ts"],"sourcesContent":["export * from './aggregate.ts';\nexport * from './vector.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,8BAAc,2BAAd;AACA,8BAAc,wBADd;","names":[]}

2
node_modules/drizzle-orm/sql/functions/index.d.cts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export * from "./aggregate.cjs";
export * from "./vector.cjs";

2
node_modules/drizzle-orm/sql/functions/index.d.ts generated vendored Normal file
View File

@ -0,0 +1,2 @@
export * from "./aggregate.js";
export * from "./vector.js";

3
node_modules/drizzle-orm/sql/functions/index.js generated vendored Normal file
View File

@ -0,0 +1,3 @@
export * from "./aggregate.js";
export * from "./vector.js";
//# sourceMappingURL=index.js.map

1
node_modules/drizzle-orm/sql/functions/index.js.map generated vendored Normal file
View File

@ -0,0 +1 @@
{"version":3,"sources":["../../../src/sql/functions/index.ts"],"sourcesContent":["export * from './aggregate.ts';\nexport * from './vector.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}

78
node_modules/drizzle-orm/sql/functions/vector.cjs generated vendored Normal file
View File

@ -0,0 +1,78 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var vector_exports = {};
__export(vector_exports, {
cosineDistance: () => cosineDistance,
hammingDistance: () => hammingDistance,
innerProduct: () => innerProduct,
jaccardDistance: () => jaccardDistance,
l1Distance: () => l1Distance,
l2Distance: () => l2Distance
});
module.exports = __toCommonJS(vector_exports);
var import_sql = require("../sql.cjs");
function toSql(value) {
return JSON.stringify(value);
}
function l2Distance(column, value) {
if (Array.isArray(value)) {
return import_sql.sql`${column} <-> ${toSql(value)}`;
}
return import_sql.sql`${column} <-> ${value}`;
}
function l1Distance(column, value) {
if (Array.isArray(value)) {
return import_sql.sql`${column} <+> ${toSql(value)}`;
}
return import_sql.sql`${column} <+> ${value}`;
}
function innerProduct(column, value) {
if (Array.isArray(value)) {
return import_sql.sql`${column} <#> ${toSql(value)}`;
}
return import_sql.sql`${column} <#> ${value}`;
}
function cosineDistance(column, value) {
if (Array.isArray(value)) {
return import_sql.sql`${column} <=> ${toSql(value)}`;
}
return import_sql.sql`${column} <=> ${value}`;
}
function hammingDistance(column, value) {
if (Array.isArray(value)) {
return import_sql.sql`${column} <~> ${toSql(value)}`;
}
return import_sql.sql`${column} <~> ${value}`;
}
function jaccardDistance(column, value) {
if (Array.isArray(value)) {
return import_sql.sql`${column} <%> ${toSql(value)}`;
}
return import_sql.sql`${column} <%> ${value}`;
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
cosineDistance,
hammingDistance,
innerProduct,
jaccardDistance,
l1Distance,
l2Distance
});
//# sourceMappingURL=vector.cjs.map

File diff suppressed because one or more lines are too long

120
node_modules/drizzle-orm/sql/functions/vector.d.cts generated vendored Normal file
View File

@ -0,0 +1,120 @@
import type { AnyColumn } from "../../column.cjs";
import type { TypedQueryBuilder } from "../../query-builders/query-builder.cjs";
import { type SQL, type SQLWrapper } from "../sql.cjs";
/**
* Used in sorting and in querying, if used in sorting,
* this specifies that the given column or expression should be sorted in an order
* that minimizes the L2 distance to the given value.
* If used in querying, this specifies that it should return the L2 distance
* between the given column or expression and the given value.
*
* ## Examples
*
* ```ts
* // Sort cars by embedding similarity
* // to the given embedding
* db.select().from(cars)
* .orderBy(l2Distance(cars.embedding, embedding));
* ```
*
* ```ts
* // Select distance of cars and embedding
* // to the given embedding
* db.select({distance: l2Distance(cars.embedding, embedding)}).from(cars)
* ```
*/
export declare function l2Distance(column: SQLWrapper | AnyColumn, value: number[] | string[] | TypedQueryBuilder<any> | string): SQL;
/**
* L1 distance is one of the possible distance measures between two probability distribution vectors and it is
* calculated as the sum of the absolute differences.
* The smaller the distance between the observed probability vectors, the higher the accuracy of the synthetic data
*
* ## Examples
*
* ```ts
* // Sort cars by embedding similarity
* // to the given embedding
* db.select().from(cars)
* .orderBy(l1Distance(cars.embedding, embedding));
* ```
*
* ```ts
* // Select distance of cars and embedding
* // to the given embedding
* db.select({distance: l1Distance(cars.embedding, embedding)}).from(cars)
* ```
*/
export declare function l1Distance(column: SQLWrapper | AnyColumn, value: number[] | string[] | TypedQueryBuilder<any> | string): SQL;
/**
* Used in sorting and in querying, if used in sorting,
* this specifies that the given column or expression should be sorted in an order
* that minimizes the inner product distance to the given value.
* If used in querying, this specifies that it should return the inner product distance
* between the given column or expression and the given value.
*
* ## Examples
*
* ```ts
* // Sort cars by embedding similarity
* // to the given embedding
* db.select().from(cars)
* .orderBy(innerProduct(cars.embedding, embedding));
* ```
*
* ```ts
* // Select distance of cars and embedding
* // to the given embedding
* db.select({ distance: innerProduct(cars.embedding, embedding) }).from(cars)
* ```
*/
export declare function innerProduct(column: SQLWrapper | AnyColumn, value: number[] | string[] | TypedQueryBuilder<any> | string): SQL;
/**
* Used in sorting and in querying, if used in sorting,
* this specifies that the given column or expression should be sorted in an order
* that minimizes the cosine distance to the given value.
* If used in querying, this specifies that it should return the cosine distance
* between the given column or expression and the given value.
*
* ## Examples
*
* ```ts
* // Sort cars by embedding similarity
* // to the given embedding
* db.select().from(cars)
* .orderBy(cosineDistance(cars.embedding, embedding));
* ```
*
* ```ts
* // Select distance of cars and embedding
* // to the given embedding
* db.select({distance: cosineDistance(cars.embedding, embedding)}).from(cars)
* ```
*/
export declare function cosineDistance(column: SQLWrapper | AnyColumn, value: number[] | string[] | TypedQueryBuilder<any> | string): SQL;
/**
* Hamming distance between two strings or vectors of equal length is the number of positions at which the
* corresponding symbols are different. In other words, it measures the minimum number of
* substitutions required to change one string into the other, or equivalently,
* the minimum number of errors that could have transformed one string into the other
*
* ## Examples
*
* ```ts
* // Sort cars by embedding similarity
* // to the given embedding
* db.select().from(cars)
* .orderBy(hammingDistance(cars.embedding, embedding));
* ```
*/
export declare function hammingDistance(column: SQLWrapper | AnyColumn, value: number[] | string[] | TypedQueryBuilder<any> | string): SQL;
/**
* ## Examples
*
* ```ts
* // Sort cars by embedding similarity
* // to the given embedding
* db.select().from(cars)
* .orderBy(jaccardDistance(cars.embedding, embedding));
* ```
*/
export declare function jaccardDistance(column: SQLWrapper | AnyColumn, value: number[] | string[] | TypedQueryBuilder<any> | string): SQL;

120
node_modules/drizzle-orm/sql/functions/vector.d.ts generated vendored Normal file
View File

@ -0,0 +1,120 @@
import type { AnyColumn } from "../../column.js";
import type { TypedQueryBuilder } from "../../query-builders/query-builder.js";
import { type SQL, type SQLWrapper } from "../sql.js";
/**
* Used in sorting and in querying, if used in sorting,
* this specifies that the given column or expression should be sorted in an order
* that minimizes the L2 distance to the given value.
* If used in querying, this specifies that it should return the L2 distance
* between the given column or expression and the given value.
*
* ## Examples
*
* ```ts
* // Sort cars by embedding similarity
* // to the given embedding
* db.select().from(cars)
* .orderBy(l2Distance(cars.embedding, embedding));
* ```
*
* ```ts
* // Select distance of cars and embedding
* // to the given embedding
* db.select({distance: l2Distance(cars.embedding, embedding)}).from(cars)
* ```
*/
export declare function l2Distance(column: SQLWrapper | AnyColumn, value: number[] | string[] | TypedQueryBuilder<any> | string): SQL;
/**
* L1 distance is one of the possible distance measures between two probability distribution vectors and it is
* calculated as the sum of the absolute differences.
* The smaller the distance between the observed probability vectors, the higher the accuracy of the synthetic data
*
* ## Examples
*
* ```ts
* // Sort cars by embedding similarity
* // to the given embedding
* db.select().from(cars)
* .orderBy(l1Distance(cars.embedding, embedding));
* ```
*
* ```ts
* // Select distance of cars and embedding
* // to the given embedding
* db.select({distance: l1Distance(cars.embedding, embedding)}).from(cars)
* ```
*/
export declare function l1Distance(column: SQLWrapper | AnyColumn, value: number[] | string[] | TypedQueryBuilder<any> | string): SQL;
/**
* Used in sorting and in querying, if used in sorting,
* this specifies that the given column or expression should be sorted in an order
* that minimizes the inner product distance to the given value.
* If used in querying, this specifies that it should return the inner product distance
* between the given column or expression and the given value.
*
* ## Examples
*
* ```ts
* // Sort cars by embedding similarity
* // to the given embedding
* db.select().from(cars)
* .orderBy(innerProduct(cars.embedding, embedding));
* ```
*
* ```ts
* // Select distance of cars and embedding
* // to the given embedding
* db.select({ distance: innerProduct(cars.embedding, embedding) }).from(cars)
* ```
*/
export declare function innerProduct(column: SQLWrapper | AnyColumn, value: number[] | string[] | TypedQueryBuilder<any> | string): SQL;
/**
* Used in sorting and in querying, if used in sorting,
* this specifies that the given column or expression should be sorted in an order
* that minimizes the cosine distance to the given value.
* If used in querying, this specifies that it should return the cosine distance
* between the given column or expression and the given value.
*
* ## Examples
*
* ```ts
* // Sort cars by embedding similarity
* // to the given embedding
* db.select().from(cars)
* .orderBy(cosineDistance(cars.embedding, embedding));
* ```
*
* ```ts
* // Select distance of cars and embedding
* // to the given embedding
* db.select({distance: cosineDistance(cars.embedding, embedding)}).from(cars)
* ```
*/
export declare function cosineDistance(column: SQLWrapper | AnyColumn, value: number[] | string[] | TypedQueryBuilder<any> | string): SQL;
/**
* Hamming distance between two strings or vectors of equal length is the number of positions at which the
* corresponding symbols are different. In other words, it measures the minimum number of
* substitutions required to change one string into the other, or equivalently,
* the minimum number of errors that could have transformed one string into the other
*
* ## Examples
*
* ```ts
* // Sort cars by embedding similarity
* // to the given embedding
* db.select().from(cars)
* .orderBy(hammingDistance(cars.embedding, embedding));
* ```
*/
export declare function hammingDistance(column: SQLWrapper | AnyColumn, value: number[] | string[] | TypedQueryBuilder<any> | string): SQL;
/**
* ## Examples
*
* ```ts
* // Sort cars by embedding similarity
* // to the given embedding
* db.select().from(cars)
* .orderBy(jaccardDistance(cars.embedding, embedding));
* ```
*/
export declare function jaccardDistance(column: SQLWrapper | AnyColumn, value: number[] | string[] | TypedQueryBuilder<any> | string): SQL;

49
node_modules/drizzle-orm/sql/functions/vector.js generated vendored Normal file
View File

@ -0,0 +1,49 @@
import { sql } from "../sql.js";
function toSql(value) {
return JSON.stringify(value);
}
function l2Distance(column, value) {
if (Array.isArray(value)) {
return sql`${column} <-> ${toSql(value)}`;
}
return sql`${column} <-> ${value}`;
}
function l1Distance(column, value) {
if (Array.isArray(value)) {
return sql`${column} <+> ${toSql(value)}`;
}
return sql`${column} <+> ${value}`;
}
function innerProduct(column, value) {
if (Array.isArray(value)) {
return sql`${column} <#> ${toSql(value)}`;
}
return sql`${column} <#> ${value}`;
}
function cosineDistance(column, value) {
if (Array.isArray(value)) {
return sql`${column} <=> ${toSql(value)}`;
}
return sql`${column} <=> ${value}`;
}
function hammingDistance(column, value) {
if (Array.isArray(value)) {
return sql`${column} <~> ${toSql(value)}`;
}
return sql`${column} <~> ${value}`;
}
function jaccardDistance(column, value) {
if (Array.isArray(value)) {
return sql`${column} <%> ${toSql(value)}`;
}
return sql`${column} <%> ${value}`;
}
export {
cosineDistance,
hammingDistance,
innerProduct,
jaccardDistance,
l1Distance,
l2Distance
};
//# sourceMappingURL=vector.js.map

1
node_modules/drizzle-orm/sql/functions/vector.js.map generated vendored Normal file

File diff suppressed because one or more lines are too long