@mdbase-dev/sdk 0.1.0-beta.231 → 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 (53) hide show
  1. package/dist/application/asset-pins.json +4 -4
  2. package/dist/application/manifest.d.ts +2 -2
  3. package/dist/application/worker-session.d.ts +2 -2
  4. package/dist/application/worker.js +179 -102
  5. package/dist/browser/mdbase-sdk.js +216 -127
  6. package/dist/browser/mdbase-sdk.min.js +52 -52
  7. package/dist/client.d.ts +16 -0
  8. package/dist/client.js +30 -1
  9. package/dist/client.js.map +1 -1
  10. package/dist/collection-api.d.ts +1 -0
  11. package/dist/collection-api.js.map +1 -1
  12. package/dist/describe-error.d.ts +1 -1
  13. package/dist/describe-error.js +2 -1
  14. package/dist/describe-error.js.map +1 -1
  15. package/dist/history.d.ts +66 -0
  16. package/dist/history.js +55 -0
  17. package/dist/history.js.map +1 -0
  18. package/dist/native/provenance.json +5 -5
  19. package/dist/native/runtime.wasm +0 -0
  20. package/dist/private.js +3 -2
  21. package/dist/private.js.map +1 -1
  22. package/dist/session.js +1 -1
  23. package/dist/session.js.map +1 -1
  24. package/node_modules/@mdbase-dev/connect-protocol/LICENSE +21 -0
  25. package/node_modules/@mdbase-dev/connect-protocol/dist/application-contract.d.ts +28 -0
  26. package/node_modules/@mdbase-dev/connect-protocol/dist/application-contract.js +21 -0
  27. package/node_modules/@mdbase-dev/connect-protocol/dist/application-declaration.d.ts +1 -1
  28. package/node_modules/@mdbase-dev/connect-protocol/dist/capabilities.d.ts +1 -0
  29. package/node_modules/@mdbase-dev/connect-protocol/dist/capabilities.js +2 -1
  30. package/node_modules/@mdbase-dev/connect-protocol/dist/connect-problems.generated.d.ts +14 -0
  31. package/node_modules/@mdbase-dev/connect-protocol/dist/connect-problems.generated.js +16 -0
  32. package/node_modules/@mdbase-dev/connect-protocol/dist/index.d.ts +2 -1
  33. package/node_modules/@mdbase-dev/connect-protocol/dist/index.js +2 -1
  34. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest-validators.generated.js +4 -4
  35. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest.d.ts +5 -0
  36. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest.js +19 -19
  37. package/node_modules/@mdbase-dev/connect-protocol/dist/operations.d.ts +1 -1
  38. package/node_modules/@mdbase-dev/connect-protocol/dist/operations.js +9 -3
  39. package/node_modules/@mdbase-dev/connect-protocol/dist/service-urls.d.ts +11 -0
  40. package/node_modules/@mdbase-dev/connect-protocol/dist/service-urls.js +51 -0
  41. package/node_modules/@mdbase-dev/connect-protocol/package.json +7 -7
  42. package/node_modules/@mdbase-dev/connect-protocol/schemas/application-capability-catalog.v2.json +4 -0
  43. package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-problem.v1.schema.json +57 -0
  44. package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-problems.v1.catalog.json +11 -0
  45. package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-protocol.v1.schema.json +1 -1
  46. package/node_modules/@mdbase-dev/connect-protocol/schemas/mdbase-app.schema.json +2 -1
  47. package/node_modules/@mdbase-dev/connect-protocol/schemas/operation-catalog.v1.json +3 -1
  48. package/node_modules/@mdbase-dev/connect-protocol/schemas/operation-mutation-classification.v1.json +28 -0
  49. package/package.json +2 -2
  50. package/vendor/mdbase-connect-sdk-3d3f95b80c9a.json +13 -0
  51. package/vendor/mdbase-dev-connect-protocol-0.1.0-beta.152-3d3f95b80c9a.tgz +0 -0
  52. package/vendor/mdbase-connect-sdk-e6e66bcd172f.json +0 -13
  53. package/vendor/mdbase-dev-connect-protocol-0.1.0-beta.145-e6e66bcd172f.tgz +0 -0
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "runtime": {
3
- "sha256": "8d01624313252ae512f35ab9ee2f865a9d53699826c1f731280b2dd7f39a93ca",
4
- "bytes": 3926059,
5
- "maxBytes": 3926059,
3
+ "sha256": "fa2c6c114536fd2ed822c6513a7ab7d3aa64e46aef7e37076fdbd230560d74ce",
4
+ "bytes": 3979440,
5
+ "maxBytes": 3979440,
6
6
  "source": {
7
7
  "repository": "mdbase-dev/mdbase-connect",
8
- "commit": "7439dbd48279f5f64d89fbde9c4326a814c1259a"
8
+ "commit": "e6fcee0b73ad6bd3f6188e07875dc5aef15f6955"
9
9
  }
10
10
  },
