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

@accordproject/concerto-core

Package Overview
Dependencies
Maintainers
3
Versions
866
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@accordproject/concerto-core - npm Package Compare versions

Comparing version 3.17.1-20240708200648 to 3.17.1-20240711045644

4

dist/concerto-core.js.LICENSE.txt
/*!
* Concerto v3.17.1-20240708200648
* Concerto v3.17.1-20240711045644
* Licensed under the Apache License, Version 2.0 (the "License");

@@ -62,2 +62,4 @@ * you may not use this file except in compliance with the License.

/*! For license information please see concerto-util.js.LICENSE.txt */
/*! https://mths.be/punycode v1.4.0 by @mathias */

@@ -24,2 +24,3 @@ /*

const DecoratorExtractor = require('./decoratorextractor');
const { Warning, ErrorCodes } = require('@accordproject/concerto-util');

@@ -213,2 +214,3 @@ // Types needed for TypeScript generation.

* @param {boolean} [options.migrate] - migrate the decoratorCommandSet $class to match the dcs model version
* @param {boolean} [options.enableDcsNamespaceTarget] - flag to control applying namespace targeted decorators on top of the namespace instead of all declarations in that namespace
* @returns {ModelManager} a new model manager with the decorations applied

@@ -250,3 +252,6 @@ */

decoratorCommandSet.commands.forEach((command) => {
this.executeCommand(model.namespace, decl, command);
this.executeCommand(model.namespace, decl, command, options?.enableDcsNamespaceTarget);
if(this.isNamespaceTargetEnabled(options?.enableDcsNamespaceTarget)) {
this.executeNamespaceCommand(model, command);
}
});

@@ -447,2 +452,21 @@ });

/**
* Executes a Command against a Model Namespace, adding
* decorators to the Namespace.
* @private
* @param {*} model the model
* @param {*} command the Command object from the dcs
*/
static executeNamespaceCommand(model, command) {
const { target, decorator, type } = command;
if (Object.keys(target).length === 2 && target.namespace) {
const { name } = ModelUtil.parseNamespace( model.namespace );
// should we just compare with namespace??
if(this.falsyOrEqual(target.namespace, [model.namespace,name])) {
this.applyDecorator(model, type, decorator);
}
}
}
/**
* Executes a Command against a ClassDeclaration, adding

@@ -452,6 +476,7 @@ * decorators to the ClassDeclaration, or its properties, as required.

* @param {*} declaration the class declaration
* @param {*} command the Command object from the
* @param {*} command the Command object from the dcs
* @param {boolean} [enableDcsNamespaceTarget] - flag to control applying namespace targeted decorators on top of the namespace instead of all declarations in that namespace
* org.accordproject.decoratorcommands model
*/
static executeCommand(namespace, declaration, command) {
static executeCommand(namespace, declaration, command, enableDcsNamespaceTarget) {
const { target, decorator, type } = command;

@@ -482,6 +507,6 @@ const { name } = ModelUtil.parseNamespace( namespace );

} else {
this.applyDecorator(declaration, type, decorator);
this.checkForNamespaceTargetAndApplyDecorator(declaration, type, decorator, target, enableDcsNamespaceTarget);
}
} else if (!(target.property || target.properties || target.type)) {
this.applyDecorator(declaration, type, decorator);
this.checkForNamespaceTargetAndApplyDecorator(declaration, type, decorator, target, enableDcsNamespaceTarget);
} else {

@@ -520,4 +545,46 @@ // scalars are declarations but do not have properties

}
/**
* Checks if enableDcsNamespaceTarget or ENABLE_DCS_TARGET_NAMESPACE is enabled or not
* if enabled, applies the decorator on top of the namespace or else on all declarations
* within the namespace.
* @private
* @param {*} declaration the type to apply the decorator to
* @param {string} type the command type
* @param {*} decorator the decorator to add
* @param {*} target the target object for the decorator
* @param {boolean} [enableDcsNamespaceTarget] - flag to control applying namespace targeted decorators on top of the namespace instead of all declarations in that namespace
*/
static checkForNamespaceTargetAndApplyDecorator(declaration, type, decorator, target, enableDcsNamespaceTarget) {
if(this.isNamespaceTargetEnabled(enableDcsNamespaceTarget)) {
if (target.declaration) {
this.applyDecorator(declaration, type, decorator);
}
} else {
this.applyDecorator(declaration, type, decorator);
}
}
/**
* Checks if enableDcsNamespaceTarget or ENABLE_DCS_TARGET_NAMESPACE is enabled or not
* and print deprecation warning if not enabled and return boolean value as well
* @private
* @param {boolean} [enableDcsNamespaceTarget] - flag to control applying namespace targeted decorators on top of the namespace instead of all declarations in that namespace
* @returns {Boolean} true if either of the flags is enabled
*/
static isNamespaceTargetEnabled(enableDcsNamespaceTarget) {
if(enableDcsNamespaceTarget || process.env.ENABLE_DCS_NAMESPACE_TARGET === 'true') {
return true;
} else {
Warning.printDeprecationWarning(
'Functionality for namespace targeted Decorator Command Sets has beed changed. Using namespace targets to apply decorators on all declarations in a namespace will be deprecated soon.',
ErrorCodes.DEPRECATION_WARNING,
ErrorCodes.CONCERTO_DEPRECATION_001,
'Please refer to https://concerto.accordproject.org/deprecation/001'
);
return false;
}
}
}
module.exports = DecoratorManager;

