New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@britannica/cam-utils

Package Overview
Dependencies
Maintainers
0
Versions
47
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@britannica/cam-utils - npm Package Compare versions

Comparing version 5.0.0-beta.1 to 5.0.0-beta.2

22

dist/cam-utils.cjs.js

@@ -55,8 +55,8 @@ 'use strict';

class CAMUtilsClient {
constructor({ cookies: { get, getAll, set, remove }, cookieOptions, environment = exports.Environment.Dev, hostname = '.britannica.com', }) {
constructor({ cookies, cookieOptions, environment = exports.Environment.Dev, hostname = '.britannica.com', }) {
this.getCookie = (name) => {
return this.get(name);
return this.get?.(name);
};
this.setCookie = (name, value, options) => {
this.set(name, value, {
this.set?.(name, value, {
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * CAM_DEFAULT_EXPIRATION_DAYS), // 1 year

@@ -69,3 +69,3 @@ ...this.cookieOptions,

this.removeCookie = (name, options) => {
this.remove(name, {
this.remove?.(name, {
...options,

@@ -78,6 +78,6 @@ domain: this.cookieDomain,

}
this.get = get;
this.getAll = getAll;
this.set = set;
this.remove = remove;
this.get = cookies?.get;
this.getAll = cookies?.getAll;
this.set = cookies?.set;
this.remove = cookies?.remove;
this.cookieOptions = cookieOptions;

@@ -92,7 +92,7 @@ this.environment = environment;

clearAuthCookies() {
Object.keys(this.getAll())
Object.keys(this.getAll?.() ?? {})
.filter((key) => key.startsWith(COGNITO_COOKIE_PREFIX) ||
key === exports.CAMCookie.LegacyAuthCookie ||
key === exports.CAMCookie.MoneySession)
.forEach((cookie) => this.remove(cookie)); // We assert this because of the cognito cookie check
.forEach((cookie) => this.remove?.(cookie)); // We assert this because of the cognito cookie check
}

@@ -116,3 +116,3 @@ /**

try {
const redirectUrl = this.get(redirectCookie);
const redirectUrl = this.get?.(redirectCookie);
if (!redirectUrl) {

@@ -119,0 +119,0 @@ return;

@@ -53,8 +53,8 @@ // --- Enums

class CAMUtilsClient {
constructor({ cookies: { get, getAll, set, remove }, cookieOptions, environment = Environment.Dev, hostname = '.britannica.com', }) {
constructor({ cookies, cookieOptions, environment = Environment.Dev, hostname = '.britannica.com', }) {
this.getCookie = (name) => {
return this.get(name);
return this.get?.(name);
};
this.setCookie = (name, value, options) => {
this.set(name, value, {
this.set?.(name, value, {
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * CAM_DEFAULT_EXPIRATION_DAYS), // 1 year

@@ -67,3 +67,3 @@ ...this.cookieOptions,

this.removeCookie = (name, options) => {
this.remove(name, {
this.remove?.(name, {
...options,

@@ -76,6 +76,6 @@ domain: this.cookieDomain,

}
this.get = get;
this.getAll = getAll;
this.set = set;
this.remove = remove;
this.get = cookies?.get;
this.getAll = cookies?.getAll;
this.set = cookies?.set;
this.remove = cookies?.remove;
this.cookieOptions = cookieOptions;

@@ -90,7 +90,7 @@ this.environment = environment;

clearAuthCookies() {
Object.keys(this.getAll())
Object.keys(this.getAll?.() ?? {})
.filter((key) => key.startsWith(COGNITO_COOKIE_PREFIX) ||
key === CAMCookie.LegacyAuthCookie ||
key === CAMCookie.MoneySession)
.forEach((cookie) => this.remove(cookie)); // We assert this because of the cognito cookie check
.forEach((cookie) => this.remove?.(cookie)); // We assert this because of the cognito cookie check
}

@@ -114,3 +114,3 @@ /**

try {
const redirectUrl = this.get(redirectCookie);
const redirectUrl = this.get?.(redirectCookie);
if (!redirectUrl) {

@@ -117,0 +117,0 @@ return;

@@ -59,8 +59,8 @@ (function (global, factory) {

class CAMUtilsClient {
constructor({ cookies: { get, getAll, set, remove }, cookieOptions, environment = exports.Environment.Dev, hostname = '.britannica.com', }) {
constructor({ cookies, cookieOptions, environment = exports.Environment.Dev, hostname = '.britannica.com', }) {
this.getCookie = (name) => {
return this.get(name);
return this.get?.(name);
};
this.setCookie = (name, value, options) => {
this.set(name, value, {
this.set?.(name, value, {
expires: new Date(Date.now() + 1000 * 60 * 60 * 24 * CAM_DEFAULT_EXPIRATION_DAYS), // 1 year

@@ -73,3 +73,3 @@ ...this.cookieOptions,

this.removeCookie = (name, options) => {
this.remove(name, {
this.remove?.(name, {
...options,

@@ -82,6 +82,6 @@ domain: this.cookieDomain,

}
this.get = get;
this.getAll = getAll;
this.set = set;
this.remove = remove;
this.get = cookies?.get;
this.getAll = cookies?.getAll;
this.set = cookies?.set;
this.remove = cookies?.remove;
this.cookieOptions = cookieOptions;

@@ -96,7 +96,7 @@ this.environment = environment;

clearAuthCookies() {
Object.keys(this.getAll())
Object.keys(this.getAll?.() ?? {})
.filter((key) => key.startsWith(COGNITO_COOKIE_PREFIX) ||
key === exports.CAMCookie.LegacyAuthCookie ||
key === exports.CAMCookie.MoneySession)
.forEach((cookie) => this.remove(cookie)); // We assert this because of the cognito cookie check
.forEach((cookie) => this.remove?.(cookie)); // We assert this because of the cognito cookie check
}

@@ -120,3 +120,3 @@ /**

try {
const redirectUrl = this.get(redirectCookie);
const redirectUrl = this.get?.(redirectCookie);
if (!redirectUrl) {

@@ -123,0 +123,0 @@ return;

import type { CookieSerializeOptions } from 'cookie';
export type GetCookie = (name: CAMCookie) => string | undefined;
export type GetAllCookies = () => Record<string, string>;
export type SetCookie = (name: CAMCookie, value: string, options?: CookieOptions) => void;
export type RemoveCookie = (name: CAMCookie, options?: CookieOptions) => void;
export type CookieOptions = Partial<CookieSerializeOptions>;
export type SetCookie = (name: CAMCookie, value: string, options?: CookieSerializeOptions) => void;
export type RemoveCookie = (name: CAMCookie, options?: CookieSerializeOptions) => void;
export type CAMUtilsClientOptions = {
cookies: {
get: GetCookie;
getAll: GetAllCookies;
set: SetCookie;
remove: RemoveCookie;
cookies?: {
get?: GetCookie;
getAll?: GetAllCookies;
set?: SetCookie;
remove?: RemoveCookie;
};
cookieOptions?: CookieOptions;
cookieOptions?: CookieSerializeOptions;
environment?: Environment;

@@ -24,3 +23,3 @@ hostname?: string;

export type AuthConfiguration = PoolConfiguration & {
cookieStorage?: CookieOptions;
cookieStorage?: CookieSerializeOptions;
};

@@ -57,10 +56,10 @@ /**

export declare class CAMUtilsClient {
private readonly get;
private readonly getAll;
private readonly set;
private readonly remove;
readonly cookieOptions?: CookieOptions;
private readonly get?;
private readonly getAll?;
private readonly set?;
private readonly remove?;
readonly cookieOptions?: CookieSerializeOptions;
readonly environment: Environment;
cookieDomain: string;
constructor({ cookies: { get, getAll, set, remove }, cookieOptions, environment, hostname, }: CAMUtilsClientOptions);
constructor({ cookies, cookieOptions, environment, hostname, }: CAMUtilsClientOptions);
set hostname(hostname: string);

@@ -67,0 +66,0 @@ getCookie: GetCookie;

{
"name": "@britannica/cam-utils",
"version": "5.0.0-beta.1",
"version": "5.0.0-beta.2",
"description": "Consumer Account Management (CAM) auth configuration and utilities",

@@ -5,0 +5,0 @@ "repository": "git://github.com/britannica/cam-utils.git",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc