s3p 3.4.6 → 3.4.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/S3Parallel/Lib/S3Keys.js +1 -1
- package/build/S3Parallel/Lib/S3Keys.js.map +1 -1
- package/build/test/Lib/S3Keys.test.js +1 -1
- package/build/test/Lib/S3Keys.test.js.map +1 -1
- package/package.json +1 -1
- package/source/S3Parallel/Lib/S3Keys.caf +30 -3
- package/source/test/Lib/S3Keys.test.caf +41 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
"use strict"
|
|
2
2
|
let Caf = require('caffeine-script-runtime');
|
|
3
|
-
Caf.defMod(module, () => {return Caf.importInvoke(["peek", "Error", "formattedInspect", "pad", "Math"], [global, require('../StandardImport')], (peek, Error, formattedInspect, pad, Math) => {let supportedKeyChars, maxKeyLength, lastKeyChar, middleKeyChar, getKeyCharIndex, getUpToNextSlash, getBisectKey, escapeKey, padKey, getLastKeyWithPrefix, debugKey; return {supportedKeyChars: supportedKeyChars = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~', maxKeyLength: maxKeyLength = 1024, lastKeyChar: lastKeyChar = peek(supportedKeyChars), middleKeyChar: middleKeyChar = supportedKeyChars[supportedKeyChars.length / 2 | 0], getKeyCharIndex: getKeyCharIndex = function(character) {return character ? supportedKeyChars.indexOf(character) : 0;}, getUpToNextSlash: getUpToNextSlash = function(key, i) {let m, found; m = key.slice(i, key.length).match(/(^[^\/]*)\//); return (found = Caf.exists(m) && m[0]) ? key.slice(0, i + found.length) : undefined;}, getBisectKey: getBisectKey = function(startAfter, stopAt, bisectPrefix) {let i, lastCommonSlash, charIndex1, charIndex2, bisectKey, prefixBisectI, key; return (startAfter < stopAt) ? (i = 0, lastCommonSlash = null, (() => {while (startAfter[i] === stopAt[i]) {if (startAfter[i] === "/") {lastCommonSlash = i;}; i++;};})(), charIndex1 = (i === startAfter.length) ? 0 : getKeyCharIndex(startAfter[i]), charIndex2 = getKeyCharIndex(stopAt[i]), (charIndex1 < 0 || charIndex2 < 0) ? (() => {throw new Error("Invalid character found in inputs:\n" + formattedInspect({startAfter, stopAt, i, charIndex1, charIndex2, supportedKeyChars}));})() : undefined, bisectKey = (() => {switch (false) {case !(bisectPrefix && (i < (prefixBisectI = (i + startAfter.length) / 2 | 0) && (key = getUpToNextSlash(startAfter, (lastCommonSlash != null) ? lastCommonSlash + 1 : 0)))): return getLastKeyWithPrefix(key); case !(charIndex1 + 1 === charIndex2): return startAfter.slice(0, i + 1) + supportedKeyChars[(supportedKeyChars.length - 1 + getKeyCharIndex(startAfter[i + 1])) / 2 | 0]; default: return startAfter.slice(0, i) + supportedKeyChars[(charIndex1 + charIndex2) / 2 | 0];};})(), !(startAfter <= bisectKey && bisectKey <= stopAt) ? (() => {throw new Error(`Whoops! ${Caf.toString(startAfter)} <= ${Caf.toString(bisectKey)} <= ${Caf.toString(stopAt)} -- something's not right`);})() : undefined, bisectKey) : undefined;}, escapeKey: escapeKey = function(key) {return /[\s()]/.test(key) ? `"${Caf.toString(key)}"` : key;}, padKey: padKey = function(key) {return pad(key, 20 * Math.ceil(key.length / 20));}, getLastKeyWithPrefix: getLastKeyWithPrefix = function(prefix) {return (prefix.length < maxKeyLength) ? prefix + lastKeyChar.repeat(maxKeyLength - prefix.length) : undefined;}, debugKey: debugKey = function(key, shouldPad = true) {let tail, i, lastIndex; return (key != null) ? (tail = 0, i = lastIndex = key.length - 1, (() => {while (key[i] === lastKeyChar) {i--;};})(), key = (() => {switch (false) {case !(key === ""): return "''"; case !(i < lastIndex): return escapeKey(key.slice(0, i + 1)) + `(${Caf.toString(lastKeyChar)}*${Caf.toString(lastIndex - i)})`; default: return escapeKey(key);};})(), shouldPad ? padKey(key) : key) : `(${Caf.toString("" + key)})`;}};});});
|
|
3
|
+
Caf.defMod(module, () => {return Caf.importInvoke(["peek", "Error", "formattedInspect", "pad", "Math"], [global, require('../StandardImport')], (peek, Error, formattedInspect, pad, Math) => {let supportedKeyChars, maxKeyLength, lastKeyChar, middleKeyChar, getKeyCharIndex, getUpToNextSlash, getBisectKey, isLastKey, getNextKey, escapeKey, padKey, getLastKeyWithPrefix, debugKey; return {supportedKeyChars: supportedKeyChars = ' !"#$%&\'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~', maxKeyLength: maxKeyLength = 1024, lastKeyChar: lastKeyChar = peek(supportedKeyChars), middleKeyChar: middleKeyChar = supportedKeyChars[supportedKeyChars.length / 2 | 0], getKeyCharIndex: getKeyCharIndex = function(character) {return character ? supportedKeyChars.indexOf(character) : 0;}, getUpToNextSlash: getUpToNextSlash = function(key, i) {let m, found; m = key.slice(i, key.length).match(/(^[^\/]*)\//); return (found = Caf.exists(m) && m[0]) ? key.slice(0, i + found.length) : undefined;}, getBisectKey: getBisectKey = function(startAfter, stopAt, bisectPrefix) {let i, lastCommonSlash, charIndex1, charIndex2, bisectKey, prefixBisectI, key; return (startAfter < stopAt) ? (i = 0, lastCommonSlash = null, (() => {while (startAfter[i] === stopAt[i]) {if (startAfter[i] === "/") {lastCommonSlash = i;}; i++;};})(), charIndex1 = (i === startAfter.length) ? 0 : getKeyCharIndex(startAfter[i]), charIndex2 = getKeyCharIndex(stopAt[i]), (charIndex1 < 0 || charIndex2 < 0) ? (() => {throw new Error("Invalid character found in inputs:\n" + formattedInspect({startAfter, stopAt, i, charIndex1, charIndex2, supportedKeyChars}));})() : undefined, bisectKey = (() => {switch (false) {case !(bisectPrefix && (i < (prefixBisectI = (i + startAfter.length) / 2 | 0) && (key = getUpToNextSlash(startAfter, (lastCommonSlash != null) ? lastCommonSlash + 1 : 0)))): return getLastKeyWithPrefix(key); case !(charIndex1 + 1 === charIndex2): return (startAfter[i + 1] === lastKeyChar) ? getNextKey(startAfter) : startAfter.slice(0, i + 1) + supportedKeyChars[(supportedKeyChars.length - 1 + getKeyCharIndex(startAfter[i + 1])) / 2 | 0]; default: return startAfter.slice(0, i) + supportedKeyChars[(charIndex1 + charIndex2) / 2 | 0];};})(), !(bisectKey.length <= maxKeyLength) ? (() => {throw new Error(`Whoops! bisectKey too long ${Caf.toString(formattedInspect({startAfter, stopAt, bisectPrefix, bisectKey, maxKeyLength, bisectKeyLength: bisectKey.length}))}`);})() : undefined, !(startAfter <= bisectKey && bisectKey <= stopAt) ? (() => {throw new Error(`Whoops! ${Caf.toString(formattedInspect(startAfter))} <=(${Caf.toString(startAfter <= bisectKey)}) ${Caf.toString(formattedInspect(bisectKey))} <=(${Caf.toString(bisectKey <= stopAt)}) ${Caf.toString(formattedInspect(stopAt))} (bisectPrefix=${Caf.toString(formattedInspect(bisectPrefix))})-- something's not right`);})() : undefined, bisectKey) : undefined;}, isLastKey: isLastKey = function(key) {return RegExp(`^[${Caf.toString(lastKeyChar)}]+\$`).test(key);}, getNextKey: getNextKey = function(key) {let i, temp; return (key.length < maxKeyLength) ? key + lastKeyChar : (i = maxKeyLength - 1, isLastKey(key) ? (() => {throw new Error(`getNextKey error: key is aleady the very last key possible: ${Caf.toString(formattedInspect(key))}`);})() : undefined, (() => {while (i > -1) {if (key[i] !== lastKeyChar) {return key.slice(0, i) + supportedKeyChars[getKeyCharIndex(key[i]) + 1];}; temp = i--;}; return temp;})());}, escapeKey: escapeKey = function(key) {return /[\s()]/.test(key) ? `"${Caf.toString(key)}"` : key;}, padKey: padKey = function(key) {return pad(key, 20 * Math.ceil(key.length / 20));}, getLastKeyWithPrefix: getLastKeyWithPrefix = function(prefix) {return (prefix.length < maxKeyLength) ? prefix + lastKeyChar.repeat(maxKeyLength - prefix.length) : undefined;}, debugKey: debugKey = function(key, shouldPad = true) {let tail, i, lastIndex; return (key != null) ? (tail = 0, i = lastIndex = key.length - 1, (() => {while (key[i] === lastKeyChar) {i--;};})(), key = (() => {switch (false) {case !(key === ""): return "''"; case !(i < lastIndex): return escapeKey(key.slice(0, i + 1)) + `(${Caf.toString(lastKeyChar)}*${Caf.toString(lastIndex - i)})`; default: return escapeKey(key);};})(), shouldPad ? padKey(key) : key) : `(${Caf.toString("" + key)})`;}};});});
|
|
4
4
|
//# sourceMappingURL=S3Keys.js.map
|
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
"source/S3Parallel/Lib/S3Keys.caf"
|
|
7
7
|
],
|
|
8
8
|
"names": [],
|
|
9
|
-
"mappings": "AAAA;;AAAA,iHAAO,
|
|
9
|
+
"mappings": "AAAA;;AAAA,iHAAO,0QAEP,QACE,uCACI,qGAEJ,6BAAe,MACf,2BAAc,KAAK,oBACnB,+BAAgB,kBAA0C,2BAAG,IAAI,IAEjE,mCAAe,QAAG,CAAC,YAAc,OAAG,YAAe,0BAA0B,aAAe,KAE5F,qCAAgB,QAAG,CAAC,KAAK,kBACvB,IACE,UAAU,GAAG,kBACN,uBACN,oBAAQ,QAAG,MAAQ,UAAU,GAAG,IAAI,6BA6BzC,6BAAY,QAAG,CAAC,YAAY,QAAQ,8FAAiB,OAAG,cAAa,UAAM,CACzE,IAAI,GACJ,kBAAkB,MAClB,eAAM,WAAW,OAAM,OAAO,KAC5B,IAAG,WAAW,OAAM,MAClB,kBAAkB,KACpB,YAEF,aAAgB,OAAM,qBAAuB,IAAO,gBAAgB,WAAW,KAC/E,aAAa,gBAAgB,OAAO,KAEjC,CAAU,aAAG,KAAK,aAAa,KAChC,cAAM,IAAI,MAAM,yCAAyC,kBAAoB,YAAY,QAAQ,GAAG,YAAY,YAAY,uCAE9H,YACE,wBAAM,MACD,iBACD,KAAI,iBAAuC,0BAAG,IAAI,MAC/C,OAAM,iBAAiB,YAAY,CAAG,2BAAsB,kBAAkB,IAAO,OAAC,OAE3F,qBAAqB,MAAG,MAGrB,CAAU,aAAG,MAAK,aAAU,OAC5B,YAAW,IAAI,OAAM,eAItB,WAAW,cAIX,iBAAiB,GAAG,IAAI,KACtB,kBAAqF,sEAAG,IAAI,aAE9F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
Caf.defMod(module, () => {return Caf.importInvoke(["describe", "test", "assert", "getUpToNextSlash", "debugKey", "repeat", "lastKeyChar", "getBisectKey", "middleKeyChar", "getLastKeyWithPrefix"], [global, require('../StandardImport')], (describe, test, assert, getUpToNextSlash, debugKey, repeat, lastKeyChar, getBisectKey, middleKeyChar, getLastKeyWithPrefix) => {return describe({getUpToNextSlash: function() {test(":this/is/ok 0 -> :this/ ", () => assert.eq("this/", getUpToNextSlash("this/is/ok", 0))); test(":this/is/ok 4 -> :this/ ", () => assert.eq("this/", getUpToNextSlash("this/is/ok", 4))); test(":this/is/ok 5 -> :this/is/", () => assert.eq("this/is/", getUpToNextSlash("this/is/ok", 5))); test(":this/is/ok 6 -> :this/is/", () => assert.eq("this/is/", getUpToNextSlash("this/is/ok", 6))); test(":this/is/ok 7 -> :this/is/", () => assert.eq("this/is/", getUpToNextSlash("this/is/ok", 7))); test("undefined if no /", () => assert.eq(undefined, getUpToNextSlash("this", 0))); test("undefined if > last /", () => assert.eq(undefined, getUpToNextSlash("this/is/okthere", 10))); return test("undefined if > length", () => assert.eq(undefined, getUpToNextSlash("this/is/ok", 100)));}, debugKey: function() {test("debugKey :a", () => assert.match(debugKey("a"), /^a +$/)); test("debugKey ''", () => assert.match(debugKey(""), "'' ")); return test("debugKey :ab~~~~~~~~~~~", () => assert.eq(debugKey("ab" + repeat(lastKeyChar, 10)), "ab(~*10) "));}, getBisectKey: {nulls_and_errors: function() {test("matching returns null", () => assert.notPresent(getBisectKey("a", "a"))); test("invalid char in first param", () => assert.rejects(() => getBisectKey("\n", "a"))); test("invalid char in second param", () => assert.rejects(() => getBisectKey("b", "😀"))); return test("reverse-order returns null", () => assert.notPresent(getBisectKey("b", "a")));}, basic: function() {test(":alpha :alphadude -> :b", () => assert.eq("alphaB", getBisectKey("alpha", "alphadude"))); test('"alpha" "alpha me" -> "alpha "', () => assert.eq("alpha ", getBisectKey("alpha", "alpha me"))); test('"alpha" "alpha " -> "alpha "', () => assert.eq("alpha ", getBisectKey("alpha", "alpha "))); test(":a :c -> :b", () => assert.eq("b", getBisectKey("a", "c"))); test(":alphabet :c -> :b", () => assert.eq("b", getBisectKey("alphabet", "c"))); test(":aa :ac -> :ab", () => assert.eq(`aa${Caf.toString(middleKeyChar)}`, getBisectKey("aa", "ab"))); return test("with spaces", () => assert.eq("My `", getBisectKey("My Other thing.bar", "My report.foo")));}, bisectPrefix: {dirAware: function() {return Caf.each2([["alpha/beta", "z", getLastKeyWithPrefix("alpha/")], ["alpha/beta/gamma", "alpha/boomTown", getLastKeyWithPrefix("alpha/beta/")], ["alpha/beta", "alpha/foo", "alpha/d"], ["run2/bcl-sync-status/39e8278706c47520c03865b84b06921a", "u", getLastKeyWithPrefix("run2/")]], ([a, b, out]) => test(`${Caf.toString(a)} ${Caf.toString(b)} -> ${Caf.toString(out.slice(0, 25))}${Caf.toString((out.length > 25) ? "..." : undefined)}`, () => assert.eq(out, getBisectKey(a, b, true))));}, basic: function() {test(":a :c -> :b~...", () => assert.eq("b", getBisectKey("a", "c", true))); test('"alpha" "alpha me" -> "alpha "', () => assert.eq("alpha ", getBisectKey("alpha", "alpha me", true))); test(":alpha :alphadude -> :alphaB", () => assert.eq("alphaB", getBisectKey("alpha", "alphadude", true))); test(":alphabet :c -> :alph~...", () => assert.eq("b", getBisectKey("alphabet", "c", true))); return test(":alphabet :alpi -> :alpha~...", () => assert.eq("alpho", getBisectKey("alphabet", "alpi", true)));}}, regressions: function() {test(":alpha :T -> notPresent", () => assert.notPresent(getBisectKey("alpha", "T"))); test(`:alpha :alphb -> :alpha${Caf.toString(middleKeyChar)}`, () => assert.eq(`alpha${Caf.toString(middleKeyChar)}`, getBisectKey("alpha", "alphb")));
|
|
3
|
+
Caf.defMod(module, () => {return Caf.importInvoke(["describe", "test", "assert", "getUpToNextSlash", "debugKey", "repeat", "lastKeyChar", "pad", "getNextKey", "isLastKey", "getBisectKey", "middleKeyChar", "getLastKeyWithPrefix"], [global, require('../StandardImport')], (describe, test, assert, getUpToNextSlash, debugKey, repeat, lastKeyChar, pad, getNextKey, isLastKey, getBisectKey, middleKeyChar, getLastKeyWithPrefix) => {return describe({getUpToNextSlash: function() {test(":this/is/ok 0 -> :this/ ", () => assert.eq("this/", getUpToNextSlash("this/is/ok", 0))); test(":this/is/ok 4 -> :this/ ", () => assert.eq("this/", getUpToNextSlash("this/is/ok", 4))); test(":this/is/ok 5 -> :this/is/", () => assert.eq("this/is/", getUpToNextSlash("this/is/ok", 5))); test(":this/is/ok 6 -> :this/is/", () => assert.eq("this/is/", getUpToNextSlash("this/is/ok", 6))); test(":this/is/ok 7 -> :this/is/", () => assert.eq("this/is/", getUpToNextSlash("this/is/ok", 7))); test("undefined if no /", () => assert.eq(undefined, getUpToNextSlash("this", 0))); test("undefined if > last /", () => assert.eq(undefined, getUpToNextSlash("this/is/okthere", 10))); return test("undefined if > length", () => assert.eq(undefined, getUpToNextSlash("this/is/ok", 100)));}, debugKey: function() {test("debugKey :a", () => assert.match(debugKey("a"), /^a +$/)); test("debugKey ''", () => assert.match(debugKey(""), "'' ")); return test("debugKey :ab~~~~~~~~~~~", () => assert.eq(debugKey("ab" + repeat(lastKeyChar, 10)), "ab(~*10) "));}, getNextKey: function() {let nextKeyMap; nextKeyMap = {a: "a~", "~": "~~", [pad("b", 1023, "~")]: pad("b", 1024, "~"), [pad("b", 1024, "~")]: "c", [pad("bc", 1024, "~")]: "bd", [pad("b~c", 1024, "~")]: "b~d"}; Caf.each2(nextKeyMap, (nextKey, key) => test(`getNextKey ${Caf.toString(key)} >>> ${Caf.toString(nextKey)}`, () => assert.eq(nextKey, getNextKey(key)))); test("isLastKey (the very last key) >>> error", () => assert.true(isLastKey(pad("", 1024, "~")))); return test("getNextKey (the very last key) >>> error", () => {let lastKey; lastKey = pad("", 1024, "~"); return assert.throws(() => getNextKey(lastKey));});}, getBisectKey: {nulls_and_errors: function() {test("matching returns null", () => assert.notPresent(getBisectKey("a", "a"))); test("invalid char in first param", () => assert.rejects(() => getBisectKey("\n", "a"))); test("invalid char in second param", () => assert.rejects(() => getBisectKey("b", "😀"))); return test("reverse-order returns null", () => assert.notPresent(getBisectKey("b", "a")));}, basic: function() {test(":alpha :alphadude -> :b", () => assert.eq("alphaB", getBisectKey("alpha", "alphadude"))); test('"alpha" "alpha me" -> "alpha "', () => assert.eq("alpha ", getBisectKey("alpha", "alpha me"))); test('"alpha" "alpha " -> "alpha "', () => assert.eq("alpha ", getBisectKey("alpha", "alpha "))); test(":a :c -> :b", () => assert.eq("b", getBisectKey("a", "c"))); test(":alphabet :c -> :b", () => assert.eq("b", getBisectKey("alphabet", "c"))); test(":aa :ac -> :ab", () => assert.eq(`aa${Caf.toString(middleKeyChar)}`, getBisectKey("aa", "ab"))); return test("with spaces", () => assert.eq("My `", getBisectKey("My Other thing.bar", "My report.foo")));}, bisectPrefix: {dirAware: function() {return Caf.each2([["alpha/beta", "z", getLastKeyWithPrefix("alpha/")], ["alpha/beta/gamma", "alpha/boomTown", getLastKeyWithPrefix("alpha/beta/")], ["alpha/beta", "alpha/foo", "alpha/d"], ["run2/bcl-sync-status/39e8278706c47520c03865b84b06921a", "u", getLastKeyWithPrefix("run2/")]], ([a, b, out]) => test(`${Caf.toString(a)} ${Caf.toString(b)} -> ${Caf.toString(out.slice(0, 25))}${Caf.toString((out.length > 25) ? "..." : undefined)}`, () => assert.eq(out, getBisectKey(a, b, true))));}, basic: function() {test(":a :c -> :b~...", () => assert.eq("b", getBisectKey("a", "c", true))); test('"alpha" "alpha me" -> "alpha "', () => assert.eq("alpha ", getBisectKey("alpha", "alpha me", true))); test(":alpha :alphadude -> :alphaB", () => assert.eq("alphaB", getBisectKey("alpha", "alphadude", true))); test(":alphabet :c -> :alph~...", () => assert.eq("b", getBisectKey("alphabet", "c", true))); return test(":alphabet :alpi -> :alpha~...", () => assert.eq("alpho", getBisectKey("alphabet", "alpi", true)));}}, regressions: function() {test(":alpha :T -> notPresent", () => assert.notPresent(getBisectKey("alpha", "T"))); test(`:alpha :alphb -> :alpha${Caf.toString(middleKeyChar)}`, () => assert.eq(`alpha${Caf.toString(middleKeyChar)}`, getBisectKey("alpha", "alphb"))); test(":./.git/objects/17/3d216b08fff7c71eeb7bf1c7d5e8aef789461e :./.git/obk -> :./.git/objq", () => assert.eq("./.git/objq", getBisectKey("./.git/objects/17/3d216b08fff7c71eeb7bf1c7d5e8aef789461e", "./.git/obk"))); test("tildeSpecial: :2/~~ :20 -> :2/~~~", () => assert.eq("2/~~~", getBisectKey("2/~~", "20"))); test("tildeSpecial: :2/~~(+1020 more) :20999 -> :20", () => assert.eq("20", getBisectKey(pad("2/", 1024, "~"), "20999"))); test("tildeSpecial: :2/~~(+1020 more) :20 -> :20", () => assert.eq("20", getBisectKey(pad("2/", 1024, "~"), "20"))); return test("tildeSpecial: original regression", () => assert.eq("filestores/kss/20", getBisectKey("filestores/kss/2/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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AO,YAAW,SAEvD,KACI,sCACC,UAAU,UAAQ,aAAa,SAAO,aAAW,SAEtD,KACI,mCACC,UACD,KACA,aAAa,YAAU,KAAG,gBAE9B,KACI,uCACC,UACD,SACA,aAAa,YAAU,QAAM,YAErC,yBACE,KACI,iCACC,kBAAkB,aAAa,SAAO,QAE3C,4CAC8B,wBACzB,+BAAkB,kBAAgB,aAAa,SAAO,YAE3D,KACI,+FACC,UAAU,eAAa,aAAa,4DAA0D,iBAEnG,KACI,2CACC,UAAU,SAAO,aAAa,QAAM,SAEzC,KACI,uDACC,UAAU,MAAI,aAAa,IAAI,MAAM,MAAM,MAAM,YAEtD,KACI,oDACC,UAAU,MAAI,aAAa,IAAI,MAAM,MAAM,MAAM,gBAEtD,KACI,2CAEA,UACE,qBACA,aACE,ogCACA"
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -65,19 +65,46 @@ import &StandardImport
|
|
|
65
65
|
|
|
66
66
|
getLastKeyWithPrefix key
|
|
67
67
|
|
|
68
|
+
# no gap between the first non-matching character
|
|
68
69
|
when charIndex1 + 1 == charIndex2
|
|
69
|
-
startAfter
|
|
70
|
-
|
|
70
|
+
if startAfter[i + 1] == lastKeyChar
|
|
71
|
+
# just increment startAfter
|
|
72
|
+
# technically, a slightly better pick might be to find the first non lastKeyChar after (i + 1)
|
|
73
|
+
# and then bisect between that character and lastKeyChar
|
|
74
|
+
getNextKey startAfter
|
|
75
|
+
|
|
76
|
+
else
|
|
77
|
+
# bisect between the lastKeyChar and startAfter[i + 1]
|
|
78
|
+
startAfter.slice 0, i + 1
|
|
79
|
+
+ supportedKeyChars[(supportedKeyChars.length - 1 + getKeyCharIndex startAfter[i + 1]) / 2 | 0]
|
|
71
80
|
|
|
72
81
|
else
|
|
73
82
|
startAfter.slice 0, i
|
|
74
83
|
+ supportedKeyChars[(charIndex1 + charIndex2) / 2 | 0]
|
|
75
84
|
|
|
85
|
+
unless bisectKey.length <= maxKeyLength
|
|
86
|
+
throw new Error "" Whoops! bisectKey too long #{} formattedInspect {} startAfter, stopAt, bisectPrefix, bisectKey, maxKeyLength, bisectKeyLength: bisectKey.length
|
|
76
87
|
unless startAfter <= bisectKey && bisectKey <= stopAt
|
|
77
|
-
throw new Error "Whoops! #{startAfter} <= #{bisectKey} <= #{stopAt} -- something's not right"
|
|
88
|
+
throw new Error "Whoops! #{formattedInspect startAfter} <=(#{startAfter <= bisectKey}) #{formattedInspect bisectKey} <=(#{bisectKey <= stopAt}) #{formattedInspect stopAt} (bisectPrefix=#{formattedInspect bisectPrefix})-- something's not right"
|
|
78
89
|
|
|
79
90
|
bisectKey
|
|
80
91
|
|
|
92
|
+
isLastKey = (key) ->
|
|
93
|
+
/// ^[#{lastKeyChar}]+$
|
|
94
|
+
.test key
|
|
95
|
+
|
|
96
|
+
getNextKey = (key) ->
|
|
97
|
+
if key.length < maxKeyLength
|
|
98
|
+
key + lastKeyChar
|
|
99
|
+
else
|
|
100
|
+
i = maxKeyLength - 1
|
|
101
|
+
if isLastKey key
|
|
102
|
+
throw new Error "getNextKey error: key is aleady the very last key possible: #{formattedInspect key}"
|
|
103
|
+
|
|
104
|
+
while i > -1
|
|
105
|
+
if key[i] != lastKeyChar
|
|
106
|
+
return key.slice(0, i) + supportedKeyChars[getKeyCharIndex(key[i]) + 1]
|
|
107
|
+
i--
|
|
81
108
|
|
|
82
109
|
escapeKey = (key) ->
|
|
83
110
|
if /[\s()]/.test key
|
|
@@ -27,6 +27,26 @@ describe
|
|
|
27
27
|
debugKey :ab + repeat lastKeyChar, 10
|
|
28
28
|
"ab(~*10) "
|
|
29
29
|
|
|
30
|
+
getNextKey: ->
|
|
31
|
+
nextKeyMap =
|
|
32
|
+
a: :a~
|
|
33
|
+
~: :~~
|
|
34
|
+
[pad :b, 1023, :~]: pad :b, 1024, :~
|
|
35
|
+
[pad :b, 1024, :~]: :c
|
|
36
|
+
[pad :bc, 1024, :~]: :bd
|
|
37
|
+
[pad :b~c, 1024, :~]: :b~d
|
|
38
|
+
|
|
39
|
+
each nextKey, key in nextKeyMap
|
|
40
|
+
test "getNextKey #{key} >>> #{nextKey}" ->
|
|
41
|
+
assert.eq nextKey, getNextKey key
|
|
42
|
+
|
|
43
|
+
test "isLastKey (the very last key) >>> error" ->
|
|
44
|
+
assert.true isLastKey pad '', 1024, '~'
|
|
45
|
+
|
|
46
|
+
test "getNextKey (the very last key) >>> error" ->
|
|
47
|
+
lastKey = pad '', 1024, '~'
|
|
48
|
+
assert.throws -> getNextKey lastKey
|
|
49
|
+
|
|
30
50
|
getBisectKey:
|
|
31
51
|
|
|
32
52
|
nulls_and_errors: ->
|
|
@@ -127,3 +147,24 @@ describe
|
|
|
127
147
|
test
|
|
128
148
|
"" :./.git/objects/17/3d216b08fff7c71eeb7bf1c7d5e8aef789461e :./.git/obk -> :./.git/objq
|
|
129
149
|
-> assert.eq :./.git/objq getBisectKey :./.git/objects/17/3d216b08fff7c71eeb7bf1c7d5e8aef789461e :./.git/obk
|
|
150
|
+
|
|
151
|
+
test
|
|
152
|
+
"" tildeSpecial: :2/~~ :20 -> :2/~~~
|
|
153
|
+
-> assert.eq :2/~~~ getBisectKey :2/~~ :20
|
|
154
|
+
|
|
155
|
+
test
|
|
156
|
+
"" tildeSpecial: :2/~~(+1020 more) :20999 -> :20
|
|
157
|
+
-> assert.eq :20 getBisectKey pad("2/", 1024, "~"), :20999
|
|
158
|
+
|
|
159
|
+
test
|
|
160
|
+
"" tildeSpecial: :2/~~(+1020 more) :20 -> :20
|
|
161
|
+
-> assert.eq :20 getBisectKey pad("2/", 1024, "~"), :20
|
|
162
|
+
|
|
163
|
+
test
|
|
164
|
+
"" tildeSpecial: original regression
|
|
165
|
+
->
|
|
166
|
+
assert.eq
|
|
167
|
+
:filestores/kss/20
|
|
168
|
+
getBisectKey
|
|
169
|
+
:filestores/kss/2/~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~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