@api-client/ui 0.0.13 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/define/http/http-body-editor.d.ts.map +1 -1
- package/dist/define/http/http-body-editor.js +1 -1
- package/dist/define/http/http-body-editor.js.map +1 -1
- package/dist/elements/http/BodyEditor.js +5 -5
- package/dist/elements/http/BodyEditor.js.map +1 -1
- package/dist/elements/http/BodyEditor.styles.d.ts +1 -1
- package/dist/elements/http/BodyEditor.styles.d.ts.map +1 -1
- package/dist/elements/http/BodyEditor.styles.js +5 -19
- package/dist/elements/http/BodyEditor.styles.js.map +1 -1
- package/dist/elements/store/FilesLib.d.ts +2 -2
- package/dist/elements/store/FilesLib.d.ts.map +1 -1
- package/dist/elements/store/FilesLib.js.map +1 -1
- package/dist/http-client/store/Cursor.js +2 -2
- package/dist/http-client/store/Cursor.js.map +1 -1
- package/dist/http-client/store/HttpClientIdbDatabase.d.ts.map +1 -1
- package/dist/http-client/store/HttpClientIdbDatabase.js +2 -6
- package/dist/http-client/store/HttpClientIdbDatabase.js.map +1 -1
- package/dist/http-client/store/State.d.ts +1 -3
- package/dist/http-client/store/State.d.ts.map +1 -1
- package/dist/http-client/store/State.js.map +1 -1
- package/dist/http-client/store/idb/IdbStore.d.ts +1 -10
- package/dist/http-client/store/idb/IdbStore.d.ts.map +1 -1
- package/dist/http-client/store/idb/IdbStore.js +0 -48
- package/dist/http-client/store/idb/IdbStore.js.map +1 -1
- package/dist/http-client/store/types.d.ts +2 -56
- package/dist/http-client/store/types.d.ts.map +1 -1
- package/dist/http-client/store/types.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/pages/api-client/ApiClient.screen.d.ts +4 -4
- package/dist/pages/api-client/ApiClient.screen.d.ts.map +1 -1
- package/dist/pages/api-client/ApiClient.screen.js +2 -2
- package/dist/pages/api-client/ApiClient.screen.js.map +1 -1
- package/dist/pages/api-client/pages/Trash.page.d.ts.map +1 -1
- package/dist/pages/api-client/pages/Trash.page.js +3 -11
- package/dist/pages/api-client/pages/Trash.page.js.map +1 -1
- package/dist/ui/list/UiDropdownList.js +1 -1
- package/dist/ui/list/UiDropdownList.js.map +1 -1
- package/package.json +2 -2
- package/src/define/http/http-body-editor.ts +1 -1
- package/src/elements/http/BodyEditor.styles.ts +5 -19
- package/src/elements/http/BodyEditor.ts +5 -5
- package/src/elements/store/FilesLib.ts +2 -2
- package/src/http-client/store/Cursor.ts +2 -2
- package/src/http-client/store/HttpClientIdbDatabase.ts +5 -9
- package/src/http-client/store/State.ts +1 -5
- package/src/http-client/store/idb/IdbStore.ts +1 -51
- package/src/http-client/store/types.ts +2 -57
- package/src/index.ts +3 -0
- package/src/pages/api-client/ApiClient.screen.ts +7 -7
- package/src/pages/api-client/pages/Trash.page.ts +3 -10
- package/src/ui/list/UiDropdownList.ts +1 -1
- package/web-test-runner.config.mjs +2 -2
- package/dist/http-client/store/Validator.d.ts +0 -4
- package/dist/http-client/store/Validator.d.ts.map +0 -1
- package/dist/http-client/store/Validator.js +0 -32
- package/dist/http-client/store/Validator.js.map +0 -1
- package/src/http-client/store/Validator.ts +0 -33
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-body-editor.d.ts","sourceRoot":"","sources":["../../../src/define/http/http-body-editor.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,mCAAmC,CAAC;AAGxD,qBACa,qBAAsB,SAAQ,OAAO;IAChD,OAAgB,MAAM,
|
|
1
|
+
{"version":3,"file":"http-body-editor.d.ts","sourceRoot":"","sources":["../../../src/define/http/http-body-editor.ts"],"names":[],"mappings":"AACA,OAAO,OAAO,MAAM,mCAAmC,CAAC;AAGxD,qBACa,qBAAsB,SAAQ,OAAO;IAChD,OAAgB,MAAM,4BAAe;CACtC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,kBAAkB,EAAE,qBAAqB,CAAC;KAC3C;CACF"}
|
|
@@ -3,7 +3,7 @@ import { customElement } from 'lit/decorators.js';
|
|
|
3
3
|
import Element from '../../elements/http/BodyEditor.js';
|
|
4
4
|
import styles from '../../elements/http/BodyEditor.styles.js';
|
|
5
5
|
let HttpBodyEditorElement = class HttpBodyEditorElement extends Element {
|
|
6
|
-
static { this.styles = [styles]; }
|
|
6
|
+
static { this.styles = [...styles]; }
|
|
7
7
|
};
|
|
8
8
|
HttpBodyEditorElement = __decorate([
|
|
9
9
|
customElement('http-body-editor')
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-body-editor.js","sourceRoot":"","sources":["../../../src/define/http/http-body-editor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,OAAO,MAAM,mCAAmC,CAAC;AACxD,OAAO,MAAM,MAAM,0CAA0C,CAAC;AAGvD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,OAAO;aAChC,WAAM,GAAG,CAAC,MAAM,CAAC,CAAC;;
|
|
1
|
+
{"version":3,"file":"http-body-editor.js","sourceRoot":"","sources":["../../../src/define/http/http-body-editor.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,OAAO,MAAM,mCAAmC,CAAC;AACxD,OAAO,MAAM,MAAM,0CAA0C,CAAC;AAGvD,IAAM,qBAAqB,GAA3B,MAAM,qBAAsB,SAAQ,OAAO;aAChC,WAAM,GAAG,CAAC,GAAG,MAAM,CAAC,CAAC;;AAD1B,qBAAqB;IADjC,aAAa,CAAC,kBAAkB,CAAC;GACrB,qBAAqB,CAEjC;SAFY,qBAAqB","sourcesContent":["import { customElement } from 'lit/decorators.js';\nimport Element from '../../elements/http/BodyEditor.js';\nimport styles from '../../elements/http/BodyEditor.styles.js';\n\n@customElement('http-body-editor')\nexport class HttpBodyEditorElement extends Element {\n static override styles = [...styles];\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'http-body-editor': HttpBodyEditorElement;\n }\n}\n"]}
|
|
@@ -616,7 +616,7 @@ export default class BodyEditor extends ApiElement {
|
|
|
616
616
|
>
|
|
617
617
|
URL decode
|
|
618
618
|
</ui-button>
|
|
619
|
-
<label title="When set it automatically encodes the values before sending the request">
|
|
619
|
+
<label title="When set it automatically encodes the values before sending the request" class="label-medium">
|
|
620
620
|
<ui-checkbox .checked="${autoEncode}" @change="${this.handleUrlEncodeAutoChange}"></ui-checkbox>
|
|
621
621
|
Encode on send
|
|
622
622
|
</label>
|
|
@@ -728,7 +728,7 @@ export default class BodyEditor extends ApiElement {
|
|
|
728
728
|
}
|
|
729
729
|
renderFormInfo() {
|
|
730
730
|
return html `
|
|
731
|
-
<p class="form-info">
|
|
731
|
+
<p class="form-info body-small">
|
|
732
732
|
Note that the content-type header will be added when the request is sent.
|
|
733
733
|
</p>
|
|
734
734
|
`;
|
|
@@ -752,7 +752,7 @@ export default class BodyEditor extends ApiElement {
|
|
|
752
752
|
const { value } = this;
|
|
753
753
|
const { size, name } = value;
|
|
754
754
|
return html `
|
|
755
|
-
<div class="file-info">
|
|
755
|
+
<div class="file-info label-medium">
|
|
756
756
|
<span class="file-name">${name || 'unknown name'}</span>
|
|
757
757
|
<span class="file-size">${size} bytes</span>
|
|
758
758
|
<ui-icon-button
|
|
@@ -772,7 +772,7 @@ export default class BodyEditor extends ApiElement {
|
|
|
772
772
|
}
|
|
773
773
|
const id = this.invalidMimeMessage;
|
|
774
774
|
return html `
|
|
775
|
-
<div class="invalid-mime">
|
|
775
|
+
<div class="invalid-mime body-medium">
|
|
776
776
|
<ui-icon icon="warning" class="warning-icon"></ui-icon>
|
|
777
777
|
${id === 1 ? this.renderFixableInvalidMime('multipart/form-data') : ''}
|
|
778
778
|
${id === 2 ? this.renderFixableInvalidMime('application/x-www-form-urlencoded') : ''}
|
|
@@ -784,7 +784,7 @@ export default class BodyEditor extends ApiElement {
|
|
|
784
784
|
*/
|
|
785
785
|
renderFixableInvalidMime(suggested) {
|
|
786
786
|
return html `
|
|
787
|
-
<p class="message">
|
|
787
|
+
<p class="message body-medium">
|
|
788
788
|
The <code>content-type</code> header has different value than <b>${suggested}</b>.
|
|
789
789
|
</p>
|
|
790
790
|
<ui-button class="fix" type="tonal" title="Updates the content type header for the request" @click="${this.autoFixMime}">Fix</ui-button>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BodyEditor.js","sourceRoot":"","sources":["../../../src/elements/http/BodyEditor.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2CAA2C;AAC3C;;;;;;;;;;;;EAYE;AACF,OAAO,EAAE,IAAI,EAAkC,OAAO,EAAE,MAAM,KAAK,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAA0F,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC9J,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAI7D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,kDAAkD,CAAC;AAC1D,OAAO,iDAAiD,CAAC;AACzD,OAAO,4CAA4C,CAAC;AACpD,OAAO,8BAA8B,CAAC;AACtC,OAAO,qCAAqC,CAAC;AAC7C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AACzC,OAAO,+BAA+B,CAAC;AACvC,OAAO,gCAAgC,CAAC;AAUxC,MAAM,CAAC,MAAM,WAAW,GAA2B,MAAM,CAAC,MAAM,CAAC;IAC/D;QACE,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,aAAa;QACpB,KAAK,EAAE,gDAAgD;KACxD;IACD;QACE,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,kBAAkB;Q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,CAAC,IAAI,CAAC,wBAAwB,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,EAAE;QACpE,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,mCAAmC,CAAC,CAAC,CAAC,CAAC,EAAE;;KAErF,CAAC;IACJ,CAAC;IAED;;OAEG;IACO,wBAAwB,CAAC,SAAiB;QAClD,OAAO,IAAI,CAAA;;2EAE4D,SAAS;;4GAEwB,IAAI,CAAC,WAAW;KACvH,CAAC;IACJ,CAAC;CACF;AApxB6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAiC;AAU5D;IADC,QAAQ,EAAE;uCAGV;AAoBD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;uCAGzB;AAkB2C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAkB;AAMjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAkB;AAMjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAoB;AAepB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAsB;AAQ1B;IAArC,KAAK,CAAC,6BAA6B,CAAC;oDAAmD;AAEnD;IAApC,KAAK,CAAC,4BAA4B,CAAC;mDAAiD","sourcesContent":["/* eslint-disable lit-a11y/no-autofocus */\n/* eslint-disable class-methods-use-this */\n/**\n@license\nCopyright 2020 The Advanced REST client authors <arc@mulesoft.com>\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not\nuse this file except in compliance with the License. You may obtain a copy of\nthe License at\nhttp://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\nWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\nLicense for the specific language governing permissions and limitations under\nthe License.\n*/\nimport { html, TemplateResult, PropertyValues, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { IBodyMetaModel, IMultipartBody, IProperty, IRawBody, ISafePayload, IUrlEncodedBodyMeta, PayloadSerializer } from '@api-client/core/build/browser.js';\nimport { ifProperty } from '../../directives/if-property.js';\nimport BodyUrlEncodedEditor from './BodyUrlEncodedEditor.js';\nimport BodyTextEditor from './BodyTextEditor.js';\nimport BodyMultipartEditor from './BodyMultipartEditor.js';\nimport { Events } from '../../events/Events.js';\nimport ApiElement from '../ApiElement.js';\nimport CheckboxElement from '../../ui/input/CheckboxElement.js';\nimport '../../define/ui/ui-icon.js';\nimport '../../define/http/http-body-urlencoded-editor.js';\nimport '../../define/http/http-body-multipart-editor.js';\nimport '../../define/http/http-body-text-editor.js';\nimport '../../define/ui/ui-button.js';\nimport '../../define/ui/ui-dropdown-list.js';\nimport '../../define/ui/ui-list.js';\nimport '../../define/ui/ui-list-item.js';\nimport '../../define/ui/ui-divider.js';\nimport '../../define/ui/ui-checkbox.js';\n\nexport type AllowedEditor = 'raw' | 'urlEncode' | 'multipart' | 'file';\n\nexport interface EditorType {\n id: AllowedEditor;\n label: string;\n title: string;\n}\n\nexport const editorTypes: Readonly<EditorType[]> = Object.freeze([\n {\n id: 'raw',\n label: 'Text editor',\n title: 'Opens a source editor with syntax highlighting'\n },\n {\n id: 'urlEncode',\n label: 'Form URL encoded',\n title: 'Opens an editor specialized with URL encoded data types'\n },\n {\n id: 'multipart',\n label: 'Multipart form data',\n title: 'Opens an editor specialized with multipart data'\n },\n {\n id: 'file',\n label: 'A file',\n title: 'Allows to choose any binary data'\n }\n]);\n\nconst monacoContentTypes: Record<string, string> = {\n 'application/json': 'JSON',\n 'application/xml': 'XML',\n 'text/html': 'HTML',\n 'text/css': 'CSS',\n '': 'Inherited from headers'\n};\n\n/**\n * @fires change When the value and the model change\n */\nexport default class BodyEditor extends ApiElement {\n /**\n * The currently rendered editor.\n * @attribute\n */\n @property({ type: String }) selected: AllowedEditor = 'raw';\n\n protected valueInternal: unknown = '';\n\n /**\n * The HTTP body.\n *\n * Depending of current editor selection the type can vary.\n */\n @property()\n get value(): unknown {\n return this.valueInternal;\n }\n\n set value(value: unknown) {\n const old = this.valueInternal;\n if (old === value) {\n return;\n }\n // this is to be able to set a private filed value from\n // within the element\n this.valueInternal = value;\n this.requestUpdate();\n }\n\n protected modelInternal: IBodyMetaModel[] | undefined;\n\n /**\n * Previously generated by this editor metadata model.\n * Used internally to set the UI.\n */\n @property({ type: Array })\n get model(): IBodyMetaModel[] | undefined {\n return this.modelInternal;\n }\n\n set model(value: IBodyMetaModel[] | undefined) {\n const old = this.modelInternal;\n if (old === value) {\n return;\n }\n // this is to be able to set a private filed value from\n // within the element\n this.modelInternal = value;\n this.requestUpdate();\n this.modelChanged();\n }\n\n /**\n * When set the editor is in read only mode.\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) readOnly = false;\n\n /**\n * When set all controls are disabled in the form\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** \n * When set it automatically encodes and decodes values.\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) autoEncode = false;\n\n /**\n * @returns True when the current value is a file (or blob).\n */\n get hasFile(): boolean {\n const { value } = this;\n return value instanceof Blob;\n }\n\n /** \n * The current request content type. It is passed to the `raw` editor\n * to detect current language.\n * @attribute\n */\n @property({ type: String, reflect: true }) contentType?: string;\n\n protected invalidMimeMessage?: number;\n\n protected invalidMimeValue?: boolean;\n\n protected mimeValue?: string;\n\n @query('http-body-urlencoded-editor') protected urlEncodedEditor?: BodyUrlEncodedEditor;\n\n @query('http-body-multipart-editor') protected multipartEditor?: BodyMultipartEditor;\n\n constructor() {\n super();\n this.addEventListener('drop', this.handlerDrop.bind(this));\n this.addEventListener('dragover', this.handleDragOver.bind(this));\n }\n\n protected override update(cp: PropertyValues<this>): void {\n if (cp.has('contentType') || cp.has('selected')) {\n this.analyzeContentType();\n }\n super.update(cp);\n }\n\n /**\n * This must be called only when the `model` property change from the \n * outside. It restores values depending on the selected editor.\n */\n protected modelChanged(): void {\n const { selected, model } = this;\n if (!model) {\n return;\n }\n if (selected === 'file') {\n this.restoreFileModel();\n }\n const info = this.readMetaModel('urlEncode') as IUrlEncodedBodyMeta[] | undefined;\n if (Array.isArray(info) && info[0]) {\n if (typeof info[0].autoEncode === 'boolean') {\n this.autoEncode = info[0].autoEncode;\n }\n }\n }\n\n /**\n * Restores file value from the model, if exists\n */\n protected restoreFileModel(): void {\n const fileModel = this.readMetaModel('file') as ISafePayload[] | undefined;\n if (!Array.isArray(fileModel) || !fileModel.length) {\n this.valueInternal = '';\n return;\n }\n const [item] = fileModel;\n if (!item || !item.data) {\n this.valueInternal = '';\n return;\n }\n const file = PayloadSerializer.deserializeFile(item);\n this.valueInternal = file;\n }\n\n protected handleTypeChange(e: CustomEvent): void {\n const target = e.detail.item as HTMLElement | undefined;\n if (!target) {\n return;\n }\n const selected = target.dataset.type as AllowedEditor;\n this.changeEditor(selected);\n }\n\n /**\n * A handler for the editor selection. It activates an editor, if necessary.\n */\n protected async changeEditor(id: AllowedEditor): Promise<void> {\n if (this.selected === id) {\n return;\n }\n this.selected = id;\n this.analyzeContentType();\n if (id === 'raw') {\n const model = this.readMetaModel('raw') as IRawBody[];\n let value = '';\n if (Array.isArray(model) && model.length) {\n value = model[0].value;\n }\n this.value = value;\n this.notifyChange();\n }\n this.requestUpdate();\n await this.updateComplete;\n // this.notifyResize();\n if (id === 'file') {\n this.restoreFileModel();\n this.notifyChange();\n } else if (id === 'urlEncode') {\n const editor = (this.shadowRoot as ShadowRoot).querySelector('http-body-urlencoded-editor');\n if (!editor) {\n throw new Error(`Invalid state. The <http-body-urlencoded-editor> element was removed from the DOM.`);\n }\n this.value = editor.value;\n this.notifyChange();\n } else if (id === 'multipart') {\n const editor = (this.shadowRoot as ShadowRoot).querySelector('http-body-multipart-editor');\n if (!editor) {\n throw new Error(`Invalid state. The <http-body-multipart-editor> element was removed from the DOM.`);\n }\n this.value = editor.value;\n this.notifyChange();\n }\n this.dispatchEvent(new Event('select'));\n }\n\n /**\n * A handler for the file pick button click.\n * Activates the file input.\n */\n protected handlePickFile(): void {\n const input = (this.shadowRoot as ShadowRoot).querySelector('.binary-hidden') as HTMLInputElement;\n input.click();\n }\n\n /**\n * A handler for the file file selection in the file input.\n * Sets the value to the file.\n */\n protected async handleFileChange(e: Event): Promise<void> {\n const input = e.target as HTMLInputElement;\n const { files } = input;\n if (!files) {\n return;\n }\n const file = files[0];\n if (!file) {\n return;\n }\n this.valueInternal = file;\n const payload = await PayloadSerializer.stringifyFile(file);\n const model = [ payload ];\n this.setMetaModel('file', model);\n this.notifyChange();\n this.requestUpdate();\n }\n\n /**\n * Clears the current value\n */\n protected handleClearFile(): void {\n this.value = '';\n this.setMetaModel('file', []);\n this.notifyChange();\n }\n\n /**\n * Reads editor view model\n * \n * @param editor The editor id\n * @returns The view model\n */\n protected readMetaModel(editor: string): (ISafePayload | IProperty | IMultipartBody | IRawBody | IUrlEncodedBodyMeta)[] | undefined {\n const meta = this.model;\n if (!meta || !Array.isArray(meta)) {\n return undefined;\n }\n const item = meta.find((model) => model.type === editor);\n if (!item) {\n return undefined;\n }\n if (Array.isArray(item.viewModel)) {\n return item.viewModel;\n }\n return undefined;\n }\n\n /**\n * Sets editor view model on the local model\n * @param editor The editor id\n * @param model The view model\n */\n protected setMetaModel(editor: AllowedEditor, model: (ISafePayload | IProperty | IMultipartBody | IRawBody | IUrlEncodedBodyMeta)[]): void {\n if (!Array.isArray(this.modelInternal)) {\n this.modelInternal = [];\n }\n const meta = this.model as IBodyMetaModel[];\n const index = meta.findIndex((item) => item.type === editor);\n if (index === -1) {\n meta.push({ type: editor, viewModel: model });\n } else {\n meta[index].viewModel = model;\n }\n }\n\n /**\n * A handler for the change event dispatched by the \n * `urlEncode` editor.\n * Updated the local value, model, and notifies the change.\n */\n protected handleUrlEncodeChange(e: Event): void {\n const editor = e.target as BodyUrlEncodedEditor;\n this.updateUrlEncodedValue(editor);\n }\n\n protected updateUrlEncodedValue(editor: BodyUrlEncodedEditor): void {\n const { value, model } = editor;\n this.valueInternal = value;\n const info: IUrlEncodedBodyMeta = {\n model,\n autoEncode: this.autoEncode,\n };\n this.setMetaModel('urlEncode', [info]);\n this.notifyChange();\n // do not request update here.\n }\n\n /**\n * A handler for the change event dispatched by the `raw` editor.\n * Updated the local value, model, and notifies the change.\n */\n protected handleRawChange(e: Event): void {\n const editor = e.target as BodyTextEditor;\n const { value } = editor;\n this.valueInternal = value;\n const model: IRawBody[] = [{ value: value as string }];\n this.setMetaModel('raw', model);\n this.notifyChange();\n }\n\n /**\n * A handler for the change event dispatched by the \n * `multipart` editor.\n * Updated the local value, model, and notifies the change.\n */\n protected handleMultipartChange(e: Event): void {\n const editor = e.target as BodyMultipartEditor;\n const { value, model } = editor;\n this.valueInternal = value;\n this.setMetaModel('multipart', model);\n this.notifyChange();\n }\n\n /**\n * Checks whether the current content type header value matches the selected editor.\n * If not it renders a warning message.\n */\n protected analyzeContentType(): void {\n const mime = this.contentType;\n if (!mime || typeof mime !== 'string') {\n this.invalidMimeValue = false;\n this.mimeValue = undefined;\n return;\n }\n let ct = mime;\n const semicolon = ct.indexOf(';');\n if (semicolon !== -1) {\n ct = ct.substring(0, semicolon);\n }\n this.mimeValue = ct;\n if (!ct) {\n this.invalidMimeValue = false;\n return;\n }\n const { selected } = this;\n if (selected === 'multipart') {\n if (ct !== 'multipart/form-data') {\n this.invalidMimeValue = true;\n this.invalidMimeMessage = 1;\n } else {\n this.invalidMimeValue = false;\n }\n } else if (selected === 'urlEncode') {\n if (ct !== 'application/x-www-form-urlencoded') {\n this.invalidMimeValue = true;\n this.invalidMimeMessage = 2;\n } else {\n this.invalidMimeValue = false;\n }\n } else {\n this.invalidMimeValue = false;\n }\n }\n\n /**\n * Automatically fixes content type problem.\n */\n protected autoFixMime(): void {\n const { selected } = this;\n let updated = '';\n if (selected === 'urlEncode') {\n updated = 'application/x-www-form-urlencoded';\n } else if (selected === 'multipart') {\n updated = 'multipart/form-data';\n }\n Events.Http.Request.State.contentTypeChange(updated, this);\n }\n\n /**\n * A handler for the mime type selection.\n */\n protected handleMimeTypeSelect(e: CustomEvent): void {\n const target = e.detail.item as HTMLElement | undefined;\n if (!target) {\n return;\n }\n const { type = '' } = target.dataset;\n if (this.mimeValue === type) {\n return;\n }\n this.contentType = type;\n Events.Http.Request.State.contentTypeChange(type, this);\n }\n\n async handlerDrop(e: DragEvent): Promise<void> {\n e.preventDefault();\n const { dataTransfer } = e;\n if (!dataTransfer) {\n return;\n }\n const { files } = dataTransfer;\n if (!files.length) {\n return;\n }\n const file = files[0];\n const { selected } = this;\n if (selected === 'file') {\n this.value = file;\n } else if (selected === 'multipart') {\n const editor = (this.shadowRoot as ShadowRoot).querySelector('http-body-multipart-editor');\n if (!editor) {\n throw new Error(`Invalid state. The <http-body-multipart-editor> element was removed from the DOM.`);\n }\n if (!e.ctrlKey && !e.metaKey) {\n editor.value = new FormData();\n }\n const ps = Array.from(files).map((item) => editor.addFile(item));\n await Promise.all(ps);\n } else {\n const payload = await PayloadSerializer.stringifyBlob(file);\n this.value = payload.data;\n const { type } = file;\n if (type) {\n Events.Http.Request.State.contentTypeChange(type, this);\n }\n }\n this.notifyChange();\n }\n\n protected handleDragOver(e: DragEvent): void {\n e.preventDefault();\n }\n\n protected handleAddUrlEncode(): void {\n const editor = this.urlEncodedEditor;\n if (editor) {\n editor.addParameter();\n }\n }\n\n protected handleUrlEncode(): void {\n const editor = this.urlEncodedEditor;\n if (editor) {\n editor.encodeParameters();\n }\n }\n\n protected handleUrlDecode(): void {\n const editor = this.urlEncodedEditor;\n if (editor) {\n editor.decodeParameters();\n }\n }\n\n protected handleUrlEncodeAutoChange(e: Event): void {\n const input = e.target as CheckboxElement;\n this.autoEncode = input.checked;\n const editor = this.urlEncodedEditor;\n if (editor) {\n this.updateUrlEncodedValue(editor);\n }\n }\n\n protected handleMultipartAddText(): void {\n const editor = this.multipartEditor;\n if (editor) {\n editor.addEmptyText();\n }\n }\n\n protected handleMultipartAddFile(): void {\n const editor = this.multipartEditor;\n if (editor) {\n editor.addEmptyFile();\n }\n }\n\n override render(): TemplateResult {\n return html`\n <div class=\"actions\">\n ${this.renderBodySelector()}\n ${this.renderMainActions()}\n </div>\n ${this.renderInvalidMime()}\n <div class=\"container\">\n ${this.renderEditor()}\n </div>\n `;\n }\n\n /**\n * @returns The template for the dropdown menu for the editor type\n */\n protected renderBodySelector(): TemplateResult {\n const { selected } = this;\n const selectedItem = editorTypes.find(i => i.id === selected);\n const label = selectedItem && selectedItem.label || 'Select editor';\n return html`\n <ui-dropdown-list\n verticalAlign=\"top\"\n @select=\"${this.handleTypeChange}\"\n class=\"type-dropdown\"\n closeOnOutsideClick\n >\n <ui-button type=\"tonal\" title=\"Select editor type\" aria-label=\"Opens a menu to select editor type\">\n <ui-icon icon=\"arrowDropDown\" slot=\"icon\" role=\"presentation\"></ui-icon>\n ${label}\n </ui-button>\n <ui-list slot=\"dropdown\" role=\"menu\">\n ${this.renderBodyTypeOptions()}\n </ui-list>\n </ui-dropdown-list>\n `;\n }\n\n protected renderBodyTypeOptions(): TemplateResult {\n return html`\n ${editorTypes.map((info) => html`\n <ui-list-item role=\"menuitem\" data-type=\"${info.id}\" title=\"${info.title}\">\n ${info.label}\n </ui-list-item>\n `)}\n `;\n }\n\n /**\n * @returns The template for the main editor actions.\n */\n protected renderMainActions(): TemplateResult | typeof nothing {\n const { selected } = this;\n if (selected === 'raw') {\n return this.renderTextEditorActions();\n }\n if (selected === 'urlEncode') {\n return this.renderUrlEncodeEditorActions();\n }\n if (selected === 'multipart') {\n return this.renderMultipartActions();\n }\n return nothing;\n }\n\n protected renderTextEditorActions(): TemplateResult {\n const label = monacoContentTypes[this.mimeValue || ''] || monacoContentTypes[''];\n return html`\n <ui-dropdown-list\n verticalAlign=\"top\"\n @select=\"${this.handleMimeTypeSelect}\"\n class=\"mime-dropdown\"\n closeOnOutsideClick\n >\n <ui-button \n type=\"tonal\" \n title=\"Select media type. This overrides the content-type header\"\n aria-label=\"Editor media type\"\n >\n <ui-icon icon=\"arrowDropDown\" slot=\"icon\"></ui-icon>\n ${label}\n </ui-button>\n <ui-list slot=\"dropdown\" role=\"menu\">\n ${this.renderMonacoOptions()}\n </ui-list>\n </ui-dropdown-list>\n `;\n }\n\n protected renderMonacoOptions(): TemplateResult[] {\n return Object.keys(monacoContentTypes).map(key => html`\n ${key === '' ? html`<ui-divider></ui-divider>` : nothing}\n <ui-list-item role=\"menuitem\" data-type=\"${key}\">\n ${monacoContentTypes[key]}\n </ui-list-item>\n `);\n }\n\n protected renderUrlEncodeEditorActions(): TemplateResult {\n const { autoEncode } = this;\n return html`\n <ui-button \n type=\"tonal\" \n aria-label=\"Adds a new parameter\" \n title=\"Adds a new parameter\" \n @click=\"${this.handleAddUrlEncode}\"\n >\n <ui-icon slot=\"icon\" icon=\"add\" role=\"presentation\"></ui-icon>\n Add\n </ui-button>\n <ui-button \n type=\"outlined\" \n title=\"URL encodes parameters in the editor\" \n aria-label=\"URL encodes parameters in the editor\"\n @click=\"${this.handleUrlEncode}\"\n ?disabled=\"${autoEncode}\"\n >\n URL encode\n </ui-button>\n <ui-button \n type=\"outlined\" \n title=\"URL decodes parameters in the editor\"\n aria-label=\"URL decodes parameters in the editor\"\n @click=\"${this.handleUrlDecode}\"\n ?disabled=\"${autoEncode}\"\n >\n URL decode\n </ui-button>\n <label title=\"When set it automatically encodes the values before sending the request\">\n <ui-checkbox .checked=\"${autoEncode}\" @change=\"${this.handleUrlEncodeAutoChange}\"></ui-checkbox>\n Encode on send\n </label>\n `;\n }\n\n protected renderMultipartActions(): TemplateResult {\n return html`\n <ui-button\n type=\"outlined\"\n title=\"Adds a new part with a file value\"\n aria-label=\"Adds a new part with a file value\"\n @click=\"${this.handleMultipartAddFile}\"\n >\n Add file part\n </ui-button>\n <ui-button \n type=\"outlined\" \n title=\"Adds a new part with a text value\"\n aria-label=\"Adds a new part with a text value\"\n @click=\"${this.handleMultipartAddText}\"\n >\n Add text part\n </ui-button>\n `;\n }\n\n /**\n * @returns A template for currently rendered editor\n */\n protected renderEditor(): TemplateResult {\n switch (this.selected) {\n case 'raw': return this.renderRawEditor();\n case 'urlEncode': return this.renderUrlEncodeEditor();\n case 'multipart': return this.renderMultipartEditor();\n case 'file': return this.renderFileEditor();\n default: return this.renderNoEditor();\n }\n }\n\n /**\n * @returns The template for the raw editor\n */\n protected renderRawEditor(): TemplateResult {\n let { value } = this;\n const model = this.readMetaModel('raw') as IRawBody[];\n const hasModel = Array.isArray(model) && model.length;\n if (typeof value !== 'string') {\n value = '';\n }\n if (!value && hasModel) {\n const [item] = model;\n value = item.value;\n }\n return this.renderTextEditor(value as string);\n }\n\n /**\n * @param value The editor value\n * @returns The template for the Monaco editor\n */\n protected renderTextEditor(value: string): TemplateResult {\n const { contentType } = this;\n return html`\n <http-body-text-editor \n .value=\"${value}\" \n .contentType=\"${contentType}\"\n @change=\"${this.handleRawChange}\"\n allowFormInfo\n ></http-body-text-editor>`;\n }\n\n /**\n * @returns A template for the application/x-www-form-urlencoded editor\n */\n protected renderUrlEncodeEditor(): TemplateResult {\n const { autoEncode } = this;\n const info = this.readMetaModel('urlEncode') as IUrlEncodedBodyMeta[] | undefined;\n const model = Array.isArray(info) && info[0] && info[0].model;\n return html`\n <http-body-urlencoded-editor \n ?autoEncode=\"${autoEncode}\"\n .model=\"${ifProperty(model)}\"\n @change=\"${this.handleUrlEncodeChange}\"\n allowFormInfo\n ></http-body-urlencoded-editor>\n `;\n }\n\n /**\n * @returns A template for the multipart editor\n */\n protected renderMultipartEditor(): TemplateResult {\n const model = this.readMetaModel('multipart') as IMultipartBody[];\n return html`\n <http-body-multipart-editor \n .model=\"${ifProperty(model)}\"\n @change=\"${this.handleMultipartChange}\"\n allowFormInfo\n ></http-body-multipart-editor>\n `;\n }\n\n /**\n * @returns A template for the file input editor\n */\n protected renderFileEditor(): TemplateResult {\n return html`\n <div class=\"file-picker\">\n <ui-button type=\"text\" @click=\"${this.handlePickFile}\">Choose a file</ui-button>\n ${this.renderFileDetail()}\n </div>\n <input type=\"file\" class=\"binary-hidden\" @change=\"${this.handleFileChange}\"/>\n ${this.renderFormInfo()}\n `;\n }\n\n protected renderFormInfo(): TemplateResult {\n return html`\n <p class=\"form-info\">\n Note that the content-type header will be added when the request is sent.\n </p>\n `;\n }\n\n /**\n * @returns A template for the missing selection\n */\n protected renderNoEditor(): TemplateResult {\n return html`<div class=\"empty-editor\">Invalid editor selected.</div>`;\n }\n\n /**\n * @returns A template for the file details.\n */\n protected renderFileDetail(): TemplateResult | string {\n if (!this.hasFile) {\n this.restoreFileModel();\n }\n if (!this.hasFile) {\n return '';\n }\n const { value } = this;\n const { size, name } = value as File;\n return html`\n <div class=\"file-info\">\n <span class=\"file-name\">${name || 'unknown name'}</span>\n <span class=\"file-size\">${size} bytes</span>\n <ui-icon-button\n aria-label=\"Delete file\"\n title=\"Deletes the file\"\n @click=\"${this.handleClearFile}\"\n ?disabled=\"${this.readOnly}\"\n >\n <ui-icon icon=\"deleteOutline\" role=\"presentation\"></ui-icon>\n </ui-icon-button>\n </div>\n `;\n }\n\n protected renderInvalidMime(): TemplateResult | string {\n if (!this.invalidMimeValue) {\n return '';\n }\n const id = this.invalidMimeMessage;\n return html`\n <div class=\"invalid-mime\">\n <ui-icon icon=\"warning\" class=\"warning-icon\"></ui-icon>\n ${id === 1 ? this.renderFixableInvalidMime('multipart/form-data') : ''}\n ${id === 2 ? this.renderFixableInvalidMime('application/x-www-form-urlencoded') : ''}\n </div>\n `;\n }\n\n /**\n * @returns A template for fixable mime type mismatch message.\n */\n protected renderFixableInvalidMime(suggested: string): TemplateResult {\n return html`\n <p class=\"message\">\n The <code>content-type</code> header has different value than <b>${suggested}</b>.\n </p>\n <ui-button class=\"fix\" type=\"tonal\" title=\"Updates the content type header for the request\" @click=\"${this.autoFixMime}\">Fix</ui-button>\n `;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"BodyEditor.js","sourceRoot":"","sources":["../../../src/elements/http/BodyEditor.ts"],"names":[],"mappings":";AAAA,0CAA0C;AAC1C,2CAA2C;AAC3C;;;;;;;;;;;;EAYE;AACF,OAAO,EAAE,IAAI,EAAkC,OAAO,EAAE,MAAM,KAAK,CAAC;AACpE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAA0F,iBAAiB,EAAE,MAAM,mCAAmC,CAAC;AAC9J,OAAO,EAAE,UAAU,EAAE,MAAM,iCAAiC,CAAC;AAI7D,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAChD,OAAO,UAAU,MAAM,kBAAkB,CAAC;AAE1C,OAAO,4BAA4B,CAAC;AACpC,OAAO,kDAAkD,CAAC;AAC1D,OAAO,iDAAiD,CAAC;AACzD,OAAO,4CAA4C,CAAC;AACpD,OAAO,8BAA8B,CAAC;AACtC,OAAO,qCAAqC,CAAC;AAC7C,OAAO,4BAA4B,CAAC;AACpC,OAAO,iCAAiC,CAAC;AACzC,OAAO,+BAA+B,CAAC;AACvC,OAAO,gCAAgC,CAAC;AAUxC,MAAM,CAAC,MAAM,WAAW,GAA2B,MAAM,CAAC,MAAM,CAAC;IAC/D;QACE,EAAE,EAAE,KAAK;QACT,KAAK,EAAE,aAAa;QACpB,KAAK,EAAE,gDAAgD;KACxD;IACD;QACE,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,kBAAkB;QACzB,KAAK,EAAE,yDAAyD;KACjE;IACD;QACE,EAAE,EAAE,WAAW;QACf,KAAK,EAAE,qBAAqB;QAC5B,KAAK,EAAE,iDAAiD;KACzD;IACD;QACE,EAAE,EAAE,MAAM;QACV,KAAK,EAAE,QAAQ;QACf,KAAK,EAAE,kCAAkC;KAC1C;CACF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AED;;OAEG;IACO,wBAAwB,CAAC,SAAiB;QAClD,OAAO,IAAI,CAAA;;2EAE4D,SAAS;;4GAEwB,IAAI,CAAC,WAAW;KACvH,CAAC;IACJ,CAAC;CACF;AApxB6B;IAA3B,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;4CAAiC;AAU5D;IADC,QAAQ,EAAE;uCAGV;AAoBD;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC;uCAGzB;AAkB2C;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAkB;AAMjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;4CAAkB;AAMjB;IAA3C,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;8CAAoB;AAepB;IAA1C,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;+CAAsB;AAQ1B;IAArC,KAAK,CAAC,6BAA6B,CAAC;oDAAmD;AAEnD;IAApC,KAAK,CAAC,4BAA4B,CAAC;mDAAiD","sourcesContent":["/* eslint-disable lit-a11y/no-autofocus */\n/* eslint-disable class-methods-use-this */\n/**\n@license\nCopyright 2020 The Advanced REST client authors <arc@mulesoft.com>\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not\nuse this file except in compliance with the License. You may obtain a copy of\nthe License at\nhttp://www.apache.org/licenses/LICENSE-2.0\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\nWARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\nLicense for the specific language governing permissions and limitations under\nthe License.\n*/\nimport { html, TemplateResult, PropertyValues, nothing } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { IBodyMetaModel, IMultipartBody, IProperty, IRawBody, ISafePayload, IUrlEncodedBodyMeta, PayloadSerializer } from '@api-client/core/build/browser.js';\nimport { ifProperty } from '../../directives/if-property.js';\nimport BodyUrlEncodedEditor from './BodyUrlEncodedEditor.js';\nimport BodyTextEditor from './BodyTextEditor.js';\nimport BodyMultipartEditor from './BodyMultipartEditor.js';\nimport { Events } from '../../events/Events.js';\nimport ApiElement from '../ApiElement.js';\nimport CheckboxElement from '../../ui/input/CheckboxElement.js';\nimport '../../define/ui/ui-icon.js';\nimport '../../define/http/http-body-urlencoded-editor.js';\nimport '../../define/http/http-body-multipart-editor.js';\nimport '../../define/http/http-body-text-editor.js';\nimport '../../define/ui/ui-button.js';\nimport '../../define/ui/ui-dropdown-list.js';\nimport '../../define/ui/ui-list.js';\nimport '../../define/ui/ui-list-item.js';\nimport '../../define/ui/ui-divider.js';\nimport '../../define/ui/ui-checkbox.js';\n\nexport type AllowedEditor = 'raw' | 'urlEncode' | 'multipart' | 'file';\n\nexport interface EditorType {\n id: AllowedEditor;\n label: string;\n title: string;\n}\n\nexport const editorTypes: Readonly<EditorType[]> = Object.freeze([\n {\n id: 'raw',\n label: 'Text editor',\n title: 'Opens a source editor with syntax highlighting'\n },\n {\n id: 'urlEncode',\n label: 'Form URL encoded',\n title: 'Opens an editor specialized with URL encoded data types'\n },\n {\n id: 'multipart',\n label: 'Multipart form data',\n title: 'Opens an editor specialized with multipart data'\n },\n {\n id: 'file',\n label: 'A file',\n title: 'Allows to choose any binary data'\n }\n]);\n\nconst monacoContentTypes: Record<string, string> = {\n 'application/json': 'JSON',\n 'application/xml': 'XML',\n 'text/html': 'HTML',\n 'text/css': 'CSS',\n '': 'Inherited from headers'\n};\n\n/**\n * @fires change When the value and the model change\n */\nexport default class BodyEditor extends ApiElement {\n /**\n * The currently rendered editor.\n * @attribute\n */\n @property({ type: String }) selected: AllowedEditor = 'raw';\n\n protected valueInternal: unknown = '';\n\n /**\n * The HTTP body.\n *\n * Depending of current editor selection the type can vary.\n */\n @property()\n get value(): unknown {\n return this.valueInternal;\n }\n\n set value(value: unknown) {\n const old = this.valueInternal;\n if (old === value) {\n return;\n }\n // this is to be able to set a private filed value from\n // within the element\n this.valueInternal = value;\n this.requestUpdate();\n }\n\n protected modelInternal: IBodyMetaModel[] | undefined;\n\n /**\n * Previously generated by this editor metadata model.\n * Used internally to set the UI.\n */\n @property({ type: Array })\n get model(): IBodyMetaModel[] | undefined {\n return this.modelInternal;\n }\n\n set model(value: IBodyMetaModel[] | undefined) {\n const old = this.modelInternal;\n if (old === value) {\n return;\n }\n // this is to be able to set a private filed value from\n // within the element\n this.modelInternal = value;\n this.requestUpdate();\n this.modelChanged();\n }\n\n /**\n * When set the editor is in read only mode.\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) readOnly = false;\n\n /**\n * When set all controls are disabled in the form\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** \n * When set it automatically encodes and decodes values.\n * @attribute\n */\n @property({ type: Boolean, reflect: true }) autoEncode = false;\n\n /**\n * @returns True when the current value is a file (or blob).\n */\n get hasFile(): boolean {\n const { value } = this;\n return value instanceof Blob;\n }\n\n /** \n * The current request content type. It is passed to the `raw` editor\n * to detect current language.\n * @attribute\n */\n @property({ type: String, reflect: true }) contentType?: string;\n\n protected invalidMimeMessage?: number;\n\n protected invalidMimeValue?: boolean;\n\n protected mimeValue?: string;\n\n @query('http-body-urlencoded-editor') protected urlEncodedEditor?: BodyUrlEncodedEditor;\n\n @query('http-body-multipart-editor') protected multipartEditor?: BodyMultipartEditor;\n\n constructor() {\n super();\n this.addEventListener('drop', this.handlerDrop.bind(this));\n this.addEventListener('dragover', this.handleDragOver.bind(this));\n }\n\n protected override update(cp: PropertyValues<this>): void {\n if (cp.has('contentType') || cp.has('selected')) {\n this.analyzeContentType();\n }\n super.update(cp);\n }\n\n /**\n * This must be called only when the `model` property change from the \n * outside. It restores values depending on the selected editor.\n */\n protected modelChanged(): void {\n const { selected, model } = this;\n if (!model) {\n return;\n }\n if (selected === 'file') {\n this.restoreFileModel();\n }\n const info = this.readMetaModel('urlEncode') as IUrlEncodedBodyMeta[] | undefined;\n if (Array.isArray(info) && info[0]) {\n if (typeof info[0].autoEncode === 'boolean') {\n this.autoEncode = info[0].autoEncode;\n }\n }\n }\n\n /**\n * Restores file value from the model, if exists\n */\n protected restoreFileModel(): void {\n const fileModel = this.readMetaModel('file') as ISafePayload[] | undefined;\n if (!Array.isArray(fileModel) || !fileModel.length) {\n this.valueInternal = '';\n return;\n }\n const [item] = fileModel;\n if (!item || !item.data) {\n this.valueInternal = '';\n return;\n }\n const file = PayloadSerializer.deserializeFile(item);\n this.valueInternal = file;\n }\n\n protected handleTypeChange(e: CustomEvent): void {\n const target = e.detail.item as HTMLElement | undefined;\n if (!target) {\n return;\n }\n const selected = target.dataset.type as AllowedEditor;\n this.changeEditor(selected);\n }\n\n /**\n * A handler for the editor selection. It activates an editor, if necessary.\n */\n protected async changeEditor(id: AllowedEditor): Promise<void> {\n if (this.selected === id) {\n return;\n }\n this.selected = id;\n this.analyzeContentType();\n if (id === 'raw') {\n const model = this.readMetaModel('raw') as IRawBody[];\n let value = '';\n if (Array.isArray(model) && model.length) {\n value = model[0].value;\n }\n this.value = value;\n this.notifyChange();\n }\n this.requestUpdate();\n await this.updateComplete;\n // this.notifyResize();\n if (id === 'file') {\n this.restoreFileModel();\n this.notifyChange();\n } else if (id === 'urlEncode') {\n const editor = (this.shadowRoot as ShadowRoot).querySelector('http-body-urlencoded-editor');\n if (!editor) {\n throw new Error(`Invalid state. The <http-body-urlencoded-editor> element was removed from the DOM.`);\n }\n this.value = editor.value;\n this.notifyChange();\n } else if (id === 'multipart') {\n const editor = (this.shadowRoot as ShadowRoot).querySelector('http-body-multipart-editor');\n if (!editor) {\n throw new Error(`Invalid state. The <http-body-multipart-editor> element was removed from the DOM.`);\n }\n this.value = editor.value;\n this.notifyChange();\n }\n this.dispatchEvent(new Event('select'));\n }\n\n /**\n * A handler for the file pick button click.\n * Activates the file input.\n */\n protected handlePickFile(): void {\n const input = (this.shadowRoot as ShadowRoot).querySelector('.binary-hidden') as HTMLInputElement;\n input.click();\n }\n\n /**\n * A handler for the file file selection in the file input.\n * Sets the value to the file.\n */\n protected async handleFileChange(e: Event): Promise<void> {\n const input = e.target as HTMLInputElement;\n const { files } = input;\n if (!files) {\n return;\n }\n const file = files[0];\n if (!file) {\n return;\n }\n this.valueInternal = file;\n const payload = await PayloadSerializer.stringifyFile(file);\n const model = [ payload ];\n this.setMetaModel('file', model);\n this.notifyChange();\n this.requestUpdate();\n }\n\n /**\n * Clears the current value\n */\n protected handleClearFile(): void {\n this.value = '';\n this.setMetaModel('file', []);\n this.notifyChange();\n }\n\n /**\n * Reads editor view model\n * \n * @param editor The editor id\n * @returns The view model\n */\n protected readMetaModel(editor: string): (ISafePayload | IProperty | IMultipartBody | IRawBody | IUrlEncodedBodyMeta)[] | undefined {\n const meta = this.model;\n if (!meta || !Array.isArray(meta)) {\n return undefined;\n }\n const item = meta.find((model) => model.type === editor);\n if (!item) {\n return undefined;\n }\n if (Array.isArray(item.viewModel)) {\n return item.viewModel;\n }\n return undefined;\n }\n\n /**\n * Sets editor view model on the local model\n * @param editor The editor id\n * @param model The view model\n */\n protected setMetaModel(editor: AllowedEditor, model: (ISafePayload | IProperty | IMultipartBody | IRawBody | IUrlEncodedBodyMeta)[]): void {\n if (!Array.isArray(this.modelInternal)) {\n this.modelInternal = [];\n }\n const meta = this.model as IBodyMetaModel[];\n const index = meta.findIndex((item) => item.type === editor);\n if (index === -1) {\n meta.push({ type: editor, viewModel: model });\n } else {\n meta[index].viewModel = model;\n }\n }\n\n /**\n * A handler for the change event dispatched by the \n * `urlEncode` editor.\n * Updated the local value, model, and notifies the change.\n */\n protected handleUrlEncodeChange(e: Event): void {\n const editor = e.target as BodyUrlEncodedEditor;\n this.updateUrlEncodedValue(editor);\n }\n\n protected updateUrlEncodedValue(editor: BodyUrlEncodedEditor): void {\n const { value, model } = editor;\n this.valueInternal = value;\n const info: IUrlEncodedBodyMeta = {\n model,\n autoEncode: this.autoEncode,\n };\n this.setMetaModel('urlEncode', [info]);\n this.notifyChange();\n // do not request update here.\n }\n\n /**\n * A handler for the change event dispatched by the `raw` editor.\n * Updated the local value, model, and notifies the change.\n */\n protected handleRawChange(e: Event): void {\n const editor = e.target as BodyTextEditor;\n const { value } = editor;\n this.valueInternal = value;\n const model: IRawBody[] = [{ value: value as string }];\n this.setMetaModel('raw', model);\n this.notifyChange();\n }\n\n /**\n * A handler for the change event dispatched by the \n * `multipart` editor.\n * Updated the local value, model, and notifies the change.\n */\n protected handleMultipartChange(e: Event): void {\n const editor = e.target as BodyMultipartEditor;\n const { value, model } = editor;\n this.valueInternal = value;\n this.setMetaModel('multipart', model);\n this.notifyChange();\n }\n\n /**\n * Checks whether the current content type header value matches the selected editor.\n * If not it renders a warning message.\n */\n protected analyzeContentType(): void {\n const mime = this.contentType;\n if (!mime || typeof mime !== 'string') {\n this.invalidMimeValue = false;\n this.mimeValue = undefined;\n return;\n }\n let ct = mime;\n const semicolon = ct.indexOf(';');\n if (semicolon !== -1) {\n ct = ct.substring(0, semicolon);\n }\n this.mimeValue = ct;\n if (!ct) {\n this.invalidMimeValue = false;\n return;\n }\n const { selected } = this;\n if (selected === 'multipart') {\n if (ct !== 'multipart/form-data') {\n this.invalidMimeValue = true;\n this.invalidMimeMessage = 1;\n } else {\n this.invalidMimeValue = false;\n }\n } else if (selected === 'urlEncode') {\n if (ct !== 'application/x-www-form-urlencoded') {\n this.invalidMimeValue = true;\n this.invalidMimeMessage = 2;\n } else {\n this.invalidMimeValue = false;\n }\n } else {\n this.invalidMimeValue = false;\n }\n }\n\n /**\n * Automatically fixes content type problem.\n */\n protected autoFixMime(): void {\n const { selected } = this;\n let updated = '';\n if (selected === 'urlEncode') {\n updated = 'application/x-www-form-urlencoded';\n } else if (selected === 'multipart') {\n updated = 'multipart/form-data';\n }\n Events.Http.Request.State.contentTypeChange(updated, this);\n }\n\n /**\n * A handler for the mime type selection.\n */\n protected handleMimeTypeSelect(e: CustomEvent): void {\n const target = e.detail.item as HTMLElement | undefined;\n if (!target) {\n return;\n }\n const { type = '' } = target.dataset;\n if (this.mimeValue === type) {\n return;\n }\n this.contentType = type;\n Events.Http.Request.State.contentTypeChange(type, this);\n }\n\n async handlerDrop(e: DragEvent): Promise<void> {\n e.preventDefault();\n const { dataTransfer } = e;\n if (!dataTransfer) {\n return;\n }\n const { files } = dataTransfer;\n if (!files.length) {\n return;\n }\n const file = files[0];\n const { selected } = this;\n if (selected === 'file') {\n this.value = file;\n } else if (selected === 'multipart') {\n const editor = (this.shadowRoot as ShadowRoot).querySelector('http-body-multipart-editor');\n if (!editor) {\n throw new Error(`Invalid state. The <http-body-multipart-editor> element was removed from the DOM.`);\n }\n if (!e.ctrlKey && !e.metaKey) {\n editor.value = new FormData();\n }\n const ps = Array.from(files).map((item) => editor.addFile(item));\n await Promise.all(ps);\n } else {\n const payload = await PayloadSerializer.stringifyBlob(file);\n this.value = payload.data;\n const { type } = file;\n if (type) {\n Events.Http.Request.State.contentTypeChange(type, this);\n }\n }\n this.notifyChange();\n }\n\n protected handleDragOver(e: DragEvent): void {\n e.preventDefault();\n }\n\n protected handleAddUrlEncode(): void {\n const editor = this.urlEncodedEditor;\n if (editor) {\n editor.addParameter();\n }\n }\n\n protected handleUrlEncode(): void {\n const editor = this.urlEncodedEditor;\n if (editor) {\n editor.encodeParameters();\n }\n }\n\n protected handleUrlDecode(): void {\n const editor = this.urlEncodedEditor;\n if (editor) {\n editor.decodeParameters();\n }\n }\n\n protected handleUrlEncodeAutoChange(e: Event): void {\n const input = e.target as CheckboxElement;\n this.autoEncode = input.checked;\n const editor = this.urlEncodedEditor;\n if (editor) {\n this.updateUrlEncodedValue(editor);\n }\n }\n\n protected handleMultipartAddText(): void {\n const editor = this.multipartEditor;\n if (editor) {\n editor.addEmptyText();\n }\n }\n\n protected handleMultipartAddFile(): void {\n const editor = this.multipartEditor;\n if (editor) {\n editor.addEmptyFile();\n }\n }\n\n override render(): TemplateResult {\n return html`\n <div class=\"actions\">\n ${this.renderBodySelector()}\n ${this.renderMainActions()}\n </div>\n ${this.renderInvalidMime()}\n <div class=\"container\">\n ${this.renderEditor()}\n </div>\n `;\n }\n\n /**\n * @returns The template for the dropdown menu for the editor type\n */\n protected renderBodySelector(): TemplateResult {\n const { selected } = this;\n const selectedItem = editorTypes.find(i => i.id === selected);\n const label = selectedItem && selectedItem.label || 'Select editor';\n return html`\n <ui-dropdown-list\n verticalAlign=\"top\"\n @select=\"${this.handleTypeChange}\"\n class=\"type-dropdown\"\n closeOnOutsideClick\n >\n <ui-button type=\"tonal\" title=\"Select editor type\" aria-label=\"Opens a menu to select editor type\">\n <ui-icon icon=\"arrowDropDown\" slot=\"icon\" role=\"presentation\"></ui-icon>\n ${label}\n </ui-button>\n <ui-list slot=\"dropdown\" role=\"menu\">\n ${this.renderBodyTypeOptions()}\n </ui-list>\n </ui-dropdown-list>\n `;\n }\n\n protected renderBodyTypeOptions(): TemplateResult {\n return html`\n ${editorTypes.map((info) => html`\n <ui-list-item role=\"menuitem\" data-type=\"${info.id}\" title=\"${info.title}\">\n ${info.label}\n </ui-list-item>\n `)}\n `;\n }\n\n /**\n * @returns The template for the main editor actions.\n */\n protected renderMainActions(): TemplateResult | typeof nothing {\n const { selected } = this;\n if (selected === 'raw') {\n return this.renderTextEditorActions();\n }\n if (selected === 'urlEncode') {\n return this.renderUrlEncodeEditorActions();\n }\n if (selected === 'multipart') {\n return this.renderMultipartActions();\n }\n return nothing;\n }\n\n protected renderTextEditorActions(): TemplateResult {\n const label = monacoContentTypes[this.mimeValue || ''] || monacoContentTypes[''];\n return html`\n <ui-dropdown-list\n verticalAlign=\"top\"\n @select=\"${this.handleMimeTypeSelect}\"\n class=\"mime-dropdown\"\n closeOnOutsideClick\n >\n <ui-button \n type=\"tonal\" \n title=\"Select media type. This overrides the content-type header\"\n aria-label=\"Editor media type\"\n >\n <ui-icon icon=\"arrowDropDown\" slot=\"icon\"></ui-icon>\n ${label}\n </ui-button>\n <ui-list slot=\"dropdown\" role=\"menu\">\n ${this.renderMonacoOptions()}\n </ui-list>\n </ui-dropdown-list>\n `;\n }\n\n protected renderMonacoOptions(): TemplateResult[] {\n return Object.keys(monacoContentTypes).map(key => html`\n ${key === '' ? html`<ui-divider></ui-divider>` : nothing}\n <ui-list-item role=\"menuitem\" data-type=\"${key}\">\n ${monacoContentTypes[key]}\n </ui-list-item>\n `);\n }\n\n protected renderUrlEncodeEditorActions(): TemplateResult {\n const { autoEncode } = this;\n return html`\n <ui-button \n type=\"tonal\" \n aria-label=\"Adds a new parameter\" \n title=\"Adds a new parameter\" \n @click=\"${this.handleAddUrlEncode}\"\n >\n <ui-icon slot=\"icon\" icon=\"add\" role=\"presentation\"></ui-icon>\n Add\n </ui-button>\n <ui-button \n type=\"outlined\" \n title=\"URL encodes parameters in the editor\" \n aria-label=\"URL encodes parameters in the editor\"\n @click=\"${this.handleUrlEncode}\"\n ?disabled=\"${autoEncode}\"\n >\n URL encode\n </ui-button>\n <ui-button \n type=\"outlined\" \n title=\"URL decodes parameters in the editor\"\n aria-label=\"URL decodes parameters in the editor\"\n @click=\"${this.handleUrlDecode}\"\n ?disabled=\"${autoEncode}\"\n >\n URL decode\n </ui-button>\n <label title=\"When set it automatically encodes the values before sending the request\" class=\"label-medium\">\n <ui-checkbox .checked=\"${autoEncode}\" @change=\"${this.handleUrlEncodeAutoChange}\"></ui-checkbox>\n Encode on send\n </label>\n `;\n }\n\n protected renderMultipartActions(): TemplateResult {\n return html`\n <ui-button\n type=\"outlined\"\n title=\"Adds a new part with a file value\"\n aria-label=\"Adds a new part with a file value\"\n @click=\"${this.handleMultipartAddFile}\"\n >\n Add file part\n </ui-button>\n <ui-button \n type=\"outlined\" \n title=\"Adds a new part with a text value\"\n aria-label=\"Adds a new part with a text value\"\n @click=\"${this.handleMultipartAddText}\"\n >\n Add text part\n </ui-button>\n `;\n }\n\n /**\n * @returns A template for currently rendered editor\n */\n protected renderEditor(): TemplateResult {\n switch (this.selected) {\n case 'raw': return this.renderRawEditor();\n case 'urlEncode': return this.renderUrlEncodeEditor();\n case 'multipart': return this.renderMultipartEditor();\n case 'file': return this.renderFileEditor();\n default: return this.renderNoEditor();\n }\n }\n\n /**\n * @returns The template for the raw editor\n */\n protected renderRawEditor(): TemplateResult {\n let { value } = this;\n const model = this.readMetaModel('raw') as IRawBody[];\n const hasModel = Array.isArray(model) && model.length;\n if (typeof value !== 'string') {\n value = '';\n }\n if (!value && hasModel) {\n const [item] = model;\n value = item.value;\n }\n return this.renderTextEditor(value as string);\n }\n\n /**\n * @param value The editor value\n * @returns The template for the Monaco editor\n */\n protected renderTextEditor(value: string): TemplateResult {\n const { contentType } = this;\n return html`\n <http-body-text-editor \n .value=\"${value}\" \n .contentType=\"${contentType}\"\n @change=\"${this.handleRawChange}\"\n allowFormInfo\n ></http-body-text-editor>`;\n }\n\n /**\n * @returns A template for the application/x-www-form-urlencoded editor\n */\n protected renderUrlEncodeEditor(): TemplateResult {\n const { autoEncode } = this;\n const info = this.readMetaModel('urlEncode') as IUrlEncodedBodyMeta[] | undefined;\n const model = Array.isArray(info) && info[0] && info[0].model;\n return html`\n <http-body-urlencoded-editor \n ?autoEncode=\"${autoEncode}\"\n .model=\"${ifProperty(model)}\"\n @change=\"${this.handleUrlEncodeChange}\"\n allowFormInfo\n ></http-body-urlencoded-editor>\n `;\n }\n\n /**\n * @returns A template for the multipart editor\n */\n protected renderMultipartEditor(): TemplateResult {\n const model = this.readMetaModel('multipart') as IMultipartBody[];\n return html`\n <http-body-multipart-editor \n .model=\"${ifProperty(model)}\"\n @change=\"${this.handleMultipartChange}\"\n allowFormInfo\n ></http-body-multipart-editor>\n `;\n }\n\n /**\n * @returns A template for the file input editor\n */\n protected renderFileEditor(): TemplateResult {\n return html`\n <div class=\"file-picker\">\n <ui-button type=\"text\" @click=\"${this.handlePickFile}\">Choose a file</ui-button>\n ${this.renderFileDetail()}\n </div>\n <input type=\"file\" class=\"binary-hidden\" @change=\"${this.handleFileChange}\"/>\n ${this.renderFormInfo()}\n `;\n }\n\n protected renderFormInfo(): TemplateResult {\n return html`\n <p class=\"form-info body-small\">\n Note that the content-type header will be added when the request is sent.\n </p>\n `;\n }\n\n /**\n * @returns A template for the missing selection\n */\n protected renderNoEditor(): TemplateResult {\n return html`<div class=\"empty-editor\">Invalid editor selected.</div>`;\n }\n\n /**\n * @returns A template for the file details.\n */\n protected renderFileDetail(): TemplateResult | string {\n if (!this.hasFile) {\n this.restoreFileModel();\n }\n if (!this.hasFile) {\n return '';\n }\n const { value } = this;\n const { size, name } = value as File;\n return html`\n <div class=\"file-info label-medium\">\n <span class=\"file-name\">${name || 'unknown name'}</span>\n <span class=\"file-size\">${size} bytes</span>\n <ui-icon-button\n aria-label=\"Delete file\"\n title=\"Deletes the file\"\n @click=\"${this.handleClearFile}\"\n ?disabled=\"${this.readOnly}\"\n >\n <ui-icon icon=\"deleteOutline\" role=\"presentation\"></ui-icon>\n </ui-icon-button>\n </div>\n `;\n }\n\n protected renderInvalidMime(): TemplateResult | string {\n if (!this.invalidMimeValue) {\n return '';\n }\n const id = this.invalidMimeMessage;\n return html`\n <div class=\"invalid-mime body-medium\">\n <ui-icon icon=\"warning\" class=\"warning-icon\"></ui-icon>\n ${id === 1 ? this.renderFixableInvalidMime('multipart/form-data') : ''}\n ${id === 2 ? this.renderFixableInvalidMime('application/x-www-form-urlencoded') : ''}\n </div>\n `;\n }\n\n /**\n * @returns A template for fixable mime type mismatch message.\n */\n protected renderFixableInvalidMime(suggested: string): TemplateResult {\n return html`\n <p class=\"message body-medium\">\n The <code>content-type</code> header has different value than <b>${suggested}</b>.\n </p>\n <ui-button class=\"fix\" type=\"tonal\" title=\"Updates the content type header for the request\" @click=\"${this.autoFixMime}\">Fix</ui-button>\n `;\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BodyEditor.styles.d.ts","sourceRoot":"","sources":["../../../src/elements/http/BodyEditor.styles.ts"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"BodyEditor.styles.d.ts","sourceRoot":"","sources":["../../../src/elements/http/BodyEditor.styles.ts"],"names":[],"mappings":";AAGA,wBAmEG"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { css } from 'lit';
|
|
2
|
-
|
|
2
|
+
import typography from '../../styles/m3/typography.module.js';
|
|
3
|
+
export default [typography, css `
|
|
3
4
|
:host {
|
|
4
5
|
display: flex;
|
|
5
6
|
flex-direction: column;
|
|
@@ -31,7 +32,8 @@ http-body-text-editor {
|
|
|
31
32
|
background-color: #FFEB3B;
|
|
32
33
|
color: #000;
|
|
33
34
|
padding: 0 8px;
|
|
34
|
-
border-radius:
|
|
35
|
+
border-radius: var(--md-sys-shape-corner-small);
|
|
36
|
+
margin-bottom: 20px;
|
|
35
37
|
}
|
|
36
38
|
|
|
37
39
|
.invalid-mime .warning-icon {
|
|
@@ -53,14 +55,6 @@ http-body-text-editor {
|
|
|
53
55
|
.form-info {
|
|
54
56
|
margin: 20px 0 0 0;
|
|
55
57
|
color: var(--md-sys-color-on-surface);
|
|
56
|
-
font-family: var(--md-sys-typescale-body-small-font-family-name);
|
|
57
|
-
font-style: var(--md-sys-typescale-body-small-font-family-style);
|
|
58
|
-
font-weight: var(--md-sys-typescale-body-small-font-weight);
|
|
59
|
-
font-size: var(--md-sys-typescale-body-small-font-size);
|
|
60
|
-
letter-spacing: var(--md-sys-typescale-body-small-tracking);
|
|
61
|
-
line-height: var(--md-sys-typescale-body-small-height);
|
|
62
|
-
text-transform: var(--md-sys-typescale-body-small-text-transform);
|
|
63
|
-
text-decoration: var(--md-sys-typescale-body-small-text-decoration);
|
|
64
58
|
}
|
|
65
59
|
|
|
66
60
|
.file-picker {
|
|
@@ -72,14 +66,6 @@ http-body-text-editor {
|
|
|
72
66
|
display: flex;
|
|
73
67
|
align-items: center;
|
|
74
68
|
margin-left: 8px;
|
|
75
|
-
font-family: var(--md-sys-typescale-label-medium-font-family-name);
|
|
76
|
-
font-style: var(--md-sys-typescale-label-medium-font-family-style);
|
|
77
|
-
font-weight: var(--md-sys-typescale-label-medium-font-weight);
|
|
78
|
-
font-size: var(--md-sys-typescale-label-medium-font-size);
|
|
79
|
-
letter-spacing: var(--md-sys-typescale-label-medium-tracking);
|
|
80
|
-
line-height: var(--md-sys-typescale-label-medium-height);
|
|
81
|
-
text-transform: var(--md-sys-typescale-label-medium-text-transform);
|
|
82
|
-
text-decoration: var(--md-sys-typescale-label-medium-text-decoration);
|
|
83
69
|
}
|
|
84
|
-
|
|
70
|
+
`];
|
|
85
71
|
//# sourceMappingURL=BodyEditor.styles.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BodyEditor.styles.js","sourceRoot":"","sources":["../../../src/elements/http/BodyEditor.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"BodyEditor.styles.js","sourceRoot":"","sources":["../../../src/elements/http/BodyEditor.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAC1B,OAAO,UAAU,MAAM,sCAAsC,CAAC;AAE9D,eAAe,CAAC,UAAU,EAAE,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmE9B,CAAC,CAAC","sourcesContent":["import { css } from 'lit';\nimport typography from '../../styles/m3/typography.module.js';\n\nexport default [typography, css`\n:host {\n display: flex;\n flex-direction: column;\n min-height: 300px;\n position: relative;\n}\n\nhttp-body-text-editor {\n height: 100%;\n}\n\n.binary-hidden {\n display: none !important;\n}\n\n.actions {\n display: flex;\n align-items: center;\n margin-bottom: 12px;\n}\n\n.actions > *:not(:last-child) {\n margin-right: 20px;\n}\n\n.invalid-mime {\n display: flex;\n align-items: center;\n background-color: #FFEB3B;\n color: #000;\n padding: 0 8px;\n border-radius: var(--md-sys-shape-corner-small);\n margin-bottom: 20px;\n}\n\n.invalid-mime .warning-icon {\n color: #FF5722;\n margin-right: 12px;\n}\n\n.invalid-mime .fix {\n background-color: white;\n margin-left: 12px;\n height: 36px;\n}\n\n.type-dropdown {\n position: relative;\n z-index: 4;\n}\n\n.form-info {\n margin: 20px 0 0 0;\n color: var(--md-sys-color-on-surface);\n}\n\n.file-picker {\n display: flex;\n align-items: center;\n}\n\n.file-info {\n display: flex;\n align-items: center;\n margin-left: 8px;\n}\n`];\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IFile } from "@api-client/core/build/browser.js";
|
|
1
|
+
import { IFile, TrashEntry } from "@api-client/core/build/browser.js";
|
|
2
2
|
import { IconType } from "../../ui/icons/Icons.js";
|
|
3
3
|
/**
|
|
4
4
|
* Sorts files on the list.
|
|
@@ -6,5 +6,5 @@ import { IconType } from "../../ui/icons/Icons.js";
|
|
|
6
6
|
* Folders are always on top.
|
|
7
7
|
*/
|
|
8
8
|
export declare function filesSortFunction(a: IFile, b: IFile): number;
|
|
9
|
-
export declare function fileIcon(item: IFile): IconType | undefined;
|
|
9
|
+
export declare function fileIcon(item: IFile | TrashEntry): IconType | undefined;
|
|
10
10
|
//# sourceMappingURL=FilesLib.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilesLib.d.ts","sourceRoot":"","sources":["../../../src/elements/store/FilesLib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,EAAe,MAAM,mCAAmC,CAAC;
|
|
1
|
+
{"version":3,"file":"FilesLib.d.ts","sourceRoot":"","sources":["../../../src/elements/store/FilesLib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiD,KAAK,EAAe,UAAU,EAAE,MAAM,mCAAmC,CAAC;AAClI,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,KAAK,GAAG,MAAM,CAW5D;AAED,wBAAgB,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,CAUvE"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FilesLib.js","sourceRoot":"","sources":["../../../src/elements/store/FilesLib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,UAAU,EAAS,WAAW,
|
|
1
|
+
{"version":3,"file":"FilesLib.js","sourceRoot":"","sources":["../../../src/elements/store/FilesLib.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,YAAY,EAAE,UAAU,EAAS,WAAW,EAAc,MAAM,mCAAmC,CAAC;AAGlI;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAC,CAAQ,EAAE,CAAQ;IAClD,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,EAAE;QACrB,IAAI,CAAC,CAAC,IAAI,KAAK,UAAU,EAAE;YACzB,OAAO,CAAC,CAAC,CAAC;SACX;QACD,OAAO,CAAC,CAAC;KACV;IACD,IAAI,CAAC,CAAC,IAAI,KAAK,CAAC,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,KAAK,UAAU,EAAE;QAC9C,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;KAC7D;IACD,OAAO,CAAC,CAAC,YAAY,CAAC,IAAI,GAAG,CAAC,CAAC,YAAY,CAAC,IAAI,CAAC;AACnD,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,IAAwB;IAC/C,IAAI,IAA0B,CAAC;IAC/B,QAAQ,IAAI,CAAC,IAAI,EAAE;QACjB,KAAK,YAAY;YAAE,IAAI,GAAG,QAAQ,CAAC;YAAC,MAAM;QAC1C,KAAK,UAAU;YAAE,IAAI,GAAG,QAAQ,CAAC;YAAC,MAAM;QACxC,KAAK,WAAW;YAAE,IAAI,GAAG,qBAAqB,CAAC;YAAC,MAAM;QACtD,KAAK,mBAAmB;YAAE,IAAI,GAAG,aAAa,CAAC;YAAC,MAAM;QACtD,QAAQ;KACT;IACD,OAAO,IAAI,CAAC;AACd,CAAC","sourcesContent":["import { CertificateFileKind, DataFileKind, FolderKind, IFile, ProjectKind, TrashEntry } from \"@api-client/core/build/browser.js\";\nimport { IconType } from \"../../ui/icons/Icons.js\";\n\n/**\n * Sorts files on the list.\n * \n * Folders are always on top.\n */\nexport function filesSortFunction(a: IFile, b: IFile): number {\n if (a.kind !== b.kind) {\n if (a.kind === FolderKind) {\n return -1;\n }\n return 1;\n }\n if (a.kind === b.kind && a.kind === FolderKind) {\n return (a.info.name || '').localeCompare(b.info.name || '');\n }\n return b.lastModified.time - a.lastModified.time;\n}\n\nexport function fileIcon(item: IFile | TrashEntry): IconType | undefined {\n let icon: IconType | undefined;\n switch (item.kind) {\n case DataFileKind: icon = 'schema'; break;\n case FolderKind: icon = 'folder'; break;\n case ProjectKind: icon = 'collectionsBookmark'; break;\n case CertificateFileKind: icon = 'certificate'; break;\n default:\n }\n return icon;\n}\n"]}
|
|
@@ -10,7 +10,7 @@ export class Cursor {
|
|
|
10
10
|
async decodeCursor(cursor) {
|
|
11
11
|
let result;
|
|
12
12
|
try {
|
|
13
|
-
const decoded = atob(cursor);
|
|
13
|
+
const decoded = window.atob(cursor);
|
|
14
14
|
result = JSON.parse(decoded);
|
|
15
15
|
}
|
|
16
16
|
catch (e) {
|
|
@@ -25,7 +25,7 @@ export class Cursor {
|
|
|
25
25
|
*/
|
|
26
26
|
async encodeCursor(state) {
|
|
27
27
|
const str = JSON.stringify(state);
|
|
28
|
-
return btoa(str);
|
|
28
|
+
return window.btoa(str);
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
//# sourceMappingURL=Cursor.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Cursor.js","sourceRoot":"","sources":["../../../src/http-client/store/Cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAG7D;;GAEG;AACH,MAAM,OAAO,MAAM;IACjB;;;OAGG;IACH,KAAK,CAAC,YAAY,CAAC,MAAc;QAC/B,IAAI,MAAkB,CAAC;QACvB,IAAI;YACF,MAAM,OAAO,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"Cursor.js","sourceRoot":"","sources":["../../../src/http-client/store/Cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,mCAAmC,CAAC;AAG7D;;GAEG;AACH,MAAM,OAAO,MAAM;IACjB;;;OAGG;IACH,KAAK,CAAC,YAAY,CAAC,MAAc;QAC/B,IAAI,MAAkB,CAAC;QACvB,IAAI;YACF,MAAM,OAAO,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;YACpC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SAC9B;QAAC,OAAO,CAAC,EAAE;YACV,MAAM,IAAI,QAAQ,CAAC,sBAAsB,EAAE,GAAG,CAAC,CAAC;SACjD;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;IAED;;;;OAIG;IACH,KAAK,CAAC,YAAY,CAAC,KAAa;QAC9B,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;QAClC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,CAAC;CACF","sourcesContent":["import { ApiError } from \"@api-client/core/build/browser.js\";\nimport { IListState } from \"./State.js\";\n\n/**\n * A class that serializes and deserializes the pagination cursor.\n */\nexport class Cursor {\n /**\n * Reads the cursor received from the client by decrypting its contents.\n * It throws an error when the cursor is invalid\n */\n async decodeCursor(cursor: string): Promise<IListState> {\n let result: IListState;\n try {\n const decoded = window.atob(cursor);\n result = JSON.parse(decoded);\n } catch (e) {\n throw new ApiError(`Invalid page cursor.`, 400);\n }\n return result;\n }\n\n /**\n * Encodes the state into a cursor.\n * @param state The list state.\n * @returns The encoded (base64) cursor.\n */\n async encodeCursor(state: object): Promise<string> {\n const str = JSON.stringify(state);\n return window.btoa(str);\n }\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClientIdbDatabase.d.ts","sourceRoot":"","sources":["../../../src/http-client/store/HttpClientIdbDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAmB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"HttpClientIdbDatabase.d.ts","sourceRoot":"","sources":["../../../src/http-client/store/HttpClientIdbDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAmB,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,YAAY,EAAa,MAAM,YAAY,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;GAEG;AACH,qBAAa,qBAAsB,YAAW,qBAAqB;;IACjE;;;OAGG;IACH,YAAY,SAAM;IAElB,SAAS,CAAC,GAAG,CAAC,EAAE,YAAY,CAAC,YAAY,CAAC,CAAC;IAE3C;;;OAGG;IACH,IAAI,EAAE,IAAI,YAAY,CAAC,YAAY,CAAC,CAMnC;IAID;;OAEG;IACH,IAAI,UAAU,IAAI,aAAa,CAM9B;IAID;;OAEG;IACH,IAAI,SAAS,IAAI,YAAY,CAM5B;IAID;;OAEG;IACH,IAAI,SAAS,IAAI,YAAY,CAM5B;IAEK,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAY3B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;IAS9B,MAAM,SAAgB;IAEhB,aAAa,CAAC,MAAM,GAAE,kBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC;IAOzE;;;;;;;OAOG;IACG,oBAAoB,CAAC,KAAK,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAY9F;;;OAGG;IACG,IAAI,IAAI,OAAO,CAAC,YAAY,CAAC,YAAY,CAAC,CAAC;IAyBjD;;;;OAIG;IACH,OAAO,CAAC,sBAAsB;IAO9B,OAAO,CAAC,yBAAyB;IAOjC,OAAO,CAAC,wBAAwB;IAOhC,OAAO,CAAC,wBAAwB;CAQjC"}
|
|
@@ -110,9 +110,7 @@ export class HttpClientIdbDatabase {
|
|
|
110
110
|
const dbResult = await openDB('HttpClient', 1, {
|
|
111
111
|
upgrade: (db) => {
|
|
112
112
|
const stores = [
|
|
113
|
-
'UrlHistory', 'WsHistory',
|
|
114
|
-
'AuthCache', 'Hosts', 'Environments',
|
|
115
|
-
'ProjectUi',
|
|
113
|
+
'UrlHistory', 'WsHistory', 'ProjectUi',
|
|
116
114
|
];
|
|
117
115
|
const names = db.objectStoreNames;
|
|
118
116
|
for (const name of stores) {
|
|
@@ -139,9 +137,7 @@ export class HttpClientIdbDatabase {
|
|
|
139
137
|
if (storeExists) {
|
|
140
138
|
return;
|
|
141
139
|
}
|
|
142
|
-
|
|
143
|
-
const typed = store;
|
|
144
|
-
typed.createIndex('space', 'meta.space', { unique: false });
|
|
140
|
+
db.createObjectStore(name, { keyPath: 'data.key' });
|
|
145
141
|
}
|
|
146
142
|
_UrlHistoryUpgradeHandler(db, storeExists) {
|
|
147
143
|
if (storeExists) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HttpClientIdbDatabase.js","sourceRoot":"","sources":["../../../src/http-client/store/HttpClientIdbDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiC,MAAM,qBAAqB,CAAC;AAG5E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAAlC;QACE;;;WAGG;QACH,iBAAY,GAAG,EAAE,CAAC;QA4ElB,WAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IAgGxB,CAAC;IAxKC;;;OAGG;IACH,IAAI,EAAE;QACJ,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC;QACpB,IAAI,CAAC,EAAE,EAAE;YACP,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;SAClF;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,WAAW,CAAiB;IAE5B;;OAEG;IACH,IAAI,UAAU;QACZ,MAAM,GAAG,GAAG,IAAI,CAAC,WAAW,CAAC;QAC7B,IAAI,CAAC,GAAG,EAAE;YACR,MAAM,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC;SAC3C;QACD,OAAO,GAAG,CAAC;IACb,CAAC;IAED,UAA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,CAAC,EAAE,CAAC,CAAC;QAC3F,MAAM,KAAK,GAAG,KAAmF,CAAC;QAClG,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAClE,CAAC;CACF","sourcesContent":["import { openDB, IDBPDatabase, IDBPObjectStore } from 'idb/with-async-ittr';\nimport { ContextListOptions } from '@api-client/core/build/browser.js';\nimport { HttpClientPersistance } from \"./HttpClientPersistance.js\";\nimport { Cursor } from './Cursor.js';\nimport { IListState } from './State.js';\nimport { HttpClientDB, SpaceStoreNames, StoreName } from './types.js';\nimport { IdbUrlHistory } from './idb/IdbUrlHistory.js';\nimport { IdbWsHistory } from './idb/IdbWsHistory.js';\nimport { IdbProjectUi } from './idb/IdbProjectUi.js';\n\n/**\n * The implementation of the API Client app database in IDB.\n */\nexport class HttpClientIdbDatabase implements HttpClientPersistance {\n /**\n * The default limit of items returned by the list operation.\n * @default 35\n */\n defaultLimit = 35;\n\n protected _db?: IDBPDatabase<HttpClientDB>;\n\n /**\n * The reference to the currently opened database.\n * This throws when the `initialize()` method wasn't called.\n */\n get db(): IDBPDatabase<HttpClientDB> {\n const db = this._db;\n if (!db) {\n throw new Error(`Attempted to access the database before opening a connection.`);\n }\n return db;\n }\n \n #urlHistory?: IdbUrlHistory;\n\n /**\n * File metadata store.\n */\n get urlHistory(): IdbUrlHistory {\n const ref = this.#urlHistory;\n if (!ref) {\n throw new Error(`Store not initialized.`);\n }\n return ref;\n }\n\n #wsHistory?: IdbWsHistory;\n\n /**\n * File metadata store.\n */\n get wsHistory(): IdbWsHistory {\n const ref = this.#wsHistory;\n if (!ref) {\n throw new Error(`Store not initialized.`);\n }\n return ref;\n }\n\n #projectUi?: IdbProjectUi;\n\n /**\n * File metadata store.\n */\n get projectUi(): IdbProjectUi {\n const ref = this.#projectUi;\n if (!ref) {\n throw new Error(`Store not initialized.`);\n }\n return ref;\n }\n\n async initialize(): Promise<void> {\n const db = await this.open();\n\n this.#urlHistory = new IdbUrlHistory(this, db);\n this.#wsHistory = new IdbWsHistory(this, db);\n this.#projectUi = new IdbProjectUi(this, db);\n \n await this.#urlHistory.warmup();\n await this.#wsHistory.warmup();\n await this.#projectUi.warmup();\n }\n\n async cleanup(): Promise<void> {\n await this.urlHistory.cleanup();\n await this.wsHistory.cleanup();\n await this.projectUi.cleanup();\n\n this.db.close();\n this._db = undefined;\n }\n\n cursor = new Cursor();\n\n async readListState(source: ContextListOptions = {}): Promise<IListState> {\n if (source.cursor) {\n return this.cursor.decodeCursor(source.cursor);\n }\n return { ...source } as IListState;\n }\n\n /**\n * Creates a database cursor when there are results.\n * This sets `skip` and `lastKey` parameters.\n * \n * @param state The last list state object\n * @param results The read results.\n * @returns A cursor to be used with pagination.\n */\n async createCursorIfNeeded(state: IListState, results: unknown[]): Promise<string | undefined> {\n if (!results.length) {\n return undefined;\n }\n\n const copy = { ...state } as IListState;\n const { key } = (results[results.length - 1] as { key: string });\n copy.skip = 1;\n copy.lastKey = key;\n return this.cursor.encodeCursor(copy);\n }\n\n /**\n * Opens the ARC store.\n * @returns The reference to the database\n */\n async open(): Promise<IDBPDatabase<HttpClientDB>> {\n if (this._db) {\n return this._db;\n }\n const dbResult = await openDB<HttpClientDB>('HttpClient', 1, {\n upgrade: (db) => {\n const stores: StoreName[] = [\n 'UrlHistory', 'WsHistory',\n 'AuthCache', 'Hosts', 'Environments', \n 'ProjectUi', \n ];\n const names = db.objectStoreNames;\n for (const name of stores) {\n const exists = names.contains(name);\n const fnName = `_${name}UpgradeHandler` as unknown as '_UrlHistoryUpgradeHandler' | '_WsHistoryUpgradeHandler' | '_ProjectUiUpgradeHandler';\n if (typeof this[fnName] === 'function') {\n this[fnName](db, exists);\n } else if (!exists) {\n this._defaultUpgradeHandler(name as SpaceStoreNames, db, exists);\n }\n }\n },\n });\n this._db = dbResult;\n return dbResult;\n }\n\n /**\n * Creates a default store where the stored object is identified by the `data.key` path.\n * @param name The store name to create\n * @param db The handler to the database\n */\n private _defaultUpgradeHandler(name: SpaceStoreNames, db: IDBPDatabase<HttpClientDB>, storeExists: boolean): void {\n if (storeExists) {\n return;\n }\n const store = db.createObjectStore(name, { keyPath: 'data.key' });\n const typed = store as IDBPObjectStore<HttpClientDB, SpaceStoreNames[], SpaceStoreNames, 'versionchange'>;\n typed.createIndex('space', 'meta.space', { unique: false });\n }\n\n private _UrlHistoryUpgradeHandler(db: IDBPDatabase<HttpClientDB>, storeExists: boolean): void {\n if (storeExists) {\n return;\n }\n db.createObjectStore('UrlHistory', { keyPath: 'key' });\n }\n\n private _WsHistoryUpgradeHandler(db: IDBPDatabase<HttpClientDB>, storeExists: boolean): void {\n if (storeExists) {\n return;\n }\n db.createObjectStore('WsHistory', { keyPath: 'key' });\n }\n\n private _ProjectUiUpgradeHandler(db: IDBPDatabase<HttpClientDB>, storeExists: boolean): void {\n if (storeExists) {\n return;\n }\n const store = db.createObjectStore('ProjectUi', { keyPath: ['meta.project', 'meta.key'] });\n const typed = store as IDBPObjectStore<HttpClientDB, ['ProjectUi'], 'ProjectUi', 'versionchange'>;\n typed.createIndex('project', 'meta.project', { unique: false });\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"HttpClientIdbDatabase.js","sourceRoot":"","sources":["../../../src/http-client/store/HttpClientIdbDatabase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAiC,MAAM,qBAAqB,CAAC;AAG5E,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAGrC,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAErD;;GAEG;AACH,MAAM,OAAO,qBAAqB;IAAlC;QACE;;;WAGG;QACH,iBAAY,GAAG,EAAE,CAAC;QA4ElB,WAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IA4FxB,CAAC;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AE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC;IACxD,CAAC;IAEO,wBAAwB,CAAC,EAA8B,EAAE,WAAoB;QACnF,IAAI,WAAW,EAAE;YACf,OAAO;SACR;QACD,MAAM,KAAK,GAAG,EAAE,CAAC,iBAAiB,CAAC,WAAW,EAAE,EAAE,OAAO,EAAE,CAAC,cAAc,EAAE,UAAU,CAAC,EAAE,CAAC,CAAC;QAC3F,MAAM,KAAK,GAAG,KAAmF,CAAC;QAClG,KAAK,CAAC,WAAW,CAAC,SAAS,EAAE,cAAc,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;IAClE,CAAC;CACF","sourcesContent":["import { openDB, IDBPDatabase, IDBPObjectStore } from 'idb/with-async-ittr';\nimport { ContextListOptions } from '@api-client/core/build/browser.js';\nimport { HttpClientPersistance } from \"./HttpClientPersistance.js\";\nimport { Cursor } from './Cursor.js';\nimport { IListState } from './State.js';\nimport { HttpClientDB, StoreName } from './types.js';\nimport { IdbUrlHistory } from './idb/IdbUrlHistory.js';\nimport { IdbWsHistory } from './idb/IdbWsHistory.js';\nimport { IdbProjectUi } from './idb/IdbProjectUi.js';\n\n/**\n * The implementation of the API Client app database in IDB.\n */\nexport class HttpClientIdbDatabase implements HttpClientPersistance {\n /**\n * The default limit of items returned by the list operation.\n * @default 35\n */\n defaultLimit = 35;\n\n protected _db?: IDBPDatabase<HttpClientDB>;\n\n /**\n * The reference to the currently opened database.\n * This throws when the `initialize()` method wasn't called.\n */\n get db(): IDBPDatabase<HttpClientDB> {\n const db = this._db;\n if (!db) {\n throw new Error(`Attempted to access the database before opening a connection.`);\n }\n return db;\n }\n \n #urlHistory?: IdbUrlHistory;\n\n /**\n * File metadata store.\n */\n get urlHistory(): IdbUrlHistory {\n const ref = this.#urlHistory;\n if (!ref) {\n throw new Error(`Store not initialized.`);\n }\n return ref;\n }\n\n #wsHistory?: IdbWsHistory;\n\n /**\n * File metadata store.\n */\n get wsHistory(): IdbWsHistory {\n const ref = this.#wsHistory;\n if (!ref) {\n throw new Error(`Store not initialized.`);\n }\n return ref;\n }\n\n #projectUi?: IdbProjectUi;\n\n /**\n * File metadata store.\n */\n get projectUi(): IdbProjectUi {\n const ref = this.#projectUi;\n if (!ref) {\n throw new Error(`Store not initialized.`);\n }\n return ref;\n }\n\n async initialize(): Promise<void> {\n const db = await this.open();\n\n this.#urlHistory = new IdbUrlHistory(this, db);\n this.#wsHistory = new IdbWsHistory(this, db);\n this.#projectUi = new IdbProjectUi(this, db);\n \n await this.#urlHistory.warmup();\n await this.#wsHistory.warmup();\n await this.#projectUi.warmup();\n }\n\n async cleanup(): Promise<void> {\n await this.urlHistory.cleanup();\n await this.wsHistory.cleanup();\n await this.projectUi.cleanup();\n\n this.db.close();\n this._db = undefined;\n }\n\n cursor = new Cursor();\n\n async readListState(source: ContextListOptions = {}): Promise<IListState> {\n if (source.cursor) {\n return this.cursor.decodeCursor(source.cursor);\n }\n return { ...source } as IListState;\n }\n\n /**\n * Creates a database cursor when there are results.\n * This sets `skip` and `lastKey` parameters.\n * \n * @param state The last list state object\n * @param results The read results.\n * @returns A cursor to be used with pagination.\n */\n async createCursorIfNeeded(state: IListState, results: unknown[]): Promise<string | undefined> {\n if (!results.length) {\n return undefined;\n }\n\n const copy = { ...state } as IListState;\n const { key } = (results[results.length - 1] as { key: string });\n copy.skip = 1;\n copy.lastKey = key;\n return this.cursor.encodeCursor(copy);\n }\n\n /**\n * Opens the ARC store.\n * @returns The reference to the database\n */\n async open(): Promise<IDBPDatabase<HttpClientDB>> {\n if (this._db) {\n return this._db;\n }\n const dbResult = await openDB<HttpClientDB>('HttpClient', 1, {\n upgrade: (db) => {\n const stores: StoreName[] = [\n 'UrlHistory', 'WsHistory', 'ProjectUi', \n ];\n const names = db.objectStoreNames;\n for (const name of stores) {\n const exists = names.contains(name);\n const fnName = `_${name}UpgradeHandler` as unknown as '_UrlHistoryUpgradeHandler' | '_WsHistoryUpgradeHandler' | '_ProjectUiUpgradeHandler';\n if (typeof this[fnName] === 'function') {\n this[fnName](db, exists);\n } else if (!exists) {\n this._defaultUpgradeHandler(name as StoreName, db, exists);\n }\n }\n },\n });\n this._db = dbResult;\n return dbResult;\n }\n\n /**\n * Creates a default store where the stored object is identified by the `data.key` path.\n * @param name The store name to create\n * @param db The handler to the database\n */\n private _defaultUpgradeHandler(name: StoreName, db: IDBPDatabase<HttpClientDB>, storeExists: boolean): void {\n if (storeExists) {\n return;\n }\n db.createObjectStore(name, { keyPath: 'data.key' });\n }\n\n private _UrlHistoryUpgradeHandler(db: IDBPDatabase<HttpClientDB>, storeExists: boolean): void {\n if (storeExists) {\n return;\n }\n db.createObjectStore('UrlHistory', { keyPath: 'key' });\n }\n\n private _WsHistoryUpgradeHandler(db: IDBPDatabase<HttpClientDB>, storeExists: boolean): void {\n if (storeExists) {\n return;\n }\n db.createObjectStore('WsHistory', { keyPath: 'key' });\n }\n\n private _ProjectUiUpgradeHandler(db: IDBPDatabase<HttpClientDB>, storeExists: boolean): void {\n if (storeExists) {\n return;\n }\n const store = db.createObjectStore('ProjectUi', { keyPath: ['meta.project', 'meta.key'] });\n const typed = store as IDBPObjectStore<HttpClientDB, ['ProjectUi'], 'ProjectUi', 'versionchange'>;\n typed.createIndex('project', 'meta.project', { unique: false });\n }\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ContextSpaceListOptions
|
|
1
|
+
import { ContextSpaceListOptions } from "@api-client/core/build/browser.js";
|
|
2
2
|
export interface CursorState {
|
|
3
3
|
/**
|
|
4
4
|
* The key of the last item returned by the query.
|
|
@@ -12,6 +12,4 @@ export interface CursorState {
|
|
|
12
12
|
skip?: number;
|
|
13
13
|
}
|
|
14
14
|
export type IListState = ContextSpaceListOptions & CursorState;
|
|
15
|
-
export type HistoryState = HistoryListOptions & CursorState;
|
|
16
|
-
export type ProjectRunsState = IProjectExecutionListOptions & CursorState;
|
|
17
15
|
//# sourceMappingURL=State.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../src/http-client/store/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,
|
|
1
|
+
{"version":3,"file":"State.d.ts","sourceRoot":"","sources":["../../../src/http-client/store/State.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAE5E,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,UAAU,GAAG,uBAAuB,GAAG,WAAW,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"State.js","sourceRoot":"","sources":["../../../src/http-client/store/State.ts"],"names":[],"mappings":"","sourcesContent":["import { ContextSpaceListOptions
|
|
1
|
+
{"version":3,"file":"State.js","sourceRoot":"","sources":["../../../src/http-client/store/State.ts"],"names":[],"mappings":"","sourcesContent":["import { ContextSpaceListOptions } from \"@api-client/core/build/browser.js\";\n\nexport interface CursorState {\n /**\n * The key of the last item returned by the query.\n * Used with pagination and this is encoded in the cursor.\n */\n lastKey?: string;\n /**\n * The number of records to skip before start capturing records.\n * This is used with the IDB `advance()` method.\n */\n skip?: number;\n}\n\nexport type IListState = ContextSpaceListOptions & CursorState;\n"]}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { IDBPDatabase } from "idb";
|
|
2
|
-
import { HttpClientDB
|
|
3
|
-
import { IListState } from "../State.js";
|
|
2
|
+
import { HttpClientDB } from "../types.js";
|
|
4
3
|
import { HttpClientIdbDatabase } from "../HttpClientIdbDatabase.js";
|
|
5
4
|
export declare abstract class IdbStore {
|
|
6
5
|
parent: HttpClientIdbDatabase;
|
|
@@ -19,13 +18,5 @@ export declare abstract class IdbStore {
|
|
|
19
18
|
* It is optional to implement but always called.
|
|
20
19
|
*/
|
|
21
20
|
cleanup(): Promise<void>;
|
|
22
|
-
/**
|
|
23
|
-
* Lists entities that uses `IStoredEntity` format.
|
|
24
|
-
* @param db A reference to the database
|
|
25
|
-
* @param storeName The name of the store to query.
|
|
26
|
-
* @param opts Query options.
|
|
27
|
-
* @returns The list of listed objects.
|
|
28
|
-
*/
|
|
29
|
-
protected listStoredEntities(db: IDBPDatabase<HttpClientDB>, storeName: StoreName, opts: IListState): Promise<unknown[]>;
|
|
30
21
|
}
|
|
31
22
|
//# sourceMappingURL=IdbStore.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IdbStore.d.ts","sourceRoot":"","sources":["../../../../src/http-client/store/idb/IdbStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,EAAE,YAAY,
|
|
1
|
+
{"version":3,"file":"IdbStore.d.ts","sourceRoot":"","sources":["../../../../src/http-client/store/idb/IdbStore.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,KAAK,CAAC;AACnC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAEpE,8BAAsB,QAAQ;IAIT,MAAM,EAAE,qBAAqB;IAAS,EAAE,EAAE,YAAY,CAAC,YAAY,CAAC;IAHvF;;OAEG;gBACgB,MAAM,EAAE,qBAAqB,EAAS,EAAE,EAAE,YAAY,CAAC,YAAY,CAAC;IAEvF;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAI7B;;;OAGG;IACG,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC;CAG/B"}
|