@manifoldco/manifold-init
Advanced tools
Comparing version 0.5.0 to 0.6.0
@@ -6,3 +6,3 @@ 'use strict'; | ||
const index = require('./index-1ab6c73d.js'); | ||
const core = require('./core-6686f12f.js'); | ||
const core = require('./core-35006c51.js'); | ||
@@ -44,3 +44,3 @@ const ConnectedButton = class { | ||
version: 0, | ||
componentVersion: '0.5.0', | ||
componentVersion: '0.6.0', | ||
}); | ||
@@ -47,0 +47,0 @@ } |
@@ -5,3 +5,3 @@ 'use strict'; | ||
const core = require('./core-6686f12f.js'); | ||
const core = require('./core-35006c51.js'); | ||
@@ -8,0 +8,0 @@ |
@@ -6,11 +6,6 @@ import { ManifoldError, ErrorType } from './ManifoldError'; | ||
export function createGateway({ baseUrl = () => 'https://api.manifold.co/graphql', retries = 3, }) { | ||
async function post(path, body, attempts) { | ||
const options = { | ||
method: 'POST', | ||
body: JSON.stringify(body), | ||
headers: { | ||
Connection: 'keep-alive', | ||
'Content-type': 'application/json', | ||
}, | ||
}; | ||
async function post(path, body, attempts, init) { | ||
const opts = init || {}; | ||
const headers = opts.headers || {}; | ||
const options = Object.assign(Object.assign({}, opts), { method: 'POST', body: JSON.stringify(body), headers: Object.assign(Object.assign({}, headers), { Connection: 'keep-alive', 'Content-type': 'application/json' }) }); | ||
const canRetry = attempts < retries; | ||
@@ -24,3 +19,3 @@ let resp; | ||
await wait(attempts ** 2 * 1000); | ||
return post(path, body, attempts + 1); | ||
return post(path, body, attempts + 1, init); | ||
} | ||
@@ -41,3 +36,3 @@ } | ||
await wait(attempts ** 2 * 1000); | ||
return post(path, body, attempts + 1); | ||
return post(path, body, attempts + 1, init); | ||
} | ||
@@ -48,3 +43,3 @@ return Promise.reject(new ManifoldError({ type: ErrorType.ServerError, message: resp.statusText })); | ||
} | ||
return { post: (path, body) => post(path, body, 0) }; | ||
return { post: (path, body, init) => post(path, body, 0, init) }; | ||
} |
@@ -38,3 +38,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
import { r as registerInstance, h, g as getElement, c as createEvent } from './index-19d1abb4.js'; | ||
import { i as initialize } from './core-f5dfd467.js'; | ||
import { i as initialize } from './core-36c0b795.js'; | ||
var ConnectedButton = /** @class */ (function () { | ||
@@ -116,3 +116,3 @@ function class_1(hostRef) { | ||
version: 0, | ||
componentVersion: '0.5.0', | ||
componentVersion: '0.6.0', | ||
})]; | ||
@@ -119,0 +119,0 @@ case 2: |
import { r as registerInstance, h, g as getElement, c as createEvent } from './index-19d1abb4.js'; | ||
import { i as initialize } from './core-f5dfd467.js'; | ||
import { i as initialize } from './core-36c0b795.js'; | ||
@@ -39,3 +39,3 @@ const ConnectedButton = class { | ||
version: 0, | ||
componentVersion: '0.5.0', | ||
componentVersion: '0.6.0', | ||
}); | ||
@@ -42,0 +42,0 @@ } |
@@ -1,1 +0,1 @@ | ||
export{i as initialize}from"./p-306f33b9.js"; | ||
export{i as initialize}from"./p-c5d0562b.js"; |
@@ -1,1 +0,1 @@ | ||
import{p as t,b as e}from"./p-17fe885f.js";t().then(t=>e([["p-8db00d8d",[[0,"connected-button",{success:[32],badRequest:[32],unauthenticated:[32],planCost:[32]}],[0,"manifold-init",{env:[1],authToken:[1025,"auth-token"],authType:[1,"auth-type"],clientId:[1,"client-id"],initialize:[64]}]]]],t)); | ||
import{p as t,b as e}from"./p-17fe885f.js";t().then(t=>e([["p-a31365c8",[[0,"connected-button",{success:[32],badRequest:[32],unauthenticated:[32],planCost:[32]}],[0,"manifold-init",{env:[1],authToken:[1025,"auth-token"],authType:[1,"auth-type"],clientId:[1,"client-id"],initialize:[64]}]]]],t)); |
@@ -1,1 +0,1 @@ | ||
System.register(["./p-c182383c.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-8dc974e1.system",[[0,"connected-button",{success:[32],badRequest:[32],unauthenticated:[32],planCost:[32]}],[0,"manifold-init",{env:[1],authToken:[1025,"auth-token"],authType:[1,"auth-type"],clientId:[1,"client-id"],initialize:[64]}]]]],t)}))}}})); | ||
System.register(["./p-c182383c.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-c9143152.system",[[0,"connected-button",{success:[32],badRequest:[32],unauthenticated:[32],planCost:[32]}],[0,"manifold-init",{env:[1],authToken:[1025,"auth-token"],authType:[1,"auth-type"],clientId:[1,"client-id"],initialize:[64]}]]]],t)}))}}})); |
@@ -18,3 +18,3 @@ { | ||
], | ||
"version": "0.5.0", | ||
"version": "0.6.0", | ||
"description": "Manifold UI Initialization", | ||
@@ -21,0 +21,0 @@ "main": "dist/index.js", |
@@ -15,7 +15,16 @@ import { ManifoldError, ErrorType } from './ManifoldError'; | ||
}): Gateway { | ||
async function post<Req extends {}, Resp>(path: string, body: Req, attempts: number) { | ||
async function post<Req extends {}, Resp>( | ||
path: string, | ||
body: Req, | ||
attempts: number, | ||
init?: RequestInit | ||
) { | ||
const opts = init || {}; | ||
const headers = opts.headers || {}; | ||
const options: RequestInit = { | ||
...opts, | ||
method: 'POST', | ||
body: JSON.stringify(body), | ||
headers: { | ||
...headers, | ||
Connection: 'keep-alive', | ||
@@ -34,3 +43,3 @@ 'Content-type': 'application/json', | ||
await wait(attempts ** 2 * 1000); | ||
return post(path, body, attempts + 1); | ||
return post(path, body, attempts + 1, init); | ||
} | ||
@@ -58,3 +67,3 @@ } | ||
await wait(attempts ** 2 * 1000); | ||
return post(path, body, attempts + 1); | ||
return post(path, body, attempts + 1, init); | ||
} | ||
@@ -69,3 +78,3 @@ return Promise.reject( | ||
return { post: <Req>(path: string, body: Req) => post(path, body, 0) }; | ||
return { post: <Req>(path: string, body: Req, init?: RequestInit) => post(path, body, 0, init) }; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
760450
28
10204