@discomedia/utils 1.0.72 → 1.0.75
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-frontend.cjs +608 -13
- package/dist/index-frontend.cjs.map +1 -1
- package/dist/index-frontend.mjs +608 -13
- package/dist/index-frontend.mjs.map +1 -1
- package/dist/index.cjs +696 -19
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +696 -19
- package/dist/index.mjs.map +1 -1
- package/dist/package.json +8 -8
- package/dist/test.js +2556 -8967
- package/dist/test.js.map +1 -1
- package/dist/types/llm-config.d.ts +1 -1
- package/dist/types/llm-config.d.ts.map +1 -1
- package/dist/types/types/index.d.ts +1 -0
- package/dist/types/types/index.d.ts.map +1 -1
- package/dist/types/types/llm-types.d.ts +2 -2
- package/dist/types/types/llm-types.d.ts.map +1 -1
- package/dist/types-frontend/llm-config.d.ts +1 -1
- package/dist/types-frontend/llm-config.d.ts.map +1 -1
- package/dist/types-frontend/types/index.d.ts +1 -0
- package/dist/types-frontend/types/index.d.ts.map +1 -1
- package/dist/types-frontend/types/llm-types.d.ts +2 -2
- package/dist/types-frontend/types/llm-types.d.ts.map +1 -1
- package/package.json +8 -8
package/dist/index.cjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var require$$0$3 = require('events');
|
|
4
4
|
var require$$1 = require('https');
|
|
5
|
-
var require$$2 = require('http');
|
|
5
|
+
var require$$2$1 = require('http');
|
|
6
6
|
var require$$3$1 = require('net');
|
|
7
7
|
var require$$4 = require('tls');
|
|
8
8
|
var require$$3 = require('crypto');
|
|
@@ -10,9 +10,10 @@ var require$$0$2 = require('stream');
|
|
|
10
10
|
var require$$7 = require('url');
|
|
11
11
|
var require$$0 = require('zlib');
|
|
12
12
|
var require$$0$1 = require('buffer');
|
|
13
|
+
var require$$2 = require('util');
|
|
13
14
|
var require$$0$4 = require('fs');
|
|
14
15
|
var require$$1$1 = require('path');
|
|
15
|
-
var require$$2$
|
|
16
|
+
var require$$2$2 = require('os');
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Logs a message to the console.
|
|
@@ -1148,6 +1149,7 @@ const OPENAI_MODELS = [
|
|
|
1148
1149
|
'gpt-5',
|
|
1149
1150
|
'gpt-5-mini',
|
|
1150
1151
|
'gpt-5.4-mini',
|
|
1152
|
+
'gpt-5.4-nano',
|
|
1151
1153
|
'gpt-5-nano',
|
|
1152
1154
|
'gpt-5.1',
|
|
1153
1155
|
'gpt-5.4',
|
|
@@ -1190,6 +1192,7 @@ const OPENROUTER_MODELS = [
|
|
|
1190
1192
|
'openai/gpt-5',
|
|
1191
1193
|
'openai/gpt-5-mini',
|
|
1192
1194
|
'openai/gpt-5.4-mini',
|
|
1195
|
+
'openai/gpt-5.4-nano',
|
|
1193
1196
|
'openai/gpt-5-nano',
|
|
1194
1197
|
'openai/gpt-5.1',
|
|
1195
1198
|
'openai/gpt-5.4',
|
|
@@ -1700,7 +1703,7 @@ const safeJSON = (text) => {
|
|
|
1700
1703
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1701
1704
|
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
1702
1705
|
|
|
1703
|
-
const VERSION = '6.
|
|
1706
|
+
const VERSION = '6.39.0'; // x-release-please-version
|
|
1704
1707
|
|
|
1705
1708
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
1706
1709
|
const isRunningInBrowser = () => {
|
|
@@ -3149,19 +3152,22 @@ class WorkloadIdentityAuth {
|
|
|
3149
3152
|
}
|
|
3150
3153
|
async refreshToken() {
|
|
3151
3154
|
const subjectToken = await this.config.provider.getToken();
|
|
3155
|
+
const body = {
|
|
3156
|
+
grant_type: TOKEN_EXCHANGE_GRANT_TYPE,
|
|
3157
|
+
subject_token: subjectToken,
|
|
3158
|
+
subject_token_type: SUBJECT_TOKEN_TYPES[this.config.provider.tokenType],
|
|
3159
|
+
identity_provider_id: this.config.identityProviderId,
|
|
3160
|
+
service_account_id: this.config.serviceAccountId,
|
|
3161
|
+
};
|
|
3162
|
+
if (this.config.clientId) {
|
|
3163
|
+
body['client_id'] = this.config.clientId;
|
|
3164
|
+
}
|
|
3152
3165
|
const response = await this.fetch(this.tokenExchangeUrl, {
|
|
3153
3166
|
method: 'POST',
|
|
3154
3167
|
headers: {
|
|
3155
3168
|
'Content-Type': 'application/json',
|
|
3156
3169
|
},
|
|
3157
|
-
body: JSON.stringify(
|
|
3158
|
-
grant_type: TOKEN_EXCHANGE_GRANT_TYPE,
|
|
3159
|
-
client_id: this.config.clientId,
|
|
3160
|
-
subject_token: subjectToken,
|
|
3161
|
-
subject_token_type: SUBJECT_TOKEN_TYPES[this.config.provider.tokenType],
|
|
3162
|
-
identity_provider_id: this.config.identityProviderId,
|
|
3163
|
-
service_account_id: this.config.serviceAccountId,
|
|
3164
|
-
}),
|
|
3170
|
+
body: JSON.stringify(body),
|
|
3165
3171
|
});
|
|
3166
3172
|
if (!response.ok) {
|
|
3167
3173
|
const errorText = await response.text();
|
|
@@ -5233,6 +5239,43 @@ let Certificates$1 = class Certificates extends APIResource {
|
|
|
5233
5239
|
}
|
|
5234
5240
|
};
|
|
5235
5241
|
|
|
5242
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5243
|
+
let DataRetention$1 = class DataRetention extends APIResource {
|
|
5244
|
+
/**
|
|
5245
|
+
* Retrieves organization data retention controls.
|
|
5246
|
+
*
|
|
5247
|
+
* @example
|
|
5248
|
+
* ```ts
|
|
5249
|
+
* const organizationDataRetention =
|
|
5250
|
+
* await client.admin.organization.dataRetention.retrieve();
|
|
5251
|
+
* ```
|
|
5252
|
+
*/
|
|
5253
|
+
retrieve(options) {
|
|
5254
|
+
return this._client.get('/organization/data_retention', {
|
|
5255
|
+
...options,
|
|
5256
|
+
__security: { adminAPIKeyAuth: true },
|
|
5257
|
+
});
|
|
5258
|
+
}
|
|
5259
|
+
/**
|
|
5260
|
+
* Updates organization data retention controls.
|
|
5261
|
+
*
|
|
5262
|
+
* @example
|
|
5263
|
+
* ```ts
|
|
5264
|
+
* const organizationDataRetention =
|
|
5265
|
+
* await client.admin.organization.dataRetention.update({
|
|
5266
|
+
* retention_type: 'zero_data_retention',
|
|
5267
|
+
* });
|
|
5268
|
+
* ```
|
|
5269
|
+
*/
|
|
5270
|
+
update(body, options) {
|
|
5271
|
+
return this._client.post('/organization/data_retention', {
|
|
5272
|
+
body,
|
|
5273
|
+
...options,
|
|
5274
|
+
__security: { adminAPIKeyAuth: true },
|
|
5275
|
+
});
|
|
5276
|
+
}
|
|
5277
|
+
};
|
|
5278
|
+
|
|
5236
5279
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5237
5280
|
class Invites extends APIResource {
|
|
5238
5281
|
/**
|
|
@@ -5329,6 +5372,22 @@ let Roles$5 = class Roles extends APIResource {
|
|
|
5329
5372
|
__security: { adminAPIKeyAuth: true },
|
|
5330
5373
|
});
|
|
5331
5374
|
}
|
|
5375
|
+
/**
|
|
5376
|
+
* Retrieves an organization role.
|
|
5377
|
+
*
|
|
5378
|
+
* @example
|
|
5379
|
+
* ```ts
|
|
5380
|
+
* const role = await client.admin.organization.roles.retrieve(
|
|
5381
|
+
* 'role_id',
|
|
5382
|
+
* );
|
|
5383
|
+
* ```
|
|
5384
|
+
*/
|
|
5385
|
+
retrieve(roleID, options) {
|
|
5386
|
+
return this._client.get(path `/organization/roles/${roleID}`, {
|
|
5387
|
+
...options,
|
|
5388
|
+
__security: { adminAPIKeyAuth: true },
|
|
5389
|
+
});
|
|
5390
|
+
}
|
|
5332
5391
|
/**
|
|
5333
5392
|
* Updates an existing organization role.
|
|
5334
5393
|
*
|
|
@@ -5382,6 +5441,92 @@ let Roles$5 = class Roles extends APIResource {
|
|
|
5382
5441
|
}
|
|
5383
5442
|
};
|
|
5384
5443
|
|
|
5444
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5445
|
+
let SpendAlerts$1 = class SpendAlerts extends APIResource {
|
|
5446
|
+
/**
|
|
5447
|
+
* Creates an organization spend alert.
|
|
5448
|
+
*
|
|
5449
|
+
* @example
|
|
5450
|
+
* ```ts
|
|
5451
|
+
* const organizationSpendAlert =
|
|
5452
|
+
* await client.admin.organization.spendAlerts.create({
|
|
5453
|
+
* currency: 'USD',
|
|
5454
|
+
* interval: 'month',
|
|
5455
|
+
* notification_channel: {
|
|
5456
|
+
* recipients: ['string'],
|
|
5457
|
+
* type: 'email',
|
|
5458
|
+
* },
|
|
5459
|
+
* threshold_amount: 0,
|
|
5460
|
+
* });
|
|
5461
|
+
* ```
|
|
5462
|
+
*/
|
|
5463
|
+
create(body, options) {
|
|
5464
|
+
return this._client.post('/organization/spend_alerts', {
|
|
5465
|
+
body,
|
|
5466
|
+
...options,
|
|
5467
|
+
__security: { adminAPIKeyAuth: true },
|
|
5468
|
+
});
|
|
5469
|
+
}
|
|
5470
|
+
/**
|
|
5471
|
+
* Updates an organization spend alert.
|
|
5472
|
+
*
|
|
5473
|
+
* @example
|
|
5474
|
+
* ```ts
|
|
5475
|
+
* const organizationSpendAlert =
|
|
5476
|
+
* await client.admin.organization.spendAlerts.update(
|
|
5477
|
+
* 'alert_id',
|
|
5478
|
+
* {
|
|
5479
|
+
* currency: 'USD',
|
|
5480
|
+
* interval: 'month',
|
|
5481
|
+
* notification_channel: {
|
|
5482
|
+
* recipients: ['string'],
|
|
5483
|
+
* type: 'email',
|
|
5484
|
+
* },
|
|
5485
|
+
* threshold_amount: 0,
|
|
5486
|
+
* },
|
|
5487
|
+
* );
|
|
5488
|
+
* ```
|
|
5489
|
+
*/
|
|
5490
|
+
update(alertID, body, options) {
|
|
5491
|
+
return this._client.post(path `/organization/spend_alerts/${alertID}`, {
|
|
5492
|
+
body,
|
|
5493
|
+
...options,
|
|
5494
|
+
__security: { adminAPIKeyAuth: true },
|
|
5495
|
+
});
|
|
5496
|
+
}
|
|
5497
|
+
/**
|
|
5498
|
+
* Lists organization spend alerts.
|
|
5499
|
+
*
|
|
5500
|
+
* @example
|
|
5501
|
+
* ```ts
|
|
5502
|
+
* // Automatically fetches more pages as needed.
|
|
5503
|
+
* for await (const organizationSpendAlert of client.admin.organization.spendAlerts.list()) {
|
|
5504
|
+
* // ...
|
|
5505
|
+
* }
|
|
5506
|
+
* ```
|
|
5507
|
+
*/
|
|
5508
|
+
list(query = {}, options) {
|
|
5509
|
+
return this._client.getAPIList('/organization/spend_alerts', (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
5510
|
+
}
|
|
5511
|
+
/**
|
|
5512
|
+
* Deletes an organization spend alert.
|
|
5513
|
+
*
|
|
5514
|
+
* @example
|
|
5515
|
+
* ```ts
|
|
5516
|
+
* const organizationSpendAlertDeleted =
|
|
5517
|
+
* await client.admin.organization.spendAlerts.delete(
|
|
5518
|
+
* 'alert_id',
|
|
5519
|
+
* );
|
|
5520
|
+
* ```
|
|
5521
|
+
*/
|
|
5522
|
+
delete(alertID, options) {
|
|
5523
|
+
return this._client.delete(path `/organization/spend_alerts/${alertID}`, {
|
|
5524
|
+
...options,
|
|
5525
|
+
__security: { adminAPIKeyAuth: true },
|
|
5526
|
+
});
|
|
5527
|
+
}
|
|
5528
|
+
};
|
|
5529
|
+
|
|
5385
5530
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5386
5531
|
class Usage extends APIResource {
|
|
5387
5532
|
/**
|
|
@@ -5492,6 +5637,24 @@ class Usage extends APIResource {
|
|
|
5492
5637
|
__security: { adminAPIKeyAuth: true },
|
|
5493
5638
|
});
|
|
5494
5639
|
}
|
|
5640
|
+
/**
|
|
5641
|
+
* Get file search calls usage details for the organization.
|
|
5642
|
+
*
|
|
5643
|
+
* @example
|
|
5644
|
+
* ```ts
|
|
5645
|
+
* const response =
|
|
5646
|
+
* await client.admin.organization.usage.fileSearchCalls({
|
|
5647
|
+
* start_time: 0,
|
|
5648
|
+
* });
|
|
5649
|
+
* ```
|
|
5650
|
+
*/
|
|
5651
|
+
fileSearchCalls(query, options) {
|
|
5652
|
+
return this._client.get('/organization/usage/file_search_calls', {
|
|
5653
|
+
query,
|
|
5654
|
+
...options,
|
|
5655
|
+
__security: { adminAPIKeyAuth: true },
|
|
5656
|
+
});
|
|
5657
|
+
}
|
|
5495
5658
|
/**
|
|
5496
5659
|
* Get images usage details for the organization.
|
|
5497
5660
|
*
|
|
@@ -5546,6 +5709,24 @@ class Usage extends APIResource {
|
|
|
5546
5709
|
__security: { adminAPIKeyAuth: true },
|
|
5547
5710
|
});
|
|
5548
5711
|
}
|
|
5712
|
+
/**
|
|
5713
|
+
* Get web search calls usage details for the organization.
|
|
5714
|
+
*
|
|
5715
|
+
* @example
|
|
5716
|
+
* ```ts
|
|
5717
|
+
* const response =
|
|
5718
|
+
* await client.admin.organization.usage.webSearchCalls({
|
|
5719
|
+
* start_time: 0,
|
|
5720
|
+
* });
|
|
5721
|
+
* ```
|
|
5722
|
+
*/
|
|
5723
|
+
webSearchCalls(query, options) {
|
|
5724
|
+
return this._client.get('/organization/usage/web_search_calls', {
|
|
5725
|
+
query,
|
|
5726
|
+
...options,
|
|
5727
|
+
__security: { adminAPIKeyAuth: true },
|
|
5728
|
+
});
|
|
5729
|
+
}
|
|
5549
5730
|
}
|
|
5550
5731
|
|
|
5551
5732
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
@@ -5569,6 +5750,25 @@ let Roles$4 = class Roles extends APIResource {
|
|
|
5569
5750
|
__security: { adminAPIKeyAuth: true },
|
|
5570
5751
|
});
|
|
5571
5752
|
}
|
|
5753
|
+
/**
|
|
5754
|
+
* Retrieves an organization role assigned to a group.
|
|
5755
|
+
*
|
|
5756
|
+
* @example
|
|
5757
|
+
* ```ts
|
|
5758
|
+
* const role =
|
|
5759
|
+
* await client.admin.organization.groups.roles.retrieve(
|
|
5760
|
+
* 'role_id',
|
|
5761
|
+
* { group_id: 'group_id' },
|
|
5762
|
+
* );
|
|
5763
|
+
* ```
|
|
5764
|
+
*/
|
|
5765
|
+
retrieve(roleID, params, options) {
|
|
5766
|
+
const { group_id } = params;
|
|
5767
|
+
return this._client.get(path `/organization/groups/${group_id}/roles/${roleID}`, {
|
|
5768
|
+
...options,
|
|
5769
|
+
__security: { adminAPIKeyAuth: true },
|
|
5770
|
+
});
|
|
5771
|
+
}
|
|
5572
5772
|
/**
|
|
5573
5773
|
* Lists the organization roles assigned to a group within the organization.
|
|
5574
5774
|
*
|
|
@@ -5627,6 +5827,25 @@ let Users$2 = class Users extends APIResource {
|
|
|
5627
5827
|
__security: { adminAPIKeyAuth: true },
|
|
5628
5828
|
});
|
|
5629
5829
|
}
|
|
5830
|
+
/**
|
|
5831
|
+
* Retrieves a user in a group.
|
|
5832
|
+
*
|
|
5833
|
+
* @example
|
|
5834
|
+
* ```ts
|
|
5835
|
+
* const user =
|
|
5836
|
+
* await client.admin.organization.groups.users.retrieve(
|
|
5837
|
+
* 'user_id',
|
|
5838
|
+
* { group_id: 'group_id' },
|
|
5839
|
+
* );
|
|
5840
|
+
* ```
|
|
5841
|
+
*/
|
|
5842
|
+
retrieve(userID, params, options) {
|
|
5843
|
+
const { group_id } = params;
|
|
5844
|
+
return this._client.get(path `/organization/groups/${group_id}/users/${userID}`, {
|
|
5845
|
+
...options,
|
|
5846
|
+
__security: { adminAPIKeyAuth: true },
|
|
5847
|
+
});
|
|
5848
|
+
}
|
|
5630
5849
|
/**
|
|
5631
5850
|
* Lists the users assigned to a group.
|
|
5632
5851
|
*
|
|
@@ -5688,6 +5907,23 @@ let Groups$1 = class Groups extends APIResource {
|
|
|
5688
5907
|
__security: { adminAPIKeyAuth: true },
|
|
5689
5908
|
});
|
|
5690
5909
|
}
|
|
5910
|
+
/**
|
|
5911
|
+
* Retrieves a group.
|
|
5912
|
+
*
|
|
5913
|
+
* @example
|
|
5914
|
+
* ```ts
|
|
5915
|
+
* const group =
|
|
5916
|
+
* await client.admin.organization.groups.retrieve(
|
|
5917
|
+
* 'group_id',
|
|
5918
|
+
* );
|
|
5919
|
+
* ```
|
|
5920
|
+
*/
|
|
5921
|
+
retrieve(groupID, options) {
|
|
5922
|
+
return this._client.get(path `/organization/groups/${groupID}`, {
|
|
5923
|
+
...options,
|
|
5924
|
+
__security: { adminAPIKeyAuth: true },
|
|
5925
|
+
});
|
|
5926
|
+
}
|
|
5691
5927
|
/**
|
|
5692
5928
|
* Updates a group's information.
|
|
5693
5929
|
*
|
|
@@ -5862,6 +6098,142 @@ class Certificates extends APIResource {
|
|
|
5862
6098
|
}
|
|
5863
6099
|
}
|
|
5864
6100
|
|
|
6101
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6102
|
+
class DataRetention extends APIResource {
|
|
6103
|
+
/**
|
|
6104
|
+
* Retrieves project data retention controls.
|
|
6105
|
+
*
|
|
6106
|
+
* @example
|
|
6107
|
+
* ```ts
|
|
6108
|
+
* const projectDataRetention =
|
|
6109
|
+
* await client.admin.organization.projects.dataRetention.retrieve(
|
|
6110
|
+
* 'project_id',
|
|
6111
|
+
* );
|
|
6112
|
+
* ```
|
|
6113
|
+
*/
|
|
6114
|
+
retrieve(projectID, options) {
|
|
6115
|
+
return this._client.get(path `/organization/projects/${projectID}/data_retention`, {
|
|
6116
|
+
...options,
|
|
6117
|
+
__security: { adminAPIKeyAuth: true },
|
|
6118
|
+
});
|
|
6119
|
+
}
|
|
6120
|
+
/**
|
|
6121
|
+
* Updates project data retention controls.
|
|
6122
|
+
*
|
|
6123
|
+
* @example
|
|
6124
|
+
* ```ts
|
|
6125
|
+
* const projectDataRetention =
|
|
6126
|
+
* await client.admin.organization.projects.dataRetention.update(
|
|
6127
|
+
* 'project_id',
|
|
6128
|
+
* { retention_type: 'organization_default' },
|
|
6129
|
+
* );
|
|
6130
|
+
* ```
|
|
6131
|
+
*/
|
|
6132
|
+
update(projectID, body, options) {
|
|
6133
|
+
return this._client.post(path `/organization/projects/${projectID}/data_retention`, {
|
|
6134
|
+
body,
|
|
6135
|
+
...options,
|
|
6136
|
+
__security: { adminAPIKeyAuth: true },
|
|
6137
|
+
});
|
|
6138
|
+
}
|
|
6139
|
+
}
|
|
6140
|
+
|
|
6141
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6142
|
+
class HostedToolPermissions extends APIResource {
|
|
6143
|
+
/**
|
|
6144
|
+
* Returns hosted tool permissions for a project.
|
|
6145
|
+
*
|
|
6146
|
+
* @example
|
|
6147
|
+
* ```ts
|
|
6148
|
+
* const projectHostedToolPermissions =
|
|
6149
|
+
* await client.admin.organization.projects.hostedToolPermissions.retrieve(
|
|
6150
|
+
* 'project_id',
|
|
6151
|
+
* );
|
|
6152
|
+
* ```
|
|
6153
|
+
*/
|
|
6154
|
+
retrieve(projectID, options) {
|
|
6155
|
+
return this._client.get(path `/organization/projects/${projectID}/hosted_tool_permissions`, {
|
|
6156
|
+
...options,
|
|
6157
|
+
__security: { adminAPIKeyAuth: true },
|
|
6158
|
+
});
|
|
6159
|
+
}
|
|
6160
|
+
/**
|
|
6161
|
+
* Updates hosted tool permissions for a project.
|
|
6162
|
+
*
|
|
6163
|
+
* @example
|
|
6164
|
+
* ```ts
|
|
6165
|
+
* const projectHostedToolPermissions =
|
|
6166
|
+
* await client.admin.organization.projects.hostedToolPermissions.update(
|
|
6167
|
+
* 'project_id',
|
|
6168
|
+
* );
|
|
6169
|
+
* ```
|
|
6170
|
+
*/
|
|
6171
|
+
update(projectID, body, options) {
|
|
6172
|
+
return this._client.post(path `/organization/projects/${projectID}/hosted_tool_permissions`, {
|
|
6173
|
+
body,
|
|
6174
|
+
...options,
|
|
6175
|
+
__security: { adminAPIKeyAuth: true },
|
|
6176
|
+
});
|
|
6177
|
+
}
|
|
6178
|
+
}
|
|
6179
|
+
|
|
6180
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6181
|
+
class ModelPermissions extends APIResource {
|
|
6182
|
+
/**
|
|
6183
|
+
* Returns model permissions for a project.
|
|
6184
|
+
*
|
|
6185
|
+
* @example
|
|
6186
|
+
* ```ts
|
|
6187
|
+
* const projectModelPermissions =
|
|
6188
|
+
* await client.admin.organization.projects.modelPermissions.retrieve(
|
|
6189
|
+
* 'project_id',
|
|
6190
|
+
* );
|
|
6191
|
+
* ```
|
|
6192
|
+
*/
|
|
6193
|
+
retrieve(projectID, options) {
|
|
6194
|
+
return this._client.get(path `/organization/projects/${projectID}/model_permissions`, {
|
|
6195
|
+
...options,
|
|
6196
|
+
__security: { adminAPIKeyAuth: true },
|
|
6197
|
+
});
|
|
6198
|
+
}
|
|
6199
|
+
/**
|
|
6200
|
+
* Updates model permissions for a project.
|
|
6201
|
+
*
|
|
6202
|
+
* @example
|
|
6203
|
+
* ```ts
|
|
6204
|
+
* const projectModelPermissions =
|
|
6205
|
+
* await client.admin.organization.projects.modelPermissions.update(
|
|
6206
|
+
* 'project_id',
|
|
6207
|
+
* { mode: 'allow_list', model_ids: ['string'] },
|
|
6208
|
+
* );
|
|
6209
|
+
* ```
|
|
6210
|
+
*/
|
|
6211
|
+
update(projectID, body, options) {
|
|
6212
|
+
return this._client.post(path `/organization/projects/${projectID}/model_permissions`, {
|
|
6213
|
+
body,
|
|
6214
|
+
...options,
|
|
6215
|
+
__security: { adminAPIKeyAuth: true },
|
|
6216
|
+
});
|
|
6217
|
+
}
|
|
6218
|
+
/**
|
|
6219
|
+
* Deletes model permissions for a project.
|
|
6220
|
+
*
|
|
6221
|
+
* @example
|
|
6222
|
+
* ```ts
|
|
6223
|
+
* const projectModelPermissionsDeleted =
|
|
6224
|
+
* await client.admin.organization.projects.modelPermissions.delete(
|
|
6225
|
+
* 'project_id',
|
|
6226
|
+
* );
|
|
6227
|
+
* ```
|
|
6228
|
+
*/
|
|
6229
|
+
delete(projectID, options) {
|
|
6230
|
+
return this._client.delete(path `/organization/projects/${projectID}/model_permissions`, {
|
|
6231
|
+
...options,
|
|
6232
|
+
__security: { adminAPIKeyAuth: true },
|
|
6233
|
+
});
|
|
6234
|
+
}
|
|
6235
|
+
}
|
|
6236
|
+
|
|
5865
6237
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
5866
6238
|
class RateLimits extends APIResource {
|
|
5867
6239
|
/**
|
|
@@ -5923,6 +6295,25 @@ let Roles$3 = class Roles extends APIResource {
|
|
|
5923
6295
|
__security: { adminAPIKeyAuth: true },
|
|
5924
6296
|
});
|
|
5925
6297
|
}
|
|
6298
|
+
/**
|
|
6299
|
+
* Retrieves a project role.
|
|
6300
|
+
*
|
|
6301
|
+
* @example
|
|
6302
|
+
* ```ts
|
|
6303
|
+
* const role =
|
|
6304
|
+
* await client.admin.organization.projects.roles.retrieve(
|
|
6305
|
+
* 'role_id',
|
|
6306
|
+
* { project_id: 'project_id' },
|
|
6307
|
+
* );
|
|
6308
|
+
* ```
|
|
6309
|
+
*/
|
|
6310
|
+
retrieve(roleID, params, options) {
|
|
6311
|
+
const { project_id } = params;
|
|
6312
|
+
return this._client.get(path `/projects/${project_id}/roles/${roleID}`, {
|
|
6313
|
+
...options,
|
|
6314
|
+
__security: { adminAPIKeyAuth: true },
|
|
6315
|
+
});
|
|
6316
|
+
}
|
|
5926
6317
|
/**
|
|
5927
6318
|
* Updates an existing project role.
|
|
5928
6319
|
*
|
|
@@ -6025,6 +6416,22 @@ class ServiceAccounts extends APIResource {
|
|
|
6025
6416
|
__security: { adminAPIKeyAuth: true },
|
|
6026
6417
|
});
|
|
6027
6418
|
}
|
|
6419
|
+
/**
|
|
6420
|
+
* Updates a service account in the project.
|
|
6421
|
+
*
|
|
6422
|
+
* @example
|
|
6423
|
+
* ```ts
|
|
6424
|
+
* const projectServiceAccount =
|
|
6425
|
+
* await client.admin.organization.projects.serviceAccounts.update(
|
|
6426
|
+
* 'service_account_id',
|
|
6427
|
+
* { project_id: 'project_id' },
|
|
6428
|
+
* );
|
|
6429
|
+
* ```
|
|
6430
|
+
*/
|
|
6431
|
+
update(serviceAccountID, params, options) {
|
|
6432
|
+
const { project_id, ...body } = params;
|
|
6433
|
+
return this._client.post(path `/organization/projects/${project_id}/service_accounts/${serviceAccountID}`, { body, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6434
|
+
}
|
|
6028
6435
|
/**
|
|
6029
6436
|
* Returns a list of service accounts in the project.
|
|
6030
6437
|
*
|
|
@@ -6062,6 +6469,101 @@ class ServiceAccounts extends APIResource {
|
|
|
6062
6469
|
}
|
|
6063
6470
|
}
|
|
6064
6471
|
|
|
6472
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6473
|
+
class SpendAlerts extends APIResource {
|
|
6474
|
+
/**
|
|
6475
|
+
* Creates a project spend alert.
|
|
6476
|
+
*
|
|
6477
|
+
* @example
|
|
6478
|
+
* ```ts
|
|
6479
|
+
* const projectSpendAlert =
|
|
6480
|
+
* await client.admin.organization.projects.spendAlerts.create(
|
|
6481
|
+
* 'project_id',
|
|
6482
|
+
* {
|
|
6483
|
+
* currency: 'USD',
|
|
6484
|
+
* interval: 'month',
|
|
6485
|
+
* notification_channel: {
|
|
6486
|
+
* recipients: ['string'],
|
|
6487
|
+
* type: 'email',
|
|
6488
|
+
* },
|
|
6489
|
+
* threshold_amount: 0,
|
|
6490
|
+
* },
|
|
6491
|
+
* );
|
|
6492
|
+
* ```
|
|
6493
|
+
*/
|
|
6494
|
+
create(projectID, body, options) {
|
|
6495
|
+
return this._client.post(path `/organization/projects/${projectID}/spend_alerts`, {
|
|
6496
|
+
body,
|
|
6497
|
+
...options,
|
|
6498
|
+
__security: { adminAPIKeyAuth: true },
|
|
6499
|
+
});
|
|
6500
|
+
}
|
|
6501
|
+
/**
|
|
6502
|
+
* Updates a project spend alert.
|
|
6503
|
+
*
|
|
6504
|
+
* @example
|
|
6505
|
+
* ```ts
|
|
6506
|
+
* const projectSpendAlert =
|
|
6507
|
+
* await client.admin.organization.projects.spendAlerts.update(
|
|
6508
|
+
* 'alert_id',
|
|
6509
|
+
* {
|
|
6510
|
+
* project_id: 'project_id',
|
|
6511
|
+
* currency: 'USD',
|
|
6512
|
+
* interval: 'month',
|
|
6513
|
+
* notification_channel: {
|
|
6514
|
+
* recipients: ['string'],
|
|
6515
|
+
* type: 'email',
|
|
6516
|
+
* },
|
|
6517
|
+
* threshold_amount: 0,
|
|
6518
|
+
* },
|
|
6519
|
+
* );
|
|
6520
|
+
* ```
|
|
6521
|
+
*/
|
|
6522
|
+
update(alertID, params, options) {
|
|
6523
|
+
const { project_id, ...body } = params;
|
|
6524
|
+
return this._client.post(path `/organization/projects/${project_id}/spend_alerts/${alertID}`, {
|
|
6525
|
+
body,
|
|
6526
|
+
...options,
|
|
6527
|
+
__security: { adminAPIKeyAuth: true },
|
|
6528
|
+
});
|
|
6529
|
+
}
|
|
6530
|
+
/**
|
|
6531
|
+
* Lists project spend alerts.
|
|
6532
|
+
*
|
|
6533
|
+
* @example
|
|
6534
|
+
* ```ts
|
|
6535
|
+
* // Automatically fetches more pages as needed.
|
|
6536
|
+
* for await (const projectSpendAlert of client.admin.organization.projects.spendAlerts.list(
|
|
6537
|
+
* 'project_id',
|
|
6538
|
+
* )) {
|
|
6539
|
+
* // ...
|
|
6540
|
+
* }
|
|
6541
|
+
* ```
|
|
6542
|
+
*/
|
|
6543
|
+
list(projectID, query = {}, options) {
|
|
6544
|
+
return this._client.getAPIList(path `/organization/projects/${projectID}/spend_alerts`, (ConversationCursorPage), { query, ...options, __security: { adminAPIKeyAuth: true } });
|
|
6545
|
+
}
|
|
6546
|
+
/**
|
|
6547
|
+
* Deletes a project spend alert.
|
|
6548
|
+
*
|
|
6549
|
+
* @example
|
|
6550
|
+
* ```ts
|
|
6551
|
+
* const projectSpendAlertDeleted =
|
|
6552
|
+
* await client.admin.organization.projects.spendAlerts.delete(
|
|
6553
|
+
* 'alert_id',
|
|
6554
|
+
* { project_id: 'project_id' },
|
|
6555
|
+
* );
|
|
6556
|
+
* ```
|
|
6557
|
+
*/
|
|
6558
|
+
delete(alertID, params, options) {
|
|
6559
|
+
const { project_id } = params;
|
|
6560
|
+
return this._client.delete(path `/organization/projects/${project_id}/spend_alerts/${alertID}`, {
|
|
6561
|
+
...options,
|
|
6562
|
+
__security: { adminAPIKeyAuth: true },
|
|
6563
|
+
});
|
|
6564
|
+
}
|
|
6565
|
+
}
|
|
6566
|
+
|
|
6065
6567
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
6066
6568
|
let Roles$2 = class Roles extends APIResource {
|
|
6067
6569
|
/**
|
|
@@ -6084,6 +6586,25 @@ let Roles$2 = class Roles extends APIResource {
|
|
|
6084
6586
|
__security: { adminAPIKeyAuth: true },
|
|
6085
6587
|
});
|
|
6086
6588
|
}
|
|
6589
|
+
/**
|
|
6590
|
+
* Retrieves a project role assigned to a group.
|
|
6591
|
+
*
|
|
6592
|
+
* @example
|
|
6593
|
+
* ```ts
|
|
6594
|
+
* const role =
|
|
6595
|
+
* await client.admin.organization.projects.groups.roles.retrieve(
|
|
6596
|
+
* 'role_id',
|
|
6597
|
+
* { project_id: 'project_id', group_id: 'group_id' },
|
|
6598
|
+
* );
|
|
6599
|
+
* ```
|
|
6600
|
+
*/
|
|
6601
|
+
retrieve(roleID, params, options) {
|
|
6602
|
+
const { project_id, group_id } = params;
|
|
6603
|
+
return this._client.get(path `/projects/${project_id}/groups/${group_id}/roles/${roleID}`, {
|
|
6604
|
+
...options,
|
|
6605
|
+
__security: { adminAPIKeyAuth: true },
|
|
6606
|
+
});
|
|
6607
|
+
}
|
|
6087
6608
|
/**
|
|
6088
6609
|
* Lists the project roles assigned to a group within a project.
|
|
6089
6610
|
*
|
|
@@ -6148,6 +6669,26 @@ class Groups extends APIResource {
|
|
|
6148
6669
|
__security: { adminAPIKeyAuth: true },
|
|
6149
6670
|
});
|
|
6150
6671
|
}
|
|
6672
|
+
/**
|
|
6673
|
+
* Retrieves a project's group.
|
|
6674
|
+
*
|
|
6675
|
+
* @example
|
|
6676
|
+
* ```ts
|
|
6677
|
+
* const projectGroup =
|
|
6678
|
+
* await client.admin.organization.projects.groups.retrieve(
|
|
6679
|
+
* 'group_id',
|
|
6680
|
+
* { project_id: 'project_id' },
|
|
6681
|
+
* );
|
|
6682
|
+
* ```
|
|
6683
|
+
*/
|
|
6684
|
+
retrieve(groupID, params, options) {
|
|
6685
|
+
const { project_id, ...query } = params;
|
|
6686
|
+
return this._client.get(path `/organization/projects/${project_id}/groups/${groupID}`, {
|
|
6687
|
+
query,
|
|
6688
|
+
...options,
|
|
6689
|
+
__security: { adminAPIKeyAuth: true },
|
|
6690
|
+
});
|
|
6691
|
+
}
|
|
6151
6692
|
/**
|
|
6152
6693
|
* Lists the groups that have access to a project.
|
|
6153
6694
|
*
|
|
@@ -6208,6 +6749,25 @@ let Roles$1 = class Roles extends APIResource {
|
|
|
6208
6749
|
__security: { adminAPIKeyAuth: true },
|
|
6209
6750
|
});
|
|
6210
6751
|
}
|
|
6752
|
+
/**
|
|
6753
|
+
* Retrieves a project role assigned to a user.
|
|
6754
|
+
*
|
|
6755
|
+
* @example
|
|
6756
|
+
* ```ts
|
|
6757
|
+
* const role =
|
|
6758
|
+
* await client.admin.organization.projects.users.roles.retrieve(
|
|
6759
|
+
* 'role_id',
|
|
6760
|
+
* { project_id: 'project_id', user_id: 'user_id' },
|
|
6761
|
+
* );
|
|
6762
|
+
* ```
|
|
6763
|
+
*/
|
|
6764
|
+
retrieve(roleID, params, options) {
|
|
6765
|
+
const { project_id, user_id } = params;
|
|
6766
|
+
return this._client.get(path `/projects/${project_id}/users/${user_id}/roles/${roleID}`, {
|
|
6767
|
+
...options,
|
|
6768
|
+
__security: { adminAPIKeyAuth: true },
|
|
6769
|
+
});
|
|
6770
|
+
}
|
|
6211
6771
|
/**
|
|
6212
6772
|
* Lists the project roles assigned to a user within a project.
|
|
6213
6773
|
*
|
|
@@ -6361,8 +6921,12 @@ class Projects extends APIResource {
|
|
|
6361
6921
|
this.serviceAccounts = new ServiceAccounts(this._client);
|
|
6362
6922
|
this.apiKeys = new APIKeys(this._client);
|
|
6363
6923
|
this.rateLimits = new RateLimits(this._client);
|
|
6924
|
+
this.modelPermissions = new ModelPermissions(this._client);
|
|
6925
|
+
this.hostedToolPermissions = new HostedToolPermissions(this._client);
|
|
6364
6926
|
this.groups = new Groups(this._client);
|
|
6365
6927
|
this.roles = new Roles$3(this._client);
|
|
6928
|
+
this.dataRetention = new DataRetention(this._client);
|
|
6929
|
+
this.spendAlerts = new SpendAlerts(this._client);
|
|
6366
6930
|
this.certificates = new Certificates(this._client);
|
|
6367
6931
|
}
|
|
6368
6932
|
/**
|
|
@@ -6460,8 +7024,12 @@ Projects.Users = Users$1;
|
|
|
6460
7024
|
Projects.ServiceAccounts = ServiceAccounts;
|
|
6461
7025
|
Projects.APIKeys = APIKeys;
|
|
6462
7026
|
Projects.RateLimits = RateLimits;
|
|
7027
|
+
Projects.ModelPermissions = ModelPermissions;
|
|
7028
|
+
Projects.HostedToolPermissions = HostedToolPermissions;
|
|
6463
7029
|
Projects.Groups = Groups;
|
|
6464
7030
|
Projects.Roles = Roles$3;
|
|
7031
|
+
Projects.DataRetention = DataRetention;
|
|
7032
|
+
Projects.SpendAlerts = SpendAlerts;
|
|
6465
7033
|
Projects.Certificates = Certificates;
|
|
6466
7034
|
|
|
6467
7035
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
@@ -6485,6 +7053,25 @@ class Roles extends APIResource {
|
|
|
6485
7053
|
__security: { adminAPIKeyAuth: true },
|
|
6486
7054
|
});
|
|
6487
7055
|
}
|
|
7056
|
+
/**
|
|
7057
|
+
* Retrieves an organization role assigned to a user.
|
|
7058
|
+
*
|
|
7059
|
+
* @example
|
|
7060
|
+
* ```ts
|
|
7061
|
+
* const role =
|
|
7062
|
+
* await client.admin.organization.users.roles.retrieve(
|
|
7063
|
+
* 'role_id',
|
|
7064
|
+
* { user_id: 'user_id' },
|
|
7065
|
+
* );
|
|
7066
|
+
* ```
|
|
7067
|
+
*/
|
|
7068
|
+
retrieve(roleID, params, options) {
|
|
7069
|
+
const { user_id } = params;
|
|
7070
|
+
return this._client.get(path `/organization/users/${user_id}/roles/${roleID}`, {
|
|
7071
|
+
...options,
|
|
7072
|
+
__security: { adminAPIKeyAuth: true },
|
|
7073
|
+
});
|
|
7074
|
+
}
|
|
6488
7075
|
/**
|
|
6489
7076
|
* Lists the organization roles assigned to a user within the organization.
|
|
6490
7077
|
*
|
|
@@ -6607,6 +7194,8 @@ class Organization extends APIResource {
|
|
|
6607
7194
|
this.users = new Users(this._client);
|
|
6608
7195
|
this.groups = new Groups$1(this._client);
|
|
6609
7196
|
this.roles = new Roles$5(this._client);
|
|
7197
|
+
this.dataRetention = new DataRetention$1(this._client);
|
|
7198
|
+
this.spendAlerts = new SpendAlerts$1(this._client);
|
|
6610
7199
|
this.certificates = new Certificates$1(this._client);
|
|
6611
7200
|
this.projects = new Projects(this._client);
|
|
6612
7201
|
}
|
|
@@ -6618,6 +7207,8 @@ Organization.Invites = Invites;
|
|
|
6618
7207
|
Organization.Users = Users;
|
|
6619
7208
|
Organization.Groups = Groups$1;
|
|
6620
7209
|
Organization.Roles = Roles$5;
|
|
7210
|
+
Organization.DataRetention = DataRetention$1;
|
|
7211
|
+
Organization.SpendAlerts = SpendAlerts$1;
|
|
6621
7212
|
Organization.Certificates = Certificates$1;
|
|
6622
7213
|
Organization.Projects = Projects;
|
|
6623
7214
|
|
|
@@ -13612,7 +14203,7 @@ const DEFAULT_MODEL = 'gpt-5.4-mini';
|
|
|
13612
14203
|
const GPT_5_HIGH_CONTEXT_THRESHOLD_TOKENS = 272_000;
|
|
13613
14204
|
const GPT_5_HIGH_CONTEXT_INPUT_MULTIPLIER = 2;
|
|
13614
14205
|
const GPT_5_HIGH_CONTEXT_OUTPUT_MULTIPLIER = 1.5;
|
|
13615
|
-
/** Token costs in USD per 1M tokens. Last updated May 2026. */
|
|
14206
|
+
/** Token costs in USD per 1M tokens. Last updated May 2026 from the OpenAI API pricing page. */
|
|
13616
14207
|
const openAiModelCosts = {
|
|
13617
14208
|
'gpt-5': {
|
|
13618
14209
|
inputCost: 1.25 / 1_000_000,
|
|
@@ -13625,9 +14216,14 @@ const openAiModelCosts = {
|
|
|
13625
14216
|
outputCost: 2 / 1_000_000,
|
|
13626
14217
|
},
|
|
13627
14218
|
'gpt-5.4-mini': {
|
|
13628
|
-
inputCost: 0.
|
|
13629
|
-
cacheHitCost: 0.
|
|
13630
|
-
outputCost:
|
|
14219
|
+
inputCost: 0.75 / 1_000_000,
|
|
14220
|
+
cacheHitCost: 0.075 / 1_000_000,
|
|
14221
|
+
outputCost: 4.5 / 1_000_000,
|
|
14222
|
+
},
|
|
14223
|
+
'gpt-5.4-nano': {
|
|
14224
|
+
inputCost: 0.2 / 1_000_000,
|
|
14225
|
+
cacheHitCost: 0.02 / 1_000_000,
|
|
14226
|
+
outputCost: 1.25 / 1_000_000,
|
|
13631
14227
|
},
|
|
13632
14228
|
'gpt-5-nano': {
|
|
13633
14229
|
inputCost: 0.05 / 1_000_000,
|
|
@@ -16254,6 +16850,10 @@ function requireReceiver () {
|
|
|
16254
16850
|
* extensions
|
|
16255
16851
|
* @param {Boolean} [options.isServer=false] Specifies whether to operate in
|
|
16256
16852
|
* client or server mode
|
|
16853
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
16854
|
+
* buffered data chunks
|
|
16855
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
16856
|
+
* fragments
|
|
16257
16857
|
* @param {Number} [options.maxPayload=0] The maximum allowed message length
|
|
16258
16858
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
16259
16859
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -16268,6 +16868,8 @@ function requireReceiver () {
|
|
|
16268
16868
|
this._binaryType = options.binaryType || BINARY_TYPES[0];
|
|
16269
16869
|
this._extensions = options.extensions || {};
|
|
16270
16870
|
this._isServer = !!options.isServer;
|
|
16871
|
+
this._maxBufferedChunks = options.maxBufferedChunks | 0;
|
|
16872
|
+
this._maxFragments = options.maxFragments | 0;
|
|
16271
16873
|
this._maxPayload = options.maxPayload | 0;
|
|
16272
16874
|
this._skipUTF8Validation = !!options.skipUTF8Validation;
|
|
16273
16875
|
this[kWebSocket] = undefined;
|
|
@@ -16303,6 +16905,22 @@ function requireReceiver () {
|
|
|
16303
16905
|
_write(chunk, encoding, cb) {
|
|
16304
16906
|
if (this._opcode === 0x08 && this._state == GET_INFO) return cb();
|
|
16305
16907
|
|
|
16908
|
+
if (
|
|
16909
|
+
this._maxBufferedChunks > 0 &&
|
|
16910
|
+
this._buffers.length >= this._maxBufferedChunks
|
|
16911
|
+
) {
|
|
16912
|
+
cb(
|
|
16913
|
+
this.createError(
|
|
16914
|
+
RangeError,
|
|
16915
|
+
'Too many buffered chunks',
|
|
16916
|
+
false,
|
|
16917
|
+
1008,
|
|
16918
|
+
'WS_ERR_TOO_MANY_BUFFERED_PARTS'
|
|
16919
|
+
)
|
|
16920
|
+
);
|
|
16921
|
+
return;
|
|
16922
|
+
}
|
|
16923
|
+
|
|
16306
16924
|
this._bufferedBytes += chunk.length;
|
|
16307
16925
|
this._buffers.push(chunk);
|
|
16308
16926
|
this.startLoop(cb);
|
|
@@ -16699,6 +17317,22 @@ function requireReceiver () {
|
|
|
16699
17317
|
}
|
|
16700
17318
|
|
|
16701
17319
|
if (data.length) {
|
|
17320
|
+
if (
|
|
17321
|
+
this._maxFragments > 0 &&
|
|
17322
|
+
this._fragments.length >= this._maxFragments
|
|
17323
|
+
) {
|
|
17324
|
+
const error = this.createError(
|
|
17325
|
+
RangeError,
|
|
17326
|
+
'Too many message fragments',
|
|
17327
|
+
false,
|
|
17328
|
+
1008,
|
|
17329
|
+
'WS_ERR_TOO_MANY_BUFFERED_PARTS'
|
|
17330
|
+
);
|
|
17331
|
+
|
|
17332
|
+
cb(error);
|
|
17333
|
+
return;
|
|
17334
|
+
}
|
|
17335
|
+
|
|
16702
17336
|
//
|
|
16703
17337
|
// This message is not compressed so its length is the sum of the payload
|
|
16704
17338
|
// length of all fragments.
|
|
@@ -16738,6 +17372,22 @@ function requireReceiver () {
|
|
|
16738
17372
|
return;
|
|
16739
17373
|
}
|
|
16740
17374
|
|
|
17375
|
+
if (
|
|
17376
|
+
this._maxFragments > 0 &&
|
|
17377
|
+
this._fragments.length >= this._maxFragments
|
|
17378
|
+
) {
|
|
17379
|
+
const error = this.createError(
|
|
17380
|
+
RangeError,
|
|
17381
|
+
'Too many message fragments',
|
|
17382
|
+
false,
|
|
17383
|
+
1008,
|
|
17384
|
+
'WS_ERR_TOO_MANY_BUFFERED_PARTS'
|
|
17385
|
+
);
|
|
17386
|
+
|
|
17387
|
+
cb(error);
|
|
17388
|
+
return;
|
|
17389
|
+
}
|
|
17390
|
+
|
|
16741
17391
|
this._fragments.push(buf);
|
|
16742
17392
|
}
|
|
16743
17393
|
|
|
@@ -16932,6 +17582,9 @@ function requireSender () {
|
|
|
16932
17582
|
|
|
16933
17583
|
const { Duplex } = require$$0$2;
|
|
16934
17584
|
const { randomFillSync } = require$$3;
|
|
17585
|
+
const {
|
|
17586
|
+
types: { isUint8Array }
|
|
17587
|
+
} = require$$2;
|
|
16935
17588
|
|
|
16936
17589
|
const PerMessageDeflate = requirePermessageDeflate();
|
|
16937
17590
|
const { EMPTY_BUFFER, kWebSocket, NOOP } = requireConstants();
|
|
@@ -17128,8 +17781,10 @@ function requireSender () {
|
|
|
17128
17781
|
|
|
17129
17782
|
if (typeof data === 'string') {
|
|
17130
17783
|
buf.write(data, 2);
|
|
17131
|
-
} else {
|
|
17784
|
+
} else if (isUint8Array(data)) {
|
|
17132
17785
|
buf.set(data, 2);
|
|
17786
|
+
} else {
|
|
17787
|
+
throw new TypeError('Second argument must be a string or a Uint8Array');
|
|
17133
17788
|
}
|
|
17134
17789
|
}
|
|
17135
17790
|
|
|
@@ -18053,7 +18708,7 @@ function requireWebsocket () {
|
|
|
18053
18708
|
|
|
18054
18709
|
const EventEmitter = require$$0$3;
|
|
18055
18710
|
const https = require$$1;
|
|
18056
|
-
const http = require$$2;
|
|
18711
|
+
const http = require$$2$1;
|
|
18057
18712
|
const net = require$$3$1;
|
|
18058
18713
|
const tls = require$$4;
|
|
18059
18714
|
const { randomBytes, createHash } = require$$3;
|
|
@@ -18250,6 +18905,10 @@ function requireWebsocket () {
|
|
|
18250
18905
|
* multiple times in the same tick
|
|
18251
18906
|
* @param {Function} [options.generateMask] The function used to generate the
|
|
18252
18907
|
* masking key
|
|
18908
|
+
* @param {Number} [options.maxBufferedChunks=0] The maximum number of
|
|
18909
|
+
* buffered data chunks
|
|
18910
|
+
* @param {Number} [options.maxFragments=0] The maximum number of message
|
|
18911
|
+
* fragments
|
|
18253
18912
|
* @param {Number} [options.maxPayload=0] The maximum allowed message size
|
|
18254
18913
|
* @param {Boolean} [options.skipUTF8Validation=false] Specifies whether or
|
|
18255
18914
|
* not to skip UTF-8 validation for text and close messages
|
|
@@ -18261,6 +18920,8 @@ function requireWebsocket () {
|
|
|
18261
18920
|
binaryType: this.binaryType,
|
|
18262
18921
|
extensions: this._extensions,
|
|
18263
18922
|
isServer: this._isServer,
|
|
18923
|
+
maxBufferedChunks: options.maxBufferedChunks,
|
|
18924
|
+
maxFragments: options.maxFragments,
|
|
18264
18925
|
maxPayload: options.maxPayload,
|
|
18265
18926
|
skipUTF8Validation: options.skipUTF8Validation
|
|
18266
18927
|
});
|
|
@@ -18689,6 +19350,10 @@ function requireWebsocket () {
|
|
|
18689
19350
|
* masking key
|
|
18690
19351
|
* @param {Number} [options.handshakeTimeout] Timeout in milliseconds for the
|
|
18691
19352
|
* handshake request
|
|
19353
|
+
* @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
|
|
19354
|
+
* buffered data chunks
|
|
19355
|
+
* @param {Number} [options.maxFragments=131072] The maximum number of message
|
|
19356
|
+
* fragments
|
|
18692
19357
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
18693
19358
|
* size
|
|
18694
19359
|
* @param {Number} [options.maxRedirects=10] The maximum number of redirects
|
|
@@ -18709,6 +19374,8 @@ function requireWebsocket () {
|
|
|
18709
19374
|
autoPong: true,
|
|
18710
19375
|
closeTimeout: CLOSE_TIMEOUT,
|
|
18711
19376
|
protocolVersion: protocolVersions[1],
|
|
19377
|
+
maxBufferedChunks: 1024 * 1024,
|
|
19378
|
+
maxFragments: 128 * 1024,
|
|
18712
19379
|
maxPayload: 100 * 1024 * 1024,
|
|
18713
19380
|
skipUTF8Validation: false,
|
|
18714
19381
|
perMessageDeflate: true,
|
|
@@ -19066,6 +19733,8 @@ function requireWebsocket () {
|
|
|
19066
19733
|
websocket.setSocket(socket, head, {
|
|
19067
19734
|
allowSynchronousEvents: opts.allowSynchronousEvents,
|
|
19068
19735
|
generateMask: opts.generateMask,
|
|
19736
|
+
maxBufferedChunks: opts.maxBufferedChunks,
|
|
19737
|
+
maxFragments: opts.maxFragments,
|
|
19069
19738
|
maxPayload: opts.maxPayload,
|
|
19070
19739
|
skipUTF8Validation: opts.skipUTF8Validation
|
|
19071
19740
|
});
|
|
@@ -19708,7 +20377,7 @@ function requireWebsocketServer () {
|
|
|
19708
20377
|
hasRequiredWebsocketServer = 1;
|
|
19709
20378
|
|
|
19710
20379
|
const EventEmitter = require$$0$3;
|
|
19711
|
-
const http = require$$2;
|
|
20380
|
+
const http = require$$2$1;
|
|
19712
20381
|
const { Duplex } = require$$0$2;
|
|
19713
20382
|
const { createHash } = require$$3;
|
|
19714
20383
|
|
|
@@ -19748,6 +20417,10 @@ function requireWebsocketServer () {
|
|
|
19748
20417
|
* called
|
|
19749
20418
|
* @param {Function} [options.handleProtocols] A hook to handle protocols
|
|
19750
20419
|
* @param {String} [options.host] The hostname where to bind the server
|
|
20420
|
+
* @param {Number} [options.maxBufferedChunks=1048576] The maximum number of
|
|
20421
|
+
* buffered data chunks
|
|
20422
|
+
* @param {Number} [options.maxFragments=131072] The maximum number of message
|
|
20423
|
+
* fragments
|
|
19751
20424
|
* @param {Number} [options.maxPayload=104857600] The maximum allowed message
|
|
19752
20425
|
* size
|
|
19753
20426
|
* @param {Boolean} [options.noServer=false] Enable no server mode
|
|
@@ -19770,6 +20443,8 @@ function requireWebsocketServer () {
|
|
|
19770
20443
|
options = {
|
|
19771
20444
|
allowSynchronousEvents: true,
|
|
19772
20445
|
autoPong: true,
|
|
20446
|
+
maxBufferedChunks: 1024 * 1024,
|
|
20447
|
+
maxFragments: 128 * 1024,
|
|
19773
20448
|
maxPayload: 100 * 1024 * 1024,
|
|
19774
20449
|
skipUTF8Validation: false,
|
|
19775
20450
|
perMessageDeflate: false,
|
|
@@ -20129,6 +20804,8 @@ function requireWebsocketServer () {
|
|
|
20129
20804
|
|
|
20130
20805
|
ws.setSocket(socket, head, {
|
|
20131
20806
|
allowSynchronousEvents: this.options.allowSynchronousEvents,
|
|
20807
|
+
maxBufferedChunks: this.options.maxBufferedChunks,
|
|
20808
|
+
maxFragments: this.options.maxFragments,
|
|
20132
20809
|
maxPayload: this.options.maxPayload,
|
|
20133
20810
|
skipUTF8Validation: this.options.skipUTF8Validation
|
|
20134
20811
|
});
|
|
@@ -20273,7 +20950,7 @@ function requireMain () {
|
|
|
20273
20950
|
hasRequiredMain = 1;
|
|
20274
20951
|
const fs = require$$0$4;
|
|
20275
20952
|
const path = require$$1$1;
|
|
20276
|
-
const os = require$$2$
|
|
20953
|
+
const os = require$$2$2;
|
|
20277
20954
|
const crypto = require$$3;
|
|
20278
20955
|
|
|
20279
20956
|
// Array of tips to display randomly
|