@telecrypt-io/storage 0.5.27 → 0.5.29
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 +22 -8
- package/dist/TeleCryptIOStorage.d.ts +8 -10
- package/dist/TeleCryptIOStorage.js +244 -211
- package/dist/core/errors.d.ts +9 -9
- package/dist/core/errors.js +18 -18
- package/dist/core/http.d.ts +20 -14
- package/dist/core/http.js +165 -91
- package/dist/core/index.d.ts +1 -0
- package/dist/core/index.js +1 -0
- package/dist/core/oidc.d.ts +15 -0
- package/dist/core/oidc.js +533 -215
- package/dist/core/operations.js +187 -267
- package/dist/core/poll.d.ts +3 -0
- package/dist/core/poll.js +7 -1
- package/dist/core/validation.d.ts +2 -1
- package/dist/core/validation.js +8 -5
- package/package.json +1 -1
package/dist/core/poll.d.ts
CHANGED
package/dist/core/poll.js
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
export class ConditionTimeoutError extends Error {
|
|
2
|
+
constructor(timeoutMs) {
|
|
3
|
+
super(`timed out after ${timeoutMs}ms waiting for condition`);
|
|
4
|
+
this.name = "ConditionTimeoutError";
|
|
5
|
+
}
|
|
6
|
+
}
|
|
1
7
|
/**
|
|
2
8
|
* A freshly-synced client doesn't always see a room/event the *instant* the
|
|
3
9
|
* server has committed it — e.g. a room this same session just created can
|
|
@@ -12,7 +18,7 @@ export async function waitForCondition(check, opts) {
|
|
|
12
18
|
const timeoutMs = opts?.timeoutMs ?? 15000;
|
|
13
19
|
const intervalMs = opts?.intervalMs ?? 300;
|
|
14
20
|
const deadline = Date.now() + timeoutMs;
|
|
15
|
-
const timeoutError = () => new
|
|
21
|
+
const timeoutError = () => new ConditionTimeoutError(timeoutMs);
|
|
16
22
|
const abortError = () => {
|
|
17
23
|
const reason = opts?.signal?.reason;
|
|
18
24
|
return reason instanceof Error ? reason : new Error("condition wait aborted");
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Shared name contract used by SDK inputs and remote projections. */
|
|
2
2
|
export declare const MAX_NAME_LENGTH = 512;
|
|
3
|
+
export declare function isValidName(value: unknown): value is string;
|
|
3
4
|
export declare function validateName(value: unknown, label: string): asserts value is string;
|
package/dist/core/validation.js
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Shared name contract used by SDK inputs and remote projections. */
|
|
2
2
|
export const MAX_NAME_LENGTH = 512;
|
|
3
|
+
export function isValidName(value) {
|
|
4
|
+
return (typeof value === "string" &&
|
|
5
|
+
value.length > 0 &&
|
|
6
|
+
value.length <= MAX_NAME_LENGTH &&
|
|
7
|
+
!/[\u0000-\u001f\u007f]/.test(value));
|
|
8
|
+
}
|
|
3
9
|
export function validateName(value, label) {
|
|
4
|
-
if (
|
|
5
|
-
value.length === 0 ||
|
|
6
|
-
value.length > MAX_NAME_LENGTH ||
|
|
7
|
-
/[\u0000-\u001f\u007f]/.test(value)) {
|
|
10
|
+
if (!isValidName(value)) {
|
|
8
11
|
throw new Error(`invalid ${label}`);
|
|
9
12
|
}
|
|
10
13
|
}
|