@sdflc/backend-helpers 1.0.38 → 1.0.39

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.
@@ -155,9 +155,9 @@ var BaseGateway = /** @class */ (function () {
155
155
  };
156
156
  BaseGateway.prototype.transformOnCreate = function (args) {
157
157
  return __awaiter(this, void 0, void 0, function () {
158
- var _a, hasCreatedAt, hasCreatedBy, hasSpace, hasVersion;
158
+ var _a, hasCreatedAt, hasCreatedBy, hasSpace, hasVersion, hasLang, localizationForField;
159
159
  return __generator(this, function (_b) {
160
- _a = this.config, hasCreatedAt = _a.hasCreatedAt, hasCreatedBy = _a.hasCreatedBy, hasSpace = _a.hasSpace, hasVersion = _a.hasVersion;
160
+ _a = this.config, hasCreatedAt = _a.hasCreatedAt, hasCreatedBy = _a.hasCreatedBy, hasSpace = _a.hasSpace, hasVersion = _a.hasVersion, hasLang = _a.hasLang, localizationForField = _a.localizationForField;
161
161
  if (hasCreatedAt) {
162
162
  args[constants_1.FIELDS.CREATED_AT] = this.dateTime.dbFormat(this.dateTimeNow);
163
163
  }
@@ -172,15 +172,18 @@ var BaseGateway = /** @class */ (function () {
172
172
  if (hasVersion) {
173
173
  args[constants_1.FIELDS.VERSION] = 0;
174
174
  }
175
+ if (hasLang && localizationForField) {
176
+ args[constants_1.FIELDS.ID] = (0, utils_1.buildKey)([args[localizationForField], args[constants_1.FIELDS.LANG]]);
177
+ }
175
178
  return [2 /*return*/, args];
176
179
  });
177
180
  });
178
181
  };
179
182
  BaseGateway.prototype.transformOnUpdate = function (params, where) {
180
183
  return __awaiter(this, void 0, void 0, function () {
181
- var _a, hasUpdatedAt, hasUpdatedBy, hasVersion;
184
+ var _a, hasUpdatedAt, hasUpdatedBy, hasVersion, hasLang, localizationForField;
182
185
  return __generator(this, function (_b) {
183
- _a = this.config, hasUpdatedAt = _a.hasUpdatedAt, hasUpdatedBy = _a.hasUpdatedBy, hasVersion = _a.hasVersion;
186
+ _a = this.config, hasUpdatedAt = _a.hasUpdatedAt, hasUpdatedBy = _a.hasUpdatedBy, hasVersion = _a.hasVersion, hasLang = _a.hasLang, localizationForField = _a.localizationForField;
184
187
  if (hasUpdatedAt) {
185
188
  params[constants_1.FIELDS.UPDATED_AT] = this.dateTime.dbFormat(this.dateTimeNow);
186
189
  }
@@ -194,6 +197,9 @@ var BaseGateway = /** @class */ (function () {
194
197
  params[constants_1.FIELDS.VERSION] = params[constants_1.FIELDS.VERSION] + 1;
195
198
  }
196
199
  }
200
+ if (hasLang && localizationForField) {
201
+ params[constants_1.FIELDS.ID] = (0, utils_1.buildKey)([params[localizationForField], params[constants_1.FIELDS.LANG]]);
202
+ }
197
203
  return [2 /*return*/, params];
198
204
  });
199
205
  });
@@ -17,6 +17,7 @@ export interface BaseGatewayPropsInterface extends CacheInterface {
17
17
  hasSpace?: boolean;
18
18
  hasVersion?: boolean;
19
19
  hasLang?: boolean;
20
+ localizationForField: string;
20
21
  defaultSorting?: SortItemInterface[];
21
22
  fieldForKeyword?: string;
22
23
  insertChunkSize?: number;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sdflc/backend-helpers",
3
- "version": "1.0.38",
3
+ "version": "1.0.39",
4
4
  "description": "Set of helper functions and classes to simplify building backend apps within @sdflc ecosystem",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",