@oxyhq/core 3.16.1 → 3.17.1

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 (45) hide show
  1. package/dist/cjs/.tsbuildinfo +1 -1
  2. package/dist/cjs/HttpService.js +8 -1
  3. package/dist/cjs/OxyServices.base.js +25 -0
  4. package/dist/cjs/mixins/OxyServices.links.js +6 -2
  5. package/dist/esm/.tsbuildinfo +1 -1
  6. package/dist/esm/HttpService.js +8 -1
  7. package/dist/esm/OxyServices.base.js +25 -0
  8. package/dist/esm/mixins/OxyServices.links.js +6 -2
  9. package/dist/types/.tsbuildinfo +1 -1
  10. package/dist/types/OxyServices.base.d.ts +11 -0
  11. package/dist/types/index.d.ts +1 -0
  12. package/dist/types/mixins/OxyServices.analytics.d.ts +1 -0
  13. package/dist/types/mixins/OxyServices.appData.d.ts +1 -0
  14. package/dist/types/mixins/OxyServices.applications.d.ts +1 -0
  15. package/dist/types/mixins/OxyServices.assets.d.ts +1 -0
  16. package/dist/types/mixins/OxyServices.auth.d.ts +1 -0
  17. package/dist/types/mixins/OxyServices.civic.d.ts +1 -0
  18. package/dist/types/mixins/OxyServices.contacts.d.ts +1 -0
  19. package/dist/types/mixins/OxyServices.devices.d.ts +1 -0
  20. package/dist/types/mixins/OxyServices.features.d.ts +1 -0
  21. package/dist/types/mixins/OxyServices.fedcm.d.ts +1 -0
  22. package/dist/types/mixins/OxyServices.identity.d.ts +1 -0
  23. package/dist/types/mixins/OxyServices.language.d.ts +1 -0
  24. package/dist/types/mixins/OxyServices.links.d.ts +6 -1
  25. package/dist/types/mixins/OxyServices.location.d.ts +1 -0
  26. package/dist/types/mixins/OxyServices.managedAccounts.d.ts +1 -0
  27. package/dist/types/mixins/OxyServices.nodes.d.ts +1 -0
  28. package/dist/types/mixins/OxyServices.payment.d.ts +1 -0
  29. package/dist/types/mixins/OxyServices.privacy.d.ts +1 -0
  30. package/dist/types/mixins/OxyServices.redirect.d.ts +1 -0
  31. package/dist/types/mixins/OxyServices.reputation.d.ts +1 -0
  32. package/dist/types/mixins/OxyServices.security.d.ts +1 -0
  33. package/dist/types/mixins/OxyServices.silent.d.ts +1 -0
  34. package/dist/types/mixins/OxyServices.sso.d.ts +1 -0
  35. package/dist/types/mixins/OxyServices.topics.d.ts +1 -0
  36. package/dist/types/mixins/OxyServices.user.d.ts +1 -0
  37. package/dist/types/mixins/OxyServices.utility.d.ts +1 -0
  38. package/dist/types/mixins/OxyServices.workspaces.d.ts +1 -0
  39. package/package.json +1 -1
  40. package/src/HttpService.ts +8 -1
  41. package/src/OxyServices.base.ts +25 -0
  42. package/src/__tests__/inSessionRefresh.test.ts +193 -0
  43. package/src/index.ts +4 -0
  44. package/src/mixins/OxyServices.links.ts +8 -4
  45. package/src/mixins/__tests__/OxyServices.links.test.ts +8 -8
@@ -11,7 +11,7 @@
11
11
  * `data` map keyed by the requested url, and surfaces a chunk failure.
12
12
  */
13
13
 
14
- import type { LinkPreview, LinkPreviewBatchResponse } from '@oxyhq/contracts';
14
+ import type { LinkPreview } from '@oxyhq/contracts';
15
15
  import { OxyServices } from '../../OxyServices';
16
16
 
17
17
  const sampleResolved: LinkPreview = {
@@ -82,10 +82,10 @@ describe('OxyServices.links', () => {
82
82
  });
83
83
 
84
84
  it('de-duplicates and sends a single chunk for <= 50 unique URLs', async () => {
85
- const response: LinkPreviewBatchResponse = {
86
- data: { 'https://a.test/': sampleResolved },
87
- };
88
- makeRequestSpy.mockResolvedValueOnce(response);
85
+ // makeRequest unwraps the API's `{ data }` envelope, so the resolved value
86
+ // is the bare record (NOT `{ data: {...} }`) mirror that real shape here.
87
+ const record: Record<string, LinkPreview> = { 'https://a.test/': sampleResolved };
88
+ makeRequestSpy.mockResolvedValueOnce(record);
89
89
 
90
90
  const result = await oxy.getLinkPreviews([
91
91
  'https://a.test/',
@@ -93,7 +93,7 @@ describe('OxyServices.links', () => {
93
93
  ' ', // dropped
94
94
  ]);
95
95
 
96
- expect(result).toEqual(response.data);
96
+ expect(result).toEqual(record);
97
97
  expect(makeRequestSpy).toHaveBeenCalledTimes(1);
98
98
  expect(makeRequestSpy).toHaveBeenCalledWith(
99
99
  'POST',
@@ -111,13 +111,13 @@ describe('OxyServices.links', () => {
111
111
  _method: 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE',
112
112
  _url: string,
113
113
  data?: { urls: string[] },
114
- ): Promise<LinkPreviewBatchResponse> => {
114
+ ): Promise<Record<string, LinkPreview>> => {
115
115
  const chunkUrls = data?.urls ?? [];
116
116
  const dataMap: Record<string, LinkPreview> = {};
117
117
  for (const u of chunkUrls) {
118
118
  dataMap[u] = { url: u, status: 'resolved', title: `t-${u}` };
119
119
  }
120
- return { data: dataMap };
120
+ return dataMap;
121
121
  },
122
122
  );
123
123