@baadal-sdk/dapi 0.31.5 → 1.0.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.
Files changed (51) hide show
  1. package/README.md +62 -2
  2. package/dist/index.d.ts +674 -0
  3. package/dist/index.js +1118 -0
  4. package/dist/index.js.map +1 -0
  5. package/package.json +44 -106
  6. package/LICENSE.txt +0 -21
  7. package/dist/cjs/index.js +0 -3
  8. package/dist/cjs/index.js.LICENSE.txt +0 -1
  9. package/dist/cjs/index.js.map +0 -1
  10. package/dist/cjs/package.json +0 -3
  11. package/dist/esm/index.js +0 -3
  12. package/dist/esm/index.js.LICENSE.txt +0 -1
  13. package/dist/esm/index.js.map +0 -1
  14. package/dist/esm/package.json +0 -3
  15. package/dist/types/aws/client.d.ts +0 -13
  16. package/dist/types/aws/client.d.ts.map +0 -1
  17. package/dist/types/aws/db.d.ts +0 -291
  18. package/dist/types/aws/db.d.ts.map +0 -1
  19. package/dist/types/aws/index.d.ts +0 -12
  20. package/dist/types/aws/index.d.ts.map +0 -1
  21. package/dist/types/aws/s3.d.ts +0 -90
  22. package/dist/types/aws/s3.d.ts.map +0 -1
  23. package/dist/types/common/common.model.d.ts +0 -4
  24. package/dist/types/common/common.model.d.ts.map +0 -1
  25. package/dist/types/common/const.d.ts +0 -4
  26. package/dist/types/common/const.d.ts.map +0 -1
  27. package/dist/types/common/error.d.ts +0 -4
  28. package/dist/types/common/error.d.ts.map +0 -1
  29. package/dist/types/common/logger.d.ts +0 -29
  30. package/dist/types/common/logger.d.ts.map +0 -1
  31. package/dist/types/fs/index.d.ts +0 -102
  32. package/dist/types/fs/index.d.ts.map +0 -1
  33. package/dist/types/gh/index.d.ts +0 -22
  34. package/dist/types/gh/index.d.ts.map +0 -1
  35. package/dist/types/index.d.ts +0 -13
  36. package/dist/types/index.d.ts.map +0 -1
  37. package/dist/types/utils/index.d.ts +0 -6
  38. package/dist/types/utils/index.d.ts.map +0 -1
  39. package/src/aws/client.ts +0 -18
  40. package/src/aws/db.ts +0 -764
  41. package/src/aws/index.ts +0 -33
  42. package/src/aws/s3.ts +0 -476
  43. package/src/common/common.model.ts +0 -3
  44. package/src/common/const.ts +0 -3
  45. package/src/common/error.ts +0 -12
  46. package/src/common/logger.ts +0 -18
  47. package/src/fs/index.ts +0 -316
  48. package/src/gh/index.ts +0 -60
  49. package/src/index.ts +0 -8
  50. package/src/typings/index.d.ts +0 -0
  51. package/src/utils/index.ts +0 -39
package/README.md CHANGED
@@ -1,2 +1,62 @@
1
- # dapi
2
- Dead-simple API wrappers
1
+ # @baadal-sdk/dapi
2
+
3
+ Dead-simple API wrappers for AWS, GitHub, and common utils
4
+
5
+ ## AWS
6
+ ```bash
7
+ brew install awscli
8
+ aws --version
9
+ aws configure # creates `~/.aws/credentials` and `~/.aws/config`
10
+ ```
11
+
12
+ ```js
13
+ import { aws } from '@baadal-sdk/dapi'
14
+
15
+ await aws.db.writeItem({
16
+ table: 'greetings',
17
+ { msg: 'hello world' }, // data
18
+ })
19
+
20
+ await aws.s3.putObject(
21
+ 'mybucket',
22
+ 'greetings/msg.txt', // s3 path
23
+ 'hello world', // contents
24
+ )
25
+ ```
26
+
27
+ ## GitHub
28
+
29
+ ```js
30
+ import { gh } from '@baadal-sdk/dapi'
31
+
32
+ const github = gh.getInstance(process.env.GITHUB_TOKEN!, 'org-name')
33
+ const { data } = await github.getContent('repo-name', 'packages/client/CHANGELOG.md')
34
+ console.log(data.content)
35
+ ```
36
+
37
+ ## fs (file system)
38
+
39
+ ```js
40
+ import { fs } from '@baadal-sdk/dapi'
41
+
42
+ const filepath = 'demo/sandbox/01/02/hello.txt'
43
+ await fs.writeFile(filepath, 'hello world')
44
+ ```
45
+
46
+ ```
47
+ > tree demo/sandbox
48
+
49
+ demo/sandbox
50
+ ├── 01
51
+ │   └── 02
52
+ │   └── hello.txt
53
+ ├── sample.txt
54
+ └── xyz
55
+ ```
56
+
57
+ ```js
58
+ const dirpath = 'demo/sandbox'
59
+ const output = await fs.readDir(dirpath)
60
+ console.log(output)
61
+ // { dirs: [ '01', 'xyz' ], files: [ 'sample.txt' ] }
62
+ ```