@saavn-labs/sdk 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.
Files changed (103) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +339 -0
  3. package/dist/core/models/album.d.ts +32 -0
  4. package/dist/core/models/album.js +1 -0
  5. package/dist/core/models/artist.d.ts +61 -0
  6. package/dist/core/models/artist.js +1 -0
  7. package/dist/core/models/index.d.ts +4 -0
  8. package/dist/core/models/index.js +4 -0
  9. package/dist/core/models/playlist.d.ts +35 -0
  10. package/dist/core/models/playlist.js +1 -0
  11. package/dist/core/models/song.d.ts +52 -0
  12. package/dist/core/models/song.js +1 -0
  13. package/dist/core/modules/album.module.d.ts +82 -0
  14. package/dist/core/modules/album.module.js +74 -0
  15. package/dist/core/modules/artist.module.d.ts +97 -0
  16. package/dist/core/modules/artist.module.js +49 -0
  17. package/dist/core/modules/extras.module.d.ts +385 -0
  18. package/dist/core/modules/extras.module.js +64 -0
  19. package/dist/core/modules/playlist.module.d.ts +79 -0
  20. package/dist/core/modules/playlist.module.js +74 -0
  21. package/dist/core/modules/song.module.d.ts +91 -0
  22. package/dist/core/modules/song.module.js +97 -0
  23. package/dist/helpers/errors.d.ts +25 -0
  24. package/dist/helpers/errors.js +84 -0
  25. package/dist/helpers/experimental/stream-urls/index.d.ts +20 -0
  26. package/dist/helpers/experimental/stream-urls/index.js +33 -0
  27. package/dist/helpers/experimental/stream-urls/stream-urls.edge.d.ts +4 -0
  28. package/dist/helpers/experimental/stream-urls/stream-urls.edge.js +38 -0
  29. package/dist/helpers/experimental/stream-urls/stream-urls.node.d.ts +4 -0
  30. package/dist/helpers/experimental/stream-urls/stream-urls.node.js +27 -0
  31. package/dist/helpers/fetch.d.ts +38 -0
  32. package/dist/helpers/fetch.js +38 -0
  33. package/dist/helpers/utils.d.ts +13 -0
  34. package/dist/helpers/utils.js +58 -0
  35. package/dist/index.d.ts +10 -0
  36. package/dist/index.js +8 -0
  37. package/dist/saavn/common-mapper.d.ts +77 -0
  38. package/dist/saavn/common-mapper.js +348 -0
  39. package/dist/saavn/entities/album.entity.d.ts +151 -0
  40. package/dist/saavn/entities/album.entity.js +25 -0
  41. package/dist/saavn/entities/artist.entity.d.ts +274 -0
  42. package/dist/saavn/entities/artist.entity.js +49 -0
  43. package/dist/saavn/entities/base.d.ts +117 -0
  44. package/dist/saavn/entities/base.js +71 -0
  45. package/dist/saavn/entities/extras.d.ts +102 -0
  46. package/dist/saavn/entities/extras.js +43 -0
  47. package/dist/saavn/entities/index.d.ts +6 -0
  48. package/dist/saavn/entities/index.js +6 -0
  49. package/dist/saavn/entities/playlist.entity.d.ts +143 -0
  50. package/dist/saavn/entities/playlist.entity.js +55 -0
  51. package/dist/saavn/entities/show.entity.d.ts +14 -0
  52. package/dist/saavn/entities/show.entity.js +14 -0
  53. package/dist/saavn/entities/song.entity.d.ts +142 -0
  54. package/dist/saavn/entities/song.entity.js +48 -0
  55. package/dist/saavn/operations/get-details/index.d.ts +755 -0
  56. package/dist/saavn/operations/get-details/index.js +34 -0
  57. package/dist/saavn/operations/get-details/mapper.ops.d.ts +35 -0
  58. package/dist/saavn/operations/get-details/mapper.ops.js +55 -0
  59. package/dist/saavn/operations/get-details/schema.ops.d.ts +706 -0
  60. package/dist/saavn/operations/get-details/schema.ops.js +49 -0
  61. package/dist/saavn/operations/get-reco/index.d.ts +144 -0
  62. package/dist/saavn/operations/get-reco/index.js +19 -0
  63. package/dist/saavn/operations/get-reco/mapper.ops.d.ts +36 -0
  64. package/dist/saavn/operations/get-reco/mapper.ops.js +43 -0
  65. package/dist/saavn/operations/get-reco/schema.ops.d.ts +103 -0
  66. package/dist/saavn/operations/get-reco/schema.ops.js +28 -0
  67. package/dist/saavn/operations/get-trending/index.d.ts +288 -0
  68. package/dist/saavn/operations/get-trending/index.js +24 -0
  69. package/dist/saavn/operations/get-trending/mapper.ops.d.ts +13 -0
  70. package/dist/saavn/operations/get-trending/mapper.ops.js +134 -0
  71. package/dist/saavn/operations/get-trending/schema.ops.d.ts +272 -0
  72. package/dist/saavn/operations/get-trending/schema.ops.js +34 -0
  73. package/dist/saavn/operations/index.d.ts +6 -0
  74. package/dist/saavn/operations/index.js +6 -0
  75. package/dist/saavn/operations/search-results/index.d.ts +790 -0
  76. package/dist/saavn/operations/search-results/index.js +29 -0
  77. package/dist/saavn/operations/search-results/mapper.ops.d.ts +413 -0
  78. package/dist/saavn/operations/search-results/mapper.ops.js +80 -0
  79. package/dist/saavn/operations/search-results/schema.ops.d.ts +366 -0
  80. package/dist/saavn/operations/search-results/schema.ops.js +101 -0
  81. package/dist/saavn/operations/web-api/index.d.ts +604 -0
  82. package/dist/saavn/operations/web-api/index.js +29 -0
  83. package/dist/saavn/operations/web-api/mapper.ops.d.ts +11 -0
  84. package/dist/saavn/operations/web-api/mapper.ops.js +23 -0
  85. package/dist/saavn/operations/web-api/schema.ops.d.ts +582 -0
  86. package/dist/saavn/operations/web-api/schema.ops.js +50 -0
  87. package/dist/saavn/operations/web-radio/index.d.ts +181 -0
  88. package/dist/saavn/operations/web-radio/index.js +19 -0
  89. package/dist/saavn/operations/web-radio/mapper.ops.d.ts +14 -0
  90. package/dist/saavn/operations/web-radio/mapper.ops.js +35 -0
  91. package/dist/saavn/operations/web-radio/schema.ops.d.ts +162 -0
  92. package/dist/saavn/operations/web-radio/schema.ops.js +56 -0
  93. package/dist/saavn/primitives/enums.d.ts +17 -0
  94. package/dist/saavn/primitives/enums.js +4 -0
  95. package/dist/saavn/primitives/string.d.ts +5 -0
  96. package/dist/saavn/primitives/string.js +22 -0
  97. package/dist/saavn/run-operation.d.ts +12 -0
  98. package/dist/saavn/run-operation.js +39 -0
  99. package/dist/schemas/index.d.ts +2188 -0
  100. package/dist/schemas/index.js +14 -0
  101. package/dist/types.d.ts +24 -0
  102. package/dist/types.js +1 -0
  103. package/package.json +82 -0
