@fedify/fedify 0.12.0-dev.263 → 0.12.0-dev.266
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGES.md +35 -0
- package/esm/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/concat.js +1 -1
- package/esm/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/copy.js +2 -2
- package/esm/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/ends_with.js +1 -1
- package/esm/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/equals.js +1 -1
- package/esm/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/includes_needle.js +2 -2
- package/esm/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/index_of_needle.js +2 -2
- package/esm/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/last_index_of_needle.js +2 -2
- package/esm/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/mod.js +1 -1
- package/esm/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/repeat.js +2 -2
- package/esm/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/starts_with.js +1 -1
- package/esm/federation/handler.js +41 -21
- package/esm/federation/inbox.js +34 -0
- package/esm/federation/middleware.js +151 -34
- package/esm/federation/mod.js +1 -0
- package/esm/federation/mq.js +1 -1
- package/esm/federation/retry.js +34 -0
- package/esm/runtime/key.js +1 -1
- package/esm/sig/http.js +1 -1
- package/package.json +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/concat.d.ts +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/concat.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/copy.d.ts +2 -2
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/copy.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/ends_with.d.ts +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/ends_with.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/equals.d.ts +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/equals.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/includes_needle.d.ts +2 -2
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/includes_needle.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/index_of_needle.d.ts +2 -2
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/index_of_needle.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/last_index_of_needle.d.ts +2 -2
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/last_index_of_needle.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/mod.d.ts +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/repeat.d.ts +2 -2
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/repeat.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/starts_with.d.ts +1 -1
- package/types/deps/jsr.io/@std/bytes/{1.0.0 → 1.0.1}/starts_with.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/internal/{1.0.0 → 1.0.1}/build_message.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/internal/{1.0.0 → 1.0.1}/diff.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/internal/{1.0.0 → 1.0.1}/diff_str.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/internal/{1.0.0 → 1.0.1}/format.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/internal/{1.0.0 → 1.0.1}/mod.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/internal/{1.0.0 → 1.0.1}/styles.d.ts.map +1 -1
- package/types/deps/jsr.io/@std/internal/{1.0.0 → 1.0.1}/types.d.ts.map +1 -1
- package/types/federation/callback.d.ts +4 -4
- package/types/federation/callback.d.ts.map +1 -1
- package/types/federation/handler.d.ts +7 -4
- package/types/federation/handler.d.ts.map +1 -1
- package/types/federation/inbox.d.ts +9 -0
- package/types/federation/inbox.d.ts.map +1 -0
- package/types/federation/inbox.test.d.ts.map +1 -0
- package/types/federation/middleware.d.ts +21 -5
- package/types/federation/middleware.d.ts.map +1 -1
- package/types/federation/mod.d.ts +1 -0
- package/types/federation/mod.d.ts.map +1 -1
- package/types/federation/mq.d.ts +2 -0
- package/types/federation/mq.d.ts.map +1 -1
- package/types/federation/queue.d.ts +11 -1
- package/types/federation/queue.d.ts.map +1 -1
- package/types/federation/retry.d.ts +64 -0
- package/types/federation/retry.d.ts.map +1 -0
- package/types/federation/retry.test.d.ts.map +1 -0
@@ -3,12 +3,22 @@ export interface SenderKeyJwkPair {
|
|
3
3
|
keyId: string;
|
4
4
|
privateKey: dntShim.JsonWebKey;
|
5
5
|
}
|
6
|
+
export type Message = OutboxMessage | InboxMessage;
|
6
7
|
export interface OutboxMessage {
|
7
8
|
type: "outbox";
|
8
9
|
keys: SenderKeyJwkPair[];
|
9
10
|
activity: unknown;
|
10
11
|
inbox: string;
|
11
|
-
|
12
|
+
started: string;
|
13
|
+
attempt: number;
|
12
14
|
headers: Record<string, string>;
|
13
15
|
}
|
16
|
+
export interface InboxMessage {
|
17
|
+
type: "inbox";
|
18
|
+
baseUrl: string;
|
19
|
+
activity: unknown;
|
20
|
+
started: string;
|
21
|
+
attempt: number;
|
22
|
+
handle: string | null;
|
23
|
+
}
|
14
24
|
//# sourceMappingURL=queue.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/federation/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,
|
1
|
+
{"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../src/federation/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAC5C,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,OAAO,CAAC,UAAU,CAAC;CAChC;AAED,MAAM,MAAM,OAAO,GAAG,aAAa,GAAG,YAAY,CAAC;AAEnD,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,QAAQ,CAAC;IACf,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACjC;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,OAAO,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB"}
|
@@ -0,0 +1,64 @@
|
|
1
|
+
/**
|
2
|
+
* The context passed to a {@link RetryPolicy} callback.
|
3
|
+
* @since 0.12.0
|
4
|
+
*/
|
5
|
+
import * as dntShim from "../_dnt.shims.js";
|
6
|
+
export interface RetryContext {
|
7
|
+
/**
|
8
|
+
* The elapsed time since the first attempt.
|
9
|
+
*/
|
10
|
+
readonly elapsedTime: dntShim.Temporal.Duration;
|
11
|
+
/**
|
12
|
+
* The number of attempts so far.
|
13
|
+
*/
|
14
|
+
readonly attempts: number;
|
15
|
+
}
|
16
|
+
/**
|
17
|
+
* A policy that determines the delay before the next retry.
|
18
|
+
* @param context The retry context.
|
19
|
+
* @returns The delay before the next retry, or `null` to stop retrying.
|
20
|
+
* It must not negative.
|
21
|
+
* @since 0.12.0
|
22
|
+
*/
|
23
|
+
export type RetryPolicy = (context: RetryContext) => dntShim.Temporal.Duration | null;
|
24
|
+
/**
|
25
|
+
* Options for {@link createExponentialBackoffPolicy} function.
|
26
|
+
* @since 0.12.0
|
27
|
+
*/
|
28
|
+
export interface CreateExponentialBackoffPolicyOptions {
|
29
|
+
/**
|
30
|
+
* The initial delay before the first retry. Defaults to 1 second.
|
31
|
+
*/
|
32
|
+
readonly initialDelay?: dntShim.Temporal.DurationLike;
|
33
|
+
/**
|
34
|
+
* The maximum delay between retries. Defaults to 12 hours.
|
35
|
+
*/
|
36
|
+
readonly maxDelay?: dntShim.Temporal.DurationLike;
|
37
|
+
/**
|
38
|
+
* The maximum number of attempts before giving up.
|
39
|
+
* Defaults to 10.
|
40
|
+
*/
|
41
|
+
readonly maxAttempts?: number;
|
42
|
+
/**
|
43
|
+
* The factor to multiply the previous delay by for each retry.
|
44
|
+
* Defaults to 2.
|
45
|
+
*/
|
46
|
+
readonly factor?: number;
|
47
|
+
/**
|
48
|
+
* Whether to add jitter to the delay to avoid synchronization.
|
49
|
+
* Turned on by default.
|
50
|
+
*/
|
51
|
+
readonly jitter?: boolean;
|
52
|
+
}
|
53
|
+
/**
|
54
|
+
* Creates an exponential backoff retry policy. The delay between retries
|
55
|
+
* starts at the `initialDelay` and is multiplied by the `factor` for each
|
56
|
+
* subsequent retry, up to the `maxDelay`. The policy will give up after
|
57
|
+
* `maxAttempts` attempts. The actual delay is randomized to avoid
|
58
|
+
* synchronization (jitter).
|
59
|
+
* @param options The options for the policy.
|
60
|
+
* @returns The retry policy.
|
61
|
+
* @since 0.12.0
|
62
|
+
*/
|
63
|
+
export declare function createExponentialBackoffPolicy(options?: CreateExponentialBackoffPolicyOptions): RetryPolicy;
|
64
|
+
//# sourceMappingURL=retry.d.ts.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"retry.d.ts","sourceRoot":"","sources":["../../src/federation/retry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,OAAO,MAAM,kBAAkB,CAAC;AAE5C,MAAM,WAAW,YAAY;IAC3B;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC;IAEhD;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,EAAE,YAAY,KAAK,OAAO,CAAC,QAAQ,CAAC,QAAQ,GAAG,IAAI,CAAC;AAEtF;;;GAGG;AACH,MAAM,WAAW,qCAAqC;IACpD;;OAEG;IACH,QAAQ,CAAC,YAAY,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IAEtD;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAC;IAElD;;;OAGG;IACH,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAE9B;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB;;;OAGG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,GAAE,qCAA0C,GAClD,WAAW,CAmBb"}
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"retry.test.d.ts","sourceRoot":"","sources":["../../src/federation/retry.test.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
|