@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.
- package/dist/cjs/.tsbuildinfo +1 -1
- package/dist/cjs/HttpService.js +8 -1
- package/dist/cjs/OxyServices.base.js +25 -0
- package/dist/cjs/mixins/OxyServices.links.js +6 -2
- package/dist/esm/.tsbuildinfo +1 -1
- package/dist/esm/HttpService.js +8 -1
- package/dist/esm/OxyServices.base.js +25 -0
- package/dist/esm/mixins/OxyServices.links.js +6 -2
- package/dist/types/.tsbuildinfo +1 -1
- package/dist/types/OxyServices.base.d.ts +11 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/mixins/OxyServices.analytics.d.ts +1 -0
- package/dist/types/mixins/OxyServices.appData.d.ts +1 -0
- package/dist/types/mixins/OxyServices.applications.d.ts +1 -0
- package/dist/types/mixins/OxyServices.assets.d.ts +1 -0
- package/dist/types/mixins/OxyServices.auth.d.ts +1 -0
- package/dist/types/mixins/OxyServices.civic.d.ts +1 -0
- package/dist/types/mixins/OxyServices.contacts.d.ts +1 -0
- package/dist/types/mixins/OxyServices.devices.d.ts +1 -0
- package/dist/types/mixins/OxyServices.features.d.ts +1 -0
- package/dist/types/mixins/OxyServices.fedcm.d.ts +1 -0
- package/dist/types/mixins/OxyServices.identity.d.ts +1 -0
- package/dist/types/mixins/OxyServices.language.d.ts +1 -0
- package/dist/types/mixins/OxyServices.links.d.ts +6 -1
- package/dist/types/mixins/OxyServices.location.d.ts +1 -0
- package/dist/types/mixins/OxyServices.managedAccounts.d.ts +1 -0
- package/dist/types/mixins/OxyServices.nodes.d.ts +1 -0
- package/dist/types/mixins/OxyServices.payment.d.ts +1 -0
- package/dist/types/mixins/OxyServices.privacy.d.ts +1 -0
- package/dist/types/mixins/OxyServices.redirect.d.ts +1 -0
- package/dist/types/mixins/OxyServices.reputation.d.ts +1 -0
- package/dist/types/mixins/OxyServices.security.d.ts +1 -0
- package/dist/types/mixins/OxyServices.silent.d.ts +1 -0
- package/dist/types/mixins/OxyServices.sso.d.ts +1 -0
- package/dist/types/mixins/OxyServices.topics.d.ts +1 -0
- package/dist/types/mixins/OxyServices.user.d.ts +1 -0
- package/dist/types/mixins/OxyServices.utility.d.ts +1 -0
- package/dist/types/mixins/OxyServices.workspaces.d.ts +1 -0
- package/package.json +1 -1
- package/src/HttpService.ts +8 -1
- package/src/OxyServices.base.ts +25 -0
- package/src/__tests__/inSessionRefresh.test.ts +193 -0
- package/src/index.ts +4 -0
- package/src/mixins/OxyServices.links.ts +8 -4
- 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
|
|
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
|
-
|
|
86
|
-
|
|
87
|
-
};
|
|
88
|
-
makeRequestSpy.mockResolvedValueOnce(
|
|
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(
|
|
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<
|
|
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
|
|
120
|
+
return dataMap;
|
|
121
121
|
},
|
|
122
122
|
);
|
|
123
123
|
|