Skip to content

Conversation

@ghostrider-05
Copy link
Owner

@ghostrider-05 ghostrider-05 commented May 12, 2025

Changes this PR makes

Exports the cache as an extendeable cache to be used in other areas in this library.

Refactor changes on PatreonMockCache:

  • remove onMissingRelationship option
  • change initial option from a Map to an array of items
  • remove store property
  • remove random generated attributes merged with request body
  • remove setRequestBody in favor of sync* methods
  • simplify some relationship methods
  • make relationships and attributes on cache item partial (and nullable)

Other changes:

feat(PatreonMock)!: change mock handler to be async and rename body argument to text

feat(PatreonMock)!: set all cache and random options to default to true

feat(PatreonMock): add responseOptions: cache, random and unknownCacheResponse options

feat(PatreonMock): add cache and random options to getMockHandlers method

feat(openapi): mark DELETE /api/oauth2/v2/webhooks/:id as documented

fix(openapi): only show retry-after header on 429 status

fix(openapi): improve json:api schemas

feat(WebhookClient): remove experimental warning from delete webhook method

fix: export types for oauth client with options

@github-actions github-actions bot added the webhooks Webhooks for Patreon API label May 12, 2025
@ghostrider-05 ghostrider-05 marked this pull request as draft May 12, 2025 16:55
@github-actions github-actions bot added the oauth Oauth2 for Patreon API label May 13, 2025
@ghostrider-05 ghostrider-05 changed the title feat!: refactor cache feat(mock)!: refactor cache May 26, 2025
@ghostrider-05 ghostrider-05 added this to the v0.15.0 milestone May 27, 2025
@ghostrider-05 ghostrider-05 changed the title feat(mock)!: refactor cache feat(PatreonMock)!: refactor cache Jun 4, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Jun 18, 2025

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 79.05%
🟰 ±0%
619 / 783
🔵 Statements 78.35%
🟰 ±0%
695 / 887
🔵 Functions 74.49%
🟰 ±0%
257 / 345
🔵 Branches 69.21%
🟰 ±0%
416 / 601
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/payloads/v2/normalized/find.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/payloads/v2/normalized/index.ts 100%
🟰 ±0%
87.5%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/rest/v2/query.ts 50%
🟰 ±0%
100%
🟰 ±0%
0%
🟰 ±0%
50%
🟰 ±0%
14
src/rest/v2/clients/baseMethods.ts 76.92%
🟰 ±0%
31.57%
🟰 ±0%
62.96%
🟰 ±0%
82.97%
🟰 ±0%
244, 246, 248, 250, 82, 121-122, 218-240, 293-305
src/rest/v2/clients/user.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/rest/v2/oauth2/client.ts 87.77%
🟰 ±0%
77.27%
🟰 ±0%
100%
🟰 ±0%
91.54%
🟰 ±0%
167-171, 187, 255, 260, 276, 300, 369
src/rest/v2/oauth2/scopes.ts 100%
🟰 ±0%
95.23%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/rest/v2/oauth2/store.ts 53.65%
🟰 ±0%
40.62%
🟰 ±0%
46.42%
🟰 ±0%
51.42%
🟰 ±0%
46, 68, 100, 101-140, 180-177
src/rest/v2/webhooks/client.ts 94.44%
🟰 ±0%
75%
🟰 ±0%
90.9%
🟰 ±0%
94.11%
🟰 ±0%
155-158
src/rest/v2/webhooks/server.ts 0%
🟰 ±0%
0%
🟰 ±0%
0%
🟰 ±0%
0%
🟰 ±0%
22-34
src/schemas/v2/query.ts 98.96%
🟰 ±0%
97.22%
🟰 ±0%
98.03%
🟰 ±0%
98.85%
🟰 ±0%
368
src/schemas/v2/cache/promise.ts 66.66%
🟰 ±0%
50%
🟰 ±0%
80%
🟰 ±0%
75%
🟰 ±0%
12, 20
src/schemas/v2/cache/shared.ts 68.57%
🟰 ±0%
53.57%
🟰 ±0%
63.15%
🟰 ±0%
70.58%
🟰 ±0%
56, 78-79, 85, 92-96, 101, 108-109
src/schemas/v2/cache/store.ts 37.14%
🟰 ±0%
37.14%
🟰 ±0%
41.17%
🟰 ±0%
36.95%
🟰 ±0%
123-127, 140, 150-153, 180-192, 205-228, 246-311, 342-371, 392-399, 467, 471, 475, 481, 485, 489
src/schemas/v2/cache/token.ts 100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
100%
🟰 ±0%
src/schemas/v2/cache/bindings/memory.ts 90%
🟰 ±0%
55.55%
🟰 ±0%
83.33%
🟰 ±0%
89.47%
🟰 ±0%
23, 39-44
Generated in workflow #789 for commit bcabe71 by the Vitest Coverage Report Action

@github-actions github-actions bot added the documentation Improvements or additions to documentation label Jun 19, 2025
@cloudflare-workers-and-pages
Copy link

Deploying patreon-api with  Cloudflare Pages  Cloudflare Pages

Latest commit: 5145d5f
Status: ✅  Deploy successful!
Preview URL: https://e13c5ed8.patreon-api.pages.dev
Branch Preview URL: https://refactor-cache.patreon-api.pages.dev

View logs

@github-actions github-actions bot added the test label Jun 26, 2025
@ghostrider-05 ghostrider-05 marked this pull request as ready for review June 30, 2025 20:12
@ghostrider-05 ghostrider-05 removed this from the v0.15.0 milestone Aug 2, 2025
@ghostrider-05 ghostrider-05 merged commit 904962b into main Oct 31, 2025
12 of 13 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in patreon-api.ts Oct 31, 2025
@ghostrider-05 ghostrider-05 deleted the refactor-cache branch October 31, 2025 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking change documentation Improvements or additions to documentation oauth Oauth2 for Patreon API test webhooks Webhooks for Patreon API

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants