@mdbase-dev/sdk 0.1.0-beta.230 → 0.1.0

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.
Files changed (61) hide show
  1. package/dist/application/asset-pins.json +4 -4
  2. package/dist/application/entry.js +2 -1
  3. package/dist/application/entry.js.map +1 -1
  4. package/dist/application/manifest.d.ts +2 -2
  5. package/dist/application/startup-timing.d.ts +6 -0
  6. package/dist/application/startup-timing.js +14 -0
  7. package/dist/application/startup-timing.js.map +1 -1
  8. package/dist/application/worker-session.d.ts +2 -2
  9. package/dist/application/worker.js +198 -104
  10. package/dist/browser/mdbase-sdk.js +251 -129
  11. package/dist/browser/mdbase-sdk.min.js +56 -56
  12. package/dist/client.d.ts +18 -0
  13. package/dist/client.js +42 -3
  14. package/dist/client.js.map +1 -1
  15. package/dist/collection-api.d.ts +1 -0
  16. package/dist/collection-api.js.map +1 -1
  17. package/dist/describe-error.d.ts +1 -1
  18. package/dist/describe-error.js +2 -1
  19. package/dist/describe-error.js.map +1 -1
  20. package/dist/history.d.ts +66 -0
  21. package/dist/history.js +55 -0
  22. package/dist/history.js.map +1 -0
  23. package/dist/native/provenance.json +5 -5
  24. package/dist/native/runtime.wasm +0 -0
  25. package/dist/performance-mark.d.ts +2 -0
  26. package/dist/performance-mark.js +6 -0
  27. package/dist/performance-mark.js.map +1 -0
  28. package/dist/private.js +3 -2
  29. package/dist/private.js.map +1 -1
  30. package/dist/session.js +1 -1
  31. package/dist/session.js.map +1 -1
  32. package/node_modules/@mdbase-dev/connect-protocol/LICENSE +21 -0
  33. package/node_modules/@mdbase-dev/connect-protocol/dist/application-contract.d.ts +28 -0
  34. package/node_modules/@mdbase-dev/connect-protocol/dist/application-contract.js +21 -0
  35. package/node_modules/@mdbase-dev/connect-protocol/dist/application-declaration.d.ts +1 -1
  36. package/node_modules/@mdbase-dev/connect-protocol/dist/capabilities.d.ts +1 -0
  37. package/node_modules/@mdbase-dev/connect-protocol/dist/capabilities.js +2 -1
  38. package/node_modules/@mdbase-dev/connect-protocol/dist/connect-problems.generated.d.ts +14 -0
  39. package/node_modules/@mdbase-dev/connect-protocol/dist/connect-problems.generated.js +16 -0
  40. package/node_modules/@mdbase-dev/connect-protocol/dist/index.d.ts +2 -1
  41. package/node_modules/@mdbase-dev/connect-protocol/dist/index.js +2 -1
  42. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest-validators.generated.js +4 -4
  43. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest.d.ts +5 -0
  44. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest.js +19 -19
  45. package/node_modules/@mdbase-dev/connect-protocol/dist/operations.d.ts +1 -1
  46. package/node_modules/@mdbase-dev/connect-protocol/dist/operations.js +9 -3
  47. package/node_modules/@mdbase-dev/connect-protocol/dist/service-urls.d.ts +11 -0
  48. package/node_modules/@mdbase-dev/connect-protocol/dist/service-urls.js +51 -0
  49. package/node_modules/@mdbase-dev/connect-protocol/package.json +7 -7
  50. package/node_modules/@mdbase-dev/connect-protocol/schemas/application-capability-catalog.v2.json +4 -0
  51. package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-problem.v1.schema.json +57 -0
  52. package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-problems.v1.catalog.json +11 -0
  53. package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-protocol.v1.schema.json +1 -1
  54. package/node_modules/@mdbase-dev/connect-protocol/schemas/mdbase-app.schema.json +2 -1
  55. package/node_modules/@mdbase-dev/connect-protocol/schemas/operation-catalog.v1.json +3 -1
  56. package/node_modules/@mdbase-dev/connect-protocol/schemas/operation-mutation-classification.v1.json +28 -0
  57. package/package.json +2 -2
  58. package/vendor/mdbase-connect-sdk-3d3f95b80c9a.json +13 -0
  59. package/vendor/mdbase-dev-connect-protocol-0.1.0-beta.152-3d3f95b80c9a.tgz +0 -0
  60. package/vendor/mdbase-connect-sdk-e6e66bcd172f.json +0 -13
  61. package/vendor/mdbase-dev-connect-protocol-0.1.0-beta.145-e6e66bcd172f.tgz +0 -0
@@ -2016,6 +2016,16 @@ var MdbaseSDK = (() => {
2016
2016
  }
2017
2017
  });
2018
2018
 
2019
+ // src/performance-mark.ts
2020
+ function performanceMark(name3) {
2021
+ if (typeof performance !== "undefined") performance.mark(name3);
2022
+ }
2023
+ var init_performance_mark = __esm({
2024
+ "src/performance-mark.ts"() {
2025
+ "use strict";
2026
+ }
2027
+ });
2028
+
2019
2029
  // node_modules/@noble/hashes/_u64.js
