@atproto/aws 0.1.6 → 0.1.8
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/CHANGELOG.md +14 -0
- package/LICENSE.txt +1 -1
- package/dist/bunny.d.ts +1 -1
- package/dist/cloudfront.d.ts +1 -1
- package/dist/index.js +797 -41
- package/dist/index.js.map +3 -3
- package/dist/kms.d.ts +1 -1
- package/dist/s3.d.ts +8 -2
- package/package.json +2 -2
- package/src/s3.ts +53 -13
package/dist/index.js
CHANGED
|
@@ -91867,30 +91867,292 @@ var require_dist2 = __commonJS({
|
|
|
91867
91867
|
}
|
|
91868
91868
|
});
|
|
91869
91869
|
|
|
91870
|
-
// ../../node_modules/.pnpm/
|
|
91870
|
+
// ../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/process.js
|
|
91871
|
+
var require_process = __commonJS({
|
|
91872
|
+
"../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/process.js"(exports, module2) {
|
|
91873
|
+
"use strict";
|
|
91874
|
+
var isLinux = () => process.platform === "linux";
|
|
91875
|
+
var report = null;
|
|
91876
|
+
var getReport = () => {
|
|
91877
|
+
if (!report) {
|
|
91878
|
+
report = isLinux() && process.report ? process.report.getReport() : {};
|
|
91879
|
+
}
|
|
91880
|
+
return report;
|
|
91881
|
+
};
|
|
91882
|
+
module2.exports = { isLinux, getReport };
|
|
91883
|
+
}
|
|
91884
|
+
});
|
|
91885
|
+
|
|
91886
|
+
// ../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/filesystem.js
|
|
91887
|
+
var require_filesystem = __commonJS({
|
|
91888
|
+
"../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/filesystem.js"(exports, module2) {
|
|
91889
|
+
"use strict";
|
|
91890
|
+
var fs3 = require("fs");
|
|
91891
|
+
var LDD_PATH = "/usr/bin/ldd";
|
|
91892
|
+
var readFileSync = (path) => fs3.readFileSync(path, "utf-8");
|
|
91893
|
+
var readFile = (path) => new Promise((resolve, reject) => {
|
|
91894
|
+
fs3.readFile(path, "utf-8", (err, data) => {
|
|
91895
|
+
if (err) {
|
|
91896
|
+
reject(err);
|
|
91897
|
+
} else {
|
|
91898
|
+
resolve(data);
|
|
91899
|
+
}
|
|
91900
|
+
});
|
|
91901
|
+
});
|
|
91902
|
+
module2.exports = {
|
|
91903
|
+
LDD_PATH,
|
|
91904
|
+
readFileSync,
|
|
91905
|
+
readFile
|
|
91906
|
+
};
|
|
91907
|
+
}
|
|
91908
|
+
});
|
|
91909
|
+
|
|
91910
|
+
// ../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/detect-libc.js
|
|
91911
|
+
var require_detect_libc = __commonJS({
|
|
91912
|
+
"../../node_modules/.pnpm/detect-libc@2.0.2/node_modules/detect-libc/lib/detect-libc.js"(exports, module2) {
|
|
91913
|
+
"use strict";
|
|
91914
|
+
var childProcess = require("child_process");
|
|
91915
|
+
var { isLinux, getReport } = require_process();
|
|
91916
|
+
var { LDD_PATH, readFile, readFileSync } = require_filesystem();
|
|
91917
|
+
var cachedFamilyFilesystem;
|
|
91918
|
+
var cachedVersionFilesystem;
|
|
91919
|
+
var command = "getconf GNU_LIBC_VERSION 2>&1 || true; ldd --version 2>&1 || true";
|
|
91920
|
+
var commandOut = "";
|
|
91921
|
+
var safeCommand = () => {
|
|
91922
|
+
if (!commandOut) {
|
|
91923
|
+
return new Promise((resolve) => {
|
|
91924
|
+
childProcess.exec(command, (err, out) => {
|
|
91925
|
+
commandOut = err ? " " : out;
|
|
91926
|
+
resolve(commandOut);
|
|
91927
|
+
});
|
|
91928
|
+
});
|
|
91929
|
+
}
|
|
91930
|
+
return commandOut;
|
|
91931
|
+
};
|
|
91932
|
+
var safeCommandSync = () => {
|
|
91933
|
+
if (!commandOut) {
|
|
91934
|
+
try {
|
|
91935
|
+
commandOut = childProcess.execSync(command, { encoding: "utf8" });
|
|
91936
|
+
} catch (_err) {
|
|
91937
|
+
commandOut = " ";
|
|
91938
|
+
}
|
|
91939
|
+
}
|
|
91940
|
+
return commandOut;
|
|
91941
|
+
};
|
|
91942
|
+
var GLIBC = "glibc";
|
|
91943
|
+
var RE_GLIBC_VERSION = /GLIBC\s(\d+\.\d+)/;
|
|
91944
|
+
var MUSL = "musl";
|
|
91945
|
+
var GLIBC_ON_LDD = GLIBC.toUpperCase();
|
|
91946
|
+
var MUSL_ON_LDD = MUSL.toLowerCase();
|
|
91947
|
+
var isFileMusl = (f) => f.includes("libc.musl-") || f.includes("ld-musl-");
|
|
91948
|
+
var familyFromReport = () => {
|
|
91949
|
+
const report = getReport();
|
|
91950
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
91951
|
+
return GLIBC;
|
|
91952
|
+
}
|
|
91953
|
+
if (Array.isArray(report.sharedObjects)) {
|
|
91954
|
+
if (report.sharedObjects.some(isFileMusl)) {
|
|
91955
|
+
return MUSL;
|
|
91956
|
+
}
|
|
91957
|
+
}
|
|
91958
|
+
return null;
|
|
91959
|
+
};
|
|
91960
|
+
var familyFromCommand = (out) => {
|
|
91961
|
+
const [getconf, ldd1] = out.split(/[\r\n]+/);
|
|
91962
|
+
if (getconf && getconf.includes(GLIBC)) {
|
|
91963
|
+
return GLIBC;
|
|
91964
|
+
}
|
|
91965
|
+
if (ldd1 && ldd1.includes(MUSL)) {
|
|
91966
|
+
return MUSL;
|
|
91967
|
+
}
|
|
91968
|
+
return null;
|
|
91969
|
+
};
|
|
91970
|
+
var getFamilyFromLddContent = (content) => {
|
|
91971
|
+
if (content.includes(MUSL_ON_LDD)) {
|
|
91972
|
+
return MUSL;
|
|
91973
|
+
}
|
|
91974
|
+
if (content.includes(GLIBC_ON_LDD)) {
|
|
91975
|
+
return GLIBC;
|
|
91976
|
+
}
|
|
91977
|
+
return null;
|
|
91978
|
+
};
|
|
91979
|
+
var familyFromFilesystem = async () => {
|
|
91980
|
+
if (cachedFamilyFilesystem !== void 0) {
|
|
91981
|
+
return cachedFamilyFilesystem;
|
|
91982
|
+
}
|
|
91983
|
+
cachedFamilyFilesystem = null;
|
|
91984
|
+
try {
|
|
91985
|
+
const lddContent = await readFile(LDD_PATH);
|
|
91986
|
+
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
91987
|
+
} catch (e) {
|
|
91988
|
+
}
|
|
91989
|
+
return cachedFamilyFilesystem;
|
|
91990
|
+
};
|
|
91991
|
+
var familyFromFilesystemSync = () => {
|
|
91992
|
+
if (cachedFamilyFilesystem !== void 0) {
|
|
91993
|
+
return cachedFamilyFilesystem;
|
|
91994
|
+
}
|
|
91995
|
+
cachedFamilyFilesystem = null;
|
|
91996
|
+
try {
|
|
91997
|
+
const lddContent = readFileSync(LDD_PATH);
|
|
91998
|
+
cachedFamilyFilesystem = getFamilyFromLddContent(lddContent);
|
|
91999
|
+
} catch (e) {
|
|
92000
|
+
}
|
|
92001
|
+
return cachedFamilyFilesystem;
|
|
92002
|
+
};
|
|
92003
|
+
var family = async () => {
|
|
92004
|
+
let family2 = null;
|
|
92005
|
+
if (isLinux()) {
|
|
92006
|
+
family2 = await familyFromFilesystem();
|
|
92007
|
+
if (!family2) {
|
|
92008
|
+
family2 = familyFromReport();
|
|
92009
|
+
}
|
|
92010
|
+
if (!family2) {
|
|
92011
|
+
const out = await safeCommand();
|
|
92012
|
+
family2 = familyFromCommand(out);
|
|
92013
|
+
}
|
|
92014
|
+
}
|
|
92015
|
+
return family2;
|
|
92016
|
+
};
|
|
92017
|
+
var familySync = () => {
|
|
92018
|
+
let family2 = null;
|
|
92019
|
+
if (isLinux()) {
|
|
92020
|
+
family2 = familyFromFilesystemSync();
|
|
92021
|
+
if (!family2) {
|
|
92022
|
+
family2 = familyFromReport();
|
|
92023
|
+
}
|
|
92024
|
+
if (!family2) {
|
|
92025
|
+
const out = safeCommandSync();
|
|
92026
|
+
family2 = familyFromCommand(out);
|
|
92027
|
+
}
|
|
92028
|
+
}
|
|
92029
|
+
return family2;
|
|
92030
|
+
};
|
|
92031
|
+
var isNonGlibcLinux = async () => isLinux() && await family() !== GLIBC;
|
|
92032
|
+
var isNonGlibcLinuxSync = () => isLinux() && familySync() !== GLIBC;
|
|
92033
|
+
var versionFromFilesystem = async () => {
|
|
92034
|
+
if (cachedVersionFilesystem !== void 0) {
|
|
92035
|
+
return cachedVersionFilesystem;
|
|
92036
|
+
}
|
|
92037
|
+
cachedVersionFilesystem = null;
|
|
92038
|
+
try {
|
|
92039
|
+
const lddContent = await readFile(LDD_PATH);
|
|
92040
|
+
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
92041
|
+
if (versionMatch) {
|
|
92042
|
+
cachedVersionFilesystem = versionMatch[1];
|
|
92043
|
+
}
|
|
92044
|
+
} catch (e) {
|
|
92045
|
+
}
|
|
92046
|
+
return cachedVersionFilesystem;
|
|
92047
|
+
};
|
|
92048
|
+
var versionFromFilesystemSync = () => {
|
|
92049
|
+
if (cachedVersionFilesystem !== void 0) {
|
|
92050
|
+
return cachedVersionFilesystem;
|
|
92051
|
+
}
|
|
92052
|
+
cachedVersionFilesystem = null;
|
|
92053
|
+
try {
|
|
92054
|
+
const lddContent = readFileSync(LDD_PATH);
|
|
92055
|
+
const versionMatch = lddContent.match(RE_GLIBC_VERSION);
|
|
92056
|
+
if (versionMatch) {
|
|
92057
|
+
cachedVersionFilesystem = versionMatch[1];
|
|
92058
|
+
}
|
|
92059
|
+
} catch (e) {
|
|
92060
|
+
}
|
|
92061
|
+
return cachedVersionFilesystem;
|
|
92062
|
+
};
|
|
92063
|
+
var versionFromReport = () => {
|
|
92064
|
+
const report = getReport();
|
|
92065
|
+
if (report.header && report.header.glibcVersionRuntime) {
|
|
92066
|
+
return report.header.glibcVersionRuntime;
|
|
92067
|
+
}
|
|
92068
|
+
return null;
|
|
92069
|
+
};
|
|
92070
|
+
var versionSuffix = (s) => s.trim().split(/\s+/)[1];
|
|
92071
|
+
var versionFromCommand = (out) => {
|
|
92072
|
+
const [getconf, ldd1, ldd2] = out.split(/[\r\n]+/);
|
|
92073
|
+
if (getconf && getconf.includes(GLIBC)) {
|
|
92074
|
+
return versionSuffix(getconf);
|
|
92075
|
+
}
|
|
92076
|
+
if (ldd1 && ldd2 && ldd1.includes(MUSL)) {
|
|
92077
|
+
return versionSuffix(ldd2);
|
|
92078
|
+
}
|
|
92079
|
+
return null;
|
|
92080
|
+
};
|
|
92081
|
+
var version2 = async () => {
|
|
92082
|
+
let version3 = null;
|
|
92083
|
+
if (isLinux()) {
|
|
92084
|
+
version3 = await versionFromFilesystem();
|
|
92085
|
+
if (!version3) {
|
|
92086
|
+
version3 = versionFromReport();
|
|
92087
|
+
}
|
|
92088
|
+
if (!version3) {
|
|
92089
|
+
const out = await safeCommand();
|
|
92090
|
+
version3 = versionFromCommand(out);
|
|
92091
|
+
}
|
|
92092
|
+
}
|
|
92093
|
+
return version3;
|
|
92094
|
+
};
|
|
92095
|
+
var versionSync = () => {
|
|
92096
|
+
let version3 = null;
|
|
92097
|
+
if (isLinux()) {
|
|
92098
|
+
version3 = versionFromFilesystemSync();
|
|
92099
|
+
if (!version3) {
|
|
92100
|
+
version3 = versionFromReport();
|
|
92101
|
+
}
|
|
92102
|
+
if (!version3) {
|
|
92103
|
+
const out = safeCommandSync();
|
|
92104
|
+
version3 = versionFromCommand(out);
|
|
92105
|
+
}
|
|
92106
|
+
}
|
|
92107
|
+
return version3;
|
|
92108
|
+
};
|
|
92109
|
+
module2.exports = {
|
|
92110
|
+
GLIBC,
|
|
92111
|
+
MUSL,
|
|
92112
|
+
family,
|
|
92113
|
+
familySync,
|
|
92114
|
+
isNonGlibcLinux,
|
|
92115
|
+
isNonGlibcLinuxSync,
|
|
92116
|
+
version: version2,
|
|
92117
|
+
versionSync
|
|
92118
|
+
};
|
|
92119
|
+
}
|
|
92120
|
+
});
|
|
92121
|
+
|
|
92122
|
+
// ../../node_modules/.pnpm/node-gyp-build-optional-packages@5.1.1/node_modules/node-gyp-build-optional-packages/index.js
|
|
91871
92123
|
var require_node_gyp_build_optional_packages = __commonJS({
|
|
91872
|
-
"../../node_modules/.pnpm/node-gyp-build-optional-packages@5.
|
|
92124
|
+
"../../node_modules/.pnpm/node-gyp-build-optional-packages@5.1.1/node_modules/node-gyp-build-optional-packages/index.js"(exports, module2) {
|
|
91873
92125
|
var fs3 = require("fs");
|
|
91874
92126
|
var path = require("path");
|
|
91875
|
-
var
|
|
92127
|
+
var url = require("url");
|
|
91876
92128
|
var vars = process.config && process.config.variables || {};
|
|
91877
92129
|
var prebuildsOnly = !!process.env.PREBUILDS_ONLY;
|
|
91878
|
-
var
|
|
92130
|
+
var versions = process.versions;
|
|
92131
|
+
var abi = versions.modules;
|
|
92132
|
+
if (versions.deno || process.isBun) {
|
|
92133
|
+
abi = "unsupported";
|
|
92134
|
+
}
|
|
91879
92135
|
var runtime = isElectron() ? "electron" : "node";
|
|
91880
92136
|
var arch = process.arch;
|
|
91881
92137
|
var platform = process.platform;
|
|
91882
|
-
var libc = process.env.LIBC || (
|
|
92138
|
+
var libc = process.env.LIBC || (isMusl(platform) ? "musl" : "glibc");
|
|
91883
92139
|
var armv = process.env.ARM_VERSION || (arch === "arm64" ? "8" : vars.arm_version) || "";
|
|
91884
|
-
var uv = (
|
|
92140
|
+
var uv = (versions.uv || "").split(".")[0];
|
|
91885
92141
|
module2.exports = load;
|
|
91886
92142
|
function load(dir) {
|
|
91887
|
-
|
|
92143
|
+
if (typeof __webpack_require__ === "function")
|
|
92144
|
+
return __non_webpack_require__(load.path(dir));
|
|
92145
|
+
else
|
|
92146
|
+
return require(load.path(dir));
|
|
91888
92147
|
}
|
|
91889
92148
|
load.path = function(dir) {
|
|
91890
92149
|
dir = path.resolve(dir || ".");
|
|
91891
|
-
var packageName;
|
|
92150
|
+
var packageName = "";
|
|
91892
92151
|
try {
|
|
91893
|
-
|
|
92152
|
+
if (typeof __webpack_require__ === "function")
|
|
92153
|
+
packageName = __non_webpack_require__(path.join(dir, "package.json")).name;
|
|
92154
|
+
else
|
|
92155
|
+
packageName = require(path.join(dir, "package.json")).name;
|
|
91894
92156
|
var varName = packageName.toUpperCase().replace(/-/g, "_") + "_PREBUILD";
|
|
91895
92157
|
if (process.env[varName])
|
|
91896
92158
|
dir = process.env[varName];
|
|
@@ -91912,7 +92174,7 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
91912
92174
|
return nearby;
|
|
91913
92175
|
var platformPackage = (packageName[0] == "@" ? "" : "@" + packageName + "/") + packageName + "-" + platform + "-" + arch;
|
|
91914
92176
|
try {
|
|
91915
|
-
var prebuildPackage = path.dirname(require("module").createRequire(path.join(dir, "package.json")).resolve(platformPackage));
|
|
92177
|
+
var prebuildPackage = path.dirname(require("module").createRequire(url.pathToFileURL(path.join(dir, "package.json"))).resolve(platformPackage));
|
|
91916
92178
|
return resolveFile(prebuildPackage);
|
|
91917
92179
|
} catch (error) {
|
|
91918
92180
|
}
|
|
@@ -91928,7 +92190,7 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
91928
92190
|
process.versions.electron ? "electron=" + process.versions.electron : "",
|
|
91929
92191
|
typeof __webpack_require__ === "function" ? "webpack=true" : ""
|
|
91930
92192
|
].filter(Boolean).join(" ");
|
|
91931
|
-
throw new Error("No native build was found for " + target2 + "\n
|
|
92193
|
+
throw new Error("No native build was found for " + target2 + "\n attempted loading from: " + dir + " and package: " + platformPackage + "\n");
|
|
91932
92194
|
function resolve(dir2) {
|
|
91933
92195
|
var tuples = readdirSync(path.join(dir2, "prebuilds")).map(parseTuple);
|
|
91934
92196
|
var tuple = tuples.filter(matchTuple(platform, arch)).sort(compareTuples)[0];
|
|
@@ -92051,8 +92313,11 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
92051
92313
|
return true;
|
|
92052
92314
|
return typeof window !== "undefined" && window.process && window.process.type === "renderer";
|
|
92053
92315
|
}
|
|
92054
|
-
function
|
|
92055
|
-
|
|
92316
|
+
function isMusl(platform2) {
|
|
92317
|
+
if (platform2 !== "linux")
|
|
92318
|
+
return false;
|
|
92319
|
+
const { familySync, MUSL } = require_detect_libc();
|
|
92320
|
+
return familySync() === MUSL;
|
|
92056
92321
|
}
|
|
92057
92322
|
load.parseTags = parseTags;
|
|
92058
92323
|
load.matchTags = matchTags;
|
|
@@ -92063,9 +92328,9 @@ var require_node_gyp_build_optional_packages = __commonJS({
|
|
|
92063
92328
|
}
|
|
92064
92329
|
});
|
|
92065
92330
|
|
|
92066
|
-
// ../../node_modules/.pnpm/cbor-extract@2.
|
|
92331
|
+
// ../../node_modules/.pnpm/cbor-extract@2.2.0/node_modules/cbor-extract/index.js
|
|
92067
92332
|
var require_cbor_extract = __commonJS({
|
|
92068
|
-
"../../node_modules/.pnpm/cbor-extract@2.
|
|
92333
|
+
"../../node_modules/.pnpm/cbor-extract@2.2.0/node_modules/cbor-extract/index.js"(exports, module2) {
|
|
92069
92334
|
module2.exports = require_node_gyp_build_optional_packages()(__dirname);
|
|
92070
92335
|
}
|
|
92071
92336
|
});
|
|
@@ -93847,7 +94112,7 @@ var require_wait = __commonJS({
|
|
|
93847
94112
|
"../../node_modules/.pnpm/thread-stream@2.4.0/node_modules/thread-stream/lib/wait.js"(exports, module2) {
|
|
93848
94113
|
"use strict";
|
|
93849
94114
|
var MAX_TIMEOUT = 1e3;
|
|
93850
|
-
function
|
|
94115
|
+
function wait2(state, index, expected, timeout, done) {
|
|
93851
94116
|
const max = Date.now() + timeout;
|
|
93852
94117
|
let current = Atomics.load(state, index);
|
|
93853
94118
|
if (current === expected) {
|
|
@@ -93898,7 +94163,7 @@ var require_wait = __commonJS({
|
|
|
93898
94163
|
};
|
|
93899
94164
|
check2(1);
|
|
93900
94165
|
}
|
|
93901
|
-
module2.exports = { wait, waitDiff };
|
|
94166
|
+
module2.exports = { wait: wait2, waitDiff };
|
|
93902
94167
|
}
|
|
93903
94168
|
});
|
|
93904
94169
|
|
|
@@ -93924,7 +94189,7 @@ var require_thread_stream = __commonJS({
|
|
|
93924
94189
|
var { Worker } = require("worker_threads");
|
|
93925
94190
|
var { join } = require("path");
|
|
93926
94191
|
var { pathToFileURL } = require("url");
|
|
93927
|
-
var { wait } = require_wait();
|
|
94192
|
+
var { wait: wait2 } = require_wait();
|
|
93928
94193
|
var {
|
|
93929
94194
|
WRITE_INDEX,
|
|
93930
94195
|
READ_INDEX
|
|
@@ -94149,7 +94414,7 @@ var require_thread_stream = __commonJS({
|
|
|
94149
94414
|
return;
|
|
94150
94415
|
}
|
|
94151
94416
|
const writeIndex = Atomics.load(this[kImpl].state, WRITE_INDEX);
|
|
94152
|
-
|
|
94417
|
+
wait2(this[kImpl].state, READ_INDEX, writeIndex, Infinity, (err, res) => {
|
|
94153
94418
|
if (err) {
|
|
94154
94419
|
destroy(this, err);
|
|
94155
94420
|
process.nextTick(cb, err);
|
|
@@ -136581,7 +136846,7 @@ function weierstrassPoints(opts) {
|
|
|
136581
136846
|
const a = point.toAffine();
|
|
136582
136847
|
return concatBytes2(Uint8Array.from([4]), Fp3.toBytes(a.x), Fp3.toBytes(a.y));
|
|
136583
136848
|
});
|
|
136584
|
-
const
|
|
136849
|
+
const fromBytes2 = CURVE.fromBytes || ((bytes3) => {
|
|
136585
136850
|
const tail = bytes3.subarray(1);
|
|
136586
136851
|
const x = Fp3.fromBytes(tail.subarray(0, Fp3.BYTES));
|
|
136587
136852
|
const y = Fp3.fromBytes(tail.subarray(Fp3.BYTES, 2 * Fp3.BYTES));
|
|
@@ -136661,7 +136926,7 @@ function weierstrassPoints(opts) {
|
|
|
136661
136926
|
return points.map((p, i) => p.toAffine(toInv[i])).map(Point2.fromAffine);
|
|
136662
136927
|
}
|
|
136663
136928
|
static fromHex(hex) {
|
|
136664
|
-
const P = Point2.fromAffine(
|
|
136929
|
+
const P = Point2.fromAffine(fromBytes2(ensureBytes("pointHex", hex)));
|
|
136665
136930
|
P.assertValidity();
|
|
136666
136931
|
return P;
|
|
136667
136932
|
}
|
|
@@ -143965,8 +144230,134 @@ function sortMapEntries(entries, options) {
|
|
|
143965
144230
|
}
|
|
143966
144231
|
|
|
143967
144232
|
// ../../node_modules/.pnpm/cborg@1.10.2/node_modules/cborg/esm/lib/decode.js
|
|
144233
|
+
var defaultDecodeOptions = {
|
|
144234
|
+
strict: false,
|
|
144235
|
+
allowIndefinite: true,
|
|
144236
|
+
allowUndefined: true,
|
|
144237
|
+
allowBigInt: true
|
|
144238
|
+
};
|
|
144239
|
+
var Tokeniser = class {
|
|
144240
|
+
constructor(data, options = {}) {
|
|
144241
|
+
this.pos = 0;
|
|
144242
|
+
this.data = data;
|
|
144243
|
+
this.options = options;
|
|
144244
|
+
}
|
|
144245
|
+
done() {
|
|
144246
|
+
return this.pos >= this.data.length;
|
|
144247
|
+
}
|
|
144248
|
+
next() {
|
|
144249
|
+
const byt = this.data[this.pos];
|
|
144250
|
+
let token = quick[byt];
|
|
144251
|
+
if (token === void 0) {
|
|
144252
|
+
const decoder2 = jump[byt];
|
|
144253
|
+
if (!decoder2) {
|
|
144254
|
+
throw new Error(`${decodeErrPrefix} no decoder for major type ${byt >>> 5} (byte 0x${byt.toString(16).padStart(2, "0")})`);
|
|
144255
|
+
}
|
|
144256
|
+
const minor = byt & 31;
|
|
144257
|
+
token = decoder2(this.data, this.pos, minor, this.options);
|
|
144258
|
+
}
|
|
144259
|
+
this.pos += token.encodedLength;
|
|
144260
|
+
return token;
|
|
144261
|
+
}
|
|
144262
|
+
};
|
|
143968
144263
|
var DONE = Symbol.for("DONE");
|
|
143969
144264
|
var BREAK = Symbol.for("BREAK");
|
|
144265
|
+
function tokenToArray(token, tokeniser, options) {
|
|
144266
|
+
const arr = [];
|
|
144267
|
+
for (let i = 0; i < token.value; i++) {
|
|
144268
|
+
const value = tokensToObject(tokeniser, options);
|
|
144269
|
+
if (value === BREAK) {
|
|
144270
|
+
if (token.value === Infinity) {
|
|
144271
|
+
break;
|
|
144272
|
+
}
|
|
144273
|
+
throw new Error(`${decodeErrPrefix} got unexpected break to lengthed array`);
|
|
144274
|
+
}
|
|
144275
|
+
if (value === DONE) {
|
|
144276
|
+
throw new Error(`${decodeErrPrefix} found array but not enough entries (got ${i}, expected ${token.value})`);
|
|
144277
|
+
}
|
|
144278
|
+
arr[i] = value;
|
|
144279
|
+
}
|
|
144280
|
+
return arr;
|
|
144281
|
+
}
|
|
144282
|
+
function tokenToMap(token, tokeniser, options) {
|
|
144283
|
+
const useMaps = options.useMaps === true;
|
|
144284
|
+
const obj = useMaps ? void 0 : {};
|
|
144285
|
+
const m = useMaps ? /* @__PURE__ */ new Map() : void 0;
|
|
144286
|
+
for (let i = 0; i < token.value; i++) {
|
|
144287
|
+
const key = tokensToObject(tokeniser, options);
|
|
144288
|
+
if (key === BREAK) {
|
|
144289
|
+
if (token.value === Infinity) {
|
|
144290
|
+
break;
|
|
144291
|
+
}
|
|
144292
|
+
throw new Error(`${decodeErrPrefix} got unexpected break to lengthed map`);
|
|
144293
|
+
}
|
|
144294
|
+
if (key === DONE) {
|
|
144295
|
+
throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no key], expected ${token.value})`);
|
|
144296
|
+
}
|
|
144297
|
+
if (useMaps !== true && typeof key !== "string") {
|
|
144298
|
+
throw new Error(`${decodeErrPrefix} non-string keys not supported (got ${typeof key})`);
|
|
144299
|
+
}
|
|
144300
|
+
if (options.rejectDuplicateMapKeys === true) {
|
|
144301
|
+
if (useMaps && m.has(key) || !useMaps && key in obj) {
|
|
144302
|
+
throw new Error(`${decodeErrPrefix} found repeat map key "${key}"`);
|
|
144303
|
+
}
|
|
144304
|
+
}
|
|
144305
|
+
const value = tokensToObject(tokeniser, options);
|
|
144306
|
+
if (value === DONE) {
|
|
144307
|
+
throw new Error(`${decodeErrPrefix} found map but not enough entries (got ${i} [no value], expected ${token.value})`);
|
|
144308
|
+
}
|
|
144309
|
+
if (useMaps) {
|
|
144310
|
+
m.set(key, value);
|
|
144311
|
+
} else {
|
|
144312
|
+
obj[key] = value;
|
|
144313
|
+
}
|
|
144314
|
+
}
|
|
144315
|
+
return useMaps ? m : obj;
|
|
144316
|
+
}
|
|
144317
|
+
function tokensToObject(tokeniser, options) {
|
|
144318
|
+
if (tokeniser.done()) {
|
|
144319
|
+
return DONE;
|
|
144320
|
+
}
|
|
144321
|
+
const token = tokeniser.next();
|
|
144322
|
+
if (token.type === Type.break) {
|
|
144323
|
+
return BREAK;
|
|
144324
|
+
}
|
|
144325
|
+
if (token.type.terminal) {
|
|
144326
|
+
return token.value;
|
|
144327
|
+
}
|
|
144328
|
+
if (token.type === Type.array) {
|
|
144329
|
+
return tokenToArray(token, tokeniser, options);
|
|
144330
|
+
}
|
|
144331
|
+
if (token.type === Type.map) {
|
|
144332
|
+
return tokenToMap(token, tokeniser, options);
|
|
144333
|
+
}
|
|
144334
|
+
if (token.type === Type.tag) {
|
|
144335
|
+
if (options.tags && typeof options.tags[token.value] === "function") {
|
|
144336
|
+
const tagged = tokensToObject(tokeniser, options);
|
|
144337
|
+
return options.tags[token.value](tagged);
|
|
144338
|
+
}
|
|
144339
|
+
throw new Error(`${decodeErrPrefix} tag not supported (${token.value})`);
|
|
144340
|
+
}
|
|
144341
|
+
throw new Error("unsupported");
|
|
144342
|
+
}
|
|
144343
|
+
function decode6(data, options) {
|
|
144344
|
+
if (!(data instanceof Uint8Array)) {
|
|
144345
|
+
throw new Error(`${decodeErrPrefix} data to decode must be a Uint8Array`);
|
|
144346
|
+
}
|
|
144347
|
+
options = Object.assign({}, defaultDecodeOptions, options);
|
|
144348
|
+
const tokeniser = options.tokenizer || new Tokeniser(data, options);
|
|
144349
|
+
const decoded = tokensToObject(tokeniser, options);
|
|
144350
|
+
if (decoded === DONE) {
|
|
144351
|
+
throw new Error(`${decodeErrPrefix} did not find any content to decode`);
|
|
144352
|
+
}
|
|
144353
|
+
if (decoded === BREAK) {
|
|
144354
|
+
throw new Error(`${decodeErrPrefix} got unexpected break`);
|
|
144355
|
+
}
|
|
144356
|
+
if (!tokeniser.done()) {
|
|
144357
|
+
throw new Error(`${decodeErrPrefix} too many terminals, data makes no sense`);
|
|
144358
|
+
}
|
|
144359
|
+
return decoded;
|
|
144360
|
+
}
|
|
143970
144361
|
|
|
143971
144362
|
// ../../node_modules/.pnpm/@ipld+dag-cbor@7.0.3/node_modules/@ipld/dag-cbor/esm/index.js
|
|
143972
144363
|
var CID_CBOR_TAG = 42;
|
|
@@ -143987,6 +144378,7 @@ var decodeOptions = {
|
|
|
143987
144378
|
tags: []
|
|
143988
144379
|
};
|
|
143989
144380
|
decodeOptions.tags[CID_CBOR_TAG] = cidDecoder;
|
|
144381
|
+
var decode7 = (data) => decode6(data, decodeOptions);
|
|
143990
144382
|
|
|
143991
144383
|
// ../../node_modules/.pnpm/cbor-x@1.5.1/node_modules/cbor-x/decode.js
|
|
143992
144384
|
var decoder;
|
|
@@ -146274,14 +146666,14 @@ var unsignedCommit = z.object({
|
|
|
146274
146666
|
version: z.literal(3),
|
|
146275
146667
|
data: schema.cid,
|
|
146276
146668
|
rev: z.string(),
|
|
146277
|
-
prev: schema.cid.nullable()
|
|
146669
|
+
prev: schema.cid.nullable()
|
|
146278
146670
|
});
|
|
146279
146671
|
var commit = z.object({
|
|
146280
146672
|
did: z.string(),
|
|
146281
146673
|
version: z.literal(3),
|
|
146282
146674
|
data: schema.cid,
|
|
146283
146675
|
rev: z.string(),
|
|
146284
|
-
prev: schema.cid.nullable()
|
|
146676
|
+
prev: schema.cid.nullable(),
|
|
146285
146677
|
sig: schema.bytes
|
|
146286
146678
|
});
|
|
146287
146679
|
var legacyV2Commit = z.object({
|
|
@@ -146316,17 +146708,346 @@ var def2 = {
|
|
|
146316
146708
|
|
|
146317
146709
|
// ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/reader.js
|
|
146318
146710
|
var import_fs = __toESM(require("fs"), 1);
|
|
146319
|
-
var
|
|
146711
|
+
var import_util8 = require("util");
|
|
146320
146712
|
|
|
146321
146713
|
// ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/decoder.js
|
|
146322
146714
|
var import_varint2 = __toESM(require_varint(), 1);
|
|
146715
|
+
var CIDV0_BYTES = {
|
|
146716
|
+
SHA2_256: 18,
|
|
146717
|
+
LENGTH: 32,
|
|
146718
|
+
DAG_PB: 112
|
|
146719
|
+
};
|
|
146720
|
+
async function readVarint(reader) {
|
|
146721
|
+
const bytes3 = await reader.upTo(8);
|
|
146722
|
+
const i = import_varint2.default.decode(bytes3);
|
|
146723
|
+
reader.seek(import_varint2.default.decode.bytes);
|
|
146724
|
+
return i;
|
|
146725
|
+
}
|
|
146726
|
+
async function readHeader(reader) {
|
|
146727
|
+
const length2 = await readVarint(reader);
|
|
146728
|
+
if (length2 === 0) {
|
|
146729
|
+
throw new Error("Invalid CAR header (zero length)");
|
|
146730
|
+
}
|
|
146731
|
+
const header = await reader.exactly(length2);
|
|
146732
|
+
reader.seek(length2);
|
|
146733
|
+
const block = decode7(header);
|
|
146734
|
+
if (block == null || Array.isArray(block) || typeof block !== "object") {
|
|
146735
|
+
throw new Error("Invalid CAR header format");
|
|
146736
|
+
}
|
|
146737
|
+
if (block.version !== 1) {
|
|
146738
|
+
if (typeof block.version === "string") {
|
|
146739
|
+
throw new Error(`Invalid CAR version: "${block.version}"`);
|
|
146740
|
+
}
|
|
146741
|
+
throw new Error(`Invalid CAR version: ${block.version}`);
|
|
146742
|
+
}
|
|
146743
|
+
if (!Array.isArray(block.roots)) {
|
|
146744
|
+
throw new Error("Invalid CAR header format");
|
|
146745
|
+
}
|
|
146746
|
+
if (Object.keys(block).filter((p) => p !== "roots" && p !== "version").length) {
|
|
146747
|
+
throw new Error("Invalid CAR header format");
|
|
146748
|
+
}
|
|
146749
|
+
return block;
|
|
146750
|
+
}
|
|
146751
|
+
async function readMultihash(reader) {
|
|
146752
|
+
const bytes3 = await reader.upTo(8);
|
|
146753
|
+
import_varint2.default.decode(bytes3);
|
|
146754
|
+
const codeLength = import_varint2.default.decode.bytes;
|
|
146755
|
+
const length2 = import_varint2.default.decode(bytes3.subarray(import_varint2.default.decode.bytes));
|
|
146756
|
+
const lengthLength = import_varint2.default.decode.bytes;
|
|
146757
|
+
const mhLength = codeLength + lengthLength + length2;
|
|
146758
|
+
const multihash = await reader.exactly(mhLength);
|
|
146759
|
+
reader.seek(mhLength);
|
|
146760
|
+
return multihash;
|
|
146761
|
+
}
|
|
146762
|
+
async function readCid(reader) {
|
|
146763
|
+
const first = await reader.exactly(2);
|
|
146764
|
+
if (first[0] === CIDV0_BYTES.SHA2_256 && first[1] === CIDV0_BYTES.LENGTH) {
|
|
146765
|
+
const bytes4 = await reader.exactly(34);
|
|
146766
|
+
reader.seek(34);
|
|
146767
|
+
const multihash2 = decode5(bytes4);
|
|
146768
|
+
return CID.create(0, CIDV0_BYTES.DAG_PB, multihash2);
|
|
146769
|
+
}
|
|
146770
|
+
const version2 = await readVarint(reader);
|
|
146771
|
+
if (version2 !== 1) {
|
|
146772
|
+
throw new Error(`Unexpected CID version (${version2})`);
|
|
146773
|
+
}
|
|
146774
|
+
const codec = await readVarint(reader);
|
|
146775
|
+
const bytes3 = await readMultihash(reader);
|
|
146776
|
+
const multihash = decode5(bytes3);
|
|
146777
|
+
return CID.create(version2, codec, multihash);
|
|
146778
|
+
}
|
|
146779
|
+
async function readBlockHead(reader) {
|
|
146780
|
+
const start = reader.pos;
|
|
146781
|
+
let length2 = await readVarint(reader);
|
|
146782
|
+
if (length2 === 0) {
|
|
146783
|
+
throw new Error("Invalid CAR section (zero length)");
|
|
146784
|
+
}
|
|
146785
|
+
length2 += reader.pos - start;
|
|
146786
|
+
const cid2 = await readCid(reader);
|
|
146787
|
+
const blockLength = length2 - (reader.pos - start);
|
|
146788
|
+
return {
|
|
146789
|
+
cid: cid2,
|
|
146790
|
+
length: length2,
|
|
146791
|
+
blockLength
|
|
146792
|
+
};
|
|
146793
|
+
}
|
|
146794
|
+
async function readBlock(reader) {
|
|
146795
|
+
const { cid: cid2, blockLength } = await readBlockHead(reader);
|
|
146796
|
+
const bytes3 = await reader.exactly(blockLength);
|
|
146797
|
+
reader.seek(blockLength);
|
|
146798
|
+
return {
|
|
146799
|
+
bytes: bytes3,
|
|
146800
|
+
cid: cid2
|
|
146801
|
+
};
|
|
146802
|
+
}
|
|
146803
|
+
async function readBlockIndex(reader) {
|
|
146804
|
+
const offset = reader.pos;
|
|
146805
|
+
const { cid: cid2, length: length2, blockLength } = await readBlockHead(reader);
|
|
146806
|
+
const index = {
|
|
146807
|
+
cid: cid2,
|
|
146808
|
+
length: length2,
|
|
146809
|
+
blockLength,
|
|
146810
|
+
offset,
|
|
146811
|
+
blockOffset: reader.pos
|
|
146812
|
+
};
|
|
146813
|
+
reader.seek(index.blockLength);
|
|
146814
|
+
return index;
|
|
146815
|
+
}
|
|
146816
|
+
function createDecoder(reader) {
|
|
146817
|
+
const headerPromise = readHeader(reader);
|
|
146818
|
+
return {
|
|
146819
|
+
header: () => headerPromise,
|
|
146820
|
+
async *blocks() {
|
|
146821
|
+
await headerPromise;
|
|
146822
|
+
while ((await reader.upTo(8)).length > 0) {
|
|
146823
|
+
yield await readBlock(reader);
|
|
146824
|
+
}
|
|
146825
|
+
},
|
|
146826
|
+
async *blocksIndex() {
|
|
146827
|
+
await headerPromise;
|
|
146828
|
+
while ((await reader.upTo(8)).length > 0) {
|
|
146829
|
+
yield await readBlockIndex(reader);
|
|
146830
|
+
}
|
|
146831
|
+
}
|
|
146832
|
+
};
|
|
146833
|
+
}
|
|
146834
|
+
function bytesReader(bytes3) {
|
|
146835
|
+
let pos = 0;
|
|
146836
|
+
return {
|
|
146837
|
+
async upTo(length2) {
|
|
146838
|
+
return bytes3.subarray(pos, pos + Math.min(length2, bytes3.length - pos));
|
|
146839
|
+
},
|
|
146840
|
+
async exactly(length2) {
|
|
146841
|
+
if (length2 > bytes3.length - pos) {
|
|
146842
|
+
throw new Error("Unexpected end of data");
|
|
146843
|
+
}
|
|
146844
|
+
return bytes3.subarray(pos, pos + length2);
|
|
146845
|
+
},
|
|
146846
|
+
seek(length2) {
|
|
146847
|
+
pos += length2;
|
|
146848
|
+
},
|
|
146849
|
+
get pos() {
|
|
146850
|
+
return pos;
|
|
146851
|
+
}
|
|
146852
|
+
};
|
|
146853
|
+
}
|
|
146854
|
+
function chunkReader(readChunk) {
|
|
146855
|
+
let pos = 0;
|
|
146856
|
+
let have = 0;
|
|
146857
|
+
let offset = 0;
|
|
146858
|
+
let currentChunk = new Uint8Array(0);
|
|
146859
|
+
const read3 = async (length2) => {
|
|
146860
|
+
have = currentChunk.length - offset;
|
|
146861
|
+
const bufa = [currentChunk.subarray(offset)];
|
|
146862
|
+
while (have < length2) {
|
|
146863
|
+
const chunk = await readChunk();
|
|
146864
|
+
if (chunk == null) {
|
|
146865
|
+
break;
|
|
146866
|
+
}
|
|
146867
|
+
if (have < 0) {
|
|
146868
|
+
if (chunk.length > have) {
|
|
146869
|
+
bufa.push(chunk.subarray(-have));
|
|
146870
|
+
}
|
|
146871
|
+
} else {
|
|
146872
|
+
bufa.push(chunk);
|
|
146873
|
+
}
|
|
146874
|
+
have += chunk.length;
|
|
146875
|
+
}
|
|
146876
|
+
currentChunk = new Uint8Array(bufa.reduce((p, c) => p + c.length, 0));
|
|
146877
|
+
let off = 0;
|
|
146878
|
+
for (const b of bufa) {
|
|
146879
|
+
currentChunk.set(b, off);
|
|
146880
|
+
off += b.length;
|
|
146881
|
+
}
|
|
146882
|
+
offset = 0;
|
|
146883
|
+
};
|
|
146884
|
+
return {
|
|
146885
|
+
async upTo(length2) {
|
|
146886
|
+
if (currentChunk.length - offset < length2) {
|
|
146887
|
+
await read3(length2);
|
|
146888
|
+
}
|
|
146889
|
+
return currentChunk.subarray(offset, offset + Math.min(currentChunk.length - offset, length2));
|
|
146890
|
+
},
|
|
146891
|
+
async exactly(length2) {
|
|
146892
|
+
if (currentChunk.length - offset < length2) {
|
|
146893
|
+
await read3(length2);
|
|
146894
|
+
}
|
|
146895
|
+
if (currentChunk.length - offset < length2) {
|
|
146896
|
+
throw new Error("Unexpected end of data");
|
|
146897
|
+
}
|
|
146898
|
+
return currentChunk.subarray(offset, offset + length2);
|
|
146899
|
+
},
|
|
146900
|
+
seek(length2) {
|
|
146901
|
+
pos += length2;
|
|
146902
|
+
offset += length2;
|
|
146903
|
+
},
|
|
146904
|
+
get pos() {
|
|
146905
|
+
return pos;
|
|
146906
|
+
}
|
|
146907
|
+
};
|
|
146908
|
+
}
|
|
146909
|
+
function asyncIterableReader(asyncIterable) {
|
|
146910
|
+
const iterator = asyncIterable[Symbol.asyncIterator]();
|
|
146911
|
+
async function readChunk() {
|
|
146912
|
+
const next = await iterator.next();
|
|
146913
|
+
if (next.done) {
|
|
146914
|
+
return null;
|
|
146915
|
+
}
|
|
146916
|
+
return next.value;
|
|
146917
|
+
}
|
|
146918
|
+
return chunkReader(readChunk);
|
|
146919
|
+
}
|
|
146323
146920
|
|
|
146324
146921
|
// ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/reader.js
|
|
146325
|
-
var fsread = (0,
|
|
146922
|
+
var fsread = (0, import_util8.promisify)(import_fs.default.read);
|
|
146923
|
+
|
|
146924
|
+
// ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/indexer.js
|
|
146925
|
+
var CarIndexer = class {
|
|
146926
|
+
constructor(version2, roots, iterator) {
|
|
146927
|
+
this._version = version2;
|
|
146928
|
+
this._roots = roots;
|
|
146929
|
+
this._iterator = iterator;
|
|
146930
|
+
}
|
|
146931
|
+
get version() {
|
|
146932
|
+
return this._version;
|
|
146933
|
+
}
|
|
146934
|
+
async getRoots() {
|
|
146935
|
+
return this._roots;
|
|
146936
|
+
}
|
|
146937
|
+
[Symbol.asyncIterator]() {
|
|
146938
|
+
return this._iterator;
|
|
146939
|
+
}
|
|
146940
|
+
static async fromBytes(bytes3) {
|
|
146941
|
+
if (!(bytes3 instanceof Uint8Array)) {
|
|
146942
|
+
throw new TypeError("fromBytes() requires a Uint8Array");
|
|
146943
|
+
}
|
|
146944
|
+
return decodeIndexerComplete(bytesReader(bytes3));
|
|
146945
|
+
}
|
|
146946
|
+
static async fromIterable(asyncIterable) {
|
|
146947
|
+
if (!asyncIterable || !(typeof asyncIterable[Symbol.asyncIterator] === "function")) {
|
|
146948
|
+
throw new TypeError("fromIterable() requires an async iterable");
|
|
146949
|
+
}
|
|
146950
|
+
return decodeIndexerComplete(asyncIterableReader(asyncIterable));
|
|
146951
|
+
}
|
|
146952
|
+
};
|
|
146953
|
+
async function decodeIndexerComplete(reader) {
|
|
146954
|
+
const decoder2 = createDecoder(reader);
|
|
146955
|
+
const { version: version2, roots } = await decoder2.header();
|
|
146956
|
+
return new CarIndexer(version2, roots, decoder2.blocksIndex());
|
|
146957
|
+
}
|
|
146958
|
+
|
|
146959
|
+
// ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/iterator.js
|
|
146960
|
+
var CarIteratorBase = class {
|
|
146961
|
+
constructor(version2, roots, iterable) {
|
|
146962
|
+
this._version = version2;
|
|
146963
|
+
this._roots = roots;
|
|
146964
|
+
this._iterable = iterable;
|
|
146965
|
+
this._decoded = false;
|
|
146966
|
+
}
|
|
146967
|
+
get version() {
|
|
146968
|
+
return this._version;
|
|
146969
|
+
}
|
|
146970
|
+
async getRoots() {
|
|
146971
|
+
return this._roots;
|
|
146972
|
+
}
|
|
146973
|
+
};
|
|
146974
|
+
var CarBlockIterator = class extends CarIteratorBase {
|
|
146975
|
+
[Symbol.asyncIterator]() {
|
|
146976
|
+
if (this._decoded) {
|
|
146977
|
+
throw new Error("Cannot decode more than once");
|
|
146978
|
+
}
|
|
146979
|
+
if (!this._iterable) {
|
|
146980
|
+
throw new Error("Block iterable not found");
|
|
146981
|
+
}
|
|
146982
|
+
this._decoded = true;
|
|
146983
|
+
return this._iterable[Symbol.asyncIterator]();
|
|
146984
|
+
}
|
|
146985
|
+
static async fromBytes(bytes3) {
|
|
146986
|
+
const { version: version2, roots, iterator } = await fromBytes(bytes3);
|
|
146987
|
+
return new CarBlockIterator(version2, roots, iterator);
|
|
146988
|
+
}
|
|
146989
|
+
static async fromIterable(asyncIterable) {
|
|
146990
|
+
const { version: version2, roots, iterator } = await fromIterable(asyncIterable);
|
|
146991
|
+
return new CarBlockIterator(version2, roots, iterator);
|
|
146992
|
+
}
|
|
146993
|
+
};
|
|
146994
|
+
var CarCIDIterator = class extends CarIteratorBase {
|
|
146995
|
+
[Symbol.asyncIterator]() {
|
|
146996
|
+
if (this._decoded) {
|
|
146997
|
+
throw new Error("Cannot decode more than once");
|
|
146998
|
+
}
|
|
146999
|
+
if (!this._iterable) {
|
|
147000
|
+
throw new Error("Block iterable not found");
|
|
147001
|
+
}
|
|
147002
|
+
this._decoded = true;
|
|
147003
|
+
const iterable = this._iterable[Symbol.asyncIterator]();
|
|
147004
|
+
return {
|
|
147005
|
+
async next() {
|
|
147006
|
+
const next = await iterable.next();
|
|
147007
|
+
if (next.done) {
|
|
147008
|
+
return next;
|
|
147009
|
+
}
|
|
147010
|
+
return {
|
|
147011
|
+
done: false,
|
|
147012
|
+
value: next.value.cid
|
|
147013
|
+
};
|
|
147014
|
+
}
|
|
147015
|
+
};
|
|
147016
|
+
}
|
|
147017
|
+
static async fromBytes(bytes3) {
|
|
147018
|
+
const { version: version2, roots, iterator } = await fromBytes(bytes3);
|
|
147019
|
+
return new CarCIDIterator(version2, roots, iterator);
|
|
147020
|
+
}
|
|
147021
|
+
static async fromIterable(asyncIterable) {
|
|
147022
|
+
const { version: version2, roots, iterator } = await fromIterable(asyncIterable);
|
|
147023
|
+
return new CarCIDIterator(version2, roots, iterator);
|
|
147024
|
+
}
|
|
147025
|
+
};
|
|
147026
|
+
async function fromBytes(bytes3) {
|
|
147027
|
+
if (!(bytes3 instanceof Uint8Array)) {
|
|
147028
|
+
throw new TypeError("fromBytes() requires a Uint8Array");
|
|
147029
|
+
}
|
|
147030
|
+
return decodeIterator(bytesReader(bytes3));
|
|
147031
|
+
}
|
|
147032
|
+
async function fromIterable(asyncIterable) {
|
|
147033
|
+
if (!asyncIterable || !(typeof asyncIterable[Symbol.asyncIterator] === "function")) {
|
|
147034
|
+
throw new TypeError("fromIterable() requires an async iterable");
|
|
147035
|
+
}
|
|
147036
|
+
return decodeIterator(asyncIterableReader(asyncIterable));
|
|
147037
|
+
}
|
|
147038
|
+
async function decodeIterator(reader) {
|
|
147039
|
+
const decoder2 = createDecoder(reader);
|
|
147040
|
+
const { version: version2, roots } = await decoder2.header();
|
|
147041
|
+
return {
|
|
147042
|
+
version: version2,
|
|
147043
|
+
roots,
|
|
147044
|
+
iterator: decoder2.blocks()
|
|
147045
|
+
};
|
|
147046
|
+
}
|
|
146326
147047
|
|
|
146327
147048
|
// ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/writer.js
|
|
146328
147049
|
var import_fs2 = __toESM(require("fs"), 1);
|
|
146329
|
-
var
|
|
147050
|
+
var import_util9 = require("util");
|
|
146330
147051
|
|
|
146331
147052
|
// ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/encoder.js
|
|
146332
147053
|
var import_varint3 = __toESM(require_varint(), 1);
|
|
@@ -146346,8 +147067,8 @@ var CarWriterOut = class {
|
|
|
146346
147067
|
};
|
|
146347
147068
|
|
|
146348
147069
|
// ../../node_modules/.pnpm/@ipld+car@3.2.3/node_modules/@ipld/car/esm/lib/writer.js
|
|
146349
|
-
var fsread2 = (0,
|
|
146350
|
-
var fswrite = (0,
|
|
147070
|
+
var fsread2 = (0, import_util9.promisify)(import_fs2.default.read);
|
|
147071
|
+
var fswrite = (0, import_util9.promisify)(import_fs2.default.write);
|
|
146351
147072
|
|
|
146352
147073
|
// ../repo/src/mst/mst.ts
|
|
146353
147074
|
var subTreePointer = z.nullable(schema.cid);
|
|
@@ -146371,7 +147092,8 @@ var BlobNotFoundError = class extends Error {
|
|
|
146371
147092
|
|
|
146372
147093
|
// src/s3.ts
|
|
146373
147094
|
var S3BlobStore = class {
|
|
146374
|
-
constructor(cfg) {
|
|
147095
|
+
constructor(did2, cfg) {
|
|
147096
|
+
this.did = did2;
|
|
146375
147097
|
const { bucket, ...rest } = cfg;
|
|
146376
147098
|
this.bucket = bucket;
|
|
146377
147099
|
this.client = new aws2.S3({
|
|
@@ -146379,17 +147101,22 @@ var S3BlobStore = class {
|
|
|
146379
147101
|
apiVersion: "2006-03-01"
|
|
146380
147102
|
});
|
|
146381
147103
|
}
|
|
147104
|
+
static creator(cfg) {
|
|
147105
|
+
return (did2) => {
|
|
147106
|
+
return new S3BlobStore(did2, cfg);
|
|
147107
|
+
};
|
|
147108
|
+
}
|
|
146382
147109
|
genKey() {
|
|
146383
147110
|
return randomStr(32, "base32");
|
|
146384
147111
|
}
|
|
146385
147112
|
getTmpPath(key) {
|
|
146386
|
-
return `tmp/${key}`;
|
|
147113
|
+
return `tmp/${this.did}/${key}`;
|
|
146387
147114
|
}
|
|
146388
147115
|
getStoredPath(cid2) {
|
|
146389
|
-
return `blocks/${cid2.toString()}`;
|
|
147116
|
+
return `blocks/${this.did}/${cid2.toString()}`;
|
|
146390
147117
|
}
|
|
146391
147118
|
getQuarantinedPath(cid2) {
|
|
146392
|
-
return `quarantine/${cid2.toString()}`;
|
|
147119
|
+
return `quarantine/${this.did}/${cid2.toString()}`;
|
|
146393
147120
|
}
|
|
146394
147121
|
async putTemp(bytes3) {
|
|
146395
147122
|
const key = this.genKey();
|
|
@@ -146458,11 +147185,21 @@ var S3BlobStore = class {
|
|
|
146458
147185
|
async delete(cid2) {
|
|
146459
147186
|
await this.deleteKey(this.getStoredPath(cid2));
|
|
146460
147187
|
}
|
|
147188
|
+
async deleteMany(cids) {
|
|
147189
|
+
const keys = cids.map((cid2) => this.getStoredPath(cid2));
|
|
147190
|
+
await this.deleteManyKeys(keys);
|
|
147191
|
+
}
|
|
146461
147192
|
async hasStored(cid2) {
|
|
147193
|
+
return this.hasKey(this.getStoredPath(cid2));
|
|
147194
|
+
}
|
|
147195
|
+
async hasTemp(key) {
|
|
147196
|
+
return this.hasKey(this.getTmpPath(key));
|
|
147197
|
+
}
|
|
147198
|
+
async hasKey(key) {
|
|
146462
147199
|
try {
|
|
146463
147200
|
const res = await this.client.headObject({
|
|
146464
147201
|
Bucket: this.bucket,
|
|
146465
|
-
Key:
|
|
147202
|
+
Key: key
|
|
146466
147203
|
});
|
|
146467
147204
|
return res.$metadata.httpStatusCode === 200;
|
|
146468
147205
|
} catch (err) {
|
|
@@ -146475,17 +147212,36 @@ var S3BlobStore = class {
|
|
|
146475
147212
|
Key: key
|
|
146476
147213
|
});
|
|
146477
147214
|
}
|
|
146478
|
-
async
|
|
146479
|
-
await this.client.
|
|
147215
|
+
async deleteManyKeys(keys) {
|
|
147216
|
+
await this.client.deleteObjects({
|
|
146480
147217
|
Bucket: this.bucket,
|
|
146481
|
-
|
|
146482
|
-
|
|
146483
|
-
|
|
146484
|
-
await this.client.deleteObject({
|
|
146485
|
-
Bucket: this.bucket,
|
|
146486
|
-
Key: keys.from
|
|
147218
|
+
Delete: {
|
|
147219
|
+
Objects: keys.map((k) => ({ Key: k }))
|
|
147220
|
+
}
|
|
146487
147221
|
});
|
|
146488
147222
|
}
|
|
147223
|
+
async move(keys) {
|
|
147224
|
+
try {
|
|
147225
|
+
await this.client.copyObject({
|
|
147226
|
+
Bucket: this.bucket,
|
|
147227
|
+
CopySource: `${this.bucket}/${keys.from}`,
|
|
147228
|
+
Key: keys.to
|
|
147229
|
+
});
|
|
147230
|
+
await this.client.deleteObject({
|
|
147231
|
+
Bucket: this.bucket,
|
|
147232
|
+
Key: keys.from
|
|
147233
|
+
});
|
|
147234
|
+
} catch (err) {
|
|
147235
|
+
handleErr(err);
|
|
147236
|
+
}
|
|
147237
|
+
}
|
|
147238
|
+
};
|
|
147239
|
+
var handleErr = (err) => {
|
|
147240
|
+
if (err?.["Code"] === "NoSuchKey") {
|
|
147241
|
+
throw new BlobNotFoundError();
|
|
147242
|
+
} else {
|
|
147243
|
+
throw err;
|
|
147244
|
+
}
|
|
146489
147245
|
};
|
|
146490
147246
|
|
|
146491
147247
|
// src/cloudfront.ts
|