@mdbase-dev/sdk 0.1.0-beta.157 → 0.1.0-beta.159
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 +4 -6
- package/dist/app-host/web-sign-in-session.js +2 -2
- package/dist/app-host/web-sign-in-session.js.map +1 -1
- package/dist/application/asset-pins.json +4 -4
- package/dist/application/entry.js +10 -1
- package/dist/application/entry.js.map +1 -1
- package/dist/application/worker.js +13 -12
- package/dist/browser/mdbase-sdk.js +28 -19
- package/dist/browser/mdbase-sdk.min.js +45 -45
- package/dist/client.js +3 -0
- package/dist/client.js.map +1 -1
- package/dist/describe-error.d.ts +1 -1
- package/dist/describe-error.js +3 -3
- package/dist/describe-error.js.map +1 -1
- package/dist/files.d.ts +1 -1
- package/dist/files.js +5 -11
- package/dist/files.js.map +1 -1
- package/dist/native/provenance.json +5 -5
- package/dist/native/runtime.wasm +0 -0
- package/dist/thin-client.d.ts +2 -2
- package/dist/thin-client.js +2 -2
- package/package.json +2 -2
|
@@ -15308,12 +15308,12 @@ function appReleaseTrust() {
|
|
|
15308
15308
|
// src/application/asset-pins.json
|
|
15309
15309
|
var asset_pins_default = {
|
|
15310
15310
|
runtime: {
|
|
15311
|
-
sha256: "
|
|
15312
|
-
bytes:
|
|
15313
|
-
maxBytes:
|
|
15311
|
+
sha256: "c30e2e23c1fbc6642936996b8495133ce66e87caaf49a99050fc38f8a7422667",
|
|
15312
|
+
bytes: 3803805,
|
|
15313
|
+
maxBytes: 3803805,
|
|
15314
15314
|
source: {
|
|
15315
15315
|
repository: "mdbase-dev/mdbase-connect",
|
|
15316
|
-
commit: "
|
|
15316
|
+
commit: "81462447473808e040d3b31d15ede54e987ffa1e"
|
|
15317
15317
|
}
|
|
15318
15318
|
},
|
|
15319
15319
|
sqlite: {
|
|
@@ -21417,9 +21417,8 @@ var FilesApi = class {
|
|
|
21417
21417
|
if (o.onProgress) this.progress.set(transfer, o.onProgress);
|
|
21418
21418
|
const busyUntil = Date.now() + REGION_BUSY_WAIT_MS;
|
|
21419
21419
|
for (; ; ) {
|
|
21420
|
-
const phase = { committing: false };
|
|
21421
21420
|
try {
|
|
21422
|
-
return await this.uploadOnce(source, size2, open2, o
|
|
21421
|
+
return await this.uploadOnce(source, size2, open2, o);
|
|
21423
21422
|
} catch (e) {
|
|
21424
21423
|
if (isMdbaseError(e, "unavailable") && this.client.link === "reconnecting") continue;
|
|
21425
21424
|
if (regionBusy(e, busyUntil)) {
|
|
@@ -21427,13 +21426,13 @@ var FilesApi = class {
|
|
|
21427
21426
|
continue;
|
|
21428
21427
|
}
|
|
21429
21428
|
this.progress.delete(transfer);
|
|
21430
|
-
|
|
21429
|
+
await this.abortUpload(transfer).catch(() => {
|
|
21431
21430
|
});
|
|
21432
21431
|
throw withMutation(e, "upload", { mutationId: open2.mutationId });
|
|
21433
21432
|
}
|
|
21434
21433
|
}
|
|
21435
21434
|
}
|
|
21436
|
-
async uploadOnce(source, size2, open2, o
|
|
21435
|
+
async uploadOnce(source, size2, open2, o) {
|
|
21437
21436
|
const s = await this.session(o.signal);
|
|
21438
21437
|
const sig = o.signal ? { signal: o.signal } : {};
|
|
21439
21438
|
const opened = await s.request("open_upload", openUploadParams.enc(open2), { codec: openUploadResult, ...sig });
|
|
@@ -21466,7 +21465,6 @@ var FilesApi = class {
|
|
|
21466
21465
|
if (inflight.size >= 4) await Promise.race(inflight);
|
|
21467
21466
|
}
|
|
21468
21467
|
await Promise.all(inflight);
|
|
21469
|
-
phase.committing = true;
|
|
21470
21468
|
const r = await s.request("commit_upload", m([[0, uuid2.enc(open2.transfer)]]), {
|
|
21471
21469
|
codec: receipt,
|
|
21472
21470
|
...sig
|
|
@@ -21480,7 +21478,7 @@ var FilesApi = class {
|
|
|
21480
21478
|
}
|
|
21481
21479
|
return w;
|
|
21482
21480
|
}
|
|
21483
|
-
/**
|
|
21481
|
+
/** Release the upload lane. An already captured write remains durable; use its receipt to resolve the outcome. */
|
|
21484
21482
|
abortUpload(transferId) {
|
|
21485
21483
|
return this.client.call("abort_upload", m([[0, uuid2.enc(transferId)]])).then(() => {
|
|
21486
21484
|
});
|
|
@@ -24528,6 +24526,9 @@ var MdbaseClient = class _MdbaseClient {
|
|
|
24528
24526
|
continue;
|
|
24529
24527
|
}
|
|
24530
24528
|
signal?.throwIfAborted();
|
|
24529
|
+
if (page.hasMore && !page.cursor) {
|
|
24530
|
+
throw mdbaseError("invalid_request", "Query requires offset paging", "query_cursor_required");
|
|
24531
|
+
}
|
|
24531
24532
|
yield page;
|
|
24532
24533
|
pagesYielded++;
|
|
24533
24534
|
if (!page.cursor) return;
|
|
@@ -31644,10 +31645,10 @@ var AppWebSignInSession = class {
|
|
|
31644
31645
|
* sign-in gesture; a pending ledger keeps its SAME request for authorize(). */
|
|
31645
31646
|
start() {
|
|
31646
31647
|
return this.operation(async () => {
|
|
31647
|
-
if (this.flow) return this.getSnapshot();
|
|
31648
|
+
if (this.flow && this.base.status !== "blocked") return this.getSnapshot();
|
|
31648
31649
|
this.publish({ status: "starting", problem: null, signOutResult: null });
|
|
31649
31650
|
const p = this.options;
|
|
31650
|
-
this.flow
|
|
31651
|
+
this.flow ??= await AppProtectedInstallationSignIn.open({
|
|
31651
31652
|
...p,
|
|
31652
31653
|
mode: p.storeMode ?? "open",
|
|
31653
31654
|
signal: this.flowLifetime.signal,
|
|
@@ -3764,9 +3764,8 @@ var MdbaseSDK = (() => {
|
|
|
3764
3764
|
if (o.onProgress) this.progress.set(transfer, o.onProgress);
|
|
3765
3765
|
const busyUntil = Date.now() + REGION_BUSY_WAIT_MS;
|
|
3766
3766
|
for (; ; ) {
|
|
3767
|
-
const phase = { committing: false };
|
|
3768
3767
|
try {
|
|
3769
|
-
return await this.uploadOnce(source, size2, open2, o
|
|
3768
|
+
return await this.uploadOnce(source, size2, open2, o);
|
|
3770
3769
|
} catch (e) {
|
|
3771
3770
|
if (isMdbaseError(e, "unavailable") && this.client.link === "reconnecting") continue;
|
|
3772
3771
|
if (regionBusy(e, busyUntil)) {
|
|
@@ -3774,13 +3773,13 @@ var MdbaseSDK = (() => {
|
|
|
3774
3773
|
continue;
|
|
3775
3774
|
}
|
|
3776
3775
|
this.progress.delete(transfer);
|
|
3777
|
-
|
|
3776
|
+
await this.abortUpload(transfer).catch(() => {
|
|
3778
3777
|
});
|
|
3779
3778
|
throw withMutation(e, "upload", { mutationId: open2.mutationId });
|
|
3780
3779
|
}
|
|
3781
3780
|
}
|
|
3782
3781
|
}
|
|
3783
|
-
async uploadOnce(source, size2, open2, o
|
|
3782
|
+
async uploadOnce(source, size2, open2, o) {
|
|
3784
3783
|
const s = await this.session(o.signal);
|
|
3785
3784
|
const sig = o.signal ? { signal: o.signal } : {};
|
|
3786
3785
|
const opened = await s.request("open_upload", openUploadParams.enc(open2), { codec: openUploadResult, ...sig });
|
|
@@ -3813,7 +3812,6 @@ var MdbaseSDK = (() => {
|
|
|
3813
3812
|
if (inflight.size >= 4) await Promise.race(inflight);
|
|
3814
3813
|
}
|
|
3815
3814
|
await Promise.all(inflight);
|
|
3816
|
-
phase.committing = true;
|
|
3817
3815
|
const r = await s.request("commit_upload", m([[0, uuid.enc(open2.transfer)]]), {
|
|
3818
3816
|
codec: receipt,
|
|
3819
3817
|
...sig
|
|
@@ -3827,7 +3825,7 @@ var MdbaseSDK = (() => {
|
|
|
3827
3825
|
}
|
|
3828
3826
|
return w;
|
|
3829
3827
|
}
|
|
3830
|
-
/**
|
|
3828
|
+
/** Release the upload lane. An already captured write remains durable; use its receipt to resolve the outcome. */
|
|
3831
3829
|
abortUpload(transferId) {
|
|
3832
3830
|
return this.client.call("abort_upload", m([[0, uuid.enc(transferId)]])).then(() => {
|
|
3833
3831
|
});
|
|
@@ -7152,6 +7150,9 @@ var MdbaseSDK = (() => {
|
|
|
7152
7150
|
continue;
|
|
7153
7151
|
}
|
|
7154
7152
|
signal?.throwIfAborted();
|
|
7153
|
+
if (page.hasMore && !page.cursor) {
|
|
7154
|
+
throw mdbaseError("invalid_request", "Query requires offset paging", "query_cursor_required");
|
|
7155
|
+
}
|
|
7155
7156
|
yield page;
|
|
7156
7157
|
pagesYielded++;
|
|
7157
7158
|
if (!page.cursor) return;
|
|
@@ -11789,7 +11790,7 @@ var MdbaseSDK = (() => {
|
|
|
11789
11790
|
const { key: key3, original } = resolve(found);
|
|
11790
11791
|
return key3 === null ? null : diagnostic(key3, original, found.refusal ?? null);
|
|
11791
11792
|
}
|
|
11792
|
-
var LABELS, PROBLEM_CODES, GENERIC, BUSY,
|
|
11793
|
+
var LABELS, PROBLEM_CODES, GENERIC, BUSY, UNAVAILABLE, UPDATE, CHOOSE, APPROVE, SET_UP, UNFINISHED_SIGN_IN, COPY, ALIASES, READINESS, NON_PROBLEM_CODES, NON_PROBLEMS, DEVELOPER, NAME2, str2, obj3, retry, isProblemCode;
|
|
11793
11794
|
var init_describe_error = __esm({
|
|
11794
11795
|
"src/describe-error.ts"() {
|
|
11795
11796
|
"use strict";
|
|
@@ -11935,7 +11936,7 @@ var MdbaseSDK = (() => {
|
|
|
11935
11936
|
];
|
|
11936
11937
|
GENERIC = ["Something went wrong", "An unexpected problem occurred. Reload the app, and contact support if it keeps happening.", "reload", "error"];
|
|
11937
11938
|
BUSY = ["Another step hasn't finished", "The app couldn't finish this step yet. Try again, or reload if it keeps happening.", "retry", "warning", true];
|
|
11938
|
-
|
|
11939
|
+
UNAVAILABLE = ["Can't complete this request", "mdbase couldn't complete this request. Try again.", "retry", "warning"];
|
|
11939
11940
|
UPDATE = ["Update required", "Update mdbase on this computer, then reload the app to try again.", "update_app", "warning", false, "Update mdbase"];
|
|
11940
11941
|
CHOOSE = ["Choose a collection", "Pick the collection you want this app to use.", "choose_collection", "info"];
|
|
11941
11942
|
APPROVE = ["Approval needed", "This app needs your approval for extra access to your collection.", "approve", "info"];
|
|
@@ -11967,7 +11968,7 @@ var MdbaseSDK = (() => {
|
|
|
11967
11968
|
read_only: ["View access only", "You have view access, so changes can't be saved. Ask the collection's owner for edit access.", "none", "warning"],
|
|
11968
11969
|
forbidden: ["Access needed", "This app doesn't have permission to do that. Approve access to continue.", "approve", "warning"],
|
|
11969
11970
|
collection_invalid: ["Your collection needs repair", "Something in this collection isn't valid. Contact support if this keeps happening.", "contact_support", "error"],
|
|
11970
|
-
unavailable:
|
|
11971
|
+
unavailable: UNAVAILABLE,
|
|
11971
11972
|
rate_limited: ["Too many requests", "Wait a moment, then try again.", "retry", "warning", true],
|
|
11972
11973
|
quota_exceeded: ["Out of storage", "You've reached your storage limit. Free up space to keep saving.", "free_space", "error"],
|
|
11973
11974
|
account_collection_quota_exceeded: ["Synced collection limit reached", ACCOUNT_COLLECTION_QUOTA_MESSAGE, "free_space", "error", false, "Manage collections"],
|
|
@@ -38812,7 +38813,7 @@ ${end.comment}` : end.comment;
|
|
|
38812
38813
|
try {
|
|
38813
38814
|
grant = input.grant();
|
|
38814
38815
|
} catch {
|
|
38815
|
-
return
|
|
38816
|
+
return UNAVAILABLE2;
|
|
38816
38817
|
}
|
|
38817
38818
|
if (!grant) return READY;
|
|
38818
38819
|
if (declaration.required.some((action) => !grant.actions.includes(action))) return incompatible("files_access_missing");
|
|
@@ -38847,14 +38848,14 @@ ${end.comment}` : end.comment;
|
|
|
38847
38848
|
}
|
|
38848
38849
|
});
|
|
38849
38850
|
}
|
|
38850
|
-
var facet, READY, FENCED,
|
|
38851
|
+
var facet, READY, FENCED, UNAVAILABLE2, incompatible;
|
|
38851
38852
|
var init_file_readiness = __esm({
|
|
38852
38853
|
"src/application/file-readiness.ts"() {
|
|
38853
38854
|
"use strict";
|
|
38854
38855
|
facet = (value2) => Object.freeze(value2);
|
|
38855
38856
|
READY = facet({ checking: false, assessment: Object.freeze({ status: "ready", problem: null }), problem: null });
|
|
38856
38857
|
FENCED = facet({ checking: false, assessment: null, problem: Object.freeze({ code: "files_fenced" }) });
|
|
38857
|
-
|
|
38858
|
+
UNAVAILABLE2 = facet({ checking: false, assessment: null, problem: Object.freeze({ code: "files_unavailable" }) });
|
|
38858
38859
|
incompatible = (code) => facet({ checking: false, assessment: Object.freeze({ status: "incompatible", problem: Object.freeze({ code }) }), problem: null });
|
|
38859
38860
|
}
|
|
38860
38861
|
});
|
|
@@ -40969,12 +40970,12 @@ ${end.comment}` : end.comment;
|
|
|
40969
40970
|
// src/application/asset-pins.json
|
|
40970
40971
|
var asset_pins_default = {
|
|
40971
40972
|
runtime: {
|
|
40972
|
-
sha256: "
|
|
40973
|
-
bytes:
|
|
40974
|
-
maxBytes:
|
|
40973
|
+
sha256: "c30e2e23c1fbc6642936996b8495133ce66e87caaf49a99050fc38f8a7422667",
|
|
40974
|
+
bytes: 3803805,
|
|
40975
|
+
maxBytes: 3803805,
|
|
40975
40976
|
source: {
|
|
40976
40977
|
repository: "mdbase-dev/mdbase-connect",
|
|
40977
|
-
commit: "
|
|
40978
|
+
commit: "81462447473808e040d3b31d15ede54e987ffa1e"
|
|
40978
40979
|
}
|
|
40979
40980
|
},
|
|
40980
40981
|
sqlite: {
|
|
@@ -42776,7 +42777,15 @@ ${end.comment}` : end.comment;
|
|
|
42776
42777
|
this.listeners.delete(listener);
|
|
42777
42778
|
};
|
|
42778
42779
|
},
|
|
42779
|
-
start: (options2) => this.track(() => this.call(
|
|
42780
|
+
start: (options2) => this.track(() => this.call(async (runtime2) => {
|
|
42781
|
+
const native = runtime2.getNativeSnapshot();
|
|
42782
|
+
if (native.status === "blocked" && native.signIn && native.selectedCollectionId === null)
|
|
42783
|
+
await runtime2.queue(() => runtime2.start(options2));
|
|
42784
|
+
else await this.started(runtime2, options2);
|
|
42785
|
+
const selection = this.choose(), snapshot4 = selection.getSnapshot();
|
|
42786
|
+
if (snapshot4.state === "blocked" && snapshot4.requested.approved && snapshot4.requested.collectionId !== null)
|
|
42787
|
+
await selection.select(snapshot4.requested.collectionId, options2);
|
|
42788
|
+
}).catch((error4) => {
|
|
42780
42789
|
const native = this.runtime?.getNativeSnapshot();
|
|
42781
42790
|
if (error4?.code === "open_in_another_tab" && native?.status === "blocked" && native.problem === "open_in_another_tab") return;
|
|
42782
42791
|
throw error4;
|
|
@@ -48486,10 +48495,10 @@ ${end.comment}` : end.comment;
|
|
|
48486
48495
|
* sign-in gesture; a pending ledger keeps its SAME request for authorize(). */
|
|
48487
48496
|
start() {
|
|
48488
48497
|
return this.operation(async () => {
|
|
48489
|
-
if (this.flow) return this.getSnapshot();
|
|
48498
|
+
if (this.flow && this.base.status !== "blocked") return this.getSnapshot();
|
|
48490
48499
|
this.publish({ status: "starting", problem: null, signOutResult: null });
|
|
48491
48500
|
const p = this.options;
|
|
48492
|
-
this.flow
|
|
48501
|
+
this.flow ??= await AppProtectedInstallationSignIn.open({
|
|
48493
48502
|
...p,
|
|
48494
48503
|
mode: p.storeMode ?? "open",
|
|
48495
48504
|
signal: this.flowLifetime.signal,
|