@trackunit/iris-app-api 2.3.10 → 2.4.0
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 +10 -0
- package/migrations/entry.js.map +1 -0
- package/migrations/v2-4-0/add-ai-navigation.js +197 -0
- package/migrations/v2-4-0/add-ai-navigation.js.map +1 -0
- package/migrations.json +7 -1
- package/package.json +1 -1
- package/src/index.d.ts +4 -0
- package/src/index.js +4 -0
- package/src/index.js.map +1 -0
- package/src/types/aiNavigableExtension.d.ts +35 -0
- package/src/types/aiNavigableExtension.js +50 -0
- package/src/types/aiNavigableExtension.js.map +1 -0
- package/src/types/cspDirectives.js.map +1 -0
- package/src/types/defaultValidHosts.js.map +1 -0
- package/src/types/extensions/adminExtensionManifest.d.ts +2 -1
- package/src/types/extensions/adminExtensionManifest.js.map +1 -0
- package/src/types/extensions/assetEventsActionsExtensionManifest.d.ts +2 -1
- package/src/types/extensions/assetEventsActionsExtensionManifest.js.map +1 -0
- package/src/types/extensions/assetHomeExtensionManifest.d.ts +2 -1
- package/src/types/extensions/assetHomeExtensionManifest.js.map +1 -0
- package/src/types/extensions/customerHomeExtensionManifest.d.ts +2 -1
- package/src/types/extensions/customerHomeExtensionManifest.js.map +1 -0
- package/src/types/extensions/fleetExtensionManifest.d.ts +2 -1
- package/src/types/extensions/fleetExtensionManifest.js.map +1 -0
- package/src/types/extensions/irisAppSettingsExtensionManifest.d.ts +2 -1
- package/src/types/extensions/irisAppSettingsExtensionManifest.js.map +1 -0
- package/src/types/extensions/lifecycleExtensionManifest.js.map +1 -0
- package/src/types/extensions/reportExtensionManifest.js.map +1 -0
- package/src/types/extensions/serversideApiExtensionManifest.js.map +1 -0
- package/src/types/extensions/siteHomeExtensionManifest.d.ts +2 -1
- package/src/types/extensions/siteHomeExtensionManifest.js.map +1 -0
- package/src/types/extensions/widgetExtensionManifest.js.map +1 -0
- package/src/types/extractAiNavigationFromTanstackRouter.d.ts +33 -0
- package/src/types/extractAiNavigationFromTanstackRouter.js +60 -0
- package/src/types/extractAiNavigationFromTanstackRouter.js.map +1 -0
- package/src/types/iconImage.js.map +1 -0
- package/src/types/icons.generated.js.map +1 -0
- package/src/types/irisAiNavigation.d.ts +41 -0
- package/src/types/irisAiNavigation.js +3 -0
- package/src/types/irisAiNavigation.js.map +1 -0
- package/src/types/irisAiNavigationValidation.d.ts +17 -0
- package/src/types/irisAiNavigationValidation.js +207 -0
- package/src/types/irisAiNavigationValidation.js.map +1 -0
- package/src/types/irisAppCspInput.js.map +1 -0
- package/src/types/irisAppCustomFields.js.map +1 -0
- package/src/types/irisAppExtensionManifest.js.map +1 -0
- package/src/types/irisAppInstallationConfig.js.map +1 -0
- package/src/types/irisAppManifest.js.map +1 -0
- package/src/types/irisAppMarketplace.js.map +1 -0
- package/src/types/loadNxRootPackageJson.js.map +1 -0
- package/src/types/modulefederation.js.map +1 -0
- package/src/types/permissionsPolicy.js.map +1 -0
- package/src/types/scopes.js.map +1 -0
- package/src/types/serversideInterfaces.js.map +1 -0
- package/src/types/subscriptionPackages.js.map +1 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
## 2.4.0 (2026-08-14)
|
|
2
|
+
|
|
3
|
+
### 🚀 Features
|
|
4
|
+
|
|
5
|
+
- AI navigation support in Iris app SDK ([#24052](https://github.com/Trackunit/manager/pull/24052))
|
|
6
|
+
|
|
7
|
+
### ❤️ Thank You
|
|
8
|
+
|
|
9
|
+
- Aravind K Namboothiri @akn-trackunit
|
|
10
|
+
|
|
1
11
|
## 2.3.10 (2026-08-13)
|
|
2
12
|
|
|
3
13
|
This was a version bump only for iris-app-api to align it with other projects, there were no code changes.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"entry.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-api/migrations/entry.ts"],"names":[],"mappings":"","sourcesContent":["export {};\n"]}
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addAiNavigation = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const ts = tslib_1.__importStar(require("typescript"));
|
|
7
|
+
const TANSTACK_MODULE = "@tanstack/react-router";
|
|
8
|
+
const IRIS_APP_API = "@trackunit/iris-app-api";
|
|
9
|
+
/**
|
|
10
|
+
* Extension types whose manifest can carry `aiNavigation`. Mirrors
|
|
11
|
+
* `aiNavigableExtensionTypes`, kept literal here so the migration keeps working
|
|
12
|
+
* against whatever version of the package a consumer is upgrading from.
|
|
13
|
+
*/
|
|
14
|
+
const aiNavigableExtensionTypes = [
|
|
15
|
+
"FLEET_EXTENSION",
|
|
16
|
+
"ADMIN_EXTENSION",
|
|
17
|
+
"IRIS_APP_SETTINGS_EXTENSION",
|
|
18
|
+
"ASSET_HOME_EXTENSION",
|
|
19
|
+
"SITE_HOME_EXTENSION",
|
|
20
|
+
"CUSTOMER_HOME_EXTENSION",
|
|
21
|
+
"ASSET_EVENTS_ACTIONS_EXTENSION",
|
|
22
|
+
];
|
|
23
|
+
const isUnderNodeModulesOrDist = (filePath) => filePath.includes("node_modules/") || filePath.includes("dist/") || filePath.includes("/.nx/");
|
|
24
|
+
const parse = (filePath, content) => ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
|
|
25
|
+
const indentationOf = (content, position) => {
|
|
26
|
+
const lineStart = content.lastIndexOf("\n", position - 1) + 1;
|
|
27
|
+
return /^[ \t]*/.exec(content.slice(lineStart, position))?.[0] ?? "";
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Inserts a named import into an existing import from `moduleSpecifier`, or adds
|
|
31
|
+
* a fresh import statement after the last import when there is none.
|
|
32
|
+
*/
|
|
33
|
+
const withImport = ({ content, sourceFile, moduleSpecifier, importName, typeOnly, }) => {
|
|
34
|
+
const imports = sourceFile.statements.filter(ts.isImportDeclaration);
|
|
35
|
+
const existing = imports.find(declaration => ts.isStringLiteral(declaration.moduleSpecifier) && declaration.moduleSpecifier.text === moduleSpecifier);
|
|
36
|
+
const namedBindings = existing?.importClause?.namedBindings;
|
|
37
|
+
if (existing !== undefined && namedBindings !== undefined && ts.isNamedImports(namedBindings)) {
|
|
38
|
+
if (namedBindings.elements.some(element => element.name.text === importName)) {
|
|
39
|
+
return content;
|
|
40
|
+
}
|
|
41
|
+
const insertAt = namedBindings.elements[namedBindings.elements.length - 1]?.getEnd();
|
|
42
|
+
if (insertAt === undefined) {
|
|
43
|
+
return content;
|
|
44
|
+
}
|
|
45
|
+
return `${content.slice(0, insertAt)}, ${importName}${content.slice(insertAt)}`;
|
|
46
|
+
}
|
|
47
|
+
const importStatement = typeOnly
|
|
48
|
+
? `import type { ${importName} } from "${moduleSpecifier}";`
|
|
49
|
+
: `import { ${importName} } from "${moduleSpecifier}";`;
|
|
50
|
+
const lastImportEnd = imports[imports.length - 1]?.getEnd();
|
|
51
|
+
return lastImportEnd === undefined
|
|
52
|
+
? `${importStatement}\n${content}`
|
|
53
|
+
: `${content.slice(0, lastImportEnd)}\n${importStatement}${content.slice(lastImportEnd)}`;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Adds `staticData.aiNavigation` to a router's TanStack module augmentation so
|
|
57
|
+
* routes can be annotated in a typed way.
|
|
58
|
+
*/
|
|
59
|
+
const annotateRouter = (content, filePath) => {
|
|
60
|
+
const sourceFile = parse(filePath, content);
|
|
61
|
+
const augmentation = sourceFile.statements.find((statement) => ts.isModuleDeclaration(statement) && ts.isStringLiteral(statement.name) && statement.name.text === TANSTACK_MODULE);
|
|
62
|
+
const body = augmentation?.body;
|
|
63
|
+
if (body === undefined || !ts.isModuleBlock(body)) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
const alreadyDeclared = body.statements.some(statement => ts.isInterfaceDeclaration(statement) && statement.name.text === "StaticDataRouteOption");
|
|
67
|
+
if (alreadyDeclared) {
|
|
68
|
+
return null;
|
|
69
|
+
}
|
|
70
|
+
const closingBrace = body.getEnd() - 1;
|
|
71
|
+
const indentation = indentationOf(content, body.statements[0]?.getStart() ?? closingBrace);
|
|
72
|
+
const declaration = [
|
|
73
|
+
`${indentation}interface StaticDataRouteOption {`,
|
|
74
|
+
`${indentation} aiNavigation?: IrisAiNavigationRouteMetadata;`,
|
|
75
|
+
`${indentation}}`,
|
|
76
|
+
"",
|
|
77
|
+
].join("\n");
|
|
78
|
+
const withDeclaration = `${content.slice(0, closingBrace)}\n${declaration}${content.slice(closingBrace)}`;
|
|
79
|
+
return withImport({
|
|
80
|
+
content: withDeclaration,
|
|
81
|
+
sourceFile: parse(filePath, withDeclaration),
|
|
82
|
+
moduleSpecifier: IRIS_APP_API,
|
|
83
|
+
importName: "IrisAiNavigationRouteMetadata",
|
|
84
|
+
typeOnly: true,
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
const manifestObject = (sourceFile) => {
|
|
88
|
+
for (const statement of sourceFile.statements) {
|
|
89
|
+
if (!ts.isVariableStatement(statement))
|
|
90
|
+
continue;
|
|
91
|
+
for (const declaration of statement.declarationList.declarations) {
|
|
92
|
+
const initializer = declaration.initializer;
|
|
93
|
+
if (initializer !== undefined && ts.isObjectLiteralExpression(initializer)) {
|
|
94
|
+
return initializer;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return undefined;
|
|
99
|
+
};
|
|
100
|
+
const propertyValue = (object, name) => {
|
|
101
|
+
const property = object.properties.find((candidate) => ts.isPropertyAssignment(candidate) && candidate.name.getText().replace(/["']/g, "") === name);
|
|
102
|
+
return property !== undefined && ts.isStringLiteral(property.initializer) ? property.initializer.text : undefined;
|
|
103
|
+
};
|
|
104
|
+
const hasProperty = (object, name) => object.properties.some(property => property.name?.getText().replace(/["']/g, "") === name);
|
|
105
|
+
/**
|
|
106
|
+
* Points an extension manifest at its route tree so `aiNavigation` is derived at
|
|
107
|
+
* build time instead of hand-written.
|
|
108
|
+
*/
|
|
109
|
+
const annotateExtensionManifest = (content, filePath, tree) => {
|
|
110
|
+
const sourceFile = parse(filePath, content);
|
|
111
|
+
const manifest = manifestObject(sourceFile);
|
|
112
|
+
if (manifest === undefined || hasProperty(manifest, "aiNavigation")) {
|
|
113
|
+
return null;
|
|
114
|
+
}
|
|
115
|
+
const extensionType = propertyValue(manifest, "type");
|
|
116
|
+
if (extensionType === undefined || !aiNavigableExtensionTypes.some(candidate => candidate === extensionType)) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
// Only the split layout is safe to wire up automatically: importing a module
|
|
120
|
+
// that also calls `createRouter` would construct a router while the manifest
|
|
121
|
+
// is being read.
|
|
122
|
+
const projectRoot = filePath.slice(0, filePath.lastIndexOf("/"));
|
|
123
|
+
const routeTreePath = `${projectRoot}/src/routeTree.tsx`;
|
|
124
|
+
if (!tree.exists(routeTreePath) || !(tree.read(routeTreePath, "utf-8") ?? "").includes("export const routeTree")) {
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
const anchor = manifest.properties.find(property => property.name?.getText() === "sourceRoot") ?? manifest.properties[0];
|
|
128
|
+
if (anchor === undefined) {
|
|
129
|
+
return null;
|
|
130
|
+
}
|
|
131
|
+
const insertAt = anchor.getEnd() + (content.charAt(anchor.getEnd()) === "," ? 1 : 0);
|
|
132
|
+
const indentation = indentationOf(content, anchor.getStart());
|
|
133
|
+
const withProperty = `${content.slice(0, insertAt)}\n${indentation}aiNavigation: extractAiNavigationFromTanstackRouter(routeTree),${content.slice(insertAt)}`;
|
|
134
|
+
const withExtractor = withImport({
|
|
135
|
+
content: withProperty,
|
|
136
|
+
sourceFile: parse(filePath, withProperty),
|
|
137
|
+
moduleSpecifier: IRIS_APP_API,
|
|
138
|
+
importName: "extractAiNavigationFromTanstackRouter",
|
|
139
|
+
typeOnly: false,
|
|
140
|
+
});
|
|
141
|
+
return withImport({
|
|
142
|
+
content: withExtractor,
|
|
143
|
+
sourceFile: parse(filePath, withExtractor),
|
|
144
|
+
moduleSpecifier: "./src/routeTree",
|
|
145
|
+
importName: "routeTree",
|
|
146
|
+
typeOnly: false,
|
|
147
|
+
});
|
|
148
|
+
};
|
|
149
|
+
/**
|
|
150
|
+
* Makes existing Iris apps ready for AI navigation.
|
|
151
|
+
*
|
|
152
|
+
* Routers gain the `staticData.aiNavigation` augmentation, and the extension
|
|
153
|
+
* manifests of navigable extension types start deriving `aiNavigation` from
|
|
154
|
+
* their route tree. Annotating individual routes with a title and description is
|
|
155
|
+
* left to the app author; see the developer hub changelog.
|
|
156
|
+
*
|
|
157
|
+
* @param tree - Nx virtual file tree.
|
|
158
|
+
*/
|
|
159
|
+
const addAiNavigation = (tree) => {
|
|
160
|
+
let routers = 0;
|
|
161
|
+
let manifests = 0;
|
|
162
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, "/", filePath => {
|
|
163
|
+
if (isUnderNodeModulesOrDist(filePath))
|
|
164
|
+
return;
|
|
165
|
+
const isRouter = filePath.endsWith("/router.tsx") || filePath.endsWith("/router.ts");
|
|
166
|
+
const isExtensionManifest = filePath.endsWith("/extension-manifest.ts");
|
|
167
|
+
if (!isRouter && !isExtensionManifest)
|
|
168
|
+
return;
|
|
169
|
+
const content = tree.read(filePath, "utf-8");
|
|
170
|
+
if (content === null)
|
|
171
|
+
return;
|
|
172
|
+
if (isRouter) {
|
|
173
|
+
if (!content.includes(TANSTACK_MODULE))
|
|
174
|
+
return;
|
|
175
|
+
const annotatedRouter = annotateRouter(content, filePath);
|
|
176
|
+
if (annotatedRouter !== null && annotatedRouter !== content) {
|
|
177
|
+
tree.write(filePath, annotatedRouter);
|
|
178
|
+
routers += 1;
|
|
179
|
+
}
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
const annotatedManifest = annotateExtensionManifest(content, filePath, tree);
|
|
183
|
+
if (annotatedManifest !== null && annotatedManifest !== content) {
|
|
184
|
+
tree.write(filePath, annotatedManifest);
|
|
185
|
+
manifests += 1;
|
|
186
|
+
}
|
|
187
|
+
});
|
|
188
|
+
if (routers === 0 && manifests === 0) {
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
devkit_1.logger.info(`AI navigation: annotated ${routers} router(s) and ${manifests} extension manifest(s). ` +
|
|
192
|
+
"Add a title and description to the routes the assistant should offer: " +
|
|
193
|
+
"https://developer.trackunit.com/changelog/ai-navigation");
|
|
194
|
+
};
|
|
195
|
+
exports.addAiNavigation = addAiNavigation;
|
|
196
|
+
exports.default = exports.addAiNavigation;
|
|
197
|
+
//# sourceMappingURL=add-ai-navigation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-ai-navigation.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/migrations/v2-4-0/add-ai-navigation.ts"],"names":[],"mappings":";;;;AAAA,uCAAqE;AACrE,uDAAiC;AAEjC,MAAM,eAAe,GAAG,wBAAwB,CAAC;AACjD,MAAM,YAAY,GAAG,yBAAyB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,yBAAyB,GAAG;IAChC,iBAAiB;IACjB,iBAAiB;IACjB,6BAA6B;IAC7B,sBAAsB;IACtB,qBAAqB;IACrB,yBAAyB;IACzB,gCAAgC;CACxB,CAAC;AAEX,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAW,EAAE,CAC7D,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;AAEjG,MAAM,KAAK,GAAG,CAAC,QAAgB,EAAE,OAAe,EAAiB,EAAE,CACjE,EAAE,CAAC,gBAAgB,CAAC,QAAQ,EAAE,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,UAAU,CA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AAQ,EAAE,CAAC;YACb,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAC;gBAAE,OAAO;YAC/C,MAAM,eAAe,GAAG,cAAc,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;YAC1D,IAAI,eAAe,KAAK,IAAI,IAAI,eAAe,KAAK,OAAO,EAAE,CAAC;gBAC5D,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,eAAe,CAAC,CAAC;gBACtC,OAAO,IAAI,CAAC,CAAC;YACf,CAAC;YACD,OAAO;QACT,CAAC;QAED,MAAM,iBAAiB,GAAG,yBAAyB,CAAC,OAAO,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QAC7E,IAAI,iBAAiB,KAAK,IAAI,IAAI,iBAAiB,KAAK,OAAO,EAAE,CAAC;YAChE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;YACxC,SAAS,IAAI,CAAC,CAAC;QACjB,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,IAAI,OAAO,KAAK,CAAC,IAAI,SAAS,KAAK,CAAC,EAAE,CAAC;QACrC,OAAO;IACT,CAAC;IAED,eAAM,CAAC,IAAI,CACT,4BAA4B,OAAO,kBAAkB,SAAS,0BAA0B;QACtF,wEAAwE;QACxE,yDAAyD,CAC5D,CAAC;AACJ,CAAC,CAAC;AAxCW,QAAA,eAAe,mBAwC1B;AAEF,kBAAe,uBAAe,CAAC","sourcesContent":["import { logger, type Tree, visitNotIgnoredFiles } from \"@nx/devkit\";\nimport * as ts from \"typescript\";\n\nconst TANSTACK_MODULE = \"@tanstack/react-router\";\nconst IRIS_APP_API = \"@trackunit/iris-app-api\";\n\n/**\n * Extension types whose manifest can carry `aiNavigation`. Mirrors\n * `aiNavigableExtensionTypes`, kept literal here so the migration keeps working\n * against whatever version of the package a consumer is upgrading from.\n */\nconst aiNavigableExtensionTypes = [\n \"FLEET_EXTENSION\",\n \"ADMIN_EXTENSION\",\n \"IRIS_APP_SETTINGS_EXTENSION\",\n \"ASSET_HOME_EXTENSION\",\n \"SITE_HOME_EXTENSION\",\n \"CUSTOMER_HOME_EXTENSION\",\n \"ASSET_EVENTS_ACTIONS_EXTENSION\",\n] as const;\n\nconst isUnderNodeModulesOrDist = (filePath: string): boolean =>\n filePath.includes(\"node_modules/\") || filePath.includes(\"dist/\") || filePath.includes(\"/.nx/\");\n\nconst parse = (filePath: string, content: string): ts.SourceFile =>\n ts.createSourceFile(filePath, content, ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);\n\nconst indentationOf = (content: string, position: number): string => {\n const lineStart = content.lastIndexOf(\"\\n\", position - 1) + 1;\n return /^[ \\t]*/.exec(content.slice(lineStart, position))?.[0] ?? \"\";\n};\n\n/**\n * Inserts a named import into an existing import from `moduleSpecifier`, or adds\n * a fresh import statement after the last import when there is none.\n */\nconst withImport = ({\n content,\n sourceFile,\n moduleSpecifier,\n importName,\n typeOnly,\n}: {\n readonly content: string;\n readonly sourceFile: ts.SourceFile;\n readonly moduleSpecifier: string;\n readonly importName: string;\n readonly typeOnly: boolean;\n}): string => {\n const imports = sourceFile.statements.filter(ts.isImportDeclaration);\n const existing = imports.find(\n declaration =>\n ts.isStringLiteral(declaration.moduleSpecifier) && declaration.moduleSpecifier.text === moduleSpecifier\n );\n\n const namedBindings = existing?.importClause?.namedBindings;\n if (existing !== undefined && namedBindings !== undefined && ts.isNamedImports(namedBindings)) {\n if (namedBindings.elements.some(element => element.name.text === importName)) {\n return content;\n }\n const insertAt = namedBindings.elements[namedBindings.elements.length - 1]?.getEnd();\n if (insertAt === undefined) {\n return content;\n }\n return `${content.slice(0, insertAt)}, ${importName}${content.slice(insertAt)}`;\n }\n\n const importStatement = typeOnly\n ? `import type { ${importName} } from \"${moduleSpecifier}\";`\n : `import { ${importName} } from \"${moduleSpecifier}\";`;\n const lastImportEnd = imports[imports.length - 1]?.getEnd();\n\n return lastImportEnd === undefined\n ? `${importStatement}\\n${content}`\n : `${content.slice(0, lastImportEnd)}\\n${importStatement}${content.slice(lastImportEnd)}`;\n};\n\n/**\n * Adds `staticData.aiNavigation` to a router's TanStack module augmentation so\n * routes can be annotated in a typed way.\n */\nconst annotateRouter = (content: string, filePath: string): string | null => {\n const sourceFile = parse(filePath, content);\n\n const augmentation = sourceFile.statements.find(\n (statement): statement is ts.ModuleDeclaration =>\n ts.isModuleDeclaration(statement) && ts.isStringLiteral(statement.name) && statement.name.text === TANSTACK_MODULE\n );\n const body = augmentation?.body;\n if (body === undefined || !ts.isModuleBlock(body)) {\n return null;\n }\n\n const alreadyDeclared = body.statements.some(\n statement => ts.isInterfaceDeclaration(statement) && statement.name.text === \"StaticDataRouteOption\"\n );\n if (alreadyDeclared) {\n return null;\n }\n\n const closingBrace = body.getEnd() - 1;\n const indentation = indentationOf(content, body.statements[0]?.getStart() ?? closingBrace);\n const declaration = [\n `${indentation}interface StaticDataRouteOption {`,\n `${indentation} aiNavigation?: IrisAiNavigationRouteMetadata;`,\n `${indentation}}`,\n \"\",\n ].join(\"\\n\");\n\n const withDeclaration = `${content.slice(0, closingBrace)}\\n${declaration}${content.slice(closingBrace)}`;\n\n return withImport({\n content: withDeclaration,\n sourceFile: parse(filePath, withDeclaration),\n moduleSpecifier: IRIS_APP_API,\n importName: \"IrisAiNavigationRouteMetadata\",\n typeOnly: true,\n });\n};\n\nconst manifestObject = (sourceFile: ts.SourceFile): ts.ObjectLiteralExpression | undefined => {\n for (const statement of sourceFile.statements) {\n if (!ts.isVariableStatement(statement)) continue;\n for (const declaration of statement.declarationList.declarations) {\n const initializer = declaration.initializer;\n if (initializer !== undefined && ts.isObjectLiteralExpression(initializer)) {\n return initializer;\n }\n }\n }\n return undefined;\n};\n\nconst propertyValue = (object: ts.ObjectLiteralExpression, name: string): string | undefined => {\n const property = object.properties.find(\n (candidate): candidate is ts.PropertyAssignment =>\n ts.isPropertyAssignment(candidate) && candidate.name.getText().replace(/[\"']/g, \"\") === name\n );\n return property !== undefined && ts.isStringLiteral(property.initializer) ? property.initializer.text : undefined;\n};\n\nconst hasProperty = (object: ts.ObjectLiteralExpression, name: string): boolean =>\n object.properties.some(property => property.name?.getText().replace(/[\"']/g, \"\") === name);\n\n/**\n * Points an extension manifest at its route tree so `aiNavigation` is derived at\n * build time instead of hand-written.\n */\nconst annotateExtensionManifest = (content: string, filePath: string, tree: Tree): string | null => {\n const sourceFile = parse(filePath, content);\n const manifest = manifestObject(sourceFile);\n if (manifest === undefined || hasProperty(manifest, \"aiNavigation\")) {\n return null;\n }\n\n const extensionType = propertyValue(manifest, \"type\");\n if (extensionType === undefined || !aiNavigableExtensionTypes.some(candidate => candidate === extensionType)) {\n return null;\n }\n\n // Only the split layout is safe to wire up automatically: importing a module\n // that also calls `createRouter` would construct a router while the manifest\n // is being read.\n const projectRoot = filePath.slice(0, filePath.lastIndexOf(\"/\"));\n const routeTreePath = `${projectRoot}/src/routeTree.tsx`;\n if (!tree.exists(routeTreePath) || !(tree.read(routeTreePath, \"utf-8\") ?? \"\").includes(\"export const routeTree\")) {\n return null;\n }\n\n const anchor = manifest.properties.find(property => property.name?.getText() === \"sourceRoot\") ?? manifest.properties[0];\n if (anchor === undefined) {\n return null;\n }\n const insertAt = anchor.getEnd() + (content.charAt(anchor.getEnd()) === \",\" ? 1 : 0);\n const indentation = indentationOf(content, anchor.getStart());\n const withProperty = `${content.slice(0, insertAt)}\\n${indentation}aiNavigation: extractAiNavigationFromTanstackRouter(routeTree),${content.slice(insertAt)}`;\n\n const withExtractor = withImport({\n content: withProperty,\n sourceFile: parse(filePath, withProperty),\n moduleSpecifier: IRIS_APP_API,\n importName: \"extractAiNavigationFromTanstackRouter\",\n typeOnly: false,\n });\n\n return withImport({\n content: withExtractor,\n sourceFile: parse(filePath, withExtractor),\n moduleSpecifier: \"./src/routeTree\",\n importName: \"routeTree\",\n typeOnly: false,\n });\n};\n\n/**\n * Makes existing Iris apps ready for AI navigation.\n *\n * Routers gain the `staticData.aiNavigation` augmentation, and the extension\n * manifests of navigable extension types start deriving `aiNavigation` from\n * their route tree. Annotating individual routes with a title and description is\n * left to the app author; see the developer hub changelog.\n *\n * @param tree - Nx virtual file tree.\n */\nexport const addAiNavigation = (tree: Tree): void => {\n let routers = 0;\n let manifests = 0;\n\n visitNotIgnoredFiles(tree, \"/\", filePath => {\n if (isUnderNodeModulesOrDist(filePath)) return;\n\n const isRouter = filePath.endsWith(\"/router.tsx\") || filePath.endsWith(\"/router.ts\");\n const isExtensionManifest = filePath.endsWith(\"/extension-manifest.ts\");\n if (!isRouter && !isExtensionManifest) return;\n\n const content = tree.read(filePath, \"utf-8\");\n if (content === null) return;\n\n if (isRouter) {\n if (!content.includes(TANSTACK_MODULE)) return;\n const annotatedRouter = annotateRouter(content, filePath);\n if (annotatedRouter !== null && annotatedRouter !== content) {\n tree.write(filePath, annotatedRouter);\n routers += 1;\n }\n return;\n }\n\n const annotatedManifest = annotateExtensionManifest(content, filePath, tree);\n if (annotatedManifest !== null && annotatedManifest !== content) {\n tree.write(filePath, annotatedManifest);\n manifests += 1;\n }\n });\n\n if (routers === 0 && manifests === 0) {\n return;\n }\n\n logger.info(\n `AI navigation: annotated ${routers} router(s) and ${manifests} extension manifest(s). ` +\n \"Add a title and description to the routes the assistant should offer: \" +\n \"https://developer.trackunit.com/changelog/ai-navigation\"\n );\n};\n\nexport default addAiNavigation;\n"]}
|
package/migrations.json
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
1
|
{
|
|
2
|
-
"generators": {
|
|
2
|
+
"generators": {
|
|
3
|
+
"v2-4-0-add-ai-navigation": {
|
|
4
|
+
"version": "2.4.0",
|
|
5
|
+
"description": "Make Iris apps ready for AI navigation: add the staticData.aiNavigation augmentation to TanStack routers, and derive aiNavigation from the route tree in navigable extension manifests.",
|
|
6
|
+
"implementation": "./migrations/v2-4-0/add-ai-navigation"
|
|
7
|
+
}
|
|
8
|
+
}
|
|
3
9
|
}
|
package/package.json
CHANGED
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
export * from "./types/aiNavigableExtension";
|
|
1
2
|
export * from "./types/defaultValidHosts";
|
|
2
3
|
export * from "./types/extensions/adminExtensionManifest";
|
|
3
4
|
export * from "./types/extensions/assetEventsActionsExtensionManifest";
|
|
@@ -10,8 +11,11 @@ export * from "./types/extensions/reportExtensionManifest";
|
|
|
10
11
|
export * from "./types/extensions/serversideApiExtensionManifest";
|
|
11
12
|
export * from "./types/extensions/siteHomeExtensionManifest";
|
|
12
13
|
export * from "./types/extensions/widgetExtensionManifest";
|
|
14
|
+
export * from "./types/extractAiNavigationFromTanstackRouter";
|
|
13
15
|
export * from "./types/iconImage";
|
|
14
16
|
export * from "./types/icons.generated";
|
|
17
|
+
export * from "./types/irisAiNavigation";
|
|
18
|
+
export * from "./types/irisAiNavigationValidation";
|
|
15
19
|
export * from "./types/irisAppCspInput";
|
|
16
20
|
export * from "./types/irisAppCustomFields";
|
|
17
21
|
export * from "./types/irisAppExtensionManifest";
|
package/src/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./types/aiNavigableExtension"), exports);
|
|
4
5
|
tslib_1.__exportStar(require("./types/defaultValidHosts"), exports);
|
|
5
6
|
tslib_1.__exportStar(require("./types/extensions/adminExtensionManifest"), exports);
|
|
6
7
|
tslib_1.__exportStar(require("./types/extensions/assetEventsActionsExtensionManifest"), exports);
|
|
@@ -13,8 +14,11 @@ tslib_1.__exportStar(require("./types/extensions/reportExtensionManifest"), expo
|
|
|
13
14
|
tslib_1.__exportStar(require("./types/extensions/serversideApiExtensionManifest"), exports);
|
|
14
15
|
tslib_1.__exportStar(require("./types/extensions/siteHomeExtensionManifest"), exports);
|
|
15
16
|
tslib_1.__exportStar(require("./types/extensions/widgetExtensionManifest"), exports);
|
|
17
|
+
tslib_1.__exportStar(require("./types/extractAiNavigationFromTanstackRouter"), exports);
|
|
16
18
|
tslib_1.__exportStar(require("./types/iconImage"), exports);
|
|
17
19
|
tslib_1.__exportStar(require("./types/icons.generated"), exports);
|
|
20
|
+
tslib_1.__exportStar(require("./types/irisAiNavigation"), exports);
|
|
21
|
+
tslib_1.__exportStar(require("./types/irisAiNavigationValidation"), exports);
|
|
18
22
|
tslib_1.__exportStar(require("./types/irisAppCspInput"), exports);
|
|
19
23
|
tslib_1.__exportStar(require("./types/irisAppCustomFields"), exports);
|
|
20
24
|
tslib_1.__exportStar(require("./types/irisAppExtensionManifest"), exports);
|
package/src/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../libs/iris-app-sdk/iris-app-api/src/index.ts"],"names":[],"mappings":";;;AAAA,uEAA6C;AAC7C,oEAA0C;AAC1C,oFAA0D;AAC1D,iGAAuE;AACvE,wFAA8D;AAC9D,2FAAiE;AACjE,oFAA0D;AAC1D,8FAAoE;AACpE,wFAA8D;AAC9D,qFAA2D;AAC3D,4FAAkE;AAClE,uFAA6D;AAC7D,qFAA2D;AAC3D,wFAA8D;AAC9D,4DAAkC;AAClC,kEAAwC;AACxC,mEAAyC;AACzC,6EAAmD;AACnD,kEAAwC;AACxC,sEAA4C;AAC5C,2EAAiD;AACjD,4EAAkD;AAClD,kEAAwC;AACxC,qEAA2C;AAC3C,wEAA8C;AAC9C,mEAAyC;AACzC,oEAA0C;AAC1C,yDAA+B;AAC/B,uEAA6C;AAC7C,uEAA6C","sourcesContent":["export * from \"./types/aiNavigableExtension\";\nexport * from \"./types/defaultValidHosts\";\nexport * from \"./types/extensions/adminExtensionManifest\";\nexport * from \"./types/extensions/assetEventsActionsExtensionManifest\";\nexport * from \"./types/extensions/assetHomeExtensionManifest\";\nexport * from \"./types/extensions/customerHomeExtensionManifest\";\nexport * from \"./types/extensions/fleetExtensionManifest\";\nexport * from \"./types/extensions/irisAppSettingsExtensionManifest\";\nexport * from \"./types/extensions/lifecycleExtensionManifest\";\nexport * from \"./types/extensions/reportExtensionManifest\";\nexport * from \"./types/extensions/serversideApiExtensionManifest\";\nexport * from \"./types/extensions/siteHomeExtensionManifest\";\nexport * from \"./types/extensions/widgetExtensionManifest\";\nexport * from \"./types/extractAiNavigationFromTanstackRouter\";\nexport * from \"./types/iconImage\";\nexport * from \"./types/icons.generated\";\nexport * from \"./types/irisAiNavigation\";\nexport * from \"./types/irisAiNavigationValidation\";\nexport * from \"./types/irisAppCspInput\";\nexport * from \"./types/irisAppCustomFields\";\nexport * from \"./types/irisAppExtensionManifest\";\nexport * from \"./types/irisAppInstallationConfig\";\nexport * from \"./types/irisAppManifest\";\nexport * from \"./types/irisAppMarketplace\";\nexport * from \"./types/loadNxRootPackageJson\";\nexport * from \"./types/modulefederation\";\nexport * from \"./types/permissionsPolicy\";\nexport * from \"./types/scopes\";\nexport * from \"./types/serversideInterfaces\";\nexport * from \"./types/subscriptionPackages\";\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IrisAppExtensionType } from "./irisAppExtensionManifest";
|
|
2
|
+
import { IrisAppExtension } from "./irisAppManifest";
|
|
3
|
+
/**
|
|
4
|
+
* The extension types whose manifest implements {@link AiNavigableExtensionManifest},
|
|
5
|
+
* derived from the manifest union so the type level stays the single source of
|
|
6
|
+
* truth for which extensions can advertise AI navigation.
|
|
7
|
+
*/
|
|
8
|
+
export type AiNavigableExtensionType<TExtension = IrisAppExtension> = TExtension extends {
|
|
9
|
+
type: IrisAppExtensionType;
|
|
10
|
+
} ? "aiNavigation" extends keyof TExtension ? TExtension["type"] : never : never;
|
|
11
|
+
export type AiNavigableExtension = Extract<IrisAppExtension, {
|
|
12
|
+
type: AiNavigableExtensionType;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* The AI navigable extension type names, for error messages that list what is
|
|
16
|
+
* supported.
|
|
17
|
+
*
|
|
18
|
+
* @returns {ReadonlyArray<string>} The extension type names that support AI navigation.
|
|
19
|
+
*/
|
|
20
|
+
export declare const aiNavigableExtensionTypeNames: () => ReadonlyArray<string>;
|
|
21
|
+
/**
|
|
22
|
+
* Whether an extension type supports AI navigation.
|
|
23
|
+
*
|
|
24
|
+
* @param type - The extension type to check.
|
|
25
|
+
* @returns {boolean} True when a manifest of this type may carry `aiNavigation`.
|
|
26
|
+
*/
|
|
27
|
+
export declare const isAiNavigableExtensionType: (type: IrisAppExtensionType) => type is AiNavigableExtensionType;
|
|
28
|
+
/**
|
|
29
|
+
* Narrows an extension to the manifests that can carry `aiNavigation`, so
|
|
30
|
+
* callers can read the field without widening the manifest union.
|
|
31
|
+
*
|
|
32
|
+
* @param extension - The extension manifest to narrow.
|
|
33
|
+
* @returns {boolean} True when the extension supports AI navigation.
|
|
34
|
+
*/
|
|
35
|
+
export declare const isAiNavigableExtension: (extension: IrisAppExtension) => extension is AiNavigableExtension;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAiNavigableExtension = exports.isAiNavigableExtensionType = exports.aiNavigableExtensionTypeNames = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Runtime mirror of {@link AiNavigableExtensionType}, needed where the extension
|
|
6
|
+
* type is only known as data (a published manifest at the server choke point, or
|
|
7
|
+
* an installed app in the Manager host). Typing it as a total `Record` makes the
|
|
8
|
+
* compiler reject both a type that is not AI navigable and a navigable type that
|
|
9
|
+
* was forgotten here.
|
|
10
|
+
*
|
|
11
|
+
* Types without a per-extension URL (`REPORT_EXTENSION`, `WIDGET_EXTENSION`) and
|
|
12
|
+
* non-UI types are absent because they do not implement the manifest interface.
|
|
13
|
+
* Entity-scoped types require entity id(s) as navigation params at navigate time
|
|
14
|
+
* (see `getIrisHostParamNames` in the Manager AI panel).
|
|
15
|
+
*/
|
|
16
|
+
const aiNavigableExtensionTypes = {
|
|
17
|
+
FLEET_EXTENSION: true,
|
|
18
|
+
ADMIN_EXTENSION: true,
|
|
19
|
+
IRIS_APP_SETTINGS_EXTENSION: true,
|
|
20
|
+
ASSET_HOME_EXTENSION: true,
|
|
21
|
+
SITE_HOME_EXTENSION: true,
|
|
22
|
+
CUSTOMER_HOME_EXTENSION: true,
|
|
23
|
+
ASSET_EVENTS_ACTIONS_EXTENSION: true,
|
|
24
|
+
};
|
|
25
|
+
/**
|
|
26
|
+
* The AI navigable extension type names, for error messages that list what is
|
|
27
|
+
* supported.
|
|
28
|
+
*
|
|
29
|
+
* @returns {ReadonlyArray<string>} The extension type names that support AI navigation.
|
|
30
|
+
*/
|
|
31
|
+
const aiNavigableExtensionTypeNames = () => Object.keys(aiNavigableExtensionTypes);
|
|
32
|
+
exports.aiNavigableExtensionTypeNames = aiNavigableExtensionTypeNames;
|
|
33
|
+
/**
|
|
34
|
+
* Whether an extension type supports AI navigation.
|
|
35
|
+
*
|
|
36
|
+
* @param type - The extension type to check.
|
|
37
|
+
* @returns {boolean} True when a manifest of this type may carry `aiNavigation`.
|
|
38
|
+
*/
|
|
39
|
+
const isAiNavigableExtensionType = (type) => type in aiNavigableExtensionTypes;
|
|
40
|
+
exports.isAiNavigableExtensionType = isAiNavigableExtensionType;
|
|
41
|
+
/**
|
|
42
|
+
* Narrows an extension to the manifests that can carry `aiNavigation`, so
|
|
43
|
+
* callers can read the field without widening the manifest union.
|
|
44
|
+
*
|
|
45
|
+
* @param extension - The extension manifest to narrow.
|
|
46
|
+
* @returns {boolean} True when the extension supports AI navigation.
|
|
47
|
+
*/
|
|
48
|
+
const isAiNavigableExtension = (extension) => (0, exports.isAiNavigableExtensionType)(extension.type);
|
|
49
|
+
exports.isAiNavigableExtension = isAiNavigableExtension;
|
|
50
|
+
//# sourceMappingURL=aiNavigableExtension.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"aiNavigableExtension.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/src/types/aiNavigableExtension.ts"],"names":[],"mappings":";;;AAmBA;;;;;;;;;;;GAWG;AACH,MAAM,yBAAyB,GAA2C;IACxE,eAAe,EAAE,IAAI;IACrB,eAAe,EAAE,IAAI;IACrB,2BAA2B,EAAE,IAAI;IACjC,oBAAoB,EAAE,IAAI;IAC1B,mBAAmB,EAAE,IAAI;IACzB,uBAAuB,EAAE,IAAI;IAC7B,8BAA8B,EAAE,IAAI;CACrC,CAAC;AAEF;;;;;GAKG;AACI,MAAM,6BAA6B,GAAG,GAA0B,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,yBAAyB,CAAC,CAAC;AAApG,QAAA,6BAA6B,iCAAuE;AAEjH;;;;;GAKG;AACI,MAAM,0BAA0B,GAAG,CAAC,IAA0B,EAAoC,EAAE,CACzG,IAAI,IAAI,yBAAyB,CAAC;AADvB,QAAA,0BAA0B,8BACH;AAEpC;;;;;;GAMG;AACI,MAAM,sBAAsB,GAAG,CAAC,SAA2B,EAAqC,EAAE,CACvG,IAAA,kCAA0B,EAAC,SAAS,CAAC,IAAI,CAAC,CAAC;AADhC,QAAA,sBAAsB,0BACU","sourcesContent":["import { AiNavigableExtensionManifest } from \"./irisAiNavigation\";\nimport { IrisAppExtensionType } from \"./irisAppExtensionManifest\";\nimport { IrisAppExtension } from \"./irisAppManifest\";\n\n/**\n * The extension types whose manifest implements {@link AiNavigableExtensionManifest},\n * derived from the manifest union so the type level stays the single source of\n * truth for which extensions can advertise AI navigation.\n */\nexport type AiNavigableExtensionType<TExtension = IrisAppExtension> = TExtension extends {\n type: IrisAppExtensionType;\n}\n ? \"aiNavigation\" extends keyof TExtension\n ? TExtension[\"type\"]\n : never\n : never;\n\nexport type AiNavigableExtension = Extract<IrisAppExtension, { type: AiNavigableExtensionType }>;\n\n/**\n * Runtime mirror of {@link AiNavigableExtensionType}, needed where the extension\n * type is only known as data (a published manifest at the server choke point, or\n * an installed app in the Manager host). Typing it as a total `Record` makes the\n * compiler reject both a type that is not AI navigable and a navigable type that\n * was forgotten here.\n *\n * Types without a per-extension URL (`REPORT_EXTENSION`, `WIDGET_EXTENSION`) and\n * non-UI types are absent because they do not implement the manifest interface.\n * Entity-scoped types require entity id(s) as navigation params at navigate time\n * (see `getIrisHostParamNames` in the Manager AI panel).\n */\nconst aiNavigableExtensionTypes: Record<AiNavigableExtensionType, true> = {\n FLEET_EXTENSION: true,\n ADMIN_EXTENSION: true,\n IRIS_APP_SETTINGS_EXTENSION: true,\n ASSET_HOME_EXTENSION: true,\n SITE_HOME_EXTENSION: true,\n CUSTOMER_HOME_EXTENSION: true,\n ASSET_EVENTS_ACTIONS_EXTENSION: true,\n};\n\n/**\n * The AI navigable extension type names, for error messages that list what is\n * supported.\n *\n * @returns {ReadonlyArray<string>} The extension type names that support AI navigation.\n */\nexport const aiNavigableExtensionTypeNames = (): ReadonlyArray<string> => Object.keys(aiNavigableExtensionTypes);\n\n/**\n * Whether an extension type supports AI navigation.\n *\n * @param type - The extension type to check.\n * @returns {boolean} True when a manifest of this type may carry `aiNavigation`.\n */\nexport const isAiNavigableExtensionType = (type: IrisAppExtensionType): type is AiNavigableExtensionType =>\n type in aiNavigableExtensionTypes;\n\n/**\n * Narrows an extension to the manifests that can carry `aiNavigation`, so\n * callers can read the field without widening the manifest union.\n *\n * @param extension - The extension manifest to narrow.\n * @returns {boolean} True when the extension supports AI navigation.\n */\nexport const isAiNavigableExtension = (extension: IrisAppExtension): extension is AiNavigableExtension =>\n isAiNavigableExtensionType(extension.type);\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cspDirectives.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/src/types/cspDirectives.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,yFAAyF;AACzF,EAAE;;;AAEW,QAAA,uCAAuC,GAAG,yCAAyC,CAAC;AACpF,QAAA,eAAe,GAAG,iBAAiB,CAAC;AACpC,QAAA,WAAW,GAAG,aAAa,CAAC;AAC5B,QAAA,YAAY,GAAG,cAAc,CAAC;AAC9B,QAAA,sBAAsB,GAAG,wBAAwB,CAAC;AAClD,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,YAAY,GAAG,cAAc,CAAC;AAC9B,QAAA,8BAA8B,GAAG,gCAAgC,CAAC;AAClE,QAAA,kBAAkB,GAAG,oBAAoB,CAAC;AAC1C,QAAA,iBAAiB,GAAG,mBAAmB,CAAC;AACxC,QAAA,uCAAuC,GAAG,yCAAyC,CAAC;AACpF,QAAA,aAAa,GAAG,eAAe,CAAC;AAChC,QAAA,oBAAoB,GAAG,sBAAsB,CAAC;AAC9C,QAAA,uCAAuC,GAAG,yCAAyC,CAAC;AA0BpF,QAAA,IAAI,GAAG,QAAQ,CAAC;AAChB,QAAA,IAAI,GAAG,QAAQ,CAAC;AAChB,QAAA,cAAc,GAAG,kBAAkB,CAAC;AACpC,QAAA,aAAa,GAAG,iBAAiB,CAAC;AAClC,QAAA,WAAW,GAAG,eAAe,CAAC;AAC9B,QAAA,aAAa,GAAG,iBAAiB,CAAC;AAClC,QAAA,aAAa,GAAG,iBAAiB,CAAC;AAClC,QAAA,gBAAgB,GAAG,oBAAoB,CAAC;AAExC,QAAA,KAAK,GAAG,SAAS,CAAC;AAClB,QAAA,KAAK,GAAG,SAAS,CAAC","sourcesContent":["//\n// Based on types from https://www.npmjs.com/package/csp-header but adjusted to our needs\n//\n\nexport const ALLOW_DOWNLOADS_WITHOUT_USER_ACTIVATION = \"allow-downloads-without-user-activation\";\nexport const ALLOW_DOWNLOADS = \"allow-downloads\";\nexport const ALLOW_FORMS = \"allow-forms\";\nexport const ALLOW_MODALS = \"allow-modals\";\nexport const ALLOW_ORIENTATION_LOCK = \"allow-orientation-lock\";\nexport const ALLOW_POINTER_LOCK = \"allow-pointer-lock\";\nexport const ALLOW_POPUPS = \"allow-popups\";\nexport const ALLOW_POPUPS_TO_ESCAPE_SANDBOX = \"allow-popups-to-escape-sandbox\";\nexport const ALLOW_PRESENTATION = \"allow-presentation\";\nexport const ALLOW_SAME_ORIGIN = \"allow-same-origin\";\nexport const ALLOW_STORAGE_ACCESS_BY_USER_ACTIVATION = \"allow-storage-access-by-user-activation\";\nexport const ALLOW_SCRIPTS = \"allow-scripts\";\nexport const ALLOW_TOP_NAVIGATION = \"allow-top-navigation\";\nexport const ALLOW_TOP_NAVIGATION_BY_USER_ACTIVATION = \"allow-top-navigation-by-user-activation\";\n\ntype TSource = string;\ntype TNonce = `nonce-${string}`;\ntype THash = `sha${\"256\" | \"384\" | \"512\"}-${string}`;\ntype TAttrDirective = THash | typeof NONE | typeof UNSAFE_INLINE | typeof UNSAFE_HASHES;\ntype TFetchDirective =\n | TSource\n | TNonce\n | THash\n | typeof NONE\n | typeof SELF\n | typeof UNSAFE_EVAL\n | typeof UNSAFE_HASHES\n | typeof UNSAFE_INLINE;\ntype TNavigationDirective =\n | TSource\n | TNonce\n | THash\n | typeof NONE\n | typeof SELF\n | typeof UNSAFE_EVAL\n | typeof UNSAFE_HASHES\n | typeof UNSAFE_INLINE\n | typeof STRICT_DYNAMIC;\n\nexport const NONE = \"'none'\";\nexport const SELF = \"'self'\";\nexport const STRICT_DYNAMIC = \"'strict-dynamic'\";\nexport const REPORT_SAMPLE = \"'report-sample'\";\nexport const UNSAFE_EVAL = \"'unsafe-eval'\";\nexport const UNSAFE_HASHES = \"'unsafe-hashes'\";\nexport const UNSAFE_INLINE = \"'unsafe-inline'\";\nexport const WASM_UNSAFE_EVAL = \"'wasm-unsafe-eval'\";\n\nexport const ALLOW = \"'allow'\";\nexport const BLOCK = \"'block'\";\n\nexport type TWebRTCDirective = typeof ALLOW | typeof BLOCK;\n\nexport type CSPDirectives = {\n \"child-src\": Array<TFetchDirective>;\n \"connect-src\": Array<TFetchDirective>;\n \"font-src\": Array<TFetchDirective>;\n \"form-action\": Array<TNavigationDirective>;\n \"frame-src\": Array<TFetchDirective>;\n \"img-src\": Array<TFetchDirective | typeof STRICT_DYNAMIC>;\n \"media-src\": Array<TFetchDirective>;\n sandbox: Array<\n | typeof ALLOW_DOWNLOADS\n | typeof ALLOW_DOWNLOADS_WITHOUT_USER_ACTIVATION\n | typeof ALLOW_FORMS\n | typeof ALLOW_MODALS\n | typeof ALLOW_ORIENTATION_LOCK\n | typeof ALLOW_POINTER_LOCK\n | typeof ALLOW_POPUPS\n | typeof ALLOW_POPUPS_TO_ESCAPE_SANDBOX\n | typeof ALLOW_PRESENTATION\n | typeof ALLOW_SAME_ORIGIN\n | typeof ALLOW_SCRIPTS\n | typeof ALLOW_STORAGE_ACCESS_BY_USER_ACTIVATION\n | typeof ALLOW_TOP_NAVIGATION\n | typeof ALLOW_TOP_NAVIGATION_BY_USER_ACTIVATION\n >;\n \"script-src\": Array<TFetchDirective | typeof STRICT_DYNAMIC | typeof REPORT_SAMPLE | typeof WASM_UNSAFE_EVAL>;\n \"script-src-attr\": Array<TAttrDirective | typeof REPORT_SAMPLE>;\n \"script-src-elem\": Array<TFetchDirective | typeof STRICT_DYNAMIC | typeof REPORT_SAMPLE>;\n \"style-src\": Array<TFetchDirective> | typeof REPORT_SAMPLE;\n \"style-src-attr\": Array<TAttrDirective | typeof REPORT_SAMPLE>;\n \"style-src-elem\": Array<TFetchDirective | typeof REPORT_SAMPLE>;\n \"upgrade-insecure-requests\": boolean;\n \"worker-src\": Array<TFetchDirective>;\n webrtc: TWebRTCDirective;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultValidHosts.js","sourceRoot":"","sources":["../../../../../../libs/iris-app-sdk/iris-app-api/src/types/defaultValidHosts.ts"],"names":[],"mappings":";;;AAAA,mDAA8C;AAE9C;;;;;;GAMG;AACI,MAAM,iBAAiB,GAAG,GAAG,EAAE;IACpC,2EAA2E;IAC3E,OAAO;QACL,mCAAmC;QACnC,qCAAqC;QACrC,mCAAmC;QACnC,wBAAwB;QACxB,wBAAwB;QACxB,wBAAwB;QACxB,8BAA8B;QAC9B,OAAO;QACP,gCAAgC;QAChC,OAAO;QACP,QAAQ;QACR,mCAAmC;QACnC,iCAAiC,EAAE,mCAAmC;QACtE,QAAQ;QACR,gCAAgC;QAChC,QAAQ;QACR,uBAAuB;QACvB,0BAA0B;QAC1B,qBAAqB;QACrB,WAAW;QACX,yBAAyB;QACzB,WAAW;QACX,yBAAyB;QACzB,yBAAyB;KAC1B,CAAC;AACJ,CAAC,CAAC;AA5BW,QAAA,iBAAiB,qBA4B5B;AAEF;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,GAAG,EAAE;IACnC,OAAO;QACL,aAAa,EAAE,IAAA,yBAAiB,GAAE;QAClC,YAAY,EAAE,CAAC,GAAG,IAAA,yBAAiB,GAAE,EAAE,2BAAW,CAAC;QACnD,SAAS,EAAE,IAAA,yBAAiB,GAAE;QAC9B,YAAY,EAAE,IAAA,yBAAiB,GAAE;QACjC,aAAa,EAAE,IAAA,yBAAiB,GAAE;KACnC,CAAC;AACJ,CAAC,CAAC;AARW,QAAA,gBAAgB,oBAQ3B","sourcesContent":["import { UNSAFE_EVAL } from \"./cspDirectives\";\n\n/**\n * Returns default valid hosts for CSP for manager.\n *\n * ! Internal use only !\n *\n * @returns {string[]} - Array of valid hosts for CSP\n */\nexport const defaultValidHosts = () => {\n // TRY TO KEEP IN SYNC WITH CHANGES IN server.js from manager (CSP headers)\n return [\n \"https://dev.manager.trackunit.com\",\n \"https://stage.manager.trackunit.com\",\n \"https://new.manager.trackunit.com\",\n \"http://localhost:5005/\",\n \"http://localhost:5010/\",\n \"http://localhost:5011/\",\n //Allow inline data like icons\n \"data:\",\n //Allow vector based google maps\n \"blob:\",\n //IMAGES\n \"https://images.iris.trackunit.com\",\n \"https://*.awsapi.trackunit.com/\", // loading images from machines api\n //SENTRY\n \"https://browser.sentry-cdn.com\",\n //GOOGLE\n \"https://*.gstatic.com\",\n \"https://*.googleapis.com\",\n \"https://*.ggpht.com\",\n //AMPLITUDE\n \"https://*.amplitude.com\",\n //SPECCHECK\n \"https://*.speccheck.com\",\n \"https://api.hsforms.com\",\n ];\n};\n\n/**\n * Returns default CSP config\n *\n * ! Internal use only !\n */\nexport const defaultCspConfig = () => {\n return {\n \"default-src\": defaultValidHosts(),\n \"script-src\": [...defaultValidHosts(), UNSAFE_EVAL],\n \"img-src\": defaultValidHosts(),\n \"worker-src\": defaultValidHosts(),\n \"connect-src\": defaultValidHosts(),\n };\n};\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { AiNavigableExtensionManifest } from "../irisAiNavigation";
|
|
1
2
|
import { AbstractExtensionManifest, TranslationKey, Translations } from "../irisAppExtensionManifest";
|
|
2
3
|
import { AccountScope } from "../scopes";
|
|
3
|
-
export interface AdminExtensionManifest extends AbstractExtensionManifest {
|
|
4
|
+
export interface AdminExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {
|
|
4
5
|
type: "ADMIN_EXTENSION";
|
|
5
6
|
/**
|
|
6
7
|
* Conditions for the admin extension to be shown.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adminExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/adminExtensionManifest.ts"],"names":[],"mappings":"","sourcesContent":["import { AiNavigableExtensionManifest } from \"../irisAiNavigation\";\nimport { AbstractExtensionManifest, TranslationKey, Translations } from \"../irisAppExtensionManifest\";\nimport { AccountScope } from \"../scopes\";\n\nexport interface AdminExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {\n type: \"ADMIN_EXTENSION\";\n\n /**\n * Conditions for the admin extension to be shown.\n *\n * Its doing OR between the conditions of the same type:\n * - If only 1 scopes is used/filled out then the admin home extension will be shown if user has the required scope.\n * - If more scopes are used/filled out then the admin home extension will be shown for all assets that the user has one of the required scopes for.\n */\n conditions?: {\n scopes?: AccountScope | Array<AccountScope>;\n };\n\n menuItem: {\n name: string | Translations | TranslationKey;\n };\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { AiNavigableExtensionManifest } from "../irisAiNavigation";
|
|
1
2
|
import { AbstractExtensionManifest, RequiredCustomField, TranslationKey, Translations } from "../irisAppExtensionManifest";
|
|
2
3
|
import { AccountScope } from "../scopes";
|
|
3
4
|
export type EVENT_TYPE = "ALERT" | "CAN_ERROR" | "DAMAGE_REPORT" | "FLUCTUATING_CAN_ERROR" | "MACHINE_FAULT" | "SERVICE";
|
|
4
|
-
export interface AssetEventsActionsExtensionManifest extends AbstractExtensionManifest {
|
|
5
|
+
export interface AssetEventsActionsExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {
|
|
5
6
|
type: "ASSET_EVENTS_ACTIONS_EXTENSION";
|
|
6
7
|
/**
|
|
7
8
|
* Conditions for the asset events actions extension to be shown.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetEventsActionsExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/assetEventsActionsExtensionManifest.ts"],"names":[],"mappings":"","sourcesContent":["import { AiNavigableExtensionManifest } from \"../irisAiNavigation\";\nimport {\n AbstractExtensionManifest,\n RequiredCustomField,\n TranslationKey,\n Translations,\n} from \"../irisAppExtensionManifest\";\nimport { AccountScope } from \"../scopes\";\n\nexport type EVENT_TYPE =\n | \"ALERT\"\n | \"CAN_ERROR\"\n | \"DAMAGE_REPORT\"\n | \"FLUCTUATING_CAN_ERROR\"\n | \"MACHINE_FAULT\"\n | \"SERVICE\";\n\nexport interface AssetEventsActionsExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {\n type: \"ASSET_EVENTS_ACTIONS_EXTENSION\";\n /**\n * Conditions for the asset events actions extension to be shown.\n * Its doing AND between the conditions types and OR between the conditions of the same type:\n * - If only failureModeIdentifier or suspectParameterNumber or eventType or SourceAddress is used/filled out then the event needs to match the filled out property.\n * - If more failureModeIdentifier, suspectParameterNumber, SourceAddress, and eventType is used/filled out then asset events actions extension will be shown for all events that matches all FMI, SPN, and eventType.\n * - If only scopes is used/filled out then the asset events actions extension will be shown for all assets that the user has the required scopes for.\n * - If more scopes are used/filled out then the asset events actions extension will be shown for all assets that the user has one of the required scopes for.\n * - If no conditions are used/filled out then the asset events actions extension will be shown for all assets and events.\n */\n conditions?: {\n eventType?: EVENT_TYPE | Array<EVENT_TYPE>;\n sourceAddress?: number | Array<number>;\n failureModeIdentifier?: number | Array<number>;\n suspectParameterNumber?: number | Array<number>;\n scopes?: AccountScope | Array<AccountScope>;\n\n /**\n * Only entityType ASSET custom fields are supported here\n */\n requiredCustomField?: RequiredCustomField | Array<RequiredCustomField>;\n };\n menuItem: {\n name: string | Translations | TranslationKey;\n };\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { AiNavigableExtensionManifest } from "../irisAiNavigation";
|
|
1
2
|
import { AbstractExtensionManifest, RegExpType, RequiredCustomField, TranslationKey, Translations } from "../irisAppExtensionManifest";
|
|
2
3
|
import { AccountScope } from "../scopes";
|
|
3
|
-
export interface AssetHomeExtensionManifest extends AbstractExtensionManifest {
|
|
4
|
+
export interface AssetHomeExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {
|
|
4
5
|
type: "ASSET_HOME_EXTENSION";
|
|
5
6
|
/**
|
|
6
7
|
* Conditions for the asset home extension to be shown.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assetHomeExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/assetHomeExtensionManifest.ts"],"names":[],"mappings":"","sourcesContent":["import { AiNavigableExtensionManifest } from \"../irisAiNavigation\";\nimport {\n AbstractExtensionManifest,\n RegExpType,\n RequiredCustomField,\n TranslationKey,\n Translations,\n} from \"../irisAppExtensionManifest\";\nimport { AccountScope } from \"../scopes\";\n\nexport interface AssetHomeExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {\n type: \"ASSET_HOME_EXTENSION\";\n /**\n * Conditions for the asset home extension to be shown.\n * model, brand, and telematicsDeviceType are case insensitive so does not matter how you write them.\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, model, or telematicsDeviceType is used/filled out then the asset needs to match the filled out property.\n * - If only scopes is used/filled out then the asset home extension will be shown for all assets that the user has the required scopes for.\n * - If more scopes are used/filled out then the asset home extension will be shown for all assets that the user has one of the required scopes for.\n * - If no conditions are used/filled out then the asset home extension will be shown for all assets.\n */\n conditions?: {\n model?: Array<string | RegExpType> | string | RegExpType;\n brand?: Array<string | RegExpType> | string | RegExpType;\n telematicsDeviceType?: Array<string | RegExpType> | string | RegExpType;\n scopes?: AccountScope | Array<AccountScope>;\n\n /**\n * Only entityType ASSET custom fields are supported here\n */\n requiredCustomField?: RequiredCustomField | Array<RequiredCustomField>;\n };\n menuItem: {\n name: string | Translations | TranslationKey;\n };\n}\n"]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { AiNavigableExtensionManifest } from "../irisAiNavigation";
|
|
1
2
|
import { AbstractExtensionManifest, TranslationKey, Translations } from "../irisAppExtensionManifest";
|
|
2
3
|
import { AccountScope } from "../scopes";
|
|
3
|
-
export interface CustomerHomeExtensionManifest extends AbstractExtensionManifest {
|
|
4
|
+
export interface CustomerHomeExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {
|
|
4
5
|
type: "CUSTOMER_HOME_EXTENSION";
|
|
5
6
|
/**
|
|
6
7
|
* Conditions for the customer home extension to be shown.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"customerHomeExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/customerHomeExtensionManifest.ts"],"names":[],"mappings":"","sourcesContent":["import { AiNavigableExtensionManifest } from \"../irisAiNavigation\";\nimport { AbstractExtensionManifest, TranslationKey, Translations } from \"../irisAppExtensionManifest\";\nimport { AccountScope } from \"../scopes\";\n\nexport interface CustomerHomeExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {\n type: \"CUSTOMER_HOME_EXTENSION\";\n\n /**\n * Conditions for the customer home extension to be shown.\n *\n * Its doing AND between the conditions types and OR between the conditions of the same type:\n * - If only scopes is used/filled out then the extension will be shown for all customers that the user has the required permission for.\n * - If more scopes are used/filled out then the extension will be shown for all customers that the user has one of the required permission for.\n * - If showFor is used then the extension will be shown for all customers that match the showFor condition.\n * - If both scopes and showFor are used then the extension will be shown for all customers that match the showFor condition and the user has the required permission for.\n */\n conditions?: {\n scopes?: AccountScope | Array<AccountScope>;\n /**\n * - If showFor is \"ALL\" then the extension will be shown for all customers in customer home.\n * - If showFor is \"BUSINESS_UNITS\" then the extension will be shown for all business units in customer home.\n * - If showFor is \"CUSTOMERS\" then the extension will be shown for all customers that are not business units in customer home.\n */\n showFor?: \"ALL\" | \"BUSINESS_UNITS\" | \"CUSTOMERS\";\n };\n\n menuItem: {\n name: string | Translations | TranslationKey;\n };\n}\n"]}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { IconByName, IconByPath } from "../iconImage";
|
|
2
|
+
import { AiNavigableExtensionManifest } from "../irisAiNavigation";
|
|
2
3
|
import { AbstractExtensionManifest, RegExpType, TranslationKey, Translations } from "../irisAppExtensionManifest";
|
|
3
4
|
import { AccountScope } from "../scopes";
|
|
4
|
-
export interface FleetExtensionManifest extends AbstractExtensionManifest {
|
|
5
|
+
export interface FleetExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {
|
|
5
6
|
type: "FLEET_EXTENSION";
|
|
6
7
|
/**
|
|
7
8
|
* Conditions for the fleet extension to be shown.
|
|
@@ -0,0 +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, IconByPath } from \"../iconImage\";\nimport { AiNavigableExtensionManifest } from \"../irisAiNavigation\";\nimport { AbstractExtensionManifest, RegExpType, TranslationKey, Translations } from \"../irisAppExtensionManifest\";\nimport { AccountScope } from \"../scopes\";\n\nexport interface FleetExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {\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?: Array<string | RegExpType> | string | RegExpType;\n brand?: Array<string | RegExpType> | string | RegExpType;\n scopes?: AccountScope | Array<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"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import { AiNavigableExtensionManifest } from "../irisAiNavigation";
|
|
1
2
|
import { AbstractExtensionManifest } from "../irisAppExtensionManifest";
|
|
2
|
-
export interface IrisAppSettingsExtensionManifest extends AbstractExtensionManifest {
|
|
3
|
+
export interface IrisAppSettingsExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {
|
|
3
4
|
type: "IRIS_APP_SETTINGS_EXTENSION";
|
|
4
5
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"irisAppSettingsExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/irisAppSettingsExtensionManifest.ts"],"names":[],"mappings":"","sourcesContent":["import { AiNavigableExtensionManifest } from \"../irisAiNavigation\";\nimport { AbstractExtensionManifest } from \"../irisAppExtensionManifest\";\n\nexport interface IrisAppSettingsExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {\n type: \"IRIS_APP_SETTINGS_EXTENSION\";\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycleExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/lifecycleExtensionManifest.ts"],"names":[],"mappings":"","sourcesContent":["import { AbstractExtensionManifest } from \"../irisAppExtensionManifest\";\n\nexport interface LifecycleExtensionManifest extends AbstractExtensionManifest {\n type: \"LIFECYCLE_EXTENSION\";\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reportExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/reportExtensionManifest.ts"],"names":[],"mappings":"","sourcesContent":["import { IconName } from \"../icons.generated\";\nimport { AbstractExtensionManifest, TranslationKey, Translations } from \"../irisAppExtensionManifest\";\nimport { AccountScope } from \"../scopes\";\n\nexport interface ReportExtensionManifest extends AbstractExtensionManifest {\n type: \"REPORT_EXTENSION\";\n\n conditions?: {\n scopes?: AccountScope | Array<AccountScope>;\n };\n\n menuItem: {\n /**\n * Title of the card in manager\n */\n name: string | Translations | TranslationKey;\n\n /**\n * Subtitle of the card in manager\n */\n description: string | Translations | TranslationKey;\n\n /**\n * Icon of the card in manager, must use icons from:\n * https://design.iris.trackunit.com/?path=/docs/components-icon--default\n */\n icon: IconName;\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serversideApiExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/serversideApiExtensionManifest.ts"],"names":[],"mappings":"","sourcesContent":["import { AbstractExtensionManifest } from \"../irisAppExtensionManifest\";\n\nexport interface ServersideApiExtensionManifest extends AbstractExtensionManifest {\n type: \"SERVERSIDE_API_EXTENSION\";\n runtime: \"DENO\";\n id: string;\n name: string;\n description?: string;\n main: `${string}.ts` | `${string}.js`;\n dependencyDefinitionFile: string;\n}\n"]}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AiNavigableExtensionManifest } from "../irisAiNavigation";
|
|
1
2
|
import { AbstractExtensionManifest, RequiredCustomField, TranslationKey, Translations } from "../irisAppExtensionManifest";
|
|
2
3
|
import { AccountScope } from "../scopes";
|
|
3
4
|
declare const siteType: {
|
|
@@ -10,7 +11,7 @@ declare const siteType: {
|
|
|
10
11
|
readonly WORK_PLACE: "WORK_PLACE";
|
|
11
12
|
};
|
|
12
13
|
type SiteType = (typeof siteType)[keyof typeof siteType];
|
|
13
|
-
export interface SiteHomeExtensionManifest extends AbstractExtensionManifest {
|
|
14
|
+
export interface SiteHomeExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {
|
|
14
15
|
type: "SITE_HOME_EXTENSION";
|
|
15
16
|
/**
|
|
16
17
|
* Conditions for the site home extension to be shown.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"siteHomeExtensionManifest.js","sourceRoot":"","sources":["../../../../../../../libs/iris-app-sdk/iris-app-api/src/types/extensions/siteHomeExtensionManifest.ts"],"names":[],"mappings":";;AASA,6DAA6D;AAC7D,MAAM,QAAQ,GAAG;IACf,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,aAAa;IAC1B,YAAY,EAAE,cAAc;IAC5B,iBAAiB,EAAE,mBAAmB;IACtC,KAAK,EAAE,OAAO;IACd,WAAW,EAAE,aAAa;IAC1B,UAAU,EAAE,YAAY;CAChB,CAAC","sourcesContent":["import { AiNavigableExtensionManifest } from \"../irisAiNavigation\";\nimport {\n AbstractExtensionManifest,\n RequiredCustomField,\n TranslationKey,\n Translations,\n} from \"../irisAppExtensionManifest\";\nimport { AccountScope } from \"../scopes\";\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nconst siteType = {\n AREA: \"AREA\",\n CLASSIC_POI: \"CLASSIC_POI\",\n CLASSIC_ZONE: \"CLASSIC_ZONE\",\n CONSTRUCTION_SITE: \"CONSTRUCTION_SITE\",\n DEPOT: \"DEPOT\",\n NOT_ON_SITE: \"NOT_ON_SITE\",\n WORK_PLACE: \"WORK_PLACE\",\n} as const;\ntype SiteType = (typeof siteType)[keyof typeof siteType];\n\nexport interface SiteHomeExtensionManifest extends AbstractExtensionManifest, AiNavigableExtensionManifest {\n type: \"SITE_HOME_EXTENSION\";\n\n /**\n * Conditions for the site home extension to be shown.\n *\n * Its doing AND between the conditions types and OR between the conditions of the same type:\n * - If only scopes is used/filled out then the site home extension will be shown for all sites that the user has the required permission for.\n * - If more scopes are used/filled out then the site home extension will be shown for all sites that the user has one of the required permission for.\n * - If only requiredCustomField is used/filled out then the site home extension will be shown for all sites that has the required custom field.\n * - If more requiredCustomField are used/filled out then the site home extension will be shown for all sites that has all of the required custom field.\n * - If no conditions are used/filled out then the site home extension will be shown for all sites.\n */\n conditions?: {\n siteType?: Array<SiteType> | SiteType;\n scopes?: AccountScope | Array<AccountScope>;\n\n /**\n * Only entityType SITE custom fields are supported here\n */\n requiredCustomField?: RequiredCustomField | Array<RequiredCustomField>;\n };\n\n menuItem: {\n name: string | Translations | TranslationKey;\n };\n}\n"]}
|