@gandalan/weblibs 1.5.25 → 1.5.27

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,4 +1,21 @@
1
1
  export * from "./index.js";
2
+ export { IDASFactory } from "./api/IDAS.js";
3
+ export { RESTClient } from "./api/RESTClient.js";
4
+ export { initIDAS } from "./api/authUtils.js";
5
+ export { createApi, fluentApi } from "./api/fluentApi.js";
6
+ export { createIDASApi, idasFluentApi } from "./api/idasFluentApi.js";
7
+ export { createAuthManager, fluentIdasAuthManager } from "./api/fluentAuthManager.js";
8
+ export { fetchEnvConfig } from "./api/fluentEnvUtils.js";
9
+ export { restClient } from "./api/fluentRestClient.js";
10
+ export function createApi(): FluentApi;
11
+ export function fluentApi(url: string, authManager: FluentAuthManager | null, serviceName: string): FluentApi;
12
+ export function createIDASApi(): IDASFluentApi;
13
+ export function idasFluentApi(url: string, authManager: FluentAuthManager, serviceName: string): IDASFluentApi;
14
+ export function createAuthManager(): FluentAuthManager;
15
+ export function fluentIdasAuthManager(appToken: string, authBaseUrl: string): FluentAuthManager;
16
+ export function fetchEnvConfig(envConfig?: string): Promise<EnvironmentConfig>;
17
+ export function restClient(): FluentRESTClient;
18
+ export function initIDAS(appToken: string): Promise<Settings | null>;
2
19
 
3
20
  export type AblageApi = {
4
21
  get: (guid: string) => Promise<AblageDTO>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gandalan/weblibs",
3
- "version": "1.5.25",
3
+ "version": "1.5.27",
4
4
  "description": "WebLibs for Gandalan JS/TS projects",
5
5
  "keywords": [
6
6
  "gandalan"
@@ -18,13 +18,34 @@ const dtoLeafDirectory = path.join(rootDir, "api", "dtos");
18
18
  const businessLeafDirectory = path.join(rootDir, "api", "business");
19
19
  const uiLeafDirectory = path.join(rootDir, "ui");
20
20
 
21
- const sourceDirectories = ["api", "ui"];
22
-
23
21
  const dtoRootMarkerStart = "// BEGIN GENERATED ROOT DTO TYPEDEFS";
24
22
  const dtoRootMarkerEnd = "// END GENERATED ROOT DTO TYPEDEFS";
25
23
  const businessRootMarkerStart = "// BEGIN GENERATED ROOT BUSINESS TYPEDEFS";
26
24
  const businessRootMarkerEnd = "// END GENERATED ROOT BUSINESS TYPEDEFS";
27
25
 
26
+ const rootValueExportStatements = [
27
+ "export { IDASFactory } from \"./api/IDAS.js\";",
28
+ "export { RESTClient } from \"./api/RESTClient.js\";",
29
+ "export { initIDAS } from \"./api/authUtils.js\";",
30
+ "export { createApi, fluentApi } from \"./api/fluentApi.js\";",
31
+ "export { createIDASApi, idasFluentApi } from \"./api/idasFluentApi.js\";",
32
+ "export { createAuthManager, fluentIdasAuthManager } from \"./api/fluentAuthManager.js\";",
33
+ "export { fetchEnvConfig } from \"./api/fluentEnvUtils.js\";",
34
+ "export { restClient } from \"./api/fluentRestClient.js\";"
35
+ ];
36
+
37
+ const rootFunctionDeclarationStatements = [
38
+ "export function createApi(): FluentApi;",
39
+ "export function fluentApi(url: string, authManager: FluentAuthManager | null, serviceName: string): FluentApi;",
40
+ "export function createIDASApi(): IDASFluentApi;",
41
+ "export function idasFluentApi(url: string, authManager: FluentAuthManager, serviceName: string): IDASFluentApi;",
42
+ "export function createAuthManager(): FluentAuthManager;",
43
+ "export function fluentIdasAuthManager(appToken: string, authBaseUrl: string): FluentAuthManager;",
44
+ "export function fetchEnvConfig(envConfig?: string): Promise<EnvironmentConfig>;",
45
+ "export function restClient(): FluentRESTClient;",
46
+ "export function initIDAS(appToken: string): Promise<Settings | null>;"
47
+ ];
48
+
28
49
  const simpleImportTypePattern = /^import\((?:"|').+(?:"|')\)\.[A-Za-z0-9_$]+$/;
29
50
  const returnTypeOfCreateApiPattern = /^ReturnType<\s*typeof\s+(create[A-Za-z0-9_$]+Api)\s*>$/;
30
51
 
@@ -244,16 +265,6 @@ function toRelativeImportPath(fromFilePath, targetFilePath) {
244
265
  return relativePath.startsWith(".") ? relativePath : `./${relativePath}`;
245
266
  }
246
267
 
247
- function toRelativeDtsImportPath(fromFilePath, targetFilePath) {
248
- const importPath = toRelativeImportPath(fromFilePath, targetFilePath);
249
-
250
- if (targetFilePath === path.join(rootDir, "api", "neherApp3Types.js")) {
251
- return importPath.replace(/\.js$/, "");
252
- }
253
-
254
- return importPath;
255
- }
256
-
257
268
  function getJSDocBlocks(source) {
258
269
  return source.match(/\/\*\*[\s\S]*?\*\//g) ?? [];
259
270
  }
@@ -1501,6 +1512,8 @@ function replaceGeneratedBlock(source, startMarker, endMarker, generatedBlock, t
1501
1512
  function buildRootDts(publicTypeEntries) {
1502
1513
  const lines = [
1503
1514
  "export * from \"./index.js\";",
1515
+ ...rootValueExportStatements,
1516
+ ...rootFunctionDeclarationStatements,
1504
1517
  ""
1505
1518
  ];
1506
1519