@mdbase-dev/connect 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/README.md +37 -15
- package/dist/advanced.d.ts +2 -0
- package/dist/advanced.js +2 -0
- package/dist/application-session.d.ts +31 -11
- package/dist/application-session.js +188 -73
- package/dist/browser/integrity.json +1 -1
- package/dist/browser/mdbase-connect.min.js +3 -3
- package/dist/browser/mdbase-connect.min.js.sha384 +1 -1
- package/dist/collection-client.d.ts +9 -6
- package/dist/collection-client.js +522 -77
- package/dist/connect-authorization-helpers.d.ts +3 -0
- package/dist/connect-authorization-helpers.js +13 -0
- package/dist/connect.js +4 -6
- package/dist/connection.d.ts +7 -6
- package/dist/connection.js +103 -89
- package/dist/crypto-entry.d.ts +6 -3
- package/dist/crypto-entry.js +3 -3
- package/dist/file-transfer-internals.d.ts +2 -1
- package/dist/file-transfer-internals.js +38 -0
- package/dist/files.d.ts +20 -2
- package/dist/files.js +43 -19
- package/dist/index.d.ts +24 -16
- package/dist/index.js +10 -14
- package/dist/internal-types.d.ts +1 -0
- package/dist/operation-helpers.js +5 -5
- package/dist/operation-types.d.ts +404 -39
- package/dist/session.d.ts +1 -1
- package/dist/session.js +2 -1
- package/dist/watch-policy.d.ts +8 -0
- package/dist/watch-policy.js +12 -0
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,25 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export
|
|
12
|
-
export
|
|
13
|
-
export
|
|
14
|
-
export {
|
|
15
|
-
export
|
|
1
|
+
export type { MdbaseDeviceAuthorization } from "./authorization-types.js";
|
|
2
|
+
export { MdbaseApplicationSession, MdbaseMemoryVerificationStore } from "./application-session.js";
|
|
3
|
+
export type { MdbaseApplicationSessionOptions, MdbaseApplicationVerificationStore, MdbaseDefinitionUpdate, MdbaseCollectionSetupUpdate, MdbaseApplicationSessionSnapshot } from "./application-session.js";
|
|
4
|
+
export type { MdbaseConnectOptions, MdbaseConnectTimeouts, MdbaseFrontmatter } from "./connect-options.js";
|
|
5
|
+
export { MdbaseConnect } from "./mdbase-connect.js";
|
|
6
|
+
export { MdbaseConnection } from "./connection.js";
|
|
7
|
+
export type { MdbaseAuthorizationTarget, MdbaseAuthorizeOptions, MdbaseConnectionAuthorizeOptions, MdbaseConnectEnvironment, MdbaseAuthorizationResult, MdbaseAuthorizationOutcome } from "./connection.js";
|
|
8
|
+
export type { MdbaseConnectionRoute, DirectAccessStatus, MdbaseConnectionInfo, MdbaseAuthorizationCapabilities, MdbaseSyncTransport, MdbaseSyncConnection } from "./connection-types.js";
|
|
9
|
+
export { effectiveCapabilities } from "./capabilities.js";
|
|
10
|
+
export type { MdbaseCapabilityState, MdbaseCapabilityEvidence, MdbaseEffectiveCapability, MdbaseEffectiveCapabilities } from "./capabilities.js";
|
|
11
|
+
export { MdbaseConnectError, isRetryableConnectError } from "./errors.js";
|
|
12
|
+
export type { ConnectErrorContext } from "./errors.js";
|
|
13
|
+
export { MdbaseFileClient } from "./files.js";
|
|
14
|
+
export type { MdbaseFileSource, CollectionFileDescriptor, MdbaseFileDeleteReceipt, MdbaseFileStreamSource, MdbaseFileProgress, MdbaseFileListOptions, MdbaseFileUploadOptions, MdbaseFileStreamUploadOptions, MdbaseFileDownloadOptions, MdbaseFileMoveOptions, MdbaseFileDeleteOptions } from "./files.js";
|
|
15
|
+
export { parseMdbasePushPayload, parseMdbaseNativeNotificationData, showMdbasePushNotification } from "./notifications.js";
|
|
16
|
+
export type { MdbaseNotificationRegistrationOptions, MdbaseNotificationRegistration, MdbaseNativeNotificationRegistrationOptions, MdbaseNativeNotificationRegistration, MdbaseNativeNotificationData, MdbasePushPayload } from "./notifications.js";
|
|
17
|
+
export type { ConnectSuccess, ConnectFailure, ConnectOutcome, CommonOperationProblemCode, RegistrationProblemCode, AuthorizationProblemCode, NotificationProblemCode, DirectAccessProblemCode, SessionProblemCode, CollectionSetupProblemCode, CollectionDescriptionProblemCode, CollectionReadProblemCode, CollectionQueryProblemCode, CollectionMutationProblemCode, CollectionChangesProblemCode, CollectionTypeProblemCode } from "./outcomes.js";
|
|
18
|
+
export type { MdbaseDesiredTimer, MdbaseTimer, MdbaseTimerList, MdbaseTimerReconciliation, ReadInput, DataContractSelector, CollectionFileMetadata, DataContractViewIdentity, QueryRecord, RecordDocument, QueryInput, QueryProjection, QuerySelectionExpression, QueryOrder, QuerySummary, QueryResult, QueryPagesOptions, QueryAllOptions, QueryPage, ConnectRequestOptions, MutationEstimate, MutationProgressState, MutationProgress, MutationProgressOptions, RenameProgressOptions, DeleteProgressOptions, PendingMutationSummary, PendingMutation, CreateInput, UpdateInput, DeleteInput, DeleteResult, DeletePreflightResult, RenameInput, RenameResult, RenamePreflightResult, ReadTypeInput, CreateTypeInput, UpdateTypeInput, ReadViewSourceInput, CreateViewSourceInput, UpdateViewSourceInput, DeleteViewSourceInput, DeleteViewSourceResult, ExecuteViewInput, SavedViewPresentation, SavedViewSource, SavedViewProperty, SavedNamedView, SavedViewDocument, SavedViewList, SavedViewSourceDocument, SavedViewExecution, ContractSetupChoice, TypePackResourceDiff, TypePackReceipt, TypePackAssessment, TypePackApplyResult, ConfigurationContributionValue, ConfigurationRequirement, ConfigurationProvision, ApplicationCollectionSetupRequirements, ApplicationCollectionSetupProvisions, ConfigurationSetupConflict, ConfigurationSetupAssessment, CollectionSetupAssessment, CollectionSetupReceipt, CollectionSetupApplyResult, AssessTypePackInput, ApplyTypePackInput, AssessCollectionSetupInput, ApplyCollectionSetupInput, ChangesInput, WatchOptions, WatchRetryOptions, WatchStatus, WatchInput, MdbaseWatchSubscription, CollectionChange, CollectionChangesPage, CollectionDescription, CollectionContractDescriptor, CollectionContractImplementationDescriptor, CollectionTypeDescriptor } from "./operation-types.js";
|
|
19
|
+
export { externalStore } from "./external-store.js";
|
|
20
|
+
export type { MdbaseExternalStore } from "./external-store.js";
|
|
21
|
+
export { MdbaseBrowserSelection, MdbaseMemorySelection } from "./selection.js";
|
|
22
|
+
export type { MdbaseSelectionHistory, MdbaseApplicationSelection, MdbaseBrowserSelectionOptions } from "./selection.js";
|
|
16
23
|
export type { MdbaseUnavailableReason } from "./session.js";
|
|
17
|
-
export
|
|
24
|
+
export { MDBASE_RECORD_CREATED_CONTRACT, MDBASE_TIMER_FIRED_CONTRACT, operationsForApplicationCapabilities } from "@mdbase-dev/connect-protocol";
|
|
25
|
+
export type { ApplicationProvisions, ApplicationCapabilityId, ApplicationCapabilityRequirements, ApplicationRequirements, ApplicationNotifications, ApplicationAuthorizationBinding, ApplicationAuthorizationProof, FileAction, FileCapability, CollectionOperation as MdbaseOperation, CollectionTypeDocument, ConnectOperationOutcome, ConnectProblem, ConnectProblemCategory, ConnectProblemCode, ConnectProblemDetailsByCode, ConnectRecoveryAction, ContractRequirement, GrantScope, JsonObject, MdbaseAppManifest, NotificationCriterion, MdbaseDiagnostic, MdbaseOperationEnvelope, KnownConnectProblem, TypePackManifest, TypePackManifestResource, TypePackProvision, TypePackSourceResource, UnknownConnectProblem } from "@mdbase-dev/connect-protocol";
|
package/dist/index.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
6
|
-
export
|
|
7
|
-
export
|
|
8
|
-
export
|
|
9
|
-
export
|
|
10
|
-
export
|
|
11
|
-
export * from "./outcomes.js";
|
|
12
|
-
export * from "./operation-types.js";
|
|
13
|
-
export * from "./external-store.js";
|
|
14
|
-
export * from "./selection.js";
|
|
1
|
+
export { MdbaseApplicationSession, MdbaseMemoryVerificationStore } from "./application-session.js";
|
|
2
|
+
export { MdbaseConnect } from "./mdbase-connect.js";
|
|
3
|
+
export { MdbaseConnection } from "./connection.js";
|
|
4
|
+
export { effectiveCapabilities } from "./capabilities.js";
|
|
5
|
+
export { MdbaseConnectError, isRetryableConnectError } from "./errors.js";
|
|
6
|
+
export { MdbaseFileClient } from "./files.js";
|
|
7
|
+
export { parseMdbasePushPayload, parseMdbaseNativeNotificationData, showMdbasePushNotification } from "./notifications.js";
|
|
8
|
+
export { externalStore } from "./external-store.js";
|
|
9
|
+
export { MdbaseBrowserSelection, MdbaseMemorySelection } from "./selection.js";
|
|
10
|
+
export { MDBASE_RECORD_CREATED_CONTRACT, MDBASE_TIMER_FIRED_CONTRACT, operationsForApplicationCapabilities } from "@mdbase-dev/connect-protocol";
|
package/dist/internal-types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { ApplicationNotifications, ApplicationRequirements, CollectionOpera
|
|
|
2
2
|
import { encryptRelayRequest } from "./crypto.js";
|
|
3
3
|
export interface Application {
|
|
4
4
|
id: string;
|
|
5
|
+
family_identity: string;
|
|
5
6
|
manifest_digest: string;
|
|
6
7
|
name: string;
|
|
7
8
|
distribution?: "web" | "portable";
|
|
@@ -66,21 +66,21 @@ export function isCancellation(error, signal) {
|
|
|
66
66
|
|| (error instanceof MdbaseConnectError && error.code === "operation_cancelled");
|
|
67
67
|
}
|
|
68
68
|
export function assertRenamePreview(input, preview) {
|
|
69
|
-
if (preview.
|
|
69
|
+
if (preview.dryRun !== true || preview.wouldRename !== true
|
|
70
70
|
|| preview.from !== input.from || preview.to !== input.to) {
|
|
71
71
|
throw connectError("invalid_preflight", "The rename preview does not match this mutation. Run the preview again.");
|
|
72
72
|
}
|
|
73
73
|
}
|
|
74
74
|
export function assertDeletePreview(input, preview) {
|
|
75
|
-
if (preview.
|
|
75
|
+
if (preview.dryRun !== true || preview.wouldDelete !== true || preview.path !== input.path) {
|
|
76
76
|
throw connectError("invalid_preflight", "The delete preview does not match this mutation. Run the preview again.");
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
export function renameEstimate(input, preview) {
|
|
80
|
-
if (input.
|
|
80
|
+
if (input.updateRefs === false) {
|
|
81
81
|
return { affectedRecords: 0, totalUnits: 1, warnings: 0 };
|
|
82
82
|
}
|
|
83
|
-
const references = preview.
|
|
83
|
+
const references = preview.referencesAffected ?? [];
|
|
84
84
|
return {
|
|
85
85
|
affectedRecords: new Set(references.map((reference) => reference.path)).size,
|
|
86
86
|
totalUnits: 1 + references.length,
|
|
@@ -89,7 +89,7 @@ export function renameEstimate(input, preview) {
|
|
|
89
89
|
}
|
|
90
90
|
export function deleteEstimate(preview) {
|
|
91
91
|
return {
|
|
92
|
-
affectedRecords: new Set((preview.
|
|
92
|
+
affectedRecords: new Set((preview.brokenLinks ?? []).map((reference) => reference.path)).size,
|
|
93
93
|
totalUnits: 1,
|
|
94
94
|
warnings: 0
|
|
95
95
|
};
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { CollectionOperation, ConnectProblem, ContractRequirement, JsonObject, MutationOperationIdentifier, TypePackProvision } from "@mdbase-dev/connect-protocol";
|
|
2
2
|
export interface MdbaseDesiredTimer {
|
|
3
3
|
/** Stable within the timer namespace. */
|
|
4
4
|
id: string;
|
|
5
5
|
/** RFC 3339 instant at which the authority should fire the timer. */
|
|
6
|
-
|
|
6
|
+
fireAt: string;
|
|
7
7
|
/** Private application data retained by the collection authority. */
|
|
8
8
|
data?: unknown;
|
|
9
9
|
}
|
|
10
10
|
export interface MdbaseTimer extends MdbaseDesiredTimer {
|
|
11
|
-
|
|
11
|
+
criterionId: string;
|
|
12
12
|
generation: number;
|
|
13
13
|
status: "scheduled" | "firing" | "fired" | "cancelled";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
firedAt: string | null;
|
|
17
17
|
}
|
|
18
18
|
export interface MdbaseTimerList {
|
|
19
19
|
namespace: string;
|
|
20
20
|
timers: MdbaseTimer[];
|
|
21
21
|
}
|
|
22
22
|
export interface MdbaseTimerReconciliation extends MdbaseTimerList {
|
|
23
|
-
|
|
23
|
+
cancelledIds: string[];
|
|
24
24
|
}
|
|
25
25
|
export interface ReadInput {
|
|
26
26
|
path: string;
|
|
27
27
|
/** Select an exact approved contract view when more than one is possible. */
|
|
28
28
|
contract?: DataContractSelector;
|
|
29
29
|
/** Include the exact UTF-8 Markdown source; requires full-collection access. */
|
|
30
|
-
|
|
30
|
+
includeDocument?: boolean;
|
|
31
31
|
}
|
|
32
32
|
export interface DataContractSelector {
|
|
33
33
|
id: string;
|
|
@@ -35,39 +35,153 @@ export interface DataContractSelector {
|
|
|
35
35
|
/** Required when several approved types implement the selected contract. */
|
|
36
36
|
type?: string;
|
|
37
37
|
}
|
|
38
|
+
export interface CollectionFileMetadata extends JsonObject {
|
|
39
|
+
name: string;
|
|
40
|
+
folder: string;
|
|
41
|
+
size: number;
|
|
42
|
+
mtime: string;
|
|
43
|
+
tags?: string[];
|
|
44
|
+
links?: unknown[];
|
|
45
|
+
embeds?: unknown[];
|
|
46
|
+
}
|
|
47
|
+
export interface DataContractViewIdentity {
|
|
48
|
+
id: string;
|
|
49
|
+
version: string;
|
|
50
|
+
digest: string;
|
|
51
|
+
type: string;
|
|
52
|
+
implementationDigest: string;
|
|
53
|
+
}
|
|
54
|
+
export interface QueryRecord<Frontmatter extends JsonObject = JsonObject> {
|
|
55
|
+
path: string;
|
|
56
|
+
frontmatter?: Frontmatter;
|
|
57
|
+
effectiveFrontmatter?: Frontmatter;
|
|
58
|
+
body?: string;
|
|
59
|
+
types: string[];
|
|
60
|
+
file: Partial<CollectionFileMetadata> & {
|
|
61
|
+
path?: string;
|
|
62
|
+
};
|
|
63
|
+
contract?: DataContractViewIdentity;
|
|
64
|
+
}
|
|
65
|
+
export interface RecordDocument<Frontmatter extends JsonObject = JsonObject> {
|
|
66
|
+
path: string;
|
|
67
|
+
revision: string;
|
|
68
|
+
types: string[];
|
|
69
|
+
frontmatter: Frontmatter;
|
|
70
|
+
effectiveFrontmatter: Frontmatter;
|
|
71
|
+
body?: string;
|
|
72
|
+
document?: string;
|
|
73
|
+
file: Partial<CollectionFileMetadata> & {
|
|
74
|
+
path?: string;
|
|
75
|
+
};
|
|
76
|
+
contract?: DataContractViewIdentity;
|
|
77
|
+
}
|
|
78
|
+
export interface CollectionTypeDescriptor {
|
|
79
|
+
name: string;
|
|
80
|
+
version?: number;
|
|
81
|
+
description?: string;
|
|
82
|
+
revision?: string;
|
|
83
|
+
path?: string;
|
|
84
|
+
definition?: JsonObject;
|
|
85
|
+
schema: JsonObject;
|
|
86
|
+
collection?: JsonObject;
|
|
87
|
+
lifecycle?: JsonObject;
|
|
88
|
+
extensions: Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
export interface CollectionContractImplementationDescriptor {
|
|
91
|
+
typeName: string;
|
|
92
|
+
typeVersion: number;
|
|
93
|
+
typePath?: string;
|
|
94
|
+
digest: string;
|
|
95
|
+
fields: Record<string, string>;
|
|
96
|
+
binding?: JsonObject;
|
|
97
|
+
}
|
|
98
|
+
export interface CollectionContractDescriptor {
|
|
99
|
+
contractType: "record";
|
|
100
|
+
id: string;
|
|
101
|
+
version: string;
|
|
102
|
+
digest: string;
|
|
103
|
+
schema: JsonObject;
|
|
104
|
+
bindingSchema?: JsonObject;
|
|
105
|
+
implementations: CollectionContractImplementationDescriptor[];
|
|
106
|
+
}
|
|
107
|
+
export interface CollectionDescription {
|
|
108
|
+
protocolVersion: 1;
|
|
109
|
+
collectionId: string;
|
|
110
|
+
displayName: string;
|
|
111
|
+
specVersion: string;
|
|
112
|
+
operations: CollectionOperation[];
|
|
113
|
+
changeCursor: number;
|
|
114
|
+
types: CollectionTypeDescriptor[];
|
|
115
|
+
contracts: CollectionContractDescriptor[];
|
|
116
|
+
configuration?: JsonObject;
|
|
117
|
+
}
|
|
118
|
+
export interface QueryProjection {
|
|
119
|
+
expression: string;
|
|
120
|
+
description?: string;
|
|
121
|
+
}
|
|
122
|
+
export interface QuerySelectionExpression {
|
|
123
|
+
name: string;
|
|
124
|
+
expression: string;
|
|
125
|
+
label?: string;
|
|
126
|
+
description?: string;
|
|
127
|
+
}
|
|
128
|
+
export interface QueryOrder {
|
|
129
|
+
field: string;
|
|
130
|
+
direction?: "asc" | "desc";
|
|
131
|
+
}
|
|
132
|
+
export interface QuerySummary {
|
|
133
|
+
field: string;
|
|
134
|
+
function: string;
|
|
135
|
+
name?: string;
|
|
136
|
+
label?: string;
|
|
137
|
+
}
|
|
138
|
+
/** Application-facing form of the canonical mdbase v0.3 query schema. */
|
|
38
139
|
export interface QueryInput {
|
|
39
140
|
/**
|
|
40
141
|
* Contract-scoped queries accept only `types`, pagination,
|
|
41
|
-
* `
|
|
142
|
+
* `frontmatterMode`, and `contract`; filter normalized fields in the app.
|
|
42
143
|
*/
|
|
43
144
|
types?: string[];
|
|
44
|
-
|
|
45
|
-
|
|
145
|
+
context?: {
|
|
146
|
+
this: {
|
|
147
|
+
path: string;
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
projections?: Record<string, QueryProjection>;
|
|
151
|
+
where?: string;
|
|
152
|
+
select?: Array<string | QuerySelectionExpression>;
|
|
153
|
+
orderBy?: QueryOrder[];
|
|
154
|
+
groupBy?: QueryOrder[];
|
|
155
|
+
summaryFunctions?: Record<string, QueryProjection>;
|
|
156
|
+
summaries?: QuerySummary[];
|
|
46
157
|
limit?: number;
|
|
47
158
|
offset?: number;
|
|
48
159
|
/** Opaque token returned by the first metadata page for consistent, fast pagination. */
|
|
49
160
|
snapshot?: string;
|
|
50
|
-
|
|
51
|
-
|
|
161
|
+
includeBody?: boolean;
|
|
162
|
+
frontmatterMode?: "effective" | "persisted" | "both";
|
|
52
163
|
/** Narrow a contract-scoped query to one exact contract/provider view. */
|
|
53
164
|
contract?: DataContractSelector;
|
|
54
|
-
[key: string]: unknown;
|
|
55
165
|
}
|
|
56
166
|
export interface QueryResult<Record extends JsonObject = JsonObject> {
|
|
57
|
-
results: Array<QueryRecord<Record
|
|
167
|
+
results: Array<QueryRecord<Record>>;
|
|
58
168
|
meta?: {
|
|
59
|
-
|
|
60
|
-
|
|
169
|
+
totalCount: number;
|
|
170
|
+
hasMore: boolean;
|
|
61
171
|
snapshot?: string;
|
|
62
|
-
[key: string]: unknown;
|
|
63
172
|
};
|
|
64
|
-
[key: string]: unknown;
|
|
65
173
|
}
|
|
66
174
|
export interface QueryPagesOptions<Record extends JsonObject = JsonObject> {
|
|
67
175
|
firstPageSize?: number;
|
|
68
176
|
pageSize?: number;
|
|
69
177
|
signal?: AbortSignal;
|
|
70
|
-
|
|
178
|
+
/** Independent budget for each page requested by this caller-driven iterator. */
|
|
179
|
+
pageTimeoutMs?: number | null;
|
|
180
|
+
onProgress?: (page: QueryPage<Record>) => void;
|
|
181
|
+
}
|
|
182
|
+
export interface QueryAllOptions<Record extends JsonObject = JsonObject> extends ConnectRequestOptions {
|
|
183
|
+
firstPageSize?: number;
|
|
184
|
+
pageSize?: number;
|
|
71
185
|
onProgress?: (page: QueryPage<Record>) => void;
|
|
72
186
|
}
|
|
73
187
|
export interface QueryPage<Record extends JsonObject = JsonObject> {
|
|
@@ -129,16 +243,16 @@ export interface CreateInput<Frontmatter extends JsonObject = JsonObject> {
|
|
|
129
243
|
frontmatter?: Partial<Frontmatter> & JsonObject;
|
|
130
244
|
/** Requires full-collection access; contract creates are frontmatter-only. */
|
|
131
245
|
body?: string;
|
|
132
|
-
|
|
246
|
+
ifRevision?: string;
|
|
133
247
|
/** Include the resulting exact Markdown source in `result.document`. */
|
|
134
|
-
|
|
248
|
+
includeDocument?: boolean;
|
|
135
249
|
}
|
|
136
250
|
interface UpdateInputBase {
|
|
137
251
|
path: string;
|
|
138
252
|
contract?: DataContractSelector;
|
|
139
|
-
|
|
253
|
+
ifRevision?: string;
|
|
140
254
|
/** Include the resulting exact Markdown source; requires full-collection access. */
|
|
141
|
-
|
|
255
|
+
includeDocument?: boolean;
|
|
142
256
|
}
|
|
143
257
|
export type UpdateInput<Frontmatter extends JsonObject = JsonObject> = UpdateInputBase & ({
|
|
144
258
|
patch: Partial<Frontmatter> & JsonObject;
|
|
@@ -147,7 +261,7 @@ export type UpdateInput<Frontmatter extends JsonObject = JsonObject> = UpdateInp
|
|
|
147
261
|
} | {
|
|
148
262
|
/**
|
|
149
263
|
* Replace the complete Markdown source. This is mutually exclusive with
|
|
150
|
-
* `patch` and `body`, and implies `
|
|
264
|
+
* `patch` and `body`, and implies `includeDocument`.
|
|
151
265
|
*/
|
|
152
266
|
document: string;
|
|
153
267
|
patch?: never;
|
|
@@ -156,22 +270,22 @@ export type UpdateInput<Frontmatter extends JsonObject = JsonObject> = UpdateInp
|
|
|
156
270
|
export interface DeleteInput {
|
|
157
271
|
path: string;
|
|
158
272
|
contract?: DataContractSelector;
|
|
159
|
-
|
|
160
|
-
|
|
273
|
+
checkBacklinks?: boolean;
|
|
274
|
+
ifRevision?: string;
|
|
161
275
|
}
|
|
162
276
|
export interface DeleteResult {
|
|
163
277
|
path: string;
|
|
164
278
|
deleted: boolean;
|
|
165
|
-
|
|
279
|
+
brokenLinks?: Array<{
|
|
166
280
|
path: string;
|
|
167
281
|
}>;
|
|
168
282
|
}
|
|
169
283
|
export interface DeletePreflightResult {
|
|
170
284
|
path: string;
|
|
171
285
|
deleted: false;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
286
|
+
dryRun: true;
|
|
287
|
+
wouldDelete: true;
|
|
288
|
+
brokenLinks?: Array<{
|
|
175
289
|
path: string;
|
|
176
290
|
}>;
|
|
177
291
|
}
|
|
@@ -179,22 +293,22 @@ export interface RenameInput {
|
|
|
179
293
|
from: string;
|
|
180
294
|
to: string;
|
|
181
295
|
contract?: DataContractSelector;
|
|
182
|
-
|
|
183
|
-
|
|
296
|
+
updateRefs?: boolean;
|
|
297
|
+
ifRevision?: string;
|
|
184
298
|
/** Include the resulting exact Markdown source in `result.document`. */
|
|
185
|
-
|
|
299
|
+
includeDocument?: boolean;
|
|
186
300
|
}
|
|
187
301
|
export interface RenameResult extends RecordDocument {
|
|
188
302
|
from: string;
|
|
189
303
|
to: string;
|
|
190
|
-
|
|
304
|
+
referencesUpdated?: JsonObject[];
|
|
191
305
|
}
|
|
192
306
|
export interface RenamePreflightResult {
|
|
193
307
|
from: string;
|
|
194
308
|
to: string;
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
309
|
+
dryRun: true;
|
|
310
|
+
wouldRename: true;
|
|
311
|
+
referencesAffected?: Array<{
|
|
198
312
|
path: string;
|
|
199
313
|
field?: string;
|
|
200
314
|
location?: string;
|
|
@@ -214,7 +328,246 @@ export interface CreateTypeInput {
|
|
|
214
328
|
}
|
|
215
329
|
export interface UpdateTypeInput extends ReadTypeInput {
|
|
216
330
|
document: string;
|
|
217
|
-
|
|
331
|
+
ifRevision: string;
|
|
332
|
+
}
|
|
333
|
+
export interface ReadViewSourceInput {
|
|
334
|
+
path: string;
|
|
335
|
+
}
|
|
336
|
+
export interface CreateViewSourceInput {
|
|
337
|
+
document: string;
|
|
338
|
+
path?: string;
|
|
339
|
+
format?: string;
|
|
340
|
+
name?: string;
|
|
341
|
+
}
|
|
342
|
+
export interface UpdateViewSourceInput {
|
|
343
|
+
path: string;
|
|
344
|
+
document: string;
|
|
345
|
+
ifRevision?: string;
|
|
346
|
+
}
|
|
347
|
+
export interface DeleteViewSourceInput {
|
|
348
|
+
path: string;
|
|
349
|
+
ifRevision?: string;
|
|
350
|
+
}
|
|
351
|
+
export interface DeleteViewSourceResult {
|
|
352
|
+
path: string;
|
|
353
|
+
deleted: boolean;
|
|
354
|
+
}
|
|
355
|
+
export interface ExecuteViewInput {
|
|
356
|
+
path: string;
|
|
357
|
+
view: string;
|
|
358
|
+
context?: {
|
|
359
|
+
path: string;
|
|
360
|
+
} | null;
|
|
361
|
+
limit?: number;
|
|
362
|
+
offset?: number;
|
|
363
|
+
render?: boolean;
|
|
364
|
+
}
|
|
365
|
+
export interface SavedViewPresentation extends JsonObject {
|
|
366
|
+
type: string;
|
|
367
|
+
fallback?: string;
|
|
368
|
+
mappings?: Record<string, string>;
|
|
369
|
+
options?: JsonObject;
|
|
370
|
+
}
|
|
371
|
+
export interface SavedViewSource {
|
|
372
|
+
path: string;
|
|
373
|
+
format: string;
|
|
374
|
+
revision: string;
|
|
375
|
+
writable: boolean;
|
|
376
|
+
}
|
|
377
|
+
export interface SavedViewProperty {
|
|
378
|
+
key: string;
|
|
379
|
+
label?: string;
|
|
380
|
+
description?: string;
|
|
381
|
+
format?: string;
|
|
382
|
+
hidden?: boolean;
|
|
383
|
+
}
|
|
384
|
+
export interface SavedNamedView {
|
|
385
|
+
id: string;
|
|
386
|
+
name: string;
|
|
387
|
+
properties: SavedViewProperty[];
|
|
388
|
+
presentation?: SavedViewPresentation;
|
|
389
|
+
}
|
|
390
|
+
export interface SavedViewDocument {
|
|
391
|
+
id: string;
|
|
392
|
+
name: string;
|
|
393
|
+
source: SavedViewSource;
|
|
394
|
+
views: SavedNamedView[];
|
|
395
|
+
}
|
|
396
|
+
export interface SavedViewList {
|
|
397
|
+
views: SavedViewDocument[];
|
|
398
|
+
meta: {
|
|
399
|
+
totalCount: number;
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
export interface SavedViewSourceDocument {
|
|
403
|
+
path: string;
|
|
404
|
+
format: string;
|
|
405
|
+
revision: string;
|
|
406
|
+
document: string;
|
|
407
|
+
}
|
|
408
|
+
export interface SavedViewRecord<Frontmatter extends JsonObject = JsonObject> extends Omit<QueryRecord<Frontmatter>, "effectiveFrontmatter"> {
|
|
409
|
+
effectiveFrontmatter: Frontmatter;
|
|
410
|
+
values?: JsonObject;
|
|
411
|
+
}
|
|
412
|
+
export interface SavedViewExecution<Frontmatter extends JsonObject = JsonObject> {
|
|
413
|
+
results: Array<SavedViewRecord<Frontmatter>>;
|
|
414
|
+
meta: {
|
|
415
|
+
totalCount: number;
|
|
416
|
+
hasMore: boolean;
|
|
417
|
+
view: {
|
|
418
|
+
path: string;
|
|
419
|
+
id: string;
|
|
420
|
+
};
|
|
421
|
+
context?: {
|
|
422
|
+
path: string;
|
|
423
|
+
};
|
|
424
|
+
groups?: Array<{
|
|
425
|
+
values: JsonObject;
|
|
426
|
+
count: number;
|
|
427
|
+
summaries: JsonObject;
|
|
428
|
+
}>;
|
|
429
|
+
};
|
|
430
|
+
}
|
|
431
|
+
export type ContractSetupChoice = {
|
|
432
|
+
contract: ContractRequirement;
|
|
433
|
+
mode: "starter";
|
|
434
|
+
} | {
|
|
435
|
+
contract: ContractRequirement;
|
|
436
|
+
mode: "existing";
|
|
437
|
+
typeName: string;
|
|
438
|
+
typeRevision: string;
|
|
439
|
+
fields: Record<string, string>;
|
|
440
|
+
binding?: Record<string, unknown>;
|
|
441
|
+
};
|
|
442
|
+
export interface TypePackResourceDiff {
|
|
443
|
+
source: string;
|
|
444
|
+
target: string;
|
|
445
|
+
kind: "contract" | "type" | "schema";
|
|
446
|
+
mode: "managed" | "seed";
|
|
447
|
+
action: "create" | "update" | "delete" | "adopt" | "unchanged" | "preserve" | "conflict";
|
|
448
|
+
digest: string;
|
|
449
|
+
currentDigest?: string;
|
|
450
|
+
installedDigest?: string;
|
|
451
|
+
adoptedFromDigest?: string;
|
|
452
|
+
reason?: string;
|
|
453
|
+
}
|
|
454
|
+
export interface TypePackReceipt {
|
|
455
|
+
id: string;
|
|
456
|
+
version: string;
|
|
457
|
+
digest: string;
|
|
458
|
+
installedBy: string;
|
|
459
|
+
resources: Array<Omit<TypePackResourceDiff, "action" | "currentDigest" | "installedDigest" | "reason">>;
|
|
460
|
+
}
|
|
461
|
+
export interface TypePackAssessment {
|
|
462
|
+
status: "current" | "install" | "upgrade" | "downgrade" | "reconfigure" | "conflict";
|
|
463
|
+
applicable: boolean;
|
|
464
|
+
assessmentDigest: string;
|
|
465
|
+
current?: TypePackReceipt;
|
|
466
|
+
desired: TypePackReceipt;
|
|
467
|
+
resources: TypePackResourceDiff[];
|
|
468
|
+
lock: {
|
|
469
|
+
target: "mdbase.lock.yaml";
|
|
470
|
+
action: "create" | "update" | "unchanged";
|
|
471
|
+
digest: string;
|
|
472
|
+
};
|
|
473
|
+
contractSetups: {
|
|
474
|
+
choices: ContractSetupChoice[];
|
|
475
|
+
resources: TypePackResourceDiff[];
|
|
476
|
+
};
|
|
477
|
+
}
|
|
478
|
+
export interface TypePackApplyResult extends TypePackAssessment {
|
|
479
|
+
receipt: TypePackReceipt;
|
|
480
|
+
cleanupDeferred: boolean;
|
|
481
|
+
}
|
|
482
|
+
export type ConfigurationContributionValue = string | number | boolean | null;
|
|
483
|
+
export interface ConfigurationRequirement {
|
|
484
|
+
id: string;
|
|
485
|
+
path: string;
|
|
486
|
+
predicate: "contains";
|
|
487
|
+
value: ConfigurationContributionValue;
|
|
488
|
+
}
|
|
489
|
+
export interface ConfigurationProvision {
|
|
490
|
+
requirement: string;
|
|
491
|
+
operation: "set_add";
|
|
492
|
+
path: string;
|
|
493
|
+
value: ConfigurationContributionValue;
|
|
494
|
+
}
|
|
495
|
+
export interface ApplicationCollectionSetupRequirements {
|
|
496
|
+
configuration: ConfigurationRequirement[];
|
|
497
|
+
}
|
|
498
|
+
export interface ApplicationCollectionSetupProvisions {
|
|
499
|
+
configuration: ConfigurationProvision[];
|
|
500
|
+
typePacks: TypePackProvision[];
|
|
501
|
+
}
|
|
502
|
+
export interface ConfigurationSetupConflict {
|
|
503
|
+
code: "configuration_path_conflict" | "configuration_type_conflict";
|
|
504
|
+
path: string;
|
|
505
|
+
expected: "mapping" | "sequence";
|
|
506
|
+
observed: "null" | "boolean" | "number" | "string" | "sequence" | "mapping" | "tagged";
|
|
507
|
+
message: string;
|
|
508
|
+
}
|
|
509
|
+
export interface ConfigurationSetupAssessment {
|
|
510
|
+
requirement: string;
|
|
511
|
+
path: string;
|
|
512
|
+
value: ConfigurationContributionValue;
|
|
513
|
+
action: "current" | "add" | "conflict";
|
|
514
|
+
conflict?: ConfigurationSetupConflict;
|
|
515
|
+
}
|
|
516
|
+
export interface CollectionSetupAssessment {
|
|
517
|
+
status: "current" | "provision" | "conflict";
|
|
518
|
+
applicable: boolean;
|
|
519
|
+
applicationId: string;
|
|
520
|
+
declarationDigest: string;
|
|
521
|
+
provisionDigest: string;
|
|
522
|
+
collectionRevision: string;
|
|
523
|
+
finalCollectionRevision: string;
|
|
524
|
+
configuration: ConfigurationSetupAssessment[];
|
|
525
|
+
typePacks: TypePackAssessment[];
|
|
526
|
+
finalResourceRevisions: Record<string, string>;
|
|
527
|
+
assessmentDigest: string;
|
|
528
|
+
}
|
|
529
|
+
export interface CollectionSetupReceipt {
|
|
530
|
+
applicationId: string;
|
|
531
|
+
declarationDigest: string;
|
|
532
|
+
provisionDigest: string;
|
|
533
|
+
assessmentDigest: string;
|
|
534
|
+
collectionRevision: string;
|
|
535
|
+
configuration: Array<{
|
|
536
|
+
requirement: string;
|
|
537
|
+
path: string;
|
|
538
|
+
value: ConfigurationContributionValue;
|
|
539
|
+
}>;
|
|
540
|
+
typePacks: TypePackReceipt[];
|
|
541
|
+
cleanupDeferred: boolean;
|
|
542
|
+
}
|
|
543
|
+
export interface CollectionSetupApplyResult {
|
|
544
|
+
assessment: CollectionSetupAssessment;
|
|
545
|
+
receipt: CollectionSetupReceipt;
|
|
546
|
+
}
|
|
547
|
+
export interface AssessTypePackInput {
|
|
548
|
+
provision: TypePackProvision;
|
|
549
|
+
installedBy: string;
|
|
550
|
+
adoptResources?: Record<string, string>;
|
|
551
|
+
preserveSeedTargets?: string[];
|
|
552
|
+
targetOverrides?: Record<string, string>;
|
|
553
|
+
contractSetups?: ContractSetupChoice[];
|
|
554
|
+
}
|
|
555
|
+
export interface ApplyTypePackInput extends AssessTypePackInput {
|
|
556
|
+
expectedAssessmentDigest: string;
|
|
557
|
+
allowDowngrade?: boolean;
|
|
558
|
+
}
|
|
559
|
+
export interface AssessCollectionSetupInput {
|
|
560
|
+
applicationId: string;
|
|
561
|
+
declarationDigest: string;
|
|
562
|
+
requirements: ApplicationCollectionSetupRequirements;
|
|
563
|
+
provisions: ApplicationCollectionSetupProvisions;
|
|
564
|
+
contractSetups?: ContractSetupChoice[];
|
|
565
|
+
}
|
|
566
|
+
export interface ApplyCollectionSetupInput extends AssessCollectionSetupInput {
|
|
567
|
+
expectedAssessmentDigest: string;
|
|
568
|
+
expectedCollectionRevision: string;
|
|
569
|
+
expectedProvisionDigest: string;
|
|
570
|
+
allowTypePackDowngrades?: string[];
|
|
218
571
|
}
|
|
219
572
|
export interface ChangesInput {
|
|
220
573
|
after?: number;
|
|
@@ -271,6 +624,18 @@ export interface MdbaseWatchSubscription {
|
|
|
271
624
|
subscribe(listener: (change: CollectionChange) => void, onStatus?: (status: WatchStatus) => void, onProblem?: (problem: ConnectProblem) => void): () => void;
|
|
272
625
|
close(): void;
|
|
273
626
|
}
|
|
627
|
+
export interface CollectionChange {
|
|
628
|
+
cursor: number;
|
|
629
|
+
type: string;
|
|
630
|
+
occurredAt: string;
|
|
631
|
+
payload: JsonObject;
|
|
632
|
+
}
|
|
633
|
+
export interface CollectionChangesPage {
|
|
634
|
+
events: CollectionChange[];
|
|
635
|
+
cursor: number;
|
|
636
|
+
hasMore: boolean;
|
|
637
|
+
reset: boolean;
|
|
638
|
+
}
|
|
274
639
|
/** Provider-neutral operation transport used by the typed collection client. */
|
|
275
640
|
export interface MdbaseCollectionTransport {
|
|
276
641
|
operation<Result>(operation: CollectionOperation, input: unknown, options?: ConnectRequestOptions): Promise<Result>;
|