@@ -0,0 +1,14 @@
1
+ import { SaavnGetDetailsSchema } from '../saavn/operations/get-details/schema.ops';
2
+ import { SaavnGetRecoSchema } from '../saavn/operations/get-reco/schema.ops';
3
+ import { SaavnGetTrendingSchema } from '../saavn/operations/get-trending/schema.ops';
4
+ import { SaavnSearchResultsSchema } from '../saavn/operations/search-results/schema.ops';
5
+ import { SaavnWebAPISchema } from '../saavn/operations/web-api/schema.ops';
6
+ import { SaavnWebRadioSchema } from '../saavn/operations/web-radio/schema.ops';
7
+ export const schemas = {
8
+ details: SaavnGetDetailsSchema,
9
+ recommendations: SaavnGetRecoSchema,
10
+ trending: SaavnGetTrendingSchema,
11
+ search: SaavnSearchResultsSchema,
12
+ webApi: SaavnWebAPISchema,
13
+ webRadio: SaavnWebRadioSchema,
14
+ };
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ export type EntityType = 'album' | 'artist' | 'label' | 'playlist' | 'show' | 'song';
3
+ export interface ClientConfig {
4
+ baseUrl: string;
5
+ fetch?: typeof fetch;
6
+ timeoutMs?: number;
7
+ }
8
+ type ImageResolution = '50x50' | '150x150' | '500x500';
9
+ export type Image = {
10
+ url: string;
11
+ resolution: ImageResolution;
12
+ };
13
+ export type SaavnOperation = {
14
+ call: string;
15
+ schema: {
16
+ params: z.ZodType;
17
+ response: z.ZodType;
18
+ };
19
+ };
20
+ export interface SaavnPermalinkToken {
21
+ type: EntityType;
22
+ token: string;
23
+ }
24
+ export {};
package/dist/types.js ADDED
@@ -0,0 +1 @@
1
+ import { z } from 'zod';
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "@saavn-labs/sdk",
3
+ "version": "0.1.0",
4
+ "description": "A low-level, type-safe TypeScript SDK over JioSaavn’s native API, built for developers who want full control, predictable contracts, and long-term stability.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.js",
11
+ "types": "./dist/index.d.ts"
12
+ },
13
+ "./*": null
14
+ },
15
+ "typesVersions": {
16
+ "*": {
17
+ "*": [
18
+ "dist/index.d.ts"
19
+ ]
20
+ }
21
+ },
22
+ "files": [
23
+ "dist",
24
+ "README.md",
25
+ "LICENSE"
26
+ ],
27
+ "scripts": {
28
+ "build": "tsc -p tsconfig.build.json && tsc-alias -p tsconfig.build.json",
29
+ "test": "vitest",
30
+ "test:run": "vitest run",
31
+ "examples:api": "bun examples/api/server.ts",
32
+ "prettier": "prettier --write ."
33
+ },
34
+ "keywords": [
35
+ "saavn-labs",
36
+ "jiosaavn",
37
+ "saavn",
38
+ "music",
39
+ "api",
40
+ "sdk",
41
+ "typescript",
42
+ "cloudflare-workers",
43
+ "vercel-serverless",
44
+ "vercel-edge",
45
+ "bun",
46
+ "deno",
47
+ "streaming",
48
+ "download",
49
+ "songs",
50
+ "albums",
51
+ "artists",
52
+ "playlists",
53
+ "trending"
54
+ ],
55
+ "author": "Saavn Labs <saavnlabs@gmail.com>",
56
+ "license": "MIT",
57
+ "repository": {
58
+ "type": "git",
59
+ "url": "https://github.com/saavn-labs/sdk.git"
60
+ },
61
+ "publishConfig": {
62
+ "access": "public"
63
+ },
64
+ "bugs": {
65
+ "url": "https://github.com/saavn-labs/sdk/issues"
66
+ },
67
+ "homepage": "https://github.com/saavn-labs/sdk#readme",
68
+ "dependencies": {
69
+ "zod": "^4.2.1"
70
+ },
71
+ "devDependencies": {
72
+ "@types/bun": "latest",
73
+ "prettier": "^3.7.4",
74
+ "tsc-alias": "^1.8.16",
75
+ "typescript": "^5.9.3",
76
+ "vite-tsconfig-paths": "^6.0.3",
77
+ "vitest": "^4.0.16"
78
+ },
79
+ "engines": {
80
+ "node": ">=18"
81
+ }
82
+ }