@trackunit/iris-app-api 0.2.3 → 0.2.4

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/CHANGELOG.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver).
4
4
 
5
+ ## [0.2.4](https://github.com/Trackunit/manager/compare/iris-app-api/0.2.3...iris-app-api/0.2.4) (2024-09-16)
6
+
5
7
  ## [0.2.3](https://github.com/Trackunit/manager/compare/iris-app-api/0.2.2...iris-app-api/0.2.3) (2024-09-11)
6
8
 
7
9
  ## [0.2.2](https://github.com/Trackunit/manager/compare/iris-app-api/0.2.1...iris-app-api/0.2.2) (2024-09-09)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/iris-app-api",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
4
4
  "license": "SEE LICENSE IN LICENSE.txt",
5
5
  "repository": "https://github.com/Trackunit/manager",
6
6
  "engines": {
@@ -1,4 +1,4 @@
1
- import { IconByName, IconImage } from "../iconImage";
1
+ import { IconByName, IconByPath } from "../iconImage";
2
2
  import { AbstractExtensionManifest, RegExpType, TranslationKey, Translations } from "../irisAppExtensionManifest";
3
3
  import { AccountScope } from "../scopes";
4
4
  export interface FleetExtensionManifest extends AbstractExtensionManifest {
@@ -21,8 +21,20 @@ export interface FleetExtensionManifest extends AbstractExtensionManifest {
21
21
  scopes?: AccountScope | AccountScope[];
22
22
  };
23
23
  menuItem: {
24
+ /**
25
+ * The name used in the menu item.
26
+ */
24
27
  name: string | Translations | TranslationKey;
28
+ /**
29
+ * The icon used in the menu item.
30
+ *
31
+ * @deprecated please use image instead.
32
+ */
25
33
  icon: string;
26
- image?: IconByName | IconImage;
34
+ image?: IconByName | IconByPath;
35
+ /**
36
+ * Description of the menu item, used in the 'Applications' menu.
37
+ */
38
+ description?: string | Translations | TranslationKey;
27
39
  };
28
40
  }
@@ -1 +1 @@
1
- {"version":3,"file":"fleetExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/fleetExtensionManifest.ts"],"names":[],"mappings":"","sourcesContent":["import { IconByName, IconImage } from \"../iconImage\";\nimport { AbstractExtensionManifest, RegExpType, TranslationKey, Translations } from \"../irisAppExtensionManifest\";\nimport { AccountScope } from \"../scopes\";\n\nexport interface FleetExtensionManifest extends AbstractExtensionManifest {\n type: \"FLEET_EXTENSION\";\n\n /**\n * Conditions for the fleet extension to be shown.\n * It is case insensitive so does not matter how you write the brand.\n * brand: \"trackunit\" and brand: \"Trackunit\" will be the same.\n *\n * Its doing AND between the conditions types and OR between the conditions of the same type:\n * - If both model and brand are used/filled out then asset needs to match both model and brand.\n * - If only brand or model is used/filled out then the asset needs to match the filled out property.\n * - If only scopes is used/filled out then the fleet extension will be shown if the user has the required scope.\n * - If more scopes are used/filled out then the fleet extension will be shown if the user has one of the required scopes.\n * - If no conditions are used/filled out then the asset home extension will be shown for all assets.\n */\n conditions?: {\n model?: (string | RegExpType)[] | string | RegExpType;\n brand?: (string | RegExpType)[] | string | RegExpType;\n scopes?: AccountScope | AccountScope[];\n };\n\n menuItem: {\n name: string | Translations | TranslationKey;\n icon: string;\n image?: IconByName | IconImage;\n };\n}\n"]}
1
+ {"version":3,"file":"fleetExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/fleetExtensionManifest.ts"],"names":[],"mappings":"","sourcesContent":["import { IconByName, IconByPath } from \"../iconImage\";\nimport { AbstractExtensionManifest, RegExpType, TranslationKey, Translations } from \"../irisAppExtensionManifest\";\nimport { AccountScope } from \"../scopes\";\n\nexport interface FleetExtensionManifest extends AbstractExtensionManifest {\n type: \"FLEET_EXTENSION\";\n\n /**\n * Conditions for the fleet extension to be shown.\n * It is case insensitive so does not matter how you write the brand.\n * brand: \"trackunit\" and brand: \"Trackunit\" will be the same.\n *\n * Its doing AND between the conditions types and OR between the conditions of the same type:\n * - If both model and brand are used/filled out then asset needs to match both model and brand.\n * - If only brand or model is used/filled out then the asset needs to match the filled out property.\n * - If only scopes is used/filled out then the fleet extension will be shown if the user has the required scope.\n * - If more scopes are used/filled out then the fleet extension will be shown if the user has one of the required scopes.\n * - If no conditions are used/filled out then the asset home extension will be shown for all assets.\n */\n conditions?: {\n model?: (string | RegExpType)[] | string | RegExpType;\n brand?: (string | RegExpType)[] | string | RegExpType;\n scopes?: AccountScope | AccountScope[];\n };\n\n menuItem: {\n /**\n * The name used in the menu item.\n */\n name: string | Translations | TranslationKey;\n /**\n * The icon used in the menu item.\n *\n * @deprecated please use image instead.\n */\n icon: string;\n image?: IconByName | IconByPath;\n\n /**\n * Description of the menu item, used in the 'Applications' menu.\n */\n description?: string | Translations | TranslationKey;\n };\n}\n"]}
@@ -11,37 +11,51 @@ export declare const isHexColor: (color: any) => color is HexColor;
11
11
  */
12
12
  export declare const isRgbColor: (color: any) => color is RgbColor;
13
13
  export type Color = HexColor | RgbColor;
14
- export type IconImage = {
14
+ export type Colorable = {
15
+ /**
16
+ * Color of the background for the icon
17
+ * Supports hex or rgb
18
+ *
19
+ * @example "#ff0000" or "rgb(255,0,0)"
20
+ */
21
+ background?: Color;
22
+ /**
23
+ * Color of the foreground for the icon
24
+ * Supports hex or rgb
25
+ *
26
+ * @example "#ff0000" or "rgb(255,0,0)"
27
+ */
28
+ foreground?: Color;
29
+ };
30
+ export type IconByPath = {
15
31
  /**
16
32
  * Path relative to the projects src folder defined in the extensions sourceRoot
33
+ * ONLY supports svg files since we replace the color in the svg file at runtime.
17
34
  *
18
35
  * @example "assets/icon.svg"
19
36
  */
20
37
  path: SvgImagePath;
21
- color?: Color;
22
- };
38
+ } & Colorable;
23
39
  export type IconByName = {
24
- name: IconName;
25
40
  /**
26
- * Color of the background for the icon
27
- * Supports hex or rgb
41
+ * Name of the icon from the Iris Icons package
28
42
  *
29
- * @example "#ff0000" or "rgb(255,0,0)"
43
+ * @example "MapMarkerPointSquare"
30
44
  */
31
- color?: Color;
32
- };
45
+ name: IconName;
46
+ } & Colorable;
33
47
  /**
34
48
  * Checks if value is an IconImage
35
49
  *
36
50
  * @param value - The value to check
37
- * @returns - True if value is an IconImage
51
+ * @returns {boolean} True if value is an IconImage
38
52
  */
39
- export declare const isIconImage: (value: unknown) => value is IconImage;
53
+ export declare const isIconByPath: (value: unknown) => value is IconByPath;
40
54
  /**
41
55
  * Checks if value is an IconByName
42
56
  *
43
57
  * @param value - The value to check
44
- * @returns - True if value is an IconByName
58
+ * @returns {boolean}- True if value is an IconByName
45
59
  */