11
11
  "sqlite": {
@@ -6,12 +6,12 @@ export declare function compileApplicationManifest(declaration: Readonly<Applica
6
6
  contracts: Readonly<import("@mdbase-dev/connect-protocol").ConnectContractRequirements>;
7
7
  nativeCapabilities: Readonly<{
8
8
  capabilityContractVersion: 2;
9
- requiredNativeCapabilities: readonly ("collection.read" | "records.create" | "records.edit" | "records.delete" | "views.manage" | "definitions.manage" | "background.schedule" | "offline.replica")[];
9
+ requiredNativeCapabilities: readonly ("collection.read" | "records.create" | "records.edit" | "records.delete" | "views.manage" | "definitions.manage" | "background.schedule" | "offline.replica" | "history.read")[];
10
10
  }> | null;
11
11
  privateDeviceDeclared: boolean;
12
12
  files?: Readonly<import("@mdbase-dev/connect-protocol").ApplicationFileRequest> | undefined;
13
13
  contractVersion: 2 | 1;
14
14
  manifest: Readonly<import("@mdbase-dev/connect-protocol/manifest").ValidatedLegacyAppManifest | import("@mdbase-dev/connect-protocol/manifest").ValidatedAppManifest>;
15
15
  semanticVersion: 2 | 1;
16
- operations: readonly ("create" | "update" | "delete" | "rename" | "changes" | "query" | "read" | "describe" | "validate" | "list_views" | "execute_view" | "read_view_source" | "create_view_source" | "update_view_source" | "delete_view_source" | "read_type" | "create_type" | "update_type" | "assess_type_pack" | "apply_type_pack" | "assess_collection_setup" | "apply_collection_setup" | "list_timers" | "put_timer" | "cancel_timer" | "reconcile_timers" | "sync")[];
16
+ operations: readonly ("create" | "update" | "delete" | "rename" | "changes" | "query" | "read" | "describe" | "validate" | "record_history" | "record_version" | "list_views" | "execute_view" | "read_view_source" | "create_view_source" | "update_view_source" | "delete_view_source" | "read_type" | "create_type" | "update_type" | "assess_type_pack" | "apply_type_pack" | "assess_collection_setup" | "apply_collection_setup" | "list_timers" | "put_timer" | "cancel_timer" | "reconcile_timers" | "sync")[];
17
17
  }>;
@@ -24,14 +24,14 @@ export declare function applicationWorkerSession(declaration: Readonly<Applicati
24
24
  contracts: Readonly<import("@mdbase-dev/connect-protocol").ConnectContractRequirements>;
25
25
  nativeCapabilities: Readonly<{
26
26
  capabilityContractVersion: 2;
27
- requiredNativeCapabilities: readonly ("collection.read" | "records.create" | "records.edit" | "records.delete" | "views.manage" | "definitions.manage" | "background.schedule" | "offline.replica")[];
27
+ requiredNativeCapabilities: readonly ("collection.read" | "records.create" | "records.edit" | "records.delete" | "views.manage" | "definitions.manage" | "background.schedule" | "offline.replica" | "history.read")[];
28
28
  }> | null;
29
29
  privateDeviceDeclared: boolean;
30
30
  files?: Readonly<import("@mdbase-dev/connect-protocol").ApplicationFileRequest> | undefined;
31
31
  contractVersion: 2 | 1;
32
32
  manifest: Readonly<import("@mdbase-dev/connect-protocol/manifest").ValidatedLegacyAppManifest | import("@mdbase-dev/connect-protocol/manifest").ValidatedAppManifest>;
33
33
  semanticVersion: 2 | 1;
34
- operations: readonly ("create" | "update" | "delete" | "rename" | "changes" | "query" | "read" | "describe" | "validate" | "list_views" | "execute_view" | "read_view_source" | "create_view_source" | "update_view_source" | "delete_view_source" | "read_type" | "create_type" | "update_type" | "assess_type_pack" | "apply_type_pack" | "assess_collection_setup" | "apply_collection_setup" | "list_timers" | "put_timer" | "cancel_timer" | "reconcile_timers" | "sync")[];
34
+ operations: readonly ("create" | "update" | "delete" | "rename" | "changes" | "query" | "read" | "describe" | "validate" | "record_history" | "record_version" | "list_views" | "execute_view" | "read_view_source" | "create_view_source" | "update_view_source" | "delete_view_source" | "read_type" | "create_type" | "update_type" | "assess_type_pack" | "apply_type_pack" | "assess_collection_setup" | "apply_collection_setup" | "list_timers" | "put_timer" | "cancel_timer" | "reconcile_timers" | "sync")[];
35
35
  }>;
36
36
  collection: Readonly<{
37
37
  people: true;
@@ -7035,7 +7035,7 @@ function parseDocument(source, options = {}) {
7035
7035
 
7036
7036
  // node_modules/@mdbase-dev/connect-protocol/dist/manifest-validators.generated.js
7037
7037
  var appManifestValidator = validate20;
7038
- var 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://" } } }] } } };
7038
+ var 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://" } } }] } } };
7039
7039
  var func1 = Object.prototype.hasOwnProperty;
7040
7040
  var func2 = (function ucs2length(str2) {
7041
7041
  const len = str2.length;
@@ -7271,7 +7271,7 @@ function validate21(data, { instancePath = "", parentData, parentDataProperty, r
7271
7271
  }
7272
7272
  validate21.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
7273
7273
  var schema39 = { "type": "array", "minItems": 1, "uniqueItems": true, "items": { "enum": ["identity", "members"] } };
7274
- var schema37 = { "enum": ["collection.read", "records.create", "records.edit", "records.delete", "views.manage", "definitions.manage", "background.schedule", "offline.replica"] };
7274
+ var schema37 = { "enum": ["collection.read", "records.create", "records.edit", "records.delete", "views.manage", "definitions.manage", "background.schedule", "offline.replica", "history.read"] };
7275
7275
  var func0 = (function equal(a, b) {
7276
7276
  if (a === b)
7277
7277
  return true;
@@ -7376,7 +7376,7 @@ function validate26(data, { instancePath = "", parentData, parentDataProperty, r
7376
7376
  const len0 = data1.length;
7377
7377
  for (let i0 = 0; i0 < len0; i0++) {
7378
7378
  let data2 = data1[i0];
7379
- 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")) {
7379
+ 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")) {
7380
7380
  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" };
7381
7381
  if (vErrors === null) {
7382
7382
  vErrors = [err5];
@@ -7429,7 +7429,7 @@ function validate26(data, { instancePath = "", parentData, parentDataProperty, r
7429
7429
  const len1 = data3.length;
7430
7430
  for (let i2 = 0; i2 < len1; i2++) {
7431
7431
  let data4 = data3[i2];
7432
- 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")) {
7432
+ 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")) {
7433
7433
  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" };
7434
7434
  if (vErrors === null) {
7435
7435
  vErrors = [err9];
@@ -14381,10 +14381,6 @@ function validate47(data, { instancePath = "", parentData, parentDataProperty, r
14381
14381
  }
14382
14382
  validate47.evaluated = { "props": true, "dynamicProps": false, "dynamicItems": false };
14383
14383
 
14384
- // node_modules/@mdbase-dev/connect-protocol/dist/collection-setup.js
14385
- var RECORD_EXTENSIONS_CONFIGURATION_PATH = "/settings/record_extensions";
14386
- var YAML_DOCUMENT_RECORDS_CAPABILITY = "yaml-document-records-v1";
14387
-
14388
14384
  // node_modules/@mdbase-dev/connect-protocol/dist/capabilities.js
14389
14385
  var APPLICATION_CAPABILITY_CONTRACT_VERSION = 2;
14390
14386
  var APPLICATION_CAPABILITY_DEFINITIONS = {
@@ -14395,7 +14391,8 @@ var APPLICATION_CAPABILITY_DEFINITIONS = {
14395
14391
  "views.manage": ["create_view_source", "update_view_source", "delete_view_source"],
14396
14392
  "definitions.manage": ["create_type", "update_type", "assess_type_pack", "apply_type_pack"],
14397
14393
  "background.schedule": ["list_timers", "put_timer", "cancel_timer", "reconcile_timers"],
14398
- "offline.replica": ["sync"]
14394
+ "offline.replica": ["sync"],
14395
+ "history.read": ["record_history", "record_version"]
14399
14396
  };
14400
14397
  var APPLICATION_SETUP_OPERATIONS = [
14401
14398
  "assess_collection_setup",
@@ -14446,6 +14443,24 @@ function capabilityOperationsForContractVersion(contractVersion, capability) {
14446
14443
  var FRESH_APPLICATION_AUTHORIZATION_VERSIONS = Object.freeze([1, 2]);
14447
14444
  var FRESH_APPLICATION_AUTHORIZATION_CAPABILITIES = Object.freeze(["application-authorization-v2-issuance"]);
14448
14445
 
14446
+ // node_modules/@mdbase-dev/connect-protocol/dist/files.js
14447
+ var DEFAULT_FILE_CHUNK_BYTES = 1024 * 1024;
14448
+ var MAX_FILE_CHUNK_BYTES = 4 * 1024 * 1024;
14449
+ var MAX_FILE_FRAME_HEADER_BYTES = 16 * 1024;
14450
+ var FILE_FRAME_PREFIX_BYTES = 16;
14451
+ var MAX_FILE_FRAME_BYTES = FILE_FRAME_PREFIX_BYTES + MAX_FILE_FRAME_HEADER_BYTES + MAX_FILE_CHUNK_BYTES + 16;
14452
+ var FILE_FRAME_MAGIC_BYTES = new Uint8Array([77, 68, 66, 70]);
14453
+ var RELAY_FILE_MAGIC_BYTES = new Uint8Array([77, 68, 66, 82]);
14454
+ function applicationFileRequest(requirement, options = {}) {
14455
+ return {
14456
+ actions: [.../* @__PURE__ */ new Set([
14457
+ ...requirement.required,
14458
+ ...options.includeOptional === false ? [] : requirement.optional ?? []
14459
+ ])],
14460
+ scope: structuredClone(requirement.scope)
14461
+ };
14462
+ }
14463
+
14449
14464
  // node_modules/@mdbase-dev/connect-protocol/dist/connect-problems.generated.js
14450
14465
  var CONNECT_PROBLEM_VERSION = 1;
14451
14466
  var CONNECT_PROBLEM_CATALOG = {
@@ -14527,6 +14542,7 @@ var CONNECT_PROBLEM_CATALOG = {
14527
14542
  "manifest_load_failed": { category: "availability", recovery: "retry" },
14528
14543
  "manifest_required": { category: "validation", recovery: "fix_request" },
14529
14544
  "missing_grant_key": { category: "authorization", recovery: "reauthorize" },
14545
+ "mutation_abandoned": { category: "conflict", recovery: "none" },
14530
14546
  "mutation_recovery_expired": { category: "compatibility", recovery: "none" },
14531
14547
  "mutation_request_conflict": { category: "conflict", recovery: "resolve_conflict" },
14532
14548
  "no_pending_mutation": { category: "conflict", recovery: "refresh" },
@@ -14630,26 +14646,24 @@ function connectError(code, message2, ...args) {
14630
14646
  });
14631
14647
  }
14632
14648
 
14633
- // node_modules/@mdbase-dev/connect-protocol/dist/files.js
14634
- var DEFAULT_FILE_CHUNK_BYTES = 1024 * 1024;
14635
- var MAX_FILE_CHUNK_BYTES = 4 * 1024 * 1024;
14636
- var MAX_FILE_FRAME_HEADER_BYTES = 16 * 1024;
14637
- var FILE_FRAME_PREFIX_BYTES = 16;
14638
- var MAX_FILE_FRAME_BYTES = FILE_FRAME_PREFIX_BYTES + MAX_FILE_FRAME_HEADER_BYTES + MAX_FILE_CHUNK_BYTES + 16;
14639
- var FILE_FRAME_MAGIC_BYTES = new Uint8Array([77, 68, 66, 70]);
14640
- var RELAY_FILE_MAGIC_BYTES = new Uint8Array([77, 68, 66, 82]);
14641
- function applicationFileRequest(requirement, options = {}) {
14649
+ // node_modules/@mdbase-dev/connect-protocol/dist/application-contract.js
14650
+ var DEFAULT_OPERATIONS = ["describe", "changes", "read", "query"];
14651
+ function normalizeApplicationManifest(value2) {
14652
+ const manifest = structuredClone(value2);
14642
14653
  return {
14643
- actions: [.../* @__PURE__ */ new Set([
14644
- ...requirement.required,
14645
- ...options.includeOptional === false ? [] : requirement.optional ?? []
14646
- ])],
14647
- scope: structuredClone(requirement.scope)
14654
+ ...manifest,
14655
+ requirements: {
14656
+ configuration: [],
14657
+ ...manifest.requirements
14658
+ },
14659
+ provisions: {
14660
+ type_packs: [],
14661
+ configuration: [],
14662
+ ...manifest.provisions
14663
+ },
14664
+ notifications: manifest.notifications ?? { criteria: [] }
14648
14665
  };
14649
14666
  }
14650
-
14651
- // node_modules/@mdbase-dev/connect-protocol/dist/application-contract.js
14652
- var DEFAULT_OPERATIONS = ["describe", "changes", "read", "query"];
14653
14667
  function semanticContractVersion(requirements) {
14654
14668
  const version3 = requirements.capabilities === void 0 ? 1 : requirements.capabilities?.contract_version;
14655
14669
  if (version3 !== 1 && version3 !== 2)
@@ -14711,6 +14725,10 @@ function authorizationFiles(requirements) {
14711
14725
  return applicationFileRequest(files);
14712
14726
  }
14713
14727
 
14728
+ // node_modules/@mdbase-dev/connect-protocol/dist/collection-setup.js
14729
+ var RECORD_EXTENSIONS_CONFIGURATION_PATH = "/settings/record_extensions";
14730
+ var YAML_DOCUMENT_RECORDS_CAPABILITY = "yaml-document-records-v1";
14731
+
14714
14732
  // node_modules/@mdbase-dev/connect-protocol/dist/operations.js
14715
14733
  var COLLECTION_OPERATIONS = [
14716
14734
  "describe",
@@ -14739,7 +14757,9 @@ var COLLECTION_OPERATIONS = [
14739
14757
  "put_timer",
14740
14758
  "cancel_timer",
14741
14759
  "reconcile_timers",
14742
- "sync"
14760
+ "sync",
14761
+ "record_history",
14762
+ "record_version"
14743
14763
  ];
14744
14764
  var FILE_CONTROL_MESSAGE_TYPES = [
14745
14765
  "list_files",
@@ -14779,7 +14799,9 @@ var COLLECTION_MUTATION_RULES = {
14779
14799
  "put_timer": "always",
14780
14800
  "cancel_timer": "always",
14781
14801
  "reconcile_timers": "always",
14782
- "sync": "sync_action"
14802
+ "sync": "sync_action",
14803
+ "record_history": "never",
14804
+ "record_version": "never"
14783
14805
  };
14784
14806
  var MUTATING_FILE_CONTROL_MESSAGE_TYPES = /* @__PURE__ */ new Set([
14785
14807
  "open_file_upload",
@@ -14937,23 +14959,7 @@ function parseVersionedAppManifest(value2, options = {}) {
14937
14959
  const result2 = validateVersionedAppManifest(value2, options);
14938
14960
  if (!result2.valid)
14939
14961
  throw new AppManifestValidationError(result2.issues);
14940
- return declaredContractVersion(value2) === 1 ? { contractVersion: 1, manifest: normalizeManifest(value2) } : { contractVersion: 2, manifest: normalizeManifest(value2) };
14941
- }
14942
- function normalizeManifest(value2) {
14943
- const manifest = structuredClone(value2);
14944
- return {
14945
- ...manifest,
14946
- requirements: {
14947
- configuration: [],
14948
- ...manifest.requirements
14949
- },
14950
- provisions: {
14951
- type_packs: [],
14952
- configuration: [],
14953
- ...manifest.provisions
14954
- },
14955
- notifications: manifest.notifications ?? { criteria: [] }
14956
- };
14962
+ return declaredContractVersion(value2) === 1 ? { contractVersion: 1, manifest: normalizeApplicationManifest(value2) } : { contractVersion: 2, manifest: normalizeApplicationManifest(value2) };
14957
14963
  }
14958
14964
  function formatManifestValidationIssues(issues) {
14959
14965
  return issues.map((issue3) => `${issue3.path || "/"} ${issue3.message}`).join("; ");
@@ -15687,12 +15693,12 @@ function appReleaseTrust() {
15687
15693
  // src/application/asset-pins.json
15688
15694
  var asset_pins_default = {
15689
15695
  runtime: {
15690
- sha256: "8d01624313252ae512f35ab9ee2f865a9d53699826c1f731280b2dd7f39a93ca",
15691
- bytes: 3926059,
15692
- maxBytes: 3926059,
15696
+ sha256: "fa2c6c114536fd2ed822c6513a7ab7d3aa64e46aef7e37076fdbd230560d74ce",
15697
+ bytes: 3979440,
15698
+ maxBytes: 3979440,
15693
15699
  source: {
15694
15700
  repository: "mdbase-dev/mdbase-connect",
15695
- commit: "7439dbd48279f5f64d89fbde9c4326a814c1259a"
15701
+ commit: "e6fcee0b73ad6bd3f6188e07875dc5aef15f6955"
15696
15702
  }
15697
15703
  },
15698
15704
  sqlite: {
@@ -21501,7 +21507,7 @@ function inheritOriginalAppGrant(port, session) {
21501
21507
  }
21502
21508
 
21503
21509
  // src/session.ts
21504
- var API_VERSIONS = [{ major: 1, minor: 3 }, { major: 1, minor: 2 }, { major: 1, minor: 1 }, { major: 1, minor: 0 }];
21510
+ var API_VERSIONS = [{ major: 1, minor: 4 }, { major: 1, minor: 3 }, { major: 1, minor: 2 }, { major: 1, minor: 1 }, { major: 1, minor: 0 }];
21505
21511
  function schemaToError(e, what) {
21506
21512
  if (isMdbaseError(e)) return e;
21507
21513
  if (e instanceof SchemaError && e.unknown) {
@@ -22255,6 +22261,95 @@ var FilesApi = class {
22255
22261
  }
22256
22262
  };
22257
22263
 
22264
+ // src/private.ts
22265
+ var DEVICE_KINDS = ["desktop", "mobile", "app_runtime", "cli", "hosted", "escrow", "recovery"];
22266
+ var kinds = enumOf("device-kind", DEVICE_KINDS);
22267
+ var deviceKind = {
22268
+ name: "device-kind",
22269
+ enc: (v) => kinds.enc(v),
22270
+ dec: (c) => {
22271
+ try {
22272
+ return kinds.dec(c);
22273
+ } catch {
22274
+ return "unknown";
22275
+ }
22276
+ }
22277
+ };
22278
+ var pendingDeviceShape = struct("pending-device", [
22279
+ [0, "device", uuid2],
22280
+ [1, "account", uuid2],
22281
+ [2, "kind", deviceKind],
22282
+ [3, "sas", tstr, "opt"],
22283
+ // Host response only; omitted from client encodings.
22284
+ [4, "exchangeReady", bool]
22285
+ ]);
22286
+ var pendingDevice = {
22287
+ ...pendingDeviceShape,
22288
+ enc: (v) => pendingDeviceShape.enc({ ...v, sas: void 0 })
22289
+ };
22290
+ var approvalReadinessShape = struct("approval-readiness", [
22291
+ [0, "device", uuid2],
22292
+ [1, "sas", tstr, "opt"],
22293
+ // Reserved: decode-only.
22294
+ [2, "exchangeReady", bool]
22295
+ ]);
22296
+ var approvalReadiness = {
22297
+ ...approvalReadinessShape,
22298
+ enc: (v) => approvalReadinessShape.enc({ ...v, sas: void 0 })
22299
+ };
22300
+ var recoveryKeyStatus = struct("recovery-key-status", [
22301
+ [0, "configured", bool],
22302
+ [1, "device", uuid2, "opt"]
22303
+ ]);
22304
+ var recoveryKeyCreated = struct("recovery-key-created", [
22305
+ [0, "phrase", tstr],
22306
+ [1, "device", uuid2]
22307
+ ]);
22308
+ var ACCOUNT_KEY_STATES = ["idle", "reading_ahead", "pending_grant", "keyed", "refused"];
22309
+ var accountKeyState = enumOf("account-key-state", ACCOUNT_KEY_STATES);
22310
+ var accountKeyStatus = struct("account-key-status", [
22311
+ [0, "state", accountKeyState],
22312
+ [1, "problem", problem, "opt"]
22313
+ ]);
22314
+
22315
+ // src/history.ts
22316
+ var recordHistoryParams = struct("record-history-params", [
22317
+ [0, "record", uuid2],
22318
+ [1, "before", uint, "opt"],
22319
+ [2, "limit", uint, "opt"]
22320
+ ]);
22321
+ var recordVersionParams = struct("record-version-params", [
22322
+ [0, "record", uuid2],
22323
+ [1, "seq", uint]
22324
+ ]);
22325
+ var authorRef2 = struct("author-ref", [
22326
+ [0, "account", uuid2],
22327
+ [1, "device", uuid2],
22328
+ [2, "grant", uuid2, "opt"],
22329
+ [3, "grantAccount", uuid2, "opt"]
22330
+ ]);
22331
+ var historyVersion = struct("history-version", [
22332
+ [0, "seq", uint],
22333
+ [1, "time", int3],
22334
+ [2, "author", authorRef2],
22335
+ [3, "kind", enumOf("version-kind", ["created", "edited", "moved", "deleted"])],
22336
+ [4, "path", tstr],
22337
+ [5, "revision", hash, "opt"],
22338
+ [6, "source", enumOf("source", ["api", "external"])],
22339
+ [7, "deviceKind", deviceKind],
22340
+ [8, "app", tstr, "opt"]
22341
+ ]);
22342
+ var recordHistory = struct("record-history", [
22343
+ [0, "versions", list(historyVersion)],
22344
+ [1, "from", uint],
22345
+ [2, "fromTime", int3, "opt"],
22346
+ [3, "next", uint, "opt"]
22347
+ ]);
22348
+ var recordVersion = struct("record-version", [
22349
+ [0, "path", tstr],
22350
+ [1, "document", tstr]
22351
+ ]);
22352
+
22258
22353
  // src/settle.ts
22259
22354
  var DEFAULT_WAIT_MS = 3e3;
22260
22355
  var cancelled = (e) => isMdbaseError(e, "cancelled");
@@ -24221,57 +24316,6 @@ async function applyTypePack(client, plan, o = {}) {
24221
24316
  return { outcome: receipt3.state === "confirmed" ? "applied" : "pending", receipt: applied.desired, write };
24222
24317
  }
24223
24318
 
24224
- // src/private.ts
24225
- var DEVICE_KINDS = ["desktop", "mobile", "app_runtime", "cli", "hosted", "escrow", "recovery"];
24226
- var kinds = enumOf("device-kind", DEVICE_KINDS);
24227
- var deviceKind = {
24228
- name: "device-kind",
24229
- enc: (v) => kinds.enc(v),
24230
- dec: (c) => {
24231
- try {
24232
- return kinds.dec(c);
24233
- } catch {
24234
- return "unknown";
24235
- }
24236
- }
24237
- };
24238
- var pendingDeviceShape = struct("pending-device", [
24239
- [0, "device", uuid2],
24240
- [1, "account", uuid2],
24241
- [2, "kind", deviceKind],
24242
- [3, "sas", tstr, "opt"],
24243
- // Host response only; omitted from client encodings.
24244
- [4, "exchangeReady", bool]
24245
- ]);
24246
- var pendingDevice = {
24247
- ...pendingDeviceShape,
24248
- enc: (v) => pendingDeviceShape.enc({ ...v, sas: void 0 })
24249
- };
24250
- var approvalReadinessShape = struct("approval-readiness", [
24251
- [0, "device", uuid2],
24252
- [1, "sas", tstr, "opt"],
24253
- // Reserved: decode-only.
24254
- [2, "exchangeReady", bool]
24255
- ]);
24256
- var approvalReadiness = {
24257
- ...approvalReadinessShape,
24258
- enc: (v) => approvalReadinessShape.enc({ ...v, sas: void 0 })
24259
- };
24260
- var recoveryKeyStatus = struct("recovery-key-status", [
24261
- [0, "configured", bool],
24262
- [1, "device", uuid2, "opt"]
24263
- ]);
24264
- var recoveryKeyCreated = struct("recovery-key-created", [
24265
- [0, "phrase", tstr],
24266
- [1, "device", uuid2]
24267
- ]);
24268
- var ACCOUNT_KEY_STATES = ["idle", "reading_ahead", "pending_grant", "keyed", "refused"];
24269
- var accountKeyState = enumOf("account-key-state", ACCOUNT_KEY_STATES);
24270
- var accountKeyStatus = struct("account-key-status", [
24271
- [0, "state", accountKeyState],
24272
- [1, "problem", problem, "opt"]
24273
- ]);
24274
-
24275
24319
  // src/write-ledger.ts
24276
24320
  function memoryWriteLedgerStore() {
24277
24321
  const rows2 = /* @__PURE__ */ new Map();
@@ -24455,6 +24499,14 @@ function params(entries) {
24455
24499
  for (const [k, v] of entries) if (v !== void 0) m2.set(k, v);
24456
24500
  return m2;
24457
24501
  }
24502
+ function historyRead(read) {
24503
+ return read.catch((e) => {
24504
+ if (isMdbaseError(e, "invalid_request") && e.reason === "unknown_method") {
24505
+ throw mdbaseError("upgrade_required", "This collection's replica has no record history.", "history_unsupported");
24506
+ }
24507
+ throw e;
24508
+ });
24509
+ }
24458
24510
  function withCurrentGrant(hello, grant) {
24459
24511
  const prior = hello.grant;
24460
24512
  if (!grant || prior.grant === grant.grant && prior.role === grant.role && valueEquals(prior.capabilities, grant.capabilities) && valueEquals(prior.fileFolders ?? null, grant.fileFolders ?? null)) return hello;
@@ -24667,7 +24719,9 @@ var READ_METHODS = /* @__PURE__ */ new Set([
24667
24719
  "new_type_file",
24668
24720
  "get_contract_v1",
24669
24721
  "map_contract_write_v1",
24670
- "plan_type_pack_v1"
24722
+ "plan_type_pack_v1",
24723
+ "record_history",
24724
+ "record_version"
24671
24725
  ]);
24672
24726
  var MdbaseClient = class _MdbaseClient {
24673
24727
  constructor(opts, session) {
@@ -25479,6 +25533,29 @@ var MdbaseClient = class _MdbaseClient {
25479
25533
  throw e;
25480
25534
  });
25481
25535
  }
25536
+ /**
25537
+ * Record history (§4.4, API 1.4): the versions of a record that the log still
25538
+ * retains. Needs `collection.read` and `history.read` through a grant without
25539
+ * a folder scope. A replica without history,
25540
+ * the hosted replica and a local-only collection refuse with
25541
+ * `upgrade_required` / `history_unsupported`.
25542
+ */
25543
+ history = {
25544
+ /** One page of a record's versions, newest first. Pass `next` as `before`
25545
+ * for older ones. `o.signal` cancels the read. */
25546
+ list: (record3, o = {}) => historyRead(this.call("record_history", recordHistoryParams.enc({ record: record3, before: o.before, limit: o.limit }), {
25547
+ codec: recordHistory,
25548
+ retry: true,
25549
+ ...o.signal ? { signal: o.signal } : {}
25550
+ })),
25551
+ /** The exact document of the version at log position `seq`, checked
25552
+ * against its revision. `o.signal` cancels the read. */
25553
+ version: (record3, seq2, o = {}) => historyRead(this.call("record_version", recordVersionParams.enc({ record: record3, seq: seq2 }), {
25554
+ codec: recordVersion,
25555
+ retry: true,
25556
+ ...o.signal ? { signal: o.signal } : {}
25557
+ }))
25558
+ };
25482
25559
  /** Definitions: `mdbase.yaml`, type files, contract files (§4.1). */
25483
25560
  resources = {
25484
25561
  /** One definition by path. `o.signal` cancels the read. */