@trackunit/iris-app-runtime-core 0.3.1 → 0.3.2

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.
@@ -1,6 +1,9 @@
1
- import { CustomFieldType } from '@trackunit/iris-app-runtime-core-api';
2
- export * from '@trackunit/iris-app-runtime-core-api';
3
- import { connectToParent } from 'penpal';
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var irisAppRuntimeCoreApi = require('@trackunit/iris-app-runtime-core-api');
6
+ var penpal = require('penpal');
4
7
 
5
8
  /******************************************************************************
6
9
  Copyright (c) Microsoft Corporation.
@@ -110,34 +113,24 @@ var FunctionPrototype$1 = Function.prototype;
110
113
  var call$5 = FunctionPrototype$1.call;
111
114
  var uncurryThisWithBind = NATIVE_BIND && FunctionPrototype$1.bind.bind(call$5, call$5);
112
115
 
113
- var functionUncurryThisRaw = function (fn) {
114
- return NATIVE_BIND ? uncurryThisWithBind(fn) : function () {
116
+ var functionUncurryThis = NATIVE_BIND ? uncurryThisWithBind : function (fn) {
117
+ return function () {
115
118
  return call$5.apply(fn, arguments);
116
119
  };
117
120
  };
118
121
 
119
- var uncurryThisRaw$1 = functionUncurryThisRaw;
122
+ var uncurryThis$c = functionUncurryThis;
120
123
 
121
- var toString$5 = uncurryThisRaw$1({}.toString);
122
- var stringSlice = uncurryThisRaw$1(''.slice);
124
+ var toString$5 = uncurryThis$c({}.toString);
125
+ var stringSlice = uncurryThis$c(''.slice);
123
126
 
124
- var classofRaw$2 = function (it) {
127
+ var classofRaw$1 = function (it) {
125
128
  return stringSlice(toString$5(it), 8, -1);
126
129
  };
127
130
 
128
- var classofRaw$1 = classofRaw$2;
129
- var uncurryThisRaw = functionUncurryThisRaw;
130
-
131
- var functionUncurryThis = function (fn) {
132
- // Nashorn bug:
133
- // https://github.com/zloirock/core-js/issues/1128
134
- // https://github.com/zloirock/core-js/issues/1130
135
- if (classofRaw$1(fn) === 'Function') return uncurryThisRaw(fn);
136
- };
137
-
138
131
  var uncurryThis$b = functionUncurryThis;
139
132
  var fails$b = fails$e;
140
- var classof$2 = classofRaw$2;
133
+ var classof$2 = classofRaw$1;
141
134
 
142
135
  var $Object$4 = Object;
143
136
  var split = uncurryThis$b(''.split);
@@ -368,10 +361,10 @@ var store$2 = sharedStore;
368
361
  (shared$3.exports = function (key, value) {
369
362
  return store$2[key] || (store$2[key] = value !== undefined ? value : {});
370
363
  })('versions', []).push({
371
- version: '3.25.5',
364
+ version: '3.26.1',
372
365
  mode: 'global',
373
366
  copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
374
- license: 'https://github.com/zloirock/core-js/blob/v3.25.5/LICENSE',
367
+ license: 'https://github.com/zloirock/core-js/blob/v3.26.1/LICENSE',
375
368
  source: 'https://github.com/zloirock/core-js'
376
369
  });
377
370
 
@@ -1126,10 +1119,10 @@ const setupHostConnector = subscribedMethods => {
1126
1119
  onTokenChanged: () => {},
1127
1120
  onAssetSortingStateChanged: () => {}
1128
1121
  }, subscribedMethods);
1129
- const connection = connectToParent({
1122
+ const connection = penpal.connectToParent({
1130
1123
  methods
1131
1124
  });
1132
- connectToParent({
1125
+ penpal.connectToParent({
1133
1126
  methods
1134
1127
  }).promise.catch(err => {
1135
1128
  // TODO consider how to handle this catch
@@ -1714,7 +1707,7 @@ var toStringTagSupport = String(test) === '[object z]';
1714
1707
 
1715
1708
  var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1716
1709
  var isCallable = isCallable$f;
1717
- var classofRaw = classofRaw$2;
1710
+ var classofRaw = classofRaw$1;
1718
1711
  var wellKnownSymbol = wellKnownSymbol$8;
1719
1712
 
1720
1713
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
@@ -1880,19 +1873,18 @@ $({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
1880
1873
  });
1881
1874
 
1882
1875
  const getCustomFieldValueFromRawValue = (customFieldDefinition, newValue) => {
1883
- if (customFieldDefinition.type === CustomFieldType.BOOLEAN) {
1876
+ if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.BOOLEAN) {
1884
1877
  return {
1885
1878
  booleanValue: newValue ? true : false,
1886
- type: CustomFieldType.BOOLEAN
1879
+ type: irisAppRuntimeCoreApi.CustomFieldType.BOOLEAN
1887
1880
  };
1888
- } else if (customFieldDefinition.type === CustomFieldType.DATE) {
1881
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.DATE) {
1889
1882
  return {
1890
1883
  dateValue: getStringValue(newValue),
1891
- type: CustomFieldType.DATE
1884
+ type: irisAppRuntimeCoreApi.CustomFieldType.DATE
1892
1885
  };
1893
- } else if (customFieldDefinition.type === CustomFieldType.DROPDOWN) {
1886
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.DROPDOWN) {
1894
1887
  const stringArrayValue = [];
1895
-
1896
1888
  if (Array.isArray(newValue)) {
1897
1889
  newValue.forEach(item => {
1898
1890
  if (typeof item === "string") {
@@ -1908,50 +1900,44 @@ const getCustomFieldValueFromRawValue = (customFieldDefinition, newValue) => {
1908
1900
  stringArrayValue.push(newValue === null || newValue === void 0 ? void 0 : newValue.value);
1909
1901
  }
1910
1902
  }
1911
-
1912
1903
  return {
1913
1904
  stringArrayValue: stringArrayValue,
1914
- type: CustomFieldType.DROPDOWN
1905
+ type: irisAppRuntimeCoreApi.CustomFieldType.DROPDOWN
1915
1906
  };
1916
- } else if (customFieldDefinition.type === CustomFieldType.EMAIL) {
1907
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.EMAIL) {
1917
1908
  return {
1918
1909
  stringValue: getStringValue(newValue),
1919
- type: CustomFieldType.EMAIL
1910
+ type: irisAppRuntimeCoreApi.CustomFieldType.EMAIL
1920
1911
  };
1921
- } else if (customFieldDefinition.type === CustomFieldType.NUMBER) {
1912
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.NUMBER) {
1922
1913
  let value = customFieldDefinition.isInteger ? parseInt(newValue) : parseFloat(newValue);
1923
-
1924
1914
  if (isNaN(value)) {
1925
1915
  value = null;
1926
1916
  }
1927
-
1928
1917
  return {
1929
1918
  numberValue: value,
1930
- type: CustomFieldType.NUMBER
1919
+ type: irisAppRuntimeCoreApi.CustomFieldType.NUMBER
1931
1920
  };
1932
- } else if (customFieldDefinition.type === CustomFieldType.PHONE_NUMBER) {
1921
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.PHONE_NUMBER) {
1933
1922
  return {
1934
1923
  stringValue: getStringValue(newValue),
1935
- type: CustomFieldType.PHONE_NUMBER
1924
+ type: irisAppRuntimeCoreApi.CustomFieldType.PHONE_NUMBER
1936
1925
  };
1937
- } else if (customFieldDefinition.type === CustomFieldType.STRING) {
1926
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.STRING) {
1938
1927
  return {
1939
1928
  stringValue: getStringValue(newValue),
1940
- type: CustomFieldType.STRING
1929
+ type: irisAppRuntimeCoreApi.CustomFieldType.STRING
1941
1930
  };
1942
- } else if (customFieldDefinition.type === CustomFieldType.WEB_ADDRESS) {
1931
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.WEB_ADDRESS) {
1943
1932
  return {
1944
1933
  stringValue: getStringValue(newValue),
1945
- type: CustomFieldType.WEB_ADDRESS
1934
+ type: irisAppRuntimeCoreApi.CustomFieldType.WEB_ADDRESS
1946
1935
  };
1947
1936
  }
1948
-
1949
1937
  throw new Error("Unsupported custom field type");
1950
1938
  };
1951
-
1952
1939
  const getStringValue = value => {
1953
1940
  const stringValue = value;
1954
-
1955
1941
  if (!isNaN(new Date(stringValue).getDate())) {
1956
1942
  return new Date(stringValue).toISOString();
1957
1943
  } else if (stringValue === null || stringValue === undefined) {
@@ -1962,7 +1948,6 @@ const getStringValue = value => {
1962
1948
  return stringValue.trim();
1963
1949
  }
1964
1950
  };
1965
-
1966
1951
  const CustomFieldRuntime = {
1967
1952
  getCustomFieldsFor: entity => __awaiter(void 0, void 0, void 0, function* () {
1968
1953
  const api = yield getHostConnector();
@@ -1977,9 +1962,7 @@ const CustomFieldRuntime = {
1977
1962
  const values = [];
1978
1963
  Object.keys(formData).forEach(key => {
1979
1964
  var _a;
1980
-
1981
1965
  const found = (_a = originalDefinitions.find(originalDefinition => originalDefinition.definition.key === key)) === null || _a === void 0 ? void 0 : _a.definition;
1982
-
1983
1966
  if (found) {
1984
1967
  values.push({
1985
1968
  definitionKey: key,
@@ -2038,20 +2021,17 @@ const ParamsRuntime = {
2038
2021
 
2039
2022
  const RestRuntime = {
2040
2023
  apiHost: "https://API_HOST",
2041
-
2042
2024
  request(path, method, requestParams, body, bodyType, secureByDefault) {
2043
2025
  return __awaiter(this, void 0, void 0, function* () {
2044
2026
  const api = yield getHostConnector();
2045
2027
  return api.requestTrackunitRestApi(path, method, requestParams, body, bodyType, secureByDefault);
2046
2028
  });
2047
2029
  }
2048
-
2049
2030
  };
2050
2031
 
2051
2032
  const ToastRuntime = {
2052
2033
  addToast(toast) {
2053
2034
  var _a, _b;
2054
-
2055
2035
  return __awaiter(this, void 0, void 0, function* () {
2056
2036
  const api = yield getHostConnector();
2057
2037
  return api.addToast(Object.assign(Object.assign({}, toast), {
@@ -2059,12 +2039,10 @@ const ToastRuntime = {
2059
2039
  secondaryAction: (_b = toast.secondaryAction) === null || _b === void 0 ? void 0 : _b.label
2060
2040
  })).then(res => {
2061
2041
  var _a, _b, _c, _d;
2062
-
2063
2042
  switch (res) {
2064
2043
  case "primaryAction":
2065
2044
  (_b = (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
2066
2045
  break;
2067
-
2068
2046
  case "secondaryAction":
2069
2047
  (_d = (_c = toast.secondaryAction) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.call(_c);
2070
2048
  break;
@@ -2072,7 +2050,6 @@ const ToastRuntime = {
2072
2050
  });
2073
2051
  });
2074
2052
  }
2075
-
2076
2053
  };
2077
2054
 
2078
2055
  const TokenRuntime = {
@@ -2089,4 +2066,25 @@ const UserSubscriptionRuntime = {
2089
2066
  })
2090
2067
  };
2091
2068
 
2092
- export { AssetRuntime, AssetSortingRuntime, CurrentUserRuntime, CustomFieldRuntime, DeveloperSettingsRuntime, EnvironmentRuntime, GlobalSelectionRuntime, NavigationRuntime, ParamsRuntime, RestRuntime, ToastRuntime, TokenRuntime, UserSubscriptionRuntime, getCustomFieldValueFromRawValue, getHostConnector, setupHostConnector };
2069
+ exports.AssetRuntime = AssetRuntime;
2070
+ exports.AssetSortingRuntime = AssetSortingRuntime;
2071
+ exports.CurrentUserRuntime = CurrentUserRuntime;
2072
+ exports.CustomFieldRuntime = CustomFieldRuntime;
2073
+ exports.DeveloperSettingsRuntime = DeveloperSettingsRuntime;
2074
+ exports.EnvironmentRuntime = EnvironmentRuntime;
2075
+ exports.GlobalSelectionRuntime = GlobalSelectionRuntime;
2076
+ exports.NavigationRuntime = NavigationRuntime;
2077
+ exports.ParamsRuntime = ParamsRuntime;
2078
+ exports.RestRuntime = RestRuntime;
2079
+ exports.ToastRuntime = ToastRuntime;
2080
+ exports.TokenRuntime = TokenRuntime;
2081
+ exports.UserSubscriptionRuntime = UserSubscriptionRuntime;
2082
+ exports.getCustomFieldValueFromRawValue = getCustomFieldValueFromRawValue;
2083
+ exports.getHostConnector = getHostConnector;
2084
+ exports.setupHostConnector = setupHostConnector;
2085
+ Object.keys(irisAppRuntimeCoreApi).forEach(function (k) {
2086
+ if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, {
2087
+ enumerable: true,
2088
+ get: function () { return irisAppRuntimeCoreApi[k]; }
2089
+ });
2090
+ });
package/package.json CHANGED
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-runtime-core",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
- "module": "./index.js",
7
- "main": "./index.js",
8
- "type": "module",
9
- "types": "./index.d.ts",
6
+ "main": "./index.cjs",
7
+ "type": "commonjs",
8
+ "types": "./src/index.d.ts",
10
9
  "dependencies": {
11
- "@trackunit/iris-app-runtime-core-api": "0.3.0",
12
- "@trackunit/react-core-contexts-api": "0.2.3"
10
+ "@trackunit/iris-app-runtime-core-api": "0.3.1",
11
+ "@trackunit/react-core-contexts-api": "0.2.4"
13
12
  },
14
13
  "peerDependencies": {}
15
14
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes