New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@plasmicapp/auth-api

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@plasmicapp/auth-api - npm Package Compare versions

Comparing version 0.0.6 to 0.0.8

25

dist/auth-api.cjs.development.js

@@ -341,6 +341,8 @@ 'use strict';

var _getPlasmicAppUserFromToken, _getPlasmicAppUser, _createPlasmicAppUser;
var PLASMIC_HOST = 'https://data.plasmic.app';
function getPlasmicAppUserFromToken(_x) {
return (_getPlasmicAppUserFromToken = _getPlasmicAppUserFromToken || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(opts) {
return _getPlasmicAppUserFromToken.apply(this, arguments);
}
function _getPlasmicAppUserFromToken() {
_getPlasmicAppUserFromToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(opts) {
var host, token, url, result, user;

@@ -383,6 +385,10 @@ return _regeneratorRuntime().wrap(function _callee$(_context) {

}, _callee);
}))).apply(this, arguments);
}));
return _getPlasmicAppUserFromToken.apply(this, arguments);
}
function getPlasmicAppUser(_x2) {
return (_getPlasmicAppUser = _getPlasmicAppUser || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(opts) {
return _getPlasmicAppUser.apply(this, arguments);
}
function _getPlasmicAppUser() {
_getPlasmicAppUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(opts) {
var host, appId, codeVerifier, code, requestParams, url, result, _yield$result$json, token, user, error;

@@ -429,6 +435,10 @@ return _regeneratorRuntime().wrap(function _callee2$(_context2) {

}, _callee2);
}))).apply(this, arguments);
}));
return _getPlasmicAppUser.apply(this, arguments);
}
function createPlasmicAppUser(_x3) {
return (_createPlasmicAppUser = _createPlasmicAppUser || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(opts) {
return _createPlasmicAppUser.apply(this, arguments);
}
function _createPlasmicAppUser() {
_createPlasmicAppUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(opts) {
var host, appSecret, email, url, result, _yield$result$json2, user, token, error;

@@ -479,3 +489,4 @@ return _regeneratorRuntime().wrap(function _callee3$(_context3) {

}, _callee3);
}))).apply(this, arguments);
}));
return _createPlasmicAppUser.apply(this, arguments);
}

@@ -482,0 +493,0 @@

@@ -1,2 +0,2 @@

"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,r,e,n,o=(t=require("@plasmicapp/isomorphic-unfetch"))&&"object"==typeof t&&"default"in t?t.default:t;function a(){a=function(){return r};var t,r={},e=Object.prototype,n=e.hasOwnProperty,o=Object.defineProperty||function(t,r,e){t[r]=e.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function f(t,r,e,n){var a=Object.create((r&&r.prototype instanceof g?r:g).prototype),i=new N(n||[]);return o(a,"_invoke",{value:j(t,e,i)}),a}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=f;var p="suspendedStart",v="executing",y="completed",d={};function g(){}function m(){}function w(){}var x={};l(x,u,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(T([])));L&&L!==e&&n.call(L,u)&&(x=L);var k=w.prototype=g.prototype=Object.create(x);function E(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function _(t,r){function e(o,a,i,u){var c=h(t[o],t,a);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&n.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,i,u)}),(function(t){e("throw",t,i,u)})):r.resolve(l).then((function(t){s.value=t,i(s)}),(function(t){return e("throw",t,i,u)}))}u(c.arg)}var a;o(this,"_invoke",{value:function(t,n){function o(){return new r((function(r,o){e(t,n,r,o)}))}return a=a?a.then(o,o):o()}})}function j(r,e,n){var o=p;return function(a,i){if(o===v)throw new Error("Generator is already running");if(o===y){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=O(u,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=v;var s=h(r,e,n);if("normal"===s.type){if(o=n.done?y:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=y,n.method="throw",n.arg=s.arg)}}}function O(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,O(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var a=h(o,r.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,d;var i=a.arg;return i?i.done?(e[r.resultName]=i.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function P(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function S(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function T(r){if(r||""===r){var e=r[u];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var o=-1,a=function e(){for(;++o<r.length;)if(n.call(r,o))return e.value=r[o],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(typeof r+" is not iterable")}return m.prototype=w,o(k,"constructor",{value:w,configurable:!0}),o(w,"constructor",{value:m,configurable:!0}),m.displayName=l(w,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===m||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,s,"GeneratorFunction")),t.prototype=Object.create(k),t},r.awrap=function(t){return{__await:t}},E(_.prototype),l(_.prototype,c,(function(){return this})),r.AsyncIterator=_,r.async=function(t,e,n,o,a){void 0===a&&(a=Promise);var i=new _(f(t,e,n,o),a);return r.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},E(k),l(k,s,"Generator"),l(k,u,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=T,N.prototype={constructor:N,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!r)for(var e in this)"t"===e.charAt(0)&&n.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function o(n,o){return u.type="throw",u.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return o("end");if(i.tryLoc<=this.prev){var c=n.call(i,"catchLoc"),s=n.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return o(i.catchLoc,!0);if(this.prev<i.finallyLoc)return o(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return o(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return o(i.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=r,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),S(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;S(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:T(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),d}},r}function i(t,r,e,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function u(t){return function(){var r=this,e=arguments;return new Promise((function(n,o){var a=t.apply(r,e);function u(t){i(a,n,o,u,c,"next",t)}function c(t){i(a,n,o,u,c,"throw",t)}u(void 0)}))}}var c="https://data.plasmic.app";exports.createPlasmicAppUser=function(t){return(n=n||u(a().mark((function t(r){var e,n,i,u,s,l,f,h;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=r.appSecret,n=r.email,i=(r.host||c)+"/api/v1/app-auth/user",t.next=4,o(i,{method:"POST",headers:{"Content-Type":"application/json","x-plasmic-app-auth-api-token":e},body:JSON.stringify({email:n})});case 4:return u=t.sent,t.next=7,u.json();case 7:if(l=(s=t.sent).user,f=s.token,h=s.error,!(u.status>=400||h)){t.next=13;break}return t.abrupt("return",{user:null,token:null,error:null!=h?h:new Error("Internal error")});case 13:return t.abrupt("return",{user:l,token:f});case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)},exports.getPlasmicAppUser=function(t){return(e=e||u(a().mark((function t(r){var e,n,i,u,s,l,f,h,p,v,y;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=r.host,n=r.appId,i=r.codeVerifier,u=r.code,(s=new URLSearchParams).set("grant_type","authorization_code"),s.set("code",u),s.set("code_verifier",i),s.set("client_id",n),l=(e||c)+"/api/v1/app-auth/token?"+s.toString(),t.next=9,o(l);case 9:return f=t.sent,t.next=12,f.json();case 12:if(p=(h=t.sent).token,v=h.user,y=h.error,!(f.status>=400||y)){t.next=18;break}return t.abrupt("return",{user:null,token:null,error:null!=y?y:new Error("Internal error")});case 18:return t.abrupt("return",{user:v,token:p});case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)},exports.getPlasmicAppUserFromToken=function(t){return(r=r||u(a().mark((function t(r){var e,n,i,u;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=r.token,n=(r.host||c)+"/api/v1/app-auth/userinfo",t.next=4,o(n,{headers:{"x-plasmic-data-user-auth-token":e}});case 4:return i=t.sent,t.next=7,i.json();case 7:if(u=t.sent,!(i.status>=400)){t.next=10;break}return t.abrupt("return",{user:null,token:null,error:new Error("Invalid token")});case 10:return t.abrupt("return",{user:u,token:e});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)};
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t,r=(t=require("@plasmicapp/isomorphic-unfetch"))&&"object"==typeof t&&"default"in t?t.default:t;function e(){e=function(){return r};var t,r={},n=Object.prototype,o=n.hasOwnProperty,a=Object.defineProperty||function(t,r,e){t[r]=e.value},i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",s=i.toStringTag||"@@toStringTag";function l(t,r,e){return Object.defineProperty(t,r,{value:e,enumerable:!0,configurable:!0,writable:!0}),t[r]}try{l({},"")}catch(t){l=function(t,r,e){return t[r]=e}}function f(t,r,e,n){var o=Object.create((r&&r.prototype instanceof g?r:g).prototype),i=new N(n||[]);return a(o,"_invoke",{value:j(t,e,i)}),o}function h(t,r,e){try{return{type:"normal",arg:t.call(r,e)}}catch(t){return{type:"throw",arg:t}}}r.wrap=f;var p="suspendedStart",y="executing",v="completed",d={};function g(){}function m(){}function w(){}var x={};l(x,u,(function(){return this}));var b=Object.getPrototypeOf,L=b&&b(b(T([])));L&&L!==n&&o.call(L,u)&&(x=L);var k=w.prototype=g.prototype=Object.create(x);function E(t){["next","throw","return"].forEach((function(r){l(t,r,(function(t){return this._invoke(r,t)}))}))}function _(t,r){function e(n,a,i,u){var c=h(t[n],t,a);if("throw"!==c.type){var s=c.arg,l=s.value;return l&&"object"==typeof l&&o.call(l,"__await")?r.resolve(l.__await).then((function(t){e("next",t,i,u)}),(function(t){e("throw",t,i,u)})):r.resolve(l).then((function(t){s.value=t,i(s)}),(function(t){return e("throw",t,i,u)}))}u(c.arg)}var n;a(this,"_invoke",{value:function(t,o){function a(){return new r((function(r,n){e(t,o,r,n)}))}return n=n?n.then(a,a):a()}})}function j(r,e,n){var o=p;return function(a,i){if(o===y)throw new Error("Generator is already running");if(o===v){if("throw"===a)throw i;return{value:t,done:!0}}for(n.method=a,n.arg=i;;){var u=n.delegate;if(u){var c=O(u,n);if(c){if(c===d)continue;return c}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===p)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=h(r,e,n);if("normal"===s.type){if(o=n.done?v:"suspendedYield",s.arg===d)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=v,n.method="throw",n.arg=s.arg)}}}function O(r,e){var n=e.method,o=r.iterator[n];if(o===t)return e.delegate=null,"throw"===n&&r.iterator.return&&(e.method="return",e.arg=t,O(r,e),"throw"===e.method)||"return"!==n&&(e.method="throw",e.arg=new TypeError("The iterator does not provide a '"+n+"' method")),d;var a=h(o,r.iterator,e.arg);if("throw"===a.type)return e.method="throw",e.arg=a.arg,e.delegate=null,d;var i=a.arg;return i?i.done?(e[r.resultName]=i.value,e.next=r.nextLoc,"return"!==e.method&&(e.method="next",e.arg=t),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function P(t){var r={tryLoc:t[0]};1 in t&&(r.catchLoc=t[1]),2 in t&&(r.finallyLoc=t[2],r.afterLoc=t[3]),this.tryEntries.push(r)}function S(t){var r=t.completion||{};r.type="normal",delete r.arg,t.completion=r}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(P,this),this.reset(!0)}function T(r){if(r||""===r){var e=r[u];if(e)return e.call(r);if("function"==typeof r.next)return r;if(!isNaN(r.length)){var n=-1,a=function e(){for(;++n<r.length;)if(o.call(r,n))return e.value=r[n],e.done=!1,e;return e.value=t,e.done=!0,e};return a.next=a}}throw new TypeError(typeof r+" is not iterable")}return m.prototype=w,a(k,"constructor",{value:w,configurable:!0}),a(w,"constructor",{value:m,configurable:!0}),m.displayName=l(w,s,"GeneratorFunction"),r.isGeneratorFunction=function(t){var r="function"==typeof t&&t.constructor;return!!r&&(r===m||"GeneratorFunction"===(r.displayName||r.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,w):(t.__proto__=w,l(t,s,"GeneratorFunction")),t.prototype=Object.create(k),t},r.awrap=function(t){return{__await:t}},E(_.prototype),l(_.prototype,c,(function(){return this})),r.AsyncIterator=_,r.async=function(t,e,n,o,a){void 0===a&&(a=Promise);var i=new _(f(t,e,n,o),a);return r.isGeneratorFunction(e)?i:i.next().then((function(t){return t.done?t.value:i.next()}))},E(k),l(k,s,"Generator"),l(k,u,(function(){return this})),l(k,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var r=Object(t),e=[];for(var n in r)e.push(n);return e.reverse(),function t(){for(;e.length;){var n=e.pop();if(n in r)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=T,N.prototype={constructor:N,reset:function(r){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(S),!r)for(var e in this)"t"===e.charAt(0)&&o.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(r){if(this.done)throw r;var e=this;function n(n,o){return u.type="throw",u.arg=r,e.next=n,o&&(e.method="next",e.arg=t),!!o}for(var a=this.tryEntries.length-1;a>=0;--a){var i=this.tryEntries[a],u=i.completion;if("root"===i.tryLoc)return n("end");if(i.tryLoc<=this.prev){var c=o.call(i,"catchLoc"),s=o.call(i,"finallyLoc");if(c&&s){if(this.prev<i.catchLoc)return n(i.catchLoc,!0);if(this.prev<i.finallyLoc)return n(i.finallyLoc)}else if(c){if(this.prev<i.catchLoc)return n(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return n(i.finallyLoc)}}}},abrupt:function(t,r){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var a=n;break}}a&&("break"===t||"continue"===t)&&a.tryLoc<=r&&r<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=t,i.arg=r,a?(this.method="next",this.next=a.finallyLoc,d):this.complete(i)},complete:function(t,r){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&r&&(this.next=r),d},finish:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),S(e),d}},catch:function(t){for(var r=this.tryEntries.length-1;r>=0;--r){var e=this.tryEntries[r];if(e.tryLoc===t){var n=e.completion;if("throw"===n.type){var o=n.arg;S(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(r,e,n){return this.delegate={iterator:T(r),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=t),d}},r}function n(t,r,e,n,o,a,i){try{var u=t[a](i),c=u.value}catch(t){return void e(t)}u.done?r(c):Promise.resolve(c).then(n,o)}function o(t){return function(){var r=this,e=arguments;return new Promise((function(o,a){var i=t.apply(r,e);function u(t){n(i,o,a,u,c,"next",t)}function c(t){n(i,o,a,u,c,"throw",t)}u(void 0)}))}}var a="https://data.plasmic.app";function i(){return(i=o(e().mark((function t(n){var o,i,u,c;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=n.token,i=(n.host||a)+"/api/v1/app-auth/userinfo",t.next=4,r(i,{headers:{"x-plasmic-data-user-auth-token":o}});case 4:return u=t.sent,t.next=7,u.json();case 7:if(c=t.sent,!(u.status>=400)){t.next=10;break}return t.abrupt("return",{user:null,token:null,error:new Error("Invalid token")});case 10:return t.abrupt("return",{user:c,token:o});case 11:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function u(){return(u=o(e().mark((function t(n){var o,i,u,c,s,l,f,h,p,y,v;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=n.host,i=n.appId,u=n.codeVerifier,c=n.code,(s=new URLSearchParams).set("grant_type","authorization_code"),s.set("code",c),s.set("code_verifier",u),s.set("client_id",i),l=(o||a)+"/api/v1/app-auth/token?"+s.toString(),t.next=9,r(l);case 9:return f=t.sent,t.next=12,f.json();case 12:if(p=(h=t.sent).token,y=h.user,v=h.error,!(f.status>=400||v)){t.next=18;break}return t.abrupt("return",{user:null,token:null,error:null!=v?v:new Error("Internal error")});case 18:return t.abrupt("return",{user:y,token:p});case 19:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function c(){return(c=o(e().mark((function t(n){var o,i,u,c,s,l,f,h;return e().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=n.appSecret,i=n.email,u=(n.host||a)+"/api/v1/app-auth/user",t.next=4,r(u,{method:"POST",headers:{"Content-Type":"application/json","x-plasmic-app-auth-api-token":o},body:JSON.stringify({email:i})});case 4:return c=t.sent,t.next=7,c.json();case 7:if(l=(s=t.sent).user,f=s.token,h=s.error,!(c.status>=400||h)){t.next=13;break}return t.abrupt("return",{user:null,token:null,error:null!=h?h:new Error("Internal error")});case 13:return t.abrupt("return",{user:l,token:f});case 14:case"end":return t.stop()}}),t)})))).apply(this,arguments)}exports.createPlasmicAppUser=function(t){return c.apply(this,arguments)},exports.getPlasmicAppUser=function(t){return u.apply(this,arguments)},exports.getPlasmicAppUserFromToken=function(t){return i.apply(this,arguments)};
//# sourceMappingURL=auth-api.cjs.production.min.js.map

@@ -335,6 +335,8 @@ import fetch from '@plasmicapp/isomorphic-unfetch';

var _getPlasmicAppUserFromToken, _getPlasmicAppUser, _createPlasmicAppUser;
var PLASMIC_HOST = 'https://data.plasmic.app';
function getPlasmicAppUserFromToken(_x) {
return (_getPlasmicAppUserFromToken = _getPlasmicAppUserFromToken || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(opts) {
return _getPlasmicAppUserFromToken.apply(this, arguments);
}
function _getPlasmicAppUserFromToken() {
_getPlasmicAppUserFromToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(opts) {
var host, token, url, result, user;

@@ -377,6 +379,10 @@ return _regeneratorRuntime().wrap(function _callee$(_context) {

}, _callee);
}))).apply(this, arguments);
}));
return _getPlasmicAppUserFromToken.apply(this, arguments);
}
function getPlasmicAppUser(_x2) {
return (_getPlasmicAppUser = _getPlasmicAppUser || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(opts) {
return _getPlasmicAppUser.apply(this, arguments);
}
function _getPlasmicAppUser() {
_getPlasmicAppUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(opts) {
var host, appId, codeVerifier, code, requestParams, url, result, _yield$result$json, token, user, error;

@@ -423,6 +429,10 @@ return _regeneratorRuntime().wrap(function _callee2$(_context2) {

}, _callee2);
}))).apply(this, arguments);
}));
return _getPlasmicAppUser.apply(this, arguments);
}
function createPlasmicAppUser(_x3) {
return (_createPlasmicAppUser = _createPlasmicAppUser || _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(opts) {
return _createPlasmicAppUser.apply(this, arguments);
}
function _createPlasmicAppUser() {
_createPlasmicAppUser = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(opts) {
var host, appSecret, email, url, result, _yield$result$json2, user, token, error;

@@ -473,3 +483,4 @@ return _regeneratorRuntime().wrap(function _callee3$(_context3) {

}, _callee3);
}))).apply(this, arguments);
}));
return _createPlasmicAppUser.apply(this, arguments);
}

@@ -476,0 +487,0 @@

{
"version": "0.0.6",
"version": "0.0.8",
"license": "MIT",

@@ -59,3 +59,3 @@ "main": "dist/index.js",

},
"gitHead": "dbe6519e32e754c106a17535505bd1ae7cff082d"
"gitHead": "388b5829f67de3782fe8afdad0d153b5c6d0aac0"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc