diff --git a/d.ts/Cookies.d.ts b/d.ts/Cookies.d.ts index 73da6c37..3c13e018 100644 --- a/d.ts/Cookies.d.ts +++ b/d.ts/Cookies.d.ts @@ -2,7 +2,8 @@ export interface Cookie { [key: string]: string; value: string; } +declare function parse(str: string, options?: any): Cookie; declare const _default: { - parse: (str: string, options?: any) => Cookie; + parse: typeof parse; }; export default _default; diff --git a/d.ts/index.d.ts b/d.ts/index.d.ts index af2ebf95..719c0437 100644 --- a/d.ts/index.d.ts +++ b/d.ts/index.d.ts @@ -1,70 +1,9 @@ -import { Experiments as PrismicExperiment } from './experiments'; +import ResolvedApi, { EXPERIMENT_COOKIE as experimentCookie, PREVIEW_COOKIE as previewCookie } from './ResolvedApi'; +import Predicates from './Predicates'; +import { Experiments } from './experiments'; +import Api, { ApiOptions } from './Api'; import { DefaultClient } from './client'; -import PrismicApi, { ApiOptions } from './Api'; -import ResolvedApi from './ResolvedApi'; -declare namespace Prismic { - const experimentCookie = "io.prismic.experiment"; - const previewCookie = "io.prismic.preview"; - const Predicates: { - at(fragment: string, value: string | number | Date | (string | number | Date)[]): string; - not(fragment: string, value: string | number | Date | (string | number | Date)[]): string; - missing(fragment: string): string; - has(fragment: string): string; - any(fragment: string, values: (string | number | Date)[]): string; - in(fragment: string, values: string[]): string; - fulltext(fragment: string, value: string): string; - similar(documentId: string, maxResults: number): string; - date: { - before(fragment: string, before: string | number | Date): string; - after(fragment: string, after: string | number | Date): string; - between(fragment: string, before: string | number | Date, after: string | number | Date): string; - dayOfMonth(fragment: string, day: number): string; - dayOfMonthAfter(fragment: string, day: number): string; - dayOfMonthBefore(fragment: string, day: number): string; - dayOfWeek(fragment: string, day: string | number): string; - dayOfWeekAfter(fragment: string, day: string | number): string; - dayOfWeekBefore(fragment: string, day: string | number): string; - month(fragment: string, month: string | number): string; - monthBefore(fragment: string, month: string | number): string; - monthAfter(fragment: string, month: string | number): string; - year(fragment: string, year: number): string; - hour(fragment: string, hour: number): string; - hourBefore(fragment: string, hour: number): string; - hourAfter(fragment: string, hour: number): string; - }; - dateBefore: (fragment: string, before: string | number | Date) => string; - dateAfter: (fragment: string, after: string | number | Date) => string; - dateBetween: (fragment: string, before: string | number | Date, after: string | number | Date) => string; - dayOfMonth: (fragment: string, day: number) => string; - dayOfMonthAfter: (fragment: string, day: number) => string; - dayOfMonthBefore: (fragment: string, day: number) => string; - dayOfWeek: (fragment: string, day: string | number) => string; - dayOfWeekAfter: (fragment: string, day: string | number) => string; - dayOfWeekBefore: (fragment: string, day: string | number) => string; - month: (fragment: string, month: string | number) => string; - monthBefore: (fragment: string, month: string | number) => string; - monthAfter: (fragment: string, month: string | number) => string; - year: (fragment: string, year: number) => string; - hour: (fragment: string, hour: number) => string; - hourBefore: (fragment: string, hour: number) => string; - hourAfter: (fragment: string, hour: number) => string; - number: { - gt(fragment: string, value: number): string; - lt(fragment: string, value: number): string; - inRange(fragment: string, before: number, after: number): string; - }; - gt: (fragment: string, value: number) => string; - lt: (fragment: string, value: number) => string; - inRange: (fragment: string, before: number, after: number) => string; - near: (fragment: string, latitude: number, longitude: number, radius: number) => string; - geopoint: { - near(fragment: string, latitude: number, longitude: number, radius: number): string; - }; - }; - const Experiments: typeof PrismicExperiment; - const Api: typeof PrismicApi; - function client(url: string, options?: ApiOptions): DefaultClient; - function getApi(url: string, options?: ApiOptions): Promise; - function api(url: string, options?: ApiOptions): Promise; -} -export = Prismic; +export { experimentCookie, previewCookie, Predicates, Experiments, Api }; +export declare function client(url: string, options?: ApiOptions): DefaultClient; +export declare function getApi(url: string, options?: ApiOptions): Promise; +export declare function api(url: string, options?: ApiOptions): Promise; diff --git a/dist/prismic-javascript.browser.esm.js b/dist/prismic-javascript.browser.esm.js new file mode 100644 index 00000000..cc3edcde --- /dev/null +++ b/dist/prismic-javascript.browser.esm.js @@ -0,0 +1,1252 @@ +class Variation { + constructor(data) { + this.data = {}; + this.data = data; + } + id() { + return this.data.id; + } + ref() { + return this.data.ref; + } + label() { + return this.data.label; + } +} +class Experiment { + constructor(data) { + this.data = {}; + this.data = data; + this.variations = (data.variations || []).map((v) => { + return new Variation(v); + }); + } + id() { + return this.data.id; + } + googleId() { + return this.data.googleId; + } + name() { + return this.data.name; + } +} +class Experiments { + constructor(data) { + if (data) { + this.drafts = (data.drafts || []).map((exp) => { + return new Experiment(exp); + }); + this.running = (data.running || []).map((exp) => { + return new Experiment(exp); + }); + } + } + current() { + if (this.running.length > 0) { + return this.running[0]; + } + else { + return null; + } + } + refFromCookie(cookie) { + if (!cookie || cookie.trim() === '') + return null; + const splitted = cookie.trim().split(' '); + if (splitted.length < 2) + return null; + const expId = splitted[0]; + const varIndex = parseInt(splitted[1], 10); + const exp = this.running.filter((exp) => { + return exp.googleId() === expId && exp.variations.length > varIndex; + })[0]; + return exp ? exp.variations[varIndex].ref() : null; + } +} + +class LazySearchForm { + constructor(id, api) { + this.id = id; + this.api = api; + this.fields = {}; + } + set(key, value) { + this.fields[key] = value; + return this; + } + ref(ref) { + return this.set('ref', ref); + } + query(query) { + return this.set('q', query); + } + pageSize(size) { + return this.set('pageSize', size); + } + fetch(fields) { + return this.set('fetch', fields); + } + fetchLinks(fields) { + return this.set('fetchLinks', fields); + } + lang(langCode) { + return this.set('lang', langCode); + } + page(p) { + return this.set('page', p); + } + after(documentId) { + return this.set('after', documentId); + } + orderings(orderings) { + return this.set('orderings', orderings); + } + url() { + return this.api.get().then((api) => { + return LazySearchForm.toSearchForm(this, api).url(); + }); + } + submit(cb) { + return this.api.get().then((api) => { + return LazySearchForm.toSearchForm(this, api).submit(cb); + }); + } + static toSearchForm(lazyForm, api) { + const form = api.form(lazyForm.id); + if (form) { + return Object.keys(lazyForm.fields).reduce((form, fieldKey) => { + const fieldValue = lazyForm.fields[fieldKey]; + if (fieldKey === 'q') { + return form.query(fieldValue); + } + else if (fieldKey === 'pageSize') { + return form.pageSize(fieldValue); + } + else if (fieldKey === 'fetch') { + return form.fetch(fieldValue); + } + else if (fieldKey === 'fetchLinks') { + return form.fetchLinks(fieldValue); + } + else if (fieldKey === 'lang') { + return form.lang(fieldValue); + } + else if (fieldKey === 'page') { + return form.page(fieldValue); + } + else if (fieldKey === 'after') { + return form.after(fieldValue); + } + else if (fieldKey === 'orderings') { + return form.orderings(fieldValue); + } + else { + return form.set(fieldKey, fieldValue); + } + }, form); + } + else { + throw new Error(`Unable to access to form ${lazyForm.id}`); + } + } +} +class SearchForm { + constructor(form, httpClient) { + this.httpClient = httpClient; + this.form = form; + this.data = {}; + for (const field in form.fields) { + if (form.fields[field]['default']) { + this.data[field] = [form.fields[field]['default']]; + } + } + } + set(field, value) { + const fieldDesc = this.form.fields[field]; + if (!fieldDesc) + throw new Error('Unknown field ' + field); + const checkedValue = value === '' || value === undefined ? null : value; + let values = this.data[field] || []; + if (fieldDesc.multiple) { + values = checkedValue ? values.concat([checkedValue]) : values; + } + else { + values = checkedValue ? [checkedValue] : values; + } + this.data[field] = values; + return this; + } + /** + * Sets a ref to query on for this SearchForm. This is a mandatory + * method to call before calling submit(), and api.form('everything').submit() + * will not work. + */ + ref(ref) { + return this.set('ref', ref); + } + /** + * Sets a predicate-based query for this SearchForm. This is where you + * paste what you compose in your prismic.io API browser. + */ + query(query) { + if (typeof query === 'string') { + return this.query([query]); + } + else if (query instanceof Array) { + return this.set('q', `[${query.join('')}]`); + } + else { + throw new Error(`Invalid query : ${query}`); + } + } + /** + * Sets a page size to query for this SearchForm. This is an optional method. + * + * @param {number} size - The page size + * @returns {SearchForm} - The SearchForm itself + */ + pageSize(size) { + return this.set('pageSize', size); + } + /** + * Restrict the results document to the specified fields + */ + fetch(fields) { + const strFields = fields instanceof Array ? fields.join(',') : fields; + return this.set('fetch', strFields); + } + /** + * Include the requested fields in the DocumentLink instances in the result + */ + fetchLinks(fields) { + const strFields = fields instanceof Array ? fields.join(',') : fields; + return this.set('fetchLinks', strFields); + } + /** + * Sets the language to query for this SearchForm. This is an optional method. + */ + lang(langCode) { + return this.set('lang', langCode); + } + /** + * Sets the page number to query for this SearchForm. This is an optional method. + */ + page(p) { + return this.set('page', p); + } + /** + * Remove all the documents except for those after the specified document in the list. This is an optional method. + */ + after(documentId) { + return this.set('after', documentId); + } + /** + * Sets the orderings to query for this SearchForm. This is an optional method. + */ + orderings(orderings) { + if (!orderings) { + return this; + } + else { + return this.set('orderings', `[${orderings.join(',')}]`); + } + } + /** + * Build the URL to query + */ + url() { + let url = this.form.action; + if (this.data) { + let sep = (url.indexOf('?') > -1 ? '&' : '?'); + for (const key in this.data) { + if (this.data.hasOwnProperty(key)) { + const values = this.data[key]; + if (values) { + for (let i = 0; i < values.length; i++) { + url += sep + key + '=' + encodeURIComponent(values[i]); + sep = '&'; + } + } + } + } + } + return url; + } + /** + * Submits the query, and calls the callback function. + */ + submit(cb) { + return this.httpClient.cachedRequest(this.url()).then((response) => { + cb && cb(null, response); + return response; + }).catch((error) => { + cb && cb(error); + throw error; + }); + } +} + +const OPERATOR = { + at: 'at', + not: 'not', + missing: 'missing', + has: 'has', + any: 'any', + in: 'in', + fulltext: 'fulltext', + similar: 'similar', + numberGt: 'number.gt', + numberLt: 'number.lt', + numberInRange: 'number.inRange', + dateBefore: 'date.before', + dateAfter: 'date.after', + dateBetween: 'date.between', + dateDayOfMonth: 'date.day-of-month', + dateDayOfMonthAfter: 'date.day-of-month-after', + dateDayOfMonthBefore: 'date.day-of-month-before', + dateDayOfWeek: 'date.day-of-week', + dateDayOfWeekAfter: 'date.day-of-week-after', + dateDayOfWeekBefore: 'date.day-of-week-before', + dateMonth: 'date.month', + dateMonthBefore: 'date.month-before', + dateMonthAfter: 'date.month-after', + dateYear: 'date.year', + dateHour: 'date.hour', + dateHourBefore: 'date.hour-before', + dateHourAfter: 'date.hour-after', + GeopointNear: 'geopoint.near', +}; +function encode(value) { + if (typeof value === 'string') { + return `"${value}"`; + } + else if (typeof value === 'number') { + return value.toString(); + } + else if (value instanceof Date) { + return value.getTime().toString(); + } + else if (value instanceof Array) { + return `[${value.map(v => encode(v)).join(',')}]`; + } + else { + throw new Error(`Unable to encode ${value} of type ${typeof value}`); + } +} +const geopoint = { + near(fragment, latitude, longitude, radius) { + return `[${OPERATOR.GeopointNear}(${fragment}, ${latitude}, ${longitude}, ${radius})]`; + }, +}; +const date = { + before(fragment, before) { + return `[${OPERATOR.dateBefore}(${fragment}, ${encode(before)})]`; + }, + after(fragment, after) { + return `[${OPERATOR.dateAfter}(${fragment}, ${encode(after)})]`; + }, + between(fragment, before, after) { + return `[${OPERATOR.dateBetween}(${fragment}, ${encode(before)}, ${encode(after)})]`; + }, + dayOfMonth(fragment, day) { + return `[${OPERATOR.dateDayOfMonth}(${fragment}, ${day})]`; + }, + dayOfMonthAfter(fragment, day) { + return `[${OPERATOR.dateDayOfMonthAfter}(${fragment}, ${day})]`; + }, + dayOfMonthBefore(fragment, day) { + return `[${OPERATOR.dateDayOfMonthBefore}(${fragment}, ${day})]`; + }, + dayOfWeek(fragment, day) { + return `[${OPERATOR.dateDayOfWeek}(${fragment}, ${encode(day)})]`; + }, + dayOfWeekAfter(fragment, day) { + return `[${OPERATOR.dateDayOfWeekAfter}(${fragment}, ${encode(day)})]`; + }, + dayOfWeekBefore(fragment, day) { + return `[${OPERATOR.dateDayOfWeekBefore}(${fragment}, ${encode(day)})]`; + }, + month(fragment, month) { + return `[${OPERATOR.dateMonth}(${fragment}, ${encode(month)})]`; + }, + monthBefore(fragment, month) { + return `[${OPERATOR.dateMonthBefore}(${fragment}, ${encode(month)})]`; + }, + monthAfter(fragment, month) { + return `[${OPERATOR.dateMonthAfter}(${fragment}, ${encode(month)})]`; + }, + year(fragment, year) { + return `[${OPERATOR.dateYear}(${fragment}, ${year})]`; + }, + hour(fragment, hour) { + return `[${OPERATOR.dateHour}(${fragment}, ${hour})]`; + }, + hourBefore(fragment, hour) { + return `[${OPERATOR.dateHourBefore}(${fragment}, ${hour})]`; + }, + hourAfter(fragment, hour) { + return `[${OPERATOR.dateHourAfter}(${fragment}, ${hour})]`; + }, +}; +const number = { + gt(fragment, value) { + return `[${OPERATOR.numberGt}(${fragment}, ${value})]`; + }, + lt(fragment, value) { + return `[${OPERATOR.numberLt}(${fragment}, ${value})]`; + }, + inRange(fragment, before, after) { + return `[${OPERATOR.numberInRange}(${fragment}, ${before}, ${after})]`; + }, +}; +var Predicates = { + at(fragment, value) { + return `[${OPERATOR.at}(${fragment}, ${encode(value)})]`; + }, + not(fragment, value) { + return `[${OPERATOR.not}(${fragment}, ${encode(value)})]`; + }, + missing(fragment) { + return `[${OPERATOR.missing}(${fragment})]`; + }, + has(fragment) { + return `[${OPERATOR.has}(${fragment})]`; + }, + any(fragment, values) { + return `[${OPERATOR.any}(${fragment}, ${encode(values)})]`; + }, + in(fragment, values) { + return `[${OPERATOR.in}(${fragment}, ${encode(values)})]`; + }, + fulltext(fragment, value) { + return `[${OPERATOR.fulltext}(${fragment}, ${encode(value)})]`; + }, + similar(documentId, maxResults) { + return `[${OPERATOR.similar}("${documentId}", ${maxResults})]`; + }, + date, + dateBefore: date.before, + dateAfter: date.after, + dateBetween: date.between, + dayOfMonth: date.dayOfMonth, + dayOfMonthAfter: date.dayOfMonthAfter, + dayOfMonthBefore: date.dayOfMonthBefore, + dayOfWeek: date.dayOfWeek, + dayOfWeekAfter: date.dayOfWeekAfter, + dayOfWeekBefore: date.dayOfWeekBefore, + month: date.month, + monthBefore: date.monthBefore, + monthAfter: date.monthAfter, + year: date.year, + hour: date.hour, + hourBefore: date.hourBefore, + hourAfter: date.hourAfter, + number, + gt: number.gt, + lt: number.lt, + inRange: number.inRange, + near: geopoint.near, + geopoint, +}; + +// Some portions of code from https://github.com/jshttp/cookie +var decode = decodeURIComponent; +function tryDecode(str, decode) { + try { + return decode(str); + } + catch (e) { + return str; + } +} +function parse(str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string'); + } + var obj = {}; + var opt = options || {}; + var pairs = str.split(/; */); + var dec = opt.decode || decode; + pairs.forEach(function (pair) { + var eq_idx = pair.indexOf('='); + // skip things that don't look like key=value + if (eq_idx < 0) { + return; + } + var key = pair.substr(0, eq_idx).trim(); + var val = pair.substr(++eq_idx, pair.length).trim(); + // quoted values + if ('"' == val[0]) { + val = val.slice(1, -1); + } + // only assign once + if (undefined == obj[key]) { + obj[key] = tryDecode(val, dec); + } + }); + return obj; +} +var Cookies = { parse }; + +const PREVIEW_COOKIE = 'io.prismic.preview'; +const EXPERIMENT_COOKIE = 'io.prismic.experiment'; +class ResolvedApi { + constructor(data, httpClient, options) { + this.data = data; + this.masterRef = data.refs.filter(ref => ref.isMasterRef)[0]; + this.experiments = new Experiments(data.experiments); + this.bookmarks = data.bookmarks; + this.httpClient = httpClient; + this.options = options; + this.refs = data.refs; + this.tags = data.tags; + this.types = data.types; + } + /** + * Returns a useable form from its id, as described in the RESTful description of the API. + * For instance: api.form("everything") works on every repository (as "everything" exists by default) + * You can then chain the calls: api.form("everything").query('[[:d = at(document.id, "UkL0gMuvzYUANCpf")]]').ref(ref).submit() + */ + form(formId) { + const form = this.data.forms[formId]; + if (form) { + return new SearchForm(form, this.httpClient); + } + return null; + } + everything() { + const f = this.form('everything'); + if (!f) + throw new Error('Missing everything form'); + return f; + } + /** + * The ID of the master ref on this prismic.io API. + * Do not use like this: searchForm.ref(api.master()). + * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page. + */ + master() { + return this.masterRef.ref; + } + /** + * Returns the ref ID for a given ref's label. + * Do not use like this: searchForm.ref(api.ref("Future release label")). + * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page. + */ + ref(label) { + const ref = this.data.refs.filter(ref => ref.label === label)[0]; + return ref ? ref.ref : null; + } + currentExperiment() { + return this.experiments.current(); + } + /** + * Query the repository + */ + query(q, optionsOrCallback, cb = () => { }) { + const { options, callback } = typeof optionsOrCallback === 'function' + ? { options: {}, callback: optionsOrCallback } + : { options: optionsOrCallback || {}, callback: cb }; + let form = this.everything(); + for (const key in options) { + form = form.set(key, options[key]); + } + if (!options.ref) { + // Look in cookies if we have a ref (preview or experiment) + let cookieString = ''; + if (this.options.req) { // NodeJS + cookieString = this.options.req.headers['cookie'] || ''; + } + else if (typeof window !== 'undefined' && window.document) { // Browser + cookieString = window.document.cookie || ''; + } + const cookies = Cookies.parse(cookieString); + const previewRef = cookies[PREVIEW_COOKIE]; + const experimentRef = this.experiments.refFromCookie(cookies[EXPERIMENT_COOKIE]); + form = form.ref(previewRef || experimentRef || this.masterRef.ref); + } + if (q) { + form.query(q); + } + return form.submit(callback); + } + /** + * Retrieve the document returned by the given query + * @param {string|array|Predicate} the query + * @param {object} additional parameters. In NodeJS, pass the request as 'req'. + * @param {function} callback(err, doc) + */ + queryFirst(q, optionsOrCallback, cb) { + const { options, callback } = typeof optionsOrCallback === 'function' + ? { options: {}, callback: optionsOrCallback } + : { options: optionsOrCallback || {}, callback: cb || (() => { }) }; + options.page = 1; + options.pageSize = 1; + return this.query(q, options).then((response) => { + const document = response && response.results && response.results[0]; + callback(null, document); + return document; + }).catch((error) => { + callback(error); + throw error; + }); + } + /** + * Retrieve the document with the given id + */ + getByID(id, maybeOptions, cb) { + const options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.queryFirst(Predicates.at('document.id', id), options, cb); + } + /** + * Retrieve multiple documents from an array of id + */ + getByIDs(ids, maybeOptions, cb) { + const options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.query(Predicates.in('document.id', ids), options, cb); + } + /** + * Retrieve the document with the given uid + */ + getByUID(type, uid, maybeOptions, cb) { + const options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.queryFirst(Predicates.at(`my.${type}.uid`, uid), options, cb); + } + /** + * Retrieve the singleton document with the given type + */ + getSingle(type, maybeOptions, cb) { + const options = maybeOptions || {}; + return this.queryFirst(Predicates.at('document.type', type), options, cb); + } + /** + * Retrieve the document with the given bookmark + */ + getBookmark(bookmark, maybeOptions, cb) { + const id = this.data.bookmarks[bookmark]; + if (id) { + return this.getByID(id, maybeOptions, cb); + } + else { + return Promise.reject('Error retrieving bookmarked id'); + } + } + previewSession(token, linkResolver, defaultUrl, cb) { + return this.httpClient.request(token).then((result) => { + if (!result.mainDocument) { + cb && cb(null, defaultUrl); + return Promise.resolve(defaultUrl); + } + else { + return this.getByID(result.mainDocument, { ref: token }).then((document) => { + if (!document) { + cb && cb(null, defaultUrl); + return defaultUrl; + } + else { + const url = linkResolver(document); + cb && cb(null, url); + return url; + } + }); + } + }).catch((error) => { + cb && cb(error); + throw error; + }); + } +} + +class Variation$1 { + constructor(data) { + this.data = {}; + this.data = data; + } + id() { + return this.data.id; + } + ref() { + return this.data.ref; + } + label() { + return this.data.label; + } +} +class Experiment$1 { + constructor(data) { + this.data = {}; + this.data = data; + this.variations = (data.variations || []).map((v) => { + return new Variation$1(v); + }); + } + id() { + return this.data.id; + } + googleId() { + return this.data.googleId; + } + name() { + return this.data.name; + } +} +class Experiments$1 { + constructor(data) { + if (data) { + this.drafts = (data.drafts || []).map((exp) => { + return new Experiment$1(exp); + }); + this.running = (data.running || []).map((exp) => { + return new Experiment$1(exp); + }); + } + } + current() { + if (this.running.length > 0) { + return this.running[0]; + } + else { + return null; + } + } + refFromCookie(cookie) { + if (!cookie || cookie.trim() === '') + return null; + const splitted = cookie.trim().split(' '); + if (splitted.length < 2) + return null; + const expId = splitted[0]; + const varIndex = parseInt(splitted[1], 10); + const exp = this.running.filter((exp) => { + return exp.googleId() === expId && exp.variations.length > varIndex; + })[0]; + return exp ? exp.variations[varIndex].ref() : null; + } +} + +/** +* A doubly linked list-based Least Recently Used (LRU) cache. Will keep most +* recently used items while discarding least recently used items when its limit +* is reached. +* +* Licensed under MIT. Copyright (c) 2010 Rasmus Andersson +* Typescript-ified by Oleksandr Nikitin +* +* Illustration of the design: +* +* entry entry entry entry +* ______ ______ ______ ______ +* | head |.newer => | |.newer => | |.newer => | tail | +* | A | | B | | C | | D | +* |______| <= older.|______| <= older.|______| <= older.|______| +* +* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added +*/ +function MakeLRUCache(limit) { + return new LRUCache(limit); +} +function LRUCache(limit) { + // Current size of the cache. (Read-only). + this.size = 0; + // Maximum number of items this cache can hold. + this.limit = limit; + this._keymap = {}; +} +/** + * Put into the cache associated with . Returns the entry which was + * removed to make room for the new entry. Otherwise undefined is returned + * (i.e. if there was enough room already). + */ +LRUCache.prototype.put = function (key, value) { + var entry = { key: key, value: value }; + // Note: No protection agains replacing, and thus orphan entries. By design. + this._keymap[key] = entry; + if (this.tail) { + // link previous tail to the new tail (entry) + this.tail.newer = entry; + entry.older = this.tail; + } + else { + // we're first in -- yay + this.head = entry; + } + // add new entry to the end of the linked list -- it's now the freshest entry. + this.tail = entry; + if (this.size === this.limit) { + // we hit the limit -- remove the head + return this.shift(); + } + else { + // increase the size counter + this.size++; + } +}; +/** + * Purge the least recently used (oldest) entry from the cache. Returns the + * removed entry or undefined if the cache was empty. + * + * If you need to perform any form of finalization of purged items, this is a + * good place to do it. Simply override/replace this function: + * + * var c = new LRUCache(123); + * c.shift = function() { + * var entry = LRUCache.prototype.shift.call(this); + * doSomethingWith(entry); + * return entry; + * } + */ +LRUCache.prototype.shift = function () { + // todo: handle special case when limit == 1 + var entry = this.head; + if (entry) { + if (this.head.newer) { + this.head = this.head.newer; + this.head.older = undefined; + } + else { + this.head = undefined; + } + // Remove last strong reference to and remove links from the purged + // entry being returned: + entry.newer = entry.older = undefined; + // delete is slow, but we need to do this to avoid uncontrollable growth: + delete this._keymap[entry.key]; + } + console.log('purging ', entry.key); + return entry; +}; +/** + * Get and register recent use of . Returns the value associated with + * or undefined if not in cache. + */ +LRUCache.prototype.get = function (key, returnEntry) { + // First, find our cache entry + var entry = this._keymap[key]; + if (entry === undefined) + return; // Not cached. Sorry. + // As was found in the cache, register it as being requested recently + if (entry === this.tail) { + // Already the most recently used entry, so no need to update the list + return returnEntry ? entry : entry.value; + } + // HEAD--------------TAIL + // <.older .newer> + // <--- add direction -- + // A B C E + if (entry.newer) { + if (entry === this.head) + this.head = entry.newer; + entry.newer.older = entry.older; // C <-- E. + } + if (entry.older) + entry.older.newer = entry.newer; // C. --> E + entry.newer = undefined; // D --x + entry.older = this.tail; // D. --> E + if (this.tail) + this.tail.newer = entry; // E. <-- D + this.tail = entry; + return returnEntry ? entry : entry.value; +}; +// ---------------------------------------------------------------------------- +// Following code is optional and can be removed without breaking the core +// functionality. +/** + * Check if is in the cache without registering recent use. Feasible if + * you do not want to chage the state of the cache, but only "peek" at it. + * Returns the entry associated with if found, or undefined if not found. + */ +LRUCache.prototype.find = function (key) { + return this._keymap[key]; +}; +/** + * Update the value of entry with . Returns the old value, or undefined if + * entry was not in the cache. + */ +LRUCache.prototype.set = function (key, value) { + var oldvalue; + var entry = this.get(key, true); + if (entry) { + oldvalue = entry.value; + entry.value = value; + } + else { + oldvalue = this.put(key, value); + if (oldvalue) + oldvalue = oldvalue.value; + } + return oldvalue; +}; +/** + * Remove entry from cache and return its value. Returns undefined if not + * found. + */ +LRUCache.prototype.remove = function (key) { + var entry = this._keymap[key]; + if (!entry) + return; + delete this._keymap[entry.key]; // need to do delete unfortunately + if (entry.newer && entry.older) { + // relink the older entry with the newer entry + entry.older.newer = entry.newer; + entry.newer.older = entry.older; + } + else if (entry.newer) { + // remove the link to us + entry.newer.older = undefined; + // link the newer entry to head + this.head = entry.newer; + } + else if (entry.older) { + // remove the link to us + entry.older.newer = undefined; + // link the newer entry to head + this.tail = entry.older; + } + else { // if(entry.older === undefined && entry.newer === undefined) { + this.head = this.tail = undefined; + } + this.size--; + return entry.value; +}; +/** Removes all entries */ +LRUCache.prototype.removeAll = function () { + // This should be safe, as we never expose strong refrences to the outside + this.head = this.tail = undefined; + this.size = 0; + this._keymap = {}; +}; +/** + * Return an array containing all keys of entries stored in the cache object, in + * arbitrary order. + */ +if (typeof Object.keys === 'function') { + LRUCache.prototype.keys = function () { return Object.keys(this._keymap); }; +} +else { + LRUCache.prototype.keys = function () { + var keys = []; + for (var k in this._keymap) + keys.push(k); + return keys; + }; +} +/** + * Call `fun` for each entry. Starting with the newest entry if `desc` is a true + * value, otherwise starts with the oldest (head) enrty and moves towards the + * tail. + * + * `fun` is called with 3 arguments in the context `context`: + * `fun.call(context, Object key, Object value, LRUCache self)` + */ +LRUCache.prototype.forEach = function (fun, context, desc) { + var entry; + if (context === true) { + desc = true; + context = undefined; + } + else if (typeof context !== 'object') + context = this; + if (desc) { + entry = this.tail; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.older; + } + } + else { + entry = this.head; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.newer; + } + } +}; +/** Returns a JSON (array) representation */ +//LRUCache.prototype.toJSON = function () { +// var s: IEntry[] = [], entry = this.head; +// while (entry) { +// s.push({ key: entry.key.toJSON(), value: entry.value.toJSON() }); +// entry = entry.newer; +// } +// return s; +//}; +/** Returns a String representation */ +LRUCache.prototype.toString = function () { + var s = '', entry = this.head; + while (entry) { + s += String(entry.key) + ':' + entry.value; + entry = entry.newer; + if (entry) + s += ' < '; + } + return s; +}; + +class DefaultApiCache { + constructor(limit = 1000) { + this.lru = MakeLRUCache(limit); + } + isExpired(key) { + const value = this.lru.get(key, false); + if (value) { + return value.expiredIn !== 0 && value.expiredIn < Date.now(); + } + else { + return false; + } + } + get(key, cb) { + const value = this.lru.get(key, false); + if (value && !this.isExpired(key)) { + cb(null, value.data); + } + else { + cb && cb(null); + } + } + set(key, value, ttl, cb) { + this.lru.remove(key); + this.lru.put(key, { + data: value, + expiredIn: ttl ? (Date.now() + (ttl * 1000)) : 0, + }); + cb && cb(null); + } + remove(key, cb) { + this.lru.remove(key); + cb && cb(null); + } + clear(cb) { + this.lru.removeAll(); + cb && cb(null); + } +} + +function createCommonjsModule(fn, module) { + return module = { exports: {} }, fn(module, module.exports), module.exports; +} + +var browser = createCommonjsModule(function (module, exports) { + +module.exports = exports = self.fetch; + +// Needed for TypeScript and Webpack. +exports.default = self.fetch.bind(self); + +exports.Headers = self.Headers; +exports.Request = self.Request; +exports.Response = self.Response; +}); +var browser_1 = browser.Headers; +var browser_2 = browser.Request; +var browser_3 = browser.Response; + +// In the browser, node-fetch exports self.fetch: +// Number of maximum simultaneous connections to the prismic server +const MAX_CONNECTIONS = 20; +// Number of requests currently running (capped by MAX_CONNECTIONS) +let running = 0; +// Requests in queue +const queue = []; +function fetchRequest(url, options, callback) { + const fetchOptions = { + headers: { + Accept: 'application/json', + }, + }; + if (options && options.proxyAgent) { + fetchOptions.agent = options.proxyAgent; + } + browser(url, fetchOptions).then((xhr) => { + if (~~(xhr.status / 100 !== 2)) { + /** + * @description + * drain the xhr before throwing an error to prevent memory leaks + * @link https://github.com/bitinn/node-fetch/issues/83 + */ + return xhr.text().then(() => { + const e = new Error(`Unexpected status code [${xhr.status}] on URL ${url}`); + e.status = xhr.status; + throw e; + }); + } + else { + return xhr.json().then((result) => { + const cacheControl = xhr.headers.get('cache-control'); + const parsedCacheControl = cacheControl ? /max-age=(\d+)/.exec(cacheControl) : null; + const ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined; + callback(null, result, xhr, ttl); + }); + } + }).catch(callback); +} +function processQueue(options) { + if (queue.length > 0 && running < MAX_CONNECTIONS) { + running++; + const req = queue.shift(); + if (req) { + fetchRequest(req.url, options, (error, result, xhr, ttl) => { + running--; + req.callback(error, result, xhr, ttl); + processQueue(options); + }); + } + } +} +class DefaultRequestHandler { + constructor(options) { + this.options = options || {}; + } + request(url, callback) { + queue.push({ url, callback }); + processQueue(this.options); + } +} + +class HttpClient { + constructor(requestHandler, cache, proxyAgent) { + this.requestHandler = requestHandler || new DefaultRequestHandler({ proxyAgent }); + this.cache = cache || new DefaultApiCache(); + } + request(url, callback) { + return new Promise((resolve, reject) => { + this.requestHandler.request(url, (err, result, xhr, ttl) => { + if (err) { + reject(err); + callback && callback(err, null, xhr, ttl); + } + else if (result) { + resolve(result); + callback && callback(null, result, xhr, ttl); + } + }); + }); + } + /** + * Fetch a URL corresponding to a query, and parse the response as a Response object + */ + cachedRequest(url, maybeOptions) { + const options = maybeOptions || {}; + const run = (cb) => { + const cacheKey = options.cacheKey || url; + this.cache.get(cacheKey, (cacheGetError, cacheGetValue) => { + if (cacheGetError || cacheGetValue) { + cb(cacheGetError, cacheGetValue); + } + else { + this.request(url, (fetchError, fetchValue, xhr, ttlReq) => { + if (fetchError) { + cb(fetchError, null); + } + else { + const ttl = ttlReq || options.ttl; + if (ttl) { + this.cache.set(cacheKey, fetchValue, ttl, cb); + } + cb(null, fetchValue); + } + }); + } + }); + }; + return new Promise((resolve, reject) => { + run((err, value) => { + if (err) + reject(err); + if (value) + resolve(value); + }); + }); + } +} + +class Api { + constructor(url, options) { + this.options = options || {}; + this.url = url; + if (this.options.accessToken) { + const accessTokenParam = `access_token=${this.options.accessToken}`; + this.url += (url.indexOf('?') > -1 ? '&' : '?') + accessTokenParam; + } + this.apiDataTTL = this.options.apiDataTTL || 5; + this.httpClient = new HttpClient(this.options.requestHandler, this.options.apiCache, this.options.proxyAgent); + } + /** + * Fetches data used to construct the api client, from cache if it's + * present, otherwise from calling the prismic api endpoint (which is + * then cached). + */ + get(cb) { + return this.httpClient.cachedRequest(this.url, { ttl: this.apiDataTTL }).then((data) => { + const resolvedApi = new ResolvedApi(data, this.httpClient, this.options); + cb && cb(null, resolvedApi); + return resolvedApi; + }).catch((error) => { + cb && cb(error); + throw error; + }); + } +} + +class DefaultClient { + constructor(url, options) { + this.api = new Api(url, options); + } + getApi() { + return this.api.get(); + } + everything() { + return this.form('everything'); + } + form(formId) { + return new LazySearchForm(formId, this.api); + } + query(q, optionsOrCallback, cb) { + return this.getApi().then(api => api.query(q, optionsOrCallback, cb)); + } + queryFirst(q, optionsOrCallback, cb) { + return this.getApi().then(api => api.queryFirst(q, optionsOrCallback, cb)); + } + getByID(id, options, cb) { + return this.getApi().then(api => api.getByID(id, options, cb)); + } + getByIDs(ids, options, cb) { + return this.getApi().then(api => api.getByIDs(ids, options, cb)); + } + getByUID(type, uid, options, cb) { + return this.getApi().then(api => api.getByUID(type, uid, options, cb)); + } + getSingle(type, options, cb) { + return this.getApi().then(api => api.getSingle(type, options, cb)); + } + getBookmark(bookmark, options, cb) { + return this.getApi().then(api => api.getBookmark(bookmark, options, cb)); + } + previewSession(token, linkResolver, defaultUrl, cb) { + return this.getApi().then(api => api.previewSession(token, linkResolver, defaultUrl, cb)); + } + static getApi(url, options) { + const api = new Api(url, options); + return api.get(); + } +} + +function client(url, options) { + return new DefaultClient(url, options); +} +function getApi(url, options) { + return DefaultClient.getApi(url, options); +} +function api(url, options) { + return getApi(url, options); +} + +export { EXPERIMENT_COOKIE as experimentCookie, PREVIEW_COOKIE as previewCookie, Predicates, Experiments$1 as Experiments, Api, client, getApi, api }; +//# sourceMappingURL=prismic-javascript.browser.esm.js.map diff --git a/dist/prismic-javascript.browser.esm.js.map b/dist/prismic-javascript.browser.esm.js.map new file mode 100644 index 00000000..67833497 --- /dev/null +++ b/dist/prismic-javascript.browser.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prismic-javascript.browser.esm.js","sources":["../src/experiments.ts","../src/form.ts","../src/Predicates.ts","../src/Cookies.ts","../src/ResolvedApi.ts","../src/Experiments.ts","../src/lru.ts","../src/cache.ts","../node_modules/node-fetch/browser.js","../src/request.ts","../src/HttpClient.ts","../src/Api.ts","../src/client.ts","../src/index.ts"],"sourcesContent":["export class Variation {\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n }\n\n id(): string {\n return this.data.id;\n }\n\n ref(): string {\n return this.data.ref;\n }\n\n label(): string {\n return this.data.label;\n }\n}\n\nexport class Experiment {\n variations: Variation[];\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n this.variations = (data.variations || []).map((v: any) => {\n return new Variation(v);\n });\n }\n\n id(): string {\n return this.data.id;\n }\n\n googleId(): string {\n return this.data.googleId;\n }\n\n name(): string {\n return this.data.name;\n }\n}\n\nexport class Experiments {\n drafts: Experiment[];\n running: Experiment[];\n\n constructor(data: any) {\n if (data) {\n this.drafts = (data.drafts || []).map((exp: any) => {\n return new Experiment(exp);\n });\n this.running = (data.running || []).map((exp: any) => {\n return new Experiment(exp);\n });\n }\n }\n\n current(): Experiment | null {\n if (this.running.length > 0) {\n return this.running[0];\n } else {\n return null;\n }\n }\n refFromCookie(cookie: string): string | null {\n if (!cookie || cookie.trim() === '') return null;\n const splitted = cookie.trim().split(' ');\n if (splitted.length < 2) return null;\n const expId = splitted[0];\n const varIndex = parseInt(splitted[1], 10);\n const exp = this.running.filter((exp) => {\n return exp.googleId() === expId && exp.variations.length > varIndex;\n })[0];\n return exp ? exp.variations[varIndex].ref() : null;\n }\n}\n","import Api from './Api';\nimport ResolvedApi from './ResolvedApi';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport HttpClient from './HttpClient';\nimport { RequestCallback } from './request';\n\nexport type Fields = { [key: string]: any };\n\nexport interface Form {\n fields: Fields;\n action: string;\n name: string;\n rel: string;\n form_method: string;\n enctype: string;\n}\n\nexport class LazySearchForm {\n id: string;\n fields: Fields;\n api: Api;\n\n constructor(id: string, api: Api) {\n this.id = id;\n this.api = api;\n this.fields = {};\n }\n\n set(key: string, value: any): LazySearchForm {\n this.fields[key] = value;\n return this;\n }\n\n ref(ref: string): LazySearchForm {\n return this.set('ref', ref);\n }\n\n query(query: string | string[]): LazySearchForm {\n return this.set('q', query);\n }\n\n pageSize(size: number): LazySearchForm {\n return this.set('pageSize', size);\n }\n\n fetch(fields: string | string[]): LazySearchForm {\n return this.set('fetch', fields);\n }\n\n fetchLinks(fields: string | string[]): LazySearchForm {\n return this.set('fetchLinks', fields);\n }\n\n lang(langCode: string): LazySearchForm {\n return this.set('lang', langCode);\n }\n\n page(p: number): LazySearchForm {\n return this.set('page', p);\n }\n\n after(documentId: string): LazySearchForm {\n return this.set('after', documentId);\n }\n\n orderings(orderings?: string[]): LazySearchForm {\n return this.set('orderings', orderings);\n }\n\n url(): Promise {\n return this.api.get().then((api) => {\n return LazySearchForm.toSearchForm(this, api).url();\n });\n }\n\n submit(cb: RequestCallback): Promise {\n return this.api.get().then((api) => {\n return LazySearchForm.toSearchForm(this, api).submit(cb);\n });\n }\n\n static toSearchForm(lazyForm: LazySearchForm, api: ResolvedApi): SearchForm {\n const form = api.form(lazyForm.id);\n if (form) {\n return Object.keys(lazyForm.fields).reduce((form, fieldKey) => {\n const fieldValue = lazyForm.fields[fieldKey];\n if (fieldKey === 'q') {\n return form.query(fieldValue);\n } else if (fieldKey === 'pageSize') {\n return form.pageSize(fieldValue);\n } else if (fieldKey === 'fetch') {\n return form.fetch(fieldValue);\n } else if (fieldKey === 'fetchLinks') {\n return form.fetchLinks(fieldValue);\n } else if (fieldKey === 'lang') {\n return form.lang(fieldValue);\n } else if (fieldKey === 'page') {\n return form.page(fieldValue);\n } else if (fieldKey === 'after') {\n return form.after(fieldValue);\n } else if (fieldKey === 'orderings') {\n return form.orderings(fieldValue);\n } else {\n return form.set(fieldKey, fieldValue);\n }\n }, form);\n } else {\n throw new Error(`Unable to access to form ${lazyForm.id}`);\n }\n }\n}\n\nexport class SearchForm {\n httpClient: HttpClient;\n form: Form;\n data: any;\n\n constructor(form: Form, httpClient: HttpClient) {\n this.httpClient = httpClient;\n this.form = form;\n\n this.data = {};\n for (const field in form.fields) {\n if (form.fields[field]['default']) {\n this.data[field] = [form.fields[field]['default']];\n }\n }\n }\n\n set(field: string, value: any): SearchForm {\n const fieldDesc = this.form.fields[field];\n if (!fieldDesc) throw new Error('Unknown field ' + field);\n const checkedValue = value === '' || value === undefined ? null : value;\n let values = this.data[field] || [];\n if (fieldDesc.multiple) {\n values = checkedValue ? values.concat([checkedValue]) : values;\n } else {\n values = checkedValue ? [checkedValue] : values;\n }\n this.data[field] = values;\n return this;\n }\n\n /**\n * Sets a ref to query on for this SearchForm. This is a mandatory\n * method to call before calling submit(), and api.form('everything').submit()\n * will not work.\n */\n ref(ref: string): SearchForm {\n return this.set('ref', ref);\n }\n\n /**\n * Sets a predicate-based query for this SearchForm. This is where you\n * paste what you compose in your prismic.io API browser.\n */\n query(query: string | string[]): SearchForm {\n if (typeof query === 'string') {\n return this.query([query]);\n } else if (query instanceof Array) {\n return this.set('q', `[${query.join('')}]`);\n } else {\n throw new Error(`Invalid query : ${query}`);\n }\n }\n\n /**\n * Sets a page size to query for this SearchForm. This is an optional method.\n *\n * @param {number} size - The page size\n * @returns {SearchForm} - The SearchForm itself\n */\n pageSize(size: number): SearchForm {\n return this.set('pageSize', size);\n }\n\n /**\n * Restrict the results document to the specified fields\n */\n fetch(fields: string | string[]): SearchForm {\n const strFields = fields instanceof Array ? fields.join(',') : fields;\n return this.set('fetch', strFields);\n }\n\n /**\n * Include the requested fields in the DocumentLink instances in the result\n */\n fetchLinks(fields: string | string[]): SearchForm {\n const strFields = fields instanceof Array ? fields.join(',') : fields;\n return this.set('fetchLinks', strFields);\n }\n\n /**\n * Sets the language to query for this SearchForm. This is an optional method.\n */\n lang(langCode: string): SearchForm {\n return this.set('lang', langCode);\n }\n\n /**\n * Sets the page number to query for this SearchForm. This is an optional method.\n */\n page(p: number): SearchForm {\n return this.set('page', p);\n }\n\n /**\n * Remove all the documents except for those after the specified document in the list. This is an optional method.\n */\n after(documentId: string): SearchForm {\n return this.set('after', documentId);\n }\n\n /**\n * Sets the orderings to query for this SearchForm. This is an optional method.\n */\n orderings(orderings ?: string[]): SearchForm {\n if (!orderings) {\n return this;\n } else {\n return this.set('orderings', `[${orderings.join(',')}]`);\n }\n }\n\n /**\n * Build the URL to query\n */\n url(): string {\n let url = this.form.action;\n if (this.data) {\n let sep = (url.indexOf('?') > -1 ? '&' : '?');\n for (const key in this.data) {\n if (this.data.hasOwnProperty(key)) {\n const values = this.data[key];\n if (values) {\n for (let i = 0; i < values.length; i++) {\n url += sep + key + '=' + encodeURIComponent(values[i]);\n sep = '&';\n }\n }\n }\n }\n }\n return url;\n }\n\n /**\n * Submits the query, and calls the callback function.\n */\n submit(cb: RequestCallback): Promise {\n return this.httpClient.cachedRequest(this.url()).then((response) => {\n cb && cb(null, response);\n return response;\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","const OPERATOR = {\n at: 'at',\n not: 'not',\n missing: 'missing',\n has: 'has',\n any: 'any',\n in: 'in',\n fulltext: 'fulltext',\n similar: 'similar',\n numberGt: 'number.gt',\n numberLt: 'number.lt',\n numberInRange: 'number.inRange',\n dateBefore: 'date.before',\n dateAfter: 'date.after',\n dateBetween: 'date.between',\n dateDayOfMonth: 'date.day-of-month',\n dateDayOfMonthAfter: 'date.day-of-month-after',\n dateDayOfMonthBefore: 'date.day-of-month-before',\n dateDayOfWeek: 'date.day-of-week',\n dateDayOfWeekAfter: 'date.day-of-week-after',\n dateDayOfWeekBefore: 'date.day-of-week-before',\n dateMonth: 'date.month',\n dateMonthBefore: 'date.month-before',\n dateMonthAfter: 'date.month-after',\n dateYear: 'date.year',\n dateHour: 'date.hour',\n dateHourBefore: 'date.hour-before',\n dateHourAfter: 'date.hour-after',\n GeopointNear: 'geopoint.near',\n};\n\ntype PredicateValue = string | number | Date;\n\nfunction encode(value: PredicateValue | PredicateValue[]): string {\n if (typeof value === 'string') {\n return `\"${value}\"`;\n } else if (typeof value === 'number') {\n return value.toString();\n } else if (value instanceof Date) {\n return value.getTime().toString();\n } else if (value instanceof Array) {\n return `[${value.map(v => encode(v)).join(',')}]`;\n } else {\n throw new Error(`Unable to encode ${value} of type ${typeof value}`);\n }\n}\n\nconst geopoint = {\n near(fragment: string, latitude: number, longitude: number, radius: number): string {\n return `[${OPERATOR.GeopointNear}(${fragment}, ${latitude}, ${longitude}, ${radius})]`;\n },\n};\n\nconst date = {\n\n before(fragment: string, before: PredicateValue): string {\n return `[${OPERATOR.dateBefore}(${fragment}, ${encode(before)})]`;\n },\n\n after(fragment: string, after: PredicateValue): string {\n return `[${OPERATOR.dateAfter}(${fragment}, ${encode(after)})]`;\n },\n\n between(fragment: string, before: PredicateValue, after: PredicateValue): string {\n return `[${OPERATOR.dateBetween}(${fragment}, ${encode(before)}, ${encode(after)})]`;\n },\n\n dayOfMonth(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonth}(${fragment}, ${day})]`;\n },\n\n dayOfMonthAfter(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonthAfter}(${fragment}, ${day})]`;\n },\n\n dayOfMonthBefore(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonthBefore}(${fragment}, ${day})]`;\n },\n\n dayOfWeek(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeek}(${fragment}, ${encode(day)})]`;\n },\n\n dayOfWeekAfter(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeekAfter}(${fragment}, ${encode(day)})]`;\n },\n\n dayOfWeekBefore(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeekBefore}(${fragment}, ${encode(day)})]`;\n },\n\n month(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonth}(${fragment}, ${encode(month)})]`;\n },\n\n monthBefore(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonthBefore}(${fragment}, ${encode(month)})]`;\n },\n\n monthAfter(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonthAfter}(${fragment}, ${encode(month)})]`;\n },\n\n year(fragment: string, year: number): string {\n return `[${OPERATOR.dateYear}(${fragment}, ${year})]`;\n },\n\n hour(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHour}(${fragment}, ${hour})]`;\n },\n\n hourBefore(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHourBefore}(${fragment}, ${hour})]`;\n },\n\n hourAfter(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHourAfter}(${fragment}, ${hour})]`;\n },\n};\n\nconst number = {\n gt(fragment: string, value: number): string {\n return `[${OPERATOR.numberGt}(${fragment}, ${value})]`;\n },\n\n lt(fragment: string, value: number): string {\n return `[${OPERATOR.numberLt}(${fragment}, ${value})]`;\n },\n\n inRange(fragment: string, before: number, after: number): string {\n return `[${OPERATOR.numberInRange}(${fragment}, ${before}, ${after})]`;\n },\n};\n\nexport default {\n at(fragment: string, value: PredicateValue | PredicateValue[]): string {\n return `[${OPERATOR.at}(${fragment}, ${encode(value)})]`;\n },\n \n not(fragment: string, value: PredicateValue | PredicateValue[]): string {\n return `[${OPERATOR.not}(${fragment}, ${encode(value)})]`;\n },\n\n missing(fragment: string): string {\n return `[${OPERATOR.missing}(${fragment})]`;\n },\n\n has(fragment: string): string {\n return `[${OPERATOR.has}(${fragment})]`;\n },\n\n any(fragment: string, values: PredicateValue[]): string {\n return `[${OPERATOR.any}(${fragment}, ${encode(values)})]`;\n },\n\n in(fragment: string, values: string[]): string {\n return `[${OPERATOR.in}(${fragment}, ${encode(values)})]`;\n },\n\n fulltext(fragment: string, value: string): string {\n return `[${OPERATOR.fulltext}(${fragment}, ${encode(value)})]`;\n },\n\n similar(documentId: string, maxResults: number): string {\n return `[${OPERATOR.similar}(\"${documentId}\", ${maxResults})]`;\n },\n\n date,\n\n dateBefore: date.before,\n\n dateAfter: date.after,\n\n dateBetween: date.between,\n\n dayOfMonth: date.dayOfMonth,\n\n dayOfMonthAfter: date.dayOfMonthAfter,\n\n dayOfMonthBefore: date.dayOfMonthBefore,\n\n dayOfWeek: date.dayOfWeek,\n\n dayOfWeekAfter: date.dayOfWeekAfter,\n\n dayOfWeekBefore: date.dayOfWeekBefore,\n\n month: date.month,\n\n monthBefore: date.monthBefore,\n\n monthAfter: date.monthAfter,\n\n year: date.year,\n\n hour: date.hour,\n\n hourBefore: date.hourBefore,\n\n hourAfter: date.hourAfter,\n\n number,\n\n gt: number.gt,\n\n lt: number.lt,\n\n inRange: number.inRange,\n\n near: geopoint.near,\n\n geopoint,\n};\n","export interface Cookie {\n [key: string]: string;\n value: string;\n}\n\n// Some portions of code from https://github.com/jshttp/cookie\n\nvar decode = decodeURIComponent;\n\nfunction tryDecode(str: string, decode: (str: string) => string) {\n try {\n return decode(str);\n } catch (e) {\n return str;\n }\n}\n\nfunction parse(str: string, options?: any) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string');\n }\n\n var obj = {};\n var opt = options || {};\n var pairs = str.split(/; */);\n var dec = opt.decode || decode;\n\n pairs.forEach(function(pair) {\n var eq_idx = pair.indexOf('=');\n\n // skip things that don't look like key=value\n if (eq_idx < 0) {\n return;\n }\n\n var key = pair.substr(0, eq_idx).trim();\n var val = pair.substr(++eq_idx, pair.length).trim();\n\n // quoted values\n if ('\"' == val[0]) {\n val = val.slice(1, -1);\n }\n\n // only assign once\n if (undefined == obj[key]) {\n obj[key] = tryDecode(val, dec);\n }\n });\n\n return obj;\n}\n\nexport default { parse };\n","import { Document } from \"./documents\";\nimport { RequestHandler, RequestCallback } from './request';\nimport { ApiCache } from './cache';\nimport { Experiment, Experiments } from './experiments';\nimport { SearchForm, Form } from './form';\nimport Predicates from './Predicates';\nimport Cookies from './Cookies';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport HttpClient from './HttpClient';\nimport { Client } from './client';\n\nexport const PREVIEW_COOKIE = 'io.prismic.preview';\nexport const EXPERIMENT_COOKIE = 'io.prismic.experiment';\n\nexport interface Ref {\n ref: string;\n label: string;\n isMasterRef: string;\n scheduledAt: string;\n id: string;\n}\n\nexport interface ApiData {\n refs: Ref[];\n bookmarks: { [key: string]: string };\n types: { [key: string]: string };\n tags: string[];\n forms: { [key: string]: Form };\n experiments: any;\n oauth_initiate: string;\n oauth_token: string;\n version: string;\n licence: string;\n}\n\nexport interface PreviewResponse {\n mainDocument?: string;\n}\n\nexport interface QueryOptions {\n [key: string]: string | number | string[];\n}\n\nexport interface ResolvedApiOptions {\n req?: any;\n}\n\nexport default class ResolvedApi implements Client {\n data: ApiData;\n masterRef: Ref;\n experiments: Experiments;\n options: ResolvedApiOptions;\n httpClient: HttpClient;\n bookmarks: { [key: string]: string };\n refs: Ref[];\n tags: string[];\n types: { [key: string]: string };\n\n constructor(data: ApiData, httpClient: HttpClient, options: ResolvedApiOptions) {\n this.data = data;\n this.masterRef = data.refs.filter(ref => ref.isMasterRef)[0];\n this.experiments = new Experiments(data.experiments);\n this.bookmarks = data.bookmarks;\n this.httpClient = httpClient;\n this.options = options;\n this.refs = data.refs;\n this.tags = data.tags;\n this.types = data.types;\n }\n\n /**\n * Returns a useable form from its id, as described in the RESTful description of the API.\n * For instance: api.form(\"everything\") works on every repository (as \"everything\" exists by default)\n * You can then chain the calls: api.form(\"everything\").query('[[:d = at(document.id, \"UkL0gMuvzYUANCpf\")]]').ref(ref).submit()\n */\n form(formId: string): SearchForm | null {\n const form = this.data.forms[formId];\n if (form) {\n return new SearchForm(form, this.httpClient);\n }\n return null;\n }\n\n everything(): SearchForm {\n const f = this.form('everything');\n if (!f) throw new Error('Missing everything form');\n return f;\n }\n\n /**\n * The ID of the master ref on this prismic.io API.\n * Do not use like this: searchForm.ref(api.master()).\n * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.\n */\n master(): string {\n return this.masterRef.ref;\n }\n\n /**\n * Returns the ref ID for a given ref's label.\n * Do not use like this: searchForm.ref(api.ref(\"Future release label\")).\n * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.\n */\n ref(label: string): string | null {\n const ref = this.data.refs.filter(ref => ref.label === label)[0];\n return ref ? ref.ref : null;\n }\n\n currentExperiment(): Experiment | null {\n return this.experiments.current();\n }\n\n /**\n * Query the repository\n */\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb: RequestCallback = () => {}): Promise {\n const { options, callback } = typeof optionsOrCallback === 'function'\n ? { options: {} as QueryOptions, callback: optionsOrCallback }\n : { options: optionsOrCallback || {}, callback: cb };\n\n let form = this.everything();\n for (const key in options) {\n form = form.set(key, options[key]);\n }\n if (!options.ref) {\n // Look in cookies if we have a ref (preview or experiment)\n let cookieString = '';\n if (this.options.req) { // NodeJS\n cookieString = this.options.req.headers['cookie'] || '';\n } else if (typeof window !== 'undefined' && window.document) { // Browser\n cookieString = window.document.cookie || '';\n }\n const cookies = Cookies.parse(cookieString);\n const previewRef = cookies[PREVIEW_COOKIE];\n const experimentRef = this.experiments.refFromCookie(cookies[EXPERIMENT_COOKIE]);\n form = form.ref(previewRef || experimentRef || this.masterRef.ref);\n }\n if (q) {\n form.query(q);\n }\n return form.submit(callback);\n }\n\n /**\n * Retrieve the document returned by the given query\n * @param {string|array|Predicate} the query\n * @param {object} additional parameters. In NodeJS, pass the request as 'req'.\n * @param {function} callback(err, doc)\n */\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n const { options, callback } = typeof optionsOrCallback === 'function'\n ? { options: {} as QueryOptions, callback: optionsOrCallback }\n : { options: optionsOrCallback || {}, callback: cb || (() => {}) };\n\n options.page = 1;\n options.pageSize = 1;\n\n return this.query(q, options).then((response) => {\n const document = response && response.results && response.results[0];\n callback(null, document);\n return document;\n }).catch((error) => {\n callback(error);\n throw error;\n });\n }\n\n /**\n * Retrieve the document with the given id\n */\n getByID(id: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.queryFirst(Predicates.at('document.id', id), options, cb);\n }\n\n /**\n * Retrieve multiple documents from an array of id\n */\n getByIDs(ids: string[], maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.query(Predicates.in('document.id', ids), options, cb);\n }\n\n /**\n * Retrieve the document with the given uid\n */\n getByUID(type: string, uid: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.queryFirst(Predicates.at(`my.${type}.uid`, uid), options, cb);\n }\n\n /**\n * Retrieve the singleton document with the given type\n */\n getSingle(type: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n return this.queryFirst(Predicates.at('document.type', type), options, cb);\n }\n\n /**\n * Retrieve the document with the given bookmark\n */\n getBookmark(bookmark: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const id = this.data.bookmarks[bookmark];\n if (id) {\n return this.getByID(id, maybeOptions, cb);\n } else {\n return Promise.reject('Error retrieving bookmarked id');\n }\n }\n\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise {\n return this.httpClient.request(token).then((result) => {\n if (!result.mainDocument) {\n cb && cb(null, defaultUrl);\n return Promise.resolve(defaultUrl);\n } else {\n return this.getByID(result.mainDocument, { ref: token }).then((document) => {\n if (!document) {\n cb && cb(null, defaultUrl);\n return defaultUrl;\n } else {\n const url = linkResolver(document);\n cb && cb(null, url);\n return url;\n }\n });\n }\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","export class Variation {\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n }\n\n id(): string {\n return this.data.id;\n }\n\n ref(): string {\n return this.data.ref;\n }\n\n label(): string {\n return this.data.label;\n }\n}\n\nexport class Experiment {\n variations: Variation[];\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n this.variations = (data.variations || []).map((v: any) => {\n return new Variation(v);\n });\n }\n\n id(): string {\n return this.data.id;\n }\n\n googleId(): string {\n return this.data.googleId;\n }\n\n name(): string {\n return this.data.name;\n }\n}\n\nexport class Experiments {\n drafts: Experiment[];\n running: Experiment[];\n\n constructor(data: any) {\n if (data) {\n this.drafts = (data.drafts || []).map((exp: any) => {\n return new Experiment(exp);\n });\n this.running = (data.running || []).map((exp: any) => {\n return new Experiment(exp);\n });\n }\n }\n\n current(): Experiment | null {\n if (this.running.length > 0) {\n return this.running[0];\n } else {\n return null;\n }\n }\n refFromCookie(cookie: string): string | null {\n if (!cookie || cookie.trim() === '') return null;\n const splitted = cookie.trim().split(' ');\n if (splitted.length < 2) return null;\n const expId = splitted[0];\n const varIndex = parseInt(splitted[1], 10);\n const exp = this.running.filter((exp) => {\n return exp.googleId() === expId && exp.variations.length > varIndex;\n })[0];\n return exp ? exp.variations[varIndex].ref() : null;\n }\n}\n","/**\n* A doubly linked list-based Least Recently Used (LRU) cache. Will keep most\n* recently used items while discarding least recently used items when its limit\n* is reached.\n*\n* Licensed under MIT. Copyright (c) 2010 Rasmus Andersson \n* Typescript-ified by Oleksandr Nikitin \n*\n* Illustration of the design:\n*\n* entry entry entry entry\n* ______ ______ ______ ______\n* | head |.newer => | |.newer => | |.newer => | tail |\n* | A | | B | | C | | D |\n* |______| <= older.|______| <= older.|______| <= older.|______|\n*\n* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added\n*/\n\nexport function MakeLRUCache(limit: number): ILRUCache {\n return new (LRUCache)(limit);\n}\n\nexport interface ILRUCache {\n put(key: string, value: any): void;\n get(key: string, Entry: boolean): any;\n remove(key: String): void;\n removeAll(): void;\n}\n\nfunction LRUCache(limit: number) {\n // Current size of the cache. (Read-only).\n this.size = 0;\n // Maximum number of items this cache can hold.\n this.limit = limit;\n this._keymap = {};\n}\n\ninterface IEntry {\n newer?: IEntry;\n older?: IEntry;\n key: string;\n value: any;\n}\n\n/**\n * Put into the cache associated with . Returns the entry which was\n * removed to make room for the new entry. Otherwise undefined is returned\n * (i.e. if there was enough room already).\n */\nLRUCache.prototype.put = function (key: string, value: any) {\n var entry: IEntry = { key: key, value: value };\n // Note: No protection agains replacing, and thus orphan entries. By design.\n this._keymap[key] = entry;\n if (this.tail) {\n // link previous tail to the new tail (entry)\n this.tail.newer = entry;\n entry.older = this.tail;\n } else {\n // we're first in -- yay\n this.head = entry;\n }\n // add new entry to the end of the linked list -- it's now the freshest entry.\n this.tail = entry;\n if (this.size === this.limit) {\n // we hit the limit -- remove the head\n return this.shift();\n } else {\n // increase the size counter\n this.size++;\n }\n};\n\n/**\n * Purge the least recently used (oldest) entry from the cache. Returns the\n * removed entry or undefined if the cache was empty.\n *\n * If you need to perform any form of finalization of purged items, this is a\n * good place to do it. Simply override/replace this function:\n *\n * var c = new LRUCache(123);\n * c.shift = function() {\n * var entry = LRUCache.prototype.shift.call(this);\n * doSomethingWith(entry);\n * return entry;\n * }\n */\nLRUCache.prototype.shift = function () {\n // todo: handle special case when limit == 1\n var entry = this.head;\n if (entry) {\n if (this.head.newer) {\n this.head = this.head.newer;\n this.head.older = undefined;\n } else {\n this.head = undefined;\n }\n // Remove last strong reference to and remove links from the purged\n // entry being returned:\n entry.newer = entry.older = undefined;\n // delete is slow, but we need to do this to avoid uncontrollable growth:\n delete this._keymap[entry.key];\n }\n console.log('purging ', entry.key);\n return entry;\n};\n\n/**\n * Get and register recent use of . Returns the value associated with \n * or undefined if not in cache.\n */\nLRUCache.prototype.get = function (key: string, returnEntry: boolean): any {\n // First, find our cache entry\n var entry = this._keymap[key];\n if (entry === undefined) return; // Not cached. Sorry.\n // As was found in the cache, register it as being requested recently\n if (entry === this.tail) {\n // Already the most recently used entry, so no need to update the list\n return returnEntry ? entry : entry.value;\n }\n // HEAD--------------TAIL\n // <.older .newer>\n // <--- add direction --\n // A B C E\n if (entry.newer) {\n if (entry === this.head)\n this.head = entry.newer;\n entry.newer.older = entry.older; // C <-- E.\n }\n if (entry.older)\n entry.older.newer = entry.newer; // C. --> E\n entry.newer = undefined; // D --x\n entry.older = this.tail; // D. --> E\n if (this.tail)\n this.tail.newer = entry; // E. <-- D\n this.tail = entry;\n return returnEntry ? entry : entry.value;\n};\n\n// ----------------------------------------------------------------------------\n// Following code is optional and can be removed without breaking the core\n// functionality.\n\n/**\n * Check if is in the cache without registering recent use. Feasible if\n * you do not want to chage the state of the cache, but only \"peek\" at it.\n * Returns the entry associated with if found, or undefined if not found.\n */\nLRUCache.prototype.find = function (key: string) {\n return this._keymap[key];\n};\n\n/**\n * Update the value of entry with . Returns the old value, or undefined if\n * entry was not in the cache.\n */\nLRUCache.prototype.set = function (key: string, value: any) {\n var oldvalue: any;\n var entry = this.get(key, true);\n if (entry) {\n oldvalue = entry.value;\n entry.value = value;\n } else {\n oldvalue = this.put(key, value);\n if (oldvalue) oldvalue = oldvalue.value;\n }\n return oldvalue;\n};\n\n/**\n * Remove entry from cache and return its value. Returns undefined if not\n * found.\n */\nLRUCache.prototype.remove = function (key: string) {\n var entry = this._keymap[key];\n if (!entry) return;\n delete this._keymap[entry.key]; // need to do delete unfortunately\n if (entry.newer && entry.older) {\n // relink the older entry with the newer entry\n entry.older.newer = entry.newer;\n entry.newer.older = entry.older;\n } else if (entry.newer) {\n // remove the link to us\n entry.newer.older = undefined;\n // link the newer entry to head\n this.head = entry.newer;\n } else if (entry.older) {\n // remove the link to us\n entry.older.newer = undefined;\n // link the newer entry to head\n this.tail = entry.older;\n } else {// if(entry.older === undefined && entry.newer === undefined) {\n this.head = this.tail = undefined;\n }\n\n this.size--;\n return entry.value;\n};\n\n/** Removes all entries */\nLRUCache.prototype.removeAll = function () {\n // This should be safe, as we never expose strong refrences to the outside\n this.head = this.tail = undefined;\n this.size = 0;\n this._keymap = {};\n};\n\n/**\n * Return an array containing all keys of entries stored in the cache object, in\n * arbitrary order.\n */\nif (typeof Object.keys === 'function') {\n LRUCache.prototype.keys = function () { return Object.keys(this._keymap); };\n} else {\n LRUCache.prototype.keys = function () {\n var keys: string[] = [];\n for (var k in this._keymap) keys.push(k);\n return keys;\n };\n}\n\n/**\n * Call `fun` for each entry. Starting with the newest entry if `desc` is a true\n * value, otherwise starts with the oldest (head) enrty and moves towards the\n * tail.\n *\n * `fun` is called with 3 arguments in the context `context`:\n * `fun.call(context, Object key, Object value, LRUCache self)`\n */\nLRUCache.prototype.forEach = function (fun: Function, context: any, desc: boolean) {\n var entry: IEntry | undefined;\n if (context === true) { desc = true; context = undefined; }\n else if (typeof context !== 'object') context = this;\n if (desc) {\n entry = this.tail;\n while (entry) {\n fun.call(context, entry.key, entry.value, this);\n entry = entry.older;\n }\n } else {\n entry = this.head;\n while (entry) {\n fun.call(context, entry.key, entry.value, this);\n entry = entry.newer;\n }\n }\n};\n\n/** Returns a JSON (array) representation */\n//LRUCache.prototype.toJSON = function () {\n// var s: IEntry[] = [], entry = this.head;\n// while (entry) {\n// s.push({ key: entry.key.toJSON(), value: entry.value.toJSON() });\n// entry = entry.newer;\n// }\n// return s;\n//};\n\n/** Returns a String representation */\nLRUCache.prototype.toString = function () {\n var s = '', entry = this.head;\n while (entry) {\n s += String(entry.key) + ':' + entry.value;\n entry = entry.newer;\n if (entry)\n s += ' < ';\n }\n return s;\n};\n\n// Export ourselves\n//if (typeof this === 'object') this.LRUCache = LRUCache;","import { ILRUCache, MakeLRUCache } from './lru';\n\nexport interface ApiCache {\n isExpired(key: String): boolean;\n get(key: string, cb: (error: Error | null, entry?: T) => void): void;\n set(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void;\n remove(key: string, cb?: (error: Error | null) => void): void;\n clear(cb?: (error: Error | null) => void): void;\n}\n\nexport class DefaultApiCache implements ApiCache {\n lru: ILRUCache;\n\n constructor(limit: number = 1000) {\n this.lru = MakeLRUCache(limit);\n }\n\n isExpired(key: string): boolean {\n const value = this.lru.get(key, false);\n if (value) {\n return value.expiredIn !== 0 && value.expiredIn < Date.now();\n } else {\n return false;\n }\n }\n\n get(key: string, cb: (error: Error | null, entry?: T) => void): void {\n const value = this.lru.get(key, false);\n if (value && !this.isExpired(key)) {\n cb(null, value.data);\n } else {\n cb && cb(null);\n }\n }\n\n set(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void {\n this.lru.remove(key);\n this.lru.put(key, {\n data: value,\n expiredIn: ttl ? (Date.now() + (ttl * 1000)) : 0,\n });\n cb && cb(null);\n }\n\n remove(key: string, cb?: (error: Error | null) => void): void {\n this.lru.remove(key);\n cb && cb(null);\n }\n\n clear(cb?: (error: Error | null) => void): void {\n this.lru.removeAll();\n cb && cb(null);\n }\n}\n","\"use strict\";\n\nmodule.exports = exports = self.fetch;\n\n// Needed for TypeScript and Webpack.\nexports.default = self.fetch.bind(self);\n\nexports.Headers = self.Headers;\nexports.Request = self.Request;\nexports.Response = self.Response;\n","// In the browser, node-fetch exports self.fetch:\n// https://github.com/bitinn/node-fetch/blob/master/browser.js\nimport fetches, { RequestInit } from 'node-fetch';\n\n// Number of maximum simultaneous connections to the prismic server\nconst MAX_CONNECTIONS: number = 20;\n// Number of requests currently running (capped by MAX_CONNECTIONS)\nlet running: number = 0;\n\ninterface Task {\n url: string;\n callback: RequestCallback;\n}\n\n// Requests in queue\nconst queue: Task[] = [];\n\ninterface NodeRequestInit extends RequestInit {\n agent?: any;\n}\n\nfunction fetchRequest(url: string, options: RequestHandlerOption, callback: RequestCallback): void {\n\n const fetchOptions = {\n headers: {\n Accept: 'application/json',\n },\n } as NodeRequestInit;\n\n if (options && options.proxyAgent) {\n fetchOptions.agent = options.proxyAgent;\n }\n\n fetches(url, fetchOptions).then((xhr) => {\n if (~~(xhr.status / 100 !== 2)) {\n /**\n * @description\n * drain the xhr before throwing an error to prevent memory leaks\n * @link https://github.com/bitinn/node-fetch/issues/83\n */\n return xhr.text().then(() => {\n const e: any = new Error(`Unexpected status code [${xhr.status}] on URL ${url}`);\n e.status = xhr.status;\n throw e;\n });\n } else {\n return xhr.json().then((result) => {\n const cacheControl = xhr.headers.get('cache-control');\n const parsedCacheControl = cacheControl ? /max-age=(\\d+)/.exec(cacheControl) : null;\n const ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined;\n callback(null, result, xhr, ttl);\n });\n }\n }).catch(callback);\n}\n\nfunction processQueue(options: RequestHandlerOption): void {\n if (queue.length > 0 && running < MAX_CONNECTIONS) {\n running++;\n\n const req = queue.shift();\n\n if (req) {\n\n fetchRequest(req.url, options, (error, result, xhr, ttl) => {\n running--;\n req.callback(error, result, xhr, ttl);\n processQueue(options);\n });\n }\n }\n}\n\nexport type RequestCallback = (error: Error | null, result?: T | null, xhr?: any, ttl?: number) => void;\n\nexport interface RequestHandlerOption {\n proxyAgent?: any;\n}\n\nexport interface RequestHandler {\n request(url: string, cb: RequestCallback): void;\n}\n\nexport class DefaultRequestHandler implements RequestHandler {\n\n options: RequestHandlerOption;\n\n constructor(options?: RequestHandlerOption) {\n this.options = options || {};\n }\n\n request(url: string, callback: RequestCallback): void {\n queue.push({ url, callback });\n processQueue(this.options);\n }\n}\n","import { ApiCache, DefaultApiCache } from './cache';\nimport { RequestHandler, DefaultRequestHandler, RequestCallback } from './request';\n\nexport interface HttpClientOptions {\n ttl?: number;\n cacheKey?: string;\n}\n\nexport default class HttpClient {\n\n private cache: ApiCache;\n private requestHandler: RequestHandler;\n\n constructor(requestHandler?: RequestHandler, cache?: ApiCache, proxyAgent?: any) {\n this.requestHandler = requestHandler || new DefaultRequestHandler({ proxyAgent });\n this.cache = cache || new DefaultApiCache();\n }\n\n request(url: string, callback?: RequestCallback): Promise {\n return new Promise((resolve, reject) => {\n this.requestHandler.request(url, (err, result, xhr, ttl) => {\n if (err) {\n reject(err);\n callback && callback(err, null, xhr, ttl);\n } else if (result) {\n resolve(result);\n callback && callback(null, result, xhr, ttl);\n }\n });\n });\n }\n\n /**\n * Fetch a URL corresponding to a query, and parse the response as a Response object\n */\n cachedRequest(url: string, maybeOptions?: HttpClientOptions): Promise {\n const options = maybeOptions || {};\n const run = (cb: RequestCallback) => {\n const cacheKey = options.cacheKey || url;\n this.cache.get(cacheKey, (cacheGetError, cacheGetValue) => {\n if (cacheGetError || cacheGetValue) {\n cb(cacheGetError, cacheGetValue);\n } else {\n this.request(url, (fetchError, fetchValue, xhr, ttlReq) => {\n if (fetchError) {\n cb(fetchError, null);\n } else {\n const ttl = ttlReq || options.ttl;\n if (ttl) {\n this.cache.set(cacheKey, fetchValue, ttl, cb);\n }\n cb(null, fetchValue);\n }\n });\n }\n });\n };\n\n return new Promise((resolve, reject) => {\n run((err, value) => {\n if (err) reject(err);\n if (value) resolve(value);\n });\n });\n }\n}\n","import Predicates from './Predicates';\nimport { RequestHandler, RequestCallback } from './request';\nimport { Document } from './documents';\nimport { ApiCache } from './cache';\nimport ResolvedApi, { ApiData } from './ResolvedApi';\nimport HttpClient from './HttpClient';\n\nexport interface ApiOptions {\n accessToken?: string;\n requestHandler?: RequestHandler;\n req?: any;\n apiCache?: ApiCache;\n apiDataTTL?: number;\n proxyAgent?: any;\n}\n\nexport default class Api {\n url: string;\n options: ApiOptions;\n apiDataTTL: number;\n httpClient: HttpClient;\n\n constructor(url: string, options?: ApiOptions) {\n this.options = options || {};\n this.url = url;\n if (this.options.accessToken) {\n const accessTokenParam = `access_token=${this.options.accessToken}`;\n this.url += (url.indexOf('?') > -1 ? '&' : '?') + accessTokenParam;\n }\n this.apiDataTTL = this.options.apiDataTTL || 5;\n this.httpClient = new HttpClient(\n this.options.requestHandler,\n this.options.apiCache,\n this.options.proxyAgent,\n );\n }\n\n /**\n * Fetches data used to construct the api client, from cache if it's\n * present, otherwise from calling the prismic api endpoint (which is\n * then cached).\n */\n get(cb?: RequestCallback): Promise {\n return this.httpClient.cachedRequest(this.url, { ttl: this.apiDataTTL }).then((data) => {\n const resolvedApi = new ResolvedApi(data, this.httpClient, this.options);\n cb && cb(null, resolvedApi);\n return resolvedApi;\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","import { Document } from \"./documents\";\nimport ResolvedApi, { QueryOptions, EXPERIMENT_COOKIE, PREVIEW_COOKIE } from './ResolvedApi';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport { SearchForm, LazySearchForm } from './form';\nimport { Experiment } from './experiments';\nimport { RequestHandler, RequestCallback } from './request';\nimport Api, { ApiOptions } from './Api';\n\nexport interface Client {\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise;\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb: RequestCallback): Promise;\n getByID(id: string, options: QueryOptions, cb: RequestCallback): Promise;\n getByIDs(ids: string[], options: QueryOptions, cb: RequestCallback): Promise;\n getByUID(type: string, uid: string, options: QueryOptions, cb: RequestCallback): Promise;\n getSingle(type: string, options: QueryOptions, cb: RequestCallback): Promise;\n getBookmark(bookmark: string, options: QueryOptions, cb: RequestCallback): Promise;\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise;\n}\n\nexport class DefaultClient implements Client {\n\n api: Api;\n resolvedApi: ResolvedApi;\n\n constructor(url: string, options?: ApiOptions) {\n this.api = new Api(url, options);\n }\n\n getApi(): Promise {\n return this.api.get();\n }\n\n everything(): LazySearchForm {\n return this.form('everything');\n }\n\n form(formId: string): LazySearchForm {\n return new LazySearchForm(formId, this.api);\n }\n\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.query(q, optionsOrCallback, cb));\n }\n\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.queryFirst(q, optionsOrCallback, cb));\n }\n\n getByID(id: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByID(id, options, cb));\n }\n\n getByIDs(ids: string[], options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByIDs(ids, options, cb));\n }\n\n getByUID(type: string, uid: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByUID(type, uid, options, cb));\n }\n\n getSingle(type: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getSingle(type, options, cb));\n }\n\n getBookmark(bookmark: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getBookmark(bookmark, options, cb));\n }\n\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.previewSession(token, linkResolver, defaultUrl, cb));\n }\n\n static getApi(url: string, options?: ApiOptions): Promise {\n const api = new Api(url, options);\n return api.get();\n }\n}\n","import ResolvedApi, { EXPERIMENT_COOKIE as experimentCookie, PREVIEW_COOKIE as previewCookie } from './ResolvedApi';\nimport Predicates from './Predicates';\nimport { Experiments } from './Experiments';\nimport Api, { ApiOptions } from './Api';\nimport { DefaultClient } from './client';\n\nexport {\n experimentCookie,\n previewCookie,\n Predicates,\n Experiments,\n Api\n};\n\nexport function client(url: string, options?: ApiOptions) {\n return new DefaultClient(url, options);\n}\n\nexport function getApi(url: string, options?: ApiOptions): Promise {\n return DefaultClient.getApi(url, options);\n}\n\nexport function api(url: string, options?: ApiOptions): Promise {\n return getApi(url, options);\n}"],"names":["Variation","Experiment","Experiments","fetches"],"mappings":"AAAO,MAAM,SAAS;IAGpB,YAAY,IAAS;QAFrB,SAAI,GAAQ,EAAE,CAAC;QAGb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;IAED,EAAE;QACA,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;KACrB;IAED,GAAG;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;KACtB;IAED,KAAK;QACH,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;KACxB;CACF;AAEM,MAAM,UAAU;IAIrB,YAAY,IAAS;QAFrB,SAAI,GAAQ,EAAE,CAAC;QAGb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,CAAM;YACnD,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;SACzB,CAAC,CAAC;KACJ;IAED,EAAE;QACA,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;KACrB;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;KAC3B;IAED,IAAI;QACF,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;KACvB;CACF;AAEM,MAAM,WAAW;IAItB,YAAY,IAAS;QACnB,IAAI,IAAI,EAAE;YACR,IAAI,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,MAAM,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,GAAQ;gBAC7C,OAAO,IAAI,UAAU,CAAC,GAAG,CAAC,CAAC;aAC5B,CAAC,CAAC;YACH,IAAI,C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.js new file mode 100644 index 00000000..7aff17b5 --- /dev/null +++ b/dist/prismic-javascript.browser.js @@ -0,0 +1,1197 @@ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : + typeof define === 'function' && define.amd ? define(['exports'], factory) : + (factory((global.PrismicJS = {}))); +}(this, (function (exports) { 'use strict'; + + var Variation = /** @class */ (function () { + function Variation(data) { + this.data = {}; + this.data = data; + } + Variation.prototype.id = function () { + return this.data.id; + }; + Variation.prototype.ref = function () { + return this.data.ref; + }; + Variation.prototype.label = function () { + return this.data.label; + }; + return Variation; + }()); + var Experiment = /** @class */ (function () { + function Experiment(data) { + this.data = {}; + this.data = data; + this.variations = (data.variations || []).map(function (v) { + return new Variation(v); + }); + } + Experiment.prototype.id = function () { + return this.data.id; + }; + Experiment.prototype.googleId = function () { + return this.data.googleId; + }; + Experiment.prototype.name = function () { + return this.data.name; + }; + return Experiment; + }()); + var Experiments = /** @class */ (function () { + function Experiments(data) { + if (data) { + this.drafts = (data.drafts || []).map(function (exp) { + return new Experiment(exp); + }); + this.running = (data.running || []).map(function (exp) { + return new Experiment(exp); + }); + } + } + Experiments.prototype.current = function () { + if (this.running.length > 0) { + return this.running[0]; + } + else { + return null; + } + }; + Experiments.prototype.refFromCookie = function (cookie) { + if (!cookie || cookie.trim() === '') + return null; + var splitted = cookie.trim().split(' '); + if (splitted.length < 2) + return null; + var expId = splitted[0]; + var varIndex = parseInt(splitted[1], 10); + var exp = this.running.filter(function (exp) { + return exp.googleId() === expId && exp.variations.length > varIndex; + })[0]; + return exp ? exp.variations[varIndex].ref() : null; + }; + return Experiments; + }()); + + var LazySearchForm = /** @class */ (function () { + function LazySearchForm(id, api) { + this.id = id; + this.api = api; + this.fields = {}; + } + LazySearchForm.prototype.set = function (key, value) { + this.fields[key] = value; + return this; + }; + LazySearchForm.prototype.ref = function (ref) { + return this.set('ref', ref); + }; + LazySearchForm.prototype.query = function (query) { + return this.set('q', query); + }; + LazySearchForm.prototype.pageSize = function (size) { + return this.set('pageSize', size); + }; + LazySearchForm.prototype.fetch = function (fields) { + console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.'); + return this.set('fetch', fields); + }; + LazySearchForm.prototype.fetchLinks = function (fields) { + console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.'); + return this.set('fetchLinks', fields); + }; + LazySearchForm.prototype.graphQuery = function (query) { + return this.set('graphQuery', query); + }; + LazySearchForm.prototype.lang = function (langCode) { + return this.set('lang', langCode); + }; + LazySearchForm.prototype.page = function (p) { + return this.set('page', p); + }; + LazySearchForm.prototype.after = function (documentId) { + return this.set('after', documentId); + }; + LazySearchForm.prototype.orderings = function (orderings) { + return this.set('orderings', orderings); + }; + LazySearchForm.prototype.url = function () { + var _this = this; + return this.api.get().then(function (api) { + return LazySearchForm.toSearchForm(_this, api).url(); + }); + }; + LazySearchForm.prototype.submit = function (cb) { + var _this = this; + return this.api.get().then(function (api) { + return LazySearchForm.toSearchForm(_this, api).submit(cb); + }); + }; + LazySearchForm.toSearchForm = function (lazyForm, api) { + var form = api.form(lazyForm.id); + if (form) { + return Object.keys(lazyForm.fields).reduce(function (form, fieldKey) { + var fieldValue = lazyForm.fields[fieldKey]; + if (fieldKey === 'q') { + return form.query(fieldValue); + } + else if (fieldKey === 'pageSize') { + return form.pageSize(fieldValue); + } + else if (fieldKey === 'fetch') { + return form.fetch(fieldValue); + } + else if (fieldKey === 'fetchLinks') { + return form.fetchLinks(fieldValue); + } + else if (fieldKey === 'graphQuery') { + return form.graphQuery(fieldValue); + } + else if (fieldKey === 'lang') { + return form.lang(fieldValue); + } + else if (fieldKey === 'page') { + return form.page(fieldValue); + } + else if (fieldKey === 'after') { + return form.after(fieldValue); + } + else if (fieldKey === 'orderings') { + return form.orderings(fieldValue); + } + else { + return form.set(fieldKey, fieldValue); + } + }, form); + } + else { + throw new Error("Unable to access to form " + lazyForm.id); + } + }; + return LazySearchForm; + }()); + var SearchForm = /** @class */ (function () { + function SearchForm(form, httpClient) { + this.httpClient = httpClient; + this.form = form; + this.data = {}; + for (var field in form.fields) { + if (form.fields[field]['default']) { + this.data[field] = [form.fields[field]['default']]; + } + } + } + SearchForm.prototype.set = function (field, value) { + var fieldDesc = this.form.fields[field]; + if (!fieldDesc) + throw new Error('Unknown field ' + field); + var checkedValue = value === '' || value === undefined ? null : value; + var values = this.data[field] || []; + if (fieldDesc.multiple) { + values = checkedValue ? values.concat([checkedValue]) : values; + } + else { + values = checkedValue ? [checkedValue] : values; + } + this.data[field] = values; + return this; + }; + /** + * Sets a ref to query on for this SearchForm. This is a mandatory + * method to call before calling submit(), and api.form('everything').submit() + * will not work. + */ + SearchForm.prototype.ref = function (ref) { + return this.set('ref', ref); + }; + /** + * Sets a predicate-based query for this SearchForm. This is where you + * paste what you compose in your prismic.io API browser. + */ + SearchForm.prototype.query = function (query) { + if (typeof query === 'string') { + return this.query([query]); + } + else if (Array.isArray(query)) { + return this.set('q', "[" + query.join('') + "]"); + } + else { + throw new Error("Invalid query : " + query); + } + }; + /** + * Sets a page size to query for this SearchForm. This is an optional method. + * + * @param {number} size - The page size + * @returns {SearchForm} - The SearchForm itself + */ + SearchForm.prototype.pageSize = function (size) { + return this.set('pageSize', size); + }; + /** + * Restrict the results document to the specified fields + */ + SearchForm.prototype.fetch = function (fields) { + console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.'); + var strFields = Array.isArray(fields) ? fields.join(',') : fields; + return this.set('fetch', strFields); + }; + /** + * Include the requested fields in the DocumentLink instances in the result + */ + SearchForm.prototype.fetchLinks = function (fields) { + console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.'); + var strFields = Array.isArray(fields) ? fields.join(',') : fields; + return this.set('fetchLinks', strFields); + }; + /** + * Sets the graphquery to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.graphQuery = function (query) { + return this.set('graphQuery', query); + }; + /** + * Sets the language to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.lang = function (langCode) { + return this.set('lang', langCode); + }; + /** + * Sets the page number to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.page = function (p) { + return this.set('page', p); + }; + /** + * Remove all the documents except for those after the specified document in the list. This is an optional method. + */ + SearchForm.prototype.after = function (documentId) { + return this.set('after', documentId); + }; + /** + * Sets the orderings to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.orderings = function (orderings) { + if (!orderings) { + return this; + } + else { + return this.set('orderings', "[" + orderings.join(',') + "]"); + } + }; + /** + * Build the URL to query + */ + SearchForm.prototype.url = function () { + var url = this.form.action; + if (this.data) { + var sep = (url.indexOf('?') > -1 ? '&' : '?'); + for (var key in this.data) { + if (this.data.hasOwnProperty(key)) { + var values = this.data[key]; + if (values) { + for (var i = 0; i < values.length; i++) { + url += sep + key + '=' + encodeURIComponent(values[i]); + sep = '&'; + } + } + } + } + } + return url; + }; + /** + * Submits the query, and calls the callback function. + */ + SearchForm.prototype.submit = function (cb) { + return this.httpClient.cachedRequest(this.url()).then(function (response) { + cb && cb(null, response); + return response; + }).catch(function (error) { + cb && cb(error); + throw error; + }); + }; + return SearchForm; + }()); + + var OPERATOR = { + at: 'at', + not: 'not', + missing: 'missing', + has: 'has', + any: 'any', + in: 'in', + fulltext: 'fulltext', + similar: 'similar', + numberGt: 'number.gt', + numberLt: 'number.lt', + numberInRange: 'number.inRange', + dateBefore: 'date.before', + dateAfter: 'date.after', + dateBetween: 'date.between', + dateDayOfMonth: 'date.day-of-month', + dateDayOfMonthAfter: 'date.day-of-month-after', + dateDayOfMonthBefore: 'date.day-of-month-before', + dateDayOfWeek: 'date.day-of-week', + dateDayOfWeekAfter: 'date.day-of-week-after', + dateDayOfWeekBefore: 'date.day-of-week-before', + dateMonth: 'date.month', + dateMonthBefore: 'date.month-before', + dateMonthAfter: 'date.month-after', + dateYear: 'date.year', + dateHour: 'date.hour', + dateHourBefore: 'date.hour-before', + dateHourAfter: 'date.hour-after', + GeopointNear: 'geopoint.near', + }; + function encode(value) { + if (typeof value === 'string') { + return "\"" + value + "\""; + } + else if (typeof value === 'number') { + return value.toString(); + } + else if (value instanceof Date) { + return value.getTime().toString(); + } + else if (Array.isArray(value)) { + return "[" + value.map(function (v) { return encode(v); }).join(',') + "]"; + } + else { + throw new Error("Unable to encode " + value + " of type " + typeof value); + } + } + var geopoint = { + near: function (fragment, latitude, longitude, radius) { + return "[" + OPERATOR.GeopointNear + "(" + fragment + ", " + latitude + ", " + longitude + ", " + radius + ")]"; + }, + }; + var date = { + before: function (fragment, before) { + return "[" + OPERATOR.dateBefore + "(" + fragment + ", " + encode(before) + ")]"; + }, + after: function (fragment, after) { + return "[" + OPERATOR.dateAfter + "(" + fragment + ", " + encode(after) + ")]"; + }, + between: function (fragment, before, after) { + return "[" + OPERATOR.dateBetween + "(" + fragment + ", " + encode(before) + ", " + encode(after) + ")]"; + }, + dayOfMonth: function (fragment, day) { + return "[" + OPERATOR.dateDayOfMonth + "(" + fragment + ", " + day + ")]"; + }, + dayOfMonthAfter: function (fragment, day) { + return "[" + OPERATOR.dateDayOfMonthAfter + "(" + fragment + ", " + day + ")]"; + }, + dayOfMonthBefore: function (fragment, day) { + return "[" + OPERATOR.dateDayOfMonthBefore + "(" + fragment + ", " + day + ")]"; + }, + dayOfWeek: function (fragment, day) { + return "[" + OPERATOR.dateDayOfWeek + "(" + fragment + ", " + encode(day) + ")]"; + }, + dayOfWeekAfter: function (fragment, day) { + return "[" + OPERATOR.dateDayOfWeekAfter + "(" + fragment + ", " + encode(day) + ")]"; + }, + dayOfWeekBefore: function (fragment, day) { + return "[" + OPERATOR.dateDayOfWeekBefore + "(" + fragment + ", " + encode(day) + ")]"; + }, + month: function (fragment, month) { + return "[" + OPERATOR.dateMonth + "(" + fragment + ", " + encode(month) + ")]"; + }, + monthBefore: function (fragment, month) { + return "[" + OPERATOR.dateMonthBefore + "(" + fragment + ", " + encode(month) + ")]"; + }, + monthAfter: function (fragment, month) { + return "[" + OPERATOR.dateMonthAfter + "(" + fragment + ", " + encode(month) + ")]"; + }, + year: function (fragment, year) { + return "[" + OPERATOR.dateYear + "(" + fragment + ", " + year + ")]"; + }, + hour: function (fragment, hour) { + return "[" + OPERATOR.dateHour + "(" + fragment + ", " + hour + ")]"; + }, + hourBefore: function (fragment, hour) { + return "[" + OPERATOR.dateHourBefore + "(" + fragment + ", " + hour + ")]"; + }, + hourAfter: function (fragment, hour) { + return "[" + OPERATOR.dateHourAfter + "(" + fragment + ", " + hour + ")]"; + }, + }; + var number = { + gt: function (fragment, value) { + return "[" + OPERATOR.numberGt + "(" + fragment + ", " + value + ")]"; + }, + lt: function (fragment, value) { + return "[" + OPERATOR.numberLt + "(" + fragment + ", " + value + ")]"; + }, + inRange: function (fragment, before, after) { + return "[" + OPERATOR.numberInRange + "(" + fragment + ", " + before + ", " + after + ")]"; + }, + }; + var Predicates = { + at: function (fragment, value) { + return "[" + OPERATOR.at + "(" + fragment + ", " + encode(value) + ")]"; + }, + not: function (fragment, value) { + return "[" + OPERATOR.not + "(" + fragment + ", " + encode(value) + ")]"; + }, + missing: function (fragment) { + return "[" + OPERATOR.missing + "(" + fragment + ")]"; + }, + has: function (fragment) { + return "[" + OPERATOR.has + "(" + fragment + ")]"; + }, + any: function (fragment, values) { + return "[" + OPERATOR.any + "(" + fragment + ", " + encode(values) + ")]"; + }, + in: function (fragment, values) { + return "[" + OPERATOR.in + "(" + fragment + ", " + encode(values) + ")]"; + }, + fulltext: function (fragment, value) { + return "[" + OPERATOR.fulltext + "(" + fragment + ", " + encode(value) + ")]"; + }, + similar: function (documentId, maxResults) { + return "[" + OPERATOR.similar + "(\"" + documentId + "\", " + maxResults + ")]"; + }, + date: date, + dateBefore: date.before, + dateAfter: date.after, + dateBetween: date.between, + dayOfMonth: date.dayOfMonth, + dayOfMonthAfter: date.dayOfMonthAfter, + dayOfMonthBefore: date.dayOfMonthBefore, + dayOfWeek: date.dayOfWeek, + dayOfWeekAfter: date.dayOfWeekAfter, + dayOfWeekBefore: date.dayOfWeekBefore, + month: date.month, + monthBefore: date.monthBefore, + monthAfter: date.monthAfter, + year: date.year, + hour: date.hour, + hourBefore: date.hourBefore, + hourAfter: date.hourAfter, + number: number, + gt: number.gt, + lt: number.lt, + inRange: number.inRange, + near: geopoint.near, + geopoint: geopoint, + }; + + // Some portions of code from https://github.com/jshttp/cookie + var decode = decodeURIComponent; + function tryDecode(str, decode) { + try { + return decode(str); + } + catch (e) { + return str; + } + } + function parse(str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string'); + } + var obj = {}; + var opt = options || {}; + var pairs = str.split(/; */); + var dec = opt.decode || decode; + pairs.forEach(function (pair) { + var eq_idx = pair.indexOf('='); + // skip things that don't look like key=value + if (eq_idx < 0) { + return; + } + var key = pair.substr(0, eq_idx).trim(); + var val = pair.substr(++eq_idx, pair.length).trim(); + // quoted values + if ('"' == val[0]) { + val = val.slice(1, -1); + } + // only assign once + if (undefined == obj[key]) { + obj[key] = tryDecode(val, dec); + } + }); + return obj; + } + var Cookies = { parse: parse }; + + var PREVIEW_COOKIE = 'io.prismic.preview'; + var EXPERIMENT_COOKIE = 'io.prismic.experiment'; + var ResolvedApi = /** @class */ (function () { + function ResolvedApi(data, httpClient, options) { + this.data = data; + this.masterRef = data.refs.filter(function (ref) { return ref.isMasterRef; })[0]; + this.experiments = new Experiments(data.experiments); + this.bookmarks = data.bookmarks; + this.httpClient = httpClient; + this.options = options; + this.refs = data.refs; + this.tags = data.tags; + this.types = data.types; + } + /** + * Returns a useable form from its id, as described in the RESTful description of the API. + * For instance: api.form("everything") works on every repository (as "everything" exists by default) + * You can then chain the calls: api.form("everything").query('[[:d = at(document.id, "UkL0gMuvzYUANCpf")]]').ref(ref).submit() + */ + ResolvedApi.prototype.form = function (formId) { + var form = this.data.forms[formId]; + if (form) { + return new SearchForm(form, this.httpClient); + } + return null; + }; + ResolvedApi.prototype.everything = function () { + var f = this.form('everything'); + if (!f) + throw new Error('Missing everything form'); + return f; + }; + /** + * The ID of the master ref on this prismic.io API. + * Do not use like this: searchForm.ref(api.master()). + * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page. + */ + ResolvedApi.prototype.master = function () { + return this.masterRef.ref; + }; + /** + * Returns the ref ID for a given ref's label. + * Do not use like this: searchForm.ref(api.ref("Future release label")). + * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page. + */ + ResolvedApi.prototype.ref = function (label) { + var ref = this.data.refs.filter(function (ref) { return ref.label === label; })[0]; + return ref ? ref.ref : null; + }; + ResolvedApi.prototype.currentExperiment = function () { + return this.experiments.current(); + }; + /** + * Query the repository + */ + ResolvedApi.prototype.query = function (q, optionsOrCallback, cb) { + if (cb === void 0) { cb = function () { }; } + var _a = typeof optionsOrCallback === 'function' + ? { options: {}, callback: optionsOrCallback } + : { options: optionsOrCallback || {}, callback: cb }, options = _a.options, callback = _a.callback; + var form = this.everything(); + for (var key in options) { + form = form.set(key, options[key]); + } + if (!options.ref) { + // Look in cookies if we have a ref (preview or experiment) + var cookieString = ''; + if (this.options.req) { // NodeJS + cookieString = this.options.req.headers['cookie'] || ''; + } + else if (typeof window !== 'undefined' && window.document) { // Browser + cookieString = window.document.cookie || ''; + } + var cookies = Cookies.parse(cookieString); + var previewRef = cookies[PREVIEW_COOKIE]; + var experimentRef = this.experiments.refFromCookie(cookies[EXPERIMENT_COOKIE]); + form = form.ref(previewRef || experimentRef || this.masterRef.ref); + } + if (q) { + form.query(q); + } + return form.submit(callback); + }; + /** + * Retrieve the document returned by the given query + * @param {string|array|Predicate} the query + * @param {object} additional parameters. In NodeJS, pass the request as 'req'. + * @param {function} callback(err, doc) + */ + ResolvedApi.prototype.queryFirst = function (q, optionsOrCallback, cb) { + var _a = typeof optionsOrCallback === 'function' + ? { options: {}, callback: optionsOrCallback } + : { options: optionsOrCallback || {}, callback: cb || (function () { }) }, options = _a.options, callback = _a.callback; + options.page = 1; + options.pageSize = 1; + return this.query(q, options).then(function (response) { + var document = response && response.results && response.results[0]; + callback(null, document); + return document; + }).catch(function (error) { + callback(error); + throw error; + }); + }; + /** + * Retrieve the document with the given id + */ + ResolvedApi.prototype.getByID = function (id, maybeOptions, cb) { + var options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.queryFirst(Predicates.at('document.id', id), options, cb); + }; + /** + * Retrieve multiple documents from an array of id + */ + ResolvedApi.prototype.getByIDs = function (ids, maybeOptions, cb) { + var options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.query(Predicates.in('document.id', ids), options, cb); + }; + /** + * Retrieve the document with the given uid + */ + ResolvedApi.prototype.getByUID = function (type, uid, maybeOptions, cb) { + var options = maybeOptions || {}; + if (options.lang === "*") + throw new Error("FORDIDDEN. You can't use getByUID with *, use the predicates instead."); + if (!options.page) + options.page = 1; + return this.queryFirst(Predicates.at("my." + type + ".uid", uid), options, cb); + }; + /** + * Retrieve the singleton document with the given type + */ + ResolvedApi.prototype.getSingle = function (type, maybeOptions, cb) { + var options = maybeOptions || {}; + return this.queryFirst(Predicates.at('document.type', type), options, cb); + }; + /** + * Retrieve the document with the given bookmark + */ + ResolvedApi.prototype.getBookmark = function (bookmark, maybeOptions, cb) { + var id = this.data.bookmarks[bookmark]; + if (id) { + return this.getByID(id, maybeOptions, cb); + } + else { + return Promise.reject('Error retrieving bookmarked id'); + } + }; + ResolvedApi.prototype.previewSession = function (token, linkResolver, defaultUrl, cb) { + var _this = this; + return new Promise(function (resolve, reject) { + _this.httpClient.request(token, function (e, result) { + if (e) { + cb && cb(e); + reject(e); + } + else if (result) { + if (!result.mainDocument) { + cb && cb(null, defaultUrl); + resolve(defaultUrl); + } + else { + return _this.getByID(result.mainDocument, { ref: token }).then(function (document) { + if (!document) { + cb && cb(null, defaultUrl); + resolve(defaultUrl); + } + else { + var url = linkResolver(document); + cb && cb(null, url); + resolve(url); + } + }).catch(reject); + } + } + }); + }); + }; + return ResolvedApi; + }()); + + /** + * A doubly linked list-based Least Recently Used (LRU) cache. Will keep most + * recently used items while discarding least recently used items when its limit + * is reached. + * + * Licensed under MIT. Copyright (c) 2010 Rasmus Andersson + * Typescript-ified by Oleksandr Nikitin + * + * Illustration of the design: + * + * entry entry entry entry + * ______ ______ ______ ______ + * | head |.newer => | |.newer => | |.newer => | tail | + * | A | | B | | C | | D | + * |______| <= older.|______| <= older.|______| <= older.|______| + * + * removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added + */ + function MakeLRUCache(limit) { + return new LRUCache(limit); + } + function LRUCache(limit) { + // Current size of the cache. (Read-only). + this.size = 0; + // Maximum number of items this cache can hold. + this.limit = limit; + this._keymap = {}; + } + /** + * Put into the cache associated with . Returns the entry which was + * removed to make room for the new entry. Otherwise undefined is returned + * (i.e. if there was enough room already). + */ + LRUCache.prototype.put = function (key, value) { + var entry = { key: key, value: value }; + // Note: No protection agains replacing, and thus orphan entries. By design. + this._keymap[key] = entry; + if (this.tail) { + // link previous tail to the new tail (entry) + this.tail.newer = entry; + entry.older = this.tail; + } + else { + // we're first in -- yay + this.head = entry; + } + // add new entry to the end of the linked list -- it's now the freshest entry. + this.tail = entry; + if (this.size === this.limit) { + // we hit the limit -- remove the head + return this.shift(); + } + else { + // increase the size counter + this.size++; + } + }; + /** + * Purge the least recently used (oldest) entry from the cache. Returns the + * removed entry or undefined if the cache was empty. + * + * If you need to perform any form of finalization of purged items, this is a + * good place to do it. Simply override/replace this function: + * + * var c = new LRUCache(123); + * c.shift = function() { + * var entry = LRUCache.prototype.shift.call(this); + * doSomethingWith(entry); + * return entry; + * } + */ + LRUCache.prototype.shift = function () { + // todo: handle special case when limit == 1 + var entry = this.head; + if (entry) { + if (this.head.newer) { + this.head = this.head.newer; + this.head.older = undefined; + } + else { + this.head = undefined; + } + // Remove last strong reference to and remove links from the purged + // entry being returned: + entry.newer = entry.older = undefined; + // delete is slow, but we need to do this to avoid uncontrollable growth: + delete this._keymap[entry.key]; + } + console.log('purging ', entry.key); + return entry; + }; + /** + * Get and register recent use of . Returns the value associated with + * or undefined if not in cache. + */ + LRUCache.prototype.get = function (key, returnEntry) { + // First, find our cache entry + var entry = this._keymap[key]; + if (entry === undefined) + return; // Not cached. Sorry. + // As was found in the cache, register it as being requested recently + if (entry === this.tail) { + // Already the most recently used entry, so no need to update the list + return returnEntry ? entry : entry.value; + } + // HEAD--------------TAIL + // <.older .newer> + // <--- add direction -- + // A B C E + if (entry.newer) { + if (entry === this.head) + this.head = entry.newer; + entry.newer.older = entry.older; // C <-- E. + } + if (entry.older) + entry.older.newer = entry.newer; // C. --> E + entry.newer = undefined; // D --x + entry.older = this.tail; // D. --> E + if (this.tail) + this.tail.newer = entry; // E. <-- D + this.tail = entry; + return returnEntry ? entry : entry.value; + }; + // ---------------------------------------------------------------------------- + // Following code is optional and can be removed without breaking the core + // functionality. + /** + * Check if is in the cache without registering recent use. Feasible if + * you do not want to chage the state of the cache, but only "peek" at it. + * Returns the entry associated with if found, or undefined if not found. + */ + LRUCache.prototype.find = function (key) { + return this._keymap[key]; + }; + /** + * Update the value of entry with . Returns the old value, or undefined if + * entry was not in the cache. + */ + LRUCache.prototype.set = function (key, value) { + var oldvalue; + var entry = this.get(key, true); + if (entry) { + oldvalue = entry.value; + entry.value = value; + } + else { + oldvalue = this.put(key, value); + if (oldvalue) + oldvalue = oldvalue.value; + } + return oldvalue; + }; + /** + * Remove entry from cache and return its value. Returns undefined if not + * found. + */ + LRUCache.prototype.remove = function (key) { + var entry = this._keymap[key]; + if (!entry) + return; + delete this._keymap[entry.key]; // need to do delete unfortunately + if (entry.newer && entry.older) { + // relink the older entry with the newer entry + entry.older.newer = entry.newer; + entry.newer.older = entry.older; + } + else if (entry.newer) { + // remove the link to us + entry.newer.older = undefined; + // link the newer entry to head + this.head = entry.newer; + } + else if (entry.older) { + // remove the link to us + entry.older.newer = undefined; + // link the newer entry to head + this.tail = entry.older; + } + else { // if(entry.older === undefined && entry.newer === undefined) { + this.head = this.tail = undefined; + } + this.size--; + return entry.value; + }; + /** Removes all entries */ + LRUCache.prototype.removeAll = function () { + // This should be safe, as we never expose strong refrences to the outside + this.head = this.tail = undefined; + this.size = 0; + this._keymap = {}; + }; + /** + * Return an array containing all keys of entries stored in the cache object, in + * arbitrary order. + */ + if (typeof Object.keys === 'function') { + LRUCache.prototype.keys = function () { return Object.keys(this._keymap); }; + } + else { + LRUCache.prototype.keys = function () { + var keys = []; + for (var k in this._keymap) + keys.push(k); + return keys; + }; + } + /** + * Call `fun` for each entry. Starting with the newest entry if `desc` is a true + * value, otherwise starts with the oldest (head) enrty and moves towards the + * tail. + * + * `fun` is called with 3 arguments in the context `context`: + * `fun.call(context, Object key, Object value, LRUCache self)` + */ + LRUCache.prototype.forEach = function (fun, context, desc) { + var entry; + if (context === true) { + desc = true; + context = undefined; + } + else if (typeof context !== 'object') + context = this; + if (desc) { + entry = this.tail; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.older; + } + } + else { + entry = this.head; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.newer; + } + } + }; + /** Returns a JSON (array) representation */ + //LRUCache.prototype.toJSON = function () { + // var s: IEntry[] = [], entry = this.head; + // while (entry) { + // s.push({ key: entry.key.toJSON(), value: entry.value.toJSON() }); + // entry = entry.newer; + // } + // return s; + //}; + /** Returns a String representation */ + LRUCache.prototype.toString = function () { + var s = '', entry = this.head; + while (entry) { + s += String(entry.key) + ':' + entry.value; + entry = entry.newer; + if (entry) + s += ' < '; + } + return s; + }; + + var DefaultApiCache = /** @class */ (function () { + function DefaultApiCache(limit) { + if (limit === void 0) { limit = 1000; } + this.lru = MakeLRUCache(limit); + } + DefaultApiCache.prototype.isExpired = function (key) { + var value = this.lru.get(key, false); + if (value) { + return value.expiredIn !== 0 && value.expiredIn < Date.now(); + } + else { + return false; + } + }; + DefaultApiCache.prototype.get = function (key, cb) { + var value = this.lru.get(key, false); + if (value && !this.isExpired(key)) { + cb(null, value.data); + } + else { + cb && cb(null); + } + }; + DefaultApiCache.prototype.set = function (key, value, ttl, cb) { + this.lru.remove(key); + this.lru.put(key, { + data: value, + expiredIn: ttl ? (Date.now() + (ttl * 1000)) : 0, + }); + cb && cb(null); + }; + DefaultApiCache.prototype.remove = function (key, cb) { + this.lru.remove(key); + cb && cb(null); + }; + DefaultApiCache.prototype.clear = function (cb) { + this.lru.removeAll(); + cb && cb(null); + }; + return DefaultApiCache; + }()); + + function fetchRequest(url, options, callback) { + var fetchOptions = { + headers: { + Accept: 'application/json', + }, + }; + if (options && options.proxyAgent) { + fetchOptions.agent = options.proxyAgent; + } + fetch(url, fetchOptions).then(function (xhr) { + if (~~(xhr.status / 100 !== 2)) { + /** + * @description + * drain the xhr before throwing an error to prevent memory leaks + * @link https://github.com/bitinn/node-fetch/issues/83 + */ + return xhr.text().then(function () { + var e = new Error("Unexpected status code [" + xhr.status + "] on URL " + url); + e.status = xhr.status; + throw e; + }); + } + return xhr.json().then(function (result) { + var cacheControl = xhr.headers.get('cache-control'); + var parsedCacheControl = cacheControl ? /max-age=(\d+)/.exec(cacheControl) : null; + var ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined; + callback(null, result, xhr, ttl); + }); + }).catch(callback); + } + var DefaultRequestHandler = /** @class */ (function () { + function DefaultRequestHandler(options) { + this.options = options || {}; + } + DefaultRequestHandler.prototype.request = function (url, callback) { + fetchRequest(url, this.options, callback); + }; + return DefaultRequestHandler; + }()); + + var HttpClient = /** @class */ (function () { + function HttpClient(requestHandler, cache, proxyAgent) { + this.requestHandler = requestHandler || new DefaultRequestHandler({ proxyAgent: proxyAgent }); + this.cache = cache || new DefaultApiCache(); + } + HttpClient.prototype.request = function (url, callback) { + this.requestHandler.request(url, function (err, result, xhr, ttl) { + if (err) { + callback && callback(err, null, xhr, ttl); + } + else if (result) { + callback && callback(null, result, xhr, ttl); + } + }); + }; + /** + * Fetch a URL corresponding to a query, and parse the response as a Response object + */ + HttpClient.prototype.cachedRequest = function (url, maybeOptions) { + var _this = this; + var options = maybeOptions || {}; + var run = function (cb) { + var cacheKey = options.cacheKey || url; + _this.cache.get(cacheKey, function (cacheGetError, cacheGetValue) { + if (cacheGetError || cacheGetValue) { + cb(cacheGetError, cacheGetValue); + } + else { + _this.request(url, function (fetchError, fetchValue, xhr, ttlReq) { + if (fetchError) { + cb(fetchError, null); + } + else { + var ttl = ttlReq || options.ttl; + if (ttl) { + _this.cache.set(cacheKey, fetchValue, ttl, cb); + } + cb(null, fetchValue); + } + }); + } + }); + }; + return new Promise(function (resolve, reject) { + run(function (err, value) { + if (err) + reject(err); + if (value) + resolve(value); + }); + }); + }; + return HttpClient; + }()); + + var Api = /** @class */ (function () { + function Api(url, options) { + this.options = options || {}; + this.url = url; + if (this.options.accessToken) { + var accessTokenParam = "access_token=" + this.options.accessToken; + this.url += (url.indexOf('?') > -1 ? '&' : '?') + accessTokenParam; + } + this.apiDataTTL = this.options.apiDataTTL || 5; + this.httpClient = new HttpClient(this.options.requestHandler, this.options.apiCache, this.options.proxyAgent); + } + /** + * Fetches data used to construct the api client, from cache if it's + * present, otherwise from calling the prismic api endpoint (which is + * then cached). + */ + Api.prototype.get = function (cb) { + var _this = this; + return this.httpClient.cachedRequest(this.url, { ttl: this.apiDataTTL }).then(function (data) { + var resolvedApi = new ResolvedApi(data, _this.httpClient, _this.options); + cb && cb(null, resolvedApi); + return resolvedApi; + }).catch(function (error) { + cb && cb(error); + throw error; + }); + }; + return Api; + }()); + + var DefaultClient = /** @class */ (function () { + function DefaultClient(url, options) { + this.api = new Api(url, options); + } + DefaultClient.prototype.getApi = function () { + return this.api.get(); + }; + DefaultClient.prototype.everything = function () { + return this.form('everything'); + }; + DefaultClient.prototype.form = function (formId) { + return new LazySearchForm(formId, this.api); + }; + DefaultClient.prototype.query = function (q, optionsOrCallback, cb) { + return this.getApi().then(function (api) { return api.query(q, optionsOrCallback, cb); }); + }; + DefaultClient.prototype.queryFirst = function (q, optionsOrCallback, cb) { + return this.getApi().then(function (api) { return api.queryFirst(q, optionsOrCallback, cb); }); + }; + DefaultClient.prototype.getByID = function (id, options, cb) { + return this.getApi().then(function (api) { return api.getByID(id, options, cb); }); + }; + DefaultClient.prototype.getByIDs = function (ids, options, cb) { + return this.getApi().then(function (api) { return api.getByIDs(ids, options, cb); }); + }; + DefaultClient.prototype.getByUID = function (type, uid, options, cb) { + return this.getApi().then(function (api) { return api.getByUID(type, uid, options, cb); }); + }; + DefaultClient.prototype.getSingle = function (type, options, cb) { + return this.getApi().then(function (api) { return api.getSingle(type, options, cb); }); + }; + DefaultClient.prototype.getBookmark = function (bookmark, options, cb) { + return this.getApi().then(function (api) { return api.getBookmark(bookmark, options, cb); }); + }; + DefaultClient.prototype.previewSession = function (token, linkResolver, defaultUrl, cb) { + return this.getApi().then(function (api) { return api.previewSession(token, linkResolver, defaultUrl, cb); }); + }; + DefaultClient.getApi = function (url, options) { + var api = new Api(url, options); + return api.get(); + }; + return DefaultClient; + }()); + + function client(url, options) { + return new DefaultClient(url, options); + } + function getApi(url, options) { + return DefaultClient.getApi(url, options); + } + function api(url, options) { + return getApi(url, options); + } + + exports.experimentCookie = EXPERIMENT_COOKIE; + exports.previewCookie = PREVIEW_COOKIE; + exports.Predicates = Predicates; + exports.Experiments = Experiments; + exports.Api = Api; + exports.client = client; + exports.getApi = getApi; + exports.api = api; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=prismic-javascript.browser.js.map diff --git a/dist/prismic-javascript.browser.js.map b/dist/prismic-javascript.browser.js.map new file mode 100644 index 00000000..1e968f53 --- /dev/null +++ b/dist/prismic-javascript.browser.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prismic-javascript.browser.js","sources":["../src/experiments.ts","../src/form.ts","../src/Predicates.ts","../src/Cookies.ts","../src/ResolvedApi.ts","../src/lru.ts","../src/cache.ts","../src/request.ts","../src/HttpClient.ts","../src/Api.ts","../src/client.ts","../src/index.ts"],"sourcesContent":["export class Variation {\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n }\n\n id(): string {\n return this.data.id;\n }\n\n ref(): string {\n return this.data.ref;\n }\n\n label(): string {\n return this.data.label;\n }\n}\n\nexport class Experiment {\n variations: Variation[];\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n this.variations = (data.variations || []).map((v: any) => {\n return new Variation(v);\n });\n }\n\n id(): string {\n return this.data.id;\n }\n\n googleId(): string {\n return this.data.googleId;\n }\n\n name(): string {\n return this.data.name;\n }\n}\n\nexport class Experiments {\n drafts: Experiment[];\n running: Experiment[];\n\n constructor(data: any) {\n if (data) {\n this.drafts = (data.drafts || []).map((exp: any) => {\n return new Experiment(exp);\n });\n this.running = (data.running || []).map((exp: any) => {\n return new Experiment(exp);\n });\n }\n }\n\n current(): Experiment | null {\n if (this.running.length > 0) {\n return this.running[0];\n } else {\n return null;\n }\n }\n refFromCookie(cookie: string): string | null {\n if (!cookie || cookie.trim() === '') return null;\n const splitted = cookie.trim().split(' ');\n if (splitted.length < 2) return null;\n const expId = splitted[0];\n const varIndex = parseInt(splitted[1], 10);\n const exp = this.running.filter((exp) => {\n return exp.googleId() === expId && exp.variations.length > varIndex;\n })[0];\n return exp ? exp.variations[varIndex].ref() : null;\n }\n}\n","import Api from './Api';\nimport ResolvedApi from './ResolvedApi';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport HttpClient from './HttpClient';\nimport { RequestCallback } from './request';\n\nexport type Fields = { [key: string]: any };\n\nexport interface Form {\n fields: Fields;\n action: string;\n name: string;\n rel: string;\n form_method: string;\n enctype: string;\n}\n\nexport class LazySearchForm {\n id: string;\n fields: Fields;\n api: Api;\n\n constructor(id: string, api: Api) {\n this.id = id;\n this.api = api;\n this.fields = {};\n }\n\n set(key: string, value: any): LazySearchForm {\n this.fields[key] = value;\n return this;\n }\n\n ref(ref: string): LazySearchForm {\n return this.set('ref', ref);\n }\n\n query(query: string | string[]): LazySearchForm {\n return this.set('q', query);\n }\n\n pageSize(size: number): LazySearchForm {\n return this.set('pageSize', size);\n }\n\n fetch(fields: string | string[]): LazySearchForm {\n console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.');\n return this.set('fetch', fields);\n }\n\n fetchLinks(fields: string | string[]): LazySearchForm {\n console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.');\n return this.set('fetchLinks', fields);\n }\n\n graphQuery(query: string): LazySearchForm {\n return this.set('graphQuery', query);\n }\n\n lang(langCode: string): LazySearchForm {\n return this.set('lang', langCode);\n }\n\n page(p: number): LazySearchForm {\n return this.set('page', p);\n }\n\n after(documentId: string): LazySearchForm {\n return this.set('after', documentId);\n }\n\n orderings(orderings?: string[]): LazySearchForm {\n return this.set('orderings', orderings);\n }\n\n url(): Promise {\n return this.api.get().then((api) => {\n return LazySearchForm.toSearchForm(this, api).url();\n });\n }\n\n submit(cb: RequestCallback): Promise {\n return this.api.get().then((api) => {\n return LazySearchForm.toSearchForm(this, api).submit(cb);\n });\n }\n\n static toSearchForm(lazyForm: LazySearchForm, api: ResolvedApi): SearchForm {\n const form = api.form(lazyForm.id);\n if (form) {\n return Object.keys(lazyForm.fields).reduce((form, fieldKey) => {\n const fieldValue = lazyForm.fields[fieldKey];\n if (fieldKey === 'q') {\n return form.query(fieldValue);\n } else if (fieldKey === 'pageSize') {\n return form.pageSize(fieldValue);\n } else if (fieldKey === 'fetch') {\n return form.fetch(fieldValue);\n } else if (fieldKey === 'fetchLinks') {\n return form.fetchLinks(fieldValue);\n } else if (fieldKey === 'graphQuery') {\n return form.graphQuery(fieldValue);\n } else if (fieldKey === 'lang') {\n return form.lang(fieldValue);\n } else if (fieldKey === 'page') {\n return form.page(fieldValue);\n } else if (fieldKey === 'after') {\n return form.after(fieldValue);\n } else if (fieldKey === 'orderings') {\n return form.orderings(fieldValue);\n } else {\n return form.set(fieldKey, fieldValue);\n }\n }, form);\n } else {\n throw new Error(`Unable to access to form ${lazyForm.id}`);\n }\n }\n}\n\nexport class SearchForm {\n httpClient: HttpClient;\n form: Form;\n data: any;\n\n constructor(form: Form, httpClient: HttpClient) {\n this.httpClient = httpClient;\n this.form = form;\n\n this.data = {};\n for (const field in form.fields) {\n if (form.fields[field]['default']) {\n this.data[field] = [form.fields[field]['default']];\n }\n }\n }\n\n set(field: string, value: any): SearchForm {\n const fieldDesc = this.form.fields[field];\n if (!fieldDesc) throw new Error('Unknown field ' + field);\n const checkedValue = value === '' || value === undefined ? null : value;\n let values = this.data[field] || [];\n if (fieldDesc.multiple) {\n values = checkedValue ? values.concat([checkedValue]) : values;\n } else {\n values = checkedValue ? [checkedValue] : values;\n }\n this.data[field] = values;\n return this;\n }\n\n /**\n * Sets a ref to query on for this SearchForm. This is a mandatory\n * method to call before calling submit(), and api.form('everything').submit()\n * will not work.\n */\n ref(ref: string): SearchForm {\n return this.set('ref', ref);\n }\n\n /**\n * Sets a predicate-based query for this SearchForm. This is where you\n * paste what you compose in your prismic.io API browser.\n */\n query(query: string | string[]): SearchForm {\n if (typeof query === 'string') {\n return this.query([query]);\n } else if (Array.isArray(query)) {\n return this.set('q', `[${query.join('')}]`);\n } else {\n throw new Error(`Invalid query : ${query}`);\n }\n }\n\n /**\n * Sets a page size to query for this SearchForm. This is an optional method.\n *\n * @param {number} size - The page size\n * @returns {SearchForm} - The SearchForm itself\n */\n pageSize(size: number): SearchForm {\n return this.set('pageSize', size);\n }\n\n /**\n * Restrict the results document to the specified fields\n */\n fetch(fields: string | string[]): SearchForm {\n console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.');\n const strFields = Array.isArray(fields) ? fields.join(',') : fields;\n return this.set('fetch', strFields);\n }\n\n /**\n * Include the requested fields in the DocumentLink instances in the result\n */\n fetchLinks(fields: string | string[]): SearchForm {\n console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.');\n const strFields = Array.isArray(fields) ? fields.join(',') : fields;\n return this.set('fetchLinks', strFields);\n }\n\n /**\n * Sets the graphquery to query for this SearchForm. This is an optional method.\n */\n graphQuery(query: string): SearchForm {\n return this.set('graphQuery', query);\n }\n\n /**\n * Sets the language to query for this SearchForm. This is an optional method.\n */\n lang(langCode: string): SearchForm {\n return this.set('lang', langCode);\n }\n\n /**\n * Sets the page number to query for this SearchForm. This is an optional method.\n */\n page(p: number): SearchForm {\n return this.set('page', p);\n }\n\n /**\n * Remove all the documents except for those after the specified document in the list. This is an optional method.\n */\n after(documentId: string): SearchForm {\n return this.set('after', documentId);\n }\n\n /**\n * Sets the orderings to query for this SearchForm. This is an optional method.\n */\n orderings(orderings ?: string[]): SearchForm {\n if (!orderings) {\n return this;\n } else {\n return this.set('orderings', `[${orderings.join(',')}]`);\n }\n }\n\n /**\n * Build the URL to query\n */\n url(): string {\n let url = this.form.action;\n if (this.data) {\n let sep = (url.indexOf('?') > -1 ? '&' : '?');\n for (const key in this.data) {\n if (this.data.hasOwnProperty(key)) {\n const values = this.data[key];\n if (values) {\n for (let i = 0; i < values.length; i++) {\n url += sep + key + '=' + encodeURIComponent(values[i]);\n sep = '&';\n }\n }\n }\n }\n }\n return url;\n }\n\n /**\n * Submits the query, and calls the callback function.\n */\n submit(cb: RequestCallback): Promise {\n return this.httpClient.cachedRequest(this.url()).then((response) => {\n cb && cb(null, response);\n return response;\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","const OPERATOR = {\n at: 'at',\n not: 'not',\n missing: 'missing',\n has: 'has',\n any: 'any',\n in: 'in',\n fulltext: 'fulltext',\n similar: 'similar',\n numberGt: 'number.gt',\n numberLt: 'number.lt',\n numberInRange: 'number.inRange',\n dateBefore: 'date.before',\n dateAfter: 'date.after',\n dateBetween: 'date.between',\n dateDayOfMonth: 'date.day-of-month',\n dateDayOfMonthAfter: 'date.day-of-month-after',\n dateDayOfMonthBefore: 'date.day-of-month-before',\n dateDayOfWeek: 'date.day-of-week',\n dateDayOfWeekAfter: 'date.day-of-week-after',\n dateDayOfWeekBefore: 'date.day-of-week-before',\n dateMonth: 'date.month',\n dateMonthBefore: 'date.month-before',\n dateMonthAfter: 'date.month-after',\n dateYear: 'date.year',\n dateHour: 'date.hour',\n dateHourBefore: 'date.hour-before',\n dateHourAfter: 'date.hour-after',\n GeopointNear: 'geopoint.near',\n};\n\ntype PredicateValue = string | number | Date;\n\nfunction encode(value: PredicateValue | PredicateValue[]): string {\n if (typeof value === 'string') {\n return `\"${value}\"`;\n } else if (typeof value === 'number') {\n return value.toString();\n } else if (value instanceof Date) {\n return value.getTime().toString();\n } else if (Array.isArray(value)) {\n return `[${value.map(v => encode(v)).join(',')}]`;\n } else {\n throw new Error(`Unable to encode ${value} of type ${typeof value}`);\n }\n}\n\nconst geopoint = {\n near(fragment: string, latitude: number, longitude: number, radius: number): string {\n return `[${OPERATOR.GeopointNear}(${fragment}, ${latitude}, ${longitude}, ${radius})]`;\n },\n};\n\nconst date = {\n\n before(fragment: string, before: PredicateValue): string {\n return `[${OPERATOR.dateBefore}(${fragment}, ${encode(before)})]`;\n },\n\n after(fragment: string, after: PredicateValue): string {\n return `[${OPERATOR.dateAfter}(${fragment}, ${encode(after)})]`;\n },\n\n between(fragment: string, before: PredicateValue, after: PredicateValue): string {\n return `[${OPERATOR.dateBetween}(${fragment}, ${encode(before)}, ${encode(after)})]`;\n },\n\n dayOfMonth(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonth}(${fragment}, ${day})]`;\n },\n\n dayOfMonthAfter(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonthAfter}(${fragment}, ${day})]`;\n },\n\n dayOfMonthBefore(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonthBefore}(${fragment}, ${day})]`;\n },\n\n dayOfWeek(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeek}(${fragment}, ${encode(day)})]`;\n },\n\n dayOfWeekAfter(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeekAfter}(${fragment}, ${encode(day)})]`;\n },\n\n dayOfWeekBefore(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeekBefore}(${fragment}, ${encode(day)})]`;\n },\n\n month(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonth}(${fragment}, ${encode(month)})]`;\n },\n\n monthBefore(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonthBefore}(${fragment}, ${encode(month)})]`;\n },\n\n monthAfter(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonthAfter}(${fragment}, ${encode(month)})]`;\n },\n\n year(fragment: string, year: number): string {\n return `[${OPERATOR.dateYear}(${fragment}, ${year})]`;\n },\n\n hour(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHour}(${fragment}, ${hour})]`;\n },\n\n hourBefore(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHourBefore}(${fragment}, ${hour})]`;\n },\n\n hourAfter(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHourAfter}(${fragment}, ${hour})]`;\n },\n};\n\nconst number = {\n gt(fragment: string, value: number): string {\n return `[${OPERATOR.numberGt}(${fragment}, ${value})]`;\n },\n\n lt(fragment: string, value: number): string {\n return `[${OPERATOR.numberLt}(${fragment}, ${value})]`;\n },\n\n inRange(fragment: string, before: number, after: number): string {\n return `[${OPERATOR.numberInRange}(${fragment}, ${before}, ${after})]`;\n },\n};\n\nexport default {\n at(fragment: string, value: PredicateValue | PredicateValue[]): string {\n return `[${OPERATOR.at}(${fragment}, ${encode(value)})]`;\n },\n\n not(fragment: string, value: PredicateValue | PredicateValue[]): string {\n return `[${OPERATOR.not}(${fragment}, ${encode(value)})]`;\n },\n\n missing(fragment: string): string {\n return `[${OPERATOR.missing}(${fragment})]`;\n },\n\n has(fragment: string): string {\n return `[${OPERATOR.has}(${fragment})]`;\n },\n\n any(fragment: string, values: PredicateValue[]): string {\n return `[${OPERATOR.any}(${fragment}, ${encode(values)})]`;\n },\n\n in(fragment: string, values: string[]): string {\n return `[${OPERATOR.in}(${fragment}, ${encode(values)})]`;\n },\n\n fulltext(fragment: string, value: string): string {\n return `[${OPERATOR.fulltext}(${fragment}, ${encode(value)})]`;\n },\n\n similar(documentId: string, maxResults: number): string {\n return `[${OPERATOR.similar}(\"${documentId}\", ${maxResults})]`;\n },\n\n date,\n\n dateBefore: date.before,\n\n dateAfter: date.after,\n\n dateBetween: date.between,\n\n dayOfMonth: date.dayOfMonth,\n\n dayOfMonthAfter: date.dayOfMonthAfter,\n\n dayOfMonthBefore: date.dayOfMonthBefore,\n\n dayOfWeek: date.dayOfWeek,\n\n dayOfWeekAfter: date.dayOfWeekAfter,\n\n dayOfWeekBefore: date.dayOfWeekBefore,\n\n month: date.month,\n\n monthBefore: date.monthBefore,\n\n monthAfter: date.monthAfter,\n\n year: date.year,\n\n hour: date.hour,\n\n hourBefore: date.hourBefore,\n\n hourAfter: date.hourAfter,\n\n number,\n\n gt: number.gt,\n\n lt: number.lt,\n\n inRange: number.inRange,\n\n near: geopoint.near,\n\n geopoint,\n};\n","export interface Cookie {\n [key: string]: string;\n value: string;\n}\n\n// Some portions of code from https://github.com/jshttp/cookie\n\nvar decode = decodeURIComponent;\n\nfunction tryDecode(str: string, decode: (str: string) => string) {\n try {\n return decode(str);\n } catch (e) {\n return str;\n }\n}\n\nfunction parse(str: string, options?: any) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string');\n }\n\n var obj = {};\n var opt = options || {};\n var pairs = str.split(/; */);\n var dec = opt.decode || decode;\n\n pairs.forEach(function(pair) {\n var eq_idx = pair.indexOf('=');\n\n // skip things that don't look like key=value\n if (eq_idx < 0) {\n return;\n }\n\n var key = pair.substr(0, eq_idx).trim();\n var val = pair.substr(++eq_idx, pair.length).trim();\n\n // quoted values\n if ('\"' == val[0]) {\n val = val.slice(1, -1);\n }\n\n // only assign once\n if (undefined == obj[key]) {\n obj[key] = tryDecode(val, dec);\n }\n });\n\n return obj;\n}\n\nexport default { parse };\n","import { Document } from \"./documents\";\nimport { RequestHandler, RequestCallback } from './request';\nimport { ApiCache } from './cache';\nimport { Experiment, Experiments } from './experiments';\nimport { SearchForm, Form } from './form';\nimport Predicates from './Predicates';\nimport Cookies from './Cookies';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport HttpClient from './HttpClient';\nimport { Client } from './client';\n\nexport const PREVIEW_COOKIE = 'io.prismic.preview';\nexport const EXPERIMENT_COOKIE = 'io.prismic.experiment';\n\nexport interface Ref {\n ref: string;\n label: string;\n isMasterRef: boolean;\n scheduledAt: string;\n id: string;\n}\n\nexport interface ApiData {\n refs: Ref[];\n bookmarks: { [key: string]: string };\n types: { [key: string]: string };\n tags: string[];\n forms: { [key: string]: Form };\n experiments: any;\n oauth_initiate: string;\n oauth_token: string;\n version: string;\n licence: string;\n}\n\nexport interface PreviewResponse {\n mainDocument?: string;\n}\n\nexport interface QueryOptions {\n [key: string]: string | number | string[];\n}\n\nexport interface ResolvedApiOptions {\n req?: any;\n}\n\nexport default class ResolvedApi implements Client {\n data: ApiData;\n masterRef: Ref;\n experiments: Experiments;\n options: ResolvedApiOptions;\n httpClient: HttpClient;\n bookmarks: { [key: string]: string };\n refs: Ref[];\n tags: string[];\n types: { [key: string]: string };\n\n constructor(data: ApiData, httpClient: HttpClient, options: ResolvedApiOptions) {\n this.data = data;\n this.masterRef = data.refs.filter(ref => ref.isMasterRef)[0];\n this.experiments = new Experiments(data.experiments);\n this.bookmarks = data.bookmarks;\n this.httpClient = httpClient;\n this.options = options;\n this.refs = data.refs;\n this.tags = data.tags;\n this.types = data.types;\n }\n\n /**\n * Returns a useable form from its id, as described in the RESTful description of the API.\n * For instance: api.form(\"everything\") works on every repository (as \"everything\" exists by default)\n * You can then chain the calls: api.form(\"everything\").query('[[:d = at(document.id, \"UkL0gMuvzYUANCpf\")]]').ref(ref).submit()\n */\n form(formId: string): SearchForm | null {\n const form = this.data.forms[formId];\n if (form) {\n return new SearchForm(form, this.httpClient);\n }\n return null;\n }\n\n everything(): SearchForm {\n const f = this.form('everything');\n if (!f) throw new Error('Missing everything form');\n return f;\n }\n\n /**\n * The ID of the master ref on this prismic.io API.\n * Do not use like this: searchForm.ref(api.master()).\n * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.\n */\n master(): string {\n return this.masterRef.ref;\n }\n\n /**\n * Returns the ref ID for a given ref's label.\n * Do not use like this: searchForm.ref(api.ref(\"Future release label\")).\n * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.\n */\n ref(label: string): string | null {\n const ref = this.data.refs.filter(ref => ref.label === label)[0];\n return ref ? ref.ref : null;\n }\n\n currentExperiment(): Experiment | null {\n return this.experiments.current();\n }\n\n /**\n * Query the repository\n */\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb: RequestCallback = () => {}): Promise {\n const { options, callback } = typeof optionsOrCallback === 'function'\n ? { options: {} as QueryOptions, callback: optionsOrCallback }\n : { options: optionsOrCallback || {}, callback: cb };\n\n let form = this.everything();\n for (const key in options) {\n form = form.set(key, options[key]);\n }\n if (!options.ref) {\n // Look in cookies if we have a ref (preview or experiment)\n let cookieString = '';\n if (this.options.req) { // NodeJS\n cookieString = this.options.req.headers['cookie'] || '';\n } else if (typeof window !== 'undefined' && window.document) { // Browser\n cookieString = window.document.cookie || '';\n }\n const cookies = Cookies.parse(cookieString);\n const previewRef = cookies[PREVIEW_COOKIE];\n const experimentRef = this.experiments.refFromCookie(cookies[EXPERIMENT_COOKIE]);\n form = form.ref(previewRef || experimentRef || this.masterRef.ref);\n }\n if (q) {\n form.query(q);\n }\n return form.submit(callback);\n }\n\n /**\n * Retrieve the document returned by the given query\n * @param {string|array|Predicate} the query\n * @param {object} additional parameters. In NodeJS, pass the request as 'req'.\n * @param {function} callback(err, doc)\n */\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n const { options, callback } = typeof optionsOrCallback === 'function'\n ? { options: {} as QueryOptions, callback: optionsOrCallback }\n : { options: optionsOrCallback || {}, callback: cb || (() => {}) };\n\n options.page = 1;\n options.pageSize = 1;\n\n return this.query(q, options).then((response) => {\n const document = response && response.results && response.results[0];\n callback(null, document);\n return document;\n }).catch((error) => {\n callback(error);\n throw error;\n });\n }\n\n /**\n * Retrieve the document with the given id\n */\n getByID(id: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.queryFirst(Predicates.at('document.id', id), options, cb);\n }\n\n /**\n * Retrieve multiple documents from an array of id\n */\n getByIDs(ids: string[], maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.query(Predicates.in('document.id', ids), options, cb);\n }\n\n /**\n * Retrieve the document with the given uid\n */\n getByUID(type: string, uid: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if(options.lang === \"*\") throw new Error(\"FORDIDDEN. You can't use getByUID with *, use the predicates instead.\")\n if(!options.page) options.page = 1;\n\n return this.queryFirst(Predicates.at(`my.${type}.uid`, uid), options, cb);\n }\n\n /**\n * Retrieve the singleton document with the given type\n */\n getSingle(type: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n return this.queryFirst(Predicates.at('document.type', type), options, cb);\n }\n\n /**\n * Retrieve the document with the given bookmark\n */\n getBookmark(bookmark: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const id = this.data.bookmarks[bookmark];\n if (id) {\n return this.getByID(id, maybeOptions, cb);\n } else {\n return Promise.reject('Error retrieving bookmarked id');\n }\n }\n\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise {\n return new Promise((resolve, reject) => {\n this.httpClient.request(token, (e, result) => {\n if (e) {\n cb && cb(e);\n reject(e);\n } else if (result) {\n if (!result.mainDocument) {\n cb && cb(null, defaultUrl);\n resolve(defaultUrl);\n } else {\n return this.getByID(result.mainDocument, { ref: token }).then((document) => {\n if (!document) {\n cb && cb(null, defaultUrl);\n resolve(defaultUrl);\n } else {\n const url = linkResolver(document);\n cb && cb(null, url);\n resolve(url);\n }\n }).catch(reject);\n }\n }\n });\n });\n }\n}\n","/**\n* A doubly linked list-based Least Recently Used (LRU) cache. Will keep most\n* recently used items while discarding least recently used items when its limit\n* is reached.\n*\n* Licensed under MIT. Copyright (c) 2010 Rasmus Andersson \n* Typescript-ified by Oleksandr Nikitin \n*\n* Illustration of the design:\n*\n* entry entry entry entry\n* ______ ______ ______ ______\n* | head |.newer => | |.newer => | |.newer => | tail |\n* | A | | B | | C | | D |\n* |______| <= older.|______| <= older.|______| <= older.|______|\n*\n* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added\n*/\n\nexport function MakeLRUCache(limit: number): ILRUCache {\n return new (LRUCache)(limit);\n}\n\nexport interface ILRUCache {\n put(key: string, value: any): void;\n get(key: string, Entry: boolean): any;\n remove(key: String): void;\n removeAll(): void;\n}\n\nfunction LRUCache(limit: number) {\n // Current size of the cache. (Read-only).\n this.size = 0;\n // Maximum number of items this cache can hold.\n this.limit = limit;\n this._keymap = {};\n}\n\ninterface IEntry {\n newer?: IEntry;\n older?: IEntry;\n key: string;\n value: any;\n}\n\n/**\n * Put into the cache associated with . Returns the entry which was\n * removed to make room for the new entry. Otherwise undefined is returned\n * (i.e. if there was enough room already).\n */\nLRUCache.prototype.put = function (key: string, value: any) {\n var entry: IEntry = { key: key, value: value };\n // Note: No protection agains replacing, and thus orphan entries. By design.\n this._keymap[key] = entry;\n if (this.tail) {\n // link previous tail to the new tail (entry)\n this.tail.newer = entry;\n entry.older = this.tail;\n } else {\n // we're first in -- yay\n this.head = entry;\n }\n // add new entry to the end of the linked list -- it's now the freshest entry.\n this.tail = entry;\n if (this.size === this.limit) {\n // we hit the limit -- remove the head\n return this.shift();\n } else {\n // increase the size counter\n this.size++;\n }\n};\n\n/**\n * Purge the least recently used (oldest) entry from the cache. Returns the\n * removed entry or undefined if the cache was empty.\n *\n * If you need to perform any form of finalization of purged items, this is a\n * good place to do it. Simply override/replace this function:\n *\n * var c = new LRUCache(123);\n * c.shift = function() {\n * var entry = LRUCache.prototype.shift.call(this);\n * doSomethingWith(entry);\n * return entry;\n * }\n */\nLRUCache.prototype.shift = function () {\n // todo: handle special case when limit == 1\n var entry = this.head;\n if (entry) {\n if (this.head.newer) {\n this.head = this.head.newer;\n this.head.older = undefined;\n } else {\n this.head = undefined;\n }\n // Remove last strong reference to and remove links from the purged\n // entry being returned:\n entry.newer = entry.older = undefined;\n // delete is slow, but we need to do this to avoid uncontrollable growth:\n delete this._keymap[entry.key];\n }\n console.log('purging ', entry.key);\n return entry;\n};\n\n/**\n * Get and register recent use of . Returns the value associated with \n * or undefined if not in cache.\n */\nLRUCache.prototype.get = function (key: string, returnEntry: boolean): any {\n // First, find our cache entry\n var entry = this._keymap[key];\n if (entry === undefined) return; // Not cached. Sorry.\n // As was found in the cache, register it as being requested recently\n if (entry === this.tail) {\n // Already the most recently used entry, so no need to update the list\n return returnEntry ? entry : entry.value;\n }\n // HEAD--------------TAIL\n // <.older .newer>\n // <--- add direction --\n // A B C E\n if (entry.newer) {\n if (entry === this.head)\n this.head = entry.newer;\n entry.newer.older = entry.older; // C <-- E.\n }\n if (entry.older)\n entry.older.newer = entry.newer; // C. --> E\n entry.newer = undefined; // D --x\n entry.older = this.tail; // D. --> E\n if (this.tail)\n this.tail.newer = entry; // E. <-- D\n this.tail = entry;\n return returnEntry ? entry : entry.value;\n};\n\n// ----------------------------------------------------------------------------\n// Following code is optional and can be removed without breaking the core\n// functionality.\n\n/**\n * Check if is in the cache without registering recent use. Feasible if\n * you do not want to chage the state of the cache, but only \"peek\" at it.\n * Returns the entry associated with if found, or undefined if not found.\n */\nLRUCache.prototype.find = function (key: string) {\n return this._keymap[key];\n};\n\n/**\n * Update the value of entry with . Returns the old value, or undefined if\n * entry was not in the cache.\n */\nLRUCache.prototype.set = function (key: string, value: any) {\n var oldvalue: any;\n var entry = this.get(key, true);\n if (entry) {\n oldvalue = entry.value;\n entry.value = value;\n } else {\n oldvalue = this.put(key, value);\n if (oldvalue) oldvalue = oldvalue.value;\n }\n return oldvalue;\n};\n\n/**\n * Remove entry from cache and return its value. Returns undefined if not\n * found.\n */\nLRUCache.prototype.remove = function (key: string) {\n var entry = this._keymap[key];\n if (!entry) return;\n delete this._keymap[entry.key]; // need to do delete unfortunately\n if (entry.newer && entry.older) {\n // relink the older entry with the newer entry\n entry.older.newer = entry.newer;\n entry.newer.older = entry.older;\n } else if (entry.newer) {\n // remove the link to us\n entry.newer.older = undefined;\n // link the newer entry to head\n this.head = entry.newer;\n } else if (entry.older) {\n // remove the link to us\n entry.older.newer = undefined;\n // link the newer entry to head\n this.tail = entry.older;\n } else {// if(entry.older === undefined && entry.newer === undefined) {\n this.head = this.tail = undefined;\n }\n\n this.size--;\n return entry.value;\n};\n\n/** Removes all entries */\nLRUCache.prototype.removeAll = function () {\n // This should be safe, as we never expose strong refrences to the outside\n this.head = this.tail = undefined;\n this.size = 0;\n this._keymap = {};\n};\n\n/**\n * Return an array containing all keys of entries stored in the cache object, in\n * arbitrary order.\n */\nif (typeof Object.keys === 'function') {\n LRUCache.prototype.keys = function () { return Object.keys(this._keymap); };\n} else {\n LRUCache.prototype.keys = function () {\n var keys: string[] = [];\n for (var k in this._keymap) keys.push(k);\n return keys;\n };\n}\n\n/**\n * Call `fun` for each entry. Starting with the newest entry if `desc` is a true\n * value, otherwise starts with the oldest (head) enrty and moves towards the\n * tail.\n *\n * `fun` is called with 3 arguments in the context `context`:\n * `fun.call(context, Object key, Object value, LRUCache self)`\n */\nLRUCache.prototype.forEach = function (fun: Function, context: any, desc: boolean) {\n var entry: IEntry | undefined;\n if (context === true) { desc = true; context = undefined; }\n else if (typeof context !== 'object') context = this;\n if (desc) {\n entry = this.tail;\n while (entry) {\n fun.call(context, entry.key, entry.value, this);\n entry = entry.older;\n }\n } else {\n entry = this.head;\n while (entry) {\n fun.call(context, entry.key, entry.value, this);\n entry = entry.newer;\n }\n }\n};\n\n/** Returns a JSON (array) representation */\n//LRUCache.prototype.toJSON = function () {\n// var s: IEntry[] = [], entry = this.head;\n// while (entry) {\n// s.push({ key: entry.key.toJSON(), value: entry.value.toJSON() });\n// entry = entry.newer;\n// }\n// return s;\n//};\n\n/** Returns a String representation */\nLRUCache.prototype.toString = function () {\n var s = '', entry = this.head;\n while (entry) {\n s += String(entry.key) + ':' + entry.value;\n entry = entry.newer;\n if (entry)\n s += ' < ';\n }\n return s;\n};\n\n// Export ourselves\n//if (typeof this === 'object') this.LRUCache = LRUCache;","import { ILRUCache, MakeLRUCache } from './lru';\n\nexport interface ApiCache {\n isExpired(key: String): boolean;\n get(key: string, cb: (error: Error | null, entry?: T) => void): void;\n set(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void;\n remove(key: string, cb?: (error: Error | null) => void): void;\n clear(cb?: (error: Error | null) => void): void;\n}\n\nexport class DefaultApiCache implements ApiCache {\n lru: ILRUCache;\n\n constructor(limit: number = 1000) {\n this.lru = MakeLRUCache(limit);\n }\n\n isExpired(key: string): boolean {\n const value = this.lru.get(key, false);\n if (value) {\n return value.expiredIn !== 0 && value.expiredIn < Date.now();\n } else {\n return false;\n }\n }\n\n get(key: string, cb: (error: Error | null, entry?: T) => void): void {\n const value = this.lru.get(key, false);\n if (value && !this.isExpired(key)) {\n cb(null, value.data);\n } else {\n cb && cb(null);\n }\n }\n\n set(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void {\n this.lru.remove(key);\n this.lru.put(key, {\n data: value,\n expiredIn: ttl ? (Date.now() + (ttl * 1000)) : 0,\n });\n cb && cb(null);\n }\n\n remove(key: string, cb?: (error: Error | null) => void): void {\n this.lru.remove(key);\n cb && cb(null);\n }\n\n clear(cb?: (error: Error | null) => void): void {\n this.lru.removeAll();\n cb && cb(null);\n }\n}\n","interface Task {\n url: string;\n callback: RequestCallback;\n}\n\ninterface NodeRequestInit extends RequestInit {\n agent?: any;\n}\n\nfunction fetchRequest(url: string, options: RequestHandlerOption, callback: RequestCallback): void {\n\n const fetchOptions = {\n headers: {\n Accept: 'application/json',\n },\n } as NodeRequestInit;\n\n if (options && options.proxyAgent) {\n fetchOptions.agent = options.proxyAgent;\n }\n\n fetch(url, fetchOptions).then((xhr) => {\n if (~~(xhr.status / 100 !== 2)) {\n /**\n * @description\n * drain the xhr before throwing an error to prevent memory leaks\n * @link https://github.com/bitinn/node-fetch/issues/83\n */\n return xhr.text().then(() => {\n const e: any = new Error(`Unexpected status code [${xhr.status}] on URL ${url}`);\n e.status = xhr.status;\n throw e;\n });\n }\n\n return xhr.json().then((result) => {\n const cacheControl = xhr.headers.get('cache-control');\n const parsedCacheControl = cacheControl ? /max-age=(\\d+)/.exec(cacheControl) : null;\n const ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined;\n\n callback(null, result, xhr, ttl);\n });\n }).catch(callback);\n}\n\nexport type RequestCallback = (error: Error | null, result?: T | null, xhr?: any, ttl?: number) => void;\n\nexport interface RequestHandlerOption {\n proxyAgent?: any;\n}\n\nexport interface RequestHandler {\n request(url: string, cb: RequestCallback): void;\n}\n\nexport class DefaultRequestHandler implements RequestHandler {\n\n options: RequestHandlerOption;\n\n constructor(options?: RequestHandlerOption) {\n this.options = options || {};\n }\n\n request(url: string, callback: RequestCallback): void {\n\n fetchRequest(url, this.options, callback);\n }\n}\n","import { ApiCache, DefaultApiCache } from './cache';\nimport { RequestHandler, DefaultRequestHandler, RequestCallback } from './request';\n\nexport interface HttpClientOptions {\n ttl?: number;\n cacheKey?: string;\n}\n\nexport default class HttpClient {\n\n private cache: ApiCache;\n private requestHandler: RequestHandler;\n\n constructor(requestHandler?: RequestHandler, cache?: ApiCache, proxyAgent?: any) {\n this.requestHandler = requestHandler || new DefaultRequestHandler({ proxyAgent });\n this.cache = cache || new DefaultApiCache();\n }\n\n request(url: string, callback?: RequestCallback): void {\n this.requestHandler.request(url, (err, result, xhr, ttl) => {\n if (err) {\n callback && callback(err, null, xhr, ttl);\n } else if (result) {\n callback && callback(null, result, xhr, ttl);\n }\n });\n }\n\n /**\n * Fetch a URL corresponding to a query, and parse the response as a Response object\n */\n cachedRequest(url: string, maybeOptions?: HttpClientOptions): Promise {\n const options = maybeOptions || {};\n const run = (cb: RequestCallback) => {\n const cacheKey = options.cacheKey || url;\n this.cache.get(cacheKey, (cacheGetError, cacheGetValue) => {\n if (cacheGetError || cacheGetValue) {\n cb(cacheGetError, cacheGetValue);\n } else {\n this.request(url, (fetchError, fetchValue, xhr, ttlReq) => {\n if (fetchError) {\n cb(fetchError, null);\n } else {\n const ttl = ttlReq || options.ttl;\n if (ttl) {\n this.cache.set(cacheKey, fetchValue, ttl, cb);\n }\n cb(null, fetchValue);\n }\n });\n }\n });\n };\n\n return new Promise((resolve, reject) => {\n run((err, value) => {\n if (err) reject(err);\n if (value) resolve(value);\n });\n });\n }\n}\n","import Predicates from './Predicates';\nimport { RequestHandler, RequestCallback } from './request';\nimport { Document } from './documents';\nimport { ApiCache } from './cache';\nimport ResolvedApi, { ApiData } from './ResolvedApi';\nimport HttpClient from './HttpClient';\n\nexport interface ApiOptions {\n accessToken?: string;\n requestHandler?: RequestHandler;\n req?: any;\n apiCache?: ApiCache;\n apiDataTTL?: number;\n proxyAgent?: any;\n}\n\nexport default class Api {\n url: string;\n options: ApiOptions;\n apiDataTTL: number;\n httpClient: HttpClient;\n\n constructor(url: string, options?: ApiOptions) {\n this.options = options || {};\n this.url = url;\n if (this.options.accessToken) {\n const accessTokenParam = `access_token=${this.options.accessToken}`;\n this.url += (url.indexOf('?') > -1 ? '&' : '?') + accessTokenParam;\n }\n this.apiDataTTL = this.options.apiDataTTL || 5;\n this.httpClient = new HttpClient(\n this.options.requestHandler,\n this.options.apiCache,\n this.options.proxyAgent,\n );\n }\n\n /**\n * Fetches data used to construct the api client, from cache if it's\n * present, otherwise from calling the prismic api endpoint (which is\n * then cached).\n */\n get(cb?: RequestCallback): Promise {\n return this.httpClient.cachedRequest(this.url, { ttl: this.apiDataTTL }).then((data) => {\n const resolvedApi = new ResolvedApi(data, this.httpClient, this.options);\n cb && cb(null, resolvedApi);\n return resolvedApi;\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","import { Document } from \"./documents\";\nimport ResolvedApi, { QueryOptions, EXPERIMENT_COOKIE, PREVIEW_COOKIE } from './ResolvedApi';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport { SearchForm, LazySearchForm } from './form';\nimport { Experiment } from './experiments';\nimport { RequestHandler, RequestCallback } from './request';\nimport Api, { ApiOptions } from './Api';\n\nexport interface Client {\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise;\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb: RequestCallback): Promise;\n getByID(id: string, options: QueryOptions, cb: RequestCallback): Promise;\n getByIDs(ids: string[], options: QueryOptions, cb: RequestCallback): Promise;\n getByUID(type: string, uid: string, options: QueryOptions, cb: RequestCallback): Promise;\n getSingle(type: string, options: QueryOptions, cb: RequestCallback): Promise;\n getBookmark(bookmark: string, options: QueryOptions, cb: RequestCallback): Promise;\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise;\n}\n\nexport class DefaultClient implements Client {\n\n api: Api;\n resolvedApi: ResolvedApi;\n\n constructor(url: string, options?: ApiOptions) {\n this.api = new Api(url, options);\n }\n\n getApi(): Promise {\n return this.api.get();\n }\n\n everything(): LazySearchForm {\n return this.form('everything');\n }\n\n form(formId: string): LazySearchForm {\n return new LazySearchForm(formId, this.api);\n }\n\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.query(q, optionsOrCallback, cb));\n }\n\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.queryFirst(q, optionsOrCallback, cb));\n }\n\n getByID(id: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByID(id, options, cb));\n }\n\n getByIDs(ids: string[], options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByIDs(ids, options, cb));\n }\n\n getByUID(type: string, uid: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByUID(type, uid, options, cb));\n }\n\n getSingle(type: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getSingle(type, options, cb));\n }\n\n getBookmark(bookmark: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getBookmark(bookmark, options, cb));\n }\n\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.previewSession(token, linkResolver, defaultUrl, cb));\n }\n\n static getApi(url: string, options?: ApiOptions): Promise {\n const api = new Api(url, options);\n return api.get();\n }\n}\n","import ResolvedApi, { EXPERIMENT_COOKIE as experimentCookie, PREVIEW_COOKIE as previewCookie } from './ResolvedApi';\nimport Predicates from './Predicates';\nimport { Experiments } from './experiments';\nimport Api, { ApiOptions } from './Api';\nimport { DefaultClient } from './client';\n\nexport {\n experimentCookie,\n previewCookie,\n Predicates,\n Experiments,\n Api\n};\n\nexport function client(url: string, options?: ApiOptions): DefaultClient {\n return new DefaultClient(url, options);\n}\n\nexport function getApi(url: string, options?: ApiOptions): Promise {\n return DefaultClient.getApi(url, options);\n}\n\nexport function api(url: string, options?: ApiOptions): Promise {\n return getApi(url, options);\n}"],"names":[],"mappings":";;;;;;IAAO;QAGL,mBAAY,IAAS;YAFrB,SAAI,GAAQ,EAAE,CAAC;YAGb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;SAClB;QAED,sBAAE,GAAF;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;SACrB;QAED,uBAAG,GAAH;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;SACtB;QAED,yBAAK,GAAL;YACE,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;SACxB;QACH,gBAAC;IAAD,CAAC,IAAA;IAEM;QAIL,oBAAY,IAAS;YAF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AC7C,IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;YAClC,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC;SAClB;QACH,oBAAC;IAAD,CAAC,IAAA;;aC9De,MAAM,CAAC,GAAW,EAAE,OAAoB;QACtD,OAAO,IAAI,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IACzC,CAAC;AAED,aAAgB,MAAM,CAAC,GAAW,EAAE,OAAoB;QACtD,OAAO,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC5C,CAAC;AAED,aAAgB,GAAG,CAAC,GAAW,EAAE,OAAoB;QACnD,OAAO,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;IAC9B,CAAC;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/prismic-javascript.browser.mjs b/dist/prismic-javascript.browser.mjs new file mode 100644 index 00000000..f1159b57 --- /dev/null +++ b/dist/prismic-javascript.browser.mjs @@ -0,0 +1,1180 @@ +var Variation = /** @class */ (function () { + function Variation(data) { + this.data = {}; + this.data = data; + } + Variation.prototype.id = function () { + return this.data.id; + }; + Variation.prototype.ref = function () { + return this.data.ref; + }; + Variation.prototype.label = function () { + return this.data.label; + }; + return Variation; +}()); +var Experiment = /** @class */ (function () { + function Experiment(data) { + this.data = {}; + this.data = data; + this.variations = (data.variations || []).map(function (v) { + return new Variation(v); + }); + } + Experiment.prototype.id = function () { + return this.data.id; + }; + Experiment.prototype.googleId = function () { + return this.data.googleId; + }; + Experiment.prototype.name = function () { + return this.data.name; + }; + return Experiment; +}()); +var Experiments = /** @class */ (function () { + function Experiments(data) { + if (data) { + this.drafts = (data.drafts || []).map(function (exp) { + return new Experiment(exp); + }); + this.running = (data.running || []).map(function (exp) { + return new Experiment(exp); + }); + } + } + Experiments.prototype.current = function () { + if (this.running.length > 0) { + return this.running[0]; + } + else { + return null; + } + }; + Experiments.prototype.refFromCookie = function (cookie) { + if (!cookie || cookie.trim() === '') + return null; + var splitted = cookie.trim().split(' '); + if (splitted.length < 2) + return null; + var expId = splitted[0]; + var varIndex = parseInt(splitted[1], 10); + var exp = this.running.filter(function (exp) { + return exp.googleId() === expId && exp.variations.length > varIndex; + })[0]; + return exp ? exp.variations[varIndex].ref() : null; + }; + return Experiments; +}()); + +var LazySearchForm = /** @class */ (function () { + function LazySearchForm(id, api) { + this.id = id; + this.api = api; + this.fields = {}; + } + LazySearchForm.prototype.set = function (key, value) { + this.fields[key] = value; + return this; + }; + LazySearchForm.prototype.ref = function (ref) { + return this.set('ref', ref); + }; + LazySearchForm.prototype.query = function (query) { + return this.set('q', query); + }; + LazySearchForm.prototype.pageSize = function (size) { + return this.set('pageSize', size); + }; + LazySearchForm.prototype.fetch = function (fields) { + console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.'); + return this.set('fetch', fields); + }; + LazySearchForm.prototype.fetchLinks = function (fields) { + console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.'); + return this.set('fetchLinks', fields); + }; + LazySearchForm.prototype.graphQuery = function (query) { + return this.set('graphQuery', query); + }; + LazySearchForm.prototype.lang = function (langCode) { + return this.set('lang', langCode); + }; + LazySearchForm.prototype.page = function (p) { + return this.set('page', p); + }; + LazySearchForm.prototype.after = function (documentId) { + return this.set('after', documentId); + }; + LazySearchForm.prototype.orderings = function (orderings) { + return this.set('orderings', orderings); + }; + LazySearchForm.prototype.url = function () { + var _this = this; + return this.api.get().then(function (api) { + return LazySearchForm.toSearchForm(_this, api).url(); + }); + }; + LazySearchForm.prototype.submit = function (cb) { + var _this = this; + return this.api.get().then(function (api) { + return LazySearchForm.toSearchForm(_this, api).submit(cb); + }); + }; + LazySearchForm.toSearchForm = function (lazyForm, api) { + var form = api.form(lazyForm.id); + if (form) { + return Object.keys(lazyForm.fields).reduce(function (form, fieldKey) { + var fieldValue = lazyForm.fields[fieldKey]; + if (fieldKey === 'q') { + return form.query(fieldValue); + } + else if (fieldKey === 'pageSize') { + return form.pageSize(fieldValue); + } + else if (fieldKey === 'fetch') { + return form.fetch(fieldValue); + } + else if (fieldKey === 'fetchLinks') { + return form.fetchLinks(fieldValue); + } + else if (fieldKey === 'graphQuery') { + return form.graphQuery(fieldValue); + } + else if (fieldKey === 'lang') { + return form.lang(fieldValue); + } + else if (fieldKey === 'page') { + return form.page(fieldValue); + } + else if (fieldKey === 'after') { + return form.after(fieldValue); + } + else if (fieldKey === 'orderings') { + return form.orderings(fieldValue); + } + else { + return form.set(fieldKey, fieldValue); + } + }, form); + } + else { + throw new Error("Unable to access to form " + lazyForm.id); + } + }; + return LazySearchForm; +}()); +var SearchForm = /** @class */ (function () { + function SearchForm(form, httpClient) { + this.httpClient = httpClient; + this.form = form; + this.data = {}; + for (var field in form.fields) { + if (form.fields[field]['default']) { + this.data[field] = [form.fields[field]['default']]; + } + } + } + SearchForm.prototype.set = function (field, value) { + var fieldDesc = this.form.fields[field]; + if (!fieldDesc) + throw new Error('Unknown field ' + field); + var checkedValue = value === '' || value === undefined ? null : value; + var values = this.data[field] || []; + if (fieldDesc.multiple) { + values = checkedValue ? values.concat([checkedValue]) : values; + } + else { + values = checkedValue ? [checkedValue] : values; + } + this.data[field] = values; + return this; + }; + /** + * Sets a ref to query on for this SearchForm. This is a mandatory + * method to call before calling submit(), and api.form('everything').submit() + * will not work. + */ + SearchForm.prototype.ref = function (ref) { + return this.set('ref', ref); + }; + /** + * Sets a predicate-based query for this SearchForm. This is where you + * paste what you compose in your prismic.io API browser. + */ + SearchForm.prototype.query = function (query) { + if (typeof query === 'string') { + return this.query([query]); + } + else if (Array.isArray(query)) { + return this.set('q', "[" + query.join('') + "]"); + } + else { + throw new Error("Invalid query : " + query); + } + }; + /** + * Sets a page size to query for this SearchForm. This is an optional method. + * + * @param {number} size - The page size + * @returns {SearchForm} - The SearchForm itself + */ + SearchForm.prototype.pageSize = function (size) { + return this.set('pageSize', size); + }; + /** + * Restrict the results document to the specified fields + */ + SearchForm.prototype.fetch = function (fields) { + console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.'); + var strFields = Array.isArray(fields) ? fields.join(',') : fields; + return this.set('fetch', strFields); + }; + /** + * Include the requested fields in the DocumentLink instances in the result + */ + SearchForm.prototype.fetchLinks = function (fields) { + console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.'); + var strFields = Array.isArray(fields) ? fields.join(',') : fields; + return this.set('fetchLinks', strFields); + }; + /** + * Sets the graphquery to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.graphQuery = function (query) { + return this.set('graphQuery', query); + }; + /** + * Sets the language to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.lang = function (langCode) { + return this.set('lang', langCode); + }; + /** + * Sets the page number to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.page = function (p) { + return this.set('page', p); + }; + /** + * Remove all the documents except for those after the specified document in the list. This is an optional method. + */ + SearchForm.prototype.after = function (documentId) { + return this.set('after', documentId); + }; + /** + * Sets the orderings to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.orderings = function (orderings) { + if (!orderings) { + return this; + } + else { + return this.set('orderings', "[" + orderings.join(',') + "]"); + } + }; + /** + * Build the URL to query + */ + SearchForm.prototype.url = function () { + var url = this.form.action; + if (this.data) { + var sep = (url.indexOf('?') > -1 ? '&' : '?'); + for (var key in this.data) { + if (this.data.hasOwnProperty(key)) { + var values = this.data[key]; + if (values) { + for (var i = 0; i < values.length; i++) { + url += sep + key + '=' + encodeURIComponent(values[i]); + sep = '&'; + } + } + } + } + } + return url; + }; + /** + * Submits the query, and calls the callback function. + */ + SearchForm.prototype.submit = function (cb) { + return this.httpClient.cachedRequest(this.url()).then(function (response) { + cb && cb(null, response); + return response; + }).catch(function (error) { + cb && cb(error); + throw error; + }); + }; + return SearchForm; +}()); + +var OPERATOR = { + at: 'at', + not: 'not', + missing: 'missing', + has: 'has', + any: 'any', + in: 'in', + fulltext: 'fulltext', + similar: 'similar', + numberGt: 'number.gt', + numberLt: 'number.lt', + numberInRange: 'number.inRange', + dateBefore: 'date.before', + dateAfter: 'date.after', + dateBetween: 'date.between', + dateDayOfMonth: 'date.day-of-month', + dateDayOfMonthAfter: 'date.day-of-month-after', + dateDayOfMonthBefore: 'date.day-of-month-before', + dateDayOfWeek: 'date.day-of-week', + dateDayOfWeekAfter: 'date.day-of-week-after', + dateDayOfWeekBefore: 'date.day-of-week-before', + dateMonth: 'date.month', + dateMonthBefore: 'date.month-before', + dateMonthAfter: 'date.month-after', + dateYear: 'date.year', + dateHour: 'date.hour', + dateHourBefore: 'date.hour-before', + dateHourAfter: 'date.hour-after', + GeopointNear: 'geopoint.near', +}; +function encode(value) { + if (typeof value === 'string') { + return "\"" + value + "\""; + } + else if (typeof value === 'number') { + return value.toString(); + } + else if (value instanceof Date) { + return value.getTime().toString(); + } + else if (Array.isArray(value)) { + return "[" + value.map(function (v) { return encode(v); }).join(',') + "]"; + } + else { + throw new Error("Unable to encode " + value + " of type " + typeof value); + } +} +var geopoint = { + near: function (fragment, latitude, longitude, radius) { + return "[" + OPERATOR.GeopointNear + "(" + fragment + ", " + latitude + ", " + longitude + ", " + radius + ")]"; + }, +}; +var date = { + before: function (fragment, before) { + return "[" + OPERATOR.dateBefore + "(" + fragment + ", " + encode(before) + ")]"; + }, + after: function (fragment, after) { + return "[" + OPERATOR.dateAfter + "(" + fragment + ", " + encode(after) + ")]"; + }, + between: function (fragment, before, after) { + return "[" + OPERATOR.dateBetween + "(" + fragment + ", " + encode(before) + ", " + encode(after) + ")]"; + }, + dayOfMonth: function (fragment, day) { + return "[" + OPERATOR.dateDayOfMonth + "(" + fragment + ", " + day + ")]"; + }, + dayOfMonthAfter: function (fragment, day) { + return "[" + OPERATOR.dateDayOfMonthAfter + "(" + fragment + ", " + day + ")]"; + }, + dayOfMonthBefore: function (fragment, day) { + return "[" + OPERATOR.dateDayOfMonthBefore + "(" + fragment + ", " + day + ")]"; + }, + dayOfWeek: function (fragment, day) { + return "[" + OPERATOR.dateDayOfWeek + "(" + fragment + ", " + encode(day) + ")]"; + }, + dayOfWeekAfter: function (fragment, day) { + return "[" + OPERATOR.dateDayOfWeekAfter + "(" + fragment + ", " + encode(day) + ")]"; + }, + dayOfWeekBefore: function (fragment, day) { + return "[" + OPERATOR.dateDayOfWeekBefore + "(" + fragment + ", " + encode(day) + ")]"; + }, + month: function (fragment, month) { + return "[" + OPERATOR.dateMonth + "(" + fragment + ", " + encode(month) + ")]"; + }, + monthBefore: function (fragment, month) { + return "[" + OPERATOR.dateMonthBefore + "(" + fragment + ", " + encode(month) + ")]"; + }, + monthAfter: function (fragment, month) { + return "[" + OPERATOR.dateMonthAfter + "(" + fragment + ", " + encode(month) + ")]"; + }, + year: function (fragment, year) { + return "[" + OPERATOR.dateYear + "(" + fragment + ", " + year + ")]"; + }, + hour: function (fragment, hour) { + return "[" + OPERATOR.dateHour + "(" + fragment + ", " + hour + ")]"; + }, + hourBefore: function (fragment, hour) { + return "[" + OPERATOR.dateHourBefore + "(" + fragment + ", " + hour + ")]"; + }, + hourAfter: function (fragment, hour) { + return "[" + OPERATOR.dateHourAfter + "(" + fragment + ", " + hour + ")]"; + }, +}; +var number = { + gt: function (fragment, value) { + return "[" + OPERATOR.numberGt + "(" + fragment + ", " + value + ")]"; + }, + lt: function (fragment, value) { + return "[" + OPERATOR.numberLt + "(" + fragment + ", " + value + ")]"; + }, + inRange: function (fragment, before, after) { + return "[" + OPERATOR.numberInRange + "(" + fragment + ", " + before + ", " + after + ")]"; + }, +}; +var Predicates = { + at: function (fragment, value) { + return "[" + OPERATOR.at + "(" + fragment + ", " + encode(value) + ")]"; + }, + not: function (fragment, value) { + return "[" + OPERATOR.not + "(" + fragment + ", " + encode(value) + ")]"; + }, + missing: function (fragment) { + return "[" + OPERATOR.missing + "(" + fragment + ")]"; + }, + has: function (fragment) { + return "[" + OPERATOR.has + "(" + fragment + ")]"; + }, + any: function (fragment, values) { + return "[" + OPERATOR.any + "(" + fragment + ", " + encode(values) + ")]"; + }, + in: function (fragment, values) { + return "[" + OPERATOR.in + "(" + fragment + ", " + encode(values) + ")]"; + }, + fulltext: function (fragment, value) { + return "[" + OPERATOR.fulltext + "(" + fragment + ", " + encode(value) + ")]"; + }, + similar: function (documentId, maxResults) { + return "[" + OPERATOR.similar + "(\"" + documentId + "\", " + maxResults + ")]"; + }, + date: date, + dateBefore: date.before, + dateAfter: date.after, + dateBetween: date.between, + dayOfMonth: date.dayOfMonth, + dayOfMonthAfter: date.dayOfMonthAfter, + dayOfMonthBefore: date.dayOfMonthBefore, + dayOfWeek: date.dayOfWeek, + dayOfWeekAfter: date.dayOfWeekAfter, + dayOfWeekBefore: date.dayOfWeekBefore, + month: date.month, + monthBefore: date.monthBefore, + monthAfter: date.monthAfter, + year: date.year, + hour: date.hour, + hourBefore: date.hourBefore, + hourAfter: date.hourAfter, + number: number, + gt: number.gt, + lt: number.lt, + inRange: number.inRange, + near: geopoint.near, + geopoint: geopoint, +}; + +// Some portions of code from https://github.com/jshttp/cookie +var decode = decodeURIComponent; +function tryDecode(str, decode) { + try { + return decode(str); + } + catch (e) { + return str; + } +} +function parse(str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string'); + } + var obj = {}; + var opt = options || {}; + var pairs = str.split(/; */); + var dec = opt.decode || decode; + pairs.forEach(function (pair) { + var eq_idx = pair.indexOf('='); + // skip things that don't look like key=value + if (eq_idx < 0) { + return; + } + var key = pair.substr(0, eq_idx).trim(); + var val = pair.substr(++eq_idx, pair.length).trim(); + // quoted values + if ('"' == val[0]) { + val = val.slice(1, -1); + } + // only assign once + if (undefined == obj[key]) { + obj[key] = tryDecode(val, dec); + } + }); + return obj; +} +var Cookies = { parse: parse }; + +var PREVIEW_COOKIE = 'io.prismic.preview'; +var EXPERIMENT_COOKIE = 'io.prismic.experiment'; +var ResolvedApi = /** @class */ (function () { + function ResolvedApi(data, httpClient, options) { + this.data = data; + this.masterRef = data.refs.filter(function (ref) { return ref.isMasterRef; })[0]; + this.experiments = new Experiments(data.experiments); + this.bookmarks = data.bookmarks; + this.httpClient = httpClient; + this.options = options; + this.refs = data.refs; + this.tags = data.tags; + this.types = data.types; + } + /** + * Returns a useable form from its id, as described in the RESTful description of the API. + * For instance: api.form("everything") works on every repository (as "everything" exists by default) + * You can then chain the calls: api.form("everything").query('[[:d = at(document.id, "UkL0gMuvzYUANCpf")]]').ref(ref).submit() + */ + ResolvedApi.prototype.form = function (formId) { + var form = this.data.forms[formId]; + if (form) { + return new SearchForm(form, this.httpClient); + } + return null; + }; + ResolvedApi.prototype.everything = function () { + var f = this.form('everything'); + if (!f) + throw new Error('Missing everything form'); + return f; + }; + /** + * The ID of the master ref on this prismic.io API. + * Do not use like this: searchForm.ref(api.master()). + * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page. + */ + ResolvedApi.prototype.master = function () { + return this.masterRef.ref; + }; + /** + * Returns the ref ID for a given ref's label. + * Do not use like this: searchForm.ref(api.ref("Future release label")). + * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page. + */ + ResolvedApi.prototype.ref = function (label) { + var ref = this.data.refs.filter(function (ref) { return ref.label === label; })[0]; + return ref ? ref.ref : null; + }; + ResolvedApi.prototype.currentExperiment = function () { + return this.experiments.current(); + }; + /** + * Query the repository + */ + ResolvedApi.prototype.query = function (q, optionsOrCallback, cb) { + if (cb === void 0) { cb = function () { }; } + var _a = typeof optionsOrCallback === 'function' + ? { options: {}, callback: optionsOrCallback } + : { options: optionsOrCallback || {}, callback: cb }, options = _a.options, callback = _a.callback; + var form = this.everything(); + for (var key in options) { + form = form.set(key, options[key]); + } + if (!options.ref) { + // Look in cookies if we have a ref (preview or experiment) + var cookieString = ''; + if (this.options.req) { // NodeJS + cookieString = this.options.req.headers['cookie'] || ''; + } + else if (typeof window !== 'undefined' && window.document) { // Browser + cookieString = window.document.cookie || ''; + } + var cookies = Cookies.parse(cookieString); + var previewRef = cookies[PREVIEW_COOKIE]; + var experimentRef = this.experiments.refFromCookie(cookies[EXPERIMENT_COOKIE]); + form = form.ref(previewRef || experimentRef || this.masterRef.ref); + } + if (q) { + form.query(q); + } + return form.submit(callback); + }; + /** + * Retrieve the document returned by the given query + * @param {string|array|Predicate} the query + * @param {object} additional parameters. In NodeJS, pass the request as 'req'. + * @param {function} callback(err, doc) + */ + ResolvedApi.prototype.queryFirst = function (q, optionsOrCallback, cb) { + var _a = typeof optionsOrCallback === 'function' + ? { options: {}, callback: optionsOrCallback } + : { options: optionsOrCallback || {}, callback: cb || (function () { }) }, options = _a.options, callback = _a.callback; + options.page = 1; + options.pageSize = 1; + return this.query(q, options).then(function (response) { + var document = response && response.results && response.results[0]; + callback(null, document); + return document; + }).catch(function (error) { + callback(error); + throw error; + }); + }; + /** + * Retrieve the document with the given id + */ + ResolvedApi.prototype.getByID = function (id, maybeOptions, cb) { + var options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.queryFirst(Predicates.at('document.id', id), options, cb); + }; + /** + * Retrieve multiple documents from an array of id + */ + ResolvedApi.prototype.getByIDs = function (ids, maybeOptions, cb) { + var options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.query(Predicates.in('document.id', ids), options, cb); + }; + /** + * Retrieve the document with the given uid + */ + ResolvedApi.prototype.getByUID = function (type, uid, maybeOptions, cb) { + var options = maybeOptions || {}; + if (options.lang === "*") + throw new Error("FORDIDDEN. You can't use getByUID with *, use the predicates instead."); + if (!options.page) + options.page = 1; + return this.queryFirst(Predicates.at("my." + type + ".uid", uid), options, cb); + }; + /** + * Retrieve the singleton document with the given type + */ + ResolvedApi.prototype.getSingle = function (type, maybeOptions, cb) { + var options = maybeOptions || {}; + return this.queryFirst(Predicates.at('document.type', type), options, cb); + }; + /** + * Retrieve the document with the given bookmark + */ + ResolvedApi.prototype.getBookmark = function (bookmark, maybeOptions, cb) { + var id = this.data.bookmarks[bookmark]; + if (id) { + return this.getByID(id, maybeOptions, cb); + } + else { + return Promise.reject('Error retrieving bookmarked id'); + } + }; + ResolvedApi.prototype.previewSession = function (token, linkResolver, defaultUrl, cb) { + var _this = this; + return new Promise(function (resolve, reject) { + _this.httpClient.request(token, function (e, result) { + if (e) { + cb && cb(e); + reject(e); + } + else if (result) { + if (!result.mainDocument) { + cb && cb(null, defaultUrl); + resolve(defaultUrl); + } + else { + return _this.getByID(result.mainDocument, { ref: token }).then(function (document) { + if (!document) { + cb && cb(null, defaultUrl); + resolve(defaultUrl); + } + else { + var url = linkResolver(document); + cb && cb(null, url); + resolve(url); + } + }).catch(reject); + } + } + }); + }); + }; + return ResolvedApi; +}()); + +/** +* A doubly linked list-based Least Recently Used (LRU) cache. Will keep most +* recently used items while discarding least recently used items when its limit +* is reached. +* +* Licensed under MIT. Copyright (c) 2010 Rasmus Andersson +* Typescript-ified by Oleksandr Nikitin +* +* Illustration of the design: +* +* entry entry entry entry +* ______ ______ ______ ______ +* | head |.newer => | |.newer => | |.newer => | tail | +* | A | | B | | C | | D | +* |______| <= older.|______| <= older.|______| <= older.|______| +* +* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added +*/ +function MakeLRUCache(limit) { + return new LRUCache(limit); +} +function LRUCache(limit) { + // Current size of the cache. (Read-only). + this.size = 0; + // Maximum number of items this cache can hold. + this.limit = limit; + this._keymap = {}; +} +/** + * Put into the cache associated with . Returns the entry which was + * removed to make room for the new entry. Otherwise undefined is returned + * (i.e. if there was enough room already). + */ +LRUCache.prototype.put = function (key, value) { + var entry = { key: key, value: value }; + // Note: No protection agains replacing, and thus orphan entries. By design. + this._keymap[key] = entry; + if (this.tail) { + // link previous tail to the new tail (entry) + this.tail.newer = entry; + entry.older = this.tail; + } + else { + // we're first in -- yay + this.head = entry; + } + // add new entry to the end of the linked list -- it's now the freshest entry. + this.tail = entry; + if (this.size === this.limit) { + // we hit the limit -- remove the head + return this.shift(); + } + else { + // increase the size counter + this.size++; + } +}; +/** + * Purge the least recently used (oldest) entry from the cache. Returns the + * removed entry or undefined if the cache was empty. + * + * If you need to perform any form of finalization of purged items, this is a + * good place to do it. Simply override/replace this function: + * + * var c = new LRUCache(123); + * c.shift = function() { + * var entry = LRUCache.prototype.shift.call(this); + * doSomethingWith(entry); + * return entry; + * } + */ +LRUCache.prototype.shift = function () { + // todo: handle special case when limit == 1 + var entry = this.head; + if (entry) { + if (this.head.newer) { + this.head = this.head.newer; + this.head.older = undefined; + } + else { + this.head = undefined; + } + // Remove last strong reference to and remove links from the purged + // entry being returned: + entry.newer = entry.older = undefined; + // delete is slow, but we need to do this to avoid uncontrollable growth: + delete this._keymap[entry.key]; + } + console.log('purging ', entry.key); + return entry; +}; +/** + * Get and register recent use of . Returns the value associated with + * or undefined if not in cache. + */ +LRUCache.prototype.get = function (key, returnEntry) { + // First, find our cache entry + var entry = this._keymap[key]; + if (entry === undefined) + return; // Not cached. Sorry. + // As was found in the cache, register it as being requested recently + if (entry === this.tail) { + // Already the most recently used entry, so no need to update the list + return returnEntry ? entry : entry.value; + } + // HEAD--------------TAIL + // <.older .newer> + // <--- add direction -- + // A B C E + if (entry.newer) { + if (entry === this.head) + this.head = entry.newer; + entry.newer.older = entry.older; // C <-- E. + } + if (entry.older) + entry.older.newer = entry.newer; // C. --> E + entry.newer = undefined; // D --x + entry.older = this.tail; // D. --> E + if (this.tail) + this.tail.newer = entry; // E. <-- D + this.tail = entry; + return returnEntry ? entry : entry.value; +}; +// ---------------------------------------------------------------------------- +// Following code is optional and can be removed without breaking the core +// functionality. +/** + * Check if is in the cache without registering recent use. Feasible if + * you do not want to chage the state of the cache, but only "peek" at it. + * Returns the entry associated with if found, or undefined if not found. + */ +LRUCache.prototype.find = function (key) { + return this._keymap[key]; +}; +/** + * Update the value of entry with . Returns the old value, or undefined if + * entry was not in the cache. + */ +LRUCache.prototype.set = function (key, value) { + var oldvalue; + var entry = this.get(key, true); + if (entry) { + oldvalue = entry.value; + entry.value = value; + } + else { + oldvalue = this.put(key, value); + if (oldvalue) + oldvalue = oldvalue.value; + } + return oldvalue; +}; +/** + * Remove entry from cache and return its value. Returns undefined if not + * found. + */ +LRUCache.prototype.remove = function (key) { + var entry = this._keymap[key]; + if (!entry) + return; + delete this._keymap[entry.key]; // need to do delete unfortunately + if (entry.newer && entry.older) { + // relink the older entry with the newer entry + entry.older.newer = entry.newer; + entry.newer.older = entry.older; + } + else if (entry.newer) { + // remove the link to us + entry.newer.older = undefined; + // link the newer entry to head + this.head = entry.newer; + } + else if (entry.older) { + // remove the link to us + entry.older.newer = undefined; + // link the newer entry to head + this.tail = entry.older; + } + else { // if(entry.older === undefined && entry.newer === undefined) { + this.head = this.tail = undefined; + } + this.size--; + return entry.value; +}; +/** Removes all entries */ +LRUCache.prototype.removeAll = function () { + // This should be safe, as we never expose strong refrences to the outside + this.head = this.tail = undefined; + this.size = 0; + this._keymap = {}; +}; +/** + * Return an array containing all keys of entries stored in the cache object, in + * arbitrary order. + */ +if (typeof Object.keys === 'function') { + LRUCache.prototype.keys = function () { return Object.keys(this._keymap); }; +} +else { + LRUCache.prototype.keys = function () { + var keys = []; + for (var k in this._keymap) + keys.push(k); + return keys; + }; +} +/** + * Call `fun` for each entry. Starting with the newest entry if `desc` is a true + * value, otherwise starts with the oldest (head) enrty and moves towards the + * tail. + * + * `fun` is called with 3 arguments in the context `context`: + * `fun.call(context, Object key, Object value, LRUCache self)` + */ +LRUCache.prototype.forEach = function (fun, context, desc) { + var entry; + if (context === true) { + desc = true; + context = undefined; + } + else if (typeof context !== 'object') + context = this; + if (desc) { + entry = this.tail; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.older; + } + } + else { + entry = this.head; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.newer; + } + } +}; +/** Returns a JSON (array) representation */ +//LRUCache.prototype.toJSON = function () { +// var s: IEntry[] = [], entry = this.head; +// while (entry) { +// s.push({ key: entry.key.toJSON(), value: entry.value.toJSON() }); +// entry = entry.newer; +// } +// return s; +//}; +/** Returns a String representation */ +LRUCache.prototype.toString = function () { + var s = '', entry = this.head; + while (entry) { + s += String(entry.key) + ':' + entry.value; + entry = entry.newer; + if (entry) + s += ' < '; + } + return s; +}; + +var DefaultApiCache = /** @class */ (function () { + function DefaultApiCache(limit) { + if (limit === void 0) { limit = 1000; } + this.lru = MakeLRUCache(limit); + } + DefaultApiCache.prototype.isExpired = function (key) { + var value = this.lru.get(key, false); + if (value) { + return value.expiredIn !== 0 && value.expiredIn < Date.now(); + } + else { + return false; + } + }; + DefaultApiCache.prototype.get = function (key, cb) { + var value = this.lru.get(key, false); + if (value && !this.isExpired(key)) { + cb(null, value.data); + } + else { + cb && cb(null); + } + }; + DefaultApiCache.prototype.set = function (key, value, ttl, cb) { + this.lru.remove(key); + this.lru.put(key, { + data: value, + expiredIn: ttl ? (Date.now() + (ttl * 1000)) : 0, + }); + cb && cb(null); + }; + DefaultApiCache.prototype.remove = function (key, cb) { + this.lru.remove(key); + cb && cb(null); + }; + DefaultApiCache.prototype.clear = function (cb) { + this.lru.removeAll(); + cb && cb(null); + }; + return DefaultApiCache; +}()); + +function fetchRequest(url, options, callback) { + var fetchOptions = { + headers: { + Accept: 'application/json', + }, + }; + if (options && options.proxyAgent) { + fetchOptions.agent = options.proxyAgent; + } + fetch(url, fetchOptions).then(function (xhr) { + if (~~(xhr.status / 100 !== 2)) { + /** + * @description + * drain the xhr before throwing an error to prevent memory leaks + * @link https://github.com/bitinn/node-fetch/issues/83 + */ + return xhr.text().then(function () { + var e = new Error("Unexpected status code [" + xhr.status + "] on URL " + url); + e.status = xhr.status; + throw e; + }); + } + return xhr.json().then(function (result) { + var cacheControl = xhr.headers.get('cache-control'); + var parsedCacheControl = cacheControl ? /max-age=(\d+)/.exec(cacheControl) : null; + var ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined; + callback(null, result, xhr, ttl); + }); + }).catch(callback); +} +var DefaultRequestHandler = /** @class */ (function () { + function DefaultRequestHandler(options) { + this.options = options || {}; + } + DefaultRequestHandler.prototype.request = function (url, callback) { + fetchRequest(url, this.options, callback); + }; + return DefaultRequestHandler; +}()); + +var HttpClient = /** @class */ (function () { + function HttpClient(requestHandler, cache, proxyAgent) { + this.requestHandler = requestHandler || new DefaultRequestHandler({ proxyAgent: proxyAgent }); + this.cache = cache || new DefaultApiCache(); + } + HttpClient.prototype.request = function (url, callback) { + this.requestHandler.request(url, function (err, result, xhr, ttl) { + if (err) { + callback && callback(err, null, xhr, ttl); + } + else if (result) { + callback && callback(null, result, xhr, ttl); + } + }); + }; + /** + * Fetch a URL corresponding to a query, and parse the response as a Response object + */ + HttpClient.prototype.cachedRequest = function (url, maybeOptions) { + var _this = this; + var options = maybeOptions || {}; + var run = function (cb) { + var cacheKey = options.cacheKey || url; + _this.cache.get(cacheKey, function (cacheGetError, cacheGetValue) { + if (cacheGetError || cacheGetValue) { + cb(cacheGetError, cacheGetValue); + } + else { + _this.request(url, function (fetchError, fetchValue, xhr, ttlReq) { + if (fetchError) { + cb(fetchError, null); + } + else { + var ttl = ttlReq || options.ttl; + if (ttl) { + _this.cache.set(cacheKey, fetchValue, ttl, cb); + } + cb(null, fetchValue); + } + }); + } + }); + }; + return new Promise(function (resolve, reject) { + run(function (err, value) { + if (err) + reject(err); + if (value) + resolve(value); + }); + }); + }; + return HttpClient; +}()); + +var Api = /** @class */ (function () { + function Api(url, options) { + this.options = options || {}; + this.url = url; + if (this.options.accessToken) { + var accessTokenParam = "access_token=" + this.options.accessToken; + this.url += (url.indexOf('?') > -1 ? '&' : '?') + accessTokenParam; + } + this.apiDataTTL = this.options.apiDataTTL || 5; + this.httpClient = new HttpClient(this.options.requestHandler, this.options.apiCache, this.options.proxyAgent); + } + /** + * Fetches data used to construct the api client, from cache if it's + * present, otherwise from calling the prismic api endpoint (which is + * then cached). + */ + Api.prototype.get = function (cb) { + var _this = this; + return this.httpClient.cachedRequest(this.url, { ttl: this.apiDataTTL }).then(function (data) { + var resolvedApi = new ResolvedApi(data, _this.httpClient, _this.options); + cb && cb(null, resolvedApi); + return resolvedApi; + }).catch(function (error) { + cb && cb(error); + throw error; + }); + }; + return Api; +}()); + +var DefaultClient = /** @class */ (function () { + function DefaultClient(url, options) { + this.api = new Api(url, options); + } + DefaultClient.prototype.getApi = function () { + return this.api.get(); + }; + DefaultClient.prototype.everything = function () { + return this.form('everything'); + }; + DefaultClient.prototype.form = function (formId) { + return new LazySearchForm(formId, this.api); + }; + DefaultClient.prototype.query = function (q, optionsOrCallback, cb) { + return this.getApi().then(function (api) { return api.query(q, optionsOrCallback, cb); }); + }; + DefaultClient.prototype.queryFirst = function (q, optionsOrCallback, cb) { + return this.getApi().then(function (api) { return api.queryFirst(q, optionsOrCallback, cb); }); + }; + DefaultClient.prototype.getByID = function (id, options, cb) { + return this.getApi().then(function (api) { return api.getByID(id, options, cb); }); + }; + DefaultClient.prototype.getByIDs = function (ids, options, cb) { + return this.getApi().then(function (api) { return api.getByIDs(ids, options, cb); }); + }; + DefaultClient.prototype.getByUID = function (type, uid, options, cb) { + return this.getApi().then(function (api) { return api.getByUID(type, uid, options, cb); }); + }; + DefaultClient.prototype.getSingle = function (type, options, cb) { + return this.getApi().then(function (api) { return api.getSingle(type, options, cb); }); + }; + DefaultClient.prototype.getBookmark = function (bookmark, options, cb) { + return this.getApi().then(function (api) { return api.getBookmark(bookmark, options, cb); }); + }; + DefaultClient.prototype.previewSession = function (token, linkResolver, defaultUrl, cb) { + return this.getApi().then(function (api) { return api.previewSession(token, linkResolver, defaultUrl, cb); }); + }; + DefaultClient.getApi = function (url, options) { + var api = new Api(url, options); + return api.get(); + }; + return DefaultClient; +}()); + +function client(url, options) { + return new DefaultClient(url, options); +} +function getApi(url, options) { + return DefaultClient.getApi(url, options); +} +function api(url, options) { + return getApi(url, options); +} + +export { EXPERIMENT_COOKIE as experimentCookie, PREVIEW_COOKIE as previewCookie, Predicates, Experiments, Api, client, getApi, api }; +//# sourceMappingURL=prismic-javascript.browser.mjs.map diff --git a/dist/prismic-javascript.browser.mjs.map b/dist/prismic-javascript.browser.mjs.map new file mode 100644 index 00000000..e3c43eeb --- /dev/null +++ b/dist/prismic-javascript.browser.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"prismic-javascript.browser.mjs","sources":["../src/experiments.ts","../src/form.ts","../src/Predicates.ts","../src/Cookies.ts","../src/ResolvedApi.ts","../src/lru.ts","../src/cache.ts","../src/request.ts","../src/HttpClient.ts","../src/Api.ts","../src/client.ts","../src/index.ts"],"sourcesContent":["export class Variation {\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n }\n\n id(): string {\n return this.data.id;\n }\n\n ref(): string {\n return this.data.ref;\n }\n\n label(): string {\n return this.data.label;\n }\n}\n\nexport class Experiment {\n variations: Variation[];\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n this.variations = (data.variations || []).map((v: any) => {\n return new Variation(v);\n });\n }\n\n id(): string {\n return this.data.id;\n }\n\n googleId(): string {\n return this.data.googleId;\n }\n\n name(): string {\n return this.data.name;\n }\n}\n\nexport class Experiments {\n drafts: Experiment[];\n running: Experiment[];\n\n constructor(data: any) {\n if (data) {\n this.drafts = (data.drafts || []).map((exp: any) => {\n return new Experiment(exp);\n });\n this.running = (data.running || []).map((exp: any) => {\n return new Experiment(exp);\n });\n }\n }\n\n current(): Experiment | null {\n if (this.running.length > 0) {\n return this.running[0];\n } else {\n return null;\n }\n }\n refFromCookie(cookie: string): string | null {\n if (!cookie || cookie.trim() === '') return null;\n const splitted = cookie.trim().split(' ');\n if (splitted.length < 2) return null;\n const expId = splitted[0];\n const varIndex = parseInt(splitted[1], 10);\n const exp = this.running.filter((exp) => {\n return exp.googleId() === expId && exp.variations.length > varIndex;\n })[0];\n return exp ? exp.variations[varIndex].ref() : null;\n }\n}\n","import Api from './Api';\nimport ResolvedApi from './ResolvedApi';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport HttpClient from './HttpClient';\nimport { RequestCallback } from './request';\n\nexport type Fields = { [key: string]: any };\n\nexport interface Form {\n fields: Fields;\n action: string;\n name: string;\n rel: string;\n form_method: string;\n enctype: string;\n}\n\nexport class LazySearchForm {\n id: string;\n fields: Fields;\n api: Api;\n\n constructor(id: string, api: Api) {\n this.id = id;\n this.api = api;\n this.fields = {};\n }\n\n set(key: string, value: any): LazySearchForm {\n this.fields[key] = value;\n return this;\n }\n\n ref(ref: string): LazySearchForm {\n return this.set('ref', ref);\n }\n\n query(query: string | string[]): LazySearchForm {\n return this.set('q', query);\n }\n\n pageSize(size: number): LazySearchForm {\n return this.set('pageSize', size);\n }\n\n fetch(fields: string | string[]): LazySearchForm {\n console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.');\n return this.set('fetch', fields);\n }\n\n fetchLinks(fields: string | string[]): LazySearchForm {\n console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.');\n return this.set('fetchLinks', fields);\n }\n\n graphQuery(query: string): LazySearchForm {\n return this.set('graphQuery', query);\n }\n\n lang(langCode: string): LazySearchForm {\n return this.set('lang', langCode);\n }\n\n page(p: number): LazySearchForm {\n return this.set('page', p);\n }\n\n after(documentId: string): LazySearchForm {\n return this.set('after', documentId);\n }\n\n orderings(orderings?: string[]): LazySearchForm {\n return this.set('orderings', orderings);\n }\n\n url(): Promise {\n return this.api.get().then((api) => {\n return LazySearchForm.toSearchForm(this, api).url();\n });\n }\n\n submit(cb: RequestCallback): Promise {\n return this.api.get().then((api) => {\n return LazySearchForm.toSearchForm(this, api).submit(cb);\n });\n }\n\n static toSearchForm(lazyForm: LazySearchForm, api: ResolvedApi): SearchForm {\n const form = api.form(lazyForm.id);\n if (form) {\n return Object.keys(lazyForm.fields).reduce((form, fieldKey) => {\n const fieldValue = lazyForm.fields[fieldKey];\n if (fieldKey === 'q') {\n return form.query(fieldValue);\n } else if (fieldKey === 'pageSize') {\n return form.pageSize(fieldValue);\n } else if (fieldKey === 'fetch') {\n return form.fetch(fieldValue);\n } else if (fieldKey === 'fetchLinks') {\n return form.fetchLinks(fieldValue);\n } else if (fieldKey === 'graphQuery') {\n return form.graphQuery(fieldValue);\n } else if (fieldKey === 'lang') {\n return form.lang(fieldValue);\n } else if (fieldKey === 'page') {\n return form.page(fieldValue);\n } else if (fieldKey === 'after') {\n return form.after(fieldValue);\n } else if (fieldKey === 'orderings') {\n return form.orderings(fieldValue);\n } else {\n return form.set(fieldKey, fieldValue);\n }\n }, form);\n } else {\n throw new Error(`Unable to access to form ${lazyForm.id}`);\n }\n }\n}\n\nexport class SearchForm {\n httpClient: HttpClient;\n form: Form;\n data: any;\n\n constructor(form: Form, httpClient: HttpClient) {\n this.httpClient = httpClient;\n this.form = form;\n\n this.data = {};\n for (const field in form.fields) {\n if (form.fields[field]['default']) {\n this.data[field] = [form.fields[field]['default']];\n }\n }\n }\n\n set(field: string, value: any): SearchForm {\n const fieldDesc = this.form.fields[field];\n if (!fieldDesc) throw new Error('Unknown field ' + field);\n const checkedValue = value === '' || value === undefined ? null : value;\n let values = this.data[field] || [];\n if (fieldDesc.multiple) {\n values = checkedValue ? values.concat([checkedValue]) : values;\n } else {\n values = checkedValue ? [checkedValue] : values;\n }\n this.data[field] = values;\n return this;\n }\n\n /**\n * Sets a ref to query on for this SearchForm. This is a mandatory\n * method to call before calling submit(), and api.form('everything').submit()\n * will not work.\n */\n ref(ref: string): SearchForm {\n return this.set('ref', ref);\n }\n\n /**\n * Sets a predicate-based query for this SearchForm. This is where you\n * paste what you compose in your prismic.io API browser.\n */\n query(query: string | string[]): SearchForm {\n if (typeof query === 'string') {\n return this.query([query]);\n } else if (Array.isArray(query)) {\n return this.set('q', `[${query.join('')}]`);\n } else {\n throw new Error(`Invalid query : ${query}`);\n }\n }\n\n /**\n * Sets a page size to query for this SearchForm. This is an optional method.\n *\n * @param {number} size - The page size\n * @returns {SearchForm} - The SearchForm itself\n */\n pageSize(size: number): SearchForm {\n return this.set('pageSize', size);\n }\n\n /**\n * Restrict the results document to the specified fields\n */\n fetch(fields: string | string[]): SearchForm {\n console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.');\n const strFields = Array.isArray(fields) ? fields.join(',') : fields;\n return this.set('fetch', strFields);\n }\n\n /**\n * Include the requested fields in the DocumentLink instances in the result\n */\n fetchLinks(fields: string | string[]): SearchForm {\n console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.');\n const strFields = Array.isArray(fields) ? fields.join(',') : fields;\n return this.set('fetchLinks', strFields);\n }\n\n /**\n * Sets the graphquery to query for this SearchForm. This is an optional method.\n */\n graphQuery(query: string): SearchForm {\n return this.set('graphQuery', query);\n }\n\n /**\n * Sets the language to query for this SearchForm. This is an optional method.\n */\n lang(langCode: string): SearchForm {\n return this.set('lang', langCode);\n }\n\n /**\n * Sets the page number to query for this SearchForm. This is an optional method.\n */\n page(p: number): SearchForm {\n return this.set('page', p);\n }\n\n /**\n * Remove all the documents except for those after the specified document in the list. This is an optional method.\n */\n after(documentId: string): SearchForm {\n return this.set('after', documentId);\n }\n\n /**\n * Sets the orderings to query for this SearchForm. This is an optional method.\n */\n orderings(orderings ?: string[]): SearchForm {\n if (!orderings) {\n return this;\n } else {\n return this.set('orderings', `[${orderings.join(',')}]`);\n }\n }\n\n /**\n * Build the URL to query\n */\n url(): string {\n let url = this.form.action;\n if (this.data) {\n let sep = (url.indexOf('?') > -1 ? '&' : '?');\n for (const key in this.data) {\n if (this.data.hasOwnProperty(key)) {\n const values = this.data[key];\n if (values) {\n for (let i = 0; i < values.length; i++) {\n url += sep + key + '=' + encodeURIComponent(values[i]);\n sep = '&';\n }\n }\n }\n }\n }\n return url;\n }\n\n /**\n * Submits the query, and calls the callback function.\n */\n submit(cb: RequestCallback): Promise {\n return this.httpClient.cachedRequest(this.url()).then((response) => {\n cb && cb(null, response);\n return response;\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","const OPERATOR = {\n at: 'at',\n not: 'not',\n missing: 'missing',\n has: 'has',\n any: 'any',\n in: 'in',\n fulltext: 'fulltext',\n similar: 'similar',\n numberGt: 'number.gt',\n numberLt: 'number.lt',\n numberInRange: 'number.inRange',\n dateBefore: 'date.before',\n dateAfter: 'date.after',\n dateBetween: 'date.between',\n dateDayOfMonth: 'date.day-of-month',\n dateDayOfMonthAfter: 'date.day-of-month-after',\n dateDayOfMonthBefore: 'date.day-of-month-before',\n dateDayOfWeek: 'date.day-of-week',\n dateDayOfWeekAfter: 'date.day-of-week-after',\n dateDayOfWeekBefore: 'date.day-of-week-before',\n dateMonth: 'date.month',\n dateMonthBefore: 'date.month-before',\n dateMonthAfter: 'date.month-after',\n dateYear: 'date.year',\n dateHour: 'date.hour',\n dateHourBefore: 'date.hour-before',\n dateHourAfter: 'date.hour-after',\n GeopointNear: 'geopoint.near',\n};\n\ntype PredicateValue = string | number | Date;\n\nfunction encode(value: PredicateValue | PredicateValue[]): string {\n if (typeof value === 'string') {\n return `\"${value}\"`;\n } else if (typeof value === 'number') {\n return value.toString();\n } else if (value instanceof Date) {\n return value.getTime().toString();\n } else if (Array.isArray(value)) {\n return `[${value.map(v => encode(v)).join(',')}]`;\n } else {\n throw new Error(`Unable to encode ${value} of type ${typeof value}`);\n }\n}\n\nconst geopoint = {\n near(fragment: string, latitude: number, longitude: number, radius: number): string {\n return `[${OPERATOR.GeopointNear}(${fragment}, ${latitude}, ${longitude}, ${radius})]`;\n },\n};\n\nconst date = {\n\n before(fragment: string, before: PredicateValue): string {\n return `[${OPERATOR.dateBefore}(${fragment}, ${encode(before)})]`;\n },\n\n after(fragment: string, after: PredicateValue): string {\n return `[${OPERATOR.dateAfter}(${fragment}, ${encode(after)})]`;\n },\n\n between(fragment: string, before: PredicateValue, after: PredicateValue): string {\n return `[${OPERATOR.dateBetween}(${fragment}, ${encode(before)}, ${encode(after)})]`;\n },\n\n dayOfMonth(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonth}(${fragment}, ${day})]`;\n },\n\n dayOfMonthAfter(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonthAfter}(${fragment}, ${day})]`;\n },\n\n dayOfMonthBefore(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonthBefore}(${fragment}, ${day})]`;\n },\n\n dayOfWeek(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeek}(${fragment}, ${encode(day)})]`;\n },\n\n dayOfWeekAfter(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeekAfter}(${fragment}, ${encode(day)})]`;\n },\n\n dayOfWeekBefore(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeekBefore}(${fragment}, ${encode(day)})]`;\n },\n\n month(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonth}(${fragment}, ${encode(month)})]`;\n },\n\n monthBefore(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonthBefore}(${fragment}, ${encode(month)})]`;\n },\n\n monthAfter(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonthAfter}(${fragment}, ${encode(month)})]`;\n },\n\n year(fragment: string, year: number): string {\n return `[${OPERATOR.dateYear}(${fragment}, ${year})]`;\n },\n\n hour(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHour}(${fragment}, ${hour})]`;\n },\n\n hourBefore(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHourBefore}(${fragment}, ${hour})]`;\n },\n\n hourAfter(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHourAfter}(${fragment}, ${hour})]`;\n },\n};\n\nconst number = {\n gt(fragment: string, value: number): string {\n return `[${OPERATOR.numberGt}(${fragment}, ${value})]`;\n },\n\n lt(fragment: string, value: number): string {\n return `[${OPERATOR.numberLt}(${fragment}, ${value})]`;\n },\n\n inRange(fragment: string, before: number, after: number): string {\n return `[${OPERATOR.numberInRange}(${fragment}, ${before}, ${after})]`;\n },\n};\n\nexport default {\n at(fragment: string, value: PredicateValue | PredicateValue[]): string {\n return `[${OPERATOR.at}(${fragment}, ${encode(value)})]`;\n },\n\n not(fragment: string, value: PredicateValue | PredicateValue[]): string {\n return `[${OPERATOR.not}(${fragment}, ${encode(value)})]`;\n },\n\n missing(fragment: string): string {\n return `[${OPERATOR.missing}(${fragment})]`;\n },\n\n has(fragment: string): string {\n return `[${OPERATOR.has}(${fragment})]`;\n },\n\n any(fragment: string, values: PredicateValue[]): string {\n return `[${OPERATOR.any}(${fragment}, ${encode(values)})]`;\n },\n\n in(fragment: string, values: string[]): string {\n return `[${OPERATOR.in}(${fragment}, ${encode(values)})]`;\n },\n\n fulltext(fragment: string, value: string): string {\n return `[${OPERATOR.fulltext}(${fragment}, ${encode(value)})]`;\n },\n\n similar(documentId: string, maxResults: number): string {\n return `[${OPERATOR.similar}(\"${documentId}\", ${maxResults})]`;\n },\n\n date,\n\n dateBefore: date.before,\n\n dateAfter: date.after,\n\n dateBetween: date.between,\n\n dayOfMonth: date.dayOfMonth,\n\n dayOfMonthAfter: date.dayOfMonthAfter,\n\n dayOfMonthBefore: date.dayOfMonthBefore,\n\n dayOfWeek: date.dayOfWeek,\n\n dayOfWeekAfter: date.dayOfWeekAfter,\n\n dayOfWeekBefore: date.dayOfWeekBefore,\n\n month: date.month,\n\n monthBefore: date.monthBefore,\n\n monthAfter: date.monthAfter,\n\n year: date.year,\n\n hour: date.hour,\n\n hourBefore: date.hourBefore,\n\n hourAfter: date.hourAfter,\n\n number,\n\n gt: number.gt,\n\n lt: number.lt,\n\n inRange: number.inRange,\n\n near: geopoint.near,\n\n geopoint,\n};\n","export interface Cookie {\n [key: string]: string;\n value: string;\n}\n\n// Some portions of code from https://github.com/jshttp/cookie\n\nvar decode = decodeURIComponent;\n\nfunction tryDecode(str: string, decode: (str: string) => string) {\n try {\n return decode(str);\n } catch (e) {\n return str;\n }\n}\n\nfunction parse(str: string, options?: any) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string');\n }\n\n var obj = {};\n var opt = options || {};\n var pairs = str.split(/; */);\n var dec = opt.decode || decode;\n\n pairs.forEach(function(pair) {\n var eq_idx = pair.indexOf('=');\n\n // skip things that don't look like key=value\n if (eq_idx < 0) {\n return;\n }\n\n var key = pair.substr(0, eq_idx).trim();\n var val = pair.substr(++eq_idx, pair.length).trim();\n\n // quoted values\n if ('\"' == val[0]) {\n val = val.slice(1, -1);\n }\n\n // only assign once\n if (undefined == obj[key]) {\n obj[key] = tryDecode(val, dec);\n }\n });\n\n return obj;\n}\n\nexport default { parse };\n","import { Document } from \"./documents\";\nimport { RequestHandler, RequestCallback } from './request';\nimport { ApiCache } from './cache';\nimport { Experiment, Experiments } from './experiments';\nimport { SearchForm, Form } from './form';\nimport Predicates from './Predicates';\nimport Cookies from './Cookies';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport HttpClient from './HttpClient';\nimport { Client } from './client';\n\nexport const PREVIEW_COOKIE = 'io.prismic.preview';\nexport const EXPERIMENT_COOKIE = 'io.prismic.experiment';\n\nexport interface Ref {\n ref: string;\n label: string;\n isMasterRef: boolean;\n scheduledAt: string;\n id: string;\n}\n\nexport interface ApiData {\n refs: Ref[];\n bookmarks: { [key: string]: string };\n types: { [key: string]: string };\n tags: string[];\n forms: { [key: string]: Form };\n experiments: any;\n oauth_initiate: string;\n oauth_token: string;\n version: string;\n licence: string;\n}\n\nexport interface PreviewResponse {\n mainDocument?: string;\n}\n\nexport interface QueryOptions {\n [key: string]: string | number | string[];\n}\n\nexport interface ResolvedApiOptions {\n req?: any;\n}\n\nexport default class ResolvedApi implements Client {\n data: ApiData;\n masterRef: Ref;\n experiments: Experiments;\n options: ResolvedApiOptions;\n httpClient: HttpClient;\n bookmarks: { [key: string]: string };\n refs: Ref[];\n tags: string[];\n types: { [key: string]: string };\n\n constructor(data: ApiData, httpClient: HttpClient, options: ResolvedApiOptions) {\n this.data = data;\n this.masterRef = data.refs.filter(ref => ref.isMasterRef)[0];\n this.experiments = new Experiments(data.experiments);\n this.bookmarks = data.bookmarks;\n this.httpClient = httpClient;\n this.options = options;\n this.refs = data.refs;\n this.tags = data.tags;\n this.types = data.types;\n }\n\n /**\n * Returns a useable form from its id, as described in the RESTful description of the API.\n * For instance: api.form(\"everything\") works on every repository (as \"everything\" exists by default)\n * You can then chain the calls: api.form(\"everything\").query('[[:d = at(document.id, \"UkL0gMuvzYUANCpf\")]]').ref(ref).submit()\n */\n form(formId: string): SearchForm | null {\n const form = this.data.forms[formId];\n if (form) {\n return new SearchForm(form, this.httpClient);\n }\n return null;\n }\n\n everything(): SearchForm {\n const f = this.form('everything');\n if (!f) throw new Error('Missing everything form');\n return f;\n }\n\n /**\n * The ID of the master ref on this prismic.io API.\n * Do not use like this: searchForm.ref(api.master()).\n * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.\n */\n master(): string {\n return this.masterRef.ref;\n }\n\n /**\n * Returns the ref ID for a given ref's label.\n * Do not use like this: searchForm.ref(api.ref(\"Future release label\")).\n * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.\n */\n ref(label: string): string | null {\n const ref = this.data.refs.filter(ref => ref.label === label)[0];\n return ref ? ref.ref : null;\n }\n\n currentExperiment(): Experiment | null {\n return this.experiments.current();\n }\n\n /**\n * Query the repository\n */\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb: RequestCallback = () => {}): Promise {\n const { options, callback } = typeof optionsOrCallback === 'function'\n ? { options: {} as QueryOptions, callback: optionsOrCallback }\n : { options: optionsOrCallback || {}, callback: cb };\n\n let form = this.everything();\n for (const key in options) {\n form = form.set(key, options[key]);\n }\n if (!options.ref) {\n // Look in cookies if we have a ref (preview or experiment)\n let cookieString = '';\n if (this.options.req) { // NodeJS\n cookieString = this.options.req.headers['cookie'] || '';\n } else if (typeof window !== 'undefined' && window.document) { // Browser\n cookieString = window.document.cookie || '';\n }\n const cookies = Cookies.parse(cookieString);\n const previewRef = cookies[PREVIEW_COOKIE];\n const experimentRef = this.experiments.refFromCookie(cookies[EXPERIMENT_COOKIE]);\n form = form.ref(previewRef || experimentRef || this.masterRef.ref);\n }\n if (q) {\n form.query(q);\n }\n return form.submit(callback);\n }\n\n /**\n * Retrieve the document returned by the given query\n * @param {string|array|Predicate} the query\n * @param {object} additional parameters. In NodeJS, pass the request as 'req'.\n * @param {function} callback(err, doc)\n */\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n const { options, callback } = typeof optionsOrCallback === 'function'\n ? { options: {} as QueryOptions, callback: optionsOrCallback }\n : { options: optionsOrCallback || {}, callback: cb || (() => {}) };\n\n options.page = 1;\n options.pageSize = 1;\n\n return this.query(q, options).then((response) => {\n const document = response && response.results && response.results[0];\n callback(null, document);\n return document;\n }).catch((error) => {\n callback(error);\n throw error;\n });\n }\n\n /**\n * Retrieve the document with the given id\n */\n getByID(id: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.queryFirst(Predicates.at('document.id', id), options, cb);\n }\n\n /**\n * Retrieve multiple documents from an array of id\n */\n getByIDs(ids: string[], maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.query(Predicates.in('document.id', ids), options, cb);\n }\n\n /**\n * Retrieve the document with the given uid\n */\n getByUID(type: string, uid: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if(options.lang === \"*\") throw new Error(\"FORDIDDEN. You can't use getByUID with *, use the predicates instead.\")\n if(!options.page) options.page = 1;\n\n return this.queryFirst(Predicates.at(`my.${type}.uid`, uid), options, cb);\n }\n\n /**\n * Retrieve the singleton document with the given type\n */\n getSingle(type: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n return this.queryFirst(Predicates.at('document.type', type), options, cb);\n }\n\n /**\n * Retrieve the document with the given bookmark\n */\n getBookmark(bookmark: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const id = this.data.bookmarks[bookmark];\n if (id) {\n return this.getByID(id, maybeOptions, cb);\n } else {\n return Promise.reject('Error retrieving bookmarked id');\n }\n }\n\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise {\n return new Promise((resolve, reject) => {\n this.httpClient.request(token, (e, result) => {\n if (e) {\n cb && cb(e);\n reject(e);\n } else if (result) {\n if (!result.mainDocument) {\n cb && cb(null, defaultUrl);\n resolve(defaultUrl);\n } else {\n return this.getByID(result.mainDocument, { ref: token }).then((document) => {\n if (!document) {\n cb && cb(null, defaultUrl);\n resolve(defaultUrl);\n } else {\n const url = linkResolver(document);\n cb && cb(null, url);\n resolve(url);\n }\n }).catch(reject);\n }\n }\n });\n });\n }\n}\n","/**\n* A doubly linked list-based Least Recently Used (LRU) cache. Will keep most\n* recently used items while discarding least recently used items when its limit\n* is reached.\n*\n* Licensed under MIT. Copyright (c) 2010 Rasmus Andersson \n* Typescript-ified by Oleksandr Nikitin \n*\n* Illustration of the design:\n*\n* entry entry entry entry\n* ______ ______ ______ ______\n* | head |.newer => | |.newer => | |.newer => | tail |\n* | A | | B | | C | | D |\n* |______| <= older.|______| <= older.|______| <= older.|______|\n*\n* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added\n*/\n\nexport function MakeLRUCache(limit: number): ILRUCache {\n return new (LRUCache)(limit);\n}\n\nexport interface ILRUCache {\n put(key: string, value: any): void;\n get(key: string, Entry: boolean): any;\n remove(key: String): void;\n removeAll(): void;\n}\n\nfunction LRUCache(limit: number) {\n // Current size of the cache. (Read-only).\n this.size = 0;\n // Maximum number of items this cache can hold.\n this.limit = limit;\n this._keymap = {};\n}\n\ninterface IEntry {\n newer?: IEntry;\n older?: IEntry;\n key: string;\n value: any;\n}\n\n/**\n * Put into the cache associated with . Returns the entry which was\n * removed to make room for the new entry. Otherwise undefined is returned\n * (i.e. if there was enough room already).\n */\nLRUCache.prototype.put = function (key: string, value: any) {\n var entry: IEntry = { key: key, value: value };\n // Note: No protection agains replacing, and thus orphan entries. By design.\n this._keymap[key] = entry;\n if (this.tail) {\n // link previous tail to the new tail (entry)\n this.tail.newer = entry;\n entry.older = this.tail;\n } else {\n // we're first in -- yay\n this.head = entry;\n }\n // add new entry to the end of the linked list -- it's now the freshest entry.\n this.tail = entry;\n if (this.size === this.limit) {\n // we hit the limit -- remove the head\n return this.shift();\n } else {\n // increase the size counter\n this.size++;\n }\n};\n\n/**\n * Purge the least recently used (oldest) entry from the cache. Returns the\n * removed entry or undefined if the cache was empty.\n *\n * If you need to perform any form of finalization of purged items, this is a\n * good place to do it. Simply override/replace this function:\n *\n * var c = new LRUCache(123);\n * c.shift = function() {\n * var entry = LRUCache.prototype.shift.call(this);\n * doSomethingWith(entry);\n * return entry;\n * }\n */\nLRUCache.prototype.shift = function () {\n // todo: handle special case when limit == 1\n var entry = this.head;\n if (entry) {\n if (this.head.newer) {\n this.head = this.head.newer;\n this.head.older = undefined;\n } else {\n this.head = undefined;\n }\n // Remove last strong reference to and remove links from the purged\n // entry being returned:\n entry.newer = entry.older = undefined;\n // delete is slow, but we need to do this to avoid uncontrollable growth:\n delete this._keymap[entry.key];\n }\n console.log('purging ', entry.key);\n return entry;\n};\n\n/**\n * Get and register recent use of . Returns the value associated with \n * or undefined if not in cache.\n */\nLRUCache.prototype.get = function (key: string, returnEntry: boolean): any {\n // First, find our cache entry\n var entry = this._keymap[key];\n if (entry === undefined) return; // Not cached. Sorry.\n // As was found in the cache, register it as being requested recently\n if (entry === this.tail) {\n // Already the most recently used entry, so no need to update the list\n return returnEntry ? entry : entry.value;\n }\n // HEAD--------------TAIL\n // <.older .newer>\n // <--- add direction --\n // A B C E\n if (entry.newer) {\n if (entry === this.head)\n this.head = entry.newer;\n entry.newer.older = entry.older; // C <-- E.\n }\n if (entry.older)\n entry.older.newer = entry.newer; // C. --> E\n entry.newer = undefined; // D --x\n entry.older = this.tail; // D. --> E\n if (this.tail)\n this.tail.newer = entry; // E. <-- D\n this.tail = entry;\n return returnEntry ? entry : entry.value;\n};\n\n// ----------------------------------------------------------------------------\n// Following code is optional and can be removed without breaking the core\n// functionality.\n\n/**\n * Check if is in the cache without registering recent use. Feasible if\n * you do not want to chage the state of the cache, but only \"peek\" at it.\n * Returns the entry associated with if found, or undefined if not found.\n */\nLRUCache.prototype.find = function (key: string) {\n return this._keymap[key];\n};\n\n/**\n * Update the value of entry with . Returns the old value, or undefined if\n * entry was not in the cache.\n */\nLRUCache.prototype.set = function (key: string, value: any) {\n var oldvalue: any;\n var entry = this.get(key, true);\n if (entry) {\n oldvalue = entry.value;\n entry.value = value;\n } else {\n oldvalue = this.put(key, value);\n if (oldvalue) oldvalue = oldvalue.value;\n }\n return oldvalue;\n};\n\n/**\n * Remove entry from cache and return its value. Returns undefined if not\n * found.\n */\nLRUCache.prototype.remove = function (key: string) {\n var entry = this._keymap[key];\n if (!entry) return;\n delete this._keymap[entry.key]; // need to do delete unfortunately\n if (entry.newer && entry.older) {\n // relink the older entry with the newer entry\n entry.older.newer = entry.newer;\n entry.newer.older = entry.older;\n } else if (entry.newer) {\n // remove the link to us\n entry.newer.older = undefined;\n // link the newer entry to head\n this.head = entry.newer;\n } else if (entry.older) {\n // remove the link to us\n entry.older.newer = undefined;\n // link the newer entry to head\n this.tail = entry.older;\n } else {// if(entry.older === undefined && entry.newer === undefined) {\n this.head = this.tail = undefined;\n }\n\n this.size--;\n return entry.value;\n};\n\n/** Removes all entries */\nLRUCache.prototype.removeAll = function () {\n // This should be safe, as we never expose strong refrences to the outside\n this.head = this.tail = undefined;\n this.size = 0;\n this._keymap = {};\n};\n\n/**\n * Return an array containing all keys of entries stored in the cache object, in\n * arbitrary order.\n */\nif (typeof Object.keys === 'function') {\n LRUCache.prototype.keys = function () { return Object.keys(this._keymap); };\n} else {\n LRUCache.prototype.keys = function () {\n var keys: string[] = [];\n for (var k in this._keymap) keys.push(k);\n return keys;\n };\n}\n\n/**\n * Call `fun` for each entry. Starting with the newest entry if `desc` is a true\n * value, otherwise starts with the oldest (head) enrty and moves towards the\n * tail.\n *\n * `fun` is called with 3 arguments in the context `context`:\n * `fun.call(context, Object key, Object value, LRUCache self)`\n */\nLRUCache.prototype.forEach = function (fun: Function, context: any, desc: boolean) {\n var entry: IEntry | undefined;\n if (context === true) { desc = true; context = undefined; }\n else if (typeof context !== 'object') context = this;\n if (desc) {\n entry = this.tail;\n while (entry) {\n fun.call(context, entry.key, entry.value, this);\n entry = entry.older;\n }\n } else {\n entry = this.head;\n while (entry) {\n fun.call(context, entry.key, entry.value, this);\n entry = entry.newer;\n }\n }\n};\n\n/** Returns a JSON (array) representation */\n//LRUCache.prototype.toJSON = function () {\n// var s: IEntry[] = [], entry = this.head;\n// while (entry) {\n// s.push({ key: entry.key.toJSON(), value: entry.value.toJSON() });\n// entry = entry.newer;\n// }\n// return s;\n//};\n\n/** Returns a String representation */\nLRUCache.prototype.toString = function () {\n var s = '', entry = this.head;\n while (entry) {\n s += String(entry.key) + ':' + entry.value;\n entry = entry.newer;\n if (entry)\n s += ' < ';\n }\n return s;\n};\n\n// Export ourselves\n//if (typeof this === 'object') this.LRUCache = LRUCache;","import { ILRUCache, MakeLRUCache } from './lru';\n\nexport interface ApiCache {\n isExpired(key: String): boolean;\n get(key: string, cb: (error: Error | null, entry?: T) => void): void;\n set(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void;\n remove(key: string, cb?: (error: Error | null) => void): void;\n clear(cb?: (error: Error | null) => void): void;\n}\n\nexport class DefaultApiCache implements ApiCache {\n lru: ILRUCache;\n\n constructor(limit: number = 1000) {\n this.lru = MakeLRUCache(limit);\n }\n\n isExpired(key: string): boolean {\n const value = this.lru.get(key, false);\n if (value) {\n return value.expiredIn !== 0 && value.expiredIn < Date.now();\n } else {\n return false;\n }\n }\n\n get(key: string, cb: (error: Error | null, entry?: T) => void): void {\n const value = this.lru.get(key, false);\n if (value && !this.isExpired(key)) {\n cb(null, value.data);\n } else {\n cb && cb(null);\n }\n }\n\n set(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void {\n this.lru.remove(key);\n this.lru.put(key, {\n data: value,\n expiredIn: ttl ? (Date.now() + (ttl * 1000)) : 0,\n });\n cb && cb(null);\n }\n\n remove(key: string, cb?: (error: Error | null) => void): void {\n this.lru.remove(key);\n cb && cb(null);\n }\n\n clear(cb?: (error: Error | null) => void): void {\n this.lru.removeAll();\n cb && cb(null);\n }\n}\n","interface Task {\n url: string;\n callback: RequestCallback;\n}\n\ninterface NodeRequestInit extends RequestInit {\n agent?: any;\n}\n\nfunction fetchRequest(url: string, options: RequestHandlerOption, callback: RequestCallback): void {\n\n const fetchOptions = {\n headers: {\n Accept: 'application/json',\n },\n } as NodeRequestInit;\n\n if (options && options.proxyAgent) {\n fetchOptions.agent = options.proxyAgent;\n }\n\n fetch(url, fetchOptions).then((xhr) => {\n if (~~(xhr.status / 100 !== 2)) {\n /**\n * @description\n * drain the xhr before throwing an error to prevent memory leaks\n * @link https://github.com/bitinn/node-fetch/issues/83\n */\n return xhr.text().then(() => {\n const e: any = new Error(`Unexpected status code [${xhr.status}] on URL ${url}`);\n e.status = xhr.status;\n throw e;\n });\n }\n\n return xhr.json().then((result) => {\n const cacheControl = xhr.headers.get('cache-control');\n const parsedCacheControl = cacheControl ? /max-age=(\\d+)/.exec(cacheControl) : null;\n const ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined;\n\n callback(null, result, xhr, ttl);\n });\n }).catch(callback);\n}\n\nexport type RequestCallback = (error: Error | null, result?: T | null, xhr?: any, ttl?: number) => void;\n\nexport interface RequestHandlerOption {\n proxyAgent?: any;\n}\n\nexport interface RequestHandler {\n request(url: string, cb: RequestCallback): void;\n}\n\nexport class DefaultRequestHandler implements RequestHandler {\n\n options: RequestHandlerOption;\n\n constructor(options?: RequestHandlerOption) {\n this.options = options || {};\n }\n\n request(url: string, callback: RequestCallback): void {\n\n fetchRequest(url, this.options, callback);\n }\n}\n","import { ApiCache, DefaultApiCache } from './cache';\nimport { RequestHandler, DefaultRequestHandler, RequestCallback } from './request';\n\nexport interface HttpClientOptions {\n ttl?: number;\n cacheKey?: string;\n}\n\nexport default class HttpClient {\n\n private cache: ApiCache;\n private requestHandler: RequestHandler;\n\n constructor(requestHandler?: RequestHandler, cache?: ApiCache, proxyAgent?: any) {\n this.requestHandler = requestHandler || new DefaultRequestHandler({ proxyAgent });\n this.cache = cache || new DefaultApiCache();\n }\n\n request(url: string, callback?: RequestCallback): void {\n this.requestHandler.request(url, (err, result, xhr, ttl) => {\n if (err) {\n callback && callback(err, null, xhr, ttl);\n } else if (result) {\n callback && callback(null, result, xhr, ttl);\n }\n });\n }\n\n /**\n * Fetch a URL corresponding to a query, and parse the response as a Response object\n */\n cachedRequest(url: string, maybeOptions?: HttpClientOptions): Promise {\n const options = maybeOptions || {};\n const run = (cb: RequestCallback) => {\n const cacheKey = options.cacheKey || url;\n this.cache.get(cacheKey, (cacheGetError, cacheGetValue) => {\n if (cacheGetError || cacheGetValue) {\n cb(cacheGetError, cacheGetValue);\n } else {\n this.request(url, (fetchError, fetchValue, xhr, ttlReq) => {\n if (fetchError) {\n cb(fetchError, null);\n } else {\n const ttl = ttlReq || options.ttl;\n if (ttl) {\n this.cache.set(cacheKey, fetchValue, ttl, cb);\n }\n cb(null, fetchValue);\n }\n });\n }\n });\n };\n\n return new Promise((resolve, reject) => {\n run((err, value) => {\n if (err) reject(err);\n if (value) resolve(value);\n });\n });\n }\n}\n","import Predicates from './Predicates';\nimport { RequestHandler, RequestCallback } from './request';\nimport { Document } from './documents';\nimport { ApiCache } from './cache';\nimport ResolvedApi, { ApiData } from './ResolvedApi';\nimport HttpClient from './HttpClient';\n\nexport interface ApiOptions {\n accessToken?: string;\n requestHandler?: RequestHandler;\n req?: any;\n apiCache?: ApiCache;\n apiDataTTL?: number;\n proxyAgent?: any;\n}\n\nexport default class Api {\n url: string;\n options: ApiOptions;\n apiDataTTL: number;\n httpClient: HttpClient;\n\n constructor(url: string, options?: ApiOptions) {\n this.options = options || {};\n this.url = url;\n if (this.options.accessToken) {\n const accessTokenParam = `access_token=${this.options.accessToken}`;\n this.url += (url.indexOf('?') > -1 ? '&' : '?') + accessTokenParam;\n }\n this.apiDataTTL = this.options.apiDataTTL || 5;\n this.httpClient = new HttpClient(\n this.options.requestHandler,\n this.options.apiCache,\n this.options.proxyAgent,\n );\n }\n\n /**\n * Fetches data used to construct the api client, from cache if it's\n * present, otherwise from calling the prismic api endpoint (which is\n * then cached).\n */\n get(cb?: RequestCallback): Promise {\n return this.httpClient.cachedRequest(this.url, { ttl: this.apiDataTTL }).then((data) => {\n const resolvedApi = new ResolvedApi(data, this.httpClient, this.options);\n cb && cb(null, resolvedApi);\n return resolvedApi;\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","import { Document } from \"./documents\";\nimport ResolvedApi, { QueryOptions, EXPERIMENT_COOKIE, PREVIEW_COOKIE } from './ResolvedApi';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport { SearchForm, LazySearchForm } from './form';\nimport { Experiment } from './experiments';\nimport { RequestHandler, RequestCallback } from './request';\nimport Api, { ApiOptions } from './Api';\n\nexport interface Client {\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise;\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb: RequestCallback): Promise;\n getByID(id: string, options: QueryOptions, cb: RequestCallback): Promise;\n getByIDs(ids: string[], options: QueryOptions, cb: RequestCallback): Promise;\n getByUID(type: string, uid: string, options: QueryOptions, cb: RequestCallback): Promise;\n getSingle(type: string, options: QueryOptions, cb: RequestCallback): Promise;\n getBookmark(bookmark: string, options: QueryOptions, cb: RequestCallback): Promise;\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise;\n}\n\nexport class DefaultClient implements Client {\n\n api: Api;\n resolvedApi: ResolvedApi;\n\n constructor(url: string, options?: ApiOptions) {\n this.api = new Api(url, options);\n }\n\n getApi(): Promise {\n return this.api.get();\n }\n\n everything(): LazySearchForm {\n return this.form('everything');\n }\n\n form(formId: string): LazySearchForm {\n return new LazySearchForm(formId, this.api);\n }\n\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.query(q, optionsOrCallback, cb));\n }\n\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.queryFirst(q, optionsOrCallback, cb));\n }\n\n getByID(id: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByID(id, options, cb));\n }\n\n getByIDs(ids: string[], options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByIDs(ids, options, cb));\n }\n\n getByUID(type: string, uid: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByUID(type, uid, options, cb));\n }\n\n getSingle(type: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getSingle(type, options, cb));\n }\n\n getBookmark(bookmark: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getBookmark(bookmark, options, cb));\n }\n\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.previewSession(token, linkResolver, defaultUrl, cb));\n }\n\n static getApi(url: string, options?: ApiOptions): Promise {\n const api = new Api(url, options);\n return api.get();\n }\n}\n","import ResolvedApi, { EXPERIMENT_COOKIE as experimentCookie, PREVIEW_COOKIE as previewCookie } from './ResolvedApi';\nimport Predicates from './Predicates';\nimport { Experiments } from './experiments';\nimport Api, { ApiOptions } from './Api';\nimport { DefaultClient } from './client';\n\nexport {\n experimentCookie,\n previewCookie,\n Predicates,\n Experiments,\n Api\n};\n\nexport function client(url: string, options?: ApiOptions): DefaultClient {\n return new DefaultClient(url, options);\n}\n\nexport function getApi(url: string, options?: ApiOptions): Promise {\n return DefaultClient.getApi(url, options);\n}\n\nexport function api(url: string, options?: ApiOptions): Promise {\n return getApi(url, options);\n}"],"names":[],"mappings":"AAAO;IAGL,mBAAY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IAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;QAClC,OAAO,GAAG,CAAC,GAAG,EAAE,CAAC;KAClB;IACH,oBAAC;CAAA,IAAA;;SC9De,MAAM,CAAC,GAAW,EAAE,OAAoB;IACtD,OAAO,IAAI,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;CACxC;AAED,SAAgB,MAAM,CAAC,GAAW,EAAE,OAAoB;IACtD,OAAO,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED,SAAgB,GAAG,CAAC,GAAW,EAAE,OAAoB;IACnD,OAAO,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;CAC7B;;;;"} \ No newline at end of file diff --git a/dist/prismic-javascript.esm.js b/dist/prismic-javascript.esm.js new file mode 100644 index 00000000..d10dcef6 --- /dev/null +++ b/dist/prismic-javascript.esm.js @@ -0,0 +1,1235 @@ +import fetches from 'node-fetch'; + +class Variation { + constructor(data) { + this.data = {}; + this.data = data; + } + id() { + return this.data.id; + } + ref() { + return this.data.ref; + } + label() { + return this.data.label; + } +} +class Experiment { + constructor(data) { + this.data = {}; + this.data = data; + this.variations = (data.variations || []).map((v) => { + return new Variation(v); + }); + } + id() { + return this.data.id; + } + googleId() { + return this.data.googleId; + } + name() { + return this.data.name; + } +} +class Experiments { + constructor(data) { + if (data) { + this.drafts = (data.drafts || []).map((exp) => { + return new Experiment(exp); + }); + this.running = (data.running || []).map((exp) => { + return new Experiment(exp); + }); + } + } + current() { + if (this.running.length > 0) { + return this.running[0]; + } + else { + return null; + } + } + refFromCookie(cookie) { + if (!cookie || cookie.trim() === '') + return null; + const splitted = cookie.trim().split(' '); + if (splitted.length < 2) + return null; + const expId = splitted[0]; + const varIndex = parseInt(splitted[1], 10); + const exp = this.running.filter((exp) => { + return exp.googleId() === expId && exp.variations.length > varIndex; + })[0]; + return exp ? exp.variations[varIndex].ref() : null; + } +} + +class LazySearchForm { + constructor(id, api) { + this.id = id; + this.api = api; + this.fields = {}; + } + set(key, value) { + this.fields[key] = value; + return this; + } + ref(ref) { + return this.set('ref', ref); + } + query(query) { + return this.set('q', query); + } + pageSize(size) { + return this.set('pageSize', size); + } + fetch(fields) { + return this.set('fetch', fields); + } + fetchLinks(fields) { + return this.set('fetchLinks', fields); + } + lang(langCode) { + return this.set('lang', langCode); + } + page(p) { + return this.set('page', p); + } + after(documentId) { + return this.set('after', documentId); + } + orderings(orderings) { + return this.set('orderings', orderings); + } + url() { + return this.api.get().then((api) => { + return LazySearchForm.toSearchForm(this, api).url(); + }); + } + submit(cb) { + return this.api.get().then((api) => { + return LazySearchForm.toSearchForm(this, api).submit(cb); + }); + } + static toSearchForm(lazyForm, api) { + const form = api.form(lazyForm.id); + if (form) { + return Object.keys(lazyForm.fields).reduce((form, fieldKey) => { + const fieldValue = lazyForm.fields[fieldKey]; + if (fieldKey === 'q') { + return form.query(fieldValue); + } + else if (fieldKey === 'pageSize') { + return form.pageSize(fieldValue); + } + else if (fieldKey === 'fetch') { + return form.fetch(fieldValue); + } + else if (fieldKey === 'fetchLinks') { + return form.fetchLinks(fieldValue); + } + else if (fieldKey === 'lang') { + return form.lang(fieldValue); + } + else if (fieldKey === 'page') { + return form.page(fieldValue); + } + else if (fieldKey === 'after') { + return form.after(fieldValue); + } + else if (fieldKey === 'orderings') { + return form.orderings(fieldValue); + } + else { + return form.set(fieldKey, fieldValue); + } + }, form); + } + else { + throw new Error(`Unable to access to form ${lazyForm.id}`); + } + } +} +class SearchForm { + constructor(form, httpClient) { + this.httpClient = httpClient; + this.form = form; + this.data = {}; + for (const field in form.fields) { + if (form.fields[field]['default']) { + this.data[field] = [form.fields[field]['default']]; + } + } + } + set(field, value) { + const fieldDesc = this.form.fields[field]; + if (!fieldDesc) + throw new Error('Unknown field ' + field); + const checkedValue = value === '' || value === undefined ? null : value; + let values = this.data[field] || []; + if (fieldDesc.multiple) { + values = checkedValue ? values.concat([checkedValue]) : values; + } + else { + values = checkedValue ? [checkedValue] : values; + } + this.data[field] = values; + return this; + } + /** + * Sets a ref to query on for this SearchForm. This is a mandatory + * method to call before calling submit(), and api.form('everything').submit() + * will not work. + */ + ref(ref) { + return this.set('ref', ref); + } + /** + * Sets a predicate-based query for this SearchForm. This is where you + * paste what you compose in your prismic.io API browser. + */ + query(query) { + if (typeof query === 'string') { + return this.query([query]); + } + else if (query instanceof Array) { + return this.set('q', `[${query.join('')}]`); + } + else { + throw new Error(`Invalid query : ${query}`); + } + } + /** + * Sets a page size to query for this SearchForm. This is an optional method. + * + * @param {number} size - The page size + * @returns {SearchForm} - The SearchForm itself + */ + pageSize(size) { + return this.set('pageSize', size); + } + /** + * Restrict the results document to the specified fields + */ + fetch(fields) { + const strFields = fields instanceof Array ? fields.join(',') : fields; + return this.set('fetch', strFields); + } + /** + * Include the requested fields in the DocumentLink instances in the result + */ + fetchLinks(fields) { + const strFields = fields instanceof Array ? fields.join(',') : fields; + return this.set('fetchLinks', strFields); + } + /** + * Sets the language to query for this SearchForm. This is an optional method. + */ + lang(langCode) { + return this.set('lang', langCode); + } + /** + * Sets the page number to query for this SearchForm. This is an optional method. + */ + page(p) { + return this.set('page', p); + } + /** + * Remove all the documents except for those after the specified document in the list. This is an optional method. + */ + after(documentId) { + return this.set('after', documentId); + } + /** + * Sets the orderings to query for this SearchForm. This is an optional method. + */ + orderings(orderings) { + if (!orderings) { + return this; + } + else { + return this.set('orderings', `[${orderings.join(',')}]`); + } + } + /** + * Build the URL to query + */ + url() { + let url = this.form.action; + if (this.data) { + let sep = (url.indexOf('?') > -1 ? '&' : '?'); + for (const key in this.data) { + if (this.data.hasOwnProperty(key)) { + const values = this.data[key]; + if (values) { + for (let i = 0; i < values.length; i++) { + url += sep + key + '=' + encodeURIComponent(values[i]); + sep = '&'; + } + } + } + } + } + return url; + } + /** + * Submits the query, and calls the callback function. + */ + submit(cb) { + return this.httpClient.cachedRequest(this.url()).then((response) => { + cb && cb(null, response); + return response; + }).catch((error) => { + cb && cb(error); + throw error; + }); + } +} + +const OPERATOR = { + at: 'at', + not: 'not', + missing: 'missing', + has: 'has', + any: 'any', + in: 'in', + fulltext: 'fulltext', + similar: 'similar', + numberGt: 'number.gt', + numberLt: 'number.lt', + numberInRange: 'number.inRange', + dateBefore: 'date.before', + dateAfter: 'date.after', + dateBetween: 'date.between', + dateDayOfMonth: 'date.day-of-month', + dateDayOfMonthAfter: 'date.day-of-month-after', + dateDayOfMonthBefore: 'date.day-of-month-before', + dateDayOfWeek: 'date.day-of-week', + dateDayOfWeekAfter: 'date.day-of-week-after', + dateDayOfWeekBefore: 'date.day-of-week-before', + dateMonth: 'date.month', + dateMonthBefore: 'date.month-before', + dateMonthAfter: 'date.month-after', + dateYear: 'date.year', + dateHour: 'date.hour', + dateHourBefore: 'date.hour-before', + dateHourAfter: 'date.hour-after', + GeopointNear: 'geopoint.near', +}; +function encode(value) { + if (typeof value === 'string') { + return `"${value}"`; + } + else if (typeof value === 'number') { + return value.toString(); + } + else if (value instanceof Date) { + return value.getTime().toString(); + } + else if (value instanceof Array) { + return `[${value.map(v => encode(v)).join(',')}]`; + } + else { + throw new Error(`Unable to encode ${value} of type ${typeof value}`); + } +} +const geopoint = { + near(fragment, latitude, longitude, radius) { + return `[${OPERATOR.GeopointNear}(${fragment}, ${latitude}, ${longitude}, ${radius})]`; + }, +}; +const date = { + before(fragment, before) { + return `[${OPERATOR.dateBefore}(${fragment}, ${encode(before)})]`; + }, + after(fragment, after) { + return `[${OPERATOR.dateAfter}(${fragment}, ${encode(after)})]`; + }, + between(fragment, before, after) { + return `[${OPERATOR.dateBetween}(${fragment}, ${encode(before)}, ${encode(after)})]`; + }, + dayOfMonth(fragment, day) { + return `[${OPERATOR.dateDayOfMonth}(${fragment}, ${day})]`; + }, + dayOfMonthAfter(fragment, day) { + return `[${OPERATOR.dateDayOfMonthAfter}(${fragment}, ${day})]`; + }, + dayOfMonthBefore(fragment, day) { + return `[${OPERATOR.dateDayOfMonthBefore}(${fragment}, ${day})]`; + }, + dayOfWeek(fragment, day) { + return `[${OPERATOR.dateDayOfWeek}(${fragment}, ${encode(day)})]`; + }, + dayOfWeekAfter(fragment, day) { + return `[${OPERATOR.dateDayOfWeekAfter}(${fragment}, ${encode(day)})]`; + }, + dayOfWeekBefore(fragment, day) { + return `[${OPERATOR.dateDayOfWeekBefore}(${fragment}, ${encode(day)})]`; + }, + month(fragment, month) { + return `[${OPERATOR.dateMonth}(${fragment}, ${encode(month)})]`; + }, + monthBefore(fragment, month) { + return `[${OPERATOR.dateMonthBefore}(${fragment}, ${encode(month)})]`; + }, + monthAfter(fragment, month) { + return `[${OPERATOR.dateMonthAfter}(${fragment}, ${encode(month)})]`; + }, + year(fragment, year) { + return `[${OPERATOR.dateYear}(${fragment}, ${year})]`; + }, + hour(fragment, hour) { + return `[${OPERATOR.dateHour}(${fragment}, ${hour})]`; + }, + hourBefore(fragment, hour) { + return `[${OPERATOR.dateHourBefore}(${fragment}, ${hour})]`; + }, + hourAfter(fragment, hour) { + return `[${OPERATOR.dateHourAfter}(${fragment}, ${hour})]`; + }, +}; +const number = { + gt(fragment, value) { + return `[${OPERATOR.numberGt}(${fragment}, ${value})]`; + }, + lt(fragment, value) { + return `[${OPERATOR.numberLt}(${fragment}, ${value})]`; + }, + inRange(fragment, before, after) { + return `[${OPERATOR.numberInRange}(${fragment}, ${before}, ${after})]`; + }, +}; +var Predicates = { + at(fragment, value) { + return `[${OPERATOR.at}(${fragment}, ${encode(value)})]`; + }, + not(fragment, value) { + return `[${OPERATOR.not}(${fragment}, ${encode(value)})]`; + }, + missing(fragment) { + return `[${OPERATOR.missing}(${fragment})]`; + }, + has(fragment) { + return `[${OPERATOR.has}(${fragment})]`; + }, + any(fragment, values) { + return `[${OPERATOR.any}(${fragment}, ${encode(values)})]`; + }, + in(fragment, values) { + return `[${OPERATOR.in}(${fragment}, ${encode(values)})]`; + }, + fulltext(fragment, value) { + return `[${OPERATOR.fulltext}(${fragment}, ${encode(value)})]`; + }, + similar(documentId, maxResults) { + return `[${OPERATOR.similar}("${documentId}", ${maxResults})]`; + }, + date, + dateBefore: date.before, + dateAfter: date.after, + dateBetween: date.between, + dayOfMonth: date.dayOfMonth, + dayOfMonthAfter: date.dayOfMonthAfter, + dayOfMonthBefore: date.dayOfMonthBefore, + dayOfWeek: date.dayOfWeek, + dayOfWeekAfter: date.dayOfWeekAfter, + dayOfWeekBefore: date.dayOfWeekBefore, + month: date.month, + monthBefore: date.monthBefore, + monthAfter: date.monthAfter, + year: date.year, + hour: date.hour, + hourBefore: date.hourBefore, + hourAfter: date.hourAfter, + number, + gt: number.gt, + lt: number.lt, + inRange: number.inRange, + near: geopoint.near, + geopoint, +}; + +// Some portions of code from https://github.com/jshttp/cookie +var decode = decodeURIComponent; +function tryDecode(str, decode) { + try { + return decode(str); + } + catch (e) { + return str; + } +} +function parse(str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string'); + } + var obj = {}; + var opt = options || {}; + var pairs = str.split(/; */); + var dec = opt.decode || decode; + pairs.forEach(function (pair) { + var eq_idx = pair.indexOf('='); + // skip things that don't look like key=value + if (eq_idx < 0) { + return; + } + var key = pair.substr(0, eq_idx).trim(); + var val = pair.substr(++eq_idx, pair.length).trim(); + // quoted values + if ('"' == val[0]) { + val = val.slice(1, -1); + } + // only assign once + if (undefined == obj[key]) { + obj[key] = tryDecode(val, dec); + } + }); + return obj; +} +var Cookies = { parse }; + +const PREVIEW_COOKIE = 'io.prismic.preview'; +const EXPERIMENT_COOKIE = 'io.prismic.experiment'; +class ResolvedApi { + constructor(data, httpClient, options) { + this.data = data; + this.masterRef = data.refs.filter(ref => ref.isMasterRef)[0]; + this.experiments = new Experiments(data.experiments); + this.bookmarks = data.bookmarks; + this.httpClient = httpClient; + this.options = options; + this.refs = data.refs; + this.tags = data.tags; + this.types = data.types; + } + /** + * Returns a useable form from its id, as described in the RESTful description of the API. + * For instance: api.form("everything") works on every repository (as "everything" exists by default) + * You can then chain the calls: api.form("everything").query('[[:d = at(document.id, "UkL0gMuvzYUANCpf")]]').ref(ref).submit() + */ + form(formId) { + const form = this.data.forms[formId]; + if (form) { + return new SearchForm(form, this.httpClient); + } + return null; + } + everything() { + const f = this.form('everything'); + if (!f) + throw new Error('Missing everything form'); + return f; + } + /** + * The ID of the master ref on this prismic.io API. + * Do not use like this: searchForm.ref(api.master()). + * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page. + */ + master() { + return this.masterRef.ref; + } + /** + * Returns the ref ID for a given ref's label. + * Do not use like this: searchForm.ref(api.ref("Future release label")). + * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page. + */ + ref(label) { + const ref = this.data.refs.filter(ref => ref.label === label)[0]; + return ref ? ref.ref : null; + } + currentExperiment() { + return this.experiments.current(); + } + /** + * Query the repository + */ + query(q, optionsOrCallback, cb = () => { }) { + const { options, callback } = typeof optionsOrCallback === 'function' + ? { options: {}, callback: optionsOrCallback } + : { options: optionsOrCallback || {}, callback: cb }; + let form = this.everything(); + for (const key in options) { + form = form.set(key, options[key]); + } + if (!options.ref) { + // Look in cookies if we have a ref (preview or experiment) + let cookieString = ''; + if (this.options.req) { // NodeJS + cookieString = this.options.req.headers['cookie'] || ''; + } + else if (typeof window !== 'undefined' && window.document) { // Browser + cookieString = window.document.cookie || ''; + } + const cookies = Cookies.parse(cookieString); + const previewRef = cookies[PREVIEW_COOKIE]; + const experimentRef = this.experiments.refFromCookie(cookies[EXPERIMENT_COOKIE]); + form = form.ref(previewRef || experimentRef || this.masterRef.ref); + } + if (q) { + form.query(q); + } + return form.submit(callback); + } + /** + * Retrieve the document returned by the given query + * @param {string|array|Predicate} the query + * @param {object} additional parameters. In NodeJS, pass the request as 'req'. + * @param {function} callback(err, doc) + */ + queryFirst(q, optionsOrCallback, cb) { + const { options, callback } = typeof optionsOrCallback === 'function' + ? { options: {}, callback: optionsOrCallback } + : { options: optionsOrCallback || {}, callback: cb || (() => { }) }; + options.page = 1; + options.pageSize = 1; + return this.query(q, options).then((response) => { + const document = response && response.results && response.results[0]; + callback(null, document); + return document; + }).catch((error) => { + callback(error); + throw error; + }); + } + /** + * Retrieve the document with the given id + */ + getByID(id, maybeOptions, cb) { + const options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.queryFirst(Predicates.at('document.id', id), options, cb); + } + /** + * Retrieve multiple documents from an array of id + */ + getByIDs(ids, maybeOptions, cb) { + const options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.query(Predicates.in('document.id', ids), options, cb); + } + /** + * Retrieve the document with the given uid + */ + getByUID(type, uid, maybeOptions, cb) { + const options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.queryFirst(Predicates.at(`my.${type}.uid`, uid), options, cb); + } + /** + * Retrieve the singleton document with the given type + */ + getSingle(type, maybeOptions, cb) { + const options = maybeOptions || {}; + return this.queryFirst(Predicates.at('document.type', type), options, cb); + } + /** + * Retrieve the document with the given bookmark + */ + getBookmark(bookmark, maybeOptions, cb) { + const id = this.data.bookmarks[bookmark]; + if (id) { + return this.getByID(id, maybeOptions, cb); + } + else { + return Promise.reject('Error retrieving bookmarked id'); + } + } + previewSession(token, linkResolver, defaultUrl, cb) { + return this.httpClient.request(token).then((result) => { + if (!result.mainDocument) { + cb && cb(null, defaultUrl); + return Promise.resolve(defaultUrl); + } + else { + return this.getByID(result.mainDocument, { ref: token }).then((document) => { + if (!document) { + cb && cb(null, defaultUrl); + return defaultUrl; + } + else { + const url = linkResolver(document); + cb && cb(null, url); + return url; + } + }); + } + }).catch((error) => { + cb && cb(error); + throw error; + }); + } +} + +class Variation$1 { + constructor(data) { + this.data = {}; + this.data = data; + } + id() { + return this.data.id; + } + ref() { + return this.data.ref; + } + label() { + return this.data.label; + } +} +class Experiment$1 { + constructor(data) { + this.data = {}; + this.data = data; + this.variations = (data.variations || []).map((v) => { + return new Variation$1(v); + }); + } + id() { + return this.data.id; + } + googleId() { + return this.data.googleId; + } + name() { + return this.data.name; + } +} +class Experiments$1 { + constructor(data) { + if (data) { + this.drafts = (data.drafts || []).map((exp) => { + return new Experiment$1(exp); + }); + this.running = (data.running || []).map((exp) => { + return new Experiment$1(exp); + }); + } + } + current() { + if (this.running.length > 0) { + return this.running[0]; + } + else { + return null; + } + } + refFromCookie(cookie) { + if (!cookie || cookie.trim() === '') + return null; + const splitted = cookie.trim().split(' '); + if (splitted.length < 2) + return null; + const expId = splitted[0]; + const varIndex = parseInt(splitted[1], 10); + const exp = this.running.filter((exp) => { + return exp.googleId() === expId && exp.variations.length > varIndex; + })[0]; + return exp ? exp.variations[varIndex].ref() : null; + } +} + +/** +* A doubly linked list-based Least Recently Used (LRU) cache. Will keep most +* recently used items while discarding least recently used items when its limit +* is reached. +* +* Licensed under MIT. Copyright (c) 2010 Rasmus Andersson +* Typescript-ified by Oleksandr Nikitin +* +* Illustration of the design: +* +* entry entry entry entry +* ______ ______ ______ ______ +* | head |.newer => | |.newer => | |.newer => | tail | +* | A | | B | | C | | D | +* |______| <= older.|______| <= older.|______| <= older.|______| +* +* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added +*/ +function MakeLRUCache(limit) { + return new LRUCache(limit); +} +function LRUCache(limit) { + // Current size of the cache. (Read-only). + this.size = 0; + // Maximum number of items this cache can hold. + this.limit = limit; + this._keymap = {}; +} +/** + * Put into the cache associated with . Returns the entry which was + * removed to make room for the new entry. Otherwise undefined is returned + * (i.e. if there was enough room already). + */ +LRUCache.prototype.put = function (key, value) { + var entry = { key: key, value: value }; + // Note: No protection agains replacing, and thus orphan entries. By design. + this._keymap[key] = entry; + if (this.tail) { + // link previous tail to the new tail (entry) + this.tail.newer = entry; + entry.older = this.tail; + } + else { + // we're first in -- yay + this.head = entry; + } + // add new entry to the end of the linked list -- it's now the freshest entry. + this.tail = entry; + if (this.size === this.limit) { + // we hit the limit -- remove the head + return this.shift(); + } + else { + // increase the size counter + this.size++; + } +}; +/** + * Purge the least recently used (oldest) entry from the cache. Returns the + * removed entry or undefined if the cache was empty. + * + * If you need to perform any form of finalization of purged items, this is a + * good place to do it. Simply override/replace this function: + * + * var c = new LRUCache(123); + * c.shift = function() { + * var entry = LRUCache.prototype.shift.call(this); + * doSomethingWith(entry); + * return entry; + * } + */ +LRUCache.prototype.shift = function () { + // todo: handle special case when limit == 1 + var entry = this.head; + if (entry) { + if (this.head.newer) { + this.head = this.head.newer; + this.head.older = undefined; + } + else { + this.head = undefined; + } + // Remove last strong reference to and remove links from the purged + // entry being returned: + entry.newer = entry.older = undefined; + // delete is slow, but we need to do this to avoid uncontrollable growth: + delete this._keymap[entry.key]; + } + console.log('purging ', entry.key); + return entry; +}; +/** + * Get and register recent use of . Returns the value associated with + * or undefined if not in cache. + */ +LRUCache.prototype.get = function (key, returnEntry) { + // First, find our cache entry + var entry = this._keymap[key]; + if (entry === undefined) + return; // Not cached. Sorry. + // As was found in the cache, register it as being requested recently + if (entry === this.tail) { + // Already the most recently used entry, so no need to update the list + return returnEntry ? entry : entry.value; + } + // HEAD--------------TAIL + // <.older .newer> + // <--- add direction -- + // A B C E + if (entry.newer) { + if (entry === this.head) + this.head = entry.newer; + entry.newer.older = entry.older; // C <-- E. + } + if (entry.older) + entry.older.newer = entry.newer; // C. --> E + entry.newer = undefined; // D --x + entry.older = this.tail; // D. --> E + if (this.tail) + this.tail.newer = entry; // E. <-- D + this.tail = entry; + return returnEntry ? entry : entry.value; +}; +// ---------------------------------------------------------------------------- +// Following code is optional and can be removed without breaking the core +// functionality. +/** + * Check if is in the cache without registering recent use. Feasible if + * you do not want to chage the state of the cache, but only "peek" at it. + * Returns the entry associated with if found, or undefined if not found. + */ +LRUCache.prototype.find = function (key) { + return this._keymap[key]; +}; +/** + * Update the value of entry with . Returns the old value, or undefined if + * entry was not in the cache. + */ +LRUCache.prototype.set = function (key, value) { + var oldvalue; + var entry = this.get(key, true); + if (entry) { + oldvalue = entry.value; + entry.value = value; + } + else { + oldvalue = this.put(key, value); + if (oldvalue) + oldvalue = oldvalue.value; + } + return oldvalue; +}; +/** + * Remove entry from cache and return its value. Returns undefined if not + * found. + */ +LRUCache.prototype.remove = function (key) { + var entry = this._keymap[key]; + if (!entry) + return; + delete this._keymap[entry.key]; // need to do delete unfortunately + if (entry.newer && entry.older) { + // relink the older entry with the newer entry + entry.older.newer = entry.newer; + entry.newer.older = entry.older; + } + else if (entry.newer) { + // remove the link to us + entry.newer.older = undefined; + // link the newer entry to head + this.head = entry.newer; + } + else if (entry.older) { + // remove the link to us + entry.older.newer = undefined; + // link the newer entry to head + this.tail = entry.older; + } + else { // if(entry.older === undefined && entry.newer === undefined) { + this.head = this.tail = undefined; + } + this.size--; + return entry.value; +}; +/** Removes all entries */ +LRUCache.prototype.removeAll = function () { + // This should be safe, as we never expose strong refrences to the outside + this.head = this.tail = undefined; + this.size = 0; + this._keymap = {}; +}; +/** + * Return an array containing all keys of entries stored in the cache object, in + * arbitrary order. + */ +if (typeof Object.keys === 'function') { + LRUCache.prototype.keys = function () { return Object.keys(this._keymap); }; +} +else { + LRUCache.prototype.keys = function () { + var keys = []; + for (var k in this._keymap) + keys.push(k); + return keys; + }; +} +/** + * Call `fun` for each entry. Starting with the newest entry if `desc` is a true + * value, otherwise starts with the oldest (head) enrty and moves towards the + * tail. + * + * `fun` is called with 3 arguments in the context `context`: + * `fun.call(context, Object key, Object value, LRUCache self)` + */ +LRUCache.prototype.forEach = function (fun, context, desc) { + var entry; + if (context === true) { + desc = true; + context = undefined; + } + else if (typeof context !== 'object') + context = this; + if (desc) { + entry = this.tail; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.older; + } + } + else { + entry = this.head; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.newer; + } + } +}; +/** Returns a JSON (array) representation */ +//LRUCache.prototype.toJSON = function () { +// var s: IEntry[] = [], entry = this.head; +// while (entry) { +// s.push({ key: entry.key.toJSON(), value: entry.value.toJSON() }); +// entry = entry.newer; +// } +// return s; +//}; +/** Returns a String representation */ +LRUCache.prototype.toString = function () { + var s = '', entry = this.head; + while (entry) { + s += String(entry.key) + ':' + entry.value; + entry = entry.newer; + if (entry) + s += ' < '; + } + return s; +}; + +class DefaultApiCache { + constructor(limit = 1000) { + this.lru = MakeLRUCache(limit); + } + isExpired(key) { + const value = this.lru.get(key, false); + if (value) { + return value.expiredIn !== 0 && value.expiredIn < Date.now(); + } + else { + return false; + } + } + get(key, cb) { + const value = this.lru.get(key, false); + if (value && !this.isExpired(key)) { + cb(null, value.data); + } + else { + cb && cb(null); + } + } + set(key, value, ttl, cb) { + this.lru.remove(key); + this.lru.put(key, { + data: value, + expiredIn: ttl ? (Date.now() + (ttl * 1000)) : 0, + }); + cb && cb(null); + } + remove(key, cb) { + this.lru.remove(key); + cb && cb(null); + } + clear(cb) { + this.lru.removeAll(); + cb && cb(null); + } +} + +// In the browser, node-fetch exports self.fetch: +// Number of maximum simultaneous connections to the prismic server +const MAX_CONNECTIONS = 20; +// Number of requests currently running (capped by MAX_CONNECTIONS) +let running = 0; +// Requests in queue +const queue = []; +function fetchRequest(url, options, callback) { + const fetchOptions = { + headers: { + Accept: 'application/json', + }, + }; + if (options && options.proxyAgent) { + fetchOptions.agent = options.proxyAgent; + } + fetches(url, fetchOptions).then((xhr) => { + if (~~(xhr.status / 100 !== 2)) { + /** + * @description + * drain the xhr before throwing an error to prevent memory leaks + * @link https://github.com/bitinn/node-fetch/issues/83 + */ + return xhr.text().then(() => { + const e = new Error(`Unexpected status code [${xhr.status}] on URL ${url}`); + e.status = xhr.status; + throw e; + }); + } + else { + return xhr.json().then((result) => { + const cacheControl = xhr.headers.get('cache-control'); + const parsedCacheControl = cacheControl ? /max-age=(\d+)/.exec(cacheControl) : null; + const ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined; + callback(null, result, xhr, ttl); + }); + } + }).catch(callback); +} +function processQueue(options) { + if (queue.length > 0 && running < MAX_CONNECTIONS) { + running++; + const req = queue.shift(); + if (req) { + fetchRequest(req.url, options, (error, result, xhr, ttl) => { + running--; + req.callback(error, result, xhr, ttl); + processQueue(options); + }); + } + } +} +class DefaultRequestHandler { + constructor(options) { + this.options = options || {}; + } + request(url, callback) { + queue.push({ url, callback }); + processQueue(this.options); + } +} + +class HttpClient { + constructor(requestHandler, cache, proxyAgent) { + this.requestHandler = requestHandler || new DefaultRequestHandler({ proxyAgent }); + this.cache = cache || new DefaultApiCache(); + } + request(url, callback) { + return new Promise((resolve, reject) => { + this.requestHandler.request(url, (err, result, xhr, ttl) => { + if (err) { + reject(err); + callback && callback(err, null, xhr, ttl); + } + else if (result) { + resolve(result); + callback && callback(null, result, xhr, ttl); + } + }); + }); + } + /** + * Fetch a URL corresponding to a query, and parse the response as a Response object + */ + cachedRequest(url, maybeOptions) { + const options = maybeOptions || {}; + const run = (cb) => { + const cacheKey = options.cacheKey || url; + this.cache.get(cacheKey, (cacheGetError, cacheGetValue) => { + if (cacheGetError || cacheGetValue) { + cb(cacheGetError, cacheGetValue); + } + else { + this.request(url, (fetchError, fetchValue, xhr, ttlReq) => { + if (fetchError) { + cb(fetchError, null); + } + else { + const ttl = ttlReq || options.ttl; + if (ttl) { + this.cache.set(cacheKey, fetchValue, ttl, cb); + } + cb(null, fetchValue); + } + }); + } + }); + }; + return new Promise((resolve, reject) => { + run((err, value) => { + if (err) + reject(err); + if (value) + resolve(value); + }); + }); + } +} + +class Api { + constructor(url, options) { + this.options = options || {}; + this.url = url; + if (this.options.accessToken) { + const accessTokenParam = `access_token=${this.options.accessToken}`; + this.url += (url.indexOf('?') > -1 ? '&' : '?') + accessTokenParam; + } + this.apiDataTTL = this.options.apiDataTTL || 5; + this.httpClient = new HttpClient(this.options.requestHandler, this.options.apiCache, this.options.proxyAgent); + } + /** + * Fetches data used to construct the api client, from cache if it's + * present, otherwise from calling the prismic api endpoint (which is + * then cached). + */ + get(cb) { + return this.httpClient.cachedRequest(this.url, { ttl: this.apiDataTTL }).then((data) => { + const resolvedApi = new ResolvedApi(data, this.httpClient, this.options); + cb && cb(null, resolvedApi); + return resolvedApi; + }).catch((error) => { + cb && cb(error); + throw error; + }); + } +} + +class DefaultClient { + constructor(url, options) { + this.api = new Api(url, options); + } + getApi() { + return this.api.get(); + } + everything() { + return this.form('everything'); + } + form(formId) { + return new LazySearchForm(formId, this.api); + } + query(q, optionsOrCallback, cb) { + return this.getApi().then(api => api.query(q, optionsOrCallback, cb)); + } + queryFirst(q, optionsOrCallback, cb) { + return this.getApi().then(api => api.queryFirst(q, optionsOrCallback, cb)); + } + getByID(id, options, cb) { + return this.getApi().then(api => api.getByID(id, options, cb)); + } + getByIDs(ids, options, cb) { + return this.getApi().then(api => api.getByIDs(ids, options, cb)); + } + getByUID(type, uid, options, cb) { + return this.getApi().then(api => api.getByUID(type, uid, options, cb)); + } + getSingle(type, options, cb) { + return this.getApi().then(api => api.getSingle(type, options, cb)); + } + getBookmark(bookmark, options, cb) { + return this.getApi().then(api => api.getBookmark(bookmark, options, cb)); + } + previewSession(token, linkResolver, defaultUrl, cb) { + return this.getApi().then(api => api.previewSession(token, linkResolver, defaultUrl, cb)); + } + static getApi(url, options) { + const api = new Api(url, options); + return api.get(); + } +} + +function client(url, options) { + return new DefaultClient(url, options); +} +function getApi(url, options) { + return DefaultClient.getApi(url, options); +} +function api(url, options) { + return getApi(url, options); +} + +export { EXPERIMENT_COOKIE as experimentCookie, PREVIEW_COOKIE as previewCookie, Predicates, Experiments$1 as Experiments, Api, client, getApi, api }; +//# sourceMappingURL=prismic-javascript.esm.js.map diff --git a/dist/prismic-javascript.esm.js.map b/dist/prismic-javascript.esm.js.map new file mode 100644 index 00000000..1f3f982e --- /dev/null +++ b/dist/prismic-javascript.esm.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prismic-javascript.esm.js","sources":["../src/experiments.ts","../src/form.ts","../src/Predicates.ts","../src/Cookies.ts","../src/ResolvedApi.ts","../src/Experiments.ts","../src/lru.ts","../src/cache.ts","../src/request.ts","../src/HttpClient.ts","../src/Api.ts","../src/client.ts","../src/index.ts"],"sourcesContent":["export class Variation {\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n }\n\n id(): string {\n return this.data.id;\n }\n\n ref(): string {\n return this.data.ref;\n }\n\n label(): string {\n return this.data.label;\n }\n}\n\nexport class Experiment {\n variations: Variation[];\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n this.variations = (data.variations || []).map((v: any) => {\n return new Variation(v);\n });\n }\n\n id(): string {\n return this.data.id;\n }\n\n googleId(): string {\n return this.data.googleId;\n }\n\n name(): string {\n return this.data.name;\n }\n}\n\nexport class Experiments {\n drafts: Experiment[];\n running: Experiment[];\n\n constructor(data: any) {\n if (data) {\n this.drafts = (data.drafts || []).map((exp: any) => {\n return new Experiment(exp);\n });\n this.running = (data.running || []).map((exp: any) => {\n return new Experiment(exp);\n });\n }\n }\n\n current(): Experiment | null {\n if (this.running.length > 0) {\n return this.running[0];\n } else {\n return null;\n }\n }\n refFromCookie(cookie: string): string | null {\n if (!cookie || cookie.trim() === '') return null;\n const splitted = cookie.trim().split(' ');\n if (splitted.length < 2) return null;\n const expId = splitted[0];\n const varIndex = parseInt(splitted[1], 10);\n const exp = this.running.filter((exp) => {\n return exp.googleId() === expId && exp.variations.length > varIndex;\n })[0];\n return exp ? exp.variations[varIndex].ref() : null;\n }\n}\n","import Api from './Api';\nimport ResolvedApi from './ResolvedApi';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport HttpClient from './HttpClient';\nimport { RequestCallback } from './request';\n\nexport type Fields = { [key: string]: any };\n\nexport interface Form {\n fields: Fields;\n action: string;\n name: string;\n rel: string;\n form_method: string;\n enctype: string;\n}\n\nexport class LazySearchForm {\n id: string;\n fields: Fields;\n api: Api;\n\n constructor(id: string, api: Api) {\n this.id = id;\n this.api = api;\n this.fields = {};\n }\n\n set(key: string, value: any): LazySearchForm {\n this.fields[key] = value;\n return this;\n }\n\n ref(ref: string): LazySearchForm {\n return this.set('ref', ref);\n }\n\n query(query: string | string[]): LazySearchForm {\n return this.set('q', query);\n }\n\n pageSize(size: number): LazySearchForm {\n return this.set('pageSize', size);\n }\n\n fetch(fields: string | string[]): LazySearchForm {\n return this.set('fetch', fields);\n }\n\n fetchLinks(fields: string | string[]): LazySearchForm {\n return this.set('fetchLinks', fields);\n }\n\n lang(langCode: string): LazySearchForm {\n return this.set('lang', langCode);\n }\n\n page(p: number): LazySearchForm {\n return this.set('page', p);\n }\n\n after(documentId: string): LazySearchForm {\n return this.set('after', documentId);\n }\n\n orderings(orderings?: string[]): LazySearchForm {\n return this.set('orderings', orderings);\n }\n\n url(): Promise {\n return this.api.get().then((api) => {\n return LazySearchForm.toSearchForm(this, api).url();\n });\n }\n\n submit(cb: RequestCallback): Promise {\n return this.api.get().then((api) => {\n return LazySearchForm.toSearchForm(this, api).submit(cb);\n });\n }\n\n static toSearchForm(lazyForm: LazySearchForm, api: ResolvedApi): SearchForm {\n const form = api.form(lazyForm.id);\n if (form) {\n return Object.keys(lazyForm.fields).reduce((form, fieldKey) => {\n const fieldValue = lazyForm.fields[fieldKey];\n if (fieldKey === 'q') {\n return form.query(fieldValue);\n } else if (fieldKey === 'pageSize') {\n return form.pageSize(fieldValue);\n } else if (fieldKey === 'fetch') {\n return form.fetch(fieldValue);\n } else if (fieldKey === 'fetchLinks') {\n return form.fetchLinks(fieldValue);\n } else if (fieldKey === 'lang') {\n return form.lang(fieldValue);\n } else if (fieldKey === 'page') {\n return form.page(fieldValue);\n } else if (fieldKey === 'after') {\n return form.after(fieldValue);\n } else if (fieldKey === 'orderings') {\n return form.orderings(fieldValue);\n } else {\n return form.set(fieldKey, fieldValue);\n }\n }, form);\n } else {\n throw new Error(`Unable to access to form ${lazyForm.id}`);\n }\n }\n}\n\nexport class SearchForm {\n httpClient: HttpClient;\n form: Form;\n data: any;\n\n constructor(form: Form, httpClient: HttpClient) {\n this.httpClient = httpClient;\n this.form = form;\n\n this.data = {};\n for (const field in form.fields) {\n if (form.fields[field]['default']) {\n this.data[field] = [form.fields[field]['default']];\n }\n }\n }\n\n set(field: string, value: any): SearchForm {\n const fieldDesc = this.form.fields[field];\n if (!fieldDesc) throw new Error('Unknown field ' + field);\n const checkedValue = value === '' || value === undefined ? null : value;\n let values = this.data[field] || [];\n if (fieldDesc.multiple) {\n values = checkedValue ? values.concat([checkedValue]) : values;\n } else {\n values = checkedValue ? [checkedValue] : values;\n }\n this.data[field] = values;\n return this;\n }\n\n /**\n * Sets a ref to query on for this SearchForm. This is a mandatory\n * method to call before calling submit(), and api.form('everything').submit()\n * will not work.\n */\n ref(ref: string): SearchForm {\n return this.set('ref', ref);\n }\n\n /**\n * Sets a predicate-based query for this SearchForm. This is where you\n * paste what you compose in your prismic.io API browser.\n */\n query(query: string | string[]): SearchForm {\n if (typeof query === 'string') {\n return this.query([query]);\n } else if (query instanceof Array) {\n return this.set('q', `[${query.join('')}]`);\n } else {\n throw new Error(`Invalid query : ${query}`);\n }\n }\n\n /**\n * Sets a page size to query for this SearchForm. This is an optional method.\n *\n * @param {number} size - The page size\n * @returns {SearchForm} - The SearchForm itself\n */\n pageSize(size: number): SearchForm {\n return this.set('pageSize', size);\n }\n\n /**\n * Restrict the results document to the specified fields\n */\n fetch(fields: string | string[]): SearchForm {\n const strFields = fields instanceof Array ? fields.join(',') : fields;\n return this.set('fetch', strFields);\n }\n\n /**\n * Include the requested fields in the DocumentLink instances in the result\n */\n fetchLinks(fields: string | string[]): SearchForm {\n const strFields = fields instanceof Array ? fields.join(',') : fields;\n return this.set('fetchLinks', strFields);\n }\n\n /**\n * Sets the language to query for this SearchForm. This is an optional method.\n */\n lang(langCode: string): SearchForm {\n return this.set('lang', langCode);\n }\n\n /**\n * Sets the page number to query for this SearchForm. This is an optional method.\n */\n page(p: number): SearchForm {\n return this.set('page', p);\n }\n\n /**\n * Remove all the documents except for those after the specified document in the list. This is an optional method.\n */\n after(documentId: string): SearchForm {\n return this.set('after', documentId);\n }\n\n /**\n * Sets the orderings to query for this SearchForm. This is an optional method.\n */\n orderings(orderings ?: string[]): SearchForm {\n if (!orderings) {\n return this;\n } else {\n return this.set('orderings', `[${orderings.join(',')}]`);\n }\n }\n\n /**\n * Build the URL to query\n */\n url(): string {\n let url = this.form.action;\n if (this.data) {\n let sep = (url.indexOf('?') > -1 ? '&' : '?');\n for (const key in this.data) {\n if (this.data.hasOwnProperty(key)) {\n const values = this.data[key];\n if (values) {\n for (let i = 0; i < values.length; i++) {\n url += sep + key + '=' + encodeURIComponent(values[i]);\n sep = '&';\n }\n }\n }\n }\n }\n return url;\n }\n\n /**\n * Submits the query, and calls the callback function.\n */\n submit(cb: RequestCallback): Promise {\n return this.httpClient.cachedRequest(this.url()).then((response) => {\n cb && cb(null, response);\n return response;\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","const OPERATOR = {\n at: 'at',\n not: 'not',\n missing: 'missing',\n has: 'has',\n any: 'any',\n in: 'in',\n fulltext: 'fulltext',\n similar: 'similar',\n numberGt: 'number.gt',\n numberLt: 'number.lt',\n numberInRange: 'number.inRange',\n dateBefore: 'date.before',\n dateAfter: 'date.after',\n dateBetween: 'date.between',\n dateDayOfMonth: 'date.day-of-month',\n dateDayOfMonthAfter: 'date.day-of-month-after',\n dateDayOfMonthBefore: 'date.day-of-month-before',\n dateDayOfWeek: 'date.day-of-week',\n dateDayOfWeekAfter: 'date.day-of-week-after',\n dateDayOfWeekBefore: 'date.day-of-week-before',\n dateMonth: 'date.month',\n dateMonthBefore: 'date.month-before',\n dateMonthAfter: 'date.month-after',\n dateYear: 'date.year',\n dateHour: 'date.hour',\n dateHourBefore: 'date.hour-before',\n dateHourAfter: 'date.hour-after',\n GeopointNear: 'geopoint.near',\n};\n\ntype PredicateValue = string | number | Date;\n\nfunction encode(value: PredicateValue | PredicateValue[]): string {\n if (typeof value === 'string') {\n return `\"${value}\"`;\n } else if (typeof value === 'number') {\n return value.toString();\n } else if (value instanceof Date) {\n return value.getTime().toString();\n } else if (value instanceof Array) {\n return `[${value.map(v => encode(v)).join(',')}]`;\n } else {\n throw new Error(`Unable to encode ${value} of type ${typeof value}`);\n }\n}\n\nconst geopoint = {\n near(fragment: string, latitude: number, longitude: number, radius: number): string {\n return `[${OPERATOR.GeopointNear}(${fragment}, ${latitude}, ${longitude}, ${radius})]`;\n },\n};\n\nconst date = {\n\n before(fragment: string, before: PredicateValue): string {\n return `[${OPERATOR.dateBefore}(${fragment}, ${encode(before)})]`;\n },\n\n after(fragment: string, after: PredicateValue): string {\n return `[${OPERATOR.dateAfter}(${fragment}, ${encode(after)})]`;\n },\n\n between(fragment: string, before: PredicateValue, after: PredicateValue): string {\n return `[${OPERATOR.dateBetween}(${fragment}, ${encode(before)}, ${encode(after)})]`;\n },\n\n dayOfMonth(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonth}(${fragment}, ${day})]`;\n },\n\n dayOfMonthAfter(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonthAfter}(${fragment}, ${day})]`;\n },\n\n dayOfMonthBefore(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonthBefore}(${fragment}, ${day})]`;\n },\n\n dayOfWeek(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeek}(${fragment}, ${encode(day)})]`;\n },\n\n dayOfWeekAfter(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeekAfter}(${fragment}, ${encode(day)})]`;\n },\n\n dayOfWeekBefore(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeekBefore}(${fragment}, ${encode(day)})]`;\n },\n\n month(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonth}(${fragment}, ${encode(month)})]`;\n },\n\n monthBefore(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonthBefore}(${fragment}, ${encode(month)})]`;\n },\n\n monthAfter(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonthAfter}(${fragment}, ${encode(month)})]`;\n },\n\n year(fragment: string, year: number): string {\n return `[${OPERATOR.dateYear}(${fragment}, ${year})]`;\n },\n\n hour(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHour}(${fragment}, ${hour})]`;\n },\n\n hourBefore(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHourBefore}(${fragment}, ${hour})]`;\n },\n\n hourAfter(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHourAfter}(${fragment}, ${hour})]`;\n },\n};\n\nconst number = {\n gt(fragment: string, value: number): string {\n return `[${OPERATOR.numberGt}(${fragment}, ${value})]`;\n },\n\n lt(fragment: string, value: number): string {\n return `[${OPERATOR.numberLt}(${fragment}, ${value})]`;\n },\n\n inRange(fragment: string, before: number, after: number): string {\n return `[${OPERATOR.numberInRange}(${fragment}, ${before}, ${after})]`;\n },\n};\n\nexport default {\n at(fragment: string, value: PredicateValue | PredicateValue[]): string {\n return `[${OPERATOR.at}(${fragment}, ${encode(value)})]`;\n },\n \n not(fragment: string, value: PredicateValue | PredicateValue[]): string {\n return `[${OPERATOR.not}(${fragment}, ${encode(value)})]`;\n },\n\n missing(fragment: string): string {\n return `[${OPERATOR.missing}(${fragment})]`;\n },\n\n has(fragment: string): string {\n return `[${OPERATOR.has}(${fragment})]`;\n },\n\n any(fragment: string, values: PredicateValue[]): string {\n return `[${OPERATOR.any}(${fragment}, ${encode(values)})]`;\n },\n\n in(fragment: string, values: string[]): string {\n return `[${OPERATOR.in}(${fragment}, ${encode(values)})]`;\n },\n\n fulltext(fragment: string, value: string): string {\n return `[${OPERATOR.fulltext}(${fragment}, ${encode(value)})]`;\n },\n\n similar(documentId: string, maxResults: number): string {\n return `[${OPERATOR.similar}(\"${documentId}\", ${maxResults})]`;\n },\n\n date,\n\n dateBefore: date.before,\n\n dateAfter: date.after,\n\n dateBetween: date.between,\n\n dayOfMonth: date.dayOfMonth,\n\n dayOfMonthAfter: date.dayOfMonthAfter,\n\n dayOfMonthBefore: date.dayOfMonthBefore,\n\n dayOfWeek: date.dayOfWeek,\n\n dayOfWeekAfter: date.dayOfWeekAfter,\n\n dayOfWeekBefore: date.dayOfWeekBefore,\n\n month: date.month,\n\n monthBefore: date.monthBefore,\n\n monthAfter: date.monthAfter,\n\n year: date.year,\n\n hour: date.hour,\n\n hourBefore: date.hourBefore,\n\n hourAfter: date.hourAfter,\n\n number,\n\n gt: number.gt,\n\n lt: number.lt,\n\n inRange: number.inRange,\n\n near: geopoint.near,\n\n geopoint,\n};\n","export interface Cookie {\n [key: string]: string;\n value: string;\n}\n\n// Some portions of code from https://github.com/jshttp/cookie\n\nvar decode = decodeURIComponent;\n\nfunction tryDecode(str: string, decode: (str: string) => string) {\n try {\n return decode(str);\n } catch (e) {\n return str;\n }\n}\n\nfunction parse(str: string, options?: any) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string');\n }\n\n var obj = {};\n var opt = options || {};\n var pairs = str.split(/; */);\n var dec = opt.decode || decode;\n\n pairs.forEach(function(pair) {\n var eq_idx = pair.indexOf('=');\n\n // skip things that don't look like key=value\n if (eq_idx < 0) {\n return;\n }\n\n var key = pair.substr(0, eq_idx).trim();\n var val = pair.substr(++eq_idx, pair.length).trim();\n\n // quoted values\n if ('\"' == val[0]) {\n val = val.slice(1, -1);\n }\n\n // only assign once\n if (undefined == obj[key]) {\n obj[key] = tryDecode(val, dec);\n }\n });\n\n return obj;\n}\n\nexport default { parse };\n","import { Document } from \"./documents\";\nimport { RequestHandler, RequestCallback } from './request';\nimport { ApiCache } from './cache';\nimport { Experiment, Experiments } from './experiments';\nimport { SearchForm, Form } from './form';\nimport Predicates from './Predicates';\nimport Cookies from './Cookies';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport HttpClient from './HttpClient';\nimport { Client } from './client';\n\nexport const PREVIEW_COOKIE = 'io.prismic.preview';\nexport const EXPERIMENT_COOKIE = 'io.prismic.experiment';\n\nexport interface Ref {\n ref: string;\n label: string;\n isMasterRef: string;\n scheduledAt: string;\n id: string;\n}\n\nexport interface ApiData {\n refs: Ref[];\n bookmarks: { [key: string]: string };\n types: { [key: string]: string };\n tags: string[];\n forms: { [key: string]: Form };\n experiments: any;\n oauth_initiate: string;\n oauth_token: string;\n version: string;\n licence: string;\n}\n\nexport interface PreviewResponse {\n mainDocument?: string;\n}\n\nexport interface QueryOptions {\n [key: string]: string | number | string[];\n}\n\nexport interface ResolvedApiOptions {\n req?: any;\n}\n\nexport default class ResolvedApi implements Client {\n data: ApiData;\n masterRef: Ref;\n experiments: Experiments;\n options: ResolvedApiOptions;\n httpClient: HttpClient;\n bookmarks: { [key: string]: string };\n refs: Ref[];\n tags: string[];\n types: { [key: string]: string };\n\n constructor(data: ApiData, httpClient: HttpClient, options: ResolvedApiOptions) {\n this.data = data;\n this.masterRef = data.refs.filter(ref => ref.isMasterRef)[0];\n this.experiments = new Experiments(data.experiments);\n this.bookmarks = data.bookmarks;\n this.httpClient = httpClient;\n this.options = options;\n this.refs = data.refs;\n this.tags = data.tags;\n this.types = data.types;\n }\n\n /**\n * Returns a useable form from its id, as described in the RESTful description of the API.\n * For instance: api.form(\"everything\") works on every repository (as \"everything\" exists by default)\n * You can then chain the calls: api.form(\"everything\").query('[[:d = at(document.id, \"UkL0gMuvzYUANCpf\")]]').ref(ref).submit()\n */\n form(formId: string): SearchForm | null {\n const form = this.data.forms[formId];\n if (form) {\n return new SearchForm(form, this.httpClient);\n }\n return null;\n }\n\n everything(): SearchForm {\n const f = this.form('everything');\n if (!f) throw new Error('Missing everything form');\n return f;\n }\n\n /**\n * The ID of the master ref on this prismic.io API.\n * Do not use like this: searchForm.ref(api.master()).\n * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.\n */\n master(): string {\n return this.masterRef.ref;\n }\n\n /**\n * Returns the ref ID for a given ref's label.\n * Do not use like this: searchForm.ref(api.ref(\"Future release label\")).\n * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.\n */\n ref(label: string): string | null {\n const ref = this.data.refs.filter(ref => ref.label === label)[0];\n return ref ? ref.ref : null;\n }\n\n currentExperiment(): Experiment | null {\n return this.experiments.current();\n }\n\n /**\n * Query the repository\n */\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb: RequestCallback = () => {}): Promise {\n const { options, callback } = typeof optionsOrCallback === 'function'\n ? { options: {} as QueryOptions, callback: optionsOrCallback }\n : { options: optionsOrCallback || {}, callback: cb };\n\n let form = this.everything();\n for (const key in options) {\n form = form.set(key, options[key]);\n }\n if (!options.ref) {\n // Look in cookies if we have a ref (preview or experiment)\n let cookieString = '';\n if (this.options.req) { // NodeJS\n cookieString = this.options.req.headers['cookie'] || '';\n } else if (typeof window !== 'undefined' && window.document) { // Browser\n cookieString = window.document.cookie || '';\n }\n const cookies = Cookies.parse(cookieString);\n const previewRef = cookies[PREVIEW_COOKIE];\n const experimentRef = this.experiments.refFromCookie(cookies[EXPERIMENT_COOKIE]);\n form = form.ref(previewRef || experimentRef || this.masterRef.ref);\n }\n if (q) {\n form.query(q);\n }\n return form.submit(callback);\n }\n\n /**\n * Retrieve the document returned by the given query\n * @param {string|array|Predicate} the query\n * @param {object} additional parameters. In NodeJS, pass the request as 'req'.\n * @param {function} callback(err, doc)\n */\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n const { options, callback } = typeof optionsOrCallback === 'function'\n ? { options: {} as QueryOptions, callback: optionsOrCallback }\n : { options: optionsOrCallback || {}, callback: cb || (() => {}) };\n\n options.page = 1;\n options.pageSize = 1;\n\n return this.query(q, options).then((response) => {\n const document = response && response.results && response.results[0];\n callback(null, document);\n return document;\n }).catch((error) => {\n callback(error);\n throw error;\n });\n }\n\n /**\n * Retrieve the document with the given id\n */\n getByID(id: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.queryFirst(Predicates.at('document.id', id), options, cb);\n }\n\n /**\n * Retrieve multiple documents from an array of id\n */\n getByIDs(ids: string[], maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.query(Predicates.in('document.id', ids), options, cb);\n }\n\n /**\n * Retrieve the document with the given uid\n */\n getByUID(type: string, uid: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.queryFirst(Predicates.at(`my.${type}.uid`, uid), options, cb);\n }\n\n /**\n * Retrieve the singleton document with the given type\n */\n getSingle(type: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n return this.queryFirst(Predicates.at('document.type', type), options, cb);\n }\n\n /**\n * Retrieve the document with the given bookmark\n */\n getBookmark(bookmark: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const id = this.data.bookmarks[bookmark];\n if (id) {\n return this.getByID(id, maybeOptions, cb);\n } else {\n return Promise.reject('Error retrieving bookmarked id');\n }\n }\n\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise {\n return this.httpClient.request(token).then((result) => {\n if (!result.mainDocument) {\n cb && cb(null, defaultUrl);\n return Promise.resolve(defaultUrl);\n } else {\n return this.getByID(result.mainDocument, { ref: token }).then((document) => {\n if (!document) {\n cb && cb(null, defaultUrl);\n return defaultUrl;\n } else {\n const url = linkResolver(document);\n cb && cb(null, url);\n return url;\n }\n });\n }\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","export class Variation {\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n }\n\n id(): string {\n return this.data.id;\n }\n\n ref(): string {\n return this.data.ref;\n }\n\n label(): string {\n return this.data.label;\n }\n}\n\nexport class Experiment {\n variations: Variation[];\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n this.variations = (data.variations || []).map((v: any) => {\n return new Variation(v);\n });\n }\n\n id(): string {\n return this.data.id;\n }\n\n googleId(): string {\n return this.data.googleId;\n }\n\n name(): string {\n return this.data.name;\n }\n}\n\nexport class Experiments {\n drafts: Experiment[];\n running: Experiment[];\n\n constructor(data: any) {\n if (data) {\n this.drafts = (data.drafts || []).map((exp: any) => {\n return new Experiment(exp);\n });\n this.running = (data.running || []).map((exp: any) => {\n return new Experiment(exp);\n });\n }\n }\n\n current(): Experiment | null {\n if (this.running.length > 0) {\n return this.running[0];\n } else {\n return null;\n }\n }\n refFromCookie(cookie: string): string | null {\n if (!cookie || cookie.trim() === '') return null;\n const splitted = cookie.trim().split(' ');\n if (splitted.length < 2) return null;\n const expId = splitted[0];\n const varIndex = parseInt(splitted[1], 10);\n const exp = this.running.filter((exp) => {\n return exp.googleId() === expId && exp.variations.length > varIndex;\n })[0];\n return exp ? exp.variations[varIndex].ref() : null;\n }\n}\n","/**\n* A doubly linked list-based Least Recently Used (LRU) cache. Will keep most\n* recently used items while discarding least recently used items when its limit\n* is reached.\n*\n* Licensed under MIT. Copyright (c) 2010 Rasmus Andersson \n* Typescript-ified by Oleksandr Nikitin \n*\n* Illustration of the design:\n*\n* entry entry entry entry\n* ______ ______ ______ ______\n* | head |.newer => | |.newer => | |.newer => | tail |\n* | A | | B | | C | | D |\n* |______| <= older.|______| <= older.|______| <= older.|______|\n*\n* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added\n*/\n\nexport function MakeLRUCache(limit: number): ILRUCache {\n return new (LRUCache)(limit);\n}\n\nexport interface ILRUCache {\n put(key: string, value: any): void;\n get(key: string, Entry: boolean): any;\n remove(key: String): void;\n removeAll(): void;\n}\n\nfunction LRUCache(limit: number) {\n // Current size of the cache. (Read-only).\n this.size = 0;\n // Maximum number of items this cache can hold.\n this.limit = limit;\n this._keymap = {};\n}\n\ninterface IEntry {\n newer?: IEntry;\n older?: IEntry;\n key: string;\n value: any;\n}\n\n/**\n * Put into the cache associated with . Returns the entry which was\n * removed to make room for the new entry. Otherwise undefined is returned\n * (i.e. if there was enough room already).\n */\nLRUCache.prototype.put = function (key: string, value: any) {\n var entry: IEntry = { key: key, value: value };\n // Note: No protection agains replacing, and thus orphan entries. By design.\n this._keymap[key] = entry;\n if (this.tail) {\n // link previous tail to the new tail (entry)\n this.tail.newer = entry;\n entry.older = this.tail;\n } else {\n // we're first in -- yay\n this.head = entry;\n }\n // add new entry to the end of the linked list -- it's now the freshest entry.\n this.tail = entry;\n if (this.size === this.limit) {\n // we hit the limit -- remove the head\n return this.shift();\n } else {\n // increase the size counter\n this.size++;\n }\n};\n\n/**\n * Purge the least recently used (oldest) entry from the cache. Returns the\n * removed entry or undefined if the cache was empty.\n *\n * If you need to perform any form of finalization of purged items, this is a\n * good place to do it. Simply override/replace this function:\n *\n * var c = new LRUCache(123);\n * c.shift = function() {\n * var entry = LRUCache.prototype.shift.call(this);\n * doSomethingWith(entry);\n * return entry;\n * }\n */\nLRUCache.prototype.shift = function () {\n // todo: handle special case when limit == 1\n var entry = this.head;\n if (entry) {\n if (this.head.newer) {\n this.head = this.head.newer;\n this.head.older = undefined;\n } else {\n this.head = undefined;\n }\n // Remove last strong reference to and remove links from the purged\n // entry being returned:\n entry.newer = entry.older = undefined;\n // delete is slow, but we need to do this to avoid uncontrollable growth:\n delete this._keymap[entry.key];\n }\n console.log('purging ', entry.key);\n return entry;\n};\n\n/**\n * Get and register recent use of . Returns the value associated with \n * or undefined if not in cache.\n */\nLRUCache.prototype.get = function (key: string, returnEntry: boolean): any {\n // First, find our cache entry\n var entry = this._keymap[key];\n if (entry === undefined) return; // Not cached. Sorry.\n // As was found in the cache, register it as being requested recently\n if (entry === this.tail) {\n // Already the most recently used entry, so no need to update the list\n return returnEntry ? entry : entry.value;\n }\n // HEAD--------------TAIL\n // <.older .newer>\n // <--- add direction --\n // A B C E\n if (entry.newer) {\n if (entry === this.head)\n this.head = entry.newer;\n entry.newer.older = entry.older; // C <-- E.\n }\n if (entry.older)\n entry.older.newer = entry.newer; // C. --> E\n entry.newer = undefined; // D --x\n entry.older = this.tail; // D. --> E\n if (this.tail)\n this.tail.newer = entry; // E. <-- D\n this.tail = entry;\n return returnEntry ? entry : entry.value;\n};\n\n// ----------------------------------------------------------------------------\n// Following code is optional and can be removed without breaking the core\n// functionality.\n\n/**\n * Check if is in the cache without registering recent use. Feasible if\n * you do not want to chage the state of the cache, but only \"peek\" at it.\n * Returns the entry associated with if found, or undefined if not found.\n */\nLRUCache.prototype.find = function (key: string) {\n return this._keymap[key];\n};\n\n/**\n * Update the value of entry with . Returns the old value, or undefined if\n * entry was not in the cache.\n */\nLRUCache.prototype.set = function (key: string, value: any) {\n var oldvalue: any;\n var entry = this.get(key, true);\n if (entry) {\n oldvalue = entry.value;\n entry.value = value;\n } else {\n oldvalue = this.put(key, value);\n if (oldvalue) oldvalue = oldvalue.value;\n }\n return oldvalue;\n};\n\n/**\n * Remove entry from cache and return its value. Returns undefined if not\n * found.\n */\nLRUCache.prototype.remove = function (key: string) {\n var entry = this._keymap[key];\n if (!entry) return;\n delete this._keymap[entry.key]; // need to do delete unfortunately\n if (entry.newer && entry.older) {\n // relink the older entry with the newer entry\n entry.older.newer = entry.newer;\n entry.newer.older = entry.older;\n } else if (entry.newer) {\n // remove the link to us\n entry.newer.older = undefined;\n // link the newer entry to head\n this.head = entry.newer;\n } else if (entry.older) {\n // remove the link to us\n entry.older.newer = undefined;\n // link the newer entry to head\n this.tail = entry.older;\n } else {// if(entry.older === undefined && entry.newer === undefined) {\n this.head = this.tail = undefined;\n }\n\n this.size--;\n return entry.value;\n};\n\n/** Removes all entries */\nLRUCache.prototype.removeAll = function () {\n // This should be safe, as we never expose strong refrences to the outside\n this.head = this.tail = undefined;\n this.size = 0;\n this._keymap = {};\n};\n\n/**\n * Return an array containing all keys of entries stored in the cache object, in\n * arbitrary order.\n */\nif (typeof Object.keys === 'function') {\n LRUCache.prototype.keys = function () { return Object.keys(this._keymap); };\n} else {\n LRUCache.prototype.keys = function () {\n var keys: string[] = [];\n for (var k in this._keymap) keys.push(k);\n return keys;\n };\n}\n\n/**\n * Call `fun` for each entry. Starting with the newest entry if `desc` is a true\n * value, otherwise starts with the oldest (head) enrty and moves towards the\n * tail.\n *\n * `fun` is called with 3 arguments in the context `context`:\n * `fun.call(context, Object key, Object value, LRUCache self)`\n */\nLRUCache.prototype.forEach = function (fun: Function, context: any, desc: boolean) {\n var entry: IEntry | undefined;\n if (context === true) { desc = true; context = undefined; }\n else if (typeof context !== 'object') context = this;\n if (desc) {\n entry = this.tail;\n while (entry) {\n fun.call(context, entry.key, entry.value, this);\n entry = entry.older;\n }\n } else {\n entry = this.head;\n while (entry) {\n fun.call(context, entry.key, entry.value, this);\n entry = entry.newer;\n }\n }\n};\n\n/** Returns a JSON (array) representation */\n//LRUCache.prototype.toJSON = function () {\n// var s: IEntry[] = [], entry = this.head;\n// while (entry) {\n// s.push({ key: entry.key.toJSON(), value: entry.value.toJSON() });\n// entry = entry.newer;\n// }\n// return s;\n//};\n\n/** Returns a String representation */\nLRUCache.prototype.toString = function () {\n var s = '', entry = this.head;\n while (entry) {\n s += String(entry.key) + ':' + entry.value;\n entry = entry.newer;\n if (entry)\n s += ' < ';\n }\n return s;\n};\n\n// Export ourselves\n//if (typeof this === 'object') this.LRUCache = LRUCache;","import { ILRUCache, MakeLRUCache } from './lru';\n\nexport interface ApiCache {\n isExpired(key: String): boolean;\n get(key: string, cb: (error: Error | null, entry?: T) => void): void;\n set(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void;\n remove(key: string, cb?: (error: Error | null) => void): void;\n clear(cb?: (error: Error | null) => void): void;\n}\n\nexport class DefaultApiCache implements ApiCache {\n lru: ILRUCache;\n\n constructor(limit: number = 1000) {\n this.lru = MakeLRUCache(limit);\n }\n\n isExpired(key: string): boolean {\n const value = this.lru.get(key, false);\n if (value) {\n return value.expiredIn !== 0 && value.expiredIn < Date.now();\n } else {\n return false;\n }\n }\n\n get(key: string, cb: (error: Error | null, entry?: T) => void): void {\n const value = this.lru.get(key, false);\n if (value && !this.isExpired(key)) {\n cb(null, value.data);\n } else {\n cb && cb(null);\n }\n }\n\n set(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void {\n this.lru.remove(key);\n this.lru.put(key, {\n data: value,\n expiredIn: ttl ? (Date.now() + (ttl * 1000)) : 0,\n });\n cb && cb(null);\n }\n\n remove(key: string, cb?: (error: Error | null) => void): void {\n this.lru.remove(key);\n cb && cb(null);\n }\n\n clear(cb?: (error: Error | null) => void): void {\n this.lru.removeAll();\n cb && cb(null);\n }\n}\n","// In the browser, node-fetch exports self.fetch:\n// https://github.com/bitinn/node-fetch/blob/master/browser.js\nimport fetches, { RequestInit } from 'node-fetch';\n\n// Number of maximum simultaneous connections to the prismic server\nconst MAX_CONNECTIONS: number = 20;\n// Number of requests currently running (capped by MAX_CONNECTIONS)\nlet running: number = 0;\n\ninterface Task {\n url: string;\n callback: RequestCallback;\n}\n\n// Requests in queue\nconst queue: Task[] = [];\n\ninterface NodeRequestInit extends RequestInit {\n agent?: any;\n}\n\nfunction fetchRequest(url: string, options: RequestHandlerOption, callback: RequestCallback): void {\n\n const fetchOptions = {\n headers: {\n Accept: 'application/json',\n },\n } as NodeRequestInit;\n\n if (options && options.proxyAgent) {\n fetchOptions.agent = options.proxyAgent;\n }\n\n fetches(url, fetchOptions).then((xhr) => {\n if (~~(xhr.status / 100 !== 2)) {\n /**\n * @description\n * drain the xhr before throwing an error to prevent memory leaks\n * @link https://github.com/bitinn/node-fetch/issues/83\n */\n return xhr.text().then(() => {\n const e: any = new Error(`Unexpected status code [${xhr.status}] on URL ${url}`);\n e.status = xhr.status;\n throw e;\n });\n } else {\n return xhr.json().then((result) => {\n const cacheControl = xhr.headers.get('cache-control');\n const parsedCacheControl = cacheControl ? /max-age=(\\d+)/.exec(cacheControl) : null;\n const ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined;\n callback(null, result, xhr, ttl);\n });\n }\n }).catch(callback);\n}\n\nfunction processQueue(options: RequestHandlerOption): void {\n if (queue.length > 0 && running < MAX_CONNECTIONS) {\n running++;\n\n const req = queue.shift();\n\n if (req) {\n\n fetchRequest(req.url, options, (error, result, xhr, ttl) => {\n running--;\n req.callback(error, result, xhr, ttl);\n processQueue(options);\n });\n }\n }\n}\n\nexport type RequestCallback = (error: Error | null, result?: T | null, xhr?: any, ttl?: number) => void;\n\nexport interface RequestHandlerOption {\n proxyAgent?: any;\n}\n\nexport interface RequestHandler {\n request(url: string, cb: RequestCallback): void;\n}\n\nexport class DefaultRequestHandler implements RequestHandler {\n\n options: RequestHandlerOption;\n\n constructor(options?: RequestHandlerOption) {\n this.options = options || {};\n }\n\n request(url: string, callback: RequestCallback): void {\n queue.push({ url, callback });\n processQueue(this.options);\n }\n}\n","import { ApiCache, DefaultApiCache } from './cache';\nimport { RequestHandler, DefaultRequestHandler, RequestCallback } from './request';\n\nexport interface HttpClientOptions {\n ttl?: number;\n cacheKey?: string;\n}\n\nexport default class HttpClient {\n\n private cache: ApiCache;\n private requestHandler: RequestHandler;\n\n constructor(requestHandler?: RequestHandler, cache?: ApiCache, proxyAgent?: any) {\n this.requestHandler = requestHandler || new DefaultRequestHandler({ proxyAgent });\n this.cache = cache || new DefaultApiCache();\n }\n\n request(url: string, callback?: RequestCallback): Promise {\n return new Promise((resolve, reject) => {\n this.requestHandler.request(url, (err, result, xhr, ttl) => {\n if (err) {\n reject(err);\n callback && callback(err, null, xhr, ttl);\n } else if (result) {\n resolve(result);\n callback && callback(null, result, xhr, ttl);\n }\n });\n });\n }\n\n /**\n * Fetch a URL corresponding to a query, and parse the response as a Response object\n */\n cachedRequest(url: string, maybeOptions?: HttpClientOptions): Promise {\n const options = maybeOptions || {};\n const run = (cb: RequestCallback) => {\n const cacheKey = options.cacheKey || url;\n this.cache.get(cacheKey, (cacheGetError, cacheGetValue) => {\n if (cacheGetError || cacheGetValue) {\n cb(cacheGetError, cacheGetValue);\n } else {\n this.request(url, (fetchError, fetchValue, xhr, ttlReq) => {\n if (fetchError) {\n cb(fetchError, null);\n } else {\n const ttl = ttlReq || options.ttl;\n if (ttl) {\n this.cache.set(cacheKey, fetchValue, ttl, cb);\n }\n cb(null, fetchValue);\n }\n });\n }\n });\n };\n\n return new Promise((resolve, reject) => {\n run((err, value) => {\n if (err) reject(err);\n if (value) resolve(value);\n });\n });\n }\n}\n","import Predicates from './Predicates';\nimport { RequestHandler, RequestCallback } from './request';\nimport { Document } from './documents';\nimport { ApiCache } from './cache';\nimport ResolvedApi, { ApiData } from './ResolvedApi';\nimport HttpClient from './HttpClient';\n\nexport interface ApiOptions {\n accessToken?: string;\n requestHandler?: RequestHandler;\n req?: any;\n apiCache?: ApiCache;\n apiDataTTL?: number;\n proxyAgent?: any;\n}\n\nexport default class Api {\n url: string;\n options: ApiOptions;\n apiDataTTL: number;\n httpClient: HttpClient;\n\n constructor(url: string, options?: ApiOptions) {\n this.options = options || {};\n this.url = url;\n if (this.options.accessToken) {\n const accessTokenParam = `access_token=${this.options.accessToken}`;\n this.url += (url.indexOf('?') > -1 ? '&' : '?') + accessTokenParam;\n }\n this.apiDataTTL = this.options.apiDataTTL || 5;\n this.httpClient = new HttpClient(\n this.options.requestHandler,\n this.options.apiCache,\n this.options.proxyAgent,\n );\n }\n\n /**\n * Fetches data used to construct the api client, from cache if it's\n * present, otherwise from calling the prismic api endpoint (which is\n * then cached).\n */\n get(cb?: RequestCallback): Promise {\n return this.httpClient.cachedRequest(this.url, { ttl: this.apiDataTTL }).then((data) => {\n const resolvedApi = new ResolvedApi(data, this.httpClient, this.options);\n cb && cb(null, resolvedApi);\n return resolvedApi;\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","import { Document } from \"./documents\";\nimport ResolvedApi, { QueryOptions, EXPERIMENT_COOKIE, PREVIEW_COOKIE } from './ResolvedApi';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport { SearchForm, LazySearchForm } from './form';\nimport { Experiment } from './experiments';\nimport { RequestHandler, RequestCallback } from './request';\nimport Api, { ApiOptions } from './Api';\n\nexport interface Client {\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise;\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb: RequestCallback): Promise;\n getByID(id: string, options: QueryOptions, cb: RequestCallback): Promise;\n getByIDs(ids: string[], options: QueryOptions, cb: RequestCallback): Promise;\n getByUID(type: string, uid: string, options: QueryOptions, cb: RequestCallback): Promise;\n getSingle(type: string, options: QueryOptions, cb: RequestCallback): Promise;\n getBookmark(bookmark: string, options: QueryOptions, cb: RequestCallback): Promise;\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise;\n}\n\nexport class DefaultClient implements Client {\n\n api: Api;\n resolvedApi: ResolvedApi;\n\n constructor(url: string, options?: ApiOptions) {\n this.api = new Api(url, options);\n }\n\n getApi(): Promise {\n return this.api.get();\n }\n\n everything(): LazySearchForm {\n return this.form('everything');\n }\n\n form(formId: string): LazySearchForm {\n return new LazySearchForm(formId, this.api);\n }\n\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.query(q, optionsOrCallback, cb));\n }\n\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.queryFirst(q, optionsOrCallback, cb));\n }\n\n getByID(id: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByID(id, options, cb));\n }\n\n getByIDs(ids: string[], options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByIDs(ids, options, cb));\n }\n\n getByUID(type: string, uid: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByUID(type, uid, options, cb));\n }\n\n getSingle(type: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getSingle(type, options, cb));\n }\n\n getBookmark(bookmark: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getBookmark(bookmark, options, cb));\n }\n\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.previewSession(token, linkResolver, defaultUrl, cb));\n }\n\n static getApi(url: string, options?: ApiOptions): Promise {\n const api = new Api(url, options);\n return api.get();\n }\n}\n","import ResolvedApi, { EXPERIMENT_COOKIE as experimentCookie, PREVIEW_COOKIE as previewCookie } from './ResolvedApi';\nimport Predicates from './Predicates';\nimport { Experiments } from './Experiments';\nimport Api, { ApiOptions } from './Api';\nimport { DefaultClient } from './client';\n\nexport {\n experimentCookie,\n previewCookie,\n Predicates,\n Experiments,\n Api\n};\n\nexport function client(url: string, options?: ApiOptions) {\n return new DefaultClient(url, options);\n}\n\nexport function getApi(url: string, options?: ApiOptions): Promise {\n return DefaultClient.getApi(url, options);\n}\n\nexport function api(url: string, options?: ApiOptions): Promise {\n return getApi(url, options);\n}"],"names":["Variation","Experiment","Experiments"],"mappings":";;AAAO,MAAM,SAAS;IAGpB,YAAY,IAAS;QAFrB,SAAI,GAAQ,EAAE,CAAC;QAGb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;IAED,EAAE;QACA,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;KACrB;IAED,GAAG;QACD,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;KACtB;IAED,KAAK;QACH,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;KACxB;CACF;AAEM,MAAM,UAAU;IAIrB,YAAY,IAAS;QAFrB,SAAI,GAAQ,EAAE,CAAC;QAGb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,EAAE,GAAG,CAAC,CAAC,CAAM;YACnD,OAAO,IAAI,SAAS,CAAC,CAAC,CAAC,CAAC;SACzB,CAAC,CAAC;KACJ;IAED,EAAE;QACA,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;KACrB;IAED,QAAQ;QACN,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC;KAC3B;I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/dist/prismic-javascript.js new file mode 100644 index 00000000..afc06cd9 --- /dev/null +++ b/dist/prismic-javascript.js @@ -0,0 +1,1191 @@ +'use strict'; + +Object.defineProperty(exports, '__esModule', { value: true }); + +var Variation = /** @class */ (function () { + function Variation(data) { + this.data = {}; + this.data = data; + } + Variation.prototype.id = function () { + return this.data.id; + }; + Variation.prototype.ref = function () { + return this.data.ref; + }; + Variation.prototype.label = function () { + return this.data.label; + }; + return Variation; +}()); +var Experiment = /** @class */ (function () { + function Experiment(data) { + this.data = {}; + this.data = data; + this.variations = (data.variations || []).map(function (v) { + return new Variation(v); + }); + } + Experiment.prototype.id = function () { + return this.data.id; + }; + Experiment.prototype.googleId = function () { + return this.data.googleId; + }; + Experiment.prototype.name = function () { + return this.data.name; + }; + return Experiment; +}()); +var Experiments = /** @class */ (function () { + function Experiments(data) { + if (data) { + this.drafts = (data.drafts || []).map(function (exp) { + return new Experiment(exp); + }); + this.running = (data.running || []).map(function (exp) { + return new Experiment(exp); + }); + } + } + Experiments.prototype.current = function () { + if (this.running.length > 0) { + return this.running[0]; + } + else { + return null; + } + }; + Experiments.prototype.refFromCookie = function (cookie) { + if (!cookie || cookie.trim() === '') + return null; + var splitted = cookie.trim().split(' '); + if (splitted.length < 2) + return null; + var expId = splitted[0]; + var varIndex = parseInt(splitted[1], 10); + var exp = this.running.filter(function (exp) { + return exp.googleId() === expId && exp.variations.length > varIndex; + })[0]; + return exp ? exp.variations[varIndex].ref() : null; + }; + return Experiments; +}()); + +var LazySearchForm = /** @class */ (function () { + function LazySearchForm(id, api) { + this.id = id; + this.api = api; + this.fields = {}; + } + LazySearchForm.prototype.set = function (key, value) { + this.fields[key] = value; + return this; + }; + LazySearchForm.prototype.ref = function (ref) { + return this.set('ref', ref); + }; + LazySearchForm.prototype.query = function (query) { + return this.set('q', query); + }; + LazySearchForm.prototype.pageSize = function (size) { + return this.set('pageSize', size); + }; + LazySearchForm.prototype.fetch = function (fields) { + console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.'); + return this.set('fetch', fields); + }; + LazySearchForm.prototype.fetchLinks = function (fields) { + console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.'); + return this.set('fetchLinks', fields); + }; + LazySearchForm.prototype.graphQuery = function (query) { + return this.set('graphQuery', query); + }; + LazySearchForm.prototype.lang = function (langCode) { + return this.set('lang', langCode); + }; + LazySearchForm.prototype.page = function (p) { + return this.set('page', p); + }; + LazySearchForm.prototype.after = function (documentId) { + return this.set('after', documentId); + }; + LazySearchForm.prototype.orderings = function (orderings) { + return this.set('orderings', orderings); + }; + LazySearchForm.prototype.url = function () { + var _this = this; + return this.api.get().then(function (api) { + return LazySearchForm.toSearchForm(_this, api).url(); + }); + }; + LazySearchForm.prototype.submit = function (cb) { + var _this = this; + return this.api.get().then(function (api) { + return LazySearchForm.toSearchForm(_this, api).submit(cb); + }); + }; + LazySearchForm.toSearchForm = function (lazyForm, api) { + var form = api.form(lazyForm.id); + if (form) { + return Object.keys(lazyForm.fields).reduce(function (form, fieldKey) { + var fieldValue = lazyForm.fields[fieldKey]; + if (fieldKey === 'q') { + return form.query(fieldValue); + } + else if (fieldKey === 'pageSize') { + return form.pageSize(fieldValue); + } + else if (fieldKey === 'fetch') { + return form.fetch(fieldValue); + } + else if (fieldKey === 'fetchLinks') { + return form.fetchLinks(fieldValue); + } + else if (fieldKey === 'graphQuery') { + return form.graphQuery(fieldValue); + } + else if (fieldKey === 'lang') { + return form.lang(fieldValue); + } + else if (fieldKey === 'page') { + return form.page(fieldValue); + } + else if (fieldKey === 'after') { + return form.after(fieldValue); + } + else if (fieldKey === 'orderings') { + return form.orderings(fieldValue); + } + else { + return form.set(fieldKey, fieldValue); + } + }, form); + } + else { + throw new Error("Unable to access to form " + lazyForm.id); + } + }; + return LazySearchForm; +}()); +var SearchForm = /** @class */ (function () { + function SearchForm(form, httpClient) { + this.httpClient = httpClient; + this.form = form; + this.data = {}; + for (var field in form.fields) { + if (form.fields[field]['default']) { + this.data[field] = [form.fields[field]['default']]; + } + } + } + SearchForm.prototype.set = function (field, value) { + var fieldDesc = this.form.fields[field]; + if (!fieldDesc) + throw new Error('Unknown field ' + field); + var checkedValue = value === '' || value === undefined ? null : value; + var values = this.data[field] || []; + if (fieldDesc.multiple) { + values = checkedValue ? values.concat([checkedValue]) : values; + } + else { + values = checkedValue ? [checkedValue] : values; + } + this.data[field] = values; + return this; + }; + /** + * Sets a ref to query on for this SearchForm. This is a mandatory + * method to call before calling submit(), and api.form('everything').submit() + * will not work. + */ + SearchForm.prototype.ref = function (ref) { + return this.set('ref', ref); + }; + /** + * Sets a predicate-based query for this SearchForm. This is where you + * paste what you compose in your prismic.io API browser. + */ + SearchForm.prototype.query = function (query) { + if (typeof query === 'string') { + return this.query([query]); + } + else if (Array.isArray(query)) { + return this.set('q', "[" + query.join('') + "]"); + } + else { + throw new Error("Invalid query : " + query); + } + }; + /** + * Sets a page size to query for this SearchForm. This is an optional method. + * + * @param {number} size - The page size + * @returns {SearchForm} - The SearchForm itself + */ + SearchForm.prototype.pageSize = function (size) { + return this.set('pageSize', size); + }; + /** + * Restrict the results document to the specified fields + */ + SearchForm.prototype.fetch = function (fields) { + console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.'); + var strFields = Array.isArray(fields) ? fields.join(',') : fields; + return this.set('fetch', strFields); + }; + /** + * Include the requested fields in the DocumentLink instances in the result + */ + SearchForm.prototype.fetchLinks = function (fields) { + console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.'); + var strFields = Array.isArray(fields) ? fields.join(',') : fields; + return this.set('fetchLinks', strFields); + }; + /** + * Sets the graphquery to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.graphQuery = function (query) { + return this.set('graphQuery', query); + }; + /** + * Sets the language to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.lang = function (langCode) { + return this.set('lang', langCode); + }; + /** + * Sets the page number to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.page = function (p) { + return this.set('page', p); + }; + /** + * Remove all the documents except for those after the specified document in the list. This is an optional method. + */ + SearchForm.prototype.after = function (documentId) { + return this.set('after', documentId); + }; + /** + * Sets the orderings to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.orderings = function (orderings) { + if (!orderings) { + return this; + } + else { + return this.set('orderings', "[" + orderings.join(',') + "]"); + } + }; + /** + * Build the URL to query + */ + SearchForm.prototype.url = function () { + var url = this.form.action; + if (this.data) { + var sep = (url.indexOf('?') > -1 ? '&' : '?'); + for (var key in this.data) { + if (this.data.hasOwnProperty(key)) { + var values = this.data[key]; + if (values) { + for (var i = 0; i < values.length; i++) { + url += sep + key + '=' + encodeURIComponent(values[i]); + sep = '&'; + } + } + } + } + } + return url; + }; + /** + * Submits the query, and calls the callback function. + */ + SearchForm.prototype.submit = function (cb) { + return this.httpClient.cachedRequest(this.url()).then(function (response) { + cb && cb(null, response); + return response; + }).catch(function (error) { + cb && cb(error); + throw error; + }); + }; + return SearchForm; +}()); + +var OPERATOR = { + at: 'at', + not: 'not', + missing: 'missing', + has: 'has', + any: 'any', + in: 'in', + fulltext: 'fulltext', + similar: 'similar', + numberGt: 'number.gt', + numberLt: 'number.lt', + numberInRange: 'number.inRange', + dateBefore: 'date.before', + dateAfter: 'date.after', + dateBetween: 'date.between', + dateDayOfMonth: 'date.day-of-month', + dateDayOfMonthAfter: 'date.day-of-month-after', + dateDayOfMonthBefore: 'date.day-of-month-before', + dateDayOfWeek: 'date.day-of-week', + dateDayOfWeekAfter: 'date.day-of-week-after', + dateDayOfWeekBefore: 'date.day-of-week-before', + dateMonth: 'date.month', + dateMonthBefore: 'date.month-before', + dateMonthAfter: 'date.month-after', + dateYear: 'date.year', + dateHour: 'date.hour', + dateHourBefore: 'date.hour-before', + dateHourAfter: 'date.hour-after', + GeopointNear: 'geopoint.near', +}; +function encode(value) { + if (typeof value === 'string') { + return "\"" + value + "\""; + } + else if (typeof value === 'number') { + return value.toString(); + } + else if (value instanceof Date) { + return value.getTime().toString(); + } + else if (Array.isArray(value)) { + return "[" + value.map(function (v) { return encode(v); }).join(',') + "]"; + } + else { + throw new Error("Unable to encode " + value + " of type " + typeof value); + } +} +var geopoint = { + near: function (fragment, latitude, longitude, radius) { + return "[" + OPERATOR.GeopointNear + "(" + fragment + ", " + latitude + ", " + longitude + ", " + radius + ")]"; + }, +}; +var date = { + before: function (fragment, before) { + return "[" + OPERATOR.dateBefore + "(" + fragment + ", " + encode(before) + ")]"; + }, + after: function (fragment, after) { + return "[" + OPERATOR.dateAfter + "(" + fragment + ", " + encode(after) + ")]"; + }, + between: function (fragment, before, after) { + return "[" + OPERATOR.dateBetween + "(" + fragment + ", " + encode(before) + ", " + encode(after) + ")]"; + }, + dayOfMonth: function (fragment, day) { + return "[" + OPERATOR.dateDayOfMonth + "(" + fragment + ", " + day + ")]"; + }, + dayOfMonthAfter: function (fragment, day) { + return "[" + OPERATOR.dateDayOfMonthAfter + "(" + fragment + ", " + day + ")]"; + }, + dayOfMonthBefore: function (fragment, day) { + return "[" + OPERATOR.dateDayOfMonthBefore + "(" + fragment + ", " + day + ")]"; + }, + dayOfWeek: function (fragment, day) { + return "[" + OPERATOR.dateDayOfWeek + "(" + fragment + ", " + encode(day) + ")]"; + }, + dayOfWeekAfter: function (fragment, day) { + return "[" + OPERATOR.dateDayOfWeekAfter + "(" + fragment + ", " + encode(day) + ")]"; + }, + dayOfWeekBefore: function (fragment, day) { + return "[" + OPERATOR.dateDayOfWeekBefore + "(" + fragment + ", " + encode(day) + ")]"; + }, + month: function (fragment, month) { + return "[" + OPERATOR.dateMonth + "(" + fragment + ", " + encode(month) + ")]"; + }, + monthBefore: function (fragment, month) { + return "[" + OPERATOR.dateMonthBefore + "(" + fragment + ", " + encode(month) + ")]"; + }, + monthAfter: function (fragment, month) { + return "[" + OPERATOR.dateMonthAfter + "(" + fragment + ", " + encode(month) + ")]"; + }, + year: function (fragment, year) { + return "[" + OPERATOR.dateYear + "(" + fragment + ", " + year + ")]"; + }, + hour: function (fragment, hour) { + return "[" + OPERATOR.dateHour + "(" + fragment + ", " + hour + ")]"; + }, + hourBefore: function (fragment, hour) { + return "[" + OPERATOR.dateHourBefore + "(" + fragment + ", " + hour + ")]"; + }, + hourAfter: function (fragment, hour) { + return "[" + OPERATOR.dateHourAfter + "(" + fragment + ", " + hour + ")]"; + }, +}; +var number = { + gt: function (fragment, value) { + return "[" + OPERATOR.numberGt + "(" + fragment + ", " + value + ")]"; + }, + lt: function (fragment, value) { + return "[" + OPERATOR.numberLt + "(" + fragment + ", " + value + ")]"; + }, + inRange: function (fragment, before, after) { + return "[" + OPERATOR.numberInRange + "(" + fragment + ", " + before + ", " + after + ")]"; + }, +}; +var Predicates = { + at: function (fragment, value) { + return "[" + OPERATOR.at + "(" + fragment + ", " + encode(value) + ")]"; + }, + not: function (fragment, value) { + return "[" + OPERATOR.not + "(" + fragment + ", " + encode(value) + ")]"; + }, + missing: function (fragment) { + return "[" + OPERATOR.missing + "(" + fragment + ")]"; + }, + has: function (fragment) { + return "[" + OPERATOR.has + "(" + fragment + ")]"; + }, + any: function (fragment, values) { + return "[" + OPERATOR.any + "(" + fragment + ", " + encode(values) + ")]"; + }, + in: function (fragment, values) { + return "[" + OPERATOR.in + "(" + fragment + ", " + encode(values) + ")]"; + }, + fulltext: function (fragment, value) { + return "[" + OPERATOR.fulltext + "(" + fragment + ", " + encode(value) + ")]"; + }, + similar: function (documentId, maxResults) { + return "[" + OPERATOR.similar + "(\"" + documentId + "\", " + maxResults + ")]"; + }, + date: date, + dateBefore: date.before, + dateAfter: date.after, + dateBetween: date.between, + dayOfMonth: date.dayOfMonth, + dayOfMonthAfter: date.dayOfMonthAfter, + dayOfMonthBefore: date.dayOfMonthBefore, + dayOfWeek: date.dayOfWeek, + dayOfWeekAfter: date.dayOfWeekAfter, + dayOfWeekBefore: date.dayOfWeekBefore, + month: date.month, + monthBefore: date.monthBefore, + monthAfter: date.monthAfter, + year: date.year, + hour: date.hour, + hourBefore: date.hourBefore, + hourAfter: date.hourAfter, + number: number, + gt: number.gt, + lt: number.lt, + inRange: number.inRange, + near: geopoint.near, + geopoint: geopoint, +}; + +// Some portions of code from https://github.com/jshttp/cookie +var decode = decodeURIComponent; +function tryDecode(str, decode) { + try { + return decode(str); + } + catch (e) { + return str; + } +} +function parse(str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string'); + } + var obj = {}; + var opt = options || {}; + var pairs = str.split(/; */); + var dec = opt.decode || decode; + pairs.forEach(function (pair) { + var eq_idx = pair.indexOf('='); + // skip things that don't look like key=value + if (eq_idx < 0) { + return; + } + var key = pair.substr(0, eq_idx).trim(); + var val = pair.substr(++eq_idx, pair.length).trim(); + // quoted values + if ('"' == val[0]) { + val = val.slice(1, -1); + } + // only assign once + if (undefined == obj[key]) { + obj[key] = tryDecode(val, dec); + } + }); + return obj; +} +var Cookies = { parse: parse }; + +var PREVIEW_COOKIE = 'io.prismic.preview'; +var EXPERIMENT_COOKIE = 'io.prismic.experiment'; +var ResolvedApi = /** @class */ (function () { + function ResolvedApi(data, httpClient, options) { + this.data = data; + this.masterRef = data.refs.filter(function (ref) { return ref.isMasterRef; })[0]; + this.experiments = new Experiments(data.experiments); + this.bookmarks = data.bookmarks; + this.httpClient = httpClient; + this.options = options; + this.refs = data.refs; + this.tags = data.tags; + this.types = data.types; + } + /** + * Returns a useable form from its id, as described in the RESTful description of the API. + * For instance: api.form("everything") works on every repository (as "everything" exists by default) + * You can then chain the calls: api.form("everything").query('[[:d = at(document.id, "UkL0gMuvzYUANCpf")]]').ref(ref).submit() + */ + ResolvedApi.prototype.form = function (formId) { + var form = this.data.forms[formId]; + if (form) { + return new SearchForm(form, this.httpClient); + } + return null; + }; + ResolvedApi.prototype.everything = function () { + var f = this.form('everything'); + if (!f) + throw new Error('Missing everything form'); + return f; + }; + /** + * The ID of the master ref on this prismic.io API. + * Do not use like this: searchForm.ref(api.master()). + * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page. + */ + ResolvedApi.prototype.master = function () { + return this.masterRef.ref; + }; + /** + * Returns the ref ID for a given ref's label. + * Do not use like this: searchForm.ref(api.ref("Future release label")). + * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page. + */ + ResolvedApi.prototype.ref = function (label) { + var ref = this.data.refs.filter(function (ref) { return ref.label === label; })[0]; + return ref ? ref.ref : null; + }; + ResolvedApi.prototype.currentExperiment = function () { + return this.experiments.current(); + }; + /** + * Query the repository + */ + ResolvedApi.prototype.query = function (q, optionsOrCallback, cb) { + if (cb === void 0) { cb = function () { }; } + var _a = typeof optionsOrCallback === 'function' + ? { options: {}, callback: optionsOrCallback } + : { options: optionsOrCallback || {}, callback: cb }, options = _a.options, callback = _a.callback; + var form = this.everything(); + for (var key in options) { + form = form.set(key, options[key]); + } + if (!options.ref) { + // Look in cookies if we have a ref (preview or experiment) + var cookieString = ''; + if (this.options.req) { // NodeJS + cookieString = this.options.req.headers['cookie'] || ''; + } + else if (typeof window !== 'undefined' && window.document) { // Browser + cookieString = window.document.cookie || ''; + } + var cookies = Cookies.parse(cookieString); + var previewRef = cookies[PREVIEW_COOKIE]; + var experimentRef = this.experiments.refFromCookie(cookies[EXPERIMENT_COOKIE]); + form = form.ref(previewRef || experimentRef || this.masterRef.ref); + } + if (q) { + form.query(q); + } + return form.submit(callback); + }; + /** + * Retrieve the document returned by the given query + * @param {string|array|Predicate} the query + * @param {object} additional parameters. In NodeJS, pass the request as 'req'. + * @param {function} callback(err, doc) + */ + ResolvedApi.prototype.queryFirst = function (q, optionsOrCallback, cb) { + var _a = typeof optionsOrCallback === 'function' + ? { options: {}, callback: optionsOrCallback } + : { options: optionsOrCallback || {}, callback: cb || (function () { }) }, options = _a.options, callback = _a.callback; + options.page = 1; + options.pageSize = 1; + return this.query(q, options).then(function (response) { + var document = response && response.results && response.results[0]; + callback(null, document); + return document; + }).catch(function (error) { + callback(error); + throw error; + }); + }; + /** + * Retrieve the document with the given id + */ + ResolvedApi.prototype.getByID = function (id, maybeOptions, cb) { + var options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.queryFirst(Predicates.at('document.id', id), options, cb); + }; + /** + * Retrieve multiple documents from an array of id + */ + ResolvedApi.prototype.getByIDs = function (ids, maybeOptions, cb) { + var options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.query(Predicates.in('document.id', ids), options, cb); + }; + /** + * Retrieve the document with the given uid + */ + ResolvedApi.prototype.getByUID = function (type, uid, maybeOptions, cb) { + var options = maybeOptions || {}; + if (options.lang === "*") + throw new Error("FORDIDDEN. You can't use getByUID with *, use the predicates instead."); + if (!options.page) + options.page = 1; + return this.queryFirst(Predicates.at("my." + type + ".uid", uid), options, cb); + }; + /** + * Retrieve the singleton document with the given type + */ + ResolvedApi.prototype.getSingle = function (type, maybeOptions, cb) { + var options = maybeOptions || {}; + return this.queryFirst(Predicates.at('document.type', type), options, cb); + }; + /** + * Retrieve the document with the given bookmark + */ + ResolvedApi.prototype.getBookmark = function (bookmark, maybeOptions, cb) { + var id = this.data.bookmarks[bookmark]; + if (id) { + return this.getByID(id, maybeOptions, cb); + } + else { + return Promise.reject('Error retrieving bookmarked id'); + } + }; + ResolvedApi.prototype.previewSession = function (token, linkResolver, defaultUrl, cb) { + var _this = this; + return new Promise(function (resolve, reject) { + _this.httpClient.request(token, function (e, result) { + if (e) { + cb && cb(e); + reject(e); + } + else if (result) { + if (!result.mainDocument) { + cb && cb(null, defaultUrl); + resolve(defaultUrl); + } + else { + return _this.getByID(result.mainDocument, { ref: token }).then(function (document) { + if (!document) { + cb && cb(null, defaultUrl); + resolve(defaultUrl); + } + else { + var url = linkResolver(document); + cb && cb(null, url); + resolve(url); + } + }).catch(reject); + } + } + }); + }); + }; + return ResolvedApi; +}()); + +/** +* A doubly linked list-based Least Recently Used (LRU) cache. Will keep most +* recently used items while discarding least recently used items when its limit +* is reached. +* +* Licensed under MIT. Copyright (c) 2010 Rasmus Andersson +* Typescript-ified by Oleksandr Nikitin +* +* Illustration of the design: +* +* entry entry entry entry +* ______ ______ ______ ______ +* | head |.newer => | |.newer => | |.newer => | tail | +* | A | | B | | C | | D | +* |______| <= older.|______| <= older.|______| <= older.|______| +* +* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added +*/ +function MakeLRUCache(limit) { + return new LRUCache(limit); +} +function LRUCache(limit) { + // Current size of the cache. (Read-only). + this.size = 0; + // Maximum number of items this cache can hold. + this.limit = limit; + this._keymap = {}; +} +/** + * Put into the cache associated with . Returns the entry which was + * removed to make room for the new entry. Otherwise undefined is returned + * (i.e. if there was enough room already). + */ +LRUCache.prototype.put = function (key, value) { + var entry = { key: key, value: value }; + // Note: No protection agains replacing, and thus orphan entries. By design. + this._keymap[key] = entry; + if (this.tail) { + // link previous tail to the new tail (entry) + this.tail.newer = entry; + entry.older = this.tail; + } + else { + // we're first in -- yay + this.head = entry; + } + // add new entry to the end of the linked list -- it's now the freshest entry. + this.tail = entry; + if (this.size === this.limit) { + // we hit the limit -- remove the head + return this.shift(); + } + else { + // increase the size counter + this.size++; + } +}; +/** + * Purge the least recently used (oldest) entry from the cache. Returns the + * removed entry or undefined if the cache was empty. + * + * If you need to perform any form of finalization of purged items, this is a + * good place to do it. Simply override/replace this function: + * + * var c = new LRUCache(123); + * c.shift = function() { + * var entry = LRUCache.prototype.shift.call(this); + * doSomethingWith(entry); + * return entry; + * } + */ +LRUCache.prototype.shift = function () { + // todo: handle special case when limit == 1 + var entry = this.head; + if (entry) { + if (this.head.newer) { + this.head = this.head.newer; + this.head.older = undefined; + } + else { + this.head = undefined; + } + // Remove last strong reference to and remove links from the purged + // entry being returned: + entry.newer = entry.older = undefined; + // delete is slow, but we need to do this to avoid uncontrollable growth: + delete this._keymap[entry.key]; + } + console.log('purging ', entry.key); + return entry; +}; +/** + * Get and register recent use of . Returns the value associated with + * or undefined if not in cache. + */ +LRUCache.prototype.get = function (key, returnEntry) { + // First, find our cache entry + var entry = this._keymap[key]; + if (entry === undefined) + return; // Not cached. Sorry. + // As was found in the cache, register it as being requested recently + if (entry === this.tail) { + // Already the most recently used entry, so no need to update the list + return returnEntry ? entry : entry.value; + } + // HEAD--------------TAIL + // <.older .newer> + // <--- add direction -- + // A B C E + if (entry.newer) { + if (entry === this.head) + this.head = entry.newer; + entry.newer.older = entry.older; // C <-- E. + } + if (entry.older) + entry.older.newer = entry.newer; // C. --> E + entry.newer = undefined; // D --x + entry.older = this.tail; // D. --> E + if (this.tail) + this.tail.newer = entry; // E. <-- D + this.tail = entry; + return returnEntry ? entry : entry.value; +}; +// ---------------------------------------------------------------------------- +// Following code is optional and can be removed without breaking the core +// functionality. +/** + * Check if is in the cache without registering recent use. Feasible if + * you do not want to chage the state of the cache, but only "peek" at it. + * Returns the entry associated with if found, or undefined if not found. + */ +LRUCache.prototype.find = function (key) { + return this._keymap[key]; +}; +/** + * Update the value of entry with . Returns the old value, or undefined if + * entry was not in the cache. + */ +LRUCache.prototype.set = function (key, value) { + var oldvalue; + var entry = this.get(key, true); + if (entry) { + oldvalue = entry.value; + entry.value = value; + } + else { + oldvalue = this.put(key, value); + if (oldvalue) + oldvalue = oldvalue.value; + } + return oldvalue; +}; +/** + * Remove entry from cache and return its value. Returns undefined if not + * found. + */ +LRUCache.prototype.remove = function (key) { + var entry = this._keymap[key]; + if (!entry) + return; + delete this._keymap[entry.key]; // need to do delete unfortunately + if (entry.newer && entry.older) { + // relink the older entry with the newer entry + entry.older.newer = entry.newer; + entry.newer.older = entry.older; + } + else if (entry.newer) { + // remove the link to us + entry.newer.older = undefined; + // link the newer entry to head + this.head = entry.newer; + } + else if (entry.older) { + // remove the link to us + entry.older.newer = undefined; + // link the newer entry to head + this.tail = entry.older; + } + else { // if(entry.older === undefined && entry.newer === undefined) { + this.head = this.tail = undefined; + } + this.size--; + return entry.value; +}; +/** Removes all entries */ +LRUCache.prototype.removeAll = function () { + // This should be safe, as we never expose strong refrences to the outside + this.head = this.tail = undefined; + this.size = 0; + this._keymap = {}; +}; +/** + * Return an array containing all keys of entries stored in the cache object, in + * arbitrary order. + */ +if (typeof Object.keys === 'function') { + LRUCache.prototype.keys = function () { return Object.keys(this._keymap); }; +} +else { + LRUCache.prototype.keys = function () { + var keys = []; + for (var k in this._keymap) + keys.push(k); + return keys; + }; +} +/** + * Call `fun` for each entry. Starting with the newest entry if `desc` is a true + * value, otherwise starts with the oldest (head) enrty and moves towards the + * tail. + * + * `fun` is called with 3 arguments in the context `context`: + * `fun.call(context, Object key, Object value, LRUCache self)` + */ +LRUCache.prototype.forEach = function (fun, context, desc) { + var entry; + if (context === true) { + desc = true; + context = undefined; + } + else if (typeof context !== 'object') + context = this; + if (desc) { + entry = this.tail; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.older; + } + } + else { + entry = this.head; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.newer; + } + } +}; +/** Returns a JSON (array) representation */ +//LRUCache.prototype.toJSON = function () { +// var s: IEntry[] = [], entry = this.head; +// while (entry) { +// s.push({ key: entry.key.toJSON(), value: entry.value.toJSON() }); +// entry = entry.newer; +// } +// return s; +//}; +/** Returns a String representation */ +LRUCache.prototype.toString = function () { + var s = '', entry = this.head; + while (entry) { + s += String(entry.key) + ':' + entry.value; + entry = entry.newer; + if (entry) + s += ' < '; + } + return s; +}; + +var DefaultApiCache = /** @class */ (function () { + function DefaultApiCache(limit) { + if (limit === void 0) { limit = 1000; } + this.lru = MakeLRUCache(limit); + } + DefaultApiCache.prototype.isExpired = function (key) { + var value = this.lru.get(key, false); + if (value) { + return value.expiredIn !== 0 && value.expiredIn < Date.now(); + } + else { + return false; + } + }; + DefaultApiCache.prototype.get = function (key, cb) { + var value = this.lru.get(key, false); + if (value && !this.isExpired(key)) { + cb(null, value.data); + } + else { + cb && cb(null); + } + }; + DefaultApiCache.prototype.set = function (key, value, ttl, cb) { + this.lru.remove(key); + this.lru.put(key, { + data: value, + expiredIn: ttl ? (Date.now() + (ttl * 1000)) : 0, + }); + cb && cb(null); + }; + DefaultApiCache.prototype.remove = function (key, cb) { + this.lru.remove(key); + cb && cb(null); + }; + DefaultApiCache.prototype.clear = function (cb) { + this.lru.removeAll(); + cb && cb(null); + }; + return DefaultApiCache; +}()); + +function fetchRequest(url, options, callback) { + var fetchOptions = { + headers: { + Accept: 'application/json', + }, + }; + if (options && options.proxyAgent) { + fetchOptions.agent = options.proxyAgent; + } + fetch(url, fetchOptions).then(function (xhr) { + if (~~(xhr.status / 100 !== 2)) { + /** + * @description + * drain the xhr before throwing an error to prevent memory leaks + * @link https://github.com/bitinn/node-fetch/issues/83 + */ + return xhr.text().then(function () { + var e = new Error("Unexpected status code [" + xhr.status + "] on URL " + url); + e.status = xhr.status; + throw e; + }); + } + return xhr.json().then(function (result) { + var cacheControl = xhr.headers.get('cache-control'); + var parsedCacheControl = cacheControl ? /max-age=(\d+)/.exec(cacheControl) : null; + var ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined; + callback(null, result, xhr, ttl); + }); + }).catch(callback); +} +var DefaultRequestHandler = /** @class */ (function () { + function DefaultRequestHandler(options) { + this.options = options || {}; + } + DefaultRequestHandler.prototype.request = function (url, callback) { + fetchRequest(url, this.options, callback); + }; + return DefaultRequestHandler; +}()); + +var HttpClient = /** @class */ (function () { + function HttpClient(requestHandler, cache, proxyAgent) { + this.requestHandler = requestHandler || new DefaultRequestHandler({ proxyAgent: proxyAgent }); + this.cache = cache || new DefaultApiCache(); + } + HttpClient.prototype.request = function (url, callback) { + this.requestHandler.request(url, function (err, result, xhr, ttl) { + if (err) { + callback && callback(err, null, xhr, ttl); + } + else if (result) { + callback && callback(null, result, xhr, ttl); + } + }); + }; + /** + * Fetch a URL corresponding to a query, and parse the response as a Response object + */ + HttpClient.prototype.cachedRequest = function (url, maybeOptions) { + var _this = this; + var options = maybeOptions || {}; + var run = function (cb) { + var cacheKey = options.cacheKey || url; + _this.cache.get(cacheKey, function (cacheGetError, cacheGetValue) { + if (cacheGetError || cacheGetValue) { + cb(cacheGetError, cacheGetValue); + } + else { + _this.request(url, function (fetchError, fetchValue, xhr, ttlReq) { + if (fetchError) { + cb(fetchError, null); + } + else { + var ttl = ttlReq || options.ttl; + if (ttl) { + _this.cache.set(cacheKey, fetchValue, ttl, cb); + } + cb(null, fetchValue); + } + }); + } + }); + }; + return new Promise(function (resolve, reject) { + run(function (err, value) { + if (err) + reject(err); + if (value) + resolve(value); + }); + }); + }; + return HttpClient; +}()); + +var Api = /** @class */ (function () { + function Api(url, options) { + this.options = options || {}; + this.url = url; + if (this.options.accessToken) { + var accessTokenParam = "access_token=" + this.options.accessToken; + this.url += (url.indexOf('?') > -1 ? '&' : '?') + accessTokenParam; + } + this.apiDataTTL = this.options.apiDataTTL || 5; + this.httpClient = new HttpClient(this.options.requestHandler, this.options.apiCache, this.options.proxyAgent); + } + /** + * Fetches data used to construct the api client, from cache if it's + * present, otherwise from calling the prismic api endpoint (which is + * then cached). + */ + Api.prototype.get = function (cb) { + var _this = this; + return this.httpClient.cachedRequest(this.url, { ttl: this.apiDataTTL }).then(function (data) { + var resolvedApi = new ResolvedApi(data, _this.httpClient, _this.options); + cb && cb(null, resolvedApi); + return resolvedApi; + }).catch(function (error) { + cb && cb(error); + throw error; + }); + }; + return Api; +}()); + +var DefaultClient = /** @class */ (function () { + function DefaultClient(url, options) { + this.api = new Api(url, options); + } + DefaultClient.prototype.getApi = function () { + return this.api.get(); + }; + DefaultClient.prototype.everything = function () { + return this.form('everything'); + }; + DefaultClient.prototype.form = function (formId) { + return new LazySearchForm(formId, this.api); + }; + DefaultClient.prototype.query = function (q, optionsOrCallback, cb) { + return this.getApi().then(function (api) { return api.query(q, optionsOrCallback, cb); }); + }; + DefaultClient.prototype.queryFirst = function (q, optionsOrCallback, cb) { + return this.getApi().then(function (api) { return api.queryFirst(q, optionsOrCallback, cb); }); + }; + DefaultClient.prototype.getByID = function (id, options, cb) { + return this.getApi().then(function (api) { return api.getByID(id, options, cb); }); + }; + DefaultClient.prototype.getByIDs = function (ids, options, cb) { + return this.getApi().then(function (api) { return api.getByIDs(ids, options, cb); }); + }; + DefaultClient.prototype.getByUID = function (type, uid, options, cb) { + return this.getApi().then(function (api) { return api.getByUID(type, uid, options, cb); }); + }; + DefaultClient.prototype.getSingle = function (type, options, cb) { + return this.getApi().then(function (api) { return api.getSingle(type, options, cb); }); + }; + DefaultClient.prototype.getBookmark = function (bookmark, options, cb) { + return this.getApi().then(function (api) { return api.getBookmark(bookmark, options, cb); }); + }; + DefaultClient.prototype.previewSession = function (token, linkResolver, defaultUrl, cb) { + return this.getApi().then(function (api) { return api.previewSession(token, linkResolver, defaultUrl, cb); }); + }; + DefaultClient.getApi = function (url, options) { + var api = new Api(url, options); + return api.get(); + }; + return DefaultClient; +}()); + +function client(url, options) { + return new DefaultClient(url, options); +} +function getApi(url, options) { + return DefaultClient.getApi(url, options); +} +function api(url, options) { + return getApi(url, options); +} + +exports.experimentCookie = EXPERIMENT_COOKIE; +exports.previewCookie = PREVIEW_COOKIE; +exports.Predicates = Predicates; +exports.Experiments = Experiments; +exports.Api = Api; +exports.client = client; +exports.getApi = getApi; +exports.api = api; +//# sourceMappingURL=prismic-javascript.js.map diff --git a/dist/prismic-javascript.js.map b/dist/prismic-javascript.js.map new file mode 100644 index 00000000..fda95a7e --- /dev/null +++ b/dist/prismic-javascript.js.map @@ -0,0 +1 @@ +{"version":3,"file":"prismic-javascript.js","sources":["../src/experiments.ts","../src/form.ts","../src/Predicates.ts","../src/Cookies.ts","../src/ResolvedApi.ts","../src/lru.ts","../src/cache.ts","../src/request.ts","../src/HttpClient.ts","../src/Api.ts","../src/client.ts","../src/index.ts"],"sourcesContent":["export class Variation {\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n }\n\n id(): string {\n return this.data.id;\n }\n\n ref(): string {\n return this.data.ref;\n }\n\n label(): string {\n return this.data.label;\n }\n}\n\nexport class Experiment {\n variations: Variation[];\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n this.variations = (data.variations || []).map((v: any) => {\n return new Variation(v);\n });\n }\n\n id(): string {\n return this.data.id;\n }\n\n googleId(): string {\n return this.data.googleId;\n }\n\n name(): string {\n return this.data.name;\n }\n}\n\nexport class Experiments {\n drafts: Experiment[];\n running: Experiment[];\n\n constructor(data: any) {\n if (data) {\n this.drafts = (data.drafts || []).map((exp: any) => {\n return new Experiment(exp);\n });\n this.running = (data.running || []).map((exp: any) => {\n return new Experiment(exp);\n });\n }\n }\n\n current(): Experiment | null {\n if (this.running.length > 0) {\n return this.running[0];\n } else {\n return null;\n }\n }\n refFromCookie(cookie: string): string | null {\n if (!cookie || cookie.trim() === '') return null;\n const splitted = cookie.trim().split(' ');\n if (splitted.length < 2) return null;\n const expId = splitted[0];\n const varIndex = parseInt(splitted[1], 10);\n const exp = this.running.filter((exp) => {\n return exp.googleId() === expId && exp.variations.length > varIndex;\n })[0];\n return exp ? exp.variations[varIndex].ref() : null;\n }\n}\n","import Api from './Api';\nimport ResolvedApi from './ResolvedApi';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport HttpClient from './HttpClient';\nimport { RequestCallback } from './request';\n\nexport type Fields = { [key: string]: any };\n\nexport interface Form {\n fields: Fields;\n action: string;\n name: string;\n rel: string;\n form_method: string;\n enctype: string;\n}\n\nexport class LazySearchForm {\n id: string;\n fields: Fields;\n api: Api;\n\n constructor(id: string, api: Api) {\n this.id = id;\n this.api = api;\n this.fields = {};\n }\n\n set(key: string, value: any): LazySearchForm {\n this.fields[key] = value;\n return this;\n }\n\n ref(ref: string): LazySearchForm {\n return this.set('ref', ref);\n }\n\n query(query: string | string[]): LazySearchForm {\n return this.set('q', query);\n }\n\n pageSize(size: number): LazySearchForm {\n return this.set('pageSize', size);\n }\n\n fetch(fields: string | string[]): LazySearchForm {\n console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.');\n return this.set('fetch', fields);\n }\n\n fetchLinks(fields: string | string[]): LazySearchForm {\n console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.');\n return this.set('fetchLinks', fields);\n }\n\n graphQuery(query: string): LazySearchForm {\n return this.set('graphQuery', query);\n }\n\n lang(langCode: string): LazySearchForm {\n return this.set('lang', langCode);\n }\n\n page(p: number): LazySearchForm {\n return this.set('page', p);\n }\n\n after(documentId: string): LazySearchForm {\n return this.set('after', documentId);\n }\n\n orderings(orderings?: string[]): LazySearchForm {\n return this.set('orderings', orderings);\n }\n\n url(): Promise {\n return this.api.get().then((api) => {\n return LazySearchForm.toSearchForm(this, api).url();\n });\n }\n\n submit(cb: RequestCallback): Promise {\n return this.api.get().then((api) => {\n return LazySearchForm.toSearchForm(this, api).submit(cb);\n });\n }\n\n static toSearchForm(lazyForm: LazySearchForm, api: ResolvedApi): SearchForm {\n const form = api.form(lazyForm.id);\n if (form) {\n return Object.keys(lazyForm.fields).reduce((form, fieldKey) => {\n const fieldValue = lazyForm.fields[fieldKey];\n if (fieldKey === 'q') {\n return form.query(fieldValue);\n } else if (fieldKey === 'pageSize') {\n return form.pageSize(fieldValue);\n } else if (fieldKey === 'fetch') {\n return form.fetch(fieldValue);\n } else if (fieldKey === 'fetchLinks') {\n return form.fetchLinks(fieldValue);\n } else if (fieldKey === 'graphQuery') {\n return form.graphQuery(fieldValue);\n } else if (fieldKey === 'lang') {\n return form.lang(fieldValue);\n } else if (fieldKey === 'page') {\n return form.page(fieldValue);\n } else if (fieldKey === 'after') {\n return form.after(fieldValue);\n } else if (fieldKey === 'orderings') {\n return form.orderings(fieldValue);\n } else {\n return form.set(fieldKey, fieldValue);\n }\n }, form);\n } else {\n throw new Error(`Unable to access to form ${lazyForm.id}`);\n }\n }\n}\n\nexport class SearchForm {\n httpClient: HttpClient;\n form: Form;\n data: any;\n\n constructor(form: Form, httpClient: HttpClient) {\n this.httpClient = httpClient;\n this.form = form;\n\n this.data = {};\n for (const field in form.fields) {\n if (form.fields[field]['default']) {\n this.data[field] = [form.fields[field]['default']];\n }\n }\n }\n\n set(field: string, value: any): SearchForm {\n const fieldDesc = this.form.fields[field];\n if (!fieldDesc) throw new Error('Unknown field ' + field);\n const checkedValue = value === '' || value === undefined ? null : value;\n let values = this.data[field] || [];\n if (fieldDesc.multiple) {\n values = checkedValue ? values.concat([checkedValue]) : values;\n } else {\n values = checkedValue ? [checkedValue] : values;\n }\n this.data[field] = values;\n return this;\n }\n\n /**\n * Sets a ref to query on for this SearchForm. This is a mandatory\n * method to call before calling submit(), and api.form('everything').submit()\n * will not work.\n */\n ref(ref: string): SearchForm {\n return this.set('ref', ref);\n }\n\n /**\n * Sets a predicate-based query for this SearchForm. This is where you\n * paste what you compose in your prismic.io API browser.\n */\n query(query: string | string[]): SearchForm {\n if (typeof query === 'string') {\n return this.query([query]);\n } else if (Array.isArray(query)) {\n return this.set('q', `[${query.join('')}]`);\n } else {\n throw new Error(`Invalid query : ${query}`);\n }\n }\n\n /**\n * Sets a page size to query for this SearchForm. This is an optional method.\n *\n * @param {number} size - The page size\n * @returns {SearchForm} - The SearchForm itself\n */\n pageSize(size: number): SearchForm {\n return this.set('pageSize', size);\n }\n\n /**\n * Restrict the results document to the specified fields\n */\n fetch(fields: string | string[]): SearchForm {\n console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.');\n const strFields = Array.isArray(fields) ? fields.join(',') : fields;\n return this.set('fetch', strFields);\n }\n\n /**\n * Include the requested fields in the DocumentLink instances in the result\n */\n fetchLinks(fields: string | string[]): SearchForm {\n console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.');\n const strFields = Array.isArray(fields) ? fields.join(',') : fields;\n return this.set('fetchLinks', strFields);\n }\n\n /**\n * Sets the graphquery to query for this SearchForm. This is an optional method.\n */\n graphQuery(query: string): SearchForm {\n return this.set('graphQuery', query);\n }\n\n /**\n * Sets the language to query for this SearchForm. This is an optional method.\n */\n lang(langCode: string): SearchForm {\n return this.set('lang', langCode);\n }\n\n /**\n * Sets the page number to query for this SearchForm. This is an optional method.\n */\n page(p: number): SearchForm {\n return this.set('page', p);\n }\n\n /**\n * Remove all the documents except for those after the specified document in the list. This is an optional method.\n */\n after(documentId: string): SearchForm {\n return this.set('after', documentId);\n }\n\n /**\n * Sets the orderings to query for this SearchForm. This is an optional method.\n */\n orderings(orderings ?: string[]): SearchForm {\n if (!orderings) {\n return this;\n } else {\n return this.set('orderings', `[${orderings.join(',')}]`);\n }\n }\n\n /**\n * Build the URL to query\n */\n url(): string {\n let url = this.form.action;\n if (this.data) {\n let sep = (url.indexOf('?') > -1 ? '&' : '?');\n for (const key in this.data) {\n if (this.data.hasOwnProperty(key)) {\n const values = this.data[key];\n if (values) {\n for (let i = 0; i < values.length; i++) {\n url += sep + key + '=' + encodeURIComponent(values[i]);\n sep = '&';\n }\n }\n }\n }\n }\n return url;\n }\n\n /**\n * Submits the query, and calls the callback function.\n */\n submit(cb: RequestCallback): Promise {\n return this.httpClient.cachedRequest(this.url()).then((response) => {\n cb && cb(null, response);\n return response;\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","const OPERATOR = {\n at: 'at',\n not: 'not',\n missing: 'missing',\n has: 'has',\n any: 'any',\n in: 'in',\n fulltext: 'fulltext',\n similar: 'similar',\n numberGt: 'number.gt',\n numberLt: 'number.lt',\n numberInRange: 'number.inRange',\n dateBefore: 'date.before',\n dateAfter: 'date.after',\n dateBetween: 'date.between',\n dateDayOfMonth: 'date.day-of-month',\n dateDayOfMonthAfter: 'date.day-of-month-after',\n dateDayOfMonthBefore: 'date.day-of-month-before',\n dateDayOfWeek: 'date.day-of-week',\n dateDayOfWeekAfter: 'date.day-of-week-after',\n dateDayOfWeekBefore: 'date.day-of-week-before',\n dateMonth: 'date.month',\n dateMonthBefore: 'date.month-before',\n dateMonthAfter: 'date.month-after',\n dateYear: 'date.year',\n dateHour: 'date.hour',\n dateHourBefore: 'date.hour-before',\n dateHourAfter: 'date.hour-after',\n GeopointNear: 'geopoint.near',\n};\n\ntype PredicateValue = string | number | Date;\n\nfunction encode(value: PredicateValue | PredicateValue[]): string {\n if (typeof value === 'string') {\n return `\"${value}\"`;\n } else if (typeof value === 'number') {\n return value.toString();\n } else if (value instanceof Date) {\n return value.getTime().toString();\n } else if (Array.isArray(value)) {\n return `[${value.map(v => encode(v)).join(',')}]`;\n } else {\n throw new Error(`Unable to encode ${value} of type ${typeof value}`);\n }\n}\n\nconst geopoint = {\n near(fragment: string, latitude: number, longitude: number, radius: number): string {\n return `[${OPERATOR.GeopointNear}(${fragment}, ${latitude}, ${longitude}, ${radius})]`;\n },\n};\n\nconst date = {\n\n before(fragment: string, before: PredicateValue): string {\n return `[${OPERATOR.dateBefore}(${fragment}, ${encode(before)})]`;\n },\n\n after(fragment: string, after: PredicateValue): string {\n return `[${OPERATOR.dateAfter}(${fragment}, ${encode(after)})]`;\n },\n\n between(fragment: string, before: PredicateValue, after: PredicateValue): string {\n return `[${OPERATOR.dateBetween}(${fragment}, ${encode(before)}, ${encode(after)})]`;\n },\n\n dayOfMonth(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonth}(${fragment}, ${day})]`;\n },\n\n dayOfMonthAfter(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonthAfter}(${fragment}, ${day})]`;\n },\n\n dayOfMonthBefore(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonthBefore}(${fragment}, ${day})]`;\n },\n\n dayOfWeek(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeek}(${fragment}, ${encode(day)})]`;\n },\n\n dayOfWeekAfter(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeekAfter}(${fragment}, ${encode(day)})]`;\n },\n\n dayOfWeekBefore(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeekBefore}(${fragment}, ${encode(day)})]`;\n },\n\n month(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonth}(${fragment}, ${encode(month)})]`;\n },\n\n monthBefore(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonthBefore}(${fragment}, ${encode(month)})]`;\n },\n\n monthAfter(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonthAfter}(${fragment}, ${encode(month)})]`;\n },\n\n year(fragment: string, year: number): string {\n return `[${OPERATOR.dateYear}(${fragment}, ${year})]`;\n },\n\n hour(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHour}(${fragment}, ${hour})]`;\n },\n\n hourBefore(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHourBefore}(${fragment}, ${hour})]`;\n },\n\n hourAfter(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHourAfter}(${fragment}, ${hour})]`;\n },\n};\n\nconst number = {\n gt(fragment: string, value: number): string {\n return `[${OPERATOR.numberGt}(${fragment}, ${value})]`;\n },\n\n lt(fragment: string, value: number): string {\n return `[${OPERATOR.numberLt}(${fragment}, ${value})]`;\n },\n\n inRange(fragment: string, before: number, after: number): string {\n return `[${OPERATOR.numberInRange}(${fragment}, ${before}, ${after})]`;\n },\n};\n\nexport default {\n at(fragment: string, value: PredicateValue | PredicateValue[]): string {\n return `[${OPERATOR.at}(${fragment}, ${encode(value)})]`;\n },\n\n not(fragment: string, value: PredicateValue | PredicateValue[]): string {\n return `[${OPERATOR.not}(${fragment}, ${encode(value)})]`;\n },\n\n missing(fragment: string): string {\n return `[${OPERATOR.missing}(${fragment})]`;\n },\n\n has(fragment: string): string {\n return `[${OPERATOR.has}(${fragment})]`;\n },\n\n any(fragment: string, values: PredicateValue[]): string {\n return `[${OPERATOR.any}(${fragment}, ${encode(values)})]`;\n },\n\n in(fragment: string, values: string[]): string {\n return `[${OPERATOR.in}(${fragment}, ${encode(values)})]`;\n },\n\n fulltext(fragment: string, value: string): string {\n return `[${OPERATOR.fulltext}(${fragment}, ${encode(value)})]`;\n },\n\n similar(documentId: string, maxResults: number): string {\n return `[${OPERATOR.similar}(\"${documentId}\", ${maxResults})]`;\n },\n\n date,\n\n dateBefore: date.before,\n\n dateAfter: date.after,\n\n dateBetween: date.between,\n\n dayOfMonth: date.dayOfMonth,\n\n dayOfMonthAfter: date.dayOfMonthAfter,\n\n dayOfMonthBefore: date.dayOfMonthBefore,\n\n dayOfWeek: date.dayOfWeek,\n\n dayOfWeekAfter: date.dayOfWeekAfter,\n\n dayOfWeekBefore: date.dayOfWeekBefore,\n\n month: date.month,\n\n monthBefore: date.monthBefore,\n\n monthAfter: date.monthAfter,\n\n year: date.year,\n\n hour: date.hour,\n\n hourBefore: date.hourBefore,\n\n hourAfter: date.hourAfter,\n\n number,\n\n gt: number.gt,\n\n lt: number.lt,\n\n inRange: number.inRange,\n\n near: geopoint.near,\n\n geopoint,\n};\n","export interface Cookie {\n [key: string]: string;\n value: string;\n}\n\n// Some portions of code from https://github.com/jshttp/cookie\n\nvar decode = decodeURIComponent;\n\nfunction tryDecode(str: string, decode: (str: string) => string) {\n try {\n return decode(str);\n } catch (e) {\n return str;\n }\n}\n\nfunction parse(str: string, options?: any) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string');\n }\n\n var obj = {};\n var opt = options || {};\n var pairs = str.split(/; */);\n var dec = opt.decode || decode;\n\n pairs.forEach(function(pair) {\n var eq_idx = pair.indexOf('=');\n\n // skip things that don't look like key=value\n if (eq_idx < 0) {\n return;\n }\n\n var key = pair.substr(0, eq_idx).trim();\n var val = pair.substr(++eq_idx, pair.length).trim();\n\n // quoted values\n if ('\"' == val[0]) {\n val = val.slice(1, -1);\n }\n\n // only assign once\n if (undefined == obj[key]) {\n obj[key] = tryDecode(val, dec);\n }\n });\n\n return obj;\n}\n\nexport default { parse };\n","import { Document } from \"./documents\";\nimport { RequestHandler, RequestCallback } from './request';\nimport { ApiCache } from './cache';\nimport { Experiment, Experiments } from './experiments';\nimport { SearchForm, Form } from './form';\nimport Predicates from './Predicates';\nimport Cookies from './Cookies';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport HttpClient from './HttpClient';\nimport { Client } from './client';\n\nexport const PREVIEW_COOKIE = 'io.prismic.preview';\nexport const EXPERIMENT_COOKIE = 'io.prismic.experiment';\n\nexport interface Ref {\n ref: string;\n label: string;\n isMasterRef: boolean;\n scheduledAt: string;\n id: string;\n}\n\nexport interface ApiData {\n refs: Ref[];\n bookmarks: { [key: string]: string };\n types: { [key: string]: string };\n tags: string[];\n forms: { [key: string]: Form };\n experiments: any;\n oauth_initiate: string;\n oauth_token: string;\n version: string;\n licence: string;\n}\n\nexport interface PreviewResponse {\n mainDocument?: string;\n}\n\nexport interface QueryOptions {\n [key: string]: string | number | string[];\n}\n\nexport interface ResolvedApiOptions {\n req?: any;\n}\n\nexport default class ResolvedApi implements Client {\n data: ApiData;\n masterRef: Ref;\n experiments: Experiments;\n options: ResolvedApiOptions;\n httpClient: HttpClient;\n bookmarks: { [key: string]: string };\n refs: Ref[];\n tags: string[];\n types: { [key: string]: string };\n\n constructor(data: ApiData, httpClient: HttpClient, options: ResolvedApiOptions) {\n this.data = data;\n this.masterRef = data.refs.filter(ref => ref.isMasterRef)[0];\n this.experiments = new Experiments(data.experiments);\n this.bookmarks = data.bookmarks;\n this.httpClient = httpClient;\n this.options = options;\n this.refs = data.refs;\n this.tags = data.tags;\n this.types = data.types;\n }\n\n /**\n * Returns a useable form from its id, as described in the RESTful description of the API.\n * For instance: api.form(\"everything\") works on every repository (as \"everything\" exists by default)\n * You can then chain the calls: api.form(\"everything\").query('[[:d = at(document.id, \"UkL0gMuvzYUANCpf\")]]').ref(ref).submit()\n */\n form(formId: string): SearchForm | null {\n const form = this.data.forms[formId];\n if (form) {\n return new SearchForm(form, this.httpClient);\n }\n return null;\n }\n\n everything(): SearchForm {\n const f = this.form('everything');\n if (!f) throw new Error('Missing everything form');\n return f;\n }\n\n /**\n * The ID of the master ref on this prismic.io API.\n * Do not use like this: searchForm.ref(api.master()).\n * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.\n */\n master(): string {\n return this.masterRef.ref;\n }\n\n /**\n * Returns the ref ID for a given ref's label.\n * Do not use like this: searchForm.ref(api.ref(\"Future release label\")).\n * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.\n */\n ref(label: string): string | null {\n const ref = this.data.refs.filter(ref => ref.label === label)[0];\n return ref ? ref.ref : null;\n }\n\n currentExperiment(): Experiment | null {\n return this.experiments.current();\n }\n\n /**\n * Query the repository\n */\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb: RequestCallback = () => {}): Promise {\n const { options, callback } = typeof optionsOrCallback === 'function'\n ? { options: {} as QueryOptions, callback: optionsOrCallback }\n : { options: optionsOrCallback || {}, callback: cb };\n\n let form = this.everything();\n for (const key in options) {\n form = form.set(key, options[key]);\n }\n if (!options.ref) {\n // Look in cookies if we have a ref (preview or experiment)\n let cookieString = '';\n if (this.options.req) { // NodeJS\n cookieString = this.options.req.headers['cookie'] || '';\n } else if (typeof window !== 'undefined' && window.document) { // Browser\n cookieString = window.document.cookie || '';\n }\n const cookies = Cookies.parse(cookieString);\n const previewRef = cookies[PREVIEW_COOKIE];\n const experimentRef = this.experiments.refFromCookie(cookies[EXPERIMENT_COOKIE]);\n form = form.ref(previewRef || experimentRef || this.masterRef.ref);\n }\n if (q) {\n form.query(q);\n }\n return form.submit(callback);\n }\n\n /**\n * Retrieve the document returned by the given query\n * @param {string|array|Predicate} the query\n * @param {object} additional parameters. In NodeJS, pass the request as 'req'.\n * @param {function} callback(err, doc)\n */\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n const { options, callback } = typeof optionsOrCallback === 'function'\n ? { options: {} as QueryOptions, callback: optionsOrCallback }\n : { options: optionsOrCallback || {}, callback: cb || (() => {}) };\n\n options.page = 1;\n options.pageSize = 1;\n\n return this.query(q, options).then((response) => {\n const document = response && response.results && response.results[0];\n callback(null, document);\n return document;\n }).catch((error) => {\n callback(error);\n throw error;\n });\n }\n\n /**\n * Retrieve the document with the given id\n */\n getByID(id: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.queryFirst(Predicates.at('document.id', id), options, cb);\n }\n\n /**\n * Retrieve multiple documents from an array of id\n */\n getByIDs(ids: string[], maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.query(Predicates.in('document.id', ids), options, cb);\n }\n\n /**\n * Retrieve the document with the given uid\n */\n getByUID(type: string, uid: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if(options.lang === \"*\") throw new Error(\"FORDIDDEN. You can't use getByUID with *, use the predicates instead.\")\n if(!options.page) options.page = 1;\n\n return this.queryFirst(Predicates.at(`my.${type}.uid`, uid), options, cb);\n }\n\n /**\n * Retrieve the singleton document with the given type\n */\n getSingle(type: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n return this.queryFirst(Predicates.at('document.type', type), options, cb);\n }\n\n /**\n * Retrieve the document with the given bookmark\n */\n getBookmark(bookmark: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const id = this.data.bookmarks[bookmark];\n if (id) {\n return this.getByID(id, maybeOptions, cb);\n } else {\n return Promise.reject('Error retrieving bookmarked id');\n }\n }\n\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise {\n return new Promise((resolve, reject) => {\n this.httpClient.request(token, (e, result) => {\n if (e) {\n cb && cb(e);\n reject(e);\n } else if (result) {\n if (!result.mainDocument) {\n cb && cb(null, defaultUrl);\n resolve(defaultUrl);\n } else {\n return this.getByID(result.mainDocument, { ref: token }).then((document) => {\n if (!document) {\n cb && cb(null, defaultUrl);\n resolve(defaultUrl);\n } else {\n const url = linkResolver(document);\n cb && cb(null, url);\n resolve(url);\n }\n }).catch(reject);\n }\n }\n });\n });\n }\n}\n","/**\n* A doubly linked list-based Least Recently Used (LRU) cache. Will keep most\n* recently used items while discarding least recently used items when its limit\n* is reached.\n*\n* Licensed under MIT. Copyright (c) 2010 Rasmus Andersson \n* Typescript-ified by Oleksandr Nikitin \n*\n* Illustration of the design:\n*\n* entry entry entry entry\n* ______ ______ ______ ______\n* | head |.newer => | |.newer => | |.newer => | tail |\n* | A | | B | | C | | D |\n* |______| <= older.|______| <= older.|______| <= older.|______|\n*\n* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added\n*/\n\nexport function MakeLRUCache(limit: number): ILRUCache {\n return new (LRUCache)(limit);\n}\n\nexport interface ILRUCache {\n put(key: string, value: any): void;\n get(key: string, Entry: boolean): any;\n remove(key: String): void;\n removeAll(): void;\n}\n\nfunction LRUCache(limit: number) {\n // Current size of the cache. (Read-only).\n this.size = 0;\n // Maximum number of items this cache can hold.\n this.limit = limit;\n this._keymap = {};\n}\n\ninterface IEntry {\n newer?: IEntry;\n older?: IEntry;\n key: string;\n value: any;\n}\n\n/**\n * Put into the cache associated with . Returns the entry which was\n * removed to make room for the new entry. Otherwise undefined is returned\n * (i.e. if there was enough room already).\n */\nLRUCache.prototype.put = function (key: string, value: any) {\n var entry: IEntry = { key: key, value: value };\n // Note: No protection agains replacing, and thus orphan entries. By design.\n this._keymap[key] = entry;\n if (this.tail) {\n // link previous tail to the new tail (entry)\n this.tail.newer = entry;\n entry.older = this.tail;\n } else {\n // we're first in -- yay\n this.head = entry;\n }\n // add new entry to the end of the linked list -- it's now the freshest entry.\n this.tail = entry;\n if (this.size === this.limit) {\n // we hit the limit -- remove the head\n return this.shift();\n } else {\n // increase the size counter\n this.size++;\n }\n};\n\n/**\n * Purge the least recently used (oldest) entry from the cache. Returns the\n * removed entry or undefined if the cache was empty.\n *\n * If you need to perform any form of finalization of purged items, this is a\n * good place to do it. Simply override/replace this function:\n *\n * var c = new LRUCache(123);\n * c.shift = function() {\n * var entry = LRUCache.prototype.shift.call(this);\n * doSomethingWith(entry);\n * return entry;\n * }\n */\nLRUCache.prototype.shift = function () {\n // todo: handle special case when limit == 1\n var entry = this.head;\n if (entry) {\n if (this.head.newer) {\n this.head = this.head.newer;\n this.head.older = undefined;\n } else {\n this.head = undefined;\n }\n // Remove last strong reference to and remove links from the purged\n // entry being returned:\n entry.newer = entry.older = undefined;\n // delete is slow, but we need to do this to avoid uncontrollable growth:\n delete this._keymap[entry.key];\n }\n console.log('purging ', entry.key);\n return entry;\n};\n\n/**\n * Get and register recent use of . Returns the value associated with \n * or undefined if not in cache.\n */\nLRUCache.prototype.get = function (key: string, returnEntry: boolean): any {\n // First, find our cache entry\n var entry = this._keymap[key];\n if (entry === undefined) return; // Not cached. Sorry.\n // As was found in the cache, register it as being requested recently\n if (entry === this.tail) {\n // Already the most recently used entry, so no need to update the list\n return returnEntry ? entry : entry.value;\n }\n // HEAD--------------TAIL\n // <.older .newer>\n // <--- add direction --\n // A B C E\n if (entry.newer) {\n if (entry === this.head)\n this.head = entry.newer;\n entry.newer.older = entry.older; // C <-- E.\n }\n if (entry.older)\n entry.older.newer = entry.newer; // C. --> E\n entry.newer = undefined; // D --x\n entry.older = this.tail; // D. --> E\n if (this.tail)\n this.tail.newer = entry; // E. <-- D\n this.tail = entry;\n return returnEntry ? entry : entry.value;\n};\n\n// ----------------------------------------------------------------------------\n// Following code is optional and can be removed without breaking the core\n// functionality.\n\n/**\n * Check if is in the cache without registering recent use. Feasible if\n * you do not want to chage the state of the cache, but only \"peek\" at it.\n * Returns the entry associated with if found, or undefined if not found.\n */\nLRUCache.prototype.find = function (key: string) {\n return this._keymap[key];\n};\n\n/**\n * Update the value of entry with . Returns the old value, or undefined if\n * entry was not in the cache.\n */\nLRUCache.prototype.set = function (key: string, value: any) {\n var oldvalue: any;\n var entry = this.get(key, true);\n if (entry) {\n oldvalue = entry.value;\n entry.value = value;\n } else {\n oldvalue = this.put(key, value);\n if (oldvalue) oldvalue = oldvalue.value;\n }\n return oldvalue;\n};\n\n/**\n * Remove entry from cache and return its value. Returns undefined if not\n * found.\n */\nLRUCache.prototype.remove = function (key: string) {\n var entry = this._keymap[key];\n if (!entry) return;\n delete this._keymap[entry.key]; // need to do delete unfortunately\n if (entry.newer && entry.older) {\n // relink the older entry with the newer entry\n entry.older.newer = entry.newer;\n entry.newer.older = entry.older;\n } else if (entry.newer) {\n // remove the link to us\n entry.newer.older = undefined;\n // link the newer entry to head\n this.head = entry.newer;\n } else if (entry.older) {\n // remove the link to us\n entry.older.newer = undefined;\n // link the newer entry to head\n this.tail = entry.older;\n } else {// if(entry.older === undefined && entry.newer === undefined) {\n this.head = this.tail = undefined;\n }\n\n this.size--;\n return entry.value;\n};\n\n/** Removes all entries */\nLRUCache.prototype.removeAll = function () {\n // This should be safe, as we never expose strong refrences to the outside\n this.head = this.tail = undefined;\n this.size = 0;\n this._keymap = {};\n};\n\n/**\n * Return an array containing all keys of entries stored in the cache object, in\n * arbitrary order.\n */\nif (typeof Object.keys === 'function') {\n LRUCache.prototype.keys = function () { return Object.keys(this._keymap); };\n} else {\n LRUCache.prototype.keys = function () {\n var keys: string[] = [];\n for (var k in this._keymap) keys.push(k);\n return keys;\n };\n}\n\n/**\n * Call `fun` for each entry. Starting with the newest entry if `desc` is a true\n * value, otherwise starts with the oldest (head) enrty and moves towards the\n * tail.\n *\n * `fun` is called with 3 arguments in the context `context`:\n * `fun.call(context, Object key, Object value, LRUCache self)`\n */\nLRUCache.prototype.forEach = function (fun: Function, context: any, desc: boolean) {\n var entry: IEntry | undefined;\n if (context === true) { desc = true; context = undefined; }\n else if (typeof context !== 'object') context = this;\n if (desc) {\n entry = this.tail;\n while (entry) {\n fun.call(context, entry.key, entry.value, this);\n entry = entry.older;\n }\n } else {\n entry = this.head;\n while (entry) {\n fun.call(context, entry.key, entry.value, this);\n entry = entry.newer;\n }\n }\n};\n\n/** Returns a JSON (array) representation */\n//LRUCache.prototype.toJSON = function () {\n// var s: IEntry[] = [], entry = this.head;\n// while (entry) {\n// s.push({ key: entry.key.toJSON(), value: entry.value.toJSON() });\n// entry = entry.newer;\n// }\n// return s;\n//};\n\n/** Returns a String representation */\nLRUCache.prototype.toString = function () {\n var s = '', entry = this.head;\n while (entry) {\n s += String(entry.key) + ':' + entry.value;\n entry = entry.newer;\n if (entry)\n s += ' < ';\n }\n return s;\n};\n\n// Export ourselves\n//if (typeof this === 'object') this.LRUCache = LRUCache;","import { ILRUCache, MakeLRUCache } from './lru';\n\nexport interface ApiCache {\n isExpired(key: String): boolean;\n get(key: string, cb: (error: Error | null, entry?: T) => void): void;\n set(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void;\n remove(key: string, cb?: (error: Error | null) => void): void;\n clear(cb?: (error: Error | null) => void): void;\n}\n\nexport class DefaultApiCache implements ApiCache {\n lru: ILRUCache;\n\n constructor(limit: number = 1000) {\n this.lru = MakeLRUCache(limit);\n }\n\n isExpired(key: string): boolean {\n const value = this.lru.get(key, false);\n if (value) {\n return value.expiredIn !== 0 && value.expiredIn < Date.now();\n } else {\n return false;\n }\n }\n\n get(key: string, cb: (error: Error | null, entry?: T) => void): void {\n const value = this.lru.get(key, false);\n if (value && !this.isExpired(key)) {\n cb(null, value.data);\n } else {\n cb && cb(null);\n }\n }\n\n set(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void {\n this.lru.remove(key);\n this.lru.put(key, {\n data: value,\n expiredIn: ttl ? (Date.now() + (ttl * 1000)) : 0,\n });\n cb && cb(null);\n }\n\n remove(key: string, cb?: (error: Error | null) => void): void {\n this.lru.remove(key);\n cb && cb(null);\n }\n\n clear(cb?: (error: Error | null) => void): void {\n this.lru.removeAll();\n cb && cb(null);\n }\n}\n","interface Task {\n url: string;\n callback: RequestCallback;\n}\n\ninterface NodeRequestInit extends RequestInit {\n agent?: any;\n}\n\nfunction fetchRequest(url: string, options: RequestHandlerOption, callback: RequestCallback): void {\n\n const fetchOptions = {\n headers: {\n Accept: 'application/json',\n },\n } as NodeRequestInit;\n\n if (options && options.proxyAgent) {\n fetchOptions.agent = options.proxyAgent;\n }\n\n fetch(url, fetchOptions).then((xhr) => {\n if (~~(xhr.status / 100 !== 2)) {\n /**\n * @description\n * drain the xhr before throwing an error to prevent memory leaks\n * @link https://github.com/bitinn/node-fetch/issues/83\n */\n return xhr.text().then(() => {\n const e: any = new Error(`Unexpected status code [${xhr.status}] on URL ${url}`);\n e.status = xhr.status;\n throw e;\n });\n }\n\n return xhr.json().then((result) => {\n const cacheControl = xhr.headers.get('cache-control');\n const parsedCacheControl = cacheControl ? /max-age=(\\d+)/.exec(cacheControl) : null;\n const ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined;\n\n callback(null, result, xhr, ttl);\n });\n }).catch(callback);\n}\n\nexport type RequestCallback = (error: Error | null, result?: T | null, xhr?: any, ttl?: number) => void;\n\nexport interface RequestHandlerOption {\n proxyAgent?: any;\n}\n\nexport interface RequestHandler {\n request(url: string, cb: RequestCallback): void;\n}\n\nexport class DefaultRequestHandler implements RequestHandler {\n\n options: RequestHandlerOption;\n\n constructor(options?: RequestHandlerOption) {\n this.options = options || {};\n }\n\n request(url: string, callback: RequestCallback): void {\n\n fetchRequest(url, this.options, callback);\n }\n}\n","import { ApiCache, DefaultApiCache } from './cache';\nimport { RequestHandler, DefaultRequestHandler, RequestCallback } from './request';\n\nexport interface HttpClientOptions {\n ttl?: number;\n cacheKey?: string;\n}\n\nexport default class HttpClient {\n\n private cache: ApiCache;\n private requestHandler: RequestHandler;\n\n constructor(requestHandler?: RequestHandler, cache?: ApiCache, proxyAgent?: any) {\n this.requestHandler = requestHandler || new DefaultRequestHandler({ proxyAgent });\n this.cache = cache || new DefaultApiCache();\n }\n\n request(url: string, callback?: RequestCallback): void {\n this.requestHandler.request(url, (err, result, xhr, ttl) => {\n if (err) {\n callback && callback(err, null, xhr, ttl);\n } else if (result) {\n callback && callback(null, result, xhr, ttl);\n }\n });\n }\n\n /**\n * Fetch a URL corresponding to a query, and parse the response as a Response object\n */\n cachedRequest(url: string, maybeOptions?: HttpClientOptions): Promise {\n const options = maybeOptions || {};\n const run = (cb: RequestCallback) => {\n const cacheKey = options.cacheKey || url;\n this.cache.get(cacheKey, (cacheGetError, cacheGetValue) => {\n if (cacheGetError || cacheGetValue) {\n cb(cacheGetError, cacheGetValue);\n } else {\n this.request(url, (fetchError, fetchValue, xhr, ttlReq) => {\n if (fetchError) {\n cb(fetchError, null);\n } else {\n const ttl = ttlReq || options.ttl;\n if (ttl) {\n this.cache.set(cacheKey, fetchValue, ttl, cb);\n }\n cb(null, fetchValue);\n }\n });\n }\n });\n };\n\n return new Promise((resolve, reject) => {\n run((err, value) => {\n if (err) reject(err);\n if (value) resolve(value);\n });\n });\n }\n}\n","import Predicates from './Predicates';\nimport { RequestHandler, RequestCallback } from './request';\nimport { Document } from './documents';\nimport { ApiCache } from './cache';\nimport ResolvedApi, { ApiData } from './ResolvedApi';\nimport HttpClient from './HttpClient';\n\nexport interface ApiOptions {\n accessToken?: string;\n requestHandler?: RequestHandler;\n req?: any;\n apiCache?: ApiCache;\n apiDataTTL?: number;\n proxyAgent?: any;\n}\n\nexport default class Api {\n url: string;\n options: ApiOptions;\n apiDataTTL: number;\n httpClient: HttpClient;\n\n constructor(url: string, options?: ApiOptions) {\n this.options = options || {};\n this.url = url;\n if (this.options.accessToken) {\n const accessTokenParam = `access_token=${this.options.accessToken}`;\n this.url += (url.indexOf('?') > -1 ? '&' : '?') + accessTokenParam;\n }\n this.apiDataTTL = this.options.apiDataTTL || 5;\n this.httpClient = new HttpClient(\n this.options.requestHandler,\n this.options.apiCache,\n this.options.proxyAgent,\n );\n }\n\n /**\n * Fetches data used to construct the api client, from cache if it's\n * present, otherwise from calling the prismic api endpoint (which is\n * then cached).\n */\n get(cb?: RequestCallback): Promise {\n return this.httpClient.cachedRequest(this.url, { ttl: this.apiDataTTL }).then((data) => {\n const resolvedApi = new ResolvedApi(data, this.httpClient, this.options);\n cb && cb(null, resolvedApi);\n return resolvedApi;\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","import { Document } from \"./documents\";\nimport ResolvedApi, { QueryOptions, EXPERIMENT_COOKIE, PREVIEW_COOKIE } from './ResolvedApi';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport { SearchForm, LazySearchForm } from './form';\nimport { Experiment } from './experiments';\nimport { RequestHandler, RequestCallback } from './request';\nimport Api, { ApiOptions } from './Api';\n\nexport interface Client {\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise;\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb: RequestCallback): Promise;\n getByID(id: string, options: QueryOptions, cb: RequestCallback): Promise;\n getByIDs(ids: string[], options: QueryOptions, cb: RequestCallback): Promise;\n getByUID(type: string, uid: string, options: QueryOptions, cb: RequestCallback): Promise;\n getSingle(type: string, options: QueryOptions, cb: RequestCallback): Promise;\n getBookmark(bookmark: string, options: QueryOptions, cb: RequestCallback): Promise;\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise;\n}\n\nexport class DefaultClient implements Client {\n\n api: Api;\n resolvedApi: ResolvedApi;\n\n constructor(url: string, options?: ApiOptions) {\n this.api = new Api(url, options);\n }\n\n getApi(): Promise {\n return this.api.get();\n }\n\n everything(): LazySearchForm {\n return this.form('everything');\n }\n\n form(formId: string): LazySearchForm {\n return new LazySearchForm(formId, this.api);\n }\n\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.query(q, optionsOrCallback, cb));\n }\n\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.queryFirst(q, optionsOrCallback, cb));\n }\n\n getByID(id: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByID(id, options, cb));\n }\n\n getByIDs(ids: string[], options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByIDs(ids, options, cb));\n }\n\n getByUID(type: string, uid: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByUID(type, uid, options, cb));\n }\n\n getSingle(type: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getSingle(type, options, cb));\n }\n\n getBookmark(bookmark: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getBookmark(bookmark, options, cb));\n }\n\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.previewSession(token, linkResolver, defaultUrl, cb));\n }\n\n static getApi(url: string, options?: ApiOptions): Promise {\n const api = new Api(url, options);\n return api.get();\n }\n}\n","import ResolvedApi, { EXPERIMENT_COOKIE as experimentCookie, PREVIEW_COOKIE as previewCookie } from './ResolvedApi';\nimport Predicates from './Predicates';\nimport { Experiments } from './experiments';\nimport Api, { ApiOptions } from './Api';\nimport { DefaultClient } from './client';\n\nexport {\n experimentCookie,\n previewCookie,\n Predicates,\n Experiments,\n Api\n};\n\nexport function client(url: string, options?: ApiOptions): DefaultClient {\n return new DefaultClient(url, options);\n}\n\nexport function getApi(url: string, options?: ApiOptions): Promise {\n return DefaultClient.getApi(url, options);\n}\n\nexport function api(url: string, options?: ApiOptions): Promise {\n return getApi(url, options);\n}"],"names":[],"mappings":";;;;AAAO;IAGL,mBAAY,IAAS;QAFrB,SAAI,GAAQ,EAAE,CAAC;QAGb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;IAED,sBAAE,GAAF;QACE,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;KACrB;IAED,uBAAG,GAAH;QACE,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;KACtB;IAED,yBAAK,GAAL;QACE,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;KACxB;IACH,gBAAC;CAAA,IAAA;AAEM;IAIL,oBAAY,IAAS;QAFrB,SAAI,GAAQ,EAAE,CAAC;QAGb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,UAAU,GAAG,CAAC,IAAI,CAAC,UAAU,IAAI,EAAE,EAAE,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dist/prismic-javascript.min.js b/dist/prismic-javascript.min.js index aeedc4f0..71aae554 100644 --- a/dist/prismic-javascript.min.js +++ b/dist/prismic-javascript.min.js @@ -1 +1 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("cross-fetch/polyfill")):"function"==typeof define&&define.amd?define("PrismicJS",["cross-fetch/polyfill"],e):"object"==typeof exports?exports.PrismicJS=e(require("cross-fetch/polyfill")):t.PrismicJS=e(t["cross-fetch/polyfill"])}("undefined"!=typeof self?self:this,function(t){return function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=20)}([function(t,e,n){"use strict";e.a=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){return e.reject(n)})})}},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";e.__esModule=!0;var r=n(5),i=n(4),o=n(6),u=n(12);e.PREVIEW_COOKIE="io.prismic.preview",e.EXPERIMENT_COOKIE="io.prismic.experiment";var a=function(){function t(t,e,n){this.data=t,this.masterRef=t.refs.filter(function(t){return t.isMasterRef})[0],this.experiments=new r.Experiments(t.experiments),this.bookmarks=t.bookmarks,this.httpClient=e,this.options=n,this.refs=t.refs,this.tags=t.tags,this.types=t.types}return t.prototype.form=function(t){var e=this.data.forms[t];return e?new i.SearchForm(e,this.httpClient):null},t.prototype.everything=function(){var t=this.form("everything");if(!t)throw new Error("Missing everything form");return t},t.prototype.master=function(){return this.masterRef.ref},t.prototype.ref=function(t){var e=this.data.refs.filter(function(e){return e.label===t})[0];return e?e.ref:null},t.prototype.currentExperiment=function(){return this.experiments.current()},t.prototype.query=function(t,n,r){void 0===r&&(r=function(){});var i="function"==typeof n?{options:{},callback:n}:{options:n||{},callback:r},o=i.options,a=i.callback,s=this.everything();for(var f in o)s=s.set(f,o[f]);if(!o.ref){var c="";this.options.req?c=this.options.req.headers.cookie||"":"undefined"!=typeof window&&window.document&&(c=window.document.cookie||"");var l=u.default.parse(c),h=l[e.PREVIEW_COOKIE],p=this.experiments.refFromCookie(l[e.EXPERIMENT_COOKIE]);s=s.ref(h||p||this.masterRef.ref)}return t&&s.query(t),s.submit(a)},t.prototype.queryFirst=function(t,e,n){var r="function"==typeof e?{options:{},callback:e}:{options:e||{},callback:n||function(){}},i=r.options,o=r.callback;return i.page=1,i.pageSize=1,this.query(t,i).then(function(t){var e=t&&t.results&&t.results[0];return o(null,e),e}).catch(function(t){throw o(t),t})},t.prototype.getByID=function(t,e,n){var r=e||{};return r.lang||(r.lang="*"),this.queryFirst(o.default.at("document.id",t),r,n)},t.prototype.getByIDs=function(t,e,n){var r=e||{};return r.lang||(r.lang="*"),this.query(o.default.in("document.id",t),r,n)},t.prototype.getByUID=function(t,e,n,r){var i=n||{};if("*"===i.lang)throw new Error("FORDIDDEN. You can't use getByUID with *, use the predicates instead.");return i.page||(i.page=1),this.queryFirst(o.default.at("my."+t+".uid",e),i,r)},t.prototype.getSingle=function(t,e,n){var r=e||{};return this.queryFirst(o.default.at("document.type",t),r,n)},t.prototype.getBookmark=function(t,e,n){var r=this.data.bookmarks[t];return r?this.getByID(r,e,n):Promise.reject("Error retrieving bookmarked id")},t.prototype.previewSession=function(t,e,n,r){var i=this;return new Promise(function(o,u){i.httpClient.request(t,function(a,s){if(a)r&&r(a),u(a);else if(s){if(s.mainDocument)return i.getByID(s.mainDocument,{ref:t}).then(function(t){if(t){var i=e(t);r&&r(null,i),o(i)}else r&&r(null,n),o(n)}).catch(u);r&&r(null,n),o(n)}})})},t}();e.default=a},function(t,e,n){"use strict";e.__esModule=!0;var r=n(2),i=n(11),o=function(){function t(t,e){if(this.options=e||{},this.url=t,this.options.accessToken){var n="access_token="+this.options.accessToken;this.url+=(t.indexOf("?")>-1?"&":"?")+n}this.apiDataTTL=this.options.apiDataTTL||5,this.httpClient=new i.default(this.options.requestHandler,this.options.apiCache,this.options.proxyAgent)}return t.prototype.get=function(t){var e=this;return this.httpClient.cachedRequest(this.url,{ttl:this.apiDataTTL}).then(function(n){var i=new r.default(n,e.httpClient,e.options);return t&&t(null,i),i}).catch(function(e){throw t&&t(e),e})},t}();e.default=o},function(t,e,n){"use strict";e.__esModule=!0;var r=function(){function t(t,e){this.id=t,this.api=e,this.fields={}}return t.prototype.set=function(t,e){return this.fields[t]=e,this},t.prototype.ref=function(t){return this.set("ref",t)},t.prototype.query=function(t){return this.set("q",t)},t.prototype.pageSize=function(t){return this.set("pageSize",t)},t.prototype.fetch=function(t){return console.warn("Warning: Using Fetch is deprecated. Use the property `graphQuery` instead."),this.set("fetch",t)},t.prototype.fetchLinks=function(t){return console.warn("Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead."),this.set("fetchLinks",t)},t.prototype.graphQuery=function(t){return this.set("graphQuery",t)},t.prototype.lang=function(t){return this.set("lang",t)},t.prototype.page=function(t){return this.set("page",t)},t.prototype.after=function(t){return this.set("after",t)},t.prototype.orderings=function(t){return this.set("orderings",t)},t.prototype.url=function(){var e=this;return this.api.get().then(function(n){return t.toSearchForm(e,n).url()})},t.prototype.submit=function(e){var n=this;return this.api.get().then(function(r){return t.toSearchForm(n,r).submit(e)})},t.toSearchForm=function(t,e){var n=e.form(t.id);if(n)return Object.keys(t.fields).reduce(function(e,n){var r=t.fields[n];return"q"===n?e.query(r):"pageSize"===n?e.pageSize(r):"fetch"===n?e.fetch(r):"fetchLinks"===n?e.fetchLinks(r):"graphQuery"===n?e.graphQuery(r):"lang"===n?e.lang(r):"page"===n?e.page(r):"after"===n?e.after(r):"orderings"===n?e.orderings(r):e.set(n,r)},n);throw new Error("Unable to access to form "+t.id)},t}();e.LazySearchForm=r;var i=function(){function t(t,e){for(var n in this.httpClient=e,this.form=t,this.data={},t.fields)t.fields[n].default&&(this.data[n]=[t.fields[n].default])}return t.prototype.set=function(t,e){var n=this.form.fields[t];if(!n)throw new Error("Unknown field "+t);var r=""===e||void 0===e?null:e,i=this.data[t]||[];return i=n.multiple?r?i.concat([r]):i:r?[r]:i,this.data[t]=i,this},t.prototype.ref=function(t){return this.set("ref",t)},t.prototype.query=function(t){if("string"==typeof t)return this.query([t]);if(Array.isArray(t))return this.set("q","["+t.join("")+"]");throw new Error("Invalid query : "+t)},t.prototype.pageSize=function(t){return this.set("pageSize",t)},t.prototype.fetch=function(t){console.warn("Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.");var e=Array.isArray(t)?t.join(","):t;return this.set("fetch",e)},t.prototype.fetchLinks=function(t){console.warn("Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.");var e=Array.isArray(t)?t.join(","):t;return this.set("fetchLinks",e)},t.prototype.graphQuery=function(t){return this.set("graphQuery",t)},t.prototype.lang=function(t){return this.set("lang",t)},t.prototype.page=function(t){return this.set("page",t)},t.prototype.after=function(t){return this.set("after",t)},t.prototype.orderings=function(t){return t?this.set("orderings","["+t.join(",")+"]"):this},t.prototype.url=function(){var t=this.form.action;if(this.data){var e=t.indexOf("?")>-1?"&":"?";for(var n in this.data)if(this.data.hasOwnProperty(n)){var r=this.data[n];if(r)for(var i=0;i0?this.running[0]:null},t.prototype.refFromCookie=function(t){if(!t||""===t.trim())return null;var e=t.trim().split(" ");if(e.length<2)return null;var n=e[0],r=parseInt(e[1],10),i=this.running.filter(function(t){return t.googleId()===n&&t.variations.length>r})[0];return i?i.variations[r].ref():null},t}();e.Experiments=o},function(t,e,n){"use strict";e.__esModule=!0;var r="at",i="not",o="missing",u="has",a="any",s="in",f="fulltext",c="similar",l="number.gt",h="number.lt",p="number.inRange",d="date.before",y="date.after",m="date.between",g="date.day-of-month",v="date.day-of-month-after",w="date.day-of-month-before",_="date.day-of-week",k="date.day-of-week-after",b="date.day-of-week-before",T="date.month",I="date.month-before",E="date.month-after",O="date.year",A="date.hour",x="date.hour-before",M="date.hour-after",j="geopoint.near";function q(t){if("string"==typeof t)return'"'+t+'"';if("number"==typeof t)return t.toString();if(t instanceof Date)return t.getTime().toString();if(Array.isArray(t))return"["+t.map(function(t){return q(t)}).join(",")+"]";throw new Error("Unable to encode "+t+" of type "+typeof t)}var S={near:function(t,e,n,r){return"["+j+"("+t+", "+e+", "+n+", "+r+")]"}},C={before:function(t,e){return"["+d+"("+t+", "+q(e)+")]"},after:function(t,e){return"["+y+"("+t+", "+q(e)+")]"},between:function(t,e,n){return"["+m+"("+t+", "+q(e)+", "+q(n)+")]"},dayOfMonth:function(t,e){return"["+g+"("+t+", "+e+")]"},dayOfMonthAfter:function(t,e){return"["+v+"("+t+", "+e+")]"},dayOfMonthBefore:function(t,e){return"["+w+"("+t+", "+e+")]"},dayOfWeek:function(t,e){return"["+_+"("+t+", "+q(e)+")]"},dayOfWeekAfter:function(t,e){return"["+k+"("+t+", "+q(e)+")]"},dayOfWeekBefore:function(t,e){return"["+b+"("+t+", "+q(e)+")]"},month:function(t,e){return"["+T+"("+t+", "+q(e)+")]"},monthBefore:function(t,e){return"["+I+"("+t+", "+q(e)+")]"},monthAfter:function(t,e){return"["+E+"("+t+", "+q(e)+")]"},year:function(t,e){return"["+O+"("+t+", "+e+")]"},hour:function(t,e){return"["+A+"("+t+", "+e+")]"},hourBefore:function(t,e){return"["+x+"("+t+", "+e+")]"},hourAfter:function(t,e){return"["+M+"("+t+", "+e+")]"}},F={gt:function(t,e){return"["+l+"("+t+", "+e+")]"},lt:function(t,e){return"["+h+"("+t+", "+e+")]"},inRange:function(t,e,n){return"["+p+"("+t+", "+e+", "+n+")]"}};e.default={at:function(t,e){return"["+r+"("+t+", "+q(e)+")]"},not:function(t,e){return"["+i+"("+t+", "+q(e)+")]"},missing:function(t){return"["+o+"("+t+")]"},has:function(t){return"["+u+"("+t+")]"},any:function(t,e){return"["+a+"("+t+", "+q(e)+")]"},in:function(t,e){return"["+s+"("+t+", "+q(e)+")]"},fulltext:function(t,e){return"["+f+"("+t+", "+q(e)+")]"},similar:function(t,e){return"["+c+'("'+t+'", '+e+")]"},date:C,dateBefore:C.before,dateAfter:C.after,dateBetween:C.between,dayOfMonth:C.dayOfMonth,dayOfMonthAfter:C.dayOfMonthAfter,dayOfMonthBefore:C.dayOfMonthBefore,dayOfWeek:C.dayOfWeek,dayOfWeekAfter:C.dayOfWeekAfter,dayOfWeekBefore:C.dayOfWeekBefore,month:C.month,monthBefore:C.monthBefore,monthAfter:C.monthAfter,year:C.year,hour:C.hour,hourBefore:C.hourBefore,hourAfter:C.hourAfter,number:F,gt:F.gt,lt:F.lt,inRange:F.inRange,near:S.near,geopoint:S}},function(t,e,n){"use strict";(function(t){var r=n(0),i=setTimeout;function o(){}function u(t){if(!(this instanceof u))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],l(t,this)}function a(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,u._immediateFn(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null!==n){var r;try{r=n(t._value)}catch(t){return void f(e.promise,t)}s(e.promise,r)}else(1===t._state?s:f)(e.promise,t._value)})):t._deferreds.push(e)}function s(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var n=e.then;if(e instanceof u)return t._state=3,t._value=e,void c(t);if("function"==typeof n)return void l(function(t,e){return function(){t.apply(e,arguments)}}(n,e),t)}t._state=1,t._value=e,c(t)}catch(e){f(t,e)}}function f(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&u._immediateFn(function(){t._handled||u._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e1)for(var n=1;n=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(17),e.setImmediate="undefined"!=typeof self&&self.setImmediate||void 0!==t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!=typeof self&&self.clearImmediate||void 0!==t&&t.clearImmediate||this&&this.clearImmediate}).call(this,n(1))},function(t,e,n){"use strict";n.r(e),function(t){var e=n(7),r=n(0),i=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==t)return t;throw new Error("unable to locate global object")}();i.Promise?i.Promise.prototype.finally||(i.Promise.prototype.finally=r.a):i.Promise=e.a}.call(this,n(1))},function(t,e,n){n(19),n(15),t.exports=n(14)}])}); \ No newline at end of file +!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e(t.PrismicJS={})}(this,function(t){"use strict";var e=function(){function t(t){this.data={},this.data=t}return t.prototype.id=function(){return this.data.id},t.prototype.ref=function(){return this.data.ref},t.prototype.label=function(){return this.data.label},t}(),n=function(){function t(t){this.data={},this.data=t,this.variations=(t.variations||[]).map(function(t){return new e(t)})}return t.prototype.id=function(){return this.data.id},t.prototype.googleId=function(){return this.data.googleId},t.prototype.name=function(){return this.data.name},t}(),r=function(){function t(t){t&&(this.drafts=(t.drafts||[]).map(function(t){return new n(t)}),this.running=(t.running||[]).map(function(t){return new n(t)}))}return t.prototype.current=function(){return this.running.length>0?this.running[0]:null},t.prototype.refFromCookie=function(t){if(!t||""===t.trim())return null;var e=t.trim().split(" ");if(e.length<2)return null;var n=e[0],r=parseInt(e[1],10),i=this.running.filter(function(t){return t.googleId()===n&&t.variations.length>r})[0];return i?i.variations[r].ref():null},t}(),i=function(){function t(t,e){this.id=t,this.api=e,this.fields={}}return t.prototype.set=function(t,e){return this.fields[t]=e,this},t.prototype.ref=function(t){return this.set("ref",t)},t.prototype.query=function(t){return this.set("q",t)},t.prototype.pageSize=function(t){return this.set("pageSize",t)},t.prototype.fetch=function(t){return console.warn("Warning: Using Fetch is deprecated. Use the property `graphQuery` instead."),this.set("fetch",t)},t.prototype.fetchLinks=function(t){return console.warn("Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead."),this.set("fetchLinks",t)},t.prototype.graphQuery=function(t){return this.set("graphQuery",t)},t.prototype.lang=function(t){return this.set("lang",t)},t.prototype.page=function(t){return this.set("page",t)},t.prototype.after=function(t){return this.set("after",t)},t.prototype.orderings=function(t){return this.set("orderings",t)},t.prototype.url=function(){var e=this;return this.api.get().then(function(n){return t.toSearchForm(e,n).url()})},t.prototype.submit=function(e){var n=this;return this.api.get().then(function(r){return t.toSearchForm(n,r).submit(e)})},t.toSearchForm=function(t,e){var n=e.form(t.id);if(n)return Object.keys(t.fields).reduce(function(e,n){var r=t.fields[n];return"q"===n?e.query(r):"pageSize"===n?e.pageSize(r):"fetch"===n?e.fetch(r):"fetchLinks"===n?e.fetchLinks(r):"graphQuery"===n?e.graphQuery(r):"lang"===n?e.lang(r):"page"===n?e.page(r):"after"===n?e.after(r):"orderings"===n?e.orderings(r):e.set(n,r)},n);throw new Error("Unable to access to form "+t.id)},t}(),o=function(){function t(t,e){for(var n in this.httpClient=e,this.form=t,this.data={},t.fields)t.fields[n].default&&(this.data[n]=[t.fields[n].default])}return t.prototype.set=function(t,e){var n=this.form.fields[t];if(!n)throw new Error("Unknown field "+t);var r=""===e||void 0===e?null:e,i=this.data[t]||[];return i=n.multiple?r?i.concat([r]):i:r?[r]:i,this.data[t]=i,this},t.prototype.ref=function(t){return this.set("ref",t)},t.prototype.query=function(t){if("string"==typeof t)return this.query([t]);if(Array.isArray(t))return this.set("q","["+t.join("")+"]");throw new Error("Invalid query : "+t)},t.prototype.pageSize=function(t){return this.set("pageSize",t)},t.prototype.fetch=function(t){console.warn("Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.");var e=Array.isArray(t)?t.join(","):t;return this.set("fetch",e)},t.prototype.fetchLinks=function(t){console.warn("Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.");var e=Array.isArray(t)?t.join(","):t;return this.set("fetchLinks",e)},t.prototype.graphQuery=function(t){return this.set("graphQuery",t)},t.prototype.lang=function(t){return this.set("lang",t)},t.prototype.page=function(t){return this.set("page",t)},t.prototype.after=function(t){return this.set("after",t)},t.prototype.orderings=function(t){return t?this.set("orderings","["+t.join(",")+"]"):this},t.prototype.url=function(){var t=this.form.action;if(this.data){var e=t.indexOf("?")>-1?"&":"?";for(var n in this.data)if(this.data.hasOwnProperty(n)){var r=this.data[n];if(r)for(var i=0;i-1?"&":"?")+n}this.apiDataTTL=this.options.apiDataTTL||5,this.httpClient=new J(this.options.requestHandler,this.options.apiCache,this.options.proxyAgent)}return t.prototype.get=function(t){var e=this;return this.httpClient.cachedRequest(this.url,{ttl:this.apiDataTTL}).then(function(n){var r=new Q(n,e.httpClient,e.options);return t&&t(null,r),r}).catch(function(e){throw t&&t(e),e})},t}(),N=function(){function t(t,e){this.api=new K(t,e)}return t.prototype.getApi=function(){return this.api.get()},t.prototype.everything=function(){return this.form("everything")},t.prototype.form=function(t){return new i(t,this.api)},t.prototype.query=function(t,e,n){return this.getApi().then(function(r){return r.query(t,e,n)})},t.prototype.queryFirst=function(t,e,n){return this.getApi().then(function(r){return r.queryFirst(t,e,n)})},t.prototype.getByID=function(t,e,n){return this.getApi().then(function(r){return r.getByID(t,e,n)})},t.prototype.getByIDs=function(t,e,n){return this.getApi().then(function(r){return r.getByIDs(t,e,n)})},t.prototype.getByUID=function(t,e,n,r){return this.getApi().then(function(i){return i.getByUID(t,e,n,r)})},t.prototype.getSingle=function(t,e,n){return this.getApi().then(function(r){return r.getSingle(t,e,n)})},t.prototype.getBookmark=function(t,e,n){return this.getApi().then(function(r){return r.getBookmark(t,e,n)})},t.prototype.previewSession=function(t,e,n,r){return this.getApi().then(function(i){return i.previewSession(t,e,n,r)})},t.getApi=function(t,e){return new K(t,e).get()},t}();function Y(t,e){return N.getApi(t,e)}t.experimentCookie="io.prismic.experiment",t.previewCookie="io.prismic.preview",t.Predicates=z,t.Experiments=r,t.Api=K,t.client=function(t,e){return new N(t,e)},t.getApi=Y,t.api=function(t,e){return Y(t,e)},Object.defineProperty(t,"__esModule",{value:!0})}); diff --git a/dist/prismic-javascript.mjs b/dist/prismic-javascript.mjs new file mode 100644 index 00000000..4ed32537 --- /dev/null +++ b/dist/prismic-javascript.mjs @@ -0,0 +1,1180 @@ +var Variation = /** @class */ (function () { + function Variation(data) { + this.data = {}; + this.data = data; + } + Variation.prototype.id = function () { + return this.data.id; + }; + Variation.prototype.ref = function () { + return this.data.ref; + }; + Variation.prototype.label = function () { + return this.data.label; + }; + return Variation; +}()); +var Experiment = /** @class */ (function () { + function Experiment(data) { + this.data = {}; + this.data = data; + this.variations = (data.variations || []).map(function (v) { + return new Variation(v); + }); + } + Experiment.prototype.id = function () { + return this.data.id; + }; + Experiment.prototype.googleId = function () { + return this.data.googleId; + }; + Experiment.prototype.name = function () { + return this.data.name; + }; + return Experiment; +}()); +var Experiments = /** @class */ (function () { + function Experiments(data) { + if (data) { + this.drafts = (data.drafts || []).map(function (exp) { + return new Experiment(exp); + }); + this.running = (data.running || []).map(function (exp) { + return new Experiment(exp); + }); + } + } + Experiments.prototype.current = function () { + if (this.running.length > 0) { + return this.running[0]; + } + else { + return null; + } + }; + Experiments.prototype.refFromCookie = function (cookie) { + if (!cookie || cookie.trim() === '') + return null; + var splitted = cookie.trim().split(' '); + if (splitted.length < 2) + return null; + var expId = splitted[0]; + var varIndex = parseInt(splitted[1], 10); + var exp = this.running.filter(function (exp) { + return exp.googleId() === expId && exp.variations.length > varIndex; + })[0]; + return exp ? exp.variations[varIndex].ref() : null; + }; + return Experiments; +}()); + +var LazySearchForm = /** @class */ (function () { + function LazySearchForm(id, api) { + this.id = id; + this.api = api; + this.fields = {}; + } + LazySearchForm.prototype.set = function (key, value) { + this.fields[key] = value; + return this; + }; + LazySearchForm.prototype.ref = function (ref) { + return this.set('ref', ref); + }; + LazySearchForm.prototype.query = function (query) { + return this.set('q', query); + }; + LazySearchForm.prototype.pageSize = function (size) { + return this.set('pageSize', size); + }; + LazySearchForm.prototype.fetch = function (fields) { + console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.'); + return this.set('fetch', fields); + }; + LazySearchForm.prototype.fetchLinks = function (fields) { + console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.'); + return this.set('fetchLinks', fields); + }; + LazySearchForm.prototype.graphQuery = function (query) { + return this.set('graphQuery', query); + }; + LazySearchForm.prototype.lang = function (langCode) { + return this.set('lang', langCode); + }; + LazySearchForm.prototype.page = function (p) { + return this.set('page', p); + }; + LazySearchForm.prototype.after = function (documentId) { + return this.set('after', documentId); + }; + LazySearchForm.prototype.orderings = function (orderings) { + return this.set('orderings', orderings); + }; + LazySearchForm.prototype.url = function () { + var _this = this; + return this.api.get().then(function (api) { + return LazySearchForm.toSearchForm(_this, api).url(); + }); + }; + LazySearchForm.prototype.submit = function (cb) { + var _this = this; + return this.api.get().then(function (api) { + return LazySearchForm.toSearchForm(_this, api).submit(cb); + }); + }; + LazySearchForm.toSearchForm = function (lazyForm, api) { + var form = api.form(lazyForm.id); + if (form) { + return Object.keys(lazyForm.fields).reduce(function (form, fieldKey) { + var fieldValue = lazyForm.fields[fieldKey]; + if (fieldKey === 'q') { + return form.query(fieldValue); + } + else if (fieldKey === 'pageSize') { + return form.pageSize(fieldValue); + } + else if (fieldKey === 'fetch') { + return form.fetch(fieldValue); + } + else if (fieldKey === 'fetchLinks') { + return form.fetchLinks(fieldValue); + } + else if (fieldKey === 'graphQuery') { + return form.graphQuery(fieldValue); + } + else if (fieldKey === 'lang') { + return form.lang(fieldValue); + } + else if (fieldKey === 'page') { + return form.page(fieldValue); + } + else if (fieldKey === 'after') { + return form.after(fieldValue); + } + else if (fieldKey === 'orderings') { + return form.orderings(fieldValue); + } + else { + return form.set(fieldKey, fieldValue); + } + }, form); + } + else { + throw new Error("Unable to access to form " + lazyForm.id); + } + }; + return LazySearchForm; +}()); +var SearchForm = /** @class */ (function () { + function SearchForm(form, httpClient) { + this.httpClient = httpClient; + this.form = form; + this.data = {}; + for (var field in form.fields) { + if (form.fields[field]['default']) { + this.data[field] = [form.fields[field]['default']]; + } + } + } + SearchForm.prototype.set = function (field, value) { + var fieldDesc = this.form.fields[field]; + if (!fieldDesc) + throw new Error('Unknown field ' + field); + var checkedValue = value === '' || value === undefined ? null : value; + var values = this.data[field] || []; + if (fieldDesc.multiple) { + values = checkedValue ? values.concat([checkedValue]) : values; + } + else { + values = checkedValue ? [checkedValue] : values; + } + this.data[field] = values; + return this; + }; + /** + * Sets a ref to query on for this SearchForm. This is a mandatory + * method to call before calling submit(), and api.form('everything').submit() + * will not work. + */ + SearchForm.prototype.ref = function (ref) { + return this.set('ref', ref); + }; + /** + * Sets a predicate-based query for this SearchForm. This is where you + * paste what you compose in your prismic.io API browser. + */ + SearchForm.prototype.query = function (query) { + if (typeof query === 'string') { + return this.query([query]); + } + else if (Array.isArray(query)) { + return this.set('q', "[" + query.join('') + "]"); + } + else { + throw new Error("Invalid query : " + query); + } + }; + /** + * Sets a page size to query for this SearchForm. This is an optional method. + * + * @param {number} size - The page size + * @returns {SearchForm} - The SearchForm itself + */ + SearchForm.prototype.pageSize = function (size) { + return this.set('pageSize', size); + }; + /** + * Restrict the results document to the specified fields + */ + SearchForm.prototype.fetch = function (fields) { + console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.'); + var strFields = Array.isArray(fields) ? fields.join(',') : fields; + return this.set('fetch', strFields); + }; + /** + * Include the requested fields in the DocumentLink instances in the result + */ + SearchForm.prototype.fetchLinks = function (fields) { + console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.'); + var strFields = Array.isArray(fields) ? fields.join(',') : fields; + return this.set('fetchLinks', strFields); + }; + /** + * Sets the graphquery to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.graphQuery = function (query) { + return this.set('graphQuery', query); + }; + /** + * Sets the language to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.lang = function (langCode) { + return this.set('lang', langCode); + }; + /** + * Sets the page number to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.page = function (p) { + return this.set('page', p); + }; + /** + * Remove all the documents except for those after the specified document in the list. This is an optional method. + */ + SearchForm.prototype.after = function (documentId) { + return this.set('after', documentId); + }; + /** + * Sets the orderings to query for this SearchForm. This is an optional method. + */ + SearchForm.prototype.orderings = function (orderings) { + if (!orderings) { + return this; + } + else { + return this.set('orderings', "[" + orderings.join(',') + "]"); + } + }; + /** + * Build the URL to query + */ + SearchForm.prototype.url = function () { + var url = this.form.action; + if (this.data) { + var sep = (url.indexOf('?') > -1 ? '&' : '?'); + for (var key in this.data) { + if (this.data.hasOwnProperty(key)) { + var values = this.data[key]; + if (values) { + for (var i = 0; i < values.length; i++) { + url += sep + key + '=' + encodeURIComponent(values[i]); + sep = '&'; + } + } + } + } + } + return url; + }; + /** + * Submits the query, and calls the callback function. + */ + SearchForm.prototype.submit = function (cb) { + return this.httpClient.cachedRequest(this.url()).then(function (response) { + cb && cb(null, response); + return response; + }).catch(function (error) { + cb && cb(error); + throw error; + }); + }; + return SearchForm; +}()); + +var OPERATOR = { + at: 'at', + not: 'not', + missing: 'missing', + has: 'has', + any: 'any', + in: 'in', + fulltext: 'fulltext', + similar: 'similar', + numberGt: 'number.gt', + numberLt: 'number.lt', + numberInRange: 'number.inRange', + dateBefore: 'date.before', + dateAfter: 'date.after', + dateBetween: 'date.between', + dateDayOfMonth: 'date.day-of-month', + dateDayOfMonthAfter: 'date.day-of-month-after', + dateDayOfMonthBefore: 'date.day-of-month-before', + dateDayOfWeek: 'date.day-of-week', + dateDayOfWeekAfter: 'date.day-of-week-after', + dateDayOfWeekBefore: 'date.day-of-week-before', + dateMonth: 'date.month', + dateMonthBefore: 'date.month-before', + dateMonthAfter: 'date.month-after', + dateYear: 'date.year', + dateHour: 'date.hour', + dateHourBefore: 'date.hour-before', + dateHourAfter: 'date.hour-after', + GeopointNear: 'geopoint.near', +}; +function encode(value) { + if (typeof value === 'string') { + return "\"" + value + "\""; + } + else if (typeof value === 'number') { + return value.toString(); + } + else if (value instanceof Date) { + return value.getTime().toString(); + } + else if (Array.isArray(value)) { + return "[" + value.map(function (v) { return encode(v); }).join(',') + "]"; + } + else { + throw new Error("Unable to encode " + value + " of type " + typeof value); + } +} +var geopoint = { + near: function (fragment, latitude, longitude, radius) { + return "[" + OPERATOR.GeopointNear + "(" + fragment + ", " + latitude + ", " + longitude + ", " + radius + ")]"; + }, +}; +var date = { + before: function (fragment, before) { + return "[" + OPERATOR.dateBefore + "(" + fragment + ", " + encode(before) + ")]"; + }, + after: function (fragment, after) { + return "[" + OPERATOR.dateAfter + "(" + fragment + ", " + encode(after) + ")]"; + }, + between: function (fragment, before, after) { + return "[" + OPERATOR.dateBetween + "(" + fragment + ", " + encode(before) + ", " + encode(after) + ")]"; + }, + dayOfMonth: function (fragment, day) { + return "[" + OPERATOR.dateDayOfMonth + "(" + fragment + ", " + day + ")]"; + }, + dayOfMonthAfter: function (fragment, day) { + return "[" + OPERATOR.dateDayOfMonthAfter + "(" + fragment + ", " + day + ")]"; + }, + dayOfMonthBefore: function (fragment, day) { + return "[" + OPERATOR.dateDayOfMonthBefore + "(" + fragment + ", " + day + ")]"; + }, + dayOfWeek: function (fragment, day) { + return "[" + OPERATOR.dateDayOfWeek + "(" + fragment + ", " + encode(day) + ")]"; + }, + dayOfWeekAfter: function (fragment, day) { + return "[" + OPERATOR.dateDayOfWeekAfter + "(" + fragment + ", " + encode(day) + ")]"; + }, + dayOfWeekBefore: function (fragment, day) { + return "[" + OPERATOR.dateDayOfWeekBefore + "(" + fragment + ", " + encode(day) + ")]"; + }, + month: function (fragment, month) { + return "[" + OPERATOR.dateMonth + "(" + fragment + ", " + encode(month) + ")]"; + }, + monthBefore: function (fragment, month) { + return "[" + OPERATOR.dateMonthBefore + "(" + fragment + ", " + encode(month) + ")]"; + }, + monthAfter: function (fragment, month) { + return "[" + OPERATOR.dateMonthAfter + "(" + fragment + ", " + encode(month) + ")]"; + }, + year: function (fragment, year) { + return "[" + OPERATOR.dateYear + "(" + fragment + ", " + year + ")]"; + }, + hour: function (fragment, hour) { + return "[" + OPERATOR.dateHour + "(" + fragment + ", " + hour + ")]"; + }, + hourBefore: function (fragment, hour) { + return "[" + OPERATOR.dateHourBefore + "(" + fragment + ", " + hour + ")]"; + }, + hourAfter: function (fragment, hour) { + return "[" + OPERATOR.dateHourAfter + "(" + fragment + ", " + hour + ")]"; + }, +}; +var number = { + gt: function (fragment, value) { + return "[" + OPERATOR.numberGt + "(" + fragment + ", " + value + ")]"; + }, + lt: function (fragment, value) { + return "[" + OPERATOR.numberLt + "(" + fragment + ", " + value + ")]"; + }, + inRange: function (fragment, before, after) { + return "[" + OPERATOR.numberInRange + "(" + fragment + ", " + before + ", " + after + ")]"; + }, +}; +var Predicates = { + at: function (fragment, value) { + return "[" + OPERATOR.at + "(" + fragment + ", " + encode(value) + ")]"; + }, + not: function (fragment, value) { + return "[" + OPERATOR.not + "(" + fragment + ", " + encode(value) + ")]"; + }, + missing: function (fragment) { + return "[" + OPERATOR.missing + "(" + fragment + ")]"; + }, + has: function (fragment) { + return "[" + OPERATOR.has + "(" + fragment + ")]"; + }, + any: function (fragment, values) { + return "[" + OPERATOR.any + "(" + fragment + ", " + encode(values) + ")]"; + }, + in: function (fragment, values) { + return "[" + OPERATOR.in + "(" + fragment + ", " + encode(values) + ")]"; + }, + fulltext: function (fragment, value) { + return "[" + OPERATOR.fulltext + "(" + fragment + ", " + encode(value) + ")]"; + }, + similar: function (documentId, maxResults) { + return "[" + OPERATOR.similar + "(\"" + documentId + "\", " + maxResults + ")]"; + }, + date: date, + dateBefore: date.before, + dateAfter: date.after, + dateBetween: date.between, + dayOfMonth: date.dayOfMonth, + dayOfMonthAfter: date.dayOfMonthAfter, + dayOfMonthBefore: date.dayOfMonthBefore, + dayOfWeek: date.dayOfWeek, + dayOfWeekAfter: date.dayOfWeekAfter, + dayOfWeekBefore: date.dayOfWeekBefore, + month: date.month, + monthBefore: date.monthBefore, + monthAfter: date.monthAfter, + year: date.year, + hour: date.hour, + hourBefore: date.hourBefore, + hourAfter: date.hourAfter, + number: number, + gt: number.gt, + lt: number.lt, + inRange: number.inRange, + near: geopoint.near, + geopoint: geopoint, +}; + +// Some portions of code from https://github.com/jshttp/cookie +var decode = decodeURIComponent; +function tryDecode(str, decode) { + try { + return decode(str); + } + catch (e) { + return str; + } +} +function parse(str, options) { + if (typeof str !== 'string') { + throw new TypeError('argument str must be a string'); + } + var obj = {}; + var opt = options || {}; + var pairs = str.split(/; */); + var dec = opt.decode || decode; + pairs.forEach(function (pair) { + var eq_idx = pair.indexOf('='); + // skip things that don't look like key=value + if (eq_idx < 0) { + return; + } + var key = pair.substr(0, eq_idx).trim(); + var val = pair.substr(++eq_idx, pair.length).trim(); + // quoted values + if ('"' == val[0]) { + val = val.slice(1, -1); + } + // only assign once + if (undefined == obj[key]) { + obj[key] = tryDecode(val, dec); + } + }); + return obj; +} +var Cookies = { parse: parse }; + +var PREVIEW_COOKIE = 'io.prismic.preview'; +var EXPERIMENT_COOKIE = 'io.prismic.experiment'; +var ResolvedApi = /** @class */ (function () { + function ResolvedApi(data, httpClient, options) { + this.data = data; + this.masterRef = data.refs.filter(function (ref) { return ref.isMasterRef; })[0]; + this.experiments = new Experiments(data.experiments); + this.bookmarks = data.bookmarks; + this.httpClient = httpClient; + this.options = options; + this.refs = data.refs; + this.tags = data.tags; + this.types = data.types; + } + /** + * Returns a useable form from its id, as described in the RESTful description of the API. + * For instance: api.form("everything") works on every repository (as "everything" exists by default) + * You can then chain the calls: api.form("everything").query('[[:d = at(document.id, "UkL0gMuvzYUANCpf")]]').ref(ref).submit() + */ + ResolvedApi.prototype.form = function (formId) { + var form = this.data.forms[formId]; + if (form) { + return new SearchForm(form, this.httpClient); + } + return null; + }; + ResolvedApi.prototype.everything = function () { + var f = this.form('everything'); + if (!f) + throw new Error('Missing everything form'); + return f; + }; + /** + * The ID of the master ref on this prismic.io API. + * Do not use like this: searchForm.ref(api.master()). + * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page. + */ + ResolvedApi.prototype.master = function () { + return this.masterRef.ref; + }; + /** + * Returns the ref ID for a given ref's label. + * Do not use like this: searchForm.ref(api.ref("Future release label")). + * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page. + */ + ResolvedApi.prototype.ref = function (label) { + var ref = this.data.refs.filter(function (ref) { return ref.label === label; })[0]; + return ref ? ref.ref : null; + }; + ResolvedApi.prototype.currentExperiment = function () { + return this.experiments.current(); + }; + /** + * Query the repository + */ + ResolvedApi.prototype.query = function (q, optionsOrCallback, cb) { + if (cb === void 0) { cb = function () { }; } + var _a = typeof optionsOrCallback === 'function' + ? { options: {}, callback: optionsOrCallback } + : { options: optionsOrCallback || {}, callback: cb }, options = _a.options, callback = _a.callback; + var form = this.everything(); + for (var key in options) { + form = form.set(key, options[key]); + } + if (!options.ref) { + // Look in cookies if we have a ref (preview or experiment) + var cookieString = ''; + if (this.options.req) { // NodeJS + cookieString = this.options.req.headers['cookie'] || ''; + } + else if (typeof window !== 'undefined' && window.document) { // Browser + cookieString = window.document.cookie || ''; + } + var cookies = Cookies.parse(cookieString); + var previewRef = cookies[PREVIEW_COOKIE]; + var experimentRef = this.experiments.refFromCookie(cookies[EXPERIMENT_COOKIE]); + form = form.ref(previewRef || experimentRef || this.masterRef.ref); + } + if (q) { + form.query(q); + } + return form.submit(callback); + }; + /** + * Retrieve the document returned by the given query + * @param {string|array|Predicate} the query + * @param {object} additional parameters. In NodeJS, pass the request as 'req'. + * @param {function} callback(err, doc) + */ + ResolvedApi.prototype.queryFirst = function (q, optionsOrCallback, cb) { + var _a = typeof optionsOrCallback === 'function' + ? { options: {}, callback: optionsOrCallback } + : { options: optionsOrCallback || {}, callback: cb || (function () { }) }, options = _a.options, callback = _a.callback; + options.page = 1; + options.pageSize = 1; + return this.query(q, options).then(function (response) { + var document = response && response.results && response.results[0]; + callback(null, document); + return document; + }).catch(function (error) { + callback(error); + throw error; + }); + }; + /** + * Retrieve the document with the given id + */ + ResolvedApi.prototype.getByID = function (id, maybeOptions, cb) { + var options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.queryFirst(Predicates.at('document.id', id), options, cb); + }; + /** + * Retrieve multiple documents from an array of id + */ + ResolvedApi.prototype.getByIDs = function (ids, maybeOptions, cb) { + var options = maybeOptions || {}; + if (!options.lang) + options.lang = '*'; + return this.query(Predicates.in('document.id', ids), options, cb); + }; + /** + * Retrieve the document with the given uid + */ + ResolvedApi.prototype.getByUID = function (type, uid, maybeOptions, cb) { + var options = maybeOptions || {}; + if (options.lang === "*") + throw new Error("FORDIDDEN. You can't use getByUID with *, use the predicates instead."); + if (!options.page) + options.page = 1; + return this.queryFirst(Predicates.at("my." + type + ".uid", uid), options, cb); + }; + /** + * Retrieve the singleton document with the given type + */ + ResolvedApi.prototype.getSingle = function (type, maybeOptions, cb) { + var options = maybeOptions || {}; + return this.queryFirst(Predicates.at('document.type', type), options, cb); + }; + /** + * Retrieve the document with the given bookmark + */ + ResolvedApi.prototype.getBookmark = function (bookmark, maybeOptions, cb) { + var id = this.data.bookmarks[bookmark]; + if (id) { + return this.getByID(id, maybeOptions, cb); + } + else { + return Promise.reject('Error retrieving bookmarked id'); + } + }; + ResolvedApi.prototype.previewSession = function (token, linkResolver, defaultUrl, cb) { + var _this = this; + return new Promise(function (resolve, reject) { + _this.httpClient.request(token, function (e, result) { + if (e) { + cb && cb(e); + reject(e); + } + else if (result) { + if (!result.mainDocument) { + cb && cb(null, defaultUrl); + resolve(defaultUrl); + } + else { + return _this.getByID(result.mainDocument, { ref: token }).then(function (document) { + if (!document) { + cb && cb(null, defaultUrl); + resolve(defaultUrl); + } + else { + var url = linkResolver(document); + cb && cb(null, url); + resolve(url); + } + }).catch(reject); + } + } + }); + }); + }; + return ResolvedApi; +}()); + +/** +* A doubly linked list-based Least Recently Used (LRU) cache. Will keep most +* recently used items while discarding least recently used items when its limit +* is reached. +* +* Licensed under MIT. Copyright (c) 2010 Rasmus Andersson +* Typescript-ified by Oleksandr Nikitin +* +* Illustration of the design: +* +* entry entry entry entry +* ______ ______ ______ ______ +* | head |.newer => | |.newer => | |.newer => | tail | +* | A | | B | | C | | D | +* |______| <= older.|______| <= older.|______| <= older.|______| +* +* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added +*/ +function MakeLRUCache(limit) { + return new LRUCache(limit); +} +function LRUCache(limit) { + // Current size of the cache. (Read-only). + this.size = 0; + // Maximum number of items this cache can hold. + this.limit = limit; + this._keymap = {}; +} +/** + * Put into the cache associated with . Returns the entry which was + * removed to make room for the new entry. Otherwise undefined is returned + * (i.e. if there was enough room already). + */ +LRUCache.prototype.put = function (key, value) { + var entry = { key: key, value: value }; + // Note: No protection agains replacing, and thus orphan entries. By design. + this._keymap[key] = entry; + if (this.tail) { + // link previous tail to the new tail (entry) + this.tail.newer = entry; + entry.older = this.tail; + } + else { + // we're first in -- yay + this.head = entry; + } + // add new entry to the end of the linked list -- it's now the freshest entry. + this.tail = entry; + if (this.size === this.limit) { + // we hit the limit -- remove the head + return this.shift(); + } + else { + // increase the size counter + this.size++; + } +}; +/** + * Purge the least recently used (oldest) entry from the cache. Returns the + * removed entry or undefined if the cache was empty. + * + * If you need to perform any form of finalization of purged items, this is a + * good place to do it. Simply override/replace this function: + * + * var c = new LRUCache(123); + * c.shift = function() { + * var entry = LRUCache.prototype.shift.call(this); + * doSomethingWith(entry); + * return entry; + * } + */ +LRUCache.prototype.shift = function () { + // todo: handle special case when limit == 1 + var entry = this.head; + if (entry) { + if (this.head.newer) { + this.head = this.head.newer; + this.head.older = undefined; + } + else { + this.head = undefined; + } + // Remove last strong reference to and remove links from the purged + // entry being returned: + entry.newer = entry.older = undefined; + // delete is slow, but we need to do this to avoid uncontrollable growth: + delete this._keymap[entry.key]; + } + console.log('purging ', entry.key); + return entry; +}; +/** + * Get and register recent use of . Returns the value associated with + * or undefined if not in cache. + */ +LRUCache.prototype.get = function (key, returnEntry) { + // First, find our cache entry + var entry = this._keymap[key]; + if (entry === undefined) + return; // Not cached. Sorry. + // As was found in the cache, register it as being requested recently + if (entry === this.tail) { + // Already the most recently used entry, so no need to update the list + return returnEntry ? entry : entry.value; + } + // HEAD--------------TAIL + // <.older .newer> + // <--- add direction -- + // A B C E + if (entry.newer) { + if (entry === this.head) + this.head = entry.newer; + entry.newer.older = entry.older; // C <-- E. + } + if (entry.older) + entry.older.newer = entry.newer; // C. --> E + entry.newer = undefined; // D --x + entry.older = this.tail; // D. --> E + if (this.tail) + this.tail.newer = entry; // E. <-- D + this.tail = entry; + return returnEntry ? entry : entry.value; +}; +// ---------------------------------------------------------------------------- +// Following code is optional and can be removed without breaking the core +// functionality. +/** + * Check if is in the cache without registering recent use. Feasible if + * you do not want to chage the state of the cache, but only "peek" at it. + * Returns the entry associated with if found, or undefined if not found. + */ +LRUCache.prototype.find = function (key) { + return this._keymap[key]; +}; +/** + * Update the value of entry with . Returns the old value, or undefined if + * entry was not in the cache. + */ +LRUCache.prototype.set = function (key, value) { + var oldvalue; + var entry = this.get(key, true); + if (entry) { + oldvalue = entry.value; + entry.value = value; + } + else { + oldvalue = this.put(key, value); + if (oldvalue) + oldvalue = oldvalue.value; + } + return oldvalue; +}; +/** + * Remove entry from cache and return its value. Returns undefined if not + * found. + */ +LRUCache.prototype.remove = function (key) { + var entry = this._keymap[key]; + if (!entry) + return; + delete this._keymap[entry.key]; // need to do delete unfortunately + if (entry.newer && entry.older) { + // relink the older entry with the newer entry + entry.older.newer = entry.newer; + entry.newer.older = entry.older; + } + else if (entry.newer) { + // remove the link to us + entry.newer.older = undefined; + // link the newer entry to head + this.head = entry.newer; + } + else if (entry.older) { + // remove the link to us + entry.older.newer = undefined; + // link the newer entry to head + this.tail = entry.older; + } + else { // if(entry.older === undefined && entry.newer === undefined) { + this.head = this.tail = undefined; + } + this.size--; + return entry.value; +}; +/** Removes all entries */ +LRUCache.prototype.removeAll = function () { + // This should be safe, as we never expose strong refrences to the outside + this.head = this.tail = undefined; + this.size = 0; + this._keymap = {}; +}; +/** + * Return an array containing all keys of entries stored in the cache object, in + * arbitrary order. + */ +if (typeof Object.keys === 'function') { + LRUCache.prototype.keys = function () { return Object.keys(this._keymap); }; +} +else { + LRUCache.prototype.keys = function () { + var keys = []; + for (var k in this._keymap) + keys.push(k); + return keys; + }; +} +/** + * Call `fun` for each entry. Starting with the newest entry if `desc` is a true + * value, otherwise starts with the oldest (head) enrty and moves towards the + * tail. + * + * `fun` is called with 3 arguments in the context `context`: + * `fun.call(context, Object key, Object value, LRUCache self)` + */ +LRUCache.prototype.forEach = function (fun, context, desc) { + var entry; + if (context === true) { + desc = true; + context = undefined; + } + else if (typeof context !== 'object') + context = this; + if (desc) { + entry = this.tail; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.older; + } + } + else { + entry = this.head; + while (entry) { + fun.call(context, entry.key, entry.value, this); + entry = entry.newer; + } + } +}; +/** Returns a JSON (array) representation */ +//LRUCache.prototype.toJSON = function () { +// var s: IEntry[] = [], entry = this.head; +// while (entry) { +// s.push({ key: entry.key.toJSON(), value: entry.value.toJSON() }); +// entry = entry.newer; +// } +// return s; +//}; +/** Returns a String representation */ +LRUCache.prototype.toString = function () { + var s = '', entry = this.head; + while (entry) { + s += String(entry.key) + ':' + entry.value; + entry = entry.newer; + if (entry) + s += ' < '; + } + return s; +}; + +var DefaultApiCache = /** @class */ (function () { + function DefaultApiCache(limit) { + if (limit === void 0) { limit = 1000; } + this.lru = MakeLRUCache(limit); + } + DefaultApiCache.prototype.isExpired = function (key) { + var value = this.lru.get(key, false); + if (value) { + return value.expiredIn !== 0 && value.expiredIn < Date.now(); + } + else { + return false; + } + }; + DefaultApiCache.prototype.get = function (key, cb) { + var value = this.lru.get(key, false); + if (value && !this.isExpired(key)) { + cb(null, value.data); + } + else { + cb && cb(null); + } + }; + DefaultApiCache.prototype.set = function (key, value, ttl, cb) { + this.lru.remove(key); + this.lru.put(key, { + data: value, + expiredIn: ttl ? (Date.now() + (ttl * 1000)) : 0, + }); + cb && cb(null); + }; + DefaultApiCache.prototype.remove = function (key, cb) { + this.lru.remove(key); + cb && cb(null); + }; + DefaultApiCache.prototype.clear = function (cb) { + this.lru.removeAll(); + cb && cb(null); + }; + return DefaultApiCache; +}()); + +function fetchRequest(url, options, callback) { + var fetchOptions = { + headers: { + Accept: 'application/json', + }, + }; + if (options && options.proxyAgent) { + fetchOptions.agent = options.proxyAgent; + } + fetch(url, fetchOptions).then(function (xhr) { + if (~~(xhr.status / 100 !== 2)) { + /** + * @description + * drain the xhr before throwing an error to prevent memory leaks + * @link https://github.com/bitinn/node-fetch/issues/83 + */ + return xhr.text().then(function () { + var e = new Error("Unexpected status code [" + xhr.status + "] on URL " + url); + e.status = xhr.status; + throw e; + }); + } + return xhr.json().then(function (result) { + var cacheControl = xhr.headers.get('cache-control'); + var parsedCacheControl = cacheControl ? /max-age=(\d+)/.exec(cacheControl) : null; + var ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined; + callback(null, result, xhr, ttl); + }); + }).catch(callback); +} +var DefaultRequestHandler = /** @class */ (function () { + function DefaultRequestHandler(options) { + this.options = options || {}; + } + DefaultRequestHandler.prototype.request = function (url, callback) { + fetchRequest(url, this.options, callback); + }; + return DefaultRequestHandler; +}()); + +var HttpClient = /** @class */ (function () { + function HttpClient(requestHandler, cache, proxyAgent) { + this.requestHandler = requestHandler || new DefaultRequestHandler({ proxyAgent: proxyAgent }); + this.cache = cache || new DefaultApiCache(); + } + HttpClient.prototype.request = function (url, callback) { + this.requestHandler.request(url, function (err, result, xhr, ttl) { + if (err) { + callback && callback(err, null, xhr, ttl); + } + else if (result) { + callback && callback(null, result, xhr, ttl); + } + }); + }; + /** + * Fetch a URL corresponding to a query, and parse the response as a Response object + */ + HttpClient.prototype.cachedRequest = function (url, maybeOptions) { + var _this = this; + var options = maybeOptions || {}; + var run = function (cb) { + var cacheKey = options.cacheKey || url; + _this.cache.get(cacheKey, function (cacheGetError, cacheGetValue) { + if (cacheGetError || cacheGetValue) { + cb(cacheGetError, cacheGetValue); + } + else { + _this.request(url, function (fetchError, fetchValue, xhr, ttlReq) { + if (fetchError) { + cb(fetchError, null); + } + else { + var ttl = ttlReq || options.ttl; + if (ttl) { + _this.cache.set(cacheKey, fetchValue, ttl, cb); + } + cb(null, fetchValue); + } + }); + } + }); + }; + return new Promise(function (resolve, reject) { + run(function (err, value) { + if (err) + reject(err); + if (value) + resolve(value); + }); + }); + }; + return HttpClient; +}()); + +var Api = /** @class */ (function () { + function Api(url, options) { + this.options = options || {}; + this.url = url; + if (this.options.accessToken) { + var accessTokenParam = "access_token=" + this.options.accessToken; + this.url += (url.indexOf('?') > -1 ? '&' : '?') + accessTokenParam; + } + this.apiDataTTL = this.options.apiDataTTL || 5; + this.httpClient = new HttpClient(this.options.requestHandler, this.options.apiCache, this.options.proxyAgent); + } + /** + * Fetches data used to construct the api client, from cache if it's + * present, otherwise from calling the prismic api endpoint (which is + * then cached). + */ + Api.prototype.get = function (cb) { + var _this = this; + return this.httpClient.cachedRequest(this.url, { ttl: this.apiDataTTL }).then(function (data) { + var resolvedApi = new ResolvedApi(data, _this.httpClient, _this.options); + cb && cb(null, resolvedApi); + return resolvedApi; + }).catch(function (error) { + cb && cb(error); + throw error; + }); + }; + return Api; +}()); + +var DefaultClient = /** @class */ (function () { + function DefaultClient(url, options) { + this.api = new Api(url, options); + } + DefaultClient.prototype.getApi = function () { + return this.api.get(); + }; + DefaultClient.prototype.everything = function () { + return this.form('everything'); + }; + DefaultClient.prototype.form = function (formId) { + return new LazySearchForm(formId, this.api); + }; + DefaultClient.prototype.query = function (q, optionsOrCallback, cb) { + return this.getApi().then(function (api) { return api.query(q, optionsOrCallback, cb); }); + }; + DefaultClient.prototype.queryFirst = function (q, optionsOrCallback, cb) { + return this.getApi().then(function (api) { return api.queryFirst(q, optionsOrCallback, cb); }); + }; + DefaultClient.prototype.getByID = function (id, options, cb) { + return this.getApi().then(function (api) { return api.getByID(id, options, cb); }); + }; + DefaultClient.prototype.getByIDs = function (ids, options, cb) { + return this.getApi().then(function (api) { return api.getByIDs(ids, options, cb); }); + }; + DefaultClient.prototype.getByUID = function (type, uid, options, cb) { + return this.getApi().then(function (api) { return api.getByUID(type, uid, options, cb); }); + }; + DefaultClient.prototype.getSingle = function (type, options, cb) { + return this.getApi().then(function (api) { return api.getSingle(type, options, cb); }); + }; + DefaultClient.prototype.getBookmark = function (bookmark, options, cb) { + return this.getApi().then(function (api) { return api.getBookmark(bookmark, options, cb); }); + }; + DefaultClient.prototype.previewSession = function (token, linkResolver, defaultUrl, cb) { + return this.getApi().then(function (api) { return api.previewSession(token, linkResolver, defaultUrl, cb); }); + }; + DefaultClient.getApi = function (url, options) { + var api = new Api(url, options); + return api.get(); + }; + return DefaultClient; +}()); + +function client(url, options) { + return new DefaultClient(url, options); +} +function getApi(url, options) { + return DefaultClient.getApi(url, options); +} +function api(url, options) { + return getApi(url, options); +} + +export { EXPERIMENT_COOKIE as experimentCookie, PREVIEW_COOKIE as previewCookie, Predicates, Experiments, Api, client, getApi, api }; +//# sourceMappingURL=prismic-javascript.mjs.map diff --git a/dist/prismic-javascript.mjs.map b/dist/prismic-javascript.mjs.map new file mode 100644 index 00000000..77dd507d --- /dev/null +++ b/dist/prismic-javascript.mjs.map @@ -0,0 +1 @@ +{"version":3,"file":"prismic-javascript.mjs","sources":["../src/experiments.ts","../src/form.ts","../src/Predicates.ts","../src/Cookies.ts","../src/ResolvedApi.ts","../src/lru.ts","../src/cache.ts","../src/request.ts","../src/HttpClient.ts","../src/Api.ts","../src/client.ts","../src/index.ts"],"sourcesContent":["export class Variation {\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n }\n\n id(): string {\n return this.data.id;\n }\n\n ref(): string {\n return this.data.ref;\n }\n\n label(): string {\n return this.data.label;\n }\n}\n\nexport class Experiment {\n variations: Variation[];\n data: any = {};\n\n constructor(data: any) {\n this.data = data;\n this.variations = (data.variations || []).map((v: any) => {\n return new Variation(v);\n });\n }\n\n id(): string {\n return this.data.id;\n }\n\n googleId(): string {\n return this.data.googleId;\n }\n\n name(): string {\n return this.data.name;\n }\n}\n\nexport class Experiments {\n drafts: Experiment[];\n running: Experiment[];\n\n constructor(data: any) {\n if (data) {\n this.drafts = (data.drafts || []).map((exp: any) => {\n return new Experiment(exp);\n });\n this.running = (data.running || []).map((exp: any) => {\n return new Experiment(exp);\n });\n }\n }\n\n current(): Experiment | null {\n if (this.running.length > 0) {\n return this.running[0];\n } else {\n return null;\n }\n }\n refFromCookie(cookie: string): string | null {\n if (!cookie || cookie.trim() === '') return null;\n const splitted = cookie.trim().split(' ');\n if (splitted.length < 2) return null;\n const expId = splitted[0];\n const varIndex = parseInt(splitted[1], 10);\n const exp = this.running.filter((exp) => {\n return exp.googleId() === expId && exp.variations.length > varIndex;\n })[0];\n return exp ? exp.variations[varIndex].ref() : null;\n }\n}\n","import Api from './Api';\nimport ResolvedApi from './ResolvedApi';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport HttpClient from './HttpClient';\nimport { RequestCallback } from './request';\n\nexport type Fields = { [key: string]: any };\n\nexport interface Form {\n fields: Fields;\n action: string;\n name: string;\n rel: string;\n form_method: string;\n enctype: string;\n}\n\nexport class LazySearchForm {\n id: string;\n fields: Fields;\n api: Api;\n\n constructor(id: string, api: Api) {\n this.id = id;\n this.api = api;\n this.fields = {};\n }\n\n set(key: string, value: any): LazySearchForm {\n this.fields[key] = value;\n return this;\n }\n\n ref(ref: string): LazySearchForm {\n return this.set('ref', ref);\n }\n\n query(query: string | string[]): LazySearchForm {\n return this.set('q', query);\n }\n\n pageSize(size: number): LazySearchForm {\n return this.set('pageSize', size);\n }\n\n fetch(fields: string | string[]): LazySearchForm {\n console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.');\n return this.set('fetch', fields);\n }\n\n fetchLinks(fields: string | string[]): LazySearchForm {\n console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.');\n return this.set('fetchLinks', fields);\n }\n\n graphQuery(query: string): LazySearchForm {\n return this.set('graphQuery', query);\n }\n\n lang(langCode: string): LazySearchForm {\n return this.set('lang', langCode);\n }\n\n page(p: number): LazySearchForm {\n return this.set('page', p);\n }\n\n after(documentId: string): LazySearchForm {\n return this.set('after', documentId);\n }\n\n orderings(orderings?: string[]): LazySearchForm {\n return this.set('orderings', orderings);\n }\n\n url(): Promise {\n return this.api.get().then((api) => {\n return LazySearchForm.toSearchForm(this, api).url();\n });\n }\n\n submit(cb: RequestCallback): Promise {\n return this.api.get().then((api) => {\n return LazySearchForm.toSearchForm(this, api).submit(cb);\n });\n }\n\n static toSearchForm(lazyForm: LazySearchForm, api: ResolvedApi): SearchForm {\n const form = api.form(lazyForm.id);\n if (form) {\n return Object.keys(lazyForm.fields).reduce((form, fieldKey) => {\n const fieldValue = lazyForm.fields[fieldKey];\n if (fieldKey === 'q') {\n return form.query(fieldValue);\n } else if (fieldKey === 'pageSize') {\n return form.pageSize(fieldValue);\n } else if (fieldKey === 'fetch') {\n return form.fetch(fieldValue);\n } else if (fieldKey === 'fetchLinks') {\n return form.fetchLinks(fieldValue);\n } else if (fieldKey === 'graphQuery') {\n return form.graphQuery(fieldValue);\n } else if (fieldKey === 'lang') {\n return form.lang(fieldValue);\n } else if (fieldKey === 'page') {\n return form.page(fieldValue);\n } else if (fieldKey === 'after') {\n return form.after(fieldValue);\n } else if (fieldKey === 'orderings') {\n return form.orderings(fieldValue);\n } else {\n return form.set(fieldKey, fieldValue);\n }\n }, form);\n } else {\n throw new Error(`Unable to access to form ${lazyForm.id}`);\n }\n }\n}\n\nexport class SearchForm {\n httpClient: HttpClient;\n form: Form;\n data: any;\n\n constructor(form: Form, httpClient: HttpClient) {\n this.httpClient = httpClient;\n this.form = form;\n\n this.data = {};\n for (const field in form.fields) {\n if (form.fields[field]['default']) {\n this.data[field] = [form.fields[field]['default']];\n }\n }\n }\n\n set(field: string, value: any): SearchForm {\n const fieldDesc = this.form.fields[field];\n if (!fieldDesc) throw new Error('Unknown field ' + field);\n const checkedValue = value === '' || value === undefined ? null : value;\n let values = this.data[field] || [];\n if (fieldDesc.multiple) {\n values = checkedValue ? values.concat([checkedValue]) : values;\n } else {\n values = checkedValue ? [checkedValue] : values;\n }\n this.data[field] = values;\n return this;\n }\n\n /**\n * Sets a ref to query on for this SearchForm. This is a mandatory\n * method to call before calling submit(), and api.form('everything').submit()\n * will not work.\n */\n ref(ref: string): SearchForm {\n return this.set('ref', ref);\n }\n\n /**\n * Sets a predicate-based query for this SearchForm. This is where you\n * paste what you compose in your prismic.io API browser.\n */\n query(query: string | string[]): SearchForm {\n if (typeof query === 'string') {\n return this.query([query]);\n } else if (Array.isArray(query)) {\n return this.set('q', `[${query.join('')}]`);\n } else {\n throw new Error(`Invalid query : ${query}`);\n }\n }\n\n /**\n * Sets a page size to query for this SearchForm. This is an optional method.\n *\n * @param {number} size - The page size\n * @returns {SearchForm} - The SearchForm itself\n */\n pageSize(size: number): SearchForm {\n return this.set('pageSize', size);\n }\n\n /**\n * Restrict the results document to the specified fields\n */\n fetch(fields: string | string[]): SearchForm {\n console.warn('Warning: Using Fetch is deprecated. Use the property `graphQuery` instead.');\n const strFields = Array.isArray(fields) ? fields.join(',') : fields;\n return this.set('fetch', strFields);\n }\n\n /**\n * Include the requested fields in the DocumentLink instances in the result\n */\n fetchLinks(fields: string | string[]): SearchForm {\n console.warn('Warning: Using FetchLinks is deprecated. Use the property `graphQuery` instead.');\n const strFields = Array.isArray(fields) ? fields.join(',') : fields;\n return this.set('fetchLinks', strFields);\n }\n\n /**\n * Sets the graphquery to query for this SearchForm. This is an optional method.\n */\n graphQuery(query: string): SearchForm {\n return this.set('graphQuery', query);\n }\n\n /**\n * Sets the language to query for this SearchForm. This is an optional method.\n */\n lang(langCode: string): SearchForm {\n return this.set('lang', langCode);\n }\n\n /**\n * Sets the page number to query for this SearchForm. This is an optional method.\n */\n page(p: number): SearchForm {\n return this.set('page', p);\n }\n\n /**\n * Remove all the documents except for those after the specified document in the list. This is an optional method.\n */\n after(documentId: string): SearchForm {\n return this.set('after', documentId);\n }\n\n /**\n * Sets the orderings to query for this SearchForm. This is an optional method.\n */\n orderings(orderings ?: string[]): SearchForm {\n if (!orderings) {\n return this;\n } else {\n return this.set('orderings', `[${orderings.join(',')}]`);\n }\n }\n\n /**\n * Build the URL to query\n */\n url(): string {\n let url = this.form.action;\n if (this.data) {\n let sep = (url.indexOf('?') > -1 ? '&' : '?');\n for (const key in this.data) {\n if (this.data.hasOwnProperty(key)) {\n const values = this.data[key];\n if (values) {\n for (let i = 0; i < values.length; i++) {\n url += sep + key + '=' + encodeURIComponent(values[i]);\n sep = '&';\n }\n }\n }\n }\n }\n return url;\n }\n\n /**\n * Submits the query, and calls the callback function.\n */\n submit(cb: RequestCallback): Promise {\n return this.httpClient.cachedRequest(this.url()).then((response) => {\n cb && cb(null, response);\n return response;\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","const OPERATOR = {\n at: 'at',\n not: 'not',\n missing: 'missing',\n has: 'has',\n any: 'any',\n in: 'in',\n fulltext: 'fulltext',\n similar: 'similar',\n numberGt: 'number.gt',\n numberLt: 'number.lt',\n numberInRange: 'number.inRange',\n dateBefore: 'date.before',\n dateAfter: 'date.after',\n dateBetween: 'date.between',\n dateDayOfMonth: 'date.day-of-month',\n dateDayOfMonthAfter: 'date.day-of-month-after',\n dateDayOfMonthBefore: 'date.day-of-month-before',\n dateDayOfWeek: 'date.day-of-week',\n dateDayOfWeekAfter: 'date.day-of-week-after',\n dateDayOfWeekBefore: 'date.day-of-week-before',\n dateMonth: 'date.month',\n dateMonthBefore: 'date.month-before',\n dateMonthAfter: 'date.month-after',\n dateYear: 'date.year',\n dateHour: 'date.hour',\n dateHourBefore: 'date.hour-before',\n dateHourAfter: 'date.hour-after',\n GeopointNear: 'geopoint.near',\n};\n\ntype PredicateValue = string | number | Date;\n\nfunction encode(value: PredicateValue | PredicateValue[]): string {\n if (typeof value === 'string') {\n return `\"${value}\"`;\n } else if (typeof value === 'number') {\n return value.toString();\n } else if (value instanceof Date) {\n return value.getTime().toString();\n } else if (Array.isArray(value)) {\n return `[${value.map(v => encode(v)).join(',')}]`;\n } else {\n throw new Error(`Unable to encode ${value} of type ${typeof value}`);\n }\n}\n\nconst geopoint = {\n near(fragment: string, latitude: number, longitude: number, radius: number): string {\n return `[${OPERATOR.GeopointNear}(${fragment}, ${latitude}, ${longitude}, ${radius})]`;\n },\n};\n\nconst date = {\n\n before(fragment: string, before: PredicateValue): string {\n return `[${OPERATOR.dateBefore}(${fragment}, ${encode(before)})]`;\n },\n\n after(fragment: string, after: PredicateValue): string {\n return `[${OPERATOR.dateAfter}(${fragment}, ${encode(after)})]`;\n },\n\n between(fragment: string, before: PredicateValue, after: PredicateValue): string {\n return `[${OPERATOR.dateBetween}(${fragment}, ${encode(before)}, ${encode(after)})]`;\n },\n\n dayOfMonth(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonth}(${fragment}, ${day})]`;\n },\n\n dayOfMonthAfter(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonthAfter}(${fragment}, ${day})]`;\n },\n\n dayOfMonthBefore(fragment: string, day: number): string {\n return `[${OPERATOR.dateDayOfMonthBefore}(${fragment}, ${day})]`;\n },\n\n dayOfWeek(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeek}(${fragment}, ${encode(day)})]`;\n },\n\n dayOfWeekAfter(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeekAfter}(${fragment}, ${encode(day)})]`;\n },\n\n dayOfWeekBefore(fragment: string, day: number | string): string {\n return `[${OPERATOR.dateDayOfWeekBefore}(${fragment}, ${encode(day)})]`;\n },\n\n month(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonth}(${fragment}, ${encode(month)})]`;\n },\n\n monthBefore(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonthBefore}(${fragment}, ${encode(month)})]`;\n },\n\n monthAfter(fragment: string, month: number | string): string {\n return `[${OPERATOR.dateMonthAfter}(${fragment}, ${encode(month)})]`;\n },\n\n year(fragment: string, year: number): string {\n return `[${OPERATOR.dateYear}(${fragment}, ${year})]`;\n },\n\n hour(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHour}(${fragment}, ${hour})]`;\n },\n\n hourBefore(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHourBefore}(${fragment}, ${hour})]`;\n },\n\n hourAfter(fragment: string, hour: number): string {\n return `[${OPERATOR.dateHourAfter}(${fragment}, ${hour})]`;\n },\n};\n\nconst number = {\n gt(fragment: string, value: number): string {\n return `[${OPERATOR.numberGt}(${fragment}, ${value})]`;\n },\n\n lt(fragment: string, value: number): string {\n return `[${OPERATOR.numberLt}(${fragment}, ${value})]`;\n },\n\n inRange(fragment: string, before: number, after: number): string {\n return `[${OPERATOR.numberInRange}(${fragment}, ${before}, ${after})]`;\n },\n};\n\nexport default {\n at(fragment: string, value: PredicateValue | PredicateValue[]): string {\n return `[${OPERATOR.at}(${fragment}, ${encode(value)})]`;\n },\n\n not(fragment: string, value: PredicateValue | PredicateValue[]): string {\n return `[${OPERATOR.not}(${fragment}, ${encode(value)})]`;\n },\n\n missing(fragment: string): string {\n return `[${OPERATOR.missing}(${fragment})]`;\n },\n\n has(fragment: string): string {\n return `[${OPERATOR.has}(${fragment})]`;\n },\n\n any(fragment: string, values: PredicateValue[]): string {\n return `[${OPERATOR.any}(${fragment}, ${encode(values)})]`;\n },\n\n in(fragment: string, values: string[]): string {\n return `[${OPERATOR.in}(${fragment}, ${encode(values)})]`;\n },\n\n fulltext(fragment: string, value: string): string {\n return `[${OPERATOR.fulltext}(${fragment}, ${encode(value)})]`;\n },\n\n similar(documentId: string, maxResults: number): string {\n return `[${OPERATOR.similar}(\"${documentId}\", ${maxResults})]`;\n },\n\n date,\n\n dateBefore: date.before,\n\n dateAfter: date.after,\n\n dateBetween: date.between,\n\n dayOfMonth: date.dayOfMonth,\n\n dayOfMonthAfter: date.dayOfMonthAfter,\n\n dayOfMonthBefore: date.dayOfMonthBefore,\n\n dayOfWeek: date.dayOfWeek,\n\n dayOfWeekAfter: date.dayOfWeekAfter,\n\n dayOfWeekBefore: date.dayOfWeekBefore,\n\n month: date.month,\n\n monthBefore: date.monthBefore,\n\n monthAfter: date.monthAfter,\n\n year: date.year,\n\n hour: date.hour,\n\n hourBefore: date.hourBefore,\n\n hourAfter: date.hourAfter,\n\n number,\n\n gt: number.gt,\n\n lt: number.lt,\n\n inRange: number.inRange,\n\n near: geopoint.near,\n\n geopoint,\n};\n","export interface Cookie {\n [key: string]: string;\n value: string;\n}\n\n// Some portions of code from https://github.com/jshttp/cookie\n\nvar decode = decodeURIComponent;\n\nfunction tryDecode(str: string, decode: (str: string) => string) {\n try {\n return decode(str);\n } catch (e) {\n return str;\n }\n}\n\nfunction parse(str: string, options?: any) {\n if (typeof str !== 'string') {\n throw new TypeError('argument str must be a string');\n }\n\n var obj = {};\n var opt = options || {};\n var pairs = str.split(/; */);\n var dec = opt.decode || decode;\n\n pairs.forEach(function(pair) {\n var eq_idx = pair.indexOf('=');\n\n // skip things that don't look like key=value\n if (eq_idx < 0) {\n return;\n }\n\n var key = pair.substr(0, eq_idx).trim();\n var val = pair.substr(++eq_idx, pair.length).trim();\n\n // quoted values\n if ('\"' == val[0]) {\n val = val.slice(1, -1);\n }\n\n // only assign once\n if (undefined == obj[key]) {\n obj[key] = tryDecode(val, dec);\n }\n });\n\n return obj;\n}\n\nexport default { parse };\n","import { Document } from \"./documents\";\nimport { RequestHandler, RequestCallback } from './request';\nimport { ApiCache } from './cache';\nimport { Experiment, Experiments } from './experiments';\nimport { SearchForm, Form } from './form';\nimport Predicates from './Predicates';\nimport Cookies from './Cookies';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport HttpClient from './HttpClient';\nimport { Client } from './client';\n\nexport const PREVIEW_COOKIE = 'io.prismic.preview';\nexport const EXPERIMENT_COOKIE = 'io.prismic.experiment';\n\nexport interface Ref {\n ref: string;\n label: string;\n isMasterRef: boolean;\n scheduledAt: string;\n id: string;\n}\n\nexport interface ApiData {\n refs: Ref[];\n bookmarks: { [key: string]: string };\n types: { [key: string]: string };\n tags: string[];\n forms: { [key: string]: Form };\n experiments: any;\n oauth_initiate: string;\n oauth_token: string;\n version: string;\n licence: string;\n}\n\nexport interface PreviewResponse {\n mainDocument?: string;\n}\n\nexport interface QueryOptions {\n [key: string]: string | number | string[];\n}\n\nexport interface ResolvedApiOptions {\n req?: any;\n}\n\nexport default class ResolvedApi implements Client {\n data: ApiData;\n masterRef: Ref;\n experiments: Experiments;\n options: ResolvedApiOptions;\n httpClient: HttpClient;\n bookmarks: { [key: string]: string };\n refs: Ref[];\n tags: string[];\n types: { [key: string]: string };\n\n constructor(data: ApiData, httpClient: HttpClient, options: ResolvedApiOptions) {\n this.data = data;\n this.masterRef = data.refs.filter(ref => ref.isMasterRef)[0];\n this.experiments = new Experiments(data.experiments);\n this.bookmarks = data.bookmarks;\n this.httpClient = httpClient;\n this.options = options;\n this.refs = data.refs;\n this.tags = data.tags;\n this.types = data.types;\n }\n\n /**\n * Returns a useable form from its id, as described in the RESTful description of the API.\n * For instance: api.form(\"everything\") works on every repository (as \"everything\" exists by default)\n * You can then chain the calls: api.form(\"everything\").query('[[:d = at(document.id, \"UkL0gMuvzYUANCpf\")]]').ref(ref).submit()\n */\n form(formId: string): SearchForm | null {\n const form = this.data.forms[formId];\n if (form) {\n return new SearchForm(form, this.httpClient);\n }\n return null;\n }\n\n everything(): SearchForm {\n const f = this.form('everything');\n if (!f) throw new Error('Missing everything form');\n return f;\n }\n\n /**\n * The ID of the master ref on this prismic.io API.\n * Do not use like this: searchForm.ref(api.master()).\n * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.\n */\n master(): string {\n return this.masterRef.ref;\n }\n\n /**\n * Returns the ref ID for a given ref's label.\n * Do not use like this: searchForm.ref(api.ref(\"Future release label\")).\n * Instead, set your ref once in a variable, and call it when you need it; this will allow to change the ref you're viewing easily for your entire page.\n */\n ref(label: string): string | null {\n const ref = this.data.refs.filter(ref => ref.label === label)[0];\n return ref ? ref.ref : null;\n }\n\n currentExperiment(): Experiment | null {\n return this.experiments.current();\n }\n\n /**\n * Query the repository\n */\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb: RequestCallback = () => {}): Promise {\n const { options, callback } = typeof optionsOrCallback === 'function'\n ? { options: {} as QueryOptions, callback: optionsOrCallback }\n : { options: optionsOrCallback || {}, callback: cb };\n\n let form = this.everything();\n for (const key in options) {\n form = form.set(key, options[key]);\n }\n if (!options.ref) {\n // Look in cookies if we have a ref (preview or experiment)\n let cookieString = '';\n if (this.options.req) { // NodeJS\n cookieString = this.options.req.headers['cookie'] || '';\n } else if (typeof window !== 'undefined' && window.document) { // Browser\n cookieString = window.document.cookie || '';\n }\n const cookies = Cookies.parse(cookieString);\n const previewRef = cookies[PREVIEW_COOKIE];\n const experimentRef = this.experiments.refFromCookie(cookies[EXPERIMENT_COOKIE]);\n form = form.ref(previewRef || experimentRef || this.masterRef.ref);\n }\n if (q) {\n form.query(q);\n }\n return form.submit(callback);\n }\n\n /**\n * Retrieve the document returned by the given query\n * @param {string|array|Predicate} the query\n * @param {object} additional parameters. In NodeJS, pass the request as 'req'.\n * @param {function} callback(err, doc)\n */\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n const { options, callback } = typeof optionsOrCallback === 'function'\n ? { options: {} as QueryOptions, callback: optionsOrCallback }\n : { options: optionsOrCallback || {}, callback: cb || (() => {}) };\n\n options.page = 1;\n options.pageSize = 1;\n\n return this.query(q, options).then((response) => {\n const document = response && response.results && response.results[0];\n callback(null, document);\n return document;\n }).catch((error) => {\n callback(error);\n throw error;\n });\n }\n\n /**\n * Retrieve the document with the given id\n */\n getByID(id: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.queryFirst(Predicates.at('document.id', id), options, cb);\n }\n\n /**\n * Retrieve multiple documents from an array of id\n */\n getByIDs(ids: string[], maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if (!options.lang) options.lang = '*';\n return this.query(Predicates.in('document.id', ids), options, cb);\n }\n\n /**\n * Retrieve the document with the given uid\n */\n getByUID(type: string, uid: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n if(options.lang === \"*\") throw new Error(\"FORDIDDEN. You can't use getByUID with *, use the predicates instead.\")\n if(!options.page) options.page = 1;\n\n return this.queryFirst(Predicates.at(`my.${type}.uid`, uid), options, cb);\n }\n\n /**\n * Retrieve the singleton document with the given type\n */\n getSingle(type: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const options = maybeOptions || {};\n return this.queryFirst(Predicates.at('document.type', type), options, cb);\n }\n\n /**\n * Retrieve the document with the given bookmark\n */\n getBookmark(bookmark: string, maybeOptions?: QueryOptions, cb?: RequestCallback): Promise {\n const id = this.data.bookmarks[bookmark];\n if (id) {\n return this.getByID(id, maybeOptions, cb);\n } else {\n return Promise.reject('Error retrieving bookmarked id');\n }\n }\n\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise {\n return new Promise((resolve, reject) => {\n this.httpClient.request(token, (e, result) => {\n if (e) {\n cb && cb(e);\n reject(e);\n } else if (result) {\n if (!result.mainDocument) {\n cb && cb(null, defaultUrl);\n resolve(defaultUrl);\n } else {\n return this.getByID(result.mainDocument, { ref: token }).then((document) => {\n if (!document) {\n cb && cb(null, defaultUrl);\n resolve(defaultUrl);\n } else {\n const url = linkResolver(document);\n cb && cb(null, url);\n resolve(url);\n }\n }).catch(reject);\n }\n }\n });\n });\n }\n}\n","/**\n* A doubly linked list-based Least Recently Used (LRU) cache. Will keep most\n* recently used items while discarding least recently used items when its limit\n* is reached.\n*\n* Licensed under MIT. Copyright (c) 2010 Rasmus Andersson \n* Typescript-ified by Oleksandr Nikitin \n*\n* Illustration of the design:\n*\n* entry entry entry entry\n* ______ ______ ______ ______\n* | head |.newer => | |.newer => | |.newer => | tail |\n* | A | | B | | C | | D |\n* |______| <= older.|______| <= older.|______| <= older.|______|\n*\n* removed <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- <-- added\n*/\n\nexport function MakeLRUCache(limit: number): ILRUCache {\n return new (LRUCache)(limit);\n}\n\nexport interface ILRUCache {\n put(key: string, value: any): void;\n get(key: string, Entry: boolean): any;\n remove(key: String): void;\n removeAll(): void;\n}\n\nfunction LRUCache(limit: number) {\n // Current size of the cache. (Read-only).\n this.size = 0;\n // Maximum number of items this cache can hold.\n this.limit = limit;\n this._keymap = {};\n}\n\ninterface IEntry {\n newer?: IEntry;\n older?: IEntry;\n key: string;\n value: any;\n}\n\n/**\n * Put into the cache associated with . Returns the entry which was\n * removed to make room for the new entry. Otherwise undefined is returned\n * (i.e. if there was enough room already).\n */\nLRUCache.prototype.put = function (key: string, value: any) {\n var entry: IEntry = { key: key, value: value };\n // Note: No protection agains replacing, and thus orphan entries. By design.\n this._keymap[key] = entry;\n if (this.tail) {\n // link previous tail to the new tail (entry)\n this.tail.newer = entry;\n entry.older = this.tail;\n } else {\n // we're first in -- yay\n this.head = entry;\n }\n // add new entry to the end of the linked list -- it's now the freshest entry.\n this.tail = entry;\n if (this.size === this.limit) {\n // we hit the limit -- remove the head\n return this.shift();\n } else {\n // increase the size counter\n this.size++;\n }\n};\n\n/**\n * Purge the least recently used (oldest) entry from the cache. Returns the\n * removed entry or undefined if the cache was empty.\n *\n * If you need to perform any form of finalization of purged items, this is a\n * good place to do it. Simply override/replace this function:\n *\n * var c = new LRUCache(123);\n * c.shift = function() {\n * var entry = LRUCache.prototype.shift.call(this);\n * doSomethingWith(entry);\n * return entry;\n * }\n */\nLRUCache.prototype.shift = function () {\n // todo: handle special case when limit == 1\n var entry = this.head;\n if (entry) {\n if (this.head.newer) {\n this.head = this.head.newer;\n this.head.older = undefined;\n } else {\n this.head = undefined;\n }\n // Remove last strong reference to and remove links from the purged\n // entry being returned:\n entry.newer = entry.older = undefined;\n // delete is slow, but we need to do this to avoid uncontrollable growth:\n delete this._keymap[entry.key];\n }\n console.log('purging ', entry.key);\n return entry;\n};\n\n/**\n * Get and register recent use of . Returns the value associated with \n * or undefined if not in cache.\n */\nLRUCache.prototype.get = function (key: string, returnEntry: boolean): any {\n // First, find our cache entry\n var entry = this._keymap[key];\n if (entry === undefined) return; // Not cached. Sorry.\n // As was found in the cache, register it as being requested recently\n if (entry === this.tail) {\n // Already the most recently used entry, so no need to update the list\n return returnEntry ? entry : entry.value;\n }\n // HEAD--------------TAIL\n // <.older .newer>\n // <--- add direction --\n // A B C E\n if (entry.newer) {\n if (entry === this.head)\n this.head = entry.newer;\n entry.newer.older = entry.older; // C <-- E.\n }\n if (entry.older)\n entry.older.newer = entry.newer; // C. --> E\n entry.newer = undefined; // D --x\n entry.older = this.tail; // D. --> E\n if (this.tail)\n this.tail.newer = entry; // E. <-- D\n this.tail = entry;\n return returnEntry ? entry : entry.value;\n};\n\n// ----------------------------------------------------------------------------\n// Following code is optional and can be removed without breaking the core\n// functionality.\n\n/**\n * Check if is in the cache without registering recent use. Feasible if\n * you do not want to chage the state of the cache, but only \"peek\" at it.\n * Returns the entry associated with if found, or undefined if not found.\n */\nLRUCache.prototype.find = function (key: string) {\n return this._keymap[key];\n};\n\n/**\n * Update the value of entry with . Returns the old value, or undefined if\n * entry was not in the cache.\n */\nLRUCache.prototype.set = function (key: string, value: any) {\n var oldvalue: any;\n var entry = this.get(key, true);\n if (entry) {\n oldvalue = entry.value;\n entry.value = value;\n } else {\n oldvalue = this.put(key, value);\n if (oldvalue) oldvalue = oldvalue.value;\n }\n return oldvalue;\n};\n\n/**\n * Remove entry from cache and return its value. Returns undefined if not\n * found.\n */\nLRUCache.prototype.remove = function (key: string) {\n var entry = this._keymap[key];\n if (!entry) return;\n delete this._keymap[entry.key]; // need to do delete unfortunately\n if (entry.newer && entry.older) {\n // relink the older entry with the newer entry\n entry.older.newer = entry.newer;\n entry.newer.older = entry.older;\n } else if (entry.newer) {\n // remove the link to us\n entry.newer.older = undefined;\n // link the newer entry to head\n this.head = entry.newer;\n } else if (entry.older) {\n // remove the link to us\n entry.older.newer = undefined;\n // link the newer entry to head\n this.tail = entry.older;\n } else {// if(entry.older === undefined && entry.newer === undefined) {\n this.head = this.tail = undefined;\n }\n\n this.size--;\n return entry.value;\n};\n\n/** Removes all entries */\nLRUCache.prototype.removeAll = function () {\n // This should be safe, as we never expose strong refrences to the outside\n this.head = this.tail = undefined;\n this.size = 0;\n this._keymap = {};\n};\n\n/**\n * Return an array containing all keys of entries stored in the cache object, in\n * arbitrary order.\n */\nif (typeof Object.keys === 'function') {\n LRUCache.prototype.keys = function () { return Object.keys(this._keymap); };\n} else {\n LRUCache.prototype.keys = function () {\n var keys: string[] = [];\n for (var k in this._keymap) keys.push(k);\n return keys;\n };\n}\n\n/**\n * Call `fun` for each entry. Starting with the newest entry if `desc` is a true\n * value, otherwise starts with the oldest (head) enrty and moves towards the\n * tail.\n *\n * `fun` is called with 3 arguments in the context `context`:\n * `fun.call(context, Object key, Object value, LRUCache self)`\n */\nLRUCache.prototype.forEach = function (fun: Function, context: any, desc: boolean) {\n var entry: IEntry | undefined;\n if (context === true) { desc = true; context = undefined; }\n else if (typeof context !== 'object') context = this;\n if (desc) {\n entry = this.tail;\n while (entry) {\n fun.call(context, entry.key, entry.value, this);\n entry = entry.older;\n }\n } else {\n entry = this.head;\n while (entry) {\n fun.call(context, entry.key, entry.value, this);\n entry = entry.newer;\n }\n }\n};\n\n/** Returns a JSON (array) representation */\n//LRUCache.prototype.toJSON = function () {\n// var s: IEntry[] = [], entry = this.head;\n// while (entry) {\n// s.push({ key: entry.key.toJSON(), value: entry.value.toJSON() });\n// entry = entry.newer;\n// }\n// return s;\n//};\n\n/** Returns a String representation */\nLRUCache.prototype.toString = function () {\n var s = '', entry = this.head;\n while (entry) {\n s += String(entry.key) + ':' + entry.value;\n entry = entry.newer;\n if (entry)\n s += ' < ';\n }\n return s;\n};\n\n// Export ourselves\n//if (typeof this === 'object') this.LRUCache = LRUCache;","import { ILRUCache, MakeLRUCache } from './lru';\n\nexport interface ApiCache {\n isExpired(key: String): boolean;\n get(key: string, cb: (error: Error | null, entry?: T) => void): void;\n set(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void;\n remove(key: string, cb?: (error: Error | null) => void): void;\n clear(cb?: (error: Error | null) => void): void;\n}\n\nexport class DefaultApiCache implements ApiCache {\n lru: ILRUCache;\n\n constructor(limit: number = 1000) {\n this.lru = MakeLRUCache(limit);\n }\n\n isExpired(key: string): boolean {\n const value = this.lru.get(key, false);\n if (value) {\n return value.expiredIn !== 0 && value.expiredIn < Date.now();\n } else {\n return false;\n }\n }\n\n get(key: string, cb: (error: Error | null, entry?: T) => void): void {\n const value = this.lru.get(key, false);\n if (value && !this.isExpired(key)) {\n cb(null, value.data);\n } else {\n cb && cb(null);\n }\n }\n\n set(key: string, value: T, ttl: number, cb?: (error: Error | null) => void): void {\n this.lru.remove(key);\n this.lru.put(key, {\n data: value,\n expiredIn: ttl ? (Date.now() + (ttl * 1000)) : 0,\n });\n cb && cb(null);\n }\n\n remove(key: string, cb?: (error: Error | null) => void): void {\n this.lru.remove(key);\n cb && cb(null);\n }\n\n clear(cb?: (error: Error | null) => void): void {\n this.lru.removeAll();\n cb && cb(null);\n }\n}\n","interface Task {\n url: string;\n callback: RequestCallback;\n}\n\ninterface NodeRequestInit extends RequestInit {\n agent?: any;\n}\n\nfunction fetchRequest(url: string, options: RequestHandlerOption, callback: RequestCallback): void {\n\n const fetchOptions = {\n headers: {\n Accept: 'application/json',\n },\n } as NodeRequestInit;\n\n if (options && options.proxyAgent) {\n fetchOptions.agent = options.proxyAgent;\n }\n\n fetch(url, fetchOptions).then((xhr) => {\n if (~~(xhr.status / 100 !== 2)) {\n /**\n * @description\n * drain the xhr before throwing an error to prevent memory leaks\n * @link https://github.com/bitinn/node-fetch/issues/83\n */\n return xhr.text().then(() => {\n const e: any = new Error(`Unexpected status code [${xhr.status}] on URL ${url}`);\n e.status = xhr.status;\n throw e;\n });\n }\n\n return xhr.json().then((result) => {\n const cacheControl = xhr.headers.get('cache-control');\n const parsedCacheControl = cacheControl ? /max-age=(\\d+)/.exec(cacheControl) : null;\n const ttl = parsedCacheControl ? parseInt(parsedCacheControl[1], 10) : undefined;\n\n callback(null, result, xhr, ttl);\n });\n }).catch(callback);\n}\n\nexport type RequestCallback = (error: Error | null, result?: T | null, xhr?: any, ttl?: number) => void;\n\nexport interface RequestHandlerOption {\n proxyAgent?: any;\n}\n\nexport interface RequestHandler {\n request(url: string, cb: RequestCallback): void;\n}\n\nexport class DefaultRequestHandler implements RequestHandler {\n\n options: RequestHandlerOption;\n\n constructor(options?: RequestHandlerOption) {\n this.options = options || {};\n }\n\n request(url: string, callback: RequestCallback): void {\n\n fetchRequest(url, this.options, callback);\n }\n}\n","import { ApiCache, DefaultApiCache } from './cache';\nimport { RequestHandler, DefaultRequestHandler, RequestCallback } from './request';\n\nexport interface HttpClientOptions {\n ttl?: number;\n cacheKey?: string;\n}\n\nexport default class HttpClient {\n\n private cache: ApiCache;\n private requestHandler: RequestHandler;\n\n constructor(requestHandler?: RequestHandler, cache?: ApiCache, proxyAgent?: any) {\n this.requestHandler = requestHandler || new DefaultRequestHandler({ proxyAgent });\n this.cache = cache || new DefaultApiCache();\n }\n\n request(url: string, callback?: RequestCallback): void {\n this.requestHandler.request(url, (err, result, xhr, ttl) => {\n if (err) {\n callback && callback(err, null, xhr, ttl);\n } else if (result) {\n callback && callback(null, result, xhr, ttl);\n }\n });\n }\n\n /**\n * Fetch a URL corresponding to a query, and parse the response as a Response object\n */\n cachedRequest(url: string, maybeOptions?: HttpClientOptions): Promise {\n const options = maybeOptions || {};\n const run = (cb: RequestCallback) => {\n const cacheKey = options.cacheKey || url;\n this.cache.get(cacheKey, (cacheGetError, cacheGetValue) => {\n if (cacheGetError || cacheGetValue) {\n cb(cacheGetError, cacheGetValue);\n } else {\n this.request(url, (fetchError, fetchValue, xhr, ttlReq) => {\n if (fetchError) {\n cb(fetchError, null);\n } else {\n const ttl = ttlReq || options.ttl;\n if (ttl) {\n this.cache.set(cacheKey, fetchValue, ttl, cb);\n }\n cb(null, fetchValue);\n }\n });\n }\n });\n };\n\n return new Promise((resolve, reject) => {\n run((err, value) => {\n if (err) reject(err);\n if (value) resolve(value);\n });\n });\n }\n}\n","import Predicates from './Predicates';\nimport { RequestHandler, RequestCallback } from './request';\nimport { Document } from './documents';\nimport { ApiCache } from './cache';\nimport ResolvedApi, { ApiData } from './ResolvedApi';\nimport HttpClient from './HttpClient';\n\nexport interface ApiOptions {\n accessToken?: string;\n requestHandler?: RequestHandler;\n req?: any;\n apiCache?: ApiCache;\n apiDataTTL?: number;\n proxyAgent?: any;\n}\n\nexport default class Api {\n url: string;\n options: ApiOptions;\n apiDataTTL: number;\n httpClient: HttpClient;\n\n constructor(url: string, options?: ApiOptions) {\n this.options = options || {};\n this.url = url;\n if (this.options.accessToken) {\n const accessTokenParam = `access_token=${this.options.accessToken}`;\n this.url += (url.indexOf('?') > -1 ? '&' : '?') + accessTokenParam;\n }\n this.apiDataTTL = this.options.apiDataTTL || 5;\n this.httpClient = new HttpClient(\n this.options.requestHandler,\n this.options.apiCache,\n this.options.proxyAgent,\n );\n }\n\n /**\n * Fetches data used to construct the api client, from cache if it's\n * present, otherwise from calling the prismic api endpoint (which is\n * then cached).\n */\n get(cb?: RequestCallback): Promise {\n return this.httpClient.cachedRequest(this.url, { ttl: this.apiDataTTL }).then((data) => {\n const resolvedApi = new ResolvedApi(data, this.httpClient, this.options);\n cb && cb(null, resolvedApi);\n return resolvedApi;\n }).catch((error) => {\n cb && cb(error);\n throw error;\n });\n }\n}\n","import { Document } from \"./documents\";\nimport ResolvedApi, { QueryOptions, EXPERIMENT_COOKIE, PREVIEW_COOKIE } from './ResolvedApi';\nimport ApiSearchResponse from './ApiSearchResponse';\nimport { SearchForm, LazySearchForm } from './form';\nimport { Experiment } from './experiments';\nimport { RequestHandler, RequestCallback } from './request';\nimport Api, { ApiOptions } from './Api';\n\nexport interface Client {\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise;\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb: RequestCallback): Promise;\n getByID(id: string, options: QueryOptions, cb: RequestCallback): Promise;\n getByIDs(ids: string[], options: QueryOptions, cb: RequestCallback): Promise;\n getByUID(type: string, uid: string, options: QueryOptions, cb: RequestCallback): Promise;\n getSingle(type: string, options: QueryOptions, cb: RequestCallback): Promise;\n getBookmark(bookmark: string, options: QueryOptions, cb: RequestCallback): Promise;\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise;\n}\n\nexport class DefaultClient implements Client {\n\n api: Api;\n resolvedApi: ResolvedApi;\n\n constructor(url: string, options?: ApiOptions) {\n this.api = new Api(url, options);\n }\n\n getApi(): Promise {\n return this.api.get();\n }\n\n everything(): LazySearchForm {\n return this.form('everything');\n }\n\n form(formId: string): LazySearchForm {\n return new LazySearchForm(formId, this.api);\n }\n\n query(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.query(q, optionsOrCallback, cb));\n }\n\n queryFirst(q: string | string[], optionsOrCallback: QueryOptions | RequestCallback, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.queryFirst(q, optionsOrCallback, cb));\n }\n\n getByID(id: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByID(id, options, cb));\n }\n\n getByIDs(ids: string[], options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByIDs(ids, options, cb));\n }\n\n getByUID(type: string, uid: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getByUID(type, uid, options, cb));\n }\n\n getSingle(type: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getSingle(type, options, cb));\n }\n\n getBookmark(bookmark: string, options: QueryOptions, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.getBookmark(bookmark, options, cb));\n }\n\n previewSession(token: string, linkResolver: (doc: any) => string, defaultUrl: string, cb?: RequestCallback): Promise {\n return this.getApi().then(api => api.previewSession(token, linkResolver, defaultUrl, cb));\n }\n\n static getApi(url: string, options?: ApiOptions): Promise {\n const api = new Api(url, options);\n return api.get();\n }\n}\n","import ResolvedApi, { EXPERIMENT_COOKIE as experimentCookie, PREVIEW_COOKIE as previewCookie } from './ResolvedApi';\nimport Predicates from './Predicates';\nimport { Experiments } from './experiments';\nimport Api, { ApiOptions } from './Api';\nimport { DefaultClient } from './client';\n\nexport {\n experimentCookie,\n previewCookie,\n Predicates,\n Experiments,\n Api\n};\n\nexport function client(url: string, options?: ApiOptions): DefaultClient {\n return new DefaultClient(url, options);\n}\n\nexport function getApi(url: string, options?: ApiOptions): Promise {\n return DefaultClient.getApi(url, options);\n}\n\nexport function api(url: string, options?: ApiOptions): Promise {\n return getApi(url, options);\n}"],"names":[],"mappings":"AAAO;IAGL,mBAAY,IAAS;QAFrB,SAAI,GAAQ,EAAE,CAAC;QAGb,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;KAClB;IAED,sBAAE,GAAF;QACE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AClB;IACH,oBAAC;CAAA,IAAA;;SC9De,MAAM,CAAC,GAAW,EAAE,OAAoB;IACtD,OAAO,IAAI,aAAa,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;CACxC;AAED,SAAgB,MAAM,CAAC,GAAW,EAAE,OAAoB;IACtD,OAAO,aAAa,CAAC,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;CAC3C;AAED,SAAgB,GAAG,CAAC,GAAW,EAAE,OAAoB;IACnD,OAAO,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;CAC7B;;;;"} \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index ee6ef86a..498cf92e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4,6 +4,26 @@ "lockfileVersion": 1, "requires": true, "dependencies": { + "@babel/code-frame": { + "version": "7.5.5", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.5.5.tgz", + "integrity": "sha512-27d4lZoomVyo51VegxI20xZPuSHusqbQag/ztrBC7wegWoQ1nLREPVSKSW8byhTlzTKyNE4ifaTA6lCp7JjpFw==", + "dev": true, + "requires": { + "@babel/highlight": "^7.0.0" + } + }, + "@babel/highlight": { + "version": "7.5.0", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.5.0.tgz", + "integrity": "sha512-7dV4eu9gBxoM0dAnj/BCFDW9LFU0zvTrkq0ugM7pnHEgguOEeOz1so2ZghEdzviYzQEED0r4EAgpsBChKy1TRQ==", + "dev": true, + "requires": { + "chalk": "^2.0.0", + "esutils": "^2.0.2", + "js-tokens": "^4.0.0" + } + }, "@fimbul/bifrost": { "version": "0.15.0", "resolved": "https://registry.npmjs.org/@fimbul/bifrost/-/bifrost-0.15.0.tgz", @@ -58,6 +78,12 @@ } } }, + "@types/estree": { + "version": "0.0.39", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.39.tgz", + "integrity": "sha512-EYNwp3bU+98cpU4lAWYYL7Zz+2gryWH1qbdDTidVd6hkiR6weksdbMadyXKXNPEkQFhXM+hVO9ZygomHXp+AIw==", + "dev": true + }, "@types/events": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/@types/events/-/events-3.0.0.tgz", @@ -100,9 +126,9 @@ "dev": true }, "@types/lodash": { - "version": "4.14.136", - "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.136.tgz", - "integrity": "sha512-0GJhzBdvsW2RUccNHOBkabI8HZVdOXmXbXhuKlDEd5Vv12P7oAVGfomGp3Ne21o5D/qu1WmthlNKFaoZJJeErA==", + "version": "4.14.144", + "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.14.144.tgz", + "integrity": "sha512-ogI4g9W5qIQQUhXAclq6zhqgqNUr7UlFaqDHbch7WLSLeeM/7d3CRaw7GLajxvyFvhJqw4Rpcz5bhoaYtIx6Tg==", "dev": true }, "@types/marked": { @@ -120,8 +146,15 @@ "@types/node": { "version": "12.6.3", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.6.3.tgz", - "integrity": "sha512-7TEYTQT1/6PP53NftXXabIZDaZfaoBdeBm8Md/i7zsWRoBe0YwOXguyK8vhHs8ehgB/w9U4K/6EWuTyp0W6nIA==", - "dev": true + "integrity": "sha512-7TEYTQT1/6PP53NftXXabIZDaZfaoBdeBm8Md/i7zsWRoBe0YwOXguyK8vhHs8ehgB/w9U4K/6EWuTyp0W6nIA==" + }, + "@types/node-fetch": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.2.tgz", + "integrity": "sha512-djYYKmdNRSBtL1x4CiE9UJb9yZhwtI1VC+UxZD0psNznrUj80ywsxKlEGAE+QL1qvLjPbfb24VosjkYM6W4RSQ==", + "requires": { + "@types/node": "*" + } }, "@types/shelljs": { "version": "0.8.5", @@ -133,4177 +166,715 @@ "@types/node": "*" } }, - "@webassemblyjs/ast": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ast/-/ast-1.5.12.tgz", - "integrity": "sha512-bmTBEKuuhSU6dC95QIW250xO769cdYGx9rWn3uBLTw2pUpud0Z5kVuMw9m9fqbNzGeuOU2HpyuZa+yUt2CTEDA==", + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", "dev": true, "requires": { - "@webassemblyjs/helper-module-context": "1.5.12", - "@webassemblyjs/helper-wasm-bytecode": "1.5.12", - "@webassemblyjs/wast-parser": "1.5.12", - "debug": "^3.1.0", - "mamacro": "^0.0.3" + "color-convert": "^1.9.0" } }, - "@webassemblyjs/floating-point-hex-parser": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/floating-point-hex-parser/-/floating-point-hex-parser-1.5.12.tgz", - "integrity": "sha512-epTvkdwOIPpTE9edHS+V+shetYzpTbd91XOzUli1zAS0+NSgSe6ZsNggIqUNzhma1s4bN2f/m8c6B1NMdCERAg==", - "dev": true - }, - "@webassemblyjs/helper-api-error": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-api-error/-/helper-api-error-1.5.12.tgz", - "integrity": "sha512-Goxag86JvLq8ucHLXFNSLYzf9wrR+CJr37DsESTAzSnGoqDTgw5eqiXSQVd/D9Biih7+DIn8UIQCxMs8emRRwg==", - "dev": true - }, - "@webassemblyjs/helper-buffer": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-buffer/-/helper-buffer-1.5.12.tgz", - "integrity": "sha512-tJNUjttL5CxiiS/KLxT4/Zk0Nbl/poFhztFxktb46zoQEUWaGHR9ZJ0SnvE7DbFX5PY5JNJDMZ0Li4lm246fWw==", + "argparse": { + "version": "1.0.10", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", + "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", "dev": true, "requires": { - "debug": "^3.1.0" + "sprintf-js": "~1.0.2" } }, - "@webassemblyjs/helper-code-frame": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-code-frame/-/helper-code-frame-1.5.12.tgz", - "integrity": "sha512-0FrJgiST+MQDMvPigzs+UIk1vslLIqGadkEWdn53Lr0NsUC2JbheG9QaO3Zf6ycK2JwsHiUpGaMFcHYXStTPMA==", - "dev": true, - "requires": { - "@webassemblyjs/wast-printer": "1.5.12" - } + "assertion-error": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", + "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", + "dev": true }, - "@webassemblyjs/helper-fsm": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-fsm/-/helper-fsm-1.5.12.tgz", - "integrity": "sha512-QBHZ45VPUJ7UyYKvUFoaxrSS9H5hbkC9U7tdWgFHmnTMutkXSEgDg2gZg3I/QTsiKOCIwx4qJUJwPd7J4D5CNQ==", + "balanced-match": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", + "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", "dev": true }, - "@webassemblyjs/helper-module-context": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-module-context/-/helper-module-context-1.5.12.tgz", - "integrity": "sha512-SCXR8hPI4JOG3cdy9HAO8W5/VQ68YXG/Hfs7qDf1cd64zWuMNshyEour5NYnLMVkrrtc0XzfVS/MdeV94woFHA==", + "brace-expansion": { + "version": "1.1.8", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", + "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", "dev": true, "requires": { - "debug": "^3.1.0", - "mamacro": "^0.0.3" + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" } }, - "@webassemblyjs/helper-wasm-bytecode": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-bytecode/-/helper-wasm-bytecode-1.5.12.tgz", - "integrity": "sha512-0Gz5lQcyvElNVbOTKwjEmIxGwdWf+zpAW/WGzGo95B7IgMEzyyfZU+PrGHDwiSH9c0knol9G7smQnY0ljrSA6g==", + "browser-stdout": { + "version": "1.3.1", + "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", + "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", "dev": true }, - "@webassemblyjs/helper-wasm-section": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/helper-wasm-section/-/helper-wasm-section-1.5.12.tgz", - "integrity": "sha512-ge/CKVKBGpiJhFN9PIOQ7sPtGYJhxm/mW1Y3SpG1L6XBunfRz0YnLjW3TmhcOEFozIVyODPS1HZ9f7VR3GBGow==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.12", - "@webassemblyjs/helper-buffer": "1.5.12", - "@webassemblyjs/helper-wasm-bytecode": "1.5.12", - "@webassemblyjs/wasm-gen": "1.5.12", - "debug": "^3.1.0" - } + "buffer-from": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", + "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", + "dev": true + }, + "builtin-modules": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-2.0.0.tgz", + "integrity": "sha512-3U5kUA5VPsRUA3nofm/BXX7GVHKfxz0hOBAPxXrIvHzlDRkQVqEn6yi8QJegxl4LzOHLdvb7XF5dVawa/VVYBg==", + "dev": true }, - "@webassemblyjs/ieee754": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/ieee754/-/ieee754-1.5.12.tgz", - "integrity": "sha512-F+PEv9QBzPi1ThLBouUJbuxhEr+Sy/oua1ftXFKHiaYYS5Z9tKPvK/hgCxlSdq+RY4MSG15jU2JYb/K5pkoybg==", + "chai": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", + "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", "dev": true, "requires": { - "ieee754": "^1.1.11" + "assertion-error": "^1.1.0", + "check-error": "^1.0.2", + "deep-eql": "^3.0.1", + "get-func-name": "^2.0.0", + "pathval": "^1.1.0", + "type-detect": "^4.0.5" } }, - "@webassemblyjs/leb128": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/leb128/-/leb128-1.5.12.tgz", - "integrity": "sha512-cCOx/LVGiWyCwVrVlvGmTdnwHzIP4+zflLjGkZxWpYCpdNax9krVIJh1Pm7O86Ox/c5PrJpbvZU1cZLxndlPEw==", + "chalk": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", + "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", "dev": true, "requires": { - "leb": "^0.3.0" + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" } }, - "@webassemblyjs/utf8": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/utf8/-/utf8-1.5.12.tgz", - "integrity": "sha512-FX8NYQMiTRU0TfK/tJVntsi9IEKsedSsna8qtsndWVE0x3zLndugiApxdNMIOoElBV9o4j0BUqR+iwU58QfPxQ==", + "check-error": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", + "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", "dev": true }, - "@webassemblyjs/wasm-edit": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-edit/-/wasm-edit-1.5.12.tgz", - "integrity": "sha512-r/oZAyC4EZl0ToOYJgvj+b0X6gVEKQMLT34pNNbtvWBehQOnaSXvVUA5FIYlH8ubWjFNAFqYaVGgQTjR1yuJdQ==", + "color-convert": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", + "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.5.12", - "@webassemblyjs/helper-buffer": "1.5.12", - "@webassemblyjs/helper-wasm-bytecode": "1.5.12", - "@webassemblyjs/helper-wasm-section": "1.5.12", - "@webassemblyjs/wasm-gen": "1.5.12", - "@webassemblyjs/wasm-opt": "1.5.12", - "@webassemblyjs/wasm-parser": "1.5.12", - "@webassemblyjs/wast-printer": "1.5.12", - "debug": "^3.1.0" + "color-name": "1.1.1" } }, - "@webassemblyjs/wasm-gen": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-gen/-/wasm-gen-1.5.12.tgz", - "integrity": "sha512-LTu+cr1YRxGGiVIXWhei/35lXXEwTnQU18x4V/gE+qCSJN21QcVTMjJuasTUh8WtmBZtOlqJbOQIeN7fGnHWhg==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.12", - "@webassemblyjs/helper-wasm-bytecode": "1.5.12", - "@webassemblyjs/ieee754": "1.5.12", - "@webassemblyjs/leb128": "1.5.12", - "@webassemblyjs/utf8": "1.5.12" - } + "color-name": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", + "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=", + "dev": true }, - "@webassemblyjs/wasm-opt": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-opt/-/wasm-opt-1.5.12.tgz", - "integrity": "sha512-LBwG5KPA9u/uigZVyTsDpS3CVxx3AePCnTItVL+OPkRCp5LqmLsOp4a3/c5CQE0Lecm0Ss9hjUTDcbYFZkXlfQ==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.12", - "@webassemblyjs/helper-buffer": "1.5.12", - "@webassemblyjs/wasm-gen": "1.5.12", - "@webassemblyjs/wasm-parser": "1.5.12", - "debug": "^3.1.0" - } + "commander": { + "version": "2.20.3", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.3.tgz", + "integrity": "sha512-GpVkmM8vF2vQUkj2LvZmD35JxeJOLCwJ9cUkugyk2nuhbv3+mJvpLYYt+0+USMxE+oj+ey/lJEnhZw75x/OMcQ==", + "dev": true }, - "@webassemblyjs/wasm-parser": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wasm-parser/-/wasm-parser-1.5.12.tgz", - "integrity": "sha512-xset3+1AtoFYEfMg30nzCGBnhKmTBzbIKvMyLhqJT06TvYV+kA884AOUpUvhSmP6XPF3G+HVZPm/PbCGxH4/VQ==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.12", - "@webassemblyjs/helper-api-error": "1.5.12", - "@webassemblyjs/helper-wasm-bytecode": "1.5.12", - "@webassemblyjs/ieee754": "1.5.12", - "@webassemblyjs/leb128": "1.5.12", - "@webassemblyjs/utf8": "1.5.12" - } + "compare-versions": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-2.0.1.tgz", + "integrity": "sha1-Htwfk2h/2XoyXFn1XkWgfbEGrKY=", + "dev": true + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", + "dev": true + }, + "core-util-is": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", + "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", + "dev": true }, - "@webassemblyjs/wast-parser": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-parser/-/wast-parser-1.5.12.tgz", - "integrity": "sha512-QWUtzhvfY7Ue9GlJ3HeOB6w5g9vNYUUnG+Y96TWPkFHJTxZlcvGfNrUoACCw6eDb9gKaHrjt77aPq41a7y8svg==", + "debug": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", + "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.5.12", - "@webassemblyjs/floating-point-hex-parser": "1.5.12", - "@webassemblyjs/helper-api-error": "1.5.12", - "@webassemblyjs/helper-code-frame": "1.5.12", - "@webassemblyjs/helper-fsm": "1.5.12", - "long": "^3.2.0", - "mamacro": "^0.0.3" + "ms": "2.0.0" } }, - "@webassemblyjs/wast-printer": { - "version": "1.5.12", - "resolved": "https://registry.npmjs.org/@webassemblyjs/wast-printer/-/wast-printer-1.5.12.tgz", - "integrity": "sha512-XF9RTeckFgDyl196uRKZWHFFfbkzsMK96QTXp+TC0R9gsV9DMiDGMSIllgy/WdrZ3y3dsQp4fTA5r4GoaOBchA==", + "deep-eql": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", + "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", "dev": true, "requires": { - "@webassemblyjs/ast": "1.5.12", - "@webassemblyjs/wast-parser": "1.5.12", - "long": "^3.2.0" + "type-detect": "^4.0.0" } }, - "acorn": { - "version": "5.7.1", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-5.7.1.tgz", - "integrity": "sha512-d+nbxBUGKg7Arpsvbnlq61mc12ek3EY8EQldM3GPAhWJ1UVxC6TDGbIvUMNU6obBX3i1+ptCIzV4vq0gFPEGVQ==", + "diff": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/diff/-/diff-4.0.1.tgz", + "integrity": "sha512-s2+XdvhPCOF01LRQBC8hf4vhbVmI2CGS5aZnxLJlT5FtdhPCDFq80q++zK2KlrVorVDdL5BOGZ/VfLrVtYNF+Q==", "dev": true }, - "acorn-dynamic-import": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/acorn-dynamic-import/-/acorn-dynamic-import-3.0.0.tgz", - "integrity": "sha512-zVWV8Z8lislJoOKKqdNMOB+s6+XV5WERty8MnKBeFgwA+19XJjJHs2RP5dzM57FftIs+jQnRToLiWazKr6sSWg==", - "dev": true, - "requires": { - "acorn": "^5.0.0" - } - }, - "ajv": { - "version": "6.5.1", - "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.5.1.tgz", - "integrity": "sha512-pgZos1vgOHDiC7gKNbZW8eKvCnNXARv2oqrGQT7Hzbq5Azp7aZG6DJzADnkuSq7RH6qkXp4J/m68yPX/2uBHyQ==", + "doctrine": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz", + "integrity": "sha1-fLhgNZujvpDgQLJrcpzkv6ZUxSM=", "dev": true, "requires": { - "fast-deep-equal": "^2.0.1", - "fast-json-stable-stringify": "^2.0.0", - "json-schema-traverse": "^0.4.1", - "uri-js": "^4.2.1" + "esutils": "^1.1.6", + "isarray": "0.0.1" + }, + "dependencies": { + "esutils": { + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", + "integrity": "sha1-wBzKqa5LiXxtDD4hCuUvPHqEQ3U=", + "dev": true + }, + "isarray": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", + "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "dev": true + } } }, - "ajv-keywords": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/ajv-keywords/-/ajv-keywords-3.2.0.tgz", - "integrity": "sha1-6GuBnGAs+IIa1jdBNpjx3sAhhHo=", + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", "dev": true }, - "ansi-escapes": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-3.1.0.tgz", - "integrity": "sha512-UgAb8H9D41AQnu/PbWlCofQVcnV4Gs2bBJi9eZPxfU/hgglFh3SMDMENRIqdr7H6XFnXdoknctFByVsCOotTVw==", + "esprima": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", "dev": true }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", + "estree-walker": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.6.1.tgz", + "integrity": "sha512-SqmZANLWS0mnatqbSfRP5g8OXZC12Fgg1IwNtLsyHDzJizORW4khDfjPqJZsemPWBB2uqykUah5YpQ6epsqC/w==", "dev": true }, - "ansi-styles": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", - "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, - "requires": { - "color-convert": "^1.9.0" - } + "esutils": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.3.tgz", + "integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g==", + "dev": true }, - "anymatch": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-2.0.0.tgz", - "integrity": "sha512-5teOsQWABXHHBFP9y3skS5P3d/WfWXpv3FUpy+LorMrNYaT9pI4oLMQX7jzQ2KklNpGpWHzdCXTDT2Y3XGlZBw==", + "fs-extra": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", + "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", "dev": true, "requires": { - "micromatch": "^3.1.4", - "normalize-path": "^2.1.1" + "graceful-fs": "^4.1.2", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" } }, - "aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", "dev": true }, - "arr-diff": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", - "integrity": "sha1-1kYQdP6/7HHn4VI1dhoyml3HxSA=", + "get-func-name": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", + "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", "dev": true }, - "arr-flatten": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/arr-flatten/-/arr-flatten-1.1.0.tgz", - "integrity": "sha1-NgSLv/TntH4TZkQxbJlmnqWukfE=", - "dev": true + "glob": { + "version": "7.1.2", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", + "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", + "dev": true, + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.0.4", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + } }, - "arr-union": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/arr-union/-/arr-union-3.1.0.tgz", - "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", + "graceful-fs": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.2.3.tgz", + "integrity": "sha512-a30VEBm4PEdx1dRB7MFK7BejejvCvBronbLjht+sHuGYj8PHs7M/5Z+rt5lw551vZ7yfTCj4Vuyy3mSJytDWRQ==", "dev": true }, - "array-unique": { - "version": "0.3.2", - "resolved": "https://registry.npmjs.org/array-unique/-/array-unique-0.3.2.tgz", - "integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=", + "growl": { + "version": "1.10.5", + "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", + "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", "dev": true }, - "asn1.js": { - "version": "4.10.1", - "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", - "integrity": "sha512-p32cOF5q0Zqs9uBiONKYLm6BClCoBCM5O9JfeUSlnQLBTxYdTK+pW+nXflm8UkKd2UYlEbYz5qEi0JuZR9ckSw==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "assert": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/assert/-/assert-1.4.1.tgz", - "integrity": "sha1-mZEtWRg2tab1s0XA8H7vwI/GXZE=", + "handlebars": { + "version": "4.5.1", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.5.1.tgz", + "integrity": "sha512-C29UoFzHe9yM61lOsIlCE5/mQVGrnIOrOq7maQl76L7tYPCgC1og0Ajt6uWnX4ZTxBPnjw+CUvawphwCfJgUnA==", "dev": true, "requires": { - "util": "0.10.3" + "neo-async": "^2.6.0", + "optimist": "^0.6.1", + "source-map": "^0.6.1", + "uglify-js": "^3.1.4" }, "dependencies": { - "inherits": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz", - "integrity": "sha1-sX0I0ya0Qj5Wjv9xn5GwscvfafE=", + "neo-async": { + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", + "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", "dev": true }, - "util": { - "version": "0.10.3", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz", - "integrity": "sha1-evsa/lCAUkZInj23/g7TeTNqwPk=", - "dev": true, - "requires": { - "inherits": "2.0.1" - } + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true } } }, - "assertion-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.0.2.tgz", - "integrity": "sha1-E8pRXYYgbaC6xm6DTdOX2HWBCUw=", - "dev": true - }, - "assign-symbols": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", - "integrity": "sha1-WWZ/QfrdTyDMvCu5a41Pf3jsA2c=", + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", "dev": true }, - "async-each": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz", - "integrity": "sha1-GdOGodntxufByF04iu28xW0zYC0=", + "he": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", + "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", "dev": true }, - "atob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.1.tgz", - "integrity": "sha1-ri1acpR38onWDdf5amMUoi3Wwio=", + "highlight.js": { + "version": "9.15.10", + "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.15.10.tgz", + "integrity": "sha512-RoV7OkQm0T3os3Dd2VHLNMoaoDVx77Wygln3n9l5YV172XonWG6rgQD3XnF/BuFFZw9A0TJgmMSO8FEWQgvcXw==", "dev": true }, - "babel-code-frame": { - "version": "6.22.0", - "resolved": "https://registry.npmjs.org/babel-code-frame/-/babel-code-frame-6.22.0.tgz", - "integrity": "sha1-AnYgvuVnqIwyVhV05/0IAdMxGOQ=", + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", "dev": true, "requires": { - "chalk": "^1.1.0", - "esutils": "^2.0.2", - "js-tokens": "^3.0.0" - }, - "dependencies": { - "ansi-styles": { - "version": "2.2.1", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-2.2.1.tgz", - "integrity": "sha1-tDLdM1i2NM914eRmQ2gkBTPB3b4=", - "dev": true - }, - "chalk": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-1.1.3.tgz", - "integrity": "sha1-qBFcVeSnAv5NFQq9OHKCKn4J/Jg=", - "dev": true, - "requires": { - "ansi-styles": "^2.2.1", - "escape-string-regexp": "^1.0.2", - "has-ansi": "^2.0.0", - "strip-ansi": "^3.0.0", - "supports-color": "^2.0.0" - } - }, - "supports-color": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-2.0.0.tgz", - "integrity": "sha1-U10EXOa2Nj+kARcIRimZXp3zJMc=", - "dev": true - } + "once": "^1.3.0", + "wrappy": "1" } }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true - }, - "base": { - "version": "0.11.2", - "resolved": "https://registry.npmjs.org/base/-/base-0.11.2.tgz", - "integrity": "sha512-5T6P4xPgpp0YDFvSWwEZ4NoE3aM4QBQXDzmVbraCkFj8zHM+mba8SyqB5DbZWyR7mYHo6Y7BdQo3MoA4m0TeQg==", - "dev": true, - "requires": { - "cache-base": "^1.0.1", - "class-utils": "^0.3.5", - "component-emitter": "^1.2.1", - "define-property": "^1.0.0", - "isobject": "^3.0.1", - "mixin-deep": "^1.2.0", - "pascalcase": "^0.1.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, - "base64-js": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.3.0.tgz", - "integrity": "sha512-ccav/yGvoa80BQDljCxsmmQ3Xvx60/UpBIij5QN21W3wBi/hhIC9OoO+KLpu9IJTS9j4DRVJ3aDDF9cMSoa2lw==", + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", "dev": true }, - "big.js": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/big.js/-/big.js-3.2.0.tgz", - "integrity": "sha512-+hN/Zh2D08Mx65pZ/4g5bsmNiZUuChDiQfTUQ7qJr4/kuopCr88xZsAXv6mBoZEsUI4OuGHlX59qE94K2mMW8Q==", + "interpret": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.2.0.tgz", + "integrity": "sha512-mT34yGKMNceBQUoVn7iCDKDntA7SC6gycMAWzGx1z/CMCTV7b2AAtXlo3nRyHZ1FelRkQbQjprHSYGwzLtkVbw==", "dev": true }, - "binary-extensions": { - "version": "1.9.0", - "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.9.0.tgz", - "integrity": "sha1-ZlBsFs5vTWkopbPNajPKQelB43s=", + "inversify": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/inversify/-/inversify-5.0.1.tgz", + "integrity": "sha512-Ieh06s48WnEYGcqHepdsJUIJUXpwH5o5vodAX+DK2JA/gjy4EbEcQZxw+uFfzysmKjiLXGYwNG3qDZsKVMcINQ==", "dev": true }, - "bluebird": { - "version": "3.5.1", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.1.tgz", - "integrity": "sha512-MKiLiV+I1AA596t9w1sQJ8jkiSr5+ZKi0WKrYGUn6d1Fx+Ij4tIj+m2WMQSGczs5jZVxV339chE8iwk6F64wjA==", + "is-module": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", + "integrity": "sha1-Mlj7afeMFNW4FdZkM2tM/7ZEFZE=", "dev": true }, - "bn.js": { - "version": "4.11.8", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.11.8.tgz", - "integrity": "sha1-LN4J617jQfSEdGuwMJsyU7GxRC8=", + "isarray": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", + "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", "dev": true }, - "brace-expansion": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.8.tgz", - "integrity": "sha1-wHshHHyVLsH479Uad+8NHTmQopI=", - "dev": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "braces": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/braces/-/braces-2.3.2.tgz", - "integrity": "sha512-aNdbnj9P8PjdXU4ybaWLK2IF3jc/EoDYbC7AazW6to3TRsfXxscC9UXOB5iDiEQrkyIbWp2SLQda4+QAa7nc3w==", + "jest-worker": { + "version": "23.2.0", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-23.2.0.tgz", + "integrity": "sha1-+vcGqNo2+uYOsmlXJX+ntdjqArk=", "dev": true, "requires": { - "arr-flatten": "^1.1.0", - "array-unique": "^0.3.2", - "extend-shallow": "^2.0.1", - "fill-range": "^4.0.0", - "isobject": "^3.0.1", - "repeat-element": "^1.1.2", - "snapdragon": "^0.8.1", - "snapdragon-node": "^2.0.1", - "split-string": "^3.0.2", - "to-regex": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } + "merge-stream": "^1.0.1" } }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=", - "dev": true - }, - "browser-stdout": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/browser-stdout/-/browser-stdout-1.3.1.tgz", - "integrity": "sha512-qhAVI1+Av2X7qelOfAIYwXONood6XlZE/fXaBSmW/T5SzLAmCgzi+eiWE7fUvbHaeNBQH13UftjpXxsfLkMpgw==", + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", "dev": true }, - "browserify-aes": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/browserify-aes/-/browserify-aes-1.2.0.tgz", - "integrity": "sha512-+7CHXqGuspUn/Sl5aO7Ea0xWGAtETPXNSAjHo48JfLdPWcMng33Xe4znFvQweqc/uzk5zSOI3H52CYnjCfb5hA==", - "dev": true, - "requires": { - "buffer-xor": "^1.0.3", - "cipher-base": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.3", - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "browserify-cipher": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-cipher/-/browserify-cipher-1.0.1.tgz", - "integrity": "sha512-sPhkz0ARKbf4rRQt2hTpAHqn47X3llLkUGn+xEJzLjwY8LRs2p0v7ljvI5EyoRO/mexrNunNECisZs+gw2zz1w==", - "dev": true, - "requires": { - "browserify-aes": "^1.0.4", - "browserify-des": "^1.0.0", - "evp_bytestokey": "^1.0.0" - } - }, - "browserify-des": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/browserify-des/-/browserify-des-1.0.1.tgz", - "integrity": "sha512-zy0Cobe3hhgpiOM32Tj7KQ3Vl91m0njwsjzZQK1L+JDf11dzP9qIvjreVinsvXrgfjhStXwUWAEpB9D7Gwmayw==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "des.js": "^1.0.0", - "inherits": "^2.0.1" - } - }, - "browserify-rsa": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/browserify-rsa/-/browserify-rsa-4.0.1.tgz", - "integrity": "sha1-IeCr+vbyApzy+vsTNWenAdQTVSQ=", + "js-yaml": { + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "dev": true, "requires": { - "bn.js": "^4.1.0", - "randombytes": "^2.0.1" + "argparse": "^1.0.7", + "esprima": "^4.0.0" } }, - "browserify-sign": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/browserify-sign/-/browserify-sign-4.0.4.tgz", - "integrity": "sha1-qk62jl17ZYuqa/alfmMMvXqT0pg=", + "jsonfile": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", + "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", "dev": true, "requires": { - "bn.js": "^4.1.1", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.2", - "elliptic": "^6.0.0", - "inherits": "^2.0.1", - "parse-asn1": "^5.0.0" + "graceful-fs": "^4.1.6" } }, - "browserify-zlib": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/browserify-zlib/-/browserify-zlib-0.2.0.tgz", - "integrity": "sha512-Z942RysHXmJrhqk88FmKBVq/v5tqmSkDz7p54G/MGyjMnCFFnC79XWNbg+Vta8W6Wb2qtSZTSxIGkJrRpCFEiA==", - "dev": true, - "requires": { - "pako": "~1.0.5" - } + "lodash": { + "version": "4.17.15", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.15.tgz", + "integrity": "sha512-8xOcRHvCjnocdS5cpwXQXVzmmh5e5+saE2QGoeQmbKmRS6J3VQppPOIt0MnmE+4xlZoumy0GPG0D0MVIQbNA1A==", + "dev": true }, - "buffer": { - "version": "4.9.1", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-4.9.1.tgz", - "integrity": "sha1-bRu2AbB6TvztlwlBMgkwJ8lbwpg=", + "magic-string": { + "version": "0.25.4", + "resolved": "https://registry.npmjs.org/magic-string/-/magic-string-0.25.4.tgz", + "integrity": "sha512-oycWO9nEVAP2RVPbIoDoA4Y7LFIJ3xRYov93gAyJhZkET1tNuB0u7uWkZS2LpBWTJUWnmau/To8ECWRC+jKNfw==", "dev": true, "requires": { - "base64-js": "^1.0.2", - "ieee754": "^1.1.4", - "isarray": "^1.0.0" + "sourcemap-codec": "^1.4.4" } }, - "buffer-from": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.0.tgz", - "integrity": "sha512-c5mRlguI/Pe2dSZmpER62rSCu0ryKmWddzRYsuXc50U2/g8jMOulc31VZMa4mYx31U5xsmSOpDCgH88Vl9cDGQ==", - "dev": true - }, - "buffer-xor": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/buffer-xor/-/buffer-xor-1.0.3.tgz", - "integrity": "sha1-JuYe0UIvtw3ULm42cp7VHYVf6Nk=", - "dev": true - }, - "builtin-status-codes": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/builtin-status-codes/-/builtin-status-codes-3.0.0.tgz", - "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", + "marked": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.4.0.tgz", + "integrity": "sha512-tMsdNBgOsrUophCAFQl0XPe6Zqk/uy9gnue+jIIKhykO51hxyu6uNx7zBPy0+y/WKYVZZMspV9YeXLNdKk+iYw==", "dev": true }, - "cacache": { - "version": "10.0.4", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", - "integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==", - "dev": true, - "requires": { - "bluebird": "^3.5.1", - "chownr": "^1.0.1", - "glob": "^7.1.2", - "graceful-fs": "^4.1.11", - "lru-cache": "^4.1.1", - "mississippi": "^2.0.0", - "mkdirp": "^0.5.1", - "move-concurrently": "^1.0.1", - "promise-inflight": "^1.0.1", - "rimraf": "^2.6.2", - "ssri": "^5.2.4", - "unique-filename": "^1.1.0", - "y18n": "^4.0.0" - }, - "dependencies": { - "y18n": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.0.tgz", - "integrity": "sha512-r9S/ZyXu/Xu9q1tYlpsLIsa3EeLXXk0VwlxqTcFRfg9EhMW+17kbt9G0NrgCmhGb5vT2hyhJZLfDGx+7+5Uj/w==", - "dev": true - } - } - }, - "cache-base": { + "merge-stream": { "version": "1.0.1", - "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", - "integrity": "sha512-AKcdTnFSWATd5/GCPRxr2ChwIJ85CeyrEyjRHlKxQ56d4XJMGym0uAiKn0xbLOGOl3+yRpOTi484dVCEc5AUzQ==", - "dev": true, - "requires": { - "collection-visit": "^1.0.0", - "component-emitter": "^1.2.1", - "get-value": "^2.0.6", - "has-value": "^1.0.0", - "isobject": "^3.0.1", - "set-value": "^2.0.0", - "to-object-path": "^0.3.0", - "union-value": "^1.0.0", - "unset-value": "^1.0.0" - } - }, - "chai": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.1.1.tgz", - "integrity": "sha1-ZuISeebzxkFf+CMYeCJ5AOIXGzk=", - "dev": true, - "requires": { - "assertion-error": "^1.0.1", - "check-error": "^1.0.1", - "deep-eql": "^2.0.1", - "get-func-name": "^2.0.0", - "pathval": "^1.0.0", - "type-detect": "^4.0.0" - } - }, - "chalk": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.1.tgz", - "integrity": "sha512-ObN6h1v2fTJSmUXoS3nMQ92LbDK9be4TV+6G+omQlGJFdcUX5heKi1LZ1YnRMIgwTLEj3E24bT6tYni50rlCfQ==", + "resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-1.0.1.tgz", + "integrity": "sha1-QEEgLVCKNCugAXQAjfDCUbjBNeE=", "dev": true, "requires": { - "ansi-styles": "^3.2.1", - "escape-string-regexp": "^1.0.5", - "supports-color": "^5.3.0" + "readable-stream": "^2.0.1" } }, - "chardet": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.5.0.tgz", - "integrity": "sha512-9ZTaoBaePSCFvNlNGrsyI8ZVACP2svUtq0DkM7t4K2ClAa96sqOIRjAzDTc8zXzFt1cZR46rRzLTiHFSJ+Qw0g==", - "dev": true - }, - "check-error": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz", - "integrity": "sha1-V00xLt2Iu13YkS6Sht1sCu1KrII=", - "dev": true - }, - "chokidar": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-2.0.4.tgz", - "integrity": "sha512-z9n7yt9rOvIJrMhvDtDictKrkFHeihkNl6uWMmZlmL6tJtX9Cs+87oK+teBx+JIgzvbX3yZHT3eF8vpbDxHJXQ==", + "minimatch": { + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", + "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", "dev": true, "requires": { - "anymatch": "^2.0.0", - "async-each": "^1.0.0", - "braces": "^2.3.0", - "fsevents": "^1.2.2", - "glob-parent": "^3.1.0", - "inherits": "^2.0.1", - "is-binary-path": "^1.0.0", - "is-glob": "^4.0.0", - "lodash.debounce": "^4.0.8", - "normalize-path": "^2.1.1", - "path-is-absolute": "^1.0.0", - "readdirp": "^2.0.0", - "upath": "^1.0.5" - }, - "dependencies": { - "is-glob": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.1.tgz", - "integrity": "sha512-5G0tKtBTFImOqDnLB2hG6Bp2qcKEFduo4tZu9MT/H6NQv/ghhy30o55ufafxJ/LdH79LLs2Kfrn85TLKyA7BUg==", - "dev": true, - "requires": { - "is-extglob": "^2.1.1" - } - } + "brace-expansion": "^1.1.7" } }, - "chownr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.0.1.tgz", - "integrity": "sha1-4qdQQqlVGQi+vSW4Uj1fl2nXkYE=", + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", "dev": true }, - "chrome-trace-event": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/chrome-trace-event/-/chrome-trace-event-1.0.0.tgz", - "integrity": "sha512-xDbVgyfDTT2piup/h8dK/y4QZfJRSa73bw1WZ8b4XM1o7fsFubUVGYcE+1ANtOzJJELGpYoG2961z0Z6OAld9A==", + "mkdirp": { + "version": "0.5.1", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "dev": true, "requires": { - "tslib": "^1.9.0" + "minimist": "0.0.8" }, "dependencies": { - "tslib": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.2.tgz", - "integrity": "sha512-AVP5Xol3WivEr7hnssHDsaM+lVrVXWUvd1cfXTRkTj80b//6g2wIFEH6hZG0muGZRnHGrfttpdzRk3YlBkWjKw==", + "minimist": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", "dev": true } } }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha1-h2Dk7MJy9MNjUy+SbYdKriwTl94=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "class-utils": { - "version": "0.3.6", - "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", - "integrity": "sha512-qOhPa/Fj7s6TY8H8esGu5QNpMMQxz79h+urzrNYN6mn+9BnxlDGf5QZ+XeCDsxSjPqsSR56XOZOJmpeurnLMeg==", + "mocha": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", + "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", "dev": true, "requires": { - "arr-union": "^3.1.0", - "define-property": "^0.2.5", - "isobject": "^3.0.0", - "static-extend": "^0.1.1" + "browser-stdout": "1.3.1", + "commander": "2.15.1", + "debug": "3.1.0", + "diff": "3.5.0", + "escape-string-regexp": "1.0.5", + "glob": "7.1.2", + "growl": "1.10.5", + "he": "1.1.1", + "minimatch": "3.0.4", + "mkdirp": "0.5.1", + "supports-color": "5.4.0" }, "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "cli-cursor": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-2.1.0.tgz", - "integrity": "sha1-s12sN2R5+sw+lHR9QdDQ9SOP/LU=", - "dev": true, - "requires": { - "restore-cursor": "^2.0.0" - } - }, - "cli-width": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-2.2.0.tgz", - "integrity": "sha1-/xnt6Kml5XkyQUewwR8PvLq+1jk=", - "dev": true - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true - }, - "collection-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/collection-visit/-/collection-visit-1.0.0.tgz", - "integrity": "sha1-S8A3PBZLwykbTTaMgpzxqApZ3KA=", - "dev": true, - "requires": { - "map-visit": "^1.0.0", - "object-visit": "^1.0.0" - } - }, - "color-convert": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.2.tgz", - "integrity": "sha512-3NUJZdhMhcdPn8vJ9v2UQJoH0qqoGUkYTgFEPZaPjEtwmmKUfNV46zZmgB2M5M4DCEQHMaCfWHCxiBflLm04Tg==", - "dev": true, - "requires": { - "color-name": "1.1.1" - } - }, - "color-name": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.1.tgz", - "integrity": "sha1-SxQVMEz1ACjqgWQ2Q72C6gWANok=", - "dev": true - }, - "colors": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.1.2.tgz", - "integrity": "sha1-FopHAXVran9RoSzgyXv6KMCE7WM=", - "dev": true - }, - "commander": { - "version": "2.11.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.11.0.tgz", - "integrity": "sha1-FXFS/R56bI2YpbcVzzdt+SgARWM=", - "dev": true - }, - "commondir": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", - "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", - "dev": true - }, - "component-emitter": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.2.1.tgz", - "integrity": "sha1-E3kY1teCg/ffemt8WmPhQOaUJeY=", - "dev": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true - }, - "concat-stream": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz", - "integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==", - "dev": true, - "requires": { - "buffer-from": "^1.0.0", - "inherits": "^2.0.3", - "readable-stream": "^2.2.2", - "typedarray": "^0.0.6" - } - }, - "console-browserify": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz", - "integrity": "sha1-8CQcRXMKn8YyOyBtvzjtx0HQuxA=", - "dev": true, - "requires": { - "date-now": "^0.1.4" - } - }, - "constants-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/constants-browserify/-/constants-browserify-1.0.0.tgz", - "integrity": "sha1-wguW2MYXdIqvHBYCF2DNJ/y4y3U=", - "dev": true - }, - "copy-concurrently": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/copy-concurrently/-/copy-concurrently-1.0.5.tgz", - "integrity": "sha512-f2domd9fsVDFtaFcbaRZuYXwtdmnzqbADSwhSWYxYB/Q8zsdUUFMXVRwXGDMWmbEzAn1kdRrtI1T/KTFOL4X2A==", - "dev": true, - "requires": { - "aproba": "^1.1.1", - "fs-write-stream-atomic": "^1.0.8", - "iferr": "^0.1.5", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.0" - } - }, - "copy-descriptor": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", - "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", - "dev": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true - }, - "create-ecdh": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/create-ecdh/-/create-ecdh-4.0.3.tgz", - "integrity": "sha512-GbEHQPMOswGpKXM9kCWVrremUcBmjteUaQ01T9rkKCPDXfUHX0IoP9LpHYo2NPFampa4e+/pFDc3jQdxrxQLaw==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "elliptic": "^6.0.0" - } - }, - "create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "dev": true, - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "dev": true, - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "cross-fetch": { - "version": "2.2.3", - "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-2.2.3.tgz", - "integrity": "sha512-PrWWNH3yL2NYIb/7WF/5vFG3DCQiXDOVf8k3ijatbrtnwNuhMWLC7YF7uqf53tbTFDzHIUD8oITw4Bxt8ST3Nw==", - "requires": { - "node-fetch": "2.1.2", - "whatwg-fetch": "2.0.4" - } - }, - "cross-spawn": { - "version": "6.0.5", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-6.0.5.tgz", - "integrity": "sha512-eTVLrBSt7fjbDygz805pMnstIs2VTBNkRm0qxZd+M7A5XDdxVRWO5MxGBXZhjY4cqLYLdtrGqRf8mBPmzwSpWQ==", - "dev": true, - "requires": { - "nice-try": "^1.0.4", - "path-key": "^2.0.1", - "semver": "^5.5.0", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - }, - "dependencies": { - "semver": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.5.0.tgz", - "integrity": "sha512-4SJ3dm0WAwWy/NVeioZh5AntkdJoWKxHxcmyP622fOkgHa4z3R0TdBJICINyaSDE6uNwVc8gZr+ZinwZAH4xIA==", - "dev": true - } - } - }, - "crypto-browserify": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/crypto-browserify/-/crypto-browserify-3.12.0.tgz", - "integrity": "sha512-fz4spIh+znjO2VjL+IdhEpRJ3YN6sMzITSBijk6FK2UvTqruSQW+/cCZTSNsMiZNvUeq0CqurF+dAbyiGOY6Wg==", - "dev": true, - "requires": { - "browserify-cipher": "^1.0.0", - "browserify-sign": "^4.0.0", - "create-ecdh": "^4.0.0", - "create-hash": "^1.1.0", - "create-hmac": "^1.1.0", - "diffie-hellman": "^5.0.0", - "inherits": "^2.0.1", - "pbkdf2": "^3.0.3", - "public-encrypt": "^4.0.0", - "randombytes": "^2.0.0", - "randomfill": "^1.0.3" - } - }, - "cyclist": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", - "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=", - "dev": true - }, - "date-now": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz", - "integrity": "sha1-6vQ5/U1ISK105cx9vvIAZyueNFs=", - "dev": true - }, - "debug": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz", - "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true - }, - "decode-uri-component": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.2.0.tgz", - "integrity": "sha1-6zkTMzRYd1y4TNGh+uBiEGu4dUU=", - "dev": true - }, - "deep-eql": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-2.0.2.tgz", - "integrity": "sha1-sbrAblbwp2d3aG1Qyf63XC7XZ5o=", - "dev": true, - "requires": { - "type-detect": "^3.0.0" - }, - "dependencies": { - "type-detect": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-3.0.0.tgz", - "integrity": "sha1-RtDMhVOrt7E6NSsNbeov1Y8tm1U=", - "dev": true - } - } - }, - "deep-equal": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-1.0.1.tgz", - "integrity": "sha1-9dJgKStmDghO/0zbyfCK0yR0SLU=", - "dev": true - }, - "define-property": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-2.0.2.tgz", - "integrity": "sha512-jwK2UV4cnPpbcG7+VRARKTZPUWowwXA8bzH5NP6ud0oeAxyYPuGZUAC7hMugpCdz4BeSZl2Dl9k66CHJ/46ZYQ==", - "dev": true, - "requires": { - "is-descriptor": "^1.0.2", - "isobject": "^3.0.1" - }, - "dependencies": { - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, - "des.js": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/des.js/-/des.js-1.0.0.tgz", - "integrity": "sha1-wHTS4qpqipoH29YfmhXCzYPsjsw=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0" - } - }, - "diff": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.3.0.tgz", - "integrity": "sha1-BWaVFQ16qTI3yn43isOxaCt5Y7k=", - "dev": true - }, - "diffie-hellman": { - "version": "5.0.3", - "resolved": "https://registry.npmjs.org/diffie-hellman/-/diffie-hellman-5.0.3.tgz", - "integrity": "sha512-kqag/Nl+f3GwyK25fhUMYj81BUOrZ9IuJsjIcDE5icNM9FJHAVm3VcUDxdLPoQtTuUylWm6ZIknYJwwaPxsUzg==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "miller-rabin": "^4.0.0", - "randombytes": "^2.0.0" - } - }, - "doctrine": { - "version": "0.7.2", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-0.7.2.tgz", - "integrity": "sha1-fLhgNZujvpDgQLJrcpzkv6ZUxSM=", - "dev": true, - "requires": { - "esutils": "^1.1.6", - "isarray": "0.0.1" - }, - "dependencies": { - "esutils": { - "version": "1.1.6", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-1.1.6.tgz", - "integrity": "sha1-wBzKqa5LiXxtDD4hCuUvPHqEQ3U=", - "dev": true - }, - "isarray": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz", - "integrity": "sha1-ihis/Kmo9Bd+Cav8YDiTmwXR7t8=", + "commander": { + "version": "2.15.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true - } - } - }, - "domain-browser": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/domain-browser/-/domain-browser-1.2.0.tgz", - "integrity": "sha512-jnjyiM6eRyZl2H+W8Q/zLMA481hzi0eszAaBUzIVnmYVDBbnLxVNnfu1HgEBvCbL+71FrxMl3E6lpKH7Ge3OXA==", - "dev": true - }, - "duplexify": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-3.6.0.tgz", - "integrity": "sha512-fO3Di4tBKJpYTFHAxTU00BcfWMY9w24r/x21a6rZRbsD/ToUgGxsMbiGRmB7uVAXeGKXD9MwiLZa5E97EVgIRQ==", - "dev": true, - "requires": { - "end-of-stream": "^1.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.0.0", - "stream-shift": "^1.0.0" - } - }, - "elliptic": { - "version": "6.4.0", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.4.0.tgz", - "integrity": "sha1-ysmvh2LIWDYYcAPI3+GT5eLq5d8=", - "dev": true, - "requires": { - "bn.js": "^4.4.0", - "brorand": "^1.0.1", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.0", - "inherits": "^2.0.1", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.0" - } - }, - "emojis-list": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/emojis-list/-/emojis-list-2.1.0.tgz", - "integrity": "sha1-TapNnbAPmBmIDHn6RXrlsJof04k=", - "dev": true - }, - "end-of-stream": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.1.tgz", - "integrity": "sha512-1MkrZNvWTKCaigbn+W15elq2BB/L22nqrSY5DKlo3X6+vclJm8Bb5djXJBmEX6fS3+zCh/F4VBK5Z2KxJt4s2Q==", - "dev": true, - "requires": { - "once": "^1.4.0" - } - }, - "enhanced-resolve": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-4.0.0.tgz", - "integrity": "sha512-jox/62b2GofV1qTUQTMPEJSDIGycS43evqYzD/KVtEb9OCoki9cnacUPxCrZa7JfPzZSYOCZhu9O9luaMxAX8g==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "memory-fs": "^0.4.0", - "tapable": "^1.0.0" - } - }, - "errno": { - "version": "0.1.7", - "resolved": "https://registry.npmjs.org/errno/-/errno-0.1.7.tgz", - "integrity": "sha512-MfrRBDWzIWifgq6tJj60gkAwtLNb6sQPlcFrSOflcP1aFmmruKQ2wRnze/8V6kgyz7H3FF8Npzv78mZ7XLLflg==", - "dev": true, - "requires": { - "prr": "~1.0.1" - } - }, - "escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true - }, - "eslint-scope": { - "version": "3.7.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-3.7.1.tgz", - "integrity": "sha1-PWPD7f2gLgbgGkUq2IyqzHzctug=", - "dev": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - }, - "esrecurse": { - "version": "4.2.1", - "resolved": "https://registry.npmjs.org/esrecurse/-/esrecurse-4.2.1.tgz", - "integrity": "sha512-64RBB++fIOAXPw3P9cy89qfMlvZEXZkqqJkjqqXIvzP5ezRZjW+lPWjw35UX/3EhUPFYbg5ER4JYgDw4007/DQ==", - "dev": true, - "requires": { - "estraverse": "^4.1.0" - } - }, - "estraverse": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.2.0.tgz", - "integrity": "sha1-De4/7TH81GlhjOc0IJn8GvoL2xM=", - "dev": true - }, - "esutils": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/esutils/-/esutils-2.0.2.tgz", - "integrity": "sha1-Cr9PHKpbyx96nYrMbepPqqBLrJs=", - "dev": true - }, - "events": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/events/-/events-1.1.1.tgz", - "integrity": "sha1-nr23Y1rQmccNzEwqH1AEKI6L2SQ=", - "dev": true - }, - "evp_bytestokey": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/evp_bytestokey/-/evp_bytestokey-1.0.3.tgz", - "integrity": "sha512-/f2Go4TognH/KvCISP7OUsHn85hT9nUkxxA9BEWxFn+Oj9o8ZNLm/40hdlgSLyuOimsrTKLUMEorQexp/aPQeA==", - "dev": true, - "requires": { - "md5.js": "^1.3.4", - "safe-buffer": "^5.1.1" - } - }, - "execa": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/execa/-/execa-0.7.0.tgz", - "integrity": "sha1-lEvs00zEHuMqY6n68nrVpl/Fl3c=", - "dev": true, - "requires": { - "cross-spawn": "^5.0.1", - "get-stream": "^3.0.0", - "is-stream": "^1.1.0", - "npm-run-path": "^2.0.0", - "p-finally": "^1.0.0", - "signal-exit": "^3.0.0", - "strip-eof": "^1.0.0" - }, - "dependencies": { - "cross-spawn": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz", - "integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=", - "dev": true, - "requires": { - "lru-cache": "^4.0.1", - "shebang-command": "^1.2.0", - "which": "^1.2.9" - } - } - } - }, - "expand-brackets": { - "version": "2.1.4", - "resolved": "https://registry.npmjs.org/expand-brackets/-/expand-brackets-2.1.4.tgz", - "integrity": "sha1-t3c14xXOMPa27/D4OwQVGiJEliI=", - "dev": true, - "requires": { - "debug": "^2.3.3", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "posix-character-classes": "^0.1.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==" - } - } - }, - "extend-shallow": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-3.0.2.tgz", - "integrity": "sha1-Jqcarwc7OfshJxcnRhMcJwQCjbg=", - "dev": true, - "requires": { - "assign-symbols": "^1.0.0", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "external-editor": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.0.0.tgz", - "integrity": "sha512-mpkfj0FEdxrIhOC04zk85X7StNtr0yXnG7zCb+8ikO8OJi2jsHh5YGoknNTyXgsbHOf1WOOcVU3kPFWT2WgCkQ==", - "dev": true, - "requires": { - "chardet": "^0.5.0", - "iconv-lite": "^0.4.22", - "tmp": "^0.0.33" - } - }, - "extglob": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/extglob/-/extglob-2.0.4.tgz", - "integrity": "sha512-Nmb6QXkELsuBr24CJSkilo6UHHgbekK5UiZgfE6UHD3Eb27YC6oD+bhcT+tJ6cl8dmsgdQxnWlcry8ksBIBLpw==", - "dev": true, - "requires": { - "array-unique": "^0.3.2", - "define-property": "^1.0.0", - "expand-brackets": "^2.1.4", - "extend-shallow": "^2.0.1", - "fragment-cache": "^0.2.1", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, - "fast-deep-equal": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-2.0.1.tgz", - "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", - "dev": true - }, - "fast-json-stable-stringify": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz", - "integrity": "sha1-1RQsDK7msRifh9OnYREGT4bIu/I=", - "dev": true - }, - "figures": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-2.0.0.tgz", - "integrity": "sha1-OrGi0qYsi/tDGgyUy3l6L84nyWI=", - "dev": true, - "requires": { - "escape-string-regexp": "^1.0.5" - } - }, - "fill-range": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-4.0.0.tgz", - "integrity": "sha1-1USBHUKPmOsGpj3EAtJAPDKMOPc=", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-number": "^3.0.0", - "repeat-string": "^1.6.1", - "to-regex-range": "^2.1.0" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "find-cache-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", - "integrity": "sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^1.0.0", - "pkg-dir": "^2.0.0" - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "flush-write-stream": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.3.tgz", - "integrity": "sha512-calZMC10u0FMUqoiunI2AiGIIUtUIvifNwkHhNupZH4cbNnW1Itkoh/Nf5HFYmDrwWPjrUxpkZT0KhuCq0jmGw==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.4" - } - }, - "for-in": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/for-in/-/for-in-1.0.2.tgz", - "integrity": "sha1-gQaNKVqBQuwKxybG4iAMMPttXoA=", - "dev": true - }, - "fragment-cache": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", - "integrity": "sha1-QpD60n8T6Jvn8zeZxrxaCr//DRk=", - "dev": true, - "requires": { - "map-cache": "^0.2.2" - } - }, - "from2": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/from2/-/from2-2.3.0.tgz", - "integrity": "sha1-i/tVAr3kpNNs/e6gB/zKIdfjgq8=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "readable-stream": "^2.0.0" - } - }, - "fs-extra": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-7.0.1.tgz", - "integrity": "sha512-YJDaCJZEnBmcbw13fvdAM9AwNOJwOzrE4pqMqBq5nFiEqXUqHwlK4B+3pUw6JNvfSPtX05xFHtYy/1ni01eGCw==", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "jsonfile": "^4.0.0", - "universalify": "^0.1.0" - } - }, - "fs-write-stream-atomic": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", - "integrity": "sha1-tH31NJPvkR33VzHnCp3tAYnbQMk=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "iferr": "^0.1.5", - "imurmurhash": "^0.1.4", - "readable-stream": "1 || 2" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true - }, - "fsevents": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.9.tgz", - "integrity": "sha512-oeyj2H3EjjonWcFjD5NvZNE9Rqe4UW+nQBU2HNeKw0koVLEFIhtyETyAakeAM3de7Z/SW5kcA+fZUait9EApnw==", - "dev": true, - "optional": true, - "requires": { - "nan": "^2.12.1", - "node-pre-gyp": "^0.12.0" - }, - "dependencies": { - "abbrev": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/abbrev/-/abbrev-1.1.1.tgz", - "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", - "dev": true, - "optional": true - }, - "ansi-regex": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz", - "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=", - "dev": true, - "optional": true - }, - "aproba": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/aproba/-/aproba-1.2.0.tgz", - "integrity": "sha512-Y9J6ZjXtoYh8RnXVCMOU/ttDmk1aBjunq9vO0ta5x85WDQiQfUF9sIPBITdbiiIVcBo03Hi3jMxigBtsddlXRw==", - "dev": true, - "optional": true - }, - "are-we-there-yet": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/are-we-there-yet/-/are-we-there-yet-1.1.5.tgz", - "integrity": "sha512-5hYdAkZlcG8tOLujVDTgCT+uPX0VnpAH28gWsLfzpXYm7wP6mp5Q/gYyR7YQ0cKVJcXJnl3j2kpBan13PtQf6w==", - "dev": true, - "optional": true, - "requires": { - "delegates": "^1.0.0", - "readable-stream": "^2.0.6" - } - }, - "balanced-match": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", - "integrity": "sha1-ibTRmasr7kneFk6gK4nORi1xt2c=", - "dev": true, - "optional": true - }, - "brace-expansion": { - "version": "1.1.11", - "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", - "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", - "dev": true, - "optional": true, - "requires": { - "balanced-match": "^1.0.0", - "concat-map": "0.0.1" - } - }, - "chownr": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.1.tgz", - "integrity": "sha512-j38EvO5+LHX84jlo6h4UzmOwi0UgW61WRyPtJz4qaadK5eY3BTS5TY/S1Stc3Uk2lIM6TPevAlULiEJwie860g==", - "dev": true, - "optional": true - }, - "code-point-at": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/code-point-at/-/code-point-at-1.1.0.tgz", - "integrity": "sha1-DQcLTQQ6W+ozovGkDi7bPZpMz3c=", - "dev": true, - "optional": true - }, - "concat-map": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", - "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", - "dev": true, - "optional": true - }, - "console-control-strings": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/console-control-strings/-/console-control-strings-1.1.0.tgz", - "integrity": "sha1-PXz0Rk22RG6mRL9LOVB/mFEAjo4=", - "dev": true, - "optional": true - }, - "core-util-is": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha1-tf1UIgqivFq1eqtxQMlAdUUDwac=", - "dev": true, - "optional": true - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "optional": true, - "requires": { - "ms": "^2.1.1" - } - }, - "deep-extend": { - "version": "0.6.0", - "resolved": "https://registry.npmjs.org/deep-extend/-/deep-extend-0.6.0.tgz", - "integrity": "sha512-LOHxIOaPYdHlJRtCQfDIVZtfw/ufM8+rVj649RIHzcm/vGwQRXFt6OPqIFWsm2XEMrNIEtWR64sY1LEKD2vAOA==", - "dev": true, - "optional": true - }, - "delegates": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/delegates/-/delegates-1.0.0.tgz", - "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", - "dev": true, - "optional": true - }, - "detect-libc": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-1.0.3.tgz", - "integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups=", - "dev": true, - "optional": true - }, - "fs-minipass": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.5.tgz", - "integrity": "sha512-JhBl0skXjUPCFH7x6x61gQxrKyXsxB5gcgePLZCwfyCGGsTISMoIeObbrvVeP6Xmyaudw4TT43qV2Gz+iyd2oQ==", - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "fs.realpath": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", - "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=", - "dev": true, - "optional": true - }, - "gauge": { - "version": "2.7.4", - "resolved": "https://registry.npmjs.org/gauge/-/gauge-2.7.4.tgz", - "integrity": "sha1-LANAXHU4w51+s3sxcCLjJfsBi/c=", - "dev": true, - "optional": true, - "requires": { - "aproba": "^1.0.3", - "console-control-strings": "^1.0.0", - "has-unicode": "^2.0.0", - "object-assign": "^4.1.0", - "signal-exit": "^3.0.0", - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1", - "wide-align": "^1.1.0" - } - }, - "glob": { - "version": "7.1.3", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", - "integrity": "sha512-vcfuiIxogLV4DlGBHIUOwI0IbrJ8HWPc4MU7HzviGeNho/UJDfi6B5p3sHeWIQ0KGIU0Jpxi5ZHxemQfLkkAwQ==", - "dev": true, - "optional": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "has-unicode": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/has-unicode/-/has-unicode-2.0.1.tgz", - "integrity": "sha1-4Ob+aijPUROIVeCG0Wkedx3iqLk=", - "dev": true, - "optional": true - }, - "iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "optional": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ignore-walk": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/ignore-walk/-/ignore-walk-3.0.1.tgz", - "integrity": "sha512-DTVlMx3IYPe0/JJcYP7Gxg7ttZZu3IInhuEhbchuqneY9wWe5Ojy2mXLBaQFUQmo0AW2r3qG7m1mg86js+gnlQ==", - "dev": true, - "optional": true, - "requires": { - "minimatch": "^3.0.4" - } - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "optional": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true, - "optional": true - }, - "ini": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz", - "integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==", - "dev": true, - "optional": true - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "optional": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true, - "optional": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==", - "dev": true, - "optional": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true, - "optional": true - }, - "minipass": { - "version": "2.3.5", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-2.3.5.tgz", - "integrity": "sha512-Gi1W4k059gyRbyVUZQ4mEqLm0YIUiGYfvxhF6SIlk3ui1WVxMTGfGdQ2SInh3PDrRTVvPKgULkpJtT4RH10+VA==", - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "^5.1.2", - "yallist": "^3.0.0" - } - }, - "minizlib": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.2.1.tgz", - "integrity": "sha512-7+4oTUOWKg7AuL3vloEWekXY2/D20cevzsrNT2kGWm+39J9hGTCBv8VI5Pm5lXZ/o3/mdR4f8rflAPhnQb8mPA==", - "dev": true, - "optional": true, - "requires": { - "minipass": "^2.2.1" - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "optional": true, - "requires": { - "minimist": "0.0.8" - } - }, - "ms": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.1.tgz", - "integrity": "sha512-tgp+dl5cGk28utYktBsrFqA7HKgrhgPsg6Z/EfhWI4gl1Hwq8B/GmY/0oXZ6nF8hDVesS/FpnYaD/kOWhYQvyg==", - "dev": true, - "optional": true - }, - "needle": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/needle/-/needle-2.3.0.tgz", - "integrity": "sha512-QBZu7aAFR0522EyaXZM0FZ9GLpq6lvQ3uq8gteiDUp7wKdy0lSd2hPlgFwVuW1CBkfEs9PfDQsQzZghLs/psdg==", - "dev": true, - "optional": true, - "requires": { - "debug": "^4.1.0", - "iconv-lite": "^0.4.4", - "sax": "^1.2.4" - } - }, - "node-pre-gyp": { - "version": "0.12.0", - "resolved": "https://registry.npmjs.org/node-pre-gyp/-/node-pre-gyp-0.12.0.tgz", - "integrity": "sha512-4KghwV8vH5k+g2ylT+sLTjy5wmUOb9vPhnM8NHvRf9dHmnW/CndrFXy2aRPaPST6dugXSdHXfeaHQm77PIz/1A==", - "dev": true, - "optional": true, - "requires": { - "detect-libc": "^1.0.2", - "mkdirp": "^0.5.1", - "needle": "^2.2.1", - "nopt": "^4.0.1", - "npm-packlist": "^1.1.6", - "npmlog": "^4.0.2", - "rc": "^1.2.7", - "rimraf": "^2.6.1", - "semver": "^5.3.0", - "tar": "^4" - } - }, - "nopt": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-4.0.1.tgz", - "integrity": "sha1-0NRoWv1UFRk8jHUFYC0NF81kR00=", - "dev": true, - "optional": true, - "requires": { - "abbrev": "1", - "osenv": "^0.1.4" - } - }, - "npm-bundled": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/npm-bundled/-/npm-bundled-1.0.6.tgz", - "integrity": "sha512-8/JCaftHwbd//k6y2rEWp6k1wxVfpFzB6t1p825+cUb7Ym2XQfhwIC5KwhrvzZRJu+LtDE585zVaS32+CGtf0g==", - "dev": true, - "optional": true - }, - "npm-packlist": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/npm-packlist/-/npm-packlist-1.4.1.tgz", - "integrity": "sha512-+TcdO7HJJ8peiiYhvPxsEDhF3PJFGUGRcFsGve3vxvxdcpO2Z4Z7rkosRM0kWj6LfbK/P0gu3dzk5RU1ffvFcw==", - "dev": true, - "optional": true, - "requires": { - "ignore-walk": "^3.0.1", - "npm-bundled": "^1.0.1" - } - }, - "npmlog": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/npmlog/-/npmlog-4.1.2.tgz", - "integrity": "sha512-2uUqazuKlTaSI/dC8AzicUck7+IrEaOnN/e0jd3Xtt1KcGpwx30v50mL7oPyr/h9bL3E4aZccVwpwP+5W9Vjkg==", - "dev": true, - "optional": true, - "requires": { - "are-we-there-yet": "~1.1.2", - "console-control-strings": "~1.1.0", - "gauge": "~2.7.3", - "set-blocking": "~2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true, - "optional": true - }, - "object-assign": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", - "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", - "dev": true, - "optional": true - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "optional": true, - "requires": { - "wrappy": "1" - } - }, - "os-homedir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-homedir/-/os-homedir-1.0.2.tgz", - "integrity": "sha1-/7xJiDNuDoM94MFox+8VISGqf7M=", - "dev": true, - "optional": true - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true, - "optional": true - }, - "osenv": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/osenv/-/osenv-0.1.5.tgz", - "integrity": "sha512-0CWcCECdMVc2Rw3U5w9ZjqX6ga6ubk1xDVKxtBQPK7wis/0F2r9T6k4ydGYhecl7YUBxBVxhL5oisPsNxAPe2g==", - "dev": true, - "optional": true, - "requires": { - "os-homedir": "^1.0.0", - "os-tmpdir": "^1.0.0" - } - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true, - "optional": true - }, - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", - "dev": true, - "optional": true - }, - "rc": { - "version": "1.2.8", - "resolved": "https://registry.npmjs.org/rc/-/rc-1.2.8.tgz", - "integrity": "sha512-y3bGgqKj3QBdxLbLkomlohkvsA8gdAiUQlSBJnBhfn+BPxg4bc62d8TcBW15wavDfgexCgccckhcZvywyQYPOw==", - "dev": true, - "optional": true, - "requires": { - "deep-extend": "^0.6.0", - "ini": "~1.3.0", - "minimist": "^1.2.0", - "strip-json-comments": "~2.0.1" - }, - "dependencies": { - "minimist": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", - "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", - "dev": true, - "optional": true - } - } - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "optional": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "rimraf": { - "version": "2.6.3", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.3.tgz", - "integrity": "sha512-mwqeW5XsA2qAejG46gYdENaxXjx9onRNCfn7L0duuP4hCuTIi/QO7PDK07KJfp1d+izWPrzEJDcSqBa0OZQriA==", - "dev": true, - "optional": true, - "requires": { - "glob": "^7.1.3" - } - }, - "safe-buffer": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz", - "integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==", - "dev": true, - "optional": true - }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true, - "optional": true - }, - "sax": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz", - "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==", - "dev": true, - "optional": true - }, - "semver": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", - "dev": true, - "optional": true - }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true, - "optional": true - }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", - "dev": true, - "optional": true - }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "optional": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "optional": true, - "requires": { - "safe-buffer": "~5.1.0" - } - }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "optional": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true, - "optional": true - }, - "tar": { - "version": "4.4.8", - "resolved": "https://registry.npmjs.org/tar/-/tar-4.4.8.tgz", - "integrity": "sha512-LzHF64s5chPQQS0IYBn9IN5h3i98c12bo4NCO7e0sGM2llXQ3p2FGC5sdENN4cTW48O915Sh+x+EXx7XW96xYQ==", - "dev": true, - "optional": true, - "requires": { - "chownr": "^1.1.1", - "fs-minipass": "^1.2.5", - "minipass": "^2.3.4", - "minizlib": "^1.1.1", - "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.2", - "yallist": "^3.0.2" - } - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", - "dev": true, - "optional": true - }, - "wide-align": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", - "integrity": "sha512-QGkOQc8XL6Bt5PwnsExKBPuMKBxnGxWWW3fU55Xt4feHozMUhdUMaBCk290qpm/wG5u/RSKzwdAC4i51YigihA==", - "dev": true, - "optional": true, - "requires": { - "string-width": "^1.0.2 || 2" - } - }, - "wrappy": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", - "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", - "dev": true, - "optional": true - }, - "yallist": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.0.3.tgz", - "integrity": "sha512-S+Zk8DEWE6oKpV+vI3qWkaK+jSbIK86pCwe2IF/xwIpQ8jEuxpw9NyaGjmp9+BoJv5FV2piqCDcoCtStppiq2A==", - "dev": true, - "optional": true - } - } - }, - "get-caller-file": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-1.0.2.tgz", - "integrity": "sha1-9wLmMSfn4jHBYKgMFVSstw1QR+U=", - "dev": true - }, - "get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha1-6td0q+5y4gQJQzoGY2YCPdaIekE=", - "dev": true - }, - "get-stream": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-3.0.0.tgz", - "integrity": "sha1-jpQ9E1jcN1VQVOy+LtsFqhdO3hQ=", - "dev": true - }, - "get-value": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/get-value/-/get-value-2.0.6.tgz", - "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", - "dev": true - }, - "glob": { - "version": "7.1.2", - "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.2.tgz", - "integrity": "sha1-wZyd+aAocC1nhhI4SmVSQExjbRU=", - "dev": true, - "requires": { - "fs.realpath": "^1.0.0", - "inflight": "^1.0.4", - "inherits": "2", - "minimatch": "^3.0.4", - "once": "^1.3.0", - "path-is-absolute": "^1.0.0" - } - }, - "glob-parent": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-3.1.0.tgz", - "integrity": "sha1-nmr2KZ2NO9K9QEMIMr0RPfkGxa4=", - "dev": true, - "requires": { - "is-glob": "^3.1.0", - "path-dirname": "^1.0.0" - } - }, - "global-modules-path": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/global-modules-path/-/global-modules-path-2.1.0.tgz", - "integrity": "sha512-3DrmGj2TP+96cABk9TfMp6f3knH/Y46dqvWznTU3Tf6/bDGLDAn15tFluQ7BcloykOcdY16U0WGq0BQblYOxJQ==", - "dev": true - }, - "graceful-fs": { - "version": "4.1.11", - "resolved": "https://registry.npmjs.org/graceful-fs/-/graceful-fs-4.1.11.tgz", - "integrity": "sha1-Dovf5NHduIVNZOBOp8AOKgJuVlg=", - "dev": true - }, - "growl": { - "version": "1.10.5", - "resolved": "https://registry.npmjs.org/growl/-/growl-1.10.5.tgz", - "integrity": "sha512-qBr4OuELkhPenW6goKVXiv47US3clb3/IbuWF9KNKEijAy9oeHxU9IgzjvJhHkUzhaj7rOUD7+YGWqUjLp5oSA==", - "dev": true - }, - "handlebars": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", - "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", - "dev": true, - "requires": { - "neo-async": "^2.6.0", - "optimist": "^0.6.1", - "source-map": "^0.6.1", - "uglify-js": "^3.1.4" - }, - "dependencies": { - "neo-async": { - "version": "2.6.1", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", - "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "has-ansi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/has-ansi/-/has-ansi-2.0.0.tgz", - "integrity": "sha1-NPUEnOHs3ysGSa8+8k5F7TVBbZE=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "has-flag": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", - "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=", - "dev": true - }, - "has-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-1.0.0.tgz", - "integrity": "sha1-GLKB2lhbHFxR3vJMkw7SmgvmsXc=", - "dev": true, - "requires": { - "get-value": "^2.0.6", - "has-values": "^1.0.0", - "isobject": "^3.0.0" - } - }, - "has-values": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-1.0.0.tgz", - "integrity": "sha1-lbC2P+whRmGab+V/51Yo1aOe/k8=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "kind-of": "^4.0.0" - }, - "dependencies": { - "kind-of": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-4.0.0.tgz", - "integrity": "sha1-IIE989cSkosgc3hpGkUGb65y3Vc=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - } - } - }, - "hash-base": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.0.4.tgz", - "integrity": "sha1-X8hoaEfs1zSZQDMZprCj8/auSRg=", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "hash.js": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.4.tgz", - "integrity": "sha512-A6RlQvvZEtFS5fLU43IDu0QUmBy+fDO9VMdTXvufKwIkt/rFfvICAViCax5fbDO4zdNzaC3/27ZhKUok5bAJyw==", - "dev": true, - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.0" - } - }, - "he": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", - "integrity": "sha1-k0EP0hsAlzUVH4howvJx80J+I/0=", - "dev": true - }, - "highlight.js": { - "version": "9.15.8", - "resolved": "https://registry.npmjs.org/highlight.js/-/highlight.js-9.15.8.tgz", - "integrity": "sha512-RrapkKQWwE+wKdF73VsOa2RQdIoO3mxwJ4P8mhbI6KYJUraUHRKM5w5zQQKXNk0xNL4UVRdulV9SBJcmzJNzVA==", - "dev": true - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dev": true, - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "https-browserify": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", - "integrity": "sha1-7AbBDgo0wPL68Zn3/X/Hj//QPHM=", - "dev": true - }, - "iconv-lite": { - "version": "0.4.23", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.23.tgz", - "integrity": "sha512-neyTUVFtahjf0mB3dZT77u+8O0QB89jFdnBkd5P1JgYPbPaia3gXXOVL2fq8VyU2gMMD7SaN7QukTB/pmXYvDA==", - "dev": true, - "requires": { - "safer-buffer": ">= 2.1.2 < 3" - } - }, - "ieee754": { - "version": "1.1.12", - "resolved": "https://registry.npmjs.org/ieee754/-/ieee754-1.1.12.tgz", - "integrity": "sha512-GguP+DRY+pJ3soyIiGPTvdiVXjZ+DbXOxGpXn3eMvNW4x4irjqXm4wHKscC+TfxSJ0yw/S1F24tqdMNsMZTiLA==", - "dev": true - }, - "iferr": { - "version": "0.1.5", - "resolved": "https://registry.npmjs.org/iferr/-/iferr-0.1.5.tgz", - "integrity": "sha1-xg7taebY/bazEEofy8ocGS3FtQE=", - "dev": true - }, - "import-local": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/import-local/-/import-local-1.0.0.tgz", - "integrity": "sha512-vAaZHieK9qjGo58agRBg+bhHX3hoTZU/Oa3GESWLz7t1U62fk63aHuDJJEteXoDeTCcPmUT+z38gkHPZkkmpmQ==", - "dev": true, - "requires": { - "pkg-dir": "^2.0.0", - "resolve-cwd": "^2.0.0" - } - }, - "imurmurhash": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/imurmurhash/-/imurmurhash-0.1.4.tgz", - "integrity": "sha1-khi5srkoojixPcT7a21XbyMUU+o=", - "dev": true - }, - "indexof": { - "version": "0.0.1", - "resolved": "https://registry.npmjs.org/indexof/-/indexof-0.0.1.tgz", - "integrity": "sha1-gtwzbSMrkGIXnQWrMpOmYFn9Q10=", - "dev": true - }, - "inflight": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", - "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=", - "dev": true, - "requires": { - "once": "^1.3.0", - "wrappy": "1" - } - }, - "inherits": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", - "integrity": "sha1-Yzwsg+PaQqUC9SRmAiSA9CCCYd4=", - "dev": true - }, - "inquirer": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-6.0.0.tgz", - "integrity": "sha512-tISQWRwtcAgrz+SHPhTH7d3e73k31gsOy6i1csonLc0u1dVK/wYvuOnFeiWqC5OXFIYbmrIFInef31wbT8MEJg==", - "dev": true, - "requires": { - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.0", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^3.0.0", - "figures": "^2.0.0", - "lodash": "^4.3.0", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rxjs": "^6.1.0", - "string-width": "^2.1.0", - "strip-ansi": "^4.0.0", - "through": "^2.3.6" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "interpret": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.1.0.tgz", - "integrity": "sha1-ftGxQQxqDg94z5XTuEQMY/eLhhQ=", - "dev": true - }, - "inversify": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/inversify/-/inversify-5.0.1.tgz", - "integrity": "sha512-Ieh06s48WnEYGcqHepdsJUIJUXpwH5o5vodAX+DK2JA/gjy4EbEcQZxw+uFfzysmKjiLXGYwNG3qDZsKVMcINQ==", - "dev": true - }, - "invert-kv": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/invert-kv/-/invert-kv-1.0.0.tgz", - "integrity": "sha1-EEqOSqym09jNFXqO+L+rLXo//bY=", - "dev": true - }, - "is-accessor-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-0.1.6.tgz", - "integrity": "sha1-qeEss66Nh2cn7u84Q/igiXtcmNY=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-binary-path": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-1.0.1.tgz", - "integrity": "sha1-dfFmQrSA8YenEcgUFh/TpKdlWJg=", - "dev": true, - "requires": { - "binary-extensions": "^1.0.0" - } - }, - "is-buffer": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.5.tgz", - "integrity": "sha1-Hzsm72E7IUuIy8ojzGwB2Hlh7sw=", - "dev": true - }, - "is-data-descriptor": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-0.1.4.tgz", - "integrity": "sha1-C17mSDiOLIYCgueT8YVv7D8wG1Y=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-descriptor": { - "version": "0.1.6", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-0.1.6.tgz", - "integrity": "sha512-avDYr0SB3DwO9zsMov0gKCESFYqCnE4hq/4z3TdUlukEy5t9C0YRq7HLrsN52NAcqXKaepeCD0n+B0arnVG3Hg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^0.1.6", - "is-data-descriptor": "^0.1.4", - "kind-of": "^5.0.0" - }, - "dependencies": { - "kind-of": { - "version": "5.1.0", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-5.1.0.tgz", - "integrity": "sha512-NGEErnH6F2vUuXDh+OlbcKW7/wOcfdRHaZ7VWtqCztfHri/++YKmP51OdWeGPuqCOba6kk2OTe5d02VmTB80Pw==", - "dev": true - } - } - }, - "is-extendable": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-0.1.1.tgz", - "integrity": "sha1-YrEQ4omkcUGOPsNqYX1HLjAd/Ik=", - "dev": true - }, - "is-extglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", - "integrity": "sha1-qIwCU1eR8C7TfHahueqXc8gz+MI=" - }, - "is-fullwidth-code-point": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-1.0.0.tgz", - "integrity": "sha1-754xOG8DGn8NZDr4L95QxFfvAMs=", - "dev": true, - "requires": { - "number-is-nan": "^1.0.0" - } - }, - "is-glob": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-3.1.0.tgz", - "integrity": "sha1-e6WuJCF4BKxwcHuWkiVnSGzD6Eo=", - "dev": true, - "requires": { - "is-extglob": "^2.1.0" - } - }, - "is-number": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-3.0.0.tgz", - "integrity": "sha1-JP1iAaR4LPUFYcgQJ2r8fRLXEZU=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "is-odd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-odd/-/is-odd-2.0.0.tgz", - "integrity": "sha512-OTiixgpZAT1M4NHgS5IguFp/Vz2VI3U7Goh4/HA1adtwyLtSBrxYlcSYkhpAE07s4fKEcjrFxyvtQBND4vFQyQ==", - "dev": true, - "requires": { - "is-number": "^4.0.0" - }, - "dependencies": { - "is-number": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-number/-/is-number-4.0.0.tgz", - "integrity": "sha512-rSklcAIlf1OmFdyAqbnWTLVelsQ58uvZ66S/ZyawjWqIviTWCjg2PzVGw8WUA+nNuPTqb4wgA+NszrJ+08LlgQ==", - "dev": true - } - } - }, - "is-plain-object": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz", - "integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "is-promise": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.1.0.tgz", - "integrity": "sha1-eaKp7OfwlugPNtKy87wWwf9L8/o=", - "dev": true - }, - "is-stream": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", - "integrity": "sha1-EtSj3U5o4Lec6428hBc66A2RykQ=", - "dev": true - }, - "is-windows": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", - "integrity": "sha512-eXK1UInq2bPmjyX6e3VHIzMLobc4J94i4AWn+Hpq3OU5KkrRC96OAcR3PRJ/pGu6m8TRnBHP9dkXQVsT/COVIA==", - "dev": true - }, - "isarray": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", - "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=", - "dev": true - }, - "isexe": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", - "integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=", - "dev": true - }, - "isobject": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz", - "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", - "dev": true - }, - "js-tokens": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-3.0.2.tgz", - "integrity": "sha1-mGbfOVECEw449/mWvOtlRDIJwls=", - "dev": true - }, - "json-loader": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/json-loader/-/json-loader-0.5.7.tgz", - "integrity": "sha1-3KFKcCNf+C8KyaOr62DTN6NlGF0=", - "dev": true - }, - "json-parse-better-errors": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", - "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", - "dev": true - }, - "json-schema-traverse": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true - }, - "json-stringify-safe": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", - "integrity": "sha1-Epai1Y/UXxmg9s4B1lcB4sc1tus=", - "dev": true - }, - "json5": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", - "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=", - "dev": true - }, - "jsonfile": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz", - "integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.6" - } - }, - "kind-of": { - "version": "3.2.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-3.2.2.tgz", - "integrity": "sha1-MeohpzS6ubuw8yRm2JOupR5KPGQ=", - "dev": true, - "requires": { - "is-buffer": "^1.1.5" - } - }, - "lcid": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/lcid/-/lcid-1.0.0.tgz", - "integrity": "sha1-MIrMr6C8SDo4Z7S28rlQYlHRuDU=", - "dev": true, - "requires": { - "invert-kv": "^1.0.0" - } - }, - "leb": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/leb/-/leb-0.3.0.tgz", - "integrity": "sha1-Mr7p+tFoMo1q6oUi2DP0GA7tHaM=", - "dev": true - }, - "loader-runner": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/loader-runner/-/loader-runner-2.3.0.tgz", - "integrity": "sha1-9IKuqC1UPgeSFwDVpG7yb9rGuKI=", - "dev": true - }, - "loader-utils": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-1.1.0.tgz", - "integrity": "sha1-yYrvSIvM7aL/teLeZG1qdUQp9c0=", - "dev": true, - "requires": { - "big.js": "^3.1.3", - "emojis-list": "^2.0.0", - "json5": "^0.5.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "lodash": { - "version": "4.17.14", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz", - "integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==", - "dev": true - }, - "lodash.debounce": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/lodash.debounce/-/lodash.debounce-4.0.8.tgz", - "integrity": "sha1-gteb/zCmfEAF/9XiUVMArZyk168=", - "dev": true - }, - "long": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", - "integrity": "sha1-2CG3E4yhy1gcFymQ7xTbIAtcR0s=", - "dev": true - }, - "lru-cache": { - "version": "4.1.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.3.tgz", - "integrity": "sha512-fFEhvcgzuIoJVUF8fYr5KR0YqxD238zgObTps31YdADwPPAp82a4M8TrckkWyx7ekNlf9aBcVn81cFwwXngrJA==", - "dev": true, - "requires": { - "pseudomap": "^1.0.2", - "yallist": "^2.1.2" - } - }, - "make-dir": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/make-dir/-/make-dir-1.3.0.tgz", - "integrity": "sha512-2w31R7SJtieJJnQtGc7RVL2StM2vGYVfqUOvUDxH6bC6aJTxPxTF0GnIgCyu7tjockiUWAYQRbxa7vKn34s5sQ==", - "dev": true, - "requires": { - "pify": "^3.0.0" - } - }, - "mamacro": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/mamacro/-/mamacro-0.0.3.tgz", - "integrity": "sha512-qMEwh+UujcQ+kbz3T6V+wAmO2U8veoq2w+3wY8MquqwVA3jChfwY+Tk52GZKDfACEPjuZ7r2oJLejwpt8jtwTA==", - "dev": true - }, - "map-cache": { - "version": "0.2.2", - "resolved": "https://registry.npmjs.org/map-cache/-/map-cache-0.2.2.tgz", - "integrity": "sha1-wyq9C9ZSXZsFFkW7TyasXcmKDb8=", - "dev": true - }, - "map-visit": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/map-visit/-/map-visit-1.0.0.tgz", - "integrity": "sha1-7Nyo8TFE5mDxtb1B8S80edmN+48=", - "dev": true, - "requires": { - "object-visit": "^1.0.0" - } - }, - "marked": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.4.0.tgz", - "integrity": "sha512-tMsdNBgOsrUophCAFQl0XPe6Zqk/uy9gnue+jIIKhykO51hxyu6uNx7zBPy0+y/WKYVZZMspV9YeXLNdKk+iYw==", - "dev": true - }, - "md5.js": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.4.tgz", - "integrity": "sha1-6b296UogpawYsENA/Fdk1bCdkB0=", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "mem": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/mem/-/mem-1.1.0.tgz", - "integrity": "sha1-Xt1StIXKHZAP5kiVUFOZoN+kX3Y=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "memory-fs": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/memory-fs/-/memory-fs-0.4.1.tgz", - "integrity": "sha1-OpoguEYlI+RHz7x+i7gO1me/xVI=", - "dev": true, - "requires": { - "errno": "^0.1.3", - "readable-stream": "^2.0.1" - } - }, - "micromatch": { - "version": "3.1.10", - "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-3.1.10.tgz", - "integrity": "sha512-MWikgl9n9M3w+bpsY3He8L+w9eF9338xRl8IAO5viDizwSzziFEyUzo2xrrloB64ADbTf8uA8vRqqttDTOmccg==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "braces": "^2.3.1", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "extglob": "^2.0.4", - "fragment-cache": "^0.2.1", - "kind-of": "^6.0.2", - "nanomatch": "^1.2.9", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.2" - }, - "dependencies": { - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, - "miller-rabin": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/miller-rabin/-/miller-rabin-4.0.1.tgz", - "integrity": "sha512-115fLhvZVqWwHPbClyntxEVfVDfl9DLLTuJvq3g2O/Oxi8AiNouAHvDSzHS0viUJc+V5vm3eq91Xwqn9dp4jRA==", - "dev": true, - "requires": { - "bn.js": "^4.0.0", - "brorand": "^1.0.1" - } - }, - "mimic-fn": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-1.2.0.tgz", - "integrity": "sha512-jf84uxzwiuiIVKiOLpfYk7N46TSy8ubTonmneY9vrpHNAnp0QBt2BxWV9dO3/j+BoVAb+a5G6YDPW3M5HOdMWQ==", - "dev": true - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==", - "dev": true - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=", - "dev": true - }, - "minimatch": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz", - "integrity": "sha1-UWbihkV/AzBgZL5Ul+jbsMPTIIM=", - "dev": true, - "requires": { - "brace-expansion": "^1.1.7" - } - }, - "minimist": { - "version": "0.0.10", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", - "integrity": "sha1-3j+YVD2/lggr5IrRoMfNqDYwHc8=", - "dev": true - }, - "mississippi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz", - "integrity": "sha512-zHo8v+otD1J10j/tC+VNoGK9keCuByhKovAvdn74dmxJl9+mWHnx6EMsDN4lgRoMI/eYo2nchAxniIbUPb5onw==", - "dev": true, - "requires": { - "concat-stream": "^1.5.0", - "duplexify": "^3.4.2", - "end-of-stream": "^1.1.0", - "flush-write-stream": "^1.0.0", - "from2": "^2.1.0", - "parallel-transform": "^1.1.0", - "pump": "^2.0.1", - "pumpify": "^1.3.3", - "stream-each": "^1.1.0", - "through2": "^2.0.0" - } - }, - "mixin-deep": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", - "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", - "dev": true, - "requires": { - "for-in": "^1.0.2", - "is-extendable": "^1.0.1" - }, - "dependencies": { - "is-extendable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/is-extendable/-/is-extendable-1.0.1.tgz", - "integrity": "sha512-arnXMxT1hhoKo9k1LZdmlNyJdDDfy2v0fXjFlmok4+i8ul/6WlbVge9bhM74OpNPQPMGUToDtz+KXa1PneJxOA==", - "dev": true, - "requires": { - "is-plain-object": "^2.0.4" - } - } - } - }, - "mkdirp": { - "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", - "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", - "dev": true, - "requires": { - "minimist": "0.0.8" - }, - "dependencies": { - "minimist": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", - "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=", - "dev": true - } - } - }, - "mocha": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/mocha/-/mocha-5.2.0.tgz", - "integrity": "sha512-2IUgKDhc3J7Uug+FxMXuqIyYzH7gJjXECKe/w43IGgQHTSj3InJi+yAA7T24L9bQMRKiUEHxEX37G5JpVUGLcQ==", - "dev": true, - "requires": { - "browser-stdout": "1.3.1", - "commander": "2.15.1", - "debug": "3.1.0", - "diff": "3.5.0", - "escape-string-regexp": "1.0.5", - "glob": "7.1.2", - "growl": "1.10.5", - "he": "1.1.1", - "minimatch": "3.0.4", - "mkdirp": "0.5.1", - "supports-color": "5.4.0" - }, - "dependencies": { - "commander": { - "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", - "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", - "dev": true - }, - "diff": { - "version": "3.5.0", - "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", - "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", - "dev": true - } - } - }, - "move-concurrently": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz", - "integrity": "sha1-viwAX9oy4LKa8fBdfEszIUxwH5I=", - "dev": true, - "requires": { - "aproba": "^1.1.1", - "copy-concurrently": "^1.0.0", - "fs-write-stream-atomic": "^1.0.8", - "mkdirp": "^0.5.1", - "rimraf": "^2.5.4", - "run-queue": "^1.0.3" - } - }, - "ms": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "mute-stream": { - "version": "0.0.7", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", - "integrity": "sha1-MHXOk7whuPq0PhvE2n6BFe0ee6s=", - "dev": true - }, - "nan": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/nan/-/nan-2.14.0.tgz", - "integrity": "sha512-INOFj37C7k3AfaNTtX8RhsTw7qRy7eLET14cROi9+5HAVbbHuIWUHEauBv5qT4Av2tWasiTY1Jw6puUNqRJXQg==", - "dev": true, - "optional": true - }, - "nanomatch": { - "version": "1.2.9", - "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.9.tgz", - "integrity": "sha512-n8R9bS8yQ6eSXaV6jHUpKzD8gLsin02w1HSFiegwrs9E098Ylhw5jdyKPaYqvHknHaSCKTPp7C8dGCQ0q9koXA==", - "dev": true, - "requires": { - "arr-diff": "^4.0.0", - "array-unique": "^0.3.2", - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "fragment-cache": "^0.2.1", - "is-odd": "^2.0.0", - "is-windows": "^1.0.2", - "kind-of": "^6.0.2", - "object.pick": "^1.3.0", - "regex-not": "^1.0.0", - "snapdragon": "^0.8.1", - "to-regex": "^3.0.1" - }, - "dependencies": { - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, - "neo-async": { - "version": "2.5.1", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.5.1.tgz", - "integrity": "sha512-3KL3fvuRkZ7s4IFOMfztb7zJp3QaVWnBeGoJlgB38XnCRPj/0tLzzLG5IB8NYOHbJ8g8UGrgZv44GLDk6CxTxA==", - "dev": true - }, - "nice-try": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/nice-try/-/nice-try-1.0.4.tgz", - "integrity": "sha512-2NpiFHqC87y/zFke0fC0spBXL3bBsoh/p5H1EFhshxjCR5+0g2d6BiXbUFz9v1sAcxsk2htp2eQnNIci2dIYcA==", - "dev": true - }, - "nock": { - "version": "10.0.6", - "resolved": "https://registry.npmjs.org/nock/-/nock-10.0.6.tgz", - "integrity": "sha512-b47OWj1qf/LqSQYnmokNWM8D88KvUl2y7jT0567NB3ZBAZFz2bWp2PC81Xn7u8F2/vJxzkzNZybnemeFa7AZ2w==", - "dev": true, - "requires": { - "chai": "^4.1.2", - "debug": "^4.1.0", - "deep-equal": "^1.0.0", - "json-stringify-safe": "^5.0.1", - "lodash": "^4.17.5", - "mkdirp": "^0.5.0", - "propagate": "^1.0.0", - "qs": "^6.5.1", - "semver": "^5.5.0" - }, - "dependencies": { - "assertion-error": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/assertion-error/-/assertion-error-1.1.0.tgz", - "integrity": "sha512-jgsaNduz+ndvGyFt3uSuWqvy4lCnIJiovtouQN5JZHOKCS2QuhEdbcQHFhVksz2N2U9hXJo8odG7ETyWlEeuDw==", - "dev": true - }, - "chai": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/chai/-/chai-4.2.0.tgz", - "integrity": "sha512-XQU3bhBukrOsQCuwZndwGcCVQHyZi53fQ6Ys1Fym7E4olpIqqZZhhoFJoaKVvV17lWQoXYwgWN2nF5crA8J2jw==", - "dev": true, - "requires": { - "assertion-error": "^1.1.0", - "check-error": "^1.0.2", - "deep-eql": "^3.0.1", - "get-func-name": "^2.0.0", - "pathval": "^1.1.0", - "type-detect": "^4.0.5" - } - }, - "debug": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", - "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", - "dev": true, - "requires": { - "ms": "^2.1.1" - } - }, - "deep-eql": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/deep-eql/-/deep-eql-3.0.1.tgz", - "integrity": "sha512-+QeIQyN5ZuO+3Uk5DYh6/1eKO0m0YmJFGNmFHGACpf1ClL1nmlV/p4gNgbl2pJGxgXb4faqo6UE+M5ACEMyVcw==", - "dev": true, - "requires": { - "type-detect": "^4.0.0" - } - }, - "ms": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", - "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true - }, - "semver": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.0.tgz", - "integrity": "sha512-Ya52jSX2u7QKghxeoFGpLwCtGlt7j0oY9DYb5apt9nPlJ42ID+ulTXESnt/qAQcoSERyZ5sl3LDIOw0nAn/5DA==", - "dev": true - }, - "type-detect": { - "version": "4.0.8", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", - "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", - "dev": true - } - } - }, - "node-fetch": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.1.2.tgz", - "integrity": "sha1-q4hOjn5X44qUR1POxwb3iNF2i7U=" - }, - "node-libs-browser": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/node-libs-browser/-/node-libs-browser-2.1.0.tgz", - "integrity": "sha512-5AzFzdoIMb89hBGMZglEegffzgRg+ZFoUmisQ8HI4j1KDdpx13J0taNp2y9xPbur6W61gepGDDotGBVQ7mfUCg==", - "dev": true, - "requires": { - "assert": "^1.1.1", - "browserify-zlib": "^0.2.0", - "buffer": "^4.3.0", - "console-browserify": "^1.1.0", - "constants-browserify": "^1.0.0", - "crypto-browserify": "^3.11.0", - "domain-browser": "^1.1.1", - "events": "^1.0.0", - "https-browserify": "^1.0.0", - "os-browserify": "^0.3.0", - "path-browserify": "0.0.0", - "process": "^0.11.10", - "punycode": "^1.2.4", - "querystring-es3": "^0.2.0", - "readable-stream": "^2.3.3", - "stream-browserify": "^2.0.1", - "stream-http": "^2.7.2", - "string_decoder": "^1.0.0", - "timers-browserify": "^2.0.4", - "tty-browserify": "0.0.0", - "url": "^0.11.0", - "util": "^0.10.3", - "vm-browserify": "0.0.4" - }, - "dependencies": { - "punycode": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", - "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true - } - } - }, - "normalize-path": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-2.1.1.tgz", - "integrity": "sha1-GrKLVW4Zg2Oowab35vogE3/mrtk=", - "dev": true, - "requires": { - "remove-trailing-separator": "^1.0.1" - } - }, - "npm-run-path": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-2.0.2.tgz", - "integrity": "sha1-NakjLfo11wZ7TLLd8jV7GHFTbF8=", - "dev": true, - "requires": { - "path-key": "^2.0.0" - } - }, - "number-is-nan": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/number-is-nan/-/number-is-nan-1.0.1.tgz", - "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", - "dev": true - }, - "object-copy": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/object-copy/-/object-copy-0.1.0.tgz", - "integrity": "sha1-fn2Fi3gb18mRpBupde04EnVOmYw=", - "dev": true, - "requires": { - "copy-descriptor": "^0.1.0", - "define-property": "^0.2.5", - "kind-of": "^3.0.3" - }, - "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - } - } - }, - "object-visit": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/object-visit/-/object-visit-1.0.1.tgz", - "integrity": "sha1-95xEk68MU3e1n+OdOV5BBC3QRbs=", - "dev": true, - "requires": { - "isobject": "^3.0.0" - } - }, - "object.pick": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/object.pick/-/object.pick-1.3.0.tgz", - "integrity": "sha1-h6EKxMFpS9Lhy/U1kaZhQftd10c=", - "dev": true, - "requires": { - "isobject": "^3.0.1" - } - }, - "once": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", - "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", - "dev": true, - "requires": { - "wrappy": "1" - } - }, - "onetime": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-2.0.1.tgz", - "integrity": "sha1-BnQoIw/WdEOyeUsiu6UotoZ5YtQ=", - "dev": true, - "requires": { - "mimic-fn": "^1.0.0" - } - }, - "optimist": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", - "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", - "dev": true, - "requires": { - "minimist": "~0.0.1", - "wordwrap": "~0.0.2" - } - }, - "os-browserify": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/os-browserify/-/os-browserify-0.3.0.tgz", - "integrity": "sha1-hUNzx/XCMVkU/Jv8a9gjj92h7Cc=", - "dev": true - }, - "os-locale": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/os-locale/-/os-locale-2.1.0.tgz", - "integrity": "sha512-3sslG3zJbEYcaC4YVAvDorjGxc7tv6KVATnLPZONiljsUncvihe9BQoVCEs0RZ1kmf4Hk9OBqlZfJZWI4GanKA==", - "dev": true, - "requires": { - "execa": "^0.7.0", - "lcid": "^1.0.0", - "mem": "^1.1.0" - } - }, - "os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true - }, - "p-finally": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-1.0.0.tgz", - "integrity": "sha1-P7z7FbiZpEEjs0ttzBi3JDNqLK4=", - "dev": true - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, - "pako": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/pako/-/pako-1.0.6.tgz", - "integrity": "sha512-lQe48YPsMJAig+yngZ87Lus+NF+3mtu7DVOBu6b/gHO1YpKwIj5AWjZ/TOS7i46HD/UixzWb1zeWDZfGZ3iYcg==", - "dev": true - }, - "parallel-transform": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/parallel-transform/-/parallel-transform-1.1.0.tgz", - "integrity": "sha1-1BDwZbBdojCB/NEPKIVMKb2jOwY=", - "dev": true, - "requires": { - "cyclist": "~0.2.2", - "inherits": "^2.0.3", - "readable-stream": "^2.1.5" - } - }, - "parse-asn1": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/parse-asn1/-/parse-asn1-5.1.1.tgz", - "integrity": "sha512-KPx7flKXg775zZpnp9SxJlz00gTd4BmJ2yJufSc44gMCRrRQ7NSzAcSJQfifuOLgW6bEi+ftrALtsgALeB2Adw==", - "dev": true, - "requires": { - "asn1.js": "^4.0.0", - "browserify-aes": "^1.0.0", - "create-hash": "^1.1.0", - "evp_bytestokey": "^1.0.0", - "pbkdf2": "^3.0.3" - } - }, - "pascalcase": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/pascalcase/-/pascalcase-0.1.1.tgz", - "integrity": "sha1-s2PlXoAGym/iF4TS2yK9FdeRfxQ=", - "dev": true - }, - "path-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/path-browserify/-/path-browserify-0.0.0.tgz", - "integrity": "sha1-oLhwcpquIUAFt9UDLsLLuw+0RRo=", - "dev": true - }, - "path-dirname": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-dirname/-/path-dirname-1.0.2.tgz", - "integrity": "sha1-zDPSTVJeCZpTiMAzbG4yuRYGCeA=", - "dev": true - }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, - "path-is-absolute": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", - "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", - "dev": true - }, - "path-key": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", - "integrity": "sha1-QRyttXTFoUDTpLGRDUDYDMn0C0A=", - "dev": true - }, - "path-parse": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.5.tgz", - "integrity": "sha1-PBrfhx6pzWyUMbbqK9dKD/BVxME=", - "dev": true - }, - "pathval": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", - "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", - "dev": true - }, - "pbkdf2": { - "version": "3.0.16", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.0.16.tgz", - "integrity": "sha512-y4CXP3thSxqf7c0qmOF+9UeOTrifiVTIM+u7NWlq+PRsHbr7r7dpCmvzrZxa96JJUNi0Y5w9VqG5ZNeCVMoDcA==", - "dev": true, - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", - "dev": true - }, - "pkg-dir": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-2.0.0.tgz", - "integrity": "sha1-9tXREJ4Z1j7fQo4L1X4Sd3YVM0s=", - "dev": true, - "requires": { - "find-up": "^2.1.0" - } - }, - "posix-character-classes": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", - "integrity": "sha1-AerA/jta9xoqbAL+q7jB/vfgDqs=", - "dev": true - }, - "process": { - "version": "0.11.10", - "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", - "integrity": "sha1-czIwDoQBYb2j5podHZGn1LwW8YI=", - "dev": true - }, - "process-nextick-args": { - "version": "1.0.7", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", - "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", - "dev": true - }, - "progress": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", - "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", - "dev": true - }, - "promise-inflight": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", - "integrity": "sha1-mEcocL8igTL8vdhoEputEsPAKeM=", - "dev": true - }, - "promise-polyfill": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/promise-polyfill/-/promise-polyfill-8.0.0.tgz", - "integrity": "sha512-QGmPnw2hDEaRS6freHynJ7nfS1nDg0/P0c/CGglA43utoJjYQMiY9ojEpK0HaJ4wbUztdmwqQRlEfGWdsEQ5uQ==" - }, - "propagate": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/propagate/-/propagate-1.0.0.tgz", - "integrity": "sha1-AMLa7t2iDofjeCs0Stuhzd1q1wk=", - "dev": true - }, - "prr": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/prr/-/prr-1.0.1.tgz", - "integrity": "sha1-0/wRS6BplaRexok/SEzrHXj19HY=", - "dev": true - }, - "pseudomap": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz", - "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", - "dev": true - }, - "public-encrypt": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.2.tgz", - "integrity": "sha512-4kJ5Esocg8X3h8YgJsKAuoesBgB7mqH3eowiDzMUPKiRDDE7E/BqqZD1hnTByIaAFiwAw246YEltSq7tdrOH0Q==", - "dev": true, - "requires": { - "bn.js": "^4.1.0", - "browserify-rsa": "^4.0.0", - "create-hash": "^1.1.0", - "parse-asn1": "^5.0.0", - "randombytes": "^2.0.1" - } - }, - "pump": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/pump/-/pump-2.0.1.tgz", - "integrity": "sha512-ruPMNRkN3MHP1cWJc9OWr+T/xDP0jhXYCLfJcBuX54hhfIBnaQmAUMfDcG4DM5UMWByBbJY69QSphm3jtDKIkA==", - "dev": true, - "requires": { - "end-of-stream": "^1.1.0", - "once": "^1.3.1" - } - }, - "pumpify": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-1.5.1.tgz", - "integrity": "sha512-oClZI37HvuUJJxSKKrC17bZ9Cu0ZYhEAGPsPUy9KlMUmv9dKX2o77RUmq7f3XjIxbwyGwYzbzQ1L2Ks8sIradQ==", - "dev": true, - "requires": { - "duplexify": "^3.6.0", - "inherits": "^2.0.3", - "pump": "^2.0.0" - } - }, - "punycode": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", - "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==", - "dev": true - }, - "qs": { - "version": "6.7.0", - "resolved": "https://registry.npmjs.org/qs/-/qs-6.7.0.tgz", - "integrity": "sha512-VCdBRNFTX1fyE7Nb6FYoURo/SPe62QCaAyzJvUjwRaIsc+NePBEniHlvxFmmX56+HZphIGtV0XeCirBtpDrTyQ==", - "dev": true - }, - "querystring": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/querystring/-/querystring-0.2.0.tgz", - "integrity": "sha1-sgmEkgO7Jd+CDadW50cAWHhSFiA=", - "dev": true - }, - "querystring-es3": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/querystring-es3/-/querystring-es3-0.2.1.tgz", - "integrity": "sha1-nsYfeQSYdXB9aUFFlv2Qek1xHnM=", - "dev": true - }, - "randombytes": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.0.6.tgz", - "integrity": "sha512-CIQ5OFxf4Jou6uOKe9t1AOgqpeU5fd70A8NPdHSGeYXqXsPe6peOwI0cUl88RWZ6sP1vPMV3avd/R6cZ5/sP1A==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "randomfill": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/randomfill/-/randomfill-1.0.4.tgz", - "integrity": "sha512-87lcbR8+MhcWcUiQ+9e+Rwx8MyR2P7qnt15ynUlbm3TU/fjbgz4GsvfSUDTemtCCtVCqb4ZcEFlyPNTh9bBTLw==", - "dev": true, - "requires": { - "randombytes": "^2.0.5", - "safe-buffer": "^5.1.0" - } - }, - "readable-stream": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", - "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~1.0.6", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.0.3", - "util-deprecate": "~1.0.1" - } - }, - "readdirp": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-2.1.0.tgz", - "integrity": "sha1-TtCtBg3zBzMAxIRANz9y0cxkLXg=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "minimatch": "^3.0.2", - "readable-stream": "^2.0.2", - "set-immediate-shim": "^1.0.1" - } - }, - "rechoir": { - "version": "0.6.2", - "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", - "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", - "dev": true, - "requires": { - "resolve": "^1.1.6" - } - }, - "reflect-metadata": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.12.tgz", - "integrity": "sha512-n+IyV+nGz3+0q3/Yf1ra12KpCyi001bi4XFxSjbiWWjfqb52iTTtpGXmCCAOWWIAn9KEuFZKGqBERHmrtScZ3A==", - "dev": true - }, - "regex-not": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", - "integrity": "sha512-J6SDjUgDxQj5NusnOtdFxDwN/+HWykR8GELwctJ7mdqhcyy1xEc4SRFHUXvxTp661YaVKAjfRLZ9cCqS6tn32A==", - "dev": true, - "requires": { - "extend-shallow": "^3.0.2", - "safe-regex": "^1.1.0" - } - }, - "remove-trailing-separator": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/remove-trailing-separator/-/remove-trailing-separator-1.0.2.tgz", - "integrity": "sha1-abBi2XhyetFNxrVrpKt3L9jXBRE=", - "dev": true - }, - "repeat-element": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/repeat-element/-/repeat-element-1.1.2.tgz", - "integrity": "sha1-7wiaF40Ug7quTZPrmLT55OEdmQo=", - "dev": true - }, - "repeat-string": { - "version": "1.6.1", - "resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz", - "integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc=", - "dev": true - }, - "require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true - }, - "require-main-filename": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", - "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=", - "dev": true - }, - "resolve": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.4.0.tgz", - "integrity": "sha1-p1vgHFPaJdk0qY69DkxKcxL5KoY=", - "dev": true, - "requires": { - "path-parse": "^1.0.5" - } - }, - "resolve-cwd": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/resolve-cwd/-/resolve-cwd-2.0.0.tgz", - "integrity": "sha1-AKn3OHVW4nA46uIyyqNypqWbZlo=", - "dev": true, - "requires": { - "resolve-from": "^3.0.0" - } - }, - "resolve-from": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz", - "integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=", - "dev": true - }, - "resolve-url": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz", - "integrity": "sha1-LGN/53yJOv0qZj/iGqkIAGjiBSo=", - "dev": true - }, - "restore-cursor": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-2.0.0.tgz", - "integrity": "sha1-n37ih/gv0ybU/RYpI9YhKe7g368=", - "dev": true, - "requires": { - "onetime": "^2.0.0", - "signal-exit": "^3.0.2" - } - }, - "ret": { - "version": "0.1.15", - "resolved": "https://registry.npmjs.org/ret/-/ret-0.1.15.tgz", - "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", - "dev": true - }, - "rimraf": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", - "integrity": "sha512-lreewLK/BlghmxtfH36YYVg1i8IAce4TI7oao75I1g245+6BctqTVQiBP3YUJ9C6DQOXJmkYR9X9fCLtCOJc5w==", - "dev": true, - "requires": { - "glob": "^7.0.5" - } - }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dev": true, - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "run-async": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.3.0.tgz", - "integrity": "sha1-A3GrSuC91yDUFm19/aZP96RFpsA=", - "dev": true, - "requires": { - "is-promise": "^2.1.0" - } - }, - "run-queue": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/run-queue/-/run-queue-1.0.3.tgz", - "integrity": "sha1-6Eg5bwV9Ij8kOGkkYY4laUFh7Ec=", - "dev": true, - "requires": { - "aproba": "^1.1.1" - } - }, - "rxjs": { - "version": "6.2.1", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.2.1.tgz", - "integrity": "sha512-OwMxHxmnmHTUpgO+V7dZChf3Tixf4ih95cmXjzzadULziVl/FKhHScGLj4goEw9weePVOH2Q0+GcCBUhKCZc/g==", - "dev": true, - "requires": { - "tslib": "^1.9.0" - }, - "dependencies": { - "tslib": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.9.2.tgz", - "integrity": "sha512-AVP5Xol3WivEr7hnssHDsaM+lVrVXWUvd1cfXTRkTj80b//6g2wIFEH6hZG0muGZRnHGrfttpdzRk3YlBkWjKw==", + }, + "diff": { + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/diff/-/diff-3.5.0.tgz", + "integrity": "sha512-A46qtFgd+g7pDZinpnwiRJtxbC1hpgf0uzP3iG89scHk0AUC7A1TGxf5OiiOUv/JMZR8GOt8hL900hV0bOy5xA==", "dev": true } } }, - "safe-buffer": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", - "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=", + "ms": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", + "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=", "dev": true }, - "safe-regex": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/safe-regex/-/safe-regex-1.1.0.tgz", - "integrity": "sha1-QKNmnzsHfR6UPURinhV91IAjvy4=", + "node-fetch": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.0.tgz", + "integrity": "sha512-8dG4H5ujfvFiqDmVu9fQ5bOHUC15JMjMY/Zumv26oOvvVJjM67KF8koCWIabKQ1GJIa9r2mMZscBq/TbdOcmNA==" + }, + "object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM=", + "dev": true + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=", "dev": true, "requires": { - "ret": "~0.1.10" + "wrappy": "1" } }, - "safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "schema-utils": { - "version": "0.4.5", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-0.4.5.tgz", - "integrity": "sha512-yYrjb9TX2k/J1Y5UNy3KYdZq10xhYcF8nMpAW6o3hy6Q8WSIEf9lJHG/ePnOBfziPM3fvQwfOwa13U/Fh8qTfA==", + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", "dev": true, "requires": { - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0" + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" } }, - "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha1-4FnAnYVx8FQII3M0M1BdOi8AsY4=", + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=", "dev": true }, - "serialize-javascript": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.5.0.tgz", - "integrity": "sha512-Ga8c8NjAAp46Br4+0oZ2WxJCwIzwP60Gq1YPgU+39PiTVxyed/iKE/zyZI6+UlVYH5Q4PaQdHhcegIFPZTUfoQ==", + "path-parse": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.6.tgz", + "integrity": "sha512-GSmOT2EbHrINBf9SR7CDELwlJ8AENk3Qn7OikK4nFYAu3Ote2+JYNVvkpAEQm3/TLNEJFD/xZJjzyxg3KBWOzw==", "dev": true }, - "set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "pathval": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/pathval/-/pathval-1.1.0.tgz", + "integrity": "sha1-uULm1L3mUwBe9rcTYd74cn0GReA=", "dev": true }, - "set-immediate-shim": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/set-immediate-shim/-/set-immediate-shim-1.0.1.tgz", - "integrity": "sha1-SysbJ+uAip+NzEgaWOXlb1mfP2E=", + "process-nextick-args": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", + "integrity": "sha1-FQ4gt1ZZCtP5EJPyWk8q2L/zC6M=", "dev": true }, - "set-value": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", - "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", - "dev": true, - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.3", - "split-string": "^3.0.1" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "setimmediate": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.5.tgz", - "integrity": "sha1-KQy7Iy4waULX1+qbg3Mqt4VvgoU=", + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", "dev": true }, - "sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dev": true, - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "shebang-command": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz", - "integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=", + "readable-stream": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.3.tgz", + "integrity": "sha1-No8lEtefnUb9/HE0mueHi7weuVw=", "dev": true, "requires": { - "shebang-regex": "^1.0.0" + "core-util-is": "~1.0.0", + "inherits": "~2.0.3", + "isarray": "~1.0.0", + "process-nextick-args": "~1.0.6", + "safe-buffer": "~5.1.1", + "string_decoder": "~1.0.3", + "util-deprecate": "~1.0.1" } }, - "shebang-regex": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-1.0.0.tgz", - "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=", - "dev": true - }, - "shelljs": { - "version": "0.8.3", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", - "integrity": "sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==", + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha1-hSBLVNuoLVdC4oyWdW70OvUOM4Q=", "dev": true, "requires": { - "glob": "^7.0.0", - "interpret": "^1.0.0", - "rechoir": "^0.6.2" + "resolve": "^1.1.6" } }, - "signal-exit": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.2.tgz", - "integrity": "sha1-tf3AjxKH6hF4Yo5BXiUTK3NkbG0=", + "reflect-metadata": { + "version": "0.1.12", + "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.12.tgz", + "integrity": "sha512-n+IyV+nGz3+0q3/Yf1ra12KpCyi001bi4XFxSjbiWWjfqb52iTTtpGXmCCAOWWIAn9KEuFZKGqBERHmrtScZ3A==", "dev": true }, - "snapdragon": { - "version": "0.8.2", - "resolved": "https://registry.npmjs.org/snapdragon/-/snapdragon-0.8.2.tgz", - "integrity": "sha512-FtyOnWN/wCHTVXOMwvSv26d+ko5vWlIDD6zoUJ7LW8vh+ZBC8QdljveRP+crNrtBwioEUWy/4dMtbBjA4ioNlg==", - "dev": true, - "requires": { - "base": "^0.11.1", - "debug": "^2.2.0", - "define-property": "^0.2.5", - "extend-shallow": "^2.0.1", - "map-cache": "^0.2.2", - "source-map": "^0.5.6", - "source-map-resolve": "^0.5.0", - "use": "^3.1.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", - "dev": true, - "requires": { - "is-descriptor": "^0.1.0" - } - }, - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "dev": true, - "requires": { - "is-extendable": "^0.1.0" - } - } - } - }, - "snapdragon-node": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/snapdragon-node/-/snapdragon-node-2.1.1.tgz", - "integrity": "sha512-O27l4xaMYt/RSQ5TR3vpWCAB5Kb/czIcqUFOM/C4fYcLnbZUc1PkjTAMjof2pBWaSTwOUd6qUHcFGVGj7aIwnw==", + "resolve": { + "version": "1.12.0", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.12.0.tgz", + "integrity": "sha512-B/dOmuoAik5bKcD6s6nXDCjzUKnaDvdkRyAk6rsmsKLipWj4797iothd7jmmUhWTfinVMU+wc56rYKsit2Qy4w==", "dev": true, "requires": { - "define-property": "^1.0.0", - "isobject": "^3.0.0", - "snapdragon-util": "^3.0.1" - }, - "dependencies": { - "define-property": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-1.0.0.tgz", - "integrity": "sha1-dp66rz9KY6rTr56NMEybvnm/sOY=", - "dev": true, - "requires": { - "is-descriptor": "^1.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "dev": true, - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "dev": true, - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } + "path-parse": "^1.0.6" } }, - "snapdragon-util": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/snapdragon-util/-/snapdragon-util-3.0.1.tgz", - "integrity": "sha512-mbKkMdQKsjX4BAL4bRYTj21edOf8cN7XHdYUJEe+Zn99hVEYcMvKPct1IqNe7+AZPirn8BCDOQBHQZknqmKlZQ==", + "rollup": { + "version": "0.65.2", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-0.65.2.tgz", + "integrity": "sha512-BbXOrpxVbx0MpElI6vVLR2B6vnWHvYU/QAMw3GcEXvs601bvgrozuaW30cnvt43B96a6DeoYA0i9T5THanN+Rw==", "dev": true, "requires": { - "kind-of": "^3.2.0" + "@types/estree": "0.0.39", + "@types/node": "*" } }, - "source-list-map": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/source-list-map/-/source-list-map-2.0.0.tgz", - "integrity": "sha1-qqR0A/eyRakvvJfqCPJQ1gh+0IU=", - "dev": true - }, - "source-map": { - "version": "0.5.7", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", - "integrity": "sha1-igOdLRAh0i0eoUyA2OpGi6LvP8w=", - "dev": true - }, - "source-map-resolve": { - "version": "0.5.2", - "resolved": "https://registry.npmjs.org/source-map-resolve/-/source-map-resolve-0.5.2.tgz", - "integrity": "sha512-MjqsvNwyz1s0k81Goz/9vRBe9SZdB09Bdw+/zYyO+3CuPk6fouTaxscHkgtE8jKvf01kVfl8riHzERQ/kefaSA==", + "rollup-plugin-commonjs": { + "version": "9.3.4", + "resolved": "https://registry.npmjs.org/rollup-plugin-commonjs/-/rollup-plugin-commonjs-9.3.4.tgz", + "integrity": "sha512-DTZOvRoiVIHHLFBCL4pFxOaJt8pagxsVldEXBOn6wl3/V21wVaj17HFfyzTsQUuou3sZL3lEJZVWKPFblJfI6w==", "dev": true, "requires": { - "atob": "^2.1.1", - "decode-uri-component": "^0.2.0", - "resolve-url": "^0.2.1", - "source-map-url": "^0.4.0", - "urix": "^0.1.0" + "estree-walker": "^0.6.0", + "magic-string": "^0.25.2", + "resolve": "^1.10.0", + "rollup-pluginutils": "^2.6.0" } }, - "source-map-url": { - "version": "0.4.0", - "resolved": "https://registry.npmjs.org/source-map-url/-/source-map-url-0.4.0.tgz", - "integrity": "sha1-PpNdfd1zYxuXZZlW1VEo6HtQhKM=", - "dev": true - }, - "split-string": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/split-string/-/split-string-3.1.0.tgz", - "integrity": "sha512-NzNVhJDYpwceVVii8/Hu6DKfD2G+NrQHlS/V/qgv763EYudVwEcMQNxd2lh+0VrUByXN/oJkl5grOhYWvQUYiw==", + "rollup-plugin-node-resolve": { + "version": "3.4.0", + "resolved": "https://registry.npmjs.org/rollup-plugin-node-resolve/-/rollup-plugin-node-resolve-3.4.0.tgz", + "integrity": "sha512-PJcd85dxfSBWih84ozRtBkB731OjXk0KnzN0oGp7WOWcarAFkVa71cV5hTJg2qpVsV2U8EUwrzHP3tvy9vS3qg==", "dev": true, "requires": { - "extend-shallow": "^3.0.0" + "builtin-modules": "^2.0.0", + "is-module": "^1.0.0", + "resolve": "^1.1.6" } }, - "ssri": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", - "integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==", + "rollup-plugin-terser": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-2.0.2.tgz", + "integrity": "sha512-B+oXJLFrIyczYRUuq4I+cP1AQBvnvr5CFa6RN0mx1o8s6OrTmnRVBx4a8hk7eRY2Z00DE3jw4LxV3708gBQsdQ==", "dev": true, "requires": { - "safe-buffer": "^5.1.1" + "@babel/code-frame": "^7.0.0", + "jest-worker": "^23.2.0", + "terser": "^3.8.2" } }, - "static-extend": { - "version": "0.1.2", - "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", - "integrity": "sha1-YICcOcv/VTNyJv1eC1IPNB8ftcY=", + "rollup-plugin-typescript": { + "version": "0.8.1", + "resolved": "https://registry.npmjs.org/rollup-plugin-typescript/-/rollup-plugin-typescript-0.8.1.tgz", + "integrity": "sha1-L/fuzCHPa7K0P8J+W2iJUs5xkko=", "dev": true, "requires": { - "define-property": "^0.2.5", - "object-copy": "^0.1.0" + "compare-versions": "2.0.1", + "object-assign": "^4.0.1", + "rollup-pluginutils": "^1.3.1", + "tippex": "^2.1.1", + "typescript": "^1.8.9" }, "dependencies": { - "define-property": { - "version": "0.2.5", - "resolved": "https://registry.npmjs.org/define-property/-/define-property-0.2.5.tgz", - "integrity": "sha1-w1se+RjsPJkPmlvFe+BKrOxcgRY=", + "estree-walker": { + "version": "0.2.1", + "resolved": "https://registry.npmjs.org/estree-walker/-/estree-walker-0.2.1.tgz", + "integrity": "sha1-va/oCVOD2EFNXcLs9MkXO225QS4=", + "dev": true + }, + "rollup-pluginutils": { + "version": "1.5.2", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-1.5.2.tgz", + "integrity": "sha1-HhVud4+UtyVb+hs9AXi+j1xVJAg=", "dev": true, "requires": { - "is-descriptor": "^0.1.0" + "estree-walker": "^0.2.1", + "minimatch": "^3.0.2" } + }, + "typescript": { + "version": "1.8.10", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.8.10.tgz", + "integrity": "sha1-tHXW4N/wv1DyluXKbvn7tccyDx4=", + "dev": true } } }, - "stream-browserify": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.1.tgz", - "integrity": "sha1-ZiZu5fm9uZQKTkUUyvtDu3Hlyds=", + "rollup-pluginutils": { + "version": "2.8.2", + "resolved": "https://registry.npmjs.org/rollup-pluginutils/-/rollup-pluginutils-2.8.2.tgz", + "integrity": "sha512-EEp9NhnUkwY8aif6bxgovPHMoMoNr2FulJziTndpt5H9RdwC47GSGuII9XxpSdzVGM0GWrNPHV6ie1LTNJPaLQ==", "dev": true, "requires": { - "inherits": "~2.0.1", - "readable-stream": "^2.0.2" + "estree-walker": "^0.6.1" } }, - "stream-each": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/stream-each/-/stream-each-1.2.2.tgz", - "integrity": "sha512-mc1dbFhGBxvTM3bIWmAAINbqiuAk9TATcfIQC8P+/+HJefgaiTlMn2dHvkX8qlI12KeYKSQ1Ua9RrIqrn1VPoA==", + "safe-buffer": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.1.tgz", + "integrity": "sha1-iTMSr2myEj3vcfV4iQAWce6yyFM=", + "dev": true + }, + "semver": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.7.1.tgz", + "integrity": "sha512-sauaDf/PZdVgrLTNYHRtpXa1iRiKcaebiKQ1BJdpQlWH2lCvexQdX55snPFyK7QzpudqbCI0qXFfOasHdyNDGQ==", + "dev": true + }, + "shelljs": { + "version": "0.8.3", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.3.tgz", + "integrity": "sha512-fc0BKlAWiLpwZljmOvAOTE/gXawtCoNrP5oaY7KIaQbbyHeQVg01pSEuEGvGh3HEdBU4baCD7wQBwADmM/7f7A==", "dev": true, "requires": { - "end-of-stream": "^1.1.0", - "stream-shift": "^1.0.0" + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" } }, - "stream-http": { - "version": "2.8.3", - "resolved": "https://registry.npmjs.org/stream-http/-/stream-http-2.8.3.tgz", - "integrity": "sha512-+TSkfINHDo4J+ZobQLWiMouQYB+UVYFttRA94FpEzzJ7ZdqcL4uUUQ7WkdkI4DSozGmgBUE/a47L+38PenXhUw==", + "source-map-support": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.16.tgz", + "integrity": "sha512-efyLRJDr68D9hBBNIPWFjhpFzURh+KJykQwvMyW5UiZzYwoF6l4YMMDIJJEyFWxWCqfyxLzz6tSfUFR+kXXsVQ==", "dev": true, "requires": { - "builtin-status-codes": "^3.0.0", - "inherits": "^2.0.1", - "readable-stream": "^2.3.6", - "to-arraybuffer": "^1.0.0", - "xtend": "^4.0.0" + "buffer-from": "^1.0.0", + "source-map": "^0.6.0" }, "dependencies": { - "process-nextick-args": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.0.tgz", - "integrity": "sha512-MtEC1TqN0EU5nephaJ4rAtThHtC86dNN9qCuEhtshvpVBkAW5ZO7BASN9REnF9eoXGcRub+pFuKEpOHE+HbEMw==", + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", "dev": true - }, - "readable-stream": { - "version": "2.3.6", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.6.tgz", - "integrity": "sha512-tQtKA9WIAhBF3+VLAseyMqZeBjW0AHJoxOtYqSUZNJxauErmLbVm2FW1y+J/YA9dUrAC39ITejlZWhVIwawkKw==", - "dev": true, - "requires": { - "core-util-is": "~1.0.0", - "inherits": "~2.0.3", - "isarray": "~1.0.0", - "process-nextick-args": "~2.0.0", - "safe-buffer": "~5.1.1", - "string_decoder": "~1.1.1", - "util-deprecate": "~1.0.1" - } - }, - "string_decoder": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz", - "integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==", - "dev": true, - "requires": { - "safe-buffer": "~5.1.0" - } } } }, - "stream-shift": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.0.tgz", - "integrity": "sha1-1cdSgl5TZ+eG944Y5EXqIjoVWVI=", + "sourcemap-codec": { + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/sourcemap-codec/-/sourcemap-codec-1.4.6.tgz", + "integrity": "sha512-1ZooVLYFxC448piVLBbtOxFcXwnymH9oUF8nRd3CuYDVvkRBxRl6pB4Mtas5a4drtL+E8LDgFkQNcgIw6tc8Hg==", "dev": true }, - "string-width": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-1.0.2.tgz", - "integrity": "sha1-EYvfW4zcUaKn5w0hHgfisLmxB9M=", - "dev": true, - "requires": { - "code-point-at": "^1.0.0", - "is-fullwidth-code-point": "^1.0.0", - "strip-ansi": "^3.0.0" - } + "sprintf-js": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true }, "string_decoder": { "version": "1.0.3", @@ -4314,21 +885,6 @@ "safe-buffer": "~5.1.0" } }, - "strip-ansi": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-3.0.1.tgz", - "integrity": "sha1-ajhfuIU9lS1f8F0Oiq+UJ43GPc8=", - "dev": true, - "requires": { - "ansi-regex": "^2.0.0" - } - }, - "strip-eof": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", - "integrity": "sha1-u0P/VZim6wXYm1n80SnJgzE2Br8=", - "dev": true - }, "supports-color": { "version": "5.4.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.4.0.tgz", @@ -4338,137 +894,31 @@ "has-flag": "^3.0.0" } }, - "tapable": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/tapable/-/tapable-1.0.0.tgz", - "integrity": "sha512-dQRhbNQkRnaqauC7WqSJ21EEksgT0fYZX2lqXzGkpo8JNig9zGZTYoMGvyI2nWmXlE2VSVXVDu7wLVGu/mQEsg==", - "dev": true - }, - "through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "through2": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/through2/-/through2-2.0.3.tgz", - "integrity": "sha1-AARWmzfHx0ujnEPzzteNGtlBQL4=", - "dev": true, - "requires": { - "readable-stream": "^2.1.5", - "xtend": "~4.0.1" - } - }, - "timers-browserify": { - "version": "2.0.10", - "resolved": "https://registry.npmjs.org/timers-browserify/-/timers-browserify-2.0.10.tgz", - "integrity": "sha512-YvC1SV1XdOUaL6gx5CoGroT3Gu49pK9+TZ38ErPldOWW4j49GI1HKs9DV+KGq/w6y+LZ72W1c8cKz2vzY+qpzg==", - "dev": true, - "requires": { - "setimmediate": "^1.0.4" - } - }, - "tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "requires": { - "os-tmpdir": "~1.0.2" - } - }, - "to-arraybuffer": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/to-arraybuffer/-/to-arraybuffer-1.0.1.tgz", - "integrity": "sha1-fSKbH8xjfkZsoIEYCDanqr/4P0M=", - "dev": true - }, - "to-object-path": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/to-object-path/-/to-object-path-0.3.0.tgz", - "integrity": "sha1-KXWIt7Dn4KwI4E5nL4XB9JmeF68=", - "dev": true, - "requires": { - "kind-of": "^3.0.2" - } - }, - "to-regex": { - "version": "3.0.2", - "resolved": "https://registry.npmjs.org/to-regex/-/to-regex-3.0.2.tgz", - "integrity": "sha512-FWtleNAtZ/Ki2qtqej2CXTOayOH9bHDQF+Q48VpWyDXjbYxA4Yz8iDB31zXOBUlOHHKidDbqGVrTUvQMPmBGBw==", - "dev": true, - "requires": { - "define-property": "^2.0.2", - "extend-shallow": "^3.0.2", - "regex-not": "^1.0.2", - "safe-regex": "^1.1.0" - } - }, - "to-regex-range": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-2.1.1.tgz", - "integrity": "sha1-fIDBe53+vlmeJzZ+DU3VWQFB2zg=", - "dev": true, - "requires": { - "is-number": "^3.0.0", - "repeat-string": "^1.6.1" - } - }, - "ts-loader": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/ts-loader/-/ts-loader-4.4.1.tgz", - "integrity": "sha512-PvL6jgVEt4RurczrTOR8uI6uRmKRfRXiv3CyMRX8+MSQLlbedfbXtbJIdkhdpbqrsumb+Lc3qrxfmXHCmODyAg==", + "terser": { + "version": "3.17.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-3.17.0.tgz", + "integrity": "sha512-/FQzzPJmCpjAH9Xvk2paiWrFq+5M6aVOf+2KRbwhByISDX/EujxsK+BAvrhb6H+2rtrLCHK9N01wO014vrIwVQ==", "dev": true, "requires": { - "chalk": "^2.3.0", - "enhanced-resolve": "^4.0.0", - "loader-utils": "^1.0.2", - "micromatch": "^3.1.4", - "semver": "^5.0.1" + "commander": "^2.19.0", + "source-map": "~0.6.1", + "source-map-support": "~0.5.10" }, "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" + "source-map": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true } } }, + "tippex": { + "version": "2.3.1", + "resolved": "https://registry.npmjs.org/tippex/-/tippex-2.3.1.tgz", + "integrity": "sha1-ov1bcIfXy/sgyYBqbBYQjCwPr9o=", + "dev": true + }, "tslib": { "version": "1.7.1", "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.7.1.tgz", @@ -4476,21 +926,38 @@ "dev": true }, "tslint": { - "version": "5.5.0", - "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.5.0.tgz", - "integrity": "sha1-EOjas+MGH6YelELozuOYKs8gpqo=", + "version": "5.20.0", + "resolved": "https://registry.npmjs.org/tslint/-/tslint-5.20.0.tgz", + "integrity": "sha512-2vqIvkMHbnx8acMogAERQ/IuINOq6DFqgF8/VDvhEkBqQh/x6SP0Y+OHnKth9/ZcHQSroOZwUQSN18v8KKF0/g==", "dev": true, "requires": { - "babel-code-frame": "^6.22.0", - "colors": "^1.1.2", - "commander": "^2.9.0", - "diff": "^3.2.0", + "@babel/code-frame": "^7.0.0", + "builtin-modules": "^1.1.1", + "chalk": "^2.3.0", + "commander": "^2.12.1", + "diff": "^4.0.1", "glob": "^7.1.1", + "js-yaml": "^3.13.1", "minimatch": "^3.0.4", + "mkdirp": "^0.5.1", "resolve": "^1.3.2", "semver": "^5.3.0", - "tslib": "^1.7.1", - "tsutils": "^2.5.1" + "tslib": "^1.8.0", + "tsutils": "^2.29.0" + }, + "dependencies": { + "builtin-modules": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/builtin-modules/-/builtin-modules-1.1.1.tgz", + "integrity": "sha1-Jw8HbFpywC9bZaR9+Uxf46J4iS8=", + "dev": true + }, + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "dev": true + } } }, "tslint-config-airbnb": { @@ -4589,36 +1056,32 @@ } }, "tsutils": { - "version": "2.8.0", - "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.8.0.tgz", - "integrity": "sha1-AWAXNymzvxOGKN0UoVN+AIUdgUo=", + "version": "2.29.0", + "resolved": "https://registry.npmjs.org/tsutils/-/tsutils-2.29.0.tgz", + "integrity": "sha512-g5JVHCIJwzfISaXpXE1qvNalca5Jwob6FjI4AoPlqMusJ6ftFE7IkkFoMhVLRgK+4Kx3gkzb8UZK5t5yTTvEmA==", "dev": true, "requires": { - "tslib": "^1.7.1" + "tslib": "^1.8.1" + }, + "dependencies": { + "tslib": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.10.0.tgz", + "integrity": "sha512-qOebF53frne81cf0S9B41ByenJ3/IuH8yJKngAX35CmiZySA0khhkovshKK+jGCaMnVomla7gVlIcc3EvKPbTQ==", + "dev": true + } } }, - "tty-browserify": { - "version": "0.0.0", - "resolved": "https://registry.npmjs.org/tty-browserify/-/tty-browserify-0.0.0.tgz", - "integrity": "sha1-oVe6QC2iTpv5V/mqadUk7tQpAaY=", - "dev": true - }, "type-detect": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.3.tgz", - "integrity": "sha1-Dj8mcLRAmbC0bChNE2p+9Jx0wuo=", - "dev": true - }, - "typedarray": { - "version": "0.0.6", - "resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz", - "integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=", + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-4.0.8.tgz", + "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, "typedoc": { - "version": "0.14.2", - "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.14.2.tgz", - "integrity": "sha512-aEbgJXV8/KqaVhcedT7xG6d2r+mOvB5ep3eIz1KuB5sc4fDYXcepEEMdU7XSqLFO5hVPu0nllHi1QxX2h/QlpQ==", + "version": "0.12.0", + "resolved": "https://registry.npmjs.org/typedoc/-/typedoc-0.12.0.tgz", + "integrity": "sha512-dsdlaYZ7Je8JC+jQ3j2Iroe4uyD0GhqzADNUVyBRgLuytQDP/g0dPkAw5PdM/4drnmmJjRzSWW97FkKo+ITqQg==", "dev": true, "requires": { "@types/fs-extra": "^5.0.3", @@ -4630,20 +1093,20 @@ "@types/shelljs": "^0.8.0", "fs-extra": "^7.0.0", "handlebars": "^4.0.6", - "highlight.js": "^9.13.1", + "highlight.js": "^9.0.0", "lodash": "^4.17.10", "marked": "^0.4.0", "minimatch": "^3.0.0", "progress": "^2.0.0", "shelljs": "^0.8.2", "typedoc-default-themes": "^0.5.0", - "typescript": "3.2.x" + "typescript": "3.0.x" }, "dependencies": { "typescript": { - "version": "3.2.4", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.2.4.tgz", - "integrity": "sha512-0RNDbSdEokBeEAkgNbxJ+BLwSManFy9TeXz8uW+48j/xhEXv1ePME60olyzw2XzUqUBNAYFeJadIqAgNqIACwg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.0.3.tgz", + "integrity": "sha512-kk80vLW9iGtjMnIv11qyxLqZm20UklzuR2tL0QAnDIygIUIemcZMxlMWudl9OOt76H3ntVzcTiddQ1/pAAJMYg==", "dev": true } } @@ -4655,29 +1118,22 @@ "dev": true }, "typescript": { - "version": "2.4.2", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-2.4.2.tgz", - "integrity": "sha1-+DlfhdRZJ2BnyYiqQYN6j4KHCEQ=", + "version": "3.6.4", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.6.4.tgz", + "integrity": "sha512-unoCll1+l+YK4i4F8f22TaNVPRHcD9PA3yCuZ8g5e0qGqlVlJ/8FSateOLLSagn+Yg5+ZwuPkL8LFUc0Jcvksg==", "dev": true }, "uglify-js": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.0.tgz", - "integrity": "sha512-W+jrUHJr3DXKhrsS7NUVxn3zqMOFn0hL/Ei6v0anCIMoKC93TjcflTagwIHLW7SfMFfiQuktQyFVCFHGUE0+yg==", + "version": "3.6.5", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.6.5.tgz", + "integrity": "sha512-7L3W+Npia1OCr5Blp4/Vw83tK1mu5gnoIURtT1fUVfQ3Kf8WStWV6NJz0fdoBJZls0KlweruRTLVe6XLafmy5g==", "dev": true, "optional": true, "requires": { - "commander": "~2.20.0", + "commander": "~2.20.3", "source-map": "~0.6.1" }, "dependencies": { - "commander": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", - "dev": true, - "optional": true - }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -4687,592 +1143,29 @@ } } }, - "uglifyjs-webpack-plugin": { - "version": "1.2.6", - "resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.6.tgz", - "integrity": "sha512-NDP94ahjW7ZH+qzdjxjIV04n5YGnrYD2jeHgKgnpUKmdAfcXEO5DbVo21fXAm/KPMyX9k21zWFBMYm9m9R2ptg==", - "dev": true, - "requires": { - "cacache": "^10.0.4", - "find-cache-dir": "^1.0.0", - "schema-utils": "^0.4.5", - "serialize-javascript": "^1.4.0", - "source-map": "^0.6.1", - "uglify-es": "^3.3.4", - "webpack-sources": "^1.1.0", - "worker-farm": "^1.5.2" - }, - "dependencies": { - "commander": { - "version": "2.13.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", - "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==", - "dev": true - }, - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - }, - "uglify-es": { - "version": "3.3.9", - "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", - "integrity": "sha512-r+MU0rfv4L/0eeW3xZrd16t4NZfK8Ld4SWVglYBb7ez5uXFWHuVRs6xCTrf1yirs9a4j4Y27nn7SRfO6v67XsQ==", - "dev": true, - "requires": { - "commander": "~2.13.0", - "source-map": "~0.6.1" - } - } - } - }, - "union-value": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", - "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", - "dev": true, - "requires": { - "arr-union": "^3.1.0", - "get-value": "^2.0.6", - "is-extendable": "^0.1.1", - "set-value": "^2.0.1" - } - }, - "unique-filename": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-1.1.0.tgz", - "integrity": "sha1-0F8v5AMlYIcfMOk8vnNe6iAVFPM=", - "dev": true, - "requires": { - "unique-slug": "^2.0.0" - } - }, - "unique-slug": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-2.0.0.tgz", - "integrity": "sha1-22Z258fMBimHj/GWCXx4hVrp9Ks=", - "dev": true, - "requires": { - "imurmurhash": "^0.1.4" - } - }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", "integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg==", "dev": true }, - "unset-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/unset-value/-/unset-value-1.0.0.tgz", - "integrity": "sha1-g3aHP30jNRef+x5vw6jtDfyKtVk=", - "dev": true, - "requires": { - "has-value": "^0.3.1", - "isobject": "^3.0.0" - }, - "dependencies": { - "has-value": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/has-value/-/has-value-0.3.1.tgz", - "integrity": "sha1-ex9YutpiyoJ+wKIHgCVlSEWZXh8=", - "dev": true, - "requires": { - "get-value": "^2.0.3", - "has-values": "^0.1.4", - "isobject": "^2.0.0" - }, - "dependencies": { - "isobject": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/isobject/-/isobject-2.1.0.tgz", - "integrity": "sha1-8GVWEJaj8dou9GJy+BXIQNh+DIk=", - "dev": true, - "requires": { - "isarray": "1.0.0" - } - } - } - }, - "has-values": { - "version": "0.1.4", - "resolved": "https://registry.npmjs.org/has-values/-/has-values-0.1.4.tgz", - "integrity": "sha1-bWHeldkd/Km5oCCJrThL/49it3E=", - "dev": true - } - } - }, - "upath": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/upath/-/upath-1.1.0.tgz", - "integrity": "sha512-bzpH/oBhoS/QI/YtbkqCg6VEiPYjSZtrHQM6/QnJS6OL9pKUFLqb3aFh4Scvwm45+7iAgiMkLhSbaZxUqmrprw==", - "dev": true - }, - "uri-js": { - "version": "4.2.2", - "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.2.2.tgz", - "integrity": "sha512-KY9Frmirql91X2Qgjry0Wd4Y+YTdrdZheS8TFwvkbLWf/G5KNJDCh6pKL5OZctEW4+0Baa5idK2ZQuELRwPznQ==", - "dev": true, - "requires": { - "punycode": "^2.1.0" - } - }, - "urix": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/urix/-/urix-0.1.0.tgz", - "integrity": "sha1-2pN/emLiH+wf0Y1Js1wpNQZ6bHI=", - "dev": true - }, - "url": { - "version": "0.11.0", - "resolved": "https://registry.npmjs.org/url/-/url-0.11.0.tgz", - "integrity": "sha1-ODjpfPxgUh63PFJajlW/3Z4uKPE=", - "dev": true, - "requires": { - "punycode": "1.3.2", - "querystring": "0.2.0" - }, - "dependencies": { - "punycode": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.3.2.tgz", - "integrity": "sha1-llOgNvt8HuQjQvIyXM7v6jkmxI0=", - "dev": true - } - } - }, - "use": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/use/-/use-3.1.0.tgz", - "integrity": "sha512-6UJEQM/L+mzC3ZJNM56Q4DFGLX/evKGRg15UJHGB9X5j5Z3AFbgZvjUh2yq/UJUY4U5dh7Fal++XbNg1uzpRAw==", - "dev": true, - "requires": { - "kind-of": "^6.0.2" - }, - "dependencies": { - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==", - "dev": true - } - } - }, - "util": { - "version": "0.10.4", - "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", - "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", - "dev": true, - "requires": { - "inherits": "2.0.3" - } - }, "util-deprecate": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=", "dev": true }, - "v8-compile-cache": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.0.0.tgz", - "integrity": "sha512-qNdTUMaCjPs4eEnM3W9H94R3sU70YCuT+/ST7nUf+id1bVOrdjrpUaeZLqPBPRph3hsgn4a4BvwpxhHZx+oSDg==", - "dev": true - }, - "vm-browserify": { - "version": "0.0.4", - "resolved": "https://registry.npmjs.org/vm-browserify/-/vm-browserify-0.0.4.tgz", - "integrity": "sha1-XX6kW7755Kb/ZflUOOCofDV9WnM=", - "dev": true, - "requires": { - "indexof": "0.0.1" - } - }, - "watchpack": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/watchpack/-/watchpack-1.6.0.tgz", - "integrity": "sha512-i6dHe3EyLjMmDlU1/bGQpEw25XSjkJULPuAVKCbNRefQVq48yXKUpwg538F7AZTf9kyr57zj++pQFltUa5H7yA==", - "dev": true, - "requires": { - "chokidar": "^2.0.2", - "graceful-fs": "^4.1.2", - "neo-async": "^2.5.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "is-glob": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.0.tgz", - "integrity": "sha1-lSHHaEXMJhCoUgPd8ICpWML/q8A=", - "requires": { - "is-extglob": "^2.1.1" - } - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" - } - } - }, - "webpack": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-4.12.0.tgz", - "integrity": "sha512-EJj2FfhgtjrTbJbJaNulcVpDxi9vsQVvTahHN7xJvIv6W+k4r/E6Hxy4eyOrj+IAFWqYgaUtnpxmSGYP8MSZJw==", - "dev": true, - "requires": { - "@webassemblyjs/ast": "1.5.12", - "@webassemblyjs/helper-module-context": "1.5.12", - "@webassemblyjs/wasm-edit": "1.5.12", - "@webassemblyjs/wasm-opt": "1.5.12", - "@webassemblyjs/wasm-parser": "1.5.12", - "acorn": "^5.6.2", - "acorn-dynamic-import": "^3.0.0", - "ajv": "^6.1.0", - "ajv-keywords": "^3.1.0", - "chrome-trace-event": "^1.0.0", - "enhanced-resolve": "^4.0.0", - "eslint-scope": "^3.7.1", - "json-parse-better-errors": "^1.0.2", - "loader-runner": "^2.3.0", - "loader-utils": "^1.1.0", - "memory-fs": "~0.4.1", - "micromatch": "^3.1.8", - "mkdirp": "~0.5.0", - "neo-async": "^2.5.0", - "node-libs-browser": "^2.0.0", - "schema-utils": "^0.4.4", - "tapable": "^1.0.0", - "uglifyjs-webpack-plugin": "^1.2.4", - "watchpack": "^1.5.0", - "webpack-sources": "^1.0.1" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "is-accessor-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-accessor-descriptor/-/is-accessor-descriptor-1.0.0.tgz", - "integrity": "sha512-m5hnHTkcVsPfqx3AKlyttIPb7J+XykHvJP2B9bZDjlhLIoEq4XoK64Vg7boZlVWYK6LUY94dYPEE7Lh0ZkZKcQ==", - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-data-descriptor": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/is-data-descriptor/-/is-data-descriptor-1.0.0.tgz", - "integrity": "sha512-jbRXy1FmtAoCjQkVmIVYwuuqDFUbaOeDjmed1tOGPrsMhtJA4rD9tkgA0F1qJ3gRFRXcHYVkdeaP50Q5rE/jLQ==", - "requires": { - "kind-of": "^6.0.0" - } - }, - "is-descriptor": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-descriptor/-/is-descriptor-1.0.2.tgz", - "integrity": "sha512-2eis5WqQGV7peooDyLmNEPUrps9+SXX5c9pL3xEB+4e9HnGuDa7mB7kHxHw4CbqS9k1T2hOH3miL8n8WtiYVtg==", - "requires": { - "is-accessor-descriptor": "^1.0.0", - "is-data-descriptor": "^1.0.0", - "kind-of": "^6.0.2" - } - }, - "kind-of": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.2.tgz", - "integrity": "sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==" - } - } - }, - "webpack-cli": { - "version": "3.0.8", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.0.8.tgz", - "integrity": "sha512-KnRLJ0BUaYRqrhAMb9dv3gzdmhmgIMKo0FmdsnmfqbPGtLnnZ6tORZAvmmKfr+A0VgiVpqC60Gv7Ofg0R2CHtQ==", - "dev": true, - "requires": { - "chalk": "^2.4.1", - "cross-spawn": "^6.0.5", - "enhanced-resolve": "^4.0.0", - "global-modules-path": "^2.1.0", - "import-local": "^1.0.0", - "inquirer": "^6.0.0", - "interpret": "^1.1.0", - "loader-utils": "^1.1.0", - "supports-color": "^5.4.0", - "v8-compile-cache": "^2.0.0", - "yargs": "^11.1.0" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "yargs": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.1.0.tgz", - "integrity": "sha512-NwW69J42EsCSanF8kyn5upxvjp5ds+t3+udGBeTbFnERA+lF541DDpMawzo4z6W/QrzNM18D+BPMiOBibnFV5A==", - "dev": true, - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^9.0.2" - } - } - } - }, - "webpack-sources": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-1.1.0.tgz", - "integrity": "sha512-aqYp18kPphgoO5c/+NaUvEeACtZjMESmDChuD3NBciVpah3XpMEU9VAAtIaB1BsfJWWTSdv8Vv1m3T0aRk2dUw==", - "dev": true, - "requires": { - "source-list-map": "^2.0.0", - "source-map": "~0.6.1" - }, - "dependencies": { - "source-map": { - "version": "0.6.1", - "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", - "dev": true - } - } - }, - "whatwg-fetch": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz", - "integrity": "sha512-dcQ1GWpOD/eEQ97k66aiEVpNnapVj90/+R+SXTPYGHpYBBypfKJEQjLrvMZ7YXbKm21gXd4NcuxUTjiv1YtLng==" - }, - "which": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/which/-/which-1.3.1.tgz", - "integrity": "sha512-HxJdYWq1MTIQbJ3nw0cqssHoTNU267KlrDuGZ1WYlxDStUtKUhOaJmh112/TZmHxxUfuJqPXSOm7tDyas0OSIQ==", - "dev": true, - "requires": { - "isexe": "^2.0.0" - } - }, - "which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, "wordwrap": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", "dev": true }, - "worker-farm": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.6.0.tgz", - "integrity": "sha512-6w+3tHbM87WnSWnENBUvA2pxJPLhQUg5LKwUQHq3r+XPhIM+Gh2R5ycbwPCyuGbNg+lPgdcnQUhuC02kJCvffQ==", - "dev": true, - "requires": { - "errno": "~0.1.7" - } - }, - "wrap-ansi": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-2.1.0.tgz", - "integrity": "sha1-2Pw9KE3QV5T+hJc8rs3Rz4JP3YU=", - "dev": true, - "requires": { - "string-width": "^1.0.1", - "strip-ansi": "^3.0.1" - } - }, "wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8=", "dev": true - }, - "xtend": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/xtend/-/xtend-4.0.1.tgz", - "integrity": "sha1-pcbVMr5lbiPbgg77lDofBJmNY68=", - "dev": true - }, - "y18n": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-3.2.1.tgz", - "integrity": "sha1-bRX7qITAhnnA136I53WegR4H+kE=", - "dev": true - }, - "yallist": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", - "integrity": "sha1-HBH5IY8HYImkfdUS+TxmmaaoHVI=", - "dev": true - }, - "yargs": { - "version": "11.0.0", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-11.0.0.tgz", - "integrity": "sha512-Rjp+lMYQOWtgqojx1dEWorjCofi1YN7AoFvYV7b1gx/7dAAeuI4kN5SZiEvr0ZmsZTOpDRcCqrpI10L31tFkBw==", - "dev": true, - "requires": { - "cliui": "^4.0.0", - "decamelize": "^1.1.1", - "find-up": "^2.1.0", - "get-caller-file": "^1.0.1", - "os-locale": "^2.0.0", - "require-directory": "^2.1.1", - "require-main-filename": "^1.0.1", - "set-blocking": "^2.0.0", - "string-width": "^2.0.0", - "which-module": "^2.0.0", - "y18n": "^3.2.1", - "yargs-parser": "^9.0.2" - }, - "dependencies": { - "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "cliui": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-4.1.0.tgz", - "integrity": "sha512-4FG+RSG9DL7uEwRUZXZn3SS34DiDPfzP0VOiEwtUWlE+AR2EIg+hSyvrIgUUfhdgR/UkAeW2QHgeP+hWrXs7jQ==", - "dev": true, - "requires": { - "string-width": "^2.1.1", - "strip-ansi": "^4.0.0", - "wrap-ansi": "^2.0.0" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, - "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - } - } - }, - "yargs-parser": { - "version": "9.0.2", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-9.0.2.tgz", - "integrity": "sha1-nM9qQ0YP5O1Aqbto9I1DuKaMwHc=", - "dev": true, - "requires": { - "camelcase": "^4.1.0" - }, - "dependencies": { - "camelcase": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-4.1.0.tgz", - "integrity": "sha1-1UVjW+HjPFQmScaRc+Xeas+uNN0=", - "dev": true - } - } } } } diff --git a/package.json b/package.json index 1c0eef78..a71b6d9c 100644 --- a/package.json +++ b/package.json @@ -12,36 +12,41 @@ ], "version": "2.1.1", "devDependencies": { - "chai": "^4.1.1", - "json-loader": "^0.5.4", + "chai": "^4.1.2", "mocha": "^5.2.0", - "nock": "^10.0.6", - "ts-loader": "^4.4.1", - "tslint": "^5.1.0", - "tslint-config-airbnb": "^5.11.1", - "typedoc": "^0.14.2", - "typescript": "^2.3.2", - "webpack": "^4.12.0", - "webpack-cli": "^3.0.8", - "yargs": "^11.0.0" + "rollup": "^0.65.0", + "rollup-plugin-commonjs": "^9.1.6", + "rollup-plugin-node-resolve": "^3.3.0", + "rollup-plugin-terser": "^2.0.2", + "rollup-plugin-typescript": "^0.8.1", + "tslint": "^5.11.0", + "tslint-config-airbnb": "^5.11.0", + "typedoc": "^0.12.0", + "typescript": "^3.0.3" }, "repository": { "type": "git", "url": "https://github.com/prismicio/prismic-javascript.git" }, - "main": "dist/prismic-javascript.min.js", + "main": "dist/prismic-javascript.js", + "module": "dist/prismic-javascript.mjs", + "browser": { + "./dist/prismic-javascript.js": "dist/prismic-javascript.browser.js", + "./dist/prismic-javascript.mjs": "dist/prismic-javascript.browser.mjs" + }, "types": "./d.ts/index.d.ts", "scripts": { - "build": "node_modules/.bin/webpack-cli -p", - "dev": "node_modules/.bin/webpack-cli -d --watch", - "check": "tsc --pretty --noEmit --project ./tsconfig.json --watch", + "build": "rollup -c", + "dev": "rollup -c -w", + "check": "tsc --pretty --noEmit --watch", "test": "mocha", - "prepare": "npm run build; npm run docs", - "docs": "typedoc --mode file --out ./docs/ ./src/index.ts", + "prepublish": "npm run build; npm run docs; npm run declarations", + "docs": "typedoc --mode file --out ./docs ./src/index.ts", + "declarations": "tsc --emitDeclarationOnly --declaration --declarationDir ./d.ts", "lint": "tslint src/**/*.ts -e src/lru.ts -e src/Cookies.ts" }, "dependencies": { - "cross-fetch": "^2.2.3", - "promise-polyfill": "8.0.0" + "@types/node-fetch": "^2.1.2", + "node-fetch": "^2.2.0" } } diff --git a/rollup.config.js b/rollup.config.js new file mode 100644 index 00000000..5f2f4ed2 --- /dev/null +++ b/rollup.config.js @@ -0,0 +1,62 @@ +import resolve from 'rollup-plugin-node-resolve'; +import commonjs from 'rollup-plugin-commonjs'; +import typescript from 'rollup-plugin-typescript'; +import { terser } from 'rollup-plugin-terser'; +import pkg from './package.json'; + +export default [ + /* prismic-javascript.js and prismic-javascript.mjs */ + { + input: 'src/index.ts', + output: [ + { file: `dist/${pkg.name}.js`, format: 'cjs', sourcemap: true }, + { file: `dist/${pkg.name}.mjs`, format: 'esm', sourcemap: true }, + ], + plugins: [ + resolve(), + commonjs(), + typescript({ + typescript: require('typescript') + }) + ], + external: [ + 'node-fetch' + ] + }, + + /* prismic-javascript.browser.js and prismic-javascript.browser.mjs */ + { + input: 'src/index.ts', + output: [ + { file: `dist/${pkg.name}.browser.js`, format: 'umd', name: 'PrismicJS', sourcemap: true }, + { file: `dist/${pkg.name}.browser.mjs`, format: 'esm', sourcemap: true }, + ], + plugins: [ + resolve({ + browser: true + }), + commonjs(), + typescript({ + typescript: require('typescript') + }) + ] + }, + + /* prismic-javascript.min.js */ + { + input: 'src/index.ts', + output: [ + { file: `dist/${pkg.name}.min.js`, format: 'umd', name: 'PrismicJS' } + ], + plugins: [ + resolve({ + browser: true + }), + commonjs(), + typescript({ + typescript: require('typescript') + }), + terser() + ] + } +]; \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index ef5943c9..ab1f0663 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,28 +1,25 @@ -import PrismicPredicates from './Predicates'; -import { Experiments as PrismicExperiment } from './experiments'; +import ResolvedApi, { EXPERIMENT_COOKIE as experimentCookie, PREVIEW_COOKIE as previewCookie } from './ResolvedApi'; +import Predicates from './Predicates'; +import { Experiments } from './experiments'; +import Api, { ApiOptions } from './Api'; import { DefaultClient } from './client'; -import PrismicApi, { ApiOptions } from './Api'; -import ResolvedApi, { EXPERIMENT_COOKIE, PREVIEW_COOKIE } from './ResolvedApi'; -namespace Prismic { +export { + experimentCookie, + previewCookie, + Predicates, + Experiments, + Api +}; - export const experimentCookie = EXPERIMENT_COOKIE; - export const previewCookie = PREVIEW_COOKIE; - export const Predicates = PrismicPredicates; - export const Experiments = PrismicExperiment; - export const Api = PrismicApi; - - export function client(url: string, options?: ApiOptions) { - return new DefaultClient(url, options); - } - - export function getApi(url: string, options?: ApiOptions): Promise { - return DefaultClient.getApi(url, options); - } +export function client(url: string, options?: ApiOptions): DefaultClient { + return new DefaultClient(url, options); +} - export function api(url: string, options?: ApiOptions): Promise { - return getApi(url, options); - } +export function getApi(url: string, options?: ApiOptions): Promise { + return DefaultClient.getApi(url, options); } -export = Prismic; +export function api(url: string, options?: ApiOptions): Promise { + return getApi(url, options); +} \ No newline at end of file diff --git a/test/api.js b/test/api.js index fb9beb89..21fd8461 100644 --- a/test/api.js +++ b/test/api.js @@ -2,7 +2,7 @@ var path = require('path'); var querystring = require('querystring'); var chai = require('chai'); var assert = chai.assert; -var Prismic = require(path.join(__dirname, '../', 'dist', 'prismic-javascript.min.js')); +var Prismic = require(path.join(__dirname, '../', 'dist', 'prismic-javascript.js')); var fs = require('fs'); function fixtures(file) { diff --git a/test/cache.js b/test/cache.js index 2d555eb6..6be2e9a9 100644 --- a/test/cache.js +++ b/test/cache.js @@ -1,7 +1,7 @@ var path = require('path'); var chai = require('chai'); var assert = chai.assert; -var Prismic = require(path.join(__dirname, '../', 'dist', 'prismic-javascript.min.js')); +var Prismic = require(path.join(__dirname, '../', 'dist', 'prismic-javascript.js')); var fs = require('fs'); function fixtures(file) { diff --git a/test/predicates.js b/test/predicates.js index ea16dcb5..64d22626 100644 --- a/test/predicates.js +++ b/test/predicates.js @@ -1,7 +1,7 @@ var path = require('path'); var chai = require('chai'); var assert = chai.assert; -var Prismic = require(path.join(__dirname, '../', 'dist', 'prismic-javascript.min.js')); +var Prismic = require(path.join(__dirname, '../', 'dist', 'prismic-javascript.js')); describe('Predicates', function() { diff --git a/test/prismic.js b/test/prismic.js index 5830d5ad..dc20329a 100644 --- a/test/prismic.js +++ b/test/prismic.js @@ -1,7 +1,7 @@ var path = require('path'); var chai = require('chai'); var assert = chai.assert; -var Prismic = require(path.join(__dirname, '../', 'dist', 'prismic-javascript.min.js')); +var Prismic = require(path.join(__dirname, '../', 'dist', 'prismic-javascript.js')); var fs = require('fs'); var querystring = require('querystring'); diff --git a/tsconfig.json b/tsconfig.json index a69cbe21..926030c4 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,15 +1,18 @@ { - "files": ["./src/index.ts"], "compilerOptions": { "noImplicitAny": true, + "strictNullChecks": true, "preserveConstEnums": true, "removeComments": false, "sourceMap": true, - "module": "commonjs", - "lib": ["es5", "dom", "es2015.promise", "es2015.symbol", "es2015.symbol.wellknown"], - "strictNullChecks": true, + "lib": ["ES5", "ES6", "DOM"], + "target": "ES5", + "module": "ES6", "baseUrl": "." }, + "include": [ + "src" + ], "exclude": [ "node_modules" ] diff --git a/webpack.config.js b/webpack.config.js deleted file mode 100644 index 5adfc0f5..00000000 --- a/webpack.config.js +++ /dev/null @@ -1,69 +0,0 @@ -var webpack = require('webpack'), - path = require('path'), - yargs = require('yargs'); - -var fileName = 'prismic-javascript', - libraryName = 'PrismicJS', - outputFile; - -if (yargs.argv.p) { - outputFile = fileName + '.min.js'; -} else { - outputFile = fileName + '.js'; -} - -var config = { - mode: yargs.argv.p ? 'production' : 'development', - entry: [ - 'promise-polyfill/src/polyfill', - 'cross-fetch/polyfill', - __dirname + '/src/index.ts' - ], - externals: [{ - "cross-fetch/polyfill": { - root: 'cross-fetch/polyfill', - commonjs2: 'cross-fetch/polyfill', - commonjs: 'cross-fetch/polyfill', - amd: 'cross-fetch/polyfill' - } - }], - output: { - path: path.join(__dirname, '/dist'), - filename: outputFile, - library: libraryName, - libraryTarget: 'umd', - umdNamedDefine: true, - globalObject: 'typeof self !== \'undefined\' ? self : this' - }, - optimization: { - minimize: !!yargs.argv.p, - }, - module: { - rules: [ - { - test: /\.ts$/, - enforce: 'pre', - loader: 'ts-loader', - exclude: /node_modules/, - options: { - compilerOptions: { - declaration: true, - declarationDir: "../d.ts" - } - } - }, - { - test: /\.json$/, - use: 'json-loader' - } - ] - }, - resolve: { - alias:{ - "@root": path.resolve( __dirname, './src' ) - }, - extensions: ['.ts', '.js'] - } -}; - -module.exports = config;