@happyvertical/smrt-commerce 0.33.1 → 0.34.1
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/dist/collections/ContractCollection.d.ts +9 -2
- package/dist/collections/ContractCollection.d.ts.map +1 -1
- package/dist/collections/ContractLineItemCollection.d.ts +9 -2
- package/dist/collections/ContractLineItemCollection.d.ts.map +1 -1
- package/dist/collections/CustomerCollection.d.ts +9 -2
- package/dist/collections/CustomerCollection.d.ts.map +1 -1
- package/dist/collections/FulfillmentCollection.d.ts +9 -2
- package/dist/collections/FulfillmentCollection.d.ts.map +1 -1
- package/dist/collections/FulfillmentLineItemCollection.d.ts +9 -2
- package/dist/collections/FulfillmentLineItemCollection.d.ts.map +1 -1
- package/dist/collections/InvoiceCollection.d.ts +9 -2
- package/dist/collections/InvoiceCollection.d.ts.map +1 -1
- package/dist/collections/InvoiceLineItemCollection.d.ts +9 -2
- package/dist/collections/InvoiceLineItemCollection.d.ts.map +1 -1
- package/dist/collections/PaymentAllocationCollection.d.ts +9 -2
- package/dist/collections/PaymentAllocationCollection.d.ts.map +1 -1
- package/dist/collections/PaymentCollection.d.ts +9 -2
- package/dist/collections/PaymentCollection.d.ts.map +1 -1
- package/dist/collections/PaymentIntentCollection.d.ts +13 -0
- package/dist/collections/PaymentIntentCollection.d.ts.map +1 -1
- package/dist/collections/PayoutCollection.d.ts +13 -0
- package/dist/collections/PayoutCollection.d.ts.map +1 -1
- package/dist/collections/VendorCollection.d.ts +9 -2
- package/dist/collections/VendorCollection.d.ts.map +1 -1
- package/dist/index.js +165 -73
- package/dist/index.js.map +1 -1
- package/dist/manifest.json +2 -2
- package/dist/smrt-knowledge.json +4 -4
- package/package.json +7 -7
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ObjectRegistry, crossPackageRef, field, smrt, SmrtObject, foreignKey, SmrtCollection } from "@happyvertical/smrt-core";
|
|
2
|
-
import { tenantId, TenantScoped } from "@happyvertical/smrt-tenancy";
|
|
2
|
+
import { tenantId, TenantScoped, queryGlobal, queryWithGlobals } from "@happyvertical/smrt-tenancy";
|
|
3
3
|
import { COMMERCE_MODULE_META, COMMERCE_UI_SLOTS } from "./ui.js";
|
|
4
4
|
ObjectRegistry.registerPackageManifest(
|
|
5
5
|
new URL("./manifest.json", import.meta.url)
|
|
@@ -1061,23 +1061,31 @@ class ContractCollection extends SmrtCollection {
|
|
|
1061
1061
|
return this.list({ where: { tenantId: tenantId2 } });
|
|
1062
1062
|
}
|
|
1063
1063
|
/**
|
|
1064
|
-
* Find all global contracts (not associated with any tenant)
|
|
1064
|
+
* Find all global contracts (not associated with any tenant).
|
|
1065
|
+
*
|
|
1066
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
1067
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
1068
|
+
* flagged as an isolation violation). (#1600)
|
|
1065
1069
|
*
|
|
1066
1070
|
* @returns Array of global contracts
|
|
1067
1071
|
*/
|
|
1068
1072
|
async findGlobal() {
|
|
1069
|
-
return this
|
|
1073
|
+
return queryGlobal(this);
|
|
1070
1074
|
}
|
|
1071
1075
|
/**
|
|
1072
|
-
* Find contracts for a tenant including global contracts
|
|
1076
|
+
* Find contracts for a tenant including global contracts.
|
|
1077
|
+
*
|
|
1078
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
1079
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
1073
1080
|
*
|
|
1074
1081
|
* @param tenantId - Tenant ID
|
|
1075
1082
|
* @returns Array of tenant-specific and global contracts
|
|
1076
1083
|
*/
|
|
1077
1084
|
async findWithGlobals(tenantId2) {
|
|
1078
|
-
return
|
|
1079
|
-
|
|
1080
|
-
|
|
1085
|
+
return queryWithGlobals(
|
|
1086
|
+
this,
|
|
1087
|
+
tenantId2,
|
|
1088
|
+
"Contract.findWithGlobals"
|
|
1081
1089
|
);
|
|
1082
1090
|
}
|
|
1083
1091
|
}
|
|
@@ -1229,23 +1237,31 @@ class ContractLineItemCollection extends SmrtCollection {
|
|
|
1229
1237
|
return this.list({ where: { tenantId: tenantId2 } });
|
|
1230
1238
|
}
|
|
1231
1239
|
/**
|
|
1232
|
-
* Find all global contract line items (not associated with any tenant)
|
|
1240
|
+
* Find all global contract line items (not associated with any tenant).
|
|
1241
|
+
*
|
|
1242
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
1243
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
1244
|
+
* flagged as an isolation violation). (#1600)
|
|
1233
1245
|
*
|
|
1234
1246
|
* @returns Array of global contract line items
|
|
1235
1247
|
*/
|
|
1236
1248
|
async findGlobal() {
|
|
1237
|
-
return this
|
|
1249
|
+
return queryGlobal(this);
|
|
1238
1250
|
}
|
|
1239
1251
|
/**
|
|
1240
|
-
* Find contract line items for a tenant including global line items
|
|
1252
|
+
* Find contract line items for a tenant including global line items.
|
|
1253
|
+
*
|
|
1254
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
1255
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
1241
1256
|
*
|
|
1242
1257
|
* @param tenantId - Tenant ID
|
|
1243
1258
|
* @returns Array of tenant-specific and global contract line items
|
|
1244
1259
|
*/
|
|
1245
1260
|
async findWithGlobals(tenantId2) {
|
|
1246
|
-
return
|
|
1247
|
-
|
|
1248
|
-
|
|
1261
|
+
return queryWithGlobals(
|
|
1262
|
+
this,
|
|
1263
|
+
tenantId2,
|
|
1264
|
+
"ContractLineItem.findWithGlobals"
|
|
1249
1265
|
);
|
|
1250
1266
|
}
|
|
1251
1267
|
}
|
|
@@ -1324,23 +1340,31 @@ class CustomerCollection extends SmrtCollection {
|
|
|
1324
1340
|
return this.list({ where: { tenantId: tenantId2 } });
|
|
1325
1341
|
}
|
|
1326
1342
|
/**
|
|
1327
|
-
* Find all global customers (not associated with any tenant)
|
|
1343
|
+
* Find all global customers (not associated with any tenant).
|
|
1344
|
+
*
|
|
1345
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
1346
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
1347
|
+
* flagged as an isolation violation). (#1600)
|
|
1328
1348
|
*
|
|
1329
1349
|
* @returns Array of global customers
|
|
1330
1350
|
*/
|
|
1331
1351
|
async findGlobal() {
|
|
1332
|
-
return this
|
|
1352
|
+
return queryGlobal(this);
|
|
1333
1353
|
}
|
|
1334
1354
|
/**
|
|
1335
|
-
* Find customers for a tenant including global customers
|
|
1355
|
+
* Find customers for a tenant including global customers.
|
|
1356
|
+
*
|
|
1357
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
1358
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
1336
1359
|
*
|
|
1337
1360
|
* @param tenantId - Tenant ID
|
|
1338
1361
|
* @returns Array of tenant-specific and global customers
|
|
1339
1362
|
*/
|
|
1340
1363
|
async findWithGlobals(tenantId2) {
|
|
1341
|
-
return
|
|
1342
|
-
|
|
1343
|
-
|
|
1364
|
+
return queryWithGlobals(
|
|
1365
|
+
this,
|
|
1366
|
+
tenantId2,
|
|
1367
|
+
"Customer.findWithGlobals"
|
|
1344
1368
|
);
|
|
1345
1369
|
}
|
|
1346
1370
|
}
|
|
@@ -1664,23 +1688,31 @@ class FulfillmentCollection extends SmrtCollection {
|
|
|
1664
1688
|
return this.list({ where: { tenantId: tenantId2 } });
|
|
1665
1689
|
}
|
|
1666
1690
|
/**
|
|
1667
|
-
* Find all global fulfillments (not associated with any tenant)
|
|
1691
|
+
* Find all global fulfillments (not associated with any tenant).
|
|
1692
|
+
*
|
|
1693
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
1694
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
1695
|
+
* flagged as an isolation violation). (#1600)
|
|
1668
1696
|
*
|
|
1669
1697
|
* @returns Array of global fulfillments
|
|
1670
1698
|
*/
|
|
1671
1699
|
async findGlobal() {
|
|
1672
|
-
return this
|
|
1700
|
+
return queryGlobal(this);
|
|
1673
1701
|
}
|
|
1674
1702
|
/**
|
|
1675
|
-
* Find fulfillments for a tenant including global fulfillments
|
|
1703
|
+
* Find fulfillments for a tenant including global fulfillments.
|
|
1704
|
+
*
|
|
1705
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
1706
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
1676
1707
|
*
|
|
1677
1708
|
* @param tenantId - Tenant ID
|
|
1678
1709
|
* @returns Array of tenant-specific and global fulfillments
|
|
1679
1710
|
*/
|
|
1680
1711
|
async findWithGlobals(tenantId2) {
|
|
1681
|
-
return
|
|
1682
|
-
|
|
1683
|
-
|
|
1712
|
+
return queryWithGlobals(
|
|
1713
|
+
this,
|
|
1714
|
+
tenantId2,
|
|
1715
|
+
"Fulfillment.findWithGlobals"
|
|
1684
1716
|
);
|
|
1685
1717
|
}
|
|
1686
1718
|
}
|
|
@@ -1864,23 +1896,31 @@ class FulfillmentLineItemCollection extends SmrtCollection {
|
|
|
1864
1896
|
return this.list({ where: { tenantId: tenantId2 } });
|
|
1865
1897
|
}
|
|
1866
1898
|
/**
|
|
1867
|
-
* Find all global fulfillment line items (not associated with any tenant)
|
|
1899
|
+
* Find all global fulfillment line items (not associated with any tenant).
|
|
1900
|
+
*
|
|
1901
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
1902
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
1903
|
+
* flagged as an isolation violation). (#1600)
|
|
1868
1904
|
*
|
|
1869
1905
|
* @returns Array of global fulfillment line items
|
|
1870
1906
|
*/
|
|
1871
1907
|
async findGlobal() {
|
|
1872
|
-
return this
|
|
1908
|
+
return queryGlobal(this);
|
|
1873
1909
|
}
|
|
1874
1910
|
/**
|
|
1875
|
-
* Find fulfillment line items for a tenant including global line items
|
|
1911
|
+
* Find fulfillment line items for a tenant including global line items.
|
|
1912
|
+
*
|
|
1913
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
1914
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
1876
1915
|
*
|
|
1877
1916
|
* @param tenantId - Tenant ID
|
|
1878
1917
|
* @returns Array of tenant-specific and global fulfillment line items
|
|
1879
1918
|
*/
|
|
1880
1919
|
async findWithGlobals(tenantId2) {
|
|
1881
|
-
return
|
|
1882
|
-
|
|
1883
|
-
|
|
1920
|
+
return queryWithGlobals(
|
|
1921
|
+
this,
|
|
1922
|
+
tenantId2,
|
|
1923
|
+
"FulfillmentLineItem.findWithGlobals"
|
|
1884
1924
|
);
|
|
1885
1925
|
}
|
|
1886
1926
|
}
|
|
@@ -2899,24 +2939,28 @@ class InvoiceCollection extends SmrtCollection {
|
|
|
2899
2939
|
return this.list({ where: { tenantId: tenantId2 } });
|
|
2900
2940
|
}
|
|
2901
2941
|
/**
|
|
2902
|
-
* Find all global invoices (not associated with any tenant)
|
|
2942
|
+
* Find all global invoices (not associated with any tenant).
|
|
2943
|
+
*
|
|
2944
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
2945
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
2946
|
+
* flagged as an isolation violation). (#1600)
|
|
2903
2947
|
*
|
|
2904
2948
|
* @returns Array of global invoices
|
|
2905
2949
|
*/
|
|
2906
2950
|
async findGlobal() {
|
|
2907
|
-
return this
|
|
2951
|
+
return queryGlobal(this);
|
|
2908
2952
|
}
|
|
2909
2953
|
/**
|
|
2910
|
-
* Find invoices for a tenant including global invoices
|
|
2954
|
+
* Find invoices for a tenant including global invoices.
|
|
2955
|
+
*
|
|
2956
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
2957
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
2911
2958
|
*
|
|
2912
2959
|
* @param tenantId - Tenant ID
|
|
2913
2960
|
* @returns Array of tenant-specific and global invoices
|
|
2914
2961
|
*/
|
|
2915
2962
|
async findWithGlobals(tenantId2) {
|
|
2916
|
-
return this.
|
|
2917
|
-
`SELECT * FROM ${this.tableName} WHERE tenant_id = ? OR tenant_id IS NULL`,
|
|
2918
|
-
[tenantId2]
|
|
2919
|
-
);
|
|
2963
|
+
return queryWithGlobals(this, tenantId2, "Invoice.findWithGlobals");
|
|
2920
2964
|
}
|
|
2921
2965
|
}
|
|
2922
2966
|
const InvoiceCollection$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -3201,23 +3245,31 @@ class InvoiceLineItemCollection extends SmrtCollection {
|
|
|
3201
3245
|
return this.list({ where: { tenantId: tenantId2 } });
|
|
3202
3246
|
}
|
|
3203
3247
|
/**
|
|
3204
|
-
* Find all global invoice line items (not associated with any tenant)
|
|
3248
|
+
* Find all global invoice line items (not associated with any tenant).
|
|
3249
|
+
*
|
|
3250
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
3251
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
3252
|
+
* flagged as an isolation violation). (#1600)
|
|
3205
3253
|
*
|
|
3206
3254
|
* @returns Array of global invoice line items
|
|
3207
3255
|
*/
|
|
3208
3256
|
async findGlobal() {
|
|
3209
|
-
return this
|
|
3257
|
+
return queryGlobal(this);
|
|
3210
3258
|
}
|
|
3211
3259
|
/**
|
|
3212
|
-
* Find invoice line items for a tenant including global line items
|
|
3260
|
+
* Find invoice line items for a tenant including global line items.
|
|
3261
|
+
*
|
|
3262
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
3263
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
3213
3264
|
*
|
|
3214
3265
|
* @param tenantId - Tenant ID
|
|
3215
3266
|
* @returns Array of tenant-specific and global invoice line items
|
|
3216
3267
|
*/
|
|
3217
3268
|
async findWithGlobals(tenantId2) {
|
|
3218
|
-
return
|
|
3219
|
-
|
|
3220
|
-
|
|
3269
|
+
return queryWithGlobals(
|
|
3270
|
+
this,
|
|
3271
|
+
tenantId2,
|
|
3272
|
+
"InvoiceLineItem.findWithGlobals"
|
|
3221
3273
|
);
|
|
3222
3274
|
}
|
|
3223
3275
|
}
|
|
@@ -3502,23 +3554,31 @@ class PaymentAllocationCollection extends SmrtCollection {
|
|
|
3502
3554
|
return this.list({ where: { tenantId: tenantId2 } });
|
|
3503
3555
|
}
|
|
3504
3556
|
/**
|
|
3505
|
-
* Find all global payment allocations (not associated with any tenant)
|
|
3557
|
+
* Find all global payment allocations (not associated with any tenant).
|
|
3558
|
+
*
|
|
3559
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
3560
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
3561
|
+
* flagged as an isolation violation). (#1600)
|
|
3506
3562
|
*
|
|
3507
3563
|
* @returns Array of global payment allocations
|
|
3508
3564
|
*/
|
|
3509
3565
|
async findGlobal() {
|
|
3510
|
-
return this
|
|
3566
|
+
return queryGlobal(this);
|
|
3511
3567
|
}
|
|
3512
3568
|
/**
|
|
3513
|
-
* Find payment allocations for a tenant including global allocations
|
|
3569
|
+
* Find payment allocations for a tenant including global allocations.
|
|
3570
|
+
*
|
|
3571
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
3572
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
3514
3573
|
*
|
|
3515
3574
|
* @param tenantId - Tenant ID
|
|
3516
3575
|
* @returns Array of tenant-specific and global payment allocations
|
|
3517
3576
|
*/
|
|
3518
3577
|
async findWithGlobals(tenantId2) {
|
|
3519
|
-
return
|
|
3520
|
-
|
|
3521
|
-
|
|
3578
|
+
return queryWithGlobals(
|
|
3579
|
+
this,
|
|
3580
|
+
tenantId2,
|
|
3581
|
+
"PaymentAllocation.findWithGlobals"
|
|
3522
3582
|
);
|
|
3523
3583
|
}
|
|
3524
3584
|
}
|
|
@@ -4163,24 +4223,28 @@ class PaymentCollection extends SmrtCollection {
|
|
|
4163
4223
|
return this.list({ where: { tenantId: tenantId2 } });
|
|
4164
4224
|
}
|
|
4165
4225
|
/**
|
|
4166
|
-
* Find all global payments (not associated with any tenant)
|
|
4226
|
+
* Find all global payments (not associated with any tenant).
|
|
4227
|
+
*
|
|
4228
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
4229
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
4230
|
+
* flagged as an isolation violation). (#1600)
|
|
4167
4231
|
*
|
|
4168
4232
|
* @returns Array of global payments
|
|
4169
4233
|
*/
|
|
4170
4234
|
async findGlobal() {
|
|
4171
|
-
return this
|
|
4235
|
+
return queryGlobal(this);
|
|
4172
4236
|
}
|
|
4173
4237
|
/**
|
|
4174
|
-
* Find payments for a tenant including global payments
|
|
4238
|
+
* Find payments for a tenant including global payments.
|
|
4239
|
+
*
|
|
4240
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
4241
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
4175
4242
|
*
|
|
4176
4243
|
* @param tenantId - Tenant ID
|
|
4177
4244
|
* @returns Array of tenant-specific and global payments
|
|
4178
4245
|
*/
|
|
4179
4246
|
async findWithGlobals(tenantId2) {
|
|
4180
|
-
return this.
|
|
4181
|
-
`SELECT * FROM ${this.tableName} WHERE tenant_id = ? OR tenant_id IS NULL`,
|
|
4182
|
-
[tenantId2]
|
|
4183
|
-
);
|
|
4247
|
+
return queryWithGlobals(this, tenantId2, "Payment.findWithGlobals");
|
|
4184
4248
|
}
|
|
4185
4249
|
}
|
|
4186
4250
|
const PaymentCollection$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
@@ -5036,13 +5100,27 @@ class PaymentIntentCollection extends SmrtCollection {
|
|
|
5036
5100
|
async findByTenant(tenantId2) {
|
|
5037
5101
|
return this.list({ where: { tenantId: tenantId2 } });
|
|
5038
5102
|
}
|
|
5103
|
+
/**
|
|
5104
|
+
* Find all global payment intents (not associated with any tenant).
|
|
5105
|
+
*
|
|
5106
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
5107
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
5108
|
+
* flagged as an isolation violation). (#1600)
|
|
5109
|
+
*/
|
|
5039
5110
|
async findGlobal() {
|
|
5040
|
-
return this
|
|
5111
|
+
return queryGlobal(this);
|
|
5041
5112
|
}
|
|
5113
|
+
/**
|
|
5114
|
+
* Find payment intents for a tenant including global intents.
|
|
5115
|
+
*
|
|
5116
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
5117
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
5118
|
+
*/
|
|
5042
5119
|
async findWithGlobals(tenantId2) {
|
|
5043
|
-
return
|
|
5044
|
-
|
|
5045
|
-
|
|
5120
|
+
return queryWithGlobals(
|
|
5121
|
+
this,
|
|
5122
|
+
tenantId2,
|
|
5123
|
+
"PaymentIntent.findWithGlobals"
|
|
5046
5124
|
);
|
|
5047
5125
|
}
|
|
5048
5126
|
}
|
|
@@ -5541,14 +5619,24 @@ class PayoutCollection extends SmrtCollection {
|
|
|
5541
5619
|
async findByTenant(tenantId2) {
|
|
5542
5620
|
return this.list({ where: { tenantId: tenantId2 } });
|
|
5543
5621
|
}
|
|
5622
|
+
/**
|
|
5623
|
+
* Find all global payouts (not associated with any tenant).
|
|
5624
|
+
*
|
|
5625
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
5626
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
5627
|
+
* flagged as an isolation violation). (#1600)
|
|
5628
|
+
*/
|
|
5544
5629
|
async findGlobal() {
|
|
5545
|
-
return this
|
|
5630
|
+
return queryGlobal(this);
|
|
5546
5631
|
}
|
|
5632
|
+
/**
|
|
5633
|
+
* Find payouts for a tenant including global payouts.
|
|
5634
|
+
*
|
|
5635
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
5636
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
5637
|
+
*/
|
|
5547
5638
|
async findWithGlobals(tenantId2) {
|
|
5548
|
-
return this.
|
|
5549
|
-
`SELECT * FROM ${this.tableName} WHERE tenant_id = ? OR tenant_id IS NULL`,
|
|
5550
|
-
[tenantId2]
|
|
5551
|
-
);
|
|
5639
|
+
return queryWithGlobals(this, tenantId2, "Payout.findWithGlobals");
|
|
5552
5640
|
}
|
|
5553
5641
|
}
|
|
5554
5642
|
class VendorCollection extends SmrtCollection {
|
|
@@ -5623,24 +5711,28 @@ class VendorCollection extends SmrtCollection {
|
|
|
5623
5711
|
return this.list({ where: { tenantId: tenantId2 } });
|
|
5624
5712
|
}
|
|
5625
5713
|
/**
|
|
5626
|
-
* Find all global vendors (not associated with any tenant)
|
|
5714
|
+
* Find all global vendors (not associated with any tenant).
|
|
5715
|
+
*
|
|
5716
|
+
* Routes through the shared tenant-global helper so it does not throw under
|
|
5717
|
+
* an active tenant context (an explicit `tenant_id IS NULL` filter would be
|
|
5718
|
+
* flagged as an isolation violation). (#1600)
|
|
5627
5719
|
*
|
|
5628
5720
|
* @returns Array of global vendors
|
|
5629
5721
|
*/
|
|
5630
5722
|
async findGlobal() {
|
|
5631
|
-
return this
|
|
5723
|
+
return queryGlobal(this);
|
|
5632
5724
|
}
|
|
5633
5725
|
/**
|
|
5634
|
-
* Find vendors for a tenant including global vendors
|
|
5726
|
+
* Find vendors for a tenant including global vendors.
|
|
5727
|
+
*
|
|
5728
|
+
* Fails closed if an active tenant context requests a different tenant's
|
|
5729
|
+
* rows; the admin/system path keeps the cross-tenant capability. (#1600)
|
|
5635
5730
|
*
|
|
5636
5731
|
* @param tenantId - Tenant ID
|
|
5637
5732
|
* @returns Array of tenant-specific and global vendors
|
|
5638
5733
|
*/
|
|
5639
5734
|
async findWithGlobals(tenantId2) {
|
|
5640
|
-
return this.
|
|
5641
|
-
`SELECT * FROM ${this.tableName} WHERE tenant_id = ? OR tenant_id IS NULL`,
|
|
5642
|
-
[tenantId2]
|
|
5643
|
-
);
|
|
5735
|
+
return queryWithGlobals(this, tenantId2, "Vendor.findWithGlobals");
|
|
5644
5736
|
}
|
|
5645
5737
|
}
|
|
5646
5738
|
export {
|