@seamapi/http 0.12.0 → 0.13.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/README.md +12 -0
- package/connect.d.ts +1 -0
- package/connect.js +1 -0
- package/connect.js.map +1 -1
- package/dist/connect.cjs +10 -50
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +3 -7
- package/lib/seam/connect/auth.js +2 -1
- package/lib/seam/connect/auth.js.map +1 -1
- package/lib/seam/connect/client.js +2 -2
- package/lib/seam/connect/client.js.map +1 -1
- package/lib/seam/connect/index.d.ts +0 -1
- package/lib/seam/connect/index.js +0 -1
- package/lib/seam/connect/index.js.map +1 -1
- package/lib/version.d.ts +1 -1
- package/lib/version.js +1 -1
- package/package.json +2 -1
- package/src/connect.ts +1 -0
- package/src/lib/seam/connect/auth.ts +2 -1
- package/src/lib/seam/connect/client.ts +2 -3
- package/src/lib/seam/connect/index.ts +0 -1
- package/src/lib/version.ts +1 -1
- package/lib/params-serializer.d.ts +0 -5
- package/lib/params-serializer.js +0 -40
- package/lib/params-serializer.js.map +0 -1
- package/src/lib/params-serializer.ts +0 -44
package/README.md
CHANGED
|
@@ -211,6 +211,18 @@ const seam = new SeamHttp({
|
|
|
211
211
|
await seam.locks.unlockDoor({ device_id })
|
|
212
212
|
```
|
|
213
213
|
|
|
214
|
+
If you have already have an action attempt id
|
|
215
|
+
and want to wait for it to resolve, simply use
|
|
216
|
+
|
|
217
|
+
```ts
|
|
218
|
+
await seam.actionAttempts.get(
|
|
219
|
+
{ action_attempt_id },
|
|
220
|
+
{
|
|
221
|
+
waitForActionAttempt: true,
|
|
222
|
+
},
|
|
223
|
+
)
|
|
224
|
+
```
|
|
225
|
+
|
|
214
226
|
Using the `waitForActionAttempt` option:
|
|
215
227
|
|
|
216
228
|
- Polls the action attempt up to the `timeout`
|
package/connect.d.ts
CHANGED
package/connect.js
CHANGED
package/connect.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect.js","sourceRoot":"","sources":["src/connect.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA"}
|
|
1
|
+
{"version":3,"file":"connect.js","sourceRoot":"","sources":["src/connect.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAA;AAC3C,cAAc,uCAAuC,CAAA"}
|
package/dist/connect.cjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var axios = require('axios');
|
|
4
|
+
var urlSearchParamsSerializer = require('@seamapi/url-search-params-serializer');
|
|
4
5
|
var axiosBetterStacktrace = require('axios-better-stacktrace');
|
|
5
6
|
var axiosRetry = require('axios-retry');
|
|
6
7
|
|
|
@@ -268,7 +269,8 @@ var getAuthHeaders = (options) => {
|
|
|
268
269
|
"clientSessionToken,",
|
|
269
270
|
"publishableKey,",
|
|
270
271
|
"consoleSessionToken",
|
|
271
|
-
"or personalAccessToken"
|
|
272
|
+
"or personalAccessToken.",
|
|
273
|
+
"Attempted reading configuration from the environment, but the environment variable SEAM_API_KEY is not set."
|
|
272
274
|
].join(" ")
|
|
273
275
|
);
|
|
274
276
|
};
|
|
@@ -525,55 +527,9 @@ var getRequestId = (err) => {
|
|
|
525
527
|
return "";
|
|
526
528
|
return requestId;
|
|
527
529
|
};
|
|
528
|
-
|
|
529
|
-
// src/lib/params-serializer.ts
|
|
530
|
-
var paramsSerializer = (params) => {
|
|
531
|
-
const searchParams = new URLSearchParams();
|
|
532
|
-
for (const [name, value] of Object.entries(params)) {
|
|
533
|
-
if (value == null)
|
|
534
|
-
continue;
|
|
535
|
-
if (Array.isArray(value)) {
|
|
536
|
-
if (value.length === 0)
|
|
537
|
-
searchParams.set(name, "");
|
|
538
|
-
if (value.length === 1 && value[0] === "") {
|
|
539
|
-
throw new UnserializableParamError(
|
|
540
|
-
name,
|
|
541
|
-
`is a single element array containing the empty string which is unsupported because it serializes to the empty array`
|
|
542
|
-
);
|
|
543
|
-
}
|
|
544
|
-
for (const v of value) {
|
|
545
|
-
searchParams.append(name, serialize(name, v));
|
|
546
|
-
}
|
|
547
|
-
continue;
|
|
548
|
-
}
|
|
549
|
-
searchParams.set(name, serialize(name, value));
|
|
550
|
-
}
|
|
551
|
-
searchParams.sort();
|
|
552
|
-
return searchParams.toString();
|
|
553
|
-
};
|
|
554
|
-
var serialize = (k, v) => {
|
|
555
|
-
if (typeof v === "string")
|
|
556
|
-
return v.toString();
|
|
557
|
-
if (typeof v === "number")
|
|
558
|
-
return v.toString();
|
|
559
|
-
if (typeof v === "bigint")
|
|
560
|
-
return v.toString();
|
|
561
|
-
if (typeof v === "boolean")
|
|
562
|
-
return v.toString();
|
|
563
|
-
throw new UnserializableParamError(k, `is a ${typeof v}`);
|
|
564
|
-
};
|
|
565
|
-
var UnserializableParamError = class extends Error {
|
|
566
|
-
constructor(name, message) {
|
|
567
|
-
super(`Could not serialize parameter: '${name}' ${message}`);
|
|
568
|
-
this.name = this.constructor.name;
|
|
569
|
-
Error.captureStackTrace(this, this.constructor);
|
|
570
|
-
}
|
|
571
|
-
};
|
|
572
|
-
|
|
573
|
-
// src/lib/seam/connect/client.ts
|
|
574
530
|
var createClient = (options) => {
|
|
575
531
|
const client = axios__default.default.create({
|
|
576
|
-
paramsSerializer,
|
|
532
|
+
paramsSerializer: urlSearchParamsSerializer.serializeUrlSearchParams,
|
|
577
533
|
...options.axiosOptions
|
|
578
534
|
});
|
|
579
535
|
axiosBetterStacktrace__default.default(axios__default.default);
|
|
@@ -3354,7 +3310,6 @@ exports.SeamHttpUnauthorizedError = SeamHttpUnauthorizedError;
|
|
|
3354
3310
|
exports.SeamHttpUserIdentities = SeamHttpUserIdentities;
|
|
3355
3311
|
exports.SeamHttpWebhooks = SeamHttpWebhooks;
|
|
3356
3312
|
exports.SeamHttpWorkspaces = SeamHttpWorkspaces;
|
|
3357
|
-
exports.UnserializableParamError = UnserializableParamError;
|
|
3358
3313
|
exports.errorInterceptor = errorInterceptor;
|
|
3359
3314
|
exports.getOpenapiSchema = getOpenapiSchema;
|
|
3360
3315
|
exports.isApiKey = isApiKey;
|
|
@@ -3376,6 +3331,11 @@ exports.isSeamHttpOptionsWithClientSessionToken = isSeamHttpOptionsWithClientSes
|
|
|
3376
3331
|
exports.isSeamHttpOptionsWithConsoleSessionToken = isSeamHttpOptionsWithConsoleSessionToken;
|
|
3377
3332
|
exports.isSeamHttpOptionsWithPersonalAccessToken = isSeamHttpOptionsWithPersonalAccessToken;
|
|
3378
3333
|
exports.isSeamHttpUnauthorizedError = isSeamHttpUnauthorizedError;
|
|
3379
|
-
|
|
3334
|
+
Object.keys(urlSearchParamsSerializer).forEach(function (k) {
|
|
3335
|
+
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, {
|
|
3336
|
+
enumerable: true,
|
|
3337
|
+
get: function () { return urlSearchParamsSerializer[k]; }
|
|
3338
|
+
});
|
|
3339
|
+
});
|
|
3380
3340
|
//# sourceMappingURL=out.js.map
|
|
3381
3341
|
//# sourceMappingURL=connect.cjs.map
|