@live-change/linkedin-authentication-service 0.9.193 → 0.9.195

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/connect.js CHANGED
@@ -45,9 +45,9 @@ definition.trigger({
45
45
  await downloadData(user, data, context)
46
46
  return
47
47
  }
48
- throw 'alreadyConnectedElsewhere'
48
+ throw app.logicError("alreadyConnectedElsewhere")
49
49
  }
50
- throw 'alreadyConnected'
50
+ throw app.logicError("alreadyConnected")
51
51
  }
52
52
  emit({
53
53
  type: 'accountConnected',
@@ -70,7 +70,7 @@ definition.trigger({
70
70
  },
71
71
  async execute({ account }, { client, service }, emit) {
72
72
  const accountData = await Account.get(account)
73
- if(!accountData) throw 'notFound'
73
+ if(!accountData) throw app.logicError("notFound")
74
74
  const { user } = accountData
75
75
  emit({
76
76
  type: 'accountDisconnected',
@@ -101,7 +101,7 @@ definition.action({
101
101
  },
102
102
  async execute({ code, redirectUri, transferOwnership }, { client, service }, emit) {
103
103
  const user = client.user
104
- if(!user) throw 'notAuthorized'
104
+ if(!user) throw app.logicError("notAuthorized")
105
105
  const tokens = await getTokensWithCode(code, redirectUri)
106
106
  debug("TOKENS", tokens)
107
107
 
@@ -139,9 +139,9 @@ definition.action({
139
139
  },
140
140
  async execute({ account }, { client, service }, emit) {
141
141
  const accountData = await Account.get(account)
142
- if(!accountData) throw 'notFound'
142
+ if(!accountData) throw app.logicError("notFound")
143
143
  const { user } = accountData
144
- if(user !== client.user) throw 'notAuthorized'
144
+ if(user !== client.user) throw app.logicError("notAuthorized")
145
145
  await service.trigger({ type: 'disconnectLinkedin' }, {
146
146
  user, account
147
147
  })
package/offlineAccess.js CHANGED
@@ -130,7 +130,7 @@ definition.action({
130
130
  },
131
131
  async execute({ code, redirectUri, scope }, { client, service }, emit) {
132
132
  const user = client.user
133
- if(!user) throw 'notAuthorized'
133
+ if(!user) throw app.logicError("notAuthorized")
134
134
  const tokens = await getTokensWithCode(code, redirectUri)
135
135
  console.log("TOKENS", tokens)
136
136
  const scopes = tokens.scope.split(' ')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/linkedin-authentication-service",
3
- "version": "0.9.193",
3
+ "version": "0.9.195",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -21,9 +21,9 @@
21
21
  "url": "https://www.viamage.com/"
22
22
  },
23
23
  "dependencies": {
24
- "@live-change/framework": "^0.9.193",
25
- "@live-change/relations-plugin": "^0.9.193"
24
+ "@live-change/framework": "^0.9.195",
25
+ "@live-change/relations-plugin": "^0.9.195"
26
26
  },
27
- "gitHead": "8a7627bed2cb66684e7169ddb3998191612e57a9",
27
+ "gitHead": "9f61eddae56ddd89aba20988b8e208d948728496",
28
28
  "type": "module"
29
29
  }
package/sign.js CHANGED
@@ -61,7 +61,7 @@ definition.action({
61
61
  user
62
62
  }
63
63
  } else { // Sign up
64
- throw 'notFound'
64
+ throw app.logicError("notFound")
65
65
  }
66
66
  }
67
67
  })
@@ -92,7 +92,7 @@ definition.action({
92
92
  const existingLogin = await Account.get(account)
93
93
  const { session } = client
94
94
  if(existingLogin) { /// Sign In
95
- throw 'alreadyConnected'
95
+ throw app.logicError("alreadyConnected")
96
96
  } else { // Sign up
97
97
  const user = app.generateUid()
98
98
  await service.trigger({ type: 'connectLinkedin' }, {