46
60
  export declare const isIconByName: (value: unknown) => value is IconByName;
47
61
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isIconByName = exports.isIconImage = exports.isRgbColor = exports.isHexColor = void 0;
3
+ exports.isIconByName = exports.isIconByPath = exports.isRgbColor = exports.isHexColor = void 0;
4
4
  /**
5
5
  * Checks if the value is a valid hex color
6
6
  */
@@ -21,20 +21,20 @@ exports.isRgbColor = isRgbColor;
21
21
  * Checks if value is an IconImage
22
22
  *
23
23
  * @param value - The value to check
24
- * @returns - True if value is an IconImage
24
+ * @returns {boolean} True if value is an IconImage
25
25
  */
26
- const isIconImage = (value) => {
27
- return !!(value === null || value === void 0 ? void 0 : value.path);
26
+ const isIconByPath = (value) => {
27
+ return typeof value === "object" && value !== null && "path" in value;
28
28
  };
29
- exports.isIconImage = isIconImage;
29
+ exports.isIconByPath = isIconByPath;
30
30
  /**
31
31
  * Checks if value is an IconByName
32
32
  *
33
33
  * @param value - The value to check
34
- * @returns - True if value is an IconByName
34
+ * @returns {boolean}- True if value is an IconByName
35
35
  */
36
36
  const isIconByName = (value) => {
37
- return !!(value === null || value === void 0 ? void 0 : value.name);
37
+ return typeof value === "object" && value !== null && "name" in value;
38
38
  };
39
39
  exports.isIconByName = isIconByName;
40
40
  //# sourceMappingURL=iconImage.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"iconImage.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/src/types/iconImage.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACH,8DAA8D;AACvD,MAAM,UAAU,GAAG,CAAC,KAAU,EAAqB,EAAE;IAC1D,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEF;;GAEG;AACH,8DAA8D;AACvD,MAAM,UAAU,GAAG,CAAC,KAAU,EAAqB,EAAE;IAC1D,OAAO,mCAAmC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAyBF;;;;;GAKG;AACI,MAAM,WAAW,GAAG,CAAC,KAAc,EAAsB,EAAE;IAChE,OAAO,CAAC,CAAC,CAAC,KAA+B,aAA/B,KAAK,uBAAL,KAAK,CAA4B,IAAI,CAAA,CAAC;AAClD,CAAC,CAAC;AAFW,QAAA,WAAW,eAEtB;AAEF;;;;;GAKG;AACI,MAAM,YAAY,GAAG,CAAC,KAAc,EAAuB,EAAE;IAClE,OAAO,CAAC,CAAC,CAAC,KAAgC,aAAhC,KAAK,uBAAL,KAAK,CAA6B,IAAI,CAAA,CAAC;AACnD,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB","sourcesContent":["import { IconName } from \"./icons.generated\";\n\ntype HexColor = `#${string}`;\ntype RgbColor = `rgb(${number},${number},${number})`;\nexport type SvgImagePath = `${string}.svg`;\n\n/**\n * Checks if the value is a valid hex color\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isHexColor = (color: any): color is HexColor => {\n return /^#[0-9A-F]{6}$/i.test(color) || /^#[0-9A-F]{3}$/i.test(color);\n};\n\n/**\n * Checks if the value is a valid rgb color\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isRgbColor = (color: any): color is RgbColor => {\n return /^rgb\\(\\d{1,3},\\d{1,3},\\d{1,3}\\)$/i.test(color);\n};\n\nexport type Color = HexColor | RgbColor;\n\nexport type IconImage = {\n /**\n * Path relative to the projects src folder defined in the extensions sourceRoot\n *\n * @example \"assets/icon.svg\"\n */\n path: SvgImagePath;\n color?: Color;\n};\n\nexport type IconByName = {\n name: IconName;\n /**\n * Color of the background for the icon\n * Supports hex or rgb\n *\n * @example \"#ff0000\" or \"rgb(255,0,0)\"\n */\n color?: Color;\n};\n\n/**\n * Checks if value is an IconImage\n *\n * @param value - The value to check\n * @returns - True if value is an IconImage\n */\nexport const isIconImage = (value: unknown): value is IconImage => {\n return !!(value as IconImage | undefined)?.path;\n};\n\n/**\n * Checks if value is an IconByName\n *\n * @param value - The value to check\n * @returns - True if value is an IconByName\n */\nexport const isIconByName = (value: unknown): value is IconByName => {\n return !!(value as IconByName | undefined)?.name;\n};\n"]}
1
+ {"version":3,"file":"iconImage.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/src/types/iconImage.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACH,8DAA8D;AACvD,MAAM,UAAU,GAAG,CAAC,KAAU,EAAqB,EAAE;IAC1D,OAAO,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACxE,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAEF;;GAEG;AACH,8DAA8D;AACvD,MAAM,UAAU,GAAG,CAAC,KAAU,EAAqB,EAAE;IAC1D,OAAO,mCAAmC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;AACzD,CAAC,CAAC;AAFW,QAAA,UAAU,cAErB;AAyCF;;;;;GAKG;AACI,MAAM,YAAY,GAAG,CAAC,KAAc,EAAuB,EAAE;IAClE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC;AACxE,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB;AAEF;;;;;GAKG;AACI,MAAM,YAAY,GAAG,CAAC,KAAc,EAAuB,EAAE;IAClE,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,CAAC;AACxE,CAAC,CAAC;AAFW,QAAA,YAAY,gBAEvB","sourcesContent":["import { IconName } from \"./icons.generated\";\n\ntype HexColor = `#${string}`;\ntype RgbColor = `rgb(${number},${number},${number})`;\nexport type SvgImagePath = `${string}.svg`;\n\n/**\n * Checks if the value is a valid hex color\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isHexColor = (color: any): color is HexColor => {\n return /^#[0-9A-F]{6}$/i.test(color) || /^#[0-9A-F]{3}$/i.test(color);\n};\n\n/**\n * Checks if the value is a valid rgb color\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nexport const isRgbColor = (color: any): color is RgbColor => {\n return /^rgb\\(\\d{1,3},\\d{1,3},\\d{1,3}\\)$/i.test(color);\n};\n\nexport type Color = HexColor | RgbColor;\n\nexport type Colorable = {\n /**\n * Color of the background for the icon\n * Supports hex or rgb\n *\n * @example \"#ff0000\" or \"rgb(255,0,0)\"\n */\n background?: Color;\n\n /**\n * Color of the foreground for the icon\n * Supports hex or rgb\n *\n * @example \"#ff0000\" or \"rgb(255,0,0)\"\n */\n foreground?: Color;\n};\n\nexport type IconByPath = {\n /**\n * Path relative to the projects src folder defined in the extensions sourceRoot\n * ONLY supports svg files since we replace the color in the svg file at runtime.\n *\n * @example \"assets/icon.svg\"\n */\n path: SvgImagePath;\n} & Colorable;\n\nexport type IconByName = {\n /**\n * Name of the icon from the Iris Icons package\n *\n * @example \"MapMarkerPointSquare\"\n */\n name: IconName;\n} & Colorable;\n\n/**\n * Checks if value is an IconImage\n *\n * @param value - The value to check\n * @returns {boolean} True if value is an IconImage\n */\nexport const isIconByPath = (value: unknown): value is IconByPath => {\n return typeof value === \"object\" && value !== null && \"path\" in value;\n};\n\n/**\n * Checks if value is an IconByName\n *\n * @param value - The value to check\n * @returns {boolean}- True if value is an IconByName\n */\nexport const isIconByName = (value: unknown): value is IconByName => {\n return typeof value === \"object\" && value !== null && \"name\" in value;\n};\n"]}