@live-change/session-service 0.9.194 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@live-change/session-service",
3
- "version": "0.9.194",
3
+ "version": "0.9.195",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -22,9 +22,9 @@
22
22
  },
23
23
  "type": "module",
24
24
  "dependencies": {
25
- "@live-change/framework": "^0.9.194",
26
- "@live-change/relations-plugin": "^0.9.194",
25
+ "@live-change/framework": "^0.9.195",
26
+ "@live-change/relations-plugin": "^0.9.195",
27
27
  "pluralize": "^8.0.0"
28
28
  },
29
- "gitHead": "40d47cf397b45ca1f1fa888d4d85727376b2b0c0"
29
+ "gitHead": "9f61eddae56ddd89aba20988b8e208d948728496"
30
30
  }
package/sessionItem.js CHANGED
@@ -75,7 +75,7 @@ definition.processor(function(service, app) {
75
75
  async execute(properties, { client, service }, emit) {
76
76
  const id = properties[modelPropertyName] || app.generateUid()
77
77
  const entity = await modelRuntime().get(id)
78
- if(entity) throw 'exists'
78
+ if(entity) throw app.logicError("exists")
79
79
  emit({
80
80
  type: eventName,
81
81
  [modelPropertyName]: id,
@@ -106,8 +106,8 @@ definition.processor(function(service, app) {
106
106
  waitForEvents: true,
107
107
  async execute(properties, { client, service }, emit) {
108
108
  const entity = await modelRuntime().get(properties[modelPropertyName])
109
- if(!entity) throw 'not_found'
110
- if(entity.session != client.session) throw 'not_authorized'
109
+ if(!entity) throw app.logicError("not_found")
110
+ if(entity.session != client.session) throw app.logicError("not_authorized")
111
111
  let updateObject = {}
112
112
  for(const propertyName of writeableProperties) {
113
113
  if(properties.hasOwnProperty(propertyName)) {
@@ -145,8 +145,8 @@ definition.processor(function(service, app) {
145
145
  waitForEvents: true,
146
146
  async execute(properties, { client, service }, emit) {
147
147
  const entity = await modelRuntime().get(properties[modelPropertyName])
148
- if(!entity) throw 'not_found'
149
- if(entity.session != client.session) throw 'not_authorized'
148
+ if(!entity) throw app.logicError("not_found")
149
+ if(entity.session != client.session) throw app.logicError("not_authorized")
150
150
  emit({
151
151
  type: eventName,
152
152
  [modelPropertyName]: entity.id,
@@ -103,7 +103,7 @@ definition.processor(function(service, app) {
103
103
  waitForEvents: true,
104
104
  async execute(properties, { client, service }, emit) {
105
105
  const entity = await modelRuntime().get(client.session)
106
- if(!entity) throw 'not_found'
106
+ if(!entity) throw app.logicError("not_found")
107
107
  let updateObject = {}
108
108
  for(const propertyName of writeableProperties) {
109
109
  if(properties.hasOwnProperty(propertyName)) {
@@ -135,7 +135,7 @@ definition.processor(function(service, app) {
135
135
  waitForEvents: true,
136
136
  async execute(properties, {client, service}, emit) {
137
137
  const entity = await modelRuntime().indexObjectGet('bySession', client.session)
138
- if (!entity) throw 'not_found'
138
+ if (!entity) throw app.logicError("not_found")
139
139
  emit({
140
140
  type: eventName,
141
141
  identifiers: {