@trackunit/iris-app-api 0.0.150 → 0.0.151
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.0.151](https://github.com/Trackunit/manager/compare/iris-app-api/0.0.150...iris-app-api/0.0.151) (2024-02-09)
|
|
6
|
+
|
|
5
7
|
## [0.0.150](https://github.com/Trackunit/manager/compare/iris-app-api/0.0.149...iris-app-api/0.0.150) (2024-02-08)
|
|
6
8
|
|
|
7
9
|
## [0.0.149](https://github.com/Trackunit/manager/compare/iris-app-api/0.0.148...iris-app-api/0.0.149) (2024-02-08)
|
package/package.json
CHANGED
|
@@ -1,5 +1,31 @@
|
|
|
1
|
+
import { TranslationKey, TranslationLanguageKeys } from "./irisAppExtensionManifest";
|
|
1
2
|
export declare type CustomFieldDefinitionType = "STRING" | "NUMBER" | "DATE" | "BOOLEAN" | "DROPDOWN" | "EMAIL" | "PHONE_NUMBER" | "WEB_ADDRESS" | "JSON" | "MONETARY";
|
|
2
3
|
export declare type EntityType = "ASSET" | "ACCOUNT" | "SITE" | "GROUP";
|
|
4
|
+
/**
|
|
5
|
+
* Test if the object is a CustomFieldTranslation array.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isCustomFieldTranslationArray: (object: CustomFieldTranslationArray | {
|
|
8
|
+
title: TranslationKey;
|
|
9
|
+
description?: TranslationKey;
|
|
10
|
+
}) => object is CustomFieldTranslationArray;
|
|
11
|
+
export interface CustomFieldTranslation {
|
|
12
|
+
language: TranslationLanguageKeys;
|
|
13
|
+
title: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
}
|
|
16
|
+
export interface CustomFieldTranslationWithoutEnglish {
|
|
17
|
+
language: Exclude<TranslationLanguageKeys, "en">;
|
|
18
|
+
title: string;
|
|
19
|
+
description?: string;
|
|
20
|
+
}
|
|
21
|
+
export type CustomFieldTranslationArray = [
|
|
22
|
+
{
|
|
23
|
+
language: "en";
|
|
24
|
+
title: string;
|
|
25
|
+
description?: string;
|
|
26
|
+
},
|
|
27
|
+
...CustomFieldTranslationWithoutEnglish[]
|
|
28
|
+
];
|
|
3
29
|
export interface AbstractCustomFieldDefinition {
|
|
4
30
|
/**
|
|
5
31
|
* The key is the name you use to get the custom field.
|
|
@@ -10,9 +36,15 @@ export interface AbstractCustomFieldDefinition {
|
|
|
10
36
|
*/
|
|
11
37
|
entityType: EntityType;
|
|
12
38
|
/**
|
|
13
|
-
* The
|
|
39
|
+
* The translations for the custom field definition.
|
|
40
|
+
* For Arrays of translations, the list must contain the language "en" as the default.
|
|
41
|
+
* Either a list of translations or a single translation object with
|
|
42
|
+
* translation keys it will look for all available languages in src/locales/<languagecode>/translation.json
|
|
14
43
|
*/
|
|
15
|
-
|
|
44
|
+
translations: CustomFieldTranslationArray | {
|
|
45
|
+
title: TranslationKey;
|
|
46
|
+
description?: TranslationKey;
|
|
47
|
+
};
|
|
16
48
|
/**
|
|
17
49
|
* Should this be visible in the generic UI in Manager.
|
|
18
50
|
*/
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UnitSi = exports.UnitUs = void 0;
|
|
3
|
+
exports.UnitSi = exports.UnitUs = exports.isCustomFieldTranslationArray = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Test if the object is a CustomFieldTranslation array.
|
|
6
|
+
*/
|
|
7
|
+
const isCustomFieldTranslationArray = (object) => {
|
|
8
|
+
return Array.isArray(object);
|
|
9
|
+
};
|
|
10
|
+
exports.isCustomFieldTranslationArray = isCustomFieldTranslationArray;
|
|
4
11
|
exports.UnitUs = {
|
|
5
12
|
acre: "acre",
|
|
6
13
|
foot: "foot",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"irisAppCustomFields.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/src/types/irisAppCustomFields.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"irisAppCustomFields.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/src/types/irisAppCustomFields.ts"],"names":[],"mappings":";;;AAgBA;;GAEG;AACI,MAAM,6BAA6B,GAAG,CAC3C,MAA6F,EACtD,EAAE;IACzC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AAJW,QAAA,6BAA6B,iCAIxC;AA2FW,QAAA,MAAM,GAAG;IACpB,IAAI,EAAE,MAAM;IACZ,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,aAAa;IAC1B,UAAU,EAAE,YAAY;IACxB,aAAa,EAAE,eAAe;IAC9B,IAAI,EAAE,MAAM;IACZ,KAAK,EAAE,OAAO;IACd,cAAc,EAAE,gBAAgB;IAChC,gBAAgB,EAAE,kBAAkB;IACpC,IAAI,EAAE,MAAM;IACZ,aAAa,EAAE,eAAe;IAC9B,KAAK,EAAE,OAAO;IACd,MAAM,EAAE,QAAQ;IAChB,IAAI,EAAE,MAAM;IACZ,qBAAqB,EAAE,uBAAuB;CACtC,CAAC;AAGE,QAAA,MAAM,GAAG;IACpB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;IAChB,UAAU,EAAE,YAAY;IACxB,IAAI,EAAE,MAAM;IACZ,GAAG,EAAE,KAAK;IACV,UAAU,EAAE,YAAY;IACxB,UAAU,EAAE,YAAY;IACxB,KAAK,EAAE,OAAO;IACd,SAAS,EAAE,WAAW;IACtB,IAAI,EAAE,MAAM;IACZ,QAAQ,EAAE,UAAU;IACpB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;IAC5B,iBAAiB,EAAE,mBAAmB;IACtC,mBAAmB,EAAE,qBAAqB;IAC1C,gBAAgB,EAAE,kBAAkB;IACpC,kBAAkB,EAAE,oBAAoB;IACxC,KAAK,EAAE,OAAO;IACd,YAAY,EAAE,cAAc;IAC5B,WAAW,EAAE,aAAa;IAC1B,gBAAgB,EAAE,kBAAkB;IACpC,wBAAwB,EAAE,0BAA0B;IACpD,GAAG,EAAE,KAAK;IACV,OAAO,EAAE,SAAS;IAClB,IAAI,EAAE,MAAM;CACJ,CAAC","sourcesContent":["import { TranslationKey, TranslationLanguageKeys } from \"./irisAppExtensionManifest\";\n\nexport declare type CustomFieldDefinitionType =\n | \"STRING\"\n | \"NUMBER\"\n | \"DATE\"\n | \"BOOLEAN\"\n | \"DROPDOWN\"\n | \"EMAIL\"\n | \"PHONE_NUMBER\"\n | \"WEB_ADDRESS\"\n | \"JSON\"\n | \"MONETARY\";\n\nexport declare type EntityType = \"ASSET\" | \"ACCOUNT\" | \"SITE\" | \"GROUP\";\n\n/**\n * Test if the object is a CustomFieldTranslation array.\n */\nexport const isCustomFieldTranslationArray = (\n object: CustomFieldTranslationArray | { title: TranslationKey; description?: TranslationKey }\n): object is CustomFieldTranslationArray => {\n return Array.isArray(object);\n};\n\nexport interface CustomFieldTranslation {\n language: TranslationLanguageKeys;\n title: string;\n description?: string;\n}\n\nexport interface CustomFieldTranslationWithoutEnglish {\n language: Exclude<TranslationLanguageKeys, \"en\">;\n title: string;\n description?: string;\n}\n\nexport type CustomFieldTranslationArray = [\n { language: \"en\"; title: string; description?: string },\n ...CustomFieldTranslationWithoutEnglish[],\n];\n\nexport interface AbstractCustomFieldDefinition {\n /**\n * The key is the name you use to get the custom field.\n */\n key: string;\n\n /**\n * The type of the entity to attach this custom field on.\n */\n entityType: EntityType;\n\n /**\n * The translations for the custom field definition.\n * For Arrays of translations, the list must contain the language \"en\" as the default.\n * Either a list of translations or a single translation object with\n * translation keys it will look for all available languages in src/locales/<languagecode>/translation.json\n */\n translations: CustomFieldTranslationArray | { title: TranslationKey; description?: TranslationKey };\n\n /**\n * Should this be visible in the generic UI in Manager.\n */\n uiVisible?: boolean;\n\n /**\n * Should this be editable in the generic UI in Manager. This does not mean you cannot change it inside a app.\n */\n uiEditable?: boolean;\n\n /**\n * The type of this custom field definition\n */\n type: CustomFieldDefinitionType;\n}\n\nexport interface StringFieldDefinition extends AbstractCustomFieldDefinition {\n type: \"STRING\";\n minimumLength?: number;\n maximumLength?: number;\n pattern?: string;\n}\n\nexport interface EmailFieldDefinition extends AbstractCustomFieldDefinition {\n type: \"EMAIL\";\n}\n\nexport interface WebAddressFieldDefinition extends AbstractCustomFieldDefinition {\n type: \"WEB_ADDRESS\";\n}\n\nexport interface PhoneNumberFieldDefinition extends AbstractCustomFieldDefinition {\n type: \"PHONE_NUMBER\";\n}\nexport interface BooleanFieldDefinition extends AbstractCustomFieldDefinition {\n type: \"BOOLEAN\";\n}\n\nexport interface DateFieldDefinition extends AbstractCustomFieldDefinition {\n type: \"DATE\";\n}\n\nexport interface DropDownFieldDefinition extends AbstractCustomFieldDefinition {\n type: \"DROPDOWN\";\n multiSelect?: boolean;\n allValues?: string[];\n /**\n * Map from old values not in the allValues to new values. Used for updating existing data when changing\n * the drop down options.\n */\n valueReplacements?: Record<string, string>;\n}\n\nexport const UnitUs = {\n acre: \"acre\",\n foot: \"foot\",\n square_foot: \"square_foot\",\n cubic_foot: \"cubic_foot\",\n gallon_liquid: \"gallon_liquid\",\n inch: \"inch\",\n pound: \"pound\",\n pound_per_hour: \"pound_per_hour\",\n pound_per_second: \"pound_per_second\",\n mile: \"mile\",\n mile_per_hour: \"mile_per_hour\",\n ounce: \"ounce\",\n ton_us: \"ton_us\",\n yard: \"yard\",\n pound_per_square_inch: \"pound_per_square_inch\",\n} as const;\nexport type UnitUsType = (typeof UnitUs)[keyof typeof UnitUs];\n\nexport const UnitSi = {\n newton: \"newton\",\n pascal: \"pascal\",\n kilopascal: \"kilopascal\",\n watt: \"watt\",\n bar: \"bar\",\n centimetre: \"centimetre\",\n millimetre: \"millimetre\",\n metre: \"metre\",\n kilometre: \"kilometre\",\n gram: \"gram\",\n kilogram: \"kilogram\",\n kilowatt: \"kilowatt\",\n kilowatthour: \"kilowatthour\",\n kilogram_per_hour: \"kilogram_per_hour\",\n kilogram_per_second: \"kilogram_per_second\",\n square_kilometre: \"square_kilometre\",\n kilometre_per_hour: \"kilometre_per_hour\",\n litre: \"litre\",\n square_metre: \"square_metre\",\n cubic_metre: \"cubic_metre\",\n metre_per_second: \"metre_per_second\",\n metre_per_second_squared: \"metre_per_second_squared\",\n ton: \"ton\",\n hectare: \"hectare\",\n hour: \"hour\",\n} as const;\nexport type UnitSiType = (typeof UnitSi)[keyof typeof UnitSi];\n\nexport interface DecimalNumberFieldDefinition extends AbstractCustomFieldDefinition {\n type: \"NUMBER\";\n\n minimum?: number;\n maximum?: number;\n\n unitSi?: UnitSiType;\n unitUs?: UnitUsType;\n\n isInteger: false;\n}\n\nexport interface IntegerNumberFieldDefinition extends AbstractCustomFieldDefinition {\n type: \"NUMBER\";\n\n minimum?: number;\n maximum?: number;\n\n isInteger: true;\n}\n\nexport type JSONValue = string | number | boolean | null | { [x: string]: JSONValue } | JSONValue[];\n\nexport interface JsonFieldDefinition extends AbstractCustomFieldDefinition {\n type: \"JSON\";\n}\n\nexport interface MonetaryFieldDefinition extends AbstractCustomFieldDefinition {\n type: \"MONETARY\";\n /**\n * The currency of the monetary field definition - ISO 4217 compliant.\n */\n currency: string;\n}\n"]}
|