@seamapi/http 2.18.0 → 2.20.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.
Files changed (44) hide show
  1. package/index.d.ts +5 -0
  2. package/index.js +5 -0
  3. package/index.js.map +1 -1
  4. package/lib/client.d.ts +12 -0
  5. package/lib/client.js.map +1 -1
  6. package/lib/index.d.ts +1 -1
  7. package/lib/index.js.map +1 -1
  8. package/lib/options.d.ts +105 -0
  9. package/lib/options.js +54 -0
  10. package/lib/options.js.map +1 -1
  11. package/lib/request-options.d.ts +13 -0
  12. package/lib/request-options.js +3 -0
  13. package/lib/request-options.js.map +1 -1
  14. package/lib/resolve-action-attempt.d.ts +47 -0
  15. package/lib/resolve-action-attempt.js +29 -0
  16. package/lib/resolve-action-attempt.js.map +1 -1
  17. package/lib/resources/device.d.ts +0 -12
  18. package/lib/resources/workspace.d.ts +2 -1
  19. package/lib/routes/workspaces/workspaces.d.ts +1 -1
  20. package/lib/seam-http-error.d.ts +34 -0
  21. package/lib/seam-http-error.js +34 -0
  22. package/lib/seam-http-error.js.map +1 -1
  23. package/lib/seam-http-request.d.ts +31 -0
  24. package/lib/seam-http-request.js +31 -0
  25. package/lib/seam-http-request.js.map +1 -1
  26. package/lib/seam-paginator.d.ts +28 -0
  27. package/lib/seam-paginator.js +25 -0
  28. package/lib/seam-paginator.js.map +1 -1
  29. package/lib/version.d.ts +1 -1
  30. package/lib/version.js +1 -1
  31. package/package.json +3 -2
  32. package/src/index.ts +5 -0
  33. package/src/lib/client.ts +14 -0
  34. package/src/lib/index.ts +3 -0
  35. package/src/lib/options.ts +105 -0
  36. package/src/lib/request-options.ts +13 -0
  37. package/src/lib/resolve-action-attempt.ts +48 -0
  38. package/src/lib/resources/device.ts +0 -12
  39. package/src/lib/resources/workspace.ts +2 -1
  40. package/src/lib/routes/workspaces/workspaces.ts +1 -1
  41. package/src/lib/seam-http-error.ts +38 -0
  42. package/src/lib/seam-http-request.ts +31 -0
  43. package/src/lib/seam-paginator.ts +28 -0
  44. package/src/lib/version.ts +1 -1
package/index.d.ts CHANGED
@@ -1 +1,6 @@
1
+ /**
2
+ * JavaScript HTTP client for the Seam API written in TypeScript.
3
+ *
4
+ * @packageDocumentation
5
+ */
1
6
  export * from './lib/index.js';
package/index.js CHANGED
@@ -1,2 +1,7 @@
1
+ /**
2
+ * JavaScript HTTP client for the Seam API written in TypeScript.
3
+ *
4
+ * @packageDocumentation
5
+ */
1
6
  export * from './lib/index.js';
2
7
  //# sourceMappingURL=index.js.map
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,cAAc,gBAAgB,CAAA"}
package/lib/client.d.ts CHANGED
@@ -3,8 +3,20 @@ import { type AxiosRetry } from 'axios-retry';
3
3
  export type Client = AxiosInstance;
4
4
  export declare const defaultTimeout = 30000;
5
5
  export interface ClientOptions {
6
+ /**
7
+ * Request timeout in milliseconds, applied per attempt.
8
+ * Set to 0 to disable the timeout. Defaults to 30 seconds.
9
+ */
6
10
  timeout?: number;
11
+ /**
12
+ * Options passed to the underlying Axios client.
13
+ */
7
14
  axiosOptions?: AxiosRequestConfig;
15
+ /**
16
+ * Options passed to axios-retry,
17
+ * which retries idempotent requests that fail
18
+ * because of a transport error, timeout, or HTTP 429 response.
19
+ */
8
20
  axiosRetryOptions?: AxiosRetryConfig;
9
21
  }
10
22
  type AxiosRetryConfig = Parameters<AxiosRetry>[1];
