@learncard/core 8.0.6 → 8.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -10
- package/dist/core.cjs.development.js +276 -209
- package/dist/core.cjs.development.js.map +4 -4
- package/dist/core.cjs.production.min.js +28 -28
- package/dist/core.cjs.production.min.js.map +4 -4
- package/dist/core.esm.js +276 -209
- package/dist/core.esm.js.map +4 -4
- package/package.json +1 -1
package/dist/core.esm.js
CHANGED
@@ -30011,15 +30011,15 @@ var require_from_string = __commonJS({
|
|
30011
30011
|
"../../node_modules/.pnpm/uint8arrays@2.1.10/node_modules/uint8arrays/from-string.js"(exports, module2) {
|
30012
30012
|
"use strict";
|
30013
30013
|
var bases2 = require_bases();
|
30014
|
-
function
|
30014
|
+
function fromString8(string2, encoding = "utf8") {
|
30015
30015
|
const base4 = bases2[encoding];
|
30016
30016
|
if (!base4) {
|
30017
30017
|
throw new Error(`Unsupported encoding "${encoding}"`);
|
30018
30018
|
}
|
30019
30019
|
return base4.decoder.decode(`${base4.prefix}${string2}`);
|
30020
30020
|
}
|
30021
|
-
__name(
|
30022
|
-
module2.exports =
|
30021
|
+
__name(fromString8, "fromString");
|
30022
|
+
module2.exports = fromString8;
|
30023
30023
|
}
|
30024
30024
|
});
|
30025
30025
|
|
@@ -30066,14 +30066,14 @@ var require_uint8arrays = __commonJS({
|
|
30066
30066
|
var compare4 = require_compare();
|
30067
30067
|
var concat4 = require_concat();
|
30068
30068
|
var equals4 = require_equals();
|
30069
|
-
var
|
30069
|
+
var fromString8 = require_from_string();
|
30070
30070
|
var toString10 = require_to_string2();
|
30071
30071
|
var xor2 = require_xor();
|
30072
30072
|
module2.exports = {
|
30073
30073
|
compare: compare4,
|
30074
30074
|
concat: concat4,
|
30075
30075
|
equals: equals4,
|
30076
|
-
fromString:
|
30076
|
+
fromString: fromString8,
|
30077
30077
|
toString: toString10,
|
30078
30078
|
xor: xor2
|
30079
30079
|
};
|
@@ -32797,7 +32797,7 @@ var require_buffer2 = __commonJS({
|
|
32797
32797
|
Buffer3.poolSize = 8192;
|
32798
32798
|
function from4(value, encodingOrOffset, length2) {
|
32799
32799
|
if (typeof value === "string") {
|
32800
|
-
return
|
32800
|
+
return fromString8(value, encodingOrOffset);
|
32801
32801
|
}
|
32802
32802
|
if (ArrayBuffer.isView(value)) {
|
32803
32803
|
return fromArrayView(value);
|
@@ -32875,7 +32875,7 @@ var require_buffer2 = __commonJS({
|
|
32875
32875
|
Buffer3.allocUnsafeSlow = function(size) {
|
32876
32876
|
return allocUnsafe2(size);
|
32877
32877
|
};
|
32878
|
-
function
|
32878
|
+
function fromString8(string2, encoding) {
|
32879
32879
|
if (typeof encoding !== "string" || encoding === "") {
|
32880
32880
|
encoding = "utf8";
|
32881
32881
|
}
|
@@ -32890,7 +32890,7 @@ var require_buffer2 = __commonJS({
|
|
32890
32890
|
}
|
32891
32891
|
return buf2;
|
32892
32892
|
}
|
32893
|
-
__name(
|
32893
|
+
__name(fromString8, "fromString");
|
32894
32894
|
function fromArrayLike2(array) {
|
32895
32895
|
var length2 = array.length < 0 ? 0 : checked(array.length) | 0;
|
32896
32896
|
var buf2 = createBuffer(length2);
|
@@ -41554,7 +41554,7 @@ var getVCTemplatesPlugin = /* @__PURE__ */ __name(() => {
|
|
41554
41554
|
};
|
41555
41555
|
}, "getVCTemplatesPlugin");
|
41556
41556
|
|
41557
|
-
// ../../node_modules/.pnpm/web-request-rpc@2.0.
|
41557
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.1/node_modules/web-request-rpc/utils.js
|
41558
41558
|
var RPC_ERRORS = {
|
41559
41559
|
ParseError: {
|
41560
41560
|
message: "Parse error",
|
@@ -41712,7 +41712,7 @@ function isHandlePromise(handle) {
|
|
41712
41712
|
}
|
41713
41713
|
__name(isHandlePromise, "isHandlePromise");
|
41714
41714
|
|
41715
|
-
// ../../node_modules/.pnpm/web-request-rpc@2.0.
|
41715
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.1/node_modules/web-request-rpc/Client.js
|
41716
41716
|
var RPC_CLIENT_CALL_TIMEOUT = 3e4;
|
41717
41717
|
var Client = class {
|
41718
41718
|
constructor() {
|
@@ -41844,7 +41844,7 @@ var Injector = class {
|
|
41844
41844
|
};
|
41845
41845
|
__name(Injector, "Injector");
|
41846
41846
|
|
41847
|
-
// ../../node_modules/.pnpm/web-request-rpc@2.0.
|
41847
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.1/node_modules/web-request-rpc/EventEmitter.js
|
41848
41848
|
var EventEmitter = class {
|
41849
41849
|
constructor({ deserialize = /* @__PURE__ */ __name((e2) => e2, "deserialize"), waitUntil = /* @__PURE__ */ __name(async () => {
|
41850
41850
|
}, "waitUntil") } = {}) {
|
@@ -41877,7 +41877,7 @@ var EventEmitter = class {
|
|
41877
41877
|
};
|
41878
41878
|
__name(EventEmitter, "EventEmitter");
|
41879
41879
|
|
41880
|
-
// ../../node_modules/.pnpm/web-request-rpc@2.0.
|
41880
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.1/node_modules/web-request-rpc/Server.js
|
41881
41881
|
var Server = class {
|
41882
41882
|
constructor() {
|
41883
41883
|
this.origin = null;
|
@@ -41966,7 +41966,7 @@ function sendMethodNotFound(handle, origin, message) {
|
|
41966
41966
|
}
|
41967
41967
|
__name(sendMethodNotFound, "sendMethodNotFound");
|
41968
41968
|
|
41969
|
-
// ../../node_modules/.pnpm/web-request-rpc@2.0.
|
41969
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.1/node_modules/web-request-rpc/WebApp.js
|
41970
41970
|
var WebApp = class {
|
41971
41971
|
constructor(relyingOrigin) {
|
41972
41972
|
this.relyingOrigin = parseUrl(relyingOrigin).origin;
|
@@ -42019,7 +42019,7 @@ var WebApp = class {
|
|
42019
42019
|
};
|
42020
42020
|
__name(WebApp, "WebApp");
|
42021
42021
|
|
42022
|
-
// ../../node_modules/.pnpm/web-request-rpc@2.0.
|
42022
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.1/node_modules/web-request-rpc/WebAppWindowDialog.js
|
42023
42023
|
var WebAppWindowDialog = class {
|
42024
42024
|
constructor() {
|
42025
42025
|
this._closeEventListeners = /* @__PURE__ */ new Set();
|
@@ -42055,7 +42055,7 @@ var WebAppWindowDialog = class {
|
|
42055
42055
|
};
|
42056
42056
|
__name(WebAppWindowDialog, "WebAppWindowDialog");
|
42057
42057
|
|
42058
|
-
// ../../node_modules/.pnpm/web-request-rpc@2.0.
|
42058
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.1/node_modules/web-request-rpc/WebAppWindowInlineDialog.js
|
42059
42059
|
var WebAppWindowInlineDialog = class extends WebAppWindowDialog {
|
42060
42060
|
constructor({ url, handle, className }) {
|
42061
42061
|
super();
|
@@ -42078,6 +42078,7 @@ var WebAppWindowInlineDialog = class extends WebAppWindowDialog {
|
|
42078
42078
|
color: "black",
|
42079
42079
|
"box-sizing": "border-box",
|
42080
42080
|
overflow: "hidden",
|
42081
|
+
"user-select": "none",
|
42081
42082
|
"z-index": 1e6
|
42082
42083
|
});
|
42083
42084
|
this.dialog.className = "web-app-window";
|
@@ -42115,7 +42116,8 @@ var WebAppWindowInlineDialog = class extends WebAppWindowDialog {
|
|
42115
42116
|
overflow: "hidden",
|
42116
42117
|
margin: 0,
|
42117
42118
|
padding: 0,
|
42118
|
-
"flex-grow": 1
|
42119
|
+
"flex-grow": 1,
|
42120
|
+
"user-select": "none"
|
42119
42121
|
});
|
42120
42122
|
this.dialog.appendChild(style);
|
42121
42123
|
this.container.appendChild(this.iframe);
|
@@ -42157,7 +42159,7 @@ function applyStyle(element, style) {
|
|
42157
42159
|
}
|
42158
42160
|
__name(applyStyle, "applyStyle");
|
42159
42161
|
|
42160
|
-
// ../../node_modules/.pnpm/web-request-rpc@2.0.
|
42162
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.1/node_modules/web-request-rpc/WebAppWindowPopupDialog.js
|
42161
42163
|
var WebAppWindowPopupDialog = class extends WebAppWindowDialog {
|
42162
42164
|
constructor({ url, handle, bounds = { width: 500, height: 400 } }) {
|
42163
42165
|
super();
|
@@ -42236,7 +42238,7 @@ var WebAppWindowPopupDialog = class extends WebAppWindowDialog {
|
|
42236
42238
|
};
|
42237
42239
|
__name(WebAppWindowPopupDialog, "WebAppWindowPopupDialog");
|
42238
42240
|
|
42239
|
-
// ../../node_modules/.pnpm/web-request-rpc@2.0.
|
42241
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.1/node_modules/web-request-rpc/WebAppWindow.js
|
42240
42242
|
var LOAD_WINDOW_TIMEOUT = 6e4;
|
42241
42243
|
var WebAppWindow = class {
|
42242
42244
|
constructor(url, {
|
@@ -42367,7 +42369,7 @@ var WebAppWindow = class {
|
|
42367
42369
|
};
|
42368
42370
|
__name(WebAppWindow, "WebAppWindow");
|
42369
42371
|
|
42370
|
-
// ../../node_modules/.pnpm/web-request-rpc@2.0.
|
42372
|
+
// ../../node_modules/.pnpm/web-request-rpc@2.0.1/node_modules/web-request-rpc/WebAppContext.js
|
42371
42373
|
var WEB_APP_CONTEXT_LOAD_TIMEOUT = 1e4;
|
42372
42374
|
var WebAppContext = class {
|
42373
42375
|
constructor() {
|
@@ -42428,7 +42430,7 @@ var WebAppContext = class {
|
|
42428
42430
|
};
|
42429
42431
|
__name(WebAppContext, "WebAppContext");
|
42430
42432
|
|
42431
|
-
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.
|
42433
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.1/node_modules/credential-handler-polyfill/CredentialRequestEvent.js
|
42432
42434
|
var CredentialRequestEvent = class {
|
42433
42435
|
constructor({
|
42434
42436
|
credentialHandler,
|
@@ -42458,7 +42460,7 @@ var CredentialRequestEvent = class {
|
|
42458
42460
|
};
|
42459
42461
|
__name(CredentialRequestEvent, "CredentialRequestEvent");
|
42460
42462
|
|
42461
|
-
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.
|
42463
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.1/node_modules/credential-handler-polyfill/CredentialStoreEvent.js
|
42462
42464
|
var CredentialStoreEvent = class {
|
42463
42465
|
constructor({
|
42464
42466
|
credentialHandler,
|
@@ -42486,7 +42488,7 @@ var CredentialStoreEvent = class {
|
|
42486
42488
|
};
|
42487
42489
|
__name(CredentialStoreEvent, "CredentialStoreEvent");
|
42488
42490
|
|
42489
|
-
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.
|
42491
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.1/node_modules/credential-handler-polyfill/CredentialHandlerService.js
|
42490
42492
|
var CredentialHandlerService = class {
|
42491
42493
|
constructor(credentialHandler) {
|
42492
42494
|
this._credentialHandler = credentialHandler;
|
@@ -42510,7 +42512,7 @@ var CredentialHandlerService = class {
|
|
42510
42512
|
};
|
42511
42513
|
__name(CredentialHandlerService, "CredentialHandlerService");
|
42512
42514
|
|
42513
|
-
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.
|
42515
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.1/node_modules/credential-handler-polyfill/CredentialHandler.js
|
42514
42516
|
var EVENT_TYPES = ["credentialrequest", "credentialstore"];
|
42515
42517
|
var CredentialHandler = class extends WebApp {
|
42516
42518
|
constructor(mediatorOrigin, inline = false) {
|
@@ -42556,7 +42558,7 @@ var CredentialHandler = class extends WebApp {
|
|
42556
42558
|
};
|
42557
42559
|
__name(CredentialHandler, "CredentialHandler");
|
42558
42560
|
|
42559
|
-
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.
|
42561
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.1/node_modules/credential-handler-polyfill/CredentialHints.js
|
42560
42562
|
var CredentialHints = class {
|
42561
42563
|
constructor(url, injector) {
|
42562
42564
|
const remote = injector.get("credentialHints", {
|
@@ -42607,7 +42609,7 @@ function imageToDataUrl(url) {
|
|
42607
42609
|
}
|
42608
42610
|
__name(imageToDataUrl, "imageToDataUrl");
|
42609
42611
|
|
42610
|
-
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.
|
42612
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.1/node_modules/credential-handler-polyfill/CredentialManager.js
|
42611
42613
|
var CredentialManager = class {
|
42612
42614
|
constructor(url, injector) {
|
42613
42615
|
if (!(url && typeof url === "string")) {
|
@@ -42624,7 +42626,7 @@ var CredentialManager = class {
|
|
42624
42626
|
};
|
42625
42627
|
__name(CredentialManager, "CredentialManager");
|
42626
42628
|
|
42627
|
-
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.
|
42629
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.1/node_modules/credential-handler-polyfill/CredentialHandlerRegistration.js
|
42628
42630
|
var CredentialHandlerRegistration = class {
|
42629
42631
|
constructor(url, injector) {
|
42630
42632
|
if (!(url && typeof url === "string")) {
|
@@ -42635,7 +42637,7 @@ var CredentialHandlerRegistration = class {
|
|
42635
42637
|
};
|
42636
42638
|
__name(CredentialHandlerRegistration, "CredentialHandlerRegistration");
|
42637
42639
|
|
42638
|
-
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.
|
42640
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.1/node_modules/credential-handler-polyfill/CredentialHandlers.js
|
42639
42641
|
var CredentialHandlers = class {
|
42640
42642
|
constructor(injector) {
|
42641
42643
|
this._init = (async () => {
|
@@ -42683,7 +42685,7 @@ var CredentialHandlers = class {
|
|
42683
42685
|
};
|
42684
42686
|
__name(CredentialHandlers, "CredentialHandlers");
|
42685
42687
|
|
42686
|
-
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.
|
42688
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.1/node_modules/credential-handler-polyfill/WebCredential.js
|
42687
42689
|
var WebCredential2 = class {
|
42688
42690
|
constructor(dataType, data, { recommendedHandlerOrigins = [] } = {}) {
|
42689
42691
|
if (typeof dataType !== "string") {
|
@@ -42697,7 +42699,7 @@ var WebCredential2 = class {
|
|
42697
42699
|
};
|
42698
42700
|
__name(WebCredential2, "WebCredential");
|
42699
42701
|
|
42700
|
-
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.
|
42702
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.1/node_modules/credential-handler-polyfill/CredentialsContainer.js
|
42701
42703
|
var CREDENTIAL_GET_TIMEOUT = 0;
|
42702
42704
|
var CREDENTIAL_STORE_TIMEOUT = 0;
|
42703
42705
|
var CredentialsContainer = class {
|
@@ -42746,7 +42748,7 @@ var CredentialsContainer = class {
|
|
42746
42748
|
};
|
42747
42749
|
__name(CredentialsContainer, "CredentialsContainer");
|
42748
42750
|
|
42749
|
-
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.
|
42751
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.1/node_modules/credential-handler-polyfill/PermissionManager.js
|
42750
42752
|
var PERMISSION_REQUEST_TIMEOUT = 0;
|
42751
42753
|
var PermissionManager = class {
|
42752
42754
|
constructor(injector) {
|
@@ -42775,7 +42777,7 @@ var PermissionManager = class {
|
|
42775
42777
|
};
|
42776
42778
|
__name(PermissionManager, "PermissionManager");
|
42777
42779
|
|
42778
|
-
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.
|
42780
|
+
// ../../node_modules/.pnpm/credential-handler-polyfill@3.0.1/node_modules/credential-handler-polyfill/index.js
|
42779
42781
|
var DEFAULT_MEDIATOR_ORIGIN = "https://authn.io";
|
42780
42782
|
var loaded;
|
42781
42783
|
async function loadOnce(options) {
|
@@ -42835,7 +42837,7 @@ async function load2(options = {
|
|
42835
42837
|
}
|
42836
42838
|
__name(load2, "load");
|
42837
42839
|
|
42838
|
-
// ../../node_modules/.pnpm/web-credential-handler@2.0.
|
42840
|
+
// ../../node_modules/.pnpm/web-credential-handler@2.0.1/node_modules/web-credential-handler/CredentialEventProxy.js
|
42839
42841
|
var PROXY_EVENT_TIMEOUT = 6e4;
|
42840
42842
|
var CredentialEventProxy = class extends WebApp {
|
42841
42843
|
constructor() {
|
@@ -42869,7 +42871,7 @@ var CredentialEventProxy = class extends WebApp {
|
|
42869
42871
|
};
|
42870
42872
|
__name(CredentialEventProxy, "CredentialEventProxy");
|
42871
42873
|
|
42872
|
-
// ../../node_modules/.pnpm/web-credential-handler@2.0.
|
42874
|
+
// ../../node_modules/.pnpm/web-credential-handler@2.0.1/node_modules/web-credential-handler/index.js
|
42873
42875
|
var DEFAULT_MEDIATOR = "https://authn.io";
|
42874
42876
|
async function installHandler() {
|
42875
42877
|
const CredentialManager2 = navigator.credentialsPolyfill.CredentialManager;
|
@@ -56859,11 +56861,11 @@ var fast_json_patch_default = Object.assign({}, core_exports, duplex_exports, {
|
|
56859
56861
|
unescapePathComponent
|
56860
56862
|
});
|
56861
56863
|
|
56862
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-tile@2.
|
56864
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-tile@2.9.0/node_modules/@ceramicnetwork/stream-tile/lib/tile-document.js
|
56863
56865
|
var import_lodash3 = __toESM(require_lodash(), 1);
|
56864
56866
|
var import_random3 = __toESM(require_random(), 1);
|
56865
56867
|
|
56866
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.
|
56868
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.13.0/node_modules/@ceramicnetwork/common/lib/streamopts.js
|
56867
56869
|
var SyncOptions;
|
56868
56870
|
(function(SyncOptions2) {
|
56869
56871
|
SyncOptions2[SyncOptions2["PREFER_CACHE"] = 0] = "PREFER_CACHE";
|
@@ -56871,14 +56873,14 @@ var SyncOptions;
|
|
56871
56873
|
SyncOptions2[SyncOptions2["NEVER_SYNC"] = 2] = "NEVER_SYNC";
|
56872
56874
|
})(SyncOptions || (SyncOptions = {}));
|
56873
56875
|
|
56874
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.
|
56876
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.13.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
56875
56877
|
var import_lodash = __toESM(require_lodash(), 1);
|
56876
56878
|
|
56877
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.
|
56879
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/commit-id.js
|
56878
56880
|
init_cid();
|
56879
56881
|
init_base36();
|
56880
56882
|
|
56881
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.
|
56883
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/stream-type.js
|
56882
56884
|
var registry = {
|
56883
56885
|
tile: 0,
|
56884
56886
|
"caip10-link": 1,
|
@@ -56910,7 +56912,7 @@ __name(StreamType, "StreamType");
|
|
56910
56912
|
StreamType.nameByCode = nameByCode;
|
56911
56913
|
StreamType.codeByName = codeByName;
|
56912
56914
|
|
56913
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.
|
56915
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/commit-id.js
|
56914
56916
|
var import_varint5 = __toESM(require_varint(), 1);
|
56915
56917
|
|
56916
56918
|
// ../../node_modules/.pnpm/typescript-memoize@1.1.1/node_modules/typescript-memoize/dist/es2015/memoize-decorator.js
|
@@ -57001,17 +57003,33 @@ function getNewFunction(originalMethod, hashFunction, duration = 0, tags) {
|
|
57001
57003
|
}
|
57002
57004
|
__name(getNewFunction, "getNewFunction");
|
57003
57005
|
|
57004
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.
|
57006
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/constants.js
|
57005
57007
|
var STREAMID_CODEC = 206;
|
57006
57008
|
|
57007
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.
|
57009
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/stream-id.js
|
57010
|
+
init_cid();
|
57011
|
+
init_base36();
|
57012
|
+
init_sha2_browser();
|
57013
|
+
var import_varint4 = __toESM(require_varint(), 1);
|
57014
|
+
|
57015
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/try-catch.util.js
|
57016
|
+
function tryCatch(fn) {
|
57017
|
+
try {
|
57018
|
+
return fn();
|
57019
|
+
} catch (e2) {
|
57020
|
+
return e2;
|
57021
|
+
}
|
57022
|
+
}
|
57023
|
+
__name(tryCatch, "tryCatch");
|
57024
|
+
|
57025
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/reading-bytes.js
|
57008
57026
|
init_cid();
|
57009
57027
|
var import_varint3 = __toESM(require_varint(), 1);
|
57010
57028
|
init_digest();
|
57011
57029
|
function readVarint(bytes) {
|
57012
57030
|
const value = import_varint3.default.decode(bytes);
|
57013
57031
|
const readLength = import_varint3.default.decode.bytes;
|
57014
|
-
const remainder = bytes.
|
57032
|
+
const remainder = bytes.subarray(readLength);
|
57015
57033
|
return [value, remainder, readLength];
|
57016
57034
|
}
|
57017
57035
|
__name(readVarint, "readVarint");
|
@@ -57020,32 +57038,100 @@ function isCidVersion(input) {
|
|
57020
57038
|
}
|
57021
57039
|
__name(isCidVersion, "isCidVersion");
|
57022
57040
|
function readCid(bytes) {
|
57023
|
-
const result = readCidNoThrow(bytes);
|
57024
|
-
if (result instanceof Error) {
|
57025
|
-
throw result;
|
57026
|
-
}
|
57027
|
-
return result;
|
57028
|
-
}
|
57029
|
-
__name(readCid, "readCid");
|
57030
|
-
function readCidNoThrow(bytes) {
|
57031
57041
|
const [cidVersion, cidVersionRemainder] = readVarint(bytes);
|
57032
57042
|
if (!isCidVersion(cidVersion)) {
|
57033
|
-
|
57043
|
+
throw new Error(`Unknown CID version ${cidVersion}`);
|
57034
57044
|
}
|
57035
57045
|
const [codec, codecRemainder] = readVarint(cidVersionRemainder);
|
57036
57046
|
const [, mhCodecRemainder, mhCodecLength] = readVarint(codecRemainder);
|
57037
57047
|
const [mhLength, , mhLengthLength] = readVarint(mhCodecRemainder);
|
57038
|
-
const multihashBytes = codecRemainder.
|
57039
|
-
const multihashBytesRemainder = codecRemainder.
|
57048
|
+
const multihashBytes = codecRemainder.subarray(0, mhCodecLength + mhLengthLength + mhLength);
|
57049
|
+
const multihashBytesRemainder = codecRemainder.subarray(mhCodecLength + mhLengthLength + mhLength);
|
57040
57050
|
return [CID.create(cidVersion, codec, decode5(multihashBytes)), multihashBytesRemainder];
|
57041
57051
|
}
|
57042
|
-
__name(
|
57052
|
+
__name(readCid, "readCid");
|
57043
57053
|
|
57044
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.
|
57054
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/stream-ref-parsing.js
|
57045
57055
|
init_cid();
|
57046
57056
|
init_base36();
|
57047
|
-
|
57048
|
-
|
57057
|
+
function fromBytes(input, title = "StreamRef") {
|
57058
|
+
const [streamCodec, streamCodecRemainder] = readVarint(input);
|
57059
|
+
if (streamCodec !== STREAMID_CODEC)
|
57060
|
+
throw new Error(`Invalid ${title}, does not include streamid codec`);
|
57061
|
+
const [type, streamtypeRemainder] = readVarint(streamCodecRemainder);
|
57062
|
+
const cidResult = readCid(streamtypeRemainder);
|
57063
|
+
const [genesis, genesisRemainder] = cidResult;
|
57064
|
+
if (genesisRemainder.length === 0) {
|
57065
|
+
return {
|
57066
|
+
kind: "stream-id",
|
57067
|
+
type,
|
57068
|
+
genesis
|
57069
|
+
};
|
57070
|
+
} else if (genesisRemainder.length === 1 && genesisRemainder[0] === 0) {
|
57071
|
+
return {
|
57072
|
+
kind: "commit-id",
|
57073
|
+
type,
|
57074
|
+
genesis,
|
57075
|
+
commit: null
|
57076
|
+
};
|
57077
|
+
} else {
|
57078
|
+
const [commit] = readCid(genesisRemainder);
|
57079
|
+
return {
|
57080
|
+
kind: "commit-id",
|
57081
|
+
type,
|
57082
|
+
genesis,
|
57083
|
+
commit
|
57084
|
+
};
|
57085
|
+
}
|
57086
|
+
}
|
57087
|
+
__name(fromBytes, "fromBytes");
|
57088
|
+
var URL_PATTERN = /(ceramic:\/\/|\/ceramic\/)?([a-zA-Z0-9]+)(\?commit=([a-zA-Z0-9]+))?/;
|
57089
|
+
function fromString5(input, title = "StreamRef") {
|
57090
|
+
const protocolMatch = URL_PATTERN.exec(input) || [];
|
57091
|
+
const base4 = protocolMatch[2];
|
57092
|
+
if (!base4)
|
57093
|
+
throw new Error(`Malformed ${title} string: ${input}`);
|
57094
|
+
const bytes = base36.decode(base4);
|
57095
|
+
const streamRef = fromBytes(bytes);
|
57096
|
+
const commit = protocolMatch[4];
|
57097
|
+
if (commit) {
|
57098
|
+
return {
|
57099
|
+
kind: "commit-id",
|
57100
|
+
type: streamRef.type,
|
57101
|
+
genesis: streamRef.genesis,
|
57102
|
+
commit: parseCommit(streamRef.genesis, commit)
|
57103
|
+
};
|
57104
|
+
}
|
57105
|
+
return streamRef;
|
57106
|
+
}
|
57107
|
+
__name(fromString5, "fromString");
|
57108
|
+
function parseCID(input) {
|
57109
|
+
try {
|
57110
|
+
return typeof input === "string" ? CID.parse(input) : CID.asCID(input);
|
57111
|
+
} catch {
|
57112
|
+
return null;
|
57113
|
+
}
|
57114
|
+
}
|
57115
|
+
__name(parseCID, "parseCID");
|
57116
|
+
function parseCommit(genesis, commit = null) {
|
57117
|
+
if (!commit)
|
57118
|
+
return null;
|
57119
|
+
if (commit === "0")
|
57120
|
+
return null;
|
57121
|
+
const commitCID = parseCID(commit);
|
57122
|
+
if (commitCID) {
|
57123
|
+
if (genesis.equals(commitCID)) {
|
57124
|
+
return null;
|
57125
|
+
} else {
|
57126
|
+
return commitCID;
|
57127
|
+
}
|
57128
|
+
} else {
|
57129
|
+
throw new Error("Cannot specify commit as a number except to request commit 0 (the genesis commit)");
|
57130
|
+
}
|
57131
|
+
}
|
57132
|
+
__name(parseCommit, "parseCommit");
|
57133
|
+
|
57134
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/stream-id.js
|
57049
57135
|
var __decorate = function(decorators, target, key2, desc) {
|
57050
57136
|
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
57051
57137
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
@@ -57060,43 +57146,40 @@ var __metadata = function(k2, v) {
|
|
57060
57146
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
57061
57147
|
return Reflect.metadata(k2, v);
|
57062
57148
|
};
|
57063
|
-
|
57064
|
-
|
57065
|
-
|
57066
|
-
throw result;
|
57149
|
+
var InvalidStreamIDBytesError = class extends Error {
|
57150
|
+
constructor(bytes) {
|
57151
|
+
super(`Invalid StreamID bytes ${base36.encode(bytes)}: contains commit`);
|
57067
57152
|
}
|
57068
|
-
|
57069
|
-
|
57070
|
-
|
57071
|
-
|
57072
|
-
|
57073
|
-
if (streamCodec !== STREAMID_CODEC)
|
57074
|
-
return new Error("fromBytes: invalid streamid, does not include streamid codec");
|
57075
|
-
const [type, streamTypeRemainder] = readVarint(streamCodecRemainder);
|
57076
|
-
const cidResult = readCidNoThrow(streamTypeRemainder);
|
57077
|
-
if (cidResult instanceof Error) {
|
57078
|
-
return cidResult;
|
57153
|
+
};
|
57154
|
+
__name(InvalidStreamIDBytesError, "InvalidStreamIDBytesError");
|
57155
|
+
var InvalidStreamIDStringError = class extends Error {
|
57156
|
+
constructor(input) {
|
57157
|
+
super(`Invalid StreamID string ${input}: contains commit`);
|
57079
57158
|
}
|
57080
|
-
|
57081
|
-
|
57082
|
-
|
57159
|
+
};
|
57160
|
+
__name(InvalidStreamIDStringError, "InvalidStreamIDStringError");
|
57161
|
+
function fromBytes2(bytes) {
|
57162
|
+
const parsed = fromBytes(bytes, "StreamID");
|
57163
|
+
if (parsed.kind === "stream-id") {
|
57164
|
+
return new StreamID(parsed.type, parsed.genesis);
|
57083
57165
|
}
|
57084
|
-
|
57166
|
+
throw new InvalidStreamIDBytesError(bytes);
|
57167
|
+
}
|
57168
|
+
__name(fromBytes2, "fromBytes");
|
57169
|
+
function fromBytesNoThrow(bytes) {
|
57170
|
+
return tryCatch(() => fromBytes2(bytes));
|
57085
57171
|
}
|
57086
57172
|
__name(fromBytesNoThrow, "fromBytesNoThrow");
|
57087
|
-
function
|
57088
|
-
const
|
57089
|
-
if (
|
57090
|
-
|
57173
|
+
function fromString6(input) {
|
57174
|
+
const parsed = fromString5(input, "StreamID");
|
57175
|
+
if (parsed.kind === "stream-id") {
|
57176
|
+
return new StreamID(parsed.type, parsed.genesis);
|
57091
57177
|
}
|
57092
|
-
|
57178
|
+
throw new InvalidStreamIDStringError(input);
|
57093
57179
|
}
|
57094
|
-
__name(
|
57180
|
+
__name(fromString6, "fromString");
|
57095
57181
|
function fromStringNoThrow(input) {
|
57096
|
-
|
57097
|
-
const commitFree = protocolFree.includes("commit") ? protocolFree.split("?")[0] : protocolFree;
|
57098
|
-
const bytes = base36.decode(commitFree);
|
57099
|
-
return fromBytesNoThrow(bytes);
|
57182
|
+
return tryCatch(() => fromString6(input));
|
57100
57183
|
}
|
57101
57184
|
__name(fromStringNoThrow, "fromStringNoThrow");
|
57102
57185
|
var TAG = Symbol.for("@ceramicnetwork/streamid/StreamID");
|
@@ -57104,9 +57187,9 @@ var StreamID = class {
|
|
57104
57187
|
constructor(type, cid) {
|
57105
57188
|
this._tag = TAG;
|
57106
57189
|
if (!(type || type === 0))
|
57107
|
-
throw new Error("constructor: type required");
|
57190
|
+
throw new Error("StreamID constructor: type required");
|
57108
57191
|
if (!cid)
|
57109
|
-
throw new Error("constructor: cid required");
|
57192
|
+
throw new Error("StreamID constructor: cid required");
|
57110
57193
|
this._type = typeof type === "string" ? StreamType.codeByName(type) : type;
|
57111
57194
|
this._cid = typeof cid === "string" ? CID.parse(cid) : cid;
|
57112
57195
|
}
|
@@ -57155,9 +57238,9 @@ var StreamID = class {
|
|
57155
57238
|
}
|
57156
57239
|
};
|
57157
57240
|
__name(StreamID, "StreamID");
|
57158
|
-
StreamID.fromBytes =
|
57241
|
+
StreamID.fromBytes = fromBytes2;
|
57159
57242
|
StreamID.fromBytesNoThrow = fromBytesNoThrow;
|
57160
|
-
StreamID.fromString =
|
57243
|
+
StreamID.fromString = fromString6;
|
57161
57244
|
StreamID.fromStringNoThrow = fromStringNoThrow;
|
57162
57245
|
__decorate([
|
57163
57246
|
Memoize(),
|
@@ -57187,7 +57270,7 @@ __decorate([
|
|
57187
57270
|
__metadata("design:returntype", String)
|
57188
57271
|
], StreamID.prototype, "toUrl", null);
|
57189
57272
|
|
57190
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.
|
57273
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/commit-id.js
|
57191
57274
|
var __decorate2 = function(decorators, target, key2, desc) {
|
57192
57275
|
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
57193
57276
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
@@ -57221,76 +57304,40 @@ var __classPrivateFieldGet = function(receiver, state, kind, f) {
|
|
57221
57304
|
var _CommitID_type;
|
57222
57305
|
var _CommitID_cid;
|
57223
57306
|
var _CommitID_commit;
|
57224
|
-
|
57225
|
-
|
57226
|
-
|
57227
|
-
throw result;
|
57307
|
+
var InvalidCommitIDBytesError = class extends Error {
|
57308
|
+
constructor(bytes) {
|
57309
|
+
super(`Error while parsing CommitID from bytes ${base36.encode(bytes)}: no commit information provided`);
|
57228
57310
|
}
|
57229
|
-
|
57311
|
+
};
|
57312
|
+
__name(InvalidCommitIDBytesError, "InvalidCommitIDBytesError");
|
57313
|
+
var InvalidCommitIDStringError = class extends Error {
|
57314
|
+
constructor(input) {
|
57315
|
+
super(`Error while parsing CommitID from string ${input}: no commit information provided`);
|
57316
|
+
}
|
57317
|
+
};
|
57318
|
+
__name(InvalidCommitIDStringError, "InvalidCommitIDStringError");
|
57319
|
+
function fromBytes3(bytes) {
|
57320
|
+
const parsed = fromBytes(bytes, "CommitID");
|
57321
|
+
if (parsed.kind === "commit-id") {
|
57322
|
+
return new CommitID(parsed.type, parsed.genesis, parsed.commit);
|
57323
|
+
}
|
57324
|
+
throw new InvalidCommitIDBytesError(bytes);
|
57230
57325
|
}
|
57231
|
-
__name(
|
57326
|
+
__name(fromBytes3, "fromBytes");
|
57232
57327
|
function fromBytesNoThrow2(bytes) {
|
57233
|
-
|
57234
|
-
if (streamCodec !== STREAMID_CODEC)
|
57235
|
-
return new Error("fromBytes: invalid streamid, does not include streamid codec");
|
57236
|
-
const [type, streamtypeRemainder] = readVarint(streamCodecRemainder);
|
57237
|
-
const cidResult = readCid(streamtypeRemainder);
|
57238
|
-
if (cidResult instanceof Error) {
|
57239
|
-
return cidResult;
|
57240
|
-
}
|
57241
|
-
const [base4, baseRemainder] = cidResult;
|
57242
|
-
if (baseRemainder.length === 0) {
|
57243
|
-
return new Error(`No commit information provided`);
|
57244
|
-
} else if (baseRemainder.length === 1) {
|
57245
|
-
return new CommitID(type, base4, baseRemainder[0]);
|
57246
|
-
} else {
|
57247
|
-
const [commit] = readCid(baseRemainder);
|
57248
|
-
return new CommitID(type, base4, commit);
|
57249
|
-
}
|
57328
|
+
return tryCatch(() => fromBytes3(bytes));
|
57250
57329
|
}
|
57251
57330
|
__name(fromBytesNoThrow2, "fromBytesNoThrow");
|
57252
|
-
function
|
57253
|
-
|
57254
|
-
|
57255
|
-
|
57256
|
-
return void 0;
|
57257
|
-
}
|
57258
|
-
}
|
57259
|
-
__name(parseCID, "parseCID");
|
57260
|
-
function parseCommit(genesis, commit = null) {
|
57261
|
-
if (!commit)
|
57262
|
-
return null;
|
57263
|
-
const commitCID = parseCID(commit);
|
57264
|
-
if (commitCID) {
|
57265
|
-
if (genesis.equals(commitCID)) {
|
57266
|
-
return null;
|
57267
|
-
} else {
|
57268
|
-
return commitCID;
|
57269
|
-
}
|
57270
|
-
} else if (String(commit) === "0") {
|
57271
|
-
return null;
|
57272
|
-
} else {
|
57273
|
-
throw new Error("Cannot specify commit as a number except to request commit 0 (the genesis commit)");
|
57331
|
+
function fromString7(input) {
|
57332
|
+
const parsed = fromString5(input, "CommitID");
|
57333
|
+
if (parsed.kind === "commit-id") {
|
57334
|
+
return new CommitID(parsed.type, parsed.genesis, parsed.commit);
|
57274
57335
|
}
|
57336
|
+
throw new InvalidCommitIDStringError(input);
|
57275
57337
|
}
|
57276
|
-
__name(
|
57277
|
-
function fromString6(input) {
|
57278
|
-
const result = fromStringNoThrow2(input);
|
57279
|
-
if (result instanceof Error) {
|
57280
|
-
throw result;
|
57281
|
-
}
|
57282
|
-
return result;
|
57283
|
-
}
|
57284
|
-
__name(fromString6, "fromString");
|
57338
|
+
__name(fromString7, "fromString");
|
57285
57339
|
function fromStringNoThrow2(input) {
|
57286
|
-
|
57287
|
-
if (protocolFree.includes("commit")) {
|
57288
|
-
const commit = protocolFree.split("?")[1].split("=")[1];
|
57289
|
-
const base4 = protocolFree.split("?")[0];
|
57290
|
-
return make(StreamID.fromString(base4), commit);
|
57291
|
-
} else {
|
57292
|
-
return fromBytesNoThrow2(base36.decode(protocolFree));
|
57293
|
-
}
|
57340
|
+
return tryCatch(() => fromString7(input));
|
57294
57341
|
}
|
57295
57342
|
__name(fromStringNoThrow2, "fromStringNoThrow");
|
57296
57343
|
var TAG2 = Symbol.for("@ceramicnetwork/streamid/CommitID");
|
@@ -57353,9 +57400,9 @@ var CommitID = class {
|
|
57353
57400
|
}
|
57354
57401
|
};
|
57355
57402
|
__name(CommitID, "CommitID");
|
57356
|
-
CommitID.fromBytes =
|
57403
|
+
CommitID.fromBytes = fromBytes3;
|
57357
57404
|
CommitID.fromBytesNoThrow = fromBytesNoThrow2;
|
57358
|
-
CommitID.fromString =
|
57405
|
+
CommitID.fromString = fromString7;
|
57359
57406
|
CommitID.fromStringNoThrow = fromStringNoThrow2;
|
57360
57407
|
CommitID.make = make;
|
57361
57408
|
__decorate2([
|
@@ -57391,29 +57438,50 @@ __decorate2([
|
|
57391
57438
|
__metadata2("design:returntype", String)
|
57392
57439
|
], CommitID.prototype, "toUrl", null);
|
57393
57440
|
|
57394
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.
|
57441
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+streamid@2.7.0/node_modules/@ceramicnetwork/streamid/lib/stream-ref.js
|
57442
|
+
init_base36();
|
57395
57443
|
var StreamRef;
|
57396
57444
|
(function(StreamRef2) {
|
57445
|
+
function fromBytes4(input) {
|
57446
|
+
const parsed = fromBytes(input);
|
57447
|
+
switch (parsed.kind) {
|
57448
|
+
case "commit-id":
|
57449
|
+
return new CommitID(parsed.type, parsed.genesis, parsed.commit);
|
57450
|
+
case "stream-id":
|
57451
|
+
return new StreamID(parsed.type, parsed.genesis);
|
57452
|
+
default:
|
57453
|
+
throw new Error(`Malformed StreamRef bytes: ${base36.encode(input)}`);
|
57454
|
+
}
|
57455
|
+
}
|
57456
|
+
__name(fromBytes4, "fromBytes");
|
57457
|
+
StreamRef2.fromBytes = fromBytes4;
|
57458
|
+
function fromString8(input) {
|
57459
|
+
const parsed = fromString5(input);
|
57460
|
+
switch (parsed.kind) {
|
57461
|
+
case "commit-id":
|
57462
|
+
return new CommitID(parsed.type, parsed.genesis, parsed.commit);
|
57463
|
+
case "stream-id":
|
57464
|
+
return new StreamID(parsed.type, parsed.genesis);
|
57465
|
+
default:
|
57466
|
+
throw new Error(`Malformed StreamRef string: ${input}`);
|
57467
|
+
}
|
57468
|
+
}
|
57469
|
+
__name(fromString8, "fromString");
|
57470
|
+
StreamRef2.fromString = fromString8;
|
57397
57471
|
function from4(input) {
|
57398
57472
|
if (StreamID.isInstance(input)) {
|
57399
57473
|
return input;
|
57400
|
-
}
|
57474
|
+
}
|
57475
|
+
if (CommitID.isInstance(input)) {
|
57401
57476
|
return input;
|
57402
|
-
} else if (input instanceof Uint8Array) {
|
57403
|
-
const commitId = CommitID.fromBytesNoThrow(input);
|
57404
|
-
if (commitId instanceof Error) {
|
57405
|
-
return StreamID.fromBytes(input);
|
57406
|
-
}
|
57407
|
-
return commitId;
|
57408
|
-
} else if (typeof input === "string") {
|
57409
|
-
const commitId = CommitID.fromStringNoThrow(input);
|
57410
|
-
if (commitId instanceof Error) {
|
57411
|
-
return StreamID.fromString(input);
|
57412
|
-
}
|
57413
|
-
return commitId;
|
57414
|
-
} else {
|
57415
|
-
throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(input)}`);
|
57416
57477
|
}
|
57478
|
+
if (input instanceof Uint8Array) {
|
57479
|
+
return fromBytes4(input);
|
57480
|
+
}
|
57481
|
+
if (typeof input === "string") {
|
57482
|
+
return fromString8(input);
|
57483
|
+
}
|
57484
|
+
throw new Error(`Can not build CommitID or StreamID from ${JSON.stringify(input)}`);
|
57417
57485
|
}
|
57418
57486
|
__name(from4, "from");
|
57419
57487
|
StreamRef2.from = from4;
|
@@ -59312,7 +59380,7 @@ function throttle(durationSelector, config2) {
|
|
59312
59380
|
}
|
59313
59381
|
__name(throttle, "throttle");
|
59314
59382
|
|
59315
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.
|
59383
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.13.0/node_modules/@ceramicnetwork/common/lib/stream.js
|
59316
59384
|
var SignatureStatus;
|
59317
59385
|
(function(SignatureStatus2) {
|
59318
59386
|
SignatureStatus2[SignatureStatus2["GENESIS"] = 0] = "GENESIS";
|
@@ -59383,10 +59451,10 @@ function StreamStatic() {
|
|
59383
59451
|
}
|
59384
59452
|
__name(StreamStatic, "StreamStatic");
|
59385
59453
|
|
59386
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.
|
59454
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.13.0/node_modules/@ceramicnetwork/common/lib/utils/http-utils.js
|
59387
59455
|
import fetch2 from "cross-fetch";
|
59388
59456
|
|
59389
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.
|
59457
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.13.0/node_modules/@ceramicnetwork/common/lib/utils/abort-signal-utils.js
|
59390
59458
|
function mergeAbortSignals(signals) {
|
59391
59459
|
const controller = new AbortController();
|
59392
59460
|
if (signals.length === 0) {
|
@@ -59433,7 +59501,7 @@ async function abortable2(original, fn) {
|
|
59433
59501
|
}
|
59434
59502
|
__name(abortable2, "abortable");
|
59435
59503
|
|
59436
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.
|
59504
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.13.0/node_modules/@ceramicnetwork/common/lib/utils/http-utils.js
|
59437
59505
|
var DEFAULT_FETCH_TIMEOUT = 60 * 1e3 * 3;
|
59438
59506
|
async function fetchJson(url, opts = {}) {
|
59439
59507
|
if (opts.body) {
|
@@ -59456,10 +59524,10 @@ async function fetchJson(url, opts = {}) {
|
|
59456
59524
|
}
|
59457
59525
|
__name(fetchJson, "fetchJson");
|
59458
59526
|
|
59459
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.
|
59527
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.13.0/node_modules/@ceramicnetwork/common/lib/utils/stream-utils.js
|
59460
59528
|
var import_lodash2 = __toESM(require_lodash(), 1);
|
59461
59529
|
|
59462
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.
|
59530
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.13.0/node_modules/@ceramicnetwork/common/lib/utils/cid-utils.js
|
59463
59531
|
init_cid();
|
59464
59532
|
function toCID(givenCid) {
|
59465
59533
|
const cid = CID.asCID(givenCid);
|
@@ -59476,7 +59544,7 @@ function toCID(givenCid) {
|
|
59476
59544
|
}
|
59477
59545
|
__name(toCID, "toCID");
|
59478
59546
|
|
59479
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.
|
59547
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.13.0/node_modules/@ceramicnetwork/common/lib/utils/stream-utils.js
|
59480
59548
|
var TILE_TYPE_ID = 0;
|
59481
59549
|
var StreamUtils = class {
|
59482
59550
|
static streamIdFromState(state) {
|
@@ -59640,7 +59708,7 @@ var StreamUtils = class {
|
|
59640
59708
|
};
|
59641
59709
|
__name(StreamUtils, "StreamUtils");
|
59642
59710
|
|
59643
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.
|
59711
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.13.0/node_modules/@ceramicnetwork/common/lib/utils/accountid-utils.js
|
59644
59712
|
function normalizeAccountId(accountId) {
|
59645
59713
|
if (typeof accountId === "string" && accountId.includes("@")) {
|
59646
59714
|
const [address, chainId] = accountId.split("@");
|
@@ -59653,7 +59721,7 @@ function normalizeAccountId(accountId) {
|
|
59653
59721
|
}
|
59654
59722
|
__name(normalizeAccountId, "normalizeAccountId");
|
59655
59723
|
|
59656
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.
|
59724
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+common@2.13.0/node_modules/@ceramicnetwork/common/lib/stream-state-subject.js
|
59657
59725
|
var StreamStateSubject = class extends BehaviorSubject {
|
59658
59726
|
next(next) {
|
59659
59727
|
const current = this.value;
|
@@ -59664,7 +59732,7 @@ var StreamStateSubject = class extends BehaviorSubject {
|
|
59664
59732
|
};
|
59665
59733
|
__name(StreamStateSubject, "StreamStateSubject");
|
59666
59734
|
|
59667
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-tile@2.
|
59735
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-tile@2.9.0/node_modules/@ceramicnetwork/stream-tile/lib/tile-document.js
|
59668
59736
|
var __decorate4 = function(decorators, target, key2, desc) {
|
59669
59737
|
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
59670
59738
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
@@ -59700,10 +59768,10 @@ function headerFromMetadata(metadata, genesis) {
|
|
59700
59768
|
};
|
59701
59769
|
if (genesis) {
|
59702
59770
|
if (!metadata?.deterministic) {
|
59703
|
-
header
|
59771
|
+
header["unique"] = toString3((0, import_random3.randomBytes)(12), "base64");
|
59704
59772
|
}
|
59705
59773
|
if (metadata?.forbidControllerChange) {
|
59706
|
-
header
|
59774
|
+
header["forbidControllerChange"] = true;
|
59707
59775
|
}
|
59708
59776
|
} else {
|
59709
59777
|
if (metadata?.deterministic !== void 0 || metadata?.unique !== void 0) {
|
@@ -59717,18 +59785,18 @@ function headerFromMetadata(metadata, genesis) {
|
|
59717
59785
|
return header;
|
59718
59786
|
}
|
59719
59787
|
__name(headerFromMetadata, "headerFromMetadata");
|
59720
|
-
async function
|
59721
|
-
if (signer.did
|
59722
|
-
throw new Error(
|
59723
|
-
}
|
59788
|
+
async function getAuthenticatedDID(signer) {
|
59789
|
+
if (!signer.did)
|
59790
|
+
throw new Error(`No DID provided`);
|
59724
59791
|
if (!signer.did.authenticated) {
|
59725
59792
|
await signer.did.authenticate();
|
59726
59793
|
if (signer.loggerProvider) {
|
59727
59794
|
signer.loggerProvider.getDiagnosticsLogger().imp(`Now authenticated as DID ${signer.did.id}`);
|
59728
59795
|
}
|
59729
59796
|
}
|
59797
|
+
return signer.did;
|
59730
59798
|
}
|
59731
|
-
__name(
|
59799
|
+
__name(getAuthenticatedDID, "getAuthenticatedDID");
|
59732
59800
|
async function throwReadOnlyError() {
|
59733
59801
|
throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.");
|
59734
59802
|
}
|
@@ -59812,10 +59880,11 @@ var TileDocument = TileDocument_1 = /* @__PURE__ */ __name(class TileDocument2 e
|
|
59812
59880
|
return this._isReadOnly;
|
59813
59881
|
}
|
59814
59882
|
async makeCommit(signer, newContent, newMetadata) {
|
59815
|
-
const commit = await this._makeRawCommit(
|
59883
|
+
const commit = await this._makeRawCommit(newContent, newMetadata);
|
59816
59884
|
return TileDocument_1._signDagJWS(signer, commit);
|
59817
59885
|
}
|
59818
|
-
async _makeRawCommit(
|
59886
|
+
async _makeRawCommit(newContent, newMetadata) {
|
59887
|
+
newMetadata || (newMetadata = {});
|
59819
59888
|
const header = headerFromMetadata(newMetadata, false);
|
59820
59889
|
if (newContent == null) {
|
59821
59890
|
newContent = this.content;
|
@@ -59829,22 +59898,20 @@ var TileDocument = TileDocument_1 = /* @__PURE__ */ __name(class TileDocument2 e
|
|
59829
59898
|
}
|
59830
59899
|
}
|
59831
59900
|
const patch = fast_json_patch_default.compare(this.content, newContent);
|
59832
|
-
const
|
59901
|
+
const genesisLogEntry = this.state.log[0];
|
59902
|
+
return {
|
59833
59903
|
header,
|
59834
59904
|
data: patch,
|
59835
59905
|
prev: this.tip,
|
59836
|
-
id:
|
59906
|
+
id: genesisLogEntry.cid
|
59837
59907
|
};
|
59838
|
-
return commit;
|
59839
59908
|
}
|
59840
59909
|
static async makeGenesis(signer, content, metadata) {
|
59841
|
-
|
59842
|
-
metadata = {};
|
59843
|
-
}
|
59910
|
+
metadata || (metadata = {});
|
59844
59911
|
if (!metadata.controllers || metadata.controllers.length === 0) {
|
59845
59912
|
if (signer.did) {
|
59846
|
-
await
|
59847
|
-
metadata.controllers = [
|
59913
|
+
const did = await getAuthenticatedDID(signer);
|
59914
|
+
metadata.controllers = [did.hasParent ? did.parent : did.id];
|
59848
59915
|
} else {
|
59849
59916
|
throw new Error("No controllers specified");
|
59850
59917
|
}
|
@@ -59865,8 +59932,8 @@ var TileDocument = TileDocument_1 = /* @__PURE__ */ __name(class TileDocument2 e
|
|
59865
59932
|
return TileDocument_1._signDagJWS(signer, commit);
|
59866
59933
|
}
|
59867
59934
|
static async _signDagJWS(signer, commit) {
|
59868
|
-
await
|
59869
|
-
return
|
59935
|
+
const did = await getAuthenticatedDID(signer);
|
59936
|
+
return did.createDagJWS(commit);
|
59870
59937
|
}
|
59871
59938
|
}, "TileDocument");
|
59872
59939
|
TileDocument.STREAM_TYPE_NAME = "tile";
|
@@ -60140,7 +60207,7 @@ var Document = class extends Observable {
|
|
60140
60207
|
};
|
60141
60208
|
__name(Document, "Document");
|
60142
60209
|
|
60143
|
-
// ../../node_modules/.pnpm/@ceramicnetwork+stream-caip10-link@2.
|
60210
|
+
// ../../node_modules/.pnpm/@ceramicnetwork+stream-caip10-link@2.8.0/node_modules/@ceramicnetwork/stream-caip10-link/lib/caip10-link.js
|
60144
60211
|
var import_lodash4 = __toESM(require_lodash(), 1);
|
60145
60212
|
var __decorate5 = function(decorators, target, key2, desc) {
|
60146
60213
|
var c2 = arguments.length, r = c2 < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key2) : desc, d3;
|
@@ -60265,7 +60332,7 @@ var __decorate6 = function(decorators, target, key2, desc) {
|
|
60265
60332
|
};
|
60266
60333
|
var Model_1;
|
60267
60334
|
var DEFAULT_LOAD_OPTS3 = { sync: SyncOptions.PREFER_CACHE };
|
60268
|
-
async function
|
60335
|
+
async function _ensureAuthenticated(signer) {
|
60269
60336
|
if (signer.did == null) {
|
60270
60337
|
throw new Error("No DID provided");
|
60271
60338
|
}
|
@@ -60276,7 +60343,7 @@ async function _ensureAuthenticated2(signer) {
|
|
60276
60343
|
}
|
60277
60344
|
}
|
60278
60345
|
}
|
60279
|
-
__name(
|
60346
|
+
__name(_ensureAuthenticated, "_ensureAuthenticated");
|
60280
60347
|
async function throwReadOnlyError3() {
|
60281
60348
|
throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.");
|
60282
60349
|
}
|
@@ -60347,7 +60414,7 @@ var Model = Model_1 = /* @__PURE__ */ __name(class Model2 extends Stream {
|
|
60347
60414
|
}
|
60348
60415
|
if (!metadata || !metadata.controller) {
|
60349
60416
|
if (signer.did) {
|
60350
|
-
await
|
60417
|
+
await _ensureAuthenticated(signer);
|
60351
60418
|
metadata = { controller: signer.did.hasParent ? signer.did.parent : signer.did.id };
|
60352
60419
|
} else {
|
60353
60420
|
throw new Error("No controller specified");
|
@@ -60367,7 +60434,7 @@ var Model = Model_1 = /* @__PURE__ */ __name(class Model2 extends Stream {
|
|
60367
60434
|
return this._isReadOnly;
|
60368
60435
|
}
|
60369
60436
|
static async _signDagJWS(signer, commit) {
|
60370
|
-
await
|
60437
|
+
await _ensureAuthenticated(signer);
|
60371
60438
|
return signer.did.createDagJWS(commit);
|
60372
60439
|
}
|
60373
60440
|
}, "Model");
|
@@ -60412,7 +60479,7 @@ var DEFAULT_DETERMINISTIC_OPTS = {
|
|
60412
60479
|
};
|
60413
60480
|
var DEFAULT_LOAD_OPTS4 = { sync: SyncOptions.PREFER_CACHE };
|
60414
60481
|
var DEFAULT_UPDATE_OPTS3 = { anchor: true, publish: true, throwOnInvalidCommit: true };
|
60415
|
-
async function
|
60482
|
+
async function _ensureAuthenticated2(signer) {
|
60416
60483
|
if (signer.did == null) {
|
60417
60484
|
throw new Error("No DID provided");
|
60418
60485
|
}
|
@@ -60423,7 +60490,7 @@ async function _ensureAuthenticated3(signer) {
|
|
60423
60490
|
}
|
60424
60491
|
}
|
60425
60492
|
}
|
60426
|
-
__name(
|
60493
|
+
__name(_ensureAuthenticated2, "_ensureAuthenticated");
|
60427
60494
|
async function throwReadOnlyError4() {
|
60428
60495
|
throw new Error("Historical stream commits cannot be modified. Load the stream without specifying a commit to make updates.");
|
60429
60496
|
}
|
@@ -60516,7 +60583,7 @@ var ModelInstanceDocument = ModelInstanceDocument_1 = /* @__PURE__ */ __name(cla
|
|
60516
60583
|
let controller = metadata.controller;
|
60517
60584
|
if (!controller) {
|
60518
60585
|
if (signer.did) {
|
60519
|
-
await
|
60586
|
+
await _ensureAuthenticated2(signer);
|
60520
60587
|
controller = signer.did.hasParent ? signer.did.parent : signer.did.id;
|
60521
60588
|
} else {
|
60522
60589
|
throw new Error("No controller specified");
|
@@ -60532,7 +60599,7 @@ var ModelInstanceDocument = ModelInstanceDocument_1 = /* @__PURE__ */ __name(cla
|
|
60532
60599
|
return { data: content, header };
|
60533
60600
|
}
|
60534
60601
|
static async _signDagJWS(signer, commit) {
|
60535
|
-
await
|
60602
|
+
await _ensureAuthenticated2(signer);
|
60536
60603
|
return signer.did.createDagJWS(commit);
|
60537
60604
|
}
|
60538
60605
|
}, "ModelInstanceDocument");
|