@vrplatform/kysely 1.3.45-6054 → 1.3.45-6069
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/build/main/query/tenant/status.d.ts +4 -6
- package/build/main/query/tenant/status.js +13 -12
- package/build/main/query/tenant/status.js.map +1 -1
- package/build/module/query/tenant/status.d.ts +4 -6
- package/build/module/query/tenant/status.js +13 -12
- package/build/module/query/tenant/status.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DB, type ExpressionBuilder, type PublicTenant, type SqlBool } from '../../isomorphic';
|
|
2
2
|
type TenantExpressionBuilder = ExpressionBuilder<DB & {
|
|
3
3
|
tenant: PublicTenant;
|
|
4
4
|
}, 'tenant'>;
|
|
5
5
|
export declare function whereTenantActive(eb: TenantExpressionBuilder): import("kysely").ExpressionWrapper<DB & {
|
|
6
6
|
tenant: PublicTenant;
|
|
7
|
-
}, "tenant",
|
|
8
|
-
export declare function whereTenantNotTestTeam(
|
|
9
|
-
tenant: PublicTenant;
|
|
10
|
-
}, "tenant", import("kysely/dist/cjs/util/type-utils").SqlBool>;
|
|
7
|
+
}, "tenant", SqlBool>;
|
|
8
|
+
export declare function whereTenantNotTestTeam(testTeamId: string): import("kysely").RawBuilder<SqlBool>;
|
|
11
9
|
export declare function whereTenantShouldBePaid(eb: TenantExpressionBuilder, { includePartnerTeams, }?: {
|
|
12
10
|
includePartnerTeams?: boolean;
|
|
13
11
|
}): import("kysely").ExpressionWrapper<DB & {
|
|
14
12
|
tenant: PublicTenant;
|
|
15
|
-
}, "tenant",
|
|
13
|
+
}, "tenant", SqlBool>;
|
|
16
14
|
export {};
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.whereTenantActive = whereTenantActive;
|
|
4
4
|
exports.whereTenantNotTestTeam = whereTenantNotTestTeam;
|
|
5
5
|
exports.whereTenantShouldBePaid = whereTenantShouldBePaid;
|
|
6
|
+
const isomorphic_1 = require("../../isomorphic");
|
|
6
7
|
const billing_partner_1 = require("./billing-partner");
|
|
7
8
|
function whereTenantActive(eb) {
|
|
8
9
|
return eb.and([
|
|
@@ -14,18 +15,18 @@ function whereTenantActive(eb) {
|
|
|
14
15
|
.where('billingPartner.calculatedStatus', '=', 'active')),
|
|
15
16
|
]);
|
|
16
17
|
}
|
|
17
|
-
function whereTenantNotTestTeam(
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
18
|
+
function whereTenantNotTestTeam(testTeamId) {
|
|
19
|
+
return (0, isomorphic_1.sql) `(
|
|
20
|
+
${isomorphic_1.sql.ref('tenant.id')} != ${testTeamId}
|
|
21
|
+
and (
|
|
22
|
+
${isomorphic_1.sql.ref('tenant.partnerId')} is null
|
|
23
|
+
or ${isomorphic_1.sql.ref('tenant.partnerId')} != ${testTeamId}
|
|
24
|
+
)
|
|
25
|
+
and (
|
|
26
|
+
${isomorphic_1.sql.ref('tenant.billingPartnerId')} is null
|
|
27
|
+
or ${isomorphic_1.sql.ref('tenant.billingPartnerId')} != ${testTeamId}
|
|
28
|
+
)
|
|
29
|
+
)`;
|
|
29
30
|
}
|
|
30
31
|
function whereTenantShouldBePaid(eb, { includePartnerTeams = false, } = {}) {
|
|
31
32
|
return eb.and([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"src/","sources":["query/tenant/status.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"src/","sources":["query/tenant/status.ts"],"names":[],"mappings":";;AAcA,8CAkBC;AAED,wDAYC;AAED,0DAeC;AA/DD,iDAM0B;AAC1B,uDAAkE;AAOlE,SAAgB,iBAAiB,CAAC,EAA2B;IAC3D,OAAO,EAAE,C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n} from '../../isomorphic';\nimport { getCalculatedBillingPartnerId } from './billing-partner';\n\ntype TenantExpressionBuilder = ExpressionBuilder<\n DB & { tenant: PublicTenant },\n 'tenant'\n>;\n\nexport function whereTenantActive(eb: TenantExpressionBuilder) {\n return eb.and([\n eb('tenant.calculatedStatus', '=', 'active'),\n eb.exists(\n eb\n .selectFrom('public.tenant as billingPartner')\n .select('billingPartner.id')\n .where(\n 'billingPartner.id',\n '=',\n eb.fn.coalesce(\n 'tenant.calculatedBillingPartnerId',\n eb.val(getCalculatedBillingPartnerId({}))\n )\n )\n .where('billingPartner.calculatedStatus', '=', 'active')\n ),\n ]);\n}\n\nexport function whereTenantNotTestTeam(testTeamId: string) {\n return sql<SqlBool>`(\n ${sql.ref('tenant.id')} != ${testTeamId}\n and (\n ${sql.ref('tenant.partnerId')} is null\n or ${sql.ref('tenant.partnerId')} != ${testTeamId}\n )\n and (\n ${sql.ref('tenant.billingPartnerId')} is null\n or ${sql.ref('tenant.billingPartnerId')} != ${testTeamId}\n )\n )`;\n}\n\nexport function whereTenantShouldBePaid(\n eb: TenantExpressionBuilder,\n {\n includePartnerTeams = false,\n }: {\n includePartnerTeams?: boolean;\n } = {}\n) {\n return eb.and([\n whereTenantActive(eb),\n eb('tenant.isOnboarding', '=', false),\n ...(includePartnerTeams\n ? []\n : [eb('tenant.calculatedIsBillable', '=', true)]),\n ]);\n}\n"]}
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type DB, type ExpressionBuilder, type PublicTenant, type SqlBool } from '../../isomorphic';
|
|
2
2
|
type TenantExpressionBuilder = ExpressionBuilder<DB & {
|
|
3
3
|
tenant: PublicTenant;
|
|
4
4
|
}, 'tenant'>;
|
|
5
5
|
export declare function whereTenantActive(eb: TenantExpressionBuilder): import("kysely").ExpressionWrapper<DB & {
|
|
6
6
|
tenant: PublicTenant;
|
|
7
|
-
}, "tenant",
|
|
8
|
-
export declare function whereTenantNotTestTeam(
|
|
9
|
-
tenant: PublicTenant;
|
|
10
|
-
}, "tenant", import("kysely/dist/cjs/util/type-utils").SqlBool>;
|
|
7
|
+
}, "tenant", SqlBool>;
|
|
8
|
+
export declare function whereTenantNotTestTeam(testTeamId: string): import("kysely").RawBuilder<SqlBool>;
|
|
11
9
|
export declare function whereTenantShouldBePaid(eb: TenantExpressionBuilder, { includePartnerTeams, }?: {
|
|
12
10
|
includePartnerTeams?: boolean;
|
|
13
11
|
}): import("kysely").ExpressionWrapper<DB & {
|
|
14
12
|
tenant: PublicTenant;
|
|
15
|
-
}, "tenant",
|
|
13
|
+
}, "tenant", SqlBool>;
|
|
16
14
|
export {};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { sql, } from '../../isomorphic';
|
|
1
2
|
import { getCalculatedBillingPartnerId } from './billing-partner';
|
|
2
3
|
export function whereTenantActive(eb) {
|
|
3
4
|
return eb.and([
|
|
@@ -9,18 +10,18 @@ export function whereTenantActive(eb) {
|
|
|
9
10
|
.where('billingPartner.calculatedStatus', '=', 'active')),
|
|
10
11
|
]);
|
|
11
12
|
}
|
|
12
|
-
export function whereTenantNotTestTeam(
|
|
13
|
-
return
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
13
|
+
export function whereTenantNotTestTeam(testTeamId) {
|
|
14
|
+
return sql `(
|
|
15
|
+
${sql.ref('tenant.id')} != ${testTeamId}
|
|
16
|
+
and (
|
|
17
|
+
${sql.ref('tenant.partnerId')} is null
|
|
18
|
+
or ${sql.ref('tenant.partnerId')} != ${testTeamId}
|
|
19
|
+
)
|
|
20
|
+
and (
|
|
21
|
+
${sql.ref('tenant.billingPartnerId')} is null
|
|
22
|
+
or ${sql.ref('tenant.billingPartnerId')} != ${testTeamId}
|
|
23
|
+
)
|
|
24
|
+
)`;
|
|
24
25
|
}
|
|
25
26
|
export function whereTenantShouldBePaid(eb, { includePartnerTeams = false, } = {}) {
|
|
26
27
|
return eb.and([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"src/","sources":["query/tenant/status.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"src/","sources":["query/tenant/status.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,GAAG,GAKJ,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAOlE,MAAM,UAAU,iBAAiB,CAAC,EAA2B;IAC3D,OAAO,EAAE,CAAC,GAAG,CAAC;QACZ,EAAE,CAAC,yBAAyB,EAAE,GAAG,EAAE,QAAQ,CAAC;QAC5C,EAAE,CAAC,MAAM,CACP,EAAE;aACC,UAAU,CAAC,iCAAiC,CAAC;aAC7C,MAAM,CAAC,mBAAmB,CAAC;aAC3B,KAAK,CACJ,mBAAmB,EACnB,GAAG,EACH,EAAE,CAAC,EAAE,CAAC,QAAQ,CACZ,mCAAmC,EACnC,EAAE,CAAC,GAAG,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC,CAC1C,CACF;aACA,KAAK,CAAC,iCAAiC,EAAE,GAAG,EAAE,QAAQ,CAAC,CAC3D;KACF,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,UAAkB;IACvD,OAAO,GAAG,CAAS;MACf,GAAG,CAAC,GAAG,CAAC,WAAW,CAAC,OAAO,UAAU;;QAEnC,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC;WACxB,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC,OAAO,UAAU;;;QAG/C,GAAG,CAAC,GAAG,CAAC,yBAAyB,CAAC;WAC/B,GAAG,CAAC,GAAG,CAAC,yBAAyB,CAAC,OAAO,UAAU;;IAE1D,CAAC;AACL,CAAC;AAED,MAAM,UAAU,uBAAuB,CACrC,EAA2B,EAC3B,EACE,mBAAmB,GAAG,KAAK,MAGzB,EAAE;IAEN,OAAO,EAAE,CAAC,GAAG,CAAC;QACZ,iBAAiB,CAAC,EAAE,CAAC;QACrB,EAAE,CAAC,qBAAqB,EAAE,GAAG,EAAE,KAAK,CAAC;QACrC,GAAG,CAAC,mBAAmB;YACrB,CAAC,CAAC,EAAE;YACJ,CAAC,CAAC,CAAC,EAAE,CAAC,6BAA6B,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC,CAAC;KACpD,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {\n sql,\n type DB,\n type ExpressionBuilder,\n type PublicTenant,\n type SqlBool,\n} from '../../isomorphic';\nimport { getCalculatedBillingPartnerId } from './billing-partner';\n\ntype TenantExpressionBuilder = ExpressionBuilder<\n DB & { tenant: PublicTenant },\n 'tenant'\n>;\n\nexport function whereTenantActive(eb: TenantExpressionBuilder) {\n return eb.and([\n eb('tenant.calculatedStatus', '=', 'active'),\n eb.exists(\n eb\n .selectFrom('public.tenant as billingPartner')\n .select('billingPartner.id')\n .where(\n 'billingPartner.id',\n '=',\n eb.fn.coalesce(\n 'tenant.calculatedBillingPartnerId',\n eb.val(getCalculatedBillingPartnerId({}))\n )\n )\n .where('billingPartner.calculatedStatus', '=', 'active')\n ),\n ]);\n}\n\nexport function whereTenantNotTestTeam(testTeamId: string) {\n return sql<SqlBool>`(\n ${sql.ref('tenant.id')} != ${testTeamId}\n and (\n ${sql.ref('tenant.partnerId')} is null\n or ${sql.ref('tenant.partnerId')} != ${testTeamId}\n )\n and (\n ${sql.ref('tenant.billingPartnerId')} is null\n or ${sql.ref('tenant.billingPartnerId')} != ${testTeamId}\n )\n )`;\n}\n\nexport function whereTenantShouldBePaid(\n eb: TenantExpressionBuilder,\n {\n includePartnerTeams = false,\n }: {\n includePartnerTeams?: boolean;\n } = {}\n) {\n return eb.and([\n whereTenantActive(eb),\n eb('tenant.isOnboarding', '=', false),\n ...(includePartnerTeams\n ? []\n : [eb('tenant.calculatedIsBillable', '=', true)]),\n ]);\n}\n"]}
|