New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@api-components/amf-helper-mixin

Package Overview
Dependencies
Maintainers
3
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@api-components/amf-helper-mixin - npm Package Compare versions

Comparing version 4.3.2 to 4.3.3

43

package.json
{
"name": "@api-components/amf-helper-mixin",
"description": "A mixin with common functions user by most AMF components to compyte AMF values",
"version": "4.3.2",
"description": "A mixin with common functions user by most AMF components to compute AMF values",
"version": "4.3.3",
"license": "Apache-2.0",

@@ -14,4 +14,3 @@ "main": "index.js",

"authors": [
"Pawel Psztyc",
"The Advanced REST client authors <arc@mulesoft.com>"
"Pawel Psztyc"
],

@@ -33,29 +32,23 @@ "contributors": [

"@api-components/api-model-generator": "^0.2.8",
"@open-wc/eslint-config": "^2.0.0",
"@open-wc/eslint-config": "^4.2.0",
"@open-wc/testing": "^2.5.17",
"@open-wc/testing-karma": "^3.4.0",
"@web/test-runner": "^0.9.12",
"@web/test-runner-playwright": "^0.6.6",
"deepmerge": "^4.2.2",
"es-dev-server": "^1.53.0",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.11.0",
"husky": "^4.2.5",
"@web/dev-server": "^0.1.3",
"@web/test-runner": "^0.12.1",
"@web/test-runner-playwright": "^0.8.0",
"eslint": "^7.17.0",
"eslint-config-prettier": "^7.1.0",
"husky": "^4.3.7",
"lint-staged": "^10.2.6",
"lit-element": "^2.3.1",
"lit-html": "^1.2.1",
"prettier": "^2.0.5",
"sinon": "^9.0.2",
"typescript": "^3.9.2",
"sinon": "^9.2.3",
"typescript": "^4.1.3",
"typescript-lit-html-plugin": "^0.9.0"
},
"scripts": {
"start": "es-dev-server --app-index demo/index.html --node-resolve --open --watch",
"lint:eslint": "eslint --ext .js,.html . --ignore-path .gitignore",
"format:eslint": "eslint --ext .js,.html . --fix --ignore-path .gitignore",
"lint:prettier": "prettier \"**/*.js\" --check --ignore-path .gitignore",
"format:prettier": "prettier \"**/*.js\" --write --ignore-path .gitignore",
"lint:types": "tsc",
"lint": "npm run lint:eslint && npm run lint:prettier",
"format": "npm run format:eslint && npm run format:prettier",
"lint": "npm run lint:eslint",
"format": "npm run format:eslint",
"test": "web-test-runner test/**/*.test.js --coverage --node-resolve --playwright --browsers chromium firefox webkit",

@@ -73,4 +66,3 @@ "test:watch": "web-test-runner test/**/*.test.js --node-resolve --watch",

"files": [
"**/demo/**/*.js",
"**/demo/**/*.html"
"test/**/*.js"
],

@@ -81,2 +73,3 @@ "rules": {

"no-unused-expressions": "off",
"no-param-reassing": "off",
"class-methods-use-this": "off",

@@ -88,6 +81,2 @@ "import/no-extraneous-dependencies": "off"

},
"prettier": {
"singleQuote": true,
"arrowParens": "always"
},
"husky": {

@@ -94,0 +83,0 @@ "hooks": {

@@ -10,3 +10,3 @@ import { Namespace } from './Namespace';

*
* (Only applies when using `_computeEndpointUri()` function)
* (Only applies when using `_computeUri()` function)
*

@@ -19,12 +19,6 @@ * By default the component render the documentation as it is defined

*
* To update base URI value either update `baseUri` property or use
* `iron-meta` with key `ApiBaseUri`. First method is easier but the second
* gives much more flexibility since it use a
* [monostate pattern](http://wiki.c2.com/?MonostatePattern)
* to manage base URI property.
* To update base URI value update the `baseUri` property.
*
* When the component constructs the final URI for the endpoint it does the following:
* - if `baseUri` is set it uses this value as a base uri for the endpoint
* - else if `iron-meta` with key `ApiBaseUri` exists and contains a value
* it uses it uses this value as a base uri for the endpoint
* - else if `amf` is set then it computes base uri value from main

@@ -71,3 +65,3 @@ * model document

*
* It is only usefult for the element to resolve references.
* It is only useful for the element to resolve references.
*/

@@ -77,5 +71,13 @@ amf: object|object[]|undefined;

/**
* This is an abstract method to be implemented by the components.
* If, instead, the component uses `amf` setter you must use `super.amf` to
* set the value.
* @param amf Current AMF model. Can be undefined.
*/
__amfChanged(amf: any): void
/**
* Returns compact model key for given value.
*
* @param property AMF orioginal property
* @param property AMF original property
* @returns Compact model property name or the same value if

@@ -92,3 +94,3 @@ * value not found in the context.

*/
_ensureAmfModel(amf: object|object[]): object|undefined;
_ensureAmfModel(amf: any): object|undefined;

@@ -106,3 +108,3 @@ /**

/**
* Gets a signle scalar value from a model.
* Gets a single scalar value from a model.
*

@@ -159,3 +161,3 @@ * @param model Amf model to extract the value from.

/**
* Tests if a passed argumet exists.
* Tests if a passed argument exists.
*

@@ -185,2 +187,5 @@ * @param value A value to test

_computeHeaders(shape: object): object[]|undefined|object;
_computeHeaderSchema(shape: object): object|undefined;
/**

@@ -192,3 +197,3 @@ * Computes a list of query parameters

/**
* In OAS URI parmaeters can be defined on an operation level under `uriParameter` proeprty.
* In OAS URI parameters can be defined on an operation level under `uriParameter` property.
* Normally `_computeQueryParameters()` function would be used to extract parameters from an endpoint.

@@ -199,3 +204,3 @@ * This is a fallback option to test when an API is OAS.

*/
_computeUriParameters(shape: object): Array<object>|undefined;
_computeUriParameters(shape: object): object[]|undefined;
/**

@@ -218,3 +223,3 @@ * Computes a list of responses

* @param endpoint Endpoint model
* @param method Optional method to be used to llokup the parameters from
* @param method Optional method to be used to lookup the parameters from
* This is used for OAS model which can defined path parameters on a method level.

@@ -292,2 +297,31 @@ * @returns Parameters if defined.

/**
* Computes AMF's `http://schema.org/API` model
*
* @param model AMF json/ld model for an API
* @return The API declaration.
*/
_computeApi(model: any): object;
/**
* Returns whether an AMF node is a WebAPI node
*
* @param model AMF json/ld model for an API
*/
_isWebAPI(model: any): boolean;
/**
* Returns whether an AMF node is an AsyncAPI node
*
* @param model AMF json/ld model for an API
*/
_isAsyncAPI(model: any): boolean;
/**
* Returns whether an AMF node is an API node
*
* @param model AMF json/ld model for an API
*/
_isAPI(model: any): boolean;
/**
* Computes value for `server` property that is later used with other computations.

@@ -301,2 +335,12 @@ *

/**
* Determines whether a partial model is valid for reading servers from
* Current valid values:
* - Operation
* - Endpoint
* @param model The partial model to evaluate
* @returns Whether the model's type is part of the array of valid node types from which to read servers
*/
_isValidServerPartial(model: any): boolean;
/**
* @returns List of servers for method, if defined, or endpoint, if defined, or root level

@@ -337,2 +381,7 @@ */

/**
* Appends endpoint's path to the url
*/
_appendPath(url: string, endpoint: any): string;
/**
* Computes base URI value from either `baseUri`, `iron-meta` with

@@ -352,3 +401,3 @@ * `ApiBaseUri` key or `amf` value (in this order).

* @param server AMF API model for Server.
* @param protocols Listy of supporte dprotocols. If not
* @param protocols List of supported protocols. If not
* provided and required to compute the url it uses `amf` to compute

@@ -407,3 +456,3 @@ * protocols

* @param id Selected shape ID
* @returns An endponit definition
* @returns An endpoint definition
*/

@@ -417,3 +466,3 @@ _computeEndpointModel(webApi: object, id: string): object|undefined;

* @param path Endpoint path
* @returns An endponit definition
* @returns An endpoint definition
*/

@@ -450,2 +499,12 @@ _computeEndpointByPath(webApi: object, path: string): object|undefined;

/**
* Computes a list of methods for an endpoint that contains a method with
* given id.
*
* @param webApi WebApi model
* @param methodId Method id.
* @returns A list of sibling methods or undefined.
*/
__computeMethodsListForMethod(webApi: any, methodId: string): any[]|undefined;
/**
* Computes a type documentation model.

@@ -485,3 +544,3 @@ *

*/
_computeDocument(webApi: object|null, selected: string|null): object|undefined;
_computeDocument(webApi: any, selected: string): any|undefined;

@@ -516,19 +575,21 @@ /**

_resolveRecursive(shape: object): void;
/**
* Merge two shapes together. If the resulting shape has one of the "special merge" keys,
* then the special merge function for that key will be used to match that property
* @param shapeA AMF node
* @param shapeB AMF node
* @returns Merged AMF node
*/
_mergeShapes(shapeA: object, shapeB: object): object;
_mergeSourceMapsSources(shapeA: object, shapeB: object): object[];
_computeApi(model: object): object | undefined;
_isWebAPI(model: object): boolean;
_isAsyncAPI(model: object): boolean;
_isAPI(model: object): boolean;
_computeHeaderSchema(shape: object): object | undefined
/**
* This is an abstract method to be implemented by the components.
* If, instead, the component uses `amf` setter you must use `super.amf` to
* set the value.
* @param {Array|Object} amf Current AMF model. Can be undefined.
* @abstract
* Obtains source map sources value from two shapes and returns the merged result
* If neither shape has a sources node, then an empty object will be returned.
* Result is wrapped in an array as per AMF model standard
* @param AMF node
* @param AMF node
* @returns Empty object or resulting merge, wrapped in an array
*/
/* eslint-disable-next-line no-unused-vars */
__amfChanged(amf: object | object[]): void
_mergeSourceMapsSources(shapeA: object, shapeB: object): object[];
}

@@ -56,3 +56,3 @@ /**

*
* It is only usefult for the element to resolve references.
* It is only useful for the element to resolve references.
*

@@ -104,3 +104,3 @@ * @type {Object|Array<Object>}

* Returns compact model key for given value.
* @param {string} property AMF orioginal property
* @param {string} property AMF original property
* @return {string} Compact model property name or the same value if

@@ -194,3 +194,3 @@ * value not found in the context.

/**
* Gets a signle scalar value from a model.
* Gets a single scalar value from a model.
* @param {Object} model Amf model to extract the value from.

@@ -306,3 +306,3 @@ * @param {string} key Model key to search for the value

/**
* Tests if a passed argumet exists.
* Tests if a passed argument exists.
*

@@ -363,3 +363,3 @@ * @param {string|Object|number} value A value to test

/**
* In OAS URI parmaeters can be defined on an operation level under `uriParameter` proeprty.
* In OAS URI parameters can be defined on an operation level under `uriParameter` property.
* Normally `_computeQueryParameters()` function would be used to extract parameters from an endpoint.

@@ -406,3 +406,3 @@ * This is a fallback option to test when an API is OAS.

* @param {Object} endpoint Endpoint model
* @param {Object=} method Optional method to be used to llokup the parameters from
* @param {Object=} method Optional method to be used to lookup the parameters from
* This is used for OAS model which can defined path parameters on a method level.

@@ -686,5 +686,3 @@ * @return {Array<Object>|undefined} Parameters if defined.

const getRootServers = () => {
return this._getValueArray(api, serverKey);
};
const getRootServers = () => this._getValueArray(api, serverKey);
const getEndpointServers = () => {

@@ -759,3 +757,3 @@ const endpoint = this._computeEndpointModel(api, endpointId);

* @param {Object=} opts.server Model for current server, if available.
* @param {string=} opts.baseUri Base URI to be used with the endpoint's paht.
* @param {string=} opts.baseUri Base URI to be used with the endpoint's path.
* Note, base URI is ignored when `ignoreBase` is set

@@ -765,4 +763,4 @@ * @param {string=} opts.version Current version of the API. It is used to replace

* @param {boolean=} [opts.ignoreBase = false] Whether or not to ignore rendering
* @param {string[]=} [opts.protocols] List of available protocols
* of the base URI with path.
* @param {string[]=} [opts.protocols] List of available protocols of the base URI with path.
* @param {boolean=} [opts.ignorePath]
* @return {string} The base uri for the endpoint.

@@ -819,3 +817,3 @@ */

* @param {Object} server AMF API model for Server.
* @param {?Array<string>} protocols Listy of supporte dprotocols. If not
* @param {?Array<string>} protocols The list of supported protocols. If not
* provided and required to compute the url it uses `amf` to compute

@@ -909,4 +907,4 @@ * protocols

const rawKey = this.ns.aml.vocabularies.document.raw;
const skey = this._getAmfKey(schemaKey);
let schema = item && item[skey];
const sKey = this._getAmfKey(schemaKey);
let schema = item && item[sKey];
if (!schema) {

@@ -951,3 +949,3 @@ return undefined;

* @param {string} id Selected shape ID
* @return {Object} An endponit definition
* @return {Object} An endpoint definition
*/

@@ -967,3 +965,3 @@ _computeEndpointModel(webApi, id) {

* @param {string} path Endpoint path
* @return {Object|undefined} An endponit definition
* @return {Object|undefined} An endpoint definition
*/

@@ -1327,4 +1325,4 @@ _computeEndpointByPath(webApi, path) {

* then the special merge function for that key will be used to match that property
* @param shapeA AMF node
* @param shapeB AMF node
* @param {any} shapeA AMF node
* @param {any} shapeB AMF node
* @return {*} Merged AMF node

@@ -1331,0 +1329,0 @@ * @private

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc