drizzle-orm 0.34.0-b75016b → 0.34.0-bab5208
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/column.cjs +1 -2
- package/column.cjs.map +1 -1
- package/column.d.cts +1 -0
- package/column.d.ts +1 -0
- package/column.js +1 -2
- package/column.js.map +1 -1
- package/package.json +51 -99
- package/pg-core/columns/common.cjs +3 -1
- package/pg-core/columns/common.cjs.map +1 -1
- package/pg-core/columns/common.d.cts +2 -1
- package/pg-core/columns/common.d.ts +2 -1
- package/pg-core/columns/common.js +3 -1
- package/pg-core/columns/common.js.map +1 -1
- package/pg-core/index.cjs +0 -4
- package/pg-core/index.cjs.map +1 -1
- package/pg-core/index.d.cts +0 -2
- package/pg-core/index.d.ts +0 -2
- package/pg-core/index.js +0 -2
- package/pg-core/index.js.map +1 -1
- package/pg-core/indexes.cjs +3 -3
- package/pg-core/indexes.cjs.map +1 -1
- package/pg-core/indexes.js +3 -3
- package/pg-core/indexes.js.map +1 -1
- package/pg-core/table.cjs.map +1 -1
- package/pg-core/table.d.cts +1 -2
- package/pg-core/table.d.ts +1 -2
- package/pg-core/table.js.map +1 -1
- package/pg-core/utils.cjs +2 -23
- package/pg-core/utils.cjs.map +1 -1
- package/pg-core/utils.d.cts +0 -2
- package/pg-core/utils.d.ts +0 -2
- package/pg-core/utils.js +2 -23
- package/pg-core/utils.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/neon/index.cjs +0 -23
- package/neon/index.cjs.map +0 -1
- package/neon/index.d.cts +0 -1
- package/neon/index.d.ts +0 -1
- package/neon/index.js +0 -2
- package/neon/index.js.map +0 -1
- package/neon/rls.cjs +0 -81
- package/neon/rls.cjs.map +0 -1
- package/neon/rls.d.cts +0 -13
- package/neon/rls.d.ts +0 -13
- package/neon/rls.js +0 -54
- package/neon/rls.js.map +0 -1
- package/pg-core/policies.cjs +0 -52
- package/pg-core/policies.cjs.map +0 -1
- package/pg-core/policies.d.cts +0 -22
- package/pg-core/policies.d.ts +0 -22
- package/pg-core/policies.js +0 -27
- package/pg-core/policies.js.map +0 -1
- package/pg-core/roles.cjs +0 -57
- package/pg-core/roles.cjs.map +0 -1
- package/pg-core/roles.d.cts +0 -13
- package/pg-core/roles.d.ts +0 -13
- package/pg-core/roles.js +0 -32
- package/pg-core/roles.js.map +0 -1
package/neon/rls.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/neon/rls.ts"],"sourcesContent":["import { is } from '~/entity.ts';\nimport { pgPolicy, PgRole, pgRole } from '~/pg-core/index.ts';\nimport type { AnyPgColumn, PgPolicyToOption } from '~/pg-core/index.ts';\nimport { type SQL, sql } from '~/sql/sql.ts';\n\nexport const crudPolicy = (\n\toptions: {\n\t\trole: PgPolicyToOption;\n\t\tread?: SQL | boolean;\n\t\tmodify?: SQL | boolean;\n\t},\n) => {\n\tconst read: SQL = options.read === true\n\t\t? sql`select true`\n\t\t: options.read === false || options.read === undefined\n\t\t? sql`select false`\n\t\t: options.read;\n\n\tconst modify: SQL = options.modify === true\n\t\t? sql`select true`\n\t\t: options.modify === false || options.modify === undefined\n\t\t? sql`select false`\n\t\t: options.modify;\n\n\tlet rolesName = '';\n\tif (Array.isArray(options.role)) {\n\t\trolesName = options.role.map((it) => {\n\t\t\treturn is(it, PgRole) ? it.name : it as string;\n\t\t}).join('-');\n\t} else {\n\t\trolesName = is(options.role, PgRole) ? options.role.name : options.role as string;\n\t}\n\n\t// Return the modify policy, followed by the read policy.\n\treturn {\n\t\t// Important to have \"_drizzle_internal\" prefix for any key here. Right after we will make\n\t\t// 3rd param in table as an array - we will move it to array and use ... operator\n\n\t\t// We can't use table name here, because in examples you can specify several crudPolicies on one table\n\t\t// So we need some other way to have a unique name\n\t\t[`_drizzle_internal-${rolesName}-crud-policy-insert`]: pgPolicy(`crud-${rolesName}-policy-insert`, {\n\t\t\tfor: 'insert',\n\t\t\tto: options.role,\n\t\t\tusing: modify,\n\t\t\twithCheck: modify,\n\t\t}),\n\t\t[`_drizzle_internal-${rolesName}-crud-policy-update`]: pgPolicy(`crud-${rolesName}-policy-update`, {\n\t\t\tfor: 'update',\n\t\t\tto: options.role,\n\t\t\tusing: modify,\n\t\t\twithCheck: modify,\n\t\t}),\n\t\t[`_drizzle_internal-${rolesName}-crud-policy-delete`]: pgPolicy(`crud-${rolesName}-policy-delete`, {\n\t\t\tfor: 'delete',\n\t\t\tto: options.role,\n\t\t\tusing: modify,\n\t\t\twithCheck: modify,\n\t\t}),\n\t\t[`_drizzle_internal-${rolesName}-crud-policy-select`]: pgPolicy(`crud-${rolesName}-policy-select`, {\n\t\t\tfor: 'select',\n\t\t\tto: options.role,\n\t\t\tusing: read,\n\t\t}),\n\t};\n};\n\n// These are default roles that Neon will set up.\nexport const authenticatedRole = pgRole('authenticated').existing();\nexport const anonymousRole = pgRole('anonymous').existing();\n\nexport const authUid = (userIdColumn: AnyPgColumn) => sql`select auth.user_id() = ${userIdColumn}`;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAAmB;AACnB,qBAAyC;AAEzC,iBAA8B;AAEvB,MAAM,aAAa,CACzB,YAKI;AACJ,QAAM,OAAY,QAAQ,SAAS,OAChC,8BACA,QAAQ,SAAS,SAAS,QAAQ,SAAS,SAC3C,+BACA,QAAQ;AAEX,QAAM,SAAc,QAAQ,WAAW,OACpC,8BACA,QAAQ,WAAW,SAAS,QAAQ,WAAW,SAC/C,+BACA,QAAQ;AAEX,MAAI,YAAY;AAChB,MAAI,MAAM,QAAQ,QAAQ,IAAI,GAAG;AAChC,gBAAY,QAAQ,KAAK,IAAI,CAAC,OAAO;AACpC,iBAAO,kBAAG,IAAI,qBAAM,IAAI,GAAG,OAAO;AAAA,IACnC,CAAC,EAAE,KAAK,GAAG;AAAA,EACZ,OAAO;AACN,oBAAY,kBAAG,QAAQ,MAAM,qBAAM,IAAI,QAAQ,KAAK,OAAO,QAAQ;AAAA,EACpE;AAGA,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAMN,CAAC,qBAAqB,SAAS,qBAAqB,OAAG,yBAAS,QAAQ,SAAS,kBAAkB;AAAA,MAClG,KAAK;AAAA,MACL,IAAI,QAAQ;AAAA,MACZ,OAAO;AAAA,MACP,WAAW;AAAA,IACZ,CAAC;AAAA,IACD,CAAC,qBAAqB,SAAS,qBAAqB,OAAG,yBAAS,QAAQ,SAAS,kBAAkB;AAAA,MAClG,KAAK;AAAA,MACL,IAAI,QAAQ;AAAA,MACZ,OAAO;AAAA,MACP,WAAW;AAAA,IACZ,CAAC;AAAA,IACD,CAAC,qBAAqB,SAAS,qBAAqB,OAAG,yBAAS,QAAQ,SAAS,kBAAkB;AAAA,MAClG,KAAK;AAAA,MACL,IAAI,QAAQ;AAAA,MACZ,OAAO;AAAA,MACP,WAAW;AAAA,IACZ,CAAC;AAAA,IACD,CAAC,qBAAqB,SAAS,qBAAqB,OAAG,yBAAS,QAAQ,SAAS,kBAAkB;AAAA,MAClG,KAAK;AAAA,MACL,IAAI,QAAQ;AAAA,MACZ,OAAO;AAAA,IACR,CAAC;AAAA,EACF;AACD;AAGO,MAAM,wBAAoB,uBAAO,eAAe,EAAE,SAAS;AAC3D,MAAM,oBAAgB,uBAAO,WAAW,EAAE,SAAS;AAEnD,MAAM,UAAU,CAAC,iBAA8B,yCAA8B,YAAY;","names":[]}
|
package/neon/rls.d.cts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { PgRole } from "../pg-core/index.cjs";
|
|
2
|
-
import type { AnyPgColumn, PgPolicyToOption } from "../pg-core/index.cjs";
|
|
3
|
-
import { type SQL } from "../sql/sql.cjs";
|
|
4
|
-
export declare const crudPolicy: (options: {
|
|
5
|
-
role: PgPolicyToOption;
|
|
6
|
-
read?: SQL | boolean;
|
|
7
|
-
modify?: SQL | boolean;
|
|
8
|
-
}) => {
|
|
9
|
-
[x: string]: import("../pg-core/index.ts").PgPolicy;
|
|
10
|
-
};
|
|
11
|
-
export declare const authenticatedRole: PgRole;
|
|
12
|
-
export declare const anonymousRole: PgRole;
|
|
13
|
-
export declare const authUid: (userIdColumn: AnyPgColumn) => SQL<unknown>;
|
package/neon/rls.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { PgRole } from "../pg-core/index.js";
|
|
2
|
-
import type { AnyPgColumn, PgPolicyToOption } from "../pg-core/index.js";
|
|
3
|
-
import { type SQL } from "../sql/sql.js";
|
|
4
|
-
export declare const crudPolicy: (options: {
|
|
5
|
-
role: PgPolicyToOption;
|
|
6
|
-
read?: SQL | boolean;
|
|
7
|
-
modify?: SQL | boolean;
|
|
8
|
-
}) => {
|
|
9
|
-
[x: string]: import("../pg-core/index.js").PgPolicy;
|
|
10
|
-
};
|
|
11
|
-
export declare const authenticatedRole: PgRole;
|
|
12
|
-
export declare const anonymousRole: PgRole;
|
|
13
|
-
export declare const authUid: (userIdColumn: AnyPgColumn) => SQL<unknown>;
|
package/neon/rls.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import { is } from "../entity.js";
|
|
2
|
-
import { pgPolicy, PgRole, pgRole } from "../pg-core/index.js";
|
|
3
|
-
import { sql } from "../sql/sql.js";
|
|
4
|
-
const crudPolicy = (options) => {
|
|
5
|
-
const read = options.read === true ? sql`select true` : options.read === false || options.read === void 0 ? sql`select false` : options.read;
|
|
6
|
-
const modify = options.modify === true ? sql`select true` : options.modify === false || options.modify === void 0 ? sql`select false` : options.modify;
|
|
7
|
-
let rolesName = "";
|
|
8
|
-
if (Array.isArray(options.role)) {
|
|
9
|
-
rolesName = options.role.map((it) => {
|
|
10
|
-
return is(it, PgRole) ? it.name : it;
|
|
11
|
-
}).join("-");
|
|
12
|
-
} else {
|
|
13
|
-
rolesName = is(options.role, PgRole) ? options.role.name : options.role;
|
|
14
|
-
}
|
|
15
|
-
return {
|
|
16
|
-
// Important to have "_drizzle_internal" prefix for any key here. Right after we will make
|
|
17
|
-
// 3rd param in table as an array - we will move it to array and use ... operator
|
|
18
|
-
// We can't use table name here, because in examples you can specify several crudPolicies on one table
|
|
19
|
-
// So we need some other way to have a unique name
|
|
20
|
-
[`_drizzle_internal-${rolesName}-crud-policy-insert`]: pgPolicy(`crud-${rolesName}-policy-insert`, {
|
|
21
|
-
for: "insert",
|
|
22
|
-
to: options.role,
|
|
23
|
-
using: modify,
|
|
24
|
-
withCheck: modify
|
|
25
|
-
}),
|
|
26
|
-
[`_drizzle_internal-${rolesName}-crud-policy-update`]: pgPolicy(`crud-${rolesName}-policy-update`, {
|
|
27
|
-
for: "update",
|
|
28
|
-
to: options.role,
|
|
29
|
-
using: modify,
|
|
30
|
-
withCheck: modify
|
|
31
|
-
}),
|
|
32
|
-
[`_drizzle_internal-${rolesName}-crud-policy-delete`]: pgPolicy(`crud-${rolesName}-policy-delete`, {
|
|
33
|
-
for: "delete",
|
|
34
|
-
to: options.role,
|
|
35
|
-
using: modify,
|
|
36
|
-
withCheck: modify
|
|
37
|
-
}),
|
|
38
|
-
[`_drizzle_internal-${rolesName}-crud-policy-select`]: pgPolicy(`crud-${rolesName}-policy-select`, {
|
|
39
|
-
for: "select",
|
|
40
|
-
to: options.role,
|
|
41
|
-
using: read
|
|
42
|
-
})
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
const authenticatedRole = pgRole("authenticated").existing();
|
|
46
|
-
const anonymousRole = pgRole("anonymous").existing();
|
|
47
|
-
const authUid = (userIdColumn) => sql`select auth.user_id() = ${userIdColumn}`;
|
|
48
|
-
export {
|
|
49
|
-
anonymousRole,
|
|
50
|
-
authUid,
|
|
51
|
-
authenticatedRole,
|
|
52
|
-
crudPolicy
|
|
53
|
-
};
|
|
54
|
-
//# sourceMappingURL=rls.js.map
|
package/neon/rls.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/neon/rls.ts"],"sourcesContent":["import { is } from '~/entity.ts';\nimport { pgPolicy, PgRole, pgRole } from '~/pg-core/index.ts';\nimport type { AnyPgColumn, PgPolicyToOption } from '~/pg-core/index.ts';\nimport { type SQL, sql } from '~/sql/sql.ts';\n\nexport const crudPolicy = (\n\toptions: {\n\t\trole: PgPolicyToOption;\n\t\tread?: SQL | boolean;\n\t\tmodify?: SQL | boolean;\n\t},\n) => {\n\tconst read: SQL = options.read === true\n\t\t? sql`select true`\n\t\t: options.read === false || options.read === undefined\n\t\t? sql`select false`\n\t\t: options.read;\n\n\tconst modify: SQL = options.modify === true\n\t\t? sql`select true`\n\t\t: options.modify === false || options.modify === undefined\n\t\t? sql`select false`\n\t\t: options.modify;\n\n\tlet rolesName = '';\n\tif (Array.isArray(options.role)) {\n\t\trolesName = options.role.map((it) => {\n\t\t\treturn is(it, PgRole) ? it.name : it as string;\n\t\t}).join('-');\n\t} else {\n\t\trolesName = is(options.role, PgRole) ? options.role.name : options.role as string;\n\t}\n\n\t// Return the modify policy, followed by the read policy.\n\treturn {\n\t\t// Important to have \"_drizzle_internal\" prefix for any key here. Right after we will make\n\t\t// 3rd param in table as an array - we will move it to array and use ... operator\n\n\t\t// We can't use table name here, because in examples you can specify several crudPolicies on one table\n\t\t// So we need some other way to have a unique name\n\t\t[`_drizzle_internal-${rolesName}-crud-policy-insert`]: pgPolicy(`crud-${rolesName}-policy-insert`, {\n\t\t\tfor: 'insert',\n\t\t\tto: options.role,\n\t\t\tusing: modify,\n\t\t\twithCheck: modify,\n\t\t}),\n\t\t[`_drizzle_internal-${rolesName}-crud-policy-update`]: pgPolicy(`crud-${rolesName}-policy-update`, {\n\t\t\tfor: 'update',\n\t\t\tto: options.role,\n\t\t\tusing: modify,\n\t\t\twithCheck: modify,\n\t\t}),\n\t\t[`_drizzle_internal-${rolesName}-crud-policy-delete`]: pgPolicy(`crud-${rolesName}-policy-delete`, {\n\t\t\tfor: 'delete',\n\t\t\tto: options.role,\n\t\t\tusing: modify,\n\t\t\twithCheck: modify,\n\t\t}),\n\t\t[`_drizzle_internal-${rolesName}-crud-policy-select`]: pgPolicy(`crud-${rolesName}-policy-select`, {\n\t\t\tfor: 'select',\n\t\t\tto: options.role,\n\t\t\tusing: read,\n\t\t}),\n\t};\n};\n\n// These are default roles that Neon will set up.\nexport const authenticatedRole = pgRole('authenticated').existing();\nexport const anonymousRole = pgRole('anonymous').existing();\n\nexport const authUid = (userIdColumn: AnyPgColumn) => sql`select auth.user_id() = ${userIdColumn}`;\n"],"mappings":"AAAA,SAAS,UAAU;AACnB,SAAS,UAAU,QAAQ,cAAc;AAEzC,SAAmB,WAAW;AAEvB,MAAM,aAAa,CACzB,YAKI;AACJ,QAAM,OAAY,QAAQ,SAAS,OAChC,mBACA,QAAQ,SAAS,SAAS,QAAQ,SAAS,SAC3C,oBACA,QAAQ;AAEX,QAAM,SAAc,QAAQ,WAAW,OACpC,mBACA,QAAQ,WAAW,SAAS,QAAQ,WAAW,SAC/C,oBACA,QAAQ;AAEX,MAAI,YAAY;AAChB,MAAI,MAAM,QAAQ,QAAQ,IAAI,GAAG;AAChC,gBAAY,QAAQ,KAAK,IAAI,CAAC,OAAO;AACpC,aAAO,GAAG,IAAI,MAAM,IAAI,GAAG,OAAO;AAAA,IACnC,CAAC,EAAE,KAAK,GAAG;AAAA,EACZ,OAAO;AACN,gBAAY,GAAG,QAAQ,MAAM,MAAM,IAAI,QAAQ,KAAK,OAAO,QAAQ;AAAA,EACpE;AAGA,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA,IAMN,CAAC,qBAAqB,SAAS,qBAAqB,GAAG,SAAS,QAAQ,SAAS,kBAAkB;AAAA,MAClG,KAAK;AAAA,MACL,IAAI,QAAQ;AAAA,MACZ,OAAO;AAAA,MACP,WAAW;AAAA,IACZ,CAAC;AAAA,IACD,CAAC,qBAAqB,SAAS,qBAAqB,GAAG,SAAS,QAAQ,SAAS,kBAAkB;AAAA,MAClG,KAAK;AAAA,MACL,IAAI,QAAQ;AAAA,MACZ,OAAO;AAAA,MACP,WAAW;AAAA,IACZ,CAAC;AAAA,IACD,CAAC,qBAAqB,SAAS,qBAAqB,GAAG,SAAS,QAAQ,SAAS,kBAAkB;AAAA,MAClG,KAAK;AAAA,MACL,IAAI,QAAQ;AAAA,MACZ,OAAO;AAAA,MACP,WAAW;AAAA,IACZ,CAAC;AAAA,IACD,CAAC,qBAAqB,SAAS,qBAAqB,GAAG,SAAS,QAAQ,SAAS,kBAAkB;AAAA,MAClG,KAAK;AAAA,MACL,IAAI,QAAQ;AAAA,MACZ,OAAO;AAAA,IACR,CAAC;AAAA,EACF;AACD;AAGO,MAAM,oBAAoB,OAAO,eAAe,EAAE,SAAS;AAC3D,MAAM,gBAAgB,OAAO,WAAW,EAAE,SAAS;AAEnD,MAAM,UAAU,CAAC,iBAA8B,8BAA8B,YAAY;","names":[]}
|
package/pg-core/policies.cjs
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
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 policies_exports = {};
|
|
20
|
-
__export(policies_exports, {
|
|
21
|
-
PgPolicy: () => PgPolicy,
|
|
22
|
-
pgPolicy: () => pgPolicy
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(policies_exports);
|
|
25
|
-
var import_entity = require("../entity.cjs");
|
|
26
|
-
class PgPolicy {
|
|
27
|
-
constructor(name, config) {
|
|
28
|
-
this.name = name;
|
|
29
|
-
if (config) {
|
|
30
|
-
this.as = config.as;
|
|
31
|
-
this.for = config.for;
|
|
32
|
-
this.to = config.to;
|
|
33
|
-
this.using = config.using;
|
|
34
|
-
this.withCheck = config.withCheck;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
static [import_entity.entityKind] = "PgPolicy";
|
|
38
|
-
as;
|
|
39
|
-
for;
|
|
40
|
-
to;
|
|
41
|
-
using;
|
|
42
|
-
withCheck;
|
|
43
|
-
}
|
|
44
|
-
function pgPolicy(name, config) {
|
|
45
|
-
return new PgPolicy(name, config);
|
|
46
|
-
}
|
|
47
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
48
|
-
0 && (module.exports = {
|
|
49
|
-
PgPolicy,
|
|
50
|
-
pgPolicy
|
|
51
|
-
});
|
|
52
|
-
//# sourceMappingURL=policies.cjs.map
|
package/pg-core/policies.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pg-core/policies.ts"],"sourcesContent":["import { entityKind } from '~/entity.ts';\nimport type { SQL } from '~/sql/sql.ts';\nimport type { PgRole } from './roles.ts';\n\nexport type PgPolicyToOption =\n\t| 'public'\n\t| 'current_role'\n\t| 'current_user'\n\t| 'session_user'\n\t| (string & {})\n\t| PgPolicyToOption[]\n\t| PgRole;\n\nexport interface PgPolicyConfig {\n\tas?: 'permissive' | 'restrictive';\n\tfor?: 'all' | 'select' | 'insert' | 'update' | 'delete';\n\tto?: PgPolicyToOption;\n\tusing?: SQL;\n\twithCheck?: SQL;\n}\n\nexport class PgPolicy implements PgPolicyConfig {\n\tstatic readonly [entityKind]: string = 'PgPolicy';\n\n\treadonly as: PgPolicyConfig['as'];\n\treadonly for: PgPolicyConfig['for'];\n\treadonly to: PgPolicyConfig['to'];\n\treadonly using: PgPolicyConfig['using'];\n\treadonly withCheck: PgPolicyConfig['withCheck'];\n\n\tconstructor(\n\t\treadonly name: string,\n\t\tconfig?: PgPolicyConfig,\n\t) {\n\t\tif (config) {\n\t\t\tthis.as = config.as;\n\t\t\tthis.for = config.for;\n\t\t\tthis.to = config.to;\n\t\t\tthis.using = config.using;\n\t\t\tthis.withCheck = config.withCheck;\n\t\t}\n\t}\n}\n\nexport function pgPolicy(name: string, config?: PgPolicyConfig) {\n\treturn new PgPolicy(name, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA2B;AAqBpB,MAAM,SAAmC;AAAA,EAS/C,YACU,MACT,QACC;AAFQ;AAGT,QAAI,QAAQ;AACX,WAAK,KAAK,OAAO;AACjB,WAAK,MAAM,OAAO;AAClB,WAAK,KAAK,OAAO;AACjB,WAAK,QAAQ,OAAO;AACpB,WAAK,YAAY,OAAO;AAAA,IACzB;AAAA,EACD;AAAA,EAnBA,QAAiB,wBAAU,IAAY;AAAA,EAE9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAcV;AAEO,SAAS,SAAS,MAAc,QAAyB;AAC/D,SAAO,IAAI,SAAS,MAAM,MAAM;AACjC;","names":[]}
|
package/pg-core/policies.d.cts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { entityKind } from "../entity.cjs";
|
|
2
|
-
import type { SQL } from "../sql/sql.cjs";
|
|
3
|
-
import type { PgRole } from "./roles.cjs";
|
|
4
|
-
export type PgPolicyToOption = 'public' | 'current_role' | 'current_user' | 'session_user' | (string & {}) | PgPolicyToOption[] | PgRole;
|
|
5
|
-
export interface PgPolicyConfig {
|
|
6
|
-
as?: 'permissive' | 'restrictive';
|
|
7
|
-
for?: 'all' | 'select' | 'insert' | 'update' | 'delete';
|
|
8
|
-
to?: PgPolicyToOption;
|
|
9
|
-
using?: SQL;
|
|
10
|
-
withCheck?: SQL;
|
|
11
|
-
}
|
|
12
|
-
export declare class PgPolicy implements PgPolicyConfig {
|
|
13
|
-
readonly name: string;
|
|
14
|
-
static readonly [entityKind]: string;
|
|
15
|
-
readonly as: PgPolicyConfig['as'];
|
|
16
|
-
readonly for: PgPolicyConfig['for'];
|
|
17
|
-
readonly to: PgPolicyConfig['to'];
|
|
18
|
-
readonly using: PgPolicyConfig['using'];
|
|
19
|
-
readonly withCheck: PgPolicyConfig['withCheck'];
|
|
20
|
-
constructor(name: string, config?: PgPolicyConfig);
|
|
21
|
-
}
|
|
22
|
-
export declare function pgPolicy(name: string, config?: PgPolicyConfig): PgPolicy;
|
package/pg-core/policies.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { entityKind } from "../entity.js";
|
|
2
|
-
import type { SQL } from "../sql/sql.js";
|
|
3
|
-
import type { PgRole } from "./roles.js";
|
|
4
|
-
export type PgPolicyToOption = 'public' | 'current_role' | 'current_user' | 'session_user' | (string & {}) | PgPolicyToOption[] | PgRole;
|
|
5
|
-
export interface PgPolicyConfig {
|
|
6
|
-
as?: 'permissive' | 'restrictive';
|
|
7
|
-
for?: 'all' | 'select' | 'insert' | 'update' | 'delete';
|
|
8
|
-
to?: PgPolicyToOption;
|
|
9
|
-
using?: SQL;
|
|
10
|
-
withCheck?: SQL;
|
|
11
|
-
}
|
|
12
|
-
export declare class PgPolicy implements PgPolicyConfig {
|
|
13
|
-
readonly name: string;
|
|
14
|
-
static readonly [entityKind]: string;
|
|
15
|
-
readonly as: PgPolicyConfig['as'];
|
|
16
|
-
readonly for: PgPolicyConfig['for'];
|
|
17
|
-
readonly to: PgPolicyConfig['to'];
|
|
18
|
-
readonly using: PgPolicyConfig['using'];
|
|
19
|
-
readonly withCheck: PgPolicyConfig['withCheck'];
|
|
20
|
-
constructor(name: string, config?: PgPolicyConfig);
|
|
21
|
-
}
|
|
22
|
-
export declare function pgPolicy(name: string, config?: PgPolicyConfig): PgPolicy;
|
package/pg-core/policies.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { entityKind } from "../entity.js";
|
|
2
|
-
class PgPolicy {
|
|
3
|
-
constructor(name, config) {
|
|
4
|
-
this.name = name;
|
|
5
|
-
if (config) {
|
|
6
|
-
this.as = config.as;
|
|
7
|
-
this.for = config.for;
|
|
8
|
-
this.to = config.to;
|
|
9
|
-
this.using = config.using;
|
|
10
|
-
this.withCheck = config.withCheck;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
static [entityKind] = "PgPolicy";
|
|
14
|
-
as;
|
|
15
|
-
for;
|
|
16
|
-
to;
|
|
17
|
-
using;
|
|
18
|
-
withCheck;
|
|
19
|
-
}
|
|
20
|
-
function pgPolicy(name, config) {
|
|
21
|
-
return new PgPolicy(name, config);
|
|
22
|
-
}
|
|
23
|
-
export {
|
|
24
|
-
PgPolicy,
|
|
25
|
-
pgPolicy
|
|
26
|
-
};
|
|
27
|
-
//# sourceMappingURL=policies.js.map
|
package/pg-core/policies.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pg-core/policies.ts"],"sourcesContent":["import { entityKind } from '~/entity.ts';\nimport type { SQL } from '~/sql/sql.ts';\nimport type { PgRole } from './roles.ts';\n\nexport type PgPolicyToOption =\n\t| 'public'\n\t| 'current_role'\n\t| 'current_user'\n\t| 'session_user'\n\t| (string & {})\n\t| PgPolicyToOption[]\n\t| PgRole;\n\nexport interface PgPolicyConfig {\n\tas?: 'permissive' | 'restrictive';\n\tfor?: 'all' | 'select' | 'insert' | 'update' | 'delete';\n\tto?: PgPolicyToOption;\n\tusing?: SQL;\n\twithCheck?: SQL;\n}\n\nexport class PgPolicy implements PgPolicyConfig {\n\tstatic readonly [entityKind]: string = 'PgPolicy';\n\n\treadonly as: PgPolicyConfig['as'];\n\treadonly for: PgPolicyConfig['for'];\n\treadonly to: PgPolicyConfig['to'];\n\treadonly using: PgPolicyConfig['using'];\n\treadonly withCheck: PgPolicyConfig['withCheck'];\n\n\tconstructor(\n\t\treadonly name: string,\n\t\tconfig?: PgPolicyConfig,\n\t) {\n\t\tif (config) {\n\t\t\tthis.as = config.as;\n\t\t\tthis.for = config.for;\n\t\t\tthis.to = config.to;\n\t\t\tthis.using = config.using;\n\t\t\tthis.withCheck = config.withCheck;\n\t\t}\n\t}\n}\n\nexport function pgPolicy(name: string, config?: PgPolicyConfig) {\n\treturn new PgPolicy(name, config);\n}\n"],"mappings":"AAAA,SAAS,kBAAkB;AAqBpB,MAAM,SAAmC;AAAA,EAS/C,YACU,MACT,QACC;AAFQ;AAGT,QAAI,QAAQ;AACX,WAAK,KAAK,OAAO;AACjB,WAAK,MAAM,OAAO;AAClB,WAAK,KAAK,OAAO;AACjB,WAAK,QAAQ,OAAO;AACpB,WAAK,YAAY,OAAO;AAAA,IACzB;AAAA,EACD;AAAA,EAnBA,QAAiB,UAAU,IAAY;AAAA,EAE9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAcV;AAEO,SAAS,SAAS,MAAc,QAAyB;AAC/D,SAAO,IAAI,SAAS,MAAM,MAAM;AACjC;","names":[]}
|
package/pg-core/roles.cjs
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
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 roles_exports = {};
|
|
20
|
-
__export(roles_exports, {
|
|
21
|
-
PgRole: () => PgRole,
|
|
22
|
-
pgRole: () => pgRole
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(roles_exports);
|
|
25
|
-
var import_entity = require("../entity.cjs");
|
|
26
|
-
class PgRole {
|
|
27
|
-
constructor(name, config) {
|
|
28
|
-
this.name = name;
|
|
29
|
-
if (config) {
|
|
30
|
-
this.createDb = config.createDb;
|
|
31
|
-
this.createRole = config.createRole;
|
|
32
|
-
this.inherit = config.inherit;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
static [import_entity.entityKind] = "PgRole";
|
|
36
|
-
/** @internal */
|
|
37
|
-
_existing;
|
|
38
|
-
/** @internal */
|
|
39
|
-
createDb;
|
|
40
|
-
/** @internal */
|
|
41
|
-
createRole;
|
|
42
|
-
/** @internal */
|
|
43
|
-
inherit;
|
|
44
|
-
existing() {
|
|
45
|
-
this._existing = true;
|
|
46
|
-
return this;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
function pgRole(name, config) {
|
|
50
|
-
return new PgRole(name, config);
|
|
51
|
-
}
|
|
52
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
53
|
-
0 && (module.exports = {
|
|
54
|
-
PgRole,
|
|
55
|
-
pgRole
|
|
56
|
-
});
|
|
57
|
-
//# sourceMappingURL=roles.cjs.map
|
package/pg-core/roles.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pg-core/roles.ts"],"sourcesContent":["import { entityKind } from '~/entity.ts';\n\nexport interface PgRoleConfig {\n\tcreateDb?: boolean;\n\tcreateRole?: boolean;\n\tinherit?: boolean;\n}\n\nexport class PgRole implements PgRoleConfig {\n\tstatic readonly [entityKind]: string = 'PgRole';\n\n\t/** @internal */\n\t_existing?: boolean;\n\n\t/** @internal */\n\treadonly createDb: PgRoleConfig['createDb'];\n\t/** @internal */\n\treadonly createRole: PgRoleConfig['createRole'];\n\t/** @internal */\n\treadonly inherit: PgRoleConfig['inherit'];\n\n\tconstructor(\n\t\treadonly name: string,\n\t\tconfig?: PgRoleConfig,\n\t) {\n\t\tif (config) {\n\t\t\tthis.createDb = config.createDb;\n\t\t\tthis.createRole = config.createRole;\n\t\t\tthis.inherit = config.inherit;\n\t\t}\n\t}\n\n\texisting(): this {\n\t\tthis._existing = true;\n\t\treturn this;\n\t}\n}\n\nexport function pgRole(name: string, config?: PgRoleConfig) {\n\treturn new PgRole(name, config);\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,oBAA2B;AAQpB,MAAM,OAA+B;AAAA,EAa3C,YACU,MACT,QACC;AAFQ;AAGT,QAAI,QAAQ;AACX,WAAK,WAAW,OAAO;AACvB,WAAK,aAAa,OAAO;AACzB,WAAK,UAAU,OAAO;AAAA,IACvB;AAAA,EACD;AAAA,EArBA,QAAiB,wBAAU,IAAY;AAAA;AAAA,EAGvC;AAAA;AAAA,EAGS;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAaT,WAAiB;AAChB,SAAK,YAAY;AACjB,WAAO;AAAA,EACR;AACD;AAEO,SAAS,OAAO,MAAc,QAAuB;AAC3D,SAAO,IAAI,OAAO,MAAM,MAAM;AAC/B;","names":[]}
|
package/pg-core/roles.d.cts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { entityKind } from "../entity.cjs";
|
|
2
|
-
export interface PgRoleConfig {
|
|
3
|
-
createDb?: boolean;
|
|
4
|
-
createRole?: boolean;
|
|
5
|
-
inherit?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare class PgRole implements PgRoleConfig {
|
|
8
|
-
readonly name: string;
|
|
9
|
-
static readonly [entityKind]: string;
|
|
10
|
-
constructor(name: string, config?: PgRoleConfig);
|
|
11
|
-
existing(): this;
|
|
12
|
-
}
|
|
13
|
-
export declare function pgRole(name: string, config?: PgRoleConfig): PgRole;
|
package/pg-core/roles.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { entityKind } from "../entity.js";
|
|
2
|
-
export interface PgRoleConfig {
|
|
3
|
-
createDb?: boolean;
|
|
4
|
-
createRole?: boolean;
|
|
5
|
-
inherit?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export declare class PgRole implements PgRoleConfig {
|
|
8
|
-
readonly name: string;
|
|
9
|
-
static readonly [entityKind]: string;
|
|
10
|
-
constructor(name: string, config?: PgRoleConfig);
|
|
11
|
-
existing(): this;
|
|
12
|
-
}
|
|
13
|
-
export declare function pgRole(name: string, config?: PgRoleConfig): PgRole;
|
package/pg-core/roles.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { entityKind } from "../entity.js";
|
|
2
|
-
class PgRole {
|
|
3
|
-
constructor(name, config) {
|
|
4
|
-
this.name = name;
|
|
5
|
-
if (config) {
|
|
6
|
-
this.createDb = config.createDb;
|
|
7
|
-
this.createRole = config.createRole;
|
|
8
|
-
this.inherit = config.inherit;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
static [entityKind] = "PgRole";
|
|
12
|
-
/** @internal */
|
|
13
|
-
_existing;
|
|
14
|
-
/** @internal */
|
|
15
|
-
createDb;
|
|
16
|
-
/** @internal */
|
|
17
|
-
createRole;
|
|
18
|
-
/** @internal */
|
|
19
|
-
inherit;
|
|
20
|
-
existing() {
|
|
21
|
-
this._existing = true;
|
|
22
|
-
return this;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
function pgRole(name, config) {
|
|
26
|
-
return new PgRole(name, config);
|
|
27
|
-
}
|
|
28
|
-
export {
|
|
29
|
-
PgRole,
|
|
30
|
-
pgRole
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=roles.js.map
|
package/pg-core/roles.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pg-core/roles.ts"],"sourcesContent":["import { entityKind } from '~/entity.ts';\n\nexport interface PgRoleConfig {\n\tcreateDb?: boolean;\n\tcreateRole?: boolean;\n\tinherit?: boolean;\n}\n\nexport class PgRole implements PgRoleConfig {\n\tstatic readonly [entityKind]: string = 'PgRole';\n\n\t/** @internal */\n\t_existing?: boolean;\n\n\t/** @internal */\n\treadonly createDb: PgRoleConfig['createDb'];\n\t/** @internal */\n\treadonly createRole: PgRoleConfig['createRole'];\n\t/** @internal */\n\treadonly inherit: PgRoleConfig['inherit'];\n\n\tconstructor(\n\t\treadonly name: string,\n\t\tconfig?: PgRoleConfig,\n\t) {\n\t\tif (config) {\n\t\t\tthis.createDb = config.createDb;\n\t\t\tthis.createRole = config.createRole;\n\t\t\tthis.inherit = config.inherit;\n\t\t}\n\t}\n\n\texisting(): this {\n\t\tthis._existing = true;\n\t\treturn this;\n\t}\n}\n\nexport function pgRole(name: string, config?: PgRoleConfig) {\n\treturn new PgRole(name, config);\n}\n"],"mappings":"AAAA,SAAS,kBAAkB;AAQpB,MAAM,OAA+B;AAAA,EAa3C,YACU,MACT,QACC;AAFQ;AAGT,QAAI,QAAQ;AACX,WAAK,WAAW,OAAO;AACvB,WAAK,aAAa,OAAO;AACzB,WAAK,UAAU,OAAO;AAAA,IACvB;AAAA,EACD;AAAA,EArBA,QAAiB,UAAU,IAAY;AAAA;AAAA,EAGvC;AAAA;AAAA,EAGS;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EAaT,WAAiB;AAChB,SAAK,YAAY;AACjB,WAAO;AAAA,EACR;AACD;AAEO,SAAS,OAAO,MAAc,QAAuB;AAC3D,SAAO,IAAI,OAAO,MAAM,MAAM;AAC/B;","names":[]}
|