@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":"access-codes-unmanaged.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/access-codes-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":"access-codes-unmanaged.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/access-codes-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,GAQ5B,MAAM,6BAA6B,CAAA;AACpC,OAAO,EACL,6BAA6B,EAC7B,YAAY,GACb,MAAM,mCAAmC,CAAA;AAE1C,OAAO,EAAE,sBA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estBody, 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 { SeamHttpAccessCodesUnmanaged } from './access-codes-unmanaged.js';
|
|
6
6
|
export declare class SeamHttpAccessCodes {
|
|
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'>): SeamHttpAccessCodes;
|
|
10
11
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpAccessCodes;
|
|
@@ -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 { SeamHttpAccessCodesUnmanaged } from './access-codes-unmanaged.js';
|
|
10
10
|
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
11
11
|
export class SeamHttpAccessCodes {
|
|
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 SeamHttpAccessCodes {
|
|
|
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 SeamHttpAccessCodes {
|
|
|
59
63
|
return new SeamHttpAccessCodes(constructorOptions);
|
|
60
64
|
}
|
|
61
65
|
get unmanaged() {
|
|
62
|
-
return SeamHttpAccessCodesUnmanaged.fromClient(this.client);
|
|
66
|
+
return SeamHttpAccessCodesUnmanaged.fromClient(this.client, this.defaults);
|
|
63
67
|
}
|
|
64
68
|
async create(body) {
|
|
65
69
|
const { data } = await this.client.request({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"access-codes.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/access-codes.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":"access-codes.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/access-codes.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,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAC1E,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,OAAO,mBAAmB;IAI9B,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;IACxD,CAAC;IAED,MAAM,CAAC,UAAU,CACf,MAA2C,EAC3C,UAAqD,EAAE;QAEvD,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,CAAC,YAAY,CAAA;IAC1B,CAAC;IAED,KAAK,CAAC,oBAAoB,CACxB,IAA0C;QAE1C,MAAM,EAAE,IAAI,EAAE,GACZ,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA0C;YACjE,GAAG,EAAE,uCAAuC;YAC5C,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEJ,OAAO,IAAI,CAAC,kBAAkB,CAAA;IAChC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAA4B;QACvC,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA4B;YACnD,GAAG,EAAE,sBAAsB;YAC3B,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 SeamHttpAcsAccessGroups {
|
|
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'>): SeamHttpAcsAccessGroups;
|
|
9
10
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpAcsAccessGroups;
|
|
@@ -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 SeamHttpAcsAccessGroups {
|
|
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 SeamHttpAcsAccessGroups {
|
|
|
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":"acs-access-groups.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs-access-groups.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":"acs-access-groups.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs-access-groups.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,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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,GAAG,CACP,IAA+B;QAE/B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA6B;YACrE,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,CACR,IAAgC;QAEhC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAA8B;YACtE,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,SAAS,CACb,IAAqC;QAErC,MAAM,EAAE,IAAI,EAAE,GACZ,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAmC;YAC1D,GAAG,EAAE,+BAA+B;YACpC,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEJ,OAAO,IAAI,CAAC,SAAS,CAAA;IACvB,CAAC;IAED,KAAK,CAAC,UAAU,CAAC,IAAoC;QACnD,MAAM,IAAI,CAAC,MAAM,CAAC,OAAO,CAAoC;YAC3D,GAAG,EAAE,gCAAgC;YACrC,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 SeamHttpAcsCredentials {
|
|
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'>): SeamHttpAcsCredentials;
|
|
9
10
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpAcsCredentials;
|
|
@@ -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 SeamHttpAcsCredentials {
|
|
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 SeamHttpAcsCredentials {
|
|
|
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":"acs-credentials.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs-credentials.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":"acs-credentials.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs-credentials.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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AC,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,QAAQ,CAAC,IAAiC;QAC9C,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,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 SeamHttpAcsSystems {
|
|
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'>): SeamHttpAcsSystems;
|
|
9
10
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpAcsSystems;
|
|
@@ -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 SeamHttpAcsSystems {
|
|
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 SeamHttpAcsSystems {
|
|
|
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":"acs-systems.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs-systems.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":"acs-systems.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs-systems.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,kBAAkB;IAI7B,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;IACxD,CAAC;IAED,MAAM,CAAC,UAAU,CACf,MAA2C,EAC3C,UAAqD,EAAE;QAEvD,MAAM,kBAAkB,GAAG,EAAE,GAAG,OAAO,EAAE,MAA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;YACjE,GAAG,EAAE,mBAAmB;YACxB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;QAEF,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,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 SeamHttpAcsUsers {
|
|
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'>): SeamHttpAcsUsers;
|
|
9
10
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpAcsUsers;
|
|
@@ -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 SeamHttpAcsUsers {
|
|
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 SeamHttpAcsUsers {
|
|
|
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":"acs-users.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs-users.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,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AAE,mBAAmB;YACxB,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,IAAI;SACX,CAAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -1,11 +1,12 @@
|
|
|
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 { SeamHttpAcsAccessGroups } from './acs-access-groups.js';
|
|
4
4
|
import { SeamHttpAcsCredentials } from './acs-credentials.js';
|
|
5
5
|
import { SeamHttpAcsSystems } from './acs-systems.js';
|
|
6
6
|
import { SeamHttpAcsUsers } from './acs-users.js';
|
|
7
7
|
export declare class SeamHttpAcs {
|
|
8
8
|
client: Client;
|
|
9
|
+
readonly defaults: Required<SeamHttpRequestOptions>;
|
|
9
10
|
constructor(apiKeyOrOptions?: string | SeamHttpOptions);
|
|
10
11
|
static fromClient(client: SeamHttpOptionsWithClient['client'], options?: Omit<SeamHttpOptionsWithClient, 'client'>): SeamHttpAcs;
|
|
11
12
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpAcs;
|
|
@@ -5,7 +5,7 @@
|
|
|
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 { SeamHttpAcsAccessGroups } from './acs-access-groups.js';
|
|
10
10
|
import { SeamHttpAcsCredentials } from './acs-credentials.js';
|
|
11
11
|
import { SeamHttpAcsSystems } from './acs-systems.js';
|
|
@@ -13,8 +13,9 @@ import { SeamHttpAcsUsers } from './acs-users.js';
|
|
|
13
13
|
import { SeamHttpClientSessions } from './client-sessions.js';
|
|
14
14
|
export class SeamHttpAcs {
|
|
15
15
|
constructor(apiKeyOrOptions = {}) {
|
|
16
|
-
const
|
|
17
|
-
this.client = createClient(
|
|
16
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
17
|
+
this.client = 'client' in options ? options.client : createClient(options);
|
|
18
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
18
19
|
}
|
|
19
20
|
static fromClient(client, options = {}) {
|
|
20
21
|
const constructorOptions = { ...options, client };
|
|
@@ -40,6 +41,9 @@ export class SeamHttpAcs {
|
|
|
40
41
|
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
41
42
|
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
42
43
|
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
44
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
45
|
+
throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttp.fromPublishableKey');
|
|
46
|
+
}
|
|
43
47
|
const client = createClient(clientOptions);
|
|
44
48
|
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
45
49
|
const { token } = await clientSessions.getOrCreate({
|
|
@@ -62,16 +66,16 @@ export class SeamHttpAcs {
|
|
|
62
66
|
return new SeamHttpAcs(constructorOptions);
|
|
63
67
|
}
|
|
64
68
|
get accessGroups() {
|
|
65
|
-
return SeamHttpAcsAccessGroups.fromClient(this.client);
|
|
69
|
+
return SeamHttpAcsAccessGroups.fromClient(this.client, this.defaults);
|
|
66
70
|
}
|
|
67
71
|
get credentials() {
|
|
68
|
-
return SeamHttpAcsCredentials.fromClient(this.client);
|
|
72
|
+
return SeamHttpAcsCredentials.fromClient(this.client, this.defaults);
|
|
69
73
|
}
|
|
70
74
|
get systems() {
|
|
71
|
-
return SeamHttpAcsSystems.fromClient(this.client);
|
|
75
|
+
return SeamHttpAcsSystems.fromClient(this.client, this.defaults);
|
|
72
76
|
}
|
|
73
77
|
get users() {
|
|
74
|
-
return SeamHttpAcsUsers.fromClient(this.client);
|
|
78
|
+
return SeamHttpAcsUsers.fromClient(this.client, this.defaults);
|
|
75
79
|
}
|
|
76
80
|
}
|
|
77
81
|
//# sourceMappingURL=acs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"acs.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,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":"acs.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/acs.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,+BAA+B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,EAAe,YAAY,EAAE,MAAM,4BAA4B,CAAA;AACtE,OAAO,EACL,2BAA2B,EAC3B,2BAA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C,kBAAkB,CAAC,EAAE;YACjE,MAAM,IAAI,2BAA2B,CACnC,4CAA4C,CAC7C,CAAA;SACF;QACD,OAAO,IAAI,WAAW,CAAC,kBAAkB,CAAC,CAAA;IAC5C,CAAC;IAED,MAAM,CAAC,uBAAuB,CAC5B,mBAAkF,EAClF,WAAkE,EAClE,UAGI,EAAE;QAEN,MAAM,kBAAkB,GAAG,EAAE,GAAG,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,WAAW,CAAC,kBAAkB,CAAC,CAAA;IAC5C,CAAC;IAED,IAAI,YAAY;QACd,OAAO,uBAAuB,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACvE,CAAC;IAED,IAAI,WAAW;QACb,OAAO,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IACtE,CAAC;IAED,IAAI,OAAO;QACT,OAAO,kBAAkB,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IAClE,CAAC;IAED,IAAI,KAAK;QACP,OAAO,gBAAgB,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAA;IAChE,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 SeamHttpActionAttempts {
|
|
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'>): SeamHttpActionAttempts;
|
|
10
10
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpActionAttempts;
|
|
@@ -12,16 +12,12 @@ export declare class SeamHttpActionAttempts {
|
|
|
12
12
|
static fromPublishableKey(publishableKey: string, userIdentifierKey: string, options?: SeamHttpFromPublishableKeyOptions): Promise<SeamHttpActionAttempts>;
|
|
13
13
|
static fromConsoleSessionToken(consoleSessionToken: SeamHttpOptionsWithConsoleSessionToken['consoleSessionToken'], workspaceId: SeamHttpOptionsWithConsoleSessionToken['workspaceId'], options?: Omit<SeamHttpOptionsWithConsoleSessionToken, 'consoleSessionToken' | 'workspaceId'>): SeamHttpActionAttempts;
|
|
14
14
|
static fromPersonalAccessToken(personalAccessToken: SeamHttpOptionsWithPersonalAccessToken['personalAccessToken'], workspaceId: SeamHttpOptionsWithPersonalAccessToken['workspaceId'], options?: Omit<SeamHttpOptionsWithPersonalAccessToken, 'personalAccessToken' | 'workspaceId'>): SeamHttpActionAttempts;
|
|
15
|
-
get(body?: ActionAttemptsGetParams,
|
|
16
|
-
waitForActionAttempt?: boolean | Partial<ResolveActionAttemptOptions>;
|
|
17
|
-
}): Promise<ActionAttemptsGetResponse['action_attempt']>;
|
|
15
|
+
get(body?: ActionAttemptsGetParams, options?: Pick<SeamHttpRequestOptions, 'waitForActionAttempt'>): Promise<ActionAttemptsGetResponse['action_attempt']>;
|
|
18
16
|
list(body?: ActionAttemptsListParams): Promise<ActionAttemptsListResponse['action_attempts']>;
|
|
19
17
|
}
|
|
20
18
|
export type ActionAttemptsGetParams = RouteRequestBody<'/action_attempts/get'>;
|
|
21
19
|
export type ActionAttemptsGetResponse = SetNonNullable<Required<RouteResponse<'/action_attempts/get'>>>;
|
|
22
|
-
export
|
|
23
|
-
waitForActionAttempt?: boolean | Partial<ResolveActionAttemptOptions>;
|
|
24
|
-
}
|
|
20
|
+
export type ActionAttemptsGetOptions = Pick<SeamHttpRequestOptions, 'waitForActionAttempt'>;
|
|
25
21
|
export type ActionAttemptsListParams = RouteRequestBody<'/action_attempts/list'>;
|
|
26
22
|
export type ActionAttemptsListResponse = SetNonNullable<Required<RouteResponse<'/action_attempts/list'>>>;
|
|
27
23
|
export type ActionAttemptsListOptions = never;
|
|
@@ -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';
|
|
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 { SeamHttpClientSessions } from './client-sessions.js';
|
|
11
11
|
export class SeamHttpActionAttempts {
|
|
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 SeamHttpActionAttempts {
|
|
|
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({
|
|
@@ -58,14 +62,18 @@ export class SeamHttpActionAttempts {
|
|
|
58
62
|
}
|
|
59
63
|
return new SeamHttpActionAttempts(constructorOptions);
|
|
60
64
|
}
|
|
61
|
-
async get(body,
|
|
65
|
+
async get(body, options = {}) {
|
|
62
66
|
const { data } = await this.client.request({
|
|
63
67
|
url: '/action_attempts/get',
|
|
64
68
|
method: 'post',
|
|
65
69
|
data: body,
|
|
66
70
|
});
|
|
67
|
-
|
|
68
|
-
|
|
71
|
+
const waitForActionAttempt = options.waitForActionAttempt ?? this.defaults.waitForActionAttempt;
|
|
72
|
+
if (waitForActionAttempt !== false) {
|
|
73
|
+
return await resolveActionAttempt(data.action_attempt, SeamHttpActionAttempts.fromClient(this.client, {
|
|
74
|
+
...this.defaults,
|
|
75
|
+
waitForActionAttempt: false,
|
|
76
|
+
}), typeof waitForActionAttempt === 'boolean' ? {} : waitForActionAttempt);
|
|
69
77
|
}
|
|
70
78
|
return data.action_attempt;
|
|
71
79
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"action-attempts.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/action-attempts.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":"action-attempts.js","sourceRoot":"","sources":["../../../../src/lib/seam/connect/routes/action-attempts.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,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAE7D,MAAM,OAAO,sBAAsB;IAIjC,YAAY,kBAA4C,EAAE;QACxD,MAAM,OAAO,GAAG,YAAY,CAAC,eAAe,CAAC,CAAA;QAC7C,IAAI,CAAC,MAAM,GAAG,QAAQ,IAAI,OAAO,CAAC,CA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AAC,MAAM,CAAC,OAAO,CAA4B;YACpE,GAAG,EAAE,sBAAsB;YAC3B,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;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;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 SeamHttpClientSessions {
|
|
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'>): SeamHttpClientSessions;
|
|
9
10
|
static fromApiKey(apiKey: SeamHttpOptionsWithApiKey['apiKey'], options?: Omit<SeamHttpOptionsWithApiKey, 'apiKey'>): SeamHttpClientSessions;
|
|
@@ -5,11 +5,12 @@
|
|
|
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
|
export class SeamHttpClientSessions {
|
|
10
10
|
constructor(apiKeyOrOptions = {}) {
|
|
11
|
-
const
|
|
12
|
-
this.client = createClient(
|
|
11
|
+
const options = parseOptions(apiKeyOrOptions);
|
|
12
|
+
this.client = 'client' in options ? options.client : createClient(options);
|
|
13
|
+
this.defaults = limitToSeamHttpRequestOptions(options);
|
|
13
14
|
}
|
|
14
15
|
static fromClient(client, options = {}) {
|
|
15
16
|
const constructorOptions = { ...options, client };
|
|
@@ -35,6 +36,9 @@ export class SeamHttpClientSessions {
|
|
|
35
36
|
static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
|
|
36
37
|
warnOnInsecureuserIdentifierKey(userIdentifierKey);
|
|
37
38
|
const clientOptions = parseOptions({ ...options, publishableKey });
|
|
39
|
+
if (isSeamHttpOptionsWithClient(clientOptions)) {
|
|
40
|
+
throw new SeamHttpInvalidOptionsError('The client option cannot be used with SeamHttp.fromPublishableKey');
|
|
41
|
+
}
|
|
38
42
|
const client = createClient(clientOptions);
|
|
39
43
|
const clientSessions = SeamHttpClientSessions.fromClient(client);
|
|
40
44
|
const { token } = await clientSessions.getOrCreate({
|