@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.
Files changed (116) hide show
  1. package/README.md +14 -1
  2. package/dist/connect.cjs +314 -141
  3. package/dist/connect.cjs.map +1 -1
  4. package/dist/connect.d.cts +89 -75
  5. package/lib/seam/connect/client.d.ts +0 -1
  6. package/lib/seam/connect/client.js +0 -2
  7. package/lib/seam/connect/client.js.map +1 -1
  8. package/lib/seam/connect/options.d.ts +7 -3
  9. package/lib/seam/connect/options.js +2 -1
  10. package/lib/seam/connect/options.js.map +1 -1
  11. package/lib/seam/connect/parse-options.d.ts +9 -3
  12. package/lib/seam/connect/parse-options.js +25 -2
  13. package/lib/seam/connect/parse-options.js.map +1 -1
  14. package/lib/seam/connect/routes/access-codes-unmanaged.d.ts +2 -1
  15. package/lib/seam/connect/routes/access-codes-unmanaged.js +7 -3
  16. package/lib/seam/connect/routes/access-codes-unmanaged.js.map +1 -1
  17. package/lib/seam/connect/routes/access-codes.d.ts +2 -1
  18. package/lib/seam/connect/routes/access-codes.js +8 -4
  19. package/lib/seam/connect/routes/access-codes.js.map +1 -1
  20. package/lib/seam/connect/routes/acs-access-groups.d.ts +2 -1
  21. package/lib/seam/connect/routes/acs-access-groups.js +7 -3
  22. package/lib/seam/connect/routes/acs-access-groups.js.map +1 -1
  23. package/lib/seam/connect/routes/acs-credentials.d.ts +2 -1
  24. package/lib/seam/connect/routes/acs-credentials.js +7 -3
  25. package/lib/seam/connect/routes/acs-credentials.js.map +1 -1
  26. package/lib/seam/connect/routes/acs-systems.d.ts +2 -1
  27. package/lib/seam/connect/routes/acs-systems.js +7 -3
  28. package/lib/seam/connect/routes/acs-systems.js.map +1 -1
  29. package/lib/seam/connect/routes/acs-users.d.ts +2 -1
  30. package/lib/seam/connect/routes/acs-users.js +7 -3
  31. package/lib/seam/connect/routes/acs-users.js.map +1 -1
  32. package/lib/seam/connect/routes/acs.d.ts +2 -1
  33. package/lib/seam/connect/routes/acs.js +11 -7
  34. package/lib/seam/connect/routes/acs.js.map +1 -1
  35. package/lib/seam/connect/routes/action-attempts.d.ts +4 -8
  36. package/lib/seam/connect/routes/action-attempts.js +15 -7
  37. package/lib/seam/connect/routes/action-attempts.js.map +1 -1
  38. package/lib/seam/connect/routes/client-sessions.d.ts +2 -1
  39. package/lib/seam/connect/routes/client-sessions.js +7 -3
  40. package/lib/seam/connect/routes/client-sessions.js.map +1 -1
  41. package/lib/seam/connect/routes/connect-webviews.d.ts +2 -1
  42. package/lib/seam/connect/routes/connect-webviews.js +7 -3
  43. package/lib/seam/connect/routes/connect-webviews.js.map +1 -1
  44. package/lib/seam/connect/routes/connected-accounts.d.ts +2 -1
  45. package/lib/seam/connect/routes/connected-accounts.js +7 -3
  46. package/lib/seam/connect/routes/connected-accounts.js.map +1 -1
  47. package/lib/seam/connect/routes/devices-unmanaged.d.ts +2 -1
  48. package/lib/seam/connect/routes/devices-unmanaged.js +7 -3
  49. package/lib/seam/connect/routes/devices-unmanaged.js.map +1 -1
  50. package/lib/seam/connect/routes/devices.d.ts +2 -1
  51. package/lib/seam/connect/routes/devices.js +8 -4
  52. package/lib/seam/connect/routes/devices.js.map +1 -1
  53. package/lib/seam/connect/routes/events.d.ts +2 -1
  54. package/lib/seam/connect/routes/events.js +7 -3
  55. package/lib/seam/connect/routes/events.js.map +1 -1
  56. package/lib/seam/connect/routes/locks.d.ts +6 -14
  57. package/lib/seam/connect/routes/locks.js +22 -10
  58. package/lib/seam/connect/routes/locks.js.map +1 -1
  59. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.d.ts +2 -1
  60. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js +7 -3
  61. package/lib/seam/connect/routes/noise-sensors-noise-thresholds.js.map +1 -1
  62. package/lib/seam/connect/routes/noise-sensors.d.ts +2 -1
  63. package/lib/seam/connect/routes/noise-sensors.js +8 -4
  64. package/lib/seam/connect/routes/noise-sensors.js.map +1 -1
  65. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.d.ts +2 -1
  66. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js +7 -3
  67. package/lib/seam/connect/routes/thermostats-climate-setting-schedules.js.map +1 -1
  68. package/lib/seam/connect/routes/thermostats.d.ts +2 -1
  69. package/lib/seam/connect/routes/thermostats.js +8 -4
  70. package/lib/seam/connect/routes/thermostats.js.map +1 -1
  71. package/lib/seam/connect/routes/user-identities.d.ts +2 -1
  72. package/lib/seam/connect/routes/user-identities.js +7 -3
  73. package/lib/seam/connect/routes/user-identities.js.map +1 -1
  74. package/lib/seam/connect/routes/webhooks.d.ts +2 -1
  75. package/lib/seam/connect/routes/webhooks.js +7 -3
  76. package/lib/seam/connect/routes/webhooks.js.map +1 -1
  77. package/lib/seam/connect/routes/workspaces.d.ts +2 -1
  78. package/lib/seam/connect/routes/workspaces.js +7 -3
  79. package/lib/seam/connect/routes/workspaces.js.map +1 -1
  80. package/lib/seam/connect/seam-http-multi-workspace.d.ts +2 -1
  81. package/lib/seam/connect/seam-http-multi-workspace.js +5 -4
  82. package/lib/seam/connect/seam-http-multi-workspace.js.map +1 -1
  83. package/lib/seam/connect/seam-http.d.ts +2 -1
  84. package/lib/seam/connect/seam-http.js +21 -17
  85. package/lib/seam/connect/seam-http.js.map +1 -1
  86. package/lib/version.d.ts +1 -1
  87. package/lib/version.js +1 -1
  88. package/package.json +3 -3
  89. package/src/lib/seam/connect/client.ts +0 -3
  90. package/src/lib/seam/connect/options.ts +11 -4
  91. package/src/lib/seam/connect/parse-options.ts +43 -4
  92. package/src/lib/seam/connect/routes/access-codes-unmanaged.ts +14 -3
  93. package/src/lib/seam/connect/routes/access-codes.ts +15 -4
  94. package/src/lib/seam/connect/routes/acs-access-groups.ts +14 -3
  95. package/src/lib/seam/connect/routes/acs-credentials.ts +14 -3
  96. package/src/lib/seam/connect/routes/acs-systems.ts +14 -3
  97. package/src/lib/seam/connect/routes/acs-users.ts +14 -3
  98. package/src/lib/seam/connect/routes/acs.ts +18 -7
  99. package/src/lib/seam/connect/routes/action-attempts.ts +26 -16
  100. package/src/lib/seam/connect/routes/client-sessions.ts +14 -3
  101. package/src/lib/seam/connect/routes/connect-webviews.ts +14 -3
  102. package/src/lib/seam/connect/routes/connected-accounts.ts +14 -3
  103. package/src/lib/seam/connect/routes/devices-unmanaged.ts +14 -3
  104. package/src/lib/seam/connect/routes/devices.ts +15 -4
  105. package/src/lib/seam/connect/routes/events.ts +14 -3
  106. package/src/lib/seam/connect/routes/locks.ts +38 -26
  107. package/src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts +14 -3
  108. package/src/lib/seam/connect/routes/noise-sensors.ts +18 -4
  109. package/src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts +14 -3
  110. package/src/lib/seam/connect/routes/thermostats.ts +18 -4
  111. package/src/lib/seam/connect/routes/user-identities.ts +14 -3
  112. package/src/lib/seam/connect/routes/webhooks.ts +14 -3
  113. package/src/lib/seam/connect/routes/workspaces.ts +14 -3
  114. package/src/lib/seam/connect/seam-http-multi-workspace.ts +7 -4
  115. package/src/lib/seam/connect/seam-http.ts +25 -17
  116. package/src/lib/version.ts +1 -1
