@seamapi/http 0.30.1 → 0.31.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/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +952 -16
- package/lib/seam/connect/resolve-action-attempt.d.ts +1273 -5
- package/lib/seam/connect/resolve-action-attempt.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/src/lib/seam/connect/resolve-action-attempt.ts +16 -9
- package/src/lib/version.ts +1 -1
- package/lib/seam/connect/action-attempt-types.d.ts +0 -17
- package/lib/seam/connect/action-attempt-types.js +0 -3
- package/lib/seam/connect/action-attempt-types.js.map +0 -1
- package/src/lib/seam/connect/action-attempt-types.ts +0 -22
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-action-attempt.js","sourceRoot":"","sources":["../../../src/lib/seam/connect/resolve-action-attempt.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"resolve-action-attempt.js","sourceRoot":"","sources":["../../../src/lib/seam/connect/resolve-action-attempt.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EACvC,aAAgB,EAChB,cAAsC,EACtC,EAAE,OAAO,GAAG,IAAI,EAAE,eAAe,GAAG,GAAG,EAA+B,EAClC,EAAE;IACtC,IAAI,UAAU,CAAA;IACd,MAAM,cAAc,GAAG,IAAI,OAAO,CAChC,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE;QACnB,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,EAAE;YACtC,MAAM,CAAC,IAAI,6BAA6B,CAAI,aAAa,EAAE,OAAO,CAAC,CAAC,CAAA;QACtE,CAAC,EAAE,OAAO,CAAC,CAAA;IACb,CAAC,CACF,CAAA;IAED,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC;YACxB,iBAAiB,CAAI,aAAa,EAAE,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AO,KAAK,YAAY,4BAA4B,CAAA;AACtD,CAAC,CAAA;AAED,MAAM,OAAO,4BAEX,SAAQ,sBAAyB;IAGjC,YAAY,aAAqC;QAC/C,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,OAAO,EAAE,aAAa,CAAC,CAAA;QACjD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;QACjC,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAA;IACtC,CAAC;CACF;AAED,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,KAAc,EAC6B,EAAE;IAC7C,OAAO,KAAK,YAAY,6BAA6B,CAAA;AACvD,CAAC,CAAA;AAED,MAAM,OAAO,6BAEX,SAAQ,sBAAyB;IACjC,YAAY,aAAgB,EAAE,OAAe;QAC3C,KAAK,CACH,qDAAqD,OAAO,IAAI,EAChE,aAAa,CACd,CAAA;QACD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;IACnC,CAAC;CACF;AAED,MAAM,yBAAyB,GAAG,CAChC,aAAgB,EAC4B,EAAE,CAC9C,aAAa,CAAC,MAAM,KAAK,SAAS,CAAA;AAEpC,MAAM,qBAAqB,GAAG,CAC5B,aAAgB,EACyB,EAAE,CAAC,aAAa,CAAC,MAAM,KAAK,OAAO,CAAA"}
|
package/lib/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const seamapiJavascriptHttpVersion = "0.
|
|
1
|
+
declare const seamapiJavascriptHttpVersion = "0.31.0";
|
|
2
2
|
export default seamapiJavascriptHttpVersion;
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seamapi/http",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "JavaScript HTTP client for the Seam API written in TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "index.js",
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
"npm": ">= 9.0.0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
|
-
"@seamapi/types": "^1.
|
|
87
|
+
"@seamapi/types": "^1.186.0"
|
|
88
88
|
},
|
|
89
89
|
"peerDependenciesMeta": {
|
|
90
90
|
"@seamapi/types": {
|
|
@@ -99,7 +99,7 @@
|
|
|
99
99
|
},
|
|
100
100
|
"devDependencies": {
|
|
101
101
|
"@seamapi/fake-seam-connect": "^1.44.2",
|
|
102
|
-
"@seamapi/types": "1.
|
|
102
|
+
"@seamapi/types": "1.186.0",
|
|
103
103
|
"@types/eslint": "^8.44.2",
|
|
104
104
|
"@types/node": "^20.8.10",
|
|
105
105
|
"ava": "^5.0.1",
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
FailedActionAttempt,
|
|
4
|
-
SuccessfulActionAttempt,
|
|
5
|
-
} from './action-attempt-types.js'
|
|
1
|
+
import type { ActionAttempt } from '@seamapi/types/connect'
|
|
2
|
+
|
|
6
3
|
import type { SeamHttpActionAttempts } from './routes/index.js'
|
|
7
4
|
|
|
8
5
|
export interface ResolveActionAttemptOptions {
|
|
@@ -14,9 +11,9 @@ export const resolveActionAttempt = async <T extends ActionAttempt>(
|
|
|
14
11
|
actionAttempt: T,
|
|
15
12
|
actionAttempts: SeamHttpActionAttempts,
|
|
16
13
|
{ timeout = 5000, pollingInterval = 500 }: ResolveActionAttemptOptions,
|
|
17
|
-
): Promise<
|
|
14
|
+
): Promise<SucceededActionAttempt<T>> => {
|
|
18
15
|
let timeoutRef
|
|
19
|
-
const timeoutPromise = new Promise<
|
|
16
|
+
const timeoutPromise = new Promise<SucceededActionAttempt<T>>(
|
|
20
17
|
(_resolve, reject) => {
|
|
21
18
|
timeoutRef = globalThis.setTimeout(() => {
|
|
22
19
|
reject(new SeamActionAttemptTimeoutError<T>(actionAttempt, timeout))
|
|
@@ -38,7 +35,7 @@ const pollActionAttempt = async <T extends ActionAttempt>(
|
|
|
38
35
|
actionAttempt: T,
|
|
39
36
|
actionAttempts: SeamHttpActionAttempts,
|
|
40
37
|
options: Pick<ResolveActionAttemptOptions, 'pollingInterval'>,
|
|
41
|
-
): Promise<
|
|
38
|
+
): Promise<SucceededActionAttempt<T>> => {
|
|
42
39
|
if (isSuccessfulActionAttempt(actionAttempt)) {
|
|
43
40
|
return actionAttempt
|
|
44
41
|
}
|
|
@@ -114,9 +111,19 @@ export class SeamActionAttemptTimeoutError<
|
|
|
114
111
|
|
|
115
112
|
const isSuccessfulActionAttempt = <T extends ActionAttempt>(
|
|
116
113
|
actionAttempt: T,
|
|
117
|
-
): actionAttempt is
|
|
114
|
+
): actionAttempt is SucceededActionAttempt<T> =>
|
|
118
115
|
actionAttempt.status === 'success'
|
|
119
116
|
|
|
120
117
|
const isFailedActionAttempt = <T extends ActionAttempt>(
|
|
121
118
|
actionAttempt: T,
|
|
122
119
|
): actionAttempt is FailedActionAttempt<T> => actionAttempt.status === 'error'
|
|
120
|
+
|
|
121
|
+
export type SucceededActionAttempt<T extends ActionAttempt> = Extract<
|
|
122
|
+
T,
|
|
123
|
+
{ status: 'success' }
|
|
124
|
+
>
|
|
125
|
+
|
|
126
|
+
export type FailedActionAttempt<T extends ActionAttempt> = Extract<
|
|
127
|
+
T,
|
|
128
|
+
{ status: 'error' }
|
|
129
|
+
>
|
package/src/lib/version.ts
CHANGED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export interface ActionAttempt {
|
|
2
|
-
action_attempt_id: string;
|
|
3
|
-
status: 'pending' | 'error' | 'success';
|
|
4
|
-
}
|
|
5
|
-
export type SuccessfulActionAttempt<T extends ActionAttempt> = T & {
|
|
6
|
-
status: 'success';
|
|
7
|
-
};
|
|
8
|
-
export type PendingActionAttempt<T extends ActionAttempt> = T & {
|
|
9
|
-
status: 'pending';
|
|
10
|
-
};
|
|
11
|
-
export type FailedActionAttempt<T extends ActionAttempt> = T & {
|
|
12
|
-
status: 'error';
|
|
13
|
-
error: {
|
|
14
|
-
type: string;
|
|
15
|
-
message: string;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"action-attempt-types.js","sourceRoot":"","sources":["../../../src/lib/seam/connect/action-attempt-types.ts"],"names":[],"mappings":"AAAA,sEAAsE"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
// UPSTREAM: These types should be provided by @seamapi/types/connect.
|
|
2
|
-
|
|
3
|
-
export interface ActionAttempt {
|
|
4
|
-
action_attempt_id: string
|
|
5
|
-
status: 'pending' | 'error' | 'success'
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
export type SuccessfulActionAttempt<T extends ActionAttempt> = T & {
|
|
9
|
-
status: 'success'
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export type PendingActionAttempt<T extends ActionAttempt> = T & {
|
|
13
|
-
status: 'pending'
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type FailedActionAttempt<T extends ActionAttempt> = T & {
|
|
17
|
-
status: 'error'
|
|
18
|
-
error: {
|
|
19
|
-
type: string
|
|
20
|
-
message: string
|
|
21
|
-
}
|
|
22
|
-
}
|