@tuturuuu/internal-api 0.7.1 → 0.9.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/dist/external-projects.d.ts.map +1 -1
- package/dist/external-projects.js +20 -10
- package/dist/index.d.ts +5 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +19 -6
- package/dist/infrastructure.d.ts +37 -1
- package/dist/infrastructure.d.ts.map +1 -1
- package/dist/infrastructure.js +53 -2
- package/dist/inventory.d.ts +303 -5
- package/dist/inventory.d.ts.map +1 -1
- package/dist/inventory.js +247 -2
- package/dist/rate-limits.d.ts +94 -0
- package/dist/rate-limits.d.ts.map +1 -0
- package/dist/rate-limits.js +74 -0
- package/dist/reports.d.ts +44 -1
- package/dist/reports.d.ts.map +1 -1
- package/dist/reports.js +11 -0
- package/dist/tasks.d.ts +36 -1
- package/dist/tasks.d.ts.map +1 -1
- package/dist/tasks.js +74 -4
- package/dist/teach.d.ts +33 -0
- package/dist/teach.d.ts.map +1 -1
- package/dist/teach.js +25 -0
- package/dist/topic-announcements.d.ts +1 -1
- package/dist/topic-announcements.d.ts.map +1 -1
- package/dist/tulearn.d.ts +34 -0
- package/dist/tulearn.d.ts.map +1 -1
- package/dist/tulearn.js +20 -0
- package/dist/users.d.ts +85 -0
- package/dist/users.d.ts.map +1 -1
- package/dist/users.js +91 -0
- package/dist/workspaces.d.ts +0 -1
- package/dist/workspaces.d.ts.map +1 -1
- package/package.json +8 -3
package/dist/inventory.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SUPPORTED_POLAR_CURRENCIES = void 0;
|
|
4
|
+
exports.toPolarCurrency = toPolarCurrency;
|
|
3
5
|
exports.createInventoryMediaUploadUrl = createInventoryMediaUploadUrl;
|
|
6
|
+
exports.createInventoryMediaReadUrl = createInventoryMediaReadUrl;
|
|
4
7
|
exports.uploadInventoryMedia = uploadInventoryMedia;
|
|
5
8
|
exports.listInventoryStorefronts = listInventoryStorefronts;
|
|
6
9
|
exports.getInventoryStorefront = getInventoryStorefront;
|
|
@@ -37,6 +40,9 @@ exports.createInventoryBatch = createInventoryBatch;
|
|
|
37
40
|
exports.updateInventoryBatch = updateInventoryBatch;
|
|
38
41
|
exports.deleteInventoryBatch = deleteInventoryBatch;
|
|
39
42
|
exports.listInventoryPromotions = listInventoryPromotions;
|
|
43
|
+
exports.createInventoryPromotion = createInventoryPromotion;
|
|
44
|
+
exports.updateInventoryPromotion = updateInventoryPromotion;
|
|
45
|
+
exports.deleteInventoryPromotion = deleteInventoryPromotion;
|
|
40
46
|
exports.listInventoryManufacturers = listInventoryManufacturers;
|
|
41
47
|
exports.listInventoryManufacturersPage = listInventoryManufacturersPage;
|
|
42
48
|
exports.listInventoryOwners = listInventoryOwners;
|
|
@@ -46,6 +52,7 @@ exports.deleteInventoryOwner = deleteInventoryOwner;
|
|
|
46
52
|
exports.listInventoryUnits = listInventoryUnits;
|
|
47
53
|
exports.listInventoryUnitsPage = listInventoryUnitsPage;
|
|
48
54
|
exports.listInventorySales = listInventorySales;
|
|
55
|
+
exports.listInventorySalesByProduct = listInventorySalesByProduct;
|
|
49
56
|
exports.getInventorySale = getInventorySale;
|
|
50
57
|
exports.updateInventorySale = updateInventorySale;
|
|
51
58
|
exports.deleteInventorySale = deleteInventorySale;
|
|
@@ -63,6 +70,10 @@ exports.listInventoryStorefrontListings = listInventoryStorefrontListings;
|
|
|
63
70
|
exports.createInventoryStorefrontListing = createInventoryStorefrontListing;
|
|
64
71
|
exports.updateInventoryStorefrontListing = updateInventoryStorefrontListing;
|
|
65
72
|
exports.deleteInventoryStorefrontListing = deleteInventoryStorefrontListing;
|
|
73
|
+
exports.listInventoryOptionTemplates = listInventoryOptionTemplates;
|
|
74
|
+
exports.createInventoryOptionTemplate = createInventoryOptionTemplate;
|
|
75
|
+
exports.updateInventoryOptionTemplate = updateInventoryOptionTemplate;
|
|
76
|
+
exports.deleteInventoryOptionTemplate = deleteInventoryOptionTemplate;
|
|
66
77
|
exports.listInventoryBundles = listInventoryBundles;
|
|
67
78
|
exports.createInventoryBundle = createInventoryBundle;
|
|
68
79
|
exports.updateInventoryBundle = updateInventoryBundle;
|
|
@@ -71,11 +82,159 @@ exports.listInventoryCheckouts = listInventoryCheckouts;
|
|
|
71
82
|
exports.releaseInventoryCheckout = releaseInventoryCheckout;
|
|
72
83
|
exports.getInventoryPolarSettings = getInventoryPolarSettings;
|
|
73
84
|
exports.updateInventoryPolarSettings = updateInventoryPolarSettings;
|
|
85
|
+
exports.getInventoryStorefrontAnalytics = getInventoryStorefrontAnalytics;
|
|
86
|
+
exports.getInventoryPolarSyncSummary = getInventoryPolarSyncSummary;
|
|
87
|
+
exports.syncInventoryPolarProducts = syncInventoryPolarProducts;
|
|
74
88
|
exports.getInventoryPublicStorefront = getInventoryPublicStorefront;
|
|
75
89
|
exports.createInventoryCheckoutSession = createInventoryCheckoutSession;
|
|
90
|
+
exports.recordInventoryStorefrontAnalyticsEvent = recordInventoryStorefrontAnalyticsEvent;
|
|
76
91
|
exports.getInventoryPublicOrder = getInventoryPublicOrder;
|
|
77
92
|
const client_1 = require("./client");
|
|
78
93
|
const storage_1 = require("./storage");
|
|
94
|
+
exports.SUPPORTED_POLAR_CURRENCIES = [
|
|
95
|
+
'AED',
|
|
96
|
+
'ALL',
|
|
97
|
+
'AMD',
|
|
98
|
+
'AOA',
|
|
99
|
+
'ARS',
|
|
100
|
+
'AUD',
|
|
101
|
+
'AWG',
|
|
102
|
+
'AZN',
|
|
103
|
+
'BAM',
|
|
104
|
+
'BBD',
|
|
105
|
+
'BDT',
|
|
106
|
+
'BIF',
|
|
107
|
+
'BMD',
|
|
108
|
+
'BND',
|
|
109
|
+
'BOB',
|
|
110
|
+
'BRL',
|
|
111
|
+
'BSD',
|
|
112
|
+
'BWP',
|
|
113
|
+
'BZD',
|
|
114
|
+
'CAD',
|
|
115
|
+
'CDF',
|
|
116
|
+
'CHF',
|
|
117
|
+
'CLP',
|
|
118
|
+
'CNY',
|
|
119
|
+
'COP',
|
|
120
|
+
'CRC',
|
|
121
|
+
'CVE',
|
|
122
|
+
'CZK',
|
|
123
|
+
'DJF',
|
|
124
|
+
'DKK',
|
|
125
|
+
'DOP',
|
|
126
|
+
'DZD',
|
|
127
|
+
'EGP',
|
|
128
|
+
'ETB',
|
|
129
|
+
'EUR',
|
|
130
|
+
'FJD',
|
|
131
|
+
'FKP',
|
|
132
|
+
'GBP',
|
|
133
|
+
'GEL',
|
|
134
|
+
'GIP',
|
|
135
|
+
'GMD',
|
|
136
|
+
'GNF',
|
|
137
|
+
'GTQ',
|
|
138
|
+
'GYD',
|
|
139
|
+
'HKD',
|
|
140
|
+
'HNL',
|
|
141
|
+
'HTG',
|
|
142
|
+
'HUF',
|
|
143
|
+
'IDR',
|
|
144
|
+
'ILS',
|
|
145
|
+
'INR',
|
|
146
|
+
'ISK',
|
|
147
|
+
'JMD',
|
|
148
|
+
'JPY',
|
|
149
|
+
'KES',
|
|
150
|
+
'KGS',
|
|
151
|
+
'KHR',
|
|
152
|
+
'KMF',
|
|
153
|
+
'KRW',
|
|
154
|
+
'KYD',
|
|
155
|
+
'KZT',
|
|
156
|
+
'LAK',
|
|
157
|
+
'LKR',
|
|
158
|
+
'LRD',
|
|
159
|
+
'LSL',
|
|
160
|
+
'MAD',
|
|
161
|
+
'MDL',
|
|
162
|
+
'MGA',
|
|
163
|
+
'MKD',
|
|
164
|
+
'MNT',
|
|
165
|
+
'MOP',
|
|
166
|
+
'MUR',
|
|
167
|
+
'MVR',
|
|
168
|
+
'MWK',
|
|
169
|
+
'MXN',
|
|
170
|
+
'MYR',
|
|
171
|
+
'MZN',
|
|
172
|
+
'NAD',
|
|
173
|
+
'NGN',
|
|
174
|
+
'NIO',
|
|
175
|
+
'NOK',
|
|
176
|
+
'NPR',
|
|
177
|
+
'NZD',
|
|
178
|
+
'PAB',
|
|
179
|
+
'PEN',
|
|
180
|
+
'PGK',
|
|
181
|
+
'PHP',
|
|
182
|
+
'PKR',
|
|
183
|
+
'PLN',
|
|
184
|
+
'PYG',
|
|
185
|
+
'QAR',
|
|
186
|
+
'RON',
|
|
187
|
+
'RSD',
|
|
188
|
+
'RWF',
|
|
189
|
+
'SAR',
|
|
190
|
+
'SBD',
|
|
191
|
+
'SCR',
|
|
192
|
+
'SEK',
|
|
193
|
+
'SGD',
|
|
194
|
+
'SHP',
|
|
195
|
+
'SOS',
|
|
196
|
+
'SRD',
|
|
197
|
+
'SZL',
|
|
198
|
+
'THB',
|
|
199
|
+
'TJS',
|
|
200
|
+
'TOP',
|
|
201
|
+
'TRY',
|
|
202
|
+
'TTD',
|
|
203
|
+
'TWD',
|
|
204
|
+
'TZS',
|
|
205
|
+
'UAH',
|
|
206
|
+
'UGX',
|
|
207
|
+
'USD',
|
|
208
|
+
'UYU',
|
|
209
|
+
'UZS',
|
|
210
|
+
'VND',
|
|
211
|
+
'VUV',
|
|
212
|
+
'WST',
|
|
213
|
+
'XAF',
|
|
214
|
+
'XCD',
|
|
215
|
+
'XCG',
|
|
216
|
+
'XOF',
|
|
217
|
+
'XPF',
|
|
218
|
+
'YER',
|
|
219
|
+
'ZAR',
|
|
220
|
+
'ZMW',
|
|
221
|
+
];
|
|
222
|
+
/**
|
|
223
|
+
* Normalizes a currency code for the Polar API boundary.
|
|
224
|
+
*
|
|
225
|
+
* Internally we store/display currencies uppercase (`USD`), but the Polar SDK's
|
|
226
|
+
* Zod enum only accepts lowercase ISO 4217 codes (`usd`). Sending the uppercase
|
|
227
|
+
* value makes Polar reject the checkout/price/discount with an
|
|
228
|
+
* `invalid_value` error. Always pass currency through this helper right before
|
|
229
|
+
* a Polar call. Unknown/empty values fall back to `usd`.
|
|
230
|
+
*/
|
|
231
|
+
function toPolarCurrency(currency) {
|
|
232
|
+
const normalized = (currency ?? 'USD').trim().toUpperCase();
|
|
233
|
+
const supported = exports.SUPPORTED_POLAR_CURRENCIES.includes(normalized)
|
|
234
|
+
? normalized
|
|
235
|
+
: 'USD';
|
|
236
|
+
return supported.toLowerCase();
|
|
237
|
+
}
|
|
79
238
|
function workspaceInventoryPath(wsId, suffix) {
|
|
80
239
|
return `/api/v1/workspaces/${(0, client_1.encodePathSegment)(wsId)}/inventory${suffix}`;
|
|
81
240
|
}
|
|
@@ -115,6 +274,14 @@ async function createInventoryMediaUploadUrl(wsId, payload, options) {
|
|
|
115
274
|
method: 'POST',
|
|
116
275
|
});
|
|
117
276
|
}
|
|
277
|
+
async function createInventoryMediaReadUrl(wsId, payload, options) {
|
|
278
|
+
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, '/media/read-url'), {
|
|
279
|
+
body: JSON.stringify(payload),
|
|
280
|
+
cache: 'no-store',
|
|
281
|
+
headers: jsonHeaders(options?.defaultHeaders),
|
|
282
|
+
method: 'POST',
|
|
283
|
+
});
|
|
284
|
+
}
|
|
118
285
|
async function uploadInventoryMedia(wsId, file, target, options) {
|
|
119
286
|
const uploadTarget = await createInventoryMediaUploadUrl(wsId, {
|
|
120
287
|
contentType: file.type || undefined,
|
|
@@ -124,11 +291,18 @@ async function uploadInventoryMedia(wsId, file, target, options) {
|
|
|
124
291
|
}, options);
|
|
125
292
|
const uploadPayload = (0, storage_1.parseSignedUploadPayload)(uploadTarget);
|
|
126
293
|
await (0, storage_1.uploadFileWithSignedUrl)(file, uploadPayload, options?.fetch ?? globalThis.fetch, options?.onUploadProgress);
|
|
294
|
+
const readUrl = uploadTarget.readUrl ??
|
|
295
|
+
(await createInventoryMediaReadUrl(wsId, {
|
|
296
|
+
path: uploadPayload.path,
|
|
297
|
+
provider: uploadPayload.provider,
|
|
298
|
+
}, options)).readUrl;
|
|
299
|
+
if (!readUrl)
|
|
300
|
+
throw new Error('Inventory media read URL is missing');
|
|
127
301
|
return {
|
|
128
302
|
fullPath: uploadPayload.fullPath,
|
|
129
303
|
path: uploadPayload.path,
|
|
130
304
|
target: uploadTarget.target,
|
|
131
|
-
url:
|
|
305
|
+
url: readUrl,
|
|
132
306
|
};
|
|
133
307
|
}
|
|
134
308
|
function listInventoryStorefronts(wsId, query, options) {
|
|
@@ -198,7 +372,7 @@ function listInventoryProducts(wsId, query, options) {
|
|
|
198
372
|
});
|
|
199
373
|
}
|
|
200
374
|
function createInventoryProduct(wsId, payload, options) {
|
|
201
|
-
return (0, client_1.getInternalApiClient)(options).json(
|
|
375
|
+
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, '/products'), {
|
|
202
376
|
body: JSON.stringify(payload),
|
|
203
377
|
headers: jsonHeaders(options?.defaultHeaders),
|
|
204
378
|
method: 'POST',
|
|
@@ -338,6 +512,26 @@ function listInventoryPromotions(wsId, query, options) {
|
|
|
338
512
|
}),
|
|
339
513
|
});
|
|
340
514
|
}
|
|
515
|
+
function createInventoryPromotion(wsId, payload, options) {
|
|
516
|
+
return (0, client_1.getInternalApiClient)(options).json(workspacePath(wsId, '/promotions'), {
|
|
517
|
+
body: JSON.stringify(payload),
|
|
518
|
+
headers: jsonHeaders(options?.defaultHeaders),
|
|
519
|
+
method: 'POST',
|
|
520
|
+
});
|
|
521
|
+
}
|
|
522
|
+
function updateInventoryPromotion(wsId, promotionId, payload, options) {
|
|
523
|
+
return (0, client_1.getInternalApiClient)(options).json(workspacePath(wsId, `/promotions/${(0, client_1.encodePathSegment)(promotionId)}`), {
|
|
524
|
+
body: JSON.stringify(payload),
|
|
525
|
+
headers: jsonHeaders(options?.defaultHeaders),
|
|
526
|
+
method: 'PUT',
|
|
527
|
+
});
|
|
528
|
+
}
|
|
529
|
+
function deleteInventoryPromotion(wsId, promotionId, options) {
|
|
530
|
+
return (0, client_1.getInternalApiClient)(options).json(workspacePath(wsId, `/promotions/${(0, client_1.encodePathSegment)(promotionId)}`), {
|
|
531
|
+
headers: jsonHeaders(options?.defaultHeaders),
|
|
532
|
+
method: 'DELETE',
|
|
533
|
+
});
|
|
534
|
+
}
|
|
341
535
|
function listInventoryManufacturers(wsId, options) {
|
|
342
536
|
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, '/manufacturers'), {
|
|
343
537
|
cache: 'no-store',
|
|
@@ -391,6 +585,11 @@ function listInventorySales(wsId, query, options) {
|
|
|
391
585
|
query: asQuery(query),
|
|
392
586
|
});
|
|
393
587
|
}
|
|
588
|
+
function listInventorySalesByProduct(wsId, options) {
|
|
589
|
+
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, '/sales/by-product'), {
|
|
590
|
+
cache: 'no-store',
|
|
591
|
+
});
|
|
592
|
+
}
|
|
394
593
|
function getInventorySale(wsId, saleId, options) {
|
|
395
594
|
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, `/sales/${(0, client_1.encodePathSegment)(saleId)}`), { cache: 'no-store' });
|
|
396
595
|
}
|
|
@@ -499,6 +698,31 @@ function deleteInventoryStorefrontListing(wsId, storefrontId, listingId, options
|
|
|
499
698
|
method: 'DELETE',
|
|
500
699
|
});
|
|
501
700
|
}
|
|
701
|
+
function listInventoryOptionTemplates(wsId, options) {
|
|
702
|
+
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, '/option-templates'), {
|
|
703
|
+
cache: 'no-store',
|
|
704
|
+
});
|
|
705
|
+
}
|
|
706
|
+
function createInventoryOptionTemplate(wsId, payload, options) {
|
|
707
|
+
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, '/option-templates'), {
|
|
708
|
+
body: JSON.stringify(payload),
|
|
709
|
+
headers: jsonHeaders(options?.defaultHeaders),
|
|
710
|
+
method: 'POST',
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
function updateInventoryOptionTemplate(wsId, templateId, payload, options) {
|
|
714
|
+
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, `/option-templates/${(0, client_1.encodePathSegment)(templateId)}`), {
|
|
715
|
+
body: JSON.stringify(payload),
|
|
716
|
+
headers: jsonHeaders(options?.defaultHeaders),
|
|
717
|
+
method: 'PATCH',
|
|
718
|
+
});
|
|
719
|
+
}
|
|
720
|
+
function deleteInventoryOptionTemplate(wsId, templateId, options) {
|
|
721
|
+
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, `/option-templates/${(0, client_1.encodePathSegment)(templateId)}`), {
|
|
722
|
+
headers: options?.defaultHeaders,
|
|
723
|
+
method: 'DELETE',
|
|
724
|
+
});
|
|
725
|
+
}
|
|
502
726
|
function listInventoryBundles(wsId, query, options) {
|
|
503
727
|
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, '/bundles'), {
|
|
504
728
|
cache: 'no-store',
|
|
@@ -547,6 +771,19 @@ function updateInventoryPolarSettings(wsId, payload, options) {
|
|
|
547
771
|
method: 'PUT',
|
|
548
772
|
});
|
|
549
773
|
}
|
|
774
|
+
function getInventoryStorefrontAnalytics(wsId, query, options) {
|
|
775
|
+
const suffix = query?.days ? `?days=${query.days}` : '';
|
|
776
|
+
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, `/analytics${suffix}`), { cache: 'no-store' });
|
|
777
|
+
}
|
|
778
|
+
function getInventoryPolarSyncSummary(wsId, options) {
|
|
779
|
+
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, '/polar-product-sync'), { cache: 'no-store' });
|
|
780
|
+
}
|
|
781
|
+
function syncInventoryPolarProducts(wsId, options) {
|
|
782
|
+
return (0, client_1.getInternalApiClient)(options).json(workspaceInventoryPath(wsId, '/polar-product-sync'), {
|
|
783
|
+
headers: jsonHeaders(options?.defaultHeaders),
|
|
784
|
+
method: 'POST',
|
|
785
|
+
});
|
|
786
|
+
}
|
|
550
787
|
function getInventoryPublicStorefront(slug, options) {
|
|
551
788
|
return (0, client_1.getInternalApiClient)(options).json(publicStorefrontPath(slug), { cache: 'no-store' });
|
|
552
789
|
}
|
|
@@ -557,6 +794,14 @@ function createInventoryCheckoutSession(slug, payload, options) {
|
|
|
557
794
|
method: 'POST',
|
|
558
795
|
});
|
|
559
796
|
}
|
|
797
|
+
function recordInventoryStorefrontAnalyticsEvent(slug, payload, options) {
|
|
798
|
+
return (0, client_1.getInternalApiClient)(options).json(publicStorefrontPath(slug, '/analytics/events'), {
|
|
799
|
+
body: JSON.stringify(payload),
|
|
800
|
+
cache: 'no-store',
|
|
801
|
+
headers: jsonHeaders(options?.defaultHeaders),
|
|
802
|
+
method: 'POST',
|
|
803
|
+
});
|
|
804
|
+
}
|
|
560
805
|
function getInventoryPublicOrder(publicToken, options) {
|
|
561
806
|
return (0, client_1.getInternalApiClient)(options).json(`/api/v1/inventory/orders/${(0, client_1.encodePathSegment)(publicToken)}`, {
|
|
562
807
|
cache: 'no-store',
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { type InternalApiClientOptions } from './client';
|
|
2
|
+
import type { AbuseReputationSubjectType, AbuseRiskTier, AbuseTrustOverride, RateLimitAbsoluteLimits, RateLimitMode } from './infrastructure';
|
|
3
|
+
export type { RateLimitAbsoluteLimits, RateLimitMode, } from './infrastructure';
|
|
4
|
+
/** A rate-limit rule is an abuse_trust_override row with mode/absolute fields. */
|
|
5
|
+
export type RateLimitRule = AbuseTrustOverride;
|
|
6
|
+
export interface RateLimitWindowTriple {
|
|
7
|
+
day: number;
|
|
8
|
+
hour: number;
|
|
9
|
+
minute: number;
|
|
10
|
+
}
|
|
11
|
+
export interface RateLimitWriteBaseLimits {
|
|
12
|
+
anonymous: RateLimitWindowTriple;
|
|
13
|
+
userBackstop: RateLimitWindowTriple;
|
|
14
|
+
userIp: RateLimitWindowTriple;
|
|
15
|
+
}
|
|
16
|
+
export interface RateLimitRulesSummary {
|
|
17
|
+
blockedCount: number;
|
|
18
|
+
byMode: Record<string, number>;
|
|
19
|
+
bySubjectType: Record<string, number>;
|
|
20
|
+
total: number;
|
|
21
|
+
unlimitedCount: number;
|
|
22
|
+
}
|
|
23
|
+
export interface RateLimitRulesResponse {
|
|
24
|
+
/** Subject keys whose rule is currently live in the edge trust cache. */
|
|
25
|
+
edgeCachedSubjectKeys: string[];
|
|
26
|
+
rules: RateLimitRule[];
|
|
27
|
+
summary: RateLimitRulesSummary;
|
|
28
|
+
writeBaseLimits: RateLimitWriteBaseLimits;
|
|
29
|
+
}
|
|
30
|
+
export interface RateLimitWriteCounter {
|
|
31
|
+
bucket: string;
|
|
32
|
+
current_count: number;
|
|
33
|
+
window_seconds: number;
|
|
34
|
+
window_started_at: string;
|
|
35
|
+
}
|
|
36
|
+
export interface RateLimitLiveUsageResponse {
|
|
37
|
+
readBuckets: {
|
|
38
|
+
available: boolean;
|
|
39
|
+
cursor: string;
|
|
40
|
+
keys: string[];
|
|
41
|
+
};
|
|
42
|
+
writeCounters: RateLimitWriteCounter[];
|
|
43
|
+
}
|
|
44
|
+
export interface GetRateLimitRulesParams {
|
|
45
|
+
includeRevoked?: boolean;
|
|
46
|
+
limit?: number;
|
|
47
|
+
q?: string;
|
|
48
|
+
subjectType?: AbuseReputationSubjectType;
|
|
49
|
+
}
|
|
50
|
+
export interface CreateRateLimitRulePayload {
|
|
51
|
+
absoluteLimits?: RateLimitAbsoluteLimits | null;
|
|
52
|
+
expiresAt?: string | null;
|
|
53
|
+
limitMode?: RateLimitMode;
|
|
54
|
+
metadata?: Record<string, unknown>;
|
|
55
|
+
reason: string;
|
|
56
|
+
subjectKey: string;
|
|
57
|
+
subjectType: AbuseReputationSubjectType;
|
|
58
|
+
tier: AbuseRiskTier;
|
|
59
|
+
trustMultiplier?: number;
|
|
60
|
+
}
|
|
61
|
+
export interface UpdateRateLimitRulePayload {
|
|
62
|
+
absoluteLimits?: RateLimitAbsoluteLimits | null;
|
|
63
|
+
expiresAt?: string | null;
|
|
64
|
+
limitMode?: RateLimitMode;
|
|
65
|
+
reason?: string;
|
|
66
|
+
tier?: AbuseRiskTier;
|
|
67
|
+
trustMultiplier?: number;
|
|
68
|
+
}
|
|
69
|
+
export interface RevokeRateLimitRulePayload {
|
|
70
|
+
reason: string;
|
|
71
|
+
}
|
|
72
|
+
export interface RateLimitRuleResponse {
|
|
73
|
+
rule: RateLimitRule;
|
|
74
|
+
}
|
|
75
|
+
export interface WorkspaceRateLimitSecretsResponse {
|
|
76
|
+
managedNames: string[];
|
|
77
|
+
secrets: Record<string, string>;
|
|
78
|
+
wsId: string;
|
|
79
|
+
}
|
|
80
|
+
export interface SaveWorkspaceRateLimitSecretsPayload {
|
|
81
|
+
secrets: Record<string, string | null>;
|
|
82
|
+
wsId: string;
|
|
83
|
+
}
|
|
84
|
+
export declare function getRateLimitRules(params?: GetRateLimitRulesParams, options?: InternalApiClientOptions): Promise<RateLimitRulesResponse>;
|
|
85
|
+
export declare function createRateLimitRule(payload: CreateRateLimitRulePayload, options?: InternalApiClientOptions): Promise<RateLimitRuleResponse>;
|
|
86
|
+
export declare function updateRateLimitRule(ruleId: string, payload: UpdateRateLimitRulePayload, options?: InternalApiClientOptions): Promise<RateLimitRuleResponse>;
|
|
87
|
+
export declare function revokeRateLimitRule(ruleId: string, payload: RevokeRateLimitRulePayload, options?: InternalApiClientOptions): Promise<RateLimitRuleResponse>;
|
|
88
|
+
export declare function getRateLimitLiveUsage(options?: InternalApiClientOptions): Promise<RateLimitLiveUsageResponse>;
|
|
89
|
+
export declare function getWorkspaceRateLimitSecrets(wsId: string, options?: InternalApiClientOptions): Promise<WorkspaceRateLimitSecretsResponse>;
|
|
90
|
+
export declare function saveWorkspaceRateLimitSecrets(payload: SaveWorkspaceRateLimitSecretsPayload, options?: InternalApiClientOptions): Promise<{
|
|
91
|
+
ok: boolean;
|
|
92
|
+
wsId: string;
|
|
93
|
+
}>;
|
|
94
|
+
//# sourceMappingURL=rate-limits.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rate-limits.d.ts","sourceRoot":"","sources":["../src/rate-limits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAwB,KAAK,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAC/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G,IAAI,CAAC,CAAC;IACvC,IAAI,EAAE,MAAM,CAAC;CACd;AAID,wBAAsB,iBAAiB,CACrC,MAAM,CAAC,EAAE,uBAAuB,EAChC,OAAO,CAAC,EAAE,wBAAwB,mCAsBnC;AAED,wBAAsB,mBAAmB,CACvC,OAAO,EAAE,0BAA0B,EACnC,OAAO,CAAC,EAAE,wBAAwB,kCASnC;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,0BAA0B,EACnC,OAAO,CAAC,EAAE,wBAAwB,kCAYnC;AAED,wBAAsB,mBAAmB,CACvC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,0BAA0B,EACnC,OAAO,CAAC,EAAE,wBAAwB,kCAYnC;AAED,wBAAsB,qBAAqB,CACzC,OAAO,CAAC,EAAE,wBAAwB,uCAMnC;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,MAAM,EACZ,OAAO,CAAC,EAAE,wBAAwB,8CAOnC;AAED,wBAAsB,6BAA6B,CACjD,OAAO,EAAE,oCAAoC,EAC7C,OAAO,CAAC,EAAE,wBAAwB;QAGT,OAAO;UAAQ,MAAM;GAS/C"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getRateLimitRules = getRateLimitRules;
|
|
4
|
+
exports.createRateLimitRule = createRateLimitRule;
|
|
5
|
+
exports.updateRateLimitRule = updateRateLimitRule;
|
|
6
|
+
exports.revokeRateLimitRule = revokeRateLimitRule;
|
|
7
|
+
exports.getRateLimitLiveUsage = getRateLimitLiveUsage;
|
|
8
|
+
exports.getWorkspaceRateLimitSecrets = getWorkspaceRateLimitSecrets;
|
|
9
|
+
exports.saveWorkspaceRateLimitSecrets = saveWorkspaceRateLimitSecrets;
|
|
10
|
+
const client_1 = require("./client");
|
|
11
|
+
const BASE_PATH = '/api/v1/infrastructure/rate-limits';
|
|
12
|
+
async function getRateLimitRules(params, options) {
|
|
13
|
+
const client = (0, client_1.getInternalApiClient)(options);
|
|
14
|
+
const searchParams = new URLSearchParams();
|
|
15
|
+
if (params?.limit != null) {
|
|
16
|
+
searchParams.set('limit', String(params.limit));
|
|
17
|
+
}
|
|
18
|
+
if (params?.subjectType) {
|
|
19
|
+
searchParams.set('subjectType', params.subjectType);
|
|
20
|
+
}
|
|
21
|
+
if (params?.q) {
|
|
22
|
+
searchParams.set('q', params.q);
|
|
23
|
+
}
|
|
24
|
+
if (params?.includeRevoked) {
|
|
25
|
+
searchParams.set('includeRevoked', 'true');
|
|
26
|
+
}
|
|
27
|
+
return client.json(`${BASE_PATH}${searchParams.size > 0 ? `?${searchParams.toString()}` : ''}`, { cache: 'no-store' });
|
|
28
|
+
}
|
|
29
|
+
async function createRateLimitRule(payload, options) {
|
|
30
|
+
const client = (0, client_1.getInternalApiClient)(options);
|
|
31
|
+
return client.json(BASE_PATH, {
|
|
32
|
+
body: JSON.stringify(payload),
|
|
33
|
+
cache: 'no-store',
|
|
34
|
+
headers: { 'Content-Type': 'application/json' },
|
|
35
|
+
method: 'POST',
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async function updateRateLimitRule(ruleId, payload, options) {
|
|
39
|
+
const client = (0, client_1.getInternalApiClient)(options);
|
|
40
|
+
return client.json(`${BASE_PATH}/rules/${encodeURIComponent(ruleId)}`, {
|
|
41
|
+
body: JSON.stringify(payload),
|
|
42
|
+
cache: 'no-store',
|
|
43
|
+
headers: { 'Content-Type': 'application/json' },
|
|
44
|
+
method: 'PATCH',
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
async function revokeRateLimitRule(ruleId, payload, options) {
|
|
48
|
+
const client = (0, client_1.getInternalApiClient)(options);
|
|
49
|
+
return client.json(`${BASE_PATH}/rules/${encodeURIComponent(ruleId)}`, {
|
|
50
|
+
body: JSON.stringify(payload),
|
|
51
|
+
cache: 'no-store',
|
|
52
|
+
headers: { 'Content-Type': 'application/json' },
|
|
53
|
+
method: 'DELETE',
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
async function getRateLimitLiveUsage(options) {
|
|
57
|
+
const client = (0, client_1.getInternalApiClient)(options);
|
|
58
|
+
return client.json(`${BASE_PATH}/live-usage`, {
|
|
59
|
+
cache: 'no-store',
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
async function getWorkspaceRateLimitSecrets(wsId, options) {
|
|
63
|
+
const client = (0, client_1.getInternalApiClient)(options);
|
|
64
|
+
return client.json(`${BASE_PATH}/workspace-secrets?wsId=${encodeURIComponent(wsId)}`, { cache: 'no-store' });
|
|
65
|
+
}
|
|
66
|
+
async function saveWorkspaceRateLimitSecrets(payload, options) {
|
|
67
|
+
const client = (0, client_1.getInternalApiClient)(options);
|
|
68
|
+
return client.json(`${BASE_PATH}/workspace-secrets`, {
|
|
69
|
+
body: JSON.stringify(payload),
|
|
70
|
+
cache: 'no-store',
|
|
71
|
+
headers: { 'Content-Type': 'application/json' },
|
|
72
|
+
method: 'PUT',
|
|
73
|
+
});
|
|
74
|
+
}
|
package/dist/reports.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { Product, SupportType } from '@tuturuuu/types';
|
|
1
|
+
import type { Product, SupportType, WorkspaceUserReport } from '@tuturuuu/types';
|
|
2
|
+
import type { WorkspaceUser } from '@tuturuuu/types/primitives/WorkspaceUser';
|
|
2
3
|
import { type InternalApiClientOptions } from './client';
|
|
3
4
|
export interface CreateReportUploadUrlPayload {
|
|
4
5
|
filename: string;
|
|
@@ -35,8 +36,50 @@ export interface SubmitReportResponse {
|
|
|
35
36
|
reportId: string;
|
|
36
37
|
uploadedMedia: string[];
|
|
37
38
|
}
|
|
39
|
+
export type WorkspaceGroupReportDashboardReport = WorkspaceUserReport & {
|
|
40
|
+
creator_name?: string | null;
|
|
41
|
+
group_name?: string | null;
|
|
42
|
+
user_archived?: boolean;
|
|
43
|
+
user_archived_until?: string | null;
|
|
44
|
+
user_name?: string | null;
|
|
45
|
+
user_note?: string | null;
|
|
46
|
+
};
|
|
47
|
+
export interface WorkspaceGroupReportDashboardResponse {
|
|
48
|
+
group: {
|
|
49
|
+
id: string;
|
|
50
|
+
name: string | null;
|
|
51
|
+
};
|
|
52
|
+
managers: Array<{
|
|
53
|
+
id: string;
|
|
54
|
+
full_name: string | null;
|
|
55
|
+
}>;
|
|
56
|
+
reportDetail: WorkspaceGroupReportDashboardReport | null;
|
|
57
|
+
reports: WorkspaceGroupReportDashboardReport[];
|
|
58
|
+
userGroupMetrics: Array<{
|
|
59
|
+
factor: number;
|
|
60
|
+
id: string;
|
|
61
|
+
is_weighted: boolean;
|
|
62
|
+
name: string;
|
|
63
|
+
unit: string;
|
|
64
|
+
value: number | null;
|
|
65
|
+
}>;
|
|
66
|
+
userStatusSummary: Array<{
|
|
67
|
+
approved_count: number;
|
|
68
|
+
pending_count: number;
|
|
69
|
+
rejected_count: number;
|
|
70
|
+
user_id: string;
|
|
71
|
+
}>;
|
|
72
|
+
users: WorkspaceUser[];
|
|
73
|
+
}
|
|
74
|
+
export interface ListWorkspaceGroupReportDashboardParams {
|
|
75
|
+
groupId: string;
|
|
76
|
+
reportId?: string | null;
|
|
77
|
+
userId?: string | null;
|
|
78
|
+
workspaceId: string;
|
|
79
|
+
}
|
|
38
80
|
export declare function createReportUploadUrl(payload: CreateReportUploadUrlPayload, options?: InternalApiClientOptions): Promise<CreateReportUploadUrlResponse>;
|
|
39
81
|
export declare function createReportUploadUrls(payload: CreateReportUploadUrlsPayload, options?: InternalApiClientOptions): Promise<CreateReportUploadUrlsResponse>;
|
|
40
82
|
export declare function deleteReportUploadPaths(payload: DeleteReportUploadPathsPayload, options?: InternalApiClientOptions): Promise<DeleteReportUploadPathsResponse>;
|
|
41
83
|
export declare function submitReport(payload: SubmitReportPayload, options?: InternalApiClientOptions): Promise<SubmitReportResponse>;
|
|
84
|
+
export declare function listWorkspaceGroupReportDashboard({ groupId, reportId, userId, workspaceId, }: ListWorkspaceGroupReportDashboardParams, options?: InternalApiClientOptions): Promise<WorkspaceGroupReportDashboardResponse>;
|
|
42
85
|
//# sourceMappingURL=reports.d.ts.map
|
package/dist/reports.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"reports.d.ts","sourceRoot":"","sources":["../src/reports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"reports.d.ts","sourceRoot":"","sources":["../src/reports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,OAAO,EACP,WAAW,EACX,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAC;AAC9E,OAAO,EAGL,KAAK,wBAAwB,EAC9B,MAAM,UAAU,CAAC;AAElB,MAAM,WAAW,4BAA4B;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,6BAA6B;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,6BAA6B;IAC5C,KAAK,EAAE,4BAA4B,EAAE,CAAC;CACvC;AAED,MAAM,WAAW,8BAA8B;IAC7C,OAAO,EAAE,6BAA6B,EAAE,CAAC;CAC1C;AAED,MAAM,WAAW,8BAA8B;IAC7C,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,+BAA+B;IAC9C,EAAE,EAAE,OAAO,CAAC;CACb;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;A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CAAC,CAAC;IACH,KAAK,EAAE,aAAa,EAAE,CAAC;CACxB;AAED,MAAM,WAAW,uCAAuC;IACtD,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,4BAA4B,EACrC,OAAO,CAAC,EAAE,wBAAwB,0CAUnC;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,6BAA6B,EACtC,OAAO,CAAC,EAAE,wBAAwB,2CAcnC;AAED,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,8BAA8B,EACvC,OAAO,CAAC,EAAE,wBAAwB,4CAcnC;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,mBAAmB,EAC5B,OAAO,CAAC,EAAE,wBAAwB,iCAWnC;AAED,wBAAsB,iCAAiC,CACrD,EACE,OAAO,EACP,QAAQ,EACR,MAAM,EACN,WAAW,GACZ,EAAE,uCAAuC,EAC1C,OAAO,CAAC,EAAE,wBAAwB,kDAcnC"}
|
package/dist/reports.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.createReportUploadUrl = createReportUploadUrl;
|
|
|
4
4
|
exports.createReportUploadUrls = createReportUploadUrls;
|
|
5
5
|
exports.deleteReportUploadPaths = deleteReportUploadPaths;
|
|
6
6
|
exports.submitReport = submitReport;
|
|
7
|
+
exports.listWorkspaceGroupReportDashboard = listWorkspaceGroupReportDashboard;
|
|
7
8
|
const client_1 = require("./client");
|
|
8
9
|
async function createReportUploadUrl(payload, options) {
|
|
9
10
|
const result = await createReportUploadUrls({ files: [payload] }, options);
|
|
@@ -46,3 +47,13 @@ async function submitReport(payload, options) {
|
|
|
46
47
|
cache: 'no-store',
|
|
47
48
|
});
|
|
48
49
|
}
|
|
50
|
+
async function listWorkspaceGroupReportDashboard({ groupId, reportId, userId, workspaceId, }, options) {
|
|
51
|
+
const client = (0, client_1.getInternalApiClient)(options);
|
|
52
|
+
return client.json(`/api/v1/workspaces/${(0, client_1.encodePathSegment)(workspaceId)}/users/reports/groups/${(0, client_1.encodePathSegment)(groupId)}/dashboard`, {
|
|
53
|
+
cache: 'no-store',
|
|
54
|
+
query: {
|
|
55
|
+
reportId: reportId || undefined,
|
|
56
|
+
userId: userId || undefined,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
}
|
package/dist/tasks.d.ts
CHANGED
|
@@ -103,6 +103,21 @@ export interface WorkspaceTaskApiTask extends Task {
|
|
|
103
103
|
is_personal_external?: boolean;
|
|
104
104
|
is_personal_external_default?: boolean;
|
|
105
105
|
}
|
|
106
|
+
export interface WorkspaceTaskDescriptionResponse {
|
|
107
|
+
description: string | null;
|
|
108
|
+
description_yjs_state: number[] | null;
|
|
109
|
+
}
|
|
110
|
+
export interface WorkspaceTaskDescriptionUpdatePayload {
|
|
111
|
+
description?: string | null;
|
|
112
|
+
description_yjs_state?: number[] | null;
|
|
113
|
+
}
|
|
114
|
+
export type WorkspaceTaskDescriptionChunkField = 'description' | 'description_yjs_state';
|
|
115
|
+
export interface WorkspaceTaskDescriptionChunkFieldPlan {
|
|
116
|
+
chunk_count: number;
|
|
117
|
+
total_length: number;
|
|
118
|
+
is_null?: boolean;
|
|
119
|
+
}
|
|
120
|
+
export type WorkspaceTaskDescriptionChunkFields = Partial<Record<WorkspaceTaskDescriptionChunkField, WorkspaceTaskDescriptionChunkFieldPlan>>;
|
|
106
121
|
export interface CurrentUserTaskPersonalPlacementPayload {
|
|
107
122
|
personal_board_id: string;
|
|
108
123
|
personal_list_id?: string | null;
|
|
@@ -115,6 +130,9 @@ export interface CurrentUserTaskPersonalPlacementResponse {
|
|
|
115
130
|
}
|
|
116
131
|
export interface WorkspaceTaskResponse {
|
|
117
132
|
task: WorkspaceTaskApiTask;
|
|
133
|
+
taskWsId?: string;
|
|
134
|
+
taskWorkspacePersonal?: boolean;
|
|
135
|
+
taskWorkspaceTier?: 'FREE' | 'PLUS' | 'PRO' | 'ENTERPRISE';
|
|
118
136
|
}
|
|
119
137
|
export interface CurrentUserTaskDialogResponse {
|
|
120
138
|
task: WorkspaceTaskApiTask;
|
|
@@ -255,7 +273,7 @@ export interface ListWorkspaceBoardsResponse {
|
|
|
255
273
|
boards: WorkspaceBoardNavigationItem[];
|
|
256
274
|
}
|
|
257
275
|
export type CreateWorkspaceTaskBoardPayload = Pick<Database['public']['Tables']['workspace_boards']['Insert'], 'name' | 'icon' | 'template_id'>;
|
|
258
|
-
export type UpdateWorkspaceTaskBoardPayload = Pick<Database['public']['Tables']['workspace_boards']['Update'], 'name' | 'icon' | 'ticket_prefix'> & {
|
|
276
|
+
export type UpdateWorkspaceTaskBoardPayload = Pick<Database['public']['Tables']['workspace_boards']['Update'], 'name' | 'icon' | 'ticket_prefix' | 'default_list_id'> & {
|
|
259
277
|
archived?: boolean;
|
|
260
278
|
group_ids?: string[];
|
|
261
279
|
};
|
|
@@ -554,6 +572,23 @@ export declare function listTaskBoardStatusTemplates(options?: InternalApiClient
|
|
|
554
572
|
templates: TaskBoardStatusTemplate[];
|
|
555
573
|
}>;
|
|
556
574
|
export declare function getWorkspaceTask(workspaceId: string, taskId: string, options?: InternalApiClientOptions): Promise<WorkspaceTaskResponse>;
|
|
575
|
+
export declare function getWorkspaceTaskDescription(workspaceId: string, taskId: string, options?: InternalApiClientOptions): Promise<WorkspaceTaskDescriptionResponse>;
|
|
576
|
+
export declare function updateWorkspaceTaskDescription(workspaceId: string, taskId: string, payload: WorkspaceTaskDescriptionUpdatePayload, options?: InternalApiClientOptions): Promise<WorkspaceTaskDescriptionResponse>;
|
|
577
|
+
export declare function beginWorkspaceTaskDescriptionChunks(workspaceId: string, taskId: string, fields: WorkspaceTaskDescriptionChunkFields, options?: InternalApiClientOptions): Promise<{
|
|
578
|
+
session_id: string;
|
|
579
|
+
}>;
|
|
580
|
+
export declare function appendWorkspaceTaskDescriptionChunk(workspaceId: string, taskId: string, payload: {
|
|
581
|
+
chunk: string;
|
|
582
|
+
chunk_index: number;
|
|
583
|
+
field: WorkspaceTaskDescriptionChunkField;
|
|
584
|
+
session_id: string;
|
|
585
|
+
}, options?: InternalApiClientOptions): Promise<{
|
|
586
|
+
success: true;
|
|
587
|
+
}>;
|
|
588
|
+
export declare function commitWorkspaceTaskDescriptionChunks(workspaceId: string, taskId: string, sessionId: string, options?: InternalApiClientOptions): Promise<WorkspaceTaskDescriptionResponse>;
|
|
589
|
+
export declare function abortWorkspaceTaskDescriptionChunks(workspaceId: string, taskId: string, sessionId: string, options?: InternalApiClientOptions): Promise<{
|
|
590
|
+
success: true;
|
|
591
|
+
}>;
|
|
557
592
|
export declare function getCurrentUserTask(taskId: string, options?: InternalApiClientOptions): Promise<CurrentUserTaskDialogResponse>;
|
|
558
593
|
export declare function getTaskDialogHydration(taskId: string, hydrationOptions?: TaskDialogHydrationOptions, clientOptions?: InternalApiClientOptions): Promise<CurrentUserTaskDialogResponse>;
|
|
559
594
|
export declare function upsertCurrentUserTaskPersonalPlacement(taskId: string, payload: CurrentUserTaskPersonalPlacementPayload, options?: InternalApiClientOptions): Promise<CurrentUserTaskPersonalPlacementResponse>;
|