Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sap/cds-mtxs

Package Overview
Dependencies
Maintainers
0
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sap/cds-mtxs - npm Package Compare versions

Comparing version 2.0.5 to 2.0.6

8

CHANGELOG.md

@@ -9,3 +9,11 @@ # Change Log

## Version 2.0.6 - 2024-08-15
### Fixed
- Subscription Manager service subscriptions are now working again.
- The `cds.features.assertIntegrity` is correctly added to the compiler options for HANA builds.
- The job status now always returns a non-null value also when using `@cap-js/hana`.
- The passcode URL now reflects the subscriber subdomain, if such is received from the client.
## Version 2.0.5 - 2024-08-06

@@ -12,0 +20,0 @@

2

package.json
{
"name": "@sap/cds-mtxs",
"version": "2.0.5",
"version": "2.0.6",
"description": "SAP Cloud Application Programming Model - Multitenancy library",

@@ -5,0 +5,0 @@ "homepage": "https://cap.cloud.sap/",

@@ -95,3 +95,3 @@ const cds = require('@sap/cds/lib')

const js = await cds.connect.to(JobsService)
const tx = js.tx(context)
const tx = js.tx({ tenant: context.tenant, user: new cds.User.Privileged() })
return tx.enqueue('subscribe', [new Set([tenant])], { data, options }, error => {

@@ -171,3 +171,3 @@ if (error) this._sendCallback('FAILED', 'Tenant creation failed')

const js = await cds.connect.to(JobsService)
const tx = js.tx(cds.context)
const tx = js.tx({ tenant: cds.context.tenant, user: new cds.User.Privileged() })
// REVISIT: use jobs service for sync and async operations (might also be interesting for concurrency control)

@@ -215,3 +215,3 @@ return tx.enqueue('upgrade', dbToTenants, { options }, error => {

const lcs = await cds.connect.to(JobsService)
const tx = lcs.tx(context)
const tx = lcs.tx({ tenant: context.tenant, user: new cds.User.Privileged() })
return tx.enqueue('unsubscribe', [new Set([tenant])], { metadata }, error => {

@@ -218,0 +218,0 @@ if (error) this._sendCallback('FAILED', 'Tenant deletion failed')

@@ -65,2 +65,6 @@ const { URL } = require('url');

/**
* Always instantiate via AuthProviderFactory to ensure validation of query.
* Constructor validates the credentials.
*/
constructor(credentials, query) {

@@ -138,2 +142,5 @@ AuthProvider.#validate(credentials);

const url = new URL(this.credentials.url);
if (this.query.subdomain) {
url.hostname = url.hostname.replace(/^[^.]+/, this.query.subdomain);
}
url.pathname = '/passcode';

@@ -140,0 +147,0 @@ this.#passcodeUrl = url.toString();

@@ -0,4 +1,5 @@

const AuthProvider = require('./AuthProvider');
const RefreshTokenAuthProvider = require('./RefreshTokenAuthProvider');
const PasswordAuthProvider = require('./PasswordAuthProvider');
const ClientCredentialsAuthProvider = require('./ClientCredentialsAuthProvider');
const PasswordAuthProvider = require('./PasswordAuthProvider');
const RefreshTokenAuthProvider = require('./RefreshTokenAuthProvider');
const { assertDefined } = require('./util/SecretsUtil');

@@ -8,13 +9,17 @@

/**
* Validates all data relevant to the determination of the grant type.
*/
static #validate(credentials, query) {
assertDefined('query', query);
assertDefined('presence of refresh token or passcode or clientid', !!query.refresh_token || !!query.passcode || !!query.clientid);
/**
* Validates all data relevant to the determination of the grant type.
*/
static #validate(credentials, query, { generic }) {
assertDefined('query', query);
if (!generic) {
assertDefined('presence of refresh token or passcode or clientid', !!query.refresh_token || !!query.passcode || !!query.clientid);
}
}
static getAuthProvider(credentials, query) {
AuthProviderFactory.#validate(credentials, query);
return query.refresh_token
static getAuthProvider(credentials, query, { generic = false } = {}) {
AuthProviderFactory.#validate(credentials, query, { generic });
return generic
? new AuthProvider(credentials, query)
: query.refresh_token
? new RefreshTokenAuthProvider(credentials, query)

@@ -24,3 +29,3 @@ : query.passcode

: new ClientCredentialsAuthProvider(credentials, query);
}
}
}
};

@@ -76,7 +76,7 @@ const cds = require('@sap/cds/lib');

const { credentials } = cds.env.requires.auth;
const passcodeUrl = new AuthProvider(credentials, {}).passcodeUrl;
DEBUG?.(`Sending passcode URL to client:`, passcodeUrl);
const authProvider = getAuthProvider(credentials, request.query, { generic: true });
DEBUG?.(`Sending passcode URL to client:`, authProvider.passcodeUrl);
// NOTE: Use snake_case for properties for compatibility with RFC 8414.
return response.status(200).send({
passcode_url: passcodeUrl
passcode_url: authProvider.passcodeUrl
});

@@ -83,0 +83,0 @@ }

@@ -16,3 +16,3 @@ const { inspect } = require('util')

const RUNNING = 'RUNNING', FINISHED = 'FINISHED', FAILED = 'FAILED'
const RUNNING = 'RUNNING', FINISHED = 'FINISHED', FAILED = 'FAILED', QUEUED = 'QUEUED'

@@ -74,3 +74,3 @@ // A queue, implemented as a circular buffer for O(1) insert + delete

const job_ID = uuid()
const job = { ID: job_ID, createdAt: (new Date).toISOString(), op }
const job = { ID: job_ID, createdAt: (new Date).toISOString(), op, status: QUEUED }
await t0_(INSERT.into(Jobs, job))

@@ -77,0 +77,0 @@ const jobs = Object.values(clusters).map(cluster => Array.from(cluster).map(tenant => ({ job_ID, ID: uuid(), tenant, op })))

@@ -318,4 +318,5 @@ const cds = require('@sap/cds/lib'), {db} = cds.env.requires

function _compileToHana(csn, tenant) {
const options = { messages: [], sql_mapping: cds.env.sql.names, assertIntegrity: false }
if (tenant !== t0) Object.assign(options, main.env.cdsc);
const options = { messages: [], sql_mapping: cds.env.sql.names }
if (tenant === t0) Object.assign(options, { assertIntegrity: false })
if (tenant !== t0) Object.assign(options, main.env.cdsc)
let definitions = []

@@ -322,0 +323,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc