@biscuit-auth/web-components
Advanced tools
Comparing version 0.0.1-beta4 to 0.3.4
@@ -6,3 +6,3 @@ "use strict"; | ||
const events_js_1 = require("../src/lib/events.js"); | ||
const biscuit_component_wasm_1 = require("@geal/biscuit-component-wasm"); | ||
const biscuit_wasm_support_1 = require("@biscuit-auth/biscuit-wasm-support"); | ||
require("./bc-authorizer-editor.js"); | ||
@@ -59,3 +59,3 @@ require("./bc-authorizer-result.js"); | ||
}; | ||
var result = (0, biscuit_component_wasm_1.execute)(state); | ||
var result = (0, biscuit_wasm_support_1.execute)(state); | ||
authorizer_result = result.authorizer_result; | ||
@@ -62,0 +62,0 @@ authorizer_world = result.authorizer_world; |
@@ -6,3 +6,3 @@ "use strict"; | ||
const events_js_1 = require("../src/lib/events.js"); | ||
const biscuit_component_wasm_1 = require("@geal/biscuit-component-wasm"); | ||
const biscuit_wasm_support_1 = require("@biscuit-auth/biscuit-wasm-support"); | ||
require("./bc-authorizer-editor.js"); | ||
@@ -57,3 +57,3 @@ require("./bc-authorizer-result.js"); | ||
}; | ||
var result = (0, biscuit_component_wasm_1.execute)(state); | ||
var result = (0, biscuit_wasm_support_1.execute)(state); | ||
authorizer_result = result.authorizer_result; | ||
@@ -60,0 +60,0 @@ authorizer_world = result.authorizer_world; |
@@ -6,3 +6,3 @@ "use strict"; | ||
const events_js_1 = require("../src/lib/events.js"); | ||
const biscuit_component_wasm_1 = require("@geal/biscuit-component-wasm"); | ||
const biscuit_wasm_support_1 = require("@biscuit-auth/biscuit-wasm-support"); | ||
require("./bc-authorizer-editor.js"); | ||
@@ -75,3 +75,3 @@ require("./bc-authorizer-result.js"); | ||
console.log("WILL EXECUTE"); | ||
var result = (0, biscuit_component_wasm_1.execute)(state); | ||
var result = (0, biscuit_wasm_support_1.execute)(state); | ||
console.log(result); | ||
@@ -78,0 +78,0 @@ var parseErrors = []; |
@@ -0,26 +1,10 @@ | ||
import { LitElement, PropertyValues } from 'lit'; | ||
import './bc-datalog-editor.js'; | ||
/** | ||
* TODO DOCS | ||
*/ | ||
export class BcTokenPrinter extends LitElement { | ||
static get properties(): { | ||
biscuit: { | ||
type: StringConstructor; | ||
}; | ||
_blocks: { | ||
type: ArrayConstructor; | ||
}; | ||
_error: { | ||
type: StringConstructor; | ||
}; | ||
started: { | ||
type: BooleanConstructor; | ||
}; | ||
}; | ||
static get styles(): import("lit").CSSResult[]; | ||
_blocks: { | ||
code: string; | ||
}[]; | ||
_error: string; | ||
export declare class BcTokenPrinter extends LitElement { | ||
biscuit: string; | ||
started: boolean; | ||
_started: boolean; | ||
firstUpdated(changedProperties: PropertyValues): void; | ||
_onUpdatedToken(e: any): void; | ||
@@ -30,5 +14,7 @@ renderTokenInput(): import("lit-html").TemplateResult<1>; | ||
renderEmptyToken(): import("lit-html").TemplateResult<1>; | ||
renderResult(): import("lit-html").TemplateResult<1>; | ||
error: any; | ||
renderResult(error: String, blocks: Array<{ | ||
code: String; | ||
}>): import("lit-html").TemplateResult<1>; | ||
render(): import("lit-html").TemplateResult<1>; | ||
static styles: import("lit").CSSResult; | ||
} | ||
import { LitElement } from "lit-element/lit-element"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.BcTokenPrinter = void 0; | ||
const tslib_1 = require("tslib"); | ||
const lit_1 = require("lit"); | ||
const decorators_js_1 = require("lit/decorators.js"); | ||
require("./bc-datalog-editor.js"); | ||
const wasm_js_1 = require("./wasm.js"); | ||
const biscuit_component_wasm_1 = require("@geal/biscuit-component-wasm"); | ||
const biscuit_wasm_support_1 = require("@biscuit-auth/biscuit-wasm-support"); | ||
/** | ||
* TODO DOCS | ||
*/ | ||
class BcTokenPrinter extends lit_1.LitElement { | ||
static get properties() { | ||
return { | ||
biscuit: { type: String }, | ||
_blocks: { type: Array }, | ||
_error: { type: String }, | ||
started: { type: Boolean }, | ||
}; | ||
} | ||
let BcTokenPrinter = class BcTokenPrinter extends lit_1.LitElement { | ||
constructor() { | ||
var _a; | ||
super(); | ||
this._blocks = []; | ||
this._error = ""; | ||
this.biscuit = (_a = this.biscuit) !== null && _a !== void 0 ? _a : ""; | ||
for (const child of Array.from(this.children)) { | ||
this._blocks.push({ code: child.innerHTML }); | ||
} | ||
this.started = false; | ||
super(...arguments); | ||
this.biscuit = ''; | ||
this._started = false; | ||
} | ||
firstUpdated(changedProperties) { | ||
(0, wasm_js_1.initialize)().then(() => this.started = true); | ||
(0, wasm_js_1.initialize)().then(() => this._started = true); | ||
} | ||
update(changedProperties) { | ||
super.update(changedProperties); | ||
} | ||
_onUpdatedToken(e) { | ||
@@ -60,4 +45,3 @@ this.biscuit = e.target.value.trim(); | ||
} | ||
renderResult() { | ||
console.log([this.error, this._blocks]); | ||
renderResult(error, blocks) { | ||
if (this.biscuit === "") { | ||
@@ -69,6 +53,6 @@ return (0, lit_1.html) ` | ||
} | ||
if (this.error) { | ||
if (error) { | ||
return (0, lit_1.html) ` | ||
${this.renderTokenInput()} | ||
<div class="content">${this.error}</div> | ||
<div class="content">${error}</div> | ||
`; | ||
@@ -80,3 +64,3 @@ } | ||
<p>Decoded token</p> | ||
${this._blocks.map((block, index) => (0, lit_1.html) ` | ||
${blocks.map((block, index) => (0, lit_1.html) ` | ||
<div> | ||
@@ -94,20 +78,10 @@ <p>Block ${index}:</p> | ||
render() { | ||
if (!this.started) | ||
if (!this._started) | ||
return this.renderNotStarted(); | ||
const result = (0, biscuit_component_wasm_1.parse_token)({ data: this.biscuit }); | ||
console.log("parsed"); | ||
console.log(result); | ||
this.error = result.error; | ||
this._blocks = []; | ||
for (let block of result.token_blocks) { | ||
this._blocks.push({ | ||
code: block | ||
}); | ||
} | ||
return this.renderResult(); | ||
const result = (0, biscuit_wasm_support_1.parse_token)({ data: this.biscuit }); | ||
const blocks = result.token_blocks.map((code) => ({ code })); | ||
return this.renderResult(result.error, blocks); | ||
} | ||
static get styles() { | ||
return [ | ||
// language=CSS | ||
(0, lit_1.css) ` | ||
}; | ||
BcTokenPrinter.styles = (0, lit_1.css) ` | ||
:host { | ||
@@ -174,8 +148,13 @@ display: flex; | ||
} | ||
`, | ||
]; | ||
} | ||
} | ||
`; | ||
(0, tslib_1.__decorate)([ | ||
(0, decorators_js_1.property)() | ||
], BcTokenPrinter.prototype, "biscuit", void 0); | ||
(0, tslib_1.__decorate)([ | ||
(0, decorators_js_1.state)() | ||
], BcTokenPrinter.prototype, "_started", void 0); | ||
BcTokenPrinter = (0, tslib_1.__decorate)([ | ||
(0, decorators_js_1.customElement)('bc-token-printer') | ||
], BcTokenPrinter); | ||
exports.BcTokenPrinter = BcTokenPrinter; | ||
window.customElements.define('bc-token-printer', BcTokenPrinter); | ||
//# sourceMappingURL=bc-token-printer.js.map |
@@ -9,6 +9,5 @@ import './imp.js'; | ||
import './bc-datalog-example.js'; | ||
import './bc-token-printer.js'; | ||
import './bc-token-printer'; | ||
import './bc-full-example.js'; | ||
import './test'; | ||
export { execute } from "@geal/biscuit-component-wasm"; | ||
export { execute } from "@biscuit-auth/biscuit-wasm-support"; | ||
export { initialize } from './wasm.js'; |
@@ -12,9 +12,8 @@ "use strict"; | ||
require("./bc-datalog-example.js"); | ||
require("./bc-token-printer.js"); | ||
require("./bc-token-printer"); | ||
require("./bc-full-example.js"); | ||
require("./test"); | ||
var biscuit_component_wasm_1 = require("@geal/biscuit-component-wasm"); | ||
Object.defineProperty(exports, "execute", { enumerable: true, get: function () { return biscuit_component_wasm_1.execute; } }); | ||
var biscuit_wasm_support_1 = require("@biscuit-auth/biscuit-wasm-support"); | ||
Object.defineProperty(exports, "execute", { enumerable: true, get: function () { return biscuit_wasm_support_1.execute; } }); | ||
var wasm_js_1 = require("./wasm.js"); | ||
Object.defineProperty(exports, "initialize", { enumerable: true, get: function () { return wasm_js_1.initialize; } }); | ||
//# sourceMappingURL=index.js.map |
@@ -5,3 +5,3 @@ "use strict"; | ||
const tslib_1 = require("tslib"); | ||
const biscuit_component_wasm_1 = (0, tslib_1.__importDefault)(require("@geal/biscuit-component-wasm")); | ||
const biscuit_wasm_support_1 = (0, tslib_1.__importDefault)(require("@biscuit-auth/biscuit-wasm-support")); | ||
let loadPromise = null; | ||
@@ -11,3 +11,3 @@ async function initialize() { | ||
console.log("will create wasm promise"); | ||
loadPromise = (0, biscuit_component_wasm_1.default)(); | ||
loadPromise = (0, biscuit_wasm_support_1.default)(); | ||
} | ||
@@ -14,0 +14,0 @@ console.log("returning wasm promise"); |
import { css, html, LitElement } from 'lit'; | ||
import { dispatchCustomEvent } from '../src/lib/events.js'; | ||
import { execute } from "@geal/biscuit-component-wasm"; | ||
import { execute } from "@biscuit-auth/biscuit-wasm-support"; | ||
import './bc-authorizer-editor.js'; | ||
@@ -5,0 +5,0 @@ import './bc-authorizer-result.js'; |
import { css, html, LitElement } from 'lit'; | ||
import { dispatchCustomEvent } from '../src/lib/events.js'; | ||
import { execute } from "@geal/biscuit-component-wasm"; | ||
import { execute } from "@biscuit-auth/biscuit-wasm-support"; | ||
import './bc-authorizer-editor.js'; | ||
@@ -5,0 +5,0 @@ import './bc-authorizer-result.js'; |
import { css, html, LitElement } from 'lit'; | ||
import { dispatchCustomEvent } from '../src/lib/events.js'; | ||
import { execute } from "@geal/biscuit-component-wasm"; | ||
import { execute } from "@biscuit-auth/biscuit-wasm-support"; | ||
import './bc-authorizer-editor.js'; | ||
@@ -5,0 +5,0 @@ import './bc-authorizer-result.js'; |
@@ -0,26 +1,10 @@ | ||
import { LitElement, PropertyValues } from 'lit'; | ||
import './bc-datalog-editor.js'; | ||
/** | ||
* TODO DOCS | ||
*/ | ||
export class BcTokenPrinter extends LitElement { | ||
static get properties(): { | ||
biscuit: { | ||
type: StringConstructor; | ||
}; | ||
_blocks: { | ||
type: ArrayConstructor; | ||
}; | ||
_error: { | ||
type: StringConstructor; | ||
}; | ||
started: { | ||
type: BooleanConstructor; | ||
}; | ||
}; | ||
static get styles(): import("lit").CSSResult[]; | ||
_blocks: { | ||
code: string; | ||
}[]; | ||
_error: string; | ||
export declare class BcTokenPrinter extends LitElement { | ||
biscuit: string; | ||
started: boolean; | ||
_started: boolean; | ||
firstUpdated(changedProperties: PropertyValues): void; | ||
_onUpdatedToken(e: any): void; | ||
@@ -30,5 +14,7 @@ renderTokenInput(): import("lit-html").TemplateResult<1>; | ||
renderEmptyToken(): import("lit-html").TemplateResult<1>; | ||
renderResult(): import("lit-html").TemplateResult<1>; | ||
error: any; | ||
renderResult(error: String, blocks: Array<{ | ||
code: String; | ||
}>): import("lit-html").TemplateResult<1>; | ||
render(): import("lit-html").TemplateResult<1>; | ||
static styles: import("lit").CSSResult; | ||
} | ||
import { LitElement } from "lit-element/lit-element"; |
@@ -0,34 +1,19 @@ | ||
import { __decorate } from "tslib"; | ||
import { css, html, LitElement } from 'lit'; | ||
import { customElement, property, state } from 'lit/decorators.js'; | ||
import './bc-datalog-editor.js'; | ||
import { initialize } from './wasm.js'; | ||
import { parse_token } from "@geal/biscuit-component-wasm"; | ||
import { parse_token } from "@biscuit-auth/biscuit-wasm-support"; | ||
/** | ||
* TODO DOCS | ||
*/ | ||
export class BcTokenPrinter extends LitElement { | ||
static get properties() { | ||
return { | ||
biscuit: { type: String }, | ||
_blocks: { type: Array }, | ||
_error: { type: String }, | ||
started: { type: Boolean }, | ||
}; | ||
} | ||
let BcTokenPrinter = class BcTokenPrinter extends LitElement { | ||
constructor() { | ||
var _a; | ||
super(); | ||
this._blocks = []; | ||
this._error = ""; | ||
this.biscuit = (_a = this.biscuit) !== null && _a !== void 0 ? _a : ""; | ||
for (const child of Array.from(this.children)) { | ||
this._blocks.push({ code: child.innerHTML }); | ||
} | ||
this.started = false; | ||
super(...arguments); | ||
this.biscuit = ''; | ||
this._started = false; | ||
} | ||
firstUpdated(changedProperties) { | ||
initialize().then(() => this.started = true); | ||
initialize().then(() => this._started = true); | ||
} | ||
update(changedProperties) { | ||
super.update(changedProperties); | ||
} | ||
_onUpdatedToken(e) { | ||
@@ -57,4 +42,3 @@ this.biscuit = e.target.value.trim(); | ||
} | ||
renderResult() { | ||
console.log([this.error, this._blocks]); | ||
renderResult(error, blocks) { | ||
if (this.biscuit === "") { | ||
@@ -66,6 +50,6 @@ return html ` | ||
} | ||
if (this.error) { | ||
if (error) { | ||
return html ` | ||
${this.renderTokenInput()} | ||
<div class="content">${this.error}</div> | ||
<div class="content">${error}</div> | ||
`; | ||
@@ -77,3 +61,3 @@ } | ||
<p>Decoded token</p> | ||
${this._blocks.map((block, index) => html ` | ||
${blocks.map((block, index) => html ` | ||
<div> | ||
@@ -91,20 +75,10 @@ <p>Block ${index}:</p> | ||
render() { | ||
if (!this.started) | ||
if (!this._started) | ||
return this.renderNotStarted(); | ||
const result = parse_token({ data: this.biscuit }); | ||
console.log("parsed"); | ||
console.log(result); | ||
this.error = result.error; | ||
this._blocks = []; | ||
for (let block of result.token_blocks) { | ||
this._blocks.push({ | ||
code: block | ||
}); | ||
} | ||
return this.renderResult(); | ||
const blocks = result.token_blocks.map((code) => ({ code })); | ||
return this.renderResult(result.error, blocks); | ||
} | ||
static get styles() { | ||
return [ | ||
// language=CSS | ||
css ` | ||
}; | ||
BcTokenPrinter.styles = css ` | ||
:host { | ||
@@ -171,7 +145,13 @@ display: flex; | ||
} | ||
`, | ||
]; | ||
} | ||
} | ||
window.customElements.define('bc-token-printer', BcTokenPrinter); | ||
`; | ||
__decorate([ | ||
property() | ||
], BcTokenPrinter.prototype, "biscuit", void 0); | ||
__decorate([ | ||
state() | ||
], BcTokenPrinter.prototype, "_started", void 0); | ||
BcTokenPrinter = __decorate([ | ||
customElement('bc-token-printer') | ||
], BcTokenPrinter); | ||
export { BcTokenPrinter }; | ||
//# sourceMappingURL=bc-token-printer.js.map |
@@ -9,6 +9,5 @@ import './imp.js'; | ||
import './bc-datalog-example.js'; | ||
import './bc-token-printer.js'; | ||
import './bc-token-printer'; | ||
import './bc-full-example.js'; | ||
import './test'; | ||
export { execute } from "@geal/biscuit-component-wasm"; | ||
export { execute } from "@biscuit-auth/biscuit-wasm-support"; | ||
export { initialize } from './wasm.js'; |
@@ -9,7 +9,6 @@ import './imp.js'; | ||
import './bc-datalog-example.js'; | ||
import './bc-token-printer.js'; | ||
import './bc-token-printer'; | ||
import './bc-full-example.js'; | ||
import './test'; | ||
export { execute } from "@geal/biscuit-component-wasm"; | ||
export { execute } from "@biscuit-auth/biscuit-wasm-support"; | ||
export { initialize } from './wasm.js'; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import init from '@geal/biscuit-component-wasm'; | ||
import init from '@biscuit-auth/biscuit-wasm-support'; | ||
let loadPromise = null; | ||
@@ -3,0 +3,0 @@ export async function initialize() { |
@@ -11,3 +11,3 @@ { | ||
"author": "Geoffroy Couprie", | ||
"version": "0.0.1-beta4", | ||
"version": "0.3.4", | ||
"scripts": { | ||
@@ -22,2 +22,3 @@ "start": "wds --node-resolve --open demo/", | ||
"dependencies": { | ||
"@biscuit-auth/biscuit-wasm-support": "0.2.1", | ||
"@codemirror/basic-setup": "^0.19.0", | ||
@@ -30,3 +31,2 @@ "@codemirror/gutter": "^0.19.5", | ||
"@codemirror/theme-one-dark": "^0.19.1", | ||
"@geal/biscuit-component-wasm": "0.2.0", | ||
"lit": "^2.0.0", | ||
@@ -33,0 +33,0 @@ "lit-analyzer": "^1.2.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
220860
2694
+ Added@biscuit-auth/biscuit-wasm-support@0.2.1(transitive)
- Removed@geal/biscuit-component-wasm@0.2.0
- Removed@geal/biscuit-component-wasm@0.2.0(transitive)