@qelos/plugin-play 2.0.23 → 2.0.24

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@qelos/plugin-play",
3
- "version": "2.0.23",
3
+ "version": "2.0.24",
4
4
  "description": "Play a plugin for Qelos",
5
5
  "main": "./dist/index.js",
6
6
  "scripts": {
package/src/app.ts CHANGED
@@ -89,8 +89,8 @@ function createApp(): FastifyInstance {
89
89
  playEndpoints();
90
90
  playFrontend();
91
91
 
92
- if (!(config.greenpressUrl || handlers.refreshToken.length)) {
93
- throw new Error('you must provide either a refresh token handler or Greenpress application credentials');
92
+ if (!(config.qelosUrl || handlers.refreshToken.length)) {
93
+ throw new Error('you must provide either a refresh token handler or Qelos application credentials');
94
94
  }
95
95
 
96
96
  return app;
@@ -63,7 +63,7 @@ export function getRefreshTokenRoute(): RouteOptions {
63
63
 
64
64
  const usersSdk = getSdk().users;
65
65
 
66
- if (config.greenpressUrl) {
66
+ if (config.qelosUrl) {
67
67
  onRefreshToken(async ({sub, identifier = ''}) => {
68
68
  const user = await usersSdk.getUser(sub);
69
69
  if (identifier.toString() !== user.internalMetadata?.tokenIdentifier) {
@@ -119,7 +119,7 @@ export function getRegisterRoute(): RouteOptions {
119
119
 
120
120
  const usersSdk = getSdk().users;
121
121
 
122
- if (config.greenpressUrl) {
122
+ if (config.qelosUrl) {
123
123
  onNewTenant(async ({email, password, appUrl}) => {
124
124
  const tenantSdk = getSdkForUrl(appUrl)
125
125
  const emailSplit = email.split('@');
@@ -201,7 +201,7 @@ export function getRegisterRoute(): RouteOptions {
201
201
  }
202
202
 
203
203
  export function getCallbackRoute(): RouteOptions {
204
- if (config.greenpressUrl) {
204
+ if (config.qelosUrl) {
205
205
  onCallback(async ({user, returnUrl}, request) => {
206
206
  const code = Math.floor(Math.random() * 1000).toString();
207
207
  // set the code on gp db
@@ -260,7 +260,7 @@ export function getCallbackRoute(): RouteOptions {
260
260
  }
261
261
 
262
262
  export function getFrontendAuthorizationRoute(): RouteOptions {
263
- if (config.greenpressUrl) {
263
+ if (config.qelosUrl) {
264
264
  onFrontendAuthorization(async ({returnUrl, user, tenant}, request) => {
265
265
  const draft = await getSdk().drafts.getDraft(returnUrl, `${tenant.sub}.${user.email}`);
266
266
  if (draft && draft.contextData) {
package/src/config.ts CHANGED
@@ -6,9 +6,9 @@ const config = {
6
6
  dev: process.env.NODE_ENV !== 'production',
7
7
  refreshTokenSecret: process.env.REFRESH_TOKEN_SECRET,
8
8
  accessTokenSecret: process.env.ACCESS_TOKEN_SECRET,
9
- greenpressUrl: process.env.GREENPRESS_URL,
10
- greenpressUsername: process.env.GREENPRESS_USERNAME,
11
- greenpressPassword: process.env.GREENPRESS_PASSWORD,
9
+ qelosUrl: process.env.QELOS_URL,
10
+ qelosUsername: process.env.QELOS_USERNAME,
11
+ qelosPassword: process.env.QELOS_PASSWORD,
12
12
  staticFrontend: {
13
13
  root: join(process.cwd(), process.env.STATIC_ROOT || 'public'),
14
14
  prefix: process.env.STATIC_PREFIX || '/',
package/src/sdk.ts CHANGED
@@ -8,10 +8,10 @@ let localSdk: QelosAdministratorSDK<{ tokenIdentifier: string }>;
8
8
 
9
9
  async function authenticate() {
10
10
  try {
11
- await localSdk.authentication.oAuthSignin({email: config.greenpressUsername, password: config.greenpressPassword});
12
- console.log('authenticated successfully to ' + config.greenpressUrl)
11
+ await localSdk.authentication.oAuthSignin({email: config.qelosUsername, password: config.qelosPassword});
12
+ console.log('authenticated successfully to ' + config.qelosUrl)
13
13
  } catch (err) {
14
- console.log('could not authenticate to own greenpress app');
14
+ console.log('could not authenticate to own qelos app');
15
15
  process.exit(1);
16
16
  }
17
17
  }
@@ -31,7 +31,7 @@ export function getSdk(): QelosAdministratorSDK {
31
31
  if (localSdk) {
32
32
  return localSdk;
33
33
  }
34
- localSdk = getSdkForUrl<{ tokenIdentifier: string }>(config.greenpressUrl);
34
+ localSdk = getSdkForUrl<{ tokenIdentifier: string }>(config.qelosUrl);
35
35
  authenticate();
36
36
  return localSdk;
37
37
  }