2020
2030
  function fromBig(n, le = false) {
2021
2031
  if (le)
@@ -3657,7 +3667,7 @@ var MdbaseSDK = (() => {
3657
3667
  init_bases_rpc();
3658
3668
  init_original_session();
3659
3669
  init_wire();
3660
- API_VERSIONS = [{ major: 1, minor: 3 }, { major: 1, minor: 2 }, { major: 1, minor: 1 }, { major: 1, minor: 0 }];
3670
+ API_VERSIONS = [{ major: 1, minor: 4 }, { major: 1, minor: 3 }, { major: 1, minor: 2 }, { major: 1, minor: 1 }, { major: 1, minor: 0 }];
3661
3671
  WriteRefusal = class extends MdbaseError {
3662
3672
  constructor(error5, context = {}) {
3663
3673
  super(schemaToError(error5, "submit").toProblem(), { ...context, cause: error5 });
@@ -4418,6 +4428,114 @@ var MdbaseSDK = (() => {
4418
4428
  }
4419
4429
  });
4420
4430
 
4431
+ // src/private.ts
4432
+ function formatSas(sas) {
4433
+ return /^\d{6}$/.test(sas) ? `${sas.slice(0, 3)} ${sas.slice(3)}` : sas;
4434
+ }
4435
+ var DEVICE_KINDS, kinds, deviceKind, pendingDeviceShape, pendingDevice, approvalReadinessShape, approvalReadiness, recoveryKeyStatus, recoveryKeyCreated, ACCOUNT_KEY_STATES, accountKeyState, accountKeyStatus;
4436
+ var init_private = __esm({
4437
+ "src/private.ts"() {
4438
+ "use strict";
4439
+ init_codec();
4440
+ init_wire();
4441
+ DEVICE_KINDS = ["desktop", "mobile", "app_runtime", "cli", "hosted", "escrow", "recovery"];
4442
+ kinds = enumOf("device-kind", DEVICE_KINDS);
4443
+ deviceKind = {
4444
+ name: "device-kind",
4445
+ enc: (v) => kinds.enc(v),
4446
+ dec: (c) => {
4447
+ try {
4448
+ return kinds.dec(c);
4449
+ } catch {
4450
+ return "unknown";
4451
+ }
4452
+ }
4453
+ };
4454
+ pendingDeviceShape = struct("pending-device", [
4455
+ [0, "device", uuid],
4456
+ [1, "account", uuid],
4457
+ [2, "kind", deviceKind],
4458
+ [3, "sas", tstr, "opt"],
4459
+ // Host response only; omitted from client encodings.
4460
+ [4, "exchangeReady", bool]
4461
+ ]);
4462
+ pendingDevice = {
4463
+ ...pendingDeviceShape,
4464
+ enc: (v) => pendingDeviceShape.enc({ ...v, sas: void 0 })
4465
+ };
4466
+ approvalReadinessShape = struct("approval-readiness", [
4467
+ [0, "device", uuid],
4468
+ [1, "sas", tstr, "opt"],
4469
+ // Reserved: decode-only.
4470
+ [2, "exchangeReady", bool]
4471
+ ]);
4472
+ approvalReadiness = {
4473
+ ...approvalReadinessShape,
4474
+ enc: (v) => approvalReadinessShape.enc({ ...v, sas: void 0 })
4475
+ };
4476
+ recoveryKeyStatus = struct("recovery-key-status", [
4477
+ [0, "configured", bool],
4478
+ [1, "device", uuid, "opt"]
4479
+ ]);
4480
+ recoveryKeyCreated = struct("recovery-key-created", [
4481
+ [0, "phrase", tstr],
4482
+ [1, "device", uuid]
4483
+ ]);
4484
+ ACCOUNT_KEY_STATES = ["idle", "reading_ahead", "pending_grant", "keyed", "refused"];
4485
+ accountKeyState = enumOf("account-key-state", ACCOUNT_KEY_STATES);
4486
+ accountKeyStatus = struct("account-key-status", [
4487
+ [0, "state", accountKeyState],
4488
+ [1, "problem", problem, "opt"]
4489
+ ]);
4490
+ }
4491
+ });
4492
+
4493
+ // src/history.ts
4494
+ var recordHistoryParams, recordVersionParams, authorRef2, historyVersion, recordHistory, recordVersion;
4495
+ var init_history = __esm({
4496
+ "src/history.ts"() {
4497
+ "use strict";
4498
+ init_codec();
4499
+ init_private();
4500
+ recordHistoryParams = struct("record-history-params", [
4501
+ [0, "record", uuid],
4502
+ [1, "before", uint, "opt"],
4503
+ [2, "limit", uint, "opt"]
4504
+ ]);
4505
+ recordVersionParams = struct("record-version-params", [
4506
+ [0, "record", uuid],
4507
+ [1, "seq", uint]
4508
+ ]);
4509
+ authorRef2 = struct("author-ref", [
4510
+ [0, "account", uuid],
4511
+ [1, "device", uuid],
4512
+ [2, "grant", uuid, "opt"],
4513
+ [3, "grantAccount", uuid, "opt"]
4514
+ ]);
4515
+ historyVersion = struct("history-version", [
4516
+ [0, "seq", uint],
4517
+ [1, "time", int],
4518
+ [2, "author", authorRef2],
4519
+ [3, "kind", enumOf("version-kind", ["created", "edited", "moved", "deleted"])],
4520
+ [4, "path", tstr],
4521
+ [5, "revision", hash, "opt"],
4522
+ [6, "source", enumOf("source", ["api", "external"])],
4523
+ [7, "deviceKind", deviceKind],
4524
+ [8, "app", tstr, "opt"]
4525
+ ]);
4526
+ recordHistory = struct("record-history", [
4527
+ [0, "versions", list(historyVersion)],
4528
+ [1, "from", uint],
4529
+ [2, "fromTime", int, "opt"],
4530
+ [3, "next", uint, "opt"]
4531
+ ]);
4532
+ recordVersion = struct("record-version", [
4533
+ [0, "path", tstr],
4534
+ [1, "document", tstr]
4535
+ ]);
4536
+ }
4537
+ });
4538
+
4421
4539
  // src/settle.ts
4422
4540
  function unknown(mutationId, reason, text9, receipt4) {
4423
4541
  const problem7 = { code: "outcome_unknown", recovery: "resolve_outcome", reason, message: text9 };
@@ -6617,68 +6735,6 @@ var MdbaseSDK = (() => {
6617
6735
  }
6618
6736
  });
6619
6737
 
6620
- // src/private.ts
6621
- function formatSas(sas) {
6622
- return /^\d{6}$/.test(sas) ? `${sas.slice(0, 3)} ${sas.slice(3)}` : sas;
6623
- }
6624
- var DEVICE_KINDS, kinds, deviceKind, pendingDeviceShape, pendingDevice, approvalReadinessShape, approvalReadiness, recoveryKeyStatus, recoveryKeyCreated, ACCOUNT_KEY_STATES, accountKeyState, accountKeyStatus;
6625
- var init_private = __esm({
6626
- "src/private.ts"() {
6627
- "use strict";
6628
- init_codec();
6629
- init_wire();
6630
- DEVICE_KINDS = ["desktop", "mobile", "app_runtime", "cli", "hosted", "escrow", "recovery"];
6631
- kinds = enumOf("device-kind", DEVICE_KINDS);
6632
- deviceKind = {
6633
- name: "device-kind",
6634
- enc: (v) => kinds.enc(v),
6635
- dec: (c) => {
6636
- try {
6637
- return kinds.dec(c);
6638
- } catch {
6639
- return "unknown";
6640
- }
6641
- }
6642
- };
6643
- pendingDeviceShape = struct("pending-device", [
6644
- [0, "device", uuid],
6645
- [1, "account", uuid],
6646
- [2, "kind", deviceKind],
6647
- [3, "sas", tstr, "opt"],
6648
- // Host response only; omitted from client encodings.
6649
- [4, "exchangeReady", bool]
6650
- ]);
6651
- pendingDevice = {
6652
- ...pendingDeviceShape,
6653
- enc: (v) => pendingDeviceShape.enc({ ...v, sas: void 0 })
6654
- };
6655
- approvalReadinessShape = struct("approval-readiness", [
6656
- [0, "device", uuid],
6657
- [1, "sas", tstr, "opt"],
6658
- // Reserved: decode-only.
6659
- [2, "exchangeReady", bool]
6660
- ]);
6661
- approvalReadiness = {
6662
- ...approvalReadinessShape,
6663
- enc: (v) => approvalReadinessShape.enc({ ...v, sas: void 0 })
6664
- };
6665
- recoveryKeyStatus = struct("recovery-key-status", [
6666
- [0, "configured", bool],
6667
- [1, "device", uuid, "opt"]
6668
- ]);
6669
- recoveryKeyCreated = struct("recovery-key-created", [
6670
- [0, "phrase", tstr],
6671
- [1, "device", uuid]
6672
- ]);
6673
- ACCOUNT_KEY_STATES = ["idle", "reading_ahead", "pending_grant", "keyed", "refused"];
6674
- accountKeyState = enumOf("account-key-state", ACCOUNT_KEY_STATES);
6675
- accountKeyStatus = struct("account-key-status", [
6676
- [0, "state", accountKeyState],
6677
- [1, "problem", problem, "opt"]
6678
- ]);
6679
- }
6680
- });
6681
-
6682
6738
  // src/write-ledger.ts
6683
6739
  function memoryWriteLedgerStore() {
6684
6740
  const rows2 = /* @__PURE__ */ new Map();
@@ -6874,6 +6930,14 @@ var MdbaseSDK = (() => {
6874
6930
  for (const [k, v] of entries) if (v !== void 0) m2.set(k, v);
6875
6931
  return m2;
6876
6932
  }
6933
+ function historyRead(read2) {
6934
+ return read2.catch((e) => {
6935
+ if (isMdbaseError(e, "invalid_request") && e.reason === "unknown_method") {
6936
+ throw mdbaseError("upgrade_required", "This collection's replica has no record history.", "history_unsupported");
6937
+ }
6938
+ throw e;
6939
+ });
6940
+ }
6877
6941
  function withCurrentGrant(hello, grant) {
6878
6942
  const prior = hello.grant;
6879
6943
  if (!grant || prior.grant === grant.grant && prior.role === grant.role && valueEquals(prior.capabilities, grant.capabilities) && valueEquals(prior.fileFolders ?? null, grant.fileFolders ?? null)) return hello;
@@ -6904,6 +6968,7 @@ var MdbaseSDK = (() => {
6904
6968
  var init_client = __esm({
6905
6969
  "src/client.ts"() {
6906
6970
  "use strict";
6971
+ init_performance_mark();
6907
6972
  init_cbor();
6908
6973
  init_bases_wire();
6909
6974
  init_bases_pages();
@@ -6911,6 +6976,7 @@ var MdbaseSDK = (() => {
6911
6976
  init_validation();
6912
6977
  init_errors();
6913
6978
  init_files();
6979
+ init_history();
6914
6980
  init_settle();
6915
6981
  init_read_helpers();
6916
6982
  init_records();
@@ -7122,7 +7188,9 @@ var MdbaseSDK = (() => {
7122
7188
  "new_type_file",
7123
7189
  "get_contract_v1",
7124
7190
  "map_contract_write_v1",
7125
- "plan_type_pack_v1"
7191
+ "plan_type_pack_v1",
7192
+ "record_history",
7193
+ "record_version"
7126
7194
  ]);
7127
7195
  MdbaseClient = class _MdbaseClient {
7128
7196
  constructor(opts, session) {
@@ -7181,6 +7249,7 @@ var MdbaseSDK = (() => {
7181
7249
  presence;
7182
7250
  writeLedger;
7183
7251
  ledgerStarted = false;
7252
+ queryAnswered = false;
7184
7253
  transportDeferred = false;
7185
7254
  /**
7186
7255
  * Unconfirmed and refused writes, and the overall save state. Survives a
@@ -7847,7 +7916,14 @@ var MdbaseSDK = (() => {
7847
7916
  [2, o.contract]
7848
7917
  ]),
7849
7918
  { codec: queryResult, retry: true, ...o.signal ? { signal: o.signal } : {} }
7850
- );
7919
+ ).then((result2) => this.firstQueryResult(result2));
7920
+ }
7921
+ firstQueryResult(result2) {
7922
+ if (!this.queryAnswered) {
7923
+ this.queryAnswered = true;
7924
+ performanceMark("mdbase:query:first-result");
7925
+ }
7926
+ return result2;
7851
7927
  }
7852
7928
  /** Canonical contract projections with validation issues and ordinary cursor
7853
7929
  * metadata. Positive page sizes above the producer's 128-record maximum clamp
@@ -7869,7 +7945,7 @@ var MdbaseSDK = (() => {
7869
7945
  if (result2.version !== 1) throw mdbaseError("upgrade_required", "unsupported contract query result", "contract_query_version");
7870
7946
  if (result2.records.length !== result2.page.records.length || result2.records.some((record5, i) => record5.id !== result2.page.records[i]?.id))
7871
7947
  throw mdbaseError("unavailable", "invalid contract query record binding", "contract_query_response");
7872
- return result2;
7948
+ return this.firstQueryResult(result2);
7873
7949
  }
7874
7950
  /**
7875
7951
  * One page of the records whose links resolve to `target`, from the
@@ -7926,6 +8002,29 @@ var MdbaseSDK = (() => {
7926
8002
  throw e;
7927
8003
  });
7928
8004
  }
8005
+ /**
8006
+ * Record history (§4.4, API 1.4): the versions of a record that the log still
8007
+ * retains. Needs `collection.read` and `history.read` through a grant without
8008
+ * a folder scope. A replica without history,
8009
+ * the hosted replica and a local-only collection refuse with
8010
+ * `upgrade_required` / `history_unsupported`.
8011
+ */
8012
+ history = {
8013
+ /** One page of a record's versions, newest first. Pass `next` as `before`
8014
+ * for older ones. `o.signal` cancels the read. */
8015
+ list: (record5, o = {}) => historyRead(this.call("record_history", recordHistoryParams.enc({ record: record5, before: o.before, limit: o.limit }), {
8016
+ codec: recordHistory,
8017
+ retry: true,
8018
+ ...o.signal ? { signal: o.signal } : {}
8019
+ })),
8020
+ /** The exact document of the version at log position `seq`, checked
8021
+ * against its revision. `o.signal` cancels the read. */
8022
+ version: (record5, seq2, o = {}) => historyRead(this.call("record_version", recordVersionParams.enc({ record: record5, seq: seq2 }), {
8023
+ codec: recordVersion,
8024
+ retry: true,
8025
+ ...o.signal ? { signal: o.signal } : {}
8026
+ }))
8027
+ };
7929
8028
  /** Definitions: `mdbase.yaml`, type files, contract files (§4.1). */
7930
8029
  resources = {
7931
8030
  /** One definition by path. `o.signal` cancels the read. */
@@ -8088,6 +8187,10 @@ var MdbaseSDK = (() => {
8088
8187
  live(query, o = {}) {
8089
8188
  const l = new LiveQuery(this, query, o.include);
8090
8189
  this.lives.add(l);
8190
+ void l.ready.then(() => {
8191
+ this.firstQueryResult(void 0);
8192
+ }, () => {
8193
+ });
8091
8194
  void this._resubscribeLive(l, true);
8092
8195
  return l;
8093
8196
  }
@@ -9583,6 +9686,7 @@ var MdbaseSDK = (() => {
9583
9686
  "people_unsupported",
9584
9687
  "people_permission_declined",
9585
9688
  "people_access",
9689
+ "history_unsupported",
9586
9690
  "configuration_conflict",
9587
9691
  "configuration_unavailable",
9588
9692
  "configuration_unsupported",
@@ -9720,6 +9824,7 @@ var MdbaseSDK = (() => {
9720
9824
  people_unsupported: ["Sharing isn't available here", "People and sharing aren't supported for this collection yet.", "none", "info"],
9721
9825
  people_permission_declined: ["People aren't shown", "This app wasn't allowed to see who else is in this collection. Approve it again and allow people to show them here.", "approve", "info", false, "Approve again"],
9722
9826
  people_access: ["People can't be shown", "This app can't see the people in this collection right now. Everything else still works.", "none", "info"],
9827
+ history_unsupported: ["History isn't available here", "Earlier versions of records in this collection can't be read here. Everything else still works.", "none", "info"],
9723
9828
  configuration_conflict: ["Settings changed elsewhere", "These settings were changed on another device. Review them and try again.", "retry", "warning"],
9724
9829
  // The collection's setup couldn't be assessed: not a network problem.
9725
9830
  configuration_unavailable: ["Couldn't check this collection's setup", "The app couldn't read how this collection is set up, so it didn't open it. Nothing in the collection was changed. Try again, and contact support if it keeps happening.", "retry", "warning"],
@@ -17067,7 +17172,7 @@ ${end.comment}` : end.comment;
17067
17172
  const len0 = data1.length;
17068
17173
  for (let i0 = 0; i0 < len0; i0++) {
17069
17174
  let data2 = data1[i0];
17070
- if (!(data2 === "collection.read" || data2 === "records.create" || data2 === "records.edit" || data2 === "records.delete" || data2 === "views.manage" || data2 === "definitions.manage" || data2 === "background.schedule" || data2 === "offline.replica")) {
17175
+ if (!(data2 === "collection.read" || data2 === "records.create" || data2 === "records.edit" || data2 === "records.delete" || data2 === "views.manage" || data2 === "definitions.manage" || data2 === "background.schedule" || data2 === "offline.replica" || data2 === "history.read")) {
17071
17176
  const err5 = { instancePath: instancePath + "/required/" + i0, schemaPath: "#/$defs/applicationCapability/enum", keyword: "enum", params: { allowedValues: schema37.enum }, message: "must be equal to one of the allowed values" };
17072
17177
  if (vErrors === null) {
17073
17178
  vErrors = [err5];
@@ -17120,7 +17225,7 @@ ${end.comment}` : end.comment;
17120
17225
  const len1 = data3.length;
17121
17226
  for (let i2 = 0; i2 < len1; i2++) {
17122
17227
  let data4 = data3[i2];
17123
- if (!(data4 === "collection.read" || data4 === "records.create" || data4 === "records.edit" || data4 === "records.delete" || data4 === "views.manage" || data4 === "definitions.manage" || data4 === "background.schedule" || data4 === "offline.replica")) {
17228
+ if (!(data4 === "collection.read" || data4 === "records.create" || data4 === "records.edit" || data4 === "records.delete" || data4 === "views.manage" || data4 === "definitions.manage" || data4 === "background.schedule" || data4 === "offline.replica" || data4 === "history.read")) {
17124
17229
  const err9 = { instancePath: instancePath + "/optional/" + i2, schemaPath: "#/$defs/applicationCapability/enum", keyword: "enum", params: { allowedValues: schema37.enum }, message: "must be equal to one of the allowed values" };
17125
17230
  if (vErrors === null) {
17126
17231
  vErrors = [err9];
@@ -24040,7 +24145,7 @@ ${end.comment}` : end.comment;
24040
24145
  "node_modules/@mdbase-dev/connect-protocol/dist/manifest-validators.generated.js"() {
24041
24146
  "use strict";
24042
24147
  appManifestValidator = validate20;
24043
- schema31 = { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://mdbase.dev/connect/schemas/mdbase-app.v1.json", "title": "mdbase connect bundled application manifest v1", "type": "object", "additionalProperties": false, "required": ["manifest_version", "id", "name"], "properties": { "manifest_version": { "const": 1 }, "distribution": { "enum": ["web", "portable"], "description": "Portable declarations use device authorization and do not claim a browser origin." }, "id": { "type": "string", "minLength": 5, "maxLength": 150, "pattern": "^[a-z][a-z0-9-]*(\\.[a-z][a-z0-9-]*){2,}$", "description": "Stable reverse-domain application identifier. This is presentation metadata, not publisher authentication." }, "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "platform": { "const": "native", "description": "Unverified native app; permits literal IPv4 loopback HTTP on any port." }, "homepage": { "type": "string", "format": "uri", "pattern": "^https://" }, "project_url": { "type": "string", "format": "uri", "pattern": "^https://" }, "icon": { "type": "string", "format": "uri", "pattern": "^https://" }, "redirect_uris": { "type": "array", "minItems": 1, "maxItems": 10, "uniqueItems": true, "items": { "type": "string", "format": "uri", "description": "An HTTPS URI on the homepage origin or a private-use scheme derived from the application ID." } }, "installation_origins": { "type": "object", "additionalProperties": false, "properties": { "lab": { "$ref": "#/$defs/installationOriginPolicy" }, "staging": { "$ref": "#/$defs/installationOriginPolicy" }, "production": { "$ref": "#/$defs/installationOriginPolicy" } } }, "requirements": { "$ref": "#/$defs/requirements" }, "provisions": { "type": "object", "additionalProperties": false, "required": ["type_packs"], "properties": { "configuration": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/configurationProvision" } }, "type_packs": { "type": "array", "maxItems": 20, "items": { "$ref": "#/$defs/typePackProvision" } } } }, "notifications": { "type": "object", "additionalProperties": false, "required": ["criteria"], "properties": { "criteria": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/notificationCriterion" } }, "native_delivery": { "$ref": "#/$defs/nativeNotificationDelivery" } } } }, "oneOf": [{ "required": ["homepage", "redirect_uris"], "properties": { "distribution": { "const": "web" }, "homepage": true, "redirect_uris": true, "project_url": false } }, { "required": ["distribution"], "properties": { "distribution": { "const": "portable" }, "platform": false, "homepage": false, "redirect_uris": false } }], "$defs": { "installationOriginPolicy": { "type": "object", "additionalProperties": false, "properties": { "app-runtime": { "$ref": "#/$defs/installationOrigins" }, "mobile": { "$ref": "#/$defs/installationOrigins" } } }, "installationOrigins": { "type": "array", "maxItems": 16, "uniqueItems": true, "items": { "type": "string", "minLength": 1, "maxLength": 255, "format": "uri" } }, "identifier": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$" }, "duration": { "type": "string", "pattern": "^[0-9]+(ms|s|m|h|d)$" }, "contract": { "type": "object", "additionalProperties": false, "required": ["id", "version", "digest"], "properties": { "id": { "$ref": "#/$defs/identifier" }, "version": { "type": "string", "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$" }, "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } } }, "requirements": { "type": "object", "additionalProperties": false, "required": ["access", "contracts"], "properties": { "capabilities": { "$ref": "#/$defs/capabilityRequirements" }, "access": { "const": "full_collection", "description": "Compatibility declaration for collection-level application authorization." }, "collection_kind": { "const": "hosted", "description": "Require a durable provider-backed collection with direct sync support." }, "people": { "type": "object", "additionalProperties": false, "required": ["version"], "anyOf": [{ "required": ["required"] }, { "required": ["optional"] }], "properties": { "version": { "const": 1 }, "required": { "$ref": "#/$defs/peoplePermissions" }, "optional": { "$ref": "#/$defs/peoplePermissions" } } }, "files": { "$ref": "#/$defs/fileRequirement" }, "configuration": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/configurationRequirement" } }, "contracts": { "type": "array", "maxItems": 20, "uniqueItems": true, "items": { "$ref": "#/$defs/contract" } } } }, "capabilityRequirements": { "type": "object", "additionalProperties": false, "required": ["contract_version", "required"], "properties": { "contract_version": { "const": 2 }, "required": { "type": "array", "maxItems": 32, "uniqueItems": true, "items": { "$ref": "#/$defs/applicationCapability" } }, "optional": { "type": "array", "maxItems": 32, "uniqueItems": true, "items": { "$ref": "#/$defs/applicationCapability" } } } }, "configurationValue": { "anyOf": [{ "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "null" }] }, "configurationRequirement": { "type": "object", "additionalProperties": false, "required": ["id", "path", "predicate", "value"], "properties": { "id": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" }, "path": { "type": "string", "minLength": 1, "maxLength": 1024 }, "predicate": { "const": "contains" }, "value": { "$ref": "#/$defs/configurationValue" } } }, "configurationProvision": { "type": "object", "additionalProperties": false, "required": ["requirement", "operation", "path", "value"], "properties": { "requirement": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" }, "operation": { "const": "set_add" }, "path": { "type": "string", "minLength": 1, "maxLength": 1024 }, "value": { "$ref": "#/$defs/configurationValue" } } }, "applicationCapability": { "enum": ["collection.read", "records.create", "records.edit", "records.delete", "views.manage", "definitions.manage", "background.schedule", "offline.replica"] }, "peoplePermissions": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["identity", "members"] } }, "fileRequirement": { "type": "object", "additionalProperties": false, "required": ["required", "scope"], "properties": { "required": { "$ref": "#/$defs/fileActions" }, "optional": { "$ref": "#/$defs/fileActions" }, "scope": { "$ref": "#/$defs/fileScope" } } }, "fileActions": { "type": "array", "minItems": 1, "maxItems": 6, "uniqueItems": true, "items": { "enum": ["list", "read", "add", "replace", "move", "delete"] } }, "fileScope": { "oneOf": [{ "type": "object", "additionalProperties": false, "required": ["kind", "folders"], "properties": { "kind": { "const": "selected_folders" }, "folders": { "type": "array", "minItems": 1, "maxItems": 100, "uniqueItems": true, "items": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^(?!/)(?!\\.)(?!.*//)(?!.*\\\\)(?!.*/\\.)(?!(?:_contracts|_schemas|_types|_views|node_modules)(?:/|$))(?!.*\\/(?:_contracts|_schemas|_types|_views|node_modules)(?:/|$))(?!.*/$).+$" } } } }, { "type": "object", "additionalProperties": false, "required": ["kind"], "properties": { "kind": { "const": "collection" } } }] }, "typePackProvision": { "type": "object", "additionalProperties": false, "required": ["manifest", "resources", "provides"], "properties": { "manifest": { "$ref": "#/$defs/typePackManifest" }, "resources": { "type": "array", "minItems": 1, "maxItems": 100, "items": { "$ref": "#/$defs/typePackSourceResource" } }, "provides": { "type": "array", "maxItems": 20, "uniqueItems": true, "items": { "$ref": "#/$defs/contract" } } } }, "typePackManifest": { "type": "object", "required": ["kind", "id", "version", "resources"], "properties": { "kind": { "const": "mdbase.type-pack" }, "id": { "$ref": "#/$defs/identifier" }, "version": { "$ref": "#/$defs/contract/properties/version" }, "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "description": { "type": "string", "maxLength": 500 }, "resources": { "type": "array", "minItems": 1, "maxItems": 100, "items": { "$ref": "#/$defs/typePackManifestResource" } } }, "patternProperties": { "^x-[A-Za-z][A-Za-z0-9._:-]{0,127}$": true }, "additionalProperties": false }, "typePackManifestResource": { "type": "object", "additionalProperties": false, "required": ["kind", "mode", "source", "target", "digest"], "properties": { "kind": { "enum": ["contract", "type", "schema"] }, "mode": { "enum": ["managed", "seed"] }, "upgrade_from": { "oneOf": [{ "$ref": "#/$defs/typePackUpgradeBaseline" }, { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/typePackUpgradeBaseline" } }] }, "source": { "type": "string", "minLength": 1, "maxLength": 240 }, "target": { "type": "string", "minLength": 1, "maxLength": 240 }, "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } } }, "typePackUpgradeBaseline": { "type": "object", "additionalProperties": false, "required": ["digest", "document"], "properties": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }, "document": { "type": "string", "maxLength": 262144 }, "version": { "type": "integer", "minimum": 1 } } }, "typePackSourceResource": { "type": "object", "additionalProperties": false, "required": ["source", "document"], "properties": { "source": { "type": "string", "minLength": 1, "maxLength": 240 }, "document": { "type": "string", "maxLength": 262144 } } }, "notificationCriterion": { "type": "object", "additionalProperties": false, "required": ["id", "event", "presentation"], "properties": { "id": { "$ref": "#/$defs/identifier" }, "event": { "$ref": "#/$defs/contract" }, "if": { "type": "object", "additionalProperties": false, "required": ["$expr"], "properties": { "$expr": { "type": "string", "minLength": 1, "maxLength": 4096 } } }, "debounce": { "$ref": "#/$defs/duration" }, "minimum_interval": { "$ref": "#/$defs/duration" }, "presentation": { "type": "object", "additionalProperties": false, "required": ["title"], "properties": { "title": { "type": "string", "minLength": 1, "maxLength": 80 }, "body": { "type": "string", "maxLength": 160 }, "tag": { "type": "string", "minLength": 1, "maxLength": 80 } } } } }, "nativeNotificationDelivery": { "oneOf": [{ "type": "object", "additionalProperties": false, "required": ["mode", "firebase_project_id"], "properties": { "mode": { "const": "managed_fcm" }, "firebase_project_id": { "type": "string", "minLength": 6, "maxLength": 63, "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$" } } }, { "type": "object", "additionalProperties": false, "required": ["mode", "url"], "properties": { "mode": { "const": "webhook" }, "url": { "type": "string", "format": "uri", "pattern": "^https://" } } }] } } };
24148
+ schema31 = { "$schema": "https://json-schema.org/draft/2020-12/schema", "$id": "https://mdbase.dev/connect/schemas/mdbase-app.v1.json", "title": "mdbase connect bundled application manifest v1", "type": "object", "additionalProperties": false, "required": ["manifest_version", "id", "name"], "properties": { "manifest_version": { "const": 1 }, "distribution": { "enum": ["web", "portable"], "description": "Portable declarations use device authorization and do not claim a browser origin." }, "id": { "type": "string", "minLength": 5, "maxLength": 150, "pattern": "^[a-z][a-z0-9-]*(\\.[a-z][a-z0-9-]*){2,}$", "description": "Stable reverse-domain application identifier. This is presentation metadata, not publisher authentication." }, "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "platform": { "const": "native", "description": "Unverified native app; permits literal IPv4 loopback HTTP on any port." }, "homepage": { "type": "string", "format": "uri", "pattern": "^https://" }, "project_url": { "type": "string", "format": "uri", "pattern": "^https://" }, "icon": { "type": "string", "format": "uri", "pattern": "^https://" }, "redirect_uris": { "type": "array", "minItems": 1, "maxItems": 10, "uniqueItems": true, "items": { "type": "string", "format": "uri", "description": "An HTTPS URI on the homepage origin or a private-use scheme derived from the application ID." } }, "installation_origins": { "type": "object", "additionalProperties": false, "properties": { "lab": { "$ref": "#/$defs/installationOriginPolicy" }, "staging": { "$ref": "#/$defs/installationOriginPolicy" }, "production": { "$ref": "#/$defs/installationOriginPolicy" } } }, "requirements": { "$ref": "#/$defs/requirements" }, "provisions": { "type": "object", "additionalProperties": false, "required": ["type_packs"], "properties": { "configuration": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/configurationProvision" } }, "type_packs": { "type": "array", "maxItems": 20, "items": { "$ref": "#/$defs/typePackProvision" } } } }, "notifications": { "type": "object", "additionalProperties": false, "required": ["criteria"], "properties": { "criteria": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/notificationCriterion" } }, "native_delivery": { "$ref": "#/$defs/nativeNotificationDelivery" } } } }, "oneOf": [{ "required": ["homepage", "redirect_uris"], "properties": { "distribution": { "const": "web" }, "homepage": true, "redirect_uris": true, "project_url": false } }, { "required": ["distribution"], "properties": { "distribution": { "const": "portable" }, "platform": false, "homepage": false, "redirect_uris": false } }], "$defs": { "installationOriginPolicy": { "type": "object", "additionalProperties": false, "properties": { "app-runtime": { "$ref": "#/$defs/installationOrigins" }, "mobile": { "$ref": "#/$defs/installationOrigins" } } }, "installationOrigins": { "type": "array", "maxItems": 16, "uniqueItems": true, "items": { "type": "string", "minLength": 1, "maxLength": 255, "format": "uri" } }, "identifier": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z0-9]+(?:[._-][a-z0-9]+)*$" }, "duration": { "type": "string", "pattern": "^[0-9]+(ms|s|m|h|d)$" }, "contract": { "type": "object", "additionalProperties": false, "required": ["id", "version", "digest"], "properties": { "id": { "$ref": "#/$defs/identifier" }, "version": { "type": "string", "pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)(?:-[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?(?:\\+[0-9A-Za-z-]+(?:\\.[0-9A-Za-z-]+)*)?$" }, "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } } }, "requirements": { "type": "object", "additionalProperties": false, "required": ["access", "contracts"], "properties": { "capabilities": { "$ref": "#/$defs/capabilityRequirements" }, "access": { "const": "full_collection", "description": "Compatibility declaration for collection-level application authorization." }, "collection_kind": { "const": "hosted", "description": "Require a durable provider-backed collection with direct sync support." }, "people": { "type": "object", "additionalProperties": false, "required": ["version"], "anyOf": [{ "required": ["required"] }, { "required": ["optional"] }], "properties": { "version": { "const": 1 }, "required": { "$ref": "#/$defs/peoplePermissions" }, "optional": { "$ref": "#/$defs/peoplePermissions" } } }, "files": { "$ref": "#/$defs/fileRequirement" }, "configuration": { "type": "array", "maxItems": 50, "items": { "$ref": "#/$defs/configurationRequirement" } }, "contracts": { "type": "array", "maxItems": 20, "uniqueItems": true, "items": { "$ref": "#/$defs/contract" } } } }, "capabilityRequirements": { "type": "object", "additionalProperties": false, "required": ["contract_version", "required"], "properties": { "contract_version": { "const": 2 }, "required": { "type": "array", "maxItems": 32, "uniqueItems": true, "items": { "$ref": "#/$defs/applicationCapability" } }, "optional": { "type": "array", "maxItems": 32, "uniqueItems": true, "items": { "$ref": "#/$defs/applicationCapability" } } } }, "configurationValue": { "anyOf": [{ "type": "string" }, { "type": "number" }, { "type": "boolean" }, { "type": "null" }] }, "configurationRequirement": { "type": "object", "additionalProperties": false, "required": ["id", "path", "predicate", "value"], "properties": { "id": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" }, "path": { "type": "string", "minLength": 1, "maxLength": 1024 }, "predicate": { "const": "contains" }, "value": { "$ref": "#/$defs/configurationValue" } } }, "configurationProvision": { "type": "object", "additionalProperties": false, "required": ["requirement", "operation", "path", "value"], "properties": { "requirement": { "type": "string", "minLength": 1, "maxLength": 100, "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" }, "operation": { "const": "set_add" }, "path": { "type": "string", "minLength": 1, "maxLength": 1024 }, "value": { "$ref": "#/$defs/configurationValue" } } }, "applicationCapability": { "enum": ["collection.read", "records.create", "records.edit", "records.delete", "views.manage", "definitions.manage", "background.schedule", "offline.replica", "history.read"] }, "peoplePermissions": { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["identity", "members"] } }, "fileRequirement": { "type": "object", "additionalProperties": false, "required": ["required", "scope"], "properties": { "required": { "$ref": "#/$defs/fileActions" }, "optional": { "$ref": "#/$defs/fileActions" }, "scope": { "$ref": "#/$defs/fileScope" } } }, "fileActions": { "type": "array", "minItems": 1, "maxItems": 6, "uniqueItems": true, "items": { "enum": ["list", "read", "add", "replace", "move", "delete"] } }, "fileScope": { "oneOf": [{ "type": "object", "additionalProperties": false, "required": ["kind", "folders"], "properties": { "kind": { "const": "selected_folders" }, "folders": { "type": "array", "minItems": 1, "maxItems": 100, "uniqueItems": true, "items": { "type": "string", "minLength": 1, "maxLength": 1024, "pattern": "^(?!/)(?!\\.)(?!.*//)(?!.*\\\\)(?!.*/\\.)(?!(?:_contracts|_schemas|_types|_views|node_modules)(?:/|$))(?!.*\\/(?:_contracts|_schemas|_types|_views|node_modules)(?:/|$))(?!.*/$).+$" } } } }, { "type": "object", "additionalProperties": false, "required": ["kind"], "properties": { "kind": { "const": "collection" } } }] }, "typePackProvision": { "type": "object", "additionalProperties": false, "required": ["manifest", "resources", "provides"], "properties": { "manifest": { "$ref": "#/$defs/typePackManifest" }, "resources": { "type": "array", "minItems": 1, "maxItems": 100, "items": { "$ref": "#/$defs/typePackSourceResource" } }, "provides": { "type": "array", "maxItems": 20, "uniqueItems": true, "items": { "$ref": "#/$defs/contract" } } } }, "typePackManifest": { "type": "object", "required": ["kind", "id", "version", "resources"], "properties": { "kind": { "const": "mdbase.type-pack" }, "id": { "$ref": "#/$defs/identifier" }, "version": { "$ref": "#/$defs/contract/properties/version" }, "name": { "type": "string", "minLength": 1, "maxLength": 100 }, "description": { "type": "string", "maxLength": 500 }, "resources": { "type": "array", "minItems": 1, "maxItems": 100, "items": { "$ref": "#/$defs/typePackManifestResource" } } }, "patternProperties": { "^x-[A-Za-z][A-Za-z0-9._:-]{0,127}$": true }, "additionalProperties": false }, "typePackManifestResource": { "type": "object", "additionalProperties": false, "required": ["kind", "mode", "source", "target", "digest"], "properties": { "kind": { "enum": ["contract", "type", "schema"] }, "mode": { "enum": ["managed", "seed"] }, "upgrade_from": { "oneOf": [{ "$ref": "#/$defs/typePackUpgradeBaseline" }, { "type": "array", "minItems": 1, "items": { "$ref": "#/$defs/typePackUpgradeBaseline" } }] }, "source": { "type": "string", "minLength": 1, "maxLength": 240 }, "target": { "type": "string", "minLength": 1, "maxLength": 240 }, "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" } } }, "typePackUpgradeBaseline": { "type": "object", "additionalProperties": false, "required": ["digest", "document"], "properties": { "digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }, "document": { "type": "string", "maxLength": 262144 }, "version": { "type": "integer", "minimum": 1 } } }, "typePackSourceResource": { "type": "object", "additionalProperties": false, "required": ["source", "document"], "properties": { "source": { "type": "string", "minLength": 1, "maxLength": 240 }, "document": { "type": "string", "maxLength": 262144 } } }, "notificationCriterion": { "type": "object", "additionalProperties": false, "required": ["id", "event", "presentation"], "properties": { "id": { "$ref": "#/$defs/identifier" }, "event": { "$ref": "#/$defs/contract" }, "if": { "type": "object", "additionalProperties": false, "required": ["$expr"], "properties": { "$expr": { "type": "string", "minLength": 1, "maxLength": 4096 } } }, "debounce": { "$ref": "#/$defs/duration" }, "minimum_interval": { "$ref": "#/$defs/duration" }, "presentation": { "type": "object", "additionalProperties": false, "required": ["title"], "properties": { "title": { "type": "string", "minLength": 1, "maxLength": 80 }, "body": { "type": "string", "maxLength": 160 }, "tag": { "type": "string", "minLength": 1, "maxLength": 80 } } } } }, "nativeNotificationDelivery": { "oneOf": [{ "type": "object", "additionalProperties": false, "required": ["mode", "firebase_project_id"], "properties": { "mode": { "const": "managed_fcm" }, "firebase_project_id": { "type": "string", "minLength": 6, "maxLength": 63, "pattern": "^[a-z][a-z0-9-]*[a-z0-9]$" } } }, { "type": "object", "additionalProperties": false, "required": ["mode", "url"], "properties": { "mode": { "const": "webhook" }, "url": { "type": "string", "format": "uri", "pattern": "^https://" } } }] } } };
24044
24149
  func1 = Object.prototype.hasOwnProperty;
24045
24150
  func2 = (function ucs2length(str3) {
24046
24151
  const len = str3.length;
@@ -24070,7 +24175,7 @@ ${end.comment}` : end.comment;
24070
24175
  })();
24071
24176
  validate21.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
24072
24177
  schema39 = { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["identity", "members"] } };
24073
- schema37 = { "enum": ["collection.read", "records.create", "records.edit", "records.delete", "views.manage", "definitions.manage", "background.schedule", "offline.replica"] };
24178
+ schema37 = { "enum": ["collection.read", "records.create", "records.edit", "records.delete", "views.manage", "definitions.manage", "background.schedule", "offline.replica", "history.read"] };
24074
24179
  func0 = (function equal2(a, b) {
24075
24180
  if (a === b)
24076
24181
  return true;
@@ -24148,15 +24253,6 @@ ${end.comment}` : end.comment;
24148
24253
  }
24149
24254
  });
24150
24255
 
24151
- // node_modules/@mdbase-dev/connect-protocol/dist/collection-setup.js
24152
- var RECORD_EXTENSIONS_CONFIGURATION_PATH, YAML_DOCUMENT_RECORDS_CAPABILITY;
24153
- var init_collection_setup = __esm({
24154
- "node_modules/@mdbase-dev/connect-protocol/dist/collection-setup.js"() {
24155
- RECORD_EXTENSIONS_CONFIGURATION_PATH = "/settings/record_extensions";
24156
- YAML_DOCUMENT_RECORDS_CAPABILITY = "yaml-document-records-v1";
24157
- }
24158
- });
24159
-
24160
24256
  // node_modules/@mdbase-dev/connect-protocol/dist/capabilities.js
24161
24257
  function capabilityOperationsForContractVersion(contractVersion, capability) {
24162
24258
  const definitions = contractVersion === 1 ? APPLICATION_CAPABILITY_V1_DEFINITIONS : contractVersion === 2 ? APPLICATION_CAPABILITY_DEFINITIONS : void 0;
@@ -24176,7 +24272,8 @@ ${end.comment}` : end.comment;
24176
24272
  "views.manage": ["create_view_source", "update_view_source", "delete_view_source"],
24177
24273
  "definitions.manage": ["create_type", "update_type", "assess_type_pack", "apply_type_pack"],
24178
24274
  "background.schedule": ["list_timers", "put_timer", "cancel_timer", "reconcile_timers"],
24179
- "offline.replica": ["sync"]
24275
+ "offline.replica": ["sync"],
24276
+ "history.read": ["record_history", "record_version"]
24180
24277
  };
24181
24278
  APPLICATION_SETUP_OPERATIONS = [
24182
24279
  "assess_collection_setup",
@@ -24223,11 +24320,26 @@ ${end.comment}` : end.comment;
24223
24320
  }
24224
24321
  });
24225
24322
 
24226
- // node_modules/@mdbase-dev/connect-protocol/dist/records.js
24227
- var MAX_READ_MANY_RESPONSE_BYTES;
24228
- var init_records2 = __esm({
24229
- "node_modules/@mdbase-dev/connect-protocol/dist/records.js"() {
24230
- MAX_READ_MANY_RESPONSE_BYTES = 8 * 1024 * 1024;
24323
+ // node_modules/@mdbase-dev/connect-protocol/dist/files.js
24324
+ function applicationFileRequest(requirement, options = {}) {
24325
+ return {
24326
+ actions: [.../* @__PURE__ */ new Set([
24327
+ ...requirement.required,
24328
+ ...options.includeOptional === false ? [] : requirement.optional ?? []
24329
+ ])],
24330
+ scope: structuredClone(requirement.scope)
24331
+ };
24332
+ }
24333
+ var DEFAULT_FILE_CHUNK_BYTES, MAX_FILE_CHUNK_BYTES, MAX_FILE_FRAME_HEADER_BYTES, FILE_FRAME_PREFIX_BYTES, MAX_FILE_FRAME_BYTES, FILE_FRAME_MAGIC_BYTES, RELAY_FILE_MAGIC_BYTES;
24334
+ var init_files2 = __esm({
24335
+ "node_modules/@mdbase-dev/connect-protocol/dist/files.js"() {
24336
+ DEFAULT_FILE_CHUNK_BYTES = 1024 * 1024;
24337
+ MAX_FILE_CHUNK_BYTES = 4 * 1024 * 1024;
24338
+ MAX_FILE_FRAME_HEADER_BYTES = 16 * 1024;
24339
+ FILE_FRAME_PREFIX_BYTES = 16;
24340
+ MAX_FILE_FRAME_BYTES = FILE_FRAME_PREFIX_BYTES + MAX_FILE_FRAME_HEADER_BYTES + MAX_FILE_CHUNK_BYTES + 16;
24341
+ FILE_FRAME_MAGIC_BYTES = new Uint8Array([77, 68, 66, 70]);
24342
+ RELAY_FILE_MAGIC_BYTES = new Uint8Array([77, 68, 66, 82]);
24231
24343
  }
24232
24344
  });
24233
24345
 
@@ -24315,6 +24427,7 @@ ${end.comment}` : end.comment;
24315
24427
  "manifest_load_failed": { category: "availability", recovery: "retry" },
24316
24428
  "manifest_required": { category: "validation", recovery: "fix_request" },
24317
24429
  "missing_grant_key": { category: "authorization", recovery: "reauthorize" },
24430
+ "mutation_abandoned": { category: "conflict", recovery: "none" },
24318
24431
  "mutation_recovery_expired": { category: "compatibility", recovery: "none" },
24319
24432
  "mutation_request_conflict": { category: "conflict", recovery: "resolve_conflict" },
24320
24433
  "no_pending_mutation": { category: "conflict", recovery: "refresh" },
@@ -24426,30 +24539,23 @@ ${end.comment}` : end.comment;
24426
24539
  }
24427
24540
  });
24428
24541
 
24429
- // node_modules/@mdbase-dev/connect-protocol/dist/files.js
24430
- function applicationFileRequest(requirement, options = {}) {
24542
+ // node_modules/@mdbase-dev/connect-protocol/dist/application-contract.js
24543
+ function normalizeApplicationManifest(value2) {
24544
+ const manifest = structuredClone(value2);
24431
24545
  return {
24432
- actions: [.../* @__PURE__ */ new Set([
24433
- ...requirement.required,
24434
- ...options.includeOptional === false ? [] : requirement.optional ?? []
24435
- ])],
24436
- scope: structuredClone(requirement.scope)
24546
+ ...manifest,
24547
+ requirements: {
24548
+ configuration: [],
24549
+ ...manifest.requirements
24550
+ },
24551
+ provisions: {
24552
+ type_packs: [],
24553
+ configuration: [],
24554
+ ...manifest.provisions
24555
+ },
24556
+ notifications: manifest.notifications ?? { criteria: [] }
24437
24557
  };
24438
24558
  }
24439
- var DEFAULT_FILE_CHUNK_BYTES, MAX_FILE_CHUNK_BYTES, MAX_FILE_FRAME_HEADER_BYTES, FILE_FRAME_PREFIX_BYTES, MAX_FILE_FRAME_BYTES, FILE_FRAME_MAGIC_BYTES, RELAY_FILE_MAGIC_BYTES;
24440
- var init_files2 = __esm({
24441
- "node_modules/@mdbase-dev/connect-protocol/dist/files.js"() {
24442
- DEFAULT_FILE_CHUNK_BYTES = 1024 * 1024;
24443
- MAX_FILE_CHUNK_BYTES = 4 * 1024 * 1024;
24444
- MAX_FILE_FRAME_HEADER_BYTES = 16 * 1024;
24445
- FILE_FRAME_PREFIX_BYTES = 16;
24446
- MAX_FILE_FRAME_BYTES = FILE_FRAME_PREFIX_BYTES + MAX_FILE_FRAME_HEADER_BYTES + MAX_FILE_CHUNK_BYTES + 16;
24447
- FILE_FRAME_MAGIC_BYTES = new Uint8Array([77, 68, 66, 70]);
24448
- RELAY_FILE_MAGIC_BYTES = new Uint8Array([77, 68, 66, 82]);
24449
- }
24450
- });
24451
-
24452
- // node_modules/@mdbase-dev/connect-protocol/dist/application-contract.js
24453
24559
  function semanticContractVersion(requirements2) {
24454
24560
  const version3 = requirements2.capabilities === void 0 ? 1 : requirements2.capabilities?.contract_version;
24455
24561
  if (version3 !== 1 && version3 !== 2)
@@ -24520,6 +24626,23 @@ ${end.comment}` : end.comment;
24520
24626
  }
24521
24627
  });
24522
24628
 
24629
+ // node_modules/@mdbase-dev/connect-protocol/dist/collection-setup.js
24630
+ var RECORD_EXTENSIONS_CONFIGURATION_PATH, YAML_DOCUMENT_RECORDS_CAPABILITY;
24631
+ var init_collection_setup = __esm({
24632
+ "node_modules/@mdbase-dev/connect-protocol/dist/collection-setup.js"() {
24633
+ RECORD_EXTENSIONS_CONFIGURATION_PATH = "/settings/record_extensions";
24634
+ YAML_DOCUMENT_RECORDS_CAPABILITY = "yaml-document-records-v1";
24635
+ }
24636
+ });
24637
+
24638
+ // node_modules/@mdbase-dev/connect-protocol/dist/records.js
24639
+ var MAX_READ_MANY_RESPONSE_BYTES;
24640
+ var init_records2 = __esm({
24641
+ "node_modules/@mdbase-dev/connect-protocol/dist/records.js"() {
24642
+ MAX_READ_MANY_RESPONSE_BYTES = 8 * 1024 * 1024;
24643
+ }
24644
+ });
24645
+
24523
24646
  // node_modules/@mdbase-dev/connect-protocol/dist/operations.js
24524
24647
  function mutationOperationIdentifier(operation, input) {
24525
24648
  const object13 = isObject(input) ? input : {};
@@ -24572,7 +24695,9 @@ ${end.comment}` : end.comment;
24572
24695
  "put_timer",
24573
24696
  "cancel_timer",
24574
24697
  "reconcile_timers",
24575
- "sync"
24698
+ "sync",
24699
+ "record_history",
24700
+ "record_version"
24576
24701
  ];
24577
24702
  FILE_CONTROL_MESSAGE_TYPES = [
24578
24703
  "list_files",
@@ -24612,7 +24737,9 @@ ${end.comment}` : end.comment;
24612
24737
  "put_timer": "always",
24613
24738
  "cancel_timer": "always",
24614
24739
  "reconcile_timers": "always",
24615
- "sync": "sync_action"
24740
+ "sync": "sync_action",
24741
+ "record_history": "never",
24742
+ "record_version": "never"
24616
24743
  };
24617
24744
  MUTATING_FILE_CONTROL_MESSAGE_TYPES = /* @__PURE__ */ new Set([
24618
24745
  "open_file_upload",
@@ -24971,23 +25098,7 @@ ${end.comment}` : end.comment;
24971
25098
  const result2 = validateVersionedAppManifest(value2, options);
24972
25099
  if (!result2.valid)
24973
25100
  throw new AppManifestValidationError(result2.issues);
24974
- return declaredContractVersion(value2) === 1 ? { contractVersion: 1, manifest: normalizeManifest(value2) } : { contractVersion: 2, manifest: normalizeManifest(value2) };
24975
- }
24976
- function normalizeManifest(value2) {
24977
- const manifest = structuredClone(value2);
24978
- return {
24979
- ...manifest,
24980
- requirements: {
24981
- configuration: [],
24982
- ...manifest.requirements
24983
- },
24984
- provisions: {
24985
- type_packs: [],
24986
- configuration: [],
24987
- ...manifest.provisions
24988
- },
24989
- notifications: manifest.notifications ?? { criteria: [] }
24990
- };
25101
+ return declaredContractVersion(value2) === 1 ? { contractVersion: 1, manifest: normalizeApplicationManifest(value2) } : { contractVersion: 2, manifest: normalizeApplicationManifest(value2) };
24991
25102
  }
24992
25103
  function formatManifestValidationIssues(issues) {
24993
25104
  return issues.map((issue3) => `${issue3.path || "/"} ${issue3.message}`).join("; ");
@@ -25453,6 +25564,7 @@ ${end.comment}` : end.comment;
25453
25564
  init_utils();
25454
25565
  init_browser();
25455
25566
  init_manifest_validators_generated();
25567
+ init_application_contract();
25456
25568
  init_collection_setup();
25457
25569
  init_dist2();
25458
25570
  APPLICATION_MANIFEST_MAX_BYTES = 524288;
@@ -50424,12 +50536,12 @@ ${end.comment}` : end.comment;
50424
50536
  // src/application/asset-pins.json
50425
50537
  var asset_pins_default = {
50426
50538
  runtime: {
50427
- sha256: "4920cd466a3d246f38c9b7fb3efe13eb48bde6f1b4c0392c3484b2e34c804c97",
50428
- bytes: 3921681,
50429
- maxBytes: 3921681,
50539
+ sha256: "fa2c6c114536fd2ed822c6513a7ab7d3aa64e46aef7e37076fdbd230560d74ce",
50540
+ bytes: 3979440,
50541
+ maxBytes: 3979440,
50430
50542
  source: {
50431
50543
  repository: "mdbase-dev/mdbase-connect",
50432
- commit: "039c7253e12af2710b9ab8be64f4c037766bf1ef"
50544
+ commit: "e6fcee0b73ad6bd3f6188e07875dc5aef15f6955"
50433
50545
  }
50434
50546
  },
50435
50547
  sqlite: {
@@ -50483,6 +50595,7 @@ ${end.comment}` : end.comment;
50483
50595
  }
50484
50596
 
50485
50597
  // src/application/startup-timing.ts
50598
+ init_performance_mark();
50486
50599
  var PREFIX = "mdbase:startup:";
50487
50600
  var WAITS = /* @__PURE__ */ new Set(["signed_out", "authorizing", "choosing", "needs_approval", "needs_setup", "problem", "unavailable", "closed"]);
50488
50601
  function clock() {
@@ -50528,6 +50641,14 @@ ${end.comment}` : end.comment;
50528
50641
  if (usable || WAITS.has(phase.kind)) this.done = true;
50529
50642
  }
50530
50643
  };
50644
+ function markCollectionOpen(selection, phase, previous) {
50645
+ if (selection.requested.collectionId !== null) {
50646
+ const changed3 = selection.requested.collectionId !== previous?.selection.requested.collectionId;
50647
+ if (changed3) performanceMark("mdbase:open:requested");
50648
+ if (selection.requested.approved && (changed3 || !previous?.selection.requested.approved)) performanceMark("mdbase:open:approved");
50649
+ }
50650
+ if (phase.kind === "ready" && (previous?.phase.kind !== "ready" || previous.phase.connection !== phase.connection)) performanceMark("mdbase:open:ready");
50651
+ }
50531
50652
 
50532
50653
  // src/application/entry.ts
50533
50654
  init_packaged_trust();
@@ -52824,6 +52945,7 @@ ${end.comment}` : end.comment;
52824
52945
  let phase = applicationPhase({ ...base, selection }, { connection, previous: last?.value.phase ?? null, openingUnsynced, startPending: this.selection?.startPending() ?? false, ...this.cpOrigin ? { cpOrigin: this.cpOrigin } : {}, ...this.messages ? { messages: this.messages } : {} });
52825
52946
  phase = this.trackOpening(phase);
52826
52947
  this.timing.observe(phase);
52948
+ markCollectionOpen(selection, phase, last?.value);
52827
52949
  const transport = base.transport ?? null, online = globalThis.navigator?.onLine;
52828
52950
  const status = this.trackSync(phase, transport !== null || online === false);
52829
52951
  const writes = this.syncing?.writes() ?? null;