@mdbase-dev/connect-protocol 0.1.0-beta.116 → 0.1.0-beta.118
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.
|
@@ -1,4 +1,11 @@
|
|
|
1
1
|
import type { ContractSetupChoice, TypePackAssessment, TypePackProvision, TypePackReceipt } from "./type-packs.js";
|
|
2
|
+
/**
|
|
3
|
+
* The one core configuration target: an application may add a record format
|
|
4
|
+
* its data is stored as. Every other target is inside an `x-*` namespace.
|
|
5
|
+
*/
|
|
6
|
+
export declare const RECORD_EXTENSIONS_CONFIGURATION_PATH: "/settings/record_extensions";
|
|
7
|
+
/** The connector's engine reads `.base` files as YAML document records (mdbase spec Chapter 03). */
|
|
8
|
+
export declare const YAML_DOCUMENT_RECORDS_CAPABILITY: "yaml-document-records-v1";
|
|
2
9
|
export type ConfigurationContributionValue = string | number | boolean | null;
|
|
3
10
|
export interface ConfigurationRequirement {
|
|
4
11
|
id: string;
|
package/dist/collection-setup.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The one core configuration target: an application may add a record format
|
|
3
|
+
* its data is stored as. Every other target is inside an `x-*` namespace.
|
|
4
|
+
*/
|
|
5
|
+
export const RECORD_EXTENSIONS_CONFIGURATION_PATH = "/settings/record_extensions";
|
|
6
|
+
/** The connector's engine reads `.base` files as YAML document records (mdbase spec Chapter 03). */
|
|
7
|
+
export const YAML_DOCUMENT_RECORDS_CAPABILITY = "yaml-document-records-v1";
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ApplicationFileRequirement, LegacyApplicationFileRequirement, Coll
|
|
|
3
3
|
import type { CollectionOperation } from "./operations.js";
|
|
4
4
|
import type { ApplicationCapabilityRequirements, LegacyApplicationCapabilityRequirements } from "./capabilities.js";
|
|
5
5
|
import type { ContractRequirement, ContractSetupChoice, TypePackProvision } from "./type-packs.js";
|
|
6
|
-
import type
|
|
6
|
+
import { type ConfigurationProvision, type ConfigurationRequirement } from "./collection-setup.js";
|
|
7
7
|
import type { ApplicationAuthorizationProof } from "./application-authorization.js";
|
|
8
8
|
export * from "./connect-problems.generated.js";
|
|
9
9
|
export * from "./files.js";
|
|
@@ -33,7 +33,7 @@ export declare const HOSTED_PROVIDER_REQUIRED_CAPABILITIES: readonly ["durable-m
|
|
|
33
33
|
export declare const HOSTED_CANDIDATE_B_ACTIVATION_CAPABILITY: "candidate-b-activation-v1";
|
|
34
34
|
export declare const HOSTED_PROVIDER_CAPABILITIES: readonly [...string[], "durable-mutation-journal-v1", "durable-file-lifecycle-v1", "contract-metadata-read-v1", "mutation-replay-after-credential-retirement-v1", "candidate-b-activation-v1"];
|
|
35
35
|
export declare const APPLICATION_DECLARATION_EVIDENCE_CAPABILITY: "application-declaration-evidence-v1";
|
|
36
|
-
export declare const RELAY_CAPABILITIES: readonly [...string[], "application-declaration-evidence-v1", "application-authorization-v4", "authorization-activation", "encrypted-relay", "policy-ack", "policy-freshness-lease-v1", "application-authorization-v5", "contract-setup-v1", "file-relay-v1", "protocol-usage-report-v1"];
|
|
36
|
+
export declare const RELAY_CAPABILITIES: readonly [...string[], "application-declaration-evidence-v1", "application-authorization-v4", "authorization-activation", "encrypted-relay", "policy-ack", "policy-freshness-lease-v1", "application-authorization-v5", "contract-setup-v1", "file-relay-v1", "protocol-usage-report-v1", "yaml-document-records-v1"];
|
|
37
37
|
export declare const AUTHORITY_PROOF_VERSION: 1;
|
|
38
38
|
export declare const AUTHORITY_PROOF_ALGORITHM: "P256-SHA256";
|
|
39
39
|
export declare const AUTHORITY_PROOF_DOMAIN: "mdbase-authority-request-proof-v1";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { FRESH_APPLICATION_AUTHORIZATION_CAPABILITIES } from "./capabilities.js";
|
|
2
|
+
import { YAML_DOCUMENT_RECORDS_CAPABILITY } from "./collection-setup.js";
|
|
2
3
|
export * from "./connect-problems.generated.js";
|
|
3
4
|
export * from "./files.js";
|
|
4
5
|
export * from "./operations.js";
|
|
@@ -49,7 +50,8 @@ export const RELAY_CAPABILITIES = [
|
|
|
49
50
|
"application-authorization-v5",
|
|
50
51
|
CONTRACT_SETUP_CAPABILITY,
|
|
51
52
|
FILE_RELAY_CAPABILITY,
|
|
52
|
-
PROTOCOL_USAGE_REPORT_CAPABILITY
|
|
53
|
+
PROTOCOL_USAGE_REPORT_CAPABILITY,
|
|
54
|
+
YAML_DOCUMENT_RECORDS_CAPABILITY
|
|
53
55
|
];
|
|
54
56
|
export const AUTHORITY_PROOF_VERSION = 1;
|
|
55
57
|
export const AUTHORITY_PROOF_ALGORITHM = "P256-SHA256";
|
package/dist/manifest.js
CHANGED
|
@@ -3,6 +3,7 @@ import { Ajv2020 } from "ajv/dist/2020.js";
|
|
|
3
3
|
import addFormatsModule from "ajv-formats";
|
|
4
4
|
import appManifestSchema from "../schemas/mdbase-app.schema.json" with { type: "json" };
|
|
5
5
|
import legacyAppManifestSchema from "../schemas/mdbase-app.legacy-v1.schema.json" with { type: "json" };
|
|
6
|
+
import { RECORD_EXTENSIONS_CONFIGURATION_PATH } from "./collection-setup.js";
|
|
6
7
|
import { isNativeRedirectUri } from "./index.js";
|
|
7
8
|
export const APPLICATION_MANIFEST_MAX_BYTES = 524_288;
|
|
8
9
|
export class AppManifestValidationError extends Error {
|
|
@@ -322,7 +323,7 @@ function validateConfigurationSetup(value) {
|
|
|
322
323
|
const requirement = asObject(candidate);
|
|
323
324
|
const id = String(requirement.id);
|
|
324
325
|
const path = String(requirement.path);
|
|
325
|
-
const pathError = configurationPointerError(path);
|
|
326
|
+
const pathError = configurationPointerError(path, requirement.value);
|
|
326
327
|
if (pathError) {
|
|
327
328
|
issues.push(issue(`/requirements/configuration/${index}/path`, "configurationPointer", pathError));
|
|
328
329
|
}
|
|
@@ -339,7 +340,7 @@ function validateConfigurationSetup(value) {
|
|
|
339
340
|
const provision = asObject(candidate);
|
|
340
341
|
const requirementId = String(provision.requirement);
|
|
341
342
|
const path = String(provision.path);
|
|
342
|
-
const pathError = configurationPointerError(path);
|
|
343
|
+
const pathError = configurationPointerError(path, provision.value);
|
|
343
344
|
if (pathError) {
|
|
344
345
|
issues.push(issue(`/provisions/configuration/${index}/path`, "configurationPointer", pathError));
|
|
345
346
|
}
|
|
@@ -371,7 +372,14 @@ function validateConfigurationSetup(value) {
|
|
|
371
372
|
}
|
|
372
373
|
return issues;
|
|
373
374
|
}
|
|
374
|
-
|
|
375
|
+
// Matches mdbase-rs collection setup.
|
|
376
|
+
const APPLICATION_RECORD_EXTENSIONS = ["md", "base"];
|
|
377
|
+
function configurationPointerError(path, value) {
|
|
378
|
+
if (path === RECORD_EXTENSIONS_CONFIGURATION_PATH) {
|
|
379
|
+
return APPLICATION_RECORD_EXTENSIONS.includes(value)
|
|
380
|
+
? undefined
|
|
381
|
+
: "accepts only the record extensions md and base";
|
|
382
|
+
}
|
|
375
383
|
if (!path.startsWith("/") || new TextEncoder().encode(path).byteLength > 1024) {
|
|
376
384
|
return "must be a bounded RFC 6901 JSON pointer";
|
|
377
385
|
}
|
package/package.json
CHANGED
|
@@ -447,7 +447,7 @@
|
|
|
447
447
|
"required": ["id", "path", "predicate", "value"],
|
|
448
448
|
"properties": {
|
|
449
449
|
"id": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" },
|
|
450
|
-
"path": { "type": "string", "pattern": "
|
|
450
|
+
"path": { "type": "string", "pattern": "^(?:/settings/record_extensions|/x-[^/]+(?:/.*)?)$", "maxLength": 1024 },
|
|
451
451
|
"predicate": { "const": "contains" },
|
|
452
452
|
"value": { "oneOf": [
|
|
453
453
|
{ "type": "string" },
|
|
@@ -464,7 +464,7 @@
|
|
|
464
464
|
"properties": {
|
|
465
465
|
"requirement": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" },
|
|
466
466
|
"operation": { "const": "set_add" },
|
|
467
|
-
"path": { "type": "string", "pattern": "
|
|
467
|
+
"path": { "type": "string", "pattern": "^(?:/settings/record_extensions|/x-[^/]+(?:/.*)?)$", "maxLength": 1024 },
|
|
468
468
|
"value": { "oneOf": [
|
|
469
469
|
{ "type": "string" },
|
|
470
470
|
{ "type": "number" },
|