@learncard/core 8.5.0 → 8.5.1
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/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
@@ -1828,11 +1828,11 @@ var require_set_to_string_tag = __commonJS({
|
|
1828
1828
|
var hasOwn = require_has_own_property();
|
1829
1829
|
var wellKnownSymbol = require_well_known_symbol();
|
1830
1830
|
var TO_STRING_TAG = wellKnownSymbol("toStringTag");
|
1831
|
-
module2.exports = function(target,
|
1831
|
+
module2.exports = function(target, TAG3, STATIC) {
|
1832
1832
|
if (target && !STATIC)
|
1833
1833
|
target = target.prototype;
|
1834
1834
|
if (target && !hasOwn(target, TO_STRING_TAG)) {
|
1835
|
-
defineProperty(target, TO_STRING_TAG, { configurable: true, value:
|
1835
|
+
defineProperty(target, TO_STRING_TAG, { configurable: true, value: TAG3 });
|
1836
1836
|
}
|
1837
1837
|
};
|
1838
1838
|
}
|
@@ -6596,7 +6596,7 @@ var require_lodash = __commonJS({
|
|
6596
6596
|
}
|
6597
6597
|
__name(matchesStrictComparable, "matchesStrictComparable");
|
6598
6598
|
function memoizeCapped(func) {
|
6599
|
-
var result2 =
|
6599
|
+
var result2 = memoize(func, function(key2) {
|
6600
6600
|
if (cache.size === MAX_MEMOIZE_SIZE) {
|
6601
6601
|
cache.clear();
|
6602
6602
|
}
|
@@ -7657,7 +7657,7 @@ var require_lodash = __commonJS({
|
|
7657
7657
|
return createWrap(func, WRAP_FLIP_FLAG);
|
7658
7658
|
}
|
7659
7659
|
__name(flip, "flip");
|
7660
|
-
function
|
7660
|
+
function memoize(func, resolver) {
|
7661
7661
|
if (typeof func != "function" || resolver != null && typeof resolver != "function") {
|
7662
7662
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
7663
7663
|
}
|
@@ -7670,11 +7670,11 @@ var require_lodash = __commonJS({
|
|
7670
7670
|
memoized.cache = cache.set(key2, result2) || cache;
|
7671
7671
|
return result2;
|
7672
7672
|
}, "memoized");
|
7673
|
-
memoized.cache = new (
|
7673
|
+
memoized.cache = new (memoize.Cache || MapCache)();
|
7674
7674
|
return memoized;
|
7675
7675
|
}
|
7676
|
-
__name(
|
7677
|
-
|
7676
|
+
__name(memoize, "memoize");
|
7677
|
+
memoize.Cache = MapCache;
|
7678
7678
|
function negate(predicate) {
|
7679
7679
|
if (typeof predicate != "function") {
|
7680
7680
|
throw new TypeError2(FUNC_ERROR_TEXT);
|
@@ -8937,7 +8937,7 @@ var require_lodash = __commonJS({
|
|
8937
8937
|
lodash.mapValues = mapValues;
|
8938
8938
|
lodash.matches = matches;
|
8939
8939
|
lodash.matchesProperty = matchesProperty;
|
8940
|
-
lodash.memoize =
|
8940
|
+
lodash.memoize = memoize;
|
8941
8941
|
lodash.merge = merge2;
|
8942
8942
|
lodash.mergeWith = mergeWith;
|
8943
8943
|
lodash.method = method;
|
@@ -36534,13 +36534,13 @@ var require_tslib = __commonJS({
|
|
36534
36534
|
var __extends3;
|
36535
36535
|
var __assign2;
|
36536
36536
|
var __rest2;
|
36537
|
-
var
|
36537
|
+
var __decorate8;
|
36538
36538
|
var __param2;
|
36539
36539
|
var __esDecorate2;
|
36540
36540
|
var __runInitializers2;
|
36541
36541
|
var __propKey2;
|
36542
36542
|
var __setFunctionName2;
|
36543
|
-
var
|
36543
|
+
var __metadata4;
|
36544
36544
|
var __awaiter2;
|
36545
36545
|
var __generator2;
|
36546
36546
|
var __exportStar2;
|
@@ -36556,8 +36556,8 @@ var require_tslib = __commonJS({
|
|
36556
36556
|
var __makeTemplateObject2;
|
36557
36557
|
var __importStar2;
|
36558
36558
|
var __importDefault2;
|
36559
|
-
var
|
36560
|
-
var
|
36559
|
+
var __classPrivateFieldGet3;
|
36560
|
+
var __classPrivateFieldSet3;
|
36561
36561
|
var __classPrivateFieldIn2;
|
36562
36562
|
var __createBinding2;
|
36563
36563
|
(function(factory) {
|
@@ -36623,7 +36623,7 @@ var require_tslib = __commonJS({
|
|
36623
36623
|
}
|
36624
36624
|
return t2;
|
36625
36625
|
}, "__rest");
|
36626
|
-
|
36626
|
+
__decorate8 = /* @__PURE__ */ __name(function(decorators, target, key2, desc) {
|
36627
36627
|
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
36628
36628
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
36629
36629
|
r = Reflect.decorate(decorators, target, key2, desc);
|
@@ -36698,7 +36698,7 @@ var require_tslib = __commonJS({
|
|
36698
36698
|
name3 = name3.description ? "[".concat(name3.description, "]") : "";
|
36699
36699
|
return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name3) : name3 });
|
36700
36700
|
}, "__setFunctionName");
|
36701
|
-
|
36701
|
+
__metadata4 = /* @__PURE__ */ __name(function(metadataKey, metadataValue) {
|
36702
36702
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
36703
36703
|
return Reflect.metadata(metadataKey, metadataValue);
|
36704
36704
|
}, "__metadata");
|
@@ -36999,14 +36999,14 @@ var require_tslib = __commonJS({
|
|
36999
36999
|
__importDefault2 = /* @__PURE__ */ __name(function(mod2) {
|
37000
37000
|
return mod2 && mod2.__esModule ? mod2 : { "default": mod2 };
|
37001
37001
|
}, "__importDefault");
|
37002
|
-
|
37002
|
+
__classPrivateFieldGet3 = /* @__PURE__ */ __name(function(receiver, state, kind, f) {
|
37003
37003
|
if (kind === "a" && !f)
|
37004
37004
|
throw new TypeError("Private accessor was defined without a getter");
|
37005
37005
|
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
37006
37006
|
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
37007
37007
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
37008
37008
|
}, "__classPrivateFieldGet");
|
37009
|
-
|
37009
|
+
__classPrivateFieldSet3 = /* @__PURE__ */ __name(function(receiver, state, value, kind, f) {
|
37010
37010
|
if (kind === "m")
|
37011
37011
|
throw new TypeError("Private method is not writable");
|
37012
37012
|
if (kind === "a" && !f)
|
@@ -37023,13 +37023,13 @@ var require_tslib = __commonJS({
|
|
37023
37023
|
exporter("__extends", __extends3);
|
37024
37024
|
exporter("__assign", __assign2);
|
37025
37025
|
exporter("__rest", __rest2);
|
37026
|
-
exporter("__decorate",
|
37026
|
+
exporter("__decorate", __decorate8);
|
37027
37027
|
exporter("__param", __param2);
|
37028
37028
|
exporter("__esDecorate", __esDecorate2);
|
37029
37029
|
exporter("__runInitializers", __runInitializers2);
|
37030
37030
|
exporter("__propKey", __propKey2);
|
37031
37031
|
exporter("__setFunctionName", __setFunctionName2);
|
37032
|
-
exporter("__metadata",
|
37032
|
+
exporter("__metadata", __metadata4);
|
37033
37033
|
exporter("__awaiter", __awaiter2);
|
37034
37034
|
exporter("__generator", __generator2);
|
37035
37035
|
exporter("__exportStar", __exportStar2);
|
@@ -37046,8 +37046,8 @@ var require_tslib = __commonJS({
|
|
37046
37046
|
exporter("__makeTemplateObject", __makeTemplateObject2);
|
37047
37047
|
exporter("__importStar", __importStar2);
|
37048
37048
|
exporter("__importDefault", __importDefault2);
|
37049
|
-
exporter("__classPrivateFieldGet",
|
37050
|
-
exporter("__classPrivateFieldSet",
|
37049
|
+
exporter("__classPrivateFieldGet", __classPrivateFieldGet3);
|
37050
|
+
exporter("__classPrivateFieldSet", __classPrivateFieldSet3);
|
37051
37051
|
exporter("__classPrivateFieldIn", __classPrivateFieldIn2);
|
37052
37052
|
});
|
37053
37053
|
}
|
@@ -38156,7 +38156,7 @@ var require_src3 = __commonJS({
|
|
38156
38156
|
"../../node_modules/.pnpm/multihashes@4.0.3/node_modules/multihashes/src/index.js"(exports, module2) {
|
38157
38157
|
"use strict";
|
38158
38158
|
var multibase = require_src2();
|
38159
|
-
var
|
38159
|
+
var varint6 = require_varint2();
|
38160
38160
|
var { names } = require_constants2();
|
38161
38161
|
var { toString: uint8ArrayToString } = (init_to_string(), __toCommonJS(to_string_exports));
|
38162
38162
|
var { fromString: uint8ArrayFromString } = (init_from_string(), __toCommonJS(from_string_exports));
|
@@ -38197,16 +38197,16 @@ var require_src3 = __commonJS({
|
|
38197
38197
|
if (bytes.length < 2) {
|
38198
38198
|
throw new Error("multihash too short. must be > 2 bytes.");
|
38199
38199
|
}
|
38200
|
-
const code3 =
|
38200
|
+
const code3 = varint6.decode(bytes);
|
38201
38201
|
if (!isValidCode(code3)) {
|
38202
38202
|
throw new Error(`multihash unknown function code: 0x${code3.toString(16)}`);
|
38203
38203
|
}
|
38204
|
-
bytes = bytes.slice(
|
38205
|
-
const len =
|
38204
|
+
bytes = bytes.slice(varint6.decode.bytes);
|
38205
|
+
const len = varint6.decode(bytes);
|
38206
38206
|
if (len < 0) {
|
38207
38207
|
throw new Error(`multihash invalid length: ${len}`);
|
38208
38208
|
}
|
38209
|
-
bytes = bytes.slice(
|
38209
|
+
bytes = bytes.slice(varint6.decode.bytes);
|
38210
38210
|
if (bytes.length !== len) {
|
38211
38211
|
throw new Error(`multihash length inconsistent: 0x${uint8ArrayToString(bytes, "base16")}`);
|
38212
38212
|
}
|
@@ -38232,8 +38232,8 @@ var require_src3 = __commonJS({
|
|
38232
38232
|
if (length2 && digest2.length !== length2) {
|
38233
38233
|
throw new Error("digest length should be equal to specified length.");
|
38234
38234
|
}
|
38235
|
-
const hash3 =
|
38236
|
-
const len =
|
38235
|
+
const hash3 = varint6.encode(hashfn);
|
38236
|
+
const len = varint6.encode(length2);
|
38237
38237
|
return uint8ArrayConcat([hash3, len, digest2], hash3.length + len.length + digest2.length);
|
38238
38238
|
}
|
38239
38239
|
__name(encode16, "encode");
|
@@ -38559,7 +38559,7 @@ var require_buffer2 = __commonJS({
|
|
38559
38559
|
Buffer3.poolSize = 8192;
|
38560
38560
|
function from4(value, encodingOrOffset, length2) {
|
38561
38561
|
if (typeof value === "string") {
|
38562
|
-
return
|
38562
|
+
return fromString7(value, encodingOrOffset);
|
38563
38563
|
}
|
38564
38564
|
if (ArrayBuffer.isView(value)) {
|
38565
38565
|
return fromArrayView(value);
|
@@ -38637,7 +38637,7 @@ var require_buffer2 = __commonJS({
|
|
38637
38637
|
Buffer3.allocUnsafeSlow = function(size) {
|
38638
38638
|
return allocUnsafe2(size);
|
38639
38639
|
};
|
38640
|
-
function
|
38640
|
+
function fromString7(string2, encoding) {
|
38641
38641
|
if (typeof encoding !== "string" || encoding === "") {
|
38642
38642
|
encoding = "utf8";
|
38643
38643
|
}
|
@@ -38652,7 +38652,7 @@ var require_buffer2 = __commonJS({
|
|
38652
38652
|
}
|
38653
38653
|
return buf2;
|
38654
38654
|
}
|
38655
|
-
__name(
|
38655
|
+
__name(fromString7, "fromString");
|
38656
38656
|
function fromArrayLike2(array) {
|
38657
38657
|
var length2 = array.length < 0 ? 0 : checked(array.length) | 0;
|
38658
38658
|
var buf2 = createBuffer(length2);
|
@@ -47369,6 +47369,100 @@ var VC_TEMPLATES = {
|
|
47369
47369
|
}
|
47370
47370
|
}
|
47371
47371
|
}
|
47372
|
+
}),
|
47373
|
+
boost: ({
|
47374
|
+
did = "did:example:d23dd687a7dc6787646f2eb98d0",
|
47375
|
+
subject = "did:example:d23dd687a7dc6787646f2eb98d0",
|
47376
|
+
issuanceDate = "2020-08-19T21:41:50Z",
|
47377
|
+
expirationDate,
|
47378
|
+
boostName = "Example Boost",
|
47379
|
+
boostId = "urn:uuid:boost:example:555",
|
47380
|
+
boostImage,
|
47381
|
+
achievementId = "urn:uuid:123",
|
47382
|
+
achievementType = "Influencer",
|
47383
|
+
achievementName = "Awesome Badge",
|
47384
|
+
achievementDescription = "Awesome People Earn Awesome Badge",
|
47385
|
+
achievementNarrative = "Earned by being awesome.",
|
47386
|
+
achievementImage = "",
|
47387
|
+
attachments,
|
47388
|
+
display
|
47389
|
+
} = {}) => ({
|
47390
|
+
"@context": [
|
47391
|
+
"https://www.w3.org/2018/credentials/v1",
|
47392
|
+
"https://purl.imsglobal.org/spec/ob/v3p0/context.json",
|
47393
|
+
{
|
47394
|
+
type: "@type",
|
47395
|
+
xsd: "https://www.w3.org/2001/XMLSchema#",
|
47396
|
+
lcn: "https://docs.learncard.com/definitions#",
|
47397
|
+
BoostCredential: {
|
47398
|
+
"@id": "lcn:boostCredential",
|
47399
|
+
"@context": {
|
47400
|
+
boostId: {
|
47401
|
+
"@id": "lcn:boostId",
|
47402
|
+
"@type": "xsd:string"
|
47403
|
+
},
|
47404
|
+
display: {
|
47405
|
+
"@id": "lcn:boostDisplay",
|
47406
|
+
"@context": {
|
47407
|
+
backgroundImage: {
|
47408
|
+
"@id": "lcn:boostBackgroundImage",
|
47409
|
+
"@type": "xsd:string"
|
47410
|
+
},
|
47411
|
+
backgroundColor: {
|
47412
|
+
"@id": "lcn:boostBackgroundColor",
|
47413
|
+
"@type": "xsd:string"
|
47414
|
+
}
|
47415
|
+
}
|
47416
|
+
},
|
47417
|
+
image: {
|
47418
|
+
"@id": "lcn:boostImage",
|
47419
|
+
"@type": "xsd:string"
|
47420
|
+
},
|
47421
|
+
attachments: {
|
47422
|
+
"@id": "lcn:boostAttachments",
|
47423
|
+
"@container": "@set",
|
47424
|
+
"@context": {
|
47425
|
+
type: {
|
47426
|
+
"@id": "lcn:boostAttachmentType",
|
47427
|
+
"@type": "xsd:string"
|
47428
|
+
},
|
47429
|
+
title: {
|
47430
|
+
"@id": "lcn:boostAttachmentTitle",
|
47431
|
+
"@type": "xsd:string"
|
47432
|
+
},
|
47433
|
+
url: {
|
47434
|
+
"@id": "lcn:boostAttachmentUrl",
|
47435
|
+
"@type": "xsd:string"
|
47436
|
+
}
|
47437
|
+
}
|
47438
|
+
}
|
47439
|
+
}
|
47440
|
+
}
|
47441
|
+
}
|
47442
|
+
],
|
47443
|
+
type: ["VerifiableCredential", "OpenBadgeCredential", "BoostCredential"],
|
47444
|
+
issuer: did,
|
47445
|
+
issuanceDate,
|
47446
|
+
name: boostName,
|
47447
|
+
expirationDate,
|
47448
|
+
credentialSubject: {
|
47449
|
+
id: subject,
|
47450
|
+
type: ["AchievementSubject"],
|
47451
|
+
achievement: {
|
47452
|
+
id: achievementId,
|
47453
|
+
type: ["Achievement"],
|
47454
|
+
achievementType,
|
47455
|
+
name: achievementName,
|
47456
|
+
description: achievementDescription,
|
47457
|
+
image: achievementImage,
|
47458
|
+
criteria: {
|
47459
|
+
narrative: achievementNarrative
|
47460
|
+
}
|
47461
|
+
}
|
47462
|
+
},
|
47463
|
+
display,
|
47464
|
+
image: boostImage,
|
47465
|
+
attachments
|
47372
47466
|
})
|
47373
47467
|
};
|
47374
47468
|
|
@@ -52604,6 +52698,11 @@ var BoostValidator = mod.object({
|
|
52604
52698
|
type: mod.string().optional(),
|
52605
52699
|
category: mod.string().optional()
|
52606
52700
|
});
|
52701
|
+
var BoostRecipientValidator = mod.object({
|
52702
|
+
to: LCNProfileValidator,
|
52703
|
+
from: mod.string(),
|
52704
|
+
received: mod.string()
|
52705
|
+
});
|
52607
52706
|
var JWKValidator = mod.object({
|
52608
52707
|
kty: mod.string(),
|
52609
52708
|
crv: mod.string(),
|
@@ -54635,10 +54734,10 @@ function wrapLegacyResolver(resolve) {
|
|
54635
54734
|
}
|
54636
54735
|
__name(wrapLegacyResolver, "wrapLegacyResolver");
|
54637
54736
|
var Resolver = class {
|
54638
|
-
constructor(
|
54737
|
+
constructor(registry2 = {}, options = {}) {
|
54639
54738
|
this.registry = void 0;
|
54640
54739
|
this.cache = void 0;
|
54641
|
-
this.registry =
|
54740
|
+
this.registry = registry2;
|
54642
54741
|
this.cache = options.cache === true ? inMemoryCache() : options.cache || noCache;
|
54643
54742
|
if (options.legacyResolvers) {
|
54644
54743
|
Object.keys(options.legacyResolvers).map((methodName) => {
|
@@ -63836,8 +63935,8 @@ __decorate2([
|
|
63836
63935
|
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/stream-ref.js
|
63837
63936
|
init_base36();
|
63838
63937
|
var StreamRef;
|
63839
|
-
(function(
|
63840
|
-
function
|
63938
|
+
(function(StreamRef2) {
|
63939
|
+
function fromBytes4(input) {
|
63841
63940
|
const parsed = fromBytes(input);
|
63842
63941
|
switch (parsed.kind) {
|
63843
63942
|
case "commit-id":
|
@@ -63848,9 +63947,9 @@ var StreamRef;
|
|
63848
63947
|
throw new Error(`Malformed StreamRef bytes: ${base36.encode(input)}`);
|
63849
63948
|
}
|
63850
63949
|
}
|
63851
|
-
__name(
|
63852
|
-
|
63853
|
-
function
|
63950
|
+
__name(fromBytes4, "fromBytes");
|
63951
|
+
StreamRef2.fromBytes = fromBytes4;
|
63952
|
+
function fromString7(input) {
|
63854
63953
|
const parsed = fromString4(input);
|
63855
63954
|
switch (parsed.kind) {
|
63856
63955
|
case "commit-id":
|
@@ -63861,8 +63960,8 @@ var StreamRef;
|
|
63861
63960
|
throw new Error(`Malformed StreamRef string: ${input}`);
|
63862
63961
|
}
|
63863
63962
|
}
|
63864
|
-
__name(
|
63865
|
-
|
63963
|
+
__name(fromString7, "fromString");
|
63964
|
+
StreamRef2.fromString = fromString7;
|
63866
63965
|
function from4(input) {
|
63867
63966
|
if (StreamID.isInstance(input)) {
|
63868
63967
|
return input;
|
@@ -63871,15 +63970,15 @@ var StreamRef;
|
|
63871
63970
|
return input;
|
63872
63971
|
}
|
63873
63972
|
if (input instanceof Uint8Array) {
|
63874
|
-
return
|
63973
|
+
return fromBytes4(input);
|
63875
63974
|
}
|
63876
63975
|
if (typeof input === "string") {
|
63877
|
-
return
|
63976
|
+
return fromString7(input);
|
63878
63977
|
}
|
63879
63978
|
throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(input)}`);
|
63880
63979
|
}
|
63881
63980
|
__name(from4, "from");
|
63882
|
-
|
63981
|
+
StreamRef2.from = from4;
|
63883
63982
|
})(StreamRef || (StreamRef = {}));
|
63884
63983
|
|
63885
63984
|
// ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/modules/index.js
|
@@ -66604,737 +66703,6 @@ var SyncOptions2;
|
|
66604
66703
|
|
66605
66704
|
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.20.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
66606
66705
|
var import_lodash4 = __toESM(require_lodash2(), 1);
|
66607
|
-
|
66608
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/commit-id.js
|
66609
|
-
init_cid();
|
66610
|
-
init_base36();
|
66611
|
-
|
66612
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/stream-type.js
|
66613
|
-
var registry2 = {
|
66614
|
-
tile: 0,
|
66615
|
-
"caip10-link": 1,
|
66616
|
-
model: 2,
|
66617
|
-
MID: 3,
|
66618
|
-
UNLOADABLE: 4
|
66619
|
-
};
|
66620
|
-
function codeByName2(name3) {
|
66621
|
-
const index = registry2[name3];
|
66622
|
-
if (typeof index !== "undefined") {
|
66623
|
-
return index;
|
66624
|
-
} else {
|
66625
|
-
throw new Error(`No stream type registered for name ${name3}`);
|
66626
|
-
}
|
66627
|
-
}
|
66628
|
-
__name(codeByName2, "codeByName");
|
66629
|
-
function nameByCode2(index) {
|
66630
|
-
const pair = Object.entries(registry2).find(([, v]) => v === index);
|
66631
|
-
if (pair) {
|
66632
|
-
return pair[0];
|
66633
|
-
} else {
|
66634
|
-
throw new Error(`No stream type registered for index ${index}`);
|
66635
|
-
}
|
66636
|
-
}
|
66637
|
-
__name(nameByCode2, "nameByCode");
|
66638
|
-
var StreamType2 = class {
|
66639
|
-
};
|
66640
|
-
__name(StreamType2, "StreamType");
|
66641
|
-
StreamType2.nameByCode = nameByCode2;
|
66642
|
-
StreamType2.codeByName = codeByName2;
|
66643
|
-
|
66644
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/commit-id.js
|
66645
|
-
var import_varint8 = __toESM(require_varint(), 1);
|
66646
|
-
|
66647
|
-
// ../../node_modules/.pnpm/mapmoize@1.2.1/node_modules/mapmoize/dist/ancillary.js
|
66648
|
-
var Strategy;
|
66649
|
-
(function(Strategy2) {
|
66650
|
-
Strategy2["WEAKMAP"] = "weakmap";
|
66651
|
-
Strategy2["REPLACE"] = "replace";
|
66652
|
-
})(Strategy || (Strategy = {}));
|
66653
|
-
|
66654
|
-
// ../../node_modules/.pnpm/mapmoize@1.2.1/node_modules/mapmoize/dist/getter.js
|
66655
|
-
function isGetterDescriptor(input) {
|
66656
|
-
return Boolean(input.get);
|
66657
|
-
}
|
66658
|
-
__name(isGetterDescriptor, "isGetterDescriptor");
|
66659
|
-
function memoizeGetter(descriptor, propertyKey, strategy) {
|
66660
|
-
const originalFunction = descriptor.get;
|
66661
|
-
switch (strategy) {
|
66662
|
-
case Strategy.WEAKMAP: {
|
66663
|
-
const bindings = /* @__PURE__ */ new WeakMap();
|
66664
|
-
descriptor.get = function() {
|
66665
|
-
let memoized = bindings.get(this);
|
66666
|
-
if (!memoized) {
|
66667
|
-
memoized = originalFunction.apply(this);
|
66668
|
-
bindings.set(this, memoized);
|
66669
|
-
}
|
66670
|
-
return memoized;
|
66671
|
-
};
|
66672
|
-
break;
|
66673
|
-
}
|
66674
|
-
case Strategy.REPLACE: {
|
66675
|
-
descriptor.get = function() {
|
66676
|
-
const value = originalFunction.apply(this);
|
66677
|
-
Object.defineProperty(this, propertyKey, {
|
66678
|
-
configurable: false,
|
66679
|
-
enumerable: false,
|
66680
|
-
value
|
66681
|
-
});
|
66682
|
-
return value;
|
66683
|
-
};
|
66684
|
-
break;
|
66685
|
-
}
|
66686
|
-
default:
|
66687
|
-
throw new Error(`Unsupported strategy: ${strategy}`);
|
66688
|
-
}
|
66689
|
-
}
|
66690
|
-
__name(memoizeGetter, "memoizeGetter");
|
66691
|
-
|
66692
|
-
// ../../node_modules/.pnpm/mapmoize@1.2.1/node_modules/mapmoize/dist/method.js
|
66693
|
-
function isMethodDescriptor(input) {
|
66694
|
-
return Boolean(input.value);
|
66695
|
-
}
|
66696
|
-
__name(isMethodDescriptor, "isMethodDescriptor");
|
66697
|
-
function memoizeMethod(descriptor, propertyKey, strategy, hashFunction, argsCacheBuilder) {
|
66698
|
-
const originalMethod = descriptor.value;
|
66699
|
-
switch (originalMethod.length) {
|
66700
|
-
case 0: {
|
66701
|
-
switch (strategy) {
|
66702
|
-
case Strategy.REPLACE: {
|
66703
|
-
descriptor.value = function() {
|
66704
|
-
const calculated = originalMethod.apply(this);
|
66705
|
-
Object.defineProperty(this, propertyKey, {
|
66706
|
-
enumerable: descriptor.enumerable,
|
66707
|
-
configurable: descriptor.configurable,
|
66708
|
-
writable: descriptor.writable,
|
66709
|
-
value: function() {
|
66710
|
-
return calculated;
|
66711
|
-
}
|
66712
|
-
});
|
66713
|
-
};
|
66714
|
-
return;
|
66715
|
-
}
|
66716
|
-
case Strategy.WEAKMAP: {
|
66717
|
-
const bindingsCache = /* @__PURE__ */ new WeakMap();
|
66718
|
-
descriptor.value = function() {
|
66719
|
-
if (bindingsCache.has(this)) {
|
66720
|
-
return bindingsCache.get(this);
|
66721
|
-
}
|
66722
|
-
let calculated = originalMethod.apply(this);
|
66723
|
-
bindingsCache.set(this, calculated);
|
66724
|
-
return calculated;
|
66725
|
-
};
|
66726
|
-
break;
|
66727
|
-
}
|
66728
|
-
}
|
66729
|
-
break;
|
66730
|
-
}
|
66731
|
-
case 1: {
|
66732
|
-
switch (strategy) {
|
66733
|
-
case Strategy.WEAKMAP: {
|
66734
|
-
const bindingsCache = /* @__PURE__ */ new WeakMap();
|
66735
|
-
descriptor.value = function(arg) {
|
66736
|
-
let argsCache = bindingsCache.get(this);
|
66737
|
-
if (!argsCache) {
|
66738
|
-
argsCache = argsCacheBuilder();
|
66739
|
-
bindingsCache.set(this, argsCache);
|
66740
|
-
}
|
66741
|
-
if (argsCache.has(arg)) {
|
66742
|
-
return argsCache.get(arg);
|
66743
|
-
}
|
66744
|
-
const memoized = originalMethod.call(this, arg);
|
66745
|
-
argsCache.set(arg, memoized);
|
66746
|
-
return memoized;
|
66747
|
-
};
|
66748
|
-
break;
|
66749
|
-
}
|
66750
|
-
case Strategy.REPLACE: {
|
66751
|
-
descriptor.value = function(arg) {
|
66752
|
-
const memoizationContainer = argsCacheBuilder();
|
66753
|
-
function replacement(arg2) {
|
66754
|
-
if (memoizationContainer.has(arg2)) {
|
66755
|
-
return memoizationContainer.get(arg2);
|
66756
|
-
} else {
|
66757
|
-
const memoized = originalMethod.call(this, arg2);
|
66758
|
-
memoizationContainer.set(arg2, memoized);
|
66759
|
-
return memoized;
|
66760
|
-
}
|
66761
|
-
}
|
66762
|
-
__name(replacement, "replacement");
|
66763
|
-
Object.defineProperty(this, propertyKey, {
|
66764
|
-
configurable: descriptor.configurable,
|
66765
|
-
enumerable: descriptor.enumerable,
|
66766
|
-
writable: descriptor.writable,
|
66767
|
-
value: replacement
|
66768
|
-
});
|
66769
|
-
return replacement.call(this, arg);
|
66770
|
-
};
|
66771
|
-
break;
|
66772
|
-
}
|
66773
|
-
}
|
66774
|
-
break;
|
66775
|
-
}
|
66776
|
-
default: {
|
66777
|
-
switch (strategy) {
|
66778
|
-
case Strategy.REPLACE: {
|
66779
|
-
descriptor.value = function(...args) {
|
66780
|
-
const memoizationContainer = argsCacheBuilder();
|
66781
|
-
function replacement(...args2) {
|
66782
|
-
const digest2 = hashFunction.apply(this, args2);
|
66783
|
-
if (memoizationContainer.has(digest2)) {
|
66784
|
-
return memoizationContainer.get(digest2);
|
66785
|
-
} else {
|
66786
|
-
const memoized = originalMethod.apply(this, args2);
|
66787
|
-
memoizationContainer.set(digest2, memoized);
|
66788
|
-
return memoized;
|
66789
|
-
}
|
66790
|
-
}
|
66791
|
-
__name(replacement, "replacement");
|
66792
|
-
Object.defineProperty(this, propertyKey, {
|
66793
|
-
configurable: descriptor.configurable,
|
66794
|
-
enumerable: descriptor.enumerable,
|
66795
|
-
writable: descriptor.writable,
|
66796
|
-
value: replacement
|
66797
|
-
});
|
66798
|
-
return replacement.apply(this, args);
|
66799
|
-
};
|
66800
|
-
break;
|
66801
|
-
}
|
66802
|
-
case Strategy.WEAKMAP: {
|
66803
|
-
const bindingsCache = /* @__PURE__ */ new WeakMap();
|
66804
|
-
descriptor.value = /* @__PURE__ */ __name(function replacement(...args) {
|
66805
|
-
let argsCache = bindingsCache.get(this);
|
66806
|
-
const digest2 = hashFunction.apply(this, args);
|
66807
|
-
if (argsCache?.has(digest2)) {
|
66808
|
-
return argsCache.get(digest2);
|
66809
|
-
}
|
66810
|
-
if (!argsCache) {
|
66811
|
-
argsCache = argsCacheBuilder();
|
66812
|
-
bindingsCache.set(this, argsCache);
|
66813
|
-
}
|
66814
|
-
const memoized = originalMethod.apply(this, args);
|
66815
|
-
argsCache.set(digest2, memoized);
|
66816
|
-
return memoized;
|
66817
|
-
}, "replacement");
|
66818
|
-
}
|
66819
|
-
}
|
66820
|
-
}
|
66821
|
-
}
|
66822
|
-
}
|
66823
|
-
__name(memoizeMethod, "memoizeMethod");
|
66824
|
-
|
66825
|
-
// ../../node_modules/.pnpm/mapmoize@1.2.1/node_modules/mapmoize/dist/index.js
|
66826
|
-
function defaultDigest(...args) {
|
66827
|
-
let result = "";
|
66828
|
-
for (let i2 = 0, length2 = args.length; i2 < length2; i2++) {
|
66829
|
-
result += `${args[i2]}$!$`;
|
66830
|
-
}
|
66831
|
-
return result;
|
66832
|
-
}
|
66833
|
-
__name(defaultDigest, "defaultDigest");
|
66834
|
-
function memoize(params) {
|
66835
|
-
const hashFunction = params?.hashFunction || defaultDigest;
|
66836
|
-
const strategy = params?.strategy || Strategy.WEAKMAP;
|
66837
|
-
const argsCacheBuilder = params?.argsCacheBuilder || (() => /* @__PURE__ */ new Map());
|
66838
|
-
return (target, propertyKey, descriptor) => {
|
66839
|
-
if (isMethodDescriptor(descriptor)) {
|
66840
|
-
memoizeMethod(descriptor, propertyKey, strategy, hashFunction, argsCacheBuilder);
|
66841
|
-
return;
|
66842
|
-
}
|
66843
|
-
if (isGetterDescriptor(descriptor)) {
|
66844
|
-
memoizeGetter(descriptor, propertyKey, strategy);
|
66845
|
-
return;
|
66846
|
-
}
|
66847
|
-
throw new Error("Decorate only a method or get accessor");
|
66848
|
-
};
|
66849
|
-
}
|
66850
|
-
__name(memoize, "memoize");
|
66851
|
-
var Memoize2 = memoize;
|
66852
|
-
|
66853
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/constants.js
|
66854
|
-
var STREAMID_CODEC2 = 206;
|
66855
|
-
|
66856
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/stream-id.js
|
66857
|
-
init_cid();
|
66858
|
-
init_base36();
|
66859
|
-
init_sha2_browser();
|
66860
|
-
var import_varint7 = __toESM(require_varint(), 1);
|
66861
|
-
|
66862
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/try-catch.util.js
|
66863
|
-
function tryCatch2(fn) {
|
66864
|
-
try {
|
66865
|
-
return fn();
|
66866
|
-
} catch (e2) {
|
66867
|
-
return e2;
|
66868
|
-
}
|
66869
|
-
}
|
66870
|
-
__name(tryCatch2, "tryCatch");
|
66871
|
-
|
66872
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/reading-bytes.js
|
66873
|
-
init_cid();
|
66874
|
-
var import_varint6 = __toESM(require_varint(), 1);
|
66875
|
-
init_digest();
|
66876
|
-
function readVarint2(bytes) {
|
66877
|
-
const value = import_varint6.default.decode(bytes);
|
66878
|
-
const readLength = import_varint6.default.decode.bytes;
|
66879
|
-
const remainder = bytes.subarray(readLength);
|
66880
|
-
return [value, remainder, readLength];
|
66881
|
-
}
|
66882
|
-
__name(readVarint2, "readVarint");
|
66883
|
-
function isCidVersion2(input) {
|
66884
|
-
return input === 0 || input === 1;
|
66885
|
-
}
|
66886
|
-
__name(isCidVersion2, "isCidVersion");
|
66887
|
-
function readCid2(bytes) {
|
66888
|
-
const [cidVersion, cidVersionRemainder] = readVarint2(bytes);
|
66889
|
-
if (!isCidVersion2(cidVersion)) {
|
66890
|
-
throw new Error(`Unknown CID version ${cidVersion}`);
|
66891
|
-
}
|
66892
|
-
const [codec, codecRemainder] = readVarint2(cidVersionRemainder);
|
66893
|
-
const [, mhCodecRemainder, mhCodecLength] = readVarint2(codecRemainder);
|
66894
|
-
const [mhLength, , mhLengthLength] = readVarint2(mhCodecRemainder);
|
66895
|
-
const multihashBytes = codecRemainder.subarray(0, mhCodecLength + mhLengthLength + mhLength);
|
66896
|
-
const multihashBytesRemainder = codecRemainder.subarray(mhCodecLength + mhLengthLength + mhLength);
|
66897
|
-
return [CID.create(cidVersion, codec, decode5(multihashBytes)), multihashBytesRemainder];
|
66898
|
-
}
|
66899
|
-
__name(readCid2, "readCid");
|
66900
|
-
|
66901
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/stream-ref-parsing.js
|
66902
|
-
init_cid();
|
66903
|
-
init_base36();
|
66904
|
-
function fromBytes4(input, title = "StreamRef") {
|
66905
|
-
const [streamCodec, streamCodecRemainder] = readVarint2(input);
|
66906
|
-
if (streamCodec !== STREAMID_CODEC2)
|
66907
|
-
throw new Error(`Invalid ${title}, does not include streamid codec`);
|
66908
|
-
const [type, streamtypeRemainder] = readVarint2(streamCodecRemainder);
|
66909
|
-
const cidResult = readCid2(streamtypeRemainder);
|
66910
|
-
const [genesis, genesisRemainder] = cidResult;
|
66911
|
-
if (genesisRemainder.length === 0) {
|
66912
|
-
return {
|
66913
|
-
kind: "stream-id",
|
66914
|
-
type,
|
66915
|
-
genesis
|
66916
|
-
};
|
66917
|
-
} else if (genesisRemainder.length === 1 && genesisRemainder[0] === 0) {
|
66918
|
-
return {
|
66919
|
-
kind: "commit-id",
|
66920
|
-
type,
|
66921
|
-
genesis,
|
66922
|
-
commit: null
|
66923
|
-
};
|
66924
|
-
} else {
|
66925
|
-
const [commit] = readCid2(genesisRemainder);
|
66926
|
-
return {
|
66927
|
-
kind: "commit-id",
|
66928
|
-
type,
|
66929
|
-
genesis,
|
66930
|
-
commit
|
66931
|
-
};
|
66932
|
-
}
|
66933
|
-
}
|
66934
|
-
__name(fromBytes4, "fromBytes");
|
66935
|
-
var URL_PATTERN2 = /(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;
|
66936
|
-
function fromString7(input, title = "StreamRef") {
|
66937
|
-
const protocolMatch = URL_PATTERN2.exec(input) || [];
|
66938
|
-
const base4 = protocolMatch[2];
|
66939
|
-
if (!base4)
|
66940
|
-
throw new Error(`Malformed ${title} string: ${input}`);
|
66941
|
-
const bytes = base36.decode(base4);
|
66942
|
-
const streamRef = fromBytes4(bytes);
|
66943
|
-
const commit = protocolMatch[4];
|
66944
|
-
if (commit) {
|
66945
|
-
return {
|
66946
|
-
kind: "commit-id",
|
66947
|
-
type: streamRef.type,
|
66948
|
-
genesis: streamRef.genesis,
|
66949
|
-
commit: parseCommit2(streamRef.genesis, commit)
|
66950
|
-
};
|
66951
|
-
}
|
66952
|
-
return streamRef;
|
66953
|
-
}
|
66954
|
-
__name(fromString7, "fromString");
|
66955
|
-
function parseCID2(input) {
|
66956
|
-
try {
|
66957
|
-
return typeof input === "string" ? CID.parse(input) : CID.asCID(input);
|
66958
|
-
} catch {
|
66959
|
-
return null;
|
66960
|
-
}
|
66961
|
-
}
|
66962
|
-
__name(parseCID2, "parseCID");
|
66963
|
-
function parseCommit2(genesis, commit = null) {
|
66964
|
-
if (!commit)
|
66965
|
-
return null;
|
66966
|
-
if (commit === "0")
|
66967
|
-
return null;
|
66968
|
-
const commitCID = parseCID2(commit);
|
66969
|
-
if (commitCID) {
|
66970
|
-
if (genesis.equals(commitCID)) {
|
66971
|
-
return null;
|
66972
|
-
} else {
|
66973
|
-
return commitCID;
|
66974
|
-
}
|
66975
|
-
} else {
|
66976
|
-
throw new Error("Cannot specify commit as a number except to request commit 0 (the genesis commit)");
|
66977
|
-
}
|
66978
|
-
}
|
66979
|
-
__name(parseCommit2, "parseCommit");
|
66980
|
-
|
66981
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/stream-id.js
|
66982
|
-
var __decorate5 = function(decorators, target, key2, desc) {
|
66983
|
-
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
66984
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
66985
|
-
r = Reflect.decorate(decorators, target, key2, desc);
|
66986
|
-
else
|
66987
|
-
for (var i2 = decorators.length - 1; i2 >= 0; i2--)
|
66988
|
-
if (d3 = decorators[i2])
|
66989
|
-
r = (c2 < 3 ? d3(r) : c2 > 3 ? d3(target, key2, r) : d3(target, key2)) || r;
|
66990
|
-
return c2 > 3 && r && Object.defineProperty(target, key2, r), r;
|
66991
|
-
};
|
66992
|
-
var __metadata4 = function(k2, v) {
|
66993
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
66994
|
-
return Reflect.metadata(k2, v);
|
66995
|
-
};
|
66996
|
-
var InvalidStreamIDBytesError2 = class extends Error {
|
66997
|
-
constructor(bytes) {
|
66998
|
-
super(`Invalid StreamID bytes ${base36.encode(bytes)}: contains commit`);
|
66999
|
-
}
|
67000
|
-
};
|
67001
|
-
__name(InvalidStreamIDBytesError2, "InvalidStreamIDBytesError");
|
67002
|
-
var InvalidStreamIDStringError2 = class extends Error {
|
67003
|
-
constructor(input) {
|
67004
|
-
super(`Invalid StreamID string ${input}: contains commit`);
|
67005
|
-
}
|
67006
|
-
};
|
67007
|
-
__name(InvalidStreamIDStringError2, "InvalidStreamIDStringError");
|
67008
|
-
function fromBytes5(bytes) {
|
67009
|
-
const parsed = fromBytes4(bytes, "StreamID");
|
67010
|
-
if (parsed.kind === "stream-id") {
|
67011
|
-
return new StreamID2(parsed.type, parsed.genesis);
|
67012
|
-
}
|
67013
|
-
throw new InvalidStreamIDBytesError2(bytes);
|
67014
|
-
}
|
67015
|
-
__name(fromBytes5, "fromBytes");
|
67016
|
-
function fromBytesNoThrow3(bytes) {
|
67017
|
-
return tryCatch2(() => fromBytes5(bytes));
|
67018
|
-
}
|
67019
|
-
__name(fromBytesNoThrow3, "fromBytesNoThrow");
|
67020
|
-
function fromString8(input) {
|
67021
|
-
const parsed = fromString7(input, "StreamID");
|
67022
|
-
if (parsed.kind === "stream-id") {
|
67023
|
-
return new StreamID2(parsed.type, parsed.genesis);
|
67024
|
-
}
|
67025
|
-
throw new InvalidStreamIDStringError2(input);
|
67026
|
-
}
|
67027
|
-
__name(fromString8, "fromString");
|
67028
|
-
function fromStringNoThrow3(input) {
|
67029
|
-
return tryCatch2(() => fromString8(input));
|
67030
|
-
}
|
67031
|
-
__name(fromStringNoThrow3, "fromStringNoThrow");
|
67032
|
-
var TAG3 = Symbol.for("@ceramicnetwork/streamid/StreamID");
|
67033
|
-
var StreamID2 = class {
|
67034
|
-
constructor(type, cid) {
|
67035
|
-
this._tag = TAG3;
|
67036
|
-
if (!(type || type === 0))
|
67037
|
-
throw new Error("StreamID constructor: type required");
|
67038
|
-
if (!cid)
|
67039
|
-
throw new Error("StreamID constructor: cid required");
|
67040
|
-
this._type = typeof type === "string" ? StreamType2.codeByName(type) : type;
|
67041
|
-
this._cid = typeof cid === "string" ? CID.parse(cid) : cid;
|
67042
|
-
}
|
67043
|
-
static isInstance(instance) {
|
67044
|
-
return typeof instance === "object" && "_tag" in instance && instance._tag === TAG3;
|
67045
|
-
}
|
67046
|
-
static async fromGenesis(type, genesis) {
|
67047
|
-
const block = await encode5({ value: genesis, codec: esm_exports, hasher: sha256 });
|
67048
|
-
return new StreamID2(type, block.cid);
|
67049
|
-
}
|
67050
|
-
get type() {
|
67051
|
-
return this._type;
|
67052
|
-
}
|
67053
|
-
get typeName() {
|
67054
|
-
return StreamType2.nameByCode(this._type);
|
67055
|
-
}
|
67056
|
-
get cid() {
|
67057
|
-
return this._cid;
|
67058
|
-
}
|
67059
|
-
get bytes() {
|
67060
|
-
const codec = import_varint7.default.encode(STREAMID_CODEC2);
|
67061
|
-
const type = import_varint7.default.encode(this.type);
|
67062
|
-
return concat([codec, type, this.cid.bytes]);
|
67063
|
-
}
|
67064
|
-
get baseID() {
|
67065
|
-
return new StreamID2(this._type, this._cid);
|
67066
|
-
}
|
67067
|
-
equals(other) {
|
67068
|
-
if (StreamID2.isInstance(other)) {
|
67069
|
-
return this.type === other.type && this.cid.equals(other.cid);
|
67070
|
-
} else {
|
67071
|
-
return false;
|
67072
|
-
}
|
67073
|
-
}
|
67074
|
-
toString() {
|
67075
|
-
return base36.encode(this.bytes);
|
67076
|
-
}
|
67077
|
-
toUrl() {
|
67078
|
-
return `ceramic://${this.toString()}`;
|
67079
|
-
}
|
67080
|
-
[Symbol.for("nodejs.util.inspect.custom")]() {
|
67081
|
-
return `StreamID(${this.toString()})`;
|
67082
|
-
}
|
67083
|
-
[Symbol.toPrimitive]() {
|
67084
|
-
return this.toString();
|
67085
|
-
}
|
67086
|
-
};
|
67087
|
-
__name(StreamID2, "StreamID");
|
67088
|
-
StreamID2.fromBytes = fromBytes5;
|
67089
|
-
StreamID2.fromBytesNoThrow = fromBytesNoThrow3;
|
67090
|
-
StreamID2.fromString = fromString8;
|
67091
|
-
StreamID2.fromStringNoThrow = fromStringNoThrow3;
|
67092
|
-
__decorate5([
|
67093
|
-
Memoize2(),
|
67094
|
-
__metadata4("design:type", String),
|
67095
|
-
__metadata4("design:paramtypes", [])
|
67096
|
-
], StreamID2.prototype, "typeName", null);
|
67097
|
-
__decorate5([
|
67098
|
-
Memoize2(),
|
67099
|
-
__metadata4("design:type", Uint8Array),
|
67100
|
-
__metadata4("design:paramtypes", [])
|
67101
|
-
], StreamID2.prototype, "bytes", null);
|
67102
|
-
__decorate5([
|
67103
|
-
Memoize2(),
|
67104
|
-
__metadata4("design:type", StreamID2),
|
67105
|
-
__metadata4("design:paramtypes", [])
|
67106
|
-
], StreamID2.prototype, "baseID", null);
|
67107
|
-
__decorate5([
|
67108
|
-
Memoize2(),
|
67109
|
-
__metadata4("design:type", Function),
|
67110
|
-
__metadata4("design:paramtypes", []),
|
67111
|
-
__metadata4("design:returntype", String)
|
67112
|
-
], StreamID2.prototype, "toString", null);
|
67113
|
-
__decorate5([
|
67114
|
-
Memoize2(),
|
67115
|
-
__metadata4("design:type", Function),
|
67116
|
-
__metadata4("design:paramtypes", []),
|
67117
|
-
__metadata4("design:returntype", String)
|
67118
|
-
], StreamID2.prototype, "toUrl", null);
|
67119
|
-
|
67120
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/commit-id.js
|
67121
|
-
var __decorate6 = function(decorators, target, key2, desc) {
|
67122
|
-
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
67123
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
67124
|
-
r = Reflect.decorate(decorators, target, key2, desc);
|
67125
|
-
else
|
67126
|
-
for (var i2 = decorators.length - 1; i2 >= 0; i2--)
|
67127
|
-
if (d3 = decorators[i2])
|
67128
|
-
r = (c2 < 3 ? d3(r) : c2 > 3 ? d3(target, key2, r) : d3(target, key2)) || r;
|
67129
|
-
return c2 > 3 && r && Object.defineProperty(target, key2, r), r;
|
67130
|
-
};
|
67131
|
-
var __metadata5 = function(k2, v) {
|
67132
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
67133
|
-
return Reflect.metadata(k2, v);
|
67134
|
-
};
|
67135
|
-
var __classPrivateFieldSet3 = function(receiver, state, value, kind, f) {
|
67136
|
-
if (kind === "m")
|
67137
|
-
throw new TypeError("Private method is not writable");
|
67138
|
-
if (kind === "a" && !f)
|
67139
|
-
throw new TypeError("Private accessor was defined without a setter");
|
67140
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
67141
|
-
throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
67142
|
-
return kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value), value;
|
67143
|
-
};
|
67144
|
-
var __classPrivateFieldGet3 = function(receiver, state, kind, f) {
|
67145
|
-
if (kind === "a" && !f)
|
67146
|
-
throw new TypeError("Private accessor was defined without a getter");
|
67147
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver))
|
67148
|
-
throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
67149
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
67150
|
-
};
|
67151
|
-
var _CommitID_type2;
|
67152
|
-
var _CommitID_cid2;
|
67153
|
-
var _CommitID_commit2;
|
67154
|
-
var InvalidCommitIDBytesError2 = class extends Error {
|
67155
|
-
constructor(bytes) {
|
67156
|
-
super(`Error while parsing CommitID from bytes ${base36.encode(bytes)}: no commit information provided`);
|
67157
|
-
}
|
67158
|
-
};
|
67159
|
-
__name(InvalidCommitIDBytesError2, "InvalidCommitIDBytesError");
|
67160
|
-
var InvalidCommitIDStringError2 = class extends Error {
|
67161
|
-
constructor(input) {
|
67162
|
-
super(`Error while parsing CommitID from string ${input}: no commit information provided`);
|
67163
|
-
}
|
67164
|
-
};
|
67165
|
-
__name(InvalidCommitIDStringError2, "InvalidCommitIDStringError");
|
67166
|
-
function fromBytes6(bytes) {
|
67167
|
-
const parsed = fromBytes4(bytes, "CommitID");
|
67168
|
-
if (parsed.kind === "commit-id") {
|
67169
|
-
return new CommitID2(parsed.type, parsed.genesis, parsed.commit);
|
67170
|
-
}
|
67171
|
-
throw new InvalidCommitIDBytesError2(bytes);
|
67172
|
-
}
|
67173
|
-
__name(fromBytes6, "fromBytes");
|
67174
|
-
function fromBytesNoThrow4(bytes) {
|
67175
|
-
return tryCatch2(() => fromBytes6(bytes));
|
67176
|
-
}
|
67177
|
-
__name(fromBytesNoThrow4, "fromBytesNoThrow");
|
67178
|
-
function fromString9(input) {
|
67179
|
-
const parsed = fromString7(input, "CommitID");
|
67180
|
-
if (parsed.kind === "commit-id") {
|
67181
|
-
return new CommitID2(parsed.type, parsed.genesis, parsed.commit);
|
67182
|
-
}
|
67183
|
-
throw new InvalidCommitIDStringError2(input);
|
67184
|
-
}
|
67185
|
-
__name(fromString9, "fromString");
|
67186
|
-
function fromStringNoThrow4(input) {
|
67187
|
-
return tryCatch2(() => fromString9(input));
|
67188
|
-
}
|
67189
|
-
__name(fromStringNoThrow4, "fromStringNoThrow");
|
67190
|
-
var TAG4 = Symbol.for("@ceramicnetwork/streamid/CommitID");
|
67191
|
-
function make2(stream, commit) {
|
67192
|
-
return new CommitID2(stream.type, stream.cid, commit);
|
67193
|
-
}
|
67194
|
-
__name(make2, "make");
|
67195
|
-
var CommitID2 = class {
|
67196
|
-
constructor(type, cid, commit = null) {
|
67197
|
-
this._tag = TAG4;
|
67198
|
-
_CommitID_type2.set(this, void 0);
|
67199
|
-
_CommitID_cid2.set(this, void 0);
|
67200
|
-
_CommitID_commit2.set(this, void 0);
|
67201
|
-
if (!type && type !== 0)
|
67202
|
-
throw new Error("constructor: type required");
|
67203
|
-
if (!cid)
|
67204
|
-
throw new Error("constructor: cid required");
|
67205
|
-
__classPrivateFieldSet3(this, _CommitID_type2, typeof type === "string" ? StreamType2.codeByName(type) : type, "f");
|
67206
|
-
__classPrivateFieldSet3(this, _CommitID_cid2, typeof cid === "string" ? CID.parse(cid) : cid, "f");
|
67207
|
-
__classPrivateFieldSet3(this, _CommitID_commit2, parseCommit2(__classPrivateFieldGet3(this, _CommitID_cid2, "f"), commit), "f");
|
67208
|
-
}
|
67209
|
-
static isInstance(instance) {
|
67210
|
-
return typeof instance === "object" && "_tag" in instance && instance._tag === TAG4;
|
67211
|
-
}
|
67212
|
-
get baseID() {
|
67213
|
-
return new StreamID2(__classPrivateFieldGet3(this, _CommitID_type2, "f"), __classPrivateFieldGet3(this, _CommitID_cid2, "f"));
|
67214
|
-
}
|
67215
|
-
get type() {
|
67216
|
-
return __classPrivateFieldGet3(this, _CommitID_type2, "f");
|
67217
|
-
}
|
67218
|
-
get typeName() {
|
67219
|
-
return StreamType2.nameByCode(__classPrivateFieldGet3(this, _CommitID_type2, "f"));
|
67220
|
-
}
|
67221
|
-
get cid() {
|
67222
|
-
return __classPrivateFieldGet3(this, _CommitID_cid2, "f");
|
67223
|
-
}
|
67224
|
-
get commit() {
|
67225
|
-
return __classPrivateFieldGet3(this, _CommitID_commit2, "f") || __classPrivateFieldGet3(this, _CommitID_cid2, "f");
|
67226
|
-
}
|
67227
|
-
get bytes() {
|
67228
|
-
const codec = import_varint8.default.encode(STREAMID_CODEC2);
|
67229
|
-
const type = import_varint8.default.encode(this.type);
|
67230
|
-
const commitBytes = __classPrivateFieldGet3(this, _CommitID_commit2, "f")?.bytes || new Uint8Array([0]);
|
67231
|
-
return concat([codec, type, this.cid.bytes, commitBytes]);
|
67232
|
-
}
|
67233
|
-
equals(other) {
|
67234
|
-
return this.type === other.type && this.cid.equals(other.cid) && this.commit.equals(other.commit);
|
67235
|
-
}
|
67236
|
-
toString() {
|
67237
|
-
return base36.encode(this.bytes);
|
67238
|
-
}
|
67239
|
-
toUrl() {
|
67240
|
-
return `ceramic://${this.toString()}`;
|
67241
|
-
}
|
67242
|
-
[(_CommitID_type2 = /* @__PURE__ */ new WeakMap(), _CommitID_cid2 = /* @__PURE__ */ new WeakMap(), _CommitID_commit2 = /* @__PURE__ */ new WeakMap(), Symbol.for("nodejs.util.inspect.custom"))]() {
|
67243
|
-
return `CommitID(${this.toString()})`;
|
67244
|
-
}
|
67245
|
-
[Symbol.toPrimitive]() {
|
67246
|
-
return this.toString();
|
67247
|
-
}
|
67248
|
-
};
|
67249
|
-
__name(CommitID2, "CommitID");
|
67250
|
-
CommitID2.fromBytes = fromBytes6;
|
67251
|
-
CommitID2.fromBytesNoThrow = fromBytesNoThrow4;
|
67252
|
-
CommitID2.fromString = fromString9;
|
67253
|
-
CommitID2.fromStringNoThrow = fromStringNoThrow4;
|
67254
|
-
CommitID2.make = make2;
|
67255
|
-
__decorate6([
|
67256
|
-
Memoize2(),
|
67257
|
-
__metadata5("design:type", StreamID2),
|
67258
|
-
__metadata5("design:paramtypes", [])
|
67259
|
-
], CommitID2.prototype, "baseID", null);
|
67260
|
-
__decorate6([
|
67261
|
-
Memoize2(),
|
67262
|
-
__metadata5("design:type", String),
|
67263
|
-
__metadata5("design:paramtypes", [])
|
67264
|
-
], CommitID2.prototype, "typeName", null);
|
67265
|
-
__decorate6([
|
67266
|
-
Memoize2(),
|
67267
|
-
__metadata5("design:type", CID),
|
67268
|
-
__metadata5("design:paramtypes", [])
|
67269
|
-
], CommitID2.prototype, "commit", null);
|
67270
|
-
__decorate6([
|
67271
|
-
Memoize2(),
|
67272
|
-
__metadata5("design:type", Uint8Array),
|
67273
|
-
__metadata5("design:paramtypes", [])
|
67274
|
-
], CommitID2.prototype, "bytes", null);
|
67275
|
-
__decorate6([
|
67276
|
-
Memoize2(),
|
67277
|
-
__metadata5("design:type", Function),
|
67278
|
-
__metadata5("design:paramtypes", []),
|
67279
|
-
__metadata5("design:returntype", String)
|
67280
|
-
], CommitID2.prototype, "toString", null);
|
67281
|
-
__decorate6([
|
67282
|
-
Memoize2(),
|
67283
|
-
__metadata5("design:type", Function),
|
67284
|
-
__metadata5("design:paramtypes", []),
|
67285
|
-
__metadata5("design:returntype", String)
|
67286
|
-
], CommitID2.prototype, "toUrl", null);
|
67287
|
-
|
67288
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.12.0/node_modules/@ceramicnetwork/streamid/lib/stream-ref.js
|
67289
|
-
init_base36();
|
67290
|
-
var StreamRef2;
|
67291
|
-
(function(StreamRef3) {
|
67292
|
-
function fromBytes7(input) {
|
67293
|
-
const parsed = fromBytes4(input);
|
67294
|
-
switch (parsed.kind) {
|
67295
|
-
case "commit-id":
|
67296
|
-
return new CommitID2(parsed.type, parsed.genesis, parsed.commit);
|
67297
|
-
case "stream-id":
|
67298
|
-
return new StreamID2(parsed.type, parsed.genesis);
|
67299
|
-
default:
|
67300
|
-
throw new Error(`Malformed StreamRef bytes: ${base36.encode(input)}`);
|
67301
|
-
}
|
67302
|
-
}
|
67303
|
-
__name(fromBytes7, "fromBytes");
|
67304
|
-
StreamRef3.fromBytes = fromBytes7;
|
67305
|
-
function fromString10(input) {
|
67306
|
-
const parsed = fromString7(input);
|
67307
|
-
switch (parsed.kind) {
|
67308
|
-
case "commit-id":
|
67309
|
-
return new CommitID2(parsed.type, parsed.genesis, parsed.commit);
|
67310
|
-
case "stream-id":
|
67311
|
-
return new StreamID2(parsed.type, parsed.genesis);
|
67312
|
-
default:
|
67313
|
-
throw new Error(`Malformed StreamRef string: ${input}`);
|
67314
|
-
}
|
67315
|
-
}
|
67316
|
-
__name(fromString10, "fromString");
|
67317
|
-
StreamRef3.fromString = fromString10;
|
67318
|
-
function from4(input) {
|
67319
|
-
if (StreamID2.isInstance(input)) {
|
67320
|
-
return input;
|
67321
|
-
}
|
67322
|
-
if (CommitID2.isInstance(input)) {
|
67323
|
-
return input;
|
67324
|
-
}
|
67325
|
-
if (input instanceof Uint8Array) {
|
67326
|
-
return fromBytes7(input);
|
67327
|
-
}
|
67328
|
-
if (typeof input === "string") {
|
67329
|
-
return fromString10(input);
|
67330
|
-
}
|
67331
|
-
throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(input)}`);
|
67332
|
-
}
|
67333
|
-
__name(from4, "from");
|
67334
|
-
StreamRef3.from = from4;
|
67335
|
-
})(StreamRef2 || (StreamRef2 = {}));
|
67336
|
-
|
67337
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.20.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
67338
66706
|
var SignatureStatus2;
|
67339
66707
|
(function(SignatureStatus3) {
|
67340
66708
|
SignatureStatus3[SignatureStatus3["GENESIS"] = 0] = "GENESIS";
|
@@ -67364,7 +66732,7 @@ var Stream2 = class extends Observable {
|
|
67364
66732
|
this._context = _context;
|
67365
66733
|
}
|
67366
66734
|
get id() {
|
67367
|
-
return new
|
66735
|
+
return new StreamID(this.state$.value.type, this.state$.value.log[0].cid);
|
67368
66736
|
}
|
67369
66737
|
get api() {
|
67370
66738
|
return this._context.api;
|
@@ -67377,13 +66745,13 @@ var Stream2 = class extends Observable {
|
|
67377
66745
|
return this.state$.value.log[this.state$.value.log.length - 1].cid;
|
67378
66746
|
}
|
67379
66747
|
get commitId() {
|
67380
|
-
return
|
66748
|
+
return CommitID.make(this.id, this.tip);
|
67381
66749
|
}
|
67382
66750
|
get allCommitIds() {
|
67383
|
-
return this.state$.value.log.map(({ cid }) =>
|
66751
|
+
return this.state$.value.log.map(({ cid }) => CommitID.make(this.id, cid));
|
67384
66752
|
}
|
67385
66753
|
get anchorCommitIds() {
|
67386
|
-
return this.state$.value.log.filter(({ type }) => type === CommitType2.ANCHOR).map(({ cid }) =>
|
66754
|
+
return this.state$.value.log.filter(({ type }) => type === CommitType2.ANCHOR).map(({ cid }) => CommitID.make(this.id, cid));
|
67387
66755
|
}
|
67388
66756
|
get state() {
|
67389
66757
|
return (0, import_lodash4.default)(this.state$.value);
|
@@ -67420,7 +66788,7 @@ __name(normalizeAccountId, "normalizeAccountId");
|
|
67420
66788
|
|
67421
66789
|
// ../../node_modules/.pnpm/@ceramicnetwork+stream-caip10-link@2.15.0/node_modules/@ceramicnetwork/stream-caip10-link/lib/caip10-link.js
|
67422
66790
|
var import_lodash5 = __toESM(require_lodash2(), 1);
|
67423
|
-
var
|
66791
|
+
var __decorate5 = function(decorators, target, key2, desc) {
|
67424
66792
|
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
67425
66793
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
67426
66794
|
r = Reflect.decorate(decorators, target, key2, desc);
|
@@ -67490,7 +66858,7 @@ var Caip10Link = Caip10Link_1 = /* @__PURE__ */ __name(class Caip10Link2 extends
|
|
67490
66858
|
}
|
67491
66859
|
static async load(ceramic, streamId, opts = {}) {
|
67492
66860
|
opts = { ...DEFAULT_LOAD_OPTS2, ...opts };
|
67493
|
-
const streamRef =
|
66861
|
+
const streamRef = StreamRef.from(streamId);
|
67494
66862
|
if (streamRef.type != Caip10Link_1.STREAM_TYPE_ID) {
|
67495
66863
|
throw new Error(`StreamID ${streamRef.toString()} does not refer to a '${Caip10Link_1.STREAM_TYPE_NAME}' stream, but to a ${streamRef.typeName}`);
|
67496
66864
|
}
|
@@ -67523,7 +66891,7 @@ var Caip10Link = Caip10Link_1 = /* @__PURE__ */ __name(class Caip10Link2 extends
|
|
67523
66891
|
}, "Caip10Link");
|
67524
66892
|
Caip10Link.STREAM_TYPE_NAME = "caip10-link";
|
67525
66893
|
Caip10Link.STREAM_TYPE_ID = 1;
|
67526
|
-
Caip10Link = Caip10Link_1 =
|
66894
|
+
Caip10Link = Caip10Link_1 = __decorate5([
|
67527
66895
|
StreamStatic2()
|
67528
66896
|
], Caip10Link);
|
67529
66897
|
|
@@ -67531,7 +66899,7 @@ Caip10Link = Caip10Link_1 = __decorate7([
|
|
67531
66899
|
init_cid();
|
67532
66900
|
init_digest();
|
67533
66901
|
var import_multihashes = __toESM(require_src3(), 1);
|
67534
|
-
var
|
66902
|
+
var __decorate6 = function(decorators, target, key2, desc) {
|
67535
66903
|
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
67536
66904
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
67537
66905
|
r = Reflect.decorate(decorators, target, key2, desc);
|
@@ -67658,13 +67026,13 @@ Model.MODEL = function() {
|
|
67658
67026
|
const cid = CID.createV1(code2, digest2);
|
67659
67027
|
return new StreamID("UNLOADABLE", cid);
|
67660
67028
|
}();
|
67661
|
-
Model = Model_1 =
|
67029
|
+
Model = Model_1 = __decorate6([
|
67662
67030
|
StreamStatic()
|
67663
67031
|
], Model);
|
67664
67032
|
|
67665
67033
|
// ../../node_modules/.pnpm/@ceramicnetwork+stream-model-instance@0.6.0/node_modules/@ceramicnetwork/stream-model-instance/lib/model-instance-document.js
|
67666
67034
|
var import_random4 = __toESM(require_random(), 1);
|
67667
|
-
var
|
67035
|
+
var __decorate7 = function(decorators, target, key2, desc) {
|
67668
67036
|
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
67669
67037
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
67670
67038
|
r = Reflect.decorate(decorators, target, key2, desc);
|
@@ -67816,7 +67184,7 @@ var ModelInstanceDocument = ModelInstanceDocument_1 = /* @__PURE__ */ __name(cla
|
|
67816
67184
|
}, "ModelInstanceDocument");
|
67817
67185
|
ModelInstanceDocument.STREAM_TYPE_NAME = "MID";
|
67818
67186
|
ModelInstanceDocument.STREAM_TYPE_ID = 3;
|
67819
|
-
ModelInstanceDocument = ModelInstanceDocument_1 =
|
67187
|
+
ModelInstanceDocument = ModelInstanceDocument_1 = __decorate7([
|
67820
67188
|
StreamStatic()
|
67821
67189
|
], ModelInstanceDocument);
|
67822
67190
|
|