New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@enonic/js-utils

Package Overview
Dependencies
Maintainers
4
Versions
108
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@enonic/js-utils - npm Package Compare versions

Comparing version 0.21.0 to 0.21.1

dist/cjs/mock/node/NodeAlreadyExistAtPathException.js

21

dist/cjs/mock/Branch.js

@@ -175,2 +175,13 @@ var __defProp = Object.defineProperty;

// src/mock/node/NodeAlreadyExistAtPathException.ts
var NodeAlreadyExistAtPathException = class extends Error {
constructor(message) {
super(message);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, NodeAlreadyExistAtPathException);
}
this.name = "com.enonic.xp.node.NodeAlreadyExistAtPathException";
}
};
// src/mock/node/NodeNotFoundException.ts

@@ -206,2 +217,3 @@ var NodeNotFoundException = class extends Error {

constructor({
branchId,
repo

@@ -240,2 +252,3 @@ }) {

};
this._id = branchId;
this._repo = repo;

@@ -263,2 +276,5 @@ this.log = this._repo.log;

]);
if (rest.hasOwnProperty("_id")) {
delete rest["_id"];
}
const _id = this.generateId();

@@ -277,5 +293,8 @@ const _versionKey = this.generateId();

if (this._nodes.hasOwnProperty(_id)) {
throw new Error(`createNode: node with _id:${_id} already exist!`);
throw new Error(`Node already exists with ${_id} repository: ${this._repo.id()} branch: ${this._id}`);
}
const _path = `${_parentPath}${_name}`;
if (this._pathIndex.hasOwnProperty(_path)) {
throw new NodeAlreadyExistAtPathException(`Node already exists at ${_path} repository: ${this._repo.id()} branch: ${this._id}`);
}
const node = __spreadValues({

@@ -282,0 +301,0 @@ _id,

@@ -237,2 +237,13 @@ var __defProp = Object.defineProperty;

// src/mock/node/NodeAlreadyExistAtPathException.ts
var NodeAlreadyExistAtPathException = class extends Error {
constructor(message) {
super(message);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, NodeAlreadyExistAtPathException);
}
this.name = "com.enonic.xp.node.NodeAlreadyExistAtPathException";
}
};
// src/mock/node/NodeNotFoundException.ts

@@ -268,2 +279,3 @@ var NodeNotFoundException = class extends Error {

constructor({
branchId,
repo

@@ -302,2 +314,3 @@ }) {

};
this._id = branchId;
this._repo = repo;

@@ -325,2 +338,5 @@ this.log = this._repo.log;

]);
if (rest.hasOwnProperty("_id")) {
delete rest["_id"];
}
const _id = this.generateId();

@@ -339,5 +355,8 @@ const _versionKey = this.generateId();

if (this._nodes.hasOwnProperty(_id)) {
throw new Error(`createNode: node with _id:${_id} already exist!`);
throw new Error(`Node already exists with ${_id} repository: ${this._repo.id()} branch: ${this._id}`);
}
const _path = `${_parentPath}${_name}`;
if (this._pathIndex.hasOwnProperty(_path)) {
throw new NodeAlreadyExistAtPathException(`Node already exists at ${_path} repository: ${this._repo.id()} branch: ${this._id}`);
}
const node = __spreadValues({

@@ -493,2 +512,3 @@ _id,

"master": new Branch({
branchId: "master",
repo: this

@@ -498,2 +518,5 @@ })

}
id() {
return this._id;
}
get() {

@@ -500,0 +523,0 @@ return {

@@ -237,2 +237,13 @@ var __defProp = Object.defineProperty;

// src/mock/node/NodeAlreadyExistAtPathException.ts
var NodeAlreadyExistAtPathException = class extends Error {
constructor(message) {
super(message);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, NodeAlreadyExistAtPathException);
}
this.name = "com.enonic.xp.node.NodeAlreadyExistAtPathException";
}
};
// src/mock/node/NodeNotFoundException.ts

@@ -268,2 +279,3 @@ var NodeNotFoundException = class extends Error {

constructor({
branchId,
repo

@@ -302,2 +314,3 @@ }) {

};
this._id = branchId;
this._repo = repo;

@@ -325,2 +338,5 @@ this.log = this._repo.log;

]);
if (rest.hasOwnProperty("_id")) {
delete rest["_id"];
}
const _id = this.generateId();

@@ -339,5 +355,8 @@ const _versionKey = this.generateId();

