@seamapi/http 1.17.1 → 1.19.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/connect.cjs CHANGED
@@ -1884,6 +1884,225 @@ var SeamHttpAcsCredentials = class _SeamHttpAcsCredentials {
1884
1884
  }
1885
1885
  };
1886
1886
 
1887
+ // src/lib/seam/connect/routes/acs-encoders-simulate.ts
1888
+ var SeamHttpAcsEncodersSimulate = class _SeamHttpAcsEncodersSimulate {
1889
+ constructor(apiKeyOrOptions = {}) {
1890
+ const options = parseOptions(apiKeyOrOptions);
1891
+ this.client = "client" in options ? options.client : createClient(options);
1892
+ this.defaults = limitToSeamHttpRequestOptions(options);
1893
+ }
1894
+ static fromClient(client, options = {}) {
1895
+ const constructorOptions = { ...options, client };
1896
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
1897
+ throw new SeamHttpInvalidOptionsError("Missing client");
1898
+ }
1899
+ return new _SeamHttpAcsEncodersSimulate(constructorOptions);
1900
+ }
1901
+ static fromApiKey(apiKey, options = {}) {
1902
+ const constructorOptions = { ...options, apiKey };
1903
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
1904
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1905
+ }
1906
+ return new _SeamHttpAcsEncodersSimulate(constructorOptions);
1907
+ }
1908
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1909
+ const constructorOptions = { ...options, clientSessionToken };
1910
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
1911
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1912
+ }
1913
+ return new _SeamHttpAcsEncodersSimulate(constructorOptions);
1914
+ }
1915
+ static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1916
+ warnOnInsecureuserIdentifierKey(userIdentifierKey);
1917
+ const clientOptions = parseOptions({ ...options, publishableKey });
1918
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1919
+ throw new SeamHttpInvalidOptionsError(
1920
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1921
+ );
1922
+ }
1923
+ const client = createClient(clientOptions);
1924
+ const clientSessions = SeamHttpClientSessions.fromClient(client);
1925
+ const { token } = await clientSessions.getOrCreate({
1926
+ user_identifier_key: userIdentifierKey
1927
+ });
1928
+ return _SeamHttpAcsEncodersSimulate.fromClientSessionToken(token, options);
1929
+ }
1930
+ static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
1931
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId };
1932
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
1933
+ throw new SeamHttpInvalidOptionsError(
1934
+ "Missing consoleSessionToken or workspaceId"
1935
+ );
1936
+ }
1937
+ return new _SeamHttpAcsEncodersSimulate(constructorOptions);
1938
+ }
1939
+ static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
1940
+ const constructorOptions = { ...options, personalAccessToken, workspaceId };
1941
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
1942
+ throw new SeamHttpInvalidOptionsError(
1943
+ "Missing personalAccessToken or workspaceId"
1944
+ );
1945
+ }
1946
+ return new _SeamHttpAcsEncodersSimulate(constructorOptions);
1947
+ }
1948
+ async updateClientSessionToken(clientSessionToken) {
1949
+ const { headers } = this.client.defaults;
1950
+ const authHeaders = getAuthHeadersForClientSessionToken({
1951
+ clientSessionToken
1952
+ });
1953
+ for (const key of Object.keys(authHeaders)) {
1954
+ if (headers[key] == null) {
1955
+ throw new Error(
1956
+ "Cannot update a clientSessionToken on a client created without a clientSessionToken"
1957
+ );
1958
+ }
1959
+ }
1960
+ this.client.defaults.headers = { ...headers, ...authHeaders };
1961
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client);
1962
+ await clientSessions.get();
1963
+ }
1964
+ nextCredentialEncodeWillFail(body) {
1965
+ return new SeamHttpRequest(this, {
1966
+ path: "/acs/encoders/simulate/next_credential_encode_will_fail",
1967
+ method: "post",
1968
+ body,
1969
+ responseKey: void 0
1970
+ });
1971
+ }
1972
+ nextCredentialEncodeWillSucceed(body) {
1973
+ return new SeamHttpRequest(this, {
1974
+ path: "/acs/encoders/simulate/next_credential_encode_will_succeed",
1975
+ method: "post",
1976
+ body,
1977
+ responseKey: void 0
1978
+ });
1979
+ }
1980
+ nextCredentialScanWillFail(body) {
1981
+ return new SeamHttpRequest(this, {
1982
+ path: "/acs/encoders/simulate/next_credential_scan_will_fail",
1983
+ method: "post",
1984
+ body,
1985
+ responseKey: void 0
1986
+ });
1987
+ }
1988
+ nextCredentialScanWillSucceed(body) {
1989
+ return new SeamHttpRequest(this, {
1990
+ path: "/acs/encoders/simulate/next_credential_scan_will_succeed",
1991
+ method: "post",
1992
+ body,
1993
+ responseKey: void 0
1994
+ });
1995
+ }
1996
+ };
1997
+
1998
+ // src/lib/seam/connect/routes/acs-encoders.ts
1999
+ var SeamHttpAcsEncoders = class _SeamHttpAcsEncoders {
2000
+ constructor(apiKeyOrOptions = {}) {
2001
+ const options = parseOptions(apiKeyOrOptions);
2002
+ this.client = "client" in options ? options.client : createClient(options);
2003
+ this.defaults = limitToSeamHttpRequestOptions(options);
2004
+ }
2005
+ static fromClient(client, options = {}) {
2006
+ const constructorOptions = { ...options, client };
2007
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
2008
+ throw new SeamHttpInvalidOptionsError("Missing client");
2009
+ }
2010
+ return new _SeamHttpAcsEncoders(constructorOptions);
2011
+ }
2012
+ static fromApiKey(apiKey, options = {}) {
2013
+ const constructorOptions = { ...options, apiKey };
2014
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
2015
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
2016
+ }
2017
+ return new _SeamHttpAcsEncoders(constructorOptions);
2018
+ }
2019
+ static fromClientSessionToken(clientSessionToken, options = {}) {
2020
+ const constructorOptions = { ...options, clientSessionToken };
2021
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
2022
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
2023
+ }
2024
+ return new _SeamHttpAcsEncoders(constructorOptions);
2025
+ }
2026
+ static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2027
+ warnOnInsecureuserIdentifierKey(userIdentifierKey);
2028
+ const clientOptions = parseOptions({ ...options, publishableKey });
2029
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
2030
+ throw new SeamHttpInvalidOptionsError(
2031
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
2032
+ );
2033
+ }
2034
+ const client = createClient(clientOptions);
2035
+ const clientSessions = SeamHttpClientSessions.fromClient(client);
2036
+ const { token } = await clientSessions.getOrCreate({
2037
+ user_identifier_key: userIdentifierKey
2038
+ });
2039
+ return _SeamHttpAcsEncoders.fromClientSessionToken(token, options);
2040
+ }
2041
+ static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
2042
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId };
2043
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
2044
+ throw new SeamHttpInvalidOptionsError(
2045
+ "Missing consoleSessionToken or workspaceId"
2046
+ );
2047
+ }
2048
+ return new _SeamHttpAcsEncoders(constructorOptions);
2049
+ }
2050
+ static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
2051
+ const constructorOptions = { ...options, personalAccessToken, workspaceId };
2052
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
2053
+ throw new SeamHttpInvalidOptionsError(
2054
+ "Missing personalAccessToken or workspaceId"
2055
+ );
2056
+ }
2057
+ return new _SeamHttpAcsEncoders(constructorOptions);
2058
+ }
2059
+ async updateClientSessionToken(clientSessionToken) {
2060
+ const { headers } = this.client.defaults;
2061
+ const authHeaders = getAuthHeadersForClientSessionToken({
2062
+ clientSessionToken
2063
+ });
2064
+ for (const key of Object.keys(authHeaders)) {
2065
+ if (headers[key] == null) {
2066
+ throw new Error(
2067
+ "Cannot update a clientSessionToken on a client created without a clientSessionToken"
2068
+ );
2069
+ }
2070
+ }
2071
+ this.client.defaults.headers = { ...headers, ...authHeaders };
2072
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client);
2073
+ await clientSessions.get();
2074
+ }
2075
+ get simulate() {
2076
+ return SeamHttpAcsEncodersSimulate.fromClient(this.client, this.defaults);
2077
+ }
2078
+ encodeCredential(body, options = {}) {
2079
+ return new SeamHttpRequest(this, {
2080
+ path: "/acs/encoders/encode_credential",
2081
+ method: "post",
2082
+ body,
2083
+ responseKey: "action_attempt",
2084
+ options
2085
+ });
2086
+ }
2087
+ list(body) {
2088
+ return new SeamHttpRequest(this, {
2089
+ path: "/acs/encoders/list",
2090
+ method: "post",
2091
+ body,
2092
+ responseKey: "acs_encoders"
2093
+ });
2094
+ }
2095
+ scanCredential(body, options = {}) {
2096
+ return new SeamHttpRequest(this, {
2097
+ path: "/acs/encoders/scan_credential",
2098
+ method: "post",
2099
+ body,
2100
+ responseKey: "action_attempt",
2101
+ options
2102
+ });
2103
+ }
2104
+ };
2105
+
1887
2106
  // src/lib/seam/connect/routes/acs-entrances.ts
