@seamapi/http 1.2.0 → 1.3.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
@@ -1871,6 +1871,101 @@ var SeamHttpAcsSystems = class _SeamHttpAcsSystems {
1871
1871
  }
1872
1872
  };
1873
1873
 
1874
+ // src/lib/seam/connect/routes/acs-users-unmanaged.ts
1875
+ var SeamHttpAcsUsersUnmanaged = class _SeamHttpAcsUsersUnmanaged {
1876
+ constructor(apiKeyOrOptions = {}) {
1877
+ const options = parseOptions(apiKeyOrOptions);
1878
+ this.client = "client" in options ? options.client : createClient(options);
1879
+ this.defaults = limitToSeamHttpRequestOptions(options);
1880
+ }
1881
+ static fromClient(client, options = {}) {
1882
+ const constructorOptions = { ...options, client };
1883
+ if (!isSeamHttpOptionsWithClient(constructorOptions)) {
1884
+ throw new SeamHttpInvalidOptionsError("Missing client");
1885
+ }
1886
+ return new _SeamHttpAcsUsersUnmanaged(constructorOptions);
1887
+ }
1888
+ static fromApiKey(apiKey, options = {}) {
1889
+ const constructorOptions = { ...options, apiKey };
1890
+ if (!isSeamHttpOptionsWithApiKey(constructorOptions)) {
1891
+ throw new SeamHttpInvalidOptionsError("Missing apiKey");
1892
+ }
1893
+ return new _SeamHttpAcsUsersUnmanaged(constructorOptions);
1894
+ }
1895
+ static fromClientSessionToken(clientSessionToken, options = {}) {
1896
+ const constructorOptions = { ...options, clientSessionToken };
1897
+ if (!isSeamHttpOptionsWithClientSessionToken(constructorOptions)) {
1898
+ throw new SeamHttpInvalidOptionsError("Missing clientSessionToken");
1899
+ }
1900
+ return new _SeamHttpAcsUsersUnmanaged(constructorOptions);
1901
+ }
1902
+ static async fromPublishableKey(publishableKey, userIdentifierKey, options = {}) {
1903
+ warnOnInsecureuserIdentifierKey(userIdentifierKey);
1904
+ const clientOptions = parseOptions({ ...options, publishableKey });
1905
+ if (isSeamHttpOptionsWithClient(clientOptions)) {
1906
+ throw new SeamHttpInvalidOptionsError(
1907
+ "The client option cannot be used with SeamHttp.fromPublishableKey"
1908
+ );
1909
+ }
1910
+ const client = createClient(clientOptions);
1911
+ const clientSessions = SeamHttpClientSessions.fromClient(client);
1912
+ const { token } = await clientSessions.getOrCreate({
1913
+ user_identifier_key: userIdentifierKey
1914
+ });
1915
+ return _SeamHttpAcsUsersUnmanaged.fromClientSessionToken(token, options);
1916
+ }
1917
+ static fromConsoleSessionToken(consoleSessionToken, workspaceId, options = {}) {
1918
+ const constructorOptions = { ...options, consoleSessionToken, workspaceId };
1919
+ if (!isSeamHttpOptionsWithConsoleSessionToken(constructorOptions)) {
1920
+ throw new SeamHttpInvalidOptionsError(
1921
+ "Missing consoleSessionToken or workspaceId"
1922
+ );
1923
+ }
1924
+ return new _SeamHttpAcsUsersUnmanaged(constructorOptions);
1925
+ }
1926
+ static fromPersonalAccessToken(personalAccessToken, workspaceId, options = {}) {
1927
+ const constructorOptions = { ...options, personalAccessToken, workspaceId };
1928
+ if (!isSeamHttpOptionsWithPersonalAccessToken(constructorOptions)) {
1929
+ throw new SeamHttpInvalidOptionsError(
1930
+ "Missing personalAccessToken or workspaceId"
1931
+ );
1932
+ }
1933
+ return new _SeamHttpAcsUsersUnmanaged(constructorOptions);
1934
+ }
1935
+ async updateClientSessionToken(clientSessionToken) {
1936
+ const { headers } = this.client.defaults;
1937
+ const authHeaders = getAuthHeadersForClientSessionToken({
1938
+ clientSessionToken
1939
+ });
1940
+ for (const key of Object.keys(authHeaders)) {
1941
+ if (headers[key] == null) {
1942
+ throw new Error(
1943
+ "Cannot update a clientSessionToken on a client created without a clientSessionToken"
1944
+ );
1945
+ }
1946
+ }
1947
+ this.client.defaults.headers = { ...headers, ...authHeaders };
1948
+ const clientSessions = SeamHttpClientSessions.fromClient(this.client);
1949
+ await clientSessions.get();
1950
+ }
1951
+ get(body) {
1952
+ return new SeamHttpRequest(this, {
1953
+ path: "/acs/users/unmanaged/get",
1954
+ method: "post",
1955
+ body,
1956
+ responseKey: "acs_user"
1957
+ });
1958
+ }
1959
+ list(body) {
1960
+ return new SeamHttpRequest(this, {
1961
+ path: "/acs/users/unmanaged/list",
1962
+ method: "post",
1963
+ body,
1964
+ responseKey: "acs_users"
1965
+ });
1966
+ }
1967
+ };
1968
+
1874
1969
  // src/lib/seam/connect/routes/acs-users.ts
1875
1970
  var SeamHttpAcsUsers = class _SeamHttpAcsUsers {
1876
1971
  constructor(apiKeyOrOptions = {}) {
@@ -1948,6 +2043,9 @@ var SeamHttpAcsUsers = class _SeamHttpAcsUsers {
1948
2043
  const clientSessions = SeamHttpClientSessions.fromClient(this.client);
1949
2044
  await clientSessions.get();
1950
2045
  }
2046
+ get unmanaged() {
2047
+ return SeamHttpAcsUsersUnmanaged.fromClient(this.client, this.defaults);
2048
+ }
1951
2049
  addToAccessGroup(body) {
1952
2050
  return new SeamHttpRequest(this, {
1953
2051
  path: "/acs/users/add_to_access_group",
@@ -4571,6 +4669,7 @@ exports.SeamHttpAcsCredentials = SeamHttpAcsCredentials;
4571
4669
  exports.SeamHttpAcsEntrances = SeamHttpAcsEntrances;
4572
4670
  exports.SeamHttpAcsSystems = SeamHttpAcsSystems;
4573
4671
  exports.SeamHttpAcsUsers = SeamHttpAcsUsers;
4672
+ exports.SeamHttpAcsUsersUnmanaged = SeamHttpAcsUsersUnmanaged;
4574
4673
  exports.SeamHttpActionAttempts = SeamHttpActionAttempts;
4575
4674
  exports.SeamHttpApiError = SeamHttpApiError;
4576
4675
  exports.SeamHttpClientSessions = SeamHttpClientSessions;