@imgix/gatsby
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -0,1 +1,10 @@ | ||
## [1.1.2](https://github.com/imgix/gatsby/compare/v1.1.1...v1.1.2) (2021-03-01) | ||
### Bug Fixes | ||
* correct types for float params ([ccb97f4](https://github.com/imgix/gatsby/commit/ccb97f4e6aa12484f4eb8e11b11f2cab02919070)) | ||
* fix imgix params with dash not working correctly ([f8a8fd0](https://github.com/imgix/gatsby/commit/f8a8fd044fe26337416518a7944899bad2679aa5)) | ||
* slight issue in tests ([3368ed7](https://github.com/imgix/gatsby/commit/3368ed76fecb08f0844f43603b80ce7072a83e70)) | ||
## [1.1.1](https://github.com/imgix/gatsby/compare/v1.1.0...v1.1.1) (2021-02-18) | ||
@@ -2,0 +11,0 @@ |
@@ -1,2 +0,2 @@ | ||
export declare const VERSION = "1.1.0"; | ||
export declare const VERSION = "1.1.1"; | ||
//# sourceMappingURL=constants.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.VERSION = void 0; | ||
exports.VERSION = '1.1.0'; | ||
exports.VERSION = '1.1.1'; | ||
//# sourceMappingURL=constants.js.map |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
@@ -69,2 +80,3 @@ if (k2 === undefined) k2 = k; | ||
.let('rootValue', rootValue) | ||
.let('modifiedArgs', __assign(__assign({}, args), { imgixParams: graphqlTypes_1.unTransformParams(args.imgixParams) })) | ||
.sequenceSL(function (_a) { | ||
@@ -89,3 +101,3 @@ var rootValue = _a.rootValue; | ||
.return(function (_a) { | ||
var url = _a.url, _b = _a.dimensions, width = _b.width, height = _b.height; | ||
var url = _a.url, modifiedArgs = _a.modifiedArgs, _b = _a.dimensions, width = _b.width, height = _b.height; | ||
return objectBuilders_1.buildImgixFixed({ | ||
@@ -96,3 +108,3 @@ client: imgixClient, | ||
sourceHeight: height, | ||
args: args, | ||
args: modifiedArgs, | ||
defaultParams: defaultParams, | ||
@@ -99,0 +111,0 @@ defaultPlaceholderParams: {}, |
"use strict"; | ||
var __assign = (this && this.__assign) || function () { | ||
__assign = Object.assign || function(t) { | ||
for (var s, i = 1, n = arguments.length; i < n; i++) { | ||
s = arguments[i]; | ||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) | ||
t[p] = s[p]; | ||
} | ||
return t; | ||
}; | ||
return __assign.apply(this, arguments); | ||
}; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
@@ -69,2 +80,3 @@ if (k2 === undefined) k2 = k; | ||
.let('rootValue', rootValue) | ||
.let('modifiedArgs', __assign(__assign({}, args), { imgixParams: graphqlTypes_1.unTransformParams(args.imgixParams) })) | ||
.sequenceSL(function (_a) { | ||
@@ -89,6 +101,6 @@ var rootValue = _a.rootValue; | ||
.return(function (_a) { | ||
var url = _a.url, _b = _a.dimensions, width = _b.width, height = _b.height; | ||
var url = _a.url, modifiedArgs = _a.modifiedArgs, _b = _a.dimensions, width = _b.width, height = _b.height; | ||
return objectBuilders_1.buildFluidObject({ | ||
client: imgixClient, | ||
args: args, | ||
args: modifiedArgs, | ||
sourceHeight: height, | ||
@@ -95,0 +107,0 @@ sourceWidth: width, |
@@ -43,3 +43,3 @@ "use strict"; | ||
var _a; | ||
return imgixClient.buildURL(url, R.mergeRight(defaultParams !== null && defaultParams !== void 0 ? defaultParams : {}, (_a = args.imgixParams) !== null && _a !== void 0 ? _a : {})); | ||
return imgixClient.buildURL(url, R.mergeRight(defaultParams !== null && defaultParams !== void 0 ? defaultParams : {}, graphqlTypes_1.unTransformParams((_a = args.imgixParams) !== null && _a !== void 0 ? _a : {}))); | ||
}), TE.getOrElse(function () { return T.of(undefined); }))(); | ||
@@ -46,0 +46,0 @@ }, |
@@ -22,4 +22,5 @@ import { GatsbyCache } from 'gatsby'; | ||
}) => GraphQLObjectType<FixedObject>; | ||
export declare const unTransformParams: <T>(params: Record<string, T>) => Record<string, T>; | ||
export declare type IGatsbySourceImgixUrlField = string; | ||
export declare const gatsbySourceImgixUrlFieldType: import("graphql").GraphQLScalarType; | ||
//# sourceMappingURL=graphqlTypes.d.ts.map |
@@ -17,3 +17,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.gatsbySourceImgixUrlFieldType = exports.createImgixFixedType = exports.getImgixFluidType = exports.createImgixFluidType = exports.ImgixUrlParamsInputType = void 0; | ||
exports.gatsbySourceImgixUrlFieldType = exports.unTransformParams = exports.createImgixFixedType = exports.getImgixFluidType = exports.createImgixFluidType = exports.ImgixUrlParamsInputType = void 0; | ||
var camel_case_1 = require("camel-case"); | ||
@@ -34,3 +34,3 @@ var graphql_1 = require("graphql"); | ||
// TODO: Clean up this mess. | ||
var type = expectsTypes.every(function (type) { return type === 'integer' || type === 'unit_scalar'; }) | ||
var type = expectsTypes.every(function (type) { return type === 'integer'; }) | ||
? graphql_1.GraphQLInt | ||
@@ -116,3 +116,13 @@ : expectsTypes.every(function (type) { | ||
exports.createImgixFixedType = createImgixFixedType; | ||
var unTransformParams = function (params) { | ||
// look for uppercase chars, replace with lowercase + `-` | ||
return Object.entries(params).reduce(function (p, _a) { | ||
var _b; | ||
var k = _a[0], v = _a[1]; | ||
var transformedKey = k.replace(/[A-Z]/, function (c) { return "-" + c.toLowerCase(); }); | ||
return __assign(__assign({}, p), (_b = {}, _b[transformedKey] = v, _b)); | ||
}, {}); | ||
}; | ||
exports.unTransformParams = unTransformParams; | ||
exports.gatsbySourceImgixUrlFieldType = graphql_1.GraphQLString; | ||
//# sourceMappingURL=graphqlTypes.js.map |
{ | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"name": "@imgix/gatsby", | ||
@@ -4,0 +4,0 @@ "description": "A Gatsby plugin to integrate with imgix's APIs", |
@@ -7,4 +7,2 @@ <!-- ix-docs-ignore --> | ||
<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![npm version](https://img.shields.io/npm/v/@imgix/gatsby.svg)](https://www.npmjs.com/package/@imgix/gatsby) | ||
@@ -14,6 +12,6 @@ [![Downloads](https://img.shields.io/npm/dm/@imgix/gatsby.svg?color=informational)](https://www.npmjs.com/package/@imgix/gatsby) | ||
[![Dependencies Status](https://david-dm.org/imgix/gatsby.svg)](https://david-dm.org/imgix/gatsby) | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-1-informational.svg)](#contributors) | ||
[![License](https://img.shields.io/npm/l/@imgix/gatsby?color=informational)](https://github.com/imgix/gatsby/blob/main/packages/gatsby/LICENSE) | ||
[![FOSSA Status](https://app.fossa.com/api/projects/git%2Bgithub.com%2Fimgix%2Fgatsby.svg?type=shield)](https://app.fossa.com/projects/git%2Bgithub.com%2Fimgix%2Fgatsby?ref=badge_shield) | ||
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?color=informational)](https://github.com/prettier/prettier) | ||
[![styled with prettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg?color=informational)](https://github.com/prettier/prettier)<!-- ALL-CONTRIBUTORS-BADGE:START - Do not remove or modify this section --> | ||
[![All Contributors](https://img.shields.io/badge/all_contributors-3-informational.svg)](#contributors) | ||
@@ -837,8 +835,9 @@ <!-- ALL-CONTRIBUTORS-BADGE:END --> | ||
<tr> | ||
<td align="center"><a href="https://github.com/frederickfogerty"><img src="https://avatars0.githubusercontent.com/u/615334?v=4" width="100px;" alt=""/><br /><sub><b>Frederick Fogerty</b></sub></a><br /><a href="https://github.com/imgix/gatsby/commits?author=frederickfogerty" title="Code">💻</a> <a href="https://github.com/imgix/gatsby/commits?author=frederickfogerty" title="Documentation">📖</a> <a href="#maintenance-frederickfogerty" title="Maintenance">🚧</a></td> | ||
<td align="center"><a href="https://angeloashmore.github.io"><img src="https://avatars2.githubusercontent.com/u/8601064?v=4" width="100px;" alt=""/><br /><sub><b>Angelo Ashmore</b></sub></a><br /><a href="https://github.com/imgix/gatsby/commits?author=angeloashmore" title="Code">💻</a></td> | ||
<td align="center"><a href="https://github.com/frederickfogerty"><img src="https://avatars0.githubusercontent.com/u/615334?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Frederick Fogerty</b></sub></a><br /><a href="https://github.com/imgix/gatsby/commits?author=frederickfogerty" title="Code">💻</a> <a href="https://github.com/imgix/gatsby/commits?author=frederickfogerty" title="Documentation">📖</a> <a href="#maintenance-frederickfogerty" title="Maintenance">🚧</a></td> | ||
<td align="center"><a href="https://angeloashmore.github.io"><img src="https://avatars2.githubusercontent.com/u/8601064?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Angelo Ashmore</b></sub></a><br /><a href="https://github.com/imgix/gatsby/commits?author=angeloashmore" title="Code">💻</a></td> | ||
<td align="center"><a href="http://www.luisball.com"><img src="https://avatars.githubusercontent.com/u/16711614?v=4?s=100" width="100px;" alt=""/><br /><sub><b>Luis H. Ball Jr.</b></sub></a><br /><a href="https://github.com/imgix/gatsby/commits?author=luqven" title="Documentation">📖</a></td> | ||
</tr> | ||
</table> | ||
<!-- markdownlint-enable --> | ||
<!-- markdownlint-restore --> | ||
<!-- prettier-ignore-end --> | ||
@@ -845,0 +844,0 @@ |
@@ -1,1 +0,1 @@ | ||
export const VERSION = '1.1.1'; | ||
export const VERSION = '1.1.2'; |
@@ -21,3 +21,7 @@ import { Do } from 'fp-ts-contrib/lib/Do'; | ||
} from '../../publicTypes'; | ||
import { createImgixFixedType, ImgixUrlParamsInputType } from './graphqlTypes'; | ||
import { | ||
createImgixFixedType, | ||
ImgixUrlParamsInputType, | ||
unTransformParams, | ||
} from './graphqlTypes'; | ||
import { buildImgixFixed } from './objectBuilders'; | ||
@@ -87,2 +91,6 @@ import { resolveDimensions } from './resolveDimensions'; | ||
.let('rootValue', rootValue) | ||
.let('modifiedArgs', { | ||
...args, | ||
imgixParams: unTransformParams(args.imgixParams), | ||
}) | ||
.sequenceSL(({ rootValue }) => ({ | ||
@@ -112,3 +120,3 @@ url: resolveUrlFromSourceData(resolveUrl)(rootValue), | ||
) | ||
.return(({ url, dimensions: { width, height } }) => | ||
.return(({ url, modifiedArgs, dimensions: { width, height } }) => | ||
buildImgixFixed({ | ||
@@ -119,3 +127,3 @@ client: imgixClient, | ||
sourceHeight: height, | ||
args, | ||
args: modifiedArgs, | ||
defaultParams, | ||
@@ -122,0 +130,0 @@ defaultPlaceholderParams: {}, // TODO: implement |
@@ -26,3 +26,7 @@ import { Do } from 'fp-ts-contrib/lib/Do'; | ||
} from '../../publicTypes'; | ||
import { createImgixFluidType, ImgixUrlParamsInputType } from './graphqlTypes'; | ||
import { | ||
createImgixFluidType, | ||
ImgixUrlParamsInputType, | ||
unTransformParams, | ||
} from './graphqlTypes'; | ||
import { buildFluidObject } from './objectBuilders'; | ||
@@ -94,2 +98,6 @@ import { resolveDimensions } from './resolveDimensions'; | ||
.let('rootValue', rootValue) | ||
.let('modifiedArgs', { | ||
...args, | ||
imgixParams: unTransformParams(args.imgixParams), | ||
}) | ||
.sequenceSL(({ rootValue }) => ({ | ||
@@ -117,6 +125,6 @@ url: resolveUrlFromSourceData(resolveUrl)(rootValue), | ||
) | ||
.return(({ url, dimensions: { width, height } }) => | ||
.return(({ url, modifiedArgs, dimensions: { width, height } }) => | ||
buildFluidObject({ | ||
client: imgixClient, | ||
args, | ||
args: modifiedArgs, | ||
sourceHeight: height, | ||
@@ -123,0 +131,0 @@ sourceWidth: width, |
@@ -16,2 +16,3 @@ import { pipe } from 'fp-ts/lib/pipeable'; | ||
ImgixUrlParamsInputType, | ||
unTransformParams, | ||
} from './graphqlTypes'; | ||
@@ -52,3 +53,6 @@ | ||
url, | ||
R.mergeRight(defaultParams ?? {}, args.imgixParams ?? {}), | ||
R.mergeRight( | ||
defaultParams ?? {}, | ||
unTransformParams(args.imgixParams ?? {}), | ||
), | ||
), | ||
@@ -55,0 +59,0 @@ ), |
@@ -40,5 +40,3 @@ import { camelCase } from 'camel-case'; | ||
// TODO: Clean up this mess. | ||
const type = expectsTypes.every( | ||
(type) => type === 'integer' || type === 'unit_scalar', | ||
) | ||
const type = expectsTypes.every((type) => type === 'integer') | ||
? GraphQLInt | ||
@@ -146,3 +144,13 @@ : expectsTypes.every( | ||
export const unTransformParams = <T>( | ||
params: Record<string, T>, | ||
): Record<string, T> => { | ||
// look for uppercase chars, replace with lowercase + `-` | ||
return Object.entries(params).reduce((p, [k, v]) => { | ||
const transformedKey = k.replace(/[A-Z]/, (c) => `-${c.toLowerCase()}`); | ||
return { ...p, [transformedKey]: v }; | ||
}, {}); | ||
}; | ||
export type IGatsbySourceImgixUrlField = string; | ||
export const gatsbySourceImgixUrlFieldType = GraphQLString; |
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
360546
4784
851