@trackunit/iris-app-runtime-core 1.4.37 → 1.4.38

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/index.cjs.js CHANGED
@@ -107,35 +107,35 @@ const CurrentUserRuntime = {
107
107
  * Get the value of a custom field from a raw value.
108
108
  *
109
109
  * @param customFieldDefinition the definition of the custom field
110
- * @param customFieldDefinition.type the type of the custom field definition
110
+ * @param customFieldDefinition.__typename the type of the custom field definition
111
111
  * @param customFieldDefinition.isInteger whether the custom field is an integer
112
112
  * @param newValue the new value to set
113
113
  * @returns { CustomFieldValue } an updated CustomFieldValue
114
114
  */
115
115
  const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue) => {
116
- if (customFieldDefinition.type === "BOOLEAN") {
116
+ if (customFieldDefinition.__typename === "BooleanFieldDefinition") {
117
117
  if (newValue === null) {
118
118
  return {
119
119
  booleanValue: null,
120
- type: "BOOLEAN",
120
+ __typename: "BooleanFieldValue",
121
121
  };
122
122
  }
123
123
  return {
124
124
  booleanValue: newValue ? true : false,
125
- type: "BOOLEAN",
125
+ __typename: "BooleanFieldValue",
126
126
  };
127
127
  }
128
- else if (customFieldDefinition.type === "DATE" || newValue instanceof Date) {
128
+ else if (customFieldDefinition.__typename === "DateFieldDefinition" || newValue instanceof Date) {
129
129
  return {
130
130
  dateValue: typeof newValue === "string" || newValue instanceof Date ? getDateValue(newValue) : null,
131
- type: "DATE",
131
+ __typename: "DateFieldValue",
132
132
  };
133
133
  }
134
- else if (customFieldDefinition.type === "STRING_LIST") {
134
+ else if (customFieldDefinition.__typename === "StringListFieldDefinition") {
135
135
  if (newValue === null) {
136
136
  return {
137
137
  stringArrayValue: null,
138
- type: "STRING_LIST",
138
+ __typename: "StringListFieldValue",
139
139
  };
140
140
  }
141
141
  const stringArrayValue = [];
@@ -159,14 +159,14 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
159
159
  }
160
160
  return {
161
161
  stringArrayValue: stringArrayValue.length ? stringArrayValue : null,
162
- type: "STRING_LIST",
162
+ __typename: "StringListFieldValue",
163
163
  };
164
164
  }
165
- else if (customFieldDefinition.type === "DROPDOWN") {
165
+ else if (customFieldDefinition.__typename === "DropDownFieldDefinition") {
166
166
  if (newValue === null) {
167
167
  return {
168
168
  stringArrayValue: null,
169
- type: "DROPDOWN",
169
+ __typename: "DropDownFieldValue",
170
170
  };
171
171
  }
172
172
  const stringArrayValue = [];
@@ -190,16 +190,16 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
190
190
  }
191
191
  return {
192
192
  stringArrayValue: stringArrayValue.length ? stringArrayValue : null,
193
- type: "DROPDOWN",
193
+ __typename: "DropDownFieldValue",
194
194
  };
195
195
  }
196
- else if (customFieldDefinition.type === "EMAIL") {
196
+ else if (customFieldDefinition.__typename === "EmailFieldDefinition") {
197
197
  return {
198
- stringValue: newValue ? getStringValue(newValue) : null,
199
- type: "EMAIL",
198
+ emailValue: newValue ? getStringValue(newValue) : null,
199
+ __typename: "EmailFieldValue",
200
200
  };
201
201
  }
202
- else if (customFieldDefinition.type === "NUMBER") {
202
+ else if (customFieldDefinition.__typename === "NumberFieldDefinition") {
203
203
  let value = customFieldDefinition.isInteger
204
204
  ? parseInt(newValue)
205
205
  : parseFloat(newValue);
@@ -208,31 +208,31 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
208
208
  }
209
209
  return {
210
210
  numberValue: value,
211
- type: "NUMBER",
211
+ __typename: "NumberFieldValue",
212
212
  };
213
213
  }
214
- else if (customFieldDefinition.type === "MONETARY") {
214
+ else if (customFieldDefinition.__typename === "MonetaryFieldDefinition") {
215
215
  return {
216
- numberValue: newValue ? newValue : null,
217
- type: "MONETARY",
216
+ monetaryValue: newValue ? newValue : null,
217
+ __typename: "MonetaryFieldValue",
218
218
  };
219
219
  }
220
- else if (customFieldDefinition.type === "PHONE_NUMBER") {
220
+ else if (customFieldDefinition.__typename === "PhoneNumberFieldDefinition") {
221
221
  return {
222
- stringValue: newValue ? getStringValue(newValue) : null,
223
- type: "PHONE_NUMBER",
222
+ phoneNumberValue: newValue ? getStringValue(newValue) : null,
223
+ __typename: "PhoneNumberFieldValue",
224
224
  };
225
225
  }
226
- else if (customFieldDefinition.type === "STRING") {
226
+ else if (customFieldDefinition.__typename === "StringFieldDefinition") {
227
227
  return {
228
228
  stringValue: newValue ? getStringValue(newValue) : null,
229
- type: "STRING",
229
+ __typename: "StringFieldValue",
230
230
  };
231
231
  }
232
- else if (customFieldDefinition.type === "WEB_ADDRESS") {
232
+ else if (customFieldDefinition.__typename === "WebAddressFieldDefinition") {
233
233
  return {
234
- stringValue: newValue ? getStringValue(newValue) : null,
235
- type: "WEB_ADDRESS",
234
+ webAddressValue: newValue ? getStringValue(newValue) : null,
235
+ __typename: "WebAddressFieldValue",
236
236
  };
237
237
  }
238
238
  throw new Error("Unsupported custom field type");
package/index.esm.js CHANGED
@@ -105,35 +105,35 @@ const CurrentUserRuntime = {
105
105
  * Get the value of a custom field from a raw value.
106
106
  *
107
107
  * @param customFieldDefinition the definition of the custom field
108
- * @param customFieldDefinition.type the type of the custom field definition
108
+ * @param customFieldDefinition.__typename the type of the custom field definition
109
109
  * @param customFieldDefinition.isInteger whether the custom field is an integer
110
110
  * @param newValue the new value to set
111
111
  * @returns { CustomFieldValue } an updated CustomFieldValue
112
112
  */
113
113
  const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue) => {
114
- if (customFieldDefinition.type === "BOOLEAN") {
114
+ if (customFieldDefinition.__typename === "BooleanFieldDefinition") {
115
115
  if (newValue === null) {
116
116
  return {
117
117
  booleanValue: null,
118
- type: "BOOLEAN",
118
+ __typename: "BooleanFieldValue",
119
119
  };
120
120
  }
121
121
  return {
122
122
  booleanValue: newValue ? true : false,
123
- type: "BOOLEAN",
123
+ __typename: "BooleanFieldValue",
124
124
  };
125
125
  }
126
- else if (customFieldDefinition.type === "DATE" || newValue instanceof Date) {
126
+ else if (customFieldDefinition.__typename === "DateFieldDefinition" || newValue instanceof Date) {
127
127
  return {
128
128
  dateValue: typeof newValue === "string" || newValue instanceof Date ? getDateValue(newValue) : null,
129
- type: "DATE",
129
+ __typename: "DateFieldValue",
130
130
  };
131
131
  }
132
- else if (customFieldDefinition.type === "STRING_LIST") {
132
+ else if (customFieldDefinition.__typename === "StringListFieldDefinition") {
133
133
  if (newValue === null) {
134
134
  return {
135
135
  stringArrayValue: null,
136
- type: "STRING_LIST",
136
+ __typename: "StringListFieldValue",
137
137
  };
138
138
  }
139
139
  const stringArrayValue = [];
@@ -157,14 +157,14 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
157
157
  }
158
158
  return {
159
159
  stringArrayValue: stringArrayValue.length ? stringArrayValue : null,
160
- type: "STRING_LIST",
160
+ __typename: "StringListFieldValue",
161
161
  };
162
162
  }
163
- else if (customFieldDefinition.type === "DROPDOWN") {
163
+ else if (customFieldDefinition.__typename === "DropDownFieldDefinition") {
164
164
  if (newValue === null) {
165
165
  return {
166
166
  stringArrayValue: null,
167
- type: "DROPDOWN",
167
+ __typename: "DropDownFieldValue",
168
168
  };
169
169
  }
170
170
  const stringArrayValue = [];
@@ -188,16 +188,16 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
188
188
  }
189
189
  return {
190
190
  stringArrayValue: stringArrayValue.length ? stringArrayValue : null,
191
- type: "DROPDOWN",
191
+ __typename: "DropDownFieldValue",
192
192
  };
193
193
  }
194
- else if (customFieldDefinition.type === "EMAIL") {
194
+ else if (customFieldDefinition.__typename === "EmailFieldDefinition") {
195
195
  return {
196
- stringValue: newValue ? getStringValue(newValue) : null,
197
- type: "EMAIL",
196
+ emailValue: newValue ? getStringValue(newValue) : null,
197
+ __typename: "EmailFieldValue",
198
198
  };
199
199
  }
200
- else if (customFieldDefinition.type === "NUMBER") {
200
+ else if (customFieldDefinition.__typename === "NumberFieldDefinition") {
201
201
  let value = customFieldDefinition.isInteger
202
202
  ? parseInt(newValue)
203
203
  : parseFloat(newValue);
@@ -206,31 +206,31 @@ const getCustomFieldValueToSaveFromRawValue = (customFieldDefinition, newValue)
206
206
  }
207
207
  return {
208
208
  numberValue: value,
209
- type: "NUMBER",
209
+ __typename: "NumberFieldValue",
210
210
  };
211
211
  }
212
- else if (customFieldDefinition.type === "MONETARY") {
212
+ else if (customFieldDefinition.__typename === "MonetaryFieldDefinition") {
213
213
  return {
214
- numberValue: newValue ? newValue : null,
215
- type: "MONETARY",
214
+ monetaryValue: newValue ? newValue : null,
215
+ __typename: "MonetaryFieldValue",
216
216
  };
217
217
  }
218
- else if (customFieldDefinition.type === "PHONE_NUMBER") {
218
+ else if (customFieldDefinition.__typename === "PhoneNumberFieldDefinition") {
219
219
  return {
220
- stringValue: newValue ? getStringValue(newValue) : null,
221
- type: "PHONE_NUMBER",
220
+ phoneNumberValue: newValue ? getStringValue(newValue) : null,
221
+ __typename: "PhoneNumberFieldValue",
222
222
  };
223
223
  }
224
- else if (customFieldDefinition.type === "STRING") {
224
+ else if (customFieldDefinition.__typename === "StringFieldDefinition") {
225
225
  return {
226
226
  stringValue: newValue ? getStringValue(newValue) : null,
227
- type: "STRING",
227
+ __typename: "StringFieldValue",
228
228
  };
229
229
  }
230
- else if (customFieldDefinition.type === "WEB_ADDRESS") {
230
+ else if (customFieldDefinition.__typename === "WebAddressFieldDefinition") {
231
231
  return {
232
- stringValue: newValue ? getStringValue(newValue) : null,
233
- type: "WEB_ADDRESS",
232
+ webAddressValue: newValue ? getStringValue(newValue) : null,
233
+ __typename: "WebAddressFieldValue",
234
234
  };
235
235
  }
236
236
  throw new Error("Unsupported custom field type");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-runtime-core",
3
- "version": "1.4.37",
3
+ "version": "1.4.38",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -10,7 +10,7 @@
10
10
  "penpal": "^6.2.2",
11
11
  "jest-fetch-mock": "^3.0.3",
12
12
  "@trackunit/react-core-contexts-api": "1.4.37",
13
- "@trackunit/iris-app-runtime-core-api": "1.3.37"
13
+ "@trackunit/iris-app-runtime-core-api": "1.3.38"
14
14
  },
15
15
  "module": "./index.esm.js",
16
16
  "main": "./index.cjs.js",
@@ -1,4 +1,4 @@
1
- import { CustomFieldType, CustomFieldValue, UnitOfMeasurementType } from "@trackunit/iris-app-runtime-core-api";
1
+ import { CustomFieldValue, UnitOfMeasurementType } from "@trackunit/iris-app-runtime-core-api";
2
2
  import { SystemOfMeasurementType } from "@trackunit/react-core-contexts-api";
3
3
  export interface DropdownSelection {
4
4
  value: string;
@@ -7,13 +7,13 @@ export interface DropdownSelection {
7
7
  * Get the value of a custom field from a raw value.
8
8
  *
9
9
  * @param customFieldDefinition the definition of the custom field
10
- * @param customFieldDefinition.type the type of the custom field definition
10
+ * @param customFieldDefinition.__typename the type of the custom field definition
11
11
  * @param customFieldDefinition.isInteger whether the custom field is an integer
12
12
  * @param newValue the new value to set
13
13
  * @returns { CustomFieldValue } an updated CustomFieldValue
14
14
  */
15
15
  export declare const getCustomFieldValueToSaveFromRawValue: (customFieldDefinition: {
16
- type: CustomFieldType;
16
+ __typename: "BooleanFieldDefinition" | "DateFieldDefinition" | "DropDownFieldDefinition" | "EmailFieldDefinition" | "JsonFieldDefinition" | "MonetaryFieldDefinition" | "NumberFieldDefinition" | "PhoneNumberFieldDefinition" | "StringFieldDefinition" | "StringListFieldDefinition" | "WebAddressFieldDefinition";
17
17
  isInteger?: boolean | null;
18
18
  }, newValue: boolean | string | string[] | DropdownSelection[] | DropdownSelection | number | Date | null) => CustomFieldValue;
19
19
  /**