@seamapi/http 0.8.1 → 0.9.1
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 +14 -1
- package/dist/connect.cjs +314 -141
- package/dist/connect.cjs.map +1 -1
- package/dist/connect.d.cts +89 -75
- package/lib/seam/connect/client.d.ts +0 -1
- package/lib/seam/connect/client.js +0 -2
- package/lib/seam/connect/client.js.map +1 -1
- package/lib/seam/connect/options.d.ts +7 -3
- package/lib/seam/connect/options.js +2 -1
- package/lib/seam/connect/options.js.map +1 -1
- package/lib/seam/connect/parse-options.d.ts +9 -3
- package/lib/seam/connect/parse-options.js +25 -2
- package/lib/seam/connect/parse-options.js.map +1 -1
- package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +2 -1
- package/lib/seam/connect/routes/access-codes-unmanaged.js +7 -3
- package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -1
- package/lib/seam/connect/routes/access-codes.d.ts +2 -1
- package/lib/seam/connect/routes/access-codes.js +8 -4
- package/lib/seam/connect/routes/access-codes.js.map +1 -1
- package/lib/seam/connect/routes/acs-access-groups.d.ts +2 -1
- package/lib/seam/connect/routes/acs-access-groups.js +7 -3
- package/lib/seam/connect/routes/acs-access-groups.js.map +1 -1
- package/lib/seam/connect/routes/acs-credentials.d.ts +2 -1
- package/lib/seam/connect/routes/acs-credentials.js +7 -3
- package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
- package/lib/seam/connect/routes/acs-systems.d.ts +2 -1
- package/lib/seam/connect/routes/acs-systems.js +7 -3
- package/lib/seam/connect/routes/acs-systems.js.map +1 -1
- package/lib/seam/connect/routes/acs-users.d.ts +2 -1
- package/lib/seam/connect/routes/acs-users.js +7 -3
- package/lib/seam/connect/routes/acs-users.js.map +1 -1
- package/lib/seam/connect/routes/acs.d.ts +2 -1
- package/lib/seam/connect/routes/acs.js +11 -7
- package/lib/seam/connect/routes/acs.js.map +1 -1
- package/lib/seam/connect/routes/action-attempts.d.ts +4 -8
- package/lib/seam/connect/routes/action-attempts.js +15 -7
- package/lib/seam/connect/routes/action-attempts.js.map +1 -1
- package/lib/seam/connect/routes/client-sessions.d.ts +2 -1
- package/lib/seam/connect/routes/client-sessions.js +7 -3
- package/lib/seam/connect/routes/client-sessions.js.map +1 -1
- package/lib/seam/connect/routes/connect-webviews.d.ts +2 -1
- package/lib/seam/connect/routes/connect-webviews.js +7 -3
- package/lib/seam/connect/routes/connect-webviews.js.map +1 -1
- package/lib/seam/connect/routes/connected-accounts.d.ts +2 -1
- package/lib/seam/connect/routes/connected-accounts.js +7 -3
- package/lib/seam/connect/routes/connected-accounts.js.map +1 -1
- package/lib/seam/connect/routes/devices-unmanaged.d.ts +2 -1
- package/lib/seam/connect/routes/devices-unmanaged.js +7 -3
- package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -1
- package/lib/seam/connect/routes/devices.d.ts +2 -1
- package/lib/seam/connect/routes/devices.js +8 -4
- package/lib/seam/connect/routes/devices.js.map +1 -1
- package/lib/seam/connect/routes/events.d.ts +2 -1
- package/lib/seam/connect/routes/events.js +7 -3
- package/lib/seam/connect/routes/events.js.map +1 -1
- package/lib/seam/connect/routes/locks.d.ts +6 -14
- package/lib/seam/connect/routes/locks.js +22 -10
- package/lib/seam/connect/routes/locks.js.map +1 -1
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +2 -1
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +7 -3
- package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -1
- package/lib/seam/connect/routes/noise-sensors.d.ts +2 -1
- package/lib/seam/connect/routes/noise-sensors.js +8 -4
- package/lib/seam/connect/routes/noise-sensors.js.map +1 -1
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +2 -1
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js +7 -3
- package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -1
- package/lib/seam/connect/routes/thermostats.d.ts +2 -1
- package/lib/seam/connect/routes/thermostats.js +8 -4
- package/lib/seam/connect/routes/thermostats.js.map +1 -1
- package/lib/seam/connect/routes/user-identities.d.ts +2 -1
- package/lib/seam/connect/routes/user-identities.js +7 -3
- package/lib/seam/connect/routes/user-identities.js.map +1 -1
- package/lib/seam/connect/routes/webhooks.d.ts +2 -1
- package/lib/seam/connect/routes/webhooks.js +7 -3
- package/lib/seam/connect/routes/webhooks.js.map +1 -1
- package/lib/seam/connect/routes/workspaces.d.ts +2 -1
- package/lib/seam/connect/routes/workspaces.js +7 -3
- package/lib/seam/connect/routes/workspaces.js.map +1 -1
- package/lib/seam/connect/seam-http-multi-workspace.d.ts +2 -1
- package/lib/seam/connect/seam-http-multi-workspace.js +5 -4
- package/lib/seam/connect/seam-http-multi-workspace.js.map +1 -1
- package/lib/seam/connect/seam-http.d.ts +2 -1
- package/lib/seam/connect/seam-http.js +21 -17
- package/lib/seam/connect/seam-http.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/client.ts +0 -3
- package/src/lib/seam/connect/options.ts +11 -4
- package/src/lib/seam/connect/parse-options.ts +43 -4
- package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +14 -3
- package/src/lib/seam/connect/routes/access-codes.ts +15 -4
- package/src/lib/seam/connect/routes/acs-access-groups.ts +14 -3
- package/src/lib/seam/connect/routes/acs-credentials.ts +14 -3
- package/src/lib/seam/connect/routes/acs-systems.ts +14 -3
- package/src/lib/seam/connect/routes/acs-users.ts +14 -3
- package/src/lib/seam/connect/routes/acs.ts +18 -7
- package/src/lib/seam/connect/routes/action-attempts.ts +26 -16
- package/src/lib/seam/connect/routes/client-sessions.ts +14 -3
- package/src/lib/seam/connect/routes/connect-webviews.ts +14 -3
- package/src/lib/seam/connect/routes/connected-accounts.ts +14 -3
- package/src/lib/seam/connect/routes/devices-unmanaged.ts +14 -3
- package/src/lib/seam/connect/routes/devices.ts +15 -4
- package/src/lib/seam/connect/routes/events.ts +14 -3
- package/src/lib/seam/connect/routes/locks.ts +38 -26
- package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +14 -3
- package/src/lib/seam/connect/routes/noise-sensors.ts +18 -4
- package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +14 -3
- package/src/lib/seam/connect/routes/thermostats.ts +18 -4
- package/src/lib/seam/connect/routes/user-identities.ts +14 -3
- package/src/lib/seam/connect/routes/webhooks.ts +14 -3
- package/src/lib/seam/connect/routes/workspaces.ts +14 -3
- package/src/lib/seam/connect/seam-http-multi-workspace.ts +7 -4
- package/src/lib/seam/connect/seam-http.ts +25 -17
- package/src/lib/version.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client-sessions.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/client-sessions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,
|
|
1
|
+
{"version":3,"file":"client-sessions.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/client-sessions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,GAQ5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,6BAA6B,EAC7B,YAAY,GACb,MAAM,mCAAmC,CAAA;AAE1C,MAAM,OAAO,sBAAsB;IAIjC,YAAY,kBAA4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C;IAED,KAAK,CAAC,IAAI,CACR,IAA+B;QAE/B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA6B;YACrE,GAAG,EAAE,uBAAuB;YAC5B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,eAAe,CAAA;IAC7B,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAA+B;QAC1C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA+B;YACtD,GAAG,EAAE,yBAAyB;YAC9B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { RouteRequestBody, RouteRequestParams, RouteResponse } from '@seamapi/types/connect';
|
|
2
2
|
import type { SetNonNullable } from 'type-fest';
|
|
3
3
|
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
4
|
-
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken } from '../../../../lib/seam/connect/options.js';
|
|
4
|
+
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken, type SeamHttpRequestOptions } from '../../../../lib/seam/connect/options.js';
|
|
5
5
|
export declare class SeamHttpConnectWebviews {
|
|
6
6
|
client: Client;
|
|
7
|
+
readonly defaults: Required<SeamHttpRequestOptions>;
|
|
7
8
|
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
8
9
|
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpConnectWebviews;
|
|
9
10
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpConnectWebviews;
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
import { warnOnInsecureuserIdentifierKey } from '../../../../lib/seam/connect/auth.js';
|
|
6
6
|
import { createClient } from '../../../../lib/seam/connect/client.js';
|
|
7
7
|
import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
-
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
8
|
+
import { limitToSeamHttpRequestOptions, parseOptions, } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
9
|
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
10
|
export class SeamHttpConnectWebviews {
|
|
11
11
|
constructor(apiKeyOrOptions = {}) {
|
|
12
|
-
const
|
|
13
|
-
this.client = createClient(
|
|
12
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
13
|
+
this.client = 'client' in options ? options.client : createClient(options);
|
|
14
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
14
15
|
}
|
|
15
16
|
static fromClient(client, options = {}) {
|
|
16
17
|
const constructorOptions = { ...options, client };
|
|
@@ -36,6 +37,9 @@ export class SeamHttpConnectWebviews {
|
|
|
36
37
|
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
37
38
|
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
38
39
|
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
40
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
41
|
+
throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttp.fromPublishableKey');
|
|
42
|
+
}
|
|
39
43
|
const client = createClient(clientOptions);
|
|
40
44
|
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
41
45
|
const { token } = await clientSessions.getOrCreate({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connect-webviews.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/connect-webviews.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,
|
|
1
|
+
{"version":3,"file":"connect-webviews.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/connect-webviews.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,GAQ5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,6BAA6B,EAC7B,YAAY,GACb,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,OAAO,uBAAuB;IAIlC,YAAY,kBAA4C,EAAE;QACxD,MAAM,OAAO,GAAG,YAAY,CAAC,eAAe,CAAC,CAAA;QAC7C,IAAI,CAAC,MAAM,GAAG,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,YAAY,CAAC,OAAO,CAAC,CAAA;QAC1E,IAAI,CAAC,QAAQ,GAAG,6BAA6B,CAAC,OAAO,CAAC,CAAA;IAC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B,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAgC;QAC3C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAgC;YACvD,GAAG,EAAE,0BAA0B;YAC/B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CACP,IAA+B;QAE/B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA6B;YACrE,GAAG,EAAE,uBAAuB;YAC5B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,eAAe,CAAA;IAC7B,CAAC;IAED,KAAK,CAAC,IAAI,CACR,IAAgC;QAEhC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8B;YACtE,GAAG,EAAE,wBAAwB;YAC7B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,gBAAgB,CAAA;IAC9B,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,MAAkC;QAC3C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8B;YACrD,GAAG,EAAE,wBAAwB;YAC7B,MAAM,EAAE,KAAK;YACb,MAAM;SACP,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { RouteRequestBody, RouteRequestParams, RouteResponse } from '@seamapi/types/connect';
|
|
2
2
|
import type { SetNonNullable } from 'type-fest';
|
|
3
3
|
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
4
|
-
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken } from '../../../../lib/seam/connect/options.js';
|
|
4
|
+
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken, type SeamHttpRequestOptions } from '../../../../lib/seam/connect/options.js';
|
|
5
5
|
export declare class SeamHttpConnectedAccounts {
|
|
6
6
|
client: Client;
|
|
7
|
+
readonly defaults: Required<SeamHttpRequestOptions>;
|
|
7
8
|
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
8
9
|
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpConnectedAccounts;
|
|
9
10
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpConnectedAccounts;
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
import { warnOnInsecureuserIdentifierKey } from '../../../../lib/seam/connect/auth.js';
|
|
6
6
|
import { createClient } from '../../../../lib/seam/connect/client.js';
|
|
7
7
|
import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
-
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
8
|
+
import { limitToSeamHttpRequestOptions, parseOptions, } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
9
|
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
10
|
export class SeamHttpConnectedAccounts {
|
|
11
11
|
constructor(apiKeyOrOptions = {}) {
|
|
12
|
-
const
|
|
13
|
-
this.client = createClient(
|
|
12
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
13
|
+
this.client = 'client' in options ? options.client : createClient(options);
|
|
14
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
14
15
|
}
|
|
15
16
|
static fromClient(client, options = {}) {
|
|
16
17
|
const constructorOptions = { ...options, client };
|
|
@@ -36,6 +37,9 @@ export class SeamHttpConnectedAccounts {
|
|
|
36
37
|
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
37
38
|
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
38
39
|
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
40
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
41
|
+
throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttp.fromPublishableKey');
|
|
42
|
+
}
|
|
39
43
|
const client = createClient(clientOptions);
|
|
40
44
|
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
41
45
|
const { token } = await clientSessions.getOrCreate({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connected-accounts.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/connected-accounts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,
|
|
1
|
+
{"version":3,"file":"connected-accounts.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/connected-accounts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,GAQ5B,M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AmB,EAAE,WAAW,EAAE,CAAA;QAC3E,IAAI,CAAC,wCAAwC,CAAC,kBAAkB,CAAC,EAAE;YACjE,MAAM,IAAI,2BAA2B,CACnC,4CAA4C,CAC7C,CAAA;SACF;QACD,OAAO,IAAI,yBAAyB,CAAC,kBAAkB,CAAC,CAAA;IAC1D,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAkC;QAC7C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAkC;YACzD,GAAG,EAAE,4BAA4B;YACjC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;IAED,KAAK,CAAC,GAAG,CACP,IAAiC;QAEjC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA+B;YACvE,GAAG,EAAE,yBAAyB;YAC9B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,iBAAiB,CAAA;IAC/B,CAAC;IAED,KAAK,CAAC,IAAI,CACR,MAAoC;QAEpC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAgC;YACxE,GAAG,EAAE,0BAA0B;YAC/B,MAAM,EAAE,KAAK;YACb,MAAM;SACP,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,kBAAkB,CAAA;IAChC,CAAC;CACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect';
|
|
2
2
|
import type { SetNonNullable } from 'type-fest';
|
|
3
3
|
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
4
|
-
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken } from '../../../../lib/seam/connect/options.js';
|
|
4
|
+
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken, type SeamHttpRequestOptions } from '../../../../lib/seam/connect/options.js';
|
|
5
5
|
export declare class SeamHttpDevicesUnmanaged {
|
|
6
6
|
client: Client;
|
|
7
|
+
readonly defaults: Required<SeamHttpRequestOptions>;
|
|
7
8
|
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
8
9
|
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpDevicesUnmanaged;
|
|
9
10
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpDevicesUnmanaged;
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
import { warnOnInsecureuserIdentifierKey } from '../../../../lib/seam/connect/auth.js';
|
|
6
6
|
import { createClient } from '../../../../lib/seam/connect/client.js';
|
|
7
7
|
import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
-
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
8
|
+
import { limitToSeamHttpRequestOptions, parseOptions, } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
9
|
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
10
|
export class SeamHttpDevicesUnmanaged {
|
|
11
11
|
constructor(apiKeyOrOptions = {}) {
|
|
12
|
-
const
|
|
13
|
-
this.client = createClient(
|
|
12
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
13
|
+
this.client = 'client' in options ? options.client : createClient(options);
|
|
14
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
14
15
|
}
|
|
15
16
|
static fromClient(client, options = {}) {
|
|
16
17
|
const constructorOptions = { ...options, client };
|
|
@@ -36,6 +37,9 @@ export class SeamHttpDevicesUnmanaged {
|
|
|
36
37
|
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
37
38
|
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
38
39
|
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
40
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
41
|
+
throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttp.fromPublishableKey');
|
|
42
|
+
}
|
|
39
43
|
const client = createClient(clientOptions);
|
|
40
44
|
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
41
45
|
const { token } = await clientSessions.getOrCreate({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devices-unmanaged.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/devices-unmanaged.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,
|
|
1
|
+
{"version":3,"file":"devices-unmanaged.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/devices-unmanaged.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EA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OAAO,EAAE,mBAAmB,EAAE,WAAW,EAAE,CAAA;QAC3E,IAAI,CAAC,wCAAwC,CAAC,kBAAkB,CAAC,EAAE;YACjE,MAAM,IAAI,2BAA2B,CACnC,4CAA4C,CAC7C,CAAA;SACF;QACD,OAAO,IAAI,wBAAwB,CAAC,kBAAkB,CAAC,CAAA;IACzD,CAAC;IAED,KAAK,CAAC,GAAG,CACP,IAAgC;QAEhC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8B;YACtE,GAAG,EAAE,wBAAwB;YAC7B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;IAED,KAAK,CAAC,IAAI,CACR,IAAiC;QAEjC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA+B;YACvE,GAAG,EAAE,yBAAyB;YAC9B,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAiC;QAC5C,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAiC;YACxD,GAAG,EAAE,2BAA2B;YAChC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect';
|
|
2
2
|
import type { SetNonNullable } from 'type-fest';
|
|
3
3
|
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
4
|
-
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken } from '../../../../lib/seam/connect/options.js';
|
|
4
|
+
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken, type SeamHttpRequestOptions } from '../../../../lib/seam/connect/options.js';
|
|
5
5
|
import { SeamHttpDevicesUnmanaged } from './devices-unmanaged.js';
|
|
6
6
|
export declare class SeamHttpDevices {
|
|
7
7
|
client: Client;
|
|
8
|
+
readonly defaults: Required<SeamHttpRequestOptions>;
|
|
8
9
|
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
9
10
|
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpDevices;
|
|
10
11
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpDevices;
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
import { warnOnInsecureuserIdentifierKey } from '../../../../lib/seam/connect/auth.js';
|
|
6
6
|
import { createClient } from '../../../../lib/seam/connect/client.js';
|
|
7
7
|
import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
-
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
8
|
+
import { limitToSeamHttpRequestOptions, parseOptions, } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
9
|
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
10
|
import { SeamHttpDevicesUnmanaged } from './devices-unmanaged.js';
|
|
11
11
|
export class SeamHttpDevices {
|
|
12
12
|
constructor(apiKeyOrOptions = {}) {
|
|
13
|
-
const
|
|
14
|
-
this.client = createClient(
|
|
13
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
14
|
+
this.client = 'client' in options ? options.client : createClient(options);
|
|
15
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
15
16
|
}
|
|
16
17
|
static fromClient(client, options = {}) {
|
|
17
18
|
const constructorOptions = { ...options, client };
|
|
@@ -37,6 +38,9 @@ export class SeamHttpDevices {
|
|
|
37
38
|
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
38
39
|
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
39
40
|
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
41
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
42
|
+
throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttp.fromPublishableKey');
|
|
43
|
+
}
|
|
40
44
|
const client = createClient(clientOptions);
|
|
41
45
|
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
42
46
|
const { token } = await clientSessions.getOrCreate({
|
|
@@ -59,7 +63,7 @@ export class SeamHttpDevices {
|
|
|
59
63
|
return new SeamHttpDevices(constructorOptions);
|
|
60
64
|
}
|
|
61
65
|
get unmanaged() {
|
|
62
|
-
return SeamHttpDevicesUnmanaged.fromClient(this.client);
|
|
66
|
+
return SeamHttpDevicesUnmanaged.fromClient(this.client, this.defaults);
|
|
63
67
|
}
|
|
64
68
|
async delete(body) {
|
|
65
69
|
await this.client.request({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"devices.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/devices.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,E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,CAAC,MAAM,CAAC,OAAO,CAAsB;YAC9D,GAAG,EAAE,eAAe;YACpB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,OAAO,CAAA;IACrB,CAAC;IAED,KAAK,CAAC,mBAAmB,CACvB,IAAuC;QAEvC,MAAM,EAAE,IAAI,EAAE,GACZ,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAqC;YAC5D,GAAG,EAAE,gCAAgC;YACrC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEJ,OAAO,IAAI,CAAC,gBAAgB,CAAA;IAC9B,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAwB;QACnC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAwB;YAC/C,GAAG,EAAE,iBAAiB;YACtB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect';
|
|
2
2
|
import type { SetNonNullable } from 'type-fest';
|
|
3
3
|
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
4
|
-
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken } from '../../../../lib/seam/connect/options.js';
|
|
4
|
+
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken, type SeamHttpRequestOptions } from '../../../../lib/seam/connect/options.js';
|
|
5
5
|
export declare class SeamHttpEvents {
|
|
6
6
|
client: Client;
|
|
7
|
+
readonly defaults: Required<SeamHttpRequestOptions>;
|
|
7
8
|
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
8
9
|
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpEvents;
|
|
9
10
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpEvents;
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
import { warnOnInsecureuserIdentifierKey } from '../../../../lib/seam/connect/auth.js';
|
|
6
6
|
import { createClient } from '../../../../lib/seam/connect/client.js';
|
|
7
7
|
import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
-
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
8
|
+
import { limitToSeamHttpRequestOptions, parseOptions, } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
9
|
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
10
|
export class SeamHttpEvents {
|
|
11
11
|
constructor(apiKeyOrOptions = {}) {
|
|
12
|
-
const
|
|
13
|
-
this.client = createClient(
|
|
12
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
13
|
+
this.client = 'client' in options ? options.client : createClient(options);
|
|
14
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
14
15
|
}
|
|
15
16
|
static fromClient(client, options = {}) {
|
|
16
17
|
const constructorOptions = { ...options, client };
|
|
@@ -36,6 +37,9 @@ export class SeamHttpEvents {
|
|
|
36
37
|
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
37
38
|
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
38
39
|
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
40
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
41
|
+
throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttp.fromPublishableKey');
|
|
42
|
+
}
|
|
39
43
|
const client = createClient(clientOptions);
|
|
40
44
|
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
41
45
|
const { token } = await clientSessions.getOrCreate({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/events.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,GAQ5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,6BAA6B,EAC7B,YAAY,GACb,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,OAAO,cAAc;IAIzB,YAAY,kBAA4C,EAAE;QACxD,MAAM,OAAO,GAAG,YAAY,CAAC,eAAe,CAAC,CAAA;QAC7C,IAAI,CAAC,MAAM,GAAG,QAAQ,IAAI,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,C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;YAClB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,KAAK,CAAA;IACnB,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,IAAuB;QAChC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAqB;YAC7D,GAAG,EAAE,cAAc;YACnB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;CACF"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect';
|
|
2
2
|
import type { SetNonNullable } from 'type-fest';
|
|
3
3
|
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
4
|
-
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken } from '../../../../lib/seam/connect/options.js';
|
|
5
|
-
import { type ResolveActionAttemptOptions } from '../../../../lib/seam/connect/resolve-action-attempt.js';
|
|
4
|
+
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken, type SeamHttpRequestOptions } from '../../../../lib/seam/connect/options.js';
|
|
6
5
|
export declare class SeamHttpLocks {
|
|
7
6
|
client: Client;
|
|
7
|
+
readonly defaults: Required<SeamHttpRequestOptions>;
|
|
8
8
|
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
9
9
|
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpLocks;
|
|
10
10
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpLocks;
|
|
@@ -14,12 +14,8 @@ export declare class SeamHttpLocks {
|
|
|
14
14
|
static fromPersonalAccessToken(personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'], workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'], options?: Omit<SeamHttpOptionsWithPersonalAccessToken, 'personalAccessToken' | 'workspaceId'>): SeamHttpLocks;
|
|
15
15
|
get(body?: LocksGetParams): Promise<LocksGetResponse['device']>;
|
|
16
16
|
list(body?: LocksListParams): Promise<LocksListResponse['devices']>;
|
|
17
|
-
lockDoor(body?: LocksLockDoorBody,
|
|
18
|
-
|
|
19
|
-
}): Promise<LocksLockDoorResponse['action_attempt']>;
|
|
20
|
-
unlockDoor(body?: LocksUnlockDoorBody, { waitForActionAttempt, }?: {
|
|
21
|
-
waitForActionAttempt?: boolean | Partial<ResolveActionAttemptOptions>;
|
|
22
|
-
}): Promise<LocksUnlockDoorResponse['action_attempt']>;
|
|
17
|
+
lockDoor(body?: LocksLockDoorBody, options?: Pick<SeamHttpRequestOptions, 'waitForActionAttempt'>): Promise<LocksLockDoorResponse['action_attempt']>;
|
|
18
|
+
unlockDoor(body?: LocksUnlockDoorBody, options?: Pick<SeamHttpRequestOptions, 'waitForActionAttempt'>): Promise<LocksUnlockDoorResponse['action_attempt']>;
|
|
23
19
|
}
|
|
24
20
|
export type LocksGetParams = RouteRequestBody<'/locks/get'>;
|
|
25
21
|
export type LocksGetResponse = SetNonNullable<Required<RouteResponse<'/locks/get'>>>;
|
|
@@ -29,11 +25,7 @@ export type LocksListResponse = SetNonNullable<Required<RouteResponse<'/locks/li
|
|
|
29
25
|
export type LocksListOptions = never;
|
|
30
26
|
export type LocksLockDoorBody = RouteRequestBody<'/locks/lock_door'>;
|
|
31
27
|
export type LocksLockDoorResponse = SetNonNullable<Required<RouteResponse<'/locks/lock_door'>>>;
|
|
32
|
-
export
|
|
33
|
-
waitForActionAttempt?: boolean | Partial<ResolveActionAttemptOptions>;
|
|
34
|
-
}
|
|
28
|
+
export type LocksLockDoorOptions = Pick<SeamHttpRequestOptions, 'waitForActionAttempt'>;
|
|
35
29
|
export type LocksUnlockDoorBody = RouteRequestBody<'/locks/unlock_door'>;
|
|
36
30
|
export type LocksUnlockDoorResponse = SetNonNullable<Required<RouteResponse<'/locks/unlock_door'>>>;
|
|
37
|
-
export
|
|
38
|
-
waitForActionAttempt?: boolean | Partial<ResolveActionAttemptOptions>;
|
|
39
|
-
}
|
|
31
|
+
export type LocksUnlockDoorOptions = Pick<SeamHttpRequestOptions, 'waitForActionAttempt'>;
|
|
@@ -5,14 +5,15 @@
|
|
|
5
5
|
import { warnOnInsecureuserIdentifierKey } from '../../../../lib/seam/connect/auth.js';
|
|
6
6
|
import { createClient } from '../../../../lib/seam/connect/client.js';
|
|
7
7
|
import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
-
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
|
-
import { resolveActionAttempt
|
|
8
|
+
import { limitToSeamHttpRequestOptions, parseOptions, } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
|
+
import { resolveActionAttempt } from '../../../../lib/seam/connect/resolve-action-attempt.js';
|
|
10
10
|
import { SeamHttpActionAttempts } from './action-attempts.js';
|
|
11
11
|
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
12
12
|
export class SeamHttpLocks {
|
|
13
13
|
constructor(apiKeyOrOptions = {}) {
|
|
14
|
-
const
|
|
15
|
-
this.client = createClient(
|
|
14
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
15
|
+
this.client = 'client' in options ? options.client : createClient(options);
|
|
16
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
16
17
|
}
|
|
17
18
|
static fromClient(client, options = {}) {
|
|
18
19
|
const constructorOptions = { ...options, client };
|
|
@@ -38,6 +39,9 @@ export class SeamHttpLocks {
|
|
|
38
39
|
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
39
40
|
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
40
41
|
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
42
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
43
|
+
throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttp.fromPublishableKey');
|
|
44
|
+
}
|
|
41
45
|
const client = createClient(clientOptions);
|
|
42
46
|
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
43
47
|
const { token } = await clientSessions.getOrCreate({
|
|
@@ -75,25 +79,33 @@ export class SeamHttpLocks {
|
|
|
75
79
|
});
|
|
76
80
|
return data.devices;
|
|
77
81
|
}
|
|
78
|
-
async lockDoor(body,
|
|
82
|
+
async lockDoor(body, options = {}) {
|
|
79
83
|
const { data } = await this.client.request({
|
|
80
84
|
url: '/locks/lock_door',
|
|
81
85
|
method: 'post',
|
|
82
86
|
data: body,
|
|
83
87
|
});
|
|
84
|
-
|
|
85
|
-
|
|
88
|
+
const waitForActionAttempt = options.waitForActionAttempt ?? this.defaults.waitForActionAttempt;
|
|
89
|
+
if (waitForActionAttempt !== false) {
|
|
90
|
+
return await resolveActionAttempt(data.action_attempt, SeamHttpActionAttempts.fromClient(this.client, {
|
|
91
|
+
...this.defaults,
|
|
92
|
+
waitForActionAttempt: false,
|
|
93
|
+
}), typeof waitForActionAttempt === 'boolean' ? {} : waitForActionAttempt);
|
|
86
94
|
}
|
|
87
95
|
return data.action_attempt;
|
|
88
96
|
}
|
|
89
|
-
async unlockDoor(body,
|
|
97
|
+
async unlockDoor(body, options = {}) {
|
|
90
98
|
const { data } = await this.client.request({
|
|
91
99
|
url: '/locks/unlock_door',
|
|
92
100
|
method: 'post',
|
|
93
101
|
data: body,
|
|
94
102
|
});
|
|
95
|
-
|
|
96
|
-
|
|
103
|
+
const waitForActionAttempt = options.waitForActionAttempt ?? this.defaults.waitForActionAttempt;
|
|
104
|
+
if (waitForActionAttempt !== false) {
|
|
105
|
+
return await resolveActionAttempt(data.action_attempt, SeamHttpActionAttempts.fromClient(this.client, {
|
|
106
|
+
...this.defaults,
|
|
107
|
+
waitForActionAttempt: false,
|
|
108
|
+
}), typeof waitForActionAttempt === 'boolean' ? {} : waitForActionAttempt);
|
|
97
109
|
}
|
|
98
110
|
return data.action_attempt;
|
|
99
111
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"locks.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/locks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,
|
|
1
|
+
{"version":3,"file":"locks.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/locks.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,GAQ5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,6BAA6B,EAC7B,YAAY,GACb,MAAM,mCAAmC,CAAA;AAC1C,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAA;AAEjF,OAAO,EAAE,sBAAs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,EAAE,CAAC,CAAC,CAAC,oBAAoB,CACtE,CAAA;SACF;QACD,OAAO,IAAI,CAAC,cAAc,CAAA;IAC5B,CAAC;IAED,KAAK,CAAC,UAAU,CACd,IAA0B,EAC1B,UAAgE,EAAE;QAElE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA0B;YAClE,GAAG,EAAE,oBAAoB;YACzB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QACF,MAAM,oBAAoB,GACxB,OAAO,CAAC,oBAAoB,IAAI,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAA;QACpE,IAAI,oBAAoB,KAAK,KAAK,EAAE;YAClC,OAAO,MAAM,oBAAoB,CAC/B,IAAI,CAAC,cAAc,EACnB,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE;gBAC7C,GAAG,IAAI,CAAC,QAAQ;gBAChB,oBAAoB,EAAE,KAAK;aAC5B,CAAC,EACF,OAAO,oBAAoB,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,oBAAoB,CACtE,CAAA;SACF;QACD,OAAO,IAAI,CAAC,cAAc,CAAA;IAC5B,CAAC;CACF"}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { RouteRequestBody, RouteResponse } from '@seamapi/types/connect';
|
|
2
2
|
import type { SetNonNullable } from 'type-fest';
|
|
3
3
|
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
4
|
-
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken } from '../../../../lib/seam/connect/options.js';
|
|
4
|
+
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken, type SeamHttpRequestOptions } from '../../../../lib/seam/connect/options.js';
|
|
5
5
|
export declare class SeamHttpNoiseSensorsNoiseThresholds {
|
|
6
6
|
client: Client;
|
|
7
|
+
readonly defaults: Required<SeamHttpRequestOptions>;
|
|
7
8
|
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
8
9
|
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpNoiseSensorsNoiseThresholds;
|
|
9
10
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpNoiseSensorsNoiseThresholds;
|
|
@@ -5,12 +5,13 @@
|
|
|
5
5
|
import { warnOnInsecureuserIdentifierKey } from '../../../../lib/seam/connect/auth.js';
|
|
6
6
|
import { createClient } from '../../../../lib/seam/connect/client.js';
|
|
7
7
|
import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
-
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
8
|
+
import { limitToSeamHttpRequestOptions, parseOptions, } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
9
|
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
10
|
export class SeamHttpNoiseSensorsNoiseThresholds {
|
|
11
11
|
constructor(apiKeyOrOptions = {}) {
|
|
12
|
-
const
|
|
13
|
-
this.client = createClient(
|
|
12
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
13
|
+
this.client = 'client' in options ? options.client : createClient(options);
|
|
14
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
14
15
|
}
|
|
15
16
|
static fromClient(client, options = {}) {
|
|
16
17
|
const constructorOptions = { ...options, client };
|
|
@@ -36,6 +37,9 @@ export class SeamHttpNoiseSensorsNoiseThresholds {
|
|
|
36
37
|
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
37
38
|
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
38
39
|
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
40
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
41
|
+
throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttp.fromPublishableKey');
|
|
42
|
+
}
|
|
39
43
|
const client = createClient(clientOptions);
|
|
40
44
|
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
41
45
|
const { token } = await clientSessions.getOrCreate({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noise-sensors-noise-thresholds.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,
|
|
1
|
+
{"version":3,"file":"noise-sensors-noise-thresholds.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,uCAAuC,EACvC,wCAAwC,EACxC,wCAAwC,EAExC,2BAA2B,GAQ5B,MAAM,6BAA6B,CAAA;AACpC,OAAO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C,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type Client } from '../../../../lib/seam/connect/client.js';
|
|
2
|
-
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken } from '../../../../lib/seam/connect/options.js';
|
|
2
|
+
import { type SeamHttpFromPublishableKeyOptions, type SeamHttpOptions, type SeamHttpOptionsWithApiKey, type SeamHttpOptionsWithClient, type SeamHttpOptionsWithClientSessionToken, type SeamHttpOptionsWithConsoleSessionToken, type SeamHttpOptionsWithPersonalAccessToken, type SeamHttpRequestOptions } from '../../../../lib/seam/connect/options.js';
|
|
3
3
|
import { SeamHttpNoiseSensorsNoiseThresholds } from './noise-sensors-noise-thresholds.js';
|
|
4
4
|
export declare class SeamHttpNoiseSensors {
|
|
5
5
|
client: Client;
|
|
6
|
+
readonly defaults: Required<SeamHttpRequestOptions>;
|
|
6
7
|
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
7
8
|
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpNoiseSensors;
|
|
8
9
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpNoiseSensors;
|
|
@@ -5,13 +5,14 @@
|
|
|
5
5
|
import { warnOnInsecureuserIdentifierKey } from '../../../../lib/seam/connect/auth.js';
|
|
6
6
|
import { createClient } from '../../../../lib/seam/connect/client.js';
|
|
7
7
|
import { isSeamHttpOptionsWithApiKey, isSeamHttpOptionsWithClient, isSeamHttpOptionsWithClientSessionToken, isSeamHttpOptionsWithConsoleSessionToken, isSeamHttpOptionsWithPersonalAccessToken, SeamHttpInvalidOptionsError, } from '../../../../lib/seam/connect/options.js';
|
|
8
|
-
import { parseOptions } from '../../../../lib/seam/connect/parse-options.js';
|
|
8
|
+
import { limitToSeamHttpRequestOptions, parseOptions, } from '../../../../lib/seam/connect/parse-options.js';
|
|
9
9
|
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
10
10
|
import { SeamHttpNoiseSensorsNoiseThresholds } from './noise-sensors-noise-thresholds.js';
|
|
11
11
|
export class SeamHttpNoiseSensors {
|
|
12
12
|
constructor(apiKeyOrOptions = {}) {
|
|
13
|
-
const
|
|
14
|
-
this.client = createClient(
|
|
13
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
14
|
+
this.client = 'client' in options ? options.client : createClient(options);
|
|
15
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
15
16
|
}
|
|
16
17
|
static fromClient(client, options = {}) {
|
|
17
18
|
const constructorOptions = { ...options, client };
|
|
@@ -37,6 +38,9 @@ export class SeamHttpNoiseSensors {
|
|
|
37
38
|
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
38
39
|
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
39
40
|
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
41
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
42
|
+
throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttp.fromPublishableKey');
|
|
43
|
+
}
|
|
40
44
|
const client = createClient(clientOptions);
|
|
41
45
|
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
42
46
|
const { token } = await clientSessions.getOrCreate({
|
|
@@ -59,7 +63,7 @@ export class SeamHttpNoiseSensors {
|
|
|
59
63
|
return new SeamHttpNoiseSensors(constructorOptions);
|
|
60
64
|
}
|
|
61
65
|
get noiseThresholds() {
|
|
62
|
-
return SeamHttpNoiseSensorsNoiseThresholds.fromClient(this.client);
|
|
66
|
+
return SeamHttpNoiseSensorsNoiseThresholds.fromClient(this.client, this.defaults);
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
69
|
//# sourceMappingURL=noise-sensors.js.map
|