package/lib/client.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"client.js","sourceRoot":"","sources":["../src/lib/client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAA+C,MAAM,OAAO,CAAA;AAC1E,OAAO,UAAU,EAAE,EAEjB,gBAAgB,EAChB,w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CAAmC,CAAA;AAI5E,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAA;AA0BpC,MAAM,wBAAwB,GAAG;IAC/B,OAAO,EAAE,CAAC;IACV,cAAc,EAAE,wBAAwB;IACxC,UAAU,EAAE,gBAAgB;IAC5B,kBAAkB,EAAE,IAAI;IACxB,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS;IACxB,uBAAuB,EAAE,GAAG,EAAE,CAAC,SAAS;IACxC,gBAAgB,EAAE,IAAI;CACY,CAAA;AAEpC,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,OAAsB,EAAiB,EAAE;IACpE,MAAM,MAAM,GAAG,KAAK,CAAC,MAAM,CAAC;QAC1B,gBAAgB,EAAE,wBAAwB;QAC1C,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,cAAc;QAC1C,GAAG,OAAO,CAAC,YAAY;KACxB,CAAC,CAAA;IAEF,UAAU,CAAC,MAAM,EAAE;QACjB,GAAG,wBAAwB;QAC3B,GAAG,OAAO,CAAC,iBAAiB;KAC7B,CAAC,CAAA;IAEF,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,gBAAgB,CAAC,CAAA;IAE7D,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
package/lib/index.d.ts CHANGED
@@ -2,7 +2,7 @@ export { SeamHttpInvalidTokenError } from './auth.js';
2
2
  export * from './error-interceptor.js';
3
3
  export * from './openapi.js';
4
4
  export * from './options.js';
5
- export { isSeamActionAttemptError, isSeamActionAttemptFailedError, isSeamActionAttemptTimeoutError, SeamActionAttemptError, SeamActionAttemptFailedError, SeamActionAttemptTimeoutError, } from './resolve-action-attempt.js';
5
+ export { type FailedActionAttempt, isSeamActionAttemptError, isSeamActionAttemptFailedError, isSeamActionAttemptTimeoutError, type ResolveActionAttemptOptions, SeamActionAttemptError, SeamActionAttemptFailedError, SeamActionAttemptTimeoutError, type SucceededActionAttempt, } from './resolve-action-attempt.js';
6
6
  export * from './resources/index.js';
7
7
  export * from './routes/index.js';
8
8
  export * from './seam-http-error.js';
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAA;AACrD,cAAc,wBAAwB,CAAA;AACtC,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,OAAO,EACL,wBAAwB,EACxB,8BAA8B,EAC9B,+BAA+B,EAC/B,sBAAsB,EACtB,4BAA4B,EAC5B,6BAA6B,GAC9B,MAAM,6BAA6B,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,YAAY,CAAA;AACnB,cAAc,mCAAmC,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAA;AACrD,cAAc,wBAAwB,CAAA;AACtC,cAAc,cAAc,CAAA;AAC5B,cAAc,cAAc,CAAA;AAC5B,OAAO,EAEL,wBAAwB,EACxB,8BAA8B,EAC9B,+BAA+B,EAE/B,sBAAsB,EACtB,4BAA4B,EAC5B,6BAA6B,GAE9B,MAAM,6BAA6B,CAAA;AACpC,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AACpC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,OAAO,EACL,QAAQ,EACR,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,GACjB,MAAM,YAAY,CAAA;AACnB,cAAc,mCAAmC,CAAA"}
package/lib/options.d.ts CHANGED
@@ -1,54 +1,159 @@
1
1
  import type { Client, ClientOptions } from './client.js';
2
2
  import { type SeamHttpRequestOptions } from './request-options.js';
3
3
  export type { SeamHttpRequestOptions } from './request-options.js';
4
+ /**
5
+ * Options for creating a SeamHttpWithoutWorkspace client,
6
+ * which is not scoped to a single workspace.
7
+ */
4
8
  export type SeamHttpWithoutWorkspaceOptions = SeamHttpWithoutWorkspaceOptionsFromEnv | SeamHttpWithoutWorkspaceOptionsWithClient | SeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken | SeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken;
9
+ /**
10
+ * Options for creating a SeamHttp client.
11
+ */
5
12
  export type SeamHttpOptions = SeamHttpOptionsFromEnv | SeamHttpOptionsWithClient | SeamHttpOptionsWithApiKey | SeamHttpOptionsWithClientSessionToken | SeamHttpOptionsWithConsoleSessionToken | SeamHttpOptionsWithPersonalAccessToken;
6
13
  interface SeamHttpCommonOptions extends ClientOptions, SeamHttpRequestOptions {
14
+ /**
15
+ * The Seam API endpoint, e.g., `https://connect.getseam.com`.
16
+ * Defaults to the SEAM_ENDPOINT or SEAM_API_URL environment variable, if set.
17
+ */
7
18
  endpoint?: string;
8
19
  }
20
+ /**
21
+ * Options for creating a SeamHttp client with `SeamHttp.fromPublishableKey`.
22
+ */
9
23
  export interface SeamHttpFromPublishableKeyOptions extends SeamHttpCommonOptions {
10
24
  }
25
+ /**
26
+ * Options for creating a SeamHttp client that reads its configuration
27
+ * from the environment, e.g., the SEAM_API_KEY environment variable.
28
+ */
11
29
  export interface SeamHttpOptionsFromEnv extends SeamHttpCommonOptions {
12
30
  }
31
+ /**
32
+ * Options for creating a SeamHttpWithoutWorkspace client that reads
33
+ * its configuration from the environment,
34
+ * e.g., the SEAM_PERSONAL_ACCESS_TOKEN environment variable.
35
+ */
13
36
  export interface SeamHttpWithoutWorkspaceOptionsFromEnv extends SeamHttpCommonOptions {
14
37
  }
38
+ /**
39
+ * Options for creating a SeamHttpWithoutWorkspace client from an existing client.
40
+ */
15
41
  export interface SeamHttpWithoutWorkspaceOptionsWithClient extends SeamHttpCommonOptions {
16
42
  client: Client;
17
43
  }
44
+ /**
45
+ * Returns true if the options include a client.
46
+ *
47
+ * @throws {@link SeamHttpInvalidOptionsError} if the client option
48
+ * is used with any other option.
49
+ */
18
50
  export declare const isSeamHttpWithoutWorkspaceOptionsWithClient: (options: SeamHttpOptions) => options is SeamHttpWithoutWorkspaceOptionsWithClient;
51
+ /**
52
+ * Options for creating a SeamHttp client from an existing client.
53
+ */
19
54
  export interface SeamHttpOptionsWithClient extends SeamHttpRequestOptions {
20
55
  client: Client;
21
56
  }
57
+ /**
58
+ * Returns true if the options include a client.
59
+ *
60
+ * @throws {@link SeamHttpInvalidOptionsError} if the client option
61
+ * is used with any other option.
62
+ */
22
63
  export declare const isSeamHttpOptionsWithClient: (options: SeamHttpOptions) => options is SeamHttpOptionsWithClient;
64
+ /**
65
+ * Options for creating a SeamHttp client authenticated with an API key.
66
+ */
23
67
  export interface SeamHttpOptionsWithApiKey extends SeamHttpCommonOptions {
24
68
  apiKey: string;
25
69
  }
70
+ /**
71
+ * Returns true if the options include an apiKey.
72
+ *
73
+ * @throws {@link SeamHttpInvalidOptionsError} if the apiKey option
74
+ * is used with another authentication option.
75
+ */
26
76
  export declare const isSeamHttpOptionsWithApiKey: (options: SeamHttpOptions) => options is SeamHttpOptionsWithApiKey;
77
+ /**
78
+ * Options for creating a SeamHttp client authenticated with a client session token.
79
+ */
27
80
  export interface SeamHttpOptionsWithClientSessionToken extends SeamHttpCommonOptions {
28
81
  clientSessionToken: string;
29
82
  }
83
+ /**
84
+ * Returns true if the options include a clientSessionToken.
85
+ *
86
+ * @throws {@link SeamHttpInvalidOptionsError} if the clientSessionToken option
87
+ * is used with another authentication option.
88
+ */
30
89
  export declare const isSeamHttpOptionsWithClientSessionToken: (options: SeamHttpOptions) => options is SeamHttpOptionsWithClientSessionToken;
90
+ /**
91
+ * Options for creating a SeamHttpWithoutWorkspace client
92
+ * authenticated with a console session token.
93
+ */
31
94
  export interface SeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken extends SeamHttpCommonOptions {
32
95
  consoleSessionToken: string;
33
96
  }
97
+ /**
98
+ * Returns true if the options include a consoleSessionToken.
99
+ *
100
+ * @throws {@link SeamHttpInvalidOptionsError} if the consoleSessionToken option
101
+ * is used with another authentication option.
102
+ */
34
103
  export declare const isSeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken: (options: SeamHttpOptions) => options is SeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken;
104
+ /**
105
+ * Options for creating a SeamHttp client
106
+ * authenticated with a console session token and scoped to a workspace.
107
+ */
35
108
  export interface SeamHttpOptionsWithConsoleSessionToken extends SeamHttpCommonOptions {
36
109
  consoleSessionToken: string;
37
110
  workspaceId: string;
38
111
  }
112
+ /**
113
+ * Returns true if the options include a consoleSessionToken and a workspaceId.
114
+ *
115
+ * @throws {@link SeamHttpInvalidOptionsError} if the consoleSessionToken option
116
+ * is used with another authentication option or without the workspaceId option.
117
+ */
39
118
  export declare const isSeamHttpOptionsWithConsoleSessionToken: (options: SeamHttpOptions) => options is SeamHttpOptionsWithConsoleSessionToken;
119
+ /**
120
+ * Options for creating a SeamHttpWithoutWorkspace client
121
+ * authenticated with a personal access token.
122
+ */
40
123
  export interface SeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken extends SeamHttpCommonOptions {
41
124
  personalAccessToken: string;
42
125
  }
126
+ /**
127
+ * Returns true if the options include a personalAccessToken.
128
+ *
129
+ * @throws {@link SeamHttpInvalidOptionsError} if the personalAccessToken option
130
+ * is used with another authentication option.
131
+ */
43
132
  export declare const isSeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken: (options: SeamHttpOptions) => options is SeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken;
133
+ /**
134
+ * Options for creating a SeamHttp client
135
+ * authenticated with a personal access token and scoped to a workspace.
136
+ */
44
137
  export interface SeamHttpOptionsWithPersonalAccessToken extends SeamHttpCommonOptions {
45
138
  personalAccessToken: string;
46
139
  workspaceId: string;
47
140
  }
141
+ /**
142
+ * Returns true if the options include a personalAccessToken and a workspaceId.
143
+ *
144
+ * @throws {@link SeamHttpInvalidOptionsError} if the personalAccessToken option
145
+ * is used with another authentication option or without the workspaceId option.
146
+ */
48
147
  export declare const isSeamHttpOptionsWithPersonalAccessToken: (options: SeamHttpOptions) => options is SeamHttpOptionsWithPersonalAccessToken;
148
+ /**
149
+ * Error thrown when a SeamHttp client is created with invalid options.
150
+ */
49
151
  export declare class SeamHttpInvalidOptionsError extends Error {
50
152
  constructor(message: string);
51
153
  }
154
+ /**
155
+ * Error thrown when a SeamHttpWithoutWorkspace client is created with invalid options.
156
+ */
52
157
  export declare class SeamHttpWithoutWorkspaceInvalidOptionsError extends Error {
53
158
  constructor(message: string);
54
159
  }
package/lib/options.js CHANGED
@@ -1,5 +1,17 @@
1
1
  import { isSeamHttpRequestOption, } from './request-options.js';
2
+ /**
3
+ * Returns true if the options include a client.
4
+ *
5
+ * @throws {@link SeamHttpInvalidOptionsError} if the client option
6
+ * is used with any other option.
7
+ */
2
8
  export const isSeamHttpWithoutWorkspaceOptionsWithClient = (options) => isSeamHttpOptionsWithClient(options);
9
+ /**
10
+ * Returns true if the options include a client.
11
+ *
12
+ * @throws {@link SeamHttpInvalidOptionsError} if the client option
13
+ * is used with any other option.
14
+ */
3
15
  export const isSeamHttpOptionsWithClient = (options) => {
4
16
  if (!('client' in options))
5
17
  return false;
@@ -11,6 +23,12 @@ export const isSeamHttpOptionsWithClient = (options) => {
11
23
  }
12
24
  return true;
13
25
  };
26
+ /**
27
+ * Returns true if the options include an apiKey.
28
+ *
29
+ * @throws {@link SeamHttpInvalidOptionsError} if the apiKey option
30
+ * is used with another authentication option.
31
+ */
14
32
  export const isSeamHttpOptionsWithApiKey = (options) => {
15
33
  if (!('apiKey' in options))
16
34
  return false;
@@ -27,6 +45,12 @@ export const isSeamHttpOptionsWithApiKey = (options) => {
27
45
  }
28
46
  return true;
29
47
  };
48
+ /**
49
+ * Returns true if the options include a clientSessionToken.
50
+ *
51
+ * @throws {@link SeamHttpInvalidOptionsError} if the clientSessionToken option
52
+ * is used with another authentication option.
53
+ */
30
54
  export const isSeamHttpOptionsWithClientSessionToken = (options) => {
31
55
  if (!('clientSessionToken' in options))
32
56
  return false;
@@ -43,6 +67,12 @@ export const isSeamHttpOptionsWithClientSessionToken = (options) => {
43
67
  }
44
68
  return true;
45
69
  };
70
+ /**
71
+ * Returns true if the options include a consoleSessionToken.
72
+ *
73
+ * @throws {@link SeamHttpInvalidOptionsError} if the consoleSessionToken option
74
+ * is used with another authentication option.
75
+ */
46
76
  export const isSeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken = (options) => {
47
77
  if (!('consoleSessionToken' in options))
48
78
  return false;
@@ -59,6 +89,12 @@ export const isSeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken = (options
59
89
  }
60
90
  return true;
61
91
  };
92
+ /**
93
+ * Returns true if the options include a consoleSessionToken and a workspaceId.
94
+ *
95
+ * @throws {@link SeamHttpInvalidOptionsError} if the consoleSessionToken option
96
+ * is used with another authentication option or without the workspaceId option.
97
+ */
62
98
  export const isSeamHttpOptionsWithConsoleSessionToken = (options) => {
63
99
  if (!isSeamHttpWithoutWorkspaceOptionsWithConsoleSessionToken(options)) {
64
100
  return false;
@@ -68,6 +104,12 @@ export const isSeamHttpOptionsWithConsoleSessionToken = (options) => {
68
104
  }
69
105
  return true;
70
106
  };
107
+ /**
108
+ * Returns true if the options include a personalAccessToken.
109
+ *
110
+ * @throws {@link SeamHttpInvalidOptionsError} if the personalAccessToken option
111
+ * is used with another authentication option.
112
+ */
71
113
  export const isSeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken = (options) => {
72
114
  if (!('personalAccessToken' in options))
73
115
  return false;
@@ -84,6 +126,12 @@ export const isSeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken = (options
84
126
  }
85
127
  return true;
86
128
  };
129
+ /**
130
+ * Returns true if the options include a personalAccessToken and a workspaceId.
131
+ *
132
+ * @throws {@link SeamHttpInvalidOptionsError} if the personalAccessToken option
133
+ * is used with another authentication option or without the workspaceId option.
134
+ */
87
135
  export const isSeamHttpOptionsWithPersonalAccessToken = (options) => {
88
136
  if (!isSeamHttpWithoutWorkspaceOptionsWithPersonalAccessToken(options)) {
89
137
  return false;
@@ -93,12 +141,18 @@ export const isSeamHttpOptionsWithPersonalAccessToken = (options) => {
93
141
  }
94
142
  return true;
95
143
  };
144
+ /**
145
+ * Error thrown when a SeamHttp client is created with invalid options.
146
+ */
96
147
  export class SeamHttpInvalidOptionsError extends Error {
97
148
  constructor(message) {
98
149
  super(`SeamHttp received invalid options: ${message}`);
99
150
  this.name = this.constructor.name;
100
151
  }
101
152
  }
153
+ /**
154
+ * Error thrown when a SeamHttpWithoutWorkspace client is created with invalid options.
155
+ */
102
156
  export class SeamHttpWithoutWorkspaceInvalidOptionsError extends Error {
103
157
  constructor(message) {
104
158
  super(`SeamHttpWithoutWorkspace received invalid options: ${message}`);
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../src/lib/options.ts"],"names":[],"mappings":"AACA,OAAO,EACL,uBAAuB,GAExB,MAAM,sBAAsB,CAAA;AAgC7B,MAAM,CAAC,MAAM,2CAA2C,GAAG,CACzD,OAAwB,EAC8B,EAAE,CACxD,2BAA2B,CAAC,OAAO,CAAC,CAAA;AAMtC,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,OAAwB,EACc,EAAE;IACxC,IAAI,CAAC,CAAC,QAAQ,IAAI,OAAO,CAAC;QAAE,OAAO,KAAK,CAAA;IACxC,IAAI,OAAO,CAAC,MAAM,IAAI,IAAI;QAAE,OAAO,KAAK,CAAA;IAExC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,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AAA;AAED;;GAEG;AACH,MAAM,OAAO,2BAA4B,SAAQ,KAAK;IACpD,YAAY,OAAe;QACzB,KAAK,CAAC,sCAAsC,OAAO,EAAE,CAAC,CAAA;QACtD,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;IACnC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,OAAO,2CAA4C,SAAQ,KAAK;IACpE,YAAY,OAAe;QACzB,KAAK,CAAC,sDAAsD,OAAO,EAAE,CAAC,CAAA;QACtE,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAA;IACnC,CAAC;CACF"}
@@ -1,5 +1,18 @@
1
1
  import type { ResolveActionAttemptOptions } from './resolve-action-attempt.js';
2
+ /**
3
+ * Options for how a {@link SeamHttpRequest} is executed.
4
+ */
2
5
  export interface SeamHttpRequestOptions {
6
+ /**
7
+ * Controls whether to wait for the action attempt to resolve
8
+ * when a request returns an action attempt.
9
+ * Pass a boolean to toggle waiting,
10
+ * or {@link ResolveActionAttemptOptions} to also configure
11
+ * the timeout and polling interval.
12
+ */
3
13
  waitForActionAttempt?: boolean | ResolveActionAttemptOptions;
4
14
  }
15
+ /**
16
+ * Returns true if the key is the name of a {@link SeamHttpRequestOptions} property.
17
+ */
5
18
  export declare const isSeamHttpRequestOption: (key: string) => key is keyof SeamHttpRequestOptions;
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Returns true if the key is the name of a {@link SeamHttpRequestOptions} property.
3
+ */
1
4
  export const isSeamHttpRequestOption = (key) => {
2
5
  const keys = {
3
6
  waitForActionAttempt: true,
@@ -1 +1 @@
1
- {"version":3,"file":"request-options.js","sourceRoot":"","sources":["../src/lib/request-options.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,GAAW,EAC0B,EAAE;IACvC,MAAM,IAAI,GAA+C;QACvD,oBAAoB,EAAE,IAAI;KAC3B,CAAA;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC,CAAA"}
1
+ {"version":3,"file":"request-options.js","sourceRoot":"","sources":["../src/lib/request-options.ts"],"names":[],"mappings":"AAgBA;;GAEG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CACrC,GAAW,EAC0B,EAAE;IACvC,MAAM,IAAI,GAA+C;QACvD,oBAAoB,EAAE,IAAI;KAC3B,CAAA;IACD,OAAO,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC,CAAA"}
@@ -1,31 +1,78 @@
1
1
  import type { ActionAttempt } from './resources/action-attempt.js';
2
+ /**
3
+ * Client used to poll action attempts by id, e.g., `SeamHttpActionAttempts`.
4
+ */
2
5
  export interface ActionAttemptsClient {
3
6
  get(parameters: {
4
7
  action_attempt_id: string;
5
8
  }): PromiseLike<ActionAttempt>;
6
9
  }
10
+ /**
11
+ * Options for waiting until an action attempt resolves.
12
+ */
7
13
  export interface ResolveActionAttemptOptions {
14
+ /**
15
+ * Maximum time in milliseconds to wait for the action attempt to resolve.
16
+ */
8
17
  timeout?: number;
18
+ /**
19
+ * Time in milliseconds to wait between polls of the action attempt.
20
+ */
9
21
  pollingInterval?: number;
10
22
  }
23
+ /**
24
+ * Polls a pending action attempt until it succeeds, fails, or times out.
25
+ *
26
+ * @returns The succeeded action attempt.
27
+ * @throws {@link SeamActionAttemptFailedError} if the action attempt fails.
28
+ * @throws {@link SeamActionAttemptTimeoutError} if the action attempt
29
+ * does not resolve within the timeout.
30
+ */
11
31
  export declare const resolveActionAttempt: <T extends ActionAttempt>(actionAttempt: T, actionAttempts: ActionAttemptsClient, { timeout, pollingInterval }: ResolveActionAttemptOptions) => Promise<SucceededActionAttempt<T>>;
32
+ /**
33
+ * Returns true if the error is a {@link SeamActionAttemptError}.
34
+ */
12
35
  export declare const isSeamActionAttemptError: <T extends ActionAttempt>(error: unknown) => error is SeamActionAttemptError<T>;
36
+ /**
37
+ * Error relating to an action attempt.
38
+ */
13
39
  export declare class SeamActionAttemptError<T extends ActionAttempt> extends Error {
14
40
  actionAttempt: T;
15
41
  constructor(message: string, actionAttempt: T);
16
42
  }
43
+ /**
44
+ * Returns true if the error is a {@link SeamActionAttemptFailedError}.
45
+ */
17
46
  export declare const isSeamActionAttemptFailedError: <T extends ActionAttempt>(error: unknown) => error is SeamActionAttemptFailedError<T>;
47
+ /**
48
+ * Error thrown when an action attempt fails.
49
+ */
18
50
  export declare class SeamActionAttemptFailedError<T extends ActionAttempt> extends SeamActionAttemptError<T> {
51
+ /**
52
+ * Error type returned by the Seam API for the failed action attempt.
53
+ */
19
54
  code: string;
20
55
  constructor(actionAttempt: FailedActionAttempt<T>);
21
56
  }
57
+ /**
58
+ * Returns true if the error is a {@link SeamActionAttemptTimeoutError}.
59
+ */
22
60
  export declare const isSeamActionAttemptTimeoutError: <T extends ActionAttempt>(error: unknown) => error is SeamActionAttemptTimeoutError<T>;
61
+ /**
62
+ * Error thrown when an action attempt does not resolve within the timeout.
63
+ */
23
64
  export declare class SeamActionAttemptTimeoutError<T extends ActionAttempt> extends SeamActionAttemptError<T> {
24
65
  constructor(actionAttempt: T, timeout: number);
25
66
  }
67
+ /**
68
+ * An action attempt that has succeeded.
69
+ */
26
70
  export type SucceededActionAttempt<T extends ActionAttempt> = T & {
27
71
  status: 'success';
28
72
  };
73
+ /**
74
+ * An action attempt that has failed.
75
+ */
29
76
  export type FailedActionAttempt<T extends ActionAttempt> = T & {
30
77
  status: 'error';
31
78
  };
@@ -1,3 +1,11 @@
1
+ /**
2
+ * Polls a pending action attempt until it succeeds, fails, or times out.
3
+ *
4
+ * @returns The succeeded action attempt.
5
+ * @throws {@link SeamActionAttemptFailedError} if the action attempt fails.
6
+ * @throws {@link SeamActionAttemptTimeoutError} if the action attempt
7
+ * does not resolve within the timeout.
8
+ */
1
9
  export const resolveActionAttempt = async (actionAttempt, actionAttempts, { timeout = 10_000, pollingInterval = 1_000 }) => {
2
10
  let timeoutRef;
3
11
  const timeoutPromise = new Promise((_resolve, reject) => {
@@ -29,9 +37,15 @@ const pollActionAttempt = async (actionAttempt, actionAttempts, options) => {
29
37
  });
30
38
  return await pollActionAttempt(nextActionAttempt, actionAttempts, options);
31
39
  };
40
+ /**
41
+ * Returns true if the error is a {@link SeamActionAttemptError}.
42
+ */
32
43
  export const isSeamActionAttemptError = (error) => {
33
44
  return error instanceof SeamActionAttemptError;
34
45
  };
46
+ /**
47
+ * Error relating to an action attempt.
48
+ */
35
49
  export class SeamActionAttemptError extends Error {
36
50
  actionAttempt;
37
51
  constructor(message, actionAttempt) {
@@ -40,10 +54,19 @@ export class SeamActionAttemptError extends Error {
40
54
  this.actionAttempt = actionAttempt;
41
55
  }
42
56
  }
57
+ /**
58
+ * Returns true if the error is a {@link SeamActionAttemptFailedError}.
59
+ */
43
60
  export const isSeamActionAttemptFailedError = (error) => {
44
61
  return error instanceof SeamActionAttemptFailedError;
45
62
  };
63
+ /**
64
+ * Error thrown when an action attempt fails.
65
+ */
46
66
  export class SeamActionAttemptFailedError extends SeamActionAttemptError {
67
+ /**
68
+ * Error type returned by the Seam API for the failed action attempt.
69
+ */
47
70
  code;
48
71
  constructor(actionAttempt) {
49
72
  super(actionAttempt.error.message, actionAttempt);
@@ -51,9 +74,15 @@ export class SeamActionAttemptFailedError extends SeamActionAttemptError {
51
74
  this.code = actionAttempt.error.type;
52
75
  }
53
76
  }
77
+ /**
78
+ * Returns true if the error is a {@link SeamActionAttemptTimeoutError}.
79
+ */
54
80
  export const isSeamActionAttemptTimeoutError = (error) => {
55
81
  return error instanceof SeamActionAttemptTimeoutError;
56
82
  };
83
+ /**
84
+ * Error thrown when an action attempt does not resolve within the timeout.
85
+ */
57
86
  export class SeamActionAttemptTimeoutError extends SeamActionAttemptError {
58
87
  constructor(actionAttempt, timeout) {
59
88
  super(`Timed out waiting for action action attempt after ${timeout}ms`, actionAttempt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a,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"}
1
+ {"version":3,"file":"resolve-action-attempt.js","sourceRoot":"","sources":["../src/lib/resolve-action-attempt.ts"],"names":[],"mappings":"AAwBA;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,KAAK,EACvC,aAAgB,EAChB,cAAoC,EACpC,EAAE,OAAO,GAAG,MAAM,EAAE,eAAe,GAAG,KAAK,EAA+B,EACtC,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,cAAc,EAAE,EAAE,eAAe,EAAE,CAAC;YACxE,cAAc;SACf,CAAC,CAAA;IACJ,CAAC;YAAS,CAAC;QACT,IAAI,UAAU,IAAI,IAAI;YAAE,UAAU,CAAC,YAAY,CAAC,UAAU,CAAC,CAAA;IAC7D,CAAC;AACH,CAAC,CAAA;AAED,MAAM,iBAAiB,GAAG,KAAK,EAC7B,aAAgB,EAChB,cAAoC,EACpC,OAA6D,EACzB,EAAE;IACtC,IAAI,yBAAyB,CAAC,aAAa,CAA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AAC,WAAW,CAAC,IAAI,CAAA;QACjC,IAAI,CAAC,IAAI,GAAG,aAAa,CAAC,KAAK,CAAC,IAAI,CAAA;IACtC,CAAC;CACF;AAED;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,KAAc,EAC6B,EAAE;IAC7C,OAAO,KAAK,YAAY,6BAA6B,CAAA;AACvD,CAAC,CAAA;AAED;;GAEG;AACH,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"}
@@ -1492,18 +1492,6 @@ export type Device = {
1492
1492
  * Set to true when the device does not support the /dual-setpoints API endpoint.
1493
1493
  */
1494
1494
  dual_setpoints_not_supported?: boolean | undefined;
1495
- /**
1496
- * Enforced cooling setpoint range in Celsius for a Sensi device, derived from an OutOfRange API error.
1497
- */
1498
- enforced_cooling_setpoint_range_celsius?: Array<number> | undefined;
1499
- /**
1500
- * Enforced heating setpoint range in Celsius for a Sensi device, derived from an OutOfRange API error.
1501
- */
1502
- enforced_heating_setpoint_range_celsius?: Array<number> | undefined;
1503
- /**
1504
- * Legacy combined enforced setpoint range in Celsius for a Sensi device, derived from an OutOfRange API error. Read as a fallback for the per-mode ranges below; no longer written.
1505
- */
1506
- enforced_setpoint_range_celsius?: Array<number> | undefined;
1507
1495
  /**
1508
1496
  * Product type for a Sensi device.
1509
1497
  */
@@ -4,10 +4,11 @@
4
4
  export type Workspace = {
5
5
  /**
6
6
  * Company name associated with the [workspace](https://docs.seam.co/core-concepts/workspaces).
7
+ * @deprecated Use `connect_partner_name` instead.
7
8
  */
8
9
  company_name: string;
9
10
  /**
10
- * @deprecated Use `company_name` instead.
11
+ * Seam Connect partner name associated with the [workspace](https://docs.seam.co/core-concepts/workspaces).
11
12
  */
12
13
  connect_partner_name: string | null;
13
14
  connect_webview_customization: {
@@ -40,11 +40,11 @@ export declare class SeamHttpWorkspaces {
40
40
  export type WorkspacesCreateParameters = {
41
41
  /**
42
42
  * Company name for the new workspace.
43
+ * @deprecated Use `connect_partner_name` instead.
43
44
  */
44
45
  company_name?: string | undefined;
45
46
  /**
46
47
  * Connect partner name for the new workspace.
47
- * @deprecated Use `company_name` instead.
48
48
  */
49
49
  connect_partner_name?: string | null | undefined;
50
50
  /**
@@ -1,22 +1,56 @@
1
1
  import type { ApiError } from './api-error-types.js';
2
+ /**
3
+ * Error thrown when the Seam API returns an error response.
4
+ */
2
5
  export declare class SeamHttpApiError extends Error {
6
+ /**
7
+ * Error type returned by the Seam API, e.g., `invalid_input`.
8
+ */
3
9
  code: string;
4
10
  statusCode: number;
11
+ /**
12
+ * Unique identifier of the request that failed.
13
+ * Provide this to Seam support when reporting an issue.
14
+ */
5
15
  requestId: string;
16
+ /**
17
+ * Additional error-specific data returned by the Seam API, if any.
18
+ */
6
19
  data?: unknown;
7
20
  constructor(error: ApiError, statusCode: number, requestId: string);
8
21
  }
22
+ /**
23
+ * Returns true if the error is a {@link SeamHttpApiError}.
24
+ */
9
25
  export declare const isSeamHttpApiError: (error: unknown) => error is SeamHttpApiError;
26
+ /**
27
+ * Error thrown when the Seam API returns a 401 Unauthorized error response.
28
+ */
10
29
  export declare class SeamHttpUnauthorizedError extends SeamHttpApiError {
11
30
  code: 'unauthorized';
12
31
  statusCode: 401;
13
32
  constructor(requestId: string);
14
33
  }
34
+ /**
35
+ * Returns true if the error is a {@link SeamHttpUnauthorizedError}.
36
+ */
15
37
  export declare const isSeamHttpUnauthorizedError: (error: unknown) => error is SeamHttpUnauthorizedError;
38
+ /**
39
+ * Error thrown when the Seam API returns an `invalid_input` error response.
40
+ */
16
41
  export declare class SeamHttpInvalidInputError extends SeamHttpApiError {
17
42
  #private;
18
43
  code: 'invalid_input';
19
44
  constructor(error: ApiError, statusCode: number, requestId: string);
45
+ /**
46
+ * Returns the validation error messages for the request parameter,
47
+ * or an empty array if the parameter had no validation errors.
48
+ *
49
+ * @param paramName - Name of the request parameter.
50
+ */
20
51
  getValidationErrorMessages(paramName: string): string[];
21
52
  }
53
+ /**
54
+ * Returns true if the error is a {@link SeamHttpInvalidInputError}.
55
+ */
22
56
  export declare const isSeamHttpInvalidInputError: (error: unknown) => error is SeamHttpInvalidInputError;