@mdbase-dev/connect 0.1.0-beta.31 → 0.1.0-beta.32
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 +75 -19
- package/dist/advanced.d.ts +7 -0
- package/dist/advanced.js +4 -0
- package/dist/application-session.d.ts +10 -5
- package/dist/application-session.js +32 -16
- package/dist/async.js +11 -5
- package/dist/authority-proof.d.ts +3 -0
- package/dist/authority-proof.js +24 -0
- 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/browser.d.ts +3 -0
- package/dist/browser.js +5 -0
- package/dist/capabilities.js +2 -1
- package/dist/collection-client.d.ts +28 -28
- package/dist/collection-client.js +42 -42
- package/dist/connect-options.d.ts +12 -4
- package/dist/connect.d.ts +12 -4
- package/dist/connect.js +105 -104
- package/dist/connection-file-transport.d.ts +2 -2
- package/dist/connection-file-transport.js +4 -4
- package/dist/connection-notifications.d.ts +10 -4
- package/dist/connection-notifications.js +41 -23
- package/dist/connection-transport.d.ts +19 -15
- package/dist/connection-transport.js +202 -202
- package/dist/connection-types.d.ts +5 -4
- package/dist/connection.d.ts +43 -43
- package/dist/connection.js +221 -77
- package/dist/crypto-entry.d.ts +4 -0
- package/dist/crypto-entry.js +4 -0
- package/dist/crypto.js +4 -4
- package/dist/external-store.d.ts +10 -0
- package/dist/external-store.js +10 -0
- package/dist/file-transfer-internals.d.ts +22 -0
- package/dist/file-transfer-internals.js +186 -0
- package/dist/files.d.ts +16 -12
- package/dist/files.js +52 -206
- package/dist/hosted-file-request.js +3 -3
- package/dist/index.d.ts +2 -5
- package/dist/index.js +1 -5
- package/dist/internal-types.d.ts +8 -1
- package/dist/local-file-transport.d.ts +2 -2
- package/dist/local-file-transport.js +13 -13
- package/dist/mdbase-connect.d.ts +6 -4
- package/dist/mdbase-connect.js +9 -8
- package/dist/notifications.d.ts +3 -2
- package/dist/operation-helpers.d.ts +3 -3
- package/dist/operation-helpers.js +12 -29
- package/dist/operation-types.d.ts +33 -8
- package/dist/outcomes.d.ts +15 -15
- package/dist/outcomes.js +13 -1
- package/dist/pending-mutation-store.d.ts +13 -0
- package/dist/pending-mutation-store.js +64 -0
- package/dist/request-budget.d.ts +27 -0
- package/dist/request-budget.js +95 -0
- package/dist/runtime-utils.d.ts +2 -0
- package/dist/runtime-utils.js +19 -0
- package/dist/session.d.ts +4 -3
- package/dist/session.js +4 -4
- package/dist/stored-token.d.ts +10 -0
- package/dist/stored-token.js +60 -0
- package/dist/token-response.d.ts +11 -0
- package/dist/token-response.js +77 -0
- package/package.json +12 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
sha384-
|
|
1
|
+
sha384-HYIXh8E0r6OVNVpvmRcFYSjLi278951j0TbDZeZGQQ/jcLhe/Ih1TvTZVdqJGqY7
|
package/dist/browser.js
ADDED
package/dist/capabilities.js
CHANGED
|
@@ -36,7 +36,8 @@ function effectiveCapability(id, required, manifest, connection) {
|
|
|
36
36
|
reason: "The current grant does not include every operation for this capability."
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
if (id === "definitions.contracts.current"
|
|
39
|
+
if (id === "definitions.contracts.current"
|
|
40
|
+
&& connection.scope.access !== "full_collection") {
|
|
40
41
|
const approved = new Set(connection.scope.contracts.map(({ id, version, digest }) => `${id}@${version}:${digest}`));
|
|
41
42
|
const missingContracts = (manifest.requirements?.contracts ?? []).filter(({ id, version, digest }) => !approved.has(`${id}@${version}:${digest}`));
|
|
42
43
|
if (missingContracts.length > 0) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CollectionChange, CollectionChangesPage, CollectionDescription, CollectionOperation, CollectionTypeDocument, ApplyTypePackInput, AssessTypePackInput, CreateViewSourceInput, DeleteViewSourceInput, DeleteViewSourceResult, ExecuteViewInput, JsonObject, ReadViewSourceInput, RecordDocument, SavedViewExecution, SavedViewList, SavedViewSourceDocument, TypePackApplyResult, TypePackAssessment, UpdateViewSourceInput } from "@mdbase-dev/connect-protocol";
|
|
2
2
|
import { type CollectionChangesProblemCode, type CollectionDescriptionProblemCode, type CollectionMutationProblemCode, type CollectionQueryProblemCode, type CollectionReadProblemCode, type CollectionTypeProblemCode, type ConnectOutcome } from "./outcomes.js";
|
|
3
|
-
import type { ChangesInput, CreateInput, CreateTypeInput, DeleteInput, DeletePreflightResult, DeleteResult, MdbaseCollectionTransport, MdbaseDesiredTimer, MdbaseTimer, MdbaseTimerList, MdbaseTimerReconciliation,
|
|
3
|
+
import type { ChangesInput, CreateInput, CreateTypeInput, DeleteInput, DeletePreflightResult, DeleteResult, MdbaseCollectionTransport, MdbaseDesiredTimer, MdbaseTimer, MdbaseTimerList, MdbaseTimerReconciliation, ConnectRequestOptions, QueryInput, QueryPage, QueryPagesOptions, QueryResult, ReadInput, ReadTypeInput, RenameInput, RenamePreflightResult, RenameResult, UpdateInput, UpdateTypeInput, WatchOptions } from "./operation-types.js";
|
|
4
4
|
/**
|
|
5
5
|
* Typed collection operations independent of OAuth, HTTP, or storage.
|
|
6
6
|
*
|
|
@@ -10,42 +10,42 @@ import type { ChangesInput, CreateInput, CreateTypeInput, DeleteInput, DeletePre
|
|
|
10
10
|
export declare class MdbaseCollectionClient<Frontmatter extends JsonObject = JsonObject> {
|
|
11
11
|
private readonly transport;
|
|
12
12
|
constructor(transport: MdbaseCollectionTransport);
|
|
13
|
-
operation<Result>(operation: CollectionOperation, input: unknown, options?:
|
|
14
|
-
describe(): Promise<ConnectOutcome<CollectionDescription, CollectionDescriptionProblemCode>>;
|
|
15
|
-
changes(input?: ChangesInput, options?:
|
|
16
|
-
read(input: ReadInput): Promise<ConnectOutcome<RecordDocument<Frontmatter>, CollectionReadProblemCode>>;
|
|
17
|
-
query(input?: QueryInput, options?:
|
|
13
|
+
operation<Result>(operation: CollectionOperation, input: unknown, options?: ConnectRequestOptions): Promise<ConnectOutcome<Result>>;
|
|
14
|
+
describe(options?: ConnectRequestOptions): Promise<ConnectOutcome<CollectionDescription, CollectionDescriptionProblemCode>>;
|
|
15
|
+
changes(input?: ChangesInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<CollectionChangesPage, CollectionChangesProblemCode>>;
|
|
16
|
+
read(input: ReadInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<RecordDocument<Frontmatter>, CollectionReadProblemCode>>;
|
|
17
|
+
query(input?: QueryInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<QueryResult<Frontmatter>, CollectionQueryProblemCode>>;
|
|
18
18
|
queryPages(input?: QueryInput, options?: QueryPagesOptions<Frontmatter>): AsyncGenerator<ConnectOutcome<QueryPage<Frontmatter>, CollectionQueryProblemCode>>;
|
|
19
19
|
queryAll(input?: QueryInput, options?: QueryPagesOptions<Frontmatter>): Promise<ConnectOutcome<QueryResult<Frontmatter>, CollectionQueryProblemCode>>;
|
|
20
|
-
listViews(): Promise<ConnectOutcome<SavedViewList, CollectionReadProblemCode>>;
|
|
21
|
-
executeView(input: ExecuteViewInput): Promise<ConnectOutcome<SavedViewExecution<Frontmatter>, CollectionReadProblemCode>>;
|
|
22
|
-
readViewSource(input: ReadViewSourceInput): Promise<ConnectOutcome<SavedViewSourceDocument, CollectionReadProblemCode>>;
|
|
23
|
-
createViewSource(input: CreateViewSourceInput): Promise<ConnectOutcome<SavedViewSourceDocument, CollectionMutationProblemCode>>;
|
|
24
|
-
updateViewSource(input: UpdateViewSourceInput): Promise<ConnectOutcome<SavedViewSourceDocument, CollectionMutationProblemCode>>;
|
|
25
|
-
deleteViewSource(input: DeleteViewSourceInput): Promise<ConnectOutcome<DeleteViewSourceResult, CollectionMutationProblemCode>>;
|
|
26
|
-
create(input: CreateInput<Frontmatter
|
|
27
|
-
update(input: UpdateInput<Frontmatter
|
|
28
|
-
delete(input: DeleteInput, options?:
|
|
29
|
-
preflightDelete(input: DeleteInput, options?:
|
|
30
|
-
rename(input: RenameInput, options?:
|
|
31
|
-
preflightRename(input: RenameInput, options?:
|
|
32
|
-
validate(input?: JsonObject): Promise<ConnectOutcome<JsonObject, CollectionReadProblemCode>>;
|
|
33
|
-
readType(input: ReadTypeInput): Promise<ConnectOutcome<CollectionTypeDocument, CollectionTypeProblemCode>>;
|
|
34
|
-
createType(input: CreateTypeInput): Promise<ConnectOutcome<CollectionTypeDocument, CollectionTypeProblemCode>>;
|
|
35
|
-
updateType(input: UpdateTypeInput): Promise<ConnectOutcome<CollectionTypeDocument, CollectionTypeProblemCode>>;
|
|
36
|
-
assessTypePack(input: AssessTypePackInput): Promise<ConnectOutcome<TypePackAssessment, CollectionTypeProblemCode>>;
|
|
37
|
-
applyTypePack(input: ApplyTypePackInput): Promise<ConnectOutcome<TypePackApplyResult, CollectionTypeProblemCode>>;
|
|
38
|
-
listTimers(namespace: string): Promise<ConnectOutcome<MdbaseTimerList, CollectionReadProblemCode>>;
|
|
20
|
+
listViews(options?: ConnectRequestOptions): Promise<ConnectOutcome<SavedViewList, CollectionReadProblemCode>>;
|
|
21
|
+
executeView(input: ExecuteViewInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<SavedViewExecution<Frontmatter>, CollectionReadProblemCode>>;
|
|
22
|
+
readViewSource(input: ReadViewSourceInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<SavedViewSourceDocument, CollectionReadProblemCode>>;
|
|
23
|
+
createViewSource(input: CreateViewSourceInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<SavedViewSourceDocument, CollectionMutationProblemCode>>;
|
|
24
|
+
updateViewSource(input: UpdateViewSourceInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<SavedViewSourceDocument, CollectionMutationProblemCode>>;
|
|
25
|
+
deleteViewSource(input: DeleteViewSourceInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<DeleteViewSourceResult, CollectionMutationProblemCode>>;
|
|
26
|
+
create(input: CreateInput<Frontmatter>, options?: ConnectRequestOptions): Promise<ConnectOutcome<RecordDocument<Frontmatter>, CollectionMutationProblemCode>>;
|
|
27
|
+
update(input: UpdateInput<Frontmatter>, options?: ConnectRequestOptions): Promise<ConnectOutcome<RecordDocument<Frontmatter>, CollectionMutationProblemCode>>;
|
|
28
|
+
delete(input: DeleteInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<DeleteResult, CollectionMutationProblemCode>>;
|
|
29
|
+
preflightDelete(input: DeleteInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<DeletePreflightResult, CollectionMutationProblemCode>>;
|
|
30
|
+
rename(input: RenameInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<RenameResult, CollectionMutationProblemCode>>;
|
|
31
|
+
preflightRename(input: RenameInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<RenamePreflightResult, CollectionMutationProblemCode>>;
|
|
32
|
+
validate(input?: JsonObject, options?: ConnectRequestOptions): Promise<ConnectOutcome<JsonObject, CollectionReadProblemCode>>;
|
|
33
|
+
readType(input: ReadTypeInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<CollectionTypeDocument, CollectionTypeProblemCode>>;
|
|
34
|
+
createType(input: CreateTypeInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<CollectionTypeDocument, CollectionTypeProblemCode>>;
|
|
35
|
+
updateType(input: UpdateTypeInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<CollectionTypeDocument, CollectionTypeProblemCode>>;
|
|
36
|
+
assessTypePack(input: AssessTypePackInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<TypePackAssessment, CollectionTypeProblemCode>>;
|
|
37
|
+
applyTypePack(input: ApplyTypePackInput, options?: ConnectRequestOptions): Promise<ConnectOutcome<TypePackApplyResult, CollectionTypeProblemCode>>;
|
|
38
|
+
listTimers(namespace: string, options?: ConnectRequestOptions): Promise<ConnectOutcome<MdbaseTimerList, CollectionReadProblemCode>>;
|
|
39
39
|
putTimer(input: {
|
|
40
40
|
namespace: string;
|
|
41
41
|
criterion_id: string;
|
|
42
42
|
timer: MdbaseDesiredTimer;
|
|
43
|
-
}): Promise<ConnectOutcome<MdbaseTimer, CollectionMutationProblemCode>>;
|
|
43
|
+
}, options?: ConnectRequestOptions): Promise<ConnectOutcome<MdbaseTimer, CollectionMutationProblemCode>>;
|
|
44
44
|
cancelTimer(input: {
|
|
45
45
|
namespace: string;
|
|
46
46
|
id: string;
|
|
47
47
|
generation?: number;
|
|
48
|
-
}): Promise<ConnectOutcome<{
|
|
48
|
+
}, options?: ConnectRequestOptions): Promise<ConnectOutcome<{
|
|
49
49
|
namespace: string;
|
|
50
50
|
id: string;
|
|
51
51
|
cancelled: boolean;
|
|
@@ -54,7 +54,7 @@ export declare class MdbaseCollectionClient<Frontmatter extends JsonObject = Jso
|
|
|
54
54
|
namespace: string;
|
|
55
55
|
criterion_id: string;
|
|
56
56
|
timers: MdbaseDesiredTimer[];
|
|
57
|
-
}): Promise<ConnectOutcome<MdbaseTimerReconciliation, CollectionMutationProblemCode>>;
|
|
57
|
+
}, options?: ConnectRequestOptions): Promise<ConnectOutcome<MdbaseTimerReconciliation, CollectionMutationProblemCode>>;
|
|
58
58
|
watch(options?: WatchOptions): AsyncGenerator<ConnectOutcome<CollectionChange, CollectionChangesProblemCode>>;
|
|
59
59
|
private rawOperation;
|
|
60
60
|
private envelopeOperation;
|
|
@@ -15,14 +15,14 @@ export class MdbaseCollectionClient {
|
|
|
15
15
|
operation(operation, input, options) {
|
|
16
16
|
return captureConnectOutcome(() => this.transport.operation(operation, input, options), ALL_CONNECT_PROBLEM_CODES);
|
|
17
17
|
}
|
|
18
|
-
describe() {
|
|
19
|
-
return this.rawOperation("describe", {}, COLLECTION_DESCRIPTION_PROBLEM_CODES);
|
|
18
|
+
describe(options) {
|
|
19
|
+
return this.rawOperation("describe", {}, COLLECTION_DESCRIPTION_PROBLEM_CODES, options);
|
|
20
20
|
}
|
|
21
21
|
changes(input = {}, options) {
|
|
22
22
|
return this.rawOperation("changes", input, COLLECTION_CHANGES_PROBLEM_CODES, options);
|
|
23
23
|
}
|
|
24
|
-
read(input) {
|
|
25
|
-
return this.envelopeOperation("read", input, COLLECTION_READ_PROBLEM_CODES);
|
|
24
|
+
read(input, options) {
|
|
25
|
+
return this.envelopeOperation("read", input, COLLECTION_READ_PROBLEM_CODES, options);
|
|
26
26
|
}
|
|
27
27
|
query(input = {}, options) {
|
|
28
28
|
return this.envelopeOperation("query", input, COLLECTION_QUERY_PROBLEM_CODES, options);
|
|
@@ -41,7 +41,7 @@ export class MdbaseCollectionClient {
|
|
|
41
41
|
offset,
|
|
42
42
|
limit: pageNumber === 0 ? firstPageSize : pageSize,
|
|
43
43
|
...(snapshot ? { snapshot } : {})
|
|
44
|
-
}, { signal: options.signal });
|
|
44
|
+
}, { signal: options.signal, timeoutMs: options.timeoutMs });
|
|
45
45
|
if (!queried.ok) {
|
|
46
46
|
yield queried;
|
|
47
47
|
return;
|
|
@@ -95,29 +95,29 @@ export class MdbaseCollectionClient {
|
|
|
95
95
|
}
|
|
96
96
|
}, diagnostics);
|
|
97
97
|
}
|
|
98
|
-
listViews() {
|
|
99
|
-
return this.envelopeOperation("list_views", {}, COLLECTION_READ_PROBLEM_CODES);
|
|
98
|
+
listViews(options) {
|
|
99
|
+
return this.envelopeOperation("list_views", {}, COLLECTION_READ_PROBLEM_CODES, options);
|
|
100
100
|
}
|
|
101
|
-
executeView(input) {
|
|
102
|
-
return this.envelopeOperation("execute_view", input, COLLECTION_READ_PROBLEM_CODES);
|
|
101
|
+
executeView(input, options) {
|
|
102
|
+
return this.envelopeOperation("execute_view", input, COLLECTION_READ_PROBLEM_CODES, options);
|
|
103
103
|
}
|
|
104
|
-
readViewSource(input) {
|
|
105
|
-
return this.envelopeOperation("read_view_source", input, COLLECTION_READ_PROBLEM_CODES);
|
|
104
|
+
readViewSource(input, options) {
|
|
105
|
+
return this.envelopeOperation("read_view_source", input, COLLECTION_READ_PROBLEM_CODES, options);
|
|
106
106
|
}
|
|
107
|
-
createViewSource(input) {
|
|
108
|
-
return this.envelopeOperation("create_view_source", input, COLLECTION_MUTATION_PROBLEM_CODES);
|
|
107
|
+
createViewSource(input, options) {
|
|
108
|
+
return this.envelopeOperation("create_view_source", input, COLLECTION_MUTATION_PROBLEM_CODES, options);
|
|
109
109
|
}
|
|
110
|
-
updateViewSource(input) {
|
|
111
|
-
return this.envelopeOperation("update_view_source", input, COLLECTION_MUTATION_PROBLEM_CODES);
|
|
110
|
+
updateViewSource(input, options) {
|
|
111
|
+
return this.envelopeOperation("update_view_source", input, COLLECTION_MUTATION_PROBLEM_CODES, options);
|
|
112
112
|
}
|
|
113
|
-
deleteViewSource(input) {
|
|
114
|
-
return this.envelopeOperation("delete_view_source", input, COLLECTION_MUTATION_PROBLEM_CODES);
|
|
113
|
+
deleteViewSource(input, options) {
|
|
114
|
+
return this.envelopeOperation("delete_view_source", input, COLLECTION_MUTATION_PROBLEM_CODES, options);
|
|
115
115
|
}
|
|
116
|
-
create(input) {
|
|
117
|
-
return this.envelopeOperation("create", input, COLLECTION_MUTATION_PROBLEM_CODES);
|
|
116
|
+
create(input, options) {
|
|
117
|
+
return this.envelopeOperation("create", input, COLLECTION_MUTATION_PROBLEM_CODES, options);
|
|
118
118
|
}
|
|
119
|
-
update(input) {
|
|
120
|
-
return this.envelopeOperation("update", input, COLLECTION_MUTATION_PROBLEM_CODES);
|
|
119
|
+
update(input, options) {
|
|
120
|
+
return this.envelopeOperation("update", input, COLLECTION_MUTATION_PROBLEM_CODES, options);
|
|
121
121
|
}
|
|
122
122
|
delete(input, options) {
|
|
123
123
|
return this.envelopeOperation("delete", input, COLLECTION_MUTATION_PROBLEM_CODES, options);
|
|
@@ -131,35 +131,35 @@ export class MdbaseCollectionClient {
|
|
|
131
131
|
preflightRename(input, options) {
|
|
132
132
|
return this.envelopeOperation("rename", { ...input, dry_run: true }, COLLECTION_MUTATION_PROBLEM_CODES, options);
|
|
133
133
|
}
|
|
134
|
-
validate(input = {}) {
|
|
135
|
-
return this.envelopeOperation("validate", input, COLLECTION_READ_PROBLEM_CODES);
|
|
134
|
+
validate(input = {}, options) {
|
|
135
|
+
return this.envelopeOperation("validate", input, COLLECTION_READ_PROBLEM_CODES, options);
|
|
136
136
|
}
|
|
137
|
-
readType(input) {
|
|
138
|
-
return this.envelopeOperation("read_type", input, COLLECTION_TYPE_PROBLEM_CODES);
|
|
137
|
+
readType(input, options) {
|
|
138
|
+
return this.envelopeOperation("read_type", input, COLLECTION_TYPE_PROBLEM_CODES, options);
|
|
139
139
|
}
|
|
140
|
-
createType(input) {
|
|
141
|
-
return this.envelopeOperation("create_type", input, COLLECTION_TYPE_PROBLEM_CODES);
|
|
140
|
+
createType(input, options) {
|
|
141
|
+
return this.envelopeOperation("create_type", input, COLLECTION_TYPE_PROBLEM_CODES, options);
|
|
142
142
|
}
|
|
143
|
-
updateType(input) {
|
|
144
|
-
return this.envelopeOperation("update_type", input, COLLECTION_TYPE_PROBLEM_CODES);
|
|
143
|
+
updateType(input, options) {
|
|
144
|
+
return this.envelopeOperation("update_type", input, COLLECTION_TYPE_PROBLEM_CODES, options);
|
|
145
145
|
}
|
|
146
|
-
assessTypePack(input) {
|
|
147
|
-
return this.envelopeOperation("assess_type_pack", input, COLLECTION_TYPE_PROBLEM_CODES);
|
|
146
|
+
assessTypePack(input, options) {
|
|
147
|
+
return this.envelopeOperation("assess_type_pack", input, COLLECTION_TYPE_PROBLEM_CODES, options);
|
|
148
148
|
}
|
|
149
|
-
applyTypePack(input) {
|
|
150
|
-
return this.envelopeOperation("apply_type_pack", input, COLLECTION_TYPE_PROBLEM_CODES);
|
|
149
|
+
applyTypePack(input, options) {
|
|
150
|
+
return this.envelopeOperation("apply_type_pack", input, COLLECTION_TYPE_PROBLEM_CODES, options);
|
|
151
151
|
}
|
|
152
|
-
listTimers(namespace) {
|
|
153
|
-
return this.rawOperation("list_timers", { namespace }, COLLECTION_READ_PROBLEM_CODES);
|
|
152
|
+
listTimers(namespace, options) {
|
|
153
|
+
return this.rawOperation("list_timers", { namespace }, COLLECTION_READ_PROBLEM_CODES, options);
|
|
154
154
|
}
|
|
155
|
-
putTimer(input) {
|
|
156
|
-
return this.rawOperation("put_timer", input, COLLECTION_MUTATION_PROBLEM_CODES);
|
|
155
|
+
putTimer(input, options) {
|
|
156
|
+
return this.rawOperation("put_timer", input, COLLECTION_MUTATION_PROBLEM_CODES, options);
|
|
157
157
|
}
|
|
158
|
-
cancelTimer(input) {
|
|
159
|
-
return this.rawOperation("cancel_timer", input, COLLECTION_MUTATION_PROBLEM_CODES);
|
|
158
|
+
cancelTimer(input, options) {
|
|
159
|
+
return this.rawOperation("cancel_timer", input, COLLECTION_MUTATION_PROBLEM_CODES, options);
|
|
160
160
|
}
|
|
161
|
-
reconcileTimers(input) {
|
|
162
|
-
return this.rawOperation("reconcile_timers", input, COLLECTION_MUTATION_PROBLEM_CODES);
|
|
161
|
+
reconcileTimers(input, options) {
|
|
162
|
+
return this.rawOperation("reconcile_timers", input, COLLECTION_MUTATION_PROBLEM_CODES, options);
|
|
163
163
|
}
|
|
164
164
|
async *watch(options = {}) {
|
|
165
165
|
let cursor = options.cursor;
|
|
@@ -169,7 +169,7 @@ export class MdbaseCollectionClient {
|
|
|
169
169
|
let connected = false;
|
|
170
170
|
options.onStatus?.({ state: "connecting", ...(cursor === undefined ? {} : { cursor }) });
|
|
171
171
|
while (!options.signal?.aborted) {
|
|
172
|
-
const changed = await this.changes(cursor === undefined ? {} : { after: cursor, limit: 200 }, { signal: options.signal });
|
|
172
|
+
const changed = await this.changes(cursor === undefined ? {} : { after: cursor, limit: 200 }, { signal: options.signal, timeoutMs: options.timeoutMs });
|
|
173
173
|
if (!changed.ok) {
|
|
174
174
|
const problem = changed.problem;
|
|
175
175
|
if (options.signal?.aborted)
|
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import type { JsonObject, MdbaseAppManifest } from "@mdbase-dev/connect-protocol";
|
|
2
2
|
import type { GrantKeyStore } from "./crypto.js";
|
|
3
3
|
import type { ApplicationIdentityStore } from "./application-identity.js";
|
|
4
|
+
export interface MdbaseConnectTimeouts {
|
|
5
|
+
requestMs?: number | null;
|
|
6
|
+
watchStartMs?: number | null;
|
|
7
|
+
uploadMs?: number | null;
|
|
8
|
+
syncMs?: number | null;
|
|
9
|
+
}
|
|
4
10
|
export interface MdbaseConnectOptions {
|
|
5
|
-
serverUrl: string;
|
|
11
|
+
serverUrl: string | URL;
|
|
6
12
|
/**
|
|
7
13
|
* A bundled v1 application manifest or its app-local URL. String values
|
|
8
14
|
* are loaded by this SDK and posted inline; Connect never fetches them.
|
|
9
15
|
*/
|
|
10
|
-
manifest?: MdbaseAppManifest | string;
|
|
11
|
-
redirectUri?: string;
|
|
16
|
+
manifest?: MdbaseAppManifest | string | URL;
|
|
17
|
+
redirectUri?: string | URL;
|
|
12
18
|
storage?: Storage;
|
|
13
19
|
/** Encrypted relay is required by default for newly authorized grants. */
|
|
14
20
|
relayEncryption?: "required" | "disabled";
|
|
@@ -18,8 +24,10 @@ export interface MdbaseConnectOptions {
|
|
|
18
24
|
/** Prefer same-computer connector access when the browser permits it. */
|
|
19
25
|
directAccess?: "auto" | "disabled";
|
|
20
26
|
/** Loopback origin override for development and automated testing. */
|
|
21
|
-
loopbackUrl?: string;
|
|
27
|
+
loopbackUrl?: string | URL;
|
|
22
28
|
/** Override browser navigation, for example to use a native system browser. */
|
|
23
29
|
navigate?: (url: string) => void | Promise<void>;
|
|
30
|
+
/** Workload-specific defaults. Per-call timeoutMs always wins. */
|
|
31
|
+
timeouts?: MdbaseConnectTimeouts;
|
|
24
32
|
}
|
|
25
33
|
export type MdbaseFrontmatter = JsonObject;
|
package/dist/connect.d.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { MdbaseConnectOptions } from "./connect-options.js";
|
|
|
5
5
|
import type { MdbaseConnectionInfo } from "./connection-types.js";
|
|
6
6
|
import { type GrantKeyStore } from "./crypto.js";
|
|
7
7
|
import { type Application, type StoredToken } from "./internal-types.js";
|
|
8
|
+
import type { ConnectRequestOptions } from "./operation-types.js";
|
|
9
|
+
import { type ResolvedConnectTimeouts } from "./request-budget.js";
|
|
8
10
|
import type { MdbaseUnavailableReason } from "./session.js";
|
|
9
11
|
export declare class MdbaseConnectInternals<Frontmatter extends JsonObject> {
|
|
10
12
|
readonly serverUrl: string;
|
|
@@ -18,6 +20,7 @@ export declare class MdbaseConnectInternals<Frontmatter extends JsonObject> {
|
|
|
18
20
|
readonly directAccessMode: "auto" | "disabled";
|
|
19
21
|
readonly loopbackUrl: string;
|
|
20
22
|
readonly navigate?: (url: string) => void | Promise<void>;
|
|
23
|
+
readonly timeouts: ResolvedConnectTimeouts;
|
|
21
24
|
readonly credentialStorage: MdbaseConnectEnvironment["credentialStorage"];
|
|
22
25
|
private application;
|
|
23
26
|
private manifestPromise;
|
|
@@ -27,13 +30,16 @@ export declare class MdbaseConnectInternals<Frontmatter extends JsonObject> {
|
|
|
27
30
|
private readonly invalidatedConnections;
|
|
28
31
|
constructor(options: MdbaseConnectOptions);
|
|
29
32
|
environment(): MdbaseConnectEnvironment;
|
|
30
|
-
register(): Promise<Application>;
|
|
31
|
-
|
|
33
|
+
register(options?: ConnectRequestOptions): Promise<Application>;
|
|
34
|
+
private registerWithinBudget;
|
|
35
|
+
manifestDeclaration(options?: ConnectRequestOptions): Promise<MdbaseAppManifest>;
|
|
32
36
|
private loadManifest;
|
|
33
37
|
authorize(options?: MdbaseAuthorizeOptions): Promise<MdbaseAuthorizationOutcome<Frontmatter>>;
|
|
38
|
+
private authorizeWithinBudget;
|
|
34
39
|
private authorizeWeb;
|
|
35
40
|
private authorizePortable;
|
|
36
|
-
completeAuthorization(callbackUrl: string): Promise<MdbaseAuthorizationResult<Frontmatter>>;
|
|
41
|
+
completeAuthorization(callbackUrl: string, options?: ConnectRequestOptions): Promise<MdbaseAuthorizationResult<Frontmatter>>;
|
|
42
|
+
private completeAuthorizationWithinBudget;
|
|
37
43
|
private performAuthorizationCompletion;
|
|
38
44
|
connections(): MdbaseConnectionInfo[];
|
|
39
45
|
connection(collectionId: string): MdbaseConnection<Frontmatter> | null;
|
|
@@ -44,9 +50,11 @@ export declare class MdbaseConnectInternals<Frontmatter extends JsonObject> {
|
|
|
44
50
|
private pinConnectorIdentity;
|
|
45
51
|
private connectorPinKey;
|
|
46
52
|
private loadApplicationIdentity;
|
|
47
|
-
removeToken(collectionId: string, keyHandle?: string, reason?: MdbaseUnavailableReason): void;
|
|
53
|
+
removeToken(collectionId: string, keyHandle?: string, reason?: MdbaseUnavailableReason, discardPending?: boolean): void;
|
|
48
54
|
tokenKey(collectionId: string): string;
|
|
49
55
|
pendingMutationKey(collectionId: string): string;
|
|
56
|
+
private removePendingMutations;
|
|
57
|
+
private pendingMutationsUseKey;
|
|
50
58
|
notificationKey(collectionId: string, transport?: "web_push" | "fcm"): string;
|
|
51
59
|
directPreferenceKey(): string;
|
|
52
60
|
defaultApplicationOrigin(): string;
|