@compresr/sdk 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.
- package/README.md +263 -0
- package/dist/cjs/clients/compression.d.ts +137 -0
- package/dist/cjs/clients/compression.d.ts.map +1 -0
- package/dist/cjs/clients/compression.js +220 -0
- package/dist/cjs/clients/compression.js.map +1 -0
- package/dist/cjs/clients/index.d.ts +2 -0
- package/dist/cjs/clients/index.d.ts.map +1 -0
- package/dist/cjs/clients/index.js +6 -0
- package/dist/cjs/clients/index.js.map +1 -0
- package/dist/cjs/config/constants.d.ts +61 -0
- package/dist/cjs/config/constants.d.ts.map +1 -0
- package/dist/cjs/config/constants.js +77 -0
- package/dist/cjs/config/constants.js.map +1 -0
- package/dist/cjs/config/endpoints.d.ts +18 -0
- package/dist/cjs/config/endpoints.d.ts.map +1 -0
- package/dist/cjs/config/endpoints.js +25 -0
- package/dist/cjs/config/endpoints.js.map +1 -0
- package/dist/cjs/config/index.d.ts +3 -0
- package/dist/cjs/config/index.d.ts.map +1 -0
- package/dist/cjs/config/index.js +20 -0
- package/dist/cjs/config/index.js.map +1 -0
- package/dist/cjs/errors/exceptions.d.ts +72 -0
- package/dist/cjs/errors/exceptions.d.ts.map +1 -0
- package/dist/cjs/errors/exceptions.js +107 -0
- package/dist/cjs/errors/exceptions.js.map +1 -0
- package/dist/cjs/errors/index.d.ts +2 -0
- package/dist/cjs/errors/index.d.ts.map +1 -0
- package/dist/cjs/errors/index.js +13 -0
- package/dist/cjs/errors/index.js.map +1 -0
- package/dist/cjs/http/client.d.ts +53 -0
- package/dist/cjs/http/client.d.ts.map +1 -0
- package/dist/cjs/http/client.js +268 -0
- package/dist/cjs/http/client.js.map +1 -0
- package/dist/cjs/http/errors.d.ts +19 -0
- package/dist/cjs/http/errors.d.ts.map +1 -0
- package/dist/cjs/http/errors.js +87 -0
- package/dist/cjs/http/errors.js.map +1 -0
- package/dist/cjs/http/index.d.ts +3 -0
- package/dist/cjs/http/index.d.ts.map +1 -0
- package/dist/cjs/http/index.js +8 -0
- package/dist/cjs/http/index.js.map +1 -0
- package/dist/cjs/index.d.ts +33 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +49 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +1 -0
- package/dist/cjs/schemas/common.d.ts +47 -0
- package/dist/cjs/schemas/common.d.ts.map +1 -0
- package/dist/cjs/schemas/common.js +29 -0
- package/dist/cjs/schemas/common.js.map +1 -0
- package/dist/cjs/schemas/compression.d.ts +378 -0
- package/dist/cjs/schemas/compression.d.ts.map +1 -0
- package/dist/cjs/schemas/compression.js +99 -0
- package/dist/cjs/schemas/compression.js.map +1 -0
- package/dist/cjs/schemas/index.d.ts +7 -0
- package/dist/cjs/schemas/index.d.ts.map +1 -0
- package/dist/cjs/schemas/index.js +30 -0
- package/dist/cjs/schemas/index.js.map +1 -0
- package/dist/cjs/schemas/search.d.ts +184 -0
- package/dist/cjs/schemas/search.d.ts.map +1 -0
- package/dist/cjs/schemas/search.js +75 -0
- package/dist/cjs/schemas/search.js.map +1 -0
- package/dist/esm/clients/compression.d.ts +137 -0
- package/dist/esm/clients/compression.d.ts.map +1 -0
- package/dist/esm/clients/compression.js +216 -0
- package/dist/esm/clients/compression.js.map +1 -0
- package/dist/esm/clients/index.d.ts +2 -0
- package/dist/esm/clients/index.d.ts.map +1 -0
- package/dist/esm/clients/index.js +2 -0
- package/dist/esm/clients/index.js.map +1 -0
- package/dist/esm/config/constants.d.ts +61 -0
- package/dist/esm/config/constants.d.ts.map +1 -0
- package/dist/esm/config/constants.js +74 -0
- package/dist/esm/config/constants.js.map +1 -0
- package/dist/esm/config/endpoints.d.ts +18 -0
- package/dist/esm/config/endpoints.d.ts.map +1 -0
- package/dist/esm/config/endpoints.js +22 -0
- package/dist/esm/config/endpoints.js.map +1 -0
- package/dist/esm/config/index.d.ts +3 -0
- package/dist/esm/config/index.d.ts.map +1 -0
- package/dist/esm/config/index.js +3 -0
- package/dist/esm/config/index.js.map +1 -0
- package/dist/esm/errors/exceptions.d.ts +72 -0
- package/dist/esm/errors/exceptions.d.ts.map +1 -0
- package/dist/esm/errors/exceptions.js +96 -0
- package/dist/esm/errors/exceptions.js.map +1 -0
- package/dist/esm/errors/index.d.ts +2 -0
- package/dist/esm/errors/index.d.ts.map +1 -0
- package/dist/esm/errors/index.js +2 -0
- package/dist/esm/errors/index.js.map +1 -0
- package/dist/esm/http/client.d.ts +53 -0
- package/dist/esm/http/client.d.ts.map +1 -0
- package/dist/esm/http/client.js +264 -0
- package/dist/esm/http/client.js.map +1 -0
- package/dist/esm/http/errors.d.ts +19 -0
- package/dist/esm/http/errors.d.ts.map +1 -0
- package/dist/esm/http/errors.js +84 -0
- package/dist/esm/http/errors.js.map +1 -0
- package/dist/esm/http/index.d.ts +3 -0
- package/dist/esm/http/index.d.ts.map +1 -0
- package/dist/esm/http/index.js +3 -0
- package/dist/esm/http/index.js.map +1 -0
- package/dist/esm/index.d.ts +33 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +36 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/schemas/common.d.ts +47 -0
- package/dist/esm/schemas/common.d.ts.map +1 -0
- package/dist/esm/schemas/common.js +26 -0
- package/dist/esm/schemas/common.js.map +1 -0
- package/dist/esm/schemas/compression.d.ts +378 -0
- package/dist/esm/schemas/compression.d.ts.map +1 -0
- package/dist/esm/schemas/compression.js +96 -0
- package/dist/esm/schemas/compression.js.map +1 -0
- package/dist/esm/schemas/index.d.ts +7 -0
- package/dist/esm/schemas/index.d.ts.map +1 -0
- package/dist/esm/schemas/index.js +10 -0
- package/dist/esm/schemas/index.js.map +1 -0
- package/dist/esm/schemas/search.d.ts +184 -0
- package/dist/esm/schemas/search.d.ts.map +1 -0
- package/dist/esm/schemas/search.js +72 -0
- package/dist/esm/schemas/search.js.map +1 -0
- package/package.json +86 -0
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SDK configuration constants
|
|
3
|
+
*/
|
|
4
|
+
/** API key prefix for validation */
|
|
5
|
+
export declare const API_KEY_PREFIX = "cmp_";
|
|
6
|
+
/** Default base URL for Compresr API */
|
|
7
|
+
export declare const DEFAULT_BASE_URL = "https://api.compresr.ai";
|
|
8
|
+
/** Default request timeout in milliseconds */
|
|
9
|
+
export declare const DEFAULT_TIMEOUT = 60000;
|
|
10
|
+
/** Stream request timeout in milliseconds */
|
|
11
|
+
export declare const STREAM_TIMEOUT = 300000;
|
|
12
|
+
/**
|
|
13
|
+
* Available compression and search models
|
|
14
|
+
*/
|
|
15
|
+
export declare const MODELS: {
|
|
16
|
+
readonly ESPRESSO: "espresso_v1";
|
|
17
|
+
readonly LATTE: "latte_v1";
|
|
18
|
+
readonly MACCHIATO: "macchiato_v1";
|
|
19
|
+
readonly AGENTIC_HISTORY_LINGUA: "agentic_history_lingua";
|
|
20
|
+
readonly AGENTIC_TOOL_OUTPUT_GEMFILTER: "agentic_tool_output_gemfilter";
|
|
21
|
+
readonly AGENTIC_TOOL_OUTPUT_LINGUA: "agentic_tool_output_lingua";
|
|
22
|
+
readonly AGENTIC_TOOL_DISCOVERY_SAT: "agentic_tool_discovery_sat";
|
|
23
|
+
};
|
|
24
|
+
export type CompressionModel = typeof MODELS.ESPRESSO | typeof MODELS.LATTE;
|
|
25
|
+
export type SearchModel = typeof MODELS.MACCHIATO;
|
|
26
|
+
export type Model = (typeof MODELS)[keyof typeof MODELS];
|
|
27
|
+
/** Models allowed for CompressionClient */
|
|
28
|
+
export declare const ALLOWED_COMPRESSION_MODELS: ReadonlySet<string>;
|
|
29
|
+
/** Models allowed for SearchClient */
|
|
30
|
+
export declare const ALLOWED_SEARCH_MODELS: ReadonlySet<string>;
|
|
31
|
+
/** Models that require a query parameter */
|
|
32
|
+
export declare const QUERY_REQUIRED_MODELS: ReadonlySet<string>;
|
|
33
|
+
/** Models that support coarse parameter */
|
|
34
|
+
export declare const COARSE_SUPPORTED_MODELS: ReadonlySet<string>;
|
|
35
|
+
/** Models that use the agnostic endpoint */
|
|
36
|
+
export declare const AGNOSTIC_ENDPOINT_MODELS: ReadonlySet<string>;
|
|
37
|
+
/** Models that use the query-specific endpoint */
|
|
38
|
+
export declare const QS_ENDPOINT_MODELS: ReadonlySet<string>;
|
|
39
|
+
/**
|
|
40
|
+
* HTTP header names
|
|
41
|
+
*/
|
|
42
|
+
export declare const HEADERS: {
|
|
43
|
+
readonly API_KEY: "X-API-Key";
|
|
44
|
+
readonly CONTENT_TYPE: "Content-Type";
|
|
45
|
+
readonly ACCEPT: "Accept";
|
|
46
|
+
readonly USER_AGENT: "User-Agent";
|
|
47
|
+
};
|
|
48
|
+
/**
|
|
49
|
+
* HTTP status codes for error handling
|
|
50
|
+
*/
|
|
51
|
+
export declare const STATUS_CODES: {
|
|
52
|
+
readonly OK: 200;
|
|
53
|
+
readonly BAD_REQUEST: 400;
|
|
54
|
+
readonly UNAUTHORIZED: 401;
|
|
55
|
+
readonly FORBIDDEN: 403;
|
|
56
|
+
readonly NOT_FOUND: 404;
|
|
57
|
+
readonly VALIDATION_ERROR: 422;
|
|
58
|
+
readonly RATE_LIMITED: 429;
|
|
59
|
+
readonly SERVER_ERROR: 500;
|
|
60
|
+
};
|
|
61
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/config/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,oCAAoC;AACpC,eAAO,MAAM,cAAc,SAAS,CAAC;AAErC,wCAAwC;AACxC,eAAO,MAAM,gBAAgB,4BAA4B,CAAC;AAE1D,8CAA8C;AAC9C,eAAO,MAAM,eAAe,QAAS,CAAC;AAEtC,6CAA6C;AAC7C,eAAO,MAAM,cAAc,SAAU,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,MAAM;;;;;;;;CAaT,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG,OAAO,MAAM,CAAC,QAAQ,GAAG,OAAO,MAAM,CAAC,KAAK,CAAC;AAC5E,MAAM,MAAM,WAAW,GAAG,OAAO,MAAM,CAAC,SAAS,CAAC;AAClD,MAAM,MAAM,KAAK,GAAG,CAAC,OAAO,MAAM,CAAC,CAAC,MAAM,OAAO,MAAM,CAAC,CAAC;AAEzD,2CAA2C;AAC3C,eAAO,MAAM,0BAA0B,EAAE,WAAW,CAAC,MAAM,CAGzD,CAAC;AAEH,sCAAsC;AACtC,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAEpD,CAAC;AAEH,4CAA4C;AAC5C,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAEpD,CAAC;AAEH,2CAA2C;AAC3C,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAEtD,CAAC;AAEH,4CAA4C;AAC5C,eAAO,MAAM,wBAAwB,EAAE,WAAW,CAAC,MAAM,CAEvD,CAAC;AAEH,kDAAkD;AAClD,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAEjD,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;CAKV,CAAC;AAEX;;GAEG;AACH,eAAO,MAAM,YAAY;;;;;;;;;CASf,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* SDK configuration constants
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.STATUS_CODES = exports.HEADERS = exports.QS_ENDPOINT_MODELS = exports.AGNOSTIC_ENDPOINT_MODELS = exports.COARSE_SUPPORTED_MODELS = exports.QUERY_REQUIRED_MODELS = exports.ALLOWED_SEARCH_MODELS = exports.ALLOWED_COMPRESSION_MODELS = exports.MODELS = exports.STREAM_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_BASE_URL = exports.API_KEY_PREFIX = void 0;
|
|
7
|
+
/** API key prefix for validation */
|
|
8
|
+
exports.API_KEY_PREFIX = 'cmp_';
|
|
9
|
+
/** Default base URL for Compresr API */
|
|
10
|
+
exports.DEFAULT_BASE_URL = 'https://api.compresr.ai';
|
|
11
|
+
/** Default request timeout in milliseconds */
|
|
12
|
+
exports.DEFAULT_TIMEOUT = 60_000;
|
|
13
|
+
/** Stream request timeout in milliseconds */
|
|
14
|
+
exports.STREAM_TIMEOUT = 300_000;
|
|
15
|
+
/**
|
|
16
|
+
* Available compression and search models
|
|
17
|
+
*/
|
|
18
|
+
exports.MODELS = {
|
|
19
|
+
// Compression models
|
|
20
|
+
ESPRESSO: 'espresso_v1',
|
|
21
|
+
LATTE: 'latte_v1',
|
|
22
|
+
// Search models
|
|
23
|
+
MACCHIATO: 'macchiato_v1',
|
|
24
|
+
// Agentic models
|
|
25
|
+
AGENTIC_HISTORY_LINGUA: 'agentic_history_lingua',
|
|
26
|
+
AGENTIC_TOOL_OUTPUT_GEMFILTER: 'agentic_tool_output_gemfilter',
|
|
27
|
+
AGENTIC_TOOL_OUTPUT_LINGUA: 'agentic_tool_output_lingua',
|
|
28
|
+
AGENTIC_TOOL_DISCOVERY_SAT: 'agentic_tool_discovery_sat',
|
|
29
|
+
};
|
|
30
|
+
/** Models allowed for CompressionClient */
|
|
31
|
+
exports.ALLOWED_COMPRESSION_MODELS = new Set([
|
|
32
|
+
exports.MODELS.ESPRESSO,
|
|
33
|
+
exports.MODELS.LATTE,
|
|
34
|
+
]);
|
|
35
|
+
/** Models allowed for SearchClient */
|
|
36
|
+
exports.ALLOWED_SEARCH_MODELS = new Set([
|
|
37
|
+
exports.MODELS.MACCHIATO,
|
|
38
|
+
]);
|
|
39
|
+
/** Models that require a query parameter */
|
|
40
|
+
exports.QUERY_REQUIRED_MODELS = new Set([
|
|
41
|
+
exports.MODELS.LATTE,
|
|
42
|
+
]);
|
|
43
|
+
/** Models that support coarse parameter */
|
|
44
|
+
exports.COARSE_SUPPORTED_MODELS = new Set([
|
|
45
|
+
exports.MODELS.LATTE,
|
|
46
|
+
]);
|
|
47
|
+
/** Models that use the agnostic endpoint */
|
|
48
|
+
exports.AGNOSTIC_ENDPOINT_MODELS = new Set([
|
|
49
|
+
exports.MODELS.ESPRESSO,
|
|
50
|
+
]);
|
|
51
|
+
/** Models that use the query-specific endpoint */
|
|
52
|
+
exports.QS_ENDPOINT_MODELS = new Set([
|
|
53
|
+
exports.MODELS.LATTE,
|
|
54
|
+
]);
|
|
55
|
+
/**
|
|
56
|
+
* HTTP header names
|
|
57
|
+
*/
|
|
58
|
+
exports.HEADERS = {
|
|
59
|
+
API_KEY: 'X-API-Key',
|
|
60
|
+
CONTENT_TYPE: 'Content-Type',
|
|
61
|
+
ACCEPT: 'Accept',
|
|
62
|
+
USER_AGENT: 'User-Agent',
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* HTTP status codes for error handling
|
|
66
|
+
*/
|
|
67
|
+
exports.STATUS_CODES = {
|
|
68
|
+
OK: 200,
|
|
69
|
+
BAD_REQUEST: 400,
|
|
70
|
+
UNAUTHORIZED: 401,
|
|
71
|
+
FORBIDDEN: 403,
|
|
72
|
+
NOT_FOUND: 404,
|
|
73
|
+
VALIDATION_ERROR: 422,
|
|
74
|
+
RATE_LIMITED: 429,
|
|
75
|
+
SERVER_ERROR: 500,
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/config/constants.ts"],"names":[],"mappings":";AAAA;;GAEG;;;AAEH,oCAAoC;AACvB,QAAA,cAAc,GAAG,MAAM,CAAC;AAErC,wCAAwC;AAC3B,QAAA,gBAAgB,GAAG,yBAAyB,CAAC;AAE1D,8CAA8C;AACjC,QAAA,eAAe,GAAG,MAAM,CAAC;AAEtC,6CAA6C;AAChC,QAAA,cAAc,GAAG,OAAO,CAAC;AAEtC;;GAEG;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GAAG;IACrB,YAAY,EAAE,GAAG;IACjB,YAAY,EAAE,GAAG;CACT,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API endpoint constants
|
|
3
|
+
*/
|
|
4
|
+
export declare const ENDPOINTS: {
|
|
5
|
+
readonly COMPRESS_AGNOSTIC: "/api/compress/question-agnostic/";
|
|
6
|
+
readonly COMPRESS_AGNOSTIC_STREAM: "/api/compress/question-agnostic/stream";
|
|
7
|
+
readonly COMPRESS_QS: "/api/compress/question-specific/";
|
|
8
|
+
readonly COMPRESS_QS_STREAM: "/api/compress/question-specific/stream";
|
|
9
|
+
readonly COMPRESS_QS_BATCH: "/api/compress/question-specific/batch";
|
|
10
|
+
readonly SEARCH: "/api/compress/search/";
|
|
11
|
+
readonly SEARCH_STREAM: "/api/compress/search/stream";
|
|
12
|
+
readonly SEARCH_INDEX_CREATE: "/api/compress/search/indexes/{indexName}";
|
|
13
|
+
readonly SEARCH_INDEX_TASK: "/api/compress/search/indexes/tasks/{taskId}";
|
|
14
|
+
readonly SEARCH_INDEX_DELETE: "/api/compress/search/indexes/{indexName}";
|
|
15
|
+
readonly SEARCH_HEALTH: "/api/compress/search/health";
|
|
16
|
+
};
|
|
17
|
+
export type Endpoint = (typeof ENDPOINTS)[keyof typeof ENDPOINTS];
|
|
18
|
+
//# sourceMappingURL=endpoints.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../../../src/config/endpoints.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;CAqBZ,CAAC;AAEX,MAAM,MAAM,QAAQ,GAAG,CAAC,OAAO,SAAS,CAAC,CAAC,MAAM,OAAO,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ENDPOINTS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* API endpoint constants
|
|
6
|
+
*/
|
|
7
|
+
exports.ENDPOINTS = {
|
|
8
|
+
// Agnostic compression (no query required)
|
|
9
|
+
COMPRESS_AGNOSTIC: '/api/compress/question-agnostic/',
|
|
10
|
+
COMPRESS_AGNOSTIC_STREAM: '/api/compress/question-agnostic/stream',
|
|
11
|
+
// Query-specific compression (query required)
|
|
12
|
+
COMPRESS_QS: '/api/compress/question-specific/',
|
|
13
|
+
COMPRESS_QS_STREAM: '/api/compress/question-specific/stream',
|
|
14
|
+
COMPRESS_QS_BATCH: '/api/compress/question-specific/batch',
|
|
15
|
+
// Agentic search
|
|
16
|
+
SEARCH: '/api/compress/search/',
|
|
17
|
+
SEARCH_STREAM: '/api/compress/search/stream',
|
|
18
|
+
// Index management
|
|
19
|
+
SEARCH_INDEX_CREATE: '/api/compress/search/indexes/{indexName}',
|
|
20
|
+
SEARCH_INDEX_TASK: '/api/compress/search/indexes/tasks/{taskId}',
|
|
21
|
+
SEARCH_INDEX_DELETE: '/api/compress/search/indexes/{indexName}',
|
|
22
|
+
// Health
|
|
23
|
+
SEARCH_HEALTH: '/api/compress/search/health',
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=endpoints.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"endpoints.js","sourceRoot":"","sources":["../../../src/config/endpoints.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACU,QAAA,SAAS,GAAG;IACvB,2CAA2C;IAC3C,iBAAiB,EAAE,kCAAkC;IACrD,wBAAwB,EAAE,wCAAwC;IAElE,8CAA8C;IAC9C,WAAW,EAAE,kCAAkC;IAC/C,kBAAkB,EAAE,wCAAwC;IAC5D,iBAAiB,EAAE,uCAAuC;IAE1D,iBAAiB;IACjB,MAAM,EAAE,uBAAuB;IAC/B,aAAa,EAAE,6BAA6B;IAE5C,mBAAmB;IACnB,mBAAmB,EAAE,0CAA0C;IAC/D,iBAAiB,EAAE,6CAA6C;IAChE,mBAAmB,EAAE,0CAA0C;IAE/D,SAAS;IACT,aAAa,EAAE,6BAA6B;CACpC,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { ENDPOINTS, type Endpoint } from './endpoints.js';
|
|
2
|
+
export { API_KEY_PREFIX, DEFAULT_BASE_URL, DEFAULT_TIMEOUT, STREAM_TIMEOUT, MODELS, type CompressionModel, type SearchModel, type Model, ALLOWED_COMPRESSION_MODELS, ALLOWED_SEARCH_MODELS, QUERY_REQUIRED_MODELS, COARSE_SUPPORTED_MODELS, AGNOSTIC_ENDPOINT_MODELS, QS_ENDPOINT_MODELS, HEADERS, STATUS_CODES, } from './constants.js';
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC1D,OAAO,EACL,cAAc,EACd,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,MAAM,EACN,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,KAAK,EACV,0BAA0B,EAC1B,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,wBAAwB,EACxB,kBAAkB,EAClB,OAAO,EACP,YAAY,GACb,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.STATUS_CODES = exports.HEADERS = exports.QS_ENDPOINT_MODELS = exports.AGNOSTIC_ENDPOINT_MODELS = exports.COARSE_SUPPORTED_MODELS = exports.QUERY_REQUIRED_MODELS = exports.ALLOWED_SEARCH_MODELS = exports.ALLOWED_COMPRESSION_MODELS = exports.MODELS = exports.STREAM_TIMEOUT = exports.DEFAULT_TIMEOUT = exports.DEFAULT_BASE_URL = exports.API_KEY_PREFIX = exports.ENDPOINTS = void 0;
|
|
4
|
+
var endpoints_js_1 = require("./endpoints.js");
|
|
5
|
+
Object.defineProperty(exports, "ENDPOINTS", { enumerable: true, get: function () { return endpoints_js_1.ENDPOINTS; } });
|
|
6
|
+
var constants_js_1 = require("./constants.js");
|
|
7
|
+
Object.defineProperty(exports, "API_KEY_PREFIX", { enumerable: true, get: function () { return constants_js_1.API_KEY_PREFIX; } });
|
|
8
|
+
Object.defineProperty(exports, "DEFAULT_BASE_URL", { enumerable: true, get: function () { return constants_js_1.DEFAULT_BASE_URL; } });
|
|
9
|
+
Object.defineProperty(exports, "DEFAULT_TIMEOUT", { enumerable: true, get: function () { return constants_js_1.DEFAULT_TIMEOUT; } });
|
|
10
|
+
Object.defineProperty(exports, "STREAM_TIMEOUT", { enumerable: true, get: function () { return constants_js_1.STREAM_TIMEOUT; } });
|
|
11
|
+
Object.defineProperty(exports, "MODELS", { enumerable: true, get: function () { return constants_js_1.MODELS; } });
|
|
12
|
+
Object.defineProperty(exports, "ALLOWED_COMPRESSION_MODELS", { enumerable: true, get: function () { return constants_js_1.ALLOWED_COMPRESSION_MODELS; } });
|
|
13
|
+
Object.defineProperty(exports, "ALLOWED_SEARCH_MODELS", { enumerable: true, get: function () { return constants_js_1.ALLOWED_SEARCH_MODELS; } });
|
|
14
|
+
Object.defineProperty(exports, "QUERY_REQUIRED_MODELS", { enumerable: true, get: function () { return constants_js_1.QUERY_REQUIRED_MODELS; } });
|
|
15
|
+
Object.defineProperty(exports, "COARSE_SUPPORTED_MODELS", { enumerable: true, get: function () { return constants_js_1.COARSE_SUPPORTED_MODELS; } });
|
|
16
|
+
Object.defineProperty(exports, "AGNOSTIC_ENDPOINT_MODELS", { enumerable: true, get: function () { return constants_js_1.AGNOSTIC_ENDPOINT_MODELS; } });
|
|
17
|
+
Object.defineProperty(exports, "QS_ENDPOINT_MODELS", { enumerable: true, get: function () { return constants_js_1.QS_ENDPOINT_MODELS; } });
|
|
18
|
+
Object.defineProperty(exports, "HEADERS", { enumerable: true, get: function () { return constants_js_1.HEADERS; } });
|
|
19
|
+
Object.defineProperty(exports, "STATUS_CODES", { enumerable: true, get: function () { return constants_js_1.STATUS_CODES; } });
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":";;;AAAA,+CAA0D;AAAjD,yGAAA,SAAS,OAAA;AAClB,+CAiBwB;AAhBtB,8GAAA,cAAc,OAAA;AACd,gHAAA,gBAAgB,OAAA;AAChB,+GAAA,eAAe,OAAA;AACf,8GAAA,cAAc,OAAA;AACd,sGAAA,MAAM,OAAA;AAIN,0HAAA,0BAA0B,OAAA;AAC1B,qHAAA,qBAAqB,OAAA;AACrB,qHAAA,qBAAqB,OAAA;AACrB,uHAAA,uBAAuB,OAAA;AACvB,wHAAA,wBAAwB,OAAA;AACxB,kHAAA,kBAAkB,OAAA;AAClB,uGAAA,OAAO,OAAA;AACP,4GAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compresr SDK Exceptions
|
|
3
|
+
*
|
|
4
|
+
* Exception classes for API error handling, mirroring the Python SDK.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Response data structure for errors
|
|
8
|
+
*/
|
|
9
|
+
export interface ErrorResponseData {
|
|
10
|
+
success: boolean;
|
|
11
|
+
error: string;
|
|
12
|
+
detail?: string;
|
|
13
|
+
code?: string;
|
|
14
|
+
field?: string;
|
|
15
|
+
retry_after?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Base error class for all Compresr SDK errors
|
|
19
|
+
*/
|
|
20
|
+
export declare class CompresrError extends Error {
|
|
21
|
+
readonly code: string;
|
|
22
|
+
readonly responseData: ErrorResponseData;
|
|
23
|
+
constructor(message: string, code?: string, responseData?: Partial<ErrorResponseData>);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Invalid or missing API key
|
|
27
|
+
*/
|
|
28
|
+
export declare class AuthenticationError extends CompresrError {
|
|
29
|
+
constructor(message?: string, responseData?: Partial<ErrorResponseData>);
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Request validation failed (invalid parameters, missing required fields)
|
|
33
|
+
*/
|
|
34
|
+
export declare class ValidationError extends CompresrError {
|
|
35
|
+
readonly field?: string;
|
|
36
|
+
constructor(message: string, field?: string, responseData?: Partial<ErrorResponseData>);
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Rate limit exceeded - too many requests
|
|
40
|
+
*/
|
|
41
|
+
export declare class RateLimitError extends CompresrError {
|
|
42
|
+
readonly retryAfter?: number;
|
|
43
|
+
constructor(message: string, retryAfter?: number, responseData?: Partial<ErrorResponseData>);
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* API key lacks required permissions/scope
|
|
47
|
+
*/
|
|
48
|
+
export declare class ScopeError extends CompresrError {
|
|
49
|
+
readonly requiredScope?: string;
|
|
50
|
+
constructor(message: string, requiredScope?: string, responseData?: Partial<ErrorResponseData>);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Internal server error
|
|
54
|
+
*/
|
|
55
|
+
export declare class ServerError extends CompresrError {
|
|
56
|
+
constructor(message?: string, responseData?: Partial<ErrorResponseData>);
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Connection error - failed to connect to API
|
|
60
|
+
*/
|
|
61
|
+
export declare class ConnectionError extends CompresrError {
|
|
62
|
+
readonly service?: string;
|
|
63
|
+
constructor(message: string, service?: string, responseData?: Partial<ErrorResponseData>);
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Resource not found (e.g., index doesn't exist)
|
|
67
|
+
*/
|
|
68
|
+
export declare class NotFoundError extends CompresrError {
|
|
69
|
+
readonly resource?: string;
|
|
70
|
+
constructor(message: string, resource?: string, responseData?: Partial<ErrorResponseData>);
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=exceptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.d.ts","sourceRoot":"","sources":["../../../src/errors/exceptions.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,YAAY,EAAE,iBAAiB,CAAC;gBAGvC,OAAO,EAAE,MAAM,EACf,IAAI,SAAmB,EACvB,YAAY,GAAE,OAAO,CAAC,iBAAiB,CAAM;CAQhD;AAED;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,aAAa;gBAElD,OAAO,SAA0B,EACjC,YAAY,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC;CAK5C;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,aAAa;IAChD,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;gBAGtB,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC;CAM5C;AAED;;GAEG;AACH,qBAAa,cAAe,SAAQ,aAAa;IAC/C,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;gBAG3B,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,EACnB,YAAY,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC;CAS5C;AAED;;GAEG;AACH,qBAAa,UAAW,SAAQ,aAAa;IAC3C,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;gBAG9B,OAAO,EAAE,MAAM,EACf,aAAa,CAAC,EAAE,MAAM,EACtB,YAAY,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC;CAM5C;AAED;;GAEG;AACH,qBAAa,WAAY,SAAQ,aAAa;gBAE1C,OAAO,SAA0B,EACjC,YAAY,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC;CAK5C;AAED;;GAEG;AACH,qBAAa,eAAgB,SAAQ,aAAa;IAChD,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;gBAGxB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC;CAM5C;AAED;;GAEG;AACH,qBAAa,aAAc,SAAQ,aAAa;IAC9C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;gBAGzB,OAAO,EAAE,MAAM,EACf,QAAQ,CAAC,EAAE,MAAM,EACjB,YAAY,CAAC,EAAE,OAAO,CAAC,iBAAiB,CAAC;CAM5C"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Compresr SDK Exceptions
|
|
4
|
+
*
|
|
5
|
+
* Exception classes for API error handling, mirroring the Python SDK.
|
|
6
|
+
*/
|
|
7
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
|
+
exports.NotFoundError = exports.ConnectionError = exports.ServerError = exports.ScopeError = exports.RateLimitError = exports.ValidationError = exports.AuthenticationError = exports.CompresrError = void 0;
|
|
9
|
+
/**
|
|
10
|
+
* Base error class for all Compresr SDK errors
|
|
11
|
+
*/
|
|
12
|
+
class CompresrError extends Error {
|
|
13
|
+
code;
|
|
14
|
+
responseData;
|
|
15
|
+
constructor(message, code = 'compresr_error', responseData = {}) {
|
|
16
|
+
super(message);
|
|
17
|
+
this.name = 'CompresrError';
|
|
18
|
+
this.code = code;
|
|
19
|
+
this.responseData = { success: false, error: message, ...responseData };
|
|
20
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
exports.CompresrError = CompresrError;
|
|
24
|
+
/**
|
|
25
|
+
* Invalid or missing API key
|
|
26
|
+
*/
|
|
27
|
+
class AuthenticationError extends CompresrError {
|
|
28
|
+
constructor(message = 'Authentication failed', responseData) {
|
|
29
|
+
super(message, 'authentication_error', responseData);
|
|
30
|
+
this.name = 'AuthenticationError';
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.AuthenticationError = AuthenticationError;
|
|
34
|
+
/**
|
|
35
|
+
* Request validation failed (invalid parameters, missing required fields)
|
|
36
|
+
*/
|
|
37
|
+
class ValidationError extends CompresrError {
|
|
38
|
+
field;
|
|
39
|
+
constructor(message, field, responseData) {
|
|
40
|
+
super(message, 'validation_error', { ...responseData, field });
|
|
41
|
+
this.name = 'ValidationError';
|
|
42
|
+
this.field = field;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ValidationError = ValidationError;
|
|
46
|
+
/**
|
|
47
|
+
* Rate limit exceeded - too many requests
|
|
48
|
+
*/
|
|
49
|
+
class RateLimitError extends CompresrError {
|
|
50
|
+
retryAfter;
|
|
51
|
+
constructor(message, retryAfter, responseData) {
|
|
52
|
+
super(message, 'rate_limit_exceeded', {
|
|
53
|
+
...responseData,
|
|
54
|
+
retry_after: retryAfter,
|
|
55
|
+
});
|
|
56
|
+
this.name = 'RateLimitError';
|
|
57
|
+
this.retryAfter = retryAfter;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
exports.RateLimitError = RateLimitError;
|
|
61
|
+
/**
|
|
62
|
+
* API key lacks required permissions/scope
|
|
63
|
+
*/
|
|
64
|
+
class ScopeError extends CompresrError {
|
|
65
|
+
requiredScope;
|
|
66
|
+
constructor(message, requiredScope, responseData) {
|
|
67
|
+
super(message, 'scope_error', responseData);
|
|
68
|
+
this.name = 'ScopeError';
|
|
69
|
+
this.requiredScope = requiredScope;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.ScopeError = ScopeError;
|
|
73
|
+
/**
|
|
74
|
+
* Internal server error
|
|
75
|
+
*/
|
|
76
|
+
class ServerError extends CompresrError {
|
|
77
|
+
constructor(message = 'Internal server error', responseData) {
|
|
78
|
+
super(message, 'server_error', responseData);
|
|
79
|
+
this.name = 'ServerError';
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
exports.ServerError = ServerError;
|
|
83
|
+
/**
|
|
84
|
+
* Connection error - failed to connect to API
|
|
85
|
+
*/
|
|
86
|
+
class ConnectionError extends CompresrError {
|
|
87
|
+
service;
|
|
88
|
+
constructor(message, service, responseData) {
|
|
89
|
+
super(message, 'connection_error', responseData);
|
|
90
|
+
this.name = 'ConnectionError';
|
|
91
|
+
this.service = service;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
exports.ConnectionError = ConnectionError;
|
|
95
|
+
/**
|
|
96
|
+
* Resource not found (e.g., index doesn't exist)
|
|
97
|
+
*/
|
|
98
|
+
class NotFoundError extends CompresrError {
|
|
99
|
+
resource;
|
|
100
|
+
constructor(message, resource, responseData) {
|
|
101
|
+
super(message, 'not_found', responseData);
|
|
102
|
+
this.name = 'NotFoundError';
|
|
103
|
+
this.resource = resource;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
exports.NotFoundError = NotFoundError;
|
|
107
|
+
//# sourceMappingURL=exceptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exceptions.js","sourceRoot":"","sources":["../../../src/errors/exceptions.ts"],"names":[],"mappings":";AAAA;;;;GAIG;;;AAcH;;GAEG;AACH,MAAa,aAAc,SAAQ,KAAK;IAC7B,IAAI,CAAS;IACb,YAAY,CAAo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AO,EACL,KAAK,iBAAiB,EACtB,aAAa,EACb,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,UAAU,EACV,WAAW,EACX,eAAe,EACf,aAAa,GACd,MAAM,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotFoundError = exports.ConnectionError = exports.ServerError = exports.ScopeError = exports.RateLimitError = exports.ValidationError = exports.AuthenticationError = exports.CompresrError = void 0;
|
|
4
|
+
var exceptions_js_1 = require("./exceptions.js");
|
|
5
|
+
Object.defineProperty(exports, "CompresrError", { enumerable: true, get: function () { return exceptions_js_1.CompresrError; } });
|
|
6
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return exceptions_js_1.AuthenticationError; } });
|
|
7
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return exceptions_js_1.ValidationError; } });
|
|
8
|
+
Object.defineProperty(exports, "RateLimitError", { enumerable: true, get: function () { return exceptions_js_1.RateLimitError; } });
|
|
9
|
+
Object.defineProperty(exports, "ScopeError", { enumerable: true, get: function () { return exceptions_js_1.ScopeError; } });
|
|
10
|
+
Object.defineProperty(exports, "ServerError", { enumerable: true, get: function () { return exceptions_js_1.ServerError; } });
|
|
11
|
+
Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return exceptions_js_1.ConnectionError; } });
|
|
12
|
+
Object.defineProperty(exports, "NotFoundError", { enumerable: true, get: function () { return exceptions_js_1.NotFoundError; } });
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/errors/index.ts"],"names":[],"mappings":";;;AAAA,iDAUyB;AARvB,8GAAA,aAAa,OAAA;AACb,oHAAA,mBAAmB,OAAA;AACnB,gHAAA,eAAe,OAAA;AACf,+GAAA,cAAc,OAAA;AACd,2GAAA,UAAU,OAAA;AACV,4GAAA,WAAW,OAAA;AACX,gHAAA,eAAe,OAAA;AACf,8GAAA,aAAa,OAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP client configuration options
|
|
3
|
+
*/
|
|
4
|
+
export interface HttpClientOptions {
|
|
5
|
+
/** API key (required) - must start with "cmp_" */
|
|
6
|
+
apiKey: string;
|
|
7
|
+
/** Base URL for API (optional, defaults to production) */
|
|
8
|
+
baseUrl?: string;
|
|
9
|
+
/** Request timeout in milliseconds (optional) */
|
|
10
|
+
timeout?: number;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Internal HTTP client for all Compresr API requests
|
|
14
|
+
*/
|
|
15
|
+
export declare class HttpClient {
|
|
16
|
+
private readonly apiKey;
|
|
17
|
+
private readonly baseUrl;
|
|
18
|
+
private readonly timeout;
|
|
19
|
+
constructor(options: HttpClientOptions);
|
|
20
|
+
/**
|
|
21
|
+
* Get default headers for requests
|
|
22
|
+
*/
|
|
23
|
+
private get headers();
|
|
24
|
+
/**
|
|
25
|
+
* Build full URL from endpoint
|
|
26
|
+
*/
|
|
27
|
+
private url;
|
|
28
|
+
/**
|
|
29
|
+
* Make a POST request
|
|
30
|
+
*/
|
|
31
|
+
post<T>(endpoint: string, data: Record<string, unknown>): Promise<T>;
|
|
32
|
+
/**
|
|
33
|
+
* Make a GET request
|
|
34
|
+
*/
|
|
35
|
+
get<T>(endpoint: string): Promise<T>;
|
|
36
|
+
/**
|
|
37
|
+
* Make a DELETE request
|
|
38
|
+
*/
|
|
39
|
+
delete<T>(endpoint: string): Promise<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Stream response from SSE endpoint
|
|
42
|
+
*/
|
|
43
|
+
stream(endpoint: string, data: Record<string, unknown>): AsyncGenerator<string, void, undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* Upload multipart form data (for index creation)
|
|
46
|
+
*/
|
|
47
|
+
postMultipart<T>(endpoint: string, files: Record<string, {
|
|
48
|
+
data: Blob;
|
|
49
|
+
filename: string;
|
|
50
|
+
contentType: string;
|
|
51
|
+
}>): Promise<T>;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/http/client.ts"],"names":[],"mappings":"AAqBA;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,kDAAkD;IAClD,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAChC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,iBAAiB;IAgBtC;;OAEG;IACH,OAAO,KAAK,OAAO,GAOlB;IAED;;OAEG;IACH,OAAO,CAAC,GAAG;IAIX;;OAEG;IACG,IAAI,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAmC1E;;OAEG;IACG,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAkC1C;;OAEG;IACG,MAAM,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IAkC7C;;OAEG;IACI,MAAM,CACX,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC5B,cAAc,CAAC,MAAM,EAAE,IAAI,EAAE,SAAS,CAAC;IAyE1C;;OAEG;IACG,aAAa,CAAC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