Initial commit: New MoreminiMore website with fresh design
This commit is contained in:
97
node_modules/drizzle-orm/gel/driver.cjs
generated
vendored
Normal file
97
node_modules/drizzle-orm/gel/driver.cjs
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
"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 driver_exports = {};
|
||||
__export(driver_exports, {
|
||||
GelDriver: () => GelDriver,
|
||||
GelJsDatabase: () => GelJsDatabase,
|
||||
drizzle: () => drizzle
|
||||
});
|
||||
module.exports = __toCommonJS(driver_exports);
|
||||
var import_gel = require("gel");
|
||||
var import_entity = require("../entity.cjs");
|
||||
var import_db = require("../gel-core/db.cjs");
|
||||
var import_dialect = require("../gel-core/dialect.cjs");
|
||||
var import_logger = require("../logger.cjs");
|
||||
var import_relations = require("../relations.cjs");
|
||||
var import_utils = require("../utils.cjs");
|
||||
var import_session = require("./session.cjs");
|
||||
class GelDriver {
|
||||
constructor(client, dialect, options = {}) {
|
||||
this.client = client;
|
||||
this.dialect = dialect;
|
||||
this.options = options;
|
||||
}
|
||||
static [import_entity.entityKind] = "GelDriver";
|
||||
createSession(schema) {
|
||||
return new import_session.GelDbSession(this.client, this.dialect, schema, { logger: this.options.logger });
|
||||
}
|
||||
}
|
||||
class GelJsDatabase extends import_db.GelDatabase {
|
||||
static [import_entity.entityKind] = "GelJsDatabase";
|
||||
}
|
||||
function construct(client, config = {}) {
|
||||
const dialect = new import_dialect.GelDialect({ casing: config.casing });
|
||||
let logger;
|
||||
if (config.logger === true) {
|
||||
logger = new import_logger.DefaultLogger();
|
||||
} else if (config.logger !== false) {
|
||||
logger = config.logger;
|
||||
}
|
||||
let schema;
|
||||
if (config.schema) {
|
||||
const tablesConfig = (0, import_relations.extractTablesRelationalConfig)(config.schema, import_relations.createTableRelationsHelpers);
|
||||
schema = {
|
||||
fullSchema: config.schema,
|
||||
schema: tablesConfig.tables,
|
||||
tableNamesMap: tablesConfig.tableNamesMap
|
||||
};
|
||||
}
|
||||
const driver = new GelDriver(client, dialect, { logger });
|
||||
const session = driver.createSession(schema);
|
||||
const db = new GelJsDatabase(dialect, session, schema);
|
||||
db.$client = client;
|
||||
return db;
|
||||
}
|
||||
function drizzle(...params) {
|
||||
if (typeof params[0] === "string") {
|
||||
const instance = (0, import_gel.createClient)({ dsn: params[0] });
|
||||
return construct(instance, params[1]);
|
||||
}
|
||||
if ((0, import_utils.isConfig)(params[0])) {
|
||||
const { connection, client, ...drizzleConfig } = params[0];
|
||||
if (client)
|
||||
return construct(client, drizzleConfig);
|
||||
const instance = (0, import_gel.createClient)(connection);
|
||||
return construct(instance, drizzleConfig);
|
||||
}
|
||||
return construct(params[0], params[1]);
|
||||
}
|
||||
((drizzle2) => {
|
||||
function mock(config) {
|
||||
return construct({}, config);
|
||||
}
|
||||
drizzle2.mock = mock;
|
||||
})(drizzle || (drizzle = {}));
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
GelDriver,
|
||||
GelJsDatabase,
|
||||
drizzle
|
||||
});
|
||||
//# sourceMappingURL=driver.cjs.map
|
||||
1
node_modules/drizzle-orm/gel/driver.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/gel/driver.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
38
node_modules/drizzle-orm/gel/driver.d.cts
generated
vendored
Normal file
38
node_modules/drizzle-orm/gel/driver.d.cts
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import { type Client, type ConnectOptions } from 'gel';
|
||||
import { entityKind } from "../entity.cjs";
|
||||
import { GelDatabase } from "../gel-core/db.cjs";
|
||||
import { GelDialect } from "../gel-core/dialect.cjs";
|
||||
import type { GelQueryResultHKT } from "../gel-core/session.cjs";
|
||||
import type { Logger } from "../logger.cjs";
|
||||
import { type RelationalSchemaConfig, type TablesRelationalConfig } from "../relations.cjs";
|
||||
import { type DrizzleConfig } from "../utils.cjs";
|
||||
import type { GelClient } from "./session.cjs";
|
||||
import { GelDbSession } from "./session.cjs";
|
||||
export interface GelDriverOptions {
|
||||
logger?: Logger;
|
||||
}
|
||||
export declare class GelDriver {
|
||||
private client;
|
||||
private dialect;
|
||||
private options;
|
||||
static readonly [entityKind]: string;
|
||||
constructor(client: GelClient, dialect: GelDialect, options?: GelDriverOptions);
|
||||
createSession(schema: RelationalSchemaConfig<TablesRelationalConfig> | undefined): GelDbSession<Record<string, unknown>, TablesRelationalConfig>;
|
||||
}
|
||||
export declare class GelJsDatabase<TSchema extends Record<string, unknown> = Record<string, never>> extends GelDatabase<GelQueryResultHKT, TSchema> {
|
||||
static readonly [entityKind]: string;
|
||||
}
|
||||
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TClient extends GelClient = Client>(...params: [TClient | string] | [TClient | string, DrizzleConfig<TSchema>] | [
|
||||
DrizzleConfig<TSchema> & ({
|
||||
connection: string | ConnectOptions;
|
||||
} | {
|
||||
client: TClient;
|
||||
})
|
||||
]): GelJsDatabase<TSchema> & {
|
||||
$client: TClient;
|
||||
};
|
||||
export declare namespace drizzle {
|
||||
function mock<TSchema extends Record<string, unknown> = Record<string, never>>(config?: DrizzleConfig<TSchema>): GelJsDatabase<TSchema> & {
|
||||
$client: '$client is not available on drizzle.mock()';
|
||||
};
|
||||
}
|
||||
38
node_modules/drizzle-orm/gel/driver.d.ts
generated
vendored
Normal file
38
node_modules/drizzle-orm/gel/driver.d.ts
generated
vendored
Normal file
@@ -0,0 +1,38 @@
|
||||
import { type Client, type ConnectOptions } from 'gel';
|
||||
import { entityKind } from "../entity.js";
|
||||
import { GelDatabase } from "../gel-core/db.js";
|
||||
import { GelDialect } from "../gel-core/dialect.js";
|
||||
import type { GelQueryResultHKT } from "../gel-core/session.js";
|
||||
import type { Logger } from "../logger.js";
|
||||
import { type RelationalSchemaConfig, type TablesRelationalConfig } from "../relations.js";
|
||||
import { type DrizzleConfig } from "../utils.js";
|
||||
import type { GelClient } from "./session.js";
|
||||
import { GelDbSession } from "./session.js";
|
||||
export interface GelDriverOptions {
|
||||
logger?: Logger;
|
||||
}
|
||||
export declare class GelDriver {
|
||||
private client;
|
||||
private dialect;
|
||||
private options;
|
||||
static readonly [entityKind]: string;
|
||||
constructor(client: GelClient, dialect: GelDialect, options?: GelDriverOptions);
|
||||
createSession(schema: RelationalSchemaConfig<TablesRelationalConfig> | undefined): GelDbSession<Record<string, unknown>, TablesRelationalConfig>;
|
||||
}
|
||||
export declare class GelJsDatabase<TSchema extends Record<string, unknown> = Record<string, never>> extends GelDatabase<GelQueryResultHKT, TSchema> {
|
||||
static readonly [entityKind]: string;
|
||||
}
|
||||
export declare function drizzle<TSchema extends Record<string, unknown> = Record<string, never>, TClient extends GelClient = Client>(...params: [TClient | string] | [TClient | string, DrizzleConfig<TSchema>] | [
|
||||
DrizzleConfig<TSchema> & ({
|
||||
connection: string | ConnectOptions;
|
||||
} | {
|
||||
client: TClient;
|
||||
})
|
||||
]): GelJsDatabase<TSchema> & {
|
||||
$client: TClient;
|
||||
};
|
||||
export declare namespace drizzle {
|
||||
function mock<TSchema extends Record<string, unknown> = Record<string, never>>(config?: DrizzleConfig<TSchema>): GelJsDatabase<TSchema> & {
|
||||
$client: '$client is not available on drizzle.mock()';
|
||||
};
|
||||
}
|
||||
74
node_modules/drizzle-orm/gel/driver.js
generated
vendored
Normal file
74
node_modules/drizzle-orm/gel/driver.js
generated
vendored
Normal file
@@ -0,0 +1,74 @@
|
||||
import { createClient } from "gel";
|
||||
import { entityKind } from "../entity.js";
|
||||
import { GelDatabase } from "../gel-core/db.js";
|
||||
import { GelDialect } from "../gel-core/dialect.js";
|
||||
import { DefaultLogger } from "../logger.js";
|
||||
import {
|
||||
createTableRelationsHelpers,
|
||||
extractTablesRelationalConfig
|
||||
} from "../relations.js";
|
||||
import { isConfig } from "../utils.js";
|
||||
import { GelDbSession } from "./session.js";
|
||||
class GelDriver {
|
||||
constructor(client, dialect, options = {}) {
|
||||
this.client = client;
|
||||
this.dialect = dialect;
|
||||
this.options = options;
|
||||
}
|
||||
static [entityKind] = "GelDriver";
|
||||
createSession(schema) {
|
||||
return new GelDbSession(this.client, this.dialect, schema, { logger: this.options.logger });
|
||||
}
|
||||
}
|
||||
class GelJsDatabase extends GelDatabase {
|
||||
static [entityKind] = "GelJsDatabase";
|
||||
}
|
||||
function construct(client, config = {}) {
|
||||
const dialect = new GelDialect({ casing: config.casing });
|
||||
let logger;
|
||||
if (config.logger === true) {
|
||||
logger = new DefaultLogger();
|
||||
} else if (config.logger !== false) {
|
||||
logger = config.logger;
|
||||
}
|
||||
let schema;
|
||||
if (config.schema) {
|
||||
const tablesConfig = extractTablesRelationalConfig(config.schema, createTableRelationsHelpers);
|
||||
schema = {
|
||||
fullSchema: config.schema,
|
||||
schema: tablesConfig.tables,
|
||||
tableNamesMap: tablesConfig.tableNamesMap
|
||||
};
|
||||
}
|
||||
const driver = new GelDriver(client, dialect, { logger });
|
||||
const session = driver.createSession(schema);
|
||||
const db = new GelJsDatabase(dialect, session, schema);
|
||||
db.$client = client;
|
||||
return db;
|
||||
}
|
||||
function drizzle(...params) {
|
||||
if (typeof params[0] === "string") {
|
||||
const instance = createClient({ dsn: params[0] });
|
||||
return construct(instance, params[1]);
|
||||
}
|
||||
if (isConfig(params[0])) {
|
||||
const { connection, client, ...drizzleConfig } = params[0];
|
||||
if (client)
|
||||
return construct(client, drizzleConfig);
|
||||
const instance = createClient(connection);
|
||||
return construct(instance, drizzleConfig);
|
||||
}
|
||||
return construct(params[0], params[1]);
|
||||
}
|
||||
((drizzle2) => {
|
||||
function mock(config) {
|
||||
return construct({}, config);
|
||||
}
|
||||
drizzle2.mock = mock;
|
||||
})(drizzle || (drizzle = {}));
|
||||
export {
|
||||
GelDriver,
|
||||
GelJsDatabase,
|
||||
drizzle
|
||||
};
|
||||
//# sourceMappingURL=driver.js.map
|
||||
1
node_modules/drizzle-orm/gel/driver.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/gel/driver.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
25
node_modules/drizzle-orm/gel/index.cjs
generated
vendored
Normal file
25
node_modules/drizzle-orm/gel/index.cjs
generated
vendored
Normal 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 gel_exports = {};
|
||||
module.exports = __toCommonJS(gel_exports);
|
||||
__reExport(gel_exports, require("./driver.cjs"), module.exports);
|
||||
__reExport(gel_exports, require("./session.cjs"), module.exports);
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
...require("./driver.cjs"),
|
||||
...require("./session.cjs")
|
||||
});
|
||||
//# sourceMappingURL=index.cjs.map
|
||||
1
node_modules/drizzle-orm/gel/index.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/gel/index.cjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/gel/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,wBAAc,wBAAd;AACA,wBAAc,yBADd;","names":[]}
|
||||
2
node_modules/drizzle-orm/gel/index.d.cts
generated
vendored
Normal file
2
node_modules/drizzle-orm/gel/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./driver.cjs";
|
||||
export * from "./session.cjs";
|
||||
2
node_modules/drizzle-orm/gel/index.d.ts
generated
vendored
Normal file
2
node_modules/drizzle-orm/gel/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
export * from "./driver.js";
|
||||
export * from "./session.js";
|
||||
3
node_modules/drizzle-orm/gel/index.js
generated
vendored
Normal file
3
node_modules/drizzle-orm/gel/index.js
generated
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
export * from "./driver.js";
|
||||
export * from "./session.js";
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/drizzle-orm/gel/index.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/gel/index.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/gel/index.ts"],"sourcesContent":["export * from './driver.ts';\nexport * from './session.ts';\n"],"mappings":"AAAA,cAAc;AACd,cAAc;","names":[]}
|
||||
5
node_modules/drizzle-orm/gel/migrator.cjs
generated
vendored
Normal file
5
node_modules/drizzle-orm/gel/migrator.cjs
generated
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
"use strict";
|
||||
async function migrate() {
|
||||
return {};
|
||||
}
|
||||
//# sourceMappingURL=migrator.cjs.map
|
||||
1
node_modules/drizzle-orm/gel/migrator.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/gel/migrator.cjs.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/gel/migrator.ts"],"sourcesContent":["// import type { MigrationConfig } from '~/migrator.ts';\n// import { readMigrationFiles } from '~/migrator.ts';\n// import type { GelJsDatabase } from './driver.ts';\n\n// not supported\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nasync function migrate<TSchema extends Record<string, unknown>>(\n\t// db: GelJsDatabase<TSchema>,\n\t// config: MigrationConfig,\n) {\n\treturn {};\n\t// const migrations = readMigrationFiles(config);\n\t// await db.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":";AAMA,eAAe,UAGb;AACD,SAAO,CAAC;AAGT;","names":[]}
|
||||
1
node_modules/drizzle-orm/gel/migrator.d.cts
generated
vendored
Normal file
1
node_modules/drizzle-orm/gel/migrator.d.cts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare function migrate<TSchema extends Record<string, unknown>>(): Promise<{}>;
|
||||
1
node_modules/drizzle-orm/gel/migrator.d.ts
generated
vendored
Normal file
1
node_modules/drizzle-orm/gel/migrator.d.ts
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
declare function migrate<TSchema extends Record<string, unknown>>(): Promise<{}>;
|
||||
4
node_modules/drizzle-orm/gel/migrator.js
generated
vendored
Normal file
4
node_modules/drizzle-orm/gel/migrator.js
generated
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
async function migrate() {
|
||||
return {};
|
||||
}
|
||||
//# sourceMappingURL=migrator.js.map
|
||||
1
node_modules/drizzle-orm/gel/migrator.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/gel/migrator.js.map
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/gel/migrator.ts"],"sourcesContent":["// import type { MigrationConfig } from '~/migrator.ts';\n// import { readMigrationFiles } from '~/migrator.ts';\n// import type { GelJsDatabase } from './driver.ts';\n\n// not supported\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nasync function migrate<TSchema extends Record<string, unknown>>(\n\t// db: GelJsDatabase<TSchema>,\n\t// config: MigrationConfig,\n) {\n\treturn {};\n\t// const migrations = readMigrationFiles(config);\n\t// await db.dialect.migrate(migrations, db.session, config);\n}\n"],"mappings":"AAMA,eAAe,UAGb;AACD,SAAO,CAAC;AAGT;","names":[]}
|
||||
139
node_modules/drizzle-orm/gel/session.cjs
generated
vendored
Normal file
139
node_modules/drizzle-orm/gel/session.cjs
generated
vendored
Normal file
@@ -0,0 +1,139 @@
|
||||
"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 session_exports = {};
|
||||
__export(session_exports, {
|
||||
GelDbPreparedQuery: () => GelDbPreparedQuery,
|
||||
GelDbSession: () => GelDbSession,
|
||||
GelDbTransaction: () => GelDbTransaction
|
||||
});
|
||||
module.exports = __toCommonJS(session_exports);
|
||||
var import_entity = require("../entity.cjs");
|
||||
var import_session = require("../gel-core/session.cjs");
|
||||
var import_logger = require("../logger.cjs");
|
||||
var import_sql = require("../sql/sql.cjs");
|
||||
var import_tracing = require("../tracing.cjs");
|
||||
var import_utils = require("../utils.cjs");
|
||||
class GelDbPreparedQuery extends import_session.GelPreparedQuery {
|
||||
constructor(client, queryString, params, logger, fields, _isResponseInArrayMode, customResultMapper, transaction = false) {
|
||||
super({ sql: queryString, params });
|
||||
this.client = client;
|
||||
this.queryString = queryString;
|
||||
this.params = params;
|
||||
this.logger = logger;
|
||||
this.fields = fields;
|
||||
this._isResponseInArrayMode = _isResponseInArrayMode;
|
||||
this.customResultMapper = customResultMapper;
|
||||
this.transaction = transaction;
|
||||
}
|
||||
static [import_entity.entityKind] = "GelPreparedQuery";
|
||||
async execute(placeholderValues = {}) {
|
||||
return import_tracing.tracer.startActiveSpan("drizzle.execute", async () => {
|
||||
const params = (0, import_sql.fillPlaceholders)(this.params, placeholderValues);
|
||||
this.logger.logQuery(this.queryString, params);
|
||||
const { fields, queryString: query, client, joinsNotNullableMap, customResultMapper } = this;
|
||||
if (!fields && !customResultMapper) {
|
||||
return import_tracing.tracer.startActiveSpan("drizzle.driver.execute", async (span) => {
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": query,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
return client.querySQL(query, params.length ? params : void 0);
|
||||
});
|
||||
}
|
||||
const result = await import_tracing.tracer.startActiveSpan("drizzle.driver.execute", (span) => {
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": query,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
return client.withSQLRowMode("array").querySQL(query, params.length ? params : void 0);
|
||||
});
|
||||
return import_tracing.tracer.startActiveSpan("drizzle.mapResponse", () => {
|
||||
return customResultMapper ? customResultMapper(result) : result.map((row) => (0, import_utils.mapResultRow)(fields, row, joinsNotNullableMap));
|
||||
});
|
||||
});
|
||||
}
|
||||
all(placeholderValues = {}) {
|
||||
return import_tracing.tracer.startActiveSpan("drizzle.execute", () => {
|
||||
const params = (0, import_sql.fillPlaceholders)(this.params, placeholderValues);
|
||||
this.logger.logQuery(this.queryString, params);
|
||||
return import_tracing.tracer.startActiveSpan("drizzle.driver.execute", (span) => {
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": this.queryString,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
return this.client.withSQLRowMode("array").querySQL(this.queryString, params.length ? params : void 0).then((result) => result);
|
||||
});
|
||||
});
|
||||
}
|
||||
/** @internal */
|
||||
isResponseInArrayMode() {
|
||||
return this._isResponseInArrayMode;
|
||||
}
|
||||
}
|
||||
class GelDbSession extends import_session.GelSession {
|
||||
constructor(client, dialect, schema, options = {}) {
|
||||
super(dialect);
|
||||
this.client = client;
|
||||
this.schema = schema;
|
||||
this.options = options;
|
||||
this.logger = options.logger ?? new import_logger.NoopLogger();
|
||||
}
|
||||
static [import_entity.entityKind] = "GelDbSession";
|
||||
logger;
|
||||
prepareQuery(query, fields, name, isResponseInArrayMode, customResultMapper) {
|
||||
return new GelDbPreparedQuery(
|
||||
this.client,
|
||||
query.sql,
|
||||
query.params,
|
||||
this.logger,
|
||||
fields,
|
||||
isResponseInArrayMode,
|
||||
customResultMapper
|
||||
);
|
||||
}
|
||||
async transaction(transaction) {
|
||||
return await this.client.transaction(async (clientTx) => {
|
||||
const session = new GelDbSession(clientTx, this.dialect, this.schema, this.options);
|
||||
const tx = new GelDbTransaction(this.dialect, session, this.schema);
|
||||
return await transaction(tx);
|
||||
});
|
||||
}
|
||||
async count(sql) {
|
||||
const res = await this.execute(sql);
|
||||
return Number(res[0]["count"]);
|
||||
}
|
||||
}
|
||||
class GelDbTransaction extends import_session.GelTransaction {
|
||||
static [import_entity.entityKind] = "GelDbTransaction";
|
||||
async transaction(transaction) {
|
||||
const tx = new GelDbTransaction(
|
||||
this.dialect,
|
||||
this.session,
|
||||
this.schema
|
||||
);
|
||||
return await transaction(tx);
|
||||
}
|
||||
}
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
GelDbPreparedQuery,
|
||||
GelDbSession,
|
||||
GelDbTransaction
|
||||
});
|
||||
//# sourceMappingURL=session.cjs.map
|
||||
1
node_modules/drizzle-orm/gel/session.cjs.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/gel/session.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
47
node_modules/drizzle-orm/gel/session.d.cts
generated
vendored
Normal file
47
node_modules/drizzle-orm/gel/session.d.cts
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
import type { Client } from 'gel';
|
||||
import type { Transaction } from 'gel/dist/transaction';
|
||||
import { entityKind } from "../entity.cjs";
|
||||
import type { GelDialect } from "../gel-core/dialect.cjs";
|
||||
import type { SelectedFieldsOrdered } from "../gel-core/query-builders/select.types.cjs";
|
||||
import { GelPreparedQuery, GelSession, GelTransaction, type PreparedQueryConfig } from "../gel-core/session.cjs";
|
||||
import { type Logger } from "../logger.cjs";
|
||||
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.cjs";
|
||||
import { type Query, type SQL } from "../sql/sql.cjs";
|
||||
export type GelClient = Client | Transaction;
|
||||
export declare class GelDbPreparedQuery<T extends PreparedQueryConfig> extends GelPreparedQuery<T> {
|
||||
private client;
|
||||
private queryString;
|
||||
private params;
|
||||
private logger;
|
||||
private fields;
|
||||
private _isResponseInArrayMode;
|
||||
private customResultMapper?;
|
||||
private transaction;
|
||||
static readonly [entityKind]: string;
|
||||
constructor(client: GelClient, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, _isResponseInArrayMode: boolean, customResultMapper?: ((rows: unknown[][]) => T["execute"]) | undefined, transaction?: boolean);
|
||||
execute(placeholderValues?: Record<string, unknown> | undefined): Promise<T['execute']>;
|
||||
all(placeholderValues?: Record<string, unknown> | undefined): Promise<T['all']>;
|
||||
}
|
||||
export interface GelSessionOptions {
|
||||
logger?: Logger;
|
||||
}
|
||||
export declare class GelDbSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends GelSession<GelQueryResultHKT, TFullSchema, TSchema> {
|
||||
private client;
|
||||
private schema;
|
||||
private options;
|
||||
static readonly [entityKind]: string;
|
||||
private logger;
|
||||
constructor(client: GelClient, dialect: GelDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: GelSessionOptions);
|
||||
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, name: string | undefined, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => T['execute']): GelDbPreparedQuery<T>;
|
||||
transaction<T>(transaction: (tx: GelTransaction<GelQueryResultHKT, TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
||||
count(sql: SQL): Promise<number>;
|
||||
}
|
||||
export declare class GelDbTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends GelTransaction<GelQueryResultHKT, TFullSchema, TSchema> {
|
||||
static readonly [entityKind]: string;
|
||||
transaction<T>(transaction: (tx: GelDbTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
||||
}
|
||||
export interface GelQueryResultHKT {
|
||||
readonly $brand: 'GelQueryResultHKT';
|
||||
readonly row: unknown;
|
||||
readonly type: unknown;
|
||||
}
|
||||
47
node_modules/drizzle-orm/gel/session.d.ts
generated
vendored
Normal file
47
node_modules/drizzle-orm/gel/session.d.ts
generated
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
import type { Client } from 'gel';
|
||||
import type { Transaction } from 'gel/dist/transaction';
|
||||
import { entityKind } from "../entity.js";
|
||||
import type { GelDialect } from "../gel-core/dialect.js";
|
||||
import type { SelectedFieldsOrdered } from "../gel-core/query-builders/select.types.js";
|
||||
import { GelPreparedQuery, GelSession, GelTransaction, type PreparedQueryConfig } from "../gel-core/session.js";
|
||||
import { type Logger } from "../logger.js";
|
||||
import type { RelationalSchemaConfig, TablesRelationalConfig } from "../relations.js";
|
||||
import { type Query, type SQL } from "../sql/sql.js";
|
||||
export type GelClient = Client | Transaction;
|
||||
export declare class GelDbPreparedQuery<T extends PreparedQueryConfig> extends GelPreparedQuery<T> {
|
||||
private client;
|
||||
private queryString;
|
||||
private params;
|
||||
private logger;
|
||||
private fields;
|
||||
private _isResponseInArrayMode;
|
||||
private customResultMapper?;
|
||||
private transaction;
|
||||
static readonly [entityKind]: string;
|
||||
constructor(client: GelClient, queryString: string, params: unknown[], logger: Logger, fields: SelectedFieldsOrdered | undefined, _isResponseInArrayMode: boolean, customResultMapper?: ((rows: unknown[][]) => T["execute"]) | undefined, transaction?: boolean);
|
||||
execute(placeholderValues?: Record<string, unknown> | undefined): Promise<T['execute']>;
|
||||
all(placeholderValues?: Record<string, unknown> | undefined): Promise<T['all']>;
|
||||
}
|
||||
export interface GelSessionOptions {
|
||||
logger?: Logger;
|
||||
}
|
||||
export declare class GelDbSession<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends GelSession<GelQueryResultHKT, TFullSchema, TSchema> {
|
||||
private client;
|
||||
private schema;
|
||||
private options;
|
||||
static readonly [entityKind]: string;
|
||||
private logger;
|
||||
constructor(client: GelClient, dialect: GelDialect, schema: RelationalSchemaConfig<TSchema> | undefined, options?: GelSessionOptions);
|
||||
prepareQuery<T extends PreparedQueryConfig = PreparedQueryConfig>(query: Query, fields: SelectedFieldsOrdered | undefined, name: string | undefined, isResponseInArrayMode: boolean, customResultMapper?: (rows: unknown[][]) => T['execute']): GelDbPreparedQuery<T>;
|
||||
transaction<T>(transaction: (tx: GelTransaction<GelQueryResultHKT, TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
||||
count(sql: SQL): Promise<number>;
|
||||
}
|
||||
export declare class GelDbTransaction<TFullSchema extends Record<string, unknown>, TSchema extends TablesRelationalConfig> extends GelTransaction<GelQueryResultHKT, TFullSchema, TSchema> {
|
||||
static readonly [entityKind]: string;
|
||||
transaction<T>(transaction: (tx: GelDbTransaction<TFullSchema, TSchema>) => Promise<T>): Promise<T>;
|
||||
}
|
||||
export interface GelQueryResultHKT {
|
||||
readonly $brand: 'GelQueryResultHKT';
|
||||
readonly row: unknown;
|
||||
readonly type: unknown;
|
||||
}
|
||||
113
node_modules/drizzle-orm/gel/session.js
generated
vendored
Normal file
113
node_modules/drizzle-orm/gel/session.js
generated
vendored
Normal file
@@ -0,0 +1,113 @@
|
||||
import { entityKind } from "../entity.js";
|
||||
import { GelPreparedQuery, GelSession, GelTransaction } from "../gel-core/session.js";
|
||||
import { NoopLogger } from "../logger.js";
|
||||
import { fillPlaceholders } from "../sql/sql.js";
|
||||
import { tracer } from "../tracing.js";
|
||||
import { mapResultRow } from "../utils.js";
|
||||
class GelDbPreparedQuery extends GelPreparedQuery {
|
||||
constructor(client, queryString, params, logger, fields, _isResponseInArrayMode, customResultMapper, transaction = false) {
|
||||
super({ sql: queryString, params });
|
||||
this.client = client;
|
||||
this.queryString = queryString;
|
||||
this.params = params;
|
||||
this.logger = logger;
|
||||
this.fields = fields;
|
||||
this._isResponseInArrayMode = _isResponseInArrayMode;
|
||||
this.customResultMapper = customResultMapper;
|
||||
this.transaction = transaction;
|
||||
}
|
||||
static [entityKind] = "GelPreparedQuery";
|
||||
async execute(placeholderValues = {}) {
|
||||
return tracer.startActiveSpan("drizzle.execute", async () => {
|
||||
const params = fillPlaceholders(this.params, placeholderValues);
|
||||
this.logger.logQuery(this.queryString, params);
|
||||
const { fields, queryString: query, client, joinsNotNullableMap, customResultMapper } = this;
|
||||
if (!fields && !customResultMapper) {
|
||||
return tracer.startActiveSpan("drizzle.driver.execute", async (span) => {
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": query,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
return client.querySQL(query, params.length ? params : void 0);
|
||||
});
|
||||
}
|
||||
const result = await tracer.startActiveSpan("drizzle.driver.execute", (span) => {
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": query,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
return client.withSQLRowMode("array").querySQL(query, params.length ? params : void 0);
|
||||
});
|
||||
return tracer.startActiveSpan("drizzle.mapResponse", () => {
|
||||
return customResultMapper ? customResultMapper(result) : result.map((row) => mapResultRow(fields, row, joinsNotNullableMap));
|
||||
});
|
||||
});
|
||||
}
|
||||
all(placeholderValues = {}) {
|
||||
return tracer.startActiveSpan("drizzle.execute", () => {
|
||||
const params = fillPlaceholders(this.params, placeholderValues);
|
||||
this.logger.logQuery(this.queryString, params);
|
||||
return tracer.startActiveSpan("drizzle.driver.execute", (span) => {
|
||||
span?.setAttributes({
|
||||
"drizzle.query.text": this.queryString,
|
||||
"drizzle.query.params": JSON.stringify(params)
|
||||
});
|
||||
return this.client.withSQLRowMode("array").querySQL(this.queryString, params.length ? params : void 0).then((result) => result);
|
||||
});
|
||||
});
|
||||
}
|
||||
/** @internal */
|
||||
isResponseInArrayMode() {
|
||||
return this._isResponseInArrayMode;
|
||||
}
|
||||
}
|
||||
class GelDbSession extends GelSession {
|
||||
constructor(client, dialect, schema, options = {}) {
|
||||
super(dialect);
|
||||
this.client = client;
|
||||
this.schema = schema;
|
||||
this.options = options;
|
||||
this.logger = options.logger ?? new NoopLogger();
|
||||
}
|
||||
static [entityKind] = "GelDbSession";
|
||||
logger;
|
||||
prepareQuery(query, fields, name, isResponseInArrayMode, customResultMapper) {
|
||||
return new GelDbPreparedQuery(
|
||||
this.client,
|
||||
query.sql,
|
||||
query.params,
|
||||
this.logger,
|
||||
fields,
|
||||
isResponseInArrayMode,
|
||||
customResultMapper
|
||||
);
|
||||
}
|
||||
async transaction(transaction) {
|
||||
return await this.client.transaction(async (clientTx) => {
|
||||
const session = new GelDbSession(clientTx, this.dialect, this.schema, this.options);
|
||||
const tx = new GelDbTransaction(this.dialect, session, this.schema);
|
||||
return await transaction(tx);
|
||||
});
|
||||
}
|
||||
async count(sql) {
|
||||
const res = await this.execute(sql);
|
||||
return Number(res[0]["count"]);
|
||||
}
|
||||
}
|
||||
class GelDbTransaction extends GelTransaction {
|
||||
static [entityKind] = "GelDbTransaction";
|
||||
async transaction(transaction) {
|
||||
const tx = new GelDbTransaction(
|
||||
this.dialect,
|
||||
this.session,
|
||||
this.schema
|
||||
);
|
||||
return await transaction(tx);
|
||||
}
|
||||
}
|
||||
export {
|
||||
GelDbPreparedQuery,
|
||||
GelDbSession,
|
||||
GelDbTransaction
|
||||
};
|
||||
//# sourceMappingURL=session.js.map
|
||||
1
node_modules/drizzle-orm/gel/session.js.map
generated
vendored
Normal file
1
node_modules/drizzle-orm/gel/session.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user