if (this._nodes.hasOwnProperty(_id)) {
throw new Error(`createNode: node with _id:${_id} already exist!`);
throw new Error(`Node already exists with ${_id} repository: ${this._repo.id()} branch: ${this._id}`);
}
const _path = `${_parentPath}${_name}`;
if (this._pathIndex.hasOwnProperty(_path)) {
throw new NodeAlreadyExistAtPathException(`Node already exists at ${_path} repository: ${this._repo.id()} branch: ${this._id}`);
}
const node = __spreadValues({

@@ -493,2 +512,3 @@ _id,

"master": new Branch({
branchId: "master",
repo: this

@@ -498,2 +518,5 @@ })

}
id() {
return this._id;
}
get() {

@@ -500,0 +523,0 @@ return {

@@ -175,2 +175,13 @@ var __defProp = Object.defineProperty;

// src/mock/node/NodeAlreadyExistAtPathException.ts
var NodeAlreadyExistAtPathException = class extends Error {
constructor(message) {
super(message);
if (Error.captureStackTrace) {
Error.captureStackTrace(this, NodeAlreadyExistAtPathException);
}
this.name = "com.enonic.xp.node.NodeAlreadyExistAtPathException";
}
};
// src/mock/node/NodeNotFoundException.ts

@@ -206,2 +217,3 @@ var NodeNotFoundException = class extends Error {

constructor({
branchId,
repo

@@ -240,2 +252,3 @@ }) {

};
this._id = branchId;
this._repo = repo;

@@ -263,2 +276,5 @@ this.log = this._repo.log;

]);
if (rest.hasOwnProperty("_id")) {
delete rest["_id"];
}
const _id = this.generateId();

@@ -277,5 +293,8 @@ const _versionKey = this.generateId();

if (this._nodes.hasOwnProperty(_id)) {
throw new Error(`createNode: node with _id:${_id} already exist!`);
throw new Error(`Node already exists with ${_id} repository: ${this._repo.id()} branch: ${this._id}`);
}
const _path = `${_parentPath}${_name}`;
if (this._pathIndex.hasOwnProperty(_path)) {
throw new NodeAlreadyExistAtPathException(`Node already exists at ${_path} repository: ${this._repo.id()} branch: ${this._id}`);
}
const node = __spreadValues({

@@ -431,2 +450,3 @@ _id,

"master": new Branch({
branchId: "master",
repo: this

@@ -436,2 +456,5 @@ })

}
id() {
return this._id;
}
get() {

@@ -438,0 +461,0 @@ return {

2

package.json

@@ -59,3 +59,3 @@ {

},
"version": "0.21.0"
"version": "0.21.1"
}

@@ -21,2 +21,3 @@ import type { Log } from './globals.d'

} from '../';
import {NodeAlreadyExistAtPathException} from './node/NodeAlreadyExistAtPathException';
import {NodeNotFoundException} from './node/NodeNotFoundException';

@@ -59,2 +60,3 @@

private _highest_id :number = 1;
private _id :string;
private _nodes :Nodes = {

@@ -94,7 +96,10 @@ '00000000-0000-0000-0000-000000000000': {

constructor({
branchId,
repo
} :{
branchId :string
repo :Repo
}) {
//console.debug('repo.constructor.name',repo.constructor.name);
this._id = branchId;
this._repo = repo;

@@ -112,3 +117,2 @@ this.log = this._repo.log;

//_childOrder,
//_id, // avoid it ending up in rest
_indexConfig = DEFAULT_INDEX_CONFIG,

@@ -126,7 +130,7 @@ //_inheritsPermissions,

} :NodeCreateParams) :RepoNodeWithData {
//if (rest.hasOwnProperty('_id')) { delete rest._id; }
if (rest.hasOwnProperty('_id')) { delete rest['_id']; } // /lib/xp/node.connect().create() simply ignores _id
//if (rest.hasOwnProperty('_versionKey')) { delete rest._versionKey; }
const _id = this.generateId();
const _versionKey = this.generateId();
if (!_name) { _name = _id; }
if (!_name) { _name = _id as string; }

@@ -148,6 +152,10 @@ if(!_parentPath.endsWith('/')) {

if (this._nodes.hasOwnProperty(_id as string)) {
throw new Error(`createNode: node with _id:${_id} already exist!`);
if (this._nodes.hasOwnProperty(_id)) { // This can only happen if
throw new Error(`Node already exists with ${_id} repository: ${this._repo.id()} branch: ${this._id}`); // /lib/xp/node.connect().create() simply ignores _id
//throw new NodeAlreadyExistAtPathException(`Node already exists at ${_path} repository: ${this._repo.id} branch: ${this._id}`);
}
const _path :string = `${_parentPath}${_name}`; // TODO use path.join?
if (this._pathIndex.hasOwnProperty(_path)) {
throw new NodeAlreadyExistAtPathException(`Node already exists at ${_path} repository: ${this._repo.id()} branch: ${this._id}`);
}
const node :RepoNodeWithData = {

@@ -154,0 +162,0 @@ _id,

@@ -14,3 +14,5 @@ import type {Log} from './globals.d'

export class Repo {
//#id :string; // Private identifiers are only available when targeting ECMAScript 2015 and higher.
private _id :string;
private _branches :Branches;

@@ -40,2 +42,3 @@ private _javaBridge :JavaBridge;

'master': new Branch({
branchId: 'master',
repo: this

@@ -46,2 +49,7 @@ })

//public get id() :string { // jsc.target should be es5 or upper to use getter / setter
public id() :string {
return this._id;
}
get() {

@@ -48,0 +56,0 @@ return {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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