@sap/cds-mtxs
Advanced tools
Comparing version 1.4.0 to 1.4.2
@@ -9,2 +9,17 @@ # Change Log | ||
## Version 1.4.2 - 2022-12-19 | ||
### Fixed | ||
- `/-/cds/jobs/pollTask` now correctly fetches the task status. | ||
- Jobs now have the correct default `RUNNING` status. | ||
## Version 1.4.1 - 2022-12-16 | ||
### Fixed | ||
- Fixed an error with when parsing the tenant metadata when it is empty | ||
- Async upgrade parallelization via database clustering now works correctly with the new jobs service | ||
- Improved `tenant_id` correlation for Kibana logging | ||
## Version 1.4.0 - 2022-12-15 | ||
@@ -11,0 +26,0 @@ |
{ | ||
"name": "@sap/cds-mtxs", | ||
"version": "1.4.0", | ||
"version": "1.4.2", | ||
"description": "SAP Cloud Application Programming Model - Multitenancy library", | ||
@@ -5,0 +5,0 @@ "homepage": "https://cap.cloud.sap/", |
@@ -94,9 +94,9 @@ const cds = require('@sap/cds/lib') | ||
async read(context) { // TODO check params for get | ||
const tenantId = this._getSubscribedTenant(context) | ||
if (tenantId) { | ||
const tenant = await cds.tx({ tenant: t0 }, tx => | ||
tx.run(SELECT.one.from(Tenants, { ID: tenantId }, tenant => { tenant.metadata })) | ||
const tenant = this._getSubscribedTenant(context) | ||
if (tenant) { | ||
const one = await cds.tx({ tenant: t0 }, tx => | ||
tx.run(SELECT.one.from(Tenants, { ID: tenant }, tenant => { tenant.metadata })) | ||
) | ||
if (!tenant) cds.error(`Tenant ${tenantId} not found`, { status: 404 }) | ||
return JSON.parse(tenant.metadata) | ||
if (!one) cds.error(`Tenant ${tenant} not found`, { status: 404 }) | ||
return JSON.parse(one.metadata ?? '{}') | ||
} | ||
@@ -118,3 +118,3 @@ return (await cds.tx({ tenant: t0 }, tx => | ||
} = cds.env.requires.multitenancy.jobs ?? cds.env.requires['cds.xt.SaasProvisioningService']?.jobs ?? {} | ||
const dbToTenants = clusterSize > 1 ? await this._tenantsByDb() : [new Set(tenants)] | ||
const dbToTenants = clusterSize > 1 ? await this._tenantsByDb(tenants) : [new Set(tenants)] | ||
LOG.info('Upgrading tenants', tenants) | ||
@@ -121,0 +121,0 @@ if (isSync) { |
@@ -7,3 +7,3 @@ const cds = require ('@sap/cds/lib') | ||
const [major, minor] = cds.version.split('.').map(Number); | ||
if (!((major === 6 && minor >= 2) || (major > 6))) throw new Error('@sap/cds-mtxs >= 1.2 requires @sap/cds version >= 6.2') | ||
if (major < 6 || major === 6 && minor < 4) throw new Error('@sap/cds-mtxs >= 1.4 requires @sap/cds version >= 6.4') | ||
if (!cds.requires.db) throw new Error(`No database configured. Check configuration for 'cds.requires.db'`) | ||
@@ -10,0 +10,0 @@ |
@@ -62,4 +62,4 @@ const cds = require('@sap/cds/lib'), { uuid } = cds.utils | ||
this.on('pollTask', req => { | ||
const task = cds.tx({ tenant: t0 }, tx => | ||
this.on('pollTask', async req => { | ||
const task = await cds.tx({ tenant: t0 }, tx => | ||
tx.run(SELECT.one.from(Tasks).where({ ID: req.data.ID })) | ||
@@ -110,3 +110,2 @@ ) | ||
try { | ||
cds.context = { tenant } | ||
return await fn | ||
@@ -113,0 +112,0 @@ } catch (e) { |
@@ -12,2 +12,7 @@ const cds = require('@sap/cds/lib') | ||
ds.before ('*', req => { | ||
const { tenant } = req?.data ?? {} | ||
if (tenant) cds.context = { tenant } | ||
}) | ||
ds.on ('subscribe', async (req, next) => { | ||
@@ -14,0 +19,0 @@ // REVISIT: Use UPSERT instead |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
147180
2842