cedar-utils
Advanced tools
Comparing version 1.0.0-beta to 1.0.1-beta
@@ -7,3 +7,9 @@ /** | ||
export declare function deepMerge(source: any, ...args: any[]): any; | ||
declare const helpers: { | ||
/** | ||
* Iterates over an object and produces an array of key/val pairs | ||
* @param {object} obj Object to iterate over | ||
* @return {array} Array of key, val pairs. | ||
*/ | ||
export declare function entries(obj: object): any[]; | ||
export declare const helpers: { | ||
entries: (obj: object) => any[]; | ||
@@ -10,0 +16,0 @@ deepMerge: (source: any, ...args: any[]) => any; |
@@ -38,3 +38,3 @@ /** | ||
*/ | ||
function entries(obj) { | ||
export function entries(obj) { | ||
var pairs = []; | ||
@@ -48,3 +48,3 @@ for (var key in obj) { | ||
} | ||
var helpers = { | ||
export var helpers = { | ||
entries: entries, | ||
@@ -51,0 +51,0 @@ deepMerge: deepMerge |
@@ -1,3 +0,4 @@ | ||
export { default as helpers } from './helpers/helpers'; | ||
export { default as query } from './query/query'; | ||
export { default as url } from './query/url'; | ||
export * from './helpers/helpers'; | ||
export * from './query/query'; | ||
export * from './query/url'; | ||
export * from './flatten/flatten'; |
@@ -1,4 +0,5 @@ | ||
export { default as helpers } from './helpers/helpers'; | ||
export { default as query } from './query/query'; | ||
export { default as url } from './query/url'; | ||
export * from './helpers/helpers'; | ||
export * from './query/query'; | ||
export * from './query/url'; | ||
export * from './flatten/flatten'; | ||
//# sourceMappingURL=index.js.map |
@@ -26,3 +26,3 @@ /** | ||
export declare function getData(url: string, options: any): Promise<any>; | ||
declare const query: { | ||
export declare const query: { | ||
fsToArr: (fs: any) => any[]; | ||
@@ -29,0 +29,0 @@ arrToFs: (arr: any[]) => any; |
@@ -65,3 +65,3 @@ /** | ||
} | ||
var query = { | ||
export var query = { | ||
fsToArr: fsToArr, | ||
@@ -68,0 +68,0 @@ arrToFs: arrToFs, |
@@ -13,3 +13,3 @@ export declare function defaultQuery(): { | ||
export declare function createFeatureServiceRequest(dataset: any): string; | ||
declare const url: { | ||
export declare const url: { | ||
defaultQuery: () => { | ||
@@ -16,0 +16,0 @@ where: string; |
@@ -58,3 +58,3 @@ import { deepMerge } from '../helpers/helpers'; | ||
} | ||
var url = { | ||
export var url = { | ||
defaultQuery: defaultQuery, | ||
@@ -61,0 +61,0 @@ serializeQueryParams: serializeQueryParams, |
@@ -1,6 +0,8 @@ | ||
{"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/index.ts": {"path":"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/index.ts","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":3,"column":16},"end":{"line":3,"column":44}},"2":{"start":{"line":4,"column":0},"end":{"line":4,"column":36}},"3":{"start":{"line":5,"column":14},"end":{"line":5,"column":38}},"4":{"start":{"line":6,"column":0},"end":{"line":6,"column":32}},"5":{"start":{"line":7,"column":12},"end":{"line":7,"column":34}},"6":{"start":{"line":8,"column":0},"end":{"line":8,"column":28}}},"fnMap":{},"branchMap":{},"s":{"0":1,"1":1,"2":1,"3":1,"4":1,"5":1,"6":1},"f":{},"b":{},"inputSourceMap":{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAAA,6CAAoD;AAA5C,4BAAA,OAAO,CAAW;AAC1B,uCAA8C;AAAtC,wBAAA,OAAO,CAAS;AACxB,mCAA0C;AAAlC,oBAAA,OAAO,CAAO","sourcesContent":["export {default as helpers} from './helpers/helpers'\nexport {default as query} from './query/query'\nexport {default as url} from './query/url'\n"]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"4046e5e7dadd62e35952da53f0f51d34b2c01770"} | ||
,"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/helpers/helpers.ts": {"path":"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/helpers/helpers.ts","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":9,"column":15},"end":{"line":9,"column":17}},"2":{"start":{"line":10,"column":4},"end":{"line":12,"column":5}},"3":{"start":{"line":11,"column":8},"end":{"line":11,"column":37}},"4":{"start":{"line":13,"column":20},"end":{"line":13,"column":32}},"5":{"start":{"line":14,"column":4},"end":{"line":25,"column":5}},"6":{"start":{"line":15,"column":8},"end":{"line":24,"column":9}},"7":{"start":{"line":16,"column":12},"end":{"line":23,"column":15}},"8":{"start":{"line":17,"column":16},"end":{"line":22,"column":17}},"9":{"start":{"line":18,"column":20},"end":{"line":18,"column":52}},"10":{"start":{"line":21,"column":20},"end":{"line":21,"column":55}},"11":{"start":{"line":26,"column":4},"end":{"line":26,"column":18}},"12":{"start":{"line":28,"column":0},"end":{"line":28,"column":30}},"13":{"start":{"line":30,"column":4},"end":{"line":34,"column":18}},"14":{"start":{"line":42,"column":16},"end":{"line":42,"column":18}},"15":{"start":{"line":43,"column":4},"end":{"line":47,"column":5}},"16":{"start":{"line":44,"column":8},"end":{"line":46,"column":9}},"17":{"start":{"line":45,"column":12},"end":{"line":45,"column":54}},"18":{"start":{"line":48,"column":4},"end":{"line":48,"column":17}},"19":{"start":{"line":50,"column":14},"end":{"line":53,"column":1}},"20":{"start":{"line":54,"column":0},"end":{"line":54,"column":26}}},"fnMap":{"0":{"name":"deepMerge","decl":{"start":{"line":8,"column":9},"end":{"line":8,"column":18}},"loc":{"start":{"line":8,"column":27},"end":{"line":27,"column":1}},"line":8},"1":{"name":"(anonymous_1)","decl":{"start":{"line":16,"column":42},"end":{"line":16,"column":43}},"loc":{"start":{"line":16,"column":55},"end":{"line":23,"column":13}},"line":16},"2":{"name":"_arrOrObj","decl":{"start":{"line":29,"column":9},"end":{"line":29,"column":18}},"loc":{"start":{"line":29,"column":24},"end":{"line":35,"column":1}},"line":29},"3":{"name":"entries","decl":{"start":{"line":41,"column":9},"end":{"line":41,"column":16}},"loc":{"start":{"line":41,"column":22},"end":{"line":49,"column":1}},"line":41}},"branchMap":{"0":{"loc":{"start":{"line":15,"column":8},"end":{"line":24,"column":9}},"type":"if","locations":[{"start":{"line":15,"column":8},"end":{"line":24,"column":9}},{"start":{"line":15,"column":8},"end":{"line":24,"column":9}}],"line":15},"1":{"loc":{"start":{"line":17,"column":16},"end":{"line":22,"column":17}},"type":"if","locations":[{"start":{"line":17,"column":16},"end":{"line":22,"column":17}},{"start":{"line":17,"column":16},"end":{"line":22,"column":17}}],"line":17},"2":{"loc":{"start":{"line":30,"column":11},"end":{"line":34,"column":17}},"type":"cond-expr","locations":[{"start":{"line":31,"column":10},"end":{"line":31,"column":28}},{"start":{"line":32,"column":10},"end":{"line":34,"column":17}}],"line":30},"3":{"loc":{"start":{"line":32,"column":10},"end":{"line":34,"column":17}},"type":"cond-expr","locations":[{"start":{"line":33,"column":14},"end":{"line":33,"column":32}},{"start":{"line":34,"column":14},"end":{"line":34,"column":17}}],"line":32},"4":{"loc":{"start":{"line":44,"column":8},"end":{"line":46,"column":9}},"type":"if","locations":[{"start":{"line":44,"column":8},"end":{"line":46,"column":9}},{"start":{"line":44,"column":8},"end":{"line":46,"column":9}}],"line":44}},"s":{"0":3,"1":16,"2":16,"3":20,"4":16,"5":16,"6":20,"7":20,"8":47,"9":8,"10":39,"11":16,"12":3,"13":47,"14":21,"15":21,"16":50,"17":50,"18":21,"19":3,"20":3},"f":{"0":16,"1":47,"2":47,"3":21},"b":{"0":[20,0],"1":[8,39],"2":[5,42],"3":[5,37],"4":[50,0]},"inputSourceMap":{"version":3,"file":"helpers.js","sourceRoot":"","sources":["helpers.ts"],"names":[],"mappings":";;AAAA;;;;GAIG;AACH,mBAA2B,MAAW;IAAE,cAAO;SAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;QAAP,6BAAO;;IAC7C,IAAM,SAAS,GAAO,IAAI,QAAC,CAAA;IAC3B,GAAG,CAAC,CAAC,IAAM,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC;QAC1B,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;YACN,OAAO,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,UAAC,CAAC;gBAC9B,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;oBAC1B,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAA;gBACjC,CAAC;gBAAC,IAAI,CAAC,CAAC;oBACN,MAAM,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;gBACpC,CAAC;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;IACH,CAAC;IACD,MAAM,CAAC,MAAM,CAAA;AACf,CAAC;AAdD,8BAcC;AAED,mBAAmB,GAAQ;IACzB,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,GAAG,CAAC;UACrB,SAAS,CAAC,EAAE,EAAE,GAAG,CAAC;UAClB,OAAO,GAAG,KAAK,QAAQ;cACvB,SAAS,CAAC,EAAE,EAAE,GAAG,CAAC;cAClB,GAAG,CAAA;AACT,CAAC;AAED;;;;GAIG;AACH,iBAAiB,GAAW;IAC1B,IAAM,KAAK,GAAG,EAAE,CAAA;IAChB,GAAG,CAAC,CAAC,IAAM,GAAG,IAAI,GAAG,CAAC,CAAC,CAAC;QACtB,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;YACR,KAAK,CAAC,IAAI,CAAC,EAAE,GAAG,KAAA,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;QACtC,CAAC;IACH,CAAC;IACD,MAAM,CAAC,KAAK,CAAA;AACd,CAAC;AAED,IAAM,OAAO,GAAG;IACd,OAAO,SAAA;IACP,SAAS,WAAA;CACV,CAAA;AAED,kBAAe,OAAO,CAAA","sourcesContent":["/**\n * Merges n objects\n * @param {object} source Empty object that other objects will be merged into\n * @return {object} Merged objects\n */\nexport function deepMerge( source: any, ...args ) {\n const arrOfObjs = [...args]\n for (const i in arrOfObjs) {\n if (i) {\n entries(arrOfObjs[i]).forEach((p) => {\n if (Array.isArray(source)) {\n source.push(_arrOrObj(p.value))\n } else {\n source[p.key] = _arrOrObj(p.value)\n }\n })\n }\n }\n return source\n}\n\nfunction _arrOrObj(val: any) {\n return Array.isArray(val)\n ? deepMerge([], val)\n : typeof val === 'object'\n ? deepMerge({}, val)\n : val\n}\n\n/**\n * Iterates over an object and produces an array of key/val pairs\n * @param {object} obj Object to iterate over\n * @return {array} Array of key, val pairs.\n */\nfunction entries(obj: object) {\n const pairs = []\n for (const key in obj) {\n if (key) {\n pairs.push({ key, value: obj[key] })\n }\n }\n return pairs\n}\n\nconst helpers = {\n entries,\n deepMerge\n}\n\nexport default helpers\n"]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"3a32af63c5f1e4518701008e60d57017e825f875"} | ||
,"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/query/query.ts": {"path":"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/query/query.ts","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":9,"column":4},"end":{"line":11,"column":5}},"2":{"start":{"line":10,"column":8},"end":{"line":10,"column":76}},"3":{"start":{"line":10,"column":49},"end":{"line":10,"column":72}},"4":{"start":{"line":13,"column":0},"end":{"line":13,"column":26}},"5":{"start":{"line":20,"column":4},"end":{"line":26,"column":6}},"6":{"start":{"line":22,"column":12},"end":{"line":24,"column":14}},"7":{"start":{"line":28,"column":0},"end":{"line":28,"column":26}},"8":{"start":{"line":36,"column":4},"end":{"line":54,"column":5}},"9":{"start":{"line":38,"column":8},"end":{"line":48,"column":11}},"10":{"start":{"line":39,"column":12},"end":{"line":47,"column":13}},"11":{"start":{"line":40,"column":16},"end":{"line":40,"column":52}},"12":{"start":{"line":41,"column":16},"end":{"line":41,"column":50}},"13":{"start":{"line":42,"column":16},"end":{"line":42,"column":40}},"14":{"start":{"line":43,"column":16},"end":{"line":43,"column":26}},"15":{"start":{"line":46,"column":16},"end":{"line":46,"column":28}},"16":{"start":{"line":52,"column":8},"end":{"line":52,"column":78}},"17":{"start":{"line":53,"column":8},"end":{"line":53,"column":18}},"18":{"start":{"line":56,"column":0},"end":{"line":56,"column":58}},"19":{"start":{"line":64,"column":15},"end":{"line":64,"column":28}},"20":{"start":{"line":65,"column":4},"end":{"line":68,"column":7}},"21":{"start":{"line":67,"column":8},"end":{"line":67,"column":49}},"22":{"start":{"line":70,"column":0},"end":{"line":70,"column":26}},"23":{"start":{"line":71,"column":12},"end":{"line":75,"column":1}},"24":{"start":{"line":76,"column":0},"end":{"line":76,"column":24}}},"fnMap":{"0":{"name":"fsToArr","decl":{"start":{"line":8,"column":9},"end":{"line":8,"column":16}},"loc":{"start":{"line":8,"column":21},"end":{"line":12,"column":1}},"line":8},"1":{"name":"(anonymous_1)","decl":{"start":{"line":10,"column":31},"end":{"line":10,"column":32}},"loc":{"start":{"line":10,"column":47},"end":{"line":10,"column":74}},"line":10},"2":{"name":"arrToFs","decl":{"start":{"line":19,"column":9},"end":{"line":19,"column":16}},"loc":{"start":{"line":19,"column":22},"end":{"line":27,"column":1}},"line":19},"3":{"name":"(anonymous_3)","decl":{"start":{"line":21,"column":26},"end":{"line":21,"column":27}},"loc":{"start":{"line":21,"column":42},"end":{"line":25,"column":9}},"line":21},"4":{"name":"checkStatusAndParseJson","decl":{"start":{"line":34,"column":9},"end":{"line":34,"column":32}},"loc":{"start":{"line":34,"column":43},"end":{"line":55,"column":1}},"line":34},"5":{"name":"(anonymous_5)","decl":{"start":{"line":38,"column":36},"end":{"line":38,"column":37}},"loc":{"start":{"line":38,"column":52},"end":{"line":48,"column":9}},"line":38},"6":{"name":"getData","decl":{"start":{"line":63,"column":9},"end":{"line":63,"column":16}},"loc":{"start":{"line":63,"column":31},"end":{"line":69,"column":1}},"line":63},"7":{"name":"(anonymous_7)","decl":{"start":{"line":66,"column":14},"end":{"line":66,"column":15}},"loc":{"start":{"line":66,"column":34},"end":{"line":68,"column":5}},"line":66}},"branchMap":{"0":{"loc":{"start":{"line":9,"column":4},"end":{"line":11,"column":5}},"type":"if","locations":[{"start":{"line":9,"column":4},"end":{"line":11,"column":5}},{"start":{"line":9,"column":4},"end":{"line":11,"column":5}}],"line":9},"1":{"loc":{"start":{"line":36,"column":4},"end":{"line":54,"column":5}},"type":"if","locations":[{"start":{"line":36,"column":4},"end":{"line":54,"column":5}},{"start":{"line":36,"column":4},"end":{"line":54,"column":5}}],"line":36},"2":{"loc":{"start":{"line":36,"column":8},"end":{"line":36,"column":55}},"type":"binary-expr","locations":[{"start":{"line":36,"column":8},"end":{"line":36,"column":30}},{"start":{"line":36,"column":34},"end":{"line":36,"column":55}}],"line":36},"3":{"loc":{"start":{"line":39,"column":12},"end":{"line":47,"column":13}},"type":"if","locations":[{"start":{"line":39,"column":12},"end":{"line":47,"column":13}},{"start":{"line":39,"column":12},"end":{"line":47,"column":13}}],"line":39},"4":{"loc":{"start":{"line":41,"column":27},"end":{"line":41,"column":49}},"type":"binary-expr","locations":[{"start":{"line":41,"column":27},"end":{"line":41,"column":42}},{"start":{"line":41,"column":46},"end":{"line":41,"column":49}}],"line":41},"5":{"loc":{"start":{"line":64,"column":15},"end":{"line":64,"column":28}},"type":"binary-expr","locations":[{"start":{"line":64,"column":15},"end":{"line":64,"column":22}},{"start":{"line":64,"column":26},"end":{"line":64,"column":28}}],"line":64}},"s":{"0":2,"1":1,"2":1,"3":13,"4":2,"5":1,"6":13,"7":2,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":2,"19":0,"20":0,"21":0,"22":2,"23":2,"24":2},"f":{"0":1,"1":13,"2":1,"3":13,"4":0,"5":0,"6":0,"7":0},"b":{"0":[1,0],"1":[0,0],"2":[0,0],"3":[0,0],"4":[0,0],"5":[0,0]},"inputSourceMap":{"version":3,"file":"query.js","sourceRoot":"","sources":["query.ts"],"names":[],"mappings":";;AACA;;;;GAIG;AACH,iBAAwB,EAAO;IAC7B,EAAE,CAAC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,CAAC;AACH,CAAC;AAnBD,0DAmBC;AAED;;;;;GAKG;AACH,iBAAwB,GAAW,EAAE,OAAY;IAC/C,IAAM,IAAI,GAAG,OAAO,IAAI,EAAE,CAAA;IAC1B,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC;SACpB,IAAI,CAAC,UAAC,QAAQ;QACb,MAAM,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;AACN,CAAC;AAND,0BAMC;AAED,IAAM,KAAK,GAAG;IACZ,OAAO,SAAA;IACP,OAAO,SAAA;IACP,OAAO,SAAA;CACR,CAAA;AAED,kBAAe,KAAK,CAAA","sourcesContent":["\n/**\n * Convert feature service response to an array\n * @param {object} fs Feature service response\n * @return {array} response object as an array\n */\nexport function fsToArr(fs: any): any[] {\n if (fs.features) {\n return fs.features.map((attr) => attr.attributes)\n }\n}\n\n/**\n * Convert array of attributes into a fs response\n * @param {any[]} arr Array of attribute objects\n * @return {object} FS response\n */\nexport function arrToFs(arr: any[]): any {\n return {\n features: arr.map((attr) => {\n return {\n attributes: attr\n }\n })\n }\n}\n\n/**\n * Handle FS errors && response\n * @param {object} response Response from a fetch\n * @return {Promise<any>} Returns a promise that resolves as JSON\n */\nexport function checkStatusAndParseJson(response: any): Promise<any> {\n let err\n if (response.status >= 200 && response.status < 300) {\n // check if this is a 200, but really a 400 error\n return response.json().then((json) => {\n if (json.error) {\n err = new Error(json.error.message)\n err.code = json.error.code || 404\n err.response = response\n throw err\n } else {\n return json\n }\n })\n } else {\n // response has a non 200 http code\n err = new Error(`Got ${response.status} ${response.statusText}`)\n throw err\n }\n}\n\n/**\n * Fetch data from a feature service\n * @param {string} url URL to fetch against\n * @param {any} options Potential options passed into fetch\n * @return {Promise<any>} FS response as JSON\n */\nexport function getData(url: string, options: any): Promise<any> {\n const opts = options || {}\n return fetch(url, opts)\n .then((response) => {\n return checkStatusAndParseJson(response)\n })\n}\n\nconst query = {\n fsToArr,\n arrToFs,\n getData\n}\n\nexport default query\n"]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"cf5cd7c4c54c44bef78f1c95ca644c4a83057c30"} | ||
,"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/query/url.ts": {"path":"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/query/url.ts","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":3,"column":16},"end":{"line":3,"column":45}},"2":{"start":{"line":5,"column":4},"end":{"line":14,"column":6}},"3":{"start":{"line":16,"column":0},"end":{"line":16,"column":36}},"4":{"start":{"line":18,"column":14},"end":{"line":18,"column":16}},"5":{"start":{"line":19,"column":4},"end":{"line":27,"column":5}},"6":{"start":{"line":20,"column":8},"end":{"line":26,"column":9}},"7":{"start":{"line":21,"column":22},"end":{"line":21,"column":35}},"8":{"start":{"line":22,"column":12},"end":{"line":24,"column":13}},"9":{"start":{"line":23,"column":16},"end":{"line":23,"column":42}},"10":{"start":{"line":25,"column":12},"end":{"line":25,"column":80}},"11":{"start":{"line":28,"column":4},"end":{"line":28,"column":25}},"12":{"start":{"line":30,"column":0},"end":{"line":30,"column":52}},"13":{"start":{"line":32,"column":16},"end":{"line":32,"column":70}},"14":{"start":{"line":34,"column":4},"end":{"line":52,"column":5}},"15":{"start":{"line":36,"column":8},"end":{"line":38,"column":9}},"16":{"start":{"line":37,"column":12},"end":{"line":37,"column":95}},"17":{"start":{"line":40,"column":22},"end":{"line":40,"column":43}},"18":{"start":{"line":42,"column":8},"end":{"line":42,"column":26}},"19":{"start":{"line":44,"column":8},"end":{"line":49,"column":11}},"20":{"start":{"line":51,"column":8},"end":{"line":51,"column":28}},"21":{"start":{"line":53,"column":4},"end":{"line":55,"column":5}},"22":{"start":{"line":54,"column":8},"end":{"line":54,"column":66}},"23":{"start":{"line":56,"column":19},"end":{"line":56,"column":72}},"24":{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},"25":{"start":{"line":58,"column":8},"end":{"line":58,"column":56}},"26":{"start":{"line":60,"column":4},"end":{"line":60,"column":20}},"27":{"start":{"line":62,"column":0},"end":{"line":62,"column":66}},"28":{"start":{"line":63,"column":10},"end":{"line":67,"column":1}},"29":{"start":{"line":68,"column":0},"end":{"line":68,"column":22}}},"fnMap":{"0":{"name":"defaultQuery","decl":{"start":{"line":4,"column":9},"end":{"line":4,"column":21}},"loc":{"start":{"line":4,"column":24},"end":{"line":15,"column":1}},"line":4},"1":{"name":"serializeQueryParams","decl":{"start":{"line":17,"column":9},"end":{"line":17,"column":29}},"loc":{"start":{"line":17,"column":38},"end":{"line":29,"column":1}},"line":17},"2":{"name":"createFeatureServiceRequest","decl":{"start":{"line":31,"column":9},"end":{"line":31,"column":36}},"loc":{"start":{"line":31,"column":46},"end":{"line":61,"column":1}},"line":31}},"branchMap":{"0":{"loc":{"start":{"line":20,"column":8},"end":{"line":26,"column":9}},"type":"if","locations":[{"start":{"line":20,"column":8},"end":{"line":26,"column":9}},{"start":{"line":20,"column":8},"end":{"line":26,"column":9}}],"line":20},"1":{"loc":{"start":{"line":22,"column":12},"end":{"line":24,"column":13}},"type":"if","locations":[{"start":{"line":22,"column":12},"end":{"line":24,"column":13}},{"start":{"line":22,"column":12},"end":{"line":24,"column":13}}],"line":22},"2":{"loc":{"start":{"line":34,"column":4},"end":{"line":52,"column":5}},"type":"if","locations":[{"start":{"line":34,"column":4},"end":{"line":52,"column":5}},{"start":{"line":34,"column":4},"end":{"line":52,"column":5}}],"line":34},"3":{"loc":{"start":{"line":36,"column":8},"end":{"line":38,"column":9}},"type":"if","locations":[{"start":{"line":36,"column":8},"end":{"line":38,"column":9}},{"start":{"line":36,"column":8},"end":{"line":38,"column":9}}],"line":36},"4":{"loc":{"start":{"line":53,"column":4},"end":{"line":55,"column":5}},"type":"if","locations":[{"start":{"line":53,"column":4},"end":{"line":55,"column":5}},{"start":{"line":53,"column":4},"end":{"line":55,"column":5}}],"line":53},"5":{"loc":{"start":{"line":53,"column":8},"end":{"line":53,"column":72}},"type":"binary-expr","locations":[{"start":{"line":53,"column":8},"end":{"line":53,"column":29}},{"start":{"line":53,"column":33},"end":{"line":53,"column":72}}],"line":53},"6":{"loc":{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},"type":"if","locations":[{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},{"start":{"line":57,"column":4},"end":{"line":59,"column":5}}],"line":57}},"s":{"0":2,"1":2,"2":3,"3":2,"4":2,"5":2,"6":19,"7":19,"8":19,"9":8,"10":19,"11":2,"12":2,"13":2,"14":2,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":2,"22":1,"23":2,"24":2,"25":0,"26":2,"27":2,"28":2,"29":2},"f":{"0":3,"1":2,"2":2},"b":{"0":[19,0],"1":[8,11],"2":[0,2],"3":[0,0],"4":[1,1],"5":[2,1],"6":[0,2]},"inputSourceMap":{"version":3,"file":"url.js","sourceRoot":"","sources":["url.ts"],"names":[],"mappings":";;AAAA,8CAA4C;AAE5C;IACE,MAAM,CAAC;QACL,KAAK,EAAE,KAAK;QACZ,cAAc,EAAE,KAAK;QACrB,oBAAoB,EAAE,KAAK;QAC3B,aAAa,EAAE,KAAK;QACpB,eAAe,EAAE,KAAK;QACtB,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,UAAU;QACrB,CAAC,EAAE,MAAM;KACV,CAAA;AACH,CAAC;AAXD,oCAWC;AAED,8BAAqC,MAAW;IAC9C,IAAM,GAAG,GAAa,EAAE,CAAA;IACxB,GAAG,CAAC,CAAC,IAAM,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC;QAC3B,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;YACjC,IAAI,GAAG,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;YACvB,EAAE,CAAC,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC,CAAC,CAAC;gBAC5B,GAAG,GAAG,IAAI,CA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AAa,CAAC,CAAA;IAC3D,CAAC;IAED,IAAI,QAAQ,GAAM,OAAO,CAAC,GAAG,eAAU,oBAAoB,CAAC,KAAK,CAAG,CAAA;IAEpE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAClB,QAAQ,GAAM,QAAQ,eAAU,OAAO,CAAC,KAAO,CAAA;IACjD,CAAC;IAED,MAAM,CAAC,QAAQ,CAAA;AACjB,CAAC;AArCD,kEAqCC;AAED,IAAM,GAAG,GAAG;IACV,YAAY,cAAA;IACZ,oBAAoB,sBAAA;IACpB,2BAA2B,6BAAA;CAC5B,CAAA;AAED,kBAAe,GAAG,CAAA","sourcesContent":["import {deepMerge} from '../helpers/helpers'\n\nexport function defaultQuery() {\n return {\n where: '1=1',\n returnGeometry: false,\n returnDistinctValues: false,\n returnIdsOnly: false,\n returnCountOnly: false,\n outFields: '*',\n sqlFormat: 'standard',\n f: 'json'\n }\n}\n\nexport function serializeQueryParams(params: any): string {\n const str: string[] = []\n for (const param in params) {\n if (params.hasOwnProperty(param)) {\n let val = params[param]\n if (typeof val !== 'string') {\n val = JSON.stringify(val)\n }\n str.push(`${encodeURIComponent(param)}=${encodeURIComponent(val)}`)\n }\n }\n return str.join('&')\n}\n\nexport function createFeatureServiceRequest(dataset: any): string {\n const query = deepMerge({}, defaultQuery(), dataset.query)\n\n // Handle bbox\n if (query.bbox) {\n // make sure a geometry was not also passed in\n if (query.geometry) {\n throw new Error('Dataset.query can not have both a geometry and a bbox specified')\n }\n // Get the bbox (w,s,e,n)\n const bboxArr = query.bbox.split(',')\n\n // Remove it so it's not serialized as-is\n delete query.bbox\n\n // cook it into a json string\n query.geometry = JSON.stringify({\n xmin: bboxArr[0],\n ymin: bboxArr[2],\n xmax: bboxArr[1],\n ymax: bboxArr[3]\n })\n // set spatial ref as geographic\n query.inSR = '4326'\n }\n\n if (!!query.outStatistics && typeof query.outStatistics !== 'string') {\n query.outStatistics = JSON.stringify(query.outStatistics)\n }\n\n let builtUrl = `${dataset.url}/query?${serializeQueryParams(query)}`\n\n if (dataset.token) {\n builtUrl = `${builtUrl}&token=${dataset.token}`\n }\n\n return builtUrl\n}\n\nconst url = {\n defaultQuery,\n serializeQueryParams,\n createFeatureServiceRequest\n}\n\nexport default url\n"]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"fba9e0205785d4f663c506a7c16962727896e16c"} | ||
{"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/index.ts": {"path":"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/index.ts","statementMap":{"0":{"start":{"line":3,"column":4},"end":{"line":3,"column":71}},"1":{"start":{"line":3,"column":21},"end":{"line":3,"column":71}},"2":{"start":{"line":3,"column":53},"end":{"line":3,"column":71}},"3":{"start":{"line":5,"column":0},"end":{"line":5,"column":62}},"4":{"start":{"line":6,"column":0},"end":{"line":6,"column":39}},"5":{"start":{"line":7,"column":0},"end":{"line":7,"column":35}},"6":{"start":{"line":8,"column":0},"end":{"line":8,"column":33}},"7":{"start":{"line":9,"column":0},"end":{"line":9,"column":39}}},"fnMap":{"0":{"name":"__export","decl":{"start":{"line":2,"column":9},"end":{"line":2,"column":17}},"loc":{"start":{"line":2,"column":21},"end":{"line":4,"column":1}},"line":2}},"branchMap":{"0":{"loc":{"start":{"line":3,"column":21},"end":{"line":3,"column":71}},"type":"if","locations":[{"start":{"line":3,"column":21},"end":{"line":3,"column":71}},{"start":{"line":3,"column":21},"end":{"line":3,"column":71}}],"line":3}},"s":{"0":4,"1":19,"2":16,"3":1,"4":1,"5":1,"6":1,"7":1},"f":{"0":4},"b":{"0":[16,3]},"inputSourceMap":{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;AAAA,uCAAiC;AACjC,mCAA8B;AAC9B,iCAA2B;AAC3B,uCAAiC","sourcesContent":["export * from './helpers/helpers'\nexport * from './query/query'\nexport * from './query/url'\nexport * from './flatten/flatten'\n"]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"b0af261cb87308f695c9b8929a8f69071f54e8fe"} | ||
,"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/flatten/flatten.ts": {"path":"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/flatten/flatten.ts","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":4,"column":4},"end":{"line":4,"column":30}},"2":{"start":{"line":7,"column":4},"end":{"line":7,"column":87}},"3":{"start":{"line":9,"column":0},"end":{"line":9,"column":44}},"4":{"start":{"line":11,"column":16},"end":{"line":11,"column":18}},"5":{"start":{"line":12,"column":4},"end":{"line":21,"column":7}},"6":{"start":{"line":13,"column":28},"end":{"line":13,"column":63}},"7":{"start":{"line":14,"column":8},"end":{"line":20,"column":11}},"8":{"start":{"line":15,"column":22},"end":{"line":15,"column":54}},"9":{"start":{"line":16,"column":12},"end":{"line":18,"column":13}},"10":{"start":{"line":17,"column":16},"end":{"line":17,"column":32}},"11":{"start":{"line":19,"column":12},"end":{"line":19,"column":53}},"12":{"start":{"line":22,"column":4},"end":{"line":22,"column":17}},"13":{"start":{"line":24,"column":0},"end":{"line":24,"column":32}},"14":{"start":{"line":27,"column":19},"end":{"line":27,"column":32}},"15":{"start":{"line":28,"column":22},"end":{"line":28,"column":38}},"16":{"start":{"line":29,"column":25},"end":{"line":29,"column":44}},"17":{"start":{"line":30,"column":19},"end":{"line":30,"column":21}},"18":{"start":{"line":32,"column":4},"end":{"line":40,"column":5}},"19":{"start":{"line":33,"column":8},"end":{"line":38,"column":11}},"20":{"start":{"line":34,"column":32},"end":{"line":34,"column":67}},"21":{"start":{"line":35,"column":12},"end":{"line":37,"column":15}},"22":{"start":{"line":36,"column":16},"end":{"line":36,"column":54}},"23":{"start":{"line":39,"column":8},"end":{"line":39,"column":24}},"24":{"start":{"line":42,"column":16},"end":{"line":42,"column":65}},"25":{"start":{"line":43,"column":14},"end":{"line":43,"column":25}},"26":{"start":{"line":44,"column":15},"end":{"line":44,"column":33}},"27":{"start":{"line":45,"column":4},"end":{"line":56,"column":7}},"28":{"start":{"line":46,"column":21},"end":{"line":46,"column":34}},"29":{"start":{"line":47,"column":22},"end":{"line":47,"column":55}},"30":{"start":{"line":48,"column":8},"end":{"line":54,"column":11}},"31":{"start":{"line":49,"column":27},"end":{"line":49,"column":43}},"32":{"start":{"line":50,"column":12},"end":{"line":53,"column":15}},"33":{"start":{"line":51,"column":27},"end":{"line":51,"column":39}},"34":{"start":{"line":52,"column":16},"end":{"line":52,"column":40}},"35":{"start":{"line":55,"column":8},"end":{"line":55,"column":31}},"36":{"start":{"line":57,"column":4},"end":{"line":57,"column":20}},"37":{"start":{"line":59,"column":0},"end":{"line":59,"column":42}},"38":{"start":{"line":60,"column":0},"end":{"line":60,"column":34}}},"fnMap":{"0":{"name":"_defaultTransformFunc","decl":{"start":{"line":3,"column":9},"end":{"line":3,"column":30}},"loc":{"start":{"line":3,"column":40},"end":{"line":5,"column":1}},"line":3},"1":{"name":"getTransformFunc","decl":{"start":{"line":6,"column":9},"end":{"line":6,"column":25}},"loc":{"start":{"line":6,"column":41},"end":{"line":8,"column":1}},"line":6},"2":{"name":"buildIndex","decl":{"start":{"line":10,"column":9},"end":{"line":10,"column":19}},"loc":{"start":{"line":10,"column":59},"end":{"line":23,"column":1}},"line":10},"3":{"name":"(anonymous_3)","decl":{"start":{"line":12,"column":24},"end":{"line":12,"column":25}},"loc":{"start":{"line":12,"column":49},"end":{"line":21,"column":5}},"line":12},"4":{"name":"(anonymous_4)","decl":{"start":{"line":14,"column":36},"end":{"line":14,"column":37}},"loc":{"start":{"line":14,"column":59},"end":{"line":20,"column":9}},"line":14},"5":{"name":"flattenFeatures","decl":{"start":{"line":25,"column":9},"end":{"line":25,"column":24}},"loc":{"start":{"line":25,"column":31},"end":{"line":58,"column":1}},"line":25},"6":{"name":"(anonymous_6)","decl":{"start":{"line":33,"column":28},"end":{"line":33,"column":29}},"loc":{"start":{"line":33,"column":53},"end":{"line":38,"column":9}},"line":33},"7":{"name":"(anonymous_7)","decl":{"start":{"line":35,"column":40},"end":{"line":35,"column":41}},"loc":{"start":{"line":35,"column":62},"end":{"line":37,"column":13}},"line":35},"8":{"name":"(anonymous_8)","decl":{"start":{"line":45,"column":17},"end":{"line":45,"column":18}},"loc":{"start":{"line":45,"column":38},"end":{"line":56,"column":5}},"line":45},"9":{"name":"(anonymous_9)","decl":{"start":{"line":48,"column":23},"end":{"line":48,"column":24}},"loc":{"start":{"line":48,"column":41},"end":{"line":54,"column":9}},"line":48},"10":{"name":"(anonymous_10)","decl":{"start":{"line":50,"column":29},"end":{"line":50,"column":30}},"loc":{"start":{"line":50,"column":46},"end":{"line":53,"column":13}},"line":50}},"branchMap":{"0":{"loc":{"start":{"line":7,"column":11},"end":{"line":7,"column":86}},"type":"cond-expr","locations":[{"start":{"line":7,"column":49},"end":{"line":7,"column":62}},{"start":{"line":7,"column":65},"end":{"line":7,"column":86}}],"line":7},"1":{"loc":{"start":{"line":16,"column":12},"end":{"line":18,"column":13}},"type":"if","locations":[{"start":{"line":16,"column":12},"end":{"line":18,"column":13}},{"start":{"line":16,"column":12},"end":{"line":18,"column":13}}],"line":16},"2":{"loc":{"start":{"line":32,"column":4},"end":{"line":40,"column":5}},"type":"if","locations":[{"start":{"line":32,"column":4},"end":{"line":40,"column":5}},{"start":{"line":32,"column":4},"end":{"line":40,"column":5}}],"line":32}},"s":{"0":2,"1":21,"2":9,"3":2,"4":2,"5":2,"6":6,"7":6,"8":14,"9":14,"10":6,"11":14,"12":2,"13":2,"14":2,"15":2,"16":2,"17":2,"18":2,"19":1,"20":3,"21":3,"22":7,"23":1,"24":1,"25":1,"26":1,"27":1,"28":3,"29":3,"30":3,"31":7,"32":7,"33":14,"34":14,"35":3,"36":1,"37":2,"38":2},"f":{"0":21,"1":9,"2":2,"3":6,"4":14,"5":2,"6":3,"7":7,"8":3,"9":7,"10":14},"b":{"0":[0,9],"1":[6,8],"2":[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,CAAC,CAAC,CAAA;IAEF,MAAM,CAAC,QAAQ,CAAA;AACjB,CAAC;AApCD,0CAoCC;AAED,kBAAe,eAAe,CAAA","sourcesContent":["function _defaultTransformFunc(feature: any) {\n return feature.attributes\n}\n\nexport function getTransformFunc(transformFunc: any) {\n return typeof transformFunc === 'function' ? transformFunc : _defaultTransformFunc\n}\n\nexport function buildIndex(joinKeys: string[], featureSets: any[], transformFuncs: any[]) {\n const index = {}\n featureSets.forEach((featureSet, i) => {\n const transformFunc = getTransformFunc(transformFuncs[i])\n featureSet.features.forEach((features, j) => {\n const idx = features.attributes[joinKeys[i]]\n if (index[idx] === undefined) {\n index[idx] = []\n }\n index[idx].push(transformFunc(features))\n })\n })\n return index\n}\n\nexport function flattenFeatures(data: any) {\n // TODO: Transform data\n const joinKeys: any[] = data.joinKeys\n const featureSets: any[] = data.featureSets\n const transformFuncs: any[] = data.transformFuncs\n const features = []\n\n // If we aren't joining, but we are merging\n if (joinKeys.length === 0) {\n featureSets.forEach((featureSet, i) => {\n const transformFunc = getTransformFunc(transformFuncs[i])\n featureSet.features.forEach((feature, j) => {\n features.push(transformFunc(feature))\n })\n })\n return features\n }\n\n // Otherwise join\n const index = buildIndex(joinKeys, featureSets, transformFuncs)\n const key = joinKeys[0] // TODO: support different `category` keys\n const keys = Object.keys(index)\n keys.forEach((indKey, i) => {\n const idxArr = index[indKey]\n const feature = { categoryField: idxArr[0][key] }\n idxArr.forEach((idx, k) => {\n const attrKeys = Object.keys(idx)\n attrKeys.forEach((ak, j) => {\n const attr = `${ak}_${k}`\n feature[attr] = idx[ak]\n })\n })\n features.push(feature)\n })\n\n return features\n}\n\nexport default flattenFeatures\n"]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"092e94d05407b593e3f8ba3814a7e1affeb8c6d7"} | ||
,"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/helpers/helpers.ts": {"path":"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/helpers/helpers.ts","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":9,"column":15},"end":{"line":9,"column":17}},"2":{"start":{"line":10,"column":4},"end":{"line":12,"column":5}},"3":{"start":{"line":11,"column":8},"end":{"line":11,"column":37}},"4":{"start":{"line":13,"column":20},"end":{"line":13,"column":32}},"5":{"start":{"line":14,"column":4},"end":{"line":25,"column":5}},"6":{"start":{"line":15,"column":8},"end":{"line":24,"column":9}},"7":{"start":{"line":16,"column":12},"end":{"line":23,"column":15}},"8":{"start":{"line":17,"column":16},"end":{"line":22,"column":17}},"9":{"start":{"line":18,"column":20},"end":{"line":18,"column":52}},"10":{"start":{"line":21,"column":20},"end":{"line":21,"column":55}},"11":{"start":{"line":26,"column":4},"end":{"line":26,"column":18}},"12":{"start":{"line":28,"column":0},"end":{"line":28,"column":30}},"13":{"start":{"line":30,"column":4},"end":{"line":34,"column":18}},"14":{"start":{"line":42,"column":16},"end":{"line":42,"column":18}},"15":{"start":{"line":43,"column":4},"end":{"line":47,"column":5}},"16":{"start":{"line":44,"column":8},"end":{"line":46,"column":9}},"17":{"start":{"line":45,"column":12},"end":{"line":45,"column":54}},"18":{"start":{"line":48,"column":4},"end":{"line":48,"column":17}},"19":{"start":{"line":50,"column":0},"end":{"line":50,"column":26}},"20":{"start":{"line":51,"column":0},"end":{"line":54,"column":2}},"21":{"start":{"line":55,"column":0},"end":{"line":55,"column":34}}},"fnMap":{"0":{"name":"deepMerge","decl":{"start":{"line":8,"column":9},"end":{"line":8,"column":18}},"loc":{"start":{"line":8,"column":27},"end":{"line":27,"column":1}},"line":8},"1":{"name":"(anonymous_1)","decl":{"start":{"line":16,"column":42},"end":{"line":16,"column":43}},"loc":{"start":{"line":16,"column":55},"end":{"line":23,"column":13}},"line":16},"2":{"name":"_arrOrObj","decl":{"start":{"line":29,"column":9},"end":{"line":29,"column":18}},"loc":{"start":{"line":29,"column":24},"end":{"line":35,"column":1}},"line":29},"3":{"name":"entries","decl":{"start":{"line":41,"column":9},"end":{"line":41,"column":16}},"loc":{"start":{"line":41,"column":22},"end":{"line":49,"column":1}},"line":41}},"branchMap":{"0":{"loc":{"start":{"line":15,"column":8},"end":{"line":24,"column":9}},"type":"if","locations":[{"start":{"line":15,"column":8},"end":{"line":24,"column":9}},{"start":{"line":15,"column":8},"end":{"line":24,"column":9}}],"line":15},"1":{"loc":{"start":{"line":17,"column":16},"end":{"line":22,"column":17}},"type":"if","locations":[{"start":{"line":17,"column":16},"end":{"line":22,"column":17}},{"start":{"line":17,"column":16},"end":{"line":22,"column":17}}],"line":17},"2":{"loc":{"start":{"line":30,"column":11},"end":{"line":34,"column":17}},"type":"cond-expr","locations":[{"start":{"line":31,"column":10},"end":{"line":31,"column":28}},{"start":{"line":32,"column":10},"end":{"line":34,"column":17}}],"line":30},"3":{"loc":{"start":{"line":32,"column":10},"end":{"line":34,"column":17}},"type":"cond-expr","locations":[{"start":{"line":33,"column":14},"end":{"line":33,"column":32}},{"start":{"line":34,"column":14},"end":{"line":34,"column":17}}],"line":32},"4":{"loc":{"start":{"line":44,"column":8},"end":{"line":46,"column":9}},"type":"if","locations":[{"start":{"line":44,"column":8},"end":{"line":46,"column":9}},{"start":{"line":44,"column":8},"end":{"line":46,"column":9}}],"line":44}},"s":{"0":3,"1":16,"2":16,"3":20,"4":16,"5":16,"6":20,"7":20,"8":47,"9":8,"10":39,"11":16,"12":3,"13":47,"14":21,"15":21,"16":50,"17":50,"18":21,"19":3,"20":3,"21":3},"f":{"0":16,"1":47,"2":47,"3":21},"b":{"0":[20,0],"1":[8,39],"2":[5,42],"3":[5,37],"4":[50,0]},"inputSourceMap":{"version":3,"file":"helpers.js","sourceRoot":"","sources":["helpers.ts"],"names":[],"mappings":";;AAAA;;;;GAIG;AACH,mBAA2B,MAAW;IAAE,cAAO;SAAP,UAAO,EAAP,qBAAO,EAAP,IAAO;QAAP,6BAAO;;IAC7C,IAAM,SAAS,GAAO,IAAI,QAAC,CAAA;IAC3B,GAA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,CAAA;AAED,kBAAe,eAAO,CAAA","sourcesContent":["/**\n * Merges n objects\n * @param {object} source Empty object that other objects will be merged into\n * @return {object} Merged objects\n */\nexport function deepMerge( source: any, ...args ) {\n const arrOfObjs = [...args]\n for (const i in arrOfObjs) {\n if (i) {\n entries(arrOfObjs[i]).forEach((p) => {\n if (Array.isArray(source)) {\n source.push(_arrOrObj(p.value))\n } else {\n source[p.key] = _arrOrObj(p.value)\n }\n })\n }\n }\n return source\n}\n\nfunction _arrOrObj(val: any) {\n return Array.isArray(val)\n ? deepMerge([], val)\n : typeof val === 'object'\n ? deepMerge({}, val)\n : val\n}\n\n/**\n * Iterates over an object and produces an array of key/val pairs\n * @param {object} obj Object to iterate over\n * @return {array} Array of key, val pairs.\n */\nexport function entries(obj: object) {\n const pairs = []\n for (const key in obj) {\n if (key) {\n pairs.push({ key, value: obj[key] })\n }\n }\n return pairs\n}\n\nexport const helpers = {\n entries,\n deepMerge\n}\n\nexport default helpers\n"]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"1ff773cd3acb41e154e1021a254ab4932a6bc884"} | ||
,"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/query/query.ts": {"path":"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/query/query.ts","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":9,"column":4},"end":{"line":11,"column":5}},"2":{"start":{"line":10,"column":8},"end":{"line":10,"column":76}},"3":{"start":{"line":10,"column":49},"end":{"line":10,"column":72}},"4":{"start":{"line":13,"column":0},"end":{"line":13,"column":26}},"5":{"start":{"line":20,"column":4},"end":{"line":26,"column":6}},"6":{"start":{"line":22,"column":12},"end":{"line":24,"column":14}},"7":{"start":{"line":28,"column":0},"end":{"line":28,"column":26}},"8":{"start":{"line":36,"column":4},"end":{"line":54,"column":5}},"9":{"start":{"line":38,"column":8},"end":{"line":48,"column":11}},"10":{"start":{"line":39,"column":12},"end":{"line":47,"column":13}},"11":{"start":{"line":40,"column":16},"end":{"line":40,"column":52}},"12":{"start":{"line":41,"column":16},"end":{"line":41,"column":50}},"13":{"start":{"line":42,"column":16},"end":{"line":42,"column":40}},"14":{"start":{"line":43,"column":16},"end":{"line":43,"column":26}},"15":{"start":{"line":46,"column":16},"end":{"line":46,"column":28}},"16":{"start":{"line":52,"column":8},"end":{"line":52,"column":78}},"17":{"start":{"line":53,"column":8},"end":{"line":53,"column":18}},"18":{"start":{"line":56,"column":0},"end":{"line":56,"column":58}},"19":{"start":{"line":64,"column":15},"end":{"line":64,"column":28}},"20":{"start":{"line":65,"column":4},"end":{"line":68,"column":7}},"21":{"start":{"line":67,"column":8},"end":{"line":67,"column":49}},"22":{"start":{"line":70,"column":0},"end":{"line":70,"column":26}},"23":{"start":{"line":71,"column":0},"end":{"line":75,"column":2}},"24":{"start":{"line":76,"column":0},"end":{"line":76,"column":32}}},"fnMap":{"0":{"name":"fsToArr","decl":{"start":{"line":8,"column":9},"end":{"line":8,"column":16}},"loc":{"start":{"line":8,"column":21},"end":{"line":12,"column":1}},"line":8},"1":{"name":"(anonymous_1)","decl":{"start":{"line":10,"column":31},"end":{"line":10,"column":32}},"loc":{"start":{"line":10,"column":47},"end":{"line":10,"column":74}},"line":10},"2":{"name":"arrToFs","decl":{"start":{"line":19,"column":9},"end":{"line":19,"column":16}},"loc":{"start":{"line":19,"column":22},"end":{"line":27,"column":1}},"line":19},"3":{"name":"(anonymous_3)","decl":{"start":{"line":21,"column":26},"end":{"line":21,"column":27}},"loc":{"start":{"line":21,"column":42},"end":{"line":25,"column":9}},"line":21},"4":{"name":"checkStatusAndParseJson","decl":{"start":{"line":34,"column":9},"end":{"line":34,"column":32}},"loc":{"start":{"line":34,"column":43},"end":{"line":55,"column":1}},"line":34},"5":{"name":"(anonymous_5)","decl":{"start":{"line":38,"column":36},"end":{"line":38,"column":37}},"loc":{"start":{"line":38,"column":52},"end":{"line":48,"column":9}},"line":38},"6":{"name":"getData","decl":{"start":{"line":63,"column":9},"end":{"line":63,"column":16}},"loc":{"start":{"line":63,"column":31},"end":{"line":69,"column":1}},"line":63},"7":{"name":"(anonymous_7)","decl":{"start":{"line":66,"column":14},"end":{"line":66,"column":15}},"loc":{"start":{"line":66,"column":34},"end":{"line":68,"column":5}},"line":66}},"branchMap":{"0":{"loc":{"start":{"line":9,"column":4},"end":{"line":11,"column":5}},"type":"if","locations":[{"start":{"line":9,"column":4},"end":{"line":11,"column":5}},{"start":{"line":9,"column":4},"end":{"line":11,"column":5}}],"line":9},"1":{"loc":{"start":{"line":36,"column":4},"end":{"line":54,"column":5}},"type":"if","locations":[{"start":{"line":36,"column":4},"end":{"line":54,"column":5}},{"start":{"line":36,"column":4},"end":{"line":54,"column":5}}],"line":36},"2":{"loc":{"start":{"line":36,"column":8},"end":{"line":36,"column":55}},"type":"binary-expr","locations":[{"start":{"line":36,"column":8},"end":{"line":36,"column":30}},{"start":{"line":36,"column":34},"end":{"line":36,"column":55}}],"line":36},"3":{"loc":{"start":{"line":39,"column":12},"end":{"line":47,"column":13}},"type":"if","locations":[{"start":{"line":39,"column":12},"end":{"line":47,"column":13}},{"start":{"line":39,"column":12},"end":{"line":47,"column":13}}],"line":39},"4":{"loc":{"start":{"line":41,"column":27},"end":{"line":41,"column":49}},"type":"binary-expr","locations":[{"start":{"line":41,"column":27},"end":{"line":41,"column":42}},{"start":{"line":41,"column":46},"end":{"line":41,"column":49}}],"line":41},"5":{"loc":{"start":{"line":64,"column":15},"end":{"line":64,"column":28}},"type":"binary-expr","locations":[{"start":{"line":64,"column":15},"end":{"line":64,"column":22}},{"start":{"line":64,"column":26},"end":{"line":64,"column":28}}],"line":64}},"s":{"0":2,"1":1,"2":1,"3":13,"4":2,"5":1,"6":13,"7":2,"8":0,"9":0,"10":0,"11":0,"12":0,"13":0,"14":0,"15":0,"16":0,"17":0,"18":2,"19":0,"20":0,"21":0,"22":2,"23":2,"24":2},"f":{"0":1,"1":13,"2":1,"3":13,"4":0,"5":0,"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AC,CAAC,CAAA;IACJ,CAAC;IAAC,IAAI,CAAC,CAAC;QACN,mCAAmC;QACnC,GAAG,GAAG,IAAI,KAAK,CAAC,SAAO,QAAQ,CAAC,MAAM,SAAI,QAAQ,CAAC,UAAY,CAAC,CAAA;QAChE,MAAM,GAAG,CAAA;IACX,CAAC;AACH,CAAC;AAnBD,0DAmBC;AAED;;;;;GAKG;AACH,iBAAwB,GAAW,EAAE,OAAY;IAC/C,IAAM,IAAI,GAAG,OAAO,IAAI,EAAE,CAAA;IAC1B,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,IAAI,CAAC;SACpB,IAAI,CAAC,UAAC,QAAQ;QACb,MAAM,CAAC,uBAAuB,CAAC,QAAQ,CAAC,CAAA;IAC1C,CAAC,CAAC,CAAA;AACN,CAAC;AAND,0BAMC;AAEY,QAAA,KAAK,GAAG;IACnB,OAAO,SAAA;IACP,OAAO,SAAA;IACP,OAAO,SAAA;CACR,CAAA;AAED,kBAAe,aAAK,CAAA","sourcesContent":["\n/**\n * Convert feature service response to an array\n * @param {object} fs Feature service response\n * @return {array} response object as an array\n */\nexport function fsToArr(fs: any): any[] {\n if (fs.features) {\n return fs.features.map((attr) => attr.attributes)\n }\n}\n\n/**\n * Convert array of attributes into a fs response\n * @param {any[]} arr Array of attribute objects\n * @return {object} FS response\n */\nexport function arrToFs(arr: any[]): any {\n return {\n features: arr.map((attr) => {\n return {\n attributes: attr\n }\n })\n }\n}\n\n/**\n * Handle FS errors && response\n * @param {object} response Response from a fetch\n * @return {Promise<any>} Returns a promise that resolves as JSON\n */\nexport function checkStatusAndParseJson(response: any): Promise<any> {\n let err\n if (response.status >= 200 && response.status < 300) {\n // check if this is a 200, but really a 400 error\n return response.json().then((json) => {\n if (json.error) {\n err = new Error(json.error.message)\n err.code = json.error.code || 404\n err.response = response\n throw err\n } else {\n return json\n }\n })\n } else {\n // response has a non 200 http code\n err = new Error(`Got ${response.status} ${response.statusText}`)\n throw err\n }\n}\n\n/**\n * Fetch data from a feature service\n * @param {string} url URL to fetch against\n * @param {any} options Potential options passed into fetch\n * @return {Promise<any>} FS response as JSON\n */\nexport function getData(url: string, options: any): Promise<any> {\n const opts = options || {}\n return fetch(url, opts)\n .then((response) => {\n return checkStatusAndParseJson(response)\n })\n}\n\nexport const query = {\n fsToArr,\n arrToFs,\n getData\n}\n\nexport default query\n"]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"745746641a267631cec465e1378fc6450da34e7b"} | ||
,"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/query/url.ts": {"path":"/Users/ben7664/Cedar/cedar/packages/cedar-utils/src/query/url.ts","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":3,"column":16},"end":{"line":3,"column":45}},"2":{"start":{"line":5,"column":4},"end":{"line":14,"column":6}},"3":{"start":{"line":16,"column":0},"end":{"line":16,"column":36}},"4":{"start":{"line":18,"column":14},"end":{"line":18,"column":16}},"5":{"start":{"line":19,"column":4},"end":{"line":27,"column":5}},"6":{"start":{"line":20,"column":8},"end":{"line":26,"column":9}},"7":{"start":{"line":21,"column":22},"end":{"line":21,"column":35}},"8":{"start":{"line":22,"column":12},"end":{"line":24,"column":13}},"9":{"start":{"line":23,"column":16},"end":{"line":23,"column":42}},"10":{"start":{"line":25,"column":12},"end":{"line":25,"column":80}},"11":{"start":{"line":28,"column":4},"end":{"line":28,"column":25}},"12":{"start":{"line":30,"column":0},"end":{"line":30,"column":52}},"13":{"start":{"line":32,"column":16},"end":{"line":32,"column":70}},"14":{"start":{"line":34,"column":4},"end":{"line":52,"column":5}},"15":{"start":{"line":36,"column":8},"end":{"line":38,"column":9}},"16":{"start":{"line":37,"column":12},"end":{"line":37,"column":95}},"17":{"start":{"line":40,"column":22},"end":{"line":40,"column":43}},"18":{"start":{"line":42,"column":8},"end":{"line":42,"column":26}},"19":{"start":{"line":44,"column":8},"end":{"line":49,"column":11}},"20":{"start":{"line":51,"column":8},"end":{"line":51,"column":28}},"21":{"start":{"line":53,"column":4},"end":{"line":55,"column":5}},"22":{"start":{"line":54,"column":8},"end":{"line":54,"column":66}},"23":{"start":{"line":56,"column":19},"end":{"line":56,"column":72}},"24":{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},"25":{"start":{"line":58,"column":8},"end":{"line":58,"column":56}},"26":{"start":{"line":60,"column":4},"end":{"line":60,"column":20}},"27":{"start":{"line":62,"column":0},"end":{"line":62,"column":66}},"28":{"start":{"line":63,"column":0},"end":{"line":67,"column":2}},"29":{"start":{"line":68,"column":0},"end":{"line":68,"column":30}}},"fnMap":{"0":{"name":"defaultQuery","decl":{"start":{"line":4,"column":9},"end":{"line":4,"column":21}},"loc":{"start":{"line":4,"column":24},"end":{"line":15,"column":1}},"line":4},"1":{"name":"serializeQueryParams","decl":{"start":{"line":17,"column":9},"end":{"line":17,"column":29}},"loc":{"start":{"line":17,"column":38},"end":{"line":29,"column":1}},"line":17},"2":{"name":"createFeatureServiceRequest","decl":{"start":{"line":31,"column":9},"end":{"line":31,"column":36}},"loc":{"start":{"line":31,"column":46},"end":{"line":61,"column":1}},"line":31}},"branchMap":{"0":{"loc":{"start":{"line":20,"column":8},"end":{"line":26,"column":9}},"type":"if","locations":[{"start":{"line":20,"column":8},"end":{"line":26,"column":9}},{"start":{"line":20,"column":8},"end":{"line":26,"column":9}}],"line":20},"1":{"loc":{"start":{"line":22,"column":12},"end":{"line":24,"column":13}},"type":"if","locations":[{"start":{"line":22,"column":12},"end":{"line":24,"column":13}},{"start":{"line":22,"column":12},"end":{"line":24,"column":13}}],"line":22},"2":{"loc":{"start":{"line":34,"column":4},"end":{"line":52,"column":5}},"type":"if","locations":[{"start":{"line":34,"column":4},"end":{"line":52,"column":5}},{"start":{"line":34,"column":4},"end":{"line":52,"column":5}}],"line":34},"3":{"loc":{"start":{"line":36,"column":8},"end":{"line":38,"column":9}},"type":"if","locations":[{"start":{"line":36,"column":8},"end":{"line":38,"column":9}},{"start":{"line":36,"column":8},"end":{"line":38,"column":9}}],"line":36},"4":{"loc":{"start":{"line":53,"column":4},"end":{"line":55,"column":5}},"type":"if","locations":[{"start":{"line":53,"column":4},"end":{"line":55,"column":5}},{"start":{"line":53,"column":4},"end":{"line":55,"column":5}}],"line":53},"5":{"loc":{"start":{"line":53,"column":8},"end":{"line":53,"column":72}},"type":"binary-expr","locations":[{"start":{"line":53,"column":8},"end":{"line":53,"column":29}},{"start":{"line":53,"column":33},"end":{"line":53,"column":72}}],"line":53},"6":{"loc":{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},"type":"if","locations":[{"start":{"line":57,"column":4},"end":{"line":59,"column":5}},{"start":{"line":57,"column":4},"end":{"line":59,"column":5}}],"line":57}},"s":{"0":2,"1":2,"2":3,"3":2,"4":2,"5":2,"6":19,"7":19,"8":19,"9":8,"10":19,"11":2,"12":2,"13":2,"14":2,"15":0,"16":0,"17":0,"18":0,"19":0,"20":0,"21":2,"22":1,"23":2,"24":2,"25":0,"26":2,"27":2,"28":2,"29":2},"f":{"0":3,"1":2,"2":2},"b":{"0":[19,0],"1":[8,11],"2":[0,2],"3":[0,0],"4":[1,1],"5":[2,1],"6":[0,2]},"inputSourceMap":{"version":3,"file":"url.js","sourceRoot":"","sources":["url.ts"],"names":[],"mappings":";;AAAA,8CAA4C;AAE5C;IACE,MAAM,CAAC;QACL,KAAK,EAAE,KAAK;QACZ,cAAc,EAAE,KAAK;QACrB,oBAAoB,EAAE,KAAK;QAC3B,aAAa,EAAE,KAAK;QACpB,eAAe,EAAE,KAAK;QACtB,SAAS,EAAE,GAAG;QACd,SAAS,EAAE,UAAU;QACrB,CAAC,EAAE,MAAM;KACV,CAAA;AACH,CAAC;AAXD,oCAWC;AAED,8BAAqC,MAAW;IAC9C,IAAM,GAAG,GAAa,EAAE,CAAA;IACxB,GAAG,CAAC,CAAC,IAAM,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC;QAC3B,EAAE,CAAC,CAAC,MAAM,CAAC,cAAc,CA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C;IAED,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,aAAa,IAAI,OAAO,KAAK,CAAC,aAAa,KAAK,QAAQ,CAAC,CAAC,CAAC;QACrE,KAAK,CAAC,aAAa,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,aAAa,CAAC,CAAA;IAC3D,CAAC;IAED,IAAI,QAAQ,GAAM,OAAO,CAAC,GAAG,eAAU,oBAAoB,CAAC,KAAK,CAAG,CAAA;IAEpE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;QAClB,QAAQ,GAAM,QAAQ,eAAU,OAAO,CAAC,KAAO,CAAA;IACjD,CAAC;IAED,MAAM,CAAC,QAAQ,CAAA;AACjB,CAAC;AArCD,kEAqCC;AAEY,QAAA,GAAG,GAAG;IACjB,YAAY,cAAA;IACZ,oBAAoB,sBAAA;IACpB,2BAA2B,6BAAA;CAC5B,CAAA;AAED,kBAAe,WAAG,CAAA","sourcesContent":["import {deepMerge} from '../helpers/helpers'\n\nexport function defaultQuery() {\n return {\n where: '1=1',\n returnGeometry: false,\n returnDistinctValues: false,\n returnIdsOnly: false,\n returnCountOnly: false,\n outFields: '*',\n sqlFormat: 'standard',\n f: 'json'\n }\n}\n\nexport function serializeQueryParams(params: any): string {\n const str: string[] = []\n for (const param in params) {\n if (params.hasOwnProperty(param)) {\n let val = params[param]\n if (typeof val !== 'string') {\n val = JSON.stringify(val)\n }\n str.push(`${encodeURIComponent(param)}=${encodeURIComponent(val)}`)\n }\n }\n return str.join('&')\n}\n\nexport function createFeatureServiceRequest(dataset: any): string {\n const query = deepMerge({}, defaultQuery(), dataset.query)\n\n // Handle bbox\n if (query.bbox) {\n // make sure a geometry was not also passed in\n if (query.geometry) {\n throw new Error('Dataset.query can not have both a geometry and a bbox specified')\n }\n // Get the bbox (w,s,e,n)\n const bboxArr = query.bbox.split(',')\n\n // Remove it so it's not serialized as-is\n delete query.bbox\n\n // cook it into a json string\n query.geometry = JSON.stringify({\n xmin: bboxArr[0],\n ymin: bboxArr[2],\n xmax: bboxArr[1],\n ymax: bboxArr[3]\n })\n // set spatial ref as geographic\n query.inSR = '4326'\n }\n\n if (!!query.outStatistics && typeof query.outStatistics !== 'string') {\n query.outStatistics = JSON.stringify(query.outStatistics)\n }\n\n let builtUrl = `${dataset.url}/query?${serializeQueryParams(query)}`\n\n if (dataset.token) {\n builtUrl = `${builtUrl}&token=${dataset.token}`\n }\n\n return builtUrl\n}\n\nexport const url = {\n defaultQuery,\n serializeQueryParams,\n createFeatureServiceRequest\n}\n\nexport default url\n"]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"03fd70e8de3ca384b015e14fee7551f3f8395fe7"} | ||
,"/Users/ben7664/Cedar/cedar/packages/cedar-utils/test/data/featureServiceResponse.ts": {"path":"/Users/ben7664/Cedar/cedar/packages/cedar-utils/test/data/featureServiceResponse.ts","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":3,"column":15},"end":{"line":30,"column":1}},"2":{"start":{"line":31,"column":0},"end":{"line":31,"column":27}}},"fnMap":{},"branchMap":{},"s":{"0":1,"1":1,"2":1},"f":{},"b":{},"inputSourceMap":{"version":3,"file":"featureServiceResponse.js","sourceRoot":"","sources":["featureServiceResponse.ts"],"names":[],"mappings":";;AAAA,IAAM,QAAQ,GAAG;IACf,iBAAiB,EAAE,KAAK;IACxB,iBAAiB,EAAE,EAAE;IACrB,YAAY,EAAE,mBAAmB;IACjC,gBAAgB,EAAE,EAAC,IAAI,EAAE,MAAM;QACZ,UAAU,EAAE,IAAI,EAAC;IACpC,MAAM,EAAE;QACN,EAAC,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,qBAAqB;YAClD,KAAK,EAAE,eAAe,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAC;QACnF,EAAC,IAAI,EAAE,MAAM,EAAE,IAAI,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AAC,aAAa,EAAE,CAAC,EAAE,IAAI,EAAE,OAAO,EAAC,EAAC;KAChD;CACF,CAAA;AAED,kBAAe,QAAQ,CAAA","sourcesContent":["const response = {\n objectIdFieldName: 'FID',\n globalIdFieldName: '',\n geometryType: 'esriGeometryPoint',\n spatialReference: {wkid: 102100,\n latestWkid: 3857},\n fields: [\n {name: 'Number_of_SUM', type: 'esriFieldTypeDouble',\n alias: 'Number_of_SUM', sqlType: 'sqlTypeFloat', domain: null, defaultValue: null},\n {name: 'Type', type: 'esriFieldTypeString', alias: 'Type',\n sqlType: 'sqlTypeNVarchar', length: 254, domain: null, defaultValue: null}\n ],\n features: [\n {attributes: {Number_of_SUM: 261, Type: 'Middle School'}},\n {attributes: {Number_of_SUM: 252, Type: 'Elementary School'}},\n {attributes: {Number_of_SUM: 184, Type: 'High School'}},\n {attributes: {Number_of_SUM: 159, Type: 'Middle School (7&8)'}},\n {attributes: {Number_of_SUM: 98, Type: 'K-8'}},\n {attributes: {Number_of_SUM: 31, Type: 'Junior/Senior High School'}},\n {attributes: {Number_of_SUM: 22, Type: 'Junior High School'}},\n {attributes: {Number_of_SUM: 3, Type: 'K-12'}},\n {attributes: {Number_of_SUM: 1, Type: 'Intermediate School'}},\n {attributes: {Number_of_SUM: 0, Type: 'Alternative School'}},\n {attributes: {Number_of_SUM: 0, Type: 'High School Annex'}},\n {attributes: {Number_of_SUM: 0, Type: 'Middle School High School'}},\n {attributes: {Number_of_SUM: 0, Type: 'Pre-K'}}\n ]\n}\n\nexport default response\n"]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"47103ce5d419fcf1ce98740d71d631fe47b2654e"} | ||
,"/Users/ben7664/Cedar/cedar/packages/cedar-utils/test/data/schoolResponse.ts": {"path":"/Users/ben7664/Cedar/cedar/packages/cedar-utils/test/data/schoolResponse.ts","statementMap":{"0":{"start":{"line":2,"column":0},"end":{"line":2,"column":62}},"1":{"start":{"line":3,"column":15},"end":{"line":136,"column":1}},"2":{"start":{"line":137,"column":0},"end":{"line":137,"column":27}}},"fnMap":{},"branchMap":{},"s":{"0":1,"1":1,"2":1},"f":{},"b":{},"inputSourceMap":{"version":3,"file":"schoolResponse.js","sourceRoot":"","sources":["schoolResponse.ts"],"names":[],"mappings":";;AAAA,IAAM,QAAQ,GAAG;IACf;QACE,iBAAiB,EAAE,KAAK;QACxB,iBAAiB,EAAE,EAAE;QACrB,YAAY,EAAE,mBAAmB;QACjC,gBAAgB,EAAE;YAChB,IAAI,EAAE,MAAM;YACZ,UAAU,EAAE,IAAI;SACjB;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,qBAAqB;gBAC3B,KAAK,EAAE,eAAe;gBACtB,OAAO,EAAE,cAAc;gBACvB,MAAM,EAAE,IAAI;gBACZ,YAAY,EAAE,IAAI;aACnB;YACD;gBACE,IAAI,EAAE,MAAM;gBACZ,IAAI,EAAE,qBAAqB;gBAC3B,KAAK,EAAE,MAAM;gBACb,OAAO,EAAE,iBAAiB;gBAC1B,MAAM,EAAE,GAAG;gBACX,MAAM,EAAE,IAAI;gBACZ,YAAY,EAAE,IAAI;aACnB;SACF;QACD,QAAQ,EAAE;YACR;gBACE,UAAU,EAAE;oBACV,aAAa,EAAE,EAAE;oBACjB,IAAI,EAAE,aAAa;iBACpB;aACF;YACD;gBACE,UAAU,EAAE;oBACV,aAAa,EAAE,CAAC;oBAChB,IAAI,EAAE,eAAe;iBACtB;aACF;YACD;gBACE,UAAU,EAAE;oBACV,aAAa,EAAE,CAAC;oBAChB,IAAI,EAAE,mBAAmB;iBAC1B;aACF;SACF;KACF;IACD;QACE,iBAAiB,EAAE,KAAK;QACxB,iBAAiB,EAAE,EAAE;QACrB,YAAY,EAAE,mBAAmB;QACjC,gBAAgB,EAAE;YAChB,IAAI,EAAE,MAAM;YACZ,UAAU,EAAE,IAAI;SACjB;QACD,MAAM,EAAE;YACN;gBACE,IAAI,EAAE,eAAe;gBACrB,I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AAe;iBACtB;aACF;SACF;KACF;CACF,CAAA;AAED,kBAAe,QAAQ,CAAA","sourcesContent":["const response = [\n {\n objectIdFieldName: 'FID',\n globalIdFieldName: '',\n geometryType: 'esriGeometryPoint',\n spatialReference: {\n wkid: 102100,\n latestWkid: 3857\n },\n fields: [\n {\n name: 'Number_of_SUM',\n type: 'esriFieldTypeDouble',\n alias: 'Number_of_SUM',\n sqlType: 'sqlTypeFloat',\n domain: null,\n defaultValue: null\n },\n {\n name: 'Type',\n type: 'esriFieldTypeString',\n alias: 'Type',\n sqlType: 'sqlTypeNVarchar',\n length: 254,\n domain: null,\n defaultValue: null\n }\n ],\n features: [\n {\n attributes: {\n Number_of_SUM: 13,\n Type: 'High School'\n }\n },\n {\n attributes: {\n Number_of_SUM: 6,\n Type: 'Middle School'\n }\n },\n {\n attributes: {\n Number_of_SUM: 1,\n Type: 'Elementary School'\n }\n }\n ]\n },\n {\n objectIdFieldName: 'FID',\n globalIdFieldName: '',\n geometryType: 'esriGeometryPoint',\n spatialReference: {\n wkid: 102100,\n latestWkid: 3857\n },\n fields: [\n {\n name: 'Number_of_SUM',\n type: 'esriFieldTypeDouble',\n alias: 'Number_of_SUM',\n sqlType: 'sqlTypeFloat',\n domain: null,\n defaultValue: null\n },\n {\n name: 'Type',\n type: 'esriFieldTypeString',\n alias: 'Type',\n sqlType: 'sqlTypeNVarchar',\n length: 254,\n domain: null,\n defaultValue: null\n }\n ],\n features: [\n {\n attributes: {\n Number_of_SUM: 1,\n Type: 'Elementary School'\n }\n }\n ]\n },\n {\n objectIdFieldName: 'FID',\n globalIdFieldName: '',\n geometryType: 'esriGeometryPoint',\n spatialReference: {\n wkid: 102100,\n latestWkid: 3857\n },\n fields: [\n {\n name: 'Number_of_SUM',\n type: 'esriFieldTypeDouble',\n alias: 'Number_of_SUM',\n sqlType: 'sqlTypeFloat',\n domain: null,\n defaultValue: null\n },\n {\n name: 'Type',\n type: 'esriFieldTypeString',\n alias: 'Type',\n sqlType: 'sqlTypeNVarchar',\n length: 254,\n domain: null,\n defaultValue: null\n }\n ],\n features: [\n {\n attributes: {\n Number_of_SUM: 8,\n Type: 'High School'\n }\n },\n {\n attributes: {\n Number_of_SUM: 1,\n Type: 'Elementary School'\n }\n },\n {\n attributes: {\n Number_of_SUM: 0,\n Type: 'Middle School'\n }\n }\n ]\n }\n]\n\nexport default response\n"]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"076db8d7334070bcd014310068141e2b3c8f6364"} | ||
} |
/** | ||
* cedar-utils - v1.0.0-beta - Tue Jul 18 2017 07:50:29 GMT-0400 (EDT) | ||
* cedar-utils - v1.0.1-beta - Fri Jul 21 2017 11:27:41 GMT-0400 (EDT) | ||
* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
@@ -195,5 +195,72 @@ * ISC | ||
function _defaultTransformFunc(feature) { | ||
return feature.attributes; | ||
} | ||
function getTransformFunc(transformFunc) { | ||
return typeof transformFunc === 'function' ? transformFunc : _defaultTransformFunc; | ||
} | ||
function buildIndex(joinKeys, featureSets, transformFuncs) { | ||
var index = {}; | ||
featureSets.forEach(function (featureSet, i) { | ||
var transformFunc = getTransformFunc(transformFuncs[i]); | ||
featureSet.features.forEach(function (features, j) { | ||
var idx = features.attributes[joinKeys[i]]; | ||
if (index[idx] === undefined) { | ||
index[idx] = []; | ||
} | ||
index[idx].push(transformFunc(features)); | ||
}); | ||
}); | ||
return index; | ||
} | ||
function flattenFeatures(data) { | ||
// TODO: Transform data | ||
var joinKeys = data.joinKeys; | ||
var featureSets = data.featureSets; | ||
var transformFuncs = data.transformFuncs; | ||
var features = []; | ||
// If we aren't joining, but we are merging | ||
if (joinKeys.length === 0) { | ||
featureSets.forEach(function (featureSet, i) { | ||
var transformFunc = getTransformFunc(transformFuncs[i]); | ||
featureSet.features.forEach(function (feature, j) { | ||
features.push(transformFunc(feature)); | ||
}); | ||
}); | ||
return features; | ||
} | ||
// Otherwise join | ||
var index = buildIndex(joinKeys, featureSets, transformFuncs); | ||
var key = joinKeys[0]; // TODO: support different `category` keys | ||
var keys = Object.keys(index); | ||
keys.forEach(function (indKey, i) { | ||
var idxArr = index[indKey]; | ||
var feature = { categoryField: idxArr[0][key] }; | ||
idxArr.forEach(function (idx, k) { | ||
var attrKeys = Object.keys(idx); | ||
attrKeys.forEach(function (ak, j) { | ||
var attr = ak + "_" + k; | ||
feature[attr] = idx[ak]; | ||
}); | ||
}); | ||
features.push(feature); | ||
}); | ||
return features; | ||
} | ||
exports.deepMerge = deepMerge; | ||
exports.entries = entries; | ||
exports.helpers = helpers; | ||
exports.fsToArr = fsToArr; | ||
exports.arrToFs = arrToFs; | ||
exports.checkStatusAndParseJson = checkStatusAndParseJson; | ||
exports.getData = getData; | ||
exports.query = query; | ||
exports.defaultQuery = defaultQuery; | ||
exports.serializeQueryParams = serializeQueryParams; | ||
exports.createFeatureServiceRequest = createFeatureServiceRequest; | ||
exports.url = url; | ||
exports.getTransformFunc = getTransformFunc; | ||
exports.buildIndex = buildIndex; | ||
exports.flattenFeatures = flattenFeatures; | ||
@@ -200,0 +267,0 @@ Object.defineProperty(exports, '__esModule', { value: true }); |
/** | ||
* cedar-utils - v1.0.0-beta - Tue Jul 18 2017 07:50:27 GMT-0400 (EDT) | ||
* cedar-utils - v1.0.1-beta - Fri Jul 21 2017 11:27:40 GMT-0400 (EDT) | ||
* Copyright (c) 2017 Environmental Systems Research Institute, Inc. | ||
* ISC | ||
*/ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(e.cedarUtils=e.cedarUtils||{})}(this,function(e){"use strict";function r(e){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];var u=r.slice();for(var i in u)i&&n(u[i]).forEach(function(r){Array.isArray(e)?e.push(t(r.value)):e[r.key]=t(r.value)});return e}function t(e){return Array.isArray(e)?r([],e):"object"==typeof e?r({},e):e}function n(e){var r=[];for(var t in e)t&&r.push({key:t,value:e[t]});return r}function o(e){if(e.features)return e.features.map(function(e){return e.attributes})}function u(e){return{features:e.map(function(e){return{attributes:e}})}}function i(e){var r;if(e.status>=200&&e.status<300)return e.json().then(function(t){if(t.error)throw r=new Error(t.error.message),r.code=t.error.code||404,r.response=e,r;return t});throw r=new Error("Got "+e.status+" "+e.statusText)}function a(e,r){var t=r||{};return fetch(e,t).then(function(e){return i(e)})}function s(){return{where:"1=1",returnGeometry:!1,returnDistinctValues:!1,returnIdsOnly:!1,returnCountOnly:!1,outFields:"*",sqlFormat:"standard",f:"json"}}function f(e){var r=[];for(var t in e)if(e.hasOwnProperty(t)){var n=e[t];"string"!=typeof n&&(n=JSON.stringify(n)),r.push(encodeURIComponent(t)+"="+encodeURIComponent(n))}return r.join("&")}function c(e){var t=r({},s(),e.query);if(t.bbox){if(t.geometry)throw new Error("Dataset.query can not have both a geometry and a bbox specified");var n=t.bbox.split(",");delete t.bbox,t.geometry=JSON.stringify({xmin:n[0],ymin:n[2],xmax:n[1],ymax:n[3]}),t.inSR="4326"}t.outStatistics&&"string"!=typeof t.outStatistics&&(t.outStatistics=JSON.stringify(t.outStatistics));var o=e.url+"/query?"+f(t);return e.token&&(o=o+"&token="+e.token),o}var y={entries:n,deepMerge:r},d={fsToArr:o,arrToFs:u,getData:a},p={defaultQuery:s,serializeQueryParams:f,createFeatureServiceRequest:c};e.helpers=y,e.query=d,e.url=p,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports):"function"==typeof define&&define.amd?define(["exports"],r):r(e.cedarUtils=e.cedarUtils||{})}(this,function(e){"use strict";function r(e){for(var r=[],o=1;o<arguments.length;o++)r[o-1]=arguments[o];var i=r.slice();for(var f in i)f&&n(i[f]).forEach(function(r){Array.isArray(e)?e.push(t(r.value)):e[r.key]=t(r.value)});return e}function t(e){return Array.isArray(e)?r([],e):"object"==typeof e?r({},e):e}function n(e){var r=[];for(var t in e)t&&r.push({key:t,value:e[t]});return r}var o={entries:n,deepMerge:r};e.deepMerge=r,e.helpers=o,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=cedar-utils.min.js.map |
{ | ||
"name": "cedar-utils", | ||
"version": "1.0.0-beta", | ||
"version": "1.0.1-beta", | ||
"description": "Core code that makes up Cedar's data fetching and json specifications", | ||
@@ -5,0 +5,0 @@ "main": "dist/cedar-utils.js", |
@@ -35,3 +35,3 @@ /** | ||
*/ | ||
function entries(obj: object) { | ||
export function entries(obj: object) { | ||
const pairs = [] | ||
@@ -46,3 +46,3 @@ for (const key in obj) { | ||
const helpers = { | ||
export const helpers = { | ||
entries, | ||
@@ -49,0 +49,0 @@ deepMerge |
@@ -1,3 +0,4 @@ | ||
export {default as helpers} from './helpers/helpers' | ||
export {default as query} from './query/query' | ||
export {default as url} from './query/url' | ||
export * from './helpers/helpers' | ||
export * from './query/query' | ||
export * from './query/url' | ||
export * from './flatten/flatten' |
@@ -68,3 +68,3 @@ | ||
const query = { | ||
export const query = { | ||
fsToArr, | ||
@@ -71,0 +71,0 @@ arrToFs, |
@@ -69,3 +69,3 @@ import {deepMerge} from '../helpers/helpers' | ||
const url = { | ||
export const url = { | ||
defaultQuery, | ||
@@ -72,0 +72,0 @@ serializeQueryParams, |
@@ -9,2 +9,4 @@ import {} from 'jest' | ||
test('chartUtils has helpers', () => { | ||
expect(chartUtils).toHaveProperty('entries') | ||
expect(chartUtils).toHaveProperty('deepMerge') | ||
expect(chartUtils).toHaveProperty('helpers') | ||
@@ -15,2 +17,5 @@ expect(chartUtils.helpers).toEqual(helpers) | ||
expect(chartUtils).toHaveProperty('query') | ||
expect(chartUtils).toHaveProperty('fsToArr') | ||
expect(chartUtils).toHaveProperty('arrToFs') | ||
expect(chartUtils).toHaveProperty('getData') | ||
expect(chartUtils.query).toEqual(query) | ||
@@ -20,4 +25,7 @@ }) | ||
expect(chartUtils).toHaveProperty('url') | ||
expect(chartUtils).toHaveProperty('defaultQuery') | ||
expect(chartUtils).toHaveProperty('serializeQueryParams') | ||
expect(chartUtils).toHaveProperty('createFeatureServiceRequest') | ||
expect(chartUtils.url).toEqual(url) | ||
}) | ||
}) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
340565
60
2112
2