@delopay/sdk 0.20.0 → 0.21.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/index.cjs CHANGED
@@ -1947,6 +1947,55 @@ var Users = class {
1947
1947
  async signOut() {
1948
1948
  return this.request("POST", "/user/signout");
1949
1949
  }
1950
+ /**
1951
+ * Paginated login history for the authenticated user — IP, User-Agent,
1952
+ * country / city / lat-lon (when GeoIP is enabled in backend), success
1953
+ * and failure events with their reasons. Strictly scoped to the JWT
1954
+ * subject; a user can only see their own activity.
1955
+ *
1956
+ * `GET /user/me/login-activity`. Requires a logged-in JWT.
1957
+ *
1958
+ * The backend returns an empty page when a Delopay admin is impersonating
1959
+ * a non-admin merchant, so the admin's metadata never renders inside the
1960
+ * merchant dashboard.
1961
+ */
1962
+ async listLoginActivity(params) {
1963
+ if (params === void 0) {
1964
+ return this.request("GET", "/user/me/login-activity");
1965
+ }
1966
+ return this.request("GET", "/user/me/login-activity", {
1967
+ query: params
1968
+ });
1969
+ }
1970
+ /**
1971
+ * List the authenticated user's currently-active dashboard sessions
1972
+ * (one row per minted login JWT that hasn't been revoked or expired).
1973
+ *
1974
+ * The row matching the JWT making this call has `is_current: true`,
1975
+ * which is what lets the dashboard render a "This device" tag.
1976
+ *
1977
+ * `GET /user/me/sessions`. Requires a logged-in JWT. Returns an empty
1978
+ * list when a Delopay admin is impersonating a non-admin merchant
1979
+ * (same guard as `listLoginActivity`).
1980
+ */
1981
+ async listActiveSessions() {
1982
+ return this.request("GET", "/user/me/sessions");
1983
+ }
1984
+ /**
1985
+ * Disconnect one of the authenticated user's sessions. The matching
1986
+ * JWT is rejected on its next request — fast-path via Redis, fall back
1987
+ * to the persistent `revoked_at` column.
1988
+ *
1989
+ * Idempotent: revoking an already-revoked or unknown id returns 404,
1990
+ * which the caller can treat as success for retry purposes. Revoking
1991
+ * a session id that belongs to a different user also returns 404 —
1992
+ * the response intentionally doesn't leak whether the id exists.
1993
+ *
1994
+ * `POST /user/me/sessions/{sessionId}/revoke`.
1995
+ */
1996
+ async revokeSession(sessionId) {
1997
+ return this.request("POST", `/user/me/sessions/${encodeURIComponent(sessionId)}/revoke`);
1998
+ }
1950
1999
  async getDetails() {
1951
2000
  return this.request("GET", "/user");
1952
2001
  }