@vendure-platform/console-auth 1.0.0-major.202609091053.0.0
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/README.md +335 -0
- package/dist/browser-auth.d.ts +48 -0
- package/dist/browser-auth.js +1 -0
- package/dist/console-api.d.ts +66 -0
- package/dist/console-api.js +1 -0
- package/dist/console-projects.d.ts +101 -0
- package/dist/console-projects.js +1 -0
- package/dist/credential-store.d.ts +99 -0
- package/dist/credential-store.js +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.js +1 -0
- package/dist/onboarding.d.ts +158 -0
- package/dist/onboarding.js +1 -0
- package/dist/origins.d.ts +23 -0
- package/dist/origins.js +1 -0
- package/dist/product-access.d.ts +48 -0
- package/dist/product-access.js +1 -0
- package/dist/project-link-manifest.d.ts +93 -0
- package/dist/project-link-manifest.js +1 -0
- package/dist/registry.d.ts +30 -0
- package/dist/registry.js +1 -0
- package/dist/session-lock.d.ts +49 -0
- package/dist/session-lock.js +1 -0
- package/dist/session.d.ts +38 -0
- package/dist/session.js +1 -0
- package/package.json +65 -0
package/dist/session.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.resolveStoredConsoleToken=t,exports.refreshStoredConsoleToken=s,exports.loginAndStoreConsoleToken=a;const e=require("./browser-auth"),o=require("./credential-store"),n=require("./origins"),r=require("./session-lock");function i(e,o,n){return{schemaVersion:2,origin:o,apiOrigin:n,accessToken:e.accessToken,expiresAt:e.expiresAt,...e.refreshToken?{refreshToken:e.refreshToken}:{}}}async function t(e={}){const n=h(e),i=await(0,o.readConsoleCredential)(n);if(i)return(0,o.isExpired)(i,u(e))?(0,r.withConsoleSessionLock)({home:e.home},async()=>{const r=await(0,o.readConsoleCredential)(n);if(r&&!(0,o.isExpired)(r,u(e)))return r.accessToken;try{return await c(e,n,r)}catch{return}}):i.accessToken}async function s(e={}){const n=h(e);return(0,r.withConsoleSessionLock)({home:e.home},async()=>c(e,n,await(0,o.readConsoleCredential)(n)))}async function a(n){const{origin:t,apiOrigin:s}=h(n),a=await(0,e.loginWithBrowser)({client:n.client,appOrigin:t,apiOrigin:s,fetch:n.fetch,openBrowser:n.openBrowser,reportAuthorizationUrl:n.reportAuthorizationUrl,signal:n.signal,timeoutMs:n.timeoutMs,now:n.now});return await(0,r.withConsoleSessionLock)({home:n.home},()=>(0,o.writeConsoleCredential)(i(a,t,s),{home:n.home})),a.accessToken}async function c(n,r,t){for(let s=0;;s++){if(!(null==t?void 0:t.refreshToken))throw new Error("The stored Vendure Console credential cannot be refreshed. Log in again.");const a=t.refreshToken;try{const t=await(0,e.refreshSession)(a,{apiOrigin:r.apiOrigin,fetch:n.fetch,now:n.now});return await(0,o.writeConsoleCredential)(i(t,r.origin,r.apiOrigin),{home:n.home}),t.accessToken}catch(e){if(s>0||!l(e))throw e;if((null==(t=await(0,o.readConsoleCredential)(r))?void 0:t.refreshToken)&&t.refreshToken!==a){if(!(0,o.isExpired)(t,u(n)))return t.accessToken;continue}throw await(0,o.discardConsoleCredential)({home:n.home}),e}}}function l(o){return o instanceof e.ConsoleTokenGrantError&&o.refused}function h(e){const{appOrigin:o,apiOrigin:r}=(0,n.consoleOrigins)(e);return{home:e.home,origin:o,apiOrigin:r}}function u(e){var o,n;return null!==(n=null===(o=e.now)||void 0===o?void 0:o.call(e))&&void 0!==n?n:new Date}
|
package/package.json
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@vendure-platform/console-auth",
|
|
3
|
+
"version": "1.0.0-major.202609091053.0.0",
|
|
4
|
+
"description": "Browser login against Vendure Console and the user-level credential store shared by @vendure-platform/create and @vendure-platform/cli",
|
|
5
|
+
"vendurePlugin": {
|
|
6
|
+
"slug": "console-auth",
|
|
7
|
+
"name": "Console Auth",
|
|
8
|
+
"tagline": "Browser login against Vendure Console, and the credential store that keeps the result.",
|
|
9
|
+
"description": "One login flow shared by @vendure-platform/create and @vendure-platform/cli, with a user-level credential store, rather than one flow per tool. Public and MIT, because create runs under npx for people who hold no registry token.",
|
|
10
|
+
"category": "tooling",
|
|
11
|
+
"requiredCapabilities": [],
|
|
12
|
+
"docsPath": "getting-started/registry-access",
|
|
13
|
+
"pluginClasses": [],
|
|
14
|
+
"kind": "tooling"
|
|
15
|
+
},
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "https://github.com/vendurehq/vendure-platform.git",
|
|
20
|
+
"directory": "libs/console-auth"
|
|
21
|
+
},
|
|
22
|
+
"type": "commonjs",
|
|
23
|
+
"main": "./dist/index.js",
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"exports": {
|
|
26
|
+
"./package.json": "./package.json",
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./origins": {
|
|
33
|
+
"types": "./dist/origins.d.ts",
|
|
34
|
+
"import": "./dist/origins.js",
|
|
35
|
+
"default": "./dist/origins.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"files": [
|
|
39
|
+
"CHANGELOG.md",
|
|
40
|
+
"README.md",
|
|
41
|
+
"dist/**/*",
|
|
42
|
+
"!**/*.map",
|
|
43
|
+
"!**/*.tsbuildinfo",
|
|
44
|
+
"!**/*.spec.*",
|
|
45
|
+
"!**/*.test.*"
|
|
46
|
+
],
|
|
47
|
+
"engines": {
|
|
48
|
+
"node": ">=22"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public"
|
|
52
|
+
},
|
|
53
|
+
"dependencies": {
|
|
54
|
+
"tslib": "^2.3.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"vite-node": "^3.2.4",
|
|
58
|
+
"vitest": "^3.2.4"
|
|
59
|
+
},
|
|
60
|
+
"nx": {
|
|
61
|
+
"tags": [
|
|
62
|
+
"scope:utility"
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
}
|