@torqlab/strava-api 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 (79) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +167 -0
  3. package/dist/client/client.d.ts +34 -0
  4. package/dist/client/client.d.ts.map +1 -0
  5. package/dist/client/create-error/create-error.d.ts +13 -0
  6. package/dist/client/create-error/create-error.d.ts.map +1 -0
  7. package/dist/client/create-error/index.d.ts +2 -0
  8. package/dist/client/create-error/index.d.ts.map +1 -0
  9. package/dist/client/get-auth-headers/get-auth-headers.d.ts +22 -0
  10. package/dist/client/get-auth-headers/get-auth-headers.d.ts.map +1 -0
  11. package/dist/client/get-auth-headers/index.d.ts +2 -0
  12. package/dist/client/get-auth-headers/index.d.ts.map +1 -0
  13. package/dist/client/handle-fetch-error/handle-fetch-error.d.ts +19 -0
  14. package/dist/client/handle-fetch-error/handle-fetch-error.d.ts.map +1 -0
  15. package/dist/client/handle-fetch-error/index.d.ts +2 -0
  16. package/dist/client/handle-fetch-error/index.d.ts.map +1 -0
  17. package/dist/client/handle-rate-limit/constants.d.ts +3 -0
  18. package/dist/client/handle-rate-limit/constants.d.ts.map +1 -0
  19. package/dist/client/handle-rate-limit/handle-rate-limit.d.ts +32 -0
  20. package/dist/client/handle-rate-limit/handle-rate-limit.d.ts.map +1 -0
  21. package/dist/client/handle-rate-limit/index.d.ts +2 -0
  22. package/dist/client/handle-rate-limit/index.d.ts.map +1 -0
  23. package/dist/client/handle-retry/handle-retry.d.ts +30 -0
  24. package/dist/client/handle-retry/handle-retry.d.ts.map +1 -0
  25. package/dist/client/handle-retry/index.d.ts +2 -0
  26. package/dist/client/handle-retry/index.d.ts.map +1 -0
  27. package/dist/client/handle-retry/types.d.ts +7 -0
  28. package/dist/client/handle-retry/types.d.ts.map +1 -0
  29. package/dist/client/index.d.ts +4 -0
  30. package/dist/client/index.d.ts.map +1 -0
  31. package/dist/client/parse-error/index.d.ts +2 -0
  32. package/dist/client/parse-error/index.d.ts.map +1 -0
  33. package/dist/client/parse-error/parse-error.d.ts +14 -0
  34. package/dist/client/parse-error/parse-error.d.ts.map +1 -0
  35. package/dist/client/parse-error-code/index.d.ts +2 -0
  36. package/dist/client/parse-error-code/index.d.ts.map +1 -0
  37. package/dist/client/parse-error-code/parse-error-code.d.ts +12 -0
  38. package/dist/client/parse-error-code/parse-error-code.d.ts.map +1 -0
  39. package/dist/client/parse-response/index.d.ts +2 -0
  40. package/dist/client/parse-response/index.d.ts.map +1 -0
  41. package/dist/client/parse-response/parse-response.d.ts +30 -0
  42. package/dist/client/parse-response/parse-response.d.ts.map +1 -0
  43. package/dist/constants.d.ts +35 -0
  44. package/dist/constants.d.ts.map +1 -0
  45. package/dist/exchange-token/exchange-token.d.ts +36 -0
  46. package/dist/exchange-token/exchange-token.d.ts.map +1 -0
  47. package/dist/exchange-token/index.d.ts +2 -0
  48. package/dist/exchange-token/index.d.ts.map +1 -0
  49. package/dist/fetch-activities/fetch-activities.d.ts +39 -0
  50. package/dist/fetch-activities/fetch-activities.d.ts.map +1 -0
  51. package/dist/fetch-activities/index.d.ts +2 -0
  52. package/dist/fetch-activities/index.d.ts.map +1 -0
  53. package/dist/fetch-activity/fetch-activity.d.ts +49 -0
  54. package/dist/fetch-activity/fetch-activity.d.ts.map +1 -0
  55. package/dist/fetch-activity/index.d.ts +2 -0
  56. package/dist/fetch-activity/index.d.ts.map +1 -0
  57. package/dist/get-auth-url/get-auth-url.d.ts +30 -0
  58. package/dist/get-auth-url/get-auth-url.d.ts.map +1 -0
  59. package/dist/get-auth-url/index.d.ts +2 -0
  60. package/dist/get-auth-url/index.d.ts.map +1 -0
  61. package/dist/index.cjs +473 -0
  62. package/dist/index.d.ts +6 -0
  63. package/dist/index.d.ts.map +1 -0
  64. package/dist/index.mjs +431 -0
  65. package/dist/refresh-token/index.d.ts +2 -0
  66. package/dist/refresh-token/index.d.ts.map +1 -0
  67. package/dist/refresh-token/refresh-token.d.ts +34 -0
  68. package/dist/refresh-token/refresh-token.d.ts.map +1 -0
  69. package/dist/refresh-token/types.d.ts +5 -0
  70. package/dist/refresh-token/types.d.ts.map +1 -0
  71. package/dist/types.d.ts +192 -0
  72. package/dist/types.d.ts.map +1 -0
  73. package/dist/validators/index.d.ts +2 -0
  74. package/dist/validators/index.d.ts.map +1 -0
  75. package/dist/validators/validate-activity-id/index.d.ts +2 -0
  76. package/dist/validators/validate-activity-id/index.d.ts.map +1 -0
  77. package/dist/validators/validate-activity-id/validate-activity-id.d.ts +22 -0
  78. package/dist/validators/validate-activity-id/validate-activity-id.d.ts.map +1 -0
  79. package/package.json +69 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../validators/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export { default } from './validate-activity-id';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../validators/validate-activity-id/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Validates the format of a Strava activity ID.
