@himenon/openapi-parameter-formatter
Advanced tools
Comparing version 0.2.6 to 0.3.0
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -26,3 +30,3 @@ if (k2 === undefined) k2 = k; | ||
if (params.style === "form") { | ||
return Core.generateFormParamter(key, params); | ||
return Core.generateFormParamterForCookie(key, params); | ||
} | ||
@@ -29,0 +33,0 @@ return undefined; |
106
$cjs/Core.js
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -25,3 +29,3 @@ if (k2 === undefined) k2 = k; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generateFromLabel = exports.generateFromMatrix = exports.generateDeepObjectParameter = exports.generatePipeDelimitedParameter = exports.generateSpaceDelimited = exports.generateFormParamter = exports.generateFromSimple = void 0; | ||
exports.generateFromLabel = exports.generateFromMatrix = exports.generateDeepObjectParameterAsURLSearchParams = exports.generateDeepObjectParameter = exports.generatePipeDelimitedParameterAsURLSearchParams = exports.generatePipeDelimitedParameter = exports.generateSpaceDelimitedAsURLSearchParams = exports.generateSpaceDelimited = exports.generateFormParamterAsURLSearchParams = exports.generateFormParamter = exports.generateFormParamterForCookie = exports.generateFromSimple = void 0; | ||
const Guard = __importStar(require("./Guard")); | ||
@@ -54,3 +58,3 @@ const flat_1 = __importDefault(require("flat")); | ||
exports.generateFromSimple = generateFromSimple; | ||
const generateFormParamter = (key, params) => { | ||
const generateFormParamterForCookie = (key, params) => { | ||
if (Guard.isEmpty(params.value)) { | ||
@@ -85,6 +89,61 @@ return `${key}=`; | ||
}; | ||
exports.generateFormParamterForCookie = generateFormParamterForCookie; | ||
const generateFormParamter = (key, params) => { | ||
return (0, exports.generateFormParamterAsURLSearchParams)(key, params).toString(); | ||
}; | ||
exports.generateFormParamter = generateFormParamter; | ||
const generateFormParamterAsURLSearchParams = (key, params) => { | ||
var _a, _b; | ||
const instance = new URLSearchParams(); | ||
if (Guard.isEmpty(params.value)) { | ||
instance.append(key.toString(), ""); | ||
return instance; | ||
} | ||
if (Guard.isPrimitive(params.value)) { | ||
instance.append(key.toString(), (_b = (_a = params.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ""); | ||
return instance; | ||
} | ||
if (Guard.isArray(params.value)) { | ||
if (params.explode) { | ||
params.value.map(item => { | ||
instance.append(key.toString(), item.toString()); | ||
}); | ||
} | ||
else { | ||
instance.append(key.toString(), params.value.join(",")); | ||
} | ||
return instance; | ||
} | ||
if (Guard.isObject(params.value)) { | ||
if (params.explode) { | ||
Object.entries(params.value).map(([k, v]) => { | ||
instance.append(k.toString(), v.toString()); | ||
}); | ||
} | ||
else { | ||
const value = Object.entries(params.value) | ||
.map(([k, v]) => `${k},${v}`) | ||
.join(","); | ||
instance.append(key.toString(), value); | ||
} | ||
return instance; | ||
} | ||
instance.append(key.toString(), ""); | ||
return instance; | ||
}; | ||
exports.generateFormParamterAsURLSearchParams = generateFormParamterAsURLSearchParams; | ||
/** | ||
* If you want to change the encoding of space to "+", use the genericSpaceDelimitedAsURLSearchParams. | ||
* @see https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20 | ||
*/ | ||
const generateSpaceDelimited = (key, params) => { | ||
var _a; | ||
return (_a = (0, exports.generateSpaceDelimitedAsURLSearchParams)(key, params)) === null || _a === void 0 ? void 0 : _a.toString().replace(/\+/g, "%20"); | ||
}; | ||
exports.generateSpaceDelimited = generateSpaceDelimited; | ||
const generateSpaceDelimitedAsURLSearchParams = (key, params) => { | ||
const instance = new URLSearchParams(); | ||
if (Guard.isArray(params.value)) { | ||
return encodeURIComponent(params.value.join(" ")); | ||
instance.append(key.toString(), params.value.join(" ")); | ||
return instance; | ||
} | ||
@@ -95,10 +154,18 @@ if (Guard.isObject(params.value)) { | ||
.join(" "); | ||
return encodeURIComponent(value); | ||
instance.append(key.toString(), value); | ||
return instance; | ||
} | ||
return undefined; | ||
}; | ||
exports.generateSpaceDelimited = generateSpaceDelimited; | ||
exports.generateSpaceDelimitedAsURLSearchParams = generateSpaceDelimitedAsURLSearchParams; | ||
const generatePipeDelimitedParameter = (key, params) => { | ||
var _a; | ||
return (_a = (0, exports.generatePipeDelimitedParameterAsURLSearchParams)(key, params)) === null || _a === void 0 ? void 0 : _a.toString(); | ||
}; | ||
exports.generatePipeDelimitedParameter = generatePipeDelimitedParameter; | ||
const generatePipeDelimitedParameterAsURLSearchParams = (key, params) => { | ||
const instance = new URLSearchParams(); | ||
if (Guard.isArray(params.value)) { | ||
return params.value.join("|"); | ||
instance.append(key.toString(), params.value.join("|")); | ||
return instance; | ||
} | ||
@@ -109,14 +176,21 @@ if (Guard.isObject(params.value)) { | ||
.join("|"); | ||
return value; | ||
instance.append(key.toString(), value); | ||
return instance; | ||
} | ||
return undefined; | ||
}; | ||
exports.generatePipeDelimitedParameter = generatePipeDelimitedParameter; | ||
exports.generatePipeDelimitedParameterAsURLSearchParams = generatePipeDelimitedParameterAsURLSearchParams; | ||
const generateDeepObjectParameter = (key, params) => { | ||
var _a; | ||
return (_a = (0, exports.generateDeepObjectParameterAsURLSearchParams)(key, params)) === null || _a === void 0 ? void 0 : _a.toString(); | ||
}; | ||
exports.generateDeepObjectParameter = generateDeepObjectParameter; | ||
const generateDeepObjectParameterAsURLSearchParams = (key, params) => { | ||
if (!Guard.isObject(params.value)) { | ||
return undefined; | ||
} | ||
const flatObject = flat_1.default(params.value); | ||
return Object.entries(flatObject) | ||
.map(([dotKeyName, primitiveValue]) => { | ||
const queryParams = new URLSearchParams(); | ||
const flatObject = (0, flat_1.default)(params.value); | ||
Object.entries(flatObject).map(([dotKeyName, primitiveValue]) => { | ||
var _a; | ||
const nestedKey = dotKeyName | ||
@@ -126,7 +200,7 @@ .split(".") | ||
.join(""); | ||
return `${[key]}${nestedKey}=${primitiveValue}`; | ||
}) | ||
.join("&"); | ||
queryParams.append(`${key}${nestedKey}`, (_a = primitiveValue === null || primitiveValue === void 0 ? void 0 : primitiveValue.toString()) !== null && _a !== void 0 ? _a : ""); | ||
}); | ||
return queryParams; | ||
}; | ||
exports.generateDeepObjectParameter = generateDeepObjectParameter; | ||
exports.generateDeepObjectParameterAsURLSearchParams = generateDeepObjectParameterAsURLSearchParams; | ||
const generateFromMatrix = (key, params) => { | ||
@@ -133,0 +207,0 @@ if (Guard.isEmpty(params.value)) { |
@@ -43,3 +43,3 @@ "use strict"; | ||
const isObject = (value) => { | ||
if (exports.isArray(value) || exports.isPrimitive(value)) { | ||
if ((0, exports.isArray)(value) || (0, exports.isPrimitive)(value)) { | ||
return false; | ||
@@ -54,6 +54,6 @@ } | ||
} | ||
if (exports.isArray(value)) { | ||
if ((0, exports.isArray)(value)) { | ||
return value.length === 0; | ||
} | ||
if (exports.isObject(value)) { | ||
if ((0, exports.isObject)(value)) { | ||
return Object.keys(value).length === 0; | ||
@@ -60,0 +60,0 @@ } |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -22,3 +26,3 @@ if (k2 === undefined) k2 = k; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.generate = void 0; | ||
exports.generateByURLSearchParams = exports.generate = void 0; | ||
const Core = __importStar(require("./Core")); | ||
@@ -41,1 +45,17 @@ const generate = (key, params) => { | ||
exports.generate = generate; | ||
const generateByURLSearchParams = (key, params) => { | ||
if (params.style === "form") { | ||
return Core.generateFormParamterAsURLSearchParams(key, params); | ||
} | ||
if (params.style === "spaceDelimited") { | ||
return Core.generateSpaceDelimitedAsURLSearchParams(key, params); | ||
} | ||
if (params.style === "pipeDelimited") { | ||
return Core.generatePipeDelimitedParameterAsURLSearchParams(key, params); | ||
} | ||
if (params.style === "deepObject") { | ||
return Core.generateDeepObjectParameterAsURLSearchParams(key, params); | ||
} | ||
return undefined; | ||
}; | ||
exports.generateByURLSearchParams = generateByURLSearchParams; |
import * as Core from "./Core"; | ||
export const generate = (key, params) => { | ||
if (params.style === "form") { | ||
return Core.generateFormParamter(key, params); | ||
return Core.generateFormParamterForCookie(key, params); | ||
} | ||
return undefined; | ||
}; |
@@ -27,3 +27,3 @@ import * as Guard from "./Guard"; | ||
}; | ||
export const generateFormParamter = (key, params) => { | ||
export const generateFormParamterForCookie = (key, params) => { | ||
if (Guard.isEmpty(params.value)) { | ||
@@ -58,5 +58,57 @@ return `${key}=`; | ||
}; | ||
export const generateFormParamter = (key, params) => { | ||
return generateFormParamterAsURLSearchParams(key, params).toString(); | ||
}; | ||
export const generateFormParamterAsURLSearchParams = (key, params) => { | ||
var _a, _b; | ||
const instance = new URLSearchParams(); | ||
if (Guard.isEmpty(params.value)) { | ||
instance.append(key.toString(), ""); | ||
return instance; | ||
} | ||
if (Guard.isPrimitive(params.value)) { | ||
instance.append(key.toString(), (_b = (_a = params.value) === null || _a === void 0 ? void 0 : _a.toString()) !== null && _b !== void 0 ? _b : ""); | ||
return instance; | ||
} | ||
if (Guard.isArray(params.value)) { | ||
if (params.explode) { | ||
params.value.map(item => { | ||
instance.append(key.toString(), item.toString()); | ||
}); | ||
} | ||
else { | ||
instance.append(key.toString(), params.value.join(",")); | ||
} | ||
return instance; | ||
} | ||
if (Guard.isObject(params.value)) { | ||
if (params.explode) { | ||
Object.entries(params.value).map(([k, v]) => { | ||
instance.append(k.toString(), v.toString()); | ||
}); | ||
} | ||
else { | ||
const value = Object.entries(params.value) | ||
.map(([k, v]) => `${k},${v}`) | ||
.join(","); | ||
instance.append(key.toString(), value); | ||
} | ||
return instance; | ||
} | ||
instance.append(key.toString(), ""); | ||
return instance; | ||
}; | ||
/** | ||
* If you want to change the encoding of space to "+", use the genericSpaceDelimitedAsURLSearchParams. | ||
* @see https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20 | ||
*/ | ||
export const generateSpaceDelimited = (key, params) => { | ||
var _a; | ||
return (_a = generateSpaceDelimitedAsURLSearchParams(key, params)) === null || _a === void 0 ? void 0 : _a.toString().replace(/\+/g, "%20"); | ||
}; | ||
export const generateSpaceDelimitedAsURLSearchParams = (key, params) => { | ||
const instance = new URLSearchParams(); | ||
if (Guard.isArray(params.value)) { | ||
return encodeURIComponent(params.value.join(" ")); | ||
instance.append(key.toString(), params.value.join(" ")); | ||
return instance; | ||
} | ||
@@ -67,3 +119,4 @@ if (Guard.isObject(params.value)) { | ||
.join(" "); | ||
return encodeURIComponent(value); | ||
instance.append(key.toString(), value); | ||
return instance; | ||
} | ||
@@ -73,4 +126,10 @@ return undefined; | ||
export const generatePipeDelimitedParameter = (key, params) => { | ||
var _a; | ||
return (_a = generatePipeDelimitedParameterAsURLSearchParams(key, params)) === null || _a === void 0 ? void 0 : _a.toString(); | ||
}; | ||
export const generatePipeDelimitedParameterAsURLSearchParams = (key, params) => { | ||
const instance = new URLSearchParams(); | ||
if (Guard.isArray(params.value)) { | ||
return params.value.join("|"); | ||
instance.append(key.toString(), params.value.join("|")); | ||
return instance; | ||
} | ||
@@ -81,3 +140,4 @@ if (Guard.isObject(params.value)) { | ||
.join("|"); | ||
return value; | ||
instance.append(key.toString(), value); | ||
return instance; | ||
} | ||
@@ -87,8 +147,13 @@ return undefined; | ||
export const generateDeepObjectParameter = (key, params) => { | ||
var _a; | ||
return (_a = generateDeepObjectParameterAsURLSearchParams(key, params)) === null || _a === void 0 ? void 0 : _a.toString(); | ||
}; | ||
export const generateDeepObjectParameterAsURLSearchParams = (key, params) => { | ||
if (!Guard.isObject(params.value)) { | ||
return undefined; | ||
} | ||
const queryParams = new URLSearchParams(); | ||
const flatObject = flatten(params.value); | ||
return Object.entries(flatObject) | ||
.map(([dotKeyName, primitiveValue]) => { | ||
Object.entries(flatObject).map(([dotKeyName, primitiveValue]) => { | ||
var _a; | ||
const nestedKey = dotKeyName | ||
@@ -98,5 +163,5 @@ .split(".") | ||
.join(""); | ||
return `${[key]}${nestedKey}=${primitiveValue}`; | ||
}) | ||
.join("&"); | ||
queryParams.append(`${key}${nestedKey}`, (_a = primitiveValue === null || primitiveValue === void 0 ? void 0 : primitiveValue.toString()) !== null && _a !== void 0 ? _a : ""); | ||
}); | ||
return queryParams; | ||
}; | ||
@@ -103,0 +168,0 @@ export const generateFromMatrix = (key, params) => { |
@@ -17,1 +17,16 @@ import * as Core from "./Core"; | ||
}; | ||
export const generateByURLSearchParams = (key, params) => { | ||
if (params.style === "form") { | ||
return Core.generateFormParamterAsURLSearchParams(key, params); | ||
} | ||
if (params.style === "spaceDelimited") { | ||
return Core.generateSpaceDelimitedAsURLSearchParams(key, params); | ||
} | ||
if (params.style === "pipeDelimited") { | ||
return Core.generatePipeDelimitedParameterAsURLSearchParams(key, params); | ||
} | ||
if (params.style === "deepObject") { | ||
return Core.generateDeepObjectParameterAsURLSearchParams(key, params); | ||
} | ||
return undefined; | ||
}; |
@@ -6,7 +6,16 @@ import { ParameterOfLabel, ParameterOfMatrix, ParameterOfSimple, ParameterOfForm, ParameterOfSpaceDelimited, ParameterOfPipeDelimited, ParameterOfDeepObject } from "./Types"; | ||
export declare const generateFromSimple: (key: string | number, params: ParameterOfSimple) => string | undefined; | ||
export declare const generateFormParamterForCookie: (key: string | number, params: ParameterOfForm) => string; | ||
export declare const generateFormParamter: (key: string | number, params: ParameterOfForm) => string; | ||
export declare const generateFormParamterAsURLSearchParams: (key: string | number, params: ParameterOfForm) => URLSearchParams; | ||
/** | ||
* If you want to change the encoding of space to "+", use the genericSpaceDelimitedAsURLSearchParams. | ||
* @see https://stackoverflow.com/questions/1634271/url-encoding-the-space-character-or-20 | ||
*/ | ||
export declare const generateSpaceDelimited: (key: string | number, params: ParameterOfSpaceDelimited) => string | undefined; | ||
export declare const generateSpaceDelimitedAsURLSearchParams: (key: string | number, params: ParameterOfSpaceDelimited) => URLSearchParams | undefined; | ||
export declare const generatePipeDelimitedParameter: (key: string | number, params: ParameterOfPipeDelimited) => string | undefined; | ||
export declare const generatePipeDelimitedParameterAsURLSearchParams: (key: string | number, params: ParameterOfPipeDelimited) => URLSearchParams | undefined; | ||
export declare const generateDeepObjectParameter: (key: string | number, params: ParameterOfDeepObject) => string | undefined; | ||
export declare const generateDeepObjectParameterAsURLSearchParams: (key: string | number, params: ParameterOfDeepObject) => URLSearchParams | undefined; | ||
export declare const generateFromMatrix: (key: string | number, params: ParameterOfMatrix) => string | undefined; | ||
export declare const generateFromLabel: (key: string | number, params: ParameterOfLabel) => string | undefined; |
import { ParameterOfForm, ParameterOfSpaceDelimited, ParameterOfPipeDelimited, ParameterOfDeepObject } from "./Types"; | ||
export declare type Parameter = ParameterOfForm | ParameterOfSpaceDelimited | ParameterOfPipeDelimited | ParameterOfDeepObject; | ||
export declare const generate: (key: string | number, params: Parameter) => string | undefined; | ||
export declare const generateByURLSearchParams: (key: string | number, params: Parameter) => URLSearchParams | undefined; |
@@ -6,2 +6,18 @@ # Change Log | ||
<a name="0.3.0"></a> | ||
# 0.3.0 (2022-04-29) | ||
### Features | ||
- Serialize QueryParameter with URLSearchParams ([#12](https://github.com/Himenon/openapi-parameter-formatter/issues/12)) ([6048a0e](https://github.com/Himenon/openapi-parameter-formatter/commit/6048a0e)) | ||
<a name="0.2.7"></a> | ||
## 0.2.7 (2022-04-22) | ||
### Chores | ||
- update dependencies ([#10](https://github.com/Himenon/openapi-parameter-formatter/issues/10)) ([3d66cea](https://github.com/Himenon/openapi-parameter-formatter/commit/3d66cea)) | ||
<a name="0.2.6"></a> | ||
@@ -8,0 +24,0 @@ |
{ | ||
"name": "@himenon/openapi-parameter-formatter", | ||
"version": "0.2.6", | ||
"version": "0.3.0", | ||
"description": "Serializes OpenAPI parameter objects.", | ||
@@ -30,14 +30,4 @@ "keywords": [ | ||
"types": "$types/index.d.ts", | ||
"scripts": { | ||
"build": "yarn ts ./scripts/build.ts", | ||
"clean": "yarn ts ./scripts/clean.ts", | ||
"format:code": "prettier \"**/*.{js,jsx,ts,tsx,json,yml,yaml,md,html}\" --write", | ||
"format:yarn:lock": "yarn-deduplicate yarn.lock --strategy highest", | ||
"lerna:version:up": "lerna version --yes", | ||
"release:github:registry": "yarn publish --registry https://npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}", | ||
"release:npm:registry": "yarn publish", | ||
"test": "run-s test:depcruise test:jest", | ||
"test:depcruise": "depcruise --validate .dependency-cruiser.js src", | ||
"test:jest": "jest -c ./jest.config.js", | ||
"ts": "ts-node -P tsconfig.build.json" | ||
"simple-git-hooks": { | ||
"pre-commit": "pnpm lint-staged" | ||
}, | ||
@@ -52,31 +42,33 @@ "resolutions": { | ||
"devDependencies": { | ||
"@types/flat": "5.0.1", | ||
"@types/jest": "26.0.20", | ||
"@types/node": "14.14.20", | ||
"@types/rimraf": "3.0.0", | ||
"@typescript-eslint/eslint-plugin": "4.12.0", | ||
"@typescript-eslint/parser": "4.12.0", | ||
"@swc/core": "^1.2.173", | ||
"@swc/helpers": "^0.3.8", | ||
"@swc/jest": "^0.2.20", | ||
"@types/flat": "5.0.2", | ||
"@types/jest": "27.4.1", | ||
"@types/node": "17.0.25", | ||
"@types/rimraf": "3.0.2", | ||
"@typescript-eslint/eslint-plugin": "5.20.0", | ||
"@typescript-eslint/parser": "5.20.0", | ||
"cherry-pick": "0.5.0", | ||
"conventional-changelog-angular-all": "1.7.0", | ||
"cpy": "8.1.1", | ||
"dependency-cruiser": "9.21.6", | ||
"eslint": "7.17.0", | ||
"eslint-config-prettier": "7.1.0", | ||
"eslint-plugin-import": "2.22.1", | ||
"dependency-cruiser": "11.6.0", | ||
"eslint": "8.13.0", | ||
"eslint-config-prettier": "8.5.0", | ||
"eslint-plugin-import": "2.26.0", | ||
"execa": "5.0.0", | ||
"generate-changelog": "1.8.0", | ||
"husky": "4.3.7", | ||
"jest": "26.6.3", | ||
"jest-cli": "26.6.3", | ||
"lerna": "3.22.1", | ||
"lint-staged": "10.5.3", | ||
"husky": "7.0.4", | ||
"jest": "27.5.1", | ||
"jest-cli": "27.5.1", | ||
"lerna": "4.0.0", | ||
"lint-staged": "12.4.0", | ||
"npm-run-all": "4.1.5", | ||
"prettier": "2.2.1", | ||
"prettier": "2.6.2", | ||
"rimraf": "3.0.2", | ||
"simple-git-hooks": "^2.7.0", | ||
"sort-package-json": "1.48.1", | ||
"ts-jest": "26.4.4", | ||
"ts-node": "9.1.1", | ||
"typescript": "4.1.3", | ||
"yarn-deduplicate": "3.1.0" | ||
"sort-package-json": "1.55.0", | ||
"ts-jest": "27.1.4", | ||
"ts-node": "10.7.0", | ||
"typescript": "4.6.3" | ||
}, | ||
@@ -89,5 +81,16 @@ "engines": { | ||
}, | ||
"simple-git-hooks": { | ||
"pre-commit": "pnpm lint-staged" | ||
} | ||
"scripts": { | ||
"build": "pnpm ts ./scripts/build.ts", | ||
"clean": "pnpm ts ./scripts/clean.ts", | ||
"format:code": "prettier \"**/*.{js,jsx,ts,tsx,json,yml,yaml,md,html}\" --write", | ||
"lerna:version:up": "lerna version --yes", | ||
"release:github:registry": "pnpm publish --registry https://npm.pkg.github.com/:_authToken=${NODE_AUTH_TOKEN}", | ||
"release:npm:registry": "pnpm publish", | ||
"test": "run-s test:depcruise test:jest", | ||
"test:depcruise": "depcruise --validate .dependency-cruiser.js src", | ||
"test:jest": "jest -c ./jest.config.js --collect-coverage", | ||
"test:jest:watch": "jest -c ./jest.config.js --watch --collect-coverage", | ||
"ts": "ts-node -P tsconfig.build.json" | ||
}, | ||
"readme": "# @himenon/openapi-parameter-formatter\n\nA library that serializes OpenAPI parameter objects.\nIt is implemented according to the following style definition.\n\n- https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.1.0.md#style-examples\n\n## Usage\n\n```ts\nimport { PathParameter } from \"@himenon/openapi-parameter-formatter\";\n\nPathParameter.generate(\"color\", {\n value: {\n R: 100,\n G: 200,\n B: 150,\n },\n style: \"label\",\n explode: true,\n});\n```\n\n```ts\nimport { QueryParameter } from \"@himenon/openapi-parameter-formatter\";\n\nQueryParameter.generate(\"color\", {\n value: {\n R: 100,\n G: 200,\n B: 150,\n },\n style: \"deepObject\",\n explode: true,\n});\n// color[R]=100&color[G]=200&color[B]=150\n```\n\n```ts\nimport { HeaderParameter } from \"@himenon/openapi-parameter-formatter\";\n\nHeaderParameter.generate(\"color\", {\n value: [\"blue\", \"black\", \"brown\"],\n style: \"simple\",\n explode: false,\n});\n// \"blue,black,brown\"\n```\n\n```ts\nimport { CookieParameter } from \"@himenon/openapi-parameter-formatter\";\n\nCookieParameter.generate(\"color\", {\n value: [\"blue\", \"black\", \"brown\"],\n style: \"form\",\n explode: false,\n});\n// \"color=R,100,G,200,B,150\"\n```\n\n## LICENCE\n\n[@himenon/openapi-parameter-formatter](https://github.com/Himenon/openapi-parameter-formatter)・MIT\n" | ||
} |
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
45437
943
31