mx-puppet-bridge
Advanced tools
Comparing version 0.0.35-2 to 0.0.35-3
@@ -12,2 +12,1 @@ export * from "./puppetbridge"; | ||
export { IStringFormatterVars } from "./structures/stringformatter"; | ||
export { ExpireSet } from "./structures/expireset"; |
@@ -25,3 +25,1 @@ "use strict"; | ||
exports.Store = store_1.Store; | ||
var expireset_1 = require("./structures/expireset"); | ||
exports.ExpireSet = expireset_1.ExpireSet; |
@@ -25,3 +25,3 @@ "use strict"; | ||
const lock_1 = require("./lock"); | ||
const expireset_1 = require("./expireset"); | ||
const expire_set_1 = require("expire-set"); | ||
const DEFAULT_LOCK_TIMEOUT = 30000; | ||
@@ -33,4 +33,4 @@ const DEFAULT_LOCK_DATA_TIMEOUT = 300000; | ||
const ldt = lockDataTimeout || DEFAULT_LOCK_DATA_TIMEOUT; | ||
this.data = new expireset_1.ExpireSet(ldt); | ||
this.authorIds = new expireset_1.ExpireSet(ldt); | ||
this.data = new expire_set_1.default(ldt); | ||
this.authorIds = new expire_set_1.default(ldt); | ||
} | ||
@@ -37,0 +37,0 @@ lock(roomId, authorId, message) { |
@@ -18,4 +18,5 @@ export interface IStringFormatterVars { | ||
static getIfParts(pattern: string, i: number): IStringFormatterGetIfPartsResult; | ||
static scanBlock(pattern: string, i: number): string; | ||
static scanBlock(pattern: string, i: number, chars: string): string; | ||
static condition(pattern: string, vars: IStringFormatterVars): string; | ||
} | ||
export {}; |
@@ -30,3 +30,3 @@ "use strict"; | ||
i += res.length; | ||
const ifComputed = StringFormatter.format(res.if, vars); | ||
const ifComputed = StringFormatter.condition(res.if, vars); | ||
if (ifComputed) { | ||
@@ -56,3 +56,3 @@ result += StringFormatter.format(res.then, vars); | ||
const char = pattern[i]; | ||
if (char.match(/[a-z]/)) { | ||
if (char.match(/[a-z0-9]/)) { | ||
length++; | ||
@@ -83,3 +83,3 @@ varName += char; | ||
if (char === "[") { | ||
const res = StringFormatter.scanBlock(pattern, i); | ||
const res = StringFormatter.scanBlock(pattern, i, "[]"); | ||
i += res.length - 1; | ||
@@ -111,3 +111,3 @@ length += res.length - 1; | ||
} | ||
static scanBlock(pattern, i) { | ||
static scanBlock(pattern, i, chars) { | ||
let result = ""; | ||
@@ -122,6 +122,6 @@ let depth = 0; | ||
} | ||
else if (char === "[") { | ||
else if (char === chars[0]) { | ||
depth++; | ||
} | ||
else if (char === "]") { | ||
else if (char === chars[1]) { | ||
depth--; | ||
@@ -135,3 +135,58 @@ if (depth === 0) { | ||
} | ||
static condition(pattern, vars) { | ||
let result = ""; | ||
for (let i = 0; i < pattern.length; i++) { | ||
const char = pattern[i]; | ||
switch (char) { | ||
case ":": { | ||
const res = StringFormatter.insertVar(pattern, vars, i); | ||
result += res.result; | ||
i += res.length; | ||
break; | ||
} | ||
case "=": { | ||
const res = StringFormatter.condition(pattern.substr(i + 1), vars); | ||
if (res === result) { | ||
return res; | ||
} | ||
return ""; | ||
} | ||
case "|": { | ||
if (result) { | ||
return result; | ||
} | ||
return StringFormatter.condition(pattern.substr(i + 1), vars); | ||
} | ||
case "&": { | ||
if (!result) { | ||
return ""; | ||
} | ||
return StringFormatter.condition(pattern.substr(i + 1), vars); | ||
} | ||
case "^": { | ||
const res = StringFormatter.condition(pattern.substr(i + 1), vars); | ||
const res1 = result ? 1 : 0; | ||
const res2 = res ? 1 : 0; | ||
if (res1 ^ res2) { | ||
return result || res; | ||
} | ||
return ""; | ||
} | ||
case "(": { | ||
const res = StringFormatter.scanBlock(pattern, i, "()"); | ||
i += res.length - 1; | ||
result += StringFormatter.condition(res.substring(1, res.length - 1), vars); | ||
break; | ||
} | ||
case "\\": | ||
i++; | ||
result += pattern[i]; | ||
break; | ||
default: | ||
result += char; | ||
} | ||
} | ||
return result; | ||
} | ||
} | ||
exports.StringFormatter = StringFormatter; |
@@ -25,3 +25,3 @@ "use strict"; | ||
const log_1 = require("./log"); | ||
const expireset_1 = require("./structures/expireset"); | ||
const expire_set_1 = require("expire-set"); | ||
const log = new log_1.Log("TypingHandler"); | ||
@@ -32,3 +32,3 @@ class TypingHandler { | ||
this.timeout = timeout; | ||
this.typingUsers = new expireset_1.ExpireSet(this.timeout); | ||
this.typingUsers = new expire_set_1.default(this.timeout); | ||
} | ||
@@ -35,0 +35,0 @@ set(mxid, roomId, typing) { |
{ | ||
"name": "mx-puppet-bridge", | ||
"version": "0.0.35-2", | ||
"version": "0.0.35-3", | ||
"description": "Matrix Puppeting Bridge library", | ||
@@ -25,2 +25,3 @@ "repository": { | ||
"events": "^3.1.0", | ||
"expire-set": "^1.0.0", | ||
"file-type": "^12.4.2", | ||
@@ -30,3 +31,3 @@ "hasha": "^5.2.0", | ||
"markdown-it": "^9.1.0", | ||
"matrix-bot-sdk": "^0.5.3", | ||
"matrix-bot-sdk": "git+https://github.com/Sorunome/matrix-js-bot-sdk.git#d7bd4433b908322d809a65a0793e2a54921aa1b0", | ||
"pg-promise": "^8.7.5", | ||
@@ -33,0 +34,0 @@ "request": "^2.88.2", |
@@ -25,2 +25,1 @@ /* | ||
export { IStringFormatterVars } from "./structures/stringformatter"; | ||
export { ExpireSet } from "./structures/expireset"; |
@@ -15,3 +15,3 @@ /* | ||
import { Lock } from "./lock"; | ||
import { ExpireSet } from "./expireset"; | ||
import ExpireSet from "expire-set"; | ||
@@ -18,0 +18,0 @@ const DEFAULT_LOCK_TIMEOUT = 30000; |
@@ -45,3 +45,3 @@ /* | ||
i += res.length; | ||
const ifComputed = StringFormatter.format(res.if, vars); | ||
const ifComputed = StringFormatter.condition(res.if, vars); | ||
if (ifComputed) { | ||
@@ -71,3 +71,3 @@ result += StringFormatter.format(res.then, vars); | ||
const char = pattern[i]; | ||
if (char.match(/[a-z]/)) { | ||
if (char.match(/[a-z0-9]/)) { | ||
length++; | ||
@@ -98,3 +98,3 @@ varName += char; | ||
if (char === "[") { | ||
const res = StringFormatter.scanBlock(pattern, i); | ||
const res = StringFormatter.scanBlock(pattern, i, "[]"); | ||
i += res.length - 1; | ||
@@ -124,3 +124,3 @@ length += res.length - 1; | ||
public static scanBlock(pattern: string, i: number): string { | ||
public static scanBlock(pattern: string, i: number, chars: string): string { | ||
let result = ""; | ||
@@ -134,5 +134,5 @@ let depth = 0; | ||
result += pattern[i]; | ||
} else if (char === "[") { | ||
} else if (char === chars[0]) { | ||
depth++; | ||
} else if (char === "]") { | ||
} else if (char === chars[1]) { | ||
depth--; | ||
@@ -146,2 +146,58 @@ if (depth === 0) { | ||
} | ||
public static condition(pattern: string, vars: IStringFormatterVars): string { | ||
let result = ""; | ||
for (let i = 0; i < pattern.length; i++) { | ||
const char = pattern[i]; | ||
switch (char) { | ||
case ":": { | ||
const res = StringFormatter.insertVar(pattern, vars, i); | ||
result += res.result; | ||
i += res.length; | ||
break; | ||
} | ||
case "=": { | ||
const res = StringFormatter.condition(pattern.substr(i+1), vars); | ||
if (res === result) { | ||
return res; | ||
} | ||
return ""; | ||
} | ||
case "|": { | ||
if (result) { | ||
return result; | ||
} | ||
return StringFormatter.condition(pattern.substr(i+1), vars); | ||
} | ||
case "&": { | ||
if (!result) { | ||
return ""; | ||
} | ||
return StringFormatter.condition(pattern.substr(i+1), vars); | ||
} | ||
case "^": { | ||
const res = StringFormatter.condition(pattern.substr(i+1), vars); | ||
const res1 = result ? 1 : 0; | ||
const res2 = res ? 1 : 0; | ||
if (res1 ^ res2) { | ||
return result || res; | ||
} | ||
return ""; | ||
} | ||
case "(": { | ||
const res = StringFormatter.scanBlock(pattern, i, "()"); | ||
i += res.length - 1; | ||
result += StringFormatter.condition(res.substring(1, res.length - 1), vars); | ||
break; | ||
} | ||
case "\\": | ||
i++; | ||
result += pattern[i]; | ||
break; | ||
default: | ||
result += char; | ||
} | ||
} | ||
return result; | ||
} | ||
} |
@@ -16,3 +16,3 @@ /* | ||
import { Log } from "./log"; | ||
import { ExpireSet } from "./structures/expireset"; | ||
import ExpireSet from "expire-set"; | ||
@@ -19,0 +19,0 @@ const log = new Log("TypingHandler"); |
Git dependency
Supply chain riskContains a dependency which resolves to a remote git URL. Dependencies fetched from git URLs are not immutable can be used to inject untrusted code or reduce the likelihood of a reproducible install.
Found 1 instance in 1 package
736723
18946
15
152
1
+ Addedexpire-set@^1.0.0
+ Addedexpire-set@1.0.0(transitive)
- Removed@types/body-parser@1.19.5(transitive)
- Removed@types/connect@3.4.38(transitive)
- Removed@types/express@4.17.21(transitive)
- Removed@types/express-serve-static-core@4.19.0(transitive)
- Removed@types/http-errors@2.0.4(transitive)
- Removed@types/mime@1.3.5(transitive)
- Removed@types/node@20.12.11(transitive)
- Removed@types/qs@6.9.15(transitive)
- Removed@types/range-parser@1.2.7(transitive)
- Removed@types/send@0.17.4(transitive)
- Removed@types/serve-static@1.15.7(transitive)
- Removedaccepts@1.3.8(transitive)
- Removedansi-styles@4.3.0(transitive)
- Removedarray-flatten@1.1.1(transitive)
- Removedbasic-auth@2.0.1(transitive)
- Removedbody-parser@1.20.2(transitive)
- Removedbytes@3.1.2(transitive)
- Removedcall-bind@1.0.7(transitive)
- Removedchalk@4.1.2(transitive)
- Removedcolor-convert@2.0.1(transitive)
- Removedcolor-name@1.1.4(transitive)
- Removedcontent-disposition@0.5.4(transitive)
- Removedcontent-type@1.0.5(transitive)
- Removedcookie@0.6.0(transitive)
- Removedcookie-signature@1.0.6(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddeepmerge@4.3.1(transitive)
- Removeddefine-data-property@1.1.4(transitive)
- Removeddepd@2.0.0(transitive)
- Removeddestroy@1.2.0(transitive)
- Removeddom-serializer@1.4.12.0.0(transitive)
- Removeddomelementtype@2.3.0(transitive)
- Removeddomhandler@3.3.04.3.15.0.3(transitive)
- Removeddomutils@2.8.03.1.0(transitive)
- Removedee-first@1.1.1(transitive)
- Removedencodeurl@1.0.2(transitive)
- Removedentities@2.2.04.5.0(transitive)
- Removedes-define-property@1.0.0(transitive)
- Removedes-errors@1.3.0(transitive)
- Removedescape-html@1.0.3(transitive)
- Removedescape-string-regexp@4.0.0(transitive)
- Removedetag@1.8.1(transitive)
- Removedexpress@4.19.2(transitive)
- Removedfinalhandler@1.2.0(transitive)
- Removedforwarded@0.2.0(transitive)
- Removedfresh@0.5.2(transitive)
- Removedfunction-bind@1.1.2(transitive)
- Removedget-intrinsic@1.2.4(transitive)
- Removedglob-to-regexp@0.4.1(transitive)
- Removedgopd@1.0.1(transitive)
- Removedgraceful-fs@4.2.11(transitive)
- Removedhas-flag@4.0.0(transitive)
- Removedhas-property-descriptors@1.0.2(transitive)
- Removedhas-proto@1.0.3(transitive)
- Removedhas-symbols@1.0.3(transitive)
- Removedhash.js@1.1.7(transitive)
- Removedhasown@2.0.2(transitive)
- Removedhe@1.2.0(transitive)
- Removedhtml-to-text@6.0.0(transitive)
- Removedhtmlencode@0.0.4(transitive)
- Removedhtmlparser2@4.1.08.0.2(transitive)
- Removedhttp-errors@2.0.0(transitive)
- Removediconv-lite@0.4.24(transitive)
- Removedipaddr.js@1.9.1(transitive)
- Removedis-plain-object@5.0.0(transitive)
- Removedis-promise@2.2.2(transitive)
- Removedlowdb@1.0.0(transitive)
- Removedlru-cache@6.0.0(transitive)
- Removedmatrix-bot-sdk@0.5.19(transitive)
- Removedmedia-typer@0.3.0(transitive)
- Removedmerge-descriptors@1.0.1(transitive)
- Removedmethods@1.1.2(transitive)
- Removedmime@1.6.0(transitive)
- Removedminimalistic-assert@1.0.1(transitive)
- Removedmkdirp@1.0.4(transitive)
- Removedmorgan@1.10.0(transitive)
- Removedms@2.0.0(transitive)
- Removednanoid@3.3.7(transitive)
- Removednegotiator@0.6.3(transitive)
- Removedobject-inspect@1.13.1(transitive)
- Removedon-finished@2.3.02.4.1(transitive)
- Removedon-headers@1.0.2(transitive)
- Removedparse-srcset@1.0.2(transitive)
- Removedparseurl@1.3.3(transitive)
- Removedpath-to-regexp@0.1.7(transitive)
- Removedpicocolors@1.0.0(transitive)
- Removedpify@3.0.0(transitive)
- Removedpostcss@8.4.38(transitive)
- Removedproxy-addr@2.0.7(transitive)
- Removedqs@6.11.0(transitive)
- Removedrange-parser@1.2.1(transitive)
- Removedraw-body@2.5.2(transitive)
- Removedsafe-buffer@5.2.1(transitive)
- Removedsanitize-html@2.13.0(transitive)
- Removedsend@0.18.0(transitive)
- Removedserve-static@1.15.0(transitive)
- Removedset-function-length@1.2.2(transitive)
- Removedsetprototypeof@1.2.0(transitive)
- Removedside-channel@1.0.6(transitive)
- Removedsource-map-js@1.2.0(transitive)
- Removedstatuses@2.0.1(transitive)
- Removedsteno@0.4.4(transitive)
- Removedsupports-color@7.2.0(transitive)
- Removedtoidentifier@1.0.1(transitive)
- Removedtype-is@1.6.18(transitive)
- Removedundici-types@5.26.5(transitive)
- Removedunpipe@1.0.0(transitive)
- Removedutils-merge@1.0.1(transitive)
- Removedvary@1.1.2(transitive)
- Removedyallist@4.0.0(transitive)