@mdbase-dev/sdk 0.1.0-beta.231 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/dist/app-host/bases-wire.d.ts +18 -2
  2. package/dist/app-host/bases-wire.js +13 -4
  3. package/dist/app-host/bases-wire.js.map +1 -1
  4. package/dist/app-host/index.d.ts +1 -1
  5. package/dist/application/asset-pins.json +4 -4
  6. package/dist/application/manifest.d.ts +2 -2
  7. package/dist/application/worker-session.d.ts +2 -2
  8. package/dist/application/worker.js +200 -109
  9. package/dist/browser/mdbase-sdk.js +238 -135
  10. package/dist/browser/mdbase-sdk.min.js +58 -58
  11. package/dist/client.d.ts +20 -0
  12. package/dist/client.js +41 -4
  13. package/dist/client.js.map +1 -1
  14. package/dist/collection-api.d.ts +1 -0
  15. package/dist/collection-api.js.map +1 -1
  16. package/dist/describe-error.d.ts +1 -1
  17. package/dist/describe-error.js +2 -1
  18. package/dist/describe-error.js.map +1 -1
  19. package/dist/history.d.ts +66 -0
  20. package/dist/history.js +55 -0
  21. package/dist/history.js.map +1 -0
  22. package/dist/native/provenance.json +5 -5
  23. package/dist/native/runtime.wasm +0 -0
  24. package/dist/private.js +3 -2
  25. package/dist/private.js.map +1 -1
  26. package/dist/session.js +1 -1
  27. package/dist/session.js.map +1 -1
  28. package/dist/testing/memory-replica.js +6 -2
  29. package/dist/testing/memory-replica.js.map +1 -1
  30. package/node_modules/@mdbase-dev/connect-protocol/LICENSE +21 -0
  31. package/node_modules/@mdbase-dev/connect-protocol/dist/application-contract.d.ts +28 -0
  32. package/node_modules/@mdbase-dev/connect-protocol/dist/application-contract.js +21 -0
  33. package/node_modules/@mdbase-dev/connect-protocol/dist/application-declaration.d.ts +1 -1
  34. package/node_modules/@mdbase-dev/connect-protocol/dist/capabilities.d.ts +1 -0
  35. package/node_modules/@mdbase-dev/connect-protocol/dist/capabilities.js +2 -1
  36. package/node_modules/@mdbase-dev/connect-protocol/dist/connect-problems.generated.d.ts +14 -0
  37. package/node_modules/@mdbase-dev/connect-protocol/dist/connect-problems.generated.js +16 -0
  38. package/node_modules/@mdbase-dev/connect-protocol/dist/index.d.ts +2 -1
  39. package/node_modules/@mdbase-dev/connect-protocol/dist/index.js +2 -1
  40. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest-validators.generated.js +4 -4
  41. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest.d.ts +5 -0
  42. package/node_modules/@mdbase-dev/connect-protocol/dist/manifest.js +19 -19
  43. package/node_modules/@mdbase-dev/connect-protocol/dist/operations.d.ts +1 -1
  44. package/node_modules/@mdbase-dev/connect-protocol/dist/operations.js +9 -3
  45. package/node_modules/@mdbase-dev/connect-protocol/dist/service-urls.d.ts +11 -0
  46. package/node_modules/@mdbase-dev/connect-protocol/dist/service-urls.js +51 -0
  47. package/node_modules/@mdbase-dev/connect-protocol/package.json +7 -7
  48. package/node_modules/@mdbase-dev/connect-protocol/schemas/application-capability-catalog.v2.json +4 -0
  49. package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-problem.v1.schema.json +57 -0
  50. package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-problems.v1.catalog.json +11 -0
  51. package/node_modules/@mdbase-dev/connect-protocol/schemas/connect-protocol.v1.schema.json +1 -1
  52. package/node_modules/@mdbase-dev/connect-protocol/schemas/mdbase-app.schema.json +2 -1
  53. package/node_modules/@mdbase-dev/connect-protocol/schemas/operation-catalog.v1.json +3 -1
  54. package/node_modules/@mdbase-dev/connect-protocol/schemas/operation-mutation-classification.v1.json +28 -0
  55. package/package.json +2 -2
  56. package/vendor/mdbase-connect-sdk-3d3f95b80c9a.json +13 -0
  57. package/vendor/mdbase-dev-connect-protocol-0.1.0-beta.152-3d3f95b80c9a.tgz +0 -0
  58. package/vendor/mdbase-connect-sdk-e6e66bcd172f.json +0 -13
  59. package/vendor/mdbase-dev-connect-protocol-0.1.0-beta.145-e6e66bcd172f.tgz +0 -0
