@gohighlevel/api-client
Version:
Official SDK for HighLevel Public APIs
36 lines • 1.51 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SessionStorage = void 0;
const logging_1 = require("../logging");
/**
* Abstract base class for session storage implementations
* Provides interface for storing and retrieving user sessions, tokens, and related data
*/
class SessionStorage {
constructor(logger) {
/**
* Calculate the expiration timestamp in milliseconds
* @param expiresIn - The number of seconds until expiration (optional)
* @returns The timestamp in milliseconds
*/
this.calculateExpireAt = (expiresIn) => {
if (expiresIn === undefined || expiresIn === null) {
// Default to 24 hours if no expires_in provided
return Date.now() + (24 * 60 * 60 * 1000);
}
return Date.now() + (expiresIn * 1000);
};
this.logger = logger || new logging_1.Logger('warn', 'GHL SDK Storage');
}
/**
* Get all sessions for the current application (optional method)
* This method is optional and can be overridden by implementations that support it
* @returns Array of session data for the current application
* @throws Error if not implemented by the storage implementation
*/
async getSessionsByApplication() {
throw new Error('getSessionsByApplication is not implemented by this storage provider');
}
}
exports.SessionStorage = SessionStorage;
//# sourceMappingURL=session-storage.js.map