@travetto/model-redis 5.0.17 → 5.0.18

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/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2023 ArcSine Technologies
3
+ Copyright (c) 2020 ArcSine Technologies
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/model-redis",
3
- "version": "5.0.17",
3
+ "version": "5.0.18",
4
4
  "description": "Redis backing for the travetto model module.",
5
5
  "keywords": [
6
6
  "typescript",
@@ -25,9 +25,9 @@
25
25
  "directory": "module/model-redis"
26
26
  },
27
27
  "dependencies": {
28
- "@travetto/cli": "^5.0.16",
29
- "@travetto/config": "^5.0.13",
30
- "@travetto/model": "^5.0.14",
28
+ "@travetto/cli": "^5.0.17",
29
+ "@travetto/config": "^5.0.14",
30
+ "@travetto/model": "^5.0.15",
31
31
  "redis": "^4.7.0"
32
32
  },
33
33
  "travetto": {
package/src/service.ts CHANGED
@@ -187,11 +187,11 @@ export class RedisModelService implements ModelCrudSupport, ModelExpirySupport,
187
187
  }
188
188
  }
189
189
 
190
- async has<T extends ModelType>(cls: Class<T>, id: string, error?: 'notfound' | 'data'): Promise<void> {
190
+ async has<T extends ModelType>(cls: Class<T>, id: string, error?: 'notfound' | 'exists'): Promise<void> {
191
191
  const res = await this.client.exists(this.#resolveKey(cls, id));
192
192
  if (res === 0 && error === 'notfound') {
193
193
  throw new NotFoundError(cls, id);
194
- } else if (res === 1 && error === 'data') {
194
+ } else if (res === 1 && error === 'exists') {
195
195
  throw new ExistsError(cls, id);
196
196
  }
197
197
  }
@@ -209,7 +209,7 @@ export class RedisModelService implements ModelCrudSupport, ModelExpirySupport,
209
209
 
210
210
  async create<T extends ModelType>(cls: Class<T>, item: OptionalId<T>): Promise<T> {
211
211
  if (item.id) {
212
- await this.has(cls, item.id, 'data');
212
+ await this.has(cls, item.id, 'exists');
213
213
  }
214
214
  const prepped = await ModelCrudUtil.preStore(cls, item, this);
215
215
  await this.#store(cls, prepped, 'write');
@@ -1,6 +1,6 @@
1
1
  import type { ServiceDescriptor } from '@travetto/cli';
2
2
 
3
- const version = process.env.REDIS_VERSION || '7.2';
3
+ const version = process.env.REDIS_VERSION || '7.4';
4
4
 
5
5
  export const service: ServiceDescriptor = {
6
6
  name: 'redis',