@optimiser/common 1.0.447 → 1.0.448

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.
@@ -135,7 +135,7 @@ exports.GetEmailwiseUnsubscribeData = GetEmailwiseUnsubscribeData;
135
135
  function GenerateAutoIncrementFieldValue(db, autoIncrementID) {
136
136
  var _this = this;
137
137
  return new Promise(function (resolve, reject) { return __awaiter(_this, void 0, void 0, function () {
138
- var sequenceDocument, val, j, item, num, ex_1;
138
+ var sequenceDocument, val, doc, j, item, num, ex_1;
139
139
  return __generator(this, function (_a) {
140
140
  switch (_a.label) {
141
141
  case 0:
@@ -144,13 +144,14 @@ function GenerateAutoIncrementFieldValue(db, autoIncrementID) {
144
144
  case 1:
145
145
  sequenceDocument = _a.sent();
146
146
  val = "";
147
- for (j = 0; j < sequenceDocument.value.Formats.length; j++) {
148
- item = sequenceDocument.value.Formats[j];
147
+ doc = sequenceDocument.value ? sequenceDocument.value : sequenceDocument;
148
+ for (j = 0; j < doc.Formats.length; j++) {
149
+ item = doc.Formats[j];
149
150
  if (item.Type == "Constant") {
150
151
  val += item.Value;
151
152
  }
152
153
  else if (item.Type == "AutoIncrement") {
153
- num = sequenceDocument.value.SequenceValue.toString();
154
+ num = doc.SequenceValue.toString();
154
155
  if (item.MinimumLength && item.MinimumLength > 0) {
155
156
  num = ("0000000000").substring(0, item.MinimumLength - num.length) + num;
156
157
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@optimiser/common",
3
- "version": "1.0.447",
3
+ "version": "1.0.448",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {