@sap/cds-mtxs
Advanced tools
Comparing version 1.7.3 to 1.8.0
@@ -15,3 +15,3 @@ const path = require('path') | ||
module.exports.createProject = async function (tenant, mtxExtension, dir, tagRegex, defaultTag = module.exports.DEFAULT_TAG) { | ||
module.exports.createProjects = async function (tenant, mtxExtension, dir, tagRegex, defaultTag = module.exports.DEFAULT_TAG) { | ||
@@ -22,3 +22,3 @@ const extensions = _splitExtensionByTag(mtxExtension, tagRegex, defaultTag) | ||
const projectFolder = path.join(dir, tenant, tag) | ||
const projectFolder = path.join(dir, tag) | ||
try { | ||
@@ -25,0 +25,0 @@ await fs.rm(projectFolder, { recursive: true, force: true }) |
const path = require('path') | ||
const mtxAdapter = require('./mtx-adapter') | ||
const { createProject } = require('./extension-project') | ||
const { createProjects } = require('./extension-project') | ||
const cds = require('@sap/cds') | ||
@@ -179,3 +179,2 @@ const LOG = cds.log('mtx'), DEBUG = cds.debug('mtx') | ||
await cds.tx({ tenant}, tx => tx.run(SELECT.one(1).from('cds.xt.Extensions'))) | ||
//const one = await SELECT.one(1).from('cds.xt.Extensions') | ||
// add metadata in case it had not been added before | ||
@@ -198,3 +197,3 @@ await _addMetadata(tenant, metadata) | ||
await createProject(tenant, mtxExtension, projectsDir, tagRegex, defaultTag) | ||
await createProjects(tenant, mtxExtension, tenantProjectFolder, tagRegex, defaultTag) | ||
@@ -210,5 +209,5 @@ // upload and verify extensions | ||
await _verifyExtension(tenantProjectFolder, tenant) | ||
migrationResult.log(tenant, `Extension verification successful for tenant ${tenant}`) | ||
migrationResult.log(tenant, `Extension verification successful for tenant ${tenant} [${tenantProjectFolder}]`) | ||
} catch (error) { | ||
migrationResult.error(tenant, `Extension verification failed for tenant ${tenant}, skipping migration`, error) | ||
migrationResult.error(tenant, `Extension verification failed for tenant ${tenant} [${tenantProjectFolder}]), skipping migration`, error) | ||
continue | ||
@@ -215,0 +214,0 @@ } |
{ | ||
"name": "@sap/cds-mtxs", | ||
"version": "1.7.3", | ||
"version": "1.8.0", | ||
"description": "SAP Cloud Application Programming Model - Multitenancy library", | ||
@@ -5,0 +5,0 @@ "homepage": "https://cap.cloud.sap/", |
@@ -6,3 +6,3 @@ const cds = require('@sap/cds/lib') | ||
const { push, pull } = require('./extensibility/push') | ||
const { token } = require('./extensibility/token') | ||
const token = require('./extensibility/token') | ||
const { transformExtendedFieldsCREATE, transformExtendedFieldsUPDATE } = require('./extensibility/handler/transformWRITE') | ||
@@ -9,0 +9,0 @@ const { transformExtendedFieldsREAD } = require('./extensibility/handler/transformREAD') |
@@ -76,3 +76,3 @@ const cds = require('@sap/cds/lib'), { uuid } = cds.utils | ||
op: task.op ?? task.OP, | ||
error: task.error ?? task.ERROR | ||
error: task.error ?? task.ERROR ?? undefined | ||
} | ||
@@ -111,6 +111,9 @@ } | ||
if (failed && onJobDone) { | ||
await onJobDone(failed.error ?? failed.ERROR) | ||
} else if (!running && !failed) { | ||
if (failed) { | ||
await retry(() => cds.tx({ tenant: t0 }, tx => | ||
tx.run(UPDATE(Jobs, { ID: job_ID }).with({ status: FAILED })) | ||
), LOG) | ||
if (onJobDone) await onJobDone(failed.error ?? failed.ERROR) | ||
} else if (!running) { | ||
await retry(() => cds.tx({ tenant: t0 }, tx => | ||
tx.run(UPDATE(Jobs, { ID: job_ID }).with({ status: FINISHED })) | ||
@@ -123,3 +126,3 @@ ), LOG) | ||
async function _nextTask(task, _fn) { | ||
const { job_ID, ID, tenant } = task | ||
const { ID, tenant } = task | ||
let hasErrored = false | ||
@@ -134,5 +137,2 @@ try { | ||
), LOG) | ||
await retry(() => cds.tx({ tenant: t0 }, tx => | ||
tx.run(UPDATE(Jobs, { ID: job_ID }).with({ status: FAILED })) | ||
), LOG) | ||
} finally { | ||
@@ -139,0 +139,0 @@ if (!hasErrored) { |
@@ -201,6 +201,6 @@ const cds = require('@sap/cds/lib'), {db} = cds.env.requires | ||
async function _deploy (req, _container) { | ||
const { tenant, options: { _: params, csn } = {} } = req.data | ||
const { tenant, options: { _: params, csn: csnFromParameter } = {} } = req.data | ||
// avoid undeploy if csn is passed - would potentially delete all tables | ||
if (csn && params?.hdi?.deploy?.auto_undeploy) params.hdi.deploy.auto_undeploy = false | ||
if (csnFromParameter && params?.hdi?.deploy?.auto_undeploy) params.hdi.deploy.auto_undeploy = false | ||
@@ -212,3 +212,3 @@ if (!cds.db) cds.db = cds.services.db = await cds.connect.to(db) | ||
DEBUG?.('preparing HANA deployment artifacts') | ||
const _resources = tenant === t0 ? null : resources4(tenant) | ||
const _resources = ( csnFromParameter ) ? null : resources4(tenant) | ||
@@ -219,3 +219,3 @@ let container | ||
container = await _container // csn4 accesses tenant tables, container has to exist | ||
return csn ?? csn4(tenant) | ||
return csnFromParameter ?? csn4(tenant) | ||
})(), | ||
@@ -233,8 +233,9 @@ (async () => { | ||
const updateCsvs = !!await csvs4(tenant) | ||
// 2. Get csvs from extensions | ||
const updateCsvs = !csnFromParameter && !!await csvs4(tenant) | ||
// 2. run cds compile -2 hana with potentially extended model from getCsn() | ||
// 3. run cds compile -2 hana with potentially extended model from getCsn() | ||
// FIXME: Do that check in a better way, as ExtensibilityService is always on by new sidecar presets | ||
const isExtensible = _isExtensible() | ||
if (isExtensible || tenant === t0) { | ||
if (isExtensible || csnFromParameter) { | ||
const csn = await _csn | ||
@@ -244,3 +245,3 @@ if (csn) await build (csn,tenant,updateCsvs) | ||
} | ||
if (tenant === t0) { | ||
if (csnFromParameter) { | ||
await fs.write ({ file_suffixes: { | ||
@@ -247,0 +248,0 @@ csv: { plugin_name: 'com.sap.hana.di.tabledata.source' }, |
@@ -8,2 +8,3 @@ const HdiDeployUtil = require('@sap/cds/bin/deploy/to-hana/hdiDeployUtil') | ||
const env = _hdi_env4(tenant,hana,options) | ||
DEBUG?.(`Deplyoment directory: ${cwd}`) | ||
DEBUG?.(`using HDI options: ${env.HDI_DEPLOY_OPTIONS}`) | ||
@@ -10,0 +11,0 @@ try { |
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
187295
62
3959
2