@cap-js/cds-types 0.0.1 → 0.1.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/apis/test.d.ts CHANGED
@@ -1,7 +1,10 @@
1
1
  import { AxiosInstance } from 'axios';
2
- import * as chai from 'chai';
2
+ import chai from 'chai';
3
3
  import * as http from 'http';
4
4
  import { Service } from './services';
5
+ import * as cds from './cds'
6
+
7
+ type _cds = typeof cds
5
8
 
6
9
  declare class Axios {
7
10
  get axios(): AxiosInstance;
@@ -24,7 +27,10 @@ declare class Axios {
24
27
  declare class DataUtil {
25
28
  delete(db?: Service): Promise<void>;
26
29
  reset(db?: Service): Promise<void>;
27
- /** @deprecated */ autoReset(enabled: boolean): this;
30
+ /**
31
+ * @deprecated if needed, call `reset()`, considering test performance
32
+ */
33
+ autoReset(enabled: boolean): this;
28
34
  }
29
35
 
30
36
  declare class Test extends Axios {
@@ -34,13 +40,16 @@ declare class Test extends Axios {
34
40
  run(cmd: string, ...args: string[]): this;
35
41
  in(...paths: string[]): this;
36
42
  silent(): this;
37
- /** @deprecated */ verbose(v: boolean): this;
43
+ /**
44
+ * @deprecated Server log is shown by default. Use `log()` to get control over it.
45
+ */
46
+ verbose(v: boolean): this;
38
47
 
39
48
  get chai(): typeof chai;
40
49
  get expect(): typeof chai.expect;
41
50
  get assert(): typeof chai.assert;
42
51
  get data(): DataUtil;
43
- get cds(): typeof import('./cds')
52
+ get cds(): _cds
44
53
 
45
54
  log() : {
46
55
  output: string
@@ -63,19 +72,16 @@ declare class Test extends Axios {
63
72
  // restore(): (...args: TArgs) => TReturnValue;
64
73
  // }
65
74
 
66
- export = cds
67
-
68
- declare class cds {
69
- test: {
75
+ declare const test: {
70
76
  Test: typeof Test
71
77
  /**
72
- * @see [capire docs](https://cap.cloud.sap/docs/node.js/cds-test?q=cds.test#run)
78
+ * @see [capire docs](https://cap.cloud.sap/docs/node.js/cds-test#class-cds-test-test)
73
79
  */
74
- (projectDir: string): Test;
80
+ (dirname: string): Test;
75
81
  /**
76
- * @see [capire docs](https://cap.cloud.sap/docs/node.js/cds-test?q=cds.test#run-2)
82
+ * @see [capire docs](https://cap.cloud.sap/docs/node.js/cds-test#class-cds-test-test)
77
83
  */
78
84
  (command: string, ...args: string[]): Test;
79
- in (string) : Test
80
- }
85
+
86
+ in (dirname: string) : Test
81
87
  }
package/apis/utils.d.ts CHANGED
@@ -1,95 +1,89 @@
1
- export = cds
2
-
3
1
  import * as fs from 'node:fs'
4
2
 
5
- declare class cds {
6
-
3
+ /**
4
+ * Provides a set of utility functionss
5
+ */
6
+ declare const utils : {
7
7
  /**
8
- * Provides a set of utility functionss
8
+ * Generates a new v4 UUID
9
+ * @see https://cap.cloud.sap/docs/node.js/cds-facade#cds-utils
9
10
  */
10
- utils : {
11
- /**
12
- * Generates a new v4 UUID
13
- * @see https://cap.cloud.sap/docs/node.js/cds-facade#cds-utils
14
- */
15
- uuid () : string
11
+ uuid () : string
16
12
 
17
- /**
18
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#decodeuri
19
- */
20
- decodeURI(input: string): string
13
+ /**
14
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#decodeuri
15
+ */
16
+ decodeURI(input: string): string
21
17
 
22
- /**
23
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#decodeuricomponent
24
- */
25
- decodeURIComponent(input: string): string
18
+ /**
19
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#decodeuricomponent
20
+ */
21
+ decodeURIComponent(input: string): string
26
22
 
27
- /**
28
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#local-filename
29
- */
30
- local(filename: string): string
23
+ /**
24
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#local-filename
25
+ */
26
+ local(filename: string): string
31
27
 
32
- /**
33
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#exists-file
34
- */
35
- exist(file: string): boolean
28
+ /**
29
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#exists-file
30
+ */
31
+ exist(file: string): boolean
36
32
 
37
- /**
38
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#isdir-file
39
- */
40
- isdir(file: string): string
33
+ /**
34
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#isdir-file
35
+ */
36
+ isdir(file: string): string
41
37
 
42
- /**
43
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#isdir-file
44
- */
45
- isfile(file: string): string
38
+ /**
39
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#isdir-file
40
+ */
41
+ isfile(file: string): string
46
42
 
47
- /**
48
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-read-file
49
- */
50
- read(file: string): Promise<Buffer | {}>
43
+ /**
44
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-read-file
45
+ */
46
+ read(file: string): Promise<Buffer | {}>
51
47
 
52
- /**
53
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-write-data-to-file
54
- */
55
- write: {
56
- (data: Object): {
57
- to(...file: string[]): Promise<ReturnType<typeof fs.promises.writeFile>>
58
- }
59
- (file: string, data: Object): Promise<ReturnType<typeof fs.promises.writeFile>>
48
+ /**
49
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-write-data-to-file
50
+ */
51
+ write: {
52
+ (data: Object): {
53
+ to(...file: string[]): Promise<ReturnType<typeof fs.promises.writeFile>>
60
54
  }
55
+ (file: string, data: Object): Promise<ReturnType<typeof fs.promises.writeFile>>
56
+ }
61
57
 
62
- /**
63
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-copy-src-to-dst
64
- */
65
- copy: {
66
- (src: string): {
67
- to(...dst: string[]): Promise<ReturnType<typeof fs.promises.copyFile>>
68
- }
69
- (dst: string, src: string): Promise<ReturnType<typeof fs.promises.copyFile>>
58
+ /**
59
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-copy-src-to-dst
60
+ */
61
+ copy: {
62
+ (src: string): {
63
+ to(...dst: string[]): Promise<ReturnType<typeof fs.promises.copyFile>>
70
64
  }
65
+ (dst: string, src: string): Promise<ReturnType<typeof fs.promises.copyFile>>
66
+ }
67
+
68
+ /**
69
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-mkdirp-path
70
+ */
71
+ mkdirp: (...path: string[]) => Promise<string>
72
+
73
+ /**
74
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-rmdir-path
75
+ */
76
+ rmdir: (...path: string[]) => Promise<ReturnType<typeof fs.promises.rm>>
71
77
 
72
- /**
73
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-mkdirp-path
74
- */
75
- mkdirp: (...path: string[]) => Promise<string>
76
-
77
- /**
78
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-rmdir-path
79
- */
80
- rmdir: (...path: string[]) => Promise<ReturnType<typeof fs.promises.rm>>
81
-
82
78
 
83
- /**
84
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-rimraf-path
85
- */
86
- rimraf: (...path: string[]) => Promise<ReturnType<typeof fs.promises.rm>>
87
-
79
+ /**
80
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-rimraf-path
81
+ */
82
+ rimraf: (...path: string[]) => Promise<ReturnType<typeof fs.promises.rm>>
83
+
88
84
 
89
- /**
90
- * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-rm-path
91
- */
92
- rm: (...path: string[]) => Promise<ReturnType<typeof fs.promises.rm>>
93
-
94
- }
85
+ /**
86
+ * @see https://cap.cloud.sap/docs/node.js/cds-utils#async-rm-path
87
+ */
88
+ rm: (...path: string[]) => Promise<ReturnType<typeof fs.promises.rm>>
95
89
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cap-js/cds-types",
3
- "version": "0.0.1",
3
+ "version": "0.1.0",
4
4
  "description": "Type definitions for main packages of CAP, like `@sap/cds`",
5
5
  "repository": "github:cap-js/cds-types",
6
6
  "homepage": "https://cap.cloud.sap/",
@@ -18,13 +18,15 @@
18
18
  "README.md"
19
19
  ],
20
20
  "scripts": {
21
- "test": "jest --silent"
21
+ "test": "jest --silent",
22
+ "api-extractor": "api-extractor run --local --verbose"
22
23
  },
23
24
  "peerDependencies": {
24
25
  "@sap/cds": ">=7"
25
26
  },
26
27
  "devDependencies": {
27
28
  "@sap/cds": "^7.4.0",
29
+ "@types/node": "^20",
28
30
  "axios": "^1.6.2",
29
31
  "chai": "^4.3.10",
30
32
  "jest": "^29.7.0",