@@ -34,2 +34,3 @@ /*

const Decorated = require('./decorated');
const { Warning, ErrorCodes } = require('@accordproject/concerto-util');

@@ -750,3 +751,8 @@ // Types needed for TypeScript generation.

}
console.warn('DEPRECATED: Wilcard Imports are deprecated in this version of Concerto and will be removed in a future version.');
Warning.printDeprecationWarning(
'Wilcard Imports are deprecated in this version of Concerto and will be removed in a future version.',
ErrorCodes.DEPRECATION_WARNING,
ErrorCodes.CONCERTO_DEPRECATION_002,
'Please refer to https://concerto.accordproject.org/deprecation/002'
);
this.importWildcardNamespaces.push(imp.namespace);

@@ -753,0 +759,0 @@ break;

{
"name": "@accordproject/concerto-core",
"version": "3.17.1-20240708200648",
"version": "3.17.1-20240711045644",
"description": "Core Implementation for the Concerto Modeling Language",

@@ -74,5 +74,5 @@ "homepage": "https://github.com/accordproject/concerto",

"dependencies": {
"@accordproject/concerto-cto": "3.17.1-20240708200648",
"@accordproject/concerto-cto": "3.17.1-20240711045644",
"@accordproject/concerto-metamodel": "3.10.0",
"@accordproject/concerto-util": "3.17.1-20240708200648",
"@accordproject/concerto-util": "3.17.1-20240711045644",
"dayjs": "1.11.10",

@@ -79,0 +79,0 @@ "debug": "4.3.4",

@@ -50,2 +50,3 @@ export = DecoratorManager;

* @param {boolean} [options.migrate] - migrate the decoratorCommandSet $class to match the dcs model version
* @param {boolean} [options.enableDcsNamespaceTarget] - flag to control applying namespace targeted decorators on top of the namespace instead of all declarations in that namespace
* @returns {ModelManager} a new model manager with the decorations applied

@@ -57,2 +58,3 @@ */

migrate?: boolean;
enableDcsNamespaceTarget?: boolean;
}): ModelManager;

@@ -124,2 +126,10 @@ /**

/**
* Executes a Command against a Model Namespace, adding
* decorators to the Namespace.
* @private
* @param {*} model the model
* @param {*} command the Command object from the dcs
*/
private static executeNamespaceCommand;
/**
* Executes a Command against a ClassDeclaration, adding

@@ -129,6 +139,7 @@ * decorators to the ClassDeclaration, or its properties, as required.

* @param {*} declaration the class declaration
* @param {*} command the Command object from the
* @param {*} command the Command object from the dcs
* @param {boolean} [enableDcsNamespaceTarget] - flag to control applying namespace targeted decorators on top of the namespace instead of all declarations in that namespace
* org.accordproject.decoratorcommands model
*/
static executeCommand(namespace: string, declaration: any, command: any): void;
static executeCommand(namespace: string, declaration: any, command: any, enableDcsNamespaceTarget?: boolean): void;
/**

@@ -142,4 +153,24 @@ * Executes a Command against a Property, adding

static executePropertyCommand(property: any, command: any): void;
/**
* Checks if enableDcsNamespaceTarget or ENABLE_DCS_TARGET_NAMESPACE is enabled or not
* if enabled, applies the decorator on top of the namespace or else on all declarations
* within the namespace.
* @private
* @param {*} declaration the type to apply the decorator to
* @param {string} type the command type
* @param {*} decorator the decorator to add
* @param {*} target the target object for the decorator
* @param {boolean} [enableDcsNamespaceTarget] - flag to control applying namespace targeted decorators on top of the namespace instead of all declarations in that namespace
*/
private static checkForNamespaceTargetAndApplyDecorator;
/**
* Checks if enableDcsNamespaceTarget or ENABLE_DCS_TARGET_NAMESPACE is enabled or not
* and print deprecation warning if not enabled and return boolean value as well
* @private
* @param {boolean} [enableDcsNamespaceTarget] - flag to control applying namespace targeted decorators on top of the namespace instead of all declarations in that namespace
* @returns {Boolean} true if either of the flags is enabled
*/
private static isNamespaceTargetEnabled;
}
import ModelFile = require("./introspect/modelfile");
import ModelManager = require("./modelmanager");

Sorry, the diff of this file is too big to display

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