📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP →

@api-components/api-example-generator

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@api-components/api-example-generator - npm Package Compare versions

Comparing version

to
3.0.0

@@ -8,3 +8,3 @@ /**

* To modify these typings, edit the source file(s):
* api-example-generator.html
* api-example-generator.js
*/

@@ -16,5 +16,8 @@

/// <reference path="../polymer/types/polymer-element.d.ts" />
/// <reference path="../amf-helper-mixin/amf-helper-mixin.d.ts" />
import {LitElement} from 'lit-element';
import {AmfHelperMixin} from '@api-components/amf-helper-mixin/amf-helper-mixin.js';
export {ApiExampleGenerator};
declare namespace ApiElements {

@@ -79,3 +82,3 @@

class ApiExampleGenerator extends
ApiElements.AmfHelperMixin(
AmfHelperMixin(
Object) {

@@ -159,2 +162,15 @@

/**
* In AMF 4 the examples model changes from being an array of examples
* to an object that contains an array of examples.
* This function extracts the array of examples back to the `examples` variable,
* respecting that the compact model can be an object instead of array.
* If the argument is an array with more than one item it means it's pre-4.0.0
* model.
*
* @param examples Examples model.
* @returns List of examples to process.
*/
_processExamples(examples: any[]|object|null): any[]|null|undefined;
/**
* Uses Example shape's source maps to determine which examples should be rendered.

@@ -232,2 +248,11 @@ *

/**
* Casts the value to given data type represented in AMF notation.
*
* @param value Value encoded in AMF
* @param type AMF data type
* @returns Casted value.
*/
_typeToValue(value: String|null, type: String|null): String|Number|Boolean|null;
/**
* Computes JSON example from UnionShape

@@ -241,2 +266,3 @@ *

_computeJsonArrayValue(range: any): any;
_extractExampleRawValue(example: any): any;

@@ -288,7 +314,6 @@ /**

* @param node Current node
* @param property AMF property
* @param range AMF range
* @returns Newly created element
*/
_appendXmlElement(doc: Document|null, node: Element|null, property: object|null, range: object|null): Element|null;
_appendXmlElement(doc: Document|null, node: Element|null, range: object|null): Element|null;
_appendXmlElements(doc: any, node: any, property: any, range: any): void;

@@ -313,4 +338,7 @@ _appendXmlArray(doc: any, node: any, property: any, range: any, isWrapped: any): void;

interface HTMLElementTagNameMap {
"api-example-generator": ApiElements.ApiExampleGenerator;
declare global {
interface HTMLElementTagNameMap {
"api-example-generator": ApiElements.ApiExampleGenerator;
}
}

@@ -1,3 +0,3 @@

import {PolymerElement} from '../../@polymer/polymer/polymer-element.js';
import {AmfHelperMixin} from '../../@api-components/amf-helper-mixin/amf-helper-mixin.js';
import { LitElement } from 'lit-element';
import { AmfHelperMixin } from '@api-components/amf-helper-mixin/amf-helper-mixin.js';
/**

@@ -65,10 +65,4 @@ * `api-example-generator`

*/
export class ApiExampleGenerator extends AmfHelperMixin(PolymerElement) {
export class ApiExampleGenerator extends AmfHelperMixin(LitElement) {
/**
* @type {String}
*/
static get is() {
return 'api-example-generator';
}
/**
* Lists media types names for payloads.

@@ -1259,2 +1253,2 @@ * The `payloads` is an array of AMF Payload shape. It can be single Payload

}
window.customElements.define(ApiExampleGenerator.is, ApiExampleGenerator);
window.customElements.define('api-example-generator', ApiExampleGenerator);

@@ -11,3 +11,3 @@ {

"name": "@api-components/api-example-generator",
"version": "3.0.0-preview.7",
"version": "3.0.0",
"license": "Apache-2.0",

@@ -20,8 +20,9 @@ "main": "api-example-generator.js",

"devDependencies": {
"@api-components/api-model-generator": "^0.2.0-preview.2",
"@api-components/api-navigation": "^3.0.0-preview.2",
"@advanced-rest-client/arc-demo-helper": "^1.0.1",
"@advanced-rest-client/testing-karma-sl": "^1.0.2",
"@api-components/api-model-generator": "0.1.12",
"@api-components/api-navigation": "^3.0.1",
"@open-wc/testing": "^0.11.1",
"@open-wc/testing-karma": "^2.0.0",
"@polymer/gen-typescript-declarations": "^1.6.1",
"@polymer/iron-component-page": "^4.0.0",
"@polymer/iron-demo-helpers": "^3.1.0",
"@polymer/iron-test-helpers": "^3.0.0",
"@polymer/paper-checkbox": "^3.0.0",

@@ -31,15 +32,14 @@ "@polymer/paper-dropdown-menu": "^3.0.0",

"@polymer/paper-listbox": "^3.0.0",
"@polymer/test-fixture": "^4.0.2",
"@webcomponents/webcomponentsjs": "^2.2.10",
"chai": "^4.2.0",
"mocha": "^5.2.0",
"sinon": "^7.3.2",
"wct-mocha": "^1.0.0",
"owc-dev-server": "^0.3.0",
"web-animations-js": "^2.3.1"
},
"scripts": {
"lint": "polymer lint api-example-generator.html",
"test-sauce": "polymer test --plugin sauce --job-name \"api-example-generator:local-test\"",
"test": "polymer test --plugin local",
"update-types": "gen-typescript-declarations --deleteExisting --outDir ."
"start": "owc-dev-server -o",
"test": "karma start --coverage",
"update-types": "gen-typescript-declarations --deleteExisting --outDir .",
"test:watch": "karma start --auto-watch=true --single-run=false",
"test:legacy": "karma start --legacy --coverage",
"test:legacy:watch": "karma start --legacy --auto-watch=true --single-run=false",
"test:sl": "karma start karma.sl.config.js --legacy --coverage"
},

@@ -55,4 +55,5 @@ "bugs": {

"dependencies": {
"@polymer/polymer": "^3.2.0"
"@api-components/amf-helper-mixin": "^3.0.1",
"lit-element": "^2.0.1"
}
}
[![Published on NPM](https://img.shields.io/npm/v/@api-components/api-example-generator.svg)](https://www.npmjs.com/package/@api-components/api-example-generator)
[![Build Status](https://travis-ci.org/api-components/api-example-generator.svg?branch=stage)](https://travis-ci.org/api-components/api-example-generator)
[![Build Status](https://travis-ci.org/advanced-rest-client/api-example-generator.svg?branch=stage)](https://travis-ci.org/advanced-rest-client/api-example-generator)
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/api-components/api-example-generator)
[![Published on webcomponents.org](https://img.shields.io/badge/webcomponents.org-published-blue.svg)](https://www.webcomponents.org/element/advanced-rest-client/api-example-generator)

@@ -41,12 +41,12 @@ ## &lt;api-example-generator&gt;

### In a Polymer 3 element
### In a LitElement element
```js
import {PolymerElement, html} from '@polymer/polymer';
import { LitElement, html } from 'lit-element';
import '@api-components/api-example-generator/api-example-generator.js';
class SampleElement extends PolymerElement {
static get template() {
class SampleElement extends LitElement {
render() {
return html`
<api-example-generator></api-example-generator>
<api-example-generator .amf="${this.model}"></api-example-generator>
`;

@@ -61,6 +61,5 @@ }

```sh
git clone https://github.com/api-components/api-example-generator
cd api-url-editor
git clone https://github.com/advanced-rest-client/api-example-generator
cd api-example-generator
npm install
npm install -g polymer-cli
```

@@ -71,4 +70,3 @@

```sh
polymer serve --npm
open http://127.0.0.1:<port>/demo/
npm start
```

@@ -78,3 +76,3 @@

```sh
polymer test --npm
npm test
```

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