@friggframework/core 2.0.0--canary.658.93c8e07.0 → 2.0.0--canary.658.164d92b.0

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@friggframework/core",
3
3
  "prettier": "@friggframework/prettier-config",
4
- "version": "2.0.0--canary.658.93c8e07.0",
4
+ "version": "2.0.0--canary.658.164d92b.0",
5
5
  "dependencies": {
6
6
  "@aws-sdk/client-apigatewaymanagementapi": "^3.588.0",
7
7
  "@aws-sdk/client-kms": "^3.588.0",
@@ -47,9 +47,9 @@
47
47
  }
48
48
  },
49
49
  "devDependencies": {
50
- "@friggframework/eslint-config": "2.0.0--canary.658.93c8e07.0",
51
- "@friggframework/prettier-config": "2.0.0--canary.658.93c8e07.0",
52
- "@friggframework/test": "2.0.0--canary.658.93c8e07.0",
50
+ "@friggframework/eslint-config": "2.0.0--canary.658.164d92b.0",
51
+ "@friggframework/prettier-config": "2.0.0--canary.658.164d92b.0",
52
+ "@friggframework/test": "2.0.0--canary.658.164d92b.0",
53
53
  "@prisma/client": "^6.19.3",
54
54
  "@types/lodash": "4.17.15",
55
55
  "@typescript-eslint/eslint-plugin": "^8.0.0",
@@ -89,5 +89,5 @@
89
89
  "publishConfig": {
90
90
  "access": "public"
91
91
  },
92
- "gitHead": "93c8e078d4ff1bf00ed831152712b442abe615cd"
92
+ "gitHead": "164d92b13ea5ffc31d5f7861fbb936fc28ad3d97"
93
93
  }
@@ -58,22 +58,13 @@ declare module "@friggframework/core" {
58
58
 
59
59
  export function loadInstalledModules(): any[];
60
60
 
61
- /**
62
- * Runs `fn` with the time the invocation ends, as epoch milliseconds. A
63
- * nested scope can shorten the deadline and never extend it.
64
- */
65
61
  export function runWithInvocationDeadline<T>(
66
62
  deadlineAt: number | undefined,
67
63
  fn: () => T
68
64
  ): T;
69
65
 
70
- /** Milliseconds left in the invocation. `Infinity` outside a Lambda. */
71
66
  export function remainingInvocationMs(now?: number): number;
72
67
 
73
- /**
74
- * Finds the hint of a throttled response: the module's classify(), then the
75
- * header parsers, then the static policy. Null when there is none.
76
- */
77
68
  export function classifyRateLimit(
78
69
  policy: RateLimitPolicy | undefined,
79
70
  signal: RateLimitSignal,
@@ -16,10 +16,6 @@ declare module "@friggframework/errors" {
16
16
  readonly body: any;
17
17
  isTimeout?: boolean;
18
18
  timeoutMs?: number;
19
- /**
20
- * True when `classify` named the response as a limit but gave no time. A
21
- * `RateLimitError` always has it.
22
- */
23
19
  isRateLimited?: boolean;
24
20
  reason?: RateLimitReason;
25
21
 
@@ -35,29 +31,19 @@ declare module "@friggframework/errors" {
35
31
 
36
32
  export type RateLimitSource = "header" | "body" | "static" | "backoff";
37
33
 
38
- /** What Frigg knows about when calls are accepted again. */
39
34
  export type RateLimitHint = {
40
- /** When calls are accepted again. */
41
35
  retryAt: Date;
42
- /** Milliseconds from the time the hint was read until `retryAt`. */
43
36
  waitMs: number;
44
37
  reason: RateLimitReason;
45
- /** A provider policy name, when the response names one. */
46
38
  policy?: string;
47
- /** Calls left in the window, when the response says. */
48
39
  remaining?: number;
49
40
  source: RateLimitSource;
50
41
  };
51
42
 
52
- /**
53
- * A FetchError for a response that said a limit was hit, and for which the
54
- * response or the module's policy says when to call again.
55
- */
56
43
  export class RateLimitError extends FetchError {
57
44
  constructor(options?: RateLimitErrorConstructor);
58
45
 
59
46
  isRateLimited: true;
60
- /** When calls are accepted again. */
61
47
  retryAt: Date;
62
48
  waitMs: number;
63
49
  reason: RateLimitReason;
@@ -73,7 +59,6 @@ declare module "@friggframework/errors" {
73
59
 
74
60
  type RateLimitErrorConstructor = FetchErrorConstructor & {
75
61
  hint?: Partial<RateLimitHint>;
76
- /** Wait from `now`. When absent, `hint.retryAt` sets the time. */
77
62
  waitMs?: number;
78
63
  module?: string;
79
64
  scopeKey?: string;
@@ -5,11 +5,6 @@ declare module "@friggframework/integrations" {
5
5
  | { type: "RETRY_WHEN_READY" }
6
6
  | { type: "LINK"; label: string; url: string };
7
7
 
8
- /**
9
- * A stored message. The framework stores the keys of an item as given, so a
10
- * caller can add its own. A rate limit adds `code: "RATE_LIMITED"`,
11
- * `module`, `reason`, `retryAt` (ISO 8601) and `actions`.
12
- */
13
8
  export interface IntegrationMessage {
14
9
  title: string;
15
10
  message: string;
@@ -44,21 +44,12 @@ declare module "@friggframework/module-plugin" {
44
44
  };
45
45
 
46
46
  export type RateLimitPolicy = {
47
- /** The key a limit counts against. Default `entity`. */
48
47
  scope?: RateLimitScope;
49
48
  windows?: RateLimitWindow[];
50
49
  maxConcurrency?: number;
51
- /** A wait never shorter than this, for every throttled response. */
52
50
  minRetryAfterMs?: number;
53
- /** The most a request sleeps in process, in total. Default 300000. */
54
51
  maxInProcessWaitMs?: number;
55
- /** Header parsers, in order. Default all three. */
56
52
  parsers?: Array<"retryAfter" | "resetHeaders" | "ietf">;
57
- /**
58
- * Recognises a limit that is not a plain 429, or names its reason. Returns
59
- * null when the response is not a limit. A hint with no time takes its
60
- * time from the parsers or the policy.
61
- */
62
53
  classify?(
63
54
  signal: RateLimitSignal
64
55
  ): Partial<Omit<RateLimitHint, "source">> & {
@@ -75,7 +66,6 @@ declare module "@friggframework/module-plugin" {
75
66
  static requestTimeoutMs?: number;
76
67
 
77
68
  DLGT_INVALID_AUTH: string;
78
- /** Notified with the `RateLimitError` right before a wait that is too long throws. */
79
69
  DLGT_RATE_LIMITED: string;
80
70
  requestTimeoutMs: number;
81
71
  backOff: number[];
@@ -96,11 +86,6 @@ declare module "@friggframework/module-plugin" {
96
86
  parseBody(response: any): Promise<any>;
97
87
  refreshAuth(): Promise<any>;
98
88
  _adoptNewerCredential(): Promise<boolean>;
99
- /**
100
- * Tells the integration about a `RateLimitError` the module throws itself.
101
- * The Requester calls it for its own errors; a module built on a vendor SDK
102
- * calls it before its own throw.
103
- */
104
89
  _notifyRateLimited(rateLimitError: RateLimitError): Promise<void>;
105
90
 
106
91
  delegate: any;
@@ -149,6 +134,7 @@ declare module "@friggframework/module-plugin" {
149
134
  type RequesterConstructor = {
150
135
  backOff?: number[];
151
136
  fetch?: any;
137
+ random?: () => number;
152
138
  };
153
139
 
154
140
  export class ApiKeyRequester