oip-common 0.1.8 → 0.2.1

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/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import * as i0 from '@angular/core';
2
- import { OnInit, OnDestroy, WritableSignal, OnChanges, SimpleChanges, Type, Provider, InjectionToken, EventEmitter, Renderer2, EnvironmentProviders, PipeTransform } from '@angular/core';
2
+ import { OnDestroy, OnInit, DestroyRef, WritableSignal, OnChanges, SimpleChanges, Type, Provider, InjectionToken, EventEmitter, Renderer2, EnvironmentProviders, PipeTransform } from '@angular/core';
3
3
  import { MessageService, ToastMessageOptions, MenuItem, ConfirmationService, FilterMetadata } from 'primeng/api';
4
4
  import { ActivatedRoute, QueryParamsHandling, IsActiveMatchOptions, Params, Router, UrlTree } from '@angular/router';
5
5
  import { InterpolationParameters, Translation, TranslationObject, TranslateService } from '@ngx-translate/core';
6
6
  import * as rxjs from 'rxjs';
7
- import { Subscription, Subject, Observable, BehaviorSubject } from 'rxjs';
7
+ import { Observable, BehaviorSubject, Subscription, Subject } from 'rxjs';
8
8
  import { LoginResponse, AuthOptions, OidcSecurityService, LogoutAuthOptions, AbstractSecurityStorage, StsConfigHttpLoader } from 'angular-auth-oidc-client';
9
9
  import { ContextMenu } from 'primeng/contextmenu';
10
10
  import { PaletteDesignToken, Preset } from '@primeuix/themes/types';
@@ -228,6 +228,105 @@ interface SecurityDto {
228
228
  roles: string[];
229
229
  }
230
230
 
