@trackunit/iris-app-runtime-core 0.3.0 → 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,9 +1119,17 @@ const setupHostConnector = subscribedMethods => {
1126
1119
  onTokenChanged: () => {},
1127
1120
  onAssetSortingStateChanged: () => {}
1128
1121
  }, subscribedMethods);
1129
- return connectToParent({
1122
+ const connection = penpal.connectToParent({
1123
+ methods
1124
+ });
1125
+ penpal.connectToParent({
1130
1126
  methods
1127
+ }).promise.catch(err => {
1128
+ // TODO consider how to handle this catch
1129
+ // eslint-disable-next-line no-console
1130
+ console.log(err);
1131
1131
  });
1132
+ return connection;
1132
1133
  };
1133
1134
  const hostConnector = setupHostConnector({});
1134
1135
  const getHostConnector = () => {
@@ -1706,7 +1707,7 @@ var toStringTagSupport = String(test) === '[object z]';
1706
1707
 
1707
1708
  var TO_STRING_TAG_SUPPORT = toStringTagSupport;
1708
1709
  var isCallable = isCallable$f;
1709
- var classofRaw = classofRaw$2;
1710
+ var classofRaw = classofRaw$1;
1710
1711
  var wellKnownSymbol = wellKnownSymbol$8;
1711
1712
 
1712
1713
  var TO_STRING_TAG = wellKnownSymbol('toStringTag');
@@ -1872,19 +1873,18 @@ $({ target: 'String', proto: true, forced: forcedStringTrimMethod('trim') }, {
1872
1873
  });
1873
1874
 
1874
1875
  const getCustomFieldValueFromRawValue = (customFieldDefinition, newValue) => {
1875
- if (customFieldDefinition.type === CustomFieldType.BOOLEAN) {
1876
+ if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.BOOLEAN) {
1876
1877
  return {
1877
1878
  booleanValue: newValue ? true : false,
1878
- type: CustomFieldType.BOOLEAN
1879
+ type: irisAppRuntimeCoreApi.CustomFieldType.BOOLEAN
1879
1880
  };
1880
- } else if (customFieldDefinition.type === CustomFieldType.DATE) {
1881
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.DATE) {
1881
1882
  return {
1882
1883
  dateValue: getStringValue(newValue),
1883
- type: CustomFieldType.DATE
1884
+ type: irisAppRuntimeCoreApi.CustomFieldType.DATE
1884
1885
  };
1885
- } else if (customFieldDefinition.type === CustomFieldType.DROPDOWN) {
1886
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.DROPDOWN) {
1886
1887
  const stringArrayValue = [];
1887
-
1888
1888
  if (Array.isArray(newValue)) {
1889
1889
  newValue.forEach(item => {
1890
1890
  if (typeof item === "string") {
@@ -1900,50 +1900,44 @@ const getCustomFieldValueFromRawValue = (customFieldDefinition, newValue) => {
1900
1900
  stringArrayValue.push(newValue === null || newValue === void 0 ? void 0 : newValue.value);
1901
1901
  }
1902
1902
  }
1903
-
1904
1903
  return {
1905
1904
  stringArrayValue: stringArrayValue,
1906
- type: CustomFieldType.DROPDOWN
1905
+ type: irisAppRuntimeCoreApi.CustomFieldType.DROPDOWN
1907
1906
  };
1908
- } else if (customFieldDefinition.type === CustomFieldType.EMAIL) {
1907
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.EMAIL) {
1909
1908
  return {
1910
1909
  stringValue: getStringValue(newValue),
1911
- type: CustomFieldType.EMAIL
1910
+ type: irisAppRuntimeCoreApi.CustomFieldType.EMAIL
1912
1911
  };
1913
- } else if (customFieldDefinition.type === CustomFieldType.NUMBER) {
1912
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.NUMBER) {
1914
1913
  let value = customFieldDefinition.isInteger ? parseInt(newValue) : parseFloat(newValue);
1915
-
1916
1914
  if (isNaN(value)) {
1917
1915
  value = null;
1918
1916
  }
1919
-
1920
1917
  return {
1921
1918
  numberValue: value,
1922
- type: CustomFieldType.NUMBER
1919
+ type: irisAppRuntimeCoreApi.CustomFieldType.NUMBER
1923
1920
  };
1924
- } else if (customFieldDefinition.type === CustomFieldType.PHONE_NUMBER) {
1921
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.PHONE_NUMBER) {
1925
1922
  return {
1926
1923
  stringValue: getStringValue(newValue),
1927
- type: CustomFieldType.PHONE_NUMBER
1924
+ type: irisAppRuntimeCoreApi.CustomFieldType.PHONE_NUMBER
1928
1925
  };
1929
- } else if (customFieldDefinition.type === CustomFieldType.STRING) {
1926
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.STRING) {
1930
1927
  return {
1931
1928
  stringValue: getStringValue(newValue),
1932
- type: CustomFieldType.STRING
1929
+ type: irisAppRuntimeCoreApi.CustomFieldType.STRING
1933
1930
  };
1934
- } else if (customFieldDefinition.type === CustomFieldType.WEB_ADDRESS) {
1931
+ } else if (customFieldDefinition.type === irisAppRuntimeCoreApi.CustomFieldType.WEB_ADDRESS) {
1935
1932
  return {
1936
1933
  stringValue: getStringValue(newValue),
1937
- type: CustomFieldType.WEB_ADDRESS
1934
+ type: irisAppRuntimeCoreApi.CustomFieldType.WEB_ADDRESS
1938
1935
  };
1939
1936
  }
1940
-
1941
1937
  throw new Error("Unsupported custom field type");
1942
1938
  };
1943
-
1944
1939
  const getStringValue = value => {
1945
1940
  const stringValue = value;
1946
-
1947
1941
  if (!isNaN(new Date(stringValue).getDate())) {
1948
1942
  return new Date(stringValue).toISOString();
1949
1943
  } else if (stringValue === null || stringValue === undefined) {
@@ -1954,7 +1948,6 @@ const getStringValue = value => {
1954
1948
  return stringValue.trim();
1955
1949
  }
1956
1950
  };
1957
-
1958
1951
  const CustomFieldRuntime = {
1959
1952
  getCustomFieldsFor: entity => __awaiter(void 0, void 0, void 0, function* () {
1960
1953
  const api = yield getHostConnector();
@@ -1969,9 +1962,7 @@ const CustomFieldRuntime = {
1969
1962
  const values = [];
1970
1963
  Object.keys(formData).forEach(key => {
1971
1964
  var _a;
1972
-
1973
1965
  const found = (_a = originalDefinitions.find(originalDefinition => originalDefinition.definition.key === key)) === null || _a === void 0 ? void 0 : _a.definition;
1974
-
1975
1966
  if (found) {
1976
1967
  values.push({
1977
1968
  definitionKey: key,
@@ -2030,20 +2021,17 @@ const ParamsRuntime = {
2030
2021
 
2031
2022
  const RestRuntime = {
2032
2023
  apiHost: "https://API_HOST",
2033
-
2034
2024
  request(path, method, requestParams, body, bodyType, secureByDefault) {
2035
2025
  return __awaiter(this, void 0, void 0, function* () {
2036
2026
  const api = yield getHostConnector();
2037
2027
  return api.requestTrackunitRestApi(path, method, requestParams, body, bodyType, secureByDefault);
2038
2028
  });
2039
2029
  }
2040
-
2041
2030
  };
2042
2031
 
2043
2032
  const ToastRuntime = {
2044
2033
  addToast(toast) {
2045
2034
  var _a, _b;
2046
-
2047
2035
  return __awaiter(this, void 0, void 0, function* () {
2048
2036
  const api = yield getHostConnector();
2049
2037
  return api.addToast(Object.assign(Object.assign({}, toast), {
@@ -2051,12 +2039,10 @@ const ToastRuntime = {
2051
2039
  secondaryAction: (_b = toast.secondaryAction) === null || _b === void 0 ? void 0 : _b.label
2052
2040
  })).then(res => {
2053
2041
  var _a, _b, _c, _d;
2054
-
2055
2042
  switch (res) {
2056
2043
  case "primaryAction":
2057
2044
  (_b = (_a = toast.primaryAction) === null || _a === void 0 ? void 0 : _a.onClick) === null || _b === void 0 ? void 0 : _b.call(_a);
2058
2045
  break;
2059
-
2060
2046
  case "secondaryAction":
2061
2047
  (_d = (_c = toast.secondaryAction) === null || _c === void 0 ? void 0 : _c.onClick) === null || _d === void 0 ? void 0 : _d.call(_c);
2062
2048
  break;
@@ -2064,7 +2050,6 @@ const ToastRuntime = {
2064
2050
  });
2065
2051
  });
2066
2052
  }
2067
-
2068
2053
  };
2069
2054
 
2070
2055
  const TokenRuntime = {
@@ -2081,4 +2066,25 @@ const UserSubscriptionRuntime = {
2081
2066
  })
2082
2067
  };
2083
2068
 
2084
- 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.0",
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