Socket
Socket
Sign inDemoInstall

@platform/cell.schema

Package Overview
Dependencies
Maintainers
1
Versions
289
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@platform/cell.schema - npm Package Compare versions

Comparing version 0.5.82 to 0.5.83

lib/Encoding/Encoding.Key.d.ts

2

lib/common/constants.pkg.js

@@ -6,3 +6,3 @@ "use strict";

name: '@platform/cell.schema',
version: '0.5.82',
version: '0.5.83',
};

@@ -6,4 +6,6 @@ export declare const Encoding: {

unescapeNamespace: (value: string) => string;
escapeKey: (input: string) => string;
unescapeKey: (input: string) => string;
transformKeys(obj: Record<string, any>, fn: (input: string) => string): {};
transformValues(obj: Record<string, any>, fn: (input: string) => string): {};
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Encoding = void 0;
var Encoding_Key_1 = require("./Encoding.Key");
exports.Encoding = {

@@ -9,2 +10,4 @@ escapePath: function (value) { return value.replace(/\//g, '\\'); },

unescapeNamespace: function (value) { return value.replace(/__/g, '.'); },
escapeKey: Encoding_Key_1.KeyEncoding.escape,
unescapeKey: Encoding_Key_1.KeyEncoding.unescape,
transformKeys: function (obj, fn) {

@@ -11,0 +14,0 @@ return Object.keys(obj).reduce(function (acc, key) {

@@ -1,1 +0,1 @@

export * from './Encoding';
export { Encoding } from './Encoding';
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var tslib_1 = require("tslib");
tslib_1.__exportStar(require("./Encoding"), exports);
exports.Encoding = void 0;
var Encoding_1 = require("./Encoding");
Object.defineProperty(exports, "Encoding", { enumerable: true, get: function () { return Encoding_1.Encoding; } });
import { t } from '../common';
export declare class Links {
static encodeKey: typeof encode;
static decodeKey: typeof decode;
static encodeKey: (input: string) => string;
static decodeKey: (input: string) => string;
static create: (prefix: string) => Links;

@@ -41,4 +41,1 @@ private constructor();

}
declare function encode(input: string): string;
declare function decode(input: string): string;
export {};

@@ -7,2 +7,3 @@ "use strict";

var Uri_1 = require("../Uri");
var Encoding_Key_1 = require("../Encoding/Encoding.Key");
var Links = (function () {

@@ -38,3 +39,3 @@ function Links(args) {

prefix = (prefix || '').trim().replace(/:*$/, '');
return prefix + ":" + encode(input);
return prefix + ":" + Encoding_Key_1.KeyEncoding.escape(input);
};

@@ -120,4 +121,4 @@ Links.prototype.toList = function (links) {

};
Links.encodeKey = encode;
Links.decodeKey = decode;
Links.encodeKey = Encoding_Key_1.KeyEncoding.escape;
Links.decodeKey = Encoding_Key_1.KeyEncoding.unescape;
Links.create = function (prefix) { return new Links({ prefix: prefix }); };

@@ -127,54 +128,4 @@ return Links;

exports.Links = Links;
function encode(input) {
var ILLEGAL = [':'];
ILLEGAL.forEach(function (char) {
if (input.includes(char)) {
throw new Error("Link key cannot contain \"" + char + "\" character.");
}
});
input = trimSlashes(input);
var escapeMultiPeriods = function (input) {
var regex = new RegExp(/\.{2,}/g);
var match = regex.exec(input);
if (match && match[0]) {
var left = input.substring(0, match.index);
var middle = ':'.repeat(match[0].length);
var right = input.substring(match.index + match[0].length);
input = left + "[" + middle + "]" + right;
return escapeMultiPeriods(input);
}
else {
return input;
}
};
input = escapeMultiPeriods(input)
.replace(/\//g, '::')
.replace(/\./g, ':');
return input;
}
function decode(input) {
var unescapeMultiPeriods = function (input) {
var regex = new RegExp(/\[:{2,}\]/g);
var match = regex.exec(input);
if (match && match[0]) {
var left = input.substring(0, match.index);
var middle = '.'.repeat(match[0].length - 2);
var right = input.substring(match.index + match[0].length);
input = "" + left + middle + right;
return unescapeMultiPeriods(input);
}
else {
return input;
}
};
input = unescapeMultiPeriods(input)
.replace(/::/g, '/')
.replace(/:/g, '.');
return input;
}
function shouldDecode(input) {
return input.includes(':');
}
function trimSlashes(input) {
return (input || '').replace(/^\/*/, '').replace(/\/*$/, '');
}

@@ -109,2 +109,4 @@ import { t, hash, coord, Mime } from '../common';

unescapeNamespace: (value: string) => string;
escapeKey: (input: string) => string;
unescapeKey: (input: string) => string;
transformKeys(obj: Record<string, any>, fn: (input: string) => string): {};

@@ -111,0 +113,0 @@ transformValues(obj: Record<string, any>, fn: (input: string) => string): {};

@@ -164,9 +164,21 @@ "use strict";

Uri.is = {
uri: function (input) { return Uri.parse(input).ok; },
uri: function (input) {
try {
return Uri.parse(input).ok;
}
catch (error) {
return false;
}
},
type: function (type, input) {
var uri = Uri.parse(input);
var types = Array.isArray(type) ? type : [type];
return types.some(function (type) {
return uri.parts.type === type && (type === 'UNKNOWN' ? true : uri.ok);
});
try {
var uri_1 = Uri.parse(input);
var types = Array.isArray(type) ? type : [type];
return types.some(function (type) {
return uri_1.parts.type === type && (type === 'UNKNOWN' ? true : uri_1.ok);
});
}
catch (error) {
return false;
}
},

@@ -173,0 +185,0 @@ ns: function (input) { return Uri.is.type('NS', input); },

{
"name": "@platform/cell.schema",
"version": "0.5.82",
"version": "0.5.83",
"description": "URI and database schemas for the `cell.os`.",

@@ -15,4 +15,4 @@ "main": "lib/index",

"@platform/cache": "0.3.17",
"@platform/cell.coord": "0.8.264",
"@platform/cell.types": "0.5.79",
"@platform/cell.coord": "0.8.265",
"@platform/cell.types": "0.5.80",
"@platform/fs.types": "0.1.8",

@@ -19,0 +19,0 @@ "@platform/fsdb.types": "0.6.58",

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