drizzle-orm 0.39.0 → 0.39.2-1177ad8
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/alias.cjs.map +1 -1
- package/alias.d.cts +1 -1
- package/alias.d.ts +1 -1
- package/alias.js.map +1 -1
- package/aws-data-api/pg/driver.cjs +5 -1
- package/aws-data-api/pg/driver.cjs.map +1 -1
- package/aws-data-api/pg/driver.d.cts +1 -0
- package/aws-data-api/pg/driver.d.ts +1 -0
- package/aws-data-api/pg/driver.js +5 -1
- package/aws-data-api/pg/driver.js.map +1 -1
- package/aws-data-api/pg/session.cjs +15 -4
- package/aws-data-api/pg/session.cjs.map +1 -1
- package/aws-data-api/pg/session.d.cts +13 -3
- package/aws-data-api/pg/session.d.ts +13 -3
- package/aws-data-api/pg/session.js +15 -4
- package/aws-data-api/pg/session.js.map +1 -1
- package/bun-sql/driver.cjs +5 -1
- package/bun-sql/driver.cjs.map +1 -1
- package/bun-sql/driver.js +5 -1
- package/bun-sql/driver.js.map +1 -1
- package/bun-sql/session.cjs +21 -9
- package/bun-sql/session.cjs.map +1 -1
- package/bun-sql/session.d.cts +12 -3
- package/bun-sql/session.d.ts +12 -3
- package/bun-sql/session.js +21 -9
- package/bun-sql/session.js.map +1 -1
- package/cache/core/cache.cjs +47 -0
- package/cache/core/cache.cjs.map +1 -0
- package/cache/core/cache.d.cts +35 -0
- package/cache/core/cache.d.ts +35 -0
- package/cache/core/cache.js +22 -0
- package/cache/core/cache.js.map +1 -0
- package/cache/core/index.cjs +23 -0
- package/cache/core/index.cjs.map +1 -0
- package/cache/core/index.d.cts +1 -0
- package/cache/core/index.d.ts +1 -0
- package/cache/core/index.js +2 -0
- package/cache/core/index.js.map +1 -0
- package/cache/core/types.cjs +17 -0
- package/cache/core/types.cjs.map +1 -0
- package/cache/core/types.d.cts +22 -0
- package/cache/core/types.d.ts +22 -0
- package/cache/core/types.js +1 -0
- package/cache/core/types.js.map +1 -0
- package/cache/upstash/cache.cjs +98 -0
- package/cache/upstash/cache.cjs.map +1 -0
- package/cache/upstash/cache.d.cts +23 -0
- package/cache/upstash/cache.d.ts +23 -0
- package/cache/upstash/cache.js +73 -0
- package/cache/upstash/cache.js.map +1 -0
- package/cache/upstash/index.cjs +23 -0
- package/cache/upstash/index.cjs.map +1 -0
- package/cache/upstash/index.d.cts +1 -0
- package/cache/upstash/index.d.ts +1 -0
- package/cache/upstash/index.js +2 -0
- package/cache/upstash/index.js.map +1 -0
- package/mysql-core/query-builders/select.types.cjs.map +1 -1
- package/mysql-core/query-builders/select.types.d.cts +1 -1
- package/mysql-core/query-builders/select.types.d.ts +1 -1
- package/neon/neon-identity.cjs +2 -2
- package/neon/neon-identity.cjs.map +1 -1
- package/neon/neon-identity.d.cts +3 -3
- package/neon/neon-identity.d.ts +3 -3
- package/neon/neon-identity.js +2 -2
- package/neon/neon-identity.js.map +1 -1
- package/neon-http/driver.cjs +9 -2
- package/neon-http/driver.cjs.map +1 -1
- package/neon-http/driver.d.cts +2 -0
- package/neon-http/driver.d.ts +2 -0
- package/neon-http/driver.js +9 -2
- package/neon-http/driver.js.map +1 -1
- package/neon-http/session.cjs +25 -15
- package/neon-http/session.cjs.map +1 -1
- package/neon-http/session.d.cts +12 -3
- package/neon-http/session.d.ts +12 -3
- package/neon-http/session.js +25 -15
- package/neon-http/session.js.map +1 -1
- package/neon-serverless/driver.cjs +9 -2
- package/neon-serverless/driver.cjs.map +1 -1
- package/neon-serverless/driver.d.cts +2 -0
- package/neon-serverless/driver.d.ts +2 -0
- package/neon-serverless/driver.js +9 -2
- package/neon-serverless/driver.js.map +1 -1
- package/neon-serverless/session.cjs +21 -7
- package/neon-serverless/session.cjs.map +1 -1
- package/neon-serverless/session.d.cts +12 -3
- package/neon-serverless/session.d.ts +12 -3
- package/neon-serverless/session.js +21 -7
- package/neon-serverless/session.js.map +1 -1
- package/node-postgres/driver.cjs +9 -2
- package/node-postgres/driver.cjs.map +1 -1
- package/node-postgres/driver.d.cts +2 -0
- package/node-postgres/driver.d.ts +2 -0
- package/node-postgres/driver.js +9 -2
- package/node-postgres/driver.js.map +1 -1
- package/node-postgres/session.cjs +19 -6
- package/node-postgres/session.cjs.map +1 -1
- package/node-postgres/session.d.cts +13 -3
- package/node-postgres/session.d.ts +13 -3
- package/node-postgres/session.js +19 -6
- package/node-postgres/session.js.map +1 -1
- package/package.json +64 -3
- package/pg-core/db.cjs +1 -0
- package/pg-core/db.cjs.map +1 -1
- package/pg-core/db.d.cts +4 -0
- package/pg-core/db.d.ts +4 -0
- package/pg-core/db.js +1 -0
- package/pg-core/db.js.map +1 -1
- package/pg-core/query-builders/delete.cjs +6 -1
- package/pg-core/query-builders/delete.cjs.map +1 -1
- package/pg-core/query-builders/delete.d.cts +2 -1
- package/pg-core/query-builders/delete.d.ts +2 -1
- package/pg-core/query-builders/delete.js +6 -1
- package/pg-core/query-builders/delete.js.map +1 -1
- package/pg-core/query-builders/insert.cjs +6 -1
- package/pg-core/query-builders/insert.cjs.map +1 -1
- package/pg-core/query-builders/insert.d.cts +2 -1
- package/pg-core/query-builders/insert.d.ts +2 -1
- package/pg-core/query-builders/insert.js +6 -1
- package/pg-core/query-builders/insert.js.map +1 -1
- package/pg-core/query-builders/select.cjs +31 -5
- package/pg-core/query-builders/select.cjs.map +1 -1
- package/pg-core/query-builders/select.d.cts +11 -2
- package/pg-core/query-builders/select.d.ts +11 -2
- package/pg-core/query-builders/select.js +31 -5
- package/pg-core/query-builders/select.js.map +1 -1
- package/pg-core/query-builders/select.types.cjs.map +1 -1
- package/pg-core/query-builders/select.types.d.cts +8 -1
- package/pg-core/query-builders/select.types.d.ts +8 -1
- package/pg-core/query-builders/update.cjs +6 -1
- package/pg-core/query-builders/update.cjs.map +1 -1
- package/pg-core/query-builders/update.d.cts +4 -3
- package/pg-core/query-builders/update.d.ts +4 -3
- package/pg-core/query-builders/update.js +6 -1
- package/pg-core/query-builders/update.js.map +1 -1
- package/pg-core/session.cjs +53 -1
- package/pg-core/session.cjs.map +1 -1
- package/pg-core/session.d.cts +14 -3
- package/pg-core/session.d.ts +14 -3
- package/pg-core/session.js +54 -2
- package/pg-core/session.js.map +1 -1
- package/pg-core/utils.cjs +16 -0
- package/pg-core/utils.cjs.map +1 -1
- package/pg-core/utils.d.cts +8 -4
- package/pg-core/utils.d.ts +8 -4
- package/pg-core/utils.js +16 -1
- package/pg-core/utils.js.map +1 -1
- package/pg-proxy/driver.cjs +7 -2
- package/pg-proxy/driver.cjs.map +1 -1
- package/pg-proxy/driver.js +7 -2
- package/pg-proxy/driver.js.map +1 -1
- package/pg-proxy/session.cjs +15 -5
- package/pg-proxy/session.cjs.map +1 -1
- package/pg-proxy/session.d.cts +12 -3
- package/pg-proxy/session.d.ts +12 -3
- package/pg-proxy/session.js +15 -5
- package/pg-proxy/session.js.map +1 -1
- package/pglite/driver.cjs +9 -2
- package/pglite/driver.cjs.map +1 -1
- package/pglite/driver.d.cts +2 -0
- package/pglite/driver.d.ts +2 -0
- package/pglite/driver.js +9 -2
- package/pglite/driver.js.map +1 -1
- package/pglite/session.cjs +19 -7
- package/pglite/session.cjs.map +1 -1
- package/pglite/session.d.cts +12 -3
- package/pglite/session.d.ts +12 -3
- package/pglite/session.js +19 -7
- package/pglite/session.js.map +1 -1
- package/postgres-js/driver.cjs +5 -1
- package/postgres-js/driver.cjs.map +1 -1
- package/postgres-js/driver.js +5 -1
- package/postgres-js/driver.js.map +1 -1
- package/postgres-js/session.cjs +18 -6
- package/postgres-js/session.cjs.map +1 -1
- package/postgres-js/session.d.cts +12 -3
- package/postgres-js/session.d.ts +12 -3
- package/postgres-js/session.js +18 -6
- package/postgres-js/session.js.map +1 -1
- package/prisma/pg/session.cjs +1 -1
- package/prisma/pg/session.cjs.map +1 -1
- package/prisma/pg/session.js +1 -1
- package/prisma/pg/session.js.map +1 -1
- package/query-builders/query-builder.cjs.map +1 -1
- package/query-builders/query-builder.d.cts +2 -1
- package/query-builders/query-builder.d.ts +2 -1
- package/query-builders/query-builder.js.map +1 -1
- package/sql/sql.cjs +9 -2
- package/sql/sql.cjs.map +1 -1
- package/sql/sql.js +9 -2
- package/sql/sql.js.map +1 -1
- package/sqlite-core/db.cjs.map +1 -1
- package/sqlite-core/db.js.map +1 -1
- package/sqlite-core/dialect.cjs +1 -1
- package/sqlite-core/dialect.cjs.map +1 -1
- package/sqlite-core/dialect.js +1 -1
- package/sqlite-core/dialect.js.map +1 -1
- package/sqlite-core/query-builders/insert.cjs +9 -3
- package/sqlite-core/query-builders/insert.cjs.map +1 -1
- package/sqlite-core/query-builders/insert.d.cts +1 -1
- package/sqlite-core/query-builders/insert.d.ts +1 -1
- package/sqlite-core/query-builders/insert.js +9 -3
- package/sqlite-core/query-builders/insert.js.map +1 -1
- package/subquery.cjs +4 -3
- package/subquery.cjs.map +1 -1
- package/subquery.d.cts +2 -1
- package/subquery.d.ts +2 -1
- package/subquery.js +4 -3
- package/subquery.js.map +1 -1
- package/utils.cjs.map +1 -1
- package/utils.d.cts +2 -0
- package/utils.d.ts +2 -0
- package/utils.js.map +1 -1
- package/vercel-postgres/driver.cjs +9 -2
- package/vercel-postgres/driver.cjs.map +1 -1
- package/vercel-postgres/driver.d.cts +2 -0
- package/vercel-postgres/driver.d.ts +2 -0
- package/vercel-postgres/driver.js +9 -2
- package/vercel-postgres/driver.js.map +1 -1
- package/vercel-postgres/session.cjs +21 -7
- package/vercel-postgres/session.cjs.map +1 -1
- package/vercel-postgres/session.d.cts +12 -3
- package/vercel-postgres/session.d.ts +12 -3
- package/vercel-postgres/session.js +21 -7
- package/vercel-postgres/session.js.map +1 -1
- package/version.cjs +1 -1
- package/version.d.cts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/xata-http/driver.cjs +7 -2
- package/xata-http/driver.cjs.map +1 -1
- package/xata-http/driver.d.cts +2 -0
- package/xata-http/driver.d.ts +2 -0
- package/xata-http/driver.js +7 -2
- package/xata-http/driver.js.map +1 -1
- package/xata-http/session.cjs +21 -7
- package/xata-http/session.cjs.map +1 -1
- package/xata-http/session.d.cts +12 -3
- package/xata-http/session.d.ts +12 -3
- package/xata-http/session.js +21 -7
- package/xata-http/session.js.map +1 -1
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { entityKind } from "../../entity.js";
|
|
2
|
+
import type { Table } from "../../index.js";
|
|
3
|
+
import type { CacheConfig } from "./types.js";
|
|
4
|
+
export declare abstract class Cache {
|
|
5
|
+
static readonly [entityKind]: string;
|
|
6
|
+
abstract strategy(): 'explicit' | 'all';
|
|
7
|
+
/**
|
|
8
|
+
* Invoked if we should check cache for cached response
|
|
9
|
+
* @param sql
|
|
10
|
+
* @param tables
|
|
11
|
+
*/
|
|
12
|
+
abstract get(key: string): Promise<any[] | undefined>;
|
|
13
|
+
/**
|
|
14
|
+
* Invoked if new query should be inserted to cache
|
|
15
|
+
* @param sql
|
|
16
|
+
* @param tables
|
|
17
|
+
*/
|
|
18
|
+
abstract put(hashedQuery: string, response: any, tables: string[], config?: CacheConfig): Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Invoked if insert, update, delete was invoked
|
|
21
|
+
* @param tables
|
|
22
|
+
*/
|
|
23
|
+
abstract onMutate(params: MutationOption): Promise<void>;
|
|
24
|
+
}
|
|
25
|
+
export declare class NoopCache extends Cache {
|
|
26
|
+
strategy(): "all";
|
|
27
|
+
static readonly [entityKind]: string;
|
|
28
|
+
get(_key: string): Promise<any[] | undefined>;
|
|
29
|
+
put(_hashedQuery: string, _response: any, _tables: string[], _config?: any): Promise<void>;
|
|
30
|
+
onMutate(_params: MutationOption): Promise<void>;
|
|
31
|
+
}
|
|
32
|
+
export type MutationOption = {
|
|
33
|
+
tags?: string | string[];
|
|
34
|
+
tables?: Table<any> | Table<any>[] | string | string[];
|
|
35
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { entityKind } from "../../entity.js";
|
|
2
|
+
class Cache {
|
|
3
|
+
static [entityKind] = "Cache";
|
|
4
|
+
}
|
|
5
|
+
class NoopCache extends Cache {
|
|
6
|
+
strategy() {
|
|
7
|
+
return "all";
|
|
8
|
+
}
|
|
9
|
+
static [entityKind] = "NoopCache";
|
|
10
|
+
async get(_key) {
|
|
11
|
+
return void 0;
|
|
12
|
+
}
|
|
13
|
+
async put(_hashedQuery, _response, _tables, _config) {
|
|
14
|
+
}
|
|
15
|
+
async onMutate(_params) {
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
export {
|
|
19
|
+
Cache,
|
|
20
|
+
NoopCache
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cache/core/cache.ts"],"sourcesContent":["import { entityKind } from '~/entity.ts';\nimport type { Table } from '~/index.ts';\nimport type { CacheConfig } from './types.ts';\n\nexport abstract class Cache {\n\tstatic readonly [entityKind]: string = 'Cache';\n\n\tabstract strategy(): 'explicit' | 'all';\n\n\t/**\n\t * Invoked if we should check cache for cached response\n\t * @param sql\n\t * @param tables\n\t */\n\tabstract get(\n\t\tkey: string,\n\t): Promise<any[] | undefined>;\n\n\t/**\n\t * Invoked if new query should be inserted to cache\n\t * @param sql\n\t * @param tables\n\t */\n\tabstract put(\n\t\thashedQuery: string,\n\t\tresponse: any,\n\t\ttables: string[],\n\t\tconfig?: CacheConfig,\n\t): Promise<void>;\n\n\t/**\n\t * Invoked if insert, update, delete was invoked\n\t * @param tables\n\t */\n\tabstract onMutate(\n\t\tparams: MutationOption,\n\t): Promise<void>;\n}\n\nexport class NoopCache extends Cache {\n\toverride strategy() {\n\t\treturn 'all' as const;\n\t}\n\n\tstatic override readonly [entityKind]: string = 'NoopCache';\n\n\toverride async get(_key: string): Promise<any[] | undefined> {\n\t\treturn undefined;\n\t}\n\toverride async put(\n\t\t_hashedQuery: string,\n\t\t_response: any,\n\t\t_tables: string[],\n\t\t_config?: any,\n\t): Promise<void> {\n\t\t// noop\n\t}\n\toverride async onMutate(_params: MutationOption): Promise<void> {\n\t\t// noop\n\t}\n}\n\nexport type MutationOption = { tags?: string | string[]; tables?: Table<any> | Table<any>[] | string | string[] };\n"],"mappings":"AAAA,SAAS,kBAAkB;AAIpB,MAAe,MAAM;AAAA,EAC3B,QAAiB,UAAU,IAAY;AAgCxC;AAEO,MAAM,kBAAkB,MAAM;AAAA,EAC3B,WAAW;AACnB,WAAO;AAAA,EACR;AAAA,EAEA,QAA0B,UAAU,IAAY;AAAA,EAEhD,MAAe,IAAI,MAA0C;AAC5D,WAAO;AAAA,EACR;AAAA,EACA,MAAe,IACd,cACA,WACA,SACA,SACgB;AAAA,EAEjB;AAAA,EACA,MAAe,SAAS,SAAwC;AAAA,EAEhE;AACD;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var core_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(core_exports);
|
|
18
|
+
__reExport(core_exports, require("./cache.cjs"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./cache.cjs")
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cache/core/index.ts"],"sourcesContent":["export * from './cache.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAc,uBAAd;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./cache.cjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./cache.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cache/core/index.ts"],"sourcesContent":["export * from './cache.ts';\n"],"mappings":"AAAA,cAAc;","names":[]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
15
|
+
var types_exports = {};
|
|
16
|
+
module.exports = __toCommonJS(types_exports);
|
|
17
|
+
//# sourceMappingURL=types.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cache/core/types.ts"],"sourcesContent":["export type CacheConfig = {\n\t/**\n\t * expire time, in seconds (a positive integer)\n\t */\n\tex?: number;\n\t/**\n\t * expire time, in milliseconds (a positive integer).\n\t */\n\tpx?: number;\n\t/**\n\t * Unix time at which the key will expire, in seconds (a positive integer).\n\t */\n\texat?: number;\n\t/**\n\t * Unix time at which the key will expire, in milliseconds (a positive integer)\n\t */\n\tpxat?: number;\n\t/**\n\t * Retain the time to live associated with the key.\n\t */\n\tkeepTtl?: boolean;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type CacheConfig = {
|
|
2
|
+
/**
|
|
3
|
+
* expire time, in seconds (a positive integer)
|
|
4
|
+
*/
|
|
5
|
+
ex?: number;
|
|
6
|
+
/**
|
|
7
|
+
* expire time, in milliseconds (a positive integer).
|
|
8
|
+
*/
|
|
9
|
+
px?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Unix time at which the key will expire, in seconds (a positive integer).
|
|
12
|
+
*/
|
|
13
|
+
exat?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Unix time at which the key will expire, in milliseconds (a positive integer)
|
|
16
|
+
*/
|
|
17
|
+
pxat?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Retain the time to live associated with the key.
|
|
20
|
+
*/
|
|
21
|
+
keepTtl?: boolean;
|
|
22
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type CacheConfig = {
|
|
2
|
+
/**
|
|
3
|
+
* expire time, in seconds (a positive integer)
|
|
4
|
+
*/
|
|
5
|
+
ex?: number;
|
|
6
|
+
/**
|
|
7
|
+
* expire time, in milliseconds (a positive integer).
|
|
8
|
+
*/
|
|
9
|
+
px?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Unix time at which the key will expire, in seconds (a positive integer).
|
|
12
|
+
*/
|
|
13
|
+
exat?: number;
|
|
14
|
+
/**
|
|
15
|
+
* Unix time at which the key will expire, in milliseconds (a positive integer)
|
|
16
|
+
*/
|
|
17
|
+
pxat?: number;
|
|
18
|
+
/**
|
|
19
|
+
* Retain the time to live associated with the key.
|
|
20
|
+
*/
|
|
21
|
+
keepTtl?: boolean;
|
|
22
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var cache_exports = {};
|
|
20
|
+
__export(cache_exports, {
|
|
21
|
+
UpstashCache: () => UpstashCache,
|
|
22
|
+
upstashCache: () => upstashCache
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(cache_exports);
|
|
25
|
+
var import_redis = require("@upstash/redis");
|
|
26
|
+
var import_core = require("../core/index.cjs");
|
|
27
|
+
var import_entity = require("../../entity.cjs");
|
|
28
|
+
var import__ = require("../../index.cjs");
|
|
29
|
+
class UpstashCache extends import_core.Cache {
|
|
30
|
+
constructor(redis, config, useGlobally) {
|
|
31
|
+
super();
|
|
32
|
+
this.redis = redis;
|
|
33
|
+
this.useGlobally = useGlobally;
|
|
34
|
+
this.internalConfig = this.toInternalConfig(config);
|
|
35
|
+
}
|
|
36
|
+
static [import_entity.entityKind] = "UpstashCache";
|
|
37
|
+
internalConfig;
|
|
38
|
+
strategy() {
|
|
39
|
+
return this.useGlobally ? "all" : "explicit";
|
|
40
|
+
}
|
|
41
|
+
toInternalConfig(config) {
|
|
42
|
+
return config ? {
|
|
43
|
+
ex: config.ex,
|
|
44
|
+
exat: config.exat,
|
|
45
|
+
px: config.px,
|
|
46
|
+
pxat: config.pxat,
|
|
47
|
+
keepTtl: config.keepTtl
|
|
48
|
+
} : void 0;
|
|
49
|
+
}
|
|
50
|
+
async get(key) {
|
|
51
|
+
const res = (await this.redis.get(key)) ?? void 0;
|
|
52
|
+
return res;
|
|
53
|
+
}
|
|
54
|
+
async put(key, response, tables, config) {
|
|
55
|
+
await this.redis.set(key, response, config ? this.toInternalConfig(config) : this.internalConfig);
|
|
56
|
+
for (const table of tables) {
|
|
57
|
+
await this.redis.sadd(table, key);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
async onMutate(params) {
|
|
61
|
+
const tagsArray = params.tags ? Array.isArray(params.tags) ? params.tags : [params.tags] : [];
|
|
62
|
+
const tablesArray = params.tables ? Array.isArray(params.tables) ? params.tables : [params.tables] : [];
|
|
63
|
+
const keysToDelete = /* @__PURE__ */ new Set();
|
|
64
|
+
for (const table of tablesArray) {
|
|
65
|
+
const tableName = (0, import_entity.is)(table, import__.Table) ? table[import__.OriginalName] : table;
|
|
66
|
+
const keys = await this.redis.smembers(tableName);
|
|
67
|
+
for (const key of keys)
|
|
68
|
+
keysToDelete.add(key);
|
|
69
|
+
}
|
|
70
|
+
if (keysToDelete.size > 0 || tagsArray.length > 0) {
|
|
71
|
+
const pipeline = this.redis.pipeline();
|
|
72
|
+
for (const tag of tagsArray) {
|
|
73
|
+
pipeline.del(tag);
|
|
74
|
+
}
|
|
75
|
+
for (const key of keysToDelete) {
|
|
76
|
+
pipeline.del(key);
|
|
77
|
+
for (const table of tablesArray) {
|
|
78
|
+
const tableName = (0, import_entity.is)(table, import__.Table) ? table[import__.OriginalName] : table;
|
|
79
|
+
pipeline.srem(tableName, key);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
await pipeline.exec();
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function upstashCache({ url, token, config, global = false }) {
|
|
87
|
+
const redis = new import_redis.Redis({
|
|
88
|
+
url,
|
|
89
|
+
token
|
|
90
|
+
});
|
|
91
|
+
return new UpstashCache(redis, config, global);
|
|
92
|
+
}
|
|
93
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
+
0 && (module.exports = {
|
|
95
|
+
UpstashCache,
|
|
96
|
+
upstashCache
|
|
97
|
+
});
|
|
98
|
+
//# sourceMappingURL=cache.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cache/upstash/cache.ts"],"sourcesContent":["import type { SetCommandOptions } from '@upstash/redis';\nimport { Redis } from '@upstash/redis';\nimport type { MutationOption } from '~/cache/core/index.ts';\nimport { Cache } from '~/cache/core/index.ts';\nimport { entityKind, is } from '~/entity.ts';\nimport { OriginalName, Table } from '~/index.ts';\nimport type { CacheConfig } from '../core/types.ts';\n\nexport class UpstashCache extends Cache {\n\tstatic override readonly [entityKind]: string = 'UpstashCache';\n\n\tprivate internalConfig?: SetCommandOptions;\n\n\tconstructor(public redis: Redis, config?: CacheConfig, protected useGlobally?: boolean) {\n\t\tsuper();\n\t\tthis.internalConfig = this.toInternalConfig(config);\n\t}\n\n\tpublic strategy() {\n\t\treturn this.useGlobally ? 'all' : 'explicit';\n\t}\n\n\tprivate toInternalConfig(config?: CacheConfig) {\n\t\treturn config\n\t\t\t? {\n\t\t\t\tex: config.ex,\n\t\t\t\texat: config.exat,\n\t\t\t\tpx: config.px,\n\t\t\t\tpxat: config.pxat,\n\t\t\t\tkeepTtl: config.keepTtl,\n\t\t\t} as SetCommandOptions\n\t\t\t: undefined;\n\t}\n\n\toverride async get(key: string) {\n\t\tconst res = await this.redis.get<any[]>(key) ?? undefined;\n\t\treturn res;\n\t}\n\n\toverride async put(key: string, response: any, tables: string[], config?: CacheConfig) {\n\t\tawait this.redis.set(key, response, config ? this.toInternalConfig(config) : this.internalConfig);\n\t\tfor (const table of tables) {\n\t\t\tawait this.redis.sadd(table, key);\n\t\t}\n\t}\n\n\toverride async onMutate(params: MutationOption) {\n\t\tconst tagsArray = params.tags ? Array.isArray(params.tags) ? params.tags : [params.tags] : [];\n\t\tconst tablesArray = params.tables ? Array.isArray(params.tables) ? params.tables : [params.tables] : [];\n\n\t\tconst keysToDelete = new Set<string>();\n\n\t\tfor (const table of tablesArray) {\n\t\t\tconst tableName = is(table, Table) ? table[OriginalName] : table as string;\n\t\t\tconst keys = await this.redis.smembers(tableName);\n\t\t\tfor (const key of keys) keysToDelete.add(key); // Add to the set\n\t\t}\n\n\t\tif (keysToDelete.size > 0 || tagsArray.length > 0) {\n\t\t\tconst pipeline = this.redis.pipeline();\n\n\t\t\tfor (const tag of tagsArray) {\n\t\t\t\tpipeline.del(tag);\n\t\t\t}\n\n\t\t\tfor (const key of keysToDelete) {\n\t\t\t\tpipeline.del(key);\n\t\t\t\tfor (const table of tablesArray) {\n\t\t\t\t\tconst tableName = is(table, Table) ? table[OriginalName] : table as string;\n\t\t\t\t\tpipeline.srem(tableName, key);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait pipeline.exec();\n\t\t}\n\t}\n}\n\nexport function upstashCache(\n\t{ url, token, config, global = false }: { url: string; token: string; config?: CacheConfig; global?: boolean },\n): UpstashCache {\n\tconst redis = new Redis({\n\t\turl,\n\t\ttoken,\n\t});\n\n\treturn new UpstashCache(redis, config, global);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mBAAsB;AAEtB,kBAAsB;AACtB,oBAA+B;AAC/B,eAAoC;AAG7B,MAAM,qBAAqB,kBAAM;AAAA,EAKvC,YAAmB,OAAc,QAAgC,aAAuB;AACvF,UAAM;AADY;AAA8C;AAEhE,SAAK,iBAAiB,KAAK,iBAAiB,MAAM;AAAA,EACnD;AAAA,EAPA,QAA0B,wBAAU,IAAY;AAAA,EAExC;AAAA,EAOD,WAAW;AACjB,WAAO,KAAK,cAAc,QAAQ;AAAA,EACnC;AAAA,EAEQ,iBAAiB,QAAsB;AAC9C,WAAO,SACJ;AAAA,MACD,IAAI,OAAO;AAAA,MACX,MAAM,OAAO;AAAA,MACb,IAAI,OAAO;AAAA,MACX,MAAM,OAAO;AAAA,MACb,SAAS,OAAO;AAAA,IACjB,IACE;AAAA,EACJ;AAAA,EAEA,MAAe,IAAI,KAAa;AAC/B,UAAM,MAAM,MAAM,KAAK,MAAM,IAAW,GAAG,KAAK;AAChD,WAAO;AAAA,EACR;AAAA,EAEA,MAAe,IAAI,KAAa,UAAe,QAAkB,QAAsB;AACtF,UAAM,KAAK,MAAM,IAAI,KAAK,UAAU,SAAS,KAAK,iBAAiB,MAAM,IAAI,KAAK,cAAc;AAChG,eAAW,SAAS,QAAQ;AAC3B,YAAM,KAAK,MAAM,KAAK,OAAO,GAAG;AAAA,IACjC;AAAA,EACD;AAAA,EAEA,MAAe,SAAS,QAAwB;AAC/C,UAAM,YAAY,OAAO,OAAO,MAAM,QAAQ,OAAO,IAAI,IAAI,OAAO,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC;AAC5F,UAAM,cAAc,OAAO,SAAS,MAAM,QAAQ,OAAO,MAAM,IAAI,OAAO,SAAS,CAAC,OAAO,MAAM,IAAI,CAAC;AAEtG,UAAM,eAAe,oBAAI,IAAY;AAErC,eAAW,SAAS,aAAa;AAChC,YAAM,gBAAY,kBAAG,OAAO,cAAK,IAAI,MAAM,qBAAY,IAAI;AAC3D,YAAM,OAAO,MAAM,KAAK,MAAM,SAAS,SAAS;AAChD,iBAAW,OAAO;AAAM,qBAAa,IAAI,GAAG;AAAA,IAC7C;AAEA,QAAI,aAAa,OAAO,KAAK,UAAU,SAAS,GAAG;AAClD,YAAM,WAAW,KAAK,MAAM,SAAS;AAErC,iBAAW,OAAO,WAAW;AAC5B,iBAAS,IAAI,GAAG;AAAA,MACjB;AAEA,iBAAW,OAAO,cAAc;AAC/B,iBAAS,IAAI,GAAG;AAChB,mBAAW,SAAS,aAAa;AAChC,gBAAM,gBAAY,kBAAG,OAAO,cAAK,IAAI,MAAM,qBAAY,IAAI;AAC3D,mBAAS,KAAK,WAAW,GAAG;AAAA,QAC7B;AAAA,MACD;AAEA,YAAM,SAAS,KAAK;AAAA,IACrB;AAAA,EACD;AACD;AAEO,SAAS,aACf,EAAE,KAAK,OAAO,QAAQ,SAAS,MAAM,GACtB;AACf,QAAM,QAAQ,IAAI,mBAAM;AAAA,IACvB;AAAA,IACA;AAAA,EACD,CAAC;AAED,SAAO,IAAI,aAAa,OAAO,QAAQ,MAAM;AAC9C;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Redis } from '@upstash/redis';
|
|
2
|
+
import type { MutationOption } from "../core/index.cjs";
|
|
3
|
+
import { Cache } from "../core/index.cjs";
|
|
4
|
+
import { entityKind } from "../../entity.cjs";
|
|
5
|
+
import type { CacheConfig } from "../core/types.cjs";
|
|
6
|
+
export declare class UpstashCache extends Cache {
|
|
7
|
+
redis: Redis;
|
|
8
|
+
protected useGlobally?: boolean | undefined;
|
|
9
|
+
static readonly [entityKind]: string;
|
|
10
|
+
private internalConfig?;
|
|
11
|
+
constructor(redis: Redis, config?: CacheConfig, useGlobally?: boolean | undefined);
|
|
12
|
+
strategy(): "all" | "explicit";
|
|
13
|
+
private toInternalConfig;
|
|
14
|
+
get(key: string): Promise<any[] | undefined>;
|
|
15
|
+
put(key: string, response: any, tables: string[], config?: CacheConfig): Promise<void>;
|
|
16
|
+
onMutate(params: MutationOption): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function upstashCache({ url, token, config, global }: {
|
|
19
|
+
url: string;
|
|
20
|
+
token: string;
|
|
21
|
+
config?: CacheConfig;
|
|
22
|
+
global?: boolean;
|
|
23
|
+
}): UpstashCache;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Redis } from '@upstash/redis';
|
|
2
|
+
import type { MutationOption } from "../core/index.js";
|
|
3
|
+
import { Cache } from "../core/index.js";
|
|
4
|
+
import { entityKind } from "../../entity.js";
|
|
5
|
+
import type { CacheConfig } from "../core/types.js";
|
|
6
|
+
export declare class UpstashCache extends Cache {
|
|
7
|
+
redis: Redis;
|
|
8
|
+
protected useGlobally?: boolean | undefined;
|
|
9
|
+
static readonly [entityKind]: string;
|
|
10
|
+
private internalConfig?;
|
|
11
|
+
constructor(redis: Redis, config?: CacheConfig, useGlobally?: boolean | undefined);
|
|
12
|
+
strategy(): "all" | "explicit";
|
|
13
|
+
private toInternalConfig;
|
|
14
|
+
get(key: string): Promise<any[] | undefined>;
|
|
15
|
+
put(key: string, response: any, tables: string[], config?: CacheConfig): Promise<void>;
|
|
16
|
+
onMutate(params: MutationOption): Promise<void>;
|
|
17
|
+
}
|
|
18
|
+
export declare function upstashCache({ url, token, config, global }: {
|
|
19
|
+
url: string;
|
|
20
|
+
token: string;
|
|
21
|
+
config?: CacheConfig;
|
|
22
|
+
global?: boolean;
|
|
23
|
+
}): UpstashCache;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Redis } from "@upstash/redis";
|
|
2
|
+
import { Cache } from "../core/index.js";
|
|
3
|
+
import { entityKind, is } from "../../entity.js";
|
|
4
|
+
import { OriginalName, Table } from "../../index.js";
|
|
5
|
+
class UpstashCache extends Cache {
|
|
6
|
+
constructor(redis, config, useGlobally) {
|
|
7
|
+
super();
|
|
8
|
+
this.redis = redis;
|
|
9
|
+
this.useGlobally = useGlobally;
|
|
10
|
+
this.internalConfig = this.toInternalConfig(config);
|
|
11
|
+
}
|
|
12
|
+
static [entityKind] = "UpstashCache";
|
|
13
|
+
internalConfig;
|
|
14
|
+
strategy() {
|
|
15
|
+
return this.useGlobally ? "all" : "explicit";
|
|
16
|
+
}
|
|
17
|
+
toInternalConfig(config) {
|
|
18
|
+
return config ? {
|
|
19
|
+
ex: config.ex,
|
|
20
|
+
exat: config.exat,
|
|
21
|
+
px: config.px,
|
|
22
|
+
pxat: config.pxat,
|
|
23
|
+
keepTtl: config.keepTtl
|
|
24
|
+
} : void 0;
|
|
25
|
+
}
|
|
26
|
+
async get(key) {
|
|
27
|
+
const res = (await this.redis.get(key)) ?? void 0;
|
|
28
|
+
return res;
|
|
29
|
+
}
|
|
30
|
+
async put(key, response, tables, config) {
|
|
31
|
+
await this.redis.set(key, response, config ? this.toInternalConfig(config) : this.internalConfig);
|
|
32
|
+
for (const table of tables) {
|
|
33
|
+
await this.redis.sadd(table, key);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
async onMutate(params) {
|
|
37
|
+
const tagsArray = params.tags ? Array.isArray(params.tags) ? params.tags : [params.tags] : [];
|
|
38
|
+
const tablesArray = params.tables ? Array.isArray(params.tables) ? params.tables : [params.tables] : [];
|
|
39
|
+
const keysToDelete = /* @__PURE__ */ new Set();
|
|
40
|
+
for (const table of tablesArray) {
|
|
41
|
+
const tableName = is(table, Table) ? table[OriginalName] : table;
|
|
42
|
+
const keys = await this.redis.smembers(tableName);
|
|
43
|
+
for (const key of keys)
|
|
44
|
+
keysToDelete.add(key);
|
|
45
|
+
}
|
|
46
|
+
if (keysToDelete.size > 0 || tagsArray.length > 0) {
|
|
47
|
+
const pipeline = this.redis.pipeline();
|
|
48
|
+
for (const tag of tagsArray) {
|
|
49
|
+
pipeline.del(tag);
|
|
50
|
+
}
|
|
51
|
+
for (const key of keysToDelete) {
|
|
52
|
+
pipeline.del(key);
|
|
53
|
+
for (const table of tablesArray) {
|
|
54
|
+
const tableName = is(table, Table) ? table[OriginalName] : table;
|
|
55
|
+
pipeline.srem(tableName, key);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
await pipeline.exec();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function upstashCache({ url, token, config, global = false }) {
|
|
63
|
+
const redis = new Redis({
|
|
64
|
+
url,
|
|
65
|
+
token
|
|
66
|
+
});
|
|
67
|
+
return new UpstashCache(redis, config, global);
|
|
68
|
+
}
|
|
69
|
+
export {
|
|
70
|
+
UpstashCache,
|
|
71
|
+
upstashCache
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=cache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cache/upstash/cache.ts"],"sourcesContent":["import type { SetCommandOptions } from '@upstash/redis';\nimport { Redis } from '@upstash/redis';\nimport type { MutationOption } from '~/cache/core/index.ts';\nimport { Cache } from '~/cache/core/index.ts';\nimport { entityKind, is } from '~/entity.ts';\nimport { OriginalName, Table } from '~/index.ts';\nimport type { CacheConfig } from '../core/types.ts';\n\nexport class UpstashCache extends Cache {\n\tstatic override readonly [entityKind]: string = 'UpstashCache';\n\n\tprivate internalConfig?: SetCommandOptions;\n\n\tconstructor(public redis: Redis, config?: CacheConfig, protected useGlobally?: boolean) {\n\t\tsuper();\n\t\tthis.internalConfig = this.toInternalConfig(config);\n\t}\n\n\tpublic strategy() {\n\t\treturn this.useGlobally ? 'all' : 'explicit';\n\t}\n\n\tprivate toInternalConfig(config?: CacheConfig) {\n\t\treturn config\n\t\t\t? {\n\t\t\t\tex: config.ex,\n\t\t\t\texat: config.exat,\n\t\t\t\tpx: config.px,\n\t\t\t\tpxat: config.pxat,\n\t\t\t\tkeepTtl: config.keepTtl,\n\t\t\t} as SetCommandOptions\n\t\t\t: undefined;\n\t}\n\n\toverride async get(key: string) {\n\t\tconst res = await this.redis.get<any[]>(key) ?? undefined;\n\t\treturn res;\n\t}\n\n\toverride async put(key: string, response: any, tables: string[], config?: CacheConfig) {\n\t\tawait this.redis.set(key, response, config ? this.toInternalConfig(config) : this.internalConfig);\n\t\tfor (const table of tables) {\n\t\t\tawait this.redis.sadd(table, key);\n\t\t}\n\t}\n\n\toverride async onMutate(params: MutationOption) {\n\t\tconst tagsArray = params.tags ? Array.isArray(params.tags) ? params.tags : [params.tags] : [];\n\t\tconst tablesArray = params.tables ? Array.isArray(params.tables) ? params.tables : [params.tables] : [];\n\n\t\tconst keysToDelete = new Set<string>();\n\n\t\tfor (const table of tablesArray) {\n\t\t\tconst tableName = is(table, Table) ? table[OriginalName] : table as string;\n\t\t\tconst keys = await this.redis.smembers(tableName);\n\t\t\tfor (const key of keys) keysToDelete.add(key); // Add to the set\n\t\t}\n\n\t\tif (keysToDelete.size > 0 || tagsArray.length > 0) {\n\t\t\tconst pipeline = this.redis.pipeline();\n\n\t\t\tfor (const tag of tagsArray) {\n\t\t\t\tpipeline.del(tag);\n\t\t\t}\n\n\t\t\tfor (const key of keysToDelete) {\n\t\t\t\tpipeline.del(key);\n\t\t\t\tfor (const table of tablesArray) {\n\t\t\t\t\tconst tableName = is(table, Table) ? table[OriginalName] : table as string;\n\t\t\t\t\tpipeline.srem(tableName, key);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tawait pipeline.exec();\n\t\t}\n\t}\n}\n\nexport function upstashCache(\n\t{ url, token, config, global = false }: { url: string; token: string; config?: CacheConfig; global?: boolean },\n): UpstashCache {\n\tconst redis = new Redis({\n\t\turl,\n\t\ttoken,\n\t});\n\n\treturn new UpstashCache(redis, config, global);\n}\n"],"mappings":"AACA,SAAS,aAAa;AAEtB,SAAS,aAAa;AACtB,SAAS,YAAY,UAAU;AAC/B,SAAS,cAAc,aAAa;AAG7B,MAAM,qBAAqB,MAAM;AAAA,EAKvC,YAAmB,OAAc,QAAgC,aAAuB;AACvF,UAAM;AADY;AAA8C;AAEhE,SAAK,iBAAiB,KAAK,iBAAiB,MAAM;AAAA,EACnD;AAAA,EAPA,QAA0B,UAAU,IAAY;AAAA,EAExC;AAAA,EAOD,WAAW;AACjB,WAAO,KAAK,cAAc,QAAQ;AAAA,EACnC;AAAA,EAEQ,iBAAiB,QAAsB;AAC9C,WAAO,SACJ;AAAA,MACD,IAAI,OAAO;AAAA,MACX,MAAM,OAAO;AAAA,MACb,IAAI,OAAO;AAAA,MACX,MAAM,OAAO;AAAA,MACb,SAAS,OAAO;AAAA,IACjB,IACE;AAAA,EACJ;AAAA,EAEA,MAAe,IAAI,KAAa;AAC/B,UAAM,MAAM,MAAM,KAAK,MAAM,IAAW,GAAG,KAAK;AAChD,WAAO;AAAA,EACR;AAAA,EAEA,MAAe,IAAI,KAAa,UAAe,QAAkB,QAAsB;AACtF,UAAM,KAAK,MAAM,IAAI,KAAK,UAAU,SAAS,KAAK,iBAAiB,MAAM,IAAI,KAAK,cAAc;AAChG,eAAW,SAAS,QAAQ;AAC3B,YAAM,KAAK,MAAM,KAAK,OAAO,GAAG;AAAA,IACjC;AAAA,EACD;AAAA,EAEA,MAAe,SAAS,QAAwB;AAC/C,UAAM,YAAY,OAAO,OAAO,MAAM,QAAQ,OAAO,IAAI,IAAI,OAAO,OAAO,CAAC,OAAO,IAAI,IAAI,CAAC;AAC5F,UAAM,cAAc,OAAO,SAAS,MAAM,QAAQ,OAAO,MAAM,IAAI,OAAO,SAAS,CAAC,OAAO,MAAM,IAAI,CAAC;AAEtG,UAAM,eAAe,oBAAI,IAAY;AAErC,eAAW,SAAS,aAAa;AAChC,YAAM,YAAY,GAAG,OAAO,KAAK,IAAI,MAAM,YAAY,IAAI;AAC3D,YAAM,OAAO,MAAM,KAAK,MAAM,SAAS,SAAS;AAChD,iBAAW,OAAO;AAAM,qBAAa,IAAI,GAAG;AAAA,IAC7C;AAEA,QAAI,aAAa,OAAO,KAAK,UAAU,SAAS,GAAG;AAClD,YAAM,WAAW,KAAK,MAAM,SAAS;AAErC,iBAAW,OAAO,WAAW;AAC5B,iBAAS,IAAI,GAAG;AAAA,MACjB;AAEA,iBAAW,OAAO,cAAc;AAC/B,iBAAS,IAAI,GAAG;AAChB,mBAAW,SAAS,aAAa;AAChC,gBAAM,YAAY,GAAG,OAAO,KAAK,IAAI,MAAM,YAAY,IAAI;AAC3D,mBAAS,KAAK,WAAW,GAAG;AAAA,QAC7B;AAAA,MACD;AAEA,YAAM,SAAS,KAAK;AAAA,IACrB;AAAA,EACD;AACD;AAEO,SAAS,aACf,EAAE,KAAK,OAAO,QAAQ,SAAS,MAAM,GACtB;AACf,QAAM,QAAQ,IAAI,MAAM;AAAA,IACvB;AAAA,IACA;AAAA,EACD,CAAC;AAED,SAAO,IAAI,aAAa,OAAO,QAAQ,MAAM;AAC9C;","names":[]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __copyProps = (to, from, except, desc) => {
|
|
7
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
8
|
+
for (let key of __getOwnPropNames(from))
|
|
9
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
10
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
11
|
+
}
|
|
12
|
+
return to;
|
|
13
|
+
};
|
|
14
|
+
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
|
|
15
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
16
|
+
var upstash_exports = {};
|
|
17
|
+
module.exports = __toCommonJS(upstash_exports);
|
|
18
|
+
__reExport(upstash_exports, require("./cache.cjs"), module.exports);
|
|
19
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
20
|
+
0 && (module.exports = {
|
|
21
|
+
...require("./cache.cjs")
|
|
22
|
+
});
|
|
23
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cache/upstash/index.ts"],"sourcesContent":["export * from './cache.ts';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,4BAAc,uBAAd;","names":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./cache.cjs";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./cache.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/cache/upstash/index.ts"],"sourcesContent":["export * from './cache.ts';\n"],"mappings":"AAAA,cAAc;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/mysql-core/query-builders/select.types.ts"],"sourcesContent":["import type { MySqlColumn } from '~/mysql-core/columns/index.ts';\nimport type { MySqlTable, MySqlTableWithColumns } from '~/mysql-core/table.ts';\nimport type {\n\tSelectedFields as SelectedFieldsBase,\n\tSelectedFieldsFlat as SelectedFieldsFlatBase,\n\tSelectedFieldsOrdered as SelectedFieldsOrderedBase,\n} from '~/operations.ts';\nimport type { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport type {\n\tAppendToNullabilityMap,\n\tAppendToResult,\n\tBuildSubquerySelection,\n\tGetSelectTableName,\n\tJoinNullability,\n\tJoinType,\n\tMapColumnsToTableAlias,\n\tSelectMode,\n\tSelectResult,\n\tSetOperator,\n} from '~/query-builders/select.types.ts';\nimport type { ColumnsSelection, Placeholder, SQL, View } from '~/sql/sql.ts';\nimport type { Subquery } from '~/subquery.ts';\nimport type { Table, UpdateTableConfig } from '~/table.ts';\nimport type { Assume, ValidateShape } from '~/utils.ts';\nimport type { MySqlPreparedQueryConfig, PreparedQueryHKTBase, PreparedQueryKind } from '../session.ts';\nimport type { MySqlViewBase } from '../view-base.ts';\nimport type { MySqlViewWithSelection } from '../view.ts';\nimport type { IndexConfig, MySqlSelectBase, MySqlSelectQueryBuilderBase } from './select.ts';\n\nexport interface MySqlSelectJoinConfig {\n\ton: SQL | undefined;\n\ttable: MySqlTable | Subquery | MySqlViewBase | SQL;\n\talias: string | undefined;\n\tjoinType: JoinType;\n\tlateral?: boolean;\n\tuseIndex?: string[];\n\tforceIndex?: string[];\n\tignoreIndex?: string[];\n}\n\nexport type BuildAliasTable<TTable extends MySqlTable | View, TAlias extends string> = TTable extends Table\n\t? MySqlTableWithColumns<\n\t\tUpdateTableConfig<TTable['_']['config'], {\n\t\t\tname: TAlias;\n\t\t\tcolumns: MapColumnsToTableAlias<TTable['_']['columns'], TAlias, 'mysql'>;\n\t\t}>\n\t>\n\t: TTable extends View ? MySqlViewWithSelection<\n\t\t\tTAlias,\n\t\t\tTTable['_']['existing'],\n\t\t\tMapColumnsToTableAlias<TTable['_']['selectedFields'], TAlias, 'mysql'>\n\t\t>\n\t: never;\n\nexport interface MySqlSelectConfig {\n\twithList?: Subquery[];\n\tfields: Record<string, unknown>;\n\tfieldsFlat?: SelectedFieldsOrdered;\n\twhere?: SQL;\n\thaving?: SQL;\n\ttable: MySqlTable | Subquery | MySqlViewBase | SQL;\n\tlimit?: number | Placeholder;\n\toffset?: number | Placeholder;\n\tjoins?: MySqlSelectJoinConfig[];\n\torderBy?: (MySqlColumn | SQL | SQL.Aliased)[];\n\tgroupBy?: (MySqlColumn | SQL | SQL.Aliased)[];\n\tlockingClause?: {\n\t\tstrength: LockStrength;\n\t\tconfig: LockConfig;\n\t};\n\tdistinct?: boolean;\n\tsetOperators: {\n\t\trightSelect: TypedQueryBuilder<any, any>;\n\t\ttype: SetOperator;\n\t\tisAll: boolean;\n\t\torderBy?: (MySqlColumn | SQL | SQL.Aliased)[];\n\t\tlimit?: number | Placeholder;\n\t\toffset?: number | Placeholder;\n\t}[];\n\tuseIndex?: string[];\n\tforceIndex?: string[];\n\tignoreIndex?: string[];\n}\n\nexport type MySqlJoin<\n\tT extends AnyMySqlSelectQueryBuilder,\n\tTDynamic extends boolean,\n\tTJoinType extends JoinType,\n\tTJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL,\n\tTJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>,\n> = T extends any ? MySqlSelectWithout<\n\t\tMySqlSelectKind<\n\t\t\tT['_']['hkt'],\n\t\t\tT['_']['tableName'],\n\t\t\tAppendToResult<\n\t\t\t\tT['_']['tableName'],\n\t\t\t\tT['_']['selection'],\n\t\t\t\tTJoinedName,\n\t\t\t\tTJoinedTable extends MySqlTable ? TJoinedTable['_']['columns']\n\t\t\t\t\t: TJoinedTable extends Subquery ? Assume<TJoinedTable['_']['selectedFields'], SelectedFields>\n\t\t\t\t\t: never,\n\t\t\t\tT['_']['selectMode']\n\t\t\t>,\n\t\t\tT['_']['selectMode'] extends 'partial' ? T['_']['selectMode'] : 'multiple',\n\t\t\tT['_']['preparedQueryHKT'],\n\t\t\tAppendToNullabilityMap<T['_']['nullabilityMap'], TJoinedName, TJoinType>,\n\t\t\tTDynamic,\n\t\t\tT['_']['excludedMethods']\n\t\t>,\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>\n\t: never;\n\nexport type MySqlJoinFn<\n\tT extends AnyMySqlSelectQueryBuilder,\n\tTDynamic extends boolean,\n\tTJoinType extends JoinType,\n> = <\n\tTJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL,\n\tTJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>,\n>(\n\ttable: TJoinedTable,\n\ton: ((aliases: T['_']['selection']) => SQL | undefined) | SQL | undefined,\n\tonIndex?: TJoinedTable extends MySqlTable ? IndexConfig\n\t\t: 'Index hint configuration is allowed only for MySqlTable and not for subqueries or views',\n) => MySqlJoin<T, TDynamic, TJoinType, TJoinedTable, TJoinedName>;\n\nexport type SelectedFieldsFlat = SelectedFieldsFlatBase<MySqlColumn>;\n\nexport type SelectedFields = SelectedFieldsBase<MySqlColumn, MySqlTable>;\n\nexport type SelectedFieldsOrdered = SelectedFieldsOrderedBase<MySqlColumn>;\n\nexport type LockStrength = 'update' | 'share';\n\nexport type LockConfig = {\n\tnoWait: true;\n\tskipLocked?: undefined;\n} | {\n\tnoWait?: undefined;\n\tskipLocked: true;\n} | {\n\tnoWait?: undefined;\n\tskipLocked?: undefined;\n};\n\nexport interface MySqlSelectHKTBase {\n\ttableName: string | undefined;\n\tselection: unknown;\n\tselectMode: SelectMode;\n\tpreparedQueryHKT: unknown;\n\tnullabilityMap: unknown;\n\tdynamic: boolean;\n\texcludedMethods: string;\n\tresult: unknown;\n\tselectedFields: unknown;\n\t_type: unknown;\n}\n\nexport type MySqlSelectKind<\n\tT extends MySqlSelectHKTBase,\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase,\n\tTNullabilityMap extends Record<string, JoinNullability>,\n\tTDynamic extends boolean,\n\tTExcludedMethods extends string,\n\tTResult = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> = (T & {\n\ttableName: TTableName;\n\tselection: TSelection;\n\tselectMode: TSelectMode;\n\tpreparedQueryHKT: TPreparedQueryHKT;\n\tnullabilityMap: TNullabilityMap;\n\tdynamic: TDynamic;\n\texcludedMethods: TExcludedMethods;\n\tresult: TResult;\n\tselectedFields: TSelectedFields;\n})['_type'];\n\nexport interface MySqlSelectQueryBuilderHKT extends MySqlSelectHKTBase {\n\t_type: MySqlSelectQueryBuilderBase<\n\t\tMySqlSelectQueryBuilderHKT,\n\t\tthis['tableName'],\n\t\tAssume<this['selection'], ColumnsSelection>,\n\t\tthis['selectMode'],\n\t\tAssume<this['preparedQueryHKT'], PreparedQueryHKTBase>,\n\t\tAssume<this['nullabilityMap'], Record<string, JoinNullability>>,\n\t\tthis['dynamic'],\n\t\tthis['excludedMethods'],\n\t\tAssume<this['result'], any[]>,\n\t\tAssume<this['selectedFields'], ColumnsSelection>\n\t>;\n}\n\nexport interface MySqlSelectHKT extends MySqlSelectHKTBase {\n\t_type: MySqlSelectBase<\n\t\tthis['tableName'],\n\t\tAssume<this['selection'], ColumnsSelection>,\n\t\tthis['selectMode'],\n\t\tAssume<this['preparedQueryHKT'], PreparedQueryHKTBase>,\n\t\tAssume<this['nullabilityMap'], Record<string, JoinNullability>>,\n\t\tthis['dynamic'],\n\t\tthis['excludedMethods'],\n\t\tAssume<this['result'], any[]>,\n\t\tAssume<this['selectedFields'], ColumnsSelection>\n\t>;\n}\n\nexport type MySqlSetOperatorExcludedMethods =\n\t| 'where'\n\t| 'having'\n\t| 'groupBy'\n\t| 'session'\n\t| 'leftJoin'\n\t| 'rightJoin'\n\t| 'innerJoin'\n\t| 'fullJoin'\n\t| 'for';\n\nexport type MySqlSelectWithout<\n\tT extends AnyMySqlSelectQueryBuilder,\n\tTDynamic extends boolean,\n\tK extends keyof T & string,\n\tTResetExcluded extends boolean = false,\n> = TDynamic extends true ? T : Omit<\n\tMySqlSelectKind<\n\t\tT['_']['hkt'],\n\t\tT['_']['tableName'],\n\t\tT['_']['selection'],\n\t\tT['_']['selectMode'],\n\t\tT['_']['preparedQueryHKT'],\n\t\tT['_']['nullabilityMap'],\n\t\tTDynamic,\n\t\tTResetExcluded extends true ? K : T['_']['excludedMethods'] | K,\n\t\tT['_']['result'],\n\t\tT['_']['selectedFields']\n\t>,\n\tTResetExcluded extends true ? K : T['_']['excludedMethods'] | K\n>;\n\nexport type MySqlSelectPrepare<T extends AnyMySqlSelect> = PreparedQueryKind<\n\tT['_']['preparedQueryHKT'],\n\tMySqlPreparedQueryConfig & {\n\t\texecute: T['_']['result'];\n\t\titerator: T['_']['result'][number];\n\t},\n\ttrue\n>;\n\nexport type MySqlSelectDynamic<T extends AnyMySqlSelectQueryBuilder> = MySqlSelectKind<\n\tT['_']['hkt'],\n\tT['_']['tableName'],\n\tT['_']['selection'],\n\tT['_']['selectMode'],\n\tT['_']['preparedQueryHKT'],\n\tT['_']['nullabilityMap'],\n\ttrue,\n\tnever,\n\tT['_']['result'],\n\tT['_']['selectedFields']\n>;\n\nexport type CreateMySqlSelectFromBuilderMode<\n\tTBuilderMode extends 'db' | 'qb',\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase,\n> = TBuilderMode extends 'db' ? MySqlSelectBase<TTableName, TSelection, TSelectMode, TPreparedQueryHKT>\n\t: MySqlSelectQueryBuilderBase<MySqlSelectQueryBuilderHKT, TTableName, TSelection, TSelectMode, TPreparedQueryHKT>;\n\nexport type MySqlSelectQueryBuilder<\n\tTHKT extends MySqlSelectHKTBase = MySqlSelectQueryBuilderHKT,\n\tTTableName extends string | undefined = string | undefined,\n\tTSelection extends ColumnsSelection = ColumnsSelection,\n\tTSelectMode extends SelectMode = SelectMode,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase = PreparedQueryHKTBase,\n\tTNullabilityMap extends Record<string, JoinNullability> = Record<string, JoinNullability>,\n\tTResult extends any[] = unknown[],\n\tTSelectedFields extends ColumnsSelection = ColumnsSelection,\n> = MySqlSelectQueryBuilderBase<\n\tTHKT,\n\tTTableName,\n\tTSelection,\n\tTSelectMode,\n\tTPreparedQueryHKT,\n\tTNullabilityMap,\n\ttrue,\n\tnever,\n\tTResult,\n\tTSelectedFields\n>;\n\nexport type AnyMySqlSelectQueryBuilder = MySqlSelectQueryBuilderBase<any, any, any, any, any, any, any, any, any>;\n\nexport type AnyMySqlSetOperatorInterface = MySqlSetOperatorInterface<any, any, any, any, any, any, any, any, any>;\n\nexport interface MySqlSetOperatorInterface<\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase = PreparedQueryHKTBase,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> {\n\t_: {\n\t\treadonly hkt: MySqlSelectHKT;\n\t\treadonly tableName: TTableName;\n\t\treadonly selection: TSelection;\n\t\treadonly selectMode: TSelectMode;\n\t\treadonly preparedQueryHKT: TPreparedQueryHKT;\n\t\treadonly nullabilityMap: TNullabilityMap;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TResult;\n\t\treadonly selectedFields: TSelectedFields;\n\t};\n}\n\nexport type MySqlSetOperatorWithResult<TResult extends any[]> = MySqlSetOperatorInterface<\n\tany,\n\tany,\n\tany,\n\tany,\n\tany,\n\tany,\n\tany,\n\tTResult,\n\tany\n>;\n\nexport type MySqlSelect<\n\tTTableName extends string | undefined = string | undefined,\n\tTSelection extends ColumnsSelection = Record<string, any>,\n\tTSelectMode extends SelectMode = SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = Record<string, JoinNullability>,\n> = MySqlSelectBase<TTableName, TSelection, TSelectMode, PreparedQueryHKTBase, TNullabilityMap, true, never>;\n\nexport type AnyMySqlSelect = MySqlSelectBase<any, any, any, any, any, any, any, any>;\n\nexport type MySqlSetOperator<\n\tTTableName extends string | undefined = string | undefined,\n\tTSelection extends ColumnsSelection = Record<string, any>,\n\tTSelectMode extends SelectMode = SelectMode,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase = PreparedQueryHKTBase,\n\tTNullabilityMap extends Record<string, JoinNullability> = Record<string, JoinNullability>,\n> = MySqlSelectBase<\n\tTTableName,\n\tTSelection,\n\tTSelectMode,\n\tTPreparedQueryHKT,\n\tTNullabilityMap,\n\ttrue,\n\tMySqlSetOperatorExcludedMethods\n>;\n\nexport type SetOperatorRightSelect<\n\tTValue extends MySqlSetOperatorWithResult<TResult>,\n\tTResult extends any[],\n> = TValue extends MySqlSetOperatorInterface<any, any, any, any, any, any, any, infer TValueResult, any>\n\t? ValidateShape<\n\t\tTValueResult[number],\n\t\tTResult[number],\n\t\tTypedQueryBuilder<any, TValueResult>\n\t>\n\t: TValue;\n\nexport type SetOperatorRestSelect<\n\tTValue extends readonly MySqlSetOperatorWithResult<TResult>[],\n\tTResult extends any[],\n> = TValue extends [infer First, ...infer Rest]\n\t? First extends MySqlSetOperatorInterface<any, any, any, any, any, any, any, infer TValueResult, any>\n\t\t? Rest extends AnyMySqlSetOperatorInterface[] ? [\n\t\t\t\tValidateShape<TValueResult[number], TResult[number], TypedQueryBuilder<any, TValueResult>>,\n\t\t\t\t...SetOperatorRestSelect<Rest, TResult>,\n\t\t\t]\n\t\t: ValidateShape<TValueResult[number], TResult[number], TypedQueryBuilder<any, TValueResult>[]>\n\t: never\n\t: TValue;\n\nexport type MySqlCreateSetOperatorFn = <\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTValue extends MySqlSetOperatorWithResult<TResult>,\n\tTRest extends MySqlSetOperatorWithResult<TResult>[],\n\tTPreparedQueryHKT extends PreparedQueryHKTBase = PreparedQueryHKTBase,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,\n>(\n\tleftSelect: MySqlSetOperatorInterface<\n\t\tTTableName,\n\t\tTSelection,\n\t\tTSelectMode,\n\t\tTPreparedQueryHKT,\n\t\tTNullabilityMap,\n\t\tTDynamic,\n\t\tTExcludedMethods,\n\t\tTResult,\n\t\tTSelectedFields\n\t>,\n\trightSelect: SetOperatorRightSelect<TValue, TResult>,\n\t...restSelects: SetOperatorRestSelect<TRest, TResult>\n) => MySqlSelectWithout<\n\tMySqlSelectBase<\n\t\tTTableName,\n\t\tTSelection,\n\t\tTSelectMode,\n\t\tTPreparedQueryHKT,\n\t\tTNullabilityMap,\n\t\tTDynamic,\n\t\tTExcludedMethods,\n\t\tTResult,\n\t\tTSelectedFields\n\t>,\n\tfalse,\n\tMySqlSetOperatorExcludedMethods,\n\ttrue\n>;\n\nexport type GetMySqlSetOperators = {\n\tunion: MySqlCreateSetOperatorFn;\n\tintersect: MySqlCreateSetOperatorFn;\n\texcept: MySqlCreateSetOperatorFn;\n\tunionAll: MySqlCreateSetOperatorFn;\n\tintersectAll: MySqlCreateSetOperatorFn;\n\texceptAll: MySqlCreateSetOperatorFn;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/mysql-core/query-builders/select.types.ts"],"sourcesContent":["import type { MySqlColumn } from '~/mysql-core/columns/index.ts';\nimport type { MySqlTable, MySqlTableWithColumns } from '~/mysql-core/table.ts';\nimport type {\n\tSelectedFields as SelectedFieldsBase,\n\tSelectedFieldsFlat as SelectedFieldsFlatBase,\n\tSelectedFieldsOrdered as SelectedFieldsOrderedBase,\n} from '~/operations.ts';\nimport type { TypedQueryBuilder } from '~/query-builders/query-builder.ts';\nimport type {\n\tAppendToNullabilityMap,\n\tAppendToResult,\n\tBuildSubquerySelection,\n\tGetSelectTableName,\n\tJoinNullability,\n\tJoinType,\n\tMapColumnsToTableAlias,\n\tSelectMode,\n\tSelectResult,\n\tSetOperator,\n} from '~/query-builders/select.types.ts';\nimport type { ColumnsSelection, Placeholder, SQL, View } from '~/sql/sql.ts';\nimport type { Subquery } from '~/subquery.ts';\nimport type { Table, UpdateTableConfig } from '~/table.ts';\nimport type { Assume, ValidateShape } from '~/utils.ts';\nimport type { MySqlPreparedQueryConfig, PreparedQueryHKTBase, PreparedQueryKind } from '../session.ts';\nimport type { MySqlViewBase } from '../view-base.ts';\nimport type { MySqlViewWithSelection } from '../view.ts';\nimport type { IndexConfig, MySqlSelectBase, MySqlSelectQueryBuilderBase } from './select.ts';\n\nexport interface MySqlSelectJoinConfig {\n\ton: SQL | undefined;\n\ttable: MySqlTable | Subquery | MySqlViewBase | SQL;\n\talias: string | undefined;\n\tjoinType: JoinType;\n\tlateral?: boolean;\n\tuseIndex?: string[];\n\tforceIndex?: string[];\n\tignoreIndex?: string[];\n}\n\nexport type BuildAliasTable<TTable extends MySqlTable | View, TAlias extends string> = TTable extends Table\n\t? MySqlTableWithColumns<\n\t\tUpdateTableConfig<TTable['_']['config'], {\n\t\t\tname: TAlias;\n\t\t\tcolumns: MapColumnsToTableAlias<TTable['_']['columns'], TAlias, 'mysql'>;\n\t\t}>\n\t>\n\t: TTable extends View ? MySqlViewWithSelection<\n\t\t\tTAlias,\n\t\t\tTTable['_']['existing'],\n\t\t\tMapColumnsToTableAlias<TTable['_']['selectedFields'], TAlias, 'mysql'>\n\t\t>\n\t: never;\n\nexport interface MySqlSelectConfig {\n\twithList?: Subquery[];\n\tfields: Record<string, unknown>;\n\tfieldsFlat?: SelectedFieldsOrdered;\n\twhere?: SQL;\n\thaving?: SQL;\n\ttable: MySqlTable | Subquery | MySqlViewBase | SQL;\n\tlimit?: number | Placeholder;\n\toffset?: number | Placeholder;\n\tjoins?: MySqlSelectJoinConfig[];\n\torderBy?: (MySqlColumn | SQL | SQL.Aliased)[];\n\tgroupBy?: (MySqlColumn | SQL | SQL.Aliased)[];\n\tlockingClause?: {\n\t\tstrength: LockStrength;\n\t\tconfig: LockConfig;\n\t};\n\tdistinct?: boolean;\n\tsetOperators: {\n\t\trightSelect: TypedQueryBuilder<any, any>;\n\t\ttype: SetOperator;\n\t\tisAll: boolean;\n\t\torderBy?: (MySqlColumn | SQL | SQL.Aliased)[];\n\t\tlimit?: number | Placeholder;\n\t\toffset?: number | Placeholder;\n\t}[];\n\tuseIndex?: string[];\n\tforceIndex?: string[];\n\tignoreIndex?: string[];\n}\n\nexport type MySqlJoin<\n\tT extends AnyMySqlSelectQueryBuilder,\n\tTDynamic extends boolean,\n\tTJoinType extends JoinType,\n\tTJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL,\n\tTJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>,\n> = T extends any ? MySqlSelectWithout<\n\t\tMySqlSelectKind<\n\t\t\tT['_']['hkt'],\n\t\t\tT['_']['tableName'],\n\t\t\tAppendToResult<\n\t\t\t\tT['_']['tableName'],\n\t\t\t\tT['_']['selection'],\n\t\t\t\tTJoinedName,\n\t\t\t\tTJoinedTable extends MySqlTable ? TJoinedTable['_']['columns']\n\t\t\t\t\t: TJoinedTable extends Subquery | View ? Assume<TJoinedTable['_']['selectedFields'], SelectedFields>\n\t\t\t\t\t: never,\n\t\t\t\tT['_']['selectMode']\n\t\t\t>,\n\t\t\tT['_']['selectMode'] extends 'partial' ? T['_']['selectMode'] : 'multiple',\n\t\t\tT['_']['preparedQueryHKT'],\n\t\t\tAppendToNullabilityMap<T['_']['nullabilityMap'], TJoinedName, TJoinType>,\n\t\t\tTDynamic,\n\t\t\tT['_']['excludedMethods']\n\t\t>,\n\t\tTDynamic,\n\t\tT['_']['excludedMethods']\n\t>\n\t: never;\n\nexport type MySqlJoinFn<\n\tT extends AnyMySqlSelectQueryBuilder,\n\tTDynamic extends boolean,\n\tTJoinType extends JoinType,\n> = <\n\tTJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL,\n\tTJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>,\n>(\n\ttable: TJoinedTable,\n\ton: ((aliases: T['_']['selection']) => SQL | undefined) | SQL | undefined,\n\tonIndex?: TJoinedTable extends MySqlTable ? IndexConfig\n\t\t: 'Index hint configuration is allowed only for MySqlTable and not for subqueries or views',\n) => MySqlJoin<T, TDynamic, TJoinType, TJoinedTable, TJoinedName>;\n\nexport type SelectedFieldsFlat = SelectedFieldsFlatBase<MySqlColumn>;\n\nexport type SelectedFields = SelectedFieldsBase<MySqlColumn, MySqlTable>;\n\nexport type SelectedFieldsOrdered = SelectedFieldsOrderedBase<MySqlColumn>;\n\nexport type LockStrength = 'update' | 'share';\n\nexport type LockConfig = {\n\tnoWait: true;\n\tskipLocked?: undefined;\n} | {\n\tnoWait?: undefined;\n\tskipLocked: true;\n} | {\n\tnoWait?: undefined;\n\tskipLocked?: undefined;\n};\n\nexport interface MySqlSelectHKTBase {\n\ttableName: string | undefined;\n\tselection: unknown;\n\tselectMode: SelectMode;\n\tpreparedQueryHKT: unknown;\n\tnullabilityMap: unknown;\n\tdynamic: boolean;\n\texcludedMethods: string;\n\tresult: unknown;\n\tselectedFields: unknown;\n\t_type: unknown;\n}\n\nexport type MySqlSelectKind<\n\tT extends MySqlSelectHKTBase,\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase,\n\tTNullabilityMap extends Record<string, JoinNullability>,\n\tTDynamic extends boolean,\n\tTExcludedMethods extends string,\n\tTResult = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> = (T & {\n\ttableName: TTableName;\n\tselection: TSelection;\n\tselectMode: TSelectMode;\n\tpreparedQueryHKT: TPreparedQueryHKT;\n\tnullabilityMap: TNullabilityMap;\n\tdynamic: TDynamic;\n\texcludedMethods: TExcludedMethods;\n\tresult: TResult;\n\tselectedFields: TSelectedFields;\n})['_type'];\n\nexport interface MySqlSelectQueryBuilderHKT extends MySqlSelectHKTBase {\n\t_type: MySqlSelectQueryBuilderBase<\n\t\tMySqlSelectQueryBuilderHKT,\n\t\tthis['tableName'],\n\t\tAssume<this['selection'], ColumnsSelection>,\n\t\tthis['selectMode'],\n\t\tAssume<this['preparedQueryHKT'], PreparedQueryHKTBase>,\n\t\tAssume<this['nullabilityMap'], Record<string, JoinNullability>>,\n\t\tthis['dynamic'],\n\t\tthis['excludedMethods'],\n\t\tAssume<this['result'], any[]>,\n\t\tAssume<this['selectedFields'], ColumnsSelection>\n\t>;\n}\n\nexport interface MySqlSelectHKT extends MySqlSelectHKTBase {\n\t_type: MySqlSelectBase<\n\t\tthis['tableName'],\n\t\tAssume<this['selection'], ColumnsSelection>,\n\t\tthis['selectMode'],\n\t\tAssume<this['preparedQueryHKT'], PreparedQueryHKTBase>,\n\t\tAssume<this['nullabilityMap'], Record<string, JoinNullability>>,\n\t\tthis['dynamic'],\n\t\tthis['excludedMethods'],\n\t\tAssume<this['result'], any[]>,\n\t\tAssume<this['selectedFields'], ColumnsSelection>\n\t>;\n}\n\nexport type MySqlSetOperatorExcludedMethods =\n\t| 'where'\n\t| 'having'\n\t| 'groupBy'\n\t| 'session'\n\t| 'leftJoin'\n\t| 'rightJoin'\n\t| 'innerJoin'\n\t| 'fullJoin'\n\t| 'for';\n\nexport type MySqlSelectWithout<\n\tT extends AnyMySqlSelectQueryBuilder,\n\tTDynamic extends boolean,\n\tK extends keyof T & string,\n\tTResetExcluded extends boolean = false,\n> = TDynamic extends true ? T : Omit<\n\tMySqlSelectKind<\n\t\tT['_']['hkt'],\n\t\tT['_']['tableName'],\n\t\tT['_']['selection'],\n\t\tT['_']['selectMode'],\n\t\tT['_']['preparedQueryHKT'],\n\t\tT['_']['nullabilityMap'],\n\t\tTDynamic,\n\t\tTResetExcluded extends true ? K : T['_']['excludedMethods'] | K,\n\t\tT['_']['result'],\n\t\tT['_']['selectedFields']\n\t>,\n\tTResetExcluded extends true ? K : T['_']['excludedMethods'] | K\n>;\n\nexport type MySqlSelectPrepare<T extends AnyMySqlSelect> = PreparedQueryKind<\n\tT['_']['preparedQueryHKT'],\n\tMySqlPreparedQueryConfig & {\n\t\texecute: T['_']['result'];\n\t\titerator: T['_']['result'][number];\n\t},\n\ttrue\n>;\n\nexport type MySqlSelectDynamic<T extends AnyMySqlSelectQueryBuilder> = MySqlSelectKind<\n\tT['_']['hkt'],\n\tT['_']['tableName'],\n\tT['_']['selection'],\n\tT['_']['selectMode'],\n\tT['_']['preparedQueryHKT'],\n\tT['_']['nullabilityMap'],\n\ttrue,\n\tnever,\n\tT['_']['result'],\n\tT['_']['selectedFields']\n>;\n\nexport type CreateMySqlSelectFromBuilderMode<\n\tTBuilderMode extends 'db' | 'qb',\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase,\n> = TBuilderMode extends 'db' ? MySqlSelectBase<TTableName, TSelection, TSelectMode, TPreparedQueryHKT>\n\t: MySqlSelectQueryBuilderBase<MySqlSelectQueryBuilderHKT, TTableName, TSelection, TSelectMode, TPreparedQueryHKT>;\n\nexport type MySqlSelectQueryBuilder<\n\tTHKT extends MySqlSelectHKTBase = MySqlSelectQueryBuilderHKT,\n\tTTableName extends string | undefined = string | undefined,\n\tTSelection extends ColumnsSelection = ColumnsSelection,\n\tTSelectMode extends SelectMode = SelectMode,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase = PreparedQueryHKTBase,\n\tTNullabilityMap extends Record<string, JoinNullability> = Record<string, JoinNullability>,\n\tTResult extends any[] = unknown[],\n\tTSelectedFields extends ColumnsSelection = ColumnsSelection,\n> = MySqlSelectQueryBuilderBase<\n\tTHKT,\n\tTTableName,\n\tTSelection,\n\tTSelectMode,\n\tTPreparedQueryHKT,\n\tTNullabilityMap,\n\ttrue,\n\tnever,\n\tTResult,\n\tTSelectedFields\n>;\n\nexport type AnyMySqlSelectQueryBuilder = MySqlSelectQueryBuilderBase<any, any, any, any, any, any, any, any, any>;\n\nexport type AnyMySqlSetOperatorInterface = MySqlSetOperatorInterface<any, any, any, any, any, any, any, any, any>;\n\nexport interface MySqlSetOperatorInterface<\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase = PreparedQueryHKTBase,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,\n> {\n\t_: {\n\t\treadonly hkt: MySqlSelectHKT;\n\t\treadonly tableName: TTableName;\n\t\treadonly selection: TSelection;\n\t\treadonly selectMode: TSelectMode;\n\t\treadonly preparedQueryHKT: TPreparedQueryHKT;\n\t\treadonly nullabilityMap: TNullabilityMap;\n\t\treadonly dynamic: TDynamic;\n\t\treadonly excludedMethods: TExcludedMethods;\n\t\treadonly result: TResult;\n\t\treadonly selectedFields: TSelectedFields;\n\t};\n}\n\nexport type MySqlSetOperatorWithResult<TResult extends any[]> = MySqlSetOperatorInterface<\n\tany,\n\tany,\n\tany,\n\tany,\n\tany,\n\tany,\n\tany,\n\tTResult,\n\tany\n>;\n\nexport type MySqlSelect<\n\tTTableName extends string | undefined = string | undefined,\n\tTSelection extends ColumnsSelection = Record<string, any>,\n\tTSelectMode extends SelectMode = SelectMode,\n\tTNullabilityMap extends Record<string, JoinNullability> = Record<string, JoinNullability>,\n> = MySqlSelectBase<TTableName, TSelection, TSelectMode, PreparedQueryHKTBase, TNullabilityMap, true, never>;\n\nexport type AnyMySqlSelect = MySqlSelectBase<any, any, any, any, any, any, any, any>;\n\nexport type MySqlSetOperator<\n\tTTableName extends string | undefined = string | undefined,\n\tTSelection extends ColumnsSelection = Record<string, any>,\n\tTSelectMode extends SelectMode = SelectMode,\n\tTPreparedQueryHKT extends PreparedQueryHKTBase = PreparedQueryHKTBase,\n\tTNullabilityMap extends Record<string, JoinNullability> = Record<string, JoinNullability>,\n> = MySqlSelectBase<\n\tTTableName,\n\tTSelection,\n\tTSelectMode,\n\tTPreparedQueryHKT,\n\tTNullabilityMap,\n\ttrue,\n\tMySqlSetOperatorExcludedMethods\n>;\n\nexport type SetOperatorRightSelect<\n\tTValue extends MySqlSetOperatorWithResult<TResult>,\n\tTResult extends any[],\n> = TValue extends MySqlSetOperatorInterface<any, any, any, any, any, any, any, infer TValueResult, any>\n\t? ValidateShape<\n\t\tTValueResult[number],\n\t\tTResult[number],\n\t\tTypedQueryBuilder<any, TValueResult>\n\t>\n\t: TValue;\n\nexport type SetOperatorRestSelect<\n\tTValue extends readonly MySqlSetOperatorWithResult<TResult>[],\n\tTResult extends any[],\n> = TValue extends [infer First, ...infer Rest]\n\t? First extends MySqlSetOperatorInterface<any, any, any, any, any, any, any, infer TValueResult, any>\n\t\t? Rest extends AnyMySqlSetOperatorInterface[] ? [\n\t\t\t\tValidateShape<TValueResult[number], TResult[number], TypedQueryBuilder<any, TValueResult>>,\n\t\t\t\t...SetOperatorRestSelect<Rest, TResult>,\n\t\t\t]\n\t\t: ValidateShape<TValueResult[number], TResult[number], TypedQueryBuilder<any, TValueResult>[]>\n\t: never\n\t: TValue;\n\nexport type MySqlCreateSetOperatorFn = <\n\tTTableName extends string | undefined,\n\tTSelection extends ColumnsSelection,\n\tTSelectMode extends SelectMode,\n\tTValue extends MySqlSetOperatorWithResult<TResult>,\n\tTRest extends MySqlSetOperatorWithResult<TResult>[],\n\tTPreparedQueryHKT extends PreparedQueryHKTBase = PreparedQueryHKTBase,\n\tTNullabilityMap extends Record<string, JoinNullability> = TTableName extends string ? Record<TTableName, 'not-null'>\n\t\t: {},\n\tTDynamic extends boolean = false,\n\tTExcludedMethods extends string = never,\n\tTResult extends any[] = SelectResult<TSelection, TSelectMode, TNullabilityMap>[],\n\tTSelectedFields extends ColumnsSelection = BuildSubquerySelection<TSelection, TNullabilityMap>,\n>(\n\tleftSelect: MySqlSetOperatorInterface<\n\t\tTTableName,\n\t\tTSelection,\n\t\tTSelectMode,\n\t\tTPreparedQueryHKT,\n\t\tTNullabilityMap,\n\t\tTDynamic,\n\t\tTExcludedMethods,\n\t\tTResult,\n\t\tTSelectedFields\n\t>,\n\trightSelect: SetOperatorRightSelect<TValue, TResult>,\n\t...restSelects: SetOperatorRestSelect<TRest, TResult>\n) => MySqlSelectWithout<\n\tMySqlSelectBase<\n\t\tTTableName,\n\t\tTSelection,\n\t\tTSelectMode,\n\t\tTPreparedQueryHKT,\n\t\tTNullabilityMap,\n\t\tTDynamic,\n\t\tTExcludedMethods,\n\t\tTResult,\n\t\tTSelectedFields\n\t>,\n\tfalse,\n\tMySqlSetOperatorExcludedMethods,\n\ttrue\n>;\n\nexport type GetMySqlSetOperators = {\n\tunion: MySqlCreateSetOperatorFn;\n\tintersect: MySqlCreateSetOperatorFn;\n\texcept: MySqlCreateSetOperatorFn;\n\tunionAll: MySqlCreateSetOperatorFn;\n\tintersectAll: MySqlCreateSetOperatorFn;\n\texceptAll: MySqlCreateSetOperatorFn;\n};\n"],"mappings":";;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
|
@@ -54,7 +54,7 @@ export interface MySqlSelectConfig {
|
|
|
54
54
|
forceIndex?: string[];
|
|
55
55
|
ignoreIndex?: string[];
|
|
56
56
|
}
|
|
57
|
-
export type MySqlJoin<T extends AnyMySqlSelectQueryBuilder, TDynamic extends boolean, TJoinType extends JoinType, TJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL, TJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>> = T extends any ? MySqlSelectWithout<MySqlSelectKind<T['_']['hkt'], T['_']['tableName'], AppendToResult<T['_']['tableName'], T['_']['selection'], TJoinedName, TJoinedTable extends MySqlTable ? TJoinedTable['_']['columns'] : TJoinedTable extends Subquery ? Assume<TJoinedTable['_']['selectedFields'], SelectedFields> : never, T['_']['selectMode']>, T['_']['selectMode'] extends 'partial' ? T['_']['selectMode'] : 'multiple', T['_']['preparedQueryHKT'], AppendToNullabilityMap<T['_']['nullabilityMap'], TJoinedName, TJoinType>, TDynamic, T['_']['excludedMethods']>, TDynamic, T['_']['excludedMethods']> : never;
|
|
57
|
+
export type MySqlJoin<T extends AnyMySqlSelectQueryBuilder, TDynamic extends boolean, TJoinType extends JoinType, TJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL, TJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>> = T extends any ? MySqlSelectWithout<MySqlSelectKind<T['_']['hkt'], T['_']['tableName'], AppendToResult<T['_']['tableName'], T['_']['selection'], TJoinedName, TJoinedTable extends MySqlTable ? TJoinedTable['_']['columns'] : TJoinedTable extends Subquery | View ? Assume<TJoinedTable['_']['selectedFields'], SelectedFields> : never, T['_']['selectMode']>, T['_']['selectMode'] extends 'partial' ? T['_']['selectMode'] : 'multiple', T['_']['preparedQueryHKT'], AppendToNullabilityMap<T['_']['nullabilityMap'], TJoinedName, TJoinType>, TDynamic, T['_']['excludedMethods']>, TDynamic, T['_']['excludedMethods']> : never;
|
|
58
58
|
export type MySqlJoinFn<T extends AnyMySqlSelectQueryBuilder, TDynamic extends boolean, TJoinType extends JoinType> = <TJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL, TJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>>(table: TJoinedTable, on: ((aliases: T['_']['selection']) => SQL | undefined) | SQL | undefined, onIndex?: TJoinedTable extends MySqlTable ? IndexConfig : 'Index hint configuration is allowed only for MySqlTable and not for subqueries or views') => MySqlJoin<T, TDynamic, TJoinType, TJoinedTable, TJoinedName>;
|
|
59
59
|
export type SelectedFieldsFlat = SelectedFieldsFlatBase<MySqlColumn>;
|
|
60
60
|
export type SelectedFields = SelectedFieldsBase<MySqlColumn, MySqlTable>;
|
|
@@ -54,7 +54,7 @@ export interface MySqlSelectConfig {
|
|
|
54
54
|
forceIndex?: string[];
|
|
55
55
|
ignoreIndex?: string[];
|
|
56
56
|
}
|
|
57
|
-
export type MySqlJoin<T extends AnyMySqlSelectQueryBuilder, TDynamic extends boolean, TJoinType extends JoinType, TJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL, TJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>> = T extends any ? MySqlSelectWithout<MySqlSelectKind<T['_']['hkt'], T['_']['tableName'], AppendToResult<T['_']['tableName'], T['_']['selection'], TJoinedName, TJoinedTable extends MySqlTable ? TJoinedTable['_']['columns'] : TJoinedTable extends Subquery ? Assume<TJoinedTable['_']['selectedFields'], SelectedFields> : never, T['_']['selectMode']>, T['_']['selectMode'] extends 'partial' ? T['_']['selectMode'] : 'multiple', T['_']['preparedQueryHKT'], AppendToNullabilityMap<T['_']['nullabilityMap'], TJoinedName, TJoinType>, TDynamic, T['_']['excludedMethods']>, TDynamic, T['_']['excludedMethods']> : never;
|
|
57
|
+
export type MySqlJoin<T extends AnyMySqlSelectQueryBuilder, TDynamic extends boolean, TJoinType extends JoinType, TJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL, TJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>> = T extends any ? MySqlSelectWithout<MySqlSelectKind<T['_']['hkt'], T['_']['tableName'], AppendToResult<T['_']['tableName'], T['_']['selection'], TJoinedName, TJoinedTable extends MySqlTable ? TJoinedTable['_']['columns'] : TJoinedTable extends Subquery | View ? Assume<TJoinedTable['_']['selectedFields'], SelectedFields> : never, T['_']['selectMode']>, T['_']['selectMode'] extends 'partial' ? T['_']['selectMode'] : 'multiple', T['_']['preparedQueryHKT'], AppendToNullabilityMap<T['_']['nullabilityMap'], TJoinedName, TJoinType>, TDynamic, T['_']['excludedMethods']>, TDynamic, T['_']['excludedMethods']> : never;
|
|
58
58
|
export type MySqlJoinFn<T extends AnyMySqlSelectQueryBuilder, TDynamic extends boolean, TJoinType extends JoinType> = <TJoinedTable extends MySqlTable | Subquery | MySqlViewBase | SQL, TJoinedName extends GetSelectTableName<TJoinedTable> = GetSelectTableName<TJoinedTable>>(table: TJoinedTable, on: ((aliases: T['_']['selection']) => SQL | undefined) | SQL | undefined, onIndex?: TJoinedTable extends MySqlTable ? IndexConfig : 'Index hint configuration is allowed only for MySqlTable and not for subqueries or views') => MySqlJoin<T, TDynamic, TJoinType, TJoinedTable, TJoinedName>;
|
|
59
59
|
export type SelectedFieldsFlat = SelectedFieldsFlatBase<MySqlColumn>;
|
|
60
60
|
export type SelectedFields = SelectedFieldsBase<MySqlColumn, MySqlTable>;
|
package/neon/neon-identity.cjs
CHANGED
|
@@ -22,8 +22,8 @@ __export(neon_identity_exports, {
|
|
|
22
22
|
});
|
|
23
23
|
module.exports = __toCommonJS(neon_identity_exports);
|
|
24
24
|
var import_pg_core = require("../pg-core/index.cjs");
|
|
25
|
-
const
|
|
26
|
-
const usersSync =
|
|
25
|
+
const neonAuthSchema = (0, import_pg_core.pgSchema)("neon_auth");
|
|
26
|
+
const usersSync = neonAuthSchema.table("users_sync", {
|
|
27
27
|
rawJson: (0, import_pg_core.jsonb)("raw_json").notNull(),
|
|
28
28
|
id: (0, import_pg_core.text)().primaryKey().notNull(),
|
|
29
29
|
name: (0, import_pg_core.text)(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/neon/neon-identity.ts"],"sourcesContent":["import { jsonb, pgSchema, text, timestamp } from '~/pg-core/index.ts';\n\nconst
|
|
1
|
+
{"version":3,"sources":["../../src/neon/neon-identity.ts"],"sourcesContent":["import { jsonb, pgSchema, text, timestamp } from '~/pg-core/index.ts';\n\nconst neonAuthSchema = pgSchema('neon_auth');\n\n/**\n * Table schema of the `users_sync` table used by Neon Auth.\n * This table automatically synchronizes and stores user data from external authentication providers.\n *\n * @schema neon_auth\n * @table users_sync\n */\nexport const usersSync = neonAuthSchema.table('users_sync', {\n\trawJson: jsonb('raw_json').notNull(),\n\tid: text().primaryKey().notNull(),\n\tname: text(),\n\temail: text(),\n\tcreatedAt: timestamp('created_at', { withTimezone: true, mode: 'string' }),\n\tdeletedAt: timestamp('deleted_at', { withTimezone: true, mode: 'string' }),\n});\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,qBAAiD;AAEjD,MAAM,qBAAiB,yBAAS,WAAW;AASpC,MAAM,YAAY,eAAe,MAAM,cAAc;AAAA,EAC3D,aAAS,sBAAM,UAAU,EAAE,QAAQ;AAAA,EACnC,QAAI,qBAAK,EAAE,WAAW,EAAE,QAAQ;AAAA,EAChC,UAAM,qBAAK;AAAA,EACX,WAAO,qBAAK;AAAA,EACZ,eAAW,0BAAU,cAAc,EAAE,cAAc,MAAM,MAAM,SAAS,CAAC;AAAA,EACzE,eAAW,0BAAU,cAAc,EAAE,cAAc,MAAM,MAAM,SAAS,CAAC;AAC1E,CAAC;","names":[]}
|
package/neon/neon-identity.d.cts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Table schema of the `users_sync` table used by Neon
|
|
2
|
+
* Table schema of the `users_sync` table used by Neon Auth.
|
|
3
3
|
* This table automatically synchronizes and stores user data from external authentication providers.
|
|
4
4
|
*
|
|
5
|
-
* @schema
|
|
5
|
+
* @schema neon_auth
|
|
6
6
|
* @table users_sync
|
|
7
7
|
*/
|
|
8
8
|
export declare const usersSync: import("../pg-core/index.ts").PgTableWithColumns<{
|
|
9
9
|
name: "users_sync";
|
|
10
|
-
schema: "
|
|
10
|
+
schema: "neon_auth";
|
|
11
11
|
columns: {
|
|
12
12
|
rawJson: import("../pg-core/index.ts").PgColumn<{
|
|
13
13
|
name: "raw_json";
|