@mediaviz/sdk 1.0.80 → 1.0.82
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/sdk.cjs +25 -5
- package/dist/sdk.d.cts +1 -1
- package/dist/sdk.d.ts +1 -1
- package/dist/sdk.esm.d.ts +1 -1
- package/dist/sdk.esm.js +25 -5
- package/dist/sdk.umd.js +25 -5
- package/package.json +1 -1
package/dist/sdk.cjs
CHANGED
|
@@ -91,8 +91,15 @@ function requireErrors () {
|
|
|
91
91
|
* @returns {OAuthError}
|
|
92
92
|
*/
|
|
93
93
|
static fromResponse(status, body) {
|
|
94
|
-
|
|
95
|
-
|
|
94
|
+
// FastAPI wraps HTTPException payloads in a `detail` envelope, so an OAuth
|
|
95
|
+
// error arrives as { detail: { error, error_description } }. Unwrap it
|
|
96
|
+
// before falling back, or every server-side OAuth error reads as server_error.
|
|
97
|
+
const payload =
|
|
98
|
+
body && typeof body === 'object' && typeof body.error !== 'string' && body.detail
|
|
99
|
+
? body.detail
|
|
100
|
+
: body;
|
|
101
|
+
if (payload && typeof payload === 'object' && typeof payload.error === 'string') {
|
|
102
|
+
return new OAuthError(payload.error, payload.error_description ?? '', status, body);
|
|
96
103
|
}
|
|
97
104
|
return new OAuthError('server_error', 'Unexpected server response', status, body);
|
|
98
105
|
}
|
|
@@ -191,12 +198,22 @@ function requireClient () {
|
|
|
191
198
|
*/
|
|
192
199
|
static async registerClient(params) {
|
|
193
200
|
const baseUrl = params.baseUrl.replace(/\/+$/, '');
|
|
194
|
-
|
|
201
|
+
const body = {
|
|
195
202
|
client_name: params.clientName,
|
|
196
203
|
client_type: params.clientType,
|
|
197
204
|
redirect_uris: params.redirectUris,
|
|
198
205
|
is_first_party: params.isFirstParty,
|
|
199
|
-
}
|
|
206
|
+
};
|
|
207
|
+
// grant_types/company_id are required to provision a confidential
|
|
208
|
+
// client_credentials (machine-to-machine) client; omitted bodies keep the
|
|
209
|
+
// legacy public/authorization_code shape. The endpoint is admin-gated, so a
|
|
210
|
+
// bearer token must be supplied for the request to authenticate.
|
|
211
|
+
if (params.grantTypes !== undefined) body.grant_types = params.grantTypes;
|
|
212
|
+
if (params.companyId !== undefined) body.company_id = params.companyId;
|
|
213
|
+
const headers = params.accessToken
|
|
214
|
+
? { Authorization: `Bearer ${params.accessToken}` }
|
|
215
|
+
: {};
|
|
216
|
+
return postJson(`${baseUrl}/oauth/clients`, body, headers);
|
|
200
217
|
}
|
|
201
218
|
|
|
202
219
|
/**
|
|
@@ -416,6 +433,9 @@ function requireTypes () {
|
|
|
416
433
|
* @property {string} clientType - "public" or "confidential"
|
|
417
434
|
* @property {string[]} redirectUris - HTTPS redirect URIs
|
|
418
435
|
* @property {boolean} isFirstParty - Whether this is a first-party client
|
|
436
|
+
* @property {string[]} [grantTypes] - Allowed grants, e.g. ["client_credentials"]; required for machine-to-machine clients
|
|
437
|
+
* @property {number} [companyId] - Company to bind the client to; required for the client_credentials grant
|
|
438
|
+
* @property {string} [accessToken] - Admin bearer token; the registration endpoint is authorization-gated
|
|
419
439
|
*/
|
|
420
440
|
|
|
421
441
|
/**
|
|
@@ -1539,7 +1559,7 @@ class Search {
|
|
|
1539
1559
|
return data;
|
|
1540
1560
|
}
|
|
1541
1561
|
|
|
1542
|
-
async
|
|
1562
|
+
async recallProjectPhotos(projectTableName, { ascOrDesc, bestOfSimilarSetsOnly, lastId, limit } = {}) {
|
|
1543
1563
|
this._ctx.requireTokens();
|
|
1544
1564
|
let path = `/api/v1/search/recall/${encodeURIComponent(projectTableName)}/`;
|
|
1545
1565
|
const query = new URLSearchParams();
|
package/dist/sdk.d.cts
CHANGED
|
@@ -456,7 +456,7 @@ export class Projects {
|
|
|
456
456
|
export class Search {
|
|
457
457
|
searchProjectPhotos(projectTableName: string, options?: { andParams?: any, andStringParams?: any, orParams?: any, orStringParams?: any, notParams?: any, notStringParams?: any, dateMin?: string | string[], dateMax?: string | string[], dateNullAnd?: boolean | boolean[], dateNullOr?: boolean | boolean[], dateOrder?: string | string[], customAlbumId?: number | number[], bestOfSimilarSetsOnly?: boolean | boolean[], curatedAlbumId?: number | number[], splitByTier?: boolean | boolean[] }): Promise<Record<string, any>>;
|
|
458
458
|
searchProjectPhotosParametrized(projectTableName: string, options?: { andSearchText?: any, orSearchText?: any, notSearchText?: any, city?: any, country?: any, state?: any, albums?: any, dateMin?: string | string[], dateMax?: string | string[], dateNullAnd?: boolean | boolean[], dateNullOr?: boolean | boolean[], ascOrDesc?: string | string[], bestOfSimilarSetsOnly?: boolean | boolean[], splitByTier?: boolean | boolean[], lastId?: number | number[], limit?: number | number[] }): Promise<Record<string, any>>;
|
|
459
|
-
|
|
459
|
+
recallProjectPhotos(projectTableName: string, options?: { ascOrDesc?: string | string[], bestOfSimilarSetsOnly?: boolean | boolean[], lastId?: number | number[], limit?: number | number[] }): Promise<any>;
|
|
460
460
|
searchProjectPhotosNaturalLanguage(projectTableName: string, searchText: string, size?: number, options?: { minCosine?: number | number[], labelMinCosine?: number | number[], labelTopK?: number | number[], labelDelta?: number | number[], bestOfSimilarSetsOnly?: boolean | boolean[], splitByTier?: boolean | boolean[] }): Promise<Record<string, any>>;
|
|
461
461
|
getProjectSavedSearches(projectTableName: string): Promise<any>;
|
|
462
462
|
getSavedSearchById(searchId: number): Promise<SearchDisplay>;
|
package/dist/sdk.d.ts
CHANGED
|
@@ -456,7 +456,7 @@ export class Projects {
|
|
|
456
456
|
export class Search {
|
|
457
457
|
searchProjectPhotos(projectTableName: string, options?: { andParams?: any, andStringParams?: any, orParams?: any, orStringParams?: any, notParams?: any, notStringParams?: any, dateMin?: string | string[], dateMax?: string | string[], dateNullAnd?: boolean | boolean[], dateNullOr?: boolean | boolean[], dateOrder?: string | string[], customAlbumId?: number | number[], bestOfSimilarSetsOnly?: boolean | boolean[], curatedAlbumId?: number | number[], splitByTier?: boolean | boolean[] }): Promise<Record<string, any>>;
|
|
458
458
|
searchProjectPhotosParametrized(projectTableName: string, options?: { andSearchText?: any, orSearchText?: any, notSearchText?: any, city?: any, country?: any, state?: any, albums?: any, dateMin?: string | string[], dateMax?: string | string[], dateNullAnd?: boolean | boolean[], dateNullOr?: boolean | boolean[], ascOrDesc?: string | string[], bestOfSimilarSetsOnly?: boolean | boolean[], splitByTier?: boolean | boolean[], lastId?: number | number[], limit?: number | number[] }): Promise<Record<string, any>>;
|
|
459
|
-
|
|
459
|
+
recallProjectPhotos(projectTableName: string, options?: { ascOrDesc?: string | string[], bestOfSimilarSetsOnly?: boolean | boolean[], lastId?: number | number[], limit?: number | number[] }): Promise<any>;
|
|
460
460
|
searchProjectPhotosNaturalLanguage(projectTableName: string, searchText: string, size?: number, options?: { minCosine?: number | number[], labelMinCosine?: number | number[], labelTopK?: number | number[], labelDelta?: number | number[], bestOfSimilarSetsOnly?: boolean | boolean[], splitByTier?: boolean | boolean[] }): Promise<Record<string, any>>;
|
|
461
461
|
getProjectSavedSearches(projectTableName: string): Promise<any>;
|
|
462
462
|
getSavedSearchById(searchId: number): Promise<SearchDisplay>;
|
package/dist/sdk.esm.d.ts
CHANGED
|
@@ -456,7 +456,7 @@ export class Projects {
|
|
|
456
456
|
export class Search {
|
|
457
457
|
searchProjectPhotos(projectTableName: string, options?: { andParams?: any, andStringParams?: any, orParams?: any, orStringParams?: any, notParams?: any, notStringParams?: any, dateMin?: string | string[], dateMax?: string | string[], dateNullAnd?: boolean | boolean[], dateNullOr?: boolean | boolean[], dateOrder?: string | string[], customAlbumId?: number | number[], bestOfSimilarSetsOnly?: boolean | boolean[], curatedAlbumId?: number | number[], splitByTier?: boolean | boolean[] }): Promise<Record<string, any>>;
|
|
458
458
|
searchProjectPhotosParametrized(projectTableName: string, options?: { andSearchText?: any, orSearchText?: any, notSearchText?: any, city?: any, country?: any, state?: any, albums?: any, dateMin?: string | string[], dateMax?: string | string[], dateNullAnd?: boolean | boolean[], dateNullOr?: boolean | boolean[], ascOrDesc?: string | string[], bestOfSimilarSetsOnly?: boolean | boolean[], splitByTier?: boolean | boolean[], lastId?: number | number[], limit?: number | number[] }): Promise<Record<string, any>>;
|
|
459
|
-
|
|
459
|
+
recallProjectPhotos(projectTableName: string, options?: { ascOrDesc?: string | string[], bestOfSimilarSetsOnly?: boolean | boolean[], lastId?: number | number[], limit?: number | number[] }): Promise<any>;
|
|
460
460
|
searchProjectPhotosNaturalLanguage(projectTableName: string, searchText: string, size?: number, options?: { minCosine?: number | number[], labelMinCosine?: number | number[], labelTopK?: number | number[], labelDelta?: number | number[], bestOfSimilarSetsOnly?: boolean | boolean[], splitByTier?: boolean | boolean[] }): Promise<Record<string, any>>;
|
|
461
461
|
getProjectSavedSearches(projectTableName: string): Promise<any>;
|
|
462
462
|
getSavedSearchById(searchId: number): Promise<SearchDisplay>;
|
package/dist/sdk.esm.js
CHANGED
|
@@ -89,8 +89,15 @@ function requireErrors () {
|
|
|
89
89
|
* @returns {OAuthError}
|
|
90
90
|
*/
|
|
91
91
|
static fromResponse(status, body) {
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
// FastAPI wraps HTTPException payloads in a `detail` envelope, so an OAuth
|
|
93
|
+
// error arrives as { detail: { error, error_description } }. Unwrap it
|
|
94
|
+
// before falling back, or every server-side OAuth error reads as server_error.
|
|
95
|
+
const payload =
|
|
96
|
+
body && typeof body === 'object' && typeof body.error !== 'string' && body.detail
|
|
97
|
+
? body.detail
|
|
98
|
+
: body;
|
|
99
|
+
if (payload && typeof payload === 'object' && typeof payload.error === 'string') {
|
|
100
|
+
return new OAuthError(payload.error, payload.error_description ?? '', status, body);
|
|
94
101
|
}
|
|
95
102
|
return new OAuthError('server_error', 'Unexpected server response', status, body);
|
|
96
103
|
}
|
|
@@ -189,12 +196,22 @@ function requireClient () {
|
|
|
189
196
|
*/
|
|
190
197
|
static async registerClient(params) {
|
|
191
198
|
const baseUrl = params.baseUrl.replace(/\/+$/, '');
|
|
192
|
-
|
|
199
|
+
const body = {
|
|
193
200
|
client_name: params.clientName,
|
|
194
201
|
client_type: params.clientType,
|
|
195
202
|
redirect_uris: params.redirectUris,
|
|
196
203
|
is_first_party: params.isFirstParty,
|
|
197
|
-
}
|
|
204
|
+
};
|
|
205
|
+
// grant_types/company_id are required to provision a confidential
|
|
206
|
+
// client_credentials (machine-to-machine) client; omitted bodies keep the
|
|
207
|
+
// legacy public/authorization_code shape. The endpoint is admin-gated, so a
|
|
208
|
+
// bearer token must be supplied for the request to authenticate.
|
|
209
|
+
if (params.grantTypes !== undefined) body.grant_types = params.grantTypes;
|
|
210
|
+
if (params.companyId !== undefined) body.company_id = params.companyId;
|
|
211
|
+
const headers = params.accessToken
|
|
212
|
+
? { Authorization: `Bearer ${params.accessToken}` }
|
|
213
|
+
: {};
|
|
214
|
+
return postJson(`${baseUrl}/oauth/clients`, body, headers);
|
|
198
215
|
}
|
|
199
216
|
|
|
200
217
|
/**
|
|
@@ -414,6 +431,9 @@ function requireTypes () {
|
|
|
414
431
|
* @property {string} clientType - "public" or "confidential"
|
|
415
432
|
* @property {string[]} redirectUris - HTTPS redirect URIs
|
|
416
433
|
* @property {boolean} isFirstParty - Whether this is a first-party client
|
|
434
|
+
* @property {string[]} [grantTypes] - Allowed grants, e.g. ["client_credentials"]; required for machine-to-machine clients
|
|
435
|
+
* @property {number} [companyId] - Company to bind the client to; required for the client_credentials grant
|
|
436
|
+
* @property {string} [accessToken] - Admin bearer token; the registration endpoint is authorization-gated
|
|
417
437
|
*/
|
|
418
438
|
|
|
419
439
|
/**
|
|
@@ -1537,7 +1557,7 @@ class Search {
|
|
|
1537
1557
|
return data;
|
|
1538
1558
|
}
|
|
1539
1559
|
|
|
1540
|
-
async
|
|
1560
|
+
async recallProjectPhotos(projectTableName, { ascOrDesc, bestOfSimilarSetsOnly, lastId, limit } = {}) {
|
|
1541
1561
|
this._ctx.requireTokens();
|
|
1542
1562
|
let path = `/api/v1/search/recall/${encodeURIComponent(projectTableName)}/`;
|
|
1543
1563
|
const query = new URLSearchParams();
|
package/dist/sdk.umd.js
CHANGED
|
@@ -95,8 +95,15 @@
|
|
|
95
95
|
* @returns {OAuthError}
|
|
96
96
|
*/
|
|
97
97
|
static fromResponse(status, body) {
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
// FastAPI wraps HTTPException payloads in a `detail` envelope, so an OAuth
|
|
99
|
+
// error arrives as { detail: { error, error_description } }. Unwrap it
|
|
100
|
+
// before falling back, or every server-side OAuth error reads as server_error.
|
|
101
|
+
const payload =
|
|
102
|
+
body && typeof body === 'object' && typeof body.error !== 'string' && body.detail
|
|
103
|
+
? body.detail
|
|
104
|
+
: body;
|
|
105
|
+
if (payload && typeof payload === 'object' && typeof payload.error === 'string') {
|
|
106
|
+
return new OAuthError(payload.error, payload.error_description ?? '', status, body);
|
|
100
107
|
}
|
|
101
108
|
return new OAuthError('server_error', 'Unexpected server response', status, body);
|
|
102
109
|
}
|
|
@@ -195,12 +202,22 @@
|
|
|
195
202
|
*/
|
|
196
203
|
static async registerClient(params) {
|
|
197
204
|
const baseUrl = params.baseUrl.replace(/\/+$/, '');
|
|
198
|
-
|
|
205
|
+
const body = {
|
|
199
206
|
client_name: params.clientName,
|
|
200
207
|
client_type: params.clientType,
|
|
201
208
|
redirect_uris: params.redirectUris,
|
|
202
209
|
is_first_party: params.isFirstParty,
|
|
203
|
-
}
|
|
210
|
+
};
|
|
211
|
+
// grant_types/company_id are required to provision a confidential
|
|
212
|
+
// client_credentials (machine-to-machine) client; omitted bodies keep the
|
|
213
|
+
// legacy public/authorization_code shape. The endpoint is admin-gated, so a
|
|
214
|
+
// bearer token must be supplied for the request to authenticate.
|
|
215
|
+
if (params.grantTypes !== undefined) body.grant_types = params.grantTypes;
|
|
216
|
+
if (params.companyId !== undefined) body.company_id = params.companyId;
|
|
217
|
+
const headers = params.accessToken
|
|
218
|
+
? { Authorization: `Bearer ${params.accessToken}` }
|
|
219
|
+
: {};
|
|
220
|
+
return postJson(`${baseUrl}/oauth/clients`, body, headers);
|
|
204
221
|
}
|
|
205
222
|
|
|
206
223
|
/**
|
|
@@ -420,6 +437,9 @@
|
|
|
420
437
|
* @property {string} clientType - "public" or "confidential"
|
|
421
438
|
* @property {string[]} redirectUris - HTTPS redirect URIs
|
|
422
439
|
* @property {boolean} isFirstParty - Whether this is a first-party client
|
|
440
|
+
* @property {string[]} [grantTypes] - Allowed grants, e.g. ["client_credentials"]; required for machine-to-machine clients
|
|
441
|
+
* @property {number} [companyId] - Company to bind the client to; required for the client_credentials grant
|
|
442
|
+
* @property {string} [accessToken] - Admin bearer token; the registration endpoint is authorization-gated
|
|
423
443
|
*/
|
|
424
444
|
|
|
425
445
|
/**
|
|
@@ -1543,7 +1563,7 @@
|
|
|
1543
1563
|
return data;
|
|
1544
1564
|
}
|
|
1545
1565
|
|
|
1546
|
-
async
|
|
1566
|
+
async recallProjectPhotos(projectTableName, { ascOrDesc, bestOfSimilarSetsOnly, lastId, limit } = {}) {
|
|
1547
1567
|
this._ctx.requireTokens();
|
|
1548
1568
|
let path = `/api/v1/search/recall/${encodeURIComponent(projectTableName)}/`;
|
|
1549
1569
|
const query = new URLSearchParams();
|