@@ -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: "31d8cda0e72a21107b5ad0b8bf48d68e9829f8842b0055e7a6fa7c7f2eff3988",
15697
+ bytes: 3981261,
15698
+ maxBytes: 3981261,
15693
15699
  source: {
15694
15700
  repository: "mdbase-dev/mdbase-connect",
15695
- commit: "7439dbd48279f5f64d89fbde9c4326a814c1259a"
15701
+ commit: "eada920017111ad18c44498d56f715c074a7a9e9"
15696
15702
  }
15697
15703
  },
15698
15704
  sqlite: {
@@ -21210,7 +21216,7 @@ function discoveryHandle(value2) {
21210
21216
  function encodeAppBasesDiscoveryRequest(request3) {
21211
21217
  const limit = unsigned(request3.limit, 128);
21212
21218
  if (!limit) throw bad2("discovery limit must be positive");
21213
- return encode(/* @__PURE__ */ new Map([[0, 1], [1, text2(request3.captureTimezone, 128)], [2, limit], [3, discoveryHandle(request3.continuation)]]));
21219
+ return encode(/* @__PURE__ */ new Map([[0, request3.reportUnreadable ? 2 : 1], [1, text2(request3.captureTimezone, 128)], [2, limit], [3, discoveryHandle(request3.continuation)]]));
21214
21220
  }
21215
21221
  function encodeAppBasesSourceRequest(request3) {
21216
21222
  return encode(/* @__PURE__ */ new Map([[0, 1], [1, uuid2.enc(request3.record)], [2, hash.enc(request3.sourceRevision)], [3, unsigned(request3.ordinal, 4294967295)], [4, text2(request3.captureTimezone, 128)]]));
@@ -21235,7 +21241,11 @@ function discoveryClock(value2) {
21235
21241
  text2(clock.localDate, 128);
21236
21242
  return clock;
21237
21243
  }
21238
- function decodeAppBasesDiscoveryResult(bytes10, expectedLimit = 128) {
21244
+ function unreadableSource(value2) {
21245
+ const m2 = fields2(value2, [0, 1, 2, 3, 4]);
21246
+ return { record: uuid2.dec(m2.get(0)), path: text2(m2.get(1)), sourceRevision: hash.dec(m2.get(2)), reason: text2(m2.get(3), 128), detail: text2(m2.get(4), 128) };
21247
+ }
21248
+ function decodeAppBasesDiscoveryResult(bytes10, expectedLimit = 128, reportUnreadable = false) {
21239
21249
  const limit = unsigned(expectedLimit, 128);
21240
21250
  if (!limit) throw bad2("discovery limit must be positive");
21241
21251
  const value2 = discoveryEnvelope(bytes10);
@@ -21243,7 +21253,9 @@ function decodeAppBasesDiscoveryResult(bytes10, expectedLimit = 128) {
21243
21253
  const m3 = fields2(value2, [0, 7]);
21244
21254
  return { kind: "refusal", problem: problem.dec(m3.get(7)) };
21245
21255
  }
21246
- const m2 = fields2(value2, [0, 1, 2, 3, 4]);
21256
+ const m2 = fields2(value2, reportUnreadable ? [0, 1, 2, 3, 4, 5] : [0, 1, 2, 3, 4]);
21257
+ const unreadable = reportUnreadable ? list2(m2.get(5), 128).map(unreadableSource) : [];
21258
+ for (let i = 1; i < unreadable.length; i++) if (unreadable[i - 1].record >= unreadable[i].record) throw bad2("unreadable sources must ascend by record");
21247
21259
  const views = list2(m2.get(1), limit).map(discoveryDescriptor);
21248
21260
  for (let i = 1; i < views.length; i++) {
21249
21261
  const previous = views[i - 1], next = views[i];
@@ -21252,7 +21264,7 @@ function decodeAppBasesDiscoveryResult(bytes10, expectedLimit = 128) {
21252
21264
  }
21253
21265
  const token = m2.get(4);
21254
21266
  if (token !== null && !(token instanceof Uint8Array)) throw bad2("native discovery handle required");
21255
- return { kind: "success", views, clock: discoveryClock(m2.get(2)), collectionRevision: hash.dec(m2.get(3)), continuation: discoveryHandle(token) };
21267
+ return { kind: "success", views, unreadable, clock: discoveryClock(m2.get(2)), collectionRevision: hash.dec(m2.get(3)), continuation: discoveryHandle(token) };
21256
21268
  }
21257
21269
  function decodeAppBasesSourceResult(bytes10, expected) {
21258
21270
  const value2 = discoveryEnvelope(bytes10);
@@ -21501,7 +21513,7 @@ function inheritOriginalAppGrant(port, session) {
21501
21513
  }
21502
21514
 
21503
21515
  // src/session.ts
21504
- var API_VERSIONS = [{ major: 1, minor: 3 }, { major: 1, minor: 2 }, { major: 1, minor: 1 }, { major: 1, minor: 0 }];
21516
+ var API_VERSIONS = [{ major: 1, minor: 4 }, { major: 1, minor: 3 }, { major: 1, minor: 2 }, { major: 1, minor: 1 }, { major: 1, minor: 0 }];
21505
21517
  function schemaToError(e, what) {
21506
21518
  if (isMdbaseError(e)) return e;
21507
21519
  if (e instanceof SchemaError && e.unknown) {
@@ -22255,6 +22267,95 @@ var FilesApi = class {
22255
22267
  }
22256
22268
  };
22257
22269
 
22270
+ // src/private.ts
22271
+ var DEVICE_KINDS = ["desktop", "mobile", "app_runtime", "cli", "hosted", "escrow", "recovery"];
22272
+ var kinds = enumOf("device-kind", DEVICE_KINDS);
22273
+ var deviceKind = {
22274
+ name: "device-kind",
22275
+ enc: (v) => kinds.enc(v),
22276
+ dec: (c) => {
22277
+ try {
22278
+ return kinds.dec(c);
22279
+ } catch {
22280
+ return "unknown";
22281
+ }
22282
+ }
22283
+ };
22284
+ var pendingDeviceShape = struct("pending-device", [
22285
+ [0, "device", uuid2],
22286
+ [1, "account", uuid2],
22287
+ [2, "kind", deviceKind],
22288
+ [3, "sas", tstr, "opt"],
22289
+ // Host response only; omitted from client encodings.
22290
+ [4, "exchangeReady", bool]
22291
+ ]);
22292
+ var pendingDevice = {
22293
+ ...pendingDeviceShape,
22294
+ enc: (v) => pendingDeviceShape.enc({ ...v, sas: void 0 })
22295
+ };
22296
+ var approvalReadinessShape = struct("approval-readiness", [
22297
+ [0, "device", uuid2],
22298
+ [1, "sas", tstr, "opt"],
22299
+ // Reserved: decode-only.
22300
+ [2, "exchangeReady", bool]
22301
+ ]);
22302
+ var approvalReadiness = {
22303
+ ...approvalReadinessShape,
22304
+ enc: (v) => approvalReadinessShape.enc({ ...v, sas: void 0 })
22305
+ };
22306
+ var recoveryKeyStatus = struct("recovery-key-status", [
22307
+ [0, "configured", bool],
22308
+ [1, "device", uuid2, "opt"]
22309
+ ]);
22310
+ var recoveryKeyCreated = struct("recovery-key-created", [
22311
+ [0, "phrase", tstr],
22312
+ [1, "device", uuid2]
22313
+ ]);
22314
+ var ACCOUNT_KEY_STATES = ["idle", "reading_ahead", "pending_grant", "keyed", "refused"];
22315
+ var accountKeyState = enumOf("account-key-state", ACCOUNT_KEY_STATES);
22316
+ var accountKeyStatus = struct("account-key-status", [
22317
+ [0, "state", accountKeyState],
22318
+ [1, "problem", problem, "opt"]
22319
+ ]);
22320
+
22321
+ // src/history.ts
22322
+ var recordHistoryParams = struct("record-history-params", [
22323
+ [0, "record", uuid2],
22324
+ [1, "before", uint, "opt"],
22325
+ [2, "limit", uint, "opt"]
22326
+ ]);
22327
+ var recordVersionParams = struct("record-version-params", [
22328
+ [0, "record", uuid2],
22329
+ [1, "seq", uint]
22330
+ ]);
22331
+ var authorRef2 = struct("author-ref", [
22332
+ [0, "account", uuid2],
22333
+ [1, "device", uuid2],
22334
+ [2, "grant", uuid2, "opt"],
22335
+ [3, "grantAccount", uuid2, "opt"]
22336
+ ]);
22337
+ var historyVersion = struct("history-version", [
22338
+ [0, "seq", uint],
22339
+ [1, "time", int3],
22340
+ [2, "author", authorRef2],
22341
+ [3, "kind", enumOf("version-kind", ["created", "edited", "moved", "deleted"])],
22342
+ [4, "path", tstr],
22343
+ [5, "revision", hash, "opt"],
22344
+ [6, "source", enumOf("source", ["api", "external"])],
22345
+ [7, "deviceKind", deviceKind],
22346
+ [8, "app", tstr, "opt"]
22347
+ ]);
22348
+ var recordHistory = struct("record-history", [
22349
+ [0, "versions", list(historyVersion)],
22350
+ [1, "from", uint],
22351
+ [2, "fromTime", int3, "opt"],
22352
+ [3, "next", uint, "opt"]
22353
+ ]);
22354
+ var recordVersion = struct("record-version", [
22355
+ [0, "path", tstr],
22356
+ [1, "document", tstr]
22357
+ ]);
22358
+
22258
22359
  // src/settle.ts
22259
22360
  var DEFAULT_WAIT_MS = 3e3;
22260
22361
  var cancelled = (e) => isMdbaseError(e, "cancelled");
@@ -24221,57 +24322,6 @@ async function applyTypePack(client, plan, o = {}) {
24221
24322
  return { outcome: receipt3.state === "confirmed" ? "applied" : "pending", receipt: applied.desired, write };
24222
24323
  }
24223
24324
 
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
24325
  // src/write-ledger.ts
24276
24326
  function memoryWriteLedgerStore() {
24277
24327
  const rows2 = /* @__PURE__ */ new Map();
@@ -24450,11 +24500,20 @@ function accountSecret(secret) {
24450
24500
  if (!(secret instanceof Uint8Array) || secret.length !== 32) throw mdbaseError("invalid_request", "the account secret is 32 bytes", "account_secret_length");
24451
24501
  }
24452
24502
  var VALIDATE_PAGE = "validate-page-v1";
24503
+ var BASES_DISCOVERY_UNREADABLE = "bases-discovery-unreadable-v1";
24453
24504
  function params(entries) {
24454
24505
  const m2 = /* @__PURE__ */ new Map();
24455
24506
  for (const [k, v] of entries) if (v !== void 0) m2.set(k, v);
24456
24507
  return m2;
24457
24508
  }
24509
+ function historyRead(read) {
24510
+ return read.catch((e) => {
24511
+ if (isMdbaseError(e, "invalid_request") && e.reason === "unknown_method") {
24512
+ throw mdbaseError("upgrade_required", "This collection's replica has no record history.", "history_unsupported");
24513
+ }
24514
+ throw e;
24515
+ });
24516
+ }
24458
24517
  function withCurrentGrant(hello, grant) {
24459
24518
  const prior = hello.grant;
24460
24519
  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 +24726,9 @@ var READ_METHODS = /* @__PURE__ */ new Set([
24667
24726
  "new_type_file",
24668
24727
  "get_contract_v1",
24669
24728
  "map_contract_write_v1",
24670
- "plan_type_pack_v1"
24729
+ "plan_type_pack_v1",
24730
+ "record_history",
24731
+ "record_version"
24671
24732
  ]);
24672
24733
  var MdbaseClient = class _MdbaseClient {
24673
24734
  constructor(opts, session) {
@@ -24844,7 +24905,7 @@ var MdbaseClient = class _MdbaseClient {
24844
24905
  versions: API_VERSIONS,
24845
24906
  clientName: opts.app.name,
24846
24907
  clientVersion: opts.app.version,
24847
- features: [.../* @__PURE__ */ new Set([...opts.features ?? [], "declared-collection-setup-v1", "file-stream-failure-v1", VALIDATE_PAGE])],
24908
+ features: [.../* @__PURE__ */ new Set([...opts.features ?? [], "declared-collection-setup-v1", "file-stream-failure-v1", VALIDATE_PAGE, BASES_DISCOVERY_UNREADABLE])],
24848
24909
  ...tz ? { timezone: tz } : {}
24849
24910
  };
24850
24911
  }
@@ -25479,6 +25540,29 @@ var MdbaseClient = class _MdbaseClient {
25479
25540
  throw e;
25480
25541
  });
25481
25542
  }
25543
+ /**
25544
+ * Record history (§4.4, API 1.4): the versions of a record that the log still
25545
+ * retains. Needs `collection.read` and `history.read` through a grant without
25546
+ * a folder scope. A replica without history,
25547
+ * the hosted replica and a local-only collection refuse with
25548
+ * `upgrade_required` / `history_unsupported`.
25549
+ */
25550
+ history = {
25551
+ /** One page of a record's versions, newest first. Pass `next` as `before`
25552
+ * for older ones. `o.signal` cancels the read. */
25553
+ list: (record3, o = {}) => historyRead(this.call("record_history", recordHistoryParams.enc({ record: record3, before: o.before, limit: o.limit }), {
25554
+ codec: recordHistory,
25555
+ retry: true,
25556
+ ...o.signal ? { signal: o.signal } : {}
25557
+ })),
25558
+ /** The exact document of the version at log position `seq`, checked
25559
+ * against its revision. `o.signal` cancels the read. */
25560
+ version: (record3, seq2, o = {}) => historyRead(this.call("record_version", recordVersionParams.enc({ record: record3, seq: seq2 }), {
25561
+ codec: recordVersion,
25562
+ retry: true,
25563
+ ...o.signal ? { signal: o.signal } : {}
25564
+ }))
25565
+ };
25482
25566
  /** Definitions: `mdbase.yaml`, type files, contract files (§4.1). */
25483
25567
  resources = {
25484
25568
  /** One definition by path. `o.signal` cancels the read. */
@@ -25927,15 +26011,22 @@ var MdbaseClient = class _MdbaseClient {
25927
26011
  }
25928
26012
  /** One bounded native discovery page. Empty views do not mean EOF when a
25929
26013
  * continuation is present. Supplied handles never silently restart/retry.
26014
+ * With `reportUnreadable`, a replica that grants
26015
+ * `bases-discovery-unreadable-v1` skips records it cannot classify and names
26016
+ * them in `unreadable`; an older replica refuses the discovery as before, so
26017
+ * an empty `unreadable` on success always means none were skipped.
25930
26018
  * `o.signal` cancels the read. */
25931
26019
  async listAppBasesViews(request3, o = {}) {
25932
26020
  const signal = o.signal;
25933
- const limit = request3.limit, bytes10 = encodeAppBasesDiscoveryRequest(request3);
26021
+ const limit = request3.limit;
26022
+ encodeAppBasesDiscoveryRequest(request3);
25934
26023
  const session = await this.readyForRead(signal);
26024
+ const reportUnreadable = request3.reportUnreadable === true && session.hello.features.includes(BASES_DISCOVERY_UNREADABLE);
26025
+ const bytes10 = encodeAppBasesDiscoveryRequest({ ...request3, reportUnreadable });
25935
26026
  const reply = await session.readAppBasesDiscovery("list-views", bytes10, signal);
25936
26027
  try {
25937
26028
  if (session !== this.session || session.closed || this.readFencedAt !== null) throw mdbaseError("unavailable", "original Bases session is no longer current");
25938
- return decodeAppBasesDiscoveryResult(reply, limit);
26029
+ return decodeAppBasesDiscoveryResult(reply, limit, reportUnreadable);
25939
26030
  } catch (error4) {
25940
26031
  throw schemaToError(error4, "app Bases discovery");
25941
26032
  } finally {