231
+ interface PutSecurityDto {
232
+ id: number;
233
+ securities: SecurityDto[];
234
+ }
235
+
236
+ declare class SecurityDataService extends BaseDataService {
237
+ getSecurity(controller: string, id: number): Promise<SecurityDto[]>;
238
+ saveSecurity(controller: string, request: PutSecurityDto): Promise<any>;
239
+ getRealmRoles(): Promise<string[]>;
240
+ static ɵfac: i0.ɵɵFactoryDeclaration<SecurityDataService, never>;
241
+ static ɵprov: i0.ɵɵInjectableDeclaration<SecurityDataService>;
242
+ }
243
+
244
+ declare abstract class SecurityService {
245
+ abstract auth(): void;
246
+ abstract logout(): void;
247
+ abstract isAuthenticated(): Observable<boolean>;
248
+ abstract getAccessToken(): Observable<string>;
249
+ abstract isTokenExpired(): Observable<boolean>;
250
+ abstract getCurrentUser(): any;
251
+ abstract getCurrentUser$(): Observable<any>;
252
+ abstract forceRefreshSession(): Observable<LoginResponse>;
253
+ abstract isAdmin(): boolean;
254
+ abstract authorize(configId?: string, authOptions?: AuthOptions): void;
255
+ abstract payload: BehaviorSubject<any>;
256
+ }
257
+ /**
258
+ * SecurityService extends OidcSecurityService to manage authentication,
259
+ * token handling, and user role access in an Angular application.
260
+ *
261
+ * It provides helper methods for checking authentication, managing tokens,
262
+ * determining user roles, and performing logout and refresh operations.
263
+ */
264
+ declare class KeycloakSecurityService extends OidcSecurityService implements OnDestroy, SecurityService {
265
+ /**
266
+ * Handles angular OIDC events.
267
+ */
268
+ private readonly publicEventsService;
269
+ /**
270
+ * Stores the latest login response from checkAuth().
271
+ */
272
+ loginResponse: BehaviorSubject<LoginResponse>;
273
+ /**
274
+ * Stores the decoded access token payload.
275
+ */
276
+ readonly payload: BehaviorSubject<any>;
277
+ /**
278
+ * Stores user-specific data from the login response.
279
+ */
280
+ private readonly currentUser;
281
+ /**
282
+ * Emits access token updates from initial auth check, manual refresh,
283
+ * and library authentication events.
284
+ */
285
+ private accessToken;
286
+ /**
287
+ * Initializes service and subscribes to authentication events.
288
+ * When a 'NewAuthenticationResult' event is received, the `auth` method is called.
289
+ */
290
+ constructor();
291
+ getCurrentUser(): any;
292
+ getCurrentUser$(): Observable<any>;
293
+ /**
294
+ * Returns the ID token for the sign-in.
295
+ * @returns A string with the id token.
296
+ */
297
+ getAccessToken(configId?: string): Observable<string>;
298
+ /**
299
+ * Indicates whether the current user has the 'admin' role.
300
+ *
301
+ * @returns {boolean} True if the user is an admin, false otherwise.
302
+ */
303
+ isAdmin(): boolean;
304
+ /**
305
+ * Initiates authentication check and updates login response, user data,
306
+ * and decoded token payload if authenticated.
307
+ */
308
+ auth(): void;
309
+ /**
310
+ * Performs logout and clears the local token payload.
311
+ *
312
+ * @param {string} [configId] Optional configuration ID for logout.
313
+ * @param {LogoutAuthOptions} [logoutAuthOptions] Optional logout options.
314
+ */
315
+ logout(configId?: string, logoutAuthOptions?: LogoutAuthOptions): void;
316
+ /**
317
+ * Completes the BehaviorSubjects when the service is destroyed to avoid memory leaks.
318
+ */
319
+ ngOnDestroy(): void;
320
+ /**
321
+ * Checks whether the current access token is expired based on the 'exp' claim.
322
+ *
323
+ * @returns {Observable<boolean>} Observable that emits true if the token is expired.
324
+ */
325
+ isTokenExpired(): Observable<boolean>;
326
+ static ɵfac: i0.ɵɵFactoryDeclaration<KeycloakSecurityService, never>;
327
+ static ɵprov: i0.ɵɵInjectableDeclaration<KeycloakSecurityService>;
328
+ }
329
+
231
330
  declare abstract class BaseModuleComponent<TBackendStoreSettings, TLocalStoreSettings> implements OnInit, OnDestroy {
232
331
  private static readonly readRight;
233
332
  private static readonly editRight;
@@ -235,9 +334,9 @@ declare abstract class BaseModuleComponent<TBackendStoreSettings, TLocalStoreSet
235
334
  private isInitialized;
236
335
  private moduleInstanceReloadPromise;
237
336
  private rightsSubscription?;
238
- private readonly destroyRef;
239
- private readonly securityDataService;
240
- private readonly securityService;
337
+ protected readonly destroyRef: DestroyRef;
338
+ protected readonly securityDataService: SecurityDataService;
339
+ protected readonly securityService: SecurityService;
241
340
  /**
242
341
  * Provide access to app settings
243
342
  */
@@ -419,92 +518,6 @@ declare class SecurityComponent implements OnChanges, OnInit, OnDestroy {
419
518
  static ɵcmp: i0.ɵɵComponentDeclaration<SecurityComponent, "security", never, { "id": { "alias": "id"; "required": false; }; "controller": { "alias": "controller"; "required": false; }; }, {}, never, never, true, never>;
420
519
  }
421
520
 
422
- declare abstract class SecurityService {
423
- abstract auth(): void;
424
- abstract logout(): void;
425
- abstract isAuthenticated(): Observable<boolean>;
426
- abstract getAccessToken(): Observable<string>;
427
- abstract isTokenExpired(): Observable<boolean>;
428
- abstract getCurrentUser(): any;
429
- abstract getCurrentUser$(): Observable<any>;
430
- abstract forceRefreshSession(): Observable<LoginResponse>;
431
- abstract isAdmin(): boolean;
432
- abstract authorize(configId?: string, authOptions?: AuthOptions): void;
433
- abstract payload: BehaviorSubject<any>;
434
- }
435
- /**
436
- * SecurityService extends OidcSecurityService to manage authentication,
437
- * token handling, and user role access in an Angular application.
438
- *
439
- * It provides helper methods for checking authentication, managing tokens,
440
- * determining user roles, and performing logout and refresh operations.
441
- */
442
- declare class KeycloakSecurityService extends OidcSecurityService implements OnDestroy, SecurityService {
443
- /**
444
- * Handles angular OIDC events.
445
- */
446
- private readonly publicEventsService;
447
- /**
448
- * Stores the latest login response from checkAuth().
449
- */
450
- loginResponse: BehaviorSubject<LoginResponse>;
451
- /**
452
- * Stores the decoded access token payload.
453
- */
454
- readonly payload: BehaviorSubject<any>;
455
- /**
456
- * Stores user-specific data from the login response.
457
- */
458
- private readonly currentUser;
459
- /**
460
- * Emits access token updates from initial auth check, manual refresh,
461
- * and library authentication events.
462
- */
463
- private accessToken;
464
- /**
465
- * Initializes service and subscribes to authentication events.
466
- * When a 'NewAuthenticationResult' event is received, the `auth` method is called.
467
- */
468
- constructor();
469
- getCurrentUser(): any;
470
- getCurrentUser$(): Observable<any>;
471
- /**
472
- * Returns the ID token for the sign-in.
473
- * @returns A string with the id token.
474
- */
475
- getAccessToken(configId?: string): Observable<string>;
476
- /**
477
- * Indicates whether the current user has the 'admin' role.
478
- *
479
- * @returns {boolean} True if the user is an admin, false otherwise.
480
- */
481
- isAdmin(): boolean;
482
- /**
483
- * Initiates authentication check and updates login response, user data,
484
- * and decoded token payload if authenticated.
485
- */
486
- auth(): void;
487
- /**
488
- * Performs logout and clears the local token payload.
489
- *
490
- * @param {string} [configId] Optional configuration ID for logout.
491
- * @param {LogoutAuthOptions} [logoutAuthOptions] Optional logout options.
492
- */
493
- logout(configId?: string, logoutAuthOptions?: LogoutAuthOptions): void;
494
- /**
495
- * Completes the BehaviorSubjects when the service is destroyed to avoid memory leaks.
496
- */
497
- ngOnDestroy(): void;
498
- /**
499
- * Checks whether the current access token is expired based on the 'exp' claim.
500
- *
501
- * @returns {Observable<boolean>} Observable that emits true if the token is expired.
502
- */
503
- isTokenExpired(): Observable<boolean>;
504
- static ɵfac: i0.ɵɵFactoryDeclaration<KeycloakSecurityService, never>;
505
- static ɵprov: i0.ɵɵInjectableDeclaration<KeycloakSecurityService>;
506
- }
507
-
508
521
  /**
509
522
  * UserService is responsible for retrieving and handling user-related data,
510
523
  * including the user's photo and short label for avatar display.
@@ -571,134 +584,58 @@ declare class FooterComponent {
571
584
  static ɵcmp: i0.ɵɵComponentDeclaration<FooterComponent, "app-footer", never, {}, {}, never, never, true, never>;
572
585
  }
573
586
 
574
- /** Data Transfer Object for creating a new module instance */
575
587
  interface AddModuleInstanceDto {
576
- /**
577
- * The identifier of the module to create an instance of
578
- * @format int32
579
- */
580
588
  moduleId?: number;
581
- /** The display label for the module instance */
582
589
  label?: string | null;
583
- /** The icon identifier for the module instance (optional) */
584
590
  icon?: string | null;
585
- /**
586
- * The parent module instance identifier (optional)
587
- * @format int32
588
- */
589
591
  parentId?: number | null;
590
- /** Array of role identifiers that can view this module instance (optional) */
591
592
  viewRoles?: string[] | null;
592
593
  }
593
- /** Data Transfer Object for editing an existing module instance */
594
594
  interface EditModuleInstanceDto {
595
- /**
596
- * The identifier of the module instance to edit
597
- * @format int32
598
- */
599
595
  moduleInstanceId?: number;
600
- /** The updated display label for the module instance */
601
596
  label?: string | null;
602
- /** The updated icon identifier for the module instance (optional) */
603
597
  icon?: string | null;
604
- /**
605
- * The updated parent module instance identifier (optional)
606
- * @format int32
607
- */
608
598
  parentId?: number | null;
609
- /** Updated array of role identifiers that can view this module instance (optional) */
610
599
  viewRoles?: string[] | null;
611
- /**
612
- * For front compatibility
613
- * @format int32
614
- */
615
600
  moduleId?: number | null;
616
601
  }
617
- /** Represents a key-value pair where the key is an integer and the value is a string. */
602
+ interface IframeModuleSettings {
603
+ url?: string | null;
604
+ }
618
605
  interface IntKeyValueDto {
619
- /** @format int32 */
620
606
  key?: number;
621
607
  value?: string | null;
622
608
  }
623
- /** It module in app */
624
609
  interface ModuleDto {
625
- /**
626
- * Id
627
- * @format int32
628
- */
629
610
  moduleId?: number;
630
- /** Name */
631
611
  name?: string | null;
632
- /** Settings */
633
612
  settings?: string | null;
634
- /** Securities */
635
613
  moduleSecurities?: ModuleSecurityDto[] | null;
636
614
  }
637
- /** Module Instance Dto */
638
615
  interface ModuleInstanceDto {
639
- /**
640
- * Unique identifier for the module instance.
641
- * @format int32
642
- */
643
616
  moduleInstanceId?: number;
644
- /**
645
- * Identifier for the module.
646
- * @format int32
647
- */
648
617
  moduleId?: number;
649
- /** The label for the module instance. */
650
618
  label?: string | null;
651
- /** Icon associated with the module instance. see https://primeng.org/icons */
652
619
  icon?: string | null;
653
- /** Route link. */
654
620
  routerLink?: string[] | null;
655
- /** URL for the module instance. */
656
621
  url?: string | null;
657
- /** The target. */
658
622
  target?: string | null;
659
- /** Configuration settings for the module instance. */
660
623
  settings?: string | null;
661
- /** Child module instances. */
662
624
  items?: ModuleInstanceDto[] | null;
663
- /** Securities */
664
625
  securities?: string[] | null;
665
- /**
666
- * Identifier for the parent module instance.
667
- * @format int32
668
- */
669
626
  parentId?: number | null;
670
- /**
671
- * Sort order position for the module instance.
672
- * @format int32
673
- */
674
627
  order?: number;
675
- /** Indicates whether this module instance should be displayed as a separator. */
676
628
  separator?: boolean;
677
629
  }
678
- /** Module security DTO */
679
630
  interface ModuleSecurityDto {
680
- /** Right */
681
631
  right: string | null;
682
- /** Role */
683
632
  role: string | null;
684
633
  }
685
634
  interface DeleteModuleInstanceParams {
686
- /**
687
- * The unique identifier of the module instance to delete.
688
- * @format int32
689
- */
690
635
  id?: number;
691
636
  }
692
637
  interface ChangeOrderParams {
693
- /**
694
- * The identifier of the first module to swap.
695
- * @format int32
696
- */
697
638
  firstModuleId?: number;
698
- /**
699
- * The identifier of the second module to swap with.
700
- * @format int32
701
- */
702
639
  secondModuleId?: number;
703
640
  }
704
641
 
@@ -837,86 +774,12 @@ declare class HttpClient<SecurityDataType = unknown> {
837
774
  }
838
775
 
839
776
  declare class MenuApi<SecurityDataType = unknown> extends HttpClient<SecurityDataType> {
840
- /**
841
- * @description Retrieves the menu available to the current authenticated user.
842
- *
843
- * @tags Menu
844
- * @name get
845
- * @summary Retrieves the menu available to the current authenticated user.
846
- * @request GET:/api/menu/get
847
- * @secure
848
- * @response `200` `(ModuleInstanceDto)[]` OK
849
- */
850
777
  get: (params?: RequestParams) => Promise<ModuleInstanceDto[]>;
851
- /**
852
- * @description Retrieves the admin-specific menu.
853
- *
854
- * @tags Menu
855
- * @name getAdminMenu
856
- * @summary Retrieves the admin-specific menu.
857
- * @request GET:/api/menu/get-admin-menu
858
- * @secure
859
- * @response `200` `(ModuleInstanceDto)[]` OK
860
- */
861
778
  getAdminMenu: (params?: RequestParams) => Promise<ModuleInstanceDto[]>;
862
- /**
863
- * @description Retrieves all available modules in the system.
864
- *
865
- * @tags Menu
866
- * @name getModules
867
- * @summary Retrieves all available modules in the system.
868
- * @request GET:/api/menu/get-modules
869
- * @secure
870
- * @response `200` `(IntKeyValueDto)[]` OK
871
- */
872
779
  getModules: (params?: RequestParams) => Promise<IntKeyValueDto[]>;
873
- /**
874
- * @description Adds a new module instance to the system.
875
- *
876
- * @tags Menu
877
- * @name addModuleInstance
878
- * @summary Adds a new module instance to the system.
879
- * @request POST:/api/menu/add-module-instance
880
- * @secure
881
- * @response `200` `void` OK
882
- * @response `500` `ApiExceptionResponse` Internal Server Error
883
- */
884
780
  addModuleInstance: (data: AddModuleInstanceDto, params?: RequestParams) => Promise<void>;
885
- /**
886
- * @description Edits an existing module instance.
887
- *
888
- * @tags Menu
889
- * @name editModuleInstance
890
- * @summary Edits an existing module instance.
891
- * @request POST:/api/menu/edit-module-instance
892
- * @secure
893
- * @response `200` `void` OK
894
- * @response `500` `ApiExceptionResponse` Internal Server Error
895
- */
896
781
  editModuleInstance: (data: EditModuleInstanceDto, params?: RequestParams) => Promise<void>;
897
- /**
898
- * @description Deletes a module instance by its identifier.
899
- *
900
- * @tags Menu
901
- * @name deleteModuleInstance
902
- * @summary Deletes a module instance by its identifier.
903
- * @request DELETE:/api/menu/delete-module-instance
904
- * @secure
905
- * @response `200` `void` OK
906
- * @response `500` `ApiExceptionResponse` Internal Server Error
907
- */
908
782
  deleteModuleInstance: (query: DeleteModuleInstanceParams, params?: RequestParams) => Promise<void>;
909
- /**
910
- * @description Swaps the order positions of two modules in the menu structure.
911
- *
912
- * @tags Menu
913
- * @name changeOrder
914
- * @summary Swaps the order positions of two modules in the menu structure.
915
- * @request POST:/api/menu/change-order
916
- * @secure
917
- * @response `200` `void` OK
918
- * @response `500` `ApiExceptionResponse` Internal Server Error
919
- */
920
783
  changeOrder: (query: ChangeOrderParams, params?: RequestParams) => Promise<void>;
921
784
  static ɵfac: i0.ɵɵFactoryDeclaration<MenuApi<any>, never>;
922
785
  static ɵprov: i0.ɵɵInjectableDeclaration<MenuApi<any>>;
@@ -1453,17 +1316,20 @@ declare class DiscussionComponent implements OnChanges, OnDestroy, OnInit {
1453
1316
  static ɵcmp: i0.ɵɵComponentDeclaration<DiscussionComponent, "discussion", never, { "objectTypeId": { "alias": "objectTypeId"; "required": true; }; "objectId": { "alias": "objectId"; "required": true; }; }, {}, never, never, true, never>;
1454
1317
  }
1455
1318
 
1456
- interface PutSecurityDto {
1457
- id: number;
1458
- securities: SecurityDto[];
1459
- }
1460
-
1461
- declare class SecurityDataService extends BaseDataService {
1462
- getSecurity(controller: string, id: number): Promise<SecurityDto[]>;
1463
- saveSecurity(controller: string, request: PutSecurityDto): Promise<any>;
1464
- getRealmRoles(): Promise<string[]>;
1465
- static ɵfac: i0.ɵɵFactoryDeclaration<SecurityDataService, never>;
1466
- static ɵprov: i0.ɵɵInjectableDeclaration<SecurityDataService>;
1319
+ declare class IframeModuleComponent extends BaseModuleComponent<IframeModuleSettings, IframeModuleSettings> implements OnInit, OnDestroy {
1320
+ private iframe?;
1321
+ private readonly renderer;
1322
+ private readonly translate;
1323
+ protected iframeUrl: string | null;
1324
+ constructor();
1325
+ private set iframeElement(value);
1326
+ private setIframeUrl;
1327
+ private isAllowedIframeUrl;
1328
+ protected onModuleInstanceChange(): Promise<void>;
1329
+ private updateIframeSrc;
1330
+ onIframeError(): void;
1331
+ static ɵfac: i0.ɵɵFactoryDeclaration<IframeModuleComponent, never>;
1332
+ static ɵcmp: i0.ɵɵComponentDeclaration<IframeModuleComponent, "ng-component", never, {}, {}, never, never, true, never>;
1467
1333
  }
1468
1334
 
1469
1335
  /**
@@ -1589,5 +1455,5 @@ declare class SecurePipe implements PipeTransform {
1589
1455
  */
1590
1456
  declare const httpLoaderAuthFactory: (httpClient: HttpClient$1) => StsConfigHttpLoader;
1591
1457
 
1592
- export { APP_THEME_PRESETS, APP_THEME_PRESETS_MERGE_MODE, AppConfiguratorComponent, AppFloatingConfiguratorComponent, AppLayoutComponent, AppModulesComponent, AppTopbar, AuthGuardService, BaseDataService, BaseModuleComponent, ConfigComponent, ContentType, DEFAULT_OIP_FRONTEND_CONFIG, DbMigrationComponent, DiscussionComponent, ErrorComponent, FooterComponent, HttpClient, KeycloakSecurityService, L10nService, LOGO_COMPONENT_TOKEN, LayoutService, LogoComponent, LogoService, MenuComponent, MenuService, MsgService, NotfoundComponent, NotificationService, OIP_FRONTEND_CONFIG, ProfileComponent, SecurePipe, SecurityComponent, SecurityDataService, SecurityService, SecurityStorageService, SidebarComponent, TableFilterService, TopBarService, UnauthorizedComponent, UserService, httpLoaderAuthFactory, langIntercept, mergeWithDefaults, provideAppThemes, provideLogoComponent, replaceDefaults };
1458
+ export { APP_THEME_PRESETS, APP_THEME_PRESETS_MERGE_MODE, AppConfiguratorComponent, AppFloatingConfiguratorComponent, AppLayoutComponent, AppModulesComponent, AppTopbar, AuthGuardService, BaseDataService, BaseModuleComponent, ConfigComponent, ContentType, DEFAULT_OIP_FRONTEND_CONFIG, DbMigrationComponent, DiscussionComponent, ErrorComponent, FooterComponent, HttpClient, IframeModuleComponent, KeycloakSecurityService, L10nService, LOGO_COMPONENT_TOKEN, LayoutService, LogoComponent, LogoService, MenuComponent, MenuService, MsgService, NotfoundComponent, NotificationService, OIP_FRONTEND_CONFIG, ProfileComponent, SecurePipe, SecurityComponent, SecurityDataService, SecurityService, SecurityStorageService, SidebarComponent, TableFilterService, TopBarService, UnauthorizedComponent, UserService, httpLoaderAuthFactory, langIntercept, mergeWithDefaults, provideAppThemes, provideLogoComponent, replaceDefaults };
1593
1459
  export type { AppConfig, AppThemePreset, AppThemePresetMergeMode, LanguageDto, MenuChangeEvent, NoSettingsDto, OipFrontendAppMode, OipFrontendConfig, PutSecurityDto, RequestParams, SecurityDto, TopBarDto };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oip-common",
3
- "version": "0.1.8",
3
+ "version": "0.2.1",
4
4
  "description": "A template for cross-platform web applications based on sakai-ng and primeNG",
5
5
  "main": "index.js",
6
6
  "keywords": [
@@ -12,22 +12,23 @@ parser.add_argument("-i", "--input", { help: "Input swagger file path" });
12
12
  parser.add_argument("-t", "--templates", { help: "Templates" });
13
13
  parser.add_argument("-d", "--data-contract-prefix", { help: "Data Contract Prefix" });
14
14
  parser.add_argument("-c", "--use-common-client", { action: "store_true", help: "Use common http client" });
15
+ parser.add_argument("--disable-jsdoc", { action: "store_true", help: "Disable JSDoc generation" });
15
16
 
16
17
  let a = parser.parse_args();
17
18
  a.data_contract_prefix ??= "";
18
19
 
19
- console.log(a);
20
20
  /* NOTE: all fields are optional expect one of `input`, `url`, `spec` */
21
21
 
22
22
  let config = {
23
23
  input: path.resolve(process.cwd(), a.input),
24
24
  templates: path.resolve(process.cwd(), a.templates),
25
- httpClientType: "fetch", // or "fetch"
25
+ httpClientType: "fetch",
26
26
  defaultResponseAsSuccess: false,
27
27
  generateClient: true,
28
28
  useCommonClient: a.use_common_client,
29
29
  generateRouteTypes: false,
30
30
  generateResponses: true,
31
+ generateJSDoc: !a.disable_jsdoc,
31
32
  toJS: false,
32
33
  extractRequestParams: true,
33
34
  extractRequestBody: true,
@@ -2,6 +2,8 @@
2
2
  const { data, utils } = it;
3
3
  const { formatDescription, escapeJSDocContent, require, _ } = utils;
4
4
 
5
+ if (it.config.generateJSDoc === false) return "";
6
+
5
7
  const stringify = (value) => _.isObject(value) ? JSON.stringify(value) : _.isString(value) ? `"${value}"` : value;
6
8
 
7
9
  const jsDocLines = _.compact([
@@ -2,6 +2,8 @@
2
2
  const { field, utils } = it;
3
3
  const { formatDescription, escapeJSDocContent, require, _ } = utils;
4
4
 
5
+ if (it.config.generateJSDoc === false) return "";
6
+
5
7
  const comments = _.uniq(
6
8
  _.compact([
7
9
  field.title && formatDescription(field.title),
@@ -5,7 +5,8 @@ const { _, getInlineParseContent, getParseContent, parseSchema, getComponentByRe
5
5
  const { parameters, path, method, payload, query, formData, security, requestParams } = route.request;
6
6
  const { type, errorType, contentTypes } = route.response;
7
7
  const { HTTP_CLIENT, RESERVED_REQ_PARAMS_ARG_NAMES } = config.constants;
8
- const routeDocs = includeFile("./route-docs", { config, route, utils });
8
+ const shouldGenerateJSDoc = config.generateJSDoc !== false;
9
+ const routeDocs = shouldGenerateJSDoc ? includeFile("./route-docs", { config, route, utils }) : null;
9
10
  const queryName = (query && query.name) || "query";
10
11
  const pathParams = _.values(parameters);
11
12
  const pathParamsNames = _.map(pathParams, "name");
@@ -82,6 +83,7 @@ const describeReturnType = () => {
82
83
  const isValidIdentifier = (name) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name);
83
84
 
84
85
  %>
86
+ <% if (shouldGenerateJSDoc) { %>
85
87
  /**
86
88
  <%~ routeDocs.description %>
87
89
 
@@ -90,6 +92,7 @@ const isValidIdentifier = (name) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name);
90
92
  <%~ routeDocs.lines %>
91
93
 
92
94
  */
95
+ <% } %>
93
96
  <% if (isValidIdentifier(route.routeName.usage)) { %><%~ route.routeName.usage %><% } else { %>"<%~ route.routeName.usage %>"<% } %> = (<%~ wrapperArgs %>)<%~ config.toJS ? `: ${describeReturnType()}` : "" %> =>
94
97
  <%~ config.singleHttpClient ? 'this.http.request' : 'this.request' %><<%~ type %>, <%~ errorType %>>({
95
98
  path: `<%~ path %>`,
@@ -3,18 +3,21 @@ const { route, utils, config } = it;
3
3
  const { _, pascalCase, require } = utils;
4
4
  const { query, payload, pathParams, headers } = route.request;
5
5
 
6
- const routeDocs = includeFile("./route-docs", { config, route, utils });
6
+ const shouldGenerateJSDoc = config.generateJSDoc !== false;
7
+ const routeDocs = shouldGenerateJSDoc ? includeFile("./route-docs", { config, route, utils }) : null;
7
8
  const isValidIdentifier = (name) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name);
8
9
  const routeNamespace = pascalCase(route.routeName.usage);
9
10
 
10
11
  %>
11
12
 
13
+ <% if (shouldGenerateJSDoc) { %>
12
14
  /**
13
15
  <%~ routeDocs.description %>
14
16
 
15
17
  <%~ routeDocs.lines %>
16
18
 
17
19
  */
20
+ <% } %>
18
21
  export namespace <% if (isValidIdentifier(routeNamespace)) { %><%~ routeNamespace %><% } else { %>"<%~ routeNamespace %>"<% } %> {
19
22
  export type RequestParams = <%~ (pathParams && pathParams.type) || '{}' %>;
20
23
  export type RequestQuery = <%~ (query && query.type) || '{}' %>;