@manifoldco/manifold-init
Advanced tools
@@ -6,3 +6,3 @@ 'use strict'; | ||
const core = require('./core-894a498f.js'); | ||
const core$1 = require('./core-6b6b23c7.js'); | ||
const core$1 = require('./core-be40eb96.js'); | ||
@@ -30,2 +30,9 @@ const ConnectedButton = class { | ||
}; | ||
this.getPlanCost = async () => { | ||
const selection = { | ||
features: { backups: 1, instance_class: 'db.t2.micro', redundancy: false, storage: 5 }, | ||
}; | ||
const response = await this.connection.gateway.post('/id/plan/235exy25wvzpxj52p87bh87gbnj4y/cost', selection); | ||
this.planCost = JSON.stringify(response, null, 2); | ||
}; | ||
} | ||
@@ -38,7 +45,7 @@ async componentWillLoad() { | ||
version: 0, | ||
componentVersion: '0.2.1', | ||
componentVersion: '0.3.0-beta.0', | ||
}); | ||
} | ||
render() { | ||
return (core.h("div", null, core.h("button", { type: "button", onClick: this.getDataSuccess }, "Send (success)"), this.success && (core.h("p", null, "Response: ", core.h("pre", null, this.success))), core.h("hr", null), core.h("button", { type: "button", onClick: this.getDataBadRequest }, "Send (bad request)"), this.badRequest && (core.h("p", null, "Response: ", core.h("pre", null, this.badRequest))), core.h("hr", null), core.h("button", { type: "button", onClick: this.getDataUnauthenticated }, "Send (unauthenticated)"), this.unauthenticated && (core.h("p", null, "Response: ", core.h("pre", null, this.unauthenticated))))); | ||
return (core.h("div", null, core.h("button", { type: "button", onClick: this.getDataSuccess }, "Send (success)"), this.success && (core.h("p", null, "Response: ", core.h("pre", null, this.success))), core.h("hr", null), core.h("button", { type: "button", onClick: this.getDataBadRequest }, "Send (bad request)"), this.badRequest && (core.h("p", null, "Response: ", core.h("pre", null, this.badRequest))), core.h("hr", null), core.h("button", { type: "button", onClick: this.getDataUnauthenticated }, "Send (unauthenticated)"), this.unauthenticated && (core.h("p", null, "Response: ", core.h("pre", null, this.unauthenticated))), core.h("hr", null), core.h("button", { type: "button", onClick: this.getPlanCost }, "Send (plan cost)"), this.planCost && (core.h("p", null, "Response: ", core.h("pre", null, this.planCost))))); | ||
} | ||
@@ -45,0 +52,0 @@ get el() { return core.getElement(this); } |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const core = require('./core-6b6b23c7.js'); | ||
const core = require('./core-be40eb96.js'); | ||
@@ -8,0 +8,0 @@ |
@@ -9,3 +9,3 @@ 'use strict'; | ||
return core.patchEsm().then(() => { | ||
core.bootstrapLazy([["connected-button_2.cjs",[[0,"connected-button",{"success":[32],"badRequest":[32],"unauthenticated":[32]}],[0,"manifold-init",{"env":[1],"authToken":[1,"auth-token"],"authType":[1,"auth-type"],"clientId":[1,"client-id"],"initialize":[64]}]]]], options); | ||
core.bootstrapLazy([["connected-button_2.cjs",[[0,"connected-button",{"success":[32],"badRequest":[32],"unauthenticated":[32],"planCost":[32]}],[0,"manifold-init",{"env":[1],"authToken":[1,"auth-token"],"authType":[1,"auth-type"],"clientId":[1,"client-id"],"initialize":[64]}]]]], options); | ||
}); | ||
@@ -12,0 +12,0 @@ }; |
@@ -6,3 +6,3 @@ 'use strict'; | ||
core.patchBrowser().then(options => { | ||
return core.bootstrapLazy([["connected-button_2.cjs",[[0,"connected-button",{"success":[32],"badRequest":[32],"unauthenticated":[32]}],[0,"manifold-init",{"env":[1],"authToken":[1,"auth-token"],"authType":[1,"auth-type"],"clientId":[1,"client-id"],"initialize":[64]}]]]], options); | ||
return core.bootstrapLazy([["connected-button_2.cjs",[[0,"connected-button",{"success":[32],"badRequest":[32],"unauthenticated":[32],"planCost":[32]}],[0,"manifold-init",{"env":[1],"authToken":[1,"auth-token"],"authType":[1,"auth-type"],"clientId":[1,"client-id"],"initialize":[64]}]]]], options); | ||
}); |
@@ -22,2 +22,9 @@ import { h } from "@stencil/core"; | ||
}; | ||
this.getPlanCost = async () => { | ||
const selection = { | ||
features: { backups: 1, instance_class: 'db.t2.micro', redundancy: false, storage: 5 }, | ||
}; | ||
const response = await this.connection.gateway.post('/id/plan/235exy25wvzpxj52p87bh87gbnj4y/cost', selection); | ||
this.planCost = JSON.stringify(response, null, 2); | ||
}; | ||
} | ||
@@ -48,3 +55,8 @@ async componentWillLoad() { | ||
"Response: ", | ||
h("pre", null, this.unauthenticated))))); | ||
h("pre", null, this.unauthenticated))), | ||
h("hr", null), | ||
h("button", { type: "button", onClick: this.getPlanCost }, "Send (plan cost)"), | ||
this.planCost && (h("p", null, | ||
"Response: ", | ||
h("pre", null, this.planCost))))); | ||
} | ||
@@ -55,5 +67,6 @@ static get is() { return "connected-button"; } | ||
"badRequest": {}, | ||
"unauthenticated": {} | ||
"unauthenticated": {}, | ||
"planCost": {} | ||
}; } | ||
static get elementRef() { return "el"; } | ||
} |
@@ -49,3 +49,3 @@ import { ManifoldError, ErrorType } from './ManifoldError'; | ||
// Immediately reject on internal server error. | ||
const internalServerError = response.status > 500; | ||
const internalServerError = response.status === 500; | ||
if (internalServerError) { | ||
@@ -52,0 +52,0 @@ return Promise.reject(new ManifoldError({ type: ErrorType.ServerError, message: response.statusText })); |
import { createGraphqlFetch } from './graphqlFetch'; | ||
import { createGateway } from './gateway'; | ||
// TODO add real tracking | ||
@@ -10,2 +11,5 @@ const track = data => { | ||
return { | ||
gateway: createGateway({ | ||
baseUrl: () => env === 'stage' ? 'https://api.stage.manifold.co/v1' : 'https://api.manifold.co/v1', | ||
}), | ||
graphqlFetch: createGraphqlFetch({ | ||
@@ -12,0 +16,0 @@ element, |
@@ -38,3 +38,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { r as registerInstance, h, g as getElement } from './core-14d8f2fa.js'; | ||
import { i as initialize } from './core-804c55ff.js'; | ||
import { i as initialize } from './core-115c85b4.js'; | ||
var ConnectedButton = /** @class */ (function () { | ||
@@ -86,2 +86,18 @@ function class_1(hostRef) { | ||
}); }; | ||
this.getPlanCost = function () { return __awaiter(_this, void 0, void 0, function () { | ||
var selection, response; | ||
return __generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
selection = { | ||
features: { backups: 1, instance_class: 'db.t2.micro', redundancy: false, storage: 5 }, | ||
}; | ||
return [4 /*yield*/, this.connection.gateway.post('/id/plan/235exy25wvzpxj52p87bh87gbnj4y/cost', selection)]; | ||
case 1: | ||
response = _a.sent(); | ||
this.planCost = JSON.stringify(response, null, 2); | ||
return [2 /*return*/]; | ||
} | ||
}); | ||
}); }; | ||
} | ||
@@ -101,3 +117,3 @@ class_1.prototype.componentWillLoad = function () { | ||
version: 0, | ||
componentVersion: '0.2.1', | ||
componentVersion: '0.3.0-beta.0', | ||
})]; | ||
@@ -112,3 +128,3 @@ case 2: | ||
class_1.prototype.render = function () { | ||
return (h("div", null, h("button", { type: "button", onClick: this.getDataSuccess }, "Send (success)"), this.success && (h("p", null, "Response: ", h("pre", null, this.success))), h("hr", null), h("button", { type: "button", onClick: this.getDataBadRequest }, "Send (bad request)"), this.badRequest && (h("p", null, "Response: ", h("pre", null, this.badRequest))), h("hr", null), h("button", { type: "button", onClick: this.getDataUnauthenticated }, "Send (unauthenticated)"), this.unauthenticated && (h("p", null, "Response: ", h("pre", null, this.unauthenticated))))); | ||
return (h("div", null, h("button", { type: "button", onClick: this.getDataSuccess }, "Send (success)"), this.success && (h("p", null, "Response: ", h("pre", null, this.success))), h("hr", null), h("button", { type: "button", onClick: this.getDataBadRequest }, "Send (bad request)"), this.badRequest && (h("p", null, "Response: ", h("pre", null, this.badRequest))), h("hr", null), h("button", { type: "button", onClick: this.getDataUnauthenticated }, "Send (unauthenticated)"), this.unauthenticated && (h("p", null, "Response: ", h("pre", null, this.unauthenticated))), h("hr", null), h("button", { type: "button", onClick: this.getPlanCost }, "Send (plan cost)"), this.planCost && (h("p", null, "Response: ", h("pre", null, this.planCost))))); | ||
}; | ||
@@ -115,0 +131,0 @@ Object.defineProperty(class_1.prototype, "el", { |
import { r as registerInstance, h, g as getElement } from './core-14d8f2fa.js'; | ||
import { i as initialize } from './core-804c55ff.js'; | ||
import { i as initialize } from './core-115c85b4.js'; | ||
@@ -25,2 +25,9 @@ const ConnectedButton = class { | ||
}; | ||
this.getPlanCost = async () => { | ||
const selection = { | ||
features: { backups: 1, instance_class: 'db.t2.micro', redundancy: false, storage: 5 }, | ||
}; | ||
const response = await this.connection.gateway.post('/id/plan/235exy25wvzpxj52p87bh87gbnj4y/cost', selection); | ||
this.planCost = JSON.stringify(response, null, 2); | ||
}; | ||
} | ||
@@ -33,7 +40,7 @@ async componentWillLoad() { | ||
version: 0, | ||
componentVersion: '0.2.1', | ||
componentVersion: '0.3.0-beta.0', | ||
}); | ||
} | ||
render() { | ||
return (h("div", null, h("button", { type: "button", onClick: this.getDataSuccess }, "Send (success)"), this.success && (h("p", null, "Response: ", h("pre", null, this.success))), h("hr", null), h("button", { type: "button", onClick: this.getDataBadRequest }, "Send (bad request)"), this.badRequest && (h("p", null, "Response: ", h("pre", null, this.badRequest))), h("hr", null), h("button", { type: "button", onClick: this.getDataUnauthenticated }, "Send (unauthenticated)"), this.unauthenticated && (h("p", null, "Response: ", h("pre", null, this.unauthenticated))))); | ||
return (h("div", null, h("button", { type: "button", onClick: this.getDataSuccess }, "Send (success)"), this.success && (h("p", null, "Response: ", h("pre", null, this.success))), h("hr", null), h("button", { type: "button", onClick: this.getDataBadRequest }, "Send (bad request)"), this.badRequest && (h("p", null, "Response: ", h("pre", null, this.badRequest))), h("hr", null), h("button", { type: "button", onClick: this.getDataUnauthenticated }, "Send (unauthenticated)"), this.unauthenticated && (h("p", null, "Response: ", h("pre", null, this.unauthenticated))), h("hr", null), h("button", { type: "button", onClick: this.getPlanCost }, "Send (plan cost)"), this.planCost && (h("p", null, "Response: ", h("pre", null, this.planCost))))); | ||
} | ||
@@ -40,0 +47,0 @@ get el() { return getElement(this); } |
@@ -1,1 +0,1 @@ | ||
export{i as initialize}from"./p-1a6d60b3.js"; | ||
export{i as initialize}from"./p-f3432b62.js"; |
@@ -1,1 +0,1 @@ | ||
import{p as t,b as e}from"./p-211aed1b.js";t().then(t=>e([["p-qiubgrfq",[[0,"connected-button",{success:[32],badRequest:[32],unauthenticated:[32]}],[0,"manifold-init",{env:[1],authToken:[1,"auth-token"],authType:[1,"auth-type"],clientId:[1,"client-id"],initialize:[64]}]]]],t)); | ||
import{p as t,b as e}from"./p-211aed1b.js";t().then(t=>e([["p-0bkcs7ti",[[0,"connected-button",{success:[32],badRequest:[32],unauthenticated:[32],planCost:[32]}],[0,"manifold-init",{env:[1],authToken:[1,"auth-token"],authType:[1,"auth-type"],clientId:[1,"client-id"],initialize:[64]}]]]],t)); |
@@ -1,1 +0,1 @@ | ||
System.register(["./p-c90b3762.system.js"],(function(){"use strict";var t,e;return{setters:[function(n){t=n.p;e=n.b}],execute:function(){t().then((function(t){return e([["p-lh2fpzj4.system",[[0,"connected-button",{success:[32],badRequest:[32],unauthenticated:[32]}],[0,"manifold-init",{env:[1],authToken:[1,"auth-token"],authType:[1,"auth-type"],clientId:[1,"client-id"],initialize:[64]}]]]],t)}))}}})); | ||
System.register(["./p-c90b3762.system.js"],(function(){"use strict";var t,e;return{setters:[function(n){t=n.p;e=n.b}],execute:function(){t().then((function(t){return e([["p-c00gtzq9.system",[[0,"connected-button",{success:[32],badRequest:[32],unauthenticated:[32],planCost:[32]}],[0,"manifold-init",{env:[1],authToken:[1,"auth-token"],authType:[1,"auth-type"],clientId:[1,"client-id"],initialize:[64]}]]]],t)}))}}})); |
@@ -7,2 +7,3 @@ import { Connection } from '../../v0'; | ||
unauthenticated?: string; | ||
planCost?: string; | ||
connection: Connection; | ||
@@ -13,3 +14,4 @@ componentWillLoad(): Promise<void>; | ||
getDataUnauthenticated: () => Promise<void>; | ||
getPlanCost: () => Promise<void>; | ||
render(): any; | ||
} |
import { GraphqlFetch } from './graphqlFetch'; | ||
import { Gateway } from './gateway'; | ||
export interface Connection { | ||
graphqlFetch: GraphqlFetch; | ||
gateway: Gateway; | ||
track: (event: string) => void; | ||
@@ -5,0 +7,0 @@ } |
@@ -18,3 +18,3 @@ { | ||
], | ||
"version": "0.2.1", | ||
"version": "0.3.0-beta.0", | ||
"description": "Manifold UI Initialization", | ||
@@ -21,0 +21,0 @@ "main": "dist/index.js", |
@@ -101,3 +101,3 @@ import { ManifoldError, ErrorType } from './ManifoldError'; | ||
// Immediately reject on internal server error. | ||
const internalServerError = response.status > 500; | ||
const internalServerError = response.status === 500; | ||
if (internalServerError) { | ||
@@ -104,0 +104,0 @@ return Promise.reject( |
import { createGraphqlFetch, GraphqlFetch } from './graphqlFetch'; | ||
import { createGateway, Gateway } from './gateway'; | ||
@@ -11,2 +12,3 @@ // TODO add real tracking | ||
graphqlFetch: GraphqlFetch; | ||
gateway: Gateway; | ||
track: (event: string) => void; | ||
@@ -24,2 +26,6 @@ } | ||
return { | ||
gateway: createGateway({ | ||
baseUrl: () => | ||
env === 'stage' ? 'https://api.stage.manifold.co/v1' : 'https://api.manifold.co/v1', | ||
}), | ||
graphqlFetch: createGraphqlFetch({ | ||
@@ -26,0 +32,0 @@ element, |
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
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
755143
2.47%91
3.41%12109
2.96%