0.2.0 - Mid migration

This commit is contained in:
Daniel Mason 2022-04-25 14:47:15 +12:00
parent 139e6a915e
commit 7e38fdbd7d
42393 changed files with 5358157 additions and 62 deletions

17
web/node_modules/universal-cookie/es6/Cookies.d.ts generated vendored Normal file
View file

@ -0,0 +1,17 @@
import { Cookie, CookieChangeListener, CookieGetOptions, CookieParseOptions, CookieSetOptions } from './types';
export default class Cookies {
private cookies;
private changeListeners;
private HAS_DOCUMENT_COOKIE;
constructor(cookies?: string | object | null, options?: CookieParseOptions);
private _updateBrowserValues;
private _emitChange;
get(name: string, options?: CookieGetOptions): any;
get<T>(name: string, options?: CookieGetOptions): T;
getAll(options?: CookieGetOptions): any;
getAll<T>(options?: CookieGetOptions): T;
set(name: string, value: Cookie, options?: CookieSetOptions): void;
remove(name: string, options?: CookieSetOptions): void;
addChangeListener(callback: CookieChangeListener): void;
removeChangeListener(callback: CookieChangeListener): void;
}

80
web/node_modules/universal-cookie/es6/Cookies.js generated vendored Normal file
View file

@ -0,0 +1,80 @@
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
import * as cookie from 'cookie';
import { hasDocumentCookie, parseCookies, readCookie } from './utils';
var Cookies = /** @class */ (function () {
function Cookies(cookies, options) {
var _this = this;
this.changeListeners = [];
this.HAS_DOCUMENT_COOKIE = false;
this.cookies = parseCookies(cookies, options);
new Promise(function () {
_this.HAS_DOCUMENT_COOKIE = hasDocumentCookie();
}).catch(function () { });
}
Cookies.prototype._updateBrowserValues = function (parseOptions) {
if (!this.HAS_DOCUMENT_COOKIE) {
return;
}
this.cookies = cookie.parse(document.cookie, parseOptions);
};
Cookies.prototype._emitChange = function (params) {
for (var i = 0; i < this.changeListeners.length; ++i) {
this.changeListeners[i](params);
}
};
Cookies.prototype.get = function (name, options, parseOptions) {
if (options === void 0) { options = {}; }
this._updateBrowserValues(parseOptions);
return readCookie(this.cookies[name], options);
};
Cookies.prototype.getAll = function (options, parseOptions) {
if (options === void 0) { options = {}; }
this._updateBrowserValues(parseOptions);
var result = {};
for (var name_1 in this.cookies) {
result[name_1] = readCookie(this.cookies[name_1], options);
}
return result;
};
Cookies.prototype.set = function (name, value, options) {
var _a;
if (typeof value === 'object') {
value = JSON.stringify(value);
}
this.cookies = __assign(__assign({}, this.cookies), (_a = {}, _a[name] = value, _a));
if (this.HAS_DOCUMENT_COOKIE) {
document.cookie = cookie.serialize(name, value, options);
}
this._emitChange({ name: name, value: value, options: options });
};
Cookies.prototype.remove = function (name, options) {
var finalOptions = (options = __assign(__assign({}, options), { expires: new Date(1970, 1, 1, 0, 0, 1), maxAge: 0 }));
this.cookies = __assign({}, this.cookies);
delete this.cookies[name];
if (this.HAS_DOCUMENT_COOKIE) {
document.cookie = cookie.serialize(name, '', finalOptions);
}
this._emitChange({ name: name, value: undefined, options: options });
};
Cookies.prototype.addChangeListener = function (callback) {
this.changeListeners.push(callback);
};
Cookies.prototype.removeChangeListener = function (callback) {
var idx = this.changeListeners.indexOf(callback);
if (idx >= 0) {
this.changeListeners.splice(idx, 1);
}
};
return Cookies;
}());
export default Cookies;

3
web/node_modules/universal-cookie/es6/index.d.ts generated vendored Normal file
View file

@ -0,0 +1,3 @@
import Cookies from './Cookies';
export default Cookies;
export * from './types';

2
web/node_modules/universal-cookie/es6/index.js generated vendored Normal file
View file

@ -0,0 +1,2 @@
import Cookies from './Cookies';
export default Cookies;

23
web/node_modules/universal-cookie/es6/types.d.ts generated vendored Normal file
View file

@ -0,0 +1,23 @@
export declare type Cookie = any;
export interface CookieGetOptions {
doNotParse?: boolean;
}
export interface CookieSetOptions {
path?: string;
expires?: Date;
maxAge?: number;
domain?: string;
secure?: boolean;
httpOnly?: boolean;
sameSite?: boolean | 'none' | 'lax' | 'strict';
encode?: (value: string) => string;
}
export interface CookieChangeOptions {
name: string;
value?: any;
options?: CookieSetOptions;
}
export interface CookieParseOptions {
decode: (value: string) => string;
}
export declare type CookieChangeListener = (options: CookieChangeOptions) => void;

0
web/node_modules/universal-cookie/es6/types.js generated vendored Normal file
View file

6
web/node_modules/universal-cookie/es6/utils.d.ts generated vendored Normal file
View file

@ -0,0 +1,6 @@
import { Cookie, CookieGetOptions, CookieParseOptions } from './types';
export declare function hasDocumentCookie(): boolean;
export declare function cleanCookies(): void;
export declare function parseCookies(cookies?: string | object | null, options?: CookieParseOptions): object;
export declare function isParsingCookie(value: Cookie, doNotParse?: boolean): boolean;
export declare function readCookie(value: Cookie, options?: CookieGetOptions): any;

53
web/node_modules/universal-cookie/es6/utils.js generated vendored Normal file
View file

@ -0,0 +1,53 @@
import * as cookie from 'cookie';
export function hasDocumentCookie() {
// Can we get/set cookies on document.cookie?
return typeof document === 'object' && typeof document.cookie === 'string';
}
export function cleanCookies() {
document.cookie.split(';').forEach(function (c) {
document.cookie = c
.replace(/^ +/, '')
.replace(/=.*/, '=;expires=' + new Date().toUTCString() + ';path=/');
});
}
export function parseCookies(cookies, options) {
if (typeof cookies === 'string') {
return cookie.parse(cookies, options);
}
else if (typeof cookies === 'object' && cookies !== null) {
return cookies;
}
else {
return {};
}
}
export function isParsingCookie(value, doNotParse) {
if (typeof doNotParse === 'undefined') {
// We guess if the cookie start with { or [, it has been serialized
doNotParse =
!value || (value[0] !== '{' && value[0] !== '[' && value[0] !== '"');
}
return !doNotParse;
}
export function readCookie(value, options) {
if (options === void 0) { options = {}; }
var cleanValue = cleanupCookieValue(value);
if (isParsingCookie(cleanValue, options.doNotParse)) {
try {
return JSON.parse(cleanValue);
}
catch (e) {
// At least we tried
}
}
// Ignore clean value if we failed the deserialization
// It is not relevant anymore to trim those values
return value;
}
function cleanupCookieValue(value) {
// express prepend j: before serializing a cookie
if (value && value[0] === 'j' && value[1] === ':') {
return value.substr(2);
}
return value;
}