@mdbase-dev/connect-protocol 0.1.0-beta.32 → 0.1.0-beta.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/application-authorization.d.ts +2 -1
- package/dist/application-authorization.js +4 -2
- package/dist/capabilities.d.ts +1 -0
- package/dist/capabilities.js +1 -0
- package/dist/collection-setup.d.ts +83 -0
- package/dist/collection-setup.js +1 -0
- package/dist/compatibility.d.ts +1 -1
- package/dist/compatibility.js +1 -1
- package/dist/files.d.ts +2 -0
- package/dist/index.d.ts +11 -3
- package/dist/index.js +3 -2
- package/dist/manifest.js +118 -5
- package/dist/operations.d.ts +2 -2
- package/dist/operations.js +7 -0
- package/package.json +1 -1
- package/schemas/catalog.json +1 -0
- package/schemas/connect-protocol.v1.schema.json +51 -4
- package/schemas/encrypted-relay.v1.schema.json +1 -1
- package/schemas/encrypted-relay.v2.schema.json +1 -1
- package/schemas/files.v1.schema.json +7 -2
- package/schemas/mdbase-app.schema.json +51 -0
- package/schemas/mdbase-query.v0.3.schema.json +171 -0
- package/schemas/operation-catalog.v1.json +2 -0
|
@@ -3,9 +3,10 @@ import type { CollectionOperation } from "./operations.js";
|
|
|
3
3
|
import type { ConnectContractRequirements } from "./compatibility.js";
|
|
4
4
|
export type ApplicationAuthorizationFlow = "authorization_code" | "device_code";
|
|
5
5
|
export interface ApplicationAuthorizationBinding {
|
|
6
|
-
protocol_version:
|
|
6
|
+
protocol_version: 4;
|
|
7
7
|
authorization_id: string;
|
|
8
8
|
application_id: string;
|
|
9
|
+
application_declaration_id: string;
|
|
9
10
|
application_manifest_digest: string;
|
|
10
11
|
application_installation_id: string;
|
|
11
12
|
installation_signing_public_key: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const INSTALLATION_ID_DOMAIN = new TextEncoder().encode("mdbase-connect application installation id v2\0");
|
|
2
|
-
const AUTHORIZATION_PROOF_DOMAIN = new TextEncoder().encode("mdbase-connect application authorization proof
|
|
2
|
+
const AUTHORIZATION_PROOF_DOMAIN = new TextEncoder().encode("mdbase-connect application authorization proof v4\0");
|
|
3
3
|
export async function applicationInstallationIdFromPublicKey(signingPublicKey) {
|
|
4
4
|
const signing = publicKey(signingPublicKey);
|
|
5
5
|
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", concat([INSTALLATION_ID_DOMAIN, field(signing)])));
|
|
@@ -26,8 +26,9 @@ export function authorizationSigningMessage(binding) {
|
|
|
26
26
|
const nonce = canonicalBase64(binding.authorization_nonce);
|
|
27
27
|
const challenge = canonicalBase64(binding.code_challenge);
|
|
28
28
|
const contracts = binding.contracts;
|
|
29
|
-
if (binding.protocol_version !==
|
|
29
|
+
if (binding.protocol_version !== 4
|
|
30
30
|
|| nonce.byteLength !== 32
|
|
31
|
+
|| !/^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)+$/u.test(binding.application_declaration_id)
|
|
31
32
|
|| !/^[0-9a-f]{64}$/u.test(binding.application_manifest_digest)
|
|
32
33
|
|| !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?Z$/u.test(binding.issued_at)
|
|
33
34
|
|| !/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,9})?Z$/u.test(binding.expires_at)
|
|
@@ -55,6 +56,7 @@ export function authorizationSigningMessage(binding) {
|
|
|
55
56
|
u32(binding.protocol_version),
|
|
56
57
|
field(uuidBytes(binding.application_id)),
|
|
57
58
|
field(uuidBytes(binding.authorization_id)),
|
|
59
|
+
field(new TextEncoder().encode(binding.application_declaration_id)),
|
|
58
60
|
field(hexBytes(binding.application_manifest_digest)),
|
|
59
61
|
field(uuidBytes(binding.application_installation_id)),
|
|
60
62
|
...keys.map(field),
|
package/dist/capabilities.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export declare const APPLICATION_CAPABILITY_DEFINITIONS: {
|
|
|
26
26
|
readonly "definitions.update": readonly ["update_type"];
|
|
27
27
|
readonly "definitions.type-pack.inspect": readonly ["assess_type_pack"];
|
|
28
28
|
readonly "definitions.type-pack.apply": readonly ["assess_type_pack", "apply_type_pack"];
|
|
29
|
+
readonly "collection.setup.apply": readonly ["assess_collection_setup", "apply_collection_setup"];
|
|
29
30
|
readonly "timers.list": readonly ["list_timers"];
|
|
30
31
|
readonly "timers.put": readonly ["put_timer"];
|
|
31
32
|
readonly "timers.cancel": readonly ["cancel_timer"];
|
package/dist/capabilities.js
CHANGED
|
@@ -25,6 +25,7 @@ export const APPLICATION_CAPABILITY_DEFINITIONS = {
|
|
|
25
25
|
"definitions.update": ["update_type"],
|
|
26
26
|
"definitions.type-pack.inspect": ["assess_type_pack"],
|
|
27
27
|
"definitions.type-pack.apply": ["assess_type_pack", "apply_type_pack"],
|
|
28
|
+
"collection.setup.apply": ["assess_collection_setup", "apply_collection_setup"],
|
|
28
29
|
"timers.list": ["list_timers"],
|
|
29
30
|
"timers.put": ["put_timer"],
|
|
30
31
|
"timers.cancel": ["cancel_timer"],
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { ContractSetupChoice, TypePackAssessment, TypePackProvision, TypePackReceipt } from "./type-packs.js";
|
|
2
|
+
export type ConfigurationContributionValue = string | number | boolean | null;
|
|
3
|
+
export interface ConfigurationRequirement {
|
|
4
|
+
id: string;
|
|
5
|
+
path: string;
|
|
6
|
+
predicate: "contains";
|
|
7
|
+
value: ConfigurationContributionValue;
|
|
8
|
+
}
|
|
9
|
+
export interface ConfigurationProvision {
|
|
10
|
+
requirement: string;
|
|
11
|
+
operation: "set_add";
|
|
12
|
+
path: string;
|
|
13
|
+
value: ConfigurationContributionValue;
|
|
14
|
+
}
|
|
15
|
+
export interface ApplicationCollectionSetupRequirements {
|
|
16
|
+
configuration: ConfigurationRequirement[];
|
|
17
|
+
}
|
|
18
|
+
export interface ApplicationCollectionSetupProvisions {
|
|
19
|
+
configuration: ConfigurationProvision[];
|
|
20
|
+
type_packs: TypePackProvision[];
|
|
21
|
+
}
|
|
22
|
+
export interface AssessCollectionSetupInput {
|
|
23
|
+
/** Stable application declaration id, not the server's database id. */
|
|
24
|
+
application_id: string;
|
|
25
|
+
/** Exact canonical digest of the complete registered application declaration. */
|
|
26
|
+
declaration_digest: string;
|
|
27
|
+
requirements: ApplicationCollectionSetupRequirements;
|
|
28
|
+
provisions: ApplicationCollectionSetupProvisions;
|
|
29
|
+
/** Collection-owner choices for user-owned contract implementations. */
|
|
30
|
+
contract_setups?: ContractSetupChoice[];
|
|
31
|
+
}
|
|
32
|
+
export interface ApplyCollectionSetupInput extends AssessCollectionSetupInput {
|
|
33
|
+
expected_assessment_digest: string;
|
|
34
|
+
expected_collection_revision: string;
|
|
35
|
+
expected_provision_digest: string;
|
|
36
|
+
allow_type_pack_downgrades?: string[];
|
|
37
|
+
}
|
|
38
|
+
export interface ConfigurationSetupConflict {
|
|
39
|
+
code: "configuration_path_conflict" | "configuration_type_conflict";
|
|
40
|
+
path: string;
|
|
41
|
+
expected: "mapping" | "sequence";
|
|
42
|
+
observed: "null" | "boolean" | "number" | "string" | "sequence" | "mapping" | "tagged";
|
|
43
|
+
message: string;
|
|
44
|
+
}
|
|
45
|
+
export interface ConfigurationSetupAssessment {
|
|
46
|
+
requirement: string;
|
|
47
|
+
path: string;
|
|
48
|
+
value: ConfigurationContributionValue;
|
|
49
|
+
action: "current" | "add" | "conflict";
|
|
50
|
+
conflict?: ConfigurationSetupConflict;
|
|
51
|
+
}
|
|
52
|
+
export interface CollectionSetupAssessment {
|
|
53
|
+
status: "current" | "provision" | "conflict";
|
|
54
|
+
applicable: boolean;
|
|
55
|
+
application_id: string;
|
|
56
|
+
declaration_digest: string;
|
|
57
|
+
provision_digest: string;
|
|
58
|
+
collection_revision: string;
|
|
59
|
+
final_collection_revision: string;
|
|
60
|
+
configuration: ConfigurationSetupAssessment[];
|
|
61
|
+
type_packs: TypePackAssessment[];
|
|
62
|
+
final_resource_revisions: Record<string, string>;
|
|
63
|
+
assessment_digest: string;
|
|
64
|
+
}
|
|
65
|
+
export interface ConfigurationContributionReceipt {
|
|
66
|
+
requirement: string;
|
|
67
|
+
path: string;
|
|
68
|
+
value: ConfigurationContributionValue;
|
|
69
|
+
}
|
|
70
|
+
export interface CollectionSetupReceipt {
|
|
71
|
+
application_id: string;
|
|
72
|
+
declaration_digest: string;
|
|
73
|
+
provision_digest: string;
|
|
74
|
+
assessment_digest: string;
|
|
75
|
+
collection_revision: string;
|
|
76
|
+
configuration: ConfigurationContributionReceipt[];
|
|
77
|
+
type_packs: TypePackReceipt[];
|
|
78
|
+
cleanup_deferred: boolean;
|
|
79
|
+
}
|
|
80
|
+
export interface CollectionSetupApplyResult {
|
|
81
|
+
assessment: CollectionSetupAssessment;
|
|
82
|
+
receipt: CollectionSetupReceipt;
|
|
83
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/compatibility.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ApplicationFileRequirement } from "./files.js";
|
|
2
2
|
import { type CollectionOperation } from "./operations.js";
|
|
3
3
|
export declare const OPERATION_TRANSPORT_PROTOCOL_VERSION: 2;
|
|
4
|
-
export declare const AUTHORIZATION_BINDING_PROTOCOL_VERSION:
|
|
4
|
+
export declare const AUTHORIZATION_BINDING_PROTOCOL_VERSION: 4;
|
|
5
5
|
export declare const SEMANTIC_CAPABILITY_CONTRACT_VERSION: 1;
|
|
6
6
|
export declare const DURABLE_MUTATION_CONTRACT_VERSION: 1;
|
|
7
7
|
export interface ConnectContractRequirements {
|
package/dist/compatibility.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { isMutatingOperation } from "./operations.js";
|
|
2
2
|
export const OPERATION_TRANSPORT_PROTOCOL_VERSION = 2;
|
|
3
|
-
export const AUTHORIZATION_BINDING_PROTOCOL_VERSION =
|
|
3
|
+
export const AUTHORIZATION_BINDING_PROTOCOL_VERSION = 4;
|
|
4
4
|
export const SEMANTIC_CAPABILITY_CONTRACT_VERSION = 1;
|
|
5
5
|
export const DURABLE_MUTATION_CONTRACT_VERSION = 1;
|
|
6
6
|
export const CONNECT_CONTRACT_SUPPORT = {
|
package/dist/files.d.ts
CHANGED
|
@@ -152,6 +152,8 @@ export interface FileTransferStatus {
|
|
|
152
152
|
state: FileTransferState;
|
|
153
153
|
received: number[];
|
|
154
154
|
received_bytes: number;
|
|
155
|
+
/** Object-store receipts for the currently durable multipart parts. */
|
|
156
|
+
uploaded_parts: UploadedFilePart[];
|
|
155
157
|
}
|
|
156
158
|
export interface PrepareFileUploadPartRequest {
|
|
157
159
|
protocol_version: 1;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { ApplicationFileRequirement, CollectionFileDescriptor, FileCapabili
|
|
|
3
3
|
import type { CollectionOperation } from "./operations.js";
|
|
4
4
|
import type { ApplicationCapabilityRequirements } from "./capabilities.js";
|
|
5
5
|
import type { ContractRequirement, ContractSetupChoice, TypePackProvision } from "./type-packs.js";
|
|
6
|
+
import type { ConfigurationProvision, ConfigurationRequirement } from "./collection-setup.js";
|
|
6
7
|
import type { ApplicationAuthorizationProof } from "./application-authorization.js";
|
|
7
8
|
export * from "./connect-problems.generated.js";
|
|
8
9
|
export * from "./files.js";
|
|
@@ -12,6 +13,7 @@ export * from "./compatibility.js";
|
|
|
12
13
|
export * from "./capabilities.js";
|
|
13
14
|
export * from "./application-authorization.js";
|
|
14
15
|
export * from "./type-packs.js";
|
|
16
|
+
export * from "./collection-setup.js";
|
|
15
17
|
export declare const CONTROL_PROTOCOL_VERSION: 1;
|
|
16
18
|
export { AUTHORIZATION_BINDING_PROTOCOL_VERSION as APPLICATION_AUTHORIZATION_PROTOCOL_VERSION } from "./compatibility.js";
|
|
17
19
|
export declare const LOOPBACK_PROTOCOL_VERSION: 1;
|
|
@@ -21,11 +23,11 @@ export declare const GRANT_ENCRYPTION_PROTOCOL_VERSION: 1;
|
|
|
21
23
|
export declare const SYNC_PROTOCOL_VERSION: 1;
|
|
22
24
|
export declare const CONTRACT_SETUP_CAPABILITY: "contract-setup-v1";
|
|
23
25
|
export declare const FILE_RELAY_CAPABILITY: "file-relay-v1";
|
|
24
|
-
export declare const RELAY_REQUIRED_CAPABILITIES: readonly ["application-authorization-
|
|
25
|
-
export declare const MINIMUM_CONNECTOR_VERSION: "0.1.0-beta.
|
|
26
|
+
export declare const RELAY_REQUIRED_CAPABILITIES: readonly ["application-authorization-v4", "authorization-activation", "encrypted-relay", "policy-ack"];
|
|
27
|
+
export declare const MINIMUM_CONNECTOR_VERSION: "0.1.0-beta.33";
|
|
26
28
|
export declare const HOSTED_PROVIDER_REQUIRED_CAPABILITIES: readonly ["durable-mutation-journal-v1", "durable-file-lifecycle-v1"];
|
|
27
29
|
export declare const HOSTED_PROVIDER_CAPABILITIES: readonly ["durable-mutation-journal-v1", "durable-file-lifecycle-v1", "mutation-replay-after-credential-retirement-v1"];
|
|
28
|
-
export declare const RELAY_CAPABILITIES: readonly ["application-authorization-
|
|
30
|
+
export declare const RELAY_CAPABILITIES: readonly ["application-authorization-v4", "authorization-activation", "encrypted-relay", "policy-ack", "contract-setup-v1", "file-relay-v1"];
|
|
29
31
|
export declare const AUTHORITY_PROOF_VERSION: 1;
|
|
30
32
|
export declare const AUTHORITY_PROOF_ALGORITHM: "P256-SHA256";
|
|
31
33
|
export declare const AUTHORITY_PROOF_DOMAIN: "mdbase-authority-request-proof-v1";
|
|
@@ -153,6 +155,8 @@ export interface NotificationWebhook {
|
|
|
153
155
|
}
|
|
154
156
|
export interface ApplicationRequirements {
|
|
155
157
|
contracts: ContractRequirement[];
|
|
158
|
+
/** Collection extension values required before the application is ready. */
|
|
159
|
+
configuration?: ConfigurationRequirement[];
|
|
156
160
|
/** Versioned semantic intent compiled by Connect into exact operations. */
|
|
157
161
|
capabilities?: ApplicationCapabilityRequirements;
|
|
158
162
|
/** Access boundary requested after compatibility and provisioning checks. */
|
|
@@ -164,6 +168,8 @@ export interface ApplicationRequirements {
|
|
|
164
168
|
}
|
|
165
169
|
export interface ApplicationProvisions {
|
|
166
170
|
type_packs: TypePackProvision[];
|
|
171
|
+
/** Narrow semantic changes that may satisfy configuration requirements. */
|
|
172
|
+
configuration?: ConfigurationProvision[];
|
|
167
173
|
}
|
|
168
174
|
export interface GrantScope {
|
|
169
175
|
/**
|
|
@@ -550,6 +556,8 @@ export interface AuthorizationActivationResponse {
|
|
|
550
556
|
contracts: CollectionContractDescriptor[];
|
|
551
557
|
/** Exact setup plan applied by the authority. */
|
|
552
558
|
contract_setups: ContractSetupChoice[];
|
|
559
|
+
setup_assessment?: unknown;
|
|
560
|
+
provision_receipt?: unknown;
|
|
553
561
|
error?: {
|
|
554
562
|
code: string;
|
|
555
563
|
message: string;
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ export * from "./compatibility.js";
|
|
|
6
6
|
export * from "./capabilities.js";
|
|
7
7
|
export * from "./application-authorization.js";
|
|
8
8
|
export * from "./type-packs.js";
|
|
9
|
+
export * from "./collection-setup.js";
|
|
9
10
|
export const CONTROL_PROTOCOL_VERSION = 1;
|
|
10
11
|
export { AUTHORIZATION_BINDING_PROTOCOL_VERSION as APPLICATION_AUTHORIZATION_PROTOCOL_VERSION } from "./compatibility.js";
|
|
11
12
|
export const LOOPBACK_PROTOCOL_VERSION = 1;
|
|
@@ -16,12 +17,12 @@ export const SYNC_PROTOCOL_VERSION = 1;
|
|
|
16
17
|
export const CONTRACT_SETUP_CAPABILITY = "contract-setup-v1";
|
|
17
18
|
export const FILE_RELAY_CAPABILITY = "file-relay-v1";
|
|
18
19
|
export const RELAY_REQUIRED_CAPABILITIES = [
|
|
19
|
-
"application-authorization-
|
|
20
|
+
"application-authorization-v4",
|
|
20
21
|
"authorization-activation",
|
|
21
22
|
"encrypted-relay",
|
|
22
23
|
"policy-ack"
|
|
23
24
|
];
|
|
24
|
-
export const MINIMUM_CONNECTOR_VERSION = "0.1.0-beta.
|
|
25
|
+
export const MINIMUM_CONNECTOR_VERSION = "0.1.0-beta.33";
|
|
25
26
|
export const HOSTED_PROVIDER_REQUIRED_CAPABILITIES = [
|
|
26
27
|
"durable-mutation-journal-v1",
|
|
27
28
|
"durable-file-lifecycle-v1"
|
package/dist/manifest.js
CHANGED
|
@@ -40,7 +40,8 @@ export function validateAppManifest(value, options = {}) {
|
|
|
40
40
|
const issues = [
|
|
41
41
|
...validateManifestOrigins(value, options.allowLocal === true),
|
|
42
42
|
...validateCapabilityRequirements(value),
|
|
43
|
-
...validateProvisionRequirements(value)
|
|
43
|
+
...validateProvisionRequirements(value),
|
|
44
|
+
...validateConfigurationSetup(value)
|
|
44
45
|
];
|
|
45
46
|
return issues.length === 0 ? { valid: true, issues: [] } : invalid(issues);
|
|
46
47
|
}
|
|
@@ -52,8 +53,16 @@ export function parseAppManifest(value, options = {}) {
|
|
|
52
53
|
const manifest = structuredClone(value);
|
|
53
54
|
return {
|
|
54
55
|
...manifest,
|
|
55
|
-
requirements:
|
|
56
|
-
|
|
56
|
+
requirements: {
|
|
57
|
+
contracts: [],
|
|
58
|
+
configuration: [],
|
|
59
|
+
...manifest.requirements
|
|
60
|
+
},
|
|
61
|
+
provisions: {
|
|
62
|
+
type_packs: [],
|
|
63
|
+
configuration: [],
|
|
64
|
+
...manifest.provisions
|
|
65
|
+
},
|
|
57
66
|
notifications: manifest.notifications ?? { criteria: [] }
|
|
58
67
|
};
|
|
59
68
|
}
|
|
@@ -253,6 +262,95 @@ function validateProvisionRequirements(value) {
|
|
|
253
262
|
}
|
|
254
263
|
return issues;
|
|
255
264
|
}
|
|
265
|
+
function validateConfigurationSetup(value) {
|
|
266
|
+
const manifest = asObject(value);
|
|
267
|
+
const requirements = asObject(manifest.requirements);
|
|
268
|
+
const provisions = asObject(manifest.provisions);
|
|
269
|
+
const requiredValues = Array.isArray(requirements.configuration)
|
|
270
|
+
? requirements.configuration
|
|
271
|
+
: [];
|
|
272
|
+
const provisionValues = Array.isArray(provisions.configuration)
|
|
273
|
+
? provisions.configuration
|
|
274
|
+
: [];
|
|
275
|
+
const issues = [];
|
|
276
|
+
const required = new Map();
|
|
277
|
+
for (const [index, candidate] of requiredValues.entries()) {
|
|
278
|
+
const requirement = asObject(candidate);
|
|
279
|
+
const id = String(requirement.id);
|
|
280
|
+
const path = String(requirement.path);
|
|
281
|
+
const pathError = configurationPointerError(path);
|
|
282
|
+
if (pathError) {
|
|
283
|
+
issues.push(issue(`/requirements/configuration/${index}/path`, "configurationPointer", pathError));
|
|
284
|
+
}
|
|
285
|
+
if (required.has(id)) {
|
|
286
|
+
issues.push(issue(`/requirements/configuration/${index}/id`, "uniqueRequirement", `duplicates configuration requirement ${id}`));
|
|
287
|
+
}
|
|
288
|
+
else {
|
|
289
|
+
required.set(id, { path, value: requirement.value, index });
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
const linked = new Set();
|
|
293
|
+
const contributionKeys = new Set();
|
|
294
|
+
for (const [index, candidate] of provisionValues.entries()) {
|
|
295
|
+
const provision = asObject(candidate);
|
|
296
|
+
const requirementId = String(provision.requirement);
|
|
297
|
+
const path = String(provision.path);
|
|
298
|
+
const pathError = configurationPointerError(path);
|
|
299
|
+
if (pathError) {
|
|
300
|
+
issues.push(issue(`/provisions/configuration/${index}/path`, "configurationPointer", pathError));
|
|
301
|
+
}
|
|
302
|
+
const requirement = required.get(requirementId);
|
|
303
|
+
if (!requirement) {
|
|
304
|
+
issues.push(issue(`/provisions/configuration/${index}/requirement`, "configurationRequirement", `references unknown configuration requirement ${requirementId}`));
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
if (linked.has(requirementId)) {
|
|
308
|
+
issues.push(issue(`/provisions/configuration/${index}/requirement`, "uniqueProvision", `configuration requirement ${requirementId} may have exactly one provision`));
|
|
309
|
+
}
|
|
310
|
+
linked.add(requirementId);
|
|
311
|
+
if (path !== requirement.path) {
|
|
312
|
+
issues.push(issue(`/provisions/configuration/${index}/path`, "configurationRequirement", `must equal /requirements/configuration/${requirement.index}/path`));
|
|
313
|
+
}
|
|
314
|
+
if (JSON.stringify(provision.value) !== JSON.stringify(requirement.value)) {
|
|
315
|
+
issues.push(issue(`/provisions/configuration/${index}/value`, "configurationRequirement", `must equal /requirements/configuration/${requirement.index}/value`));
|
|
316
|
+
}
|
|
317
|
+
const contributionKey = `${path}\0${JSON.stringify(provision.value)}`;
|
|
318
|
+
if (contributionKeys.has(contributionKey)) {
|
|
319
|
+
issues.push(issue(`/provisions/configuration/${index}`, "uniqueContribution", "duplicates another configuration path and value contribution"));
|
|
320
|
+
}
|
|
321
|
+
contributionKeys.add(contributionKey);
|
|
322
|
+
}
|
|
323
|
+
for (const [id, requirement] of required) {
|
|
324
|
+
if (!linked.has(id)) {
|
|
325
|
+
issues.push(issue(`/requirements/configuration/${requirement.index}`, "configurationProvision", `requires one provision linked by id ${id}`));
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
return issues;
|
|
329
|
+
}
|
|
330
|
+
function configurationPointerError(path) {
|
|
331
|
+
if (!path.startsWith("/") || new TextEncoder().encode(path).byteLength > 1024) {
|
|
332
|
+
return "must be a bounded RFC 6901 JSON pointer";
|
|
333
|
+
}
|
|
334
|
+
const encoded = path.slice(1).split("/");
|
|
335
|
+
if (encoded.length < 2 || encoded.length > 16) {
|
|
336
|
+
return "must address a value below an x-* extension namespace";
|
|
337
|
+
}
|
|
338
|
+
const segments = [];
|
|
339
|
+
for (const value of encoded) {
|
|
340
|
+
if (/~(?:[^01]|$)/u.test(value))
|
|
341
|
+
return "contains an invalid RFC 6901 escape";
|
|
342
|
+
const segment = value.replaceAll("~1", "/").replaceAll("~0", "~");
|
|
343
|
+
if (segment.length === 0
|
|
344
|
+
|| segment === "-"
|
|
345
|
+
|| /^\d+$/u.test(segment)
|
|
346
|
+
|| [...segment].some((character) => /\p{Cc}/u.test(character)))
|
|
347
|
+
return "contains a disallowed object-key segment";
|
|
348
|
+
segments.push(segment);
|
|
349
|
+
}
|
|
350
|
+
return /^x-[a-z0-9][a-z0-9-]*$/u.test(segments[0])
|
|
351
|
+
? undefined
|
|
352
|
+
: "must be inside a top-level x-* extension namespace";
|
|
353
|
+
}
|
|
256
354
|
function validateCapabilityRequirements(value) {
|
|
257
355
|
const manifest = asObject(value);
|
|
258
356
|
const requirements = asObject(manifest.requirements);
|
|
@@ -285,8 +383,23 @@ function validateCapabilityRequirements(value) {
|
|
|
285
383
|
}
|
|
286
384
|
if (Array.isArray(provisions.type_packs)
|
|
287
385
|
&& provisions.type_packs.length > 0
|
|
288
|
-
&& !required.includes("
|
|
289
|
-
issues.push(issue("/requirements/capabilities/required", "
|
|
386
|
+
&& !required.includes("collection.setup.apply")) {
|
|
387
|
+
issues.push(issue("/requirements/capabilities/required", "collectionSetupCapability", "must require collection.setup.apply when bundled type packs are declared"));
|
|
388
|
+
}
|
|
389
|
+
const hasConfigurationProvisions = Array.isArray(provisions.configuration)
|
|
390
|
+
&& provisions.configuration.length > 0;
|
|
391
|
+
const hasSetupProvisions = hasConfigurationProvisions
|
|
392
|
+
|| (Array.isArray(provisions.type_packs) && provisions.type_packs.length > 0);
|
|
393
|
+
if (hasConfigurationProvisions && !required.includes("collection.setup.apply")) {
|
|
394
|
+
issues.push(issue("/requirements/capabilities/required", "collectionSetupCapability", "must require collection.setup.apply when configuration provisions are declared"));
|
|
395
|
+
}
|
|
396
|
+
if (declared.has("collection.setup.apply")) {
|
|
397
|
+
if (requirements.access !== "full_collection") {
|
|
398
|
+
issues.push(issue("/requirements/access", "collectionSetupAccess", "must be full_collection for collection.setup.apply"));
|
|
399
|
+
}
|
|
400
|
+
if (!hasSetupProvisions) {
|
|
401
|
+
issues.push(issue("/provisions", "collectionSetupProvision", "must declare a configuration provision or type pack for collection.setup.apply"));
|
|
402
|
+
}
|
|
290
403
|
}
|
|
291
404
|
if (declared.has("notifications.background-delivery")
|
|
292
405
|
&& !Array.isArray(asObject(manifest.notifications).criteria)) {
|
package/dist/operations.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export declare const OPERATION_CATALOG_VERSION: 1;
|
|
2
|
-
export declare const COLLECTION_OPERATIONS: readonly ["describe", "changes", "read", "query", "list_views", "execute_view", "read_view_source", "create_view_source", "update_view_source", "delete_view_source", "validate", "create", "update", "delete", "rename", "read_type", "create_type", "update_type", "assess_type_pack", "apply_type_pack", "list_timers", "put_timer", "cancel_timer", "reconcile_timers", "sync"];
|
|
2
|
+
export declare const COLLECTION_OPERATIONS: readonly ["describe", "changes", "read", "query", "list_views", "execute_view", "read_view_source", "create_view_source", "update_view_source", "delete_view_source", "validate", "create", "update", "delete", "rename", "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"];
|
|
3
3
|
export type CollectionOperation = typeof COLLECTION_OPERATIONS[number];
|
|
4
4
|
export declare const FILE_CONTROL_MESSAGE_TYPES: readonly ["list_files", "open_file_upload", "open_file_download", "move_file", "delete_file", "get_file_transfer_status", "commit_file_upload", "abort_file_transfer"];
|
|
5
5
|
export type FileControlMessageType = typeof FILE_CONTROL_MESSAGE_TYPES[number];
|
|
6
6
|
export type EncryptedOperation = CollectionOperation | "file_control";
|
|
7
|
-
export declare const MUTATING_OPERATION_IDENTIFIERS: readonly ["create_view_source", "update_view_source", "delete_view_source", "create", "update", "delete", "rename", "create_type", "update_type", "apply_type_pack", "put_timer", "cancel_timer", "reconcile_timers", "sync:mutate", "file_control:open_file_upload", "file_control:move_file", "file_control:delete_file", "file_control:commit_file_upload", "file_control:abort_file_transfer"];
|
|
7
|
+
export declare const MUTATING_OPERATION_IDENTIFIERS: readonly ["create_view_source", "update_view_source", "delete_view_source", "create", "update", "delete", "rename", "create_type", "update_type", "apply_type_pack", "apply_collection_setup", "put_timer", "cancel_timer", "reconcile_timers", "sync:mutate", "file_control:open_file_upload", "file_control:move_file", "file_control:delete_file", "file_control:commit_file_upload", "file_control:abort_file_transfer"];
|
|
8
8
|
export type MutationOperationIdentifier = typeof MUTATING_OPERATION_IDENTIFIERS[number];
|
|
9
9
|
export declare function isCollectionOperation(value: string): value is CollectionOperation;
|
|
10
10
|
export declare function areCollectionOperations(values: readonly string[]): values is readonly CollectionOperation[];
|
package/dist/operations.js
CHANGED
|
@@ -21,6 +21,8 @@ export const COLLECTION_OPERATIONS = [
|
|
|
21
21
|
"update_type",
|
|
22
22
|
"assess_type_pack",
|
|
23
23
|
"apply_type_pack",
|
|
24
|
+
"assess_collection_setup",
|
|
25
|
+
"apply_collection_setup",
|
|
24
26
|
"list_timers",
|
|
25
27
|
"put_timer",
|
|
26
28
|
"cancel_timer",
|
|
@@ -58,6 +60,8 @@ const COLLECTION_MUTATION_RULES = {
|
|
|
58
60
|
"update_type": "always",
|
|
59
61
|
"assess_type_pack": "never",
|
|
60
62
|
"apply_type_pack": "always",
|
|
63
|
+
"assess_collection_setup": "never",
|
|
64
|
+
"apply_collection_setup": "always",
|
|
61
65
|
"list_timers": "never",
|
|
62
66
|
"put_timer": "always",
|
|
63
67
|
"cancel_timer": "always",
|
|
@@ -85,6 +89,8 @@ const COLLECTION_INPUT_SCHEMA_VERSIONS = {
|
|
|
85
89
|
"update_type": 1,
|
|
86
90
|
"assess_type_pack": 1,
|
|
87
91
|
"apply_type_pack": 1,
|
|
92
|
+
"assess_collection_setup": 1,
|
|
93
|
+
"apply_collection_setup": 1,
|
|
88
94
|
"list_timers": 1,
|
|
89
95
|
"put_timer": 1,
|
|
90
96
|
"cancel_timer": 1,
|
|
@@ -119,6 +125,7 @@ export const MUTATING_OPERATION_IDENTIFIERS = [
|
|
|
119
125
|
"create_type",
|
|
120
126
|
"update_type",
|
|
121
127
|
"apply_type_pack",
|
|
128
|
+
"apply_collection_setup",
|
|
122
129
|
"put_timer",
|
|
123
130
|
"cancel_timer",
|
|
124
131
|
"reconcile_timers",
|
package/package.json
CHANGED
package/schemas/catalog.json
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
"connect_protocol": "./connect-protocol.v1.schema.json",
|
|
8
8
|
"connect_problem": "./connect-problem.v1.schema.json",
|
|
9
9
|
"connect_problem_catalog": "./connect-problems.v1.catalog.json",
|
|
10
|
+
"mdbase_query_v0_3": "./mdbase-query.v0.3.schema.json",
|
|
10
11
|
"encrypted_relay": "./encrypted-relay.v2.schema.json",
|
|
11
12
|
"files": "./files.v1.schema.json",
|
|
12
13
|
"notification_webhook": "./notification-webhook.v1.schema.json",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
|
|
23
23
|
},
|
|
24
24
|
"operation": {
|
|
25
|
-
"enum": ["describe", "changes", "read", "query", "list_views", "execute_view", "read_view_source", "create_view_source", "update_view_source", "delete_view_source", "validate", "create", "update", "delete", "rename", "read_type", "create_type", "update_type", "assess_type_pack", "apply_type_pack", "list_timers", "put_timer", "cancel_timer", "reconcile_timers", "sync"]
|
|
25
|
+
"enum": ["describe", "changes", "read", "query", "list_views", "execute_view", "read_view_source", "create_view_source", "update_view_source", "delete_view_source", "validate", "create", "update", "delete", "rename", "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"]
|
|
26
26
|
},
|
|
27
27
|
"connectContractRequirements": {
|
|
28
28
|
"type": "object",
|
|
@@ -289,11 +289,12 @@
|
|
|
289
289
|
"applicationAuthorizationBinding": {
|
|
290
290
|
"type": "object",
|
|
291
291
|
"additionalProperties": false,
|
|
292
|
-
"required": ["protocol_version", "authorization_id", "application_id", "application_manifest_digest", "application_installation_id", "installation_signing_public_key", "grant_agreement_public_key", "grant_signing_public_key", "flow", "authorization_nonce", "issued_at", "expires_at", "code_challenge", "contracts", "requested_operations"],
|
|
292
|
+
"required": ["protocol_version", "authorization_id", "application_id", "application_declaration_id", "application_manifest_digest", "application_installation_id", "installation_signing_public_key", "grant_agreement_public_key", "grant_signing_public_key", "flow", "authorization_nonce", "issued_at", "expires_at", "code_challenge", "contracts", "requested_operations"],
|
|
293
293
|
"properties": {
|
|
294
|
-
"protocol_version": { "const":
|
|
294
|
+
"protocol_version": { "const": 4 },
|
|
295
295
|
"authorization_id": { "$ref": "#/$defs/uuid" },
|
|
296
296
|
"application_id": { "$ref": "#/$defs/uuid" },
|
|
297
|
+
"application_declaration_id": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)+$" },
|
|
297
298
|
"application_manifest_digest": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
|
|
298
299
|
"application_installation_id": { "$ref": "#/$defs/uuid" },
|
|
299
300
|
"installation_signing_public_key": { "$ref": "#/$defs/p256PublicKey" },
|
|
@@ -352,6 +353,11 @@
|
|
|
352
353
|
"maxItems": 20,
|
|
353
354
|
"items": { "$ref": "#/$defs/contractRequirement" }
|
|
354
355
|
},
|
|
356
|
+
"configuration": {
|
|
357
|
+
"type": "array",
|
|
358
|
+
"maxItems": 100,
|
|
359
|
+
"items": { "$ref": "#/$defs/configurationRequirement" }
|
|
360
|
+
},
|
|
355
361
|
"access": { "enum": ["contract", "full_collection"] },
|
|
356
362
|
"collection_kind": { "const": "hosted" },
|
|
357
363
|
"files": {
|
|
@@ -426,9 +432,46 @@
|
|
|
426
432
|
"type": "array",
|
|
427
433
|
"maxItems": 100,
|
|
428
434
|
"items": { "$ref": "#/$defs/typePackProvision" }
|
|
435
|
+
},
|
|
436
|
+
"configuration": {
|
|
437
|
+
"type": "array",
|
|
438
|
+
"maxItems": 100,
|
|
439
|
+
"items": { "$ref": "#/$defs/configurationProvision" }
|
|
429
440
|
}
|
|
430
441
|
}
|
|
431
442
|
},
|
|
443
|
+
"configurationRequirement": {
|
|
444
|
+
"type": "object",
|
|
445
|
+
"additionalProperties": false,
|
|
446
|
+
"required": ["id", "path", "predicate", "value"],
|
|
447
|
+
"properties": {
|
|
448
|
+
"id": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" },
|
|
449
|
+
"path": { "type": "string", "pattern": "^/x-[^/]+(?:/.*)?$", "maxLength": 1024 },
|
|
450
|
+
"predicate": { "const": "contains" },
|
|
451
|
+
"value": { "oneOf": [
|
|
452
|
+
{ "type": "string" },
|
|
453
|
+
{ "type": "number" },
|
|
454
|
+
{ "type": "boolean" },
|
|
455
|
+
{ "type": "null" }
|
|
456
|
+
] }
|
|
457
|
+
}
|
|
458
|
+
},
|
|
459
|
+
"configurationProvision": {
|
|
460
|
+
"type": "object",
|
|
461
|
+
"additionalProperties": false,
|
|
462
|
+
"required": ["requirement", "operation", "path", "value"],
|
|
463
|
+
"properties": {
|
|
464
|
+
"requirement": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$" },
|
|
465
|
+
"operation": { "const": "set_add" },
|
|
466
|
+
"path": { "type": "string", "pattern": "^/x-[^/]+(?:/.*)?$", "maxLength": 1024 },
|
|
467
|
+
"value": { "oneOf": [
|
|
468
|
+
{ "type": "string" },
|
|
469
|
+
{ "type": "number" },
|
|
470
|
+
{ "type": "boolean" },
|
|
471
|
+
{ "type": "null" }
|
|
472
|
+
] }
|
|
473
|
+
}
|
|
474
|
+
},
|
|
432
475
|
"authorizationOfferRequest": {
|
|
433
476
|
"type": "object",
|
|
434
477
|
"additionalProperties": false,
|
|
@@ -461,12 +504,14 @@
|
|
|
461
504
|
"authorizationActivationRequest": {
|
|
462
505
|
"type": "object",
|
|
463
506
|
"additionalProperties": false,
|
|
464
|
-
"required": ["type", "protocol_version", "request_id", "authorization_id", "collection_id", "requirements", "provisions", "contract_setups", "grant"],
|
|
507
|
+
"required": ["type", "protocol_version", "request_id", "authorization_id", "application_declaration_id", "application_manifest_digest", "collection_id", "requirements", "provisions", "contract_setups", "grant"],
|
|
465
508
|
"properties": {
|
|
466
509
|
"type": { "const": "authorization_activation_request" },
|
|
467
510
|
"protocol_version": { "const": 1 },
|
|
468
511
|
"request_id": { "$ref": "#/$defs/uuid" },
|
|
469
512
|
"authorization_id": { "$ref": "#/$defs/uuid" },
|
|
513
|
+
"application_declaration_id": { "type": "string", "pattern": "^[a-z][a-z0-9]*(?:[._-][a-z0-9]+)+$" },
|
|
514
|
+
"application_manifest_digest": { "type": "string", "pattern": "^[0-9a-f]{64}$" },
|
|
470
515
|
"collection_id": { "$ref": "#/$defs/uuid" },
|
|
471
516
|
"requirements": { "$ref": "#/$defs/applicationRequirements" },
|
|
472
517
|
"provisions": { "$ref": "#/$defs/applicationProvisions" },
|
|
@@ -497,6 +542,8 @@
|
|
|
497
542
|
"maxItems": 20,
|
|
498
543
|
"items": { "$ref": "#/$defs/contractSetupChoice" }
|
|
499
544
|
},
|
|
545
|
+
"setup_assessment": true,
|
|
546
|
+
"provision_receipt": true,
|
|
500
547
|
"error": {
|
|
501
548
|
"type": "object",
|
|
502
549
|
"additionalProperties": false,
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
|
|
15
15
|
},
|
|
16
16
|
"operation": {
|
|
17
|
-
"enum": ["describe", "changes", "read", "query", "list_views", "execute_view", "read_view_source", "create_view_source", "update_view_source", "delete_view_source", "validate", "create", "update", "delete", "rename", "read_type", "create_type", "update_type", "assess_type_pack", "apply_type_pack", "list_timers", "put_timer", "cancel_timer", "reconcile_timers", "file_control"]
|
|
17
|
+
"enum": ["describe", "changes", "read", "query", "list_views", "execute_view", "read_view_source", "create_view_source", "update_view_source", "delete_view_source", "validate", "create", "update", "delete", "rename", "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", "file_control"]
|
|
18
18
|
},
|
|
19
19
|
"envelope": {
|
|
20
20
|
"type": "object",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}$"
|
|
15
15
|
},
|
|
16
16
|
"operation": {
|
|
17
|
-
"enum": ["describe", "changes", "read", "query", "list_views", "execute_view", "read_view_source", "create_view_source", "update_view_source", "delete_view_source", "validate", "create", "update", "delete", "rename", "read_type", "create_type", "update_type", "assess_type_pack", "apply_type_pack", "list_timers", "put_timer", "cancel_timer", "reconcile_timers", "sync", "file_control"]
|
|
17
|
+
"enum": ["describe", "changes", "read", "query", "list_views", "execute_view", "read_view_source", "create_view_source", "update_view_source", "delete_view_source", "validate", "create", "update", "delete", "rename", "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", "file_control"]
|
|
18
18
|
},
|
|
19
19
|
"envelope": {
|
|
20
20
|
"type": "object",
|
|
@@ -323,7 +323,7 @@
|
|
|
323
323
|
"transferStatus": {
|
|
324
324
|
"type": "object",
|
|
325
325
|
"additionalProperties": false,
|
|
326
|
-
"required": ["protocol_version", "type", "transfer_id", "state", "received", "received_bytes"],
|
|
326
|
+
"required": ["protocol_version", "type", "transfer_id", "state", "received", "received_bytes", "uploaded_parts"],
|
|
327
327
|
"properties": {
|
|
328
328
|
"protocol_version": { "const": 1 },
|
|
329
329
|
"type": { "const": "file_transfer_status" },
|
|
@@ -334,7 +334,12 @@
|
|
|
334
334
|
"uniqueItems": true,
|
|
335
335
|
"items": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }
|
|
336
336
|
},
|
|
337
|
-
"received_bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 }
|
|
337
|
+
"received_bytes": { "type": "integer", "minimum": 0, "maximum": 9007199254740991 },
|
|
338
|
+
"uploaded_parts": {
|
|
339
|
+
"type": "array",
|
|
340
|
+
"maxItems": 10000,
|
|
341
|
+
"items": { "$ref": "#/$defs/uploadedPart" }
|
|
342
|
+
}
|
|
338
343
|
}
|
|
339
344
|
},
|
|
340
345
|
"prepareUploadPartRequest": {
|
|
@@ -39,6 +39,11 @@
|
|
|
39
39
|
"additionalProperties": false,
|
|
40
40
|
"required": ["type_packs"],
|
|
41
41
|
"properties": {
|
|
42
|
+
"configuration": {
|
|
43
|
+
"type": "array",
|
|
44
|
+
"maxItems": 50,
|
|
45
|
+
"items": { "$ref": "#/$defs/configurationProvision" }
|
|
46
|
+
},
|
|
42
47
|
"type_packs": {
|
|
43
48
|
"type": "array",
|
|
44
49
|
"maxItems": 20,
|
|
@@ -118,6 +123,11 @@
|
|
|
118
123
|
"description": "Require a durable provider-backed collection with direct sync support."
|
|
119
124
|
},
|
|
120
125
|
"files": { "$ref": "#/$defs/fileRequirement" },
|
|
126
|
+
"configuration": {
|
|
127
|
+
"type": "array",
|
|
128
|
+
"maxItems": 50,
|
|
129
|
+
"items": { "$ref": "#/$defs/configurationRequirement" }
|
|
130
|
+
},
|
|
121
131
|
"contracts": {
|
|
122
132
|
"type": "array",
|
|
123
133
|
"maxItems": 20,
|
|
@@ -146,6 +156,46 @@
|
|
|
146
156
|
}
|
|
147
157
|
}
|
|
148
158
|
},
|
|
159
|
+
"configurationValue": {
|
|
160
|
+
"anyOf": [
|
|
161
|
+
{ "type": "string" },
|
|
162
|
+
{ "type": "number" },
|
|
163
|
+
{ "type": "boolean" },
|
|
164
|
+
{ "type": "null" }
|
|
165
|
+
]
|
|
166
|
+
},
|
|
167
|
+
"configurationRequirement": {
|
|
168
|
+
"type": "object",
|
|
169
|
+
"additionalProperties": false,
|
|
170
|
+
"required": ["id", "path", "predicate", "value"],
|
|
171
|
+
"properties": {
|
|
172
|
+
"id": {
|
|
173
|
+
"type": "string",
|
|
174
|
+
"minLength": 1,
|
|
175
|
+
"maxLength": 100,
|
|
176
|
+
"pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
|
|
177
|
+
},
|
|
178
|
+
"path": { "type": "string", "minLength": 1, "maxLength": 1024 },
|
|
179
|
+
"predicate": { "const": "contains" },
|
|
180
|
+
"value": { "$ref": "#/$defs/configurationValue" }
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"configurationProvision": {
|
|
184
|
+
"type": "object",
|
|
185
|
+
"additionalProperties": false,
|
|
186
|
+
"required": ["requirement", "operation", "path", "value"],
|
|
187
|
+
"properties": {
|
|
188
|
+
"requirement": {
|
|
189
|
+
"type": "string",
|
|
190
|
+
"minLength": 1,
|
|
191
|
+
"maxLength": 100,
|
|
192
|
+
"pattern": "^[a-z][a-z0-9]*(?:-[a-z0-9]+)*$"
|
|
193
|
+
},
|
|
194
|
+
"operation": { "const": "set_add" },
|
|
195
|
+
"path": { "type": "string", "minLength": 1, "maxLength": 1024 },
|
|
196
|
+
"value": { "$ref": "#/$defs/configurationValue" }
|
|
197
|
+
}
|
|
198
|
+
},
|
|
149
199
|
"applicationCapability": {
|
|
150
200
|
"enum": [
|
|
151
201
|
"collection.inspect",
|
|
@@ -169,6 +219,7 @@
|
|
|
169
219
|
"definitions.update",
|
|
170
220
|
"definitions.type-pack.inspect",
|
|
171
221
|
"definitions.type-pack.apply",
|
|
222
|
+
"collection.setup.apply",
|
|
172
223
|
"timers.list",
|
|
173
224
|
"timers.put",
|
|
174
225
|
"timers.cancel",
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://mdbase.dev/schemas/v0.3/query.schema.json",
|
|
4
|
+
"title": "mdbase v0.3 query object",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"types": { "$ref": "#/$defs/typeList" },
|
|
8
|
+
"context": { "$ref": "#/$defs/queryContext" },
|
|
9
|
+
"projections": { "$ref": "#/$defs/projectionSet" },
|
|
10
|
+
"where": { "$ref": "#/$defs/expression" },
|
|
11
|
+
"select": { "$ref": "#/$defs/select" },
|
|
12
|
+
"order_by": { "$ref": "#/$defs/orderBy" },
|
|
13
|
+
"group_by": { "$ref": "#/$defs/groupBy" },
|
|
14
|
+
"summary_functions": { "$ref": "#/$defs/summaryFunctionSet" },
|
|
15
|
+
"summaries": { "$ref": "#/$defs/summaries" },
|
|
16
|
+
"limit": { "type": "integer", "minimum": 0 },
|
|
17
|
+
"offset": { "type": "integer", "minimum": 0 },
|
|
18
|
+
"include_body": { "type": "boolean", "default": false },
|
|
19
|
+
"frontmatter_mode": {
|
|
20
|
+
"enum": ["effective", "persisted", "both"],
|
|
21
|
+
"default": "effective"
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"patternProperties": {
|
|
25
|
+
"^x-[A-Za-z][A-Za-z0-9._:-]{0,127}$": { "$ref": "#/$defs/extension" }
|
|
26
|
+
},
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"$defs": {
|
|
29
|
+
"identifier": {
|
|
30
|
+
"type": "string",
|
|
31
|
+
"pattern": "^[A-Za-z][A-Za-z0-9._:-]*$"
|
|
32
|
+
},
|
|
33
|
+
"typeName": {
|
|
34
|
+
"type": "string",
|
|
35
|
+
"pattern": "^[A-Za-z][A-Za-z0-9_-]{0,127}$"
|
|
36
|
+
},
|
|
37
|
+
"fieldName": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"pattern": "^[A-Za-z_][A-Za-z0-9_:-]*$"
|
|
40
|
+
},
|
|
41
|
+
"expression": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"minLength": 1
|
|
44
|
+
},
|
|
45
|
+
"extension": {
|
|
46
|
+
"type": "object",
|
|
47
|
+
"additionalProperties": true
|
|
48
|
+
},
|
|
49
|
+
"typeList": {
|
|
50
|
+
"type": "array",
|
|
51
|
+
"minItems": 1,
|
|
52
|
+
"uniqueItems": true,
|
|
53
|
+
"items": { "$ref": "#/$defs/typeName" }
|
|
54
|
+
},
|
|
55
|
+
"queryContext": {
|
|
56
|
+
"type": "object",
|
|
57
|
+
"required": ["this"],
|
|
58
|
+
"properties": {
|
|
59
|
+
"this": {
|
|
60
|
+
"type": "object",
|
|
61
|
+
"required": ["path"],
|
|
62
|
+
"properties": {
|
|
63
|
+
"path": { "type": "string", "minLength": 1 }
|
|
64
|
+
},
|
|
65
|
+
"additionalProperties": false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
"additionalProperties": false
|
|
69
|
+
},
|
|
70
|
+
"projectionSet": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"propertyNames": { "$ref": "#/$defs/fieldName" },
|
|
73
|
+
"additionalProperties": { "$ref": "#/$defs/projection" }
|
|
74
|
+
},
|
|
75
|
+
"projection": {
|
|
76
|
+
"type": "object",
|
|
77
|
+
"required": ["expr"],
|
|
78
|
+
"properties": {
|
|
79
|
+
"expr": { "$ref": "#/$defs/expression" },
|
|
80
|
+
"description": { "type": "string" }
|
|
81
|
+
},
|
|
82
|
+
"patternProperties": {
|
|
83
|
+
"^x-[A-Za-z][A-Za-z0-9._:-]{0,127}$": { "$ref": "#/$defs/extension" }
|
|
84
|
+
},
|
|
85
|
+
"additionalProperties": false
|
|
86
|
+
},
|
|
87
|
+
"select": {
|
|
88
|
+
"type": "array",
|
|
89
|
+
"minItems": 1,
|
|
90
|
+
"items": {
|
|
91
|
+
"oneOf": [
|
|
92
|
+
{ "type": "string", "minLength": 1 },
|
|
93
|
+
{ "$ref": "#/$defs/selectExpression" }
|
|
94
|
+
]
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
"selectExpression": {
|
|
98
|
+
"type": "object",
|
|
99
|
+
"required": ["name", "expr"],
|
|
100
|
+
"properties": {
|
|
101
|
+
"name": { "$ref": "#/$defs/fieldName" },
|
|
102
|
+
"expr": { "$ref": "#/$defs/expression" },
|
|
103
|
+
"label": { "type": "string" },
|
|
104
|
+
"description": { "type": "string" }
|
|
105
|
+
},
|
|
106
|
+
"patternProperties": {
|
|
107
|
+
"^x-[A-Za-z][A-Za-z0-9._:-]{0,127}$": { "$ref": "#/$defs/extension" }
|
|
108
|
+
},
|
|
109
|
+
"additionalProperties": false
|
|
110
|
+
},
|
|
111
|
+
"orderBy": {
|
|
112
|
+
"type": "array",
|
|
113
|
+
"minItems": 1,
|
|
114
|
+
"items": {
|
|
115
|
+
"type": "object",
|
|
116
|
+
"required": ["field"],
|
|
117
|
+
"properties": {
|
|
118
|
+
"field": { "type": "string", "minLength": 1 },
|
|
119
|
+
"direction": { "enum": ["asc", "desc"], "default": "asc" }
|
|
120
|
+
},
|
|
121
|
+
"additionalProperties": false
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
"groupBy": {
|
|
125
|
+
"type": "array",
|
|
126
|
+
"minItems": 1,
|
|
127
|
+
"items": {
|
|
128
|
+
"type": "object",
|
|
129
|
+
"required": ["field"],
|
|
130
|
+
"properties": {
|
|
131
|
+
"field": { "type": "string", "minLength": 1 },
|
|
132
|
+
"direction": { "enum": ["asc", "desc"], "default": "asc" }
|
|
133
|
+
},
|
|
134
|
+
"additionalProperties": false
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
"summaryFunctionSet": {
|
|
138
|
+
"type": "object",
|
|
139
|
+
"propertyNames": { "$ref": "#/$defs/fieldName" },
|
|
140
|
+
"additionalProperties": { "$ref": "#/$defs/summaryFunction" }
|
|
141
|
+
},
|
|
142
|
+
"summaryFunction": {
|
|
143
|
+
"type": "object",
|
|
144
|
+
"required": ["expr"],
|
|
145
|
+
"properties": {
|
|
146
|
+
"expr": { "$ref": "#/$defs/expression" },
|
|
147
|
+
"description": { "type": "string" }
|
|
148
|
+
},
|
|
149
|
+
"patternProperties": {
|
|
150
|
+
"^x-[A-Za-z][A-Za-z0-9._:-]{0,127}$": { "$ref": "#/$defs/extension" }
|
|
151
|
+
},
|
|
152
|
+
"additionalProperties": false
|
|
153
|
+
},
|
|
154
|
+
"summaries": {
|
|
155
|
+
"type": "array",
|
|
156
|
+
"minItems": 1,
|
|
157
|
+
"items": { "$ref": "#/$defs/summary" }
|
|
158
|
+
},
|
|
159
|
+
"summary": {
|
|
160
|
+
"type": "object",
|
|
161
|
+
"required": ["field", "function"],
|
|
162
|
+
"properties": {
|
|
163
|
+
"field": { "type": "string", "minLength": 1 },
|
|
164
|
+
"function": { "$ref": "#/$defs/identifier" },
|
|
165
|
+
"name": { "$ref": "#/$defs/fieldName" },
|
|
166
|
+
"label": { "type": "string" }
|
|
167
|
+
},
|
|
168
|
+
"additionalProperties": false
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
}
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
{ "id": "update_type", "input_schema_version": 1, "mutation": "always" },
|
|
22
22
|
{ "id": "assess_type_pack", "input_schema_version": 1, "mutation": "never" },
|
|
23
23
|
{ "id": "apply_type_pack", "input_schema_version": 1, "mutation": "always" },
|
|
24
|
+
{ "id": "assess_collection_setup", "input_schema_version": 1, "mutation": "never" },
|
|
25
|
+
{ "id": "apply_collection_setup", "input_schema_version": 1, "mutation": "always" },
|
|
24
26
|
{ "id": "list_timers", "input_schema_version": 1, "mutation": "never" },
|
|
25
27
|
{ "id": "put_timer", "input_schema_version": 1, "mutation": "always" },
|
|
26
28
|
{ "id": "cancel_timer", "input_schema_version": 1, "mutation": "always" },
|