oip-common 0.3.1 → 0.3.3
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/fesm2022/oip-common.mjs +12 -0
- package/fesm2022/oip-common.mjs.map +1 -1
- package/index.d.ts +9 -3
- package/package.json +1 -1
- package/scripts/generate-api.mjs +22 -2
package/index.d.ts
CHANGED
|
@@ -399,9 +399,11 @@ declare abstract class BaseModuleComponent<TBackendStoreSettings, TLocalStoreSet
|
|
|
399
399
|
private static readonly readRight;
|
|
400
400
|
private static readonly editRight;
|
|
401
401
|
private static readonly deleteRight;
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
402
|
+
protected isInitialized: boolean;
|
|
403
|
+
protected moduleInstanceReloadPromise: Promise<void>;
|
|
404
|
+
protected rightsSubscription?: Subscription;
|
|
405
|
+
protected securityRoles: string[];
|
|
406
|
+
protected securitySettings: SecurityDto[];
|
|
405
407
|
protected readonly destroyRef: DestroyRef;
|
|
406
408
|
protected readonly securityService: SecurityService;
|
|
407
409
|
protected readonly httpClient: HttpClient<any>;
|
|
@@ -512,6 +514,10 @@ declare abstract class BaseModuleComponent<TBackendStoreSettings, TLocalStoreSet
|
|
|
512
514
|
* Gets an instant translation for a key or an array of keys.
|
|
513
515
|
*/
|
|
514
516
|
t(key: string | string[], interpolateParams?: InterpolationParameters): Translation | TranslationObject;
|
|
517
|
+
/**
|
|
518
|
+
* Checks whether the current user has the specified security right.
|
|
519
|
+
*/
|
|
520
|
+
hasRight(code: string): boolean;
|
|
515
521
|
/**
|
|
516
522
|
* Initializes the component and subscribes to local settings updates.
|
|
517
523
|
*/
|
package/package.json
CHANGED
package/scripts/generate-api.mjs
CHANGED
|
@@ -82,8 +82,28 @@ let config = {
|
|
|
82
82
|
onCreateRequestParams: (rawType) => {},
|
|
83
83
|
onCreateRoute: (routeData) => {},
|
|
84
84
|
onCreateRouteName: (routeNameInfo, rawRouteInfo) => {
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
const route = rawRouteInfo.route || rawRouteInfo.path || "<unknown route>";
|
|
86
|
+
const method = rawRouteInfo.method || rawRouteInfo.requestMethod || "<unknown method>";
|
|
87
|
+
const tags = Array.isArray(rawRouteInfo.tags) ? rawRouteInfo.tags.join(", ") : (rawRouteInfo.tags || "<none>");
|
|
88
|
+
const moduleName = rawRouteInfo.moduleName;
|
|
89
|
+
|
|
90
|
+
if (!moduleName) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
`Invalid API route name for ${method.toUpperCase()} ${route}. Missing moduleName. Tags: ${tags}. ` +
|
|
93
|
+
"Add a controller tag/module name or provide explicit operationId.",
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (routeNameInfo.usage === moduleName) {
|
|
98
|
+
throw new Error(
|
|
99
|
+
`Invalid API route name for ${method.toUpperCase()} ${route}. Generated usage "${routeNameInfo.usage}" ` +
|
|
100
|
+
`equals moduleName "${moduleName}". Add an action segment in controller route, ` +
|
|
101
|
+
`e.g. [HttpGet("get-${moduleName}")], or provide explicit operationId.`,
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
if (routeNameInfo.usage.startsWith(moduleName)) {
|
|
106
|
+
const str = routeNameInfo.usage.substring(moduleName.length);
|
|
87
107
|
routeNameInfo.usage = str[0].toLowerCase() + str.slice(1);
|
|
88
108
|
routeNameInfo.original = routeNameInfo.usage;
|
|
89
109
|
}
|