@gpt-platform/client 0.1.2 → 0.1.3
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/index.d.mts +54 -58
- package/dist/index.d.ts +54 -58
- package/dist/index.js +19 -48
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +19 -48
- package/dist/index.mjs.map +1 -1
- package/llms.txt +0 -2
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1225,7 +1225,7 @@ function buildUserAgent(sdkVersion, appInfo) {
|
|
|
1225
1225
|
|
|
1226
1226
|
// src/base-client.ts
|
|
1227
1227
|
var DEFAULT_API_VERSION = "2025-12-03";
|
|
1228
|
-
var SDK_VERSION = "0.1.
|
|
1228
|
+
var SDK_VERSION = "0.1.3";
|
|
1229
1229
|
function generateUUID() {
|
|
1230
1230
|
if (typeof crypto !== "undefined" && typeof crypto.randomUUID === "function") {
|
|
1231
1231
|
return crypto.randomUUID();
|
|
@@ -1315,7 +1315,7 @@ var BaseClient = class {
|
|
|
1315
1315
|
this.clientInstance = createClient(createConfig(clientConfig));
|
|
1316
1316
|
const userAgent = buildUserAgent(SDK_VERSION, config.appInfo);
|
|
1317
1317
|
const timeout = config.timeout;
|
|
1318
|
-
this.clientInstance.interceptors.request.use((req) => {
|
|
1318
|
+
this.clientInstance.interceptors.request.use(async (req) => {
|
|
1319
1319
|
const requestStartTime = Date.now();
|
|
1320
1320
|
this.requestTimings.set(req, requestStartTime);
|
|
1321
1321
|
const requestUrl = req.url || resolvedBaseUrl || "";
|
|
@@ -1327,10 +1327,7 @@ var BaseClient = class {
|
|
|
1327
1327
|
this.log.warn(message);
|
|
1328
1328
|
}
|
|
1329
1329
|
}
|
|
1330
|
-
req.headers.set(
|
|
1331
|
-
"Accept",
|
|
1332
|
-
`application/vnd.api+json; version=${this.apiVersion}`
|
|
1333
|
-
);
|
|
1330
|
+
req.headers.set("Accept", "application/vnd.api+json");
|
|
1334
1331
|
req.headers.set("Content-Type", "application/vnd.api+json");
|
|
1335
1332
|
if (typeof process !== "undefined") {
|
|
1336
1333
|
req.headers.set("User-Agent", userAgent);
|
|
@@ -3293,15 +3290,6 @@ var postTenants = (options) => (options.client ?? client).post({
|
|
|
3293
3290
|
...options.headers
|
|
3294
3291
|
}
|
|
3295
3292
|
});
|
|
3296
|
-
var postTenantsByIdRemoveStorage = (options) => (options.client ?? client).post({
|
|
3297
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
3298
|
-
url: "/tenants/{id}/remove-storage",
|
|
3299
|
-
...options,
|
|
3300
|
-
headers: {
|
|
3301
|
-
"Content-Type": "application/vnd.api+json",
|
|
3302
|
-
...options.headers
|
|
3303
|
-
}
|
|
3304
|
-
});
|
|
3305
3293
|
var getExtractionSchemaDiscoveriesById = (options) => (options.client ?? client).get({
|
|
3306
3294
|
security: [{ scheme: "bearer", type: "http" }],
|
|
3307
3295
|
url: "/extraction/schema-discoveries/{id}",
|
|
@@ -4069,15 +4057,6 @@ var patchSchedulingEventsById = (options) => (options.client ?? client).patch({
|
|
|
4069
4057
|
...options.headers
|
|
4070
4058
|
}
|
|
4071
4059
|
});
|
|
4072
|
-
var postTenantsByIdBuyStorage = (options) => (options.client ?? client).post({
|
|
4073
|
-
security: [{ scheme: "bearer", type: "http" }],
|
|
4074
|
-
url: "/tenants/{id}/buy-storage",
|
|
4075
|
-
...options,
|
|
4076
|
-
headers: {
|
|
4077
|
-
"Content-Type": "application/vnd.api+json",
|
|
4078
|
-
...options.headers
|
|
4079
|
-
}
|
|
4080
|
-
});
|
|
4081
4060
|
var getWorkspaceMemberships = (options) => (options.client ?? client).get({
|
|
4082
4061
|
security: [{ scheme: "bearer", type: "http" }],
|
|
4083
4062
|
url: "/workspace-memberships",
|
|
@@ -5193,6 +5172,15 @@ function createIdentityNamespace(rb) {
|
|
|
5193
5172
|
* console.log(token.access_token);
|
|
5194
5173
|
* ```
|
|
5195
5174
|
*/
|
|
5175
|
+
/**
|
|
5176
|
+
* Authenticate with email and password to receive an access token.
|
|
5177
|
+
* @example
|
|
5178
|
+
* ```typescript
|
|
5179
|
+
* const client = new GptClient({ apiKey: 'sk_tenant_...' });
|
|
5180
|
+
* const userWithToken = await client.identity.login('user@example.com', 'password123');
|
|
5181
|
+
* console.log(userWithToken.token);
|
|
5182
|
+
* ```
|
|
5183
|
+
*/
|
|
5196
5184
|
login: async (email, password, options) => {
|
|
5197
5185
|
LoginRequestSchema.parse({ email, password });
|
|
5198
5186
|
return rb.execute(
|
|
@@ -6043,28 +6031,6 @@ function createPlatformNamespace(rb) {
|
|
|
6043
6031
|
options
|
|
6044
6032
|
);
|
|
6045
6033
|
},
|
|
6046
|
-
/** Buy storage for a tenant */
|
|
6047
|
-
buyStorage: async (id, attributes, options) => {
|
|
6048
|
-
return rb.execute(
|
|
6049
|
-
postTenantsByIdBuyStorage,
|
|
6050
|
-
{
|
|
6051
|
-
path: { id },
|
|
6052
|
-
body: { data: { type: "tenant", attributes } }
|
|
6053
|
-
},
|
|
6054
|
-
options
|
|
6055
|
-
);
|
|
6056
|
-
},
|
|
6057
|
-
/** Remove storage from a tenant */
|
|
6058
|
-
removeStorage: async (id, attributes, options) => {
|
|
6059
|
-
return rb.execute(
|
|
6060
|
-
postTenantsByIdRemoveStorage,
|
|
6061
|
-
{
|
|
6062
|
-
path: { id },
|
|
6063
|
-
body: { data: { type: "tenant", attributes } }
|
|
6064
|
-
},
|
|
6065
|
-
options
|
|
6066
|
-
);
|
|
6067
|
-
},
|
|
6068
6034
|
/** Schedule a tenant purge */
|
|
6069
6035
|
schedulePurge: async (id, options) => {
|
|
6070
6036
|
return rb.execute(
|
|
@@ -11503,7 +11469,7 @@ var RequestBuilder = class {
|
|
|
11503
11469
|
async execute(fn, params, options) {
|
|
11504
11470
|
const headers = buildHeaders(this.getHeaders, options);
|
|
11505
11471
|
try {
|
|
11506
|
-
const
|
|
11472
|
+
const response = await this.requestWithRetry(
|
|
11507
11473
|
() => fn({
|
|
11508
11474
|
client: this.clientInstance,
|
|
11509
11475
|
headers,
|
|
@@ -11511,7 +11477,12 @@ var RequestBuilder = class {
|
|
|
11511
11477
|
...options?.signal && { signal: options.signal }
|
|
11512
11478
|
})
|
|
11513
11479
|
);
|
|
11514
|
-
|
|
11480
|
+
const { data, error } = response;
|
|
11481
|
+
if (error) {
|
|
11482
|
+
throw error;
|
|
11483
|
+
}
|
|
11484
|
+
const innerData = data?.data;
|
|
11485
|
+
return this.unwrap(innerData);
|
|
11515
11486
|
} catch (error) {
|
|
11516
11487
|
throw handleApiError(error);
|
|
11517
11488
|
}
|