package/dist/connect.cjs CHANGED
@@ -10,6 +10,82 @@ var axios__default = /*#__PURE__*/_interopDefault(axios);
10
10
  var axiosBetterStacktrace__default = /*#__PURE__*/_interopDefault(axiosBetterStacktrace);
11
11
  var axiosRetry__default = /*#__PURE__*/_interopDefault(axiosRetry);
12
12
 
13
+ // src/lib/version.ts
14
+ var seamapiJavascriptHttpVersion = null;
15
+ var version_default = seamapiJavascriptHttpVersion;
16
+
17
+ // src/lib/seam/connect/parse-options.ts
18
+ var defaultEndpoint = "https://connect.getseam.com";
19
+ var sdkHeaders = {
20
+ "seam-sdk-name": "seamapi/javascript-http",
21
+ "seam-sdk-version": version_default
22
+ };
23
+ var parseOptions = (apiKeyOrOptions) => {
24
+ const options = getNormalizedOptions(apiKeyOrOptions);
25
+ if (isSeamHttpOptionsWithClient(options))
26
+ return options;
27
+ if (isSeamHttpMultiWorkspaceOptionsWithClient(options))
28
+ return options;
29
+ return {
30
+ ...options,
31
+ axiosOptions: {
32
+ baseURL: options.endpoint ?? getEndpointFromEnv() ?? defaultEndpoint,
33
+ withCredentials: isSeamHttpOptionsWithClientSessionToken(options),
34
+ ...options.axiosOptions,
35
+ headers: {
36
+ ...getAuthHeaders(options),
37
+ ...options.axiosOptions?.headers,
38
+ ...sdkHeaders
39
+ }
40
+ },
41
+ axiosRetryOptions: {
42
+ ...options.axiosRetryOptions
43
+ }
44
+ };
45
+ };
46
+ var getNormalizedOptions = (apiKeyOrOptions) => {
47
+ const options = typeof apiKeyOrOptions === "string" ? { apiKey: apiKeyOrOptions } : apiKeyOrOptions;
48
+ const requestOptions = {
49
+ waitForActionAttempt: options.waitForActionAttempt ?? false
50
+ };
51
+ if (isSeamHttpOptionsWithClient(options)) {
52
+ return {
53
+ ...options,
54
+ ...requestOptions
55
+ };
56
+ }
57
+ const apiKey = "apiKey" in options ? options.apiKey : getApiKeyFromEnv(options);
58
+ return {
59
+ ...options,
60
+ ...apiKey != null ? { apiKey } : {},
61
+ ...requestOptions
62
+ };
63
+ };
64
+ var getApiKeyFromEnv = (options) => {
65
+ if ("clientSessionToken" in options && options.clientSessionToken != null) {
66
+ return null;
67
+ }
68
+ return globalThis.process?.env?.SEAM_API_KEY;
69
+ };
70
+ var getEndpointFromEnv = () => {
71
+ return globalThis.process?.env?.SEAM_ENDPOINT ?? globalThis.process?.env?.SEAM_API_URL;
72
+ };
73
+ var limitToSeamHttpRequestOptions = (options) => {
74
+ return Object.keys(options).filter(isSeamHttpRequestOption).reduce(
75
+ (obj, key) => ({
76
+ ...obj,
77
+ [key]: options[key]
78
+ }),
79
+ {}
80
+ );
81
+ };
82
+ var isSeamHttpRequestOption = (key) => {
83
+ const keys = {
84
+ waitForActionAttempt: true
85
+ };
86
+ return Object.keys(keys).includes(key);
87
+ };
88
+
13
89
  // src/lib/seam/connect/options.ts
14
90
  var isSeamHttpMultiWorkspaceOptionsWithClient = (options) => isSeamHttpOptionsWithClient(options);
