@learncard/core 8.5.0 → 8.5.1
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/core.cjs.development.js +152 -784
- package/dist/core.cjs.development.js.map +4 -4
- package/dist/core.cjs.production.min.js +76 -76
- package/dist/core.cjs.production.min.js.map +4 -4
- package/dist/core.esm.js +152 -784
- package/dist/core.esm.js.map +4 -4
- package/dist/wallet/plugins/vc-templates/types.d.ts +28 -0
- package/package.json +2 -2
package/dist/core.esm.js
CHANGED
@@ -1834,11 +1834,11 @@ var require_set_to_string_tag = __commonJS({
|
|
1834
1834
|
var hasOwn = require_has_own_property();
|
1835
1835
|
var wellKnownSymbol = require_well_known_symbol();
|
1836
1836
|
var TO_STRING_TAG = wellKnownSymbol("toStringTag");
|
1837
|
-
module2.exports = function(target,
|
1837
|
+
module2.exports = function(target, TAG3, STATIC) {
|
1838
1838
|
if (target && !STATIC)
|
1839
1839
|
target = target.prototype;
|
1840
1840
|
if (target && !hasOwn(target, TO_STRING_TAG)) {
|
1841
|
-
defineProperty(target, TO_STRING_TAG, { configurable: true, value:
|
1841
|
+
defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG3 });
|
1842
1842
|
}
|
1843
1843
|
};
|
1844
1844
|
}
|
@@ -6602,7 +6602,7 @@ var require_lodash = __commonJS({
|
|
6602
6602
|
}
|
6603
6603
|
__name(matchesStrictComparable, "matchesStrictComparable");
|
6604
6604
|
function memoizeCapped(func) {
|
6605
|
-
var result2 =
|
6605
|
+
var result2 = memoize(func, function(key2) {
|
6606
6606
|
if (cache.size === MAX_MEMOIZE_SIZE) {
|
6607
6607
|
cache.clear();
|
6608
6608
|
}
|
@@ -7663,7 +7663,7 @@ var require_lodash = __commonJS({
|
|
7663
7663
|
return createWrap(func, WRAP_FLIP_FLAG);
|
7664
7664
|
}
|
7665
7665
|
__name(flip, "flip");
|
7666
|
-
function
|
7666
|
+
function memoize(func, resolver) {
|
7667
7667
|
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
7668
7668
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
7669
7669
|
}
|
@@ -7676,11 +7676,11 @@ var require_lodash = __commonJS({
|
|
7676
7676
|
memoized.cache = cache.set(key2, result2) || cache;
|
7677
7677
|
return result2;
|
7678
7678
|
}, "memoized");
|
7679
|
-
memoized.cache = new (
|
7679
|
+
memoized.cache = new (memoize.Cache || MapCache)();
|
7680
7680
|
return memoized;
|
7681
7681
|
}
|
7682
|
-
__name(
|
7683
|
-
|
7682
|
+
__name(memoize, "memoize");
|
7683
|
+
memoize.Cache = MapCache;
|
7684
7684
|
function negate(predicate) {
|
7685
7685
|
if (typeof predicate != "function") {
|
7686
7686
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
@@ -8943,7 +8943,7 @@ var require_lodash = __commonJS({
|
|
8943
8943
|
lodash.mapValues = mapValues;
|
8944
8944
|
lodash.matches = matches;
|
8945
8945
|
lodash.matchesProperty = matchesProperty;
|
8946
|
-
lodash.memoize =
|
8946
|
+
lodash.memoize = memoize;
|
8947
8947
|
lodash.merge = merge2;
|
8948
8948
|
lodash.mergeWith = mergeWith;
|
8949
8949
|
lodash.method = method;
|
@@ -36540,13 +36540,13 @@ var require_tslib = __commonJS({
|
|
36540
36540
|
var __extends3;
|
36541
36541
|
var __assign2;
|
36542
36542
|
var __rest2;
|
36543
|
-
var
|
36543
|
+
var __decorate8;
|
36544
36544
|
var __param2;
|
36545
36545
|
var __esDecorate2;
|
36546
36546
|
var __runInitializers2;
|
36547
36547
|
var __propKey2;
|
36548
36548
|
var __setFunctionName2;
|
36549
|
-
var
|
36549
|
+
var __metadata4;
|
36550
36550
|
var __awaiter2;
|
36551
36551
|
var __generator2;
|
36552
36552
|
var __exportStar2;
|
@@ -36562,8 +36562,8 @@ var require_tslib = __commonJS({
|
|
36562
36562
|
var __makeTemplateObject2;
|
36563
36563
|
var __importStar2;
|
36564
36564
|
var __importDefault2;
|
36565
|
-
var
|
36566
|
-
var
|
36565
|
+
var __classPrivateFieldGet3;
|
36566
|
+
var __classPrivateFieldSet3;
|
36567
36567
|
var __classPrivateFieldIn2;
|
36568
36568
|
var __createBinding2;
|
36569
36569
|
(function(factory) {
|
@@ -36629,7 +36629,7 @@ var require_tslib = __commonJS({
|
|
36629
36629
|
}
|
36630
36630
|
return t2;
|
36631
36631
|
}, "__rest");
|
36632
|
-
|
36632
|
+
__decorate8 = /* @__PURE__ */ __name(function(decorators, target, key2, desc) {
|
36633
36633
|
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
36634
36634
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
36635
36635
|
r = Reflect.decorate(decorators, target, key2, desc);
|
@@ -36704,7 +36704,7 @@ var require_tslib = __commonJS({
|
|
36704
36704
|
name3 = name3.description ? "[".concat(name3.description, "]") : "";
|
36705
36705
|
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name3) : name3 });
|
36706
36706
|
}, "__setFunctionName");
|
36707
|
-
|
36707
|
+
__metadata4 = /* @__PURE__ */ __name(function(metadataKey, metadataValue) {
|
36708
36708
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
36709
36709
|
return Reflect.metadata(metadataKey, metadataValue);
|
36710
36710
|
}, "__metadata");
|
@@ -37005,14 +37005,14 @@ var require_tslib = __commonJS({
|
|
37005
37005
|
__importDefault2 = /* @__PURE__ */ __name(function(mod2) {
|
37006
37006
|
return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
|
37007
37007
|
}, "__importDefault");
|
37008
|
-
|
37008
|
+
__classPrivateFieldGet3 = /* @__PURE__ */ __name(function(receiver, state, kind, f) {
|
37009
37009
|
if (kind === "a" && !f)
|
37010
37010
|
throw new TypeError("Private accessor was defined without a getter");
|
37011
37011
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
37012
37012
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
37013
37013
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
37014
37014
|
}, "__classPrivateFieldGet");
|
37015
|
-
|
37015
|
+
__classPrivateFieldSet3 = /* @__PURE__ */ __name(function(receiver, state, value, kind, f) {
|
37016
37016
|
if (kind === "m")
|
37017
37017
|
throw new TypeError("Private method is not writable");
|
37018
37018
|
if (kind === "a" && !f)
|
@@ -37029,13 +37029,13 @@ var require_tslib = __commonJS({
|
|
37029
37029
|
exporter("__extends", __extends3);
|
37030
37030
|
exporter("__assign", __assign2);
|
37031
37031
|
exporter("__rest", __rest2);
|
37032
|
-
exporter("__decorate",
|
37032
|
+
exporter("__decorate", __decorate8);
|
37033
37033
|
exporter("__param", __param2);
|
37034
37034
|
exporter("__esDecorate", __esDecorate2);
|
37035
37035
|
exporter("__runInitializers", __runInitializers2);
|
37036
37036
|
exporter("__propKey", __propKey2);
|
37037
37037
|
exporter("__setFunctionName", __setFunctionName2);
|
37038
|
-
exporter("__metadata",
|
37038
|
+
exporter("__metadata", __metadata4);
|
37039
37039
|
exporter("__awaiter", __awaiter2);
|
37040
37040
|
exporter("__generator", __generator2);
|
37041
37041
|
exporter("__exportStar", __exportStar2);
|
@@ -37052,8 +37052,8 @@ var require_tslib = __commonJS({
|
|
37052
37052
|
exporter("__makeTemplateObject", __makeTemplateObject2);
|
37053
37053
|
exporter("__importStar", __importStar2);
|
37054
37054
|
exporter("__importDefault", __importDefault2);
|
37055
|
-
exporter("__classPrivateFieldGet",
|
37056
|
-
exporter("__classPrivateFieldSet",
|
37055
|
+
exporter("__classPrivateFieldGet", __classPrivateFieldGet3);
|
37056
|
+
exporter("__classPrivateFieldSet", __classPrivateFieldSet3);
|
37057
37057
|
exporter("__classPrivateFieldIn", __classPrivateFieldIn2);
|
37058
37058
|
});
|
37059
37059
|
}
|
@@ -38162,7 +38162,7 @@ var require_src3 = __commonJS({
|
|
38162
38162
|
"../../node_modules/.pnpm/multihashes@4.0.3/node_modules/multihashes/src/index.js"(exports, module2) {
|
38163
38163
|
"use strict";
|
38164
38164
|
var multibase = require_src2();
|
38165
|
-
var
|
38165
|
+
var varint6 = require_varint2();
|
38166
38166
|
var { names } = require_constants2();
|
38167
38167
|
var { toString: uint8ArrayToString } = (init_to_string(), __toCommonJS(to_string_exports));
|
38168
38168
|
var { fromString: uint8ArrayFromString } = (init_from_string(), __toCommonJS(from_string_exports));
|
@@ -38203,16 +38203,16 @@ var require_src3 = __commonJS({
|
|
38203
38203
|
if (bytes.length < 2) {
|
38204
38204
|
throw new Error("multihash too short. must be > 2 bytes.");
|
38205
38205
|
}
|
38206
|
-
const code3 =
|
38206
|
+
const code3 = varint6.decode(bytes);
|
38207
38207
|
if (!isValidCode(code3)) {
|
38208
38208
|
throw new Error(`multihash unknown function code: 0x${code3.toString(16)}`);
|
38209
38209
|
}
|
38210
|
-
bytes = bytes.slice(
|
38211
|
-
const len =
|
38210
|
+
bytes = bytes.slice(varint6.decode.bytes);
|
38211
|
+
const len = varint6.decode(bytes);
|
38212
38212
|
if (len < 0) {
|
38213
38213
|
throw new Error(`multihash invalid length: ${len}`);
|
38214
38214
|
}
|
38215
|
-
bytes = bytes.slice(
|
38215
|
+
bytes = bytes.slice(varint6.decode.bytes);
|
38216
38216
|
if (bytes.length !== len) {
|
38217
38217
|
throw new Error(`multihash length inconsistent: 0x${uint8ArrayToString(bytes, "base16")}`);
|
38218
38218
|
}
|
@@ -38238,8 +38238,8 @@ var require_src3 = __commonJS({
|
|
38238
38238
|
if (length2 && digest2.length !== length2) {
|
38239
38239
|
throw new Error("digest length should be equal to specified length.");
|
38240
38240
|
}
|
38241
|
-
const hash3 =
|
38242
|
-
const len =
|
38241
|
+
const hash3 = varint6.encode(hashfn);
|
38242
|
+
const len = varint6.encode(length2);
|
38243
38243
|
return uint8ArrayConcat([hash3, len, digest2], hash3.length + len.length + digest2.length);
|
38244
38244
|
}
|
38245
38245
|
__name(encode16, "encode");
|
@@ -38565,7 +38565,7 @@ var require_buffer2 = __commonJS({
|
|
38565
38565
|
Buffer3.poolSize = 8192;
|
38566
38566
|
function from4(value, encodingOrOffset, length2) {
|
38567
38567
|
if (typeof value === "string") {
|
38568
|
-
return
|
38568
|
+
return fromString7(value, encodingOrOffset);
|
38569
38569
|
}
|
38570
38570
|
if (ArrayBuffer.isView(value)) {
|
38571
38571
|
return fromArrayView(value);
|
@@ -38643,7 +38643,7 @@ var require_buffer2 = __commonJS({
|
|
38643
38643
|
Buffer3.allocUnsafeSlow = function(size) {
|
38644
38644
|
return allocUnsafe2(size);
|
38645
38645
|
};
|
38646
|
-
function
|
38646
|
+
function fromString7(string2, encoding) {
|
38647
38647
|
if (typeof encoding !== "string" || encoding === "") {
|
38648
38648
|
encoding = "utf8";
|
38649
38649
|
}
|
@@ -38658,7 +38658,7 @@ var require_buffer2 = __commonJS({
|
|
38658
38658
|
}
|
38659
38659
|
return buf2;
|
38660
38660
|
}
|
38661
|
-
__name(
|
38661
|
+
__name(fromString7, "fromString");
|
38662
38662
|
function fromArrayLike2(array) {
|
38663
38663
|
var length2 = array.length < 0 ? 0 : checked(array.length) | 0;
|
38664
38664
|
var buf2 = createBuffer(length2);
|
@@ -47344,6 +47344,100 @@ var VC_TEMPLATES = {
|
|
47344
47344
|
}
|
47345
47345
|
}
|
47346
47346
|
}
|
47347
|
+
}),
|
47348
|
+
boost: ({
|
47349
|
+
did = "did:example:d23dd687a7dc6787646f2eb98d0",
|
47350
|
+
subject = "did:example:d23dd687a7dc6787646f2eb98d0",
|
47351
|
+
issuanceDate = "2020-08-19T21:41:50Z",
|
47352
|
+
expirationDate,
|
47353
|
+
boostName = "Example Boost",
|
47354
|
+
boostId = "urn:uuid:boost:example:555",
|
47355
|
+
boostImage,
|
47356
|
+
achievementId = "urn:uuid:123",
|
47357
|
+
achievementType = "Influencer",
|
47358
|
+
achievementName = "Awesome Badge",
|
47359
|
+
achievementDescription = "Awesome People Earn Awesome Badge",
|
47360
|
+
achievementNarrative = "Earned by being awesome.",
|
47361
|
+
achievementImage = "",
|
47362
|
+
attachments,
|
47363
|
+
display
|
47364
|
+
} = {}) => ({
|
47365
|
+
"@context": [
|
47366
|
+
"https://www.w3.org/2018/credentials/v1",
|
47367
|
+
"https://purl.imsglobal.org/spec/ob/v3p0/context.json",
|
47368
|
+
{
|
47369
|
+
type: "@type",
|
47370
|
+
xsd: "https://www.w3.org/2001/XMLSchema#",
|
47371
|
+
lcn: "https://docs.learncard.com/definitions#",
|
47372
|
+
BoostCredential: {
|
47373
|
+
"@id": "lcn:boostCredential",
|
47374
|
+
"@context": {
|
47375
|
+
boostId: {
|
47376
|
+
"@id": "lcn:boostId",
|
47377
|
+
"@type": "xsd:string"
|
47378
|
+
},
|
47379
|
+
display: {
|
47380
|
+
"@id": "lcn:boostDisplay",
|
47381
|
+
"@context": {
|
47382
|
+
backgroundImage: {
|
47383
|
+
"@id": "lcn:boostBackgroundImage",
|
47384
|
+
"@type": "xsd:string"
|
47385
|
+
},
|
47386
|
+
backgroundColor: {
|
47387
|
+
"@id": "lcn:boostBackgroundColor",
|
47388
|
+
"@type": "xsd:string"
|
47389
|
+
}
|
47390
|
+
}
|
47391
|
+
},
|
47392
|
+
image: {
|
47393
|
+
"@id": "lcn:boostImage",
|
47394
|
+
"@type": "xsd:string"
|
47395
|
+
},
|
47396
|
+
attachments: {
|
47397
|
+
"@id": "lcn:boostAttachments",
|
47398
|
+
"@container": "@set",
|
47399
|
+
"@context": {
|
47400
|
+
type: {
|
47401
|
+
"@id": "lcn:boostAttachmentType",
|
47402
|
+
"@type": "xsd:string"
|
47403
|
+
},
|
47404
|
+
title: {
|
47405
|
+
"@id": "lcn:boostAttachmentTitle",
|
47406
|
+
"@type": "xsd:string"
|
47407
|
+
},
|
47408
|
+
url: {
|
47409
|
+
"@id": "lcn:boostAttachmentUrl",
|
47410
|
+
"@type": "xsd:string"
|
47411
|
+
}
|
47412
|
+
}
|
47413
|
+
}
|
47414
|
+
}
|
47415
|
+
}
|
47416
|
+
}
|
47417
|
+
],
|
47418
|
+
type: ["VerifiableCredential", "OpenBadgeCredential", "BoostCredential"],
|
47419
|
+
issuer: did,
|
47420
|
+
issuanceDate,
|
47421
|
+
name: boostName,
|
47422
|
+
expirationDate,
|
47423
|
+
credentialSubject: {
|
47424
|
+
id: subject,
|
47425
|
+
type: ["AchievementSubject"],
|
47426
|
+
achievement: {
|
47427
|
+
id: achievementId,
|
47428
|
+
type: ["Achievement"],
|
47429
|
+
achievementType,
|
47430
|
+
name: achievementName,
|
47431
|
+
description: achievementDescription,
|
47432
|
+
image: achievementImage,
|
47433
|
+
criteria: {
|
47434
|
+
narrative: achievementNarrative
|
47435
|
+
}
|
47436
|
+
}
|
47437
|
+
},
|
47438
|
+
display,
|
47439
|
+
image: boostImage,
|
47440
|
+
attachments
|
47347
47441
|
})
|
47348
47442
|
};
|
47349
47443
|
|
@@ -52579,6 +52673,11 @@ var BoostValidator = mod.object({
|
|
52579
52673
|
type: mod.string().optional(),
|
52580
52674
|
category: mod.string().optional()
|
52581
52675
|
});
|
52676
|
+
var BoostRecipientValidator = mod.object({
|
52677
|
+
to: LCNProfileValidator,
|
52678
|
+
from: mod.string(),
|
52679
|
+
received: mod.string()
|
52680
|
+
});
|
52582
52681
|
var JWKValidator = mod.object({
|
52583
52682
|
kty: mod.string(),
|
52584
52683
|
crv: mod.string(),
|
@@ -54610,10 +54709,10 @@ function wrapLegacyResolver(resolve) {
|
|
54610
54709
|
}
|
54611
54710
|
__name(wrapLegacyResolver, "wrapLegacyResolver");
|
54612
54711
|
var Resolver = class {
|
54613
|
-
constructor(
|
54712
|
+
constructor(registry2 = {}, options = {}) {
|
54614
54713
|
this.registry = void 0;
|
54615
54714
|
this.cache = void 0;
|
54616
|
-
this.registry =
|
54715
|
+
this.registry = registry2;
|
54617
54716
|
this.cache = options.cache === true ? inMemoryCache() : options.cache || noCache;
|
54618
54717
|
if (options.legacyResolvers) {
|
54619
54718
|
Object.keys(options.legacyResolvers).map((methodName) => {
|
@@ -63811,8 +63910,8 @@ __decorate2([
|
|
63811
63910
|
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/stream-ref.js
|
63812
63911
|
init_base36();
|
63813
63912
|
var StreamRef;
|
63814
|
-
(function(
|
63815
|
-
function
|
63913
|
+
(function(StreamRef2) {
|
63914
|
+
function fromBytes4(input) {
|
63816
63915
|
const parsed = fromBytes(input);
|
63817
63916
|
switch (parsed.kind) {
|
63818
63917
|
case "commit-id":
|
@@ -63823,9 +63922,9 @@ var StreamRef;
|
|
63823
63922
|
throw new Error(`Malformed StreamRef bytes: ${base36.encode(input)}`);
|
63824
63923
|
}
|
63825
63924
|
}
|
63826
|
-
__name(
|
63827
|
-
|
63828
|
-
function
|
63925
|
+
__name(fromBytes4, "fromBytes");
|
63926
|
+
StreamRef2.fromBytes = fromBytes4;
|
63927
|
+
function fromString7(input) {
|
63829
63928
|
const parsed = fromString4(input);
|
63830
63929
|
switch (parsed.kind) {
|
63831
63930
|
case "commit-id":
|
@@ -63836,8 +63935,8 @@ var StreamRef;
|
|
63836
63935
|
throw new Error(`Malformed StreamRef string: ${input}`);
|
63837
63936
|
}
|
63838
63937
|
}
|
63839
|
-
__name(
|
63840
|
-
|
63938
|
+
__name(fromString7, "fromString");
|
63939
|
+
StreamRef2.fromString = fromString7;
|
63841
63940
|
function from4(input) {
|
63842
63941
|
if (StreamID.isInstance(input)) {
|
63843
63942
|
return input;
|
@@ -63846,15 +63945,15 @@ var StreamRef;
|
|
63846
63945
|
return input;
|
63847
63946
|
}
|
63848
63947
|
if (input instanceof Uint8Array) {
|
63849
|
-
return
|
63948
|
+
return fromBytes4(input);
|
63850
63949
|
}
|
63851
63950
|
if (typeof input === "string") {
|
63852
|
-
return
|
63951
|
+
return fromString7(input);
|
63853
63952
|
}
|
63854
63953
|
throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(input)}`);
|
63855
63954
|
}
|
63856
63955
|
__name(from4, "from");
|
63857
|
-
|
63956
|
+
StreamRef2.from = from4;
|
63858
63957
|
})(StreamRef || (StreamRef = {}));
|
63859
63958
|
|
63860
63959
|
// ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/modules/index.js
|
@@ -66579,737 +66678,6 @@ var SyncOptions2;
|
|
66579
66678
|
|
66580
66679
|
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.20.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
66581
66680
|
var import_lodash4 = __toESM(require_lodash2(), 1);
|
66582
|
-
|
66583
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/commit-id.js
|
66584
|
-
init_cid();
|
66585
|
-
init_base36();
|
66586
|
-
|
66587
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/stream-type.js
|
66588
|
-
var registry2 = {
|
66589
|
-
tile: 0,
|
66590
|
-
"caip10-link": 1,
|
66591
|
-
model: 2,
|
66592
|
-
MID: 3,
|
66593
|
-
UNLOADABLE: 4
|
66594
|
-
};
|
66595
|
-
function codeByName2(name3) {
|
66596
|
-
const index = registry2[name3];
|
66597
|
-
if (typeof index !== "undefined") {
|
66598
|
-
return index;
|
66599
|
-
} else {
|
66600
|
-
throw new Error(`No stream type registered for name ${name3}`);
|
66601
|
-
}
|
66602
|
-
}
|
66603
|
-
__name(codeByName2, "codeByName");
|
66604
|
-
function nameByCode2(index) {
|
66605
|
-
const pair = Object.entries(registry2).find(([, v]) => v === index);
|
66606
|
-
if (pair) {
|
66607
|
-
return pair[0];
|
66608
|
-
} else {
|
66609
|
-
throw new Error(`No stream type registered for index ${index}`);
|
66610
|
-
}
|
66611
|
-
}
|
66612
|
-
__name(nameByCode2, "nameByCode");
|
66613
|
-
var StreamType2 = class {
|
66614
|
-
};
|
66615
|
-
__name(StreamType2, "StreamType");
|
66616
|
-
StreamType2.nameByCode = nameByCode2;
|
66617
|
-
StreamType2.codeByName = codeByName2;
|
66618
|
-
|
66619
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/commit-id.js
|
66620
|
-
var import_varint8 = __toESM(require_varint(), 1);
|
66621
|
-
|
66622
|
-
// ../../node_modules/.pnpm/mapmoize@1.2.1/node_modules/mapmoize/dist/ancillary.js
|
66623
|
-
var Strategy;
|
66624
|
-
(function(Strategy2) {
|
66625
|
-
Strategy2["WEAKMAP"] = "weakmap";
|
66626
|
-
Strategy2["REPLACE"] = "replace";
|
66627
|
-
})(Strategy || (Strategy = {}));
|
66628
|
-
|
66629
|
-
// ../../node_modules/.pnpm/mapmoize@1.2.1/node_modules/mapmoize/dist/getter.js
|
66630
|
-
function isGetterDescriptor(input) {
|
66631
|
-
return Boolean(input.get);
|
66632
|
-
}
|
66633
|
-
__name(isGetterDescriptor, "isGetterDescriptor");
|
66634
|
-
function memoizeGetter(descriptor, propertyKey, strategy) {
|
66635
|
-
const originalFunction = descriptor.get;
|
66636
|
-
switch (strategy) {
|
66637
|
-
case Strategy.WEAKMAP: {
|
66638
|
-
const bindings = /* @__PURE__ */ new WeakMap();
|
66639
|
-
descriptor.get = function() {
|
66640
|
-
let memoized = bindings.get(this);
|
66641
|
-
if (!memoized) {
|
66642
|
-
memoized = originalFunction.apply(this);
|
66643
|
-
bindings.set(this, memoized);
|
66644
|
-
}
|
66645
|
-
return memoized;
|
66646
|
-
};
|
66647
|
-
break;
|
66648
|
-
}
|
66649
|
-
case Strategy.REPLACE: {
|
66650
|
-
descriptor.get = function() {
|
66651
|
-
const value = originalFunction.apply(this);
|
66652
|
-
Object.defineProperty(this, propertyKey, {
|
66653
|
-
configurable: false,
|
66654
|
-
enumerable: false,
|
66655
|
-
value
|
66656
|
-
});
|
66657
|
-
return value;
|
66658
|
-
};
|
66659
|
-
break;
|
66660
|
-
}
|
66661
|
-
default:
|
66662
|
-
throw new Error(`Unsupported strategy: ${strategy}`);
|
66663
|
-
}
|
66664
|
-
}
|
66665
|
-
__name(memoizeGetter, "memoizeGetter");
|
66666
|
-
|
66667
|
-
// ../../node_modules/.pnpm/mapmoize@1.2.1/node_modules/mapmoize/dist/method.js
|
66668
|
-
function isMethodDescriptor(input) {
|
66669
|
-
return Boolean(input.value);
|
66670
|
-
}
|
66671
|
-
__name(isMethodDescriptor, "isMethodDescriptor");
|
66672
|
-
function memoizeMethod(descriptor, propertyKey, strategy, hashFunction, argsCacheBuilder) {
|
66673
|
-
const originalMethod = descriptor.value;
|
66674
|
-
switch (originalMethod.length) {
|
66675
|
-
case 0: {
|
66676
|
-
switch (strategy) {
|
66677
|
-
case Strategy.REPLACE: {
|
66678
|
-
descriptor.value = function() {
|
66679
|
-
const calculated = originalMethod.apply(this);
|
66680
|
-
Object.defineProperty(this, propertyKey, {
|
66681
|
-
enumerable: descriptor.enumerable,
|
66682
|
-
configurable: descriptor.configurable,
|
66683
|
-
writable: descriptor.writable,
|
66684
|
-
value: function() {
|
66685
|
-
return calculated;
|
66686
|
-
}
|
66687
|
-
});
|
66688
|
-
};
|
66689
|
-
return;
|
66690
|
-
}
|
66691
|
-
case Strategy.WEAKMAP: {
|
66692
|
-
const bindingsCache = /* @__PURE__ */ new WeakMap();
|
66693
|
-
descriptor.value = function() {
|
66694
|
-
if (bindingsCache.has(this)) {
|
66695
|
-
return bindingsCache.get(this);
|
66696
|
-
}
|
66697
|
-
let calculated = originalMethod.apply(this);
|
66698
|
-
bindingsCache.set(this, calculated);
|
66699
|
-
return calculated;
|
66700
|
-
};
|
66701
|
-
break;
|
66702
|
-
}
|
66703
|
-
}
|
66704
|
-
break;
|
66705
|
-
}
|
66706
|
-
case 1: {
|
66707
|
-
switch (strategy) {
|
66708
|
-
case Strategy.WEAKMAP: {
|
66709
|
-
const bindingsCache = /* @__PURE__ */ new WeakMap();
|
66710
|
-
descriptor.value = function(arg) {
|
66711
|
-
let argsCache = bindingsCache.get(this);
|
66712
|
-
if (!argsCache) {
|
66713
|
-
argsCache = argsCacheBuilder();
|
66714
|
-
bindingsCache.set(this, argsCache);
|
66715
|
-
}
|
66716
|
-
if (argsCache.has(arg)) {
|
66717
|
-
return argsCache.get(arg);
|
66718
|
-
}
|
66719
|
-
const memoized = originalMethod.call(this, arg);
|
66720
|
-
argsCache.set(arg, memoized);
|
66721
|
-
return memoized;
|
66722
|
-
};
|
66723
|
-
break;
|
66724
|
-
}
|
66725
|
-
case Strategy.REPLACE: {
|
66726
|
-
descriptor.value = function(arg) {
|
66727
|
-
const memoizationContainer = argsCacheBuilder();
|
66728
|
-
function replacement(arg2) {
|
66729
|
-
if (memoizationContainer.has(arg2)) {
|
66730
|
-
return memoizationContainer.get(arg2);
|
66731
|
-
} else {
|
66732
|
-
const memoized = originalMethod.call(this, arg2);
|
66733
|
-
memoizationContainer.set(arg2, memoized);
|
66734
|
-
return memoized;
|
66735
|
-
}
|
66736
|
-
}
|
66737
|
-
__name(replacement, "replacement");
|
66738
|
-
Object.defineProperty(this, propertyKey, {
|
66739
|
-
configurable: descriptor.configurable,
|
66740
|
-
enumerable: descriptor.enumerable,
|
66741
|
-
writable: descriptor.writable,
|
66742
|
-
value: replacement
|
66743
|
-
});
|
66744
|
-
return replacement.call(this, arg);
|
66745
|
-
};
|
66746
|
-
break;
|
66747
|
-
}
|
66748
|
-
}
|
66749
|
-
break;
|
66750
|
-
}
|
66751
|
-
default: {
|
66752
|
-
switch (strategy) {
|
66753
|
-
case Strategy.REPLACE: {
|
66754
|
-
descriptor.value = function(...args) {
|
66755
|
-
const memoizationContainer = argsCacheBuilder();
|
66756
|
-
function replacement(...args2) {
|
66757
|
-
const digest2 = hashFunction.apply(this, args2);
|
66758
|
-
if (memoizationContainer.has(digest2)) {
|
66759
|
-
return memoizationContainer.get(digest2);
|
66760
|
-
} else {
|
66761
|
-
const memoized = originalMethod.apply(this, args2);
|
66762
|
-
memoizationContainer.set(digest2, memoized);
|
66763
|
-
return memoized;
|
66764
|
-
}
|
66765
|
-
}
|
66766
|
-
__name(replacement, "replacement");
|
66767
|
-
Object.defineProperty(this, propertyKey, {
|
66768
|
-
configurable: descriptor.configurable,
|
66769
|
-
enumerable: descriptor.enumerable,
|
66770
|
-
writable: descriptor.writable,
|
66771
|
-
value: replacement
|
66772
|
-
});
|
66773
|
-
return replacement.apply(this, args);
|
66774
|
-
};
|
66775
|
-
break;
|
66776
|
-
}
|
66777
|
-
case Strategy.WEAKMAP: {
|
66778
|
-
const bindingsCache = /* @__PURE__ */ new WeakMap();
|
66779
|
-
descriptor.value = /* @__PURE__ */ __name(function replacement(...args) {
|
66780
|
-
let argsCache = bindingsCache.get(this);
|
66781
|
-
const digest2 = hashFunction.apply(this, args);
|
66782
|
-
if (argsCache?.has(digest2)) {
|
66783
|
-
return argsCache.get(digest2);
|
66784
|
-
}
|
66785
|
-
if (!argsCache) {
|
66786
|
-
argsCache = argsCacheBuilder();
|
66787
|
-
bindingsCache.set(this, argsCache);
|
66788
|
-
}
|
66789
|
-
const memoized = originalMethod.apply(this, args);
|
66790
|
-
argsCache.set(digest2, memoized);
|
66791
|
-
return memoized;
|
66792
|
-
}, "replacement");
|
66793
|
-
}
|
66794
|
-
}
|
66795
|
-
}
|
66796
|
-
}
|
66797
|
-
}
|
66798
|
-
__name(memoizeMethod, "memoizeMethod");
|
66799
|
-
|
66800
|
-
// ../../node_modules/.pnpm/mapmoize@1.2.1/node_modules/mapmoize/dist/index.js
|
66801
|
-
function defaultDigest(...args) {
|
66802
|
-
let result = "";
|
66803
|
-
for (let i2 = 0, length2 = args.length; i2 < length2; i2++) {
|
66804
|
-
result += `${args[i2]}$!$`;
|
66805
|
-
}
|
66806
|
-
return result;
|
66807
|
-
}
|
66808
|
-
__name(defaultDigest, "defaultDigest");
|
66809
|
-
function memoize(params) {
|
66810
|
-
const hashFunction = params?.hashFunction || defaultDigest;
|
66811
|
-
const strategy = params?.strategy || Strategy.WEAKMAP;
|
66812
|
-
const argsCacheBuilder = params?.argsCacheBuilder || (() => /* @__PURE__ */ new Map());
|
66813
|
-
return (target, propertyKey, descriptor) => {
|
66814
|
-
if (isMethodDescriptor(descriptor)) {
|
66815
|
-
memoizeMethod(descriptor, propertyKey, strategy, hashFunction, argsCacheBuilder);
|
66816
|
-
return;
|
66817
|
-
}
|
66818
|
-
if (isGetterDescriptor(descriptor)) {
|
66819
|
-
memoizeGetter(descriptor, propertyKey, strategy);
|
66820
|
-
return;
|
66821
|
-
}
|
66822
|
-
throw new Error("Decorate only a method or get accessor");
|
66823
|
-
};
|
66824
|
-
}
|
66825
|
-
__name(memoize, "memoize");
|
66826
|
-
var Memoize2 = memoize;
|
66827
|
-
|
66828
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/constants.js
|
66829
|
-
var STREAMID_CODEC2 = 206;
|
66830
|
-
|
66831
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/stream-id.js
|
66832
|
-
init_cid();
|
66833
|
-
init_base36();
|
66834
|
-
init_sha2_browser();
|
66835
|
-
var import_varint7 = __toESM(require_varint(), 1);
|
66836
|
-
|
66837
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/try-catch.util.js
|
66838
|
-
function tryCatch2(fn) {
|
66839
|
-
try {
|
66840
|
-
return fn();
|
66841
|
-
} catch (e2) {
|
66842
|
-
return e2;
|
66843
|
-
}
|
66844
|
-
}
|
66845
|
-
__name(tryCatch2, "tryCatch");
|
66846
|
-
|
66847
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/reading-bytes.js
|
66848
|
-
init_cid();
|
66849
|
-
var import_varint6 = __toESM(require_varint(), 1);
|
66850
|
-
init_digest();
|
66851
|
-
function readVarint2(bytes) {
|
66852
|
-
const value = import_varint6.default.decode(bytes);
|
66853
|
-
const readLength = import_varint6.default.decode.bytes;
|
66854
|
-
const remainder = bytes.subarray(readLength);
|
66855
|
-
return [value, remainder, readLength];
|
66856
|
-
}
|
66857
|
-
__name(readVarint2, "readVarint");
|
66858
|
-
function isCidVersion2(input) {
|
66859
|
-
return input === 0 || input === 1;
|
66860
|
-
}
|
66861
|
-
__name(isCidVersion2, "isCidVersion");
|
66862
|
-
function readCid2(bytes) {
|
66863
|
-
const [cidVersion, cidVersionRemainder] = readVarint2(bytes);
|
66864
|
-
if (!isCidVersion2(cidVersion)) {
|
66865
|
-
throw new Error(`Unknown CID version ${cidVersion}`);
|
66866
|
-
}
|
66867
|
-
const [codec, codecRemainder] = readVarint2(cidVersionRemainder);
|
66868
|
-
const [, mhCodecRemainder, mhCodecLength] = readVarint2(codecRemainder);
|
66869
|
-
const [mhLength, , mhLengthLength] = readVarint2(mhCodecRemainder);
|
66870
|
-
const multihashBytes = codecRemainder.subarray(0, mhCodecLength + mhLengthLength + mhLength);
|
66871
|
-
const multihashBytesRemainder = codecRemainder.subarray(mhCodecLength + mhLengthLength + mhLength);
|
66872
|
-
return [CID.create(cidVersion, codec, decode5(multihashBytes)), multihashBytesRemainder];
|
66873
|
-
}
|
66874
|
-
__name(readCid2, "readCid");
|
66875
|
-
|
66876
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/stream-ref-parsing.js
|
66877
|
-
init_cid();
|
66878
|
-
init_base36();
|
66879
|
-
function fromBytes4(input, title = "StreamRef") {
|
66880
|
-
const [streamCodec, streamCodecRemainder] = readVarint2(input);
|
66881
|
-
if (streamCodec !== STREAMID_CODEC2)
|
66882
|
-
throw new Error(`Invalid ${title}, does not include streamid codec`);
|
66883
|
-
const [type, streamtypeRemainder] = readVarint2(streamCodecRemainder);
|
66884
|
-
const cidResult = readCid2(streamtypeRemainder);
|
66885
|
-
const [genesis, genesisRemainder] = cidResult;
|
66886
|
-
if (genesisRemainder.length === 0) {
|
66887
|
-
return {
|
66888
|
-
kind: "stream-id",
|
66889
|
-
type,
|
66890
|
-
genesis
|
66891
|
-
};
|
66892
|
-
} else if (genesisRemainder.length === 1 && genesisRemainder[0] === 0) {
|
66893
|
-
return {
|
66894
|
-
kind: "commit-id",
|
66895
|
-
type,
|
66896
|
-
genesis,
|
66897
|
-
commit: null
|
66898
|
-
};
|
66899
|
-
} else {
|
66900
|
-
const [commit] = readCid2(genesisRemainder);
|
66901
|
-
return {
|
66902
|
-
kind: "commit-id",
|
66903
|
-
type,
|
66904
|
-
genesis,
|
66905
|
-
commit
|
66906
|
-
};
|
66907
|
-
}
|
66908
|
-
}
|
66909
|
-
__name(fromBytes4, "fromBytes");
|
66910
|
-
var URL_PATTERN2 = /(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;
|
66911
|
-
function fromString7(input, title = "StreamRef") {
|
66912
|
-
const protocolMatch = URL_PATTERN2.exec(input) || [];
|
66913
|
-
const base4 = protocolMatch[2];
|
66914
|
-
if (!base4)
|
66915
|
-
throw new Error(`Malformed ${title} string: ${input}`);
|
66916
|
-
const bytes = base36.decode(base4);
|
66917
|
-
const streamRef = fromBytes4(bytes);
|
66918
|
-
const commit = protocolMatch[4];
|
66919
|
-
if (commit) {
|
66920
|
-
return {
|
66921
|
-
kind: "commit-id",
|
66922
|
-
type: streamRef.type,
|
66923
|
-
genesis: streamRef.genesis,
|
66924
|
-
commit: parseCommit2(streamRef.genesis, commit)
|
66925
|
-
};
|
66926
|
-
}
|
66927
|
-
return streamRef;
|
66928
|
-
}
|
66929
|
-
__name(fromString7, "fromString");
|
66930
|
-
function parseCID2(input) {
|
66931
|
-
try {
|
66932
|
-
return typeof input === "string" ? CID.parse(input) : CID.asCID(input);
|
66933
|
-
} catch {
|
66934
|
-
return null;
|
66935
|
-
}
|
66936
|
-
}
|
66937
|
-
__name(parseCID2, "parseCID");
|
66938
|
-
function parseCommit2(genesis, commit = null) {
|
66939
|
-
if (!commit)
|
66940
|
-
return null;
|
66941
|
-
if (commit === "0")
|
66942
|
-
return null;
|
66943
|
-
const commitCID = parseCID2(commit);
|
66944
|
-
if (commitCID) {
|
66945
|
-
if (genesis.equals(commitCID)) {
|
66946
|
-
return null;
|
66947
|
-
} else {
|
66948
|
-
return commitCID;
|
66949
|
-
}
|
66950
|
-
} else {
|
66951
|
-
throw new Error("Cannot specify commit as a number except to request commit 0 (the genesis commit)");
|
66952
|
-
}
|
66953
|
-
}
|
66954
|
-
__name(parseCommit2, "parseCommit");
|
66955
|
-
|
66956
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/stream-id.js
|
66957
|
-
var __decorate5 = function(decorators, target, key2, desc) {
|
66958
|
-
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
66959
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
66960
|
-
r = Reflect.decorate(decorators, target, key2, desc);
|
66961
|
-
else
|
66962
|
-
for (var i2 = decorators.length - 1; i2 >= 0; i2--)
|
66963
|
-
if (d3 = decorators[i2])
|
66964
|
-
r = (c2 < 3 ? d3(r) : c2 > 3 ? d3(target, key2, r) : d3(target, key2)) || r;
|
66965
|
-
return c2 > 3 && r && Object.defineProperty(target, key2, r), r;
|
66966
|
-
};
|
66967
|
-
var __metadata4 = function(k2, v) {
|
66968
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
66969
|
-
return Reflect.metadata(k2, v);
|
66970
|
-
};
|
66971
|
-
var InvalidStreamIDBytesError2 = class extends Error {
|
66972
|
-
constructor(bytes) {
|
66973
|
-
super(`Invalid StreamID bytes ${base36.encode(bytes)}: contains commit`);
|
66974
|
-
}
|
66975
|
-
};
|
66976
|
-
__name(InvalidStreamIDBytesError2, "InvalidStreamIDBytesError");
|
66977
|
-
var InvalidStreamIDStringError2 = class extends Error {
|
66978
|
-
constructor(input) {
|
66979
|
-
super(`Invalid StreamID string ${input}: contains commit`);
|
66980
|
-
}
|
66981
|
-
};
|
66982
|
-
__name(InvalidStreamIDStringError2, "InvalidStreamIDStringError");
|
66983
|
-
function fromBytes5(bytes) {
|
66984
|
-
const parsed = fromBytes4(bytes, "StreamID");
|
66985
|
-
if (parsed.kind === "stream-id") {
|
66986
|
-
return new StreamID2(parsed.type, parsed.genesis);
|
66987
|
-
}
|
66988
|
-
throw new InvalidStreamIDBytesError2(bytes);
|
66989
|
-
}
|
66990
|
-
__name(fromBytes5, "fromBytes");
|
66991
|
-
function fromBytesNoThrow3(bytes) {
|
66992
|
-
return tryCatch2(() => fromBytes5(bytes));
|
66993
|
-
}
|
66994
|
-
__name(fromBytesNoThrow3, "fromBytesNoThrow");
|
66995
|
-
function fromString8(input) {
|
66996
|
-
const parsed = fromString7(input, "StreamID");
|
66997
|
-
if (parsed.kind === "stream-id") {
|
66998
|
-
return new StreamID2(parsed.type, parsed.genesis);
|
66999
|
-
}
|
67000
|
-
throw new InvalidStreamIDStringError2(input);
|
67001
|
-
}
|
67002
|
-
__name(fromString8, "fromString");
|
67003
|
-
function fromStringNoThrow3(input) {
|
67004
|
-
return tryCatch2(() => fromString8(input));
|
67005
|
-
}
|
67006
|
-
__name(fromStringNoThrow3, "fromStringNoThrow");
|
67007
|
-
var TAG3 = Symbol.for("@ceramicnetwork/streamid/StreamID");
|
67008
|
-
var StreamID2 = class {
|
67009
|
-
constructor(type, cid) {
|
67010
|
-
this._tag = TAG3;
|
67011
|
-
if (!(type || type === 0))
|
67012
|
-
throw new Error("StreamID constructor: type required");
|
67013
|
-
if (!cid)
|
67014
|
-
throw new Error("StreamID constructor: cid required");
|
67015
|
-
this._type = typeof type === "string" ? StreamType2.codeByName(type) : type;
|
67016
|
-
this._cid = typeof cid === "string" ? CID.parse(cid) : cid;
|
67017
|
-
}
|
67018
|
-
static isInstance(instance) {
|
67019
|
-
return typeof instance === "object" && "_tag" in instance && instance._tag === TAG3;
|
67020
|
-
}
|
67021
|
-
static async fromGenesis(type, genesis) {
|
67022
|
-
const block = await encode5({ value: genesis, codec: esm_exports, hasher: sha256 });
|
67023
|
-
return new StreamID2(type, block.cid);
|
67024
|
-
}
|
67025
|
-
get type() {
|
67026
|
-
return this._type;
|
67027
|
-
}
|
67028
|
-
get typeName() {
|
67029
|
-
return StreamType2.nameByCode(this._type);
|
67030
|
-
}
|
67031
|
-
get cid() {
|
67032
|
-
return this._cid;
|
67033
|
-
}
|
67034
|
-
get bytes() {
|
67035
|
-
const codec = import_varint7.default.encode(STREAMID_CODEC2);
|
67036
|
-
const type = import_varint7.default.encode(this.type);
|
67037
|
-
return concat([codec, type, this.cid.bytes]);
|
67038
|
-
}
|
67039
|
-
get baseID() {
|
67040
|
-
return new StreamID2(this._type, this._cid);
|
67041
|
-
}
|
67042
|
-
equals(other) {
|
67043
|
-
if (StreamID2.isInstance(other)) {
|
67044
|
-
return this.type === other.type && this.cid.equals(other.cid);
|
67045
|
-
} else {
|
67046
|
-
return false;
|
67047
|
-
}
|
67048
|
-
}
|
67049
|
-
toString() {
|
67050
|
-
return base36.encode(this.bytes);
|
67051
|
-
}
|
67052
|
-
toUrl() {
|
67053
|
-
return `ceramic://${this.toString()}`;
|
67054
|
-
}
|
67055
|
-
[Symbol.for("nodejs.util.inspect.custom")]() {
|
67056
|
-
return `StreamID(${this.toString()})`;
|
67057
|
-
}
|
67058
|
-
[Symbol.toPrimitive]() {
|
67059
|
-
return this.toString();
|
67060
|
-
}
|
67061
|
-
};
|
67062
|
-
__name(StreamID2, "StreamID");
|
67063
|
-
StreamID2.fromBytes = fromBytes5;
|
67064
|
-
StreamID2.fromBytesNoThrow = fromBytesNoThrow3;
|
67065
|
-
StreamID2.fromString = fromString8;
|
67066
|
-
StreamID2.fromStringNoThrow = fromStringNoThrow3;
|
67067
|
-
__decorate5([
|
67068
|
-
Memoize2(),
|
67069
|
-
__metadata4("design:type", String),
|
67070
|
-
__metadata4("design:paramtypes", [])
|
67071
|
-
], StreamID2.prototype, "typeName", null);
|
67072
|
-
__decorate5([
|
67073
|
-
Memoize2(),
|
67074
|
-
__metadata4("design:type", Uint8Array),
|
67075
|
-
__metadata4("design:paramtypes", [])
|
67076
|
-
], StreamID2.prototype, "bytes", null);
|
67077
|
-
__decorate5([
|
67078
|
-
Memoize2(),
|
67079
|
-
__metadata4("design:type", StreamID2),
|
67080
|
-
__metadata4("design:paramtypes", [])
|
67081
|
-
], StreamID2.prototype, "baseID", null);
|
67082
|
-
__decorate5([
|
67083
|
-
Memoize2(),
|
67084
|
-
__metadata4("design:type", Function),
|
67085
|
-
__metadata4("design:paramtypes", []),
|
67086
|
-
__metadata4("design:returntype", String)
|
67087
|
-
], StreamID2.prototype, "toString", null);
|
67088
|
-
__decorate5([
|
67089
|
-
Memoize2(),
|
67090
|
-
__metadata4("design:type", Function),
|
67091
|
-
__metadata4("design:paramtypes", []),
|
67092
|
-
__metadata4("design:returntype", String)
|
67093
|
-
], StreamID2.prototype, "toUrl", null);
|
67094
|
-
|
67095
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/commit-id.js
|
67096
|
-
var __decorate6 = function(decorators, target, key2, desc) {
|
67097
|
-
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
67098
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
67099
|
-
r = Reflect.decorate(decorators, target, key2, desc);
|
67100
|
-
else
|
67101
|
-
for (var i2 = decorators.length - 1; i2 >= 0; i2--)
|
67102
|
-
if (d3 = decorators[i2])
|
67103
|
-
r = (c2 < 3 ? d3(r) : c2 > 3 ? d3(target, key2, r) : d3(target, key2)) || r;
|
67104
|
-
return c2 > 3 && r && Object.defineProperty(target, key2, r), r;
|
67105
|
-
};
|
67106
|
-
var __metadata5 = function(k2, v) {
|
67107
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
67108
|
-
return Reflect.metadata(k2, v);
|
67109
|
-
};
|
67110
|
-
var __classPrivateFieldSet3 = function(receiver, state, value, kind, f) {
|
67111
|
-
if (kind === "m")
|
67112
|
-
throw new TypeError("Private method is not writable");
|
67113
|
-
if (kind === "a" && !f)
|
67114
|
-
throw new TypeError("Private accessor was defined without a setter");
|
67115
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
67116
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
67117
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
67118
|
-
};
|
67119
|
-
var __classPrivateFieldGet3 = function(receiver, state, kind, f) {
|
67120
|
-
if (kind === "a" && !f)
|
67121
|
-
throw new TypeError("Private accessor was defined without a getter");
|
67122
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
67123
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
67124
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
67125
|
-
};
|
67126
|
-
var _CommitID_type2;
|
67127
|
-
var _CommitID_cid2;
|
67128
|
-
var _CommitID_commit2;
|
67129
|
-
var InvalidCommitIDBytesError2 = class extends Error {
|
67130
|
-
constructor(bytes) {
|
67131
|
-
super(`Error while parsing CommitID from bytes ${base36.encode(bytes)}: no commit information provided`);
|
67132
|
-
}
|
67133
|
-
};
|
67134
|
-
__name(InvalidCommitIDBytesError2, "InvalidCommitIDBytesError");
|
67135
|
-
var InvalidCommitIDStringError2 = class extends Error {
|
67136
|
-
constructor(input) {
|
67137
|
-
super(`Error while parsing CommitID from string ${input}: no commit information provided`);
|
67138
|
-
}
|
67139
|
-
};
|
67140
|
-
__name(InvalidCommitIDStringError2, "InvalidCommitIDStringError");
|
67141
|
-
function fromBytes6(bytes) {
|
67142
|
-
const parsed = fromBytes4(bytes, "CommitID");
|
67143
|
-
if (parsed.kind === "commit-id") {
|
67144
|
-
return new CommitID2(parsed.type, parsed.genesis, parsed.commit);
|
67145
|
-
}
|
67146
|
-
throw new InvalidCommitIDBytesError2(bytes);
|
67147
|
-
}
|
67148
|
-
__name(fromBytes6, "fromBytes");
|
67149
|
-
function fromBytesNoThrow4(bytes) {
|
67150
|
-
return tryCatch2(() => fromBytes6(bytes));
|
67151
|
-
}
|
67152
|
-
__name(fromBytesNoThrow4, "fromBytesNoThrow");
|
67153
|
-
function fromString9(input) {
|
67154
|
-
const parsed = fromString7(input, "CommitID");
|
67155
|
-
if (parsed.kind === "commit-id") {
|
67156
|
-
return new CommitID2(parsed.type, parsed.genesis, parsed.commit);
|
67157
|
-
}
|
67158
|
-
throw new InvalidCommitIDStringError2(input);
|
67159
|
-
}
|
67160
|
-
__name(fromString9, "fromString");
|
67161
|
-
function fromStringNoThrow4(input) {
|
67162
|
-
return tryCatch2(() => fromString9(input));
|
67163
|
-
}
|
67164
|
-
__name(fromStringNoThrow4, "fromStringNoThrow");
|
67165
|
-
var TAG4 = Symbol.for("@ceramicnetwork/streamid/CommitID");
|
67166
|
-
function make2(stream, commit) {
|
67167
|
-
return new CommitID2(stream.type, stream.cid, commit);
|
67168
|
-
}
|
67169
|
-
__name(make2, "make");
|
67170
|
-
var CommitID2 = class {
|
67171
|
-
constructor(type, cid, commit = null) {
|
67172
|
-
this._tag = TAG4;
|
67173
|
-
_CommitID_type2.set(this, void 0);
|
67174
|
-
_CommitID_cid2.set(this, void 0);
|
67175
|
-
_CommitID_commit2.set(this, void 0);
|
67176
|
-
if (!type && type !== 0)
|
67177
|
-
throw new Error("constructor: type required");
|
67178
|
-
if (!cid)
|
67179
|
-
throw new Error("constructor: cid required");
|
67180
|
-
__classPrivateFieldSet3(this, _CommitID_type2, typeof type === "string" ? StreamType2.codeByName(type) : type, "f");
|
67181
|
-
__classPrivateFieldSet3(this, _CommitID_cid2, typeof cid === "string" ? CID.parse(cid) : cid, "f");
|
67182
|
-
__classPrivateFieldSet3(this, _CommitID_commit2, parseCommit2(__classPrivateFieldGet3(this, _CommitID_cid2, "f"), commit), "f");
|
67183
|
-
}
|
67184
|
-
static isInstance(instance) {
|
67185
|
-
return typeof instance === "object" && "_tag" in instance && instance._tag === TAG4;
|
67186
|
-
}
|
67187
|
-
get baseID() {
|
67188
|
-
return new StreamID2(__classPrivateFieldGet3(this, _CommitID_type2, "f"), __classPrivateFieldGet3(this, _CommitID_cid2, "f"));
|
67189
|
-
}
|
67190
|
-
get type() {
|
67191
|
-
return __classPrivateFieldGet3(this, _CommitID_type2, "f");
|
67192
|
-
}
|
67193
|
-
get typeName() {
|
67194
|
-
return StreamType2.nameByCode(__classPrivateFieldGet3(this, _CommitID_type2, "f"));
|
67195
|
-
}
|
67196
|
-
get cid() {
|
67197
|
-
return __classPrivateFieldGet3(this, _CommitID_cid2, "f");
|
67198
|
-
}
|
67199
|
-
get commit() {
|
67200
|
-
return __classPrivateFieldGet3(this, _CommitID_commit2, "f") || __classPrivateFieldGet3(this, _CommitID_cid2, "f");
|
67201
|
-
}
|
67202
|
-
get bytes() {
|
67203
|
-
const codec = import_varint8.default.encode(STREAMID_CODEC2);
|
67204
|
-
const type = import_varint8.default.encode(this.type);
|
67205
|
-
const commitBytes = __classPrivateFieldGet3(this, _CommitID_commit2, "f")?.bytes || new Uint8Array([0]);
|
67206
|
-
return concat([codec, type, this.cid.bytes, commitBytes]);
|
67207
|
-
}
|
67208
|
-
equals(other) {
|
67209
|
-
return this.type === other.type && this.cid.equals(other.cid) && this.commit.equals(other.commit);
|
67210
|
-
}
|
67211
|
-
toString() {
|
67212
|
-
return base36.encode(this.bytes);
|
67213
|
-
}
|
67214
|
-
toUrl() {
|
67215
|
-
return `ceramic://${this.toString()}`;
|
67216
|
-
}
|
67217
|
-
[(_CommitID_type2 = /* @__PURE__ */ new WeakMap(), _CommitID_cid2 = /* @__PURE__ */ new WeakMap(), _CommitID_commit2 = /* @__PURE__ */ new WeakMap(), Symbol.for("nodejs.util.inspect.custom"))]() {
|
67218
|
-
return `CommitID(${this.toString()})`;
|
67219
|
-
}
|
67220
|
-
[Symbol.toPrimitive]() {
|
67221
|
-
return this.toString();
|
67222
|
-
}
|
67223
|
-
};
|
67224
|
-
__name(CommitID2, "CommitID");
|
67225
|
-
CommitID2.fromBytes = fromBytes6;
|
67226
|
-
CommitID2.fromBytesNoThrow = fromBytesNoThrow4;
|
67227
|
-
CommitID2.fromString = fromString9;
|
67228
|
-
CommitID2.fromStringNoThrow = fromStringNoThrow4;
|
67229
|
-
CommitID2.make = make2;
|
67230
|
-
__decorate6([
|
67231
|
-
Memoize2(),
|
67232
|
-
__metadata5("design:type", StreamID2),
|
67233
|
-
__metadata5("design:paramtypes", [])
|
67234
|
-
], CommitID2.prototype, "baseID", null);
|
67235
|
-
__decorate6([
|
67236
|
-
Memoize2(),
|
67237
|
-
__metadata5("design:type", String),
|
67238
|
-
__metadata5("design:paramtypes", [])
|
67239
|
-
], CommitID2.prototype, "typeName", null);
|
67240
|
-
__decorate6([
|
67241
|
-
Memoize2(),
|
67242
|
-
__metadata5("design:type", CID),
|
67243
|
-
__metadata5("design:paramtypes", [])
|
67244
|
-
], CommitID2.prototype, "commit", null);
|
67245
|
-
__decorate6([
|
67246
|
-
Memoize2(),
|
67247
|
-
__metadata5("design:type", Uint8Array),
|
67248
|
-
__metadata5("design:paramtypes", [])
|
67249
|
-
], CommitID2.prototype, "bytes", null);
|
67250
|
-
__decorate6([
|
67251
|
-
Memoize2(),
|
67252
|
-
__metadata5("design:type", Function),
|
67253
|
-
__metadata5("design:paramtypes", []),
|
67254
|
-
__metadata5("design:returntype", String)
|
67255
|
-
], CommitID2.prototype, "toString", null);
|
67256
|
-
__decorate6([
|
67257
|
-
Memoize2(),
|
67258
|
-
__metadata5("design:type", Function),
|
67259
|
-
__metadata5("design:paramtypes", []),
|
67260
|
-
__metadata5("design:returntype", String)
|
67261
|
-
], CommitID2.prototype, "toUrl", null);
|
67262
|
-
|
67263
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/stream-ref.js
|
67264
|
-
init_base36();
|
67265
|
-
var StreamRef2;
|
67266
|
-
(function(StreamRef3) {
|
67267
|
-
function fromBytes7(input) {
|
67268
|
-
const parsed = fromBytes4(input);
|
67269
|
-
switch (parsed.kind) {
|
67270
|
-
case "commit-id":
|
67271
|
-
return new CommitID2(parsed.type, parsed.genesis, parsed.commit);
|
67272
|
-
case "stream-id":
|
67273
|
-
return new StreamID2(parsed.type, parsed.genesis);
|
67274
|
-
default:
|
67275
|
-
throw new Error(`Malformed StreamRef bytes: ${base36.encode(input)}`);
|
67276
|
-
}
|
67277
|
-
}
|
67278
|
-
__name(fromBytes7, "fromBytes");
|
67279
|
-
StreamRef3.fromBytes = fromBytes7;
|
67280
|
-
function fromString10(input) {
|
67281
|
-
const parsed = fromString7(input);
|
67282
|
-
switch (parsed.kind) {
|
67283
|
-
case "commit-id":
|
67284
|
-
return new CommitID2(parsed.type, parsed.genesis, parsed.commit);
|
67285
|
-
case "stream-id":
|
67286
|
-
return new StreamID2(parsed.type, parsed.genesis);
|
67287
|
-
default:
|
67288
|
-
throw new Error(`Malformed StreamRef string: ${input}`);
|
67289
|
-
}
|
67290
|
-
}
|
67291
|
-
__name(fromString10, "fromString");
|
67292
|
-
StreamRef3.fromString = fromString10;
|
67293
|
-
function from4(input) {
|
67294
|
-
if (StreamID2.isInstance(input)) {
|
67295
|
-
return input;
|
67296
|
-
}
|
67297
|
-
if (CommitID2.isInstance(input)) {
|
67298
|
-
return input;
|
67299
|
-
}
|
67300
|
-
if (input instanceof Uint8Array) {
|
67301
|
-
return fromBytes7(input);
|
67302
|
-
}
|
67303
|
-
if (typeof input === "string") {
|
67304
|
-
return fromString10(input);
|
67305
|
-
}
|
67306
|
-
throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(input)}`);
|
67307
|
-
}
|
67308
|
-
__name(from4, "from");
|
67309
|
-
StreamRef3.from = from4;
|
67310
|
-
})(StreamRef2 || (StreamRef2 = {}));
|
67311
|
-
|
67312
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.20.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
67313
66681
|
var SignatureStatus2;
|
67314
66682
|
(function(SignatureStatus3) {
|
67315
66683
|
SignatureStatus3[SignatureStatus3["GENESIS"] = 0] = "GENESIS";
|
@@ -67339,7 +66707,7 @@ var Stream2 = class extends Observable {
|
|
67339
66707
|
this._context = _context;
|
67340
66708
|
}
|
67341
66709
|
get id() {
|
67342
|
-
return new
|
66710
|
+
return new StreamID(this.state$.value.type, this.state$.value.log[0].cid);
|
67343
66711
|
}
|
67344
66712
|
get api() {
|
67345
66713
|
return this._context.api;
|
@@ -67352,13 +66720,13 @@ var Stream2 = class extends Observable {
|
|
67352
66720
|
return this.state$.value.log[this.state$.value.log.length - 1].cid;
|
67353
66721
|
}
|
67354
66722
|
get commitId() {
|
67355
|
-
return
|
66723
|
+
return CommitID.make(this.id, this.tip);
|
67356
66724
|
}
|
67357
66725
|
get allCommitIds() {
|
67358
|
-
return this.state$.value.log.map(({ cid }) =>
|
66726
|
+
return this.state$.value.log.map(({ cid }) => CommitID.make(this.id, cid));
|
67359
66727
|
}
|
67360
66728
|
get anchorCommitIds() {
|
67361
|
-
return this.state$.value.log.filter(({ type }) => type === CommitType2.ANCHOR).map(({ cid }) =>
|
66729
|
+
return this.state$.value.log.filter(({ type }) => type === CommitType2.ANCHOR).map(({ cid }) => CommitID.make(this.id, cid));
|
67362
66730
|
}
|
67363
66731
|
get state() {
|
67364
66732
|
return (0, import_lodash4.default)(this.state$.value);
|
@@ -67395,7 +66763,7 @@ __name(normalizeAccountId, "normalizeAccountId");
|
|
67395
66763
|
|
67396
66764
|
// ../../node_modules/.pnpm/@ceramicnetwork+stream-caip10-link@2.15.0/node_modules/@ceramicnetwork/stream-caip10-link/lib/caip10-link.js
|
67397
66765
|
var import_lodash5 = __toESM(require_lodash2(), 1);
|
67398
|
-
var
|
66766
|
+
var __decorate5 = function(decorators, target, key2, desc) {
|
67399
66767
|
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
67400
66768
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
67401
66769
|
r = Reflect.decorate(decorators, target, key2, desc);
|
@@ -67465,7 +66833,7 @@ var Caip10Link = Caip10Link_1 = /* @__PURE__ */ __name(class Caip10Link2 extends
|
|
67465
66833
|
}
|
67466
66834
|
static async load(ceramic, streamId, opts = {}) {
|
67467
66835
|
opts = { ...DEFAULT_LOAD_OPTS2, ...opts };
|
67468
|
-
const streamRef =
|
66836
|
+
const streamRef = StreamRef.from(streamId);
|
67469
66837
|
if (streamRef.type != Caip10Link_1.STREAM_TYPE_ID) {
|
67470
66838
|
throw new Error(`StreamID ${streamRef.toString()} does not refer to a '${Caip10Link_1.STREAM_TYPE_NAME}' stream, but to a ${streamRef.typeName}`);
|
67471
66839
|
}
|
@@ -67498,7 +66866,7 @@ var Caip10Link = Caip10Link_1 = /* @__PURE__ */ __name(class Caip10Link2 extends
|
|
67498
66866
|
}, "Caip10Link");
|
67499
66867
|
Caip10Link.STREAM_TYPE_NAME = "caip10-link";
|
67500
66868
|
Caip10Link.STREAM_TYPE_ID = 1;
|
67501
|
-
Caip10Link = Caip10Link_1 =
|
66869
|
+
Caip10Link = Caip10Link_1 = __decorate5([
|
67502
66870
|
StreamStatic2()
|
67503
66871
|
], Caip10Link);
|
67504
66872
|
|
@@ -67506,7 +66874,7 @@ Caip10Link = Caip10Link_1 = __decorate7([
|
|
67506
66874
|
init_cid();
|
67507
66875
|
init_digest();
|
67508
66876
|
var import_multihashes = __toESM(require_src3(), 1);
|
67509
|
-
var
|
66877
|
+
var __decorate6 = function(decorators, target, key2, desc) {
|
67510
66878
|
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
67511
66879
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
67512
66880
|
r = Reflect.decorate(decorators, target, key2, desc);
|
@@ -67633,13 +67001,13 @@ Model.MODEL = function() {
|
|
67633
67001
|
const cid = CID.createV1(code2, digest2);
|
67634
67002
|
return new StreamID("UNLOADABLE", cid);
|
67635
67003
|
}();
|
67636
|
-
Model = Model_1 =
|
67004
|
+
Model = Model_1 = __decorate6([
|
67637
67005
|
StreamStatic()
|
67638
67006
|
], Model);
|
67639
67007
|
|
67640
67008
|
// ../../node_modules/.pnpm/@ceramicnetwork+stream-model-instance@0.6.0/node_modules/@ceramicnetwork/stream-model-instance/lib/model-instance-document.js
|
67641
67009
|
var import_random4 = __toESM(require_random(), 1);
|
67642
|
-
var
|
67010
|
+
var __decorate7 = function(decorators, target, key2, desc) {
|
67643
67011
|
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
67644
67012
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
67645
67013
|
r = Reflect.decorate(decorators, target, key2, desc);
|
@@ -67791,7 +67159,7 @@ var ModelInstanceDocument = ModelInstanceDocument_1 = /* @__PURE__ */ __name(cla
|
|
67791
67159
|
}, "ModelInstanceDocument");
|
67792
67160
|
ModelInstanceDocument.STREAM_TYPE_NAME = "MID";
|
67793
67161
|
ModelInstanceDocument.STREAM_TYPE_ID = 3;
|
67794
|
-
ModelInstanceDocument = ModelInstanceDocument_1 =
|
67162
|
+
ModelInstanceDocument = ModelInstanceDocument_1 = __decorate7([
|
67795
67163
|
StreamStatic()
|
67796
67164
|
], ModelInstanceDocument);
|
67797
67165
|
|