3
+ *
4
+ * Ensures the activity ID is a valid numeric string that can be used to fetch
5
+ * activity data from the Strava API. Activity IDs must be positive numbers.
6
+ *
7
+ * @param {string} activityId - The activity ID to validate (can be string or number).
8
+ * @returns {void}
9
+ * @throws {Error} Throws an error with ActivityError structure if validation fails.
10
+ * Error codes: 'INVALID_ID' for all validation failures.
11
+ * The error is not retryable.
12
+ *
13
+ * @example
14
+ * ```typescript
15
+ * validateActivityId('123456789'); // Valid
16
+ * validateActivityId(''); // Throws INVALID_ID error
17
+ * validateActivityId('abc'); // Throws INVALID_ID error
18
+ * ```
19
+ */
20
+ declare const validateActivityId: (activityId: string) => void;
21
+ export default validateActivityId;
22
+ //# sourceMappingURL=validate-activity-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate-activity-id.d.ts","sourceRoot":"","sources":["../../../validators/validate-activity-id/validate-activity-id.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,QAAA,MAAM,kBAAkB,GAAI,YAAY,MAAM,KAAG,IAuBhD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,69 @@
1
+ {
2
+ "name": "@torqlab/strava-api",
3
+ "version": "1.0.0",
4
+ "description": "Strava API client with automatic rate limiting, retry handling, and comprehensive type safety.",
5
+ "license": "MIT",
6
+ "author": {
7
+ "name": "Bohdan Balov",
8
+ "email": "balovbohdan@gmail.com",
9
+ "url": "https://balov.dev"
10
+ },
11
+ "keywords": [
12
+ "strava",
13
+ "torq"
14
+ ],
15
+ "type": "module",
16
+ "main": "dist/index.cjs",
17
+ "module": "dist/index.mjs",
18
+ "types": "dist/index.d.ts",
19
+ "exports": {
20
+ ".": {
21
+ "types": "./dist/index.d.ts",
22
+ "import": "./dist/index.mjs",
23
+ "require": "./dist/index.cjs"
24
+ }
25
+ },
26
+ "files": [
27
+ "dist"
28
+ ],
29
+ "engines": {
30
+ "node": "24.x"
31
+ },
32
+ "publishConfig": {
33
+ "registry": "https://registry.npmjs.org/",
34
+ "access": "public"
35
+ },
36
+ "repository": {
37
+ "type": "git",
38
+ "url": "https://github.com/torqlab/strava-api.git"
39
+ },
40
+ "homepage": "https://github.com/torqlab/strava-api",
41
+ "bugs": {
42
+ "url": "https://github.com/torqlab/strava-api/issues"
43
+ },
44
+ "scripts": {
45
+ "build:types": "bunx tsc -p tsconfig.build.json",
46
+ "build:esm": "bun build ./index.ts --outfile dist/index.mjs --target node",
47
+ "build:cjs": "bun build ./index.ts --outfile dist/index.cjs --target node --format cjs",
48
+ "build": "bun run clean && bun run build:types && bun run build:esm && bun run build:cjs",
49
+ "test": "bun test",
50
+ "lint": "eslint . --ext .ts",
51
+ "format": "prettier --write .",
52
+ "format:check": "prettier --check .",
53
+ "prepare": "husky",
54
+ "prepublishOnly": "bun run build",
55
+ "clean": "rm -rf dist"
56
+ },
57
+ "devDependencies": {
58
+ "@eslint/js": "^9.15.0",
59
+ "@types/bun": "^1.1.13",
60
+ "bun": "^1.1.38",
61
+ "eslint": "^9.15.0",
62
+ "eslint-config-prettier": "^9.1.0",
63
+ "eslint-plugin-jsdoc": "^50.5.0",
64
+ "husky": "^9.1.7",
65
+ "prettier": "^3.3.3",
66
+ "typescript": "^5.6.3",
67
+ "typescript-eslint": "^8.15.0"
68
+ }
69
+ }