15
91
  var isSeamHttpOptionsWithClient = (options) => {
@@ -18,7 +94,7 @@ var isSeamHttpOptionsWithClient = (options) => {
18
94
  if (options.client == null)
19
95
  return false;
20
96
  const keys = Object.keys(options).filter((k) => k !== "client");
21
- if (keys.length > 0) {
97
+ if (keys.filter((k) => !isSeamHttpRequestOption(k)).length > 0) {
22
98
  throw new SeamHttpInvalidOptionsError(
23
99
  `The client option cannot be used with any other option, but received: ${keys.join(
24
100
  ", "
@@ -557,8 +633,6 @@ var UnserializableParamError = class extends Error {
557
633
 
558
634
  // src/lib/seam/connect/client.ts
559
635
  var createClient = (options) => {
560
- if (options.client != null)
561
- return options.client;
562
636
  const client = axios__default.default.create({
563
637
  paramsSerializer,
564
638
  ...options.axiosOptions
@@ -573,63 +647,12 @@ var createClient = (options) => {
573
647
  return client;
574
648
  };
575
649
 
576
- // src/lib/version.ts
577
- var seamapiJavascriptHttpVersion = null;
578
- var version_default = seamapiJavascriptHttpVersion;
579
-
580
- // src/lib/seam/connect/parse-options.ts
581
- var defaultEndpoint = "https://connect.getseam.com";
582
- var sdkHeaders = {
583
- "seam-sdk-name": "seamapi/javascript-http",
584
- "seam-sdk-version": version_default
585
- };
586
- var parseOptions = (apiKeyOrOptions) => {
587
- const options = getNormalizedOptions(apiKeyOrOptions);
588
- if (isSeamHttpOptionsWithClient(options))
589
- return options;
590
- if (isSeamHttpMultiWorkspaceOptionsWithClient(options))
591
- return options;
592
- return {
593
- axiosOptions: {
594
- baseURL: options.endpoint ?? getEndpointFromEnv() ?? defaultEndpoint,
595
- withCredentials: isSeamHttpOptionsWithClientSessionToken(options),
596
- ...options.axiosOptions,
597
- headers: {
598
- ...getAuthHeaders(options),
599
- ...options.axiosOptions?.headers,
600
- ...sdkHeaders
601
- }
602
- },
603
- axiosRetryOptions: {
604
- ...options.axiosRetryOptions
605
- }
606
- };
607
- };
608
- var getNormalizedOptions = (apiKeyOrOptions) => {
609
- const options = typeof apiKeyOrOptions === "string" ? { apiKey: apiKeyOrOptions } : apiKeyOrOptions;
610
- if (isSeamHttpOptionsWithClient(options))
611
- return options;
612
- const apiKey = "apiKey" in options ? options.apiKey : getApiKeyFromEnv(options);
613
- return {
614
- ...options,
615
- ...apiKey != null ? { apiKey } : {}
616
- };
617
- };
618
- var getApiKeyFromEnv = (options) => {
619
- if ("clientSessionToken" in options && options.clientSessionToken != null) {
620
- return null;
621
- }
622
- return globalThis.process?.env?.SEAM_API_KEY;
623
- };
624
- var getEndpointFromEnv = () => {
625
- return globalThis.process?.env?.SEAM_ENDPOINT ?? globalThis.process?.env?.SEAM_API_URL;
626
- };
627
-
628
650
  // src/lib/seam/connect/routes/client-sessions.ts
629
651
  var SeamHttpClientSessions = class _SeamHttpClientSessions {
630
652
  constructor(apiKeyOrOptions = {}) {
631
- const clientOptions = parseOptions(apiKeyOrOptions);
632
- this.client = createClient(clientOptions);
653
+ const options = parseOptions(apiKeyOrOptions);
654
+ this.client = "client" in options ? options.client : createClient(options);
655
+ this.defaults = limitToSeamHttpRequestOptions(options);
633
656
  }
634
657
  static fromClient(client, options = {}) {
635
658
  const constructorOptions = { ...options, client };
@@ -655,6 +678,11 @@ var SeamHttpClientSessions = class _SeamHttpClientSessions {
655
678
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
656
679
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
657
680
  const clientOptions = parseOptions({ ...options, publishableKey });
681
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
682
+ throw new SeamHttpInvalidOptionsError(
683
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
684
+ );
685
+ }
658
686
  const client = createClient(clientOptions);
659
687
  const clientSessions = _SeamHttpClientSessions.fromClient(client);
660
688
  const { token } = await clientSessions.getOrCreate({
@@ -739,8 +767,9 @@ var SeamHttpClientSessions = class _SeamHttpClientSessions {
739
767
  // src/lib/seam/connect/routes/access-codes-unmanaged.ts
740
768
  var SeamHttpAccessCodesUnmanaged = class _SeamHttpAccessCodesUnmanaged {
741
769
  constructor(apiKeyOrOptions = {}) {
742
- const clientOptions = parseOptions(apiKeyOrOptions);
743
- this.client = createClient(clientOptions);
770
+ const options = parseOptions(apiKeyOrOptions);
771
+ this.client = "client" in options ? options.client : createClient(options);
772
+ this.defaults = limitToSeamHttpRequestOptions(options);
744
773
  }
745
774
  static fromClient(client, options = {}) {
746
775
  const constructorOptions = { ...options, client };
@@ -766,6 +795,11 @@ var SeamHttpAccessCodesUnmanaged = class _SeamHttpAccessCodesUnmanaged {
766
795
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
767
796
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
768
797
  const clientOptions = parseOptions({ ...options, publishableKey });
798
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
799
+ throw new SeamHttpInvalidOptionsError(
800
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
801
+ );
802
+ }
769
803
  const client = createClient(clientOptions);
770
804
  const clientSessions = SeamHttpClientSessions.fromClient(client);
771
805
  const { token } = await clientSessions.getOrCreate({
@@ -835,8 +869,9 @@ var SeamHttpAccessCodesUnmanaged = class _SeamHttpAccessCodesUnmanaged {
835
869
  // src/lib/seam/connect/routes/access-codes.ts
836
870
  var SeamHttpAccessCodes = class _SeamHttpAccessCodes {
837
871
  constructor(apiKeyOrOptions = {}) {
838
- const clientOptions = parseOptions(apiKeyOrOptions);
839
- this.client = createClient(clientOptions);
872
+ const options = parseOptions(apiKeyOrOptions);
873
+ this.client = "client" in options ? options.client : createClient(options);
874
+ this.defaults = limitToSeamHttpRequestOptions(options);
840
875
  }
841
876
  static fromClient(client, options = {}) {
842
877
  const constructorOptions = { ...options, client };
@@ -862,6 +897,11 @@ var SeamHttpAccessCodes = class _SeamHttpAccessCodes {
862
897
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
863
898
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
864
899
  const clientOptions = parseOptions({ ...options, publishableKey });
900
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
901
+ throw new SeamHttpInvalidOptionsError(
902
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
903
+ );
904
+ }
865
905
  const client = createClient(clientOptions);
866
906
  const clientSessions = SeamHttpClientSessions.fromClient(client);
867
907
  const { token } = await clientSessions.getOrCreate({
@@ -888,7 +928,7 @@ var SeamHttpAccessCodes = class _SeamHttpAccessCodes {
888
928
  return new _SeamHttpAccessCodes(constructorOptions);
889
929
  }
890
930
  get unmanaged() {
891
- return SeamHttpAccessCodesUnmanaged.fromClient(this.client);
931
+ return SeamHttpAccessCodesUnmanaged.fromClient(this.client, this.defaults);
892
932
  }
893
933
  async create(body) {
894
934
  const { data } = await this.client.request({
@@ -959,8 +999,9 @@ var SeamHttpAccessCodes = class _SeamHttpAccessCodes {
959
999
  // src/lib/seam/connect/routes/acs-access-groups.ts
960
1000
  var SeamHttpAcsAccessGroups = class _SeamHttpAcsAccessGroups {
961
1001
  constructor(apiKeyOrOptions = {}) {
962
- const clientOptions = parseOptions(apiKeyOrOptions);
963
- this.client = createClient(clientOptions);
1002
+ const options = parseOptions(apiKeyOrOptions);
1003
+ this.client = "client" in options ? options.client : createClient(options);
1004
+ this.defaults = limitToSeamHttpRequestOptions(options);
964
1005
  }
965
1006
  static fromClient(client, options = {}) {
966
1007
  const constructorOptions = { ...options, client };
@@ -986,6 +1027,11 @@ var SeamHttpAcsAccessGroups = class _SeamHttpAcsAccessGroups {
986
1027
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
987
1028
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
988
1029
  const clientOptions = parseOptions({ ...options, publishableKey });
1030
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1031
+ throw new SeamHttpInvalidOptionsError(
1032
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1033
+ );
1034
+ }
989
1035
  const client = createClient(clientOptions);
990
1036
  const clientSessions = SeamHttpClientSessions.fromClient(client);
991
1037
  const { token } = await clientSessions.getOrCreate({
@@ -1054,8 +1100,9 @@ var SeamHttpAcsAccessGroups = class _SeamHttpAcsAccessGroups {
1054
1100
  // src/lib/seam/connect/routes/acs-credentials.ts
1055
1101
  var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
1056
1102
  constructor(apiKeyOrOptions = {}) {
1057
- const clientOptions = parseOptions(apiKeyOrOptions);
1058
- this.client = createClient(clientOptions);
1103
+ const options = parseOptions(apiKeyOrOptions);
1104
+ this.client = "client" in options ? options.client : createClient(options);
1105
+ this.defaults = limitToSeamHttpRequestOptions(options);
1059
1106
  }
1060
1107
  static fromClient(client, options = {}) {
1061
1108
  const constructorOptions = { ...options, client };
@@ -1081,6 +1128,11 @@ var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
1081
1128
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1082
1129
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
1083
1130
  const clientOptions = parseOptions({ ...options, publishableKey });
1131
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1132
+ throw new SeamHttpInvalidOptionsError(
1133
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1134
+ );
1135
+ }
1084
1136
  const client = createClient(clientOptions);
1085
1137
  const clientSessions = SeamHttpClientSessions.fromClient(client);
1086
1138
  const { token } = await clientSessions.getOrCreate({
@@ -1156,8 +1208,9 @@ var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
1156
1208
  // src/lib/seam/connect/routes/acs-systems.ts
1157
1209
  var SeamHttpAcsSystems = class _SeamHttpAcsSystems {
1158
1210
  constructor(apiKeyOrOptions = {}) {
1159
- const clientOptions = parseOptions(apiKeyOrOptions);
1160
- this.client = createClient(clientOptions);
1211
+ const options = parseOptions(apiKeyOrOptions);
1212
+ this.client = "client" in options ? options.client : createClient(options);
1213
+ this.defaults = limitToSeamHttpRequestOptions(options);
1161
1214
  }
1162
1215
  static fromClient(client, options = {}) {
1163
1216
  const constructorOptions = { ...options, client };
@@ -1183,6 +1236,11 @@ var SeamHttpAcsSystems = class _SeamHttpAcsSystems {
1183
1236
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1184
1237
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
1185
1238
  const clientOptions = parseOptions({ ...options, publishableKey });
1239
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1240
+ throw new SeamHttpInvalidOptionsError(
1241
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1242
+ );
1243
+ }
1186
1244
  const client = createClient(clientOptions);
1187
1245
  const clientSessions = SeamHttpClientSessions.fromClient(client);
1188
1246
  const { token } = await clientSessions.getOrCreate({
@@ -1229,8 +1287,9 @@ var SeamHttpAcsSystems = class _SeamHttpAcsSystems {
1229
1287
  // src/lib/seam/connect/routes/acs-users.ts
1230
1288
  var SeamHttpAcsUsers = class _SeamHttpAcsUsers {
1231
1289
  constructor(apiKeyOrOptions = {}) {
1232
- const clientOptions = parseOptions(apiKeyOrOptions);
1233
- this.client = createClient(clientOptions);
1290
+ const options = parseOptions(apiKeyOrOptions);
1291
+ this.client = "client" in options ? options.client : createClient(options);
1292
+ this.defaults = limitToSeamHttpRequestOptions(options);
1234
1293
  }
1235
1294
  static fromClient(client, options = {}) {
1236
1295
  const constructorOptions = { ...options, client };
@@ -1256,6 +1315,11 @@ var SeamHttpAcsUsers = class _SeamHttpAcsUsers {
1256
1315
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1257
1316
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
1258
1317
  const clientOptions = parseOptions({ ...options, publishableKey });
1318
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1319
+ throw new SeamHttpInvalidOptionsError(
1320
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1321
+ );
1322
+ }
1259
1323
  const client = createClient(clientOptions);
1260
1324
  const clientSessions = SeamHttpClientSessions.fromClient(client);
1261
1325
  const { token } = await clientSessions.getOrCreate({
@@ -1352,8 +1416,9 @@ var SeamHttpAcsUsers = class _SeamHttpAcsUsers {
1352
1416
  // src/lib/seam/connect/routes/acs.ts
1353
1417
  var SeamHttpAcs = class _SeamHttpAcs {
1354
1418
  constructor(apiKeyOrOptions = {}) {
1355
- const clientOptions = parseOptions(apiKeyOrOptions);
1356
- this.client = createClient(clientOptions);
1419
+ const options = parseOptions(apiKeyOrOptions);
1420
+ this.client = "client" in options ? options.client : createClient(options);
1421
+ this.defaults = limitToSeamHttpRequestOptions(options);
1357
1422
  }
1358
1423
  static fromClient(client, options = {}) {
1359
1424
  const constructorOptions = { ...options, client };
@@ -1379,6 +1444,11 @@ var SeamHttpAcs = class _SeamHttpAcs {
1379
1444
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1380
1445
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
1381
1446
  const clientOptions = parseOptions({ ...options, publishableKey });
1447
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1448
+ throw new SeamHttpInvalidOptionsError(
1449
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1450
+ );
1451
+ }
1382
1452
  const client = createClient(clientOptions);
1383
1453
  const clientSessions = SeamHttpClientSessions.fromClient(client);
1384
1454
  const { token } = await clientSessions.getOrCreate({
@@ -1405,24 +1475,25 @@ var SeamHttpAcs = class _SeamHttpAcs {
1405
1475
  return new _SeamHttpAcs(constructorOptions);
1406
1476
  }
1407
1477
  get accessGroups() {
1408
- return SeamHttpAcsAccessGroups.fromClient(this.client);
1478
+ return SeamHttpAcsAccessGroups.fromClient(this.client, this.defaults);
1409
1479
  }
1410
1480
  get credentials() {
1411
- return SeamHttpAcsCredentials.fromClient(this.client);
1481
+ return SeamHttpAcsCredentials.fromClient(this.client, this.defaults);
1412
1482
  }
1413
1483
  get systems() {
1414
- return SeamHttpAcsSystems.fromClient(this.client);
1484
+ return SeamHttpAcsSystems.fromClient(this.client, this.defaults);
1415
1485
  }
1416
1486
  get users() {
1417
- return SeamHttpAcsUsers.fromClient(this.client);
1487
+ return SeamHttpAcsUsers.fromClient(this.client, this.defaults);
1418
1488
  }
1419
1489
  };
1420
1490
 
1421
1491
  // src/lib/seam/connect/routes/action-attempts.ts
1422
1492
  var SeamHttpActionAttempts = class _SeamHttpActionAttempts {
1423
1493
  constructor(apiKeyOrOptions = {}) {
1424
- const clientOptions = parseOptions(apiKeyOrOptions);
1425
- this.client = createClient(clientOptions);
1494
+ const options = parseOptions(apiKeyOrOptions);
1495
+ this.client = "client" in options ? options.client : createClient(options);
1496
+ this.defaults = limitToSeamHttpRequestOptions(options);
1426
1497
  }
1427
1498
  static fromClient(client, options = {}) {
1428
1499
  const constructorOptions = { ...options, client };
@@ -1448,6 +1519,11 @@ var SeamHttpActionAttempts = class _SeamHttpActionAttempts {
1448
1519
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1449
1520
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
1450
1521
  const clientOptions = parseOptions({ ...options, publishableKey });
1522
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1523
+ throw new SeamHttpInvalidOptionsError(
1524
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1525
+ );
1526
+ }
1451
1527
  const client = createClient(clientOptions);
1452
1528
  const clientSessions = SeamHttpClientSessions.fromClient(client);
1453
1529
  const { token } = await clientSessions.getOrCreate({
@@ -1473,18 +1549,20 @@ var SeamHttpActionAttempts = class _SeamHttpActionAttempts {
1473
1549
  }
1474
1550
  return new _SeamHttpActionAttempts(constructorOptions);
1475
1551
  }
1476
- async get(body, {
1477
- waitForActionAttempt = false
1478
- } = {}) {
1552
+ async get(body, options = {}) {
1479
1553
  const { data } = await this.client.request({
1480
1554
  url: "/action_attempts/get",
1481
1555
  method: "post",
1482
1556
  data: body
1483
1557
  });
1484
- if (waitForActionAttempt != null && waitForActionAttempt !== false) {
1558
+ const waitForActionAttempt = options.waitForActionAttempt ?? this.defaults.waitForActionAttempt;
1559
+ if (waitForActionAttempt !== false) {
1485
1560
  return await resolveActionAttempt(
1486
1561
  data.action_attempt,
1487
- _SeamHttpActionAttempts.fromClient(this.client),
1562
+ _SeamHttpActionAttempts.fromClient(this.client, {
1563
+ ...this.defaults,
1564
+ waitForActionAttempt: false
1565
+ }),
1488
1566
  typeof waitForActionAttempt === "boolean" ? {} : waitForActionAttempt
1489
1567
  );
1490
1568
  }
@@ -1503,8 +1581,9 @@ var SeamHttpActionAttempts = class _SeamHttpActionAttempts {
1503
1581
  // src/lib/seam/connect/routes/connect-webviews.ts
1504
1582
  var SeamHttpConnectWebviews = class _SeamHttpConnectWebviews {
1505
1583
  constructor(apiKeyOrOptions = {}) {
1506
- const clientOptions = parseOptions(apiKeyOrOptions);
1507
- this.client = createClient(clientOptions);
1584
+ const options = parseOptions(apiKeyOrOptions);
1585
+ this.client = "client" in options ? options.client : createClient(options);
1586
+ this.defaults = limitToSeamHttpRequestOptions(options);
1508
1587
  }
1509
1588
  static fromClient(client, options = {}) {
1510
1589
  const constructorOptions = { ...options, client };
@@ -1530,6 +1609,11 @@ var SeamHttpConnectWebviews = class _SeamHttpConnectWebviews {
1530
1609
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1531
1610
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
1532
1611
  const clientOptions = parseOptions({ ...options, publishableKey });
1612
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1613
+ throw new SeamHttpInvalidOptionsError(
1614
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1615
+ );
1616
+ }
1533
1617
  const client = createClient(clientOptions);
1534
1618
  const clientSessions = SeamHttpClientSessions.fromClient(client);
1535
1619
  const { token } = await clientSessions.getOrCreate({
@@ -1598,8 +1682,9 @@ var SeamHttpConnectWebviews = class _SeamHttpConnectWebviews {
1598
1682
  // src/lib/seam/connect/routes/connected-accounts.ts
1599
1683
  var SeamHttpConnectedAccounts = class _SeamHttpConnectedAccounts {
1600
1684
  constructor(apiKeyOrOptions = {}) {
1601
- const clientOptions = parseOptions(apiKeyOrOptions);
1602
- this.client = createClient(clientOptions);
1685
+ const options = parseOptions(apiKeyOrOptions);
1686
+ this.client = "client" in options ? options.client : createClient(options);
1687
+ this.defaults = limitToSeamHttpRequestOptions(options);
1603
1688
  }
1604
1689
  static fromClient(client, options = {}) {
1605
1690
  const constructorOptions = { ...options, client };
@@ -1625,6 +1710,11 @@ var SeamHttpConnectedAccounts = class _SeamHttpConnectedAccounts {
1625
1710
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1626
1711
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
1627
1712
  const clientOptions = parseOptions({ ...options, publishableKey });
1713
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1714
+ throw new SeamHttpInvalidOptionsError(
1715
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1716
+ );
1717
+ }
1628
1718
  const client = createClient(clientOptions);
1629
1719
  const clientSessions = SeamHttpClientSessions.fromClient(client);
1630
1720
  const { token } = await clientSessions.getOrCreate({
@@ -1678,8 +1768,9 @@ var SeamHttpConnectedAccounts = class _SeamHttpConnectedAccounts {
1678
1768
  // src/lib/seam/connect/routes/devices-unmanaged.ts
1679
1769
  var SeamHttpDevicesUnmanaged = class _SeamHttpDevicesUnmanaged {
1680
1770
  constructor(apiKeyOrOptions = {}) {
1681
- const clientOptions = parseOptions(apiKeyOrOptions);
1682
- this.client = createClient(clientOptions);
1771
+ const options = parseOptions(apiKeyOrOptions);
1772
+ this.client = "client" in options ? options.client : createClient(options);
1773
+ this.defaults = limitToSeamHttpRequestOptions(options);
1683
1774
  }
1684
1775
  static fromClient(client, options = {}) {
1685
1776
  const constructorOptions = { ...options, client };
@@ -1705,6 +1796,11 @@ var SeamHttpDevicesUnmanaged = class _SeamHttpDevicesUnmanaged {
1705
1796
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1706
1797
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
1707
1798
  const clientOptions = parseOptions({ ...options, publishableKey });
1799
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1800
+ throw new SeamHttpInvalidOptionsError(
1801
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1802
+ );
1803
+ }
1708
1804
  const client = createClient(clientOptions);
1709
1805
  const clientSessions = SeamHttpClientSessions.fromClient(client);
1710
1806
  const { token } = await clientSessions.getOrCreate({
@@ -1758,8 +1854,9 @@ var SeamHttpDevicesUnmanaged = class _SeamHttpDevicesUnmanaged {
1758
1854
  // src/lib/seam/connect/routes/devices.ts
1759
1855
  var SeamHttpDevices = class _SeamHttpDevices {
1760
1856
  constructor(apiKeyOrOptions = {}) {
1761
- const clientOptions = parseOptions(apiKeyOrOptions);
1762
- this.client = createClient(clientOptions);
1857
+ const options = parseOptions(apiKeyOrOptions);
1858
+ this.client = "client" in options ? options.client : createClient(options);
1859
+ this.defaults = limitToSeamHttpRequestOptions(options);
1763
1860
  }
1764
1861
  static fromClient(client, options = {}) {
1765
1862
  const constructorOptions = { ...options, client };
@@ -1785,6 +1882,11 @@ var SeamHttpDevices = class _SeamHttpDevices {
1785
1882
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1786
1883
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
1787
1884
  const clientOptions = parseOptions({ ...options, publishableKey });
1885
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1886
+ throw new SeamHttpInvalidOptionsError(
1887
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1888
+ );
1889
+ }
1788
1890
  const client = createClient(clientOptions);
1789
1891
  const clientSessions = SeamHttpClientSessions.fromClient(client);
1790
1892
  const { token } = await clientSessions.getOrCreate({
@@ -1811,7 +1913,7 @@ var SeamHttpDevices = class _SeamHttpDevices {
1811
1913
  return new _SeamHttpDevices(constructorOptions);
1812
1914
  }
1813
1915
  get unmanaged() {
1814
- return SeamHttpDevicesUnmanaged.fromClient(this.client);
1916
+ return SeamHttpDevicesUnmanaged.fromClient(this.client, this.defaults);
1815
1917
  }
1816
1918
  async delete(body) {
1817
1919
  await this.client.request({
@@ -1856,8 +1958,9 @@ var SeamHttpDevices = class _SeamHttpDevices {
1856
1958
  // src/lib/seam/connect/routes/events.ts
1857
1959
  var SeamHttpEvents = class _SeamHttpEvents {
1858
1960
  constructor(apiKeyOrOptions = {}) {
1859
- const clientOptions = parseOptions(apiKeyOrOptions);
1860
- this.client = createClient(clientOptions);
1961
+ const options = parseOptions(apiKeyOrOptions);
1962
+ this.client = "client" in options ? options.client : createClient(options);
1963
+ this.defaults = limitToSeamHttpRequestOptions(options);
1861
1964
  }
1862
1965
  static fromClient(client, options = {}) {
1863
1966
  const constructorOptions = { ...options, client };
@@ -1883,6 +1986,11 @@ var SeamHttpEvents = class _SeamHttpEvents {
1883
1986
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1884
1987
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
1885
1988
  const clientOptions = parseOptions({ ...options, publishableKey });
1989
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1990
+ throw new SeamHttpInvalidOptionsError(
1991
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1992
+ );
1993
+ }
1886
1994
  const client = createClient(clientOptions);
1887
1995
  const clientSessions = SeamHttpClientSessions.fromClient(client);
1888
1996
  const { token } = await clientSessions.getOrCreate({
@@ -1929,8 +2037,9 @@ var SeamHttpEvents = class _SeamHttpEvents {
1929
2037
  // src/lib/seam/connect/routes/locks.ts
1930
2038
  var SeamHttpLocks = class _SeamHttpLocks {
1931
2039
  constructor(apiKeyOrOptions = {}) {
1932
- const clientOptions = parseOptions(apiKeyOrOptions);
1933
- this.client = createClient(clientOptions);
2040
+ const options = parseOptions(apiKeyOrOptions);
2041
+ this.client = "client" in options ? options.client : createClient(options);
2042
+ this.defaults = limitToSeamHttpRequestOptions(options);
1934
2043
  }
1935
2044
  static fromClient(client, options = {}) {
1936
2045
  const constructorOptions = { ...options, client };
@@ -1956,6 +2065,11 @@ var SeamHttpLocks = class _SeamHttpLocks {
1956
2065
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1957
2066
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
1958
2067
  const clientOptions = parseOptions({ ...options, publishableKey });
2068
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2069
+ throw new SeamHttpInvalidOptionsError(
2070
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2071
+ );
2072
+ }
1959
2073
  const client = createClient(clientOptions);
1960
2074
  const clientSessions = SeamHttpClientSessions.fromClient(client);
1961
2075
  const { token } = await clientSessions.getOrCreate({
@@ -1997,35 +2111,39 @@ var SeamHttpLocks = class _SeamHttpLocks {
1997
2111
  });
1998
2112
  return data.devices;
1999
2113
  }
2000
- async lockDoor(body, {
2001
- waitForActionAttempt = false
2002
- } = {}) {
2114
+ async lockDoor(body, options = {}) {
2003
2115
  const { data } = await this.client.request({
2004
2116
  url: "/locks/lock_door",
2005
2117
  method: "post",
2006
2118
  data: body
2007
2119
  });
2008
- if (waitForActionAttempt != null && waitForActionAttempt !== false) {
2120
+ const waitForActionAttempt = options.waitForActionAttempt ?? this.defaults.waitForActionAttempt;
2121
+ if (waitForActionAttempt !== false) {
2009
2122
  return await resolveActionAttempt(
2010
2123
  data.action_attempt,
2011
- SeamHttpActionAttempts.fromClient(this.client),
2124
+ SeamHttpActionAttempts.fromClient(this.client, {
2125
+ ...this.defaults,
2126
+ waitForActionAttempt: false
2127
+ }),
2012
2128
  typeof waitForActionAttempt === "boolean" ? {} : waitForActionAttempt
2013
2129
  );
2014
2130
  }
2015
2131
  return data.action_attempt;
2016
2132
  }
2017
- async unlockDoor(body, {
2018
- waitForActionAttempt = false
2019
- } = {}) {
2133
+ async unlockDoor(body, options = {}) {
2020
2134
  const { data } = await this.client.request({
2021
2135
  url: "/locks/unlock_door",
2022
2136
  method: "post",
2023
2137
  data: body
2024
2138
  });
2025
- if (waitForActionAttempt != null && waitForActionAttempt !== false) {
2139
+ const waitForActionAttempt = options.waitForActionAttempt ?? this.defaults.waitForActionAttempt;
2140
+ if (waitForActionAttempt !== false) {
2026
2141
  return await resolveActionAttempt(
2027
2142
  data.action_attempt,
2028
- SeamHttpActionAttempts.fromClient(this.client),
2143
+ SeamHttpActionAttempts.fromClient(this.client, {
2144
+ ...this.defaults,
2145
+ waitForActionAttempt: false
2146
+ }),
2029
2147
  typeof waitForActionAttempt === "boolean" ? {} : waitForActionAttempt
2030
2148
  );
2031
2149
  }
@@ -2036,8 +2154,9 @@ var SeamHttpLocks = class _SeamHttpLocks {
2036
2154
  // src/lib/seam/connect/routes/noise-sensors-noise-thresholds.ts
2037
2155
  var SeamHttpNoiseSensorsNoiseThresholds = class _SeamHttpNoiseSensorsNoiseThresholds {
2038
2156
  constructor(apiKeyOrOptions = {}) {
2039
- const clientOptions = parseOptions(apiKeyOrOptions);
2040
- this.client = createClient(clientOptions);
2157
+ const options = parseOptions(apiKeyOrOptions);
2158
+ this.client = "client" in options ? options.client : createClient(options);
2159
+ this.defaults = limitToSeamHttpRequestOptions(options);
2041
2160
  }
2042
2161
  static fromClient(client, options = {}) {
2043
2162
  const constructorOptions = { ...options, client };
@@ -2063,6 +2182,11 @@ var SeamHttpNoiseSensorsNoiseThresholds = class _SeamHttpNoiseSensorsNoiseThresh
2063
2182
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2064
2183
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
2065
2184
  const clientOptions = parseOptions({ ...options, publishableKey });
2185
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2186
+ throw new SeamHttpInvalidOptionsError(
2187
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2188
+ );
2189
+ }
2066
2190
  const client = createClient(clientOptions);
2067
2191
  const clientSessions = SeamHttpClientSessions.fromClient(client);
2068
2192
  const { token } = await clientSessions.getOrCreate({
@@ -2133,8 +2257,9 @@ var SeamHttpNoiseSensorsNoiseThresholds = class _SeamHttpNoiseSensorsNoiseThresh
2133
2257
  // src/lib/seam/connect/routes/noise-sensors.ts
2134
2258
  var SeamHttpNoiseSensors = class _SeamHttpNoiseSensors {
2135
2259
  constructor(apiKeyOrOptions = {}) {
2136
- const clientOptions = parseOptions(apiKeyOrOptions);
2137
- this.client = createClient(clientOptions);
2260
+ const options = parseOptions(apiKeyOrOptions);
2261
+ this.client = "client" in options ? options.client : createClient(options);
2262
+ this.defaults = limitToSeamHttpRequestOptions(options);
2138
2263
  }
2139
2264
  static fromClient(client, options = {}) {
2140
2265
  const constructorOptions = { ...options, client };
@@ -2160,6 +2285,11 @@ var SeamHttpNoiseSensors = class _SeamHttpNoiseSensors {
2160
2285
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2161
2286
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
2162
2287
  const clientOptions = parseOptions({ ...options, publishableKey });
2288
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2289
+ throw new SeamHttpInvalidOptionsError(
2290
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2291
+ );
2292
+ }
2163
2293
  const client = createClient(clientOptions);
2164
2294
  const clientSessions = SeamHttpClientSessions.fromClient(client);
2165
2295
  const { token } = await clientSessions.getOrCreate({
@@ -2186,15 +2316,19 @@ var SeamHttpNoiseSensors = class _SeamHttpNoiseSensors {
2186
2316
  return new _SeamHttpNoiseSensors(constructorOptions);
2187
2317
  }
2188
2318
  get noiseThresholds() {
2189
- return SeamHttpNoiseSensorsNoiseThresholds.fromClient(this.client);
2319
+ return SeamHttpNoiseSensorsNoiseThresholds.fromClient(
2320
+ this.client,
2321
+ this.defaults
2322
+ );
2190
2323
  }
2191
2324
  };
2192
2325
 
2193
2326
  // src/lib/seam/connect/routes/thermostats-climate-setting-schedules.ts
2194
2327
  var SeamHttpThermostatsClimateSettingSchedules = class _SeamHttpThermostatsClimateSettingSchedules {
2195
2328
  constructor(apiKeyOrOptions = {}) {
2196
- const clientOptions = parseOptions(apiKeyOrOptions);
2197
- this.client = createClient(clientOptions);
2329
+ const options = parseOptions(apiKeyOrOptions);
2330
+ this.client = "client" in options ? options.client : createClient(options);
2331
+ this.defaults = limitToSeamHttpRequestOptions(options);
2198
2332
  }
2199
2333
  static fromClient(client, options = {}) {
2200
2334
  const constructorOptions = { ...options, client };
@@ -2220,6 +2354,11 @@ var SeamHttpThermostatsClimateSettingSchedules = class _SeamHttpThermostatsClima
2220
2354
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2221
2355
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
2222
2356
  const clientOptions = parseOptions({ ...options, publishableKey });
2357
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2358
+ throw new SeamHttpInvalidOptionsError(
2359
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2360
+ );
2361
+ }
2223
2362
  const client = createClient(clientOptions);
2224
2363
  const clientSessions = SeamHttpClientSessions.fromClient(client);
2225
2364
  const { token } = await clientSessions.getOrCreate({
@@ -2299,8 +2438,9 @@ var SeamHttpThermostatsClimateSettingSchedules = class _SeamHttpThermostatsClima
2299
2438
  // src/lib/seam/connect/routes/thermostats.ts
2300
2439
  var SeamHttpThermostats = class _SeamHttpThermostats {
2301
2440
  constructor(apiKeyOrOptions = {}) {
2302
- const clientOptions = parseOptions(apiKeyOrOptions);
2303
- this.client = createClient(clientOptions);
2441
+ const options = parseOptions(apiKeyOrOptions);
2442
+ this.client = "client" in options ? options.client : createClient(options);
2443
+ this.defaults = limitToSeamHttpRequestOptions(options);
2304
2444
  }
2305
2445
  static fromClient(client, options = {}) {
2306
2446
  const constructorOptions = { ...options, client };
@@ -2326,6 +2466,11 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
2326
2466
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2327
2467
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
2328
2468
  const clientOptions = parseOptions({ ...options, publishableKey });
2469
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2470
+ throw new SeamHttpInvalidOptionsError(
2471
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2472
+ );
2473
+ }
2329
2474
  const client = createClient(clientOptions);
2330
2475
  const clientSessions = SeamHttpClientSessions.fromClient(client);
2331
2476
  const { token } = await clientSessions.getOrCreate({
@@ -2352,7 +2497,10 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
2352
2497
  return new _SeamHttpThermostats(constructorOptions);
2353
2498
  }
2354
2499
  get climateSettingSchedules() {
2355
- return SeamHttpThermostatsClimateSettingSchedules.fromClient(this.client);
2500
+ return SeamHttpThermostatsClimateSettingSchedules.fromClient(
2501
+ this.client,
2502
+ this.defaults
2503
+ );
2356
2504
  }
2357
2505
  async cool(body) {
2358
2506
  await this.client.request({
@@ -2417,8 +2565,9 @@ var SeamHttpThermostats = class _SeamHttpThermostats {
2417
2565
  // src/lib/seam/connect/routes/user-identities.ts
2418
2566
  var SeamHttpUserIdentities = class _SeamHttpUserIdentities {
2419
2567
  constructor(apiKeyOrOptions = {}) {
2420
- const clientOptions = parseOptions(apiKeyOrOptions);
2421
- this.client = createClient(clientOptions);
2568
+ const options = parseOptions(apiKeyOrOptions);
2569
+ this.client = "client" in options ? options.client : createClient(options);
2570
+ this.defaults = limitToSeamHttpRequestOptions(options);
2422
2571
  }
2423
2572
  static fromClient(client, options = {}) {
2424
2573
  const constructorOptions = { ...options, client };
@@ -2444,6 +2593,11 @@ var SeamHttpUserIdentities = class _SeamHttpUserIdentities {
2444
2593
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2445
2594
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
2446
2595
  const clientOptions = parseOptions({ ...options, publishableKey });
2596
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2597
+ throw new SeamHttpInvalidOptionsError(
2598
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2599
+ );
2600
+ }
2447
2601
  const client = createClient(clientOptions);
2448
2602
  const clientSessions = SeamHttpClientSessions.fromClient(client);
2449
2603
  const { token } = await clientSessions.getOrCreate({
@@ -2534,8 +2688,9 @@ var SeamHttpUserIdentities = class _SeamHttpUserIdentities {
2534
2688
  // src/lib/seam/connect/routes/webhooks.ts
2535
2689
  var SeamHttpWebhooks = class _SeamHttpWebhooks {
2536
2690
  constructor(apiKeyOrOptions = {}) {
2537
- const clientOptions = parseOptions(apiKeyOrOptions);
2538
- this.client = createClient(clientOptions);
2691
+ const options = parseOptions(apiKeyOrOptions);
2692
+ this.client = "client" in options ? options.client : createClient(options);
2693
+ this.defaults = limitToSeamHttpRequestOptions(options);
2539
2694
  }
2540
2695
  static fromClient(client, options = {}) {
2541
2696
  const constructorOptions = { ...options, client };
@@ -2561,6 +2716,11 @@ var SeamHttpWebhooks = class _SeamHttpWebhooks {
2561
2716
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2562
2717
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
2563
2718
  const clientOptions = parseOptions({ ...options, publishableKey });
2719
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2720
+ throw new SeamHttpInvalidOptionsError(
2721
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2722
+ );
2723
+ }
2564
2724
  const client = createClient(clientOptions);
2565
2725
  const clientSessions = SeamHttpClientSessions.fromClient(client);
2566
2726
  const { token } = await clientSessions.getOrCreate({
@@ -2622,8 +2782,9 @@ var SeamHttpWebhooks = class _SeamHttpWebhooks {
2622
2782
  // src/lib/seam/connect/routes/workspaces.ts
2623
2783
  var SeamHttpWorkspaces = class _SeamHttpWorkspaces {
2624
2784
  constructor(apiKeyOrOptions = {}) {
2625
- const clientOptions = parseOptions(apiKeyOrOptions);
2626
- this.client = createClient(clientOptions);
2785
+ const options = parseOptions(apiKeyOrOptions);
2786
+ this.client = "client" in options ? options.client : createClient(options);
2787
+ this.defaults = limitToSeamHttpRequestOptions(options);
2627
2788
  }
2628
2789
  static fromClient(client, options = {}) {
2629
2790
  const constructorOptions = { ...options, client };
@@ -2649,6 +2810,11 @@ var SeamHttpWorkspaces = class _SeamHttpWorkspaces {
2649
2810
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2650
2811
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
2651
2812
  const clientOptions = parseOptions({ ...options, publishableKey });
2813
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2814
+ throw new SeamHttpInvalidOptionsError(
2815
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2816
+ );
2817
+ }
2652
2818
  const client = createClient(clientOptions);
2653
2819
  const clientSessions = SeamHttpClientSessions.fromClient(client);
2654
2820
  const { token } = await clientSessions.getOrCreate({
@@ -2702,8 +2868,9 @@ var SeamHttpWorkspaces = class _SeamHttpWorkspaces {
2702
2868
  // src/lib/seam/connect/seam-http.ts
2703
2869
  var SeamHttp = class _SeamHttp {
2704
2870
  constructor(apiKeyOrOptions = {}) {
2705
- const clientOptions = parseOptions(apiKeyOrOptions);
2706
- this.client = createClient(clientOptions);
2871
+ const options = parseOptions(apiKeyOrOptions);
2872
+ this.client = "client" in options ? options.client : createClient(options);
2873
+ this.defaults = limitToSeamHttpRequestOptions(options);
2707
2874
  }
2708
2875
  static fromClient(client, options = {}) {
2709
2876
  const constructorOptions = { ...options, client };
@@ -2729,6 +2896,11 @@ var SeamHttp = class _SeamHttp {
2729
2896
  static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2730
2897
  warnOnInsecureuserIdentifierKey(userIdentifierKey);
2731
2898
  const clientOptions = parseOptions({ ...options, publishableKey });
2899
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2900
+ throw new SeamHttpInvalidOptionsError(
2901
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2902
+ );
2903
+ }
2732
2904
  const client = createClient(clientOptions);
2733
2905
  const clientSessions = SeamHttpClientSessions.fromClient(client);
2734
2906
  const { token } = await clientSessions.getOrCreate({
@@ -2755,54 +2927,55 @@ var SeamHttp = class _SeamHttp {
2755
2927
  return new _SeamHttp(constructorOptions);
2756
2928
  }
2757
2929
  get accessCodes() {
2758
- return SeamHttpAccessCodes.fromClient(this.client);
2930
+ return SeamHttpAccessCodes.fromClient(this.client, this.defaults);
2759
2931
  }
2760
2932
  get acs() {
2761
- return SeamHttpAcs.fromClient(this.client);
2933
+ return SeamHttpAcs.fromClient(this.client, this.defaults);
2762
2934
  }
2763
2935
  get actionAttempts() {
2764
- return SeamHttpActionAttempts.fromClient(this.client);
2936
+ return SeamHttpActionAttempts.fromClient(this.client, this.defaults);
2765
2937
  }
2766
2938
  get clientSessions() {
2767
- return SeamHttpClientSessions.fromClient(this.client);
2939
+ return SeamHttpClientSessions.fromClient(this.client, this.defaults);
2768
2940
  }
2769
2941
  get connectedAccounts() {
2770
- return SeamHttpConnectedAccounts.fromClient(this.client);
2942
+ return SeamHttpConnectedAccounts.fromClient(this.client, this.defaults);
2771
2943
  }
2772
2944
  get connectWebviews() {
2773
- return SeamHttpConnectWebviews.fromClient(this.client);
2945
+ return SeamHttpConnectWebviews.fromClient(this.client, this.defaults);
2774
2946
  }
2775
2947
  get devices() {
2776
- return SeamHttpDevices.fromClient(this.client);
2948
+ return SeamHttpDevices.fromClient(this.client, this.defaults);
2777
2949
  }
2778
2950
  get events() {
2779
- return SeamHttpEvents.fromClient(this.client);
2951
+ return SeamHttpEvents.fromClient(this.client, this.defaults);
2780
2952
  }
2781
2953
  get locks() {
2782
- return SeamHttpLocks.fromClient(this.client);
2954
+ return SeamHttpLocks.fromClient(this.client, this.defaults);
2783
2955
  }
2784
2956
  get noiseSensors() {
2785
- return SeamHttpNoiseSensors.fromClient(this.client);
2957
+ return SeamHttpNoiseSensors.fromClient(this.client, this.defaults);
2786
2958
  }
2787
2959
  get thermostats() {
2788
- return SeamHttpThermostats.fromClient(this.client);
2960
+ return SeamHttpThermostats.fromClient(this.client, this.defaults);
2789
2961
  }
2790
2962
  get userIdentities() {
2791
- return SeamHttpUserIdentities.fromClient(this.client);
2963
+ return SeamHttpUserIdentities.fromClient(this.client, this.defaults);
2792
2964
  }
2793
2965
  get webhooks() {
2794
- return SeamHttpWebhooks.fromClient(this.client);
2966
+ return SeamHttpWebhooks.fromClient(this.client, this.defaults);
2795
2967
  }
2796
2968
  get workspaces() {
2797
- return SeamHttpWorkspaces.fromClient(this.client);
2969
+ return SeamHttpWorkspaces.fromClient(this.client, this.defaults);
2798
2970
  }
2799
2971
  };
2800
2972
 
2801
2973
  // src/lib/seam/connect/seam-http-multi-workspace.ts
2802
2974
  var SeamHttpMultiWorkspace = class _SeamHttpMultiWorkspace {
2803
2975
  constructor(options) {
2804
- const clientOptions = parseOptions(options);
2805
- this.client = createClient(clientOptions);
2976
+ const opts = parseOptions(options);
2977
+ this.client = "client" in opts ? opts.client : createClient(opts);
2978
+ this.defaults = limitToSeamHttpRequestOptions(opts);
2806
2979
  }
2807
2980
  static fromClient(client, options = {}) {
2808
2981
  const constructorOptions = { ...options, client };
@@ -2834,7 +3007,7 @@ var SeamHttpMultiWorkspace = class _SeamHttpMultiWorkspace {
2834
3007
  return new _SeamHttpMultiWorkspace(constructorOptions);
2835
3008
  }
2836
3009
  get workspaces() {
2837
- return SeamHttpWorkspaces.fromClient(this.client);
3010
+ return SeamHttpWorkspaces.fromClient(this.client, this.defaults);
2838
3011
  }
2839
3012
  };
2840
3013