@mdbase-dev/connect 0.1.0-beta.32 → 0.1.0-beta.33
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/session.d.ts
CHANGED
|
@@ -67,7 +67,7 @@ export declare class MdbaseSession<Frontmatter extends JsonObject = JsonObject>
|
|
|
67
67
|
authorize(target: "choose" | "selected" | {
|
|
68
68
|
collectionId: string;
|
|
69
69
|
}, options?: Omit<MdbaseAuthorizeOptions, "operations" | "returnTo" | "target">): Promise<ConnectOutcome<MdbaseAuthorizationOutcome<Frontmatter>, SessionProblemCode>>;
|
|
70
|
-
ensureOperations(requiredOperations: CollectionOperation[]): Promise<ConnectOutcome<MdbaseAuthorizationOutcome<Frontmatter> | {
|
|
70
|
+
ensureOperations(requiredOperations: CollectionOperation[], options?: ConnectRequestOptions): Promise<ConnectOutcome<MdbaseAuthorizationOutcome<Frontmatter> | {
|
|
71
71
|
kind: "unchanged";
|
|
72
72
|
connection: MdbaseConnection<Frontmatter>;
|
|
73
73
|
}, SessionProblemCode>>;
|
package/dist/session.js
CHANGED
|
@@ -124,7 +124,7 @@ export class MdbaseSession {
|
|
|
124
124
|
this.refresh();
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
async ensureOperations(requiredOperations) {
|
|
127
|
+
async ensureOperations(requiredOperations, options) {
|
|
128
128
|
const current = this.snapshot;
|
|
129
129
|
if (current.status !== "ready") {
|
|
130
130
|
return connectFailure(connectProblem("collection_not_ready", "Choose an authorized collection first."));
|
|
@@ -137,6 +137,7 @@ export class MdbaseSession {
|
|
|
137
137
|
this.transactionDepth += 1;
|
|
138
138
|
try {
|
|
139
139
|
const outcome = await this.connect.authorize({
|
|
140
|
+
...options,
|
|
140
141
|
operations: uniqueOperations([...capabilities.grantedOperations, ...capabilities.missingOperations]),
|
|
141
142
|
target: { kind: "collection", collectionId: current.collectionId },
|
|
142
143
|
returnTo: this.selection.authorizationReturnTo()
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { WatchOptions } from "./operation-types.js";
|
|
2
|
+
export interface ResolvedWatchRetryOptions {
|
|
3
|
+
initialDelayMs: number;
|
|
4
|
+
maxDelayMs: number;
|
|
5
|
+
multiplier: number;
|
|
6
|
+
maxAttempts?: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function watchRetryPolicy(options: WatchOptions["retry"]): ResolvedWatchRetryOptions | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export function watchRetryPolicy(options) {
|
|
2
|
+
if (options === false)
|
|
3
|
+
return undefined;
|
|
4
|
+
return {
|
|
5
|
+
initialDelayMs: Math.max(0, options?.initialDelayMs ?? 500),
|
|
6
|
+
maxDelayMs: Math.max(0, options?.maxDelayMs ?? 15_000),
|
|
7
|
+
multiplier: Math.max(1, options?.multiplier ?? 2),
|
|
8
|
+
...(options?.maxAttempts === undefined
|
|
9
|
+
? {}
|
|
10
|
+
: { maxAttempts: Math.max(0, options.maxAttempts) })
|
|
11
|
+
};
|
|
12
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mdbase-dev/connect",
|
|
3
|
-
"version": "0.1.0-beta.
|
|
3
|
+
"version": "0.1.0-beta.33",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"README.md"
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
|
-
"@mdbase-dev/connect-protocol": "0.1.0-beta.
|
|
36
|
+
"@mdbase-dev/connect-protocol": "0.1.0-beta.33"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"esbuild": "^0.28.1",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"test": "vitest run",
|
|
46
46
|
"test:browser-storage": "pnpm build && node scripts/browser-storage.test.mjs",
|
|
47
47
|
"test:consumer-spikes": "tsc -p tsconfig.consumer-spikes.json",
|
|
48
|
-
"test:public-api": "pnpm build && tsc -p tsconfig.public-api.json",
|
|
48
|
+
"test:public-api": "pnpm build && pnpm --filter @mdbase-dev/connect-protocol build && pnpm --filter @mdbase-dev/connect-testing build && tsc -p tsconfig.public-api.json && node scripts/check-public-api.mjs && node scripts/test-packed-api.mjs",
|
|
49
49
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
50
50
|
}
|
|
51
51
|
}
|