1888
2107
  var SeamHttpAcsEntrances = class _SeamHttpAcsEntrances {
1889
2108
  constructor(apiKeyOrOptions = {}) {
@@ -2458,6 +2677,9 @@ var SeamHttpAcs = class _SeamHttpAcs {
2458
2677
  get entrances() {
2459
2678
  return SeamHttpAcsEntrances.fromClient(this.client, this.defaults);
2460
2679
  }
2680
+ get encoders() {
2681
+ return SeamHttpAcsEncoders.fromClient(this.client, this.defaults);
2682
+ }
2461
2683
  get systems() {
2462
2684
  return SeamHttpAcsSystems.fromClient(this.client, this.defaults);
2463
2685
  }
@@ -2466,111 +2688,6 @@ var SeamHttpAcs = class _SeamHttpAcs {
2466
2688
  }
2467
2689
  };
2468
2690
 
2469
- // src/lib/seam/connect/routes/acs-encoders.ts
2470
- var SeamHttpAcsEncoders = class _SeamHttpAcsEncoders {
2471
- constructor(apiKeyOrOptions = {}) {
2472
- const options = parseOptions(apiKeyOrOptions);
2473
- this.client = "client" in options ? options.client : createClient(options);
2474
- this.defaults = limitToSeamHttpRequestOptions(options);
2475
- }
2476
- static fromClient(client, options = {}) {
2477
- const constructorOptions = { ...options, client };
2478
- if (!isSeamHttpOptionsWithClient(constructorOptions)) {
2479
- throw new SeamHttpInvalidOptionsError("Missing client");
2480
- }
2481
- return new _SeamHttpAcsEncoders(constructorOptions);
2482
- }
2483
- static fromApiKey(apiKey, options = {}) {
2484
- const constructorOptions = { ...options, apiKey };
2485
- if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
2486
- throw new SeamHttpInvalidOptionsError("Missing apiKey");
2487
- }
2488
- return new _SeamHttpAcsEncoders(constructorOptions);
2489
- }
2490
- static fromClientSessionToken(clientSessionToken, options = {}) {
2491
- const constructorOptions = { ...options, clientSessionToken };
2492
- if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
2493
- throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
2494
- }
2495
- return new _SeamHttpAcsEncoders(constructorOptions);
2496
- }
2497
- static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
2498
- warnOnInsecureuserIdentifierKey(userIdentifierKey);
2499
- const clientOptions = parseOptions({ ...options, publishableKey });
2500
- if (isSeamHttpOptionsWithClient(clientOptions)) {
2501
- throw new SeamHttpInvalidOptionsError(
2502
- "The client option cannot be used with SeamHttp.fromPublishableKey"
2503
- );
2504
- }
2505
- const client = createClient(clientOptions);
2506
- const clientSessions = SeamHttpClientSessions.fromClient(client);
2507
- const { token } = await clientSessions.getOrCreate({
2508
- user_identifier_key: userIdentifierKey
2509
- });
2510
- return _SeamHttpAcsEncoders.fromClientSessionToken(token, options);
2511
- }
2512
- static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
2513
- const constructorOptions = { ...options, consoleSessionToken, workspaceId };
2514
- if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
2515
- throw new SeamHttpInvalidOptionsError(
2516
- "Missing consoleSessionToken or workspaceId"
2517
- );
2518
- }
2519
- return new _SeamHttpAcsEncoders(constructorOptions);
2520
- }
2521
- static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
2522
- const constructorOptions = { ...options, personalAccessToken, workspaceId };
2523
- if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
2524
- throw new SeamHttpInvalidOptionsError(
2525
- "Missing personalAccessToken or workspaceId"
2526
- );
2527
- }
2528
- return new _SeamHttpAcsEncoders(constructorOptions);
2529
- }
2530
- async updateClientSessionToken(clientSessionToken) {
2531
- const { headers } = this.client.defaults;
2532
- const authHeaders = getAuthHeadersForClientSessionToken({
2533
- clientSessionToken
2534
- });
2535
- for (const key of Object.keys(authHeaders)) {
2536
- if (headers[key] == null) {
2537
- throw new Error(
2538
- "Cannot update a clientSessionToken on a client created without a clientSessionToken"
2539
- );
2540
- }
2541
- }
2542
- this.client.defaults.headers = { ...headers, ...authHeaders };
2543
- const clientSessions = SeamHttpClientSessions.fromClient(this.client);
2544
- await clientSessions.get();
2545
- }
2546
- encodeCredential(body, options = {}) {
2547
- return new SeamHttpRequest(this, {
2548
- path: "/acs/encoders/encode_credential",
2549
- method: "post",
2550
- body,
2551
- responseKey: "action_attempt",
2552
- options
2553
- });
2554
- }
2555
- list(body) {
2556
- return new SeamHttpRequest(this, {
2557
- path: "/acs/encoders/list",
2558
- method: "post",
2559
- body,
2560
- responseKey: "acs_encoders"
2561
- });
2562
- }
2563
- scanCredential(body, options = {}) {
2564
- return new SeamHttpRequest(this, {
2565
- path: "/acs/encoders/scan_credential",
2566
- method: "post",
2567
- body,
2568
- responseKey: "action_attempt",
2569
- options
2570
- });
2571
- }
2572
- };
2573
-
2574
2691
  // src/lib/seam/connect/routes/action-attempts.ts
2575
2692
  var SeamHttpActionAttempts = class _SeamHttpActionAttempts {
2576
2693
  constructor(apiKeyOrOptions = {}) {
@@ -5045,6 +5162,7 @@ exports.SeamHttpAcsCredentialProvisioningAutomations = SeamHttpAcsCredentialProv
5045
5162
  exports.SeamHttpAcsCredentials = SeamHttpAcsCredentials;
5046
5163
  exports.SeamHttpAcsCredentialsUnmanaged = SeamHttpAcsCredentialsUnmanaged;
5047
5164
  exports.SeamHttpAcsEncoders = SeamHttpAcsEncoders;
5165
+ exports.SeamHttpAcsEncodersSimulate = SeamHttpAcsEncodersSimulate;
5048
5166
  exports.SeamHttpAcsEntrances = SeamHttpAcsEntrances;
5049
5167
  exports.SeamHttpAcsSystems = SeamHttpAcsSystems;
5050
5168
  exports.SeamHttpAcsUsers = SeamHttpAcsUsers;